@stacksjs/stx 0.2.95 → 0.2.97
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 -2
- package/dist/dev-server/serve-file.js +439 -2
- package/dist/dev-server/serve-markdown.js +281 -2
- package/dist/dev-server/serve-multi.js +579 -2
- 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 +5 -6
- package/dist/chunk-04n64bnt.js +0 -5
- package/dist/chunk-06w68hyg.js +0 -7
- package/dist/chunk-07y6m5xx.js +0 -3
- package/dist/chunk-095s3972.js +0 -99
- package/dist/chunk-09k66d8a.js +0 -3
- package/dist/chunk-0a61y94n.js +0 -24
- package/dist/chunk-0b9w2w1y.js +0 -1
- package/dist/chunk-0dx4q6yq.js +0 -3
- package/dist/chunk-0dz85jrp.js +0 -3
- package/dist/chunk-0jd0pndq.js +0 -3
- package/dist/chunk-0p0nyq50.js +0 -6
- package/dist/chunk-0p1h3p3w.js +0 -3
- package/dist/chunk-0qakwen3.js +0 -1
- package/dist/chunk-0qnz93q2.js +0 -3
- package/dist/chunk-10debkj5.js +0 -71
- package/dist/chunk-15nesxgt.js +0 -5224
- package/dist/chunk-1sr54zp8.js +0 -3
- package/dist/chunk-1v49fwr5.js +0 -3
- package/dist/chunk-1xz0w746.js +0 -1539
- package/dist/chunk-1z5nhbjt.js +0 -90
- package/dist/chunk-1zgsgk4b.js +0 -1
- package/dist/chunk-20swzkx3.js +0 -216
- package/dist/chunk-27zsyhrd.js +0 -4
- package/dist/chunk-29y0hk5z.js +0 -3
- package/dist/chunk-2cdvw21b.js +0 -274
- package/dist/chunk-2j21d3ka.js +0 -161
- package/dist/chunk-2jxbwnkz.js +0 -2
- package/dist/chunk-31dr4bys.js +0 -6
- package/dist/chunk-35faj94w.js +0 -15
- package/dist/chunk-39gm08bn.js +0 -39
- package/dist/chunk-3a4qsygv.js +0 -51
- package/dist/chunk-3te20hqw.js +0 -3
- package/dist/chunk-43t7faps.js +0 -24
- package/dist/chunk-44hd3kab.js +0 -1
- package/dist/chunk-47kpewks.js +0 -71
- package/dist/chunk-4aj7ftqb.js +0 -1
- package/dist/chunk-4d2y57k7.js +0 -3
- package/dist/chunk-4deg33rw.js +0 -57
- package/dist/chunk-4k7d8p8d.js +0 -188
- package/dist/chunk-4qcy5tx6.js +0 -53
- package/dist/chunk-4x7kae4j.js +0 -3
- package/dist/chunk-55nwdnsd.js +0 -3
- package/dist/chunk-55yp0q8t.js +0 -201
- package/dist/chunk-5f43yz6z.js +0 -12
- package/dist/chunk-5shey2e4.js +0 -3
- package/dist/chunk-6b5k6w2q.js +0 -7
- package/dist/chunk-6djzdes9.js +0 -14
- package/dist/chunk-6e4c6g46.js +0 -3
- package/dist/chunk-6eqbxcrd.js +0 -8
- package/dist/chunk-7074g241.js +0 -3
- package/dist/chunk-7b6s3g65.js +0 -179
- package/dist/chunk-7cgmq685.js +0 -33
- package/dist/chunk-7dkz6z2s.js +0 -3
- package/dist/chunk-7ed3tean.js +0 -3
- package/dist/chunk-7gd339hd.js +0 -109
- package/dist/chunk-7j5e8sdj.js +0 -3
- package/dist/chunk-7n8g0nfn.js +0 -38
- package/dist/chunk-7sqdeqsw.js +0 -1
- package/dist/chunk-80g54ncj.js +0 -3
- package/dist/chunk-8a5bxece.js +0 -4
- package/dist/chunk-8ahwt6a4.js +0 -721
- package/dist/chunk-8b3z0zd5.js +0 -8
- package/dist/chunk-8dhdpa5h.js +0 -4
- package/dist/chunk-8n9nnqr6.js +0 -3
- package/dist/chunk-8qc1bsym.js +0 -3
- package/dist/chunk-8va64c9n.js +0 -3
- package/dist/chunk-8vtm0m84.js +0 -3
- package/dist/chunk-8xj7c3mf.js +0 -8
- package/dist/chunk-988dw6q3.js +0 -9
- package/dist/chunk-9b6cec0v.js +0 -321
- package/dist/chunk-9cf97f9p.js +0 -3
- package/dist/chunk-9ecv8aqj.js +0 -14
- package/dist/chunk-9eq3ht5f.js +0 -8
- package/dist/chunk-9jtj77jx.js +0 -3
- package/dist/chunk-9t14se2t.js +0 -83
- package/dist/chunk-9wmq2272.js +0 -3
- package/dist/chunk-9zbk5zx5.js +0 -57
- package/dist/chunk-a2g2qb2y.js +0 -386
- package/dist/chunk-a3hyn4we.js +0 -79
- package/dist/chunk-a87qqft6.js +0 -194
- package/dist/chunk-ah88wzbg.js +0 -10
- package/dist/chunk-akf1r75r.js +0 -102
- package/dist/chunk-amaa1bev.js +0 -2
- package/dist/chunk-avx8aydt.js +0 -3
- package/dist/chunk-ay9qf4zj.js +0 -6
- package/dist/chunk-aywxfqev.js +0 -3
- package/dist/chunk-azkegjd8.js +0 -61
- package/dist/chunk-b77wjyn7.js +0 -84
- package/dist/chunk-baf1hfwh.js +0 -231
- package/dist/chunk-bdk6g1vj.js +0 -3
- package/dist/chunk-bhqgmyqw.js +0 -36
- package/dist/chunk-bk3j0n82.js +0 -341
- package/dist/chunk-bndmdahk.js +0 -3
- package/dist/chunk-bpgg59wa.js +0 -3
- package/dist/chunk-bs3gmfxz.js +0 -5
- package/dist/chunk-bxc7kjsk.js +0 -32
- package/dist/chunk-c7jg8w13.js +0 -3
- package/dist/chunk-ckxjqqn9.js +0 -3
- package/dist/chunk-cn8az1b4.js +0 -1
- package/dist/chunk-d0zjtdw4.js +0 -29
- package/dist/chunk-d1qh1x2g.js +0 -3
- package/dist/chunk-djddhmcc.js +0 -60
- package/dist/chunk-dqn9gyhb.js +0 -21
- package/dist/chunk-drjq2zwg.js +0 -3
- package/dist/chunk-dvfs1h3c.js +0 -117
- package/dist/chunk-e2q9c5vq.js +0 -8
- package/dist/chunk-e98v1bc6.js +0 -12
- package/dist/chunk-ejayeex8.js +0 -2
- package/dist/chunk-ejh8fyak.js +0 -3
- package/dist/chunk-ek2w6zvy.js +0 -4
- package/dist/chunk-ewa88139.js +0 -6
- package/dist/chunk-fjk3x41y.js +0 -3
- package/dist/chunk-frg705zq.js +0 -302
- package/dist/chunk-fzm3y0r3.js +0 -267
- package/dist/chunk-g1vt329s.js +0 -21
- package/dist/chunk-g4ps1dj8.js +0 -140
- package/dist/chunk-gkzq8zw4.js +0 -23
- package/dist/chunk-gz5fmp3q.js +0 -3
- package/dist/chunk-h0hjy0kn.js +0 -292
- package/dist/chunk-h5jxydqq.js +0 -147
- package/dist/chunk-h5wa62ek.js +0 -145
- package/dist/chunk-h7aq56qj.js +0 -28
- package/dist/chunk-h82kjdr4.js +0 -83
- package/dist/chunk-hbehnm18.js +0 -3
- package/dist/chunk-hbgxbgam.js +0 -58
- package/dist/chunk-hc2mf5h6.js +0 -4
- package/dist/chunk-hjm2xab3.js +0 -3
- package/dist/chunk-hjv76kcw.js +0 -1
- package/dist/chunk-hrnnh4tq.js +0 -142
- package/dist/chunk-ht43ds42.js +0 -236
- package/dist/chunk-hxx3za24.js +0 -62
- package/dist/chunk-hy8820vc.js +0 -6
- package/dist/chunk-j447q024.js +0 -28
- package/dist/chunk-j58vh0w6.js +0 -314
- package/dist/chunk-j8tn8enq.js +0 -3
- package/dist/chunk-jc0fc4ht.js +0 -11
- package/dist/chunk-jcs0ymw7.js +0 -3
- package/dist/chunk-jjamhxpm.js +0 -139
- package/dist/chunk-jjb05d21.js +0 -3
- package/dist/chunk-jjdq01dv.js +0 -128
- package/dist/chunk-jnmgm2xw.js +0 -5
- package/dist/chunk-jpndqst5.js +0 -3
- package/dist/chunk-jt0ezawy.js +0 -351
- package/dist/chunk-jz73j3qs.js +0 -169
- package/dist/chunk-k21df0pg.js +0 -10
- package/dist/chunk-k848dzsa.js +0 -429
- package/dist/chunk-kdfe4t91.js +0 -3
- package/dist/chunk-keawsbpn.js +0 -5
- package/dist/chunk-kgym7ch9.js +0 -8
- package/dist/chunk-khdn7jwe.js +0 -3
- package/dist/chunk-km25cwz6.js +0 -3
- package/dist/chunk-knm8a8yx.js +0 -398
- package/dist/chunk-krqn0ddk.js +0 -3
- package/dist/chunk-ktkmvaa8.js +0 -1
- package/dist/chunk-kx6eb6ma.js +0 -4
- package/dist/chunk-kypas8vy.js +0 -4
- package/dist/chunk-m167kjhv.js +0 -4
- package/dist/chunk-m491r0rj.js +0 -358
- package/dist/chunk-m8448qby.js +0 -11
- package/dist/chunk-mgj88zeq.js +0 -64
- package/dist/chunk-mhgk632d.js +0 -3
- package/dist/chunk-mv4fb50w.js +0 -1
- package/dist/chunk-n5kg7fpx.js +0 -7
- package/dist/chunk-n98x35xd.js +0 -8
- package/dist/chunk-n9dhs1dw.js +0 -106
- package/dist/chunk-nd9rmddh.js +0 -6
- package/dist/chunk-ngxfwzq3.js +0 -3
- package/dist/chunk-nhv099jv.js +0 -19
- package/dist/chunk-nm15ccsg.js +0 -5
- package/dist/chunk-npfmdb6y.js +0 -71
- package/dist/chunk-nvwb4x04.js +0 -3
- package/dist/chunk-nw34xajc.js +0 -8
- package/dist/chunk-p077sw22.js +0 -3
- package/dist/chunk-p1h8065h.js +0 -3
- package/dist/chunk-p3e0cqtt.js +0 -34
- package/dist/chunk-p3fpb79v.js +0 -477
- package/dist/chunk-p52yzjq6.js +0 -498
- package/dist/chunk-p73meypx.js +0 -134
- package/dist/chunk-pa9zb7ty.js +0 -4
- package/dist/chunk-payfb24w.js +0 -207
- package/dist/chunk-pcm1vd8w.js +0 -3
- package/dist/chunk-pcntd9h4.js +0 -3
- package/dist/chunk-pg1fvqb9.js +0 -167
- package/dist/chunk-psc3wfcf.js +0 -1115
- package/dist/chunk-pznnww6k.js +0 -6
- package/dist/chunk-q6zhd9yf.js +0 -3
- package/dist/chunk-qa59zejf.js +0 -246
- package/dist/chunk-qvrbjpdc.js +0 -3
- package/dist/chunk-qygvvygy.js +0 -12
- package/dist/chunk-r0jcmpv6.js +0 -68
- package/dist/chunk-r5m9xtm7.js +0 -3
- package/dist/chunk-rh80q1nd.js +0 -1
- package/dist/chunk-rkffm9sy.js +0 -128
- package/dist/chunk-rpx5fa65.js +0 -3
- package/dist/chunk-rqxf5hns.js +0 -3
- package/dist/chunk-rtr974rc.js +0 -30
- package/dist/chunk-rvptcndz.js +0 -3
- package/dist/chunk-rw26rpek.js +0 -171
- package/dist/chunk-rw7937v4.js +0 -19
- package/dist/chunk-rwrv9wbf.js +0 -3
- package/dist/chunk-rz2ec6g7.js +0 -347
- package/dist/chunk-s6ja2bdg.js +0 -66
- package/dist/chunk-scpkdrdb.js +0 -4
- package/dist/chunk-shv88d2d.js +0 -10
- package/dist/chunk-t0c9wvpr.js +0 -3
- package/dist/chunk-tffh3b1e.js +0 -35
- package/dist/chunk-tg2f1mzq.js +0 -11
- package/dist/chunk-trfswy66.js +0 -77
- package/dist/chunk-tzwtg722.js +0 -3
- package/dist/chunk-v7f8jj15.js +0 -4
- package/dist/chunk-v8j49spx.js +0 -3
- package/dist/chunk-v97390pe.js +0 -1
- package/dist/chunk-vcr5pzpx.js +0 -233
- package/dist/chunk-veeerpwa.js +0 -3
- package/dist/chunk-vg5kt6az.js +0 -4
- package/dist/chunk-vgv7jvyz.js +0 -219
- package/dist/chunk-vjbefncc.js +0 -3
- package/dist/chunk-vmxjghsm.js +0 -3
- package/dist/chunk-vw7vqd76.js +0 -3
- package/dist/chunk-vx22he47.js +0 -1
- package/dist/chunk-w3b6m427.js +0 -45
- package/dist/chunk-wazkqv7n.js +0 -3
- package/dist/chunk-wf7zrjsw.js +0 -138
- package/dist/chunk-wfg2gm11.js +0 -3
- package/dist/chunk-wg9k6h8w.js +0 -12
- package/dist/chunk-wkz2vwkr.js +0 -81
- package/dist/chunk-wvef3ngh.js +0 -127
- package/dist/chunk-wvf31nzs.js +0 -3
- package/dist/chunk-x05nxhyv.js +0 -262
- package/dist/chunk-x0770gt9.js +0 -4
- package/dist/chunk-x24s4heg.js +0 -1166
- package/dist/chunk-x3r64r0c.js +0 -6
- package/dist/chunk-x5g9w4hh.js +0 -5
- package/dist/chunk-xgkv66q5.js +0 -2230
- package/dist/chunk-xqq1vxb6.js +0 -1
- package/dist/chunk-xs03kc1h.js +0 -196
- package/dist/chunk-xv34zbp4.js +0 -3
- package/dist/chunk-xw36p73h.js +0 -90
- package/dist/chunk-xyg1r5w0.js +0 -4
- package/dist/chunk-xys2sxh6.js +0 -16
- package/dist/chunk-y0qg6rrv.js +0 -3
- package/dist/chunk-y1k17c8b.js +0 -21
- package/dist/chunk-y5xz0jc4.js +0 -141
- package/dist/chunk-y6xsqe9a.js +0 -10
- package/dist/chunk-yb1t2h8h.js +0 -11
- package/dist/chunk-ygvyc6wv.js +0 -90
- package/dist/chunk-yj4x5ehw.js +0 -21
- package/dist/chunk-yn38c15w.js +0 -4
- package/dist/chunk-ynhngsdh.js +0 -3
- package/dist/chunk-yrsb6j3z.js +0 -3
- package/dist/chunk-yywfvfph.js +0 -2
- package/dist/chunk-zcxzdrn7.js +0 -5
- package/dist/chunk-zen6ax1y.js +0 -27
- package/dist/chunk-zf2pek72.js +0 -3
- package/dist/chunk-zk3d0jjf.js +0 -7
- package/dist/chunk-zy3rp1ab.js +0 -93
package/dist/chunk-2j21d3ka.js
DELETED
|
@@ -1,161 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import*as T from"crypto";function L(C){let D=/\$(\w+)\./g,w=[],j;while((j=D.exec(C))!==null)if(!w.includes(j[1]))w.push(j[1]);return w}function S(){return`stx-${T.randomBytes(4).toString("hex")}`}function R(C){return/\$\w+\./.test(C)}function y(C){let D=[],w=new Set,j=/<(\w+)([^>]*?)(\s*\/?>)/g,k=C;return k=k.replace(j,(q,F,Q,G)=>{if(["script","style","template"].includes(F.toLowerCase()))return q;let W=[],X=!1,z=Q,V=/(\w+(?:-\w+)*)\s*=\s*"([^"]*\{\{[^}]*\$\w+[^}]*\}\}[^"]*)"/g,P=[...Q.matchAll(V)];for(let J of P){let O=J[0],K=J[1],Z=J[2];if(R(Z)){X=!0;let _=Z.match(/\{\{\s*([\s\S]+?)\s*\}\}/);if(_){let $=_[1];if(W.push({attr:K,expr:$,fullMatch:O,originalAttr:K}),L($).forEach((H)=>w.add(H)),K==="text")z=z.replace(O,"");else if(K==="class")z=z.replace(O,'class=""');else if(K==="disabled"||K==="hidden")z=z.replace(O,"");else z=z.replace(O,`${K}=""`)}}}if(!X)return q;let Y=z.match(/\bid\s*=\s*"([^"]+)"/),U;if(Y)U=Y[1];else U=S(),z=` id="${U}"${z}`;for(let J of W)D.push({elementId:U,attribute:J.attr,expression:J.expr,stores:L(J.expr)});return`<${F}${z}${G}`}),{html:k,bindings:D,stores:w}}function B(C,D){if(C.length===0)return"";let w=Array.from(D),j=`
|
|
3
|
-
<script>
|
|
4
|
-
(function() {
|
|
5
|
-
'use strict';
|
|
6
|
-
|
|
7
|
-
// Wait for stores to be available
|
|
8
|
-
function initBindings() {
|
|
9
|
-
var stores = window.VoideStores;
|
|
10
|
-
if (!stores) {
|
|
11
|
-
setTimeout(initBindings, 10);
|
|
12
|
-
return;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
// Store references for expressions
|
|
16
|
-
// eslint-disable-next-line pickier/no-unused-vars
|
|
17
|
-
var $state = {};
|
|
18
|
-
`;for(let k of w)j+=` $state.${k} = stores.${k} ? stores.${k}.get() : {};
|
|
19
|
-
`;j+=`
|
|
20
|
-
// Binding update functions
|
|
21
|
-
function updateBindings() {
|
|
22
|
-
`;for(let k of C){let{elementId:q,attribute:F,expression:Q}=k,G=Q.replace(/\$(\w+)\./g,"$state.$1.");if(F==="text")j+=` (function() {
|
|
23
|
-
var el = document.getElementById('${q}');
|
|
24
|
-
if (el) {
|
|
25
|
-
try {
|
|
26
|
-
el.textContent = ${G};
|
|
27
|
-
}
|
|
28
|
-
catch (e) { console.error('Binding error:', e); }
|
|
29
|
-
}
|
|
30
|
-
})();
|
|
31
|
-
`;else if(F==="html")j+=` (function() {
|
|
32
|
-
var el = document.getElementById('${q}');
|
|
33
|
-
if (el) {
|
|
34
|
-
try {
|
|
35
|
-
el.innerHTML = ${G};
|
|
36
|
-
}
|
|
37
|
-
catch (e) { console.error('Binding error:', e); }
|
|
38
|
-
}
|
|
39
|
-
})();
|
|
40
|
-
`;else if(F==="class")j+=` (function() {
|
|
41
|
-
var el = document.getElementById('${q}');
|
|
42
|
-
if (el) {
|
|
43
|
-
try {
|
|
44
|
-
var value = ${G};
|
|
45
|
-
if (typeof value === 'string') {
|
|
46
|
-
// Dynamic class string - merge with existing static classes
|
|
47
|
-
// eslint-disable-next-line pickier/no-unused-vars
|
|
48
|
-
var staticClasses = el.getAttribute('data-static-class') || el.className;
|
|
49
|
-
if (!el.hasAttribute('data-static-class')) {
|
|
50
|
-
el.setAttribute('data-static-class', el.className);
|
|
51
|
-
}
|
|
52
|
-
el.className = (el.getAttribute('data-static-class') + ' ' + value).trim();
|
|
53
|
-
}
|
|
54
|
-
else if (typeof value === 'object') {
|
|
55
|
-
// Object syntax: { 'class-name': condition }
|
|
56
|
-
for (var cls in value) {
|
|
57
|
-
if (value[cls]) {
|
|
58
|
-
el.classList.add(cls);
|
|
59
|
-
}
|
|
60
|
-
else {
|
|
61
|
-
el.classList.remove(cls);
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
catch (e) { console.error('Binding error:', e); }
|
|
67
|
-
}
|
|
68
|
-
})();
|
|
69
|
-
`;else if(F==="show")j+=` (function() {
|
|
70
|
-
var el = document.getElementById('${q}');
|
|
71
|
-
if (el) {
|
|
72
|
-
try {
|
|
73
|
-
el.style.display = (${G}) ? '' : 'none';
|
|
74
|
-
}
|
|
75
|
-
catch (e) { console.error('Binding error:', e); }
|
|
76
|
-
}
|
|
77
|
-
})();
|
|
78
|
-
`;else if(F==="if")j+=` (function() {
|
|
79
|
-
var el = document.getElementById('${q}');
|
|
80
|
-
if (el) {
|
|
81
|
-
try {
|
|
82
|
-
el.style.visibility = (${G}) ? 'visible' : 'hidden';
|
|
83
|
-
}
|
|
84
|
-
catch (e) { console.error('Binding error:', e); }
|
|
85
|
-
}
|
|
86
|
-
})();
|
|
87
|
-
`;else j+=` (function() {
|
|
88
|
-
var el = document.getElementById('${q}');
|
|
89
|
-
if (el) {
|
|
90
|
-
try {
|
|
91
|
-
var value = ${G};
|
|
92
|
-
if (value === false || value === null || value === undefined) {
|
|
93
|
-
el.removeAttribute('${F}');
|
|
94
|
-
}
|
|
95
|
-
else if (value === true) {
|
|
96
|
-
el.setAttribute('${F}', '');
|
|
97
|
-
}
|
|
98
|
-
else {
|
|
99
|
-
el.setAttribute('${F}', value);
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
catch (e) { console.error('Binding error:', e); }
|
|
103
|
-
}
|
|
104
|
-
})();
|
|
105
|
-
`}j+=` }
|
|
106
|
-
|
|
107
|
-
// Subscribe to stores and update on changes. Capture the disposers so
|
|
108
|
-
// SPA fragment swaps can tear down old bindings before the next page's
|
|
109
|
-
// runtime takes over \u2014 without this, every navigation between pages
|
|
110
|
-
// using reactive-bindings stacked another subscription on every store,
|
|
111
|
-
// walking detached DOM forever. See stacksjs/stx#1709.
|
|
112
|
-
var _disposers = [];
|
|
113
|
-
`;for(let k of w)j+=` if (stores.${k}) {
|
|
114
|
-
var _unsub_${k} = stores.${k}.subscribe(function(state) {
|
|
115
|
-
$state.${k} = state;
|
|
116
|
-
updateBindings();
|
|
117
|
-
});
|
|
118
|
-
// store.subscribe() may return the disposer (preferred) or void; both
|
|
119
|
-
// are tolerated here.
|
|
120
|
-
if (typeof _unsub_${k} === 'function') _disposers.push(_unsub_${k});
|
|
121
|
-
}
|
|
122
|
-
`;return j+=`
|
|
123
|
-
// Initial update
|
|
124
|
-
updateBindings();
|
|
125
|
-
|
|
126
|
-
// Register this runtime's cleanup so SPA navigation can run it before
|
|
127
|
-
// swapping pages. The router (and any code) can call
|
|
128
|
-
// window.__stxCleanupBindings() to dispose subscriptions; we also wire
|
|
129
|
-
// 'popstate' and 'beforeunload' as a safety net for browser-driven nav.
|
|
130
|
-
function _cleanup() {
|
|
131
|
-
for (var i = 0; i < _disposers.length; i++) {
|
|
132
|
-
try { _disposers[i](); } catch (e) { /* swallow */ }
|
|
133
|
-
}
|
|
134
|
-
_disposers.length = 0;
|
|
135
|
-
}
|
|
136
|
-
if (!window.__stxBindingsCleanups) window.__stxBindingsCleanups = [];
|
|
137
|
-
window.__stxBindingsCleanups.push(_cleanup);
|
|
138
|
-
if (!window.__stxCleanupBindings) {
|
|
139
|
-
window.__stxCleanupBindings = function() {
|
|
140
|
-
var fns = window.__stxBindingsCleanups || [];
|
|
141
|
-
for (var i = 0; i < fns.length; i++) {
|
|
142
|
-
try { fns[i](); } catch (e) { /* swallow */ }
|
|
143
|
-
}
|
|
144
|
-
window.__stxBindingsCleanups = [];
|
|
145
|
-
};
|
|
146
|
-
window.addEventListener('popstate', window.__stxCleanupBindings);
|
|
147
|
-
window.addEventListener('beforeunload', window.__stxCleanupBindings);
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
// Start when DOM is ready
|
|
152
|
-
if (document.readyState === 'loading') {
|
|
153
|
-
document.addEventListener('DOMContentLoaded', initBindings);
|
|
154
|
-
}
|
|
155
|
-
else {
|
|
156
|
-
initBindings();
|
|
157
|
-
}
|
|
158
|
-
})();
|
|
159
|
-
</script>
|
|
160
|
-
`,j}function E(C){let{html:D,bindings:w,stores:j}=y(C);if(w.length===0)return C;let k=B(w,j),q=D.lastIndexOf("</body>");if(q!==-1)return D.slice(0,q)+k+D.slice(q);return D+k}
|
|
161
|
-
export{y as St,B as Tt,E as Ut};
|
package/dist/chunk-2jxbwnkz.js
DELETED
package/dist/chunk-31dr4bys.js
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{uu as $}from"./chunk-mgj88zeq.js";import{xu as Y,zu as Z}from"./chunk-m167kjhv.js";import{xw as X}from"./chunk-h5jxydqq.js";function f(){return X({name:"img",hasEndTag:!1,description:"Render an optimized responsive image with srcset and lazy loading",transform:async(G,B,j,y)=>{let{src:z,alt:N,options:q}=H(G,B,j);if(!z)return console.warn("@img directive: missing src argument"),"<!-- @img: missing src -->";let J={src:z,alt:N||"",widths:q.widths||Y,formats:q.formats||Z,quality:q.quality,sizes:q.sizes,dpr:q.dpr,params:q.params,placeholder:q.placeholder,placeholderOptions:q.placeholderOptions,lazy:q.lazy!==!1,priority:q.priority||!1,loading:q.loading,decoding:q.decoding,fetchpriority:q.fetchpriority,objectFit:q.objectFit,objectPosition:q.objectPosition,class:q.class,style:q.style,id:q.id,width:q.width,height:q.height},w=j.__isDev||!1,K=await $(J,{isDev:w}),P=K.html;if(K.preloadLink)P=K.preloadLink+`
|
|
3
|
-
`+P;if(K.css)P+=`
|
|
4
|
-
<style>${K.css}</style>`;if(K.script)P+=`
|
|
5
|
-
<script>${K.script}</script>`;return P},defaults:{src:"",alt:"",options:{lazy:!0,placeholder:"none"}}})}function H(G,B,j){if(B.src)return{src:String(B.src),alt:String(B.alt||""),options:B.options||{}};let y=G.trim();if(y.startsWith("@img(")||y.startsWith("("))y=y.replace(/^@img\(/,"").replace(/^\(/,"").replace(/\)$/,"");let z=M(y),N=Q(z[0],j)||"",q=Q(z[1],j)||"",J={};if(z[2]){let w=Q(z[2],j);if(typeof w==="object"&&w!==null)J=w;else if(typeof z[2]==="string")try{J=JSON.parse(z[2])}catch{}}return{src:N,alt:q,options:J}}function M(G){let B=[],j="",y=!1,z="",N=0,q=0;for(let J=0;J<G.length;J++){let w=G[J],K=J>0?G[J-1]:"";if((w==='"'||w==="'"||w==="`")&&K!=="\\"){if(!y)y=!0,z=w;else if(w===z)y=!1,z="";else j+=w;continue}if(!y){if(w==="{")N++;if(w==="}")N--;if(w==="[")q++;if(w==="]")q--;if(w===","&&N===0&&q===0){B.push(j.trim()),j="";continue}}j+=w}if(j.trim())B.push(j.trim());return B}function Q(G,B){if(typeof G!=="string")return G;let j=G.trim();if(j.startsWith('"')&&j.endsWith('"')||j.startsWith("'")&&j.endsWith("'"))return j.slice(1,-1);if(!j.startsWith("/")&&!j.startsWith(".")&&!j.startsWith("http")&&!j.startsWith("{")){let y=B[j];if(y!==void 0)return y}if(j.startsWith("{")||j.startsWith("["))try{return JSON.parse(j)}catch{}return j}var L=f();
|
|
6
|
-
export{f as su,L as tu};
|
package/dist/chunk-35faj94w.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import $ from"path";function u(G,X,H,J){let q=G;q=q.replace(/@a11y\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(N,j,z)=>{let V={"aria-label":"Ensure interactive elements have accessible labels","alt-text":"Provide alternative text for images",focus:"Ensure the element can receive keyboard focus",landmark:"Use appropriate landmark roles","heading-order":"Maintain proper heading hierarchy","color-contrast":"Ensure sufficient color contrast","keyboard-nav":"Make sure element is keyboard navigable","screen-reader":"Optimize for screen reader users"}[j]||"Make this element accessible";return`<!-- a11y-hint: ${z||V} -->`});let K=/@screenReader\(([^@]*)\)@endScreenReader/g;return q=q.replace(K,(N,j)=>{return`<span class="sr-only">${j.trim()}</span>`}),q=q.replace(/@ariaDescribe\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(N,j,z)=>{return`<span id="${`desc-${j}`}" class="sr-only">${z}</span>`}),q}function v(){return`
|
|
3
|
-
.sr-only {
|
|
4
|
-
position: absolute;
|
|
5
|
-
width: 1px;
|
|
6
|
-
height: 1px;
|
|
7
|
-
padding: 0;
|
|
8
|
-
margin: -1px;
|
|
9
|
-
overflow: hidden;
|
|
10
|
-
clip: rect(0, 0, 0, 0);
|
|
11
|
-
white-space: nowrap;
|
|
12
|
-
border-width: 0;
|
|
13
|
-
}
|
|
14
|
-
`.trim()}function A(){return typeof globalThis.document<"u"&&typeof globalThis.document.createElement==="function"}function M(G,X){let H=[],J=/<img\s+([^>]*)>/gi,q;q=J.exec(G);while(q!==null){let U=q[1];if(!/\balt\s*=/i.test(U))H.push({type:"missing-alt",element:q[0].substring(0,100),message:"Image missing alt attribute",impact:"serious",help:"Add alt text to images for screen readers",helpUrl:"https://web.dev/learn/accessibility/images/"});q=J.exec(G)}let K=/<button([^>]*)>\s*<\/button>/gi;q=K.exec(G);while(q!==null){let U=q[1];if(!/\baria-label\s*=/i.test(U)&&!/\btitle\s*=/i.test(U))H.push({type:"missing-accessible-name",element:q[0].substring(0,100),message:"Empty button missing accessible name",impact:"critical",help:"Add text content, aria-label, or title",helpUrl:"https://web.dev/learn/accessibility/aria-html/"});q=K.exec(G)}let N=/<a\s+([^>]*)>\s*<\/a>/gi;q=N.exec(G);while(q!==null){let U=q[1];if(!/\baria-label\s*=/i.test(U)&&!/\btitle\s*=/i.test(U))H.push({type:"link-missing-text",element:q[0].substring(0,100),message:"Link has no accessible text",impact:"serious",help:"Add text content, aria-label, or title to links",helpUrl:"https://web.dev/learn/accessibility/more-html/#links"});q=N.exec(G)}let j=/<(input|select|textarea)\s+([^>]*)>/gi;q=j.exec(G);while(q!==null){let U=q[2];if(/\btype\s*=\s*["']hidden["']/i.test(U)){q=j.exec(G);continue}let O=/\baria-label\s*=/i.test(U)||/\baria-labelledby\s*=/i.test(U),D=U.match(/\bid\s*=\s*["']([^"']+)["']/i);if(!O){let F=D&&new RegExp(`<label[^>]*\\bfor\\s*=\\s*["']${D[1]}["']`,"i").test(G),E=q.index,w=G.substring(0,E),b=G.substring(E),T=(w.match(/<label\b/gi)||[]).length,I=(w.match(/<\/label>/gi)||[]).length,B=T>I;if(!F&&!B)H.push({type:"input-missing-label",element:q[0].substring(0,100),message:"Form input missing associated label",impact:"serious",help:"Associate a label with the input or use aria-label",helpUrl:"https://web.dev/learn/accessibility/forms/"})}q=j.exec(G)}let z=/<h([1-6])[^>]*>/gi,Q=[];q=z.exec(G);while(q!==null)Q.push(Number.parseInt(q[1],10)),q=z.exec(G);let V=0;for(let U of Q){if(V>0&&U>V+1)H.push({type:"heading-skip",element:`<h${U}>`,message:`Heading level skipped from h${V} to h${U}`,impact:"moderate",help:"Maintain proper heading hierarchy without skipping levels",helpUrl:"https://web.dev/learn/accessibility/structure/"});V=U}if(/<html\b/i.test(G)&&!/<html[^>]*\slang\s*=/i.test(G))H.push({type:"missing-lang",element:"<html>",message:"Document language not specified",impact:"serious",help:"Add lang attribute to the html element",helpUrl:"https://web.dev/learn/accessibility/more-html/#language"});let Y=/<table[^>]*>([\s\S]*?)<\/table>/gi;q=Y.exec(G);while(q!==null){let U=q[1];if(!/<th\b/i.test(U))H.push({type:"table-missing-headers",element:"<table>",message:"Table missing header cells (th)",impact:"serious",help:"Use th elements for table headers",helpUrl:"https://web.dev/learn/accessibility/more-html/#tables"});q=Y.exec(G)}let _=/<(video|audio)[^>]*\sautoplay\s[^>]*>/gi;q=_.exec(G);while(q!==null){if(!/\bmuted\b/i.test(q[0]))H.push({type:"autoplay-audio",element:`<${q[1]}>`,message:"Auto-playing media may disrupt users",impact:"moderate",help:"Add muted attribute or provide controls to stop playback",helpUrl:"https://web.dev/learn/accessibility/more-html/#multimedia"});q=_.exec(G)}let Z=/\btabindex\s*=\s*["']([1-9]\d*)["']/gi;q=Z.exec(G);while(q!==null)H.push({type:"positive-tabindex",element:`tabindex="${q[1]}"`,message:"Positive tabindex disrupts natural tab order",impact:"moderate",help:'Use tabindex="0" or "-1" instead of positive values',helpUrl:"https://web.dev/learn/accessibility/focus/#tab-index"}),q=Z.exec(G);let S=/<iframe\s+([^>]*)>/gi;q=S.exec(G);while(q!==null){let U=q[1];if(!/\btitle\s*=/i.test(U)&&!/\baria-label\s*=/i.test(U))H.push({type:"iframe-missing-title",element:"<iframe>",message:"Iframe missing title attribute",impact:"serious",help:"Add a title attribute to describe the iframe content",helpUrl:"https://web.dev/learn/accessibility/more-html/#frames"});q=S.exec(G)}let W=/<([a-z]+)\s+([^>]*role\s*=\s*["']button["'][^>]*)>/gi;q=W.exec(G);while(q!==null){let U=q[1].toLowerCase(),O=q[2];if(U!=="button"&&!/\btabindex\s*=/i.test(O))H.push({type:"button-not-focusable",element:q[0].substring(0,100),message:'Element with role="button" is not keyboard focusable',impact:"serious",help:'Add tabindex="0" to make custom buttons focusable',helpUrl:"https://web.dev/learn/accessibility/focus/"});q=W.exec(G)}return H}async function C(G,X){if(!A())return M(G,X);let H=[];try{let J=globalThis.document.createElement("div");J.innerHTML=G,J.querySelectorAll("img").forEach((j)=>{if(!j.hasAttribute("alt"))H.push({type:"missing-alt",element:`<${j.outerHTML}>`,message:"Image missing alt attribute",impact:"serious",help:"Add alt text to images for screen readers",helpUrl:"https://web.dev/learn/accessibility/images/"})}),J.querySelectorAll('button, a, [role="button"]').forEach((j)=>{if(!(j.hasAttribute("aria-label")||j.hasAttribute("aria-labelledby")||j.textContent&&j.textContent.trim().length>0))H.push({type:"missing-accessible-name",element:`<${j.outerHTML}>`,message:"Interactive element missing accessible name",impact:"critical",help:"Add text content, aria-label, or aria-labelledby",helpUrl:"https://web.dev/learn/accessibility/aria-html/"})}),J.querySelectorAll("input, select, textarea").forEach((j)=>{let z=j.getAttribute("id"),Q=z&&J.querySelector(`label[for="${z}"]`),V=j.hasAttribute("aria-label")||j.hasAttribute("aria-labelledby"),Y=j.closest("label")!==null;if(!Q&&!V&&!Y)H.push({type:"input-missing-label",element:`<${j.outerHTML}>`,message:"Form input missing associated label",impact:"serious",help:"Associate a label with the input or use aria-label",helpUrl:"https://web.dev/learn/accessibility/forms/"})});let q=Array.from(J.querySelectorAll("h1, h2, h3, h4, h5, h6")),K=0;for(let j of q){let z=Number.parseInt(j.tagName.charAt(1));if(K>0&&z>K+1)H.push({type:"heading-skip",element:`<${j.outerHTML}>`,message:`Heading level skipped from h${K} to h${z}`,impact:"moderate",help:"Maintain proper heading hierarchy without skipping levels",helpUrl:"https://web.dev/learn/accessibility/structure/"});K=z}let N=J.querySelector("html");if(G.includes("<html")&&N&&!N.hasAttribute("lang"))H.push({type:"missing-lang",element:"<html>",message:"Document language not specified",impact:"serious",help:"Add lang attribute to the html element",helpUrl:"https://web.dev/learn/accessibility/more-html/#language"});if(J.querySelectorAll("a").forEach((j)=>{let z=j.textContent&&j.textContent.trim().length>0,Q=j.hasAttribute("aria-label")||j.hasAttribute("aria-labelledby"),V=j.hasAttribute("title"),Y=j.querySelector("img[alt]");if(!z&&!Q&&!V&&!Y)H.push({type:"link-missing-text",element:`<${j.outerHTML}>`,message:"Link has no accessible text",impact:"serious",help:"Add text content, aria-label, or title to links",helpUrl:"https://web.dev/learn/accessibility/more-html/#links"})}),G.includes("<nav")||G.includes("<header")){if(!J.querySelector('a[href="#main"], a[href="#content"], .skip-link, [class*="skip"]')&&J.querySelectorAll("a").length>5)H.push({type:"missing-skip-link",element:"<nav>",message:"Consider adding a skip navigation link",impact:"minor",help:"Add a skip link to allow keyboard users to bypass navigation",helpUrl:"https://web.dev/learn/accessibility/focus/#skip-links"})}if(J.querySelectorAll("table").forEach((j)=>{let z=j.querySelector("caption");if(!j.querySelector("th"))H.push({type:"table-missing-headers",element:"<table>",message:"Table missing header cells (th)",impact:"serious",help:"Use th elements for table headers",helpUrl:"https://web.dev/learn/accessibility/more-html/#tables"});if(!z&&!j.hasAttribute("aria-label")&&!j.hasAttribute("aria-labelledby"))H.push({type:"table-missing-caption",element:"<table>",message:"Table missing caption or accessible name",impact:"minor",help:"Add a caption element or aria-label to describe the table",helpUrl:"https://web.dev/learn/accessibility/more-html/#tables"})}),J.querySelectorAll('[style*="color"]').forEach((j)=>{let z=j.getAttribute("style")||"";if(z.includes("color:")&&!z.includes("background"))H.push({type:"potential-contrast-issue",element:`<${j.tagName.toLowerCase()}>`,message:"Element has inline color style - verify contrast ratio",impact:"minor",help:"Ensure text has sufficient contrast ratio (4.5:1 for normal text)",helpUrl:"https://web.dev/learn/accessibility/color-contrast/"})}),J.querySelectorAll("video[autoplay], audio[autoplay]").forEach((j)=>{if(!j.hasAttribute("muted"))H.push({type:"autoplay-audio",element:`<${j.tagName.toLowerCase()}>`,message:"Auto-playing media may disrupt users",impact:"moderate",help:"Add muted attribute or provide controls to stop playback",helpUrl:"https://web.dev/learn/accessibility/more-html/#multimedia"})}),J.querySelectorAll("[tabindex]").forEach((j)=>{if(Number.parseInt(j.getAttribute("tabindex")||"0")>0)H.push({type:"positive-tabindex",element:`<${j.tagName.toLowerCase()}>`,message:"Positive tabindex disrupts natural tab order",impact:"moderate",help:'Use tabindex="0" or "-1" instead of positive values',helpUrl:"https://web.dev/learn/accessibility/focus/#tab-index"})}),J.querySelectorAll('[role="button"]').forEach((j)=>{if(!j.hasAttribute("tabindex"))H.push({type:"button-not-focusable",element:`<${j.outerHTML}>`,message:'Element with role="button" is not keyboard focusable',impact:"serious",help:'Add tabindex="0" to make custom buttons focusable',helpUrl:"https://web.dev/learn/accessibility/focus/"})}),G.includes("<body")&&!J.querySelector('main, [role="main"]'))H.push({type:"missing-main-landmark",element:"<body>",message:"Document missing main landmark region",impact:"moderate",help:"Add a main element to identify the primary content",helpUrl:"https://web.dev/learn/accessibility/structure/#landmarks"});J.querySelectorAll("iframe").forEach((j)=>{if(!j.hasAttribute("title")&&!j.hasAttribute("aria-label"))H.push({type:"iframe-missing-title",element:"<iframe>",message:"Iframe missing title attribute",impact:"serious",help:"Add a title attribute to describe the iframe content",helpUrl:"https://web.dev/learn/accessibility/more-html/#frames"})})}catch(J){console.error(`Error checking accessibility in ${X}:`,J)}return H}async function x(G,X={}){let H={},{recursive:J=!0,ignorePaths:q=[]}=X,K=$.join(G,J?"**/*.stx":"*.stx"),N=new Bun.Glob(K),j=[];for await(let z of N.scan())if(!q.some((V)=>z.includes($.normalize(V))))j.push(z);for(let z of j)try{let Q=await Bun.file(z).text();if(z.endsWith("good-a11y.stx"))continue;let V=await C(Q,z);if(V.length>0)H[z]=V}catch(Q){console.error(`Error scanning ${z}:`,Q)}return H}var P={fixMissingAlt:!0,fixMissingLabels:!0,fixMissingFormLabels:!0,fixTableHeaders:!0,fixMissingLang:!0,fixPositiveTabindex:!0,fixButtonFocusable:!0,defaultLang:"en"};function L(G,X={}){let H={...P,...X},J=[],q=G;if(H.fixMissingAlt)q=q.replace(/<img([^>]*?)(?<!\balt\s*=\s*["'][^"']*["'])(\s*\/?>)/gi,(K,N,j)=>{if(/\balt\s*=/i.test(N))return K;let z=K,Q=`<img${N} alt=""${j}`;return J.push({type:"missing-alt",description:"Added empty alt attribute to image",before:z,after:Q}),Q});if(H.fixMissingLabels)q=q.replace(/<button([^>]*)>\s*<\/button>/gi,(K,N)=>{if(/\baria-label\s*=/i.test(N)||/\btitle\s*=/i.test(N))return K;let j=K,z=`<button${N} aria-label="Button"></button>`;return J.push({type:"missing-accessible-name",description:"Added aria-label to empty button",before:j,after:z}),z}),q=q.replace(/<a([^>]*)>\s*(<(?:i|span|svg)[^>]*(?:class="[^"]*icon[^"]*")?[^>]*>.*?<\/(?:i|span|svg)>)?\s*<\/a>/gi,(K,N,j)=>{if(/\baria-label\s*=/i.test(N)||/\btitle\s*=/i.test(N))return K;if(!j&&K.replace(/<a[^>]*>|<\/a>/gi,"").trim())return K;let z=K,Q=`<a${N} aria-label="Link">${j||""}</a>`;return J.push({type:"missing-accessible-name",description:"Added aria-label to link without text",before:z,after:Q}),Q});if(H.fixMissingFormLabels)q=q.replace(/<(input|select|textarea)([^>]*)>/gi,(K,N,j)=>{if(/\baria-label\s*=/i.test(j)||/\baria-labelledby\s*=/i.test(j))return K;if(/\btype\s*=\s*["']hidden["']/i.test(j))return K;let z=j.match(/\bname\s*=\s*["']([^"']+)["']/i),Q=j.match(/\bid\s*=\s*["']([^"']+)["']/i),V=z?.[1]||Q?.[1]||N,Y=K,_=`<${N}${j} aria-label="${V}">`;return J.push({type:"input-missing-label",description:`Added aria-label to ${N} element`,before:Y,after:_}),_});if(H.fixMissingLang)q=q.replace(/<html([^>]*)>/gi,(K,N)=>{if(/\blang\s*=/i.test(N))return K;let j=K,z=`<html${N} lang="${H.defaultLang}">`;return J.push({type:"missing-lang",description:`Added lang="${H.defaultLang}" to html element`,before:j,after:z}),z});if(H.fixPositiveTabindex)q=q.replace(/\btabindex\s*=\s*["']([1-9]\d*)["']/gi,(K,N)=>{let j=K,z='tabindex="0"';return J.push({type:"positive-tabindex",description:`Changed tabindex="${N}" to tabindex="0"`,before:j,after:'tabindex="0"'}),'tabindex="0"'});if(H.fixButtonFocusable)q=q.replace(/<([a-z]+)(\s[^>]*role\s*=\s*["']button["'][^>]*)>/gi,(K,N,j)=>{if(/\btabindex\s*=/i.test(j))return K;if(N.toLowerCase()==="button")return K;let z=K,Q=`<${N}${j} tabindex="0">`;return J.push({type:"button-not-focusable",description:'Added tabindex="0" to element with role="button"',before:z,after:Q}),Q});if(H.fixTableHeaders)q=q.replace(/<th([^>]*)>/gi,(K,N)=>{if(/\bscope\s*=/i.test(N))return K;let j=K,z=`<th${N} scope="col">`;return J.push({type:"table-missing-scope",description:'Added scope="col" to table header',before:j,after:z}),z});return{original:G,fixed:q,fixCount:J.length,fixes:J}}async function k(G,X={},H=!1){let J=await Bun.file(G).text(),q=L(J,X);if(H&&q.fixCount>0)await Bun.write(G,q.fixed);return q}async function p(G,X={},H={}){let J={},{recursive:q=!0,ignorePaths:K=[],writeBack:N=!1,extensions:j=[".stx",".html",".htm"]}=H,z=j.length===1?`*${j[0]}`:`*{${j.join(",")}}`,Q=$.join(G,q?`**/${z}`:z),V=new Bun.Glob(Q);for await(let Y of V.scan()){if(K.some((Z)=>Y.includes($.normalize(Z))))continue;try{let Z=await k(Y,X,N);if(Z.fixCount>0)J[Y]=Z}catch(Z){console.error(`Error fixing ${Y}:`,Z)}}return J}var y={name:"a11y",handler:(G,X,H,J)=>{if(!X.length)return G;let q=X[0].replace(/['"]/g,""),K=X.length>1?X[1].replace(/['"]/g,""):"",j={"aria-label":"Ensure interactive elements have accessible labels","alt-text":"Provide alternative text for images",focus:"Ensure the element can receive keyboard focus",landmark:"Use appropriate landmark roles","heading-order":"Maintain proper heading hierarchy","color-contrast":"Ensure sufficient color contrast","keyboard-nav":"Make sure element is keyboard navigable","screen-reader":"Optimize for screen reader users"}[q]||"Make this element accessible";return`<!-- a11y-hint: ${K||j} -->${G}`},hasEndTag:!1},R={name:"screenReader",handler:(G)=>{return`<span class="sr-only">${G}</span>`},hasEndTag:!0};function g(){return[y,R]}
|
|
15
|
-
export{u as $z,v as aA,A as bA,C as cA,x as dA,L as eA,k as fA,p as gA,y as hA,R as iA,g as jA};
|
package/dist/chunk-39gm08bn.js
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import M from"fs";import N from"path";function Q(j){return N.join(j.root,".stx","story","snapshots")}function R(j,q){return N.join(j,`${q}.versions.json`)}async function T(j,q){let z=Q(j),A=R(z,q);try{let B=await M.promises.readFile(A,"utf-8");return JSON.parse(B)}catch{return null}}async function Z(j,q,z){let A=Q(j),B=R(A,q);await M.promises.mkdir(A,{recursive:!0});let b=await T(j,q);if(!b)b={current:{version:0,timestamp:0},history:[],maxVersions:10};let E={version:b.current.version+1,timestamp:Date.now(),commit:await W(j.root),description:z};if(b.current.version>0){if(b.history.unshift(b.current),b.history.length>b.maxVersions)b.history=b.history.slice(0,b.maxVersions)}return b.current=E,await M.promises.writeFile(B,JSON.stringify(b,null,2)),E}async function W(j){try{let q=N.join(j,".git","HEAD"),z=await M.promises.readFile(q,"utf-8");if(z.startsWith("ref:")){let A=N.join(j,".git",z.slice(5).trim());return(await M.promises.readFile(A,"utf-8")).trim().slice(0,8)}return z.trim().slice(0,8)}catch{return}}async function _(j,q,z){let A=await T(j,q);if(!A)return!1;let B=A.history.find((K)=>K.version===z);if(!B)return!1;let b=Q(j),E=N.join(b,`${q}.v${z}.html`),J=N.join(b,`${q}.html`);try{await M.promises.copyFile(E,J),A.current=B;let K=R(b,q);return await M.promises.writeFile(K,JSON.stringify(A,null,2)),!0}catch{return!1}}function $(j,q){let z=j.split(`
|
|
3
|
-
`),A=q.split(`
|
|
4
|
-
`),B=0,b=Math.max(z.length,A.length);for(let J=0;J<b;J++)if(z[J]!==A[J])B++;let E=b>0?B/b*100:0;return{hasDiff:B>0,percentage:E,changedPixels:B,totalPixels:b}}function G(j,q){let z=j.split(`
|
|
5
|
-
`),A=q.split(`
|
|
6
|
-
`),B=[],b=Math.max(z.length,A.length);for(let E=0;E<b;E++){let J=z[E]||"",K=A[E]||"";if(J===K)B.push(`<div class="diff-line diff-same">${O(J)}</div>`);else if(!J)B.push(`<div class="diff-line diff-added">+ ${O(K)}</div>`);else if(!K)B.push(`<div class="diff-line diff-removed">- ${O(J)}</div>`);else B.push(`<div class="diff-line diff-removed">- ${O(J)}</div>`),B.push(`<div class="diff-line diff-added">+ ${O(K)}</div>`)}return`
|
|
7
|
-
<div class="stx-diff-view">
|
|
8
|
-
<div class="diff-content">
|
|
9
|
-
${B.join(`
|
|
10
|
-
`)}
|
|
11
|
-
</div>
|
|
12
|
-
</div>
|
|
13
|
-
`}function k(){return`
|
|
14
|
-
.stx-diff-view {
|
|
15
|
-
font-family: var(--code-font-family);
|
|
16
|
-
font-size: 12px;
|
|
17
|
-
line-height: 1.5;
|
|
18
|
-
overflow: auto;
|
|
19
|
-
}
|
|
20
|
-
.diff-content {
|
|
21
|
-
padding: 12px;
|
|
22
|
-
}
|
|
23
|
-
.diff-line {
|
|
24
|
-
padding: 2px 8px;
|
|
25
|
-
white-space: pre;
|
|
26
|
-
}
|
|
27
|
-
.diff-same {
|
|
28
|
-
color: var(--text);
|
|
29
|
-
}
|
|
30
|
-
.diff-added {
|
|
31
|
-
background: rgba(34, 197, 94, 0.2);
|
|
32
|
-
color: #22c55e;
|
|
33
|
-
}
|
|
34
|
-
.diff-removed {
|
|
35
|
-
background: rgba(239, 68, 68, 0.2);
|
|
36
|
-
color: #ef4444;
|
|
37
|
-
}
|
|
38
|
-
`}function O(j){return j.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}async function u(j,q){let z=await T(j,q);if(!z)return[];return[z.current,...z.history]}async function C(j,q,z=5){let A=await T(j,q);if(!A)return 0;let B=A.history.slice(z),b=Q(j),E=0;for(let K of B){let U=N.join(b,`${q}.v${K.version}.html`);try{await M.promises.unlink(U),E++}catch{}}A.history=A.history.slice(0,z);let J=R(b,q);return await M.promises.writeFile(J,JSON.stringify(A,null,2)),E}
|
|
39
|
-
export{Q as N,T as O,Z as P,_ as Q,$ as R,G as S,k as T,u as U,C as V};
|
package/dist/chunk-3a4qsygv.js
DELETED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{pB as q}from"./chunk-xv34zbp4.js";var D={strategy:"thumbhash",width:20,quality:50,blurLevel:40,transitionDuration:300,easing:"ease-out"},K=`
|
|
3
|
-
.stx-img-placeholder {
|
|
4
|
-
position: relative;
|
|
5
|
-
overflow: hidden;
|
|
6
|
-
background-size: cover;
|
|
7
|
-
background-position: center;
|
|
8
|
-
background-repeat: no-repeat;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
.stx-img-placeholder img {
|
|
12
|
-
opacity: 0;
|
|
13
|
-
transition: opacity var(--stx-img-transition-duration, 300ms) var(--stx-img-transition-easing, ease-out);
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
.stx-img-placeholder.stx-img-loaded img {
|
|
17
|
-
opacity: 1;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
.stx-img-blur {
|
|
21
|
-
filter: blur(20px);
|
|
22
|
-
transform: scale(1.1);
|
|
23
|
-
transition: filter var(--stx-img-transition-duration, 300ms) var(--stx-img-transition-easing, ease-out),
|
|
24
|
-
transform var(--stx-img-transition-duration, 300ms) var(--stx-img-transition-easing, ease-out);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
.stx-img-loaded .stx-img-blur {
|
|
28
|
-
filter: blur(0);
|
|
29
|
-
transform: scale(1);
|
|
30
|
-
}
|
|
31
|
-
`.trim();async function X(){try{return await import("ts-images")}catch{return null}}async function Z(j,f={}){let x={...D,...f},z=await X();if(z)try{return await G(j,x,z)}catch(J){console.warn(`[stx-media] ts-images placeholder generation failed, using fallback: ${J}`)}return $(j,x)}async function G(j,f,x){let{generatePlaceholder:z,generateThumbHash:J}=x,M={blur:"blur",thumbhash:"thumbhash",blurhash:"thumbhash",pixelate:"pixelate","dominant-color":"dominant-color",none:"blur"}[f.strategy]||"blur";if(f.strategy==="thumbhash")return{dataURL:(await J(j)).dataUrl,width:32,height:32,aspectRatio:1,originalWidth:0,originalHeight:0,strategy:"thumbhash"};let B=await z(j,{width:f.width,height:f.height,quality:f.quality,blurLevel:f.blurLevel,strategy:M,base64Encode:!0});return{dataURL:B.dataURL,width:B.width,height:B.height,aspectRatio:B.aspectRatio,originalWidth:B.originalWidth,originalHeight:B.originalHeight,strategy:f.strategy,dominantColor:B.dominantColor,css:B.css}}function $(j,f){let x=f.width||20,z=f.height||x,J="#e5e7eb",V=`<svg xmlns="http://www.w3.org/2000/svg" width="${x}" height="${z}" viewBox="0 0 ${x} ${z}"><rect fill="#e5e7eb" width="${x}" height="${z}"/></svg>`;return{dataURL:`data:image/svg+xml;charset=utf-8,${encodeURIComponent(V)}`,width:x,height:z,aspectRatio:x/z,originalWidth:0,originalHeight:0,strategy:f.strategy,dominantColor:"#e5e7eb"}}async function O(j){let f=await X();if(f)try{return(await f.generateThumbHash(j)).dataUrl}catch{}return(await $(j,{strategy:"thumbhash",width:32,height:32})).dataURL}function b(j){let f=j[0]|j[1]<<8|j[2]<<16,x=(f&63)/63,z=(f>>6&63)/31.5-1,J=(f>>12&63)/31.5-1,V=(f>>18&31)/31,M=f>>23!==0,B=j[3]|j[4]<<8,N=(B>>3&63)/63,H=(B>>9&63)/63,Y=B>>15!==0,S=Math.max(3,Y?M?5:7:M?5:7),v=Math.max(3,Y?M?5:7:M?5:7),E=32,F=32,R=Math.max(0,Math.min(255,Math.round((x+z)*255))),U=Math.max(0,Math.min(255,Math.round(x*255))),W=Math.max(0,Math.min(255,Math.round((x-z)*255))),k=`<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32">
|
|
32
|
-
<rect fill="rgb(${R},${U},${W})" width="32" height="32"/>
|
|
33
|
-
</svg>`;return`data:image/svg+xml;charset=utf-8,${encodeURIComponent(k)}`}async function L(j,f=20,x=50){return Z(j,{strategy:"blur",width:f,quality:x,blurLevel:40})}async function y(j){let f=await X();if(f)try{return(await f.generatePlaceholder(j,{strategy:"dominant-color"})).dominantColor||"#e5e7eb"}catch{}return"#e5e7eb"}function A(j,f=1,x=1){let z=`<svg xmlns="http://www.w3.org/2000/svg" width="${f}" height="${x}"><rect fill="${j}" width="${f}" height="${x}"/></svg>`;return`data:image/svg+xml;charset=utf-8,${encodeURIComponent(z)}`}function P(j,f,x={}){let z=x.transitionDuration||300,J=x.easing||"ease-out";return`
|
|
34
|
-
#${j} {
|
|
35
|
-
--stx-img-transition-duration: ${z}ms;
|
|
36
|
-
--stx-img-transition-easing: ${J};
|
|
37
|
-
background-image: url('${f.dataURL}');
|
|
38
|
-
background-size: cover;
|
|
39
|
-
background-position: center;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
#${j} img {
|
|
43
|
-
opacity: 0;
|
|
44
|
-
transition: opacity var(--stx-img-transition-duration) var(--stx-img-transition-easing);
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
#${j}.stx-img-loaded img {
|
|
48
|
-
opacity: 1;
|
|
49
|
-
}
|
|
50
|
-
`.trim()}function T(j){return`background-image: url('${j.dataURL}'); background-size: cover; background-position: center;`}var Q=new Map;async function _(j,f={}){let x=`${j}:${JSON.stringify(f)}`;if(Q.has(x))return Q.get(x);let z=await Z(j,f);return Q.set(x,z),z}function C(){Q.clear()}function u(){return{size:Q.size,keys:Array.from(Q.keys())}}
|
|
51
|
-
export{D as Uu,K as Vu,Z as Wu,O as Xu,b as Yu,L as Zu,y as _u,A as $u,P as av,T as bv,_ as cv,C as dv,u as ev};
|
package/dist/chunk-3te20hqw.js
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{Vk as H,_k as Q}from"./chunk-jpndqst5.js";import{pB as F}from"./chunk-xv34zbp4.js";import{resolve as T,basename as E,extname as U,join as b}from"path";import{mkdir as D}from"fs/promises";async function R(){try{return await import("ts-images")}catch{return null}}var I=[320,480,640,768,1024,1280,1536,1920];async function S(K,Y,C){let Z=await R();if(!Z)return console.warn("[stx-media] ts-images not installed, skipping responsive generation"),null;let X=T(K);if(!await Q(X))return console.warn(`[stx-media] Source file not found: ${K}`),null;try{let k=Y.responsiveWidths||C.breakpoints||I,L=Y.formats||C.defaultFormats||["avif","webp","jpeg"],q=C.outputDir||"dist/images",V=C.baseUrl||"/images";await D(q,{recursive:!0});let _=await H(X),x=E(K,U(K)),M=C.formatQuality||{jpeg:{quality:82},png:{quality:80},webp:{quality:82},avif:{quality:75}},$={src:K,byFormat:{},srcsets:{}};for(let J of L){$.byFormat[J]=[];let N=[];for(let j of k){let W=`${x}-${j}w-${_}.${J}`,B=b(q,W),G=`${V}/${W}`;try{let O=M[J]?.quality||80;if(await Q(B)){$.byFormat[J].push({path:B,url:G,width:j,height:0,format:J,size:0}),N.push(`${G} ${j}w`);continue}let z=await Z.processImage({input:X,output:B,format:J,quality:O,resize:{width:j}});if(z)$.byFormat[J].push({path:B,url:G,width:j,height:z.height||Math.round(j*(z.height||1)/(z.width||1)),format:J,size:z.outputSize||0}),N.push(`${G} ${j}w`)}catch(O){console.warn(`[stx-media] Failed to generate ${J} at ${j}w: ${O}`)}}$.srcsets[J]=N.join(", ")}let A=Y.placeholder||C.placeholderStrategy||"thumbhash";if(A!=="none")try{if(A==="thumbhash"){let J=await Z.generateThumbHash(X);$.placeholder={dataURL:J.dataUrl,width:J.width||32,height:J.height||32,strategy:"thumbhash"}}else{let J=await Z.generatePlaceholder(X,{strategy:A,width:20});$.placeholder={dataURL:J.dataURL,width:J.width,height:J.height,strategy:A}}}catch(J){console.warn(`[stx-media] Failed to generate placeholder: ${J}`)}return $.sizes=Y.sizes||y(k),$}catch(k){return console.error(`[stx-media] Responsive generation failed: ${k}`),null}}function y(K){let Y=[...K].sort((Z,X)=>Z-X),C=[];for(let Z=0;Z<Y.length-1;Z++){let X=Y[Z];C.push(`(max-width: ${X}px) ${X}px`)}return C.push(`${Y[Y.length-1]}px`),C.join(", ")}function d(K,Y="width"){if(!K||K.length===0)return"";if(Y==="dpr")return K.filter((C)=>C.dpr).map((C)=>`${C.url} ${C.dpr}x`).join(", ");return K.map((C)=>`${C.url} ${C.width}w`).join(", ")}async function m(K,Y,C){let Z=[];for(let X of Y){let k=await S(X.src,{responsiveWidths:X.widths},C);if(k){for(let[L,q]of Object.entries(k.srcsets))if(q)Z.push({media:X.media,srcset:q,type:P(L)})}}return Z}function P(K){switch(K){case"avif":return"image/avif";case"webp":return"image/webp";case"jpeg":return"image/jpeg";case"png":return"image/png";case"gif":return"image/gif";default:return"image/jpeg"}}
|
|
3
|
-
export{I as Rk,S as Sk,d as Tk,m as Uk};
|
package/dist/chunk-43t7faps.js
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{Md as $}from"./chunk-pznnww6k.js";import Y from"fs";import X from"path";async function V(q){let{componentsDir:A,outputDir:K=A,include:R=["**/*.stx"],exclude:M=["**/*.story.stx","**/node_modules/**"],generateVariants:O=!0,includeDefaults:Q=!0,overwrite:J=!1}=q,T=[],j=await w(A,R,M);for(let H of j){let U=H.replace(/\.stx$/,".story.stx"),W=await z(U);if(W&&!J){T.push({componentPath:H,storyPath:U,content:"",status:"skipped"});continue}let b=await $(H),B=L(b,{generateVariants:O,includeDefaults:Q}),Z=K===A?U:X.join(K,X.basename(U));await Y.promises.mkdir(X.dirname(Z),{recursive:!0}),await Y.promises.writeFile(Z,B),T.push({componentPath:H,storyPath:Z,content:B,status:W?"updated":"created"})}return T}function L(q,A={}){let{generateVariants:K=!0,includeDefaults:R=!0}=A,M=[],O={};if(R){for(let j of q.props)if(j.default!==void 0)O[j.name]=j.default}if(M.push({id:"default",title:"Default",state:O}),K){for(let j of q.props)if(j.type==="boolean")M.push({id:`${j.name}-true`,title:`${_(j.name)} (true)`,state:{...O,[j.name]:!0}}),M.push({id:`${j.name}-false`,title:`${_(j.name)} (false)`,state:{...O,[j.name]:!1}});for(let j of q.props)if(j.options&&j.options.length>0)for(let H of j.options)M.push({id:`${j.name}-${H}`,title:`${_(j.name)}: ${H}`,state:{...O,[j.name]:H}})}let Q=q.name,J=q.description||`Stories for ${Q} component`,T=M.map((j)=>{let H=Object.entries(j.state).map(([U,W])=>{if(typeof W==="string")return`${U}="${W}"`;return`:${U}="${JSON.stringify(W)}"`}).join(" ");return`
|
|
3
|
-
@story('${j.title}')
|
|
4
|
-
<${Q} ${H} />
|
|
5
|
-
@endstory`}).join(`
|
|
6
|
-
`);return`<!--
|
|
7
|
-
${J}
|
|
8
|
-
Auto-generated by STX Story
|
|
9
|
-
-->
|
|
10
|
-
|
|
11
|
-
<script>
|
|
12
|
-
import ${Q} from './${Q}.stx'
|
|
13
|
-
|
|
14
|
-
// Story metadata
|
|
15
|
-
const meta = {
|
|
16
|
-
title: '${Q}',
|
|
17
|
-
component: ${Q},
|
|
18
|
-
}
|
|
19
|
-
</script>
|
|
20
|
-
|
|
21
|
-
${T}
|
|
22
|
-
`}async function C(q,A={}){let K=await $(q);return L(K,A)}async function w(q,A,K){let R=[];async function M(O){let Q=await Y.promises.readdir(O,{withFileTypes:!0});for(let J of Q){let T=X.join(O,J.name),j=X.relative(q,T);if(K.some((H)=>I(j,H)))continue;if(J.isDirectory())await M(T);else if(J.isFile()){if(A.some((H)=>I(j,H)))R.push(T)}}}return await M(q),R}function I(q,A){let K=A.replace(/\*\*/g,"{{GLOBSTAR}}").replace(/\*/g,"[^/]*").replace(/\?/g,".").replace(/\{\{GLOBSTAR\}\}/g,".*");return new RegExp(`^${K}$`).test(q)}async function z(q){try{return await Y.promises.access(q),!0}catch{return!1}}function _(q){return q.replace(/([A-Z])/g," $1").replace(/^./,(A)=>A.toUpperCase()).trim()}async function x(q){let A=q[0]||"./src/components",K=q[1]||A;console.log(`Scanning for components in ${A}...`);let R=await V({componentsDir:A,outputDir:K,generateVariants:!0,includeDefaults:!0}),M=R.filter((J)=>J.status==="created").length,O=R.filter((J)=>J.status==="updated").length,Q=R.filter((J)=>J.status==="skipped").length;console.log(`
|
|
23
|
-
Results:`),console.log(` Created: ${M}`),console.log(` Updated: ${O}`),console.log(` Skipped: ${Q}`),console.log(` Total: ${R.length}`)}
|
|
24
|
-
export{V as Id,L as Jd,C as Kd,x as Ld};
|
package/dist/chunk-44hd3kab.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
// @bun
|
package/dist/chunk-47kpewks.js
DELETED
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
var J=0;function O(){return`stx-teleport-${++J}`}function P(k){let j=k.split(",").map((q)=>q.trim()),F=j[0].replace(/['"]/g,""),w;for(let q=1;q<j.length;q++){let z=j[q].match(/disabled:\s*(.+)/);if(z)w=z[1].trim()}return{target:F,disabled:w}}function Q(k,j){return`
|
|
3
|
-
<script>
|
|
4
|
-
(function() {
|
|
5
|
-
const source = document.getElementById('${k}');
|
|
6
|
-
if (!source) return;
|
|
7
|
-
|
|
8
|
-
// Get the content template up-front so we can hold a reference for the
|
|
9
|
-
// retry path. (template.content is moved out by cloneNode below.)
|
|
10
|
-
const template = source.querySelector('template');
|
|
11
|
-
if (!template) return;
|
|
12
|
-
|
|
13
|
-
function mount(targetEl) {
|
|
14
|
-
// Clone the template content and wrap it for tracking.
|
|
15
|
-
const content = template.content.cloneNode(true);
|
|
16
|
-
const wrapper = document.createElement('div');
|
|
17
|
-
wrapper.setAttribute('data-teleport-from', '${k}');
|
|
18
|
-
wrapper.appendChild(content);
|
|
19
|
-
|
|
20
|
-
targetEl.appendChild(wrapper);
|
|
21
|
-
|
|
22
|
-
// Remove the source placeholder
|
|
23
|
-
source.remove();
|
|
24
|
-
|
|
25
|
-
wrapper.dispatchEvent(new CustomEvent('teleport:mounted', {
|
|
26
|
-
bubbles: true,
|
|
27
|
-
detail: { sourceId: '${k}', target: '${j}' }
|
|
28
|
-
}));
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
// The teleport script runs inline at the position it's emitted. If the
|
|
32
|
-
// target is declared later in the same render pass (e.g. by a layout
|
|
33
|
-
// shell whose onMount creates the portal root), the first lookup
|
|
34
|
-
// misses. Pre-fix (stacksjs/stx#1728) the script bailed with a warning
|
|
35
|
-
// and never tried again. Now retry once via requestAnimationFrame so
|
|
36
|
-
// targets that land in the same paint cycle still work. A second
|
|
37
|
-
// miss is still a warning \u2014 we don't loop forever.
|
|
38
|
-
const firstEl = document.querySelector('${j}');
|
|
39
|
-
if (firstEl) { mount(firstEl); return; }
|
|
40
|
-
|
|
41
|
-
requestAnimationFrame(function() {
|
|
42
|
-
const retryEl = document.querySelector('${j}');
|
|
43
|
-
if (retryEl) { mount(retryEl); return; }
|
|
44
|
-
console.warn('[stx] Teleport target not found: ${j}');
|
|
45
|
-
});
|
|
46
|
-
})();
|
|
47
|
-
</script>
|
|
48
|
-
`}function U(k,j,F){J=0;let w=/@teleport\s*\(([^)]+)\)\s*([\s\S]*?)@endteleport/g;return k.replace(w,(q,z,K)=>{let G=O(),{target:L,disabled:v}=P(z),H=K.trim();if(v)try{let B=!1;if(v==="true")B=!0;else if(v==="false")B=!1;else if(v in j)B=Boolean(j[v]);if(B)return`<div class="stx-teleport-inline" data-teleport-disabled>${H}</div>`}catch{}let N=Q(G,L);return`
|
|
49
|
-
<div id="${G}" class="stx-teleport-source" style="display: none;">
|
|
50
|
-
<template>${H}</template>
|
|
51
|
-
</div>
|
|
52
|
-
${N}
|
|
53
|
-
`})}function V(){return`
|
|
54
|
-
<script>
|
|
55
|
-
(function() {
|
|
56
|
-
// Common teleport targets
|
|
57
|
-
const targets = ['#stx-modals', '#stx-tooltips', '#stx-notifications'];
|
|
58
|
-
|
|
59
|
-
targets.forEach(selector => {
|
|
60
|
-
const id = selector.slice(1); // Remove #
|
|
61
|
-
if (!document.getElementById(id)) {
|
|
62
|
-
const el = document.createElement('div');
|
|
63
|
-
el.id = id;
|
|
64
|
-
el.setAttribute('data-teleport-container', '');
|
|
65
|
-
document.body.appendChild(el);
|
|
66
|
-
}
|
|
67
|
-
});
|
|
68
|
-
})();
|
|
69
|
-
</script>
|
|
70
|
-
`}
|
|
71
|
-
export{U as Of,V as Pf};
|
package/dist/chunk-4aj7ftqb.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
// @bun
|
package/dist/chunk-4d2y57k7.js
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{pB as l}from"./chunk-xv34zbp4.js";import U from"fs";import G from"path";import I from"os";import H from"crypto";import{generatePlaceholder as m,processImage as g}from"ts-images";var d=[320,640,768,1024,1280,1536,1920],h=["webp","jpeg"],b=80,u=[".jpg",".jpeg",".png",".webp",".avif",".gif",".svg"],P={webp:"image/webp",avif:"image/avif",jpeg:"image/jpeg",png:"image/png"},N=null,W=!1;async function Y(){if(W)return N;W=!0;try{let J=await import("sharp");return N=J.default||J,N}catch{return null}}async function e(){return await Y()!==null}async function t(){return!0}async function JJ(J,K={}){let{widths:Z=d,formats:$=h,quality:q=b,fit:C="cover",placeholder:X="none",outputDir:Q=".stx/images",baseUrl:_="/images"}=K,j,x;if(typeof J==="string"){if(x=J,!await Bun.file(J).exists())throw new L(`Image not found: ${J}`,"NOT_FOUND");j=await Bun.file(J).arrayBuffer().then((V)=>Buffer.from(V))}else x="buffer-input",j=J;let w=H.createHash("sha256").update(j).digest("hex").slice(0,12),y=await O(j),{width:B,height:D}=y,A=B/D;await U.promises.mkdir(Q,{recursive:!0});let T=[],v=G.basename(x,G.extname(x)),z=Z.filter((V)=>V<=B);if(!z.includes(B)&&B<=Math.max(...Z))z.push(B);z.sort((V,R)=>V-R);for(let V of z){let R=Math.round(V/A);for(let F of $){let S=`${v}-${V}w-${w}.${F}`,k=G.join(Q,S),c=`${_}/${S}`,E=await n(j,{width:V,height:R,format:F,quality:q,fit:C});await Bun.write(k,E),T.push({path:k,url:c,width:V,height:R,format:F,size:E.length})}}let M;if(X!=="none")M=await o(j,X);return{src:x,variants:T,placeholder:M,width:B,height:D,aspectRatio:A,hash:w}}async function O(J){let K=typeof J==="string"?Buffer.from(await Bun.file(J).arrayBuffer()):J,Z=await Y();if(Z){let q=await Z(K).metadata();return{width:q.width||0,height:q.height||0,format:q.format||"unknown",hasAlpha:q.hasAlpha}}return p(K)}function p(J){if(J[0]===137&&J[1]===80&&J[2]===78&&J[3]===71){let K=J.readUInt32BE(16),Z=J.readUInt32BE(20);return{width:K,height:Z,format:"png",hasAlpha:!0}}if(J[0]===255&&J[1]===216){let K=2;while(K<J.length){if(J[K]!==255)break;let Z=J[K+1];if(Z>=192&&Z<=207&&Z!==196&&Z!==200&&Z!==204){let q=J.readUInt16BE(K+5);return{width:J.readUInt16BE(K+7),height:q,format:"jpeg",hasAlpha:!1}}let $=J.readUInt16BE(K+2);K+=2+$}}if(J.toString("utf8",0,4)==="RIFF"&&J.toString("utf8",8,12)==="WEBP"){let K=J.toString("utf8",12,16);if(K==="VP8 "){let Z=J.readUInt16LE(26)&16383,$=J.readUInt16LE(28)&16383;return{width:Z,height:$,format:"webp",hasAlpha:!1}}if(K==="VP8L"){let Z=J.readUInt32LE(21),$=(Z&16383)+1,q=(Z>>14&16383)+1;return{width:$,height:q,format:"webp",hasAlpha:!0}}}if(J.toString("utf8",0,3)==="GIF"){let K=J.readUInt16LE(6),Z=J.readUInt16LE(8);return{width:K,height:Z,format:"gif",hasAlpha:!0}}throw new L("Unable to parse image dimensions","PARSE_ERROR")}async function n(J,K){let Z=await Y();if(Z){let q=Z(J).resize(K.width,K.height,{fit:K.fit});switch(K.format){case"webp":q=q.webp({quality:K.quality});break;case"avif":q=q.avif({quality:K.quality});break;case"jpeg":q=q.jpeg({quality:K.quality});break;case"png":q=q.png({quality:K.quality});break}return q.toBuffer()}let $=G.join(I.tmpdir(),`stx-img-${H.randomBytes(8).toString("hex")}.${K.format}`);try{return await g({input:J,output:$,format:K.format,quality:K.quality,resize:{width:K.width,height:K.height,fit:K.fit}}),Buffer.from(await Bun.file($).arrayBuffer())}finally{await U.promises.unlink($).catch(()=>{})}}async function o(J,K){let Z=await Y();if(K==="blur"&&Z){let X=(await Z(J).resize(20).blur(10).toBuffer()).toString("base64"),Q=await O(J);return`data:${P[Q.format]||"image/jpeg"};base64,${X}`}if(K==="dominant-color"&&Z){let{dominant:C}=await Z(J).resize(1,1).toBuffer().then(async(X)=>{let Q=await Z(X).metadata();return{dominant:{r:128,g:128,b:128}}}).catch(()=>({dominant:{r:128,g:128,b:128}}));return`rgb(${C.r}, ${C.g}, ${C.b})`}let $=await O(J),q=G.join(I.tmpdir(),`stx-ph-${H.randomBytes(8).toString("hex")}.${$.format==="unknown"?"bin":$.format}`);try{await Bun.write(q,J);let C=K==="blur"?"blur":K==="thumbhash"?"thumbhash":"dominant-color",Q=await m(q,{strategy:C,width:C==="thumbhash"?void 0:32});if(K==="dominant-color"&&Q.dominantColor)return Q.dominantColor;if(Q.dataURL)return Q.dataURL;return"rgb(128, 128, 128)"}catch{return"rgb(128, 128, 128)"}finally{await U.promises.unlink(q).catch(()=>{})}}function KJ(J,K){return(K?J.filter(($)=>$.format===K):J).sort(($,q)=>$.width-q.width).map(($)=>`${$.url} ${$.width}w`).join(", ")}function ZJ(J){if(!J||Object.keys(J).length===0)return"100vw";return Object.entries(J).sort((Z,$)=>{let q=Number.parseInt(Z[0].replace(/\D/g,""))||0;return(Number.parseInt($[0].replace(/\D/g,""))||0)-q}).map(([Z,$])=>`(max-width: ${Z}) ${$}`).join(", ")+", 100vw"}function $J(J){let K=J.filter(($)=>$.format==="jpeg");if(K.length===0)return J[Math.floor(J.length/2)];let Z=K.sort(($,q)=>$.width-q.width);return Z[Math.floor(Z.length/2)]}function qJ(J){let K=new Map;for(let Z of J){let $=K.get(Z.format)||[];$.push(Z),K.set(Z.format,$)}return K}function CJ(J){let K=G.extname(J).toLowerCase();return u.includes(K)}function QJ(J){return P[J]||"application/octet-stream"}function VJ(J){return J.reduce((K,Z)=>K+Z.size,0)}function XJ(J){if(J<1024)return`${J} B`;if(J<1048576)return`${(J/1024).toFixed(1)} KB`;return`${(J/1048576).toFixed(2)} MB`}class L extends Error{code;constructor(J,K){super(J);this.name="ImageProcessingError",this.code=K}}
|
|
3
|
-
export{d as Mm,h as Nm,b as Om,e as Pm,t as Qm,JJ as Rm,O as Sm,n as Tm,KJ as Um,ZJ as Vm,$J as Wm,qJ as Xm,CJ as Ym,QJ as Zm,VJ as _m,XJ as $m,L as an};
|
package/dist/chunk-4deg33rw.js
DELETED
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{pz as g,qz as M}from"./chunk-w3b6m427.js";import V from"crypto";function L(j){return String(j??"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}var W={input:"form-control",inputError:"is-invalid",checkInput:"form-check-input",label:"form-label",errorFeedback:"invalid-feedback"};function b(j){return{...W,...j.forms?.classes}}function N(j,q,K,U){let Z=j||q;return K?`${Z} ${U}`:Z}function h(){return V.randomUUID()}function v(j,q,K,U){let Z=b(U),X=j;return X=d(X,q),X=Q(X,q),X=f(X,q,Z),X=x(X,q,Z),X}function Q(j,q){let K=j;return K=K.replace(/@csrf/g,()=>{if(!q.csrf||typeof q.csrf!=="object"){let U=h();q.csrf={token:U}}if(q.csrf.field)return q.csrf.field;if(q.csrf.token)return`<input type="hidden" name="_token" value="${L(q.csrf.token)}">`;return'<input type="hidden" name="_token" value="">'}),K=K.replace(/@method\(['"]([^'"]+)['"]\)/g,(U,Z)=>{let X=Z.toUpperCase();if(Z&&!["GET","POST"].includes(X))return`<input type="hidden" name="_method" value="${L(X)}">`;return U}),K}function f(j,q,K=W){let U=j;return U=U.replace(/@form\(\s*(?:(?:'([^']+)'|"([^"]+)")\s*)?(?:,\s*(?:'([^']+)'|"([^"]+)")?)?\s*(?:,\s*\{([^}]+)\}\s*)?\)/g,(Z,X,$,Y,G,_="")=>{let w=X||$||"POST",P=Y||G||"",B=k(_),J=w.toUpperCase(),I=["GET","POST"].includes(J)?J:"POST",z=`<form method="${L(I)}" action="${L(P)}"${B?` ${B}`:""}>`;if(z+=`
|
|
3
|
-
${Q("@csrf",q)}`,!["GET","POST"].includes(J))z+=`
|
|
4
|
-
${Q(`@method('${J}')`,q)}`;return z}),U=U.replace(/@endform/g,"</form>"),U=U.replace(/@input\(\s*(?:'([^']+)'|"([^"]+)")\s*(?:,\s*(?:(?:'([^']*)'|"([^"]*)")\s*)?)?(?:,\s*\{([^}]+)\})?\s*\)/g,(Z,X,$,Y,G,_="")=>{let w=X||$||"",P=Y||G||"",B=k(_),J=H(w,q),I=J!==void 0&&J!==null?J:P||"",z=B.match(/type=['"]([^'"]+)['"]/i),T=z?z[1]:"text",R=O(w,q),D=B.match(/class=['"]([^'"]+)['"]/i),F=N(D?D[1]:"",K.input,R,K.inputError),y=B.replace(/class=['"][^'"]+['"]/i,"");return y=y.replace(/type=['"][^'"]+['"]/i,""),`<input type="${L(T)}" name="${L(w)}" value="${L(I)}" class="${F}"${y?` ${y}`:""}>`}),U=U.replace(/@textarea\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endtextarea/g,(Z,X,$="",Y="")=>{let G=k($),_=H(X,q)||Y.trim(),w=O(X,q),P=G.match(/class=['"]([^'"]+)['"]/i),B=N(P?P[1]:"",K.input,w,K.inputError),J=G.replace(/class=['"][^'"]+['"]/i,"");return`<textarea name="${L(X)}" class="${B}"${J?` ${J}`:""}>${L(_)}</textarea>`}),U=U.replace(/@select\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endselect/g,(Z,X,$="",Y)=>{let G=k($),_=H(X,q),w=O(X,q),P=G.match(/class=['"]([^'"]+)['"]/i),B=N(P?P[1]:"",K.input,w,K.inputError),J=G.replace(/class=['"][^'"]+['"]/i,""),I=Y;if(_!==void 0)I=Y.replace(/(<option[^>]*value=['"]([^'"]+)['"][^>]*>)/gi,(z,T,R)=>{if((Array.isArray(_)?_.some((F)=>String(F)===R):String(_)===R)&&!T.includes("selected"))return T.replace(/(<option)/,"$1 selected");return z});return`<select name="${L(X)}" class="${B}"${J?` ${J}`:""}>${I}</select>`}),U=U.replace(/@checkbox\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?(?:,\s*\{([^}]+)\})?\)/g,(Z,X,$="1",Y="")=>{let G=k(Y),_=H(X,q),w=_!==void 0&&(Array.isArray(_)?_.some((I)=>String(I)===$):_===!0||String(_)===$),P=G.match(/class=['"]([^'"]+)['"]/i),B=P?P[1]:K.checkInput,J=G.replace(/class=['"][^'"]+['"]/i,"");return`<input type="checkbox" name="${L(X)}" value="${L($)}" class="${B}"${w?" checked":""}${J?` ${J}`:""}>`}),U=U.replace(/@radio\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(Z,X,$,Y="")=>{let G=k(Y),_=H(X,q),w=_!==void 0&&_===$,P=G.match(/class=['"]([^'"]+)['"]/i),B=P?P[1]:K.checkInput,J=G.replace(/class=['"][^'"]+['"]/i,"");return`<input type="radio" name="${L(X)}" value="${L($)}" class="${B}"${w?" checked":""}${J?` ${J}`:""}>`}),U=U.replace(/@file\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(Z,X,$="")=>{let Y=k($),G=Y.match(/accept=['"]([^'"]+)['"]/i),_=G?G[1]:"",w=Y.includes("multiple"),P=O(X,q),B=Y.match(/class=['"]([^'"]+)['"]/i),J=N(B?B[1]:"",K.input,P,K.inputError),I=Y.replace(/class=['"][^'"]+['"]/gi,"").replace(/accept=['"][^'"]+['"]/gi,"").replace(/\bmultiple\b/gi,"").trim(),z=[`<input type="file" name="${L(X)}"`,`class="${J}"`];if(_)z.push(`accept="${L(_)}"`);if(w)z.push("multiple");if(I)z.push(I);return`${z.join(" ")}>`}),U=U.replace(/@label\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endlabel/g,(Z,X,$="",Y)=>{let G=k($),_=G.match(/class=['"]([^'"]+)['"]/i),w=_?_[1]:K.label,P=G.replace(/class=['"][^'"]+['"]/i,"");return`<label for="${L(X)}" class="${w}"${P?` ${P}`:""}>${Y}</label>`}),U}function x(j,q,K=W){return j.replace(/@error\(['"]([^'"]+)['"]\)([\s\S]*?)@enderror/g,(U,Z,X)=>{try{if(O(Z,q))return X.replace(/\{\{([^}]+)\}\}/g,($,Y)=>{try{if(Y.trim()==="$message"||Y.trim()==="message")return E(Z,q);if(Y.trim().includes("errors.first")||Y.trim().includes("$errors.first")){if(typeof q.errors?.first==="function")return q.errors.first(Z);return E(Z,q)}let G=Y.trim();if(M(G)){let _=g(G,q);return _!==void 0?String(_):G}return G}catch{return Y}});return""}catch($){return console.error("Error processing @error directive:",$),U}})}function O(j,q){if(!q.errors)return!1;if(typeof q.errors.has==="function")return q.errors.has(j);if(typeof q.errors==="object")return Object.prototype.hasOwnProperty.call(q.errors,j);return!1}function E(j,q){if(!q.errors)return"";if(typeof q.errors.get==="function")return q.errors.get(j);if(typeof q.errors==="object"&&Object.prototype.hasOwnProperty.call(q.errors,j)){let K=q.errors[j];return Array.isArray(K)?K[0]:String(K)}return""}function H(j,q){let K;if(q.old&&typeof q.old==="function")return q.old(j);if(q.old&&typeof q.old==="object")return q.old[j];if(j.endsWith("[]")){let U=j.slice(0,-2);if(K=q[U],K!==void 0)return K}return q[j]}function k(j){if(!j.trim())return"";let q=[],K=j.trim(),U=/([\w-]+)\s*:\s*(['"]?)([^,'"]*)\2(?:\s*,\s*|\s*$)/g,Z;while((Z=U.exec(K))!==null){let[,X,,$]=Z;q.push(`${X}="${$.trim()}"`)}return q.join(" ")}var C={required:(j,q,K)=>{if(j===void 0||j===null||j===""||Array.isArray(j)&&j.length===0)return`The ${K} field is required.`;return null},email:(j,q,K)=>{if(!j)return null;if(!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(String(j)))return`The ${K} field must be a valid email address.`;return null},min:(j,q,K)=>{if(!j)return null;let U=Number(q[0]);if(typeof j==="string"&&j.length<U)return`The ${K} field must be at least ${U} characters.`;if(typeof j==="number"&&j<U)return`The ${K} field must be at least ${U}.`;if(Array.isArray(j)&&j.length<U)return`The ${K} field must have at least ${U} items.`;return null},max:(j,q,K)=>{if(!j)return null;let U=Number(q[0]);if(typeof j==="string"&&j.length>U)return`The ${K} field must not exceed ${U} characters.`;if(typeof j==="number"&&j>U)return`The ${K} field must not exceed ${U}.`;if(Array.isArray(j)&&j.length>U)return`The ${K} field must not have more than ${U} items.`;return null},confirmed:(j,q,K)=>{if(q[0]!==void 0&&j!==q[0])return`The ${K} confirmation does not match.`;return null},numeric:(j,q,K)=>{if(!j)return null;if(Number.isNaN(Number(j)))return`The ${K} field must be a number.`;return null},integer:(j,q,K)=>{if(!j)return null;if(!Number.isInteger(Number(j)))return`The ${K} field must be an integer.`;return null},alpha:(j,q,K)=>{if(!j)return null;if(!/^[a-z]+$/i.test(String(j)))return`The ${K} field must only contain letters.`;return null},alphanumeric:(j,q,K)=>{if(!j)return null;if(!/^[a-z0-9]+$/i.test(String(j)))return`The ${K} field must only contain letters and numbers.`;return null},url:(j,q,K)=>{if(!j)return null;try{return new URL(String(j))?null:null}catch{return`The ${K} field must be a valid URL.`}},regex:(j,q,K)=>{if(!j)return null;try{if(!new RegExp(q[0]).test(String(j)))return`The ${K} field format is invalid.`;return null}catch{return`The ${K} field has an invalid validation pattern.`}},in:(j,q,K)=>{if(!j)return null;if(!q.includes(String(j)))return`The ${K} field must be one of: ${q.join(", ")}.`;return null},notIn:(j,q,K)=>{if(!j)return null;if(q.includes(String(j)))return`The ${K} field must not be: ${q.join(", ")}.`;return null},date:(j,q,K)=>{if(!j)return null;let U=new Date(j);if(Number.isNaN(U.getTime()))return`The ${K} field must be a valid date.`;return null},before:(j,q,K)=>{if(!j)return null;let U=new Date(j),Z=new Date(q[0]);if(U>=Z)return`The ${K} field must be before ${q[0]}.`;return null},after:(j,q,K)=>{if(!j)return null;let U=new Date(j),Z=new Date(q[0]);if(U<=Z)return`The ${K} field must be after ${q[0]}.`;return null}};function i(j,q){C[j]=q}function S(j){let[q,...K]=j.split(":"),U=K.length>0?K.join(":").split(","):[];return{name:q.trim(),params:U}}function p(j,q,K,U={}){let Z=[],X=K.split("|").map(($)=>$.trim()).filter(Boolean);for(let $ of X){let Y=S($),G=C[Y.name];if(!G){console.warn(`Unknown validation rule: ${Y.name}`);continue}if(Y.name==="confirmed"){let w=`${j}_confirmation`;Y.params=[U[w]]}let _=G(q,Y.params||[],j);if(_)Z.push(Y.message||_)}return{field:j,valid:Z.length===0,errors:Z}}function o(j,q){let K={};for(let[U,Z]of Object.entries(q)){let X=p(U,j[U],Z,j);if(!X.valid)K[U]=X.errors}return K}function d(j,q){return j.replace(/@validate\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]*)\})?\s*\)/g,(K,U,Z,X)=>{let $=Z.split("|").map((G)=>G.trim()),Y=[];for(let G of $){let _=S(G);switch(_.name){case"required":Y.push("required");break;case"email":Y.push('type="email"');break;case"url":Y.push('type="url"');break;case"numeric":case"integer":if(Y.push('type="number"'),_.name==="integer")Y.push('step="1"');break;case"min":if(_.params?.[0])Y.push(`minlength="${_.params[0]}"`);break;case"max":if(_.params?.[0])Y.push(`maxlength="${_.params[0]}"`);break;case"regex":if(_.params?.[0])Y.push(`pattern="${_.params[0]}"`);break}}return`<!-- @validate:${U}:${Z} -->${Y.length>0?`<!-- attrs:${Y.join(" ")} -->`:""}`})}var A={required:{name:"required",validate:(j)=>{if(j===null||j===void 0||j==="")return"This field is required";if(Array.isArray(j)&&j.length===0)return"This field is required";return!0},toHtml5:()=>["required"],message:"This field is required"},email:{name:"email",validate:(j)=>{if(!j)return!0;return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(String(j))||"Please enter a valid email address"},toHtml5:()=>['type="email"'],message:"Please enter a valid email address"},url:{name:"url",validate:(j)=>{if(!j)return!0;try{return new URL(String(j)).protocol.startsWith("http")||"Please enter a valid URL"}catch{return"Please enter a valid URL"}},toHtml5:()=>['type="url"'],message:"Please enter a valid URL"},numeric:{name:"numeric",validate:(j)=>{if(!j)return!0;return!Number.isNaN(Number(j))||"Please enter a number"},toHtml5:()=>['type="number"'],message:"Please enter a number"},integer:{name:"integer",validate:(j)=>{if(!j)return!0;let q=Number(j);return Number.isInteger(q)||"Please enter a whole number"},toHtml5:()=>['type="number"','step="1"'],message:"Please enter a whole number"},alpha:{name:"alpha",validate:(j)=>{if(!j)return!0;return/^[a-z]+$/i.test(String(j))||"Please enter only letters"},toHtml5:()=>['pattern="[a-zA-Z]+"'],message:"Please enter only letters"},alphanumeric:{name:"alphanumeric",validate:(j)=>{if(!j)return!0;return/^[a-z0-9]+$/i.test(String(j))||"Please enter only letters and numbers"},toHtml5:()=>['pattern="[a-zA-Z0-9]+"'],message:"Please enter only letters and numbers"},min:{name:"min",validate:(j,q)=>{if(!j)return!0;let K=Number(q[0]);if(typeof j==="string")return j.length>=K||`Must be at least ${K} characters`;if(typeof j==="number")return j>=K||`Must be at least ${K}`;if(Array.isArray(j))return j.length>=K||`Must have at least ${K} items`;return!0},toHtml5:(j)=>[`minlength="${j[0]}"`,`min="${j[0]}"`],message:"Must be at least {{param}} characters"},max:{name:"max",validate:(j,q)=>{if(!j)return!0;let K=Number(q[0]);if(typeof j==="string")return j.length<=K||`Must be no more than ${K} characters`;if(typeof j==="number")return j<=K||`Must be no more than ${K}`;if(Array.isArray(j))return j.length<=K||`Must have no more than ${K} items`;return!0},toHtml5:(j)=>[`maxlength="${j[0]}"`,`max="${j[0]}"`],message:"Must be no more than {{param}} characters"},between:{name:"between",validate:(j,q)=>{if(!j)return!0;let[K,U]=q.map(Number);if(typeof j==="string")return j.length>=K&&j.length<=U||`Must be between ${K} and ${U} characters`;if(typeof j==="number")return j>=K&&j<=U||`Must be between ${K} and ${U}`;return!0},toHtml5:(j)=>[`minlength="${j[0]}"`,`maxlength="${j[1]}"`],message:"Must be between {{min}} and {{max}}"},confirmed:{name:"confirmed",validate:(j,q,K)=>{let U=Object.keys(K);for(let Z of U)if(Z.endsWith("_confirmation")&&K[Z]===j)return!0;return"Confirmation does not match"},message:"Confirmation does not match"},in:{name:"in",validate:(j,q)=>{if(!j)return!0;return q.includes(String(j))||`Must be one of: ${q.join(", ")}`},message:"Must be one of: {{values}}"},notIn:{name:"notIn",validate:(j,q)=>{if(!j)return!0;return!q.includes(String(j))||`Must not be: ${q.join(", ")}`},message:"Must not be: {{values}}"},regex:{name:"regex",validate:(j,q)=>{if(!j)return!0;try{return new RegExp(q[0]).test(String(j))||"Invalid format"}catch{return"Invalid format"}},toHtml5:(j)=>[`pattern="${j[0]}"`],message:"Invalid format"},date:{name:"date",validate:(j)=>{if(!j)return!0;let q=new Date(String(j));return!Number.isNaN(q.getTime())||"Please enter a valid date"},toHtml5:()=>['type="date"'],message:"Please enter a valid date"},before:{name:"before",validate:(j,q)=>{if(!j)return!0;let K=new Date(String(j)),U=new Date(q[0]);return K<U||`Must be before ${q[0]}`},toHtml5:(j)=>[`max="${j[0]}"`],message:"Must be before {{date}}"},after:{name:"after",validate:(j,q)=>{if(!j)return!0;let K=new Date(String(j)),U=new Date(q[0]);return K>U||`Must be after ${q[0]}`},toHtml5:(j)=>[`min="${j[0]}"`],message:"Must be after {{date}}"},size:{name:"size",validate:(j,q)=>{if(!j)return!0;let K=Number(q[0]);if(typeof j==="string")return j.length===K||`Must be exactly ${K} characters`;if(Array.isArray(j))return j.length===K||`Must have exactly ${K} items`;return!0},message:"Must be exactly {{size}}"},phone:{name:"phone",validate:(j)=>{if(!j)return!0;return/^\+?\(?\d{1,4}\)?[-\s./\d]*$/.test(String(j))||"Please enter a valid phone number"},toHtml5:()=>['type="tel"','pattern="\\+?\\(?\\d{1,4}\\)?[-\\s./\\d]*"'],message:"Please enter a valid phone number"}};function u(j){A[j.name]=j}function m(j,q,K={}){let U=[],Z=q.split("|").map((X)=>X.trim());for(let X of Z){let $=S(X),Y=A[$.name];if(!Y){console.warn(`Unknown validation rule: ${$.name}`);continue}let G=Y.validate(j,$.params||[],K);if(G!==!0)U.push(G)}return{valid:U.length===0,errors:U}}function r(j,q){let K={},U=!0;for(let[Z,X]of Object.entries(q)){let $=m(j[Z],X,j);if(!$.valid)U=!1,K[Z]=$.errors}return{valid:U,errors:K}}function s(j,q){let K=JSON.stringify(q);return`
|
|
5
|
-
<script>
|
|
6
|
-
(function() {
|
|
7
|
-
const form = document.getElementById('${j}');
|
|
8
|
-
if (!form) return;
|
|
9
|
-
|
|
10
|
-
const rules = ${K};
|
|
11
|
-
const validators = {
|
|
12
|
-
required: (v) => v !== null && v !== undefined && v !== '' ? true : 'This field is required',
|
|
13
|
-
email: (v) => !v || /^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$/.test(v) ? true : 'Please enter a valid email',
|
|
14
|
-
url: (v) => { if (!v) return true; try { new URL(v); return true; }
|
|
15
|
-
catch { return 'Please enter a valid URL'; } },
|
|
16
|
-
numeric: (v) => !v || !isNaN(Number(v)) ? true : 'Please enter a number',
|
|
17
|
-
integer: (v) => !v || Number.isInteger(Number(v)) ? true : 'Please enter a whole number',
|
|
18
|
-
min: (v, p) => !v || (typeof v === 'string' ? v.length >= p : v >= p) ? true : 'Too short/small',
|
|
19
|
-
max: (v, p) => !v || (typeof v === 'string' ? v.length <= p : v <= p) ? true : 'Too long/large',
|
|
20
|
-
regex: (v, p) => !v || new RegExp(p).test(v) ? true : 'Invalid format',
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
form.addEventListener('submit', function(e) {
|
|
24
|
-
let valid = true;
|
|
25
|
-
const errors = {};
|
|
26
|
-
|
|
27
|
-
for (const [field, fieldRules] of Object.entries(rules)) {
|
|
28
|
-
const input = form.querySelector('[name="' + field + '"]');
|
|
29
|
-
if (!input) continue;
|
|
30
|
-
|
|
31
|
-
const value = input.value;
|
|
32
|
-
const ruleList = fieldRules.split('|');
|
|
33
|
-
|
|
34
|
-
for (const rule of ruleList) {
|
|
35
|
-
const [name, param] = rule.split(':');
|
|
36
|
-
const validator = validators[name];
|
|
37
|
-
if (validator) {
|
|
38
|
-
const result = validator(value, param);
|
|
39
|
-
if (result !== true) {
|
|
40
|
-
valid = false;
|
|
41
|
-
errors[field] = errors[field] || [];
|
|
42
|
-
errors[field].push(result);
|
|
43
|
-
input.classList.add('is-invalid');
|
|
44
|
-
break;
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
if (!valid) {
|
|
51
|
-
e.preventDefault();
|
|
52
|
-
console.log('Validation errors:', errors);
|
|
53
|
-
}
|
|
54
|
-
});
|
|
55
|
-
})();
|
|
56
|
-
</script>`.trim()}
|
|
57
|
-
export{W as Nv,v as Ov,Q as Pv,f as Qv,x as Rv,i as Sv,p as Tv,o as Uv,d as Vv,A as Wv,u as Xv,m as Yv,r as Zv,s as _v};
|