jssm 5.141.13 → 5.142.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 +9 -9
- package/custom-elements.json +188 -48
- package/dist/cdn/instance.js +104 -32
- package/dist/cdn/viz.js +90 -41
- package/dist/cli/fsl-render.cjs +1 -1
- package/dist/cli/fsl.cjs +1 -1
- package/dist/deno/README.md +9 -9
- 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.define.js +54 -4
- package/dist/wc/instance.js +73 -29
- package/dist/wc/viz.define.js +49 -18
- package/dist/wc/viz.js +60 -22
- package/package.json +4 -1
package/dist/cdn/instance.js
CHANGED
|
@@ -21430,7 +21430,7 @@ var constants = /*#__PURE__*/Object.freeze({
|
|
|
21430
21430
|
* Useful for runtime diagnostics and for embedding in serialized machine
|
|
21431
21431
|
* snapshots so that deserializers can detect version-skew.
|
|
21432
21432
|
*/
|
|
21433
|
-
const version = "5.
|
|
21433
|
+
const version = "5.142.0";
|
|
21434
21434
|
|
|
21435
21435
|
// whargarbl lots of these return arrays could/should be sets
|
|
21436
21436
|
const { state_name_chars, state_name_first_chars, action_label_chars } = constants;
|
|
@@ -25342,6 +25342,74 @@ function abstract_everything_hook_step(maybe_hook, hook_args) {
|
|
|
25342
25342
|
}
|
|
25343
25343
|
}
|
|
25344
25344
|
|
|
25345
|
+
/**
|
|
25346
|
+
* Shared helpers for the dual-prefix (`fsl-` canonical, `jssm-` synonym)
|
|
25347
|
+
* web-component naming convention. Centralizes the "match either prefix"
|
|
25348
|
+
* rule so it lives in exactly one place.
|
|
25349
|
+
*/
|
|
25350
|
+
/**
|
|
25351
|
+
* Returns true when `tag_name` is exactly `fsl-<suffix>` or `jssm-<suffix>`
|
|
25352
|
+
* (case-insensitive).
|
|
25353
|
+
*
|
|
25354
|
+
* @param tag_name - The element tag name to test (e.g. `"FSL-VIZ"`, `"jssm-viz"`).
|
|
25355
|
+
* @param suffix - The suffix to match after the prefix (e.g. `"viz"`).
|
|
25356
|
+
* @returns `true` when `tag_name` is `fsl-<suffix>` or `jssm-<suffix>`.
|
|
25357
|
+
*
|
|
25358
|
+
* @example
|
|
25359
|
+
* wc_suffix_matches('FSL-VIZ', 'viz'); // true
|
|
25360
|
+
* wc_suffix_matches('jssm-viz', 'viz'); // true
|
|
25361
|
+
* wc_suffix_matches('div', 'viz'); // false
|
|
25362
|
+
* wc_suffix_matches('fsl-vizard', 'viz'); // false — suffix must match exactly
|
|
25363
|
+
*/
|
|
25364
|
+
function wc_suffix_matches(tag_name, suffix) {
|
|
25365
|
+
const lower = tag_name.toLowerCase();
|
|
25366
|
+
return lower === `fsl-${suffix}` || lower === `jssm-${suffix}`;
|
|
25367
|
+
}
|
|
25368
|
+
/**
|
|
25369
|
+
* Returns the nearest ancestor of `el` (or `el` itself) whose tag is
|
|
25370
|
+
* `fsl-<suffix>` or `jssm-<suffix>`, or `null` if none exists.
|
|
25371
|
+
*
|
|
25372
|
+
* @param el - The element to start the search from.
|
|
25373
|
+
* @param suffix - The suffix to match (e.g. `"instance"`).
|
|
25374
|
+
* @returns The closest matching ancestor element, or `null`.
|
|
25375
|
+
*
|
|
25376
|
+
* @example
|
|
25377
|
+
* // <fsl-instance><div id="k"></div></fsl-instance>
|
|
25378
|
+
* closest_wc(document.getElementById('k'), 'instance'); // <fsl-instance>
|
|
25379
|
+
*
|
|
25380
|
+
* @see wc_suffix_matches
|
|
25381
|
+
*/
|
|
25382
|
+
function closest_wc(el, suffix) {
|
|
25383
|
+
return el.closest(`fsl-${suffix}, jssm-${suffix}`);
|
|
25384
|
+
}
|
|
25385
|
+
/**
|
|
25386
|
+
* Registers a canonical custom-element tag and its synonym tag.
|
|
25387
|
+
*
|
|
25388
|
+
* `customElements.define` requires a distinct constructor per tag name, so
|
|
25389
|
+
* callers pass the canonical class and a thin subclass for the synonym.
|
|
25390
|
+
* The function is idempotent: if either tag is already registered it skips
|
|
25391
|
+
* that `define` call rather than throwing.
|
|
25392
|
+
*
|
|
25393
|
+
* @param canonical_tag - The primary tag name (e.g. `"fsl-instance"`).
|
|
25394
|
+
* @param synonym_tag - The alias tag name (e.g. `"jssm-instance"`).
|
|
25395
|
+
* @param CanonicalClass - Constructor to register under `canonical_tag`.
|
|
25396
|
+
* @param SynonymClass - Constructor to register under `synonym_tag`
|
|
25397
|
+
* (must be a distinct class from `CanonicalClass`).
|
|
25398
|
+
*
|
|
25399
|
+
* @example
|
|
25400
|
+
* class FslInstance extends HTMLElement {}
|
|
25401
|
+
* class JssmInstance extends FslInstance {}
|
|
25402
|
+
* define_with_synonym('fsl-instance', 'jssm-instance', FslInstance, JssmInstance);
|
|
25403
|
+
*
|
|
25404
|
+
* @see closest_wc
|
|
25405
|
+
*/
|
|
25406
|
+
function define_with_synonym(canonical_tag, synonym_tag, CanonicalClass, SynonymClass) {
|
|
25407
|
+
if (!customElements.get(canonical_tag))
|
|
25408
|
+
customElements.define(canonical_tag, CanonicalClass);
|
|
25409
|
+
if (!customElements.get(synonym_tag))
|
|
25410
|
+
customElements.define(synonym_tag, SynonymClass);
|
|
25411
|
+
}
|
|
25412
|
+
|
|
25345
25413
|
/**
|
|
25346
25414
|
* Walk a dotted path into a value. Used by the `data.path.to.field`
|
|
25347
25415
|
* variant of {@link resolve_binding}. Returns `undefined` whenever the
|
|
@@ -25505,12 +25573,13 @@ function install_bindings(host, machine) {
|
|
|
25505
25573
|
apply();
|
|
25506
25574
|
unsubs.push(machine.on('transition', apply));
|
|
25507
25575
|
}
|
|
25508
|
-
// Form 2: dedicated `<jssm-bind>` configuration tags. Only
|
|
25509
|
-
// children are considered configuration tags for THIS host — nested
|
|
25510
|
-
// `<jssm-instance>` children would have their own
|
|
25511
|
-
// their own component.
|
|
25512
|
-
const
|
|
25513
|
-
|
|
25576
|
+
// Form 2: dedicated `<fsl-bind>` / `<jssm-bind>` configuration tags. Only
|
|
25577
|
+
// direct children are considered configuration tags for THIS host — nested
|
|
25578
|
+
// `<fsl-instance>` / `<jssm-instance>` children would have their own
|
|
25579
|
+
// bindings handled by their own component.
|
|
25580
|
+
const all_direct = host.querySelectorAll(':scope > *');
|
|
25581
|
+
const config_tags = Array.from(all_direct).filter(el => wc_suffix_matches(el.tagName, 'bind'));
|
|
25582
|
+
for (const tag of config_tags) {
|
|
25514
25583
|
const selector = tag.getAttribute('selector');
|
|
25515
25584
|
const expr = tag.getAttribute('source');
|
|
25516
25585
|
const target = (_b = tag.getAttribute('target')) !== null && _b !== void 0 ? _b : 'textContent';
|
|
@@ -25532,22 +25601,22 @@ function install_bindings(host, machine) {
|
|
|
25532
25601
|
return unsubs;
|
|
25533
25602
|
}
|
|
25534
25603
|
/**
|
|
25535
|
-
* `<jssm-bind>` configuration tag. The element itself is
|
|
25536
|
-
* it carries `selector`, `source`, and optional `target`
|
|
25537
|
-
* that the parent `<
|
|
25604
|
+
* `<fsl-bind>` / `<jssm-bind>` configuration tag. The element itself is
|
|
25605
|
+
* invisible — it carries `selector`, `source`, and optional `target`
|
|
25606
|
+
* attributes that the parent `<fsl-instance>` reads during its connection
|
|
25538
25607
|
* lifecycle to wire up a machine-to-DOM binding.
|
|
25539
25608
|
*
|
|
25540
25609
|
* Registering it as a `LitElement` (rather than leaving it as a generic
|
|
25541
25610
|
* unknown tag) gives it a stable upgrade timing, a `display: none`
|
|
25542
25611
|
* default style, and a proper place in the custom-elements registry so
|
|
25543
|
-
* `customElements.get('
|
|
25612
|
+
* `customElements.get('fsl-bind')` resolves.
|
|
25544
25613
|
*
|
|
25545
|
-
* @element
|
|
25614
|
+
* @element fsl-bind
|
|
25546
25615
|
* @attribute selector - CSS selector for the target element(s), scoped to the host.
|
|
25547
25616
|
* @attribute source - Binding expression (see {@link resolve_binding}).
|
|
25548
25617
|
* @attribute target - Target property name; defaults to `textContent`.
|
|
25549
25618
|
*/
|
|
25550
|
-
class
|
|
25619
|
+
class FslBind extends i {
|
|
25551
25620
|
/**
|
|
25552
25621
|
* No-op render. The tag's purpose is purely declarative
|
|
25553
25622
|
* configuration; it must not contribute any DOM to the page.
|
|
@@ -25556,7 +25625,7 @@ class JssmBind extends i {
|
|
|
25556
25625
|
return null;
|
|
25557
25626
|
}
|
|
25558
25627
|
}
|
|
25559
|
-
|
|
25628
|
+
FslBind.styles = i$3 `:host { display: none; }`;
|
|
25560
25629
|
|
|
25561
25630
|
const VALID_KINDS = new Set([
|
|
25562
25631
|
'hook',
|
|
@@ -25974,9 +26043,10 @@ function resolve_fsl_source(host, fsl_attr) {
|
|
|
25974
26043
|
const clone = host.cloneNode(true);
|
|
25975
26044
|
// Drop every script tag (any type — we only want raw text FSL here).
|
|
25976
26045
|
clone.querySelectorAll('script').forEach(n => n.remove());
|
|
25977
|
-
// Drop every <jssm-*> companion tag (e.g. <
|
|
26046
|
+
// Drop every <fsl-*> or <jssm-*> companion tag (e.g. <fsl-hook>, <jssm-on>, etc.).
|
|
25978
26047
|
clone.querySelectorAll('*').forEach(n => {
|
|
25979
|
-
|
|
26048
|
+
const t = n.tagName.toLowerCase();
|
|
26049
|
+
if (t.startsWith('fsl-') || t.startsWith('jssm-')) {
|
|
25980
26050
|
n.remove();
|
|
25981
26051
|
}
|
|
25982
26052
|
});
|
|
@@ -26017,7 +26087,7 @@ function resolve_fsl_source(host, fsl_attr) {
|
|
|
26017
26087
|
* and sets a `--current-state` CSS custom property so consumer CSS can
|
|
26018
26088
|
* style by state without subclassing.
|
|
26019
26089
|
*
|
|
26020
|
-
* @element
|
|
26090
|
+
* @element fsl-instance
|
|
26021
26091
|
* @cssproperty [--current-state] - The machine's current state name as a CSS string token.
|
|
26022
26092
|
* @slot title - Heading area for the instance.
|
|
26023
26093
|
* @slot viz - Visualization slot; fallback is a placeholder string.
|
|
@@ -26027,7 +26097,7 @@ function resolve_fsl_source(host, fsl_attr) {
|
|
|
26027
26097
|
* @slot info-panel - Slot for an info / status panel.
|
|
26028
26098
|
* @slot footer - Footer slot.
|
|
26029
26099
|
*/
|
|
26030
|
-
class
|
|
26100
|
+
class FslInstance extends i {
|
|
26031
26101
|
constructor() {
|
|
26032
26102
|
super(...arguments);
|
|
26033
26103
|
/**
|
|
@@ -26047,7 +26117,7 @@ class JssmInstance extends i {
|
|
|
26047
26117
|
*/
|
|
26048
26118
|
this._machine = undefined;
|
|
26049
26119
|
/**
|
|
26050
|
-
* Live unsubscribe callbacks for #645 `<
|
|
26120
|
+
* Live unsubscribe callbacks for #645 `<fsl-bind>` / `data-jssm-bind`
|
|
26051
26121
|
* projections. Every entry must be invoked exactly once during
|
|
26052
26122
|
* {@link disconnectedCallback}.
|
|
26053
26123
|
*/
|
|
@@ -26060,7 +26130,8 @@ class JssmInstance extends i {
|
|
|
26060
26130
|
this._on_unsubscribes = [];
|
|
26061
26131
|
/**
|
|
26062
26132
|
* Per-instance registry of named hook handlers consulted before
|
|
26063
|
-
* `globalThis` when resolving `<
|
|
26133
|
+
* `globalThis` when resolving `<fsl-hook handler="name">` /
|
|
26134
|
+
* `<jssm-hook handler="name">`.
|
|
26064
26135
|
*/
|
|
26065
26136
|
this.registry = new Map();
|
|
26066
26137
|
/**
|
|
@@ -26083,7 +26154,7 @@ class JssmInstance extends i {
|
|
|
26083
26154
|
*/
|
|
26084
26155
|
get machine() {
|
|
26085
26156
|
if (this._machine === undefined) {
|
|
26086
|
-
throw new Error('
|
|
26157
|
+
throw new Error('fsl-instance: machine accessed before connection');
|
|
26087
26158
|
}
|
|
26088
26159
|
return this._machine;
|
|
26089
26160
|
}
|
|
@@ -26126,7 +26197,7 @@ class JssmInstance extends i {
|
|
|
26126
26197
|
// Step 1: resolve FSL source.
|
|
26127
26198
|
const resolved = resolve_fsl_source(this, this.fsl);
|
|
26128
26199
|
if (resolved.error !== undefined) {
|
|
26129
|
-
throw new Error(`
|
|
26200
|
+
throw new Error(`fsl-instance: ${resolved.error}`);
|
|
26130
26201
|
}
|
|
26131
26202
|
// Step 2: construct the machine.
|
|
26132
26203
|
// (The resolver guarantees `fsl` is a non-empty string when error is undefined.)
|
|
@@ -26171,7 +26242,7 @@ class JssmInstance extends i {
|
|
|
26171
26242
|
*/
|
|
26172
26243
|
_install_jssm_on_children() {
|
|
26173
26244
|
const machine = this._machine;
|
|
26174
|
-
const on_nodes = this.querySelectorAll(':scope > jssm-on');
|
|
26245
|
+
const on_nodes = this.querySelectorAll(':scope > fsl-on, :scope > jssm-on');
|
|
26175
26246
|
let index = 0;
|
|
26176
26247
|
for (const el of Array.from(on_nodes)) {
|
|
26177
26248
|
index += 1;
|
|
@@ -26199,7 +26270,7 @@ class JssmInstance extends i {
|
|
|
26199
26270
|
*/
|
|
26200
26271
|
_install_declarative_hooks() {
|
|
26201
26272
|
const machine = this._machine;
|
|
26202
|
-
const hook_els = this.querySelectorAll(':scope > jssm-hook');
|
|
26273
|
+
const hook_els = this.querySelectorAll(':scope > fsl-hook, :scope > jssm-hook');
|
|
26203
26274
|
for (const el of Array.from(hook_els)) {
|
|
26204
26275
|
const debug_id = `${this._hook_id_prefix()}${++this._hook_debug_counter}`;
|
|
26205
26276
|
const spec = parse_hook_element(el, debug_id, this.registry);
|
|
@@ -26260,7 +26331,7 @@ class JssmInstance extends i {
|
|
|
26260
26331
|
*/
|
|
26261
26332
|
_discover_jssm_actions() {
|
|
26262
26333
|
var _a, _b, _c, _d;
|
|
26263
|
-
const inline_targets = Array.from(this.querySelectorAll('[data-jssm-action]')).filter(el => el
|
|
26334
|
+
const inline_targets = Array.from(this.querySelectorAll('[data-jssm-action]')).filter(el => closest_wc(el, 'action') === null);
|
|
26264
26335
|
for (const el of inline_targets) {
|
|
26265
26336
|
this._install_action_listener({
|
|
26266
26337
|
source: el,
|
|
@@ -26272,7 +26343,7 @@ class JssmInstance extends i {
|
|
|
26272
26343
|
stop_propagation: 'jssmStopPropagation' in el.dataset,
|
|
26273
26344
|
});
|
|
26274
26345
|
}
|
|
26275
|
-
const tags = this.querySelectorAll(':scope > jssm-action');
|
|
26346
|
+
const tags = this.querySelectorAll(':scope > fsl-action, :scope > jssm-action');
|
|
26276
26347
|
for (const tag of Array.from(tags)) {
|
|
26277
26348
|
const selector = tag.getAttribute('selector');
|
|
26278
26349
|
const action_name = tag.getAttribute('action');
|
|
@@ -26363,7 +26434,7 @@ class JssmInstance extends i {
|
|
|
26363
26434
|
return b `
|
|
26364
26435
|
<div class="container">
|
|
26365
26436
|
<header>
|
|
26366
|
-
<slot name="title"><span class="placeholder">
|
|
26437
|
+
<slot name="title"><span class="placeholder">fsl-instance</span></slot>
|
|
26367
26438
|
</header>
|
|
26368
26439
|
<section class="viz">
|
|
26369
26440
|
<slot name="viz"><span class="placeholder">no viz configured</span></slot>
|
|
@@ -26390,7 +26461,7 @@ class JssmInstance extends i {
|
|
|
26390
26461
|
`;
|
|
26391
26462
|
}
|
|
26392
26463
|
}
|
|
26393
|
-
|
|
26464
|
+
FslInstance.styles = i$3 `
|
|
26394
26465
|
:host {
|
|
26395
26466
|
display: block;
|
|
26396
26467
|
}
|
|
@@ -26409,12 +26480,13 @@ JssmInstance.styles = i$3 `
|
|
|
26409
26480
|
* survives the future companion-tag work without colliding with
|
|
26410
26481
|
* dynamically declared attributes.
|
|
26411
26482
|
*/
|
|
26412
|
-
|
|
26483
|
+
FslInstance.properties = {
|
|
26413
26484
|
fsl: { type: String, reflect: false },
|
|
26414
26485
|
};
|
|
26415
26486
|
|
|
26416
|
-
|
|
26417
|
-
|
|
26487
|
+
/** Thin subclass so `<jssm-instance>` registers under a distinct constructor. */
|
|
26488
|
+
class JssmInstance extends FslInstance {
|
|
26418
26489
|
}
|
|
26490
|
+
define_with_synonym('fsl-instance', 'jssm-instance', FslInstance, JssmInstance);
|
|
26419
26491
|
|
|
26420
|
-
export { JssmInstance };
|
|
26492
|
+
export { FslInstance, JssmInstance };
|
package/dist/cdn/viz.js
CHANGED
|
@@ -21455,7 +21455,7 @@ var constants = /*#__PURE__*/Object.freeze({
|
|
|
21455
21455
|
* Useful for runtime diagnostics and for embedding in serialized machine
|
|
21456
21456
|
* snapshots so that deserializers can detect version-skew.
|
|
21457
21457
|
*/
|
|
21458
|
-
const version = "5.
|
|
21458
|
+
const version = "5.142.0";
|
|
21459
21459
|
|
|
21460
21460
|
// whargarbl lots of these return arrays could/should be sets
|
|
21461
21461
|
const { state_name_chars, state_name_first_chars, action_label_chars } = constants;
|
|
@@ -25988,6 +25988,70 @@ async function machine_to_svg_string(u_jssm, opts = {}) {
|
|
|
25988
25988
|
return dot_to_svg(machine_to_dot(u_jssm, opts));
|
|
25989
25989
|
}
|
|
25990
25990
|
|
|
25991
|
+
/**
|
|
25992
|
+
* Shared helpers for the dual-prefix (`fsl-` canonical, `jssm-` synonym)
|
|
25993
|
+
* web-component naming convention. Centralizes the "match either prefix"
|
|
25994
|
+
* rule so it lives in exactly one place.
|
|
25995
|
+
*/
|
|
25996
|
+
/**
|
|
25997
|
+
* Returns true when `tag_name` is exactly `fsl-<suffix>` or `jssm-<suffix>`
|
|
25998
|
+
* (case-insensitive).
|
|
25999
|
+
*
|
|
26000
|
+
* @param tag_name - The element tag name to test (e.g. `"FSL-VIZ"`, `"jssm-viz"`).
|
|
26001
|
+
* @param suffix - The suffix to match after the prefix (e.g. `"viz"`).
|
|
26002
|
+
* @returns `true` when `tag_name` is `fsl-<suffix>` or `jssm-<suffix>`.
|
|
26003
|
+
*
|
|
26004
|
+
* @example
|
|
26005
|
+
* wc_suffix_matches('FSL-VIZ', 'viz'); // true
|
|
26006
|
+
* wc_suffix_matches('jssm-viz', 'viz'); // true
|
|
26007
|
+
* wc_suffix_matches('div', 'viz'); // false
|
|
26008
|
+
* wc_suffix_matches('fsl-vizard', 'viz'); // false — suffix must match exactly
|
|
26009
|
+
*/
|
|
26010
|
+
/**
|
|
26011
|
+
* Returns the nearest ancestor of `el` (or `el` itself) whose tag is
|
|
26012
|
+
* `fsl-<suffix>` or `jssm-<suffix>`, or `null` if none exists.
|
|
26013
|
+
*
|
|
26014
|
+
* @param el - The element to start the search from.
|
|
26015
|
+
* @param suffix - The suffix to match (e.g. `"instance"`).
|
|
26016
|
+
* @returns The closest matching ancestor element, or `null`.
|
|
26017
|
+
*
|
|
26018
|
+
* @example
|
|
26019
|
+
* // <fsl-instance><div id="k"></div></fsl-instance>
|
|
26020
|
+
* closest_wc(document.getElementById('k'), 'instance'); // <fsl-instance>
|
|
26021
|
+
*
|
|
26022
|
+
* @see wc_suffix_matches
|
|
26023
|
+
*/
|
|
26024
|
+
function closest_wc(el, suffix) {
|
|
26025
|
+
return el.closest(`fsl-${suffix}, jssm-${suffix}`);
|
|
26026
|
+
}
|
|
26027
|
+
/**
|
|
26028
|
+
* Registers a canonical custom-element tag and its synonym tag.
|
|
26029
|
+
*
|
|
26030
|
+
* `customElements.define` requires a distinct constructor per tag name, so
|
|
26031
|
+
* callers pass the canonical class and a thin subclass for the synonym.
|
|
26032
|
+
* The function is idempotent: if either tag is already registered it skips
|
|
26033
|
+
* that `define` call rather than throwing.
|
|
26034
|
+
*
|
|
26035
|
+
* @param canonical_tag - The primary tag name (e.g. `"fsl-instance"`).
|
|
26036
|
+
* @param synonym_tag - The alias tag name (e.g. `"jssm-instance"`).
|
|
26037
|
+
* @param CanonicalClass - Constructor to register under `canonical_tag`.
|
|
26038
|
+
* @param SynonymClass - Constructor to register under `synonym_tag`
|
|
26039
|
+
* (must be a distinct class from `CanonicalClass`).
|
|
26040
|
+
*
|
|
26041
|
+
* @example
|
|
26042
|
+
* class FslInstance extends HTMLElement {}
|
|
26043
|
+
* class JssmInstance extends FslInstance {}
|
|
26044
|
+
* define_with_synonym('fsl-instance', 'jssm-instance', FslInstance, JssmInstance);
|
|
26045
|
+
*
|
|
26046
|
+
* @see closest_wc
|
|
26047
|
+
*/
|
|
26048
|
+
function define_with_synonym(canonical_tag, synonym_tag, CanonicalClass, SynonymClass) {
|
|
26049
|
+
if (!customElements.get(canonical_tag))
|
|
26050
|
+
customElements.define(canonical_tag, CanonicalClass);
|
|
26051
|
+
if (!customElements.get(synonym_tag))
|
|
26052
|
+
customElements.define(synonym_tag, SynonymClass);
|
|
26053
|
+
}
|
|
26054
|
+
|
|
25991
26055
|
var __decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
|
25992
26056
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
25993
26057
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -26030,20 +26094,20 @@ function normalize_viz_error(e) {
|
|
|
26030
26094
|
*
|
|
26031
26095
|
* Two operating modes:
|
|
26032
26096
|
*
|
|
26033
|
-
* 1. **Standalone** (no parent `<
|
|
26097
|
+
* 1. **Standalone** (no parent `<fsl-instance>` ancestor): render from
|
|
26034
26098
|
* the element's own `fsl=""` attribute / property. Re-renders on
|
|
26035
26099
|
* attribute change.
|
|
26036
|
-
* 2. **Nested** (inside a `<jssm-instance>` ancestor,
|
|
26037
|
-
* `
|
|
26038
|
-
* parent's machine and re-render on every `transition`
|
|
26039
|
-
* element's own `fsl` attribute is ignored in this mode;
|
|
26040
|
-
* emits a `console.warn` for developer feedback.
|
|
26100
|
+
* 2. **Nested** (inside a `<fsl-instance>` or `<jssm-instance>` ancestor,
|
|
26101
|
+
* found via `closest_wc(this, 'instance')` at `connectedCallback`):
|
|
26102
|
+
* bind to the parent's machine and re-render on every `transition`
|
|
26103
|
+
* event. The element's own `fsl` attribute is ignored in this mode;
|
|
26104
|
+
* supplying it emits a `console.warn` for developer feedback.
|
|
26041
26105
|
*
|
|
26042
|
-
* @element
|
|
26106
|
+
* @element fsl-viz
|
|
26043
26107
|
* @cssproperty [--jssm-viz-min-height=100px] - Minimum height of the rendered SVG container.
|
|
26044
26108
|
* @fires {CustomEvent<{ message: string; location?: unknown }>} viz-error - Fires when the FSL source fails to parse or render.
|
|
26045
26109
|
*/
|
|
26046
|
-
class
|
|
26110
|
+
class FslViz extends i$1 {
|
|
26047
26111
|
constructor() {
|
|
26048
26112
|
super(...arguments);
|
|
26049
26113
|
/** FSL source to render. */
|
|
@@ -26052,9 +26116,10 @@ class JssmViz extends i$1 {
|
|
|
26052
26116
|
this.engine = undefined;
|
|
26053
26117
|
this._svg = '';
|
|
26054
26118
|
/**
|
|
26055
|
-
* Parent `<jssm-instance>` host reference, set in
|
|
26056
|
-
* when a parent is found. When non-null the viz is
|
|
26057
|
-
* renders the parent's machine instead of its own
|
|
26119
|
+
* Parent `<fsl-instance>` (or `<jssm-instance>`) host reference, set in
|
|
26120
|
+
* `connectedCallback` when a parent is found. When non-null the viz is
|
|
26121
|
+
* in nested mode and renders the parent's machine instead of its own
|
|
26122
|
+
* `fsl` attribute.
|
|
26058
26123
|
*/
|
|
26059
26124
|
this._parent_host = null;
|
|
26060
26125
|
/**
|
|
@@ -26087,9 +26152,9 @@ class JssmViz extends i$1 {
|
|
|
26087
26152
|
}
|
|
26088
26153
|
/**
|
|
26089
26154
|
* Web Components lifecycle hook. Walks up to find a parent
|
|
26090
|
-
* `<jssm-instance>` ancestor
|
|
26091
|
-
* subscribes to the parent machine's
|
|
26092
|
-
* leaves standalone behavior intact.
|
|
26155
|
+
* `<fsl-instance>` or `<jssm-instance>` ancestor via `closest_wc`; if
|
|
26156
|
+
* found, switches into nested mode and subscribes to the parent machine's
|
|
26157
|
+
* `transition` events. Otherwise leaves standalone behavior intact.
|
|
26093
26158
|
*
|
|
26094
26159
|
* Subscription setup is deferred via `customElements.whenDefined` so the
|
|
26095
26160
|
* parent has had a chance to upgrade and construct its machine before
|
|
@@ -26097,7 +26162,7 @@ class JssmViz extends i$1 {
|
|
|
26097
26162
|
*/
|
|
26098
26163
|
connectedCallback() {
|
|
26099
26164
|
super.connectedCallback();
|
|
26100
|
-
const host = this
|
|
26165
|
+
const host = closest_wc(this, 'instance');
|
|
26101
26166
|
if (host === null) {
|
|
26102
26167
|
return; // standalone: existing behavior, willUpdate handles render
|
|
26103
26168
|
}
|
|
@@ -26106,13 +26171,13 @@ class JssmViz extends i$1 {
|
|
|
26106
26171
|
// owns the machine.
|
|
26107
26172
|
if (typeof this.fsl === 'string' && this.fsl.trim().length > 0) {
|
|
26108
26173
|
// eslint-disable-next-line no-console
|
|
26109
|
-
console.warn('<
|
|
26174
|
+
console.warn('<fsl-viz>: `fsl` ignored when nested inside <fsl-instance>; parent owns the machine');
|
|
26110
26175
|
}
|
|
26111
26176
|
this._parent_host = host;
|
|
26112
26177
|
// Defer to whenDefined so a not-yet-upgraded host has its machine
|
|
26113
26178
|
// available before we access `host.machine` (which throws when called
|
|
26114
26179
|
// pre-connection).
|
|
26115
|
-
void customElements.whenDefined('
|
|
26180
|
+
void customElements.whenDefined('fsl-instance').then(() => {
|
|
26116
26181
|
// Re-check the host is still attached and the viz still belongs to
|
|
26117
26182
|
// it — disconnection between the deferred resolution and now is
|
|
26118
26183
|
// legal and should not error.
|
|
@@ -26227,7 +26292,7 @@ class JssmViz extends i$1 {
|
|
|
26227
26292
|
return b `<div class="container">${o(this._svg)}</div>`;
|
|
26228
26293
|
}
|
|
26229
26294
|
}
|
|
26230
|
-
|
|
26295
|
+
FslViz.styles = i$4 `
|
|
26231
26296
|
:host {
|
|
26232
26297
|
display: block;
|
|
26233
26298
|
min-height: var(--jssm-viz-min-height, 100px);
|
|
@@ -26239,33 +26304,17 @@ JssmViz.styles = i$4 `
|
|
|
26239
26304
|
`;
|
|
26240
26305
|
__decorate([
|
|
26241
26306
|
n({ type: String })
|
|
26242
|
-
],
|
|
26307
|
+
], FslViz.prototype, "fsl", void 0);
|
|
26243
26308
|
__decorate([
|
|
26244
26309
|
n({ type: String })
|
|
26245
|
-
],
|
|
26310
|
+
], FslViz.prototype, "engine", void 0);
|
|
26246
26311
|
__decorate([
|
|
26247
26312
|
r()
|
|
26248
|
-
],
|
|
26313
|
+
], FslViz.prototype, "_svg", void 0);
|
|
26249
26314
|
|
|
26250
|
-
/**
|
|
26251
|
-
|
|
26252
|
-
* second tag name. `customElements.define` requires a distinct constructor
|
|
26253
|
-
* per tag, so the only portable way to publish `<fsl-viz>` as a synonym
|
|
26254
|
-
* for `<jssm-viz>` is to register a no-op subclass.
|
|
26255
|
-
*
|
|
26256
|
-
* Both tags render identically; `<fsl-viz>` is provided as an alternative
|
|
26257
|
-
* spelling for users whose mental model is "FSL viz" rather than "jssm
|
|
26258
|
-
* viz". Parent-context binding for both tags lives on the shared
|
|
26259
|
-
* `JssmViz` base class (see {@link JssmViz}); the synonym inherits it
|
|
26260
|
-
* automatically.
|
|
26261
|
-
*/
|
|
26262
|
-
class FslViz extends JssmViz {
|
|
26263
|
-
}
|
|
26264
|
-
if (!customElements.get('jssm-viz')) {
|
|
26265
|
-
customElements.define('jssm-viz', JssmViz);
|
|
26266
|
-
}
|
|
26267
|
-
if (!customElements.get('fsl-viz')) {
|
|
26268
|
-
customElements.define('fsl-viz', FslViz);
|
|
26315
|
+
/** Thin subclass so `<jssm-viz>` registers under a distinct constructor. */
|
|
26316
|
+
class JssmViz extends FslViz {
|
|
26269
26317
|
}
|
|
26318
|
+
define_with_synonym('fsl-viz', 'jssm-viz', FslViz, JssmViz);
|
|
26270
26319
|
|
|
26271
26320
|
export { FslViz, JssmViz };
|