@verbb/plugin-kit-web 2.0.11 → 2.0.13

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/CHANGELOG.md CHANGED
@@ -2,6 +2,16 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## 2.0.13 - 2026-08-25
6
+
7
+ ### Fixed
8
+ - `<pk-icon>` re-resolves when the shared icon registry gains glyphs (pairs with `@verbb/plugin-kit-icons` page-global registry — later plugins’ `registerIcons` fill icons that upgraded earlier).
9
+
10
+ ## 2.0.12 - 2026-08-25
11
+
12
+ ### Changed
13
+ - Released alongside the other `@verbb/plugin-kit-*` packages to keep versions aligned.
14
+
5
15
  ## 2.0.11 - 2026-08-25
6
16
 
7
17
  ### Fixed
@@ -5,6 +5,7 @@ import { PkElement } from '../../base/pk-element.js';
5
5
  *
6
6
  * The name registry starts empty — consumers must {@link registerIcons}
7
7
  * (or import `@verbb/plugin-kit-icons/all.js`) before `<pk-icon icon="…">` resolves.
8
+ * Registrations are page-global across bundled Plugin Kit copies (Craft multi-plugin CP).
8
9
  *
9
10
  * Sizing follows `font-size` (defaults to `1em`), colour follows `currentColor`,
10
11
  * so consumers style it like text:
@@ -36,6 +37,9 @@ export declare class PkIcon extends PkElement {
36
37
  * otherwise it is hidden from assistive technology.
37
38
  */
38
39
  label?: string;
40
+ private unsubscribeRegistry;
41
+ connectedCallback(): void;
42
+ disconnectedCallback(): void;
39
43
  render(): import('lit-html').TemplateResult<1> | typeof nothing;
40
44
  }
41
45
  declare global {
@@ -1 +1 @@
1
- {"version":3,"file":"pk-icon.d.ts","sourceRoot":"","sources":["../../../src/components/icon/pk-icon.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,OAAO,EAAE,MAAM,KAAK,CAAC;AAKzC,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAErD;;;;;;;;;;;;;;;;;;GAkBG;AACH,qBACa,MAAO,SAAQ,SAAS;IACjC,OAAgB,MAAM,0BAsBpB;IAEF;;;OAGG;IAEH,IAAI,SAAM;IAEV;;;OAGG;IAEH,IAAI,SAAM;IAEV;;;OAGG;IAEH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEN,MAAM;CASlB;AAED,OAAO,CAAC,MAAM,CAAC;IACX,UAAU,qBAAqB;QAC3B,SAAS,EAAE,MAAM,CAAC;KACrB;CACJ"}
1
+ {"version":3,"file":"pk-icon.d.ts","sourceRoot":"","sources":["../../../src/components/icon/pk-icon.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,OAAO,EAAE,MAAM,KAAK,CAAC;AAKzC,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAErD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,qBACa,MAAO,SAAQ,SAAS;IACjC,OAAgB,MAAM,0BAsBpB;IAEF;;;OAGG;IAEH,IAAI,SAAM;IAEV;;;OAGG;IAEH,IAAI,SAAM;IAEV;;;OAGG;IAEH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf,OAAO,CAAC,mBAAmB,CAA6B;IAE/C,iBAAiB,IAAI,IAAI;IASzB,oBAAoB,IAAI,IAAI;IAM5B,MAAM;CASlB;AAED,OAAO,CAAC,MAAM,CAAC;IACX,UAAU,qBAAqB;QAC3B,SAAS,EAAE,MAAM,CAAC;KACrB;CACJ"}
@@ -2,13 +2,14 @@ import { n as PkElement, t as __decorate } from "../../chunks/decorate-W02hmVTt.
2
2
  import { css, html, nothing } from "lit";
3
3
  import { customElement, property } from "lit/decorators.js";
4
4
  import { unsafeSVG } from "lit/directives/unsafe-svg.js";
5
- import { getIcon, iconToSvg } from "@verbb/plugin-kit-icons";
5
+ import { getIcon, iconToSvg, subscribeIconRegistry } from "@verbb/plugin-kit-icons";
6
6
  //#region src/components/icon/pk-icon.ts
7
7
  var PkIcon = class PkIcon extends PkElement {
8
8
  constructor(..._args) {
9
9
  super(..._args);
10
10
  this.icon = "";
11
11
  this.name = "";
12
+ this.unsubscribeRegistry = null;
12
13
  }
13
14
  static {
14
15
  this.styles = css`
@@ -35,6 +36,17 @@ var PkIcon = class PkIcon extends PkElement {
35
36
  }
36
37
  `;
37
38
  }
39
+ connectedCallback() {
40
+ super.connectedCallback();
41
+ this.unsubscribeRegistry = subscribeIconRegistry(() => {
42
+ this.requestUpdate();
43
+ });
44
+ }
45
+ disconnectedCallback() {
46
+ this.unsubscribeRegistry?.();
47
+ this.unsubscribeRegistry = null;
48
+ super.disconnectedCallback();
49
+ }
38
50
  render() {
39
51
  const icon = getIcon(this.icon || this.name);
40
52
  if (!icon) return nothing;
@@ -1 +1 @@
1
- {"version":3,"file":"pk-icon.js","names":[],"sources":["../../../src/components/icon/pk-icon.ts"],"sourcesContent":["import { html, css, nothing } from 'lit';\nimport { customElement, property } from 'lit/decorators.js';\nimport { unsafeSVG } from 'lit/directives/unsafe-svg.js';\nimport { getIcon, iconToSvg } from '@verbb/plugin-kit-icons';\n\nimport { PkElement } from '../../base/pk-element.js';\n\n/**\n * Standalone icon element backed by the Plugin Kit raw-SVG icon set.\n *\n * The name registry starts empty — consumers must {@link registerIcons}\n * (or import `@verbb/plugin-kit-icons/all.js`) before `<pk-icon icon=\"…\">` resolves.\n *\n * Sizing follows `font-size` (defaults to `1em`), colour follows `currentColor`,\n * so consumers style it like text:\n *\n * ```html\n * <pk-icon icon=\"chevron-down\"></pk-icon>\n * <pk-icon icon=\"pen\" label=\"Edit\" style=\"font-size: 20px; color: #6b7280\"></pk-icon>\n * ```\n *\n * Prefer the `icon` attribute over `name`: some server-side form renderers\n * (e.g. Craft CMS `Html::namespaceInputs()`) rewrite every `name=\"…\"` attribute\n * in a form to namespace it, which would corrupt the icon lookup. `icon` is left\n * untouched. `name` is still supported for non-form contexts / back-compat.\n */\n@customElement('pk-icon')\nexport class PkIcon extends PkElement {\n static override styles = css`\n :host {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n flex: none;\n /* Square em box + slight baseline nudge for inline text. Flex\n * parents (e.g. button slots) should zero vertical-align. */\n width: 1em;\n height: 1em;\n line-height: 1;\n vertical-align: -0.125em;\n }\n\n svg {\n display: block;\n width: 100%;\n height: 100%;\n fill: currentColor;\n /* Allow intentional path overhang past the icon canvas. */\n overflow: visible;\n }\n `;\n\n /**\n * Icon name (kebab-case), e.g. `chevron-down`, `gear`, `xmark`.\n * Namespacing-safe alternative to `name` — use this inside CMS form markup.\n */\n @property()\n icon = '';\n\n /**\n * Icon name (kebab-case). Back-compat / non-form alias for `icon`.\n * Avoid in server-namespaced forms, where `name` attributes get rewritten.\n */\n @property()\n name = '';\n\n /**\n * Accessible label. When set the icon is exposed as an image with a title;\n * otherwise it is hidden from assistive technology.\n */\n @property()\n label?: string;\n\n override render() {\n const icon = getIcon(this.icon || this.name);\n\n if (!icon) {\n return nothing;\n }\n\n return html`${unsafeSVG(iconToSvg(icon, { title: this.label }))}`;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'pk-icon': PkIcon;\n }\n}\n"],"mappings":";;;;;;AA2BO,IAAA,SAAA,MAAM,eAAe,UAAU;;;cA8B3B;cAOA;;;gBApCkB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;CA6C5B,SAAkB;EACd,MAAM,OAAO,QAAQ,KAAK,QAAQ,KAAK,KAAK;AAE5C,MAAI,CAAC,KACD,QAAO;AAGX,SAAO,IAAI,GAAG,UAAU,UAAU,MAAM,EAAE,OAAO,KAAK,OAAO,CAAC,CAAC;;;YAxBlE,UAAU,CAAA,EAAA,OAAA,WAAA,QAAA,KAAA,EAAA;YAOV,UAAU,CAAA,EAAA,OAAA,WAAA,QAAA,KAAA,EAAA;YAOV,UAAU,CAAA,EAAA,OAAA,WAAA,SAAA,KAAA,EAAA;qBA5Cd,cAAc,UAAU,CAAA,EAAA,OAAA"}
1
+ {"version":3,"file":"pk-icon.js","names":[],"sources":["../../../src/components/icon/pk-icon.ts"],"sourcesContent":["import { html, css, nothing } from 'lit';\nimport { customElement, property } from 'lit/decorators.js';\nimport { unsafeSVG } from 'lit/directives/unsafe-svg.js';\nimport { getIcon, iconToSvg, subscribeIconRegistry } from '@verbb/plugin-kit-icons';\n\nimport { PkElement } from '../../base/pk-element.js';\n\n/**\n * Standalone icon element backed by the Plugin Kit raw-SVG icon set.\n *\n * The name registry starts empty — consumers must {@link registerIcons}\n * (or import `@verbb/plugin-kit-icons/all.js`) before `<pk-icon icon=\"…\">` resolves.\n * Registrations are page-global across bundled Plugin Kit copies (Craft multi-plugin CP).\n *\n * Sizing follows `font-size` (defaults to `1em`), colour follows `currentColor`,\n * so consumers style it like text:\n *\n * ```html\n * <pk-icon icon=\"chevron-down\"></pk-icon>\n * <pk-icon icon=\"pen\" label=\"Edit\" style=\"font-size: 20px; color: #6b7280\"></pk-icon>\n * ```\n *\n * Prefer the `icon` attribute over `name`: some server-side form renderers\n * (e.g. Craft CMS `Html::namespaceInputs()`) rewrite every `name=\"…\"` attribute\n * in a form to namespace it, which would corrupt the icon lookup. `icon` is left\n * untouched. `name` is still supported for non-form contexts / back-compat.\n */\n@customElement('pk-icon')\nexport class PkIcon extends PkElement {\n static override styles = css`\n :host {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n flex: none;\n /* Square em box + slight baseline nudge for inline text. Flex\n * parents (e.g. button slots) should zero vertical-align. */\n width: 1em;\n height: 1em;\n line-height: 1;\n vertical-align: -0.125em;\n }\n\n svg {\n display: block;\n width: 100%;\n height: 100%;\n fill: currentColor;\n /* Allow intentional path overhang past the icon canvas. */\n overflow: visible;\n }\n `;\n\n /**\n * Icon name (kebab-case), e.g. `chevron-down`, `gear`, `xmark`.\n * Namespacing-safe alternative to `name` — use this inside CMS form markup.\n */\n @property()\n icon = '';\n\n /**\n * Icon name (kebab-case). Back-compat / non-form alias for `icon`.\n * Avoid in server-namespaced forms, where `name` attributes get rewritten.\n */\n @property()\n name = '';\n\n /**\n * Accessible label. When set the icon is exposed as an image with a title;\n * otherwise it is hidden from assistive technology.\n */\n @property()\n label?: string;\n\n private unsubscribeRegistry: (() => void) | null = null;\n\n override connectedCallback(): void {\n super.connectedCallback();\n\n // Later plugins may register glyphs after this host upgraded — re-resolve.\n this.unsubscribeRegistry = subscribeIconRegistry(() => {\n this.requestUpdate();\n });\n }\n\n override disconnectedCallback(): void {\n this.unsubscribeRegistry?.();\n this.unsubscribeRegistry = null;\n super.disconnectedCallback();\n }\n\n override render() {\n const icon = getIcon(this.icon || this.name);\n\n if (!icon) {\n return nothing;\n }\n\n return html`${unsafeSVG(iconToSvg(icon, { title: this.label }))}`;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'pk-icon': PkIcon;\n }\n}\n"],"mappings":";;;;;;AA4BO,IAAA,SAAA,MAAM,eAAe,UAAU;;;cA8B3B;cAOA;6BAS4C;;;gBA7C1B,GAAG;;;;;;;;;;;;;;;;;;;;;;;;CA+C5B,oBAAmC;AAC/B,QAAM,mBAAmB;AAGzB,OAAK,sBAAsB,4BAA4B;AACnD,QAAK,eAAe;IACtB;;CAGN,uBAAsC;AAClC,OAAK,uBAAuB;AAC5B,OAAK,sBAAsB;AAC3B,QAAM,sBAAsB;;CAGhC,SAAkB;EACd,MAAM,OAAO,QAAQ,KAAK,QAAQ,KAAK,KAAK;AAE5C,MAAI,CAAC,KACD,QAAO;AAGX,SAAO,IAAI,GAAG,UAAU,UAAU,MAAM,EAAE,OAAO,KAAK,OAAO,CAAC,CAAC;;;YAzClE,UAAU,CAAA,EAAA,OAAA,WAAA,QAAA,KAAA,EAAA;YAOV,UAAU,CAAA,EAAA,OAAA,WAAA,QAAA,KAAA,EAAA;YAOV,UAAU,CAAA,EAAA,OAAA,WAAA,SAAA,KAAA,EAAA;qBA5Cd,cAAc,UAAU,CAAA,EAAA,OAAA"}
@@ -56,6 +56,7 @@ var getErrorMessage = function(error, maxTraceLines = 5) {
56
56
  };
57
57
  //#endregion
58
58
  //#region ../plugin-kit-core/dist/utils/connect.js
59
+ var craftWindow = () => window;
59
60
  var DEFAULT_FORM_SELECTOR = "#main-form";
60
61
  var resolveCpForm = ({ formSelector = DEFAULT_FORM_SELECTOR, host } = {}) => {
61
62
  if (formSelector) {
@@ -68,13 +69,15 @@ var resolveCpForm = ({ formSelector = DEFAULT_FORM_SELECTOR, host } = {}) => {
68
69
  };
69
70
  /** Escape text for CP dialog markup; prefers `Craft.escapeHtml` when available. */
70
71
  var escapeCpHtml = (value) => {
71
- if (window.Craft?.escapeHtml) return window.Craft.escapeHtml(value);
72
+ const craft = craftWindow().Craft;
73
+ if (craft?.escapeHtml) return craft.escapeHtml(value);
72
74
  return value.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
73
75
  };
74
76
  /** POST a credentials connect/check controller action from the CP. */
75
77
  var sendCpConnectRequest = (action, data) => {
76
- if (!window.Craft?.sendActionRequest) return Promise.reject(/* @__PURE__ */ new Error("Craft.sendActionRequest is unavailable."));
77
- return window.Craft.sendActionRequest("POST", action, { data });
78
+ const craft = craftWindow().Craft;
79
+ if (!craft?.sendActionRequest) return Promise.reject(/* @__PURE__ */ new Error("Craft.sendActionRequest is unavailable."));
80
+ return craft.sendActionRequest("POST", action, { data });
78
81
  };
79
82
  /**
80
83
  * Serialize named CP form controls into a flat key → value map.
@@ -102,7 +105,7 @@ var buildConnectPayload = (values, options = {}) => {
102
105
  const idParam = options.idParam ?? "sourceId";
103
106
  const payload = { type };
104
107
  payload[idParam] = values[idParam] ?? values.sourceId ?? values.id ?? options.sourceId;
105
- const csrfTokenName = typeof window !== "undefined" ? window.Craft?.csrfTokenName : void 0;
108
+ const csrfTokenName = typeof window !== "undefined" ? craftWindow().Craft?.csrfTokenName : void 0;
106
109
  if (csrfTokenName && values[csrfTokenName]) payload[csrfTokenName] = values[csrfTokenName];
107
110
  if (includeTypeNamespace && type) {
108
111
  const prefix = `types[${type}]`;
@@ -161,8 +164,7 @@ var submitCpFormAction = ({ formSelector = DEFAULT_FORM_SELECTOR, host, action,
161
164
  formSelector,
162
165
  host
163
166
  });
164
- const craft = window.Craft;
165
- const $ = window.$;
167
+ const { Craft: craft, $ } = craftWindow();
166
168
  if (!form || typeof craft?.submitForm !== "function" || !$) return;
167
169
  const params = {};
168
170
  if (paramName && paramValue) params[paramName] = paramValue;
@@ -1,13 +1,14 @@
1
1
  import { a as o, f as A, l as n, m as i, p as b, u as customElement } from "./lit-DpLik9Rf.js";
2
2
  import { c as __decorate, l as PkElement } from "./pk-base-B21zXxSo.js";
3
3
  import { t as iconToSvg } from "./svg-_Mtb7CHx.js";
4
- import { t as getIcon } from "./registry-CmL0rH9r.js";
4
+ import { i as subscribeIconRegistry, t as getIcon } from "./registry-BanyScVR.js";
5
5
  //#region src/components/icon/pk-icon.ts
6
6
  var PkIcon = class PkIcon extends PkElement {
7
7
  constructor(..._args) {
8
8
  super(..._args);
9
9
  this.icon = "";
10
10
  this.name = "";
11
+ this.unsubscribeRegistry = null;
11
12
  }
12
13
  static {
13
14
  this.styles = i`
@@ -34,6 +35,17 @@ var PkIcon = class PkIcon extends PkElement {
34
35
  }
35
36
  `;
36
37
  }
38
+ connectedCallback() {
39
+ super.connectedCallback();
40
+ this.unsubscribeRegistry = subscribeIconRegistry(() => {
41
+ this.requestUpdate();
42
+ });
43
+ }
44
+ disconnectedCallback() {
45
+ this.unsubscribeRegistry?.();
46
+ this.unsubscribeRegistry = null;
47
+ super.disconnectedCallback();
48
+ }
37
49
  render() {
38
50
  const icon = getIcon(this.icon || this.name);
39
51
  if (!icon) return A;
@@ -0,0 +1,72 @@
1
+ //#region ../plugin-kit-icons/dist/registry.js
2
+ var camelToKebab = (value) => {
3
+ return value.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
4
+ };
5
+ /**
6
+ * Normalize a consumer-facing name to the registry key.
7
+ * Accepts kebab-case (`chevron-down`) or camelCase (`chevronDown`) — same glyph, not synonyms.
8
+ */
9
+ var normalizeIconName = (name) => {
10
+ const trimmed = name.trim();
11
+ if (!trimmed) return trimmed;
12
+ if (!/[A-Z]/.test(trimmed)) return trimmed.toLowerCase();
13
+ return camelToKebab(trimmed);
14
+ };
15
+ /**
16
+ * Cross-bundle singleton keys. Craft CP pages load several Plugin Kit consumers,
17
+ * each with its own Vite copy of this module — a module-scoped `registry` object
18
+ * would not be shared, so Plugin B’s `registerIcons({ gear })` never reaches
19
+ * Plugin A’s winning `<pk-icon>`. `globalThis` is the same map for every copy.
20
+ */
21
+ var REGISTRY_KEY = "__PK_ICON_REGISTRY__";
22
+ var LISTENERS_KEY = "__PK_ICON_REGISTRY_LISTENERS__";
23
+ var getRegistry = () => {
24
+ const root = globalThis;
25
+ if (!root[REGISTRY_KEY]) root[REGISTRY_KEY] = {};
26
+ return root[REGISTRY_KEY];
27
+ };
28
+ var getListeners = () => {
29
+ const root = globalThis;
30
+ if (!root[LISTENERS_KEY]) root[LISTENERS_KEY] = /* @__PURE__ */ new Set();
31
+ return root[LISTENERS_KEY];
32
+ };
33
+ var notifyRegistryChanged = () => {
34
+ for (const listener of getListeners()) try {
35
+ listener();
36
+ } catch {}
37
+ };
38
+ /**
39
+ * Subscribe to additive `registerIcon(s)` updates (e.g. `<pk-icon>` re-resolves
40
+ * after a later plugin merges glyphs into the shared map). Returns unsubscribe.
41
+ */
42
+ var subscribeIconRegistry = (listener) => {
43
+ const listeners = getListeners();
44
+ listeners.add(listener);
45
+ return () => {
46
+ listeners.delete(listener);
47
+ };
48
+ };
49
+ /** Resolve an icon by kebab-case or camelCase name. Returns `undefined` if unknown. */
50
+ var getIcon = (name) => {
51
+ if (!name) return;
52
+ const registry = getRegistry();
53
+ return registry[normalizeIconName(name)] ?? registry[name];
54
+ };
55
+ /**
56
+ * Register several icons in one call. Equivalent to repeated {@link registerIcon},
57
+ * with a single change notification at the end.
58
+ * Keys may be kebab-case or camelCase (normalized to kebab).
59
+ */
60
+ var registerIcons = (entries) => {
61
+ let changed = false;
62
+ for (const [name, icon] of Object.entries(entries)) {
63
+ const key = normalizeIconName(name);
64
+ if (!key) throw new Error("registerIcon: name must be a non-empty string");
65
+ if (!icon?.path || !icon.width || !icon.height) throw new Error(`registerIcon: icon "${key}" must include width, height, and path`);
66
+ getRegistry()[key] = icon;
67
+ changed = true;
68
+ }
69
+ if (changed) notifyRegistryChanged();
70
+ };
71
+ //#endregion
72
+ export { subscribeIconRegistry as i, normalizeIconName as n, registerIcons as r, getIcon as t };
@@ -1,7 +1,7 @@
1
1
  import { c as r, d as i, l as n, p as b, u as customElement } from "../../chunks/lit-DpLik9Rf.js";
2
2
  import { c as __decorate } from "../../chunks/pk-base-B21zXxSo.js";
3
3
  import "../../chunks/pk-button-Dh4gjLHw.js";
4
- import { c as watchCpFormDirty, s as submitCpFormAction, t as pkConnectStyles } from "../../chunks/pk-connect.styles-BAgeFns_.js";
4
+ import { c as watchCpFormDirty, s as submitCpFormAction, t as pkConnectStyles } from "../../chunks/pk-connect.styles-Bfgwu0VH.js";
5
5
  import "../../chunks/pk-status-BRIVW7EH.js";
6
6
  //#region src/components/connect/pk-connect-oauth.ts
7
7
  var PkConnectOauth = class PkConnectOauth extends i {
@@ -1,9 +1,9 @@
1
1
  import { c as r, d as i, f as A, l as n, p as b, u as customElement } from "../../chunks/lit-DpLik9Rf.js";
2
2
  import { c as __decorate } from "../../chunks/pk-base-B21zXxSo.js";
3
- import "../../chunks/pk-icon-B-OBmJ3K.js";
3
+ import "../../chunks/pk-icon-WHUu7wxk.js";
4
4
  import "../../chunks/pk-button-Dh4gjLHw.js";
5
5
  import "../../chunks/pk-dialog-BpPRqFMm.js";
6
- import { a as sendCpConnectRequest, c as watchCpFormDirty, i as resolveConnectError, n as buildConnectPayload, o as serializeCpForm, r as escapeCpHtml, t as pkConnectStyles } from "../../chunks/pk-connect.styles-BAgeFns_.js";
6
+ import { a as sendCpConnectRequest, c as watchCpFormDirty, i as resolveConnectError, n as buildConnectPayload, o as serializeCpForm, r as escapeCpHtml, t as pkConnectStyles } from "../../chunks/pk-connect.styles-Bfgwu0VH.js";
7
7
  import "../../chunks/pk-status-BRIVW7EH.js";
8
8
  //#region src/components/connect/pk-connect.ts
9
9
  var pkStatusForState = (status) => {
@@ -1,7 +1,7 @@
1
1
  import { c as r, f as A, i as e, l as n, m as i, o, p as b, t as c, u as customElement } from "../../chunks/lit-DpLik9Rf.js";
2
2
  import { c as __decorate, i as PkFormAssociatedElement } from "../../chunks/pk-base-B21zXxSo.js";
3
3
  import { B as plus, C as gripMove, S as gear, Y as xmark, b as ellipsis, l as arrowUp, o as arrowDown } from "../../chunks/svg-_Mtb7CHx.js";
4
- import { t as getIcon } from "../../chunks/registry-CmL0rH9r.js";
4
+ import { t as getIcon } from "../../chunks/registry-BanyScVR.js";
5
5
  import "../../chunks/pk-button-Dh4gjLHw.js";
6
6
  import { t as RequiredValidator } from "../../chunks/required-validator-0XwZtX9k.js";
7
7
  import "../../chunks/pk-checkbox-BrZQB816.js";
@@ -1,6 +1,6 @@
1
1
  import { M as icons } from "../../chunks/svg-_Mtb7CHx.js";
2
- import { n as normalizeIconName, r as registerIcons } from "../../chunks/registry-CmL0rH9r.js";
3
- import "../../chunks/pk-icon-B-OBmJ3K.js";
2
+ import { n as normalizeIconName, r as registerIcons } from "../../chunks/registry-BanyScVR.js";
3
+ import "../../chunks/pk-icon-WHUu7wxk.js";
4
4
  //#region ../plugin-kit-icons/dist/all.js
5
5
  /**
6
6
  * Side-effect entry: register every curated icon for `<pk-icon icon="…">` lookup.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@verbb/plugin-kit-web",
3
- "version": "2.0.11",
3
+ "version": "2.0.13",
4
4
  "description": "Plugin Kit web components (shadow DOM, Craft design system)",
5
5
  "type": "module",
6
6
  "types": "dist/index.d.ts",
@@ -982,18 +982,18 @@
982
982
  },
983
983
  "peerDependencies": {
984
984
  "@floating-ui/dom": "^1.7.3",
985
- "@verbb/plugin-kit-core": "^2.0.11",
986
- "@verbb/plugin-kit-icons": "^2.0.11",
985
+ "@verbb/plugin-kit-core": "^2.0.13",
986
+ "@verbb/plugin-kit-icons": "^2.0.13",
987
987
  "lit": "^3.3.0"
988
988
  },
989
989
  "license": "MIT",
990
990
  "dependencies": {
991
991
  "@floating-ui/dom": "^1.7.3",
992
992
  "@tiptap/core": "^3.22.4",
993
- "@verbb/plugin-kit-codemirror-core": "2.0.11",
994
- "@verbb/plugin-kit-core": "^2.0.11",
995
- "@verbb/plugin-kit-icons": "^2.0.11",
996
- "@verbb/plugin-kit-tiptap-core": "^2.0.11",
993
+ "@verbb/plugin-kit-codemirror-core": "2.0.13",
994
+ "@verbb/plugin-kit-core": "^2.0.13",
995
+ "@verbb/plugin-kit-icons": "^2.0.13",
996
+ "@verbb/plugin-kit-tiptap-core": "^2.0.13",
997
997
  "composed-offset-position": "^0.0.6",
998
998
  "lit": "^3.3.0"
999
999
  },
@@ -1,55 +0,0 @@
1
- //#region ../plugin-kit-icons/dist/registry.js
2
- var camelToKebab = (value) => {
3
- return value.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
4
- };
5
- /**
6
- * Normalize a consumer-facing name to the registry key.
7
- * Accepts kebab-case (`chevron-down`) or camelCase (`chevronDown`) — same glyph, not synonyms.
8
- */
9
- var normalizeIconName = (name) => {
10
- const trimmed = name.trim();
11
- if (!trimmed) return trimmed;
12
- if (!/[A-Z]/.test(trimmed)) return trimmed.toLowerCase();
13
- return camelToKebab(trimmed);
14
- };
15
- /** Empty until the consumer registers icons or imports `@verbb/plugin-kit-icons/all.js`. */
16
- var registry = {};
17
- /** Resolve an icon by kebab-case or camelCase name. Returns `undefined` if unknown. */
18
- var getIcon = (name) => {
19
- if (!name) return;
20
- return registry[normalizeIconName(name)] ?? registry[name];
21
- };
22
- /**
23
- * Register (or overwrite) an icon for `<pk-icon icon="…">` / {@link getIcon}.
24
- *
25
- * Call once at app bootstrap for every name your Twig/HTML looks up. Prefer named
26
- * icon imports so unused glyphs stay out of the bundle; use
27
- * `@verbb/plugin-kit-icons/all.js` only when you need the full curated set.
28
- *
29
- * Object keys may be camelCase (`arrowUp`) or kebab-case (`arrow-up`) — both
30
- * store under the kebab key that HTML uses.
31
- *
32
- * @example
33
- * ```ts
34
- * import { registerIcons, plus, gear, arrowUp } from '@verbb/plugin-kit-icons';
35
- *
36
- * registerIcons({ plus, gear, arrowUp });
37
- * // <pk-icon icon="plus"></pk-icon>
38
- * // <pk-icon icon="arrow-up"></pk-icon>
39
- * ```
40
- */
41
- var registerIcon = (name, icon) => {
42
- const key = normalizeIconName(name);
43
- if (!key) throw new Error("registerIcon: name must be a non-empty string");
44
- if (!icon?.path || !icon.width || !icon.height) throw new Error(`registerIcon: icon "${key}" must include width, height, and path`);
45
- registry[key] = icon;
46
- };
47
- /**
48
- * Register several icons in one call. Equivalent to repeated {@link registerIcon}.
49
- * Keys may be kebab-case or camelCase (normalized to kebab).
50
- */
51
- var registerIcons = (entries) => {
52
- for (const [name, icon] of Object.entries(entries)) registerIcon(name, icon);
53
- };
54
- //#endregion
55
- export { normalizeIconName as n, registerIcons as r, getIcon as t };