viewkitjs 0.36.0 → 0.38.0

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 (174) hide show
  1. package/CHANGELOG.md +75 -0
  2. package/package.json +1 -1
  3. package/views/dist/atoms/types.d.ts +32 -4
  4. package/views/dist/contract.d.ts +18 -9
  5. package/views/dist/contract.js +18 -1
  6. package/views/dist/controls/button/own-look-moved.d.ts +11 -0
  7. package/views/dist/controls/button/own-look-moved.js +3 -0
  8. package/views/dist/controls/date-editor/date-behaviour.d.ts +80 -0
  9. package/views/dist/controls/date-editor/date-behaviour.js +187 -0
  10. package/views/dist/controls/date-editor/date-editor.d.ts +3 -2
  11. package/views/dist/controls/date-editor/date-editor.js +29 -166
  12. package/views/dist/controls/field/field.d.ts +3 -2
  13. package/views/dist/controls/field/field.js +7 -2
  14. package/views/dist/controls/field/looks.d.ts +1 -1
  15. package/views/dist/controls/field/looks.js +7 -4
  16. package/views/dist/controls/field.css +64 -1
  17. package/views/dist/controls/filter-editor/filter-editor.js +2 -2
  18. package/views/dist/controls/filter-editor/parts.d.ts +2 -0
  19. package/views/dist/controls/filter-editor/parts.js +1 -1
  20. package/views/dist/controls/glyphs/glyphs.js +2 -0
  21. package/views/dist/controls/index.d.ts +3 -1
  22. package/views/dist/controls/index.js +3 -1
  23. package/views/dist/controls/inline-input.css +10 -0
  24. package/views/dist/controls/internal/phone.d.ts +1 -1
  25. package/views/dist/controls/internal/phone.js +3 -2
  26. package/views/dist/controls/internal/read-token.d.ts +2 -1
  27. package/views/dist/controls/internal/read-token.js +2 -1
  28. package/views/dist/controls/list/tokens.d.ts +1 -1
  29. package/views/dist/controls/list/tokens.js +1 -1
  30. package/views/dist/controls/list.css +5 -2
  31. package/views/dist/controls/menu-list/menu-list.js +3 -2
  32. package/views/dist/controls/menu.css +4 -4
  33. package/views/dist/controls/number-editor/tokens.d.ts +8 -0
  34. package/views/dist/controls/number-editor/tokens.js +2 -0
  35. package/views/dist/controls/number-editor.css +20 -0
  36. package/views/dist/controls/pane.css +1 -1
  37. package/views/dist/controls/picker.css +5 -3
  38. package/views/dist/controls/popover/looks.d.ts +1 -1
  39. package/views/dist/controls/popover/looks.js +5 -0
  40. package/views/dist/controls/popover/tokens.d.ts +13 -1
  41. package/views/dist/controls/popover/tokens.js +4 -1
  42. package/views/dist/controls/popover.css +59 -8
  43. package/views/dist/controls/select/select.js +1 -1
  44. package/views/dist/controls/sort-editor.css +4 -2
  45. package/views/dist/controls/text-editor/tokens.d.ts +8 -0
  46. package/views/dist/controls/text-editor/tokens.js +2 -0
  47. package/views/dist/controls/text-editor.css +28 -0
  48. package/views/dist/controls/toolbar/toolbar.d.ts +4 -2
  49. package/views/dist/controls/toolbar/toolbar.js +7 -2
  50. package/views/dist/controls/toolbar-button/atom-toolbar-button.js +1 -1
  51. package/views/dist/controls/toolbar.css +5 -0
  52. package/views/dist/controls/tooltip/tokens.d.ts +1 -1
  53. package/views/dist/controls/tooltip/tokens.js +1 -1
  54. package/views/dist/controls/tooltip/tooltip.js +2 -1
  55. package/views/dist/controls/tooltip.css +5 -3
  56. package/views/dist/controls/values-editor.css +20 -5
  57. package/views/dist/display/entity-chip.d.ts +7 -1
  58. package/views/dist/display/entity-chip.js +2 -1
  59. package/views/dist/field-row/FieldRow.js +25 -12
  60. package/views/dist/field-row/field-row-button.d.ts +12 -0
  61. package/views/dist/field-row/field-row-button.js +5 -0
  62. package/views/dist/fields/binding.d.ts +4 -0
  63. package/views/dist/grid/chrome/GridCellEditors.d.ts +4 -1
  64. package/views/dist/grid/chrome/GridCellEditors.js +3 -2
  65. package/views/dist/grid/chrome/GridCellOutline.d.ts +15 -5
  66. package/views/dist/grid/chrome/GridCellOutline.js +20 -5
  67. package/views/dist/grid/chrome/GridChipsEditor.js +1 -1
  68. package/views/dist/grid/chrome/GridDateEditor.d.ts +1 -1
  69. package/views/dist/grid/chrome/GridDateEditor.js +1 -1
  70. package/views/dist/grid/chrome/GridLongTextEditor.d.ts +1 -1
  71. package/views/dist/grid/chrome/GridLongTextEditor.js +8 -5
  72. package/views/dist/grid/chrome/GridNameEditor.d.ts +1 -1
  73. package/views/dist/grid/chrome/GridNameEditor.js +1 -1
  74. package/views/dist/grid/chrome/GridNumberEditor.d.ts +1 -1
  75. package/views/dist/grid/chrome/GridNumberEditor.js +3 -2
  76. package/views/dist/grid/chrome/GridPlaceEditor.d.ts +1 -1
  77. package/views/dist/grid/chrome/GridPlaceEditor.js +1 -1
  78. package/views/dist/grid/chrome/GridRangeEditor.d.ts +2 -2
  79. package/views/dist/grid/chrome/GridRangeEditor.js +1 -1
  80. package/views/dist/grid/chrome/GridRelationEditor.js +2 -2
  81. package/views/dist/grid/chrome/GridRowCells.js +6 -5
  82. package/views/dist/grid/chrome/GridSelectEditor.js +1 -1
  83. package/views/dist/grid/chrome/GridStructure.js +3 -3
  84. package/views/dist/grid/chrome/GridTable.d.ts +2 -1
  85. package/views/dist/grid/chrome/GridTable.js +7 -2
  86. package/views/dist/grid/chrome/GridTextEditor.d.ts +1 -1
  87. package/views/dist/grid/chrome/GridTextEditor.js +4 -2
  88. package/views/dist/grid/chrome/GridValueListEditor.d.ts +1 -1
  89. package/views/dist/grid/chrome/GridValueListEditor.js +1 -1
  90. package/views/dist/grid/chrome/grid-body-place.d.ts +7 -2
  91. package/views/dist/grid/chrome/grid-body-place.js +9 -4
  92. package/views/dist/grid/chrome/grid-cell-classes.js +2 -2
  93. package/views/dist/grid/chrome/grid-edit-session.d.ts +8 -0
  94. package/views/dist/grid/chrome/grid-edit-session.js +21 -3
  95. package/views/dist/grid/chrome/grid-editor-layer.d.ts +11 -0
  96. package/views/dist/grid/chrome/grid-editor-layer.js +1 -0
  97. package/views/dist/grid/chrome/grid-fitted-box.d.ts +4 -4
  98. package/views/dist/grid/chrome/grid-fitted-box.js +1 -3
  99. package/views/dist/grid/chrome/grid-hover.d.ts +3 -3
  100. package/views/dist/grid/chrome/grid-hover.js +2 -3
  101. package/views/dist/grid/chrome/grid-row-props.d.ts +6 -2
  102. package/views/dist/grid/chrome/grid-styles.d.ts +1 -5
  103. package/views/dist/grid/chrome/grid-styles.js +0 -1
  104. package/views/dist/grid/chrome/useGridKeyboard.d.ts +5 -2
  105. package/views/dist/grid/chrome/useGridKeyboard.js +11 -15
  106. package/views/dist/grid/chrome/useGridTableInteractionModel.d.ts +3 -1
  107. package/views/dist/grid/chrome/useGridTableInteractionModel.js +30 -2
  108. package/views/dist/grid/core/useGridEditing.d.ts +3 -0
  109. package/views/dist/grid/core/useGridEditing.js +2 -0
  110. package/views/dist/grid/grid.css +4 -19
  111. package/views/dist/internal/length.d.ts +2 -0
  112. package/views/dist/internal/length.js +16 -0
  113. package/views/dist/internal/screen-forms.d.ts +11 -0
  114. package/views/dist/internal/screen-forms.js +31 -0
  115. package/views/dist/list/list.js +2 -1
  116. package/views/dist/list/parts.d.ts +8 -2
  117. package/views/dist/list/parts.js +31 -7
  118. package/views/dist/list/toolbar.js +7 -3
  119. package/views/dist/looks/index.d.ts +1 -0
  120. package/views/dist/looks/index.js +1 -0
  121. package/views/dist/panels/react/popover.d.ts +3 -1
  122. package/views/dist/panels/react/popover.js +2 -2
  123. package/views/dist/panels/react/toolbar/ReadyToolbar.d.ts +6 -3
  124. package/views/dist/panels/react/toolbar/Toolbar.d.ts +12 -1
  125. package/views/dist/panels/react/toolbar/Toolbar.js +5 -1
  126. package/views/dist/panels/react/toolbar/ToolbarAdvancedFilters.js +1 -1
  127. package/views/dist/panels/react/toolbar/ToolbarButton.js +3 -2
  128. package/views/dist/panels/react/toolbar/ToolbarFilterAdd.js +1 -3
  129. package/views/dist/panels/react/toolbar/ToolbarOptions.js +1 -1
  130. package/views/dist/panels/react/toolbar/ToolbarQuickFilters.d.ts +1 -1
  131. package/views/dist/panels/react/toolbar/ToolbarQuickFilters.js +1 -1
  132. package/views/dist/panels/react/toolbar/ToolbarSave.d.ts +3 -1
  133. package/views/dist/panels/react/toolbar/ToolbarSave.js +28 -20
  134. package/views/dist/panels/react/toolbar/ToolbarSearch.js +1 -1
  135. package/views/dist/panels/react/toolbar/context.d.ts +3 -2
  136. package/views/dist/panels/react/views-row/FoldingViewRow.js +24 -7
  137. package/views/dist/panels/react/views-row/ViewPicker.js +1 -1
  138. package/views/dist/panels/react/views-row/more-views.d.ts +2 -0
  139. package/views/dist/panels/react/views-row/more-views.js +3 -0
  140. package/views/dist/panels/react.d.ts +1 -1
  141. package/views/dist/panels/toolbar/model.d.ts +2 -2
  142. package/views/dist/provider/components.d.ts +8 -7
  143. package/views/dist/provider/desktop.d.ts +2 -1
  144. package/views/dist/provider/desktop.js +5 -2
  145. package/views/dist/selection/bar-overflow.d.ts +2 -0
  146. package/views/dist/selection/bar-overflow.js +2 -1
  147. package/views/dist/selection/bar-props.d.ts +1 -1
  148. package/views/dist/selection/verbs.d.ts +2 -2
  149. package/views/dist/styles.css +341 -80
  150. package/views/dist/styles.unlayered.css +341 -80
  151. package/views/docs/contract.md +77 -23
  152. package/views/docs/controls/list.md +2 -0
  153. package/views/docs/controls/menu.md +2 -0
  154. package/views/docs/controls/number-editor.md +2 -0
  155. package/views/docs/controls/picker.md +2 -0
  156. package/views/docs/controls/popover.md +7 -0
  157. package/views/docs/controls/text-editor.md +2 -0
  158. package/views/docs/controls/tooltip.md +2 -0
  159. package/views/docs/guides/atoms.md +11 -10
  160. package/views/docs/guides/selection.md +1 -1
  161. package/views/docs/guides/the-grid.md +7 -5
  162. package/views/docs/guides/the-provider.md +2 -2
  163. package/views/docs/reference/controls.md +11 -6
  164. package/views/docs/reference/display.md +1 -1
  165. package/views/docs/reference/field-row.md +1 -1
  166. package/views/docs/reference/list.md +5 -6
  167. package/views/docs/reference/looks.md +4 -1
  168. package/views/docs/reference/panels-react.md +5 -4
  169. package/views/docs/reference/panels.md +1 -1
  170. package/views/docs/reference/react.md +6 -6
  171. package/views/docs/reference/selection.md +1 -1
  172. package/views/docs/reference/views.md +3 -3
  173. package/views/docs/reshaping.md +2 -2
  174. package/views/skills/views/SKILL.md +1 -1
@@ -8,8 +8,9 @@ export function ToolbarButton({ size, ...props }) {
8
8
  const slot = useToolbarSlot();
9
9
  const iconOnly = slot.words === "icon" && props.icon != null;
10
10
  const hasWords = props.word !== null || props.children != null;
11
- const alone = slot.iconAlone || (iconOnly && hasWords);
11
+ const wordOnly = slot.words === "word" && hasWords && !props.foot;
12
+ const alone = !wordOnly && (slot.iconAlone || (iconOnly && hasWords));
12
13
  const Button = slot.button ?? atoms.ToolbarButton;
13
14
  const className = cx(slot.className, props.className) || undefined;
14
- return (_jsx(Button, { ...props, ...(iconOnly && { word: null }), ...(alone && { iconAlone: true }), ...(className && { className }), size: size ?? slot.size }));
15
+ return (_jsx(Button, { ...props, ...(iconOnly && { word: null }), ...(wordOnly && { icon: null, children: props.children ?? props.word ?? props.label }), ...(alone && { iconAlone: true }), ...(className && { className }), size: size ?? slot.size }));
15
16
  }
@@ -52,7 +52,5 @@ export function ToolbarFilterAdd({ filterTree, onHeldChange, open, onOpenChange,
52
52
  const why = details?.reason;
53
53
  if (!next && why !== "outside-press" && why !== "focus-out")
54
54
  hangsAt.anchor.current?.focus({ preventScroll: true });
55
- }, anchor: hangsAt.anchor, ...hangs, ...(opens === "filters"
56
- ? { chrome: "panel", className: "w-fit max-w-[calc(100vw-2rem)]" }
57
- : { chrome: "menu" }), panelData: { "data-slot": "vk-toolbar-filters-panel" }, children: list }))] }));
55
+ }, anchor: hangsAt.anchor, ...hangs, chrome: "menu", ...(opens === "filters" && { className: "w-(--vk-panel-w,fit-content) max-w-[calc(100vw-2rem)]" }), panelData: { "data-slot": "vk-toolbar-filters-panel" }, children: list }))] }));
58
56
  }
@@ -33,5 +33,5 @@ export function ToolbarOptions({ view, viewFoot, footClear, resets, layered, cus
33
33
  };
34
34
  return (_jsx(ToolbarPanelPart, { panelKey: "options", slot: "vk-toolbar-options", part: "options", icon: _jsx(Glyph, { className: "h-4 w-4 shrink-0" }), label: name, word: name, count: count, onClear: clear, dot: !!view && view.changes > 0, open: holdsOpen ? open : ownOpen, onOpenChange: handleOpenChange, host: host, popoverClassName: widthClassName
35
35
  ? viewOptionsPopoverClassName(page, widthClassName)
36
- : viewOptionsPopoverClassName(null, "w-75"), onSheetEscape: step.escapeBack, children: ({ fill, close, closeButton }) => (_jsx(PanelStepHold.Provider, { value: step, children: _jsx(ViewOptionsPanelContent, { ...inputs, activePanel: page, onOpenPanel: setPage, anyActive: view ? view.changes > 0 : count > 0, clearAll: clear, foldFilters: foldFilters, onClose: close, closeButton: closeButton, fill: fill, view: view, viewFoot: viewFoot, footClear: footClear, ...(resets && { resets }), ...(layered && { layered }), ...(customizeItems && { customizeItems }), fieldEditor: fieldEditor, ...(viewName !== undefined && { viewName }), ...(onRenameView && { onRenameView }), ...(onCopyLink && { onCopyLink }), ...(onExport && { onExport }), ...(exportCount !== undefined && { exportCount }) }) })) }));
36
+ : viewOptionsPopoverClassName(null, "w-(--vk-panel-w,calc(var(--spacing)*75))"), onSheetEscape: step.escapeBack, children: ({ fill, close, closeButton }) => (_jsx(PanelStepHold.Provider, { value: step, children: _jsx(ViewOptionsPanelContent, { ...inputs, activePanel: page, onOpenPanel: setPage, anyActive: view ? view.changes > 0 : count > 0, clearAll: clear, foldFilters: foldFilters, onClose: close, closeButton: closeButton, fill: fill, view: view, viewFoot: viewFoot, footClear: footClear, ...(resets && { resets }), ...(layered && { layered }), ...(customizeItems && { customizeItems }), fieldEditor: fieldEditor, ...(viewName !== undefined && { viewName }), ...(onRenameView && { onRenameView }), ...(onCopyLink && { onCopyLink }), ...(onExport && { onExport }), ...(exportCount !== undefined && { exportCount }) }) })) }));
37
37
  }
@@ -11,7 +11,7 @@ export declare function ToolbarQuickFilters({ quickFilters, open, onOpenChange,
11
11
  host?: ToolbarPanelHost;
12
12
  /** The button's glyph; absent, the filter row's category glyph. */
13
13
  icon?: ReactNode;
14
- /** `null`: its icon alone, its words its name to a screen reader, unless it was placed `words: "both"` (VK-967); absent,
14
+ /** `null`: its icon alone, its words its name to a screen reader, unless it was placed `words: "both"` (VK-967) or `"word"` (VK-970); absent,
15
15
  * its icon and its words. */
16
16
  word?: null;
17
17
  }): ReactNode;
@@ -14,5 +14,5 @@ export function ToolbarQuickFilters({ quickFilters, open, onOpenChange, host, ic
14
14
  return null;
15
15
  const Glyph = icons.filterCategory;
16
16
  const label = quickFilters.label ?? messages({ key: "views.panels.quick-filters" });
17
- return (_jsx(ToolbarPanelPart, { panelKey: "quick", slot: "vk-toolbar-quick", part: "quick", icon: icon ?? _jsx(Glyph, { className: "h-4 w-4 shrink-0" }), label: label, word: word === null && slot.words !== "both" ? null : label, changed: holdStands(quickFilters.hold), open: open, onOpenChange: onOpenChange, host: host, children: ({ close, closeButton }) => (_jsx(QuickFiltersPanel, { quickFilters: quickFilters, form: phone ? "phone" : "computer", onDone: close, closeButton: closeButton, inHost: !!host })) }));
17
+ return (_jsx(ToolbarPanelPart, { panelKey: "quick", slot: "vk-toolbar-quick", part: "quick", icon: icon ?? _jsx(Glyph, { className: "h-4 w-4 shrink-0" }), label: label, word: word === null && slot.words !== "both" && slot.words !== "word" ? null : label, changed: holdStands(quickFilters.hold), open: open, onOpenChange: onOpenChange, host: host, children: ({ close, closeButton }) => (_jsx(QuickFiltersPanel, { quickFilters: quickFilters, form: phone ? "phone" : "computer", onDone: close, closeButton: closeButton, inHost: !!host })) }));
18
18
  }
@@ -1,10 +1,12 @@
1
1
  import type { ReactNode } from "react";
2
2
  import type { CollectionViewState } from "../../view-state.js";
3
- export declare function ToolbarSave({ view, layered, onClear, }: {
3
+ export declare function ToolbarSave({ view, layered, onClear, only, }: {
4
4
  /** The shared view this list shows: Clear is its `onReset`, Save its `onPublish`. */
5
5
  view?: CollectionViewState;
6
6
  /** With no shared view, what Clear does: the list back to its default. Absent, nothing to clear. */
7
7
  onClear?: () => void;
8
8
  /** The reader's own layer holds something (VK-1034): on a shared view Clear stands for it too, Save doesn't. */
9
9
  layered?: boolean;
10
+ /** One half alone, where the app placed Clear and Save apart (VK-970): `clear` or `save`. Absent, both in one box. */
11
+ only?: "clear" | "save";
10
12
  }): ReactNode;
@@ -4,7 +4,7 @@ import { useViews } from "../../../provider/context.js";
4
4
  import { drawPanelButton } from "../../panel-button.js";
5
5
  import { useToolbarSlot } from "./context.js";
6
6
  import { ToolbarButton } from "./ToolbarButton.js";
7
- export function ToolbarSave({ view, layered = false, onClear, }) {
7
+ export function ToolbarSave({ view, layered = false, onClear, only, }) {
8
8
  const views = useViews();
9
9
  const { messages } = views;
10
10
  const { appFrame } = useToolbarSlot();
@@ -16,24 +16,32 @@ export function ToolbarSave({ view, layered = false, onClear, }) {
16
16
  if (appFrame) {
17
17
  const clearWord = messages({ key: "views.panels.view-clear" });
18
18
  const saveWord = messages({ key: "views.panels.view-save" });
19
- return (_jsxs("span", { "data-slot": "vk-toolbar-save", className: "inline-flex shrink-0 items-center gap-2", children: [_jsx(ToolbarButton, { icon: null, label: clearWord, part: "clear", disabled: pending, onClick: clear, children: clearWord }), publish && (_jsx(ToolbarButton, { icon: null, label: saveWord, part: "save", disabled: pending, onClick: view.onPublish, children: saveWord }))] }));
19
+ const clearButton = (_jsx(ToolbarButton, { icon: null, label: clearWord, part: "clear", disabled: pending, onClick: clear, children: clearWord }));
20
+ const saveButton = publish && (_jsx(ToolbarButton, { icon: null, label: saveWord, part: "save", disabled: pending, onClick: view.onPublish, children: saveWord }));
21
+ if (only)
22
+ return only === "clear" ? clearButton : saveButton || null;
23
+ return (_jsxs("span", { "data-slot": "vk-toolbar-save", className: "inline-flex shrink-0 items-center gap-2", children: [clearButton, saveButton] }));
20
24
  }
21
- return (_jsxs("span", { "data-slot": "vk-toolbar-save", className: "inline-flex shrink-0 items-center gap-2", children: [drawPanelButton(views, {
22
- frame: "h-8 px-3",
23
- variant: "ghost",
24
- size: "sm",
25
- disabled: pending,
26
- onClick: clear,
27
- "data-slot": "vk-toolbar-clear",
28
- children: messages({ key: "views.panels.view-clear" }),
29
- }), publish &&
30
- drawPanelButton(views, {
31
- frame: "h-8 px-3",
32
- variant: "outline",
33
- size: "sm",
34
- disabled: pending,
35
- onClick: view.onPublish,
36
- "data-slot": "vk-toolbar-save-button",
37
- children: messages({ key: "views.panels.view-save" }),
38
- })] }));
25
+ const clearButton = drawPanelButton(views, {
26
+ frame: "h-8 px-3",
27
+ variant: "ghost",
28
+ size: "sm",
29
+ disabled: pending,
30
+ onClick: clear,
31
+ "data-slot": "vk-toolbar-clear",
32
+ children: messages({ key: "views.panels.view-clear" }),
33
+ });
34
+ const saveButton = publish &&
35
+ drawPanelButton(views, {
36
+ frame: "h-8 px-3",
37
+ variant: "outline",
38
+ size: "sm",
39
+ disabled: pending,
40
+ onClick: view.onPublish,
41
+ "data-slot": "vk-toolbar-save-button",
42
+ children: messages({ key: "views.panels.view-save" }),
43
+ });
44
+ if (only)
45
+ return only === "clear" ? clearButton : saveButton || null;
46
+ return (_jsxs("span", { "data-slot": "vk-toolbar-save", className: "inline-flex shrink-0 items-center gap-2", children: [clearButton, saveButton] }));
39
47
  }
@@ -43,7 +43,7 @@ export function ToolbarSearch({ value, onChange, placeholder, searching = false,
43
43
  setOpened(false);
44
44
  };
45
45
  if (!shown) {
46
- return (_jsx("div", { "data-slot": "vk-toolbar-search", className: "relative flex flex-none items-center", children: _jsx(ToolbarButton, { part: "search", icon: searching ? _jsx(LoadingRing, { label: busy, slot: "vk-toolbar-search-spinner", className: "h-4 w-4" }) : _jsx(Glass, { className: "h-4 w-4 shrink-0" }), label: name, word: slot.words === "both" ? undefined : null, onClick: () => {
46
+ return (_jsx("div", { "data-slot": "vk-toolbar-search", className: "relative flex flex-none items-center", children: _jsx(ToolbarButton, { part: "search", icon: searching ? _jsx(LoadingRing, { label: busy, slot: "vk-toolbar-search-spinner", className: "h-4 w-4" }) : _jsx(Glass, { className: "h-4 w-4 shrink-0" }), label: name, word: slot.words === "both" || slot.words === "word" ? undefined : null, onClick: () => {
47
47
  pressed.current = true;
48
48
  setOpened(true);
49
49
  } }) }));
@@ -29,8 +29,9 @@ export type ToolbarSlotState = {
29
29
  * part's chip, tabs, "+N" and "+", and Clear and Save draw through your `ToolbarButton`. */
30
30
  appFrame: boolean;
31
31
  /** Its words as it was placed (`ToolbarPlacement.words`, VK-967): `icon`, its icon alone; `both`, a part that is its icon
32
- * alone by default (the search, the quick filters' button) reads its word. Absent, its own. */
33
- words?: "both" | "icon";
32
+ * alone by default (the search, the quick filters' button) reads its word; `word`, its word alone, no icon, on every button
33
+ * of the part that has a word (VK-970). Absent, its own. */
34
+ words?: "both" | "icon" | "word";
34
35
  /** `false`: New stays on a phone's folding line instead of at the list's foot. */
35
36
  foot?: boolean;
36
37
  /** The key of the place it stands in (VK-984): a part whose button stands in more than one place (Sort's pill, a panel
@@ -1,6 +1,6 @@
1
1
  "use client";
2
2
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
- import { useCallback, useLayoutEffect, useMemo, useRef, useState } from "react";
3
+ import { useCallback, useContext, useLayoutEffect, useMemo, useRef, useState } from "react";
4
4
  import { useViews } from "../../../provider/context.js";
5
5
  import { formatCount } from "../../../internal/count.js";
6
6
  import { drawPanelButton, PanelButton } from "../../panel-button.js";
@@ -10,6 +10,8 @@ import { PillGroup } from "./PillGroup.js";
10
10
  import { useAnchoredToggle } from "./use-anchored-toggle.js";
11
11
  import { ToolbarButton } from "../toolbar/ToolbarButton.js";
12
12
  import { useViewsRowInFrame } from "./in-frame.js";
13
+ import { MoreViews } from "./more-views.js";
14
+ import { cx } from "../../../internal/cx.js";
13
15
  import { ViewCreatePill } from "./ViewCreatePill.js";
14
16
  import { useNewView } from "./new-view.js";
15
17
  import { ViewPickerRow } from "./ViewPickerRow.js";
@@ -21,6 +23,7 @@ export function FoldingViewRow({ axis, folded: told }) {
21
23
  const [visible, setVisible] = useState(axis.options.length);
22
24
  const words = usePillWords(axis.hideCounts);
23
25
  const inFrame = useViewsRowInFrame();
26
+ const ownMore = useContext(MoreViews);
24
27
  const pills = useMemo(() => toPillOptions(axis.options, words), [axis.options, words]);
25
28
  const viewMenu = useMemo(() => (axis.verbs && views.components.ViewMenu ? { views: viewsListItemsOf(axis), value: axis.value, verbs: axis.verbs } : undefined), [axis, views.components.ViewMenu]);
26
29
  const newView = useNewView(axis);
@@ -93,19 +96,32 @@ export function FoldingViewRow({ axis, folded: told }) {
93
96
  const ordered = pills.filter(inBlock).map((pill) => (visibleValues.has(pill.value) ? dealt.shift() : pill.value));
94
97
  axis.onReorder(ordered);
95
98
  };
96
- return (_jsxs("div", { ref: hostRef, "data-slot": "vk-views-row", className: isTold ? "relative flex flex-none items-center gap-0.5" : "relative flex min-w-0 flex-1 items-center gap-0.5", children: [_jsx(PillGroup, { value: axis.value, options: shown, onChange: axis.onChange, variant: "plain", onReorder: axis.onReorder ? onPillReorder : undefined, canDrag: axis.canDrag, viewMenu: viewMenu }), folded.length > 0 && _jsx(FoldedViews, { axis: axis, options: foldedOptions, viewMenu: viewMenu }), newView.onCreate && _jsx(ViewCreatePill, { label: axis.createLabel, onClick: newView.onCreate }), newView.slot(hostRef), !isTold && (_jsx("div", { "aria-hidden": true, inert: true, className: "pointer-events-none absolute inset-0 overflow-hidden", style: { visibility: "hidden" }, children: _jsxs("div", { ref: measureRef, "data-slot": "vk-views-row", className: "pointer-events-none absolute left-0 top-0 flex items-center gap-0.5 whitespace-nowrap", children: [_jsx("div", { "data-measure-pills": true, className: "contents", children: _jsx(PillGroup, { value: axis.value, options: pills, onChange: () => { }, variant: "plain" }) }), inFrame ? (_jsx("span", { "data-measure-more": true, className: "inline-flex", children: _jsx(MoreButton, { count: 99 }) })) : (_jsx("span", { "data-measure-more": true, className: "inline-flex", children: drawPanelButton(views, {
97
- frame: MORE_CHIP_FRAME,
99
+ return (_jsxs("div", { ref: hostRef, "data-slot": "vk-views-row", className: isTold ? "relative flex flex-none items-center gap-0.5" : "relative flex min-w-0 flex-1 items-center gap-0.5", children: [_jsx(PillGroup, { value: axis.value, options: shown, onChange: axis.onChange, variant: "plain", onReorder: axis.onReorder ? onPillReorder : undefined, canDrag: axis.canDrag, viewMenu: viewMenu }), folded.length > 0 && _jsx(FoldedViews, { axis: axis, options: foldedOptions, viewMenu: viewMenu }), newView.onCreate && _jsx(ViewCreatePill, { label: axis.createLabel, onClick: newView.onCreate }), newView.slot(hostRef), !isTold && (_jsx("div", { "aria-hidden": true, inert: true, className: "pointer-events-none absolute inset-0 overflow-hidden", style: { visibility: "hidden" }, children: _jsxs("div", { ref: measureRef, "data-slot": "vk-views-row", className: "pointer-events-none absolute left-0 top-0 flex items-center gap-0.5 whitespace-nowrap", children: [_jsx("div", { "data-measure-pills": true, className: "contents", children: _jsx(PillGroup, { value: axis.value, options: pills, onChange: () => { }, variant: "plain" }) }), inFrame ? (_jsx("span", { "data-measure-more": true, className: "inline-flex", children: _jsx(MoreButton, { count: 99 }) })) : (_jsx("span", { "data-measure-more": true, className: "inline-flex", children: ownMore?.button ? (_jsx(ownMore.button, { ...ownMoreProps(views, 99, ownMore.className) })) : (drawPanelButton(views, {
100
+ frame: cx(MORE_CHIP_FRAME, ownMore?.className),
98
101
  variant: "ghost",
99
102
  size: "sm",
100
103
  "data-slot": "vk-views-more",
101
104
  children: moreChipInner(views, 99),
102
- }) })), axis.onCreate && (_jsx("span", { "data-measure-ghost": true, children: _jsx(ViewCreatePill, { label: axis.createLabel, onClick: () => { } }) }))] }) }))] }));
105
+ })) })), axis.onCreate && (_jsx("span", { "data-measure-ghost": true, children: _jsx(ViewCreatePill, { label: axis.createLabel, onClick: () => { } }) }))] }) }))] }));
103
106
  }
104
107
  const MORE_CHIP_FRAME = "h-8 shrink-0 gap-0.5 whitespace-nowrap px-2.5";
105
108
  function moreChipInner({ conventions, icons }, count) {
106
109
  const Chevron = icons.chevronDown;
107
110
  return (_jsxs(_Fragment, { children: ["+", formatCount(count, conventions), _jsx(Chevron, { className: "h-3.5 w-3.5 shrink-0 opacity-70" })] }));
108
111
  }
112
+ function ownMoreProps({ conventions, messages }, count, className) {
113
+ return {
114
+ part: "views-more",
115
+ icon: null,
116
+ word: null,
117
+ label: messages({ key: "views.panels.views-more", values: { count } }),
118
+ children: `+${formatCount(count, conventions)}`,
119
+ popup: "dialog",
120
+ open: false,
121
+ size: "sm",
122
+ ...(className && { className }),
123
+ };
124
+ }
109
125
  function MoreButton({ count, ref, open, onPointerDown, onClick, }) {
110
126
  const { conventions, messages } = useViews();
111
127
  return (_jsxs(ToolbarButton, { ref: ref, icon: null, label: messages({ key: "views.panels.views-more", values: { count } }), part: "views-more", popup: "dialog", open: Boolean(open), onPointerDown: onPointerDown, onClick: onClick, children: ["+", formatCount(count, conventions)] }));
@@ -117,13 +133,14 @@ function FoldedViews({ axis, options, viewMenu, }) {
117
133
  const anchor = useRef(null);
118
134
  const toggle = useAnchoredToggle(anchor);
119
135
  const inFrame = useViewsRowInFrame();
136
+ const ownMore = useContext(MoreViews);
120
137
  const holding = useRef(false);
121
138
  const onHold = useCallback((on) => {
122
139
  holding.current = on;
123
140
  }, []);
124
141
  const rowMenu = viewMenu && { ...viewMenu, onDone: toggle.close, onHold };
125
- return (_jsxs(_Fragment, { children: [inFrame ? (_jsx(MoreButton, { count: options.length, ref: anchor, open: toggle.open, onPointerDown: toggle.triggerProps.onPointerDown, onClick: toggle.triggerProps.onClick })) : (_jsx(PanelButton, { views: views, draw: {
126
- frame: MORE_CHIP_FRAME,
142
+ return (_jsxs(_Fragment, { children: [inFrame ? (_jsx(MoreButton, { count: options.length, ref: anchor, open: toggle.open, onPointerDown: toggle.triggerProps.onPointerDown, onClick: toggle.triggerProps.onClick })) : ownMore?.button ? (_jsx(ownMore.button, { ...ownMoreProps(views, options.length, ownMore.className), ref: anchor, open: toggle.open, onPointerDown: toggle.triggerProps.onPointerDown, onClick: toggle.triggerProps.onClick })) : (_jsx(PanelButton, { views: views, draw: {
143
+ frame: cx(MORE_CHIP_FRAME, ownMore?.className),
127
144
  variant: "ghost",
128
145
  size: "sm",
129
146
  ref: anchor,
@@ -135,7 +152,7 @@ function FoldedViews({ axis, options, viewMenu, }) {
135
152
  onPointerDown: toggle.triggerProps.onPointerDown,
136
153
  onClick: toggle.triggerProps.onClick,
137
154
  children: moreChipInner(views, options.length),
138
- } })), _jsx(Popover, { open: toggle.open, onOpenChange: toggle.onOpenChange, anchor: anchor, align: "start", sideOffset: 6, chrome: "menu", className: "w-64", onOutsidePress: () => (holding.current ? false : undefined), onEscape: () => (holding.current ? false : undefined), children: _jsx("div", { role: "listbox", "aria-label": messages({ key: "views.panels.views-more-list" }), className: VIEWS_LIST_CLASS, children: options.map((option) => (_jsx(ViewPickerRow, { option: option, active: option.value === axis.value, hideCounts: axis.hideCounts, viewMenu: rowMenu, onSelect: () => {
155
+ } })), _jsx(Popover, { open: toggle.open, onOpenChange: toggle.onOpenChange, anchor: anchor, align: "start", sideOffset: 6, chrome: "menu", className: "w-(--vk-panel-w,calc(var(--spacing)*64))", onOutsidePress: () => (holding.current ? false : undefined), onEscape: () => (holding.current ? false : undefined), children: _jsx("div", { role: "listbox", "aria-label": messages({ key: "views.panels.views-more-list" }), className: VIEWS_LIST_CLASS, children: options.map((option) => (_jsx(ViewPickerRow, { option: option, active: option.value === axis.value, hideCounts: axis.hideCounts, viewMenu: rowMenu, onSelect: () => {
139
156
  axis.onChange(option.value);
140
157
  toggle.close();
141
158
  } }, option.value))) }) })] }));
@@ -88,5 +88,5 @@ export function ViewPicker({ axis, className }) {
88
88
  close: { label: messages({ key: "views.panels.close" }), onPress: () => toggle.setOpen(false) },
89
89
  back: { label: messages({ key: "views.panels.back" }), onPress: step.back },
90
90
  },
91
- }), onSheetEscape: step.escapeBack, children: list })) : (_jsx(Popover, { open: toggle.open, onOpenChange: onOpenChange, anchor: anchor, align: "start", sideOffset: 6, chrome: "menu", className: "w-72", onOutsidePress: () => (holding.current ? false : undefined), onEscape: () => (holding.current ? false : undefined), children: list }))] }));
91
+ }), onSheetEscape: step.escapeBack, children: list })) : (_jsx(Popover, { open: toggle.open, onOpenChange: onOpenChange, anchor: anchor, align: "start", sideOffset: 6, chrome: "menu", className: "w-(--vk-panel-w,calc(var(--spacing)*72))", onOutsidePress: () => (holding.current ? false : undefined), onEscape: () => (holding.current ? false : undefined), children: list }))] }));
92
92
  }
@@ -0,0 +1,2 @@
1
+ import type { ToolbarMoreViews } from "../toolbar/Toolbar.js";
2
+ export declare const MoreViews: import("react").Context<ToolbarMoreViews | null>;
@@ -0,0 +1,3 @@
1
+ "use client";
2
+ import { createContext } from "react";
3
+ export const MoreViews = createContext(null);
@@ -27,7 +27,7 @@ export { ViewOptionsActions } from "./react/view-actions.js";
27
27
  export { ViewOptionsPopoverPanel, keepPanelOpenForPortals, useViewActivePanel, useViewOptionsPopover, viewOptionsPopoverClassName, } from "./react/popover.js";
28
28
  export type { ViewOptionsPopoverState } from "./react/popover.js";
29
29
  export { Toolbar, ToolbarSeparator } from "./react/toolbar/Toolbar.js";
30
- export type { ToolbarMore, ToolbarOverflow, ToolbarPart } from "./react/toolbar/Toolbar.js";
30
+ export type { ToolbarMore, ToolbarMoreViews, ToolbarOverflow, ToolbarPart } from "./react/toolbar/Toolbar.js";
31
31
  export { ToolbarButton } from "./react/toolbar/ToolbarButton.js";
32
32
  export { useToolbarPanel, useToolbarSlot } from "./react/toolbar/context.js";
33
33
  export { ToolbarRadioProvider, ToolbarSlotProvider } from "./react/toolbar/context.js";
@@ -17,8 +17,8 @@ export type ToolbarPlacement = {
17
17
  /** In the fold arrangement, it may fold into ⋯ when its line still has no room. */
18
18
  fold?: boolean;
19
19
  /** Its words, for a part whose button has a word (VK-967): `both`, as the look's words say (icon and word where they show);
20
- * `icon`, its icon alone whatever the look. Absent, the part's own. */
21
- words?: "both" | "icon";
20
+ * `icon`, its icon alone whatever the look; `word`, its word alone, no icon (VK-970). Absent, the part's own. */
21
+ words?: "both" | "icon" | "word";
22
22
  /** On a phone's folding line New stands at the list's foot, unless `false` keeps it on the line (VK-967). */
23
23
  foot?: boolean;
24
24
  };
@@ -38,7 +38,8 @@ export type ViewsButtonProps = {
38
38
  /** The part's name, `vk-grid-row-more` on a row's ⋯. */
39
39
  "data-slot"?: string;
40
40
  /** Which one of a part that repeats, beside its `data-slot` (VK-1013: inside ViewKit's panels, under `panelControls`): a
41
- * rule's field, an action's verb. Forward it to your element. */
41
+ * rule's field, an action's verb; and a record's field row's target (`vk-field-row-target`, `-beside`, `-under`), which the
42
+ * Field's Box dresses. Forward it to your element. */
42
43
  "data-key"?: string;
43
44
  /** A state flag: `""` (present, no value) while the menu this button opens is open; absent when closed. */
44
45
  "data-open"?: "";
@@ -150,7 +151,7 @@ export type ViewsMenuItem = {
150
151
  * disables every row under it: the provider hands the app's `Menu` those rows already `disabled`. */
151
152
  children?: ViewsMenuItem[];
152
153
  /** A group (`children`) that opens its rows beside the menu, one level in, rather than in place: its row
153
- * shows its label and `detail` and opens on a hover, a press or →. A hint: an adapter with no flyouts
154
+ * shows its label and `detail` and opens on a hover or →. A hint: an adapter with no flyouts
154
155
  * draws the group in place under its label, as every group is drawn. Ignored on a row with no `children`. */
155
156
  beside?: boolean;
156
157
  /** A checkable row (`checked` set) that leaves the menu open when picked, so several can be ticked in
@@ -476,7 +477,7 @@ type ViewsPartsBodyCommon = {
476
477
  /** The field's name: the body's accessible name, a sheet's title. */
477
478
  label: string;
478
479
  /** The edit is finished: the editor closes and saves what was handed. With no argument it closes as Enter does
479
- * (the grid moves one row down); `"pick"` closes as a pick (a band picked), which moves nowhere. */
480
+ * (the grid writes and keeps the cell); `"pick"` closes as a pick (a band picked), the same. */
480
481
  onDone: (how?: "pick") => void;
481
482
  /** It may be emptied: every box cleared is a clear. */
482
483
  empty: boolean;
@@ -579,7 +580,7 @@ export type ViewsValuesBodyProps = {
579
580
  value: readonly ViewsValueLine[];
580
581
  /** Every change as it is made, the whole list each time. A line handed as it was drawn keeps what is stored. */
581
582
  onValueChange: (value: readonly ViewsValueLine[]) => void;
582
- /** The edit is finished: the editor closes as Enter does (the grid moves one row down) and saves what was handed. */
583
+ /** The edit is finished: the editor closes as Enter does (the grid writes and keeps the cell) and saves what was handed. */
583
584
  onDone: () => void;
584
585
  /** Why a value would be refused, in the app's words, or null when it reads: check each value as it is added or changed. */
585
586
  check: (value: string) => string | null;
@@ -617,7 +618,7 @@ export type ViewsTextBodyProps = {
617
618
  value: string;
618
619
  /** Every change as it is made, the whole text each time. */
619
620
  onValueChange: (value: string) => void;
620
- /** The edit is finished: the editor closes as Enter does (the grid moves one row down) and saves what was handed. */
621
+ /** The edit is finished: the editor closes as Enter does (the grid writes and keeps the cell) and saves what was handed. */
621
622
  onDone: () => void;
622
623
  /** Why a value would be refused, in the app's words, or null when it reads. The editor checks again at the close. */
623
624
  check: (value: string) => string | null;
@@ -657,7 +658,7 @@ export type ViewsNumberBodyProps = {
657
658
  /** Every change as it is made: the number, null when emptied, `NaN` for text that reads as no number (a close on it
658
659
  * changes nothing); and the unit when it is one of `units`. */
659
660
  onValueChange: (value: number | null, unit?: string) => void;
660
- /** The edit is finished: the editor closes as Enter does (the grid moves one row down) and saves what was handed. */
661
+ /** The edit is finished: the editor closes as Enter does (the grid writes and keeps the cell) and saves what was handed. */
661
662
  onDone: () => void;
662
663
  /** Why a value would be refused, in the app's words, or null when it reads. The editor checks again at the close. */
663
664
  check: (value: number | null, unit?: string) => string | null;
@@ -1710,7 +1711,7 @@ export type ViewsComponents = {
1710
1711
  Checkbox: ComponentType<ViewsCheckboxProps>;
1711
1712
  Menu: ComponentType<ViewsMenuProps>;
1712
1713
  /** @deprecated Read by nothing: the grid's menus are your `Menu` and every list an editor opens is your `Picker`.
1713
- * Leave it out; it goes at a later minor. */
1714
+ * Leave it out; it goes in a later release that breaks something anyway. */
1714
1715
  Command?: ViewsCommandParts;
1715
1716
  /** Optional: the filter's month draws through it (the date editor opens `DateBody`). Reached without one, it throws
1716
1717
  * an error naming it. */
@@ -5,7 +5,8 @@ export { DEFAULT_DESKTOP_QUERY } from "../internal/phone-line.js";
5
5
  * The package's own: no entry point exports it. */
6
6
  export declare function isDesktopNow(query: string): boolean;
7
7
  /** Whether the screen is a desktop, by the provider's `desktopQuery`: true where there is no
8
- * `matchMedia`. It follows the query's changes. The package's own: no entry point exports it. */
8
+ * `matchMedia`; inside a `ScreenForms` twin while the page comes alive, the screen it is told. It follows the query's
9
+ * changes. The package's own: no entry point exports it. */
9
10
  export declare function useDesktop(): boolean;
10
11
  /** Whether `query` matches the screen, following its changes. `fallback` is the answer where the screen
11
12
  * can't be asked (a server render, no `matchMedia`). The package's own: no entry point exports it. */
@@ -1,5 +1,6 @@
1
1
  "use client";
2
- import { useCallback, useSyncExternalStore } from "react";
2
+ import { useCallback, useContext, useSyncExternalStore } from "react";
3
+ import { ScreenTold } from "../internal/screen-forms.js";
3
4
  import { useViews } from "./context.js";
4
5
  export { DEFAULT_DESKTOP_QUERY } from "../internal/phone-line.js";
5
6
  function canAsk() {
@@ -10,7 +11,9 @@ export function isDesktopNow(query) {
10
11
  }
11
12
  export function useDesktop() {
12
13
  const { desktopQuery } = useViews();
13
- return useMediaQuery(desktopQuery, true);
14
+ const told = useContext(ScreenTold);
15
+ const desktop = useMediaQuery(desktopQuery, true);
16
+ return told ? told === "computer" : desktop;
14
17
  }
15
18
  export function useMediaQuery(query, fallback) {
16
19
  const subscribe = useCallback((onChange) => {
@@ -2,6 +2,8 @@ import type { ViewsMenuItem } from "../provider/components.js";
2
2
  import type { SelectionVerb } from "./verbs.js";
3
3
  /** How many verbs stay on the bar before the rest fold into More. */
4
4
  export declare const INLINE_VERBS = 4;
5
+ /** The first four verbs not marked `more` stand on the bar. More holds the marked ones, then the rest past
6
+ * four: the components map's bar's order (`moreRows`), so both list More alike. */
5
7
  export declare function splitVerbs(verbs: readonly SelectionVerb[]): {
6
8
  inline: SelectionVerb[];
7
9
  overflow: SelectionVerb[];
@@ -1,6 +1,7 @@
1
1
  export const INLINE_VERBS = 4;
2
2
  export function splitVerbs(verbs) {
3
- return { inline: verbs.slice(0, INLINE_VERBS), overflow: verbs.slice(INLINE_VERBS) };
3
+ const onBar = verbs.filter((verb) => !verb.more), kept = verbs.filter((verb) => verb.more);
4
+ return { inline: onBar.slice(0, INLINE_VERBS), overflow: [...kept, ...onBar.slice(INLINE_VERBS)] };
4
5
  }
5
6
  export function overflowItems(overflow) {
6
7
  const reason = (disabled, why) => disabled && why ? { disabledReason: why } : {};
@@ -11,7 +11,7 @@ export type SelectionBarProps = {
11
11
  };
12
12
  /** Clears the selection: the count chip, the phone's ✕. */
13
13
  onClear: () => void;
14
- /** What the selection lets a person do, in order: the first four on the bar, the rest in More. */
14
+ /** What the selection lets a person do, in order: the first four not marked `more` on ViewKit's own bar, the rest in More. */
15
15
  verbs: readonly SelectionVerb[];
16
16
  /** A batch is running: every control is disabled until it ends. */
17
17
  busy?: boolean;
@@ -35,7 +35,7 @@ export type SelectionOptionsVerb = {
35
35
  /** Its values: a status by its `slot`, a category by its `color`, a person or a company by `avatarUrl` (null: their initials)
36
36
  * and `kind`. ViewKit's own bar reads the value, the label, the slot and the colour. */
37
37
  options: ViewsPickerItem[];
38
- /** Kept off the bar, in More (CONTROLS.SelectionBar's bar). */
38
+ /** Kept off the bar, in More: on ViewKit's own bar and on CONTROLS.SelectionBar's. */
39
39
  more?: boolean;
40
40
  /** What every picked row holds, when they hold the same: a value, or null when every one is empty; left out, they differ.
41
41
  * CONTROLS.SelectionBar's bar marks it. */
@@ -58,7 +58,7 @@ export type SelectionVerb = ({
58
58
  kind: "group";
59
59
  label: string;
60
60
  icon?: ReactNode;
61
- /** Kept off the bar, in More (CONTROLS.SelectionBar's bar). */
61
+ /** Kept off the bar, in More: on ViewKit's own bar and on CONTROLS.SelectionBar's. */
62
62
  more?: boolean;
63
63
  disabled?: boolean;
64
64
  /** Why the group is disabled: its own button and More's row carry it, and so does each of its rows that