vira 29.5.2 → 29.5.4
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.
|
@@ -13,4 +13,4 @@ export declare const ViraCollapsibleWrapper: import("element-vir").DeclarativeEl
|
|
|
13
13
|
contentHeight: number;
|
|
14
14
|
}, {
|
|
15
15
|
expandChange: import("element-vir").DefineEvent<boolean>;
|
|
16
|
-
}, "vira-collapsible-wrapper-
|
|
16
|
+
}, "vira-collapsible-wrapper-expand-on-print", "vira-collapsible-wrapper-", readonly ["header"], readonly []>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { css, defineElementEvent, html, listen, onResize } from 'element-vir';
|
|
1
|
+
import { classMap, css, defineElementEvent, html, listen, onResize } from 'element-vir';
|
|
2
2
|
import { noNativeFormStyles, noUserSelect, viraAnimationDurations } from '../styles/index.js';
|
|
3
3
|
import { defineViraElement } from './define-vira-element.js';
|
|
4
4
|
/**
|
|
@@ -16,7 +16,6 @@ export const ViraCollapsibleWrapper = defineViraElement()({
|
|
|
16
16
|
};
|
|
17
17
|
},
|
|
18
18
|
hostClasses: {
|
|
19
|
-
'vira-collapsible-wrapper-expanded': ({ inputs }) => inputs.expanded,
|
|
20
19
|
'vira-collapsible-wrapper-expand-on-print': ({ inputs }) => !!inputs.expandOnPrint,
|
|
21
20
|
},
|
|
22
21
|
slotNames: ['header'],
|
|
@@ -41,12 +40,10 @@ export const ViraCollapsibleWrapper = defineViraElement()({
|
|
|
41
40
|
.collapsing-element {
|
|
42
41
|
transition: height ${viraAnimationDurations['vira-pretty-animation-duration'].value};
|
|
43
42
|
overflow: hidden;
|
|
44
|
-
${noUserSelect}
|
|
45
|
-
}
|
|
46
43
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
44
|
+
&.collapsed {
|
|
45
|
+
${noUserSelect}
|
|
46
|
+
}
|
|
50
47
|
}
|
|
51
48
|
|
|
52
49
|
@media print {
|
|
@@ -79,7 +76,13 @@ export const ViraCollapsibleWrapper = defineViraElement()({
|
|
|
79
76
|
<slot name=${slotNames.header}>Header</slot>
|
|
80
77
|
</button>
|
|
81
78
|
|
|
82
|
-
<div
|
|
79
|
+
<div
|
|
80
|
+
class="collapsing-element ${classMap({
|
|
81
|
+
collapsed: !inputs.expanded,
|
|
82
|
+
})}"
|
|
83
|
+
style=${collapsingStyles}
|
|
84
|
+
disabled="disabled"
|
|
85
|
+
>
|
|
83
86
|
<div
|
|
84
87
|
${onResize(({ contentRect }) => {
|
|
85
88
|
updateState({ contentHeight: contentRect.height });
|
package/dist/icons/icon-svg.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type PartialWithUndefined } from '@augment-vir/common';
|
|
2
|
+
import { type CSSResult, type TemplateResult } from 'element-vir';
|
|
2
3
|
import { viraIconCssVars } from './icon-css-vars.js';
|
|
3
4
|
/**
|
|
4
5
|
* An individual Vira icon SVG definition.
|
|
@@ -24,4 +25,4 @@ export declare function defineIcon({ name, svgTemplate, }: {
|
|
|
24
25
|
*
|
|
25
26
|
* @category Icon
|
|
26
27
|
*/
|
|
27
|
-
export declare function createColoredIcon(icon: ViraIconSvg, colors:
|
|
28
|
+
export declare function createColoredIcon(icon: ViraIconSvg, colors: PartialWithUndefined<Record<keyof typeof viraIconCssVars, string | CSSResult>>): ViraIconSvg;
|
package/dist/icons/icon-svg.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
1
|
+
import { check } from '@augment-vir/assert';
|
|
2
|
+
import { getObjectTypedKeys } from '@augment-vir/common';
|
|
3
3
|
import { html } from 'element-vir';
|
|
4
4
|
import { viraIconCssVars } from './icon-css-vars.js';
|
|
5
5
|
/**
|
|
@@ -14,17 +14,6 @@ export function defineIcon({ name, svgTemplate, }) {
|
|
|
14
14
|
};
|
|
15
15
|
return iconSvg;
|
|
16
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
17
|
/**
|
|
29
18
|
* Wraps an existing icon with a specific color and outputs another icon that can be used anywhere
|
|
30
19
|
* the original icon can be used.
|
|
@@ -34,10 +23,14 @@ function getAssertedValidColor(input) {
|
|
|
34
23
|
export function createColoredIcon(icon, colors) {
|
|
35
24
|
const colorStyles = getObjectTypedKeys(colors)
|
|
36
25
|
.map((cssVarName) => {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
26
|
+
if (colors[cssVarName]) {
|
|
27
|
+
return `${viraIconCssVars[cssVarName].name}: ${String(colors[cssVarName])};`;
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
return undefined;
|
|
31
|
+
}
|
|
40
32
|
})
|
|
33
|
+
.filter(check.isTruthy)
|
|
41
34
|
.join(' ');
|
|
42
35
|
return defineIcon({
|
|
43
36
|
name: icon.name,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vira",
|
|
3
|
-
"version": "29.5.
|
|
3
|
+
"version": "29.5.4",
|
|
4
4
|
"description": "A simple and highly versatile design system using element-vir.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"design",
|
|
@@ -41,7 +41,6 @@
|
|
|
41
41
|
"@augment-vir/assert": "^31.59.3",
|
|
42
42
|
"@augment-vir/common": "^31.59.3",
|
|
43
43
|
"@augment-vir/web": "^31.59.3",
|
|
44
|
-
"colorjs.io": "^0.6.1",
|
|
45
44
|
"date-vir": "^8.1.1",
|
|
46
45
|
"device-navigation": "^4.5.5",
|
|
47
46
|
"lit-css-vars": "^3.5.0",
|