vira 2.2.1 → 2.3.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/index.d.ts +1 -1
- package/dist/elements/index.js +1 -1
- package/dist/elements/vira-button/vira-button.element.js +1 -1
- package/dist/icons/icon-svg.d.ts +2 -0
- package/dist/icons/icon-svg.js +19 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/re-exports/colorjs-io.d.ts +5 -0
- package/dist/re-exports/colorjs-io.js +2 -0
- package/dist/re-exports/index.d.ts +2 -0
- package/dist/re-exports/index.js +2 -0
- package/dist/styles/color.d.ts +4 -0
- package/dist/styles/color.js +26 -0
- package/dist/styles/index.d.ts +3 -0
- package/dist/styles/index.js +3 -0
- package/package.json +9 -9
package/dist/elements/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** This file is automatically updated by update-
|
|
1
|
+
/** This file is automatically updated by update-index-exports.ts */
|
|
2
2
|
export * from './define-vira-element';
|
|
3
3
|
export * from './vira-button/vira-button.element';
|
|
4
4
|
export * from './vira-collapsible/vira-collapsible-wrapper.element';
|
package/dist/elements/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** This file is automatically updated by update-
|
|
1
|
+
/** This file is automatically updated by update-index-exports.ts */
|
|
2
2
|
export * from './define-vira-element';
|
|
3
3
|
export * from './vira-button/vira-button.element';
|
|
4
4
|
export * from './vira-collapsible/vira-collapsible-wrapper.element';
|
package/dist/icons/icon-svg.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { TemplateResult } from 'element-vir';
|
|
2
|
+
import { viraIconCssVars } from './icon-css-vars';
|
|
2
3
|
export type ViraIconSvg = {
|
|
3
4
|
name: string;
|
|
4
5
|
svgTemplate: TemplateResult;
|
|
@@ -7,3 +8,4 @@ export declare function defineIcon({ name, svgTemplate, }: {
|
|
|
7
8
|
name: string;
|
|
8
9
|
svgTemplate: TemplateResult;
|
|
9
10
|
}): ViraIconSvg;
|
|
11
|
+
export declare function createColoredIcon(icon: ViraIconSvg, colors: Partial<Record<keyof typeof viraIconCssVars, string>>): ViraIconSvg;
|
package/dist/icons/icon-svg.js
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
import { getObjectTypedKeys } from '@augment-vir/common';
|
|
2
|
+
import { html } from 'element-vir';
|
|
3
|
+
import { getAssertedValidColor } from '../styles/color';
|
|
4
|
+
import { viraIconCssVars } from './icon-css-vars';
|
|
1
5
|
export function defineIcon({ name, svgTemplate, }) {
|
|
2
6
|
const iconSvg = {
|
|
3
7
|
name,
|
|
@@ -5,3 +9,18 @@ export function defineIcon({ name, svgTemplate, }) {
|
|
|
5
9
|
};
|
|
6
10
|
return iconSvg;
|
|
7
11
|
}
|
|
12
|
+
export function createColoredIcon(icon, colors) {
|
|
13
|
+
const colorStyles = getObjectTypedKeys(colors)
|
|
14
|
+
.map((cssVarName) => {
|
|
15
|
+
const colorValue = colors[cssVarName];
|
|
16
|
+
const color = getAssertedValidColor(colorValue);
|
|
17
|
+
return `${viraIconCssVars[cssVarName].name}: ${color.toString()};`;
|
|
18
|
+
})
|
|
19
|
+
.join(' ');
|
|
20
|
+
return defineIcon({
|
|
21
|
+
name: icon.name,
|
|
22
|
+
svgTemplate: html `
|
|
23
|
+
<div style=${colorStyles}>${icon.svgTemplate}</div>
|
|
24
|
+
`,
|
|
25
|
+
});
|
|
26
|
+
}
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { Format } from 'colorjs.io/types/src/space';
|
|
2
|
+
import { ColorTypes } from '../re-exports/colorjs-io';
|
|
3
|
+
export declare function getAssertedValidColor(input: ColorTypes | undefined): import("colorjs.io/types/src/color").default;
|
|
4
|
+
export declare const rgbCssColorFormat: Format;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { wrapInTry } from '@augment-vir/common';
|
|
2
|
+
import { Color } from '../re-exports/colorjs-io';
|
|
3
|
+
export function getAssertedValidColor(input) {
|
|
4
|
+
try {
|
|
5
|
+
if (!input) {
|
|
6
|
+
throw new Error('invalid empty color');
|
|
7
|
+
}
|
|
8
|
+
return new Color(input);
|
|
9
|
+
}
|
|
10
|
+
catch (caught) {
|
|
11
|
+
const stringInput = String(input);
|
|
12
|
+
const inputForMessage = stringInput.toLowerCase().match(/\[\s*object\s+object\s*\]/)
|
|
13
|
+
? wrapInTry({ callback: () => JSON.stringify(input), fallbackValue: stringInput })
|
|
14
|
+
: stringInput;
|
|
15
|
+
throw new Error(`Invalid color: ${inputForMessage}`);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
export const rgbCssColorFormat = {
|
|
19
|
+
name: 'rgb',
|
|
20
|
+
coords: [
|
|
21
|
+
'<number>[0, 255]',
|
|
22
|
+
'<number>[0, 255]',
|
|
23
|
+
'<number>[0, 255]',
|
|
24
|
+
],
|
|
25
|
+
commas: true,
|
|
26
|
+
};
|
package/dist/styles/index.d.ts
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
|
+
/** This file is automatically updated by update-index-exports.ts */
|
|
2
|
+
export * from './color';
|
|
1
3
|
export * from './disabled';
|
|
2
4
|
export * from './durations';
|
|
3
5
|
export * from './focus';
|
|
4
6
|
export * from './native-styles';
|
|
5
7
|
export * from './scrollbar';
|
|
6
8
|
export * from './user-select';
|
|
9
|
+
export * from './vira-css-vars';
|
package/dist/styles/index.js
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
|
+
/** This file is automatically updated by update-index-exports.ts */
|
|
2
|
+
export * from './color';
|
|
1
3
|
export * from './disabled';
|
|
2
4
|
export * from './durations';
|
|
3
5
|
export * from './focus';
|
|
4
6
|
export * from './native-styles';
|
|
5
7
|
export * from './scrollbar';
|
|
6
8
|
export * from './user-select';
|
|
9
|
+
export * from './vira-css-vars';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vira",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.3.0",
|
|
4
4
|
"description": "A simple and highly versatile design system using element-vir.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"design",
|
|
@@ -40,17 +40,17 @@
|
|
|
40
40
|
"test:docs": "virmator code-in-markdown check"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@augment-vir/common": "^
|
|
44
|
-
"element-vir": "^16.3.
|
|
45
|
-
"lit-css-vars": "^3.0.
|
|
46
|
-
"spa-router-vir": "^
|
|
43
|
+
"@augment-vir/common": "^18.1.0",
|
|
44
|
+
"element-vir": "^16.3.2",
|
|
45
|
+
"lit-css-vars": "^3.0.1",
|
|
46
|
+
"spa-router-vir": "^3.0.2",
|
|
47
47
|
"type-fest": "^4.3.1"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
|
-
"@augment-vir/browser-testing": "^
|
|
51
|
-
"@augment-vir/node-js": "^
|
|
50
|
+
"@augment-vir/browser-testing": "^18.1.0",
|
|
51
|
+
"@augment-vir/node-js": "^18.1.0",
|
|
52
52
|
"@open-wc/testing": "^3.2.0",
|
|
53
|
-
"@types/chai": "^4.3.
|
|
53
|
+
"@types/chai": "^4.3.6",
|
|
54
54
|
"@types/mocha": "^10.0.1",
|
|
55
55
|
"@web/dev-server-esbuild": "^0.4.1",
|
|
56
56
|
"@web/test-runner": "^0.17.1",
|
|
@@ -61,6 +61,6 @@
|
|
|
61
61
|
"istanbul-smart-text-reporter": "^1.1.2",
|
|
62
62
|
"typescript": "^5.2.2",
|
|
63
63
|
"vite": "^4.4.9",
|
|
64
|
-
"vite-tsconfig-paths": "^4.2.
|
|
64
|
+
"vite-tsconfig-paths": "^4.2.1"
|
|
65
65
|
}
|
|
66
66
|
}
|