vira 25.15.0 → 26.0.1
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.
|
@@ -5,16 +5,15 @@ import { wrapDefineElement } from 'element-vir';
|
|
|
5
5
|
* @category Internal
|
|
6
6
|
*/
|
|
7
7
|
export const ViraTagNamePrefix = `vira-`;
|
|
8
|
-
|
|
8
|
+
/**
|
|
9
|
+
* Define a vira element with custom requirements (like the `vira-` element tag prefix).
|
|
10
|
+
*
|
|
11
|
+
* @category Internal
|
|
12
|
+
*/
|
|
13
|
+
export const defineViraElement = wrapDefineElement({
|
|
9
14
|
assertInputs: (inputs) => {
|
|
10
15
|
if (!inputs.tagName.startsWith(ViraTagNamePrefix)) {
|
|
11
16
|
throw new Error(`Tag name should start with '${ViraTagNamePrefix}' but got '${inputs.tagName}'`);
|
|
12
17
|
}
|
|
13
18
|
},
|
|
14
19
|
});
|
|
15
|
-
/**
|
|
16
|
-
* Define a vira element with custom requirements (like the `vira-` element tag prefix).
|
|
17
|
-
*
|
|
18
|
-
* @category Internal
|
|
19
|
-
*/
|
|
20
|
-
export const defineViraElement = defineElement;
|
|
@@ -16,9 +16,8 @@ export declare enum ViraButtonStyle {
|
|
|
16
16
|
* @category Elements
|
|
17
17
|
* @see https://electrovir.github.io/element-vir/vira/book/elements/vira-button
|
|
18
18
|
*/
|
|
19
|
-
export declare const ViraButton: import("element-vir").DeclarativeElementDefinition<"vira-button", {
|
|
19
|
+
export declare const ViraButton: import("element-vir").DeclarativeElementDefinition<"vira-button", PartialWithUndefined<{
|
|
20
20
|
text: string;
|
|
21
|
-
} & PartialWithUndefined<{
|
|
22
21
|
icon: Pick<ViraIconSvg, "svgTemplate">;
|
|
23
22
|
disabled: boolean;
|
|
24
23
|
buttonStyle: ViraButtonStyle;
|
|
@@ -99,6 +99,10 @@ export const ViraButton = defineViraElement()({
|
|
|
99
99
|
border-color ${viraAnimationDurations['vira-interaction-animation-duration'].value};
|
|
100
100
|
}
|
|
101
101
|
|
|
102
|
+
.empty-text {
|
|
103
|
+
width: 0;
|
|
104
|
+
}
|
|
105
|
+
|
|
102
106
|
${createFocusStyles({
|
|
103
107
|
selector: 'button:focus:focus-visible:not(:active):not([disabled])',
|
|
104
108
|
elementBorderSize: 2,
|
|
@@ -128,7 +132,9 @@ export const ViraButton = defineViraElement()({
|
|
|
128
132
|
? html `
|
|
129
133
|
<span class="text-template">${inputs.text}</span>
|
|
130
134
|
`
|
|
131
|
-
:
|
|
135
|
+
: html `
|
|
136
|
+
<span class="empty-text"> </span>
|
|
137
|
+
`;
|
|
132
138
|
return html `
|
|
133
139
|
<button ?disabled=${inputs.disabled}>${iconTemplate} ${textTemplate}</button>
|
|
134
140
|
`;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type PartialWithUndefined } from '@augment-vir/common';
|
|
2
|
+
import { type AttributeValues, type CSSResult } from 'element-vir';
|
|
2
3
|
import { type SpaRoute, type SpaRouter } from 'spa-router-vir';
|
|
3
4
|
/**
|
|
4
5
|
* The route properties required for using {@link ViraLink} with a route.
|
|
@@ -33,11 +34,12 @@ export declare const ViraLink: import("element-vir").DeclarativeElementDefinitio
|
|
|
33
34
|
*/
|
|
34
35
|
route: ViraLinkRoute;
|
|
35
36
|
}, "link" | "route"> & PartialWithUndefined<{
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
37
|
+
/** Styles that will be applied directly to the inner elements. */
|
|
38
|
+
stylePassthrough: Readonly<PartialWithUndefined<{
|
|
39
|
+
a: CSSResult;
|
|
40
|
+
}>>;
|
|
41
|
+
/** Attributes that will be applied directly to the inner elements. */
|
|
42
|
+
attributePassthrough: Readonly<PartialWithUndefined<{
|
|
43
|
+
a: AttributeValues;
|
|
44
|
+
}>>;
|
|
43
45
|
}>, {}, {}, "vira-link-", "vira-link-hover-color", readonly []>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { css, html, ifDefined, listen } from 'element-vir';
|
|
1
|
+
import { attributes, css, html, ifDefined, listen, nothing, } from 'element-vir';
|
|
2
2
|
import { defineViraElement } from './define-vira-element.js';
|
|
3
3
|
/**
|
|
4
4
|
* A hyperlink wrapper element that can be configured to emit route change events rather than just
|
|
@@ -57,7 +57,10 @@ export const ViraLink = defineViraElement()({
|
|
|
57
57
|
href=${inputs.link.url}
|
|
58
58
|
target="_blank"
|
|
59
59
|
rel="noopener noreferrer"
|
|
60
|
-
|
|
60
|
+
${inputs.attributePassthrough?.a
|
|
61
|
+
? attributes(inputs.attributePassthrough.a)
|
|
62
|
+
: nothing}
|
|
63
|
+
style=${ifDefined(inputs.stylePassthrough?.a)}
|
|
61
64
|
>
|
|
62
65
|
<slot></slot>
|
|
63
66
|
</a>
|
|
@@ -72,7 +75,10 @@ export const ViraLink = defineViraElement()({
|
|
|
72
75
|
<a
|
|
73
76
|
href=${linkUrl}
|
|
74
77
|
rel="noopener noreferrer"
|
|
75
|
-
|
|
78
|
+
${inputs.attributePassthrough?.a
|
|
79
|
+
? attributes(inputs.attributePassthrough.a)
|
|
80
|
+
: nothing}
|
|
81
|
+
style=${ifDefined(inputs.stylePassthrough?.a)}
|
|
76
82
|
${listen('click', clickCallback)}
|
|
77
83
|
>
|
|
78
84
|
<slot></slot>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vira",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "26.0.1",
|
|
4
4
|
"description": "A simple and highly versatile design system using element-vir.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"design",
|
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
"vite-tsconfig-paths": "^5.1.4"
|
|
68
68
|
},
|
|
69
69
|
"peerDependencies": {
|
|
70
|
-
"element-vir": "^
|
|
70
|
+
"element-vir": "^26.0.1"
|
|
71
71
|
},
|
|
72
72
|
"engines": {
|
|
73
73
|
"node": ">=22"
|