jssm 5.148.2 → 5.149.2

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.
@@ -0,0 +1,52 @@
1
+ import { FslDocs } from './docs.js';
2
+ export { FslDocs } from './docs.js';
3
+
4
+ /**
5
+ * Shared helpers for the dual-prefix (`fsl-` canonical, `jssm-` synonym)
6
+ * web-component naming convention. Centralizes the "match either prefix"
7
+ * rule so it lives in exactly one place.
8
+ */
9
+ /**
10
+ * Returns true when `tag_name` is exactly `fsl-<suffix>` or `jssm-<suffix>`
11
+ * (case-insensitive).
12
+ *
13
+ * @param tag_name - The element tag name to test (e.g. `"FSL-VIZ"`, `"jssm-viz"`).
14
+ * @param suffix - The suffix to match after the prefix (e.g. `"viz"`).
15
+ * @returns `true` when `tag_name` is `fsl-<suffix>` or `jssm-<suffix>`.
16
+ *
17
+ * @example
18
+ * wc_suffix_matches('FSL-VIZ', 'viz'); // true
19
+ * wc_suffix_matches('jssm-viz', 'viz'); // true
20
+ * wc_suffix_matches('div', 'viz'); // false
21
+ * wc_suffix_matches('fsl-vizard', 'viz'); // false — suffix must match exactly
22
+ */
23
+ /**
24
+ * Registers a single canonical `fsl-*` custom-element tag, with no `jssm-*`
25
+ * synonym.
26
+ *
27
+ * This is the registration path for **new** web components. The `jssm-*`
28
+ * prefix is a deprecated backward-compatibility alias retained only for the
29
+ * components that shipped under that name (`<jssm-viz>`, `<jssm-instance>`,
30
+ * `<jssm-bind>`); new components are `fsl-*`-only for fsl.tools brand
31
+ * alignment, and the legacy synonyms are slated for removal in v6. Use
32
+ * {@link define_with_synonym} only when maintaining one of those pre-existing
33
+ * dual-named components.
34
+ *
35
+ * Idempotent: skips the `define` call when the tag is already registered.
36
+ *
37
+ * @param canonical_tag - The `fsl-*` tag name (e.g. `"fsl-info-panel"`).
38
+ * @param CanonicalClass - Constructor to register under `canonical_tag`.
39
+ *
40
+ * @example
41
+ * class FslInfoPanel extends HTMLElement {}
42
+ * define_canonical('fsl-info-panel', FslInfoPanel);
43
+ *
44
+ * @see define_with_synonym
45
+ */
46
+ function define_canonical(canonical_tag, CanonicalClass) {
47
+ if (!customElements.get(canonical_tag))
48
+ customElements.define(canonical_tag, CanonicalClass);
49
+ }
50
+
51
+ // New component: canonical `fsl-*` only, no deprecated `jssm-*` synonym.
52
+ define_canonical('fsl-docs', FslDocs);