@ng-native/icons 0.11.0 → 0.13.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/dist/ng-icon.d.ts CHANGED
@@ -20,7 +20,9 @@
20
20
  * The two things ng-icons expresses in CSS become inputs here. `color` is set on the host, which
21
21
  * is what native paints a `currentColor` brush from - so a bound colour changes every stroke in
22
22
  * the icon without re-parsing it. `strokeWidth` fills in `var(--ng-icon__stroke-width, 1.5)`,
23
- * which is how the heroicons outline set carries its weight.
23
+ * which is how the heroicons outline set carries its weight. `provideNgIconsConfig` sets the
24
+ * defaults of both and of `size`, and `provideNgIconLoader` is asked for a name no `provideIcons`
25
+ * has, as on the web.
24
26
  */
25
27
  import { type Signal } from '@angular/core';
26
28
  import * as i0 from "@angular/core";
@@ -30,6 +32,16 @@ export declare class NgIcon {
30
32
  private readonly engine;
31
33
  /** Every `provideIcons` in scope, innermost last, which is how ng-icons layers them. */
32
34
  private readonly icons;
35
+ /** `provideNgIconsConfig`: the size, colour and stroke width an icon has without its own. */
36
+ private readonly config;
37
+ /** `provideNgIconLoader`: where an icon no `provideIcons` has comes from. */
38
+ private readonly loader;
39
+ /** `withCaching()`: what the loader already answered, so it is asked once per name. */
40
+ private readonly cache;
41
+ private readonly injector;
42
+ private readonly errors;
43
+ /** A static `aria-label`, which labels the icon as `accessibilityLabel` does. */
44
+ private readonly ariaLabel;
33
45
  /** The key the icon was provided under: `heroBookOpen`, or `hero-book-open`. */
34
46
  readonly name: import("@angular/core").InputSignal<string | undefined>;
35
47
  /** Markup, for an icon that comes from somewhere other than a provider. */
@@ -40,13 +52,22 @@ export declare class NgIcon {
40
52
  * text around it, and sized by a `font-size` on it or above it, or by a width and height.
41
53
  */
42
54
  readonly size: import("@angular/core").InputSignalWithTransform<number | undefined, string | number | undefined>;
43
- /** What a `currentColor` stroke or fill paints as. Native resolves it, so binding is cheap. */
55
+ /**
56
+ * What a `currentColor` stroke or fill paints as. It is the host's `color` style, so a `var()`
57
+ * resolves against the tokens in scope, and native paints it, so binding is cheap.
58
+ */
44
59
  readonly color: import("@angular/core").InputSignal<string | undefined>;
45
60
  /** Fills in `var(--ng-icon__stroke-width, …)`, which is how an outline set carries its weight. */
46
61
  readonly strokeWidth: import("@angular/core").InputSignal<string | number | undefined>;
47
62
  /** Absent leaves the icon out of the accessibility tree, which is right for a decorative one. */
48
63
  readonly accessibilityLabel: import("@angular/core").InputSignal<string | undefined>;
49
- /** The size as an inline style, or nothing for the stylesheet's `1em` to stand. */
64
+ /** The label a screen reader reads: the input, or a static `aria-label`. */
65
+ protected readonly label: Signal<string | undefined>;
66
+ /** How many times the icon has asked the loader, so only the newest answer is drawn. */
67
+ private asks;
68
+ /** The markup the loader answered with, and the name it was asked for. */
69
+ private readonly loaded;
70
+ /** The size as an inline style, or nothing for the stylesheet's size to stand. */
50
71
  protected readonly style: Signal<{
51
72
  width?: undefined;
52
73
  height?: undefined;
@@ -60,6 +81,13 @@ export declare class NgIcon {
60
81
  private readonly root;
61
82
  protected readonly viewBox: Signal<Record<string, unknown>>;
62
83
  constructor();
84
+ /** The icon `provideIcons` has under this name, the nearest one first. */
85
+ private provided;
86
+ /** Asks the loader for an icon no `provideIcons` has, as `@ng-icons/core` does. */
87
+ private load;
88
+ /** The loader's answer for a name, through the `withCaching()` cache when there is one. */
89
+ private request;
90
+ private reportMissing;
63
91
  private draw;
64
92
  private append;
65
93
  /**
package/dist/ng-icon.js CHANGED
@@ -20,11 +20,13 @@
20
20
  * The two things ng-icons expresses in CSS become inputs here. `color` is set on the host, which
21
21
  * is what native paints a `currentColor` brush from - so a bound colour changes every stroke in
22
22
  * the icon without re-parsing it. `strokeWidth` fills in `var(--ng-icon__stroke-width, 1.5)`,
23
- * which is how the heroicons outline set carries its weight.
23
+ * which is how the heroicons outline set carries its weight. `provideNgIconsConfig` sets the
24
+ * defaults of both and of `size`, and `provideNgIconLoader` is asked for a name no `provideIcons`
25
+ * has, as on the web.
24
26
  */
25
- import { Component, ElementRef, Renderer2, computed, effect, inject, input, numberAttribute, } from '@angular/core';
27
+ import { Component, ElementRef, ErrorHandler, HostAttributeToken, Injector, Renderer2, computed, effect, inject, input, numberAttribute, runInInjectionContext, signal, untracked, } from '@angular/core';
26
28
  import { claimHost, HostEngine } from '@ng-native/fabric';
27
- import { NgIconsToken } from '@ng-icons/core';
29
+ import { NgIconCacheToken, NgIconConfigToken, NgIconLoaderToken, NgIconsToken, } from '@ng-icons/core';
28
30
  import { parseSvg } from "./parse-svg.js";
29
31
  import { registerSvgComponents } from "./svg-elements.js";
30
32
  import { PAINT, SVG_ELEMENTS, UNDRAWN, gradientProps, isGradient, isTokenPaint, nativeProps, own, stopColor, styleAttributes, textProps, viewBoxProps, } from "./svg-props.js";
@@ -52,12 +54,39 @@ function pointsOf(value) {
52
54
  const points = rem ? Number(rem[1]) * 16 : numberAttribute(px ? px[1] : value, Number.NaN);
53
55
  return Number.isNaN(points) ? undefined : points;
54
56
  }
57
+ /** A loader's answer as a promise: it may be a string, a promise or an observable. */
58
+ function settled(result) {
59
+ if (typeof result === 'string')
60
+ return Promise.resolve(result);
61
+ const observable = result;
62
+ if (typeof observable?.subscribe !== 'function')
63
+ return Promise.resolve(result);
64
+ // The last value once it completes, which is what ng-icons' `toPromise()` waits for.
65
+ return new Promise((resolve, reject) => {
66
+ let last;
67
+ result.subscribe({
68
+ next: (value) => (last = value),
69
+ error: reject,
70
+ complete: () => resolve(last),
71
+ });
72
+ });
73
+ }
55
74
  export class NgIcon {
56
75
  host = inject(ElementRef).nativeElement;
57
76
  renderer = inject(Renderer2);
58
77
  engine = inject(HostEngine);
59
78
  /** Every `provideIcons` in scope, innermost last, which is how ng-icons layers them. */
60
79
  icons = inject(NgIconsToken, { optional: true }) ?? [];
80
+ /** `provideNgIconsConfig`: the size, colour and stroke width an icon has without its own. */
81
+ config = inject(NgIconConfigToken, { optional: true }) ?? {};
82
+ /** `provideNgIconLoader`: where an icon no `provideIcons` has comes from. */
83
+ loader = inject(NgIconLoaderToken, { optional: true });
84
+ /** `withCaching()`: what the loader already answered, so it is asked once per name. */
85
+ cache = inject(NgIconCacheToken, { optional: true });
86
+ injector = inject(Injector);
87
+ errors = inject(ErrorHandler);
88
+ /** A static `aria-label`, which labels the icon as `accessibilityLabel` does. */
89
+ ariaLabel = inject(new HostAttributeToken('aria-label'), { optional: true });
61
90
  /** The key the icon was provided under: `heroBookOpen`, or `hero-book-open`. */
62
91
  name = input(/* @ts-ignore */
63
92
  ...(ngDevMode ? [undefined, { debugName: "name" }] : /* istanbul ignore next */ []));
@@ -69,17 +98,28 @@ export class NgIcon {
69
98
  * `size="32"` is read as the number it spells. With none, the icon is `1em`: as big as the
70
99
  * text around it, and sized by a `font-size` on it or above it, or by a width and height.
71
100
  */
72
- size = input(undefined, { ...(ngDevMode ? { debugName: "size" } : /* istanbul ignore next */ {}), transform: (value) => pointsOf(value) });
73
- /** What a `currentColor` stroke or fill paints as. Native resolves it, so binding is cheap. */
74
- color = input(/* @ts-ignore */
75
- ...(ngDevMode ? [undefined, { debugName: "color" }] : /* istanbul ignore next */ []));
101
+ size = input(pointsOf(this.config.size), { ...(ngDevMode ? { debugName: "size" } : /* istanbul ignore next */ {}), transform: (value) => pointsOf(value) });
102
+ /**
103
+ * What a `currentColor` stroke or fill paints as. It is the host's `color` style, so a `var()`
104
+ * resolves against the tokens in scope, and native paints it, so binding is cheap.
105
+ */
106
+ color = input(this.config.color, /* @ts-ignore */
107
+ ...(ngDevMode ? [{ debugName: "color" }] : /* istanbul ignore next */ []));
76
108
  /** Fills in `var(--ng-icon__stroke-width, …)`, which is how an outline set carries its weight. */
77
- strokeWidth = input(/* @ts-ignore */
78
- ...(ngDevMode ? [undefined, { debugName: "strokeWidth" }] : /* istanbul ignore next */ []));
109
+ strokeWidth = input(this.config.strokeWidth, /* @ts-ignore */
110
+ ...(ngDevMode ? [{ debugName: "strokeWidth" }] : /* istanbul ignore next */ []));
79
111
  /** Absent leaves the icon out of the accessibility tree, which is right for a decorative one. */
80
112
  accessibilityLabel = input(/* @ts-ignore */
81
113
  ...(ngDevMode ? [undefined, { debugName: "accessibilityLabel" }] : /* istanbul ignore next */ []));
82
- /** The size as an inline style, or nothing for the stylesheet's `1em` to stand. */
114
+ /** The label a screen reader reads: the input, or a static `aria-label`. */
115
+ label = computed(() => this.accessibilityLabel() ?? this.ariaLabel ?? undefined, /* @ts-ignore */
116
+ ...(ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []));
117
+ /** How many times the icon has asked the loader, so only the newest answer is drawn. */
118
+ asks = 0;
119
+ /** The markup the loader answered with, and the name it was asked for. */
120
+ loaded = signal(undefined, /* @ts-ignore */
121
+ ...(ngDevMode ? [{ debugName: "loaded" }] : /* istanbul ignore next */ []));
122
+ /** The size as an inline style, or nothing for the stylesheet's size to stand. */
83
123
  style = computed(() => {
84
124
  const size = this.size();
85
125
  return size === undefined ? {} : { width: size, height: size };
@@ -95,17 +135,16 @@ export class NgIcon {
95
135
  const name = this.name();
96
136
  if (name === undefined)
97
137
  return undefined;
98
- const key = toPropertyName(name);
99
- // Reversed, because a nearer `provideIcons` should win over one further up the tree.
100
- for (const set of [...this.icons].reverse()) {
101
- const markup = own(set, key);
102
- if (markup)
103
- return markup;
104
- }
105
- if (typeof ngDevMode !== 'undefined' && ngDevMode) {
106
- console.warn(`[angular-native] no icon named ${name}. Pass it to provideIcons() from the set it ` +
107
- `belongs to, the same way you would on the web.`);
108
- }
138
+ const provided = this.provided(name);
139
+ if (provided)
140
+ return provided;
141
+ const loaded = this.loaded();
142
+ if (loaded?.name === name && loaded.svg)
143
+ return loaded.svg;
144
+ // Still loading: the warning waits for the loader's answer.
145
+ if (this.loader && loaded?.name !== name)
146
+ return undefined;
147
+ this.reportMissing(name);
109
148
  return undefined;
110
149
  }, /* @ts-ignore */
111
150
  ...(ngDevMode ? [{ debugName: "markup" }] : /* istanbul ignore next */ []));
@@ -128,6 +167,58 @@ export class NgIcon {
128
167
  // The shapes are created rather than templated: an icon's tree is data, and a template that
129
168
  // could express it would be a component per tag with a recursive switch between them.
130
169
  effect(() => this.draw());
170
+ effect(() => this.load());
171
+ }
172
+ /** The icon `provideIcons` has under this name, the nearest one first. */
173
+ provided(name) {
174
+ const key = toPropertyName(name);
175
+ // Reversed, because a nearer `provideIcons` should win over one further up the tree.
176
+ for (const set of [...this.icons].reverse()) {
177
+ const markup = own(set, key);
178
+ if (markup)
179
+ return markup;
180
+ }
181
+ return undefined;
182
+ }
183
+ /** Asks the loader for an icon no `provideIcons` has, as `@ng-icons/core` does. */
184
+ load() {
185
+ const name = this.name();
186
+ const ask = ++this.asks;
187
+ if (!this.loader || this.svg() !== undefined || name === undefined)
188
+ return;
189
+ if (this.provided(name))
190
+ return;
191
+ this.request(this.loader, name).then((svg) => {
192
+ // The icon asked again while the loader was answering, so this answer is out of date.
193
+ if (ask === this.asks)
194
+ this.loaded.set({ name, svg });
195
+ }, (error) => this.errors.handleError(error));
196
+ }
197
+ /** The loader's answer for a name, through the `withCaching()` cache when there is one. */
198
+ async request(loader, name) {
199
+ const cached = this.cache?.get(name);
200
+ if (cached !== undefined)
201
+ return cached;
202
+ // Untracked, so a signal the loader reads does not ask it again when that signal changes.
203
+ const answer = settled(untracked(() => runInInjectionContext(this.injector, () => loader(name))));
204
+ this.cache?.set(name, answer);
205
+ try {
206
+ const svg = await answer;
207
+ if (svg !== undefined)
208
+ this.cache?.set(name, svg);
209
+ return svg;
210
+ }
211
+ catch (error) {
212
+ // Not kept, so the next icon with this name asks again.
213
+ this.cache?.delete(name);
214
+ throw error;
215
+ }
216
+ }
217
+ reportMissing(name) {
218
+ if (typeof ngDevMode === 'undefined' || !ngDevMode)
219
+ return;
220
+ console.warn(`[angular-native] no icon named ${name}. Pass it to provideIcons() from the set it ` +
221
+ `belongs to, the same way you would on the web, or load it with provideNgIconLoader().`);
131
222
  }
132
223
  draw() {
133
224
  const root = this.root();
@@ -217,13 +308,13 @@ export class NgIcon {
217
308
  return shape;
218
309
  }
219
310
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.2.0", ngImport: i0, type: NgIcon, deps: [], target: i0.ɵɵFactoryTarget.Component });
220
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.2.0", type: NgIcon, isStandalone: true, selector: "ng-icon", inputs: { name: { classPropertyName: "name", publicName: "name", isSignal: true, isRequired: false, transformFunction: null }, svg: { classPropertyName: "svg", publicName: "svg", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, color: { classPropertyName: "color", publicName: "color", isSignal: true, isRequired: false, transformFunction: null }, strokeWidth: { classPropertyName: "strokeWidth", publicName: "strokeWidth", isSignal: true, isRequired: false, transformFunction: null }, accessibilityLabel: { classPropertyName: "accessibilityLabel", publicName: "accessibilityLabel", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "style": "style()", "color": "color()", "bbWidth": "box()", "bbHeight": "box()", "minX": "viewBox().minX", "minY": "viewBox().minY", "vbWidth": "viewBox().vbWidth", "vbHeight": "viewBox().vbHeight", "align": "viewBox().align", "meetOrSlice": "viewBox().meetOrSlice", "accessible": "accessibilityLabel() !== undefined", "accessibilityRole": "accessibilityLabel() === undefined ? undefined : 'image'", "accessibilityLabel": "accessibilityLabel()" } }, ngImport: i0, template: '', isInline: true, styles: ["\n :host {\n width: 1em;\n height: 1em;\n }\n "] });
311
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.2.0", type: NgIcon, isStandalone: true, selector: "ng-icon", inputs: { name: { classPropertyName: "name", publicName: "name", isSignal: true, isRequired: false, transformFunction: null }, svg: { classPropertyName: "svg", publicName: "svg", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, color: { classPropertyName: "color", publicName: "color", isSignal: true, isRequired: false, transformFunction: null }, strokeWidth: { classPropertyName: "strokeWidth", publicName: "strokeWidth", isSignal: true, isRequired: false, transformFunction: null }, accessibilityLabel: { classPropertyName: "accessibilityLabel", publicName: "accessibilityLabel", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "style": "style()", "style.color": "color()", "bbWidth": "box()", "bbHeight": "box()", "minX": "viewBox().minX", "minY": "viewBox().minY", "vbWidth": "viewBox().vbWidth", "vbHeight": "viewBox().vbHeight", "align": "viewBox().align", "meetOrSlice": "viewBox().meetOrSlice", "accessible": "label() !== undefined", "accessibilityRole": "label() === undefined ? undefined : 'image'", "accessibilityLabel": "label()" } }, ngImport: i0, template: '', isInline: true, styles: ["\n :host {\n width: var(--ng-icon__size, 1em);\n height: var(--ng-icon__size, 1em);\n }\n "] });
221
312
  }
222
313
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.0", ngImport: i0, type: NgIcon, decorators: [{
223
314
  type: Component,
224
315
  args: [{ selector: 'ng-icon', template: '', host: {
225
316
  '[style]': 'style()',
226
- '[color]': 'color()',
317
+ '[style.color]': 'color()',
227
318
  '[bbWidth]': 'box()',
228
319
  '[bbHeight]': 'box()',
229
320
  '[minX]': 'viewBox().minX',
@@ -232,9 +323,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.0", ngImpor
232
323
  '[vbHeight]': 'viewBox().vbHeight',
233
324
  '[align]': 'viewBox().align',
234
325
  '[meetOrSlice]': 'viewBox().meetOrSlice',
235
- '[accessible]': 'accessibilityLabel() !== undefined',
236
- '[accessibilityRole]': "accessibilityLabel() === undefined ? undefined : 'image'",
237
- '[accessibilityLabel]': 'accessibilityLabel()',
238
- }, styles: ["\n :host {\n width: 1em;\n height: 1em;\n }\n "] }]
326
+ '[accessible]': 'label() !== undefined',
327
+ '[accessibilityRole]': "label() === undefined ? undefined : 'image'",
328
+ '[accessibilityLabel]': 'label()',
329
+ }, styles: ["\n :host {\n width: var(--ng-icon__size, 1em);\n height: var(--ng-icon__size, 1em);\n }\n "] }]
239
330
  }], ctorParameters: () => [], propDecorators: { name: [{ type: i0.Input, args: [{ isSignal: true, alias: "name", required: false }] }], svg: [{ type: i0.Input, args: [{ isSignal: true, alias: "svg", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], color: [{ type: i0.Input, args: [{ isSignal: true, alias: "color", required: false }] }], strokeWidth: [{ type: i0.Input, args: [{ isSignal: true, alias: "strokeWidth", required: false }] }], accessibilityLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "accessibilityLabel", required: false }] }] } });
240
331
  //# sourceMappingURL=ng-icon.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ng-icon.js","sourceRoot":"","sources":["../src/ng-icon.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,OAAO,EACL,SAAS,EACT,UAAU,EACV,SAAS,EACT,QAAQ,EACR,MAAM,EACN,MAAM,EACN,KAAK,EACL,eAAe,GAEhB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,SAAS,EAAgC,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACxF,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,QAAQ,EAAgB,MAAM,gBAAgB,CAAC;AACxD,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,EACL,KAAK,EACL,YAAY,EACZ,OAAO,EACP,aAAa,EACb,UAAU,EACV,YAAY,EACZ,WAAW,EACX,GAAG,EACH,SAAS,EACT,eAAe,EACf,SAAS,EACT,YAAY,GACb,MAAM,gBAAgB,CAAC;;AAExB,+EAA+E;AAC/E,MAAM,QAAQ,GAAG,IAAI,GAAG,EAAU,CAAC;AAEnC,+FAA+F;AAC/F,SAAS,cAAc,CAAC,IAAY;IAClC,OAAO,IAAI;SACR,OAAO,CAAC,sBAAsB,EAAE,CAAC,CAAC,EAAE,EAAE,EAAE,SAA6B,EAAE,EAAE,CACxE,SA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,CAAC,KAAK,CAAC,CAAC;gBACrF,SAAS;YACX,OAAO,KAAK,CAAC,KAAK,CAAC,CAAC;QACtB,CAAC;QACD,KAAK,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;YAClD,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC,KAAK,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC;QAChD,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC;uGAnKU,MAAM;2FAAN,MAAM,oyCA5BP,EAAE;;2FA4BD,MAAM;kBA9BlB,SAAS;+BACE,SAAS,YACT,EAAE,QAYN;wBACJ,SAAS,EAAE,SAAS;wBACpB,SAAS,EAAE,SAAS;wBACpB,WAAW,EAAE,OAAO;wBACpB,YAAY,EAAE,OAAO;wBACrB,QAAQ,EAAE,gBAAgB;wBAC1B,QAAQ,EAAE,gBAAgB;wBAC1B,WAAW,EAAE,mBAAmB;wBAChC,YAAY,EAAE,oBAAoB;wBAClC,SAAS,EAAE,iBAAiB;wBAC5B,eAAe,EAAE,uBAAuB;wBACxC,cAAc,EAAE,oCAAoC;wBACpD,qBAAqB,EAAE,0DAA0D;wBACjF,sBAAsB,EAAE,sBAAsB;qBAC/C","sourcesContent":["/**\n * An icon, from the same `@ng-icons` packages a web app uses.\n *\n * An app imports `NgIcon`, provides the icons it uses with ng-icons' own `provideIcons`, and\n * writes `<ng-icon name=\"heroBookOpen\" [size]=\"28\" color=\"#ff9f0a\" />`. The imports are the same\n * ones a web app writes:\n *\n * ```ts\n * import { NgIcon } from '@ng-native/icons';\n * import { provideIcons } from '@ng-icons/core';\n * import { heroBookOpen } from '@ng-icons/heroicons/outline';\n * ```\n *\n * The icon *packages* are the reusable part: each set ships its icons as plain strings of SVG\n * markup, and `provideIcons` is ordinary dependency injection. What cannot be reused is\n * `@ng-icons/core`'s own `NgIcon`, which inserts that markup with `innerHTML` and sizes it with\n * CSS custom properties. This is the same component against react-native-svg's native views: the\n * markup is parsed, translated, and committed as real shapes.\n *\n * The two things ng-icons expresses in CSS become inputs here. `color` is set on the host, which\n * is what native paints a `currentColor` brush from - so a bound colour changes every stroke in\n * the icon without re-parsing it. `strokeWidth` fills in `var(--ng-icon__stroke-width, 1.5)`,\n * which is how the heroicons outline set carries its weight.\n */\nimport {\n Component,\n ElementRef,\n Renderer2,\n computed,\n effect,\n inject,\n input,\n numberAttribute,\n type Signal,\n} from '@angular/core';\nimport { claimHost, type Engine, type EngineNode, HostEngine } from '@ng-native/fabric';\nimport { NgIconsToken } from '@ng-icons/core';\nimport { parseSvg, type SvgNode } from './parse-svg.ts';\nimport { registerSvgComponents } from './svg-elements.ts';\nimport {\n PAINT,\n SVG_ELEMENTS,\n UNDRAWN,\n gradientProps,\n isGradient,\n isTokenPaint,\n nativeProps,\n own,\n stopColor,\n styleAttributes,\n textProps,\n viewBoxProps,\n} from './svg-props.ts';\n\n/** The tags already reported as not drawn, so a list of icons says it once. */\nconst reported = new Set<string>();\n\n/** ng-icons stores icons under a camel-cased key, so `hero-book-open` finds `heroBookOpen`. */\nfunction toPropertyName(name: string): string {\n return name\n .replace(/([^a-zA-Z0-9])+(.)?/g, (_, __, character: string | undefined) =>\n character ? character.toUpperCase() : '',\n )\n .replace(/[^a-zA-Z\\d]/g, '')\n .replace(/^([A-Z])/, (match) => match.toLowerCase());\n}\n\n/**\n * A size in points: a number, a number as a string, or one with the unit a web app writes it\n * with, `18px` or `1.5rem`. Anything else is no size, and the icon is as big as the text around it.\n */\nfunction pointsOf(value: number | string | undefined): number | undefined {\n if (value === undefined || value === '') return undefined;\n const text = typeof value === 'string' ? value.trim() : '';\n const rem = /^([\\d.]+)rem$/.exec(text);\n const px = /^([\\d.]+)px$/.exec(text);\n // `..rem` fits the pattern and is no number: NaN either way, and so no size.\n const points = rem ? Number(rem[1]) * 16 : numberAttribute(px ? px[1] : value, Number.NaN);\n return Number.isNaN(points) ? undefined : points;\n}\n\n@Component({\n selector: 'ng-icon',\n template: '',\n /*\n * With no size it is as big as the text around it, which is what an icon is on the web:\n * `@ng-icons/core` sizes one `1em`, and a library sizes its icons with a font size. A `size`\n * is an inline style, which beats this.\n */\n styles: `\n :host {\n width: 1em;\n height: 1em;\n }\n `,\n host: {\n '[style]': 'style()',\n '[color]': 'color()',\n '[bbWidth]': 'box()',\n '[bbHeight]': 'box()',\n '[minX]': 'viewBox().minX',\n '[minY]': 'viewBox().minY',\n '[vbWidth]': 'viewBox().vbWidth',\n '[vbHeight]': 'viewBox().vbHeight',\n '[align]': 'viewBox().align',\n '[meetOrSlice]': 'viewBox().meetOrSlice',\n '[accessible]': 'accessibilityLabel() !== undefined',\n '[accessibilityRole]': \"accessibilityLabel() === undefined ? undefined : 'image'\",\n '[accessibilityLabel]': 'accessibilityLabel()',\n },\n})\nexport class NgIcon {\n private readonly host = inject(ElementRef).nativeElement as EngineNode;\n private readonly renderer = inject(Renderer2);\n private readonly engine = inject(HostEngine);\n /** Every `provideIcons` in scope, innermost last, which is how ng-icons layers them. */\n private readonly icons = inject(NgIconsToken, { optional: true }) ?? [];\n\n /** The key the icon was provided under: `heroBookOpen`, or `hero-book-open`. */\n readonly name = input<string>();\n /** Markup, for an icon that comes from somewhere other than a provider. */\n readonly svg = input<string>();\n /**\n * Points, square. Icons are drawn from a `viewBox`, so this is the size on screen. A static\n * `size=\"32\"` is read as the number it spells. With none, the icon is `1em`: as big as the\n * text around it, and sized by a `font-size` on it or above it, or by a width and height.\n */\n readonly size = input(undefined, {\n transform: (value: number | string | undefined) => pointsOf(value),\n });\n /** What a `currentColor` stroke or fill paints as. Native resolves it, so binding is cheap. */\n readonly color = input<string>();\n /** Fills in `var(--ng-icon__stroke-width, …)`, which is how an outline set carries its weight. */\n readonly strokeWidth = input<number | string>();\n /** Absent leaves the icon out of the accessibility tree, which is right for a decorative one. */\n readonly accessibilityLabel = input<string>();\n\n /** The size as an inline style, or nothing for the stylesheet's `1em` to stand. */\n protected readonly style = computed(() => {\n const size = this.size();\n return size === undefined ? {} : { width: size, height: size };\n });\n /** What the view scales its drawing to: the size, or the whole of the box it is laid out as. */\n protected readonly box = computed(() => this.size() ?? '100%');\n\n private readonly markup: Signal<string | undefined> = computed(() => {\n const svg = this.svg();\n if (svg !== undefined) return svg;\n const name = this.name();\n if (name === undefined) return undefined;\n\n const key = toPropertyName(name);\n // Reversed, because a nearer `provideIcons` should win over one further up the tree.\n for (const set of [...this.icons].reverse()) {\n const markup = own(set, key);\n if (markup) return markup;\n }\n if (typeof ngDevMode !== 'undefined' && ngDevMode) {\n console.warn(\n `[angular-native] no icon named ${name}. Pass it to provideIcons() from the set it ` +\n `belongs to, the same way you would on the web.`,\n );\n }\n return undefined;\n });\n\n private readonly root = computed(() => {\n const markup = this.markup();\n return markup === undefined ? null : parseSvg(markup);\n });\n\n protected readonly viewBox = computed(() => viewBoxProps(this.root()?.attrs['viewBox']));\n\n constructor() {\n // Before the first shape is created, which is before this component's own commit.\n registerSvgComponents();\n // Claimed, and stripped of the attributes Angular wrote from static inputs: `name` is one of\n // ours *and* one of react-native-svg's, so leaving it there hands native an element name.\n claimHost(this.host);\n for (const input of Object.keys(\n (NgIcon as { ɵcmp?: { inputs?: object } }).ɵcmp?.inputs ?? {},\n )) {\n delete this.host.props[input];\n }\n // The shapes are created rather than templated: an icon's tree is data, and a template that\n // could express it would be a component per tag with a recursive switch between them.\n effect(() => this.draw());\n }\n\n private draw(): void {\n const root = this.root();\n for (const child of [...this.host.children]) this.renderer.removeChild(this.host, child);\n if (!root) return;\n\n // Everything hangs off one group carrying the root's presentation attributes, which is how\n // react-native-svg's own `Svg` does it: the svg view itself holds no paint, so a root that\n // says `stroke=\"currentColor\"` needs a group for its children to inherit from.\n const group = this.create('svg-g', root);\n for (const child of root.children) this.append(group, child);\n this.renderer.appendChild(this.host, group);\n }\n\n private append(parent: unknown, node: SvgNode): void {\n const element = own(SVG_ELEMENTS, node.tag);\n if (!element) return this.reportUndrawn(node.tag);\n const shape = this.create(element, node);\n for (const child of node.children) this.append(shape, child);\n this.renderer.appendChild(parent, shape);\n }\n\n /**\n * A `currentColor` stop is settled here from the `color` input, where a `currentColor` brush is\n * painted by native from the colour the cascade gives the icon. With no input it is black.\n */\n private reportUntintedStop(gradient: SvgNode): void {\n if (typeof ngDevMode === 'undefined' || !ngDevMode) return;\n if (this.color() !== undefined || reported.has('currentColor')) return;\n if (!gradient.children.some((stop) => stopColor(stop.attrs) === 'currentColor')) return;\n reported.add('currentColor');\n console.warn(\n '[angular-native] <ng-icon> paints a gradient stop written as currentColor from its ' +\n '`color` input, and this icon has none, so the stop is black. Set `color` on the icon.',\n );\n }\n\n /** An incomplete drawing with no message is the hardest failure to track down. */\n private reportUndrawn(tag: string): void {\n if (typeof ngDevMode === 'undefined' || !ngDevMode) return;\n if (UNDRAWN.has(tag) || reported.has(tag)) return;\n reported.add(tag);\n const drawn = ['svg', ...Object.keys(SVG_ELEMENTS), 'stop'].filter((name) => name !== '#text');\n console.warn(\n `[angular-native] <ng-icon> does not draw <${tag}>, so it is left out of the icon. ` +\n `It draws ${drawn.slice(0, -1).join(', ')} and ${drawn.at(-1)}.`,\n );\n }\n\n /** The native props of one element: a gradient's, a text's, or a shape's. */\n private propsOf(node: SvgNode, attrs: Record<string, string>): Record<string, unknown> {\n const context = { color: (value: string) => this.engine.color(value) };\n if (isGradient(node.tag)) {\n this.reportUntintedStop(node);\n return gradientProps(node, context, this.color());\n }\n const props = nativeProps(node.tag, attrs, context);\n if (node.tag === '#text') return { ...props, content: node.text };\n return node.tag === 'text' || node.tag === 'tspan' ? { ...props, ...textProps(attrs) } : props;\n }\n\n private create(element: string, node: SvgNode): unknown {\n const shape = this.renderer.createElement(element) as EngineNode;\n // Created here rather than by a template, so nothing else will account for it: without this\n // the engine reports every shape as an element whose component was forgotten.\n claimHost(shape);\n const attrs = {\n ...node.attrs,\n // A `style` attribute is where ng-icons puts the stroke width, as a custom property.\n ...styleAttributes(node.attrs['style'] ?? '', {\n '--ng-icon__stroke-width': this.strokeWidth(),\n }),\n };\n const props = this.propsOf(node, attrs);\n // A paint that reads a custom property is settled by the cascade, with the tokens in scope\n // for the shape, and follows them. It stays in `propList`, which says the shape has one.\n const cascade = this.engine as Partial<Pick<Engine, 'setBoundStyle'>>;\n for (const paint of PAINT) {\n if (!isTokenPaint(attrs[paint]) || !cascade.setBoundStyle?.(shape, paint, attrs[paint]))\n continue;\n delete props[paint];\n }\n for (const [prop, value] of Object.entries(props)) {\n this.renderer.setProperty(shape, prop, value);\n }\n return shape;\n }\n}\n"]}
1
+ {"version":3,"file":"ng-icon.js","sourceRoot":"","sources":["../src/ng-icon.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,OAAO,EACL,SAAS,EACT,UAAU,EACV,YAAY,EACZ,kBAAkB,EAClB,QAAQ,EACR,SAAS,EACT,QAAQ,EACR,MAAM,EACN,MAAM,EACN,KAAK,EACL,eAAe,EACf,qBAAqB,EACrB,MAAM,EACN,SAAS,GAEV,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,SAAS,EAAgC,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACxF,OAAO,EACL,gBAAgB,EAChB,iBAAiB,EACjB,iBAAiB,EACjB,YAAY,GAEb,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,QAAQ,EAAgB,MAAM,gBAAgB,CAAC;AACxD,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,EACL,KAAK,EACL,YAAY,EACZ,OAAO,EACP,aAAa,EACb,UAAU,EACV,YAAY,EACZ,WAAW,EACX,GAAG,EACH,SAAS,EACT,eAAe,EACf,SAAS,EACT,YAAY,GACb,MAAM,gBAAgB,CAAC;;AAExB,+EAA+E;AAC/E,MAAM,QAAQ,GAAG,IAAI,GAAG,EAAU,CAAC;AAEnC,+FAA+F;AAC/F,SAAS,cAAc,CAAC,IAAY;IAClC,OAAO,IAAI;SACR,OAAO,CAAC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AE,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC;gBACrF,SAAS;YACX,OAAO,KAAK,CAAC,KAAK,CAAC,CAAC;QACtB,CAAC;QACD,KAAK,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;YAClD,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC,KAAK,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC;QAChD,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC;uGA7OU,MAAM;2FAAN,MAAM,mwCA7BP,EAAE;;2FA6BD,MAAM;kBA/BlB,SAAS;+BACE,SAAS,YACT,EAAE,QAaN;wBACJ,SAAS,EAAE,SAAS;wBACpB,eAAe,EAAE,SAAS;wBAC1B,WAAW,EAAE,OAAO;wBACpB,YAAY,EAAE,OAAO;wBACrB,QAAQ,EAAE,gBAAgB;wBAC1B,QAAQ,EAAE,gBAAgB;wBAC1B,WAAW,EAAE,mBAAmB;wBAChC,YAAY,EAAE,oBAAoB;wBAClC,SAAS,EAAE,iBAAiB;wBAC5B,eAAe,EAAE,uBAAuB;wBACxC,cAAc,EAAE,uBAAuB;wBACvC,qBAAqB,EAAE,6CAA6C;wBACpE,sBAAsB,EAAE,SAAS;qBAClC","sourcesContent":["/**\n * An icon, from the same `@ng-icons` packages a web app uses.\n *\n * An app imports `NgIcon`, provides the icons it uses with ng-icons' own `provideIcons`, and\n * writes `<ng-icon name=\"heroBookOpen\" [size]=\"28\" color=\"#ff9f0a\" />`. The imports are the same\n * ones a web app writes:\n *\n * ```ts\n * import { NgIcon } from '@ng-native/icons';\n * import { provideIcons } from '@ng-icons/core';\n * import { heroBookOpen } from '@ng-icons/heroicons/outline';\n * ```\n *\n * The icon *packages* are the reusable part: each set ships its icons as plain strings of SVG\n * markup, and `provideIcons` is ordinary dependency injection. What cannot be reused is\n * `@ng-icons/core`'s own `NgIcon`, which inserts that markup with `innerHTML` and sizes it with\n * CSS custom properties. This is the same component against react-native-svg's native views: the\n * markup is parsed, translated, and committed as real shapes.\n *\n * The two things ng-icons expresses in CSS become inputs here. `color` is set on the host, which\n * is what native paints a `currentColor` brush from - so a bound colour changes every stroke in\n * the icon without re-parsing it. `strokeWidth` fills in `var(--ng-icon__stroke-width, 1.5)`,\n * which is how the heroicons outline set carries its weight. `provideNgIconsConfig` sets the\n * defaults of both and of `size`, and `provideNgIconLoader` is asked for a name no `provideIcons`\n * has, as on the web.\n */\nimport {\n Component,\n ElementRef,\n ErrorHandler,\n HostAttributeToken,\n Injector,\n Renderer2,\n computed,\n effect,\n inject,\n input,\n numberAttribute,\n runInInjectionContext,\n signal,\n untracked,\n type Signal,\n} from '@angular/core';\nimport { claimHost, type Engine, type EngineNode, HostEngine } from '@ng-native/fabric';\nimport {\n NgIconCacheToken,\n NgIconConfigToken,\n NgIconLoaderToken,\n NgIconsToken,\n type NgIconLoader,\n} from '@ng-icons/core';\nimport { parseSvg, type SvgNode } from './parse-svg.ts';\nimport { registerSvgComponents } from './svg-elements.ts';\nimport {\n PAINT,\n SVG_ELEMENTS,\n UNDRAWN,\n gradientProps,\n isGradient,\n isTokenPaint,\n nativeProps,\n own,\n stopColor,\n styleAttributes,\n textProps,\n viewBoxProps,\n} from './svg-props.ts';\n\n/** The tags already reported as not drawn, so a list of icons says it once. */\nconst reported = new Set<string>();\n\n/** ng-icons stores icons under a camel-cased key, so `hero-book-open` finds `heroBookOpen`. */\nfunction toPropertyName(name: string): string {\n return name\n .replace(/([^a-zA-Z0-9])+(.)?/g, (_, __, character: string | undefined) =>\n character ? character.toUpperCase() : '',\n )\n .replace(/[^a-zA-Z\\d]/g, '')\n .replace(/^([A-Z])/, (match) => match.toLowerCase());\n}\n\n/**\n * A size in points: a number, a number as a string, or one with the unit a web app writes it\n * with, `18px` or `1.5rem`. Anything else is no size, and the icon is as big as the text around it.\n */\nfunction pointsOf(value: number | string | undefined): number | undefined {\n if (value === undefined || value === '') return undefined;\n const text = typeof value === 'string' ? value.trim() : '';\n const rem = /^([\\d.]+)rem$/.exec(text);\n const px = /^([\\d.]+)px$/.exec(text);\n // `..rem` fits the pattern and is no number: NaN either way, and so no size.\n const points = rem ? Number(rem[1]) * 16 : numberAttribute(px ? px[1] : value, Number.NaN);\n return Number.isNaN(points) ? undefined : points;\n}\n\n/** A loader's answer as a promise: it may be a string, a promise or an observable. */\nfunction settled(result: unknown): Promise<string | undefined> {\n if (typeof result === 'string') return Promise.resolve(result);\n const observable = result as { subscribe?: unknown } | null;\n if (typeof observable?.subscribe !== 'function')\n return Promise.resolve(result as Promise<string>);\n // The last value once it completes, which is what ng-icons' `toPromise()` waits for.\n return new Promise((resolve, reject) => {\n let last: string | undefined;\n (result as { subscribe(observer: object): void }).subscribe({\n next: (value: string) => (last = value),\n error: reject,\n complete: () => resolve(last),\n });\n });\n}\n\n@Component({\n selector: 'ng-icon',\n template: '',\n /*\n * With no size it is as big as the text around it, which is what an icon is on the web:\n * `@ng-icons/core` sizes one `1em`, and a library sizes its icons with a font size. An\n * `<ng-icon-stack size>` sets `--ng-icon__size` for the icons in it. A `size` is an inline\n * style, which beats both.\n */\n styles: `\n :host {\n width: var(--ng-icon__size, 1em);\n height: var(--ng-icon__size, 1em);\n }\n `,\n host: {\n '[style]': 'style()',\n '[style.color]': 'color()',\n '[bbWidth]': 'box()',\n '[bbHeight]': 'box()',\n '[minX]': 'viewBox().minX',\n '[minY]': 'viewBox().minY',\n '[vbWidth]': 'viewBox().vbWidth',\n '[vbHeight]': 'viewBox().vbHeight',\n '[align]': 'viewBox().align',\n '[meetOrSlice]': 'viewBox().meetOrSlice',\n '[accessible]': 'label() !== undefined',\n '[accessibilityRole]': \"label() === undefined ? undefined : 'image'\",\n '[accessibilityLabel]': 'label()',\n },\n})\nexport class NgIcon {\n private readonly host = inject(ElementRef).nativeElement as EngineNode;\n private readonly renderer = inject(Renderer2);\n private readonly engine = inject(HostEngine);\n /** Every `provideIcons` in scope, innermost last, which is how ng-icons layers them. */\n private readonly icons = inject(NgIconsToken, { optional: true }) ?? [];\n /** `provideNgIconsConfig`: the size, colour and stroke width an icon has without its own. */\n private readonly config = inject(NgIconConfigToken, { optional: true }) ?? {};\n /** `provideNgIconLoader`: where an icon no `provideIcons` has comes from. */\n private readonly loader = inject(NgIconLoaderToken, { optional: true });\n /** `withCaching()`: what the loader already answered, so it is asked once per name. */\n private readonly cache = inject(NgIconCacheToken, { optional: true });\n private readonly injector = inject(Injector);\n private readonly errors = inject(ErrorHandler);\n /** A static `aria-label`, which labels the icon as `accessibilityLabel` does. */\n private readonly ariaLabel = inject(new HostAttributeToken('aria-label'), { optional: true });\n\n /** The key the icon was provided under: `heroBookOpen`, or `hero-book-open`. */\n readonly name = input<string>();\n /** Markup, for an icon that comes from somewhere other than a provider. */\n readonly svg = input<string>();\n /**\n * Points, square. Icons are drawn from a `viewBox`, so this is the size on screen. A static\n * `size=\"32\"` is read as the number it spells. With none, the icon is `1em`: as big as the\n * text around it, and sized by a `font-size` on it or above it, or by a width and height.\n */\n readonly size = input(pointsOf(this.config.size), {\n transform: (value: number | string | undefined) => pointsOf(value),\n });\n /**\n * What a `currentColor` stroke or fill paints as. It is the host's `color` style, so a `var()`\n * resolves against the tokens in scope, and native paints it, so binding is cheap.\n */\n readonly color = input<string | undefined>(this.config.color);\n /** Fills in `var(--ng-icon__stroke-width, …)`, which is how an outline set carries its weight. */\n readonly strokeWidth = input<number | string | undefined>(this.config.strokeWidth);\n /** Absent leaves the icon out of the accessibility tree, which is right for a decorative one. */\n readonly accessibilityLabel = input<string>();\n\n /** The label a screen reader reads: the input, or a static `aria-label`. */\n protected readonly label = computed(\n () => this.accessibilityLabel() ?? this.ariaLabel ?? undefined,\n );\n /** How many times the icon has asked the loader, so only the newest answer is drawn. */\n private asks = 0;\n /** The markup the loader answered with, and the name it was asked for. */\n private readonly loaded = signal<{ name: string; svg: string | undefined } | undefined>(\n undefined,\n );\n\n /** The size as an inline style, or nothing for the stylesheet's size to stand. */\n protected readonly style = computed(() => {\n const size = this.size();\n return size === undefined ? {} : { width: size, height: size };\n });\n /** What the view scales its drawing to: the size, or the whole of the box it is laid out as. */\n protected readonly box = computed(() => this.size() ?? '100%');\n\n private readonly markup: Signal<string | undefined> = computed(() => {\n const svg = this.svg();\n if (svg !== undefined) return svg;\n const name = this.name();\n if (name === undefined) return undefined;\n\n const provided = this.provided(name);\n if (provided) return provided;\n const loaded = this.loaded();\n if (loaded?.name === name && loaded.svg) return loaded.svg;\n // Still loading: the warning waits for the loader's answer.\n if (this.loader && loaded?.name !== name) return undefined;\n this.reportMissing(name);\n return undefined;\n });\n\n private readonly root = computed(() => {\n const markup = this.markup();\n return markup === undefined ? null : parseSvg(markup);\n });\n\n protected readonly viewBox = computed(() => viewBoxProps(this.root()?.attrs['viewBox']));\n\n constructor() {\n // Before the first shape is created, which is before this component's own commit.\n registerSvgComponents();\n // Claimed, and stripped of the attributes Angular wrote from static inputs: `name` is one of\n // ours *and* one of react-native-svg's, so leaving it there hands native an element name.\n claimHost(this.host);\n for (const input of Object.keys(\n (NgIcon as { ɵcmp?: { inputs?: object } }).ɵcmp?.inputs ?? {},\n )) {\n delete this.host.props[input];\n }\n // The shapes are created rather than templated: an icon's tree is data, and a template that\n // could express it would be a component per tag with a recursive switch between them.\n effect(() => this.draw());\n effect(() => this.load());\n }\n\n /** The icon `provideIcons` has under this name, the nearest one first. */\n private provided(name: string): string | undefined {\n const key = toPropertyName(name);\n // Reversed, because a nearer `provideIcons` should win over one further up the tree.\n for (const set of [...this.icons].reverse()) {\n const markup = own(set, key);\n if (markup) return markup;\n }\n return undefined;\n }\n\n /** Asks the loader for an icon no `provideIcons` has, as `@ng-icons/core` does. */\n private load(): void {\n const name = this.name();\n const ask = ++this.asks;\n if (!this.loader || this.svg() !== undefined || name === undefined) return;\n if (this.provided(name)) return;\n this.request(this.loader, name).then(\n (svg) => {\n // The icon asked again while the loader was answering, so this answer is out of date.\n if (ask === this.asks) this.loaded.set({ name, svg });\n },\n (error: unknown) => this.errors.handleError(error),\n );\n }\n\n /** The loader's answer for a name, through the `withCaching()` cache when there is one. */\n private async request(loader: NgIconLoader, name: string): Promise<string | undefined> {\n const cached = this.cache?.get(name);\n if (cached !== undefined) return cached;\n // Untracked, so a signal the loader reads does not ask it again when that signal changes.\n const answer = settled(\n untracked(() => runInInjectionContext(this.injector, () => loader(name))),\n );\n this.cache?.set(name, answer as Promise<string>);\n try {\n const svg = await answer;\n if (svg !== undefined) this.cache?.set(name, svg);\n return svg;\n } catch (error) {\n // Not kept, so the next icon with this name asks again.\n this.cache?.delete(name);\n throw error;\n }\n }\n\n private reportMissing(name: string): void {\n if (typeof ngDevMode === 'undefined' || !ngDevMode) return;\n console.warn(\n `[angular-native] no icon named ${name}. Pass it to provideIcons() from the set it ` +\n `belongs to, the same way you would on the web, or load it with provideNgIconLoader().`,\n );\n }\n\n private draw(): void {\n const root = this.root();\n for (const child of [...this.host.children]) this.renderer.removeChild(this.host, child);\n if (!root) return;\n\n // Everything hangs off one group carrying the root's presentation attributes, which is how\n // react-native-svg's own `Svg` does it: the svg view itself holds no paint, so a root that\n // says `stroke=\"currentColor\"` needs a group for its children to inherit from.\n const group = this.create('svg-g', root);\n for (const child of root.children) this.append(group, child);\n this.renderer.appendChild(this.host, group);\n }\n\n private append(parent: unknown, node: SvgNode): void {\n const element = own(SVG_ELEMENTS, node.tag);\n if (!element) return this.reportUndrawn(node.tag);\n const shape = this.create(element, node);\n for (const child of node.children) this.append(shape, child);\n this.renderer.appendChild(parent, shape);\n }\n\n /**\n * A `currentColor` stop is settled here from the `color` input, where a `currentColor` brush is\n * painted by native from the colour the cascade gives the icon. With no input it is black.\n */\n private reportUntintedStop(gradient: SvgNode): void {\n if (typeof ngDevMode === 'undefined' || !ngDevMode) return;\n if (this.color() !== undefined || reported.has('currentColor')) return;\n if (!gradient.children.some((stop) => stopColor(stop.attrs) === 'currentColor')) return;\n reported.add('currentColor');\n console.warn(\n '[angular-native] <ng-icon> paints a gradient stop written as currentColor from its ' +\n '`color` input, and this icon has none, so the stop is black. Set `color` on the icon.',\n );\n }\n\n /** An incomplete drawing with no message is the hardest failure to track down. */\n private reportUndrawn(tag: string): void {\n if (typeof ngDevMode === 'undefined' || !ngDevMode) return;\n if (UNDRAWN.has(tag) || reported.has(tag)) return;\n reported.add(tag);\n const drawn = ['svg', ...Object.keys(SVG_ELEMENTS), 'stop'].filter((name) => name !== '#text');\n console.warn(\n `[angular-native] <ng-icon> does not draw <${tag}>, so it is left out of the icon. ` +\n `It draws ${drawn.slice(0, -1).join(', ')} and ${drawn.at(-1)}.`,\n );\n }\n\n /** The native props of one element: a gradient's, a text's, or a shape's. */\n private propsOf(node: SvgNode, attrs: Record<string, string>): Record<string, unknown> {\n const context = { color: (value: string) => this.engine.color(value) };\n if (isGradient(node.tag)) {\n this.reportUntintedStop(node);\n return gradientProps(node, context, this.color());\n }\n const props = nativeProps(node.tag, attrs, context);\n if (node.tag === '#text') return { ...props, content: node.text };\n return node.tag === 'text' || node.tag === 'tspan' ? { ...props, ...textProps(attrs) } : props;\n }\n\n private create(element: string, node: SvgNode): unknown {\n const shape = this.renderer.createElement(element) as EngineNode;\n // Created here rather than by a template, so nothing else will account for it: without this\n // the engine reports every shape as an element whose component was forgotten.\n claimHost(shape);\n const attrs = {\n ...node.attrs,\n // A `style` attribute is where ng-icons puts the stroke width, as a custom property.\n ...styleAttributes(node.attrs['style'] ?? '', {\n '--ng-icon__stroke-width': this.strokeWidth(),\n }),\n };\n const props = this.propsOf(node, attrs);\n // A paint that reads a custom property is settled by the cascade, with the tokens in scope\n // for the shape, and follows them. It stays in `propList`, which says the shape has one.\n const cascade = this.engine as Partial<Pick<Engine, 'setBoundStyle'>>;\n for (const paint of PAINT) {\n if (!isTokenPaint(attrs[paint]) || !cascade.setBoundStyle?.(shape, paint, attrs[paint]))\n continue;\n delete props[paint];\n }\n for (const [prop, value] of Object.entries(props)) {\n this.renderer.setProperty(shape, prop, value);\n }\n return shape;\n }\n}\n"]}
@@ -26,6 +26,9 @@ const SVG_VIEW_NAMES = {
26
26
  'svg-rect': 'RNSVGRect',
27
27
  'svg-line': 'RNSVGLine',
28
28
  'svg-defs': 'RNSVGDefs',
29
+ 'svg-mask': 'RNSVGMask',
30
+ 'svg-clip-path': 'RNSVGClipPath',
31
+ 'svg-use': 'RNSVGUse',
29
32
  'svg-linear-gradient': 'RNSVGLinearGradient',
30
33
  'svg-radial-gradient': 'RNSVGRadialGradient',
31
34
  'svg-text': 'RNSVGText',
@@ -1 +1 @@
1
- {"version":3,"file":"svg-elements.js","sourceRoot":"","sources":["../src/svg-elements.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAErE;;;;;;;;GAQG;AACH,MAAM,cAAc,GAA2B;IAC7C,OAAO,EAAE,YAAY;IACrB,UAAU,EAAE,WAAW;IACvB,YAAY,EAAE,aAAa;IAC3B,aAAa,EAAE,cAAc;IAC7B,UAAU,EAAE,WAAW;IACvB,UAAU,EAAE,WAAW;IACvB,UAAU,EAAE,WAAW;IACvB,qBAAqB,EAAE,qBAAqB;IAC5C,qBAAqB,EAAE,qBAAqB;IAC5C,UAAU,EAAE,WAAW;IACvB,WAAW,EAAE,YAAY;CAC1B,CAAC;AAEF,IAAI,UAAU,GAAG,KAAK,CAAC;AAEvB;;;;;;;GAOG;AACH,MAAM,UAAU,qBAAqB;IACnC,IAAI,UAAU;QAAE,OAAO;IACvB,UAAU,GAAG,IAAI,CAAC;IAClB,gBAAgB,CACd,SAAS,EACT,cAAc,EAAE,KAAK,SAAS,CAAC,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,cAAc,CACxE,CAAC;IACF,KAAK,MAAM,CAAC,OAAO,EAAE,QAAQ,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,cAAc,CAAC,EAAE,CAAC;QACjE,gBAAgB,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;IACtC,CAAC;AACH,CAAC","sourcesContent":["/**\n * react-native-svg, driven directly.\n *\n * The same arrangement as react-native-screens in the router: the native side is a set of\n * codegen'd Fabric components, and their React wrappers are unreachable, so the engine is taught\n * the element names and the shapes are created with `createElement`. The app installs\n * `react-native-svg` for the native half; none of its JavaScript is imported.\n *\n * No decorators here: tests import this at runtime.\n */\nimport { nativePlatform, registerViewName } from '@ng-native/fabric';\n\n/**\n * Element name -> Fabric component. Lowercase, because the compiler drops a template with a\n * capitalized element name, and prefixed, because `path` and\n * `line` are words an app might reasonably want for a component of its own.\n *\n * The root is the one that differs per platform: iOS draws into `RNSVGSvgView`, Android into\n * `RNSVGSvgViewAndroid`, and react-native-svg keeps them as separate specs because their props\n * are not the same.\n */\nconst SVG_VIEW_NAMES: Record<string, string> = {\n 'svg-g': 'RNSVGGroup',\n 'svg-path': 'RNSVGPath',\n 'svg-circle': 'RNSVGCircle',\n 'svg-ellipse': 'RNSVGEllipse',\n 'svg-rect': 'RNSVGRect',\n 'svg-line': 'RNSVGLine',\n 'svg-defs': 'RNSVGDefs',\n 'svg-linear-gradient': 'RNSVGLinearGradient',\n 'svg-radial-gradient': 'RNSVGRadialGradient',\n 'svg-text': 'RNSVGText',\n 'svg-tspan': 'RNSVGTSpan',\n};\n\nlet registered = false;\n\n/**\n * Teach the engine the shape elements and `ng-icon`, `NgIcon`'s own host, as the root. Called by\n * `NgIcon`, so importing it is the whole setup - the same lesson as `AnimatedStyle`, which stopped\n * needing a bootstrap provider for the same reason.\n *\n * A name the native side does not know renders as `UnimplementedNativeView` rather than erroring,\n * so an app that has not installed `react-native-svg` sees blank boxes where its icons were.\n */\nexport function registerSvgComponents(): void {\n if (registered) return;\n registered = true;\n registerViewName(\n 'ng-icon',\n nativePlatform() === 'android' ? 'RNSVGSvgViewAndroid' : 'RNSVGSvgView',\n );\n for (const [element, viewName] of Object.entries(SVG_VIEW_NAMES)) {\n registerViewName(element, viewName);\n }\n}\n"]}
1
+ {"version":3,"file":"svg-elements.js","sourceRoot":"","sources":["../src/svg-elements.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAErE;;;;;;;;GAQG;AACH,MAAM,cAAc,GAA2B;IAC7C,OAAO,EAAE,YAAY;IACrB,UAAU,EAAE,WAAW;IACvB,YAAY,EAAE,aAAa;IAC3B,aAAa,EAAE,cAAc;IAC7B,UAAU,EAAE,WAAW;IACvB,UAAU,EAAE,WAAW;IACvB,UAAU,EAAE,WAAW;IACvB,UAAU,EAAE,WAAW;IACvB,eAAe,EAAE,eAAe;IAChC,SAAS,EAAE,UAAU;IACrB,qBAAqB,EAAE,qBAAqB;IAC5C,qBAAqB,EAAE,qBAAqB;IAC5C,UAAU,EAAE,WAAW;IACvB,WAAW,EAAE,YAAY;CAC1B,CAAC;AAEF,IAAI,UAAU,GAAG,KAAK,CAAC;AAEvB;;;;;;;GAOG;AACH,MAAM,UAAU,qBAAqB;IACnC,IAAI,UAAU;QAAE,OAAO;IACvB,UAAU,GAAG,IAAI,CAAC;IAClB,gBAAgB,CACd,SAAS,EACT,cAAc,EAAE,KAAK,SAAS,CAAC,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,cAAc,CACxE,CAAC;IACF,KAAK,MAAM,CAAC,OAAO,EAAE,QAAQ,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,cAAc,CAAC,EAAE,CAAC;QACjE,gBAAgB,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;IACtC,CAAC;AACH,CAAC","sourcesContent":["/**\n * react-native-svg, driven directly.\n *\n * The same arrangement as react-native-screens in the router: the native side is a set of\n * codegen'd Fabric components, and their React wrappers are unreachable, so the engine is taught\n * the element names and the shapes are created with `createElement`. The app installs\n * `react-native-svg` for the native half; none of its JavaScript is imported.\n *\n * No decorators here: tests import this at runtime.\n */\nimport { nativePlatform, registerViewName } from '@ng-native/fabric';\n\n/**\n * Element name -> Fabric component. Lowercase, because the compiler drops a template with a\n * capitalized element name, and prefixed, because `path` and\n * `line` are words an app might reasonably want for a component of its own.\n *\n * The root is the one that differs per platform: iOS draws into `RNSVGSvgView`, Android into\n * `RNSVGSvgViewAndroid`, and react-native-svg keeps them as separate specs because their props\n * are not the same.\n */\nconst SVG_VIEW_NAMES: Record<string, string> = {\n 'svg-g': 'RNSVGGroup',\n 'svg-path': 'RNSVGPath',\n 'svg-circle': 'RNSVGCircle',\n 'svg-ellipse': 'RNSVGEllipse',\n 'svg-rect': 'RNSVGRect',\n 'svg-line': 'RNSVGLine',\n 'svg-defs': 'RNSVGDefs',\n 'svg-mask': 'RNSVGMask',\n 'svg-clip-path': 'RNSVGClipPath',\n 'svg-use': 'RNSVGUse',\n 'svg-linear-gradient': 'RNSVGLinearGradient',\n 'svg-radial-gradient': 'RNSVGRadialGradient',\n 'svg-text': 'RNSVGText',\n 'svg-tspan': 'RNSVGTSpan',\n};\n\nlet registered = false;\n\n/**\n * Teach the engine the shape elements and `ng-icon`, `NgIcon`'s own host, as the root. Called by\n * `NgIcon`, so importing it is the whole setup - the same lesson as `AnimatedStyle`, which stopped\n * needing a bootstrap provider for the same reason.\n *\n * A name the native side does not know renders as `UnimplementedNativeView` rather than erroring,\n * so an app that has not installed `react-native-svg` sees blank boxes where its icons were.\n */\nexport function registerSvgComponents(): void {\n if (registered) return;\n registered = true;\n registerViewName(\n 'ng-icon',\n nativePlatform() === 'android' ? 'RNSVGSvgViewAndroid' : 'RNSVGSvgView',\n );\n for (const [element, viewName] of Object.entries(SVG_VIEW_NAMES)) {\n registerViewName(element, viewName);\n }\n}\n"]}
package/dist/svg-props.js CHANGED
@@ -36,6 +36,9 @@ export const SVG_ELEMENTS = {
36
36
  polyline: 'svg-path',
37
37
  polygon: 'svg-path',
38
38
  defs: 'svg-defs',
39
+ mask: 'svg-mask',
40
+ clipPath: 'svg-clip-path',
41
+ use: 'svg-use',
39
42
  linearGradient: 'svg-linear-gradient',
40
43
  radialGradient: 'svg-radial-gradient',
41
44
  text: 'svg-text',
@@ -52,8 +55,10 @@ const GEOMETRY = {
52
55
  ellipse: ['cx', 'cy', 'rx', 'ry'],
53
56
  rect: ['x', 'y', 'width', 'height', 'rx', 'ry'],
54
57
  line: ['x1', 'y1', 'x2', 'y2'],
58
+ mask: ['x', 'y', 'width', 'height'],
59
+ use: ['x', 'y', 'width', 'height'],
55
60
  };
56
- /** A shape's geometry, as written, and 0 for what react-native-svg defaults and it left out. */
61
+ /** A shape's geometry, as written, and the default for what it left out. */
57
62
  function geometry(tag, attrs, props) {
58
63
  for (const name of own(GEOMETRY, tag) ?? []) {
59
64
  if (attrs[name] !== undefined)
@@ -61,6 +66,10 @@ function geometry(tag, attrs, props) {
61
66
  }
62
67
  for (const name of own(ZERO_BY_DEFAULT, tag) ?? [])
63
68
  props[name] ??= 0;
69
+ if (tag !== 'mask')
70
+ return;
71
+ for (const [name, value] of Object.entries(MASK_AREA))
72
+ props[name] ??= value;
64
73
  }
65
74
  /**
66
75
  * The geometry each shape defaults to 0 when absent, as react-native-svg's `Rect`, `Circle`,
@@ -72,7 +81,21 @@ const ZERO_BY_DEFAULT = {
72
81
  ellipse: ['cx', 'cy', 'rx', 'ry'],
73
82
  rect: ['x', 'y', 'width', 'height'],
74
83
  line: ['x1', 'y1', 'x2', 'y2'],
84
+ use: ['x', 'y', 'width', 'height'],
75
85
  };
86
+ /** The area a mask covers when the markup does not say, which is SVG's default. */
87
+ const MASK_AREA = { x: '-10%', y: '-10%', width: '120%', height: '120%' };
88
+ const MASK_TYPE = { luminance: 0, alpha: 1 };
89
+ /** A mask's units and type, as the integers react-native-svg's `Mask` sends. */
90
+ function maskProps(attrs) {
91
+ return {
92
+ maskUnits: own(GRADIENT_UNITS, attrs['maskUnits'] ?? '') ?? 0,
93
+ maskContentUnits: own(GRADIENT_UNITS, attrs['maskContentUnits'] ?? '') ?? 1,
94
+ maskType: own(MASK_TYPE, attrs['mask-type'] ?? '') ?? 0,
95
+ };
96
+ }
97
+ /** The id in `url(#id)` or `#id`, the form a reference to another element is written in. */
98
+ const referenceOf = (value) => value === undefined ? undefined : (URL_REFERENCE.exec(value) ?? /^#(.+)$/.exec(value))?.[1];
76
99
  /** SVG attribute -> native prop, for the presentation attributes shapes and groups share. */
77
100
  const PRESENTATION = {
78
101
  fill: 'fill',
@@ -360,6 +383,7 @@ export function nativeProps(tag, attrs, context) {
360
383
  if (propList.length > 0)
361
384
  props['propList'] = propList;
362
385
  geometry(tag, attrs, props);
386
+ references(tag, attrs, props);
363
387
  if (tag === 'polyline' || tag === 'polygon') {
364
388
  props['d'] = pointsToPath(attrs['points'] ?? '', tag === 'polygon');
365
389
  }
@@ -370,6 +394,24 @@ export function nativeProps(tag, attrs, context) {
370
394
  }
371
395
  return props;
372
396
  }
397
+ /**
398
+ * How elements point at each other: an element's `id` is the `name` native knows it by, and a
399
+ * `mask`, a `clip-path` and a `<use>` name the element they use, as react-native-svg sends them.
400
+ */
401
+ function references(tag, attrs, props) {
402
+ if (attrs['id'])
403
+ props['name'] = attrs['id'];
404
+ const mask = referenceOf(attrs['mask']);
405
+ if (mask)
406
+ props['mask'] = mask;
407
+ const clipPath = referenceOf(attrs['clip-path']);
408
+ if (clipPath)
409
+ props['clipPath'] = clipPath;
410
+ if (tag === 'mask')
411
+ Object.assign(props, maskProps(attrs));
412
+ if (tag === 'use')
413
+ props['href'] = referenceOf(attrs['href'] ?? attrs['xlink:href']);
414
+ }
373
415
  /**
374
416
  * The props react-native-svg's Android view manager declares as `float` rather than `Dynamic`,
375
417
  * with the default it applies when the prop is absent.
@@ -399,15 +441,25 @@ function presentationValue(prop, value, context) {
399
441
  if (prop === 'fillRule' || prop === 'clipRule')
400
442
  return own(FILL_RULE, value) ?? 1;
401
443
  if (prop === 'strokeDasharray')
402
- return value
403
- .trim()
404
- .split(/[\s,]+/)
405
- .filter(Boolean);
444
+ return dashes(value);
406
445
  return prop in NUMERIC ? numberFor(prop, value) : value;
407
446
  }
447
+ /** A dash pattern as a list of lengths, or null for `none`, which is a solid line. */
448
+ function dashes(value) {
449
+ if (value.trim() === 'none')
450
+ return null;
451
+ return value
452
+ .trim()
453
+ .split(/[\s,]+/)
454
+ .filter(Boolean);
455
+ }
456
+ const OPACITY = new Set(['opacity', 'fillOpacity', 'strokeOpacity']);
408
457
  /** The attribute as the float Android's view manager takes, or the default it applies. */
409
458
  function numberFor(prop, value) {
410
459
  const number = Number.parseFloat(value);
411
- return Number.isNaN(number) ? NUMERIC[prop] : number;
460
+ if (Number.isNaN(number))
461
+ return NUMERIC[prop];
462
+ // `50%` is half, for an opacity, as react-native-svg's `extractOpacity` reads it.
463
+ return OPACITY.has(prop) && value.trim().endsWith('%') ? number / 100 : number;
412
464
  }
413
465
  //# sourceMappingURL=svg-props.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"svg-props.js","sourceRoot":"","sources":["../src/svg-props.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AASH,MAAM,OAAO,GAA2B,EAAE,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC;AACzE,MAAM,QAAQ,GAA2B,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC;AAC1E,MAAM,SAAS,GAA2B,EAAE,OAAO,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;AAErE,MAAM,aAAa,GAAG,gBAAgB,CAAC;AAEvC,yGAAyG;AACzG,MAAM,UAAU,GAAG,CAAI,KAAkC,EAAE,GAAW;IACpE,OAAO,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;AAC5D,CAAC;AAED;;;GAGG;AACH,MAAM,CAAC,MAAM,YAAY,GAA2B;IAClD,CAAC,EAAE,OAAO;IACV,IA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AO,CAAC,CAAC;IACzE,IAAI,IAAI,KAAK,eAAe;QAAE,OAAO,GAAG,CAAC,OAAO,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC;IAC9D,IAAI,IAAI,KAAK,gBAAgB;QAAE,OAAO,GAAG,CAAC,QAAQ,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC;IAChE,IAAI,IAAI,KAAK,UAAU,IAAI,IAAI,KAAK,UAAU;QAAE,OAAO,GAAG,CAAC,SAAS,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC;IAClF,IAAI,IAAI,KAAK,iBAAiB;QAC5B,OAAO,KAAK;aACT,IAAI,EAAE;aACN,KAAK,CAAC,QAAQ,CAAC;aACf,MAAM,CAAC,OAAO,CAAC,CAAC;IACrB,OAAO,IAAI,IAAI,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;AAC1D,CAAC;AAED,0FAA0F;AAC1F,SAAS,SAAS,CAAC,IAAY,EAAE,KAAa;IAC5C,MAAM,MAAM,GAAG,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;IACxC,OAAO,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAE,CAAC,CAAC,CAAC,MAAM,CAAC;AACxD,CAAC","sourcesContent":["/**\n * SVG attributes to the props react-native-svg's native views actually take.\n *\n * They are not the same thing, and the difference is the whole reason this file exists. `fill`\n * and `stroke` are not colours but *brushes*, a tagged struct that says whether the paint is a\n * colour, the view's own `color`, or a reference to a gradient. `stroke-linecap`, `stroke-linejoin`\n * and `fill-rule` are integers, not the keywords they are written as. And a shape has to declare\n * which props it set - `propList` - because anything absent is inherited from the group above it,\n * which is exactly how an icon whose root carries `stroke=\"currentColor\"` paints its paths.\n *\n * Send the attributes through unchanged and every one of those reads as nothing at all, with no\n * error: the shape draws in the default black, or does not draw.\n *\n * All of this is what react-native-svg does in JavaScript before its props reach native. Its\n * components are React, so this is the same translation rather than a call into it.\n */\n\n/** The paint on a shape: a colour, the view's own colour, or a reference to a gradient. */\nexport type Brush =\n | null\n | { readonly type: 0; readonly payload: unknown }\n | { readonly type: 1; readonly brushRef: string }\n | { readonly type: 2 };\n\nconst LINECAP: Record<string, number> = { butt: 0, round: 1, square: 2 };\nconst LINEJOIN: Record<string, number> = { miter: 0, round: 1, bevel: 2 };\nconst FILL_RULE: Record<string, number> = { evenodd: 0, nonzero: 1 };\n\nconst URL_REFERENCE = /^url\\(#(.+)\\)$/;\n\n/** `table[key]`, but never off `Object.prototype`: a tag or attribute named `constructor` is unknown. */\nexport function own<T>(table: Readonly<Record<string, T>>, key: string): T | undefined {\n return Object.hasOwn(table, key) ? table[key] : undefined;\n}\n\n/**\n * Which element each SVG tag commits as. `polyline` and `polygon` are paths: react-native-svg has\n * no component for either and converts their points to a `d`, so this does too.\n */\nexport const SVG_ELEMENTS: Record<string, string> = {\n g: 'svg-g',\n path: 'svg-path',\n circle: 'svg-circle',\n ellipse: 'svg-ellipse',\n rect: 'svg-rect',\n line: 'svg-line',\n polyline: 'svg-path',\n polygon: 'svg-path',\n defs: 'svg-defs',\n linearGradient: 'svg-linear-gradient',\n radialGradient: 'svg-radial-gradient',\n text: 'svg-text',\n tspan: 'svg-tspan',\n // The characters of a text: react-native-svg draws them as a span of their own.\n '#text': 'svg-tspan',\n};\n\n/** The tags that are no view and are not missed: a label, and what a gradient reads itself. */\nexport const UNDRAWN: ReadonlySet<string> = new Set(['title', 'desc', 'stop']);\n\n/** Geometry, per tag. Everything else on a shape is presentation and shared. */\nconst GEOMETRY: Record<string, readonly string[]> = {\n path: ['d'],\n circle: ['cx', 'cy', 'r'],\n ellipse: ['cx', 'cy', 'rx', 'ry'],\n rect: ['x', 'y', 'width', 'height', 'rx', 'ry'],\n line: ['x1', 'y1', 'x2', 'y2'],\n};\n\n/** A shape's geometry, as written, and 0 for what react-native-svg defaults and it left out. */\nfunction geometry(\n tag: string,\n attrs: Readonly<Record<string, string>>,\n props: Record<string, unknown>,\n): void {\n for (const name of own(GEOMETRY, tag) ?? []) {\n if (attrs[name] !== undefined) props[name] = attrs[name];\n }\n for (const name of own(ZERO_BY_DEFAULT, tag) ?? []) props[name] ??= 0;\n}\n\n/**\n * The geometry each shape defaults to 0 when absent, as react-native-svg's `Rect`, `Circle`,\n * `Ellipse` and `Line` do before they commit. Android's shape views read a missing length as null\n * and crash drawing it, and design tools often leave out a `y=\"0\"`.\n */\nconst ZERO_BY_DEFAULT: Record<string, readonly string[]> = {\n circle: ['cx', 'cy', 'r'],\n ellipse: ['cx', 'cy', 'rx', 'ry'],\n rect: ['x', 'y', 'width', 'height'],\n line: ['x1', 'y1', 'x2', 'y2'],\n};\n\n/** SVG attribute -> native prop, for the presentation attributes shapes and groups share. */\nconst PRESENTATION: Record<string, string> = {\n fill: 'fill',\n 'fill-opacity': 'fillOpacity',\n 'fill-rule': 'fillRule',\n stroke: 'stroke',\n 'stroke-opacity': 'strokeOpacity',\n 'stroke-width': 'strokeWidth',\n 'stroke-linecap': 'strokeLinecap',\n 'stroke-linejoin': 'strokeLinejoin',\n 'stroke-dasharray': 'strokeDasharray',\n 'stroke-dashoffset': 'strokeDashoffset',\n 'stroke-miterlimit': 'strokeMiterlimit',\n 'clip-rule': 'clipRule',\n opacity: 'opacity',\n};\n\n/** The presentation attributes that are a paint. */\nexport const PAINT: ReadonlySet<string> = new Set(['fill', 'stroke']);\n\n/** Whether a paint is a `var()`, which only the cascade can settle. */\nexport const isTokenPaint = (value: string | undefined): value is string =>\n value !== undefined && /^\\s*var\\(/i.test(value);\n\nexport interface SvgContext {\n /** The host's colour conversion, which a brush payload is the result of. */\n color(value: string): unknown;\n}\n\nexport function brushOf(value: string, context: SvgContext): Brush {\n if (value === 'none') return null;\n // Deliberately kept as a brush rather than resolved here: native paints it from the view's own\n // `color`, so a bound `[color]` on the icon changes every `currentColor` shape without a\n // re-parse.\n if (value === 'currentColor') return { type: 2 };\n const reference = URL_REFERENCE.exec(value);\n if (reference) return { type: 1, brushRef: reference[1]! };\n return { type: 0, payload: context.color(value) };\n}\n\nconst GRADIENT_UNITS: Record<string, number> = { objectBoundingBox: 0, userSpaceOnUse: 1 };\n\n/** Where a gradient runs when the markup does not say, as react-native-svg's components default. */\nconst GRADIENT_LINE: Record<string, Readonly<Record<string, string>>> = {\n linearGradient: { x1: '0%', y1: '0%', x2: '100%', y2: '0%' },\n radialGradient: { cx: '50%', cy: '50%' },\n};\n\nexport const isGradient = (tag: string): boolean => Object.hasOwn(GRADIENT_LINE, tag);\n\n/**\n * A gradient's native props: its name, where it runs, and its stops.\n *\n * A `<stop>` is not a view. react-native-svg reads the stops in JavaScript and hands the gradient\n * one flat list, `[offset, colour, offset, colour]`, in offset order, each colour a single number\n * with the stop's opacity in its alpha. `currentColor` is the colour passed in: native has no\n * brush for it inside a gradient, so it is settled here.\n */\nexport function gradientProps(\n node: { tag: string; attrs: Readonly<Record<string, string>>; children: readonly SvgNodeLike[] },\n context: SvgContext,\n currentColor?: string,\n): Record<string, unknown> {\n const { attrs } = node;\n const stops = node.children\n .filter((child) => child.tag === 'stop')\n .map((stop) => stopOf(stop.attrs, context, currentColor))\n .filter((stop) => stop !== null)\n .sort((a, b) => a[0] - b[0]);\n return {\n name: attrs['id'],\n ...gradientLine(node.tag, attrs),\n gradient: stops.flat(),\n gradientUnits: own(GRADIENT_UNITS, attrs['gradientUnits'] ?? '') ?? 0,\n gradientTransform: transformMatrix(attrs['gradientTransform'] ?? '') ?? null,\n };\n}\n\n/** Where a gradient runs: what the markup set, over what react-native-svg defaults. */\nfunction gradientLine(\n tag: string,\n attrs: Readonly<Record<string, string>>,\n): Record<string, unknown> {\n const line: Record<string, unknown> = { ...own(GRADIENT_LINE, tag) };\n for (const name of Object.keys(line)) line[name] = attrs[name] ?? line[name];\n if (tag !== 'radialGradient') return line;\n const radius = attrs['r'] ?? '50%';\n return {\n ...line,\n rx: attrs['rx'] ?? radius,\n ry: attrs['ry'] ?? radius,\n fx: attrs['fx'] ?? line['cx'],\n fy: attrs['fy'] ?? line['cy'],\n };\n}\n\ninterface SvgNodeLike {\n readonly tag: string;\n readonly attrs: Readonly<Record<string, string>>;\n}\n\n/** The stop colour of a stop, from its attribute or its `style`. */\nexport const stopColor = (attrs: Readonly<Record<string, string>>): string =>\n /(?:^|;)\\s*stop-color\\s*:\\s*([^;]+)/.exec(attrs['style'] ?? '')?.[1]?.trim() ??\n attrs['stop-color'] ??\n '#000';\n\n/**\n * One stop as `[offset, colour]`, its attributes read from its `style` where they are there, or\n * null for a colour the host cannot convert, such as a `var()`: native takes a list of numbers,\n * and one that is not there would be worse than a stop left out.\n */\nfunction stopOf(\n attrs: Readonly<Record<string, string>>,\n context: SvgContext,\n currentColor: string | undefined,\n): [number, unknown] | null {\n const all = { ...attrs, ...styleAttributes(attrs['style'] ?? '', {}) };\n const written = stopColor(attrs);\n const colour = context.color(written === 'currentColor' ? (currentColor ?? '#000') : written);\n if (colour === null || colour === undefined) return null;\n return [fraction(all['offset'], 0), withOpacity(colour, fraction(all['stop-opacity'], 1))];\n}\n\n/** A number or a percentage as a fraction, or the fallback for one that is neither. */\nfunction fraction(value: string | undefined, fallback: number): number {\n const number = Number.parseFloat(value ?? '');\n if (Number.isNaN(number)) return fallback;\n return value!.trim().endsWith('%') ? number / 100 : number;\n}\n\n/**\n * A processed colour at a fraction of its own opacity: a device's is one number, AARRGGBB, and\n * the web host's is the CSS colour it was given, which a mix with nothing fades the same way.\n */\nfunction withOpacity(colour: unknown, fraction: number): unknown {\n const opacity = Math.min(1, Math.max(0, fraction));\n if (typeof colour !== 'number') {\n return opacity === 1 ? colour : `color-mix(in srgb, ${colour} ${opacity * 100}%, transparent)`;\n }\n const alpha = Math.round((colour >>> 24) * opacity);\n return (colour & 0x00ffffff) | (alpha << 24);\n}\n\n/** SVG attribute -> key of the `font` object react-native-svg's text views read. */\nconst FONT: Record<string, string> = {\n 'font-size': 'fontSize',\n 'font-weight': 'fontWeight',\n 'font-style': 'fontStyle',\n 'font-family': 'fontFamily',\n 'font-variant': 'fontVariant',\n 'font-stretch': 'fontStretch',\n 'text-anchor': 'textAnchor',\n 'text-decoration': 'textDecoration',\n 'letter-spacing': 'letterSpacing',\n 'word-spacing': 'wordSpacing',\n kerning: 'kerning',\n};\n\nconst lengthList = (value: string | undefined): string[] =>\n value === undefined\n ? []\n : value\n .trim()\n .split(/[\\s,]+/)\n .filter(Boolean);\n\n/**\n * What a `text` or a `tspan` takes beside its paint: its font as one object, and each of its\n * positions as a list, since SVG places a glyph at a time. The first family of a `font-family` is\n * the one asked for, as react-native-svg reads it.\n */\nexport function textProps(attrs: Readonly<Record<string, string>>): Record<string, unknown> {\n const font: Record<string, string> = {};\n for (const [name, value] of Object.entries(attrs)) {\n const key = own(FONT, name);\n if (!key) continue;\n font[key] =\n key === 'fontFamily'\n ? value\n .split(',')[0]!\n .trim()\n .replace(/^[\"']|[\"']$/g, '')\n : value;\n }\n return {\n x: lengthList(attrs['x']),\n y: lengthList(attrs['y']),\n dx: lengthList(attrs['dx']),\n dy: lengthList(attrs['dy']),\n rotate: lengthList(attrs['rotate']),\n font,\n };\n}\n\n/** `M x,y L x,y ...`, which is what a polyline or polygon is once native sees it. */\nexport function pointsToPath(points: string, close: boolean): string {\n const numbers = points\n .trim()\n .split(/[\\s,]+/)\n .filter(Boolean);\n let path = '';\n for (let index = 0; index + 1 < numbers.length; index += 2) {\n path += `${index === 0 ? 'M' : 'L'}${numbers[index]},${numbers[index + 1]}`;\n }\n return close && path ? `${path}Z` : path;\n}\n\n/** `stroke-width:2;opacity:.5` as attributes, with `var(--name, fallback)` resolved. */\nexport function styleAttributes(\n style: string,\n variables: Readonly<Record<string, string | number | undefined>>,\n): Record<string, string> {\n const attrs: Record<string, string> = {};\n for (const declaration of style.split(';')) {\n const colon = declaration.indexOf(':');\n if (colon === -1) continue;\n const name = declaration.slice(0, colon).trim();\n const value = declaration.slice(colon + 1).trim();\n // A paint's `var()` is kept as written: the cascade settles it, with the tokens in scope.\n const resolved = resolveVar(value, variables) ?? (PAINT.has(name) ? value : undefined);\n if (name && resolved !== undefined) attrs[name] = resolved;\n }\n return attrs;\n}\n\nfunction resolveVar(\n value: string,\n variables: Readonly<Record<string, string | number | undefined>>,\n): string | undefined {\n const match = /^var\\(\\s*(--[\\w-]+)\\s*(?:,\\s*([^)]*))?\\)$/.exec(value);\n if (!match) return value;\n const supplied = variables[match[1]!];\n if (supplied !== undefined) return String(supplied);\n return match[2]?.trim() || undefined;\n}\n\n/** The four numbers of a `viewBox`, as the props the svg view takes them as. */\nexport function viewBoxProps(viewBox: string | undefined): Record<string, unknown> {\n if (!viewBox) return {};\n const parts = viewBox.trim().replace(/,/g, ' ').split(/\\s+/).map(Number);\n if (parts.length !== 4 || parts.some(Number.isNaN)) return {};\n const [minX, minY, vbWidth, vbHeight] = parts;\n return { minX, minY, vbWidth, vbHeight, align: 'xMidYMid', meetOrSlice: 0 };\n}\n\nconst TRANSFORM = /([a-zA-Z]+)\\s*\\(([^)]*)\\)/g;\n\n/**\n * A `transform` attribute as a 2x3 matrix, which is the only form native takes.\n *\n * Rare in icon sets - one occurrence across bootstrap-icons and lucide, and that one is already a\n * `matrix()` - but a shape drawn in the wrong place is worse than one not drawn, so the other\n * three forms compose rather than being ignored.\n */\nexport function transformMatrix(transform: string): number[] | undefined {\n let matrix: number[] | undefined;\n TRANSFORM.lastIndex = 0;\n let match: RegExpExecArray | null;\n while ((match = TRANSFORM.exec(transform)) !== null) {\n const values = match[2]!\n .trim()\n .split(/[\\s,]+/)\n .map(Number);\n const next = matrixFor(match[1]!, values);\n if (next) matrix = matrix ? multiply(matrix, next) : next;\n }\n return matrix;\n}\n\n/** `translate(4)` and `scale(2)` mean something for the missing argument; `rotate(90)` means 0. */\nconst at = (values: number[], index: number, fallback: number) => values[index] ?? fallback;\n\nfunction matrixFor(name: string, values: number[]): number[] | undefined {\n const first = at(values, 0, 0);\n if (name === 'matrix') return values.length === 6 ? values : undefined;\n if (name === 'translate') return [1, 0, 0, 1, first, at(values, 1, 0)];\n if (name === 'scale') return [first, 0, 0, at(values, 1, first), 0, 0];\n if (name === 'rotate') return rotation(first, at(values, 1, 0), at(values, 2, 0));\n return undefined;\n}\n\nfunction rotation(degrees: number, cx: number, cy: number): number[] {\n const radians = (degrees * Math.PI) / 180;\n const cos = Math.cos(radians);\n const sin = Math.sin(radians);\n // Rotating about a point is the rotation with the point moved to the origin and back.\n return [cos, sin, -sin, cos, cx - cos * cx + sin * cy, cy - sin * cx - cos * cy];\n}\n\n/** `[a, b, c, d, tx, ty]`, in SVG's own order. */\nfunction multiply(left: number[], right: number[]): number[] {\n const [a1, b1, c1, d1, e1, f1] = left as [number, number, number, number, number, number];\n const [a2, b2, c2, d2, e2, f2] = right as [number, number, number, number, number, number];\n return [\n a1 * a2 + c1 * b2,\n b1 * a2 + d1 * b2,\n a1 * c2 + c1 * d2,\n b1 * c2 + d1 * d2,\n a1 * e2 + c1 * f2 + e1,\n b1 * e2 + d1 * f2 + f1,\n ];\n}\n\n/**\n * One element's native props.\n *\n * `propList` is the load-bearing part: it names the props this element set itself, and native\n * inherits everything else from the group above. Omit it and a path with no `fill` of its own\n * paints black instead of the colour its parent carries.\n */\nexport function nativeProps(\n tag: string,\n attrs: Readonly<Record<string, string>>,\n context: SvgContext,\n): Record<string, unknown> {\n const props: Record<string, unknown> = {};\n const propList: string[] = [];\n\n for (const [name, value] of Object.entries(attrs)) {\n const prop = own(PRESENTATION, name);\n if (!prop) continue;\n props[prop] = presentationValue(prop, value, context);\n propList.push(prop);\n }\n if (propList.length > 0) props['propList'] = propList;\n\n geometry(tag, attrs, props);\n if (tag === 'polyline' || tag === 'polygon') {\n props['d'] = pointsToPath(attrs['points'] ?? '', tag === 'polygon');\n }\n if (attrs['transform']) {\n const matrix = transformMatrix(attrs['transform']);\n if (matrix) props['matrix'] = matrix;\n }\n return props;\n}\n\n/**\n * The props react-native-svg's Android view manager declares as `float` rather than `Dynamic`,\n * with the default it applies when the prop is absent.\n *\n * `Dynamic` reads whatever arrives, so an SVG attribute can stay the string it was written as -\n * which is what `strokeWidth` and every geometry attribute do. These five cannot: the Android\n * manager takes a `float` parameter, and a string reaching one throws `java.lang.String cannot be\n * cast to java.lang.Double` out of `setProperty` while the view is being created, which takes the\n * whole screen down. iOS never noticed, because folly's `dynamic` coerces a numeric string on the\n * way into a `Float` prop. react-native-svg's own JavaScript sends numbers here too, through\n * `extractOpacity`, so this is the same translation and not an Android workaround.\n */\nconst NUMERIC: Record<string, number> = {\n opacity: 1,\n fillOpacity: 1,\n strokeOpacity: 1,\n strokeDashoffset: 0,\n strokeMiterlimit: 4,\n};\n\nfunction presentationValue(prop: string, value: string, context: SvgContext): unknown {\n if (prop === 'fill' || prop === 'stroke') return brushOf(value, context);\n if (prop === 'strokeLinecap') return own(LINECAP, value) ?? 0;\n if (prop === 'strokeLinejoin') return own(LINEJOIN, value) ?? 0;\n if (prop === 'fillRule' || prop === 'clipRule') return own(FILL_RULE, value) ?? 1;\n if (prop === 'strokeDasharray')\n return value\n .trim()\n .split(/[\\s,]+/)\n .filter(Boolean);\n return prop in NUMERIC ? numberFor(prop, value) : value;\n}\n\n/** The attribute as the float Android's view manager takes, or the default it applies. */\nfunction numberFor(prop: string, value: string): number {\n const number = Number.parseFloat(value);\n return Number.isNaN(number) ? NUMERIC[prop]! : number;\n}\n"]}
1
+ {"version":3,"file":"svg-props.js","sourceRoot":"","sources":["../src/svg-props.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AASH,MAAM,OAAO,GAA2B,EAAE,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC;AACzE,MAAM,QAAQ,GAA2B,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC;AAC1E,MAAM,SAAS,GAA2B,EAAE,OAAO,EAAE,CAAC,EA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C,CAAC,MAAM,GAAG,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC;AACjF,CAAC","sourcesContent":["/**\n * SVG attributes to the props react-native-svg's native views actually take.\n *\n * They are not the same thing, and the difference is the whole reason this file exists. `fill`\n * and `stroke` are not colours but *brushes*, a tagged struct that says whether the paint is a\n * colour, the view's own `color`, or a reference to a gradient. `stroke-linecap`, `stroke-linejoin`\n * and `fill-rule` are integers, not the keywords they are written as. And a shape has to declare\n * which props it set - `propList` - because anything absent is inherited from the group above it,\n * which is exactly how an icon whose root carries `stroke=\"currentColor\"` paints its paths.\n *\n * Send the attributes through unchanged and every one of those reads as nothing at all, with no\n * error: the shape draws in the default black, or does not draw.\n *\n * All of this is what react-native-svg does in JavaScript before its props reach native. Its\n * components are React, so this is the same translation rather than a call into it.\n */\n\n/** The paint on a shape: a colour, the view's own colour, or a reference to a gradient. */\nexport type Brush =\n | null\n | { readonly type: 0; readonly payload: unknown }\n | { readonly type: 1; readonly brushRef: string }\n | { readonly type: 2 };\n\nconst LINECAP: Record<string, number> = { butt: 0, round: 1, square: 2 };\nconst LINEJOIN: Record<string, number> = { miter: 0, round: 1, bevel: 2 };\nconst FILL_RULE: Record<string, number> = { evenodd: 0, nonzero: 1 };\n\nconst URL_REFERENCE = /^url\\(#(.+)\\)$/;\n\n/** `table[key]`, but never off `Object.prototype`: a tag or attribute named `constructor` is unknown. */\nexport function own<T>(table: Readonly<Record<string, T>>, key: string): T | undefined {\n return Object.hasOwn(table, key) ? table[key] : undefined;\n}\n\n/**\n * Which element each SVG tag commits as. `polyline` and `polygon` are paths: react-native-svg has\n * no component for either and converts their points to a `d`, so this does too.\n */\nexport const SVG_ELEMENTS: Record<string, string> = {\n g: 'svg-g',\n path: 'svg-path',\n circle: 'svg-circle',\n ellipse: 'svg-ellipse',\n rect: 'svg-rect',\n line: 'svg-line',\n polyline: 'svg-path',\n polygon: 'svg-path',\n defs: 'svg-defs',\n mask: 'svg-mask',\n clipPath: 'svg-clip-path',\n use: 'svg-use',\n linearGradient: 'svg-linear-gradient',\n radialGradient: 'svg-radial-gradient',\n text: 'svg-text',\n tspan: 'svg-tspan',\n // The characters of a text: react-native-svg draws them as a span of their own.\n '#text': 'svg-tspan',\n};\n\n/** The tags that are no view and are not missed: a label, and what a gradient reads itself. */\nexport const UNDRAWN: ReadonlySet<string> = new Set(['title', 'desc', 'stop']);\n\n/** Geometry, per tag. Everything else on a shape is presentation and shared. */\nconst GEOMETRY: Record<string, readonly string[]> = {\n path: ['d'],\n circle: ['cx', 'cy', 'r'],\n ellipse: ['cx', 'cy', 'rx', 'ry'],\n rect: ['x', 'y', 'width', 'height', 'rx', 'ry'],\n line: ['x1', 'y1', 'x2', 'y2'],\n mask: ['x', 'y', 'width', 'height'],\n use: ['x', 'y', 'width', 'height'],\n};\n\n/** A shape's geometry, as written, and the default for what it left out. */\nfunction geometry(\n tag: string,\n attrs: Readonly<Record<string, string>>,\n props: Record<string, unknown>,\n): void {\n for (const name of own(GEOMETRY, tag) ?? []) {\n if (attrs[name] !== undefined) props[name] = attrs[name];\n }\n for (const name of own(ZERO_BY_DEFAULT, tag) ?? []) props[name] ??= 0;\n if (tag !== 'mask') return;\n for (const [name, value] of Object.entries(MASK_AREA)) props[name] ??= value;\n}\n\n/**\n * The geometry each shape defaults to 0 when absent, as react-native-svg's `Rect`, `Circle`,\n * `Ellipse` and `Line` do before they commit. Android's shape views read a missing length as null\n * and crash drawing it, and design tools often leave out a `y=\"0\"`.\n */\nconst ZERO_BY_DEFAULT: Record<string, readonly string[]> = {\n circle: ['cx', 'cy', 'r'],\n ellipse: ['cx', 'cy', 'rx', 'ry'],\n rect: ['x', 'y', 'width', 'height'],\n line: ['x1', 'y1', 'x2', 'y2'],\n use: ['x', 'y', 'width', 'height'],\n};\n\n/** The area a mask covers when the markup does not say, which is SVG's default. */\nconst MASK_AREA = { x: '-10%', y: '-10%', width: '120%', height: '120%' };\n\nconst MASK_TYPE: Record<string, number> = { luminance: 0, alpha: 1 };\n\n/** A mask's units and type, as the integers react-native-svg's `Mask` sends. */\nfunction maskProps(attrs: Readonly<Record<string, string>>): Record<string, number> {\n return {\n maskUnits: own(GRADIENT_UNITS, attrs['maskUnits'] ?? '') ?? 0,\n maskContentUnits: own(GRADIENT_UNITS, attrs['maskContentUnits'] ?? '') ?? 1,\n maskType: own(MASK_TYPE, attrs['mask-type'] ?? '') ?? 0,\n };\n}\n\n/** The id in `url(#id)` or `#id`, the form a reference to another element is written in. */\nconst referenceOf = (value: string | undefined): string | undefined =>\n value === undefined ? undefined : (URL_REFERENCE.exec(value) ?? /^#(.+)$/.exec(value))?.[1];\n\n/** SVG attribute -> native prop, for the presentation attributes shapes and groups share. */\nconst PRESENTATION: Record<string, string> = {\n fill: 'fill',\n 'fill-opacity': 'fillOpacity',\n 'fill-rule': 'fillRule',\n stroke: 'stroke',\n 'stroke-opacity': 'strokeOpacity',\n 'stroke-width': 'strokeWidth',\n 'stroke-linecap': 'strokeLinecap',\n 'stroke-linejoin': 'strokeLinejoin',\n 'stroke-dasharray': 'strokeDasharray',\n 'stroke-dashoffset': 'strokeDashoffset',\n 'stroke-miterlimit': 'strokeMiterlimit',\n 'clip-rule': 'clipRule',\n opacity: 'opacity',\n};\n\n/** The presentation attributes that are a paint. */\nexport const PAINT: ReadonlySet<string> = new Set(['fill', 'stroke']);\n\n/** Whether a paint is a `var()`, which only the cascade can settle. */\nexport const isTokenPaint = (value: string | undefined): value is string =>\n value !== undefined && /^\\s*var\\(/i.test(value);\n\nexport interface SvgContext {\n /** The host's colour conversion, which a brush payload is the result of. */\n color(value: string): unknown;\n}\n\nexport function brushOf(value: string, context: SvgContext): Brush {\n if (value === 'none') return null;\n // Deliberately kept as a brush rather than resolved here: native paints it from the view's own\n // `color`, so a bound `[color]` on the icon changes every `currentColor` shape without a\n // re-parse.\n if (value === 'currentColor') return { type: 2 };\n const reference = URL_REFERENCE.exec(value);\n if (reference) return { type: 1, brushRef: reference[1]! };\n return { type: 0, payload: context.color(value) };\n}\n\nconst GRADIENT_UNITS: Record<string, number> = { objectBoundingBox: 0, userSpaceOnUse: 1 };\n\n/** Where a gradient runs when the markup does not say, as react-native-svg's components default. */\nconst GRADIENT_LINE: Record<string, Readonly<Record<string, string>>> = {\n linearGradient: { x1: '0%', y1: '0%', x2: '100%', y2: '0%' },\n radialGradient: { cx: '50%', cy: '50%' },\n};\n\nexport const isGradient = (tag: string): boolean => Object.hasOwn(GRADIENT_LINE, tag);\n\n/**\n * A gradient's native props: its name, where it runs, and its stops.\n *\n * A `<stop>` is not a view. react-native-svg reads the stops in JavaScript and hands the gradient\n * one flat list, `[offset, colour, offset, colour]`, in offset order, each colour a single number\n * with the stop's opacity in its alpha. `currentColor` is the colour passed in: native has no\n * brush for it inside a gradient, so it is settled here.\n */\nexport function gradientProps(\n node: { tag: string; attrs: Readonly<Record<string, string>>; children: readonly SvgNodeLike[] },\n context: SvgContext,\n currentColor?: string,\n): Record<string, unknown> {\n const { attrs } = node;\n const stops = node.children\n .filter((child) => child.tag === 'stop')\n .map((stop) => stopOf(stop.attrs, context, currentColor))\n .filter((stop) => stop !== null)\n .sort((a, b) => a[0] - b[0]);\n return {\n name: attrs['id'],\n ...gradientLine(node.tag, attrs),\n gradient: stops.flat(),\n gradientUnits: own(GRADIENT_UNITS, attrs['gradientUnits'] ?? '') ?? 0,\n gradientTransform: transformMatrix(attrs['gradientTransform'] ?? '') ?? null,\n };\n}\n\n/** Where a gradient runs: what the markup set, over what react-native-svg defaults. */\nfunction gradientLine(\n tag: string,\n attrs: Readonly<Record<string, string>>,\n): Record<string, unknown> {\n const line: Record<string, unknown> = { ...own(GRADIENT_LINE, tag) };\n for (const name of Object.keys(line)) line[name] = attrs[name] ?? line[name];\n if (tag !== 'radialGradient') return line;\n const radius = attrs['r'] ?? '50%';\n return {\n ...line,\n rx: attrs['rx'] ?? radius,\n ry: attrs['ry'] ?? radius,\n fx: attrs['fx'] ?? line['cx'],\n fy: attrs['fy'] ?? line['cy'],\n };\n}\n\ninterface SvgNodeLike {\n readonly tag: string;\n readonly attrs: Readonly<Record<string, string>>;\n}\n\n/** The stop colour of a stop, from its attribute or its `style`. */\nexport const stopColor = (attrs: Readonly<Record<string, string>>): string =>\n /(?:^|;)\\s*stop-color\\s*:\\s*([^;]+)/.exec(attrs['style'] ?? '')?.[1]?.trim() ??\n attrs['stop-color'] ??\n '#000';\n\n/**\n * One stop as `[offset, colour]`, its attributes read from its `style` where they are there, or\n * null for a colour the host cannot convert, such as a `var()`: native takes a list of numbers,\n * and one that is not there would be worse than a stop left out.\n */\nfunction stopOf(\n attrs: Readonly<Record<string, string>>,\n context: SvgContext,\n currentColor: string | undefined,\n): [number, unknown] | null {\n const all = { ...attrs, ...styleAttributes(attrs['style'] ?? '', {}) };\n const written = stopColor(attrs);\n const colour = context.color(written === 'currentColor' ? (currentColor ?? '#000') : written);\n if (colour === null || colour === undefined) return null;\n return [fraction(all['offset'], 0), withOpacity(colour, fraction(all['stop-opacity'], 1))];\n}\n\n/** A number or a percentage as a fraction, or the fallback for one that is neither. */\nfunction fraction(value: string | undefined, fallback: number): number {\n const number = Number.parseFloat(value ?? '');\n if (Number.isNaN(number)) return fallback;\n return value!.trim().endsWith('%') ? number / 100 : number;\n}\n\n/**\n * A processed colour at a fraction of its own opacity: a device's is one number, AARRGGBB, and\n * the web host's is the CSS colour it was given, which a mix with nothing fades the same way.\n */\nfunction withOpacity(colour: unknown, fraction: number): unknown {\n const opacity = Math.min(1, Math.max(0, fraction));\n if (typeof colour !== 'number') {\n return opacity === 1 ? colour : `color-mix(in srgb, ${colour} ${opacity * 100}%, transparent)`;\n }\n const alpha = Math.round((colour >>> 24) * opacity);\n return (colour & 0x00ffffff) | (alpha << 24);\n}\n\n/** SVG attribute -> key of the `font` object react-native-svg's text views read. */\nconst FONT: Record<string, string> = {\n 'font-size': 'fontSize',\n 'font-weight': 'fontWeight',\n 'font-style': 'fontStyle',\n 'font-family': 'fontFamily',\n 'font-variant': 'fontVariant',\n 'font-stretch': 'fontStretch',\n 'text-anchor': 'textAnchor',\n 'text-decoration': 'textDecoration',\n 'letter-spacing': 'letterSpacing',\n 'word-spacing': 'wordSpacing',\n kerning: 'kerning',\n};\n\nconst lengthList = (value: string | undefined): string[] =>\n value === undefined\n ? []\n : value\n .trim()\n .split(/[\\s,]+/)\n .filter(Boolean);\n\n/**\n * What a `text` or a `tspan` takes beside its paint: its font as one object, and each of its\n * positions as a list, since SVG places a glyph at a time. The first family of a `font-family` is\n * the one asked for, as react-native-svg reads it.\n */\nexport function textProps(attrs: Readonly<Record<string, string>>): Record<string, unknown> {\n const font: Record<string, string> = {};\n for (const [name, value] of Object.entries(attrs)) {\n const key = own(FONT, name);\n if (!key) continue;\n font[key] =\n key === 'fontFamily'\n ? value\n .split(',')[0]!\n .trim()\n .replace(/^[\"']|[\"']$/g, '')\n : value;\n }\n return {\n x: lengthList(attrs['x']),\n y: lengthList(attrs['y']),\n dx: lengthList(attrs['dx']),\n dy: lengthList(attrs['dy']),\n rotate: lengthList(attrs['rotate']),\n font,\n };\n}\n\n/** `M x,y L x,y ...`, which is what a polyline or polygon is once native sees it. */\nexport function pointsToPath(points: string, close: boolean): string {\n const numbers = points\n .trim()\n .split(/[\\s,]+/)\n .filter(Boolean);\n let path = '';\n for (let index = 0; index + 1 < numbers.length; index += 2) {\n path += `${index === 0 ? 'M' : 'L'}${numbers[index]},${numbers[index + 1]}`;\n }\n return close && path ? `${path}Z` : path;\n}\n\n/** `stroke-width:2;opacity:.5` as attributes, with `var(--name, fallback)` resolved. */\nexport function styleAttributes(\n style: string,\n variables: Readonly<Record<string, string | number | undefined>>,\n): Record<string, string> {\n const attrs: Record<string, string> = {};\n for (const declaration of style.split(';')) {\n const colon = declaration.indexOf(':');\n if (colon === -1) continue;\n const name = declaration.slice(0, colon).trim();\n const value = declaration.slice(colon + 1).trim();\n // A paint's `var()` is kept as written: the cascade settles it, with the tokens in scope.\n const resolved = resolveVar(value, variables) ?? (PAINT.has(name) ? value : undefined);\n if (name && resolved !== undefined) attrs[name] = resolved;\n }\n return attrs;\n}\n\nfunction resolveVar(\n value: string,\n variables: Readonly<Record<string, string | number | undefined>>,\n): string | undefined {\n const match = /^var\\(\\s*(--[\\w-]+)\\s*(?:,\\s*([^)]*))?\\)$/.exec(value);\n if (!match) return value;\n const supplied = variables[match[1]!];\n if (supplied !== undefined) return String(supplied);\n return match[2]?.trim() || undefined;\n}\n\n/** The four numbers of a `viewBox`, as the props the svg view takes them as. */\nexport function viewBoxProps(viewBox: string | undefined): Record<string, unknown> {\n if (!viewBox) return {};\n const parts = viewBox.trim().replace(/,/g, ' ').split(/\\s+/).map(Number);\n if (parts.length !== 4 || parts.some(Number.isNaN)) return {};\n const [minX, minY, vbWidth, vbHeight] = parts;\n return { minX, minY, vbWidth, vbHeight, align: 'xMidYMid', meetOrSlice: 0 };\n}\n\nconst TRANSFORM = /([a-zA-Z]+)\\s*\\(([^)]*)\\)/g;\n\n/**\n * A `transform` attribute as a 2x3 matrix, which is the only form native takes.\n *\n * Rare in icon sets - one occurrence across bootstrap-icons and lucide, and that one is already a\n * `matrix()` - but a shape drawn in the wrong place is worse than one not drawn, so the other\n * three forms compose rather than being ignored.\n */\nexport function transformMatrix(transform: string): number[] | undefined {\n let matrix: number[] | undefined;\n TRANSFORM.lastIndex = 0;\n let match: RegExpExecArray | null;\n while ((match = TRANSFORM.exec(transform)) !== null) {\n const values = match[2]!\n .trim()\n .split(/[\\s,]+/)\n .map(Number);\n const next = matrixFor(match[1]!, values);\n if (next) matrix = matrix ? multiply(matrix, next) : next;\n }\n return matrix;\n}\n\n/** `translate(4)` and `scale(2)` mean something for the missing argument; `rotate(90)` means 0. */\nconst at = (values: number[], index: number, fallback: number) => values[index] ?? fallback;\n\nfunction matrixFor(name: string, values: number[]): number[] | undefined {\n const first = at(values, 0, 0);\n if (name === 'matrix') return values.length === 6 ? values : undefined;\n if (name === 'translate') return [1, 0, 0, 1, first, at(values, 1, 0)];\n if (name === 'scale') return [first, 0, 0, at(values, 1, first), 0, 0];\n if (name === 'rotate') return rotation(first, at(values, 1, 0), at(values, 2, 0));\n return undefined;\n}\n\nfunction rotation(degrees: number, cx: number, cy: number): number[] {\n const radians = (degrees * Math.PI) / 180;\n const cos = Math.cos(radians);\n const sin = Math.sin(radians);\n // Rotating about a point is the rotation with the point moved to the origin and back.\n return [cos, sin, -sin, cos, cx - cos * cx + sin * cy, cy - sin * cx - cos * cy];\n}\n\n/** `[a, b, c, d, tx, ty]`, in SVG's own order. */\nfunction multiply(left: number[], right: number[]): number[] {\n const [a1, b1, c1, d1, e1, f1] = left as [number, number, number, number, number, number];\n const [a2, b2, c2, d2, e2, f2] = right as [number, number, number, number, number, number];\n return [\n a1 * a2 + c1 * b2,\n b1 * a2 + d1 * b2,\n a1 * c2 + c1 * d2,\n b1 * c2 + d1 * d2,\n a1 * e2 + c1 * f2 + e1,\n b1 * e2 + d1 * f2 + f1,\n ];\n}\n\n/**\n * One element's native props.\n *\n * `propList` is the load-bearing part: it names the props this element set itself, and native\n * inherits everything else from the group above. Omit it and a path with no `fill` of its own\n * paints black instead of the colour its parent carries.\n */\nexport function nativeProps(\n tag: string,\n attrs: Readonly<Record<string, string>>,\n context: SvgContext,\n): Record<string, unknown> {\n const props: Record<string, unknown> = {};\n const propList: string[] = [];\n\n for (const [name, value] of Object.entries(attrs)) {\n const prop = own(PRESENTATION, name);\n if (!prop) continue;\n props[prop] = presentationValue(prop, value, context);\n propList.push(prop);\n }\n if (propList.length > 0) props['propList'] = propList;\n\n geometry(tag, attrs, props);\n references(tag, attrs, props);\n if (tag === 'polyline' || tag === 'polygon') {\n props['d'] = pointsToPath(attrs['points'] ?? '', tag === 'polygon');\n }\n if (attrs['transform']) {\n const matrix = transformMatrix(attrs['transform']);\n if (matrix) props['matrix'] = matrix;\n }\n return props;\n}\n\n/**\n * How elements point at each other: an element's `id` is the `name` native knows it by, and a\n * `mask`, a `clip-path` and a `<use>` name the element they use, as react-native-svg sends them.\n */\nfunction references(\n tag: string,\n attrs: Readonly<Record<string, string>>,\n props: Record<string, unknown>,\n): void {\n if (attrs['id']) props['name'] = attrs['id'];\n const mask = referenceOf(attrs['mask']);\n if (mask) props['mask'] = mask;\n const clipPath = referenceOf(attrs['clip-path']);\n if (clipPath) props['clipPath'] = clipPath;\n if (tag === 'mask') Object.assign(props, maskProps(attrs));\n if (tag === 'use') props['href'] = referenceOf(attrs['href'] ?? attrs['xlink:href']);\n}\n\n/**\n * The props react-native-svg's Android view manager declares as `float` rather than `Dynamic`,\n * with the default it applies when the prop is absent.\n *\n * `Dynamic` reads whatever arrives, so an SVG attribute can stay the string it was written as -\n * which is what `strokeWidth` and every geometry attribute do. These five cannot: the Android\n * manager takes a `float` parameter, and a string reaching one throws `java.lang.String cannot be\n * cast to java.lang.Double` out of `setProperty` while the view is being created, which takes the\n * whole screen down. iOS never noticed, because folly's `dynamic` coerces a numeric string on the\n * way into a `Float` prop. react-native-svg's own JavaScript sends numbers here too, through\n * `extractOpacity`, so this is the same translation and not an Android workaround.\n */\nconst NUMERIC: Record<string, number> = {\n opacity: 1,\n fillOpacity: 1,\n strokeOpacity: 1,\n strokeDashoffset: 0,\n strokeMiterlimit: 4,\n};\n\nfunction presentationValue(prop: string, value: string, context: SvgContext): unknown {\n if (prop === 'fill' || prop === 'stroke') return brushOf(value, context);\n if (prop === 'strokeLinecap') return own(LINECAP, value) ?? 0;\n if (prop === 'strokeLinejoin') return own(LINEJOIN, value) ?? 0;\n if (prop === 'fillRule' || prop === 'clipRule') return own(FILL_RULE, value) ?? 1;\n if (prop === 'strokeDasharray') return dashes(value);\n return prop in NUMERIC ? numberFor(prop, value) : value;\n}\n\n/** A dash pattern as a list of lengths, or null for `none`, which is a solid line. */\nfunction dashes(value: string): string[] | null {\n if (value.trim() === 'none') return null;\n return value\n .trim()\n .split(/[\\s,]+/)\n .filter(Boolean);\n}\n\nconst OPACITY: ReadonlySet<string> = new Set(['opacity', 'fillOpacity', 'strokeOpacity']);\n\n/** The attribute as the float Android's view manager takes, or the default it applies. */\nfunction numberFor(prop: string, value: string): number {\n const number = Number.parseFloat(value);\n if (Number.isNaN(number)) return NUMERIC[prop]!;\n // `50%` is half, for an opacity, as react-native-svg's `extractOpacity` reads it.\n return OPACITY.has(prop) && value.trim().endsWith('%') ? number / 100 : number;\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ng-native/icons",
3
- "version": "0.11.0",
3
+ "version": "0.13.0",
4
4
  "description": "@ng-icons rendered as native react-native-svg shapes in Angular Native.",
5
5
  "keywords": [
6
6
  "angular",
@@ -17,7 +17,7 @@
17
17
  "type": "module",
18
18
  "main": "dist/index.js",
19
19
  "dependencies": {
20
- "@ng-native/fabric": "0.11.0"
20
+ "@ng-native/fabric": "0.13.0"
21
21
  },
22
22
  "peerDependencies": {
23
23
  "@angular/core": "^22.0.0",