@webquark/core 0.0.1
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/LICENSE +21 -0
- package/dist/cjs/dom-CTqgGpWA.js +238 -0
- package/dist/cjs/index-CLlvFbDw.js +1774 -0
- package/dist/cjs/index-DGQOjEwT.js +33 -0
- package/dist/cjs/index.cjs.js +7 -0
- package/dist/cjs/loader.cjs.js +12 -0
- package/dist/cjs/q-button_3.cjs.entry.js +603 -0
- package/dist/cjs/q-card.cjs.entry.js +55 -0
- package/dist/cjs/q-carousel.cjs.entry.js +288 -0
- package/dist/cjs/q-circular-progress_2.cjs.entry.js +255 -0
- package/dist/cjs/q-data-table.cjs.entry.js +197 -0
- package/dist/cjs/q-dialog.cjs.entry.js +143 -0
- package/dist/cjs/q-dropdown.cjs.entry.js +348 -0
- package/dist/cjs/q-icon.cjs.entry.js +184 -0
- package/dist/cjs/q-quantity-selector.cjs.entry.js +178 -0
- package/dist/cjs/q-reel.cjs.entry.js +117 -0
- package/dist/cjs/q-sidepanel.cjs.entry.js +215 -0
- package/dist/cjs/q-step-diagram-item.cjs.entry.js +48 -0
- package/dist/cjs/q-step-diagram.cjs.entry.js +47 -0
- package/dist/cjs/q-syntax-box.cjs.entry.js +457 -0
- package/dist/cjs/q-textarea.cjs.entry.js +136 -0
- package/dist/cjs/q-thumbnail.cjs.entry.js +44 -0
- package/dist/cjs/q-toggle.cjs.entry.js +148 -0
- package/dist/cjs/webquark.cjs.js +24 -0
- package/dist/collection/assets/icons/braces.svg +14 -0
- package/dist/collection/assets/icons/check.svg +1 -0
- package/dist/collection/assets/icons/chevron-down.svg +1 -0
- package/dist/collection/assets/icons/chevron-left.svg +1 -0
- package/dist/collection/assets/icons/chevron-right.svg +1 -0
- package/dist/collection/assets/icons/chevron-up.svg +1 -0
- package/dist/collection/assets/icons/copy.svg +4 -0
- package/dist/collection/assets/icons/eye-off.svg +1 -0
- package/dist/collection/assets/icons/eye.svg +1 -0
- package/dist/collection/assets/icons/minus.svg +1 -0
- package/dist/collection/assets/icons/play.svg +1 -0
- package/dist/collection/assets/icons/plus.svg +1 -0
- package/dist/collection/assets/icons/search.svg +1 -0
- package/dist/collection/assets/icons/spinner.svg +1 -0
- package/dist/collection/assets/icons/trash-2.svg +1 -0
- package/dist/collection/assets/icons/x.svg +1 -0
- package/dist/collection/collection-manifest.json +32 -0
- package/dist/collection/components/button/button.css +174 -0
- package/dist/collection/components/button/button.js +358 -0
- package/dist/collection/components/card/card.css +96 -0
- package/dist/collection/components/card/card.js +147 -0
- package/dist/collection/components/carousel/carousel.css +177 -0
- package/dist/collection/components/carousel/carousel.js +467 -0
- package/dist/collection/components/circular-progress/circular-progress.css +85 -0
- package/dist/collection/components/circular-progress/circular-progress.js +122 -0
- package/dist/collection/components/data-table/data-table.css +219 -0
- package/dist/collection/components/data-table/data-table.js +481 -0
- package/dist/collection/components/dialog/dialog.css +240 -0
- package/dist/collection/components/dialog/dialog.js +481 -0
- package/dist/collection/components/dropdown/dropdown.css +292 -0
- package/dist/collection/components/dropdown/dropdown.js +606 -0
- package/dist/collection/components/icon/icon.css +39 -0
- package/dist/collection/components/icon/icon.js +297 -0
- package/dist/collection/components/input/input.css +276 -0
- package/dist/collection/components/input/input.js +609 -0
- package/dist/collection/components/quantity-selector/quantity-selector.css +131 -0
- package/dist/collection/components/quantity-selector/quantity-selector.js +361 -0
- package/dist/collection/components/reel/reel.css +185 -0
- package/dist/collection/components/reel/reel.js +214 -0
- package/dist/collection/components/scrollable/scrollable.css +122 -0
- package/dist/collection/components/scrollable/scrollable.js +536 -0
- package/dist/collection/components/sidepanel/sidepanel.css +371 -0
- package/dist/collection/components/sidepanel/sidepanel.js +460 -0
- package/dist/collection/components/step-diagram/step-diagram.css +21 -0
- package/dist/collection/components/step-diagram/step-diagram.js +74 -0
- package/dist/collection/components/step-diagram-item/step-diagram-item.css +253 -0
- package/dist/collection/components/step-diagram-item/step-diagram-item.js +131 -0
- package/dist/collection/components/syntax-box/syntax-box.css +206 -0
- package/dist/collection/components/syntax-box/syntax-box.js +534 -0
- package/dist/collection/components/textarea/textarea.css +83 -0
- package/dist/collection/components/textarea/textarea.js +461 -0
- package/dist/collection/components/thumbnail/thumbnail.css +109 -0
- package/dist/collection/components/thumbnail/thumbnail.js +171 -0
- package/dist/collection/components/toggle/toggle.css +212 -0
- package/dist/collection/components/toggle/toggle.js +390 -0
- package/dist/collection/components/tooltip/tooltip.css +65 -0
- package/dist/collection/components/tooltip/tooltip.js +249 -0
- package/dist/collection/index.js +10 -0
- package/dist/collection/playground/components/playground-code-preview/playground-code-preview.js +48 -0
- package/dist/collection/playground/components/playground-event-log/playground-event-log.js +63 -0
- package/dist/collection/playground/components/playground-header/playground-header.js +65 -0
- package/dist/collection/playground/components/playground-sidebar/playground-sidebar.js +74 -0
- package/dist/collection/playground/components/properties-panel/properties-panel.js +146 -0
- package/dist/collection/playground/components/properties-panel/property-row.js +31 -0
- package/dist/collection/playground/components/properties-panel/slot-row.js +27 -0
- package/dist/collection/playground/components/sandbox-viewport/sandbox-panel.js +334 -0
- package/dist/collection/playground/components/sandbox-viewport/sandbox-viewport.js +155 -0
- package/dist/collection/playground/components/sandbox-viewport/variant-card.js +86 -0
- package/dist/collection/playground/components/sandbox-viewport/viewport-tabs.js +39 -0
- package/dist/collection/playground/components/theme-designer/theme-designer.js +89 -0
- package/dist/collection/playground/components/theme-designer/token-row.js +70 -0
- package/dist/collection/playground/components/theme-designer/token-section.js +19 -0
- package/dist/collection/playground/dom-factory.js +76 -0
- package/dist/collection/playground/events.js +37 -0
- package/dist/collection/playground/logo.svg +8 -0
- package/dist/collection/playground/playground.bundled.js +2831 -0
- package/dist/collection/playground/playground.js +10 -0
- package/dist/collection/playground/state.js +158 -0
- package/dist/collection/playground/utils/color.js +26 -0
- package/dist/collection/playground/utils/dom.js +38 -0
- package/dist/collection/playground/utils/index.js +2 -0
- package/dist/collection/playground/views/q-button-view/q-button-view.js +6 -0
- package/dist/collection/playground/views/q-input-view/q-input-view.js +6 -0
- package/dist/collection/utils/dom.js +228 -0
- package/dist/collection/utils/formatter.js +177 -0
- package/dist/collection/utils/formatter.unit.test.js +53 -0
- package/dist/collection/utils/math.js +19 -0
- package/dist/collection/utils/syntax.js +110 -0
- package/dist/collection/utils/utils.js +28 -0
- package/dist/collection/utils/utils.unit.test.js +16 -0
- package/dist/components/index.d.ts +35 -0
- package/dist/components/index.js +1 -0
- package/dist/components/p-91lJS0-v.js +1 -0
- package/dist/components/p-B7e76DLW.js +1 -0
- package/dist/components/p-BCSpNDGG.js +1 -0
- package/dist/components/p-BRNv11Jn.js +1 -0
- package/dist/components/p-CYfD9z8O.js +1 -0
- package/dist/components/p-DfTW9B7V.js +1 -0
- package/dist/components/p-DgaKWrjd.js +1 -0
- package/dist/components/p-DoQvrOHk.js +1 -0
- package/dist/components/q-button.d.ts +11 -0
- package/dist/components/q-button.js +1 -0
- package/dist/components/q-card.d.ts +11 -0
- package/dist/components/q-card.js +1 -0
- package/dist/components/q-carousel.d.ts +11 -0
- package/dist/components/q-carousel.js +1 -0
- package/dist/components/q-circular-progress.d.ts +11 -0
- package/dist/components/q-circular-progress.js +1 -0
- package/dist/components/q-data-table.d.ts +11 -0
- package/dist/components/q-data-table.js +1 -0
- package/dist/components/q-dialog.d.ts +11 -0
- package/dist/components/q-dialog.js +1 -0
- package/dist/components/q-dropdown.d.ts +11 -0
- package/dist/components/q-dropdown.js +1 -0
- package/dist/components/q-icon.d.ts +11 -0
- package/dist/components/q-icon.js +1 -0
- package/dist/components/q-input.d.ts +11 -0
- package/dist/components/q-input.js +1 -0
- package/dist/components/q-quantity-selector.d.ts +11 -0
- package/dist/components/q-quantity-selector.js +1 -0
- package/dist/components/q-reel.d.ts +11 -0
- package/dist/components/q-reel.js +1 -0
- package/dist/components/q-scrollable.d.ts +11 -0
- package/dist/components/q-scrollable.js +1 -0
- package/dist/components/q-sidepanel.d.ts +11 -0
- package/dist/components/q-sidepanel.js +1 -0
- package/dist/components/q-step-diagram-item.d.ts +11 -0
- package/dist/components/q-step-diagram-item.js +1 -0
- package/dist/components/q-step-diagram.d.ts +11 -0
- package/dist/components/q-step-diagram.js +1 -0
- package/dist/components/q-syntax-box.d.ts +11 -0
- package/dist/components/q-syntax-box.js +1 -0
- package/dist/components/q-textarea.d.ts +11 -0
- package/dist/components/q-textarea.js +1 -0
- package/dist/components/q-thumbnail.d.ts +11 -0
- package/dist/components/q-thumbnail.js +1 -0
- package/dist/components/q-toggle.d.ts +11 -0
- package/dist/components/q-toggle.js +1 -0
- package/dist/components/q-tooltip.d.ts +11 -0
- package/dist/components/q-tooltip.js +1 -0
- package/dist/esm/dom-DoQvrOHk.js +230 -0
- package/dist/esm/index-BJiYCN3i.js +30 -0
- package/dist/esm/index-CYoQ4Zv3.js +1764 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/loader.js +10 -0
- package/dist/esm/q-button_3.entry.js +599 -0
- package/dist/esm/q-card.entry.js +53 -0
- package/dist/esm/q-carousel.entry.js +286 -0
- package/dist/esm/q-circular-progress_2.entry.js +252 -0
- package/dist/esm/q-data-table.entry.js +195 -0
- package/dist/esm/q-dialog.entry.js +141 -0
- package/dist/esm/q-dropdown.entry.js +346 -0
- package/dist/esm/q-icon.entry.js +182 -0
- package/dist/esm/q-quantity-selector.entry.js +176 -0
- package/dist/esm/q-reel.entry.js +115 -0
- package/dist/esm/q-sidepanel.entry.js +213 -0
- package/dist/esm/q-step-diagram-item.entry.js +46 -0
- package/dist/esm/q-step-diagram.entry.js +45 -0
- package/dist/esm/q-syntax-box.entry.js +455 -0
- package/dist/esm/q-textarea.entry.js +134 -0
- package/dist/esm/q-thumbnail.entry.js +42 -0
- package/dist/esm/q-toggle.entry.js +146 -0
- package/dist/esm/webquark.js +20 -0
- package/dist/index.cjs.js +1 -0
- package/dist/index.js +1 -0
- package/dist/loader/cdn.js +1 -0
- package/dist/loader/index.cjs.js +1 -0
- package/dist/loader/index.d.ts +24 -0
- package/dist/loader/index.es2017.js +1 -0
- package/dist/loader/index.js +2 -0
- package/dist/playground/assets/icons/braces.svg +14 -0
- package/dist/playground/assets/icons/check.svg +1 -0
- package/dist/playground/assets/icons/chevron-down.svg +1 -0
- package/dist/playground/assets/icons/chevron-left.svg +1 -0
- package/dist/playground/assets/icons/chevron-right.svg +1 -0
- package/dist/playground/assets/icons/chevron-up.svg +1 -0
- package/dist/playground/assets/icons/copy.svg +4 -0
- package/dist/playground/assets/icons/eye-off.svg +1 -0
- package/dist/playground/assets/icons/eye.svg +1 -0
- package/dist/playground/assets/icons/minus.svg +1 -0
- package/dist/playground/assets/icons/play.svg +1 -0
- package/dist/playground/assets/icons/plus.svg +1 -0
- package/dist/playground/assets/icons/search.svg +1 -0
- package/dist/playground/assets/icons/spinner.svg +1 -0
- package/dist/playground/assets/icons/trash-2.svg +1 -0
- package/dist/playground/assets/icons/x.svg +1 -0
- package/dist/playground/build/index.esm.js +1 -0
- package/dist/playground/build/p-095635d3.entry.js +1 -0
- package/dist/playground/build/p-1238a2cc.entry.js +1 -0
- package/dist/playground/build/p-389e2cd3.entry.js +1 -0
- package/dist/playground/build/p-4f133a25.entry.js +1 -0
- package/dist/playground/build/p-5c67a28e.entry.js +1 -0
- package/dist/playground/build/p-679fa494.entry.js +1 -0
- package/dist/playground/build/p-6dc7b987.entry.js +1 -0
- package/dist/playground/build/p-7083c5ff.entry.js +1 -0
- package/dist/playground/build/p-7f47861b.entry.js +1 -0
- package/dist/playground/build/p-8a94a0a2.entry.js +1 -0
- package/dist/playground/build/p-9afa3fe8.entry.js +1 -0
- package/dist/playground/build/p-9bb8ed97.entry.js +1 -0
- package/dist/playground/build/p-BJiYCN3i.js +1 -0
- package/dist/playground/build/p-CYoQ4Zv3.js +2 -0
- package/dist/playground/build/p-DoQvrOHk.js +1 -0
- package/dist/playground/build/p-aa9be919.entry.js +1 -0
- package/dist/playground/build/p-b1e68119.entry.js +1 -0
- package/dist/playground/build/p-c8d6af8e.entry.js +1 -0
- package/dist/playground/build/p-f48dd3dd.entry.js +1 -0
- package/dist/playground/build/p-f7b5b155.entry.js +1 -0
- package/dist/playground/build/webquark.css +1 -0
- package/dist/playground/build/webquark.esm.js +1 -0
- package/dist/playground/build/webquark.js +33 -0
- package/dist/playground/css/base.css +145 -0
- package/dist/playground/host.config.json +15 -0
- package/dist/playground/index.html +29 -0
- package/dist/playground/logo.svg +8 -0
- package/dist/playground/playground/components.manifest.json +20 -0
- package/dist/playground/playground/specs/q-button.sandbox.json +198 -0
- package/dist/playground/playground/specs/q-card.sandbox.json +144 -0
- package/dist/playground/playground/specs/q-carousel.sandbox.json +120 -0
- package/dist/playground/playground/specs/q-circular-progress.sandbox.json +91 -0
- package/dist/playground/playground/specs/q-data-table.sandbox.json +108 -0
- package/dist/playground/playground/specs/q-dialog.sandbox.json +108 -0
- package/dist/playground/playground/specs/q-dropdown.sandbox.json +116 -0
- package/dist/playground/playground/specs/q-icon.sandbox.json +138 -0
- package/dist/playground/playground/specs/q-input.sandbox.json +192 -0
- package/dist/playground/playground/specs/q-quantity-selector.sandbox.json +99 -0
- package/dist/playground/playground/specs/q-reel.sandbox.json +70 -0
- package/dist/playground/playground/specs/q-scrollable.sandbox.json +102 -0
- package/dist/playground/playground/specs/q-sidepanel.sandbox.json +147 -0
- package/dist/playground/playground/specs/q-step-diagram.sandbox.json +56 -0
- package/dist/playground/playground/specs/q-syntax-box.sandbox.json +160 -0
- package/dist/playground/playground/specs/q-textarea.sandbox.json +133 -0
- package/dist/playground/playground/specs/q-toggle.sandbox.json +196 -0
- package/dist/playground/playground/specs/q-tooltip.sandbox.json +65 -0
- package/dist/playground/playground.css +1 -0
- package/dist/playground/playground.js +2831 -0
- package/dist/playground/views/q-button-view/q-button-view.css +1 -0
- package/dist/playground/views/q-button-view/q-button-view.html +1 -0
- package/dist/playground/views/q-button-view/q-button-view.js +6 -0
- package/dist/playground/views/q-input-view/q-input-view.css +1 -0
- package/dist/playground/views/q-input-view/q-input-view.html +1 -0
- package/dist/playground/views/q-input-view/q-input-view.js +6 -0
- package/dist/types/components/button/button.d.ts +26 -0
- package/dist/types/components/card/card.d.ts +12 -0
- package/dist/types/components/carousel/carousel.d.ts +44 -0
- package/dist/types/components/circular-progress/circular-progress.d.ts +7 -0
- package/dist/types/components/data-table/data-table.d.ts +45 -0
- package/dist/types/components/dialog/dialog.d.ts +35 -0
- package/dist/types/components/dropdown/dropdown.d.ts +49 -0
- package/dist/types/components/icon/icon.d.ts +33 -0
- package/dist/types/components/input/input.d.ts +43 -0
- package/dist/types/components/quantity-selector/quantity-selector.d.ts +31 -0
- package/dist/types/components/reel/reel.d.ts +23 -0
- package/dist/types/components/scrollable/scrollable.d.ts +47 -0
- package/dist/types/components/sidepanel/sidepanel.d.ts +58 -0
- package/dist/types/components/step-diagram/step-diagram.d.ts +10 -0
- package/dist/types/components/step-diagram-item/step-diagram-item.d.ts +12 -0
- package/dist/types/components/syntax-box/syntax-box.d.ts +37 -0
- package/dist/types/components/textarea/textarea.d.ts +36 -0
- package/dist/types/components/thumbnail/thumbnail.d.ts +18 -0
- package/dist/types/components/toggle/toggle.d.ts +36 -0
- package/dist/types/components/tooltip/tooltip.d.ts +29 -0
- package/dist/types/components.d.ts +1752 -0
- package/dist/types/declarations.d.ts +9 -0
- package/dist/types/index.d.ts +11 -0
- package/dist/types/playground/components/playground-code-preview/playground-code-preview.d.ts +9 -0
- package/dist/types/playground/components/playground-event-log/playground-event-log.d.ts +11 -0
- package/dist/types/playground/components/playground-header/playground-header.d.ts +10 -0
- package/dist/types/playground/components/playground-sidebar/playground-sidebar.d.ts +11 -0
- package/dist/types/playground/components/properties-panel/properties-panel.d.ts +15 -0
- package/dist/types/playground/components/properties-panel/property-row.d.ts +6 -0
- package/dist/types/playground/components/properties-panel/slot-row.d.ts +7 -0
- package/dist/types/playground/components/sandbox-viewport/sandbox-panel.d.ts +15 -0
- package/dist/types/playground/components/sandbox-viewport/sandbox-viewport.d.ts +14 -0
- package/dist/types/playground/components/sandbox-viewport/variant-card.d.ts +7 -0
- package/dist/types/playground/components/sandbox-viewport/viewport-tabs.d.ts +5 -0
- package/dist/types/playground/components/theme-designer/theme-designer.d.ts +15 -0
- package/dist/types/playground/components/theme-designer/token-row.d.ts +13 -0
- package/dist/types/playground/components/theme-designer/token-section.d.ts +7 -0
- package/dist/types/playground/dom-factory.d.ts +12 -0
- package/dist/types/playground/events.d.ts +24 -0
- package/dist/types/playground/playground.d.ts +7 -0
- package/dist/types/playground/state.d.ts +44 -0
- package/dist/types/playground/utils/color.d.ts +8 -0
- package/dist/types/playground/utils/dom.d.ts +15 -0
- package/dist/types/playground/utils/index.d.ts +2 -0
- package/dist/types/stencil-public-runtime.d.ts +1861 -0
- package/dist/types/utils/dom.d.ts +68 -0
- package/dist/types/utils/formatter.d.ts +24 -0
- package/dist/types/utils/formatter.unit.test.d.ts +1 -0
- package/dist/types/utils/math.d.ts +10 -0
- package/dist/types/utils/syntax.d.ts +9 -0
- package/dist/types/utils/utils.d.ts +11 -0
- package/dist/types/utils/utils.unit.test.d.ts +1 -0
- package/dist/webquark/index.esm.js +1 -0
- package/dist/webquark/p-095635d3.entry.js +1 -0
- package/dist/webquark/p-1238a2cc.entry.js +1 -0
- package/dist/webquark/p-389e2cd3.entry.js +1 -0
- package/dist/webquark/p-4f133a25.entry.js +1 -0
- package/dist/webquark/p-5c67a28e.entry.js +1 -0
- package/dist/webquark/p-679fa494.entry.js +1 -0
- package/dist/webquark/p-6dc7b987.entry.js +1 -0
- package/dist/webquark/p-7083c5ff.entry.js +1 -0
- package/dist/webquark/p-7f47861b.entry.js +1 -0
- package/dist/webquark/p-8a94a0a2.entry.js +1 -0
- package/dist/webquark/p-9afa3fe8.entry.js +1 -0
- package/dist/webquark/p-9bb8ed97.entry.js +1 -0
- package/dist/webquark/p-BJiYCN3i.js +1 -0
- package/dist/webquark/p-CYoQ4Zv3.js +2 -0
- package/dist/webquark/p-DoQvrOHk.js +1 -0
- package/dist/webquark/p-aa9be919.entry.js +1 -0
- package/dist/webquark/p-b1e68119.entry.js +1 -0
- package/dist/webquark/p-c8d6af8e.entry.js +1 -0
- package/dist/webquark/p-f48dd3dd.entry.js +1 -0
- package/dist/webquark/p-f7b5b155.entry.js +1 -0
- package/dist/webquark/webquark.css +1 -0
- package/dist/webquark/webquark.esm.js +1 -0
- package/package.json +84 -0
- package/readme.md +79 -0
- package/scripts/webquark-serve.js +79 -0
|
@@ -0,0 +1,2831 @@
|
|
|
1
|
+
// src/playground/state.ts
|
|
2
|
+
var activeEffect = null;
|
|
3
|
+
var registeredEffects = new Set;
|
|
4
|
+
function signal(initialValue) {
|
|
5
|
+
let value = initialValue;
|
|
6
|
+
const subscribers = new Set;
|
|
7
|
+
const getter = () => {
|
|
8
|
+
if (activeEffect) {
|
|
9
|
+
subscribers.add(activeEffect);
|
|
10
|
+
}
|
|
11
|
+
return value;
|
|
12
|
+
};
|
|
13
|
+
getter.set = (newValue) => {
|
|
14
|
+
if (value !== newValue) {
|
|
15
|
+
value = newValue;
|
|
16
|
+
[...subscribers].filter((fn) => registeredEffects.has(fn)).forEach((run) => run());
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
getter.update = (fn) => {
|
|
20
|
+
getter.set(fn(value));
|
|
21
|
+
};
|
|
22
|
+
return getter;
|
|
23
|
+
}
|
|
24
|
+
function effect(fn) {
|
|
25
|
+
const run = () => {
|
|
26
|
+
activeEffect = run;
|
|
27
|
+
try {
|
|
28
|
+
fn();
|
|
29
|
+
} finally {
|
|
30
|
+
activeEffect = null;
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
registeredEffects.add(run);
|
|
34
|
+
run();
|
|
35
|
+
return () => registeredEffects.delete(run);
|
|
36
|
+
}
|
|
37
|
+
function computed(fn) {
|
|
38
|
+
const derived = signal();
|
|
39
|
+
effect(() => {
|
|
40
|
+
derived.set(fn());
|
|
41
|
+
});
|
|
42
|
+
return derived;
|
|
43
|
+
}
|
|
44
|
+
var SPEC_BASE_URL = "/playground/specs";
|
|
45
|
+
var activeComponent = signal("q-button");
|
|
46
|
+
var activeTab = signal("sandbox");
|
|
47
|
+
var theme = signal(document.documentElement.getAttribute("data-theme") || "dark");
|
|
48
|
+
var componentRegistry = signal({});
|
|
49
|
+
var activeSpec = computed(() => {
|
|
50
|
+
const registry = componentRegistry();
|
|
51
|
+
const active = activeComponent();
|
|
52
|
+
return registry[active] || null;
|
|
53
|
+
});
|
|
54
|
+
async function fetchComponentSpec(tag) {
|
|
55
|
+
const registry = { ...componentRegistry() };
|
|
56
|
+
if (registry[tag])
|
|
57
|
+
return;
|
|
58
|
+
try {
|
|
59
|
+
const res = await fetch(`${SPEC_BASE_URL}/${tag}.sandbox.json`);
|
|
60
|
+
if (!res.ok)
|
|
61
|
+
throw new Error(`HTTP ${res.status}`);
|
|
62
|
+
const spec = await res.json();
|
|
63
|
+
if (spec.props) {
|
|
64
|
+
Object.keys(spec.props).forEach((p) => {
|
|
65
|
+
if (spec.props) {
|
|
66
|
+
spec.props[p].currentValue = spec.props[p].default;
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
if (spec.slots) {
|
|
71
|
+
Object.keys(spec.slots).forEach((s) => {
|
|
72
|
+
if (spec.slots) {
|
|
73
|
+
spec.slots[s].currentValue = spec.slots[s].default || "";
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
registry[tag] = spec;
|
|
78
|
+
componentRegistry.set(registry);
|
|
79
|
+
} catch (err) {
|
|
80
|
+
console.error(`Failed to fetch spec for ${tag}:`, err);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
function updateKnobValue(type, name, value) {
|
|
84
|
+
const registry = { ...componentRegistry() };
|
|
85
|
+
const spec = registry[activeComponent()];
|
|
86
|
+
if (!spec)
|
|
87
|
+
return;
|
|
88
|
+
if (type === "prop" && spec.props) {
|
|
89
|
+
spec.props[name].currentValue = value;
|
|
90
|
+
} else if (type === "slot" && spec.slots) {
|
|
91
|
+
spec.slots[name].currentValue = value;
|
|
92
|
+
}
|
|
93
|
+
componentRegistry.set(registry);
|
|
94
|
+
}
|
|
95
|
+
function serializeComponentCode(tag, props, slots, appendScript = null) {
|
|
96
|
+
let code = `<${tag}`;
|
|
97
|
+
if (props) {
|
|
98
|
+
Object.keys(props).forEach((k) => {
|
|
99
|
+
const p = props[k];
|
|
100
|
+
const val = p && typeof p === "object" && "currentValue" in p ? p.currentValue : p;
|
|
101
|
+
if (val === true) {
|
|
102
|
+
code += ` ${k}`;
|
|
103
|
+
} else if (val !== undefined && val !== null && val !== "") {
|
|
104
|
+
code += ` ${k}="${val}"`;
|
|
105
|
+
}
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
code += ">";
|
|
109
|
+
let slotContent = "";
|
|
110
|
+
if (slots) {
|
|
111
|
+
if (typeof slots === "string") {
|
|
112
|
+
if (slots) {
|
|
113
|
+
slotContent += `
|
|
114
|
+
${slots.replace(/\n/g, `
|
|
115
|
+
`)}
|
|
116
|
+
`;
|
|
117
|
+
}
|
|
118
|
+
} else {
|
|
119
|
+
Object.keys(slots).forEach((slotName) => {
|
|
120
|
+
const s = slots[slotName];
|
|
121
|
+
const val = s && typeof s === "object" && "currentValue" in s ? s.currentValue : s;
|
|
122
|
+
if (val) {
|
|
123
|
+
if (slotName === "default") {
|
|
124
|
+
slotContent += `
|
|
125
|
+
${val.replace(/\n/g, `
|
|
126
|
+
`)}
|
|
127
|
+
`;
|
|
128
|
+
} else {
|
|
129
|
+
if (typeof val === "string" && val.includes(`slot="${slotName}"`)) {
|
|
130
|
+
slotContent += `
|
|
131
|
+
${val.replace(/\n/g, `
|
|
132
|
+
`)}
|
|
133
|
+
`;
|
|
134
|
+
} else {
|
|
135
|
+
slotContent += `
|
|
136
|
+
<span slot="${slotName}">${val.replace(/\n/g, `
|
|
137
|
+
`)}</span>
|
|
138
|
+
`;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
if (slotContent) {
|
|
146
|
+
code += slotContent + `</${tag}>`;
|
|
147
|
+
} else {
|
|
148
|
+
code += `</${tag}>`;
|
|
149
|
+
}
|
|
150
|
+
if (appendScript) {
|
|
151
|
+
code += appendScript;
|
|
152
|
+
}
|
|
153
|
+
return code;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
// src/playground/dom-factory.ts
|
|
157
|
+
function h(tag, attrs, ...children) {
|
|
158
|
+
if (typeof tag === "function") {
|
|
159
|
+
return tag(attrs || {});
|
|
160
|
+
}
|
|
161
|
+
const el = document.createElement(tag);
|
|
162
|
+
if (attrs) {
|
|
163
|
+
Object.keys(attrs).forEach((key) => {
|
|
164
|
+
const val = attrs[key];
|
|
165
|
+
if (val === undefined || val === null || val === false) {
|
|
166
|
+
return;
|
|
167
|
+
}
|
|
168
|
+
if (key.startsWith("on") && typeof val === "function") {
|
|
169
|
+
const rawEventName = key.slice(2);
|
|
170
|
+
const nativeEvents = ["click", "input", "change", "focus", "blur", "keydown", "keyup", "keypress", "submit", "scroll"];
|
|
171
|
+
const lowerEvent = rawEventName.toLowerCase();
|
|
172
|
+
const eventName = nativeEvents.includes(lowerEvent) ? lowerEvent : rawEventName.charAt(0).toLowerCase() + rawEventName.slice(1);
|
|
173
|
+
el.addEventListener(eventName, val);
|
|
174
|
+
} else if (key === "className" || key === "class") {
|
|
175
|
+
if (typeof val === "object") {
|
|
176
|
+
const classes = Object.keys(val).filter((k) => !!val[k]).join(" ");
|
|
177
|
+
el.setAttribute("class", classes);
|
|
178
|
+
} else {
|
|
179
|
+
el.setAttribute("class", String(val));
|
|
180
|
+
}
|
|
181
|
+
} else if (key.startsWith("data-")) {
|
|
182
|
+
el.setAttribute(key, String(val));
|
|
183
|
+
} else if (key in el && key !== "style") {
|
|
184
|
+
try {
|
|
185
|
+
el[key] = val;
|
|
186
|
+
} catch {
|
|
187
|
+
el.setAttribute(key, String(val));
|
|
188
|
+
}
|
|
189
|
+
} else {
|
|
190
|
+
el.setAttribute(key, String(val));
|
|
191
|
+
}
|
|
192
|
+
});
|
|
193
|
+
}
|
|
194
|
+
const appendChildren = (childList) => {
|
|
195
|
+
childList.forEach((child) => {
|
|
196
|
+
if (child === undefined || child === null || child === false) {
|
|
197
|
+
return;
|
|
198
|
+
}
|
|
199
|
+
if (Array.isArray(child)) {
|
|
200
|
+
appendChildren(child);
|
|
201
|
+
} else if (child instanceof Node) {
|
|
202
|
+
el.appendChild(child);
|
|
203
|
+
} else {
|
|
204
|
+
el.appendChild(document.createTextNode(String(child)));
|
|
205
|
+
}
|
|
206
|
+
});
|
|
207
|
+
};
|
|
208
|
+
appendChildren(children);
|
|
209
|
+
return el;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
// src/playground/components/playground-header/playground-header.css
|
|
213
|
+
var playground_header_default = `.app-header {\r
|
|
214
|
+
display: flex;\r
|
|
215
|
+
align-items: center;\r
|
|
216
|
+
justify-content: space-between;\r
|
|
217
|
+
padding: 8px 16px;\r
|
|
218
|
+
min-height: 56px;\r
|
|
219
|
+
background: var(--bg-sidebar);\r
|
|
220
|
+
border-bottom: 1px solid var(--border-color);\r
|
|
221
|
+
flex-shrink: 0;\r
|
|
222
|
+
box-sizing: border-box;\r
|
|
223
|
+
gap: 16px;\r
|
|
224
|
+
}\r
|
|
225
|
+
\r
|
|
226
|
+
.header-logo {\r
|
|
227
|
+
display: flex;\r
|
|
228
|
+
align-items: center;\r
|
|
229
|
+
gap: 12px;\r
|
|
230
|
+
flex-shrink: 0;\r
|
|
231
|
+
}\r
|
|
232
|
+
\r
|
|
233
|
+
.logo-image {\r
|
|
234
|
+
height: 28px;\r
|
|
235
|
+
width: auto;\r
|
|
236
|
+
display: block;\r
|
|
237
|
+
}\r
|
|
238
|
+
\r
|
|
239
|
+
.logo-text {\r
|
|
240
|
+
font-size: 1.15rem;\r
|
|
241
|
+
font-weight: 700;\r
|
|
242
|
+
letter-spacing: -0.025em;\r
|
|
243
|
+
background: linear-gradient(135deg, var(--text-main) 30%, var(--text-muted) 100%);\r
|
|
244
|
+
-webkit-background-clip: text;\r
|
|
245
|
+
-webkit-text-fill-color: transparent;\r
|
|
246
|
+
}\r
|
|
247
|
+
\r
|
|
248
|
+
.header-actions {\r
|
|
249
|
+
display: flex;\r
|
|
250
|
+
align-items: center;\r
|
|
251
|
+
gap: 20px;\r
|
|
252
|
+
flex-shrink: 0;\r
|
|
253
|
+
}\r
|
|
254
|
+
\r
|
|
255
|
+
.action-btn {\r
|
|
256
|
+
background: var(--bg-surface);\r
|
|
257
|
+
border: 1px solid var(--border-color);\r
|
|
258
|
+
color: var(--text-main);\r
|
|
259
|
+
padding: 6px 12px;\r
|
|
260
|
+
border-radius: var(--q-radius-md);\r
|
|
261
|
+
font-size: 0.85rem;\r
|
|
262
|
+
font-weight: 500;\r
|
|
263
|
+
cursor: pointer;\r
|
|
264
|
+
transition:\r
|
|
265
|
+
background-color 0.2s,\r
|
|
266
|
+
color 0.2s,\r
|
|
267
|
+
border-color 0.2s;\r
|
|
268
|
+
}\r
|
|
269
|
+
\r
|
|
270
|
+
.action-btn:hover {\r
|
|
271
|
+
background: var(--primary);\r
|
|
272
|
+
color: white;\r
|
|
273
|
+
border-color: var(--primary);\r
|
|
274
|
+
}\r
|
|
275
|
+
\r
|
|
276
|
+
/* Hamburger Menu Toggle styles */\r
|
|
277
|
+
.hamburger-menu {\r
|
|
278
|
+
display: none;\r
|
|
279
|
+
background: transparent;\r
|
|
280
|
+
border: none;\r
|
|
281
|
+
cursor: pointer;\r
|
|
282
|
+
padding: 8px;\r
|
|
283
|
+
flex-direction: column;\r
|
|
284
|
+
gap: 5px;\r
|
|
285
|
+
z-index: 1001;\r
|
|
286
|
+
justify-content: center;\r
|
|
287
|
+
align-items: center;\r
|
|
288
|
+
height: 40px;\r
|
|
289
|
+
width: 40px;\r
|
|
290
|
+
border-radius: var(--q-radius-md);\r
|
|
291
|
+
margin-right: 8px;\r
|
|
292
|
+
}\r
|
|
293
|
+
\r
|
|
294
|
+
.hamburger-menu:hover {\r
|
|
295
|
+
background: rgba(255, 255, 255, 0.05);\r
|
|
296
|
+
}\r
|
|
297
|
+
\r
|
|
298
|
+
.hamburger-line {\r
|
|
299
|
+
display: block;\r
|
|
300
|
+
width: 20px;\r
|
|
301
|
+
height: 2px;\r
|
|
302
|
+
background-color: var(--text-main);\r
|
|
303
|
+
transition:\r
|
|
304
|
+
transform 0.3s ease,\r
|
|
305
|
+
opacity 0.3s ease;\r
|
|
306
|
+
}\r
|
|
307
|
+
\r
|
|
308
|
+
/* Mobile responsive menu overrides */\r
|
|
309
|
+
@media (max-width: 900px) {\r
|
|
310
|
+
.hamburger-menu {\r
|
|
311
|
+
display: flex;\r
|
|
312
|
+
}\r
|
|
313
|
+
\r
|
|
314
|
+
.hamburger-menu.open .hamburger-line:nth-child(1) {\r
|
|
315
|
+
transform: translateY(7px) rotate(45deg);\r
|
|
316
|
+
}\r
|
|
317
|
+
\r
|
|
318
|
+
.hamburger-menu.open .hamburger-line:nth-child(2) {\r
|
|
319
|
+
opacity: 0;\r
|
|
320
|
+
}\r
|
|
321
|
+
\r
|
|
322
|
+
.hamburger-menu.open .hamburger-line:nth-child(3) {\r
|
|
323
|
+
transform: translateY(-7px) rotate(-45deg);\r
|
|
324
|
+
}\r
|
|
325
|
+
\r
|
|
326
|
+
.app-header {\r
|
|
327
|
+
padding: 8px 10px;\r
|
|
328
|
+
min-height: 52px;\r
|
|
329
|
+
gap: 12px;\r
|
|
330
|
+
}\r
|
|
331
|
+
\r
|
|
332
|
+
.logo-text {\r
|
|
333
|
+
font-size: 1rem;\r
|
|
334
|
+
}\r
|
|
335
|
+
\r
|
|
336
|
+
.header-actions {\r
|
|
337
|
+
gap: 10px;\r
|
|
338
|
+
}\r
|
|
339
|
+
}\r
|
|
340
|
+
`;
|
|
341
|
+
|
|
342
|
+
// src/playground/components/playground-header/playground-header.tsx
|
|
343
|
+
class PlaygroundHeader extends HTMLElement {
|
|
344
|
+
cleanupThemeEffect;
|
|
345
|
+
hamburgerBtn = null;
|
|
346
|
+
connectedCallback() {
|
|
347
|
+
this.innerHTML = "";
|
|
348
|
+
this.appendChild(/* @__PURE__ */ h("header", {
|
|
349
|
+
class: "app-header"
|
|
350
|
+
}, /* @__PURE__ */ h("button", {
|
|
351
|
+
class: "hamburger-menu",
|
|
352
|
+
id: "hamburgerMenu",
|
|
353
|
+
"aria-label": "Toggle Menu",
|
|
354
|
+
type: "button",
|
|
355
|
+
onClick: () => this.toggleSidebar()
|
|
356
|
+
}, /* @__PURE__ */ h("span", {
|
|
357
|
+
class: "hamburger-line"
|
|
358
|
+
}), /* @__PURE__ */ h("span", {
|
|
359
|
+
class: "hamburger-line"
|
|
360
|
+
}), /* @__PURE__ */ h("span", {
|
|
361
|
+
class: "hamburger-line"
|
|
362
|
+
})), /* @__PURE__ */ h("div", {
|
|
363
|
+
class: "header-logo"
|
|
364
|
+
}, /* @__PURE__ */ h("img", {
|
|
365
|
+
src: "/logo.svg",
|
|
366
|
+
class: "logo-image",
|
|
367
|
+
alt: "WebQuark Logo"
|
|
368
|
+
}), /* @__PURE__ */ h("div", {
|
|
369
|
+
class: "logo-text"
|
|
370
|
+
}, "WebQuark")), /* @__PURE__ */ h("div", {
|
|
371
|
+
class: "header-actions"
|
|
372
|
+
}, /* @__PURE__ */ h("q-button", {
|
|
373
|
+
id: "themeToggle",
|
|
374
|
+
variant: "ghost",
|
|
375
|
+
onClick: () => this.toggleTheme()
|
|
376
|
+
}, /* @__PURE__ */ h("q-icon", {
|
|
377
|
+
id: "themeIcon",
|
|
378
|
+
slot: "icon-left",
|
|
379
|
+
name: "sun"
|
|
380
|
+
})))));
|
|
381
|
+
const styleId = "playground-header-style";
|
|
382
|
+
if (!document.getElementById(styleId)) {
|
|
383
|
+
const style = document.createElement("style");
|
|
384
|
+
style.id = styleId;
|
|
385
|
+
style.textContent = playground_header_default;
|
|
386
|
+
document.head.appendChild(style);
|
|
387
|
+
}
|
|
388
|
+
this.init();
|
|
389
|
+
}
|
|
390
|
+
init() {
|
|
391
|
+
this.hamburgerBtn = this.querySelector("#hamburgerMenu");
|
|
392
|
+
const backdrop = document.getElementById("sidebarBackdrop");
|
|
393
|
+
this.cleanupThemeEffect = effect(() => {
|
|
394
|
+
const currentTheme = theme();
|
|
395
|
+
document.documentElement.setAttribute("data-theme", currentTheme);
|
|
396
|
+
const iconEl = this.querySelector("#themeIcon");
|
|
397
|
+
if (iconEl) {
|
|
398
|
+
iconEl.setAttribute("name", currentTheme === "dark" ? "sun" : "moon");
|
|
399
|
+
}
|
|
400
|
+
});
|
|
401
|
+
if (backdrop) {
|
|
402
|
+
backdrop.addEventListener("click", () => {
|
|
403
|
+
const sidebar = document.querySelector("playground-sidebar");
|
|
404
|
+
if (sidebar)
|
|
405
|
+
sidebar.classList.remove("open");
|
|
406
|
+
backdrop.classList.remove("active");
|
|
407
|
+
if (this.hamburgerBtn)
|
|
408
|
+
this.hamburgerBtn.classList.remove("open");
|
|
409
|
+
});
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
toggleTheme() {
|
|
413
|
+
const newTheme = theme() === "dark" ? "light" : "dark";
|
|
414
|
+
theme.set(newTheme);
|
|
415
|
+
}
|
|
416
|
+
toggleSidebar() {
|
|
417
|
+
const sidebar = document.querySelector("playground-sidebar");
|
|
418
|
+
const backdrop = document.getElementById("sidebarBackdrop");
|
|
419
|
+
if (sidebar)
|
|
420
|
+
sidebar.classList.toggle("open");
|
|
421
|
+
if (backdrop)
|
|
422
|
+
backdrop.classList.toggle("active");
|
|
423
|
+
if (this.hamburgerBtn)
|
|
424
|
+
this.hamburgerBtn.classList.toggle("open");
|
|
425
|
+
}
|
|
426
|
+
disconnectedCallback() {
|
|
427
|
+
if (this.cleanupThemeEffect) {
|
|
428
|
+
this.cleanupThemeEffect();
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
customElements.define("playground-header", PlaygroundHeader);
|
|
433
|
+
|
|
434
|
+
// src/playground/components/playground-sidebar/playground-sidebar.css
|
|
435
|
+
var playground_sidebar_default = `/* playground-sidebar.css\r
|
|
436
|
+
All nav item rendering is handled by q-sidepanel variant="nav".\r
|
|
437
|
+
This file only styles the host element layout, the Global Styling footer\r
|
|
438
|
+
button (slotted light DOM), and mobile responsive overrides. */\r
|
|
439
|
+
\r
|
|
440
|
+
playground-sidebar {\r
|
|
441
|
+
display: flex;\r
|
|
442
|
+
flex-direction: column;\r
|
|
443
|
+
flex-shrink: 0;\r
|
|
444
|
+
height: 100%;\r
|
|
445
|
+
}\r
|
|
446
|
+
\r
|
|
447
|
+
/* Global Styling footer button — lives in q-sidepanel's footer slot (light DOM) */\r
|
|
448
|
+
.global-styling-btn {\r
|
|
449
|
+
display: flex;\r
|
|
450
|
+
align-items: center;\r
|
|
451
|
+
justify-content: center;\r
|
|
452
|
+
gap: 8px;\r
|
|
453
|
+
width: calc(100% - 24px);\r
|
|
454
|
+
margin: 4px 12px;\r
|
|
455
|
+
background: var(--bg-surface, transparent);\r
|
|
456
|
+
border: 1px solid var(--border-color, var(--q-border-color, #374151));\r
|
|
457
|
+
color: var(--text-main, var(--q-fg-base, #f9fafb));\r
|
|
458
|
+
padding: 10px 16px;\r
|
|
459
|
+
border-radius: var(--q-radius-md, 8px);\r
|
|
460
|
+
font-size: 0.9rem;\r
|
|
461
|
+
font-weight: 600;\r
|
|
462
|
+
cursor: pointer;\r
|
|
463
|
+
transition: all 0.2s ease;\r
|
|
464
|
+
box-sizing: border-box;\r
|
|
465
|
+
}\r
|
|
466
|
+
\r
|
|
467
|
+
.global-styling-btn:hover {\r
|
|
468
|
+
background: rgba(255, 255, 255, 0.05);\r
|
|
469
|
+
color: var(--text-main, var(--q-fg-base, #f9fafb));\r
|
|
470
|
+
}\r
|
|
471
|
+
\r
|
|
472
|
+
.global-styling-btn.active {\r
|
|
473
|
+
background: var(--accent-glow, color-mix(in srgb, var(--q-color-primary, #6366f1) 12%, transparent));\r
|
|
474
|
+
color: var(--primary, var(--q-color-primary, #818cf8));\r
|
|
475
|
+
border-color: var(--primary, var(--q-color-primary, #6366f1));\r
|
|
476
|
+
}\r
|
|
477
|
+
\r
|
|
478
|
+
.global-styling-btn:focus-visible {\r
|
|
479
|
+
outline: var(--q-focus-ring, 2px solid var(--primary, var(--q-color-primary)));\r
|
|
480
|
+
outline-offset: -2px;\r
|
|
481
|
+
}\r
|
|
482
|
+
\r
|
|
483
|
+
/* Mobile responsive: q-sidepanel handles its own internal layout,\r
|
|
484
|
+
we just control the host element position on small screens */\r
|
|
485
|
+
@media (max-width: 900px) {\r
|
|
486
|
+
playground-sidebar {\r
|
|
487
|
+
position: fixed;\r
|
|
488
|
+
top: 64px;\r
|
|
489
|
+
left: 0;\r
|
|
490
|
+
bottom: 0;\r
|
|
491
|
+
width: 280px;\r
|
|
492
|
+
height: calc(100vh - 64px);\r
|
|
493
|
+
z-index: 1000;\r
|
|
494
|
+
transform: translateX(-100%);\r
|
|
495
|
+
transition: transform 220ms ease-out;\r
|
|
496
|
+
box-shadow: 4px 0 15px rgba(0, 0, 0, 0.3);\r
|
|
497
|
+
}\r
|
|
498
|
+
\r
|
|
499
|
+
playground-sidebar.open {\r
|
|
500
|
+
transform: translateX(0);\r
|
|
501
|
+
}\r
|
|
502
|
+
}\r
|
|
503
|
+
`;
|
|
504
|
+
|
|
505
|
+
// src/playground/components/playground-sidebar/playground-sidebar.tsx
|
|
506
|
+
class PlaygroundSidebar extends HTMLElement {
|
|
507
|
+
components = [];
|
|
508
|
+
navPanel = null;
|
|
509
|
+
globalStylingBtn = null;
|
|
510
|
+
handleNavSelect;
|
|
511
|
+
cleanupActiveEffect;
|
|
512
|
+
async connectedCallback() {
|
|
513
|
+
try {
|
|
514
|
+
const res = await fetch("/playground/components.manifest.json");
|
|
515
|
+
if (!res.ok)
|
|
516
|
+
throw new Error(`HTTP ${res.status}`);
|
|
517
|
+
this.components = await res.json();
|
|
518
|
+
} catch (err) {
|
|
519
|
+
console.error("[playground-sidebar] Failed to load components.manifest.json:", err);
|
|
520
|
+
this.components = [];
|
|
521
|
+
}
|
|
522
|
+
this.innerHTML = "";
|
|
523
|
+
this.appendChild(/* @__PURE__ */ h("q-sidepanel", {
|
|
524
|
+
id: "sidebarNav",
|
|
525
|
+
variant: "nav",
|
|
526
|
+
mode: "flat"
|
|
527
|
+
}, /* @__PURE__ */ h("div", {
|
|
528
|
+
slot: "footer"
|
|
529
|
+
}, /* @__PURE__ */ h("button", {
|
|
530
|
+
id: "globalStylingBtn",
|
|
531
|
+
class: "global-styling-btn",
|
|
532
|
+
type: "button",
|
|
533
|
+
onClick: () => activeComponent.set("global-styling")
|
|
534
|
+
}, /* @__PURE__ */ h("q-icon", {
|
|
535
|
+
name: "globe",
|
|
536
|
+
lib: "lucide",
|
|
537
|
+
size: "16"
|
|
538
|
+
}), /* @__PURE__ */ h("span", null, "Global Styling")))));
|
|
539
|
+
const styleId = "playground-sidebar-style";
|
|
540
|
+
if (!document.getElementById(styleId)) {
|
|
541
|
+
const style = document.createElement("style");
|
|
542
|
+
style.id = styleId;
|
|
543
|
+
style.textContent = playground_sidebar_default;
|
|
544
|
+
document.head.appendChild(style);
|
|
545
|
+
}
|
|
546
|
+
this.init();
|
|
547
|
+
}
|
|
548
|
+
init() {
|
|
549
|
+
this.navPanel = this.querySelector("#sidebarNav");
|
|
550
|
+
this.globalStylingBtn = this.querySelector("#globalStylingBtn");
|
|
551
|
+
if (!this.navPanel)
|
|
552
|
+
return;
|
|
553
|
+
this.navPanel.items = this.components.map((comp) => ({
|
|
554
|
+
label: comp.name,
|
|
555
|
+
value: comp.tag
|
|
556
|
+
}));
|
|
557
|
+
this.handleNavSelect = (e) => {
|
|
558
|
+
const { value } = e.detail;
|
|
559
|
+
activeTab.set("sandbox");
|
|
560
|
+
activeComponent.set(value);
|
|
561
|
+
fetchComponentSpec(value);
|
|
562
|
+
};
|
|
563
|
+
this.navPanel.addEventListener("qSelect", this.handleNavSelect);
|
|
564
|
+
this.cleanupActiveEffect = effect(() => {
|
|
565
|
+
const active = activeComponent();
|
|
566
|
+
if (this.navPanel) {
|
|
567
|
+
this.navPanel.value = active;
|
|
568
|
+
}
|
|
569
|
+
if (this.globalStylingBtn) {
|
|
570
|
+
this.globalStylingBtn.classList.toggle("active", active === "global-styling");
|
|
571
|
+
}
|
|
572
|
+
});
|
|
573
|
+
}
|
|
574
|
+
disconnectedCallback() {
|
|
575
|
+
if (this.cleanupActiveEffect) {
|
|
576
|
+
this.cleanupActiveEffect();
|
|
577
|
+
}
|
|
578
|
+
if (this.navPanel && this.handleNavSelect) {
|
|
579
|
+
this.navPanel.removeEventListener("qSelect", this.handleNavSelect);
|
|
580
|
+
}
|
|
581
|
+
}
|
|
582
|
+
}
|
|
583
|
+
customElements.define("playground-sidebar", PlaygroundSidebar);
|
|
584
|
+
|
|
585
|
+
// src/playground/components/sandbox-viewport/viewport-tabs.tsx
|
|
586
|
+
class ViewportTabs extends HTMLElement {
|
|
587
|
+
cleanupEffect;
|
|
588
|
+
connectedCallback() {
|
|
589
|
+
this.innerHTML = "";
|
|
590
|
+
this.appendChild(/* @__PURE__ */ h("div", {
|
|
591
|
+
class: "tabs-bar",
|
|
592
|
+
id: "tabsBar"
|
|
593
|
+
}, /* @__PURE__ */ h("div", {
|
|
594
|
+
class: "tab-buttons"
|
|
595
|
+
}, /* @__PURE__ */ h("button", {
|
|
596
|
+
class: "tab-btn",
|
|
597
|
+
"data-tab": "sandbox"
|
|
598
|
+
}, "Sandbox"), /* @__PURE__ */ h("button", {
|
|
599
|
+
class: "tab-btn",
|
|
600
|
+
"data-tab": "variants"
|
|
601
|
+
}, "Variants"), /* @__PURE__ */ h("button", {
|
|
602
|
+
class: "tab-btn",
|
|
603
|
+
"data-tab": "edgecases"
|
|
604
|
+
}, "Edge Cases")), /* @__PURE__ */ h("div", {
|
|
605
|
+
class: "active-component-badge",
|
|
606
|
+
id: "activeCompBadge"
|
|
607
|
+
}, "q-button")));
|
|
608
|
+
const tabsBar = this.querySelector("#tabsBar");
|
|
609
|
+
const activeCompBadge = this.querySelector("#activeCompBadge");
|
|
610
|
+
const tabBtns = this.querySelectorAll(".tab-btn");
|
|
611
|
+
tabBtns.forEach((btn) => {
|
|
612
|
+
btn.addEventListener("click", () => {
|
|
613
|
+
const nextTab = btn.dataset.tab;
|
|
614
|
+
if (nextTab) {
|
|
615
|
+
activeTab.set(nextTab);
|
|
616
|
+
}
|
|
617
|
+
});
|
|
618
|
+
});
|
|
619
|
+
this.cleanupEffect = effect(() => {
|
|
620
|
+
const active = activeComponent();
|
|
621
|
+
const tab = activeTab();
|
|
622
|
+
if (activeCompBadge) {
|
|
623
|
+
activeCompBadge.innerText = active === "global-styling" ? "Global Styling" : active;
|
|
624
|
+
}
|
|
625
|
+
if (tabsBar) {
|
|
626
|
+
tabsBar.style.display = active === "global-styling" ? "none" : "";
|
|
627
|
+
}
|
|
628
|
+
tabBtns.forEach((btn) => {
|
|
629
|
+
btn.classList.toggle("active", btn.dataset.tab === tab);
|
|
630
|
+
});
|
|
631
|
+
});
|
|
632
|
+
}
|
|
633
|
+
disconnectedCallback() {
|
|
634
|
+
if (this.cleanupEffect) {
|
|
635
|
+
this.cleanupEffect();
|
|
636
|
+
}
|
|
637
|
+
}
|
|
638
|
+
}
|
|
639
|
+
customElements.define("viewport-tabs", ViewportTabs);
|
|
640
|
+
|
|
641
|
+
// src/playground/events.ts
|
|
642
|
+
class TypedEventBus {
|
|
643
|
+
listeners = {};
|
|
644
|
+
on(event, callback) {
|
|
645
|
+
if (!this.listeners[event]) {
|
|
646
|
+
this.listeners[event] = new Set;
|
|
647
|
+
}
|
|
648
|
+
this.listeners[event].add(callback);
|
|
649
|
+
return () => this.off(event, callback);
|
|
650
|
+
}
|
|
651
|
+
off(event, callback) {
|
|
652
|
+
if (this.listeners[event]) {
|
|
653
|
+
this.listeners[event].delete(callback);
|
|
654
|
+
}
|
|
655
|
+
}
|
|
656
|
+
emit(event, data) {
|
|
657
|
+
if (this.listeners[event]) {
|
|
658
|
+
this.listeners[event].forEach((callback) => {
|
|
659
|
+
try {
|
|
660
|
+
callback(data);
|
|
661
|
+
} catch (err) {
|
|
662
|
+
console.error(`Error in event listener for event "${String(event)}":`, err);
|
|
663
|
+
}
|
|
664
|
+
});
|
|
665
|
+
}
|
|
666
|
+
}
|
|
667
|
+
}
|
|
668
|
+
var playgroundBus = new TypedEventBus;
|
|
669
|
+
|
|
670
|
+
// src/playground/utils/color.ts
|
|
671
|
+
function convertToHex(rgbVal) {
|
|
672
|
+
if (!rgbVal)
|
|
673
|
+
return "#000000";
|
|
674
|
+
rgbVal = rgbVal.trim();
|
|
675
|
+
if (rgbVal.startsWith("#")) {
|
|
676
|
+
return rgbVal;
|
|
677
|
+
}
|
|
678
|
+
const match = rgbVal.match(/^rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*[\d.]+)?\)$/i);
|
|
679
|
+
if (match) {
|
|
680
|
+
const r = parseInt(match[1], 10);
|
|
681
|
+
const g = parseInt(match[2], 10);
|
|
682
|
+
const b = parseInt(match[3], 10);
|
|
683
|
+
return "#" + [r, g, b].map((x) => {
|
|
684
|
+
const hex = x.toString(16);
|
|
685
|
+
return hex.length === 1 ? "0" + hex : hex;
|
|
686
|
+
}).join("");
|
|
687
|
+
}
|
|
688
|
+
return rgbVal;
|
|
689
|
+
}
|
|
690
|
+
// src/playground/utils/dom.ts
|
|
691
|
+
function setElementProperties(el, props) {
|
|
692
|
+
if (!el || !props)
|
|
693
|
+
return;
|
|
694
|
+
const tag = el.tagName?.toLowerCase();
|
|
695
|
+
Object.keys(props).forEach((pName) => {
|
|
696
|
+
const val = props[pName];
|
|
697
|
+
const isBoolean = typeof val === "boolean" || val === "true" || val === "false";
|
|
698
|
+
if (isBoolean) {
|
|
699
|
+
const boolVal = val === true || val === "true";
|
|
700
|
+
if (tag === "q-toggle" && pName === "checked" && typeof el.setChecked === "function") {
|
|
701
|
+
el.setChecked(boolVal);
|
|
702
|
+
return;
|
|
703
|
+
}
|
|
704
|
+
el[pName] = boolVal;
|
|
705
|
+
if (boolVal)
|
|
706
|
+
el.setAttribute(pName, "");
|
|
707
|
+
else
|
|
708
|
+
el.removeAttribute(pName);
|
|
709
|
+
} else {
|
|
710
|
+
el[pName] = val;
|
|
711
|
+
if (val !== undefined && val !== null && val !== "") {
|
|
712
|
+
el.setAttribute(pName, val);
|
|
713
|
+
} else {
|
|
714
|
+
el.removeAttribute(pName);
|
|
715
|
+
}
|
|
716
|
+
}
|
|
717
|
+
});
|
|
718
|
+
}
|
|
719
|
+
// src/playground/components/sandbox-viewport/sandbox-panel.tsx
|
|
720
|
+
var SYNCBACK_MAP = {
|
|
721
|
+
"q-sidepanel": { qClose: (cfg, _det) => {
|
|
722
|
+
if (cfg.props)
|
|
723
|
+
cfg.props.open.currentValue = false;
|
|
724
|
+
} },
|
|
725
|
+
"q-dialog": { qClose: (cfg, _det) => {
|
|
726
|
+
if (cfg.props)
|
|
727
|
+
cfg.props.open.currentValue = false;
|
|
728
|
+
} },
|
|
729
|
+
"q-dropdown": { qChange: (cfg, det) => {
|
|
730
|
+
if (cfg.props)
|
|
731
|
+
cfg.props.value.currentValue = det;
|
|
732
|
+
} },
|
|
733
|
+
"q-input": { qChange: (cfg, det) => {
|
|
734
|
+
if (cfg.props)
|
|
735
|
+
cfg.props.value.currentValue = det;
|
|
736
|
+
} },
|
|
737
|
+
"q-textarea": { qChange: (cfg, det) => {
|
|
738
|
+
if (cfg.props)
|
|
739
|
+
cfg.props.value.currentValue = det;
|
|
740
|
+
} },
|
|
741
|
+
"q-toggle": { qChange: (cfg, det) => {
|
|
742
|
+
if (cfg.props)
|
|
743
|
+
cfg.props.checked.currentValue = det;
|
|
744
|
+
} }
|
|
745
|
+
};
|
|
746
|
+
|
|
747
|
+
class SandboxPanel extends HTMLElement {
|
|
748
|
+
stageContainer = null;
|
|
749
|
+
activeModule = null;
|
|
750
|
+
loadedTag = null;
|
|
751
|
+
syncedComponents = new Set;
|
|
752
|
+
previousSlotValues = new WeakMap;
|
|
753
|
+
cleanupEffect;
|
|
754
|
+
connectedCallback() {
|
|
755
|
+
this.innerHTML = "";
|
|
756
|
+
this.appendChild(/* @__PURE__ */ h("div", {
|
|
757
|
+
class: "sandbox-layout"
|
|
758
|
+
}, /* @__PURE__ */ h("div", {
|
|
759
|
+
class: "sandbox-main"
|
|
760
|
+
}, /* @__PURE__ */ h("div", {
|
|
761
|
+
class: "stage-container",
|
|
762
|
+
id: "stageContainer"
|
|
763
|
+
}), /* @__PURE__ */ h("div", {
|
|
764
|
+
class: "sandbox-bottom-panels"
|
|
765
|
+
}, /* @__PURE__ */ h("playground-event-log", null), /* @__PURE__ */ h("playground-code-preview", null)))));
|
|
766
|
+
this.stageContainer = this.querySelector("#stageContainer");
|
|
767
|
+
this.activeModule = null;
|
|
768
|
+
this.loadedTag = null;
|
|
769
|
+
this.syncedComponents = new Set;
|
|
770
|
+
this.cleanupEffect = effect(async () => {
|
|
771
|
+
const active = activeComponent();
|
|
772
|
+
const tab = activeTab();
|
|
773
|
+
const registry = componentRegistry();
|
|
774
|
+
const spec = registry[active];
|
|
775
|
+
if (active === "global-styling" || tab !== "sandbox" || !spec || !this.stageContainer) {
|
|
776
|
+
this.loadedTag = null;
|
|
777
|
+
return;
|
|
778
|
+
}
|
|
779
|
+
if (this.loadedTag !== active) {
|
|
780
|
+
this.loadedTag = active;
|
|
781
|
+
const CUSTOM_VIEW_TAGS = ["q-button", "q-input"];
|
|
782
|
+
if (CUSTOM_VIEW_TAGS.includes(active)) {
|
|
783
|
+
await this.loadComponentSandboxView(active, spec, registry);
|
|
784
|
+
} else {
|
|
785
|
+
this.renderFallback(active, spec);
|
|
786
|
+
}
|
|
787
|
+
} else {
|
|
788
|
+
const activeEl = this.stageContainer.querySelector(active);
|
|
789
|
+
if (activeEl) {
|
|
790
|
+
const STRUCTURAL_PROPS = ["type", "variant"];
|
|
791
|
+
const hasStructuralChange = STRUCTURAL_PROPS.some((propName) => {
|
|
792
|
+
if (!spec.props?.[propName])
|
|
793
|
+
return false;
|
|
794
|
+
const currentVal = activeEl.getAttribute(propName) ?? "";
|
|
795
|
+
const newVal = String(spec.props[propName].currentValue ?? "");
|
|
796
|
+
return currentVal !== newVal;
|
|
797
|
+
});
|
|
798
|
+
if (hasStructuralChange) {
|
|
799
|
+
this.loadedTag = null;
|
|
800
|
+
const CUSTOM_VIEW_TAGS = ["q-button", "q-input"];
|
|
801
|
+
if (CUSTOM_VIEW_TAGS.includes(active)) {
|
|
802
|
+
await this.loadComponentSandboxView(active, spec, registry);
|
|
803
|
+
} else {
|
|
804
|
+
this.renderFallback(active, spec);
|
|
805
|
+
}
|
|
806
|
+
this.loadedTag = active;
|
|
807
|
+
} else {
|
|
808
|
+
this.updateElementFromSpec(activeEl, spec);
|
|
809
|
+
}
|
|
810
|
+
}
|
|
811
|
+
}
|
|
812
|
+
});
|
|
813
|
+
}
|
|
814
|
+
async loadComponentSandboxView(tag, spec, registry) {
|
|
815
|
+
if (!this.stageContainer)
|
|
816
|
+
return;
|
|
817
|
+
const isFirstLoad = !this.syncedComponents.has(tag);
|
|
818
|
+
if (isFirstLoad) {
|
|
819
|
+
this.syncedComponents.add(tag);
|
|
820
|
+
}
|
|
821
|
+
if (this.activeModule && typeof this.activeModule.destroy === "function") {
|
|
822
|
+
try {
|
|
823
|
+
this.activeModule.destroy(this.stageContainer);
|
|
824
|
+
} catch (err) {
|
|
825
|
+
console.error(`Error destroying previous module:`, err);
|
|
826
|
+
}
|
|
827
|
+
}
|
|
828
|
+
this.activeModule = null;
|
|
829
|
+
const existingStyle = document.getElementById("custom-view-style");
|
|
830
|
+
if (existingStyle) {
|
|
831
|
+
existingStyle.remove();
|
|
832
|
+
}
|
|
833
|
+
let customHtmlLoaded = false;
|
|
834
|
+
const timestamp = Date.now();
|
|
835
|
+
const htmlUrl = `/views/${tag}-view/${tag}-view.html?t=${timestamp}`;
|
|
836
|
+
try {
|
|
837
|
+
const htmlRes = await fetch(htmlUrl);
|
|
838
|
+
if (htmlRes.ok) {
|
|
839
|
+
const htmlText = await htmlRes.text();
|
|
840
|
+
if (htmlText.trim().startsWith("<!DOCTYPE") || htmlText.includes("<html")) {
|
|
841
|
+
throw new Error("SPA fallback page returned instead of view fragment");
|
|
842
|
+
}
|
|
843
|
+
this.stageContainer.innerHTML = htmlText;
|
|
844
|
+
const el = this.stageContainer.querySelector(tag);
|
|
845
|
+
if (el) {
|
|
846
|
+
customHtmlLoaded = true;
|
|
847
|
+
if (isFirstLoad) {
|
|
848
|
+
if (spec.props) {
|
|
849
|
+
Object.keys(spec.props).forEach((propName) => {
|
|
850
|
+
if (spec.props) {
|
|
851
|
+
const prop = spec.props[propName];
|
|
852
|
+
if (prop.type === "boolean") {
|
|
853
|
+
prop.currentValue = el.hasAttribute(propName);
|
|
854
|
+
} else {
|
|
855
|
+
const attrVal = el.getAttribute(propName);
|
|
856
|
+
if (attrVal !== null) {
|
|
857
|
+
prop.currentValue = attrVal;
|
|
858
|
+
}
|
|
859
|
+
}
|
|
860
|
+
}
|
|
861
|
+
});
|
|
862
|
+
}
|
|
863
|
+
if (spec.slots) {
|
|
864
|
+
Object.keys(spec.slots).forEach((slotName) => {
|
|
865
|
+
if (spec.slots) {
|
|
866
|
+
const slot = spec.slots[slotName];
|
|
867
|
+
if (slotName === "default") {
|
|
868
|
+
const clone = el.cloneNode(true);
|
|
869
|
+
Array.from(clone.children).forEach((child) => {
|
|
870
|
+
if (child.hasAttribute("slot"))
|
|
871
|
+
child.remove();
|
|
872
|
+
});
|
|
873
|
+
slot.currentValue = clone.innerHTML.trim();
|
|
874
|
+
} else {
|
|
875
|
+
const slotEl = el.querySelector(`[slot="${slotName}"]`);
|
|
876
|
+
if (slotEl) {
|
|
877
|
+
slot.currentValue = slotEl.innerHTML.trim();
|
|
878
|
+
}
|
|
879
|
+
}
|
|
880
|
+
}
|
|
881
|
+
});
|
|
882
|
+
}
|
|
883
|
+
componentRegistry.set({ ...registry });
|
|
884
|
+
} else {
|
|
885
|
+
this.updateElementFromSpec(el, spec);
|
|
886
|
+
}
|
|
887
|
+
}
|
|
888
|
+
}
|
|
889
|
+
} catch (err) {
|
|
890
|
+
console.warn(`Error fetching custom view for ${tag}:`, err);
|
|
891
|
+
}
|
|
892
|
+
if (!customHtmlLoaded) {
|
|
893
|
+
this.renderFallback(tag, spec);
|
|
894
|
+
}
|
|
895
|
+
const activeEl = this.stageContainer.querySelector(tag);
|
|
896
|
+
if (activeEl) {
|
|
897
|
+
this.bindEvents(activeEl, tag);
|
|
898
|
+
}
|
|
899
|
+
if (spec.options && activeEl) {
|
|
900
|
+
activeEl.options = spec.options;
|
|
901
|
+
}
|
|
902
|
+
if (spec.hasOwnProperty("stageHelper") && spec.stageHelper && activeEl) {
|
|
903
|
+
const stageHelper = spec.stageHelper;
|
|
904
|
+
const helper = document.createElement("div");
|
|
905
|
+
helper.className = "stage-helper-bar";
|
|
906
|
+
helper.innerHTML = `
|
|
907
|
+
<span class="stage-helper-text">${stageHelper.label}</span>
|
|
908
|
+
<q-button variant="secondary" size="sm" id="${stageHelper.buttonId}">${stageHelper.buttonLabel}</q-button>
|
|
909
|
+
`;
|
|
910
|
+
this.stageContainer.appendChild(helper);
|
|
911
|
+
}
|
|
912
|
+
const cssUrl = `/views/${tag}-view/${tag}-view.css`;
|
|
913
|
+
const cssUrlWithTimestamp = `${cssUrl}?t=${timestamp}`;
|
|
914
|
+
try {
|
|
915
|
+
const cssRes = await fetch(cssUrlWithTimestamp, { method: "HEAD" });
|
|
916
|
+
if (cssRes.ok) {
|
|
917
|
+
const link = document.createElement("link");
|
|
918
|
+
link.id = "custom-view-style";
|
|
919
|
+
link.rel = "stylesheet";
|
|
920
|
+
link.href = cssUrlWithTimestamp;
|
|
921
|
+
document.head.appendChild(link);
|
|
922
|
+
}
|
|
923
|
+
} catch (err) {}
|
|
924
|
+
const jsUrl = `/views/${tag}-view/${tag}-view.js`;
|
|
925
|
+
const jsUrlWithTimestamp = `${jsUrl}?t=${timestamp}`;
|
|
926
|
+
try {
|
|
927
|
+
const jsRes = await fetch(jsUrlWithTimestamp, { method: "HEAD" });
|
|
928
|
+
if (jsRes.ok) {
|
|
929
|
+
const mod = await import(jsUrlWithTimestamp);
|
|
930
|
+
this.activeModule = mod;
|
|
931
|
+
if (mod && typeof mod.init === "function") {
|
|
932
|
+
mod.init(this.stageContainer);
|
|
933
|
+
}
|
|
934
|
+
}
|
|
935
|
+
} catch (err) {
|
|
936
|
+
console.warn(`Could not initialize custom JS module for ${tag}:`, err);
|
|
937
|
+
}
|
|
938
|
+
}
|
|
939
|
+
renderFallback(tag, spec) {
|
|
940
|
+
if (!this.stageContainer)
|
|
941
|
+
return;
|
|
942
|
+
const el = document.createElement(tag);
|
|
943
|
+
this.updateElementFromSpec(el, spec);
|
|
944
|
+
this.stageContainer.innerHTML = "";
|
|
945
|
+
this.stageContainer.appendChild(el);
|
|
946
|
+
}
|
|
947
|
+
bindEvents(activeEl, tag) {
|
|
948
|
+
const eventsToLog = ["qChange", "qSelect", "qClose", "qSlideChange", "qLightboxOpen", "qLightboxClose", "qItemClick", "qScroll", "qClick", "qFocus", "qBlur"];
|
|
949
|
+
eventsToLog.forEach((eventName) => {
|
|
950
|
+
activeEl.addEventListener(eventName, (e) => {
|
|
951
|
+
const customEvent = e;
|
|
952
|
+
playgroundBus.emit("event-dispatched", {
|
|
953
|
+
name: eventName,
|
|
954
|
+
detail: customEvent.detail
|
|
955
|
+
});
|
|
956
|
+
let changed = false;
|
|
957
|
+
const registry = componentRegistry();
|
|
958
|
+
const config = registry[tag];
|
|
959
|
+
if (!config)
|
|
960
|
+
return;
|
|
961
|
+
const handler = SYNCBACK_MAP[tag]?.[eventName];
|
|
962
|
+
if (handler) {
|
|
963
|
+
handler(config, customEvent.detail);
|
|
964
|
+
changed = true;
|
|
965
|
+
}
|
|
966
|
+
if (changed) {
|
|
967
|
+
componentRegistry.set({ ...registry });
|
|
968
|
+
}
|
|
969
|
+
});
|
|
970
|
+
});
|
|
971
|
+
}
|
|
972
|
+
updateElementFromSpec(el, spec) {
|
|
973
|
+
if (!el || !spec)
|
|
974
|
+
return;
|
|
975
|
+
if (spec.props) {
|
|
976
|
+
const flatProps = {};
|
|
977
|
+
Object.keys(spec.props).forEach((pName) => {
|
|
978
|
+
if (spec.props) {
|
|
979
|
+
flatProps[pName] = spec.props[pName].currentValue;
|
|
980
|
+
}
|
|
981
|
+
});
|
|
982
|
+
setElementProperties(el, flatProps);
|
|
983
|
+
}
|
|
984
|
+
if (spec.slots) {
|
|
985
|
+
this.updateElementSlots(el, spec);
|
|
986
|
+
}
|
|
987
|
+
if (spec.options) {
|
|
988
|
+
el.options = spec.options;
|
|
989
|
+
}
|
|
990
|
+
}
|
|
991
|
+
updateElementSlots(el, config) {
|
|
992
|
+
if (!config.slots)
|
|
993
|
+
return;
|
|
994
|
+
let cachedSlots = this.previousSlotValues.get(el);
|
|
995
|
+
if (!cachedSlots) {
|
|
996
|
+
cachedSlots = {};
|
|
997
|
+
this.previousSlotValues.set(el, cachedSlots);
|
|
998
|
+
}
|
|
999
|
+
let hasAnySlotChanged = false;
|
|
1000
|
+
Object.keys(config.slots).forEach((slotName) => {
|
|
1001
|
+
const currentVal = config.slots[slotName]?.currentValue ?? "";
|
|
1002
|
+
if (cachedSlots[slotName] !== currentVal) {
|
|
1003
|
+
hasAnySlotChanged = true;
|
|
1004
|
+
cachedSlots[slotName] = currentVal;
|
|
1005
|
+
}
|
|
1006
|
+
});
|
|
1007
|
+
if (!hasAnySlotChanged && Object.keys(cachedSlots).length > 0) {
|
|
1008
|
+
return;
|
|
1009
|
+
}
|
|
1010
|
+
const namedSlots = {};
|
|
1011
|
+
Array.from(el.children).forEach((child) => {
|
|
1012
|
+
const slotName = child.getAttribute("slot");
|
|
1013
|
+
if (slotName) {
|
|
1014
|
+
namedSlots[slotName] = child;
|
|
1015
|
+
}
|
|
1016
|
+
});
|
|
1017
|
+
el.innerHTML = "";
|
|
1018
|
+
const defaultSlot = config.slots.default;
|
|
1019
|
+
if (defaultSlot && defaultSlot.currentValue) {
|
|
1020
|
+
el.innerHTML = defaultSlot.currentValue;
|
|
1021
|
+
}
|
|
1022
|
+
Object.keys(config.slots).forEach((slotName) => {
|
|
1023
|
+
if (slotName === "default")
|
|
1024
|
+
return;
|
|
1025
|
+
if (config.slots) {
|
|
1026
|
+
const slot = config.slots[slotName];
|
|
1027
|
+
if (slot.currentValue) {
|
|
1028
|
+
const wrapper = document.createElement("span");
|
|
1029
|
+
wrapper.setAttribute("slot", slotName);
|
|
1030
|
+
wrapper.innerHTML = slot.currentValue;
|
|
1031
|
+
el.appendChild(wrapper);
|
|
1032
|
+
}
|
|
1033
|
+
}
|
|
1034
|
+
});
|
|
1035
|
+
}
|
|
1036
|
+
disconnectedCallback() {
|
|
1037
|
+
if (this.cleanupEffect) {
|
|
1038
|
+
this.cleanupEffect();
|
|
1039
|
+
}
|
|
1040
|
+
if (this.activeModule && typeof this.activeModule.destroy === "function") {
|
|
1041
|
+
try {
|
|
1042
|
+
this.activeModule.destroy(this.stageContainer);
|
|
1043
|
+
} catch (err) {}
|
|
1044
|
+
}
|
|
1045
|
+
}
|
|
1046
|
+
}
|
|
1047
|
+
customElements.define("sandbox-panel", SandboxPanel);
|
|
1048
|
+
|
|
1049
|
+
// src/playground/components/sandbox-viewport/variant-card.tsx
|
|
1050
|
+
class VariantCard extends HTMLElement {
|
|
1051
|
+
tag;
|
|
1052
|
+
item;
|
|
1053
|
+
resizeObserver;
|
|
1054
|
+
connectedCallback() {
|
|
1055
|
+
if (!this.tag || !this.item)
|
|
1056
|
+
return;
|
|
1057
|
+
const tag = this.tag;
|
|
1058
|
+
const item = this.item;
|
|
1059
|
+
const registry = componentRegistry();
|
|
1060
|
+
const config = registry[tag];
|
|
1061
|
+
if (!config)
|
|
1062
|
+
return;
|
|
1063
|
+
this.className = "variant-card";
|
|
1064
|
+
this.innerHTML = "";
|
|
1065
|
+
const titleRow = /* @__PURE__ */ h("div", {
|
|
1066
|
+
class: "variant-title-row"
|
|
1067
|
+
}, /* @__PURE__ */ h("h4", {
|
|
1068
|
+
class: "variant-card-title"
|
|
1069
|
+
}, item.name));
|
|
1070
|
+
this.appendChild(titleRow);
|
|
1071
|
+
const stage = /* @__PURE__ */ h("div", {
|
|
1072
|
+
class: "variant-card-stage"
|
|
1073
|
+
}, /* @__PURE__ */ h("span", {
|
|
1074
|
+
class: "variant-card-dimensions"
|
|
1075
|
+
}, "0px × 0px"));
|
|
1076
|
+
const el = document.createElement(tag);
|
|
1077
|
+
setElementProperties(el, item.props);
|
|
1078
|
+
const defaultSlot = item.slot !== undefined ? item.slot : config.slots?.default?.default || "";
|
|
1079
|
+
if (defaultSlot !== undefined && defaultSlot !== "") {
|
|
1080
|
+
el.innerHTML = defaultSlot;
|
|
1081
|
+
}
|
|
1082
|
+
if (item.slots) {
|
|
1083
|
+
Object.keys(item.slots).forEach((slotName) => {
|
|
1084
|
+
const wrapper = document.createElement("span");
|
|
1085
|
+
wrapper.setAttribute("slot", slotName);
|
|
1086
|
+
wrapper.innerHTML = item.slots[slotName];
|
|
1087
|
+
el.appendChild(wrapper);
|
|
1088
|
+
});
|
|
1089
|
+
} else if (config.slots) {
|
|
1090
|
+
Object.keys(config.slots).forEach((slotName) => {
|
|
1091
|
+
if (slotName !== "default" && config.slots[slotName].default) {
|
|
1092
|
+
const wrapper = document.createElement("span");
|
|
1093
|
+
wrapper.setAttribute("slot", slotName);
|
|
1094
|
+
wrapper.innerHTML = config.slots[slotName].default;
|
|
1095
|
+
el.appendChild(wrapper);
|
|
1096
|
+
}
|
|
1097
|
+
});
|
|
1098
|
+
}
|
|
1099
|
+
stage.appendChild(el);
|
|
1100
|
+
this.appendChild(stage);
|
|
1101
|
+
const dimensionsBadge = stage.querySelector(".variant-card-dimensions");
|
|
1102
|
+
if (typeof ResizeObserver !== "undefined" && dimensionsBadge) {
|
|
1103
|
+
this.resizeObserver = new ResizeObserver(() => {
|
|
1104
|
+
const rect = el.getBoundingClientRect();
|
|
1105
|
+
const width = Math.round(rect.width);
|
|
1106
|
+
const height = Math.round(rect.height);
|
|
1107
|
+
dimensionsBadge.innerText = `${width}px × ${height}px`;
|
|
1108
|
+
});
|
|
1109
|
+
this.resizeObserver.observe(el);
|
|
1110
|
+
}
|
|
1111
|
+
if (config.options) {
|
|
1112
|
+
el.options = config.options;
|
|
1113
|
+
}
|
|
1114
|
+
if (tag === "q-sidepanel") {
|
|
1115
|
+
const btn = /* @__PURE__ */ h("q-button", {
|
|
1116
|
+
variant: "secondary",
|
|
1117
|
+
size: "sm",
|
|
1118
|
+
class: "var-open-panel-btn"
|
|
1119
|
+
}, "Trigger Drawer Panel");
|
|
1120
|
+
this.appendChild(btn);
|
|
1121
|
+
}
|
|
1122
|
+
if (tag === "q-dialog") {
|
|
1123
|
+
const btn = /* @__PURE__ */ h("q-button", {
|
|
1124
|
+
variant: "secondary",
|
|
1125
|
+
size: "sm",
|
|
1126
|
+
class: "var-open-dialog-btn"
|
|
1127
|
+
}, "Trigger Dialog Overlay");
|
|
1128
|
+
this.appendChild(btn);
|
|
1129
|
+
}
|
|
1130
|
+
const slots = { default: defaultSlot };
|
|
1131
|
+
if (item.slots) {
|
|
1132
|
+
Object.assign(slots, item.slots);
|
|
1133
|
+
}
|
|
1134
|
+
const appendScript = tag === "q-dropdown" && config.options ? `
|
|
1135
|
+
|
|
1136
|
+
<!-- Programmatic dropdown options population script -->
|
|
1137
|
+
<script>
|
|
1138
|
+
const dropdown = document.querySelector('q-dropdown');
|
|
1139
|
+
dropdown.options = ${JSON.stringify(config.options, null, 2).replace(/\n/g, `
|
|
1140
|
+
`)};
|
|
1141
|
+
</script>` : null;
|
|
1142
|
+
const codeText = serializeComponentCode(tag, item.props, slots, appendScript);
|
|
1143
|
+
const syntaxBox = /* @__PURE__ */ h("q-syntax-box", {
|
|
1144
|
+
variant: "plain",
|
|
1145
|
+
code: codeText,
|
|
1146
|
+
class: "variant-card-code"
|
|
1147
|
+
});
|
|
1148
|
+
this.appendChild(syntaxBox);
|
|
1149
|
+
}
|
|
1150
|
+
disconnectedCallback() {
|
|
1151
|
+
if (this.resizeObserver) {
|
|
1152
|
+
this.resizeObserver.disconnect();
|
|
1153
|
+
}
|
|
1154
|
+
}
|
|
1155
|
+
}
|
|
1156
|
+
customElements.define("variant-card", VariantCard);
|
|
1157
|
+
|
|
1158
|
+
// src/playground/components/sandbox-viewport/sandbox-viewport.css
|
|
1159
|
+
var sandbox_viewport_default = `.main-panel {\r
|
|
1160
|
+
flex: 1;\r
|
|
1161
|
+
display: flex;\r
|
|
1162
|
+
flex-direction: column;\r
|
|
1163
|
+
min-width: 0;\r
|
|
1164
|
+
background: var(--bg-app);\r
|
|
1165
|
+
overflow: hidden;\r
|
|
1166
|
+
height: 100%;\r
|
|
1167
|
+
}\r
|
|
1168
|
+
\r
|
|
1169
|
+
.tabs-bar {\r
|
|
1170
|
+
display: flex;\r
|
|
1171
|
+
align-items: center;\r
|
|
1172
|
+
justify-content: space-between;\r
|
|
1173
|
+
padding: 0 24px;\r
|
|
1174
|
+
height: 43px;\r
|
|
1175
|
+
background: var(--bg-sidebar);\r
|
|
1176
|
+
border-bottom: 1px solid var(--border-color);\r
|
|
1177
|
+
flex-shrink: 0;\r
|
|
1178
|
+
gap: 16px;\r
|
|
1179
|
+
}\r
|
|
1180
|
+
\r
|
|
1181
|
+
.tab-buttons {\r
|
|
1182
|
+
display: flex;\r
|
|
1183
|
+
height: 100%;\r
|
|
1184
|
+
flex-shrink: 0;\r
|
|
1185
|
+
}\r
|
|
1186
|
+
\r
|
|
1187
|
+
.tab-btn {\r
|
|
1188
|
+
background: transparent;\r
|
|
1189
|
+
border: none;\r
|
|
1190
|
+
color: var(--text-muted);\r
|
|
1191
|
+
padding: 0 20px;\r
|
|
1192
|
+
font-size: 0.9rem;\r
|
|
1193
|
+
font-weight: 600;\r
|
|
1194
|
+
cursor: pointer;\r
|
|
1195
|
+
height: 100%;\r
|
|
1196
|
+
display: flex;\r
|
|
1197
|
+
align-items: center;\r
|
|
1198
|
+
border-bottom: 2px solid transparent;\r
|
|
1199
|
+
transition: all 0.2s ease;\r
|
|
1200
|
+
}\r
|
|
1201
|
+
\r
|
|
1202
|
+
.tab-btn:hover {\r
|
|
1203
|
+
color: var(--text-main);\r
|
|
1204
|
+
}\r
|
|
1205
|
+
\r
|
|
1206
|
+
.tab-btn.active {\r
|
|
1207
|
+
color: var(--primary);\r
|
|
1208
|
+
border-bottom-color: var(--primary);\r
|
|
1209
|
+
}\r
|
|
1210
|
+
\r
|
|
1211
|
+
.active-component-badge {\r
|
|
1212
|
+
font-family: monospace;\r
|
|
1213
|
+
background: var(--bg-surface);\r
|
|
1214
|
+
border: 1px solid var(--border-color);\r
|
|
1215
|
+
padding: 4px 8px;\r
|
|
1216
|
+
border-radius: var(--q-radius-md);\r
|
|
1217
|
+
font-size: 0.8rem;\r
|
|
1218
|
+
color: var(--primary);\r
|
|
1219
|
+
flex-shrink: 0;\r
|
|
1220
|
+
}\r
|
|
1221
|
+
\r
|
|
1222
|
+
.stage-content-wrapper {\r
|
|
1223
|
+
flex: 1;\r
|
|
1224
|
+
min-height: 0;\r
|
|
1225
|
+
position: relative;\r
|
|
1226
|
+
display: flex;\r
|
|
1227
|
+
flex-direction: column;\r
|
|
1228
|
+
}\r
|
|
1229
|
+
\r
|
|
1230
|
+
.tab-content {\r
|
|
1231
|
+
display: none;\r
|
|
1232
|
+
flex: 1;\r
|
|
1233
|
+
min-height: 0;\r
|
|
1234
|
+
flex-direction: column;\r
|
|
1235
|
+
}\r
|
|
1236
|
+
\r
|
|
1237
|
+
.tab-content.active {\r
|
|
1238
|
+
display: flex;\r
|
|
1239
|
+
}\r
|
|
1240
|
+
\r
|
|
1241
|
+
.sandbox-layout {\r
|
|
1242
|
+
display: flex;\r
|
|
1243
|
+
flex-direction: column;\r
|
|
1244
|
+
flex: 1;\r
|
|
1245
|
+
min-height: 0;\r
|
|
1246
|
+
box-sizing: border-box;\r
|
|
1247
|
+
}\r
|
|
1248
|
+
\r
|
|
1249
|
+
.sandbox-main {\r
|
|
1250
|
+
flex: 1;\r
|
|
1251
|
+
display: flex;\r
|
|
1252
|
+
flex-direction: column;\r
|
|
1253
|
+
padding: 24px;\r
|
|
1254
|
+
gap: 20px;\r
|
|
1255
|
+
min-height: 0;\r
|
|
1256
|
+
}\r
|
|
1257
|
+
\r
|
|
1258
|
+
.sandbox-bottom-panels {\r
|
|
1259
|
+
display: flex;\r
|
|
1260
|
+
gap: 20px;\r
|
|
1261
|
+
height: 150px;\r
|
|
1262
|
+
flex-shrink: 0;\r
|
|
1263
|
+
}\r
|
|
1264
|
+
\r
|
|
1265
|
+
playground-event-log,\r
|
|
1266
|
+
playground-code-preview {\r
|
|
1267
|
+
flex: 1;\r
|
|
1268
|
+
min-width: 0;\r
|
|
1269
|
+
height: 100%;\r
|
|
1270
|
+
}\r
|
|
1271
|
+
\r
|
|
1272
|
+
\r
|
|
1273
|
+
.stage-container {\r
|
|
1274
|
+
flex: 1;\r
|
|
1275
|
+
min-height: 0;\r
|
|
1276
|
+
background-color: var(--bg-app);\r
|
|
1277
|
+
background-image: radial-gradient(var(--bg-surface) 1.5px, transparent 1.5px);\r
|
|
1278
|
+
background-size: 20px 20px;\r
|
|
1279
|
+
border: 1px solid var(--border-color);\r
|
|
1280
|
+
border-radius: var(--q-radius-lg);\r
|
|
1281
|
+
padding: 40px;\r
|
|
1282
|
+
display: flex;\r
|
|
1283
|
+
align-items: center;\r
|
|
1284
|
+
justify-content: center;\r
|
|
1285
|
+
position: relative;\r
|
|
1286
|
+
transition:\r
|
|
1287
|
+
background-color 0.3s ease,\r
|
|
1288
|
+
border-color 0.3s ease;\r
|
|
1289
|
+
transform: translate(0, 0); /* Bounded mode by default */\r
|
|
1290
|
+
overflow: hidden;\r
|
|
1291
|
+
}\r
|
|
1292
|
+
\r
|
|
1293
|
+
/* Helpers Panel inside stage */\r
|
|
1294
|
+
.stage-helper-bar {\r
|
|
1295
|
+
position: absolute;\r
|
|
1296
|
+
bottom: 16px;\r
|
|
1297
|
+
left: 50%;\r
|
|
1298
|
+
transform: translateX(-50%);\r
|
|
1299
|
+
background: rgba(17, 24, 39, 0.95);\r
|
|
1300
|
+
padding: 8px 16px;\r
|
|
1301
|
+
border-radius: 30px;\r
|
|
1302
|
+
border: 1px solid rgba(255, 255, 255, 0.1);\r
|
|
1303
|
+
display: flex;\r
|
|
1304
|
+
align-items: center;\r
|
|
1305
|
+
gap: 10px;\r
|
|
1306
|
+
z-index: 100;\r
|
|
1307
|
+
}\r
|
|
1308
|
+
\r
|
|
1309
|
+
.stage-helper-text {\r
|
|
1310
|
+
font-size: 0.8rem;\r
|
|
1311
|
+
color: var(--text-muted);\r
|
|
1312
|
+
}\r
|
|
1313
|
+
\r
|
|
1314
|
+
/* Grid Visual Matrix styling */\r
|
|
1315
|
+
.variants-grid {\r
|
|
1316
|
+
display: grid;\r
|
|
1317
|
+
grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));\r
|
|
1318
|
+
gap: 24px;\r
|
|
1319
|
+
padding: 24px;\r
|
|
1320
|
+
}\r
|
|
1321
|
+
\r
|
|
1322
|
+
.variant-card {\r
|
|
1323
|
+
background: var(--bg-sidebar);\r
|
|
1324
|
+
border: 1px solid var(--border-color);\r
|
|
1325
|
+
border-radius: var(--q-radius-lg);\r
|
|
1326
|
+
padding: 20px;\r
|
|
1327
|
+
display: flex;\r
|
|
1328
|
+
flex-direction: column;\r
|
|
1329
|
+
gap: 16px;\r
|
|
1330
|
+
min-width: 0;\r
|
|
1331
|
+
}\r
|
|
1332
|
+
\r
|
|
1333
|
+
.variant-title-row {\r
|
|
1334
|
+
display: flex;\r
|
|
1335
|
+
justify-content: space-between;\r
|
|
1336
|
+
align-items: center;\r
|
|
1337
|
+
border-bottom: 1px solid var(--border-color);\r
|
|
1338
|
+
padding-bottom: 8px;\r
|
|
1339
|
+
gap: 16px;\r
|
|
1340
|
+
}\r
|
|
1341
|
+
\r
|
|
1342
|
+
.variant-card-title {\r
|
|
1343
|
+
font-size: 0.9rem;\r
|
|
1344
|
+
font-weight: 600;\r
|
|
1345
|
+
color: var(--primary);\r
|
|
1346
|
+
margin: 0;\r
|
|
1347
|
+
flex-shrink: 1;\r
|
|
1348
|
+
min-width: 0;\r
|
|
1349
|
+
overflow: hidden;\r
|
|
1350
|
+
text-overflow: ellipsis;\r
|
|
1351
|
+
white-space: nowrap;\r
|
|
1352
|
+
}\r
|
|
1353
|
+
\r
|
|
1354
|
+
.variant-card-stage {\r
|
|
1355
|
+
display: flex;\r
|
|
1356
|
+
align-items: center;\r
|
|
1357
|
+
justify-content: center;\r
|
|
1358
|
+
min-height: 160px;\r
|
|
1359
|
+
min-width: 280px;\r
|
|
1360
|
+
background: var(--bg-app);\r
|
|
1361
|
+
border-radius: var(--q-radius-md);\r
|
|
1362
|
+
padding: 20px;\r
|
|
1363
|
+
position: relative;\r
|
|
1364
|
+
overflow: auto;\r
|
|
1365
|
+
border: 1px solid var(--border-color);\r
|
|
1366
|
+
}\r
|
|
1367
|
+
\r
|
|
1368
|
+
.variant-card-dimensions {\r
|
|
1369
|
+
position: absolute;\r
|
|
1370
|
+
top: 8px;\r
|
|
1371
|
+
right: 8px;\r
|
|
1372
|
+
background: rgba(17, 24, 39, 0.85);\r
|
|
1373
|
+
border: 1px solid rgba(255, 255, 255, 0.15);\r
|
|
1374
|
+
color: var(--text-muted);\r
|
|
1375
|
+
font-family: monospace;\r
|
|
1376
|
+
font-size: 0.7rem;\r
|
|
1377
|
+
padding: 2px 6px;\r
|
|
1378
|
+
border-radius: 4px;\r
|
|
1379
|
+
pointer-events: none;\r
|
|
1380
|
+
z-index: 5;\r
|
|
1381
|
+
user-select: none;\r
|
|
1382
|
+
}\r
|
|
1383
|
+
\r
|
|
1384
|
+
.variant-card-desc {\r
|
|
1385
|
+
font-size: 0.8rem;\r
|
|
1386
|
+
color: var(--text-muted);\r
|
|
1387
|
+
margin: 0;\r
|
|
1388
|
+
}\r
|
|
1389
|
+
\r
|
|
1390
|
+
.variant-card-code {\r
|
|
1391
|
+
margin: 0;\r
|
|
1392
|
+
padding: 10px;\r
|
|
1393
|
+
background: #0d1117;\r
|
|
1394
|
+
border-radius: var(--q-radius-md);\r
|
|
1395
|
+
border: 1px solid #21262d;\r
|
|
1396
|
+
font-family: monospace;\r
|
|
1397
|
+
font-size: 0.75rem;\r
|
|
1398
|
+
overflow-x: auto;\r
|
|
1399
|
+
color: #c9d1d9;\r
|
|
1400
|
+
}\r
|
|
1401
|
+
\r
|
|
1402
|
+
/* Responsive mobile view styles */\r
|
|
1403
|
+
@media (max-width: 900px) {\r
|
|
1404
|
+
.sandbox-layout {\r
|
|
1405
|
+
flex-direction: column;\r
|
|
1406
|
+
}\r
|
|
1407
|
+
\r
|
|
1408
|
+
.sandbox-main {\r
|
|
1409
|
+
padding: 16px;\r
|
|
1410
|
+
gap: 16px;\r
|
|
1411
|
+
overflow-y: auto;\r
|
|
1412
|
+
height: auto;\r
|
|
1413
|
+
min-height: 100%;\r
|
|
1414
|
+
}\r
|
|
1415
|
+
\r
|
|
1416
|
+
.stage-container {\r
|
|
1417
|
+
min-height: 320px;\r
|
|
1418
|
+
padding: 20px;\r
|
|
1419
|
+
}\r
|
|
1420
|
+
\r
|
|
1421
|
+
.variants-grid {\r
|
|
1422
|
+
grid-template-columns: 1fr;\r
|
|
1423
|
+
padding: 16px;\r
|
|
1424
|
+
gap: 16px;\r
|
|
1425
|
+
}\r
|
|
1426
|
+
\r
|
|
1427
|
+
.tabs-bar {\r
|
|
1428
|
+
flex-direction: column;\r
|
|
1429
|
+
height: auto;\r
|
|
1430
|
+
padding: 10px 16px;\r
|
|
1431
|
+
align-items: stretch;\r
|
|
1432
|
+
gap: 8px;\r
|
|
1433
|
+
}\r
|
|
1434
|
+
\r
|
|
1435
|
+
.tab-buttons {\r
|
|
1436
|
+
overflow-x: auto;\r
|
|
1437
|
+
white-space: nowrap;\r
|
|
1438
|
+
height: auto;\r
|
|
1439
|
+
padding: 4px 0;\r
|
|
1440
|
+
-webkit-overflow-scrolling: touch;\r
|
|
1441
|
+
}\r
|
|
1442
|
+
\r
|
|
1443
|
+
.tab-buttons::-webkit-scrollbar {\r
|
|
1444
|
+
display: none;\r
|
|
1445
|
+
}\r
|
|
1446
|
+
\r
|
|
1447
|
+
.tab-btn {\r
|
|
1448
|
+
flex-shrink: 0;\r
|
|
1449
|
+
}\r
|
|
1450
|
+
\r
|
|
1451
|
+
.active-component-badge {\r
|
|
1452
|
+
align-self: flex-start;\r
|
|
1453
|
+
}\r
|
|
1454
|
+
\r
|
|
1455
|
+
.sandbox-bottom-panels {\r
|
|
1456
|
+
flex-direction: column;\r
|
|
1457
|
+
height: auto;\r
|
|
1458
|
+
}\r
|
|
1459
|
+
}\r
|
|
1460
|
+
\r
|
|
1461
|
+
.grid-empty-state {\r
|
|
1462
|
+
grid-column: span 3;\r
|
|
1463
|
+
padding: 40px;\r
|
|
1464
|
+
text-align: center;\r
|
|
1465
|
+
color: var(--text-muted);\r
|
|
1466
|
+
}\r
|
|
1467
|
+
\r
|
|
1468
|
+
/* Wide components full-width layouts */\r
|
|
1469
|
+
sandbox-viewport[active-component="q-data-table"] .variants-grid,\r
|
|
1470
|
+
sandbox-viewport[active-component="q-data-table"] .edgecases-grid,\r
|
|
1471
|
+
sandbox-viewport[active-component="q-step-diagram"] .variants-grid,\r
|
|
1472
|
+
sandbox-viewport[active-component="q-step-diagram"] .edgecases-grid {\r
|
|
1473
|
+
grid-template-columns: 1fr;\r
|
|
1474
|
+
}\r
|
|
1475
|
+
\r
|
|
1476
|
+
.variant-card-stage > q-data-table,\r
|
|
1477
|
+
.variant-card-stage > q-step-diagram {\r
|
|
1478
|
+
width: 100%;\r
|
|
1479
|
+
flex: 1;\r
|
|
1480
|
+
}\r
|
|
1481
|
+
`;
|
|
1482
|
+
|
|
1483
|
+
// src/playground/components/sandbox-viewport/sandbox-viewport.tsx
|
|
1484
|
+
function emptyState(msg) {
|
|
1485
|
+
return `<div class="grid-empty-state">${msg}</div>`;
|
|
1486
|
+
}
|
|
1487
|
+
|
|
1488
|
+
class SandboxViewport extends HTMLElement {
|
|
1489
|
+
variantsGrid = null;
|
|
1490
|
+
edgecasesGrid = null;
|
|
1491
|
+
cleanupEffect;
|
|
1492
|
+
connectedCallback() {
|
|
1493
|
+
this.innerHTML = "";
|
|
1494
|
+
this.appendChild(/* @__PURE__ */ h("viewport-tabs", null));
|
|
1495
|
+
this.appendChild(/* @__PURE__ */ h("div", {
|
|
1496
|
+
class: "stage-content-wrapper"
|
|
1497
|
+
}, /* @__PURE__ */ h("sandbox-panel", {
|
|
1498
|
+
class: "tab-content active",
|
|
1499
|
+
id: "content-sandbox"
|
|
1500
|
+
}), /* @__PURE__ */ h("div", {
|
|
1501
|
+
class: "tab-content",
|
|
1502
|
+
id: "content-variants"
|
|
1503
|
+
}, /* @__PURE__ */ h("q-scrollable", {
|
|
1504
|
+
height: "100%"
|
|
1505
|
+
}, /* @__PURE__ */ h("div", {
|
|
1506
|
+
class: "variants-grid",
|
|
1507
|
+
id: "variantsGrid"
|
|
1508
|
+
}))), /* @__PURE__ */ h("div", {
|
|
1509
|
+
class: "tab-content",
|
|
1510
|
+
id: "content-edgecases"
|
|
1511
|
+
}, /* @__PURE__ */ h("q-scrollable", {
|
|
1512
|
+
height: "100%"
|
|
1513
|
+
}, /* @__PURE__ */ h("div", {
|
|
1514
|
+
class: "variants-grid",
|
|
1515
|
+
id: "edgecasesGrid"
|
|
1516
|
+
}))), /* @__PURE__ */ h("div", {
|
|
1517
|
+
class: "tab-content",
|
|
1518
|
+
id: "content-global-styling"
|
|
1519
|
+
}, /* @__PURE__ */ h("q-scrollable", {
|
|
1520
|
+
height: "100%"
|
|
1521
|
+
}, /* @__PURE__ */ h("theme-designer", null)))));
|
|
1522
|
+
const styleId = "sandbox-viewport-style";
|
|
1523
|
+
if (!document.getElementById(styleId)) {
|
|
1524
|
+
const style = document.createElement("style");
|
|
1525
|
+
style.id = styleId;
|
|
1526
|
+
style.textContent = sandbox_viewport_default;
|
|
1527
|
+
document.head.appendChild(style);
|
|
1528
|
+
}
|
|
1529
|
+
this.init();
|
|
1530
|
+
}
|
|
1531
|
+
init() {
|
|
1532
|
+
this.variantsGrid = this.querySelector("#variantsGrid");
|
|
1533
|
+
this.edgecasesGrid = this.querySelector("#edgecasesGrid");
|
|
1534
|
+
this.addEventListener("click", (e) => {
|
|
1535
|
+
const target = e.target;
|
|
1536
|
+
if (!target)
|
|
1537
|
+
return;
|
|
1538
|
+
if (target.id === "closePanelBtn") {
|
|
1539
|
+
const panel = this.querySelector("q-sidepanel");
|
|
1540
|
+
if (panel) {
|
|
1541
|
+
panel.open = false;
|
|
1542
|
+
const registry = componentRegistry();
|
|
1543
|
+
if (registry["q-sidepanel"] && registry["q-sidepanel"].props) {
|
|
1544
|
+
registry["q-sidepanel"].props.open.currentValue = false;
|
|
1545
|
+
componentRegistry.set({ ...registry });
|
|
1546
|
+
}
|
|
1547
|
+
}
|
|
1548
|
+
}
|
|
1549
|
+
if (target.id === "stageOpenPanelBtn") {
|
|
1550
|
+
const panel = this.querySelector("q-sidepanel");
|
|
1551
|
+
if (panel) {
|
|
1552
|
+
panel.open = true;
|
|
1553
|
+
const registry = componentRegistry();
|
|
1554
|
+
if (registry["q-sidepanel"] && registry["q-sidepanel"].props) {
|
|
1555
|
+
registry["q-sidepanel"].props.open.currentValue = true;
|
|
1556
|
+
componentRegistry.set({ ...registry });
|
|
1557
|
+
}
|
|
1558
|
+
}
|
|
1559
|
+
}
|
|
1560
|
+
if (target.id === "stageOpenDialogBtn") {
|
|
1561
|
+
const dialog = this.querySelector("q-dialog");
|
|
1562
|
+
if (dialog) {
|
|
1563
|
+
dialog.open = true;
|
|
1564
|
+
const registry = componentRegistry();
|
|
1565
|
+
if (registry["q-dialog"] && registry["q-dialog"].props) {
|
|
1566
|
+
registry["q-dialog"].props.open.currentValue = true;
|
|
1567
|
+
componentRegistry.set({ ...registry });
|
|
1568
|
+
}
|
|
1569
|
+
}
|
|
1570
|
+
}
|
|
1571
|
+
if (target.classList.contains("var-open-panel-btn")) {
|
|
1572
|
+
const card = target.closest(".variant-card");
|
|
1573
|
+
if (card) {
|
|
1574
|
+
const panel = card.querySelector("q-sidepanel");
|
|
1575
|
+
if (panel)
|
|
1576
|
+
panel.open = true;
|
|
1577
|
+
}
|
|
1578
|
+
}
|
|
1579
|
+
if (target.classList.contains("var-open-dialog-btn")) {
|
|
1580
|
+
const card = target.closest(".variant-card");
|
|
1581
|
+
if (card) {
|
|
1582
|
+
const dialog = card.querySelector("q-dialog");
|
|
1583
|
+
if (dialog)
|
|
1584
|
+
dialog.open = true;
|
|
1585
|
+
}
|
|
1586
|
+
}
|
|
1587
|
+
});
|
|
1588
|
+
this.cleanupEffect = effect(() => {
|
|
1589
|
+
const active = activeComponent();
|
|
1590
|
+
const tab = activeTab();
|
|
1591
|
+
const registry = componentRegistry();
|
|
1592
|
+
const spec = registry[active];
|
|
1593
|
+
this.setAttribute("active-component", active);
|
|
1594
|
+
this.querySelectorAll(".stage-content-wrapper > .tab-content").forEach((c) => {
|
|
1595
|
+
if (active === "global-styling") {
|
|
1596
|
+
c.classList.toggle("active", c.id === "content-global-styling");
|
|
1597
|
+
} else {
|
|
1598
|
+
c.classList.toggle("active", c.id === `content-${tab}`);
|
|
1599
|
+
}
|
|
1600
|
+
});
|
|
1601
|
+
if (active !== "global-styling" && spec) {
|
|
1602
|
+
if (tab === "variants") {
|
|
1603
|
+
this.renderVariantsMatrix(active, spec);
|
|
1604
|
+
} else if (tab === "edgecases") {
|
|
1605
|
+
this.renderEdgeCases(active, spec);
|
|
1606
|
+
}
|
|
1607
|
+
}
|
|
1608
|
+
});
|
|
1609
|
+
}
|
|
1610
|
+
renderVariantsMatrix(tag, config) {
|
|
1611
|
+
if (!this.variantsGrid)
|
|
1612
|
+
return;
|
|
1613
|
+
this.variantsGrid.innerHTML = "";
|
|
1614
|
+
const variants = config.variants;
|
|
1615
|
+
if (!variants || variants.length === 0) {
|
|
1616
|
+
this.variantsGrid.innerHTML = emptyState("No variant matrix defined for this component.");
|
|
1617
|
+
return;
|
|
1618
|
+
}
|
|
1619
|
+
variants.forEach((variant) => {
|
|
1620
|
+
const card = document.createElement("variant-card");
|
|
1621
|
+
card.tag = tag;
|
|
1622
|
+
card.item = variant;
|
|
1623
|
+
this.variantsGrid.appendChild(card);
|
|
1624
|
+
});
|
|
1625
|
+
}
|
|
1626
|
+
renderEdgeCases(tag, config) {
|
|
1627
|
+
if (!this.edgecasesGrid)
|
|
1628
|
+
return;
|
|
1629
|
+
this.edgecasesGrid.innerHTML = "";
|
|
1630
|
+
const edgeCases = config.edgeCases;
|
|
1631
|
+
if (!edgeCases || edgeCases.length === 0) {
|
|
1632
|
+
this.edgecasesGrid.innerHTML = emptyState("No stress-test layout edge cases defined for this component.");
|
|
1633
|
+
return;
|
|
1634
|
+
}
|
|
1635
|
+
edgeCases.forEach((edge) => {
|
|
1636
|
+
const card = document.createElement("variant-card");
|
|
1637
|
+
card.tag = tag;
|
|
1638
|
+
card.item = edge;
|
|
1639
|
+
this.edgecasesGrid.appendChild(card);
|
|
1640
|
+
});
|
|
1641
|
+
}
|
|
1642
|
+
disconnectedCallback() {
|
|
1643
|
+
if (this.cleanupEffect) {
|
|
1644
|
+
this.cleanupEffect();
|
|
1645
|
+
}
|
|
1646
|
+
}
|
|
1647
|
+
}
|
|
1648
|
+
customElements.define("sandbox-viewport", SandboxViewport);
|
|
1649
|
+
|
|
1650
|
+
// src/playground/components/playground-event-log/playground-event-log.css
|
|
1651
|
+
var playground_event_log_default = `.event-log-container {\r
|
|
1652
|
+
background: #0d1117;\r
|
|
1653
|
+
border: 1px solid #21262d;\r
|
|
1654
|
+
border-radius: var(--q-radius-lg);\r
|
|
1655
|
+
overflow: hidden;\r
|
|
1656
|
+
height: 100%;\r
|
|
1657
|
+
box-sizing: border-box;\r
|
|
1658
|
+
}\r
|
|
1659
|
+
\r
|
|
1660
|
+
.event-log-header {\r
|
|
1661
|
+
display: flex;\r
|
|
1662
|
+
justify-content: space-between;\r
|
|
1663
|
+
align-items: center;\r
|
|
1664
|
+
padding: 8px 16px;\r
|
|
1665
|
+
background: #161b22;\r
|
|
1666
|
+
border-bottom: 1px solid #21262d;\r
|
|
1667
|
+
font-size: 0.8rem;\r
|
|
1668
|
+
color: #8b949e;\r
|
|
1669
|
+
}\r
|
|
1670
|
+
\r
|
|
1671
|
+
.clear-log-btn {\r
|
|
1672
|
+
background: transparent;\r
|
|
1673
|
+
border: 1px solid #30363d;\r
|
|
1674
|
+
color: #c9d1d9;\r
|
|
1675
|
+
border-radius: 4px;\r
|
|
1676
|
+
padding: 2px 6px;\r
|
|
1677
|
+
font-size: 0.75rem;\r
|
|
1678
|
+
cursor: pointer;\r
|
|
1679
|
+
}\r
|
|
1680
|
+
\r
|
|
1681
|
+
.clear-log-btn:hover {\r
|
|
1682
|
+
background: #30363d;\r
|
|
1683
|
+
}\r
|
|
1684
|
+
\r
|
|
1685
|
+
.event-log-body {\r
|
|
1686
|
+
padding: 12px 16px;\r
|
|
1687
|
+
font-family: monospace;\r
|
|
1688
|
+
font-size: 0.8rem;\r
|
|
1689
|
+
display: flex;\r
|
|
1690
|
+
flex-direction: column;\r
|
|
1691
|
+
gap: 4px;\r
|
|
1692
|
+
min-height: 50px;\r
|
|
1693
|
+
}\r
|
|
1694
|
+
\r
|
|
1695
|
+
.log-placeholder {\r
|
|
1696
|
+
color: #57606a;\r
|
|
1697
|
+
font-style: italic;\r
|
|
1698
|
+
}\r
|
|
1699
|
+
\r
|
|
1700
|
+
.log-item {\r
|
|
1701
|
+
color: #57ab5a;\r
|
|
1702
|
+
word-break: break-all;\r
|
|
1703
|
+
}\r
|
|
1704
|
+
\r
|
|
1705
|
+
.log-item-time {\r
|
|
1706
|
+
color: #8b949e;\r
|
|
1707
|
+
margin-right: 8px;\r
|
|
1708
|
+
}\r
|
|
1709
|
+
`;
|
|
1710
|
+
|
|
1711
|
+
// src/playground/components/playground-event-log/playground-event-log.tsx
|
|
1712
|
+
class PlaygroundEventLog extends HTMLElement {
|
|
1713
|
+
logBody = null;
|
|
1714
|
+
syntaxBox = null;
|
|
1715
|
+
unsubscribeBus;
|
|
1716
|
+
connectedCallback() {
|
|
1717
|
+
this.innerHTML = "";
|
|
1718
|
+
this.appendChild(/* @__PURE__ */ h("q-syntax-box", {
|
|
1719
|
+
variant: "panel",
|
|
1720
|
+
heading: "Event Dispatches Log",
|
|
1721
|
+
id: "eventLogBox"
|
|
1722
|
+
}, /* @__PURE__ */ h("q-button", {
|
|
1723
|
+
slot: "actions",
|
|
1724
|
+
variant: "ghost",
|
|
1725
|
+
size: "sm",
|
|
1726
|
+
id: "clearLogBtn",
|
|
1727
|
+
onClick: () => this.clearLog()
|
|
1728
|
+
}, /* @__PURE__ */ h("q-icon", {
|
|
1729
|
+
slot: "icon-left",
|
|
1730
|
+
lib: "local",
|
|
1731
|
+
name: "trash-2",
|
|
1732
|
+
size: "sm"
|
|
1733
|
+
}), /* @__PURE__ */ h("q-tooltip", {
|
|
1734
|
+
slot: "icon-left",
|
|
1735
|
+
position: "bottom",
|
|
1736
|
+
content: "Clear Log"
|
|
1737
|
+
})), /* @__PURE__ */ h("div", {
|
|
1738
|
+
id: "eventLogBody",
|
|
1739
|
+
class: "event-log-body"
|
|
1740
|
+
}, /* @__PURE__ */ h("span", {
|
|
1741
|
+
class: "log-placeholder"
|
|
1742
|
+
}, "Interactive events will appear here in real-time..."))));
|
|
1743
|
+
const styleId = "playground-event-log-style";
|
|
1744
|
+
if (!document.getElementById(styleId)) {
|
|
1745
|
+
const style = document.createElement("style");
|
|
1746
|
+
style.id = styleId;
|
|
1747
|
+
style.textContent = playground_event_log_default;
|
|
1748
|
+
document.head.appendChild(style);
|
|
1749
|
+
}
|
|
1750
|
+
this.init();
|
|
1751
|
+
}
|
|
1752
|
+
init() {
|
|
1753
|
+
this.logBody = this.querySelector("#eventLogBody");
|
|
1754
|
+
this.syntaxBox = this.querySelector("#eventLogBox");
|
|
1755
|
+
this.unsubscribeBus = playgroundBus.on("event-dispatched", (data) => {
|
|
1756
|
+
this.logEvent(data.name, data.detail);
|
|
1757
|
+
});
|
|
1758
|
+
}
|
|
1759
|
+
logEvent(name, detail) {
|
|
1760
|
+
if (!this.logBody)
|
|
1761
|
+
return;
|
|
1762
|
+
const placeholder = this.logBody.querySelector(".log-placeholder");
|
|
1763
|
+
if (placeholder)
|
|
1764
|
+
placeholder.remove();
|
|
1765
|
+
const now = new Date;
|
|
1766
|
+
const ms = String(now.getMilliseconds()).padStart(3, "0");
|
|
1767
|
+
const timeStr = now.toTimeString().split(" ")[0] + "." + ms;
|
|
1768
|
+
const line = document.createElement("div");
|
|
1769
|
+
line.className = "log-item";
|
|
1770
|
+
line.innerHTML = `
|
|
1771
|
+
<span class="log-item-time">[${timeStr}]</span>
|
|
1772
|
+
<strong>${name}</strong>: ${detail !== undefined ? JSON.stringify(detail) : "<em>(void detail)</em>"}
|
|
1773
|
+
`;
|
|
1774
|
+
this.logBody.appendChild(line);
|
|
1775
|
+
if (this.syntaxBox && typeof this.syntaxBox.scrollToBottom === "function") {
|
|
1776
|
+
this.syntaxBox.scrollToBottom();
|
|
1777
|
+
}
|
|
1778
|
+
}
|
|
1779
|
+
clearLog() {
|
|
1780
|
+
if (this.logBody) {
|
|
1781
|
+
this.logBody.innerHTML = '<span class="log-placeholder">Interactive events will appear here in real-time...</span>';
|
|
1782
|
+
}
|
|
1783
|
+
}
|
|
1784
|
+
disconnectedCallback() {
|
|
1785
|
+
if (this.unsubscribeBus) {
|
|
1786
|
+
this.unsubscribeBus();
|
|
1787
|
+
}
|
|
1788
|
+
}
|
|
1789
|
+
}
|
|
1790
|
+
customElements.define("playground-event-log", PlaygroundEventLog);
|
|
1791
|
+
|
|
1792
|
+
// src/playground/components/playground-code-preview/playground-code-preview.css
|
|
1793
|
+
var playground_code_preview_default = `.code-preview-container {\r
|
|
1794
|
+
position: relative;\r
|
|
1795
|
+
border-radius: var(--q-radius-lg);\r
|
|
1796
|
+
background: #0d1117;\r
|
|
1797
|
+
border: 1px solid #21262d;\r
|
|
1798
|
+
overflow: hidden;\r
|
|
1799
|
+
height: 100%;\r
|
|
1800
|
+
box-sizing: border-box;\r
|
|
1801
|
+
}\r
|
|
1802
|
+
\r
|
|
1803
|
+
.code-preview-header {\r
|
|
1804
|
+
display: flex;\r
|
|
1805
|
+
justify-content: space-between;\r
|
|
1806
|
+
align-items: center;\r
|
|
1807
|
+
padding: 8px 16px;\r
|
|
1808
|
+
background: #161b22;\r
|
|
1809
|
+
border-bottom: 1px solid #21262d;\r
|
|
1810
|
+
font-size: 0.8rem;\r
|
|
1811
|
+
color: #8b949e;\r
|
|
1812
|
+
}\r
|
|
1813
|
+
\r
|
|
1814
|
+
.copy-btn {\r
|
|
1815
|
+
background: transparent;\r
|
|
1816
|
+
border: 1px solid #30363d;\r
|
|
1817
|
+
color: #c9d1d9;\r
|
|
1818
|
+
border-radius: 4px;\r
|
|
1819
|
+
padding: 4px 8px;\r
|
|
1820
|
+
font-size: 0.75rem;\r
|
|
1821
|
+
cursor: pointer;\r
|
|
1822
|
+
transition:\r
|
|
1823
|
+
background-color 0.2s,\r
|
|
1824
|
+
border-color 0.2s,\r
|
|
1825
|
+
color 0.2s;\r
|
|
1826
|
+
}\r
|
|
1827
|
+
\r
|
|
1828
|
+
.copy-btn:hover {\r
|
|
1829
|
+
background: #30363d;\r
|
|
1830
|
+
border-color: #8b949e;\r
|
|
1831
|
+
}\r
|
|
1832
|
+
\r
|
|
1833
|
+
.code-preview-body {\r
|
|
1834
|
+
margin: 0;\r
|
|
1835
|
+
padding: 16px;\r
|
|
1836
|
+
overflow-x: auto;\r
|
|
1837
|
+
font-family:\r
|
|
1838
|
+
ui-monospace,\r
|
|
1839
|
+
SFMono-Regular,\r
|
|
1840
|
+
SF Mono,\r
|
|
1841
|
+
Menlo,\r
|
|
1842
|
+
Consolas,\r
|
|
1843
|
+
Liberation Mono,\r
|
|
1844
|
+
monospace;\r
|
|
1845
|
+
font-size: 0.85rem;\r
|
|
1846
|
+
line-height: 1.5;\r
|
|
1847
|
+
color: #c9d1d9;\r
|
|
1848
|
+
}\r
|
|
1849
|
+
\r
|
|
1850
|
+
/* Syntax highlighting */\r
|
|
1851
|
+
.code-comment {\r
|
|
1852
|
+
color: #8b949e;\r
|
|
1853
|
+
font-style: italic;\r
|
|
1854
|
+
}\r
|
|
1855
|
+
.code-tag {\r
|
|
1856
|
+
color: #ff7b72;\r
|
|
1857
|
+
font-weight: 600;\r
|
|
1858
|
+
}\r
|
|
1859
|
+
.code-attr {\r
|
|
1860
|
+
color: #79c0ff;\r
|
|
1861
|
+
}\r
|
|
1862
|
+
.code-value {\r
|
|
1863
|
+
color: #a5d6ff;\r
|
|
1864
|
+
}\r
|
|
1865
|
+
`;
|
|
1866
|
+
|
|
1867
|
+
// src/playground/components/playground-code-preview/playground-code-preview.tsx
|
|
1868
|
+
class PlaygroundCodePreview extends HTMLElement {
|
|
1869
|
+
codeBlockBox = null;
|
|
1870
|
+
cleanupCodeEffect;
|
|
1871
|
+
connectedCallback() {
|
|
1872
|
+
this.innerHTML = "";
|
|
1873
|
+
this.appendChild(/* @__PURE__ */ h("q-syntax-box", {
|
|
1874
|
+
variant: "panel",
|
|
1875
|
+
heading: "LIVE RENDER MARKUP",
|
|
1876
|
+
copyable: "true",
|
|
1877
|
+
id: "codeBlockBox"
|
|
1878
|
+
}));
|
|
1879
|
+
const styleId = "playground-code-preview-style";
|
|
1880
|
+
if (!document.getElementById(styleId)) {
|
|
1881
|
+
const style = document.createElement("style");
|
|
1882
|
+
style.id = styleId;
|
|
1883
|
+
style.textContent = playground_code_preview_default;
|
|
1884
|
+
document.head.appendChild(style);
|
|
1885
|
+
}
|
|
1886
|
+
this.init();
|
|
1887
|
+
}
|
|
1888
|
+
init() {
|
|
1889
|
+
this.codeBlockBox = this.querySelector("#codeBlockBox");
|
|
1890
|
+
this.cleanupCodeEffect = effect(() => {
|
|
1891
|
+
const active = activeComponent();
|
|
1892
|
+
const registry = componentRegistry();
|
|
1893
|
+
const config = registry[active];
|
|
1894
|
+
if (config) {
|
|
1895
|
+
this.updateCodeBlock(active, config);
|
|
1896
|
+
}
|
|
1897
|
+
});
|
|
1898
|
+
}
|
|
1899
|
+
updateCodeBlock(tag, config) {
|
|
1900
|
+
if (!this.codeBlockBox || !config)
|
|
1901
|
+
return;
|
|
1902
|
+
const appendScript = tag === "q-dropdown" && config.options ? `
|
|
1903
|
+
|
|
1904
|
+
<!-- Programmatic dropdown options population script -->
|
|
1905
|
+
<script>
|
|
1906
|
+
const dropdown = document.querySelector('${tag}');
|
|
1907
|
+
dropdown.options = ${JSON.stringify(config.options, null, 2).replace(/\n/g, `
|
|
1908
|
+
`)};
|
|
1909
|
+
</script>` : null;
|
|
1910
|
+
this.codeBlockBox.code = serializeComponentCode(tag, config.props, config.slots, appendScript);
|
|
1911
|
+
}
|
|
1912
|
+
disconnectedCallback() {
|
|
1913
|
+
if (this.cleanupCodeEffect) {
|
|
1914
|
+
this.cleanupCodeEffect();
|
|
1915
|
+
}
|
|
1916
|
+
}
|
|
1917
|
+
}
|
|
1918
|
+
customElements.define("playground-code-preview", PlaygroundCodePreview);
|
|
1919
|
+
|
|
1920
|
+
// src/playground/components/properties-panel/property-row.tsx
|
|
1921
|
+
var CONTROL_FACTORY = {
|
|
1922
|
+
boolean: (propName, prop) => /* @__PURE__ */ h("q-toggle", {
|
|
1923
|
+
type: "switch",
|
|
1924
|
+
size: "sm",
|
|
1925
|
+
"data-prop": propName,
|
|
1926
|
+
checked: prop.currentValue,
|
|
1927
|
+
onQChange: (e) => updateKnobValue("prop", propName, e.detail)
|
|
1928
|
+
}),
|
|
1929
|
+
select: (propName, prop) => {
|
|
1930
|
+
const options = prop.options ? prop.options.map((opt) => ({ label: opt || "(none)", value: opt })) : [];
|
|
1931
|
+
const dropdown = /* @__PURE__ */ h("q-dropdown", {
|
|
1932
|
+
size: "sm",
|
|
1933
|
+
"data-prop": propName,
|
|
1934
|
+
value: prop.currentValue,
|
|
1935
|
+
onQChange: (e) => updateKnobValue("prop", propName, e.detail)
|
|
1936
|
+
});
|
|
1937
|
+
dropdown.options = options;
|
|
1938
|
+
return dropdown;
|
|
1939
|
+
},
|
|
1940
|
+
number: (propName, prop) => /* @__PURE__ */ h("q-input", {
|
|
1941
|
+
type: "number",
|
|
1942
|
+
size: "sm",
|
|
1943
|
+
"data-prop": propName,
|
|
1944
|
+
value: prop.currentValue,
|
|
1945
|
+
onQInput: (e) => updateKnobValue("prop", propName, e.detail)
|
|
1946
|
+
})
|
|
1947
|
+
};
|
|
1948
|
+
function createPropControl(propName, prop) {
|
|
1949
|
+
const factory = CONTROL_FACTORY[prop.type];
|
|
1950
|
+
if (factory)
|
|
1951
|
+
return factory(propName, prop);
|
|
1952
|
+
return /* @__PURE__ */ h("q-input", {
|
|
1953
|
+
type: "text",
|
|
1954
|
+
size: "sm",
|
|
1955
|
+
"data-prop": propName,
|
|
1956
|
+
value: prop.currentValue,
|
|
1957
|
+
onQInput: (e) => updateKnobValue("prop", propName, e.detail)
|
|
1958
|
+
});
|
|
1959
|
+
}
|
|
1960
|
+
|
|
1961
|
+
class PropertyRow extends HTMLElement {
|
|
1962
|
+
propName;
|
|
1963
|
+
prop;
|
|
1964
|
+
connectedCallback() {
|
|
1965
|
+
if (!this.propName || !this.prop)
|
|
1966
|
+
return;
|
|
1967
|
+
this.className = "property-row";
|
|
1968
|
+
this.innerHTML = "";
|
|
1969
|
+
this.appendChild(/* @__PURE__ */ h("div", {
|
|
1970
|
+
class: "property-meta"
|
|
1971
|
+
}, /* @__PURE__ */ h("span", {
|
|
1972
|
+
class: "property-label"
|
|
1973
|
+
}, this.propName), /* @__PURE__ */ h("span", {
|
|
1974
|
+
class: "property-label-sub"
|
|
1975
|
+
}, this.prop.description || "")));
|
|
1976
|
+
this.appendChild(/* @__PURE__ */ h("div", {
|
|
1977
|
+
class: "property-control-container"
|
|
1978
|
+
}, createPropControl(this.propName, this.prop)));
|
|
1979
|
+
}
|
|
1980
|
+
}
|
|
1981
|
+
customElements.define("property-row", PropertyRow);
|
|
1982
|
+
|
|
1983
|
+
// src/playground/components/properties-panel/slot-row.tsx
|
|
1984
|
+
class SlotRow extends HTMLElement {
|
|
1985
|
+
slotName;
|
|
1986
|
+
slotConfig;
|
|
1987
|
+
activeComponentTag;
|
|
1988
|
+
connectedCallback() {
|
|
1989
|
+
if (!this.slotName || !this.slotConfig)
|
|
1990
|
+
return;
|
|
1991
|
+
this.className = "property-row vertical";
|
|
1992
|
+
this.innerHTML = "";
|
|
1993
|
+
const labelText = this.slotName === "default" ? "default (Inner content)" : `slot="${this.slotName}"`;
|
|
1994
|
+
this.appendChild(/* @__PURE__ */ h("div", {
|
|
1995
|
+
class: "property-meta"
|
|
1996
|
+
}, /* @__PURE__ */ h("span", {
|
|
1997
|
+
class: "property-label"
|
|
1998
|
+
}, labelText), /* @__PURE__ */ h("span", {
|
|
1999
|
+
class: "property-label-sub"
|
|
2000
|
+
}, this.slotConfig.description || "")));
|
|
2001
|
+
let inputControl;
|
|
2002
|
+
if (this.activeComponentTag === "q-data-table" && this.slotName === "footer") {
|
|
2003
|
+
inputControl = /* @__PURE__ */ h("q-syntax-box", {
|
|
2004
|
+
editable: true,
|
|
2005
|
+
language: "html",
|
|
2006
|
+
height: "110px",
|
|
2007
|
+
"data-slot": this.slotName,
|
|
2008
|
+
value: this.slotConfig.currentValue,
|
|
2009
|
+
onQInput: (e) => updateKnobValue("slot", this.slotName, e.detail)
|
|
2010
|
+
});
|
|
2011
|
+
} else if (this.slotConfig.description && (this.slotConfig.description.includes("textarea") || this.slotConfig.description.includes("html"))) {
|
|
2012
|
+
inputControl = /* @__PURE__ */ h("q-textarea", {
|
|
2013
|
+
rows: 4,
|
|
2014
|
+
"data-slot": this.slotName,
|
|
2015
|
+
value: this.slotConfig.currentValue,
|
|
2016
|
+
onQInput: (e) => updateKnobValue("slot", this.slotName, e.detail)
|
|
2017
|
+
});
|
|
2018
|
+
} else {
|
|
2019
|
+
inputControl = /* @__PURE__ */ h("q-input", {
|
|
2020
|
+
type: "text",
|
|
2021
|
+
"data-slot": this.slotName,
|
|
2022
|
+
value: this.slotConfig.currentValue,
|
|
2023
|
+
onQInput: (e) => updateKnobValue("slot", this.slotName, e.detail)
|
|
2024
|
+
});
|
|
2025
|
+
}
|
|
2026
|
+
this.appendChild(inputControl);
|
|
2027
|
+
}
|
|
2028
|
+
}
|
|
2029
|
+
customElements.define("slot-row", SlotRow);
|
|
2030
|
+
|
|
2031
|
+
// src/playground/components/properties-panel/properties-panel.css
|
|
2032
|
+
var properties_panel_default = `.properties-panel {
|
|
2033
|
+
width: 340px;
|
|
2034
|
+
background: var(--bg-sidebar);
|
|
2035
|
+
border-left: 1px solid var(--border-color);
|
|
2036
|
+
flex-shrink: 0;
|
|
2037
|
+
display: flex;
|
|
2038
|
+
flex-direction: column;
|
|
2039
|
+
height: 100%;
|
|
2040
|
+
}
|
|
2041
|
+
|
|
2042
|
+
.properties-scroll-content {
|
|
2043
|
+
padding: 20px;
|
|
2044
|
+
display: flex;
|
|
2045
|
+
flex-direction: column;
|
|
2046
|
+
gap: 24px;
|
|
2047
|
+
box-sizing: border-box;
|
|
2048
|
+
}
|
|
2049
|
+
|
|
2050
|
+
.properties-section-title {
|
|
2051
|
+
font-size: 0.8rem;
|
|
2052
|
+
text-transform: uppercase;
|
|
2053
|
+
letter-spacing: 0.05em;
|
|
2054
|
+
color: var(--text-muted);
|
|
2055
|
+
border-bottom: 1px solid var(--border-color);
|
|
2056
|
+
padding-bottom: 8px;
|
|
2057
|
+
margin: 0 0 12px 0;
|
|
2058
|
+
}
|
|
2059
|
+
|
|
2060
|
+
.property-row {
|
|
2061
|
+
display: flex;
|
|
2062
|
+
align-items: center;
|
|
2063
|
+
justify-content: space-between;
|
|
2064
|
+
padding: 8px 0;
|
|
2065
|
+
gap: 12px;
|
|
2066
|
+
border-bottom: 1px dashed rgba(255, 255, 255, 0.04);
|
|
2067
|
+
}
|
|
2068
|
+
|
|
2069
|
+
.property-row.vertical {
|
|
2070
|
+
flex-direction: column;
|
|
2071
|
+
align-items: flex-start;
|
|
2072
|
+
}
|
|
2073
|
+
|
|
2074
|
+
.property-meta {
|
|
2075
|
+
flex: 1;
|
|
2076
|
+
min-width: 0;
|
|
2077
|
+
}
|
|
2078
|
+
|
|
2079
|
+
.property-control-container {
|
|
2080
|
+
flex: 1;
|
|
2081
|
+
display: flex;
|
|
2082
|
+
justify-content: flex-end;
|
|
2083
|
+
min-width: 0;
|
|
2084
|
+
}
|
|
2085
|
+
|
|
2086
|
+
.property-label {
|
|
2087
|
+
font-size: 0.85rem;
|
|
2088
|
+
font-weight: 500;
|
|
2089
|
+
color: var(--text-main);
|
|
2090
|
+
}
|
|
2091
|
+
|
|
2092
|
+
.property-label-sub {
|
|
2093
|
+
font-size: 0.7rem;
|
|
2094
|
+
color: var(--text-muted);
|
|
2095
|
+
display: block;
|
|
2096
|
+
margin-top: 2px;
|
|
2097
|
+
}
|
|
2098
|
+
|
|
2099
|
+
.properties-panel-header {
|
|
2100
|
+
display: none;
|
|
2101
|
+
}
|
|
2102
|
+
|
|
2103
|
+
.properties-toggle-btn {
|
|
2104
|
+
display: none;
|
|
2105
|
+
position: fixed;
|
|
2106
|
+
bottom: 24px;
|
|
2107
|
+
right: 24px;
|
|
2108
|
+
background: linear-gradient(135deg, var(--primary) 0%, #2563eb 100%);
|
|
2109
|
+
color: white;
|
|
2110
|
+
border: none;
|
|
2111
|
+
border-radius: 50px;
|
|
2112
|
+
padding: 12px 20px;
|
|
2113
|
+
font-weight: 600;
|
|
2114
|
+
font-size: 0.9rem;
|
|
2115
|
+
cursor: pointer;
|
|
2116
|
+
box-shadow: 0 4px 20px rgba(37, 99, 235, 0.4);
|
|
2117
|
+
align-items: center;
|
|
2118
|
+
gap: 8px;
|
|
2119
|
+
z-index: 998;
|
|
2120
|
+
transition:
|
|
2121
|
+
transform 0.2s,
|
|
2122
|
+
box-shadow 0.2s;
|
|
2123
|
+
}
|
|
2124
|
+
|
|
2125
|
+
.properties-toggle-btn:hover {
|
|
2126
|
+
transform: translateY(-2px);
|
|
2127
|
+
box-shadow: 0 6px 24px rgba(37, 99, 235, 0.5);
|
|
2128
|
+
}
|
|
2129
|
+
|
|
2130
|
+
.properties-toggle-btn:active {
|
|
2131
|
+
transform: translateY(0);
|
|
2132
|
+
}
|
|
2133
|
+
|
|
2134
|
+
.properties-toggle-icon {
|
|
2135
|
+
font-size: 1rem;
|
|
2136
|
+
}
|
|
2137
|
+
|
|
2138
|
+
/* Custom WebQuark Component Properties Layout */
|
|
2139
|
+
.property-row:not(.vertical) q-dropdown,
|
|
2140
|
+
.property-row:not(.vertical) q-input {
|
|
2141
|
+
width: 100% !important;
|
|
2142
|
+
display: block !important;
|
|
2143
|
+
min-width: 0 !important;
|
|
2144
|
+
}
|
|
2145
|
+
|
|
2146
|
+
.property-row.vertical q-input,
|
|
2147
|
+
.property-row.vertical q-textarea,
|
|
2148
|
+
.property-row.vertical q-syntax-box {
|
|
2149
|
+
width: 100%;
|
|
2150
|
+
max-width: 100%;
|
|
2151
|
+
box-sizing: border-box;
|
|
2152
|
+
margin-top: 6px;
|
|
2153
|
+
display: block;
|
|
2154
|
+
}
|
|
2155
|
+
|
|
2156
|
+
/* Mobile properties panel overrides */
|
|
2157
|
+
@media (max-width: 900px) {
|
|
2158
|
+
.properties-panel {
|
|
2159
|
+
position: fixed;
|
|
2160
|
+
bottom: 0;
|
|
2161
|
+
left: 0;
|
|
2162
|
+
right: 0;
|
|
2163
|
+
height: 60vh;
|
|
2164
|
+
width: 100%;
|
|
2165
|
+
z-index: 1000;
|
|
2166
|
+
transform: translateY(100%);
|
|
2167
|
+
transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
|
|
2168
|
+
background: var(--bg-sidebar);
|
|
2169
|
+
border-left: none;
|
|
2170
|
+
border-top: 1px solid var(--border-color);
|
|
2171
|
+
box-shadow: 0 -10px 25px rgba(0, 0, 0, 0.3);
|
|
2172
|
+
box-sizing: border-box;
|
|
2173
|
+
display: flex;
|
|
2174
|
+
flex-direction: column;
|
|
2175
|
+
}
|
|
2176
|
+
|
|
2177
|
+
.properties-panel.open {
|
|
2178
|
+
transform: translateY(0);
|
|
2179
|
+
}
|
|
2180
|
+
|
|
2181
|
+
.properties-section {
|
|
2182
|
+
flex: none;
|
|
2183
|
+
}
|
|
2184
|
+
|
|
2185
|
+
.properties-panel-header {
|
|
2186
|
+
display: flex;
|
|
2187
|
+
align-items: center;
|
|
2188
|
+
justify-content: space-between;
|
|
2189
|
+
padding-bottom: 12px;
|
|
2190
|
+
border-bottom: 1px solid var(--border-color);
|
|
2191
|
+
margin-bottom: 8px;
|
|
2192
|
+
gap: 16px;
|
|
2193
|
+
}
|
|
2194
|
+
|
|
2195
|
+
.properties-panel-header span {
|
|
2196
|
+
font-weight: 700;
|
|
2197
|
+
font-size: 1rem;
|
|
2198
|
+
color: var(--text-main);
|
|
2199
|
+
flex-shrink: 1;
|
|
2200
|
+
min-width: 0;
|
|
2201
|
+
overflow: hidden;
|
|
2202
|
+
text-overflow: ellipsis;
|
|
2203
|
+
white-space: nowrap;
|
|
2204
|
+
}
|
|
2205
|
+
|
|
2206
|
+
.properties-close-btn {
|
|
2207
|
+
background: transparent;
|
|
2208
|
+
border: none;
|
|
2209
|
+
color: var(--text-main);
|
|
2210
|
+
font-size: 1.5rem;
|
|
2211
|
+
cursor: pointer;
|
|
2212
|
+
padding: 4px 8px;
|
|
2213
|
+
line-height: 1;
|
|
2214
|
+
display: flex;
|
|
2215
|
+
align-items: center;
|
|
2216
|
+
justify-content: center;
|
|
2217
|
+
flex-shrink: 0;
|
|
2218
|
+
}
|
|
2219
|
+
|
|
2220
|
+
.properties-toggle-btn {
|
|
2221
|
+
display: flex;
|
|
2222
|
+
}
|
|
2223
|
+
}
|
|
2224
|
+
|
|
2225
|
+
.property-empty-state {
|
|
2226
|
+
color: var(--text-muted);
|
|
2227
|
+
font-size: 0.85rem;
|
|
2228
|
+
}
|
|
2229
|
+
`;
|
|
2230
|
+
|
|
2231
|
+
// src/playground/components/properties-panel/properties-panel.tsx
|
|
2232
|
+
class PropertiesPanel extends HTMLElement {
|
|
2233
|
+
panel = null;
|
|
2234
|
+
attrContainer = null;
|
|
2235
|
+
slotContainer = null;
|
|
2236
|
+
cleanupEffect;
|
|
2237
|
+
lastActiveComponent = null;
|
|
2238
|
+
connectedCallback() {
|
|
2239
|
+
this.innerHTML = "";
|
|
2240
|
+
const toggleBtn = /* @__PURE__ */ h("button", {
|
|
2241
|
+
class: "properties-toggle-btn",
|
|
2242
|
+
id: "propertiesToggleBtn",
|
|
2243
|
+
type: "button",
|
|
2244
|
+
onClick: () => this.openPanel()
|
|
2245
|
+
}, /* @__PURE__ */ h("span", {
|
|
2246
|
+
class: "properties-toggle-icon"
|
|
2247
|
+
}, "⚙️"), /* @__PURE__ */ h("span", null, "Properties"));
|
|
2248
|
+
const closeBtn = /* @__PURE__ */ h("button", {
|
|
2249
|
+
class: "properties-close-btn",
|
|
2250
|
+
id: "propertiesCloseBtn",
|
|
2251
|
+
type: "button",
|
|
2252
|
+
onClick: () => this.closePanel()
|
|
2253
|
+
}, "×");
|
|
2254
|
+
this.panel = /* @__PURE__ */ h("aside", {
|
|
2255
|
+
class: "properties-panel",
|
|
2256
|
+
id: "propertiesPanel"
|
|
2257
|
+
}, /* @__PURE__ */ h("q-scrollable", {
|
|
2258
|
+
height: "100%"
|
|
2259
|
+
}, /* @__PURE__ */ h("div", {
|
|
2260
|
+
class: "properties-scroll-content"
|
|
2261
|
+
}, /* @__PURE__ */ h("div", {
|
|
2262
|
+
class: "properties-panel-header"
|
|
2263
|
+
}, /* @__PURE__ */ h("span", null, "Component Properties"), closeBtn), /* @__PURE__ */ h("div", {
|
|
2264
|
+
class: "properties-section"
|
|
2265
|
+
}, /* @__PURE__ */ h("h3", {
|
|
2266
|
+
class: "properties-section-title"
|
|
2267
|
+
}, "Properties"), /* @__PURE__ */ h("div", {
|
|
2268
|
+
id: "attributeProperties"
|
|
2269
|
+
})), /* @__PURE__ */ h("div", {
|
|
2270
|
+
class: "properties-section",
|
|
2271
|
+
style: "margin-top: 10px;"
|
|
2272
|
+
}, /* @__PURE__ */ h("h3", {
|
|
2273
|
+
class: "properties-section-title"
|
|
2274
|
+
}, "Slots (Content)"), /* @__PURE__ */ h("div", {
|
|
2275
|
+
id: "slotProperties"
|
|
2276
|
+
})))));
|
|
2277
|
+
this.appendChild(toggleBtn);
|
|
2278
|
+
this.appendChild(this.panel);
|
|
2279
|
+
const styleId = "properties-panel-style";
|
|
2280
|
+
let style = document.getElementById(styleId);
|
|
2281
|
+
if (!style) {
|
|
2282
|
+
style = document.createElement("style");
|
|
2283
|
+
style.id = styleId;
|
|
2284
|
+
document.head.appendChild(style);
|
|
2285
|
+
}
|
|
2286
|
+
style.textContent = properties_panel_default;
|
|
2287
|
+
this.init(toggleBtn);
|
|
2288
|
+
}
|
|
2289
|
+
init(toggleBtn) {
|
|
2290
|
+
this.attrContainer = this.querySelector("#attributeProperties");
|
|
2291
|
+
this.slotContainer = this.querySelector("#slotProperties");
|
|
2292
|
+
this.cleanupEffect = effect(() => {
|
|
2293
|
+
const active = activeComponent();
|
|
2294
|
+
const tab = activeTab();
|
|
2295
|
+
const registry = componentRegistry();
|
|
2296
|
+
const config = registry[active];
|
|
2297
|
+
if (active === "global-styling" || tab !== "sandbox") {
|
|
2298
|
+
this.style.display = "none";
|
|
2299
|
+
toggleBtn.style.display = "none";
|
|
2300
|
+
if (this.panel)
|
|
2301
|
+
this.panel.classList.remove("open");
|
|
2302
|
+
return;
|
|
2303
|
+
}
|
|
2304
|
+
this.style.display = "";
|
|
2305
|
+
toggleBtn.style.display = "";
|
|
2306
|
+
if (config) {
|
|
2307
|
+
this.buildProperties(config, active);
|
|
2308
|
+
}
|
|
2309
|
+
});
|
|
2310
|
+
}
|
|
2311
|
+
buildProperties(config, active) {
|
|
2312
|
+
if (!this.attrContainer || !this.slotContainer)
|
|
2313
|
+
return;
|
|
2314
|
+
if (this.lastActiveComponent !== active) {
|
|
2315
|
+
this.attrContainer.innerHTML = "";
|
|
2316
|
+
if (config.props && Object.keys(config.props).length > 0) {
|
|
2317
|
+
Object.keys(config.props).forEach((propName) => {
|
|
2318
|
+
if (config.props) {
|
|
2319
|
+
const prop = config.props[propName];
|
|
2320
|
+
const row = document.createElement("property-row");
|
|
2321
|
+
row.propName = propName;
|
|
2322
|
+
row.prop = prop;
|
|
2323
|
+
this.attrContainer.appendChild(row);
|
|
2324
|
+
}
|
|
2325
|
+
});
|
|
2326
|
+
} else {
|
|
2327
|
+
this.attrContainer.appendChild(/* @__PURE__ */ h("div", {
|
|
2328
|
+
class: "property-empty-state"
|
|
2329
|
+
}, "No customizable attributes."));
|
|
2330
|
+
}
|
|
2331
|
+
} else {
|
|
2332
|
+
if (config.props) {
|
|
2333
|
+
Object.keys(config.props).forEach((propName) => {
|
|
2334
|
+
const prop = config.props[propName];
|
|
2335
|
+
const control = this.attrContainer.querySelector(`[data-prop="${propName}"]`);
|
|
2336
|
+
if (control) {
|
|
2337
|
+
if (prop.type === "boolean") {
|
|
2338
|
+
if (control.checked !== prop.currentValue) {
|
|
2339
|
+
control.checked = prop.currentValue;
|
|
2340
|
+
}
|
|
2341
|
+
} else {
|
|
2342
|
+
if (control.value !== prop.currentValue && document.activeElement !== control) {
|
|
2343
|
+
control.value = prop.currentValue;
|
|
2344
|
+
}
|
|
2345
|
+
}
|
|
2346
|
+
}
|
|
2347
|
+
});
|
|
2348
|
+
}
|
|
2349
|
+
}
|
|
2350
|
+
if (this.lastActiveComponent !== active) {
|
|
2351
|
+
this.slotContainer.innerHTML = "";
|
|
2352
|
+
if (config.slots && Object.keys(config.slots).length > 0) {
|
|
2353
|
+
Object.keys(config.slots).forEach((slotName) => {
|
|
2354
|
+
if (config.slots) {
|
|
2355
|
+
const slot = config.slots[slotName];
|
|
2356
|
+
const row = document.createElement("slot-row");
|
|
2357
|
+
row.slotName = slotName;
|
|
2358
|
+
row.slotConfig = slot;
|
|
2359
|
+
row.activeComponentTag = active;
|
|
2360
|
+
this.slotContainer.appendChild(row);
|
|
2361
|
+
}
|
|
2362
|
+
});
|
|
2363
|
+
} else {
|
|
2364
|
+
this.slotContainer.appendChild(/* @__PURE__ */ h("div", {
|
|
2365
|
+
class: "property-empty-state"
|
|
2366
|
+
}, "No slot options configured."));
|
|
2367
|
+
}
|
|
2368
|
+
} else {
|
|
2369
|
+
if (config.slots) {
|
|
2370
|
+
Object.keys(config.slots).forEach((slotName) => {
|
|
2371
|
+
const slot = config.slots[slotName];
|
|
2372
|
+
const control = this.slotContainer.querySelector(`[data-slot="${slotName}"]`);
|
|
2373
|
+
if (control) {
|
|
2374
|
+
if (control.value !== slot.currentValue && document.activeElement !== control) {
|
|
2375
|
+
control.value = slot.currentValue;
|
|
2376
|
+
}
|
|
2377
|
+
}
|
|
2378
|
+
});
|
|
2379
|
+
}
|
|
2380
|
+
}
|
|
2381
|
+
this.lastActiveComponent = active;
|
|
2382
|
+
}
|
|
2383
|
+
openPanel() {
|
|
2384
|
+
if (this.panel)
|
|
2385
|
+
this.panel.classList.add("open");
|
|
2386
|
+
}
|
|
2387
|
+
closePanel() {
|
|
2388
|
+
if (this.panel)
|
|
2389
|
+
this.panel.classList.remove("open");
|
|
2390
|
+
}
|
|
2391
|
+
disconnectedCallback() {
|
|
2392
|
+
if (this.cleanupEffect) {
|
|
2393
|
+
this.cleanupEffect();
|
|
2394
|
+
}
|
|
2395
|
+
}
|
|
2396
|
+
}
|
|
2397
|
+
customElements.define("properties-panel", PropertiesPanel);
|
|
2398
|
+
|
|
2399
|
+
// src/playground/components/theme-designer/token-row.tsx
|
|
2400
|
+
class TokenRow extends HTMLElement {
|
|
2401
|
+
token;
|
|
2402
|
+
syncValue() {
|
|
2403
|
+
const computedStyle = window.getComputedStyle(document.documentElement);
|
|
2404
|
+
const val = computedStyle.getPropertyValue(this.token.name).trim();
|
|
2405
|
+
if (this.token.type === "color") {
|
|
2406
|
+
const hexVal = convertToHex(val);
|
|
2407
|
+
const picker = this.querySelector(".color-swatch-picker");
|
|
2408
|
+
const textInput = this.querySelector(".color-text-input");
|
|
2409
|
+
if (picker)
|
|
2410
|
+
picker.value = hexVal;
|
|
2411
|
+
if (textInput)
|
|
2412
|
+
textInput.value = hexVal;
|
|
2413
|
+
} else if (this.token.type === "radius") {
|
|
2414
|
+
const numVal = parseInt(val, 10) || 0;
|
|
2415
|
+
const slider = this.querySelector(".range-slider-input");
|
|
2416
|
+
const display = this.querySelector(".range-slider-value");
|
|
2417
|
+
if (slider)
|
|
2418
|
+
slider.value = String(numVal);
|
|
2419
|
+
if (display)
|
|
2420
|
+
display.innerText = `${numVal}px`;
|
|
2421
|
+
}
|
|
2422
|
+
}
|
|
2423
|
+
connectedCallback() {
|
|
2424
|
+
if (!this.token)
|
|
2425
|
+
return;
|
|
2426
|
+
this.className = "token-row";
|
|
2427
|
+
this.innerHTML = "";
|
|
2428
|
+
const computedStyle = window.getComputedStyle(document.documentElement);
|
|
2429
|
+
const val = computedStyle.getPropertyValue(this.token.name).trim();
|
|
2430
|
+
let control;
|
|
2431
|
+
if (this.token.type === "color") {
|
|
2432
|
+
const hexVal = convertToHex(val);
|
|
2433
|
+
const picker = /* @__PURE__ */ h("input", {
|
|
2434
|
+
type: "color",
|
|
2435
|
+
class: "color-swatch-picker",
|
|
2436
|
+
"data-token": this.token.name,
|
|
2437
|
+
value: hexVal,
|
|
2438
|
+
onInput: (e) => {
|
|
2439
|
+
const target = e.target;
|
|
2440
|
+
const textInput2 = this.querySelector(".color-text-input");
|
|
2441
|
+
if (textInput2)
|
|
2442
|
+
textInput2.value = target.value;
|
|
2443
|
+
document.documentElement.style.setProperty(this.token.name, target.value);
|
|
2444
|
+
}
|
|
2445
|
+
});
|
|
2446
|
+
const textInput = /* @__PURE__ */ h("input", {
|
|
2447
|
+
type: "text",
|
|
2448
|
+
class: "color-text-input",
|
|
2449
|
+
"data-token": this.token.name,
|
|
2450
|
+
value: hexVal,
|
|
2451
|
+
onInput: (e) => {
|
|
2452
|
+
const target = e.target;
|
|
2453
|
+
const newColor = target.value;
|
|
2454
|
+
if (/^#[0-9A-F]{6}$/i.test(newColor)) {
|
|
2455
|
+
const pickerEl = this.querySelector(".color-swatch-picker");
|
|
2456
|
+
if (pickerEl)
|
|
2457
|
+
pickerEl.value = newColor;
|
|
2458
|
+
document.documentElement.style.setProperty(this.token.name, newColor);
|
|
2459
|
+
}
|
|
2460
|
+
}
|
|
2461
|
+
});
|
|
2462
|
+
control = /* @__PURE__ */ h("div", {
|
|
2463
|
+
class: "color-input-container"
|
|
2464
|
+
}, /* @__PURE__ */ h("div", {
|
|
2465
|
+
class: "color-picker-wrapper"
|
|
2466
|
+
}, picker), textInput);
|
|
2467
|
+
} else {
|
|
2468
|
+
const numVal = parseInt(val, 10) || 0;
|
|
2469
|
+
const valDisplay = /* @__PURE__ */ h("span", {
|
|
2470
|
+
class: "range-slider-value",
|
|
2471
|
+
"data-token": this.token.name
|
|
2472
|
+
}, numVal, "px");
|
|
2473
|
+
const slider = /* @__PURE__ */ h("input", {
|
|
2474
|
+
type: "range",
|
|
2475
|
+
class: "range-slider-input",
|
|
2476
|
+
min: String(this.token.min ?? 0),
|
|
2477
|
+
max: String(this.token.max ?? 40),
|
|
2478
|
+
value: String(numVal),
|
|
2479
|
+
"data-token": this.token.name,
|
|
2480
|
+
onInput: (e) => {
|
|
2481
|
+
const target = e.target;
|
|
2482
|
+
valDisplay.innerText = `${target.value}px`;
|
|
2483
|
+
document.documentElement.style.setProperty(this.token.name, `${target.value}px`);
|
|
2484
|
+
}
|
|
2485
|
+
});
|
|
2486
|
+
control = /* @__PURE__ */ h("div", {
|
|
2487
|
+
class: "range-slider-container"
|
|
2488
|
+
}, slider, valDisplay);
|
|
2489
|
+
}
|
|
2490
|
+
this.appendChild(/* @__PURE__ */ h("div", {
|
|
2491
|
+
class: "token-info"
|
|
2492
|
+
}, /* @__PURE__ */ h("span", {
|
|
2493
|
+
class: "token-label"
|
|
2494
|
+
}, this.token.label), /* @__PURE__ */ h("span", {
|
|
2495
|
+
class: "token-desc"
|
|
2496
|
+
}, this.token.desc)));
|
|
2497
|
+
this.appendChild(/* @__PURE__ */ h("div", {
|
|
2498
|
+
class: "token-control-wrapper"
|
|
2499
|
+
}, control));
|
|
2500
|
+
}
|
|
2501
|
+
}
|
|
2502
|
+
customElements.define("token-row", TokenRow);
|
|
2503
|
+
|
|
2504
|
+
// src/playground/components/theme-designer/token-section.tsx
|
|
2505
|
+
class TokenSection extends HTMLElement {
|
|
2506
|
+
categoryName;
|
|
2507
|
+
tokens;
|
|
2508
|
+
connectedCallback() {
|
|
2509
|
+
if (!this.categoryName || !this.tokens)
|
|
2510
|
+
return;
|
|
2511
|
+
this.className = "theme-section-card";
|
|
2512
|
+
this.innerHTML = "";
|
|
2513
|
+
this.appendChild(/* @__PURE__ */ h("h3", null, this.categoryName));
|
|
2514
|
+
this.tokens.forEach((token) => {
|
|
2515
|
+
const row = document.createElement("token-row");
|
|
2516
|
+
row.token = token;
|
|
2517
|
+
this.appendChild(row);
|
|
2518
|
+
});
|
|
2519
|
+
}
|
|
2520
|
+
}
|
|
2521
|
+
customElements.define("token-section", TokenSection);
|
|
2522
|
+
|
|
2523
|
+
// src/playground/components/theme-designer/theme-designer.css
|
|
2524
|
+
var theme_designer_default = `.theme-designer-container {
|
|
2525
|
+
padding: 32px 24px;
|
|
2526
|
+
max-width: 1000px;
|
|
2527
|
+
margin: 0 auto;
|
|
2528
|
+
}
|
|
2529
|
+
|
|
2530
|
+
.theme-designer-header {
|
|
2531
|
+
display: flex;
|
|
2532
|
+
align-items: center;
|
|
2533
|
+
justify-content: space-between;
|
|
2534
|
+
margin-bottom: 8px;
|
|
2535
|
+
flex-wrap: wrap;
|
|
2536
|
+
gap: 16px;
|
|
2537
|
+
}
|
|
2538
|
+
|
|
2539
|
+
.theme-designer-header h2 {
|
|
2540
|
+
font-size: 1.75rem;
|
|
2541
|
+
font-weight: 700;
|
|
2542
|
+
margin: 0;
|
|
2543
|
+
background: linear-gradient(135deg, var(--text-main) 30%, var(--primary) 100%);
|
|
2544
|
+
-webkit-background-clip: text;
|
|
2545
|
+
-webkit-text-fill-color: transparent;
|
|
2546
|
+
}
|
|
2547
|
+
|
|
2548
|
+
.theme-designer-desc {
|
|
2549
|
+
font-size: 0.95rem;
|
|
2550
|
+
color: var(--text-muted);
|
|
2551
|
+
margin: 0 0 32px 0;
|
|
2552
|
+
line-height: 1.5;
|
|
2553
|
+
}
|
|
2554
|
+
|
|
2555
|
+
.reset-theme-btn {
|
|
2556
|
+
display: flex;
|
|
2557
|
+
align-items: center;
|
|
2558
|
+
gap: 8px;
|
|
2559
|
+
background: transparent;
|
|
2560
|
+
border: 1px solid var(--border-color);
|
|
2561
|
+
color: var(--text-main);
|
|
2562
|
+
padding: 8px 16px;
|
|
2563
|
+
border-radius: var(--q-radius-md, 8px);
|
|
2564
|
+
font-size: 0.85rem;
|
|
2565
|
+
font-weight: 600;
|
|
2566
|
+
cursor: pointer;
|
|
2567
|
+
transition: all 0.2s ease;
|
|
2568
|
+
}
|
|
2569
|
+
|
|
2570
|
+
.reset-theme-btn:hover {
|
|
2571
|
+
background: rgba(255, 255, 255, 0.05);
|
|
2572
|
+
border-color: var(--text-main);
|
|
2573
|
+
}
|
|
2574
|
+
|
|
2575
|
+
.theme-sections-grid {
|
|
2576
|
+
display: grid;
|
|
2577
|
+
grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
|
|
2578
|
+
gap: 24px;
|
|
2579
|
+
margin-top: 16px;
|
|
2580
|
+
}
|
|
2581
|
+
|
|
2582
|
+
.theme-section-card {
|
|
2583
|
+
background: var(--bg-sidebar);
|
|
2584
|
+
border: 1px solid var(--border-color);
|
|
2585
|
+
border-radius: var(--q-radius-lg, 12px);
|
|
2586
|
+
padding: 24px;
|
|
2587
|
+
box-shadow: var(--shadow-main);
|
|
2588
|
+
}
|
|
2589
|
+
|
|
2590
|
+
.theme-section-card h3 {
|
|
2591
|
+
font-size: 1.15rem;
|
|
2592
|
+
font-weight: 600;
|
|
2593
|
+
margin: 0 0 20px 0;
|
|
2594
|
+
padding-bottom: 10px;
|
|
2595
|
+
border-bottom: 1px solid var(--border-color);
|
|
2596
|
+
color: var(--text-main);
|
|
2597
|
+
}
|
|
2598
|
+
|
|
2599
|
+
.token-row {
|
|
2600
|
+
display: flex;
|
|
2601
|
+
flex-direction: column;
|
|
2602
|
+
gap: 8px;
|
|
2603
|
+
margin-bottom: 20px;
|
|
2604
|
+
}
|
|
2605
|
+
|
|
2606
|
+
.token-row:last-child {
|
|
2607
|
+
margin-bottom: 0;
|
|
2608
|
+
}
|
|
2609
|
+
|
|
2610
|
+
.token-info {
|
|
2611
|
+
display: flex;
|
|
2612
|
+
flex-direction: column;
|
|
2613
|
+
}
|
|
2614
|
+
|
|
2615
|
+
.token-label {
|
|
2616
|
+
font-size: 0.9rem;
|
|
2617
|
+
font-weight: 600;
|
|
2618
|
+
color: var(--text-main);
|
|
2619
|
+
}
|
|
2620
|
+
|
|
2621
|
+
.token-desc {
|
|
2622
|
+
font-size: 0.75rem;
|
|
2623
|
+
color: var(--text-muted);
|
|
2624
|
+
}
|
|
2625
|
+
|
|
2626
|
+
.token-control-wrapper {
|
|
2627
|
+
display: flex;
|
|
2628
|
+
align-items: center;
|
|
2629
|
+
gap: 12px;
|
|
2630
|
+
}
|
|
2631
|
+
|
|
2632
|
+
/* Color control styling */
|
|
2633
|
+
.color-input-container {
|
|
2634
|
+
display: flex;
|
|
2635
|
+
align-items: center;
|
|
2636
|
+
gap: 8px;
|
|
2637
|
+
width: 100%;
|
|
2638
|
+
}
|
|
2639
|
+
|
|
2640
|
+
.color-picker-wrapper {
|
|
2641
|
+
position: relative;
|
|
2642
|
+
width: 38px;
|
|
2643
|
+
height: 38px;
|
|
2644
|
+
border-radius: var(--q-radius-md, 8px);
|
|
2645
|
+
overflow: hidden;
|
|
2646
|
+
border: 1px solid var(--border-color);
|
|
2647
|
+
cursor: pointer;
|
|
2648
|
+
flex-shrink: 0;
|
|
2649
|
+
}
|
|
2650
|
+
|
|
2651
|
+
.color-swatch-picker {
|
|
2652
|
+
position: absolute;
|
|
2653
|
+
top: -8px;
|
|
2654
|
+
left: -8px;
|
|
2655
|
+
width: 56px;
|
|
2656
|
+
height: 56px;
|
|
2657
|
+
padding: 0;
|
|
2658
|
+
border: 0;
|
|
2659
|
+
cursor: pointer;
|
|
2660
|
+
background: none;
|
|
2661
|
+
}
|
|
2662
|
+
|
|
2663
|
+
.color-text-input {
|
|
2664
|
+
flex: 1;
|
|
2665
|
+
background: var(--bg-app);
|
|
2666
|
+
border: 1px solid var(--border-color);
|
|
2667
|
+
color: var(--text-main);
|
|
2668
|
+
padding: 8px 12px;
|
|
2669
|
+
border-radius: var(--q-radius-md, 8px);
|
|
2670
|
+
font-size: 0.85rem;
|
|
2671
|
+
font-family: monospace;
|
|
2672
|
+
}
|
|
2673
|
+
|
|
2674
|
+
.color-text-input:focus {
|
|
2675
|
+
outline: none;
|
|
2676
|
+
border-color: var(--primary);
|
|
2677
|
+
}
|
|
2678
|
+
|
|
2679
|
+
/* Range input/slider overrides */
|
|
2680
|
+
.range-slider-container {
|
|
2681
|
+
display: flex;
|
|
2682
|
+
align-items: center;
|
|
2683
|
+
gap: 12px;
|
|
2684
|
+
width: 100%;
|
|
2685
|
+
}
|
|
2686
|
+
|
|
2687
|
+
.range-slider-input {
|
|
2688
|
+
flex: 1;
|
|
2689
|
+
-webkit-appearance: none;
|
|
2690
|
+
appearance: none;
|
|
2691
|
+
height: 6px;
|
|
2692
|
+
border-radius: 3px;
|
|
2693
|
+
background: var(--bg-app);
|
|
2694
|
+
outline: none;
|
|
2695
|
+
}
|
|
2696
|
+
|
|
2697
|
+
.range-slider-input::-webkit-slider-thumb {
|
|
2698
|
+
-webkit-appearance: none;
|
|
2699
|
+
appearance: none;
|
|
2700
|
+
width: 16px;
|
|
2701
|
+
height: 16px;
|
|
2702
|
+
border-radius: 50%;
|
|
2703
|
+
background: var(--primary);
|
|
2704
|
+
cursor: pointer;
|
|
2705
|
+
transition: transform 0.1s ease;
|
|
2706
|
+
}
|
|
2707
|
+
|
|
2708
|
+
.range-slider-input::-webkit-slider-thumb:hover {
|
|
2709
|
+
transform: scale(1.2);
|
|
2710
|
+
}
|
|
2711
|
+
|
|
2712
|
+
.range-slider-value {
|
|
2713
|
+
font-size: 0.85rem;
|
|
2714
|
+
font-family: monospace;
|
|
2715
|
+
color: var(--text-main);
|
|
2716
|
+
min-width: 40px;
|
|
2717
|
+
text-align: right;
|
|
2718
|
+
}
|
|
2719
|
+
`;
|
|
2720
|
+
|
|
2721
|
+
// src/playground/components/theme-designer/theme-designer.tsx
|
|
2722
|
+
var THEME_TOKENS = [
|
|
2723
|
+
{
|
|
2724
|
+
category: "Brand & Status Colors",
|
|
2725
|
+
tokens: [
|
|
2726
|
+
{ name: "--q-color-primary", label: "Primary Color", type: "color", desc: "Main brand/accent color" },
|
|
2727
|
+
{ name: "--q-color-primary-hover", label: "Primary Hover", type: "color", desc: "Hover state for primary actions" },
|
|
2728
|
+
{ name: "--q-color-secondary", label: "Secondary Color", type: "color", desc: "Secondary/muted accent color" },
|
|
2729
|
+
{ name: "--q-color-success", label: "Success Color", type: "color", desc: "Success indicator" },
|
|
2730
|
+
{ name: "--q-color-warning", label: "Warning Color", type: "color", desc: "Warning indicator" },
|
|
2731
|
+
{ name: "--q-color-danger", label: "Danger Color", type: "color", desc: "Danger/Error indicator" }
|
|
2732
|
+
]
|
|
2733
|
+
},
|
|
2734
|
+
{
|
|
2735
|
+
category: "Surfaces & Backgrounds",
|
|
2736
|
+
tokens: [
|
|
2737
|
+
{ name: "--q-bg-base", label: "Base Background", type: "color", desc: "Lowest canvas background" },
|
|
2738
|
+
{ name: "--q-bg-surface-1", label: "Surface 1", type: "color", desc: "Sidebar/surface panels" },
|
|
2739
|
+
{ name: "--q-bg-surface-2", label: "Surface 2", type: "color", desc: "Nested tabs/toolbar sections" },
|
|
2740
|
+
{ name: "--q-bg-surface-3", label: "Surface 3", type: "color", desc: "Dropdowns/popovers" }
|
|
2741
|
+
]
|
|
2742
|
+
},
|
|
2743
|
+
{
|
|
2744
|
+
category: "Borders & Outlines",
|
|
2745
|
+
tokens: [
|
|
2746
|
+
{ name: "--q-border-color", label: "Border Color", type: "color", desc: "Subtle container border" }
|
|
2747
|
+
]
|
|
2748
|
+
},
|
|
2749
|
+
{
|
|
2750
|
+
category: "Border Radii",
|
|
2751
|
+
tokens: [
|
|
2752
|
+
{ name: "--q-radius-sm", label: "Small Radius", type: "radius", min: 0, max: 40, desc: "Badges and small components" },
|
|
2753
|
+
{ name: "--q-radius-md", label: "Medium Radius", type: "radius", min: 0, max: 40, desc: "Buttons, inputs, thumbnails" },
|
|
2754
|
+
{ name: "--q-radius-lg", label: "Large Radius", type: "radius", min: 0, max: 40, desc: "Cards, dropdown menus, panels" }
|
|
2755
|
+
]
|
|
2756
|
+
}
|
|
2757
|
+
];
|
|
2758
|
+
|
|
2759
|
+
class ThemeDesigner extends HTMLElement {
|
|
2760
|
+
cleanupThemeSync;
|
|
2761
|
+
connectedCallback() {
|
|
2762
|
+
this.innerHTML = "";
|
|
2763
|
+
this.appendChild(/* @__PURE__ */ h("div", {
|
|
2764
|
+
class: "theme-designer-container"
|
|
2765
|
+
}, /* @__PURE__ */ h("div", {
|
|
2766
|
+
class: "theme-designer-header"
|
|
2767
|
+
}, /* @__PURE__ */ h("div", {
|
|
2768
|
+
style: "flex: 1"
|
|
2769
|
+
}, /* @__PURE__ */ h("h2", {
|
|
2770
|
+
style: "margin: 0; font-size: 1.25rem; font-weight: 700; color: var(--text-main)"
|
|
2771
|
+
}, "Global Styling Designer"), /* @__PURE__ */ h("p", {
|
|
2772
|
+
class: "theme-designer-desc"
|
|
2773
|
+
}, "Customize global brand tokens and spacing variables. Overrides apply instantly to all sandbox components.")), /* @__PURE__ */ h("button", {
|
|
2774
|
+
id: "resetThemeBtn",
|
|
2775
|
+
class: "reset-theme-btn",
|
|
2776
|
+
type: "button",
|
|
2777
|
+
onClick: () => this.resetTheme()
|
|
2778
|
+
}, /* @__PURE__ */ h("q-icon", {
|
|
2779
|
+
name: "refresh-cw",
|
|
2780
|
+
lib: "lucide",
|
|
2781
|
+
size: "16"
|
|
2782
|
+
}), /* @__PURE__ */ h("span", null, "Reset to Default"))), this.renderGrid()));
|
|
2783
|
+
const styleId = "theme-designer-style";
|
|
2784
|
+
if (!document.getElementById(styleId)) {
|
|
2785
|
+
const style = document.createElement("style");
|
|
2786
|
+
style.id = styleId;
|
|
2787
|
+
style.textContent = theme_designer_default;
|
|
2788
|
+
document.head.appendChild(style);
|
|
2789
|
+
}
|
|
2790
|
+
this.init();
|
|
2791
|
+
}
|
|
2792
|
+
init() {
|
|
2793
|
+
this.cleanupThemeSync = effect(() => {
|
|
2794
|
+
theme();
|
|
2795
|
+
setTimeout(() => this.syncThemeInputs(), 50);
|
|
2796
|
+
});
|
|
2797
|
+
}
|
|
2798
|
+
renderGrid() {
|
|
2799
|
+
const grid = /* @__PURE__ */ h("div", {
|
|
2800
|
+
class: "theme-sections-grid",
|
|
2801
|
+
id: "themeSectionsGrid"
|
|
2802
|
+
});
|
|
2803
|
+
THEME_TOKENS.forEach((cat) => {
|
|
2804
|
+
const card = document.createElement("token-section");
|
|
2805
|
+
card.categoryName = cat.category;
|
|
2806
|
+
card.tokens = cat.tokens;
|
|
2807
|
+
grid.appendChild(card);
|
|
2808
|
+
});
|
|
2809
|
+
return grid;
|
|
2810
|
+
}
|
|
2811
|
+
resetTheme() {
|
|
2812
|
+
document.documentElement.style.cssText = "";
|
|
2813
|
+
setTimeout(() => this.syncThemeInputs(), 50);
|
|
2814
|
+
}
|
|
2815
|
+
syncThemeInputs() {
|
|
2816
|
+
this.querySelectorAll("token-row").forEach((row) => {
|
|
2817
|
+
if (typeof row.syncValue === "function") {
|
|
2818
|
+
row.syncValue();
|
|
2819
|
+
}
|
|
2820
|
+
});
|
|
2821
|
+
}
|
|
2822
|
+
disconnectedCallback() {
|
|
2823
|
+
if (this.cleanupThemeSync) {
|
|
2824
|
+
this.cleanupThemeSync();
|
|
2825
|
+
}
|
|
2826
|
+
}
|
|
2827
|
+
}
|
|
2828
|
+
customElements.define("theme-designer", ThemeDesigner);
|
|
2829
|
+
|
|
2830
|
+
// src/playground/playground.ts
|
|
2831
|
+
fetchComponentSpec("q-button");
|