@skdx/icons 0.29.0 → 0.30.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.
|
@@ -1 +1 @@
|
|
|
1
|
-
import*as e from"@angular/core";import{InjectionToken as t,inject as n,SkipSelf as o,Optional as r,ElementRef as i,Renderer2 as s,Input as a,Directive as l,input as d,booleanAttribute as c,computed as u,ChangeDetectionStrategy as g,Component as m}from"@angular/core";const p=new t("SKDX_ICON_ENTRIES");function h(e
|
|
1
|
+
import*as e from"@angular/core";import{InjectionToken as t,inject as n,SkipSelf as o,Optional as r,ElementRef as i,Renderer2 as s,Input as a,Directive as l,input as d,booleanAttribute as c,computed as u,ChangeDetectionStrategy as g,Component as m}from"@angular/core";const p=new t("SKDX_ICON_ENTRIES");function h(e){return e.reduce((e,t)=>Object.assign(e,t),{})}const k=new t("SKDX_ICON_REGISTRY",{factory:()=>h(n(p,{optional:!0})??[])});function b(e){return{provide:p,multi:!0,useFactory:t=>h([...t??[],e]),deps:[[new o,new r,p]]}}class SkdxIconNodeDirective{constructor(){this.host=n(i),this.renderer=n(s)}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:l,args:[{selector:"[skdxIconNode]",standalone:!0}]}],propDecorators:{node:[{type:a,args:["skdxIconNode"]}]}});class SkdxIconComponent{constructor(){this.registry=h(n(p,{optional:!0})??[]),this.name=d.required(...ngDevMode?[{debugName:"name"}]:[]),this.size=d(24,...ngDevMode?[{debugName:"size"}]:[]),this.color=d("currentColor",...ngDevMode?[{debugName:"color"}]:[]),this.strokeWidth=d(2,...ngDevMode?[{debugName:"strokeWidth"}]:[]),this.absoluteStrokeWidth=d(!1,{...ngDevMode?{debugName:"absoluteStrokeWidth"}:{},transform:c}),this.label=d(...ngDevMode?[void 0,{debugName:"label"}]:[]),this.renderedStrokeWidth=u(()=>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()),...ngDevMode?[{debugName:"renderedStrokeWidth"}]:[]),this.iconNode=u(()=>this.registry[this.name()]??[],...ngDevMode?[{debugName:"iconNode"}]:[])}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:{classPropertyName:"name",publicName:"name",isSignal:!0,isRequired:!0,transformFunction:null},size:{classPropertyName:"size",publicName:"size",isSignal:!0,isRequired:!1,transformFunction:null},color:{classPropertyName:"color",publicName:"color",isSignal:!0,isRequired:!1,transformFunction:null},strokeWidth:{classPropertyName:"strokeWidth",publicName:"strokeWidth",isSignal:!0,isRequired:!1,transformFunction:null},absoluteStrokeWidth:{classPropertyName:"absoluteStrokeWidth",publicName:"absoluteStrokeWidth",isSignal:!0,isRequired:!1,transformFunction:null},label:{classPropertyName:"label",publicName:"label",isSignal:!0,isRequired:!1,transformFunction:null}},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]="label() ? \'img\' : null"\n [attr.aria-hidden]="label() ? null : \'true\'"\n focusable="false"\n [attr.data-skdx-icon]="name()"\n >\n @if (label()) {\n <title>{{ label() }}</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:m,args:[{selector:"skdx-icon",standalone:!0,imports:[SkdxIconNodeDirective],changeDetection:g.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]="label() ? \'img\' : null"\n [attr.aria-hidden]="label() ? null : \'true\'"\n focusable="false"\n [attr.data-skdx-icon]="name()"\n >\n @if (label()) {\n <title>{{ label() }}</title>\n }\n <g [skdxIconNode]="iconNode()"></g>\n </svg>\n '}]}],propDecorators:{name:[{type:e.Input,args:[{isSignal:!0,alias:"name",required:!0}]}],size:[{type:e.Input,args:[{isSignal:!0,alias:"size",required:!1}]}],color:[{type:e.Input,args:[{isSignal:!0,alias:"color",required:!1}]}],strokeWidth:[{type:e.Input,args:[{isSignal:!0,alias:"strokeWidth",required:!1}]}],absoluteStrokeWidth:[{type:e.Input,args:[{isSignal:!0,alias:"absoluteStrokeWidth",required:!1}]}],label:[{type:e.Input,args:[{isSignal:!0,alias:"label",required:!1}]}]}});export{k as SKDX_ICON_REGISTRY,SkdxIconComponent,b as provideIcons};
|
|
@@ -3,11 +3,18 @@ import { InjectionToken, Provider, Signal } from '@angular/core';
|
|
|
3
3
|
|
|
4
4
|
type IconNode = ReadonlyArray<readonly [string, Record<string, string>]>;
|
|
5
5
|
type IconRegistryEntries = Record<string, IconNode>;
|
|
6
|
-
/**
|
|
6
|
+
/**
|
|
7
|
+
* Merged icon registry every `<skdx-icon name>` resolves against — the union of every `provideIcons()` call in the injector tree.
|
|
8
|
+
* Its default factory is root-scoped and caches on first resolution, so injecting this token
|
|
9
|
+
* directly only reflects registrations visible from wherever it first resolved; component-scoped
|
|
10
|
+
* `provideIcons()` calls made below that point won't show up here — `<skdx-icon>` reads
|
|
11
|
+
* `SKDX_ICON_ENTRIES` itself at its own injector to stay accurate.
|
|
12
|
+
*/
|
|
7
13
|
declare const SKDX_ICON_REGISTRY: InjectionToken<IconRegistryEntries>;
|
|
8
14
|
/**
|
|
9
15
|
* Registers icons for `<skdx-icon name="...">` to resolve by name — Angular Material's `provideIcons()`-style API.
|
|
10
|
-
* Call once per icon set (app root, a feature route, a lazy-loaded module);
|
|
16
|
+
* Call once per icon set (app root, a feature route, a lazy-loaded module, or a component); calls
|
|
17
|
+
* at the same injector and nested calls in descendant injectors all merge rather than overwrite.
|
|
11
18
|
*/
|
|
12
19
|
declare function provideIcons(icons: IconRegistryEntries): Provider;
|
|
13
20
|
|
|
@@ -3,11 +3,18 @@ import { InjectionToken, Provider, Signal } from '@angular/core';
|
|
|
3
3
|
|
|
4
4
|
type IconNode = ReadonlyArray<readonly [string, Record<string, string>]>;
|
|
5
5
|
type IconRegistryEntries = Record<string, IconNode>;
|
|
6
|
-
/**
|
|
6
|
+
/**
|
|
7
|
+
* Merged icon registry every `<skdx-icon name>` resolves against — the union of every `provideIcons()` call in the injector tree.
|
|
8
|
+
* Its default factory is root-scoped and caches on first resolution, so injecting this token
|
|
9
|
+
* directly only reflects registrations visible from wherever it first resolved; component-scoped
|
|
10
|
+
* `provideIcons()` calls made below that point won't show up here — `<skdx-icon>` reads
|
|
11
|
+
* `SKDX_ICON_ENTRIES` itself at its own injector to stay accurate.
|
|
12
|
+
*/
|
|
7
13
|
declare const SKDX_ICON_REGISTRY: InjectionToken<IconRegistryEntries>;
|
|
8
14
|
/**
|
|
9
15
|
* Registers icons for `<skdx-icon name="...">` to resolve by name — Angular Material's `provideIcons()`-style API.
|
|
10
|
-
* Call once per icon set (app root, a feature route, a lazy-loaded module);
|
|
16
|
+
* Call once per icon set (app root, a feature route, a lazy-loaded module, or a component); calls
|
|
17
|
+
* at the same injector and nested calls in descendant injectors all merge rather than overwrite.
|
|
11
18
|
*/
|
|
12
19
|
declare function provideIcons(icons: IconRegistryEntries): Provider;
|
|
13
20
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@skdx/icons",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.30.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": {
|