@stacksjs/stx 0.2.572 → 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-s34g3awk.js → chunk-fynh3bkq.js} +1 -1
- 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/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
package/dist/craft-bridge.d.ts
CHANGED
|
@@ -25,473 +25,7 @@ export declare function injectCraftBridge(html: string, config?: CraftBridgeConf
|
|
|
25
25
|
* Client-side Craft bridge script
|
|
26
26
|
* This gets injected into stx templates when running in a Craft webview
|
|
27
27
|
*/
|
|
28
|
-
export declare const CRAFT_BRIDGE_SCRIPT:
|
|
29
|
-
<script>
|
|
30
|
-
(function() {
|
|
31
|
-
'use strict';
|
|
32
|
-
|
|
33
|
-
// Skip if already initialized or not in Craft environment
|
|
34
|
-
if (window.__craftBridgeInitialized) return;
|
|
35
|
-
window.__craftBridgeInitialized = true;
|
|
36
|
-
|
|
37
|
-
// Message ID counter
|
|
38
|
-
let messageId = 0;
|
|
39
|
-
const generateId = () => 'msg_' + Date.now() + '_' + (++messageId);
|
|
40
|
-
|
|
41
|
-
// Pending requests
|
|
42
|
-
const pending = new Map();
|
|
43
|
-
|
|
44
|
-
// Event listeners
|
|
45
|
-
const eventListeners = new Map();
|
|
46
|
-
|
|
47
|
-
// Configuration
|
|
48
|
-
const config = {
|
|
49
|
-
debug: false,
|
|
50
|
-
timeout: 30000
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
// Send message to native
|
|
54
|
-
function send(message) {
|
|
55
|
-
const json = JSON.stringify(message);
|
|
56
|
-
|
|
57
|
-
if (config.debug) {
|
|
58
|
-
console.log('[Craft Bridge] Sending:', message.method, message.params);
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
// iOS WKWebView
|
|
62
|
-
if (window.webkit?.messageHandlers?.craft) {
|
|
63
|
-
window.webkit.messageHandlers.craft.postMessage(message);
|
|
64
|
-
return true;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
// Android WebView
|
|
68
|
-
if (window.CraftBridge) {
|
|
69
|
-
window.CraftBridge.postMessage(json);
|
|
70
|
-
return true;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
// Electron IPC
|
|
74
|
-
if (window.craftIPC) {
|
|
75
|
-
window.craftIPC.send('bridge-message', message);
|
|
76
|
-
return true;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
return false;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
// Make a request and wait for response
|
|
83
|
-
function request(method, params) {
|
|
84
|
-
return new Promise((resolve, reject) => {
|
|
85
|
-
const id = generateId();
|
|
86
|
-
const timeout = setTimeout(() => {
|
|
87
|
-
pending.delete(id);
|
|
88
|
-
reject(new Error('Request timeout: ' + method));
|
|
89
|
-
}, config.timeout);
|
|
90
|
-
|
|
91
|
-
pending.set(id, { resolve, reject, timeout });
|
|
92
|
-
|
|
93
|
-
const sent = send({
|
|
94
|
-
id,
|
|
95
|
-
type: 'request',
|
|
96
|
-
method,
|
|
97
|
-
params
|
|
98
|
-
});
|
|
99
|
-
|
|
100
|
-
if (!sent) {
|
|
101
|
-
clearTimeout(timeout);
|
|
102
|
-
pending.delete(id);
|
|
103
|
-
// Return gracefully if not in Craft environment
|
|
104
|
-
resolve(undefined);
|
|
105
|
-
}
|
|
106
|
-
});
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
// Handle incoming messages
|
|
110
|
-
function handleMessage(event) {
|
|
111
|
-
let data;
|
|
112
|
-
try {
|
|
113
|
-
data = event.detail || (typeof event.data === 'string' ? JSON.parse(event.data) : event.data);
|
|
114
|
-
}
|
|
115
|
-
catch (e) {
|
|
116
|
-
return;
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
if (!data || !data.id) return;
|
|
120
|
-
|
|
121
|
-
if (config.debug) {
|
|
122
|
-
console.log('[Craft Bridge] Received:', data);
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
if (data.type === 'response') {
|
|
126
|
-
const req = pending.get(data.id);
|
|
127
|
-
if (req) {
|
|
128
|
-
clearTimeout(req.timeout);
|
|
129
|
-
pending.delete(data.id);
|
|
130
|
-
if (data.error) {
|
|
131
|
-
req.reject(new Error(data.error.message));
|
|
132
|
-
}
|
|
133
|
-
else {
|
|
134
|
-
req.resolve(data.result);
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
else if (data.type === 'event' && data.method) {
|
|
139
|
-
const listeners = eventListeners.get(data.method) || [];
|
|
140
|
-
listeners.forEach(fn => fn(data.params));
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
// Listen for messages
|
|
145
|
-
window.addEventListener('message', handleMessage);
|
|
146
|
-
window.addEventListener('craft-bridge-message', handleMessage);
|
|
147
|
-
|
|
148
|
-
// Check if running in Craft
|
|
149
|
-
function isCraft() {
|
|
150
|
-
return !!(
|
|
151
|
-
window.webkit?.messageHandlers?.craft ||
|
|
152
|
-
window.CraftBridge ||
|
|
153
|
-
window.craftIPC
|
|
154
|
-
);
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
// Subscribe to events
|
|
158
|
-
function on(event, callback) {
|
|
159
|
-
if (!eventListeners.has(event)) {
|
|
160
|
-
eventListeners.set(event, []);
|
|
161
|
-
}
|
|
162
|
-
eventListeners.get(event).push(callback);
|
|
163
|
-
return () => {
|
|
164
|
-
const listeners = eventListeners.get(event);
|
|
165
|
-
const idx = listeners.indexOf(callback);
|
|
166
|
-
if (idx > -1) listeners.splice(idx, 1);
|
|
167
|
-
};
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
function sendNativeUI(action, data) {
|
|
171
|
-
if (window.webkit?.messageHandlers?.craft) {
|
|
172
|
-
window.webkit.messageHandlers.craft.postMessage({ t: 'nativeUI', a: action, d: data || {} });
|
|
173
|
-
return true;
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
if (window.CraftBridge?.postMessage) {
|
|
177
|
-
window.CraftBridge.postMessage(JSON.stringify({ t: 'nativeUI', a: action, d: data || {} }));
|
|
178
|
-
return true;
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
return send({
|
|
182
|
-
id: generateId(),
|
|
183
|
-
type: 'nativeUI',
|
|
184
|
-
action,
|
|
185
|
-
data: data || {}
|
|
186
|
-
});
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
// Live component handles, keyed by id, so an event coming back from the host
|
|
190
|
-
// can be routed to the callbacks registered on the right one. Without this
|
|
191
|
-
// the onSelect/onSpaceChange callbacks were stored and never invoked.
|
|
192
|
-
const sidebars = new Map();
|
|
193
|
-
const spacesSidebars = new Map();
|
|
194
|
-
|
|
195
|
-
function createNativeUIFacade() {
|
|
196
|
-
class Sidebar {
|
|
197
|
-
constructor(id) {
|
|
198
|
-
this.id = id;
|
|
199
|
-
this._selectCallbacks = [];
|
|
200
|
-
}
|
|
201
|
-
addSection(section) {
|
|
202
|
-
sendNativeUI('addSidebarSection', { sidebarId: this.id, section });
|
|
203
|
-
return this;
|
|
204
|
-
}
|
|
205
|
-
setSelectedItem(itemId) {
|
|
206
|
-
sendNativeUI('setSelectedItem', { sidebarId: this.id, itemId });
|
|
207
|
-
return this;
|
|
208
|
-
}
|
|
209
|
-
onSelect(callback) {
|
|
210
|
-
this._selectCallbacks.push(callback);
|
|
211
|
-
return this;
|
|
212
|
-
}
|
|
213
|
-
destroy() {
|
|
214
|
-
sidebars.delete(this.id);
|
|
215
|
-
sendNativeUI('destroyComponent', { id: this.id, type: 'sidebar' });
|
|
216
|
-
}
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
/**
|
|
220
|
-
* An Arc-style sidebar of swipeable spaces.
|
|
221
|
-
*
|
|
222
|
-
* Separate from Sidebar rather than an option on it: a source list selects
|
|
223
|
-
* one row out of many, while a spaces sidebar selects one whole SCENE, and
|
|
224
|
-
* a host that renders the switcher natively (a segmented control in the
|
|
225
|
-
* toolbar, a Touch Bar strip) needs the space list, not the item list.
|
|
226
|
-
*/
|
|
227
|
-
class SpacesSidebar {
|
|
228
|
-
constructor(id) {
|
|
229
|
-
this.id = id;
|
|
230
|
-
this._spaceCallbacks = [];
|
|
231
|
-
}
|
|
232
|
-
setSpaces(spaces) {
|
|
233
|
-
sendNativeUI('setSidebarSpaces', { sidebarId: this.id, spaces });
|
|
234
|
-
return this;
|
|
235
|
-
}
|
|
236
|
-
setActiveSpace(spaceId) {
|
|
237
|
-
sendNativeUI('setActiveSpace', { sidebarId: this.id, spaceId });
|
|
238
|
-
return this;
|
|
239
|
-
}
|
|
240
|
-
onSpaceChange(callback) {
|
|
241
|
-
this._spaceCallbacks.push(callback);
|
|
242
|
-
return this;
|
|
243
|
-
}
|
|
244
|
-
destroy() {
|
|
245
|
-
spacesSidebars.delete(this.id);
|
|
246
|
-
sendNativeUI('destroyComponent', { id: this.id, type: 'spacesSidebar' });
|
|
247
|
-
}
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
class FileBrowser {
|
|
251
|
-
constructor(id) {
|
|
252
|
-
this.id = id;
|
|
253
|
-
}
|
|
254
|
-
addFile(file) {
|
|
255
|
-
sendNativeUI('addFile', { browserId: this.id, file });
|
|
256
|
-
return this;
|
|
257
|
-
}
|
|
258
|
-
addFiles(files) {
|
|
259
|
-
sendNativeUI('addFiles', { browserId: this.id, files });
|
|
260
|
-
return this;
|
|
261
|
-
}
|
|
262
|
-
clearFiles() {
|
|
263
|
-
sendNativeUI('clearFiles', { browserId: this.id });
|
|
264
|
-
return this;
|
|
265
|
-
}
|
|
266
|
-
destroy() {
|
|
267
|
-
sendNativeUI('destroyComponent', { id: this.id, type: 'fileBrowser' });
|
|
268
|
-
}
|
|
269
|
-
}
|
|
270
|
-
|
|
271
|
-
class SplitView {
|
|
272
|
-
constructor(id, sidebar, browser) {
|
|
273
|
-
this.id = id;
|
|
274
|
-
this.sidebar = sidebar;
|
|
275
|
-
this.browser = browser;
|
|
276
|
-
}
|
|
277
|
-
setDividerPosition(position) {
|
|
278
|
-
sendNativeUI('setDividerPosition', { splitViewId: this.id, position });
|
|
279
|
-
return this;
|
|
280
|
-
}
|
|
281
|
-
destroy() {
|
|
282
|
-
sendNativeUI('destroyComponent', { id: this.id, type: 'splitView' });
|
|
283
|
-
}
|
|
284
|
-
}
|
|
285
|
-
|
|
286
|
-
// Host -> page. The host names the component in the payload; we look up the
|
|
287
|
-
// handle and fan out to whatever the page registered on it.
|
|
288
|
-
on('sidebar.select', function(params) {
|
|
289
|
-
const sidebar = sidebars.get(params && params.sidebarId);
|
|
290
|
-
if (sidebar) sidebar._selectCallbacks.forEach(fn => fn(params.itemId));
|
|
291
|
-
});
|
|
292
|
-
on('sidebar.spaceChange', function(params) {
|
|
293
|
-
const sidebar = spacesSidebars.get(params && params.sidebarId);
|
|
294
|
-
if (sidebar) sidebar._spaceCallbacks.forEach(fn => fn(params.spaceId));
|
|
295
|
-
});
|
|
296
|
-
|
|
297
|
-
return {
|
|
298
|
-
createSidebar(options) {
|
|
299
|
-
const opts = options || {};
|
|
300
|
-
const id = opts.id || 'sidebar-' + Date.now() + '-' + Math.random().toString(36).slice(2);
|
|
301
|
-
sendNativeUI('createSidebar', Object.assign({}, opts, { id }));
|
|
302
|
-
const sidebar = new Sidebar(id);
|
|
303
|
-
sidebars.set(id, sidebar);
|
|
304
|
-
return sidebar;
|
|
305
|
-
},
|
|
306
|
-
createSpacesSidebar(options) {
|
|
307
|
-
const opts = options || {};
|
|
308
|
-
const id = opts.id || 'spaces-' + Date.now() + '-' + Math.random().toString(36).slice(2);
|
|
309
|
-
sendNativeUI('createSpacesSidebar', Object.assign({}, opts, { id }));
|
|
310
|
-
const sidebar = new SpacesSidebar(id);
|
|
311
|
-
spacesSidebars.set(id, sidebar);
|
|
312
|
-
return sidebar;
|
|
313
|
-
},
|
|
314
|
-
createFileBrowser(options) {
|
|
315
|
-
const opts = options || {};
|
|
316
|
-
const id = opts.id || 'browser-' + Date.now() + '-' + Math.random().toString(36).slice(2);
|
|
317
|
-
sendNativeUI('createFileBrowser', Object.assign({}, opts, { id }));
|
|
318
|
-
return new FileBrowser(id);
|
|
319
|
-
},
|
|
320
|
-
createSplitView(options) {
|
|
321
|
-
if (!options?.sidebar || !options?.browser) {
|
|
322
|
-
throw new Error('createSplitView requires sidebar and browser options');
|
|
323
|
-
}
|
|
324
|
-
const id = options.id || 'splitview-' + Date.now() + '-' + Math.random().toString(36).slice(2);
|
|
325
|
-
sendNativeUI('createSplitView', {
|
|
326
|
-
id,
|
|
327
|
-
sidebarId: options.sidebar.id,
|
|
328
|
-
browserId: options.browser.id
|
|
329
|
-
});
|
|
330
|
-
return new SplitView(id, options.sidebar, options.browser);
|
|
331
|
-
},
|
|
332
|
-
showQuickLook(options) {
|
|
333
|
-
sendNativeUI('showQuickLook', options);
|
|
334
|
-
},
|
|
335
|
-
closeQuickLook() {
|
|
336
|
-
sendNativeUI('closeQuickLook', {});
|
|
337
|
-
},
|
|
338
|
-
toggleQuickLook(options) {
|
|
339
|
-
sendNativeUI('toggleQuickLook', options);
|
|
340
|
-
}
|
|
341
|
-
};
|
|
342
|
-
}
|
|
343
|
-
|
|
344
|
-
const existingCraft = window.craft || {};
|
|
345
|
-
const nativeUI = existingCraft.nativeUI || createNativeUIFacade();
|
|
346
|
-
const componentAPI = existingCraft.components || Object.assign({}, nativeUI, {
|
|
347
|
-
updateComponent: (id, props) => request('component.update', { componentId: id, props }),
|
|
348
|
-
destroyComponent: (id) => request('component.destroy', { componentId: id })
|
|
349
|
-
});
|
|
350
|
-
|
|
351
|
-
// Build the craft API object
|
|
352
|
-
window.craft = Object.assign({}, existingCraft, {
|
|
353
|
-
// Meta
|
|
354
|
-
isCraft,
|
|
355
|
-
on,
|
|
356
|
-
config,
|
|
357
|
-
|
|
358
|
-
// Window API
|
|
359
|
-
window: {
|
|
360
|
-
show: () => request('window.show'),
|
|
361
|
-
hide: () => request('window.hide'),
|
|
362
|
-
close: () => request('window.close'),
|
|
363
|
-
minimize: () => request('window.minimize'),
|
|
364
|
-
maximize: () => request('window.maximize'),
|
|
365
|
-
restore: () => request('window.restore'),
|
|
366
|
-
focus: () => request('window.focus'),
|
|
367
|
-
blur: () => request('window.blur'),
|
|
368
|
-
setTitle: (title) => request('window.setTitle', { title }),
|
|
369
|
-
setSize: (width, height) => request('window.setSize', { width, height }),
|
|
370
|
-
setPosition: (x, y) => request('window.setPosition', { x, y }),
|
|
371
|
-
setFullscreen: (fullscreen) => request('window.setFullscreen', { fullscreen }),
|
|
372
|
-
setAlwaysOnTop: (alwaysOnTop) => request('window.setAlwaysOnTop', { alwaysOnTop }),
|
|
373
|
-
getSize: () => request('window.getSize'),
|
|
374
|
-
getPosition: () => request('window.getPosition'),
|
|
375
|
-
isFullscreen: () => request('window.isFullscreen'),
|
|
376
|
-
isMaximized: () => request('window.isMaximized'),
|
|
377
|
-
isMinimized: () => request('window.isMinimized'),
|
|
378
|
-
isVisible: () => request('window.isVisible'),
|
|
379
|
-
center: () => request('window.center'),
|
|
380
|
-
toggleFullscreen: () => request('window.toggleFullscreen'),
|
|
381
|
-
startDrag: () => request('window.startDrag'),
|
|
382
|
-
},
|
|
383
|
-
|
|
384
|
-
// System Tray/Menubar API
|
|
385
|
-
tray: {
|
|
386
|
-
setTitle: (title) => request('tray.setTitle', { title }),
|
|
387
|
-
setTooltip: (tooltip) => request('tray.setTooltip', { tooltip }),
|
|
388
|
-
setIcon: (icon) => request('tray.setIcon', { icon }),
|
|
389
|
-
setMenu: (menu) => request('tray.setMenu', { menu }),
|
|
390
|
-
show: () => request('tray.show'),
|
|
391
|
-
hide: () => request('tray.hide'),
|
|
392
|
-
onClick: (callback) => on('tray.click', callback),
|
|
393
|
-
onDoubleClick: (callback) => on('tray.doubleClick', callback),
|
|
394
|
-
onRightClick: (callback) => on('tray.rightClick', callback),
|
|
395
|
-
},
|
|
396
|
-
|
|
397
|
-
// App API
|
|
398
|
-
app: {
|
|
399
|
-
quit: () => request('app.quit'),
|
|
400
|
-
hide: () => request('app.hide'),
|
|
401
|
-
show: () => request('app.show'),
|
|
402
|
-
focus: () => request('app.focus'),
|
|
403
|
-
getInfo: () => request('app.getInfo'),
|
|
404
|
-
getVersion: () => request('app.getVersion'),
|
|
405
|
-
getName: () => request('app.getName'),
|
|
406
|
-
getPath: (name) => request('app.getPath', { name }),
|
|
407
|
-
isDarkMode: () => request('app.isDarkMode'),
|
|
408
|
-
getLocale: () => request('app.getLocale'),
|
|
409
|
-
setBadge: (badge) => request('app.setBadge', { badge }),
|
|
410
|
-
hideDockIcon: () => request('app.hideDockIcon'),
|
|
411
|
-
showDockIcon: () => request('app.showDockIcon'),
|
|
412
|
-
notify: (options) => request('app.notify', options),
|
|
413
|
-
registerShortcut: (accelerator, callback) => {
|
|
414
|
-
const id = generateId();
|
|
415
|
-
on('shortcut.' + id, callback);
|
|
416
|
-
return request('app.registerShortcut', { accelerator, id });
|
|
417
|
-
},
|
|
418
|
-
unregisterShortcut: (accelerator) => request('app.unregisterShortcut', { accelerator }),
|
|
419
|
-
},
|
|
420
|
-
|
|
421
|
-
// Dialog API
|
|
422
|
-
dialog: {
|
|
423
|
-
openFile: (options) => request('dialog.openFile', options),
|
|
424
|
-
openFolder: (options) => request('dialog.openFolder', options),
|
|
425
|
-
saveFile: (options) => request('dialog.saveFile', options),
|
|
426
|
-
showAlert: (options) => request('dialog.showAlert', options),
|
|
427
|
-
showConfirm: (options) => request('dialog.showConfirm', options),
|
|
428
|
-
showPrompt: (options) => request('dialog.showPrompt', options),
|
|
429
|
-
showColorPicker: (options) => request('dialog.showColorPicker', options),
|
|
430
|
-
},
|
|
431
|
-
|
|
432
|
-
// Clipboard API
|
|
433
|
-
clipboard: {
|
|
434
|
-
writeText: (text) => request('clipboard.writeText', { text }),
|
|
435
|
-
readText: () => request('clipboard.readText'),
|
|
436
|
-
writeHTML: (html) => request('clipboard.writeHTML', { html }),
|
|
437
|
-
readHTML: () => request('clipboard.readHTML'),
|
|
438
|
-
clear: () => request('clipboard.clear'),
|
|
439
|
-
},
|
|
440
|
-
|
|
441
|
-
// File System API (limited for security)
|
|
442
|
-
fs: {
|
|
443
|
-
readFile: (path, encoding) => request('fs.readFile', { path, encoding }),
|
|
444
|
-
writeFile: (path, content, encoding) => request('fs.writeFile', { path, content, encoding }),
|
|
445
|
-
exists: (path) => request('fs.exists', { path }),
|
|
446
|
-
stat: (path) => request('fs.stat', { path }),
|
|
447
|
-
readDir: (path) => request('fs.readDir', { path }),
|
|
448
|
-
createDir: (path, recursive) => request('fs.createDir', { path, recursive }),
|
|
449
|
-
remove: (path, recursive) => request('fs.remove', { path, recursive }),
|
|
450
|
-
},
|
|
451
|
-
|
|
452
|
-
// Process/Shell API (limited for security)
|
|
453
|
-
process: {
|
|
454
|
-
exec: (command, options) => request('process.exec', { command, ...options }),
|
|
455
|
-
spawn: (command, args, options) => request('process.spawn', { command, args, ...options }),
|
|
456
|
-
env: () => request('process.env'),
|
|
457
|
-
cwd: () => request('process.cwd'),
|
|
458
|
-
platform: () => request('process.platform'),
|
|
459
|
-
},
|
|
460
|
-
|
|
461
|
-
// Gesture stream
|
|
462
|
-
//
|
|
463
|
-
// A webview's wheel events carry no phase information, so a page can only
|
|
464
|
-
// guess where a trackpad swipe begins and ends — typically with an idle
|
|
465
|
-
// timeout, which mistimes the release and cannot see momentum at all. The
|
|
466
|
-
// host holds the real NSEvent, so it forwards the phases instead:
|
|
467
|
-
//
|
|
468
|
-
// { axis: 'horizontal' | 'vertical',
|
|
469
|
-
// phase: 'begin' | 'change' | 'end',
|
|
470
|
-
// deltaX, deltaY, // points since the last event
|
|
471
|
-
// velocityX, velocityY, // points per second, at 'end'
|
|
472
|
-
// momentum: boolean } // the OS is coasting, not the finger
|
|
473
|
-
//
|
|
474
|
-
// Consumers must stay correct when nothing ever arrives: a host without
|
|
475
|
-
// gesture support simply never emits, so keep the wheel path bound and let
|
|
476
|
-
// a begin phase take over from it.
|
|
477
|
-
gestures: {
|
|
478
|
-
onSwipe: (callback) => on('gesture.swipe', callback),
|
|
479
|
-
},
|
|
480
|
-
|
|
481
|
-
// Native component helpers
|
|
482
|
-
nativeUI,
|
|
483
|
-
components: componentAPI
|
|
484
|
-
});
|
|
485
|
-
|
|
486
|
-
// Dispatch ready event
|
|
487
|
-
window.dispatchEvent(new CustomEvent('craft:ready', { detail: { isCraft: isCraft() } }));
|
|
488
|
-
|
|
489
|
-
if (config.debug) {
|
|
490
|
-
console.log('[Craft Bridge] Initialized, isCraft:', isCraft());
|
|
491
|
-
}
|
|
492
|
-
})();
|
|
493
|
-
</script>
|
|
494
|
-
`;
|
|
28
|
+
export declare const CRAFT_BRIDGE_SCRIPT: string;
|
|
495
29
|
declare const craftBridge: {
|
|
496
30
|
CRAFT_BRIDGE_SCRIPT: string
|
|
497
31
|
generateCraftBridgeScript: typeof generateCraftBridgeScript
|