vira 25.15.0 → 26.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.
@@ -5,16 +5,15 @@ import { wrapDefineElement } from 'element-vir';
5
5
  * @category Internal
6
6
  */
7
7
  export const ViraTagNamePrefix = `vira-`;
8
- const { defineElement } = wrapDefineElement({
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;
@@ -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
- aria?: {
37
- /**
38
- * This label will be attached to the inner `<a>` element's `aria-label` attribute.
39
- * If none is provided, no `aria-label` attribute will be generated.
40
- */
41
- label: string;
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
- aria-label=${ifDefined(inputs.aria?.label || undefined)}
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
- aria-label=${ifDefined(inputs.aria?.label || undefined)}
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": "25.15.0",
3
+ "version": "26.0.0",
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": "^25.15.0"
70
+ "element-vir": "^26.0.0"
71
71
  },
72
72
  "engines": {
73
73
  "node": ">=22"