@juice-js/icons 0.0.0-stage → 2.5.0-alpha.5
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 +16 -2
- package/fesm2022/juice-js-icons.mjs +104 -0
- package/fesm2022/juice-js-icons.mjs.map +1 -0
- package/package.json +38 -4
- package/types/juice-js-icons.d.ts +37 -0
package/README.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @juice-js/icons
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Inline SVG icons for Juice apps, drawn from the `lucide` data package (peer dependency). Material-free.
|
|
4
|
+
|
|
5
|
+
```ts
|
|
6
|
+
import { Search, ChevronDown } from 'lucide';
|
|
7
|
+
import { provideJuiceIcons } from '@juice-js/icons';
|
|
8
|
+
|
|
9
|
+
providers: [provideJuiceIcons({ search: Search, 'chevron-down': ChevronDown })];
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
```html
|
|
13
|
+
<juice-icon name="search" /> <!-- decorative: aria-hidden -->
|
|
14
|
+
<juice-icon name="search" size="20" label="Search" /> <!-- role=img + aria-label -->
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Icons use `currentColor`. An unknown name renders nothing and logs a warning in dev mode. Register only the icons you use so the rest tree-shake away.
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { InjectionToken, makeEnvironmentProviders, input, inject, ElementRef, DOCUMENT, computed, isDevMode, effect, ViewEncapsulation, ChangeDetectionStrategy, Component } from '@angular/core';
|
|
3
|
+
|
|
4
|
+
/** Multi token: every `provideJuiceIcons` call contributes one set; later sets win on a name clash. */
|
|
5
|
+
const JUICE_ICONS = new InjectionToken('JUICE_ICONS');
|
|
6
|
+
/**
|
|
7
|
+
* Registers icons for `<juice-icon>`. Pass only the icons the app uses so the rest tree-shake away:
|
|
8
|
+
* `provideJuiceIcons({ search: Search, 'chevron-down': ChevronDown })`, with the nodes imported from `lucide`.
|
|
9
|
+
*/
|
|
10
|
+
function provideJuiceIcons(icons) {
|
|
11
|
+
return makeEnvironmentProviders([{ provide: JUICE_ICONS, useValue: icons, multi: true }]);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const SVG_NS = 'http://www.w3.org/2000/svg';
|
|
15
|
+
const warned = new Set();
|
|
16
|
+
/**
|
|
17
|
+
* Inline SVG icon drawn from the registered lucide data. It inherits `currentColor`, is `aria-hidden` unless
|
|
18
|
+
* `label` is set, and renders nothing for an unknown name (with a dev-mode warning).
|
|
19
|
+
*/
|
|
20
|
+
class JuiceIcon {
|
|
21
|
+
constructor() {
|
|
22
|
+
/** Registered icon name. */
|
|
23
|
+
this.name = input.required(/* @ts-ignore */
|
|
24
|
+
...(ngDevMode ? [{ debugName: "name" }] : /* istanbul ignore next */ []));
|
|
25
|
+
/** Edge length in px (or any CSS length string). */
|
|
26
|
+
this.size = input(16, /* @ts-ignore */
|
|
27
|
+
...(ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []));
|
|
28
|
+
/** Accessible name. Without it the icon is decorative. */
|
|
29
|
+
this.label = input('', /* @ts-ignore */
|
|
30
|
+
...(ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []));
|
|
31
|
+
this.host = inject(ElementRef).nativeElement;
|
|
32
|
+
this.doc = inject(DOCUMENT);
|
|
33
|
+
this.sets = inject(JUICE_ICONS, { optional: true }) ?? [];
|
|
34
|
+
this.node = computed(() => {
|
|
35
|
+
const name = this.name();
|
|
36
|
+
for (let i = this.sets.length - 1; i >= 0; i--) {
|
|
37
|
+
const set = this.sets[i];
|
|
38
|
+
if (Object.prototype.hasOwnProperty.call(set, name))
|
|
39
|
+
return set[name];
|
|
40
|
+
}
|
|
41
|
+
if (isDevMode() && !warned.has(name)) {
|
|
42
|
+
warned.add(name);
|
|
43
|
+
console.warn(`[juice-icon] Unknown icon "${name}". Register it with provideJuiceIcons().`);
|
|
44
|
+
}
|
|
45
|
+
return undefined;
|
|
46
|
+
}, /* @ts-ignore */
|
|
47
|
+
...(ngDevMode ? [{ debugName: "node" }] : /* istanbul ignore next */ []));
|
|
48
|
+
effect(() => {
|
|
49
|
+
const node = this.node();
|
|
50
|
+
const size = this.size();
|
|
51
|
+
this.host.replaceChildren();
|
|
52
|
+
if (!node)
|
|
53
|
+
return;
|
|
54
|
+
const length = typeof size === 'number' ? `${size}px` : size;
|
|
55
|
+
const svg = this.doc.createElementNS(SVG_NS, 'svg');
|
|
56
|
+
setAttrs(svg, {
|
|
57
|
+
xmlns: SVG_NS,
|
|
58
|
+
viewBox: '0 0 24 24',
|
|
59
|
+
fill: 'none',
|
|
60
|
+
stroke: 'currentColor',
|
|
61
|
+
'stroke-width': '2',
|
|
62
|
+
'stroke-linecap': 'round',
|
|
63
|
+
'stroke-linejoin': 'round',
|
|
64
|
+
'aria-hidden': 'true',
|
|
65
|
+
focusable: 'false',
|
|
66
|
+
});
|
|
67
|
+
svg.style.width = length;
|
|
68
|
+
svg.style.height = length;
|
|
69
|
+
for (const [tag, attrs] of node) {
|
|
70
|
+
// lucide data only uses graphic primitives; refuse anything else so a bad icon set cannot inject script.
|
|
71
|
+
if (!/^[a-z]+$/.test(tag) || tag === 'script' || tag === 'foreignObject')
|
|
72
|
+
continue;
|
|
73
|
+
const child = this.doc.createElementNS(SVG_NS, tag);
|
|
74
|
+
setAttrs(child, attrs);
|
|
75
|
+
svg.appendChild(child);
|
|
76
|
+
}
|
|
77
|
+
this.host.appendChild(svg);
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: JuiceIcon, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
81
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.0.6", type: JuiceIcon, isStandalone: true, selector: "juice-icon", inputs: { name: { classPropertyName: "name", publicName: "name", isSignal: true, isRequired: true, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "attr.role": "label() ? \"img\" : null", "attr.aria-label": "label() || null", "attr.aria-hidden": "label() ? null : \"true\"" } }, ngImport: i0, template: '', isInline: true, styles: ["juice-icon{display:inline-flex;flex:none;align-items:center;justify-content:center;line-height:0;vertical-align:middle}juice-icon>svg{display:block}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
82
|
+
}
|
|
83
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: JuiceIcon, decorators: [{
|
|
84
|
+
type: Component,
|
|
85
|
+
args: [{ selector: 'juice-icon', template: '', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, host: {
|
|
86
|
+
'[attr.role]': 'label() ? "img" : null',
|
|
87
|
+
'[attr.aria-label]': 'label() || null',
|
|
88
|
+
'[attr.aria-hidden]': 'label() ? null : "true"',
|
|
89
|
+
}, styles: ["juice-icon{display:inline-flex;flex:none;align-items:center;justify-content:center;line-height:0;vertical-align:middle}juice-icon>svg{display:block}\n"] }]
|
|
90
|
+
}], ctorParameters: () => [], propDecorators: { name: [{ type: i0.Input, args: [{ isSignal: true, alias: "name", required: true }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }] } });
|
|
91
|
+
function setAttrs(el, attrs) {
|
|
92
|
+
for (const [key, value] of Object.entries(attrs)) {
|
|
93
|
+
if (value == null || /^on/i.test(key) || !/^[A-Za-z][\w:-]*$/.test(key))
|
|
94
|
+
continue;
|
|
95
|
+
el.setAttribute(key, String(value));
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Generated bundle index. Do not edit.
|
|
101
|
+
*/
|
|
102
|
+
|
|
103
|
+
export { JUICE_ICONS, JuiceIcon, provideJuiceIcons };
|
|
104
|
+
//# sourceMappingURL=juice-js-icons.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"juice-js-icons.mjs","sources":["../../../../projects/juice-js/icons/src/lib/icons.ts","../../../../projects/juice-js/icons/src/lib/icon.component.ts","../../../../projects/juice-js/icons/src/juice-js-icons.ts"],"sourcesContent":["import { EnvironmentProviders, InjectionToken, makeEnvironmentProviders } from '@angular/core';\nimport type { IconNode } from 'lucide';\n\nexport type { IconNode } from 'lucide';\n\n/** A registry of icon data, keyed by the name used in `<juice-icon name>`. */\nexport type JuiceIconSet = Readonly<Record<string, IconNode>>;\n\n/** Multi token: every `provideJuiceIcons` call contributes one set; later sets win on a name clash. */\nexport const JUICE_ICONS = new InjectionToken<JuiceIconSet[]>('JUICE_ICONS');\n\n/**\n * Registers icons for `<juice-icon>`. Pass only the icons the app uses so the rest tree-shake away:\n * `provideJuiceIcons({ search: Search, 'chevron-down': ChevronDown })`, with the nodes imported from `lucide`.\n */\nexport function provideJuiceIcons(icons: Record<string, IconNode>): EnvironmentProviders {\n return makeEnvironmentProviders([{ provide: JUICE_ICONS, useValue: icons, multi: true }]);\n}\n","import {\n ChangeDetectionStrategy,\n Component,\n DOCUMENT,\n ViewEncapsulation,\n computed,\n effect,\n ElementRef,\n inject,\n input,\n isDevMode,\n} from '@angular/core';\nimport { JUICE_ICONS, IconNode } from './icons';\n\nconst SVG_NS = 'http://www.w3.org/2000/svg';\nconst warned = new Set<string>();\n\n/**\n * Inline SVG icon drawn from the registered lucide data. It inherits `currentColor`, is `aria-hidden` unless\n * `label` is set, and renders nothing for an unknown name (with a dev-mode warning).\n */\n@Component({\n selector: 'juice-icon',\n template: '',\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n styles: `\n juice-icon {\n display: inline-flex;\n flex: none;\n align-items: center;\n justify-content: center;\n line-height: 0;\n vertical-align: middle;\n }\n juice-icon > svg {\n display: block;\n }\n `,\n host: {\n '[attr.role]': 'label() ? \"img\" : null',\n '[attr.aria-label]': 'label() || null',\n '[attr.aria-hidden]': 'label() ? null : \"true\"',\n },\n})\nexport class JuiceIcon {\n /** Registered icon name. */\n readonly name = input.required<string>();\n /** Edge length in px (or any CSS length string). */\n readonly size = input<number | string>(16);\n /** Accessible name. Without it the icon is decorative. */\n readonly label = input<string>('');\n\n private readonly host = inject<ElementRef<HTMLElement>>(ElementRef).nativeElement;\n private readonly doc = inject(DOCUMENT);\n private readonly sets = inject(JUICE_ICONS, { optional: true }) ?? [];\n\n private readonly node = computed<IconNode | undefined>(() => {\n const name = this.name();\n for (let i = this.sets.length - 1; i >= 0; i--) {\n const set = this.sets[i];\n if (Object.prototype.hasOwnProperty.call(set, name)) return set[name];\n }\n if (isDevMode() && !warned.has(name)) {\n warned.add(name);\n console.warn(`[juice-icon] Unknown icon \"${name}\". Register it with provideJuiceIcons().`);\n }\n return undefined;\n });\n\n constructor() {\n effect(() => {\n const node = this.node();\n const size = this.size();\n this.host.replaceChildren();\n if (!node) return;\n const length = typeof size === 'number' ? `${size}px` : size;\n const svg = this.doc.createElementNS(SVG_NS, 'svg');\n setAttrs(svg, {\n xmlns: SVG_NS,\n viewBox: '0 0 24 24',\n fill: 'none',\n stroke: 'currentColor',\n 'stroke-width': '2',\n 'stroke-linecap': 'round',\n 'stroke-linejoin': 'round',\n 'aria-hidden': 'true',\n focusable: 'false',\n });\n svg.style.width = length;\n svg.style.height = length;\n for (const [tag, attrs] of node) {\n // lucide data only uses graphic primitives; refuse anything else so a bad icon set cannot inject script.\n if (!/^[a-z]+$/.test(tag) || tag === 'script' || tag === 'foreignObject') continue;\n const child = this.doc.createElementNS(SVG_NS, tag);\n setAttrs(child, attrs as Record<string, unknown>);\n svg.appendChild(child);\n }\n this.host.appendChild(svg);\n });\n }\n}\n\nfunction setAttrs(el: Element, attrs: Record<string, unknown>): void {\n for (const [key, value] of Object.entries(attrs)) {\n if (value == null || /^on/i.test(key) || !/^[A-Za-z][\\w:-]*$/.test(key)) continue;\n el.setAttribute(key, String(value));\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;AAQA;MACa,WAAW,GAAG,IAAI,cAAc,CAAiB,aAAa;AAE3E;;;AAGG;AACG,SAAU,iBAAiB,CAAC,KAA+B,EAAA;AAC/D,IAAA,OAAO,wBAAwB,CAAC,CAAC,EAAE,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC3F;;ACHA,MAAM,MAAM,GAAG,4BAA4B;AAC3C,MAAM,MAAM,GAAG,IAAI,GAAG,EAAU;AAEhC;;;AAGG;MAyBU,SAAS,CAAA;AAyBpB,IAAA,WAAA,GAAA;;QAvBS,IAAA,CAAA,IAAI,GAAG,KAAK,CAAC,QAAQ;iFAAU;;QAE/B,IAAA,CAAA,IAAI,GAAG,KAAK,CAAkB,EAAE;iFAAC;;QAEjC,IAAA,CAAA,KAAK,GAAG,KAAK,CAAS,EAAE;kFAAC;AAEjB,QAAA,IAAA,CAAA,IAAI,GAAG,MAAM,CAA0B,UAAU,CAAC,CAAC,aAAa;AAChE,QAAA,IAAA,CAAA,GAAG,GAAG,MAAM,CAAC,QAAQ,CAAC;AACtB,QAAA,IAAA,CAAA,IAAI,GAAG,MAAM,CAAC,WAAW,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,IAAI,EAAE;AAEpD,QAAA,IAAA,CAAA,IAAI,GAAG,QAAQ,CAAuB,MAAK;AAC1D,YAAA,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,EAAE;AACxB,YAAA,KAAK,IAAI,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,IAAI,C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E,wBAAwB;AACvC,wBAAA,mBAAmB,EAAE,iBAAiB;AACtC,wBAAA,oBAAoB,EAAE,yBAAyB;AAChD,qBAAA,EAAA,MAAA,EAAA,CAAA,wJAAA,CAAA,EAAA;;AA4DH,SAAS,QAAQ,CAAC,EAAW,EAAE,KAA8B,EAAA;AAC3D,IAAA,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;AAChD,QAAA,IAAI,KAAK,IAAI,IAAI,IAAI,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,mBAAmB,CAAC,IAAI,CAAC,GAAG,CAAC;YAAE;QACzE,EAAE,CAAC,YAAY,CAAC,GAAG,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC;IACrC;AACF;;AC5GA;;AAEG;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,40 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@juice-js/icons",
|
|
3
|
-
"version": "
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "2.5.0-alpha.5",
|
|
4
|
+
"description": "Juice icons: an inline SVG icon component over the lucide data package",
|
|
5
|
+
"author": "jack@creatorflow.io",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"bugs": {
|
|
8
|
+
"url": "https://github.com/PavellisLabs/juice-layout/issues"
|
|
9
|
+
},
|
|
10
|
+
"homepage": "https://github.com/PavellisLabs/juice-layout#readme",
|
|
11
|
+
"publishConfig": {
|
|
12
|
+
"access": "public",
|
|
13
|
+
"provenance": true
|
|
14
|
+
},
|
|
15
|
+
"repository": {
|
|
16
|
+
"type": "git",
|
|
17
|
+
"url": "git+https://github.com/PavellisLabs/juice-layout.git"
|
|
18
|
+
},
|
|
19
|
+
"peerDependencies": {
|
|
20
|
+
"@angular/common": "^22.0.0",
|
|
21
|
+
"@angular/core": "^22.0.0",
|
|
22
|
+
"lucide": "^1.0.0"
|
|
23
|
+
},
|
|
24
|
+
"dependencies": {
|
|
25
|
+
"tslib": "^2.3.0"
|
|
26
|
+
},
|
|
27
|
+
"sideEffects": false,
|
|
28
|
+
"module": "fesm2022/juice-js-icons.mjs",
|
|
29
|
+
"typings": "types/juice-js-icons.d.ts",
|
|
30
|
+
"exports": {
|
|
31
|
+
"./package.json": {
|
|
32
|
+
"default": "./package.json"
|
|
33
|
+
},
|
|
34
|
+
".": {
|
|
35
|
+
"types": "./types/juice-js-icons.d.ts",
|
|
36
|
+
"default": "./fesm2022/juice-js-icons.mjs"
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
"type": "module"
|
|
40
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import * as _angular_core from '@angular/core';
|
|
2
|
+
import { InjectionToken, EnvironmentProviders } from '@angular/core';
|
|
3
|
+
import { IconNode } from 'lucide';
|
|
4
|
+
export { IconNode } from 'lucide';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Inline SVG icon drawn from the registered lucide data. It inherits `currentColor`, is `aria-hidden` unless
|
|
8
|
+
* `label` is set, and renders nothing for an unknown name (with a dev-mode warning).
|
|
9
|
+
*/
|
|
10
|
+
declare class JuiceIcon {
|
|
11
|
+
/** Registered icon name. */
|
|
12
|
+
readonly name: _angular_core.InputSignal<string>;
|
|
13
|
+
/** Edge length in px (or any CSS length string). */
|
|
14
|
+
readonly size: _angular_core.InputSignal<string | number>;
|
|
15
|
+
/** Accessible name. Without it the icon is decorative. */
|
|
16
|
+
readonly label: _angular_core.InputSignal<string>;
|
|
17
|
+
private readonly host;
|
|
18
|
+
private readonly doc;
|
|
19
|
+
private readonly sets;
|
|
20
|
+
private readonly node;
|
|
21
|
+
constructor();
|
|
22
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<JuiceIcon, never>;
|
|
23
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<JuiceIcon, "juice-icon", never, { "name": { "alias": "name"; "required": true; "isSignal": true; }; "size": { "alias": "size"; "required": false; "isSignal": true; }; "label": { "alias": "label"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/** A registry of icon data, keyed by the name used in `<juice-icon name>`. */
|
|
27
|
+
type JuiceIconSet = Readonly<Record<string, IconNode>>;
|
|
28
|
+
/** Multi token: every `provideJuiceIcons` call contributes one set; later sets win on a name clash. */
|
|
29
|
+
declare const JUICE_ICONS: InjectionToken<Readonly<Record<string, IconNode>>[]>;
|
|
30
|
+
/**
|
|
31
|
+
* Registers icons for `<juice-icon>`. Pass only the icons the app uses so the rest tree-shake away:
|
|
32
|
+
* `provideJuiceIcons({ search: Search, 'chevron-down': ChevronDown })`, with the nodes imported from `lucide`.
|
|
33
|
+
*/
|
|
34
|
+
declare function provideJuiceIcons(icons: Record<string, IconNode>): EnvironmentProviders;
|
|
35
|
+
|
|
36
|
+
export { JUICE_ICONS, JuiceIcon, provideJuiceIcons };
|
|
37
|
+
export type { JuiceIconSet };
|