@stacksjs/stx 0.2.95 → 0.2.96
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/a11y.js +598 -2
- package/dist/analytics.js +159 -2
- package/dist/analyzer.js +240 -2
- package/dist/animation.js +688 -2
- package/dist/app-shell.js +220 -2
- package/dist/app.js +79 -2
- package/dist/assets.js +155 -2
- package/dist/ast.js +630 -2
- package/dist/async-components.js +428 -2
- package/dist/auth.js +12 -2
- package/dist/broadcasting.js +102 -2
- package/dist/browser-composables.js +565 -2
- package/dist/build-assets.js +29 -2
- package/dist/build-mode-detector.js +50 -2
- package/dist/build-optimizer.js +433 -2
- package/dist/build-views.js +180 -2
- package/dist/build.js +33 -2
- package/dist/builtins/drawer.js +37 -2
- package/dist/builtins/escape.js +3 -2
- package/dist/builtins/icon.js +83 -2
- package/dist/builtins/index.js +34 -2
- package/dist/builtins/modal.js +38 -2
- package/dist/builtins/safe-image.js +51 -2
- package/dist/builtins/stx-image.js +200 -2
- package/dist/builtins/stx-link.js +41 -2
- package/dist/builtins/stx-loading-indicator.js +35 -2
- package/dist/builtins/suspense.js +24 -2
- package/dist/builtins/toast.js +42 -2
- package/dist/builtins/tooltip.js +106 -2
- package/dist/builtins/transition-group.js +22 -2
- package/dist/bundle-analyzer/collector.js +233 -2
- package/dist/bundle-analyzer/index.js +82 -2
- package/dist/bundle-analyzer/report.js +318 -2
- package/dist/bundle-analyzer/treemap.js +594 -2
- package/dist/caching.js +131 -2
- package/dist/cli.js +11317 -10982
- package/dist/client/directive.js +14 -2
- package/dist/client/index.js +2 -2
- package/dist/client-helpers.js +312 -2
- package/dist/client-script-bundler.js +216 -6
- package/dist/client-script.js +754 -2
- package/dist/client.js +73 -4
- package/dist/component-hmr.js +585 -2
- package/dist/component-library.d.ts +6 -0
- package/dist/component-library.js +683 -0
- package/dist/component-processing.js +613 -2
- package/dist/component-registry.js +90 -2
- package/dist/component-renderer.js +660 -2
- package/dist/components.js +213 -2
- package/dist/composables/index.js +220 -2
- package/dist/composables/use-battery.js +101 -2
- package/dist/composables/use-broadcast-channel.js +80 -2
- package/dist/composables/use-channel.js +124 -2
- package/dist/composables/use-clipboard.js +79 -2
- package/dist/composables/use-color-mode.js +131 -2
- package/dist/composables/use-cookie.js +86 -2
- package/dist/composables/use-device-orientation.js +181 -2
- package/dist/composables/use-event-listener.js +27 -2
- package/dist/composables/use-event-source.js +166 -2
- package/dist/composables/use-eye-dropper.js +142 -2
- package/dist/composables/use-fetch.js +223 -2
- package/dist/composables/use-fullscreen.js +110 -2
- package/dist/composables/use-geolocation.js +101 -2
- package/dist/composables/use-idle.js +182 -2
- package/dist/composables/use-intersection-observer.js +168 -2
- package/dist/composables/use-keyboard.js +224 -2
- package/dist/composables/use-media-query.js +62 -2
- package/dist/composables/use-meta.js +48 -2
- package/dist/composables/use-mouse.js +286 -2
- package/dist/composables/use-mutation-observer.js +129 -2
- package/dist/composables/use-network.js +85 -2
- package/dist/composables/use-notification.js +94 -2
- package/dist/composables/use-permissions.js +132 -2
- package/dist/composables/use-query.js +0 -1
- package/dist/composables/use-resize-observer.js +157 -2
- package/dist/composables/use-router.js +51 -2
- package/dist/composables/use-share.js +104 -2
- package/dist/composables/use-speech.js +294 -2
- package/dist/composables/use-storage.js +130 -2
- package/dist/composables/use-text-selection.js +205 -4
- package/dist/composables/use-timer.js +183 -2
- package/dist/composables/use-utilities.js +176 -2
- package/dist/composables/use-wake-lock.js +122 -2
- package/dist/composables/use-websocket.js +165 -2
- package/dist/composables/use-window.js +163 -2
- package/dist/composables.js +552 -2
- package/dist/composition-api.js +190 -2
- package/dist/computed.js +376 -8
- package/dist/conditionals.js +599 -2
- package/dist/config.js +751 -2
- package/dist/craft-bridge.js +432 -2
- package/dist/craft-compiler.js +810 -2
- package/dist/craft-components.js +945 -2
- package/dist/craft-entry.js +5 -2
- package/dist/craft-ssr.js +559 -2
- package/dist/csp.js +220 -2
- package/dist/csrf.js +38 -2
- package/dist/custom-directives.js +136 -2
- package/dist/defer.js +156 -2
- package/dist/deploy/config-generators.js +214 -2
- package/dist/deploy/index.js +203 -2
- package/dist/deploy/netlify.js +167 -2
- package/dist/dev-server/crosswind.js +379 -2
- package/dist/dev-server/index.js +7 -2
- package/dist/dev-server/keyboard-shortcuts.js +81 -2
- package/dist/dev-server/native-window.js +91 -2
- package/dist/dev-server/port-utils.js +40 -2
- package/dist/dev-server/serve-app.js +682 -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/x-element.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
export function generateXElementRuntime() {
|
|
2
|
+
return `<script data-stx-scoped>
|
|
3
3
|
(function() {
|
|
4
4
|
'use strict';
|
|
5
5
|
|
|
@@ -283,6 +283,18 @@ else {
|
|
|
283
283
|
// Expose for manual initialization
|
|
284
284
|
window.XElement = XElement;
|
|
285
285
|
})();
|
|
286
|
-
</script
|
|
287
|
-
|
|
288
|
-
|
|
286
|
+
</script>`;
|
|
287
|
+
}
|
|
288
|
+
export function hasXElementDirectives(template) {
|
|
289
|
+
return /\bx-(data|model|text|show|init|html)\b/.test(template) || /\s:[a-z]/.test(template);
|
|
290
|
+
}
|
|
291
|
+
export function processXElementDirectives(template) {
|
|
292
|
+
if (!hasXElementDirectives(template))
|
|
293
|
+
return template;
|
|
294
|
+
const runtime = generateXElementRuntime(), bodyCloseIdx = template.lastIndexOf("</body>");
|
|
295
|
+
if (bodyCloseIdx !== -1)
|
|
296
|
+
return template.slice(0, bodyCloseIdx) + runtime + `
|
|
297
|
+
` + template.slice(bodyCloseIdx);
|
|
298
|
+
return template + `
|
|
299
|
+
` + runtime;
|
|
300
|
+
}
|
package/package.json
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stacksjs/stx",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"
|
|
5
|
-
"version": "0.2.95",
|
|
4
|
+
"version": "0.2.96",
|
|
6
5
|
"description": "A performant UI Framework. Powered by Bun.",
|
|
7
6
|
"author": "Chris Breuer <chris@stacksjs.org>",
|
|
8
7
|
"license": "MIT",
|
|
@@ -118,16 +117,16 @@
|
|
|
118
117
|
"dependencies": {
|
|
119
118
|
"@cwcss/crosswind": "^0.2.6",
|
|
120
119
|
"@stacksjs/clapp": "^0.2.0",
|
|
121
|
-
"@stacksjs/sanitizer": "0.2.
|
|
120
|
+
"@stacksjs/sanitizer": "0.2.96",
|
|
122
121
|
"@stacksjs/ts-i18n": "^0.1.11",
|
|
123
|
-
"bun-plugin-stx": "0.2.
|
|
122
|
+
"bun-plugin-stx": "0.2.96",
|
|
124
123
|
"bunfig": "^0.15.14",
|
|
125
|
-
"stx-router": "0.2.
|
|
124
|
+
"stx-router": "0.2.96",
|
|
126
125
|
"ts-broadcasting": "^0.0.8",
|
|
127
126
|
"ts-images": "^0.1.9",
|
|
128
127
|
"ts-syntax-highlighter": "^0.2.1"
|
|
129
128
|
},
|
|
130
129
|
"optionalDependencies": {
|
|
131
|
-
"@stacksjs/desktop": "0.2.
|
|
130
|
+
"@stacksjs/desktop": "0.2.96"
|
|
132
131
|
}
|
|
133
132
|
}
|
package/dist/chunk-04n64bnt.js
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import Q from"fs";import L from"path";function Z(w){let q=[];if(q.push("[build]"),q.push(` command = "${E(w.build.command)}"`),q.push(` publish = "${E(w.build.publish)}"`),w.build.functions)q.push(` functions = "${E(w.build.functions)}"`);if(w.build.edge_functions)q.push(` edge_functions = "${E(w.build.edge_functions)}"`);if(w.build.environment&&Object.keys(w.build.environment).length>0){q.push(""),q.push("[build.environment]");for(let[z,B]of Object.entries(w.build.environment))q.push(` ${z} = "${E(B)}"`)}if(w.functions){if(q.push(""),q.push("[functions]"),w.functions.directory)q.push(` directory = "${E(w.functions.directory)}"`);if(w.functions.node_bundler)q.push(` node_bundler = "${w.functions.node_bundler}"`);if(w.functions.external_node_modules&&w.functions.external_node_modules.length>0)q.push(` external_node_modules = [${w.functions.external_node_modules.map((z)=>`"${z}"`).join(", ")}]`)}if(w.edge_functions&&w.edge_functions.length>0){q.push("");for(let z of w.edge_functions)q.push("[[edge_functions]]"),q.push(` function = "${E(z.function)}"`),q.push(` path = "${E(z.path)}"`)}if(w.redirects&&w.redirects.length>0){q.push("");for(let z of w.redirects){if(q.push("[[redirects]]"),q.push(` from = "${E(z.from)}"`),q.push(` to = "${E(z.to)}"`),z.status!==void 0)q.push(` status = ${z.status}`);if(z.force!==void 0)q.push(` force = ${z.force}`);if(z.conditions&&Object.keys(z.conditions).length>0){q.push(" [redirects.conditions]");for(let[B,G]of Object.entries(z.conditions))q.push(` ${B} = "${E(G)}"`)}}}if(w.headers&&w.headers.length>0){q.push("");for(let z of w.headers){q.push("[[headers]]"),q.push(` for = "${E(z.for)}"`),q.push(" [headers.values]");for(let[B,G]of Object.entries(z.values))q.push(` ${B} = "${E(G)}"`)}}if(w.plugins&&w.plugins.length>0){q.push("");for(let z of w.plugins)if(q.push("[[plugins]]"),q.push(` package = "${E(z.package)}"`),z.inputs&&Object.keys(z.inputs).length>0){q.push(" [plugins.inputs]");for(let[B,G]of Object.entries(z.inputs))if(typeof G==="string")q.push(` ${B} = "${E(G)}"`);else if(typeof G==="boolean"||typeof G==="number")q.push(` ${B} = ${G}`)}}if(w.context&&Object.keys(w.context).length>0)for(let[z,B]of Object.entries(w.context)){if(q.push(""),q.push(`[context.${z}]`),B.command)q.push(` command = "${E(B.command)}"`);if(B.publish)q.push(` publish = "${E(B.publish)}"`);if(B.environment&&Object.keys(B.environment).length>0){q.push(` [context.${z}.environment]`);for(let[G,U]of Object.entries(B.environment))q.push(` ${G} = "${E(U)}"`)}}return q.join(`
|
|
3
|
-
`)+`
|
|
4
|
-
`}function E(w){return w.replace(/\\/g,"\\\\").replace(/"/g,"\\\"").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t")}async function _(w){let q={framework:"stx",buildCommand:"bun run build",outputDir:"dist"},z=L.join(w,"package.json");if(await Bun.file(z).exists())try{let K=JSON.parse(await Bun.file(z).text());if(K.scripts?.build)q.buildCommand="bun run build";let M={...K.dependencies,...K.devDependencies};if(M["@stacksjs/stx"]||M.stx)q.framework="stx"}catch{}let B=L.join(w,"stx.config.ts"),G=L.join(w,".config","stx.config.ts");if(await Bun.file(B).exists()||await Bun.file(G).exists())q.framework="stx";let U=["dist","build","out","public",".output"];for(let K of U){let M=L.join(w,K);if(Q.existsSync(M)&&Q.statSync(M).isDirectory()){q.outputDir=K;break}}let W=["functions","netlify/functions","api"];for(let K of W){let M=L.join(w,K);if(Q.existsSync(M)&&Q.statSync(M).isDirectory()){q.functionsDir=K;break}}let X=L.join(w,"netlify","edge-functions");if(Q.existsSync(X))q.edgeFunctionsDir="netlify/edge-functions";let V=L.join(w,q.outputDir||"dist");if(Q.existsSync(V)){let K=Q.existsSync(L.join(V,"index.html")),M=Q.readdirSync(V).filter((Y)=>Y.endsWith(".html"));q.isSPA=K&&M.length===1}return q}function $(w={}){let q={build:{command:w.buildCommand||"bun run build",publish:w.outputDir||"dist"}};if(w.functionsDir)q.build.functions=w.functionsDir,q.functions={directory:w.functionsDir,node_bundler:"esbuild"};if(w.edgeFunctionsDir)q.build.edge_functions=w.edgeFunctionsDir;if(q.headers=[{for:"/*",values:{"X-Frame-Options":"DENY","X-Content-Type-Options":"nosniff","X-XSS-Protection":"1; mode=block","Referrer-Policy":"strict-origin-when-cross-origin"}},{for:"/assets/*",values:{"Cache-Control":"public, max-age=31536000, immutable"}}],w.isSPA!==!1)q.redirects=[{from:"/*",to:"/index.html",status:200}];return q.context={production:{environment:{NODE_ENV:"production"}},"deploy-preview":{environment:{NODE_ENV:"development"}}},q}async function I(w,q){let z=await _(w),B=q||$(z),G=Z(B),U=L.join(w,"netlify.toml");return await Bun.write(U,G),U}function O(w){return Q.existsSync(L.join(w,"netlify.toml"))}async function R(w){let q=L.join(w,"netlify.toml");if(!await Bun.file(q).exists())return null;return Bun.file(q).text()}
|
|
5
|
-
export{Z as Qn,_ as Rn,$ as Sn,I as Tn,O as Un,R as Vn};
|
package/dist/chunk-06w68hyg.js
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{Zg as b}from"./chunk-n5kg7fpx.js";import{_g as f,ah as u,bh as v,dh as d,eh as p}from"./chunk-jnmgm2xw.js";import{fh as y}from"./chunk-9eq3ht5f.js";import{gh as S}from"./chunk-0p0nyq50.js";import{hh as F}from"./chunk-6eqbxcrd.js";import{ih as P}from"./chunk-ewa88139.js";import{Rw as D}from"./chunk-shv88d2d.js";var{Glob:m}=globalThis.Bun;import{cpSync as h,existsSync as T,mkdirSync as j,readFileSync as g,readdirSync as s,rmSync as r,statSync as n,unlinkSync as a,writeFileSync as A}from"fs";import{dirname as i,join as H,relative as o}from"path";import w from"process";import e from"bun-plugin-stx";async function Aq(q){let N=Date.now(),V=q.pagesDir??"pages",K=q.outDir??"dist",Q=q.publicDir??"public";if(!q.noClean)r(K,{recursive:!0,force:!0});j(K,{recursive:!0});let B=new m(`${V}/**/*.stx`),Z=await Array.fromAsync(B.scan("."));if(Z.length===0)throw Error(`No .stx files found in ${V}/`);let _=await Bun.build({entrypoints:Z,outdir:K,plugins:[e()],naming:{entry:"[name].[ext]"}});if(!_.success)throw console.error(_.logs),Error("Build failed");qq(K);let $=z(K).filter((G)=>G.endsWith(".html")),X=f(q,w.cwd()),M=new Set($.map(I));for(let G of $){let E=H(K,G),x=g(E,"utf8"),J=I(G),O=X?X.locales:[q.seo?.locale?.split(/[_-]/)[0]??"en"];for(let W of O){let Y=x;if(Y=Kq(Y),X)Y=u(Y,X,W);if(Y=await D(Y,w.cwd()),Y=F(Y,q,q.pages?.[J],J),X)Y=Nq(Y,q,X,W,J),Y=Qq(Y,W,X.defaultLocale,M);if(Y=b(Y,q),Y=Vq(Y),X)Y=Y.replace(/<\/body>/i,`${p(X,W)}
|
|
3
|
-
</body>`);if(q.spa!==!1)Y=await S(Y,q.router);let C=X?l(J,W,X.defaultLocale):G,L=H(K,C);if(j(t(L),{recursive:!0}),A(L,Y),X&&W!==X.defaultLocale&&C!==G);}}if(T(Q))h(Q,K,{recursive:!0});let R=H(K,"404.html");if(!T(R)&&T(H(K,"index.html"))){let G=g(H(K,"index.html"),"utf8").replace(/<title>[^<]*<\/title>/i,`<title>404 \u2014 ${Xq(q.name)}</title>`);A(R,G)}if(q.sitemap!==!1){let G=[],E=$.filter((J)=>J!=="404.html").map(I),x=X?X.locales:[null];for(let J of E){let O=q.pages?.[J];for(let W of x){let Y=W&&X?v(J,W,X.defaultLocale):J;G.push({path:Y,page:O})}}A(H(K,"sitemap.xml"),P(q,G))}let U=y(q);if(U!==null)A(H(K,"robots.txt"),U);let c=$.map(I);return{outDir:K,pages:c,durationMs:Date.now()-N}}function t(q){return i(q)}function l(q,N,V){let K=v(q,N,V);if(K==="/")return"index.html";let Q=K.replace(/^\//,"").replace(/\/$/,"");if(!Q.includes("/")){if(N!==V&&Q===N)return`${N}/index.html`;return`${Q}.html`}return`${Q}.html`.replace(/\.html\.html$/,".html")}function I(q){if(q==="index.html")return"/";return`/${q.replace(/\.html$/,"").replace(/\/index$/,"")}`}function z(q,N=q){let V=[];if(!T(q))return V;for(let K of s(q,{withFileTypes:!0})){let Q=H(q,K.name);if(K.isDirectory())V.push(...z(Q,N));else V.push(o(N,Q))}return V}function qq(q){for(let N of z(q)){if(!/^chunk-.*\.js(?:\.map)?$/.test(N))continue;let V=H(q,N);try{if(n(V).size===0)a(V)}catch{}}}function Kq(q){return q.replace(/<script[^>]*src=["']\.\/chunk-[^"']*\.js["'][^>]*><\/script>\s*/g,"")}function Nq(q,N,V,K,Q){if(!V)return q;if(/<html\b[^>]*\blang=/i.test(q))q=q.replace(/<html\b([^>]*)\blang="[^"]*"/i,`<html$1lang="${K}"`);else q=q.replace(/<html\b([^>]*)>/i,`<html$1 lang="${K}">`);let B=`${N.url.replace(/\/$/,"")}${v(Q,K,V.defaultLocale)}`;if(/<link rel="canonical"/.test(q))q=q.replace(/<link rel="canonical"[^>]*>/,`<link rel="canonical" href="${k(B)}">`);let Z=K.includes("_")||K.includes("-")?K:K.toLowerCase();if(/<meta property="og:locale"/.test(q))q=q.replace(/<meta property="og:locale"[^>]*>/,`<meta property="og:locale" content="${k(Z)}">`);if(/<meta property="og:url"/.test(q))q=q.replace(/<meta property="og:url"[^>]*>/,`<meta property="og:url" content="${k(B)}">`);let _=d(N.url,Q,V);if(!q.includes("hreflang="))q=q.replace(/<link rel="canonical"[^>]*>/,($)=>`${_}
|
|
4
|
-
${$}`);return q}function k(q){return q.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function Qq(q,N,V,K){if(N===V)return q;return q.replace(/<a\b([^>]*?)\bhref="(\/[^"]*)"([^>]*)>/gi,(Q,B,Z,_)=>{if(Z.startsWith("//"))return Q;if(Z===`/${N}`||Z===`/${N}/`||Z.startsWith(`/${N}/`))return Q;let $=Z.match(/^(\/[^?#]*)(.*)$/);if(!$)return Q;let[,X,M]=$,R=X==="/"?"/":X.replace(/\/$/,"");if(!K.has(R))return Q;let U=R==="/"?`/${N}/`:`/${N}${R}`;return`<a${B}href="${U}${M}"${_}>`})}function Vq(q){if(/<main\b/i.test(q)||/\bdata-stx-content\b/i.test(q))return q;let N=q.match(/<body\b[^>]*>/i),V=q.search(/<\/body\s*>/i);if(!N||V<0)return q;let K=N.index+N[0].length,Q=q.slice(K,V),B=0,Z=[...Q.matchAll(/<\/nav>/gi)];if(Z.length>0){let U=Z[Z.length-1];B=U.index+U[0].length}let _=Q.length,$=Q.search(/<footer\b/i);if($!==-1)_=Math.min(_,$);let X=Q.search(/<script\b[^>]*data-stx-(?:theme-toggle|reparent-progress)\b/i);if(X!==-1)_=Math.min(_,X);if(_<=B)return q;let M=Q.slice(B,_);if(!M.trim())return q;let R=`${Q.slice(0,B)}
|
|
5
|
-
<main>${M}</main>
|
|
6
|
-
${Q.slice(_)}`;return`${q.slice(0,K)}${R}${q.slice(V)}`}function Xq(q){return q.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}function Iq(q){return q}
|
|
7
|
-
export{Aq as Xg,Iq as Yg};
|
package/dist/chunk-07y6m5xx.js
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
function z(c,j="_method"){let k=c.toUpperCase();if(k==="GET"||k==="POST")return"";return`<input type="hidden" name="${j}" value="${k}">`}function B(c){return c.replace(/@method\(\s*(['"])([^'"]+)\1\s*(?:,\s*(['"])([^'"]+)\3\s*)?\)/g,(j,k,v,A,x)=>{return z(v,x||"_method")})}function C(c,j="_method"){if(c&&typeof c[j]==="string")return c[j].toUpperCase();return null}
|
|
3
|
-
export{z as fu,B as gu,C as hu};
|
package/dist/chunk-095s3972.js
DELETED
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
function F(b,j){let k=[],h=[];for(let q of j)if(q.required&&!(q.name in b))k.push({prop:q.name,message:`Required prop "${q.name}" is missing`,expected:q.type});for(let[q,A]of Object.entries(b)){let x=j.find((D)=>D.name===q);if(!x){h.push({prop:q,message:`Unknown prop "${q}" - not defined in component`});continue}let B=C(A,x.type,x.options);if(B)k.push({prop:q,message:B,expected:x.type,actual:typeof A})}return{valid:k.length===0,errors:k,warnings:h}}function C(b,j,k){if(b===null||b===void 0){if(j.includes("null")||j.includes("undefined")||j.includes("?"))return null;return`Expected ${j}, got ${b===null?"null":"undefined"}`}let h=typeof b,q=j.toLowerCase().trim();if(q.includes("|")){let A=q.split("|").map((x)=>x.trim());for(let x of A)if(C(b,x,k)===null)return null;return`Expected one of ${A.join(" | ")}, got ${h}`}if(k&&k.length>0){if(!k.includes(String(b)))return`Expected one of [${k.join(", ")}], got "${b}"`;return null}switch(q){case"string":if(h!=="string")return`Expected string, got ${h}`;break;case"number":if(h!=="number"||Number.isNaN(b))return`Expected number, got ${h}`;break;case"boolean":if(h!=="boolean")return`Expected boolean, got ${h}`;break;case"array":case"any[]":case"array<any>":if(!Array.isArray(b))return`Expected array, got ${h}`;break;case"object":case"record<string, any>":if(h!=="object"||Array.isArray(b))return`Expected object, got ${h}`;break;case"function":if(h!=="function")return`Expected function, got ${h}`;break;case"any":break;default:if(q.startsWith("array<")||q.endsWith("[]")){if(!Array.isArray(b))return`Expected array, got ${h}`}}return null}function H(b){return`
|
|
3
|
-
window.__stxValidateProps = function(props) {
|
|
4
|
-
const definitions = ${JSON.stringify(b)};
|
|
5
|
-
const errors = [];
|
|
6
|
-
const warnings = [];
|
|
7
|
-
|
|
8
|
-
// Check required props
|
|
9
|
-
for (const def of definitions) {
|
|
10
|
-
if (def.required && !(def.name in props)) {
|
|
11
|
-
errors.push({
|
|
12
|
-
prop: def.name,
|
|
13
|
-
message: 'Required prop "' + def.name + '" is missing',
|
|
14
|
-
expected: def.type
|
|
15
|
-
});
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
// Validate provided props
|
|
20
|
-
for (const [name, value] of Object.entries(props)) {
|
|
21
|
-
const def = definitions.find(d => d.name === name);
|
|
22
|
-
|
|
23
|
-
if (!def) {
|
|
24
|
-
warnings.push({
|
|
25
|
-
prop: name,
|
|
26
|
-
message: 'Unknown prop "' + name + '"'
|
|
27
|
-
});
|
|
28
|
-
continue;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
// Basic type validation
|
|
32
|
-
const actualType = typeof value;
|
|
33
|
-
const expectedType = def.type.toLowerCase();
|
|
34
|
-
|
|
35
|
-
if (expectedType === 'string' && actualType !== 'string') {
|
|
36
|
-
errors.push({ prop: name, message: 'Expected string, got ' + actualType });
|
|
37
|
-
}
|
|
38
|
-
else if (expectedType === 'number' && actualType !== 'number') {
|
|
39
|
-
errors.push({ prop: name, message: 'Expected number, got ' + actualType });
|
|
40
|
-
}
|
|
41
|
-
else if (expectedType === 'boolean' && actualType !== 'boolean') {
|
|
42
|
-
errors.push({ prop: name, message: 'Expected boolean, got ' + actualType });
|
|
43
|
-
}
|
|
44
|
-
else if (expectedType === 'array' && !Array.isArray(value)) {
|
|
45
|
-
errors.push({ prop: name, message: 'Expected array, got ' + actualType });
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
// Check options
|
|
49
|
-
if (def.options && def.options.length > 0) {
|
|
50
|
-
if (!def.options.includes(String(value))) {
|
|
51
|
-
errors.push({
|
|
52
|
-
prop: name,
|
|
53
|
-
message: 'Expected one of [' + def.options.join(', ') + '], got "' + value + '"'
|
|
54
|
-
});
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
return { valid: errors.length === 0, errors, warnings };
|
|
60
|
-
};
|
|
61
|
-
`}function J(b){let j=[];if(b.valid)j.push("\u2713 All props are valid");else{j.push("\u2717 Validation failed:");for(let k of b.errors)j.push(` \u2022 ${k.prop}: ${k.message}`)}if(b.warnings.length>0){j.push(""),j.push("Warnings:");for(let k of b.warnings)j.push(` \u26A0 ${k.prop}: ${k.message}`)}return j.join(`
|
|
62
|
-
`)}function K(b){if(b.valid&&b.warnings.length===0)return"";let j=b.errors.map((h)=>`
|
|
63
|
-
<div class="validation-error">
|
|
64
|
-
<strong>${h.prop}:</strong> ${h.message}
|
|
65
|
-
</div>
|
|
66
|
-
`).join(""),k=b.warnings.map((h)=>`
|
|
67
|
-
<div class="validation-warning">
|
|
68
|
-
<strong>${h.prop}:</strong> ${h.message}
|
|
69
|
-
</div>
|
|
70
|
-
`).join("");return`
|
|
71
|
-
<div class="stx-validation-panel ${b.valid?"warnings-only":"has-errors"}">
|
|
72
|
-
${j}
|
|
73
|
-
${k}
|
|
74
|
-
</div>
|
|
75
|
-
`}function L(){return`
|
|
76
|
-
.stx-validation-panel {
|
|
77
|
-
padding: 12px;
|
|
78
|
-
margin: 8px 0;
|
|
79
|
-
border-radius: 4px;
|
|
80
|
-
font-size: 13px;
|
|
81
|
-
}
|
|
82
|
-
.stx-validation-panel.has-errors {
|
|
83
|
-
background: #fee2e2;
|
|
84
|
-
border: 1px solid #ef4444;
|
|
85
|
-
}
|
|
86
|
-
.stx-validation-panel.warnings-only {
|
|
87
|
-
background: #fef3c7;
|
|
88
|
-
border: 1px solid #f59e0b;
|
|
89
|
-
}
|
|
90
|
-
.validation-error {
|
|
91
|
-
color: #dc2626;
|
|
92
|
-
margin-bottom: 4px;
|
|
93
|
-
}
|
|
94
|
-
.validation-warning {
|
|
95
|
-
color: #d97706;
|
|
96
|
-
margin-bottom: 4px;
|
|
97
|
-
}
|
|
98
|
-
`}
|
|
99
|
-
export{F as la,H as ma,J as na,K as oa,L as pa};
|
package/dist/chunk-09k66d8a.js
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import W from"process";function X(){if(typeof globalThis<"u"&&"caches"in globalThis&&"CF"in globalThis)return{platform:"cloudflare",supportsStreaming:!0,supportsCrypto:!0,supportsKV:!0,supportsCache:!0,capabilities:["kv","r2","d1","durable-objects","queues"]};if(typeof globalThis<"u"&&"Deno"in globalThis)return{platform:"deno",version:globalThis.Deno.version?.deno,supportsStreaming:!0,supportsCrypto:!0,supportsKV:!0,supportsCache:!0,capabilities:["kv","deploy","ffi"]};if(typeof globalThis<"u"&&"Bun"in globalThis)return{platform:"bun",version:globalThis.Bun.version,supportsStreaming:!0,supportsCrypto:!0,supportsKV:!1,supportsCache:!1,capabilities:["sqlite","ffi","native-modules"]};if(typeof globalThis<"u"&&"EdgeRuntime"in globalThis)return{platform:"vercel",supportsStreaming:!0,supportsCrypto:!0,supportsKV:!0,supportsCache:!0,capabilities:["edge-config","blob"]};if(typeof globalThis<"u"&&"Netlify"in globalThis)return{platform:"netlify",supportsStreaming:!0,supportsCrypto:!0,supportsKV:!0,supportsCache:!1,capabilities:["blobs","edge-functions"]};if(typeof globalThis<"u"&&"fastly"in globalThis)return{platform:"fastly",supportsStreaming:!0,supportsCrypto:!0,supportsKV:!0,supportsCache:!0,capabilities:["dictionary","backend","geolocation"]};if(W.versions?.node)return{platform:"node",version:W.versions.node,supportsStreaming:!0,supportsCrypto:!0,supportsKV:!1,supportsCache:!1,capabilities:["fs","child-process","native-modules"]};return{platform:"unknown",supportsStreaming:!1,supportsCrypto:!1,supportsKV:!1,supportsCache:!1,capabilities:[]}}function K(){let j=X();return["cloudflare","deno","vercel","netlify","fastly"].includes(j.platform)}function V(){return X().platform!=="unknown"}function $(j){return{get(z){if(j&&z in j){let b=j[z];return typeof b==="string"?b:void 0}if(typeof globalThis<"u"&&"Deno"in globalThis)return globalThis.Deno.env.get(z);if(W.env)return W.env[z];return},getOrThrow(z){let b=this.get(z);if(b===void 0)throw Error(`Environment variable "${z}" is not set`);return b},has(z){return this.get(z)!==void 0},all(){let z={};if(j){for(let[b,B]of Object.entries(j))if(typeof B==="string")z[b]=B}if(typeof globalThis<"u"&&"Deno"in globalThis){let b=globalThis.Deno.env.toObject();Object.assign(z,b)}if(W.env){for(let[b,B]of Object.entries(W.env))if(B!==void 0)z[b]=B}return z}}}function D(j){let z=X();if(z.platform==="cloudflare"&&j)return j;if(z.platform==="deno"&&"Deno"in globalThis)return G();if(z.platform==="node"||z.platform==="bun")return N();return}function G(){let j=null,z=async()=>{if(!j)j=await globalThis.Deno.openKv();return j};return{async get(b){return(await(await z()).get(["stx",b])).value},async getWithMetadata(b){let B=await z(),F=await B.get(["stx",b]),J=await B.get(["stx-meta",b]);return{value:F.value,metadata:J.value}},async put(b,B,F){let J=await z(),L=F?.expirationTtl?F.expirationTtl*1000:void 0;if(await J.set(["stx",b],B,L?{expireIn:L}:void 0),F?.metadata)await J.set(["stx-meta",b],F.metadata,L?{expireIn:L}:void 0)},async delete(b){let B=await z();await B.delete(["stx",b]),await B.delete(["stx-meta",b])},async list(b){let B=await z(),F=b?.prefix?["stx",b.prefix]:["stx"],J=B.list({prefix:F,limit:b?.limit||100}),L=[];for await(let O of J){let S=O.key.slice(1).join("/");if(!S.startsWith("stx-meta/"))L.push({name:S})}return{keys:L,list_complete:!0}}}}function N(){let j=new Map,z=()=>{let b=Date.now();for(let[B,F]of j.entries())if(F.expiration&&F.expiration<b)j.delete(B)};return{async get(b){z();let B=j.get(b);if(!B)return null;if(B.expiration&&B.expiration<Date.now())return j.delete(b),null;return B.value},async getWithMetadata(b){z();let B=j.get(b);if(!B)return{value:null,metadata:null};if(B.expiration&&B.expiration<Date.now())return j.delete(b),{value:null,metadata:null};return{value:B.value,metadata:B.metadata||null}},async put(b,B,F){let J=F?.expiration?F.expiration*1000:F?.expirationTtl?Date.now()+F.expirationTtl*1000:void 0;j.set(b,{value:B,metadata:F?.metadata,expiration:J})},async delete(b){j.delete(b)},async list(b){z();let B=[];for(let[F,J]of j.entries()){if(b?.prefix&&!F.startsWith(b.prefix))continue;if(B.push({name:F,expiration:J.expiration,metadata:J.metadata}),b?.limit&&B.length>=b.limit)break}return{keys:B,list_complete:!0}}}}function T(){let j=X();if(j.platform==="cloudflare"&&"caches"in globalThis)return M();if(j.supportsStreaming)return A();return}function M(){return{async match(j){return(await caches.default).match(j)},async put(j,z){await(await caches.default).put(j,z.clone())},async delete(j){return(await caches.default).delete(j)}}}function A(){let j=new Map,z=60000;return{async match(b){let B=b.url,F=j.get(B);if(!F)return;if(Date.now()>F.expiration){j.delete(B);return}return F.response.clone()},async put(b,B){let F=b.url,J=B.headers.get("Cache-Control"),L=60000;if(J){let O=J.match(/max-age=(\d+)/);if(O)L=Number.parseInt(O[1],10)*1000}j.set(F,{response:B.clone(),expiration:Date.now()+L})},async delete(b){return j.delete(b.url)}}}function w(){return`${Date.now().toString(36)}-${Math.random().toString(36).slice(2,9)}`}function P(j,z){if(z.platform==="cloudflare"){let b=j.cf;if(b)return{city:b.city,country:b.country,countryCode:b.country,region:b.region,latitude:b.latitude?Number.parseFloat(b.latitude):void 0,longitude:b.longitude?Number.parseFloat(b.longitude):void 0,timezone:b.timezone}}if(z.platform==="vercel"){let b={},B=j.headers.get("x-vercel-ip-city"),F=j.headers.get("x-vercel-ip-country"),J=j.headers.get("x-vercel-ip-country-region"),L=j.headers.get("x-vercel-ip-latitude"),O=j.headers.get("x-vercel-ip-longitude");if(B)b.city=decodeURIComponent(B);if(F)b.countryCode=F;if(J)b.region=J;if(L)b.latitude=Number.parseFloat(L);if(O)b.longitude=Number.parseFloat(O);return Object.keys(b).length>0?b:void 0}if(z.platform==="netlify"){let b={},B=j.headers.get("x-nf-geo-city"),F=j.headers.get("x-nf-geo-country");if(B)b.city=B;if(F)b.countryCode=F;return Object.keys(b).length>0?b:void 0}return}function Z(j,z,b){let B=new Headers(j.headers);if(z.origins==="*")B.set("Access-Control-Allow-Origin","*");else if(z.origins&&b&&z.origins.includes(b))B.set("Access-Control-Allow-Origin",b),B.set("Vary","Origin");if(z.methods)B.set("Access-Control-Allow-Methods",z.methods.join(", "));if(z.headers)B.set("Access-Control-Allow-Headers",z.headers.join(", "));if(z.exposeHeaders)B.set("Access-Control-Expose-Headers",z.exposeHeaders.join(", "));if(z.credentials)B.set("Access-Control-Allow-Credentials","true");if(z.maxAge)B.set("Access-Control-Max-Age",String(z.maxAge));return new Response(j.body,{status:j.status,statusText:j.statusText,headers:B})}function Y(j){let z=X();return async(b,B)=>{let F=performance.now(),J=w(),L={runtime:z,platform:B||{},requestId:J,geo:P(b,z),timing:{start:F,getElapsed:()=>performance.now()-F},kv:D(B?.KV),cache:T(),env:$(B?.env)};try{if(b.method==="OPTIONS"&&j.cors){let Q=new Response(null,{status:204});return Q=Z(Q,j.cors,b.headers.get("Origin")||void 0),Q}if(j.cache?.enabled&&b.method==="GET"&&L.cache){if(_(b,j.cache)){let S=await L.cache.match(b);if(S){let U=new Response(S.body,S);return U.headers.set("X-Cache","HIT"),U.headers.set("X-Request-Id",J),j.cors?Z(U,j.cors,b.headers.get("Origin")||void 0):U}}}let O;if(j.middleware&&j.middleware.length>0)O=await H(b,L,j.middleware,async()=>{let Q=await j.render(b,L);return typeof Q==="string"?new Response(Q,{headers:{"Content-Type":"text/html; charset=utf-8"}}):Q});else{let Q=await j.render(b,L);O=typeof Q==="string"?new Response(Q,{headers:{"Content-Type":"text/html; charset=utf-8"}}):Q}if(O.headers.set("X-Request-Id",J),O.headers.set("X-Response-Time",`${L.timing.getElapsed().toFixed(2)}ms`),j.cache?.enabled&&b.method==="GET"&&L.cache){if(_(b,j.cache)&&O.status===200){let S=j.cache.ttl||60,U=O.clone();U.headers.set("Cache-Control",`public, max-age=${S}`),await L.cache.put(b,U),O.headers.set("X-Cache","MISS")}}if(j.cors)O=Z(O,j.cors,b.headers.get("Origin")||void 0);return O}catch(O){let Q=O instanceof Error?O:Error(String(O));if(j.onError)return j.onError(Q,b);return new Response(`Internal Server Error: ${Q.message}`,{status:500,headers:{"Content-Type":"text/plain","X-Request-Id":J}})}}}function _(j,z){let B=new URL(j.url).pathname;if(z.excludePaths){for(let F of z.excludePaths)if(F.test(B))return!1}if(z.includePaths){for(let F of z.includePaths)if(F.test(B))return!0;return!1}return!0}async function H(j,z,b,B){let F=0,J=async()=>{if(F>=b.length)return B();let L=b[F];return F++,L(j,z,J)};return J()}function C(j,z){let b=new Headers(z?.headers);return b.set("Content-Type","text/html; charset=utf-8"),b.set("Transfer-Encoding","chunked"),new Response(j,{...z,headers:b})}function I(){let j=new TextEncoder;return new TransformStream({transform(z,b){b.enqueue(j.encode(z))}})}function E(j){let z=new TextEncoder;return new ReadableStream({async start(b){for await(let B of j)b.enqueue(z.encode(B));b.close()}})}function x(j){let z=Y(j);return{async fetch(b,B,F){return z(b,{env:B,ctx:F,KV:B.KV})}}}function v(j){let z=Y(j);return(b)=>z(b,{})}function h(j){let z=Y(j);return(b)=>z(b,{})}function m(j){let z=Y(j);return(b,B)=>{return z(b,{netlifyContext:B})}}function y(j){let z=j.headers.get("Cookie");if(!z)return{};let b={};for(let B of z.split(";")){let[F,J]=B.split("=").map((L)=>L.trim());if(F&&J)b[F]=decodeURIComponent(J)}return b}function k(j,z,b){let B=`${encodeURIComponent(j)}=${encodeURIComponent(z)}`;if(b?.maxAge!==void 0)B+=`; Max-Age=${b.maxAge}`;if(b?.expires)B+=`; Expires=${b.expires.toUTCString()}`;if(b?.path)B+=`; Path=${b.path}`;if(b?.domain)B+=`; Domain=${b.domain}`;if(b?.secure)B+="; Secure";if(b?.httpOnly)B+="; HttpOnly";if(b?.sameSite)B+=`; SameSite=${b.sameSite}`;return B}function q(j,z){let b=new Headers(z?.headers);return b.set("Content-Type","application/json; charset=utf-8"),new Response(JSON.stringify(j),{...z,headers:b})}function d(j,z=302){return new Response(null,{status:z,headers:{Location:j}})}function l(j="Not Found"){return new Response(j,{status:404,headers:{"Content-Type":"text/plain"}})}
|
|
3
|
-
export{X as sn,K as tn,V as un,$ as vn,D as wn,T as xn,Y as yn,C as zn,I as An,E as Bn,x as Cn,v as Dn,h as En,m as Fn,y as Gn,k as Hn,q as In,d as Jn,l as Kn};
|
package/dist/chunk-0a61y94n.js
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{Ks as X,xr as W}from"./chunk-1xz0w746.js";import V from"fs";import M from"path";import*as Y from"readline";var j={reset:"\x1B[0m",bold:"\x1B[1m",dim:"\x1B[2m",red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",cyan:"\x1B[36m"},Q={help:{description:"Show available commands",usage:"help [command]",handler:async(q,z)=>{if(q[0]&&Q[q[0]]){let A=Q[q[0]];console.log(`
|
|
3
|
-
${j.bold}${q[0]}${j.reset} - ${A.description}`),console.log(` Usage: ${j.cyan}${A.usage}${j.reset}
|
|
4
|
-
`)}else{console.log(`
|
|
5
|
-
${j.bold}Available Commands:${j.reset}
|
|
6
|
-
`);for(let[A,B]of Object.entries(Q))console.log(` ${j.cyan}${A.padEnd(12)}${j.reset} ${B.description}`);console.log(`
|
|
7
|
-
${j.dim}Type 'help <command>' for more details${j.reset}
|
|
8
|
-
`)}}},render:{description:"Render a template file",usage:"render <file> [--raw]",handler:async(q,z)=>{if(!q[0]){console.log(`${j.red}Error: Please specify a file to render${j.reset}`);return}let A=M.resolve(z.cwd,q[0]);if(!await Bun.file(A).exists()){console.log(`${j.red}Error: File not found: ${A}${j.reset}`);return}try{let B=await Bun.file(A).text(),G=q.includes("--raw");console.log(`
|
|
9
|
-
${j.dim}Rendering ${A}...${j.reset}
|
|
10
|
-
`);let I=await X(B,z.context,A,{},new Set);if(z.lastResult=I,G)console.log(I);else I.split(`
|
|
11
|
-
`).forEach((L,J)=>{let O=String(J+1).padStart(3," ");console.log(`${j.dim}${O}${j.reset} ${L}`)});console.log()}catch(B){console.log(`${j.red}Error rendering template:${j.reset}`,B)}}},eval:{description:"Evaluate an expression",usage:"eval <expression>",handler:async(q,z)=>{if(!q.length){console.log(`${j.red}Error: Please provide an expression to evaluate${j.reset}`);return}let A=q.join(" ");try{let B=`{{ ${A} }}`,I=(await W(B,z.context,"eval")).trim();z.lastResult=I,console.log(`${j.green}\u2192${j.reset} ${I}`)}catch(B){console.log(`${j.red}Error:${j.reset}`,B)}}},set:{description:"Set a context variable",usage:"set <key> <value>",handler:async(q,z)=>{if(q.length<2){console.log(`${j.red}Error: Usage: set <key> <value>${j.reset}`);return}let A=q[0],B=q.slice(1).join(" "),G;try{G=JSON.parse(B)}catch{G=B}z.context[A]=G,console.log(`${j.green}\u2713${j.reset} ${A} = ${JSON.stringify(G)}`)}},unset:{description:"Remove a context variable",usage:"unset <key>",handler:async(q,z)=>{if(!q[0]){console.log(`${j.red}Error: Please specify a variable to remove${j.reset}`);return}if(q[0]in z.context)delete z.context[q[0]],console.log(`${j.green}\u2713${j.reset} Removed ${q[0]}`);else console.log(`${j.yellow}Variable not found: ${q[0]}${j.reset}`)}},context:{description:"Show current context variables",usage:"context",handler:async(q,z)=>{let A=Object.keys(z.context);if(A.length===0){console.log(`${j.dim}Context is empty${j.reset}`);return}console.log(`
|
|
12
|
-
${j.bold}Context Variables:${j.reset}
|
|
13
|
-
`);for(let B of A){let G=z.context[B],I=Array.isArray(G)?"array":typeof G,K=JSON.stringify(G).slice(0,50);console.log(` ${j.cyan}${B}${j.reset} ${j.dim}(${I})${j.reset}: ${K}${K.length>=50?"...":""}`)}console.log()}},clear:{description:"Clear context or screen",usage:"clear [context|screen]",handler:async(q,z)=>{if(q[0]==="context"||!q[0])z.context={},console.log(`${j.green}\u2713${j.reset} Context cleared`);if(q[0]==="screen"||!q[0])console.clear()}},cd:{description:"Change working directory",usage:"cd <directory>",handler:async(q,z)=>{if(!q[0]){console.log(`${j.cyan}${z.cwd}${j.reset}`);return}let A=M.resolve(z.cwd,q[0]);if(!V.existsSync(A)){console.log(`${j.red}Error: Directory not found: ${A}${j.reset}`);return}if(!V.statSync(A).isDirectory()){console.log(`${j.red}Error: Not a directory: ${A}${j.reset}`);return}z.cwd=A,console.log(`${j.green}\u2713${j.reset} ${A}`)}},ls:{description:"List files in current directory",usage:"ls [pattern]",handler:async(q,z)=>{let A=q[0]||"*",B=new Bun.Glob(A),G=[];for await(let J of B.scan({cwd:z.cwd,onlyFiles:!1}))G.push(J);if(G.length===0){console.log(`${j.dim}No files found${j.reset}`);return}G.sort();let I=G.filter((J)=>J.endsWith(".stx")),K=G.filter((J)=>J.endsWith(".md")),L=G.filter((J)=>!J.endsWith(".stx")&&!J.endsWith(".md"));if(I.length>0)console.log(`
|
|
14
|
-
${j.bold}Templates:${j.reset}`),I.forEach((J)=>console.log(` ${j.green}${J}${j.reset}`));if(K.length>0)console.log(`
|
|
15
|
-
${j.bold}Markdown:${j.reset}`),K.forEach((J)=>console.log(` ${j.blue}${J}${j.reset}`));if(L.length>0)console.log(`
|
|
16
|
-
${j.bold}Other:${j.reset}`),L.forEach((J)=>console.log(` ${j.dim}${J}${j.reset}`));console.log()}},cat:{description:"Show file contents",usage:"cat <file>",handler:async(q,z)=>{if(!q[0]){console.log(`${j.red}Error: Please specify a file${j.reset}`);return}let A=M.resolve(z.cwd,q[0]);if(!await Bun.file(A).exists()){console.log(`${j.red}Error: File not found: ${A}${j.reset}`);return}let G=(await Bun.file(A).text()).split(`
|
|
17
|
-
`);console.log(),G.forEach((I,K)=>{let L=String(K+1).padStart(3," ");console.log(`${j.dim}${L}${j.reset} ${I}`)}),console.log()}},load:{description:"Load context from JSON file",usage:"load <file.json>",handler:async(q,z)=>{if(!q[0]){console.log(`${j.red}Error: Please specify a JSON file${j.reset}`);return}let A=M.resolve(z.cwd,q[0]);if(!await Bun.file(A).exists()){console.log(`${j.red}Error: File not found: ${A}${j.reset}`);return}try{let B=await Bun.file(A).text(),G=JSON.parse(B);z.context={...z.context,...G},console.log(`${j.green}\u2713${j.reset} Loaded ${Object.keys(G).length} variables from ${q[0]}`)}catch(B){console.log(`${j.red}Error parsing JSON:${j.reset}`,B)}}},save:{description:"Save context to JSON file",usage:"save <file.json>",handler:async(q,z)=>{if(!q[0]){console.log(`${j.red}Error: Please specify a file name${j.reset}`);return}let A=M.resolve(z.cwd,q[0]);try{await Bun.write(A,JSON.stringify(z.context,null,2)),console.log(`${j.green}\u2713${j.reset} Context saved to ${q[0]}`)}catch(B){console.log(`${j.red}Error saving file:${j.reset}`,B)}}},history:{description:"Show command history",usage:"history [count]",handler:async(q,z)=>{let A=q[0]?Number.parseInt(q[0],10):20,B=z.history.slice(-A);if(B.length===0){console.log(`${j.dim}No history${j.reset}`);return}console.log(),B.forEach((G,I)=>{let K=String(z.history.length-B.length+I+1).padStart(3," ");console.log(`${j.dim}${K}${j.reset} ${G}`)}),console.log()}},exit:{description:"Exit interactive mode",usage:"exit",handler:async(q,z)=>{z.running=!1,console.log(`
|
|
18
|
-
${j.dim}Goodbye!${j.reset}
|
|
19
|
-
`)}},quit:{description:"Exit interactive mode (alias for exit)",usage:"quit",handler:async(q,z)=>Q.exit.handler(q,z)}};function Z(q,z){let A=q.split(" "),B=A[0];if(A.length===1)return Object.keys(Q).filter((G)=>G.startsWith(B));if(["render","cat","load","cd"].includes(B)){let G=A.slice(1).join(" "),I=M.dirname(G)||".",K=M.basename(G),L=M.resolve(z.cwd,I);if(V.existsSync(L)&&V.statSync(L).isDirectory())try{return V.readdirSync(L).filter((O)=>O.startsWith(K)).map((O)=>`${B} ${I==="."?"":`${I}/`}${O}`)}catch{return[]}}if(["unset","eval","set"].includes(B)){let G=A[1]||"";return Object.keys(z.context).filter((I)=>I.startsWith(G)).map((I)=>`${B} ${I}`)}return[]}async function R(q={}){let z={context:q.context||{},cwd:q.cwd||process.cwd(),history:[],running:!0,lastResult:null},A=Y.createInterface({input:process.stdin,output:process.stdout,completer:(G)=>{return[Z(G,z),G]},historySize:q.maxHistory||100});console.log(`
|
|
20
|
-
${j.bold}${j.blue}stx Interactive Mode${j.reset}
|
|
21
|
-
${j.dim}Type 'help' for available commands, 'exit' to quit${j.reset}
|
|
22
|
-
`);let B=()=>{let G=z.cwd.replace(process.env.HOME||"","~");A.question(`${j.cyan}stx${j.reset} ${j.dim}${G}${j.reset} ${j.green}>${j.reset} `,async(I)=>{let K=I.trim();if(!K){if(z.running)B();return}z.history.push(K);let L=K.match(/(?:[^\s"]|"[^"]*")+/g)||[],J=L[0]?.toLowerCase(),O=L.slice(1).map((U)=>U.replace(/^"|"$/g,""));if(J&&Q[J])try{await Q[J].handler(O,z)}catch(U){console.log(`${j.red}Error:${j.reset}`,U)}else if(J)if(K.includes("{{")||K.includes("}}"))try{let U=await W(K,z.context,"eval");console.log(`${j.green}\u2192${j.reset} ${U}`)}catch{console.log(`${j.red}Unknown command: ${J}${j.reset}`),console.log(`${j.dim}Type 'help' for available commands${j.reset}`)}else console.log(`${j.red}Unknown command: ${J}${j.reset}`),console.log(`${j.dim}Type 'help' for available commands${j.reset}`);if(z.running)B();else A.close()})};A.on("SIGINT",()=>{console.log(`
|
|
23
|
-
${j.dim}(Use 'exit' to quit)${j.reset}`),B()}),B()}
|
|
24
|
-
export{R as Dl};
|
package/dist/chunk-0b9w2w1y.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
// @bun
|
package/dist/chunk-0dx4q6yq.js
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
var h={reset:"\x1B[0m",bright:"\x1B[1m",dim:"\x1B[2m",underscore:"\x1B[4m",blink:"\x1B[5m",reverse:"\x1B[7m",hidden:"\x1B[8m",black:"\x1B[30m",red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",cyan:"\x1B[36m",white:"\x1B[37m",gray:"\x1B[90m",bgBlack:"\x1B[40m",bgRed:"\x1B[41m",bgGreen:"\x1B[42m",bgYellow:"\x1B[43m",bgBlue:"\x1B[44m",bgMagenta:"\x1B[45m",bgCyan:"\x1B[46m",bgWhite:"\x1B[47m",bgGray:"\x1B[100m"};function f(b,j){return`${h[j]}${b}${h.reset}`}function k(b){return f(b,"green")}function n(b){return f(b,"yellow")}function p(b){return f(b,"red")}function q(b){return f(b,"cyan")}function v(b){return f(b,"gray")}
|
|
3
|
-
export{h as Sw,f as Tw,k as Uw,n as Vw,p as Ww,q as Xw,v as Yw};
|
package/dist/chunk-0dz85jrp.js
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import M from"fs";import Q from"path";var T=1,W=".stx/story/search-index.json";function U(A){return Q.join(A,W)}async function Y(A){let J=U(A.root);try{let G=await M.promises.readFile(J,"utf-8"),z=JSON.parse(G);if(z.version!==T)return null;return z}catch{return null}}async function Z(A,J){let G=U(A.root),z=Q.dirname(G);await M.promises.mkdir(z,{recursive:!0});let B={version:T,created:Date.now(),updated:Date.now(),entries:J};await M.promises.writeFile(G,JSON.stringify(B,null,2))}function $(A,J){let G=[];for(let z of A){let B=J.get(z.fileName),j=[z.fileName.toLowerCase(),z.relativePath.toLowerCase()],H=[],K=[];if(B){if(B.description)j.push(B.description.toLowerCase());for(let C of B.props)if(H.push(C.name),j.push(C.name.toLowerCase()),C.description)j.push(C.description.toLowerCase());for(let C of B.slots)K.push(`slot:${C.name}`);for(let C of B.directives||[])K.push(`directive:${C.name}`);for(let C of B.dependencies)K.push(`uses:${C}`)}G.push({id:z.id,name:z.fileName,path:z.relativePath,searchText:j.join(" "),props:H,tags:K,mtime:Date.now()})}return G}async function w(A,J){for(let G of J.entries)try{let z=Q.join(A.root,G.path);if((await M.promises.stat(z)).mtimeMs>G.mtime)return!0}catch{return!0}return!1}function q(A,J){let z=J.toLowerCase().split(/\s+/).filter(Boolean);if(z.length===0)return A.entries;return A.entries.map((j)=>{let H=0;for(let K of z)if(j.name.toLowerCase()===K)H+=100;else if(j.name.toLowerCase().startsWith(K))H+=50;else if(j.name.toLowerCase().includes(K))H+=25;else if(j.props.some((C)=>C.toLowerCase().includes(K)))H+=15;else if(j.tags.some((C)=>C.toLowerCase().includes(K)))H+=10;else if(j.searchText.includes(K))H+=5;return{entry:j,score:H}}).filter((j)=>j.score>0).sort((j,H)=>H.score-j.score).map((j)=>j.entry)}async function O(A,J,G,z=!1){if(!z){let j=await Y(A);if(j&&!await w(A,j))return j.entries}let B=$(J,G);return Z(A,B).catch(()=>{}),B}
|
|
3
|
-
export{Y as H,Z as I,$ as J,w as K,q as L,O as M};
|
package/dist/chunk-0jd0pndq.js
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
var E=[];function Q(D){E=[];for(let z of D.storyFiles)if(E.push({text:z.fileName.toLowerCase(),original:z.fileName,type:"story",storyId:z.id}),E.push({text:z.relativePath.toLowerCase(),original:z.relativePath,type:"story",storyId:z.id}),z.story)for(let A of z.story.variants)E.push({text:A.title.toLowerCase(),original:A.title,type:"story",storyId:z.id,variantId:A.id})}function R(D){for(let z of D){let A=z.name.toLowerCase().replace(/[^a-z0-9]+/g,"-");if(E.push({text:z.name.toLowerCase(),original:z.name,type:"component",storyId:A}),z.description)E.push({text:z.description.toLowerCase(),original:z.description,type:"component",storyId:A});for(let B of z.props)if(E.push({text:B.name.toLowerCase(),original:B.name,type:"prop",storyId:A,meta:{propType:B.type}}),B.description)E.push({text:B.description.toLowerCase(),original:B.description,type:"prop",storyId:A,meta:{propName:B.name}});for(let B of z.slots)E.push({text:B.name.toLowerCase(),original:B.name,type:"slot",storyId:A});if(z.tags)for(let B of z.tags)E.push({text:B.toLowerCase(),original:B,type:"component",storyId:A,meta:{tag:!0}})}}function T(D,z=20){if(!D||D.length<2)return[];let A=D.toLowerCase(),B=[],H=new Set;for(let C of E){let F=C.text.indexOf(A);if(F===-1)continue;let G=100;if(C.text===A)G+=50;if(F===0)G+=30;if(F===0||C.text[F-1]===" "||C.text[F-1]==="-")G+=20;if(C.type==="story")G+=10;if(C.type==="component")G+=5;G-=C.text.length*0.5;let K=`${C.storyId}-${C.variantId||""}-${C.type}`;if(H.has(K))continue;H.add(K),B.push({type:C.type,title:C.original,storyId:C.storyId,variantId:C.variantId,score:G,match:P(C.original,D)})}return B.sort((C,F)=>F.score-C.score),B.slice(0,z)}function P(D,z){let A=D.toLowerCase().indexOf(z.toLowerCase());if(A===-1)return D;let B=D.slice(0,A),H=D.slice(A,A+z.length),C=D.slice(A+z.length);return`${B}<mark>${H}</mark>${C}`}function U(){return[]}function V(){E=[]}function W(){return E.length}function X(){return JSON.stringify(E)}function Y(D){try{E=JSON.parse(D)}catch{E=[]}}
|
|
3
|
-
export{Q as Bb,R as Cb,T as Db,U as Eb,V as Fb,W as Gb,X as Hb,Y as Ib};
|
package/dist/chunk-0p0nyq50.js
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{pB as D}from"./chunk-xv34zbp4.js";var q=null;async function E(){if(q!==null)return q;try{let j=await import("stx-router");if(typeof j.getRouterScript==="function")q=j.getRouterScript();else q=""}catch{q=""}return q}async function G(j,B){let z=await E();if(!z)return j;let C={interceptAllLinks:!0,container:"main",...B},A=`${`<script>window.__stxRouterConfig=${JSON.stringify(C)};</script>
|
|
3
|
-
`}<script>${z}</script>`;if(/<\/body>/i.test(j))return j.replace(/<\/body>/i,`${A}
|
|
4
|
-
</body>`);return`${j}
|
|
5
|
-
${A}`}
|
|
6
|
-
export{G as gh};
|
package/dist/chunk-0p1h3p3w.js
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
function z(q,x){if(typeof window>"u")return x;return window[q]??x}function B(q,x){if(typeof window>"u")return;window[q]=x}function F(q){let A=z("__STX_STORES__",{})[q];if(!A)throw Error(`Store "${q}" not found. Make sure it's defined with defineStore().`);return A}function Q(q){return F(q)}function U(q){let x=z("__STX_STORES__",{});return q in x}function W(){let q=z("__STX_STORES__",{});return Object.keys(q)}function X(q,x=5000){return new Promise((A,H)=>{let I=Date.now(),D=()=>{let E=F(q);if(E)A(E);else if(Date.now()-I>x)H(Error(`Timeout waiting for store "${q}"`));else requestAnimationFrame(D)};D()})}function J(){return z("__STX_ROUTE_PARAMS__",{})}function K(q){return J()[q]}function Y(q){let x=K(q);if(x===void 0)throw Error(`Route parameter "${q}" not found`);return x}function L(){return z("__STX_MIDDLEWARE_STATE__",{})}function Z(q){return L()[q]}function _(){if(typeof window>"u")return;if(!z("__STX_STORES__",null))B("__STX_STORES__",{})}function $(q,x){let A=z("__STX_STORES__",{});A[q]=x,B("__STX_STORES__",A)}function w(){return z("__STX_STORE_STATE__",null)}function C(q){B("__STX_ROUTE_PARAMS__",q)}function M(q){B("__STX_MIDDLEWARE_STATE__",q)}function N(){return typeof window>"u"}function O(){return typeof window<"u"}function T(q){if(O())q()}function h(q){if(N())q()}
|
|
3
|
-
export{F as Dh,Q as Eh,U as Fh,W as Gh,X as Hh,J as Ih,K as Jh,Y as Kh,L as Lh,Z as Mh,_ as Nh,$ as Oh,w as Ph,C as Qh,M as Rh,N as Sh,O as Th,T as Uh,h as Vh};
|
package/dist/chunk-0qakwen3.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
// @bun
|
package/dist/chunk-0qnz93q2.js
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{me as A}from"./chunk-ngxfwzq3.js";import E from"path";async function K(j){let k=j.root??process.cwd(),q;try{let z=await import(E.join(k,"stx.config.ts"));q=(z.default||z).story}catch{}let B={...q,...j.config},D=A(B);return{root:k,config:D,storyFiles:[],tree:void 0,mode:j.mode}}function L(j,k){j.storyFiles=k}function N(j,k){j.tree=k}
|
|
3
|
-
export{K as fe,L as ge,N as he};
|
package/dist/chunk-10debkj5.js
DELETED
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
var R={method:"POST",fieldName:"file",timeout:60000,withCredentials:!1};function U(q,J={}){if(J.maxSize&&q.size>J.maxSize)return{valid:!1,error:`File size (${E(q.size)}) exceeds maximum (${E(J.maxSize)})`,code:"FILE_TOO_LARGE"};if(J.accept&&J.accept.length>0){if(!J.accept.some((H)=>{if(H.endsWith("/*")){let K=H.slice(0,-1);return q.type.startsWith(K)}return q.type===H}))return{valid:!1,error:`File type "${q.type}" is not allowed`,code:"INVALID_TYPE"}}return{valid:!0}}function E(q){if(q<1024)return`${q} B`;if(q<1048576)return`${(q/1024).toFixed(1)} KB`;return`${(q/1048576).toFixed(2)} MB`}async function _(q,J,Q){let H={...R,...J},K=U(q,H);if(!K.valid)return{success:!1,error:K.error,name:q.name,size:q.size,type:q.type};if(H.chunkSize&&q.size>H.chunkSize)return F(q,H,Q);return O(q,H,Q)}async function O(q,J,Q){return new Promise((H)=>{let K=new XMLHttpRequest,Y=Date.now(),V=0,W=Y;K.upload.addEventListener("progress",(M)=>{if(M.lengthComputable&&Q){let $=Date.now(),Z=($-W)/1000,B=M.loaded-V,A=Z>0?B/Z:0,G=M.total-M.loaded,N=A>0?G/A*1000:void 0;V=M.loaded,W=$,Q({file:q,loaded:M.loaded,total:M.total,percent:Math.round(M.loaded/M.total*100),speed:A,timeRemaining:N})}}),K.addEventListener("load",()=>{if(K.status>=200&&K.status<300)try{let M=JSON.parse(K.responseText);H({success:!0,url:M.url,id:M.id,name:q.name,size:q.size,type:q.type,data:M})}catch{H({success:!0,name:q.name,size:q.size,type:q.type})}else H({success:!1,error:`Upload failed with status ${K.status}`,name:q.name,size:q.size,type:q.type})}),K.addEventListener("error",()=>{H({success:!1,error:"Network error during upload",name:q.name,size:q.size,type:q.type})}),K.addEventListener("timeout",()=>{H({success:!1,error:"Upload timed out",name:q.name,size:q.size,type:q.type})});let X=new FormData;if(X.append(J.fieldName||"file",q),J.formData)for(let[M,$]of Object.entries(J.formData))X.append(M,$);if(K.open(J.method||"POST",J.endpoint),K.timeout=J.timeout||60000,K.withCredentials=J.withCredentials||!1,J.headers)for(let[M,$]of Object.entries(J.headers))K.setRequestHeader(M,$);K.send(X)})}async function F(q,J,Q){let H=J.chunkSize,K=Math.ceil(q.size/H),Y=0,V;for(let W=0;W<K;W++){let X=W*H,M=Math.min(X+H,q.size),$=q.slice(X,M),Z=new FormData;if(Z.append(J.fieldName||"file",$,q.name),Z.append("chunk",String(W)),Z.append("totalChunks",String(K)),Z.append("fileName",q.name),Z.append("fileSize",String(q.size)),Z.append("fileType",q.type),V)Z.append("uploadId",V);if(J.formData)for(let[B,A]of Object.entries(J.formData))Z.append(B,A);try{let B=await fetch(J.endpoint,{method:J.method||"POST",headers:J.headers,credentials:J.withCredentials?"include":"same-origin",body:Z});if(!B.ok)return{success:!1,error:`Chunk ${W+1}/${K} failed with status ${B.status}`,name:q.name,size:q.size,type:q.type};let A=await B.json();if(!V&&A.uploadId)V=A.uploadId;if(Y=M,Q)Q({file:q,loaded:Y,total:q.size,percent:Math.round(Y/q.size*100),chunk:W+1,totalChunks:K});if(W===K-1)return{success:!0,url:A.url,id:A.id||V,name:q.name,size:q.size,type:q.type,data:A}}catch(B){return{success:!1,error:`Chunk upload failed: ${B}`,name:q.name,size:q.size,type:q.type}}}return{success:!1,error:"Unknown error during chunked upload",name:q.name,size:q.size,type:q.type}}async function L(q,J,Q,H){let K=[];for(let Y of q){let V=await _(Y,J,(W)=>{if(Q)Q(Y,W)});if(K.push(V),H)H(Y,V)}return K}function T(q,J=200){return new Promise((Q,H)=>{if(!q.type.startsWith("image/")){H(Error("File is not an image"));return}let K=new FileReader;K.onload=(Y)=>{let V=new Image;V.onload=()=>{let W=document.createElement("canvas"),X=V.width,M=V.height;if(X>J||M>J)if(X>M)M=Math.round(M*J/X),X=J;else X=Math.round(X*J/M),M=J;W.width=X,W.height=M;let $=W.getContext("2d");if($)$.drawImage(V,0,0,X,M),Q(W.toDataURL("image/jpeg",0.7));else H(Error("Could not get canvas context"))},V.onerror=()=>H(Error("Could not load image")),V.src=Y.target?.result},K.onerror=()=>H(Error("Could not read file")),K.readAsDataURL(q)})}function I(q){return new Promise((J,Q)=>{if(!q.type.startsWith("video/")){Q(Error("File is not a video"));return}let H=document.createElement("video"),K=document.createElement("canvas");H.preload="metadata",H.muted=!0,H.playsInline=!0,H.onloadeddata=()=>{H.currentTime=0.1},H.onseeked=()=>{K.width=H.videoWidth,K.height=H.videoHeight;let Y=K.getContext("2d");if(Y)Y.drawImage(H,0,0),J(K.toDataURL("image/jpeg",0.7));else Q(Error("Could not get canvas context"));URL.revokeObjectURL(H.src)},H.onerror=()=>{URL.revokeObjectURL(H.src),Q(Error("Could not load video"))},H.src=URL.createObjectURL(q)})}function w(){return`
|
|
3
|
-
(function() {
|
|
4
|
-
'use strict';
|
|
5
|
-
|
|
6
|
-
if (typeof window === 'undefined') return;
|
|
7
|
-
|
|
8
|
-
window.STX = window.STX || {};
|
|
9
|
-
|
|
10
|
-
window.STX.uploadFile = function(file, options, onProgress) {
|
|
11
|
-
return new Promise(function(resolve) {
|
|
12
|
-
var xhr = new XMLHttpRequest();
|
|
13
|
-
|
|
14
|
-
xhr.upload.addEventListener('progress', function(e) {
|
|
15
|
-
if (e.lengthComputable && onProgress) {
|
|
16
|
-
onProgress({
|
|
17
|
-
file: file,
|
|
18
|
-
loaded: e.loaded,
|
|
19
|
-
total: e.total,
|
|
20
|
-
percent: Math.round((e.loaded / e.total) * 100)
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
xhr.addEventListener('load', function() {
|
|
26
|
-
if (xhr.status >= 200 && xhr.status < 300) {
|
|
27
|
-
try {
|
|
28
|
-
var data = JSON.parse(xhr.responseText);
|
|
29
|
-
resolve({ success: true, url: data.url, id: data.id, data: data });
|
|
30
|
-
}
|
|
31
|
-
catch (e) {
|
|
32
|
-
resolve({ success: true });
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
else {
|
|
36
|
-
resolve({ success: false, error: 'Upload failed: ' + xhr.status });
|
|
37
|
-
}
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
xhr.addEventListener('error', function() {
|
|
41
|
-
resolve({ success: false, error: 'Network error' });
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
var formData = new FormData();
|
|
45
|
-
formData.append(options.fieldName || 'file', file);
|
|
46
|
-
|
|
47
|
-
xhr.open(options.method || 'POST', options.endpoint);
|
|
48
|
-
if (options.headers) {
|
|
49
|
-
for (var key in options.headers) {
|
|
50
|
-
xhr.setRequestHeader(key, options.headers[key]);
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
xhr.send(formData);
|
|
54
|
-
});
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
window.STX.validateFile = function(file, options) {
|
|
58
|
-
if (options.maxSize && file.size > options.maxSize) {
|
|
59
|
-
return { valid: false, error: 'File too large' };
|
|
60
|
-
}
|
|
61
|
-
if (options.accept && options.accept.length) {
|
|
62
|
-
var valid = options.accept.some(function(type) {
|
|
63
|
-
return type.endsWith('/*') ? file.type.startsWith(type.slice(0, -1)) : file.type === type;
|
|
64
|
-
});
|
|
65
|
-
if (!valid) return { valid: false, error: 'Invalid file type' };
|
|
66
|
-
}
|
|
67
|
-
return { valid: true };
|
|
68
|
-
};
|
|
69
|
-
})();
|
|
70
|
-
`.trim()}
|
|
71
|
-
export{U as xl,_ as yl,L as zl,T as Al,I as Bl,w as Cl};
|