@lovince/icons 1.1.0 → 1.1.1

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/dist/element.d.ts CHANGED
@@ -1,8 +1,9 @@
1
- export declare class LvIconElement extends HTMLElement {
2
- static get observedAttributes(): readonly string[];
3
- connectedCallback(): void;
4
- attributeChangedCallback(): void;
5
- private render;
6
- }
7
- /** Idempotent, so calling it from several entry points is safe. */
1
+ import { IconName } from './paths';
2
+ import { RenderOptions } from './render';
3
+ declare const normaliseName: (value: string | null) => IconName | null;
4
+ /** Reads the element's attributes into render options. Exported for testing. */
5
+ export declare const optionsFromAttributes: (get: (name: string) => string | null, has: (name: string) => boolean) => RenderOptions;
6
+ export { normaliseName as resolveElementName };
7
+ export type LvIconElement = HTMLElement;
8
+ /** Idempotent and SSR-safe: a no-op anywhere without a DOM. */
8
9
  export declare const defineIconElement: (tag?: string) => void;
package/dist/index.d.ts CHANGED
@@ -5,7 +5,7 @@
5
5
  */
6
6
  export { paths, iconNames, iconGroups, isIconName, type IconName } from './paths';
7
7
  export { renderIcon, createIcon, iconDataUri, type RenderOptions } from './render';
8
- export { LvIconElement, defineIconElement } from './element';
8
+ export { defineIconElement, optionsFromAttributes, resolveElementName, type LvIconElement, } from './element';
9
9
  export { CANVAS, DEFAULT_SIZE, DEFAULT_STROKE, resolveGeometry, resolveStroke, resolveTransform, resolveFill, type IconFlip, type IconGeometry, } from './core/props';
10
10
  export { CONTEXT, VARIANT_FILL, STATE_FILL, STATE_OPACITY, opticalStroke, resolveContext, resolveVariantFill, type ContextPreset, type IconContext, type IconState, type IconVariant, } from './core/variants';
11
11
  export { createTimeline, journeyChoreography, type Cue, type CueInput, type Timeline, } from './core/choreography';
package/dist/index.js CHANGED
@@ -53,32 +53,37 @@ var C = "http://www.w3.org/2000/svg", w = (e) => e.replace(/&/g, "&").replac
53
53
  if (e == null) return t;
54
54
  let n = Number.parseFloat(e);
55
55
  return Number.isFinite(n) ? n : t;
56
- }, N = class extends HTMLElement {
57
- static get observedAttributes() {
58
- return k;
59
- }
60
- connectedCallback() {
61
- this.render();
62
- }
63
- attributeChangedCallback() {
64
- this.isConnected && this.render();
65
- }
66
- render() {
67
- let e = j(this.getAttribute("name"));
68
- if (this.replaceChildren(), e === null) return;
69
- let t = this.getAttribute("flip"), n = D(e, {
70
- size: M(this.getAttribute("size"), 24),
71
- strokeWidth: M(this.getAttribute("stroke-width"), 2),
72
- absoluteStrokeWidth: this.hasAttribute("absolute-stroke-width"),
73
- fill: M(this.getAttribute("fill"), 0),
74
- rotate: M(this.getAttribute("rotate"), 0),
75
- ...t === "horizontal" || t === "vertical" || t === "both" ? { flip: t } : {},
76
- ...this.getAttribute("label") == null ? {} : { label: this.getAttribute("label") }
77
- });
78
- n !== null && this.appendChild(n);
79
- }
56
+ }, N = (e, t) => {
57
+ let n = e("flip"), r = e("label");
58
+ return {
59
+ size: M(e("size"), 24),
60
+ strokeWidth: M(e("stroke-width"), 2),
61
+ absoluteStrokeWidth: t("absolute-stroke-width"),
62
+ fill: M(e("fill"), 0),
63
+ rotate: M(e("rotate"), 0),
64
+ ...n === "horizontal" || n === "vertical" || n === "both" ? { flip: n } : {},
65
+ ...r == null ? {} : { label: r }
66
+ };
80
67
  }, P = (e = "lv-icon") => {
81
- typeof window > "u" || typeof customElements > "u" || customElements.get(e) === void 0 && customElements.define(e, N);
68
+ if (typeof window > "u" || typeof customElements > "u" || typeof HTMLElement > "u" || customElements.get(e) !== void 0) return;
69
+ class t extends HTMLElement {
70
+ static get observedAttributes() {
71
+ return k;
72
+ }
73
+ connectedCallback() {
74
+ this.render();
75
+ }
76
+ attributeChangedCallback() {
77
+ this.isConnected && this.render();
78
+ }
79
+ render() {
80
+ let e = j(this.getAttribute("name"));
81
+ if (this.replaceChildren(), e === null) return;
82
+ let t = D(e, N((e) => this.getAttribute(e), (e) => this.hasAttribute(e)));
83
+ t !== null && this.appendChild(t);
84
+ }
85
+ }
86
+ customElements.define(e, t);
82
87
  }, F = (e) => e < .5 ? 4 * e * e * e : 1 - (-2 * e + 2) ** 3 / 2, I = () => {
83
88
  let e = [], t = 0, n = 0, r = !1, i = (n) => {
84
89
  let r = n.duration ?? y.state, i = Math.max(0, t + (n.offset ?? 0));
@@ -151,4 +156,4 @@ var C = "http://www.w3.org/2000/svg", w = (e) => e.replace(/&/g, "&amp;").replac
151
156
  }), n.length > 0 && t.stagger(n, .06), t;
152
157
  };
153
158
  //#endregion
154
- export { g as CANVAS, h as CONTEXT, p as DEFAULT_SIZE, u as DEFAULT_STROKE, y as DURATION, m as EASE, N as LvIconElement, v as STATE_FILL, o as STATE_OPACITY, f as VARIANT_FILL, D as createIcon, I as createTimeline, _ as cssDuration, P as defineIconElement, O as iconDataUri, e as iconGroups, t as iconNames, n as isIconName, L as journeyChoreography, b as opticalStroke, r as paths, d as prefersReducedMotion, E as renderIcon, s as resolveContext, a as resolveDuration, l as resolveFill, i as resolveGeometry, x as resolveStroke, S as resolveTransform, c as resolveVariantFill };
159
+ export { g as CANVAS, h as CONTEXT, p as DEFAULT_SIZE, u as DEFAULT_STROKE, y as DURATION, m as EASE, v as STATE_FILL, o as STATE_OPACITY, f as VARIANT_FILL, D as createIcon, I as createTimeline, _ as cssDuration, P as defineIconElement, O as iconDataUri, e as iconGroups, t as iconNames, n as isIconName, L as journeyChoreography, b as opticalStroke, N as optionsFromAttributes, r as paths, d as prefersReducedMotion, E as renderIcon, s as resolveContext, a as resolveDuration, j as resolveElementName, l as resolveFill, i as resolveGeometry, x as resolveStroke, S as resolveTransform, c as resolveVariantFill };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lovince/icons",
3
- "version": "1.1.0",
3
+ "version": "1.1.1",
4
4
  "description": "A motion-aware icon system for Vue 3 \u2014 24x24 geometry, variable weight and fill, animated state transitions.",
5
5
  "type": "module",
6
6
  "license": "MIT",