@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.
- package/README.md +5 -8
- package/dist/a11y.d.ts +82 -0
- package/dist/app.js +13 -1168
- package/dist/app.js.map +3 -9
- package/dist/chunk-00zt3w6e.js +58 -0
- package/dist/chunk-00zt3w6e.js.map +10 -0
- package/dist/chunk-3zvyth50.js +87 -0
- package/dist/chunk-3zvyth50.js.map +10 -0
- package/dist/chunk-5gtx3pza.js +11 -0
- package/dist/chunk-5gtx3pza.js.map +9 -0
- package/dist/chunk-7222131a.js +191 -0
- package/dist/chunk-7222131a.js.map +10 -0
- package/dist/chunk-avchpwhf.js +200 -0
- package/dist/chunk-avchpwhf.js.map +10 -0
- package/dist/chunk-ec0tgy9a.js +154 -0
- package/dist/chunk-ec0tgy9a.js.map +10 -0
- package/dist/chunk-fnss4dm2.js +479 -0
- package/dist/chunk-fnss4dm2.js.map +10 -0
- package/dist/chunk-g2gz9pgg.js +133 -0
- package/dist/chunk-g2gz9pgg.js.map +10 -0
- package/dist/chunk-g72v6mmf.js +341 -0
- package/dist/chunk-g72v6mmf.js.map +10 -0
- package/dist/chunk-g7g3jxty.js +351 -0
- package/dist/chunk-g7g3jxty.js.map +10 -0
- package/dist/chunk-g830re2c.js +50 -0
- package/dist/chunk-g830re2c.js.map +10 -0
- package/dist/chunk-gtwh1sg7.js +127 -0
- package/dist/chunk-gtwh1sg7.js.map +10 -0
- package/dist/chunk-k12cwfst.js +72 -0
- package/dist/chunk-k12cwfst.js.map +10 -0
- package/dist/chunk-mbqqsz6r.js +128 -0
- package/dist/chunk-mbqqsz6r.js.map +10 -0
- package/dist/chunk-ne632swm.js +209 -0
- package/dist/chunk-ne632swm.js.map +10 -0
- package/dist/chunk-p3pj1bax.js +206 -0
- package/dist/chunk-p3pj1bax.js.map +10 -0
- package/dist/chunk-vshdk2pw.js +56 -0
- package/dist/chunk-vshdk2pw.js.map +10 -0
- package/dist/chunk-wp2ebn2m.js +51 -0
- package/dist/chunk-wp2ebn2m.js.map +10 -0
- package/dist/chunk-x4qv4jm9.js +88 -0
- package/dist/chunk-x4qv4jm9.js.map +10 -0
- package/dist/chunk-ycxp4drd.js +211 -0
- package/dist/chunk-ycxp4drd.js.map +10 -0
- package/dist/components/builtin.js +14 -1246
- package/dist/components/builtin.js.map +3 -10
- package/dist/context.js +7 -362
- package/dist/context.js.map +3 -6
- package/dist/datasource.js +5 -76
- package/dist/datasource.js.map +3 -4
- package/dist/disposable.js +20 -367
- package/dist/disposable.js.map +3 -5
- package/dist/engine-base.d.ts +38 -2
- package/dist/engine-base.js +45 -412
- package/dist/engine-base.js.map +4 -6
- package/dist/events.js +7 -285
- package/dist/events.js.map +3 -5
- package/dist/hypen.js +8 -71
- package/dist/hypen.js.map +3 -4
- package/dist/index.browser.js +58 -2152
- package/dist/index.browser.js.map +3 -16
- package/dist/index.d.ts +4 -0
- package/dist/index.js +175 -3057
- package/dist/index.js.map +5 -22
- package/dist/logger.js +16 -220
- package/dist/logger.js.map +3 -4
- package/dist/managed-router.js +12 -1367
- package/dist/managed-router.js.map +3 -10
- package/dist/portable.js +6 -70
- package/dist/portable.js.map +3 -4
- package/dist/remote/client.js +9 -1010
- package/dist/remote/client.js.map +3 -8
- package/dist/remote/index.d.ts +2 -0
- package/dist/remote/index.js +511 -1066
- package/dist/remote/index.js.map +4 -9
- package/dist/remote/remote-session.d.ts +245 -0
- package/dist/remote/session.js +5 -147
- package/dist/remote/session.js.map +3 -4
- package/dist/renderer.js +7 -271
- package/dist/renderer.js.map +3 -5
- package/dist/resolver.js +5 -484
- package/dist/resolver.js.map +3 -5
- package/dist/result.js +25 -211
- package/dist/result.js.map +3 -4
- package/dist/retry.js +10 -336
- package/dist/retry.js.map +3 -5
- package/dist/router.js +9 -807
- package/dist/router.js.map +3 -8
- package/dist/state.js +10 -274
- package/dist/state.js.map +3 -5
- package/dist/types.d.ts +129 -1
- package/dist/validate.d.ts +19 -0
- package/package.json +13 -1
- package/src/a11y.ts +127 -0
- package/src/engine-base.ts +87 -4
- package/src/index.ts +10 -0
- package/src/remote/index.ts +16 -0
- package/src/remote/remote-session.ts +998 -0
- package/src/types.ts +131 -1
- 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.
|
|
95
|
-
|
|
96
|
-
|
|
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;
|