@hypen-space/core 0.4.980 → 0.5.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 (100) hide show
  1. package/README.md +5 -8
  2. package/dist/a11y.d.ts +82 -0
  3. package/dist/app.js +13 -1168
  4. package/dist/app.js.map +3 -9
  5. package/dist/chunk-00zt3w6e.js +58 -0
  6. package/dist/chunk-00zt3w6e.js.map +10 -0
  7. package/dist/chunk-3zvyth50.js +87 -0
  8. package/dist/chunk-3zvyth50.js.map +10 -0
  9. package/dist/chunk-5gtx3pza.js +11 -0
  10. package/dist/chunk-5gtx3pza.js.map +9 -0
  11. package/dist/chunk-7222131a.js +191 -0
  12. package/dist/chunk-7222131a.js.map +10 -0
  13. package/dist/chunk-avchpwhf.js +200 -0
  14. package/dist/chunk-avchpwhf.js.map +10 -0
  15. package/dist/chunk-ec0tgy9a.js +154 -0
  16. package/dist/chunk-ec0tgy9a.js.map +10 -0
  17. package/dist/chunk-fnss4dm2.js +479 -0
  18. package/dist/chunk-fnss4dm2.js.map +10 -0
  19. package/dist/chunk-g2gz9pgg.js +133 -0
  20. package/dist/chunk-g2gz9pgg.js.map +10 -0
  21. package/dist/chunk-g72v6mmf.js +341 -0
  22. package/dist/chunk-g72v6mmf.js.map +10 -0
  23. package/dist/chunk-g7g3jxty.js +351 -0
  24. package/dist/chunk-g7g3jxty.js.map +10 -0
  25. package/dist/chunk-g830re2c.js +50 -0
  26. package/dist/chunk-g830re2c.js.map +10 -0
  27. package/dist/chunk-gtwh1sg7.js +127 -0
  28. package/dist/chunk-gtwh1sg7.js.map +10 -0
  29. package/dist/chunk-k12cwfst.js +72 -0
  30. package/dist/chunk-k12cwfst.js.map +10 -0
  31. package/dist/chunk-mbqqsz6r.js +128 -0
  32. package/dist/chunk-mbqqsz6r.js.map +10 -0
  33. package/dist/chunk-ne632swm.js +209 -0
  34. package/dist/chunk-ne632swm.js.map +10 -0
  35. package/dist/chunk-p3pj1bax.js +206 -0
  36. package/dist/chunk-p3pj1bax.js.map +10 -0
  37. package/dist/chunk-vshdk2pw.js +56 -0
  38. package/dist/chunk-vshdk2pw.js.map +10 -0
  39. package/dist/chunk-wp2ebn2m.js +51 -0
  40. package/dist/chunk-wp2ebn2m.js.map +10 -0
  41. package/dist/chunk-x4qv4jm9.js +88 -0
  42. package/dist/chunk-x4qv4jm9.js.map +10 -0
  43. package/dist/chunk-ycxp4drd.js +211 -0
  44. package/dist/chunk-ycxp4drd.js.map +10 -0
  45. package/dist/components/builtin.js +14 -1246
  46. package/dist/components/builtin.js.map +3 -10
  47. package/dist/context.js +7 -362
  48. package/dist/context.js.map +3 -6
  49. package/dist/datasource.js +5 -76
  50. package/dist/datasource.js.map +3 -4
  51. package/dist/disposable.js +20 -367
  52. package/dist/disposable.js.map +3 -5
  53. package/dist/engine-base.d.ts +38 -2
  54. package/dist/engine-base.js +45 -412
  55. package/dist/engine-base.js.map +4 -6
  56. package/dist/events.js +7 -285
  57. package/dist/events.js.map +3 -5
  58. package/dist/hypen.js +8 -71
  59. package/dist/hypen.js.map +3 -4
  60. package/dist/index.browser.js +58 -2152
  61. package/dist/index.browser.js.map +3 -16
  62. package/dist/index.d.ts +4 -0
  63. package/dist/index.js +175 -3057
  64. package/dist/index.js.map +5 -22
  65. package/dist/logger.js +16 -220
  66. package/dist/logger.js.map +3 -4
  67. package/dist/managed-router.js +12 -1367
  68. package/dist/managed-router.js.map +3 -10
  69. package/dist/portable.js +6 -70
  70. package/dist/portable.js.map +3 -4
  71. package/dist/remote/client.js +9 -1010
  72. package/dist/remote/client.js.map +3 -8
  73. package/dist/remote/index.d.ts +2 -0
  74. package/dist/remote/index.js +511 -1066
  75. package/dist/remote/index.js.map +4 -9
  76. package/dist/remote/remote-session.d.ts +245 -0
  77. package/dist/remote/session.js +5 -147
  78. package/dist/remote/session.js.map +3 -4
  79. package/dist/renderer.js +7 -271
  80. package/dist/renderer.js.map +3 -5
  81. package/dist/resolver.js +5 -484
  82. package/dist/resolver.js.map +3 -5
  83. package/dist/result.js +25 -211
  84. package/dist/result.js.map +3 -4
  85. package/dist/retry.js +10 -336
  86. package/dist/retry.js.map +3 -5
  87. package/dist/router.js +9 -807
  88. package/dist/router.js.map +3 -8
  89. package/dist/state.js +10 -274
  90. package/dist/state.js.map +3 -5
  91. package/dist/types.d.ts +129 -1
  92. package/dist/validate.d.ts +19 -0
  93. package/package.json +13 -1
  94. package/src/a11y.ts +127 -0
  95. package/src/engine-base.ts +87 -4
  96. package/src/index.ts +10 -0
  97. package/src/remote/index.ts +16 -0
  98. package/src/remote/remote-session.ts +998 -0
  99. package/src/types.ts +131 -1
  100. package/src/validate.ts +37 -0
package/README.md CHANGED
@@ -91,9 +91,10 @@ const counter = app
91
91
  const engine = new Engine();
92
92
  await engine.init();
93
93
 
94
- // 3. Mount a renderer (one call wires up patch streaming + actions)
95
- import { createHypenClient } from "@hypen-space/web/dom";
96
- const { renderer } = createHypenClient(document.getElementById("app")!, engine);
94
+ // 3. Connect your renderer
95
+ engine.setRenderCallback((patches) => {
96
+ myRenderer.applyPatches(patches);
97
+ });
97
98
 
98
99
  // 4. Register the module and render
99
100
  engine.setModule("counter", counter.actions, counter.stateKeys, counter.initialState);
@@ -309,12 +310,8 @@ const remote = new RemoteEngine("ws://localhost:3000", {
309
310
  autoReconnect: true,
310
311
  });
311
312
 
312
- // Mount a renderer once — `createHypenClient` accepts RemoteEngine
313
- // directly (it picks up `onPatches` automatically).
314
- import { createHypenClient } from "@hypen-space/web/dom";
315
- createHypenClient(document.getElementById("app")!, remote);
316
-
317
313
  remote
314
+ .onPatches((patches) => renderer.applyPatches(patches))
318
315
  .onStateUpdate((state) => console.log("Server state:", state))
319
316
  .onConnect(() => console.log("Connected"));
320
317
 
package/dist/a11y.d.ts ADDED
@@ -0,0 +1,82 @@
1
+ /**
2
+ * Accessibility conformance diagnostics — host-side surfacing.
3
+ *
4
+ * The engine's dev-mode conformance pass (`checkAccessibility(source)` on the
5
+ * WASM engine, wired through the package `Engine` wrappers) returns findings
6
+ * as `A11yDiagnostic[]`. This module provides a small, pure helper for
7
+ * surfacing those findings in a dev console.
8
+ */
9
+ /**
10
+ * Byte range `[start, end)` of an element's name token in its source string.
11
+ * Mirrors the Rust `SourceSpan` serialization.
12
+ */
13
+ export interface A11ySourceSpan {
14
+ start: number;
15
+ end: number;
16
+ }
17
+ /**
18
+ * A single accessibility conformance finding produced by the engine.
19
+ *
20
+ * Shape mirrors the Rust located-diagnostic serialization
21
+ * (`{ rule, elementType, message, span?, line?, col? }`). The location
22
+ * fields are present when the engine binding ships span support and the
23
+ * finding maps to a source element; older bindings omit them.
24
+ */
25
+ export interface A11yDiagnostic {
26
+ /** Kebab-case rule identifier (e.g. `"icon-only-control"`). */
27
+ rule: string;
28
+ /** The element type the finding applies to (e.g. `"Button"`). */
29
+ elementType: string;
30
+ /** Human-readable description of the gap. */
31
+ message: string;
32
+ /** Byte span of the offending element's name token in the source. */
33
+ span?: A11ySourceSpan;
34
+ /** 1-based source line of the finding. */
35
+ line?: number;
36
+ /** 1-based column in Unicode codepoints (human/CLI convention). */
37
+ col?: number;
38
+ }
39
+ /**
40
+ * `console.warn` each accessibility finding as
41
+ * `a11y[<rule>] <elementType>: <message>`.
42
+ *
43
+ * Pure with respect to its input (it mutates nothing and returns the
44
+ * formatted lines), so it is unit-testable: the returned array is exactly
45
+ * what was warned, in order. A `console`-less environment is tolerated — the
46
+ * lines are still returned.
47
+ */
48
+ export declare function logA11yDiagnostics(diags: A11yDiagnostic[]): string[];
49
+ /**
50
+ * Kebab-case ids of every accessibility rule this SDK version expects the
51
+ * engine's conformance pass to implement. Mirrors the engine's `A11yRule`
52
+ * enum via `ALL_RULES` in `hypen-engine-rs/src/ir/conformance.rs` (the Rust
53
+ * side pins these exact strings in a unit test).
54
+ *
55
+ * Used for rule-set drift detection: a prebuilt WASM that predates a rule
56
+ * still exposes `checkAccessibility` and looks current while silently never
57
+ * firing the newer rule.
58
+ */
59
+ export declare const EXPECTED_A11Y_RULES: readonly string[];
60
+ /** Result of {@link checkRuleDrift}. */
61
+ export interface A11yRuleDrift {
62
+ /**
63
+ * Whether the binding exposes `a11yRules()` at all. `false` means the
64
+ * build predates rule-list stamping entirely (every expected rule is
65
+ * reported missing).
66
+ */
67
+ hasRuleList: boolean;
68
+ /** Expected rule ids the binding does not implement; empty means no drift. */
69
+ missing: string[];
70
+ }
71
+ /**
72
+ * Compare an engine binding's advertised accessibility rules against
73
+ * {@link EXPECTED_A11Y_RULES}. `engine` is anything exposing the WASM
74
+ * binding surface (a raw `WasmEngine` or a wrapper forwarding `a11yRules`).
75
+ *
76
+ * Drift is a warning, not a failure: findings from the rules the binding
77
+ * does implement remain valid, so callers should surface the missing rules
78
+ * and continue rather than abort the check.
79
+ */
80
+ export declare function checkRuleDrift(engine: {
81
+ a11yRules?: () => string[];
82
+ } | null | undefined): A11yRuleDrift;