@stacksjs/stx 0.2.94 → 0.2.96
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/a11y.js +598 -2
- package/dist/analytics.js +159 -2
- package/dist/analyzer.js +240 -2
- package/dist/animation.js +688 -2
- package/dist/app-shell.js +220 -2
- package/dist/app.js +79 -2
- package/dist/assets.js +155 -2
- package/dist/ast.js +630 -2
- package/dist/async-components.js +428 -2
- package/dist/auth.js +12 -2
- package/dist/broadcasting.js +102 -2
- package/dist/browser-composables.js +565 -2
- package/dist/build-assets.js +29 -2
- package/dist/build-mode-detector.js +50 -2
- package/dist/build-optimizer.js +433 -2
- package/dist/build-views.js +180 -2
- package/dist/build.js +33 -2
- package/dist/builtins/drawer.js +37 -2
- package/dist/builtins/escape.js +3 -2
- package/dist/builtins/icon.js +83 -2
- package/dist/builtins/index.js +34 -2
- package/dist/builtins/modal.js +38 -2
- package/dist/builtins/safe-image.js +51 -2
- package/dist/builtins/stx-image.js +200 -2
- package/dist/builtins/stx-link.js +41 -2
- package/dist/builtins/stx-loading-indicator.js +35 -2
- package/dist/builtins/suspense.js +24 -2
- package/dist/builtins/toast.js +42 -2
- package/dist/builtins/tooltip.js +106 -2
- package/dist/builtins/transition-group.js +22 -2
- package/dist/bundle-analyzer/collector.js +233 -2
- package/dist/bundle-analyzer/index.js +82 -2
- package/dist/bundle-analyzer/report.js +318 -2
- package/dist/bundle-analyzer/treemap.js +594 -2
- package/dist/caching.js +131 -2
- package/dist/cli.js +11317 -10982
- package/dist/client/directive.js +14 -2
- package/dist/client/index.js +2 -2
- package/dist/client-helpers.js +312 -2
- package/dist/client-script-bundler.js +216 -6
- package/dist/client-script.js +754 -2
- package/dist/client.js +73 -4
- package/dist/component-hmr.js +585 -2
- package/dist/component-library.d.ts +6 -0
- package/dist/component-library.js +683 -0
- package/dist/component-processing.js +613 -2
- package/dist/component-registry.js +90 -2
- package/dist/component-renderer.js +660 -2
- package/dist/components.js +213 -2
- package/dist/composables/index.js +220 -2
- package/dist/composables/use-battery.js +101 -2
- package/dist/composables/use-broadcast-channel.js +80 -2
- package/dist/composables/use-channel.js +124 -2
- package/dist/composables/use-clipboard.js +79 -2
- package/dist/composables/use-color-mode.js +131 -2
- package/dist/composables/use-cookie.js +86 -2
- package/dist/composables/use-device-orientation.js +181 -2
- package/dist/composables/use-event-listener.js +27 -2
- package/dist/composables/use-event-source.js +166 -2
- package/dist/composables/use-eye-dropper.js +142 -2
- package/dist/composables/use-fetch.js +223 -2
- package/dist/composables/use-fullscreen.js +110 -2
- package/dist/composables/use-geolocation.js +101 -2
- package/dist/composables/use-idle.js +182 -2
- package/dist/composables/use-intersection-observer.js +168 -2
- package/dist/composables/use-keyboard.js +224 -2
- package/dist/composables/use-media-query.js +62 -2
- package/dist/composables/use-meta.js +48 -2
- package/dist/composables/use-mouse.js +286 -2
- package/dist/composables/use-mutation-observer.js +129 -2
- package/dist/composables/use-network.js +85 -2
- package/dist/composables/use-notification.js +94 -2
- package/dist/composables/use-permissions.js +132 -2
- package/dist/composables/use-query.js +0 -1
- package/dist/composables/use-resize-observer.js +157 -2
- package/dist/composables/use-router.js +51 -2
- package/dist/composables/use-share.js +104 -2
- package/dist/composables/use-speech.js +294 -2
- package/dist/composables/use-storage.js +130 -2
- package/dist/composables/use-text-selection.js +205 -4
- package/dist/composables/use-timer.js +183 -2
- package/dist/composables/use-utilities.js +176 -2
- package/dist/composables/use-wake-lock.js +122 -2
- package/dist/composables/use-websocket.js +165 -2
- package/dist/composables/use-window.js +163 -2
- package/dist/composables.js +552 -2
- package/dist/composition-api.js +190 -2
- package/dist/computed.js +376 -8
- package/dist/conditionals.js +599 -2
- package/dist/config.js +751 -2
- package/dist/craft-bridge.js +432 -2
- package/dist/craft-compiler.js +810 -2
- package/dist/craft-components.js +945 -2
- package/dist/craft-entry.js +5 -2
- package/dist/craft-ssr.js +559 -2
- package/dist/csp.js +220 -2
- package/dist/csrf.js +38 -2
- package/dist/custom-directives.js +136 -2
- package/dist/defer.js +156 -2
- package/dist/deploy/config-generators.js +214 -2
- package/dist/deploy/index.js +203 -2
- package/dist/deploy/netlify.js +167 -2
- package/dist/dev-server/crosswind.js +379 -2
- package/dist/dev-server/index.js +7 -2
- package/dist/dev-server/keyboard-shortcuts.js +81 -2
- package/dist/dev-server/native-window.js +91 -2
- package/dist/dev-server/port-utils.js +40 -2
- package/dist/dev-server/serve-app.js +682 -7
- package/dist/dev-server/serve-file.js +439 -7
- package/dist/dev-server/serve-markdown.js +281 -2
- package/dist/dev-server/serve-multi.js +424 -17
- package/dist/dev-server/terminal-colors.js +45 -2
- package/dist/dev-server/theme-selector.js +111 -2
- package/dist/dev-server/types.js +43 -2
- package/dist/dev-server.js +4 -2
- package/dist/devtools.js +462 -18
- package/dist/directive-api.js +355 -2
- package/dist/docs.js +567 -2
- package/dist/doctor.js +123 -2
- package/dist/document-shell.js +105 -2
- package/dist/dynamic-components.js +78 -2
- package/dist/edge-runtime.js +539 -2
- package/dist/env.js +9 -2
- package/dist/error-boundaries.js +62 -12
- package/dist/error-handling.js +1 -2
- package/dist/errors/codes.js +97 -2
- package/dist/errors/formatter.js +196 -2
- package/dist/errors/index.js +44 -2
- package/dist/errors/logger.js +250 -2
- package/dist/errors/sanitizer.js +181 -2
- package/dist/errors/types.js +86 -2
- package/dist/events.js +382 -2
- package/dist/expressions.js +650 -2
- package/dist/formatter.js +265 -2
- package/dist/forms-validation.js +510 -4
- package/dist/forms.js +709 -2
- package/dist/head.js +224 -2
- package/dist/heatmap.js +566 -2
- package/dist/hot-reload.js +367 -2
- package/dist/html-masking.js +73 -2
- package/dist/hydration-runtime.js +195 -2
- package/dist/hydration.js +654 -2
- package/dist/i18n.js +633 -2
- package/dist/image-optimization/auto-sibling.js +88 -2
- package/dist/image-optimization/build-plugin.js +241 -2
- package/dist/image-optimization/component.js +244 -2
- package/dist/image-optimization/directive.js +203 -2
- package/dist/image-optimization/index.js +54 -2
- package/dist/image-optimization/processor.js +262 -2
- package/dist/image-optimization/serve.js +102 -2
- package/dist/includes.js +733 -2
- package/dist/index.d.ts +1 -0
- package/dist/index.js +134 -2
- package/dist/init.js +505 -2
- package/dist/inline-assets.js +82 -2
- package/dist/interactive.js +383 -2
- package/dist/internal-markdown.js +141 -2
- package/dist/island-chunking.js +52 -2
- package/dist/js-ts.js +57 -2
- package/dist/jsx-runtime.js +289 -2
- package/dist/keep-alive.js +421 -2
- package/dist/lazy-loader.js +245 -2
- package/dist/loading-indicator.js +322 -2
- package/dist/loops.js +643 -2
- package/dist/manifest.js +31 -2
- package/dist/markdown.js +68 -2
- package/dist/media/client/blur-up.js +217 -2
- package/dist/media/client/index.js +53 -2
- package/dist/media/client/lazy-load.js +283 -2
- package/dist/media/client/upload-handler.js +354 -2
- package/dist/media/image/component.js +574 -2
- package/dist/media/image/directive.js +160 -2
- package/dist/media/image/editing.js +193 -2
- package/dist/media/image/index.js +80 -2
- package/dist/media/image/placeholder.js +188 -2
- package/dist/media/image/processor/cache.js +51 -2
- package/dist/media/image/processor/index.js +3 -2
- package/dist/media/image/processor/optimizer.js +202 -2
- package/dist/media/image/processor/responsive.js +162 -2
- package/dist/media/image/srcset.js +194 -2
- package/dist/media/index.js +198 -2
- package/dist/media/manager/embed.js +253 -2
- package/dist/media/protected/component.js +235 -2
- package/dist/media/protected/index.js +20 -2
- package/dist/media/protected/signature.js +205 -2
- package/dist/media/shared/cache.js +132 -2
- package/dist/media/shared/hash.js +35 -2
- package/dist/media/shared/index.js +2 -2
- package/dist/media/types.js +0 -1
- package/dist/media/upload/component.js +320 -2
- package/dist/media/upload/index.js +1 -2
- package/dist/media/video/directive.js +142 -2
- package/dist/media/video/index.js +583 -2
- package/dist/media/video/processor/cache.js +52 -2
- package/dist/media/video/processor/index.js +4 -2
- package/dist/media/video/processor/streaming.js +197 -2
- package/dist/media/video/processor/thumbnail.js +134 -2
- package/dist/media/video/processor/transcoder.js +283 -2
- package/dist/method-spoofing.js +17 -2
- package/dist/middleware.js +40 -2
- package/dist/misc-directives.js +222 -2
- package/dist/native-build.js +511 -2
- package/dist/parser/directive-parser.js +239 -2
- package/dist/parser/expression-parser.js +358 -2
- package/dist/parser/index.js +23 -2
- package/dist/parser/tokenizer.js +534 -2
- package/dist/partial-hydration.js +427 -2
- package/dist/performance-utils.js +430 -2
- package/dist/placeholder.js +35 -2
- package/dist/plugin-system.js +214 -2
- package/dist/plugin.js +173 -2
- package/dist/precompiler.js +660 -81
- package/dist/process.js +711 -2
- package/dist/production-build.js +596 -2
- package/dist/production-builder.js +132 -2
- package/dist/production-server.js +188 -2
- package/dist/props.js +224 -2
- package/dist/public-env.js +19 -2
- package/dist/pwa/audit.js +255 -2
- package/dist/pwa/directives.js +332 -2
- package/dist/pwa/icons.js +109 -2
- package/dist/pwa/index.js +47 -2
- package/dist/pwa/inject.js +102 -2
- package/dist/pwa/manifest.js +186 -2
- package/dist/pwa/offline.js +259 -2
- package/dist/pwa/precache.js +116 -2
- package/dist/pwa/service-worker.js +860 -2
- package/dist/pwa/workbox-strategies.js +167 -2
- package/dist/pwa/workbox.js +382 -2
- package/dist/pwa.js +427 -427
- package/dist/reactive-bindings.js +266 -2
- package/dist/reactive.js +569 -2
- package/dist/reactivity.js +559 -2
- package/dist/release.js +1 -2
- package/dist/render.js +165 -2
- package/dist/route-middleware.js +17 -2
- package/dist/router.js +9 -2
- package/dist/routes.js +14 -2
- package/dist/runtime-injection.js +120 -2
- package/dist/runtime.js +94 -2
- package/dist/safe-evaluator.js +444 -2
- package/dist/scaffolding.js +897 -2
- package/dist/screenshot.js +87 -2
- package/dist/script-classifier.js +32 -2
- package/dist/script-validation.js +158 -2
- package/dist/seo.js +457 -2
- package/dist/serve.js +237 -2
- package/dist/server-bindings.js +108 -2
- package/dist/server-components.js +338 -11
- package/dist/signal-processing.js +946 -2
- package/dist/signals-api.js +154 -2
- package/dist/signals.js +5287 -2
- package/dist/site-builder/build.js +224 -2
- package/dist/site-builder/i18n.js +140 -2
- package/dist/site-builder/index.js +15 -2
- package/dist/site-builder/robots.js +26 -2
- package/dist/site-builder/router.js +27 -2
- package/dist/site-builder/seo.js +36 -2
- package/dist/site-builder/sitemap.js +26 -2
- package/dist/site-builder/theme.js +33 -2
- package/dist/site-builder/types.js +0 -1
- package/dist/slots.js +201 -2
- package/dist/source-maps.js +350 -2
- package/dist/spa-shell.js +34 -2
- package/dist/ssg.js +389 -389
- package/dist/ssr.js +355 -2
- package/dist/state-management.js +533 -2
- package/dist/store-imports.js +13 -2
- package/dist/store-loader.js +72 -5
- package/dist/stores-client.js +132 -2
- package/dist/story/addons.js +261 -2
- package/dist/story/analytics.js +235 -2
- package/dist/story/auto-stories.js +158 -2
- package/dist/story/bookmarks.js +277 -2
- package/dist/story/bun-test.js +102 -2
- package/dist/story/cli.js +155 -2
- package/dist/story/collect/analyzer.js +305 -2
- package/dist/story/collect/index.js +27 -2
- package/dist/story/collect/parser.js +129 -2
- package/dist/story/collect/scanner.js +101 -2
- package/dist/story/collect/tree.js +110 -2
- package/dist/story/commands/build.js +172 -2
- package/dist/story/commands/dev.js +78 -2
- package/dist/story/commands/index.js +3 -2
- package/dist/story/commands/preview.js +56 -2
- package/dist/story/compiled-output.js +151 -2
- package/dist/story/composition.js +261 -2
- package/dist/story/config-watcher.js +67 -2
- package/dist/story/config.js +64 -2
- package/dist/story/context.js +27 -2
- package/dist/story/controls/index.js +320 -2
- package/dist/story/crosswind.js +189 -2
- package/dist/story/desktop-preview.js +105 -2
- package/dist/story/docs-generator.js +186 -2
- package/dist/story/errors.js +239 -2
- package/dist/story/figma-export.js +224 -2
- package/dist/story/generator.js +165 -2
- package/dist/story/hmr.js +131 -2
- package/dist/story/hot-swap.js +207 -2
- package/dist/story/index.js +49 -2
- package/dist/story/interactions.js +225 -2
- package/dist/story/keyboard-shortcuts.js +345 -2
- package/dist/story/output.js +153 -2
- package/dist/story/performance.js +252 -2
- package/dist/story/presets.js +289 -2
- package/dist/story/props-validation.js +215 -2
- package/dist/story/renderer.js +209 -2
- package/dist/story/search-index.js +106 -2
- package/dist/story/search.js +140 -2
- package/dist/story/server.js +965 -2
- package/dist/story/setup.js +78 -2
- package/dist/story/snapshots.js +170 -2
- package/dist/story/testing.js +163 -2
- package/dist/story/theme.js +170 -2
- package/dist/story/types.js +0 -2
- package/dist/story/ui/code-panel.js +175 -2
- package/dist/story/ui/controls-panel.js +168 -2
- package/dist/story/ui/index.js +4 -2
- package/dist/story/ui/navigation.js +250 -2
- package/dist/story/ui/preview.js +251 -2
- package/dist/story/visual-testing.js +247 -2
- package/dist/streaming.js +537 -2
- package/dist/strict-lint.js +288 -2
- package/dist/style-scoping.js +50 -2
- package/dist/suspense.js +398 -2
- package/dist/teleport.js +109 -2
- package/dist/template-compiler.js +63 -2
- package/dist/template-hydrator.js +82 -2
- package/dist/template-tag-balance.js +93 -2
- package/dist/testing.js +581 -2
- package/dist/transitions.js +443 -2
- package/dist/type-checker.js +581 -2
- package/dist/types/component-types.d.ts +54 -0
- package/dist/types/component-types.js +0 -1
- package/dist/types/config-types.js +0 -1
- package/dist/types/context-types.js +0 -1
- package/dist/types/csp-types.js +0 -1
- package/dist/types/directive-types.js +3 -2
- package/dist/types/index.d.ts +5 -0
- package/dist/types/index.js +1 -2
- package/dist/types/pwa-types.js +0 -1
- package/dist/types.js +1 -2
- package/dist/typescript-templates.js +386 -4
- package/dist/utils.js +942 -2
- package/dist/validator.js +171 -2
- package/dist/variable-extractor.js +1094 -2
- package/dist/view-composers.js +29 -2
- package/dist/virtual-scrolling.js +454 -2
- package/dist/visual-editor.js +688 -28
- package/dist/vue-template.js +475 -2
- package/dist/web-components/css-scoping.js +177 -2
- package/dist/web-components/index.js +13 -2
- package/dist/web-components/reactive-generator.js +121 -56
- package/dist/web-components.js +1447 -2
- package/dist/x-element.js +17 -5
- package/package.json +6 -7
- package/dist/chunk-03c26pjz.js +0 -3
- package/dist/chunk-04mvcmcr.js +0 -106
- package/dist/chunk-05hgyyqc.js +0 -4
- package/dist/chunk-095s3972.js +0 -99
- package/dist/chunk-0b9w2w1y.js +0 -1
- package/dist/chunk-0dz85jrp.js +0 -3
- package/dist/chunk-0g4gece6.js +0 -4
- package/dist/chunk-0jd0pndq.js +0 -3
- package/dist/chunk-0jkwrcwj.js +0 -3
- package/dist/chunk-0m9tdm7t.js +0 -71
- package/dist/chunk-0qakwen3.js +0 -1
- package/dist/chunk-0qnz93q2.js +0 -3
- package/dist/chunk-0tatqxj2.js +0 -57
- package/dist/chunk-0wdar532.js +0 -102
- package/dist/chunk-13yz561y.js +0 -3
- package/dist/chunk-174z0cd0.js +0 -3
- package/dist/chunk-1mmykse5.js +0 -81
- package/dist/chunk-1z2yq9em.js +0 -3
- package/dist/chunk-1z5nhbjt.js +0 -90
- package/dist/chunk-1zgsgk4b.js +0 -1
- package/dist/chunk-25s7bckb.js +0 -171
- package/dist/chunk-268adc7r.js +0 -2230
- package/dist/chunk-26r6zh3t.js +0 -194
- package/dist/chunk-2w3302dh.js +0 -3
- package/dist/chunk-2xen423s.js +0 -3
- package/dist/chunk-39gm08bn.js +0 -39
- package/dist/chunk-3bjtemm6.js +0 -128
- package/dist/chunk-3jm3snz8.js +0 -3
- package/dist/chunk-3ngm57nt.js +0 -12
- package/dist/chunk-3rh7va1z.js +0 -3
- package/dist/chunk-3yg9hbmb.js +0 -4
- package/dist/chunk-44hd3kab.js +0 -1
- package/dist/chunk-46mkpbkk.js +0 -12
- package/dist/chunk-48cw2nde.js +0 -2
- package/dist/chunk-48r3qe0k.js +0 -3
- package/dist/chunk-4aj7ftqb.js +0 -1
- package/dist/chunk-4bt81cg3.js +0 -61
- package/dist/chunk-4j188175.js +0 -3
- package/dist/chunk-4k7d8p8d.js +0 -188
- package/dist/chunk-4qq8ffke.js +0 -28
- package/dist/chunk-50vqeesm.js +0 -142
- package/dist/chunk-52agge4n.js +0 -38
- package/dist/chunk-55yp0q8t.js +0 -201
- package/dist/chunk-57p201gb.js +0 -83
- package/dist/chunk-5ggw1dyv.js +0 -3
- package/dist/chunk-5kt3ay7x.js +0 -10
- package/dist/chunk-5p568px4.js +0 -1166
- package/dist/chunk-5ppkfyn2.js +0 -3
- package/dist/chunk-5q87fgkk.js +0 -3
- package/dist/chunk-5qb761h2.js +0 -3
- package/dist/chunk-5xvbq2gs.js +0 -30
- package/dist/chunk-647849kf.js +0 -34
- package/dist/chunk-6b5k6w2q.js +0 -7
- package/dist/chunk-6cr3eeh4.js +0 -23
- package/dist/chunk-6djgb0hr.js +0 -3
- package/dist/chunk-6dqzky7x.js +0 -35
- package/dist/chunk-6e4c6g46.js +0 -3
- package/dist/chunk-6w03t7h6.js +0 -3
- package/dist/chunk-6wn85hn6.js +0 -4
- package/dist/chunk-6y4gqs1q.js +0 -169
- package/dist/chunk-75rndzbd.js +0 -6
- package/dist/chunk-77tga15w.js +0 -3
- package/dist/chunk-7a51hkpf.js +0 -3
- package/dist/chunk-7b0xdy5h.js +0 -386
- package/dist/chunk-7cgmq685.js +0 -33
- package/dist/chunk-7dy588as.js +0 -6
- package/dist/chunk-7rvh2wwv.js +0 -721
- package/dist/chunk-7sm05m0j.js +0 -351
- package/dist/chunk-7sqdeqsw.js +0 -1
- package/dist/chunk-7xcfy2fn.js +0 -4
- package/dist/chunk-82t27pvd.js +0 -5
- package/dist/chunk-87kx8byz.js +0 -1115
- package/dist/chunk-8fgwhhb8.js +0 -6
- package/dist/chunk-8qbax8xn.js +0 -347
- package/dist/chunk-91s2hres.js +0 -8
- package/dist/chunk-94g3cahw.js +0 -11
- package/dist/chunk-957amb71.js +0 -8
- package/dist/chunk-95w08s8v.js +0 -3
- package/dist/chunk-9agvhp1x.js +0 -93
- package/dist/chunk-9tmbrwwx.js +0 -219
- package/dist/chunk-9yz5d003.js +0 -51
- package/dist/chunk-a3hyn4we.js +0 -79
- package/dist/chunk-a69tvya5.js +0 -53
- package/dist/chunk-adjcg6wa.js +0 -498
- package/dist/chunk-adqh2m9z.js +0 -45
- package/dist/chunk-asarebzq.js +0 -292
- package/dist/chunk-aw3rp9ac.js +0 -24
- package/dist/chunk-b0cyc09a.js +0 -109
- package/dist/chunk-b3kkjcdh.js +0 -3
- package/dist/chunk-b3prs7y0.js +0 -5
- package/dist/chunk-b5zc9y0y.js +0 -90
- package/dist/chunk-baa7h4yz.js +0 -3
- package/dist/chunk-bgec9r1v.js +0 -5224
- package/dist/chunk-bjnjpsgn.js +0 -3
- package/dist/chunk-bk8ew8ze.js +0 -24
- package/dist/chunk-bn08k7yy.js +0 -3
- package/dist/chunk-bpgg59wa.js +0 -3
- package/dist/chunk-bwxda6n1.js +0 -3
- package/dist/chunk-bykjk6vj.js +0 -4
- package/dist/chunk-c53hyw5c.js +0 -477
- package/dist/chunk-c7jg8w13.js +0 -3
- package/dist/chunk-ca6qd1dx.js +0 -3
- package/dist/chunk-cdbwprfv.js +0 -6
- package/dist/chunk-ceg2c2q2.js +0 -11
- package/dist/chunk-cn409b69.js +0 -3
- package/dist/chunk-cn8az1b4.js +0 -1
- package/dist/chunk-cp3kwv17.js +0 -8
- package/dist/chunk-cpcc11vp.js +0 -5
- package/dist/chunk-cr3wbrcr.js +0 -10
- package/dist/chunk-cygfdk1n.js +0 -3
- package/dist/chunk-cyp4m0vh.js +0 -16
- package/dist/chunk-cz25azze.js +0 -4
- package/dist/chunk-d77yxcds.js +0 -3
- package/dist/chunk-dvfs1h3c.js +0 -117
- package/dist/chunk-dyjnn5k8.js +0 -262
- package/dist/chunk-dzw95th7.js +0 -3
- package/dist/chunk-e0zytzdh.js +0 -179
- package/dist/chunk-e53h9qhd.js +0 -84
- package/dist/chunk-eds0f8f1.js +0 -3
- package/dist/chunk-eh8hact1.js +0 -5
- package/dist/chunk-epj957jf.js +0 -4
- package/dist/chunk-eqeyaq6g.js +0 -77
- package/dist/chunk-fbxt2mrx.js +0 -5
- package/dist/chunk-fch9tk1k.js +0 -3
- package/dist/chunk-fe7r1mq1.js +0 -9
- package/dist/chunk-fhawx87n.js +0 -8
- package/dist/chunk-fk51yyrw.js +0 -3
- package/dist/chunk-fms20x0n.js +0 -21
- package/dist/chunk-fs0qezn5.js +0 -341
- package/dist/chunk-fzm3y0r3.js +0 -267
- package/dist/chunk-g2hekckm.js +0 -161
- package/dist/chunk-g4ps1dj8.js +0 -140
- package/dist/chunk-g8b81pzc.js +0 -3
- package/dist/chunk-ganag9dm.js +0 -3
- package/dist/chunk-gc84b1d2.js +0 -58
- package/dist/chunk-gcf5v18y.js +0 -60
- package/dist/chunk-ghrx0hn1.js +0 -4
- package/dist/chunk-gqpkp459.js +0 -3
- package/dist/chunk-h45py5w5.js +0 -2
- package/dist/chunk-h5wa62ek.js +0 -145
- package/dist/chunk-h82kjdr4.js +0 -83
- package/dist/chunk-haecq01c.js +0 -3
- package/dist/chunk-hepg894w.js +0 -3
- package/dist/chunk-hjdc99kb.js +0 -3
- package/dist/chunk-hje9v2zh.js +0 -3
- package/dist/chunk-hjv76kcw.js +0 -1
- package/dist/chunk-hke99a0v.js +0 -3
- package/dist/chunk-hpqr9e3x.js +0 -3
- package/dist/chunk-hq5cem49.js +0 -236
- package/dist/chunk-hrampcrj.js +0 -3
- package/dist/chunk-ht4j68cs.js +0 -3
- package/dist/chunk-hxx3za24.js +0 -62
- package/dist/chunk-j4s5qwd7.js +0 -4
- package/dist/chunk-jbejwejg.js +0 -8
- package/dist/chunk-jc0fc4ht.js +0 -11
- package/dist/chunk-jcs0ymw7.js +0 -3
- package/dist/chunk-jfm69keq.js +0 -231
- package/dist/chunk-jfrn43vh.js +0 -2
- package/dist/chunk-jjamhxpm.js +0 -139
- package/dist/chunk-jjvp4t5w.js +0 -27
- package/dist/chunk-jt44av4j.js +0 -3
- package/dist/chunk-jt98jhpt.js +0 -10
- package/dist/chunk-k8440jxh.js +0 -6
- package/dist/chunk-kdxa9epn.js +0 -21
- package/dist/chunk-kfd2hf6f.js +0 -3
- package/dist/chunk-kgym7ch9.js +0 -8
- package/dist/chunk-kh6rfz2v.js +0 -4
- package/dist/chunk-kkp6rs2n.js +0 -36
- package/dist/chunk-ktkmvaa8.js +0 -1
- package/dist/chunk-m59y310j.js +0 -3
- package/dist/chunk-mgmyr1b9.js +0 -6
- package/dist/chunk-mqwbpamc.js +0 -3
- package/dist/chunk-mrehzhxv.js +0 -5
- package/dist/chunk-mv03qb75.js +0 -3
- package/dist/chunk-mv4fb50w.js +0 -1
- package/dist/chunk-mwbng54r.js +0 -2
- package/dist/chunk-n46a5g1g.js +0 -3
- package/dist/chunk-n944baxp.js +0 -3
- package/dist/chunk-nanw7yhz.js +0 -14
- package/dist/chunk-nap11ntr.js +0 -21
- package/dist/chunk-ncnfa8ae.js +0 -29
- package/dist/chunk-ngxfwzq3.js +0 -3
- package/dist/chunk-nvwb4x04.js +0 -3
- package/dist/chunk-nw34xajc.js +0 -8
- package/dist/chunk-payfb24w.js +0 -207
- package/dist/chunk-pc31m5x5.js +0 -398
- package/dist/chunk-pg1fvqb9.js +0 -167
- package/dist/chunk-q60knhjf.js +0 -3
- package/dist/chunk-q6h6yvzb.js +0 -10
- package/dist/chunk-qd5461tt.js +0 -3
- package/dist/chunk-qdc3aav1.js +0 -3
- package/dist/chunk-qfwzdffx.js +0 -3
- package/dist/chunk-qgxwmagw.js +0 -134
- package/dist/chunk-qhdtssn1.js +0 -19
- package/dist/chunk-qk584whs.js +0 -3
- package/dist/chunk-qm4yppj5.js +0 -57
- package/dist/chunk-qwyd9a1d.js +0 -2
- package/dist/chunk-qxs6et76.js +0 -196
- package/dist/chunk-rb1e4cnb.js +0 -3
- package/dist/chunk-rh80q1nd.js +0 -1
- package/dist/chunk-rkffm9sy.js +0 -128
- package/dist/chunk-rv002yn0.js +0 -14
- package/dist/chunk-s6ja2bdg.js +0 -66
- package/dist/chunk-sjagg9qz.js +0 -66
- package/dist/chunk-sn07azv3.js +0 -3
- package/dist/chunk-svahbw0w.js +0 -12
- package/dist/chunk-svhtdb0s.js +0 -6
- package/dist/chunk-t37dp99j.js +0 -3
- package/dist/chunk-tj6zfxeb.js +0 -64
- package/dist/chunk-tmgz5t2g.js +0 -3
- package/dist/chunk-tr0z0e1g.js +0 -3
- package/dist/chunk-tx6br9r4.js +0 -274
- package/dist/chunk-v97390pe.js +0 -1
- package/dist/chunk-vcr5pzpx.js +0 -233
- package/dist/chunk-vdfwv0fp.js +0 -6
- package/dist/chunk-vp2395eb.js +0 -3
- package/dist/chunk-vpe6napb.js +0 -28
- package/dist/chunk-vv9wfz1c.js +0 -12
- package/dist/chunk-vw6ejgmy.js +0 -21
- package/dist/chunk-vx22he47.js +0 -1
- package/dist/chunk-w01y57f5.js +0 -1539
- package/dist/chunk-w21mwxdd.js +0 -4
- package/dist/chunk-w4n8fqp7.js +0 -216
- package/dist/chunk-w959hm8j.js +0 -358
- package/dist/chunk-wf7zrjsw.js +0 -138
- package/dist/chunk-wk07pwtd.js +0 -321
- package/dist/chunk-wvef3ngh.js +0 -127
- package/dist/chunk-wxvyj65q.js +0 -2
- package/dist/chunk-x1hjv24z.js +0 -11
- package/dist/chunk-x39sfpvm.js +0 -302
- package/dist/chunk-x4fze3q2.js +0 -314
- package/dist/chunk-x64kb787.js +0 -15
- package/dist/chunk-xcb0pbr6.js +0 -4
- package/dist/chunk-xhkjhxsp.js +0 -3
- package/dist/chunk-xhnpsngj.js +0 -5
- package/dist/chunk-xsqbk4yk.js +0 -3
- package/dist/chunk-xygc53vr.js +0 -68
- package/dist/chunk-y0qg6rrv.js +0 -3
- package/dist/chunk-y25pr13j.js +0 -19
- package/dist/chunk-y4c744dk.js +0 -3
- package/dist/chunk-y4md9hp0.js +0 -3
- package/dist/chunk-y5wazw6j.js +0 -7
- package/dist/chunk-y5xz0jc4.js +0 -141
- package/dist/chunk-y86m1wr4.js +0 -4
- package/dist/chunk-yaan98dd.js +0 -3
- package/dist/chunk-yach037f.js +0 -32
- package/dist/chunk-yexjrg9d.js +0 -7
- package/dist/chunk-ygvyc6wv.js +0 -90
- package/dist/chunk-yj560gp8.js +0 -8
- package/dist/chunk-yn38c15w.js +0 -4
- package/dist/chunk-yr1gdceh.js +0 -3
- package/dist/chunk-yw2fzq86.js +0 -3
- package/dist/chunk-ywkrxp2h.js +0 -147
- package/dist/chunk-z37xq5rx.js +0 -3
- package/dist/chunk-z4djtgt0.js +0 -71
- package/dist/chunk-z8cjr9n9.js +0 -7
- package/dist/chunk-znxp3zha.js +0 -71
- package/dist/chunk-zt2yag10.js +0 -429
package/dist/chunk-s6ja2bdg.js
DELETED
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
var u=new Set;function x(){return{open(f){u.add(f),f.send(JSON.stringify({type:"connected",timestamp:Date.now()}))},close(f){u.delete(f)},message(f,k){}}}function q(f){let k=JSON.stringify({...f,timestamp:f.timestamp||Date.now()});for(let v of u)try{v.send(k)}catch{u.delete(v)}}function z(f,k){q({type:"story-update",data:{storyId:f,...k}})}function A(f,k){q({type:"story-add",data:{storyId:f,...k}})}function B(f){q({type:"story-remove",data:{storyId:f}})}function C(){q({type:"config-change"})}function D(){q({type:"full-reload"})}function E(f){q({type:"error",data:{error:f}})}function F(){return u.size}function J(f){return`
|
|
3
|
-
<script>
|
|
4
|
-
(function() {
|
|
5
|
-
const ws = new WebSocket('${f}');
|
|
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
|
-
`}
|
|
66
|
-
export{x as oc,q as pc,z as qc,A as rc,B as sc,C as tc,D as uc,E as vc,F as wc,J as xc};
|
package/dist/chunk-sjagg9qz.js
DELETED
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{sp as S,tp as g}from"./chunk-m59y310j.js";import{Er as M,Ls as E,Sr as T,ur as Q}from"./chunk-w01y57f5.js";import{et as H}from"./chunk-nap11ntr.js";import{St as b}from"./chunk-kdxa9epn.js";import{Nx as W}from"./chunk-rv002yn0.js";import{vy as O}from"./chunk-jjvp4t5w.js";import{yy as k,zy as v}from"./chunk-94g3cahw.js";import{Gy as A,Iy as F}from"./chunk-ht4j68cs.js";import{Ly as y}from"./chunk-fch9tk1k.js";import{rB as d}from"./chunk-3jm3snz8.js";import Z from"path";var f={name:"bun-plugin-stx",async setup(_){let z={...await T(),..._.config?.stx},w=new Set,x=z.webComponents?.enabled?`./${Z.relative(Z.dirname(_.config?.outdir||"dist"),z.webComponents.outputDir||"dist/web-components")}`:"/web-components",R=[];if(z.webComponents?.enabled)try{let q=await M(z,w);if(R.push(...q),z.debug&&q.length>0)console.log(`Successfully built ${q.length} web components`)}catch(q){console.error("Failed to build web components:",q)}_.onLoad({filter:/\.stx$/},async({path:q})=>{try{let K=new Set;if(z.cache&&z.cachePath){let B=await S(q,z);if(B){if(z.debug)console.log(`Using cached version of ${q}`);return{contents:B,loader:"html"}}}let G=await O(()=>Bun.file(q).text(),"",(B)=>{throw new F(`Failed to read stx file: ${q}`,q,void 0,void 0,`File read error: ${B.message}`)});if(!G)throw new F(`stx file is empty: ${q}`,q);let{scriptContent:U,templateContent:$,allScripts:X}=W.time("script-extraction",()=>{let B=G,N=G.match(/<template\b(?![^>]*(?:\b(?:id|x-for|x-if|@for|@if|:for|:if)\s*=|\s#[\w-]|\bv-slot|\bslot\s*=))[^>]*>([\s\S]*?)<\/template>/i);if(N)B=N[1].trim();let Y=G.match(/<script\b[^>]*>[\s\S]*?<\/script>/gi)||[],D="",I=[];for(let V of Y){let u=V.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i)?.[1]||"",L=V.match(/<script\b([^>]*)>/i),P=L?L[1]:"";if(/\bserver\b/i.test(P))D=u;else I.push(V)}let m=B.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"");return{scriptContent:D,templateContent:m,allScripts:I}}),j={__filename:q,__dirname:Z.dirname(q),__stx:{webComponentsPath:x,builtComponents:R}};await O(()=>H(U,j,q),void 0,(B)=>{let N=new A(`Script execution failed in ${q}: ${B.message}`,q,void 0,void 0,U.substring(0,100));if(k.log(N,{filePath:q,scriptContent:U}),z.debug)throw N});let J=await W.timeAsync("directive-processing",async()=>{return await E($,j,q,z,K)});if(X.length>0){let{interpolateScriptsInTemplate:B}=await import("././expressions.js"),N=B(X.join(`
|
|
3
|
-
`),j),Y=J.search(/<\/body>/i);if(Y!==-1)J=J.slice(0,Y)+N+`
|
|
4
|
-
`+J.slice(Y);else J+=`
|
|
5
|
-
${N}`}if(J=await b(J),K.forEach((B)=>w.add(B)),z.cache&&z.cachePath){if(await g(q,J,K,z),z.debug)console.log(`Cached template ${q} with ${K.size} dependencies`)}return{contents:J,loader:"html"}}catch(K){let G=K instanceof Error?K:new A(`Plugin processing failed: ${String(K)}`,q);if(k.log(G,{filePath:q,buildConfig:_.config}),v.logDetailedError(G,{filePath:q,plugin:"bun-plugin-stx"}),z.debug)console.error("stx Plugin Error:",G);let U=G,$=U.line||null,X=U.context||null;return{contents:z.debug||y()?`<!DOCTYPE html>
|
|
6
|
-
<html lang="en">
|
|
7
|
-
<head>
|
|
8
|
-
<meta charset="UTF-8">
|
|
9
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
10
|
-
<title>stx Rendering Error</title>
|
|
11
|
-
<style>
|
|
12
|
-
body { font-family: system-ui, -apple-system, sans-serif; max-width: 800px; margin: 40px auto; padding: 20px; line-height: 1.6; }
|
|
13
|
-
.error-header { color: #dc3545; border-left: 4px solid #dc3545; padding-left: 16px; margin-bottom: 24px; }
|
|
14
|
-
.error-details { background: #f8f9fa; border: 1px solid #dee2e6; border-radius: 8px; padding: 16px; margin: 16px 0; }
|
|
15
|
-
.error-code { background: #2d3748; color: #e2e8f0; padding: 16px; border-radius: 8px; overflow-x: auto; font-family: 'Monaco', 'Menlo', monospace; font-size: 14px; }
|
|
16
|
-
.help-section { background: #e3f2fd; border-left: 4px solid #2196f3; padding: 16px; margin-top: 24px; }
|
|
17
|
-
.file-path { font-family: monospace; background: #f1f3f4; padding: 2px 6px; border-radius: 4px; }
|
|
18
|
-
</style>
|
|
19
|
-
</head>
|
|
20
|
-
<body>
|
|
21
|
-
<div class="error-header">
|
|
22
|
-
<h1>stx Template Error</h1>
|
|
23
|
-
<p>An error occurred while processing your stx template.</p>
|
|
24
|
-
</div>
|
|
25
|
-
|
|
26
|
-
<div class="error-details">
|
|
27
|
-
<h3>Error Details</h3>
|
|
28
|
-
<p><strong>File:</strong> <span class="file-path">${Q(q)}</span></p>
|
|
29
|
-
<p><strong>Error:</strong> ${Q(G.message)}</p>
|
|
30
|
-
${$?`<p><strong>Line:</strong> ${Q(String($))}</p>`:""}
|
|
31
|
-
${X?`<p><strong>Context:</strong> ${Q(String(X))}</p>`:""}
|
|
32
|
-
</div>
|
|
33
|
-
|
|
34
|
-
${G.stack?`
|
|
35
|
-
<div class="error-details">
|
|
36
|
-
<h3>Stack Trace</h3>
|
|
37
|
-
<pre class="error-code">${Q(G.stack)}</pre>
|
|
38
|
-
</div>`:""}
|
|
39
|
-
|
|
40
|
-
<div class="help-section">
|
|
41
|
-
<h3>Troubleshooting Tips</h3>
|
|
42
|
-
<ul>
|
|
43
|
-
<li>Check the syntax of your stx directives (e.g., @if, @foreach)</li>
|
|
44
|
-
<li>Verify that all variables used in the template are properly defined</li>
|
|
45
|
-
<li>Ensure script tags have valid JavaScript/TypeScript syntax</li>
|
|
46
|
-
<li>Run <code>stx debug ${Q(Z.basename(q))}</code> for detailed analysis</li>
|
|
47
|
-
<li>Enable debug mode in your stx config for more detailed error messages</li>
|
|
48
|
-
</ul>
|
|
49
|
-
</div>
|
|
50
|
-
</body>
|
|
51
|
-
</html>`:`<!DOCTYPE html>
|
|
52
|
-
<html lang="en">
|
|
53
|
-
<head>
|
|
54
|
-
<meta charset="UTF-8">
|
|
55
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
56
|
-
<title>Error</title>
|
|
57
|
-
<style>
|
|
58
|
-
body { font-family: system-ui, -apple-system, sans-serif; max-width: 600px; margin: 80px auto; padding: 20px; text-align: center; color: #333; }
|
|
59
|
-
</style>
|
|
60
|
-
</head>
|
|
61
|
-
<body>
|
|
62
|
-
<h1>Something went wrong</h1>
|
|
63
|
-
<p>An internal error occurred. Please try again later.</p>
|
|
64
|
-
</body>
|
|
65
|
-
</html>`,loader:"html"}}})}},t=f;
|
|
66
|
-
export{f as qf,t as rf};
|
package/dist/chunk-sn07azv3.js
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{Ek as x,Fk as C}from"./chunk-5q87fgkk.js";import{Sk as U,Xk as k}from"./chunk-5ggw1dyv.js";import{rB as q}from"./chunk-3jm3snz8.js";import{resolve as B,basename as F,extname as T,join as z}from"path";import{mkdir as R}from"fs/promises";async function X(){try{return await import("ts-images")}catch{return null}}function A(K){switch(K){case"quality":return{jpeg:{quality:90,mozjpeg:!0,progressive:!0},png:{compressionLevel:6,palette:!1},webp:{quality:90,effort:6,smartSubsample:!0},avif:{quality:85,effort:6}};case"performance":return{jpeg:{quality:70,mozjpeg:!0,progressive:!0},png:{compressionLevel:9,palette:!0},webp:{quality:70,effort:4,smartSubsample:!0},avif:{quality:60,effort:2}};case"web":default:return{jpeg:{quality:82,mozjpeg:!0,progressive:!0},png:{compressionLevel:8,palette:!1},webp:{quality:82,effort:5,smartSubsample:!0},avif:{quality:75,effort:4}}}}function P(K,L){let N=L?A(L):A("web"),G=K.formatQuality||{};return{jpeg:{...N.jpeg,...G.jpeg},png:{...N.png,...G.png},webp:{...N.webp,...G.webp},avif:{...N.avif,...G.avif}}}async function f(K,L,N){let G=await X();if(!G)return console.warn("[stx-media] ts-images not installed, skipping optimization"),{src:K,processed:!1};let w=await x(K,L,N);if(w)return w;try{let O=B(K);if(!await k(O))return{src:K,processed:!1,errors:[`Source file not found: ${K}`]};let J=P(N,L.preset),Y=N.outputDir||"dist/images",E=N.baseUrl||"/images";await R(Y,{recursive:!0});let Z=await U(O),H=F(K,T(K)),S=L.outputFormat?[L.outputFormat]:N.defaultFormats||["avif","webp","jpeg"],M={src:K,processed:!0,variants:[],hash:Z},_=null;if(L.transformations&&L.transformations.length>0)_=await d(O,L.transformations,G);for(let V of S){let $=J[V]||{},j=`${H}-${Z}.${V}`,v=z(Y,j);try{let W=await G.optimizeImage({input:_||O,output:v,format:V,quality:$.quality,progressive:$.progressive});if(W){if(M.variants.push({path:v,url:`${E}/${j}`,width:W.width||0,height:W.height||0,format:V,size:W.outputSize||0}),!M.originalWidth&&W.width)M.originalWidth=W.width,M.originalHeight=W.height}}catch(W){M.errors=M.errors||[],M.errors.push(`Failed to optimize ${V}: ${W}`)}}if(L.embedThumbhash||L.placeholder==="thumbhash")try{let V=await G.generateThumbHash(O);M.placeholder=V.dataUrl}catch(V){M.errors=M.errors||[],M.errors.push(`Failed to generate thumbhash: ${V}`)}if(L.useDominantColor)try{let V=await G.generatePlaceholder(O,{strategy:"dominant-color"});M.dominantColor=V.dominantColor}catch(V){M.errors=M.errors||[],M.errors.push(`Failed to extract dominant color: ${V}`)}return await C(K,L,M,N),M}catch(O){return{src:K,processed:!1,errors:[`Processing failed: ${O}`]}}}async function n(K,L,N,G){let w=await X();if(!w)return{success:!1,error:"ts-images not installed"};try{return{success:!0,size:(await w.optimizeImage({input:K,output:G,format:L,quality:N}))?.outputSize}}catch(O){return{success:!1,error:String(O)}}}async function d(K,L,N){let G=N||await X();if(!G)return console.warn("[stx-media] ts-images not installed, skipping transformations"),null;try{let w=await G.decode(K);for(let O of L){let J=O.options||{};switch(O.type){case"resize":if(J.width||J.height)w=await G.resize(w,{width:J.width,height:J.height,fit:J.fit});break;case"blur":if(J.sigma!==void 0)w=await G.blur(w,J.sigma);break;case"sharpen":if(J.amount!==void 0)w=await G.sharpen(w,J.amount);break;case"grayscale":w=await G.grayscale(w);break;case"rotate":if(J.angle!==void 0)w=await G.rotate(w,J.angle);break;case"flip":w=await G.flip(w);break;case"flop":w=await G.flop(w);break;case"brightness":if(J.value!==void 0)w=await G.brightness(w,J.value);break;case"contrast":if(J.value!==void 0)w=await G.contrast(w,J.value);break;case"saturation":if(J.value!==void 0)w=await G.saturation(w,J.value);break}}return await G.encode(w,"png")}catch(w){return console.error(`[stx-media] Transformation failed: ${w}`),null}}
|
|
3
|
-
export{f as Ak,n as Bk,d as Ck};
|
package/dist/chunk-svahbw0w.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{Jm as O,Km as U,Lm as V,Nm as k,Om as x,Rm as F,Wm as w}from"./chunk-cygfdk1n.js";import{yw as C}from"./chunk-ywkrxp2h.js";var R=new Map;function l(){R.clear()}async function D(X,P){let q=`${X}:${JSON.stringify(P)}`;if(R.has(q))return R.get(q);try{let G=await x(X,P);return R.set(q,G),G}catch{return null}}function I(){return C({name:"image",hasEndTag:!1,description:"Render an optimized image with responsive variants",transform:async(X,P,q)=>{let{src:G,alt:Z,options:J}=f(X,P,q);if(!G)return console.warn("@image directive: missing src argument"),"<!-- @image: missing src -->";let $={widths:J.widths||(J.width?[J.width]:O),formats:J.formats||U,quality:J.quality||V,placeholder:(J.placeholder==="color"?"dominant-color":J.placeholder)||"none"};if(!await k())return M(G,Z||"",J);let N=await D(G,$);if(!N)return M(G,Z||"",J);return b(N,Z||"",J)}})}function f(X,P,q){if(P.src)return{src:String(P.src),alt:String(P.alt||""),options:P.options||{}};let Z=X.trim();if(Z.startsWith("@image(")||Z.startsWith("("))Z=Z.replace(/^@image\(/,"").replace(/^\(/,"").replace(/\)$/,"");let J=y(Z),$=J[0]||"",B=J[1]||"",N={};if($&&!$.startsWith("/")&&!$.startsWith(".")&&!$.startsWith("http")){let j=q[$];if(typeof j==="string")$=j}if(J[2])try{if(typeof J[2]==="string")N=JSON.parse(J[2]);else N=J[2]}catch{}return{src:$,alt:B,options:N}}function y(X){let P=[],q="",G=!1,Z="",J=0,$=0;for(let B=0;B<X.length;B++){let N=X[B],j=B>0?X[B-1]:"";if((N==='"'||N==="'")&&j!=="\\"){if(!G)G=!0,Z=N;else if(N===Z)G=!1,Z="";else q+=N;continue}if(!G){if(N==="{")J++;if(N==="}")J--;if(N==="[")$++;if(N==="]")$--;if(N===","&&J===0&&$===0){P.push(q.trim()),q="";continue}}q+=N}if(q.trim())P.push(q.trim());return P}function M(X,P,q){let G=[`src="${Y(X)}"`];if(P)G.push(`alt="${Y(P)}"`);if(q.width)G.push(`width="${q.width}"`);if(q.height)G.push(`height="${q.height}"`);if(q.class)G.push(`class="${Y(q.class)}"`);if(q.style)G.push(`style="${Y(q.style)}"`);if(q.lazy!==!1)G.push('loading="lazy"');return G.push('decoding="async"'),`<img ${G.join(" ")} />`}function b(X,P,q){let{variants:G,placeholder:Z,width:J,height:$,aspectRatio:B}=X,N=new Map;for(let H of G){let W=N.get(H.format)||[];W.push(H),N.set(H.format,W)}let j=["avif","webp","jpeg","png"],L=[];for(let H of j){let W=N.get(H);if(W&&W.length>0){let T=F(W),u=w(H),v=q.sizes||"100vw";L.push(` <source type="${u}" srcset="${Y(T)}" sizes="${Y(v)}" />`)}}let _=N.get("jpeg")||[],E=_.length>0?_[Math.floor(_.length/2)]:G[Math.floor(G.length/2)],z=[`src="${E?.url||X.src}"`,`alt="${Y(P)}"`];if(q.width||J)z.push(`width="${q.width||J}"`);if(q.height||$)z.push(`height="${q.height||$}"`);if(q.class)z.push(`class="${Y(q.class)}"`);let K=[];if(B)K.push(`aspect-ratio: ${B.toFixed(4)}`);if(q.style)K.push(q.style);if(K.length>0)z.push(`style="${K.join("; ")}"`);if(q.lazy!==!1&&!q.priority)z.push('loading="lazy"');if(z.push('decoding="async"'),q.priority)z.push('fetchpriority="high"');let Q=`<picture>
|
|
3
|
-
`;if(Q+=L.join(`
|
|
4
|
-
`)+`
|
|
5
|
-
`,Q+=` <img ${z.join(" ")} />
|
|
6
|
-
`,Q+="</picture>",q.placeholder&&Z){let H=`stx-img-${Math.random().toString(36).slice(2,8)}`;if(q.placeholder==="blur"||q.placeholder==="thumbhash"){let W=Z.replace(/'/g,"%27").replace(/"/g,"%22");Q=`<div id="${H}" class="stx-image-placeholder" style="background-image: url('${W}'); background-size: cover;">
|
|
7
|
-
${Q}
|
|
8
|
-
</div>`}else if(q.placeholder==="color"){let W=Z.replace(/[^a-zA-Z0-9#(),.\s%-]/g,"");Q=`<div id="${H}" class="stx-image-placeholder" style="background-color: ${W};">
|
|
9
|
-
${Q}
|
|
10
|
-
</div>`}}if(q.priority&&E){let H=w(E.format);Q=`<link rel="preload" as="image" href="${Y(E.url)}" type="${H}" />
|
|
11
|
-
`+Q}return Q}function Y(X){return X.replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(/</g,"<").replace(/>/g,">")}var h=I();
|
|
12
|
-
export{l as Zl,I as _l,h as $l};
|
package/dist/chunk-svhtdb0s.js
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{_x as Y}from"./chunk-wxvyj65q.js";import $ from"fs";import z from"path";async function v(w){let k=await $.promises.readFile(w,"utf-8"),G=z.basename(w,".stx");return B(k,G,w)}function B(w,k,G){let E=J(w),q=A(w),H=L(w),I=T(w),F=S(w),K=V(w);return{name:k,path:G,description:H,props:E,slots:q,dependencies:I,cssClasses:F,directives:K}}function J(w){let k=[],G=w.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i);if(!G)return k;let E=G[1];try{let q=Y(E);for(let H of q){if(H.name.startsWith("_"))continue;if(H.type==="function")continue;let I=O(E,H.start),F={name:H.name,type:Z(H.value||"",void 0,I),required:!1,default:H.value?_(H.value):void 0};if(I){let K=I.match(/@type\s+\{([^}]+)\}/i);if(K){if(F.type=K[1].trim(),F.type.includes("|"))F.options=F.type.split("|").map((Q)=>Q.trim().replace(/['"]/g,"")).filter((Q)=>Q!=="")}if(I.match(/@required/i))F.required=!0;let X=I.split(`
|
|
3
|
-
`).map((Q)=>Q.trim().replace(/^\*\s*/,"")).filter((Q)=>!Q.startsWith("@")&&Q.length>0);if(X.length>0)F.description=X.join(" ").trim()}k.push(F)}}catch{return b(E)}return k}function O(w,k){let E=w.slice(0,k).match(/\/\*\*\s*([\s\S]*?)\s*\*\/\s*$/);return E?E[1]:void 0}function b(w){let k=[],G=/(?:\/\*\*\s*([\s\S]*?)\s*\*\/\s*)?(?:export\s+)?(?:const|let|var)\s+(\w+)\s*(?::\s*([^=]+))?\s*=\s*([^;\n]+)/g,E=G.exec(w);while(E!==null){let[,q,H,I,F]=E;if(H.startsWith("_"))continue;let K={name:H,type:Z(F,I,q),required:!1,default:_(F)};if(q){let W=q.match(/@type\s+\{([^}]+)\}/i);if(W){if(K.type=W[1].trim(),K.type.includes("|"))K.options=K.type.split("|").map((U)=>U.trim().replace(/['"]/g,"")).filter((U)=>U!=="")}if(q.match(/@required/i))K.required=!0;let Q=q.split(`
|
|
4
|
-
`).map((U)=>U.trim().replace(/^\*\s*/,"")).filter((U)=>!U.startsWith("@")&&U.length>0);if(Q.length>0)K.description=Q.join(" ").trim()}k.push(K),E=G.exec(w)}return k}function Z(w,k,G){if(G){let q=G.match(/@type\s+\{([^}]+)\}/i);if(q)return q[1].trim()}if(k)return k.trim();let E=w.trim();if(E==="true"||E==="false")return"boolean";if(/^['"`]/.test(E))return"string";if(/^-?\d+(?:\.\d+)?$/.test(E))return"number";if(E.startsWith("["))return"array";if(E.startsWith("{"))return"object";if(E==="null")return"null";if(E==="undefined")return"undefined";return"any"}function _(w){let k=w.trim();try{if(k==="true")return!0;if(k==="false")return!1;if(k==="null")return null;if(k==="undefined")return;if(/^-?\d+(?:\.\d+)?$/.test(k))return Number(k);if(/^['"`].*['"`]$/.test(k))return k.slice(1,-1);if(k.startsWith("[")||k.startsWith("{")){let E=k.replace(/'/g,'"');try{return JSON.parse(E)}catch{return k}}return k}catch{return k}}function A(w){let k=[],G=new Set;if(/\{\{\s*slot\s*\}\}/.test(w))k.push({name:"default"}),G.add("default");let E=/<slot\s*(?:name\s*=\s*["']([^"']+)["'])?\s*\/?>/gi,q=E.exec(w);while(q!==null){let H=q[1]||"default";if(!G.has(H))k.push({name:H}),G.add(H);q=E.exec(w)}return k}function L(w){let k=w.match(/^\s*<!--\s*([\s\S]*?)\s*-->/);if(k)return k[1].trim();let G=w.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i);if(G){let E=G[1].match(/^\s*\/\*\*\s*([\s\S]*?)\s*\*\//);if(E){let q=E[1].split(`
|
|
5
|
-
`).map((H)=>H.trim().replace(/^\*\s*/,"")).filter((H)=>!H.startsWith("@")&&H.length>0);if(q.length>0)return q.join(" ").trim()}}return}function T(w){let k=[],G=new Set,E=/import\s+(\w+)\s+from\s+['"][^'"]+\.stx['"]/g,q=E.exec(w);while(q!==null){let F=q[1];if(!G.has(F))k.push(F),G.add(F);q=E.exec(w)}let H=/<([A-Z][a-zA-Z0-9]*)\b/g;q=H.exec(w);while(q!==null){let F=q[1];if(!G.has(F))k.push(F),G.add(F);q=H.exec(w)}let I=/@component\s*\(\s*['"]([^'"]+)['"]/g;q=I.exec(w);while(q!==null){let F=q[1];if(!G.has(F))k.push(F),G.add(F);q=I.exec(w)}return k}function S(w){let k=[],G=new Set,E=/class\s*=\s*["']([^"']+)["']/gi,q=E.exec(w);while(q!==null){let H=q[1];for(let I of H.split(/\s+/)){let F=I.trim();if(F&&!F.includes("{{")&&!G.has(F))k.push(F),G.add(F)}q=E.exec(w)}return k}function V(w){let k=new Map,G=["@if","@else","@elseif","@endif","@unless","@endunless","@foreach","@endforeach","@for","@endfor","@while","@endwhile","@switch","@case","@default","@endswitch","@component","@endcomponent","@slot","@endslot","@include","@layout","@extends","@section","@endsection","@yield","@push","@endpush","@stack","@once","@endonce","@auth","@endauth","@guest","@endguest","@can","@endcan","@cannot","@endcannot","@env","@endenv","@production","@endproduction","@js","@endjs","@ts","@endts","@css","@endcss","@json","@class","@style","@checked","@selected","@disabled","@readonly","@required"];for(let q of G){let H=new RegExp(q.replace("@","@"),"gi"),I=w.match(H);if(I&&I.length>0){let F=q.slice(1);if(!F.startsWith("end"))k.set(F,(k.get(F)||0)+I.length)}}let E=[];for(let[q,H]of k)E.push({name:q,count:H});return E.sort((q,H)=>H.count-q.count),E}
|
|
6
|
-
export{v as Md,B as Nd,J as Od,A as Pd,L as Qd,T as Rd,S as Sd,V as Td};
|
package/dist/chunk-t37dp99j.js
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
function q(g){return g.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function L(g){if(g.clientReactive.to)return{value:g.clientReactive.to,reactive:!0};if(g.serverDynamic.to!==void 0)return{value:String(g.serverDynamic.to),reactive:!1};if(typeof g.static.to==="string")return{value:g.static.to,reactive:!1};return{value:"#",reactive:!1}}var O={name:"StxLink",aliases:["stx-link"],render(g,G,M){let z=L(g),E=(typeof g.static.class==="string"?g.static.class:"")||(typeof g.static.className==="string"?g.static.className:""),H=typeof g.static.activeClass==="string"?g.static.activeClass:"active",I=typeof g.static.exactActiveClass==="string"?g.static.exactActiveClass:"exact-active",J=g.static.prefetch===!0||g.static.prefetch==="true"||g.serverDynamic.prefetch===!0,j=[];if(z.reactive)j.push(`:href="${q(z.value)}"`);else j.push(`href="${q(z.value)}"`);if(E)j.push(`class="${q(E)}"`);if(j.push("data-stx-link"),j.push(`data-stx-active-class="${q(H)}"`),j.push(`data-stx-exact-active-class="${q(I)}"`),J)j.push("data-stx-prefetch");let K=new Set(["to","class","className","activeClass","exactActiveClass","prefetch"]);for(let[B,D]of Object.entries(g.static)){if(K.has(B))continue;if(typeof D==="boolean"){if(D)j.push(q(B))}else j.push(`${q(B)}="${q(D)}"`)}return`<a ${j.join(" ")}>${G}</a>`}};
|
|
3
|
-
export{O as _y};
|
package/dist/chunk-tj6zfxeb.js
DELETED
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{Au as n,Du as l,Gu as XJ,Iu as i,Lu as c,Su as a,yu as d}from"./chunk-7xcfy2fn.js";import{Wu as p,bv as ZJ,dv as $J}from"./chunk-9yz5d003.js";import{rB as VJ}from"./chunk-3jm3snz8.js";async function WJ(){try{return await import("./media/image/processor/index.js")}catch(J){if(!JJ)console.warn("[stx-media] Image processor not available, some features disabled:",J),JJ=!0;return null}}var JJ=!1,o=80,h="async",y="lazy",KJ=!1;async function m(J,K={}){let $=K,X=J;if(X.process&&!X.skipOptimization){if($.tsImagesConfig?.enabled&&!$.isDev)return RJ(X,$)}if($.processedResult?.processed)return s(J,$.processedResult,K);if($.responsiveVariants)return HJ(J,$.responsiveVariants,K);let{src:B,alt:Q,width:M,height:V,sizes:W,widths:w=d,dpr:k,formats:Z=n,quality:Y=o,params:N={},placeholder:G="none",placeholderOptions:j={},lazy:R=!0,priority:_=!1,loading:L=_?"eager":y,decoding:E=h,fetchpriority:D,objectFit:f,objectPosition:I,crossorigin:H,referrerpolicy:S}=J,F=J.class,O=J.style,z=J.id,x=J.data||{},{isDev:C=!1,baseUrl:v=""}=K;if(C&&!K.optimize)return kJ(J);let P,q,T=z||`stx-img-${Math.random().toString(36).slice(2,8)}`;if(G!=="none"&&!_)try{P=await $J(B,{strategy:G,...j}),q=ZJ(T,P,j)}catch{}let u=k!==void 0&&M!==void 0,b;if(u)b=GJ(J,T,P,K);else b=await wJ(J,T,P,K);let A;if(_){let t=Z.includes("webp")?"webp":Z[0],QJ=l(B,w,{...N,q:Y},t),MJ=typeof W==="object"?i(W):W||"100vw";A=`<link rel="preload" as="image" imagesrcset="${QJ}" imagesizes="${MJ}" />`}let g=[];if(!KJ&&G!=="none")g.push(p),KJ=!0;if(q)g.push(q);let qJ=R?YJ(T):void 0;return{html:b,preloadLink:A,css:g.length>0?g.join(`
|
|
3
|
-
`):void 0,script:qJ}}async function wJ(J,K,$,X){let{src:B,alt:Q,width:M,height:V,sizes:W,widths:w=d,formats:k=n,quality:Z=o,params:Y={},lazy:N=!0,priority:G=!1,loading:j=G?"eager":y,decoding:R=h,fetchpriority:_,objectFit:L,objectPosition:E,crossorigin:D,referrerpolicy:f}=J,I=J.class,H=J.style,S=J.data||{},F=typeof W==="object"?i(W):W||"100vw",O=[];for(let C of k){let v=l(B,w,{...Y,q:Z},C),P=a(C);if(N&&!G)O.push(` <source type="${P}" data-srcset="${v}" data-sizes="${F}" />`);else O.push(` <source type="${P}" srcset="${v}" sizes="${F}" />`)}let z=r({src:c(B,{...Y,q:Z}),alt:Q,width:M,height:V,loading:G?void 0:j,decoding:R,fetchpriority:G?"high":_,objectFit:L,objectPosition:E,crossorigin:D,referrerpolicy:f,className:BJ(I,$),style:e(H,L,E,$),lazy:N&&!G,data:S}),x;if($){let C=`background-image: url('${$.dataURL}'); background-size: cover; background-position: center;`;x=`<div id="${K}" class="stx-img-placeholder" style="${C}">
|
|
4
|
-
<picture>
|
|
5
|
-
${O.join(`
|
|
6
|
-
`)}
|
|
7
|
-
<img ${z} />
|
|
8
|
-
</picture>
|
|
9
|
-
</div>`}else x=`<picture${K?` id="${K}"`:""}>
|
|
10
|
-
${O.join(`
|
|
11
|
-
`)}
|
|
12
|
-
<img ${z} />
|
|
13
|
-
</picture>`;return x}function GJ(J,K,$,X){let{src:B,alt:Q,width:M,height:V,dpr:W=[1,2,3],quality:w=o,params:k={},lazy:Z=!0,priority:Y=!1,loading:N=Y?"eager":y,decoding:G=h,fetchpriority:j,objectFit:R,objectPosition:_,crossorigin:L,referrerpolicy:E}=J,D=J.class,f=J.style,I=J.data||{},H=typeof M==="number"?M:Number.parseInt(String(M),10),S=XJ(B,H,W,{...k,q:w}),F=r({src:c(B,{...k,w:H,q:w}),alt:Q,width:M,height:V,loading:Y?void 0:N,decoding:G,fetchpriority:Y?"high":j,objectFit:R,objectPosition:_,crossorigin:L,referrerpolicy:E,className:BJ(D,$),style:e(f,R,_,$),lazy:Z&&!Y,data:I}),O=Z&&!Y?`data-srcset="${S}"`:`srcset="${S}"`;if($){let z=`background-image: url('${$.dataURL}'); background-size: cover; background-position: center;`;return`<div id="${K}" class="stx-img-placeholder" style="${z}">
|
|
14
|
-
<img ${F} ${O} />
|
|
15
|
-
</div>`}return`<img ${K?`id="${K}" `:""}${F} ${O} />`}function kJ(J){let{src:K,alt:$,width:X,height:B,loading:Q=y,decoding:M=h,fetchpriority:V,objectFit:W,objectPosition:w,crossorigin:k,referrerpolicy:Z,priority:Y=!1}=J,N=J.class,G=J.style,j=J.id,R=J.data||{};return{html:`<img ${r({src:K,alt:$,width:X,height:B,loading:Y?"eager":Q,decoding:M,fetchpriority:Y?"high":V,objectFit:W,objectPosition:w,crossorigin:k,referrerpolicy:Z,className:N,style:e(G,W,w),id:j,data:R})} />`}}function r(J){let K=[];if(J.lazy)K.push(`data-src="${U(J.src)}"`),K.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"');else K.push(`src="${U(J.src)}"`);if(K.push(`alt="${U(J.alt)}"`),J.width)K.push(`width="${J.width}"`);if(J.height)K.push(`height="${J.height}"`);if(J.loading)K.push(`loading="${J.loading}"`);if(J.decoding)K.push(`decoding="${J.decoding}"`);if(J.fetchpriority)K.push(`fetchpriority="${J.fetchpriority}"`);if(J.crossorigin)K.push(`crossorigin="${J.crossorigin}"`);if(J.referrerpolicy)K.push(`referrerpolicy="${J.referrerpolicy}"`);if(J.className)K.push(`class="${U(J.className)}"`);if(J.style)K.push(`style="${U(J.style)}"`);if(J.id)K.push(`id="${U(J.id)}"`);if(J.data)for(let[$,X]of Object.entries(J.data))K.push(`data-${$}="${U(X)}"`);if(J.lazy)K.push("data-stx-lazy");return K.join(" ")}function BJ(J,K){let $=[];if(J)$.push(J);if(K)$.push("stx-img-blur");return $.join(" ")||""}function e(J,K,$,X){let B=[];if(K)B.push(`object-fit: ${K}`);if($)B.push(`object-position: ${$}`);if(X)B.push("opacity: 0; transition: opacity 300ms ease-out");if(J)B.push(J);return B.join("; ")}function U(J){return J.replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(/</g,"<").replace(/>/g,">")}function YJ(J){return`
|
|
16
|
-
(function() {
|
|
17
|
-
const container = document.getElementById('${J}');
|
|
18
|
-
if (!container) return;
|
|
19
|
-
|
|
20
|
-
const img = container.querySelector('img[data-stx-lazy]') || container;
|
|
21
|
-
if (!img.dataset.src && !img.dataset.srcset) return;
|
|
22
|
-
|
|
23
|
-
const observer = new IntersectionObserver((entries) => {
|
|
24
|
-
entries.forEach(entry => {
|
|
25
|
-
if (entry.isIntersecting) {
|
|
26
|
-
// Load image
|
|
27
|
-
if (img.dataset.src) img.src = img.dataset.src;
|
|
28
|
-
if (img.dataset.srcset) img.srcset = img.dataset.srcset;
|
|
29
|
-
|
|
30
|
-
// Load sources
|
|
31
|
-
const sources = container.querySelectorAll('source[data-srcset]');
|
|
32
|
-
sources.forEach(source => {
|
|
33
|
-
if (source.dataset.srcset) source.srcset = source.dataset.srcset;
|
|
34
|
-
if (source.dataset.sizes) source.sizes = source.dataset.sizes;
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
// Handle load completion
|
|
38
|
-
img.onload = () => {
|
|
39
|
-
img.style.opacity = '1';
|
|
40
|
-
if (container.classList.contains('stx-img-placeholder')) {
|
|
41
|
-
container.classList.add('stx-img-loaded');
|
|
42
|
-
}
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
observer.disconnect();
|
|
46
|
-
}
|
|
47
|
-
});
|
|
48
|
-
}, { rootMargin: '50px' });
|
|
49
|
-
|
|
50
|
-
observer.observe(container);
|
|
51
|
-
})();
|
|
52
|
-
`.trim()}function OJ(J){let K=J.match(/<Img\s+([^>]*?)\/?>/);if(!K)return null;let $=K[1],X={},B=/(:?)(\w+)(?:=(?:"([^"]*)"|'([^']*)'|\{([^}]+)\}))?/g,Q;while((Q=B.exec($))!==null){let[,M,V,W,w,k]=Q,Z=W??w??k??!0;if(M===":"&&typeof Z==="string")try{X[V]=JSON.parse(Z)}catch{X[V]=Z}else switch(V){case"src":X.src=String(Z);break;case"alt":X.alt=String(Z);break;case"width":X.width=Number(Z)||Z;break;case"height":X.height=Number(Z)||Z;break;case"sizes":X.sizes=String(Z);break;case"quality":X.quality=Number(Z);break;case"placeholder":X.placeholder=Z;break;case"lazy":X.lazy=Z===!0||Z==="true";break;case"priority":X.priority=Z===!0||Z==="true";break;case"class":X.class=String(Z);break;case"style":X.style=String(Z);break;case"id":X.id=String(Z);break;case"loading":X.loading=Z;break;case"decoding":X.decoding=Z;break;case"fetchpriority":X.fetchpriority=Z;break;case"objectFit":X.objectFit=Z;break;case"objectPosition":X.objectPosition=String(Z);break;case"crossorigin":X.crossorigin=Z;break}}if(!X.src||!X.alt)return null;return X}async function NJ(J,K={}){let $=/<Img\s+[^>]*?\/?>/g,X=[],B=[],Q=[],M=J,V=[],W;while((W=$.exec(J))!==null)V.push({match:W[0],index:W.index});for(let w=V.length-1;w>=0;w--){let{match:k}=V[w],Z=OJ(k);if(Z){let Y=await m(Z,K);if(M=M.replace(k,Y.html),Y.preloadLink)X.push(Y.preloadLink);if(Y.css)B.push(Y.css);if(Y.script)Q.push(Y.script)}}return{html:M,preloadLinks:X,styles:B,scripts:Q}}async function RJ(J,K){let $=await WJ();if(!$)return m({...J,process:!1},K);let X=K.tsImagesConfig;if(J.responsiveWidths&&J.responsiveWidths.length>0||J.widths&&J.widths.length>0||!J.width&&!J.dpr){let Q=await $.generateResponsiveVariants(J.src,J,X);if(Q)return HJ(J,Q,K)}else{let Q=await $.processImage(J.src,J,X);if(Q.processed)return s(J,Q,K)}return m({...J,process:!1},K)}async function s(J,K,$){let{alt:X,width:B,height:Q,lazy:M=!0,priority:V=!1,objectFit:W,objectPosition:w,crossorigin:k,referrerpolicy:Z}=J,Y=J.class,N=J.style,G=J.id||`stx-img-${Math.random().toString(36).slice(2,8)}`,j=J.data||{},R=K.variants||[],_=R.find((q)=>q.format==="jpeg")||R.find((q)=>q.format==="webp")||R[0],L=_?.url||J.src,E=R.filter((q)=>q.format===(_?.format||"jpeg")).map((q)=>`${q.url} ${q.width}w`).join(", "),D=new Map;for(let q of R){if(!D.has(q.format))D.set(q.format,[]);D.get(q.format).push(q)}let f=[],I=["avif","webp","jpeg","png"];for(let q of I){let T=D.get(q);if(T&&T.length>0){let u=T.map((A)=>`${A.url} ${A.width}w`).join(", "),b=a(q);if(M&&!V)f.push(` <source type="${b}" data-srcset="${u}" />`);else f.push(` <source type="${b}" srcset="${u}" />`)}}let H=[];if(M&&!V){if(H.push(`data-src="${U(L)}"`),H.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"'),E)H.push(`data-srcset="${E}"`)}else if(H.push(`src="${U(L)}"`),E)H.push(`srcset="${E}"`);H.push(`alt="${U(X)}"`);let S=B||K.originalWidth,F=Q||K.originalHeight;if(S)H.push(`width="${S}"`);if(F)H.push(`height="${F}"`);if(!V)H.push(`loading="${M?"lazy":"eager"}"`);if(H.push('decoding="async"'),V)H.push('fetchpriority="high"');if(k)H.push(`crossorigin="${k}"`);if(Z)H.push(`referrerpolicy="${Z}"`);let O=[];if(W)O.push(`object-fit: ${W}`);if(w)O.push(`object-position: ${w}`);if(K.placeholder&&M)O.push("opacity: 0; transition: opacity 300ms ease-out");if(N)O.push(N);if(O.length>0)H.push(`style="${O.join("; ")}"`);let z=[];if(Y)z.push(Y);if(K.placeholder)z.push("stx-img-blur");if(z.length>0)H.push(`class="${z.join(" ")}"`);if(M&&!V)H.push("data-stx-lazy");for(let[q,T]of Object.entries(j))H.push(`data-${q}="${U(T)}"`);let x;if(K.placeholder||K.dominantColor&&J.useDominantColor){let q=K.placeholder?`background-image: url('${K.placeholder}'); background-size: cover; background-position: center;`:`background-color: ${K.dominantColor};`;x=`<div id="${G}" class="stx-img-placeholder" style="${q}">
|
|
53
|
-
<picture>
|
|
54
|
-
${f.join(`
|
|
55
|
-
`)}
|
|
56
|
-
<img ${H.join(" ")} />
|
|
57
|
-
</picture>
|
|
58
|
-
</div>`}else x=`<picture${G?` id="${G}"`:""}>
|
|
59
|
-
${f.join(`
|
|
60
|
-
`)}
|
|
61
|
-
<img ${H.join(" ")} />
|
|
62
|
-
</picture>`;let C=[];if(K.placeholder)C.push(p);let v=M?YJ(G):void 0,P;if(V&&E)P=`<link rel="preload" as="image" imagesrcset="${E}" />`;return{html:x,preloadLink:P,css:C.length>0?C.join(`
|
|
63
|
-
`):void 0,script:v}}async function HJ(J,K,$){let X={src:K.src,processed:!0,variants:[],placeholder:K.placeholder?.dataURL,originalWidth:K.placeholder?.width,originalHeight:K.placeholder?.height};for(let[B,Q]of Object.entries(K.byFormat))if(Q)X.variants.push(...Q);return s(J,X,$)}
|
|
64
|
-
export{m as vu,OJ as wu,NJ as xu};
|
package/dist/chunk-tmgz5t2g.js
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
function C(j,A={}){let B=[];for(let[D,G]of Object.entries(A)){if(G===void 0||G===null)continue;if(Array.isArray(G))B.push(`${D}=${encodeURIComponent(G.join(","))}`);else if(typeof G==="boolean"){if(G)B.push(`${D}=true`)}else B.push(`${D}=${encodeURIComponent(String(G))}`)}if(B.length===0)return j;let F=j.includes("?")?"&":"?";return`${j}${F}${B.join("&")}`}function O(j){let A=j.indexOf("?");if(A===-1)return{src:j,params:{}};let B=j.slice(0,A),F=j.slice(A+1),D={};for(let G of F.split("&")){let[K,L]=G.split("="),J=L?decodeURIComponent(L):"";if(J==="true")D[K]=!0;else if(J==="false")D[K]=!1;else if(/^-?\d+$/.test(J))D[K]=Number.parseInt(J,10);else if(/^-?\d+\.\d+$/.test(J))D[K]=Number.parseFloat(J);else if(J.includes(","))D[K]=J.split(",");else D[K]=J}return{src:B,params:D}}function M(...j){let A={};for(let B of j)if(B)Object.assign(A,B);return A}function Q(j,A,B,F){let D={w:A};if(B)D.h=B;if(F)D.fit=F;return C(j,D)}function X(j,A,B,F="center"){return C(j,{w:A,h:B,fit:"crop",crop:F})}function Y(j,A,B="center"){return C(j,{w:A,h:A,fit:"crop",crop:B})}function Z(j,A,B){return C(j,{w:A,h:B,fit:"max"})}function _(j,A,B){return C(j,{w:A,h:B,fit:"crop"})}function $(j,A){return C(j,{blur:Math.min(2000,Math.max(0,A))})}function R(j,A){return C(j,{sharp:Math.min(100,Math.max(0,A))})}function T(j){return C(j,{sat:-100})}function E(j,A=100){return C(j,{sepia:Math.min(100,Math.max(0,A))})}function H(j){return C(j,{invert:!0})}function W(j,A){return C(j,{bri:Math.min(100,Math.max(-100,A))})}function V(j,A){return C(j,{con:Math.min(100,Math.max(-100,A))})}function f(j,A){return C(j,{sat:Math.min(100,Math.max(-100,A))})}function S(j,A){return C(j,{rot:(A%360+360)%360})}function x(j){return C(j,{flip:"h"})}function k(j){return C(j,{flip:"v"})}function P(j,A,B){let F={fm:A};if(B!==void 0)F.q=B;return C(j,F)}function w(j,A){return C(j,{q:Math.min(100,Math.max(1,A))})}function q(j,A=["format","compress"]){return C(j,{auto:A})}function v(j,A,B={}){return C(j,{mark:A,markx:B.x,marky:B.y,markalpha:B.alpha,markscale:B.scale,markalign:B.align})}var N={web:{fm:"webp",q:80,auto:["format","compress"]},highQuality:{q:95},thumb:{w:150,h:150,fit:"crop",crop:"center"},avatar:{w:200,h:200,fit:"crop",crop:"faces"},social:{w:1200,h:630,fit:"crop"},preview:{w:400,q:70},placeholder:{w:20,blur:200,q:20}};function y(j,A,B){return C(j,M(N[A],B))}function b(j,A,B){return A.map((F)=>C(j,{...B,w:F}))}function z(j,A,B=[1,2,3],F){return B.map((D)=>C(j,{...F,w:Math.round(A*D),dpr:D}))}function U(j){let A=[];if(j.w!==void 0&&(j.w<1||j.w>16383))A.push("Width must be between 1 and 16383");if(j.h!==void 0&&(j.h<1||j.h>16383))A.push("Height must be between 1 and 16383");if(j.q!==void 0&&(j.q<1||j.q>100))A.push("Quality must be between 1 and 100");if(j.blur!==void 0&&(j.blur<0||j.blur>2000))A.push("Blur must be between 0 and 2000");if(j.rot!==void 0&&(j.rot<0||j.rot>359))A.push("Rotation must be between 0 and 359");if(j.dpr!==void 0&&(j.dpr<1||j.dpr>5))A.push("DPR must be between 1 and 5");return{valid:A.length===0,errors:A}}function I(j){let A={...j};if(A.w!==void 0)A.w=Math.min(16383,Math.max(1,A.w));if(A.h!==void 0)A.h=Math.min(16383,Math.max(1,A.h));if(A.q!==void 0)A.q=Math.min(100,Math.max(1,A.q));if(A.blur!==void 0)A.blur=Math.min(2000,Math.max(0,A.blur));if(A.rot!==void 0)A.rot=(A.rot%360+360)%360;if(A.dpr!==void 0)A.dpr=Math.min(5,Math.max(1,A.dpr));return A}
|
|
3
|
-
export{C as Zj,O as _j,M as $j,Q as ak,X as bk,Y as ck,Z as dk,_ as ek,$ as fk,R as gk,T as hk,E as ik,H as jk,W as kk,V as lk,f as mk,S as nk,x as ok,k as pk,P as qk,w as rk,q as sk,v as tk,N as uk,y as vk,b as wk,z as xk,U as yk,I as zk};
|
package/dist/chunk-tr0z0e1g.js
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
var B=0,A=new Map;function F(){B=0,A.clear()}function G(b,q){let j=B++,w=`<!--__STX_${b.toUpperCase()}_${j}__-->`;return A.set(w,{type:b,expression:q}),w}function I(){let b={};for(let[q,j]of A)b[q]={type:j.type,expression:j.expression};return b}function J(b){let q={},j=/<!--__STX_(EXPR|COND|RAW)_(\d+)__-->/g,w;while((w=j.exec(b))!==null){let z=w[0],D=w[1].toLowerCase(),E=A.get(z);q[z]={type:D,expression:E?.expression||""}}return q}function K(b,q){let j=b;for(let[w,z]of q)j=j.split(w).join(z);return j}function N(b){return b.includes("<!--__STX_")}
|
|
3
|
-
export{F as au,G as bu,I as cu,J as du,K as eu,N as fu};
|
package/dist/chunk-tx6br9r4.js
DELETED
|
@@ -1,274 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
class Q{instances=new Map;componentsByFile=new Map;stateSnapshots=new Map;config;constructor(k={}){this.config={preserveState:k.preserveState??!0,maxStateAge:k.maxStateAge??30000,errorRecovery:k.errorRecovery??!0,verbose:k.verbose??!1,serializeState:k.serializeState??this.defaultSerializeState.bind(this),deserializeState:k.deserializeState??this.defaultDeserializeState.bind(this)}}register(k){if(this.instances.set(k.id,k),!this.componentsByFile.has(k.name))this.componentsByFile.set(k.name,new Set);if(this.componentsByFile.get(k.name).add(k.id),this.config.verbose)console.log(`[HMR] Registered component: ${k.name} (${k.id})`)}unregister(k){let q=this.instances.get(k);if(!q)return;if(this.componentsByFile.get(q.name)?.delete(k),this.componentsByFile.get(q.name)?.size===0)this.componentsByFile.delete(q.name);if(this.stateSnapshots.delete(k),q.cleanup?.(),this.instances.delete(k),this.config.verbose)console.log(`[HMR] Unregistered component: ${q.name} (${k})`)}getInstancesByFile(k){let q=this.componentsByFile.get(k)||new Set;return Array.from(q).map((z)=>this.instances.get(z)).filter(Boolean)}getInstance(k){return this.instances.get(k)}captureState(k){let q=this.instances.get(k);if(!q||!this.config.preserveState)return;let z=this.config.serializeState(q);if(this.stateSnapshots.set(k,z),this.config.verbose)console.log(`[HMR] Captured state for: ${q.name}`)}restoreState(k){let q=this.instances.get(k),z=this.stateSnapshots.get(k);if(!q||!z||!this.config.preserveState)return!1;if(Date.now()-z.timestamp>this.config.maxStateAge){if(this.stateSnapshots.delete(k),this.config.verbose)console.log(`[HMR] State expired for: ${q.name}`);return!1}try{if(this.config.deserializeState(z,q),this.config.verbose)console.log(`[HMR] Restored state for: ${q.name}`);return!0}catch(A){return console.error(`[HMR] Failed to restore state for ${q.name}:`,A),!1}}defaultSerializeState(k){let q={},z={};if(k.element)k.element.querySelectorAll("[data-stx-ref]").forEach((B)=>{let D=B.getAttribute("data-stx-ref"),G=B.getAttribute("data-stx-value");if(D&&G)try{q[D]=JSON.parse(G)}catch{q[D]=G}});return{refs:q,reactiveObjects:z,custom:k.state?.custom||{},timestamp:Date.now()}}defaultDeserializeState(k,q){if(q.element)Object.entries(k.refs).forEach(([z,A])=>{let B=q.element.querySelector(`[data-stx-ref="${z}"]`);if(B)B.setAttribute("data-stx-value",JSON.stringify(A)),B.dispatchEvent(new CustomEvent("stx:state-restored",{detail:{name:z,value:A},bubbles:!0}))});q.state={...k,timestamp:Date.now()}}getAllInstances(){return Array.from(this.instances.values())}clear(){for(let k of this.instances.values())k.cleanup?.();this.instances.clear(),this.componentsByFile.clear(),this.stateSnapshots.clear()}}class K{registry;config;pendingUpdates=new Map;updateQueue=Promise.resolve();constructor(k={}){this.config={preserveState:k.preserveState??!0,maxStateAge:k.maxStateAge??30000,errorRecovery:k.errorRecovery??!0,verbose:k.verbose??!1,serializeState:k.serializeState??(()=>({refs:{},reactiveObjects:{},custom:{},timestamp:Date.now()})),deserializeState:k.deserializeState??(()=>{})},this.registry=new Q(this.config)}register(k){this.registry.register(k)}unregister(k){this.registry.unregister(k)}async handleUpdate(k){return this.updateQueue=this.updateQueue.then(()=>this.processUpdate(k)),this.updateQueue}async processUpdate(k){let q=this.registry.getInstancesByFile(k.file);if(q.length===0){if(this.config.verbose)console.log(`[HMR] No instances found for: ${k.file}`);return}if(this.config.verbose)console.log(`[HMR] Updating ${q.length} instance(s) of: ${k.file}`);for(let z of q)await this.updateInstance(z,k);if(typeof window<"u"&&typeof window.dispatchEvent==="function")window.dispatchEvent(new CustomEvent("stx:hmr-update",{detail:{file:k.file,count:q.length}}))}async updateInstance(k,q){this.registry.captureState(k.id);let z=!1,A=k.element?.innerHTML||"";try{if(k.element?.dispatchEvent(new CustomEvent("stx:before-hmr-update",{bubbles:!0})),k.cleanup?.(),q.type==="style")await this.updateStyles(k,q);else await this.updateComponent(k,q);let B=this.registry.restoreState(k.id);if(!B&&k.setup)await k.setup();k.element?.dispatchEvent(new CustomEvent("stx:after-hmr-update",{detail:{stateRestored:B},bubbles:!0}))}catch(B){if(z=!0,console.error(`[HMR] Error updating component ${k.name}:`,B),this.config.errorRecovery){if(k.element&&A)k.element.innerHTML=A,console.log(`[HMR] Recovered previous state for: ${k.name}`);k.element?.dispatchEvent(new CustomEvent("stx:hmr-error",{detail:{error:B},bubbles:!0}))}}if(!z&&this.config.verbose)console.log(`[HMR] Successfully updated: ${k.name}`)}async updateComponent(k,q){if(!k.element)return;let{html:z,script:A}=this.parseComponentCode(q.code);if(z)k.element.innerHTML=z;if(A)await this.executeScript(A,k);if(k.render)k.element.innerHTML=k.render();this.reinitializeInteractivity(k)}async updateStyles(k,q){if(!k.element)return;let z=q.code.match(/<style\b[^>]*>([\s\S]*?)<\/style>/i);if(!z)return;let A=z[1],B=k.id,D=document.querySelector(`style[data-stx-component="${B}"]`);if(!D)D=document.createElement("style"),D.setAttribute("data-stx-component",B),document.head.appendChild(D);if(D.textContent=A,this.config.verbose)console.log(`[HMR] Updated styles for: ${k.name}`)}parseComponentCode(k){let q=k,z="",A="",B=k.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i);if(B)z=B[1],q=q.replace(B[0],"");let D=k.match(/<style\b[^>]*>([\s\S]*?)<\/style>/i);if(D)A=D[1],q=q.replace(D[0],"");return{html:q.trim(),script:z.trim(),style:A.trim()}}async executeScript(k,q){try{let z={element:q.element,props:q.props,...typeof window<"u"?window.stx:{}},A=`
|
|
3
|
-
return (async function() {
|
|
4
|
-
${k}
|
|
5
|
-
})()
|
|
6
|
-
`;await Function(...Object.keys(z),A)(...Object.values(z))}catch(z){throw console.error("[HMR] Script execution error:",z),z}}reinitializeInteractivity(k){if(!k.element)return;k.element.querySelectorAll("[data-stx-events]").forEach((z)=>{let A=z.getAttribute("data-stx-events");if(!A)return;try{let B=JSON.parse(A);for(let[D,G]of Object.entries(B))if(typeof window<"u"&&window.stx?.[G])z.addEventListener(D,window.stx[G])}catch{}}),k.element.dispatchEvent(new CustomEvent("stx:reinitialize",{bubbles:!0}))}getRegistry(){return this.registry}async refresh(k){let q=this.registry.getInstancesByFile(k);for(let z of q)if(z.render&&z.element)this.registry.captureState(z.id),z.element.innerHTML=z.render(),this.registry.restoreState(z.id),this.reinitializeInteractivity(z)}}function U(k){return`
|
|
7
|
-
<script data-stx-hmr-client>
|
|
8
|
-
(function() {
|
|
9
|
-
'use strict';
|
|
10
|
-
|
|
11
|
-
// Component registry
|
|
12
|
-
const __instances = new Map();
|
|
13
|
-
const __stateSnapshots = new Map();
|
|
14
|
-
|
|
15
|
-
// Register a component
|
|
16
|
-
function registerComponent(id, name, element, props, setup, render, cleanup) {
|
|
17
|
-
__instances.set(id, {
|
|
18
|
-
id,
|
|
19
|
-
name,
|
|
20
|
-
element,
|
|
21
|
-
props: props || {},
|
|
22
|
-
setup,
|
|
23
|
-
render,
|
|
24
|
-
cleanup,
|
|
25
|
-
state: { refs: {}, reactiveObjects: {}, custom: {}, timestamp: Date.now() },
|
|
26
|
-
isMounted: true,
|
|
27
|
-
children: new Map()
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
console.log('[HMR] Registered:', name, '(' + id + ')');
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
// Unregister a component
|
|
34
|
-
function unregisterComponent(id) {
|
|
35
|
-
const instance = __instances.get(id);
|
|
36
|
-
if (instance) {
|
|
37
|
-
instance.cleanup?.();
|
|
38
|
-
__instances.delete(id);
|
|
39
|
-
__stateSnapshots.delete(id);
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
// Capture component state
|
|
44
|
-
function captureState(id) {
|
|
45
|
-
const instance = __instances.get(id);
|
|
46
|
-
if (!instance || !instance.element) return;
|
|
47
|
-
|
|
48
|
-
const state = { refs: {}, reactiveObjects: {}, custom: {}, timestamp: Date.now() };
|
|
49
|
-
|
|
50
|
-
// Capture form values
|
|
51
|
-
instance.element.querySelectorAll('input, textarea, select').forEach(el => {
|
|
52
|
-
if (el.name || el.id) {
|
|
53
|
-
state.refs[el.name || el.id] = el.type === 'checkbox' ? el.checked : el.value;
|
|
54
|
-
}
|
|
55
|
-
});
|
|
56
|
-
|
|
57
|
-
// Capture data-stx-state attributes
|
|
58
|
-
instance.element.querySelectorAll('[data-stx-state]').forEach(el => {
|
|
59
|
-
const key = el.getAttribute('data-stx-state');
|
|
60
|
-
const value = el.getAttribute('data-stx-value');
|
|
61
|
-
if (key && value) {
|
|
62
|
-
try { state.custom[key] = JSON.parse(value); }
|
|
63
|
-
catch { state.custom[key] = value; }
|
|
64
|
-
}
|
|
65
|
-
});
|
|
66
|
-
|
|
67
|
-
__stateSnapshots.set(id, state);
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
// Restore component state
|
|
71
|
-
function restoreState(id) {
|
|
72
|
-
const instance = __instances.get(id);
|
|
73
|
-
const state = __stateSnapshots.get(id);
|
|
74
|
-
if (!instance || !state || !instance.element) return false;
|
|
75
|
-
|
|
76
|
-
// Restore form values
|
|
77
|
-
Object.entries(state.refs).forEach(([name, value]) => {
|
|
78
|
-
const el = instance.element.querySelector('[name="' + name + '"], #' + name);
|
|
79
|
-
if (el) {
|
|
80
|
-
if (el.type === 'checkbox') el.checked = value;
|
|
81
|
-
else el.value = value;
|
|
82
|
-
}
|
|
83
|
-
});
|
|
84
|
-
|
|
85
|
-
// Restore data-stx-state
|
|
86
|
-
Object.entries(state.custom).forEach(([key, value]) => {
|
|
87
|
-
const el = instance.element.querySelector('[data-stx-state="' + key + '"]');
|
|
88
|
-
if (el) {
|
|
89
|
-
el.setAttribute('data-stx-value', JSON.stringify(value));
|
|
90
|
-
el.dispatchEvent(new CustomEvent('stx:state-restored', { detail: { key, value } }));
|
|
91
|
-
}
|
|
92
|
-
});
|
|
93
|
-
|
|
94
|
-
return true;
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
// Handle HMR update
|
|
98
|
-
async function handleUpdate(data) {
|
|
99
|
-
const { file, code, type } = data;
|
|
100
|
-
|
|
101
|
-
// Find matching instances
|
|
102
|
-
const instances = [];
|
|
103
|
-
__instances.forEach(inst => {
|
|
104
|
-
if (inst.name === file || file.endsWith(inst.name + '.stx')) {
|
|
105
|
-
instances.push(inst);
|
|
106
|
-
}
|
|
107
|
-
});
|
|
108
|
-
|
|
109
|
-
if (instances.length === 0) {
|
|
110
|
-
console.log('[HMR] No instances for:', file, '- doing full reload');
|
|
111
|
-
window.location.reload();
|
|
112
|
-
return;
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
console.log('[HMR] Updating', instances.length, 'instance(s) of:', file);
|
|
116
|
-
|
|
117
|
-
for (const instance of instances) {
|
|
118
|
-
try {
|
|
119
|
-
// Capture state
|
|
120
|
-
captureState(instance.id);
|
|
121
|
-
|
|
122
|
-
// Run cleanup
|
|
123
|
-
instance.cleanup?.();
|
|
124
|
-
|
|
125
|
-
// Style-only update
|
|
126
|
-
if (type === 'style') {
|
|
127
|
-
const styleMatch = code.match(/<style[^>]*>([\\s\\S]*?)<\\/style>/i);
|
|
128
|
-
if (styleMatch) {
|
|
129
|
-
let styleEl = document.querySelector('style[data-stx-component="' + instance.id + '"]');
|
|
130
|
-
if (!styleEl) {
|
|
131
|
-
styleEl = document.createElement('style');
|
|
132
|
-
styleEl.setAttribute('data-stx-component', instance.id);
|
|
133
|
-
document.head.appendChild(styleEl);
|
|
134
|
-
}
|
|
135
|
-
styleEl.textContent = styleMatch[1];
|
|
136
|
-
}
|
|
137
|
-
continue;
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
// Full update - extract and apply HTML
|
|
141
|
-
let html = code;
|
|
142
|
-
html = html.replace(/<script[^>]*>[\\s\\S]*?<\\/script>/gi, '');
|
|
143
|
-
html = html.replace(/<style[^>]*>[\\s\\S]*?<\\/style>/gi, '');
|
|
144
|
-
html = html.trim();
|
|
145
|
-
|
|
146
|
-
if (instance.element && html) {
|
|
147
|
-
instance.element.innerHTML = html;
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
// Re-run setup
|
|
151
|
-
if (instance.setup) {
|
|
152
|
-
await instance.setup();
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
// Restore state
|
|
156
|
-
restoreState(instance.id);
|
|
157
|
-
|
|
158
|
-
// Dispatch events
|
|
159
|
-
instance.element?.dispatchEvent(new CustomEvent('stx:hmr-updated', { bubbles: true }));
|
|
160
|
-
|
|
161
|
-
console.log('[HMR] Updated:', instance.name);
|
|
162
|
-
}
|
|
163
|
-
catch (error) {
|
|
164
|
-
console.error('[HMR] Update failed for', instance.name, error);
|
|
165
|
-
// Restore previous state on error
|
|
166
|
-
restoreState(instance.id);
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
window.dispatchEvent(new CustomEvent('stx:hmr-complete', {
|
|
171
|
-
detail: { file, count: instances.length }
|
|
172
|
-
}));
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
// Connect to HMR WebSocket
|
|
176
|
-
let ws = null;
|
|
177
|
-
let reconnectTimer = null;
|
|
178
|
-
|
|
179
|
-
function connect() {
|
|
180
|
-
try {
|
|
181
|
-
ws = new WebSocket('ws://' + window.location.hostname + ':${k}');
|
|
182
|
-
|
|
183
|
-
ws.onopen = () => {
|
|
184
|
-
console.log('[HMR] Connected');
|
|
185
|
-
clearTimeout(reconnectTimer);
|
|
186
|
-
};
|
|
187
|
-
|
|
188
|
-
ws.onmessage = async (event) => {
|
|
189
|
-
try {
|
|
190
|
-
const data = JSON.parse(event.data);
|
|
191
|
-
if (data.type === 'component-update') {
|
|
192
|
-
await handleUpdate(data);
|
|
193
|
-
}
|
|
194
|
-
else if (data.type === 'reload') {
|
|
195
|
-
// Fall back to full reload
|
|
196
|
-
window.location.reload();
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
catch (e) {
|
|
200
|
-
console.error('[HMR] Message error:', e);
|
|
201
|
-
}
|
|
202
|
-
};
|
|
203
|
-
|
|
204
|
-
ws.onclose = () => {
|
|
205
|
-
ws = null;
|
|
206
|
-
reconnectTimer = setTimeout(connect, 1000);
|
|
207
|
-
};
|
|
208
|
-
}
|
|
209
|
-
catch (e) {
|
|
210
|
-
reconnectTimer = setTimeout(connect, 1000);
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
// Initialize
|
|
215
|
-
if (document.readyState === 'loading') {
|
|
216
|
-
document.addEventListener('DOMContentLoaded', connect);
|
|
217
|
-
}
|
|
218
|
-
else {
|
|
219
|
-
connect();
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
// Expose API
|
|
223
|
-
window.__stxHMR = {
|
|
224
|
-
register: registerComponent,
|
|
225
|
-
unregister: unregisterComponent,
|
|
226
|
-
captureState,
|
|
227
|
-
restoreState,
|
|
228
|
-
refresh: (name) => handleUpdate({ file: name, code: '', type: 'refresh' }),
|
|
229
|
-
instances: () => Array.from(__instances.values())
|
|
230
|
-
};
|
|
231
|
-
})();
|
|
232
|
-
</script>
|
|
233
|
-
`}function W(k,q,z,A){return`
|
|
234
|
-
<div data-stx-component="${k}" data-stx-name="${q}">
|
|
235
|
-
${z}
|
|
236
|
-
</div>
|
|
237
|
-
<script>
|
|
238
|
-
(function() {
|
|
239
|
-
const __id = '${k}';
|
|
240
|
-
const __name = '${q}';
|
|
241
|
-
const __element = document.querySelector('[data-stx-component="${k}"]');
|
|
242
|
-
|
|
243
|
-
let __cleanup = null;
|
|
244
|
-
|
|
245
|
-
async function __setup() {
|
|
246
|
-
${A}
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
function __render() {
|
|
250
|
-
return __element?.innerHTML || '';
|
|
251
|
-
}
|
|
252
|
-
|
|
253
|
-
// Register with HMR
|
|
254
|
-
if (window.__stxHMR) {
|
|
255
|
-
window.__stxHMR.register(__id, __name, __element, {}, __setup, __render, () => __cleanup?.());
|
|
256
|
-
}
|
|
257
|
-
|
|
258
|
-
// Run setup
|
|
259
|
-
__setup();
|
|
260
|
-
|
|
261
|
-
// Cleanup on removal
|
|
262
|
-
const observer = new MutationObserver((mutations) => {
|
|
263
|
-
if (!document.body.contains(__element)) {
|
|
264
|
-
observer.disconnect();
|
|
265
|
-
if (window.__stxHMR) {
|
|
266
|
-
window.__stxHMR.unregister(__id);
|
|
267
|
-
}
|
|
268
|
-
}
|
|
269
|
-
});
|
|
270
|
-
observer.observe(document.body, { childList: true, subtree: true });
|
|
271
|
-
})();
|
|
272
|
-
</script>
|
|
273
|
-
`}var J=null;function X(k){if(!J)J=new K(k);return J}function Y(){if(J)J.getRegistry().clear(),J=null}var Z={ComponentHMRHandler:K,getHMRHandler:X,resetHMRHandler:Y,generateHMRClientScript:U,wrapComponentForHMR:W};
|
|
274
|
-
export{K as ap,U as bp,W as cp,X as dp,Y as ep,Z as fp};
|
package/dist/chunk-v97390pe.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
// @bun
|