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
|
@@ -127,4 +127,41 @@ export function setGlobalMode(mode) {
|
|
|
127
127
|
export function setGlobalTheme(theme) {
|
|
128
128
|
document.documentElement.setAttribute('theme', theme);
|
|
129
129
|
}
|
|
130
|
+
/**
|
|
131
|
+
* Global configuration for le-kit
|
|
132
|
+
*/
|
|
133
|
+
let leKitConfig = {
|
|
134
|
+
/**
|
|
135
|
+
* URL to the custom-elements.json manifest.
|
|
136
|
+
* Used by admin components (le-component, le-slot) to load component metadata.
|
|
137
|
+
*
|
|
138
|
+
* Default: '/custom-elements.json' (served from app root)
|
|
139
|
+
*
|
|
140
|
+
* For apps using le-kit, you may need to:
|
|
141
|
+
* 1. Copy the manifest from node_modules/le-kit/custom-elements.json to your public folder
|
|
142
|
+
* 2. Or set this to point to where the manifest is served
|
|
143
|
+
*/
|
|
144
|
+
manifestUrl: '/custom-elements.json',
|
|
145
|
+
};
|
|
146
|
+
/**
|
|
147
|
+
* Configure le-kit global settings.
|
|
148
|
+
*
|
|
149
|
+
* @example
|
|
150
|
+
* ```ts
|
|
151
|
+
* import { configureLeki } from 'le-kit';
|
|
152
|
+
*
|
|
153
|
+
* configureLeki({
|
|
154
|
+
* manifestUrl: '/assets/custom-elements.json'
|
|
155
|
+
* });
|
|
156
|
+
* ```
|
|
157
|
+
*/
|
|
158
|
+
export function configureLeki(config) {
|
|
159
|
+
leKitConfig = { ...leKitConfig, ...config };
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Get the current le-kit configuration.
|
|
163
|
+
*/
|
|
164
|
+
export function getLeKitConfig() {
|
|
165
|
+
return leKitConfig;
|
|
166
|
+
}
|
|
130
167
|
//# sourceMappingURL=app.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app.js","sourceRoot":"","sources":["../../src/global/app.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAKxC;;;;;;;;;;;;GAYG;AACH,SAAS,cAAc;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CAAC,OAAO,CAAC,CAAC;IACjE,IAAI,SAAS,EAAE,CAAC;QACd,OAAO,SAAuB,CAAC;IACjC,CAAC;IAED,OAAO,SAAS,CAAC;AACnB,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,aAAa,CAAC,IAAe;IAC3C,QAAQ,CAAC,eAAe,CAAC,YAAY,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;AACtD,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,cAAc,CAAC,KAAiB;IAC9C,QAAQ,CAAC,eAAe,CAAC,YAAY,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;AACxD,CAAC","sourcesContent":["import { setMode } from '@stencil/core';\n\nexport type LeKitMode = 'default' | 'admin' | string;\nexport type LeKitTheme = 'default' | 'dark' | string;\n\n/**\n * Global mode initialization for le-kit components.\n *\n * Mode inheritance works as follows:\n * 1. Check the element's own `mode` attribute\n * 2. Traverse up the DOM to find a parent with `mode` attribute\n * 3. Check the document root element (html) for `mode` attribute\n * 4. Fall back to 'default'\n *\n * This allows setting mode at any level:\n * - `<html mode=\"admin\">` - all components in admin mode\n * - `<le-card mode=\"admin\">` - this card and its children in admin mode\n */\nfunction initializeMode() {\n setMode((el: HTMLElement): LeKitMode => {\n // 1. Check element's own mode attribute\n const ownMode = el.getAttribute('mode');\n if (ownMode) {\n return ownMode as LeKitMode;\n }\n\n // 2. Traverse up the DOM tree to find inherited mode\n let parent = el.parentElement;\n while (parent) {\n const parentMode = parent.getAttribute('mode');\n if (parentMode) {\n return parentMode as LeKitMode;\n }\n parent = parent.parentElement;\n }\n\n // 3. Check document root element\n const rootMode = document.documentElement.getAttribute('mode');\n if (rootMode) {\n return rootMode as LeKitMode;\n }\n\n // 4. Default mode\n return 'default';\n });\n}\n\n// Default export for Stencil global script\nexport default initializeMode;\n\n/**\n * Helper function to get the current mode for an element.\n * Can be used programmatically in components.\n * \n * This function traverses both regular DOM and shadow DOM boundaries\n * to find the nearest mode attribute.\n */\nexport function getMode(el: HTMLElement): LeKitMode {\n // Check element's own mode\n const ownMode = el.getAttribute('mode');\n if (ownMode) {\n return ownMode as LeKitMode;\n }\n\n // Traverse up DOM, crossing shadow boundaries\n let current: Node | null = el;\n while (current) {\n // Try parent element first\n if (current instanceof Element && current.parentElement) {\n current = current.parentElement;\n const mode = (current as HTMLElement).getAttribute?.('mode');\n if (mode) {\n return mode as LeKitMode;\n }\n } else {\n // No parent element - check if we're in a shadow root\n const root = current.getRootNode();\n if (root instanceof ShadowRoot) {\n // Cross the shadow boundary to the host element\n current = root.host;\n const mode = (current as HTMLElement).getAttribute?.('mode');\n if (mode) {\n return mode as LeKitMode;\n }\n } else {\n // We've reached the document root\n break;\n }\n }\n }\n\n // Check document root\n const rootMode = document.documentElement.getAttribute('mode');\n if (rootMode) {\n return rootMode as LeKitMode;\n }\n\n return 'default';\n}\n\n/**\n * Helper function to get the current theme for an element.\n * Theme inheritance works the same as mode - cascades through DOM.\n */\nexport function getTheme(el: HTMLElement): LeKitTheme {\n // Check element's own theme\n const ownTheme = el.getAttribute('theme');\n if (ownTheme) {\n return ownTheme as LeKitTheme;\n }\n\n // Traverse up DOM\n let parent = el.parentElement;\n while (parent) {\n const parentTheme = parent.getAttribute('theme');\n if (parentTheme) {\n return parentTheme as LeKitTheme;\n }\n parent = parent.parentElement;\n }\n\n // Check root\n const rootTheme = document.documentElement.getAttribute('theme');\n if (rootTheme) {\n return rootTheme as LeKitTheme;\n }\n\n return 'default';\n}\n\n/**\n * Helper function to set mode on the document root.\n * Useful for switching all components to admin mode.\n */\nexport function setGlobalMode(mode: LeKitMode): void {\n document.documentElement.setAttribute('mode', mode);\n}\n\n/**\n * Helper function to set theme on the document root.\n * Useful for switching all components to a different theme.\n */\nexport function setGlobalTheme(theme: LeKitTheme): void {\n document.documentElement.setAttribute('theme', theme);\n}\n"]}
|
|
1
|
+
{"version":3,"file":"app.js","sourceRoot":"","sources":["../../src/global/app.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,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C;IAED,aAAa;IACb,MAAM,SAAS,GAAG,QAAQ,CAAC,eAAe,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC;IACjE,IAAI,SAAS,EAAE,CAAC;QACd,OAAO,SAAuB,CAAC;IACjC,CAAC;IAED,OAAO,SAAS,CAAC;AACnB,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,aAAa,CAAC,IAAe;IAC3C,QAAQ,CAAC,eAAe,CAAC,YAAY,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;AACtD,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,cAAc,CAAC,KAAiB;IAC9C,QAAQ,CAAC,eAAe,CAAC,YAAY,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;AACxD,CAAC;AAED;;GAEG;AACH,IAAI,WAAW,GAAG;IAChB;;;;;;;;;OASG;IACH,WAAW,EAAE,uBAAuB;CACrC,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,aAAa,CAAC,MAAmC;IAC/D,WAAW,GAAG,EAAE,GAAG,WAAW,EAAE,GAAG,MAAM,EAAE,CAAC;AAC9C,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,cAAc;IAC5B,OAAO,WAAW,CAAC;AACrB,CAAC","sourcesContent":["import { setMode } from '@stencil/core';\n\nexport type LeKitMode = 'default' | 'admin' | string;\nexport type LeKitTheme = 'default' | 'dark' | string;\n\n/**\n * Global mode initialization for le-kit components.\n *\n * Mode inheritance works as follows:\n * 1. Check the element's own `mode` attribute\n * 2. Traverse up the DOM to find a parent with `mode` attribute\n * 3. Check the document root element (html) for `mode` attribute\n * 4. Fall back to 'default'\n *\n * This allows setting mode at any level:\n * - `<html mode=\"admin\">` - all components in admin mode\n * - `<le-card mode=\"admin\">` - this card and its children in admin mode\n */\nfunction initializeMode() {\n setMode((el: HTMLElement): LeKitMode => {\n // 1. Check element's own mode attribute\n const ownMode = el.getAttribute('mode');\n if (ownMode) {\n return ownMode as LeKitMode;\n }\n\n // 2. Traverse up the DOM tree to find inherited mode\n let parent = el.parentElement;\n while (parent) {\n const parentMode = parent.getAttribute('mode');\n if (parentMode) {\n return parentMode as LeKitMode;\n }\n parent = parent.parentElement;\n }\n\n // 3. Check document root element\n const rootMode = document.documentElement.getAttribute('mode');\n if (rootMode) {\n return rootMode as LeKitMode;\n }\n\n // 4. Default mode\n return 'default';\n });\n}\n\n// Default export for Stencil global script\nexport default initializeMode;\n\n/**\n * Helper function to get the current mode for an element.\n * Can be used programmatically in components.\n * \n * This function traverses both regular DOM and shadow DOM boundaries\n * to find the nearest mode attribute.\n */\nexport function getMode(el: HTMLElement): LeKitMode {\n // Check element's own mode\n const ownMode = el.getAttribute('mode');\n if (ownMode) {\n return ownMode as LeKitMode;\n }\n\n // Traverse up DOM, crossing shadow boundaries\n let current: Node | null = el;\n while (current) {\n // Try parent element first\n if (current instanceof Element && current.parentElement) {\n current = current.parentElement;\n const mode = (current as HTMLElement).getAttribute?.('mode');\n if (mode) {\n return mode as LeKitMode;\n }\n } else {\n // No parent element - check if we're in a shadow root\n const root = current.getRootNode();\n if (root instanceof ShadowRoot) {\n // Cross the shadow boundary to the host element\n current = root.host;\n const mode = (current as HTMLElement).getAttribute?.('mode');\n if (mode) {\n return mode as LeKitMode;\n }\n } else {\n // We've reached the document root\n break;\n }\n }\n }\n\n // Check document root\n const rootMode = document.documentElement.getAttribute('mode');\n if (rootMode) {\n return rootMode as LeKitMode;\n }\n\n return 'default';\n}\n\n/**\n * Helper function to get the current theme for an element.\n * Theme inheritance works the same as mode - cascades through DOM.\n */\nexport function getTheme(el: HTMLElement): LeKitTheme {\n // Check element's own theme\n const ownTheme = el.getAttribute('theme');\n if (ownTheme) {\n return ownTheme as LeKitTheme;\n }\n\n // Traverse up DOM\n let parent = el.parentElement;\n while (parent) {\n const parentTheme = parent.getAttribute('theme');\n if (parentTheme) {\n return parentTheme as LeKitTheme;\n }\n parent = parent.parentElement;\n }\n\n // Check root\n const rootTheme = document.documentElement.getAttribute('theme');\n if (rootTheme) {\n return rootTheme as LeKitTheme;\n }\n\n return 'default';\n}\n\n/**\n * Helper function to set mode on the document root.\n * Useful for switching all components to admin mode.\n */\nexport function setGlobalMode(mode: LeKitMode): void {\n document.documentElement.setAttribute('mode', mode);\n}\n\n/**\n * Helper function to set theme on the document root.\n * Useful for switching all components to a different theme.\n */\nexport function setGlobalTheme(theme: LeKitTheme): void {\n document.documentElement.setAttribute('theme', theme);\n}\n\n/**\n * Global configuration for le-kit\n */\nlet leKitConfig = {\n /**\n * URL to the custom-elements.json manifest.\n * Used by admin components (le-component, le-slot) to load component metadata.\n * \n * Default: '/custom-elements.json' (served from app root)\n * \n * For apps using le-kit, you may need to:\n * 1. Copy the manifest from node_modules/le-kit/custom-elements.json to your public folder\n * 2. Or set this to point to where the manifest is served\n */\n manifestUrl: '/custom-elements.json',\n};\n\n/**\n * Configure le-kit global settings.\n * \n * @example\n * ```ts\n * import { configureLeki } from 'le-kit';\n * \n * configureLeki({\n * manifestUrl: '/assets/custom-elements.json'\n * });\n * ```\n */\nexport function configureLeki(config: Partial<typeof leKitConfig>): void {\n leKitConfig = { ...leKitConfig, ...config };\n}\n\n/**\n * Get the current le-kit configuration.\n */\nexport function getLeKitConfig(): typeof leKitConfig {\n return leKitConfig;\n}\n"]}
|
package/dist/collection/index.js
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
// Utility exports
|
|
10
10
|
export { generateId, parseCommaSeparated, slotHasContent } from './utils/utils';
|
|
11
11
|
// Global mode and theme helpers
|
|
12
|
-
export { getMode, setGlobalMode, getTheme, setGlobalTheme } from './global/app';
|
|
12
|
+
export { getMode, setGlobalMode, getTheme, setGlobalTheme, configureLeki, getLeKitConfig } from './global/app';
|
|
13
13
|
// Popup/dialog programmatic API
|
|
14
14
|
export { leAlert, leConfirm, lePrompt } from './components/le-popup/le-popup.api';
|
|
15
15
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,kBAAkB;AAClB,OAAO,EAAE,UAAU,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAEhF,gCAAgC;AAChC,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,kBAAkB;AAClB,OAAO,EAAE,UAAU,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAEhF,gCAAgC;AAChC,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,cAAc,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAG/G,gCAAgC;AAChC,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,oCAAoC,CAAC","sourcesContent":["/**\n * @fileoverview Entry point for le-kit component library\n *\n * This file exports utilities, types, and helper functions.\n * Components are auto-registered and available as custom elements.\n *\n * @see README.md for usage instructions\n */\n\n// Utility exports\nexport { generateId, parseCommaSeparated, slotHasContent } from './utils/utils';\n\n// Global mode and theme helpers\nexport { getMode, setGlobalMode, getTheme, setGlobalTheme, configureLeki, getLeKitConfig } from './global/app';\nexport type { LeKitMode, LeKitTheme } from './global/app';\n\n// Popup/dialog programmatic API\nexport { leAlert, leConfirm, lePrompt } from './components/le-popup/le-popup.api';\nexport type { PopupOptions } from './components/le-popup/le-popup.api';\nexport type { PopupResult, PopupType, PopupPosition } from './components/le-popup/le-popup';\n\n// Type exports\nexport type * from './components.d.ts';\n"]}
|
package/dist/components/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { i as initializeMode } from './le-button2.js';
|
|
2
|
-
export { g as generateId, a as getMode, c as getTheme, p as parseCommaSeparated, b as setGlobalMode, d as setGlobalTheme, s as slotHasContent } from './le-button2.js';
|
|
2
|
+
export { e as configureLeki, g as generateId, f as getLeKitConfig, a as getMode, c as getTheme, p as parseCommaSeparated, b as setGlobalMode, d as setGlobalTheme, s as slotHasContent } from './le-button2.js';
|
|
3
3
|
export { getAssetPath, render, setAssetPath, setNonce, setPlatformOptions } from '@stencil/core/internal/client';
|
|
4
4
|
export { LeBox, defineCustomElement as defineCustomElementLeBox } from './le-box.js';
|
|
5
5
|
export { LeButton, defineCustomElement as defineCustomElementLeButton } from './le-button.js';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { proxyCustomElement, HTMLElement, h, Host } from '@stencil/core/internal/client';
|
|
2
|
-
import {
|
|
2
|
+
import { h as classnames, j as defineCustomElement$2, k as defineCustomElement$3, l as defineCustomElement$5, m as defineCustomElement$6, n as defineCustomElement$7 } from './le-button2.js';
|
|
3
3
|
import { d as defineCustomElement$4 } from './le-popover2.js';
|
|
4
4
|
|
|
5
5
|
const leBoxDefaultCss = ":host{display:block;box-sizing:border-box}:host([hidden]){display:none}.box{width:100%;height:100%;box-sizing:border-box}.content{width:100%;height:100%;box-sizing:border-box;background:var(--le-box-bg, transparent);border-radius:var(--le-box-border-radius, 0);padding:var(--le-box-padding, 0)}:host(.display-flex) .content{min-height:100%}";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { setMode, proxyCustomElement, HTMLElement, createEvent, h,
|
|
1
|
+
import { setMode, proxyCustomElement, HTMLElement, createEvent, h, Host, Fragment } from '@stencil/core/internal/client';
|
|
2
2
|
import { d as defineCustomElement$5 } from './le-popover2.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
@@ -127,6 +127,43 @@ function setGlobalMode(mode) {
|
|
|
127
127
|
function setGlobalTheme(theme) {
|
|
128
128
|
document.documentElement.setAttribute('theme', theme);
|
|
129
129
|
}
|
|
130
|
+
/**
|
|
131
|
+
* Global configuration for le-kit
|
|
132
|
+
*/
|
|
133
|
+
let leKitConfig = {
|
|
134
|
+
/**
|
|
135
|
+
* URL to the custom-elements.json manifest.
|
|
136
|
+
* Used by admin components (le-component, le-slot) to load component metadata.
|
|
137
|
+
*
|
|
138
|
+
* Default: '/custom-elements.json' (served from app root)
|
|
139
|
+
*
|
|
140
|
+
* For apps using le-kit, you may need to:
|
|
141
|
+
* 1. Copy the manifest from node_modules/le-kit/custom-elements.json to your public folder
|
|
142
|
+
* 2. Or set this to point to where the manifest is served
|
|
143
|
+
*/
|
|
144
|
+
manifestUrl: '/custom-elements.json',
|
|
145
|
+
};
|
|
146
|
+
/**
|
|
147
|
+
* Configure le-kit global settings.
|
|
148
|
+
*
|
|
149
|
+
* @example
|
|
150
|
+
* ```ts
|
|
151
|
+
* import { configureLeki } from 'le-kit';
|
|
152
|
+
*
|
|
153
|
+
* configureLeki({
|
|
154
|
+
* manifestUrl: '/assets/custom-elements.json'
|
|
155
|
+
* });
|
|
156
|
+
* ```
|
|
157
|
+
*/
|
|
158
|
+
function configureLeki(config) {
|
|
159
|
+
leKitConfig = { ...leKitConfig, ...config };
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Get the current le-kit configuration.
|
|
163
|
+
*/
|
|
164
|
+
function getLeKitConfig() {
|
|
165
|
+
return leKitConfig;
|
|
166
|
+
}
|
|
130
167
|
|
|
131
168
|
/**
|
|
132
169
|
* Utility functions for le-kit components
|
|
@@ -677,8 +714,8 @@ const LeSlot = /*@__PURE__*/ proxyCustomElement(class LeSlot extends HTMLElement
|
|
|
677
714
|
*/
|
|
678
715
|
async loadAvailableComponents() {
|
|
679
716
|
try {
|
|
680
|
-
const
|
|
681
|
-
const response = await fetch(
|
|
717
|
+
const { manifestUrl } = getLeKitConfig();
|
|
718
|
+
const response = await fetch(manifestUrl);
|
|
682
719
|
const manifest = await response.json();
|
|
683
720
|
const components = [];
|
|
684
721
|
const allowedList = this.allowedComponents?.split(',').map(s => s.trim()) || [];
|
|
@@ -753,7 +790,7 @@ const LeSlot = /*@__PURE__*/ proxyCustomElement(class LeSlot extends HTMLElement
|
|
|
753
790
|
render() {
|
|
754
791
|
const displayLabel = this.label || this.name;
|
|
755
792
|
// Always render the same structure, CSS handles visibility via .admin-mode class
|
|
756
|
-
return (h(Host, { key: '
|
|
793
|
+
return (h(Host, { key: '5ff8f0dd3c07f92e0584450fabf57b89ea0c0a10', class: {
|
|
757
794
|
'admin-mode': this.adminMode,
|
|
758
795
|
'invalid-html': !this.isValidHtml,
|
|
759
796
|
}, 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', {
|
|
@@ -797,7 +834,6 @@ const LeSlot = /*@__PURE__*/ proxyCustomElement(class LeSlot extends HTMLElement
|
|
|
797
834
|
return (h("div", { class: "le-slot-dropzone", style: dropzoneStyle }, h("slot", { ref: el => (this.slotRef = el), onSlotchange: this.handleSlotChange })));
|
|
798
835
|
}
|
|
799
836
|
}
|
|
800
|
-
static get assetsDirs() { return ["../../assets"]; }
|
|
801
837
|
static get style() { return leSlotDefaultCss; }
|
|
802
838
|
}, [769, "le-slot", {
|
|
803
839
|
"type": [1],
|
|
@@ -959,9 +995,9 @@ const LeComponent = /*@__PURE__*/ proxyCustomElement(class LeComponent extends H
|
|
|
959
995
|
*/
|
|
960
996
|
async loadComponentMetadata() {
|
|
961
997
|
try {
|
|
962
|
-
// Fetch the manifest
|
|
963
|
-
const
|
|
964
|
-
const response = await fetch(
|
|
998
|
+
// Fetch the manifest from configured URL
|
|
999
|
+
const { manifestUrl } = getLeKitConfig();
|
|
1000
|
+
const response = await fetch(manifestUrl);
|
|
965
1001
|
const manifest = await response.json();
|
|
966
1002
|
// Find the component definition
|
|
967
1003
|
for (const module of manifest.modules) {
|
|
@@ -1099,7 +1135,6 @@ const LeComponent = /*@__PURE__*/ proxyCustomElement(class LeComponent extends H
|
|
|
1099
1135
|
// In admin mode, show wrapper with header and settings
|
|
1100
1136
|
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)))));
|
|
1101
1137
|
}
|
|
1102
|
-
static get assetsDirs() { return ["../../assets"]; }
|
|
1103
1138
|
static get style() { return leComponentCss; }
|
|
1104
1139
|
}, [769, "le-component", {
|
|
1105
1140
|
"component": [1],
|
|
@@ -1405,7 +1440,7 @@ function defineCustomElement() {
|
|
|
1405
1440
|
} });
|
|
1406
1441
|
}
|
|
1407
1442
|
|
|
1408
|
-
export { LeButton as L, getMode as a, setGlobalMode as b, getTheme as c, setGlobalTheme as d,
|
|
1443
|
+
export { LeButton as L, getMode as a, setGlobalMode as b, getTheme as c, setGlobalTheme as d, configureLeki as e, getLeKitConfig as f, generateId as g, classnames as h, initializeMode as i, defineCustomElement$4 as j, defineCustomElement$3 as k, defineCustomElement$2 as l, defineCustomElement$1 as m, defineCustomElement as n, LeCheckbox as o, parseCommaSeparated as p, LeComponent as q, LeSlot as r, slotHasContent as s, LeStringInput as t, observeModeChanges as u };
|
|
1409
1444
|
//# sourceMappingURL=le-button2.js.map
|
|
1410
1445
|
|
|
1411
1446
|
//# sourceMappingURL=le-button2.js.map
|