le-kit 0.1.4 → 0.1.6
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/cjs/{index-CO4npcak.js → index-WzJ78D5H.js} +9 -2
- package/dist/cjs/{index-CO4npcak.js.map → index-WzJ78D5H.js.map} +1 -1
- package/dist/cjs/index.cjs.js +2 -2
- 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 +25 -22
- 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-BeT0iyCQ.js → utils-CBjH2E8A.js} +3 -3
- package/dist/cjs/{utils-BeT0iyCQ.js.map → utils-CBjH2E8A.js.map} +1 -1
- package/dist/collection/assets/.gitkeep +1 -0
- package/dist/collection/assets/custom-elements.json +4305 -0
- package/dist/collection/components/le-component/le-component.js +10 -8
- package/dist/collection/components/le-component/le-component.js.map +1 -1
- package/dist/collection/components/le-slot/le-slot.js +15 -14
- package/dist/collection/components/le-slot/le-slot.js.map +1 -1
- package/dist/components/le-button2.js +24 -21
- package/dist/components/le-button2.js.map +1 -1
- package/dist/docs.json +2 -2
- package/dist/esm/{index-D71TXvJa.js → index-CdjJ98OT.js} +9 -3
- package/dist/esm/{index-D71TXvJa.js.map → index-CdjJ98OT.js.map} +1 -1
- 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 +25 -22
- 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-CJLZrrdC.js → utils-CzfSUhYB.js} +3 -3
- package/dist/esm/{utils-CJLZrrdC.js.map → utils-CzfSUhYB.js.map} +1 -1
- package/dist/le-kit/assets/custom-elements.json +4305 -0
- 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-cfc35bd3.entry.js → p-0633b3ab.entry.js} +2 -2
- package/dist/le-kit/{p-0955b105.entry.js → p-1452a995.entry.js} +2 -2
- package/dist/le-kit/{p-18d79ee2.entry.js → p-220528ee.entry.js} +2 -2
- package/dist/le-kit/p-32ff3dbe.entry.js +2 -0
- package/dist/le-kit/p-32ff3dbe.entry.js.map +1 -0
- package/dist/le-kit/{p-d04da1f5.entry.js → p-3551598e.entry.js} +2 -2
- package/dist/le-kit/{p-79d179bd.entry.js → p-722899f0.entry.js} +2 -2
- package/dist/le-kit/{p-c8a9288e.entry.js → p-95764888.entry.js} +2 -2
- package/dist/le-kit/{p-D71TXvJa.js → p-CdjJ98OT.js} +2 -2
- package/dist/le-kit/{p-D71TXvJa.js.map → p-CdjJ98OT.js.map} +1 -1
- package/dist/le-kit/{p-qIai5-eB.js → p-CvDc0yWN.js} +2 -2
- package/dist/le-kit/{p-qIai5-eB.js.map → p-CvDc0yWN.js.map} +1 -1
- package/dist/le-kit/{p-024a764e.entry.js → p-bc20e30d.entry.js} +2 -2
- package/dist/le-kit/{p-4b1d3b6d.entry.js → p-d32eddad.entry.js} +2 -2
- package/dist/types/components.d.ts +4 -4
- package/package.json +1 -1
- package/dist/le-kit/index-D21JjI31.js.map +0 -1
- package/dist/le-kit/p-073cf0b9.entry.js +0 -2
- package/dist/le-kit/p-073cf0b9.entry.js.map +0 -1
- package/dist/le-kit/utils-apol-Xc_.js.map +0 -1
- /package/dist/le-kit/{p-cfc35bd3.entry.js.map → p-0633b3ab.entry.js.map} +0 -0
- /package/dist/le-kit/{p-0955b105.entry.js.map → p-1452a995.entry.js.map} +0 -0
- /package/dist/le-kit/{p-18d79ee2.entry.js.map → p-220528ee.entry.js.map} +0 -0
- /package/dist/le-kit/{p-d04da1f5.entry.js.map → p-3551598e.entry.js.map} +0 -0
- /package/dist/le-kit/{p-79d179bd.entry.js.map → p-722899f0.entry.js.map} +0 -0
- /package/dist/le-kit/{p-c8a9288e.entry.js.map → p-95764888.entry.js.map} +0 -0
- /package/dist/le-kit/{p-024a764e.entry.js.map → p-bc20e30d.entry.js.map} +0 -0
- /package/dist/le-kit/{p-4b1d3b6d.entry.js.map → p-d32eddad.entry.js.map} +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { setMode, proxyCustomElement, HTMLElement, createEvent, h, Host, Fragment } from '@stencil/core/internal/client';
|
|
1
|
+
import { setMode, proxyCustomElement, HTMLElement, createEvent, h, getAssetPath, Host, Fragment } from '@stencil/core/internal/client';
|
|
2
2
|
import { d as defineCustomElement$5 } from './le-popover2.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
@@ -517,7 +517,7 @@ const LeSlot = /*@__PURE__*/ proxyCustomElement(class LeSlot extends HTMLElement
|
|
|
517
517
|
leSlotChange;
|
|
518
518
|
disconnectModeObserver;
|
|
519
519
|
connectedCallback() {
|
|
520
|
-
this.disconnectModeObserver = observeModeChanges(this.el,
|
|
520
|
+
this.disconnectModeObserver = observeModeChanges(this.el, mode => {
|
|
521
521
|
const wasAdmin = this.adminMode;
|
|
522
522
|
this.adminMode = mode === 'admin';
|
|
523
523
|
// When entering admin mode, read content from slotted elements
|
|
@@ -621,8 +621,7 @@ const LeSlot = /*@__PURE__*/ proxyCustomElement(class LeSlot extends HTMLElement
|
|
|
621
621
|
if (!this.name && rootNode instanceof ShadowRoot) {
|
|
622
622
|
const hostComponent = rootNode.host;
|
|
623
623
|
Array.from(hostComponent.childNodes).forEach(node => {
|
|
624
|
-
if (node.nodeType === Node.TEXT_NODE ||
|
|
625
|
-
(node.nodeType === Node.ELEMENT_NODE && !node.hasAttribute('slot'))) {
|
|
624
|
+
if (node.nodeType === Node.TEXT_NODE || (node.nodeType === Node.ELEMENT_NODE && !node.hasAttribute('slot'))) {
|
|
626
625
|
node.remove();
|
|
627
626
|
}
|
|
628
627
|
});
|
|
@@ -642,7 +641,7 @@ const LeSlot = /*@__PURE__*/ proxyCustomElement(class LeSlot extends HTMLElement
|
|
|
642
641
|
this.leSlotChange.emit({
|
|
643
642
|
name: this.name,
|
|
644
643
|
value: this.textValue,
|
|
645
|
-
isValid: this.isValidHtml
|
|
644
|
+
isValid: this.isValidHtml,
|
|
646
645
|
});
|
|
647
646
|
};
|
|
648
647
|
/**
|
|
@@ -678,7 +677,8 @@ const LeSlot = /*@__PURE__*/ proxyCustomElement(class LeSlot extends HTMLElement
|
|
|
678
677
|
*/
|
|
679
678
|
async loadAvailableComponents() {
|
|
680
679
|
try {
|
|
681
|
-
const
|
|
680
|
+
const manifestPath = getAssetPath('assets/custom-elements.json');
|
|
681
|
+
const response = await fetch(manifestPath);
|
|
682
682
|
const manifest = await response.json();
|
|
683
683
|
const components = [];
|
|
684
684
|
const allowedList = this.allowedComponents?.split(',').map(s => s.trim()) || [];
|
|
@@ -701,7 +701,7 @@ const LeSlot = /*@__PURE__*/ proxyCustomElement(class LeSlot extends HTMLElement
|
|
|
701
701
|
}
|
|
702
702
|
}
|
|
703
703
|
}
|
|
704
|
-
this.availableComponents = components;
|
|
704
|
+
this.availableComponents = components || [];
|
|
705
705
|
}
|
|
706
706
|
catch (error) {
|
|
707
707
|
console.warn('[le-slot] Failed to load component manifest:', error);
|
|
@@ -753,17 +753,17 @@ const LeSlot = /*@__PURE__*/ proxyCustomElement(class LeSlot extends HTMLElement
|
|
|
753
753
|
render() {
|
|
754
754
|
const displayLabel = this.label || this.name;
|
|
755
755
|
// Always render the same structure, CSS handles visibility via .admin-mode class
|
|
756
|
-
return (h(Host, { key: '
|
|
756
|
+
return (h(Host, { key: 'af150a31db62d9c3df9a8c10be34b9bb6756d07f', class: {
|
|
757
757
|
'admin-mode': this.adminMode,
|
|
758
|
-
'invalid-html': !this.isValidHtml
|
|
758
|
+
'invalid-html': !this.isValidHtml,
|
|
759
759
|
}, 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', {
|
|
760
760
|
'le-slot-header-no-label': !displayLabel,
|
|
761
761
|
'le-slot-header-text': this.type === 'text',
|
|
762
|
-
'le-slot-header-error': !this.isValidHtml
|
|
763
|
-
}) }, displayLabel && (h("span", { class: "le-slot-label" }, displayLabel, this.required && h("span", { class: "le-slot-required" }, "*"))), !this.isValidHtml && h("span", { class: "le-slot-invalid" }, "\u26A0 Invalid HTML"), this.type === 'slot' && this.adminMode && (h("le-popover", { mode: "default", showClose: true, align: "start", position: "right", popoverTitle: "Add Component", open: this.pickerOpen, onLePopoverOpen: () => this.pickerOpen = true, onLePopoverClose: () => this.pickerOpen = false }, h("le-button", { type: "button", class: "le-slot-button", slot: "trigger", variant: "clear", size: "small", "aria-label": "Add component", "icon-only": true }, h("span", { class: "le-slot-add-btn", slot: "icon-only" }, "+")), h("div", { class: "le-slot-picker" }, this.availableComponents.length > 0 ? (h("ul", { class: "le-slot-picker-list" }, this.availableComponents.map(component => (h("li", { key: component.tagName }, h("button", { class: "le-slot-picker-item", onClick: () => {
|
|
762
|
+
'le-slot-header-error': !this.isValidHtml,
|
|
763
|
+
}) }, displayLabel && (h("span", { class: "le-slot-label" }, displayLabel, this.required && h("span", { class: "le-slot-required" }, "*"))), !this.isValidHtml && h("span", { class: "le-slot-invalid" }, "\u26A0 Invalid HTML"), this.type === 'slot' && this.adminMode && (h("le-popover", { mode: "default", showClose: true, align: "start", position: "right", popoverTitle: "Add Component", open: this.pickerOpen, onLePopoverOpen: () => (this.pickerOpen = true), onLePopoverClose: () => (this.pickerOpen = false) }, h("le-button", { type: "button", class: "le-slot-button", slot: "trigger", variant: "clear", size: "small", "aria-label": "Add component", "icon-only": true }, h("span", { class: "le-slot-add-btn", slot: "icon-only" }, "+")), h("div", { class: "le-slot-picker" }, this.availableComponents.length > 0 ? (h("ul", { class: "le-slot-picker-list" }, this.availableComponents.map(component => (h("li", { key: component.tagName }, h("button", { class: "le-slot-picker-item", onClick: () => {
|
|
764
764
|
this.addComponent(component.tagName);
|
|
765
765
|
this.pickerOpen = false;
|
|
766
|
-
} }, h("span", { class: "le-slot-picker-name" }, component.name), component.description &&
|
|
766
|
+
} }, h("span", { class: "le-slot-picker-name" }, component.name), component.description && h("span", { class: "le-slot-picker-desc" }, component.description))))))) : (h("div", { class: "le-slot-picker-empty" }, "No components available")))))), this.renderContent())) : (
|
|
767
767
|
// In default mode, just pass through the slot - slotted content renders naturally
|
|
768
768
|
// Note: We use unnamed slot here because named slots from parent component
|
|
769
769
|
// are passed as le-slot's light DOM children
|
|
@@ -774,7 +774,7 @@ const LeSlot = /*@__PURE__*/ proxyCustomElement(class LeSlot extends HTMLElement
|
|
|
774
774
|
// Wrap in a hidden div since slot elements can't have style prop in Stencil
|
|
775
775
|
// Note: We use unnamed slot here because named slots from parent component
|
|
776
776
|
// are passed as le-slot's light DOM children
|
|
777
|
-
const slotElement = (h("div", { class: "hidden-slot" }, h("slot", { ref:
|
|
777
|
+
const slotElement = (h("div", { class: "hidden-slot" }, h("slot", { ref: el => (this.slotRef = el), onSlotchange: this.handleSlotChange })));
|
|
778
778
|
switch (this.type) {
|
|
779
779
|
case 'text':
|
|
780
780
|
return (h("div", { class: { 'le-slot-input': true, 'has-error': !this.isValidHtml } }, h("le-string-input", { mode: "default", value: this.textValue, placeholder: this.placeholder || `Enter ${this.label || this.name || 'text'}...`, onChange: this.handleTextInput }), slotElement));
|
|
@@ -794,9 +794,10 @@ const LeSlot = /*@__PURE__*/ proxyCustomElement(class LeSlot extends HTMLElement
|
|
|
794
794
|
}
|
|
795
795
|
});
|
|
796
796
|
}
|
|
797
|
-
return (h("div", { class: "le-slot-dropzone", style: dropzoneStyle }, h("slot", { ref:
|
|
797
|
+
return (h("div", { class: "le-slot-dropzone", style: dropzoneStyle }, h("slot", { ref: el => (this.slotRef = el), onSlotchange: this.handleSlotChange })));
|
|
798
798
|
}
|
|
799
799
|
}
|
|
800
|
+
static get assetsDirs() { return ["../../assets"]; }
|
|
800
801
|
static get style() { return leSlotDefaultCss; }
|
|
801
802
|
}, [769, "le-slot", {
|
|
802
803
|
"type": [1],
|
|
@@ -911,7 +912,7 @@ const LeComponent = /*@__PURE__*/ proxyCustomElement(class LeComponent extends H
|
|
|
911
912
|
// Find the host element - le-component is rendered inside the component's shadow DOM,
|
|
912
913
|
// so we need to find the shadow root's host element
|
|
913
914
|
this.findHostElement();
|
|
914
|
-
this.disconnectModeObserver = observeModeChanges(this.el,
|
|
915
|
+
this.disconnectModeObserver = observeModeChanges(this.el, mode => {
|
|
915
916
|
this.adminMode = mode === 'admin';
|
|
916
917
|
// Load metadata and refresh property values only when entering admin mode
|
|
917
918
|
if (this.adminMode) {
|
|
@@ -958,8 +959,9 @@ const LeComponent = /*@__PURE__*/ proxyCustomElement(class LeComponent extends H
|
|
|
958
959
|
*/
|
|
959
960
|
async loadComponentMetadata() {
|
|
960
961
|
try {
|
|
961
|
-
// Fetch the manifest
|
|
962
|
-
const
|
|
962
|
+
// Fetch the manifest using getAssetPath for correct bundle path
|
|
963
|
+
const manifestPath = getAssetPath('assets/custom-elements.json');
|
|
964
|
+
const response = await fetch(manifestPath);
|
|
963
965
|
const manifest = await response.json();
|
|
964
966
|
// Find the component definition
|
|
965
967
|
for (const module of manifest.modules) {
|
|
@@ -1063,7 +1065,7 @@ const LeComponent = /*@__PURE__*/ proxyCustomElement(class LeComponent extends H
|
|
|
1063
1065
|
*/
|
|
1064
1066
|
renderPropertyEditor() {
|
|
1065
1067
|
const hasProperties = this.componentMeta && this.componentMeta.attributes.length > 0;
|
|
1066
|
-
return (h("div", { class: "property-editor-container" }, hasProperties ? (h("form", { class: "property-editor", onSubmit:
|
|
1068
|
+
return (h("div", { class: "property-editor-container" }, hasProperties ? (h("form", { class: "property-editor", onSubmit: e => e.preventDefault() }, this.componentMeta.attributes.map(attr => this.renderPropertyField(attr)))) : (h("p", { class: "no-properties" }, "No editable properties")), h("div", { class: "property-editor-actions" }, h("le-button", { type: "button", variant: "outlined", color: "danger", "full-width": true, onClick: () => this.deleteComponent() }, h("span", { slot: "icon-start" }, "\uD83D\uDDD1\uFE0F"), h("span", null, "Delete Component")))));
|
|
1067
1069
|
}
|
|
1068
1070
|
/**
|
|
1069
1071
|
* Render a single property field based on its type
|
|
@@ -1075,15 +1077,15 @@ const LeComponent = /*@__PURE__*/ proxyCustomElement(class LeComponent extends H
|
|
|
1075
1077
|
const enumMatch = type.match(/^'[^']+'/);
|
|
1076
1078
|
if (enumMatch) {
|
|
1077
1079
|
const options = type.split('|').map(opt => opt.trim().replace(/'/g, ''));
|
|
1078
|
-
return (h("div", { class: "property-field" }, h("label", { htmlFor: `prop-${attr.name}` }, attr.name, attr.description && h("span", { class: "property-hint" }, attr.description)), h("select", { id: `prop-${attr.name}`, onChange:
|
|
1080
|
+
return (h("div", { class: "property-field" }, h("label", { htmlFor: `prop-${attr.name}` }, attr.name, attr.description && h("span", { class: "property-hint" }, attr.description)), h("select", { id: `prop-${attr.name}`, onChange: e => this.handlePropertyChange(attr.name, e.target.value, type) }, options.map(opt => (h("option", { value: opt, selected: value === opt || (!value && attr.default?.replace(/'/g, '') === opt) }, opt))))));
|
|
1079
1081
|
}
|
|
1080
1082
|
// Boolean type
|
|
1081
1083
|
if (type === 'boolean') {
|
|
1082
|
-
return (h("div", { class: "property-field property-field--checkbox" }, h("le-checkbox", { name: `prop-${attr.name}`, checked: value === true || value === '', onChange:
|
|
1084
|
+
return (h("div", { class: "property-field property-field--checkbox" }, h("le-checkbox", { name: `prop-${attr.name}`, checked: value === true || value === '', onChange: e => this.handlePropertyChange(attr.name, e.target.checked, type) }, attr.name, attr.description && h("div", { slot: "description" }, attr.description))));
|
|
1083
1085
|
}
|
|
1084
1086
|
// Number type
|
|
1085
1087
|
if (type === 'number') {
|
|
1086
|
-
return (h("div", { class: "property-field" }, h("label", { htmlFor: `prop-${attr.name}` }, attr.name, attr.description && h("span", { class: "property-hint" }, attr.description)), h("input", { type: "number", id: `prop-${attr.name}`, value: value ?? '', placeholder: attr.default, onChange:
|
|
1088
|
+
return (h("div", { class: "property-field" }, h("label", { htmlFor: `prop-${attr.name}` }, attr.name, attr.description && h("span", { class: "property-hint" }, attr.description)), h("input", { type: "number", id: `prop-${attr.name}`, value: value ?? '', placeholder: attr.default, onChange: e => this.handlePropertyChange(attr.name, e.target.value, type) })));
|
|
1087
1089
|
}
|
|
1088
1090
|
// Default: string/text input
|
|
1089
1091
|
return (h("div", { class: "property-field" }, h("le-string-input", { name: `prop-${attr.name}`, label: attr.name, value: value ?? '', placeholder: attr.default?.replace(/'/g, ''), onChange: (e) => this.handlePropertyChange(attr.name, e.detail.value, type) }, h("span", { slot: "description" }, attr.description))));
|
|
@@ -1097,6 +1099,7 @@ const LeComponent = /*@__PURE__*/ proxyCustomElement(class LeComponent extends H
|
|
|
1097
1099
|
// In admin mode, show wrapper with header and settings
|
|
1098
1100
|
return (h(Host, { class: classnames(this.component, this.hostClass, 'admin-mode'), style: this.hostStyle }, h("div", { class: "le-component-wrapper" }, h("div", { class: "le-component-header" }, h("span", { class: "le-component-name" }, name), h("le-popover", { popoverTitle: `${name} Settings`, position: "right", align: "start", "min-width": "300px", mode: "default" }, h("le-button", { type: "button", class: "le-component-button", slot: "trigger", variant: "clear", size: "small", "aria-label": "Edit component properties", "icon-only": true }, h("span", { class: "le-component-trigger", slot: "icon-only" }, "\u2699")), this.renderPropertyEditor())), h("div", { class: "le-component-content" }, h("slot", null)))));
|
|
1099
1101
|
}
|
|
1102
|
+
static get assetsDirs() { return ["../../assets"]; }
|
|
1100
1103
|
static get style() { return leComponentCss; }
|
|
1101
1104
|
}, [769, "le-component", {
|
|
1102
1105
|
"component": [1],
|