@ohos-ports/stacksjs-stx 0.2.287-beta.0
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.md +21 -0
- package/README.md +1042 -0
- package/dist/a11y.d.ts +256 -0
- package/dist/a11y.js +671 -0
- package/dist/analytics.d.ts +40 -0
- package/dist/analytics.js +159 -0
- package/dist/analyzer.d.ts +68 -0
- package/dist/analyzer.js +240 -0
- package/dist/animation.d.ts +123 -0
- package/dist/animation.js +688 -0
- package/dist/app-shell.d.ts +76 -0
- package/dist/app-shell.js +209 -0
- package/dist/app.d.ts +65 -0
- package/dist/app.js +79 -0
- package/dist/appearance-bootstrap.d.ts +54 -0
- package/dist/appearance-bootstrap.js +92 -0
- package/dist/asset-roots.d.ts +32 -0
- package/dist/asset-roots.js +7 -0
- package/dist/assets.d.ts +21 -0
- package/dist/assets.js +155 -0
- package/dist/ast.d.ts +265 -0
- package/dist/ast.js +630 -0
- package/dist/async-components.d.ts +123 -0
- package/dist/async-components.js +428 -0
- package/dist/auth.d.ts +13 -0
- package/dist/auth.js +12 -0
- package/dist/broadcasting.d.ts +77 -0
- package/dist/broadcasting.js +103 -0
- package/dist/browser-composables.d.ts +348 -0
- package/dist/browser-composables.js +606 -0
- package/dist/browser-core-imports.d.ts +12 -0
- package/dist/browser-core-imports.js +28 -0
- package/dist/build-assets.d.ts +32 -0
- package/dist/build-assets.js +29 -0
- package/dist/build-externalize-repeated.d.ts +34 -0
- package/dist/build-externalize-repeated.js +101 -0
- package/dist/build-externalize.d.ts +73 -0
- package/dist/build-externalize.js +80 -0
- package/dist/build-id.d.ts +57 -0
- package/dist/build-id.js +25 -0
- package/dist/build-message.d.ts +81 -0
- package/dist/build-message.js +65 -0
- package/dist/build-mode-detector.d.ts +26 -0
- package/dist/build-mode-detector.js +50 -0
- package/dist/build-optimizer.d.ts +101 -0
- package/dist/build-optimizer.js +433 -0
- package/dist/build-views.d.ts +56 -0
- package/dist/build-views.js +180 -0
- package/dist/build.d.ts +31 -0
- package/dist/build.js +34 -0
- package/dist/builtins/attrs.d.ts +49 -0
- package/dist/builtins/attrs.js +39 -0
- package/dist/builtins/drawer.d.ts +24 -0
- package/dist/builtins/drawer.js +37 -0
- package/dist/builtins/escape.d.ts +12 -0
- package/dist/builtins/escape.js +3 -0
- package/dist/builtins/icon.d.ts +45 -0
- package/dist/builtins/icon.js +100 -0
- package/dist/builtins/image-delivery.d.ts +16 -0
- package/dist/builtins/image-delivery.js +115 -0
- package/dist/builtins/image-placeholder.d.ts +78 -0
- package/dist/builtins/image-placeholder.js +137 -0
- package/dist/builtins/index.d.ts +26 -0
- package/dist/builtins/index.js +34 -0
- package/dist/builtins/modal.d.ts +26 -0
- package/dist/builtins/modal.js +38 -0
- package/dist/builtins/safe-image.d.ts +44 -0
- package/dist/builtins/safe-image.js +45 -0
- package/dist/builtins/stx-image.d.ts +29 -0
- package/dist/builtins/stx-image.js +222 -0
- package/dist/builtins/stx-link.d.ts +11 -0
- package/dist/builtins/stx-link.js +35 -0
- package/dist/builtins/stx-loading-indicator.d.ts +13 -0
- package/dist/builtins/stx-loading-indicator.js +35 -0
- package/dist/builtins/suspense.d.ts +30 -0
- package/dist/builtins/suspense.js +24 -0
- package/dist/builtins/toast.d.ts +19 -0
- package/dist/builtins/toast.js +42 -0
- package/dist/builtins/tooltip.d.ts +18 -0
- package/dist/builtins/tooltip.js +106 -0
- package/dist/builtins/transition-group.d.ts +27 -0
- package/dist/builtins/transition-group.js +22 -0
- package/dist/bun-shim.js +496 -0
- package/dist/bundle-analyzer/collector.d.ts +66 -0
- package/dist/bundle-analyzer/collector.js +233 -0
- package/dist/bundle-analyzer/index.d.ts +98 -0
- package/dist/bundle-analyzer/index.js +82 -0
- package/dist/bundle-analyzer/report.d.ts +39 -0
- package/dist/bundle-analyzer/report.js +318 -0
- package/dist/bundle-analyzer/treemap.d.ts +19 -0
- package/dist/bundle-analyzer/treemap.js +594 -0
- package/dist/bundle-analyzer.js +499 -0
- package/dist/caching.d.ts +69 -0
- package/dist/caching.js +135 -0
- package/dist/chunk-0y46fbkx.js +3 -0
- package/dist/chunk-122tyfre.js +2 -0
- package/dist/chunk-19nfvxfw.js +43 -0
- package/dist/chunk-1kah92n2.js +3 -0
- package/dist/chunk-1kms3b9d.js +2 -0
- package/dist/chunk-1q4y74mh.js +1194 -0
- package/dist/chunk-248e84r1.js +4 -0
- package/dist/chunk-24ps8kft.js +2 -0
- package/dist/chunk-2et5hxfv.js +2 -0
- package/dist/chunk-2r1rd8f0.js +2 -0
- package/dist/chunk-2tk1zkrz.js +2 -0
- package/dist/chunk-38ejahd9.js +3 -0
- package/dist/chunk-3zv4wz87.js +2 -0
- package/dist/chunk-4122k1bh.js +2 -0
- package/dist/chunk-45az9zht.js +2 -0
- package/dist/chunk-4qr85f07.js +2 -0
- package/dist/chunk-4ww3znrr.js +15 -0
- package/dist/chunk-54st8g2j.js +397 -0
- package/dist/chunk-58f0mthg.js +3 -0
- package/dist/chunk-5a19dhx5.js +2 -0
- package/dist/chunk-5kk8gsj2.js +3 -0
- package/dist/chunk-5w1e3yxs.js +499 -0
- package/dist/chunk-6gdycmxr.js +2 -0
- package/dist/chunk-6hmnaza7.js +4473 -0
- package/dist/chunk-71t0yan0.js +5 -0
- package/dist/chunk-74cv4ta1.js +3 -0
- package/dist/chunk-74v15e8z.js +2 -0
- package/dist/chunk-7b329e5v.js +3 -0
- package/dist/chunk-7q9mwh4v.js +84 -0
- package/dist/chunk-866y9d8b.js +8169 -0
- package/dist/chunk-8fwerspy.js +2 -0
- package/dist/chunk-8mjdpr94.js +147 -0
- package/dist/chunk-92mj1t26.js +60 -0
- package/dist/chunk-9b22663r.js +2 -0
- package/dist/chunk-9hjdgm4d.js +2 -0
- package/dist/chunk-9n0gvfrg.js +4 -0
- package/dist/chunk-9wr7zcad.js +18 -0
- package/dist/chunk-9y0g8kzt.js +358 -0
- package/dist/chunk-a0nfbmeh.js +3 -0
- package/dist/chunk-acn1b56m.js +1280 -0
- package/dist/chunk-awkq3xfx.js +2 -0
- package/dist/chunk-b6ej2fdf.js +1814 -0
- package/dist/chunk-b8rrnqry.js +2 -0
- package/dist/chunk-bfqfs07m.js +3022 -0
- package/dist/chunk-bs6kapy7.js +2 -0
- package/dist/chunk-btav940g.js +2 -0
- package/dist/chunk-bz820epz.js +3 -0
- package/dist/chunk-ccspd3mc.js +2 -0
- package/dist/chunk-csbgwaa5.js +2 -0
- package/dist/chunk-d8t4sjsp.js +2 -0
- package/dist/chunk-dap191q2.js +2 -0
- package/dist/chunk-de7fye10.js +4 -0
- package/dist/chunk-dgrt76d2.js +2 -0
- package/dist/chunk-dhh5q7qt.js +3 -0
- package/dist/chunk-dsffsqnt.js +2 -0
- package/dist/chunk-dtq7y5ym.js +2 -0
- package/dist/chunk-fed3xsp9.js +3 -0
- package/dist/chunk-ferav3bw.js +19 -0
- package/dist/chunk-fvhm8psm.js +3 -0
- package/dist/chunk-g4vpzv6b.js +2 -0
- package/dist/chunk-g9csmj0s.js +2 -0
- package/dist/chunk-gtcrpmz1.js +2 -0
- package/dist/chunk-h4xh8cms.js +4 -0
- package/dist/chunk-h8yqsz9m.js +2 -0
- package/dist/chunk-hcq5dw7a.js +2 -0
- package/dist/chunk-hm0xha6c.js +12 -0
- package/dist/chunk-hpybjwwf.js +8 -0
- package/dist/chunk-jegt35zh.js +2 -0
- package/dist/chunk-jr3jp3ev.js +8 -0
- package/dist/chunk-k56rjjc0.js +24 -0
- package/dist/chunk-kdh37tp8.js +194 -0
- package/dist/chunk-kxzb4et3.js +29 -0
- package/dist/chunk-mf4n3x1j.js +14 -0
- package/dist/chunk-mkd9kjgb.js +3 -0
- package/dist/chunk-mxfh1nxg.js +2 -0
- package/dist/chunk-n3ggrhb3.js +3 -0
- package/dist/chunk-nkb3scg6.js +8 -0
- package/dist/chunk-nnd4wq8j.js +231 -0
- package/dist/chunk-nsp1cw38.js +11 -0
- package/dist/chunk-nx5qkm8k.js +30 -0
- package/dist/chunk-p3242nck.js +2 -0
- package/dist/chunk-p98kfh94.js +2 -0
- package/dist/chunk-pkaabd8h.js +3 -0
- package/dist/chunk-pzm13sdc.js +3 -0
- package/dist/chunk-q4p5k2p3.js +2 -0
- package/dist/chunk-q9n5swx7.js +3 -0
- package/dist/chunk-qc1f74ek.js +3 -0
- package/dist/chunk-qpyjak7z.js +2 -0
- package/dist/chunk-qr82je1m.js +22 -0
- package/dist/chunk-qy73j6m4.js +288 -0
- package/dist/chunk-qzkhpsam.js +505 -0
- package/dist/chunk-r3ayvdz3.js +2 -0
- package/dist/chunk-r7r66978.js +2 -0
- package/dist/chunk-rbb7dvja.js +30 -0
- package/dist/chunk-refwkt87.js +71 -0
- package/dist/chunk-rj4kajww.js +2 -0
- package/dist/chunk-rp4rjjmf.js +2 -0
- package/dist/chunk-se0p17c2.js +898 -0
- package/dist/chunk-sj9pmene.js +2 -0
- package/dist/chunk-sscwkffs.js +2 -0
- package/dist/chunk-svpqxn2c.js +2 -0
- package/dist/chunk-t6nseeb9.js +351 -0
- package/dist/chunk-t8y1ggdy.js +2 -0
- package/dist/chunk-tndhnk9e.js +2 -0
- package/dist/chunk-v5e1gxwm.js +3 -0
- package/dist/chunk-vqxmxgaj.js +4 -0
- package/dist/chunk-vrrax298.js +2 -0
- package/dist/chunk-w3ycm4na.js +3 -0
- package/dist/chunk-wcm80anz.js +321 -0
- package/dist/chunk-wrzwgkbx.js +22 -0
- package/dist/chunk-x650vjcp.js +302 -0
- package/dist/chunk-xgnc1wy6.js +116 -0
- package/dist/chunk-xpp135ad.js +11 -0
- package/dist/chunk-xttsqmkm.js +216 -0
- package/dist/chunk-y11cxbxd.js +3757 -0
- package/dist/chunk-y7m2dpd3.js +341 -0
- package/dist/chunk-y98jsjqq.js +2 -0
- package/dist/chunk-ya386h70.js +2 -0
- package/dist/chunk-ydrz60kr.js +2 -0
- package/dist/chunk-ypmqf7tm.js +4 -0
- package/dist/chunk-z4jhj5e5.js +28 -0
- package/dist/chunk-zg75gjns.js +2 -0
- package/dist/chunk-zqqx1qaj.js +2 -0
- package/dist/cli-flags.d.ts +34 -0
- package/dist/cli-flags.js +20 -0
- package/dist/cli.js +174 -0
- package/dist/client/directive.d.ts +17 -0
- package/dist/client/directive.js +14 -0
- package/dist/client/index.d.ts +7 -0
- package/dist/client/index.js +2 -0
- package/dist/client-helpers.d.ts +317 -0
- package/dist/client-helpers.js +312 -0
- package/dist/client-script-bundler.d.ts +103 -0
- package/dist/client-script-bundler.js +390 -0
- package/dist/client-script.d.ts +215 -0
- package/dist/client-script.js +865 -0
- package/dist/client.d.ts +21 -0
- package/dist/client.js +73 -0
- package/dist/codemod.d.ts +33 -0
- package/dist/codemod.js +244 -0
- package/dist/color-mode-boot.d.ts +92 -0
- package/dist/color-mode-boot.js +72 -0
- package/dist/component-client-factories.d.ts +33 -0
- package/dist/component-client-factories.js +77 -0
- package/dist/component-hmr.d.ts +107 -0
- package/dist/component-hmr.js +585 -0
- package/dist/component-library.d.ts +38 -0
- package/dist/component-library.js +994 -0
- package/dist/component-processing.d.ts +198 -0
- package/dist/component-processing.js +677 -0
- package/dist/component-registry.d.ts +127 -0
- package/dist/component-registry.js +90 -0
- package/dist/component-renderer.d.ts +52 -0
- package/dist/component-renderer.js +790 -0
- package/dist/components/StxImage.stx +12 -0
- package/dist/components/StxLink.stx +18 -0
- package/dist/components.d.ts +28 -0
- package/dist/components.js +213 -0
- package/dist/composable-loader.d.ts +62 -0
- package/dist/composable-loader.js +190 -0
- package/dist/composables/index.d.ts +417 -0
- package/dist/composables/index.js +222 -0
- package/dist/composables/use-battery.d.ts +46 -0
- package/dist/composables/use-battery.js +101 -0
- package/dist/composables/use-broadcast-channel.d.ts +59 -0
- package/dist/composables/use-broadcast-channel.js +80 -0
- package/dist/composables/use-channel.d.ts +67 -0
- package/dist/composables/use-channel.js +124 -0
- package/dist/composables/use-clipboard.d.ts +30 -0
- package/dist/composables/use-clipboard.js +90 -0
- package/dist/composables/use-color-mode.d.ts +67 -0
- package/dist/composables/use-color-mode.js +152 -0
- package/dist/composables/use-cookie.d.ts +59 -0
- package/dist/composables/use-cookie.js +86 -0
- package/dist/composables/use-device-orientation.d.ts +116 -0
- package/dist/composables/use-device-orientation.js +181 -0
- package/dist/composables/use-event-listener.d.ts +35 -0
- package/dist/composables/use-event-listener.js +27 -0
- package/dist/composables/use-event-source.d.ts +90 -0
- package/dist/composables/use-event-source.js +166 -0
- package/dist/composables/use-eye-dropper.d.ts +117 -0
- package/dist/composables/use-eye-dropper.js +142 -0
- package/dist/composables/use-fetch.d.ts +59 -0
- package/dist/composables/use-fetch.js +273 -0
- package/dist/composables/use-form.d.ts +91 -0
- package/dist/composables/use-form.js +112 -0
- package/dist/composables/use-fullscreen.d.ts +47 -0
- package/dist/composables/use-fullscreen.js +110 -0
- package/dist/composables/use-geolocation.d.ts +62 -0
- package/dist/composables/use-geolocation.js +101 -0
- package/dist/composables/use-idle.d.ts +102 -0
- package/dist/composables/use-idle.js +182 -0
- package/dist/composables/use-intersection-observer.d.ts +83 -0
- package/dist/composables/use-intersection-observer.js +168 -0
- package/dist/composables/use-keyboard.d.ts +100 -0
- package/dist/composables/use-keyboard.js +224 -0
- package/dist/composables/use-media-query.d.ts +56 -0
- package/dist/composables/use-media-query.js +62 -0
- package/dist/composables/use-meta.d.ts +35 -0
- package/dist/composables/use-meta.js +48 -0
- package/dist/composables/use-mouse.d.ts +65 -0
- package/dist/composables/use-mouse.js +286 -0
- package/dist/composables/use-mutation-observer.d.ts +101 -0
- package/dist/composables/use-mutation-observer.js +129 -0
- package/dist/composables/use-network.d.ts +40 -0
- package/dist/composables/use-network.js +85 -0
- package/dist/composables/use-notification.d.ts +98 -0
- package/dist/composables/use-notification.js +94 -0
- package/dist/composables/use-permissions.d.ts +119 -0
- package/dist/composables/use-permissions.js +132 -0
- package/dist/composables/use-query.d.ts +48 -0
- package/dist/composables/use-query.js +0 -0
- package/dist/composables/use-resize-observer.d.ts +60 -0
- package/dist/composables/use-resize-observer.js +157 -0
- package/dist/composables/use-router.d.ts +80 -0
- package/dist/composables/use-router.js +105 -0
- package/dist/composables/use-scroll-lock.d.ts +13 -0
- package/dist/composables/use-scroll-lock.js +55 -0
- package/dist/composables/use-share.d.ts +74 -0
- package/dist/composables/use-share.js +104 -0
- package/dist/composables/use-speech.d.ts +117 -0
- package/dist/composables/use-speech.js +294 -0
- package/dist/composables/use-storage.d.ts +69 -0
- package/dist/composables/use-storage.js +196 -0
- package/dist/composables/use-text-selection.d.ts +121 -0
- package/dist/composables/use-text-selection.js +205 -0
- package/dist/composables/use-timer.d.ts +92 -0
- package/dist/composables/use-timer.js +193 -0
- package/dist/composables/use-utilities.d.ts +103 -0
- package/dist/composables/use-utilities.js +176 -0
- package/dist/composables/use-wake-lock.d.ts +85 -0
- package/dist/composables/use-wake-lock.js +122 -0
- package/dist/composables/use-websocket.d.ts +70 -0
- package/dist/composables/use-websocket.js +165 -0
- package/dist/composables/use-window.d.ts +84 -0
- package/dist/composables/use-window.js +163 -0
- package/dist/composables.d.ts +287 -0
- package/dist/composables.js +562 -0
- package/dist/composition-api.d.ts +197 -0
- package/dist/composition-api.js +199 -0
- package/dist/compression.d.ts +30 -0
- package/dist/compression.js +107 -0
- package/dist/computed.d.ts +138 -0
- package/dist/computed.js +382 -0
- package/dist/conditionals.d.ts +48 -0
- package/dist/conditionals.js +626 -0
- package/dist/config.d.ts +77 -0
- package/dist/config.js +828 -0
- package/dist/cookie-serialize.d.ts +40 -0
- package/dist/cookie-serialize.js +18 -0
- package/dist/craft-bridge.d.ts +525 -0
- package/dist/craft-bridge.js +511 -0
- package/dist/craft-compiler.d.ts +245 -0
- package/dist/craft-compiler.js +810 -0
- package/dist/craft-components.d.ts +739 -0
- package/dist/craft-components.js +1074 -0
- package/dist/craft-entry.d.ts +6 -0
- package/dist/craft-entry.js +9 -0
- package/dist/craft-ssr.d.ts +147 -0
- package/dist/craft-ssr.js +559 -0
- package/dist/craft.js +9 -0
- package/dist/csp.d.ts +295 -0
- package/dist/csp.js +220 -0
- package/dist/csrf.d.ts +38 -0
- package/dist/csrf.js +38 -0
- package/dist/custom-directives.d.ts +5 -0
- package/dist/custom-directives.js +136 -0
- package/dist/database.d.ts +391 -0
- package/dist/database.js +5 -0
- package/dist/defer.d.ts +28 -0
- package/dist/defer.js +156 -0
- package/dist/deploy/config-generators.d.ts +75 -0
- package/dist/deploy/config-generators.js +214 -0
- package/dist/deploy/index.d.ts +88 -0
- package/dist/deploy/index.js +203 -0
- package/dist/deploy/netlify.d.ts +109 -0
- package/dist/deploy/netlify.js +167 -0
- package/dist/desktop.d.ts +16 -0
- package/dist/desktop.js +1 -0
- package/dist/dev-server/index.d.ts +22 -0
- package/dist/dev-server/index.js +7 -0
- package/dist/dev-server/keyboard-shortcuts.d.ts +34 -0
- package/dist/dev-server/keyboard-shortcuts.js +81 -0
- package/dist/dev-server/native-window.d.ts +59 -0
- package/dist/dev-server/native-window.js +91 -0
- package/dist/dev-server/port-utils.d.ts +27 -0
- package/dist/dev-server/port-utils.js +40 -0
- package/dist/dev-server/serve-app.d.ts +15 -0
- package/dist/dev-server/serve-app.js +727 -0
- package/dist/dev-server/serve-file.d.ts +3 -0
- package/dist/dev-server/serve-file.js +443 -0
- package/dist/dev-server/serve-markdown.d.ts +3 -0
- package/dist/dev-server/serve-markdown.js +284 -0
- package/dist/dev-server/serve-multi.d.ts +5 -0
- package/dist/dev-server/serve-multi.js +596 -0
- package/dist/dev-server/terminal-colors.d.ts +56 -0
- package/dist/dev-server/terminal-colors.js +45 -0
- package/dist/dev-server/theme-selector.d.ts +32 -0
- package/dist/dev-server/theme-selector.js +111 -0
- package/dist/dev-server/ts-css.d.ts +108 -0
- package/dist/dev-server/ts-css.js +438 -0
- package/dist/dev-server/types.d.ts +99 -0
- package/dist/dev-server/types.js +43 -0
- package/dist/dev-server.d.ts +6 -0
- package/dist/dev-server.js +4 -0
- package/dist/devtools.d.ts +182 -0
- package/dist/devtools.js +593 -0
- package/dist/directive-api.d.ts +154 -0
- package/dist/directive-api.js +355 -0
- package/dist/docs.d.ts +56 -0
- package/dist/docs.js +567 -0
- package/dist/doctor.d.ts +29 -0
- package/dist/doctor.js +123 -0
- package/dist/document-shell.d.ts +218 -0
- package/dist/document-shell.js +338 -0
- package/dist/dynamic-components.d.ts +23 -0
- package/dist/dynamic-components.js +197 -0
- package/dist/edge-runtime.d.ts +193 -0
- package/dist/edge-runtime.js +525 -0
- package/dist/env.d.ts +3 -0
- package/dist/env.js +9 -0
- package/dist/error-boundaries.d.ts +78 -0
- package/dist/error-boundaries.js +281 -0
- package/dist/error-handling.d.ts +14 -0
- package/dist/error-handling.js +1 -0
- package/dist/errors/codes.d.ts +92 -0
- package/dist/errors/codes.js +97 -0
- package/dist/errors/formatter.d.ts +84 -0
- package/dist/errors/formatter.js +196 -0
- package/dist/errors/index.d.ts +12 -0
- package/dist/errors/index.js +44 -0
- package/dist/errors/logger.d.ts +135 -0
- package/dist/errors/logger.js +250 -0
- package/dist/errors/sanitizer.d.ts +73 -0
- package/dist/errors/sanitizer.js +181 -0
- package/dist/errors/types.d.ts +92 -0
- package/dist/errors/types.js +86 -0
- package/dist/events.d.ts +145 -0
- package/dist/events.js +396 -0
- package/dist/expressions.d.ts +180 -0
- package/dist/expressions.js +719 -0
- package/dist/find-body-tag.d.ts +50 -0
- package/dist/find-body-tag.js +57 -0
- package/dist/formatter.d.ts +19 -0
- package/dist/formatter.js +265 -0
- package/dist/forms-validation.d.ts +189 -0
- package/dist/forms-validation.js +421 -0
- package/dist/forms.d.ts +224 -0
- package/dist/forms.js +729 -0
- package/dist/fragment-container.d.ts +57 -0
- package/dist/fragment-container.js +123 -0
- package/dist/framework-composables.d.ts +73 -0
- package/dist/framework-composables.js +126 -0
- package/dist/head-injection.d.ts +61 -0
- package/dist/head-injection.js +28 -0
- package/dist/head.d.ts +282 -0
- package/dist/head.js +231 -0
- package/dist/heatmap.d.ts +206 -0
- package/dist/heatmap.js +566 -0
- package/dist/hot-reload.d.ts +87 -0
- package/dist/hot-reload.js +373 -0
- package/dist/html-masking.d.ts +125 -0
- package/dist/html-masking.js +196 -0
- package/dist/hydration-runtime.d.ts +44 -0
- package/dist/hydration-runtime.js +195 -0
- package/dist/hydration.d.ts +135 -0
- package/dist/hydration.js +654 -0
- package/dist/i18n.d.ts +342 -0
- package/dist/i18n.js +678 -0
- package/dist/image-optimization/auto-sibling.d.ts +42 -0
- package/dist/image-optimization/auto-sibling.js +88 -0
- package/dist/image-optimization/build-plugin.d.ts +54 -0
- package/dist/image-optimization/build-plugin.js +241 -0
- package/dist/image-optimization/component.d.ts +46 -0
- package/dist/image-optimization/component.js +244 -0
- package/dist/image-optimization/directive.d.ts +30 -0
- package/dist/image-optimization/directive.js +203 -0
- package/dist/image-optimization/index.d.ts +156 -0
- package/dist/image-optimization/index.js +54 -0
- package/dist/image-optimization/processor.d.ts +140 -0
- package/dist/image-optimization/processor.js +262 -0
- package/dist/image-optimization/serve.d.ts +54 -0
- package/dist/image-optimization/serve.js +102 -0
- package/dist/import-rebase.d.ts +16 -0
- package/dist/import-rebase.js +16 -0
- package/dist/imported-signals.d.ts +43 -0
- package/dist/imported-signals.js +35 -0
- package/dist/includes.d.ts +171 -0
- package/dist/includes.js +764 -0
- package/dist/index.d.ts +365 -0
- package/dist/index.js +202 -0
- package/dist/init.d.ts +39 -0
- package/dist/init.js +505 -0
- package/dist/inline-assets.d.ts +28 -0
- package/dist/inline-assets.js +82 -0
- package/dist/interactive.d.ts +14 -0
- package/dist/interactive.js +383 -0
- package/dist/internal-markdown.d.ts +22 -0
- package/dist/internal-markdown.js +141 -0
- package/dist/island-chunking.d.ts +48 -0
- package/dist/island-chunking.js +52 -0
- package/dist/isolated-build.d.ts +12 -0
- package/dist/isolated-build.js +18 -0
- package/dist/js-ts.d.ts +10 -0
- package/dist/js-ts.js +60 -0
- package/dist/jsx-runtime.d.ts +92 -0
- package/dist/jsx-runtime.js +289 -0
- package/dist/keep-alive.d.ts +108 -0
- package/dist/keep-alive.js +421 -0
- package/dist/layout-types.d.ts +45 -0
- package/dist/layout-types.js +56 -0
- package/dist/lazy-loader.d.ts +90 -0
- package/dist/lazy-loader.js +245 -0
- package/dist/lazy-module.d.ts +11 -0
- package/dist/lazy-module.js +18 -0
- package/dist/loading-indicator.d.ts +50 -0
- package/dist/loading-indicator.js +322 -0
- package/dist/loops.d.ts +91 -0
- package/dist/loops.js +690 -0
- package/dist/manifest.d.ts +41 -0
- package/dist/manifest.js +31 -0
- package/dist/markdown-view.d.ts +25 -0
- package/dist/markdown-view.js +39 -0
- package/dist/markdown.d.ts +10 -0
- package/dist/markdown.js +68 -0
- package/dist/media/client/blur-up.d.ts +66 -0
- package/dist/media/client/blur-up.js +217 -0
- package/dist/media/client/index.d.ts +93 -0
- package/dist/media/client/index.js +53 -0
- package/dist/media/client/lazy-load.d.ts +74 -0
- package/dist/media/client/lazy-load.js +283 -0
- package/dist/media/client/upload-handler.d.ts +80 -0
- package/dist/media/client/upload-handler.js +354 -0
- package/dist/media/image/component.d.ts +60 -0
- package/dist/media/image/component.js +574 -0
- package/dist/media/image/directive.d.ts +23 -0
- package/dist/media/image/directive.js +160 -0
- package/dist/media/image/editing.d.ts +212 -0
- package/dist/media/image/editing.js +193 -0
- package/dist/media/image/index.d.ts +142 -0
- package/dist/media/image/index.js +80 -0
- package/dist/media/image/placeholder.d.ts +89 -0
- package/dist/media/image/placeholder.js +188 -0
- package/dist/media/image/processor/cache.d.ts +53 -0
- package/dist/media/image/processor/cache.js +51 -0
- package/dist/media/image/processor/index.d.ts +11 -0
- package/dist/media/image/processor/index.js +3 -0
- package/dist/media/image/processor/optimizer.d.ts +24 -0
- package/dist/media/image/processor/optimizer.js +202 -0
- package/dist/media/image/processor/responsive.d.ts +28 -0
- package/dist/media/image/processor/responsive.js +162 -0
- package/dist/media/image/srcset.d.ts +157 -0
- package/dist/media/image/srcset.js +194 -0
- package/dist/media/index.d.ts +331 -0
- package/dist/media/index.js +198 -0
- package/dist/media/manager/embed.d.ts +25 -0
- package/dist/media/manager/embed.js +253 -0
- package/dist/media/protected/component.d.ts +33 -0
- package/dist/media/protected/component.js +235 -0
- package/dist/media/protected/index.d.ts +47 -0
- package/dist/media/protected/index.js +20 -0
- package/dist/media/protected/signature.d.ts +72 -0
- package/dist/media/protected/signature.js +205 -0
- package/dist/media/shared/cache.d.ts +76 -0
- package/dist/media/shared/cache.js +132 -0
- package/dist/media/shared/hash.d.ts +31 -0
- package/dist/media/shared/hash.js +35 -0
- package/dist/media/shared/index.d.ts +7 -0
- package/dist/media/shared/index.js +2 -0
- package/dist/media/types.d.ts +1477 -0
- package/dist/media/types.js +0 -0
- package/dist/media/upload/component.d.ts +9 -0
- package/dist/media/upload/component.js +320 -0
- package/dist/media/upload/index.d.ts +8 -0
- package/dist/media/upload/index.js +1 -0
- package/dist/media/video/directive.d.ts +23 -0
- package/dist/media/video/directive.js +142 -0
- package/dist/media/video/index.d.ts +76 -0
- package/dist/media/video/index.js +583 -0
- package/dist/media/video/processor/cache.d.ts +55 -0
- package/dist/media/video/processor/cache.js +52 -0
- package/dist/media/video/processor/index.d.ts +12 -0
- package/dist/media/video/processor/index.js +4 -0
- package/dist/media/video/processor/streaming.d.ts +26 -0
- package/dist/media/video/processor/streaming.js +197 -0
- package/dist/media/video/processor/thumbnail.d.ts +35 -0
- package/dist/media/video/processor/thumbnail.js +134 -0
- package/dist/media/video/processor/transcoder.d.ts +19 -0
- package/dist/media/video/processor/transcoder.js +283 -0
- package/dist/menubar.d.ts +65 -0
- package/dist/menubar.js +99 -0
- package/dist/method-spoofing.d.ts +20 -0
- package/dist/method-spoofing.js +17 -0
- package/dist/middleware.d.ts +112 -0
- package/dist/middleware.js +40 -0
- package/dist/misc-directives.d.ts +55 -0
- package/dist/misc-directives.js +328 -0
- package/dist/native-build.d.ts +88 -0
- package/dist/native-build.js +575 -0
- package/dist/owned-routes.d.ts +42 -0
- package/dist/owned-routes.js +26 -0
- package/dist/page-action.d.ts +73 -0
- package/dist/page-action.js +91 -0
- package/dist/page-meta.d.ts +38 -0
- package/dist/page-meta.js +16 -0
- package/dist/page-response.d.ts +120 -0
- package/dist/page-response.js +117 -0
- package/dist/parser/directive-parser.d.ts +119 -0
- package/dist/parser/directive-parser.js +249 -0
- package/dist/parser/expression-parser.d.ts +58 -0
- package/dist/parser/expression-parser.js +358 -0
- package/dist/parser/index.d.ts +13 -0
- package/dist/parser/index.js +23 -0
- package/dist/parser/tokenizer.d.ts +77 -0
- package/dist/parser/tokenizer.js +534 -0
- package/dist/partial-hydration.d.ts +123 -0
- package/dist/partial-hydration.js +427 -0
- package/dist/performance-utils.d.ts +318 -0
- package/dist/performance-utils.js +466 -0
- package/dist/placeholder.d.ts +54 -0
- package/dist/placeholder.js +35 -0
- package/dist/plugin-system.d.ts +301 -0
- package/dist/plugin-system.js +214 -0
- package/dist/plugin.d.ts +3 -0
- package/dist/plugin.js +174 -0
- package/dist/precompiler.d.ts +43 -0
- package/dist/precompiler.js +670 -0
- package/dist/process.d.ts +16 -0
- package/dist/process.js +879 -0
- package/dist/production-build.d.ts +163 -0
- package/dist/production-build.js +596 -0
- package/dist/production-builder.d.ts +42 -0
- package/dist/production-builder.js +146 -0
- package/dist/production-server.d.ts +19 -0
- package/dist/production-server.js +208 -0
- package/dist/prop-sentinels.d.ts +31 -0
- package/dist/prop-sentinels.js +7 -0
- package/dist/props.d.ts +216 -0
- package/dist/props.js +224 -0
- package/dist/public-env.d.ts +29 -0
- package/dist/public-env.js +19 -0
- package/dist/pwa/audit.d.ts +42 -0
- package/dist/pwa/audit.js +255 -0
- package/dist/pwa/directives.d.ts +38 -0
- package/dist/pwa/directives.js +332 -0
- package/dist/pwa/icons.d.ts +42 -0
- package/dist/pwa/icons.js +109 -0
- package/dist/pwa/index.d.ts +104 -0
- package/dist/pwa/index.js +47 -0
- package/dist/pwa/inject.d.ts +32 -0
- package/dist/pwa/inject.js +102 -0
- package/dist/pwa/manifest.d.ts +104 -0
- package/dist/pwa/manifest.js +186 -0
- package/dist/pwa/offline.d.ts +8 -0
- package/dist/pwa/offline.js +259 -0
- package/dist/pwa/precache.d.ts +35 -0
- package/dist/pwa/precache.js +116 -0
- package/dist/pwa/service-worker.d.ts +33 -0
- package/dist/pwa/service-worker.js +860 -0
- package/dist/pwa/workbox-strategies.d.ts +100 -0
- package/dist/pwa/workbox-strategies.js +167 -0
- package/dist/pwa/workbox.d.ts +51 -0
- package/dist/pwa/workbox.js +382 -0
- package/dist/pwa.d.ts +52 -0
- package/dist/pwa.js +236 -0
- package/dist/reactive-bindings.d.ts +47 -0
- package/dist/reactive-bindings.js +268 -0
- package/dist/reactive-tracking.d.ts +81 -0
- package/dist/reactive-tracking.js +49 -0
- package/dist/reactive.d.ts +117 -0
- package/dist/reactive.js +593 -0
- package/dist/reactivity.d.ts +206 -0
- package/dist/reactivity.js +574 -0
- package/dist/release.d.ts +1 -0
- package/dist/release.js +1 -0
- package/dist/render-memo.d.ts +40 -0
- package/dist/render-memo.js +33 -0
- package/dist/render.d.ts +54 -0
- package/dist/render.js +153 -0
- package/dist/resolve-stx-targets.d.ts +49 -0
- package/dist/resolve-stx-targets.js +38 -0
- package/dist/route-middleware.d.ts +2 -0
- package/dist/route-middleware.js +17 -0
- package/dist/route-types.d.ts +134 -0
- package/dist/route-types.js +24 -0
- package/dist/router.d.ts +9 -0
- package/dist/router.js +9 -0
- package/dist/routes.d.ts +6 -0
- package/dist/routes.js +14 -0
- package/dist/runtime-globals.d.ts +236 -0
- package/dist/runtime-globals.js +230 -0
- package/dist/runtime-injection.d.ts +113 -0
- package/dist/runtime-injection.js +156 -0
- package/dist/runtime.d.ts +140 -0
- package/dist/runtime.js +94 -0
- package/dist/safe-evaluator.d.ts +165 -0
- package/dist/safe-evaluator.js +461 -0
- package/dist/scaffolding.d.ts +113 -0
- package/dist/scaffolding.js +897 -0
- package/dist/screenshot.d.ts +22 -0
- package/dist/screenshot.js +100 -0
- package/dist/script-classifier.d.ts +41 -0
- package/dist/script-classifier.js +51 -0
- package/dist/script-emit.d.ts +50 -0
- package/dist/script-emit.js +11 -0
- package/dist/script-json.d.ts +36 -0
- package/dist/script-json.js +6 -0
- package/dist/script-validation.d.ts +26 -0
- package/dist/script-validation.js +179 -0
- package/dist/seo.d.ts +225 -0
- package/dist/seo.js +486 -0
- package/dist/serve.d.ts +44 -0
- package/dist/serve.js +233 -0
- package/dist/server-bindings.d.ts +39 -0
- package/dist/server-bindings.js +171 -0
- package/dist/server-components.d.ts +138 -0
- package/dist/server-components.js +427 -0
- package/dist/sfc-template.d.ts +17 -0
- package/dist/sfc-template.js +32 -0
- package/dist/signal-processing.d.ts +222 -0
- package/dist/signal-processing.js +1081 -0
- package/dist/signals-api.d.ts +459 -0
- package/dist/signals-api.js +172 -0
- package/dist/signals.d.ts +41 -0
- package/dist/signals.js +8233 -0
- package/dist/site-builder/build.d.ts +18 -0
- package/dist/site-builder/build.js +252 -0
- package/dist/site-builder/i18n.d.ts +104 -0
- package/dist/site-builder/i18n.js +150 -0
- package/dist/site-builder/index.d.ts +27 -0
- package/dist/site-builder/index.js +16 -0
- package/dist/site-builder/robots.d.ts +2 -0
- package/dist/site-builder/robots.js +26 -0
- package/dist/site-builder/router.d.ts +10 -0
- package/dist/site-builder/router.js +27 -0
- package/dist/site-builder/seo.d.ts +8 -0
- package/dist/site-builder/seo.js +67 -0
- package/dist/site-builder/sitemap.d.ts +10 -0
- package/dist/site-builder/sitemap.js +26 -0
- package/dist/site-builder/theme.d.ts +12 -0
- package/dist/site-builder/theme.js +38 -0
- package/dist/site-builder/types.d.ts +74 -0
- package/dist/site-builder/types.js +0 -0
- package/dist/site-url.d.ts +46 -0
- package/dist/site-url.js +70 -0
- package/dist/slots.d.ts +129 -0
- package/dist/slots.js +286 -0
- package/dist/source-maps.d.ts +98 -0
- package/dist/source-maps.js +350 -0
- package/dist/source-signature.d.ts +45 -0
- package/dist/source-signature.js +20 -0
- package/dist/spa-nav.d.ts +49 -0
- package/dist/spa-nav.js +12 -0
- package/dist/spa-shell.d.ts +21 -0
- package/dist/spa-shell.js +34 -0
- package/dist/ssg.d.ts +357 -0
- package/dist/ssg.js +94 -0
- package/dist/ssr.d.ts +116 -0
- package/dist/ssr.js +339 -0
- package/dist/state-dir.d.ts +36 -0
- package/dist/state-dir.js +22 -0
- package/dist/state-management.d.ts +299 -0
- package/dist/state-management.js +519 -0
- package/dist/store-imports.d.ts +47 -0
- package/dist/store-imports.js +16 -0
- package/dist/store-loader.d.ts +15 -0
- package/dist/store-loader.js +111 -0
- package/dist/stores-client.d.ts +70 -0
- package/dist/stores-client.js +132 -0
- package/dist/story/addons.d.ts +123 -0
- package/dist/story/addons.js +261 -0
- package/dist/story/analytics.d.ts +163 -0
- package/dist/story/analytics.js +235 -0
- package/dist/story/auto-stories.d.ts +38 -0
- package/dist/story/auto-stories.js +158 -0
- package/dist/story/bookmarks.d.ts +102 -0
- package/dist/story/bookmarks.js +277 -0
- package/dist/story/bun-test.d.ts +45 -0
- package/dist/story/bun-test.js +102 -0
- package/dist/story/cli.d.ts +132 -0
- package/dist/story/cli.js +155 -0
- package/dist/story/collect/analyzer.d.ts +33 -0
- package/dist/story/collect/analyzer.js +305 -0
- package/dist/story/collect/index.d.ts +31 -0
- package/dist/story/collect/index.js +27 -0
- package/dist/story/collect/parser.d.ts +17 -0
- package/dist/story/collect/parser.js +129 -0
- package/dist/story/collect/scanner.d.ts +17 -0
- package/dist/story/collect/scanner.js +101 -0
- package/dist/story/collect/tree.d.ts +24 -0
- package/dist/story/collect/tree.js +110 -0
- package/dist/story/commands/build.d.ts +19 -0
- package/dist/story/commands/build.js +172 -0
- package/dist/story/commands/dev.d.ts +23 -0
- package/dist/story/commands/dev.js +78 -0
- package/dist/story/commands/index.d.ts +9 -0
- package/dist/story/commands/index.js +3 -0
- package/dist/story/commands/preview.d.ts +21 -0
- package/dist/story/commands/preview.js +56 -0
- package/dist/story/compiled-output.d.ts +27 -0
- package/dist/story/compiled-output.js +151 -0
- package/dist/story/composition.d.ts +47 -0
- package/dist/story/composition.js +261 -0
- package/dist/story/config-watcher.d.ts +33 -0
- package/dist/story/config-watcher.js +67 -0
- package/dist/story/config.d.ts +29 -0
- package/dist/story/config.js +64 -0
- package/dist/story/context.d.ts +27 -0
- package/dist/story/context.js +27 -0
- package/dist/story/controls/index.d.ts +54 -0
- package/dist/story/controls/index.js +320 -0
- package/dist/story/desktop-preview.d.ts +34 -0
- package/dist/story/desktop-preview.js +105 -0
- package/dist/story/docs-generator.d.ts +30 -0
- package/dist/story/docs-generator.js +187 -0
- package/dist/story/errors.d.ts +47 -0
- package/dist/story/errors.js +239 -0
- package/dist/story/figma-export.d.ts +169 -0
- package/dist/story/figma-export.js +224 -0
- package/dist/story/generator.d.ts +21 -0
- package/dist/story/generator.js +165 -0
- package/dist/story/hmr.d.ts +62 -0
- package/dist/story/hmr.js +131 -0
- package/dist/story/hot-swap.d.ts +46 -0
- package/dist/story/hot-swap.js +207 -0
- package/dist/story/index.d.ts +99 -0
- package/dist/story/index.js +49 -0
- package/dist/story/interactions.d.ts +53 -0
- package/dist/story/interactions.js +225 -0
- package/dist/story/keyboard-shortcuts.d.ts +39 -0
- package/dist/story/keyboard-shortcuts.js +345 -0
- package/dist/story/output.d.ts +115 -0
- package/dist/story/output.js +153 -0
- package/dist/story/performance.d.ts +129 -0
- package/dist/story/performance.js +252 -0
- package/dist/story/presets.d.ts +123 -0
- package/dist/story/presets.js +289 -0
- package/dist/story/props-validation.d.ts +45 -0
- package/dist/story/props-validation.js +215 -0
- package/dist/story/renderer.d.ts +69 -0
- package/dist/story/renderer.js +209 -0
- package/dist/story/search-index.d.ts +47 -0
- package/dist/story/search-index.js +106 -0
- package/dist/story/search.d.ts +56 -0
- package/dist/story/search.js +140 -0
- package/dist/story/server.d.ts +31 -0
- package/dist/story/server.js +965 -0
- package/dist/story/setup.d.ts +56 -0
- package/dist/story/setup.js +78 -0
- package/dist/story/snapshots.d.ts +65 -0
- package/dist/story/snapshots.js +171 -0
- package/dist/story/testing.d.ts +83 -0
- package/dist/story/testing.js +164 -0
- package/dist/story/theme.d.ts +68 -0
- package/dist/story/theme.js +170 -0
- package/dist/story/ts-css.d.ts +29 -0
- package/dist/story/ts-css.js +189 -0
- package/dist/story/types.d.ts +342 -0
- package/dist/story/types.js +0 -0
- package/dist/story/ui/code-panel.d.ts +43 -0
- package/dist/story/ui/code-panel.js +175 -0
- package/dist/story/ui/controls-panel.d.ts +25 -0
- package/dist/story/ui/controls-panel.js +168 -0
- package/dist/story/ui/index.d.ts +8 -0
- package/dist/story/ui/index.js +4 -0
- package/dist/story/ui/navigation.d.ts +55 -0
- package/dist/story/ui/navigation.js +250 -0
- package/dist/story/ui/preview.d.ts +46 -0
- package/dist/story/ui/preview.js +251 -0
- package/dist/story/visual-testing.d.ts +45 -0
- package/dist/story/visual-testing.js +248 -0
- package/dist/streaming.d.ts +238 -0
- package/dist/streaming.js +537 -0
- package/dist/strict-lint.d.ts +52 -0
- package/dist/strict-lint.js +269 -0
- package/dist/strip-literals.d.ts +40 -0
- package/dist/strip-literals.js +149 -0
- package/dist/stx-virtual-ts.d.ts +358 -0
- package/dist/stx-virtual-ts.js +670 -0
- package/dist/stx.d.ts +924 -0
- package/dist/style-scoping.d.ts +42 -0
- package/dist/style-scoping.js +82 -0
- package/dist/suspense.d.ts +98 -0
- package/dist/suspense.js +398 -0
- package/dist/teleport.d.ts +31 -0
- package/dist/teleport.js +109 -0
- package/dist/template-compiler.d.ts +33 -0
- package/dist/template-compiler.js +68 -0
- package/dist/template-hydrator.d.ts +28 -0
- package/dist/template-hydrator.js +95 -0
- package/dist/template-tag-balance.d.ts +32 -0
- package/dist/template-tag-balance.js +93 -0
- package/dist/testing.d.ts +330 -0
- package/dist/testing.js +588 -0
- package/dist/theme-tokens.d.ts +88 -0
- package/dist/theme-tokens.js +71 -0
- package/dist/transitions.d.ts +99 -0
- package/dist/transitions.js +443 -0
- package/dist/ts-css-config.d.ts +71 -0
- package/dist/ts-css-config.js +44 -0
- package/dist/type-checker.d.ts +85 -0
- package/dist/type-checker.js +581 -0
- package/dist/typecheck.d.ts +70 -0
- package/dist/typecheck.js +365 -0
- package/dist/types/component-types.d.ts +248 -0
- package/dist/types/component-types.js +0 -0
- package/dist/types/config-types.d.ts +938 -0
- package/dist/types/config-types.js +0 -0
- package/dist/types/context-types.d.ts +122 -0
- package/dist/types/context-types.js +0 -0
- package/dist/types/csp-types.d.ts +83 -0
- package/dist/types/csp-types.js +0 -0
- package/dist/types/directive-types.d.ts +315 -0
- package/dist/types/directive-types.js +3 -0
- package/dist/types/index.d.ts +20 -0
- package/dist/types/index.js +1 -0
- package/dist/types/pwa-types.d.ts +338 -0
- package/dist/types/pwa-types.js +0 -0
- package/dist/types.d.ts +27 -0
- package/dist/types.js +1 -0
- package/dist/typescript-templates.d.ts +156 -0
- package/dist/typescript-templates.js +386 -0
- package/dist/unresolved-identifiers.d.ts +52 -0
- package/dist/unresolved-identifiers.js +148 -0
- package/dist/utils.d.ts +112 -0
- package/dist/utils.js +1170 -0
- package/dist/validator.d.ts +80 -0
- package/dist/validator.js +171 -0
- package/dist/variable-extractor.d.ts +142 -0
- package/dist/variable-extractor.js +1306 -0
- package/dist/view-composers.d.ts +171 -0
- package/dist/view-composers.js +29 -0
- package/dist/virtual-scrolling.d.ts +127 -0
- package/dist/virtual-scrolling.js +454 -0
- package/dist/visual-editor.d.ts +185 -0
- package/dist/visual-editor.js +735 -0
- package/dist/visual-testing.d.ts +135 -0
- package/dist/visual-testing.js +126 -0
- package/dist/vue-template.d.ts +39 -0
- package/dist/vue-template.js +476 -0
- package/dist/web-components/css-scoping.d.ts +64 -0
- package/dist/web-components/css-scoping.js +210 -0
- package/dist/web-components/index.d.ts +29 -0
- package/dist/web-components/index.js +13 -0
- package/dist/web-components/reactive-generator.d.ts +72 -0
- package/dist/web-components/reactive-generator.js +484 -0
- package/dist/web-components.d.ts +253 -0
- package/dist/web-components.js +1466 -0
- package/dist/x-element.d.ts +42 -0
- package/dist/x-element.js +301 -0
- package/package.json +107 -0
- package/stx.d.ts +924 -0
|
@@ -0,0 +1,1280 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{a as x,b as u,c as b,d as Az,e as G,f as d,h as y,i as I,j as Uz,k as v}from"./chunk-0y46fbkx.js";import{l as h,m as f,n as g}from"./chunk-q9n5swx7.js";import{to as V}from"./chunk-y11cxbxd.js";import"./chunk-92mj1t26.js";import"./chunk-8mjdpr94.js";import"./chunk-pkaabd8h.js";import"./chunk-xpp135ad.js";import"./chunk-wrzwgkbx.js";import"./chunk-5kk8gsj2.js";import"./chunk-38ejahd9.js";import"./chunk-ypmqf7tm.js";import"./chunk-de7fye10.js";import"./chunk-v5e1gxwm.js";import"./chunk-b6ej2fdf.js";import"./chunk-x650vjcp.js";import{gv as F}from"./chunk-qc1f74ek.js";import l from"fs";import R from"path";function m(z,J){let Z=[R.join(z.root,"stx.config.ts"),R.join(z.root,"stx.config.js"),R.join(z.root,"stx.config.mjs")],K=J.debounceMs??300,$=null,X=[];for(let B of Z)try{if(!l.existsSync(B))continue;let Y=l.watch(B,(W)=>{if(W==="change"){if($)clearTimeout($);$=setTimeout(async()=>{d("Config file changed, restarting...");try{await J.onChange()}catch(j){G(`Failed to restart: ${j}`)}},K)}});X.push(Y)}catch{}return{stop(){if($)clearTimeout($);for(let B of X)B.close()}}}import E from"fs";import i from"path";var Gz=".stx/story/analytics.json",Nz=1,c=1e4;class M{storage;storagePath;currentSession=null;dirty=!1;viewStartTimes=new Map;constructor(z){this.storagePath=i.join(z,Gz),this.storage=this.loadStorage(),this.startSession()}loadStorage(){try{let z=E.readFileSync(this.storagePath,"utf-8");return JSON.parse(z)}catch{return{version:Nz,events:[],sessions:[]}}}async save(){if(!this.dirty)return;let z=i.dirname(this.storagePath);if(await E.promises.mkdir(z,{recursive:!0}),this.storage.events.length>c)this.storage.events=this.storage.events.slice(-c);await E.promises.writeFile(this.storagePath,JSON.stringify(this.storage,null,2)),this.dirty=!1}startSession(){this.endSession(),this.currentSession={id:Hz(),startTime:Date.now(),componentViews:[]},this.storage.sessions.push(this.currentSession),this.dirty=!0}endSession(){if(this.currentSession)this.currentSession.endTime=Date.now(),this.currentSession=null}track(z){this.storage.events.push({...z,timestamp:Date.now()}),this.dirty=!0}trackView(z,J){if(this.endViewTiming(z),this.viewStartTimes.set(z,Date.now()),this.track({type:"view",componentId:z,variantId:J}),this.currentSession&&!this.currentSession.componentViews.includes(z))this.currentSession.componentViews.push(z)}endViewTiming(z){let J=this.viewStartTimes.get(z);if(J){let Z=Date.now()-J;this.track({type:"view",componentId:z,metadata:{duration:Z,endView:!0}}),this.viewStartTimes.delete(z)}}trackPropChange(z,J,Z){this.track({type:"prop_change",componentId:z,propName:J,metadata:{value:Z}})}trackVariantSwitch(z,J){this.track({type:"variant_switch",componentId:z,variantId:J})}trackSearch(z,J){this.track({type:"search",query:z,metadata:{resultCount:J}})}getComponentAnalytics(z,J){let Z=this.storage.events.filter((Q)=>Q.componentId===z),K=Z.filter((Q)=>Q.type==="view"&&!Q.metadata?.endView),$=Z.filter((Q)=>Q.type==="prop_change"),X=Z.filter((Q)=>Q.type==="variant_switch"),B={};for(let Q of $)if(Q.propName)B[Q.propName]=(B[Q.propName]||0)+1;let Y={};for(let Q of X)if(Q.variantId)Y[Q.variantId]=(Y[Q.variantId]||0)+1;let W=new Set(this.storage.sessions.filter((Q)=>Q.componentViews.includes(z)).map((Q)=>Q.id)),j=Z.filter((Q)=>Q.metadata?.duration).map((Q)=>Q.metadata.duration),U=j.length>0?j.reduce((Q,D)=>Q+D,0)/j.length:0,_=Object.entries(B).sort((Q,D)=>D[1]-Q[1]).slice(0,5).map(([Q])=>Q);return{componentId:z,componentName:J,viewCount:K.length,uniqueViews:W.size,lastViewed:K[K.length-1]?.timestamp,propChanges:B,topChangedProps:_,variantViews:Y,avgTimeSpent:U}}getMostViewedComponents(z=10){let J=new Map;for(let Z of this.storage.events)if(Z.type==="view"&&Z.componentId&&!Z.metadata?.endView)J.set(Z.componentId,(J.get(Z.componentId)||0)+1);return Array.from(J.entries()).map(([Z,K])=>({componentId:Z,viewCount:K})).sort((Z,K)=>K.viewCount-Z.viewCount).slice(0,z)}getMostChangedProps(z=10){let J=new Map;for(let Z of this.storage.events)if(Z.type==="prop_change"&&Z.propName)J.set(Z.propName,(J.get(Z.propName)||0)+1);return Array.from(J.entries()).map(([Z,K])=>({propName:Z,changeCount:K})).sort((Z,K)=>K.changeCount-Z.changeCount).slice(0,z)}getSearchAnalytics(){let z=this.storage.events.filter(($)=>$.type==="search"),J=new Map,Z=0;for(let $ of z){if($.query)J.set($.query,(J.get($.query)||0)+1);if($.metadata?.resultCount!==void 0)Z+=$.metadata.resultCount}let K=Array.from(J.entries()).map(([$,X])=>({query:$,count:X})).sort(($,X)=>X.count-$.count).slice(0,10);return{totalSearches:z.length,topQueries:K,avgResultCount:z.length>0?Z/z.length:0}}clear(){this.storage.events=[],this.storage.sessions=[],this.dirty=!0,this.startSession()}exportAnalytics(){return JSON.stringify({exportedAt:Date.now(),...this.storage},null,2)}}function Hz(){return`session-${Date.now()}-${Math.random().toString(36).slice(2,8)}`}import P from"fs";import p from"path";var Fz=".stx/story/bookmarks.json",Vz=1;class T{storage;storagePath;dirty=!1;constructor(z){this.storagePath=p.join(z,Fz),this.storage=this.loadStorage()}loadStorage(){try{let z=P.readFileSync(this.storagePath,"utf-8");return JSON.parse(z)}catch{return{version:Vz,bookmarks:[]}}}async save(){if(!this.dirty)return;let z=p.dirname(this.storagePath);await P.promises.mkdir(z,{recursive:!0}),await P.promises.writeFile(this.storagePath,JSON.stringify(this.storage,null,2)),this.dirty=!1}addBookmark(z,J,Z,K={}){let $={id:Rz(),name:K.name||`${z}/${J}`,storyId:z,variantId:J,props:Z,created:Date.now(),notes:K.notes,color:K.color};return this.storage.bookmarks.push($),this.dirty=!0,$}getAllBookmarks(){return[...this.storage.bookmarks]}getBookmarksForStory(z){return this.storage.bookmarks.filter((J)=>J.storyId===z)}getBookmark(z){return this.storage.bookmarks.find((J)=>J.id===z)}isBookmarked(z,J){return this.storage.bookmarks.some((Z)=>Z.storyId===z&&Z.variantId===J)}updateBookmark(z,J){let Z=this.getBookmark(z);if(!Z)return;return Object.assign(Z,J),this.dirty=!0,Z}deleteBookmark(z){let J=this.storage.bookmarks.findIndex((Z)=>Z.id===z);if(J===-1)return!1;return this.storage.bookmarks.splice(J,1),this.dirty=!0,!0}toggleBookmark(z,J,Z){let K=this.storage.bookmarks.find((X)=>X.storyId===z&&X.variantId===J);if(K)return this.deleteBookmark(K.id),{added:!1};return{added:!0,bookmark:this.addBookmark(z,J,Z)}}exportBookmarks(){return JSON.stringify(this.storage,null,2)}importBookmarks(z,J=!0){let Z=JSON.parse(z),K=0;for(let $ of Z.bookmarks){if(J){let X=this.storage.bookmarks.find((B)=>B.id===$.id);if(X)Object.assign(X,$);else this.storage.bookmarks.push($)}else this.storage.bookmarks.push($);K++}if(K>0)this.dirty=!0;return K}}function Rz(){return`bm-${Date.now()}-${Math.random().toString(36).slice(2,8)}`}var N=new Set;function s(){return{open(z){N.add(z),z.send(JSON.stringify({type:"connected",timestamp:Date.now()}))},close(z){N.delete(z)},message(z,J){}}}function q(z){let J=JSON.stringify({...z,timestamp:z.timestamp||Date.now()});for(let Z of N)try{Z.send(J)}catch{N.delete(Z)}}function n(z,J){q({type:"story-update",data:{storyId:z,...J}})}function a(z,J){q({type:"story-add",data:{storyId:z,...J}})}function o(z){q({type:"story-remove",data:{storyId:z}})}function r(z){return`
|
|
3
|
+
<script>
|
|
4
|
+
(function() {
|
|
5
|
+
const ws = new WebSocket('${z}');
|
|
6
|
+
|
|
7
|
+
ws.onopen = function() {
|
|
8
|
+
console.log('[STX Story] HMR connected');
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
ws.onmessage = function(event) {
|
|
12
|
+
const message = JSON.parse(event.data);
|
|
13
|
+
|
|
14
|
+
switch (message.type) {
|
|
15
|
+
case 'connected':
|
|
16
|
+
console.log('[STX Story] Connected to HMR server');
|
|
17
|
+
break;
|
|
18
|
+
|
|
19
|
+
case 'story-update':
|
|
20
|
+
console.log('[STX Story] Story updated:', message.data.storyId);
|
|
21
|
+
// Reload the current story if it matches
|
|
22
|
+
if (window.__stxStory && window.__stxStory.currentStoryId === message.data.storyId) {
|
|
23
|
+
window.__stxStory.reloadCurrentStory();
|
|
24
|
+
}
|
|
25
|
+
break;
|
|
26
|
+
|
|
27
|
+
case 'story-add':
|
|
28
|
+
console.log('[STX Story] Story added:', message.data.storyId);
|
|
29
|
+
window.__stxStory && window.__stxStory.refreshStoryList();
|
|
30
|
+
break;
|
|
31
|
+
|
|
32
|
+
case 'story-remove':
|
|
33
|
+
console.log('[STX Story] Story removed:', message.data.storyId);
|
|
34
|
+
window.__stxStory && window.__stxStory.refreshStoryList();
|
|
35
|
+
break;
|
|
36
|
+
|
|
37
|
+
case 'config-change':
|
|
38
|
+
console.log('[STX Story] Config changed, reloading...');
|
|
39
|
+
location.reload();
|
|
40
|
+
break;
|
|
41
|
+
|
|
42
|
+
case 'full-reload':
|
|
43
|
+
console.log('[STX Story] Full reload requested');
|
|
44
|
+
location.reload();
|
|
45
|
+
break;
|
|
46
|
+
|
|
47
|
+
case 'error':
|
|
48
|
+
console.error('[STX Story] Error:', message.data.error);
|
|
49
|
+
break;
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
ws.onclose = function() {
|
|
54
|
+
console.log('[STX Story] HMR disconnected, attempting reconnect...');
|
|
55
|
+
setTimeout(function() {
|
|
56
|
+
location.reload();
|
|
57
|
+
}, 1000);
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
ws.onerror = function(error) {
|
|
61
|
+
console.error('[STX Story] WebSocket error:', error);
|
|
62
|
+
};
|
|
63
|
+
})();
|
|
64
|
+
</script>
|
|
65
|
+
`}function e(){return`
|
|
66
|
+
<script>
|
|
67
|
+
(function() {
|
|
68
|
+
// Hot swap state
|
|
69
|
+
window.__stxHotSwap = {
|
|
70
|
+
storyId: null,
|
|
71
|
+
variantId: null,
|
|
72
|
+
props: {},
|
|
73
|
+
iframe: null,
|
|
74
|
+
|
|
75
|
+
// Initialize hot swap
|
|
76
|
+
init: function(iframeSelector) {
|
|
77
|
+
this.iframe = document.querySelector(iframeSelector);
|
|
78
|
+
if (!this.iframe) {
|
|
79
|
+
console.warn('[STX Story] Hot swap iframe not found');
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
// Listen for variant changes
|
|
84
|
+
window.addEventListener('stx:variant-change', this.handleVariantChange.bind(this));
|
|
85
|
+
window.addEventListener('stx:props-change', this.handlePropsChange.bind(this));
|
|
86
|
+
|
|
87
|
+
console.log('[STX Story] Hot swap initialized');
|
|
88
|
+
},
|
|
89
|
+
|
|
90
|
+
// Handle variant change
|
|
91
|
+
handleVariantChange: function(event) {
|
|
92
|
+
const { storyId, variantId } = event.detail;
|
|
93
|
+
|
|
94
|
+
if (this.storyId === storyId && this.variantId === variantId) {
|
|
95
|
+
return; // No change
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
this.storyId = storyId;
|
|
99
|
+
this.variantId = variantId;
|
|
100
|
+
|
|
101
|
+
this.swapContent();
|
|
102
|
+
},
|
|
103
|
+
|
|
104
|
+
// Handle props change
|
|
105
|
+
handlePropsChange: function(event) {
|
|
106
|
+
const { props } = event.detail;
|
|
107
|
+
this.props = { ...this.props, ...props };
|
|
108
|
+
this.updateProps();
|
|
109
|
+
},
|
|
110
|
+
|
|
111
|
+
// Swap iframe content without reload
|
|
112
|
+
swapContent: async function() {
|
|
113
|
+
if (!this.iframe || !this.storyId || !this.variantId) return;
|
|
114
|
+
|
|
115
|
+
// Save scroll position
|
|
116
|
+
const scrollTop = this.iframe.contentWindow?.scrollY || 0;
|
|
117
|
+
const scrollLeft = this.iframe.contentWindow?.scrollX || 0;
|
|
118
|
+
|
|
119
|
+
// Fetch new content
|
|
120
|
+
try {
|
|
121
|
+
const response = await fetch('/api/render/' + this.storyId + '/' + this.variantId);
|
|
122
|
+
const data = await response.json();
|
|
123
|
+
|
|
124
|
+
if (data.html) {
|
|
125
|
+
// Fade out
|
|
126
|
+
this.iframe.style.opacity = '0.5';
|
|
127
|
+
this.iframe.style.transition = 'opacity 150ms ease';
|
|
128
|
+
|
|
129
|
+
// Update content
|
|
130
|
+
const doc = this.iframe.contentDocument;
|
|
131
|
+
if (doc) {
|
|
132
|
+
// Find body or create one
|
|
133
|
+
let body = doc.body;
|
|
134
|
+
if (!body) {
|
|
135
|
+
doc.write('<html><head></head><body></body></html>');
|
|
136
|
+
body = doc.body;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
// Update body content
|
|
140
|
+
body.innerHTML = data.html;
|
|
141
|
+
|
|
142
|
+
// Update styles if provided
|
|
143
|
+
if (data.css) {
|
|
144
|
+
let styleEl = doc.getElementById('stx-component-styles');
|
|
145
|
+
if (!styleEl) {
|
|
146
|
+
styleEl = doc.createElement('style');
|
|
147
|
+
styleEl.id = 'stx-component-styles';
|
|
148
|
+
doc.head.appendChild(styleEl);
|
|
149
|
+
}
|
|
150
|
+
styleEl.textContent = data.css;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
// Restore scroll position
|
|
154
|
+
this.iframe.contentWindow?.scrollTo(scrollLeft, scrollTop);
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
// Fade in
|
|
158
|
+
setTimeout(() => {
|
|
159
|
+
this.iframe.style.opacity = '1';
|
|
160
|
+
}, 50);
|
|
161
|
+
|
|
162
|
+
// Dispatch event
|
|
163
|
+
window.dispatchEvent(new CustomEvent('stx:swap-complete', {
|
|
164
|
+
detail: { storyId: this.storyId, variantId: this.variantId }
|
|
165
|
+
}));
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
catch (error) {
|
|
169
|
+
console.error('[STX Story] Hot swap failed:', error);
|
|
170
|
+
// Fallback to full reload
|
|
171
|
+
this.iframe.src = '/preview/' + this.storyId + '/' + this.variantId;
|
|
172
|
+
}
|
|
173
|
+
},
|
|
174
|
+
|
|
175
|
+
// Update props in iframe without content swap
|
|
176
|
+
updateProps: function() {
|
|
177
|
+
if (!this.iframe) return;
|
|
178
|
+
|
|
179
|
+
const win = this.iframe.contentWindow;
|
|
180
|
+
if (win && win.__stxProps) {
|
|
181
|
+
Object.assign(win.__stxProps, this.props);
|
|
182
|
+
|
|
183
|
+
// Trigger re-render if component supports it
|
|
184
|
+
if (win.__stxRerender) {
|
|
185
|
+
win.__stxRerender(this.props);
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
window.dispatchEvent(new CustomEvent('stx:props-updated', {
|
|
189
|
+
detail: { props: this.props }
|
|
190
|
+
}));
|
|
191
|
+
}
|
|
192
|
+
},
|
|
193
|
+
|
|
194
|
+
// Select a variant
|
|
195
|
+
selectVariant: function(storyId, variantId) {
|
|
196
|
+
window.dispatchEvent(new CustomEvent('stx:variant-change', {
|
|
197
|
+
detail: { storyId, variantId }
|
|
198
|
+
}));
|
|
199
|
+
},
|
|
200
|
+
|
|
201
|
+
// Update a prop
|
|
202
|
+
updateProp: function(name, value) {
|
|
203
|
+
window.dispatchEvent(new CustomEvent('stx:props-change', {
|
|
204
|
+
detail: { props: { [name]: value } }
|
|
205
|
+
}));
|
|
206
|
+
},
|
|
207
|
+
|
|
208
|
+
// Reset props to defaults
|
|
209
|
+
resetProps: function() {
|
|
210
|
+
this.props = {};
|
|
211
|
+
this.swapContent();
|
|
212
|
+
}
|
|
213
|
+
};
|
|
214
|
+
|
|
215
|
+
// Auto-initialize when DOM is ready
|
|
216
|
+
if (document.readyState === 'loading') {
|
|
217
|
+
document.addEventListener('DOMContentLoaded', function() {
|
|
218
|
+
window.__stxHotSwap.init('#preview-iframe');
|
|
219
|
+
});
|
|
220
|
+
}
|
|
221
|
+
else {
|
|
222
|
+
window.__stxHotSwap.init('#preview-iframe');
|
|
223
|
+
}
|
|
224
|
+
})();
|
|
225
|
+
</script>
|
|
226
|
+
`}var t=[{key:"k",modifiers:["meta"],description:"Open search",category:"Navigation",action:"openSearch"},{key:"ArrowUp",description:"Previous story",category:"Navigation",action:"prevStory"},{key:"ArrowDown",description:"Next story",category:"Navigation",action:"nextStory"},{key:"ArrowLeft",description:"Previous variant",category:"Navigation",action:"prevVariant"},{key:"ArrowRight",description:"Next variant",category:"Navigation",action:"nextVariant"},{key:"Enter",description:"Select story",category:"Navigation",action:"selectStory"},{key:"Escape",description:"Close panel/modal",category:"Navigation",action:"closePanel"},{key:"d",description:"Toggle dark mode",category:"View",action:"toggleDarkMode"},{key:"f",description:"Toggle fullscreen",category:"View",action:"toggleFullscreen"},{key:"s",description:"Toggle sidebar",category:"View",action:"toggleSidebar"},{key:"a",description:"Toggle addons panel",category:"View",action:"toggleAddons"},{key:"z",description:"Zoom in",category:"View",action:"zoomIn"},{key:"x",description:"Zoom out",category:"View",action:"zoomOut"},{key:"0",description:"Reset zoom",category:"View",action:"resetZoom"},{key:"r",description:"Reload story",category:"Actions",action:"reloadStory"},{key:"c",description:"Copy story code",category:"Actions",action:"copyCode"},{key:"p",description:"Open props panel",category:"Actions",action:"openProps"},{key:"b",description:"Toggle bookmark",category:"Actions",action:"toggleBookmark"},{key:"t",description:"Run tests",category:"Actions",action:"runTests"},{key:"?",description:"Show shortcuts",category:"Help",action:"showShortcuts"}];function Ez(z){let J=[];if(z.modifiers)for(let K of z.modifiers)switch(K){case"meta":J.push("\u2318");break;case"ctrl":J.push("Ctrl");break;case"alt":J.push("Alt");break;case"shift":J.push("\u21E7");break}let Z=z.key;switch(Z){case"ArrowUp":Z="\u2191";break;case"ArrowDown":Z="\u2193";break;case"ArrowLeft":Z="\u2190";break;case"ArrowRight":Z="\u2192";break;case"Enter":Z="\u21B5";break;case"Escape":Z="Esc";break;default:Z=Z.toUpperCase()}return J.push(Z),J.join(" + ")}function zz(z=t){let J=new Map;for(let K of z){let $=J.get(K.category)||[];$.push(K),J.set(K.category,$)}return`
|
|
227
|
+
<div class="shortcuts-modal" id="shortcuts-modal" style="display: none;">
|
|
228
|
+
<div class="shortcuts-backdrop" onclick="closeShortcutsModal()"></div>
|
|
229
|
+
<div class="shortcuts-content">
|
|
230
|
+
<div class="shortcuts-header">
|
|
231
|
+
<h3>Keyboard Shortcuts</h3>
|
|
232
|
+
<button class="shortcuts-close" onclick="closeShortcutsModal()">\xD7</button>
|
|
233
|
+
</div>
|
|
234
|
+
<div class="shortcuts-body">
|
|
235
|
+
${Array.from(J.entries()).map(([K,$])=>`
|
|
236
|
+
<div class="shortcuts-category">
|
|
237
|
+
<h4>${K}</h4>
|
|
238
|
+
<div class="shortcuts-list">
|
|
239
|
+
${$.map((X)=>`
|
|
240
|
+
<div class="shortcut-item">
|
|
241
|
+
<span class="shortcut-desc">${X.description}</span>
|
|
242
|
+
<kbd class="shortcut-key">${Ez(X)}</kbd>
|
|
243
|
+
</div>
|
|
244
|
+
`).join("")}
|
|
245
|
+
</div>
|
|
246
|
+
</div>
|
|
247
|
+
`).join("")}
|
|
248
|
+
</div>
|
|
249
|
+
</div>
|
|
250
|
+
</div>
|
|
251
|
+
`}function Jz(){return`
|
|
252
|
+
.shortcuts-modal {
|
|
253
|
+
position: fixed;
|
|
254
|
+
inset: 0;
|
|
255
|
+
z-index: 1000;
|
|
256
|
+
display: flex;
|
|
257
|
+
align-items: center;
|
|
258
|
+
justify-content: center;
|
|
259
|
+
}
|
|
260
|
+
.shortcuts-backdrop {
|
|
261
|
+
position: absolute;
|
|
262
|
+
inset: 0;
|
|
263
|
+
background: rgba(0, 0, 0, 0.5);
|
|
264
|
+
}
|
|
265
|
+
.shortcuts-content {
|
|
266
|
+
position: relative;
|
|
267
|
+
background: var(--bg);
|
|
268
|
+
border-radius: 12px;
|
|
269
|
+
box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
|
|
270
|
+
max-width: 600px;
|
|
271
|
+
max-height: 80vh;
|
|
272
|
+
overflow: hidden;
|
|
273
|
+
display: flex;
|
|
274
|
+
flex-direction: column;
|
|
275
|
+
}
|
|
276
|
+
.shortcuts-header {
|
|
277
|
+
display: flex;
|
|
278
|
+
justify-content: space-between;
|
|
279
|
+
align-items: center;
|
|
280
|
+
padding: 16px 20px;
|
|
281
|
+
border-bottom: 1px solid var(--border);
|
|
282
|
+
}
|
|
283
|
+
.shortcuts-header h3 {
|
|
284
|
+
margin: 0;
|
|
285
|
+
font-size: 16px;
|
|
286
|
+
}
|
|
287
|
+
.shortcuts-close {
|
|
288
|
+
background: none;
|
|
289
|
+
border: none;
|
|
290
|
+
font-size: 24px;
|
|
291
|
+
cursor: pointer;
|
|
292
|
+
color: var(--text-secondary);
|
|
293
|
+
padding: 0;
|
|
294
|
+
line-height: 1;
|
|
295
|
+
}
|
|
296
|
+
.shortcuts-body {
|
|
297
|
+
padding: 20px;
|
|
298
|
+
overflow-y: auto;
|
|
299
|
+
display: grid;
|
|
300
|
+
grid-template-columns: repeat(2, 1fr);
|
|
301
|
+
gap: 24px;
|
|
302
|
+
}
|
|
303
|
+
.shortcuts-category h4 {
|
|
304
|
+
margin: 0 0 12px;
|
|
305
|
+
font-size: 12px;
|
|
306
|
+
text-transform: uppercase;
|
|
307
|
+
color: var(--text-secondary);
|
|
308
|
+
letter-spacing: 0.5px;
|
|
309
|
+
}
|
|
310
|
+
.shortcuts-list {
|
|
311
|
+
display: flex;
|
|
312
|
+
flex-direction: column;
|
|
313
|
+
gap: 8px;
|
|
314
|
+
}
|
|
315
|
+
.shortcut-item {
|
|
316
|
+
display: flex;
|
|
317
|
+
justify-content: space-between;
|
|
318
|
+
align-items: center;
|
|
319
|
+
gap: 12px;
|
|
320
|
+
}
|
|
321
|
+
.shortcut-desc {
|
|
322
|
+
font-size: 13px;
|
|
323
|
+
color: var(--text);
|
|
324
|
+
}
|
|
325
|
+
.shortcut-key {
|
|
326
|
+
font-family: monospace;
|
|
327
|
+
font-size: 11px;
|
|
328
|
+
padding: 4px 8px;
|
|
329
|
+
background: var(--bg-secondary);
|
|
330
|
+
border: 1px solid var(--border);
|
|
331
|
+
border-radius: 4px;
|
|
332
|
+
color: var(--text-secondary);
|
|
333
|
+
white-space: nowrap;
|
|
334
|
+
}
|
|
335
|
+
`}function Zz(){return`
|
|
336
|
+
<script>
|
|
337
|
+
window.__stxShortcuts = {
|
|
338
|
+
shortcuts: ${JSON.stringify(t)},
|
|
339
|
+
|
|
340
|
+
init() {
|
|
341
|
+
document.addEventListener('keydown', this.handleKeydown.bind(this));
|
|
342
|
+
},
|
|
343
|
+
|
|
344
|
+
handleKeydown(event) {
|
|
345
|
+
// Don't handle if typing in input
|
|
346
|
+
if (event.target.tagName === 'INPUT' || event.target.tagName === 'TEXTAREA') {
|
|
347
|
+
return;
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
const shortcut = this.findShortcut(event);
|
|
351
|
+
if (shortcut) {
|
|
352
|
+
event.preventDefault();
|
|
353
|
+
this.executeAction(shortcut.action);
|
|
354
|
+
}
|
|
355
|
+
},
|
|
356
|
+
|
|
357
|
+
findShortcut(event) {
|
|
358
|
+
return this.shortcuts.find(s => {
|
|
359
|
+
if (s.key.toLowerCase() !== event.key.toLowerCase()) return false;
|
|
360
|
+
|
|
361
|
+
const mods = s.modifiers || [];
|
|
362
|
+
if (mods.includes('meta') !== event.metaKey) return false;
|
|
363
|
+
if (mods.includes('ctrl') !== event.ctrlKey) return false;
|
|
364
|
+
if (mods.includes('alt') !== event.altKey) return false;
|
|
365
|
+
if (mods.includes('shift') !== event.shiftKey) return false;
|
|
366
|
+
|
|
367
|
+
return true;
|
|
368
|
+
});
|
|
369
|
+
},
|
|
370
|
+
|
|
371
|
+
executeAction(action) {
|
|
372
|
+
switch (action) {
|
|
373
|
+
case 'openSearch':
|
|
374
|
+
document.getElementById('search-input')?.focus();
|
|
375
|
+
break;
|
|
376
|
+
case 'prevStory':
|
|
377
|
+
this.navigateStory(-1);
|
|
378
|
+
break;
|
|
379
|
+
case 'nextStory':
|
|
380
|
+
this.navigateStory(1);
|
|
381
|
+
break;
|
|
382
|
+
case 'prevVariant':
|
|
383
|
+
this.navigateVariant(-1);
|
|
384
|
+
break;
|
|
385
|
+
case 'nextVariant':
|
|
386
|
+
this.navigateVariant(1);
|
|
387
|
+
break;
|
|
388
|
+
case 'selectStory':
|
|
389
|
+
document.querySelector('.story-item.focused')?.click();
|
|
390
|
+
break;
|
|
391
|
+
case 'closePanel':
|
|
392
|
+
this.closeActivePanel();
|
|
393
|
+
break;
|
|
394
|
+
case 'toggleDarkMode':
|
|
395
|
+
document.documentElement.classList.toggle('dark');
|
|
396
|
+
break;
|
|
397
|
+
case 'toggleFullscreen':
|
|
398
|
+
this.toggleFullscreen();
|
|
399
|
+
break;
|
|
400
|
+
case 'toggleSidebar':
|
|
401
|
+
document.querySelector('.sidebar')?.classList.toggle('hidden');
|
|
402
|
+
break;
|
|
403
|
+
case 'toggleAddons':
|
|
404
|
+
document.querySelector('.addons-panel')?.classList.toggle('hidden');
|
|
405
|
+
break;
|
|
406
|
+
case 'zoomIn':
|
|
407
|
+
window.__stxStory?.zoomIn?.();
|
|
408
|
+
break;
|
|
409
|
+
case 'zoomOut':
|
|
410
|
+
window.__stxStory?.zoomOut?.();
|
|
411
|
+
break;
|
|
412
|
+
case 'resetZoom':
|
|
413
|
+
window.__stxStory?.resetZoom?.();
|
|
414
|
+
break;
|
|
415
|
+
case 'reloadStory':
|
|
416
|
+
window.__stxStory?.reloadCurrentStory?.();
|
|
417
|
+
break;
|
|
418
|
+
case 'copyCode':
|
|
419
|
+
window.__stxStory?.copyCode?.();
|
|
420
|
+
break;
|
|
421
|
+
case 'openProps':
|
|
422
|
+
document.querySelector('[data-panel="props"]')?.click();
|
|
423
|
+
break;
|
|
424
|
+
case 'toggleBookmark':
|
|
425
|
+
window.__stxBookmarks?.toggleCurrent?.();
|
|
426
|
+
break;
|
|
427
|
+
case 'runTests':
|
|
428
|
+
window.__stxStory?.runTests?.();
|
|
429
|
+
break;
|
|
430
|
+
case 'showShortcuts':
|
|
431
|
+
this.showModal();
|
|
432
|
+
break;
|
|
433
|
+
}
|
|
434
|
+
},
|
|
435
|
+
|
|
436
|
+
navigateStory(direction) {
|
|
437
|
+
const items = Array.from(document.querySelectorAll('.story-item'));
|
|
438
|
+
const current = document.querySelector('.story-item.active');
|
|
439
|
+
const currentIndex = current ? items.indexOf(current) : -1;
|
|
440
|
+
const nextIndex = Math.max(0, Math.min(items.length - 1, currentIndex + direction));
|
|
441
|
+
items[nextIndex]?.click();
|
|
442
|
+
},
|
|
443
|
+
|
|
444
|
+
navigateVariant(direction) {
|
|
445
|
+
const buttons = Array.from(document.querySelectorAll('.variant-btn'));
|
|
446
|
+
const current = document.querySelector('.variant-btn.active');
|
|
447
|
+
const currentIndex = current ? buttons.indexOf(current) : -1;
|
|
448
|
+
const nextIndex = Math.max(0, Math.min(buttons.length - 1, currentIndex + direction));
|
|
449
|
+
buttons[nextIndex]?.click();
|
|
450
|
+
},
|
|
451
|
+
|
|
452
|
+
closeActivePanel() {
|
|
453
|
+
const modal = document.querySelector('.shortcuts-modal[style*="flex"]');
|
|
454
|
+
if (modal) {
|
|
455
|
+
closeShortcutsModal();
|
|
456
|
+
return;
|
|
457
|
+
}
|
|
458
|
+
// Close other panels
|
|
459
|
+
document.querySelector('.panel.open')?.classList.remove('open');
|
|
460
|
+
},
|
|
461
|
+
|
|
462
|
+
toggleFullscreen() {
|
|
463
|
+
if (document.fullscreenElement) {
|
|
464
|
+
document.exitFullscreen();
|
|
465
|
+
}
|
|
466
|
+
else {
|
|
467
|
+
document.documentElement.requestFullscreen();
|
|
468
|
+
}
|
|
469
|
+
},
|
|
470
|
+
|
|
471
|
+
showModal() {
|
|
472
|
+
const modal = document.getElementById('shortcuts-modal');
|
|
473
|
+
if (modal) modal.style.display = 'flex';
|
|
474
|
+
}
|
|
475
|
+
};
|
|
476
|
+
|
|
477
|
+
function closeShortcutsModal() {
|
|
478
|
+
const modal = document.getElementById('shortcuts-modal');
|
|
479
|
+
if (modal) modal.style.display = 'none';
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
// Initialize on load
|
|
483
|
+
if (document.readyState === 'loading') {
|
|
484
|
+
document.addEventListener('DOMContentLoaded', () => window.__stxShortcuts.init());
|
|
485
|
+
}
|
|
486
|
+
else {
|
|
487
|
+
window.__stxShortcuts.init();
|
|
488
|
+
}
|
|
489
|
+
</script>
|
|
490
|
+
`}class $z{metrics=new Map;maxHistorySize=100;enabled=!0;setEnabled(z){this.enabled=z}recordRender(z,J,Z,K){if(!this.enabled)return;let $=this.metrics.get(z);if(!$)$={componentId:z,componentName:J,renderCount:0,totalRenderTime:0,avgRenderTime:0,minRenderTime:1/0,maxRenderTime:0,lastRenderTime:0,history:[]},this.metrics.set(z,$);$.renderCount++,$.totalRenderTime+=Z,$.avgRenderTime=$.totalRenderTime/$.renderCount,$.minRenderTime=Math.min($.minRenderTime,Z),$.maxRenderTime=Math.max($.maxRenderTime,Z),$.lastRenderTime=Z;let X=this.getMemoryUsage();if(X!==void 0)$.memoryUsage=X;if($.history.push({timestamp:Date.now(),duration:Z,props:K,memory:X}),$.history.length>this.maxHistorySize)$.history=$.history.slice(-this.maxHistorySize)}getMetrics(z){return this.metrics.get(z)}getAllMetrics(){return Array.from(this.metrics.values())}getSlowestComponents(z=10){return this.getAllMetrics().sort((J,Z)=>Z.avgRenderTime-J.avgRenderTime).slice(0,z)}getMostRenderedComponents(z=10){return this.getAllMetrics().sort((J,Z)=>Z.renderCount-J.renderCount).slice(0,z)}clear(){this.metrics.clear()}clearComponent(z){this.metrics.delete(z)}getMemoryUsage(){if(typeof performance<"u"&&"memory"in performance)return performance.memory?.usedJSHeapSize;return}exportMetrics(){return JSON.stringify({timestamp:Date.now(),metrics:this.getAllMetrics()},null,2)}createTimer(z,J){return new Yz(this,z,J)}}class Yz{profiler;componentId;componentName;startTime;props;constructor(z,J,Z){this.profiler=z;this.componentId=J;this.componentName=Z;this.startTime=performance.now()}setProps(z){return this.props=z,this}end(){let z=performance.now()-this.startTime;return this.profiler.recordRender(this.componentId,this.componentName,z,this.props),z}}var tz=new $z;function Kz(){return`
|
|
491
|
+
<script>
|
|
492
|
+
window.__stxPerformance = {
|
|
493
|
+
metrics: new Map(),
|
|
494
|
+
|
|
495
|
+
recordRender(componentId, componentName, duration, props) {
|
|
496
|
+
let m = this.metrics.get(componentId);
|
|
497
|
+
if (!m) {
|
|
498
|
+
m = {
|
|
499
|
+
componentId,
|
|
500
|
+
componentName,
|
|
501
|
+
renderCount: 0,
|
|
502
|
+
totalRenderTime: 0,
|
|
503
|
+
avgRenderTime: 0,
|
|
504
|
+
minRenderTime: Infinity,
|
|
505
|
+
maxRenderTime: 0,
|
|
506
|
+
lastRenderTime: 0,
|
|
507
|
+
history: []
|
|
508
|
+
};
|
|
509
|
+
this.metrics.set(componentId, m);
|
|
510
|
+
}
|
|
511
|
+
|
|
512
|
+
m.renderCount++;
|
|
513
|
+
m.totalRenderTime += duration;
|
|
514
|
+
m.avgRenderTime = m.totalRenderTime / m.renderCount;
|
|
515
|
+
m.minRenderTime = Math.min(m.minRenderTime, duration);
|
|
516
|
+
m.maxRenderTime = Math.max(m.maxRenderTime, duration);
|
|
517
|
+
m.lastRenderTime = duration;
|
|
518
|
+
|
|
519
|
+
m.history.push({ timestamp: Date.now(), duration, props });
|
|
520
|
+
if (m.history.length > 100) m.history.shift();
|
|
521
|
+
|
|
522
|
+
this.updatePanel();
|
|
523
|
+
},
|
|
524
|
+
|
|
525
|
+
getMetrics() {
|
|
526
|
+
return Array.from(this.metrics.values());
|
|
527
|
+
},
|
|
528
|
+
|
|
529
|
+
clear() {
|
|
530
|
+
this.metrics.clear();
|
|
531
|
+
this.updatePanel();
|
|
532
|
+
},
|
|
533
|
+
|
|
534
|
+
updatePanel() {
|
|
535
|
+
const panel = document.getElementById('performance-panel');
|
|
536
|
+
if (panel) {
|
|
537
|
+
// Update panel content
|
|
538
|
+
window.dispatchEvent(new CustomEvent('stx:performance-update', {
|
|
539
|
+
detail: { metrics: this.getMetrics() }
|
|
540
|
+
}));
|
|
541
|
+
}
|
|
542
|
+
},
|
|
543
|
+
|
|
544
|
+
// Timer helper
|
|
545
|
+
startTimer(componentId, componentName) {
|
|
546
|
+
const start = performance.now();
|
|
547
|
+
return {
|
|
548
|
+
end: (props) => {
|
|
549
|
+
const duration = performance.now() - start;
|
|
550
|
+
this.recordRender(componentId, componentName, duration, props);
|
|
551
|
+
return duration;
|
|
552
|
+
}
|
|
553
|
+
};
|
|
554
|
+
}
|
|
555
|
+
};
|
|
556
|
+
|
|
557
|
+
window.clearPerformanceMetrics = () => window.__stxPerformance.clear();
|
|
558
|
+
</script>
|
|
559
|
+
`}import w from"fs";import Xz from"path";var Mz=".stx/story/presets.json",C=1,Pz=10;class k{storage;storagePath;dirty=!1;constructor(z){this.storagePath=Xz.join(z,Mz),this.storage=this.loadStorage()}loadStorage(){try{let z=w.readFileSync(this.storagePath,"utf-8"),J=JSON.parse(z);if(J.version!==C)return this.migrateStorage(J);return J}catch{return{version:C,presets:[],recentIds:[]}}}migrateStorage(z){return{version:C,presets:z.presets||[],recentIds:z.recentIds||[]}}async save(){if(!this.dirty)return;let z=Xz.dirname(this.storagePath);await w.promises.mkdir(z,{recursive:!0}),await w.promises.writeFile(this.storagePath,JSON.stringify(this.storage,null,2)),this.dirty=!1}createPreset(z,J,Z={}){let K={id:Tz(),name:z,description:Z.description,props:J,componentId:Z.componentId,created:Date.now(),usageCount:0,tags:Z.tags};return this.storage.presets.push(K),this.dirty=!0,K}getPreset(z){return this.storage.presets.find((J)=>J.id===z)}getAllPresets(){return[...this.storage.presets]}getPresetsForComponent(z){return this.storage.presets.filter((J)=>!J.componentId||J.componentId===z)}getRecentPresets(){return this.storage.recentIds.map((z)=>this.getPreset(z)).filter((z)=>z!==void 0)}usePreset(z){let J=this.getPreset(z);if(!J)return;return J.lastUsed=Date.now(),J.usageCount++,this.storage.recentIds=[z,...this.storage.recentIds.filter((Z)=>Z!==z)].slice(0,Pz),this.dirty=!0,J}updatePreset(z,J){let Z=this.getPreset(z);if(!Z)return;return Object.assign(Z,J),this.dirty=!0,Z}deletePreset(z){let J=this.storage.presets.findIndex((Z)=>Z.id===z);if(J===-1)return!1;return this.storage.presets.splice(J,1),this.storage.recentIds=this.storage.recentIds.filter((Z)=>Z!==z),this.dirty=!0,!0}searchPresets(z){let J=z.toLowerCase();return this.storage.presets.filter((Z)=>{if(Z.name.toLowerCase().includes(J))return!0;if(Z.description?.toLowerCase().includes(J))return!0;if(Z.tags?.some((K)=>K.toLowerCase().includes(J)))return!0;return!1})}getMostUsedPresets(z=5){return[...this.storage.presets].sort((J,Z)=>Z.usageCount-J.usageCount).slice(0,z)}exportPresets(z){let J=z?this.storage.presets.filter((Z)=>z.includes(Z.id)):this.storage.presets;return JSON.stringify({presets:J},null,2)}importPresets(z,J=!1){let Z=JSON.parse(z),K=0;for(let $ of Z.presets){let X=this.storage.presets.find((B)=>B.id===$.id);if(X&&!J)continue;if(X)Object.assign(X,$);else this.storage.presets.push($);K++}if(K>0)this.dirty=!0;return K}}function Tz(){return`preset-${Date.now()}-${Math.random().toString(36).slice(2,8)}`}import S from"fs";var Qz=new Map;async function H(z,J,Z={}){let K=performance.now(),$=[];try{let X=await S.promises.stat(J),B=Qz.get(J),Y;if(B&&B.mtime===X.mtimeMs)Y=B.content;else Y=await S.promises.readFile(J,"utf-8"),Qz.set(J,{content:Y,mtime:X.mtimeMs,analyzed:null});let{processDirectives:W}=await import("./chunk-r7r66978.js"),j={},U=A(Y);if(U)try{await V(U,j,J)}catch(O){$.push(`Warning: Could not extract script variables: ${O instanceof Error?O.message:String(O)}`)}if(Z.props)Object.assign(j,Z.props);let Q=await W(Y,j,J,{},new Set),D=Wz(Y),L=A(Y);return Q=jz(Q),Q=Dz(Q,j),{html:Q,css:D,js:L,errors:$,duration:performance.now()-K}}catch(X){return $.push(X instanceof Error?X.message:String(X)),{html:`<div class="stx-render-error">${Lz($[0])}</div>`,css:"",js:"",errors:$,duration:performance.now()-K}}}async function qz(z){try{let J=await S.promises.readFile(z,"utf-8"),Z=A(J);if(!Z)return null;let K={};if(await V(Z,K,z),Array.isArray(K.variants))return K.variants;return null}catch{return null}}async function Bz(z,J,Z,K){let $=J.story?.variants;if(!$){let Y=await qz(J.path);if(Y)$=Y}if(!$&&Z==="default")return H(z,J.path,{props:K||{}});if(!$)return H(z,J.path,{props:K||{}});let X=$.find((Y)=>Y.id===Z);if(!X&&Z==="default")return H(z,J.path,{props:K||{}});if(!X)return{html:'<div class="stx-render-error">Variant not found</div>',css:"",js:"",errors:[`Variant '${Z}' not found`],duration:0};let B={...X.state,...K};if(X.source)return wz(z,X.source,B);return H(z,J.path,{props:B})}async function wz(z,J,Z={}){let K=performance.now(),$=[];try{let{processDirectives:X}=await import("./chunk-r7r66978.js"),B={...Z},Y=A(J);if(Y)try{await V(Y,B,"inline-template.stx")}catch{}let j=await X(J,B,"inline-template.stx",{},new Set);return j=jz(j),j=Dz(j,B),{html:j,css:Wz(J),js:A(J),errors:$,duration:performance.now()-K}}catch(X){return $.push(X instanceof Error?X.message:String(X)),{html:`<div class="stx-render-error">${Lz($[0])}</div>`,css:"",js:"",errors:$,duration:performance.now()-K}}}function Wz(z){let J=[],Z=/<style\b[^>]*>([\s\S]*?)<\/style>/gi,K=Z.exec(z);while(K!==null)J.push(K[1].trim()),K=Z.exec(z);return J.join(`
|
|
560
|
+
`)}function jz(z){return z.replace(/<!--[\s\S]*?-->/g,"").replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"").replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/^\s*\n/gm,"").trim()}function A(z){let J=[],Z=/<script\b[^>]*>([\s\S]*?)<\/script>/gi,K=Z.exec(z);while(K!==null)J.push(K[1].trim()),K=Z.exec(z);return J.join(`
|
|
561
|
+
`)}function Dz(z,J){let Z=`<script>window.__stxProps = ${JSON.stringify(J)};</script>`;return z+Z}function Lz(z){return z.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}async function Oz(z,J){let Z=await I(z);f(z,Z);let K=v(z.config,Z);g(z,K),console.log(` Found ${Z.length} story files`);let $=typeof J.host==="string"?J.host:J.host===!0?"0.0.0.0":"localhost",X=new k(z.root),B=new T(z.root),Y=new M(z.root),W=s(),j=Bun.serve({port:J.port,hostname:$,fetch:async(Q,D)=>{let O=new URL(Q.url).pathname;if(O==="/__hmr"){if(D.upgrade(Q,{data:{isHmr:!0}}))return;return new Response("WebSocket upgrade failed",{status:400})}if(O.startsWith("/api/"))return Cz(z,O,Q,{presetsManager:X,bookmarksManager:B,analyticsTracker:Y});return kz(z,O,J.port)},websocket:{open(Q){W.open(Q)},close(Q){W.close(Q)},message(Q,D){W.message(Q,D)}}}),U=`http://${$}:${J.port}`,_=Uz(z,async(Q,D)=>{console.log(` [${Q}] ${D.relativePath}`);let L=await I(z);f(z,L);let O=v(z.config,L);if(g(z,O),Q==="add")a(D.id,{fileName:D.fileName});else if(Q==="unlink")o(D.id);else n(D.id,{fileName:D.fileName})});if(J.open){let Q=U;try{let{exec:D}=await import("child_process"),L=process.platform;D(`${L==="darwin"?"open":L==="win32"?"start":"xdg-open"} ${Q}`)}catch{}}return{server:j,url:U,close:async()=>{_(),j.stop()}}}async function Cz(z,J,Z,K){let{presetsManager:$,bookmarksManager:X,analyticsTracker:B}=K;if(J==="/api/stories")return Response.json({files:z.storyFiles.map((Y)=>({id:Y.id,fileName:Y.fileName,relativePath:Y.relativePath,treePath:Y.treePath})),tree:z.tree});if(J.startsWith("/api/story/")){let Y=J.slice(11),W=z.storyFiles.find((j)=>j.id===Y);if(!W)return new Response("Story not found",{status:404});try{let j=await Bun.file(W.path).text();return Response.json({id:W.id,fileName:W.fileName,relativePath:W.relativePath,content:j})}catch{return new Response("Error reading story",{status:500})}}if(J==="/api/config")return Response.json({theme:z.config.theme,responsivePresets:z.config.responsivePresets,backgroundPresets:z.config.backgroundPresets});if(J.startsWith("/api/render/")){let Y=new URL(Z.url),W=J.slice(12).split("/"),j=W[0],U=W[1]||"default",_,Q=Y.searchParams.get("props");if(Q)try{_=JSON.parse(Q)}catch{}let D=z.storyFiles.find((L)=>L.id===j);if(!D)return new Response("Story not found",{status:404});try{let L=await Bz(z,D,U,_);return Response.json({html:L.html,css:L.css,js:L.js,errors:L.errors,duration:L.duration})}catch(L){return Response.json({html:"",css:"",js:"",errors:[L instanceof Error?L.message:String(L)],duration:0},{status:500})}}if(J==="/api/presets"&&Z.method==="GET")return Response.json({presets:$.getAllPresets()});if(J==="/api/presets"&&Z.method==="POST")try{let Y=await Z.json(),W=$.createPreset(Y.name,Y.props,{componentId:Y.componentId,description:Y.description});return await $.save(),Response.json(W)}catch(Y){return Response.json({error:String(Y)},{status:400})}if(J.startsWith("/api/presets/")&&!J.includes("/use")&&Z.method==="GET"){let Y=J.slice(13),W=$.getPreset(Y);if(!W)return new Response("Preset not found",{status:404});return Response.json(W)}if(J.endsWith("/use")&&Z.method==="POST"){let Y=J.slice(13,-4),W=$.usePreset(Y);if(!W)return new Response("Preset not found",{status:404});return await $.save(),Response.json(W)}if(J.startsWith("/api/presets/")&&Z.method==="DELETE"){let Y=J.slice(13);if(!$.deletePreset(Y))return new Response("Preset not found",{status:404});return await $.save(),Response.json({success:!0})}if(J==="/api/bookmarks"&&Z.method==="GET")return Response.json({bookmarks:X.getAllBookmarks()});if(J==="/api/bookmarks"&&Z.method==="POST")try{let Y=await Z.json(),W=X.addBookmark(Y.storyId,Y.variantId,Y.props,{name:Y.name,notes:Y.notes,color:Y.color});return await X.save(),Response.json(W)}catch(Y){return Response.json({error:String(Y)},{status:400})}if(J==="/api/bookmarks/toggle"&&Z.method==="POST")try{let Y=await Z.json(),W=X.toggleBookmark(Y.storyId,Y.variantId,Y.props);return await X.save(),Response.json(W)}catch(Y){return Response.json({error:String(Y)},{status:400})}if(J.startsWith("/api/bookmarks/")&&J!=="/api/bookmarks/toggle"&&Z.method==="GET"){let Y=J.slice(15),W=X.getBookmark(Y);if(!W)return new Response("Bookmark not found",{status:404});return Response.json(W)}if(J.startsWith("/api/bookmarks/")&&Z.method==="DELETE"){let Y=J.slice(15);if(!X.deleteBookmark(Y))return new Response("Bookmark not found",{status:404});return await X.save(),Response.json({success:!0})}if(J==="/api/analytics/track"&&Z.method==="POST")try{let Y=await Z.json();if(Y.type==="view"&&Y.componentId)B.trackView(Y.componentId,Y.variantId);else if(Y.type==="prop_change"&&Y.componentId&&Y.propName)B.trackPropChange(Y.componentId,Y.propName,null);else if(Y.type==="variant_switch"&&Y.componentId&&Y.variantId)B.trackVariantSwitch(Y.componentId,Y.variantId);else if(Y.type==="search"&&Y.query)B.trackSearch(Y.query,0);return await B.save(),Response.json({success:!0})}catch(Y){return Response.json({error:String(Y)},{status:400})}if(J==="/api/analytics/summary"&&Z.method==="GET")return Response.json({mostViewed:B.getMostViewedComponents(10),mostChangedProps:B.getMostChangedProps(10),searchAnalytics:B.getSearchAnalytics()});if(J.startsWith("/api/analytics/component/")&&Z.method==="GET"){let Y=J.slice(25),W=z.storyFiles.find((U)=>U.id===Y),j=B.getComponentAnalytics(Y,W?.fileName||Y);return Response.json(j)}return new Response("Not found",{status:404})}function kz(z,J,Z){let K=Sz(z,Z);return new Response(K,{headers:{"Content-Type":"text/html; charset=utf-8"}})}function Sz(z,J){let{theme:Z}=z.config,K=Z.title||"STX Story",$=`ws://localhost:${J}/__hmr`,X=r($);return`<!DOCTYPE html>
|
|
562
|
+
<html lang="en" class="${Z.darkClass||"dark"}">
|
|
563
|
+
<head>
|
|
564
|
+
<meta charset="UTF-8">
|
|
565
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
566
|
+
<title>${K}</title>
|
|
567
|
+
<style>
|
|
568
|
+
* { box-sizing: border-box; margin: 0; padding: 0; }
|
|
569
|
+
:root {
|
|
570
|
+
--bg: #ffffff;
|
|
571
|
+
--bg-secondary: #f8f9fa;
|
|
572
|
+
--bg-tertiary: #e9ecef;
|
|
573
|
+
--text: #212529;
|
|
574
|
+
--text-secondary: #6c757d;
|
|
575
|
+
--border: #dee2e6;
|
|
576
|
+
--primary: #3b82f6;
|
|
577
|
+
--primary-hover: #2563eb;
|
|
578
|
+
--success: #10b981;
|
|
579
|
+
--warning: #f59e0b;
|
|
580
|
+
--danger: #ef4444;
|
|
581
|
+
}
|
|
582
|
+
.dark {
|
|
583
|
+
--bg: #0d1117;
|
|
584
|
+
--bg-secondary: #161b22;
|
|
585
|
+
--bg-tertiary: #21262d;
|
|
586
|
+
--text: #f0f6fc;
|
|
587
|
+
--text-secondary: #8b949e;
|
|
588
|
+
--border: #30363d;
|
|
589
|
+
}
|
|
590
|
+
body {
|
|
591
|
+
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
|
|
592
|
+
background: var(--bg);
|
|
593
|
+
color: var(--text);
|
|
594
|
+
display: flex;
|
|
595
|
+
height: 100vh;
|
|
596
|
+
overflow: hidden;
|
|
597
|
+
}
|
|
598
|
+
|
|
599
|
+
/* Sidebar */
|
|
600
|
+
.sidebar {
|
|
601
|
+
width: 260px;
|
|
602
|
+
min-width: 260px;
|
|
603
|
+
background: var(--bg-secondary);
|
|
604
|
+
border-right: 1px solid var(--border);
|
|
605
|
+
display: flex;
|
|
606
|
+
flex-direction: column;
|
|
607
|
+
overflow: hidden;
|
|
608
|
+
}
|
|
609
|
+
.sidebar-header {
|
|
610
|
+
padding: 16px;
|
|
611
|
+
border-bottom: 1px solid var(--border);
|
|
612
|
+
display: flex;
|
|
613
|
+
align-items: center;
|
|
614
|
+
gap: 8px;
|
|
615
|
+
}
|
|
616
|
+
.sidebar-header h1 {
|
|
617
|
+
font-size: 16px;
|
|
618
|
+
font-weight: 600;
|
|
619
|
+
}
|
|
620
|
+
.sidebar-search {
|
|
621
|
+
padding: 12px 16px;
|
|
622
|
+
border-bottom: 1px solid var(--border);
|
|
623
|
+
}
|
|
624
|
+
.sidebar-search input {
|
|
625
|
+
width: 100%;
|
|
626
|
+
padding: 8px 12px;
|
|
627
|
+
border: 1px solid var(--border);
|
|
628
|
+
border-radius: 6px;
|
|
629
|
+
background: var(--bg);
|
|
630
|
+
color: var(--text);
|
|
631
|
+
font-size: 13px;
|
|
632
|
+
}
|
|
633
|
+
.sidebar-search input:focus {
|
|
634
|
+
outline: none;
|
|
635
|
+
border-color: var(--primary);
|
|
636
|
+
}
|
|
637
|
+
.story-list {
|
|
638
|
+
flex: 1;
|
|
639
|
+
overflow-y: auto;
|
|
640
|
+
padding: 8px;
|
|
641
|
+
list-style: none;
|
|
642
|
+
}
|
|
643
|
+
.story-item {
|
|
644
|
+
padding: 8px 12px;
|
|
645
|
+
border-radius: 6px;
|
|
646
|
+
cursor: pointer;
|
|
647
|
+
margin-bottom: 2px;
|
|
648
|
+
font-size: 13px;
|
|
649
|
+
display: flex;
|
|
650
|
+
align-items: center;
|
|
651
|
+
gap: 8px;
|
|
652
|
+
}
|
|
653
|
+
.story-item:hover { background: var(--bg-tertiary); }
|
|
654
|
+
.story-item.active {
|
|
655
|
+
background: var(--primary);
|
|
656
|
+
color: white;
|
|
657
|
+
}
|
|
658
|
+
.story-icon { font-size: 14px; }
|
|
659
|
+
|
|
660
|
+
/* Main content */
|
|
661
|
+
.main {
|
|
662
|
+
flex: 1;
|
|
663
|
+
display: flex;
|
|
664
|
+
flex-direction: column;
|
|
665
|
+
overflow: hidden;
|
|
666
|
+
}
|
|
667
|
+
|
|
668
|
+
/* Toolbar */
|
|
669
|
+
.toolbar {
|
|
670
|
+
padding: 12px 16px;
|
|
671
|
+
border-bottom: 1px solid var(--border);
|
|
672
|
+
display: flex;
|
|
673
|
+
align-items: center;
|
|
674
|
+
gap: 12px;
|
|
675
|
+
background: var(--bg-secondary);
|
|
676
|
+
}
|
|
677
|
+
.toolbar-group {
|
|
678
|
+
display: flex;
|
|
679
|
+
align-items: center;
|
|
680
|
+
gap: 8px;
|
|
681
|
+
}
|
|
682
|
+
.toolbar-divider {
|
|
683
|
+
width: 1px;
|
|
684
|
+
height: 24px;
|
|
685
|
+
background: var(--border);
|
|
686
|
+
}
|
|
687
|
+
.toolbar select, .toolbar button {
|
|
688
|
+
padding: 6px 12px;
|
|
689
|
+
border: 1px solid var(--border);
|
|
690
|
+
border-radius: 6px;
|
|
691
|
+
background: var(--bg);
|
|
692
|
+
color: var(--text);
|
|
693
|
+
font-size: 12px;
|
|
694
|
+
cursor: pointer;
|
|
695
|
+
}
|
|
696
|
+
.toolbar select:hover, .toolbar button:hover {
|
|
697
|
+
background: var(--bg-tertiary);
|
|
698
|
+
}
|
|
699
|
+
.toolbar-spacer { flex: 1; }
|
|
700
|
+
|
|
701
|
+
/* Variant tabs */
|
|
702
|
+
.variant-tabs {
|
|
703
|
+
display: flex;
|
|
704
|
+
gap: 4px;
|
|
705
|
+
padding: 12px 16px;
|
|
706
|
+
border-bottom: 1px solid var(--border);
|
|
707
|
+
background: var(--bg);
|
|
708
|
+
overflow-x: auto;
|
|
709
|
+
}
|
|
710
|
+
.variant-tab {
|
|
711
|
+
padding: 6px 14px;
|
|
712
|
+
border: 1px solid var(--border);
|
|
713
|
+
border-radius: 6px;
|
|
714
|
+
background: var(--bg-secondary);
|
|
715
|
+
color: var(--text);
|
|
716
|
+
font-size: 12px;
|
|
717
|
+
cursor: pointer;
|
|
718
|
+
white-space: nowrap;
|
|
719
|
+
transition: all 0.15s;
|
|
720
|
+
}
|
|
721
|
+
.variant-tab:hover { background: var(--bg-tertiary); }
|
|
722
|
+
.variant-tab.active {
|
|
723
|
+
background: var(--primary);
|
|
724
|
+
border-color: var(--primary);
|
|
725
|
+
color: white;
|
|
726
|
+
}
|
|
727
|
+
|
|
728
|
+
/* Content area */
|
|
729
|
+
.content-wrapper {
|
|
730
|
+
flex: 1;
|
|
731
|
+
display: flex;
|
|
732
|
+
overflow: hidden;
|
|
733
|
+
}
|
|
734
|
+
|
|
735
|
+
/* Canvas */
|
|
736
|
+
.canvas-container {
|
|
737
|
+
flex: 1;
|
|
738
|
+
display: flex;
|
|
739
|
+
flex-direction: column;
|
|
740
|
+
overflow: hidden;
|
|
741
|
+
background: var(--bg-tertiary);
|
|
742
|
+
}
|
|
743
|
+
.canvas {
|
|
744
|
+
flex: 1;
|
|
745
|
+
padding: 24px;
|
|
746
|
+
overflow: auto;
|
|
747
|
+
display: flex;
|
|
748
|
+
justify-content: center;
|
|
749
|
+
align-items: flex-start;
|
|
750
|
+
}
|
|
751
|
+
.canvas-frame {
|
|
752
|
+
background: white;
|
|
753
|
+
border-radius: 8px;
|
|
754
|
+
box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
|
|
755
|
+
overflow: hidden;
|
|
756
|
+
width: 100%;
|
|
757
|
+
max-width: 100%;
|
|
758
|
+
}
|
|
759
|
+
.canvas-frame iframe {
|
|
760
|
+
width: 100%;
|
|
761
|
+
height: 400px;
|
|
762
|
+
border: none;
|
|
763
|
+
display: block;
|
|
764
|
+
}
|
|
765
|
+
|
|
766
|
+
/* Controls Panel */
|
|
767
|
+
.controls-panel {
|
|
768
|
+
width: 300px;
|
|
769
|
+
min-width: 300px;
|
|
770
|
+
background: var(--bg-secondary);
|
|
771
|
+
border-left: 1px solid var(--border);
|
|
772
|
+
display: flex;
|
|
773
|
+
flex-direction: column;
|
|
774
|
+
overflow: hidden;
|
|
775
|
+
}
|
|
776
|
+
.controls-header {
|
|
777
|
+
padding: 12px 16px;
|
|
778
|
+
border-bottom: 1px solid var(--border);
|
|
779
|
+
font-weight: 600;
|
|
780
|
+
font-size: 13px;
|
|
781
|
+
display: flex;
|
|
782
|
+
justify-content: space-between;
|
|
783
|
+
align-items: center;
|
|
784
|
+
}
|
|
785
|
+
.controls-body {
|
|
786
|
+
flex: 1;
|
|
787
|
+
overflow-y: auto;
|
|
788
|
+
padding: 16px;
|
|
789
|
+
}
|
|
790
|
+
.control-group {
|
|
791
|
+
margin-bottom: 16px;
|
|
792
|
+
}
|
|
793
|
+
.control-label {
|
|
794
|
+
display: block;
|
|
795
|
+
font-size: 12px;
|
|
796
|
+
font-weight: 500;
|
|
797
|
+
margin-bottom: 6px;
|
|
798
|
+
color: var(--text-secondary);
|
|
799
|
+
}
|
|
800
|
+
.control-input {
|
|
801
|
+
width: 100%;
|
|
802
|
+
padding: 8px 12px;
|
|
803
|
+
border: 1px solid var(--border);
|
|
804
|
+
border-radius: 6px;
|
|
805
|
+
background: var(--bg);
|
|
806
|
+
color: var(--text);
|
|
807
|
+
font-size: 13px;
|
|
808
|
+
}
|
|
809
|
+
.control-input:focus {
|
|
810
|
+
outline: none;
|
|
811
|
+
border-color: var(--primary);
|
|
812
|
+
}
|
|
813
|
+
.control-checkbox {
|
|
814
|
+
display: flex;
|
|
815
|
+
align-items: center;
|
|
816
|
+
gap: 8px;
|
|
817
|
+
}
|
|
818
|
+
.control-checkbox input {
|
|
819
|
+
width: 16px;
|
|
820
|
+
height: 16px;
|
|
821
|
+
}
|
|
822
|
+
.controls-actions {
|
|
823
|
+
padding: 12px 16px;
|
|
824
|
+
border-top: 1px solid var(--border);
|
|
825
|
+
display: flex;
|
|
826
|
+
gap: 8px;
|
|
827
|
+
}
|
|
828
|
+
.controls-actions button {
|
|
829
|
+
flex: 1;
|
|
830
|
+
padding: 8px;
|
|
831
|
+
border: 1px solid var(--border);
|
|
832
|
+
border-radius: 6px;
|
|
833
|
+
background: var(--bg);
|
|
834
|
+
color: var(--text);
|
|
835
|
+
font-size: 12px;
|
|
836
|
+
cursor: pointer;
|
|
837
|
+
}
|
|
838
|
+
.controls-actions button:hover {
|
|
839
|
+
background: var(--bg-tertiary);
|
|
840
|
+
}
|
|
841
|
+
|
|
842
|
+
/* States */
|
|
843
|
+
.empty-state {
|
|
844
|
+
display: flex;
|
|
845
|
+
flex-direction: column;
|
|
846
|
+
align-items: center;
|
|
847
|
+
justify-content: center;
|
|
848
|
+
height: 100%;
|
|
849
|
+
color: var(--text-secondary);
|
|
850
|
+
font-size: 14px;
|
|
851
|
+
gap: 8px;
|
|
852
|
+
}
|
|
853
|
+
.loading {
|
|
854
|
+
display: flex;
|
|
855
|
+
align-items: center;
|
|
856
|
+
justify-content: center;
|
|
857
|
+
height: 100%;
|
|
858
|
+
color: var(--text-secondary);
|
|
859
|
+
}
|
|
860
|
+
.loading::after {
|
|
861
|
+
content: '';
|
|
862
|
+
width: 20px;
|
|
863
|
+
height: 20px;
|
|
864
|
+
border: 2px solid var(--border);
|
|
865
|
+
border-top-color: var(--primary);
|
|
866
|
+
border-radius: 50%;
|
|
867
|
+
animation: spin 1s linear infinite;
|
|
868
|
+
margin-left: 8px;
|
|
869
|
+
}
|
|
870
|
+
@keyframes spin {
|
|
871
|
+
to { transform: rotate(360deg); }
|
|
872
|
+
}
|
|
873
|
+
.render-error {
|
|
874
|
+
padding: 16px;
|
|
875
|
+
background: #fef2f2;
|
|
876
|
+
border: 1px solid #fecaca;
|
|
877
|
+
border-radius: 8px;
|
|
878
|
+
color: #dc2626;
|
|
879
|
+
}
|
|
880
|
+
.dark .render-error {
|
|
881
|
+
background: #450a0a;
|
|
882
|
+
border-color: #7f1d1d;
|
|
883
|
+
color: #fca5a5;
|
|
884
|
+
}
|
|
885
|
+
.render-error pre {
|
|
886
|
+
margin-top: 8px;
|
|
887
|
+
white-space: pre-wrap;
|
|
888
|
+
font-size: 12px;
|
|
889
|
+
font-family: monospace;
|
|
890
|
+
}
|
|
891
|
+
</style>
|
|
892
|
+
</head>
|
|
893
|
+
<body>
|
|
894
|
+
<aside class="sidebar">
|
|
895
|
+
<div class="sidebar-header">
|
|
896
|
+
<span style="font-size: 20px;">\uD83D\uDCD6</span>
|
|
897
|
+
<h1>${K}</h1>
|
|
898
|
+
</div>
|
|
899
|
+
<div class="sidebar-search">
|
|
900
|
+
<input type="text" placeholder="Search components..." id="search-input" oninput="filterStories(this.value)">
|
|
901
|
+
</div>
|
|
902
|
+
<ul class="story-list" id="story-list">
|
|
903
|
+
<li class="empty-state">Loading stories...</li>
|
|
904
|
+
</ul>
|
|
905
|
+
</aside>
|
|
906
|
+
|
|
907
|
+
<main class="main">
|
|
908
|
+
<div class="toolbar">
|
|
909
|
+
<div class="toolbar-group">
|
|
910
|
+
<button onclick="toggleTheme()" title="Toggle theme">\uD83C\uDF13</button>
|
|
911
|
+
<button onclick="reloadStory()" title="Reload">\u21BB</button>
|
|
912
|
+
</div>
|
|
913
|
+
<div class="toolbar-divider"></div>
|
|
914
|
+
<div class="toolbar-group">
|
|
915
|
+
<select id="viewport" onchange="changeViewport(this.value)">
|
|
916
|
+
<option value="">Responsive</option>
|
|
917
|
+
${z.config.responsivePresets.map((B)=>`<option value="${B.width}">${B.label}</option>`).join("")}
|
|
918
|
+
</select>
|
|
919
|
+
<select id="background" onchange="changeBackground(this.value)">
|
|
920
|
+
${z.config.backgroundPresets.map((B)=>`<option value="${B.color}">${B.label}</option>`).join("")}
|
|
921
|
+
</select>
|
|
922
|
+
</div>
|
|
923
|
+
<div class="toolbar-spacer"></div>
|
|
924
|
+
<div class="toolbar-group">
|
|
925
|
+
<button onclick="toggleControls()" id="controls-toggle">Controls \u25B6</button>
|
|
926
|
+
</div>
|
|
927
|
+
</div>
|
|
928
|
+
|
|
929
|
+
<div class="variant-tabs" id="variant-tabs" style="display: none;">
|
|
930
|
+
<!-- Variant tabs will be populated here -->
|
|
931
|
+
</div>
|
|
932
|
+
|
|
933
|
+
<div class="content-wrapper">
|
|
934
|
+
<div class="canvas-container">
|
|
935
|
+
<div class="canvas" id="canvas">
|
|
936
|
+
<div class="empty-state">
|
|
937
|
+
<span style="font-size: 32px;">\uD83C\uDFA8</span>
|
|
938
|
+
<span>Select a component from the sidebar</span>
|
|
939
|
+
</div>
|
|
940
|
+
</div>
|
|
941
|
+
</div>
|
|
942
|
+
|
|
943
|
+
<div class="controls-panel" id="controls-panel" style="display: none;">
|
|
944
|
+
<div class="controls-header">
|
|
945
|
+
<span>Controls</span>
|
|
946
|
+
<button onclick="resetProps()" style="font-size: 11px; padding: 4px 8px;">Reset</button>
|
|
947
|
+
</div>
|
|
948
|
+
<div class="controls-body" id="controls-body">
|
|
949
|
+
<div class="empty-state">Select a story to edit props</div>
|
|
950
|
+
</div>
|
|
951
|
+
<div class="controls-actions">
|
|
952
|
+
<button onclick="copyProps()">Copy JSON</button>
|
|
953
|
+
<button onclick="applyProps()">Apply</button>
|
|
954
|
+
</div>
|
|
955
|
+
</div>
|
|
956
|
+
</div>
|
|
957
|
+
</main>
|
|
958
|
+
|
|
959
|
+
<script>
|
|
960
|
+
let currentStory = null;
|
|
961
|
+
let currentVariant = 'default';
|
|
962
|
+
let currentStoryData = null;
|
|
963
|
+
let currentProps = {};
|
|
964
|
+
let allStories = [];
|
|
965
|
+
|
|
966
|
+
// Load stories
|
|
967
|
+
fetch('/api/stories')
|
|
968
|
+
.then(r => r.json())
|
|
969
|
+
.then(data => {
|
|
970
|
+
allStories = data.files;
|
|
971
|
+
renderStoryList(allStories);
|
|
972
|
+
});
|
|
973
|
+
|
|
974
|
+
function renderStoryList(stories) {
|
|
975
|
+
const list = document.getElementById('story-list');
|
|
976
|
+
if (stories.length === 0) {
|
|
977
|
+
list.innerHTML = '<li class="empty-state">No stories found</li>';
|
|
978
|
+
return;
|
|
979
|
+
}
|
|
980
|
+
list.innerHTML = stories.map(f =>
|
|
981
|
+
'<li class="story-item" data-id="' + f.id + '" onclick="selectStory(\\'' + f.id + '\\', this)">' +
|
|
982
|
+
'<span class="story-icon">\uD83D\uDCE6</span>' + f.fileName + '</li>'
|
|
983
|
+
).join('');
|
|
984
|
+
}
|
|
985
|
+
|
|
986
|
+
function filterStories(query) {
|
|
987
|
+
const filtered = allStories.filter(f =>
|
|
988
|
+
f.fileName.toLowerCase().includes(query.toLowerCase())
|
|
989
|
+
);
|
|
990
|
+
renderStoryList(filtered);
|
|
991
|
+
}
|
|
992
|
+
|
|
993
|
+
function selectStory(id, element) {
|
|
994
|
+
currentStory = id;
|
|
995
|
+
currentVariant = 'default';
|
|
996
|
+
|
|
997
|
+
document.querySelectorAll('.story-item').forEach(el => el.classList.remove('active'));
|
|
998
|
+
if (element) element.classList.add('active');
|
|
999
|
+
|
|
1000
|
+
// Fetch story details with variants
|
|
1001
|
+
fetch('/api/story/' + id)
|
|
1002
|
+
.then(r => r.json())
|
|
1003
|
+
.then(data => {
|
|
1004
|
+
currentStoryData = data;
|
|
1005
|
+
currentProps = {};
|
|
1006
|
+
|
|
1007
|
+
// Parse variants from content
|
|
1008
|
+
const variants = parseVariants(data.content);
|
|
1009
|
+
renderVariantTabs(variants);
|
|
1010
|
+
|
|
1011
|
+
// Parse props from content
|
|
1012
|
+
const props = parseProps(data.content);
|
|
1013
|
+
renderControls(props);
|
|
1014
|
+
|
|
1015
|
+
// Render the default variant
|
|
1016
|
+
renderVariant('default');
|
|
1017
|
+
})
|
|
1018
|
+
.catch(err => {
|
|
1019
|
+
showError('Failed to load story: ' + err.message);
|
|
1020
|
+
});
|
|
1021
|
+
}
|
|
1022
|
+
|
|
1023
|
+
function parseVariants(content) {
|
|
1024
|
+
const match = content.match(/const\\s+variants\\s*=\\s*\\[([\\s\\S]*?)\\]/);
|
|
1025
|
+
if (!match) return [{ id: 'default', title: 'Default' }];
|
|
1026
|
+
|
|
1027
|
+
try {
|
|
1028
|
+
const variantsStr = '[' + match[1] + ']';
|
|
1029
|
+
const cleaned = variantsStr
|
|
1030
|
+
.replace(/'/g, '"')
|
|
1031
|
+
.replace(/(\\w+):/g, '"$1":')
|
|
1032
|
+
.replace(/,\\s*}/g, '}')
|
|
1033
|
+
.replace(/,\\s*]/g, ']');
|
|
1034
|
+
return JSON.parse(cleaned);
|
|
1035
|
+
}
|
|
1036
|
+
catch {
|
|
1037
|
+
return [{ id: 'default', title: 'Default' }];
|
|
1038
|
+
}
|
|
1039
|
+
}
|
|
1040
|
+
|
|
1041
|
+
function parseProps(content) {
|
|
1042
|
+
const props = [];
|
|
1043
|
+
const scriptMatch = content.match(/<script>([\\s\\S]*?)<\\/script>/);
|
|
1044
|
+
if (!scriptMatch) return props;
|
|
1045
|
+
|
|
1046
|
+
const script = scriptMatch[1];
|
|
1047
|
+
const propMatches = script.matchAll(/const\\s+(\\w+)\\s*=\\s*([^\\n]+)/g);
|
|
1048
|
+
|
|
1049
|
+
for (const m of propMatches) {
|
|
1050
|
+
const name = m[1];
|
|
1051
|
+
const valueStr = m[2].trim();
|
|
1052
|
+
|
|
1053
|
+
// Skip variants and title
|
|
1054
|
+
if (name === 'variants' || name === 'title') continue;
|
|
1055
|
+
|
|
1056
|
+
let type = 'text';
|
|
1057
|
+
let value = valueStr;
|
|
1058
|
+
|
|
1059
|
+
if (valueStr === 'true' || valueStr === 'false') {
|
|
1060
|
+
type = 'boolean';
|
|
1061
|
+
value = valueStr === 'true';
|
|
1062
|
+
}
|
|
1063
|
+
else if (valueStr.match(/^\\d+$/)) {
|
|
1064
|
+
type = 'number';
|
|
1065
|
+
value = parseInt(valueStr);
|
|
1066
|
+
}
|
|
1067
|
+
else if (valueStr.startsWith("'") || valueStr.startsWith('"')) {
|
|
1068
|
+
value = valueStr.slice(1, -1);
|
|
1069
|
+
}
|
|
1070
|
+
|
|
1071
|
+
props.push({ name, type, value, default: value });
|
|
1072
|
+
currentProps[name] = value;
|
|
1073
|
+
}
|
|
1074
|
+
|
|
1075
|
+
return props;
|
|
1076
|
+
}
|
|
1077
|
+
|
|
1078
|
+
function renderVariantTabs(variants) {
|
|
1079
|
+
const container = document.getElementById('variant-tabs');
|
|
1080
|
+
if (variants.length <= 1) {
|
|
1081
|
+
container.style.display = 'none';
|
|
1082
|
+
return;
|
|
1083
|
+
}
|
|
1084
|
+
|
|
1085
|
+
container.style.display = 'flex';
|
|
1086
|
+
container.innerHTML = variants.map(v =>
|
|
1087
|
+
'<button class="variant-tab' + (v.id === currentVariant ? ' active' : '') +
|
|
1088
|
+
'" onclick="selectVariant(\\'' + v.id + '\\')">' + v.title + '</button>'
|
|
1089
|
+
).join('');
|
|
1090
|
+
}
|
|
1091
|
+
|
|
1092
|
+
function renderControls(props) {
|
|
1093
|
+
const body = document.getElementById('controls-body');
|
|
1094
|
+
if (props.length === 0) {
|
|
1095
|
+
body.innerHTML = '<div class="empty-state">No props available</div>';
|
|
1096
|
+
return;
|
|
1097
|
+
}
|
|
1098
|
+
|
|
1099
|
+
body.innerHTML = props.map(p => {
|
|
1100
|
+
if (p.type === 'boolean') {
|
|
1101
|
+
return '<div class="control-group">' +
|
|
1102
|
+
'<label class="control-checkbox">' +
|
|
1103
|
+
'<input type="checkbox" ' + (currentProps[p.name] ? 'checked' : '') +
|
|
1104
|
+
' onchange="updateProp(\\'' + p.name + '\\', this.checked)">' +
|
|
1105
|
+
'<span>' + p.name + '</span>' +
|
|
1106
|
+
'</label></div>';
|
|
1107
|
+
}
|
|
1108
|
+
return '<div class="control-group">' +
|
|
1109
|
+
'<label class="control-label">' + p.name + '</label>' +
|
|
1110
|
+
'<input type="' + (p.type === 'number' ? 'number' : 'text') + '" ' +
|
|
1111
|
+
'class="control-input" value="' + escapeHtml(String(currentProps[p.name] || '')) + '" ' +
|
|
1112
|
+
'onchange="updateProp(\\'' + p.name + '\\', this.value)">' +
|
|
1113
|
+
'</div>';
|
|
1114
|
+
}).join('');
|
|
1115
|
+
}
|
|
1116
|
+
|
|
1117
|
+
function selectVariant(variantId) {
|
|
1118
|
+
currentVariant = variantId;
|
|
1119
|
+
|
|
1120
|
+
document.querySelectorAll('.variant-tab').forEach(el => el.classList.remove('active'));
|
|
1121
|
+
event.target.classList.add('active');
|
|
1122
|
+
|
|
1123
|
+
// Get variant state and apply to props
|
|
1124
|
+
const variants = parseVariants(currentStoryData.content);
|
|
1125
|
+
const variant = variants.find(v => v.id === variantId);
|
|
1126
|
+
if (variant && variant.state) {
|
|
1127
|
+
Object.assign(currentProps, variant.state);
|
|
1128
|
+
renderControls(parseProps(currentStoryData.content));
|
|
1129
|
+
}
|
|
1130
|
+
|
|
1131
|
+
renderVariant(variantId);
|
|
1132
|
+
}
|
|
1133
|
+
|
|
1134
|
+
function renderVariant(variantId) {
|
|
1135
|
+
const canvas = document.getElementById('canvas');
|
|
1136
|
+
canvas.innerHTML = '<div class="loading">Rendering</div>';
|
|
1137
|
+
|
|
1138
|
+
// Build URL with props
|
|
1139
|
+
const propsParam = Object.keys(currentProps).length > 0
|
|
1140
|
+
? '?props=' + encodeURIComponent(JSON.stringify(currentProps))
|
|
1141
|
+
: '';
|
|
1142
|
+
|
|
1143
|
+
fetch('/api/render/' + currentStory + '/' + variantId + propsParam)
|
|
1144
|
+
.then(r => r.json())
|
|
1145
|
+
.then(data => {
|
|
1146
|
+
if (data.errors && data.errors.length > 0 && !data.html) {
|
|
1147
|
+
canvas.innerHTML = '<div class="render-error"><strong>Render Error:</strong><pre>' +
|
|
1148
|
+
escapeHtml(data.errors.join('\\n')) + '</pre></div>';
|
|
1149
|
+
return;
|
|
1150
|
+
}
|
|
1151
|
+
|
|
1152
|
+
canvas.innerHTML = '<div class="canvas-frame"><iframe id="preview-iframe"></iframe></div>';
|
|
1153
|
+
const iframe = document.getElementById('preview-iframe');
|
|
1154
|
+
const iframeDoc = iframe.contentDocument || iframe.contentWindow.document;
|
|
1155
|
+
|
|
1156
|
+
iframeDoc.open();
|
|
1157
|
+
iframeDoc.write('<!DOCTYPE html>' +
|
|
1158
|
+
'<html>' +
|
|
1159
|
+
'<head>' +
|
|
1160
|
+
'<meta charset="UTF-8">' +
|
|
1161
|
+
'<meta name="viewport" content="width=device-width, initial-scale=1.0">' +
|
|
1162
|
+
'<style>' +
|
|
1163
|
+
'* { box-sizing: border-box; }' +
|
|
1164
|
+
'body { margin: 0; padding: 20px; font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, sans-serif; }' +
|
|
1165
|
+
(data.css || '') +
|
|
1166
|
+
'</style>' +
|
|
1167
|
+
'</head>' +
|
|
1168
|
+
'<body>' +
|
|
1169
|
+
(data.html || '') +
|
|
1170
|
+
'</body>' +
|
|
1171
|
+
'</html>');
|
|
1172
|
+
iframeDoc.close();
|
|
1173
|
+
|
|
1174
|
+
// Auto-resize iframe
|
|
1175
|
+
setTimeout(() => {
|
|
1176
|
+
const height = iframeDoc.body.scrollHeight + 40;
|
|
1177
|
+
iframe.style.height = Math.max(200, height) + 'px';
|
|
1178
|
+
}, 100);
|
|
1179
|
+
})
|
|
1180
|
+
.catch(err => {
|
|
1181
|
+
canvas.innerHTML = '<div class="render-error"><strong>Error:</strong> ' + escapeHtml(err.message) + '</div>';
|
|
1182
|
+
});
|
|
1183
|
+
}
|
|
1184
|
+
|
|
1185
|
+
function updateProp(name, value) {
|
|
1186
|
+
currentProps[name] = value;
|
|
1187
|
+
}
|
|
1188
|
+
|
|
1189
|
+
function applyProps() {
|
|
1190
|
+
if (currentStory) {
|
|
1191
|
+
renderVariant(currentVariant);
|
|
1192
|
+
}
|
|
1193
|
+
}
|
|
1194
|
+
|
|
1195
|
+
function resetProps() {
|
|
1196
|
+
if (currentStoryData) {
|
|
1197
|
+
currentProps = {};
|
|
1198
|
+
const props = parseProps(currentStoryData.content);
|
|
1199
|
+
props.forEach(p => { currentProps[p.name] = p.default; });
|
|
1200
|
+
renderControls(props);
|
|
1201
|
+
renderVariant(currentVariant);
|
|
1202
|
+
}
|
|
1203
|
+
}
|
|
1204
|
+
|
|
1205
|
+
function copyProps() {
|
|
1206
|
+
navigator.clipboard.writeText(JSON.stringify(currentProps, null, 2))
|
|
1207
|
+
.then(() => alert('Props copied to clipboard!'));
|
|
1208
|
+
}
|
|
1209
|
+
|
|
1210
|
+
function reloadStory() {
|
|
1211
|
+
if (currentStory) {
|
|
1212
|
+
renderVariant(currentVariant);
|
|
1213
|
+
}
|
|
1214
|
+
}
|
|
1215
|
+
|
|
1216
|
+
function showError(message) {
|
|
1217
|
+
document.getElementById('canvas').innerHTML =
|
|
1218
|
+
'<div class="render-error">' + escapeHtml(message) + '</div>';
|
|
1219
|
+
}
|
|
1220
|
+
|
|
1221
|
+
function escapeHtml(text) {
|
|
1222
|
+
const div = document.createElement('div');
|
|
1223
|
+
div.textContent = text;
|
|
1224
|
+
return div.innerHTML;
|
|
1225
|
+
}
|
|
1226
|
+
|
|
1227
|
+
function toggleTheme() {
|
|
1228
|
+
document.documentElement.classList.toggle('dark');
|
|
1229
|
+
}
|
|
1230
|
+
|
|
1231
|
+
function toggleControls() {
|
|
1232
|
+
const panel = document.getElementById('controls-panel');
|
|
1233
|
+
const btn = document.getElementById('controls-toggle');
|
|
1234
|
+
if (panel.style.display === 'none') {
|
|
1235
|
+
panel.style.display = 'flex';
|
|
1236
|
+
btn.textContent = 'Controls \u25C0';
|
|
1237
|
+
}
|
|
1238
|
+
else {
|
|
1239
|
+
panel.style.display = 'none';
|
|
1240
|
+
btn.textContent = 'Controls \u25B6';
|
|
1241
|
+
}
|
|
1242
|
+
}
|
|
1243
|
+
|
|
1244
|
+
function changeViewport(width) {
|
|
1245
|
+
const frame = document.querySelector('.canvas-frame');
|
|
1246
|
+
if (frame) {
|
|
1247
|
+
frame.style.maxWidth = width ? width + 'px' : '';
|
|
1248
|
+
}
|
|
1249
|
+
}
|
|
1250
|
+
|
|
1251
|
+
function changeBackground(color) {
|
|
1252
|
+
const canvas = document.getElementById('canvas');
|
|
1253
|
+
canvas.style.background = color || '';
|
|
1254
|
+
}
|
|
1255
|
+
|
|
1256
|
+
// STX Story global object for HMR
|
|
1257
|
+
window.__stxStory = {
|
|
1258
|
+
currentStoryId: null,
|
|
1259
|
+
reloadCurrentStory: function() {
|
|
1260
|
+
if (currentStory) renderVariant(currentVariant);
|
|
1261
|
+
},
|
|
1262
|
+
refreshStoryList: function() {
|
|
1263
|
+
fetch('/api/stories')
|
|
1264
|
+
.then(r => r.json())
|
|
1265
|
+
.then(data => {
|
|
1266
|
+
allStories = data.files;
|
|
1267
|
+
renderStoryList(allStories);
|
|
1268
|
+
});
|
|
1269
|
+
}
|
|
1270
|
+
};
|
|
1271
|
+
</script>
|
|
1272
|
+
${X}
|
|
1273
|
+
${e()}
|
|
1274
|
+
${Zz()}
|
|
1275
|
+
${Kz()}
|
|
1276
|
+
<style>${Jz()}</style>
|
|
1277
|
+
${zz()}
|
|
1278
|
+
</body>
|
|
1279
|
+
</html>`}import fz from"fs";import gz from"path";var Iz=new Map,vz=[],xz=[],uz=new Map;async function _z(z){let J=z.config.setupFile;if(!J)return;let Z=gz.resolve(z.root,J);try{await fz.promises.access(Z)}catch{return}let K={storyContext:z,registerComponent:($,X)=>{Iz.set($,X)},addCSS:($)=>{vz.push($)},addScript:($)=>{xz.push($)},setState:($,X)=>{uz.set($,X)}};try{let $=await import(Z);if(typeof $.default==="function")await $.default(K);else if(typeof $.setupStory==="function")await $.setupStory(K)}catch($){console.warn(`Warning: Failed to load setup file: ${$}`)}}async function bz(z={}){x();let J=await h({mode:"dev"});if(!J.config.enabled){G("Story feature is disabled in config.");return}await _z(J);let Z=z.port??J.config.port,K,$=async()=>{K=await Oz(J,{port:Z,open:z.open,host:z.host}),b(J.storyFiles.length),u(K.url),y()};await $();let X=m(J,{onChange:async()=>{await K.close();let Y=await h({mode:"dev"});Object.assign(J,Y),await $()}}),B=async()=>{console.log(`
|
|
1280
|
+
`),X.stop(),await K.close(),process.exit(0)};if(process.on("SIGINT",B),process.on("SIGTERM",B),process.stdin.isTTY)process.stdin.setRawMode(!0),process.stdin.resume(),process.stdin.on("data",async(Y)=>{switch(Y.toString()){case"h":y();break;case"o":try{let{exec:j}=await import("child_process"),U=process.platform==="darwin"?"open":process.platform==="win32"?"start":"xdg-open";j(`${U} ${K.url}`)}catch{Az("Failed to open browser")}break;case"r":await K.close(),await $();break;case"c":console.clear(),x(),b(J.storyFiles.length),u(K.url);break;case"q":case"\x03":await B();break}});await new Promise(()=>{})}var qJ=bz;export{bz as devCommand,qJ as dev};
|