@threadlabs/looma 0.47.1 → 0.47.2
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-combobox/ui-combobox.html +23 -4
- package/components/ui-combobox/ui-combobox.js +6 -0
- package/components/ui-top-bar/ui-top-bar.html +32 -2
- package/components/ui-top-bar/ui-top-bar.js +60 -0
- package/dist/index.js +4 -3
- package/docs/catalog.json +66 -3
- package/package.json +1 -1
- package/styles/ui-combobox.css +40 -6
- package/styles/ui-top-bar.css +24 -1
- package/vanilla/UiCombobox.d.ts +1 -0
- package/vanilla/UiCombobox.js +88 -82
- package/vanilla/UiTopBar.d.ts +1 -0
- package/vanilla/UiTopBar.js +50 -13
- package/vue/UiCombobox.d.ts +6 -0
- package/vue/UiCombobox.vue +76 -9
- package/vue/UiTopBar.d.ts +17 -1
- package/vue/UiTopBar.vue +171 -3
- package/vue/chunks/UiAffordanceScope.js +1 -1
- package/vue/chunks/UiAvatar.js +1 -1
- package/vue/chunks/UiAvatarGroup.js +1 -1
- package/vue/chunks/UiBadge.js +1 -1
- package/vue/chunks/UiBreadcrumbItem.js +1 -1
- package/vue/chunks/UiBreadcrumbs.js +1 -1
- package/vue/chunks/UiButton.js +1 -1
- package/vue/chunks/UiCallout.js +1 -1
- package/vue/chunks/UiCard.js +1 -1
- package/vue/chunks/UiCheckbox.js +1 -1
- package/vue/chunks/UiCluster.js +1 -1
- package/vue/chunks/UiColorPicker.js +1 -1
- package/vue/chunks/UiCombobox.js +74 -53
- package/vue/chunks/UiContainer.js +1 -1
- package/vue/chunks/UiContextMenu.js +1 -1
- package/vue/chunks/UiCover.js +1 -1
- package/vue/chunks/UiCurveEditor.js +1 -1
- package/vue/chunks/UiCycleButton.js +1 -1
- package/vue/chunks/UiDescriptionItem.js +1 -1
- package/vue/chunks/UiDescriptionList.js +1 -1
- package/vue/chunks/UiDialog.js +1 -1
- package/vue/chunks/UiDisclosure.js +1 -1
- package/vue/chunks/UiEditable.js +1 -1
- package/vue/chunks/UiEditorBlockActions.js +1 -1
- package/vue/chunks/UiEditorChipEditor.js +1 -1
- package/vue/chunks/UiEditorCodeLanguage.js +1 -1
- package/vue/chunks/UiEditorFootnoteEditor.js +1 -1
- package/vue/chunks/UiEditorImageToolbar.js +1 -1
- package/vue/chunks/UiEditorInsertTableGrid.js +1 -1
- package/vue/chunks/UiEditorLinkCard.js +1 -1
- package/vue/chunks/UiEditorLinkForm.js +1 -1
- package/vue/chunks/UiEditorMentionMenu.js +1 -1
- package/vue/chunks/UiEditorMentionMenuItem.js +1 -1
- package/vue/chunks/UiEditorSlashMenu.js +1 -1
- package/vue/chunks/UiEditorSlashMenuGroup.js +1 -1
- package/vue/chunks/UiEditorSlashMenuItem.js +1 -1
- package/vue/chunks/UiEditorSurface.js +1 -1
- package/vue/chunks/UiEditorTableContextMenu.js +1 -1
- package/vue/chunks/UiEditorTableOverlay.js +1 -1
- package/vue/chunks/UiEditorTableToolbar.js +1 -1
- package/vue/chunks/UiEditorToolbar.js +1 -1
- package/vue/chunks/UiFloatingActionButton.js +1 -1
- package/vue/chunks/UiFormField.js +1 -1
- package/vue/chunks/UiGrid.js +1 -1
- package/vue/chunks/UiIcon.js +1 -1
- package/vue/chunks/UiIconButton.js +1 -1
- package/vue/chunks/UiImage.js +1 -1
- package/vue/chunks/UiInput.js +1 -1
- package/vue/chunks/UiInputGroup.js +1 -1
- package/vue/chunks/UiLightEditor.js +1 -1
- package/vue/chunks/UiList.js +1 -1
- package/vue/chunks/UiListItem.js +1 -1
- package/vue/chunks/UiListbox.js +1 -1
- package/vue/chunks/UiMenu.js +1 -1
- package/vue/chunks/UiMenuGroup.js +1 -1
- package/vue/chunks/UiMenuItem.js +1 -1
- package/vue/chunks/UiMeter.js +1 -1
- package/vue/chunks/UiNavItem.js +1 -1
- package/vue/chunks/UiNumberInput.js +1 -1
- package/vue/chunks/UiPageHeader.js +1 -1
- package/vue/chunks/UiPagination.js +1 -1
- package/vue/chunks/UiPopover.js +1 -1
- package/vue/chunks/UiRadio.js +1 -1
- package/vue/chunks/UiRadioGroup.js +1 -1
- package/vue/chunks/UiReel.js +1 -1
- package/vue/chunks/UiScrollArea.js +1 -1
- package/vue/chunks/UiSearchResultRow.js +1 -1
- package/vue/chunks/UiSearchShell.js +1 -1
- package/vue/chunks/UiSection.js +1 -1
- package/vue/chunks/UiSelect.js +1 -1
- package/vue/chunks/UiSeparator.js +1 -1
- package/vue/chunks/UiSidebar.js +1 -1
- package/vue/chunks/UiSiteHeader.js +1 -1
- package/vue/chunks/UiSkeleton.js +1 -1
- package/vue/chunks/UiSlider.js +1 -1
- package/vue/chunks/UiSpinner.js +1 -1
- package/vue/chunks/UiStack.js +1 -1
- package/vue/chunks/UiStatusMessage.js +1 -1
- package/vue/chunks/UiSwatch.js +1 -1
- package/vue/chunks/UiSwitch.js +1 -1
- package/vue/chunks/UiSwitcher.js +1 -1
- package/vue/chunks/UiTable.js +1 -1
- package/vue/chunks/UiTabs.js +1 -1
- package/vue/chunks/UiText.js +1 -1
- package/vue/chunks/UiTextarea.js +1 -1
- package/vue/chunks/UiToast.js +1 -1
- package/vue/chunks/UiToastRegion.js +1 -1
- package/vue/chunks/UiTooltip.js +1 -1
- package/vue/chunks/UiTopBar.js +105 -17
- package/vue/chunks/UiTree.js +1 -1
- package/vue/chunks/UiTreeItem.js +1 -1
- package/vue/chunks/props.js +1 -1
- package/vue/components.css +65 -8
|
@@ -47,6 +47,9 @@
|
|
|
47
47
|
>Lets the user choose several options. Each choice becomes a removable badge before the input, the list stays open between picks, and choosing a checked
|
|
48
48
|
option removes it. items-change then reports the whole list of items, and selected-values-change the list of their values; use selectedValues or items,
|
|
49
49
|
not value, in this mode.</prop>
|
|
50
|
+
<prop name="maxRows" type="integer" default="1"
|
|
51
|
+
>Visible rows of selected items and typing space in multiple mode. More than one lets the field grow and wrap before extra rows scroll vertically inside it.
|
|
52
|
+
One or less keeps the single horizontally scrolling row; single-selection fields are unchanged.</prop>
|
|
50
53
|
<prop name="tokenSeparators" type="list(string)"
|
|
51
54
|
>Keys that commit the typed text in multiple mode, as KeyboardEvent key values such as "," or ";". The text is added as the option whose label matches it,
|
|
52
55
|
ignoring case, or with allowCreate is reported as create-item; otherwise it stays in the input.</prop>
|
|
@@ -427,7 +430,7 @@
|
|
|
427
430
|
*</template></label>
|
|
428
431
|
<div class="control">
|
|
429
432
|
<div class="field" $ref="field">
|
|
430
|
-
<div class="entry">
|
|
433
|
+
<div class="entry" class:multiline="$multiple and $maxRows > 1" style:--_max-rows="$maxRows">
|
|
431
434
|
<span class="start"><slot name="start"></slot></span>
|
|
432
435
|
<template $if="$multiple">
|
|
433
436
|
<button
|
|
@@ -850,6 +853,7 @@
|
|
|
850
853
|
/* Multiple mode keeps one control height. Chips and the input scroll within the entry,
|
|
851
854
|
while the clear and disclosure controls remain fixed at the end of the field. */
|
|
852
855
|
:host([multiple]) .field {
|
|
856
|
+
--_item-row: 1.75rem;
|
|
853
857
|
align-items: center !important;
|
|
854
858
|
min-block-size: var(--_ui-combobox-item-min-block-size, var(--_row));
|
|
855
859
|
padding: var(--ui-space-1) !important;
|
|
@@ -867,24 +871,39 @@
|
|
|
867
871
|
max-block-size: none;
|
|
868
872
|
flex: 1 0 var(--_ui-combobox-item-input-min-inline-size, 5rem);
|
|
869
873
|
width: auto;
|
|
870
|
-
min-block-size:
|
|
874
|
+
min-block-size: var(--_item-row);
|
|
871
875
|
padding: var(--ui-space-0-5) var(--ui-space-1) !important;
|
|
872
876
|
}
|
|
873
877
|
/* Size variants keep their control height as selections are added. */
|
|
874
878
|
:host([multiple]):host([size="sm"]) .field {
|
|
879
|
+
--_item-row: calc(var(--_row) - 2 * var(--ui-border-width) - 2 * var(--ui-space-0-5));
|
|
875
880
|
min-block-size: 0;
|
|
876
881
|
padding: var(--ui-space-0-5) !important;
|
|
877
882
|
}
|
|
878
883
|
:host([multiple]):host([size="sm"]) input {
|
|
879
|
-
min-block-size:
|
|
884
|
+
min-block-size: var(--_item-row);
|
|
880
885
|
padding: 0 var(--ui-space-1) !important;
|
|
881
886
|
}
|
|
882
887
|
/* A large multiple field starts at the large control height, as sm starts at the small one. */
|
|
883
888
|
:host([multiple]):host([size="lg"]) .field {
|
|
889
|
+
--_item-row: calc(var(--ui-control-size-lg) - 2 * var(--ui-border-width) - 2 * var(--ui-space-1));
|
|
884
890
|
min-block-size: 0;
|
|
885
891
|
}
|
|
886
892
|
:host([multiple]):host([size="lg"]) input {
|
|
887
|
-
min-block-size:
|
|
893
|
+
min-block-size: var(--_item-row);
|
|
894
|
+
}
|
|
895
|
+
/* Grow through the requested rows, then keep the typing row in a bounded field.
|
|
896
|
+
The entry owns its scroll; clear/disclosure actions remain outside it. */
|
|
897
|
+
:host([multiple]) .entry.multiline {
|
|
898
|
+
--_entry-row: max(var(--ui-badge-min-block-size, 1.5rem), var(--_item-row));
|
|
899
|
+
flex-wrap: wrap !important;
|
|
900
|
+
align-content: flex-start !important;
|
|
901
|
+
max-block-size: calc(var(--_max-rows) * var(--_entry-row) + (var(--_max-rows) - 1) * var(--ui-space-1));
|
|
902
|
+
overflow-x: hidden;
|
|
903
|
+
overflow-y: auto;
|
|
904
|
+
}
|
|
905
|
+
.entry.multiline .item {
|
|
906
|
+
min-block-size: var(--_entry-row);
|
|
888
907
|
}
|
|
889
908
|
.item {
|
|
890
909
|
appearance: none;
|
|
@@ -497,6 +497,9 @@ export function connect(host) {
|
|
|
497
497
|
void validateCurrent();
|
|
498
498
|
};
|
|
499
499
|
const onFocusin = (event) => {
|
|
500
|
+
if (host.props.multiple.value && host.props.maxRows.value > 1 && field.contains(event.target)) {
|
|
501
|
+
revealActiveItem(field, () => document.activeElement);
|
|
502
|
+
}
|
|
500
503
|
if (event.target === input && host.props.openOnFocus.value && !host.state.expanded && !suppressFocusOpening) openFromField();
|
|
501
504
|
};
|
|
502
505
|
const onCompositionstart = (event) => { if (event.target === input) composing = true; };
|
|
@@ -585,10 +588,13 @@ export function connect(host) {
|
|
|
585
588
|
if (host.props.query.value !== lastQuery) { lastQuery = host.props.query.value; syncQuery(); }
|
|
586
589
|
if (host.props.disabled.value || host.props.readonly.value) close();
|
|
587
590
|
updateView();
|
|
591
|
+
if (host.props.multiple.value && host.props.maxRows.value > 1
|
|
592
|
+
&& document.activeElement && field.contains(document.activeElement)) revealActiveItem(field, () => document.activeElement);
|
|
588
593
|
});
|
|
589
594
|
|
|
590
595
|
return () => {
|
|
591
596
|
alive = false;
|
|
597
|
+
cancelActiveItemReveal(field);
|
|
592
598
|
stop();
|
|
593
599
|
stopReset();
|
|
594
600
|
observer.disconnect();
|
|
@@ -1,7 +1,17 @@
|
|
|
1
|
-
<template component="ui-top-bar">
|
|
1
|
+
<template component="ui-top-bar" module="./ui-top-bar.js">
|
|
2
|
+
<defs>
|
|
3
|
+
<prop name="titleFor" type="string" default=""
|
|
4
|
+
>The ID of the page heading represented by the default title slot. While that heading is visible below the sticky bar, its duplicate title is concealed.
|
|
5
|
+
After the heading scrolls above the bar, the single-line title slides up and fades in. Leading and action slots stay available, and the bar keeps its
|
|
6
|
+
size. Omit it for an always-visible title. Reduced motion removes the transition.</prop>
|
|
7
|
+
<state name="titleOutOfView" type="boolean" value="false"></state>
|
|
8
|
+
<computed name="titleHidden" from="not ($titleFor = '') and not $titleOutOfView"></computed>
|
|
9
|
+
</defs>
|
|
2
10
|
<header>
|
|
3
11
|
<div class="leading"><slot name="leading"></slot></div>
|
|
4
|
-
<div class="title"
|
|
12
|
+
<div class="title" class:scroll-title="not ($titleFor = '')" class:concealed="$titleHidden" from:aria-hidden="$titleHidden" from:inert="$titleHidden">
|
|
13
|
+
<slot></slot>
|
|
14
|
+
</div>
|
|
5
15
|
<div class="search"><slot name="search"></slot></div>
|
|
6
16
|
<div class="actions"><slot name="actions"></slot></div>
|
|
7
17
|
</header>
|
|
@@ -40,6 +50,26 @@
|
|
|
40
50
|
min-inline-size: 0;
|
|
41
51
|
flex: 1;
|
|
42
52
|
}
|
|
53
|
+
.title.scroll-title {
|
|
54
|
+
overflow: hidden;
|
|
55
|
+
white-space: nowrap;
|
|
56
|
+
text-overflow: ellipsis;
|
|
57
|
+
opacity: 1;
|
|
58
|
+
transform: translateY(0);
|
|
59
|
+
transition: opacity var(--ui-motion-fast) var(--ui-motion-ease), transform var(--ui-motion-fast) var(--ui-motion-ease);
|
|
60
|
+
}
|
|
61
|
+
.title.scroll-title.concealed {
|
|
62
|
+
opacity: 0;
|
|
63
|
+
transform: translateY(var(--ui-space-2));
|
|
64
|
+
pointer-events: none;
|
|
65
|
+
}
|
|
66
|
+
@media (prefers-reduced-motion: reduce) {
|
|
67
|
+
.title.scroll-title,
|
|
68
|
+
.title.scroll-title.concealed {
|
|
69
|
+
transition: none;
|
|
70
|
+
transform: none;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
43
73
|
|
|
44
74
|
/* An unused region takes no space, so it adds no gap. */
|
|
45
75
|
.leading:empty,
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { createIdResolver } from "../shared/overlay.js";
|
|
2
|
+
|
|
3
|
+
/** Reveal the duplicate title at the sticky edge; scroll never drives animation progress. */
|
|
4
|
+
export function connect(host) {
|
|
5
|
+
const element = host.element;
|
|
6
|
+
const document = element.ownerDocument;
|
|
7
|
+
const view = document.defaultView;
|
|
8
|
+
let observer = null;
|
|
9
|
+
let heading = null;
|
|
10
|
+
let bottom = -1;
|
|
11
|
+
let frame = 0;
|
|
12
|
+
let alive = true;
|
|
13
|
+
const resolver = createIdResolver(document, () => sync());
|
|
14
|
+
|
|
15
|
+
function sync() {
|
|
16
|
+
if (!alive) return;
|
|
17
|
+
const id = host.props.titleFor.value;
|
|
18
|
+
const next = resolver.get(id);
|
|
19
|
+
const edge = Math.max(0, element.getBoundingClientRect().bottom);
|
|
20
|
+
if (next === heading && Math.abs(edge - bottom) < 0.5 && observer) return;
|
|
21
|
+
observer?.disconnect();
|
|
22
|
+
observer = null;
|
|
23
|
+
heading = next;
|
|
24
|
+
bottom = edge;
|
|
25
|
+
if (!id || !heading || !view.IntersectionObserver) {
|
|
26
|
+
host.state.titleOutOfView = Boolean(id);
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
observer = new view.IntersectionObserver(entries => {
|
|
30
|
+
if (!alive) return;
|
|
31
|
+
const entry = entries.at(-1);
|
|
32
|
+
if (entry?.target !== heading) return;
|
|
33
|
+
if (!heading?.isConnected) { sync(); return; }
|
|
34
|
+
host.state.titleOutOfView = !entry.isIntersecting && entry.boundingClientRect.top < bottom;
|
|
35
|
+
}, { rootMargin: `-${bottom}px 0px 0px 0px` });
|
|
36
|
+
observer.observe(heading);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// Nested scrollports may move the bar before it becomes sticky. Rebuild its
|
|
40
|
+
// observation boundary only when that edge changes, not for every scroll tick.
|
|
41
|
+
const schedule = () => {
|
|
42
|
+
if (frame || !host.props.titleFor.value) return;
|
|
43
|
+
frame = view.requestAnimationFrame(() => { frame = 0; sync(); });
|
|
44
|
+
};
|
|
45
|
+
const resize = new view.ResizeObserver(schedule);
|
|
46
|
+
resize.observe(element);
|
|
47
|
+
document.addEventListener("scroll", schedule, { capture: true, passive: true });
|
|
48
|
+
view.addEventListener("resize", schedule);
|
|
49
|
+
const stop = host.effect(sync);
|
|
50
|
+
return () => {
|
|
51
|
+
alive = false;
|
|
52
|
+
stop();
|
|
53
|
+
resolver.stop();
|
|
54
|
+
observer?.disconnect();
|
|
55
|
+
resize.disconnect();
|
|
56
|
+
if (frame) view.cancelAnimationFrame(frame);
|
|
57
|
+
document.removeEventListener("scroll", schedule, true);
|
|
58
|
+
view.removeEventListener("resize", schedule);
|
|
59
|
+
};
|
|
60
|
+
}
|