@threadlabs/looma 0.39.5 → 0.40.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.
@@ -29,8 +29,8 @@
29
29
  tone="danger" variant="outline" is a destructive secondary action. neutral is the quiet one, for a button that should not claim a colour. The field
30
30
  variant always uses neutral field colors.</prop>
31
31
  <prop name="disabled" type="boolean" default="false"
32
- >Makes the button unavailable: it cannot be pressed, uses a flat neutral palette, and loses its raised look. A disabled link (as="a" with href) drops its
33
- href and states aria-disabled="true" instead, because a link has no native disabled state.</prop>
32
+ >Makes the button unavailable: it cannot be pressed, uses a flat neutral palette, and loses its raised look. A disabled link (with href) drops its href and
33
+ states aria-disabled="true" instead, because a link has no native disabled state.</prop>
34
34
  <prop name="loading" type="boolean" default="false"
35
35
  >Keeps the action focusable and its label visible while work is in progress. It shows a decorative spinner, states aria-disabled and aria-busy, and prevents
36
36
  activation or form submission until cleared.</prop>
@@ -41,12 +41,10 @@
41
41
  <prop name="type" type="keyword" values="button, submit, reset" default="button"
42
42
  >The button's type, as on a native button. button by default, so it never submits a form by accident. A link has no type.</prop>
43
43
  <prop name="href" type="string"
44
- >The link's destination. Pair it with as="a" so the button renders as a real link that navigates. A disabled link drops its href and states
45
- aria-disabled="true", so it cannot be followed.</prop>
46
- <prop name="target" type="string">Where a link opens, as on a native link. Only meaningful with as="a".</prop>
47
- <prop name="rel" type="string">The link's relationship to its destination, as on a native link. Only meaningful with as="a".</prop>
48
- <prop name="as" type="keyword" values="button, a" default="button"
49
- >The native element the button renders: a button, or a link (a) that navigates to href.</prop>
44
+ >The link's destination. Supplying href automatically renders a native link instead of a button, including an empty href for the current document. A
45
+ disabled link drops its href and states aria-disabled="true", so it cannot be followed.</prop>
46
+ <prop name="target" type="string">Where a link opens, as on a native link. Only meaningful with href.</prop>
47
+ <prop name="rel" type="string">The link's relationship to its destination, as on a native link. Only meaningful with href.</prop>
50
48
  <!-- Each root carries only its own attributes: a link has no type or disabled, and a disabled link
51
49
  loses its href and states aria-disabled instead. The language has no conditional expression, so a
52
50
  table keyed by a boolean's text picks each value, and null leaves the attribute off. -->
@@ -55,7 +53,7 @@
55
53
  <a
56
54
  from:data-appearance="$appearance"
57
55
  from:data-tone="$colorTone"
58
- $when="$appearance = 'card' and $as = 'a'"
56
+ $when="$appearance = 'card' and $href != null"
59
57
  from:href="{ true: null, false: $href }[concat($disabled or $loading or $pending)]"
60
58
  from:target="$target"
61
59
  from:rel="$rel"
@@ -87,7 +85,7 @@
87
85
  <a
88
86
  from:data-appearance="$appearance"
89
87
  from:data-tone="$colorTone"
90
- $when="$as = 'a'"
88
+ $when="$href != null"
91
89
  from:href="{ true: null, false: $href }[concat($disabled or $loading or $pending)]"
92
90
  from:target="$target"
93
91
  from:rel="$rel"
@@ -5,6 +5,9 @@ export function connect(host) {
5
5
  event.preventDefault();
6
6
  event.stopImmediatePropagation();
7
7
  };
8
- host.element.addEventListener("click", onClick, true);
9
- return () => host.element.removeEventListener("click", onClick, true);
8
+ return host.effect(() => {
9
+ const element = host.element;
10
+ element.addEventListener("click", onClick, true);
11
+ return () => element.removeEventListener("click", onClick, true);
12
+ });
10
13
  }
@@ -118,7 +118,7 @@
118
118
  --_ui-callout-icon: var(--ui-callout-icon);
119
119
  --_ui-callout-icon-size: var(--ui-callout-icon-size);
120
120
 
121
- --_callout-surface: color-mix(in srgb, var(--_callout-border) 19%, var(--ui-surface-default));
121
+ --_callout-surface: oklch(from var(--_callout-border) l c h / 10%);
122
122
  --_ui-selection-context-surface: light-dark(
123
123
  oklch(from var(--ui-callout-surface, var(--_callout-surface)) calc(l - 0.045) calc(max(c, min(0.045, c * 3))) h),
124
124
  oklch(from var(--ui-callout-surface, var(--_callout-surface)) calc(l + 0.045) calc(max(c, min(0.045, c * 3))) h)
@@ -32,7 +32,6 @@
32
32
  <template $if="$openHref != ''">
33
33
  <ui-button
34
34
  from:id="concat($base, '-open')"
35
- as="a"
36
35
  variant="ghost"
37
36
  tone="neutral"
38
37
  size="sm"
@@ -37,8 +37,7 @@
37
37
  tone="neutral"
38
38
  from:size="$size"
39
39
  from:disabled="$disabled or not $hasPrevious or $page &lt;= 1"
40
- from:as="{ true: 'a', false: 'button' }[concat($previousHref != '')]"
41
- from:href="$previousHref"
40
+ from:href="{ true: $previousHref, false: null }[concat($previousHref != '')]"
42
41
  from:aria-label="$previousLabel"
43
42
  from:data-pagination-page="$page - 1"
44
43
  ><ui-icon name="chevron-left"></ui-icon></ui-button>
@@ -50,8 +49,7 @@
50
49
  from:tone="{ true: 'accent', false: 'neutral' }[concat($item.value = $page)]"
51
50
  from:size="$size"
52
51
  from:disabled="$disabled"
53
- from:as="{ true: 'a', false: 'button' }[concat(default($item.href, '') != '')]"
54
- from:href="$item.href"
52
+ from:href="{ true: $item.href, false: null }[concat(default($item.href, '') != '')]"
55
53
  from:data-pagination-page="$item.value"
56
54
  from:aria-label="concat($pageLabel, ' ', format($item.value, 'number'))"
57
55
  from:aria-current="{ true: 'page', false: null }[concat($item.value = $page)]"
@@ -63,8 +61,7 @@
63
61
  tone="neutral"
64
62
  from:size="$size"
65
63
  from:disabled="$disabled or not $hasNext"
66
- from:as="{ true: 'a', false: 'button' }[concat($nextHref != '')]"
67
- from:href="$nextHref"
64
+ from:href="{ true: $nextHref, false: null }[concat($nextHref != '')]"
68
65
  from:aria-label="$nextLabel"
69
66
  from:data-pagination-page="$page + 1"
70
67
  ><ui-icon name="chevron-right"></ui-icon></ui-button>