le-kit 0.1.6 → 0.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/{dist/le-kit/assets/custom-elements.json → custom-elements.json} +833 -833
- package/dist/cjs/{index-WzJ78D5H.js → index-D7B9TPh8.js} +41 -9
- package/dist/cjs/index-D7B9TPh8.js.map +1 -0
- package/dist/cjs/index.cjs.js +4 -2
- package/dist/cjs/index.cjs.js.map +1 -1
- package/dist/cjs/le-box.cjs.entry.js +2 -2
- package/dist/cjs/le-button.le-checkbox.le-component.le-popover.le-slot.le-string-input.entry.cjs.js.map +1 -1
- package/dist/cjs/le-button_6.cjs.entry.js +8 -10
- package/dist/cjs/le-card.cjs.entry.js +2 -2
- package/dist/cjs/le-kit.cjs.js +1 -1
- package/dist/cjs/le-number-input.cjs.entry.js +2 -2
- package/dist/cjs/le-popup.cjs.entry.js +1 -1
- package/dist/cjs/le-round-progress.cjs.entry.js +1 -1
- package/dist/cjs/le-stack.cjs.entry.js +2 -2
- package/dist/cjs/le-text.cjs.entry.js +2 -2
- package/dist/cjs/le-turntable.cjs.entry.js +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/{utils-CBjH2E8A.js → utils-DrsoID-a.js} +3 -3
- package/dist/cjs/{utils-CBjH2E8A.js.map → utils-DrsoID-a.js.map} +1 -1
- package/dist/collection/components/le-component/le-component.js +5 -5
- package/dist/collection/components/le-component/le-component.js.map +1 -1
- package/dist/collection/components/le-slot/le-slot.js +5 -5
- package/dist/collection/components/le-slot/le-slot.js.map +1 -1
- package/dist/collection/global/app.js +37 -0
- package/dist/collection/global/app.js.map +1 -1
- package/dist/collection/index.js +1 -1
- package/dist/collection/index.js.map +1 -1
- package/dist/components/index.js +1 -1
- package/dist/components/le-box.js +1 -1
- package/dist/components/le-button.js +1 -1
- package/dist/components/le-button2.js +45 -10
- package/dist/components/le-button2.js.map +1 -1
- package/dist/components/le-card.js +1 -1
- package/dist/components/le-checkbox.js +1 -1
- package/dist/components/le-component.js +1 -1
- package/dist/components/le-number-input.js +1 -1
- package/dist/components/le-popup.js +1 -1
- package/dist/components/le-slot.js +1 -1
- package/dist/components/le-stack.js +1 -1
- package/dist/components/le-string-input.js +1 -1
- package/dist/components/le-text.js +1 -1
- package/dist/docs.json +1 -1
- package/dist/esm/{index-CdjJ98OT.js → index-PS-3Rz-c.js} +40 -9
- package/dist/esm/index-PS-3Rz-c.js.map +1 -0
- package/dist/esm/index.js +2 -2
- package/dist/esm/le-box.entry.js +2 -2
- package/dist/esm/le-button.le-checkbox.le-component.le-popover.le-slot.le-string-input.entry.js.map +1 -1
- package/dist/esm/le-button_6.entry.js +8 -10
- package/dist/esm/le-card.entry.js +2 -2
- package/dist/esm/le-kit.js +2 -2
- package/dist/esm/le-number-input.entry.js +2 -2
- package/dist/esm/le-popup.entry.js +1 -1
- package/dist/esm/le-round-progress.entry.js +1 -1
- package/dist/esm/le-stack.entry.js +2 -2
- package/dist/esm/le-text.entry.js +2 -2
- package/dist/esm/le-turntable.entry.js +1 -1
- package/dist/esm/loader.js +2 -2
- package/dist/esm/{utils-CzfSUhYB.js → utils-lgjSfQP0.js} +3 -3
- package/dist/esm/{utils-CzfSUhYB.js.map → utils-lgjSfQP0.js.map} +1 -1
- package/dist/le-kit/index.esm.js +1 -1
- package/dist/le-kit/le-button.le-checkbox.le-component.le-popover.le-slot.le-string-input.entry.esm.js.map +1 -1
- package/dist/le-kit/le-kit.esm.js +1 -1
- package/dist/le-kit/p-27710b5b.entry.js +2 -0
- package/dist/le-kit/{p-0633b3ab.entry.js.map → p-27710b5b.entry.js.map} +1 -1
- package/dist/le-kit/{p-1452a995.entry.js → p-34102cef.entry.js} +2 -2
- package/dist/le-kit/{p-95764888.entry.js → p-56a80e6d.entry.js} +2 -2
- package/dist/le-kit/p-615ea10f.entry.js +2 -0
- package/dist/le-kit/p-615ea10f.entry.js.map +1 -0
- package/dist/le-kit/{p-bc20e30d.entry.js → p-935bb2d4.entry.js} +2 -2
- package/dist/le-kit/{p-220528ee.entry.js → p-9d3dc4e5.entry.js} +2 -2
- package/dist/le-kit/{p-CvDc0yWN.js → p-DN2JVY-7.js} +2 -2
- package/dist/le-kit/{p-CvDc0yWN.js.map → p-DN2JVY-7.js.map} +1 -1
- package/dist/le-kit/p-PS-3Rz-c.js +3 -0
- package/dist/le-kit/p-PS-3Rz-c.js.map +1 -0
- package/dist/le-kit/{p-3551598e.entry.js → p-ccabc638.entry.js} +2 -2
- package/dist/le-kit/{p-722899f0.entry.js → p-d8157b06.entry.js} +2 -2
- package/dist/le-kit/p-e8c2ca0e.entry.js +2 -0
- package/dist/le-kit/{p-d32eddad.entry.js.map → p-e8c2ca0e.entry.js.map} +1 -1
- package/dist/types/global/app.d.ts +33 -0
- package/dist/types/index.d.ts +1 -1
- package/package.json +3 -2
- package/readme.md +22 -0
- package/dist/cjs/index-WzJ78D5H.js.map +0 -1
- package/dist/collection/assets/.gitkeep +0 -1
- package/dist/collection/assets/custom-elements.json +0 -4305
- package/dist/esm/index-CdjJ98OT.js.map +0 -1
- package/dist/le-kit/p-0633b3ab.entry.js +0 -2
- package/dist/le-kit/p-32ff3dbe.entry.js +0 -2
- package/dist/le-kit/p-32ff3dbe.entry.js.map +0 -1
- package/dist/le-kit/p-CdjJ98OT.js +0 -3
- package/dist/le-kit/p-CdjJ98OT.js.map +0 -1
- package/dist/le-kit/p-d32eddad.entry.js +0 -2
- /package/dist/le-kit/{p-1452a995.entry.js.map → p-34102cef.entry.js.map} +0 -0
- /package/dist/le-kit/{p-95764888.entry.js.map → p-56a80e6d.entry.js.map} +0 -0
- /package/dist/le-kit/{p-bc20e30d.entry.js.map → p-935bb2d4.entry.js.map} +0 -0
- /package/dist/le-kit/{p-220528ee.entry.js.map → p-9d3dc4e5.entry.js.map} +0 -0
- /package/dist/le-kit/{p-3551598e.entry.js.map → p-ccabc638.entry.js.map} +0 -0
- /package/dist/le-kit/{p-722899f0.entry.js.map → p-d8157b06.entry.js.map} +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var index = require('./index-
|
|
4
|
-
var utils = require('./utils-
|
|
3
|
+
var index = require('./index-D7B9TPh8.js');
|
|
4
|
+
var utils = require('./utils-DrsoID-a.js');
|
|
5
5
|
|
|
6
6
|
const leButtonDefaultCss = ":host{display:inline-block;--le-button-border-radius:var(--le-radius-md);--le-button-padding-x:0.4rem;--le-button-padding-y:0.4rem;--le-button-small-padding:0.25rem;--le-button-font-size:var(--le-font-size-md);--le-button-font-weight:var(--le-font-weight-medium);--le-button-transition:var(--le-transition-fast);--le-button-icon-aspect-ratio:1;--_btn-bg:var(--le-color-primary);--_btn-bg-hover:var(--le-color-primary-dark);--_btn-bg-system:var(--le-color-black);--_btn-color:var(--le-color-primary-contrast);--_btn-border-color:var(--le-color-primary)}:host([full-width]){display:block;width:100%}.button{display:inline-flex;align-items:center;justify-content:center;gap:var(--le-spacing-3);width:100%;padding:var(--le-button-padding-y) var(--le-button-padding-x);border:1px solid var(--_btn-border-color);border-radius:var(--le-button-border-radius);background:var(--_btn-bg);color:var(--_btn-color);font-family:var(--le-font-family-base);font-size:var(--le-button-font-size);font-weight:var(--le-button-font-weight);line-height:var(--le-line-height-tight);text-decoration:none;cursor:pointer;transition:background-color var(--le-button-transition) var(--le-transition-easing),\n border-color var(--le-button-transition) var(--le-transition-easing),\n box-shadow var(--le-button-transition) var(--le-transition-easing),\n transform var(--le-button-transition) var(--le-transition-easing)}.button:hover:not(:disabled){background:var(--_btn-bg-hover);border-color:var(--_btn-bg-hover)}.button:active:not(:disabled){transform:translateY(1px)}.button:focus-visible{outline:2px solid var(--le-color-focus);outline-offset:2px}.button:disabled{opacity:0.5;cursor:not-allowed}:host>le-component.color-primary{--_btn-bg:var(--le-color-primary);--_btn-bg-hover:var(--le-color-primary-dark);--_btn-color:var(--le-color-primary-contrast);--_btn-border-color:var(--le-color-primary)}:host>le-component.color-secondary{--_btn-bg:var(--le-color-secondary);--_btn-bg-hover:var(--le-color-secondary-dark);--_btn-color:var(--le-color-secondary-contrast);--_btn-border-color:var(--le-color-secondary)}:host>le-component.color-success{--_btn-bg:var(--le-color-success);--_btn-bg-hover:var(--le-color-success-dark);--_btn-color:var(--le-color-success-contrast);--_btn-border-color:var(--le-color-success)}:host>le-component.color-warning{--_btn-bg:var(--le-color-warning);--_btn-bg-hover:var(--le-color-warning-dark);--_btn-color:var(--le-color-warning-contrast);--_btn-border-color:var(--le-color-warning)}:host>le-component.color-danger{--_btn-bg:var(--le-color-danger);--_btn-bg-hover:var(--le-color-danger-dark);--_btn-color:var(--le-color-danger-contrast);--_btn-border-color:var(--le-color-danger)}:host>le-component.color-info{--_btn-bg:var(--le-color-info);--_btn-bg-hover:var(--le-color-info-dark);--_btn-color:var(--le-color-info-contrast);--_btn-border-color:var(--le-color-info)}:host>le-component.variant-solid .button{box-shadow:var(--le-shadow-sm)}:host>le-component.variant-solid .button:hover:not(:disabled){box-shadow:var(--le-shadow-md)}:host>le-component.variant-outlined .button{background:transparent;color:var(--_btn-bg);border-color:var(--_btn-border-color)}:host>le-component.variant-outlined .button:hover:not(:disabled){background:var(--_btn-bg);color:var(--_btn-color)}:host>le-component.variant-clear .button{background:transparent;color:var(--_btn-bg);border-color:transparent}:host>le-component.variant-clear .button:hover:not(:disabled){background:var(--le-color-gray-100);border-color:transparent}:host>le-component.variant-system .button{background:transparent;color:var(--_btn-bg-system);border-color:transparent}:host>le-component.size-small .button{--le-button-padding-x:0.4rem;--le-button-padding-y:0.3rem;--le-button-padding-top:0.35rem;--le-button-font-size:var(--le-button-small-font-size, var(--le-font-size-xs))}:host>le-component.size-large .button{--le-button-padding-x:0.9rem;--le-button-padding-y:0.6rem;--le-button-font-size:var(--le-font-size-xl)}:host>le-component.full-width{display:block;width:100%}:host>le-component.selected .button{box-shadow:inset 0 2px 4px rgba(0, 0, 0, 0.2)}:host>le-component.variant-outlined.selected .button,:host>le-component.variant-clear.selected .button{background:var(--_btn-bg);color:var(--_btn-color)}:host>le-component.icon-only .button{padding:0.5rem;padding-bottom:0.6rem;aspect-ratio:var(--le-button-icon-aspect-ratio, 1)}:host>le-component.icon-only.size-small .button{padding:var(--le-button-small-padding, 0.25rem)}:host>le-component.icon-only.size-large .button{padding:0.75rem}:host>le-component.icon-only .content{display:none}.content{display:inline}.content:empty{display:none}.icon-start,.icon-only,.icon-end{display:flex;align-items:center;justify-content:center}.icon-start:empty,.icon-only:empty,.icon-end:empty{display:none}::slotted([slot=\"icon-start\"]),::slotted([slot=\"icon-only\"]),::slotted([slot=\"icon-end\"]){display:flex;align-items:center;justify-content:center;width:1.125em;height:1.125em}";
|
|
7
7
|
|
|
@@ -237,9 +237,9 @@ const LeComponent = class {
|
|
|
237
237
|
*/
|
|
238
238
|
async loadComponentMetadata() {
|
|
239
239
|
try {
|
|
240
|
-
// Fetch the manifest
|
|
241
|
-
const
|
|
242
|
-
const response = await fetch(
|
|
240
|
+
// Fetch the manifest from configured URL
|
|
241
|
+
const { manifestUrl } = index.getLeKitConfig();
|
|
242
|
+
const response = await fetch(manifestUrl);
|
|
243
243
|
const manifest = await response.json();
|
|
244
244
|
// Find the component definition
|
|
245
245
|
for (const module of manifest.modules) {
|
|
@@ -377,7 +377,6 @@ const LeComponent = class {
|
|
|
377
377
|
// In admin mode, show wrapper with header and settings
|
|
378
378
|
return (index.h(index.Host, { class: utils.classnames(this.component, this.hostClass, 'admin-mode'), style: this.hostStyle }, index.h("div", { class: "le-component-wrapper" }, index.h("div", { class: "le-component-header" }, index.h("span", { class: "le-component-name" }, name), index.h("le-popover", { popoverTitle: `${name} Settings`, position: "right", align: "start", "min-width": "300px", mode: "default" }, index.h("le-button", { type: "button", class: "le-component-button", slot: "trigger", variant: "clear", size: "small", "aria-label": "Edit component properties", "icon-only": true }, index.h("span", { class: "le-component-trigger", slot: "icon-only" }, "\u2699")), this.renderPropertyEditor())), index.h("div", { class: "le-component-content" }, index.h("slot", null)))));
|
|
379
379
|
}
|
|
380
|
-
static get assetsDirs() { return ["../../assets"]; }
|
|
381
380
|
};
|
|
382
381
|
LeComponent.style = leComponentCss;
|
|
383
382
|
|
|
@@ -981,8 +980,8 @@ const LeSlot = class {
|
|
|
981
980
|
*/
|
|
982
981
|
async loadAvailableComponents() {
|
|
983
982
|
try {
|
|
984
|
-
const
|
|
985
|
-
const response = await fetch(
|
|
983
|
+
const { manifestUrl } = index.getLeKitConfig();
|
|
984
|
+
const response = await fetch(manifestUrl);
|
|
986
985
|
const manifest = await response.json();
|
|
987
986
|
const components = [];
|
|
988
987
|
const allowedList = this.allowedComponents?.split(',').map(s => s.trim()) || [];
|
|
@@ -1057,7 +1056,7 @@ const LeSlot = class {
|
|
|
1057
1056
|
render() {
|
|
1058
1057
|
const displayLabel = this.label || this.name;
|
|
1059
1058
|
// Always render the same structure, CSS handles visibility via .admin-mode class
|
|
1060
|
-
return (index.h(index.Host, { key: '
|
|
1059
|
+
return (index.h(index.Host, { key: '5ff8f0dd3c07f92e0584450fabf57b89ea0c0a10', class: {
|
|
1061
1060
|
'admin-mode': this.adminMode,
|
|
1062
1061
|
'invalid-html': !this.isValidHtml,
|
|
1063
1062
|
}, role: this.adminMode ? 'region' : undefined, "aria-label": this.adminMode ? `Slot: ${displayLabel}` : undefined, "data-slot-name": this.name, "data-slot-type": this.type, "data-allowed": this.allowedComponents, "data-multiple": this.multiple, "data-required": this.required }, this.adminMode ? (index.h("div", { class: "le-slot-container" }, index.h("div", { class: utils.classnames('le-slot-header', {
|
|
@@ -1101,7 +1100,6 @@ const LeSlot = class {
|
|
|
1101
1100
|
return (index.h("div", { class: "le-slot-dropzone", style: dropzoneStyle }, index.h("slot", { ref: el => (this.slotRef = el), onSlotchange: this.handleSlotChange })));
|
|
1102
1101
|
}
|
|
1103
1102
|
}
|
|
1104
|
-
static get assetsDirs() { return ["../../assets"]; }
|
|
1105
1103
|
};
|
|
1106
1104
|
LeSlot.style = leSlotDefaultCss;
|
|
1107
1105
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var index = require('./index-
|
|
4
|
-
var utils = require('./utils-
|
|
3
|
+
var index = require('./index-D7B9TPh8.js');
|
|
4
|
+
var utils = require('./utils-DrsoID-a.js');
|
|
5
5
|
|
|
6
6
|
const leCardDefaultCss = ":host{display:block;--le-card-bg:var(--le-color-surface);--le-card-border-radius:var(--le-radius-lg);--le-card-shadow:var(--le-shadow-md);--le-card-shadow-elevated:var(--le-shadow-lg);--le-card-shadow-hover:var(--le-shadow-xl);--le-card-padding:var(--le-space-md);--le-card-border-color:var(--le-color-border);--le-card-transition:var(--le-transition-normal)}.card{background:var(--le-card-bg);border-radius:var(--le-card-border-radius);overflow:hidden;color:var(--le-color-text);box-shadow:var(--le-card-shadow)}:host>le-component.variant-outlined .card{border:1px solid var(--le-card-border-color);box-shadow:none}:host>le-component.variant-elevated .card{box-shadow:var(--le-card-shadow-elevated)}:host>le-component.interactive .card{cursor:pointer;transition:transform var(--le-card-transition), box-shadow var(--le-card-transition)}:host>le-component.interactive .card:hover{transform:translateY(-2px);box-shadow:var(--le-card-shadow-hover)}:host>le-component.interactive .card:focus-visible{outline:2px solid var(--le-color-border-focus);outline-offset:2px}.card-header{padding:var(--le-card-padding);padding-bottom:0}.card-header:empty{display:none}.card-content{padding:var(--le-card-padding)}.card-footer{padding:var(--le-card-padding);padding-top:0}.card-footer:empty{display:none}";
|
|
7
7
|
|
package/dist/cjs/le-kit.cjs.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var index = require('./index-
|
|
4
|
-
var utils = require('./utils-
|
|
3
|
+
var index = require('./index-D7B9TPh8.js');
|
|
4
|
+
var utils = require('./utils-DrsoID-a.js');
|
|
5
5
|
|
|
6
6
|
const leNumberInputCss = ":host{display:block;--le-input-bg:var(--le-color-surface, #ffffff);--le-input-color:var(--le-color-text-primary, #333333);--le-input-border:var(--le-border-width, 2px) solid var(--le-color-border-input, #007bff);--le-input-radius:var(--le-radius-sm, 4px);--le-input-padding:2px 6px;--le-input-height:1.5rem;--le-input-label-color:var(--le-color-text-primary, #333333);--le-input-desc-color:var(--le-color-text-secondary, #666666);--le-input-placeholder-color:#999999;--le-input-border-error:2px solid var(--le-color-danger, #dc3545);--le-input-error-color:var(--le-color-danger, #dc3545)}.le-input-wrapper{display:flex;flex-direction:column;gap:2px}.le-input-label{display:block;font-size:0.9em;font-weight:500;color:var(--le-input-label-color);margin-bottom:2px}.le-input-container{position:relative;display:flex;align-items:center;background:var(--le-input-bg);border:var(--le-input-border);border-radius:var(--le-input-radius);transition:border-color 0.2s}.le-input-container:focus-within{outline:2px solid var(--le-color-focus);outline-offset:2px}.le-input-container.has-error{border:var(--le-input-border-error)}:host([disabled]) .le-input-container{opacity:0.6;background-color:rgba(0,0,0,0.05);cursor:not-allowed}input{flex:1;width:100%;height:calc(var(--le-input-height) - 2px);padding:var(--le-input-padding);border:none;background:transparent;color:var(--le-input-color);font-family:inherit;font-size:inherit;outline:none;text-align:right;-moz-appearance:textfield;}input::-webkit-outer-spin-button,input::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}input::placeholder{color:var(--le-input-placeholder-color)}.icon-start,.icon-end{display:flex;align-items:center;justify-content:center;padding:0 8px;color:var(--le-input-desc-color)}.le-input-controls{display:flex;flex-direction:column;border-left:1px solid var(--le-color-border, #cccccc);height:100%}.le-input-control-btn{--le-button-border-radius:0;--le-button-padding-x:0;--le-button-padding-y:0;--le-button-small-font-size:9.5px;--le-button-small-padding:0 0.2rem;--le-button-icon-aspect-ratio:2;display:flex;align-items:center;justify-content:center;height:50%;cursor:pointer;background:none;border:none;color:var(--le-input-desc-color);font-size:10px;line-height:1}.le-input-control-btn:hover{background-color:rgba(0,0,0,0.05);color:var(--le-color-primary, #007bff)}.le-input-control-btn:active{background-color:rgba(0,0,0,0.1)}.le-input-description{font-size:0.85em;color:var(--le-input-desc-color);margin-top:2px}.le-input-error{font-size:0.85em;color:var(--le-input-error-color);margin-top:2px}";
|
|
7
7
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var index = require('./index-
|
|
3
|
+
var index = require('./index-D7B9TPh8.js');
|
|
4
4
|
|
|
5
5
|
const lePopupCss = ":host{display:contents}.le-popup-dialog{position:fixed;z-index:100;top:0;right:0;bottom:0;left:0;padding:0;border:none;background:transparent;max-width:none;max-height:none;overflow:visible;--_popup-min-width:var(--le-popup-min-width, 320px);--_popup-max-width:var(--le-popup-max-width, min(500px, 90vw));--_popup-min-height:var(--le-popup-min-height, auto)}.le-popup-dialog::backdrop{background:var(--le-popup-backdrop-color, rgba(0, 0, 0, 0.5));animation:le-popup-backdrop-fade 0.2s ease-out}@keyframes le-popup-backdrop-fade{from{opacity:0}to{opacity:1}}.le-popup-position-center{margin:auto}.le-popup-position-top{margin:var(--le-space-2xl, 48px) auto auto auto}.le-popup-position-top-left{margin:var(--le-space-lg, 24px) auto auto var(--le-space-lg, 24px)}.le-popup-position-top-right{margin:var(--le-space-lg, 24px) var(--le-space-lg, 24px) auto auto}.le-popup-position-bottom{margin:auto auto var(--le-space-2xl, 48px) auto}.le-popup-position-bottom-left{margin:auto auto var(--le-space-lg, 24px) var(--le-space-lg, 24px)}.le-popup-position-bottom-right{margin:auto var(--le-space-lg, 24px) var(--le-space-lg, 24px) auto}.le-popup-container{display:flex;flex-direction:column;min-width:var(--_popup-min-width);max-width:var(--_popup-max-width);min-height:var(--_popup-min-height);max-height:calc(100vh - var(--le-space-2xl, 48px) * 2);background:var(--le-color-surface, #ffffff);border:1px solid var(--le-color-border, #e0e0e0);border-radius:var(--le-radius-lg, 12px);box-shadow:var(--le-shadow-xl, 0 8px 32px rgba(0, 0, 0, 0.15));overflow:hidden;font-family:var(--le-font-family, system-ui, -apple-system, sans-serif);color:var(--le-color-text, #333);animation:le-popup-appear 0.2s ease-out}@keyframes le-popup-appear{from{opacity:0;transform:scale(0.95) translateY(-10px)}to{opacity:1;transform:scale(1) translateY(0)}}.le-popup-header{flex-shrink:0;padding:var(--le-space-md, 16px) var(--le-space-lg, 24px);border-bottom:1px solid var(--le-color-border, #e0e0e0);background:var(--le-color-surface-alt, #f9f9f9);font-size:var(--le-font-size-lg, 1.125rem);font-weight:var(--le-font-weight-semibold, 600);color:var(--le-color-text, #333)}.le-popup-body{flex:1;padding:var(--le-space-lg, 24px);overflow-y:auto}.le-popup-message{margin:0;font-size:var(--le-font-size-md, 1rem);line-height:var(--le-line-height-relaxed, 1.6);color:var(--le-color-text, #333)}.le-popup-message+::slotted(*){margin-top:var(--le-space-md, 16px)}.le-popup-input{display:block;width:100%;margin-top:var(--le-space-md, 16px);padding:var(--le-space-sm, 8px) var(--le-space-md, 16px);font-family:inherit;font-size:var(--le-font-size-md, 1rem);color:var(--le-color-text, #333);background:var(--le-color-background, #fff);border:1px solid var(--le-color-border, #e0e0e0);border-radius:var(--le-radius-md, 8px);outline:none;transition:border-color var(--le-transition-fast, 0.15s ease),\n box-shadow var(--le-transition-fast, 0.15s ease);box-sizing:border-box}.le-popup-input:focus{border-color:var(--le-color-primary, #2196f3);box-shadow:0 0 0 3px var(--le-color-primary-light, rgba(33, 150, 243, 0.2))}.le-popup-input::placeholder{color:var(--le-color-text-muted, #999)}.le-popup-footer{flex-shrink:0;display:flex;justify-content:flex-end;gap:var(--le-space-sm, 8px);padding:var(--le-space-md, 16px) var(--le-space-lg, 24px);border-top:1px solid var(--le-color-border, #e0e0e0);background:var(--le-color-surface-alt, #f9f9f9)}.le-popup-btn{min-width:80px}@media (max-width: 480px){.le-popup-container{min-width:calc(100vw - var(--le-space-md, 16px) * 2);max-width:calc(100vw - var(--le-space-md, 16px) * 2)}.le-popup-footer{flex-direction:column-reverse}.le-popup-btn{width:100%}}";
|
|
6
6
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var index = require('./index-
|
|
3
|
+
var index = require('./index-D7B9TPh8.js');
|
|
4
4
|
|
|
5
5
|
const leRoundProgressCss = ".round-progress--container{position:relative}.round-progress{position:absolute;top:0;left:0;right:0;bottom:0;display:block}.round-progress--progress{filter:drop-shadow(var(--progress-shadow))}.round-progress--circle{fill:none;stroke:var(--progress-color, #999);stroke-width:var(--progress-width, 4);stroke-linecap:var(--progress-linecap, round);animation:progress--circle 0.5s ease-out forwards;transition:stroke-dasharray 0.5s ease-out}@keyframes progress--circle{0%{stroke-dasharray:0 1000}}.round-progress--path{fill:none;stroke-linecap:round}";
|
|
6
6
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var index = require('./index-
|
|
4
|
-
var utils = require('./utils-
|
|
3
|
+
var index = require('./index-D7B9TPh8.js');
|
|
4
|
+
var utils = require('./utils-DrsoID-a.js');
|
|
5
5
|
|
|
6
6
|
const leStackDefaultCss = ":host{display:block}:host([hidden]){display:none}.stack{gap:var(--le-stack-gap, var(--le-space-md))}:host(.full-width){width:100%}:host(.full-height){height:100%}:host(.direction-horizontal) .stack{min-height:0}:host(.direction-vertical) .stack{min-width:0}";
|
|
7
7
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var index = require('./index-
|
|
4
|
-
var utils = require('./utils-
|
|
3
|
+
var index = require('./index-D7B9TPh8.js');
|
|
4
|
+
var utils = require('./utils-DrsoID-a.js');
|
|
5
5
|
|
|
6
6
|
const leTextDefaultCss = ":host{display:block}:host([hidden]){display:none}.le-text{margin:0;color:var(--le-text-color, var(--le-color-text));font-family:var(--le-font-family);line-height:var(--le-text-line-height, 1.5)}.variant-p{font-size:var(--le-font-size-base, 1rem);font-weight:var(--le-font-weight-normal, 400);color:var(--le-color-text)}.variant-h1{font-size:var(--le-font-size-4xl, 2.5rem);font-weight:var(--le-font-weight-bold, 700);line-height:1.2;color:var(--le-color-text);letter-spacing:-0.02em}.variant-h2{font-size:var(--le-font-size-3xl, 2rem);font-weight:var(--le-font-weight-bold, 700);line-height:1.25;color:var(--le-color-text);letter-spacing:-0.01em}.variant-h3{font-size:var(--le-font-size-2xl, 1.5rem);font-weight:var(--le-font-weight-semibold, 600);line-height:1.3;color:var(--le-color-text)}.variant-h4{font-size:var(--le-font-size-xl, 1.25rem);font-weight:var(--le-font-weight-semibold, 600);line-height:1.35;color:var(--le-color-text)}.variant-h5{font-size:var(--le-font-size-lg, 1.125rem);font-weight:var(--le-font-weight-medium, 500);line-height:1.4;color:var(--le-color-text)}.variant-h6{font-size:var(--le-font-size-base, 1rem);font-weight:var(--le-font-weight-medium, 500);line-height:1.45;color:var(--le-color-text);text-transform:uppercase;letter-spacing:0.05em}.variant-code{font-family:var(--le-font-family-mono, 'SF Mono', 'Fira Code', 'Consolas', monospace);font-size:var(--le-font-size-sm, 0.875rem);background:var(--le-color-surface-alt, #f5f5f5);padding:var(--le-space-md);border-radius:var(--le-radius-md);overflow-x:auto;white-space:pre-wrap;color:var(--le-color-text)}.variant-quote{font-size:var(--le-font-size-lg, 1.125rem);font-style:italic;color:var(--le-color-text-secondary);border-left:4px solid var(--le-color-primary);padding-left:var(--le-space-lg);margin-left:0;margin-right:0}.variant-label{font-size:var(--le-font-size-sm, 0.875rem);font-weight:var(--le-font-weight-medium, 500);color:var(--le-color-text-secondary);text-transform:uppercase;letter-spacing:0.05em}.variant-small{font-size:var(--le-font-size-sm, 0.875rem);color:var(--le-color-text-secondary)}.truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.truncate.max-lines-2,.truncate.max-lines-3,.truncate.max-lines-4,.truncate.max-lines-5{white-space:normal;display:-webkit-box;-webkit-box-orient:vertical}.truncate.max-lines-2{-webkit-line-clamp:2;line-clamp:2}.truncate.max-lines-3{-webkit-line-clamp:3;line-clamp:3}.truncate.max-lines-4{-webkit-line-clamp:4;line-clamp:4}.truncate.max-lines-5{-webkit-line-clamp:5;line-clamp:5}:host([align=\"center\"]) .le-text{text-align:center}:host([align=\"right\"]) .le-text{text-align:right}:host([align=\"justify\"]) .le-text{text-align:justify}.le-text a{color:var(--le-color-primary);text-decoration:underline}.le-text a:hover{color:var(--le-color-primary-dark)}.le-text strong,.le-text b{font-weight:var(--le-font-weight-bold, 700)}.le-text em,.le-text i{font-style:italic}.le-text u{text-decoration:underline}.le-text s,.le-text strike{text-decoration:line-through}";
|
|
7
7
|
|
package/dist/cjs/loader.cjs.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var index = require('./index-
|
|
3
|
+
var index = require('./index-D7B9TPh8.js');
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Utility functions for le-kit components
|
|
@@ -147,6 +147,6 @@ exports.generateId = generateId;
|
|
|
147
147
|
exports.observeModeChanges = observeModeChanges;
|
|
148
148
|
exports.parseCommaSeparated = parseCommaSeparated;
|
|
149
149
|
exports.slotHasContent = slotHasContent;
|
|
150
|
-
//# sourceMappingURL=utils-
|
|
150
|
+
//# sourceMappingURL=utils-DrsoID-a.js.map
|
|
151
151
|
|
|
152
|
-
//# sourceMappingURL=utils-
|
|
152
|
+
//# sourceMappingURL=utils-DrsoID-a.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils-
|
|
1
|
+
{"version":3,"file":"utils-DrsoID-a.js","sources":["src/utils/utils.ts"],"sourcesContent":["/**\n * Utility functions for le-kit components\n */\n\nimport { getMode } from '../global/app';\n\n/**\n * Generates a unique ID for component instances\n */\nexport function generateId(prefix: string = 'le'): string {\n return `${prefix}-${Math.random().toString(36).substring(2, 9)}`;\n}\n\n/**\n * Parses a comma-separated string into an array\n */\nexport function parseCommaSeparated(value: string | undefined): string[] {\n if (!value) return [];\n return value\n .split(',')\n .map(s => s.trim())\n .filter(Boolean);\n}\n\n/**\n * Checks if a slot has content\n */\nexport function slotHasContent(el: HTMLElement, slotName: string = ''): boolean {\n const selector = slotName ? `[slot=\"${slotName}\"]` : ':not([slot])';\n return el.querySelector(selector) !== null;\n}\n\n/**\n * Sets up a MutationObserver to track mode changes on ancestor elements.\n * Returns a cleanup function to disconnect the observer.\n * \n * If the element or any ancestor has an explicit `mode` attribute, that creates\n * a \"mode boundary\" - the mode is determined from that point, not from further up.\n * This allows components like le-popover to force default mode for their children.\n * \n * @param el - The component's host element\n * @param callback - Function to call when mode changes, receives the new mode\n * @returns Cleanup function to disconnect the observer\n * \n * @example\n * ```tsx\n * export class MyComponent {\n * @Element() el: HTMLElement;\n * @State() adminMode: boolean = false;\n * private disconnectModeObserver?: () => void;\n * \n * connectedCallback() {\n * this.disconnectModeObserver = observeModeChanges(this.el, (mode) => {\n * this.adminMode = mode === 'admin';\n * });\n * }\n * \n * disconnectedCallback() {\n * this.disconnectModeObserver?.();\n * }\n * }\n * ```\n */\nexport function observeModeChanges(\n el: HTMLElement,\n callback: (mode: string) => void\n): () => void {\n // Call immediately with current mode\n callback(getMode(el));\n\n // Set up observer for mode attribute changes\n const observer = new MutationObserver(() => {\n callback(getMode(el));\n });\n\n // Observe the element itself (for mode boundary changes)\n observer.observe(el, {\n attributes: true,\n attributeFilter: ['mode'],\n });\n\n // Observe document root\n observer.observe(document.documentElement, {\n attributes: true,\n attributeFilter: ['mode'],\n });\n\n // Traverse up, crossing shadow boundaries, and observe each element\n let current: Node | null = el;\n while (current) {\n if (current instanceof Element && current.parentElement) {\n current = current.parentElement;\n observer.observe(current, {\n attributes: true,\n attributeFilter: ['mode'],\n });\n // If this element has an explicit mode, it's a boundary\n if ((current as Element).hasAttribute('mode')) {\n break;\n }\n } else {\n // Check if we're in a shadow root\n const root = current.getRootNode();\n if (root instanceof ShadowRoot) {\n // Cross the shadow boundary and observe the host\n current = root.host;\n observer.observe(current, {\n attributes: true,\n attributeFilter: ['mode'],\n });\n // If the host has an explicit mode, it's a boundary\n if ((current as Element).hasAttribute('mode')) {\n break;\n }\n } else {\n break;\n }\n }\n }\n\n // Return cleanup function\n return () => observer.disconnect();\n}\n\n/**\n * Combines multiple class names into a single string, filtering out falsy values.\n * \n * @param classes - arguments of class names, undefined, arrays, objects with boolean values and nested combinations of these\n * @returns Combined class names string\n */\nexport function classnames(...classes: any[]): string {\n const result: string[] = [];\n\n classes.forEach(cls => {\n if (!cls) return;\n\n if (typeof cls === 'string') {\n result.push(cls);\n } else if (Array.isArray(cls)) {\n result.push(classnames(...cls));\n } else if (typeof cls === 'object') {\n Object.entries(cls).forEach(([key, value]) => {\n if (value) {\n result.push(key);\n }\n });\n }\n });\n\n return result.join(' ');\n}\n"],"names":["getMode"],"mappings":";;;;AAAA;;AAEG;AAIH;;AAEG;AACa,SAAA,UAAU,CAAC,MAAA,GAAiB,IAAI,EAAA;IAC9C,OAAO,CAAA,EAAG,MAAM,CAAI,CAAA,EAAA,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE;AAClE;AAEA;;AAEG;AACG,SAAU,mBAAmB,CAAC,KAAyB,EAAA;AAC3D,IAAA,IAAI,CAAC,KAAK;AAAE,QAAA,OAAO,EAAE;AACrB,IAAA,OAAO;SACJ,KAAK,CAAC,GAAG;SACT,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE;SACjB,MAAM,CAAC,OAAO,CAAC;AACpB;AAEA;;AAEG;SACa,cAAc,CAAC,EAAe,EAAE,WAAmB,EAAE,EAAA;AACnE,IAAA,MAAM,QAAQ,GAAG,QAAQ,GAAG,CAAU,OAAA,EAAA,QAAQ,CAAI,EAAA,CAAA,GAAG,cAAc;IACnE,OAAO,EAAE,CAAC,aAAa,CAAC,QAAQ,CAAC,KAAK,IAAI;AAC5C;AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8BG;AACa,SAAA,kBAAkB,CAChC,EAAe,EACf,QAAgC,EAAA;;AAGhC,IAAA,QAAQ,CAACA,aAAO,CAAC,EAAE,CAAC,CA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EA;;;;;AAKG;AACa,SAAA,UAAU,CAAC,GAAG,OAAc,EAAA;IAC1C,MAAM,MAAM,GAAa,EAAE;AAE3B,IAAA,OAAO,CAAC,OAAO,CAAC,GAAG,IAAG;AACpB,QAAA,IAAI,CAAC,GAAG;YAAE;AAEV,QAAA,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE;AAC3B,YAAA,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC;;AACX,aAAA,IAAI,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE;YAC7B,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,GAAG,CAAC,CAAC;;AAC1B,aAAA,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE;AAClC,YAAA,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,KAAI;gBAC3C,IAAI,KAAK,EAAE;AACT,oBAAA,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC;;AAEpB,aAAC,CAAC;;AAEN,KAAC,CAAC;AAEF,IAAA,OAAO,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC;AACzB;;;;;;;;"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { h, Host
|
|
1
|
+
import { h, Host } from "@stencil/core";
|
|
2
2
|
import { classnames, observeModeChanges } from "../../utils/utils";
|
|
3
|
+
import { getLeKitConfig } from "../../global/app";
|
|
3
4
|
/**
|
|
4
5
|
* Component wrapper for admin mode editing.
|
|
5
6
|
*
|
|
@@ -118,9 +119,9 @@ export class LeComponent {
|
|
|
118
119
|
*/
|
|
119
120
|
async loadComponentMetadata() {
|
|
120
121
|
try {
|
|
121
|
-
// Fetch the manifest
|
|
122
|
-
const
|
|
123
|
-
const response = await fetch(
|
|
122
|
+
// Fetch the manifest from configured URL
|
|
123
|
+
const { manifestUrl } = getLeKitConfig();
|
|
124
|
+
const response = await fetch(manifestUrl);
|
|
124
125
|
const manifest = await response.json();
|
|
125
126
|
// Find the component definition
|
|
126
127
|
for (const module of manifest.modules) {
|
|
@@ -270,7 +271,6 @@ export class LeComponent {
|
|
|
270
271
|
"$": ["le-component.css"]
|
|
271
272
|
};
|
|
272
273
|
}
|
|
273
|
-
static get assetsDirs() { return ["../../assets"]; }
|
|
274
274
|
static get properties() {
|
|
275
275
|
return {
|
|
276
276
|
"component": {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"le-component.js","sourceRoot":"","sources":["../../../src/components/le-component/le-component.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AACvF,OAAO,EAAE,UAAU,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAEnE;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAOH,MAAM,OAAO,WAAW;IACX,EAAE,CAAc;IAE3B;;;OAGG;IACK,SAAS,CAAU;IAE3B;;;OAGG;IACK,WAAW,CAAU;IAE7B;;;OAGG;IACK,SAAS,CAAU;IAE3B;;;OAGG;IACK,SAAS,CAA6B;IAE9C;;OAEG;IACK,WAAW,CAAe;IAElC;;OAEG;IACc,SAAS,GAAY,KAAK,CAAC;IAE5C;;OAEG;IACc,aAAa,GAA6B,IAAI,CAAC;IAEhE;;OAEG;IACc,cAAc,GAAwB,EAAE,CAAC;IAElD,sBAAsB,CAAc;IAE5C,iBAAiB;QACf,sFAAsF;QACtF,oDAAoD;QACpD,IAAI,CAAC,eAAe,EAAE,CAAC;QAEvB,IAAI,CAAC,sBAAsB,GAAG,kBAAkB,CAAC,IAAI,CAAC,EAAE,EAAE,IAAI,CAAC,EAAE;YAC/D,IAAI,CAAC,SAAS,GAAG,IAAI,KAAK,OAAO,CAAC;YAClC,0EAA0E;YAC1E,IAAI,IAAI,CAAC,SAAS,EAAE,CAAC;gBACnB,I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EAAC,IAAI,EAAC,SAAS,EAAC,OAAO,EAAC,OAAO,EAAC,IAAI,EAAC,OAAO,gBAAY,2BAA2B;4BACrI,YAAM,KAAK,EAAC,sBAAsB,EAAC,IAAI,EAAC,WAAW,aAE5C,CACG;wBACX,IAAI,CAAC,oBAAoB,EAAE,CACjB,CACT;gBACN,WAAK,KAAK,EAAC,sBAAsB;oBAC/B,eAAa,CACT,CACF,CACD,CACR,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Prop, State, h, Host, Element, getAssetPath } from '@stencil/core';\nimport { classnames, observeModeChanges } from '../../utils/utils';\n\n/**\n * Component wrapper for admin mode editing.\n *\n * This component is used internally by other components to provide admin-mode\n * editing capabilities. It wraps the component's rendered output and shows\n * a settings popover for editing properties.\n *\n * In default mode, it acts as a simple passthrough (display: contents).\n * In admin mode, it shows a border, component name header, and settings popover.\n *\n * The host element is found automatically by traversing up through the shadow DOM.\n *\n * Usage inside a component's render method:\n * ```tsx\n * render() {\n * return (\n * <le-component component=\"le-card\">\n * <Host>...</Host>\n * </le-component>\n * );\n * }\n * ```\n *\n * @slot - The component's rendered content\n *\n * @cmsInternal true\n * @cmsCategory System\n */\n@Component({\n tag: 'le-component',\n styleUrl: 'le-component.css',\n shadow: true,\n assetsDirs: ['../../assets'],\n})\nexport class LeComponent {\n @Element() el: HTMLElement;\n\n /**\n * The tag name of the component (e.g., 'le-card').\n * Used to look up property metadata and display the component name.\n */\n @Prop() component!: string;\n\n /**\n * Optional display name for the component.\n * If not provided, the tag name will be formatted as the display name.\n */\n @Prop() displayName?: string;\n\n /**\n * Classes to apply to the host element.\n * Allows parent components to pass their styling classes.\n */\n @Prop() hostClass?: string;\n\n /**\n * Inline styles to apply to the host element.\n * Allows parent components to pass dynamic styles (e.g., flex properties).\n */\n @Prop() hostStyle?: { [key: string]: string };\n\n /**\n * Reference to the host element (found automatically from parent)\n */\n private hostElement?: HTMLElement;\n\n /**\n * Internal state to track admin mode\n */\n @State() private adminMode: boolean = false;\n\n /**\n * Component metadata loaded from Custom Elements Manifest\n */\n @State() private componentMeta: ComponentMetadata | null = null;\n\n /**\n * Current property values of the host component\n */\n @State() private propertyValues: Record<string, any> = {};\n\n private disconnectModeObserver?: () => void;\n\n connectedCallback() {\n // Find the host element - le-component is rendered inside the component's shadow DOM,\n // so we need to find the shadow root's host element\n this.findHostElement();\n\n this.disconnectModeObserver = observeModeChanges(this.el, mode => {\n this.adminMode = mode === 'admin';\n // Load metadata and refresh property values only when entering admin mode\n if (this.adminMode) {\n if (!this.componentMeta) {\n this.loadComponentMetadata();\n } else {\n this.readPropertyValues();\n }\n }\n });\n }\n\n /**\n * Find the host element by traversing up through shadow DOM\n */\n private findHostElement() {\n // Get the shadow root that contains this le-component\n const rootNode = this.el.getRootNode();\n if (rootNode instanceof ShadowRoot) {\n // The host of this shadow root is our target component (e.g., le-card)\n this.hostElement = rootNode.host as HTMLElement;\n }\n }\n\n componentDidLoad() {\n // Read initial property values from the host element\n this.readPropertyValues();\n }\n\n disconnectedCallback() {\n this.disconnectModeObserver?.();\n }\n\n /**\n * Formats a tag name into a display name\n * e.g., 'le-card' -> 'Card'\n */\n private formatDisplayName(tagName: string): string {\n return tagName\n .replace(/^le-/, '') // Remove 'le-' prefix\n .split('-')\n .map(word => word.charAt(0).toUpperCase() + word.slice(1))\n .join(' ');\n }\n\n /**\n * Load component metadata from the Custom Elements Manifest\n */\n private async loadComponentMetadata() {\n try {\n // Fetch the manifest using getAssetPath for correct bundle path\n const manifestPath = getAssetPath('assets/custom-elements.json');\n const response = await fetch(manifestPath);\n const manifest = await response.json();\n\n // Find the component definition\n for (const module of manifest.modules) {\n for (const declaration of module.declarations || []) {\n if (declaration.tagName === this.component) {\n const attributes = (declaration.attributes || []).filter((attr: AttributeMetadata) => !this.isInternalAttribute(attr.name));\n this.componentMeta = {\n tagName: declaration.tagName,\n description: declaration.description,\n attributes,\n };\n // console.log(`[le-component] Loaded metadata for ${this.component}:`, this.componentMeta);\n // Read property values after metadata is loaded\n this.readPropertyValues();\n return;\n }\n }\n }\n // console.warn(`[le-component] No metadata found for component: ${this.component}`);\n } catch (error) {\n // console.warn(`[le-component] Failed to load metadata for component: ${this.component}`, error);\n }\n }\n\n /**\n * Check if an attribute is internal (should not be shown in editor)\n */\n private isInternalAttribute(name: string): boolean {\n const internalAttrs = ['mode', 'theme', 'class', 'style', 'id', 'slot'];\n return internalAttrs.includes(name);\n }\n\n /**\n * Read current property values from the host element\n */\n private readPropertyValues() {\n if (!this.hostElement || !this.componentMeta) return;\n\n const values: Record<string, any> = {};\n for (const attr of this.componentMeta.attributes) {\n const value = this.hostElement.getAttribute(attr.name);\n values[attr.name] = this.parseAttributeValue(value, attr.type?.text);\n }\n this.propertyValues = values;\n }\n\n /**\n * Parse an attribute value based on its type\n */\n private parseAttributeValue(value: string | null, type?: string): any {\n if (value === null) return undefined;\n\n if (type === 'boolean') {\n return value !== null && value !== 'false';\n }\n if (type === 'number') {\n return parseFloat(value);\n }\n return value;\n }\n\n /**\n * Handle property value changes from the editor\n */\n private handlePropertyChange(attrName: string, value: any, type?: string) {\n if (!this.hostElement) return;\n\n // Update the host element's attribute\n if (type === 'boolean') {\n if (value) {\n this.hostElement.setAttribute(attrName, '');\n } else {\n this.hostElement.removeAttribute(attrName);\n }\n } else if (value === undefined || value === '') {\n this.hostElement.removeAttribute(attrName);\n } else {\n this.hostElement.setAttribute(attrName, String(value));\n }\n\n // Update local state\n this.propertyValues = { ...this.propertyValues, [attrName]: value };\n }\n\n /**\n * Delete this component from the DOM\n */\n private deleteComponent() {\n if (!this.hostElement) return;\n\n // Confirm deletion\n const name = this.displayName || this.formatDisplayName(this.component);\n if (!confirm(`Delete this ${name}?`)) return;\n\n // Remove the host element from its parent\n const parent = this.hostElement.parentElement;\n if (parent) {\n this.hostElement.remove();\n }\n }\n\n /**\n * Render the property editor form\n */\n private renderPropertyEditor() {\n const hasProperties = this.componentMeta && this.componentMeta.attributes.length > 0;\n\n return (\n <div class=\"property-editor-container\">\n {hasProperties ? (\n <form class=\"property-editor\" onSubmit={e => e.preventDefault()}>\n {this.componentMeta!.attributes.map(attr => this.renderPropertyField(attr))}\n </form>\n ) : (\n <p class=\"no-properties\">No editable properties</p>\n )}\n <div class=\"property-editor-actions\">\n <le-button type=\"button\" variant=\"outlined\" color=\"danger\" full-width onClick={() => this.deleteComponent()}>\n <span slot=\"icon-start\">🗑️</span>\n <span>Delete Component</span>\n </le-button>\n </div>\n </div>\n );\n }\n\n /**\n * Render a single property field based on its type\n */\n private renderPropertyField(attr: AttributeMetadata) {\n const value = this.propertyValues[attr.name];\n const type = attr.type?.text || 'string';\n\n // Check if type is a union of string literals (e.g., \"'default' | 'outlined' | 'elevated'\")\n const enumMatch = type.match(/^'[^']+'/);\n if (enumMatch) {\n const options = type.split('|').map(opt => opt.trim().replace(/'/g, ''));\n return (\n <div class=\"property-field\">\n <label htmlFor={`prop-${attr.name}`}>\n {attr.name}\n {attr.description && <span class=\"property-hint\">{attr.description}</span>}\n </label>\n <select id={`prop-${attr.name}`} onChange={e => this.handlePropertyChange(attr.name, (e.target as HTMLSelectElement).value, type)}>\n {options.map(opt => (\n <option value={opt} selected={value === opt || (!value && attr.default?.replace(/'/g, '') === opt)}>\n {opt}\n </option>\n ))}\n </select>\n </div>\n );\n }\n\n // Boolean type\n if (type === 'boolean') {\n return (\n <div class=\"property-field property-field--checkbox\">\n <le-checkbox\n name={`prop-${attr.name}`}\n checked={value === true || value === ''}\n onChange={e => this.handlePropertyChange(attr.name, (e.target as HTMLInputElement).checked, type)}\n >\n {attr.name}\n {attr.description && <div slot=\"description\">{attr.description}</div>}\n </le-checkbox>\n </div>\n );\n }\n\n // Number type\n if (type === 'number') {\n return (\n <div class=\"property-field\">\n <label htmlFor={`prop-${attr.name}`}>\n {attr.name}\n {attr.description && <span class=\"property-hint\">{attr.description}</span>}\n </label>\n <input\n type=\"number\"\n id={`prop-${attr.name}`}\n value={value ?? ''}\n placeholder={attr.default}\n onChange={e => this.handlePropertyChange(attr.name, (e.target as HTMLInputElement).value, type)}\n />\n </div>\n );\n }\n\n // Default: string/text input\n return (\n <div class=\"property-field\">\n <le-string-input\n name={`prop-${attr.name}`}\n label={attr.name}\n value={value ?? ''}\n placeholder={attr.default?.replace(/'/g, '')}\n onChange={(e: any) => this.handlePropertyChange(attr.name, e.detail.value, type)}\n >\n <span slot=\"description\">{attr.description}</span>\n </le-string-input>\n </div>\n );\n }\n\n render() {\n const name = this.displayName || this.formatDisplayName(this.component);\n\n // In default mode, just pass through content with host classes\n if (!this.adminMode) {\n return (\n <Host class={classnames(this.component, this.hostClass)} style={this.hostStyle}>\n <slot></slot>\n </Host>\n );\n }\n\n // In admin mode, show wrapper with header and settings\n return (\n <Host class={classnames(this.component, this.hostClass, 'admin-mode')} style={this.hostStyle}>\n <div class=\"le-component-wrapper\">\n <div class=\"le-component-header\">\n <span class=\"le-component-name\">{name}</span>\n <le-popover popoverTitle={`${name} Settings`} position=\"right\" align=\"start\" min-width=\"300px\" mode=\"default\">\n <le-button type=\"button\" class=\"le-component-button\" slot=\"trigger\" variant=\"clear\" size=\"small\" aria-label=\"Edit component properties\" icon-only>\n <span class=\"le-component-trigger\" slot=\"icon-only\">\n ⚙\n </span>\n </le-button>\n {this.renderPropertyEditor()}\n </le-popover>\n </div>\n <div class=\"le-component-content\">\n <slot></slot>\n </div>\n </div>\n </Host>\n );\n }\n}\n\n/**\n * Type definitions for component metadata\n */\ninterface ComponentMetadata {\n tagName: string;\n description?: string;\n attributes: AttributeMetadata[];\n}\n\ninterface AttributeMetadata {\n name: string;\n fieldName?: string;\n description?: string;\n default?: string;\n type?: {\n text: string;\n };\n}\n"]}
|
|
1
|
+
{"version":3,"file":"le-component.js","sourceRoot":"","sources":["../../../src/components/le-component/le-component.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Prop, State, h, Host, Element } from '@stencil/core';\nimport { classnames, observeModeChanges } from '../../utils/utils';\nimport { getLeKitConfig } from '../../global/app';\n\n/**\n * Component wrapper for admin mode editing.\n *\n * This component is used internally by other components to provide admin-mode\n * editing capabilities. It wraps the component's rendered output and shows\n * a settings popover for editing properties.\n *\n * In default mode, it acts as a simple passthrough (display: contents).\n * In admin mode, it shows a border, component name header, and settings popover.\n *\n * The host element is found automatically by traversing up through the shadow DOM.\n *\n * Usage inside a component's render method:\n * ```tsx\n * render() {\n * return (\n * <le-component component=\"le-card\">\n * <Host>...</Host>\n * </le-component>\n * );\n * }\n * ```\n *\n * @slot - The component's rendered content\n *\n * @cmsInternal true\n * @cmsCategory System\n */\n@Component({\n tag: 'le-component',\n styleUrl: 'le-component.css',\n shadow: true,\n})\nexport class LeComponent {\n @Element() el: HTMLElement;\n\n /**\n * The tag name of the component (e.g., 'le-card').\n * Used to look up property metadata and display the component name.\n */\n @Prop() component!: string;\n\n /**\n * Optional display name for the component.\n * If not provided, the tag name will be formatted as the display name.\n */\n @Prop() displayName?: string;\n\n /**\n * Classes to apply to the host element.\n * Allows parent components to pass their styling classes.\n */\n @Prop() hostClass?: string;\n\n /**\n * Inline styles to apply to the host element.\n * Allows parent components to pass dynamic styles (e.g., flex properties).\n */\n @Prop() hostStyle?: { [key: string]: string };\n\n /**\n * Reference to the host element (found automatically from parent)\n */\n private hostElement?: HTMLElement;\n\n /**\n * Internal state to track admin mode\n */\n @State() private adminMode: boolean = false;\n\n /**\n * Component metadata loaded from Custom Elements Manifest\n */\n @State() private componentMeta: ComponentMetadata | null = null;\n\n /**\n * Current property values of the host component\n */\n @State() private propertyValues: Record<string, any> = {};\n\n private disconnectModeObserver?: () => void;\n\n connectedCallback() {\n // Find the host element - le-component is rendered inside the component's shadow DOM,\n // so we need to find the shadow root's host element\n this.findHostElement();\n\n this.disconnectModeObserver = observeModeChanges(this.el, mode => {\n this.adminMode = mode === 'admin';\n // Load metadata and refresh property values only when entering admin mode\n if (this.adminMode) {\n if (!this.componentMeta) {\n this.loadComponentMetadata();\n } else {\n this.readPropertyValues();\n }\n }\n });\n }\n\n /**\n * Find the host element by traversing up through shadow DOM\n */\n private findHostElement() {\n // Get the shadow root that contains this le-component\n const rootNode = this.el.getRootNode();\n if (rootNode instanceof ShadowRoot) {\n // The host of this shadow root is our target component (e.g., le-card)\n this.hostElement = rootNode.host as HTMLElement;\n }\n }\n\n componentDidLoad() {\n // Read initial property values from the host element\n this.readPropertyValues();\n }\n\n disconnectedCallback() {\n this.disconnectModeObserver?.();\n }\n\n /**\n * Formats a tag name into a display name\n * e.g., 'le-card' -> 'Card'\n */\n private formatDisplayName(tagName: string): string {\n return tagName\n .replace(/^le-/, '') // Remove 'le-' prefix\n .split('-')\n .map(word => word.charAt(0).toUpperCase() + word.slice(1))\n .join(' ');\n }\n\n /**\n * Load component metadata from the Custom Elements Manifest\n */\n private async loadComponentMetadata() {\n try {\n // Fetch the manifest from configured URL\n const { manifestUrl } = getLeKitConfig();\n const response = await fetch(manifestUrl);\n const manifest = await response.json();\n\n // Find the component definition\n for (const module of manifest.modules) {\n for (const declaration of module.declarations || []) {\n if (declaration.tagName === this.component) {\n const attributes = (declaration.attributes || []).filter((attr: AttributeMetadata) => !this.isInternalAttribute(attr.name));\n this.componentMeta = {\n tagName: declaration.tagName,\n description: declaration.description,\n attributes,\n };\n // console.log(`[le-component] Loaded metadata for ${this.component}:`, this.componentMeta);\n // Read property values after metadata is loaded\n this.readPropertyValues();\n return;\n }\n }\n }\n // console.warn(`[le-component] No metadata found for component: ${this.component}`);\n } catch (error) {\n // console.warn(`[le-component] Failed to load metadata for component: ${this.component}`, error);\n }\n }\n\n /**\n * Check if an attribute is internal (should not be shown in editor)\n */\n private isInternalAttribute(name: string): boolean {\n const internalAttrs = ['mode', 'theme', 'class', 'style', 'id', 'slot'];\n return internalAttrs.includes(name);\n }\n\n /**\n * Read current property values from the host element\n */\n private readPropertyValues() {\n if (!this.hostElement || !this.componentMeta) return;\n\n const values: Record<string, any> = {};\n for (const attr of this.componentMeta.attributes) {\n const value = this.hostElement.getAttribute(attr.name);\n values[attr.name] = this.parseAttributeValue(value, attr.type?.text);\n }\n this.propertyValues = values;\n }\n\n /**\n * Parse an attribute value based on its type\n */\n private parseAttributeValue(value: string | null, type?: string): any {\n if (value === null) return undefined;\n\n if (type === 'boolean') {\n return value !== null && value !== 'false';\n }\n if (type === 'number') {\n return parseFloat(value);\n }\n return value;\n }\n\n /**\n * Handle property value changes from the editor\n */\n private handlePropertyChange(attrName: string, value: any, type?: string) {\n if (!this.hostElement) return;\n\n // Update the host element's attribute\n if (type === 'boolean') {\n if (value) {\n this.hostElement.setAttribute(attrName, '');\n } else {\n this.hostElement.removeAttribute(attrName);\n }\n } else if (value === undefined || value === '') {\n this.hostElement.removeAttribute(attrName);\n } else {\n this.hostElement.setAttribute(attrName, String(value));\n }\n\n // Update local state\n this.propertyValues = { ...this.propertyValues, [attrName]: value };\n }\n\n /**\n * Delete this component from the DOM\n */\n private deleteComponent() {\n if (!this.hostElement) return;\n\n // Confirm deletion\n const name = this.displayName || this.formatDisplayName(this.component);\n if (!confirm(`Delete this ${name}?`)) return;\n\n // Remove the host element from its parent\n const parent = this.hostElement.parentElement;\n if (parent) {\n this.hostElement.remove();\n }\n }\n\n /**\n * Render the property editor form\n */\n private renderPropertyEditor() {\n const hasProperties = this.componentMeta && this.componentMeta.attributes.length > 0;\n\n return (\n <div class=\"property-editor-container\">\n {hasProperties ? (\n <form class=\"property-editor\" onSubmit={e => e.preventDefault()}>\n {this.componentMeta!.attributes.map(attr => this.renderPropertyField(attr))}\n </form>\n ) : (\n <p class=\"no-properties\">No editable properties</p>\n )}\n <div class=\"property-editor-actions\">\n <le-button type=\"button\" variant=\"outlined\" color=\"danger\" full-width onClick={() => this.deleteComponent()}>\n <span slot=\"icon-start\">🗑️</span>\n <span>Delete Component</span>\n </le-button>\n </div>\n </div>\n );\n }\n\n /**\n * Render a single property field based on its type\n */\n private renderPropertyField(attr: AttributeMetadata) {\n const value = this.propertyValues[attr.name];\n const type = attr.type?.text || 'string';\n\n // Check if type is a union of string literals (e.g., \"'default' | 'outlined' | 'elevated'\")\n const enumMatch = type.match(/^'[^']+'/);\n if (enumMatch) {\n const options = type.split('|').map(opt => opt.trim().replace(/'/g, ''));\n return (\n <div class=\"property-field\">\n <label htmlFor={`prop-${attr.name}`}>\n {attr.name}\n {attr.description && <span class=\"property-hint\">{attr.description}</span>}\n </label>\n <select id={`prop-${attr.name}`} onChange={e => this.handlePropertyChange(attr.name, (e.target as HTMLSelectElement).value, type)}>\n {options.map(opt => (\n <option value={opt} selected={value === opt || (!value && attr.default?.replace(/'/g, '') === opt)}>\n {opt}\n </option>\n ))}\n </select>\n </div>\n );\n }\n\n // Boolean type\n if (type === 'boolean') {\n return (\n <div class=\"property-field property-field--checkbox\">\n <le-checkbox\n name={`prop-${attr.name}`}\n checked={value === true || value === ''}\n onChange={e => this.handlePropertyChange(attr.name, (e.target as HTMLInputElement).checked, type)}\n >\n {attr.name}\n {attr.description && <div slot=\"description\">{attr.description}</div>}\n </le-checkbox>\n </div>\n );\n }\n\n // Number type\n if (type === 'number') {\n return (\n <div class=\"property-field\">\n <label htmlFor={`prop-${attr.name}`}>\n {attr.name}\n {attr.description && <span class=\"property-hint\">{attr.description}</span>}\n </label>\n <input\n type=\"number\"\n id={`prop-${attr.name}`}\n value={value ?? ''}\n placeholder={attr.default}\n onChange={e => this.handlePropertyChange(attr.name, (e.target as HTMLInputElement).value, type)}\n />\n </div>\n );\n }\n\n // Default: string/text input\n return (\n <div class=\"property-field\">\n <le-string-input\n name={`prop-${attr.name}`}\n label={attr.name}\n value={value ?? ''}\n placeholder={attr.default?.replace(/'/g, '')}\n onChange={(e: any) => this.handlePropertyChange(attr.name, e.detail.value, type)}\n >\n <span slot=\"description\">{attr.description}</span>\n </le-string-input>\n </div>\n );\n }\n\n render() {\n const name = this.displayName || this.formatDisplayName(this.component);\n\n // In default mode, just pass through content with host classes\n if (!this.adminMode) {\n return (\n <Host class={classnames(this.component, this.hostClass)} style={this.hostStyle}>\n <slot></slot>\n </Host>\n );\n }\n\n // In admin mode, show wrapper with header and settings\n return (\n <Host class={classnames(this.component, this.hostClass, 'admin-mode')} style={this.hostStyle}>\n <div class=\"le-component-wrapper\">\n <div class=\"le-component-header\">\n <span class=\"le-component-name\">{name}</span>\n <le-popover popoverTitle={`${name} Settings`} position=\"right\" align=\"start\" min-width=\"300px\" mode=\"default\">\n <le-button type=\"button\" class=\"le-component-button\" slot=\"trigger\" variant=\"clear\" size=\"small\" aria-label=\"Edit component properties\" icon-only>\n <span class=\"le-component-trigger\" slot=\"icon-only\">\n ⚙\n </span>\n </le-button>\n {this.renderPropertyEditor()}\n </le-popover>\n </div>\n <div class=\"le-component-content\">\n <slot></slot>\n </div>\n </div>\n </Host>\n );\n }\n}\n\n/**\n * Type definitions for component metadata\n */\ninterface ComponentMetadata {\n tagName: string;\n description?: string;\n attributes: AttributeMetadata[];\n}\n\ninterface AttributeMetadata {\n name: string;\n fieldName?: string;\n description?: string;\n default?: string;\n type?: {\n text: string;\n };\n}\n"]}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { h, Host
|
|
1
|
+
import { h, Host } from "@stencil/core";
|
|
2
2
|
import { classnames, observeModeChanges } from "../../utils/utils";
|
|
3
|
+
import { getLeKitConfig } from "../../global/app";
|
|
3
4
|
/**
|
|
4
5
|
* Slot placeholder component for admin/CMS mode.
|
|
5
6
|
*
|
|
@@ -265,8 +266,8 @@ export class LeSlot {
|
|
|
265
266
|
*/
|
|
266
267
|
async loadAvailableComponents() {
|
|
267
268
|
try {
|
|
268
|
-
const
|
|
269
|
-
const response = await fetch(
|
|
269
|
+
const { manifestUrl } = getLeKitConfig();
|
|
270
|
+
const response = await fetch(manifestUrl);
|
|
270
271
|
const manifest = await response.json();
|
|
271
272
|
const components = [];
|
|
272
273
|
const allowedList = this.allowedComponents?.split(',').map(s => s.trim()) || [];
|
|
@@ -341,7 +342,7 @@ export class LeSlot {
|
|
|
341
342
|
render() {
|
|
342
343
|
const displayLabel = this.label || this.name;
|
|
343
344
|
// Always render the same structure, CSS handles visibility via .admin-mode class
|
|
344
|
-
return (h(Host, { key: '
|
|
345
|
+
return (h(Host, { key: '5ff8f0dd3c07f92e0584450fabf57b89ea0c0a10', class: {
|
|
345
346
|
'admin-mode': this.adminMode,
|
|
346
347
|
'invalid-html': !this.isValidHtml,
|
|
347
348
|
}, role: this.adminMode ? 'region' : undefined, "aria-label": this.adminMode ? `Slot: ${displayLabel}` : undefined, "data-slot-name": this.name, "data-slot-type": this.type, "data-allowed": this.allowedComponents, "data-multiple": this.multiple, "data-required": this.required }, this.adminMode ? (h("div", { class: "le-slot-container" }, h("div", { class: classnames('le-slot-header', {
|
|
@@ -397,7 +398,6 @@ export class LeSlot {
|
|
|
397
398
|
"$": ["le-slot.default.css"]
|
|
398
399
|
};
|
|
399
400
|
}
|
|
400
|
-
static get assetsDirs() { return ["../../assets"]; }
|
|
401
401
|
static get properties() {
|
|
402
402
|
return {
|
|
403
403
|
"type": {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"le-slot.js","sourceRoot":"","sources":["../../../src/components/le-slot/le-slot.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAgB,YAAY,EAAE,MAAM,eAAe,CAAC;AAC5G,OAAO,EAAE,UAAU,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAEnE;;;;;;;;;;;;GAYG;AAOH,MAAM,OAAO,MAAM;IACN,EAAE,CAAc;IAE3B;;;;;OAKG;IACK,IAAI,GAAiC,MAAM,CAAC;IAEpD;;;OAGG;IACK,IAAI,GAAW,EAAE,CAAC;IAE1B;;;OA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AAE,CAAC;oBACnB,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;wBACvC,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;wBACzD,IAAI,IAAI,IAAI,KAAK,EAAE,CAAC;4BAClB,mDAAmD;4BACnD,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC,CAAC;4BACjF,aAAa,CAAC,SAAS,CAAC,GAAG,KAAK,CAAC;wBACnC,CAAC;oBACH,CAAC,CAAC,CAAC;gBACL,CAAC;gBACD,OAAO,CACL,WAAK,KAAK,EAAC,kBAAkB,EAAC,KAAK,EAAE,aAAa;oBAChD,YAAM,GAAG,EAAE,EAAE,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,OAAO,GAAG,EAAqB,CAAC,EAAE,YAAY,EAAE,IAAI,CAAC,gBAAgB,GAAS,CACjG,CACP,CAAC;QACN,CAAC;IACH,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Prop, State, h, Host, Element, Event, EventEmitter, getAssetPath } from '@stencil/core';\nimport { classnames, observeModeChanges } from '../../utils/utils';\n\n/**\n * Slot placeholder component for admin/CMS mode.\n *\n * This component renders a visual placeholder for slots when in admin mode,\n * allowing CMS systems to show available drop zones for content or inline editing.\n *\n * In non-admin mode, this component renders nothing and acts as a passthrough.\n *\n * @slot - Default slot for placeholder content or drop zone UI\n *\n * @cmsInternal true\n * @cmsCategory System\n */\n@Component({\n tag: 'le-slot',\n styleUrl: 'le-slot.default.css',\n shadow: true,\n assetsDirs: ['../../assets'],\n})\nexport class LeSlot {\n @Element() el: HTMLElement;\n\n /**\n * The type of slot content.\n * - `slot`: Default, shows a dropzone for components (default)\n * - `text`: Shows a single-line text input\n * - `textarea`: Shows a multi-line text area\n */\n @Prop() type: 'slot' | 'text' | 'textarea' = 'slot';\n\n /**\n * The name of the slot this placeholder represents.\n * Should match the slot name in the parent component.\n */\n @Prop() name: string = '';\n\n /**\n * Label to display in admin mode.\n * If not provided, the slot name will be used.\n */\n @Prop() label?: string;\n\n /**\n * Description of what content this slot accepts.\n * Shown in admin mode to guide content editors.\n */\n @Prop() description?: string;\n\n /**\n * Comma-separated list of allowed component tags for this slot.\n * Used by CMS to filter available components.\n *\n * @example \"le-card,le-button,le-text\"\n */\n @Prop() allowedComponents?: string;\n\n /**\n * Whether multiple components can be dropped in this slot.\n */\n @Prop() multiple: boolean = true;\n\n /**\n * Whether this slot is required to have content.\n */\n @Prop() required: boolean = false;\n\n /**\n * Placeholder text for text/textarea inputs in admin mode.\n */\n @Prop() placeholder?: string;\n\n /**\n * The HTML tag to create when there's no slotted element.\n * Used with type=\"text\" or type=\"textarea\" to auto-create elements.\n *\n * @example \"h3\" - creates <h3 slot=\"header\">content</h3>\n * @example \"p\" - creates <p slot=\"content\">content</p>\n */\n @Prop() tag?: string;\n\n /**\n * CSS styles for the slot dropzone container.\n * Useful for layouts - e.g., \"flex-direction: row\" for horizontal stacks.\n * Only applies in admin mode for type=\"slot\".\n */\n @Prop() slotStyle?: string;\n\n /**\n * Internal state to track admin mode\n */\n @State() private adminMode: boolean = false;\n\n /**\n * Internal state for text input value (synced from slot content)\n */\n @State() private textValue: string = '';\n\n /**\n * Whether the current textValue contains valid HTML\n */\n @State() private isValidHtml: boolean = true;\n\n /**\n * Available components loaded from Custom Elements Manifest\n */\n @State() private availableComponents: ComponentInfo[] = [];\n\n /**\n * Whether the component picker popover is open\n */\n @State() private pickerOpen: boolean = false;\n\n /**\n * Reference to the slot element to access assignedNodes\n */\n private slotRef?: HTMLSlotElement;\n\n /**\n * The original slotted element (e.g., <h3 slot=\"header\">)\n */\n private slottedElement?: Element;\n\n /**\n * Emitted when text content changes in admin mode.\n * The event detail contains the new text value and validity.\n */\n @Event() leSlotChange: EventEmitter<{ name: string; value: string; isValid: boolean }>;\n\n private disconnectModeObserver?: () => void;\n\n connectedCallback() {\n this.disconnectModeObserver = observeModeChanges(this.el, mode => {\n const wasAdmin = this.adminMode;\n this.adminMode = mode === 'admin';\n\n // When entering admin mode, read content from slotted elements\n if (this.adminMode && !wasAdmin) {\n // Need to wait for render to access slot ref\n requestAnimationFrame(() => this.readSlottedContent());\n\n // Load available components for the component picker\n if (this.type === 'slot') {\n this.loadAvailableComponents();\n }\n }\n });\n }\n\n disconnectedCallback() {\n this.disconnectModeObserver?.();\n }\n\n /**\n * Flag to prevent re-reading content right after we updated it\n */\n private isUpdating: boolean = false;\n\n /**\n * Read content from slotted elements via assignedNodes()\n */\n private readSlottedContent() {\n if (!this.slotRef) return;\n\n // Skip if we just updated the content ourselves\n if (this.isUpdating) {\n this.isUpdating = false;\n return;\n }\n\n const assignedNodes = this.slotRef.assignedNodes({ flatten: true });\n\n // For text/textarea types, we want to edit the innerHTML of slotted elements\n if (this.type === 'text' || this.type === 'textarea') {\n // Find the first element node (skip text nodes that are just whitespace)\n const elementNode = assignedNodes.find(node => node.nodeType === Node.ELEMENT_NODE) as Element | undefined;\n\n if (elementNode) {\n // Only update textValue if slotted element changed or we don't have one yet\n if (this.slottedElement !== elementNode) {\n this.slottedElement = elementNode;\n this.textValue = elementNode.innerHTML?.trim() || '';\n // console.log(`[le-slot \"${this.name}\"] Read slotted content:`, this.textValue);\n }\n } else {\n // No element, check for direct text content\n const textContent = assignedNodes\n .filter(node => node.nodeType === Node.TEXT_NODE)\n .map(node => node.textContent)\n .join('')\n .trim();\n\n if (textContent && !this.textValue) {\n this.textValue = textContent;\n // console.log(`[le-slot \"${this.name}\"] Read text content:`, this.textValue);\n }\n }\n }\n }\n\n /**\n * Validates if a string contains valid HTML\n */\n private validateHtml(html: string): boolean {\n // Empty string is valid\n if (!html.trim()) return true;\n\n // Create a template element to parse the HTML\n const template = document.createElement('template');\n template.innerHTML = html;\n\n // Check that we don't have obviously broken HTML\n // Count opening and closing tags for common elements\n const openTags = (html.match(/<[a-z][^>]*(?<!\\/)>/gi) || []).length;\n const closeTags = (html.match(/<\\/[a-z][^>]*>/gi) || []).length;\n const selfClosing = (html.match(/<[a-z][^>]*\\/>/gi) || []).length;\n\n // Simple validation: opening tags (minus self-closing) should roughly match closing tags\n // Allow some tolerance for void elements like <br>, <img>, etc.\n const voidElements = (html.match(/<(br|hr|img|input|meta|link|area|base|col|embed|param|source|track|wbr)[^>]*>/gi) || []).length;\n\n const effectiveOpenTags = openTags - selfClosing - voidElements;\n\n // If difference is too large, HTML is likely broken\n if (Math.abs(effectiveOpenTags - closeTags) > 1) {\n return false;\n }\n\n return true;\n }\n\n private handleTextInput = (event: Event) => {\n const target = event.target as HTMLInputElement | HTMLTextAreaElement;\n this.textValue = target.value;\n this.isValidHtml = this.validateHtml(this.textValue);\n\n if (this.isValidHtml) {\n // Set flag to prevent slotchange from re-reading what we just wrote\n this.isUpdating = true;\n\n console.log('Updating text value:', this.textValue, 'slottedElement:', this.slottedElement);\n\n if (this.slottedElement) {\n // Update existing slotted element's innerHTML\n this.slottedElement.innerHTML = this.textValue;\n } else if (this.tag && this.textValue) {\n // No slotted element exists\n // If the slot doesn't have a name, then it's the default slot\n // remove the existing non-slotted content (text nodes and elements without slot attribute)\n const rootNode = this.el.getRootNode();\n if (!this.name && rootNode instanceof ShadowRoot) {\n const hostComponent = rootNode.host;\n Array.from(hostComponent.childNodes).forEach(node => {\n if (node.nodeType === Node.TEXT_NODE || (node.nodeType === Node.ELEMENT_NODE && !(node as Element).hasAttribute('slot'))) {\n node.remove();\n }\n });\n }\n // create one using the specified tag\n this.createSlottedElement();\n } else if (this.textValue) {\n // no tag specified - just replace everything in the host component\n const rootNode = this.el.getRootNode();\n if (rootNode instanceof ShadowRoot) {\n const hostComponent = rootNode.host;\n hostComponent.innerHTML = this.textValue;\n }\n }\n }\n\n this.leSlotChange.emit({\n name: this.name,\n value: this.textValue,\n isValid: this.isValidHtml,\n });\n };\n\n /**\n * Create a new slotted element when none exists.\n * The element is appended to the host component's light DOM.\n */\n private createSlottedElement() {\n if (!this.tag) return;\n\n // Find the host component (le-card, etc.) by traversing up through shadow DOM\n // le-slot is inside le-card's shadow DOM, so we need to find le-card's host\n const rootNode = this.el.getRootNode();\n if (!(rootNode instanceof ShadowRoot)) return;\n\n const hostComponent = rootNode.host;\n if (!hostComponent) return;\n\n // Create the new element\n const newElement = document.createElement(this.tag);\n newElement.innerHTML = this.textValue;\n\n // Set the slot attribute if this is a named slot\n if (this.name) {\n newElement.setAttribute('slot', this.name);\n }\n\n // Append to the host component's light DOM\n hostComponent.appendChild(newElement);\n\n // Store reference to the new element\n this.slottedElement = newElement;\n\n // console.log(`[le-slot \"${this.name}\"] Created new <${this.tag}> element`);\n }\n\n /**\n * Load available components from Custom Elements Manifest\n */\n private async loadAvailableComponents() {\n try {\n const manifestPath = getAssetPath('assets/custom-elements.json');\n const response = await fetch(manifestPath);\n const manifest = await response.json();\n\n const components: ComponentInfo[] = [];\n const allowedList = this.allowedComponents?.split(',').map(s => s.trim()) || [];\n\n for (const module of manifest.modules) {\n for (const declaration of module.declarations || []) {\n if (declaration.tagName && declaration.customElement) {\n // Skip internal components (le-slot, le-component, le-popover)\n const isInternal = ['le-slot', 'le-component', 'le-popover'].includes(declaration.tagName);\n if (isInternal) continue;\n\n // If allowedComponents is specified, filter by it\n if (allowedList.length > 0 && !allowedList.includes(declaration.tagName)) {\n continue;\n }\n\n components.push({\n tagName: declaration.tagName,\n name: this.formatComponentName(declaration.tagName),\n description: declaration.description || '',\n });\n }\n }\n }\n\n this.availableComponents = components || [];\n } catch (error) {\n console.warn('[le-slot] Failed to load component manifest:', error);\n }\n }\n\n /**\n * Format a tag name into a display name\n * e.g., 'le-card' -> 'Card'\n */\n private formatComponentName(tagName: string): string {\n return tagName\n .replace(/^le-/, '')\n .split('-')\n .map(word => word.charAt(0).toUpperCase() + word.slice(1))\n .join(' ');\n }\n\n /**\n * Add a new component to the slot\n */\n private addComponent(tagName: string) {\n // Find the host component by traversing up through shadow DOM\n const rootNode = this.el.getRootNode();\n if (!(rootNode instanceof ShadowRoot)) return;\n\n const hostComponent = rootNode.host;\n if (!hostComponent) return;\n\n // Create the new component element\n const newElement = document.createElement(tagName);\n\n // Set the slot attribute if this is a named slot\n if (this.name) {\n newElement.setAttribute('slot', this.name);\n }\n\n // Append to the host component's light DOM\n hostComponent.appendChild(newElement);\n\n // Emit change event so the page can save\n this.leSlotChange.emit({\n name: this.name,\n value: hostComponent.innerHTML,\n isValid: true,\n });\n }\n\n /**\n * Handle slot change event to re-read content when nodes are assigned\n */\n private handleSlotChange = () => {\n this.readSlottedContent();\n };\n\n render() {\n const displayLabel = this.label || this.name;\n\n // Always render the same structure, CSS handles visibility via .admin-mode class\n return (\n <Host\n class={{\n 'admin-mode': this.adminMode,\n 'invalid-html': !this.isValidHtml,\n }}\n role={this.adminMode ? 'region' : undefined}\n aria-label={this.adminMode ? `Slot: ${displayLabel}` : undefined}\n data-slot-name={this.name}\n data-slot-type={this.type}\n data-allowed={this.allowedComponents}\n data-multiple={this.multiple}\n data-required={this.required}\n >\n {this.adminMode ? (\n <div class=\"le-slot-container\">\n <div\n class={classnames('le-slot-header', {\n 'le-slot-header-no-label': !displayLabel,\n 'le-slot-header-text': this.type === 'text',\n 'le-slot-header-error': !this.isValidHtml,\n })}\n >\n {displayLabel && (\n <span class=\"le-slot-label\">\n {displayLabel}\n {this.required && <span class=\"le-slot-required\">*</span>}\n </span>\n )}\n {/* {this.description && <le-popover mode=\"default\" showClose={false} align=\"end\" position=\"bottom\">\n <span slot=\"trigger\" class=\"le-slot-description-icon\">ℹ️</span>\n {this.description}\n </le-popover>} */}\n {!this.isValidHtml && <span class=\"le-slot-invalid\">⚠ Invalid HTML</span>}\n {this.type === 'slot' && this.adminMode && (\n <le-popover\n mode=\"default\"\n showClose={true}\n align=\"start\"\n position=\"right\"\n popoverTitle=\"Add Component\"\n open={this.pickerOpen}\n onLePopoverOpen={() => (this.pickerOpen = true)}\n onLePopoverClose={() => (this.pickerOpen = false)}\n >\n <le-button type=\"button\" class=\"le-slot-button\" slot=\"trigger\" variant=\"clear\" size=\"small\" aria-label=\"Add component\" icon-only>\n <span class=\"le-slot-add-btn\" slot=\"icon-only\">\n +\n </span>\n </le-button>\n <div class=\"le-slot-picker\">\n {this.availableComponents.length > 0 ? (\n <ul class=\"le-slot-picker-list\">\n {this.availableComponents.map(component => (\n <li key={component.tagName}>\n <button\n class=\"le-slot-picker-item\"\n onClick={() => {\n this.addComponent(component.tagName);\n this.pickerOpen = false;\n }}\n >\n <span class=\"le-slot-picker-name\">{component.name}</span>\n {component.description && <span class=\"le-slot-picker-desc\">{component.description}</span>}\n </button>\n </li>\n ))}\n </ul>\n ) : (\n <div class=\"le-slot-picker-empty\">No components available</div>\n )}\n </div>\n </le-popover>\n )}\n </div>\n {this.renderContent()}\n </div>\n ) : (\n // In default mode, just pass through the slot - slotted content renders naturally\n // Note: We use unnamed slot here because named slots from parent component\n // are passed as le-slot's light DOM children\n <slot\n // ref={(el) => this.slotRef = el as HTMLSlotElement}\n // onSlotchange={this.handleSlotChange}\n ></slot>\n )}\n </Host>\n );\n }\n\n private renderContent() {\n // Create the slot element with ref for reading assignedNodes\n // Wrap in a hidden div since slot elements can't have style prop in Stencil\n // Note: We use unnamed slot here because named slots from parent component\n // are passed as le-slot's light DOM children\n const slotElement = (\n <div class=\"hidden-slot\">\n <slot ref={el => (this.slotRef = el as HTMLSlotElement)} onSlotchange={this.handleSlotChange}></slot>\n </div>\n );\n\n switch (this.type) {\n case 'text':\n return (\n <div class={{ 'le-slot-input': true, 'has-error': !this.isValidHtml }}>\n <le-string-input\n mode=\"default\"\n value={this.textValue}\n placeholder={this.placeholder || `Enter ${this.label || this.name || 'text'}...`}\n onChange={this.handleTextInput}\n // required={this.required}\n ></le-string-input>\n {slotElement}\n </div>\n );\n\n case 'textarea':\n return (\n <div class={{ 'le-slot-input': true, 'has-error': !this.isValidHtml }}>\n <textarea\n value={this.textValue}\n placeholder={this.placeholder || `Enter ${this.label || this.name || 'text'}...`}\n onInput={this.handleTextInput}\n required={this.required}\n rows={3}\n ></textarea>\n {slotElement}\n </div>\n );\n\n case 'slot':\n default:\n // Parse slotStyle string into style object if provided\n const dropzoneStyle: { [key: string]: string } = {};\n if (this.slotStyle) {\n this.slotStyle.split(';').forEach(rule => {\n const [prop, value] = rule.split(':').map(s => s.trim());\n if (prop && value) {\n // Convert kebab-case to camelCase for style object\n const camelProp = prop.replace(/-([a-z])/g, (_, letter) => letter.toUpperCase());\n dropzoneStyle[camelProp] = value;\n }\n });\n }\n return (\n <div class=\"le-slot-dropzone\" style={dropzoneStyle}>\n <slot ref={el => (this.slotRef = el as HTMLSlotElement)} onSlotchange={this.handleSlotChange}></slot>\n </div>\n );\n }\n }\n}\n\n/**\n * Component info from the manifest\n */\ninterface ComponentInfo {\n tagName: string;\n name: string;\n description: string;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"le-slot.js","sourceRoot":"","sources":["../../../src/components/le-slot/le-slot.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAgB,MAAM,eAAe,CAAC;AAC9F,OAAO,EAAE,UAAU,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Prop, State, h, Host, Element, Event, EventEmitter } from '@stencil/core';\nimport { classnames, observeModeChanges } from '../../utils/utils';\nimport { getLeKitConfig } from '../../global/app';\n\n/**\n * Slot placeholder component for admin/CMS mode.\n *\n * This component renders a visual placeholder for slots when in admin mode,\n * allowing CMS systems to show available drop zones for content or inline editing.\n *\n * In non-admin mode, this component renders nothing and acts as a passthrough.\n *\n * @slot - Default slot for placeholder content or drop zone UI\n *\n * @cmsInternal true\n * @cmsCategory System\n */\n@Component({\n tag: 'le-slot',\n styleUrl: 'le-slot.default.css',\n shadow: true,\n})\nexport class LeSlot {\n @Element() el: HTMLElement;\n\n /**\n * The type of slot content.\n * - `slot`: Default, shows a dropzone for components (default)\n * - `text`: Shows a single-line text input\n * - `textarea`: Shows a multi-line text area\n */\n @Prop() type: 'slot' | 'text' | 'textarea' = 'slot';\n\n /**\n * The name of the slot this placeholder represents.\n * Should match the slot name in the parent component.\n */\n @Prop() name: string = '';\n\n /**\n * Label to display in admin mode.\n * If not provided, the slot name will be used.\n */\n @Prop() label?: string;\n\n /**\n * Description of what content this slot accepts.\n * Shown in admin mode to guide content editors.\n */\n @Prop() description?: string;\n\n /**\n * Comma-separated list of allowed component tags for this slot.\n * Used by CMS to filter available components.\n *\n * @example \"le-card,le-button,le-text\"\n */\n @Prop() allowedComponents?: string;\n\n /**\n * Whether multiple components can be dropped in this slot.\n */\n @Prop() multiple: boolean = true;\n\n /**\n * Whether this slot is required to have content.\n */\n @Prop() required: boolean = false;\n\n /**\n * Placeholder text for text/textarea inputs in admin mode.\n */\n @Prop() placeholder?: string;\n\n /**\n * The HTML tag to create when there's no slotted element.\n * Used with type=\"text\" or type=\"textarea\" to auto-create elements.\n *\n * @example \"h3\" - creates <h3 slot=\"header\">content</h3>\n * @example \"p\" - creates <p slot=\"content\">content</p>\n */\n @Prop() tag?: string;\n\n /**\n * CSS styles for the slot dropzone container.\n * Useful for layouts - e.g., \"flex-direction: row\" for horizontal stacks.\n * Only applies in admin mode for type=\"slot\".\n */\n @Prop() slotStyle?: string;\n\n /**\n * Internal state to track admin mode\n */\n @State() private adminMode: boolean = false;\n\n /**\n * Internal state for text input value (synced from slot content)\n */\n @State() private textValue: string = '';\n\n /**\n * Whether the current textValue contains valid HTML\n */\n @State() private isValidHtml: boolean = true;\n\n /**\n * Available components loaded from Custom Elements Manifest\n */\n @State() private availableComponents: ComponentInfo[] = [];\n\n /**\n * Whether the component picker popover is open\n */\n @State() private pickerOpen: boolean = false;\n\n /**\n * Reference to the slot element to access assignedNodes\n */\n private slotRef?: HTMLSlotElement;\n\n /**\n * The original slotted element (e.g., <h3 slot=\"header\">)\n */\n private slottedElement?: Element;\n\n /**\n * Emitted when text content changes in admin mode.\n * The event detail contains the new text value and validity.\n */\n @Event() leSlotChange: EventEmitter<{ name: string; value: string; isValid: boolean }>;\n\n private disconnectModeObserver?: () => void;\n\n connectedCallback() {\n this.disconnectModeObserver = observeModeChanges(this.el, mode => {\n const wasAdmin = this.adminMode;\n this.adminMode = mode === 'admin';\n\n // When entering admin mode, read content from slotted elements\n if (this.adminMode && !wasAdmin) {\n // Need to wait for render to access slot ref\n requestAnimationFrame(() => this.readSlottedContent());\n\n // Load available components for the component picker\n if (this.type === 'slot') {\n this.loadAvailableComponents();\n }\n }\n });\n }\n\n disconnectedCallback() {\n this.disconnectModeObserver?.();\n }\n\n /**\n * Flag to prevent re-reading content right after we updated it\n */\n private isUpdating: boolean = false;\n\n /**\n * Read content from slotted elements via assignedNodes()\n */\n private readSlottedContent() {\n if (!this.slotRef) return;\n\n // Skip if we just updated the content ourselves\n if (this.isUpdating) {\n this.isUpdating = false;\n return;\n }\n\n const assignedNodes = this.slotRef.assignedNodes({ flatten: true });\n\n // For text/textarea types, we want to edit the innerHTML of slotted elements\n if (this.type === 'text' || this.type === 'textarea') {\n // Find the first element node (skip text nodes that are just whitespace)\n const elementNode = assignedNodes.find(node => node.nodeType === Node.ELEMENT_NODE) as Element | undefined;\n\n if (elementNode) {\n // Only update textValue if slotted element changed or we don't have one yet\n if (this.slottedElement !== elementNode) {\n this.slottedElement = elementNode;\n this.textValue = elementNode.innerHTML?.trim() || '';\n // console.log(`[le-slot \"${this.name}\"] Read slotted content:`, this.textValue);\n }\n } else {\n // No element, check for direct text content\n const textContent = assignedNodes\n .filter(node => node.nodeType === Node.TEXT_NODE)\n .map(node => node.textContent)\n .join('')\n .trim();\n\n if (textContent && !this.textValue) {\n this.textValue = textContent;\n // console.log(`[le-slot \"${this.name}\"] Read text content:`, this.textValue);\n }\n }\n }\n }\n\n /**\n * Validates if a string contains valid HTML\n */\n private validateHtml(html: string): boolean {\n // Empty string is valid\n if (!html.trim()) return true;\n\n // Create a template element to parse the HTML\n const template = document.createElement('template');\n template.innerHTML = html;\n\n // Check that we don't have obviously broken HTML\n // Count opening and closing tags for common elements\n const openTags = (html.match(/<[a-z][^>]*(?<!\\/)>/gi) || []).length;\n const closeTags = (html.match(/<\\/[a-z][^>]*>/gi) || []).length;\n const selfClosing = (html.match(/<[a-z][^>]*\\/>/gi) || []).length;\n\n // Simple validation: opening tags (minus self-closing) should roughly match closing tags\n // Allow some tolerance for void elements like <br>, <img>, etc.\n const voidElements = (html.match(/<(br|hr|img|input|meta|link|area|base|col|embed|param|source|track|wbr)[^>]*>/gi) || []).length;\n\n const effectiveOpenTags = openTags - selfClosing - voidElements;\n\n // If difference is too large, HTML is likely broken\n if (Math.abs(effectiveOpenTags - closeTags) > 1) {\n return false;\n }\n\n return true;\n }\n\n private handleTextInput = (event: Event) => {\n const target = event.target as HTMLInputElement | HTMLTextAreaElement;\n this.textValue = target.value;\n this.isValidHtml = this.validateHtml(this.textValue);\n\n if (this.isValidHtml) {\n // Set flag to prevent slotchange from re-reading what we just wrote\n this.isUpdating = true;\n\n console.log('Updating text value:', this.textValue, 'slottedElement:', this.slottedElement);\n\n if (this.slottedElement) {\n // Update existing slotted element's innerHTML\n this.slottedElement.innerHTML = this.textValue;\n } else if (this.tag && this.textValue) {\n // No slotted element exists\n // If the slot doesn't have a name, then it's the default slot\n // remove the existing non-slotted content (text nodes and elements without slot attribute)\n const rootNode = this.el.getRootNode();\n if (!this.name && rootNode instanceof ShadowRoot) {\n const hostComponent = rootNode.host;\n Array.from(hostComponent.childNodes).forEach(node => {\n if (node.nodeType === Node.TEXT_NODE || (node.nodeType === Node.ELEMENT_NODE && !(node as Element).hasAttribute('slot'))) {\n node.remove();\n }\n });\n }\n // create one using the specified tag\n this.createSlottedElement();\n } else if (this.textValue) {\n // no tag specified - just replace everything in the host component\n const rootNode = this.el.getRootNode();\n if (rootNode instanceof ShadowRoot) {\n const hostComponent = rootNode.host;\n hostComponent.innerHTML = this.textValue;\n }\n }\n }\n\n this.leSlotChange.emit({\n name: this.name,\n value: this.textValue,\n isValid: this.isValidHtml,\n });\n };\n\n /**\n * Create a new slotted element when none exists.\n * The element is appended to the host component's light DOM.\n */\n private createSlottedElement() {\n if (!this.tag) return;\n\n // Find the host component (le-card, etc.) by traversing up through shadow DOM\n // le-slot is inside le-card's shadow DOM, so we need to find le-card's host\n const rootNode = this.el.getRootNode();\n if (!(rootNode instanceof ShadowRoot)) return;\n\n const hostComponent = rootNode.host;\n if (!hostComponent) return;\n\n // Create the new element\n const newElement = document.createElement(this.tag);\n newElement.innerHTML = this.textValue;\n\n // Set the slot attribute if this is a named slot\n if (this.name) {\n newElement.setAttribute('slot', this.name);\n }\n\n // Append to the host component's light DOM\n hostComponent.appendChild(newElement);\n\n // Store reference to the new element\n this.slottedElement = newElement;\n\n // console.log(`[le-slot \"${this.name}\"] Created new <${this.tag}> element`);\n }\n\n /**\n * Load available components from Custom Elements Manifest\n */\n private async loadAvailableComponents() {\n try {\n const { manifestUrl } = getLeKitConfig();\n const response = await fetch(manifestUrl);\n const manifest = await response.json();\n\n const components: ComponentInfo[] = [];\n const allowedList = this.allowedComponents?.split(',').map(s => s.trim()) || [];\n\n for (const module of manifest.modules) {\n for (const declaration of module.declarations || []) {\n if (declaration.tagName && declaration.customElement) {\n // Skip internal components (le-slot, le-component, le-popover)\n const isInternal = ['le-slot', 'le-component', 'le-popover'].includes(declaration.tagName);\n if (isInternal) continue;\n\n // If allowedComponents is specified, filter by it\n if (allowedList.length > 0 && !allowedList.includes(declaration.tagName)) {\n continue;\n }\n\n components.push({\n tagName: declaration.tagName,\n name: this.formatComponentName(declaration.tagName),\n description: declaration.description || '',\n });\n }\n }\n }\n\n this.availableComponents = components || [];\n } catch (error) {\n console.warn('[le-slot] Failed to load component manifest:', error);\n }\n }\n\n /**\n * Format a tag name into a display name\n * e.g., 'le-card' -> 'Card'\n */\n private formatComponentName(tagName: string): string {\n return tagName\n .replace(/^le-/, '')\n .split('-')\n .map(word => word.charAt(0).toUpperCase() + word.slice(1))\n .join(' ');\n }\n\n /**\n * Add a new component to the slot\n */\n private addComponent(tagName: string) {\n // Find the host component by traversing up through shadow DOM\n const rootNode = this.el.getRootNode();\n if (!(rootNode instanceof ShadowRoot)) return;\n\n const hostComponent = rootNode.host;\n if (!hostComponent) return;\n\n // Create the new component element\n const newElement = document.createElement(tagName);\n\n // Set the slot attribute if this is a named slot\n if (this.name) {\n newElement.setAttribute('slot', this.name);\n }\n\n // Append to the host component's light DOM\n hostComponent.appendChild(newElement);\n\n // Emit change event so the page can save\n this.leSlotChange.emit({\n name: this.name,\n value: hostComponent.innerHTML,\n isValid: true,\n });\n }\n\n /**\n * Handle slot change event to re-read content when nodes are assigned\n */\n private handleSlotChange = () => {\n this.readSlottedContent();\n };\n\n render() {\n const displayLabel = this.label || this.name;\n\n // Always render the same structure, CSS handles visibility via .admin-mode class\n return (\n <Host\n class={{\n 'admin-mode': this.adminMode,\n 'invalid-html': !this.isValidHtml,\n }}\n role={this.adminMode ? 'region' : undefined}\n aria-label={this.adminMode ? `Slot: ${displayLabel}` : undefined}\n data-slot-name={this.name}\n data-slot-type={this.type}\n data-allowed={this.allowedComponents}\n data-multiple={this.multiple}\n data-required={this.required}\n >\n {this.adminMode ? (\n <div class=\"le-slot-container\">\n <div\n class={classnames('le-slot-header', {\n 'le-slot-header-no-label': !displayLabel,\n 'le-slot-header-text': this.type === 'text',\n 'le-slot-header-error': !this.isValidHtml,\n })}\n >\n {displayLabel && (\n <span class=\"le-slot-label\">\n {displayLabel}\n {this.required && <span class=\"le-slot-required\">*</span>}\n </span>\n )}\n {/* {this.description && <le-popover mode=\"default\" showClose={false} align=\"end\" position=\"bottom\">\n <span slot=\"trigger\" class=\"le-slot-description-icon\">ℹ️</span>\n {this.description}\n </le-popover>} */}\n {!this.isValidHtml && <span class=\"le-slot-invalid\">⚠ Invalid HTML</span>}\n {this.type === 'slot' && this.adminMode && (\n <le-popover\n mode=\"default\"\n showClose={true}\n align=\"start\"\n position=\"right\"\n popoverTitle=\"Add Component\"\n open={this.pickerOpen}\n onLePopoverOpen={() => (this.pickerOpen = true)}\n onLePopoverClose={() => (this.pickerOpen = false)}\n >\n <le-button type=\"button\" class=\"le-slot-button\" slot=\"trigger\" variant=\"clear\" size=\"small\" aria-label=\"Add component\" icon-only>\n <span class=\"le-slot-add-btn\" slot=\"icon-only\">\n +\n </span>\n </le-button>\n <div class=\"le-slot-picker\">\n {this.availableComponents.length > 0 ? (\n <ul class=\"le-slot-picker-list\">\n {this.availableComponents.map(component => (\n <li key={component.tagName}>\n <button\n class=\"le-slot-picker-item\"\n onClick={() => {\n this.addComponent(component.tagName);\n this.pickerOpen = false;\n }}\n >\n <span class=\"le-slot-picker-name\">{component.name}</span>\n {component.description && <span class=\"le-slot-picker-desc\">{component.description}</span>}\n </button>\n </li>\n ))}\n </ul>\n ) : (\n <div class=\"le-slot-picker-empty\">No components available</div>\n )}\n </div>\n </le-popover>\n )}\n </div>\n {this.renderContent()}\n </div>\n ) : (\n // In default mode, just pass through the slot - slotted content renders naturally\n // Note: We use unnamed slot here because named slots from parent component\n // are passed as le-slot's light DOM children\n <slot\n // ref={(el) => this.slotRef = el as HTMLSlotElement}\n // onSlotchange={this.handleSlotChange}\n ></slot>\n )}\n </Host>\n );\n }\n\n private renderContent() {\n // Create the slot element with ref for reading assignedNodes\n // Wrap in a hidden div since slot elements can't have style prop in Stencil\n // Note: We use unnamed slot here because named slots from parent component\n // are passed as le-slot's light DOM children\n const slotElement = (\n <div class=\"hidden-slot\">\n <slot ref={el => (this.slotRef = el as HTMLSlotElement)} onSlotchange={this.handleSlotChange}></slot>\n </div>\n );\n\n switch (this.type) {\n case 'text':\n return (\n <div class={{ 'le-slot-input': true, 'has-error': !this.isValidHtml }}>\n <le-string-input\n mode=\"default\"\n value={this.textValue}\n placeholder={this.placeholder || `Enter ${this.label || this.name || 'text'}...`}\n onChange={this.handleTextInput}\n // required={this.required}\n ></le-string-input>\n {slotElement}\n </div>\n );\n\n case 'textarea':\n return (\n <div class={{ 'le-slot-input': true, 'has-error': !this.isValidHtml }}>\n <textarea\n value={this.textValue}\n placeholder={this.placeholder || `Enter ${this.label || this.name || 'text'}...`}\n onInput={this.handleTextInput}\n required={this.required}\n rows={3}\n ></textarea>\n {slotElement}\n </div>\n );\n\n case 'slot':\n default:\n // Parse slotStyle string into style object if provided\n const dropzoneStyle: { [key: string]: string } = {};\n if (this.slotStyle) {\n this.slotStyle.split(';').forEach(rule => {\n const [prop, value] = rule.split(':').map(s => s.trim());\n if (prop && value) {\n // Convert kebab-case to camelCase for style object\n const camelProp = prop.replace(/-([a-z])/g, (_, letter) => letter.toUpperCase());\n dropzoneStyle[camelProp] = value;\n }\n });\n }\n return (\n <div class=\"le-slot-dropzone\" style={dropzoneStyle}>\n <slot ref={el => (this.slotRef = el as HTMLSlotElement)} onSlotchange={this.handleSlotChange}></slot>\n </div>\n );\n }\n }\n}\n\n/**\n * Component info from the manifest\n */\ninterface ComponentInfo {\n tagName: string;\n name: string;\n description: string;\n}\n"]}
|