@threadlabs/looma 0.47.0 → 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.
Files changed (120) hide show
  1. package/components/ui-button/ui-button.html +3 -7
  2. package/components/ui-combobox/ui-combobox.html +23 -4
  3. package/components/ui-combobox/ui-combobox.js +6 -0
  4. package/components/ui-icon-button/ui-icon-button.html +3 -8
  5. package/components/ui-top-bar/ui-top-bar.html +32 -2
  6. package/components/ui-top-bar/ui-top-bar.js +60 -0
  7. package/dist/index.js +4 -3
  8. package/docs/README.md +1 -1
  9. package/docs/catalog.json +67 -12
  10. package/docs/customizer-render.mjs +3 -3
  11. package/docs/customizer.js +1 -7
  12. package/docs/theme.mjs +43 -12
  13. package/package.json +1 -1
  14. package/styles/ui-button.css +3 -7
  15. package/styles/ui-combobox.css +40 -6
  16. package/styles/ui-icon-button.css +3 -8
  17. package/styles/ui-top-bar.css +24 -1
  18. package/vanilla/UiCombobox.d.ts +1 -0
  19. package/vanilla/UiCombobox.js +88 -82
  20. package/vanilla/UiTopBar.d.ts +1 -0
  21. package/vanilla/UiTopBar.js +50 -13
  22. package/vue/UiButton.vue +3 -7
  23. package/vue/UiCombobox.d.ts +6 -0
  24. package/vue/UiCombobox.vue +76 -9
  25. package/vue/UiIconButton.vue +3 -8
  26. package/vue/UiTopBar.d.ts +17 -1
  27. package/vue/UiTopBar.vue +171 -3
  28. package/vue/chunks/UiAffordanceScope.js +1 -1
  29. package/vue/chunks/UiAvatar.js +1 -1
  30. package/vue/chunks/UiAvatarGroup.js +1 -1
  31. package/vue/chunks/UiBadge.js +1 -1
  32. package/vue/chunks/UiBreadcrumbItem.js +1 -1
  33. package/vue/chunks/UiBreadcrumbs.js +1 -1
  34. package/vue/chunks/UiButton.js +2 -2
  35. package/vue/chunks/UiCallout.js +1 -1
  36. package/vue/chunks/UiCard.js +1 -1
  37. package/vue/chunks/UiCheckbox.js +1 -1
  38. package/vue/chunks/UiCluster.js +1 -1
  39. package/vue/chunks/UiColorPicker.js +1 -1
  40. package/vue/chunks/UiCombobox.js +74 -53
  41. package/vue/chunks/UiContainer.js +1 -1
  42. package/vue/chunks/UiContextMenu.js +1 -1
  43. package/vue/chunks/UiCover.js +1 -1
  44. package/vue/chunks/UiCurveEditor.js +1 -1
  45. package/vue/chunks/UiCycleButton.js +1 -1
  46. package/vue/chunks/UiDescriptionItem.js +1 -1
  47. package/vue/chunks/UiDescriptionList.js +1 -1
  48. package/vue/chunks/UiDialog.js +1 -1
  49. package/vue/chunks/UiDisclosure.js +1 -1
  50. package/vue/chunks/UiEditable.js +1 -1
  51. package/vue/chunks/UiEditorBlockActions.js +1 -1
  52. package/vue/chunks/UiEditorChipEditor.js +1 -1
  53. package/vue/chunks/UiEditorCodeLanguage.js +1 -1
  54. package/vue/chunks/UiEditorFootnoteEditor.js +1 -1
  55. package/vue/chunks/UiEditorImageToolbar.js +1 -1
  56. package/vue/chunks/UiEditorInsertTableGrid.js +1 -1
  57. package/vue/chunks/UiEditorLinkCard.js +1 -1
  58. package/vue/chunks/UiEditorLinkForm.js +1 -1
  59. package/vue/chunks/UiEditorMentionMenu.js +1 -1
  60. package/vue/chunks/UiEditorMentionMenuItem.js +1 -1
  61. package/vue/chunks/UiEditorSlashMenu.js +1 -1
  62. package/vue/chunks/UiEditorSlashMenuGroup.js +1 -1
  63. package/vue/chunks/UiEditorSlashMenuItem.js +1 -1
  64. package/vue/chunks/UiEditorSurface.js +1 -1
  65. package/vue/chunks/UiEditorTableContextMenu.js +1 -1
  66. package/vue/chunks/UiEditorTableOverlay.js +1 -1
  67. package/vue/chunks/UiEditorTableToolbar.js +1 -1
  68. package/vue/chunks/UiEditorToolbar.js +1 -1
  69. package/vue/chunks/UiFloatingActionButton.js +1 -1
  70. package/vue/chunks/UiFormField.js +1 -1
  71. package/vue/chunks/UiGrid.js +1 -1
  72. package/vue/chunks/UiIcon.js +1 -1
  73. package/vue/chunks/UiIconButton.js +2 -2
  74. package/vue/chunks/UiImage.js +1 -1
  75. package/vue/chunks/UiInput.js +1 -1
  76. package/vue/chunks/UiInputGroup.js +1 -1
  77. package/vue/chunks/UiLightEditor.js +1 -1
  78. package/vue/chunks/UiList.js +1 -1
  79. package/vue/chunks/UiListItem.js +1 -1
  80. package/vue/chunks/UiListbox.js +1 -1
  81. package/vue/chunks/UiMenu.js +1 -1
  82. package/vue/chunks/UiMenuGroup.js +1 -1
  83. package/vue/chunks/UiMenuItem.js +1 -1
  84. package/vue/chunks/UiMeter.js +1 -1
  85. package/vue/chunks/UiNavItem.js +1 -1
  86. package/vue/chunks/UiNumberInput.js +1 -1
  87. package/vue/chunks/UiPageHeader.js +1 -1
  88. package/vue/chunks/UiPagination.js +1 -1
  89. package/vue/chunks/UiPopover.js +1 -1
  90. package/vue/chunks/UiRadio.js +1 -1
  91. package/vue/chunks/UiRadioGroup.js +1 -1
  92. package/vue/chunks/UiReel.js +1 -1
  93. package/vue/chunks/UiScrollArea.js +1 -1
  94. package/vue/chunks/UiSearchResultRow.js +1 -1
  95. package/vue/chunks/UiSearchShell.js +1 -1
  96. package/vue/chunks/UiSection.js +1 -1
  97. package/vue/chunks/UiSelect.js +1 -1
  98. package/vue/chunks/UiSeparator.js +1 -1
  99. package/vue/chunks/UiSidebar.js +1 -1
  100. package/vue/chunks/UiSiteHeader.js +1 -1
  101. package/vue/chunks/UiSkeleton.js +1 -1
  102. package/vue/chunks/UiSlider.js +1 -1
  103. package/vue/chunks/UiSpinner.js +1 -1
  104. package/vue/chunks/UiStack.js +1 -1
  105. package/vue/chunks/UiStatusMessage.js +1 -1
  106. package/vue/chunks/UiSwatch.js +1 -1
  107. package/vue/chunks/UiSwitch.js +1 -1
  108. package/vue/chunks/UiSwitcher.js +1 -1
  109. package/vue/chunks/UiTable.js +1 -1
  110. package/vue/chunks/UiTabs.js +1 -1
  111. package/vue/chunks/UiText.js +1 -1
  112. package/vue/chunks/UiTextarea.js +1 -1
  113. package/vue/chunks/UiToast.js +1 -1
  114. package/vue/chunks/UiToastRegion.js +1 -1
  115. package/vue/chunks/UiTooltip.js +1 -1
  116. package/vue/chunks/UiTopBar.js +105 -17
  117. package/vue/chunks/UiTree.js +1 -1
  118. package/vue/chunks/UiTreeItem.js +1 -1
  119. package/vue/chunks/props.js +1 -1
  120. package/vue/components.css +77 -38
@@ -318,14 +318,11 @@
318
318
  }
319
319
 
320
320
  :host[data-appearance="outline"]:not([data-tone="neutral"]) {
321
- --_outline-highlight: var(--ui-surface-highlight, linear-gradient(transparent, transparent));
322
321
  --_outline-wash: var(--_tone-wash);
323
322
  border-color: var(--ui-button-border, var(--_tone-outline-border, var(--_tone-text)));
324
323
  background-color: var(--ui-button-surface, transparent);
325
324
  box-shadow: var(--ui-button-shadow, var(--ui-neutral-shadow));
326
- background-image:
327
- linear-gradient(var(--_outline-wash), var(--_outline-wash)),
328
- var(--_outline-highlight);
325
+ background-image: linear-gradient(var(--_outline-wash), var(--_outline-wash));
329
326
  }
330
327
 
331
328
  :host[data-appearance="outline"]:not([data-tone="neutral"]):hover:not(:disabled, [aria-disabled="true"]) {
@@ -451,15 +448,14 @@
451
448
  :host[data-tone="neutral"][data-appearance="outline"] {
452
449
  border-color: var(--ui-button-border, var(--ui-control-border));
453
450
  background-color: var(--ui-button-surface, transparent);
451
+ background-image: none;
454
452
  box-shadow: var(--ui-button-shadow, var(--ui-neutral-shadow));
455
453
  }
456
454
  :host[data-tone="neutral"][data-appearance="outline"]:hover:not(:disabled, [aria-disabled="true"]) {
457
455
  border-color: var(--ui-button-hover-border, var(--ui-control-border-hover));
458
456
  background-color: var(--ui-button-hover-surface, transparent);
459
457
  --_outline-wash: var(--ui-neutral-wash-hover);
460
- background-image:
461
- linear-gradient(var(--_outline-wash), var(--_outline-wash)),
462
- var(--ui-surface-highlight, linear-gradient(transparent, transparent));
458
+ background-image: linear-gradient(var(--_outline-wash), var(--_outline-wash));
463
459
  }
464
460
  :host[data-tone="neutral"][data-appearance="outline"]:active:not(:disabled, [aria-disabled="true"]) {
465
461
  background-image: none;
@@ -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: 1.75rem;
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: calc(var(--_row) - 2 * var(--ui-border-width) - 2 * var(--ui-space-0-5));
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: calc(var(--ui-control-size-lg) - 2 * var(--ui-border-width) - 2 * var(--ui-space-1));
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();
@@ -414,7 +414,7 @@
414
414
  :host[data-appearance="outline"] {
415
415
  border-color: var(--ui-icon-button-border, var(--_icon-button-border, var(--ui-control-border, var(--ui-border-strong))));
416
416
  background-color: var(--ui-icon-button-outline-surface, var(--_icon-button-outline-surface, var(--ui-surface-default)));
417
- background-image: var(--ui-surface-highlight, none);
417
+ background-image: none;
418
418
  color: var(--ui-icon-button-outline-text, var(--_icon-button-text, var(--ui-text-primary)));
419
419
  box-shadow: var(--ui-neutral-shadow);
420
420
  }
@@ -444,13 +444,10 @@
444
444
  }
445
445
 
446
446
  :host[data-appearance="outline"]:not([data-tone="neutral"]) {
447
- --_outline-highlight: var(--ui-surface-highlight, linear-gradient(transparent, transparent));
448
447
  --_outline-wash: var(--_tone-wash);
449
448
  border-color: var(--ui-icon-button-border, var(--_tone-outline-border));
450
449
  background-color: var(--ui-icon-button-outline-surface, transparent);
451
- background-image:
452
- linear-gradient(var(--_outline-wash), var(--_outline-wash)),
453
- var(--_outline-highlight);
450
+ background-image: linear-gradient(var(--_outline-wash), var(--_outline-wash));
454
451
  }
455
452
 
456
453
  :host[data-appearance="outline"]:not([data-tone="neutral"]):hover:enabled:not([aria-disabled="true"]) {
@@ -465,9 +462,7 @@
465
462
  :host[data-tone="neutral"][data-appearance="outline"]:hover:enabled:not([aria-disabled="true"]) {
466
463
  background-color: var(--ui-icon-button-hover-surface, transparent);
467
464
  --_outline-wash: var(--ui-neutral-wash-hover);
468
- background-image:
469
- linear-gradient(var(--_outline-wash), var(--_outline-wash)),
470
- var(--ui-surface-highlight, linear-gradient(transparent, transparent));
465
+ background-image: linear-gradient(var(--_outline-wash), var(--_outline-wash));
471
466
  }
472
467
  :host[data-tone="neutral"][data-appearance="outline"]:active:enabled:not([aria-disabled="true"]) {
473
468
  background-color: var(--ui-icon-button-active-surface, var(--ui-neutral-active));
@@ -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"><slot></slot></div>
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
+ }