@xmachines/play-solid 1.0.0-beta.2 → 1.0.0-beta.3

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,30 +1,31 @@
1
- import { memo as o, insert as r, createComponent as i, Dynamic as u, mergeProps as s, template as d } from "solid-js/web";
2
- import { createSignal as g, onMount as b } from "solid-js";
3
- import { Signal as w } from "@xmachines/play-signals";
4
- var f = /* @__PURE__ */ d('<div class=play-renderer-error>Component "<!>" not found in catalog. Available: ');
5
- const h = (n) => {
6
- const [e, a] = g(n.actor.currentView.get());
7
- b(() => {
8
- const t = new w.subtle.Watcher(() => {
9
- queueMicrotask(() => {
10
- t.getPending(), a(n.actor.currentView.get()), t.watch(n.actor.currentView);
11
- });
12
- });
13
- t.watch(n.actor.currentView);
14
- });
15
- const l = n.actor.send.bind(n.actor);
16
- return [o(() => o(() => !e())() && (n.fallback || null)), o(() => o(() => !!(e() && !n.components))() && (console.error(`Components catalog is ${n.components === null ? "null" : "undefined"}. Cannot render component "${e().component}".`), n.fallback || null)), o(() => o(() => !!(e() && n.components && !n.components[e().component]))() && (console.error(`Component "${e().component}" not found in catalog. Available components: ${Object.keys(n.components).join(", ")}`), (() => {
17
- var t = f(), m = t.firstChild, c = m.nextSibling;
18
- return c.nextSibling, r(t, () => e().component, c), r(t, () => Object.keys(n.components).join(", "), null), t;
19
- })())), o(() => o(() => !!(e() && n.components && n.components[e().component]))() && i(u, s({
20
- get component() {
21
- return n.components[e().component];
22
- }
23
- }, () => e().props, {
24
- send: l
25
- })))];
1
+ import { Dynamic as e, createComponent as t, insert as n, memo as r, mergeProps as i, template as a } from "solid-js/web";
2
+ import { createSignal as o, onMount as s } from "solid-js";
3
+ import { Signal as c } from "@xmachines/play-signals";
4
+ //#region src/PlayRenderer.tsx
5
+ var l = /* @__PURE__ */ a("<div class=play-renderer-error>Component \"<!>\" not found in catalog. Available: "), u = (a) => {
6
+ let [u, d] = o(a.actor.currentView.get());
7
+ s(() => {
8
+ let e = new c.subtle.Watcher(() => {
9
+ queueMicrotask(() => {
10
+ e.getPending(), d(a.actor.currentView.get()), e.watch(a.actor.currentView);
11
+ });
12
+ });
13
+ e.watch(a.actor.currentView);
14
+ });
15
+ let f = a.actor.send.bind(a.actor);
16
+ return [
17
+ r(() => r(() => !u())() && (a.fallback || null)),
18
+ r(() => r(() => !!(u() && !a.components))() && (console.error(`Components catalog is ${a.components === null ? "null" : "undefined"}. Cannot render component "${u().component}".`), a.fallback || null)),
19
+ r(() => r(() => !!(u() && a.components && !a.components[u().component]))() && (console.error(`Component "${u().component}" not found in catalog. Available components: ${Object.keys(a.components).join(", ")}`), (() => {
20
+ var e = l(), t = e.firstChild.nextSibling;
21
+ return t.nextSibling, n(e, () => u().component, t), n(e, () => Object.keys(a.components).join(", "), null), e;
22
+ })())),
23
+ r(() => r(() => !!(u() && a.components && a.components[u().component]))() && t(e, i({ get component() {
24
+ return a.components[u().component];
25
+ } }, () => u().props, { send: f })))
26
+ ];
26
27
  };
27
- export {
28
- h as PlayRenderer
29
- };
30
- //# sourceMappingURL=PlayRenderer.js.map
28
+ //#endregion
29
+ export { u as PlayRenderer };
30
+
31
+ //# sourceMappingURL=PlayRenderer.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"PlayRenderer.js","sources":["../src/PlayRenderer.tsx"],"sourcesContent":["/**\n * PlayRenderer - Main SolidJS renderer component for XMachines Play architecture\n *\n * @packageDocumentation\n */\n\nimport { createSignal, onMount, type Component } from \"solid-js\";\nimport { Dynamic } from \"solid-js/web\";\nimport { Signal } from \"@xmachines/play-signals\";\nimport type { PlayRendererProps, SolidView } from \"./types.js\";\n\n/**\n * Main renderer component that subscribes to actor signals and renders UI\n *\n * Architecture (per XMachines Play patterns):\n * - Subscribes to actor.currentView signal via TC39 Signal.subtle.Watcher\n * - Dynamically renders catalog components based on view.component string\n * - Forwards user events to actor via actor.send()\n * - SolidJS signal only for triggering renders, NOT business logic\n *\n * Invariant: Actor Authority - Actor decides all state transitions via guards.\n * Invariant: Passive Infrastructure - Component observes signals and sends events.\n * Invariant: Signal-Only Reactivity - Business logic state lives in actor signals.\n *\n * @example\n * ```typescript\n * import { PlayRenderer } from \"@xmachines/play-solidjs\";\n * import { definePlayer } from \"@xmachines/play-xstate\";\n *\n * const actor = definePlayer({ machine, catalog })();\n * actor.start();\n *\n * const components = {\n * Dashboard: (props) => <div>User: {props.userId}</div>,\n * LoginForm: (props) => (\n * <form onSubmit={(e) => {\n * e.preventDefault();\n * props.send({ type: \"auth.login\", payload: {...} });\n * }}>...</form>\n * )\n * };\n *\n * <PlayRenderer actor={actor} components={components} />\n * ```\n *\n * @param props - Component props\n * @returns SolidJS element rendering current view from actor\n *\n * @remarks\n * **Component lookup:** Dynamically looks up component from `components` map\n * using `view.component` string from actor.currentView signal.\n *\n * **Event forwarding:** Injects `send` function as prop to components. Components\n * call `send(event)` to forward intents to actor. Actor guards decide validity.\n *\n * **Error handling:** If component not found in catalog, logs error and shows\n * fallback. This indicates missing component registration, not runtime error.\n *\n * **Signal bridge:** Uses one-shot re-watch pattern. TC39 Signal watchers stop\n * watching after notification, so watcher.watch() must be called in microtask\n * after getPending() to re-arm for next notification.\n *\n * **CRITICAL:** Never call actor.send() during render - only in event handlers.\n * Calling send during render causes infinite render loops.\n */\nexport const PlayRenderer: Component<PlayRendererProps> = (props) => {\n\t// Create SolidJS signal for view\n\t// Signal is NOT business logic state - it's just SolidJS's render trigger\n\tconst [view, setView] = createSignal<SolidView>(props.actor.currentView.get() as SolidView);\n\n\t// Bridge TC39 Signal to SolidJS signal\n\t// Uses one-shot re-watch pattern (must re-watch after each notification)\n\tonMount(() => {\n\t\tconst watcher = new Signal.subtle.Watcher(() => {\n\t\t\tqueueMicrotask(() => {\n\t\t\t\t// Acknowledge the notification\n\t\t\t\twatcher.getPending();\n\n\t\t\t\t// Update SolidJS signal (triggers SolidJS reactivity)\n\t\t\t\tsetView(props.actor.currentView.get() as SolidView);\n\n\t\t\t\t// Re-watch for next notification (one-shot pattern)\n\t\t\t\t// TC39 Signal watchers stop watching after notification\n\t\t\t\twatcher.watch(props.actor.currentView);\n\t\t\t});\n\t\t});\n\n\t\t// Watch actor.currentView for changes\n\t\twatcher.watch(props.actor.currentView);\n\n\t\t// Note: TC39 Signal watchers don't have explicit disposal\n\t\t// The watcher will be garbage collected when the component unmounts\n\t});\n\n\t// Bind send function (ensures correct 'this' context)\n\tconst sendBound = props.actor.send.bind(props.actor);\n\n\treturn (\n\t\t<>\n\t\t\t{/* No view - show fallback */}\n\t\t\t{!view() && (props.fallback || null)}\n\n\t\t\t{/* Handle null/undefined components catalog gracefully */}\n\t\t\t{view() &&\n\t\t\t\t!props.components &&\n\t\t\t\t(() => {\n\t\t\t\t\tconsole.error(\n\t\t\t\t\t\t`Components catalog is ${props.components === null ? \"null\" : \"undefined\"}. ` +\n\t\t\t\t\t\t\t`Cannot render component \"${view()!.component}\".`,\n\t\t\t\t\t);\n\t\t\t\t\treturn props.fallback || null;\n\t\t\t\t})()}\n\n\t\t\t{/* View exists but component not found */}\n\t\t\t{view() &&\n\t\t\t\tprops.components &&\n\t\t\t\t!props.components[view()!.component] &&\n\t\t\t\t(() => {\n\t\t\t\t\tconsole.error(\n\t\t\t\t\t\t`Component \"${view()!.component}\" not found in catalog. ` +\n\t\t\t\t\t\t\t`Available components: ${Object.keys(props.components).join(\", \")}`,\n\t\t\t\t\t);\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<div class=\"play-renderer-error\">\n\t\t\t\t\t\t\tComponent \"{view()!.component}\" not found in catalog. Available:{\" \"}\n\t\t\t\t\t\t\t{Object.keys(props.components).join(\", \")}\n\t\t\t\t\t\t</div>\n\t\t\t\t\t);\n\t\t\t\t})()}\n\n\t\t\t{/* Render matched component dynamically */}\n\t\t\t{view() && props.components && props.components[view()!.component] && (\n\t\t\t\t<Dynamic\n\t\t\t\t\tcomponent={props.components[view()!.component]}\n\t\t\t\t\t{...view()!.props}\n\t\t\t\t\tsend={sendBound}\n\t\t\t\t/>\n\t\t\t)}\n\t\t</>\n\t);\n};\n"],"names":["PlayRenderer","props","view","setView","createSignal","actor","currentView","get","onMount","watcher","Signal","subtle","Watcher","queueMicrotask","getPending","watch","sendBound","send","bind","_$memo","fallback","components","console","error","component","Object","keys","join","_el$","_tmpl$","_el$2","firstChild","_el$5","nextSibling","_$insert","_$createComponent","Dynamic","_$mergeProps"],"mappings":";;;;AAiEO,MAAMA,IAA8CC,CAAAA,MAAU;AAGpE,QAAM,CAACC,GAAMC,CAAO,IAAIC,EAAwBH,EAAMI,MAAMC,YAAYC,KAAkB;AAI1FC,EAAAA,EAAQ,MAAM;AACb,UAAMC,IAAU,IAAIC,EAAOC,OAAOC,QAAQ,MAAM;AAC/CC,qBAAe,MAAM;AAEpBJ,QAAAA,EAAQK,WAAAA,GAGRX,EAAQF,EAAMI,MAAMC,YAAYC,IAAAA,CAAkB,GAIlDE,EAAQM,MAAMd,EAAMI,MAAMC,WAAW;AAAA,MACtC,CAAC;AAAA,IACF,CAAC;AAGDG,IAAAA,EAAQM,MAAMd,EAAMI,MAAMC,WAAW;AAAA,EAItC,CAAC;AAGD,QAAMU,IAAYf,EAAMI,MAAMY,KAAKC,KAAKjB,EAAMI,KAAK;AAEnD,SAAA,CAAAc,EAAA,MAGGA,EAAA,MAAA,CAACjB,EAAAA,CAAM,EAAA,MAAKD,EAAMmB,YAAY,KAAK,GAAAD,EAAA,MAGnCA,EAAA,MAAA,CAAA,EAAAjB,EAAAA,KACA,CAACD,EAAMoB,WAAU,EAAA,MAEhBC,QAAQC,MACP,yBAAyBtB,EAAMoB,eAAe,OAAO,SAAS,WAAW,8BAC5CnB,EAAAA,EAAQsB,SAAS,IAC/C,GACOvB,EAAMmB,YAAY,KACtB,GAAAD,EAAA,MAGJA,EAAA,MAAA,CAAA,EAAAjB,EAAAA,KACAD,EAAMoB,cACN,CAACpB,EAAMoB,WAAWnB,EAAAA,EAAQsB,SAAS,EAAC,EAAA,MAEnCF,QAAQC,MACP,cAAcrB,EAAAA,EAAQsB,SAAS,iDACLC,OAAOC,KAAKzB,EAAMoB,UAAU,EAAEM,KAAK,IAAI,CAAC,EACnE,IACA,MAAA;AAAA,QAAAC,IAAAC,KAAAC,IAAAF,EAAAG,YAAAC,IAAAF,EAAAG;AAAAD,WAAAA,EAAAC,aAAAC,EAAAN,GAAA,MAEc1B,EAAAA,EAAQsB,WAASQ,CAAA,GAAAE,EAAAN,GAAA,MAC5BH,OAAOC,KAAKzB,EAAMoB,UAAU,EAAEM,KAAK,IAAI,GAAC,IAAA,GAAAC;AAAAA,EAAA,GAAA,EAGxC,GAAAT,EAAA,MAGJA,EAAA,MAAA,CAAA,EAAAjB,EAAAA,KAAUD,EAAMoB,cAAcpB,EAAMoB,WAAWnB,EAAAA,EAAQsB,SAAS,EAAC,OAAAW,EAChEC,GAAOC,EAAA;AAAA,IAAA,IACPb,YAAS;AAAA,aAAEvB,EAAMoB,WAAWnB,EAAAA,EAAQsB,SAAS;AAAA,IAAC;AAAA,EAAA,GAAA,MAC1CtB,EAAAA,EAAQD,OAAK;AAAA,IACjBgB,MAAMD;AAAAA,EAAAA,CAAS,CAAA,CAEhB,CAAA;AAGJ;"}
1
+ {"version":3,"file":"PlayRenderer.js","names":["createSignal","onMount","Component","Dynamic","Signal","PlayRendererProps","SolidView","PlayRenderer","props","view","setView","actor","currentView","get","watcher","subtle","Watcher","queueMicrotask","getPending","watch","sendBound","send","bind","_$memo","fallback","components","console","error","component","Object","keys","join","_el$","_tmpl$","_el$2","firstChild","_el$5","nextSibling","_el$3","_$insert","_$createComponent","_$mergeProps"],"sources":["../src/PlayRenderer.tsx"],"sourcesContent":["/**\n * PlayRenderer - Main SolidJS renderer component for XMachines Play architecture\n *\n * @packageDocumentation\n */\n\nimport { createSignal, onMount, type Component } from \"solid-js\";\nimport { Dynamic } from \"solid-js/web\";\nimport { Signal } from \"@xmachines/play-signals\";\nimport type { PlayRendererProps, SolidView } from \"./types.js\";\n\n/**\n * Main renderer component that subscribes to actor signals and renders UI\n *\n * Architecture (per XMachines Play patterns):\n * - Subscribes to actor.currentView signal via TC39 Signal.subtle.Watcher\n * - Dynamically renders catalog components based on view.component string\n * - Forwards user events to actor via actor.send()\n * - SolidJS signal only for triggering renders, NOT business logic\n *\n * Invariant: Actor Authority - Actor decides all state transitions via guards.\n * Invariant: Passive Infrastructure - Component observes signals and sends events.\n * Invariant: Signal-Only Reactivity - Business logic state lives in actor signals.\n *\n * @example\n * ```typescript\n * import { PlayRenderer } from \"@xmachines/play-solidjs\";\n * import { definePlayer } from \"@xmachines/play-xstate\";\n *\n * const actor = definePlayer({ machine, catalog })();\n * actor.start();\n *\n * const components = {\n * Dashboard: (props) => <div>User: {props.userId}</div>,\n * LoginForm: (props) => (\n * <form onSubmit={(e) => {\n * e.preventDefault();\n * props.send({ type: \"auth.login\", payload: {...} });\n * }}>...</form>\n * )\n * };\n *\n * <PlayRenderer actor={actor} components={components} />\n * ```\n *\n * @param props - Component props\n * @returns SolidJS element rendering current view from actor\n *\n * @remarks\n * **Component lookup:** Dynamically looks up component from `components` map\n * using `view.component` string from actor.currentView signal.\n *\n * **Event forwarding:** Injects `send` function as prop to components. Components\n * call `send(event)` to forward intents to actor. Actor guards decide validity.\n *\n * **Error handling:** If component not found in catalog, logs error and shows\n * fallback. This indicates missing component registration, not runtime error.\n *\n * **Signal bridge:** Uses one-shot re-watch pattern. TC39 Signal watchers stop\n * watching after notification, so watcher.watch() must be called in microtask\n * after getPending() to re-arm for next notification.\n *\n * **CRITICAL:** Never call actor.send() during render - only in event handlers.\n * Calling send during render causes infinite render loops.\n */\nexport const PlayRenderer: Component<PlayRendererProps> = (props) => {\n\t// Create SolidJS signal for view\n\t// Signal is NOT business logic state - it's just SolidJS's render trigger\n\tconst [view, setView] = createSignal<SolidView>(props.actor.currentView.get() as SolidView);\n\n\t// Bridge TC39 Signal to SolidJS signal\n\t// Uses one-shot re-watch pattern (must re-watch after each notification)\n\tonMount(() => {\n\t\tconst watcher = new Signal.subtle.Watcher(() => {\n\t\t\tqueueMicrotask(() => {\n\t\t\t\t// Acknowledge the notification\n\t\t\t\twatcher.getPending();\n\n\t\t\t\t// Update SolidJS signal (triggers SolidJS reactivity)\n\t\t\t\tsetView(props.actor.currentView.get() as SolidView);\n\n\t\t\t\t// Re-watch for next notification (one-shot pattern)\n\t\t\t\t// TC39 Signal watchers stop watching after notification\n\t\t\t\twatcher.watch(props.actor.currentView);\n\t\t\t});\n\t\t});\n\n\t\t// Watch actor.currentView for changes\n\t\twatcher.watch(props.actor.currentView);\n\n\t\t// Note: TC39 Signal watchers don't have explicit disposal\n\t\t// The watcher will be garbage collected when the component unmounts\n\t});\n\n\t// Bind send function (ensures correct 'this' context)\n\tconst sendBound = props.actor.send.bind(props.actor);\n\n\treturn (\n\t\t<>\n\t\t\t{/* No view - show fallback */}\n\t\t\t{!view() && (props.fallback || null)}\n\n\t\t\t{/* Handle null/undefined components catalog gracefully */}\n\t\t\t{view() &&\n\t\t\t\t!props.components &&\n\t\t\t\t(() => {\n\t\t\t\t\tconsole.error(\n\t\t\t\t\t\t`Components catalog is ${props.components === null ? \"null\" : \"undefined\"}. ` +\n\t\t\t\t\t\t\t`Cannot render component \"${view()!.component}\".`,\n\t\t\t\t\t);\n\t\t\t\t\treturn props.fallback || null;\n\t\t\t\t})()}\n\n\t\t\t{/* View exists but component not found */}\n\t\t\t{view() &&\n\t\t\t\tprops.components &&\n\t\t\t\t!props.components[view()!.component] &&\n\t\t\t\t(() => {\n\t\t\t\t\tconsole.error(\n\t\t\t\t\t\t`Component \"${view()!.component}\" not found in catalog. ` +\n\t\t\t\t\t\t\t`Available components: ${Object.keys(props.components).join(\", \")}`,\n\t\t\t\t\t);\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<div class=\"play-renderer-error\">\n\t\t\t\t\t\t\tComponent \"{view()!.component}\" not found in catalog. Available:{\" \"}\n\t\t\t\t\t\t\t{Object.keys(props.components).join(\", \")}\n\t\t\t\t\t\t</div>\n\t\t\t\t\t);\n\t\t\t\t})()}\n\n\t\t\t{/* Render matched component dynamically */}\n\t\t\t{view() && props.components && props.components[view()!.component] && (\n\t\t\t\t<Dynamic\n\t\t\t\t\tcomponent={props.components[view()!.component]}\n\t\t\t\t\t{...view()!.props}\n\t\t\t\t\tsend={sendBound}\n\t\t\t\t/>\n\t\t\t)}\n\t\t</>\n\t);\n};\n"],"mappings":";;;;iHAiEaO,KAA8CC,MAAU;CAGpE,IAAM,CAACC,GAAMC,KAAWV,EAAwBQ,EAAMG,MAAMC,YAAYC,KAAK,CAAc;AAI3FZ,SAAc;EACb,IAAMa,IAAU,IAAIV,EAAOW,OAAOC,cAAc;AAC/CC,wBAAqB;AASpBH,IAPAA,EAAQI,YAAY,EAGpBR,EAAQF,EAAMG,MAAMC,YAAYC,KAAK,CAAc,EAInDC,EAAQK,MAAMX,EAAMG,MAAMC,YAAY;KACrC;IACD;AAGFE,IAAQK,MAAMX,EAAMG,MAAMC,YAAY;GAIrC;CAGF,IAAMQ,IAAYZ,EAAMG,MAAMU,KAAKC,KAAKd,EAAMG,MAAM;AAEpD,QAAA;EAAAY,QAGGA,QAAA,CAACd,GAAM,CAAA,EAAA,KAAKD,EAAMgB,YAAY,MAAK;EAAAD,QAGnCA,QAAA,CAAA,EAAAd,GAAM,IACN,CAACD,EAAMiB,YAAU,EAAA,KAEhBC,QAAQC,MACP,yBAAyBnB,EAAMiB,eAAe,OAAO,SAAS,YAAW,6BAC5ChB,GAAM,CAAEmB,UAAS,IAC9C,EACMpB,EAAMgB,YAAY,MACtB;EAAAD,QAGJA,QAAA,CAAA,EAAAd,GAAM,IACND,EAAMiB,cACN,CAACjB,EAAMiB,WAAWhB,GAAM,CAAEmB,YAAU,EAAA,KAEnCF,QAAQC,MACP,cAAclB,GAAM,CAAEmB,UAAS,gDACLC,OAAOC,KAAKtB,EAAMiB,WAAW,CAACM,KAAK,KAAK,GAClE,SACD;GAAA,IAAAC,IAAAC,GAAA,EAAAG,IAAAJ,EAAAG,WAAAE;AAG2C,UAH3CD,EAAAC,aAAAE,EAAAP,SAEcvB,GAAM,CAAEmB,WAASQ,EAAA,EAAAG,EAAAP,SAC5BH,OAAOC,KAAKtB,EAAMiB,WAAW,CAACM,KAAK,KAAK,EAAA,KAAA,EAAAC;MAAA,EAGxC;EAAAT,QAGJA,QAAA,CAAA,EAAAd,GAAM,IAAID,EAAMiB,cAAcjB,EAAMiB,WAAWhB,GAAM,CAAEmB,YAAU,EAAA,IAAAY,EAChErC,GAAOsC,EAAA,EAAA,IACPb,YAAS;AAAA,UAAEpB,EAAMiB,WAAWhB,GAAM,CAAEmB;KAAU,QAC1CnB,GAAM,CAAED,OAAK,EACjBa,MAAMD,GAAS,CAAA,CAEhB,CAAA;EAAA"}
package/dist/index.js CHANGED
@@ -1,5 +1,2 @@
1
- import { PlayRenderer as o } from "./PlayRenderer.js";
2
- export {
3
- o as PlayRenderer
4
- };
5
- //# sourceMappingURL=index.js.map
1
+ import { PlayRenderer as e } from "./PlayRenderer.js";
2
+ export { e as PlayRenderer };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xmachines/play-solid",
3
- "version": "1.0.0-beta.2",
3
+ "version": "1.0.0-beta.3",
4
4
  "description": "SolidJS renderer for XMachines Play architecture",
5
5
  "keywords": [
6
6
  "catalog",
@@ -24,6 +24,9 @@
24
24
  "default": "./dist/index.js"
25
25
  }
26
26
  },
27
+ "publishConfig": {
28
+ "access": "public"
29
+ },
27
30
  "scripts": {
28
31
  "build": "vite build && tsc --build",
29
32
  "clean": "rm -rf dist tsconfig.tsbuildinfo",
@@ -34,23 +37,20 @@
34
37
  "prepublishOnly": "npm run build"
35
38
  },
36
39
  "dependencies": {
37
- "@xmachines/play-actor": "1.0.0-beta.2",
38
- "@xmachines/play-catalog": "1.0.0-beta.2",
39
- "@xmachines/play-signals": "1.0.0-beta.2"
40
+ "@xmachines/play-actor": "1.0.0-beta.3",
41
+ "@xmachines/play-catalog": "1.0.0-beta.3",
42
+ "@xmachines/play-signals": "1.0.0-beta.3"
40
43
  },
41
44
  "devDependencies": {
42
45
  "@solidjs/testing-library": "^0.8.10",
43
- "@types/node": "^25.4.0",
44
- "solid-js": "^1.9.3",
45
- "typescript": "^5.7.0",
46
- "vite": "^7.3.1",
47
- "vite-plugin-solid": "^2.11.4",
48
- "vitest": "^4.0.18"
46
+ "@types/node": "^25.5.0",
47
+ "solid-js": "^1.9.11",
48
+ "typescript": "^5.9.3",
49
+ "vite": "^8.0.0",
50
+ "vite-plugin-solid": "^2.11.11",
51
+ "vitest": "^4.1.0"
49
52
  },
50
53
  "peerDependencies": {
51
54
  "solid-js": "^1.8.0 || ^1.9.0"
52
- },
53
- "publishConfig": {
54
- "access": "public"
55
55
  }
56
56
  }
@@ -1,63 +0,0 @@
1
- /**
2
- * PlayRenderer - Main SolidJS renderer component for XMachines Play architecture
3
- *
4
- * @packageDocumentation
5
- */
6
- import { type Component } from "solid-js";
7
- import type { PlayRendererProps } from "./types.js";
8
- /**
9
- * Main renderer component that subscribes to actor signals and renders UI
10
- *
11
- * Architecture (per XMachines Play patterns):
12
- * - Subscribes to actor.currentView signal via TC39 Signal.subtle.Watcher
13
- * - Dynamically renders catalog components based on view.component string
14
- * - Forwards user events to actor via actor.send()
15
- * - SolidJS signal only for triggering renders, NOT business logic
16
- *
17
- * Invariant: Actor Authority - Actor decides all state transitions via guards.
18
- * Invariant: Passive Infrastructure - Component observes signals and sends events.
19
- * Invariant: Signal-Only Reactivity - Business logic state lives in actor signals.
20
- *
21
- * @example
22
- * ```typescript
23
- * import { PlayRenderer } from "@xmachines/play-solidjs";
24
- * import { definePlayer } from "@xmachines/play-xstate";
25
- *
26
- * const actor = definePlayer({ machine, catalog })();
27
- * actor.start();
28
- *
29
- * const components = {
30
- * Dashboard: (props) => <div>User: {props.userId}</div>,
31
- * LoginForm: (props) => (
32
- * <form onSubmit={(e) => {
33
- * e.preventDefault();
34
- * props.send({ type: "auth.login", payload: {...} });
35
- * }}>...</form>
36
- * )
37
- * };
38
- *
39
- * <PlayRenderer actor={actor} components={components} />
40
- * ```
41
- *
42
- * @param props - Component props
43
- * @returns SolidJS element rendering current view from actor
44
- *
45
- * @remarks
46
- * **Component lookup:** Dynamically looks up component from `components` map
47
- * using `view.component` string from actor.currentView signal.
48
- *
49
- * **Event forwarding:** Injects `send` function as prop to components. Components
50
- * call `send(event)` to forward intents to actor. Actor guards decide validity.
51
- *
52
- * **Error handling:** If component not found in catalog, logs error and shows
53
- * fallback. This indicates missing component registration, not runtime error.
54
- *
55
- * **Signal bridge:** Uses one-shot re-watch pattern. TC39 Signal watchers stop
56
- * watching after notification, so watcher.watch() must be called in microtask
57
- * after getPending() to re-arm for next notification.
58
- *
59
- * **CRITICAL:** Never call actor.send() during render - only in event handlers.
60
- * Calling send during render causes infinite render loops.
61
- */
62
- export declare const PlayRenderer: Component<PlayRendererProps>;
63
- //# sourceMappingURL=PlayRenderer.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"PlayRenderer.d.ts","sourceRoot":"","sources":["../src/PlayRenderer.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAyB,KAAK,SAAS,EAAE,MAAM,UAAU,CAAC;AAGjE,OAAO,KAAK,EAAE,iBAAiB,EAAa,MAAM,YAAY,CAAC;AAE/D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqDG;AACH,eAAO,MAAM,YAAY,EAAE,SAAS,CAAC,iBAAiB,CA2ErD,CAAC"}
package/dist/index.d.ts DELETED
@@ -1,8 +0,0 @@
1
- /**
2
- * SolidJS renderer for XMachines Play architecture
3
- *
4
- * @packageDocumentation
5
- */
6
- export { PlayRenderer } from "./PlayRenderer.js";
7
- export type { PlayRendererProps } from "./types.js";
8
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,YAAY,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC"}
package/dist/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
package/dist/types.d.ts DELETED
@@ -1,28 +0,0 @@
1
- /**
2
- * TypeScript type definitions for play-solidjs
3
- *
4
- * @packageDocumentation
5
- */
6
- import type { AbstractActor, Viewable } from "@xmachines/play-actor";
7
- import type { JSX, ValidComponent } from "solid-js";
8
- import type { AnyActorLogic } from "xstate";
9
- export type SolidView = {
10
- component: string;
11
- props: Record<string, unknown>;
12
- } | null;
13
- /**
14
- * Props for PlayRenderer component
15
- *
16
- * @property actor - Actor instance with currentView signal (requires Viewable capability)
17
- * @property components - Map of component names to SolidJS components
18
- * @property fallback - Optional element shown when currentView is null
19
- */
20
- export interface PlayRendererProps {
21
- /** Actor instance with currentView signal (requires Viewable capability) */
22
- actor: AbstractActor<AnyActorLogic> & Viewable;
23
- /** Map of component names to SolidJS components */
24
- components: Record<string, ValidComponent>;
25
- /** Optional element shown when currentView is null */
26
- fallback?: JSX.Element;
27
- }
28
- //# sourceMappingURL=types.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACrE,OAAO,KAAK,EAAE,GAAG,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AACpD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AAE5C,MAAM,MAAM,SAAS,GAAG;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAAE,GAAG,IAAI,CAAC;AAErF;;;;;;GAMG;AACH,MAAM,WAAW,iBAAiB;IACjC,4EAA4E;IAC5E,KAAK,EAAE,aAAa,CAAC,aAAa,CAAC,GAAG,QAAQ,CAAC;IAE/C,mDAAmD;IACnD,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;IAE3C,sDAAsD;IACtD,QAAQ,CAAC,EAAE,GAAG,CAAC,OAAO,CAAC;CACvB"}