@threadlabs/looma 0.26.16 → 0.26.18
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.
- package/components/ui-menu/ui-menu.html +6 -0
- package/components/ui-menu-item/ui-menu-item.html +26 -0
- package/components/ui-meter/ui-meter.html +59 -8
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/styles/ui-menu-item.css +25 -0
- package/styles/ui-menu.css +5 -0
- package/styles/ui-meter.css +34 -0
- package/vanilla/UiMenu.d.ts +1 -0
- package/vanilla/UiMenu.js +4 -4
- package/vanilla/UiMenuItem.d.ts +1 -0
- package/vanilla/UiMenuItem.js +77 -49
- package/vanilla/UiMeter.d.ts +2 -0
- package/vanilla/UiMeter.js +136 -38
- package/vue/UiMenu.d.ts +9 -0
- package/vue/UiMenu.vue +25 -1
- package/vue/UiMenuItem.d.ts +13 -0
- package/vue/UiMenuItem.vue +48 -2
- package/vue/UiMeter.d.ts +27 -0
- package/vue/UiMeter.vue +514 -77
- package/vue/chunks/UiMenu.js +24 -1
- package/vue/chunks/UiMenuItem.js +55 -12
- package/vue/chunks/UiMeter.js +271 -57
- package/vue/components.css +101 -52
package/vue/UiMenu.d.ts
CHANGED
|
@@ -12,6 +12,10 @@ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPro
|
|
|
12
12
|
type: PropType<string | null>;
|
|
13
13
|
default: string;
|
|
14
14
|
};
|
|
15
|
+
icons: {
|
|
16
|
+
type: PropType<boolean | null>;
|
|
17
|
+
default: boolean;
|
|
18
|
+
};
|
|
15
19
|
inline: {
|
|
16
20
|
type: PropType<boolean | null>;
|
|
17
21
|
default: boolean;
|
|
@@ -54,6 +58,10 @@ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPro
|
|
|
54
58
|
type: PropType<string | null>;
|
|
55
59
|
default: string;
|
|
56
60
|
};
|
|
61
|
+
icons: {
|
|
62
|
+
type: PropType<boolean | null>;
|
|
63
|
+
default: boolean;
|
|
64
|
+
};
|
|
57
65
|
inline: {
|
|
58
66
|
type: PropType<boolean | null>;
|
|
59
67
|
default: boolean;
|
|
@@ -94,6 +102,7 @@ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPro
|
|
|
94
102
|
placement: string | null;
|
|
95
103
|
inline: boolean | null;
|
|
96
104
|
density: "comfortable" | "compact" | null;
|
|
105
|
+
icons: boolean | null;
|
|
97
106
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
98
107
|
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
99
108
|
declare const _default: typeof __VLS_export;
|
package/vue/UiMenu.vue
CHANGED
|
@@ -25,6 +25,14 @@ const propValidityContract = {
|
|
|
25
25
|
description: 'ID of the control that toggles and anchors the menu.',
|
|
26
26
|
default: '',
|
|
27
27
|
},
|
|
28
|
+
icons: {
|
|
29
|
+
type: { kind: 'terminal', name: 'boolean' },
|
|
30
|
+
required: false,
|
|
31
|
+
target: { attribute: 'icons' },
|
|
32
|
+
description:
|
|
33
|
+
'Reserves a fixed icon column in every item, including items without an icon. Supply item icons through their icon slot.',
|
|
34
|
+
default: false,
|
|
35
|
+
},
|
|
28
36
|
inline: {
|
|
29
37
|
type: { kind: 'terminal', name: 'boolean' },
|
|
30
38
|
required: false,
|
|
@@ -64,6 +72,7 @@ const props = defineProps({
|
|
|
64
72
|
default: 'comfortable',
|
|
65
73
|
},
|
|
66
74
|
for: { type: null as unknown as PropType<string | null>, default: '' },
|
|
75
|
+
icons: { type: null as unknown as PropType<boolean | null>, default: false },
|
|
67
76
|
inline: { type: null as unknown as PropType<boolean | null>, default: false },
|
|
68
77
|
open: { type: null as unknown as PropType<boolean | null>, default: false },
|
|
69
78
|
placement: { type: null as unknown as PropType<string | null>, default: 'bottom-start' },
|
|
@@ -72,6 +81,7 @@ const props = defineProps({
|
|
|
72
81
|
const acceptedProps: Record<string, unknown> = {
|
|
73
82
|
density: 'comfortable',
|
|
74
83
|
for: '',
|
|
84
|
+
icons: false,
|
|
75
85
|
inline: false,
|
|
76
86
|
open: false,
|
|
77
87
|
placement: 'bottom-start',
|
|
@@ -92,6 +102,13 @@ const checkedProps = computed(() => ({
|
|
|
92
102
|
'for',
|
|
93
103
|
acceptedProps,
|
|
94
104
|
) as string,
|
|
105
|
+
icons: checkedProp<boolean>(
|
|
106
|
+
props['icons'],
|
|
107
|
+
{ kind: 'terminal', name: 'boolean' },
|
|
108
|
+
false,
|
|
109
|
+
'icons',
|
|
110
|
+
acceptedProps,
|
|
111
|
+
) as boolean,
|
|
95
112
|
inline: checkedProp<boolean>(
|
|
96
113
|
props['inline'],
|
|
97
114
|
{ kind: 'terminal', name: 'boolean' },
|
|
@@ -214,6 +231,7 @@ const hostState = computed(() =>
|
|
|
214
231
|
&& `density=${encodeURIComponent(checkedProps.value.density)}`,
|
|
215
232
|
checkedProps.value.size && 'size',
|
|
216
233
|
checkedProps.value.size != null && `size=${encodeURIComponent(checkedProps.value.size)}`,
|
|
234
|
+
checkedProps.value.icons && 'icons',
|
|
217
235
|
internalOpen.value && 'internalOpen',
|
|
218
236
|
checkedProps.value.inline && 'inline',
|
|
219
237
|
].filter(Boolean).join(' ')
|
|
@@ -281,7 +299,7 @@ useComponentHost(() => import('../components/ui-menu/ui-menu.js'), {
|
|
|
281
299
|
? (incoming[name] ?? incoming[kebab] ?? null)
|
|
282
300
|
: null
|
|
283
301
|
},
|
|
284
|
-
propNames: ['density', 'for', 'inline', 'open', 'placement', 'size'],
|
|
302
|
+
propNames: ['density', 'for', 'icons', 'inline', 'open', 'placement', 'size'],
|
|
285
303
|
propValidity: (name: string) =>
|
|
286
304
|
propValidityState({ contract: propValidityContract, values: { ...props } }, name),
|
|
287
305
|
state: { internalOpen },
|
|
@@ -297,6 +315,7 @@ useComponentHost(() => import('../components/ui-menu/ui-menu.js'), {
|
|
|
297
315
|
v-prop-validity="{ contract: propValidityContract, values: { ...props } }"
|
|
298
316
|
:data-density="reflectedProp('density', 'density', checkedProps.density, undefined, false)"
|
|
299
317
|
:data-for="reflectedProp('for', 'for', checkedProps.for, undefined, false)"
|
|
318
|
+
:data-icons="reflectedProp('icons', 'icons', checkedProps.icons, undefined, false)"
|
|
300
319
|
:data-inline="reflectedProp('inline', 'inline', checkedProps.inline, undefined, false)"
|
|
301
320
|
:data-open="reflectedProp('open', 'open', checkedProps.open, undefined, false)"
|
|
302
321
|
:data-placement="reflectedProp('placement', 'placement', checkedProps.placement, undefined, false)"
|
|
@@ -355,6 +374,10 @@ useComponentHost(() => import('../components/ui-menu/ui-menu.js'), {
|
|
|
355
374
|
gap: 0;
|
|
356
375
|
}
|
|
357
376
|
|
|
377
|
+
[data-component~="ui-menu"][data-ui-menu-state~="icons"] {
|
|
378
|
+
--_ui-default-menu-icon-display: inline-flex;
|
|
379
|
+
}
|
|
380
|
+
|
|
358
381
|
[data-component~="ui-menu"] {
|
|
359
382
|
--_ui-menu-surface: var(--ui-menu-surface);
|
|
360
383
|
--_ui-menu-border: var(--ui-menu-border);
|
|
@@ -367,6 +390,7 @@ useComponentHost(() => import('../components/ui-menu/ui-menu.js'), {
|
|
|
367
390
|
--_ui-default-menu-item-radius: initial;
|
|
368
391
|
--_ui-default-menu-item-min-block-size: initial;
|
|
369
392
|
--_ui-default-menu-indicator-size: initial;
|
|
393
|
+
--_ui-default-menu-icon-display: none;
|
|
370
394
|
display: flex;
|
|
371
395
|
flex-direction: column;
|
|
372
396
|
box-sizing: border-box;
|
package/vue/UiMenuItem.d.ts
CHANGED
|
@@ -14,6 +14,10 @@ declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<import
|
|
|
14
14
|
type: PropType<string | null>;
|
|
15
15
|
default: string;
|
|
16
16
|
};
|
|
17
|
+
tone: {
|
|
18
|
+
type: PropType<"neutral" | "danger" | null>;
|
|
19
|
+
default: string;
|
|
20
|
+
};
|
|
17
21
|
type: {
|
|
18
22
|
type: PropType<"action" | "checkbox" | "radio" | null>;
|
|
19
23
|
default: string;
|
|
@@ -45,6 +49,10 @@ declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<import
|
|
|
45
49
|
type: PropType<string | null>;
|
|
46
50
|
default: string;
|
|
47
51
|
};
|
|
52
|
+
tone: {
|
|
53
|
+
type: PropType<"neutral" | "danger" | null>;
|
|
54
|
+
default: string;
|
|
55
|
+
};
|
|
48
56
|
type: {
|
|
49
57
|
type: PropType<"action" | "checkbox" | "radio" | null>;
|
|
50
58
|
default: string;
|
|
@@ -66,13 +74,18 @@ declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<import
|
|
|
66
74
|
}>, {
|
|
67
75
|
type: "checkbox" | "radio" | "action" | null;
|
|
68
76
|
value: string | null;
|
|
77
|
+
tone: "neutral" | "danger" | null;
|
|
69
78
|
disabled: boolean | null;
|
|
70
79
|
href: string | null;
|
|
71
80
|
checked: boolean | null;
|
|
72
81
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>, {
|
|
82
|
+
icon?: (props: {}) => any;
|
|
83
|
+
} & {
|
|
73
84
|
default?: (props: {}) => any;
|
|
74
85
|
} & {
|
|
75
86
|
shortcut?: (props: {}) => any;
|
|
87
|
+
} & {
|
|
88
|
+
icon?: (props: {}) => any;
|
|
76
89
|
} & {
|
|
77
90
|
default?: (props: {}) => any;
|
|
78
91
|
} & {
|
package/vue/UiMenuItem.vue
CHANGED
|
@@ -45,6 +45,14 @@ const propValidityContract = {
|
|
|
45
45
|
'A destination makes an action item a real link, with native navigation and link context actions.',
|
|
46
46
|
default: '',
|
|
47
47
|
},
|
|
48
|
+
tone: {
|
|
49
|
+
type: { kind: 'terminal', name: 'keyword' },
|
|
50
|
+
required: false,
|
|
51
|
+
target: { attribute: 'tone' },
|
|
52
|
+
description: 'Danger identifies a destructive action without changing its behavior.',
|
|
53
|
+
values: ['neutral', 'danger'],
|
|
54
|
+
default: 'neutral',
|
|
55
|
+
},
|
|
48
56
|
type: {
|
|
49
57
|
type: { kind: 'terminal', name: 'keyword' },
|
|
50
58
|
required: false,
|
|
@@ -68,6 +76,7 @@ const props = defineProps({
|
|
|
68
76
|
checked: { type: null as unknown as PropType<boolean | null>, default: false },
|
|
69
77
|
disabled: { type: null as unknown as PropType<boolean | null>, default: false },
|
|
70
78
|
href: { type: null as unknown as PropType<string | null>, default: '' },
|
|
79
|
+
tone: { type: null as unknown as PropType<'neutral' | 'danger' | null>, default: 'neutral' },
|
|
71
80
|
type: {
|
|
72
81
|
type: null as unknown as PropType<'action' | 'checkbox' | 'radio' | null>,
|
|
73
82
|
default: 'action',
|
|
@@ -78,6 +87,7 @@ const acceptedProps: Record<string, unknown> = {
|
|
|
78
87
|
checked: false,
|
|
79
88
|
disabled: false,
|
|
80
89
|
href: '',
|
|
90
|
+
tone: 'neutral',
|
|
81
91
|
type: 'action',
|
|
82
92
|
value: '',
|
|
83
93
|
}
|
|
@@ -103,6 +113,13 @@ const checkedProps = computed(() => ({
|
|
|
103
113
|
'href',
|
|
104
114
|
acceptedProps,
|
|
105
115
|
) as string,
|
|
116
|
+
tone: checkedProp<'neutral' | 'danger'>(
|
|
117
|
+
props['tone'],
|
|
118
|
+
{ kind: 'terminal', name: 'keyword' },
|
|
119
|
+
false,
|
|
120
|
+
'tone',
|
|
121
|
+
acceptedProps,
|
|
122
|
+
) as 'neutral' | 'danger',
|
|
106
123
|
type: checkedProp<'action' | 'checkbox' | 'radio'>(
|
|
107
124
|
props['type'],
|
|
108
125
|
{ kind: 'terminal', name: 'keyword' },
|
|
@@ -250,6 +267,8 @@ if (
|
|
|
250
267
|
/** The values the styles' :host-state() rules test. */
|
|
251
268
|
const hostState = computed(() =>
|
|
252
269
|
[
|
|
270
|
+
checkedProps.value.tone && 'tone',
|
|
271
|
+
checkedProps.value.tone != null && `tone=${encodeURIComponent(checkedProps.value.tone)}`,
|
|
253
272
|
checkedProps.value.type && 'type',
|
|
254
273
|
checkedProps.value.type != null && `type=${encodeURIComponent(checkedProps.value.type)}`,
|
|
255
274
|
].filter(Boolean).join(' ')
|
|
@@ -296,7 +315,7 @@ useComponentHost(() => import('../components/ui-menu-item/ui-menu-item.js'), {
|
|
|
296
315
|
? (incoming[name] ?? incoming[kebab] ?? null)
|
|
297
316
|
: null
|
|
298
317
|
},
|
|
299
|
-
propNames: ['checked', 'disabled', 'href', 'type', 'value'],
|
|
318
|
+
propNames: ['checked', 'disabled', 'href', 'tone', 'type', 'value'],
|
|
300
319
|
propValidity: (name: string) =>
|
|
301
320
|
propValidityState({ contract: propValidityContract, values: { ...props } }, name),
|
|
302
321
|
state: { internalChecked },
|
|
@@ -347,11 +366,13 @@ function concat<T extends unknown[]>(...values: T): ConcatResult<T> {
|
|
|
347
366
|
:data-checked="reflectedProp('checked', 'checked', checkedProps.checked, undefined, false)"
|
|
348
367
|
:data-disabled="reflectedProp('disabled', 'disabled', checkedProps.disabled, undefined, false)"
|
|
349
368
|
:data-href="reflectedProp('href', 'href', checkedProps.href, undefined, false)"
|
|
369
|
+
:data-tone="reflectedProp('tone', 'tone', checkedProps.tone, undefined, false)"
|
|
350
370
|
:data-type="reflectedProp('type', 'type', checkedProps.type, undefined, false)"
|
|
351
371
|
:data-value="reflectedProp('value', 'value', checkedProps.value, undefined, true)"
|
|
352
372
|
:data-ui-menu-item-state="hostState || undefined"
|
|
353
373
|
ref="@html-next/root"
|
|
354
|
-
><span class="
|
|
374
|
+
><span class="icon" aria-hidden="true"><slot name="icon" /></span>
|
|
375
|
+
<span class="label"><slot /></span>
|
|
355
376
|
<span class="shortcut" aria-hidden="true"><slot name="shortcut" /></span></a>
|
|
356
377
|
<div
|
|
357
378
|
v-else
|
|
@@ -370,6 +391,7 @@ function concat<T extends unknown[]>(...values: T): ConcatResult<T> {
|
|
|
370
391
|
:data-checked="reflectedProp('checked', 'checked', checkedProps.checked, undefined, false)"
|
|
371
392
|
:data-disabled="reflectedProp('disabled', 'disabled', checkedProps.disabled, undefined, false)"
|
|
372
393
|
:data-href="reflectedProp('href', 'href', checkedProps.href, undefined, false)"
|
|
394
|
+
:data-tone="reflectedProp('tone', 'tone', checkedProps.tone, undefined, false)"
|
|
373
395
|
:data-type="reflectedProp('type', 'type', checkedProps.type, undefined, false)"
|
|
374
396
|
:data-value="reflectedProp('value', 'value', checkedProps.value, undefined, true)"
|
|
375
397
|
:data-ui-menu-item-state="hostState || undefined"
|
|
@@ -379,6 +401,7 @@ function concat<T extends unknown[]>(...values: T): ConcatResult<T> {
|
|
|
379
401
|
v-if="(checkedProps.type === 'checkbox' || checkedProps.type === 'radio') && internalChecked"
|
|
380
402
|
name="check"
|
|
381
403
|
/></span>
|
|
404
|
+
<span class="icon" aria-hidden="true"><slot name="icon" /></span>
|
|
382
405
|
<span class="label"><slot /></span>
|
|
383
406
|
<span class="shortcut" aria-hidden="true"><slot name="shortcut" /></span>
|
|
384
407
|
</div>
|
|
@@ -444,6 +467,29 @@ function concat<T extends unknown[]>(...values: T): ConcatResult<T> {
|
|
|
444
467
|
color var(--ui-motion-fast) var(--ui-motion-ease);
|
|
445
468
|
}
|
|
446
469
|
|
|
470
|
+
/* A named icon has a fixed column; an icon-enabled menu reserves it on every row. */
|
|
471
|
+
.icon {
|
|
472
|
+
display: var(--_ui-default-menu-icon-display, none);
|
|
473
|
+
align-items: center;
|
|
474
|
+
justify-content: center;
|
|
475
|
+
flex: none;
|
|
476
|
+
inline-size: var(--ui-icon-size-sm);
|
|
477
|
+
block-size: var(--ui-icon-size-sm);
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
.icon:not(:empty) {
|
|
481
|
+
display: inline-flex;
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
.icon :slotted(svg) {
|
|
485
|
+
inline-size: 100%;
|
|
486
|
+
block-size: 100%;
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
[data-component~="ui-menu-item"][data-ui-menu-item-state~="tone=danger"] {
|
|
490
|
+
color: var(--ui-danger);
|
|
491
|
+
}
|
|
492
|
+
|
|
447
493
|
.label {
|
|
448
494
|
display: flex;
|
|
449
495
|
align-items: center;
|
package/vue/UiMeter.d.ts
CHANGED
|
@@ -10,6 +10,13 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
10
10
|
type: PropType<number | null>;
|
|
11
11
|
default: number;
|
|
12
12
|
};
|
|
13
|
+
parts: {
|
|
14
|
+
type: PropType<readonly ({
|
|
15
|
+
readonly value: number;
|
|
16
|
+
readonly color: string;
|
|
17
|
+
})[] | null>;
|
|
18
|
+
default: () => never[];
|
|
19
|
+
};
|
|
13
20
|
segments: {
|
|
14
21
|
type: PropType<number | null>;
|
|
15
22
|
default: number;
|
|
@@ -30,6 +37,10 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
30
37
|
type: PropType<string | null>;
|
|
31
38
|
default: string;
|
|
32
39
|
};
|
|
40
|
+
variant: {
|
|
41
|
+
type: PropType<"progress" | "distribution" | null>;
|
|
42
|
+
default: string;
|
|
43
|
+
};
|
|
33
44
|
}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
34
45
|
label: {
|
|
35
46
|
type: PropType<string | null>;
|
|
@@ -39,6 +50,13 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
39
50
|
type: PropType<number | null>;
|
|
40
51
|
default: number;
|
|
41
52
|
};
|
|
53
|
+
parts: {
|
|
54
|
+
type: PropType<readonly ({
|
|
55
|
+
readonly value: number;
|
|
56
|
+
readonly color: string;
|
|
57
|
+
})[] | null>;
|
|
58
|
+
default: () => never[];
|
|
59
|
+
};
|
|
42
60
|
segments: {
|
|
43
61
|
type: PropType<number | null>;
|
|
44
62
|
default: number;
|
|
@@ -59,12 +77,21 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
59
77
|
type: PropType<string | null>;
|
|
60
78
|
default: string;
|
|
61
79
|
};
|
|
80
|
+
variant: {
|
|
81
|
+
type: PropType<"progress" | "distribution" | null>;
|
|
82
|
+
default: string;
|
|
83
|
+
};
|
|
62
84
|
}>> & Readonly<{}>, {
|
|
63
85
|
label: string | null;
|
|
64
86
|
value: number | null;
|
|
65
87
|
size: "sm" | "md" | null;
|
|
66
88
|
max: number | null;
|
|
67
89
|
tone: "info" | "neutral" | "accent" | "success" | "warning" | "danger" | null;
|
|
90
|
+
variant: "progress" | "distribution" | null;
|
|
91
|
+
parts: readonly {
|
|
92
|
+
readonly value: number;
|
|
93
|
+
readonly color: string;
|
|
94
|
+
}[] | null;
|
|
68
95
|
segments: number | null;
|
|
69
96
|
valueText: string | null;
|
|
70
97
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|