@skdx/icons 0.27.0 → 0.28.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -7
- package/dist/angular/fesm2022/skdx-icons.mjs +1 -1
- package/dist/angular/stroke-width.d.cts +4 -25
- package/dist/angular/stroke-width.d.ts +4 -25
- package/dist/angular/types/skdx-icons.d.cts +25 -26
- package/dist/angular/types/skdx-icons.d.ts +25 -26
- package/dist/react/createIcon.d.cts +9 -22
- package/dist/react/createIcon.d.ts +9 -22
- package/dist/svelte/IconBase.svelte +33 -27
- package/dist/svelte/stroke-width.d.cts +0 -13
- package/dist/svelte/stroke-width.d.ts +0 -13
- package/dist/web-components/icon-registry.cjs +1 -1
- package/dist/web-components/icon-registry.d.cts +4 -0
- package/dist/web-components/icon-registry.d.ts +4 -0
- package/dist/web-components/icon-registry.js +1 -1
- package/dist/web-components/skdx-icon.cjs +6 -6
- package/dist/web-components/skdx-icon.d.cts +3 -0
- package/dist/web-components/skdx-icon.d.ts +3 -0
- package/dist/web-components/skdx-icon.js +6 -6
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -60,8 +60,9 @@ Web Components ships **one shared element**, `<skdx-icon name>`, instead of a cu
|
|
|
60
60
|
<script type="module">
|
|
61
61
|
// Full import — register exactly the icons you use in one call.
|
|
62
62
|
import '@skdx/icons/web-components';
|
|
63
|
+
|
|
64
|
+
import { BellIcon, SearchIcon } from '@skdx/icons/data';
|
|
63
65
|
import { registerIcons } from '@skdx/icons/web-components';
|
|
64
|
-
import { SearchIcon, BellIcon } from '@skdx/icons/data';
|
|
65
66
|
|
|
66
67
|
registerIcons({ SearchIcon, BellIcon });
|
|
67
68
|
</script>
|
|
@@ -87,7 +88,8 @@ Angular uses a name registry via DI instead of a component per icon, for the sam
|
|
|
87
88
|
|
|
88
89
|
```ts
|
|
89
90
|
import { Component } from '@angular/core';
|
|
90
|
-
|
|
91
|
+
|
|
92
|
+
import { provideIcons, SkdxIconComponent } from '@skdx/icons/angular';
|
|
91
93
|
import { SearchIcon } from '@skdx/icons/data';
|
|
92
94
|
|
|
93
95
|
@Component({
|
|
@@ -146,7 +148,7 @@ Every icon accepts all standard SVG props plus:
|
|
|
146
148
|
| Prop | Default | Description |
|
|
147
149
|
| ------------- | ---------------- | --------------------------------------------------------------------- |
|
|
148
150
|
| `size` | `24` | Rendered width/height in px (icons are square, drawn on a 24×24 grid) |
|
|
149
|
-
| `color` | `'currentColor'` | Stroke color — any CSS color, including `var(--skdx-*)` tokens
|
|
151
|
+
| `color` | `'currentColor'` | Stroke color — any CSS color, including `var(--skdx-*)` tokens |
|
|
150
152
|
| `strokeWidth` | `2` | Stroke width relative to the 24×24 grid |
|
|
151
153
|
| `title` | — | Accessible label; without it the icon is `aria-hidden` |
|
|
152
154
|
|
|
@@ -165,11 +167,11 @@ iconKeywords.SearchIcon; // ['find', 'magnifier', 'zoom', ...]
|
|
|
165
167
|
|
|
166
168
|
lucide keeps every renamed icon's old name around as an **alias**: a second SVG file with identical artwork under the superseded name. This package ships **only lucide's canonical names**, so there is exactly one way to import each icon and nothing published is already on a removal path:
|
|
167
169
|
|
|
168
|
-
|
|
|
169
|
-
| --------: |
|
|
170
|
+
| Count | What |
|
|
171
|
+
| --------: | --------------------------------------------------------------------------------------------------------------- |
|
|
170
172
|
| **1,997** | SVG files in `lucide-static@1.25.0` |
|
|
171
|
-
|
|
|
172
|
-
|
|
|
173
|
+
| −249 | legacy alias names (`AlertCircle` → `CircleAlert`, `Filter` → `Funnel`, …) — superseded spellings, same artwork |
|
|
174
|
+
| −0 | icons upstream has flagged for deletion — lucide 1.x removed its deprecated brand set outright, so none remain |
|
|
173
175
|
| **1,748** | exports this package ships (`iconNames.length`) — one per distinct icon |
|
|
174
176
|
|
|
175
177
|
No export carries an `@deprecated` tag, because no deprecated name is published in the first place.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import*as
|
|
1
|
+
import*as e from"@angular/core";import{InjectionToken as t,inject as n,ElementRef as o,Renderer2 as r,Input as i,Directive as s,booleanAttribute as a,ChangeDetectionStrategy as d,Component as c}from"@angular/core";const l=new t("SKDX_ICON_ENTRIES"),h=new t("SKDX_ICON_REGISTRY",{factory:()=>Object.assign({},...n(l,{optional:!0})??[])});function p(e){return{provide:l,useValue:e,multi:!0}}class SkdxIconNodeDirective{constructor(){this.host=n(o),this.renderer=n(r)}set node(e){const t=this.host.nativeElement;for(;t.firstChild;)this.renderer.removeChild(t,t.firstChild);for(const[n,o]of e){const e=this.renderer.createElement(n,"http://www.w3.org/2000/svg");for(const[t,n]of Object.entries(o))this.renderer.setAttribute(e,t,n);this.renderer.appendChild(t,e)}}static{this.ɵfac=e.ɵɵngDeclareFactory({minVersion:"12.0.0",version:"22.0.6",ngImport:e,type:SkdxIconNodeDirective,deps:[],target:e.ɵɵFactoryTarget.Directive})}static{this.ɵdir=e.ɵɵngDeclareDirective({minVersion:"14.0.0",version:"22.0.6",type:SkdxIconNodeDirective,isStandalone:!0,selector:"[skdxIconNode]",inputs:{node:["skdxIconNode","node"]},ngImport:e})}}e.ɵɵngDeclareClassMetadata({minVersion:"12.0.0",version:"22.0.6",ngImport:e,type:SkdxIconNodeDirective,decorators:[{type:s,args:[{selector:"[skdxIconNode]",standalone:!0}]}],propDecorators:{node:[{type:i,args:["skdxIconNode"]}]}});class SkdxIconComponent{constructor(){this.registry=n(h),this.size=24,this.color="currentColor",this.strokeWidth=2,this.absoluteStrokeWidth=!1}get renderedStrokeWidth(){return function(e,t,n){if(!n)return e;const o=24*Number(e)/Number(t);return Number.isFinite(o)?o:e}(this.strokeWidth,this.size,this.absoluteStrokeWidth)}get iconNode(){return this.registry[this.name]??[]}static{this.ɵfac=e.ɵɵngDeclareFactory({minVersion:"12.0.0",version:"22.0.6",ngImport:e,type:SkdxIconComponent,deps:[],target:e.ɵɵFactoryTarget.Component})}static{this.ɵcmp=e.ɵɵngDeclareComponent({minVersion:"17.0.0",version:"22.0.6",type:SkdxIconComponent,isStandalone:!0,selector:"skdx-icon",inputs:{name:"name",size:"size",color:"color",strokeWidth:"strokeWidth",absoluteStrokeWidth:["absoluteStrokeWidth","absoluteStrokeWidth",a],title:"title"},ngImport:e,template:'\n <svg\n xmlns="http://www.w3.org/2000/svg"\n [attr.width]="size"\n [attr.height]="size"\n viewBox="0 0 24 24"\n fill="none"\n [attr.stroke]="color"\n [attr.stroke-width]="renderedStrokeWidth"\n stroke-linecap="round"\n stroke-linejoin="round"\n [attr.role]="title ? \'img\' : null"\n [attr.aria-hidden]="title ? null : \'true\'"\n focusable="false"\n [attr.data-skdx-icon]="name"\n >\n @if (title) {\n <title>{{ title }}</title>\n }\n <g [skdxIconNode]="iconNode"></g>\n </svg>\n ',isInline:!0,dependencies:[{kind:"directive",type:SkdxIconNodeDirective,selector:"[skdxIconNode]",inputs:["skdxIconNode"]}],changeDetection:e.ChangeDetectionStrategy.OnPush})}}e.ɵɵngDeclareClassMetadata({minVersion:"12.0.0",version:"22.0.6",ngImport:e,type:SkdxIconComponent,decorators:[{type:c,args:[{selector:"skdx-icon",standalone:!0,imports:[SkdxIconNodeDirective],changeDetection:d.OnPush,template:'\n <svg\n xmlns="http://www.w3.org/2000/svg"\n [attr.width]="size"\n [attr.height]="size"\n viewBox="0 0 24 24"\n fill="none"\n [attr.stroke]="color"\n [attr.stroke-width]="renderedStrokeWidth"\n stroke-linecap="round"\n stroke-linejoin="round"\n [attr.role]="title ? \'img\' : null"\n [attr.aria-hidden]="title ? null : \'true\'"\n focusable="false"\n [attr.data-skdx-icon]="name"\n >\n @if (title) {\n <title>{{ title }}</title>\n }\n <g [skdxIconNode]="iconNode"></g>\n </svg>\n '}]}],propDecorators:{name:[{type:i,args:[{required:!0}]}],size:[{type:i}],color:[{type:i}],strokeWidth:[{type:i}],absoluteStrokeWidth:[{type:i,args:[{transform:a}]}],title:[{type:i}]}});export{h as SKDX_ICON_REGISTRY,SkdxIconComponent,p as provideIcons};
|
|
@@ -1,30 +1,9 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Angular-local copy of `src/strokeWidth.ts`'s `resolveStrokeWidth`.
|
|
3
|
-
*
|
|
4
|
-
* Why a copy and not an import: this package's Angular output is built by
|
|
5
|
-
* ng-packagr, which roots its TypeScript program at the entry file's own
|
|
6
|
-
* directory (`src/angular/index.ts`). Under ng-packagr 22 + TypeScript 6, ANY
|
|
7
|
-
* import that reaches outside `src/angular/` crashes partial compilation with
|
|
8
|
-
* "Cannot destructure property 'pos' of 'file.referencedFiles[index]'" — the
|
|
9
|
-
* Angular compiler is a TypeScript release behind. It is not specific to this
|
|
10
|
-
* helper; a one-line probe module reproduces it identically.
|
|
11
|
-
*
|
|
12
|
-
* `stroke-width.parity.test.ts` asserts this copy and the shared original
|
|
13
|
-
* agree across a table of inputs, so the duplication cannot silently drift.
|
|
14
|
-
* Delete this file and import `../strokeWidth.js` again once the toolchain
|
|
15
|
-
* catches up.
|
|
16
|
-
*/
|
|
17
1
|
/**
|
|
18
2
|
* Resolves the `stroke-width` actually rendered onto an icon's `<svg>`.
|
|
19
3
|
*
|
|
20
|
-
* By default `
|
|
21
|
-
* `
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
* sizes shares one optical weight. Matches lucide's prop of the same name.
|
|
25
|
-
*
|
|
26
|
-
* Non-numeric sizes (`'2em'`, `'100%'`) can't be rescaled — there's no pixel
|
|
27
|
-
* count to divide by — so the value passes through unchanged rather than
|
|
28
|
-
* becoming `NaN` and blanking the icon.
|
|
4
|
+
* By default it scales with `size` relative to the 24×24 grid; with
|
|
5
|
+
* `absoluteStrokeWidth`, it's rescaled to a fixed rendered pixel weight
|
|
6
|
+
* across sizes, matching lucide's prop of the same name. Non-numeric sizes
|
|
7
|
+
* pass through unchanged rather than becoming `NaN`.
|
|
29
8
|
*/
|
|
30
9
|
export declare function resolveStrokeWidth(strokeWidth: number | string, size: number | string, absoluteStrokeWidth?: boolean): number | string;
|
|
@@ -1,30 +1,9 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Angular-local copy of `src/strokeWidth.ts`'s `resolveStrokeWidth`.
|
|
3
|
-
*
|
|
4
|
-
* Why a copy and not an import: this package's Angular output is built by
|
|
5
|
-
* ng-packagr, which roots its TypeScript program at the entry file's own
|
|
6
|
-
* directory (`src/angular/index.ts`). Under ng-packagr 22 + TypeScript 6, ANY
|
|
7
|
-
* import that reaches outside `src/angular/` crashes partial compilation with
|
|
8
|
-
* "Cannot destructure property 'pos' of 'file.referencedFiles[index]'" — the
|
|
9
|
-
* Angular compiler is a TypeScript release behind. It is not specific to this
|
|
10
|
-
* helper; a one-line probe module reproduces it identically.
|
|
11
|
-
*
|
|
12
|
-
* `stroke-width.parity.test.ts` asserts this copy and the shared original
|
|
13
|
-
* agree across a table of inputs, so the duplication cannot silently drift.
|
|
14
|
-
* Delete this file and import `../strokeWidth.js` again once the toolchain
|
|
15
|
-
* catches up.
|
|
16
|
-
*/
|
|
17
1
|
/**
|
|
18
2
|
* Resolves the `stroke-width` actually rendered onto an icon's `<svg>`.
|
|
19
3
|
*
|
|
20
|
-
* By default `
|
|
21
|
-
* `
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
* sizes shares one optical weight. Matches lucide's prop of the same name.
|
|
25
|
-
*
|
|
26
|
-
* Non-numeric sizes (`'2em'`, `'100%'`) can't be rescaled — there's no pixel
|
|
27
|
-
* count to divide by — so the value passes through unchanged rather than
|
|
28
|
-
* becoming `NaN` and blanking the icon.
|
|
4
|
+
* By default it scales with `size` relative to the 24×24 grid; with
|
|
5
|
+
* `absoluteStrokeWidth`, it's rescaled to a fixed rendered pixel weight
|
|
6
|
+
* across sizes, matching lucide's prop of the same name. Non-numeric sizes
|
|
7
|
+
* pass through unchanged rather than becoming `NaN`.
|
|
29
8
|
*/
|
|
30
9
|
export declare function resolveStrokeWidth(strokeWidth: number | string, size: number | string, absoluteStrokeWidth?: boolean): number | string;
|
|
@@ -1,17 +1,35 @@
|
|
|
1
|
-
import { SafeHtml } from '@angular/platform-browser';
|
|
2
1
|
import * as i0 from '@angular/core';
|
|
3
2
|
import { InjectionToken, Provider } from '@angular/core';
|
|
4
3
|
|
|
4
|
+
type IconNode = ReadonlyArray<readonly [string, Record<string, string>]>;
|
|
5
|
+
type IconRegistryEntries = Record<string, IconNode>;
|
|
6
|
+
/** Merged icon registry every `<skdx-icon name>` resolves against — the union of every `provideIcons()` call in the injector tree. */
|
|
7
|
+
declare const SKDX_ICON_REGISTRY: InjectionToken<IconRegistryEntries>;
|
|
8
|
+
/**
|
|
9
|
+
* Registers icons for `<skdx-icon name="...">` to resolve by name —
|
|
10
|
+
* Angular Material's `provideIcons()`-style API. Call once per icon set
|
|
11
|
+
* (app root, a feature route, a lazy-loaded module); multiple calls merge
|
|
12
|
+
* rather than overwrite each other.
|
|
13
|
+
*
|
|
14
|
+
* Unlike the other 4 frameworks' per-icon components, Ivy-compiling ~1,900
|
|
15
|
+
* individual `@Component`-decorated classes would balloon this library's
|
|
16
|
+
* Angular build time and bundle size, so Angular trades true per-import
|
|
17
|
+
* tree-shaking for one shared `<skdx-icon>` element plus this name registry —
|
|
18
|
+
* import only the `IconNode` data you use from `@skdx/icons/angular/icons`
|
|
19
|
+
* and register just that subset.
|
|
20
|
+
*/
|
|
21
|
+
declare function provideIcons(icons: IconRegistryEntries): Provider;
|
|
22
|
+
|
|
5
23
|
/**
|
|
6
24
|
* `<skdx-icon name="CheckIcon">` — resolves icon geometry by name from the
|
|
7
25
|
* registry built by `provideIcons()` (see `icon-registry.ts`). Shares the
|
|
8
26
|
* same `size`/`color`/`strokeWidth`/`title` prop contract as every other
|
|
9
27
|
* framework's icon output, as Angular `@Input()`s.
|
|
10
28
|
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
29
|
+
* Geometry is appended through `Renderer2` rather than `[innerHTML]`: the
|
|
30
|
+
* `innerHTML` setter exists only on `HTMLElement` in the domino DOM Angular
|
|
31
|
+
* uses for SSR, so binding it on an SVG element throws `NotYetImplemented`
|
|
32
|
+
* during prerender.
|
|
15
33
|
*
|
|
16
34
|
* There is no mirroring input: icons never flip under `dir="rtl"` on their
|
|
17
35
|
* own. Add the `skdx-icon-mirror` class at the call site to the ones that
|
|
@@ -21,7 +39,6 @@ import { InjectionToken, Provider } from '@angular/core';
|
|
|
21
39
|
*/
|
|
22
40
|
declare class SkdxIconComponent {
|
|
23
41
|
private readonly registry;
|
|
24
|
-
private readonly sanitizer;
|
|
25
42
|
/** Name of a registered icon — see `provideIcons()`. */
|
|
26
43
|
name: string;
|
|
27
44
|
/** Rendered width/height in pixels (icons are square). @default 24 */
|
|
@@ -36,30 +53,12 @@ declare class SkdxIconComponent {
|
|
|
36
53
|
title?: string;
|
|
37
54
|
/** The `stroke-width` actually rendered — rescaled when `absoluteStrokeWidth` is set. */
|
|
38
55
|
get renderedStrokeWidth(): number | string;
|
|
39
|
-
|
|
56
|
+
/** Geometry for the currently named icon, empty when the name is unregistered. */
|
|
57
|
+
get iconNode(): IconNode;
|
|
40
58
|
static ɵfac: i0.ɵɵFactoryDeclaration<SkdxIconComponent, never>;
|
|
41
59
|
static ɵcmp: i0.ɵɵComponentDeclaration<SkdxIconComponent, "skdx-icon", never, { "name": { "alias": "name"; "required": true; }; "size": { "alias": "size"; "required": false; }; "color": { "alias": "color"; "required": false; }; "strokeWidth": { "alias": "strokeWidth"; "required": false; }; "absoluteStrokeWidth": { "alias": "absoluteStrokeWidth"; "required": false; }; "title": { "alias": "title"; "required": false; }; }, {}, never, never, true, never>;
|
|
42
60
|
static ngAcceptInputType_absoluteStrokeWidth: unknown;
|
|
43
61
|
}
|
|
44
62
|
|
|
45
|
-
type IconNode = ReadonlyArray<readonly [string, Record<string, string>]>;
|
|
46
|
-
type IconRegistryEntries = Record<string, IconNode>;
|
|
47
|
-
/** Merged icon registry every `<skdx-icon name>` resolves against — the union of every `provideIcons()` call in the injector tree. */
|
|
48
|
-
declare const SKDX_ICON_REGISTRY: InjectionToken<IconRegistryEntries>;
|
|
49
|
-
/**
|
|
50
|
-
* Registers icons for `<skdx-icon name="...">` to resolve by name —
|
|
51
|
-
* Angular Material's `provideIcons()`-style API. Call once per icon set
|
|
52
|
-
* (app root, a feature route, a lazy-loaded module); multiple calls merge
|
|
53
|
-
* rather than overwrite each other.
|
|
54
|
-
*
|
|
55
|
-
* Unlike the other 4 frameworks' per-icon components, Ivy-compiling ~1,900
|
|
56
|
-
* individual `@Component`-decorated classes would balloon this library's
|
|
57
|
-
* Angular build time and bundle size, so Angular trades true per-import
|
|
58
|
-
* tree-shaking for one shared `<skdx-icon>` element plus this name registry —
|
|
59
|
-
* import only the `IconNode` data you use from `@skdx/icons/angular/icons`
|
|
60
|
-
* and register just that subset.
|
|
61
|
-
*/
|
|
62
|
-
declare function provideIcons(icons: IconRegistryEntries): Provider;
|
|
63
|
-
|
|
64
63
|
export { SKDX_ICON_REGISTRY, SkdxIconComponent, provideIcons };
|
|
65
64
|
export type { IconNode, IconRegistryEntries };
|
|
@@ -1,17 +1,35 @@
|
|
|
1
|
-
import { SafeHtml } from '@angular/platform-browser';
|
|
2
1
|
import * as i0 from '@angular/core';
|
|
3
2
|
import { InjectionToken, Provider } from '@angular/core';
|
|
4
3
|
|
|
4
|
+
type IconNode = ReadonlyArray<readonly [string, Record<string, string>]>;
|
|
5
|
+
type IconRegistryEntries = Record<string, IconNode>;
|
|
6
|
+
/** Merged icon registry every `<skdx-icon name>` resolves against — the union of every `provideIcons()` call in the injector tree. */
|
|
7
|
+
declare const SKDX_ICON_REGISTRY: InjectionToken<IconRegistryEntries>;
|
|
8
|
+
/**
|
|
9
|
+
* Registers icons for `<skdx-icon name="...">` to resolve by name —
|
|
10
|
+
* Angular Material's `provideIcons()`-style API. Call once per icon set
|
|
11
|
+
* (app root, a feature route, a lazy-loaded module); multiple calls merge
|
|
12
|
+
* rather than overwrite each other.
|
|
13
|
+
*
|
|
14
|
+
* Unlike the other 4 frameworks' per-icon components, Ivy-compiling ~1,900
|
|
15
|
+
* individual `@Component`-decorated classes would balloon this library's
|
|
16
|
+
* Angular build time and bundle size, so Angular trades true per-import
|
|
17
|
+
* tree-shaking for one shared `<skdx-icon>` element plus this name registry —
|
|
18
|
+
* import only the `IconNode` data you use from `@skdx/icons/angular/icons`
|
|
19
|
+
* and register just that subset.
|
|
20
|
+
*/
|
|
21
|
+
declare function provideIcons(icons: IconRegistryEntries): Provider;
|
|
22
|
+
|
|
5
23
|
/**
|
|
6
24
|
* `<skdx-icon name="CheckIcon">` — resolves icon geometry by name from the
|
|
7
25
|
* registry built by `provideIcons()` (see `icon-registry.ts`). Shares the
|
|
8
26
|
* same `size`/`color`/`strokeWidth`/`title` prop contract as every other
|
|
9
27
|
* framework's icon output, as Angular `@Input()`s.
|
|
10
28
|
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
29
|
+
* Geometry is appended through `Renderer2` rather than `[innerHTML]`: the
|
|
30
|
+
* `innerHTML` setter exists only on `HTMLElement` in the domino DOM Angular
|
|
31
|
+
* uses for SSR, so binding it on an SVG element throws `NotYetImplemented`
|
|
32
|
+
* during prerender.
|
|
15
33
|
*
|
|
16
34
|
* There is no mirroring input: icons never flip under `dir="rtl"` on their
|
|
17
35
|
* own. Add the `skdx-icon-mirror` class at the call site to the ones that
|
|
@@ -21,7 +39,6 @@ import { InjectionToken, Provider } from '@angular/core';
|
|
|
21
39
|
*/
|
|
22
40
|
declare class SkdxIconComponent {
|
|
23
41
|
private readonly registry;
|
|
24
|
-
private readonly sanitizer;
|
|
25
42
|
/** Name of a registered icon — see `provideIcons()`. */
|
|
26
43
|
name: string;
|
|
27
44
|
/** Rendered width/height in pixels (icons are square). @default 24 */
|
|
@@ -36,30 +53,12 @@ declare class SkdxIconComponent {
|
|
|
36
53
|
title?: string;
|
|
37
54
|
/** The `stroke-width` actually rendered — rescaled when `absoluteStrokeWidth` is set. */
|
|
38
55
|
get renderedStrokeWidth(): number | string;
|
|
39
|
-
|
|
56
|
+
/** Geometry for the currently named icon, empty when the name is unregistered. */
|
|
57
|
+
get iconNode(): IconNode;
|
|
40
58
|
static ɵfac: i0.ɵɵFactoryDeclaration<SkdxIconComponent, never>;
|
|
41
59
|
static ɵcmp: i0.ɵɵComponentDeclaration<SkdxIconComponent, "skdx-icon", never, { "name": { "alias": "name"; "required": true; }; "size": { "alias": "size"; "required": false; }; "color": { "alias": "color"; "required": false; }; "strokeWidth": { "alias": "strokeWidth"; "required": false; }; "absoluteStrokeWidth": { "alias": "absoluteStrokeWidth"; "required": false; }; "title": { "alias": "title"; "required": false; }; }, {}, never, never, true, never>;
|
|
42
60
|
static ngAcceptInputType_absoluteStrokeWidth: unknown;
|
|
43
61
|
}
|
|
44
62
|
|
|
45
|
-
type IconNode = ReadonlyArray<readonly [string, Record<string, string>]>;
|
|
46
|
-
type IconRegistryEntries = Record<string, IconNode>;
|
|
47
|
-
/** Merged icon registry every `<skdx-icon name>` resolves against — the union of every `provideIcons()` call in the injector tree. */
|
|
48
|
-
declare const SKDX_ICON_REGISTRY: InjectionToken<IconRegistryEntries>;
|
|
49
|
-
/**
|
|
50
|
-
* Registers icons for `<skdx-icon name="...">` to resolve by name —
|
|
51
|
-
* Angular Material's `provideIcons()`-style API. Call once per icon set
|
|
52
|
-
* (app root, a feature route, a lazy-loaded module); multiple calls merge
|
|
53
|
-
* rather than overwrite each other.
|
|
54
|
-
*
|
|
55
|
-
* Unlike the other 4 frameworks' per-icon components, Ivy-compiling ~1,900
|
|
56
|
-
* individual `@Component`-decorated classes would balloon this library's
|
|
57
|
-
* Angular build time and bundle size, so Angular trades true per-import
|
|
58
|
-
* tree-shaking for one shared `<skdx-icon>` element plus this name registry —
|
|
59
|
-
* import only the `IconNode` data you use from `@skdx/icons/angular/icons`
|
|
60
|
-
* and register just that subset.
|
|
61
|
-
*/
|
|
62
|
-
declare function provideIcons(icons: IconRegistryEntries): Provider;
|
|
63
|
-
|
|
64
63
|
export { SKDX_ICON_REGISTRY, SkdxIconComponent, provideIcons };
|
|
65
64
|
export type { IconNode, IconRegistryEntries };
|
|
@@ -4,11 +4,8 @@ export type { IconNode };
|
|
|
4
4
|
/**
|
|
5
5
|
* Props shared by every generated icon component and any custom icon built with {@link createIcon}.
|
|
6
6
|
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* direction of travel (a back arrow, a "next" chevron). See
|
|
10
|
-
* `@skdx/icons/mirror.css` for the rule and for why that call belongs to the
|
|
11
|
-
* consumer rather than to per-icon metadata.
|
|
7
|
+
* No mirroring prop: icons never flip under `dir="rtl"` on their own. Add the `skdx-icon-mirror` class at the
|
|
8
|
+
* call site to ones that encode direction of travel (a back arrow, a "next" chevron) — see `@skdx/icons/mirror.css`.
|
|
12
9
|
*/
|
|
13
10
|
export interface IconProps extends Omit<React.SVGAttributes<SVGSVGElement>, 'children'> {
|
|
14
11
|
/**
|
|
@@ -17,10 +14,7 @@ export interface IconProps extends Omit<React.SVGAttributes<SVGSVGElement>, 'chi
|
|
|
17
14
|
*/
|
|
18
15
|
size?: number | string;
|
|
19
16
|
/**
|
|
20
|
-
* Stroke color
|
|
21
|
-
* surrounding CSS `color` — set `color: var(--skdx-color-primary-600)` (or
|
|
22
|
-
* any theme token) on the icon or a parent to theme it. Pass any CSS color
|
|
23
|
-
* to override per-use.
|
|
17
|
+
* Stroke color; defaults to `currentColor` so icons inherit the surrounding CSS `color`.
|
|
24
18
|
* @default 'currentColor'
|
|
25
19
|
*/
|
|
26
20
|
color?: string;
|
|
@@ -30,30 +24,23 @@ export interface IconProps extends Omit<React.SVGAttributes<SVGSVGElement>, 'chi
|
|
|
30
24
|
*/
|
|
31
25
|
strokeWidth?: number | string;
|
|
32
26
|
/**
|
|
33
|
-
*
|
|
34
|
-
* at different `size`s keep one optical weight (the value is rescaled by
|
|
35
|
-
* `24 ÷ size`). No effect when `size` isn't a plain number.
|
|
27
|
+
* Reads `strokeWidth` as rendered pixels instead of grid units, rescaled by `24 ÷ size` to keep one optical weight.
|
|
36
28
|
* @default false
|
|
37
29
|
*/
|
|
38
30
|
absoluteStrokeWidth?: boolean;
|
|
39
31
|
/**
|
|
40
|
-
* Accessible label
|
|
41
|
-
* `<title>`, exposing it to assistive technology; when omitted the icon is
|
|
42
|
-
* `aria-hidden` (the common case — a nearby text label already describes it).
|
|
32
|
+
* Accessible label; renders `role="img"` with a `<title>` when set, else `aria-hidden`.
|
|
43
33
|
*/
|
|
44
34
|
title?: string;
|
|
45
35
|
}
|
|
46
36
|
/** A ref-forwarding icon component (the return type of {@link createIcon}): accepts {@link IconProps} and forwards its ref to the underlying `<svg>`. */
|
|
47
37
|
export type SkdxIconComponent = React.ForwardRefExoticComponent<IconProps & React.RefAttributes<SVGSVGElement>>;
|
|
48
38
|
/**
|
|
49
|
-
* Builds a themeable, ref-forwarding icon component from raw SVG node data —
|
|
50
|
-
*
|
|
51
|
-
* with, exposed for authoring custom icons that behave identically (same
|
|
52
|
-
* `size`/`color`/`strokeWidth`/`title` props, same theming via `currentColor`).
|
|
39
|
+
* Builds a themeable, ref-forwarding icon component from raw SVG node data — the same factory every
|
|
40
|
+
* generated `@skdx/icons` component is built with, exposed for authoring custom icons that behave identically.
|
|
53
41
|
*
|
|
54
|
-
* Icons render on a 24x24 grid (scaled by `size
|
|
55
|
-
*
|
|
56
|
-
* (`className`, `onClick`, `style`, …) plus the ref.
|
|
42
|
+
* Icons render on a 24x24 grid (scaled by `size`), draw with `fill="none"` + `stroke={color}`, and forward
|
|
43
|
+
* all other SVG props plus the ref.
|
|
57
44
|
*
|
|
58
45
|
* @param displayName - Component display name (for devtools) and the value written to the rendered `data-skdx-icon` attribute.
|
|
59
46
|
* @param iconNode - The SVG child elements as `[tagName, attributes][]` pairs, e.g. `[['circle', { cx: '12', cy: '12', r: '10' }]]`.
|
|
@@ -4,11 +4,8 @@ export type { IconNode };
|
|
|
4
4
|
/**
|
|
5
5
|
* Props shared by every generated icon component and any custom icon built with {@link createIcon}.
|
|
6
6
|
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* direction of travel (a back arrow, a "next" chevron). See
|
|
10
|
-
* `@skdx/icons/mirror.css` for the rule and for why that call belongs to the
|
|
11
|
-
* consumer rather than to per-icon metadata.
|
|
7
|
+
* No mirroring prop: icons never flip under `dir="rtl"` on their own. Add the `skdx-icon-mirror` class at the
|
|
8
|
+
* call site to ones that encode direction of travel (a back arrow, a "next" chevron) — see `@skdx/icons/mirror.css`.
|
|
12
9
|
*/
|
|
13
10
|
export interface IconProps extends Omit<React.SVGAttributes<SVGSVGElement>, 'children'> {
|
|
14
11
|
/**
|
|
@@ -17,10 +14,7 @@ export interface IconProps extends Omit<React.SVGAttributes<SVGSVGElement>, 'chi
|
|
|
17
14
|
*/
|
|
18
15
|
size?: number | string;
|
|
19
16
|
/**
|
|
20
|
-
* Stroke color
|
|
21
|
-
* surrounding CSS `color` — set `color: var(--skdx-color-primary-600)` (or
|
|
22
|
-
* any theme token) on the icon or a parent to theme it. Pass any CSS color
|
|
23
|
-
* to override per-use.
|
|
17
|
+
* Stroke color; defaults to `currentColor` so icons inherit the surrounding CSS `color`.
|
|
24
18
|
* @default 'currentColor'
|
|
25
19
|
*/
|
|
26
20
|
color?: string;
|
|
@@ -30,30 +24,23 @@ export interface IconProps extends Omit<React.SVGAttributes<SVGSVGElement>, 'chi
|
|
|
30
24
|
*/
|
|
31
25
|
strokeWidth?: number | string;
|
|
32
26
|
/**
|
|
33
|
-
*
|
|
34
|
-
* at different `size`s keep one optical weight (the value is rescaled by
|
|
35
|
-
* `24 ÷ size`). No effect when `size` isn't a plain number.
|
|
27
|
+
* Reads `strokeWidth` as rendered pixels instead of grid units, rescaled by `24 ÷ size` to keep one optical weight.
|
|
36
28
|
* @default false
|
|
37
29
|
*/
|
|
38
30
|
absoluteStrokeWidth?: boolean;
|
|
39
31
|
/**
|
|
40
|
-
* Accessible label
|
|
41
|
-
* `<title>`, exposing it to assistive technology; when omitted the icon is
|
|
42
|
-
* `aria-hidden` (the common case — a nearby text label already describes it).
|
|
32
|
+
* Accessible label; renders `role="img"` with a `<title>` when set, else `aria-hidden`.
|
|
43
33
|
*/
|
|
44
34
|
title?: string;
|
|
45
35
|
}
|
|
46
36
|
/** A ref-forwarding icon component (the return type of {@link createIcon}): accepts {@link IconProps} and forwards its ref to the underlying `<svg>`. */
|
|
47
37
|
export type SkdxIconComponent = React.ForwardRefExoticComponent<IconProps & React.RefAttributes<SVGSVGElement>>;
|
|
48
38
|
/**
|
|
49
|
-
* Builds a themeable, ref-forwarding icon component from raw SVG node data —
|
|
50
|
-
*
|
|
51
|
-
* with, exposed for authoring custom icons that behave identically (same
|
|
52
|
-
* `size`/`color`/`strokeWidth`/`title` props, same theming via `currentColor`).
|
|
39
|
+
* Builds a themeable, ref-forwarding icon component from raw SVG node data — the same factory every
|
|
40
|
+
* generated `@skdx/icons` component is built with, exposed for authoring custom icons that behave identically.
|
|
53
41
|
*
|
|
54
|
-
* Icons render on a 24x24 grid (scaled by `size
|
|
55
|
-
*
|
|
56
|
-
* (`className`, `onClick`, `style`, …) plus the ref.
|
|
42
|
+
* Icons render on a 24x24 grid (scaled by `size`), draw with `fill="none"` + `stroke={color}`, and forward
|
|
43
|
+
* all other SVG props plus the ref.
|
|
57
44
|
*
|
|
58
45
|
* @param displayName - Component display name (for devtools) and the value written to the rendered `data-skdx-icon` attribute.
|
|
59
46
|
* @param iconNode - The SVG child elements as `[tagName, attributes][]` pairs, e.g. `[['circle', { cx: '12', cy: '12', r: '10' }]]`.
|
|
@@ -1,33 +1,39 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
Copyright (c) 2026 SkandaDX
|
|
3
|
+
This file is part of the SkandaDX organization.
|
|
4
|
+
Licensed under the MIT License. See LICENSE in the repository root.
|
|
5
|
+
-->
|
|
6
|
+
|
|
1
7
|
<script lang="ts">
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
8
|
+
import type { IconNode } from '../iconNode.js';
|
|
9
|
+
import type { IconProps } from './icon-props.js';
|
|
10
|
+
// Deliberately the Svelte-local copy, not `../strokeWidth.js` — svelte-package
|
|
11
|
+
// only copies this directory, so an outside import dangles. See stroke-width.ts.
|
|
12
|
+
import { resolveStrokeWidth } from './stroke-width.js';
|
|
7
13
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
14
|
+
/**
|
|
15
|
+
* Shared rendering shell every generated Svelte icon component wraps —
|
|
16
|
+
* the Svelte equivalent of `@skdx/icons/react`'s `createIcon`, sharing
|
|
17
|
+
* the same {@link IconNode} geometry and the same
|
|
18
|
+
* `size`/`color`/`strokeWidth`/`title` prop contract. Ships as raw source
|
|
19
|
+
* (compiled by the consumer's own Svelte compiler via `svelte-package`),
|
|
20
|
+
* matching every other Svelte component in this design system.
|
|
21
|
+
*/
|
|
22
|
+
interface Props extends IconProps {
|
|
23
|
+
name: string;
|
|
24
|
+
iconNode: IconNode;
|
|
25
|
+
}
|
|
20
26
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
27
|
+
let {
|
|
28
|
+
name,
|
|
29
|
+
iconNode,
|
|
30
|
+
size = 24,
|
|
31
|
+
color = 'currentColor',
|
|
32
|
+
strokeWidth = 2,
|
|
33
|
+
absoluteStrokeWidth,
|
|
34
|
+
title,
|
|
35
|
+
...rest
|
|
36
|
+
}: Props = $props();
|
|
31
37
|
</script>
|
|
32
38
|
|
|
33
39
|
<svg
|
|
@@ -1,16 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Svelte-local copy of `src/strokeWidth.ts`'s `resolveStrokeWidth`.
|
|
3
|
-
*
|
|
4
|
-
* Why a copy and not an import: the Svelte output is produced by
|
|
5
|
-
* `svelte-package --input src/svelte`, which copies only that directory. An
|
|
6
|
-
* import reaching outside it (`../strokeWidth.js`) survives typechecking but
|
|
7
|
-
* dangles in `dist/svelte`, so consumers — and the packaged test — fail to
|
|
8
|
-
* resolve it at runtime. Same constraint the Angular copy documents, a
|
|
9
|
-
* different tool.
|
|
10
|
-
*
|
|
11
|
-
* `../stroke-width.parity.test.ts` asserts this copy and the shared original
|
|
12
|
-
* agree across a table of inputs, so the duplication cannot silently drift.
|
|
13
|
-
*/
|
|
14
1
|
/**
|
|
15
2
|
* Resolves the `stroke-width` actually rendered onto an icon's `<svg>`.
|
|
16
3
|
*
|
|
@@ -1,16 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Svelte-local copy of `src/strokeWidth.ts`'s `resolveStrokeWidth`.
|
|
3
|
-
*
|
|
4
|
-
* Why a copy and not an import: the Svelte output is produced by
|
|
5
|
-
* `svelte-package --input src/svelte`, which copies only that directory. An
|
|
6
|
-
* import reaching outside it (`../strokeWidth.js`) survives typechecking but
|
|
7
|
-
* dangles in `dist/svelte`, so consumers — and the packaged test — fail to
|
|
8
|
-
* resolve it at runtime. Same constraint the Angular copy documents, a
|
|
9
|
-
* different tool.
|
|
10
|
-
*
|
|
11
|
-
* `../stroke-width.parity.test.ts` asserts this copy and the shared original
|
|
12
|
-
* agree across a table of inputs, so the duplication cannot silently drift.
|
|
13
|
-
*/
|
|
14
1
|
/**
|
|
15
2
|
* Resolves the `stroke-width` actually rendered onto an icon's `<svg>`.
|
|
16
3
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var r=Object.defineProperty;var
|
|
1
|
+
"use strict";var r=Object.defineProperty;var d=Object.getOwnPropertyDescriptor;var p=Object.getOwnPropertyNames;var g=Object.prototype.hasOwnProperty;var u=(e,t)=>{for(var o in t)r(e,o,{get:t[o],enumerable:!0})},f=(e,t,o,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of p(t))!g.call(e,n)&&n!==o&&r(e,n,{get:()=>t[n],enumerable:!(i=d(t,n))||i.enumerable});return e};var I=e=>f(r({},"__esModule",{value:!0}),e);var N={};u(N,{getIcon:()=>y,registerIcons:()=>a,subscribeToIconRegistry:()=>v});module.exports=I(N);var c=new Map,s=new Set;function a(e){for(let[t,o]of Object.entries(e))c.set(t,o);for(let t of s)t.requestUpdate()}function y(e){return c.get(e)}function v(e){return s.add(e),()=>s.delete(e)}0&&(module.exports={getIcon,registerIcons,subscribeToIconRegistry});
|
|
@@ -16,3 +16,7 @@ export type IconRegistryEntries = Record<string, IconNode>;
|
|
|
16
16
|
export declare function registerIcons(icons: IconRegistryEntries): void;
|
|
17
17
|
/** Looks up a registered icon's geometry by name — used by `<skdx-icon>`. */
|
|
18
18
|
export declare function getIcon(name: string): IconNode | undefined;
|
|
19
|
+
/** Subscribes a connected `<skdx-icon>` to redraw on later `registerIcons()` calls; returns the unsubscribe. */
|
|
20
|
+
export declare function subscribeToIconRegistry(el: {
|
|
21
|
+
requestUpdate(): void;
|
|
22
|
+
}): () => void;
|
|
@@ -16,3 +16,7 @@ export type IconRegistryEntries = Record<string, IconNode>;
|
|
|
16
16
|
export declare function registerIcons(icons: IconRegistryEntries): void;
|
|
17
17
|
/** Looks up a registered icon's geometry by name — used by `<skdx-icon>`. */
|
|
18
18
|
export declare function getIcon(name: string): IconNode | undefined;
|
|
19
|
+
/** Subscribes a connected `<skdx-icon>` to redraw on later `registerIcons()` calls; returns the unsubscribe. */
|
|
20
|
+
export declare function subscribeToIconRegistry(el: {
|
|
21
|
+
requestUpdate(): void;
|
|
22
|
+
}): () => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var t=/* @__PURE__ */new
|
|
1
|
+
var e=/* @__PURE__ */new Map,t=/* @__PURE__ */new Set;function n(n){for(const[t,o]of Object.entries(n))e.set(t,o);for(const e of t)e.requestUpdate()}function o(t){return e.get(t)}function r(e){return t.add(e),()=>t.delete(e)}export{o as getIcon,n as registerIcons,r as subscribeToIconRegistry};
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var c=Object.defineProperty;var p=Object.getOwnPropertyDescriptor;var T=Object.getOwnPropertyNames;var C=Object.prototype.hasOwnProperty;var b=e=>{throw TypeError(e)};var W=(e,t)=>{for(var i in t)c(e,i,{get:t[i],enumerable:!0})},z=(e,t,i,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of T(t))!C.call(e,r)&&r!==i&&c(e,r,{get:()=>t[r],enumerable:!(s=p(t,r))||s.enumerable});return e};var E=e=>z(c({},"__esModule",{value:!0}),e),h=(e,t,i,s)=>{for(var r=s>1?void 0:s?p(t,i):t,u=e.length-1,d;u>=0;u--)(d=e[u])&&(r=(s?d(t,i,r):d(r))||r);return s&&r&&c(t,i,r),r};var g=(e,t,i)=>t.has(e)||b("Cannot "+i);var f=(e,t,i)=>(g(e,t,"read from private field"),i?i.call(e):t.get(e)),v=(e,t,i)=>t.has(e)?b("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,i),$=(e,t,i,s)=>(g(e,t,"write to private field"),s?s.call(e,i):t.set(e,i),i);var B={};W(B,{SkdxIcon:()=>o});module.exports=E(B);var l=require("lit"),n=require("lit/decorators.js"),k=require("lit/directives/unsafe-svg.js"),w=require("../strokeWidth.cjs"),y=require("./icon-base.cjs"),m=require("./icon-registry.cjs");var R=24,a,o=class extends l.LitElement{constructor(){super(...arguments);this.name="";this.size=R;this.color="currentColor";this.strokeWidth=2;this.absoluteStrokeWidth=!1;v(this,a)}createRenderRoot(){return this}connectedCallback(){super.connectedCallback(),$(this,a,(0,m.subscribeToIconRegistry)(this))}disconnectedCallback(){var i;super.disconnectedCallback(),(i=f(this,a))==null||i.call(this)}render(){let i=(0,m.getIcon)(this.name)??[];return l.html`<svg
|
|
2
2
|
xmlns="http://www.w3.org/2000/svg"
|
|
3
3
|
width=${this.size}
|
|
4
4
|
height=${this.size}
|
|
5
5
|
viewBox="0 0 24 24"
|
|
6
6
|
fill="none"
|
|
7
7
|
stroke=${this.color}
|
|
8
|
-
stroke-width=${(0,
|
|
8
|
+
stroke-width=${(0,w.resolveStrokeWidth)(this.strokeWidth,this.size,this.absoluteStrokeWidth)}
|
|
9
9
|
stroke-linecap="round"
|
|
10
10
|
stroke-linejoin="round"
|
|
11
|
-
role=${this.iconTitle?"img":
|
|
12
|
-
aria-hidden=${this.iconTitle?
|
|
11
|
+
role=${this.iconTitle?"img":l.nothing}
|
|
12
|
+
aria-hidden=${this.iconTitle?l.nothing:"true"}
|
|
13
13
|
focusable="false"
|
|
14
14
|
data-skdx-icon=${this.name}
|
|
15
15
|
>
|
|
16
|
-
${this.iconTitle?
|
|
17
|
-
</svg>`}};
|
|
16
|
+
${this.iconTitle?l.html`<title>${this.iconTitle}</title>`:l.nothing}${(0,k.unsafeSVG)((0,y.iconMarkup)(i))}
|
|
17
|
+
</svg>`}};a=new WeakMap,h([(0,n.property)({type:String})],o.prototype,"name",2),h([(0,n.property)({type:Number})],o.prototype,"size",2),h([(0,n.property)({type:String})],o.prototype,"color",2),h([(0,n.property)({type:String,attribute:"stroke-width"})],o.prototype,"strokeWidth",2),h([(0,n.property)({type:Boolean,attribute:"absolute-stroke-width"})],o.prototype,"absoluteStrokeWidth",2),h([(0,n.property)({type:String,attribute:"title"})],o.prototype,"iconTitle",2),o=h([(0,n.customElement)("skdx-icon")],o);0&&(module.exports={SkdxIcon});
|
|
@@ -17,6 +17,7 @@ import { LitElement } from 'lit';
|
|
|
17
17
|
* consumer rather than to per-icon metadata.
|
|
18
18
|
*/
|
|
19
19
|
export declare class SkdxIcon extends LitElement {
|
|
20
|
+
#private;
|
|
20
21
|
/** Registered icon name — see `registerIcons()`. */
|
|
21
22
|
name: string;
|
|
22
23
|
/** Rendered width/height in pixels (icons are square). @default 24 */
|
|
@@ -35,5 +36,7 @@ export declare class SkdxIcon extends LitElement {
|
|
|
35
36
|
*/
|
|
36
37
|
iconTitle?: string;
|
|
37
38
|
createRenderRoot(): this;
|
|
39
|
+
connectedCallback(): void;
|
|
40
|
+
disconnectedCallback(): void;
|
|
38
41
|
protected render(): import("lit").TemplateResult<1>;
|
|
39
42
|
}
|
|
@@ -17,6 +17,7 @@ import { LitElement } from 'lit';
|
|
|
17
17
|
* consumer rather than to per-icon metadata.
|
|
18
18
|
*/
|
|
19
19
|
export declare class SkdxIcon extends LitElement {
|
|
20
|
+
#private;
|
|
20
21
|
/** Registered icon name — see `registerIcons()`. */
|
|
21
22
|
name: string;
|
|
22
23
|
/** Rendered width/height in pixels (icons are square). @default 24 */
|
|
@@ -35,5 +36,7 @@ export declare class SkdxIcon extends LitElement {
|
|
|
35
36
|
*/
|
|
36
37
|
iconTitle?: string;
|
|
37
38
|
createRenderRoot(): this;
|
|
39
|
+
connectedCallback(): void;
|
|
40
|
+
disconnectedCallback(): void;
|
|
38
41
|
protected render(): import("lit").TemplateResult<1>;
|
|
39
42
|
}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
var t=Object.defineProperty,e=Object.getOwnPropertyDescriptor,i=(i,o,
|
|
1
|
+
var t=Object.defineProperty,e=Object.getOwnPropertyDescriptor,i=t=>{throw TypeError(t)},r=(i,r,o,s)=>{for(var n,a=s>1?void 0:s?e(r,o):r,h=i.length-1;h>=0;h--)(n=i[h])&&(a=(s?n(r,o,a):n(a))||a);return s&&a&&t(r,o,a),a},o=(t,e,r)=>e.has(t)||i("Cannot "+r);import{html as s,LitElement as n,nothing as a}from"lit";import{customElement as h,property as l}from"lit/decorators.js";import{unsafeSVG as c}from"lit/directives/unsafe-svg.js";import{resolveStrokeWidth as d}from"../strokeWidth.js";import{iconMarkup as p}from"./icon-base.js";import{getIcon as m,subscribeToIconRegistry as u}from"./icon-registry.js";var k,b=class extends n{constructor(){var t,e;super(...arguments),this.name="",this.size=24,this.color="currentColor",this.strokeWidth=2,this.absoluteStrokeWidth=!1,t=this,(e=k).has(t)?i("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,void 0)}createRenderRoot(){return this}connectedCallback(){var t,e,i;super.connectedCallback(),t=this,e=k,i=u(this),o(t,e,"write to private field"),e.set(t,i)}disconnectedCallback(){var t,e;super.disconnectedCallback(),null==(o(this,e=k,"read from private field"),t=e.get(this))||t.call(this)}render(){const t=m(this.name)??[];return s`<svg
|
|
2
2
|
xmlns="http://www.w3.org/2000/svg"
|
|
3
3
|
width=${this.size}
|
|
4
4
|
height=${this.size}
|
|
5
5
|
viewBox="0 0 24 24"
|
|
6
6
|
fill="none"
|
|
7
7
|
stroke=${this.color}
|
|
8
|
-
stroke-width=${
|
|
8
|
+
stroke-width=${d(this.strokeWidth,this.size,this.absoluteStrokeWidth)}
|
|
9
9
|
stroke-linecap="round"
|
|
10
10
|
stroke-linejoin="round"
|
|
11
|
-
role=${this.iconTitle?"img":
|
|
12
|
-
aria-hidden=${this.iconTitle?
|
|
11
|
+
role=${this.iconTitle?"img":a}
|
|
12
|
+
aria-hidden=${this.iconTitle?a:"true"}
|
|
13
13
|
focusable="false"
|
|
14
14
|
data-skdx-icon=${this.name}
|
|
15
15
|
>
|
|
16
|
-
${this.iconTitle?
|
|
17
|
-
</svg>`}};
|
|
16
|
+
${this.iconTitle?s`<title>${this.iconTitle}</title>`:a}${c(p(t))}
|
|
17
|
+
</svg>`}};k=new WeakMap,r([l({type:String})],b.prototype,"name",2),r([l({type:Number})],b.prototype,"size",2),r([l({type:String})],b.prototype,"color",2),r([l({type:String,attribute:"stroke-width"})],b.prototype,"strokeWidth",2),r([l({type:Boolean,attribute:"absolute-stroke-width"})],b.prototype,"absoluteStrokeWidth",2),r([l({type:String,attribute:"title"})],b.prototype,"iconTitle",2),b=r([h("skdx-icon")],b);export{b as SkdxIcon};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@skdx/icons",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.28.0",
|
|
4
4
|
"description": "Themeable SVG icon components for the SkandaDX design system — 24x24 by default, colored via currentColor so --skdx-* theme tokens apply",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"publishConfig": {
|