@octanejs/xstate 0.0.1 → 0.0.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.
Files changed (2) hide show
  1. package/package.json +4 -4
  2. package/src/internal.ts +2 -25
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@octanejs/xstate",
3
- "version": "0.0.1",
3
+ "version": "0.0.3",
4
4
  "description": "XState tools for Octane — reuses the framework-agnostic xstate actor core unchanged and ports the @xstate/react 6.1.0 binding onto Octane hooks.",
5
5
  "author": {
6
6
  "name": "Dominic Gannaway",
@@ -42,7 +42,7 @@
42
42
  ],
43
43
  "peerDependencies": {
44
44
  "xstate": "^5.28.0",
45
- "octane": "0.1.43"
45
+ "octane": "0.1.45"
46
46
  },
47
47
  "peerDependenciesMeta": {
48
48
  "xstate": {
@@ -66,8 +66,8 @@
66
66
  "use-sync-external-store": "1.6.0",
67
67
  "vitest": "^4.1.10",
68
68
  "xstate": "5.32.5",
69
- "@octanejs/testing-library": "0.1.40",
70
- "octane": "0.1.43"
69
+ "@octanejs/testing-library": "0.1.42",
70
+ "octane": "0.1.45"
71
71
  },
72
72
  "scripts": {
73
73
  "test": "vitest run",
package/src/internal.ts CHANGED
@@ -4,32 +4,9 @@
4
4
  // composes. This package declares `octane.hookSlots.manual` for `src`, so the
5
5
  // compiler's plain-`.ts` slotting pass skips these modules and the forwarding
6
6
  // below is the only thing that keeps two call sites of the same hook apart.
7
- const subSlotCache = new Map<symbol, Map<string, symbol>>();
8
- const bareTagCache = new Map<string, symbol>();
7
+ import { createSubSlot } from 'octane';
9
8
 
10
- export function subSlot(slot: symbol | undefined, tag: string): symbol {
11
- if (slot === undefined) {
12
- let bare = bareTagCache.get(tag);
13
- if (bare === undefined) {
14
- bare = Symbol.for(`@octanejs/xstate:${tag}`);
15
- bareTagCache.set(tag, bare);
16
- }
17
- return bare;
18
- }
19
-
20
- let byTag = subSlotCache.get(slot);
21
- if (byTag === undefined) {
22
- byTag = new Map();
23
- subSlotCache.set(slot, byTag);
24
- }
25
-
26
- let child = byTag.get(tag);
27
- if (child === undefined) {
28
- child = Symbol.for(`${slot.description ?? ''}:${tag}`);
29
- byTag.set(tag, child);
30
- }
31
- return child;
32
- }
9
+ export const subSlot = createSubSlot({ slotlessPrefix: '@octanejs/xstate:' });
33
10
 
34
11
  export function splitSlot(args: unknown[]): [unknown[], symbol | undefined] {
35
12
  const tail = args[args.length - 1];