@ohos-ports/stacksjs-stx 0.2.287-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +21 -0
- package/README.md +1042 -0
- package/dist/a11y.d.ts +256 -0
- package/dist/a11y.js +671 -0
- package/dist/analytics.d.ts +40 -0
- package/dist/analytics.js +159 -0
- package/dist/analyzer.d.ts +68 -0
- package/dist/analyzer.js +240 -0
- package/dist/animation.d.ts +123 -0
- package/dist/animation.js +688 -0
- package/dist/app-shell.d.ts +76 -0
- package/dist/app-shell.js +209 -0
- package/dist/app.d.ts +65 -0
- package/dist/app.js +79 -0
- package/dist/appearance-bootstrap.d.ts +54 -0
- package/dist/appearance-bootstrap.js +92 -0
- package/dist/asset-roots.d.ts +32 -0
- package/dist/asset-roots.js +7 -0
- package/dist/assets.d.ts +21 -0
- package/dist/assets.js +155 -0
- package/dist/ast.d.ts +265 -0
- package/dist/ast.js +630 -0
- package/dist/async-components.d.ts +123 -0
- package/dist/async-components.js +428 -0
- package/dist/auth.d.ts +13 -0
- package/dist/auth.js +12 -0
- package/dist/broadcasting.d.ts +77 -0
- package/dist/broadcasting.js +103 -0
- package/dist/browser-composables.d.ts +348 -0
- package/dist/browser-composables.js +606 -0
- package/dist/browser-core-imports.d.ts +12 -0
- package/dist/browser-core-imports.js +28 -0
- package/dist/build-assets.d.ts +32 -0
- package/dist/build-assets.js +29 -0
- package/dist/build-externalize-repeated.d.ts +34 -0
- package/dist/build-externalize-repeated.js +101 -0
- package/dist/build-externalize.d.ts +73 -0
- package/dist/build-externalize.js +80 -0
- package/dist/build-id.d.ts +57 -0
- package/dist/build-id.js +25 -0
- package/dist/build-message.d.ts +81 -0
- package/dist/build-message.js +65 -0
- package/dist/build-mode-detector.d.ts +26 -0
- package/dist/build-mode-detector.js +50 -0
- package/dist/build-optimizer.d.ts +101 -0
- package/dist/build-optimizer.js +433 -0
- package/dist/build-views.d.ts +56 -0
- package/dist/build-views.js +180 -0
- package/dist/build.d.ts +31 -0
- package/dist/build.js +34 -0
- package/dist/builtins/attrs.d.ts +49 -0
- package/dist/builtins/attrs.js +39 -0
- package/dist/builtins/drawer.d.ts +24 -0
- package/dist/builtins/drawer.js +37 -0
- package/dist/builtins/escape.d.ts +12 -0
- package/dist/builtins/escape.js +3 -0
- package/dist/builtins/icon.d.ts +45 -0
- package/dist/builtins/icon.js +100 -0
- package/dist/builtins/image-delivery.d.ts +16 -0
- package/dist/builtins/image-delivery.js +115 -0
- package/dist/builtins/image-placeholder.d.ts +78 -0
- package/dist/builtins/image-placeholder.js +137 -0
- package/dist/builtins/index.d.ts +26 -0
- package/dist/builtins/index.js +34 -0
- package/dist/builtins/modal.d.ts +26 -0
- package/dist/builtins/modal.js +38 -0
- package/dist/builtins/safe-image.d.ts +44 -0
- package/dist/builtins/safe-image.js +45 -0
- package/dist/builtins/stx-image.d.ts +29 -0
- package/dist/builtins/stx-image.js +222 -0
- package/dist/builtins/stx-link.d.ts +11 -0
- package/dist/builtins/stx-link.js +35 -0
- package/dist/builtins/stx-loading-indicator.d.ts +13 -0
- package/dist/builtins/stx-loading-indicator.js +35 -0
- package/dist/builtins/suspense.d.ts +30 -0
- package/dist/builtins/suspense.js +24 -0
- package/dist/builtins/toast.d.ts +19 -0
- package/dist/builtins/toast.js +42 -0
- package/dist/builtins/tooltip.d.ts +18 -0
- package/dist/builtins/tooltip.js +106 -0
- package/dist/builtins/transition-group.d.ts +27 -0
- package/dist/builtins/transition-group.js +22 -0
- package/dist/bun-shim.js +496 -0
- package/dist/bundle-analyzer/collector.d.ts +66 -0
- package/dist/bundle-analyzer/collector.js +233 -0
- package/dist/bundle-analyzer/index.d.ts +98 -0
- package/dist/bundle-analyzer/index.js +82 -0
- package/dist/bundle-analyzer/report.d.ts +39 -0
- package/dist/bundle-analyzer/report.js +318 -0
- package/dist/bundle-analyzer/treemap.d.ts +19 -0
- package/dist/bundle-analyzer/treemap.js +594 -0
- package/dist/bundle-analyzer.js +499 -0
- package/dist/caching.d.ts +69 -0
- package/dist/caching.js +135 -0
- package/dist/chunk-0y46fbkx.js +3 -0
- package/dist/chunk-122tyfre.js +2 -0
- package/dist/chunk-19nfvxfw.js +43 -0
- package/dist/chunk-1kah92n2.js +3 -0
- package/dist/chunk-1kms3b9d.js +2 -0
- package/dist/chunk-1q4y74mh.js +1194 -0
- package/dist/chunk-248e84r1.js +4 -0
- package/dist/chunk-24ps8kft.js +2 -0
- package/dist/chunk-2et5hxfv.js +2 -0
- package/dist/chunk-2r1rd8f0.js +2 -0
- package/dist/chunk-2tk1zkrz.js +2 -0
- package/dist/chunk-38ejahd9.js +3 -0
- package/dist/chunk-3zv4wz87.js +2 -0
- package/dist/chunk-4122k1bh.js +2 -0
- package/dist/chunk-45az9zht.js +2 -0
- package/dist/chunk-4qr85f07.js +2 -0
- package/dist/chunk-4ww3znrr.js +15 -0
- package/dist/chunk-54st8g2j.js +397 -0
- package/dist/chunk-58f0mthg.js +3 -0
- package/dist/chunk-5a19dhx5.js +2 -0
- package/dist/chunk-5kk8gsj2.js +3 -0
- package/dist/chunk-5w1e3yxs.js +499 -0
- package/dist/chunk-6gdycmxr.js +2 -0
- package/dist/chunk-6hmnaza7.js +4473 -0
- package/dist/chunk-71t0yan0.js +5 -0
- package/dist/chunk-74cv4ta1.js +3 -0
- package/dist/chunk-74v15e8z.js +2 -0
- package/dist/chunk-7b329e5v.js +3 -0
- package/dist/chunk-7q9mwh4v.js +84 -0
- package/dist/chunk-866y9d8b.js +8169 -0
- package/dist/chunk-8fwerspy.js +2 -0
- package/dist/chunk-8mjdpr94.js +147 -0
- package/dist/chunk-92mj1t26.js +60 -0
- package/dist/chunk-9b22663r.js +2 -0
- package/dist/chunk-9hjdgm4d.js +2 -0
- package/dist/chunk-9n0gvfrg.js +4 -0
- package/dist/chunk-9wr7zcad.js +18 -0
- package/dist/chunk-9y0g8kzt.js +358 -0
- package/dist/chunk-a0nfbmeh.js +3 -0
- package/dist/chunk-acn1b56m.js +1280 -0
- package/dist/chunk-awkq3xfx.js +2 -0
- package/dist/chunk-b6ej2fdf.js +1814 -0
- package/dist/chunk-b8rrnqry.js +2 -0
- package/dist/chunk-bfqfs07m.js +3022 -0
- package/dist/chunk-bs6kapy7.js +2 -0
- package/dist/chunk-btav940g.js +2 -0
- package/dist/chunk-bz820epz.js +3 -0
- package/dist/chunk-ccspd3mc.js +2 -0
- package/dist/chunk-csbgwaa5.js +2 -0
- package/dist/chunk-d8t4sjsp.js +2 -0
- package/dist/chunk-dap191q2.js +2 -0
- package/dist/chunk-de7fye10.js +4 -0
- package/dist/chunk-dgrt76d2.js +2 -0
- package/dist/chunk-dhh5q7qt.js +3 -0
- package/dist/chunk-dsffsqnt.js +2 -0
- package/dist/chunk-dtq7y5ym.js +2 -0
- package/dist/chunk-fed3xsp9.js +3 -0
- package/dist/chunk-ferav3bw.js +19 -0
- package/dist/chunk-fvhm8psm.js +3 -0
- package/dist/chunk-g4vpzv6b.js +2 -0
- package/dist/chunk-g9csmj0s.js +2 -0
- package/dist/chunk-gtcrpmz1.js +2 -0
- package/dist/chunk-h4xh8cms.js +4 -0
- package/dist/chunk-h8yqsz9m.js +2 -0
- package/dist/chunk-hcq5dw7a.js +2 -0
- package/dist/chunk-hm0xha6c.js +12 -0
- package/dist/chunk-hpybjwwf.js +8 -0
- package/dist/chunk-jegt35zh.js +2 -0
- package/dist/chunk-jr3jp3ev.js +8 -0
- package/dist/chunk-k56rjjc0.js +24 -0
- package/dist/chunk-kdh37tp8.js +194 -0
- package/dist/chunk-kxzb4et3.js +29 -0
- package/dist/chunk-mf4n3x1j.js +14 -0
- package/dist/chunk-mkd9kjgb.js +3 -0
- package/dist/chunk-mxfh1nxg.js +2 -0
- package/dist/chunk-n3ggrhb3.js +3 -0
- package/dist/chunk-nkb3scg6.js +8 -0
- package/dist/chunk-nnd4wq8j.js +231 -0
- package/dist/chunk-nsp1cw38.js +11 -0
- package/dist/chunk-nx5qkm8k.js +30 -0
- package/dist/chunk-p3242nck.js +2 -0
- package/dist/chunk-p98kfh94.js +2 -0
- package/dist/chunk-pkaabd8h.js +3 -0
- package/dist/chunk-pzm13sdc.js +3 -0
- package/dist/chunk-q4p5k2p3.js +2 -0
- package/dist/chunk-q9n5swx7.js +3 -0
- package/dist/chunk-qc1f74ek.js +3 -0
- package/dist/chunk-qpyjak7z.js +2 -0
- package/dist/chunk-qr82je1m.js +22 -0
- package/dist/chunk-qy73j6m4.js +288 -0
- package/dist/chunk-qzkhpsam.js +505 -0
- package/dist/chunk-r3ayvdz3.js +2 -0
- package/dist/chunk-r7r66978.js +2 -0
- package/dist/chunk-rbb7dvja.js +30 -0
- package/dist/chunk-refwkt87.js +71 -0
- package/dist/chunk-rj4kajww.js +2 -0
- package/dist/chunk-rp4rjjmf.js +2 -0
- package/dist/chunk-se0p17c2.js +898 -0
- package/dist/chunk-sj9pmene.js +2 -0
- package/dist/chunk-sscwkffs.js +2 -0
- package/dist/chunk-svpqxn2c.js +2 -0
- package/dist/chunk-t6nseeb9.js +351 -0
- package/dist/chunk-t8y1ggdy.js +2 -0
- package/dist/chunk-tndhnk9e.js +2 -0
- package/dist/chunk-v5e1gxwm.js +3 -0
- package/dist/chunk-vqxmxgaj.js +4 -0
- package/dist/chunk-vrrax298.js +2 -0
- package/dist/chunk-w3ycm4na.js +3 -0
- package/dist/chunk-wcm80anz.js +321 -0
- package/dist/chunk-wrzwgkbx.js +22 -0
- package/dist/chunk-x650vjcp.js +302 -0
- package/dist/chunk-xgnc1wy6.js +116 -0
- package/dist/chunk-xpp135ad.js +11 -0
- package/dist/chunk-xttsqmkm.js +216 -0
- package/dist/chunk-y11cxbxd.js +3757 -0
- package/dist/chunk-y7m2dpd3.js +341 -0
- package/dist/chunk-y98jsjqq.js +2 -0
- package/dist/chunk-ya386h70.js +2 -0
- package/dist/chunk-ydrz60kr.js +2 -0
- package/dist/chunk-ypmqf7tm.js +4 -0
- package/dist/chunk-z4jhj5e5.js +28 -0
- package/dist/chunk-zg75gjns.js +2 -0
- package/dist/chunk-zqqx1qaj.js +2 -0
- package/dist/cli-flags.d.ts +34 -0
- package/dist/cli-flags.js +20 -0
- package/dist/cli.js +174 -0
- package/dist/client/directive.d.ts +17 -0
- package/dist/client/directive.js +14 -0
- package/dist/client/index.d.ts +7 -0
- package/dist/client/index.js +2 -0
- package/dist/client-helpers.d.ts +317 -0
- package/dist/client-helpers.js +312 -0
- package/dist/client-script-bundler.d.ts +103 -0
- package/dist/client-script-bundler.js +390 -0
- package/dist/client-script.d.ts +215 -0
- package/dist/client-script.js +865 -0
- package/dist/client.d.ts +21 -0
- package/dist/client.js +73 -0
- package/dist/codemod.d.ts +33 -0
- package/dist/codemod.js +244 -0
- package/dist/color-mode-boot.d.ts +92 -0
- package/dist/color-mode-boot.js +72 -0
- package/dist/component-client-factories.d.ts +33 -0
- package/dist/component-client-factories.js +77 -0
- package/dist/component-hmr.d.ts +107 -0
- package/dist/component-hmr.js +585 -0
- package/dist/component-library.d.ts +38 -0
- package/dist/component-library.js +994 -0
- package/dist/component-processing.d.ts +198 -0
- package/dist/component-processing.js +677 -0
- package/dist/component-registry.d.ts +127 -0
- package/dist/component-registry.js +90 -0
- package/dist/component-renderer.d.ts +52 -0
- package/dist/component-renderer.js +790 -0
- package/dist/components/StxImage.stx +12 -0
- package/dist/components/StxLink.stx +18 -0
- package/dist/components.d.ts +28 -0
- package/dist/components.js +213 -0
- package/dist/composable-loader.d.ts +62 -0
- package/dist/composable-loader.js +190 -0
- package/dist/composables/index.d.ts +417 -0
- package/dist/composables/index.js +222 -0
- package/dist/composables/use-battery.d.ts +46 -0
- package/dist/composables/use-battery.js +101 -0
- package/dist/composables/use-broadcast-channel.d.ts +59 -0
- package/dist/composables/use-broadcast-channel.js +80 -0
- package/dist/composables/use-channel.d.ts +67 -0
- package/dist/composables/use-channel.js +124 -0
- package/dist/composables/use-clipboard.d.ts +30 -0
- package/dist/composables/use-clipboard.js +90 -0
- package/dist/composables/use-color-mode.d.ts +67 -0
- package/dist/composables/use-color-mode.js +152 -0
- package/dist/composables/use-cookie.d.ts +59 -0
- package/dist/composables/use-cookie.js +86 -0
- package/dist/composables/use-device-orientation.d.ts +116 -0
- package/dist/composables/use-device-orientation.js +181 -0
- package/dist/composables/use-event-listener.d.ts +35 -0
- package/dist/composables/use-event-listener.js +27 -0
- package/dist/composables/use-event-source.d.ts +90 -0
- package/dist/composables/use-event-source.js +166 -0
- package/dist/composables/use-eye-dropper.d.ts +117 -0
- package/dist/composables/use-eye-dropper.js +142 -0
- package/dist/composables/use-fetch.d.ts +59 -0
- package/dist/composables/use-fetch.js +273 -0
- package/dist/composables/use-form.d.ts +91 -0
- package/dist/composables/use-form.js +112 -0
- package/dist/composables/use-fullscreen.d.ts +47 -0
- package/dist/composables/use-fullscreen.js +110 -0
- package/dist/composables/use-geolocation.d.ts +62 -0
- package/dist/composables/use-geolocation.js +101 -0
- package/dist/composables/use-idle.d.ts +102 -0
- package/dist/composables/use-idle.js +182 -0
- package/dist/composables/use-intersection-observer.d.ts +83 -0
- package/dist/composables/use-intersection-observer.js +168 -0
- package/dist/composables/use-keyboard.d.ts +100 -0
- package/dist/composables/use-keyboard.js +224 -0
- package/dist/composables/use-media-query.d.ts +56 -0
- package/dist/composables/use-media-query.js +62 -0
- package/dist/composables/use-meta.d.ts +35 -0
- package/dist/composables/use-meta.js +48 -0
- package/dist/composables/use-mouse.d.ts +65 -0
- package/dist/composables/use-mouse.js +286 -0
- package/dist/composables/use-mutation-observer.d.ts +101 -0
- package/dist/composables/use-mutation-observer.js +129 -0
- package/dist/composables/use-network.d.ts +40 -0
- package/dist/composables/use-network.js +85 -0
- package/dist/composables/use-notification.d.ts +98 -0
- package/dist/composables/use-notification.js +94 -0
- package/dist/composables/use-permissions.d.ts +119 -0
- package/dist/composables/use-permissions.js +132 -0
- package/dist/composables/use-query.d.ts +48 -0
- package/dist/composables/use-query.js +0 -0
- package/dist/composables/use-resize-observer.d.ts +60 -0
- package/dist/composables/use-resize-observer.js +157 -0
- package/dist/composables/use-router.d.ts +80 -0
- package/dist/composables/use-router.js +105 -0
- package/dist/composables/use-scroll-lock.d.ts +13 -0
- package/dist/composables/use-scroll-lock.js +55 -0
- package/dist/composables/use-share.d.ts +74 -0
- package/dist/composables/use-share.js +104 -0
- package/dist/composables/use-speech.d.ts +117 -0
- package/dist/composables/use-speech.js +294 -0
- package/dist/composables/use-storage.d.ts +69 -0
- package/dist/composables/use-storage.js +196 -0
- package/dist/composables/use-text-selection.d.ts +121 -0
- package/dist/composables/use-text-selection.js +205 -0
- package/dist/composables/use-timer.d.ts +92 -0
- package/dist/composables/use-timer.js +193 -0
- package/dist/composables/use-utilities.d.ts +103 -0
- package/dist/composables/use-utilities.js +176 -0
- package/dist/composables/use-wake-lock.d.ts +85 -0
- package/dist/composables/use-wake-lock.js +122 -0
- package/dist/composables/use-websocket.d.ts +70 -0
- package/dist/composables/use-websocket.js +165 -0
- package/dist/composables/use-window.d.ts +84 -0
- package/dist/composables/use-window.js +163 -0
- package/dist/composables.d.ts +287 -0
- package/dist/composables.js +562 -0
- package/dist/composition-api.d.ts +197 -0
- package/dist/composition-api.js +199 -0
- package/dist/compression.d.ts +30 -0
- package/dist/compression.js +107 -0
- package/dist/computed.d.ts +138 -0
- package/dist/computed.js +382 -0
- package/dist/conditionals.d.ts +48 -0
- package/dist/conditionals.js +626 -0
- package/dist/config.d.ts +77 -0
- package/dist/config.js +828 -0
- package/dist/cookie-serialize.d.ts +40 -0
- package/dist/cookie-serialize.js +18 -0
- package/dist/craft-bridge.d.ts +525 -0
- package/dist/craft-bridge.js +511 -0
- package/dist/craft-compiler.d.ts +245 -0
- package/dist/craft-compiler.js +810 -0
- package/dist/craft-components.d.ts +739 -0
- package/dist/craft-components.js +1074 -0
- package/dist/craft-entry.d.ts +6 -0
- package/dist/craft-entry.js +9 -0
- package/dist/craft-ssr.d.ts +147 -0
- package/dist/craft-ssr.js +559 -0
- package/dist/craft.js +9 -0
- package/dist/csp.d.ts +295 -0
- package/dist/csp.js +220 -0
- package/dist/csrf.d.ts +38 -0
- package/dist/csrf.js +38 -0
- package/dist/custom-directives.d.ts +5 -0
- package/dist/custom-directives.js +136 -0
- package/dist/database.d.ts +391 -0
- package/dist/database.js +5 -0
- package/dist/defer.d.ts +28 -0
- package/dist/defer.js +156 -0
- package/dist/deploy/config-generators.d.ts +75 -0
- package/dist/deploy/config-generators.js +214 -0
- package/dist/deploy/index.d.ts +88 -0
- package/dist/deploy/index.js +203 -0
- package/dist/deploy/netlify.d.ts +109 -0
- package/dist/deploy/netlify.js +167 -0
- package/dist/desktop.d.ts +16 -0
- package/dist/desktop.js +1 -0
- package/dist/dev-server/index.d.ts +22 -0
- package/dist/dev-server/index.js +7 -0
- package/dist/dev-server/keyboard-shortcuts.d.ts +34 -0
- package/dist/dev-server/keyboard-shortcuts.js +81 -0
- package/dist/dev-server/native-window.d.ts +59 -0
- package/dist/dev-server/native-window.js +91 -0
- package/dist/dev-server/port-utils.d.ts +27 -0
- package/dist/dev-server/port-utils.js +40 -0
- package/dist/dev-server/serve-app.d.ts +15 -0
- package/dist/dev-server/serve-app.js +727 -0
- package/dist/dev-server/serve-file.d.ts +3 -0
- package/dist/dev-server/serve-file.js +443 -0
- package/dist/dev-server/serve-markdown.d.ts +3 -0
- package/dist/dev-server/serve-markdown.js +284 -0
- package/dist/dev-server/serve-multi.d.ts +5 -0
- package/dist/dev-server/serve-multi.js +596 -0
- package/dist/dev-server/terminal-colors.d.ts +56 -0
- package/dist/dev-server/terminal-colors.js +45 -0
- package/dist/dev-server/theme-selector.d.ts +32 -0
- package/dist/dev-server/theme-selector.js +111 -0
- package/dist/dev-server/ts-css.d.ts +108 -0
- package/dist/dev-server/ts-css.js +438 -0
- package/dist/dev-server/types.d.ts +99 -0
- package/dist/dev-server/types.js +43 -0
- package/dist/dev-server.d.ts +6 -0
- package/dist/dev-server.js +4 -0
- package/dist/devtools.d.ts +182 -0
- package/dist/devtools.js +593 -0
- package/dist/directive-api.d.ts +154 -0
- package/dist/directive-api.js +355 -0
- package/dist/docs.d.ts +56 -0
- package/dist/docs.js +567 -0
- package/dist/doctor.d.ts +29 -0
- package/dist/doctor.js +123 -0
- package/dist/document-shell.d.ts +218 -0
- package/dist/document-shell.js +338 -0
- package/dist/dynamic-components.d.ts +23 -0
- package/dist/dynamic-components.js +197 -0
- package/dist/edge-runtime.d.ts +193 -0
- package/dist/edge-runtime.js +525 -0
- package/dist/env.d.ts +3 -0
- package/dist/env.js +9 -0
- package/dist/error-boundaries.d.ts +78 -0
- package/dist/error-boundaries.js +281 -0
- package/dist/error-handling.d.ts +14 -0
- package/dist/error-handling.js +1 -0
- package/dist/errors/codes.d.ts +92 -0
- package/dist/errors/codes.js +97 -0
- package/dist/errors/formatter.d.ts +84 -0
- package/dist/errors/formatter.js +196 -0
- package/dist/errors/index.d.ts +12 -0
- package/dist/errors/index.js +44 -0
- package/dist/errors/logger.d.ts +135 -0
- package/dist/errors/logger.js +250 -0
- package/dist/errors/sanitizer.d.ts +73 -0
- package/dist/errors/sanitizer.js +181 -0
- package/dist/errors/types.d.ts +92 -0
- package/dist/errors/types.js +86 -0
- package/dist/events.d.ts +145 -0
- package/dist/events.js +396 -0
- package/dist/expressions.d.ts +180 -0
- package/dist/expressions.js +719 -0
- package/dist/find-body-tag.d.ts +50 -0
- package/dist/find-body-tag.js +57 -0
- package/dist/formatter.d.ts +19 -0
- package/dist/formatter.js +265 -0
- package/dist/forms-validation.d.ts +189 -0
- package/dist/forms-validation.js +421 -0
- package/dist/forms.d.ts +224 -0
- package/dist/forms.js +729 -0
- package/dist/fragment-container.d.ts +57 -0
- package/dist/fragment-container.js +123 -0
- package/dist/framework-composables.d.ts +73 -0
- package/dist/framework-composables.js +126 -0
- package/dist/head-injection.d.ts +61 -0
- package/dist/head-injection.js +28 -0
- package/dist/head.d.ts +282 -0
- package/dist/head.js +231 -0
- package/dist/heatmap.d.ts +206 -0
- package/dist/heatmap.js +566 -0
- package/dist/hot-reload.d.ts +87 -0
- package/dist/hot-reload.js +373 -0
- package/dist/html-masking.d.ts +125 -0
- package/dist/html-masking.js +196 -0
- package/dist/hydration-runtime.d.ts +44 -0
- package/dist/hydration-runtime.js +195 -0
- package/dist/hydration.d.ts +135 -0
- package/dist/hydration.js +654 -0
- package/dist/i18n.d.ts +342 -0
- package/dist/i18n.js +678 -0
- package/dist/image-optimization/auto-sibling.d.ts +42 -0
- package/dist/image-optimization/auto-sibling.js +88 -0
- package/dist/image-optimization/build-plugin.d.ts +54 -0
- package/dist/image-optimization/build-plugin.js +241 -0
- package/dist/image-optimization/component.d.ts +46 -0
- package/dist/image-optimization/component.js +244 -0
- package/dist/image-optimization/directive.d.ts +30 -0
- package/dist/image-optimization/directive.js +203 -0
- package/dist/image-optimization/index.d.ts +156 -0
- package/dist/image-optimization/index.js +54 -0
- package/dist/image-optimization/processor.d.ts +140 -0
- package/dist/image-optimization/processor.js +262 -0
- package/dist/image-optimization/serve.d.ts +54 -0
- package/dist/image-optimization/serve.js +102 -0
- package/dist/import-rebase.d.ts +16 -0
- package/dist/import-rebase.js +16 -0
- package/dist/imported-signals.d.ts +43 -0
- package/dist/imported-signals.js +35 -0
- package/dist/includes.d.ts +171 -0
- package/dist/includes.js +764 -0
- package/dist/index.d.ts +365 -0
- package/dist/index.js +202 -0
- package/dist/init.d.ts +39 -0
- package/dist/init.js +505 -0
- package/dist/inline-assets.d.ts +28 -0
- package/dist/inline-assets.js +82 -0
- package/dist/interactive.d.ts +14 -0
- package/dist/interactive.js +383 -0
- package/dist/internal-markdown.d.ts +22 -0
- package/dist/internal-markdown.js +141 -0
- package/dist/island-chunking.d.ts +48 -0
- package/dist/island-chunking.js +52 -0
- package/dist/isolated-build.d.ts +12 -0
- package/dist/isolated-build.js +18 -0
- package/dist/js-ts.d.ts +10 -0
- package/dist/js-ts.js +60 -0
- package/dist/jsx-runtime.d.ts +92 -0
- package/dist/jsx-runtime.js +289 -0
- package/dist/keep-alive.d.ts +108 -0
- package/dist/keep-alive.js +421 -0
- package/dist/layout-types.d.ts +45 -0
- package/dist/layout-types.js +56 -0
- package/dist/lazy-loader.d.ts +90 -0
- package/dist/lazy-loader.js +245 -0
- package/dist/lazy-module.d.ts +11 -0
- package/dist/lazy-module.js +18 -0
- package/dist/loading-indicator.d.ts +50 -0
- package/dist/loading-indicator.js +322 -0
- package/dist/loops.d.ts +91 -0
- package/dist/loops.js +690 -0
- package/dist/manifest.d.ts +41 -0
- package/dist/manifest.js +31 -0
- package/dist/markdown-view.d.ts +25 -0
- package/dist/markdown-view.js +39 -0
- package/dist/markdown.d.ts +10 -0
- package/dist/markdown.js +68 -0
- package/dist/media/client/blur-up.d.ts +66 -0
- package/dist/media/client/blur-up.js +217 -0
- package/dist/media/client/index.d.ts +93 -0
- package/dist/media/client/index.js +53 -0
- package/dist/media/client/lazy-load.d.ts +74 -0
- package/dist/media/client/lazy-load.js +283 -0
- package/dist/media/client/upload-handler.d.ts +80 -0
- package/dist/media/client/upload-handler.js +354 -0
- package/dist/media/image/component.d.ts +60 -0
- package/dist/media/image/component.js +574 -0
- package/dist/media/image/directive.d.ts +23 -0
- package/dist/media/image/directive.js +160 -0
- package/dist/media/image/editing.d.ts +212 -0
- package/dist/media/image/editing.js +193 -0
- package/dist/media/image/index.d.ts +142 -0
- package/dist/media/image/index.js +80 -0
- package/dist/media/image/placeholder.d.ts +89 -0
- package/dist/media/image/placeholder.js +188 -0
- package/dist/media/image/processor/cache.d.ts +53 -0
- package/dist/media/image/processor/cache.js +51 -0
- package/dist/media/image/processor/index.d.ts +11 -0
- package/dist/media/image/processor/index.js +3 -0
- package/dist/media/image/processor/optimizer.d.ts +24 -0
- package/dist/media/image/processor/optimizer.js +202 -0
- package/dist/media/image/processor/responsive.d.ts +28 -0
- package/dist/media/image/processor/responsive.js +162 -0
- package/dist/media/image/srcset.d.ts +157 -0
- package/dist/media/image/srcset.js +194 -0
- package/dist/media/index.d.ts +331 -0
- package/dist/media/index.js +198 -0
- package/dist/media/manager/embed.d.ts +25 -0
- package/dist/media/manager/embed.js +253 -0
- package/dist/media/protected/component.d.ts +33 -0
- package/dist/media/protected/component.js +235 -0
- package/dist/media/protected/index.d.ts +47 -0
- package/dist/media/protected/index.js +20 -0
- package/dist/media/protected/signature.d.ts +72 -0
- package/dist/media/protected/signature.js +205 -0
- package/dist/media/shared/cache.d.ts +76 -0
- package/dist/media/shared/cache.js +132 -0
- package/dist/media/shared/hash.d.ts +31 -0
- package/dist/media/shared/hash.js +35 -0
- package/dist/media/shared/index.d.ts +7 -0
- package/dist/media/shared/index.js +2 -0
- package/dist/media/types.d.ts +1477 -0
- package/dist/media/types.js +0 -0
- package/dist/media/upload/component.d.ts +9 -0
- package/dist/media/upload/component.js +320 -0
- package/dist/media/upload/index.d.ts +8 -0
- package/dist/media/upload/index.js +1 -0
- package/dist/media/video/directive.d.ts +23 -0
- package/dist/media/video/directive.js +142 -0
- package/dist/media/video/index.d.ts +76 -0
- package/dist/media/video/index.js +583 -0
- package/dist/media/video/processor/cache.d.ts +55 -0
- package/dist/media/video/processor/cache.js +52 -0
- package/dist/media/video/processor/index.d.ts +12 -0
- package/dist/media/video/processor/index.js +4 -0
- package/dist/media/video/processor/streaming.d.ts +26 -0
- package/dist/media/video/processor/streaming.js +197 -0
- package/dist/media/video/processor/thumbnail.d.ts +35 -0
- package/dist/media/video/processor/thumbnail.js +134 -0
- package/dist/media/video/processor/transcoder.d.ts +19 -0
- package/dist/media/video/processor/transcoder.js +283 -0
- package/dist/menubar.d.ts +65 -0
- package/dist/menubar.js +99 -0
- package/dist/method-spoofing.d.ts +20 -0
- package/dist/method-spoofing.js +17 -0
- package/dist/middleware.d.ts +112 -0
- package/dist/middleware.js +40 -0
- package/dist/misc-directives.d.ts +55 -0
- package/dist/misc-directives.js +328 -0
- package/dist/native-build.d.ts +88 -0
- package/dist/native-build.js +575 -0
- package/dist/owned-routes.d.ts +42 -0
- package/dist/owned-routes.js +26 -0
- package/dist/page-action.d.ts +73 -0
- package/dist/page-action.js +91 -0
- package/dist/page-meta.d.ts +38 -0
- package/dist/page-meta.js +16 -0
- package/dist/page-response.d.ts +120 -0
- package/dist/page-response.js +117 -0
- package/dist/parser/directive-parser.d.ts +119 -0
- package/dist/parser/directive-parser.js +249 -0
- package/dist/parser/expression-parser.d.ts +58 -0
- package/dist/parser/expression-parser.js +358 -0
- package/dist/parser/index.d.ts +13 -0
- package/dist/parser/index.js +23 -0
- package/dist/parser/tokenizer.d.ts +77 -0
- package/dist/parser/tokenizer.js +534 -0
- package/dist/partial-hydration.d.ts +123 -0
- package/dist/partial-hydration.js +427 -0
- package/dist/performance-utils.d.ts +318 -0
- package/dist/performance-utils.js +466 -0
- package/dist/placeholder.d.ts +54 -0
- package/dist/placeholder.js +35 -0
- package/dist/plugin-system.d.ts +301 -0
- package/dist/plugin-system.js +214 -0
- package/dist/plugin.d.ts +3 -0
- package/dist/plugin.js +174 -0
- package/dist/precompiler.d.ts +43 -0
- package/dist/precompiler.js +670 -0
- package/dist/process.d.ts +16 -0
- package/dist/process.js +879 -0
- package/dist/production-build.d.ts +163 -0
- package/dist/production-build.js +596 -0
- package/dist/production-builder.d.ts +42 -0
- package/dist/production-builder.js +146 -0
- package/dist/production-server.d.ts +19 -0
- package/dist/production-server.js +208 -0
- package/dist/prop-sentinels.d.ts +31 -0
- package/dist/prop-sentinels.js +7 -0
- package/dist/props.d.ts +216 -0
- package/dist/props.js +224 -0
- package/dist/public-env.d.ts +29 -0
- package/dist/public-env.js +19 -0
- package/dist/pwa/audit.d.ts +42 -0
- package/dist/pwa/audit.js +255 -0
- package/dist/pwa/directives.d.ts +38 -0
- package/dist/pwa/directives.js +332 -0
- package/dist/pwa/icons.d.ts +42 -0
- package/dist/pwa/icons.js +109 -0
- package/dist/pwa/index.d.ts +104 -0
- package/dist/pwa/index.js +47 -0
- package/dist/pwa/inject.d.ts +32 -0
- package/dist/pwa/inject.js +102 -0
- package/dist/pwa/manifest.d.ts +104 -0
- package/dist/pwa/manifest.js +186 -0
- package/dist/pwa/offline.d.ts +8 -0
- package/dist/pwa/offline.js +259 -0
- package/dist/pwa/precache.d.ts +35 -0
- package/dist/pwa/precache.js +116 -0
- package/dist/pwa/service-worker.d.ts +33 -0
- package/dist/pwa/service-worker.js +860 -0
- package/dist/pwa/workbox-strategies.d.ts +100 -0
- package/dist/pwa/workbox-strategies.js +167 -0
- package/dist/pwa/workbox.d.ts +51 -0
- package/dist/pwa/workbox.js +382 -0
- package/dist/pwa.d.ts +52 -0
- package/dist/pwa.js +236 -0
- package/dist/reactive-bindings.d.ts +47 -0
- package/dist/reactive-bindings.js +268 -0
- package/dist/reactive-tracking.d.ts +81 -0
- package/dist/reactive-tracking.js +49 -0
- package/dist/reactive.d.ts +117 -0
- package/dist/reactive.js +593 -0
- package/dist/reactivity.d.ts +206 -0
- package/dist/reactivity.js +574 -0
- package/dist/release.d.ts +1 -0
- package/dist/release.js +1 -0
- package/dist/render-memo.d.ts +40 -0
- package/dist/render-memo.js +33 -0
- package/dist/render.d.ts +54 -0
- package/dist/render.js +153 -0
- package/dist/resolve-stx-targets.d.ts +49 -0
- package/dist/resolve-stx-targets.js +38 -0
- package/dist/route-middleware.d.ts +2 -0
- package/dist/route-middleware.js +17 -0
- package/dist/route-types.d.ts +134 -0
- package/dist/route-types.js +24 -0
- package/dist/router.d.ts +9 -0
- package/dist/router.js +9 -0
- package/dist/routes.d.ts +6 -0
- package/dist/routes.js +14 -0
- package/dist/runtime-globals.d.ts +236 -0
- package/dist/runtime-globals.js +230 -0
- package/dist/runtime-injection.d.ts +113 -0
- package/dist/runtime-injection.js +156 -0
- package/dist/runtime.d.ts +140 -0
- package/dist/runtime.js +94 -0
- package/dist/safe-evaluator.d.ts +165 -0
- package/dist/safe-evaluator.js +461 -0
- package/dist/scaffolding.d.ts +113 -0
- package/dist/scaffolding.js +897 -0
- package/dist/screenshot.d.ts +22 -0
- package/dist/screenshot.js +100 -0
- package/dist/script-classifier.d.ts +41 -0
- package/dist/script-classifier.js +51 -0
- package/dist/script-emit.d.ts +50 -0
- package/dist/script-emit.js +11 -0
- package/dist/script-json.d.ts +36 -0
- package/dist/script-json.js +6 -0
- package/dist/script-validation.d.ts +26 -0
- package/dist/script-validation.js +179 -0
- package/dist/seo.d.ts +225 -0
- package/dist/seo.js +486 -0
- package/dist/serve.d.ts +44 -0
- package/dist/serve.js +233 -0
- package/dist/server-bindings.d.ts +39 -0
- package/dist/server-bindings.js +171 -0
- package/dist/server-components.d.ts +138 -0
- package/dist/server-components.js +427 -0
- package/dist/sfc-template.d.ts +17 -0
- package/dist/sfc-template.js +32 -0
- package/dist/signal-processing.d.ts +222 -0
- package/dist/signal-processing.js +1081 -0
- package/dist/signals-api.d.ts +459 -0
- package/dist/signals-api.js +172 -0
- package/dist/signals.d.ts +41 -0
- package/dist/signals.js +8233 -0
- package/dist/site-builder/build.d.ts +18 -0
- package/dist/site-builder/build.js +252 -0
- package/dist/site-builder/i18n.d.ts +104 -0
- package/dist/site-builder/i18n.js +150 -0
- package/dist/site-builder/index.d.ts +27 -0
- package/dist/site-builder/index.js +16 -0
- package/dist/site-builder/robots.d.ts +2 -0
- package/dist/site-builder/robots.js +26 -0
- package/dist/site-builder/router.d.ts +10 -0
- package/dist/site-builder/router.js +27 -0
- package/dist/site-builder/seo.d.ts +8 -0
- package/dist/site-builder/seo.js +67 -0
- package/dist/site-builder/sitemap.d.ts +10 -0
- package/dist/site-builder/sitemap.js +26 -0
- package/dist/site-builder/theme.d.ts +12 -0
- package/dist/site-builder/theme.js +38 -0
- package/dist/site-builder/types.d.ts +74 -0
- package/dist/site-builder/types.js +0 -0
- package/dist/site-url.d.ts +46 -0
- package/dist/site-url.js +70 -0
- package/dist/slots.d.ts +129 -0
- package/dist/slots.js +286 -0
- package/dist/source-maps.d.ts +98 -0
- package/dist/source-maps.js +350 -0
- package/dist/source-signature.d.ts +45 -0
- package/dist/source-signature.js +20 -0
- package/dist/spa-nav.d.ts +49 -0
- package/dist/spa-nav.js +12 -0
- package/dist/spa-shell.d.ts +21 -0
- package/dist/spa-shell.js +34 -0
- package/dist/ssg.d.ts +357 -0
- package/dist/ssg.js +94 -0
- package/dist/ssr.d.ts +116 -0
- package/dist/ssr.js +339 -0
- package/dist/state-dir.d.ts +36 -0
- package/dist/state-dir.js +22 -0
- package/dist/state-management.d.ts +299 -0
- package/dist/state-management.js +519 -0
- package/dist/store-imports.d.ts +47 -0
- package/dist/store-imports.js +16 -0
- package/dist/store-loader.d.ts +15 -0
- package/dist/store-loader.js +111 -0
- package/dist/stores-client.d.ts +70 -0
- package/dist/stores-client.js +132 -0
- package/dist/story/addons.d.ts +123 -0
- package/dist/story/addons.js +261 -0
- package/dist/story/analytics.d.ts +163 -0
- package/dist/story/analytics.js +235 -0
- package/dist/story/auto-stories.d.ts +38 -0
- package/dist/story/auto-stories.js +158 -0
- package/dist/story/bookmarks.d.ts +102 -0
- package/dist/story/bookmarks.js +277 -0
- package/dist/story/bun-test.d.ts +45 -0
- package/dist/story/bun-test.js +102 -0
- package/dist/story/cli.d.ts +132 -0
- package/dist/story/cli.js +155 -0
- package/dist/story/collect/analyzer.d.ts +33 -0
- package/dist/story/collect/analyzer.js +305 -0
- package/dist/story/collect/index.d.ts +31 -0
- package/dist/story/collect/index.js +27 -0
- package/dist/story/collect/parser.d.ts +17 -0
- package/dist/story/collect/parser.js +129 -0
- package/dist/story/collect/scanner.d.ts +17 -0
- package/dist/story/collect/scanner.js +101 -0
- package/dist/story/collect/tree.d.ts +24 -0
- package/dist/story/collect/tree.js +110 -0
- package/dist/story/commands/build.d.ts +19 -0
- package/dist/story/commands/build.js +172 -0
- package/dist/story/commands/dev.d.ts +23 -0
- package/dist/story/commands/dev.js +78 -0
- package/dist/story/commands/index.d.ts +9 -0
- package/dist/story/commands/index.js +3 -0
- package/dist/story/commands/preview.d.ts +21 -0
- package/dist/story/commands/preview.js +56 -0
- package/dist/story/compiled-output.d.ts +27 -0
- package/dist/story/compiled-output.js +151 -0
- package/dist/story/composition.d.ts +47 -0
- package/dist/story/composition.js +261 -0
- package/dist/story/config-watcher.d.ts +33 -0
- package/dist/story/config-watcher.js +67 -0
- package/dist/story/config.d.ts +29 -0
- package/dist/story/config.js +64 -0
- package/dist/story/context.d.ts +27 -0
- package/dist/story/context.js +27 -0
- package/dist/story/controls/index.d.ts +54 -0
- package/dist/story/controls/index.js +320 -0
- package/dist/story/desktop-preview.d.ts +34 -0
- package/dist/story/desktop-preview.js +105 -0
- package/dist/story/docs-generator.d.ts +30 -0
- package/dist/story/docs-generator.js +187 -0
- package/dist/story/errors.d.ts +47 -0
- package/dist/story/errors.js +239 -0
- package/dist/story/figma-export.d.ts +169 -0
- package/dist/story/figma-export.js +224 -0
- package/dist/story/generator.d.ts +21 -0
- package/dist/story/generator.js +165 -0
- package/dist/story/hmr.d.ts +62 -0
- package/dist/story/hmr.js +131 -0
- package/dist/story/hot-swap.d.ts +46 -0
- package/dist/story/hot-swap.js +207 -0
- package/dist/story/index.d.ts +99 -0
- package/dist/story/index.js +49 -0
- package/dist/story/interactions.d.ts +53 -0
- package/dist/story/interactions.js +225 -0
- package/dist/story/keyboard-shortcuts.d.ts +39 -0
- package/dist/story/keyboard-shortcuts.js +345 -0
- package/dist/story/output.d.ts +115 -0
- package/dist/story/output.js +153 -0
- package/dist/story/performance.d.ts +129 -0
- package/dist/story/performance.js +252 -0
- package/dist/story/presets.d.ts +123 -0
- package/dist/story/presets.js +289 -0
- package/dist/story/props-validation.d.ts +45 -0
- package/dist/story/props-validation.js +215 -0
- package/dist/story/renderer.d.ts +69 -0
- package/dist/story/renderer.js +209 -0
- package/dist/story/search-index.d.ts +47 -0
- package/dist/story/search-index.js +106 -0
- package/dist/story/search.d.ts +56 -0
- package/dist/story/search.js +140 -0
- package/dist/story/server.d.ts +31 -0
- package/dist/story/server.js +965 -0
- package/dist/story/setup.d.ts +56 -0
- package/dist/story/setup.js +78 -0
- package/dist/story/snapshots.d.ts +65 -0
- package/dist/story/snapshots.js +171 -0
- package/dist/story/testing.d.ts +83 -0
- package/dist/story/testing.js +164 -0
- package/dist/story/theme.d.ts +68 -0
- package/dist/story/theme.js +170 -0
- package/dist/story/ts-css.d.ts +29 -0
- package/dist/story/ts-css.js +189 -0
- package/dist/story/types.d.ts +342 -0
- package/dist/story/types.js +0 -0
- package/dist/story/ui/code-panel.d.ts +43 -0
- package/dist/story/ui/code-panel.js +175 -0
- package/dist/story/ui/controls-panel.d.ts +25 -0
- package/dist/story/ui/controls-panel.js +168 -0
- package/dist/story/ui/index.d.ts +8 -0
- package/dist/story/ui/index.js +4 -0
- package/dist/story/ui/navigation.d.ts +55 -0
- package/dist/story/ui/navigation.js +250 -0
- package/dist/story/ui/preview.d.ts +46 -0
- package/dist/story/ui/preview.js +251 -0
- package/dist/story/visual-testing.d.ts +45 -0
- package/dist/story/visual-testing.js +248 -0
- package/dist/streaming.d.ts +238 -0
- package/dist/streaming.js +537 -0
- package/dist/strict-lint.d.ts +52 -0
- package/dist/strict-lint.js +269 -0
- package/dist/strip-literals.d.ts +40 -0
- package/dist/strip-literals.js +149 -0
- package/dist/stx-virtual-ts.d.ts +358 -0
- package/dist/stx-virtual-ts.js +670 -0
- package/dist/stx.d.ts +924 -0
- package/dist/style-scoping.d.ts +42 -0
- package/dist/style-scoping.js +82 -0
- package/dist/suspense.d.ts +98 -0
- package/dist/suspense.js +398 -0
- package/dist/teleport.d.ts +31 -0
- package/dist/teleport.js +109 -0
- package/dist/template-compiler.d.ts +33 -0
- package/dist/template-compiler.js +68 -0
- package/dist/template-hydrator.d.ts +28 -0
- package/dist/template-hydrator.js +95 -0
- package/dist/template-tag-balance.d.ts +32 -0
- package/dist/template-tag-balance.js +93 -0
- package/dist/testing.d.ts +330 -0
- package/dist/testing.js +588 -0
- package/dist/theme-tokens.d.ts +88 -0
- package/dist/theme-tokens.js +71 -0
- package/dist/transitions.d.ts +99 -0
- package/dist/transitions.js +443 -0
- package/dist/ts-css-config.d.ts +71 -0
- package/dist/ts-css-config.js +44 -0
- package/dist/type-checker.d.ts +85 -0
- package/dist/type-checker.js +581 -0
- package/dist/typecheck.d.ts +70 -0
- package/dist/typecheck.js +365 -0
- package/dist/types/component-types.d.ts +248 -0
- package/dist/types/component-types.js +0 -0
- package/dist/types/config-types.d.ts +938 -0
- package/dist/types/config-types.js +0 -0
- package/dist/types/context-types.d.ts +122 -0
- package/dist/types/context-types.js +0 -0
- package/dist/types/csp-types.d.ts +83 -0
- package/dist/types/csp-types.js +0 -0
- package/dist/types/directive-types.d.ts +315 -0
- package/dist/types/directive-types.js +3 -0
- package/dist/types/index.d.ts +20 -0
- package/dist/types/index.js +1 -0
- package/dist/types/pwa-types.d.ts +338 -0
- package/dist/types/pwa-types.js +0 -0
- package/dist/types.d.ts +27 -0
- package/dist/types.js +1 -0
- package/dist/typescript-templates.d.ts +156 -0
- package/dist/typescript-templates.js +386 -0
- package/dist/unresolved-identifiers.d.ts +52 -0
- package/dist/unresolved-identifiers.js +148 -0
- package/dist/utils.d.ts +112 -0
- package/dist/utils.js +1170 -0
- package/dist/validator.d.ts +80 -0
- package/dist/validator.js +171 -0
- package/dist/variable-extractor.d.ts +142 -0
- package/dist/variable-extractor.js +1306 -0
- package/dist/view-composers.d.ts +171 -0
- package/dist/view-composers.js +29 -0
- package/dist/virtual-scrolling.d.ts +127 -0
- package/dist/virtual-scrolling.js +454 -0
- package/dist/visual-editor.d.ts +185 -0
- package/dist/visual-editor.js +735 -0
- package/dist/visual-testing.d.ts +135 -0
- package/dist/visual-testing.js +126 -0
- package/dist/vue-template.d.ts +39 -0
- package/dist/vue-template.js +476 -0
- package/dist/web-components/css-scoping.d.ts +64 -0
- package/dist/web-components/css-scoping.js +210 -0
- package/dist/web-components/index.d.ts +29 -0
- package/dist/web-components/index.js +13 -0
- package/dist/web-components/reactive-generator.d.ts +72 -0
- package/dist/web-components/reactive-generator.js +484 -0
- package/dist/web-components.d.ts +253 -0
- package/dist/web-components.js +1466 -0
- package/dist/x-element.d.ts +42 -0
- package/dist/x-element.js +301 -0
- package/package.json +107 -0
- package/stx.d.ts +924 -0
|
@@ -0,0 +1,1194 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{dv as W,ev as k,fv as G}from"./chunk-qc1f74ek.js";import A from"fs";import B from"path";function h(j){let q=0;for(let K=0;K<j.length;K++){let Q=j[K];q=(q<<5)-q+Q,q=q&q}return Math.abs(q).toString(16).padStart(8,"0")}function u(j,q){let K=B.basename(j);for(let Q of q)if(Q.startsWith("*.")){let Y=Q.slice(1);if(K.endsWith(Y))return!0}else if(Q.includes("*")){let Y=new RegExp(`^${Q.replace(/\*/g,".*")}$`);if(Y.test(K)||Y.test(j))return!0}else if(K===Q||j.includes(Q))return!0;return!1}function f(j,q,K){let Q=B.extname(j).toLowerCase(),Y=l[Q],X=(K.maxFileSizeKB||500)*1024;if(q>X)return!1;if(K.exclude&&u(j,K.exclude))return!1;if(K.include&&K.include.length>0){for(let Z of K.include)if(Z.startsWith("*.")){if(j.endsWith(Z.slice(1)))return!0}else if(j.includes(Z))return!0}if(Y&&K[Y]===!0)return!0;if(!Y)return!1;return!1}function T(j,q,K,Q){let Y=A.readdirSync(j,{withFileTypes:!0});for(let X of Y){let Z=B.join(j,X.name);if(X.isDirectory()){if(["node_modules",".git",".stx"].includes(X.name))continue;T(Z,q,K,Q)}else if(X.isFile()){let O=A.statSync(Z),_=B.relative(q,Z);if(f(_,O.size,K)){let $=A.readFileSync(Z),L=h($),V=`/${_.replace(/\\/g,"/")}`;Q.push({url:V,revision:L,size:O.size})}}}}function U(j,q){let K=q.pwa?.precache,Q=[];if(!K?.enabled)return{entries:[],totalSize:0,fileCount:0};if(!A.existsSync(j))return{entries:[],totalSize:0,fileCount:0};T(j,j,K,Q),Q.sort((X,Z)=>X.url.localeCompare(Z.url));let Y=Q.reduce((X,Z)=>X+Z.size,0);return{entries:Q,totalSize:Y,fileCount:Q.length}}function J(j){if(j.entries.length===0)return"[]";return`[
|
|
3
|
+
${j.entries.map((K)=>` { url: '${K.url}', revision: '${K.revision}' }`).join(`,
|
|
4
|
+
`)}
|
|
5
|
+
]`}function E(j){if(j<1024)return`${j} B`;if(j<1048576)return`${(j/1024).toFixed(1)} KB`;return`${(j/1048576).toFixed(2)} MB`}var l;var F=G(()=>{l={".html":"includeHtml",".htm":"includeHtml",".js":"includeJs",".mjs":"includeJs",".css":"includeCss",".png":"includeImages",".jpg":"includeImages",".jpeg":"includeImages",".gif":"includeImages",".webp":"includeImages",".svg":"includeImages",".ico":"includeImages",".woff":"includeFonts",".woff2":"includeFonts",".ttf":"includeFonts",".eot":"includeFonts",".otf":"includeFonts"}});function g(j){let q={"cache-first":{className:"CacheFirst",importFrom:"workbox-strategies"},"network-first":{className:"NetworkFirst",importFrom:"workbox-strategies"},"stale-while-revalidate":{className:"StaleWhileRevalidate",importFrom:"workbox-strategies"},"network-only":{className:"NetworkOnly",importFrom:"workbox-strategies"},"cache-only":{className:"CacheOnly",importFrom:"workbox-strategies"}};return q[j]||q["network-first"]}function R(j){return g(j).className}function M(j){let q=j.pwa;if(!q?.enabled)return"";let K=q.routes||[],Q=q.cacheStorage,Y=[];for(let X of K){let Z=R(X.strategy),O=[];if(X.maxAgeSeconds||X.maxEntries||Q?.maxEntries){let $=X.maxEntries||Q?.maxEntries||100,L=X.maxAgeSeconds||(Q?.maxAge?Q.maxAge*24*60*60:void 0);O.push(`new ExpirationPlugin({
|
|
6
|
+
maxEntries: ${$},
|
|
7
|
+
${L?`maxAgeSeconds: ${L},`:""}
|
|
8
|
+
purgeOnQuotaError: true,
|
|
9
|
+
})`)}if(X.strategy==="network-first"||X.strategy==="stale-while-revalidate")O.push(`new CacheableResponsePlugin({
|
|
10
|
+
statuses: [0, 200],
|
|
11
|
+
})`);let _=c(X.pattern);Y.push(`
|
|
12
|
+
// ${X.pattern}
|
|
13
|
+
registerRoute(
|
|
14
|
+
${_},
|
|
15
|
+
new ${Z}({
|
|
16
|
+
cacheName: '${X.cacheName||a(X.pattern)}',
|
|
17
|
+
${O.length>0?`plugins: [
|
|
18
|
+
${O.join(`,
|
|
19
|
+
`)}
|
|
20
|
+
],`:""}
|
|
21
|
+
})
|
|
22
|
+
);`)}return Y.join(`
|
|
23
|
+
`)}function c(j){if(j.startsWith("*.")){let q=j.slice(2);return`({ request }) => request.destination === '${p(q)}'`}if(j.endsWith("/**"))return`({ url }) => url.pathname.startsWith('${j.slice(0,-3)}')`;if(j.endsWith("/*")){let q=j.slice(0,-2);return`({ url }) => url.pathname.startsWith('${q}') && !url.pathname.slice(${q.length+1}).includes('/')`}if(j.includes("*")&&!j.startsWith("*")){let[q,K]=j.split("*");return`({ url }) => url.pathname.startsWith('${q}') && url.pathname.endsWith('${K}')`}if(j==="/"||!j.includes("*"))return`({ url }) => url.pathname === '${j}'`;return`new RegExp('${s(j).replace(/\\\*/g,".*")}')`}function p(j){return{js:"script",mjs:"script",css:"style",html:"document",htm:"document",png:"image",jpg:"image",jpeg:"image",gif:"image",svg:"image",webp:"image",avif:"image",ico:"image",woff:"font",woff2:"font",ttf:"font",eot:"font",otf:"font"}[j.toLowerCase()]||"empty"}function a(j){return"stx-"+j.replace(/[^\w]/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"").toLowerCase().slice(0,30)+"-cache"}function s(j){return j.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}var v=()=>{};var D={};k(D,{isWorkboxEnabled:()=>b,getServiceWorkerGenerator:()=>e,generateWorkboxServiceWorker:()=>P,generateWorkboxConfig:()=>S});function S(j,q){let K=j.pwa;if(!K?.enabled)return{mode:"generate",modules:[],skipWaiting:!0,clientsClaim:!0};let Q=K.serviceWorker||{},Y=K.routes||[],X=[{name:"workbox-precaching",exports:["precacheAndRoute","cleanupOutdatedCaches"]},{name:"workbox-routing",exports:["registerRoute","NavigationRoute","setDefaultHandler"]}],Z=new Set;for(let $ of Y)Z.add(R($.strategy));if(Z.size>0)X.push({name:"workbox-strategies",exports:Array.from(Z)});if(Y.some(($)=>$.maxAgeSeconds||$.maxEntries)||K.cacheStorage)X.push({name:"workbox-expiration",exports:["ExpirationPlugin"]});if(Y.some(($)=>$.strategy==="network-first"||$.strategy==="stale-while-revalidate"))X.push({name:"workbox-cacheable-response",exports:["CacheableResponsePlugin"]});if(K.backgroundSync?.enabled)X.push({name:"workbox-background-sync",exports:["BackgroundSyncPlugin","Queue"]});if(Q.navigationPreload)X.push({name:"workbox-navigation-preload",exports:["enable"]});let _=q?U(q,j):void 0;return{mode:"generate",modules:X,precacheManifest:_?.entries,skipWaiting:Q.skipWaiting??!0,clientsClaim:Q.clientsClaim??!0,offlineFallback:K.offline?.enabled?"/offline.html":void 0,navigationPreload:Q.navigationPreload??!1,cacheVersion:Q.cacheVersion||"1.0.0"}}function P(j,q){let K=j.pwa;if(!K?.enabled)return"";let Q=S(j,q),Y=K.serviceWorker||{},X=K.push,Z=K.backgroundSync,O=q?U(q,j):null,_=O?J(O):"[]",$=r(Q.modules),L=M(j);return`/**
|
|
24
|
+
* Service Worker - Generated by stx with Workbox
|
|
25
|
+
* Cache Version: ${Q.cacheVersion}
|
|
26
|
+
*
|
|
27
|
+
* This service worker uses Google's Workbox library for robust caching.
|
|
28
|
+
* https://developers.google.com/web/tools/workbox
|
|
29
|
+
*
|
|
30
|
+
* Features:
|
|
31
|
+
* - Precaching with automatic revision management
|
|
32
|
+
* - Runtime caching with multiple strategies
|
|
33
|
+
* - Offline fallback support
|
|
34
|
+
* - Push notifications: ${X?.enabled?"enabled":"disabled"}
|
|
35
|
+
* - Background sync: ${Z?.enabled?"enabled":"disabled"}
|
|
36
|
+
*/
|
|
37
|
+
|
|
38
|
+
// Import Workbox modules from CDN
|
|
39
|
+
importScripts('https://storage.googleapis.com/workbox-cdn/releases/7.0.0/workbox-sw.js');
|
|
40
|
+
|
|
41
|
+
// Disable Workbox logging in production
|
|
42
|
+
workbox.setConfig({ debug: true });
|
|
43
|
+
|
|
44
|
+
// Extract modules from workbox global
|
|
45
|
+
${$}
|
|
46
|
+
|
|
47
|
+
const CACHE_VERSION = '${Q.cacheVersion}';
|
|
48
|
+
const OFFLINE_PAGE = '${Q.offlineFallback||"/offline.html"}';
|
|
49
|
+
|
|
50
|
+
// ============================================================================
|
|
51
|
+
// Precaching
|
|
52
|
+
// ============================================================================
|
|
53
|
+
|
|
54
|
+
// Clean up outdated caches from previous versions
|
|
55
|
+
cleanupOutdatedCaches();
|
|
56
|
+
|
|
57
|
+
// Precache static assets
|
|
58
|
+
// The manifest is injected during build or defined below
|
|
59
|
+
const PRECACHE_MANIFEST = ${_};
|
|
60
|
+
|
|
61
|
+
// Add essential assets
|
|
62
|
+
PRECACHE_MANIFEST.push(
|
|
63
|
+
{ url: '/', revision: CACHE_VERSION },
|
|
64
|
+
{ url: '/manifest.json', revision: CACHE_VERSION },
|
|
65
|
+
${Q.offlineFallback?`{ url: '${Q.offlineFallback}', revision: CACHE_VERSION },`:""}
|
|
66
|
+
);
|
|
67
|
+
|
|
68
|
+
// Precache and route all manifest entries
|
|
69
|
+
precacheAndRoute(PRECACHE_MANIFEST);
|
|
70
|
+
|
|
71
|
+
// ============================================================================
|
|
72
|
+
// Navigation Preload
|
|
73
|
+
// ============================================================================
|
|
74
|
+
|
|
75
|
+
${Q.navigationPreload?`// Enable navigation preload for faster page loads
|
|
76
|
+
enable();`:"// Navigation preload disabled"}
|
|
77
|
+
|
|
78
|
+
// ============================================================================
|
|
79
|
+
// Runtime Caching
|
|
80
|
+
// ============================================================================
|
|
81
|
+
|
|
82
|
+
${L}
|
|
83
|
+
|
|
84
|
+
// ============================================================================
|
|
85
|
+
// Offline Fallback
|
|
86
|
+
// ============================================================================
|
|
87
|
+
|
|
88
|
+
${Q.offlineFallback?`
|
|
89
|
+
// Set up offline fallback for navigation requests
|
|
90
|
+
const navigationRoute = new NavigationRoute(
|
|
91
|
+
new NetworkFirst({
|
|
92
|
+
cacheName: 'stx-pages-cache',
|
|
93
|
+
plugins: [
|
|
94
|
+
new CacheableResponsePlugin({ statuses: [0, 200] }),
|
|
95
|
+
],
|
|
96
|
+
}),
|
|
97
|
+
{
|
|
98
|
+
// Return offline page when navigation fails
|
|
99
|
+
async allowedHandler(request) {
|
|
100
|
+
try {
|
|
101
|
+
const response = await this.handle(request);
|
|
102
|
+
return response;
|
|
103
|
+
}
|
|
104
|
+
catch (error) {
|
|
105
|
+
const cache = await caches.open('stx-offline-cache');
|
|
106
|
+
return cache.match(OFFLINE_PAGE) || new Response('You are offline', {
|
|
107
|
+
status: 503,
|
|
108
|
+
statusText: 'Service Unavailable',
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
},
|
|
112
|
+
}
|
|
113
|
+
);
|
|
114
|
+
registerRoute(navigationRoute);
|
|
115
|
+
`:"// No offline fallback configured"}
|
|
116
|
+
|
|
117
|
+
// Default handler for unmatched requests
|
|
118
|
+
setDefaultHandler(new NetworkFirst({
|
|
119
|
+
cacheName: 'stx-default-cache',
|
|
120
|
+
plugins: [
|
|
121
|
+
new CacheableResponsePlugin({ statuses: [0, 200] }),
|
|
122
|
+
new ExpirationPlugin({ maxEntries: 100, maxAgeSeconds: 60 * 60 * 24 }), // 1 day
|
|
123
|
+
],
|
|
124
|
+
}));
|
|
125
|
+
|
|
126
|
+
// ============================================================================
|
|
127
|
+
// Service Worker Lifecycle
|
|
128
|
+
// ============================================================================
|
|
129
|
+
|
|
130
|
+
${Q.skipWaiting?`// Skip waiting - activate immediately
|
|
131
|
+
self.skipWaiting();`:"// Manual skipWaiting - user must trigger update"}
|
|
132
|
+
|
|
133
|
+
${Q.clientsClaim?`// Claim clients - take control immediately
|
|
134
|
+
self.addEventListener('activate', () => {
|
|
135
|
+
self.clients.claim();
|
|
136
|
+
});`:"// Manual clients claim"}
|
|
137
|
+
|
|
138
|
+
// ============================================================================
|
|
139
|
+
// Message Handling
|
|
140
|
+
// ============================================================================
|
|
141
|
+
|
|
142
|
+
self.addEventListener('message', (event) => {
|
|
143
|
+
const { type, payload } = event.data || {};
|
|
144
|
+
|
|
145
|
+
switch (type) {
|
|
146
|
+
case 'SKIP_WAITING':
|
|
147
|
+
self.skipWaiting();
|
|
148
|
+
break;
|
|
149
|
+
|
|
150
|
+
case 'GET_VERSION':
|
|
151
|
+
event.source?.postMessage({ type: 'VERSION', payload: CACHE_VERSION });
|
|
152
|
+
break;
|
|
153
|
+
|
|
154
|
+
case 'CACHE_URLS':
|
|
155
|
+
if (Array.isArray(payload)) {
|
|
156
|
+
event.waitUntil(
|
|
157
|
+
caches.open('stx-dynamic-cache').then(cache => cache.addAll(payload))
|
|
158
|
+
);
|
|
159
|
+
}
|
|
160
|
+
break;
|
|
161
|
+
|
|
162
|
+
case 'CLEAR_CACHE':
|
|
163
|
+
event.waitUntil(
|
|
164
|
+
caches.keys().then(names =>
|
|
165
|
+
Promise.all(names.map(name => caches.delete(name)))
|
|
166
|
+
)
|
|
167
|
+
);
|
|
168
|
+
break;
|
|
169
|
+
}
|
|
170
|
+
});
|
|
171
|
+
|
|
172
|
+
${X?.enabled?n(X):"// Push notifications disabled"}
|
|
173
|
+
|
|
174
|
+
${Z?.enabled?o(Z):"// Background sync disabled"}
|
|
175
|
+
|
|
176
|
+
console.log('[Workbox SW] Service Worker loaded - Version:', CACHE_VERSION);
|
|
177
|
+
`}function r(j){let q=[];for(let K of j){let Q=K.name.replace("workbox-","");q.push(`const { ${K.exports.join(", ")} } = workbox.${i(Q)};`)}return q.join(`
|
|
178
|
+
`)}function i(j){return j.replace(/-([a-z])/g,(q,K)=>K.toUpperCase())}function n(j){return`
|
|
179
|
+
// ============================================================================
|
|
180
|
+
// Push Notifications
|
|
181
|
+
// ============================================================================
|
|
182
|
+
|
|
183
|
+
const PUSH_CONFIG = {
|
|
184
|
+
defaultIcon: '${j?.defaultIcon||"/pwa-icons/icon-192x192.png"}',
|
|
185
|
+
defaultBadge: '${j?.defaultBadge||"/pwa-icons/icon-72x72.png"}',
|
|
186
|
+
};
|
|
187
|
+
|
|
188
|
+
self.addEventListener('push', (event) => {
|
|
189
|
+
console.log('[Workbox SW] Push notification received');
|
|
190
|
+
|
|
191
|
+
let data = {
|
|
192
|
+
title: 'Notification',
|
|
193
|
+
body: 'You have a new notification',
|
|
194
|
+
icon: PUSH_CONFIG.defaultIcon,
|
|
195
|
+
badge: PUSH_CONFIG.defaultBadge,
|
|
196
|
+
};
|
|
197
|
+
|
|
198
|
+
if (event.data) {
|
|
199
|
+
try {
|
|
200
|
+
const payload = event.data.json();
|
|
201
|
+
data = { ...data, ...payload };
|
|
202
|
+
}
|
|
203
|
+
catch {
|
|
204
|
+
data.body = event.data.text();
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
const options = {
|
|
209
|
+
body: data.body,
|
|
210
|
+
icon: data.icon || PUSH_CONFIG.defaultIcon,
|
|
211
|
+
badge: data.badge || PUSH_CONFIG.defaultBadge,
|
|
212
|
+
vibrate: data.vibrate || [100, 50, 100],
|
|
213
|
+
data: {
|
|
214
|
+
url: data.url || '/',
|
|
215
|
+
...data.data,
|
|
216
|
+
},
|
|
217
|
+
actions: data.actions || [],
|
|
218
|
+
tag: data.tag,
|
|
219
|
+
renotify: data.renotify || false,
|
|
220
|
+
requireInteraction: data.requireInteraction || false,
|
|
221
|
+
};
|
|
222
|
+
|
|
223
|
+
event.waitUntil(
|
|
224
|
+
self.registration.showNotification(data.title, options)
|
|
225
|
+
);
|
|
226
|
+
});
|
|
227
|
+
|
|
228
|
+
self.addEventListener('notificationclick', (event) => {
|
|
229
|
+
console.log('[Workbox SW] Notification clicked');
|
|
230
|
+
event.notification.close();
|
|
231
|
+
|
|
232
|
+
const url = event.notification.data?.url || '/';
|
|
233
|
+
|
|
234
|
+
event.waitUntil(
|
|
235
|
+
clients.matchAll({ type: 'window', includeUncontrolled: true }).then(windowClients => {
|
|
236
|
+
for (const client of windowClients) {
|
|
237
|
+
if (client.url === url && 'focus' in client) {
|
|
238
|
+
return client.focus();
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
if (clients.openWindow) {
|
|
242
|
+
return clients.openWindow(url);
|
|
243
|
+
}
|
|
244
|
+
})
|
|
245
|
+
);
|
|
246
|
+
});
|
|
247
|
+
`}function o(j){return`
|
|
248
|
+
// ============================================================================
|
|
249
|
+
// Background Sync
|
|
250
|
+
// ============================================================================
|
|
251
|
+
|
|
252
|
+
const syncQueue = new Queue('${j?.queueName||"stx-sync-queue"}', {
|
|
253
|
+
maxRetentionTime: ${j?.maxRetentionMinutes||1440}, // minutes
|
|
254
|
+
onSync: async ({ queue }) => {
|
|
255
|
+
let entry;
|
|
256
|
+
while ((entry = await queue.shiftRequest())) {
|
|
257
|
+
try {
|
|
258
|
+
await fetch(entry.request.clone());
|
|
259
|
+
console.log('[Workbox SW] Sync succeeded:', entry.request.url);
|
|
260
|
+
|
|
261
|
+
// Notify clients
|
|
262
|
+
const allClients = await self.clients.matchAll();
|
|
263
|
+
allClients.forEach(client => {
|
|
264
|
+
client.postMessage({
|
|
265
|
+
type: 'SYNC_COMPLETE',
|
|
266
|
+
url: entry.request.url,
|
|
267
|
+
success: true,
|
|
268
|
+
});
|
|
269
|
+
});
|
|
270
|
+
}
|
|
271
|
+
catch (error) {
|
|
272
|
+
console.log('[Workbox SW] Sync failed, re-queuing:', entry.request.url);
|
|
273
|
+
await queue.unshiftRequest(entry);
|
|
274
|
+
throw error;
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
},
|
|
278
|
+
});
|
|
279
|
+
|
|
280
|
+
// Register routes that should use background sync
|
|
281
|
+
${j?.endpoints?.map((q)=>`
|
|
282
|
+
registerRoute(
|
|
283
|
+
({ url }) => url.pathname.startsWith('${q}'),
|
|
284
|
+
new NetworkOnly({
|
|
285
|
+
plugins: [
|
|
286
|
+
new BackgroundSyncPlugin('${j?.queueName||"stx-sync-queue"}', {
|
|
287
|
+
maxRetentionTime: ${j?.maxRetentionMinutes||1440},
|
|
288
|
+
}),
|
|
289
|
+
],
|
|
290
|
+
}),
|
|
291
|
+
'POST'
|
|
292
|
+
);`).join(`
|
|
293
|
+
`)||"// No background sync endpoints configured"}
|
|
294
|
+
|
|
295
|
+
// Handle form sync messages
|
|
296
|
+
self.addEventListener('message', (event) => {
|
|
297
|
+
if (event.data?.type === 'REGISTER_FORM_SYNC') {
|
|
298
|
+
const { action, method, data } = event.data.payload;
|
|
299
|
+
|
|
300
|
+
const request = new Request(action, {
|
|
301
|
+
method: method || 'POST',
|
|
302
|
+
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
|
|
303
|
+
body: new URLSearchParams(data).toString(),
|
|
304
|
+
});
|
|
305
|
+
|
|
306
|
+
event.waitUntil(syncQueue.pushRequest({ request }));
|
|
307
|
+
}
|
|
308
|
+
});
|
|
309
|
+
`}function b(j){return j.pwa?.enabled===!0&&j.pwa?.serviceWorker?.useWorkbox===!0}function e(j){if(b(j))return P;let{generateServiceWorker:q}=(H(),W(d));return q}var x=G(()=>{v();F()});var d={};k(d,{isWorkboxEnabled:()=>y,getServiceWorkerFileName:()=>z,generateServiceWorkerAuto:()=>qj,generateServiceWorker:()=>w});function w(j,q){let K=j.pwa;if(!K?.enabled)return"";let Q=K.serviceWorker||{},Y=K.routes||[],X=Q.cacheVersion||"1.0.0",Z=K.offline,O=Z?.page?"/offline.html":"/offline.html",_=K.push,$=K.backgroundSync,L=K.cacheStorage,V=q?U(q,j):null,C=V?J(V):"[]",m=["/","/manifest.json",...Z?.enabled?[O]:[],...Z?.precacheAssets||[]];return`/**
|
|
310
|
+
* Service Worker - Auto-generated by stx
|
|
311
|
+
* Cache Version: ${X}
|
|
312
|
+
*
|
|
313
|
+
* This service worker implements configurable caching strategies:
|
|
314
|
+
* - cache-first: Serve from cache, fall back to network
|
|
315
|
+
* - network-first: Try network, fall back to cache
|
|
316
|
+
* - stale-while-revalidate: Serve cached, update in background
|
|
317
|
+
* - network-only: Always fetch from network
|
|
318
|
+
* - cache-only: Only serve from cache
|
|
319
|
+
*
|
|
320
|
+
* Additional features:
|
|
321
|
+
* - Push notifications: ${_?.enabled?"enabled":"disabled"}
|
|
322
|
+
* - Background sync: ${$?.enabled?"enabled":"disabled"}
|
|
323
|
+
* - Cache limits: ${L?.maxSize?`${E(L.maxSize*1024*1024)}`:"unlimited"}
|
|
324
|
+
*/
|
|
325
|
+
|
|
326
|
+
const CACHE_VERSION = '${X}';
|
|
327
|
+
const CACHE_NAME = 'stx-pwa-v' + CACHE_VERSION;
|
|
328
|
+
const OFFLINE_PAGE = '${O}';
|
|
329
|
+
|
|
330
|
+
// Assets to precache on install
|
|
331
|
+
const PRECACHE_ASSETS = ${JSON.stringify(m,null,2)};
|
|
332
|
+
|
|
333
|
+
// Auto-generated precache manifest from build output
|
|
334
|
+
const BUILD_PRECACHE_MANIFEST = ${C};
|
|
335
|
+
|
|
336
|
+
// Route caching strategies
|
|
337
|
+
const ROUTE_STRATEGIES = ${JSON.stringify(Y,null,2)};
|
|
338
|
+
|
|
339
|
+
// Routes to exclude from caching
|
|
340
|
+
const EXCLUDED_ROUTES = ${JSON.stringify(Q.excludeRoutes||[],null,2)};
|
|
341
|
+
|
|
342
|
+
// Cache storage configuration
|
|
343
|
+
const CACHE_CONFIG = {
|
|
344
|
+
maxSize: ${L?.maxSize||0} * 1024 * 1024, // Convert MB to bytes
|
|
345
|
+
maxAge: ${L?.maxAge||0} * 24 * 60 * 60 * 1000, // Convert days to ms
|
|
346
|
+
maxEntries: ${L?.maxEntries||0},
|
|
347
|
+
purgeStrategy: '${L?.purgeStrategy||"lru"}',
|
|
348
|
+
};
|
|
349
|
+
|
|
350
|
+
// Background sync configuration
|
|
351
|
+
const SYNC_CONFIG = {
|
|
352
|
+
enabled: ${$?.enabled||!1},
|
|
353
|
+
queueName: '${$?.queueName||"stx-sync-queue"}',
|
|
354
|
+
maxRetries: ${$?.maxRetries||3},
|
|
355
|
+
minInterval: ${$?.minInterval||1000},
|
|
356
|
+
};
|
|
357
|
+
|
|
358
|
+
// Push notification configuration
|
|
359
|
+
const PUSH_CONFIG = {
|
|
360
|
+
enabled: ${_?.enabled||!1},
|
|
361
|
+
defaultIcon: '${_?.defaultIcon||"/pwa-icons/icon-192x192.png"}',
|
|
362
|
+
defaultBadge: '${_?.defaultBadge||"/pwa-icons/icon-72x72.png"}',
|
|
363
|
+
};
|
|
364
|
+
|
|
365
|
+
/**
|
|
366
|
+
* Install event - precache essential assets
|
|
367
|
+
*/
|
|
368
|
+
self.addEventListener('install', (event) => {
|
|
369
|
+
console.log('[SW] Installing service worker...');
|
|
370
|
+
${Q.skipWaiting?"self.skipWaiting();":""}
|
|
371
|
+
|
|
372
|
+
event.waitUntil(
|
|
373
|
+
caches.open(CACHE_NAME).then(async (cache) => {
|
|
374
|
+
// Combine manual precache assets with auto-generated manifest
|
|
375
|
+
const allAssets = [...PRECACHE_ASSETS];
|
|
376
|
+
|
|
377
|
+
// Add build precache manifest entries
|
|
378
|
+
for (const entry of BUILD_PRECACHE_MANIFEST) {
|
|
379
|
+
if (!allAssets.includes(entry.url)) {
|
|
380
|
+
allAssets.push(entry.url);
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
console.log('[SW] Precaching assets:', allAssets.length);
|
|
385
|
+
|
|
386
|
+
// Cache assets one by one to handle failures gracefully
|
|
387
|
+
const results = await Promise.allSettled(
|
|
388
|
+
allAssets.map(async (url) => {
|
|
389
|
+
try {
|
|
390
|
+
const response = await fetch(url);
|
|
391
|
+
if (response.ok) {
|
|
392
|
+
await cache.put(url, response);
|
|
393
|
+
return { url, success: true };
|
|
394
|
+
}
|
|
395
|
+
return { url, success: false, reason: response.status };
|
|
396
|
+
}
|
|
397
|
+
catch (error) {
|
|
398
|
+
return { url, success: false, reason: error.message };
|
|
399
|
+
}
|
|
400
|
+
})
|
|
401
|
+
);
|
|
402
|
+
|
|
403
|
+
const failed = results.filter(r => r.status === 'rejected' || (r.status === 'fulfilled' && !r.value.success));
|
|
404
|
+
if (failed.length > 0) {
|
|
405
|
+
console.warn('[SW] Failed to precache some assets:', failed.length);
|
|
406
|
+
}
|
|
407
|
+
})
|
|
408
|
+
);
|
|
409
|
+
});
|
|
410
|
+
|
|
411
|
+
/**
|
|
412
|
+
* Activate event - clean up old caches
|
|
413
|
+
*/
|
|
414
|
+
self.addEventListener('activate', (event) => {
|
|
415
|
+
console.log('[SW] Activating service worker...');
|
|
416
|
+
${Q.clientsClaim?"self.clients.claim();":""}
|
|
417
|
+
|
|
418
|
+
event.waitUntil(
|
|
419
|
+
(async () => {
|
|
420
|
+
// Clean up old caches
|
|
421
|
+
const cacheNames = await caches.keys();
|
|
422
|
+
await Promise.all(
|
|
423
|
+
cacheNames
|
|
424
|
+
.filter((name) => name.startsWith('stx-pwa-') && name !== CACHE_NAME)
|
|
425
|
+
.map((name) => {
|
|
426
|
+
console.log('[SW] Deleting old cache:', name);
|
|
427
|
+
return caches.delete(name);
|
|
428
|
+
})
|
|
429
|
+
);
|
|
430
|
+
|
|
431
|
+
// Enforce cache storage limits
|
|
432
|
+
if (CACHE_CONFIG.maxSize > 0 || CACHE_CONFIG.maxEntries > 0) {
|
|
433
|
+
await enforceCacheLimits();
|
|
434
|
+
}
|
|
435
|
+
})()
|
|
436
|
+
);
|
|
437
|
+
});
|
|
438
|
+
|
|
439
|
+
/**
|
|
440
|
+
* Fetch event - apply caching strategies
|
|
441
|
+
*/
|
|
442
|
+
self.addEventListener('fetch', (event) => {
|
|
443
|
+
const { request } = event;
|
|
444
|
+
const url = new URL(request.url);
|
|
445
|
+
|
|
446
|
+
// Only handle GET requests
|
|
447
|
+
if (request.method !== 'GET') {
|
|
448
|
+
return;
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
// Skip cross-origin requests
|
|
452
|
+
if (url.origin !== location.origin) {
|
|
453
|
+
return;
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
// Skip excluded routes
|
|
457
|
+
if (isExcludedRoute(url.pathname)) {
|
|
458
|
+
return;
|
|
459
|
+
}
|
|
460
|
+
|
|
461
|
+
// Find matching strategy and apply
|
|
462
|
+
const routeConfig = getRouteConfig(url.pathname);
|
|
463
|
+
event.respondWith(applyStrategy(request, routeConfig));
|
|
464
|
+
});
|
|
465
|
+
|
|
466
|
+
/**
|
|
467
|
+
* Message event - handle messages from main thread
|
|
468
|
+
*/
|
|
469
|
+
self.addEventListener('message', (event) => {
|
|
470
|
+
const { type, payload } = event.data || {};
|
|
471
|
+
|
|
472
|
+
switch (type) {
|
|
473
|
+
case 'SKIP_WAITING':
|
|
474
|
+
console.log('[SW] Received SKIP_WAITING message');
|
|
475
|
+
self.skipWaiting();
|
|
476
|
+
break;
|
|
477
|
+
|
|
478
|
+
case 'CACHE_URLS':
|
|
479
|
+
if (Array.isArray(payload)) {
|
|
480
|
+
event.waitUntil(
|
|
481
|
+
caches.open(CACHE_NAME).then((cache) => cache.addAll(payload))
|
|
482
|
+
);
|
|
483
|
+
}
|
|
484
|
+
break;
|
|
485
|
+
|
|
486
|
+
case 'CLEAR_CACHE':
|
|
487
|
+
event.waitUntil(
|
|
488
|
+
caches.keys().then((names) =>
|
|
489
|
+
Promise.all(names.map((name) => caches.delete(name)))
|
|
490
|
+
)
|
|
491
|
+
);
|
|
492
|
+
break;
|
|
493
|
+
|
|
494
|
+
case 'GET_CACHE_SIZE':
|
|
495
|
+
event.waitUntil(
|
|
496
|
+
getCacheSize().then((size) => {
|
|
497
|
+
event.source?.postMessage({ type: 'CACHE_SIZE', payload: size });
|
|
498
|
+
})
|
|
499
|
+
);
|
|
500
|
+
break;
|
|
501
|
+
}
|
|
502
|
+
});
|
|
503
|
+
|
|
504
|
+
${_?.enabled?t():"// Push notifications disabled"}
|
|
505
|
+
|
|
506
|
+
${$?.enabled?jj():"// Background sync disabled"}
|
|
507
|
+
|
|
508
|
+
/**
|
|
509
|
+
* Check if a route should be excluded from caching
|
|
510
|
+
*/
|
|
511
|
+
function isExcludedRoute(pathname) {
|
|
512
|
+
return EXCLUDED_ROUTES.some((pattern) => matchPattern(pathname, pattern));
|
|
513
|
+
}
|
|
514
|
+
|
|
515
|
+
/**
|
|
516
|
+
* Match a path against a glob pattern
|
|
517
|
+
* Supports: *.ext, /path/*, /path/**, exact matches
|
|
518
|
+
*/
|
|
519
|
+
function matchPattern(path, pattern) {
|
|
520
|
+
// Handle file extension patterns like *.js, *.css
|
|
521
|
+
if (pattern.startsWith('*.')) {
|
|
522
|
+
return path.endsWith(pattern.slice(1));
|
|
523
|
+
}
|
|
524
|
+
|
|
525
|
+
// Handle patterns ending with /**
|
|
526
|
+
if (pattern.endsWith('/**')) {
|
|
527
|
+
const prefix = pattern.slice(0, -3);
|
|
528
|
+
return path.startsWith(prefix);
|
|
529
|
+
}
|
|
530
|
+
|
|
531
|
+
// Handle patterns ending with /*
|
|
532
|
+
if (pattern.endsWith('/*')) {
|
|
533
|
+
const prefix = pattern.slice(0, -2);
|
|
534
|
+
if (!path.startsWith(prefix)) return false;
|
|
535
|
+
const rest = path.slice(prefix.length);
|
|
536
|
+
return rest.length > 0 && !rest.slice(1).includes('/');
|
|
537
|
+
}
|
|
538
|
+
|
|
539
|
+
// Handle patterns with * in the middle
|
|
540
|
+
if (pattern.includes('*')) {
|
|
541
|
+
const parts = pattern.split('*');
|
|
542
|
+
if (parts.length === 2) {
|
|
543
|
+
return path.startsWith(parts[0]) && path.endsWith(parts[1]);
|
|
544
|
+
}
|
|
545
|
+
}
|
|
546
|
+
|
|
547
|
+
// Exact match
|
|
548
|
+
return path === pattern;
|
|
549
|
+
}
|
|
550
|
+
|
|
551
|
+
/**
|
|
552
|
+
* Get the cache configuration for a given path
|
|
553
|
+
*/
|
|
554
|
+
function getRouteConfig(pathname) {
|
|
555
|
+
for (const route of ROUTE_STRATEGIES) {
|
|
556
|
+
if (matchPattern(pathname, route.pattern)) {
|
|
557
|
+
return route;
|
|
558
|
+
}
|
|
559
|
+
}
|
|
560
|
+
// Default to network-first for unmatched routes
|
|
561
|
+
return { strategy: 'network-first' };
|
|
562
|
+
}
|
|
563
|
+
|
|
564
|
+
/**
|
|
565
|
+
* Apply the appropriate caching strategy
|
|
566
|
+
*/
|
|
567
|
+
async function applyStrategy(request, routeConfig) {
|
|
568
|
+
const { strategy, cacheName, maxAgeSeconds, maxEntries } = routeConfig;
|
|
569
|
+
const cache = await caches.open(cacheName || CACHE_NAME);
|
|
570
|
+
|
|
571
|
+
switch (strategy) {
|
|
572
|
+
case 'cache-first':
|
|
573
|
+
return cacheFirst(request, cache, maxAgeSeconds);
|
|
574
|
+
|
|
575
|
+
case 'network-first':
|
|
576
|
+
return networkFirst(request, cache);
|
|
577
|
+
|
|
578
|
+
case 'stale-while-revalidate':
|
|
579
|
+
return staleWhileRevalidate(request, cache);
|
|
580
|
+
|
|
581
|
+
case 'network-only':
|
|
582
|
+
return networkOnly(request);
|
|
583
|
+
|
|
584
|
+
case 'cache-only':
|
|
585
|
+
return cacheOnly(request, cache);
|
|
586
|
+
|
|
587
|
+
default:
|
|
588
|
+
return networkFirst(request, cache);
|
|
589
|
+
}
|
|
590
|
+
}
|
|
591
|
+
|
|
592
|
+
/**
|
|
593
|
+
* Cache-first strategy
|
|
594
|
+
* Serve from cache if available, otherwise fetch from network
|
|
595
|
+
*/
|
|
596
|
+
async function cacheFirst(request, cache, maxAge) {
|
|
597
|
+
const cached = await cache.match(request);
|
|
598
|
+
|
|
599
|
+
if (cached) {
|
|
600
|
+
// Check if cache is still valid (if maxAge is set)
|
|
601
|
+
if (maxAge) {
|
|
602
|
+
const cachedDate = cached.headers.get('sw-cache-date');
|
|
603
|
+
if (cachedDate) {
|
|
604
|
+
const age = (Date.now() - new Date(cachedDate).getTime()) / 1000;
|
|
605
|
+
if (age > maxAge) {
|
|
606
|
+
// Cache expired, fetch fresh
|
|
607
|
+
return fetchAndCache(request, cache);
|
|
608
|
+
}
|
|
609
|
+
}
|
|
610
|
+
}
|
|
611
|
+
return cached;
|
|
612
|
+
}
|
|
613
|
+
|
|
614
|
+
return fetchAndCache(request, cache);
|
|
615
|
+
}
|
|
616
|
+
|
|
617
|
+
/**
|
|
618
|
+
* Network-first strategy
|
|
619
|
+
* Try network first, fall back to cache if offline
|
|
620
|
+
*/
|
|
621
|
+
async function networkFirst(request, cache) {
|
|
622
|
+
try {
|
|
623
|
+
const response = await fetch(request);
|
|
624
|
+
if (response.ok) {
|
|
625
|
+
const cloned = response.clone();
|
|
626
|
+
cache.put(request, cloned);
|
|
627
|
+
}
|
|
628
|
+
return response;
|
|
629
|
+
}
|
|
630
|
+
catch (error) {
|
|
631
|
+
const cached = await cache.match(request);
|
|
632
|
+
if (cached) {
|
|
633
|
+
return cached;
|
|
634
|
+
}
|
|
635
|
+
return offlineResponse(request);
|
|
636
|
+
}
|
|
637
|
+
}
|
|
638
|
+
|
|
639
|
+
/**
|
|
640
|
+
* Stale-while-revalidate strategy
|
|
641
|
+
* Serve cached immediately, update cache in background
|
|
642
|
+
*/
|
|
643
|
+
async function staleWhileRevalidate(request, cache) {
|
|
644
|
+
const cached = await cache.match(request);
|
|
645
|
+
|
|
646
|
+
// Fetch in background to update cache
|
|
647
|
+
const fetchPromise = fetch(request)
|
|
648
|
+
.then((response) => {
|
|
649
|
+
if (response.ok) {
|
|
650
|
+
cache.put(request, response.clone());
|
|
651
|
+
}
|
|
652
|
+
return response;
|
|
653
|
+
})
|
|
654
|
+
.catch(() => null);
|
|
655
|
+
|
|
656
|
+
// Return cached immediately if available, otherwise wait for fetch
|
|
657
|
+
if (cached) {
|
|
658
|
+
return cached;
|
|
659
|
+
}
|
|
660
|
+
|
|
661
|
+
const response = await fetchPromise;
|
|
662
|
+
return response || offlineResponse(request);
|
|
663
|
+
}
|
|
664
|
+
|
|
665
|
+
/**
|
|
666
|
+
* Network-only strategy
|
|
667
|
+
* Always fetch from network, no caching
|
|
668
|
+
*/
|
|
669
|
+
async function networkOnly(request) {
|
|
670
|
+
try {
|
|
671
|
+
return await fetch(request);
|
|
672
|
+
}
|
|
673
|
+
catch (error) {
|
|
674
|
+
return offlineResponse(request);
|
|
675
|
+
}
|
|
676
|
+
}
|
|
677
|
+
|
|
678
|
+
/**
|
|
679
|
+
* Cache-only strategy
|
|
680
|
+
* Only serve from cache, never fetch
|
|
681
|
+
*/
|
|
682
|
+
async function cacheOnly(request, cache) {
|
|
683
|
+
const cached = await cache.match(request);
|
|
684
|
+
return cached || offlineResponse(request);
|
|
685
|
+
}
|
|
686
|
+
|
|
687
|
+
/**
|
|
688
|
+
* Fetch and cache a request
|
|
689
|
+
*/
|
|
690
|
+
async function fetchAndCache(request, cache) {
|
|
691
|
+
try {
|
|
692
|
+
const response = await fetch(request);
|
|
693
|
+
if (response.ok) {
|
|
694
|
+
// Add cache timestamp header
|
|
695
|
+
const headers = new Headers(response.headers);
|
|
696
|
+
headers.set('sw-cache-date', new Date().toISOString());
|
|
697
|
+
|
|
698
|
+
const cachedResponse = new Response(response.clone().body, {
|
|
699
|
+
status: response.status,
|
|
700
|
+
statusText: response.statusText,
|
|
701
|
+
headers,
|
|
702
|
+
});
|
|
703
|
+
|
|
704
|
+
cache.put(request, cachedResponse);
|
|
705
|
+
}
|
|
706
|
+
return response;
|
|
707
|
+
}
|
|
708
|
+
catch (error) {
|
|
709
|
+
return offlineResponse(request);
|
|
710
|
+
}
|
|
711
|
+
}
|
|
712
|
+
|
|
713
|
+
/**
|
|
714
|
+
* Generate offline response
|
|
715
|
+
*/
|
|
716
|
+
async function offlineResponse(request) {
|
|
717
|
+
// For navigation requests, return offline page
|
|
718
|
+
if (request.mode === 'navigate') {
|
|
719
|
+
const cache = await caches.open(CACHE_NAME);
|
|
720
|
+
const offlinePage = await cache.match(OFFLINE_PAGE);
|
|
721
|
+
if (offlinePage) {
|
|
722
|
+
return offlinePage;
|
|
723
|
+
}
|
|
724
|
+
}
|
|
725
|
+
|
|
726
|
+
// Return a basic offline response
|
|
727
|
+
return new Response('You are offline', {
|
|
728
|
+
status: 503,
|
|
729
|
+
statusText: 'Service Unavailable',
|
|
730
|
+
headers: {
|
|
731
|
+
'Content-Type': 'text/plain',
|
|
732
|
+
},
|
|
733
|
+
});
|
|
734
|
+
}
|
|
735
|
+
|
|
736
|
+
/**
|
|
737
|
+
* Get total cache size
|
|
738
|
+
*/
|
|
739
|
+
async function getCacheSize() {
|
|
740
|
+
let totalSize = 0;
|
|
741
|
+
const cacheNames = await caches.keys();
|
|
742
|
+
|
|
743
|
+
for (const cacheName of cacheNames) {
|
|
744
|
+
const cache = await caches.open(cacheName);
|
|
745
|
+
const keys = await cache.keys();
|
|
746
|
+
|
|
747
|
+
for (const request of keys) {
|
|
748
|
+
const response = await cache.match(request);
|
|
749
|
+
if (response) {
|
|
750
|
+
const blob = await response.clone().blob();
|
|
751
|
+
totalSize += blob.size;
|
|
752
|
+
}
|
|
753
|
+
}
|
|
754
|
+
}
|
|
755
|
+
|
|
756
|
+
return totalSize;
|
|
757
|
+
}
|
|
758
|
+
|
|
759
|
+
/**
|
|
760
|
+
* Enforce cache storage limits
|
|
761
|
+
*/
|
|
762
|
+
async function enforceCacheLimits() {
|
|
763
|
+
const cache = await caches.open(CACHE_NAME);
|
|
764
|
+
const keys = await cache.keys();
|
|
765
|
+
|
|
766
|
+
// Get cache entries with metadata
|
|
767
|
+
const entries = [];
|
|
768
|
+
for (const request of keys) {
|
|
769
|
+
const response = await cache.match(request);
|
|
770
|
+
if (response) {
|
|
771
|
+
const blob = await response.clone().blob();
|
|
772
|
+
const cachedDate = response.headers.get('sw-cache-date');
|
|
773
|
+
entries.push({
|
|
774
|
+
request,
|
|
775
|
+
size: blob.size,
|
|
776
|
+
date: cachedDate ? new Date(cachedDate) : new Date(),
|
|
777
|
+
});
|
|
778
|
+
}
|
|
779
|
+
}
|
|
780
|
+
|
|
781
|
+
// Check total size limit
|
|
782
|
+
if (CACHE_CONFIG.maxSize > 0) {
|
|
783
|
+
const totalSize = entries.reduce((sum, e) => sum + e.size, 0);
|
|
784
|
+
|
|
785
|
+
if (totalSize > CACHE_CONFIG.maxSize) {
|
|
786
|
+
console.log('[SW] Cache size exceeded, purging...');
|
|
787
|
+
await purgeCache(entries, cache, CACHE_CONFIG.maxSize);
|
|
788
|
+
}
|
|
789
|
+
}
|
|
790
|
+
|
|
791
|
+
// Check max entries limit
|
|
792
|
+
if (CACHE_CONFIG.maxEntries > 0 && entries.length > CACHE_CONFIG.maxEntries) {
|
|
793
|
+
console.log('[SW] Cache entries exceeded, purging...');
|
|
794
|
+
await purgeByEntryCount(entries, cache, CACHE_CONFIG.maxEntries);
|
|
795
|
+
}
|
|
796
|
+
|
|
797
|
+
// Check max age limit
|
|
798
|
+
if (CACHE_CONFIG.maxAge > 0) {
|
|
799
|
+
const now = Date.now();
|
|
800
|
+
const expiredEntries = entries.filter(e => (now - e.date.getTime()) > CACHE_CONFIG.maxAge);
|
|
801
|
+
|
|
802
|
+
for (const entry of expiredEntries) {
|
|
803
|
+
console.log('[SW] Removing expired cache entry:', entry.request.url);
|
|
804
|
+
await cache.delete(entry.request);
|
|
805
|
+
}
|
|
806
|
+
}
|
|
807
|
+
}
|
|
808
|
+
|
|
809
|
+
/**
|
|
810
|
+
* Purge cache to meet size limit
|
|
811
|
+
*/
|
|
812
|
+
async function purgeCache(entries, cache, maxSize) {
|
|
813
|
+
// Sort by purge strategy
|
|
814
|
+
const sorted = [...entries];
|
|
815
|
+
|
|
816
|
+
switch (CACHE_CONFIG.purgeStrategy) {
|
|
817
|
+
case 'lru':
|
|
818
|
+
// Least Recently Used - remove oldest first
|
|
819
|
+
sorted.sort((a, b) => a.date.getTime() - b.date.getTime());
|
|
820
|
+
break;
|
|
821
|
+
case 'fifo':
|
|
822
|
+
// First In First Out - same as lru for our purposes
|
|
823
|
+
sorted.sort((a, b) => a.date.getTime() - b.date.getTime());
|
|
824
|
+
break;
|
|
825
|
+
case 'lfu':
|
|
826
|
+
// Least Frequently Used - we don't track frequency, use size as proxy
|
|
827
|
+
sorted.sort((a, b) => b.size - a.size);
|
|
828
|
+
break;
|
|
829
|
+
default:
|
|
830
|
+
sorted.sort((a, b) => a.date.getTime() - b.date.getTime());
|
|
831
|
+
}
|
|
832
|
+
|
|
833
|
+
let currentSize = entries.reduce((sum, e) => sum + e.size, 0);
|
|
834
|
+
|
|
835
|
+
for (const entry of sorted) {
|
|
836
|
+
if (currentSize <= maxSize * 0.8) { // Keep 80% buffer
|
|
837
|
+
break;
|
|
838
|
+
}
|
|
839
|
+
|
|
840
|
+
// Don't delete essential assets
|
|
841
|
+
const url = entry.request.url;
|
|
842
|
+
if (PRECACHE_ASSETS.some(asset => url.endsWith(asset))) {
|
|
843
|
+
continue;
|
|
844
|
+
}
|
|
845
|
+
|
|
846
|
+
console.log('[SW] Purging cache entry:', url);
|
|
847
|
+
await cache.delete(entry.request);
|
|
848
|
+
currentSize -= entry.size;
|
|
849
|
+
}
|
|
850
|
+
}
|
|
851
|
+
|
|
852
|
+
/**
|
|
853
|
+
* Purge cache by entry count
|
|
854
|
+
*/
|
|
855
|
+
async function purgeByEntryCount(entries, cache, maxEntries) {
|
|
856
|
+
const sorted = [...entries].sort((a, b) => a.date.getTime() - b.date.getTime());
|
|
857
|
+
const toRemove = sorted.slice(0, entries.length - maxEntries);
|
|
858
|
+
|
|
859
|
+
for (const entry of toRemove) {
|
|
860
|
+
// Don't delete essential assets
|
|
861
|
+
const url = entry.request.url;
|
|
862
|
+
if (PRECACHE_ASSETS.some(asset => url.endsWith(asset))) {
|
|
863
|
+
continue;
|
|
864
|
+
}
|
|
865
|
+
|
|
866
|
+
await cache.delete(entry.request);
|
|
867
|
+
}
|
|
868
|
+
}
|
|
869
|
+
|
|
870
|
+
console.log('[SW] Service Worker loaded - Version:', CACHE_VERSION);
|
|
871
|
+
`}function t(){return`
|
|
872
|
+
/**
|
|
873
|
+
* Push event - handle incoming push notifications
|
|
874
|
+
*/
|
|
875
|
+
self.addEventListener('push', (event) => {
|
|
876
|
+
console.log('[SW] Push notification received');
|
|
877
|
+
|
|
878
|
+
let data = {
|
|
879
|
+
title: 'Notification',
|
|
880
|
+
body: 'You have a new notification',
|
|
881
|
+
icon: PUSH_CONFIG.defaultIcon,
|
|
882
|
+
badge: PUSH_CONFIG.defaultBadge,
|
|
883
|
+
};
|
|
884
|
+
|
|
885
|
+
if (event.data) {
|
|
886
|
+
try {
|
|
887
|
+
const payload = event.data.json();
|
|
888
|
+
data = { ...data, ...payload };
|
|
889
|
+
}
|
|
890
|
+
catch {
|
|
891
|
+
data.body = event.data.text();
|
|
892
|
+
}
|
|
893
|
+
}
|
|
894
|
+
|
|
895
|
+
const options = {
|
|
896
|
+
body: data.body,
|
|
897
|
+
icon: data.icon || PUSH_CONFIG.defaultIcon,
|
|
898
|
+
badge: data.badge || PUSH_CONFIG.defaultBadge,
|
|
899
|
+
vibrate: data.vibrate || [100, 50, 100],
|
|
900
|
+
data: {
|
|
901
|
+
url: data.url || '/',
|
|
902
|
+
...data.data,
|
|
903
|
+
},
|
|
904
|
+
actions: data.actions || [],
|
|
905
|
+
tag: data.tag,
|
|
906
|
+
renotify: data.renotify || false,
|
|
907
|
+
requireInteraction: data.requireInteraction || false,
|
|
908
|
+
silent: data.silent || false,
|
|
909
|
+
};
|
|
910
|
+
|
|
911
|
+
event.waitUntil(
|
|
912
|
+
self.registration.showNotification(data.title, options)
|
|
913
|
+
);
|
|
914
|
+
});
|
|
915
|
+
|
|
916
|
+
/**
|
|
917
|
+
* Notification click event - handle notification interactions
|
|
918
|
+
*/
|
|
919
|
+
self.addEventListener('notificationclick', (event) => {
|
|
920
|
+
console.log('[SW] Notification clicked:', event.action);
|
|
921
|
+
event.notification.close();
|
|
922
|
+
|
|
923
|
+
const url = event.notification.data?.url || '/';
|
|
924
|
+
|
|
925
|
+
event.waitUntil(
|
|
926
|
+
clients.matchAll({ type: 'window', includeUncontrolled: true }).then((windowClients) => {
|
|
927
|
+
// Check if there's already a window open with this URL
|
|
928
|
+
for (const client of windowClients) {
|
|
929
|
+
if (client.url === url && 'focus' in client) {
|
|
930
|
+
return client.focus();
|
|
931
|
+
}
|
|
932
|
+
}
|
|
933
|
+
// Open a new window
|
|
934
|
+
if (clients.openWindow) {
|
|
935
|
+
return clients.openWindow(url);
|
|
936
|
+
}
|
|
937
|
+
})
|
|
938
|
+
);
|
|
939
|
+
});
|
|
940
|
+
|
|
941
|
+
/**
|
|
942
|
+
* Notification close event
|
|
943
|
+
*/
|
|
944
|
+
self.addEventListener('notificationclose', (event) => {
|
|
945
|
+
console.log('[SW] Notification closed');
|
|
946
|
+
|
|
947
|
+
// Track notification dismissal if needed
|
|
948
|
+
const data = event.notification.data;
|
|
949
|
+
if (data?.trackDismiss) {
|
|
950
|
+
// Could send analytics here
|
|
951
|
+
}
|
|
952
|
+
});
|
|
953
|
+
`}function jj(){return`
|
|
954
|
+
/**
|
|
955
|
+
* Background sync queue storage (IndexedDB)
|
|
956
|
+
*/
|
|
957
|
+
const SYNC_STORE = 'stx-sync-store';
|
|
958
|
+
let syncDb = null;
|
|
959
|
+
|
|
960
|
+
async function getSyncDb() {
|
|
961
|
+
if (syncDb) return syncDb;
|
|
962
|
+
|
|
963
|
+
return new Promise((resolve, reject) => {
|
|
964
|
+
const request = indexedDB.open(SYNC_STORE, 1);
|
|
965
|
+
|
|
966
|
+
request.onerror = () => reject(request.error);
|
|
967
|
+
request.onsuccess = () => {
|
|
968
|
+
syncDb = request.result;
|
|
969
|
+
resolve(syncDb);
|
|
970
|
+
};
|
|
971
|
+
|
|
972
|
+
request.onupgradeneeded = (event) => {
|
|
973
|
+
const db = event.target.result;
|
|
974
|
+
if (!db.objectStoreNames.contains('queue')) {
|
|
975
|
+
db.createObjectStore('queue', { keyPath: 'id', autoIncrement: true });
|
|
976
|
+
}
|
|
977
|
+
};
|
|
978
|
+
});
|
|
979
|
+
}
|
|
980
|
+
|
|
981
|
+
/**
|
|
982
|
+
* Add request to sync queue
|
|
983
|
+
*/
|
|
984
|
+
async function addToSyncQueue(request) {
|
|
985
|
+
const db = await getSyncDb();
|
|
986
|
+
const tx = db.transaction('queue', 'readwrite');
|
|
987
|
+
const store = tx.objectStore('queue');
|
|
988
|
+
|
|
989
|
+
const data = {
|
|
990
|
+
url: request.url,
|
|
991
|
+
method: request.method,
|
|
992
|
+
headers: Object.fromEntries(request.headers.entries()),
|
|
993
|
+
body: await request.clone().text(),
|
|
994
|
+
timestamp: Date.now(),
|
|
995
|
+
retries: 0,
|
|
996
|
+
};
|
|
997
|
+
|
|
998
|
+
return new Promise((resolve, reject) => {
|
|
999
|
+
const req = store.add(data);
|
|
1000
|
+
req.onsuccess = () => resolve(req.result);
|
|
1001
|
+
req.onerror = () => reject(req.error);
|
|
1002
|
+
});
|
|
1003
|
+
}
|
|
1004
|
+
|
|
1005
|
+
/**
|
|
1006
|
+
* Get all pending sync requests
|
|
1007
|
+
*/
|
|
1008
|
+
async function getPendingSyncRequests() {
|
|
1009
|
+
const db = await getSyncDb();
|
|
1010
|
+
const tx = db.transaction('queue', 'readonly');
|
|
1011
|
+
const store = tx.objectStore('queue');
|
|
1012
|
+
|
|
1013
|
+
return new Promise((resolve, reject) => {
|
|
1014
|
+
const req = store.getAll();
|
|
1015
|
+
req.onsuccess = () => resolve(req.result);
|
|
1016
|
+
req.onerror = () => reject(req.error);
|
|
1017
|
+
});
|
|
1018
|
+
}
|
|
1019
|
+
|
|
1020
|
+
/**
|
|
1021
|
+
* Remove request from sync queue
|
|
1022
|
+
*/
|
|
1023
|
+
async function removeSyncRequest(id) {
|
|
1024
|
+
const db = await getSyncDb();
|
|
1025
|
+
const tx = db.transaction('queue', 'readwrite');
|
|
1026
|
+
const store = tx.objectStore('queue');
|
|
1027
|
+
|
|
1028
|
+
return new Promise((resolve, reject) => {
|
|
1029
|
+
const req = store.delete(id);
|
|
1030
|
+
req.onsuccess = () => resolve();
|
|
1031
|
+
req.onerror = () => reject(req.error);
|
|
1032
|
+
});
|
|
1033
|
+
}
|
|
1034
|
+
|
|
1035
|
+
/**
|
|
1036
|
+
* Update sync request retry count
|
|
1037
|
+
*/
|
|
1038
|
+
async function updateSyncRetries(id, retries) {
|
|
1039
|
+
const db = await getSyncDb();
|
|
1040
|
+
const tx = db.transaction('queue', 'readwrite');
|
|
1041
|
+
const store = tx.objectStore('queue');
|
|
1042
|
+
|
|
1043
|
+
const req = store.get(id);
|
|
1044
|
+
req.onsuccess = () => {
|
|
1045
|
+
const data = req.result;
|
|
1046
|
+
if (data) {
|
|
1047
|
+
data.retries = retries;
|
|
1048
|
+
store.put(data);
|
|
1049
|
+
}
|
|
1050
|
+
};
|
|
1051
|
+
}
|
|
1052
|
+
|
|
1053
|
+
/**
|
|
1054
|
+
* Sync event - process queued requests when online
|
|
1055
|
+
*/
|
|
1056
|
+
self.addEventListener('sync', (event) => {
|
|
1057
|
+
console.log('[SW] Sync event:', event.tag);
|
|
1058
|
+
|
|
1059
|
+
if (event.tag === SYNC_CONFIG.queueName || event.tag === 'stx-form-sync') {
|
|
1060
|
+
event.waitUntil(processBackgroundSync());
|
|
1061
|
+
}
|
|
1062
|
+
});
|
|
1063
|
+
|
|
1064
|
+
/**
|
|
1065
|
+
* Process all queued sync requests
|
|
1066
|
+
*/
|
|
1067
|
+
async function processBackgroundSync() {
|
|
1068
|
+
console.log('[SW] Processing background sync queue');
|
|
1069
|
+
|
|
1070
|
+
const requests = await getPendingSyncRequests();
|
|
1071
|
+
console.log('[SW] Pending sync requests:', requests.length);
|
|
1072
|
+
|
|
1073
|
+
for (const request of requests) {
|
|
1074
|
+
if (request.retries >= SYNC_CONFIG.maxRetries) {
|
|
1075
|
+
console.log('[SW] Max retries reached, removing:', request.url);
|
|
1076
|
+
await removeSyncRequest(request.id);
|
|
1077
|
+
continue;
|
|
1078
|
+
}
|
|
1079
|
+
|
|
1080
|
+
try {
|
|
1081
|
+
const response = await fetch(request.url, {
|
|
1082
|
+
method: request.method,
|
|
1083
|
+
headers: request.headers,
|
|
1084
|
+
body: request.method !== 'GET' ? request.body : undefined,
|
|
1085
|
+
});
|
|
1086
|
+
|
|
1087
|
+
if (response.ok) {
|
|
1088
|
+
console.log('[SW] Sync succeeded:', request.url);
|
|
1089
|
+
await removeSyncRequest(request.id);
|
|
1090
|
+
|
|
1091
|
+
// Notify clients of successful sync
|
|
1092
|
+
const clients = await self.clients.matchAll();
|
|
1093
|
+
clients.forEach(client => {
|
|
1094
|
+
client.postMessage({
|
|
1095
|
+
type: 'SYNC_COMPLETE',
|
|
1096
|
+
url: request.url,
|
|
1097
|
+
success: true,
|
|
1098
|
+
});
|
|
1099
|
+
});
|
|
1100
|
+
}
|
|
1101
|
+
else {
|
|
1102
|
+
throw new Error('Response not ok: ' + response.status);
|
|
1103
|
+
}
|
|
1104
|
+
}
|
|
1105
|
+
catch (error) {
|
|
1106
|
+
console.log('[SW] Sync failed, will retry:', request.url, error.message);
|
|
1107
|
+
await updateSyncRetries(request.id, request.retries + 1);
|
|
1108
|
+
}
|
|
1109
|
+
}
|
|
1110
|
+
}
|
|
1111
|
+
|
|
1112
|
+
/**
|
|
1113
|
+
* Register a form for background sync
|
|
1114
|
+
* Called from main thread via message
|
|
1115
|
+
*/
|
|
1116
|
+
async function registerFormSync(formData) {
|
|
1117
|
+
// Store form data in IndexedDB
|
|
1118
|
+
await addToSyncQueue({
|
|
1119
|
+
url: formData.action,
|
|
1120
|
+
method: formData.method || 'POST',
|
|
1121
|
+
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
|
|
1122
|
+
clone: () => ({ text: async () => new URLSearchParams(formData.data).toString() }),
|
|
1123
|
+
});
|
|
1124
|
+
|
|
1125
|
+
// Register for background sync
|
|
1126
|
+
await self.registration.sync.register(SYNC_CONFIG.queueName);
|
|
1127
|
+
}
|
|
1128
|
+
|
|
1129
|
+
// Listen for form sync requests
|
|
1130
|
+
self.addEventListener('message', (event) => {
|
|
1131
|
+
if (event.data?.type === 'REGISTER_FORM_SYNC') {
|
|
1132
|
+
event.waitUntil(registerFormSync(event.data.payload));
|
|
1133
|
+
}
|
|
1134
|
+
});
|
|
1135
|
+
`}function z(j){return j.pwa?.serviceWorker?.fileName||"sw.js"}function y(j){return j.pwa?.enabled===!0&&j.pwa?.serviceWorker?.useWorkbox===!0}function qj(j,q){if(!j.pwa?.enabled)return"";if(y(j)){let{generateWorkboxServiceWorker:K}=(x(),W(D));return K(j,q)}return w(j,q)}var H=G(()=>{F()});H();function I(j){let q=j.pwa;if(!q?.enabled)return"";let K=q.manifest,Q=q.icons?.outputDir?`/${q.icons.outputDir}`:"/pwa-icons",Y=z(j),X=`
|
|
1136
|
+
<!-- stx PWA Meta Tags -->
|
|
1137
|
+
<link rel="manifest" href="/manifest.json">
|
|
1138
|
+
<meta name="theme-color" content="${N(K?.themeColor||"#000000")}">
|
|
1139
|
+
<meta name="mobile-web-app-capable" content="yes">
|
|
1140
|
+
<meta name="apple-mobile-web-app-capable" content="yes">
|
|
1141
|
+
<meta name="apple-mobile-web-app-status-bar-style" content="default">
|
|
1142
|
+
<meta name="apple-mobile-web-app-title" content="${N(K?.shortName||K?.name||"App")}">`;if(q.icons?.generateAppleIcons!==!1)X+=`
|
|
1143
|
+
<link rel="apple-touch-icon" href="${Q}/apple-touch-icon.png">
|
|
1144
|
+
<link rel="apple-touch-icon" sizes="120x120" href="${Q}/apple-touch-icon-120x120.png">
|
|
1145
|
+
<link rel="apple-touch-icon" sizes="152x152" href="${Q}/apple-touch-icon-152x152.png">
|
|
1146
|
+
<link rel="apple-touch-icon" sizes="167x167" href="${Q}/apple-touch-icon-167x167.png">
|
|
1147
|
+
<link rel="apple-touch-icon" sizes="180x180" href="${Q}/apple-touch-icon-180x180.png">`;return X+=`
|
|
1148
|
+
<link rel="icon" type="image/png" sizes="32x32" href="${Q}/favicon-32x32.png">
|
|
1149
|
+
<link rel="icon" type="image/png" sizes="16x16" href="${Q}/favicon-16x16.png">
|
|
1150
|
+
<link rel="icon" type="image/png" sizes="192x192" href="${Q}/icon-192x192.png">`,X+=`
|
|
1151
|
+
<!-- stx Service Worker Registration -->
|
|
1152
|
+
<script>
|
|
1153
|
+
if ('serviceWorker' in navigator) {
|
|
1154
|
+
window.addEventListener('load', function() {
|
|
1155
|
+
navigator.serviceWorker.register('/${Y}')
|
|
1156
|
+
.then(function(registration) {
|
|
1157
|
+
console.log('[PWA] Service Worker registered:', registration.scope);
|
|
1158
|
+
|
|
1159
|
+
// Check for updates
|
|
1160
|
+
registration.addEventListener('updatefound', function() {
|
|
1161
|
+
const newWorker = registration.installing;
|
|
1162
|
+
if (newWorker) {
|
|
1163
|
+
newWorker.addEventListener('statechange', function() {
|
|
1164
|
+
if (newWorker.state === 'installed' && navigator.serviceWorker.controller) {
|
|
1165
|
+
console.log('[PWA] New content available, refresh to update');
|
|
1166
|
+
// Optionally dispatch a custom event for UI notification
|
|
1167
|
+
window.dispatchEvent(new CustomEvent('pwa-update-available'));
|
|
1168
|
+
}
|
|
1169
|
+
});
|
|
1170
|
+
}
|
|
1171
|
+
});
|
|
1172
|
+
})
|
|
1173
|
+
.catch(function(error) {
|
|
1174
|
+
console.error('[PWA] Service Worker registration failed:', error);
|
|
1175
|
+
});
|
|
1176
|
+
});
|
|
1177
|
+
}
|
|
1178
|
+
</script>
|
|
1179
|
+
<!-- End stx PWA -->`,X}function Lj(j,q){let K=q.pwa;if(!K?.enabled||K.autoInject===!1)return j;if(j.includes("<!-- stx PWA Meta Tags -->"))return j;if(!j.includes("</head>")){let Y=j.lastIndexOf("</body>");if(Y!==-1){let X=I(q);return j.slice(0,Y)+X+`
|
|
1180
|
+
`+j.slice(Y)}return j+I(q)}let Q=I(q);return j.replace("</head>",`${Q}
|
|
1181
|
+
</head>`)}function Uj(j){if(!j.pwa?.enabled)return"";return`<script>
|
|
1182
|
+
if ('serviceWorker' in navigator) {
|
|
1183
|
+
window.addEventListener('load', function() {
|
|
1184
|
+
navigator.serviceWorker.register('/${z(j)}')
|
|
1185
|
+
.then(function(registration) {
|
|
1186
|
+
console.log('[PWA] Service Worker registered:', registration.scope);
|
|
1187
|
+
})
|
|
1188
|
+
.catch(function(error) {
|
|
1189
|
+
console.error('[PWA] Service Worker registration failed:', error);
|
|
1190
|
+
});
|
|
1191
|
+
});
|
|
1192
|
+
}
|
|
1193
|
+
</script>`}function Vj(){return'<link rel="manifest" href="/manifest.json">'}function Aj(j){return`<meta name="theme-color" content="${N(j)}">`}function N(j){return j.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}
|
|
1194
|
+
export{U as Mk,J as Nk,E as Ok,F as Pk,w as Qk,z as Rk,y as Sk,qj as Tk,H as Uk,I as Vk,Lj as Wk,Uj as Xk,Vj as Yk,Aj as Zk};
|