jssm 5.136.0 → 5.138.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.
- package/README.md +7 -7
- package/custom-elements.json +377 -8
- package/dist/cdn/instance.js +419 -8
- package/dist/cdn/viz.js +1 -1
- package/dist/cli/fsl-render.cjs +1 -1
- package/dist/cli/fsl.cjs +1 -1
- package/dist/deno/README.md +7 -7
- package/dist/deno/jssm.js +1 -1
- package/dist/jssm.es5.cjs +1 -1
- package/dist/jssm.es5.iife.js +1 -1
- package/dist/jssm.es6.mjs +1 -1
- package/dist/jssm_viz.cjs +1 -1
- package/dist/jssm_viz.iife.cjs +1 -1
- package/dist/jssm_viz.mjs +1 -1
- package/dist/wc/instance.js +418 -7
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -18,10 +18,10 @@ Please edit the file it's derived from, instead: `./src/md/readme_base.md`
|
|
|
18
18
|
|
|
19
19
|
|
|
20
20
|
|
|
21
|
-
* Generated for version 5.
|
|
21
|
+
* Generated for version 5.138.0 at 5/28/2026, 7:32:08 AM
|
|
22
22
|
|
|
23
23
|
-->
|
|
24
|
-
# jssm 5.
|
|
24
|
+
# jssm 5.138.0
|
|
25
25
|
|
|
26
26
|
[**Try the live editor**](https://stonecypher.github.io/jssm-viz-demo/graph_explorer.html) ·
|
|
27
27
|
[Documentation](https://stonecypher.github.io/jssm/docs/) ·
|
|
@@ -281,7 +281,7 @@ That decision shows up everywhere downstream:
|
|
|
281
281
|
or run `npm run benny` against your own machine.
|
|
282
282
|
|
|
283
283
|
- **More thoroughly tested than any other JavaScript state-machine
|
|
284
|
-
library.** 6,
|
|
284
|
+
library.** 6,349 tests at 100.0% line coverage
|
|
285
285
|
([report](https://coveralls.io/github/StoneCypher/jssm)), plus
|
|
286
286
|
fuzz testing via `fast-check`, with parser test data across ten natural
|
|
287
287
|
languages and Emoji.
|
|
@@ -414,11 +414,11 @@ If your contribution is missing here, please open an issue.
|
|
|
414
414
|
|
|
415
415
|
<br/>
|
|
416
416
|
|
|
417
|
-
***6,
|
|
417
|
+
***6,349 tests***, run 57,136 times.
|
|
418
418
|
|
|
419
|
-
- 5,
|
|
420
|
-
- 513 fuzz tests with 3.
|
|
421
|
-
- 5,
|
|
419
|
+
- 5,836 specs with 100.0% coverage
|
|
420
|
+
- 513 fuzz tests with 3.6% coverage
|
|
421
|
+
- 5,288 TypeScript lines - 1.2 tests per line, 10.8 generated tests per line
|
|
422
422
|
|
|
423
423
|
[](https://github.com/StoneCypher/jssm/actions)
|
|
424
424
|
[](https://www.npmjs.com/package/jssm)
|
package/custom-elements.json
CHANGED
|
@@ -2,6 +2,254 @@
|
|
|
2
2
|
"schemaVersion": "1.0.0",
|
|
3
3
|
"readme": "",
|
|
4
4
|
"modules": [
|
|
5
|
+
{
|
|
6
|
+
"kind": "javascript-module",
|
|
7
|
+
"path": "src/ts/wc/jssm_hook_wc.ts",
|
|
8
|
+
"declarations": [
|
|
9
|
+
{
|
|
10
|
+
"kind": "function",
|
|
11
|
+
"name": "make_hook_proxy",
|
|
12
|
+
"return": {
|
|
13
|
+
"type": {
|
|
14
|
+
"text": ""
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
"parameters": [
|
|
18
|
+
{
|
|
19
|
+
"name": "ctx",
|
|
20
|
+
"type": {
|
|
21
|
+
"text": "{ data?: TData; from?: string; to?: string; action?: string }"
|
|
22
|
+
},
|
|
23
|
+
"description": "Raw hook context passed by jssm."
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
"name": "machine",
|
|
27
|
+
"type": {
|
|
28
|
+
"text": "{ state(): unknown }"
|
|
29
|
+
},
|
|
30
|
+
"description": "The owning machine; used for the `state()` accessor."
|
|
31
|
+
}
|
|
32
|
+
],
|
|
33
|
+
"description": "Build a JssmHookProxy that wraps an arbitrary hook context object.\n\nThe context shape varies by hook kind (`from`/`to`/`action` may be absent\nfor transition-kind hooks), so this normalizes the shape via optional\nfields and exposes mutable `data` while keeping the rest read-only.\n\nThe `machine` parameter is used only for `state()`, so unit tests can\nsubstitute any object with a `state(): unknown` method."
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
"kind": "function",
|
|
37
|
+
"name": "compile_inline_body",
|
|
38
|
+
"return": {
|
|
39
|
+
"type": {
|
|
40
|
+
"text": ""
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
"parameters": [
|
|
44
|
+
{
|
|
45
|
+
"name": "body",
|
|
46
|
+
"type": {
|
|
47
|
+
"text": "string"
|
|
48
|
+
},
|
|
49
|
+
"description": "Trimmed textContent of the `<jssm-hook>` element."
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
"name": "debug_id",
|
|
53
|
+
"type": {
|
|
54
|
+
"text": "string"
|
|
55
|
+
},
|
|
56
|
+
"description": "Identifier appended to the synthetic sourceURL."
|
|
57
|
+
}
|
|
58
|
+
],
|
|
59
|
+
"description": "Compile a textContent body into a callable user handler.\n\nUses dynamic function construction — the same primitive browsers use\ninternally for `<a onclick=\"...\">` and `setTimeout(stringBody, ms)`.\nStrict CSP without `'unsafe-eval'` blocks this and the call will throw;\nconsumers should fall back to the `handler=\"name\"` form there.\n\nPrepends a `//# sourceURL=` comment so devtools surface a meaningful name\nin stack traces instead of `anonymous`."
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
"kind": "function",
|
|
63
|
+
"name": "resolve_named_handler",
|
|
64
|
+
"return": {
|
|
65
|
+
"type": {
|
|
66
|
+
"text": ""
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
"parameters": [
|
|
70
|
+
{
|
|
71
|
+
"name": "name",
|
|
72
|
+
"type": {
|
|
73
|
+
"text": "string"
|
|
74
|
+
},
|
|
75
|
+
"description": "The handler name from the `handler=\"\"` attribute."
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
"name": "registry",
|
|
79
|
+
"optional": true,
|
|
80
|
+
"type": {
|
|
81
|
+
"text": "JssmHookRegistry"
|
|
82
|
+
},
|
|
83
|
+
"description": "Optional in-WC registry to consult first."
|
|
84
|
+
}
|
|
85
|
+
],
|
|
86
|
+
"description": "Resolve a `handler=\"name\"` attribute to a callable by consulting first the\noptional in-WC registry, then `globalThis[name]`. Throws a clear error if\nneither resolves."
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
"kind": "function",
|
|
90
|
+
"name": "normalize_hook_kind",
|
|
91
|
+
"return": {
|
|
92
|
+
"type": {
|
|
93
|
+
"text": ""
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
"parameters": [
|
|
97
|
+
{
|
|
98
|
+
"name": "raw",
|
|
99
|
+
"type": {
|
|
100
|
+
"text": "string | null | undefined"
|
|
101
|
+
},
|
|
102
|
+
"description": "The raw attribute value, or null if not present."
|
|
103
|
+
}
|
|
104
|
+
],
|
|
105
|
+
"description": "Validate and normalize a `<jssm-hook kind=\"...\">` value, defaulting to\n`\"hook\"` when the attribute is absent. Throws on unknown kinds rather\nthan silently doing nothing later."
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
"kind": "function",
|
|
109
|
+
"name": "parse_hook_element",
|
|
110
|
+
"return": {
|
|
111
|
+
"type": {
|
|
112
|
+
"text": ""
|
|
113
|
+
}
|
|
114
|
+
},
|
|
115
|
+
"parameters": [
|
|
116
|
+
{
|
|
117
|
+
"name": "el",
|
|
118
|
+
"type": {
|
|
119
|
+
"text": "HTMLElement"
|
|
120
|
+
},
|
|
121
|
+
"description": "The `<jssm-hook>` element to parse."
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
"name": "debug_id",
|
|
125
|
+
"type": {
|
|
126
|
+
"text": "string"
|
|
127
|
+
},
|
|
128
|
+
"description": "Identifier used in the inline body's sourceURL."
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
"name": "registry",
|
|
132
|
+
"optional": true,
|
|
133
|
+
"type": {
|
|
134
|
+
"text": "JssmHookRegistry"
|
|
135
|
+
},
|
|
136
|
+
"description": "Optional in-WC registry of named handlers."
|
|
137
|
+
}
|
|
138
|
+
],
|
|
139
|
+
"description": "Parse a single `<jssm-hook>` element into a JssmHookInstallSpec.\n\nValidates the mutual-exclusion rule between `handler=\"name\"` and inline\nbody, defaults `kind` to `\"hook\"`, resolves named handlers against the\noptional registry then `globalThis`, and compiles inline bodies via\ndynamic function construction. Conditional-required attributes (e.g.\n`from`/`to` for `kind=\"hook\"`) are NOT validated here — `set_hook` will\nthrow with its own clear errors on missing pieces, which keeps the\nerror surface single-sourced."
|
|
140
|
+
},
|
|
141
|
+
{
|
|
142
|
+
"kind": "function",
|
|
143
|
+
"name": "wrap_user_handler",
|
|
144
|
+
"return": {
|
|
145
|
+
"type": {
|
|
146
|
+
"text": ""
|
|
147
|
+
}
|
|
148
|
+
},
|
|
149
|
+
"parameters": [
|
|
150
|
+
{
|
|
151
|
+
"name": "spec",
|
|
152
|
+
"type": {
|
|
153
|
+
"text": "JssmHookInstallSpec"
|
|
154
|
+
},
|
|
155
|
+
"description": "The parsed install spec carrying the user handler."
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
"name": "machine",
|
|
159
|
+
"type": {
|
|
160
|
+
"text": "{ state(): unknown }"
|
|
161
|
+
},
|
|
162
|
+
"description": "The owning machine; used by the proxy's `state()`."
|
|
163
|
+
}
|
|
164
|
+
],
|
|
165
|
+
"description": "Wrap a JssmHookUserHandler so that jssm's native hook contract is\nsatisfied: the user gets a friendly proxy, the proxy's mutated `data`\nbecomes the `HookComplexResult.data`, and an explicit `false` return\ncancels the transition.\n\nAny non-`false` return — including `undefined`, `true`, or an arbitrary\nobject — allows the transition. This matches the contract spelled out\nin the issue (#641): \"return false cancels; anything else allows\"."
|
|
166
|
+
},
|
|
167
|
+
{
|
|
168
|
+
"kind": "function",
|
|
169
|
+
"name": "build_hook_descriptor",
|
|
170
|
+
"return": {
|
|
171
|
+
"type": {
|
|
172
|
+
"text": ""
|
|
173
|
+
}
|
|
174
|
+
},
|
|
175
|
+
"parameters": [
|
|
176
|
+
{
|
|
177
|
+
"name": "spec",
|
|
178
|
+
"type": {
|
|
179
|
+
"text": "JssmHookInstallSpec"
|
|
180
|
+
},
|
|
181
|
+
"description": "The parsed install spec."
|
|
182
|
+
},
|
|
183
|
+
{
|
|
184
|
+
"name": "wrapped",
|
|
185
|
+
"type": {
|
|
186
|
+
"text": "(ctx: RawHookContext) => unknown"
|
|
187
|
+
},
|
|
188
|
+
"description": "The wrapped (friendly-proxy) handler from {@link wrap_user_handler}.\n * "
|
|
189
|
+
}
|
|
190
|
+
],
|
|
191
|
+
"description": "Build the typed descriptor object passed to `machine.set_hook` (and later\nto `machine.remove_hook` for cleanup) from a parsed JssmHookInstallSpec\nand the wrapped handler.\n\nFor kinds that need `from`/`to`/`action`, the descriptor includes those.\nMissing required keys produce `undefined` here; jssm's `set_hook` will\nsurface the error with its own clear message so we don't duplicate\nvalidation.\n\nReturn type is `unknown` because jssm's `HookDescription` is a\ndiscriminated union and our runtime-discriminator value can't be tracked\nby TypeScript across the build. The WC casts at the `set_hook` call site."
|
|
192
|
+
}
|
|
193
|
+
],
|
|
194
|
+
"exports": [
|
|
195
|
+
{
|
|
196
|
+
"kind": "js",
|
|
197
|
+
"name": "make_hook_proxy",
|
|
198
|
+
"declaration": {
|
|
199
|
+
"name": "make_hook_proxy",
|
|
200
|
+
"module": "src/ts/wc/jssm_hook_wc.ts"
|
|
201
|
+
}
|
|
202
|
+
},
|
|
203
|
+
{
|
|
204
|
+
"kind": "js",
|
|
205
|
+
"name": "compile_inline_body",
|
|
206
|
+
"declaration": {
|
|
207
|
+
"name": "compile_inline_body",
|
|
208
|
+
"module": "src/ts/wc/jssm_hook_wc.ts"
|
|
209
|
+
}
|
|
210
|
+
},
|
|
211
|
+
{
|
|
212
|
+
"kind": "js",
|
|
213
|
+
"name": "resolve_named_handler",
|
|
214
|
+
"declaration": {
|
|
215
|
+
"name": "resolve_named_handler",
|
|
216
|
+
"module": "src/ts/wc/jssm_hook_wc.ts"
|
|
217
|
+
}
|
|
218
|
+
},
|
|
219
|
+
{
|
|
220
|
+
"kind": "js",
|
|
221
|
+
"name": "normalize_hook_kind",
|
|
222
|
+
"declaration": {
|
|
223
|
+
"name": "normalize_hook_kind",
|
|
224
|
+
"module": "src/ts/wc/jssm_hook_wc.ts"
|
|
225
|
+
}
|
|
226
|
+
},
|
|
227
|
+
{
|
|
228
|
+
"kind": "js",
|
|
229
|
+
"name": "parse_hook_element",
|
|
230
|
+
"declaration": {
|
|
231
|
+
"name": "parse_hook_element",
|
|
232
|
+
"module": "src/ts/wc/jssm_hook_wc.ts"
|
|
233
|
+
}
|
|
234
|
+
},
|
|
235
|
+
{
|
|
236
|
+
"kind": "js",
|
|
237
|
+
"name": "wrap_user_handler",
|
|
238
|
+
"declaration": {
|
|
239
|
+
"name": "wrap_user_handler",
|
|
240
|
+
"module": "src/ts/wc/jssm_hook_wc.ts"
|
|
241
|
+
}
|
|
242
|
+
},
|
|
243
|
+
{
|
|
244
|
+
"kind": "js",
|
|
245
|
+
"name": "build_hook_descriptor",
|
|
246
|
+
"declaration": {
|
|
247
|
+
"name": "build_hook_descriptor",
|
|
248
|
+
"module": "src/ts/wc/jssm_hook_wc.ts"
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
]
|
|
252
|
+
},
|
|
5
253
|
{
|
|
6
254
|
"kind": "javascript-module",
|
|
7
255
|
"path": "src/ts/wc/jssm_instance_wc.ts",
|
|
@@ -30,11 +278,11 @@
|
|
|
30
278
|
"description": "The current value of the host's `fsl` attribute (or property), or empty string."
|
|
31
279
|
}
|
|
32
280
|
],
|
|
33
|
-
"description": "Resolve a `<jssm-instance>`'s FSL source from the three legal channels:\nthe `fsl=\"\"` attribute, a child `<script type=\"text/fsl\">`, and the\nelement's own text content (after stripping the script and any\n`<jssm-*>` companion tags). Exactly one channel may be used; using\nnone or more than one is an error.\n\nPulled out as a pure function so it's testable without spinning up a\nLit element.\n\n```typescript\nconst div = document.createElement('div');\ndiv.setAttribute('fsl', 'Off -> On;');\nresolve_fsl_source(div as HTMLElement, 'Off -> On;');\n// => { fsl: 'Off -> On;', provided_count: 1, error: undefined }\n```"
|
|
281
|
+
"description": "Resolve a `<jssm-instance>`'s FSL source from the three legal channels:\r\nthe `fsl=\"\"` attribute, a child `<script type=\"text/fsl\">`, and the\r\nelement's own text content (after stripping the script and any\r\n`<jssm-*>` companion tags). Exactly one channel may be used; using\r\nnone or more than one is an error.\r\n\r\nPulled out as a pure function so it's testable without spinning up a\r\nLit element.\r\n\r\n```typescript\r\nconst div = document.createElement('div');\r\ndiv.setAttribute('fsl', 'Off -> On;');\r\nresolve_fsl_source(div as HTMLElement, 'Off -> On;');\r\n// => { fsl: 'Off -> On;', provided_count: 1, error: undefined }\r\n```"
|
|
34
282
|
},
|
|
35
283
|
{
|
|
36
284
|
"kind": "class",
|
|
37
|
-
"description": "Web component that owns a single `Machine<unknown>` constructed from an\nFSL source supplied via one of three mutually exclusive channels:\n\n 1. The `fsl=\"\"` attribute,\n 2. A child `<script type=\"text/fsl\">`,\n 3. The element's own text content (companion `<jssm-*>` children and\n any `<script type=\"text/fsl\">` are excluded from this channel).\n\nSupplying zero or more than one channel is a thrown error.\n\nOn every transition the component reflects machine state to its own\nattributes (`current-state`, `legal-actions`, `terminal`, `complete`)\nand sets a `--current-state` CSS custom property so consumer CSS can\nstyle by state without subclassing.",
|
|
285
|
+
"description": "Web component that owns a single `Machine<unknown>` constructed from an\r\nFSL source supplied via one of three mutually exclusive channels:\r\n\r\n 1. The `fsl=\"\"` attribute,\r\n 2. A child `<script type=\"text/fsl\">`,\r\n 3. The element's own text content (companion `<jssm-*>` children and\r\n any `<script type=\"text/fsl\">` are excluded from this channel).\r\n\r\nSupplying zero or more than one channel is a thrown error.\r\n\r\nOn every transition the component reflects machine state to its own\r\nattributes (`current-state`, `legal-actions`, `terminal`, `complete`)\r\nand sets a `--current-state` CSS custom property so consumer CSS can\r\nstyle by state without subclassing.",
|
|
38
286
|
"name": "JssmInstance",
|
|
39
287
|
"cssProperties": [
|
|
40
288
|
{
|
|
@@ -81,7 +329,7 @@
|
|
|
81
329
|
"text": "string"
|
|
82
330
|
},
|
|
83
331
|
"default": "''",
|
|
84
|
-
"description": "FSL source attribute. When non-empty, this is the sole channel\nsupplying the machine's source. Setting both this and a child\n`<script type=\"text/fsl\">` (or non-empty text content) is an error.",
|
|
332
|
+
"description": "FSL source attribute. When non-empty, this is the sole channel\r\nsupplying the machine's source. Setting both this and a child\r\n`<script type=\"text/fsl\">` (or non-empty text content) is an error.",
|
|
85
333
|
"attribute": "fsl"
|
|
86
334
|
},
|
|
87
335
|
{
|
|
@@ -92,7 +340,47 @@
|
|
|
92
340
|
},
|
|
93
341
|
"privacy": "private",
|
|
94
342
|
"default": "undefined",
|
|
95
|
-
"description": "The underlying machine instance, constructed at `connectedCallback`.\nExposed raw (not proxied) per the #639/#648 design decision so that\nconsumers can use the full Machine API directly.\n\nMarked optional because Lit will instantiate the element before\n`connectedCallback` runs; the instance is guaranteed present after\nconnection."
|
|
343
|
+
"description": "The underlying machine instance, constructed at `connectedCallback`.\r\nExposed raw (not proxied) per the #639/#648 design decision so that\r\nconsumers can use the full Machine API directly.\r\n\r\nMarked optional because Lit will instantiate the element before\r\n`connectedCallback` runs; the instance is guaranteed present after\r\nconnection."
|
|
344
|
+
},
|
|
345
|
+
{
|
|
346
|
+
"kind": "field",
|
|
347
|
+
"name": "registry",
|
|
348
|
+
"type": {
|
|
349
|
+
"text": "JssmHookRegistry"
|
|
350
|
+
},
|
|
351
|
+
"readonly": true,
|
|
352
|
+
"default": "new Map()",
|
|
353
|
+
"description": "Per-instance registry of named hook handlers consulted before\r\n`globalThis` when resolving `<jssm-hook handler=\"name\">`.\r\n\r\nInitialized to an empty `Map`; consumers may populate it before the\r\nelement connects to provide handlers without polluting global scope —\r\nuseful for module-scoped SPAs where strict CSP blocks inline-body hooks."
|
|
354
|
+
},
|
|
355
|
+
{
|
|
356
|
+
"kind": "field",
|
|
357
|
+
"name": "_installed_hooks",
|
|
358
|
+
"type": {
|
|
359
|
+
"text": "unknown[]"
|
|
360
|
+
},
|
|
361
|
+
"privacy": "private",
|
|
362
|
+
"default": "[]",
|
|
363
|
+
"description": "Descriptors for hooks this WC installed at connect time, used in\r\n`disconnectedCallback` to call `remove_hook` for each so the underlying\r\nmachine doesn't leak handlers when the element is detached.\r\n\r\nCaptured at install time because `remove_hook` matches by descriptor\r\nshape (not handler identity), and we need to record the wrapped handler\r\nwe passed to `set_hook` to undo the registration cleanly. Stored as\r\n`unknown[]` and cast at the call site because jssm's `HookDescription`\r\nis a discriminated union whose discriminator is only known at runtime."
|
|
364
|
+
},
|
|
365
|
+
{
|
|
366
|
+
"kind": "field",
|
|
367
|
+
"name": "_hook_debug_counter",
|
|
368
|
+
"type": {
|
|
369
|
+
"text": "number"
|
|
370
|
+
},
|
|
371
|
+
"privacy": "private",
|
|
372
|
+
"default": "0",
|
|
373
|
+
"description": "Counter used to give each compiled inline-body hook a unique debug id\r\nfor its `//# sourceURL=jssm-hook:N` annotation. Per-instance so that\r\nmultiple `<jssm-instance>` elements on a page don't share numbering."
|
|
374
|
+
},
|
|
375
|
+
{
|
|
376
|
+
"kind": "field",
|
|
377
|
+
"name": "_action_listeners",
|
|
378
|
+
"type": {
|
|
379
|
+
"text": "Array<{\r\n target : EventTarget;\r\n event : string;\r\n handler : EventListener;\r\n }>"
|
|
380
|
+
},
|
|
381
|
+
"privacy": "private",
|
|
382
|
+
"default": "[]",
|
|
383
|
+
"description": "Records every DOM listener installed by `<jssm-action>` / `data-jssm-action`\r\ndiscovery so disconnectedCallback can remove each one with the\r\nsame handler reference originally passed to `addEventListener`.\r\n\r\nListeners installed via the dedicated `<jssm-action>` tag form may target\r\nelements outside the host (its `selector` is resolved against the host,\r\nbut matching elements live in the document tree), so cleanup must be\r\nexplicit — relying on the host's GC is not sufficient."
|
|
96
384
|
},
|
|
97
385
|
{
|
|
98
386
|
"kind": "field",
|
|
@@ -128,7 +416,7 @@
|
|
|
128
416
|
"description": "Optional data payload to pass to the action."
|
|
129
417
|
}
|
|
130
418
|
],
|
|
131
|
-
"description": "Convenience wrapper for `machine.action(action, data)`.\nAfter the action, reflects updated state to host attributes and the\n`--current-state` CSS custom property, and requests a Lit update so\nthe state-specific `<slot name=\"state-...\">` can re-pick."
|
|
419
|
+
"description": "Convenience wrapper for `machine.action(action, data)`.\r\nAfter the action, reflects updated state to host attributes and the\r\n`--current-state` CSS custom property, and requests a Lit update so\r\nthe state-specific `<slot name=\"state-...\">` can re-pick."
|
|
132
420
|
},
|
|
133
421
|
{
|
|
134
422
|
"kind": "method",
|
|
@@ -138,7 +426,88 @@
|
|
|
138
426
|
"text": "string"
|
|
139
427
|
}
|
|
140
428
|
},
|
|
141
|
-
"description": "Convenience wrapper for `machine.state()`. Returns the current\nstate's name."
|
|
429
|
+
"description": "Convenience wrapper for `machine.state()`. Returns the current\r\nstate's name."
|
|
430
|
+
},
|
|
431
|
+
{
|
|
432
|
+
"kind": "method",
|
|
433
|
+
"name": "_install_declarative_hooks",
|
|
434
|
+
"privacy": "private",
|
|
435
|
+
"return": {
|
|
436
|
+
"type": {
|
|
437
|
+
"text": "void"
|
|
438
|
+
}
|
|
439
|
+
},
|
|
440
|
+
"description": "Discover every direct-child `<jssm-hook>` element and install each\r\nagainst the owned machine. Handlers are wrapped with the friendly-proxy\r\nadapter that lets user code write `m.data = ...` and return `false` to\r\ncancel — see make_hook_proxy and the issue (#641) doc-comment\r\nfor the full contract.\r\n\r\nDirect children only (the `:scope > jssm-hook` selector) so that nested\r\n`<jssm-instance>` elements don't have their child hooks installed on\r\nthe outer machine.\r\n\r\nTracks every installed descriptor in `_installed_hooks` so that\r\n`disconnectedCallback` can remove them on detach."
|
|
441
|
+
},
|
|
442
|
+
{
|
|
443
|
+
"kind": "method",
|
|
444
|
+
"name": "_hook_id_prefix",
|
|
445
|
+
"privacy": "private",
|
|
446
|
+
"return": {
|
|
447
|
+
"type": {
|
|
448
|
+
"text": "string"
|
|
449
|
+
}
|
|
450
|
+
},
|
|
451
|
+
"description": "Prefix used in synthetic `//# sourceURL=jssm-hook:<prefix><n>` annotations\r\nfor inline-body hooks compiled by this element. Includes the element's\r\n`id` when present so multi-instance pages can tell sources apart in\r\ndevtools."
|
|
452
|
+
},
|
|
453
|
+
{
|
|
454
|
+
"kind": "method",
|
|
455
|
+
"name": "_discover_jssm_actions",
|
|
456
|
+
"privacy": "private",
|
|
457
|
+
"return": {
|
|
458
|
+
"type": {
|
|
459
|
+
"text": "void"
|
|
460
|
+
}
|
|
461
|
+
},
|
|
462
|
+
"description": "Wire DOM events to machine actions, using the two declarative forms from\r\nissue #640:\r\n\r\n 1. Inline attribute form: every descendant of the host carrying a\r\n `data-jssm-action=\"<name>\"` attribute receives a listener on the\r\n event named by `data-jssm-event` (default `click`).\r\n 2. Dedicated tag form: each direct `<jssm-action>` child of the host\r\n supplies a CSS `selector` (scoped to the host), an `action`, and an\r\n optional `event` (default `click`); every matching descendant\r\n receives a listener configured by the tag's attributes.\r\n\r\nBoth forms support optional `from-state` guards (dispatch only when the\r\nmachine's current state matches), `from-property` data extraction (pass\r\nthe source element's named property as the action's data argument), and\r\n`prevent-default` / `stop-propagation` modifiers.\r\n\r\nEvery installed listener is recorded in _action_listeners so\r\ndisconnectedCallback can detach them cleanly."
|
|
463
|
+
},
|
|
464
|
+
{
|
|
465
|
+
"kind": "method",
|
|
466
|
+
"name": "_install_action_listener",
|
|
467
|
+
"privacy": "private",
|
|
468
|
+
"return": {
|
|
469
|
+
"type": {
|
|
470
|
+
"text": "void"
|
|
471
|
+
}
|
|
472
|
+
},
|
|
473
|
+
"parameters": [
|
|
474
|
+
{
|
|
475
|
+
"name": "config",
|
|
476
|
+
"type": {
|
|
477
|
+
"text": "{\r\n source : HTMLElement;\r\n event_name : string;\r\n action_name : string;\r\n from_state : string | undefined;\r\n from_property : string | undefined;\r\n prevent_default : boolean;\r\n stop_propagation : boolean;\r\n }"
|
|
478
|
+
},
|
|
479
|
+
"description": "Listener configuration."
|
|
480
|
+
},
|
|
481
|
+
{
|
|
482
|
+
"description": "Element to attach the listener to.",
|
|
483
|
+
"name": "config.source"
|
|
484
|
+
},
|
|
485
|
+
{
|
|
486
|
+
"description": "DOM event to listen for.",
|
|
487
|
+
"name": "config.event_name"
|
|
488
|
+
},
|
|
489
|
+
{
|
|
490
|
+
"description": "Action to dispatch on the machine.",
|
|
491
|
+
"name": "config.action_name"
|
|
492
|
+
},
|
|
493
|
+
{
|
|
494
|
+
"description": "If set, only fire when `machine.state() === from_state`.",
|
|
495
|
+
"name": "config.from_state"
|
|
496
|
+
},
|
|
497
|
+
{
|
|
498
|
+
"description": "If set, pass `source[from_property]` as the action's data argument.",
|
|
499
|
+
"name": "config.from_property"
|
|
500
|
+
},
|
|
501
|
+
{
|
|
502
|
+
"description": "If true, call `e.preventDefault()` before checking the guard.",
|
|
503
|
+
"name": "config.prevent_default"
|
|
504
|
+
},
|
|
505
|
+
{
|
|
506
|
+
"description": "If true, call `e.stopPropagation()` before checking the guard.",
|
|
507
|
+
"name": "config.stop_propagation"
|
|
508
|
+
}
|
|
509
|
+
],
|
|
510
|
+
"description": "Attach one DOM listener that translates a DOM event into a\r\n`machine.action(...)` call, honoring the configured modifiers. The\r\nlistener is recorded in _action_listeners so it can be removed\r\non disconnect."
|
|
142
511
|
},
|
|
143
512
|
{
|
|
144
513
|
"kind": "method",
|
|
@@ -149,7 +518,7 @@
|
|
|
149
518
|
"text": "void"
|
|
150
519
|
}
|
|
151
520
|
},
|
|
152
|
-
"description": "Reflect machine state onto host attributes and CSS custom properties.\nCalled after every transition and once during `connectedCallback`.\n\nMechanism 1 (#639): writes to host attributes.\nMechanism 3 (#639): writes to host inline-style custom properties."
|
|
521
|
+
"description": "Reflect machine state onto host attributes and CSS custom properties.\r\nCalled after every transition and once during `connectedCallback`.\r\n\r\nMechanism 1 (#639): writes to host attributes.\r\nMechanism 3 (#639): writes to host inline-style custom properties."
|
|
153
522
|
}
|
|
154
523
|
],
|
|
155
524
|
"attributes": [
|
|
@@ -159,7 +528,7 @@
|
|
|
159
528
|
"text": "string"
|
|
160
529
|
},
|
|
161
530
|
"default": "''",
|
|
162
|
-
"description": "FSL source attribute. When non-empty, this is the sole channel\nsupplying the machine's source. Setting both this and a child\n`<script type=\"text/fsl\">` (or non-empty text content) is an error.",
|
|
531
|
+
"description": "FSL source attribute. When non-empty, this is the sole channel\r\nsupplying the machine's source. Setting both this and a child\r\n`<script type=\"text/fsl\">` (or non-empty text content) is an error.",
|
|
163
532
|
"fieldName": "fsl"
|
|
164
533
|
}
|
|
165
534
|
],
|