vira 31.2.0 → 31.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/elements/pop-up/vira-menu-item.element.d.ts +1 -1
- package/dist/elements/pop-up/vira-menu-item.element.js +6 -6
- package/dist/elements/vira-button.element.js +2 -2
- package/dist/elements/vira-icon.element.d.ts +1 -1
- package/dist/elements/vira-icon.element.js +11 -2
- package/dist/elements/vira-input.element.js +1 -1
- package/dist/elements/vira-link.element.d.ts +1 -1
- package/dist/elements/vira-link.element.js +5 -5
- package/dist/elements/vira-modal.element.d.ts +1 -1
- package/dist/elements/vira-modal.element.js +6 -6
- package/dist/elements/vira-overflow-switch.element.d.ts +1 -1
- package/dist/elements/vira-overflow-switch.element.js +5 -5
- package/dist/elements/vira-select.element.d.ts +1 -1
- package/dist/elements/vira-select.element.js +5 -5
- package/dist/elements/vira-tag.element.js +2 -2
- package/dist/icons/feather-icons.d.ts +24 -0
- package/dist/icons/feather-icons.js +89 -0
- package/dist/icons/icon-svg.d.ts +2 -0
- package/dist/icons/icon-svgs/{check-16.icon.d.ts → 16/check-16.icon.d.ts} +1 -1
- package/dist/icons/icon-svgs/{check-16.icon.js → 16/check-16.icon.js} +2 -2
- package/dist/icons/icon-svgs/{chevron-down-16.icon.d.ts → 16/chevron-down-16.icon.d.ts} +1 -1
- package/dist/icons/icon-svgs/{chevron-down-16.icon.js → 16/chevron-down-16.icon.js} +2 -2
- package/dist/icons/icon-svgs/{chevron-up-16.icon.d.ts → 16/chevron-up-16.icon.d.ts} +1 -1
- package/dist/icons/icon-svgs/{chevron-up-16.icon.js → 16/chevron-up-16.icon.js} +2 -2
- package/dist/icons/icon-svgs/{dash-16.icon.d.ts → 16/dash-16.icon.d.ts} +1 -1
- package/dist/icons/icon-svgs/{dash-16.icon.js → 16/dash-16.icon.js} +2 -2
- package/dist/icons/icon-svgs/{element-16.icon.d.ts → 16/element-16.icon.d.ts} +1 -1
- package/dist/icons/icon-svgs/{element-16.icon.js → 16/element-16.icon.js} +2 -2
- package/dist/icons/icon-svgs/{upload-16.icon.d.ts → 16/upload-16.icon.d.ts} +1 -1
- package/dist/icons/icon-svgs/{upload-16.icon.js → 16/upload-16.icon.js} +2 -2
- package/dist/icons/icon-svgs/{x-16.icon.d.ts → 16/x-16.icon.d.ts} +1 -1
- package/dist/icons/icon-svgs/{x-16.icon.js → 16/x-16.icon.js} +2 -2
- package/dist/icons/icon-svgs/{arrow-down-24.icon.d.ts → 24/arrow-down-24.icon.d.ts} +1 -1
- package/dist/icons/icon-svgs/{arrow-down-24.icon.js → 24/arrow-down-24.icon.js} +2 -2
- package/dist/icons/icon-svgs/{arrow-left-24.icon.d.ts → 24/arrow-left-24.icon.d.ts} +1 -1
- package/dist/icons/icon-svgs/{arrow-left-24.icon.js → 24/arrow-left-24.icon.js} +2 -2
- package/dist/icons/icon-svgs/{arrow-right-24.icon.d.ts → 24/arrow-right-24.icon.d.ts} +1 -1
- package/dist/icons/icon-svgs/{arrow-right-24.icon.js → 24/arrow-right-24.icon.js} +2 -2
- package/dist/icons/icon-svgs/{arrow-up-24.icon.d.ts → 24/arrow-up-24.icon.d.ts} +1 -1
- package/dist/icons/icon-svgs/{arrow-up-24.icon.js → 24/arrow-up-24.icon.js} +2 -2
- package/dist/icons/icon-svgs/{auto-theme-24.icon.d.ts → 24/auto-theme-24.icon.d.ts} +1 -1
- package/dist/icons/icon-svgs/{auto-theme-24.icon.js → 24/auto-theme-24.icon.js} +2 -2
- package/dist/icons/icon-svgs/{bell-24.icon.d.ts → 24/bell-24.icon.d.ts} +1 -1
- package/dist/icons/icon-svgs/{bell-24.icon.js → 24/bell-24.icon.js} +2 -2
- package/dist/icons/icon-svgs/{chat-24.icon.d.ts → 24/chat-24.icon.d.ts} +1 -1
- package/dist/icons/icon-svgs/{chat-24.icon.js → 24/chat-24.icon.js} +2 -2
- package/dist/icons/icon-svgs/{check-24.icon.d.ts → 24/check-24.icon.d.ts} +1 -1
- package/dist/icons/icon-svgs/{check-24.icon.js → 24/check-24.icon.js} +2 -2
- package/dist/icons/icon-svgs/{chevron-down-24.icon.d.ts → 24/chevron-down-24.icon.d.ts} +1 -1
- package/dist/icons/icon-svgs/{chevron-down-24.icon.js → 24/chevron-down-24.icon.js} +2 -2
- package/dist/icons/icon-svgs/{chevron-up-24.icon.d.ts → 24/chevron-up-24.icon.d.ts} +1 -1
- package/dist/icons/icon-svgs/{chevron-up-24.icon.js → 24/chevron-up-24.icon.js} +2 -2
- package/dist/icons/icon-svgs/{close-x-24.icon.d.ts → 24/close-x-24.icon.d.ts} +1 -1
- package/dist/icons/icon-svgs/{close-x-24.icon.js → 24/close-x-24.icon.js} +2 -2
- package/dist/icons/icon-svgs/{commit-24.icon.d.ts → 24/commit-24.icon.d.ts} +1 -1
- package/dist/icons/icon-svgs/{commit-24.icon.js → 24/commit-24.icon.js} +2 -2
- package/dist/icons/icon-svgs/{copy-24.icon.d.ts → 24/copy-24.icon.d.ts} +1 -1
- package/dist/icons/icon-svgs/{copy-24.icon.js → 24/copy-24.icon.js} +2 -2
- package/dist/icons/icon-svgs/{document-24.icon.d.ts → 24/document-24.icon.d.ts} +1 -1
- package/dist/icons/icon-svgs/{document-24.icon.js → 24/document-24.icon.js} +2 -2
- package/dist/icons/icon-svgs/{document-search-24.icon.d.ts → 24/document-search-24.icon.d.ts} +1 -1
- package/dist/icons/icon-svgs/{document-search-24.icon.js → 24/document-search-24.icon.js} +2 -2
- package/dist/icons/icon-svgs/{double-chevron-24.icon.d.ts → 24/double-chevron-24.icon.d.ts} +1 -1
- package/dist/icons/icon-svgs/{double-chevron-24.icon.js → 24/double-chevron-24.icon.js} +2 -2
- package/dist/icons/icon-svgs/{element-24.icon.d.ts → 24/element-24.icon.d.ts} +1 -1
- package/dist/icons/icon-svgs/{element-24.icon.js → 24/element-24.icon.js} +2 -2
- package/dist/icons/icon-svgs/{external-link-24.icon.d.ts → 24/external-link-24.icon.d.ts} +1 -1
- package/dist/icons/icon-svgs/{external-link-24.icon.js → 24/external-link-24.icon.js} +2 -2
- package/dist/icons/icon-svgs/{eye-closed-24.icon.d.ts → 24/eye-closed-24.icon.d.ts} +1 -1
- package/dist/icons/icon-svgs/{eye-closed-24.icon.js → 24/eye-closed-24.icon.js} +2 -2
- package/dist/icons/icon-svgs/{eye-open-24.icon.d.ts → 24/eye-open-24.icon.d.ts} +1 -1
- package/dist/icons/icon-svgs/{eye-open-24.icon.js → 24/eye-open-24.icon.js} +2 -2
- package/dist/icons/icon-svgs/{filter-24.icon.d.ts → 24/filter-24.icon.d.ts} +1 -1
- package/dist/icons/icon-svgs/{filter-24.icon.js → 24/filter-24.icon.js} +2 -2
- package/dist/icons/icon-svgs/{globe-24.icon.d.ts → 24/globe-24.icon.d.ts} +1 -1
- package/dist/icons/icon-svgs/{globe-24.icon.js → 24/globe-24.icon.js} +2 -2
- package/dist/icons/icon-svgs/{link-24.icon.d.ts → 24/link-24.icon.d.ts} +1 -1
- package/dist/icons/icon-svgs/{link-24.icon.js → 24/link-24.icon.js} +2 -2
- package/dist/icons/icon-svgs/{loader-24.icon.d.ts → 24/loader-24.icon.d.ts} +1 -1
- package/dist/icons/icon-svgs/{loader-24.icon.js → 24/loader-24.icon.js} +2 -2
- package/dist/icons/icon-svgs/{loader-animated-24.icon.d.ts → 24/loader-animated-24.icon.d.ts} +1 -1
- package/dist/icons/icon-svgs/{loader-animated-24.icon.js → 24/loader-animated-24.icon.js} +2 -2
- package/dist/icons/icon-svgs/{lock-24.icon.d.ts → 24/lock-24.icon.d.ts} +1 -1
- package/dist/icons/icon-svgs/{lock-24.icon.js → 24/lock-24.icon.js} +2 -2
- package/dist/icons/icon-svgs/{magnifying-glass-24.icon.d.ts → 24/magnifying-glass-24.icon.d.ts} +1 -1
- package/dist/icons/icon-svgs/{magnifying-glass-24.icon.js → 24/magnifying-glass-24.icon.js} +2 -2
- package/dist/icons/icon-svgs/{moon-24.icon.d.ts → 24/moon-24.icon.d.ts} +1 -1
- package/dist/icons/icon-svgs/{moon-24.icon.js → 24/moon-24.icon.js} +2 -2
- package/dist/icons/icon-svgs/{options-24.icon.d.ts → 24/options-24.icon.d.ts} +1 -1
- package/dist/icons/icon-svgs/{options-24.icon.js → 24/options-24.icon.js} +2 -2
- package/dist/icons/icon-svgs/{pencil-24.icon.d.ts → 24/pencil-24.icon.d.ts} +1 -1
- package/dist/icons/icon-svgs/{pencil-24.icon.js → 24/pencil-24.icon.js} +2 -2
- package/dist/icons/icon-svgs/24/plus-24.icon.d.ts +8 -0
- package/dist/icons/icon-svgs/24/plus-24.icon.js +23 -0
- package/dist/icons/icon-svgs/{printer-24.icon.d.ts → 24/printer-24.icon.d.ts} +1 -1
- package/dist/icons/icon-svgs/{printer-24.icon.js → 24/printer-24.icon.js} +2 -2
- package/dist/icons/icon-svgs/{shield-24.icon.d.ts → 24/shield-24.icon.d.ts} +1 -1
- package/dist/icons/icon-svgs/{shield-24.icon.js → 24/shield-24.icon.js} +2 -2
- package/dist/icons/icon-svgs/{sort-ascending-24.icon.d.ts → 24/sort-ascending-24.icon.d.ts} +1 -1
- package/dist/icons/icon-svgs/{sort-ascending-24.icon.js → 24/sort-ascending-24.icon.js} +2 -2
- package/dist/icons/icon-svgs/{sort-descending-24.icon.d.ts → 24/sort-descending-24.icon.d.ts} +1 -1
- package/dist/icons/icon-svgs/{sort-descending-24.icon.js → 24/sort-descending-24.icon.js} +2 -2
- package/dist/icons/icon-svgs/{sparkle-24.icon.d.ts → 24/sparkle-24.icon.d.ts} +1 -1
- package/dist/icons/icon-svgs/{sparkle-24.icon.js → 24/sparkle-24.icon.js} +2 -2
- package/dist/icons/icon-svgs/{speaker-loud-24.icon.d.ts → 24/speaker-loud-24.icon.d.ts} +1 -1
- package/dist/icons/icon-svgs/{speaker-loud-24.icon.js → 24/speaker-loud-24.icon.js} +2 -2
- package/dist/icons/icon-svgs/{speaker-medium-24.icon.d.ts → 24/speaker-medium-24.icon.d.ts} +1 -1
- package/dist/icons/icon-svgs/{speaker-medium-24.icon.js → 24/speaker-medium-24.icon.js} +2 -2
- package/dist/icons/icon-svgs/{speaker-muted-24.icon.d.ts → 24/speaker-muted-24.icon.d.ts} +1 -1
- package/dist/icons/icon-svgs/{speaker-muted-24.icon.js → 24/speaker-muted-24.icon.js} +2 -2
- package/dist/icons/icon-svgs/{speaker-quiet-24.icon.d.ts → 24/speaker-quiet-24.icon.d.ts} +1 -1
- package/dist/icons/icon-svgs/{speaker-quiet-24.icon.js → 24/speaker-quiet-24.icon.js} +2 -2
- package/dist/icons/icon-svgs/{star-24.icon.d.ts → 24/star-24.icon.d.ts} +1 -1
- package/dist/icons/icon-svgs/{star-24.icon.js → 24/star-24.icon.js} +2 -2
- package/dist/icons/icon-svgs/{status-failure-24.icon.d.ts → 24/status-failure-24.icon.d.ts} +1 -1
- package/dist/icons/icon-svgs/{status-failure-24.icon.js → 24/status-failure-24.icon.js} +2 -2
- package/dist/icons/icon-svgs/{status-in-progress-24.icon.d.ts → 24/status-in-progress-24.icon.d.ts} +1 -1
- package/dist/icons/icon-svgs/{status-in-progress-24.icon.js → 24/status-in-progress-24.icon.js} +2 -2
- package/dist/icons/icon-svgs/{status-success-24.icon.d.ts → 24/status-success-24.icon.d.ts} +1 -1
- package/dist/icons/icon-svgs/{status-success-24.icon.js → 24/status-success-24.icon.js} +2 -2
- package/dist/icons/icon-svgs/{status-unknown-24.icon.d.ts → 24/status-unknown-24.icon.d.ts} +1 -1
- package/dist/icons/icon-svgs/{status-unknown-24.icon.js → 24/status-unknown-24.icon.js} +2 -2
- package/dist/icons/icon-svgs/{status-warning-24.icon.d.ts → 24/status-warning-24.icon.d.ts} +1 -1
- package/dist/icons/icon-svgs/{status-warning-24.icon.js → 24/status-warning-24.icon.js} +2 -2
- package/dist/icons/icon-svgs/{sun-24.icon.d.ts → 24/sun-24.icon.d.ts} +1 -1
- package/dist/icons/icon-svgs/{sun-24.icon.js → 24/sun-24.icon.js} +2 -2
- package/dist/icons/icon-svgs/{upload-24.icon.d.ts → 24/upload-24.icon.d.ts} +1 -1
- package/dist/icons/icon-svgs/{upload-24.icon.js → 24/upload-24.icon.js} +2 -2
- package/dist/icons/icon-svgs/{x-24.icon.d.ts → 24/x-24.icon.d.ts} +1 -1
- package/dist/icons/icon-svgs/{x-24.icon.js → 24/x-24.icon.js} +2 -2
- package/dist/icons/index.d.ts +58 -56
- package/dist/icons/index.js +114 -112
- package/dist/icons/sized-icon.d.ts +8 -0
- package/dist/icons/sized-icon.js +12 -0
- package/dist/util/shared-text-input-logic.js +2 -2
- package/package.json +11 -7
|
@@ -21,5 +21,5 @@ export declare const ViraMenuItem: import("element-vir").DeclarativeElementDefin
|
|
|
21
21
|
iconOverride: ViraIconSvg;
|
|
22
22
|
}>, {
|
|
23
23
|
/** Removes event listeners registered during init. */
|
|
24
|
-
|
|
24
|
+
cleanupListeners: undefined | (() => void);
|
|
25
25
|
}, {}, "vira-menu-item-selected" | "vira-menu-item-disabled" | "vira-menu-item-enabled" | "vira-menu-item-default-icon" | "vira-menu-item-default-styles", "vira-menu-item-", readonly [], readonly []>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { assertWrap } from '@augment-vir/assert';
|
|
2
2
|
import { css, html } from 'element-vir';
|
|
3
3
|
import { listenTo } from 'typed-event-target';
|
|
4
|
-
import { Check24Icon } from '../../icons/icon-svgs/check-24.icon.js';
|
|
4
|
+
import { Check24Icon } from '../../icons/icon-svgs/24/check-24.icon.js';
|
|
5
5
|
import { viraFormCssVars } from '../../styles/form-styles.js';
|
|
6
6
|
import { noUserSelect } from '../../styles/index.js';
|
|
7
7
|
import { defineViraElement } from '../../util/define-vira-element.js';
|
|
@@ -17,7 +17,7 @@ export const ViraMenuItem = defineViraElement()({
|
|
|
17
17
|
state() {
|
|
18
18
|
return {
|
|
19
19
|
/** Removes event listeners registered during init. */
|
|
20
|
-
|
|
20
|
+
cleanupListeners: undefined,
|
|
21
21
|
};
|
|
22
22
|
},
|
|
23
23
|
hostClasses: {
|
|
@@ -94,7 +94,7 @@ export const ViraMenuItem = defineViraElement()({
|
|
|
94
94
|
host.setAttribute('tabindex', inputs.disabled ? '-1' : '0');
|
|
95
95
|
host.setAttribute('aria-selected', String(!!inputs.selected));
|
|
96
96
|
host.setAttribute('aria-disabled', String(!!inputs.disabled));
|
|
97
|
-
state.
|
|
97
|
+
state.cleanupListeners?.();
|
|
98
98
|
const propagating = {};
|
|
99
99
|
function propagateMouseEvent(event) {
|
|
100
100
|
if (propagating[event.type]) {
|
|
@@ -135,15 +135,15 @@ export const ViraMenuItem = defineViraElement()({
|
|
|
135
135
|
}),
|
|
136
136
|
];
|
|
137
137
|
updateState({
|
|
138
|
-
|
|
138
|
+
cleanupListeners: () => {
|
|
139
139
|
listenerRemovers.forEach((remover) => remover());
|
|
140
140
|
},
|
|
141
141
|
});
|
|
142
142
|
},
|
|
143
143
|
cleanup({ state, updateState }) {
|
|
144
|
-
state.
|
|
144
|
+
state.cleanupListeners?.();
|
|
145
145
|
updateState({
|
|
146
|
-
|
|
146
|
+
cleanupListeners: undefined,
|
|
147
147
|
});
|
|
148
148
|
},
|
|
149
149
|
render({ inputs }) {
|
|
@@ -309,11 +309,11 @@ export const ViraButton = defineViraElement()({
|
|
|
309
309
|
const styles = viraSizeVariants.map((sizeVariant) => {
|
|
310
310
|
return css `
|
|
311
311
|
${hostClasses[`vira-button-size-${sizeVariant}`].selector} {
|
|
312
|
-
height: ${viraSizeHeights[sizeVariant]}px;
|
|
313
312
|
font-size: ${viraFormCssVars[`vira-form-${sizeVariant}-text-size`].value};
|
|
314
313
|
|
|
315
314
|
button {
|
|
316
|
-
|
|
315
|
+
min-height: ${viraSizeHeights[sizeVariant]}px;
|
|
316
|
+
padding: 2px
|
|
317
317
|
${viraFormCssVars[`vira-form-${sizeVariant}-text-size`].value};
|
|
318
318
|
}
|
|
319
319
|
}
|
|
@@ -7,7 +7,7 @@ import { type ViraIconSvg } from '../icons/icon-svg.js';
|
|
|
7
7
|
* @see https://electrovir.github.io/vira/book/elements/vira-icon
|
|
8
8
|
*/
|
|
9
9
|
export declare const ViraIcon: import("element-vir").DeclarativeElementDefinition<"vira-icon", {
|
|
10
|
-
icon: Pick<ViraIconSvg, "svgTemplate"> | undefined;
|
|
10
|
+
icon: Pick<ViraIconSvg, "svgTemplate" | "size"> | undefined;
|
|
11
11
|
/** Ignores the given icon's embedded size and causes the <svg> element to fill its parent. */
|
|
12
12
|
fitContainer?: boolean | undefined;
|
|
13
13
|
}, {}, {}, "vira-icon-fit-container", "vira-icon-", readonly [], readonly []>;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { addPx } from '@augment-vir/common';
|
|
1
2
|
import { css } from 'element-vir';
|
|
2
3
|
import { defineViraElement } from '../util/define-vira-element.js';
|
|
3
4
|
/**
|
|
@@ -11,7 +12,7 @@ export const ViraIcon = defineViraElement()({
|
|
|
11
12
|
tagName: 'vira-icon',
|
|
12
13
|
hostClasses: {
|
|
13
14
|
/** Ignores the given icon's embedded size and causes the <svg> element to fill its parent. */
|
|
14
|
-
'vira-icon-fit-container': ({ inputs }) => !!inputs.fitContainer,
|
|
15
|
+
'vira-icon-fit-container': ({ inputs }) => !!inputs.fitContainer || !!inputs.icon?.size,
|
|
15
16
|
},
|
|
16
17
|
styles: ({ hostClasses }) => css `
|
|
17
18
|
:host {
|
|
@@ -28,15 +29,23 @@ export const ViraIcon = defineViraElement()({
|
|
|
28
29
|
display: block;
|
|
29
30
|
}
|
|
30
31
|
|
|
32
|
+
svg * {
|
|
33
|
+
vector-effect: non-scaling-stroke;
|
|
34
|
+
}
|
|
35
|
+
|
|
31
36
|
${hostClasses['vira-icon-fit-container'].selector} svg {
|
|
32
37
|
height: 100%;
|
|
33
38
|
width: 100%;
|
|
34
39
|
}
|
|
35
40
|
`,
|
|
36
|
-
render({ inputs }) {
|
|
41
|
+
render({ inputs, host }) {
|
|
37
42
|
if (!inputs.icon) {
|
|
38
43
|
return '';
|
|
39
44
|
}
|
|
45
|
+
else if (inputs.icon.size) {
|
|
46
|
+
host.style.width = addPx(inputs.icon.size);
|
|
47
|
+
host.style.height = addPx(inputs.icon.size);
|
|
48
|
+
}
|
|
40
49
|
return inputs.icon.svgTemplate;
|
|
41
50
|
},
|
|
42
51
|
});
|
|
@@ -2,7 +2,7 @@ import { assertWrap } from '@augment-vir/assert';
|
|
|
2
2
|
import { randomString } from '@augment-vir/common';
|
|
3
3
|
import { extractEventTarget } from '@augment-vir/web';
|
|
4
4
|
import { attributes, css, defineElementEvent, html, ifDefined, listen, nothing, onResize, renderIf, } from 'element-vir';
|
|
5
|
-
import { CloseX24Icon } from '../icons/icon-svgs/close-x-24.icon.js';
|
|
5
|
+
import { CloseX24Icon } from '../icons/icon-svgs/24/close-x-24.icon.js';
|
|
6
6
|
import { EyeClosed24Icon, EyeOpen24Icon } from '../icons/index.js';
|
|
7
7
|
import { createFocusStyles } from '../styles/focus.js';
|
|
8
8
|
import { viraFormCssVars } from '../styles/form-styles.js';
|
|
@@ -74,5 +74,5 @@ export declare const ViraLink: import("element-vir").DeclarativeElementDefinitio
|
|
|
74
74
|
disableLinkStyles: boolean;
|
|
75
75
|
}>, {
|
|
76
76
|
/** Removes event listeners registered during init. */
|
|
77
|
-
|
|
77
|
+
cleanupListeners: undefined | (() => void);
|
|
78
78
|
}, {}, "vira-link-link-styles", "vira-link-", readonly [], readonly []>;
|
|
@@ -16,7 +16,7 @@ export const ViraLink = defineViraElement()({
|
|
|
16
16
|
state() {
|
|
17
17
|
return {
|
|
18
18
|
/** Removes event listeners registered during init. */
|
|
19
|
-
|
|
19
|
+
cleanupListeners: undefined,
|
|
20
20
|
};
|
|
21
21
|
},
|
|
22
22
|
hostClasses: {
|
|
@@ -51,7 +51,7 @@ export const ViraLink = defineViraElement()({
|
|
|
51
51
|
}
|
|
52
52
|
`,
|
|
53
53
|
init({ state, updateState, host }) {
|
|
54
|
-
state.
|
|
54
|
+
state.cleanupListeners?.();
|
|
55
55
|
let propagating = false;
|
|
56
56
|
const listenerRemovers = [
|
|
57
57
|
listenTo(host, 'click', (event) => {
|
|
@@ -70,15 +70,15 @@ export const ViraLink = defineViraElement()({
|
|
|
70
70
|
}),
|
|
71
71
|
];
|
|
72
72
|
updateState({
|
|
73
|
-
|
|
73
|
+
cleanupListeners: () => {
|
|
74
74
|
listenerRemovers.forEach((remover) => remover());
|
|
75
75
|
},
|
|
76
76
|
});
|
|
77
77
|
},
|
|
78
78
|
cleanup({ state, updateState }) {
|
|
79
|
-
state.
|
|
79
|
+
state.cleanupListeners?.();
|
|
80
80
|
updateState({
|
|
81
|
-
|
|
81
|
+
cleanupListeners: undefined,
|
|
82
82
|
});
|
|
83
83
|
},
|
|
84
84
|
render({ inputs }) {
|
|
@@ -33,7 +33,7 @@ export declare const ViraModal: import("element-vir").DeclarativeElementDefiniti
|
|
|
33
33
|
contentElement: HTMLDivElement | undefined;
|
|
34
34
|
previousOpenValue: undefined | boolean;
|
|
35
35
|
/** Remove listeners. */
|
|
36
|
-
|
|
36
|
+
cleanupListeners: undefined | (() => void);
|
|
37
37
|
}, {
|
|
38
38
|
modalClose: import("element-vir").DefineEvent<void>;
|
|
39
39
|
}, "vira-modal-phone-size", "vira-modal-backdrop-filter", readonly ["modalTitle"], readonly []>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { assertWrap } from '@augment-vir/assert';
|
|
2
2
|
import { css, defineElementEvent, html, listen, nothing, onDomCreated } from 'element-vir';
|
|
3
3
|
import { listenToGlobal } from 'typed-event-target';
|
|
4
|
-
import { X24Icon } from '../icons/icon-svgs/x-24.icon.js';
|
|
4
|
+
import { X24Icon } from '../icons/icon-svgs/24/x-24.icon.js';
|
|
5
5
|
import { viraFormCssVars } from '../styles/form-styles.js';
|
|
6
6
|
import { noNativeFormStyles, noNativeSpacing } from '../styles/native-styles.js';
|
|
7
7
|
import { viraShadows } from '../styles/shadows.js';
|
|
@@ -29,11 +29,11 @@ export const ViraModal = defineViraElement()({
|
|
|
29
29
|
contentElement: undefined,
|
|
30
30
|
previousOpenValue: undefined,
|
|
31
31
|
/** Remove listeners. */
|
|
32
|
-
|
|
32
|
+
cleanupListeners: undefined,
|
|
33
33
|
};
|
|
34
34
|
},
|
|
35
35
|
cleanup({ state }) {
|
|
36
|
-
state.
|
|
36
|
+
state.cleanupListeners?.();
|
|
37
37
|
},
|
|
38
38
|
hostClasses: {
|
|
39
39
|
'vira-modal-phone-size': ({ inputs }) => !!inputs.isMobileSize,
|
|
@@ -142,7 +142,7 @@ export const ViraModal = defineViraElement()({
|
|
|
142
142
|
}
|
|
143
143
|
}
|
|
144
144
|
if (state.previousOpenValue !== inputs.open) {
|
|
145
|
-
state.
|
|
145
|
+
state.cleanupListeners?.();
|
|
146
146
|
updateState({
|
|
147
147
|
previousOpenValue: inputs.open,
|
|
148
148
|
});
|
|
@@ -151,7 +151,7 @@ export const ViraModal = defineViraElement()({
|
|
|
151
151
|
dispatch(new events.modalClose());
|
|
152
152
|
}));
|
|
153
153
|
updateState({
|
|
154
|
-
|
|
154
|
+
cleanupListeners: () => {
|
|
155
155
|
removers.forEach((remover) => remover());
|
|
156
156
|
},
|
|
157
157
|
});
|
|
@@ -159,7 +159,7 @@ export const ViraModal = defineViraElement()({
|
|
|
159
159
|
}
|
|
160
160
|
function close() {
|
|
161
161
|
if (inputs.open) {
|
|
162
|
-
state.
|
|
162
|
+
state.cleanupListeners?.();
|
|
163
163
|
dispatch(new events.modalClose());
|
|
164
164
|
}
|
|
165
165
|
}
|
|
@@ -17,5 +17,5 @@ export declare const ViraOverflowSwitch: import("element-vir").DeclarativeElemen
|
|
|
17
17
|
isOverflowing: boolean;
|
|
18
18
|
resizeObserver: undefined | ResizeObserver;
|
|
19
19
|
/** Called on cleanup to clear all listeners. */
|
|
20
|
-
|
|
20
|
+
cleanupListeners: undefined | (() => void);
|
|
21
21
|
}, {}, "vira-overflow-switch-show-small", "vira-overflow-switch-", readonly ["large", "small"], readonly []>;
|
|
@@ -20,7 +20,7 @@ export const ViraOverflowSwitch = defineViraElement()({
|
|
|
20
20
|
isOverflowing: false,
|
|
21
21
|
resizeObserver: undefined,
|
|
22
22
|
/** Called on cleanup to clear all listeners. */
|
|
23
|
-
|
|
23
|
+
cleanupListeners: undefined,
|
|
24
24
|
};
|
|
25
25
|
},
|
|
26
26
|
hostClasses: {
|
|
@@ -57,9 +57,9 @@ export const ViraOverflowSwitch = defineViraElement()({
|
|
|
57
57
|
}
|
|
58
58
|
`,
|
|
59
59
|
cleanup({ state, updateState }) {
|
|
60
|
-
state.
|
|
60
|
+
state.cleanupListeners?.();
|
|
61
61
|
updateState({
|
|
62
|
-
|
|
62
|
+
cleanupListeners: undefined,
|
|
63
63
|
});
|
|
64
64
|
},
|
|
65
65
|
render({ slotNames, updateState, inputs, host, state }) {
|
|
@@ -89,9 +89,9 @@ export const ViraOverflowSwitch = defineViraElement()({
|
|
|
89
89
|
});
|
|
90
90
|
/** Initial measurement: defer until after first layout. */
|
|
91
91
|
updateOverflowing(overflowParams);
|
|
92
|
-
state.
|
|
92
|
+
state.cleanupListeners?.();
|
|
93
93
|
updateState({
|
|
94
|
-
|
|
94
|
+
cleanupListeners() {
|
|
95
95
|
resizeObserver.disconnect();
|
|
96
96
|
removeSlotChangeListener();
|
|
97
97
|
},
|
|
@@ -33,7 +33,7 @@ export declare const ViraSelect: import("element-vir").DeclarativeElementDefinit
|
|
|
33
33
|
*/
|
|
34
34
|
randomId: string;
|
|
35
35
|
/** Removes event listeners registered during init. */
|
|
36
|
-
|
|
36
|
+
cleanupListeners: undefined | (() => void);
|
|
37
37
|
}, {
|
|
38
38
|
valueChange: import("element-vir").DefineEvent<string>;
|
|
39
39
|
}, "vira-select-disabled" | "vira-select-error" | "vira-select-not-raw", "vira-select-padding-horizontal" | "vira-select-padding-vertical" | "vira-select-icon-padding", readonly [], readonly []>;
|
|
@@ -28,7 +28,7 @@ export const ViraSelect = defineViraElement()({
|
|
|
28
28
|
*/
|
|
29
29
|
randomId: randomString(32),
|
|
30
30
|
/** Removes event listeners registered during init. */
|
|
31
|
-
|
|
31
|
+
cleanupListeners: undefined,
|
|
32
32
|
};
|
|
33
33
|
},
|
|
34
34
|
events: {
|
|
@@ -192,7 +192,7 @@ export const ViraSelect = defineViraElement()({
|
|
|
192
192
|
}
|
|
193
193
|
`,
|
|
194
194
|
init({ state, updateState, host }) {
|
|
195
|
-
state.
|
|
195
|
+
state.cleanupListeners?.();
|
|
196
196
|
const listenerRemovers = [
|
|
197
197
|
listenTo(host, 'mousedown', (event) => {
|
|
198
198
|
const selectElement = assertWrap.instanceOf(host.shadowRoot.querySelector('select'), HTMLSelectElement);
|
|
@@ -209,15 +209,15 @@ export const ViraSelect = defineViraElement()({
|
|
|
209
209
|
}),
|
|
210
210
|
];
|
|
211
211
|
updateState({
|
|
212
|
-
|
|
212
|
+
cleanupListeners: () => {
|
|
213
213
|
listenerRemovers.forEach((remover) => remover());
|
|
214
214
|
},
|
|
215
215
|
});
|
|
216
216
|
},
|
|
217
217
|
cleanup({ state, updateState }) {
|
|
218
|
-
state.
|
|
218
|
+
state.cleanupListeners?.();
|
|
219
219
|
updateState({
|
|
220
|
-
|
|
220
|
+
cleanupListeners: undefined,
|
|
221
221
|
});
|
|
222
222
|
},
|
|
223
223
|
render({ inputs, state, dispatch, events }) {
|
|
@@ -2,8 +2,8 @@ import { check } from '@augment-vir/assert';
|
|
|
2
2
|
import { colorCss, ContrastLevelName } from '@electrovir/color';
|
|
3
3
|
import { css, defineElementEvent, html, listen, unsafeCSS } from 'element-vir';
|
|
4
4
|
import { themeDefaultKey } from 'theme-vir/dist/color-theme/color-theme.js';
|
|
5
|
-
import { Check16Icon } from '../icons/icon-svgs/check-16.icon.js';
|
|
6
|
-
import { X16Icon } from '../icons/icon-svgs/x-16.icon.js';
|
|
5
|
+
import { Check16Icon } from '../icons/icon-svgs/16/check-16.icon.js';
|
|
6
|
+
import { X16Icon } from '../icons/icon-svgs/16/x-16.icon.js';
|
|
7
7
|
import { viraFormCssVars } from '../styles/form-styles.js';
|
|
8
8
|
import { ViraColorVariant, viraColorVariantToColorName, ViraEmphasis, ViraSize, viraSizeHeights, } from '../styles/form-variants.js';
|
|
9
9
|
import { noNativeFormStyles } from '../styles/native-styles.js';
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type * as featherIconsImportType from 'feather-icons';
|
|
2
|
+
import { type FeatherAttributes } from 'feather-icons';
|
|
3
|
+
import { type ViraIconSvg } from './icon-svg.js';
|
|
4
|
+
declare const featherIconsImported: typeof featherIconsImportType;
|
|
5
|
+
/**
|
|
6
|
+
* All supported feather icon names.
|
|
7
|
+
*
|
|
8
|
+
* @category Internal
|
|
9
|
+
*/
|
|
10
|
+
export type FeatherIconKey = keyof typeof featherIconsImported.icons;
|
|
11
|
+
/**
|
|
12
|
+
* An entry in {@link featherIcons}.
|
|
13
|
+
*
|
|
14
|
+
* @category Internal
|
|
15
|
+
*/
|
|
16
|
+
export type FeatherIconEntry = ViraIconSvg & ((options: Readonly<FeatherAttributes>) => ViraIconSvg);
|
|
17
|
+
/**
|
|
18
|
+
* All [Feather icons](https://feathericons.com) in a format compatible with `ViraIcon`. Each icon
|
|
19
|
+
* entry can be accessed directly or customized by calling it as a function.
|
|
20
|
+
*
|
|
21
|
+
* @category Icon
|
|
22
|
+
*/
|
|
23
|
+
export declare const featherIcons: Readonly<Record<FeatherIconKey, FeatherIconEntry>>;
|
|
24
|
+
export {};
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { check } from '@augment-vir/assert';
|
|
2
|
+
import { html, unsafeHTML } from 'element-vir';
|
|
3
|
+
import { viraIconCssVars } from './icon-css-vars.js';
|
|
4
|
+
/** Feather's export format is all messed up so we have to do this to catch all its possible cases. */
|
|
5
|
+
async function importFeatherIcons() {
|
|
6
|
+
const imported = (await import('feather-icons'));
|
|
7
|
+
function recurseImport(imported) {
|
|
8
|
+
if (check.isObject(imported)) {
|
|
9
|
+
if (check.hasKey(imported, 'default')) {
|
|
10
|
+
return recurseImport(imported.default);
|
|
11
|
+
}
|
|
12
|
+
else if (check.hasKey(imported, 'icons')) {
|
|
13
|
+
return imported;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
return undefined;
|
|
17
|
+
}
|
|
18
|
+
return (recurseImport(imported) ||
|
|
19
|
+
/** Unfortunately, Feather will attach itself to the global state sometimes. */
|
|
20
|
+
globalThis.feather);
|
|
21
|
+
}
|
|
22
|
+
const featherIconsImported = await importFeatherIcons();
|
|
23
|
+
const defaultFeatherOptions = {
|
|
24
|
+
fill: String(viraIconCssVars['vira-icon-fill-color'].value),
|
|
25
|
+
stroke: String(viraIconCssVars['vira-icon-stroke-color'].value),
|
|
26
|
+
'stroke-width': String(viraIconCssVars['vira-icon-stroke-width'].value),
|
|
27
|
+
};
|
|
28
|
+
function createFeatherIconEntry(iconKey) {
|
|
29
|
+
const featherIcon = featherIconsImported.icons[iconKey];
|
|
30
|
+
const configureIconCallback = (options) => {
|
|
31
|
+
return {
|
|
32
|
+
name: featherIcon.name,
|
|
33
|
+
svgTemplate: html `
|
|
34
|
+
${unsafeHTML(featherIcon.toSvg({
|
|
35
|
+
...defaultFeatherOptions,
|
|
36
|
+
...options,
|
|
37
|
+
}))}
|
|
38
|
+
`,
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
Object.defineProperty(configureIconCallback, 'name', {
|
|
42
|
+
value: featherIcon.name,
|
|
43
|
+
writable: false,
|
|
44
|
+
configurable: true,
|
|
45
|
+
});
|
|
46
|
+
return Object.assign(configureIconCallback, {
|
|
47
|
+
svgTemplate: html `
|
|
48
|
+
${unsafeHTML(featherIcon.toSvg(defaultFeatherOptions))}
|
|
49
|
+
`,
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
const featherIconCache = new Map();
|
|
53
|
+
/**
|
|
54
|
+
* All [Feather icons](https://feathericons.com) in a format compatible with `ViraIcon`. Each icon
|
|
55
|
+
* entry can be accessed directly or customized by calling it as a function.
|
|
56
|
+
*
|
|
57
|
+
* @category Icon
|
|
58
|
+
*/
|
|
59
|
+
export const featherIcons = new Proxy({}, {
|
|
60
|
+
get(_target, property) {
|
|
61
|
+
const iconKey = property;
|
|
62
|
+
if (!(iconKey in featherIconsImported.icons)) {
|
|
63
|
+
return undefined;
|
|
64
|
+
}
|
|
65
|
+
const cached = featherIconCache.get(iconKey);
|
|
66
|
+
if (cached) {
|
|
67
|
+
return cached;
|
|
68
|
+
}
|
|
69
|
+
const entry = createFeatherIconEntry(iconKey);
|
|
70
|
+
featherIconCache.set(iconKey, entry);
|
|
71
|
+
return entry;
|
|
72
|
+
},
|
|
73
|
+
has(_target, property) {
|
|
74
|
+
return property in featherIconsImported.icons;
|
|
75
|
+
},
|
|
76
|
+
ownKeys() {
|
|
77
|
+
return Object.keys(featherIconsImported.icons);
|
|
78
|
+
},
|
|
79
|
+
getOwnPropertyDescriptor(_target, property) {
|
|
80
|
+
if (property in featherIconsImported.icons) {
|
|
81
|
+
return {
|
|
82
|
+
configurable: true,
|
|
83
|
+
enumerable: true,
|
|
84
|
+
writable: false,
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
return undefined;
|
|
88
|
+
},
|
|
89
|
+
});
|
package/dist/icons/icon-svg.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { html } from 'element-vir';
|
|
2
|
-
import { viraIconCssVars } from '
|
|
3
|
-
import { defineIcon } from '
|
|
2
|
+
import { viraIconCssVars } from '../../icon-css-vars.js';
|
|
3
|
+
import { defineIcon } from '../../icon-svg.js';
|
|
4
4
|
/**
|
|
5
5
|
* A checkmark (16px).
|
|
6
6
|
*
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { html } from 'element-vir';
|
|
2
|
-
import { viraIconCssVars } from '
|
|
3
|
-
import { defineIcon } from '
|
|
2
|
+
import { viraIconCssVars } from '../../icon-css-vars.js';
|
|
3
|
+
import { defineIcon } from '../../icon-svg.js';
|
|
4
4
|
/**
|
|
5
5
|
* A chevron that points downwards (16px). See ChevronDown24Icon for the 24px version.
|
|
6
6
|
*
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { html } from 'element-vir';
|
|
2
|
-
import { viraIconCssVars } from '
|
|
3
|
-
import { defineIcon } from '
|
|
2
|
+
import { viraIconCssVars } from '../../icon-css-vars.js';
|
|
3
|
+
import { defineIcon } from '../../icon-svg.js';
|
|
4
4
|
/**
|
|
5
5
|
* A chevron that points upwards (16px). See ChevronUp24Icon for the 24px version.
|
|
6
6
|
*
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { html } from 'element-vir';
|
|
2
|
-
import { viraIconCssVars } from '
|
|
3
|
-
import { defineIcon } from '
|
|
2
|
+
import { viraIconCssVars } from '../../icon-css-vars.js';
|
|
3
|
+
import { defineIcon } from '../../icon-svg.js';
|
|
4
4
|
/**
|
|
5
5
|
* A dash (horizontal line) icon.
|
|
6
6
|
*
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { html } from 'element-vir';
|
|
2
|
-
import { viraIconCssVars } from '
|
|
3
|
-
import { defineIcon } from '
|
|
2
|
+
import { viraIconCssVars } from '../../icon-css-vars.js';
|
|
3
|
+
import { defineIcon } from '../../icon-svg.js';
|
|
4
4
|
/**
|
|
5
5
|
* An icon symbol that represents an HTML element.
|
|
6
6
|
*
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { html } from 'element-vir';
|
|
2
|
-
import { viraIconCssVars } from '
|
|
3
|
-
import { defineIcon } from '
|
|
2
|
+
import { viraIconCssVars } from '../../icon-css-vars.js';
|
|
3
|
+
import { defineIcon } from '../../icon-svg.js';
|
|
4
4
|
/**
|
|
5
5
|
* An upload icon (16×16).
|
|
6
6
|
*
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { html } from 'element-vir';
|
|
2
|
-
import { viraIconCssVars } from '
|
|
3
|
-
import { defineIcon } from '
|
|
2
|
+
import { viraIconCssVars } from '../../icon-css-vars.js';
|
|
3
|
+
import { defineIcon } from '../../icon-svg.js';
|
|
4
4
|
/**
|
|
5
5
|
* An x icon.
|
|
6
6
|
*
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { html } from 'element-vir';
|
|
2
|
-
import { viraIconCssVars } from '
|
|
3
|
-
import { defineIcon } from '
|
|
2
|
+
import { viraIconCssVars } from '../../icon-css-vars.js';
|
|
3
|
+
import { defineIcon } from '../../icon-svg.js';
|
|
4
4
|
/**
|
|
5
5
|
* An arrow down icon.
|
|
6
6
|
*
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { html } from 'element-vir';
|
|
2
|
-
import { viraIconCssVars } from '
|
|
3
|
-
import { defineIcon } from '
|
|
2
|
+
import { viraIconCssVars } from '../../icon-css-vars.js';
|
|
3
|
+
import { defineIcon } from '../../icon-svg.js';
|
|
4
4
|
/**
|
|
5
5
|
* An arrow left icon.
|
|
6
6
|
*
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { html } from 'element-vir';
|
|
2
|
-
import { viraIconCssVars } from '
|
|
3
|
-
import { defineIcon } from '
|
|
2
|
+
import { viraIconCssVars } from '../../icon-css-vars.js';
|
|
3
|
+
import { defineIcon } from '../../icon-svg.js';
|
|
4
4
|
/**
|
|
5
5
|
* An arrow right icon.
|
|
6
6
|
*
|