vira 29.5.4 → 29.5.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,11 @@
1
+ import { type PartialWithUndefined } from '@augment-vir/common';
2
+ import { type CSSResult } from 'element-vir';
3
+ import { viraIconCssVars } from './icon-css-vars.js';
4
+ import { type ViraIconSvg } from './icon-svg.js';
5
+ /**
6
+ * Wraps an existing icon with a specific color and outputs another icon that can be used anywhere
7
+ * the original icon can be used.
8
+ *
9
+ * @category Icon
10
+ */
11
+ export declare function createColoredIcon(icon: ViraIconSvg, colors: PartialWithUndefined<Record<keyof typeof viraIconCssVars, string | CSSResult>>): ViraIconSvg;
@@ -0,0 +1,34 @@
1
+ import { check } from '@augment-vir/assert';
2
+ import { getObjectTypedKeys } from '@augment-vir/common';
3
+ import { css, html, unsafeCSS } from 'element-vir';
4
+ import { viraIconCssVars } from './icon-css-vars.js';
5
+ import { defineIcon } from './icon-svg.js';
6
+ /**
7
+ * Wraps an existing icon with a specific color and outputs another icon that can be used anywhere
8
+ * the original icon can be used.
9
+ *
10
+ * @category Icon
11
+ */
12
+ export function createColoredIcon(icon, colors) {
13
+ const colorStyles = getObjectTypedKeys(colors)
14
+ .map((cssVarName) => {
15
+ if (colors[cssVarName]) {
16
+ return `${viraIconCssVars[cssVarName].name}: ${String(colors[cssVarName])};`;
17
+ }
18
+ else {
19
+ return undefined;
20
+ }
21
+ })
22
+ .filter(check.isTruthy)
23
+ .join(' ');
24
+ const styles = css `
25
+ ${unsafeCSS(colorStyles)}
26
+ display: inline-flex;
27
+ `;
28
+ return defineIcon({
29
+ name: icon.name,
30
+ svgTemplate: html `
31
+ <div style=${styles}>${icon.svgTemplate}</div>
32
+ `,
33
+ });
34
+ }
@@ -1,6 +1,4 @@
1
- import { type PartialWithUndefined } from '@augment-vir/common';
2
- import { type CSSResult, type TemplateResult } from 'element-vir';
3
- import { viraIconCssVars } from './icon-css-vars.js';
1
+ import { type TemplateResult } from 'element-vir';
4
2
  /**
5
3
  * An individual Vira icon SVG definition.
6
4
  *
@@ -19,10 +17,3 @@ export declare function defineIcon({ name, svgTemplate, }: {
19
17
  name: string;
20
18
  svgTemplate: TemplateResult;
21
19
  }): ViraIconSvg;
22
- /**
23
- * Wraps an existing icon with a specific color and outputs another icon that can be used anywhere
24
- * the original icon can be used.
25
- *
26
- * @category Icon
27
- */
28
- export declare function createColoredIcon(icon: ViraIconSvg, colors: PartialWithUndefined<Record<keyof typeof viraIconCssVars, string | CSSResult>>): ViraIconSvg;
@@ -1,7 +1,3 @@
1
- import { check } from '@augment-vir/assert';
2
- import { getObjectTypedKeys } from '@augment-vir/common';
3
- import { html } from 'element-vir';
4
- import { viraIconCssVars } from './icon-css-vars.js';
5
1
  /**
6
2
  * A function used to define an individual Vira icon SVG.
7
3
  *
@@ -14,28 +10,3 @@ export function defineIcon({ name, svgTemplate, }) {
14
10
  };
15
11
  return iconSvg;
16
12
  }
17
- /**
18
- * Wraps an existing icon with a specific color and outputs another icon that can be used anywhere
19
- * the original icon can be used.
20
- *
21
- * @category Icon
22
- */
23
- export function createColoredIcon(icon, colors) {
24
- const colorStyles = getObjectTypedKeys(colors)
25
- .map((cssVarName) => {
26
- if (colors[cssVarName]) {
27
- return `${viraIconCssVars[cssVarName].name}: ${String(colors[cssVarName])};`;
28
- }
29
- else {
30
- return undefined;
31
- }
32
- })
33
- .filter(check.isTruthy)
34
- .join(' ');
35
- return defineIcon({
36
- name: icon.name,
37
- svgTemplate: html `
38
- <div style=${colorStyles}>${icon.svgTemplate}</div>
39
- `,
40
- });
41
- }
@@ -1,4 +1,5 @@
1
1
  /** This file is automatically updated by update-icon-exports.ts */
2
+ export * from './colored-icon.js';
2
3
  export * from './icon-css-vars.js';
3
4
  export * from './icon-svg.js';
4
5
  export * from './icon-svgs/arrow-up-24.icon.js';
@@ -45,6 +45,7 @@ import { StatusWarning24Icon } from './icon-svgs/status-warning-24.icon.js';
45
45
  import { Sun24Icon } from './icon-svgs/sun-24.icon.js';
46
46
  import { Upload24Icon } from './icon-svgs/upload-24.icon.js';
47
47
  import { X24Icon } from './icon-svgs/x-24.icon.js';
48
+ export * from './colored-icon.js';
48
49
  export * from './icon-css-vars.js';
49
50
  export * from './icon-svg.js';
50
51
  export * from './icon-svgs/arrow-up-24.icon.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vira",
3
- "version": "29.5.4",
3
+ "version": "29.5.5",
4
4
  "description": "A simple and highly versatile design system using element-vir.",
5
5
  "keywords": [
6
6
  "design",