@threadlabs/looma 0.10.11 → 0.10.12

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.
@@ -0,0 +1,33 @@
1
+ <template component="ui-list">
2
+ <defs>
3
+ <prop name="layout" type="rows | grid" default="rows"
4
+ >How the items are laid out. Rows stack the items one per line, for a list read top to bottom. Grid sets them in as many columns as fit, each at least
5
+ --ui-list-min-item-width (14rem) wide, for card items such as pinned or featured entries.</prop>
6
+ </defs>
7
+ <ul role="list"><slot></slot></ul>
8
+ <style>
9
+ /* A list of items (ui-list-item). It owns the spacing between them, so a view never sets it. The
10
+ explicit list role keeps the list announced as one: some browsers drop it from a list with no
11
+ markers. */
12
+ :host {
13
+ display: flex;
14
+ flex-direction: column;
15
+ gap: var(--ui-list-gap, var(--ui-space-1));
16
+ min-inline-size: 0;
17
+ margin: 0;
18
+ padding: 0;
19
+ list-style: none;
20
+ }
21
+
22
+ :host-state([layout="grid"]) {
23
+ display: grid;
24
+ grid-template-columns: repeat(auto-fill, minmax(min(100%, var(--ui-list-min-item-width, 14rem)), 1fr));
25
+ gap: var(--ui-list-gap, var(--ui-space-3));
26
+ }
27
+
28
+ /* A component that sets its display still honours the hidden attribute on its root. */
29
+ :host[hidden] {
30
+ display: none;
31
+ }
32
+ </style>
33
+ </template>
@@ -0,0 +1,146 @@
1
+ <template component="ui-list-item">
2
+ <defs>
3
+ <prop name="variant" type="row | card" default="row"
4
+ >How the item is drawn. A row is flat and takes a hover surface when it is a link, for items read down a list. A card sits on a raised, bordered surface,
5
+ for items set in a grid (a List with layout="grid"). Both have the same parts: leading, title, description, and trailing.</prop>
6
+ <prop name="current" type="boolean" default="false"
7
+ >Marks the item as the current one, such as the site you are in: it takes the selected surface and aria-current="true", which assistive technology
8
+ announces. Set it on one item at a time.</prop>
9
+ </defs>
10
+ <li :aria-current="current">
11
+ <span class="leading"><slot name="leading"></slot></span>
12
+ <span class="content">
13
+ <span class="title"><slot></slot></span>
14
+ <span class="description"><slot name="description"></slot></span>
15
+ </span>
16
+ <span class="trailing"><slot name="trailing"></slot></span>
17
+ </li>
18
+ <style>
19
+ /* One entry in a list: something to recognise (leading, usually an icon), its name (the default
20
+ slot), one line about it (description), and what it offers (trailing, such as a button or a
21
+ badge). The title and description are one line each and end in an ellipsis, so every item in a
22
+ list has the same height.
23
+
24
+ A link in the title is the whole item: its hit area stretches over the item, so the icon and the
25
+ padding follow it too, and the item takes the link's focus ring. The link stays a real link, so
26
+ a router, a modified click, and "open in new tab" all work. Trailing controls sit above it and
27
+ stay their own. */
28
+ :host {
29
+ position: relative;
30
+ box-sizing: border-box;
31
+ display: flex;
32
+ align-items: center;
33
+ gap: var(--ui-list-item-gap, var(--ui-space-3));
34
+ min-inline-size: 0;
35
+ min-block-size: var(--ui-control-size, 2.5rem);
36
+ padding-block: var(--ui-list-item-padding-block, var(--ui-space-2));
37
+ padding-inline: var(--ui-list-item-padding-inline, var(--ui-space-3));
38
+ border-radius: var(--ui-radius-md);
39
+ color: var(--ui-text-primary);
40
+ transition: background-color var(--ui-motion-fast) var(--ui-motion-ease), border-color var(--ui-motion-fast) var(--ui-motion-ease);
41
+ }
42
+
43
+ :host-state([variant="card"]) {
44
+ padding-block: var(--ui-list-item-padding-block, var(--ui-space-3));
45
+ padding-inline: var(--ui-list-item-padding-inline, var(--ui-space-4));
46
+ border: 1px solid var(--ui-border-default);
47
+ border-radius: var(--ui-radius-lg);
48
+ background: var(--ui-surface-raised);
49
+ }
50
+
51
+ :host:has(.title a[href]:hover) {
52
+ background: var(--ui-surface-hover);
53
+ }
54
+
55
+ :host-state([variant="card"]):has(.title a[href]:hover) {
56
+ border-color: var(--ui-border-strong);
57
+ }
58
+
59
+ :host-state([current]) {
60
+ background: var(--ui-surface-hover);
61
+ }
62
+
63
+ :host:has(.title a[href]:focus-visible) {
64
+ box-shadow: 0 0 0 2px var(--ui-focus-ring);
65
+ }
66
+
67
+ .leading,
68
+ .trailing {
69
+ display: inline-flex;
70
+ flex: none;
71
+ align-items: center;
72
+ gap: var(--ui-space-2);
73
+ }
74
+
75
+ .leading {
76
+ color: var(--ui-text-muted);
77
+ font-size: var(--ui-list-item-icon-size, var(--ui-font-size-lg));
78
+ }
79
+
80
+ /* Trailing controls take their own clicks, above the title link's stretched hit area. */
81
+ .trailing {
82
+ position: relative;
83
+ z-index: 1;
84
+ color: var(--ui-text-muted);
85
+ font-size: var(--ui-font-size-sm);
86
+ }
87
+
88
+ .content {
89
+ display: flex;
90
+ flex: 1;
91
+ flex-direction: column;
92
+ gap: var(--ui-space-0-5, 2px);
93
+ min-inline-size: 0;
94
+ }
95
+
96
+ .title,
97
+ .description {
98
+ display: block;
99
+ min-inline-size: 0;
100
+ overflow: hidden;
101
+ text-overflow: ellipsis;
102
+ white-space: nowrap;
103
+ }
104
+
105
+ .title {
106
+ font-size: var(--ui-font-size-md);
107
+ font-weight: var(--ui-font-medium);
108
+ line-height: var(--ui-line-height-tight);
109
+ }
110
+
111
+ .description {
112
+ color: var(--ui-text-muted);
113
+ font-size: var(--ui-font-size-sm);
114
+ line-height: var(--ui-line-height-tight);
115
+ }
116
+
117
+ .title > :slotted(a) {
118
+ color: inherit;
119
+ text-decoration: none;
120
+ }
121
+
122
+ .title > :slotted(a:focus-visible) {
123
+ outline: none;
124
+ box-shadow: none;
125
+ }
126
+
127
+ .title > :slotted(a[href])::after {
128
+ position: absolute;
129
+ inset: 0;
130
+ border-radius: inherit;
131
+ content: "";
132
+ }
133
+
134
+ /* An unused region takes no space. */
135
+ .leading:empty,
136
+ .description:empty,
137
+ .trailing:empty {
138
+ display: none;
139
+ }
140
+
141
+ /* A component that sets its display still honours the hidden attribute on its root. */
142
+ :host[hidden] {
143
+ display: none;
144
+ }
145
+ </style>
146
+ </template>