@threadlabs/looma 0.10.10 → 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,26 @@
1
+ type __VLS_Props = {
2
+ current?: boolean;
3
+ variant?: 'row' | 'card';
4
+ };
5
+ declare var __VLS_1: {}, __VLS_3: {}, __VLS_5: {}, __VLS_7: {};
6
+ type __VLS_Slots = {} & {
7
+ leading?: (props: typeof __VLS_1) => any;
8
+ } & {
9
+ default?: (props: typeof __VLS_3) => any;
10
+ } & {
11
+ description?: (props: typeof __VLS_5) => any;
12
+ } & {
13
+ trailing?: (props: typeof __VLS_7) => any;
14
+ };
15
+ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
16
+ variant: "row" | "card";
17
+ current: boolean;
18
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
19
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
20
+ declare const _default: typeof __VLS_export;
21
+ export default _default;
22
+ type __VLS_WithSlots<T, S> = T & {
23
+ new (): {
24
+ $slots: S;
25
+ };
26
+ };
@@ -0,0 +1,2 @@
1
+ import { t as UiListItem_default } from "./chunks/UiListItem.js";
2
+ export { UiListItem_default as default };
@@ -0,0 +1,171 @@
1
+ <!-- Generated by HTML Next 1.0.0-alpha.5 for Vue 3.5. Do not edit. -->
2
+ <script setup lang="ts">
3
+ import { computed } from 'vue'
4
+
5
+ defineOptions({ inheritAttrs: false })
6
+
7
+ const props = withDefaults(
8
+ defineProps<{
9
+ current?: boolean
10
+ variant?: 'row' | 'card'
11
+ }>(),
12
+ {
13
+ current: false,
14
+ variant: 'row',
15
+ },
16
+ )
17
+
18
+ /** The values the styles' :host-state() rules test. */
19
+ const hostState = computed(() =>
20
+ [
21
+ props.variant && `variant variant=${props.variant}`,
22
+ props.current && 'current',
23
+ ].filter(Boolean).join(' ')
24
+ )
25
+ </script>
26
+
27
+ <template>
28
+ <li
29
+ data-component="ui-list-item"
30
+ v-bind="$attrs"
31
+ :aria-current="current"
32
+ :data-ui-list-item-state="hostState || undefined"
33
+ >
34
+ <span class="leading"><slot name="leading" /></span>
35
+ <span class="content"><span class="title"><slot /></span>
36
+ <span class="description"><slot name="description" /></span></span>
37
+ <span class="trailing"><slot name="trailing" /></span>
38
+ </li>
39
+ </template>
40
+
41
+ <style scoped>
42
+ /* One entry in a list: something to recognise (leading, usually an icon), its name (the default
43
+ slot), one line about it (description), and what it offers (trailing, such as a button or a
44
+ badge). The title and description are one line each and end in an ellipsis, so every item in a
45
+ list has the same height.
46
+
47
+ A link in the title is the whole item: its hit area stretches over the item, so the icon and the
48
+ padding follow it too, and the item takes the link's focus ring. The link stays a real link, so
49
+ a router, a modified click, and "open in new tab" all work. Trailing controls sit above it and
50
+ stay their own. */
51
+ [data-component~="ui-list-item"] {
52
+ position: relative;
53
+ box-sizing: border-box;
54
+ display: flex;
55
+ align-items: center;
56
+ gap: var(--ui-list-item-gap, var(--ui-space-3));
57
+ min-inline-size: 0;
58
+ min-block-size: var(--ui-control-size, 2.5rem);
59
+ padding-block: var(--ui-list-item-padding-block, var(--ui-space-2));
60
+ padding-inline: var(--ui-list-item-padding-inline, var(--ui-space-3));
61
+ border-radius: var(--ui-radius-md);
62
+ color: var(--ui-text-primary);
63
+ transition:
64
+ background-color var(--ui-motion-fast) var(--ui-motion-ease),
65
+ border-color var(--ui-motion-fast) var(--ui-motion-ease);
66
+ }
67
+
68
+ [data-component~="ui-list-item"][data-ui-list-item-state~="variant=card"] {
69
+ padding-block: var(--ui-list-item-padding-block, var(--ui-space-3));
70
+ padding-inline: var(--ui-list-item-padding-inline, var(--ui-space-4));
71
+ border: 1px solid var(--ui-border-default);
72
+ border-radius: var(--ui-radius-lg);
73
+ background: var(--ui-surface-raised);
74
+ }
75
+
76
+ [data-component~="ui-list-item"]:has(.title a[href]:hover) {
77
+ background: var(--ui-surface-hover);
78
+ }
79
+
80
+ [data-component~="ui-list-item"][data-ui-list-item-state~="variant=card"]:has(.title
81
+ a[href]:hover) {
82
+ border-color: var(--ui-border-strong);
83
+ }
84
+
85
+ [data-component~="ui-list-item"][data-ui-list-item-state~="current"] {
86
+ background: var(--ui-surface-hover);
87
+ }
88
+
89
+ [data-component~="ui-list-item"]:has(.title a[href]:focus-visible) {
90
+ box-shadow: 0 0 0 2px var(--ui-focus-ring);
91
+ }
92
+
93
+ .leading,
94
+ .trailing {
95
+ display: inline-flex;
96
+ flex: none;
97
+ align-items: center;
98
+ gap: var(--ui-space-2);
99
+ }
100
+
101
+ .leading {
102
+ color: var(--ui-text-muted);
103
+ font-size: var(--ui-list-item-icon-size, var(--ui-font-size-lg));
104
+ }
105
+
106
+ /* Trailing controls take their own clicks, above the title link's stretched hit area. */
107
+ .trailing {
108
+ position: relative;
109
+ z-index: 1;
110
+ color: var(--ui-text-muted);
111
+ font-size: var(--ui-font-size-sm);
112
+ }
113
+
114
+ .content {
115
+ display: flex;
116
+ flex: 1;
117
+ flex-direction: column;
118
+ gap: var(--ui-space-0-5, 2px);
119
+ min-inline-size: 0;
120
+ }
121
+
122
+ .title,
123
+ .description {
124
+ display: block;
125
+ min-inline-size: 0;
126
+ overflow: hidden;
127
+ text-overflow: ellipsis;
128
+ white-space: nowrap;
129
+ }
130
+
131
+ .title {
132
+ font-size: var(--ui-font-size-md);
133
+ font-weight: var(--ui-font-medium);
134
+ line-height: var(--ui-line-height-tight);
135
+ }
136
+
137
+ .description {
138
+ color: var(--ui-text-muted);
139
+ font-size: var(--ui-font-size-sm);
140
+ line-height: var(--ui-line-height-tight);
141
+ }
142
+
143
+ .title > :slotted(a) {
144
+ color: inherit;
145
+ text-decoration: none;
146
+ }
147
+
148
+ .title > :slotted(a:focus-visible) {
149
+ outline: none;
150
+ box-shadow: none;
151
+ }
152
+
153
+ .title > :slotted(a[href])::after {
154
+ position: absolute;
155
+ inset: 0;
156
+ border-radius: inherit;
157
+ content: "";
158
+ }
159
+
160
+ /* An unused region takes no space. */
161
+ .leading:empty,
162
+ .description:empty,
163
+ .trailing:empty {
164
+ display: none;
165
+ }
166
+
167
+ /* A component that sets its display still honours the hidden attribute on its root. */
168
+ [data-component~="ui-list-item"][hidden] {
169
+ display: none;
170
+ }
171
+ </style>
@@ -51,6 +51,8 @@ const root = ref<HTMLElement | null>(null)
51
51
  const rowElement = useTemplateRef<HTMLElement>('row')
52
52
  const dragHandleElement = useTemplateRef<HTMLElement>('dragHandle')
53
53
  const disclosureElement = useTemplateRef<HTMLElement>('disclosure')
54
+ const leadingElement = useTemplateRef<HTMLElement>('leading')
55
+ const labelElement = useTemplateRef<HTMLElement>('label')
54
56
  const labelTextElement = useTemplateRef<HTMLElement>('labelText')
55
57
  const actionsElement = useTemplateRef<HTMLElement>('actions')
56
58
  const childrenElement = useTemplateRef<HTMLElement>('children')
@@ -92,6 +94,8 @@ useComponentHost(controllerModule.default, {
92
94
  row: rowElement,
93
95
  dragHandle: dragHandleElement,
94
96
  disclosure: disclosureElement,
97
+ leading: leadingElement,
98
+ label: labelElement,
95
99
  labelText: labelTextElement,
96
100
  actions: actionsElement,
97
101
  children: childrenElement,
@@ -154,8 +158,8 @@ useComponentHost(controllerModule.default, {
154
158
  >
155
159
  <span class="disclosure-icon" aria-hidden="true"></span>
156
160
  </button>
157
- <span class="leading"><slot name="leading" /></span>
158
- <span class="label"><span class="label-text" ref="labelText"><slot name="label">{{
161
+ <span class="leading" ref="leading"><slot name="leading" /></span>
162
+ <span class="label" ref="label"><span class="label-text" ref="labelText"><slot name="label">{{
159
163
  label
160
164
  }}</slot></span></span>
161
165
  <span class="actions" ref="actions"><slot name="actions" /></span>
@@ -296,6 +300,9 @@ useComponentHost(controllerModule.default, {
296
300
  block-size: 1em;
297
301
  margin-inline-start: var(--ui-space-1);
298
302
  color: var(--ui-text-muted);
303
+ /* Above the label, so a sliding name passes under the icon. */
304
+ position: relative;
305
+ z-index: 1;
299
306
  }
300
307
 
301
308
  .leading:empty {
@@ -324,6 +331,9 @@ useComponentHost(controllerModule.default, {
324
331
  overflow: hidden;
325
332
  padding: var(--ui-tree-item-label-padding-block, var(--ui-space-1))
326
333
  var(--ui-tree-item-label-padding-inline, var(--ui-space-2));
334
+ /* The length of the fade before the controls. The label's one flex child lays out no gap; this
335
+ is where the controller reads the length in pixels to stop a sliding name before the fade. */
336
+ column-gap: var(--ui-space-3);
327
337
  }
328
338
 
329
339
  /* Slotted label content fills the cell, so a link is the row's hit area rather than sizing to
@@ -344,6 +354,27 @@ useComponentHost(controllerModule.default, {
344
354
  min-inline-size: 0;
345
355
  }
346
356
 
357
+ /* The controls sit over the label's end, so the text fades out where they begin. The fade is
358
+ the truncation mark while it shows: an ellipsis under it would read as a second one. */
359
+ .row:hover > .label,
360
+ .row:focus-within > .label {
361
+ text-overflow: clip;
362
+ mask-image: linear-gradient(
363
+ to right,
364
+ #000 calc(100% - var(--_tree-actions-width, 1.75rem) - var(--ui-space-3)),
365
+ transparent calc(100% - var(--_tree-actions-width, 1.75rem))
366
+ );
367
+ }
368
+
369
+ .row:hover > .label:dir(rtl),
370
+ .row:focus-within > .label:dir(rtl) {
371
+ mask-image: linear-gradient(
372
+ to left,
373
+ #000 calc(100% - var(--_tree-actions-width, 1.75rem) - var(--ui-space-3)),
374
+ transparent calc(100% - var(--_tree-actions-width, 1.75rem))
375
+ );
376
+ }
377
+
347
378
  /* A hovered row reads its whole name: the label slides far enough to show the end, waits
348
379
  there, and comes back. Only when it actually overflows — the controller measures by how
349
380
  much — after the controls have taken their place over its end — and hands over the distance
@@ -355,13 +386,21 @@ useComponentHost(controllerModule.default, {
355
386
  will-change: transform;
356
387
  }
357
388
 
358
- /* While it slides, the start fades too: the name is leaving the cell at both ends, and a hard
359
- edge beside the icon reads as a collision rather than as more text. */
389
+ /* This comes after the hover fade, which it replaces at the same specificity. While the name
390
+ slides, the label reaches back under the icon (the controller measures how far) with its text
391
+ where it was, and fades out across that stretch, gone by the icon's middle: the name slips
392
+ under the icon rather than stopping at a hard edge beside it. */
360
393
  .row[data-ui-marquee] > .label {
394
+ margin-inline-start: calc(-1 * var(--_marquee-lead, 0px));
395
+ padding-inline-start: calc(
396
+ var(--_marquee-lead, 0px) + var(--ui-tree-item-label-padding-inline, var(--ui-space-2))
397
+ );
361
398
  mask-image: linear-gradient(
362
399
  to right,
363
- transparent 0,
364
- #000 var(--ui-space-2),
400
+ transparent calc(var(--_marquee-lead, 0px) / 2),
401
+ #000 calc(
402
+ var(--_marquee-lead, 0px) + var(--ui-tree-item-label-padding-inline, var(--ui-space-2))
403
+ ),
365
404
  #000 calc(100% - var(--_tree-actions-width, 1.75rem) - var(--ui-space-3)),
366
405
  transparent calc(100% - var(--_tree-actions-width, 1.75rem))
367
406
  );
@@ -370,8 +409,10 @@ useComponentHost(controllerModule.default, {
370
409
  .row[data-ui-marquee] > .label:dir(rtl) {
371
410
  mask-image: linear-gradient(
372
411
  to left,
373
- transparent 0,
374
- #000 var(--ui-space-2),
412
+ transparent calc(var(--_marquee-lead, 0px) / 2),
413
+ #000 calc(
414
+ var(--_marquee-lead, 0px) + var(--ui-tree-item-label-padding-inline, var(--ui-space-2))
415
+ ),
375
416
  #000 calc(100% - var(--_tree-actions-width, 1.75rem) - var(--ui-space-3)),
376
417
  transparent calc(100% - var(--_tree-actions-width, 1.75rem))
377
418
  );
@@ -394,27 +435,6 @@ useComponentHost(controllerModule.default, {
394
435
  }
395
436
  }
396
437
 
397
- /* The controls sit over the label's end, so the text fades out where they begin. The fade is
398
- the truncation mark while it shows: an ellipsis under it would read as a second one. */
399
- .row:hover > .label,
400
- .row:focus-within > .label {
401
- text-overflow: clip;
402
- mask-image: linear-gradient(
403
- to right,
404
- #000 calc(100% - var(--_tree-actions-width, 1.75rem) - var(--ui-space-3)),
405
- transparent calc(100% - var(--_tree-actions-width, 1.75rem))
406
- );
407
- }
408
-
409
- .row:hover > .label:dir(rtl),
410
- .row:focus-within > .label:dir(rtl) {
411
- mask-image: linear-gradient(
412
- to left,
413
- #000 calc(100% - var(--_tree-actions-width, 1.75rem) - var(--ui-space-3)),
414
- transparent calc(100% - var(--_tree-actions-width, 1.75rem))
415
- );
416
- }
417
-
418
438
  .row:hover > .label > :slotted(*),
419
439
  .row:focus-within > .label > :slotted(*) {
420
440
  text-overflow: clip;
@@ -0,0 +1,24 @@
1
+ import { t as _plugin_vue_export_helper_default } from "./_plugin-vue_export-helper.js";
2
+ import { computed, createElementBlock, defineComponent, mergeProps, openBlock, renderSlot } from "vue";
3
+ //#region .build/vue/UiList.vue?vue&type=script&setup=true&lang.ts
4
+ var _hoisted_1 = ["data-ui-list-state"];
5
+ //#endregion
6
+ //#region .build/vue/UiList.vue
7
+ var UiList_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PURE__ */ defineComponent({
8
+ inheritAttrs: false,
9
+ __name: "UiList",
10
+ props: { layout: { default: "rows" } },
11
+ setup(__props) {
12
+ const props = __props;
13
+ /** The values the styles' :host-state() rules test. */
14
+ const hostState = computed(() => [props.layout && `layout layout=${props.layout}`].filter(Boolean).join(" "));
15
+ return (_ctx, _cache) => {
16
+ return openBlock(), createElementBlock("ul", mergeProps({
17
+ "data-component": "ui-list",
18
+ role: "list"
19
+ }, _ctx.$attrs, { "data-ui-list-state": hostState.value || void 0 }), [renderSlot(_ctx.$slots, "default", {}, void 0, true)], 16, _hoisted_1);
20
+ };
21
+ }
22
+ }), [["__scopeId", "data-v-935b1197"]]);
23
+ //#endregion
24
+ export { UiList_default as t };
@@ -0,0 +1,39 @@
1
+ import { t as _plugin_vue_export_helper_default } from "./_plugin-vue_export-helper.js";
2
+ import { computed, createElementBlock, createElementVNode, defineComponent, mergeProps, openBlock, renderSlot } from "vue";
3
+ //#region .build/vue/UiListItem.vue?vue&type=script&setup=true&lang.ts
4
+ var _hoisted_1 = ["aria-current", "data-ui-list-item-state"];
5
+ var _hoisted_2 = { class: "leading" };
6
+ var _hoisted_3 = { class: "content" };
7
+ var _hoisted_4 = { class: "title" };
8
+ var _hoisted_5 = { class: "description" };
9
+ var _hoisted_6 = { class: "trailing" };
10
+ //#endregion
11
+ //#region .build/vue/UiListItem.vue
12
+ var UiListItem_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PURE__ */ defineComponent({
13
+ inheritAttrs: false,
14
+ __name: "UiListItem",
15
+ props: {
16
+ current: {
17
+ type: Boolean,
18
+ default: false
19
+ },
20
+ variant: { default: "row" }
21
+ },
22
+ setup(__props) {
23
+ const props = __props;
24
+ /** The values the styles' :host-state() rules test. */
25
+ const hostState = computed(() => [props.variant && `variant variant=${props.variant}`, props.current && "current"].filter(Boolean).join(" "));
26
+ return (_ctx, _cache) => {
27
+ return openBlock(), createElementBlock("li", mergeProps({ "data-component": "ui-list-item" }, _ctx.$attrs, {
28
+ "aria-current": __props.current,
29
+ "data-ui-list-item-state": hostState.value || void 0
30
+ }), [
31
+ createElementVNode("span", _hoisted_2, [renderSlot(_ctx.$slots, "leading")]),
32
+ createElementVNode("span", _hoisted_3, [createElementVNode("span", _hoisted_4, [renderSlot(_ctx.$slots, "default")]), createElementVNode("span", _hoisted_5, [renderSlot(_ctx.$slots, "description")])]),
33
+ createElementVNode("span", _hoisted_6, [renderSlot(_ctx.$slots, "trailing")])
34
+ ], 16, _hoisted_1);
35
+ };
36
+ }
37
+ }), [["__scopeId", "data-v-d61daf46"]]);
38
+ //#endregion
39
+ export { UiListItem_default as t };
@@ -22,8 +22,14 @@ var _hoisted_2 = {
22
22
  };
23
23
  var _hoisted_3 = ["aria-label"];
24
24
  var _hoisted_4 = ["disabled", "hidden"];
25
- var _hoisted_5 = { class: "leading" };
26
- var _hoisted_6 = { class: "label" };
25
+ var _hoisted_5 = {
26
+ class: "leading",
27
+ ref: "leading"
28
+ };
29
+ var _hoisted_6 = {
30
+ class: "label",
31
+ ref: "label"
32
+ };
27
33
  var _hoisted_7 = {
28
34
  class: "label-text",
29
35
  ref: "labelText"
@@ -79,6 +85,8 @@ var UiTreeItem_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__P
79
85
  const rowElement = useTemplateRef("row");
80
86
  const dragHandleElement = useTemplateRef("dragHandle");
81
87
  const disclosureElement = useTemplateRef("disclosure");
88
+ const leadingElement = useTemplateRef("leading");
89
+ const labelElement = useTemplateRef("label");
82
90
  const labelTextElement = useTemplateRef("labelText");
83
91
  const actionsElement = useTemplateRef("actions");
84
92
  const childrenElement = useTemplateRef("children");
@@ -114,6 +122,8 @@ var UiTreeItem_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__P
114
122
  row: rowElement,
115
123
  dragHandle: dragHandleElement,
116
124
  disclosure: disclosureElement,
125
+ leading: leadingElement,
126
+ label: labelElement,
117
127
  labelText: labelTextElement,
118
128
  actions: actionsElement,
119
129
  children: childrenElement
@@ -203,8 +213,8 @@ var UiTreeItem_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__P
203
213
  class: "disclosure-icon",
204
214
  "aria-hidden": "true"
205
215
  }, null, -1)])], 8, _hoisted_4),
206
- createElementVNode("span", _hoisted_5, [renderSlot(_ctx.$slots, "leading")]),
207
- createElementVNode("span", _hoisted_6, [createElementVNode("span", _hoisted_7, [renderSlot(_ctx.$slots, "label", {}, () => [createTextVNode(toDisplayString(__props.label), 1)])], 512)]),
216
+ createElementVNode("span", _hoisted_5, [renderSlot(_ctx.$slots, "leading")], 512),
217
+ createElementVNode("span", _hoisted_6, [createElementVNode("span", _hoisted_7, [renderSlot(_ctx.$slots, "label", {}, () => [createTextVNode(toDisplayString(__props.label), 1)])], 512)], 512),
208
218
  createElementVNode("span", _hoisted_8, [renderSlot(_ctx.$slots, "actions")], 512),
209
219
  _cache[2] || (_cache[2] = createElementVNode("span", {
210
220
  class: "drop-indicator row-drop-indicator",
@@ -224,6 +234,6 @@ var UiTreeItem_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__P
224
234
  ], 16, _hoisted_1);
225
235
  };
226
236
  }
227
- }), [["__scopeId", "data-v-a950b4d2"]]);
237
+ }), [["__scopeId", "data-v-3778b642"]]);
228
238
  //#endregion
229
239
  export { UiTreeItem_default as t };