This commit is contained in:
2026-09-15 10:35:56 +08:00
commit 782f8ea7aa
4086 changed files with 631288 additions and 0 deletions
@@ -0,0 +1,155 @@
.esun-interactive-cards-preview {
padding: 14px;
background: #f4f5f5;
}
.esun-interactive-cards-preview__meta {
display: flex;
align-items: center;
justify-content: space-between;
margin: 0 0 12px;
color: #303030;
}
.esun-interactive-cards-preview__meta span {
color: #687078;
font-size: 12px;
}
.esun-interactive-cards-preview__grid {
display: grid;
grid-template-columns: repeat(3, minmax(0, 1fr));
gap: 12px;
min-height: 120px;
}
.esun-interactive-cards-preview__grid[data-desktop-columns="2"] {
grid-template-columns: repeat(2, minmax(0, 1fr));
}
.esun-interactive-cards-preview__grid[data-desktop-columns="4"] {
grid-template-columns: repeat(4, minmax(0, 1fr));
}
.esun-interactive-cards-preview__empty {
padding: 28px;
border: 1px dashed #adadad;
color: #666;
text-align: center;
}
.esun-interactive-card-preview {
position: relative;
min-height: 180px;
/* overflow: hidden; */
border-radius: 8px;
background: #dfe3e4;
}
.esun-interactive-card-preview__media {
height: 145px;
overflow: hidden;
cursor: grab;
}
.esun-interactive-card-preview__image {
width: 100%;
height: 100%;
object-fit: cover;
}
.esun-interactive-card-preview__body {
display: flex;
flex-direction: column;
gap: 3px;
padding: 10px;
background: #fff;
}
.esun-interactive-card-preview__body strong,
.esun-interactive-card-preview__body span {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.esun-interactive-card-preview__body small {
color: #138d50;
}
.esun-product-cards-preview {
padding: 14px;
background: #f4f5f5;
}
.esun-product-cards-preview__meta {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 12px;
}
.esun-product-cards-preview__meta span {
color: #687078;
font-size: 12px;
}
.esun-product-cards-preview__grid {
display: grid;
grid-template-columns: repeat(3, minmax(0, 1fr));
gap: 12px;
min-height: 120px;
}
.esun-product-cards-preview__grid[data-desktop-columns="2"] {
grid-template-columns: repeat(2, minmax(0, 1fr));
}
.esun-product-cards-preview__grid[data-desktop-columns="4"] {
grid-template-columns: repeat(4, minmax(0, 1fr));
}
.esun-product-cards-preview__empty {
padding: 28px;
border: 1px dashed #adadad;
color: #666;
text-align: center;
}
.esun-product-card-preview {
min-width: 0;
/* overflow: hidden; */
border: 1px solid #d9ebe1;
border-radius: 12px;
background: #fff;
}
.esun-product-card-preview__handle {
display: flex;
align-items: center;
justify-content: center;
aspect-ratio: 1.4 / 1;
padding: 12px;
color: #7b8580;
background: linear-gradient(135deg, #fff, #eef8f2);
text-align: center;
cursor: grab;
}
.esun-product-card-preview__body {
display: flex;
flex-direction: column;
gap: 5px;
padding: 12px;
}
.esun-product-card-preview__body strong,
.esun-product-card-preview__body small {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.esun-product-card-preview__body small {
color: #138d50;
}
@@ -0,0 +1,14 @@
define([
'Magento_PageBuilder/js/content-type/image/preview'
], function (ImagePreview) {
'use strict';
function Preview() {
ImagePreview.apply(this, arguments);
}
Preview.prototype = Object.create(ImagePreview.prototype);
Preview.prototype.constructor = Preview;
return Preview;
});
@@ -0,0 +1,60 @@
define([
'Magento_PageBuilder/js/content-type/preview-collection',
'Magento_PageBuilder/js/content-type-factory',
'Magento_PageBuilder/js/config',
'Magento_PageBuilder/js/content-type-menu/option',
'mage/translate'
], function (PreviewCollection, contentTypeFactory, config, Option, $t) {
'use strict';
function Preview() {
PreviewCollection.apply(this, arguments);
}
Preview.prototype = Object.create(PreviewCollection.prototype);
Preview.prototype.constructor = Preview;
Preview.prototype.retrieveOptions = function () {
var options = PreviewCollection.prototype.retrieveOptions.call(this);
options.add = new Option({
preview: this,
icon: "<i class='icon-pagebuilder-add'></i>",
title: $t('Add Card'),
action: this.addCard.bind(this),
classes: ['add-child'],
sort: 10
});
return options;
};
Preview.prototype.addCard = function () {
var self = this;
return contentTypeFactory(
config.getContentTypeConfig('esun-interactive-card'),
this.contentType,
this.contentType.stageId,
{}
).then(function (card) {
self.contentType.addChild(card);
return card;
}).catch(function (error) {
console.error(error);
});
};
Preview.prototype.getSortableOptions = function () {
return {
handle: '.esun-interactive-card-preview__media',
items: '.pagebuilder-content-type-wrapper',
cursor: 'grabbing',
containment: 'parent',
tolerance: 'pointer',
revert: 150
};
};
return Preview;
});
@@ -0,0 +1,60 @@
define([
'Magento_PageBuilder/js/content-type/preview-collection',
'Magento_PageBuilder/js/content-type-factory',
'Magento_PageBuilder/js/config',
'Magento_PageBuilder/js/content-type-menu/option',
'mage/translate'
], function (PreviewCollection, contentTypeFactory, config, Option, $t) {
'use strict';
function Preview() {
PreviewCollection.apply(this, arguments);
}
Preview.prototype = Object.create(PreviewCollection.prototype);
Preview.prototype.constructor = Preview;
Preview.prototype.retrieveOptions = function () {
var options = PreviewCollection.prototype.retrieveOptions.call(this);
options.add = new Option({
preview: this,
icon: "<i class='icon-pagebuilder-add'></i>",
title: $t('Add Product Card'),
action: this.addCard.bind(this),
classes: ['add-child'],
sort: 10
});
return options;
};
Preview.prototype.addCard = function () {
var self = this;
return contentTypeFactory(
config.getContentTypeConfig('esun-product-card'),
this.contentType,
this.contentType.stageId,
{}
).then(function (card) {
self.contentType.addChild(card);
return card;
}).catch(function (error) {
console.error(error);
});
};
Preview.prototype.getSortableOptions = function () {
return {
handle: '.esun-product-card-preview__handle',
items: '.pagebuilder-content-type-wrapper',
cursor: 'grabbing',
containment: 'parent',
tolerance: 'pointer',
revert: 150
};
};
return Preview;
});
@@ -0,0 +1,25 @@
<article class="esun-interactive-card"
attr="data.main.attributes"
ko-style="data.main.style"
css="data.main.css"
tabindex="0"
aria-expanded="false">
<picture class="esun-interactive-card__picture">
<source if="data.mobile_image.attributes().src"
media="(max-width: 767px)"
attr="{ srcset: data.mobile_image.attributes().src }"/>
<img if="data.desktop_image.attributes().src"
class="esun-interactive-card__image"
attr="data.desktop_image.attributes"/>
</picture>
<div class="esun-interactive-card__shade"></div>
<div class="esun-interactive-card__content">
<h3 class="esun-interactive-card__title"
attr="data.title.attributes"
html="data.title.html"></h3>
<div class="esun-interactive-card__description"
attr="data.description.attributes"
html="data.description.html"></div>
</div>
<div class="esun-interactive-card__product" aria-live="polite"></div>
</article>
@@ -0,0 +1,18 @@
<article class="pagebuilder-content-type esun-interactive-card-preview"
attr="data.main.attributes"
css="data.main.css"
event="{ mouseover: onMouseOver, mouseout: onMouseOut }, mouseoverBubble: false">
<render args="getOptions().template"></render>
<div class="esun-interactive-card-preview__media">
<scope args="getUploader().getUiComponent()"><render></render></scope>
<img if="getViewportImageData().attributes().src"
attr="getViewportImageData().attributes"
class="esun-interactive-card-preview__image"/>
</div>
<div class="esun-interactive-card-preview__body">
<strong if="data.title.html()" html="data.title.html"></strong>
<span ifnot="data.title.html()" translate="'Open settings to add the card title.'"></span>
<small if="data.main.attributes()['data-product-sku']"
data-bind="text: 'SKU: ' + data.main.attributes()['data-product-sku']"></small>
</div>
</article>
@@ -0,0 +1,20 @@
<section class="esun-interactive-cards"
attr="data.main.attributes"
ko-style="data.main.style"
css="data.main.css"
data-mage-init='{"Esun_InteractiveCards/js/cards":{}}'>
<div class="esun-interactive-cards__viewport">
<div class="esun-interactive-cards__track">
<render args="masterTemplate"></render>
</div>
</div>
<div class="esun-interactive-cards__controls" aria-label="Interactive cards navigation">
<button class="esun-interactive-cards__arrow esun-interactive-cards__arrow--prev"
type="button"
aria-label="Previous cards">&#8249;</button>
<div class="esun-interactive-cards__dots"></div>
<button class="esun-interactive-cards__arrow esun-interactive-cards__arrow--next"
type="button"
aria-label="Next cards">&#8250;</button>
</div>
</section>
@@ -0,0 +1,22 @@
<div class="pagebuilder-content-type pagebuilder-entity pagebuilder-entity-preview esun-interactive-cards-preview"
event="{ mouseover: onMouseOver, mouseout: onMouseOut }, mouseoverBubble: false">
<render args="getOptions().template"></render>
<div class="esun-interactive-cards-preview__meta">
<strong translate="'Interactive Cards'"></strong>
<span data-bind="text: data.main.attributes()['data-desktop-columns'] + ' cards per row'"></span>
</div>
<div class="esun-interactive-cards-preview__grid"
each="contentType.getChildren()"
attr="Object.assign({}, data.main.attributes(), { id: contentType.id + '-children' })"
ko-style="data.main.style"
css="data.main.css"
data-bind="sortableChildren: getSortableOptions()">
<div class="pagebuilder-content-type-wrapper"
template="{ name: preview.template, data: preview, afterRender: function () { preview.dispatchAfterRenderEvent.apply(preview, arguments); } }"
attr="{ id: id }"
css="{'pagebuilder-content-type-hidden': !preview.display()}"></div>
</div>
<div class="esun-interactive-cards-preview__empty"
if="contentType.getChildren().length === 0"
translate="'Use Add Card to create the first card.'"></div>
</div>
@@ -0,0 +1,15 @@
<article class="esun-product-card"
attr="data.main.attributes"
ko-style="data.main.style"
css="data.main.css"
aria-live="polite">
<a class="esun-product-card__media" href="#" tabindex="-1">
<img class="esun-product-card__image" src="" alt=""/>
</a>
<div class="esun-product-card__body">
<a class="esun-product-card__title" href="#"></a>
<div class="esun-product-card__tags"></div>
<a class="esun-product-card__link" href="#">Explore All</a>
</div>
<div class="esun-product-card__status" role="status"></div>
</article>
@@ -0,0 +1,13 @@
<article class="pagebuilder-content-type esun-product-card-preview"
attr="data.main.attributes"
css="data.main.css"
event="{ mouseover: onMouseOver, mouseout: onMouseOut }, mouseoverBubble: false">
<render args="getOptions().template"></render>
<div class="esun-product-card-preview__handle">
<span translate="'Product image loads on the storefront'"></span>
</div>
<div class="esun-product-card-preview__body">
<strong data-bind="text: data.main.attributes()['data-product-sku'] || 'Enter a product SKU'"></strong>
<small data-bind="text: data.main.attributes()['data-product-tags'] || 'No tags'"></small>
</div>
</article>
@@ -0,0 +1,9 @@
<section class="esun-product-cards"
attr="data.main.attributes"
ko-style="data.main.style"
css="data.main.css"
data-mage-init='{"Esun_InteractiveCards/js/product-cards":{}}'>
<div class="esun-product-cards__grid">
<render args="masterTemplate"></render>
</div>
</section>
@@ -0,0 +1,22 @@
<div class="pagebuilder-content-type pagebuilder-entity pagebuilder-entity-preview esun-product-cards-preview"
event="{ mouseover: onMouseOver, mouseout: onMouseOut }, mouseoverBubble: false">
<render args="getOptions().template"></render>
<div class="esun-product-cards-preview__meta">
<strong translate="'Product Cards'"></strong>
<span data-bind="text: data.main.attributes()['data-desktop-columns'] + ' cards per row'"></span>
</div>
<div class="esun-product-cards-preview__grid"
each="contentType.getChildren()"
attr="Object.assign({}, data.main.attributes(), { id: contentType.id + '-children' })"
ko-style="data.main.style"
css="data.main.css"
data-bind="sortableChildren: getSortableOptions()">
<div class="pagebuilder-content-type-wrapper"
template="{ name: preview.template, data: preview, afterRender: function () { preview.dispatchAfterRenderEvent.apply(preview, arguments); } }"
attr="{ id: id }"
css="{'pagebuilder-content-type-hidden': !preview.display()}"></div>
</div>
<div class="esun-product-cards-preview__empty"
if="contentType.getChildren().length === 0"
translate="'Use Add Product Card to create the first product.'"></div>
</div>