vira 28.19.4 → 28.19.6

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.
Files changed (188) hide show
  1. package/package.json +13 -13
  2. package/src/elements/define-vira-element.ts +29 -0
  3. package/src/elements/form/vira-form-fields.ts +140 -0
  4. package/src/elements/form/vira-form.element.ts +204 -0
  5. package/src/elements/pop-up/pop-up-helpers.ts +85 -0
  6. package/{dist/elements/pop-up/pop-up-menu-item.d.ts → src/elements/pop-up/pop-up-menu-item.ts} +4 -3
  7. package/{dist/elements/pop-up/vira-menu-item.element.js → src/elements/pop-up/vira-menu-item.element.ts} +28 -11
  8. package/src/elements/pop-up/vira-menu-trigger.element.ts +158 -0
  9. package/{dist/elements/pop-up/vira-menu.element.js → src/elements/pop-up/vira-menu.element.ts} +76 -49
  10. package/{dist/elements/pop-up/vira-pop-up-menu.element.js → src/elements/pop-up/vira-pop-up-menu.element.ts} +34 -22
  11. package/{dist/elements/pop-up/vira-pop-up-trigger.element.js → src/elements/pop-up/vira-pop-up-trigger.element.ts} +200 -91
  12. package/src/elements/shared-text-input-logic.ts +173 -0
  13. package/{dist/elements/vira-bold-text.element.js → src/elements/vira-bold-text.element.ts} +8 -7
  14. package/{dist/elements/vira-button.element.js → src/elements/vira-button.element.ts} +64 -33
  15. package/{dist/elements/vira-card.element.js → src/elements/vira-card.element.ts} +16 -13
  16. package/{dist/elements/vira-checkbox.element.js → src/elements/vira-checkbox.element.ts} +71 -28
  17. package/{dist/elements/vira-collapsible-wrapper.element.js → src/elements/vira-collapsible-wrapper.element.ts} +18 -16
  18. package/{dist/elements/vira-dropdown.element.js → src/elements/vira-dropdown.element.ts} +94 -48
  19. package/{dist/elements/vira-error.element.js → src/elements/vira-error.element.ts} +6 -5
  20. package/{dist/elements/vira-icon.element.js → src/elements/vira-icon.element.ts} +13 -6
  21. package/{dist/elements/vira-image.element.js → src/elements/vira-image.element.ts} +63 -43
  22. package/{dist/elements/vira-input.element.js → src/elements/vira-input.element.ts} +151 -85
  23. package/{dist/elements/vira-link.element.js → src/elements/vira-link.element.ts} +62 -11
  24. package/{dist/elements/vira-modal.element.js → src/elements/vira-modal.element.ts} +89 -50
  25. package/src/elements/vira-overflow-switch.element.ts +137 -0
  26. package/{dist/elements/vira-progress.element.js → src/elements/vira-progress.element.ts} +26 -11
  27. package/{dist/elements/vira-select.element.js → src/elements/vira-select.element.ts} +96 -41
  28. package/src/icons/icon-color.test-helper.ts +9 -0
  29. package/{dist/icons/icon-css-vars.js → src/icons/icon-css-vars.ts} +2 -1
  30. package/src/icons/icon-svg.ts +71 -0
  31. package/{dist/icons/icon-svgs/bell-24.icon.js → src/icons/icon-svgs/bell-24.icon.ts} +5 -4
  32. package/{dist/icons/icon-svgs/chat-24.icon.js → src/icons/icon-svgs/chat-24.icon.ts} +5 -4
  33. package/{dist/icons/icon-svgs/check-24.icon.js → src/icons/icon-svgs/check-24.icon.ts} +5 -4
  34. package/{dist/icons/icon-svgs/chevron-down-24.icon.js → src/icons/icon-svgs/chevron-down-24.icon.ts} +5 -4
  35. package/{dist/icons/icon-svgs/chevron-up-24.icon.js → src/icons/icon-svgs/chevron-up-24.icon.ts} +5 -4
  36. package/{dist/icons/icon-svgs/close-x-24.icon.js → src/icons/icon-svgs/close-x-24.icon.ts} +5 -4
  37. package/{dist/icons/icon-svgs/commit-24.icon.js → src/icons/icon-svgs/commit-24.icon.ts} +5 -4
  38. package/{dist/icons/icon-svgs/copy-24.icon.js → src/icons/icon-svgs/copy-24.icon.ts} +5 -4
  39. package/{dist/icons/icon-svgs/document-24.icon.js → src/icons/icon-svgs/document-24.icon.ts} +5 -4
  40. package/{dist/icons/icon-svgs/document-search-24.icon.js → src/icons/icon-svgs/document-search-24.icon.ts} +5 -4
  41. package/{dist/icons/icon-svgs/double-chevron-24.icon.js → src/icons/icon-svgs/double-chevron-24.icon.ts} +5 -4
  42. package/{dist/icons/icon-svgs/element-16.icon.js → src/icons/icon-svgs/element-16.icon.ts} +5 -4
  43. package/{dist/icons/icon-svgs/element-24.icon.js → src/icons/icon-svgs/element-24.icon.ts} +5 -4
  44. package/{dist/icons/icon-svgs/external-link-24.icon.js → src/icons/icon-svgs/external-link-24.icon.ts} +5 -4
  45. package/{dist/icons/icon-svgs/eye-closed-24.icon.js → src/icons/icon-svgs/eye-closed-24.icon.ts} +5 -4
  46. package/{dist/icons/icon-svgs/eye-open-24.icon.js → src/icons/icon-svgs/eye-open-24.icon.ts} +5 -4
  47. package/{dist/icons/icon-svgs/filter-24.icon.js → src/icons/icon-svgs/filter-24.icon.ts} +5 -4
  48. package/{dist/icons/icon-svgs/link-24.icon.js → src/icons/icon-svgs/link-24.icon.ts} +5 -4
  49. package/{dist/icons/icon-svgs/loader-24.icon.js → src/icons/icon-svgs/loader-24.icon.ts} +5 -4
  50. package/{dist/icons/icon-svgs/loader-animated-24.icon.js → src/icons/icon-svgs/loader-animated-24.icon.ts} +8 -6
  51. package/{dist/icons/icon-svgs/lock-24.icon.js → src/icons/icon-svgs/lock-24.icon.ts} +5 -4
  52. package/{dist/icons/icon-svgs/options-24.icon.js → src/icons/icon-svgs/options-24.icon.ts} +5 -4
  53. package/{dist/icons/icon-svgs/pencil-24.icon.js → src/icons/icon-svgs/pencil-24.icon.ts} +5 -4
  54. package/{dist/icons/icon-svgs/shield-24.icon.js → src/icons/icon-svgs/shield-24.icon.ts} +5 -4
  55. package/{dist/icons/icon-svgs/sort-ascending-24.icon.js → src/icons/icon-svgs/sort-ascending-24.icon.ts} +5 -4
  56. package/{dist/icons/icon-svgs/sort-descending-24.icon.js → src/icons/icon-svgs/sort-descending-24.icon.ts} +5 -4
  57. package/{dist/icons/icon-svgs/speaker-loud-24.icon.js → src/icons/icon-svgs/speaker-loud-24.icon.ts} +5 -4
  58. package/{dist/icons/icon-svgs/speaker-medium-24.icon.js → src/icons/icon-svgs/speaker-medium-24.icon.ts} +5 -4
  59. package/{dist/icons/icon-svgs/speaker-muted-24.icon.js → src/icons/icon-svgs/speaker-muted-24.icon.ts} +5 -4
  60. package/{dist/icons/icon-svgs/speaker-quiet-24.icon.js → src/icons/icon-svgs/speaker-quiet-24.icon.ts} +5 -4
  61. package/{dist/icons/icon-svgs/star-24.icon.js → src/icons/icon-svgs/star-24.icon.ts} +5 -4
  62. package/{dist/icons/icon-svgs/status-failure-24.icon.js → src/icons/icon-svgs/status-failure-24.icon.ts} +5 -4
  63. package/{dist/icons/icon-svgs/status-in-progress-24.icon.js → src/icons/icon-svgs/status-in-progress-24.icon.ts} +5 -4
  64. package/{dist/icons/icon-svgs/status-success-24.icon.js → src/icons/icon-svgs/status-success-24.icon.ts} +5 -4
  65. package/{dist/icons/icon-svgs/status-unknown-24.icon.js → src/icons/icon-svgs/status-unknown-24.icon.ts} +5 -4
  66. package/{dist/icons/icon-svgs/status-warning-24.icon.js → src/icons/icon-svgs/status-warning-24.icon.ts} +5 -4
  67. package/{dist/icons/icon-svgs/upload-24.icon.js → src/icons/icon-svgs/upload-24.icon.ts} +5 -4
  68. package/{dist/icons/icon-svgs/x-24.icon.js → src/icons/icon-svgs/x-24.icon.ts} +5 -4
  69. package/{dist/icons/index.js → src/icons/index.ts} +43 -39
  70. package/{dist/styles/border.js → src/styles/border.ts} +2 -1
  71. package/{dist/styles/disabled.js → src/styles/disabled.ts} +3 -2
  72. package/{dist/styles/durations.js → src/styles/durations.ts} +2 -1
  73. package/{dist/styles/focus.js → src/styles/focus.ts} +32 -8
  74. package/{dist/styles/font.js → src/styles/font.ts} +2 -1
  75. package/{dist/styles/form-styles.js → src/styles/form-styles.ts} +6 -1
  76. package/{dist/styles/index.js → src/styles/index.ts} +1 -0
  77. package/{dist/styles/native-styles.js → src/styles/native-styles.ts} +5 -3
  78. package/{dist/styles/scrollbar.js → src/styles/scrollbar.ts} +4 -3
  79. package/{dist/styles/shadows.js → src/styles/shadows.ts} +8 -6
  80. package/{dist/styles/user-select.js → src/styles/user-select.ts} +3 -2
  81. package/{dist/styles/vira-color-palette.js → src/styles/vira-color-palette.ts} +11 -1
  82. package/src/styles/vira-color-theme.ts +1142 -0
  83. package/src/util/define-table.ts +279 -0
  84. package/src/util/dynamic-element.ts +129 -0
  85. package/src/util/pop-up-manager.ts +380 -0
  86. package/dist/elements/define-vira-element.d.ts +0 -18
  87. package/dist/elements/define-vira-element.js +0 -19
  88. package/dist/elements/form/vira-form-fields.d.ts +0 -100
  89. package/dist/elements/form/vira-form-fields.js +0 -60
  90. package/dist/elements/form/vira-form.element.d.ts +0 -35
  91. package/dist/elements/form/vira-form.element.js +0 -151
  92. package/dist/elements/index.js +0 -25
  93. package/dist/elements/pop-up/pop-up-helpers.d.ts +0 -33
  94. package/dist/elements/pop-up/pop-up-helpers.js +0 -58
  95. package/dist/elements/pop-up/pop-up-menu-item.js +0 -1
  96. package/dist/elements/pop-up/vira-menu-item.element.d.ts +0 -19
  97. package/dist/elements/pop-up/vira-menu-trigger.element.d.ts +0 -41
  98. package/dist/elements/pop-up/vira-menu-trigger.element.js +0 -121
  99. package/dist/elements/pop-up/vira-menu.element.d.ts +0 -38
  100. package/dist/elements/pop-up/vira-pop-up-menu.element.d.ts +0 -35
  101. package/dist/elements/pop-up/vira-pop-up-trigger.element.d.ts +0 -105
  102. package/dist/elements/shared-text-input-logic.d.ts +0 -63
  103. package/dist/elements/shared-text-input-logic.js +0 -101
  104. package/dist/elements/vira-bold-text.element.d.ts +0 -9
  105. package/dist/elements/vira-button.element.d.ts +0 -31
  106. package/dist/elements/vira-card.element.d.ts +0 -18
  107. package/dist/elements/vira-checkbox.element.d.ts +0 -34
  108. package/dist/elements/vira-collapsible-wrapper.element.d.ts +0 -14
  109. package/dist/elements/vira-dropdown.element.d.ts +0 -46
  110. package/dist/elements/vira-error.element.d.ts +0 -7
  111. package/dist/elements/vira-icon.element.d.ts +0 -13
  112. package/dist/elements/vira-image.element.d.ts +0 -45
  113. package/dist/elements/vira-input.element.d.ts +0 -62
  114. package/dist/elements/vira-link.element.d.ts +0 -73
  115. package/dist/elements/vira-modal.element.d.ts +0 -39
  116. package/dist/elements/vira-overflow-switch.element.d.ts +0 -21
  117. package/dist/elements/vira-overflow-switch.element.js +0 -110
  118. package/dist/elements/vira-progress.element.d.ts +0 -18
  119. package/dist/elements/vira-select.element.d.ts +0 -48
  120. package/dist/icons/icon-color.test-helper.d.ts +0 -6
  121. package/dist/icons/icon-color.test-helper.js +0 -9
  122. package/dist/icons/icon-css-vars.d.ts +0 -14
  123. package/dist/icons/icon-svg.d.ts +0 -27
  124. package/dist/icons/icon-svg.js +0 -48
  125. package/dist/icons/icon-svgs/bell-24.icon.d.ts +0 -8
  126. package/dist/icons/icon-svgs/chat-24.icon.d.ts +0 -8
  127. package/dist/icons/icon-svgs/check-24.icon.d.ts +0 -8
  128. package/dist/icons/icon-svgs/chevron-down-24.icon.d.ts +0 -8
  129. package/dist/icons/icon-svgs/chevron-up-24.icon.d.ts +0 -8
  130. package/dist/icons/icon-svgs/close-x-24.icon.d.ts +0 -8
  131. package/dist/icons/icon-svgs/commit-24.icon.d.ts +0 -8
  132. package/dist/icons/icon-svgs/copy-24.icon.d.ts +0 -8
  133. package/dist/icons/icon-svgs/document-24.icon.d.ts +0 -8
  134. package/dist/icons/icon-svgs/document-search-24.icon.d.ts +0 -8
  135. package/dist/icons/icon-svgs/double-chevron-24.icon.d.ts +0 -8
  136. package/dist/icons/icon-svgs/element-16.icon.d.ts +0 -8
  137. package/dist/icons/icon-svgs/element-24.icon.d.ts +0 -8
  138. package/dist/icons/icon-svgs/external-link-24.icon.d.ts +0 -8
  139. package/dist/icons/icon-svgs/eye-closed-24.icon.d.ts +0 -8
  140. package/dist/icons/icon-svgs/eye-open-24.icon.d.ts +0 -8
  141. package/dist/icons/icon-svgs/filter-24.icon.d.ts +0 -8
  142. package/dist/icons/icon-svgs/link-24.icon.d.ts +0 -8
  143. package/dist/icons/icon-svgs/loader-24.icon.d.ts +0 -8
  144. package/dist/icons/icon-svgs/loader-animated-24.icon.d.ts +0 -8
  145. package/dist/icons/icon-svgs/lock-24.icon.d.ts +0 -8
  146. package/dist/icons/icon-svgs/options-24.icon.d.ts +0 -8
  147. package/dist/icons/icon-svgs/pencil-24.icon.d.ts +0 -8
  148. package/dist/icons/icon-svgs/shield-24.icon.d.ts +0 -8
  149. package/dist/icons/icon-svgs/sort-ascending-24.icon.d.ts +0 -8
  150. package/dist/icons/icon-svgs/sort-descending-24.icon.d.ts +0 -8
  151. package/dist/icons/icon-svgs/speaker-loud-24.icon.d.ts +0 -8
  152. package/dist/icons/icon-svgs/speaker-medium-24.icon.d.ts +0 -8
  153. package/dist/icons/icon-svgs/speaker-muted-24.icon.d.ts +0 -8
  154. package/dist/icons/icon-svgs/speaker-quiet-24.icon.d.ts +0 -8
  155. package/dist/icons/icon-svgs/star-24.icon.d.ts +0 -8
  156. package/dist/icons/icon-svgs/status-failure-24.icon.d.ts +0 -8
  157. package/dist/icons/icon-svgs/status-in-progress-24.icon.d.ts +0 -8
  158. package/dist/icons/icon-svgs/status-success-24.icon.d.ts +0 -8
  159. package/dist/icons/icon-svgs/status-unknown-24.icon.d.ts +0 -8
  160. package/dist/icons/icon-svgs/status-warning-24.icon.d.ts +0 -8
  161. package/dist/icons/icon-svgs/upload-24.icon.d.ts +0 -8
  162. package/dist/icons/icon-svgs/x-24.icon.d.ts +0 -8
  163. package/dist/icons/index.d.ts +0 -86
  164. package/dist/index.js +0 -4
  165. package/dist/styles/border.d.ts +0 -9
  166. package/dist/styles/disabled.d.ts +0 -6
  167. package/dist/styles/durations.d.ts +0 -22
  168. package/dist/styles/focus.d.ts +0 -31
  169. package/dist/styles/font.d.ts +0 -9
  170. package/dist/styles/form-styles.d.ts +0 -20
  171. package/dist/styles/index.d.ts +0 -13
  172. package/dist/styles/native-styles.d.ts +0 -13
  173. package/dist/styles/scrollbar.d.ts +0 -6
  174. package/dist/styles/shadows.d.ts +0 -20
  175. package/dist/styles/user-select.d.ts +0 -6
  176. package/dist/styles/vira-color-palette.d.ts +0 -95
  177. package/dist/styles/vira-color-theme.d.ts +0 -1184
  178. package/dist/styles/vira-color-theme.js +0 -1137
  179. package/dist/util/define-table.d.ts +0 -110
  180. package/dist/util/define-table.js +0 -115
  181. package/dist/util/dynamic-element.d.ts +0 -63
  182. package/dist/util/dynamic-element.js +0 -61
  183. package/dist/util/index.js +0 -3
  184. package/dist/util/pop-up-manager.d.ts +0 -180
  185. package/dist/util/pop-up-manager.js +0 -203
  186. /package/{dist/elements/index.d.ts → src/elements/index.ts} +0 -0
  187. /package/{dist/index.d.ts → src/index.ts} +0 -0
  188. /package/{dist/util/index.d.ts → src/util/index.ts} +0 -0
@@ -1,110 +0,0 @@
1
- import { css, html, onDomCreated } from 'element-vir';
2
- import { listenTo } from 'typed-event-target';
3
- import { defineViraElement } from './define-vira-element.js';
4
- /**
5
- * An element switches between two slots based on their overflow.
6
- *
7
- * @category Elements
8
- * @see https://electrovir.github.io/vira/book/elements/vira-overflow-switch
9
- */
10
- export const ViraOverflowSwitch = defineViraElement()({
11
- tagName: 'vira-overflow-switch',
12
- slotNames: [
13
- /** The child to render, if it fits. */
14
- 'large',
15
- /** The child to render if the large one does not fit. */
16
- 'small',
17
- ],
18
- state() {
19
- return {
20
- isOverflowing: false,
21
- resizeObserver: undefined,
22
- /** Called on cleanup to clear all listeners. */
23
- cleanup: undefined,
24
- };
25
- },
26
- hostClasses: {
27
- 'vira-overflow-switch-show-small': ({ state, inputs }) => state.isOverflowing || !!inputs.useSmall,
28
- },
29
- styles: ({ hostClasses }) => css `
30
- :host {
31
- display: inline-block;
32
- max-width: 100%;
33
- }
34
-
35
- .large,
36
- .small {
37
- display: inline-block;
38
- }
39
-
40
- .small {
41
- display: none;
42
- }
43
-
44
- /**
45
- * When the large content overflows, hide it but keep it in layout so we can measure it.
46
- * The small content is then shown instead.
47
- */
48
- ${hostClasses['vira-overflow-switch-show-small'].selector} .large {
49
- visibility: hidden;
50
- position: absolute;
51
- top: 0;
52
- left: 0;
53
- }
54
-
55
- ${hostClasses['vira-overflow-switch-show-small'].selector} .small {
56
- display: inline-block;
57
- }
58
- `,
59
- cleanup({ state, updateState }) {
60
- state.cleanup?.();
61
- updateState({
62
- cleanup: undefined,
63
- });
64
- },
65
- render({ slotNames, updateState, inputs, host, state }) {
66
- return html `
67
- <div
68
- class="large"
69
- ${onDomCreated((largeElement) => {
70
- if (!inputs.automaticallySwitch) {
71
- return;
72
- }
73
- const overflowParams = {
74
- elementToTest: largeElement,
75
- host,
76
- updateState,
77
- };
78
- const resizeObserver = new ResizeObserver(() => {
79
- updateOverflowing(overflowParams);
80
- });
81
- resizeObserver.observe(host);
82
- /**
83
- * Also observe the large slot wrapper itself in case its own layout changes
84
- * without host resizing.
85
- */
86
- resizeObserver.observe(largeElement);
87
- const removeSlotChangeListener = listenTo(largeElement, 'slotchange', () => {
88
- updateOverflowing(overflowParams);
89
- });
90
- /** Initial measurement: defer until after first layout. */
91
- updateOverflowing(overflowParams);
92
- state.cleanup?.();
93
- updateState({
94
- cleanup() {
95
- resizeObserver.disconnect();
96
- removeSlotChangeListener();
97
- },
98
- });
99
- })}
100
- >
101
- <slot name=${slotNames.large}></slot>
102
- </div>
103
- <div class="small"><slot name=${slotNames.small}></slot></div>
104
- `;
105
- },
106
- });
107
- function updateOverflowing({ elementToTest, host, updateState, }) {
108
- const isOverflowing = elementToTest.scrollWidth > host.clientWidth;
109
- updateState({ isOverflowing });
110
- }
@@ -1,18 +0,0 @@
1
- import { type PartialWithUndefined } from '@augment-vir/common';
2
- /**
3
- * A [`<progress>`](https://developer.mozilla.org/docs/Web/HTML/Reference/Elements/progress)
4
- * alternative that supports custom styling in _all_ browsers via CSS vars _and_ prevents background
5
- * bleed.
6
- *
7
- * @category Progress
8
- * @category Elements
9
- * @see https://electrovir.github.io/vira/book/elements/vira-progress
10
- */
11
- export declare const ViraProgress: import("element-vir").DeclarativeElementDefinition<"vira-progress", Readonly<{
12
- value: number;
13
- } & PartialWithUndefined<{
14
- /** @default 0 */
15
- min: number;
16
- /** @default 100 */
17
- max: number;
18
- }>>, {}, {}, "vira-progress-", "vira-progress-border-radius" | "vira-progress-background-color" | "vira-progress-foreground-color", readonly [], readonly []>;
@@ -1,48 +0,0 @@
1
- import { type PartialWithUndefined } from '@augment-vir/common';
2
- import { type AttributeValues } from 'element-vir';
3
- import { type ViraIconSvg } from '../icons/index.js';
4
- /**
5
- * Options for {@link ViraSelect}.
6
- *
7
- * @category Dropdown
8
- * @category Elements
9
- * @see https://electrovir.github.io/vira/book/elements/vira-select
10
- */
11
- export type ViraSelectOption = {
12
- /** A value or id, used to keep track of which option is selected. */
13
- value: string;
14
- label: string;
15
- } & PartialWithUndefined<{
16
- disabled: boolean;
17
- }>;
18
- /**
19
- * Similar to {@link ViraDropdown} but is, instead, simply a wrapper for `<select>` and nothing more.
20
- *
21
- * @category Dropdown
22
- * @category Elements
23
- * @see https://electrovir.github.io/vira/book/elements/vira-select
24
- */
25
- export declare const ViraSelect: import("element-vir").DeclarativeElementDefinition<"vira-select", Readonly<{
26
- options: ReadonlyArray<Readonly<ViraSelectOption>>;
27
- /** The currently selected option value. */
28
- value: undefined | string;
29
- } & PartialWithUndefined<{
30
- icon: Readonly<ViraIconSvg>;
31
- placeholder: string;
32
- label: string;
33
- disabled: boolean;
34
- attributePassthrough: Readonly<PartialWithUndefined<{
35
- label: AttributeValues;
36
- select: AttributeValues;
37
- option: AttributeValues;
38
- }>>;
39
- hasError: boolean;
40
- }>>, {
41
- /**
42
- * Used to couple the label and select together. This is not applied if no label is
43
- * provided.
44
- */
45
- randomId: string;
46
- }, {
47
- valueChange: import("element-vir").DefineEvent<string>;
48
- }, "vira-select-disabled" | "vira-select-error", "vira-select-padding-horizontal" | "vira-select-padding-vertical" | "vira-select-icon-padding", readonly [], readonly []>;
@@ -1,6 +0,0 @@
1
- export declare enum ColorType {
2
- Color = "color",
3
- Fill = "fill",
4
- Stroke = "stroke"
5
- }
6
- export declare function extractIconColor(element: Element, colorType: ColorType): string;
@@ -1,9 +0,0 @@
1
- export var ColorType;
2
- (function (ColorType) {
3
- ColorType["Color"] = "color";
4
- ColorType["Fill"] = "fill";
5
- ColorType["Stroke"] = "stroke";
6
- })(ColorType || (ColorType = {}));
7
- export function extractIconColor(element, colorType) {
8
- return window.getComputedStyle(element).getPropertyValue(colorType);
9
- }
@@ -1,14 +0,0 @@
1
- /**
2
- * CSS vars that are supported by all Vira SVG icons.
3
- *
4
- * @category Icon
5
- * @category CSS Vars
6
- * @category Styles
7
- */
8
- export declare const viraIconCssVars: import("lit-css-vars").CssVarDefinitions<{
9
- /** To be used for coloring an icon's stroke. */
10
- readonly 'vira-icon-stroke-color': "currentColor";
11
- /** To be used for coloring an icon's fill. */
12
- readonly 'vira-icon-fill-color': "none";
13
- readonly 'vira-icon-stroke-width': "1.5px";
14
- }>;
@@ -1,27 +0,0 @@
1
- import { type TemplateResult } from 'element-vir';
2
- import { viraIconCssVars } from './icon-css-vars.js';
3
- /**
4
- * An individual Vira icon SVG definition.
5
- *
6
- * @category Icon
7
- */
8
- export type ViraIconSvg = {
9
- name: string;
10
- svgTemplate: TemplateResult;
11
- };
12
- /**
13
- * A function used to define an individual Vira icon SVG.
14
- *
15
- * @category Icon
16
- */
17
- export declare function defineIcon({ name, svgTemplate, }: {
18
- name: string;
19
- svgTemplate: TemplateResult;
20
- }): ViraIconSvg;
21
- /**
22
- * Wraps an existing icon with a specific color and outputs another icon that can be used anywhere
23
- * the original icon can be used.
24
- *
25
- * @category Icon
26
- */
27
- export declare function createColoredIcon(icon: ViraIconSvg, colors: Partial<Record<keyof typeof viraIconCssVars, string>>): ViraIconSvg;
@@ -1,48 +0,0 @@
1
- import { getObjectTypedKeys, stringify } from '@augment-vir/common';
2
- import Color from 'colorjs.io';
3
- import { html } from 'element-vir';
4
- import { viraIconCssVars } from './icon-css-vars.js';
5
- /**
6
- * A function used to define an individual Vira icon SVG.
7
- *
8
- * @category Icon
9
- */
10
- export function defineIcon({ name, svgTemplate, }) {
11
- const iconSvg = {
12
- name,
13
- svgTemplate,
14
- };
15
- return iconSvg;
16
- }
17
- function getAssertedValidColor(input) {
18
- try {
19
- if (!input) {
20
- throw new Error('invalid empty color');
21
- }
22
- return new Color(input);
23
- }
24
- catch {
25
- throw new Error(`Invalid color: ${stringify(input)}`);
26
- }
27
- }
28
- /**
29
- * Wraps an existing icon with a specific color and outputs another icon that can be used anywhere
30
- * the original icon can be used.
31
- *
32
- * @category Icon
33
- */
34
- export function createColoredIcon(icon, colors) {
35
- const colorStyles = getObjectTypedKeys(colors)
36
- .map((cssVarName) => {
37
- const colorValue = colors[cssVarName];
38
- const color = getAssertedValidColor(colorValue);
39
- return `${viraIconCssVars[cssVarName].name}: ${color.toString()};`;
40
- })
41
- .join(' ');
42
- return defineIcon({
43
- name: icon.name,
44
- svgTemplate: html `
45
- <div style=${colorStyles}>${icon.svgTemplate}</div>
46
- `,
47
- });
48
- }
@@ -1,8 +0,0 @@
1
- /**
2
- * A bell icon.
3
- *
4
- * @category Icon
5
- * @category SVG
6
- * @see https://electrovir.github.io/vira/book/icons/bell24icon
7
- */
8
- export declare const Bell24Icon: import("../icon-svg.js").ViraIconSvg;
@@ -1,8 +0,0 @@
1
- /**
2
- * A chat bubble icon.
3
- *
4
- * @category Icon
5
- * @category SVG
6
- * @see https://electrovir.github.io/vira/book/icons/chat24icon
7
- */
8
- export declare const Chat24Icon: import("../icon-svg.js").ViraIconSvg;
@@ -1,8 +0,0 @@
1
- /**
2
- * A checkmark.
3
- *
4
- * @category Icon
5
- * @category SVG
6
- * @see https://electrovir.github.io/vira/book/icons/check24icon
7
- */
8
- export declare const Check24Icon: import("../icon-svg.js").ViraIconSvg;
@@ -1,8 +0,0 @@
1
- /**
2
- * A chevron that points upwards. See ChevronUp24Icon or one pointing upwards.
3
- *
4
- * @category Icon
5
- * @category SVG
6
- * @see https://electrovir.github.io/vira/book/icons/chevrondown24icon
7
- */
8
- export declare const ChevronDown24Icon: import("../icon-svg.js").ViraIconSvg;
@@ -1,8 +0,0 @@
1
- /**
2
- * A chevron that points upwards. See ChevronDown24Icon for one pointing downloads.
3
- *
4
- * @category Icon
5
- * @category SVG
6
- * @see https://electrovir.github.io/vira/book/icons/chevronup24icon
7
- */
8
- export declare const ChevronUp24Icon: import("../icon-svg.js").ViraIconSvg;
@@ -1,8 +0,0 @@
1
- /**
2
- * An x icon meant to be used as a "close" button.
3
- *
4
- * @category Icon
5
- * @category SVG
6
- * @see https://electrovir.github.io/vira/book/icons/closex24icon
7
- */
8
- export declare const CloseX24Icon: import("../icon-svg.js").ViraIconSvg;
@@ -1,8 +0,0 @@
1
- /**
2
- * An icon that represents a single commit in git.
3
- *
4
- * @category Icon
5
- * @category SVG
6
- * @see https://electrovir.github.io/vira/book/icons/commit24icon
7
- */
8
- export declare const Commit24Icon: import("../icon-svg.js").ViraIconSvg;
@@ -1,8 +0,0 @@
1
- /**
2
- * An icon that represents copying something.
3
- *
4
- * @category Icon
5
- * @category SVG
6
- * @see https://electrovir.github.io/vira/book/icons/copy24icon
7
- */
8
- export declare const Copy24Icon: import("../icon-svg.js").ViraIconSvg;
@@ -1,8 +0,0 @@
1
- /**
2
- * An icon that represents a single document file on a computer file system.
3
- *
4
- * @category Icon
5
- * @category SVG
6
- * @see https://electrovir.github.io/vira/book/icons/document24icon
7
- */
8
- export declare const Document24Icon: import("../icon-svg.js").ViraIconSvg;
@@ -1,8 +0,0 @@
1
- /**
2
- * An icon that represents searching on a document or searching for a document.
3
- *
4
- * @category Icon
5
- * @category SVG
6
- * @see https://electrovir.github.io/vira/book/icons/documentsearch24icon
7
- */
8
- export declare const DocumentSearch24Icon: import("../icon-svg.js").ViraIconSvg;
@@ -1,8 +0,0 @@
1
- /**
2
- * A icon with two opposing chevrons.
3
- *
4
- * @category Icon
5
- * @category SVG
6
- * @see https://electrovir.github.io/vira/book/icons/doublechevron24icon
7
- */
8
- export declare const DoubleChevron24Icon: import("../icon-svg.js").ViraIconSvg;
@@ -1,8 +0,0 @@
1
- /**
2
- * An icon symbol that represents an HTML element.
3
- *
4
- * @category Icon
5
- * @category SVG
6
- * @see https://electrovir.github.io/vira/book/icons/element16icon
7
- */
8
- export declare const Element16Icon: import("../icon-svg.js").ViraIconSvg;
@@ -1,8 +0,0 @@
1
- /**
2
- * An icon symbol that represents an HTML element.
3
- *
4
- * @category Icon
5
- * @category SVG
6
- * @see https://electrovir.github.io/vira/book/icons/element24icon
7
- */
8
- export declare const Element24Icon: import("../icon-svg.js").ViraIconSvg;
@@ -1,8 +0,0 @@
1
- /**
2
- * An external link icon.
3
- *
4
- * @category Icon
5
- * @category SVG
6
- * @see https://electrovir.github.io/vira/book/icons/externallink24icon
7
- */
8
- export declare const ExternalLink24Icon: import("../icon-svg.js").ViraIconSvg;
@@ -1,8 +0,0 @@
1
- /**
2
- * A closed or disable eye icon.
3
- *
4
- * @category Icon
5
- * @category SVG
6
- * @see https://electrovir.github.io/vira/book/icons/eyeclosed24icon
7
- */
8
- export declare const EyeClosed24Icon: import("../icon-svg.js").ViraIconSvg;
@@ -1,8 +0,0 @@
1
- /**
2
- * An open eye icon.
3
- *
4
- * @category Icon
5
- * @category SVG
6
- * @see https://electrovir.github.io/vira/book/icons/eyeopen24icon
7
- */
8
- export declare const EyeOpen24Icon: import("../icon-svg.js").ViraIconSvg;
@@ -1,8 +0,0 @@
1
- /**
2
- * An icon symbol that represents filtering.
3
- *
4
- * @category Icon
5
- * @category SVG
6
- * @see https://electrovir.github.io/vira/book/icons/filter24icon
7
- */
8
- export declare const Filter24Icon: import("../icon-svg.js").ViraIconSvg;
@@ -1,8 +0,0 @@
1
- /**
2
- * A link icon.
3
- *
4
- * @category Icon
5
- * @category SVG
6
- * @see https://electrovir.github.io/vira/book/icons/link24icon
7
- */
8
- export declare const Link24Icon: import("../icon-svg.js").ViraIconSvg;
@@ -1,8 +0,0 @@
1
- /**
2
- * A static loading icon.
3
- *
4
- * @category Icon
5
- * @category SVG
6
- * @see https://electrovir.github.io/vira/book/icons/loader24icon
7
- */
8
- export declare const Loader24Icon: import("../icon-svg.js").ViraIconSvg;
@@ -1,8 +0,0 @@
1
- /**
2
- * A variation of {@link Loader24Icon} that spins on its own.
3
- *
4
- * @category Icon
5
- * @category SVG
6
- * @see https://electrovir.github.io/vira/book/icons/loaderanimated24icon
7
- */
8
- export declare const LoaderAnimated24Icon: import("../icon-svg.js").ViraIconSvg;
@@ -1,8 +0,0 @@
1
- /**
2
- * A lock icon.
3
- *
4
- * @category Icon
5
- * @category SVG
6
- * @see https://electrovir.github.io/vira/book/icons/lock24icon
7
- */
8
- export declare const Lock24Icon: import("../icon-svg.js").ViraIconSvg;
@@ -1,8 +0,0 @@
1
- /**
2
- * An icon that represents configuration options.
3
- *
4
- * @category Icon
5
- * @category SVG
6
- * @see https://electrovir.github.io/vira/book/icons/options24icon
7
- */
8
- export declare const Options24Icon: import("../icon-svg.js").ViraIconSvg;
@@ -1,8 +0,0 @@
1
- /**
2
- * A pencil icon.
3
- *
4
- * @category Icon
5
- * @category SVG
6
- * @see https://electrovir.github.io/vira/book/icons/pencil24icon
7
- */
8
- export declare const Pencil24Icon: import("../icon-svg.js").ViraIconSvg;
@@ -1,8 +0,0 @@
1
- /**
2
- * A shield icon.
3
- *
4
- * @category Icon
5
- * @category SVG
6
- * @see https://electrovir.github.io/vira/book/icons/shield24icon
7
- */
8
- export declare const Shield24Icon: import("../icon-svg.js").ViraIconSvg;
@@ -1,8 +0,0 @@
1
- /**
2
- * A icon indicating ascending sorting.
3
- *
4
- * @category Icon
5
- * @category SVG
6
- * @see https://electrovir.github.io/vira/book/icons/sortascending24icon
7
- */
8
- export declare const SortAscending24Icon: import("../icon-svg.js").ViraIconSvg;
@@ -1,8 +0,0 @@
1
- /**
2
- * A icon indicating descending sorting.
3
- *
4
- * @category Icon
5
- * @category SVG
6
- * @see https://electrovir.github.io/vira/book/icons/sortdescending24icon
7
- */
8
- export declare const SortDescending24Icon: import("../icon-svg.js").ViraIconSvg;
@@ -1,8 +0,0 @@
1
- /**
2
- * A speaker icon at maximum volume.
3
- *
4
- * @category Icon
5
- * @category SVG
6
- * @see https://electrovir.github.io/vira/book/icons/speakerloud24icon
7
- */
8
- export declare const SpeakerLoud24Icon: import("../icon-svg.js").ViraIconSvg;
@@ -1,8 +0,0 @@
1
- /**
2
- * A speaker icon at medium volume.
3
- *
4
- * @category Icon
5
- * @category SVG
6
- * @see https://electrovir.github.io/vira/book/icons/speakermedium24icon
7
- */
8
- export declare const SpeakerMedium24Icon: import("../icon-svg.js").ViraIconSvg;
@@ -1,8 +0,0 @@
1
- /**
2
- * A speaker icon that is muted.
3
- *
4
- * @category Icon
5
- * @category SVG
6
- * @see https://electrovir.github.io/vira/book/icons/speakermuted24icon
7
- */
8
- export declare const SpeakerMuted24Icon: import("../icon-svg.js").ViraIconSvg;
@@ -1,8 +0,0 @@
1
- /**
2
- * A speaker icon that is at minimum volume.
3
- *
4
- * @category Icon
5
- * @category SVG
6
- * @see https://electrovir.github.io/vira/book/icons/speakerquiet24icon
7
- */
8
- export declare const SpeakerQuiet24Icon: import("../icon-svg.js").ViraIconSvg;
@@ -1,8 +0,0 @@
1
- /**
2
- * A star icon.
3
- *
4
- * @category Icon
5
- * @category SVG
6
- * @see https://electrovir.github.io/vira/book/icons/star24icon
7
- */
8
- export declare const Star24Icon: import("../icon-svg.js").ViraIconSvg;
@@ -1,8 +0,0 @@
1
- /**
2
- * A status icon with an x that indicates something failed (like a build pipeline).
3
- *
4
- * @category Icon
5
- * @category SVG
6
- * @see https://electrovir.github.io/vira/book/icons/statusfailure24icon
7
- */
8
- export declare const StatusFailure24Icon: import("../icon-svg.js").ViraIconSvg;
@@ -1,8 +0,0 @@
1
- /**
2
- * A status icon that indicates that something is still in progress.
3
- *
4
- * @category Icon
5
- * @category SVG
6
- * @see https://electrovir.github.io/vira/book/icons/statusinprogress24icon
7
- */
8
- export declare const StatusInProgress24Icon: import("../icon-svg.js").ViraIconSvg;
@@ -1,8 +0,0 @@
1
- /**
2
- * A status icon that indicates success.
3
- *
4
- * @category Icon
5
- * @category SVG
6
- * @see https://electrovir.github.io/vira/book/icons/statussuccess24icon
7
- */
8
- export declare const StatusSuccess24Icon: import("../icon-svg.js").ViraIconSvg;
@@ -1,8 +0,0 @@
1
- /**
2
- * A status icon with a ? that indicates the status is unknown.
3
- *
4
- * @category Icon
5
- * @category SVG
6
- * @see https://electrovir.github.io/vira/book/icons/statusunknown24icon
7
- */
8
- export declare const StatusUnknown24Icon: import("../icon-svg.js").ViraIconSvg;
@@ -1,8 +0,0 @@
1
- /**
2
- * A status icon that indicates a warning.
3
- *
4
- * @category Icon
5
- * @category SVG
6
- * @see https://electrovir.github.io/vira/book/icons/statuswarning24icon
7
- */
8
- export declare const StatusWarning24Icon: import("../icon-svg.js").ViraIconSvg;
@@ -1,8 +0,0 @@
1
- /**
2
- * An upload icon.
3
- *
4
- * @category Icon
5
- * @category SVG
6
- * @see https://electrovir.github.io/vira/book/icons/upload24icon
7
- */
8
- export declare const Upload24Icon: import("../icon-svg.js").ViraIconSvg;