jssm 5.137.0 → 5.139.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 +443 -32
- package/dist/cdn/instance.js +512 -53
- 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 +512 -53
- 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.139.0 at 5/28/2026, 8:04:13 AM
|
|
22
22
|
|
|
23
23
|
-->
|
|
24
|
-
# jssm 5.
|
|
24
|
+
# jssm 5.139.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,389 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,389 tests***, run 57,176 times.
|
|
418
418
|
|
|
419
|
-
- 5,
|
|
420
|
-
- 513 fuzz tests with 3.
|
|
421
|
-
- 5,
|
|
419
|
+
- 5,876 specs with 100.0% coverage
|
|
420
|
+
- 513 fuzz tests with 3.5% coverage
|
|
421
|
+
- 5,397 TypeScript lines - 1.2 tests per line, 10.6 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,10 +2,337 @@
|
|
|
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.\r\n\r\nThe context shape varies by hook kind (`from`/`to`/`action` may be absent\r\nfor transition-kind hooks), so this normalizes the shape via optional\r\nfields and exposes mutable `data` while keeping the rest read-only.\r\n\r\nThe `machine` parameter is used only for `state()`, so unit tests can\r\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.\r\n\r\nUses dynamic function construction — the same primitive browsers use\r\ninternally for `<a onclick=\"...\">` and `setTimeout(stringBody, ms)`.\r\nStrict CSP without `'unsafe-eval'` blocks this and the call will throw;\r\nconsumers should fall back to the `handler=\"name\"` form there.\r\n\r\nPrepends a `//# sourceURL=` comment so devtools surface a meaningful name\r\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\r\noptional in-WC registry, then `globalThis[name]`. Throws a clear error if\r\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\r\n`\"hook\"` when the attribute is absent. Throws on unknown kinds rather\r\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.\r\n\r\nValidates the mutual-exclusion rule between `handler=\"name\"` and inline\r\nbody, defaults `kind` to `\"hook\"`, resolves named handlers against the\r\noptional registry then `globalThis`, and compiles inline bodies via\r\ndynamic function construction. Conditional-required attributes (e.g.\r\n`from`/`to` for `kind=\"hook\"`) are NOT validated here — `set_hook` will\r\nthrow with its own clear errors on missing pieces, which keeps the\r\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\r\nsatisfied: the user gets a friendly proxy, the proxy's mutated `data`\r\nbecomes the `HookComplexResult.data`, and an explicit `false` return\r\ncancels the transition.\r\n\r\nAny non-`false` return — including `undefined`, `true`, or an arbitrary\r\nobject — allows the transition. This matches the contract spelled out\r\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}.\r\n * "
|
|
189
|
+
}
|
|
190
|
+
],
|
|
191
|
+
"description": "Build the typed descriptor object passed to `machine.set_hook` (and later\r\nto `machine.remove_hook` for cleanup) from a parsed JssmHookInstallSpec\r\nand the wrapped handler.\r\n\r\nFor kinds that need `from`/`to`/`action`, the descriptor includes those.\r\nMissing required keys produce `undefined` here; jssm's `set_hook` will\r\nsurface the error with its own clear message so we don't duplicate\r\nvalidation.\r\n\r\nReturn type is `unknown` because jssm's `HookDescription` is a\r\ndiscriminated union and our runtime-discriminator value can't be tracked\r\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",
|
|
8
256
|
"declarations": [
|
|
257
|
+
{
|
|
258
|
+
"kind": "variable",
|
|
259
|
+
"name": "JSSM_ON_EVENT_NAMES",
|
|
260
|
+
"default": "new Set<string>([ 'transition', 'rejection', 'action', 'entry', 'exit', 'terminal', 'complete', 'error', 'data-change', 'override', 'timeout', 'hook-registration', 'hook-removal' ])",
|
|
261
|
+
"description": "Allow-list of event names accepted by `<jssm-on event=\"...\">`. Must stay\r\nin sync with the `JssmEventName` union in `jssm_types.ts` (the library's\r\n`machine.on(...)` event API, added in #638). Validating here gives the\r\ndeclarative wiring a clear \"unknown event name\" error at the WC layer\r\ninstead of relying on a downstream library throw whose message would\r\nmention `machine.on(...)` rather than the offending tag."
|
|
262
|
+
},
|
|
263
|
+
{
|
|
264
|
+
"kind": "function",
|
|
265
|
+
"name": "parse_jssm_on_element",
|
|
266
|
+
"return": {
|
|
267
|
+
"type": {
|
|
268
|
+
"text": ""
|
|
269
|
+
}
|
|
270
|
+
},
|
|
271
|
+
"parameters": [
|
|
272
|
+
{
|
|
273
|
+
"name": "el",
|
|
274
|
+
"type": {
|
|
275
|
+
"text": "HTMLElement"
|
|
276
|
+
},
|
|
277
|
+
"description": "The `<jssm-on>` element to parse."
|
|
278
|
+
}
|
|
279
|
+
],
|
|
280
|
+
"description": "Parse a `<jssm-on>` element into a validated ParsedJssmOn\r\nrecord. Centralized so the declarative-tag logic is testable without\r\nspinning up the full `<jssm-instance>` lifecycle.\r\n\r\nValidation rules (per #643):\r\n - `event` is required and must be in JSSM_ON_EVENT_NAMES.\r\n - Either a `handler=\"name\"` attribute or non-empty `textContent`\r\n must be supplied, but not both.\r\n - `state` is only meaningful for `event=\"entry\"` / `event=\"exit\"`;\r\n it's silently ignored on other events.\r\n - `from` / `to` are only meaningful for `event=\"transition\"`; they\r\n are silently ignored on other events. Both → AND (a specific\r\n edge). Neither → unfiltered.\r\n\r\n```typescript\r\nconst el = document.createElement('jssm-on');\r\nel.setAttribute('event', 'entry');\r\nel.setAttribute('state', 'paid');\r\nel.setAttribute('handler', 'onPaid');\r\nparse_jssm_on_element(el);\r\n// => { event: 'entry', handler_name: 'onPaid', inline_body: undefined,\r\n// once: false, name: undefined, filter: { state: 'paid' } }\r\n```"
|
|
281
|
+
},
|
|
282
|
+
{
|
|
283
|
+
"kind": "variable",
|
|
284
|
+
"name": "jssm_handler_registry",
|
|
285
|
+
"type": {
|
|
286
|
+
"text": "Map<string, (...args: unknown[]) => unknown>"
|
|
287
|
+
},
|
|
288
|
+
"default": "new Map()",
|
|
289
|
+
"description": "Optional global registry that `<jssm-on>` (and, later, `<jssm-hook>`)\r\nconsult first when resolving a `handler=\"name\"` attribute. Consumers\r\nregister named handlers here in a strict-CSP environment where a stray\r\n`globalThis[name]` isn't acceptable. Falls through to `globalThis[name]`\r\nif the registry has no entry.\r\n\r\nIntentionally a `Map<string, Function>` rather than a class with methods,\r\nso consumers can use any of `.get`, `.set`, `.delete`, `.clear` directly\r\nwithout a thin wrapper API."
|
|
290
|
+
},
|
|
291
|
+
{
|
|
292
|
+
"kind": "function",
|
|
293
|
+
"name": "resolve_named_handler",
|
|
294
|
+
"return": {
|
|
295
|
+
"type": {
|
|
296
|
+
"text": ""
|
|
297
|
+
}
|
|
298
|
+
},
|
|
299
|
+
"parameters": [
|
|
300
|
+
{
|
|
301
|
+
"name": "name",
|
|
302
|
+
"type": {
|
|
303
|
+
"text": "string"
|
|
304
|
+
},
|
|
305
|
+
"description": "The handler name as supplied by `handler=\"...\"`."
|
|
306
|
+
}
|
|
307
|
+
],
|
|
308
|
+
"description": "Resolve a named handler from the registry, then from `globalThis`.\r\nThrows if neither lookup finds a function — earlier failure here is\r\nbetter than a delayed \"is not a function\" at first event delivery."
|
|
309
|
+
},
|
|
310
|
+
{
|
|
311
|
+
"kind": "function",
|
|
312
|
+
"name": "compile_inline_body",
|
|
313
|
+
"return": {
|
|
314
|
+
"type": {
|
|
315
|
+
"text": ""
|
|
316
|
+
}
|
|
317
|
+
},
|
|
318
|
+
"parameters": [
|
|
319
|
+
{
|
|
320
|
+
"name": "body",
|
|
321
|
+
"type": {
|
|
322
|
+
"text": "string"
|
|
323
|
+
},
|
|
324
|
+
"description": "The inline JS body (function body, not full function)."
|
|
325
|
+
},
|
|
326
|
+
{
|
|
327
|
+
"name": "source_id",
|
|
328
|
+
"type": {
|
|
329
|
+
"text": "string"
|
|
330
|
+
},
|
|
331
|
+
"description": "A short identifier for the sourceURL pragma."
|
|
332
|
+
}
|
|
333
|
+
],
|
|
334
|
+
"description": "Compile an inline-body string into a handler function whose single\r\nparameter is `e` (the event detail object). Uses the same dynamic\r\n`Function(...)` constructor that browsers use internally for inline\r\nevent-handler attributes such as `<a onclick=\"...\">`; the input here\r\nis consumer-authored markup, never network data, so the surface is\r\nexactly that of an inline event-handler attribute and the same CSP\r\ncaveats apply (strict CSP without `'unsafe-eval'` blocks it). A\r\n`//# sourceURL=jssm-on:N` pragma is appended so devtools stack traces\r\npoint at a meaningful name."
|
|
335
|
+
},
|
|
9
336
|
{
|
|
10
337
|
"kind": "function",
|
|
11
338
|
"name": "resolve_fsl_source",
|
|
@@ -94,6 +421,46 @@
|
|
|
94
421
|
"default": "undefined",
|
|
95
422
|
"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."
|
|
96
423
|
},
|
|
424
|
+
{
|
|
425
|
+
"kind": "field",
|
|
426
|
+
"name": "_on_unsubscribes",
|
|
427
|
+
"type": {
|
|
428
|
+
"text": "Array<() => void>"
|
|
429
|
+
},
|
|
430
|
+
"privacy": "private",
|
|
431
|
+
"default": "[]",
|
|
432
|
+
"description": "Unsubscribe callbacks for every `machine.on(...)` / `machine.once(...)`\r\nsubscription installed from a `<jssm-on>` child during\r\n`connectedCallback`. Walked in `disconnectedCallback` so a removed\r\n`<jssm-instance>` doesn't leave dangling handlers on its (now-orphan)\r\nmachine. Array (insertion order) rather than Set so cleanup order is\r\ndeterministic and easy to reason about."
|
|
433
|
+
},
|
|
434
|
+
{
|
|
435
|
+
"kind": "field",
|
|
436
|
+
"name": "registry",
|
|
437
|
+
"type": {
|
|
438
|
+
"text": "JssmHookRegistry"
|
|
439
|
+
},
|
|
440
|
+
"readonly": true,
|
|
441
|
+
"default": "new Map()",
|
|
442
|
+
"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."
|
|
443
|
+
},
|
|
444
|
+
{
|
|
445
|
+
"kind": "field",
|
|
446
|
+
"name": "_installed_hooks",
|
|
447
|
+
"type": {
|
|
448
|
+
"text": "unknown[]"
|
|
449
|
+
},
|
|
450
|
+
"privacy": "private",
|
|
451
|
+
"default": "[]",
|
|
452
|
+
"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."
|
|
453
|
+
},
|
|
454
|
+
{
|
|
455
|
+
"kind": "field",
|
|
456
|
+
"name": "_hook_debug_counter",
|
|
457
|
+
"type": {
|
|
458
|
+
"text": "number"
|
|
459
|
+
},
|
|
460
|
+
"privacy": "private",
|
|
461
|
+
"default": "0",
|
|
462
|
+
"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."
|
|
463
|
+
},
|
|
97
464
|
{
|
|
98
465
|
"kind": "field",
|
|
99
466
|
"name": "_action_listeners",
|
|
@@ -150,6 +517,39 @@
|
|
|
150
517
|
},
|
|
151
518
|
"description": "Convenience wrapper for `machine.state()`. Returns the current\r\nstate's name."
|
|
152
519
|
},
|
|
520
|
+
{
|
|
521
|
+
"kind": "method",
|
|
522
|
+
"name": "_install_jssm_on_children",
|
|
523
|
+
"privacy": "private",
|
|
524
|
+
"return": {
|
|
525
|
+
"type": {
|
|
526
|
+
"text": "void"
|
|
527
|
+
}
|
|
528
|
+
},
|
|
529
|
+
"description": "Discover direct-child `<jssm-on>` elements and install their\r\nsubscriptions on the owned machine. Per #643:\r\n\r\n- Direct children only (`:scope > jssm-on`). Deeper nesting is the\r\n responsibility of a future MutationObserver-driven v2.\r\n- Each `<jssm-on>` is parsed by parse_jssm_on_element, which\r\n enforces the form / event-name / filter rules.\r\n- Handlers come from resolve_named_handler (form A) or\r\n compile_inline_body (form B), and the result is installed\r\n via `machine.on(...)` or `machine.once(...)` depending on the\r\n element's `once` attribute.\r\n- Every returned unsubscribe is tracked in _on_unsubscribes\r\n so disconnectedCallback can release them all.\r\n\r\nCalled once from `connectedCallback` after the machine has been\r\nconstructed. Any error thrown by parsing or resolution propagates\r\nout so it surfaces via jsdom's error event (matching the rest of\r\n`<jssm-instance>`'s \"fail loud at connect\" policy)."
|
|
530
|
+
},
|
|
531
|
+
{
|
|
532
|
+
"kind": "method",
|
|
533
|
+
"name": "_install_declarative_hooks",
|
|
534
|
+
"privacy": "private",
|
|
535
|
+
"return": {
|
|
536
|
+
"type": {
|
|
537
|
+
"text": "void"
|
|
538
|
+
}
|
|
539
|
+
},
|
|
540
|
+
"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."
|
|
541
|
+
},
|
|
542
|
+
{
|
|
543
|
+
"kind": "method",
|
|
544
|
+
"name": "_hook_id_prefix",
|
|
545
|
+
"privacy": "private",
|
|
546
|
+
"return": {
|
|
547
|
+
"type": {
|
|
548
|
+
"text": "string"
|
|
549
|
+
}
|
|
550
|
+
},
|
|
551
|
+
"description": "Prefix used in synthetic `//# sourceURL=jssm-hook:<prefix><n>` annotations\r\nfor inline-body hooks compiled by this element."
|
|
552
|
+
},
|
|
153
553
|
{
|
|
154
554
|
"kind": "method",
|
|
155
555
|
"name": "_discover_jssm_actions",
|
|
@@ -159,7 +559,7 @@
|
|
|
159
559
|
"text": "void"
|
|
160
560
|
}
|
|
161
561
|
},
|
|
162
|
-
"description": "Wire DOM events to machine actions, using the two declarative forms from\r\nissue #640
|
|
562
|
+
"description": "Wire DOM events to machine actions, using the two declarative forms from\r\nissue #640. Both forms support optional `from-state` guards,\r\n`from-property` data extraction, and `prevent-default` /\r\n`stop-propagation` modifiers."
|
|
163
563
|
},
|
|
164
564
|
{
|
|
165
565
|
"kind": "method",
|
|
@@ -175,39 +575,10 @@
|
|
|
175
575
|
"name": "config",
|
|
176
576
|
"type": {
|
|
177
577
|
"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 }"
|
|
178
|
-
}
|
|
179
|
-
"description": "Listener configuration."
|
|
180
|
-
},
|
|
181
|
-
{
|
|
182
|
-
"description": "Element to attach the listener to.",
|
|
183
|
-
"name": "config.source"
|
|
184
|
-
},
|
|
185
|
-
{
|
|
186
|
-
"description": "DOM event to listen for.",
|
|
187
|
-
"name": "config.event_name"
|
|
188
|
-
},
|
|
189
|
-
{
|
|
190
|
-
"description": "Action to dispatch on the machine.",
|
|
191
|
-
"name": "config.action_name"
|
|
192
|
-
},
|
|
193
|
-
{
|
|
194
|
-
"description": "If set, only fire when `machine.state() === from_state`.",
|
|
195
|
-
"name": "config.from_state"
|
|
196
|
-
},
|
|
197
|
-
{
|
|
198
|
-
"description": "If set, pass `source[from_property]` as the action's data argument.",
|
|
199
|
-
"name": "config.from_property"
|
|
200
|
-
},
|
|
201
|
-
{
|
|
202
|
-
"description": "If true, call `e.preventDefault()` before checking the guard.",
|
|
203
|
-
"name": "config.prevent_default"
|
|
204
|
-
},
|
|
205
|
-
{
|
|
206
|
-
"description": "If true, call `e.stopPropagation()` before checking the guard.",
|
|
207
|
-
"name": "config.stop_propagation"
|
|
578
|
+
}
|
|
208
579
|
}
|
|
209
580
|
],
|
|
210
|
-
"description": "Attach one DOM listener that translates a DOM event into a\r\n`machine.action(...)` call, honoring the configured modifiers.
|
|
581
|
+
"description": "Attach one DOM listener that translates a DOM event into a\r\n`machine.action(...)` call, honoring the configured modifiers."
|
|
211
582
|
},
|
|
212
583
|
{
|
|
213
584
|
"kind": "method",
|
|
@@ -241,6 +612,46 @@
|
|
|
241
612
|
}
|
|
242
613
|
],
|
|
243
614
|
"exports": [
|
|
615
|
+
{
|
|
616
|
+
"kind": "js",
|
|
617
|
+
"name": "JSSM_ON_EVENT_NAMES",
|
|
618
|
+
"declaration": {
|
|
619
|
+
"name": "JSSM_ON_EVENT_NAMES",
|
|
620
|
+
"module": "src/ts/wc/jssm_instance_wc.ts"
|
|
621
|
+
}
|
|
622
|
+
},
|
|
623
|
+
{
|
|
624
|
+
"kind": "js",
|
|
625
|
+
"name": "parse_jssm_on_element",
|
|
626
|
+
"declaration": {
|
|
627
|
+
"name": "parse_jssm_on_element",
|
|
628
|
+
"module": "src/ts/wc/jssm_instance_wc.ts"
|
|
629
|
+
}
|
|
630
|
+
},
|
|
631
|
+
{
|
|
632
|
+
"kind": "js",
|
|
633
|
+
"name": "jssm_handler_registry",
|
|
634
|
+
"declaration": {
|
|
635
|
+
"name": "jssm_handler_registry",
|
|
636
|
+
"module": "src/ts/wc/jssm_instance_wc.ts"
|
|
637
|
+
}
|
|
638
|
+
},
|
|
639
|
+
{
|
|
640
|
+
"kind": "js",
|
|
641
|
+
"name": "resolve_named_handler",
|
|
642
|
+
"declaration": {
|
|
643
|
+
"name": "resolve_named_handler",
|
|
644
|
+
"module": "src/ts/wc/jssm_instance_wc.ts"
|
|
645
|
+
}
|
|
646
|
+
},
|
|
647
|
+
{
|
|
648
|
+
"kind": "js",
|
|
649
|
+
"name": "compile_inline_body",
|
|
650
|
+
"declaration": {
|
|
651
|
+
"name": "compile_inline_body",
|
|
652
|
+
"module": "src/ts/wc/jssm_instance_wc.ts"
|
|
653
|
+
}
|
|
654
|
+
},
|
|
244
655
|
{
|
|
245
656
|
"kind": "js",
|
|
246
657
|
"name": "resolve_fsl_source",
|