vira 23.4.1 → 24.0.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/define-vira-element.d.ts +2 -2
- package/dist/elements/dropdown/vira-dropdown.element.js +9 -7
- package/dist/elements/vira-bold-text.element.js +14 -3
- package/dist/elements/vira-collapsible-wrapper.element.js +5 -3
- package/dist/elements/vira-image.element.js +14 -12
- package/dist/elements/vira-input.element.js +6 -4
- package/dist/elements/vira-link.element.d.ts +2 -2
- package/dist/elements/vira-link.element.js +7 -3
- package/package.json +14 -14
|
@@ -15,10 +15,10 @@ export type ViraTagName = `${typeof ViraTagNamePrefix}${string}`;
|
|
|
15
15
|
*
|
|
16
16
|
* @category Internal
|
|
17
17
|
*/
|
|
18
|
-
export declare const defineViraElement: <Inputs extends {}>() => <const TagName extends `vira-${string}`,
|
|
18
|
+
export declare const defineViraElement: <Inputs extends {}>(...errorParams: import("element-vir").DeclarativeElementInputErrorParams<Inputs>) => <const TagName extends `vira-${string}`, State extends {}, EventsInit extends {}, const HostClassKeys extends `${TagName}-${string}` = `${TagName}-`, const CssVarKeys extends `${TagName}-${string}` = `${TagName}-`, const SlotNames extends ReadonlyArray<string> = readonly []>(inputs: import("element-vir").DeclarativeElementInit<TagName, Inputs, State, EventsInit, HostClassKeys, CssVarKeys, SlotNames>) => import("element-vir").DeclarativeElementDefinition<TagName, Inputs, State, EventsInit, HostClassKeys, CssVarKeys, SlotNames>;
|
|
19
19
|
/**
|
|
20
20
|
* Define a vira element with custom requirements (like the `vira-` element tag prefix).
|
|
21
21
|
*
|
|
22
22
|
* @category Internal
|
|
23
23
|
*/
|
|
24
|
-
export declare const defineViraElementNoInputs: <const TagName extends `vira-${string}`, Inputs extends {},
|
|
24
|
+
export declare const defineViraElementNoInputs: <const TagName extends `vira-${string}`, Inputs extends {}, State extends {}, EventsInit extends {}, const HostClassKeys extends `${TagName}-${string}` = `${TagName}-`, const CssVarKeys extends `${TagName}-${string}` = `${TagName}-`, const SlotNames extends ReadonlyArray<string> = readonly []>(inputs: import("element-vir").DeclarativeElementInit<TagName, Inputs, State, EventsInit, HostClassKeys, CssVarKeys, SlotNames>) => import("element-vir").DeclarativeElementDefinition<TagName, Inputs, State, EventsInit, HostClassKeys, CssVarKeys, SlotNames>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { assert } from '@augment-vir/assert';
|
|
2
2
|
import { NavController } from 'device-navigation';
|
|
3
|
-
import { classMap, css, defineElementEvent, html, ifDefined, listen,
|
|
3
|
+
import { classMap, css, defineElementEvent, html, ifDefined, listen, renderIf, testId, } from 'element-vir';
|
|
4
4
|
import { ChevronUp24Icon } from '../../icons/index.js';
|
|
5
5
|
import { viraBorders } from '../../styles/border.js';
|
|
6
6
|
import { createFocusStyles, viraFocusCssVars } from '../../styles/focus.js';
|
|
@@ -32,6 +32,14 @@ export const viraDropdownTestIds = {
|
|
|
32
32
|
*/
|
|
33
33
|
export const ViraDropdown = defineViraElement()({
|
|
34
34
|
tagName: 'vira-dropdown',
|
|
35
|
+
state() {
|
|
36
|
+
return {
|
|
37
|
+
/** `undefined` means the pop up is not currently showing. */
|
|
38
|
+
showPopUpResult: undefined,
|
|
39
|
+
popUpManager: new PopUpManager(),
|
|
40
|
+
navController: undefined,
|
|
41
|
+
};
|
|
42
|
+
},
|
|
35
43
|
hostClasses: {
|
|
36
44
|
'vira-dropdown-disabled': ({ inputs }) => !!inputs.isDisabled,
|
|
37
45
|
},
|
|
@@ -155,12 +163,6 @@ export const ViraDropdown = defineViraElement()({
|
|
|
155
163
|
selectedChange: defineElementEvent(),
|
|
156
164
|
openChange: defineElementEvent(),
|
|
157
165
|
},
|
|
158
|
-
stateInitStatic: {
|
|
159
|
-
/** `undefined` means the pop up is not currently showing. */
|
|
160
|
-
showPopUpResult: undefined,
|
|
161
|
-
popUpManager: perInstance(() => new PopUpManager()),
|
|
162
|
-
navController: undefined,
|
|
163
|
-
},
|
|
164
166
|
cleanup({ state, updateState }) {
|
|
165
167
|
updateState({ showPopUpResult: undefined });
|
|
166
168
|
state.popUpManager.destroy();
|
|
@@ -9,10 +9,19 @@ export const ViraBoldText = defineElement()({
|
|
|
9
9
|
'vira-bold-bold': ({ inputs }) => inputs.bold,
|
|
10
10
|
},
|
|
11
11
|
styles: ({ hostClasses, cssVars }) => css `
|
|
12
|
+
span {
|
|
13
|
+
text-decoration: inherit;
|
|
14
|
+
white-space: inherit;
|
|
15
|
+
}
|
|
16
|
+
|
|
12
17
|
.bold-wrapper {
|
|
13
18
|
position: relative;
|
|
14
19
|
}
|
|
15
20
|
|
|
21
|
+
.everything-wrapper {
|
|
22
|
+
width: 100%;
|
|
23
|
+
}
|
|
24
|
+
|
|
16
25
|
.bold {
|
|
17
26
|
font-weight: ${cssVars['vira-bold-bold-weight'].value};
|
|
18
27
|
visibility: hidden;
|
|
@@ -39,10 +48,12 @@ export const ViraBoldText = defineElement()({
|
|
|
39
48
|
`,
|
|
40
49
|
render({ inputs }) {
|
|
41
50
|
return html `
|
|
42
|
-
<span class="
|
|
43
|
-
<span class="bold"
|
|
51
|
+
<span class="everything-wrapper">
|
|
52
|
+
<span class="bold-wrapper">
|
|
53
|
+
<span class="bold">${inputs.text}</span>
|
|
44
54
|
|
|
45
|
-
|
|
55
|
+
<span class="normal">${inputs.text}</span>
|
|
56
|
+
</span>
|
|
46
57
|
</span>
|
|
47
58
|
`;
|
|
48
59
|
},
|
|
@@ -10,6 +10,11 @@ import { defineViraElement } from './define-vira-element.js';
|
|
|
10
10
|
*/
|
|
11
11
|
export const ViraCollapsibleWrapper = defineViraElement()({
|
|
12
12
|
tagName: 'vira-collapsible-wrapper',
|
|
13
|
+
state() {
|
|
14
|
+
return {
|
|
15
|
+
contentHeight: 0,
|
|
16
|
+
};
|
|
17
|
+
},
|
|
13
18
|
hostClasses: {
|
|
14
19
|
'vira-collapsible-wrapper-expanded': ({ inputs }) => inputs.expanded,
|
|
15
20
|
},
|
|
@@ -43,9 +48,6 @@ export const ViraCollapsibleWrapper = defineViraElement()({
|
|
|
43
48
|
events: {
|
|
44
49
|
expandChange: defineElementEvent(),
|
|
45
50
|
},
|
|
46
|
-
stateInitStatic: {
|
|
47
|
-
contentHeight: 0,
|
|
48
|
-
},
|
|
49
51
|
render({ state, slotNames, updateState, dispatch, events, inputs }) {
|
|
50
52
|
const collapsingStyles = inputs.expanded
|
|
51
53
|
? css `
|
|
@@ -16,6 +16,20 @@ import { ViraIcon } from './vira-icon.element.js';
|
|
|
16
16
|
*/
|
|
17
17
|
export const ViraImage = defineViraElement()({
|
|
18
18
|
tagName: 'vira-image',
|
|
19
|
+
state() {
|
|
20
|
+
return {
|
|
21
|
+
/**
|
|
22
|
+
* To avoid race conditions between `<img>` element events and potential input changing,
|
|
23
|
+
* save the loaded state of an URL's image by the image's URL.
|
|
24
|
+
*/
|
|
25
|
+
loadedUrls: {},
|
|
26
|
+
/**
|
|
27
|
+
* To avoid race conditions between `<img>` element events and potential input changing,
|
|
28
|
+
* save the errored state of an URL's image by the image's URL.
|
|
29
|
+
*/
|
|
30
|
+
erroredUrls: {},
|
|
31
|
+
};
|
|
32
|
+
},
|
|
19
33
|
hostClasses: {
|
|
20
34
|
'vira-image-height-constrained': ({ inputs }) => inputs.dominantDimension === 'height',
|
|
21
35
|
},
|
|
@@ -74,18 +88,6 @@ export const ViraImage = defineViraElement()({
|
|
|
74
88
|
display: none;
|
|
75
89
|
}
|
|
76
90
|
`,
|
|
77
|
-
stateInitStatic: {
|
|
78
|
-
/**
|
|
79
|
-
* To avoid race conditions between `<img>` element events and potential input changing,
|
|
80
|
-
* save the loaded state of an URL's image by the image's URL.
|
|
81
|
-
*/
|
|
82
|
-
loadedUrls: {},
|
|
83
|
-
/**
|
|
84
|
-
* To avoid race conditions between `<img>` element events and potential input changing,
|
|
85
|
-
* save the errored state of an URL's image by the image's URL.
|
|
86
|
-
*/
|
|
87
|
-
erroredUrls: {},
|
|
88
|
-
},
|
|
89
91
|
render({ inputs, state, updateState, dispatch, events, slotNames }) {
|
|
90
92
|
/**
|
|
91
93
|
* Saved off for use in the image listeners. This is used to eliminate race conditions
|
|
@@ -29,6 +29,12 @@ export var ViraInputType;
|
|
|
29
29
|
*/
|
|
30
30
|
export const ViraInput = defineViraElement()({
|
|
31
31
|
tagName: 'vira-input',
|
|
32
|
+
state() {
|
|
33
|
+
return {
|
|
34
|
+
forcedInputWidth: 0,
|
|
35
|
+
showPassword: false,
|
|
36
|
+
};
|
|
37
|
+
},
|
|
32
38
|
hostClasses: {
|
|
33
39
|
'vira-input-disabled': ({ inputs }) => !!inputs.disabled,
|
|
34
40
|
'vira-input-fit-text': ({ inputs }) => !!inputs.fitText,
|
|
@@ -247,10 +253,6 @@ export const ViraInput = defineViraElement()({
|
|
|
247
253
|
}
|
|
248
254
|
`;
|
|
249
255
|
},
|
|
250
|
-
stateInitStatic: {
|
|
251
|
-
forcedInputWidth: 0,
|
|
252
|
-
showPassword: false,
|
|
253
|
-
},
|
|
254
256
|
render: ({ inputs, dispatch, state, updateState, events }) => {
|
|
255
257
|
const { filtered: filteredValue } = filterTextInputValue({
|
|
256
258
|
value: inputs.value,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { SpaRoute, SpaRouter } from 'spa-router-vir';
|
|
2
2
|
import { RequireExactlyOne } from 'type-fest';
|
|
3
3
|
/**
|
|
4
4
|
* A hyperlink wrapper element that can be configured to emit route change events rather than just
|
|
@@ -22,7 +22,7 @@ export declare const ViraLink: import("element-vir").DeclarativeElementDefinitio
|
|
|
22
22
|
* is provided for the inputs, don't provide a link property.
|
|
23
23
|
*/
|
|
24
24
|
route: {
|
|
25
|
-
route:
|
|
25
|
+
route: SpaRoute<any, any, any>;
|
|
26
26
|
router: Pick<SpaRouter<any, any, any>, "createRouteUrl" | "setRouteOnDirectNavigation">;
|
|
27
27
|
scrollToTop?: boolean;
|
|
28
28
|
};
|
|
@@ -41,9 +41,13 @@ export const ViraLink = defineViraElement()({
|
|
|
41
41
|
if (!inputs.route) {
|
|
42
42
|
return;
|
|
43
43
|
}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
window.scrollTo(
|
|
44
|
+
const routed = inputs.route.router.setRouteOnDirectNavigation(inputs.route.route, event);
|
|
45
|
+
if (inputs.route.scrollToTop) {
|
|
46
|
+
window.scrollTo({
|
|
47
|
+
left: 0,
|
|
48
|
+
top: 0,
|
|
49
|
+
behavior: routed ? 'instant' : 'smooth',
|
|
50
|
+
});
|
|
47
51
|
}
|
|
48
52
|
}
|
|
49
53
|
if (inputs.link?.newTab) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vira",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "24.0.0",
|
|
4
4
|
"description": "A simple and highly versatile design system using element-vir.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"design",
|
|
@@ -37,36 +37,36 @@
|
|
|
37
37
|
"test:docs": "virmator docs check"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@augment-vir/assert": "^31.
|
|
41
|
-
"@augment-vir/common": "^31.
|
|
42
|
-
"@augment-vir/web": "^31.
|
|
40
|
+
"@augment-vir/assert": "^31.10.0",
|
|
41
|
+
"@augment-vir/common": "^31.10.0",
|
|
42
|
+
"@augment-vir/web": "^31.10.0",
|
|
43
43
|
"colorjs.io": "^0.5.2",
|
|
44
|
-
"date-vir": "^7.
|
|
45
|
-
"device-navigation": "^3.0
|
|
44
|
+
"date-vir": "^7.3.1",
|
|
45
|
+
"device-navigation": "^3.1.0",
|
|
46
46
|
"lit-css-vars": "^3.0.11",
|
|
47
47
|
"observavir": "^2.0.5",
|
|
48
48
|
"page-active": "^1.0.1",
|
|
49
|
-
"spa-router-vir": "^
|
|
50
|
-
"type-fest": "^4.
|
|
51
|
-
"typed-event-target": "^4.0.
|
|
49
|
+
"spa-router-vir": "^5.3.1",
|
|
50
|
+
"type-fest": "^4.37.0",
|
|
51
|
+
"typed-event-target": "^4.0.3"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
|
-
"@augment-vir/test": "^31.
|
|
54
|
+
"@augment-vir/test": "^31.10.0",
|
|
55
55
|
"@web/dev-server-esbuild": "^1.0.4",
|
|
56
56
|
"@web/test-runner": "^0.20.0",
|
|
57
57
|
"@web/test-runner-commands": "^0.9.0",
|
|
58
58
|
"@web/test-runner-playwright": "^0.11.0",
|
|
59
59
|
"@web/test-runner-visual-regression": "^0.10.0",
|
|
60
|
-
"esbuild": "^0.25.
|
|
60
|
+
"esbuild": "^0.25.1",
|
|
61
61
|
"istanbul-smart-text-reporter": "^1.1.5",
|
|
62
62
|
"markdown-code-example-inserter": "^3.0.3",
|
|
63
63
|
"typedoc": "^0.27.9",
|
|
64
|
-
"typescript": "5.
|
|
65
|
-
"vite": "^6.2.
|
|
64
|
+
"typescript": "5.8.2",
|
|
65
|
+
"vite": "^6.2.1",
|
|
66
66
|
"vite-tsconfig-paths": "^5.1.4"
|
|
67
67
|
},
|
|
68
68
|
"peerDependencies": {
|
|
69
|
-
"element-vir": "^
|
|
69
|
+
"element-vir": "^24.0.0"
|
|
70
70
|
},
|
|
71
71
|
"engines": {
|
|
72
72
|
"node": ">=22"
|