@xmachines/play-vue 2.0.0-alpha.1 → 2.1.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.
Files changed (37) hide show
  1. package/README.md +27 -29
  2. package/dist/ActorProvider.js +11 -4
  3. package/dist/ActorProvider.js.map +1 -1
  4. package/dist/ActorProvider.vue_vue_type_script_lang.js +124 -76
  5. package/dist/ActorProvider.vue_vue_type_script_lang.js.map +1 -1
  6. package/dist/PlayRenderer.js +11 -4
  7. package/dist/PlayRenderer.js.map +1 -1
  8. package/dist/PlayRenderer.vue_vue_type_script_lang.js +30 -11
  9. package/dist/PlayRenderer.vue_vue_type_script_lang.js.map +1 -1
  10. package/dist/PlayUIProvider.js +11 -4
  11. package/dist/PlayUIProvider.js.map +1 -1
  12. package/dist/PlayUIProvider.vue_vue_type_script_lang.js +51 -32
  13. package/dist/PlayUIProvider.vue_vue_type_script_lang.js.map +1 -1
  14. package/dist/actor-provider-context.d.ts +22 -14
  15. package/dist/actor-provider-context.d.ts.map +1 -1
  16. package/dist/actor-provider-context.js +42 -7
  17. package/dist/actor-provider-context.js.map +1 -1
  18. package/dist/define-registry.d.ts +41 -36
  19. package/dist/define-registry.d.ts.map +1 -1
  20. package/dist/define-registry.js +117 -19
  21. package/dist/define-registry.js.map +1 -1
  22. package/dist/index.d.ts +10 -10
  23. package/dist/index.d.ts.map +1 -1
  24. package/dist/index.js +8 -8
  25. package/dist/types.d.ts +11 -7
  26. package/dist/types.d.ts.map +1 -1
  27. package/dist/useActor.d.ts +31 -25
  28. package/dist/useActor.d.ts.map +1 -1
  29. package/dist/useActor.js +54 -9
  30. package/dist/useActor.js.map +1 -1
  31. package/package.json +25 -24
  32. package/dist/ActorProvider.vue.d.ts +0 -51
  33. package/dist/ActorProvider.vue.d.ts.map +0 -1
  34. package/dist/PlayRenderer.vue.d.ts +0 -5
  35. package/dist/PlayRenderer.vue.d.ts.map +0 -1
  36. package/dist/PlayUIProvider.vue.d.ts +0 -76
  37. package/dist/PlayUIProvider.vue.d.ts.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"PlayRenderer.js","names":[],"sources":["../src/PlayRenderer.vue"],"sourcesContent":["<script lang=\"ts\">\n/**\n * PlayRenderer — zero-prop leaf component for the XMachines Vue render architecture.\n *\n * Reads the current view context from the nearest ActorProvider (or PlayUIProvider)\n * and renders <Renderer spec={view.spec} registry={view.registry} />.\n *\n * Must be used inside <ActorProvider> or <PlayUIProvider>.\n *\n * @example\n * ```ts\n * <PlayUIProvider :actor=\"actor\" :registryResult=\"registryResult\">\n * <PlayRenderer />\n * </PlayUIProvider>\n * ```\n *\n * @invariant Passive Infrastructure - Component observes context, never decides\n */\n\nimport { defineComponent, h } from \"vue\";\nimport { Renderer } from \"@xmachines/json-render-vue\";\nimport { getPlayViewContext } from \"./actor-provider-context.js\";\n\nexport default defineComponent({\n\tname: \"PlayRenderer\",\n\tsetup() {\n\t\t// Call inject at setup() time — valid Vue composition API.\n\t\t// getPlayViewContext() uses inject() which must run synchronously during setup().\n\t\t// The Proxy returned by ActorProviderInner ensures view.spec and view.registry\n\t\t// always reflect the latest values when accessed during the render function.\n\t\tconst view = getPlayViewContext();\n\t\treturn () => {\n\t\t\treturn h(Renderer, { spec: view.spec, registry: view.registry });\n\t\t};\n\t},\n});\n</script>\n"],"mappings":""}
1
+ {"version":3,"file":"PlayRenderer.js","names":[],"sources":["../src/PlayRenderer.vue"],"sourcesContent":["<script lang=\"ts\">\n/**\n * PlayRenderer — the leaf component without props of the XMachines Vue render architecture.\n *\n * It reads the current view context of the nearest ActorProvider, or of the nearest\n * PlayUIProvider. It then renders <Renderer spec={view.spec} registry={view.registry} />.\n *\n * Use it inside <ActorProvider> or <PlayUIProvider>.\n *\n * @example\n * ```ts\n * <PlayUIProvider :actor=\"actor\" :registryResult=\"registryResult\">\n * <PlayRenderer />\n * </PlayUIProvider>\n * ```\n *\n * @invariant Passive Infrastructure - the component observes the context. It never decides\n */\n\nimport { defineComponent, h } from \"vue\";\nimport { Renderer } from \"@xmachines/json-render-vue\";\nimport { usePlayView } from \"./actor-provider-context.js\";\n\nexport default defineComponent({\n\tname: \"PlayRenderer\",\n\tsetup() {\n\t\t// Call inject during setup(), which the composition API of Vue permits.\n\t\t// usePlayView() uses inject(), and inject() must run synchronously during\n\t\t// setup(). The Proxy of ActorProviderInner gives view.spec and view.registry their\n\t\t// newest values on each read in the render function.\n\t\tconst view = usePlayView();\n\t\treturn () => {\n\t\t\treturn h(Renderer, { spec: view.spec, registry: view.registry });\n\t\t};\n\t},\n});\n</script>\n"],"mappings":""}
@@ -1,18 +1,37 @@
1
- import { getPlayViewContext as e } from "./actor-provider-context.js";
2
- import { defineComponent as t, h as n } from "vue";
3
- import { Renderer as r } from "@xmachines/json-render-vue";
4
- //#region src/PlayRenderer.vue?vue&type=script&lang.ts
5
- var i = t({
1
+ import { usePlayView } from "./actor-provider-context.js";
2
+ import { defineComponent, h } from "vue";
3
+ import { Renderer } from "@xmachines/json-render-vue";
4
+ //#region packages/play-vue/src/PlayRenderer.vue?vue&type=script&lang.ts
5
+ /**
6
+ * PlayRenderer — the leaf component without props of the XMachines Vue render architecture.
7
+ *
8
+ * It reads the current view context of the nearest ActorProvider, or of the nearest
9
+ * PlayUIProvider. It then renders <Renderer spec={view.spec} registry={view.registry} />.
10
+ *
11
+ * Use it inside <ActorProvider> or <PlayUIProvider>.
12
+ *
13
+ * @example
14
+ * ```ts
15
+ * <PlayUIProvider :actor="actor" :registryResult="registryResult">
16
+ * <PlayRenderer />
17
+ * </PlayUIProvider>
18
+ * ```
19
+ *
20
+ * @invariant Passive Infrastructure - the component observes the context. It never decides
21
+ */
22
+ var PlayRenderer_vue_vue_type_script_lang_default = defineComponent({
6
23
  name: "PlayRenderer",
7
24
  setup() {
8
- let t = e();
9
- return () => n(r, {
10
- spec: t.spec,
11
- registry: t.registry
12
- });
25
+ const view = usePlayView();
26
+ return () => {
27
+ return h(Renderer, {
28
+ spec: view.spec,
29
+ registry: view.registry
30
+ });
31
+ };
13
32
  }
14
33
  });
15
34
  //#endregion
16
- export { i as default };
35
+ export { PlayRenderer_vue_vue_type_script_lang_default as default };
17
36
 
18
37
  //# sourceMappingURL=PlayRenderer.vue_vue_type_script_lang.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"PlayRenderer.vue_vue_type_script_lang.js","names":[],"sources":["../src/PlayRenderer.vue"],"sourcesContent":["<script lang=\"ts\">\n/**\n * PlayRenderer — zero-prop leaf component for the XMachines Vue render architecture.\n *\n * Reads the current view context from the nearest ActorProvider (or PlayUIProvider)\n * and renders <Renderer spec={view.spec} registry={view.registry} />.\n *\n * Must be used inside <ActorProvider> or <PlayUIProvider>.\n *\n * @example\n * ```ts\n * <PlayUIProvider :actor=\"actor\" :registryResult=\"registryResult\">\n * <PlayRenderer />\n * </PlayUIProvider>\n * ```\n *\n * @invariant Passive Infrastructure - Component observes context, never decides\n */\n\nimport { defineComponent, h } from \"vue\";\nimport { Renderer } from \"@xmachines/json-render-vue\";\nimport { getPlayViewContext } from \"./actor-provider-context.js\";\n\nexport default defineComponent({\n\tname: \"PlayRenderer\",\n\tsetup() {\n\t\t// Call inject at setup() time — valid Vue composition API.\n\t\t// getPlayViewContext() uses inject() which must run synchronously during setup().\n\t\t// The Proxy returned by ActorProviderInner ensures view.spec and view.registry\n\t\t// always reflect the latest values when accessed during the render function.\n\t\tconst view = getPlayViewContext();\n\t\treturn () => {\n\t\t\treturn h(Renderer, { spec: view.spec, registry: view.registry });\n\t\t};\n\t},\n});\n</script>\n"],"mappings":";;;;AAuBA,IAAA,IAAe,EAAgB;CAC9B,MAAM;CACN,QAAQ;EAKP,IAAM,IAAO,EAAmB;EAChC,aACQ,EAAE,GAAU;GAAE,MAAM,EAAK;GAAM,UAAU,EAAK;EAAS,CAAC;CAEjE;AACD,CAAC"}
1
+ {"version":3,"file":"PlayRenderer.vue_vue_type_script_lang.js","names":[],"sources":["../src/PlayRenderer.vue"],"sourcesContent":["<script lang=\"ts\">\n/**\n * PlayRenderer — the leaf component without props of the XMachines Vue render architecture.\n *\n * It reads the current view context of the nearest ActorProvider, or of the nearest\n * PlayUIProvider. It then renders <Renderer spec={view.spec} registry={view.registry} />.\n *\n * Use it inside <ActorProvider> or <PlayUIProvider>.\n *\n * @example\n * ```ts\n * <PlayUIProvider :actor=\"actor\" :registryResult=\"registryResult\">\n * <PlayRenderer />\n * </PlayUIProvider>\n * ```\n *\n * @invariant Passive Infrastructure - the component observes the context. It never decides\n */\n\nimport { defineComponent, h } from \"vue\";\nimport { Renderer } from \"@xmachines/json-render-vue\";\nimport { usePlayView } from \"./actor-provider-context.js\";\n\nexport default defineComponent({\n\tname: \"PlayRenderer\",\n\tsetup() {\n\t\t// Call inject during setup(), which the composition API of Vue permits.\n\t\t// usePlayView() uses inject(), and inject() must run synchronously during\n\t\t// setup(). The Proxy of ActorProviderInner gives view.spec and view.registry their\n\t\t// newest values on each read in the render function.\n\t\tconst view = usePlayView();\n\t\treturn () => {\n\t\t\treturn h(Renderer, { spec: view.spec, registry: view.registry });\n\t\t};\n\t},\n});\n</script>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAuBA,IAAA,gDAAe,gBAAgB;CAC9B,MAAM;CACN,QAAQ;EAKP,MAAM,OAAO,YAAY;EACzB,aAAa;GACZ,OAAO,EAAE,UAAU;IAAE,MAAM,KAAK;IAAM,UAAU,KAAK;GAAS,CAAC;EAChE;CACD;AACD,CAAC"}
@@ -1,7 +1,14 @@
1
- import e from "./PlayUIProvider.vue_vue_type_script_lang.js";
2
- //#region src/PlayUIProvider.vue
3
- var t = e;
1
+ import PlayUIProvider_vue_vue_type_script_lang_default from "./PlayUIProvider.vue_vue_type_script_lang.js";
2
+ import { useSSRContext } from "vue";
3
+ //#region packages/play-vue/src/PlayUIProvider.vue
4
+ var _sfc_setup = PlayUIProvider_vue_vue_type_script_lang_default.setup;
5
+ PlayUIProvider_vue_vue_type_script_lang_default.setup = (props, ctx) => {
6
+ const ssrContext = useSSRContext();
7
+ (ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("packages/play-vue/src/PlayUIProvider.vue");
8
+ return _sfc_setup ? _sfc_setup(props, ctx) : void 0;
9
+ };
10
+ var PlayUIProvider_default = PlayUIProvider_vue_vue_type_script_lang_default;
4
11
  //#endregion
5
- export { t as default };
12
+ export { PlayUIProvider_default as default };
6
13
 
7
14
  //# sourceMappingURL=PlayUIProvider.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"PlayUIProvider.js","names":[],"sources":["../src/PlayUIProvider.vue"],"sourcesContent":["<script lang=\"ts\">\n/**\n * PlayUIProvider — batteries-included composite provider for actor-driven UI rendering.\n *\n * Wraps ActorProvider + JSONUIProvider (from @xmachines/json-render-vue) to provide a single\n * entry point for all actor lifecycle and UI rendering concerns.\n *\n * Standard usage:\n * ```ts\n * <PlayUIProvider :actor=\"actor\" :registryResult=\"registryResult\">\n * <PlayRenderer />\n * </PlayUIProvider>\n * ```\n *\n * For custom provider composition (escape hatch), use <ActorProvider> directly.\n *\n * @packageDocumentation\n */\n\nimport { defineComponent, h } from \"vue\";\nimport type { PropType } from \"vue\";\nimport { JSONUIProvider } from \"@xmachines/json-render-vue\";\nimport type { DefineRegistryResult, RenderErrorHandler } from \"@xmachines/json-render-vue\";\n\nimport type { StateStore } from \"@xmachines/json-render-core\";\nimport type { AbstractActor, Viewable } from \"@xmachines/play-actor\";\nimport type { AnyActorLogic } from \"xstate\";\nimport ActorProvider from \"./ActorProvider.vue\";\nimport { getPlayViewContext } from \"./actor-provider-context.js\";\nimport type { PlayUIProviderProps } from \"./types.js\";\n\n// Re-export props type for consumers who import from this file\nexport type { PlayUIProviderProps } from \"./types.js\";\n\n// ---------------------------------------------------------------------------\n// JSONUIBridge — inner component inside ActorProvider's tree\n// Reads ViewContextValue via getPlayViewContext() and passes handlers + registry\n// to JSONUIProvider so both ActorProvider and JSONUIProvider share the same state.\n// ---------------------------------------------------------------------------\n\nconst JSONUIBridge = defineComponent({\n\tname: \"JSONUIBridge\",\n\tprops: {\n\t\tnavigate: {\n\t\t\ttype: Function as PropType<(path: string) => void>,\n\t\t\tdefault: undefined,\n\t\t},\n\t\tvalidationFunctions: {\n\t\t\ttype: Object as PropType<\n\t\t\t\tRecord<string, (value: unknown, args?: Record<string, unknown>) => boolean>\n\t\t\t>,\n\t\t\tdefault: undefined,\n\t\t},\n\t\tfunctions: {\n\t\t\ttype: Object as PropType<\n\t\t\t\tRecord<\n\t\t\t\t\tstring,\n\t\t\t\t\t(args?: Record<string, unknown>, state?: Record<string, unknown>) => unknown\n\t\t\t\t>\n\t\t\t>,\n\t\t\tdefault: undefined,\n\t\t},\n\t},\n\tsetup(props, { slots }) {\n\t\treturn () => {\n\t\t\tconst view = getPlayViewContext();\n\t\t\treturn h(\n\t\t\t\tJSONUIProvider,\n\t\t\t\t{\n\t\t\t\t\tregistry: view.registry,\n\t\t\t\t\thandlers: view.handlers,\n\t\t\t\t\tstore: view.store,\n\t\t\t\t\t...(props.navigate ? { navigate: props.navigate } : {}),\n\t\t\t\t\t...(props.validationFunctions\n\t\t\t\t\t\t? { validationFunctions: props.validationFunctions }\n\t\t\t\t\t\t: {}),\n\t\t\t\t\t...(props.functions ? { functions: props.functions } : {}),\n\t\t\t\t},\n\t\t\t\tslots,\n\t\t\t);\n\t\t};\n\t},\n});\n\n// ---------------------------------------------------------------------------\n// PlayUIProvider — main export\n// ---------------------------------------------------------------------------\n\nexport default defineComponent({\n\tname: \"PlayUIProvider\",\n\tprops: {\n\t\tactor: {\n\t\t\ttype: Object as PropType<AbstractActor<AnyActorLogic> & Viewable>,\n\t\t\trequired: true,\n\t\t},\n\t\tregistryResult: {\n\t\t\ttype: Object as PropType<DefineRegistryResult>,\n\t\t\trequired: true,\n\t\t},\n\t\tstore: {\n\t\t\ttype: Object as PropType<StateStore>,\n\t\t\tdefault: undefined,\n\t\t},\n\t\tonRenderError: {\n\t\t\ttype: Function as PropType<RenderErrorHandler>,\n\t\t\tdefault: undefined,\n\t\t},\n\t\tnavigate: {\n\t\t\ttype: Function as PropType<PlayUIProviderProps[\"navigate\"]>,\n\t\t\tdefault: undefined,\n\t\t},\n\t\tvalidationFunctions: {\n\t\t\ttype: Object as PropType<PlayUIProviderProps[\"validationFunctions\"]>,\n\t\t\tdefault: undefined,\n\t\t},\n\t\tfunctions: {\n\t\t\ttype: Object as PropType<PlayUIProviderProps[\"functions\"]>,\n\t\t\tdefault: undefined,\n\t\t},\n\t},\n\tsetup(props, { slots }) {\n\t\treturn () =>\n\t\t\th(\n\t\t\t\tActorProvider,\n\t\t\t\t{\n\t\t\t\t\tactor: props.actor,\n\t\t\t\t\tregistryResult: props.registryResult,\n\t\t\t\t\t...(props.store ? { store: props.store } : {}),\n\t\t\t\t\t...(props.onRenderError ? { onRenderError: props.onRenderError } : {}),\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tdefault: () =>\n\t\t\t\t\t\th(\n\t\t\t\t\t\t\tJSONUIBridge,\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t...(props.navigate ? { navigate: props.navigate } : {}),\n\t\t\t\t\t\t\t\t...(props.validationFunctions\n\t\t\t\t\t\t\t\t\t? { validationFunctions: props.validationFunctions }\n\t\t\t\t\t\t\t\t\t: {}),\n\t\t\t\t\t\t\t\t...(props.functions ? { functions: props.functions } : {}),\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tslots,\n\t\t\t\t\t\t),\n\t\t\t\t\tfallback: slots.fallback,\n\t\t\t\t},\n\t\t\t);\n\t},\n});\n</script>\n"],"mappings":""}
1
+ {"version":3,"file":"PlayUIProvider.js","names":[],"sources":["../src/PlayUIProvider.vue"],"sourcesContent":["<script lang=\"ts\">\n/**\n * PlayUIProvider — the composite provider of an actor-driven UI.\n *\n * It wraps ActorProvider and JSONUIProvider, from @xmachines/json-render-vue. One\n * component therefore serves the complete actor lifecycle and the complete UI\n * rendering.\n *\n * The standard use:\n * ```ts\n * <PlayUIProvider :actor=\"actor\" :registryResult=\"registryResult\">\n * <PlayRenderer />\n * </PlayUIProvider>\n * ```\n *\n * For a custom provider composition, use <ActorProvider> directly.\n *\n * @packageDocumentation\n */\n\nimport { defineComponent, h } from \"vue\";\nimport type { PropType } from \"vue\";\nimport { JSONUIProvider } from \"@xmachines/json-render-vue\";\nimport type { DefineRegistryResult, RenderErrorHandler } from \"@xmachines/json-render-vue\";\n\nimport type { StateStore } from \"@xmachines/json-render-core\";\nimport type { AbstractActor, Viewable } from \"@xmachines/play-actor\";\nimport type { AnyActorLogic } from \"xstate\";\nimport ActorProvider from \"./ActorProvider.vue\";\nimport { usePlayView } from \"./actor-provider-context.js\";\nimport type { PlayUIProviderProps } from \"./types.js\";\n\n// Re-export the props type, for a consumer that imports from this file\nexport type { PlayUIProviderProps } from \"./types.js\";\n\n// ---------------------------------------------------------------------------\n// JSONUIBridge — the inner component inside the tree of ActorProvider\n// It reads the ViewContextValue with usePlayView(), and it gives the handlers\n// and the registry to JSONUIProvider. Therefore ActorProvider and JSONUIProvider\n// share one state.\n// ---------------------------------------------------------------------------\n\nconst JSONUIBridge = defineComponent({\n\tname: \"JSONUIBridge\",\n\tprops: {\n\t\tnavigate: {\n\t\t\ttype: Function as PropType<(path: string) => void>,\n\t\t\tdefault: undefined,\n\t\t},\n\t\tvalidationFunctions: {\n\t\t\ttype: Object as PropType<\n\t\t\t\tRecord<string, (value: unknown, args?: Record<string, unknown>) => boolean>\n\t\t\t>,\n\t\t\tdefault: undefined,\n\t\t},\n\t\tfunctions: {\n\t\t\ttype: Object as PropType<\n\t\t\t\tRecord<\n\t\t\t\t\tstring,\n\t\t\t\t\t(args?: Record<string, unknown>, state?: Record<string, unknown>) => unknown\n\t\t\t\t>\n\t\t\t>,\n\t\t\tdefault: undefined,\n\t\t},\n\t},\n\tsetup(props, { slots }) {\n\t\treturn () => {\n\t\t\tconst view = usePlayView();\n\t\t\treturn h(\n\t\t\t\tJSONUIProvider,\n\t\t\t\t{\n\t\t\t\t\tregistry: view.registry,\n\t\t\t\t\thandlers: view.handlers,\n\t\t\t\t\tstore: view.store,\n\t\t\t\t\t...(props.navigate ? { navigate: props.navigate } : {}),\n\t\t\t\t\t...(props.validationFunctions\n\t\t\t\t\t\t? { validationFunctions: props.validationFunctions }\n\t\t\t\t\t\t: {}),\n\t\t\t\t\t...(props.functions ? { functions: props.functions } : {}),\n\t\t\t\t},\n\t\t\t\tslots,\n\t\t\t);\n\t\t};\n\t},\n});\n\n// ---------------------------------------------------------------------------\n// PlayUIProvider — the main export\n// ---------------------------------------------------------------------------\n\nexport default defineComponent({\n\tname: \"PlayUIProvider\",\n\tprops: {\n\t\tactor: {\n\t\t\ttype: Object as PropType<AbstractActor<AnyActorLogic> & Viewable>,\n\t\t\trequired: true,\n\t\t},\n\t\tregistryResult: {\n\t\t\ttype: Object as PropType<DefineRegistryResult>,\n\t\t\trequired: true,\n\t\t},\n\t\tstore: {\n\t\t\ttype: Object as PropType<StateStore>,\n\t\t\tdefault: undefined,\n\t\t},\n\t\tonRenderError: {\n\t\t\ttype: Function as PropType<RenderErrorHandler>,\n\t\t\tdefault: undefined,\n\t\t},\n\t\tnavigate: {\n\t\t\ttype: Function as PropType<PlayUIProviderProps[\"navigate\"]>,\n\t\t\tdefault: undefined,\n\t\t},\n\t\tvalidationFunctions: {\n\t\t\ttype: Object as PropType<PlayUIProviderProps[\"validationFunctions\"]>,\n\t\t\tdefault: undefined,\n\t\t},\n\t\tfunctions: {\n\t\t\ttype: Object as PropType<PlayUIProviderProps[\"functions\"]>,\n\t\t\tdefault: undefined,\n\t\t},\n\t},\n\tsetup(props, { slots }) {\n\t\treturn () =>\n\t\t\th(\n\t\t\t\tActorProvider,\n\t\t\t\t{\n\t\t\t\t\tactor: props.actor,\n\t\t\t\t\tregistryResult: props.registryResult,\n\t\t\t\t\t...(props.store ? { store: props.store } : {}),\n\t\t\t\t\t...(props.onRenderError ? { onRenderError: props.onRenderError } : {}),\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tdefault: () =>\n\t\t\t\t\t\th(\n\t\t\t\t\t\t\tJSONUIBridge,\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t...(props.navigate ? { navigate: props.navigate } : {}),\n\t\t\t\t\t\t\t\t...(props.validationFunctions\n\t\t\t\t\t\t\t\t\t? { validationFunctions: props.validationFunctions }\n\t\t\t\t\t\t\t\t\t: {}),\n\t\t\t\t\t\t\t\t...(props.functions ? { functions: props.functions } : {}),\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tslots,\n\t\t\t\t\t\t),\n\t\t\t\t\tfallback: slots.fallback,\n\t\t\t\t},\n\t\t\t);\n\t},\n});\n</script>\n"],"mappings":""}
@@ -1,9 +1,27 @@
1
- import { getPlayViewContext as e } from "./actor-provider-context.js";
2
- import t from "./ActorProvider.js";
3
- import { defineComponent as n, h as r } from "vue";
4
- import { JSONUIProvider as i } from "@xmachines/json-render-vue";
5
- //#region src/PlayUIProvider.vue?vue&type=script&lang.ts
6
- var a = n({
1
+ import { usePlayView } from "./actor-provider-context.js";
2
+ import ActorProvider_default from "./ActorProvider.js";
3
+ import { defineComponent, h } from "vue";
4
+ import { JSONUIProvider } from "@xmachines/json-render-vue";
5
+ //#region packages/play-vue/src/PlayUIProvider.vue?vue&type=script&lang.ts
6
+ /**
7
+ * PlayUIProvider — the composite provider of an actor-driven UI.
8
+ *
9
+ * It wraps ActorProvider and JSONUIProvider, from @xmachines/json-render-vue. One
10
+ * component therefore serves the complete actor lifecycle and the complete UI
11
+ * rendering.
12
+ *
13
+ * The standard use:
14
+ * ```ts
15
+ * <PlayUIProvider :actor="actor" :registryResult="registryResult">
16
+ * <PlayRenderer />
17
+ * </PlayUIProvider>
18
+ * ```
19
+ *
20
+ * For a custom provider composition, use <ActorProvider> directly.
21
+ *
22
+ * @packageDocumentation
23
+ */
24
+ var JSONUIBridge = defineComponent({
7
25
  name: "JSONUIBridge",
8
26
  props: {
9
27
  navigate: {
@@ -19,29 +37,30 @@ var a = n({
19
37
  default: void 0
20
38
  }
21
39
  },
22
- setup(t, { slots: n }) {
40
+ setup(props, { slots }) {
23
41
  return () => {
24
- let a = e();
25
- return r(i, {
26
- registry: a.registry,
27
- handlers: a.handlers,
28
- store: a.store,
29
- ...t.navigate ? { navigate: t.navigate } : {},
30
- ...t.validationFunctions ? { validationFunctions: t.validationFunctions } : {},
31
- ...t.functions ? { functions: t.functions } : {}
32
- }, n);
42
+ const view = usePlayView();
43
+ return h(JSONUIProvider, {
44
+ registry: view.registry,
45
+ handlers: view.handlers,
46
+ store: view.store,
47
+ ...props.navigate ? { navigate: props.navigate } : {},
48
+ ...props.validationFunctions ? { validationFunctions: props.validationFunctions } : {},
49
+ ...props.functions ? { functions: props.functions } : {}
50
+ }, slots);
33
51
  };
34
52
  }
35
- }), o = n({
53
+ });
54
+ var PlayUIProvider_vue_vue_type_script_lang_default = defineComponent({
36
55
  name: "PlayUIProvider",
37
56
  props: {
38
57
  actor: {
39
58
  type: Object,
40
- required: !0
59
+ required: true
41
60
  },
42
61
  registryResult: {
43
62
  type: Object,
44
- required: !0
63
+ required: true
45
64
  },
46
65
  store: {
47
66
  type: Object,
@@ -64,23 +83,23 @@ var a = n({
64
83
  default: void 0
65
84
  }
66
85
  },
67
- setup(e, { slots: n }) {
68
- return () => r(t, {
69
- actor: e.actor,
70
- registryResult: e.registryResult,
71
- ...e.store ? { store: e.store } : {},
72
- ...e.onRenderError ? { onRenderError: e.onRenderError } : {}
86
+ setup(props, { slots }) {
87
+ return () => h(ActorProvider_default, {
88
+ actor: props.actor,
89
+ registryResult: props.registryResult,
90
+ ...props.store ? { store: props.store } : {},
91
+ ...props.onRenderError ? { onRenderError: props.onRenderError } : {}
73
92
  }, {
74
- default: () => r(a, {
75
- ...e.navigate ? { navigate: e.navigate } : {},
76
- ...e.validationFunctions ? { validationFunctions: e.validationFunctions } : {},
77
- ...e.functions ? { functions: e.functions } : {}
78
- }, n),
79
- fallback: n.fallback
93
+ default: () => h(JSONUIBridge, {
94
+ ...props.navigate ? { navigate: props.navigate } : {},
95
+ ...props.validationFunctions ? { validationFunctions: props.validationFunctions } : {},
96
+ ...props.functions ? { functions: props.functions } : {}
97
+ }, slots),
98
+ fallback: slots.fallback
80
99
  });
81
100
  }
82
101
  });
83
102
  //#endregion
84
- export { o as default };
103
+ export { PlayUIProvider_vue_vue_type_script_lang_default as default };
85
104
 
86
105
  //# sourceMappingURL=PlayUIProvider.vue_vue_type_script_lang.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"PlayUIProvider.vue_vue_type_script_lang.js","names":[],"sources":["../src/PlayUIProvider.vue"],"sourcesContent":["<script lang=\"ts\">\n/**\n * PlayUIProvider — batteries-included composite provider for actor-driven UI rendering.\n *\n * Wraps ActorProvider + JSONUIProvider (from @xmachines/json-render-vue) to provide a single\n * entry point for all actor lifecycle and UI rendering concerns.\n *\n * Standard usage:\n * ```ts\n * <PlayUIProvider :actor=\"actor\" :registryResult=\"registryResult\">\n * <PlayRenderer />\n * </PlayUIProvider>\n * ```\n *\n * For custom provider composition (escape hatch), use <ActorProvider> directly.\n *\n * @packageDocumentation\n */\n\nimport { defineComponent, h } from \"vue\";\nimport type { PropType } from \"vue\";\nimport { JSONUIProvider } from \"@xmachines/json-render-vue\";\nimport type { DefineRegistryResult, RenderErrorHandler } from \"@xmachines/json-render-vue\";\n\nimport type { StateStore } from \"@xmachines/json-render-core\";\nimport type { AbstractActor, Viewable } from \"@xmachines/play-actor\";\nimport type { AnyActorLogic } from \"xstate\";\nimport ActorProvider from \"./ActorProvider.vue\";\nimport { getPlayViewContext } from \"./actor-provider-context.js\";\nimport type { PlayUIProviderProps } from \"./types.js\";\n\n// Re-export props type for consumers who import from this file\nexport type { PlayUIProviderProps } from \"./types.js\";\n\n// ---------------------------------------------------------------------------\n// JSONUIBridge — inner component inside ActorProvider's tree\n// Reads ViewContextValue via getPlayViewContext() and passes handlers + registry\n// to JSONUIProvider so both ActorProvider and JSONUIProvider share the same state.\n// ---------------------------------------------------------------------------\n\nconst JSONUIBridge = defineComponent({\n\tname: \"JSONUIBridge\",\n\tprops: {\n\t\tnavigate: {\n\t\t\ttype: Function as PropType<(path: string) => void>,\n\t\t\tdefault: undefined,\n\t\t},\n\t\tvalidationFunctions: {\n\t\t\ttype: Object as PropType<\n\t\t\t\tRecord<string, (value: unknown, args?: Record<string, unknown>) => boolean>\n\t\t\t>,\n\t\t\tdefault: undefined,\n\t\t},\n\t\tfunctions: {\n\t\t\ttype: Object as PropType<\n\t\t\t\tRecord<\n\t\t\t\t\tstring,\n\t\t\t\t\t(args?: Record<string, unknown>, state?: Record<string, unknown>) => unknown\n\t\t\t\t>\n\t\t\t>,\n\t\t\tdefault: undefined,\n\t\t},\n\t},\n\tsetup(props, { slots }) {\n\t\treturn () => {\n\t\t\tconst view = getPlayViewContext();\n\t\t\treturn h(\n\t\t\t\tJSONUIProvider,\n\t\t\t\t{\n\t\t\t\t\tregistry: view.registry,\n\t\t\t\t\thandlers: view.handlers,\n\t\t\t\t\tstore: view.store,\n\t\t\t\t\t...(props.navigate ? { navigate: props.navigate } : {}),\n\t\t\t\t\t...(props.validationFunctions\n\t\t\t\t\t\t? { validationFunctions: props.validationFunctions }\n\t\t\t\t\t\t: {}),\n\t\t\t\t\t...(props.functions ? { functions: props.functions } : {}),\n\t\t\t\t},\n\t\t\t\tslots,\n\t\t\t);\n\t\t};\n\t},\n});\n\n// ---------------------------------------------------------------------------\n// PlayUIProvider — main export\n// ---------------------------------------------------------------------------\n\nexport default defineComponent({\n\tname: \"PlayUIProvider\",\n\tprops: {\n\t\tactor: {\n\t\t\ttype: Object as PropType<AbstractActor<AnyActorLogic> & Viewable>,\n\t\t\trequired: true,\n\t\t},\n\t\tregistryResult: {\n\t\t\ttype: Object as PropType<DefineRegistryResult>,\n\t\t\trequired: true,\n\t\t},\n\t\tstore: {\n\t\t\ttype: Object as PropType<StateStore>,\n\t\t\tdefault: undefined,\n\t\t},\n\t\tonRenderError: {\n\t\t\ttype: Function as PropType<RenderErrorHandler>,\n\t\t\tdefault: undefined,\n\t\t},\n\t\tnavigate: {\n\t\t\ttype: Function as PropType<PlayUIProviderProps[\"navigate\"]>,\n\t\t\tdefault: undefined,\n\t\t},\n\t\tvalidationFunctions: {\n\t\t\ttype: Object as PropType<PlayUIProviderProps[\"validationFunctions\"]>,\n\t\t\tdefault: undefined,\n\t\t},\n\t\tfunctions: {\n\t\t\ttype: Object as PropType<PlayUIProviderProps[\"functions\"]>,\n\t\t\tdefault: undefined,\n\t\t},\n\t},\n\tsetup(props, { slots }) {\n\t\treturn () =>\n\t\t\th(\n\t\t\t\tActorProvider,\n\t\t\t\t{\n\t\t\t\t\tactor: props.actor,\n\t\t\t\t\tregistryResult: props.registryResult,\n\t\t\t\t\t...(props.store ? { store: props.store } : {}),\n\t\t\t\t\t...(props.onRenderError ? { onRenderError: props.onRenderError } : {}),\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tdefault: () =>\n\t\t\t\t\t\th(\n\t\t\t\t\t\t\tJSONUIBridge,\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t...(props.navigate ? { navigate: props.navigate } : {}),\n\t\t\t\t\t\t\t\t...(props.validationFunctions\n\t\t\t\t\t\t\t\t\t? { validationFunctions: props.validationFunctions }\n\t\t\t\t\t\t\t\t\t: {}),\n\t\t\t\t\t\t\t\t...(props.functions ? { functions: props.functions } : {}),\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tslots,\n\t\t\t\t\t\t),\n\t\t\t\t\tfallback: slots.fallback,\n\t\t\t\t},\n\t\t\t);\n\t},\n});\n</script>\n"],"mappings":";;;;;AAwCA,IAAM,IAAe,EAAgB;CACpC,MAAM;CACN,OAAO;EACN,UAAU;GACT,MAAM;GACN,SAAS,KAAA;EACV;EACA,qBAAqB;GACpB,MAAM;GAGN,SAAS,KAAA;EACV;EACA,WAAW;GACV,MAAM;GAMN,SAAS,KAAA;EACV;CACD;CACA,MAAM,GAAO,EAAE,YAAS;EACvB,aAAa;GACZ,IAAM,IAAO,EAAmB;GAChC,OAAO,EACN,GACA;IACC,UAAU,EAAK;IACf,UAAU,EAAK;IACf,OAAO,EAAK;IACZ,GAAI,EAAM,WAAW,EAAE,UAAU,EAAM,SAAS,IAAI,CAAC;IACrD,GAAI,EAAM,sBACP,EAAE,qBAAqB,EAAM,oBAAoB,IACjD,CAAC;IACJ,GAAI,EAAM,YAAY,EAAE,WAAW,EAAM,UAAU,IAAI,CAAC;GACzD,GACA,CACD;EACD;CACD;AACD,CAAC,GAMD,IAAe,EAAgB;CAC9B,MAAM;CACN,OAAO;EACN,OAAO;GACN,MAAM;GACN,UAAU;EACX;EACA,gBAAgB;GACf,MAAM;GACN,UAAU;EACX;EACA,OAAO;GACN,MAAM;GACN,SAAS,KAAA;EACV;EACA,eAAe;GACd,MAAM;GACN,SAAS,KAAA;EACV;EACA,UAAU;GACT,MAAM;GACN,SAAS,KAAA;EACV;EACA,qBAAqB;GACpB,MAAM;GACN,SAAS,KAAA;EACV;EACA,WAAW;GACV,MAAM;GACN,SAAS,KAAA;EACV;CACD;CACA,MAAM,GAAO,EAAE,YAAS;EACvB,aACC,EACC,GACA;GACC,OAAO,EAAM;GACb,gBAAgB,EAAM;GACtB,GAAI,EAAM,QAAQ,EAAE,OAAO,EAAM,MAAM,IAAI,CAAC;GAC5C,GAAI,EAAM,gBAAgB,EAAE,eAAe,EAAM,cAAc,IAAI,CAAC;EACrE,GACA;GACC,eACC,EACC,GACA;IACC,GAAI,EAAM,WAAW,EAAE,UAAU,EAAM,SAAS,IAAI,CAAC;IACrD,GAAI,EAAM,sBACP,EAAE,qBAAqB,EAAM,oBAAoB,IACjD,CAAC;IACJ,GAAI,EAAM,YAAY,EAAE,WAAW,EAAM,UAAU,IAAI,CAAC;GACzD,GACA,CACD;GACD,UAAU,EAAM;EACjB,CACD;CACF;AACD,CAAC"}
1
+ {"version":3,"file":"PlayUIProvider.vue_vue_type_script_lang.js","names":[],"sources":["../src/PlayUIProvider.vue"],"sourcesContent":["<script lang=\"ts\">\n/**\n * PlayUIProvider — the composite provider of an actor-driven UI.\n *\n * It wraps ActorProvider and JSONUIProvider, from @xmachines/json-render-vue. One\n * component therefore serves the complete actor lifecycle and the complete UI\n * rendering.\n *\n * The standard use:\n * ```ts\n * <PlayUIProvider :actor=\"actor\" :registryResult=\"registryResult\">\n * <PlayRenderer />\n * </PlayUIProvider>\n * ```\n *\n * For a custom provider composition, use <ActorProvider> directly.\n *\n * @packageDocumentation\n */\n\nimport { defineComponent, h } from \"vue\";\nimport type { PropType } from \"vue\";\nimport { JSONUIProvider } from \"@xmachines/json-render-vue\";\nimport type { DefineRegistryResult, RenderErrorHandler } from \"@xmachines/json-render-vue\";\n\nimport type { StateStore } from \"@xmachines/json-render-core\";\nimport type { AbstractActor, Viewable } from \"@xmachines/play-actor\";\nimport type { AnyActorLogic } from \"xstate\";\nimport ActorProvider from \"./ActorProvider.vue\";\nimport { usePlayView } from \"./actor-provider-context.js\";\nimport type { PlayUIProviderProps } from \"./types.js\";\n\n// Re-export the props type, for a consumer that imports from this file\nexport type { PlayUIProviderProps } from \"./types.js\";\n\n// ---------------------------------------------------------------------------\n// JSONUIBridge — the inner component inside the tree of ActorProvider\n// It reads the ViewContextValue with usePlayView(), and it gives the handlers\n// and the registry to JSONUIProvider. Therefore ActorProvider and JSONUIProvider\n// share one state.\n// ---------------------------------------------------------------------------\n\nconst JSONUIBridge = defineComponent({\n\tname: \"JSONUIBridge\",\n\tprops: {\n\t\tnavigate: {\n\t\t\ttype: Function as PropType<(path: string) => void>,\n\t\t\tdefault: undefined,\n\t\t},\n\t\tvalidationFunctions: {\n\t\t\ttype: Object as PropType<\n\t\t\t\tRecord<string, (value: unknown, args?: Record<string, unknown>) => boolean>\n\t\t\t>,\n\t\t\tdefault: undefined,\n\t\t},\n\t\tfunctions: {\n\t\t\ttype: Object as PropType<\n\t\t\t\tRecord<\n\t\t\t\t\tstring,\n\t\t\t\t\t(args?: Record<string, unknown>, state?: Record<string, unknown>) => unknown\n\t\t\t\t>\n\t\t\t>,\n\t\t\tdefault: undefined,\n\t\t},\n\t},\n\tsetup(props, { slots }) {\n\t\treturn () => {\n\t\t\tconst view = usePlayView();\n\t\t\treturn h(\n\t\t\t\tJSONUIProvider,\n\t\t\t\t{\n\t\t\t\t\tregistry: view.registry,\n\t\t\t\t\thandlers: view.handlers,\n\t\t\t\t\tstore: view.store,\n\t\t\t\t\t...(props.navigate ? { navigate: props.navigate } : {}),\n\t\t\t\t\t...(props.validationFunctions\n\t\t\t\t\t\t? { validationFunctions: props.validationFunctions }\n\t\t\t\t\t\t: {}),\n\t\t\t\t\t...(props.functions ? { functions: props.functions } : {}),\n\t\t\t\t},\n\t\t\t\tslots,\n\t\t\t);\n\t\t};\n\t},\n});\n\n// ---------------------------------------------------------------------------\n// PlayUIProvider — the main export\n// ---------------------------------------------------------------------------\n\nexport default defineComponent({\n\tname: \"PlayUIProvider\",\n\tprops: {\n\t\tactor: {\n\t\t\ttype: Object as PropType<AbstractActor<AnyActorLogic> & Viewable>,\n\t\t\trequired: true,\n\t\t},\n\t\tregistryResult: {\n\t\t\ttype: Object as PropType<DefineRegistryResult>,\n\t\t\trequired: true,\n\t\t},\n\t\tstore: {\n\t\t\ttype: Object as PropType<StateStore>,\n\t\t\tdefault: undefined,\n\t\t},\n\t\tonRenderError: {\n\t\t\ttype: Function as PropType<RenderErrorHandler>,\n\t\t\tdefault: undefined,\n\t\t},\n\t\tnavigate: {\n\t\t\ttype: Function as PropType<PlayUIProviderProps[\"navigate\"]>,\n\t\t\tdefault: undefined,\n\t\t},\n\t\tvalidationFunctions: {\n\t\t\ttype: Object as PropType<PlayUIProviderProps[\"validationFunctions\"]>,\n\t\t\tdefault: undefined,\n\t\t},\n\t\tfunctions: {\n\t\t\ttype: Object as PropType<PlayUIProviderProps[\"functions\"]>,\n\t\t\tdefault: undefined,\n\t\t},\n\t},\n\tsetup(props, { slots }) {\n\t\treturn () =>\n\t\t\th(\n\t\t\t\tActorProvider,\n\t\t\t\t{\n\t\t\t\t\tactor: props.actor,\n\t\t\t\t\tregistryResult: props.registryResult,\n\t\t\t\t\t...(props.store ? { store: props.store } : {}),\n\t\t\t\t\t...(props.onRenderError ? { onRenderError: props.onRenderError } : {}),\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tdefault: () =>\n\t\t\t\t\t\th(\n\t\t\t\t\t\t\tJSONUIBridge,\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t...(props.navigate ? { navigate: props.navigate } : {}),\n\t\t\t\t\t\t\t\t...(props.validationFunctions\n\t\t\t\t\t\t\t\t\t? { validationFunctions: props.validationFunctions }\n\t\t\t\t\t\t\t\t\t: {}),\n\t\t\t\t\t\t\t\t...(props.functions ? { functions: props.functions } : {}),\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tslots,\n\t\t\t\t\t\t),\n\t\t\t\t\tfallback: slots.fallback,\n\t\t\t\t},\n\t\t\t);\n\t},\n});\n</script>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AA0CA,IAAM,eAAe,gBAAgB;CACpC,MAAM;CACN,OAAO;EACN,UAAU;GACT,MAAM;GACN,SAAS,KAAA;EACV;EACA,qBAAqB;GACpB,MAAM;GAGN,SAAS,KAAA;EACV;EACA,WAAW;GACV,MAAM;GAMN,SAAS,KAAA;EACV;CACD;CACA,MAAM,OAAO,EAAE,SAAS;EACvB,aAAa;GACZ,MAAM,OAAO,YAAY;GACzB,OAAO,EACN,gBACA;IACC,UAAU,KAAK;IACf,UAAU,KAAK;IACf,OAAO,KAAK;IACZ,GAAI,MAAM,WAAW,EAAE,UAAU,MAAM,SAAS,IAAI,CAAC;IACrD,GAAI,MAAM,sBACP,EAAE,qBAAqB,MAAM,oBAAoB,IACjD,CAAC;IACJ,GAAI,MAAM,YAAY,EAAE,WAAW,MAAM,UAAU,IAAI,CAAC;GACzD,GACA,KACD;EACD;CACD;AACD,CAAC;AAMD,IAAA,kDAAe,gBAAgB;CAC9B,MAAM;CACN,OAAO;EACN,OAAO;GACN,MAAM;GACN,UAAU;EACX;EACA,gBAAgB;GACf,MAAM;GACN,UAAU;EACX;EACA,OAAO;GACN,MAAM;GACN,SAAS,KAAA;EACV;EACA,eAAe;GACd,MAAM;GACN,SAAS,KAAA;EACV;EACA,UAAU;GACT,MAAM;GACN,SAAS,KAAA;EACV;EACA,qBAAqB;GACpB,MAAM;GACN,SAAS,KAAA;EACV;EACA,WAAW;GACV,MAAM;GACN,SAAS,KAAA;EACV;CACD;CACA,MAAM,OAAO,EAAE,SAAS;EACvB,aACC,EACC,uBACA;GACC,OAAO,MAAM;GACb,gBAAgB,MAAM;GACtB,GAAI,MAAM,QAAQ,EAAE,OAAO,MAAM,MAAM,IAAI,CAAC;GAC5C,GAAI,MAAM,gBAAgB,EAAE,eAAe,MAAM,cAAc,IAAI,CAAC;EACrE,GACA;GACC,eACC,EACC,cACA;IACC,GAAI,MAAM,WAAW,EAAE,UAAU,MAAM,SAAS,IAAI,CAAC;IACrD,GAAI,MAAM,sBACP,EAAE,qBAAqB,MAAM,oBAAoB,IACjD,CAAC;IACJ,GAAI,MAAM,YAAY,EAAE,WAAW,MAAM,UAAU,IAAI,CAAC;GACzD,GACA,KACD;GACD,UAAU,MAAM;EACjB,CACD;CACF;AACD,CAAC"}
@@ -1,9 +1,10 @@
1
1
  /**
2
- * ViewContextValue and getPlayViewContext — shared context types for Vue provider architecture.
2
+ * ViewContextValue and usePlayView — the shared context types of the Vue provider architecture.
3
3
  *
4
- * Extracted from ActorProvider.vue so TypeScript can re-export these types from index.ts.
5
- * (The vue-shim.d.ts only declares a default export from *.vue files, so named exports
6
- * from .vue SFCs are not visible to TypeScript's re-export resolution.)
4
+ * This file holds them, and not ActorProvider.vue, so that TypeScript can
5
+ * re-export the types from index.ts. (The file vue-shim.d.ts declares a default
6
+ * export of each *.vue file only. Therefore TypeScript does not see a named export
7
+ * of a .vue SFC when it resolves a re-export.)
7
8
  *
8
9
  * @packageDocumentation
9
10
  */
@@ -11,30 +12,37 @@ import type { InjectionKey } from "vue";
11
12
  import type { ComponentRegistry } from "@xmachines/json-render-vue";
12
13
  import type { BaseViewContextValue } from "@xmachines/play-actor";
13
14
  /**
14
- * Context value provided by ActorProvider and consumed by PlayRenderer (zero-prop leaf).
15
- * Accessible via getPlayViewContext() inside any ActorProvider/PlayUIProvider tree.
15
+ * The context value that ActorProvider provides and PlayRenderer, the leaf without
16
+ * props, reads. usePlayView() gives it inside every ActorProvider tree and
17
+ * PlayUIProvider tree.
16
18
  */
17
19
  export interface ViewContextValue extends BaseViewContextValue<ComponentRegistry> {
18
20
  }
19
21
  /**
20
- * Injection key for the ViewContextValue. Exported so ActorProvider.vue can use it
21
- * as the canonical key without re-declaring.
22
+ * The injection key of the ViewContextValue. This file exports it, so that
23
+ * ActorProvider.vue uses it as the canonical key and declares no second key.
22
24
  *
23
- * @internal Use getPlayViewContext() as the public API; do not inject ViewKey directly.
25
+ * @internal Use usePlayView() as the public API. Never inject ViewKey directly.
24
26
  */
25
27
  export declare const ViewKey: InjectionKey<ViewContextValue>;
26
28
  /**
27
- * Access the current ViewContextValue from inside an ActorProvider tree.
29
+ * Returns the current ViewContextValue inside an ActorProvider tree.
28
30
  *
29
- * @throws {Error} If called outside an <ActorProvider> (or <PlayUIProvider>) tree
31
+ * @throws {Error} When the caller is outside an <ActorProvider> tree or a <PlayUIProvider> tree
30
32
  *
31
33
  * @example
32
34
  * ```typescript
33
- * import { getPlayViewContext } from "@xmachines/play-vue";
35
+ * import { usePlayView } from "@xmachines/play-vue";
34
36
  *
35
- * const view = getPlayViewContext();
37
+ * const view = usePlayView();
36
38
  * // view.spec, view.handlers, view.registry
37
39
  * ```
38
40
  */
39
- export declare function getPlayViewContext(): ViewContextValue;
41
+ export declare function usePlayView(): ViewContextValue;
42
+ /**
43
+ * Access the current ViewContextValue from inside an ActorProvider tree.
44
+ *
45
+ * @deprecated Renamed to {@link usePlayView}; will be removed in the next major.
46
+ */
47
+ export declare const getPlayViewContext: typeof usePlayView;
40
48
  //# sourceMappingURL=actor-provider-context.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"actor-provider-context.d.ts","sourceRoot":"","sources":["../src/actor-provider-context.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,KAAK,CAAC;AAExC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AACpE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAElE;;;GAGG;AACH,MAAM,WAAW,gBAAiB,SAAQ,oBAAoB,CAAC,iBAAiB,CAAC;CAAG;AAEpF;;;;;GAKG;AACH,eAAO,MAAM,OAAO,EAAE,YAAY,CAAC,gBAAgB,CAA4B,CAAC;AAEhF;;;;;;;;;;;;GAYG;AACH,wBAAgB,kBAAkB,IAAI,gBAAgB,CAErD"}
1
+ {"version":3,"file":"actor-provider-context.d.ts","sourceRoot":"","sources":["../src/actor-provider-context.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAGH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,KAAK,CAAC;AAExC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AACpE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAElE;;;;GAIG;AACH,MAAM,WAAW,gBAAiB,SAAQ,oBAAoB,CAAC,iBAAiB,CAAC;CAAG;AAEpF;;;;;GAKG;AACH,eAAO,MAAM,OAAO,EAAE,YAAY,CAAC,gBAAgB,CAA4B,CAAC;AAEhF;;;;;;;;;;;;GAYG;AACH,wBAAgB,WAAW,IAAI,gBAAgB,CAE9C;AAED;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,oBAAc,CAAC"}
@@ -1,11 +1,46 @@
1
- import { inject as e } from "vue";
2
- import { assertNonNullable as t } from "@xmachines/play";
3
- //#region src/actor-provider-context.ts
4
- var n = Symbol("xmachines.view");
5
- function r() {
6
- return t(e(n), "ViewKey");
1
+ import { inject } from "vue";
2
+ import { assertNonNullable } from "@xmachines/play";
3
+ //#region packages/play-vue/src/actor-provider-context.ts
4
+ /**
5
+ * ViewContextValue and usePlayView — the shared context types of the Vue provider architecture.
6
+ *
7
+ * This file holds them, and not ActorProvider.vue, so that TypeScript can
8
+ * re-export the types from index.ts. (The file vue-shim.d.ts declares a default
9
+ * export of each *.vue file only. Therefore TypeScript does not see a named export
10
+ * of a .vue SFC when it resolves a re-export.)
11
+ *
12
+ * @packageDocumentation
13
+ */
14
+ /**
15
+ * The injection key of the ViewContextValue. This file exports it, so that
16
+ * ActorProvider.vue uses it as the canonical key and declares no second key.
17
+ *
18
+ * @internal Use usePlayView() as the public API. Never inject ViewKey directly.
19
+ */
20
+ var ViewKey = Symbol("xmachines.view");
21
+ /**
22
+ * Returns the current ViewContextValue inside an ActorProvider tree.
23
+ *
24
+ * @throws {Error} When the caller is outside an <ActorProvider> tree or a <PlayUIProvider> tree
25
+ *
26
+ * @example
27
+ * ```typescript
28
+ * import { usePlayView } from "@xmachines/play-vue";
29
+ *
30
+ * const view = usePlayView();
31
+ * // view.spec, view.handlers, view.registry
32
+ * ```
33
+ */
34
+ function usePlayView() {
35
+ return assertNonNullable(inject(ViewKey), "ViewKey");
7
36
  }
37
+ /**
38
+ * Access the current ViewContextValue from inside an ActorProvider tree.
39
+ *
40
+ * @deprecated Renamed to {@link usePlayView}; will be removed in the next major.
41
+ */
42
+ var getPlayViewContext = usePlayView;
8
43
  //#endregion
9
- export { n as ViewKey, r as getPlayViewContext };
44
+ export { ViewKey, getPlayViewContext, usePlayView };
10
45
 
11
46
  //# sourceMappingURL=actor-provider-context.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"actor-provider-context.js","names":[],"sources":["../src/actor-provider-context.ts"],"sourcesContent":["/**\n * ViewContextValue and getPlayViewContext — shared context types for Vue provider architecture.\n *\n * Extracted from ActorProvider.vue so TypeScript can re-export these types from index.ts.\n * (The vue-shim.d.ts only declares a default export from *.vue files, so named exports\n * from .vue SFCs are not visible to TypeScript's re-export resolution.)\n *\n * @packageDocumentation\n */\n\nimport { inject } from \"vue\";\nimport type { InjectionKey } from \"vue\";\nimport { assertNonNullable } from \"@xmachines/play\";\nimport type { ComponentRegistry } from \"@xmachines/json-render-vue\";\nimport type { BaseViewContextValue } from \"@xmachines/play-actor\";\n\n/**\n * Context value provided by ActorProvider and consumed by PlayRenderer (zero-prop leaf).\n * Accessible via getPlayViewContext() inside any ActorProvider/PlayUIProvider tree.\n */\nexport interface ViewContextValue extends BaseViewContextValue<ComponentRegistry> {}\n\n/**\n * Injection key for the ViewContextValue. Exported so ActorProvider.vue can use it\n * as the canonical key without re-declaring.\n *\n * @internal Use getPlayViewContext() as the public API; do not inject ViewKey directly.\n */\nexport const ViewKey: InjectionKey<ViewContextValue> = Symbol(\"xmachines.view\");\n\n/**\n * Access the current ViewContextValue from inside an ActorProvider tree.\n *\n * @throws {Error} If called outside an <ActorProvider> (or <PlayUIProvider>) tree\n *\n * @example\n * ```typescript\n * import { getPlayViewContext } from \"@xmachines/play-vue\";\n *\n * const view = getPlayViewContext();\n * // view.spec, view.handlers, view.registry\n * ```\n */\nexport function getPlayViewContext(): ViewContextValue {\n\treturn assertNonNullable(inject(ViewKey), \"ViewKey\");\n}\n"],"mappings":";;;AA4BA,IAAa,IAA0C,OAAO,gBAAgB;AAe9E,SAAgB,IAAuC;CACtD,OAAO,EAAkB,EAAO,CAAO,GAAG,SAAS;AACpD"}
1
+ {"version":3,"file":"actor-provider-context.js","names":[],"sources":["../src/actor-provider-context.ts"],"sourcesContent":["/**\n * ViewContextValue and usePlayView — the shared context types of the Vue provider architecture.\n *\n * This file holds them, and not ActorProvider.vue, so that TypeScript can\n * re-export the types from index.ts. (The file vue-shim.d.ts declares a default\n * export of each *.vue file only. Therefore TypeScript does not see a named export\n * of a .vue SFC when it resolves a re-export.)\n *\n * @packageDocumentation\n */\n\nimport { inject } from \"vue\";\nimport type { InjectionKey } from \"vue\";\nimport { assertNonNullable } from \"@xmachines/play\";\nimport type { ComponentRegistry } from \"@xmachines/json-render-vue\";\nimport type { BaseViewContextValue } from \"@xmachines/play-actor\";\n\n/**\n * The context value that ActorProvider provides and PlayRenderer, the leaf without\n * props, reads. usePlayView() gives it inside every ActorProvider tree and\n * PlayUIProvider tree.\n */\nexport interface ViewContextValue extends BaseViewContextValue<ComponentRegistry> {}\n\n/**\n * The injection key of the ViewContextValue. This file exports it, so that\n * ActorProvider.vue uses it as the canonical key and declares no second key.\n *\n * @internal Use usePlayView() as the public API. Never inject ViewKey directly.\n */\nexport const ViewKey: InjectionKey<ViewContextValue> = Symbol(\"xmachines.view\");\n\n/**\n * Returns the current ViewContextValue inside an ActorProvider tree.\n *\n * @throws {Error} When the caller is outside an <ActorProvider> tree or a <PlayUIProvider> tree\n *\n * @example\n * ```typescript\n * import { usePlayView } from \"@xmachines/play-vue\";\n *\n * const view = usePlayView();\n * // view.spec, view.handlers, view.registry\n * ```\n */\nexport function usePlayView(): ViewContextValue {\n\treturn assertNonNullable(inject(ViewKey), \"ViewKey\");\n}\n\n/**\n * Access the current ViewContextValue from inside an ActorProvider tree.\n *\n * @deprecated Renamed to {@link usePlayView}; will be removed in the next major.\n */\nexport const getPlayViewContext = usePlayView;\n"],"mappings":";;;;;;;;;;;;;;;;;;;AA8BA,IAAa,UAA0C,OAAO,gBAAgB;;;;;;;;;;;;;;AAe9E,SAAgB,cAAgC;CAC/C,OAAO,kBAAkB,OAAO,OAAO,GAAG,SAAS;AACpD;;;;;;AAOA,IAAa,qBAAqB"}
@@ -1,40 +1,44 @@
1
1
  /**
2
- * `defineRegistry` wrapper for @xmachines/play-vue.
2
+ * The `defineRegistry` wrapper of @xmachines/play-vue.
3
3
  *
4
- * Wraps `defineRegistry` from `@xmachines/json-render-vue` with automatic SFC support.
4
+ * It wraps `defineRegistry` from `@xmachines/json-render-vue`, and it adds support
5
+ * for an SFC.
5
6
  *
6
- * ## Vue-specific — React and Solid do not need this
7
+ * ## Vue only — React and Solid do not need this wrapper
7
8
  *
8
- * In React, `useContext()` works anywhere inside the component call tree.
9
- * In Solid, `useContext()` works inside reactive computations and component renders.
10
- * Neither has the strict "synchronous setup() only" constraint that Vue's `inject()`
11
- * imposes — so their `defineRegistry` implementations call `componentFn(ctx)` directly
12
- * with no wrapping needed.
9
+ * In React, `useContext()` works everywhere inside the component call tree. In
10
+ * Solid, `useContext()` works inside a reactive computation and inside a component
11
+ * render. Neither framework has the strict rule of the Vue function `inject()`,
12
+ * which runs during a synchronous `setup()` only. Therefore the `defineRegistry`
13
+ * implementation of each of them calls `componentFn(ctx)` directly, and it wraps
14
+ * nothing.
13
15
  *
14
- * For the DOM renderer, there is no component system at all — just render functions
15
- * returning `HTMLElement` — so injection context is not applicable.
16
+ * The DOM renderer has no component system at all. It has render functions that
17
+ * return an `HTMLElement`. An injection context is therefore not relevant.
16
18
  *
17
- * Only Vue requires this adapter.
19
+ * Vue alone needs this adapter.
18
20
  *
19
- * ## Why this wrapper exists
21
+ * ## The reason for this wrapper
20
22
  *
21
- * `@xmachines/json-render-vue`'s `defineRegistry` calls each registered component as a plain
22
- * function: `componentFn(ctx)`. A `.vue` SFC (output of `defineComponent` or
23
- * `<script setup>`) is an **object**, not a function — calling it throws.
23
+ * The `defineRegistry` function of `@xmachines/json-render-vue` calls each
24
+ * registered component as a plain function: `componentFn(ctx)`. A `.vue` SFC, which
25
+ * is the output of `defineComponent` or of `<script setup>`, is an **object**, not a
26
+ * function. A call to that object throws.
24
27
  *
25
- * More fundamentally, `defineRegistry` calls components inside its own render
26
- * function (the return value of `setup()`). Vue's `inject()` — and composables built
27
- * on it: `useStateBinding`, `useStateStore` — only work during synchronous `setup()`
28
- * execution, not inside render functions. Plain `.ts` `ComponentFn` files cannot
29
- * call any Vue composable for this reason.
28
+ * There is a second and deeper reason. `defineRegistry` calls each component inside
29
+ * its own render function, which is the return value of `setup()`. The Vue function
30
+ * `inject()`, and each composable on it, such as `useStateBinding` and
31
+ * `useStateStore`, works during the synchronous run of `setup()` only, not inside a
32
+ * render function. For this reason a plain `.ts` `ComponentFn` file can call no Vue
33
+ * composable.
30
34
  *
31
- * This wrapper auto-detects Vue SFCs in the `components` map and wraps them via
32
- * `h(SFC, ctx)`. The SFC renders as a child component with its own `setup()`,
33
- * giving full access to composables inside `<script setup>`.
35
+ * This wrapper finds each Vue SFC in the `components` map, and it wraps the SFC with
36
+ * `h(SFC, ctx)`. The SFC then renders as a child component with its own `setup()`,
37
+ * and every composable works inside `<script setup>`.
34
38
  *
35
- * ## Usage
39
+ * ## Use
36
40
  *
37
- * Import `defineRegistry` from `@xmachines/play-vue` instead of `@xmachines/json-render-vue`:
41
+ * Import `defineRegistry` from `@xmachines/play-vue`, not from `@xmachines/json-render-vue`:
38
42
  *
39
43
  * ```ts
40
44
  * import { defineRegistry } from "@xmachines/play-vue";
@@ -45,14 +49,14 @@
45
49
  *
46
50
  * const { registry } = defineRegistry(catalog, {
47
51
  * components: {
48
- * Login: LoginSFC, // .vue SFC — auto-wrapped
49
- * Dashboard: DashboardSFC, // .vue SFC — auto-wrapped
52
+ * Login: LoginSFC, // a .vue SFC — the wrapper handles it
53
+ * Dashboard: DashboardSFC, // a .vue SFC — the wrapper handles it
50
54
  * },
51
55
  * });
52
56
  * ```
53
57
  *
54
- * Plain `ComponentFn` functions still work and are passed through unchanged.
55
- * Mixing SFCs and plain functions in the same registry is supported.
58
+ * A plain `ComponentFn` function also works, and the wrapper passes it through
59
+ * without a change. One registry can hold both SFCs and plain functions.
56
60
  */
57
61
  import { type Component } from "vue";
58
62
  import { defineRegistry as defineRegistryBase, type ComponentFn } from "@xmachines/json-render-vue";
@@ -65,15 +69,16 @@ export type DefineRegistryOptions<C extends Catalog> = Omit<Parameters<typeof de
65
69
  components?: ComponentsMap<C>;
66
70
  };
67
71
  /**
68
- * Create a component registry, automatically wrapping `.vue` SFCs so they work
69
- * correctly with `@xmachines/json-render-vue`'s rendering pipeline.
72
+ * Creates a component registry. It wraps each `.vue` SFC, so that the SFC works
73
+ * correctly with the render pipeline of `@xmachines/json-render-vue`.
70
74
  *
71
- * Drop-in replacement for `defineRegistry` from `@xmachines/json-render-vue`. Import from
72
- * `@xmachines/play-vue` to get SFC support for free.
75
+ * This function is the drop-in replacement for `defineRegistry` from
76
+ * `@xmachines/json-render-vue`. Import it from `@xmachines/play-vue`, and you get
77
+ * the support for an SFC.
73
78
  *
74
- * @param catalog - The json-render catalog defining component prop shapes.
75
- * @param options - Registry options. `components` entries may be `.vue` SFCs
76
- * (objects) or plain `ComponentFn` functions — both are handled automatically.
79
+ * @param catalog - The json-render catalog. It defines the prop shape of each component.
80
+ * @param options - The registry options. Each `components` entry is a `.vue` SFC,
81
+ * which is an object, or a plain `ComponentFn` function. The wrapper handles both.
77
82
  */
78
83
  export declare function defineRegistry<C extends Catalog>(catalog: C, options: DefineRegistryOptions<C>): ReturnType<typeof defineRegistryBase<C>>;
79
84
  //# sourceMappingURL=define-registry.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"define-registry.d.ts","sourceRoot":"","sources":["../src/define-registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuDG;AAEH,OAAO,EAAK,KAAK,SAAS,EAAE,MAAM,KAAK,CAAC;AACxC,OAAO,EACN,cAAc,IAAI,kBAAkB,EAEpC,KAAK,WAAW,EAEhB,MAAM,4BAA4B,CAAC;AACpC,OAAO,KAAK,EAAE,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AAwCnF,MAAM,MAAM,cAAc,CAAC,CAAC,SAAS,OAAO,EAAE,CAAC,SAAS,MAAM,sBAAsB,CAAC,CAAC,CAAC,IACpF,WAAW,CAAC,CAAC,EAAE,CAAC,CAAC,GACjB,SAAS,CAAC;AAEb,MAAM,MAAM,aAAa,CAAC,CAAC,SAAS,OAAO,IAAI;KAC7C,CAAC,IAAI,MAAM,sBAAsB,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,cAAc,CAAC,CAAC,EAAE,CAAC,CAAC;CAC7D,CAAC;AAEF,MAAM,MAAM,qBAAqB,CAAC,CAAC,SAAS,OAAO,IAAI,IAAI,CAC1D,UAAU,CAAC,OAAO,kBAAkB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAC3C,YAAY,CACZ,GAAG;IACH,UAAU,CAAC,EAAE,aAAa,CAAC,CAAC,CAAC,CAAC;CAC9B,CAAC;AAEF;;;;;;;;;;GAUG;AACH,wBAAgB,cAAc,CAAC,CAAC,SAAS,OAAO,EAC/C,OAAO,EAAE,CAAC,EACV,OAAO,EAAE,qBAAqB,CAAC,CAAC,CAAC,GAC/B,UAAU,CAAC,OAAO,kBAAkB,CAAC,CAAC,CAAC,CAAC,CAa1C"}
1
+ {"version":3,"file":"define-registry.d.ts","sourceRoot":"","sources":["../src/define-registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2DG;AAEH,OAAO,EAAK,KAAK,SAAS,EAAE,MAAM,KAAK,CAAC;AACxC,OAAO,EACN,cAAc,IAAI,kBAAkB,EAEpC,KAAK,WAAW,EAEhB,MAAM,4BAA4B,CAAC;AACpC,OAAO,KAAK,EAAE,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AA0CnF,MAAM,MAAM,cAAc,CAAC,CAAC,SAAS,OAAO,EAAE,CAAC,SAAS,MAAM,sBAAsB,CAAC,CAAC,CAAC,IACpF,WAAW,CAAC,CAAC,EAAE,CAAC,CAAC,GACjB,SAAS,CAAC;AAEb,MAAM,MAAM,aAAa,CAAC,CAAC,SAAS,OAAO,IAAI;KAC7C,CAAC,IAAI,MAAM,sBAAsB,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,cAAc,CAAC,CAAC,EAAE,CAAC,CAAC;CAC7D,CAAC;AAEF,MAAM,MAAM,qBAAqB,CAAC,CAAC,SAAS,OAAO,IAAI,IAAI,CAC1D,UAAU,CAAC,OAAO,kBAAkB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAC3C,YAAY,CACZ,GAAG;IACH,UAAU,CAAC,EAAE,aAAa,CAAC,CAAC,CAAC,CAAC;CAC9B,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,wBAAgB,cAAc,CAAC,CAAC,SAAS,OAAO,EAC/C,OAAO,EAAE,CAAC,EACV,OAAO,EAAE,qBAAqB,CAAC,CAAC,CAAC,GAC/B,UAAU,CAAC,OAAO,kBAAkB,CAAC,CAAC,CAAC,CAAC,CAa1C"}