@xmachines/play-vue 2.0.0-alpha.1 → 2.0.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.
@@ -1,9 +1,26 @@
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 { getPlayViewContext } 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 — batteries-included composite provider for actor-driven UI rendering.
8
+ *
9
+ * Wraps ActorProvider + JSONUIProvider (from @xmachines/json-render-vue) to provide a single
10
+ * entry point for all actor lifecycle and UI rendering concerns.
11
+ *
12
+ * Standard usage:
13
+ * ```ts
14
+ * <PlayUIProvider :actor="actor" :registryResult="registryResult">
15
+ * <PlayRenderer />
16
+ * </PlayUIProvider>
17
+ * ```
18
+ *
19
+ * For custom provider composition (escape hatch), use <ActorProvider> directly.
20
+ *
21
+ * @packageDocumentation
22
+ */
23
+ var JSONUIBridge = defineComponent({
7
24
  name: "JSONUIBridge",
8
25
  props: {
9
26
  navigate: {
@@ -19,29 +36,30 @@ var a = n({
19
36
  default: void 0
20
37
  }
21
38
  },
22
- setup(t, { slots: n }) {
39
+ setup(props, { slots }) {
23
40
  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);
41
+ const view = getPlayViewContext();
42
+ return h(JSONUIProvider, {
43
+ registry: view.registry,
44
+ handlers: view.handlers,
45
+ store: view.store,
46
+ ...props.navigate ? { navigate: props.navigate } : {},
47
+ ...props.validationFunctions ? { validationFunctions: props.validationFunctions } : {},
48
+ ...props.functions ? { functions: props.functions } : {}
49
+ }, slots);
33
50
  };
34
51
  }
35
- }), o = n({
52
+ });
53
+ var PlayUIProvider_vue_vue_type_script_lang_default = defineComponent({
36
54
  name: "PlayUIProvider",
37
55
  props: {
38
56
  actor: {
39
57
  type: Object,
40
- required: !0
58
+ required: true
41
59
  },
42
60
  registryResult: {
43
61
  type: Object,
44
- required: !0
62
+ required: true
45
63
  },
46
64
  store: {
47
65
  type: Object,
@@ -64,23 +82,23 @@ var a = n({
64
82
  default: void 0
65
83
  }
66
84
  },
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 } : {}
85
+ setup(props, { slots }) {
86
+ return () => h(ActorProvider_default, {
87
+ actor: props.actor,
88
+ registryResult: props.registryResult,
89
+ ...props.store ? { store: props.store } : {},
90
+ ...props.onRenderError ? { onRenderError: props.onRenderError } : {}
73
91
  }, {
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
92
+ default: () => h(JSONUIBridge, {
93
+ ...props.navigate ? { navigate: props.navigate } : {},
94
+ ...props.validationFunctions ? { validationFunctions: props.validationFunctions } : {},
95
+ ...props.functions ? { functions: props.functions } : {}
96
+ }, slots),
97
+ fallback: slots.fallback
80
98
  });
81
99
  }
82
100
  });
83
101
  //#endregion
84
- export { o as default };
102
+ export { PlayUIProvider_vue_vue_type_script_lang_default as default };
85
103
 
86
104
  //# 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 — 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,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,mBAAmB;GAChC,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,11 +1,39 @@
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 getPlayViewContext — shared context types for Vue provider architecture.
6
+ *
7
+ * Extracted from ActorProvider.vue so TypeScript can re-export these types from index.ts.
8
+ * (The vue-shim.d.ts only declares a default export from *.vue files, so named exports
9
+ * from .vue SFCs are not visible to TypeScript's re-export resolution.)
10
+ *
11
+ * @packageDocumentation
12
+ */
13
+ /**
14
+ * Injection key for the ViewContextValue. Exported so ActorProvider.vue can use it
15
+ * as the canonical key without re-declaring.
16
+ *
17
+ * @internal Use getPlayViewContext() as the public API; do not inject ViewKey directly.
18
+ */
19
+ var ViewKey = Symbol("xmachines.view");
20
+ /**
21
+ * Access the current ViewContextValue from inside an ActorProvider tree.
22
+ *
23
+ * @throws {Error} If called outside an <ActorProvider> (or <PlayUIProvider>) tree
24
+ *
25
+ * @example
26
+ * ```typescript
27
+ * import { getPlayViewContext } from "@xmachines/play-vue";
28
+ *
29
+ * const view = getPlayViewContext();
30
+ * // view.spec, view.handlers, view.registry
31
+ * ```
32
+ */
33
+ function getPlayViewContext() {
34
+ return assertNonNullable(inject(ViewKey), "ViewKey");
7
35
  }
8
36
  //#endregion
9
- export { n as ViewKey, r as getPlayViewContext };
37
+ export { ViewKey, getPlayViewContext };
10
38
 
11
39
  //# 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 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,UAA0C,OAAO,gBAAgB;;;;;;;;;;;;;;AAe9E,SAAgB,qBAAuC;CACtD,OAAO,kBAAkB,OAAO,OAAO,GAAG,SAAS;AACpD"}
@@ -1,27 +1,118 @@
1
- import { h as e } from "vue";
2
- import { defineRegistry as t } from "@xmachines/json-render-vue";
3
- //#region src/define-registry.ts
4
- function n(e) {
5
- if (typeof e != "object" || !e) return !1;
6
- let t = e;
7
- return "__vccOpts" in t || "__name" in t ? !0 : typeof t.setup == "function" || typeof t.render == "function";
1
+ import { h } from "vue";
2
+ import { defineRegistry } from "@xmachines/json-render-vue";
3
+ //#region packages/play-vue/src/define-registry.ts
4
+ /**
5
+ * `defineRegistry` wrapper for @xmachines/play-vue.
6
+ *
7
+ * Wraps `defineRegistry` from `@xmachines/json-render-vue` with automatic SFC support.
8
+ *
9
+ * ## Vue-specific — React and Solid do not need this
10
+ *
11
+ * In React, `useContext()` works anywhere inside the component call tree.
12
+ * In Solid, `useContext()` works inside reactive computations and component renders.
13
+ * Neither has the strict "synchronous setup() only" constraint that Vue's `inject()`
14
+ * imposes — so their `defineRegistry` implementations call `componentFn(ctx)` directly
15
+ * with no wrapping needed.
16
+ *
17
+ * For the DOM renderer, there is no component system at all — just render functions
18
+ * returning `HTMLElement` — so injection context is not applicable.
19
+ *
20
+ * Only Vue requires this adapter.
21
+ *
22
+ * ## Why this wrapper exists
23
+ *
24
+ * `@xmachines/json-render-vue`'s `defineRegistry` calls each registered component as a plain
25
+ * function: `componentFn(ctx)`. A `.vue` SFC (output of `defineComponent` or
26
+ * `<script setup>`) is an **object**, not a function — calling it throws.
27
+ *
28
+ * More fundamentally, `defineRegistry` calls components inside its own render
29
+ * function (the return value of `setup()`). Vue's `inject()` — and composables built
30
+ * on it: `useStateBinding`, `useStateStore` — only work during synchronous `setup()`
31
+ * execution, not inside render functions. Plain `.ts` `ComponentFn` files cannot
32
+ * call any Vue composable for this reason.
33
+ *
34
+ * This wrapper auto-detects Vue SFCs in the `components` map and wraps them via
35
+ * `h(SFC, ctx)`. The SFC renders as a child component with its own `setup()`,
36
+ * giving full access to composables inside `<script setup>`.
37
+ *
38
+ * ## Usage
39
+ *
40
+ * Import `defineRegistry` from `@xmachines/play-vue` instead of `@xmachines/json-render-vue`:
41
+ *
42
+ * ```ts
43
+ * import { defineRegistry } from "@xmachines/play-vue";
44
+ * // not: import { defineRegistry } from "@xmachines/json-render-vue";
45
+ *
46
+ * import LoginSFC from "./views/Login.vue";
47
+ * import DashboardSFC from "./views/Dashboard.vue";
48
+ *
49
+ * const { registry } = defineRegistry(catalog, {
50
+ * components: {
51
+ * Login: LoginSFC, // .vue SFC — auto-wrapped
52
+ * Dashboard: DashboardSFC, // .vue SFC — auto-wrapped
53
+ * },
54
+ * });
55
+ * ```
56
+ *
57
+ * Plain `ComponentFn` functions still work and are passed through unchanged.
58
+ * Mixing SFCs and plain functions in the same registry is supported.
59
+ */
60
+ /**
61
+ * Detect whether a value is a Vue component object (SFC) rather than a plain
62
+ * `ComponentFn` function.
63
+ *
64
+ * Vue SFCs produced by `defineComponent` or `<script setup>` compilation are
65
+ * plain objects (not callable). A `ComponentFn` is always a plain function.
66
+ *
67
+ * Detection strategy (checked in order):
68
+ * 1. `__vccOpts` — set by vite-plugin-vue / vue-loader on every `<script setup>` SFC.
69
+ * 2. `__name` — set by Vite on named SFCs (present alongside `__vccOpts` but also
70
+ * on `defineComponent({ name: "..." })` output without `<script setup>`).
71
+ * 3. `setup` is a function — the `defineComponent({ setup() {} })` signature.
72
+ * 4. `render` is a function — the `defineComponent({ render() {} })` signature.
73
+ *
74
+ * Requiring `setup` / `render` to be **functions** prevents plain POJOs that
75
+ * happen to have a `setup` or `render` key from being misidentified as components.
76
+ */
77
+ function isVueSFC(value) {
78
+ if (typeof value !== "object" || value === null) return false;
79
+ const v = value;
80
+ if ("__vccOpts" in v || "__name" in v) return true;
81
+ return typeof v["setup"] === "function" || typeof v["render"] === "function";
8
82
  }
9
- function r(t) {
10
- return (n) => e(t, n);
83
+ /**
84
+ * Wrap a Vue SFC as a `ComponentFn` by rendering it via `h()`.
85
+ *
86
+ * The SFC receives the full `ComponentContext` as its props and renders in its
87
+ * own child component `setup()`, where Vue composables work correctly.
88
+ */
89
+ function wrapSFC(component) {
90
+ return (ctx) => h(component, ctx);
11
91
  }
12
- function i(e, i) {
13
- let a = {};
14
- for (let [e, t] of Object.entries(i.components ?? {})) {
15
- if (t === void 0) continue;
16
- let i = e;
17
- a[i] = n(t) ? r(t) : t;
92
+ /**
93
+ * Create a component registry, automatically wrapping `.vue` SFCs so they work
94
+ * correctly with `@xmachines/json-render-vue`'s rendering pipeline.
95
+ *
96
+ * Drop-in replacement for `defineRegistry` from `@xmachines/json-render-vue`. Import from
97
+ * `@xmachines/play-vue` to get SFC support for free.
98
+ *
99
+ * @param catalog - The json-render catalog defining component prop shapes.
100
+ * @param options - Registry options. `components` entries may be `.vue` SFCs
101
+ * (objects) or plain `ComponentFn` functions — both are handled automatically.
102
+ */
103
+ function defineRegistry$1(catalog, options) {
104
+ const wrappedComponents = {};
105
+ for (const [key, component] of Object.entries(options.components ?? {})) {
106
+ if (component === void 0) continue;
107
+ const k = key;
108
+ wrappedComponents[k] = isVueSFC(component) ? wrapSFC(component) : component;
18
109
  }
19
- return t(e, {
20
- ...i,
21
- components: a
110
+ return defineRegistry(catalog, {
111
+ ...options,
112
+ components: wrappedComponents
22
113
  });
23
114
  }
24
115
  //#endregion
25
- export { i as defineRegistry };
116
+ export { defineRegistry$1 as defineRegistry };
26
117
 
27
118
  //# sourceMappingURL=define-registry.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"define-registry.js","names":[],"sources":["../src/define-registry.ts"],"sourcesContent":["/**\n * `defineRegistry` wrapper for @xmachines/play-vue.\n *\n * Wraps `defineRegistry` from `@xmachines/json-render-vue` with automatic SFC support.\n *\n * ## Vue-specific — React and Solid do not need this\n *\n * In React, `useContext()` works anywhere inside the component call tree.\n * In Solid, `useContext()` works inside reactive computations and component renders.\n * Neither has the strict \"synchronous setup() only\" constraint that Vue's `inject()`\n * imposes — so their `defineRegistry` implementations call `componentFn(ctx)` directly\n * with no wrapping needed.\n *\n * For the DOM renderer, there is no component system at all — just render functions\n * returning `HTMLElement` — so injection context is not applicable.\n *\n * Only Vue requires this adapter.\n *\n * ## Why this wrapper exists\n *\n * `@xmachines/json-render-vue`'s `defineRegistry` calls each registered component as a plain\n * function: `componentFn(ctx)`. A `.vue` SFC (output of `defineComponent` or\n * `<script setup>`) is an **object**, not a function — calling it throws.\n *\n * More fundamentally, `defineRegistry` calls components inside its own render\n * function (the return value of `setup()`). Vue's `inject()` — and composables built\n * on it: `useStateBinding`, `useStateStore` — only work during synchronous `setup()`\n * execution, not inside render functions. Plain `.ts` `ComponentFn` files cannot\n * call any Vue composable for this reason.\n *\n * This wrapper auto-detects Vue SFCs in the `components` map and wraps them via\n * `h(SFC, ctx)`. The SFC renders as a child component with its own `setup()`,\n * giving full access to composables inside `<script setup>`.\n *\n * ## Usage\n *\n * Import `defineRegistry` from `@xmachines/play-vue` instead of `@xmachines/json-render-vue`:\n *\n * ```ts\n * import { defineRegistry } from \"@xmachines/play-vue\";\n * // not: import { defineRegistry } from \"@xmachines/json-render-vue\";\n *\n * import LoginSFC from \"./views/Login.vue\";\n * import DashboardSFC from \"./views/Dashboard.vue\";\n *\n * const { registry } = defineRegistry(catalog, {\n * components: {\n * Login: LoginSFC, // .vue SFC — auto-wrapped\n * Dashboard: DashboardSFC, // .vue SFC — auto-wrapped\n * },\n * });\n * ```\n *\n * Plain `ComponentFn` functions still work and are passed through unchanged.\n * Mixing SFCs and plain functions in the same registry is supported.\n */\n\nimport { h, type Component } from \"vue\";\nimport {\n\tdefineRegistry as defineRegistryBase,\n\ttype ComponentContext,\n\ttype ComponentFn,\n\ttype Components,\n} from \"@xmachines/json-render-vue\";\nimport type { Catalog, InferCatalogComponents } from \"@xmachines/json-render-core\";\n\n/**\n * Detect whether a value is a Vue component object (SFC) rather than a plain\n * `ComponentFn` function.\n *\n * Vue SFCs produced by `defineComponent` or `<script setup>` compilation are\n * plain objects (not callable). A `ComponentFn` is always a plain function.\n *\n * Detection strategy (checked in order):\n * 1. `__vccOpts` — set by vite-plugin-vue / vue-loader on every `<script setup>` SFC.\n * 2. `__name` — set by Vite on named SFCs (present alongside `__vccOpts` but also\n * on `defineComponent({ name: \"...\" })` output without `<script setup>`).\n * 3. `setup` is a function — the `defineComponent({ setup() {} })` signature.\n * 4. `render` is a function — the `defineComponent({ render() {} })` signature.\n *\n * Requiring `setup` / `render` to be **functions** prevents plain POJOs that\n * happen to have a `setup` or `render` key from being misidentified as components.\n */\nfunction isVueSFC(value: unknown): value is Component {\n\tif (typeof value !== \"object\" || value === null) return false;\n\tconst v = value as Record<string, unknown>;\n\t// Compiler-injected markers — unambiguous Vue component identifiers.\n\tif (\"__vccOpts\" in v || \"__name\" in v) return true;\n\t// defineComponent() output: setup or render must be callable, not just present.\n\treturn typeof v[\"setup\"] === \"function\" || typeof v[\"render\"] === \"function\";\n}\n\n/**\n * Wrap a Vue SFC as a `ComponentFn` by rendering it via `h()`.\n *\n * The SFC receives the full `ComponentContext` as its props and renders in its\n * own child component `setup()`, where Vue composables work correctly.\n */\nfunction wrapSFC<C extends Catalog, K extends keyof InferCatalogComponents<C>>(\n\tcomponent: Component,\n): ComponentFn<C, K> {\n\treturn (ctx: ComponentContext<C, K>) => h(component, ctx);\n}\n\nexport type ComponentEntry<C extends Catalog, K extends keyof InferCatalogComponents<C>> =\n\t| ComponentFn<C, K>\n\t| Component;\n\nexport type ComponentsMap<C extends Catalog> = {\n\t[K in keyof InferCatalogComponents<C>]?: ComponentEntry<C, K>;\n};\n\nexport type DefineRegistryOptions<C extends Catalog> = Omit<\n\tParameters<typeof defineRegistryBase<C>>[1],\n\t\"components\"\n> & {\n\tcomponents?: ComponentsMap<C>;\n};\n\n/**\n * Create a component registry, automatically wrapping `.vue` SFCs so they work\n * correctly with `@xmachines/json-render-vue`'s rendering pipeline.\n *\n * Drop-in replacement for `defineRegistry` from `@xmachines/json-render-vue`. Import from\n * `@xmachines/play-vue` to get SFC support for free.\n *\n * @param catalog - The json-render catalog defining component prop shapes.\n * @param options - Registry options. `components` entries may be `.vue` SFCs\n * (objects) or plain `ComponentFn` functions — both are handled automatically.\n */\nexport function defineRegistry<C extends Catalog>(\n\tcatalog: C,\n\toptions: DefineRegistryOptions<C>,\n): ReturnType<typeof defineRegistryBase<C>> {\n\tconst wrappedComponents = {} as Components<C>;\n\n\tfor (const [key, component] of Object.entries(options.components ?? {})) {\n\t\tif (component === undefined) continue;\n\t\tconst k = key as keyof InferCatalogComponents<C>;\n\t\twrappedComponents[k] = isVueSFC(component)\n\t\t\t? wrapSFC(component as Component)\n\t\t\t: (component as ComponentFn<C, typeof k>);\n\t}\n\n\tconst baseOptions = options as Parameters<typeof defineRegistryBase<C>>[1];\n\treturn defineRegistryBase(catalog, { ...baseOptions, components: wrappedComponents });\n}\n"],"mappings":";;;AAmFA,SAAS,EAAS,GAAoC;CACrD,IAAI,OAAO,KAAU,aAAY,GAAgB,OAAO;CACxD,IAAM,IAAI;CAIV,OAFI,eAAe,KAAK,YAAY,IAAU,KAEvC,OAAO,EAAE,SAAa,cAAc,OAAO,EAAE,UAAc;AACnE;AAQA,SAAS,EACR,GACoB;CACpB,QAAQ,MAAgC,EAAE,GAAW,CAAG;AACzD;AA4BA,SAAgB,EACf,GACA,GAC2C;CAC3C,IAAM,IAAoB,CAAC;CAE3B,KAAK,IAAM,CAAC,GAAK,MAAc,OAAO,QAAQ,EAAQ,cAAc,CAAC,CAAC,GAAG;EACxE,IAAI,MAAc,KAAA,GAAW;EAC7B,IAAM,IAAI;EACV,EAAkB,KAAK,EAAS,CAAS,IACtC,EAAQ,CAAsB,IAC7B;CACL;CAGA,OAAO,EAAmB,GAAS;EAAE,GAAG;EAAa,YAAY;CAAkB,CAAC;AACrF"}
1
+ {"version":3,"file":"define-registry.js","names":[],"sources":["../src/define-registry.ts"],"sourcesContent":["/**\n * `defineRegistry` wrapper for @xmachines/play-vue.\n *\n * Wraps `defineRegistry` from `@xmachines/json-render-vue` with automatic SFC support.\n *\n * ## Vue-specific — React and Solid do not need this\n *\n * In React, `useContext()` works anywhere inside the component call tree.\n * In Solid, `useContext()` works inside reactive computations and component renders.\n * Neither has the strict \"synchronous setup() only\" constraint that Vue's `inject()`\n * imposes — so their `defineRegistry` implementations call `componentFn(ctx)` directly\n * with no wrapping needed.\n *\n * For the DOM renderer, there is no component system at all — just render functions\n * returning `HTMLElement` — so injection context is not applicable.\n *\n * Only Vue requires this adapter.\n *\n * ## Why this wrapper exists\n *\n * `@xmachines/json-render-vue`'s `defineRegistry` calls each registered component as a plain\n * function: `componentFn(ctx)`. A `.vue` SFC (output of `defineComponent` or\n * `<script setup>`) is an **object**, not a function — calling it throws.\n *\n * More fundamentally, `defineRegistry` calls components inside its own render\n * function (the return value of `setup()`). Vue's `inject()` — and composables built\n * on it: `useStateBinding`, `useStateStore` — only work during synchronous `setup()`\n * execution, not inside render functions. Plain `.ts` `ComponentFn` files cannot\n * call any Vue composable for this reason.\n *\n * This wrapper auto-detects Vue SFCs in the `components` map and wraps them via\n * `h(SFC, ctx)`. The SFC renders as a child component with its own `setup()`,\n * giving full access to composables inside `<script setup>`.\n *\n * ## Usage\n *\n * Import `defineRegistry` from `@xmachines/play-vue` instead of `@xmachines/json-render-vue`:\n *\n * ```ts\n * import { defineRegistry } from \"@xmachines/play-vue\";\n * // not: import { defineRegistry } from \"@xmachines/json-render-vue\";\n *\n * import LoginSFC from \"./views/Login.vue\";\n * import DashboardSFC from \"./views/Dashboard.vue\";\n *\n * const { registry } = defineRegistry(catalog, {\n * components: {\n * Login: LoginSFC, // .vue SFC — auto-wrapped\n * Dashboard: DashboardSFC, // .vue SFC — auto-wrapped\n * },\n * });\n * ```\n *\n * Plain `ComponentFn` functions still work and are passed through unchanged.\n * Mixing SFCs and plain functions in the same registry is supported.\n */\n\nimport { h, type Component } from \"vue\";\nimport {\n\tdefineRegistry as defineRegistryBase,\n\ttype ComponentContext,\n\ttype ComponentFn,\n\ttype Components,\n} from \"@xmachines/json-render-vue\";\nimport type { Catalog, InferCatalogComponents } from \"@xmachines/json-render-core\";\n\n/**\n * Detect whether a value is a Vue component object (SFC) rather than a plain\n * `ComponentFn` function.\n *\n * Vue SFCs produced by `defineComponent` or `<script setup>` compilation are\n * plain objects (not callable). A `ComponentFn` is always a plain function.\n *\n * Detection strategy (checked in order):\n * 1. `__vccOpts` — set by vite-plugin-vue / vue-loader on every `<script setup>` SFC.\n * 2. `__name` — set by Vite on named SFCs (present alongside `__vccOpts` but also\n * on `defineComponent({ name: \"...\" })` output without `<script setup>`).\n * 3. `setup` is a function — the `defineComponent({ setup() {} })` signature.\n * 4. `render` is a function — the `defineComponent({ render() {} })` signature.\n *\n * Requiring `setup` / `render` to be **functions** prevents plain POJOs that\n * happen to have a `setup` or `render` key from being misidentified as components.\n */\nfunction isVueSFC(value: unknown): value is Component {\n\tif (typeof value !== \"object\" || value === null) return false;\n\tconst v = value as Record<string, unknown>;\n\t// Compiler-injected markers — unambiguous Vue component identifiers.\n\tif (\"__vccOpts\" in v || \"__name\" in v) return true;\n\t// defineComponent() output: setup or render must be callable, not just present.\n\treturn typeof v[\"setup\"] === \"function\" || typeof v[\"render\"] === \"function\";\n}\n\n/**\n * Wrap a Vue SFC as a `ComponentFn` by rendering it via `h()`.\n *\n * The SFC receives the full `ComponentContext` as its props and renders in its\n * own child component `setup()`, where Vue composables work correctly.\n */\nfunction wrapSFC<C extends Catalog, K extends keyof InferCatalogComponents<C>>(\n\tcomponent: Component,\n): ComponentFn<C, K> {\n\treturn (ctx: ComponentContext<C, K>) => h(component, ctx);\n}\n\nexport type ComponentEntry<C extends Catalog, K extends keyof InferCatalogComponents<C>> =\n\t| ComponentFn<C, K>\n\t| Component;\n\nexport type ComponentsMap<C extends Catalog> = {\n\t[K in keyof InferCatalogComponents<C>]?: ComponentEntry<C, K>;\n};\n\nexport type DefineRegistryOptions<C extends Catalog> = Omit<\n\tParameters<typeof defineRegistryBase<C>>[1],\n\t\"components\"\n> & {\n\tcomponents?: ComponentsMap<C>;\n};\n\n/**\n * Create a component registry, automatically wrapping `.vue` SFCs so they work\n * correctly with `@xmachines/json-render-vue`'s rendering pipeline.\n *\n * Drop-in replacement for `defineRegistry` from `@xmachines/json-render-vue`. Import from\n * `@xmachines/play-vue` to get SFC support for free.\n *\n * @param catalog - The json-render catalog defining component prop shapes.\n * @param options - Registry options. `components` entries may be `.vue` SFCs\n * (objects) or plain `ComponentFn` functions — both are handled automatically.\n */\nexport function defineRegistry<C extends Catalog>(\n\tcatalog: C,\n\toptions: DefineRegistryOptions<C>,\n): ReturnType<typeof defineRegistryBase<C>> {\n\tconst wrappedComponents = {} as Components<C>;\n\n\tfor (const [key, component] of Object.entries(options.components ?? {})) {\n\t\tif (component === undefined) continue;\n\t\tconst k = key as keyof InferCatalogComponents<C>;\n\t\twrappedComponents[k] = isVueSFC(component)\n\t\t\t? wrapSFC(component as Component)\n\t\t\t: (component as ComponentFn<C, typeof k>);\n\t}\n\n\tconst baseOptions = options as Parameters<typeof defineRegistryBase<C>>[1];\n\treturn defineRegistryBase(catalog, { ...baseOptions, components: wrappedComponents });\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmFA,SAAS,SAAS,OAAoC;CACrD,IAAI,OAAO,UAAU,YAAY,UAAU,MAAM,OAAO;CACxD,MAAM,IAAI;CAEV,IAAI,eAAe,KAAK,YAAY,GAAG,OAAO;CAE9C,OAAO,OAAO,EAAE,aAAa,cAAc,OAAO,EAAE,cAAc;AACnE;;;;;;;AAQA,SAAS,QACR,WACoB;CACpB,QAAQ,QAAgC,EAAE,WAAW,GAAG;AACzD;;;;;;;;;;;;AA4BA,SAAgB,iBACf,SACA,SAC2C;CAC3C,MAAM,oBAAoB,CAAC;CAE3B,KAAK,MAAM,CAAC,KAAK,cAAc,OAAO,QAAQ,QAAQ,cAAc,CAAC,CAAC,GAAG;EACxE,IAAI,cAAc,KAAA,GAAW;EAC7B,MAAM,IAAI;EACV,kBAAkB,KAAK,SAAS,SAAS,IACtC,QAAQ,SAAsB,IAC7B;CACL;CAGA,OAAO,eAAmB,SAAS;EAAE,GAAG;EAAa,YAAY;CAAkB,CAAC;AACrF"}
package/dist/index.d.ts CHANGED
@@ -22,6 +22,6 @@ export { useActor } from "./useActor.js";
22
22
  export type { AnyPlayActor } from "./useActor.js";
23
23
  export { defineRegistry } from "./define-registry.js";
24
24
  export type { DefineRegistryOptions, ComponentsMap, ComponentEntry } from "./define-registry.js";
25
- export { JSONUIProvider, StateProvider, ActionProvider, VisibilityProvider, ValidationProvider, Renderer, useBoundProp, } from "@xmachines/json-render-vue";
25
+ export { JSONUIProvider, StateProvider, ActionProvider, VisibilityProvider, ValidationProvider, Renderer, useBoundProp, useFieldValidation, } from "@xmachines/json-render-vue";
26
26
  export type { JSONUIProviderProps, StateProviderProps, ActionProviderProps, ValidationProviderProps, RendererProps, ComponentFn, ComponentContext, DefineRegistryResult, } from "@xmachines/json-render-vue";
27
27
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAGH,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAC/D,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAGjE,YAAY,EACX,kBAAkB,EAClB,mBAAmB,EACnB,kBAAkB,EAClB,uBAAuB,GACvB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AACjE,YAAY,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAGpE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,YAAY,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAGlD,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,YAAY,EAAE,qBAAqB,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAGjG,OAAO,EACN,cAAc,EACd,aAAa,EACb,cAAc,EACd,kBAAkB,EAClB,kBAAkB,EAClB,QAAQ,EACR,YAAY,GACZ,MAAM,4BAA4B,CAAC;AACpC,YAAY,EACX,mBAAmB,EACnB,kBAAkB,EAClB,mBAAmB,EACnB,uBAAuB,EACvB,aAAa,EACb,WAAW,EACX,gBAAgB,EAChB,oBAAoB,GACpB,MAAM,4BAA4B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAGH,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAC/D,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAGjE,YAAY,EACX,kBAAkB,EAClB,mBAAmB,EACnB,kBAAkB,EAClB,uBAAuB,GACvB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AACjE,YAAY,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAGpE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,YAAY,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAGlD,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,YAAY,EAAE,qBAAqB,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAGjG,OAAO,EACN,cAAc,EACd,aAAa,EACb,cAAc,EACd,kBAAkB,EAClB,kBAAkB,EAClB,QAAQ,EACR,YAAY,EACZ,kBAAkB,GAClB,MAAM,4BAA4B,CAAC;AACpC,YAAY,EACX,mBAAmB,EACnB,kBAAkB,EAClB,mBAAmB,EACnB,uBAAuB,EACvB,aAAa,EACb,WAAW,EACX,gBAAgB,EAChB,oBAAoB,GACpB,MAAM,4BAA4B,CAAC"}
package/dist/index.js CHANGED
@@ -1,8 +1,8 @@
1
- import { getPlayViewContext as e } from "./actor-provider-context.js";
2
- import t from "./PlayRenderer.js";
3
- import { useActor as n } from "./useActor.js";
4
- import r from "./ActorProvider.js";
5
- import i from "./PlayUIProvider.js";
6
- import { defineRegistry as a } from "./define-registry.js";
7
- import { ActionProvider as o, JSONUIProvider as s, Renderer as c, StateProvider as l, ValidationProvider as u, VisibilityProvider as d, useBoundProp as f } from "@xmachines/json-render-vue";
8
- export { o as ActionProvider, r as ActorProvider, s as JSONUIProvider, t as PlayRenderer, i as PlayUIProvider, c as Renderer, l as StateProvider, u as ValidationProvider, d as VisibilityProvider, a as defineRegistry, e as getPlayViewContext, n as useActor, f as useBoundProp };
1
+ import { getPlayViewContext } from "./actor-provider-context.js";
2
+ import PlayRenderer_default from "./PlayRenderer.js";
3
+ import { useActor } from "./useActor.js";
4
+ import ActorProvider_default from "./ActorProvider.js";
5
+ import PlayUIProvider_default from "./PlayUIProvider.js";
6
+ import { defineRegistry } from "./define-registry.js";
7
+ import { ActionProvider, JSONUIProvider, Renderer, StateProvider, ValidationProvider, VisibilityProvider, useBoundProp, useFieldValidation } from "@xmachines/json-render-vue";
8
+ export { ActionProvider, ActorProvider_default as ActorProvider, JSONUIProvider, PlayRenderer_default as PlayRenderer, PlayUIProvider_default as PlayUIProvider, Renderer, StateProvider, ValidationProvider, VisibilityProvider, defineRegistry, getPlayViewContext, useActor, useBoundProp, useFieldValidation };
package/dist/useActor.js CHANGED
@@ -1,14 +1,55 @@
1
- import { inject as e, provide as t } from "vue";
2
- import { assertNonNullable as n } from "@xmachines/play";
3
- //#region src/useActor.ts
4
- var r = Symbol("xmachines.actor");
5
- function i(e) {
6
- t(r, e);
1
+ import { inject, provide } from "vue";
2
+ import { assertNonNullable } from "@xmachines/play";
3
+ //#region packages/play-vue/src/useActor.ts
4
+ /**
5
+ * useActor — Vue composable for accessing the provided actor inside a PlayRenderer tree.
6
+ *
7
+ * Components rendered inside PlayRenderer can call useActor() to reach the actor
8
+ * instance without prop drilling.
9
+ *
10
+ * What is returned is a **swap-following proxy**, not the raw actor object:
11
+ * - It is a stable reference for the lifetime of the injection, yet forwards every
12
+ * operation (property reads/writes, `in`, `Object.keys` / spread, `instanceof`)
13
+ * to whichever actor is CURRENTLY provided — so it transparently follows a
14
+ * `props.actor` swap on `<ActorProvider>` without consumers re-injecting.
15
+ * - Method identity is stable per underlying method: `actor.send === actor.send`
16
+ * across repeated reads (allocation-free), and rebinds only when the underlying
17
+ * method changes or the actor is swapped.
18
+ * - It is NOT `===` the `actor` prop passed to `<ActorProvider>` (it is a distinct
19
+ * Proxy object). Any consumer keyed on actor identity — most notably a router
20
+ * bridge extending `RouterBridgeBase`, whose one-bridge-per-actor guard keys a
21
+ * WeakMap on the actor instance — must be given the actor prop itself, not the
22
+ * value returned by `useActor()`.
23
+ *
24
+ * @throws {Error} If called outside a PlayRenderer tree
25
+ *
26
+ * @example
27
+ * ```typescript
28
+ * import { useActor } from "@xmachines/play-vue";
29
+ *
30
+ * const actor = useActor();
31
+ * actor.send({ type: "SUBMIT" });
32
+ * ```
33
+ *
34
+ * @packageDocumentation
35
+ */
36
+ var ActorKey = Symbol("xmachines.actor");
37
+ /**
38
+ * Provide the actor to all descendant components via Vue's inject/provide mechanism.
39
+ *
40
+ * Called inside `PlayRenderer.vue`'s `setup()` to make the actor available to any
41
+ * child component that calls `useActor()`. Not typically needed outside framework
42
+ * internals unless building a custom renderer wrapper.
43
+ *
44
+ * @param actor - The actor instance to inject into the component tree.
45
+ */
46
+ function provideActor(actor) {
47
+ provide(ActorKey, actor);
7
48
  }
8
- function a() {
9
- return n(e(r), "ActorKey");
49
+ function useActor() {
50
+ return assertNonNullable(inject(ActorKey), "ActorKey");
10
51
  }
11
52
  //#endregion
12
- export { r as ActorKey, i as provideActor, a as useActor };
53
+ export { ActorKey, provideActor, useActor };
13
54
 
14
55
  //# sourceMappingURL=useActor.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useActor.js","names":[],"sources":["../src/useActor.ts"],"sourcesContent":["/**\n * useActor — Vue composable for accessing the provided actor inside a PlayRenderer tree.\n *\n * Components rendered inside PlayRenderer can call useActor() to reach the actor\n * instance without prop drilling.\n *\n * What is returned is a **swap-following proxy**, not the raw actor object:\n * - It is a stable reference for the lifetime of the injection, yet forwards every\n * operation (property reads/writes, `in`, `Object.keys` / spread, `instanceof`)\n * to whichever actor is CURRENTLY provided — so it transparently follows a\n * `props.actor` swap on `<ActorProvider>` without consumers re-injecting.\n * - Method identity is stable per underlying method: `actor.send === actor.send`\n * across repeated reads (allocation-free), and rebinds only when the underlying\n * method changes or the actor is swapped.\n * - It is NOT `===` the `actor` prop passed to `<ActorProvider>` (it is a distinct\n * Proxy object). Any consumer keyed on actor identity — most notably a router\n * bridge extending `RouterBridgeBase`, whose one-bridge-per-actor guard keys a\n * WeakMap on the actor instance — must be given the actor prop itself, not the\n * value returned by `useActor()`.\n *\n * @throws {Error} If called outside a PlayRenderer tree\n *\n * @example\n * ```typescript\n * import { useActor } from \"@xmachines/play-vue\";\n *\n * const actor = useActor();\n * actor.send({ type: \"SUBMIT\" });\n * ```\n *\n * @packageDocumentation\n */\n\nimport { inject, provide } from \"vue\";\nimport type { InjectionKey } from \"vue\";\nimport { assertNonNullable } from \"@xmachines/play\";\nimport type { AbstractActor } from \"@xmachines/play-actor\";\nimport type { AnyActorLogic } from \"xstate\";\n\n/** Bare actor type accepted by Vue context providers. For the full routing + view shape, use `PlayActor` from `@xmachines/play-router`. */\nexport type AnyPlayActor = AbstractActor<AnyActorLogic>;\n\nexport const ActorKey: InjectionKey<AnyPlayActor> = Symbol(\"xmachines.actor\");\n\n/**\n * Provide the actor to all descendant components via Vue's inject/provide mechanism.\n *\n * Called inside `PlayRenderer.vue`'s `setup()` to make the actor available to any\n * child component that calls `useActor()`. Not typically needed outside framework\n * internals unless building a custom renderer wrapper.\n *\n * @param actor - The actor instance to inject into the component tree.\n */\nexport function provideActor(actor: AnyPlayActor): void {\n\tprovide(ActorKey, actor);\n}\n\nexport function useActor(): AnyPlayActor {\n\treturn assertNonNullable(inject(ActorKey), \"ActorKey\");\n}\n"],"mappings":";;;AA0CA,IAAa,IAAuC,OAAO,iBAAiB;AAW5E,SAAgB,EAAa,GAA2B;CACvD,EAAQ,GAAU,CAAK;AACxB;AAEA,SAAgB,IAAyB;CACxC,OAAO,EAAkB,EAAO,CAAQ,GAAG,UAAU;AACtD"}
1
+ {"version":3,"file":"useActor.js","names":[],"sources":["../src/useActor.ts"],"sourcesContent":["/**\n * useActor — Vue composable for accessing the provided actor inside a PlayRenderer tree.\n *\n * Components rendered inside PlayRenderer can call useActor() to reach the actor\n * instance without prop drilling.\n *\n * What is returned is a **swap-following proxy**, not the raw actor object:\n * - It is a stable reference for the lifetime of the injection, yet forwards every\n * operation (property reads/writes, `in`, `Object.keys` / spread, `instanceof`)\n * to whichever actor is CURRENTLY provided — so it transparently follows a\n * `props.actor` swap on `<ActorProvider>` without consumers re-injecting.\n * - Method identity is stable per underlying method: `actor.send === actor.send`\n * across repeated reads (allocation-free), and rebinds only when the underlying\n * method changes or the actor is swapped.\n * - It is NOT `===` the `actor` prop passed to `<ActorProvider>` (it is a distinct\n * Proxy object). Any consumer keyed on actor identity — most notably a router\n * bridge extending `RouterBridgeBase`, whose one-bridge-per-actor guard keys a\n * WeakMap on the actor instance — must be given the actor prop itself, not the\n * value returned by `useActor()`.\n *\n * @throws {Error} If called outside a PlayRenderer tree\n *\n * @example\n * ```typescript\n * import { useActor } from \"@xmachines/play-vue\";\n *\n * const actor = useActor();\n * actor.send({ type: \"SUBMIT\" });\n * ```\n *\n * @packageDocumentation\n */\n\nimport { inject, provide } from \"vue\";\nimport type { InjectionKey } from \"vue\";\nimport { assertNonNullable } from \"@xmachines/play\";\nimport type { AbstractActor } from \"@xmachines/play-actor\";\nimport type { AnyActorLogic } from \"xstate\";\n\n/** Bare actor type accepted by Vue context providers. For the full routing + view shape, use `PlayActor` from `@xmachines/play-router`. */\nexport type AnyPlayActor = AbstractActor<AnyActorLogic>;\n\nexport const ActorKey: InjectionKey<AnyPlayActor> = Symbol(\"xmachines.actor\");\n\n/**\n * Provide the actor to all descendant components via Vue's inject/provide mechanism.\n *\n * Called inside `PlayRenderer.vue`'s `setup()` to make the actor available to any\n * child component that calls `useActor()`. Not typically needed outside framework\n * internals unless building a custom renderer wrapper.\n *\n * @param actor - The actor instance to inject into the component tree.\n */\nexport function provideActor(actor: AnyPlayActor): void {\n\tprovide(ActorKey, actor);\n}\n\nexport function useActor(): AnyPlayActor {\n\treturn assertNonNullable(inject(ActorKey), \"ActorKey\");\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0CA,IAAa,WAAuC,OAAO,iBAAiB;;;;;;;;;;AAW5E,SAAgB,aAAa,OAA2B;CACvD,QAAQ,UAAU,KAAK;AACxB;AAEA,SAAgB,WAAyB;CACxC,OAAO,kBAAkB,OAAO,QAAQ,GAAG,UAAU;AACtD"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xmachines/play-vue",
3
- "version": "2.0.0-alpha.1",
3
+ "version": "2.0.0",
4
4
  "description": "Vue renderer for XMachines Play architecture",
5
5
  "keywords": [
6
6
  "reactive",
@@ -10,9 +10,10 @@
10
10
  "xmachines"
11
11
  ],
12
12
  "license": "MIT",
13
+ "author": "Mikael Karon <mikael@karon.se>",
13
14
  "repository": {
14
15
  "type": "git",
15
- "url": "git+ssh://git@gitlab.com/xmachin-es/xmachines-js.git",
16
+ "url": "git+https://gitlab.com/xmachin-es/xmachines-js.git",
16
17
  "directory": "packages/play-vue"
17
18
  },
18
19
  "files": [
@@ -21,60 +22,59 @@
21
22
  "LICENSE"
22
23
  ],
23
24
  "type": "module",
25
+ "sideEffects": false,
24
26
  "main": "./dist/index.js",
25
27
  "types": "./dist/index.d.ts",
26
28
  "exports": {
27
29
  ".": {
28
- "source": "./src/index.ts",
29
30
  "types": "./dist/index.d.ts",
30
31
  "default": "./dist/index.js"
31
- }
32
+ },
33
+ "./package.json": "./package.json"
32
34
  },
33
35
  "publishConfig": {
34
36
  "access": "public"
35
37
  },
36
38
  "scripts": {
37
- "build": "vite build && tsc --build --force",
39
+ "build": "vite build && tsc --build",
38
40
  "clean": "rm -rf dist *.tsbuildinfo coverage .vitest-attachments test/browser/__screenshots__ node_modules/.svelte2tsx-* node_modules/.vite*",
39
41
  "lint": "oxlint .",
40
42
  "format": "oxfmt .",
41
43
  "test": "vitest",
42
- "test:watch": "vitest",
43
- "prepublishOnly": "npm run build"
44
+ "test:watch": "vitest"
44
45
  },
45
46
  "dependencies": {
46
- "@xmachines/play": "2.0.0-alpha.1",
47
- "@xmachines/play-actor": "2.0.0-alpha.1",
48
- "@xmachines/play-signals": "2.0.0-alpha.1"
47
+ "@xmachines/play": "2.0.0",
48
+ "@xmachines/play-actor": "2.0.0",
49
+ "@xmachines/play-signals": "2.0.0"
49
50
  },
50
51
  "devDependencies": {
51
52
  "@testing-library/jest-dom": "^6.9.1",
52
- "@types/node": "^26.1.1",
53
+ "@types/node": "^26.2.0",
53
54
  "@vitejs/plugin-vue": "^6.0.5",
54
- "@vitest/browser-playwright": "^4.1.10",
55
+ "@vitest/browser-playwright": "^4.1.11",
55
56
  "@vue/test-utils": "^2.4.9",
56
- "@xmachines/json-render-core": "^0.19.0-xm.2",
57
- "@xmachines/json-render-vue": "^0.19.0-xm.2",
58
- "@xmachines/json-render-xstate": "^0.19.0-xm.2",
59
- "@xmachines/shared": "2.0.0-alpha.1",
57
+ "@xmachines/json-render-core": "^0.20.0-xm.2",
58
+ "@xmachines/json-render-vue": "^0.20.0-xm.2",
59
+ "@xmachines/json-render-xstate": "^0.20.0-xm.2",
60
60
  "@xstate/store": "^3.17.0",
61
- "oxfmt": "^0.58.0",
62
- "oxlint": "^1.73.0",
61
+ "oxfmt": "^0.64.0",
62
+ "oxlint": "^1.79.0",
63
63
  "typescript": "^5.9.3 || ^6.0.3",
64
64
  "vite": "^8.0.10",
65
65
  "vite-plugin-dts": "^4.5.4",
66
- "vitest": "^4.1.10",
66
+ "vitest": "^4.1.11",
67
67
  "vue": "^3.5.33",
68
- "xstate": "^6.0.0-alpha.20",
68
+ "xstate": "^5.31.0",
69
69
  "zod": "^4.4.1"
70
70
  },
71
71
  "peerDependencies": {
72
- "@xmachines/json-render-core": "^0.19.0-xm.2",
73
- "@xmachines/json-render-vue": "^0.19.0-xm.2",
74
- "@xmachines/json-render-xstate": "^0.19.0-xm.2",
72
+ "@xmachines/json-render-core": "^0.20.0-xm.2",
73
+ "@xmachines/json-render-vue": "^0.20.0-xm.2",
74
+ "@xmachines/json-render-xstate": "^0.20.0-xm.2",
75
75
  "@xstate/store": "^3.17.0",
76
76
  "vue": "^3.5.0",
77
- "xstate": "^6.0.0-alpha.20"
77
+ "xstate": "^5.31.0"
78
78
  },
79
79
  "engines": {
80
80
  "node": ">=22.0.0"