viewkitjs 0.30.0 → 0.30.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -6
- package/package.json +1 -1
- package/views/dist/controls/button/map-button.d.ts +5 -3
- package/views/dist/controls/button/map-button.js +14 -7
- package/views/dist/panels/react/views-row/FoldingViewRow.js +3 -4
- package/views/dist/styles.css +1 -1
- package/views/dist/styles.unlayered.css +1 -1
- package/views/docs/reference/controls.md +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,12 @@ Until 0.19.0 ViewKit shipped as three packages; their changes are in [fields/CHA
|
|
|
5
5
|
|
|
6
6
|
## [Unreleased]
|
|
7
7
|
|
|
8
|
+
## [0.30.1] — 2026-12-01
|
|
9
|
+
|
|
10
|
+
### Fixed
|
|
11
|
+
|
|
12
|
+
- At ViewKit's defaults (`CONTROLS.Button`, no `Button` of your own), the views picker's chip stands on one line again: the view's glyph small, beside its name, the chevron after it, where 0.30.0 drew the glyph large and stacked over the name. The views row's "+N" chip stands its count and chevron on one line the same way. `CONTROLS.Button` now counts your `AppIcon` as a glyph, as it counts an svg or one of your icons, and stands a glyph handed after the words as its end icon, as it stands one handed before them as its icon. `leadingGlyph` returns that end glyph as `iconEnd`. This is a default every app that takes `CONTROLS.Button` sees; an app that hands its own `Button` (the portal, the Showcase's own pages, outright-base, Atlas) sees nothing change.
|
|
13
|
+
|
|
8
14
|
## [0.30.0] — 2026-12-01
|
|
9
15
|
|
|
10
16
|
### Added
|
|
@@ -385,10 +391,9 @@ Create your search indexes again. The folded text `searchIndexes` prints changed
|
|
|
385
391
|
|
|
386
392
|
## [0.25.0] — 2026-11-26
|
|
387
393
|
|
|
388
|
-
viewkitjs/views/controls: the Menu (the components map's default `Menu`, with `menuEntries`), its context menu and its ⋯, the Avatar and its stack, the Select, and the Picker's core (`usePicker`, `Picker`, `PickerUnder` and its rows), with the popup line's stylesheet, the phone's line (`usePhone`, `PhoneHost`, `ComputerHost`) and a list's own scrolling; their looks (`LIST_LOOKS`, `PICKER_LOOKS`, `AVATAR_LOOKS`) in viewkitjs/views/looks.
|
|
389
|
-
|
|
390
394
|
### Added
|
|
391
395
|
|
|
396
|
+
- `viewkitjs/views/controls`: the Menu (the components map's default `Menu`, with `menuEntries`), its context menu and its ⋯, the Avatar and its stack, the Select, and the Picker's core (`usePicker`, `Picker`, `PickerUnder` and its rows), with the popup line's stylesheet, the phone's line (`usePhone`, `PhoneHost`, `ComputerHost`) and a list's own scrolling; their looks (`LIST_LOOKS`, `PICKER_LOOKS`, `AVATAR_LOOKS`) in `viewkitjs/views/looks`.
|
|
392
397
|
- `viewkitjs/fields/definitions`: every setting `creatableFieldTypes(cv)` lists carries a `label` in the host's words, and a word or words setting carries `wordLabels`, a name for each of its words, so a New field dialog names every setting and choice without a copy of its own.
|
|
393
398
|
- Two message keys, so a host renames them in its own language; an exhaustive resolver words them:
|
|
394
399
|
- `setting.label` (values `type`, `path`): Default value, Fewest characters, Most characters (a name's and a place's: Most characters in each part), Pattern it must match, Written over several lines, Stored as, Lowest value, Highest value, Whole numbers only, Most decimals, Shown as, Decimals shown, Unit after the number, Show + and −, A rise reads as, Stored in, Duration style, Currency, A range of, Per, A date to look forward to, Date style, Show the time, Options, Values allowed, Most values (a multi-select's: Most choices), Tidy each value, Links to, How many, Holds several values, Parts of the place.
|
|
@@ -398,6 +403,9 @@ viewkitjs/views/controls: the Menu (the components map's default `Menu`, with `m
|
|
|
398
403
|
|
|
399
404
|
- `viewkitjs/fields`: a text field's `validation.pattern` is read in ViewKit's own pattern dialect and matched without backtracking: each character of a value costs at most one pass over the pattern's steps, and one value may cost at most 20,000,000 steps in all (its characters times the pattern's steps, about a fifth of a second). The dialect is JavaScript's regular-expression syntax with no flags and answers as `RegExp` does, without lookahead, lookbehind, backreferences or group flags (`(?i:…)`), and without the legacy forms whose meaning depends on where they sit (a lone `{`, `}` or `]`); its escapes are `\d \w \s \b`, their capitals, `\t \n \r \f \v \0 \xHH \uHHHH` and any escaped ASCII symbol, and an escaped letter or digit it doesn't know (`\q`, `\cJ`, `\u{41}`) is refused. A pattern is at most 500 characters and 1,000 steps once its repeats are counted out. `checkFieldSpec`, `defineFields` and `zodFor` refuse a pattern outside it, in the same words. Before, any pattern that compiled was taken: a pattern declared in code that uses one of these now fails at definition and is rewritten, for example `"^(?!test)\\w+$"` (lookahead) as a check of its own, `"(\\w)\\1"` (a backreference) as a check of its own, `"a{"` as `"a\\{"`, `"\\q"` as `"q"`. A definition already stored as data is checked the same way when `zodFor` builds its schema: run `checkFieldSpec` over your stored definitions before you upgrade.
|
|
400
405
|
- `viewkitjs/fields`: `zodFor` refuses a value too long for its field's pattern to read within that cost as too long ("Too long — at most N characters", `validation.max-length`), before the pattern reads it: 20,000 characters for a cap-sized pattern of 1,000 steps, far more for a short one. A field's own `maxLength`, when lower, says the limit as before.
|
|
406
|
+
- `viewkitjs/views/controls`: with nothing picked, a menu list on a phone draws My preset's Words, for a menu's own sheet: Words rows, full-width lines, rows 56 high and 2xl corners, with no icon, value or chevron on a row. It drew Card rows, inset lines, rows 52 high and xl corners. A piece whose menu lists stand on no menu's own sheet (a panel's settings, a list of people) keeps the card rows with `MENU_LIST_CARD_FRAME` (`viewkitjs/views/looks`) on a frame round them, whatever the app picks; the Menu takes it as its `frame` on a phone.
|
|
407
|
+
- `viewkitjs/views/controls`: with nothing picked, the list's options (the Select's list, the Menu's panel, the Picker on a computer) are My preset's: an outline edge, the xl shadow, 6 of padding and the medium highlight. They were a subtle edge, the md shadow, 4 of padding and the light highlight. A frame that picks the old values (`data-list-edge="subtle"`, `data-list-shadow="md"`, `data-list-padding="4"`, `data-list-intensity="1"`) still draws them.
|
|
408
|
+
- `viewkitjs/views/controls`: a menu's level in steps out by its panel's own padding, where it stepped out by one spacing step, so it meets its panel's edge and its first row stands level with the row that opened it at any padding.
|
|
401
409
|
|
|
402
410
|
### Fixed
|
|
403
411
|
|
|
@@ -405,7 +413,10 @@ viewkitjs/views/controls: the Menu (the components map's default `Menu`, with `m
|
|
|
405
413
|
|
|
406
414
|
## [0.24.0] — 2026-11-26
|
|
407
415
|
|
|
408
|
-
|
|
416
|
+
### Added
|
|
417
|
+
|
|
418
|
+
- `viewkitjs/views/controls`: the menu list, the list's stylesheet and the helpers they stand on (Icon, Grip, useHoldDrag, useReorder); the menu list's looks in `viewkitjs/views/looks`.
|
|
419
|
+
- `viewkitjs/views/looks`: a piece's looks may pick fewer options than it has (`PieceLooks<Id, Picked>`).
|
|
409
420
|
|
|
410
421
|
### Fixed
|
|
411
422
|
|
|
@@ -416,15 +427,15 @@ viewkitjs/views/controls: the menu list, the list's stylesheet and the helpers t
|
|
|
416
427
|
|
|
417
428
|
## [0.23.0] — 2026-11-25
|
|
418
429
|
|
|
419
|
-
viewkitjs/views/controls: the Option, the Tag, the Status and the Switch, their looks in viewkitjs/views/looks; CONTROL_ATOMS draws ViewKit's Tag, StatusBadge and CellMore atoms with them for an app that spreads it into its atoms.
|
|
420
|
-
|
|
421
430
|
### Added
|
|
422
431
|
|
|
432
|
+
- `viewkitjs/views/controls`: the Option, the Tag, the Status and the Switch, their looks in `viewkitjs/views/looks`; `CONTROL_ATOMS` draws ViewKit's Tag, StatusBadge and CellMore atoms with them for an app that spreads it into its atoms.
|
|
423
433
|
- `viewkitjs/views/controls`: the bottom Sheet (`Sheet`, `SheetHead`, `SheetBody`, `SheetFoot`, `SheetStep`, `SheetButton`, `SheetClose`, `useSheetCloseAll`, `STOPS`), with its forms, its stops and its spring, and the phone's header bar (`HeaderBar`) with the soft edge it stands on (`SoftEdge`), join the default controls, on Base UI. `CONTROLS` now also holds `Sheet`. Their stylesheets are `viewkitjs/views/controls/sheet.css` and `phone-header.css`, and the ready stylesheet carries them.
|
|
424
434
|
- `viewkitjs/views/looks`: `SHEET_LOOKS` and `PHONE_HEADER_LOOKS`, by the Outright kit's names.
|
|
425
435
|
- `viewkitjs/views/controls`: the Popover, the Tooltip (with `TooltipGroup`, `TooltipShown` and `TOOLTIP_TIMING`), the Kbd, the Glass button (with `GlassButtonGroup`) and the Scrollbar join the default controls, on Base UI; `POPUP_HOST` and `popupHostOf` name where a popup stands. `CONTROLS` now also holds `Popover` and `Tooltip`. Each control's stylesheet is `viewkitjs/views/controls/<piece>.css` (`popover`, `tooltip`, `kbd`, `glass-button`, `scrollbar`), every name it reads listed on its page under `docs/controls/`, and the ready stylesheet carries them.
|
|
426
436
|
- `viewkitjs/views/looks`: `POPOVER_LOOKS`, `TOOLTIP_LOOKS`, `KBD_LOOKS` and `GLASS_BUTTON_LOOKS`, each control's options by the Outright kit's names.
|
|
427
437
|
- `viewkitjs/views/controls`: the Input (with its InputGroup, addons, buttons and segments, and a box's own look), the inline input, the Field (with FieldSet, FieldSeparator and Field rows), the Toggle and its group, the number field and the Checkbox (with its mark and list), on Base UI, as the Outright kit draws them; and `useAutofill`, which turns the browser's and the password managers' filling off on a box.
|
|
438
|
+
- The stylesheets of the Input, the inline input, the Field, the Toggle, the number field and the Checkbox, `viewkitjs/views/controls/{input,inline-input,field,toggle,number-field,checkbox}.css`, in the ready stylesheet too, and each one's tokens page under `views/docs/controls/`. Their phone rules hold below 640px, by the Outright Showcase's hooks (`o-phone`, `data-computer-host`), named in the controls' reference page.
|
|
428
439
|
- `CONTROLS` draws the components map's `Input` and `Checkbox`.
|
|
429
440
|
- Their options and looks on `viewkitjs/views/looks`: `INPUT_LOOKS`, `INLINE_INPUT_LOOKS`, `FIELD_LOOKS`, `TOGGLE_LOOKS`, `CHECKBOX_LOOKS`; a box's own look beside the Input's (`InputOwnLook`, `inputAttrs`, `inputOwnAttrs`, `inputFrameAttrs`, `kindLook`, `attioBox`) and a Field rows card's (`fieldRowsAttrs`, `FieldRowsLook`).
|
|
430
441
|
- `VK_CONTROL_TOKENS_BY_PIECE` and `ControlToken`: each default control's own list of the names its stylesheet reads, with each name's kind and the Outright token it stands for (`outright`). `VK_CONTROL_TOKENS` gathers them, once each.
|
|
@@ -437,7 +448,6 @@ viewkitjs/views/controls: the Option, the Tag, the Status and the Switch, their
|
|
|
437
448
|
- Where nothing says otherwise, the phone header's surface is Glass and two Glass buttons stand together on the pill, as their options' defaults say; only `data-phone-header-surface="flat"` or `data-glass-button-pair="separate"` set them apart.
|
|
438
449
|
- The default Popover's shadow is `md` and two Glass buttons share the glass pill unless something round them says `separate`: My preset's picks, the Outright look's defaults.
|
|
439
450
|
- The inline input's default is the Outright look's: the line, `md` corners, on a 20% tint of the brand (it was the `attio` look: `sm` corners on the overlay's ground). An app that picks none of its options, or only some, draws the new defaults for the rest.
|
|
440
|
-
- Their stylesheets, `viewkitjs/views/controls/{input,inline-input,field,toggle,number-field,checkbox}.css`, in the ready stylesheet too, and each one's tokens page under `views/docs/controls/`. Their phone rules hold below 640px, by the Outright Showcase's hooks (`o-phone`, `data-computer-host`), named in the controls' reference page.
|
|
441
451
|
- The number field's stepper gap is named with the addon it stands in (`.o-input-addon.o-number-steps`), so it wins over the addon's own gap whatever order the stylesheets load in.
|
|
442
452
|
- The controls' stylesheet doors are one pattern, `viewkitjs/views/controls/<piece>.css` (the outline's `smooth.css`, the Button's `button.css`, the Spinner's `spinner.css`), the same paths as before.
|
|
443
453
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "viewkitjs",
|
|
3
|
-
"version": "0.30.
|
|
3
|
+
"version": "0.30.1",
|
|
4
4
|
"description": "ViewKit — typed fields, the grid and its editors, and a list's SQL for record lists, in one package: viewkitjs/fields, viewkitjs/views and viewkitjs/postgres. By Sheaf.",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"repository": {
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import type { ViewsButtonProps } from "../../provider/components.js";
|
|
3
|
-
/** A glyph ViewKit hands before a button's words (+ Add column's "+", its icon in a fragment with the words
|
|
4
|
-
*
|
|
5
|
-
*
|
|
3
|
+
/** A glyph ViewKit hands before a button's words (+ Add column's "+", its icon in a fragment with the words; the views chip's
|
|
4
|
+
* view glyph) is the Button's icon, and one after them (the chip's chevron) its end icon, so each stands beside the words on
|
|
5
|
+
* one line, never stacked over or under them in the label. A glyph is an svg, one of the app's icons or its `AppIcon`
|
|
6
|
+
* (`glyphs`), never another component; a glyph alone stays the children. */
|
|
6
7
|
export declare function leadingGlyph(children: React.ReactNode, glyphs: ReadonlySet<unknown>): {
|
|
7
8
|
icon?: React.ReactNode;
|
|
8
9
|
label: React.ReactNode;
|
|
10
|
+
iconEnd?: React.ReactNode;
|
|
9
11
|
};
|
|
10
12
|
/** ViewKit's button, drawn as the kit's Button. Outside a provider (an app drawing it on its own) only an svg is a glyph. */
|
|
11
13
|
export declare function MapButton({ variant, size, type, children, ...rest }: ViewsButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -8,13 +8,20 @@ const KIND = {
|
|
|
8
8
|
export function leadingGlyph(children, glyphs) {
|
|
9
9
|
const inner = React.isValidElement(children) && children.type === React.Fragment ? children.props.children : children;
|
|
10
10
|
const parts = React.Children.toArray(inner);
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
const isGlyph = (part) => React.isValidElement(part) && (part.type === "svg" || glyphs.has(part.type));
|
|
12
|
+
if (parts.length < 2)
|
|
13
|
+
return { label: children };
|
|
14
|
+
const icon = isGlyph(parts[0]) ? parts[0] : undefined;
|
|
15
|
+
const words = parts.slice(icon === undefined ? 0 : 1);
|
|
16
|
+
const iconEnd = words.length > 1 && isGlyph(words[words.length - 1]) ? words[words.length - 1] : undefined;
|
|
17
|
+
if (icon === undefined && iconEnd === undefined)
|
|
18
|
+
return { label: children };
|
|
19
|
+
return { icon, label: iconEnd === undefined ? words : words.slice(0, -1), iconEnd };
|
|
14
20
|
}
|
|
15
21
|
export function MapButton({ variant = "default", size = "default", type = "button", children, ...rest }) {
|
|
16
|
-
const
|
|
17
|
-
const
|
|
18
|
-
const
|
|
19
|
-
|
|
22
|
+
const views = React.useContext(ViewsContext);
|
|
23
|
+
const icons = views?.icons, AppIcon = views?.components.AppIcon;
|
|
24
|
+
const glyphs = React.useMemo(() => new Set([...(icons ? Object.values(icons) : []), ...(AppIcon ? [AppIcon] : [])]), [icons, AppIcon]);
|
|
25
|
+
const { icon, label, iconEnd } = size === "icon" ? { icon: undefined, label: children, iconEnd: undefined } : leadingGlyph(children, glyphs);
|
|
26
|
+
return _jsx(Button, { kind: KIND[variant], size: size === "default" ? "md" : "sm", shape: size === "icon" ? "icon" : "default", type: type, icon: icon, iconEnd: iconEnd, ...rest, children: label });
|
|
20
27
|
}
|
|
@@ -94,12 +94,11 @@ export function FoldingViewRow({ axis, folded: told }) {
|
|
|
94
94
|
variant: "ghost",
|
|
95
95
|
size: "sm",
|
|
96
96
|
"data-slot": "vk-views-more",
|
|
97
|
-
children:
|
|
97
|
+
children: moreChipInner(views, 99),
|
|
98
98
|
}) })), axis.onCreate && (_jsx("span", { "data-measure-ghost": true, children: _jsx(ViewCreatePill, { label: axis.createLabel, onClick: () => { } }) }))] }) }))] }));
|
|
99
99
|
}
|
|
100
100
|
const MORE_CHIP_FRAME = "h-8 shrink-0 gap-0.5 whitespace-nowrap px-2.5";
|
|
101
|
-
function
|
|
102
|
-
const { conventions, icons } = useViews();
|
|
101
|
+
function moreChipInner({ conventions, icons }, count) {
|
|
103
102
|
const Chevron = icons.chevronDown;
|
|
104
103
|
return (_jsxs(_Fragment, { children: ["+", formatCount(count, conventions), _jsx(Chevron, { className: "h-3.5 w-3.5 shrink-0 opacity-70" })] }));
|
|
105
104
|
}
|
|
@@ -126,7 +125,7 @@ function FoldedViews({ axis, options, }) {
|
|
|
126
125
|
"data-state": toggle.open ? "open" : "closed",
|
|
127
126
|
onPointerDown: toggle.triggerProps.onPointerDown,
|
|
128
127
|
onClick: toggle.triggerProps.onClick,
|
|
129
|
-
children:
|
|
128
|
+
children: moreChipInner(views, options.length),
|
|
130
129
|
} })), _jsx(Popover, { open: toggle.open, onOpenChange: toggle.onOpenChange, anchor: anchor, align: "start", sideOffset: 6, chrome: "menu", className: "w-64", 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, onSelect: () => {
|
|
131
130
|
axis.onChange(option.value);
|
|
132
131
|
toggle.close();
|
package/views/dist/styles.css
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! viewkitjs 0.30.
|
|
1
|
+
/*! viewkitjs 0.30.1 · viewkitjs/views/styles.css: ViewKit's look, its defaults the Outright look */
|
|
2
2
|
/*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */
|
|
3
3
|
@layer theme, base, components, utilities;
|
|
4
4
|
@layer base {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! viewkitjs 0.30.
|
|
1
|
+
/*! viewkitjs 0.30.1 · viewkitjs/views/styles.unlayered.css: ViewKit's look, its defaults the Outright look */
|
|
2
2
|
|
|
3
3
|
@layer base {
|
|
4
4
|
@layer viewkit {:where(*):where([data-slot^="vk-"], [data-vk-body], [data-slot^="vk-"] *, [data-vk-body] *),
|
|
@@ -4,8 +4,8 @@ Import from `viewkitjs/views/controls` to draw ViewKit's default controls: the O
|
|
|
4
4
|
|
|
5
5
|
## The defaults
|
|
6
6
|
|
|
7
|
-
- `CONTROLS` — the components map's defaults, for each control an app leaves out: each control below that fills a slot of the map. An app spreads it first and its own controls after, `components={{ ...CONTROLS, ...own }}`. Its `Button` draws ViewKit's buttons (`variant`, `size`) as the kit's Button's kinds and sizes,
|
|
8
|
-
- `leadingGlyph` — `leadingGlyph(children, glyphs)`: a glyph before a button's words (an svg, or one of the app's icons in `glyphs`) as `
|
|
7
|
+
- `CONTROLS` — the components map's defaults, for each control an app leaves out: each control below that fills a slot of the map. An app spreads it first and its own controls after, `components={{ ...CONTROLS, ...own }}`. Its `Button` draws ViewKit's buttons (`variant`, `size`) as the kit's Button's kinds and sizes, stands a glyph handed before the words as the Button's icon, and one handed after them as its end icon.
|
|
8
|
+
- `leadingGlyph` — `leadingGlyph(children, glyphs)`: a glyph before a button's words (an svg, or one of the app's icons or its `AppIcon` in `glyphs`) as `icon`, one after them as `iconEnd`, and the words as `label`; a glyph alone, or another component, stays `{ label }`.
|
|
9
9
|
|
|
10
10
|
<!-- One block per lane of control moves, each opened by its comment: a move adds its controls' sections inside its own block alone. -->
|
|
11
11
|
|