@demlik/tea 0.7.0 → 0.8.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 (45) hide show
  1. package/dist/chart/index.d.ts +72 -789
  2. package/dist/chart/index.js +4 -232
  3. package/dist/chart/index.js.map +1 -1
  4. package/dist/chart/inspect/index.d.ts +85 -0
  5. package/dist/chart/inspect/index.js +5 -0
  6. package/dist/chart/inspect/index.js.map +1 -0
  7. package/dist/chart/inspect/react.d.ts +112 -0
  8. package/dist/chart/inspect/react.js +11 -0
  9. package/dist/chart/inspect/react.js.map +1 -0
  10. package/dist/chart/inspect/styles.css +286 -0
  11. package/dist/chart/lane/index.d.ts +361 -0
  12. package/dist/chart/lane/index.js +9 -0
  13. package/dist/chart/lane/index.js.map +1 -0
  14. package/dist/chart/lane/react.d.ts +83 -0
  15. package/dist/chart/lane/react.js +559 -0
  16. package/dist/chart/lane/react.js.map +1 -0
  17. package/dist/chart/lane/styles.css +498 -0
  18. package/dist/chart/report/index.d.ts +116 -0
  19. package/dist/chart/report/index.js +32 -0
  20. package/dist/chart/report/index.js.map +1 -0
  21. package/dist/chunk-5KJKJOFC.js +758 -0
  22. package/dist/chunk-5KJKJOFC.js.map +1 -0
  23. package/dist/chunk-E6GEDSF4.js +307 -0
  24. package/dist/chunk-E6GEDSF4.js.map +1 -0
  25. package/dist/chunk-JER5O7PQ.js +416 -0
  26. package/dist/chunk-JER5O7PQ.js.map +1 -0
  27. package/dist/chunk-UOC2PL46.js +13 -0
  28. package/dist/chunk-UOC2PL46.js.map +1 -0
  29. package/dist/chunk-WRAA7GVZ.js +209 -0
  30. package/dist/chunk-WRAA7GVZ.js.map +1 -0
  31. package/dist/chunk-ZCL7SCBK.js +685 -0
  32. package/dist/chunk-ZCL7SCBK.js.map +1 -0
  33. package/dist/chunk-ZD6PNZBK.js +457 -0
  34. package/dist/chunk-ZD6PNZBK.js.map +1 -0
  35. package/dist/devtools/index.js +2 -207
  36. package/dist/devtools/index.js.map +1 -1
  37. package/dist/fold-Blbhru48.d.ts +435 -0
  38. package/dist/graph-CcjWZVrd.d.ts +923 -0
  39. package/dist/machine-viz/index.d.ts +18 -1
  40. package/dist/machine-viz/index.js +2 -8
  41. package/dist/machine-viz/index.js.map +1 -1
  42. package/dist/reducer-BqyoVyBG.d.ts +447 -0
  43. package/dist/run-BVeqJDBF.d.ts +713 -0
  44. package/dist/samples-DCt6nF8H.d.ts +59 -0
  45. package/package.json +24 -1
@@ -0,0 +1,59 @@
1
+ import { M as MsgOf, E as EventName } from './graph-CcjWZVrd.js';
2
+
3
+ type Narrow<U, K> = Extract<U, {
4
+ type: K;
5
+ }>;
6
+ /**
7
+ * Event `E`'s declared payload — its Msg member minus the `type` the chart
8
+ * already owns.
9
+ *
10
+ * Read off `MsgOf<C>` rather than off the `events` section directly, so it is
11
+ * the SAME derivation the compiled machine consumes: a sample that type-checks
12
+ * here is a msg the machine accepts, by construction. An event with no `data`
13
+ * has `DataOf = unknown`, so this is `{}` — no keys, nothing to supply.
14
+ */
15
+ type SamplePayload<C, E extends string> = Omit<Narrow<MsgOf<C>, E>, "type">;
16
+ /** Does event `E` declare a payload the author must fill in? */
17
+ type NeedsSample<C, E extends string> = [keyof SamplePayload<C, E>] extends [
18
+ never
19
+ ] ? false : true;
20
+ /**
21
+ * The sample bag: one entry per event that DECLARES a payload, each typed as
22
+ * exactly that payload.
23
+ *
24
+ * The `as` clause drops the payload-free events from the key union entirely —
25
+ * so `{ START: {} }` for a bare `START: { scope: "edges" }` is an excess
26
+ * property tsc rejects, rather than a meaningless entry it accepts. "Where an
27
+ * event has no declared payload, no sample is required" is therefore not a
28
+ * convention; it is unrepresentable to supply one.
29
+ *
30
+ * The `type` tag is absent for the same reason it is absent from an `assign`'s
31
+ * return: it is the chart's fact, stamped on by {@link sampleMsg}, so the
32
+ * author cannot write it wrong and cannot write it twice.
33
+ *
34
+ * ```ts
35
+ * const samples: Samples<LaneG> = {
36
+ * WIP: { at: 1 },
37
+ * FAIL: { at: 2, reason: "flaky" }, // `reason` is REQUIRED — the chart says so
38
+ * // BLOCKED: … // omit one and tsc names it
39
+ * };
40
+ * ```
41
+ */
42
+ type Samples<C> = {
43
+ readonly [E in EventName<C> as [NeedsSample<C, E>] extends [true] ? E : never]: SamplePayload<C, E>;
44
+ };
45
+ /** The samples bag as the runtime reads it: event name → payload object. */
46
+ type RtSamples = Readonly<Record<string, object | undefined>>;
47
+ /**
48
+ * Build the Msg for `event` from the sample bag: the payload, plus the `type`
49
+ * the chart owns.
50
+ *
51
+ * Returns `undefined` exactly when the event needs a payload and none was
52
+ * supplied — which is the honest "cannot" the guard preview degrades on,
53
+ * rather than a half-built msg that makes a guard throw for the wrong reason.
54
+ */
55
+ declare function sampleMsg(event: string, hasPayload: boolean, samples: RtSamples | undefined): {
56
+ readonly type: string;
57
+ } | undefined;
58
+
59
+ export { type RtSamples as R, type SamplePayload as S, type Samples as a, sampleMsg as s };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@demlik/tea",
3
- "version": "0.7.0",
3
+ "version": "0.8.0",
4
4
  "description": "TEA-faithful state machine substrate — one package, every host adapter. Core + subs + testing, plus React, Durable Object, Chrome extension, Node, in-memory, work-queue, devtools, and property-testing modules as subpaths.",
5
5
  "keywords": [
6
6
  "tea",
@@ -252,6 +252,28 @@
252
252
  "types": "./dist/chart/index.d.ts",
253
253
  "import": "./dist/chart/index.js"
254
254
  },
255
+ "./chart/inspect": {
256
+ "types": "./dist/chart/inspect/index.d.ts",
257
+ "import": "./dist/chart/inspect/index.js"
258
+ },
259
+ "./chart/inspect/react": {
260
+ "types": "./dist/chart/inspect/react.d.ts",
261
+ "import": "./dist/chart/inspect/react.js"
262
+ },
263
+ "./chart/inspect/styles.css": "./dist/chart/inspect/styles.css",
264
+ "./chart/report": {
265
+ "types": "./dist/chart/report/index.d.ts",
266
+ "import": "./dist/chart/report/index.js"
267
+ },
268
+ "./chart/lane": {
269
+ "types": "./dist/chart/lane/index.d.ts",
270
+ "import": "./dist/chart/lane/index.js"
271
+ },
272
+ "./chart/lane/react": {
273
+ "types": "./dist/chart/lane/react.d.ts",
274
+ "import": "./dist/chart/lane/react.js"
275
+ },
276
+ "./chart/lane/styles.css": "./dist/chart/lane/styles.css",
255
277
  "./package.json": "./package.json"
256
278
  },
257
279
  "dependencies": {
@@ -322,6 +344,7 @@
322
344
  "docs:reference:check": "pnpm run docs:reference && git diff --exit-code -- docs/reference",
323
345
  "verify-exports": "node scripts/verify-exports.mjs",
324
346
  "check:chart-probes": "node scripts/check-chart-probes.mjs",
347
+ "check:merge-markers": "node scripts/check-merge-markers.mjs",
325
348
  "release": "changeset"
326
349
  }
327
350
  }