@threadlabs/looma 0.53.9 → 0.53.11

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 (74) hide show
  1. package/README.md +16 -0
  2. package/blocks/editor-workspace.html +53 -0
  3. package/blocks/editor-workspace.js +15 -0
  4. package/blocks/list-detail.html +54 -0
  5. package/blocks/list-detail.js +62 -0
  6. package/blocks/search-and-open.html +33 -0
  7. package/blocks/search-and-open.js +53 -0
  8. package/blocks/settings-form.html +26 -0
  9. package/blocks/settings-form.js +16 -0
  10. package/components/shared/behaviors.d.ts +2 -0
  11. package/components/shared/behaviors.js +2 -0
  12. package/components/shared/collection-navigation.d.ts +28 -0
  13. package/components/shared/collection-navigation.js +40 -0
  14. package/components/shared/deferred-focus.d.ts +8 -0
  15. package/components/shared/deferred-focus.js +21 -0
  16. package/components/shared/form-reset.js +14 -6
  17. package/components/shared/menu-navigation.js +19 -22
  18. package/components/shared/overlay-dismissal.js +7 -0
  19. package/components/shared/overlay.js +3 -2
  20. package/components/ui-button/ui-button.html +1 -0
  21. package/components/ui-checkbox/ui-checkbox.html +1 -0
  22. package/components/ui-color-picker/ui-color-picker.html +1 -1
  23. package/components/ui-combobox/ui-combobox.html +5 -2
  24. package/components/ui-combobox/ui-combobox.js +6 -6
  25. package/components/ui-date-picker/ui-date-picker.js +5 -6
  26. package/components/ui-date-range-picker/ui-date-range-picker.js +6 -8
  27. package/components/ui-disclosure/ui-disclosure.html +3 -2
  28. package/components/ui-editor-toolbar/ui-editor-toolbar.js +8 -6
  29. package/components/ui-form-field/ui-form-field.html +1 -1
  30. package/components/ui-input/ui-input.html +1 -0
  31. package/components/ui-list-item/ui-list-item.html +3 -3
  32. package/components/ui-listbox/ui-listbox.html +1 -0
  33. package/components/ui-listbox/ui-listbox.js +10 -16
  34. package/components/ui-menu/ui-menu.html +1 -1
  35. package/components/ui-menu-item/ui-menu-item.html +1 -1
  36. package/components/ui-nav-item/ui-nav-item.html +2 -2
  37. package/components/ui-radio/ui-radio.html +1 -0
  38. package/components/ui-radio-group/ui-radio-group.html +1 -0
  39. package/components/ui-search-shell/ui-search-shell.js +4 -5
  40. package/components/ui-segmented-control/ui-segmented-control.html +3 -2
  41. package/components/ui-select/ui-select.html +4 -1
  42. package/components/ui-sidebar/ui-sidebar.html +7 -0
  43. package/components/ui-switch/ui-switch.html +1 -0
  44. package/components/ui-switcher/ui-switcher.html +28 -1
  45. package/components/ui-tabs/ui-tabs.js +5 -3
  46. package/components/ui-textarea/ui-textarea.html +5 -2
  47. package/dist/index.js +1 -1
  48. package/docs/catalog.json +80 -32
  49. package/editor/components.css +7 -3
  50. package/editor/index.js +77 -43
  51. package/package.json +8 -1
  52. package/styles/ui-button.css +1 -0
  53. package/styles/ui-checkbox.css +1 -0
  54. package/styles/ui-color-picker.css +2 -2
  55. package/styles/ui-combobox.css +8 -4
  56. package/styles/ui-disclosure.css +2 -1
  57. package/styles/ui-form-field.css +1 -1
  58. package/styles/ui-input.css +1 -0
  59. package/styles/ui-list-item.css +3 -3
  60. package/styles/ui-listbox.css +2 -0
  61. package/styles/ui-menu-item.css +1 -1
  62. package/styles/ui-nav-item.css +1 -1
  63. package/styles/ui-radio-group.css +1 -0
  64. package/styles/ui-radio.css +1 -0
  65. package/styles/ui-segmented-control.css +3 -2
  66. package/styles/ui-select.css +4 -1
  67. package/styles/ui-sidebar.css +12 -1
  68. package/styles/ui-switch.css +1 -0
  69. package/styles/ui-switcher.css +22 -1
  70. package/styles/ui-textarea.css +5 -2
  71. package/theme-system.css +3 -2
  72. package/tokens.css +1 -1
  73. package/vanilla/UiSwitcher.d.ts +2 -1
  74. package/vanilla/UiSwitcher.js +96 -16
package/docs/catalog.json CHANGED
@@ -683,7 +683,7 @@
683
683
  "tag": "ui-switcher",
684
684
  "package": "@threadlabs/looma",
685
685
  "root": "div",
686
- "angularHost": "div",
686
+ "angularHost": "ng-template",
687
687
  "resource": "@threadlabs/looma/components/ui-switcher/ui-switcher.html"
688
688
  },
689
689
  {
@@ -780,7 +780,7 @@
780
780
  ],
781
781
  "schemaVersion": 1,
782
782
  "package": "@threadlabs/looma",
783
- "version": "0.53.9",
783
+ "version": "0.53.11",
784
784
  "groups": [
785
785
  {
786
786
  "id": "layout",
@@ -8186,7 +8186,7 @@
8186
8186
  {
8187
8187
  "name": "--ui-combobox-label-font-size",
8188
8188
  "fallbacks": [
8189
- "var(--ui-field-label-font-size, var(--ui-font-size-md))"
8189
+ "var(--ui-field-label-font-size, var(--ui-font-size-sm))"
8190
8190
  ]
8191
8191
  },
8192
8192
  {
@@ -8344,7 +8344,7 @@
8344
8344
  {
8345
8345
  "name": "--ui-field-label-font-size",
8346
8346
  "fallbacks": [
8347
- "var(--ui-font-size-md)"
8347
+ "var(--ui-font-size-sm)"
8348
8348
  ]
8349
8349
  },
8350
8350
  {
@@ -17052,9 +17052,6 @@
17052
17052
  {
17053
17053
  "name": "--ui-font-semibold"
17054
17054
  },
17055
- {
17056
- "name": "--ui-font-size-md"
17057
- },
17058
17055
  {
17059
17056
  "name": "--ui-font-size-sm"
17060
17057
  },
@@ -17139,7 +17136,7 @@
17139
17136
  {
17140
17137
  "name": "density",
17141
17138
  "property": "density",
17142
- "description": "Compact trades padding and type size for rows that fit more on screen.",
17139
+ "description": "Compact reduces row spacing while keeping the shared UI text size.",
17143
17140
  "type": "keyword",
17144
17141
  "valueType": {
17145
17142
  "kind": "terminal",
@@ -17247,7 +17244,7 @@
17247
17244
  "properties": [
17248
17245
  {
17249
17246
  "name": "density",
17250
- "description": "Compact trades padding and type size for rows that fit more on screen.",
17247
+ "description": "Compact reduces row spacing while keeping the shared UI text size.",
17251
17248
  "type": "\"comfortable\" | \"compact\"",
17252
17249
  "default": "comfortable",
17253
17250
  "options": [
@@ -18921,7 +18918,7 @@
18921
18918
  {
18922
18919
  "name": "--ui-form-field-label-font-size",
18923
18920
  "fallbacks": [
18924
- "var(--ui-field-label-font-size, var(--ui-font-size-md))"
18921
+ "var(--ui-field-label-font-size, var(--ui-font-size-sm))"
18925
18922
  ]
18926
18923
  },
18927
18924
  {
@@ -18950,12 +18947,9 @@
18950
18947
  {
18951
18948
  "name": "--ui-field-label-font-size",
18952
18949
  "fallbacks": [
18953
- "var(--ui-font-size-md)"
18950
+ "var(--ui-font-size-sm)"
18954
18951
  ]
18955
18952
  },
18956
- {
18957
- "name": "--ui-font-size-md"
18958
- },
18959
18953
  {
18960
18954
  "name": "--ui-font-size-sm"
18961
18955
  },
@@ -22666,10 +22660,10 @@
22666
22660
  "name": "--ui-font-size-lg"
22667
22661
  },
22668
22662
  {
22669
- "name": "--ui-font-size-md"
22663
+ "name": "--ui-font-size-sm"
22670
22664
  },
22671
22665
  {
22672
- "name": "--ui-font-size-sm"
22666
+ "name": "--ui-line-height"
22673
22667
  },
22674
22668
  {
22675
22669
  "name": "--ui-line-height-tight"
@@ -23019,6 +23013,9 @@
23019
23013
  {
23020
23014
  "name": "--ui-focus-width"
23021
23015
  },
23016
+ {
23017
+ "name": "--ui-font-size-sm"
23018
+ },
23022
23019
  {
23023
23020
  "name": "--ui-line-height-md"
23024
23021
  },
@@ -23419,7 +23416,7 @@
23419
23416
  {
23420
23417
  "name": "density",
23421
23418
  "property": "density",
23422
- "description": "Compact trades padding and type size for rows that fit more on screen.",
23419
+ "description": "Compact reduces row spacing while keeping the shared UI text size.",
23423
23420
  "type": "keyword",
23424
23421
  "valueType": {
23425
23422
  "kind": "terminal",
@@ -23505,7 +23502,7 @@
23505
23502
  "properties": [
23506
23503
  {
23507
23504
  "name": "density",
23508
- "description": "Compact trades padding and type size for rows that fit more on screen.",
23505
+ "description": "Compact reduces row spacing while keeping the shared UI text size.",
23509
23506
  "type": "\"comfortable\" | \"compact\"",
23510
23507
  "default": "comfortable",
23511
23508
  "options": [
@@ -23861,7 +23858,7 @@
23861
23858
  {
23862
23859
  "name": "--ui-menu-item-font-size",
23863
23860
  "fallbacks": [
23864
- "var(--ui-font-size-md)"
23861
+ "var(--ui-font-size-sm)"
23865
23862
  ]
23866
23863
  },
23867
23864
  {
@@ -23938,9 +23935,6 @@
23938
23935
  {
23939
23936
  "name": "--ui-font-normal"
23940
23937
  },
23941
- {
23942
- "name": "--ui-font-size-md"
23943
- },
23944
23938
  {
23945
23939
  "name": "--ui-font-size-sm"
23946
23940
  },
@@ -24668,9 +24662,6 @@
24668
24662
  {
24669
24663
  "name": "--ui-font-normal"
24670
24664
  },
24671
- {
24672
- "name": "--ui-font-size-md"
24673
- },
24674
24665
  {
24675
24666
  "name": "--ui-font-size-sm"
24676
24667
  },
@@ -24776,7 +24767,7 @@
24776
24767
  {
24777
24768
  "name": "density",
24778
24769
  "property": "density",
24779
- "description": "Compact uses smaller type and row spacing to sit alongside a compact tree; comfortable keeps the regular navigation row.",
24770
+ "description": "Compact reduces row spacing to sit alongside a compact tree; both densities keep the shared UI text size.",
24780
24771
  "type": "keyword",
24781
24772
  "valueType": {
24782
24773
  "kind": "terminal",
@@ -24860,7 +24851,7 @@
24860
24851
  },
24861
24852
  {
24862
24853
  "name": "density",
24863
- "description": "Compact uses smaller type and row spacing to sit alongside a compact tree; comfortable keeps the regular navigation row.",
24854
+ "description": "Compact reduces row spacing to sit alongside a compact tree; both densities keep the shared UI text size.",
24864
24855
  "type": "\"comfortable\" | \"compact\"",
24865
24856
  "default": "comfortable",
24866
24857
  "options": [
@@ -26805,9 +26796,18 @@
26805
26796
  "var(--ui-danger-solid)"
26806
26797
  ]
26807
26798
  },
26799
+ {
26800
+ "name": "--ui-field-label-font-size",
26801
+ "fallbacks": [
26802
+ "var(--ui-font-size-sm)"
26803
+ ]
26804
+ },
26808
26805
  {
26809
26806
  "name": "--ui-font-medium"
26810
26807
  },
26808
+ {
26809
+ "name": "--ui-font-size-sm"
26810
+ },
26811
26811
  {
26812
26812
  "name": "--ui-space-2"
26813
26813
  },
@@ -28407,6 +28407,12 @@
28407
28407
  "var(--ui-danger-solid)"
28408
28408
  ]
28409
28409
  },
28410
+ {
28411
+ "name": "--ui-field-label-font-size",
28412
+ "fallbacks": [
28413
+ "var(--ui-font-size-sm)"
28414
+ ]
28415
+ },
28410
28416
  {
28411
28417
  "name": "--ui-field-radius",
28412
28418
  "fallbacks": [
@@ -28422,9 +28428,6 @@
28422
28428
  {
28423
28429
  "name": "--ui-font-medium"
28424
28430
  },
28425
- {
28426
- "name": "--ui-font-size-lg"
28427
- },
28428
28431
  {
28429
28432
  "name": "--ui-font-size-md"
28430
28433
  },
@@ -31651,11 +31654,11 @@
31651
31654
  ]
31652
31655
  },
31653
31656
  {
31654
- "angularHost": "div",
31657
+ "angularHost": "ng-template",
31655
31658
  "tag": "ui-switcher",
31656
31659
  "package": "@threadlabs/looma",
31657
31660
  "root": "div",
31658
- "description": "Intrinsic equal-column layout that stacks when its own container becomes too narrow.",
31661
+ "description": "Intrinsic layout that stacks when its container becomes too narrow, with equal columns or a narrower rail beside the detail.",
31659
31662
  "designTokens": {
31660
31663
  "sources": [
31661
31664
  "packages/looma/src/components/ui-switcher/ui-switcher.html"
@@ -31716,6 +31719,22 @@
31716
31719
  "stretch"
31717
31720
  ]
31718
31721
  },
31722
+ {
31723
+ "name": "balance",
31724
+ "property": "balance",
31725
+ "description": "Use the start and end slots to give one pane about a third of the row for a rail or inspector. At the same threshold, the start pane stacks above the end pane. Equal uses the default slot and gives children the same width.",
31726
+ "type": "keyword",
31727
+ "valueType": {
31728
+ "kind": "terminal",
31729
+ "name": "keyword"
31730
+ },
31731
+ "default": "equal",
31732
+ "options": [
31733
+ "equal",
31734
+ "narrow-start",
31735
+ "narrow-end"
31736
+ ]
31737
+ },
31719
31738
  {
31720
31739
  "name": "gap",
31721
31740
  "property": "gap",
@@ -31772,6 +31791,17 @@
31772
31791
  "stretch"
31773
31792
  ]
31774
31793
  },
31794
+ {
31795
+ "name": "balance",
31796
+ "description": "Use the start and end slots to give one pane about a third of the row for a rail or inspector. At the same threshold, the start pane stacks above the end pane. Equal uses the default slot and gives children the same width.",
31797
+ "type": "\"equal\" | \"narrow-start\" | \"narrow-end\"",
31798
+ "default": "equal",
31799
+ "options": [
31800
+ "equal",
31801
+ "narrow-start",
31802
+ "narrow-end"
31803
+ ]
31804
+ },
31775
31805
  {
31776
31806
  "name": "gap",
31777
31807
  "description": "Space between items, on the spacing scale: xs is 0.5rem, s 0.75rem, m 1rem (also the default), l 1.5rem, and xl 2rem. The --ui-switcher-gap custom property, set on :root, an ancestor, or the component itself, overrides it.",
@@ -31806,6 +31836,14 @@
31806
31836
  {
31807
31837
  "name": "default",
31808
31838
  "description": "Default child content."
31839
+ },
31840
+ {
31841
+ "name": "start",
31842
+ "description": "Named content for the start region."
31843
+ },
31844
+ {
31845
+ "name": "end",
31846
+ "description": "Named content for the end region."
31809
31847
  }
31810
31848
  ],
31811
31849
  "group": "layout",
@@ -31850,6 +31888,16 @@
31850
31888
  "resizable": true,
31851
31889
  "bindings": "",
31852
31890
  "frameworks": {}
31891
+ },
31892
+ {
31893
+ "id": "@threadlabs/looma/ui-switcher/04-list-and-detail",
31894
+ "name": "04-list-and-detail",
31895
+ "title": "A rail beside the detail",
31896
+ "description": "The first pane takes about a third of the room in a row. Resize this example to see both panes stack in reading order.",
31897
+ "markup": "<ui-switcher balance=\"narrow-start\" threshold=\"sm\" align=\"start\">\n <ui-card slot=\"start\" padding=\"sm\">Report index</ui-card>\n <ui-card slot=\"end\" padding=\"sm\">The footbridge is open. The lower path is still muddy after rain.</ui-card>\n</ui-switcher>",
31898
+ "resizable": true,
31899
+ "bindings": "",
31900
+ "frameworks": {}
31853
31901
  }
31854
31902
  ]
31855
31903
  },
@@ -89,6 +89,7 @@
89
89
  background-color: var(--ui-button-surface, oklch(from var(--_tone) l c h / calc(5% * var(--ui-tonal-opacity, 1))));
90
90
  color: var(--ui-button-text, var(--_tone-text));
91
91
  font: inherit;
92
+ font-size: var(--ui-font-size-sm);
92
93
  font-weight: var(--ui-font-medium);
93
94
  text-decoration: none;
94
95
  /* Unset, a button wraps as its container does. */
@@ -987,7 +988,7 @@
987
988
 
988
989
  .label {
989
990
  color: var(--_ui-form-field-label-text, var(--ui-text-secondary));
990
- font-size: var(--_ui-form-field-label-font-size, var(--ui-field-label-font-size, var(--ui-font-size-md)));
991
+ font-size: var(--_ui-form-field-label-font-size, var(--ui-field-label-font-size, var(--ui-font-size-sm)));
991
992
  }
992
993
 
993
994
  /* A label action, such as a small help button, sits after the label text in a box one line
@@ -2028,7 +2029,7 @@
2028
2029
  text-align: left;
2029
2030
  border-radius: var(--ui-menu-item-radius, var(--_ui-default-menu-item-radius, var(--ui-selection-radius)));
2030
2031
  color: var(--ui-text-primary);
2031
- font-size: var(--ui-menu-item-font-size, var(--_ui-default-menu-item-font-size, var(--ui-font-size-md)));
2032
+ font-size: var(--ui-menu-item-font-size, var(--_ui-default-menu-item-font-size, var(--ui-font-size-sm)));
2032
2033
  font-weight: var(--ui-font-medium);
2033
2034
  text-decoration: none;
2034
2035
  cursor: pointer;
@@ -2909,6 +2910,7 @@
2909
2910
  gap: var(--ui-checkbox-gap, var(--ui-space-2)) !important;
2910
2911
  max-inline-size: 100%;
2911
2912
  color: var(--ui-text-primary);
2913
+ font-size: var(--ui-font-size-sm);
2912
2914
  line-height: var(--ui-line-height-md) !important;
2913
2915
  cursor: pointer;
2914
2916
  }
@@ -3211,6 +3213,7 @@
3211
3213
  background: transparent;
3212
3214
  color: inherit;
3213
3215
  font: inherit;
3216
+ font-size: var(--ui-font-size-sm);
3214
3217
  font-weight: var(--ui-font-semibold);
3215
3218
  text-align: start;
3216
3219
  cursor: pointer;
@@ -3317,7 +3320,7 @@
3317
3320
  min-block-size: var(--ui-nav-min-block-size);
3318
3321
  padding-block: var(--ui-nav-padding-block) !important;
3319
3322
  border-radius: var(--ui-selection-radius);
3320
- font-size: var(--ui-font-size-md);
3323
+ font-size: var(--ui-font-size-sm);
3321
3324
  font-weight: var(--ui-font-normal);
3322
3325
  color: var(--ui-text-secondary);
3323
3326
  }
@@ -3410,6 +3413,7 @@
3410
3413
  background-image: var(--_ui-default-input-highlight, var(--ui-surface-highlight, none));
3411
3414
  color: var(--ui-text-primary);
3412
3415
  font: inherit;
3416
+ font-size: var(--ui-font-size-sm);
3413
3417
  line-height: var(--ui-line-height-tight);
3414
3418
  box-shadow: var(--ui-input-shadow, var(--_ui-default-input-shadow, var(--ui-control-inset)));
3415
3419
  transition:
package/editor/index.js CHANGED
@@ -267,6 +267,14 @@ function updateSurfaceMaterial$1(element, role) {
267
267
  if (!Number.isFinite(previous) || Math.abs(next - previous) >= Math.max(.002, Math.abs(previous) * .04)) element.style.setProperty("--_ui-material-scale", String(next));
268
268
  }
269
269
  //#endregion
270
+ //#region src/components/shared/overlay-dismissal.js
271
+ function overlayDismissalTarget$1(records, reason) {
272
+ const top = records.at(-1);
273
+ if (!top) return void 0;
274
+ if (top.dismissible === false && (reason === "escape" || reason === "light-dismiss")) return void 0;
275
+ return top.canClose?.(reason) === false ? void 0 : top;
276
+ }
277
+ //#endregion
270
278
  //#region src/components/shared/overlay.js
271
279
  function stateFor$1(document) {
272
280
  const key = Symbol.for("@threadlabs/looma/overlay-stack/v1");
@@ -290,8 +298,8 @@ function syncModalBackdrops$1(state) {
290
298
  for (const record of state.records) (record.modalElement ?? record.element).toggleAttribute("data-ui-backdrop-hidden", Boolean(record.modal && record !== topModal));
291
299
  }
292
300
  function requestClose$1(document, reason, trigger) {
293
- const record = stateFor$1(document).records.at(-1);
294
- if (!record || record.dismissible === false && (reason === "escape" || reason === "light-dismiss") || record.canClose?.(reason) === false) return false;
301
+ const record = overlayDismissalTarget$1(stateFor$1(document).records, reason);
302
+ if (!record) return false;
295
303
  record.requestClose(reason, trigger);
296
304
  return true;
297
305
  }
@@ -3944,6 +3952,14 @@ function updateSurfaceMaterial(element, role) {
3944
3952
  if (!Number.isFinite(previous) || Math.abs(next - previous) >= Math.max(.002, Math.abs(previous) * .04)) element.style.setProperty("--_ui-material-scale", String(next));
3945
3953
  }
3946
3954
  //#endregion
3955
+ //#region components/shared/overlay-dismissal.js
3956
+ function overlayDismissalTarget(records, reason) {
3957
+ const top = records.at(-1);
3958
+ if (!top) return void 0;
3959
+ if (top.dismissible === false && (reason === "escape" || reason === "light-dismiss")) return void 0;
3960
+ return top.canClose?.(reason) === false ? void 0 : top;
3961
+ }
3962
+ //#endregion
3947
3963
  //#region components/shared/overlay.js
3948
3964
  function stateFor(document) {
3949
3965
  const key = Symbol.for("@threadlabs/looma/overlay-stack/v1");
@@ -3967,8 +3983,8 @@ function syncModalBackdrops(state) {
3967
3983
  for (const record of state.records) (record.modalElement ?? record.element).toggleAttribute("data-ui-backdrop-hidden", Boolean(record.modal && record !== topModal));
3968
3984
  }
3969
3985
  function requestClose(document, reason, trigger) {
3970
- const record = stateFor(document).records.at(-1);
3971
- if (!record || record.dismissible === false && (reason === "escape" || reason === "light-dismiss") || record.canClose?.(reason) === false) return false;
3986
+ const record = overlayDismissalTarget(stateFor(document).records, reason);
3987
+ if (!record) return false;
3972
3988
  record.requestClose(reason, trigger);
3973
3989
  return true;
3974
3990
  }
@@ -7925,6 +7941,32 @@ function focusAndRevealItem(root, item) {
7925
7941
  revealActiveItem(root, item);
7926
7942
  }
7927
7943
  //#endregion
7944
+ //#region components/shared/collection-navigation.js
7945
+ /** Keys used by vertical collection navigation. Horizontal widgets translate their arrow keys.
7946
+ * @type {readonly string[]}
7947
+ */
7948
+ var collectionNavigationKeys = Object.freeze([
7949
+ "ArrowDown",
7950
+ "ArrowUp",
7951
+ "Home",
7952
+ "End"
7953
+ ]);
7954
+ /** Move through an already filtered collection without allocating an index array.
7955
+ * @param {number} length Number of eligible items.
7956
+ * @param {number} current Position in the eligible collection, or -1.
7957
+ * @param {string} key A collection navigation key.
7958
+ * @param {boolean} wrap Whether to wrap at either edge.
7959
+ */
7960
+ function nextCollectionPosition(length, current, key, wrap) {
7961
+ const last = length - 1;
7962
+ if (last < 0) return -1;
7963
+ if (key === "Home") return 0;
7964
+ if (key === "End") return last;
7965
+ if (key === "ArrowDown") return current === last && wrap ? 0 : Math.min(current + 1, last);
7966
+ if (key === "ArrowUp") return current < 0 || current === 0 && wrap ? last : Math.max(current - 1, 0);
7967
+ return -1;
7968
+ }
7969
+ //#endregion
7928
7970
  //#region components/shared/menu-navigation.js
7929
7971
  var itemSelector = "[role=\"menuitem\"], [role=\"menuitemcheckbox\"], [role=\"menuitemradio\"]";
7930
7972
  var searches = /* @__PURE__ */ new WeakMap();
@@ -7943,39 +7985,26 @@ function navigateMenu(event, menu) {
7943
7985
  if (!items.length) return false;
7944
7986
  const current = menuItemFrom(event.target);
7945
7987
  const index = items.indexOf(current);
7946
- let next = -1;
7947
- switch (event.key) {
7948
- case "ArrowDown":
7949
- next = index < 0 ? 0 : (index + 1) % items.length;
7950
- break;
7951
- case "ArrowUp":
7952
- next = index < 0 ? items.length - 1 : (index - 1 + items.length) % items.length;
7953
- break;
7954
- case "Home":
7955
- next = 0;
7956
- break;
7957
- case "End":
7958
- next = items.length - 1;
7959
- break;
7960
- default: {
7961
- if (event.key.length !== 1 || event.key === " " || event.altKey || event.ctrlKey || event.metaKey) return false;
7962
- const now = Date.now();
7963
- const previous = searches.get(menu);
7964
- const query = `${previous && now - previous.time < 700 ? previous.query : ""}${event.key.toLocaleLowerCase()}`;
7965
- searches.set(menu, {
7966
- query,
7967
- time: now
7968
- });
7969
- const find = (prefix) => {
7970
- for (let offset = 1; offset <= items.length; offset += 1) {
7971
- const candidate = (index + offset + items.length) % items.length;
7972
- if (label(items[candidate]).startsWith(prefix)) return candidate;
7973
- }
7974
- return -1;
7975
- };
7976
- next = find(query);
7977
- if (next < 0 && query.length > 1) next = find(event.key.toLocaleLowerCase());
7978
- }
7988
+ let next;
7989
+ if (collectionNavigationKeys.includes(event.key)) next = nextCollectionPosition(items.length, index, event.key, true);
7990
+ else {
7991
+ if (event.key.length !== 1 || event.key === " " || event.altKey || event.ctrlKey || event.metaKey) return false;
7992
+ const now = Date.now();
7993
+ const previous = searches.get(menu);
7994
+ const query = `${previous && now - previous.time < 700 ? previous.query : ""}${event.key.toLocaleLowerCase()}`;
7995
+ searches.set(menu, {
7996
+ query,
7997
+ time: now
7998
+ });
7999
+ const find = (prefix) => {
8000
+ for (let offset = 1; offset <= items.length; offset += 1) {
8001
+ const candidate = (index + offset + items.length) % items.length;
8002
+ if (label(items[candidate]).startsWith(prefix)) return candidate;
8003
+ }
8004
+ return -1;
8005
+ };
8006
+ next = find(query);
8007
+ if (next < 0 && query.length > 1) next = find(event.key.toLocaleLowerCase());
7979
8008
  }
7980
8009
  event.preventDefault();
7981
8010
  if (next >= 0) focusAndRevealItem(menu, items[next]);
@@ -11912,17 +11941,22 @@ var tableOfContentsNodeView = ({ editor, node, getPos }) => {
11912
11941
  * @lifecycle Returns the function that stops listening.
11913
11942
  */
11914
11943
  function afterFormReset(control, callback) {
11915
- const document = control.ownerDocument;
11916
- let timer;
11944
+ const tree = control.getRootNode();
11945
+ const root = tree.host ? tree : control.ownerDocument;
11946
+ const pending = /* @__PURE__ */ new Set();
11917
11947
  const onReset = (event) => {
11918
- if (event.target === control.form) timer = setTimeout(() => {
11948
+ if (event.target !== control.form) return;
11949
+ const timer = setTimeout(() => {
11950
+ pending.delete(timer);
11919
11951
  if (!event.defaultPrevented) callback();
11920
11952
  });
11953
+ pending.add(timer);
11921
11954
  };
11922
- document.addEventListener("reset", onReset);
11955
+ root.addEventListener("reset", onReset, { capture: true });
11923
11956
  return () => {
11924
- clearTimeout(timer);
11925
- document.removeEventListener("reset", onReset);
11957
+ root.removeEventListener("reset", onReset, { capture: true });
11958
+ for (const timer of pending) clearTimeout(timer);
11959
+ pending.clear();
11926
11960
  };
11927
11961
  }
11928
11962
  //#endregion
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@threadlabs/looma",
3
- "version": "0.53.9",
3
+ "version": "0.53.11",
4
4
  "type": "module",
5
5
  "description": "HTML Next UI components, native DOM support and design tokens.",
6
6
  "license": "MIT",
@@ -53,6 +53,7 @@
53
53
  "./vanilla": "./vanilla/index.js",
54
54
  "./vanilla/*": "./vanilla/*",
55
55
  "./components/*": "./components/*",
56
+ "./blocks/*": "./blocks/*",
56
57
  "./tokens.css": "./tokens.css",
57
58
  "./theme-light.css": "./theme-light.css",
58
59
  "./theme-dark.css": "./theme-dark.css",
@@ -75,6 +76,11 @@
75
76
  "import": "./components/shared/input-modality.js",
76
77
  "default": "./components/shared/input-modality.js"
77
78
  },
79
+ "./behaviors": {
80
+ "types": "./components/shared/behaviors.d.ts",
81
+ "import": "./components/shared/behaviors.js",
82
+ "default": "./components/shared/behaviors.js"
83
+ },
78
84
  "./docs/examples/*": "./docs/examples/*"
79
85
  },
80
86
  "files": [
@@ -83,6 +89,7 @@
83
89
  "markdown/",
84
90
  "vanilla/",
85
91
  "components/",
92
+ "blocks/",
86
93
  "styles/",
87
94
  "*.css",
88
95
  "README.md",
@@ -89,6 +89,7 @@
89
89
  background-color: var(--ui-button-surface, oklch(from var(--_tone) l c h / calc(5% * var(--ui-tonal-opacity, 1))));
90
90
  color: var(--ui-button-text, var(--_tone-text));
91
91
  font: inherit;
92
+ font-size: var(--ui-font-size-sm);
92
93
  font-weight: var(--ui-font-medium);
93
94
  text-decoration: none;
94
95
  /* Unset, a button wraps as its container does. */
@@ -21,6 +21,7 @@
21
21
  gap: var(--ui-checkbox-gap, var(--ui-space-2)) !important;
22
22
  max-inline-size: 100%;
23
23
  color: var(--ui-text-primary);
24
+ font-size: var(--ui-font-size-sm);
24
25
  line-height: var(--ui-line-height-md) !important;
25
26
  cursor: pointer;
26
27
  }
@@ -13,7 +13,7 @@
13
13
  margin: 0 !important;
14
14
  padding: 0 !important;
15
15
  --_size: var(--ui-control-size-md);
16
- --_font: 1em;
16
+ --_font: var(--ui-font-size-sm);
17
17
  --_padding: var(--ui-control-inset-block-md, var(--ui-space-2));
18
18
  }
19
19
  :scope:where(:is([component~="ui-color-picker"]:not(template), [data-component~="ui-color-picker"]:not([component])))[data-ui-color-picker-state~="size=sm"] {
@@ -114,7 +114,7 @@
114
114
  margin: 0 !important;
115
115
  padding: 0 !important;
116
116
  --_size: var(--ui-control-size-md);
117
- --_font: 1em;
117
+ --_font: var(--ui-font-size-sm);
118
118
  --_padding: var(--ui-control-inset-block-md, var(--ui-space-2));
119
119
  }
120
120
  :where(:is([component~="ui-color-picker"]:not(template), [data-component~="ui-color-picker"]:not([component])))[data-ui-color-picker-state~="size=sm"]:where(:scope, :not(:is([component]:not(template), [data-component]:not([component])), [data-slotted]:not([data-slotted~="ui-color-picker"]))) {
@@ -32,10 +32,11 @@
32
32
  min-inline-size: 0;
33
33
  color: var(--ui-text-primary);
34
34
  font: inherit;
35
+ font-size: var(--ui-font-size-sm);
35
36
  }
36
37
  label {
37
38
  color: var(--_ui-combobox-label-text, var(--ui-text-primary));
38
- font-size: var(--_ui-combobox-label-font-size, var(--ui-field-label-font-size, var(--ui-font-size-md)));
39
+ font-size: var(--_ui-combobox-label-font-size, var(--ui-field-label-font-size, var(--ui-font-size-sm)));
39
40
  font-weight: 500;
40
41
  }
41
42
  /* The field and anything that annotates it sit on one row; the help button is beside the box,
@@ -267,7 +268,9 @@
267
268
  white-space: nowrap;
268
269
  }
269
270
  @media (pointer: coarse) {
270
- :scope:where(:is([component~="ui-combobox"]:not(template), [data-component~="ui-combobox"]:not([component])))[data-ui-combobox-state~="size=sm"] input {
271
+ :scope:where(:is([component~="ui-combobox"]:not(template), [data-component~="ui-combobox"]:not([component]))) input,
272
+ :scope:where(:is([component~="ui-combobox"]:not(template), [data-component~="ui-combobox"]:not([component])))[data-ui-combobox-state~="size=sm"] input,
273
+ :scope:where(:is([component~="ui-combobox"]:not(template), [data-component~="ui-combobox"]:not([component])))[data-ui-combobox-state~="size=lg"] input {
271
274
  font-size: var(--ui-font-size-md);
272
275
  }
273
276
  }
@@ -409,10 +412,11 @@
409
412
  min-inline-size: 0;
410
413
  color: var(--ui-text-primary);
411
414
  font: inherit;
415
+ font-size: var(--ui-font-size-sm);
412
416
  }
413
417
  label:where(:scope, :scope *) {
414
418
  color: var(--_ui-combobox-label-text, var(--ui-text-primary));
415
- font-size: var(--_ui-combobox-label-font-size, var(--ui-field-label-font-size, var(--ui-font-size-md)));
419
+ font-size: var(--_ui-combobox-label-font-size, var(--ui-field-label-font-size, var(--ui-font-size-sm)));
416
420
  font-weight: 500;
417
421
  }
418
422
  /* The field and anything that annotates it sit on one row; the help button is beside the box,
@@ -641,7 +645,7 @@
641
645
  white-space: nowrap;
642
646
  }
643
647
  @media (pointer: coarse) {
644
- :where(:is([component~="ui-combobox"]:not(template), [data-component~="ui-combobox"]:not([component])))[data-ui-combobox-state~="size=sm"] input:where(:scope, :not(:is([component]:not(template), [data-component]:not([component])), [data-slotted]:not([data-slotted~="ui-combobox"]))) {
648
+ :where(:is([component~="ui-combobox"]:not(template), [data-component~="ui-combobox"]:not([component]))) input:where(:scope, :not(:is([component]:not(template), [data-component]:not([component])), [data-slotted]:not([data-slotted~="ui-combobox"]))), :where(:is([component~="ui-combobox"]:not(template), [data-component~="ui-combobox"]:not([component])))[data-ui-combobox-state~="size=sm"] input:where(:scope, :not(:is([component]:not(template), [data-component]:not([component])), [data-slotted]:not([data-slotted~="ui-combobox"]))), :where(:is([component~="ui-combobox"]:not(template), [data-component~="ui-combobox"]:not([component])))[data-ui-combobox-state~="size=lg"] input:where(:scope, :not(:is([component]:not(template), [data-component]:not([component])), [data-slotted]:not([data-slotted~="ui-combobox"]))) {
645
649
  font-size: var(--ui-font-size-md);
646
650
  }
647
651
  }
@@ -47,6 +47,7 @@
47
47
  background: transparent;
48
48
  color: inherit;
49
49
  font: inherit;
50
+ font-size: var(--ui-font-size-sm);
50
51
  font-weight: var(--ui-font-semibold);
51
52
  text-align: start;
52
53
  cursor: pointer;
@@ -153,7 +154,7 @@
153
154
  min-block-size: var(--ui-nav-min-block-size);
154
155
  padding-block: var(--ui-nav-padding-block) !important;
155
156
  border-radius: var(--ui-selection-radius);
156
- font-size: var(--ui-font-size-md);
157
+ font-size: var(--ui-font-size-sm);
157
158
  font-weight: var(--ui-font-normal);
158
159
  color: var(--ui-text-secondary);
159
160
  }