@stacksjs/stx 0.2.571 → 0.2.573
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/a11y.d.ts +51 -111
- package/dist/animation.d.ts +131 -74
- package/dist/api-client.d.ts +11 -21
- package/dist/api-handler.d.ts +4 -4
- package/dist/appearance-bootstrap.d.ts +16 -77
- package/dist/application-layers.d.ts +11 -20
- package/dist/asset-roots.d.ts +7 -27
- package/dist/assets.d.ts +7 -9
- package/dist/async-components.d.ts +56 -78
- package/dist/auth.d.ts +0 -3
- package/dist/browser-core-imports.d.ts +2 -2
- package/dist/build-externalize-repeated.d.ts +0 -25
- package/dist/build-externalize.d.ts +18 -53
- package/dist/build-id.d.ts +40 -28
- package/dist/build-message.d.ts +20 -44
- package/dist/builtins/attrs.d.ts +0 -14
- package/dist/builtins/drawer.d.ts +3 -22
- package/dist/builtins/icon.d.ts +17 -19
- package/dist/builtins/image-alpha.d.ts +8 -8
- package/dist/builtins/image-delivery.d.ts +38 -40
- package/dist/builtins/image-placeholder.d.ts +12 -50
- package/dist/builtins/image-warmup-worker.d.ts +1 -1
- package/dist/builtins/image-worker.d.ts +6 -32
- package/dist/builtins/index.d.ts +16 -6
- package/dist/builtins/modal.d.ts +13 -23
- package/dist/builtins/safe-image.d.ts +2 -42
- package/dist/builtins/stx-image.d.ts +44 -24
- package/dist/builtins/stx-link.d.ts +5 -8
- package/dist/builtins/stx-loading-indicator.d.ts +11 -10
- package/dist/builtins/suspense.d.ts +6 -27
- package/dist/builtins/toast.d.ts +15 -16
- package/dist/builtins/transition-group.d.ts +1 -25
- package/dist/caching.d.ts +24 -21
- package/dist/{chunk-f4jh9vrj.js → chunk-0s647d0b.js} +53 -53
- package/dist/{chunk-09gtbb1w.js → chunk-1bsafdnt.js} +1 -1
- package/dist/{chunk-m6mxqepz.js → chunk-1btr5tme.js} +1 -1
- package/dist/{chunk-01mxer9s.js → chunk-2g6wcnna.js} +1 -1
- package/dist/{chunk-rrj5m9xv.js → chunk-2hg2bqtj.js} +1 -1
- package/dist/{chunk-xckzvbvn.js → chunk-4f0fh2a9.js} +1 -1
- package/dist/chunk-557wtdps.js +2 -0
- package/dist/{chunk-vr36s2en.js → chunk-58vrf6kh.js} +1 -1
- package/dist/{chunk-qzbzn1yf.js → chunk-6tsnz28m.js} +1 -1
- package/dist/{chunk-cvswrbzw.js → chunk-6x8cwscv.js} +1 -1
- package/dist/{chunk-1n64749x.js → chunk-74ew8ajw.js} +1 -1
- package/dist/{chunk-jqefcghh.js → chunk-78d6yyxz.js} +2 -2
- package/dist/{chunk-83fdt4yj.js → chunk-824cnbac.js} +1 -1
- package/dist/{chunk-ntgy4e1q.js → chunk-864xm0jy.js} +1 -1
- package/dist/{chunk-nn174xjh.js → chunk-9fbkdrm8.js} +1 -1
- package/dist/{chunk-kzjrgh0b.js → chunk-a3gvw1q2.js} +1 -1
- package/dist/{chunk-pqcvh9pp.js → chunk-amtrg7pn.js} +1 -1
- package/dist/{chunk-pw9verqx.js → chunk-b5fpsp5n.js} +1 -1
- package/dist/{chunk-5afw7z6v.js → chunk-bcjr3fw7.js} +1 -1
- package/dist/{chunk-n6qp05t9.js → chunk-bkj0j5se.js} +1 -1
- package/dist/{chunk-mzqyv7s5.js → chunk-cf97xdqa.js} +1 -1
- package/dist/{chunk-cgwyd9aq.js → chunk-cr67dpx4.js} +1 -1
- package/dist/{chunk-f1apaqfk.js → chunk-dpqvacd1.js} +1 -1
- package/dist/{chunk-ghy82tsc.js → chunk-et8726at.js} +1 -1
- package/dist/{chunk-4bgfpkwx.js → chunk-ev8t5cxk.js} +1 -1
- package/dist/{chunk-4ssg5xpq.js → chunk-fynh3bkq.js} +12 -2
- package/dist/{chunk-gzgc8zk5.js → chunk-g8757f97.js} +2 -2
- package/dist/{chunk-3gft8zng.js → chunk-hm4j4d8q.js} +1 -1
- package/dist/{chunk-0bt0fbs1.js → chunk-j9qy9t3t.js} +5 -5
- package/dist/{chunk-2a1q5y6r.js → chunk-jhc47xzj.js} +1 -1
- package/dist/{chunk-79vdkvhf.js → chunk-kns5m52j.js} +1 -1
- package/dist/{chunk-2cqbyb8w.js → chunk-mjpewk4r.js} +1 -1
- package/dist/{chunk-2jjff8kv.js → chunk-nj488tj2.js} +2 -2
- package/dist/{chunk-dcpf6kas.js → chunk-q9chv68c.js} +1 -1
- package/dist/{chunk-xq2ck69k.js → chunk-qm280dp3.js} +1 -1
- package/dist/{chunk-ymawe0y5.js → chunk-sjcstv33.js} +1 -1
- package/dist/{chunk-tc5r2vmw.js → chunk-t0zdz8kd.js} +1 -1
- package/dist/{chunk-jwvzvapp.js → chunk-t3dnak1j.js} +1 -1
- package/dist/{chunk-2jsnrfc8.js → chunk-t64nnmmj.js} +1 -1
- package/dist/{chunk-m2a1fxpb.js → chunk-tvb8p7c0.js} +1 -1
- package/dist/{chunk-6f4qrd0s.js → chunk-tyhgq6rw.js} +1 -1
- package/dist/{chunk-4wfr074d.js → chunk-vn7tc8hm.js} +1 -1
- package/dist/{chunk-y4ajd836.js → chunk-xy6g8zb9.js} +1 -1
- package/dist/{chunk-zddzjd60.js → chunk-ya7xks9t.js} +1 -1
- package/dist/chunk-zpz6q2fh.js +2 -0
- package/dist/chunk-zxt94g45.js +2 -0
- package/dist/{chunk-cyg9w31a.js → chunk-zz7tw07b.js} +1 -1
- package/dist/{chunk-ta8bhz27.js → chunk-zzcxacjf.js} +1 -1
- package/dist/cli.js +7 -7
- package/dist/client/directive.d.ts +0 -7
- package/dist/client/index.d.ts +1 -0
- package/dist/client/signals-appearance-runtime.d.ts +1 -1
- package/dist/client/signals-binding-utils-runtime.d.ts +1 -1
- package/dist/client/signals-bootstrap-runtime.d.ts +2 -2
- package/dist/client/signals-class-runtime.d.ts +1 -1
- package/dist/client/signals-component-api-runtime.d.ts +1 -1
- package/dist/client/signals-component-hydration-runtime.d.ts +1 -1
- package/dist/client/signals-component-props-runtime.d.ts +1 -1
- package/dist/client/signals-conditional-chain-runtime.d.ts +1 -1
- package/dist/client/signals-conditional-component-runtime.d.ts +1 -1
- package/dist/client/signals-container-cleanup-runtime.d.ts +1 -1
- package/dist/client/signals-context-runtime.d.ts +1 -1
- package/dist/client/signals-cookie-runtime.d.ts +1 -1
- package/dist/client/signals-devtools-runtime.d.ts +1 -1
- package/dist/client/signals-dialog-runtime.d.ts +1 -1
- package/dist/client/signals-dom-ready-runtime.d.ts +1 -1
- package/dist/client/signals-drawer-runtime.d.ts +1 -1
- package/dist/client/signals-effect-runtime.d.ts +1 -1
- package/dist/client/signals-event-shorthand-runtime.d.ts +1 -1
- package/dist/client/signals-expression-compiler-runtime.d.ts +1 -1
- package/dist/client/signals-expression-runtime.d.ts +1 -1
- package/dist/client/signals-fetch-transport-runtime.d.ts +1 -1
- package/dist/client/signals-for-runtime.d.ts +1 -1
- package/dist/client/signals-globals-runtime.d.ts +1 -1
- package/dist/client/signals-handler-runtime.d.ts +1 -1
- package/dist/client/signals-head-runtime.d.ts +1 -1
- package/dist/client/signals-helpers-runtime.d.ts +1 -1
- package/dist/client/signals-host-runtime.d.ts +1 -1
- package/dist/client/signals-hydration-audit-runtime.d.ts +1 -1
- package/dist/client/signals-hydration-runtime.d.ts +1 -1
- package/dist/client/signals-if-chain-runtime.d.ts +1 -1
- package/dist/client/signals-if-runtime.d.ts +1 -1
- package/dist/client/signals-lazy-hydration-runtime.d.ts +1 -1
- package/dist/client/signals-lifecycle-runtime.d.ts +1 -1
- package/dist/client/signals-loop-component-remap-runtime.d.ts +1 -1
- package/dist/client/signals-loop-conditional-runtime.d.ts +1 -1
- package/dist/client/signals-loop-row-runtime.d.ts +1 -1
- package/dist/client/signals-manifest-hydration-runtime.d.ts +1 -1
- package/dist/client/signals-model-runtime.d.ts +1 -1
- package/dist/client/signals-mount-runtime.d.ts +1 -1
- package/dist/client/signals-navigation-runtime.d.ts +1 -1
- package/dist/client/signals-notify-runtime.d.ts +1 -1
- package/dist/client/signals-optimistic-runtime.d.ts +1 -1
- package/dist/client/signals-overlay-runtime.d.ts +1 -1
- package/dist/client/signals-pipe-runtime.d.ts +1 -1
- package/dist/client/signals-proxy-runtime.d.ts +1 -1
- package/dist/client/signals-query-runtime.d.ts +1 -1
- package/dist/client/signals-reactive-runtime.d.ts +1 -1
- package/dist/client/signals-ref-runtime.d.ts +1 -1
- package/dist/client/signals-scope-disposal-runtime.d.ts +1 -1
- package/dist/client/signals-scope-traversal-runtime.d.ts +1 -1
- package/dist/client/signals-show-runtime.d.ts +1 -1
- package/dist/client/signals-spa-load-control-runtime.d.ts +1 -1
- package/dist/client/signals-spa-load-runtime.d.ts +1 -1
- package/dist/client/signals-state-runtime.d.ts +1 -1
- package/dist/client/signals-storage-runtime.d.ts +1 -1
- package/dist/client/signals-store-registry-runtime.d.ts +1 -1
- package/dist/client/signals-style-runtime.d.ts +1 -1
- package/dist/client/signals-suspense-runtime.d.ts +1 -1
- package/dist/client/signals-timer-runtime.d.ts +1 -1
- package/dist/client/signals-toast-runtime.d.ts +1 -1
- package/dist/client/signals-tooltip-runtime.d.ts +1 -1
- package/dist/client/signals-transition-group-runtime.d.ts +1 -1
- package/dist/client/signals-websocket-runtime.d.ts +1 -1
- package/dist/client-helpers.d.ts +1 -312
- package/dist/client-module-registry.d.ts +4 -27
- package/dist/client-parameter-bindings.d.ts +1 -4
- package/dist/client-script-bundler.d.ts +55 -103
- package/dist/client-script.d.ts +69 -127
- package/dist/color-mode-boot.d.ts +21 -58
- package/dist/component-client-factories.d.ts +8 -9
- package/dist/component-contract-checks.d.ts +15 -18
- package/dist/component-contract.d.ts +6 -6
- package/dist/component-hmr.d.ts +8 -7
- package/dist/component-model.d.ts +14 -20
- package/dist/component-processing.d.ts +51 -59
- package/dist/component-registry.d.ts +28 -99
- package/dist/component-renderer.d.ts +19 -16
- package/dist/component-resolution.d.ts +8 -8
- package/dist/component-tags.d.ts +1 -1
- package/dist/composable-loader.d.ts +6 -41
- package/dist/composables/use-fetch.d.ts +45 -114
- package/dist/composables/use-form.d.ts +2 -56
- package/dist/composables/use-intersection-observer.d.ts +1 -1
- package/dist/composables.d.ts +75 -74
- package/dist/composition-api.d.ts +19 -43
- package/dist/computed.d.ts +93 -86
- package/dist/conditionals.d.ts +0 -24
- package/dist/config.d.ts +30 -24
- package/dist/config.js +3 -0
- package/dist/craft-bridge.d.ts +1 -467
- package/dist/craft-components.d.ts +234 -680
- package/dist/craft-entry.js +1 -1
- package/dist/craft.js +1 -1
- package/dist/csp.d.ts +41 -107
- package/dist/database.d.ts +1 -1
- package/dist/defer.d.ts +0 -24
- package/dist/dev-server/terminal-colors.d.ts +32 -32
- package/dist/dev-server/ts-css.d.ts +26 -35
- package/dist/dev-server/types.d.ts +33 -29
- package/dist/directive-api.d.ts +42 -85
- package/dist/directive-arguments.d.ts +14 -39
- package/dist/document-shell.d.ts +49 -81
- package/dist/dynamic-components.d.ts +0 -9
- package/dist/engine-bindings.d.ts +1 -1
- package/dist/env.d.ts +26 -0
- package/dist/error-boundaries.d.ts +36 -43
- package/dist/error-handling.d.ts +1 -1
- package/dist/errors/codes.d.ts +43 -51
- package/dist/errors/formatter.d.ts +38 -58
- package/dist/errors/index.d.ts +61 -5
- package/dist/errors/logger.d.ts +40 -114
- package/dist/errors/sanitizer.d.ts +28 -53
- package/dist/errors/types.d.ts +31 -44
- package/dist/events.d.ts +32 -94
- package/dist/expressions.d.ts +57 -62
- package/dist/find-body-tag.d.ts +5 -34
- package/dist/first-script-tag.d.ts +0 -23
- package/dist/forms-validation.d.ts +117 -149
- package/dist/forms.d.ts +161 -120
- package/dist/framework-composables.d.ts +0 -32
- package/dist/head-injection.d.ts +30 -32
- package/dist/head-keys.d.ts +12 -15
- package/dist/head.d.ts +110 -139
- package/dist/heatmap.d.ts +76 -152
- package/dist/html-masking.d.ts +38 -62
- package/dist/hydration-runtime.d.ts +24 -20
- package/dist/hydration.d.ts +11 -10
- package/dist/i18n.d.ts +34 -95
- package/dist/image-optimization/auto-sibling.d.ts +4 -32
- package/dist/imported-signals.d.ts +0 -36
- package/dist/includes.d.ts +6 -69
- package/dist/index.d.ts +2 -1
- package/dist/init.d.ts +12 -20
- package/dist/internal-markdown.d.ts +8 -12
- package/dist/interpolation-context.d.ts +15 -15
- package/dist/island-chunking.d.ts +13 -30
- package/dist/keep-alive.d.ts +52 -72
- package/dist/layout-types.d.ts +2 -27
- package/dist/lazy-module.d.ts +0 -10
- package/dist/loading-indicator.d.ts +8 -5
- package/dist/loop-binding.d.ts +4 -7
- package/dist/loops.d.ts +25 -67
- package/dist/markdown.d.ts +1 -0
- package/dist/media/image/component.d.ts +9 -25
- package/dist/media/image/directive.d.ts +1 -15
- package/dist/media/image/placeholder.d.ts +9 -20
- package/dist/media/image/processor/cache.d.ts +18 -40
- package/dist/media/image/processor/index.d.ts +10 -1
- package/dist/media/image/processor/optimizer.d.ts +1 -12
- package/dist/media/image/processor/responsive.d.ts +6 -16
- package/dist/media/image/srcset.d.ts +49 -47
- package/dist/media/shared/cache.d.ts +31 -51
- package/dist/media/shared/hash.d.ts +0 -7
- package/dist/media/types.d.ts +754 -1235
- package/dist/media/video/directive.d.ts +1 -15
- package/dist/media/video/index.d.ts +17 -39
- package/dist/media/video/processor/cache.d.ts +19 -42
- package/dist/media/video/processor/index.d.ts +18 -1
- package/dist/media/video/processor/streaming.d.ts +10 -17
- package/dist/media/video/processor/thumbnail.d.ts +15 -21
- package/dist/media/video/processor/transcoder.d.ts +1 -11
- package/dist/meta-arguments.d.ts +14 -39
- package/dist/method-spoofing.d.ts +0 -7
- package/dist/middleware.d.ts +0 -60
- package/dist/native/bridge/protocol.d.ts +2 -1
- package/dist/native/compiler/bundle.js +11 -1
- package/dist/native/compiler/headwind-to-style.d.ts +383 -359
- package/dist/native/compiler/icons.d.ts +249 -243
- package/dist/native/compiler/svg.d.ts +35 -24
- package/dist/native/runtime/jsc-globals.d.ts +1 -1
- package/dist/native/runtime/native-host.d.ts +1 -1
- package/dist/native/runtime/native-host.js +3 -0
- package/dist/offline/app-service-worker.d.ts +50 -114
- package/dist/offline/kept-store.d.ts +23 -37
- package/dist/offline/query-cache.d.ts +55 -126
- package/dist/owned-routes.d.ts +0 -31
- package/dist/page-response.d.ts +8 -39
- package/dist/parser/directive-parser.d.ts +45 -57
- package/dist/parser/expression-parser.d.ts +35 -33
- package/dist/parser/index.d.ts +39 -4
- package/dist/parser/tokenizer.d.ts +49 -61
- package/dist/partial-hydration.d.ts +51 -82
- package/dist/performance-utils.d.ts +115 -255
- package/dist/placeholder.d.ts +9 -18
- package/dist/plugin-system.d.ts +115 -264
- package/dist/process.d.ts +4 -9
- package/dist/process.js +6 -4
- package/dist/prop-sentinels.d.ts +11 -11
- package/dist/public-env.d.ts +0 -14
- package/dist/pwa/directives.d.ts +20 -12
- package/dist/pwa/inject.d.ts +0 -10
- package/dist/pwa/precache.d.ts +16 -22
- package/dist/pwa/service-worker.d.ts +0 -12
- package/dist/pwa.js +1 -1
- package/dist/reactive-bindings.d.ts +11 -34
- package/dist/reactive-tracking.d.ts +0 -36
- package/dist/reactive.d.ts +41 -58
- package/dist/render-memo.d.ts +5 -23
- package/dist/resolve-stx-targets.d.ts +6 -44
- package/dist/route-middleware.d.ts +35 -2
- package/dist/route-rules.d.ts +10 -13
- package/dist/router.d.ts +9 -8
- package/dist/routes.d.ts +3 -1
- package/dist/runtime-config-server.d.ts +14 -17
- package/dist/runtime-config.d.ts +2 -3
- package/dist/runtime-globals.d.ts +90 -122
- package/dist/runtime-injection.d.ts +0 -8
- package/dist/scaffolding.d.ts +30 -26
- package/dist/script-emit.d.ts +0 -30
- package/dist/script-validation.d.ts +6 -12
- package/dist/seo.d.ts +75 -153
- package/dist/server-api.d.ts +9 -12
- package/dist/server-bindings.d.ts +1 -26
- package/dist/server-data.d.ts +4 -5
- package/dist/sfc-template.d.ts +8 -8
- package/dist/signal-processing.d.ts +37 -53
- package/dist/signals-api.d.ts +58 -135
- package/dist/signals.d.ts +18 -24
- package/dist/site-url.d.ts +31 -28
- package/dist/slots.d.ts +20 -86
- package/dist/source-signature.d.ts +5 -28
- package/dist/ssg.d.ts +158 -337
- package/dist/ssg.js +2 -2
- package/dist/state-dir.d.ts +4 -4
- package/dist/store-loader.d.ts +0 -10
- package/dist/story/analytics.d.ts +60 -138
- package/dist/story/bookmarks.d.ts +34 -87
- package/dist/story/cli.d.ts +69 -123
- package/dist/story/collect/scanner.d.ts +0 -4
- package/dist/story/collect/tree.d.ts +1 -8
- package/dist/story/commands/build.d.ts +6 -11
- package/dist/story/commands/dev.d.ts +8 -15
- package/dist/story/commands/preview.d.ts +7 -13
- package/dist/story/config-watcher.d.ts +13 -20
- package/dist/story/config.d.ts +8 -11
- package/dist/story/context.d.ts +8 -14
- package/dist/story/hmr.d.ts +26 -24
- package/dist/story/hot-swap.d.ts +23 -34
- package/dist/story/keyboard-shortcuts.d.ts +18 -23
- package/dist/story/output.d.ts +44 -46
- package/dist/story/performance.d.ts +45 -107
- package/dist/story/presets.d.ts +41 -107
- package/dist/story/renderer.d.ts +27 -41
- package/dist/story/search.d.ts +12 -23
- package/dist/story/server.d.ts +11 -21
- package/dist/story/setup.d.ts +15 -23
- package/dist/story/testing.d.ts +40 -65
- package/dist/story/types.d.ts +160 -262
- package/dist/streaming.d.ts +57 -119
- package/dist/strip-literals.d.ts +1 -25
- package/dist/stx-module-imports.d.ts +7 -0
- package/dist/stx-virtual-ts.d.ts +102 -253
- package/dist/style-scoping.d.ts +8 -21
- package/dist/suspense.d.ts +52 -67
- package/dist/teleport.d.ts +0 -22
- package/dist/template-syntax-escape.d.ts +8 -8
- package/dist/template-tag-balance.d.ts +6 -22
- package/dist/testing.d.ts +26 -11
- package/dist/theme-tokens.d.ts +388 -134
- package/dist/transitions.d.ts +55 -66
- package/dist/ts-css-config.d.ts +12 -70
- package/dist/types/component-types.d.ts +122 -187
- package/dist/types/config-types.d.ts +341 -956
- package/dist/types/context-types.d.ts +24 -46
- package/dist/types/csp-types.d.ts +66 -70
- package/dist/types/directive-types.d.ts +156 -223
- package/dist/types/index.d.ts +110 -6
- package/dist/types/pwa-types.d.ts +148 -273
- package/dist/types.d.ts +1 -0
- package/dist/unresolved-identifiers.d.ts +22 -24
- package/dist/url-safety.d.ts +32 -32
- package/dist/utils.d.ts +21 -36
- package/dist/validator.d.ts +26 -28
- package/dist/variable-extractor.d.ts +19 -49
- package/dist/view-composers.d.ts +81 -80
- package/dist/virtual-scrolling.d.ts +82 -101
- package/dist/visual-testing.d.ts +10 -9
- package/dist/vue-template.d.ts +0 -23
- package/dist/web-components/css-scoping.d.ts +11 -21
- package/dist/web-components.d.ts +58 -81
- package/dist/x-element.d.ts +1 -0
- package/package.json +6 -6
- package/stx.d.ts +2 -2
- package/dist/app-service-worker.d.ts +0 -165
- package/dist/chunk-49gwmcrn.js +0 -2
- package/dist/chunk-6va5pe2m.js +0 -2
- package/dist/chunk-bm2q1srp.js +0 -2
- package/dist/signals-context-runtime.d.ts +0 -2
- package/dist/signals-drawer-runtime.d.ts +0 -2
- package/dist/signals-host-runtime.d.ts +0 -9
- package/dist/signals-loop-conditional-runtime.d.ts +0 -2
- package/dist/signals-manifest-hydration-runtime.d.ts +0 -2
- package/dist/signals-notify-runtime.d.ts +0 -2
- package/dist/signals-optimistic-runtime.d.ts +0 -2
- package/dist/signals-overlay-runtime.d.ts +0 -2
- package/dist/signals-scope-disposal-runtime.d.ts +0 -2
- package/dist/signals-spa-load-control-runtime.d.ts +0 -2
- package/dist/signals-storage-runtime.d.ts +0 -2
|
@@ -1,84 +1,40 @@
|
|
|
1
|
+
import type { StxOptions } from './types';
|
|
1
2
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
* Handles resolution of both builtin and file-based STX components.
|
|
5
|
-
* Builtin components (e.g., StxLink, StxImage) are registered in-memory
|
|
6
|
-
* and render directly to HTML without requiring a .stx file on disk.
|
|
7
|
-
* File-based components are resolved through a multi-strategy search
|
|
8
|
-
* that mirrors the existing resolution logic in utils.ts.
|
|
3
|
+
* Convert a kebab-case string to PascalCase.
|
|
9
4
|
*
|
|
10
|
-
* @
|
|
5
|
+
* @example kebabToPascal("stx-link") // "StxLink"
|
|
11
6
|
*/
|
|
12
|
-
|
|
7
|
+
export declare function kebabToPascal(str: string): string;
|
|
8
|
+
/** Singleton registry instance shared across the framework */
|
|
9
|
+
export declare const registry: ComponentRegistry;
|
|
13
10
|
/**
|
|
14
11
|
* Context passed to builtin component render functions.
|
|
15
12
|
*/
|
|
16
|
-
export interface RenderContext {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
/** Compiler options */
|
|
22
|
-
options: StxOptions;
|
|
23
|
-
/** Dependency set for cache invalidation tracking */
|
|
24
|
-
dependencies: Set<string>;
|
|
13
|
+
export declare interface RenderContext {
|
|
14
|
+
context: Record<string, any>
|
|
15
|
+
filePath: string
|
|
16
|
+
options: StxOptions
|
|
17
|
+
dependencies: Set<string>
|
|
25
18
|
}
|
|
26
19
|
/**
|
|
27
20
|
* Props resolved from component attributes, categorized by binding type.
|
|
28
21
|
*/
|
|
29
|
-
export interface ResolvedProps {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
* A static attribute is two things at once, and they disagree about naming.
|
|
37
|
-
* To a `.stx` component it is a prop, and `active-class` has to arrive as
|
|
38
|
-
* `$props.activeClass` because a kebab key cannot be destructured. To a
|
|
39
|
-
* builtin that forwards unconsumed attributes onto real markup it is an HTML
|
|
40
|
-
* attribute, and must go out spelled the way the author wrote it. Keeping the
|
|
41
|
-
* original here lets both be true; without it, forwarding emitted
|
|
42
|
-
* `activeClass="…"` and the browser saw an unknown attribute.
|
|
43
|
-
*
|
|
44
|
-
* Only present for names that actually changed, so `key in staticNames` is a
|
|
45
|
-
* meaningful test.
|
|
46
|
-
*/
|
|
47
|
-
staticNames: Record<string, string>;
|
|
48
|
-
/** Server-side dynamic bindings — e.g. :count="items.length" (evaluated at compile time) */
|
|
49
|
-
serverDynamic: Record<string, unknown>;
|
|
50
|
-
/**
|
|
51
|
-
* Original attribute spelling for any `serverDynamic` key that was camelized.
|
|
52
|
-
*
|
|
53
|
-
* Same reason as {@link ResolvedProps.staticNames}: a builtin forwarding an
|
|
54
|
-
* unconsumed binding onto real markup must spell it the way the author wrote
|
|
55
|
-
* it, or `:some-attr="x"` goes out as `someAttr` and the browser sees an
|
|
56
|
-
* attribute it does not know.
|
|
57
|
-
*/
|
|
58
|
-
serverDynamicNames?: Record<string, string>;
|
|
59
|
-
/** Client-side reactive bindings — expression string preserved for signals */
|
|
60
|
-
clientReactive: Record<string, string>;
|
|
61
|
-
/** Event handler bindings — e.g. @click="handler()" */
|
|
62
|
-
events: Record<string, string>;
|
|
22
|
+
export declare interface ResolvedProps {
|
|
23
|
+
static: Record<string, string | boolean>
|
|
24
|
+
staticNames: Record<string, string>
|
|
25
|
+
serverDynamic: Record<string, unknown>
|
|
26
|
+
serverDynamicNames?: Record<string, string>
|
|
27
|
+
clientReactive: Record<string, string>
|
|
28
|
+
events: Record<string, string>
|
|
63
29
|
}
|
|
64
30
|
/**
|
|
65
31
|
* Definition for a builtin component that renders without a .stx file.
|
|
66
32
|
*/
|
|
67
|
-
export interface BuiltinComponentDef {
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
aliases: string[];
|
|
72
|
-
/** Render the component to an HTML string */
|
|
73
|
-
render(props: ResolvedProps, slotContent: string, ctx: RenderContext): string;
|
|
33
|
+
export declare interface BuiltinComponentDef {
|
|
34
|
+
name: string
|
|
35
|
+
aliases: string[]
|
|
36
|
+
render(props: ResolvedProps, slotContent: string, ctx: RenderContext): string
|
|
74
37
|
}
|
|
75
|
-
/**
|
|
76
|
-
* Convert a kebab-case string to PascalCase.
|
|
77
|
-
*
|
|
78
|
-
* @example kebabToPascal("stx-link") // "StxLink"
|
|
79
|
-
*/
|
|
80
|
-
export declare function kebabToPascal(str: string): string;
|
|
81
|
-
export { pascalToKebab } from './component-resolution';
|
|
82
38
|
/**
|
|
83
39
|
* Central registry for STX components.
|
|
84
40
|
*
|
|
@@ -86,37 +42,10 @@ export { pascalToKebab } from './component-resolution';
|
|
|
86
42
|
* file-based component resolution with multi-directory search.
|
|
87
43
|
*/
|
|
88
44
|
export declare class ComponentRegistry {
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
registerBuiltin(def: BuiltinComponentDef): void;
|
|
95
|
-
/**
|
|
96
|
-
* Check whether a component name matches a registered builtin (case-insensitive).
|
|
97
|
-
*/
|
|
98
|
-
isBuiltin(name: string): boolean;
|
|
99
|
-
/**
|
|
100
|
-
* Retrieve a builtin component definition by name (case-insensitive).
|
|
101
|
-
* Returns null if no matching builtin is found.
|
|
102
|
-
*/
|
|
103
|
-
getBuiltin(name: string): BuiltinComponentDef | null;
|
|
104
|
-
/**
|
|
105
|
-
* Resolve a file-based component to an absolute file path.
|
|
106
|
-
*
|
|
107
|
-
* Resolution order:
|
|
108
|
-
* 1. Check `context.__importedComponents` Map (explicit @import directives)
|
|
109
|
-
* 2. Generate name variants: [baseName.stx, PascalCase.stx, kebab-case.stx]
|
|
110
|
-
* 3. Search directories in priority order:
|
|
111
|
-
* - Page-relative components/
|
|
112
|
-
* - Global componentsDir
|
|
113
|
-
* - Parent-relative components/
|
|
114
|
-
* - Project root src/components and components/
|
|
115
|
-
* - Built-in STX components directory
|
|
116
|
-
* 4. Search subdirectories one level deep within each directory
|
|
117
|
-
* 5. Return null if not found
|
|
118
|
-
*/
|
|
119
|
-
resolveFile(name: string, fromFile: string, options: StxOptions, parentContext?: Record<string, any>): Promise<string | null>;
|
|
45
|
+
builtins: Map<string, BuiltinComponentDef>;
|
|
46
|
+
registerBuiltin(def: BuiltinComponentDef): void;
|
|
47
|
+
isBuiltin(name: string): boolean;
|
|
48
|
+
getBuiltin(name: string): BuiltinComponentDef | null;
|
|
49
|
+
resolveFile(name: string, fromFile: string, options: StxOptions, parentContext?: Record<string, any>): Promise<string | null>;
|
|
120
50
|
}
|
|
121
|
-
|
|
122
|
-
export declare const registry: ComponentRegistry;
|
|
51
|
+
export { pascalToKebab } from './component-resolution';
|
|
@@ -1,20 +1,5 @@
|
|
|
1
|
-
import type { StxOptions } from './types';
|
|
2
1
|
import { freeIdentifiers } from './safe-evaluator';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Process ES `import { A, B } from '<spec>'` statements inside `<script>` tags
|
|
6
|
-
* for component tag registration. Registers each named import as a tag pointing
|
|
7
|
-
* at the matching `.stx` file (resolved by component name within the package or
|
|
8
|
-
* relative directory) and strips the import line from the script body so it
|
|
9
|
-
* doesn't run as JS at template runtime.
|
|
10
|
-
*
|
|
11
|
-
* - `<spec>` may be a bare module specifier (resolved via node_modules walk) or
|
|
12
|
-
* a relative path to a directory or a single `.stx` file.
|
|
13
|
-
* - Default imports (`import Foo from '...'`) are also supported when `<spec>`
|
|
14
|
-
* resolves to a single `.stx` file.
|
|
15
|
-
* - Named imports referencing non-`.stx` exports are left untouched in the script.
|
|
16
|
-
*/
|
|
17
|
-
export { freeIdentifiers };
|
|
2
|
+
import type { StxOptions } from './types';
|
|
18
3
|
export declare function processESImports(template: string, context: Record<string, any>, filePath: string, options: StxOptions, dependencies: Set<string>): Promise<string>;
|
|
19
4
|
/**
|
|
20
5
|
* Unified component processing entry point.
|
|
@@ -33,3 +18,21 @@ export declare function processESImports(template: string, context: Record<strin
|
|
|
33
18
|
* @returns The processed template with all components rendered
|
|
34
19
|
*/
|
|
35
20
|
export declare function processComponents(template: string, context: Record<string, any>, filePath: string, options: StxOptions, dependencies: Set<string>): Promise<string>;
|
|
21
|
+
export { rendersAsElement } from './component-tags';
|
|
22
|
+
/**
|
|
23
|
+
* Process ES `import { A, B } from '<spec>'` statements inside `<script>` tags
|
|
24
|
+
* for component tag registration. Registers each named import as a tag pointing
|
|
25
|
+
* at the matching `.stx` file (resolved by component name within the package or
|
|
26
|
+
* relative directory) and strips the import line from the script body so it
|
|
27
|
+
* doesn't run as JS at template runtime.
|
|
28
|
+
*
|
|
29
|
+
* - `<spec>` may be a bare module specifier (resolved via node_modules walk) or
|
|
30
|
+
* a relative path to a directory or a single `.stx` file.
|
|
31
|
+
* - Default imports (`import Foo from '...'`) are also supported when `<spec>`
|
|
32
|
+
* resolves to a single `.stx` file.
|
|
33
|
+
* - Named imports referencing non-`.stx` exports are left untouched in the script.
|
|
34
|
+
*/
|
|
35
|
+
// Re-exported from its previous home. It moved to `safe-evaluator`, where the
|
|
36
|
+
// loop processor can reach it too, and this keeps the path it shipped under
|
|
37
|
+
// in 0.2.211 working.
|
|
38
|
+
export { freeIdentifiers };
|
|
@@ -21,17 +21,17 @@ export declare function buildStxIndex(pkgDir: string, cache?: boolean): Map<stri
|
|
|
21
21
|
* package directory on disk, walking up node_modules from `fromDir`.
|
|
22
22
|
*/
|
|
23
23
|
export declare function resolvePackageDir(spec: string, fromDir: string): string | null;
|
|
24
|
-
export interface ComponentLookupOptions {
|
|
25
|
-
componentsDir?: string;
|
|
26
|
-
projectRoot?: string;
|
|
27
|
-
}
|
|
28
|
-
export interface ComponentLookupContext {
|
|
29
|
-
__importedComponents?: Map<string, string>;
|
|
30
|
-
__originalFilePath?: string;
|
|
31
|
-
}
|
|
32
24
|
export declare function componentImportCandidates(componentPath: string, filePath: string, options?: ComponentLookupOptions): string[];
|
|
33
25
|
export declare function importedComponentPath(name: string, context?: ComponentLookupContext): string | undefined;
|
|
34
26
|
/** The renderer and editor walk exactly the same ordered file candidates. */
|
|
35
27
|
export declare function componentFileCandidates(name: string, fromFile: string, options?: ComponentLookupOptions, context?: ComponentLookupContext): Generator<string>;
|
|
36
28
|
/** Synchronous counterpart for TypeScript's synchronous language-service host. */
|
|
37
29
|
export declare function resolveComponentFileSync(name: string, fromFile: string, options?: ComponentLookupOptions, context?: ComponentLookupContext): string | null;
|
|
30
|
+
export declare interface ComponentLookupOptions {
|
|
31
|
+
componentsDir?: string
|
|
32
|
+
projectRoot?: string
|
|
33
|
+
}
|
|
34
|
+
export declare interface ComponentLookupContext {
|
|
35
|
+
__importedComponents?: Map<string, string>
|
|
36
|
+
__originalFilePath?: string
|
|
37
|
+
}
|
package/dist/component-tags.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
export declare const htmlTags: Set<string>;
|
|
2
1
|
/**
|
|
3
2
|
* Whether `tagName` certainly reaches the page as the element it names, by the
|
|
4
3
|
* three passes of `processComponents` below. A component tag is replaced by
|
|
@@ -7,3 +6,4 @@ export declare const htmlTags: Set<string>;
|
|
|
7
6
|
* cannot know, so it never counts as certain.
|
|
8
7
|
*/
|
|
9
8
|
export declare function rendersAsElement(tagName: string): boolean;
|
|
9
|
+
export declare const htmlTags: Set<any>;
|
|
@@ -1,51 +1,16 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Composable Auto-Loader
|
|
3
|
-
*
|
|
4
|
-
* Discovers .ts files in `composablesDir`, bundles them into a single script,
|
|
5
|
-
* and exposes every exported binding on `window.__composables`. That object is
|
|
6
|
-
* what `import { useThing } from '@composables'` compiles to — store-imports.ts
|
|
7
|
-
* rewrites the import into `const { useThing } = window.__composables`, a plain
|
|
8
|
-
* destructure in the page's own scope, which is exactly where template
|
|
9
|
-
* directives can see it.
|
|
10
|
-
*
|
|
11
|
-
* Before this loader existed the rewrite had nothing feeding it: `@composables`
|
|
12
|
-
* imports compiled to a destructure of `undefined`, so every binding that
|
|
13
|
-
* referenced a composable silently did nothing — `@click` never fired, `@show`
|
|
14
|
-
* never flipped, and there was no console error or build warning to notice.
|
|
15
|
-
* Sharing client logic between pages was effectively impossible, so the same
|
|
16
|
-
* block got copy-pasted into page after page. See #1780.
|
|
17
|
-
*
|
|
18
|
-
* Mirrors store-loader.ts, with one deliberate difference: stores are
|
|
19
|
-
* side-effectful (running `defineStore(...)` registers them globally, so
|
|
20
|
-
* nothing needs to be exported), whereas composables are *values* — their
|
|
21
|
-
* exported names have to be collected and attached to `window.__composables`.
|
|
22
|
-
*
|
|
23
|
-
* @module composable-loader
|
|
24
|
-
*/
|
|
25
|
-
/** One composable file and the names it exports. */
|
|
26
|
-
export interface ComposableModule {
|
|
27
|
-
/** Absolute path to the `.ts` file. */
|
|
28
|
-
file: string;
|
|
29
|
-
/** Exported binding names, excluding `default`. */
|
|
30
|
-
names: string[];
|
|
31
|
-
}
|
|
32
1
|
export declare function listComposableModules(composablesDir?: string | string[]): Promise<ComposableModule[]>;
|
|
33
2
|
/**
|
|
34
3
|
* @param pageSource - the rendered page, used to drop composables it cannot
|
|
35
4
|
* reach. Omit to emit every composable, which is what a caller with no page in
|
|
36
5
|
* hand needs.
|
|
37
6
|
*/
|
|
38
|
-
export declare function getComposableScript(composablesDir?: string | string[], pageSource?: string,
|
|
39
|
-
/**
|
|
40
|
-
* Text that is not (yet) part of `pageSource` but will ship with the page --
|
|
41
|
-
* the store bundle and the framework-composable bundle, which are collected
|
|
42
|
-
* alongside this one and spliced into the document together (#1945). They are
|
|
43
|
-
* scanned for reachability the same way the page is, because a composable
|
|
44
|
-
* used only from a store still has to be kept (#1936); passing them here
|
|
45
|
-
* rather than splicing them in first is what lets the three share one splice.
|
|
46
|
-
*/
|
|
47
|
-
extraSources?: readonly string[]): Promise<string | null>;
|
|
7
|
+
export declare function getComposableScript(composablesDir?: string | string[], pageSource?: string, extraSources?: readonly string[]): Promise<string | null>;
|
|
48
8
|
/**
|
|
49
9
|
* Clear the cached composable script (for dev mode hot reload).
|
|
50
10
|
*/
|
|
51
11
|
export declare function clearComposableCache(): void;
|
|
12
|
+
/** One composable file and the names it exports. */
|
|
13
|
+
export declare interface ComposableModule {
|
|
14
|
+
file: string
|
|
15
|
+
names: string[]
|
|
16
|
+
}
|
|
@@ -1,111 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
* useFetch — reactive data fetching (module-import path).
|
|
3
|
-
*
|
|
4
|
-
* stx ships two `useFetch` implementations:
|
|
5
|
-
*
|
|
6
|
-
* 1. This one (signals-api / module-import path) — used by tests,
|
|
7
|
-
* SSR-side tooling, and any code that imports from `'stx'` or
|
|
8
|
-
* `'@stacksjs/stx/composables'` directly.
|
|
9
|
-
* 2. The runtime template literal inside `packages/stx/src/signals.ts`
|
|
10
|
-
* (search for `function useFetch`), injected into client pages and
|
|
11
|
-
* exposed at `window.stx.useFetch`.
|
|
12
|
-
*
|
|
13
|
-
* Pre-stacksjs/stx#1726 these returned different shapes (composable used
|
|
14
|
-
* a Vue-style `{ get, subscribe, refresh, execute, abort }` ref;
|
|
15
|
-
* runtime returned Signal-shaped `{ data, loading, error, refetch }`).
|
|
16
|
-
* That meant the same code crashed on one path or the other depending
|
|
17
|
-
* on which entry point the bundler resolved. Now both return the
|
|
18
|
-
* Signal shape — `data`, `loading`, `error` are signals; `refetch` is
|
|
19
|
-
* a function. The composable additionally exposes `abort`, `status`,
|
|
20
|
-
* `statusText` and accepts the richer options set (retry, cache,
|
|
21
|
-
* refetchOnFocus, etc.) — these are supersets the runtime doesn't
|
|
22
|
-
* implement, available to module-import consumers only.
|
|
23
|
-
*
|
|
24
|
-
* Parity tests in `test/composables/use-fetch-parity.test.ts` pin the
|
|
25
|
-
* shared shape across both impls; do not change one side without the
|
|
26
|
-
* other.
|
|
27
|
-
*
|
|
28
|
-
* @example
|
|
29
|
-
* ```ts
|
|
30
|
-
* const { data, loading, error, refetch } = useFetch('/api/users')
|
|
31
|
-
* // data() — current value (null while loading)
|
|
32
|
-
* // loading() — boolean signal
|
|
33
|
-
* // error() — Error | null signal
|
|
34
|
-
* // refetch() — trigger a new request
|
|
35
|
-
* ```
|
|
36
|
-
*/
|
|
1
|
+
import { state } from '../signals-api';
|
|
37
2
|
import type { Signal } from '../signals-api';
|
|
38
3
|
/** @internal Closure-free: also embedded in the generated browser runtime. */
|
|
39
|
-
export declare function readHydratedData(key?: string, hydrate?: boolean, transform?: (data: any) => unknown): {
|
|
40
|
-
data: unknown;
|
|
41
|
-
error?: Error;
|
|
42
|
-
} | undefined;
|
|
4
|
+
export declare function readHydratedData(key?: string, hydrate?: boolean, transform?: (data: any) => unknown): { data: unknown, error?: Error } | undefined;
|
|
43
5
|
/** Forget a hydration snapshot; existing signals change only on explicit refresh. */
|
|
44
6
|
export declare function clearServerData(key?: string): void;
|
|
45
|
-
export interface FetchOptions<T = unknown> extends Omit<RequestInit, 'body'> {
|
|
46
|
-
/** Request body (will be JSON stringified if object) */
|
|
47
|
-
body?: BodyInit | Record<string, unknown> | null;
|
|
48
|
-
/** Base URL to prepend */
|
|
49
|
-
baseURL?: string;
|
|
50
|
-
/** Query parameters */
|
|
51
|
-
query?: Record<string, string | number | boolean | undefined>;
|
|
52
|
-
/** Fetch immediately on creation (default: true) */
|
|
53
|
-
immediate?: boolean;
|
|
54
|
-
/** Transform response data */
|
|
55
|
-
transform?: (data: unknown) => T;
|
|
56
|
-
/** Custom response parser (default: json) */
|
|
57
|
-
parseResponse?: (response: Response) => Promise<unknown>;
|
|
58
|
-
/** Timeout in milliseconds (default: 30000) */
|
|
59
|
-
timeout?: number;
|
|
60
|
-
/** Retry count on failure (default: 0) */
|
|
61
|
-
retry?: number;
|
|
62
|
-
/** Retry delay in milliseconds (default: 1000) */
|
|
63
|
-
retryDelay?: number;
|
|
64
|
-
/** Cache key for deduplication */
|
|
65
|
-
key?: string;
|
|
66
|
-
/** Reuse matching useServerData data for the initial load (default: true). */
|
|
67
|
-
hydrate?: boolean;
|
|
68
|
-
/** Cache time in milliseconds (0 = no cache) */
|
|
69
|
-
cacheTime?: number;
|
|
70
|
-
/** Refetch on document visibility change (default: false) */
|
|
71
|
-
refetchOnFocus?: boolean;
|
|
72
|
-
/** Refetch interval in milliseconds */
|
|
73
|
-
refetchInterval?: number;
|
|
74
|
-
/** Initial value while loading (matches runtime's `initialData`) */
|
|
75
|
-
initialData?: T | null;
|
|
76
|
-
}
|
|
77
|
-
/** How one run of the request should behave. */
|
|
78
|
-
export interface RefetchOptions {
|
|
79
|
-
/**
|
|
80
|
-
* Refresh without touching `loading` or clearing the current error.
|
|
81
|
-
*
|
|
82
|
-
* A poll refreshes data that is already on screen, so driving the first-load
|
|
83
|
-
* state from it puts a spinner over a populated view on every tick. Bind
|
|
84
|
-
* `isFetching` for a subtle in-flight indicator instead (stacksjs/stx#1929).
|
|
85
|
-
*/
|
|
86
|
-
background?: boolean;
|
|
87
|
-
}
|
|
88
|
-
/** Signal-shaped fetch result. Matches the runtime's `useFetch` return. */
|
|
89
|
-
export interface FetchRef<T> {
|
|
90
|
-
/** Current data, or `initialData`/null while loading. */
|
|
91
|
-
data: Signal<T | null>;
|
|
92
|
-
/** True while a first-load request is in flight. A background one leaves it alone. */
|
|
93
|
-
loading: Signal<boolean>;
|
|
94
|
-
/** True while ANY request is in flight, background ones included. */
|
|
95
|
-
isFetching: Signal<boolean>;
|
|
96
|
-
/** The most recent error, or null. */
|
|
97
|
-
error: Signal<Error | null>;
|
|
98
|
-
/** HTTP status code of the most recent response, or null. */
|
|
99
|
-
status: Signal<number | null>;
|
|
100
|
-
/** HTTP status text of the most recent response, or null. */
|
|
101
|
-
statusText: Signal<string | null>;
|
|
102
|
-
/** Trigger a new request. */
|
|
103
|
-
refetch: (_options?: RefetchOptions) => Promise<void>;
|
|
104
|
-
/** Same as refetch — kept for runtime-parity callers. */
|
|
105
|
-
execute: () => Promise<void>;
|
|
106
|
-
/** Abort the in-flight request. */
|
|
107
|
-
abort: () => void;
|
|
108
|
-
}
|
|
109
7
|
/**
|
|
110
8
|
* Reactive fetch with loading/error states. Returns Signal-shaped state.
|
|
111
9
|
*/
|
|
@@ -114,21 +12,54 @@ export declare function useFetch<T = unknown>(url: string | (() => string), opti
|
|
|
114
12
|
* Generic async data fetcher. Same Signal shape as `useFetch`.
|
|
115
13
|
*/
|
|
116
14
|
export declare function useAsyncData<T>(fetcher: () => Promise<T>, options?: {
|
|
117
|
-
immediate?: boolean
|
|
118
|
-
transform?: (data: T) => T
|
|
119
|
-
initialData?: T | null
|
|
120
|
-
key?: string
|
|
121
|
-
hydrate?: boolean
|
|
122
|
-
cacheTime?: number
|
|
123
|
-
}): FetchRef<T>;
|
|
15
|
+
immediate?: boolean
|
|
16
|
+
transform?: (data: T) => T
|
|
17
|
+
initialData?: T | null
|
|
18
|
+
key?: string
|
|
19
|
+
hydrate?: boolean
|
|
20
|
+
cacheTime?: number
|
|
21
|
+
}): FetchRef<T>;
|
|
124
22
|
/**
|
|
125
23
|
* POST request helper. Returns the fetch state plus an execute(body) helper.
|
|
126
24
|
*/
|
|
127
25
|
export declare function usePost<T = unknown, B = unknown>(url: string, options?: Omit<FetchOptions<T>, 'method' | 'body'>): {
|
|
128
|
-
execute: (body?: B) => Promise<T | null
|
|
129
|
-
state: FetchRef<T
|
|
130
|
-
};
|
|
26
|
+
execute: (body?: B) => Promise<T | null>
|
|
27
|
+
state: FetchRef<T>
|
|
28
|
+
};
|
|
131
29
|
/** Clear fetch cache (one key or all). */
|
|
132
30
|
export declare function clearFetchCache(key?: string): void;
|
|
133
31
|
/** Prefetch data into cache. */
|
|
134
32
|
export declare function prefetch<T>(url: string, options?: FetchOptions<T>): Promise<void>;
|
|
33
|
+
export declare interface FetchOptions<T = unknown> extends Omit<RequestInit, 'body'> {
|
|
34
|
+
body?: BodyInit | Record<string, unknown> | null
|
|
35
|
+
baseURL?: string
|
|
36
|
+
query?: Record<string, string | number | boolean | undefined>
|
|
37
|
+
immediate?: boolean
|
|
38
|
+
transform?: (data: unknown) => T
|
|
39
|
+
parseResponse?: (response: Response) => Promise<unknown>
|
|
40
|
+
timeout?: number
|
|
41
|
+
retry?: number
|
|
42
|
+
retryDelay?: number
|
|
43
|
+
key?: string
|
|
44
|
+
hydrate?: boolean
|
|
45
|
+
cacheTime?: number
|
|
46
|
+
refetchOnFocus?: boolean
|
|
47
|
+
refetchInterval?: number
|
|
48
|
+
initialData?: T | null
|
|
49
|
+
}
|
|
50
|
+
/** How one run of the request should behave. */
|
|
51
|
+
export declare interface RefetchOptions {
|
|
52
|
+
background?: boolean
|
|
53
|
+
}
|
|
54
|
+
/** Signal-shaped fetch result. Matches the runtime's `useFetch` return. */
|
|
55
|
+
export declare interface FetchRef<T> {
|
|
56
|
+
data: Signal<T | null>
|
|
57
|
+
loading: Signal<boolean>
|
|
58
|
+
isFetching: Signal<boolean>
|
|
59
|
+
error: Signal<Error | null>
|
|
60
|
+
status: Signal<number | null>
|
|
61
|
+
statusText: Signal<string | null>
|
|
62
|
+
refetch: (_options?: RefetchOptions) => Promise<void>
|
|
63
|
+
execute: () => Promise<void>
|
|
64
|
+
abort: () => void
|
|
65
|
+
}
|
|
@@ -1,55 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* useForm — reactive form state reachable from a <script client> block
|
|
3
|
-
* (stacksjs/stx#1846, renamed in #1843).
|
|
4
|
-
*
|
|
5
|
-
* Named `defineForm` until it turned out to be the odd one out. In this
|
|
6
|
-
* codebase `define*` DECLARES — defineProps, defineEmits, defineExpose,
|
|
7
|
-
* definePageMeta, defineSlots, defineStore — while `use*` returns live reactive
|
|
8
|
-
* state: useFetch, useCookie, useMutation, useDark. This returns signal-backed
|
|
9
|
-
* state and a handleSubmit, so it was a `use*` wearing a `define*` name, and the
|
|
10
|
-
* file being called use-form.ts while exporting defineForm meant grepping for
|
|
11
|
-
* either one found the wrong half.
|
|
12
|
-
*
|
|
13
|
-
* `defineForm` remains as a deprecated alias below.
|
|
14
|
-
*
|
|
15
|
-
* ---
|
|
16
|
-
*
|
|
17
|
-
* THERE IS A SECOND `useForm`, in @stacksjs/composables
|
|
18
|
-
* (storage/framework/core/composables/src/useForm.ts). It is not this one, and
|
|
19
|
-
* the two are not interchangeable — they were written independently because
|
|
20
|
-
* neither side could find the other's, which is #1843's adoption problem
|
|
21
|
-
* happening to the framework itself.
|
|
22
|
-
*
|
|
23
|
-
* this one @stacksjs/composables
|
|
24
|
-
* useForm(schema, initialValues) useForm({ initialValues, onSubmit })
|
|
25
|
-
* form.values.email form.values.value.email
|
|
26
|
-
* form.getFieldState('email') form.field('email')
|
|
27
|
-
* v.required().email() schema.string().email() (ts-validation)
|
|
28
|
-
* validate() -> Promise<string[]> validate() -> { valid, errors }
|
|
29
|
-
* has: validating, validateField has: isSubmitting, isValid, isDirty,
|
|
30
|
-
* setErrors (422), clearErrors,
|
|
31
|
-
* submitButtonProps, firstErrorField,
|
|
32
|
-
* aria inputProps
|
|
33
|
-
*
|
|
34
|
-
* Before adding a feature here, check whether it exists there — and say so in
|
|
35
|
-
* the PR either way. Unifying them is a breaking change to one side's public
|
|
36
|
-
* API, not a re-export, so it needs a deliberate decision rather than drift.
|
|
37
|
-
*
|
|
38
|
-
* Lifted out of forms-validation.ts so the framework-composables demand-bundler
|
|
39
|
-
* (src/framework-composables.ts) can ship it to the browser. That bundler scans
|
|
40
|
-
* THIS directory, takes each file whole, strips the imports — every name they
|
|
41
|
-
* pull from stx is a runtime global by the time the emitted script runs — and
|
|
42
|
-
* merges the export onto window.stx. defineForm was exported from the package
|
|
43
|
-
* and type-checked, yet reached the client by no path at all, so an app that
|
|
44
|
-
* wanted reactive form state hand-rolled it. #1856 made it reactive; this makes
|
|
45
|
-
* it reachable.
|
|
46
|
-
*
|
|
47
|
-
* The signal comes from signals-api, whose `state` is published as a bare global
|
|
48
|
-
* (signals.ts does `window.state = state`), so the stripped `import { state }`
|
|
49
|
-
* below still resolves once the bundle runs. reactivity.ts's `reactive()` would
|
|
50
|
-
* NOT — it tracks a separate effect context the template runtime never reads
|
|
51
|
-
* (see #1885).
|
|
52
|
-
*/
|
|
53
1
|
import type { FormState, Validator } from '../forms-validation';
|
|
54
2
|
/**
|
|
55
3
|
* Reactive form state from a validation schema.
|
|
@@ -76,9 +24,7 @@ import type { FormState, Validator } from '../forms-validation';
|
|
|
76
24
|
* })
|
|
77
25
|
* ```
|
|
78
26
|
*/
|
|
79
|
-
export declare function useForm<T extends Record<string, Validator>>(schema: T, initialValues?: Partial<{
|
|
80
|
-
[K in keyof T]: unknown;
|
|
81
|
-
}>): FormState<T>;
|
|
27
|
+
export declare function useForm<T extends Record<string, Validator>>(schema: T, initialValues?: Partial<{ [K in keyof T]: unknown }>): FormState<T>;
|
|
82
28
|
/**
|
|
83
29
|
* @deprecated Use {@link useForm}. Renamed in stacksjs/stx#1843 so the name
|
|
84
30
|
* matches what it does: `define*` declares in this codebase, `use*` returns
|
|
@@ -88,4 +34,4 @@ export declare function useForm<T extends Record<string, Validator>>(schema: T,
|
|
|
88
34
|
* and anything comparing or spying on the function keeps working. Kept for a
|
|
89
35
|
* minor; existing apps do not have to move in the same release they upgrade in.
|
|
90
36
|
*/
|
|
91
|
-
export declare const defineForm:
|
|
37
|
+
export declare const defineForm: unknown;
|
|
@@ -18,7 +18,7 @@ export declare function useLazyLoad(target: Element | (() => Element | null) | n
|
|
|
18
18
|
* Infinite scroll handler - triggers callback when sentinel element is visible
|
|
19
19
|
*/
|
|
20
20
|
export declare function useInfiniteScroll(sentinel: Element | (() => Element | null) | null, loadMore: () => void | Promise<void>, options?: IntersectionObserverOptions & {
|
|
21
|
-
|
|
21
|
+
|
|
22
22
|
debounce?: number
|
|
23
23
|
}): {
|
|
24
24
|
stop: () => void
|