aeico-components 0.1.7 → 0.1.8
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/alert.cjs +637 -4
- package/dist/alert.cjs.map +7 -1
- package/dist/alert.js +575 -3
- package/dist/alert.js.map +7 -1
- package/dist/badge.cjs +573 -4
- package/dist/badge.cjs.map +7 -1
- package/dist/badge.js +510 -3
- package/dist/badge.js.map +7 -1
- package/dist/breadcrumb.cjs +709 -5
- package/dist/breadcrumb.cjs.map +7 -1
- package/dist/breadcrumb.js +644 -4
- package/dist/breadcrumb.js.map +7 -1
- package/dist/button-group.cjs +546 -4
- package/dist/button-group.cjs.map +7 -1
- package/dist/button-group.js +489 -3
- package/dist/button-group.js.map +7 -1
- package/dist/button.cjs +834 -4
- package/dist/button.cjs.map +7 -1
- package/dist/button.js +771 -3
- package/dist/button.js.map +7 -1
- package/dist/card.cjs +574 -4
- package/dist/card.cjs.map +7 -1
- package/dist/card.js +516 -3
- package/dist/card.js.map +7 -1
- package/dist/checkbox.cjs +867 -4
- package/dist/checkbox.cjs.map +7 -1
- package/dist/checkbox.js +794 -3
- package/dist/checkbox.js.map +7 -1
- package/dist/copy-button.cjs +1046 -4
- package/dist/copy-button.cjs.map +7 -1
- package/dist/copy-button.js +969 -3
- package/dist/copy-button.js.map +7 -1
- package/dist/detail-group.cjs +531 -4
- package/dist/detail-group.cjs.map +7 -1
- package/dist/detail-group.js +474 -3
- package/dist/detail-group.js.map +7 -1
- package/dist/detail.cjs +627 -4
- package/dist/detail.cjs.map +7 -1
- package/dist/detail.js +569 -3
- package/dist/detail.js.map +7 -1
- package/dist/dialog.cjs +738 -4
- package/dist/dialog.cjs.map +7 -1
- package/dist/dialog.js +665 -3
- package/dist/dialog.js.map +7 -1
- package/dist/divider.cjs +558 -4
- package/dist/divider.cjs.map +7 -1
- package/dist/divider.js +502 -3
- package/dist/divider.js.map +7 -1
- package/dist/drawer.cjs +818 -4
- package/dist/drawer.cjs.map +7 -1
- package/dist/drawer.js +749 -3
- package/dist/drawer.js.map +7 -1
- package/dist/dropdown.cjs +1396 -5
- package/dist/dropdown.cjs.map +7 -1
- package/dist/dropdown.js +1316 -4
- package/dist/dropdown.js.map +7 -1
- package/dist/icon-button.cjs +999 -4
- package/dist/icon-button.cjs.map +7 -1
- package/dist/icon-button.js +930 -3
- package/dist/icon-button.js.map +7 -1
- package/dist/icon.cjs +613 -4
- package/dist/icon.cjs.map +7 -1
- package/dist/icon.js +547 -3
- package/dist/icon.js.map +7 -1
- package/dist/index.cjs +6532 -74
- package/dist/index.cjs.map +7 -1
- package/dist/index.js +6183 -73
- package/dist/index.js.map +7 -1
- package/dist/menu.cjs +841 -4
- package/dist/menu.cjs.map +7 -1
- package/dist/menu.js +785 -3
- package/dist/menu.js.map +7 -1
- package/dist/navbar.cjs +622 -4
- package/dist/navbar.cjs.map +7 -1
- package/dist/navbar.js +564 -3
- package/dist/navbar.js.map +7 -1
- package/dist/number-input.cjs +885 -4
- package/dist/number-input.cjs.map +7 -1
- package/dist/number-input.js +817 -3
- package/dist/number-input.js.map +7 -1
- package/dist/pagination.cjs +1099 -4
- package/dist/pagination.cjs.map +7 -1
- package/dist/pagination.js +1029 -3
- package/dist/pagination.js.map +7 -1
- package/dist/progress-bar.cjs +581 -4
- package/dist/progress-bar.cjs.map +7 -1
- package/dist/progress-bar.js +525 -3
- package/dist/progress-bar.js.map +7 -1
- package/dist/radio-group.cjs +973 -5
- package/dist/radio-group.cjs.map +7 -1
- package/dist/radio-group.js +899 -4
- package/dist/radio-group.js.map +7 -1
- package/dist/select.cjs +1242 -45
- package/dist/select.cjs.map +7 -1
- package/dist/select.js +1159 -44
- package/dist/select.js.map +7 -1
- package/dist/slider.cjs +1420 -4
- package/dist/slider.cjs.map +7 -1
- package/dist/slider.js +1351 -3
- package/dist/slider.js.map +7 -1
- package/dist/spinner.cjs +587 -4
- package/dist/spinner.cjs.map +7 -1
- package/dist/spinner.js +528 -3
- package/dist/spinner.js.map +7 -1
- package/dist/styles/layout.cjs +1 -0
- package/dist/styles/layout.js +1 -0
- package/dist/styles/radius.cjs +1 -0
- package/dist/styles/radius.js +1 -0
- package/dist/styles/variables.cjs +1 -0
- package/dist/styles/variables.js +1 -0
- package/dist/switch.cjs +1092 -4
- package/dist/switch.cjs.map +7 -1
- package/dist/switch.js +1013 -3
- package/dist/switch.js.map +7 -1
- package/dist/tabs.cjs +660 -6
- package/dist/tabs.cjs.map +7 -1
- package/dist/tabs.js +591 -5
- package/dist/tabs.js.map +7 -1
- package/dist/tag.cjs +591 -3
- package/dist/tag.cjs.map +7 -1
- package/dist/tag.js +532 -2
- package/dist/tag.js.map +7 -1
- package/dist/text-input.cjs +829 -4
- package/dist/text-input.cjs.map +7 -1
- package/dist/text-input.js +761 -3
- package/dist/text-input.js.map +7 -1
- package/dist/textarea.cjs +914 -3
- package/dist/textarea.cjs.map +7 -1
- package/dist/textarea.js +854 -2
- package/dist/textarea.js.map +7 -1
- package/dist/tooltip.cjs +764 -4
- package/dist/tooltip.cjs.map +7 -1
- package/dist/tooltip.js +711 -3
- package/dist/tooltip.js.map +7 -1
- package/dist/tree.cjs +1059 -4
- package/dist/tree.cjs.map +7 -1
- package/dist/tree.js +985 -3
- package/dist/tree.js.map +7 -1
- package/dist/types/dialog/dialog.d.ts +1 -0
- package/dist/types/drawer/drawer.d.ts +2 -0
- package/dist/types/icon/defines.d.ts +2 -0
- package/dist/types/menu/defines.d.ts +1 -0
- package/dist/types/menu/menu-item.d.ts +1 -0
- package/dist/types/menu/menu.d.ts +1 -0
- package/dist/types/styles/layout.d.ts +2 -0
- package/dist/types/styles/radius.d.ts +2 -0
- package/dist/types/styles/variables.d.ts +2 -0
- package/package.json +31 -7
- package/src/alert/alert.ts +3 -3
- package/src/badge/badge.ts +4 -4
- package/src/breadcrumb/breadcrumb-item.ts +2 -2
- package/src/breadcrumb/breadcrumb.ts +3 -3
- package/src/button/button.ts +4 -4
- package/src/button-group/button-group.ts +8 -9
- package/src/card/card.ts +3 -3
- package/src/checkbox/checkbox.ts +6 -6
- package/src/copy-button/copy-button.ts +4 -4
- package/src/detail/detail.ts +3 -3
- package/src/detail-group/detail-group.ts +2 -2
- package/src/dialog/dialog.ts +15 -14
- package/src/divider/divider.ts +3 -3
- package/src/drawer/drawer.ts +28 -11
- package/src/dropdown/dropdown-item.ts +2 -2
- package/src/dropdown/dropdown.ts +2 -2
- package/src/icon/defines.ts +2 -0
- package/src/icon/icon.ts +4 -4
- package/src/menu/defines.ts +1 -0
- package/src/menu/menu-item.ts +14 -4
- package/src/menu/menu.ts +5 -2
- package/src/navbar/navbar.ts +3 -3
- package/src/number-input/number-input.ts +5 -5
- package/src/pagination/pagination.ts +3 -3
- package/src/progress-bar/progress-bar.ts +3 -3
- package/src/radio-group/radio-group.ts +12 -8
- package/src/select/select-option.ts +2 -2
- package/src/select/select.ts +5 -5
- package/src/slider/slider.ts +6 -6
- package/src/spinner/spinner.ts +4 -4
- package/src/styles/components/button-group.css +2 -0
- package/src/styles/components/card.css +42 -18
- package/src/styles/components/checkbox.css +16 -5
- package/src/styles/components/dialog.css +1 -1
- package/src/styles/components/drawer.css +50 -9
- package/src/styles/components/field-label.css +1 -1
- package/src/styles/components/menu-item.css +6 -0
- package/src/styles/components/navbar.css +7 -28
- package/src/styles/components/radio-group.css +19 -0
- package/src/styles/components/slider.css +30 -5
- package/src/styles/components/switch.css +16 -2
- package/src/styles/layout.css +5 -2
- package/src/styles/radius.css +15 -0
- package/src/switch/switch.ts +6 -6
- package/src/tabs/tab-panel.ts +1 -1
- package/src/tabs/tab.ts +1 -1
- package/src/tabs/tabs.ts +2 -2
- package/src/tag/tag.ts +4 -4
- package/src/text-input/text-input.ts +5 -5
- package/src/textarea/textarea.ts +5 -5
- package/src/tooltip/tooltip.ts +2 -2
- package/src/tree/tree-item.ts +2 -2
- package/src/tree/tree.ts +2 -2
- package/dist/chunks/action-button.cjs +0 -296
- package/dist/chunks/action-button.cjs.map +0 -1
- package/dist/chunks/action-button.js +0 -297
- package/dist/chunks/action-button.js.map +0 -1
- package/dist/chunks/aeico-component.cjs +0 -17
- package/dist/chunks/aeico-component.cjs.map +0 -1
- package/dist/chunks/aeico-component.js +0 -18
- package/dist/chunks/aeico-component.js.map +0 -1
- package/dist/chunks/alert.cjs +0 -164
- package/dist/chunks/alert.cjs.map +0 -1
- package/dist/chunks/alert.js +0 -165
- package/dist/chunks/alert.js.map +0 -1
- package/dist/chunks/badge.cjs +0 -85
- package/dist/chunks/badge.cjs.map +0 -1
- package/dist/chunks/badge.js +0 -86
- package/dist/chunks/badge.js.map +0 -1
- package/dist/chunks/breadcrumb-item.cjs +0 -261
- package/dist/chunks/breadcrumb-item.cjs.map +0 -1
- package/dist/chunks/breadcrumb-item.js +0 -262
- package/dist/chunks/breadcrumb-item.js.map +0 -1
- package/dist/chunks/button-group.cjs +0 -79
- package/dist/chunks/button-group.cjs.map +0 -1
- package/dist/chunks/button-group.js +0 -80
- package/dist/chunks/button-group.js.map +0 -1
- package/dist/chunks/button.cjs +0 -337
- package/dist/chunks/button.cjs.map +0 -1
- package/dist/chunks/button.js +0 -338
- package/dist/chunks/button.js.map +0 -1
- package/dist/chunks/card.cjs +0 -93
- package/dist/chunks/card.cjs.map +0 -1
- package/dist/chunks/card.js +0 -94
- package/dist/chunks/card.js.map +0 -1
- package/dist/chunks/checkbox.cjs +0 -86
- package/dist/chunks/checkbox.cjs.map +0 -1
- package/dist/chunks/checkbox.js +0 -87
- package/dist/chunks/checkbox.js.map +0 -1
- package/dist/chunks/color.cjs +0 -4
- package/dist/chunks/color.cjs.map +0 -1
- package/dist/chunks/color.js +0 -5
- package/dist/chunks/color.js.map +0 -1
- package/dist/chunks/copy-button.cjs +0 -171
- package/dist/chunks/copy-button.cjs.map +0 -1
- package/dist/chunks/copy-button.js +0 -172
- package/dist/chunks/copy-button.js.map +0 -1
- package/dist/chunks/detail-group.cjs +0 -65
- package/dist/chunks/detail-group.cjs.map +0 -1
- package/dist/chunks/detail-group.js +0 -66
- package/dist/chunks/detail-group.js.map +0 -1
- package/dist/chunks/detail.cjs +0 -146
- package/dist/chunks/detail.cjs.map +0 -1
- package/dist/chunks/detail.js +0 -147
- package/dist/chunks/detail.js.map +0 -1
- package/dist/chunks/dialog.cjs +0 -117
- package/dist/chunks/dialog.cjs.map +0 -1
- package/dist/chunks/dialog.js +0 -118
- package/dist/chunks/dialog.js.map +0 -1
- package/dist/chunks/divider.cjs +0 -80
- package/dist/chunks/divider.cjs.map +0 -1
- package/dist/chunks/divider.js +0 -81
- package/dist/chunks/divider.js.map +0 -1
- package/dist/chunks/drawer.cjs +0 -180
- package/dist/chunks/drawer.cjs.map +0 -1
- package/dist/chunks/drawer.js +0 -181
- package/dist/chunks/drawer.js.map +0 -1
- package/dist/chunks/dropdown-button.cjs +0 -533
- package/dist/chunks/dropdown-button.cjs.map +0 -1
- package/dist/chunks/dropdown-button.js +0 -534
- package/dist/chunks/dropdown-button.js.map +0 -1
- package/dist/chunks/icon-button.cjs +0 -35
- package/dist/chunks/icon-button.cjs.map +0 -1
- package/dist/chunks/icon-button.js +0 -36
- package/dist/chunks/icon-button.js.map +0 -1
- package/dist/chunks/icon.cjs +0 -124
- package/dist/chunks/icon.cjs.map +0 -1
- package/dist/chunks/icon.js +0 -125
- package/dist/chunks/icon.js.map +0 -1
- package/dist/chunks/menu.cjs +0 -396
- package/dist/chunks/menu.cjs.map +0 -1
- package/dist/chunks/menu.js +0 -397
- package/dist/chunks/menu.js.map +0 -1
- package/dist/chunks/navbar.cjs +0 -142
- package/dist/chunks/navbar.cjs.map +0 -1
- package/dist/chunks/navbar.js +0 -143
- package/dist/chunks/navbar.js.map +0 -1
- package/dist/chunks/number-input.cjs +0 -110
- package/dist/chunks/number-input.cjs.map +0 -1
- package/dist/chunks/number-input.js +0 -111
- package/dist/chunks/number-input.js.map +0 -1
- package/dist/chunks/pagination.cjs +0 -475
- package/dist/chunks/pagination.cjs.map +0 -1
- package/dist/chunks/pagination.js +0 -476
- package/dist/chunks/pagination.js.map +0 -1
- package/dist/chunks/progress-bar.cjs +0 -101
- package/dist/chunks/progress-bar.cjs.map +0 -1
- package/dist/chunks/progress-bar.js +0 -102
- package/dist/chunks/progress-bar.js.map +0 -1
- package/dist/chunks/radio.cjs +0 -185
- package/dist/chunks/radio.cjs.map +0 -1
- package/dist/chunks/radio.js +0 -186
- package/dist/chunks/radio.js.map +0 -1
- package/dist/chunks/select.cjs +0 -381
- package/dist/chunks/select.cjs.map +0 -1
- package/dist/chunks/select.js +0 -382
- package/dist/chunks/select.js.map +0 -1
- package/dist/chunks/size.cjs +0 -4
- package/dist/chunks/size.cjs.map +0 -1
- package/dist/chunks/size.js +0 -5
- package/dist/chunks/size.js.map +0 -1
- package/dist/chunks/slider.cjs +0 -608
- package/dist/chunks/slider.cjs.map +0 -1
- package/dist/chunks/slider.js +0 -609
- package/dist/chunks/slider.js.map +0 -1
- package/dist/chunks/spinner.cjs +0 -102
- package/dist/chunks/spinner.cjs.map +0 -1
- package/dist/chunks/spinner.js +0 -103
- package/dist/chunks/spinner.js.map +0 -1
- package/dist/chunks/switch.cjs +0 -167
- package/dist/chunks/switch.cjs.map +0 -1
- package/dist/chunks/switch.js +0 -168
- package/dist/chunks/switch.js.map +0 -1
- package/dist/chunks/tab-panel.cjs +0 -174
- package/dist/chunks/tab-panel.cjs.map +0 -1
- package/dist/chunks/tab-panel.js +0 -175
- package/dist/chunks/tab-panel.js.map +0 -1
- package/dist/chunks/tag.cjs +0 -108
- package/dist/chunks/tag.cjs.map +0 -1
- package/dist/chunks/tag.js +0 -109
- package/dist/chunks/tag.js.map +0 -1
- package/dist/chunks/text-input.cjs +0 -54
- package/dist/chunks/text-input.cjs.map +0 -1
- package/dist/chunks/text-input.js +0 -55
- package/dist/chunks/text-input.js.map +0 -1
- package/dist/chunks/textarea.cjs +0 -137
- package/dist/chunks/textarea.cjs.map +0 -1
- package/dist/chunks/textarea.js +0 -138
- package/dist/chunks/textarea.js.map +0 -1
- package/dist/chunks/tooltip.cjs +0 -292
- package/dist/chunks/tooltip.cjs.map +0 -1
- package/dist/chunks/tooltip.js +0 -293
- package/dist/chunks/tooltip.js.map +0 -1
- package/dist/chunks/tree.cjs +0 -468
- package/dist/chunks/tree.cjs.map +0 -1
- package/dist/chunks/tree.js +0 -469
- package/dist/chunks/tree.js.map +0 -1
- package/dist/chunks/variables.cjs +0 -396
- package/dist/chunks/variables.cjs.map +0 -1
- package/dist/chunks/variables.js +0 -397
- package/dist/chunks/variables.js.map +0 -1
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
|
-
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
4
|
-
import { A as AeicoComponent } from "./aeico-component.js";
|
|
5
|
-
import { html } from "aeico";
|
|
6
|
-
class IconButton extends AeicoComponent {
|
|
7
|
-
render() {
|
|
8
|
-
return html(({ aeButton, aeIcon }) => {
|
|
9
|
-
aeButton(
|
|
10
|
-
{
|
|
11
|
-
color: this.color,
|
|
12
|
-
variant: this.variant,
|
|
13
|
-
size: this.size,
|
|
14
|
-
disabled: this.disabled
|
|
15
|
-
},
|
|
16
|
-
() => {
|
|
17
|
-
aeIcon({ name: this.icon });
|
|
18
|
-
}
|
|
19
|
-
);
|
|
20
|
-
});
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
__publicField(IconButton, "tagName", "icon-button");
|
|
24
|
-
__publicField(IconButton, "props", {
|
|
25
|
-
icon: { type: String },
|
|
26
|
-
size: { type: String },
|
|
27
|
-
color: { type: String },
|
|
28
|
-
variant: { type: String },
|
|
29
|
-
disabled: { type: Boolean }
|
|
30
|
-
});
|
|
31
|
-
__publicField(IconButton, "styles", [":host { display: contents; }"]);
|
|
32
|
-
IconButton.register();
|
|
33
|
-
export {
|
|
34
|
-
IconButton as I
|
|
35
|
-
};
|
|
36
|
-
//# sourceMappingURL=icon-button.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"icon-button.js","sources":["../../src/icon-button/icon-button.ts"],"sourcesContent":["import type { InferProps, Props } from 'aeico';\nimport AeicoComponent from '../aeico-component';\nimport { html } from 'aeico';\nimport type { IconColor } from '../icon/defines';\n// Ensure ae-button and ae-icon are registered\nimport '../button/button';\nimport '../icon/icon';\n\nexport type IconButtonVariant = 'filled' | 'outlined' | 'subtle' | 'text';\nexport type IconButtonSize = 'xs' | 'sm' | 'md' | 'lg';\n\n/**\n * @deprecated Use `<ae-button>` with an `<ae-icon>` slot instead.\n *\n * ```html\n * <ae-button color=\"primary\"><ae-icon name=\"star\"></ae-icon></ae-button>\n * ```\n */\nclass IconButton extends AeicoComponent {\n static tagName = 'icon-button';\n\n static props: Props = {\n icon: { type: String },\n size: { type: String },\n color: { type: String },\n variant: { type: String },\n disabled: { type: Boolean },\n };\n\n declare icon?: string;\n declare size?: IconButtonSize;\n declare color?: IconColor;\n declare variant?: IconButtonVariant;\n declare disabled?: boolean;\n\n protected static styles = [':host { display: contents; }'];\n\n protected render() {\n return html(({ aeButton, aeIcon }) => {\n aeButton(\n {\n color: this.color,\n variant: this.variant,\n size: this.size,\n disabled: this.disabled,\n },\n () => {\n aeIcon({ name: this.icon });\n },\n );\n });\n }\n}\n\nIconButton.register();\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'ae-icon-button': IconButton;\n }\n}\n\nexport default IconButton;\nexport type IconButtonProps = InferProps<typeof IconButton>;\n"],"names":[],"mappings":";;;;;AAkBA,MAAM,mBAAmB,eAAe;AAAA,EAmB5B,SAAS;AACjB,WAAO,KAAK,CAAC,EAAE,UAAU,aAAa;AACpC;AAAA,QACE;AAAA,UACE,OAAO,KAAK;AAAA,UACZ,SAAS,KAAK;AAAA,UACd,MAAM,KAAK;AAAA,UACX,UAAU,KAAK;AAAA,QAAA;AAAA,QAEjB,MAAM;AACJ,iBAAO,EAAE,MAAM,KAAK,KAAA,CAAM;AAAA,QAC5B;AAAA,MAAA;AAAA,IAEJ,CAAC;AAAA,EACH;AACF;AAjCE,cADI,YACG,WAAU;AAEjB,cAHI,YAGG,SAAe;AAAA,EACpB,MAAM,EAAE,MAAM,OAAA;AAAA,EACd,MAAM,EAAE,MAAM,OAAA;AAAA,EACd,OAAO,EAAE,MAAM,OAAA;AAAA,EACf,SAAS,EAAE,MAAM,OAAA;AAAA,EACjB,UAAU,EAAE,MAAM,QAAA;AAAQ;AAS5B,cAjBI,YAiBa,UAAS,CAAC,8BAA8B;AAmB3D,WAAW,SAAA;"}
|
package/dist/chunks/icon.cjs
DELETED
|
@@ -1,124 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
4
|
-
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
5
|
-
const aeicoComponent = require("./aeico-component.cjs");
|
|
6
|
-
const aeico = require("aeico");
|
|
7
|
-
const variables = require("./variables.cjs");
|
|
8
|
-
const size = require("./size.cjs");
|
|
9
|
-
const color = require("./color.cjs");
|
|
10
|
-
const style = ":host {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n font-size: 20px;\n width: 1em;\n height: 1em;\n color: inherit;\n flex-shrink: 0;\n line-height: 0;\n vertical-align: middle;\n}\n\n:host([color]) {\n color: var(--ae-color-solid);\n}\n\n.icon-svg {\n display: block;\n width: 100%;\n height: 100%;\n fill: var(--icon-fill, currentColor);\n stroke: var(--icon-stroke, none);\n stroke-width: var(--icon-stroke-width, 2);\n stroke-linecap: var(--icon-stroke-linecap, round);\n stroke-linejoin: var(--icon-stroke-linejoin, round);\n pointer-events: none;\n overflow: visible;\n}\n";
|
|
11
|
-
const defaultViewBox = "0 0 24 24";
|
|
12
|
-
class IconRegistry {
|
|
13
|
-
/** Register user icons. Always takes priority over built-in icons. */
|
|
14
|
-
static add(icons) {
|
|
15
|
-
for (const [name, data] of Object.entries(icons)) {
|
|
16
|
-
if (typeof data === "string") {
|
|
17
|
-
this._icons.set(name, { paths: data, viewBox: defaultViewBox });
|
|
18
|
-
} else {
|
|
19
|
-
this._icons.set(name, data);
|
|
20
|
-
}
|
|
21
|
-
this._builtInKeys.delete(name);
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* Register built-in icons provided by the library.
|
|
26
|
-
* A built-in icon will NOT overwrite an icon already registered by the user.
|
|
27
|
-
*/
|
|
28
|
-
static addBuiltIn(icons) {
|
|
29
|
-
for (const [name, data] of Object.entries(icons)) {
|
|
30
|
-
if (this._icons.has(name) && !this._builtInKeys.has(name)) continue;
|
|
31
|
-
if (typeof data === "string") {
|
|
32
|
-
this._icons.set(name, { paths: data, viewBox: defaultViewBox });
|
|
33
|
-
} else {
|
|
34
|
-
this._icons.set(name, data);
|
|
35
|
-
}
|
|
36
|
-
this._builtInKeys.add(name);
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
static get(name) {
|
|
40
|
-
return this._icons.get(name);
|
|
41
|
-
}
|
|
42
|
-
static has(name) {
|
|
43
|
-
return this._icons.has(name);
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
__publicField(IconRegistry, "_icons", /* @__PURE__ */ new Map());
|
|
47
|
-
/** Names registered via addBuiltIn — can be overridden by user add() calls */
|
|
48
|
-
__publicField(IconRegistry, "_builtInKeys", /* @__PURE__ */ new Set());
|
|
49
|
-
IconRegistry.addBuiltIn({
|
|
50
|
-
copy: "M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm0 16H8V7h11v14z",
|
|
51
|
-
check: "M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z",
|
|
52
|
-
"chevron-left": "M15.41 7.41L14 6l-6 6 6 6 1.41-1.41L10.83 12z",
|
|
53
|
-
"chevron-right": "M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z",
|
|
54
|
-
"chevron-up": "M12 8l-6 6 1.41 1.41L12 10.83l4.59 4.58L18 14z",
|
|
55
|
-
"chevron-down": "M16.59 8.59L12 13.17 7.41 8.59 6 10l6 6 6-6z",
|
|
56
|
-
"chevrons-left": "M18.41 16.59L13.82 12l4.59-4.59L17 6l-6 6 6 6zM6 6h2v12H6z",
|
|
57
|
-
"chevrons-right": "M5.59 7.41L10.18 12l-4.59 4.59L7 18l6-6-6-6zM16 6h2v12h-2z",
|
|
58
|
-
close: "M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"
|
|
59
|
-
});
|
|
60
|
-
class Icon extends aeicoComponent.AeicoComponent {
|
|
61
|
-
render() {
|
|
62
|
-
const def = this.name ? IconRegistry.get(this.name) : void 0;
|
|
63
|
-
const numericSize = Number(this.size);
|
|
64
|
-
if (this.size !== void 0 && !isNaN(numericSize) && numericSize > 0) {
|
|
65
|
-
this.style.setProperty("font-size", `${numericSize}px`);
|
|
66
|
-
} else {
|
|
67
|
-
this.style.removeProperty("font-size");
|
|
68
|
-
}
|
|
69
|
-
if (!def) return;
|
|
70
|
-
const { paths } = def;
|
|
71
|
-
const isMultiPath = Array.isArray(paths);
|
|
72
|
-
if (!isMultiPath) {
|
|
73
|
-
const useStroke = this.stroke ?? (this.strokeWidth !== void 0 ? true : def.stroke ?? false);
|
|
74
|
-
const useStrokeWidth = this.strokeWidth ?? def.strokeWidth ?? 2;
|
|
75
|
-
if (useStroke) {
|
|
76
|
-
this.style.setProperty("--icon-fill", "none");
|
|
77
|
-
this.style.setProperty("--icon-stroke", "currentColor");
|
|
78
|
-
this.style.setProperty("--icon-stroke-width", String(useStrokeWidth));
|
|
79
|
-
} else {
|
|
80
|
-
this.style.removeProperty("--icon-fill");
|
|
81
|
-
this.style.removeProperty("--icon-stroke");
|
|
82
|
-
this.style.removeProperty("--icon-stroke-width");
|
|
83
|
-
}
|
|
84
|
-
} else {
|
|
85
|
-
this.style.removeProperty("--icon-fill");
|
|
86
|
-
this.style.removeProperty("--icon-stroke");
|
|
87
|
-
this.style.removeProperty("--icon-stroke-width");
|
|
88
|
-
}
|
|
89
|
-
return aeico.html(({ svg, path }) => {
|
|
90
|
-
svg(
|
|
91
|
-
{
|
|
92
|
-
className: "icon-svg",
|
|
93
|
-
viewBox: def.viewBox ?? defaultViewBox,
|
|
94
|
-
"aria-hidden": "true",
|
|
95
|
-
xmlns: aeicoComponent.SVG_NS
|
|
96
|
-
},
|
|
97
|
-
() => {
|
|
98
|
-
if (typeof paths === "string") {
|
|
99
|
-
path({ d: paths });
|
|
100
|
-
} else {
|
|
101
|
-
for (const p of paths) {
|
|
102
|
-
const attrs = { d: p.d };
|
|
103
|
-
if (p.fill) attrs.style = { fill: p.fill };
|
|
104
|
-
path(attrs);
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
);
|
|
109
|
-
});
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
__publicField(Icon, "tagName", "icon");
|
|
113
|
-
__publicField(Icon, "props", {
|
|
114
|
-
name: { type: String },
|
|
115
|
-
size: { type: String },
|
|
116
|
-
color: { type: String },
|
|
117
|
-
stroke: { type: Boolean },
|
|
118
|
-
strokeWidth: { type: Number }
|
|
119
|
-
});
|
|
120
|
-
__publicField(Icon, "styles", [variables.variables, size.sizeCSS, color.colorCSS, style]);
|
|
121
|
-
Icon.register();
|
|
122
|
-
exports.Icon = Icon;
|
|
123
|
-
exports.IconRegistry = IconRegistry;
|
|
124
|
-
//# sourceMappingURL=icon.cjs.map
|
package/dist/chunks/icon.cjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"icon.cjs","sources":["../../src/icon/defines.ts","../../src/icon/registry.ts","../../src/icon/built-in-icons.ts","../../src/icon/icon.ts"],"sourcesContent":["export type IconSize = '3xs' | '2xs' | 'xs' | 'sm' | 'md' | 'lg' | 'xl' | number;\n\nexport type IconColor =\n | 'default'\n | 'primary'\n | 'secondary'\n | 'success'\n | 'danger'\n | 'warning'\n | 'info';\n\nexport interface IconPathDef {\n d: string;\n fill?: string;\n}\n\nexport interface IconDefinition {\n paths: string | IconPathDef[];\n viewBox?: string;\n stroke?: boolean;\n strokeWidth?: number;\n}\n\nexport const defaultViewBox = '0 0 24 24';\n\nexport type IconRegistryData = Record<string, string | IconDefinition>;\n","import { IconDefinition, IconRegistryData, defaultViewBox } from './defines';\n\nclass IconRegistry {\n private static _icons: Map<string, IconDefinition> = new Map();\n /** Names registered via addBuiltIn — can be overridden by user add() calls */\n private static _builtInKeys: Set<string> = new Set();\n\n /** Register user icons. Always takes priority over built-in icons. */\n static add(icons: IconRegistryData) {\n for (const [name, data] of Object.entries(icons)) {\n if (typeof data === 'string') {\n this._icons.set(name, { paths: data, viewBox: defaultViewBox });\n } else {\n this._icons.set(name, data);\n }\n // Mark as user-defined (removes built-in status)\n this._builtInKeys.delete(name);\n }\n }\n\n /**\n * Register built-in icons provided by the library.\n * A built-in icon will NOT overwrite an icon already registered by the user.\n */\n static addBuiltIn(icons: IconRegistryData) {\n for (const [name, data] of Object.entries(icons)) {\n // Skip if the user has already registered this icon\n if (this._icons.has(name) && !this._builtInKeys.has(name)) continue;\n if (typeof data === 'string') {\n this._icons.set(name, { paths: data, viewBox: defaultViewBox });\n } else {\n this._icons.set(name, data);\n }\n this._builtInKeys.add(name);\n }\n }\n\n static get(name: string): IconDefinition | undefined {\n return this._icons.get(name);\n }\n\n static has(name: string): boolean {\n return this._icons.has(name);\n }\n}\n\nexport default IconRegistry;\n","/**\n * Built-in system icons used internally by aeico components.\n * These are pre-registered so components work out of the box.\n * Users can override any of them by calling IconRegistry.add({ 'name': '...' }).\n *\n * All paths use the Material Design 24×24 viewBox.\n */\nimport IconRegistry from './registry';\n\nIconRegistry.addBuiltIn({\n copy: 'M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm0 16H8V7h11v14z',\n check: 'M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z',\n 'chevron-left': 'M15.41 7.41L14 6l-6 6 6 6 1.41-1.41L10.83 12z',\n 'chevron-right': 'M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z',\n 'chevron-up': 'M12 8l-6 6 1.41 1.41L12 10.83l4.59 4.58L18 14z',\n 'chevron-down': 'M16.59 8.59L12 13.17 7.41 8.59 6 10l6 6 6-6z',\n 'chevrons-left': 'M18.41 16.59L13.82 12l4.59-4.59L17 6l-6 6 6 6zM6 6h2v12H6z',\n 'chevrons-right': 'M5.59 7.41L10.18 12l-4.59 4.59L7 18l6-6-6-6zM16 6h2v12h-2z',\n close:\n 'M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z',\n});\n","import type { InferProps, Props } from 'aeico';\nimport { SVG_NS } from '../utils';\nimport AeicoComponent from '../aeico-component';\nimport { html } from 'aeico';\nimport styleVariables from '../styles/variables.css?inline';\nimport sizeCSS from '../styles/size.css?inline';\nimport colorCSS from '../styles/color.css?inline';\nimport style from '../styles/components/icon.css?inline';\nimport type { IconSize, IconColor } from './defines';\nimport { defaultViewBox } from './defines';\nimport IconRegistry from './registry';\nimport './built-in-icons';\n\nclass Icon extends AeicoComponent {\n static tagName = 'icon';\n\n static props: Props = {\n name: { type: String },\n size: { type: String },\n color: { type: String },\n stroke: { type: Boolean },\n strokeWidth: { type: Number },\n };\n\n declare name?: string;\n declare size?: IconSize;\n declare color?: IconColor;\n declare stroke?: boolean;\n declare strokeWidth?: number;\n\n protected static styles = [styleVariables, sizeCSS, colorCSS, style];\n\n protected render() {\n const def = this.name ? IconRegistry.get(this.name) : undefined;\n\n // Numeric size: set font-size directly (string sizes are handled by size.css)\n const numericSize = Number(this.size);\n if (this.size !== undefined && !isNaN(numericSize) && numericSize > 0) {\n this.style.setProperty('font-size', `${numericSize}px`);\n } else {\n this.style.removeProperty('font-size');\n }\n\n if (!def) return;\n\n const { paths } = def;\n const isMultiPath = Array.isArray(paths);\n\n // Stroke CSS variables only apply in single-path mode (component props)\n if (!isMultiPath) {\n const useStroke =\n this.stroke ?? (this.strokeWidth !== undefined ? true : (def.stroke ?? false));\n const useStrokeWidth = this.strokeWidth ?? def.strokeWidth ?? 2;\n\n if (useStroke) {\n this.style.setProperty('--icon-fill', 'none');\n this.style.setProperty('--icon-stroke', 'currentColor');\n this.style.setProperty('--icon-stroke-width', String(useStrokeWidth));\n } else {\n this.style.removeProperty('--icon-fill');\n this.style.removeProperty('--icon-stroke');\n this.style.removeProperty('--icon-stroke-width');\n }\n } else {\n this.style.removeProperty('--icon-fill');\n this.style.removeProperty('--icon-stroke');\n this.style.removeProperty('--icon-stroke-width');\n }\n\n return html(({ svg, path }) => {\n svg(\n {\n className: 'icon-svg',\n viewBox: def.viewBox ?? defaultViewBox,\n 'aria-hidden': 'true',\n xmlns: SVG_NS,\n },\n () => {\n if (typeof paths === 'string') {\n path({ d: paths });\n } else {\n for (const p of paths) {\n const attrs: Record<string, unknown> = { d: p.d };\n if (p.fill) attrs.style = { fill: p.fill };\n path(attrs);\n }\n }\n },\n );\n });\n }\n}\n\nIcon.register();\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'ae-icon': Icon;\n }\n}\n\nexport default Icon;\nexport type IconProps = InferProps<typeof Icon>;\n"],"names":["AeicoComponent","html","SVG_NS","styleVariables","sizeCSS","colorCSS"],"mappings":";;;;;;;;;;AAuBO,MAAM,iBAAiB;ACrB9B,MA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EAAE,KAAM,OAAM,QAAQ,EAAE,MAAM,EAAE,KAAA;AACpC,mBAAK,KAAK;AAAA,YACZ;AAAA,UACF;AAAA,QACF;AAAA,MAAA;AAAA,IAEJ,CAAC;AAAA,EACH;AACF;AA7EE,cADI,MACG,WAAU;AAEjB,cAHI,MAGG,SAAe;AAAA,EACpB,MAAM,EAAE,MAAM,OAAA;AAAA,EACd,MAAM,EAAE,MAAM,OAAA;AAAA,EACd,OAAO,EAAE,MAAM,OAAA;AAAA,EACf,QAAQ,EAAE,MAAM,QAAA;AAAA,EAChB,aAAa,EAAE,MAAM,OAAA;AAAO;AAS9B,cAjBI,MAiBa,UAAS,CAACC,UAAAA,WAAgBC,KAAAA,SAASC,MAAAA,UAAU,KAAK;AA+DrE,KAAK,SAAA;;;"}
|
package/dist/chunks/icon.js
DELETED
|
@@ -1,125 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
|
-
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
4
|
-
import { A as AeicoComponent, S as SVG_NS } from "./aeico-component.js";
|
|
5
|
-
import { html } from "aeico";
|
|
6
|
-
import { v as variables } from "./variables.js";
|
|
7
|
-
import { s as sizeCSS } from "./size.js";
|
|
8
|
-
import { c as colorCSS } from "./color.js";
|
|
9
|
-
const style = ":host {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n font-size: 20px;\n width: 1em;\n height: 1em;\n color: inherit;\n flex-shrink: 0;\n line-height: 0;\n vertical-align: middle;\n}\n\n:host([color]) {\n color: var(--ae-color-solid);\n}\n\n.icon-svg {\n display: block;\n width: 100%;\n height: 100%;\n fill: var(--icon-fill, currentColor);\n stroke: var(--icon-stroke, none);\n stroke-width: var(--icon-stroke-width, 2);\n stroke-linecap: var(--icon-stroke-linecap, round);\n stroke-linejoin: var(--icon-stroke-linejoin, round);\n pointer-events: none;\n overflow: visible;\n}\n";
|
|
10
|
-
const defaultViewBox = "0 0 24 24";
|
|
11
|
-
class IconRegistry {
|
|
12
|
-
/** Register user icons. Always takes priority over built-in icons. */
|
|
13
|
-
static add(icons) {
|
|
14
|
-
for (const [name, data] of Object.entries(icons)) {
|
|
15
|
-
if (typeof data === "string") {
|
|
16
|
-
this._icons.set(name, { paths: data, viewBox: defaultViewBox });
|
|
17
|
-
} else {
|
|
18
|
-
this._icons.set(name, data);
|
|
19
|
-
}
|
|
20
|
-
this._builtInKeys.delete(name);
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* Register built-in icons provided by the library.
|
|
25
|
-
* A built-in icon will NOT overwrite an icon already registered by the user.
|
|
26
|
-
*/
|
|
27
|
-
static addBuiltIn(icons) {
|
|
28
|
-
for (const [name, data] of Object.entries(icons)) {
|
|
29
|
-
if (this._icons.has(name) && !this._builtInKeys.has(name)) continue;
|
|
30
|
-
if (typeof data === "string") {
|
|
31
|
-
this._icons.set(name, { paths: data, viewBox: defaultViewBox });
|
|
32
|
-
} else {
|
|
33
|
-
this._icons.set(name, data);
|
|
34
|
-
}
|
|
35
|
-
this._builtInKeys.add(name);
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
static get(name) {
|
|
39
|
-
return this._icons.get(name);
|
|
40
|
-
}
|
|
41
|
-
static has(name) {
|
|
42
|
-
return this._icons.has(name);
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
__publicField(IconRegistry, "_icons", /* @__PURE__ */ new Map());
|
|
46
|
-
/** Names registered via addBuiltIn — can be overridden by user add() calls */
|
|
47
|
-
__publicField(IconRegistry, "_builtInKeys", /* @__PURE__ */ new Set());
|
|
48
|
-
IconRegistry.addBuiltIn({
|
|
49
|
-
copy: "M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm0 16H8V7h11v14z",
|
|
50
|
-
check: "M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z",
|
|
51
|
-
"chevron-left": "M15.41 7.41L14 6l-6 6 6 6 1.41-1.41L10.83 12z",
|
|
52
|
-
"chevron-right": "M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z",
|
|
53
|
-
"chevron-up": "M12 8l-6 6 1.41 1.41L12 10.83l4.59 4.58L18 14z",
|
|
54
|
-
"chevron-down": "M16.59 8.59L12 13.17 7.41 8.59 6 10l6 6 6-6z",
|
|
55
|
-
"chevrons-left": "M18.41 16.59L13.82 12l4.59-4.59L17 6l-6 6 6 6zM6 6h2v12H6z",
|
|
56
|
-
"chevrons-right": "M5.59 7.41L10.18 12l-4.59 4.59L7 18l6-6-6-6zM16 6h2v12h-2z",
|
|
57
|
-
close: "M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"
|
|
58
|
-
});
|
|
59
|
-
class Icon extends AeicoComponent {
|
|
60
|
-
render() {
|
|
61
|
-
const def = this.name ? IconRegistry.get(this.name) : void 0;
|
|
62
|
-
const numericSize = Number(this.size);
|
|
63
|
-
if (this.size !== void 0 && !isNaN(numericSize) && numericSize > 0) {
|
|
64
|
-
this.style.setProperty("font-size", `${numericSize}px`);
|
|
65
|
-
} else {
|
|
66
|
-
this.style.removeProperty("font-size");
|
|
67
|
-
}
|
|
68
|
-
if (!def) return;
|
|
69
|
-
const { paths } = def;
|
|
70
|
-
const isMultiPath = Array.isArray(paths);
|
|
71
|
-
if (!isMultiPath) {
|
|
72
|
-
const useStroke = this.stroke ?? (this.strokeWidth !== void 0 ? true : def.stroke ?? false);
|
|
73
|
-
const useStrokeWidth = this.strokeWidth ?? def.strokeWidth ?? 2;
|
|
74
|
-
if (useStroke) {
|
|
75
|
-
this.style.setProperty("--icon-fill", "none");
|
|
76
|
-
this.style.setProperty("--icon-stroke", "currentColor");
|
|
77
|
-
this.style.setProperty("--icon-stroke-width", String(useStrokeWidth));
|
|
78
|
-
} else {
|
|
79
|
-
this.style.removeProperty("--icon-fill");
|
|
80
|
-
this.style.removeProperty("--icon-stroke");
|
|
81
|
-
this.style.removeProperty("--icon-stroke-width");
|
|
82
|
-
}
|
|
83
|
-
} else {
|
|
84
|
-
this.style.removeProperty("--icon-fill");
|
|
85
|
-
this.style.removeProperty("--icon-stroke");
|
|
86
|
-
this.style.removeProperty("--icon-stroke-width");
|
|
87
|
-
}
|
|
88
|
-
return html(({ svg, path }) => {
|
|
89
|
-
svg(
|
|
90
|
-
{
|
|
91
|
-
className: "icon-svg",
|
|
92
|
-
viewBox: def.viewBox ?? defaultViewBox,
|
|
93
|
-
"aria-hidden": "true",
|
|
94
|
-
xmlns: SVG_NS
|
|
95
|
-
},
|
|
96
|
-
() => {
|
|
97
|
-
if (typeof paths === "string") {
|
|
98
|
-
path({ d: paths });
|
|
99
|
-
} else {
|
|
100
|
-
for (const p of paths) {
|
|
101
|
-
const attrs = { d: p.d };
|
|
102
|
-
if (p.fill) attrs.style = { fill: p.fill };
|
|
103
|
-
path(attrs);
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
);
|
|
108
|
-
});
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
__publicField(Icon, "tagName", "icon");
|
|
112
|
-
__publicField(Icon, "props", {
|
|
113
|
-
name: { type: String },
|
|
114
|
-
size: { type: String },
|
|
115
|
-
color: { type: String },
|
|
116
|
-
stroke: { type: Boolean },
|
|
117
|
-
strokeWidth: { type: Number }
|
|
118
|
-
});
|
|
119
|
-
__publicField(Icon, "styles", [variables, sizeCSS, colorCSS, style]);
|
|
120
|
-
Icon.register();
|
|
121
|
-
export {
|
|
122
|
-
Icon as I,
|
|
123
|
-
IconRegistry as a
|
|
124
|
-
};
|
|
125
|
-
//# sourceMappingURL=icon.js.map
|
package/dist/chunks/icon.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"icon.js","sources":["../../src/icon/defines.ts","../../src/icon/registry.ts","../../src/icon/built-in-icons.ts","../../src/icon/icon.ts"],"sourcesContent":["export type IconSize = '3xs' | '2xs' | 'xs' | 'sm' | 'md' | 'lg' | 'xl' | number;\n\nexport type IconColor =\n | 'default'\n | 'primary'\n | 'secondary'\n | 'success'\n | 'danger'\n | 'warning'\n | 'info';\n\nexport interface IconPathDef {\n d: string;\n fill?: string;\n}\n\nexport interface IconDefinition {\n paths: string | IconPathDef[];\n viewBox?: string;\n stroke?: boolean;\n strokeWidth?: number;\n}\n\nexport const defaultViewBox = '0 0 24 24';\n\nexport type IconRegistryData = Record<string, string | IconDefinition>;\n","import { IconDefinition, IconRegistryData, defaultViewBox } from './defines';\n\nclass IconRegistry {\n private static _icons: Map<string, IconDefinition> = new Map();\n /** Names registered via addBuiltIn — can be overridden by user add() calls */\n private static _builtInKeys: Set<string> = new Set();\n\n /** Register user icons. Always takes priority over built-in icons. */\n static add(icons: IconRegistryData) {\n for (const [name, data] of Object.entries(icons)) {\n if (typeof data === 'string') {\n this._icons.set(name, { paths: data, viewBox: defaultViewBox });\n } else {\n this._icons.set(name, data);\n }\n // Mark as user-defined (removes built-in status)\n this._builtInKeys.delete(name);\n }\n }\n\n /**\n * Register built-in icons provided by the library.\n * A built-in icon will NOT overwrite an icon already registered by the user.\n */\n static addBuiltIn(icons: IconRegistryData) {\n for (const [name, data] of Object.entries(icons)) {\n // Skip if the user has already registered this icon\n if (this._icons.has(name) && !this._builtInKeys.has(name)) continue;\n if (typeof data === 'string') {\n this._icons.set(name, { paths: data, viewBox: defaultViewBox });\n } else {\n this._icons.set(name, data);\n }\n this._builtInKeys.add(name);\n }\n }\n\n static get(name: string): IconDefinition | undefined {\n return this._icons.get(name);\n }\n\n static has(name: string): boolean {\n return this._icons.has(name);\n }\n}\n\nexport default IconRegistry;\n","/**\n * Built-in system icons used internally by aeico components.\n * These are pre-registered so components work out of the box.\n * Users can override any of them by calling IconRegistry.add({ 'name': '...' }).\n *\n * All paths use the Material Design 24×24 viewBox.\n */\nimport IconRegistry from './registry';\n\nIconRegistry.addBuiltIn({\n copy: 'M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm0 16H8V7h11v14z',\n check: 'M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z',\n 'chevron-left': 'M15.41 7.41L14 6l-6 6 6 6 1.41-1.41L10.83 12z',\n 'chevron-right': 'M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z',\n 'chevron-up': 'M12 8l-6 6 1.41 1.41L12 10.83l4.59 4.58L18 14z',\n 'chevron-down': 'M16.59 8.59L12 13.17 7.41 8.59 6 10l6 6 6-6z',\n 'chevrons-left': 'M18.41 16.59L13.82 12l4.59-4.59L17 6l-6 6 6 6zM6 6h2v12H6z',\n 'chevrons-right': 'M5.59 7.41L10.18 12l-4.59 4.59L7 18l6-6-6-6zM16 6h2v12h-2z',\n close:\n 'M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z',\n});\n","import type { InferProps, Props } from 'aeico';\nimport { SVG_NS } from '../utils';\nimport AeicoComponent from '../aeico-component';\nimport { html } from 'aeico';\nimport styleVariables from '../styles/variables.css?inline';\nimport sizeCSS from '../styles/size.css?inline';\nimport colorCSS from '../styles/color.css?inline';\nimport style from '../styles/components/icon.css?inline';\nimport type { IconSize, IconColor } from './defines';\nimport { defaultViewBox } from './defines';\nimport IconRegistry from './registry';\nimport './built-in-icons';\n\nclass Icon extends AeicoComponent {\n static tagName = 'icon';\n\n static props: Props = {\n name: { type: String },\n size: { type: String },\n color: { type: String },\n stroke: { type: Boolean },\n strokeWidth: { type: Number },\n };\n\n declare name?: string;\n declare size?: IconSize;\n declare color?: IconColor;\n declare stroke?: boolean;\n declare strokeWidth?: number;\n\n protected static styles = [styleVariables, sizeCSS, colorCSS, style];\n\n protected render() {\n const def = this.name ? IconRegistry.get(this.name) : undefined;\n\n // Numeric size: set font-size directly (string sizes are handled by size.css)\n const numericSize = Number(this.size);\n if (this.size !== undefined && !isNaN(numericSize) && numericSize > 0) {\n this.style.setProperty('font-size', `${numericSize}px`);\n } else {\n this.style.removeProperty('font-size');\n }\n\n if (!def) return;\n\n const { paths } = def;\n const isMultiPath = Array.isArray(paths);\n\n // Stroke CSS variables only apply in single-path mode (component props)\n if (!isMultiPath) {\n const useStroke =\n this.stroke ?? (this.strokeWidth !== undefined ? true : (def.stroke ?? false));\n const useStrokeWidth = this.strokeWidth ?? def.strokeWidth ?? 2;\n\n if (useStroke) {\n this.style.setProperty('--icon-fill', 'none');\n this.style.setProperty('--icon-stroke', 'currentColor');\n this.style.setProperty('--icon-stroke-width', String(useStrokeWidth));\n } else {\n this.style.removeProperty('--icon-fill');\n this.style.removeProperty('--icon-stroke');\n this.style.removeProperty('--icon-stroke-width');\n }\n } else {\n this.style.removeProperty('--icon-fill');\n this.style.removeProperty('--icon-stroke');\n this.style.removeProperty('--icon-stroke-width');\n }\n\n return html(({ svg, path }) => {\n svg(\n {\n className: 'icon-svg',\n viewBox: def.viewBox ?? defaultViewBox,\n 'aria-hidden': 'true',\n xmlns: SVG_NS,\n },\n () => {\n if (typeof paths === 'string') {\n path({ d: paths });\n } else {\n for (const p of paths) {\n const attrs: Record<string, unknown> = { d: p.d };\n if (p.fill) attrs.style = { fill: p.fill };\n path(attrs);\n }\n }\n },\n );\n });\n }\n}\n\nIcon.register();\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'ae-icon': Icon;\n }\n}\n\nexport default Icon;\nexport type IconProps = InferProps<typeof Icon>;\n"],"names":["styleVariables"],"mappings":";;;;;;;;;AAuBO,MAAM,iBAAiB;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