viewkitjs 0.24.0-pr-755-9d44fcd → 0.25.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 (69) hide show
  1. package/CHANGELOG.md +31 -0
  2. package/package.json +1 -1
  3. package/views/dist/controls/avatar/avatar.d.ts +58 -0
  4. package/views/dist/controls/avatar/avatar.js +54 -0
  5. package/views/dist/controls/avatar/looks.d.ts +4 -0
  6. package/views/dist/controls/avatar/looks.js +5 -0
  7. package/views/dist/controls/avatar/tokens.d.ts +131 -0
  8. package/views/dist/controls/avatar/tokens.js +35 -0
  9. package/views/dist/controls/avatar.css +163 -0
  10. package/views/dist/controls/controls.d.ts +2 -0
  11. package/views/dist/controls/controls.js +2 -0
  12. package/views/dist/controls/index.d.ts +12 -0
  13. package/views/dist/controls/index.js +12 -0
  14. package/views/dist/controls/internal/phone.d.ts +9 -0
  15. package/views/dist/controls/internal/phone.js +15 -0
  16. package/views/dist/controls/internal/read-token.d.ts +2 -1
  17. package/views/dist/controls/internal/read-token.js +1 -1
  18. package/views/dist/controls/internal/scroll.d.ts +38 -0
  19. package/views/dist/controls/internal/scroll.js +126 -0
  20. package/views/dist/controls/list/looks.d.ts +4 -0
  21. package/views/dist/controls/list/looks.js +12 -0
  22. package/views/dist/controls/list.css +17 -13
  23. package/views/dist/controls/menu/map-menu.d.ts +11 -0
  24. package/views/dist/controls/menu/map-menu.js +47 -0
  25. package/views/dist/controls/menu/menu.d.ts +75 -0
  26. package/views/dist/controls/menu/menu.js +105 -0
  27. package/views/dist/controls/menu/tokens.d.ts +23 -0
  28. package/views/dist/controls/menu/tokens.js +8 -0
  29. package/views/dist/controls/menu-list/looks.d.ts +5 -1
  30. package/views/dist/controls/menu-list/looks.js +6 -4
  31. package/views/dist/controls/menu-list/menu-list.js +3 -1
  32. package/views/dist/controls/menu-list.css +39 -31
  33. package/views/dist/controls/menu.css +25 -0
  34. package/views/dist/controls/picker/looks.d.ts +19 -0
  35. package/views/dist/controls/picker/looks.js +32 -0
  36. package/views/dist/controls/picker/picker.d.ts +153 -0
  37. package/views/dist/controls/picker/picker.js +773 -0
  38. package/views/dist/controls/picker/rows.d.ts +129 -0
  39. package/views/dist/controls/picker/rows.js +90 -0
  40. package/views/dist/controls/picker/tokens.d.ts +147 -0
  41. package/views/dist/controls/picker/tokens.js +39 -0
  42. package/views/dist/controls/picker.css +237 -0
  43. package/views/dist/controls/popup-line/tokens.d.ts +23 -0
  44. package/views/dist/controls/popup-line/tokens.js +8 -0
  45. package/views/dist/controls/popup-line.css +44 -0
  46. package/views/dist/controls/select/filled.d.ts +7 -0
  47. package/views/dist/controls/select/filled.js +5 -0
  48. package/views/dist/controls/select/fit.d.ts +9 -0
  49. package/views/dist/controls/select/fit.js +11 -0
  50. package/views/dist/controls/select/select.d.ts +131 -0
  51. package/views/dist/controls/select/select.js +227 -0
  52. package/views/dist/controls/select/side.d.ts +3 -0
  53. package/views/dist/controls/select/side.js +4 -0
  54. package/views/dist/controls/select/tokens.d.ts +27 -0
  55. package/views/dist/controls/select/tokens.js +9 -0
  56. package/views/dist/controls/select.css +91 -0
  57. package/views/dist/controls/tokens.js +10 -0
  58. package/views/dist/looks/index.d.ts +4 -0
  59. package/views/dist/looks/index.js +4 -0
  60. package/views/dist/looks/pieces.js +6 -0
  61. package/views/dist/styles.css +586 -62
  62. package/views/dist/styles.unlayered.css +586 -62
  63. package/views/docs/controls/avatar.md +38 -0
  64. package/views/docs/controls/menu.md +11 -0
  65. package/views/docs/controls/picker.md +42 -0
  66. package/views/docs/controls/popup-line.md +11 -0
  67. package/views/docs/controls/select.md +12 -0
  68. package/views/docs/reference/controls.md +86 -0
  69. package/views/docs/reference/looks.md +8 -0
package/CHANGELOG.md CHANGED
@@ -5,6 +5,37 @@ Until 0.19.0 ViewKit shipped as three packages; their changes are in [fields/CHA
5
5
 
6
6
  ## [Unreleased]
7
7
 
8
+ ## [0.25.0] — 2026-11-26
9
+
10
+ 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.
11
+
12
+ ### Added
13
+
14
+ - `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.
15
+ - Two message keys, so a host renames them in its own language; an exhaustive resolver words them:
16
+ - `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.
17
+ - `setting.word` (values `type`, `path`, `word`): Number and Exact decimal; Number and Duration; Checkbox, Icon, Marker and Words; Up is good and Neutral; Milliseconds and Seconds; Adaptive, Clock and Units; Number, Bar and Ring; Numbers, Amounts and Percents; Hour, Day, Week, Month and Year; Short, Long, Numbers only and Relative; Only the listed options and Any value typed in; Trim spaces, Lowercase and Spaces to hyphens; One record and Several records; Address line 1, Address line 2, Postal code, City, Region, Region code and Country.
18
+
19
+ ### Changed
20
+
21
+ - `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.
22
+ - `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.
23
+
24
+ ### Fixed
25
+
26
+ - `viewkitjs/fields`: a pattern such as `(a+)+$`, accepted from data by `checkFieldSpec`, no longer lets one crafted value hold a server's thread: no pattern and no value cost more than the bound above.
27
+
28
+ ## [0.24.0] — 2026-11-26
29
+
30
+ 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. A piece's looks may pick fewer options than it has (`PieceLooks<Id, Picked>`).
31
+
32
+ ### Fixed
33
+
34
+ - `viewkitjs/views/controls`: inside the bottom Sheet with its smooth corners (its default), a box that draws the smooth outline too (an Input, a Tag) keeps its own rounded bottom corners: the Sheet's square bottom and its foot no longer reach what it holds.
35
+ - `viewkitjs/views/controls`: the strip the Sheet lays under itself in the page goes on and fades on the Sheet's own spring, where a frame picks one.
36
+ - `viewkitjs/views/grid`: Home and End in a cell's editor move its caret to the start or the end of its line (⇧ extends the selection) on every platform. On a Mac they scrolled the whole grid to its top or its foot instead.
37
+ - `viewkitjs/views/grid`: a grid first drawn where it can't be seen (in a box `hidden` or `display: none` takes out of the page) keeps no width read there: a column with no width of its own is fitted once the grid is laid out, never narrower than its header.
38
+
8
39
  ## [0.23.0] — 2026-11-25
9
40
 
10
41
  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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "viewkitjs",
3
- "version": "0.24.0-pr-755-9d44fcd",
3
+ "version": "0.25.0",
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": {
@@ -0,0 +1,58 @@
1
+ import * as React from "react";
2
+ export type AvatarSize = 16 | 20 | 24 | 32 | 40 | 64;
3
+ /** The initials of a name: the first letters of the first and last names; a first name of two joined
4
+ * parts gives both ("Maximiliane-Theodora von Hohenberg-Lichtenstein" is MT); one name gives one ("Jo" is J). */
5
+ export declare function initials(name: string): string;
6
+ /** A person's tone, 1 to 6, from their id: the same on every screen and in every theme. */
7
+ export declare function toneOf(id: string): number;
8
+ /** Whether a person is here now: here, a green dot; away, a hollow ring (after Slack). */
9
+ export type AvatarPresence = "here" | "away";
10
+ export interface AvatarProps {
11
+ /** Whose or what's it is: its accessible name, and where the initials come from. */
12
+ name: string;
13
+ /** People are circles on their tone; things (a company, a record) are squares; the workspace is the one brand square; an agent
14
+ * (Claude, a reply agent) is a thing's square holding its own icon: its app icon as `src`, its mark as `icon`, drawn in its own
15
+ * fills, or with neither its first letter. */
16
+ kind?: "person" | "thing" | "workspace" | "agent";
17
+ /** 16 in a chip (a typed Select's), with no badge; 20 in chips and text, 24 in dense rows and stacks, 32 in list rows,
18
+ * 40 in headers, 64 on a record's own page. */
19
+ size?: AvatarSize;
20
+ /** A stable id, for a person's tone. */
21
+ id?: string;
22
+ /** The tone itself, where the app keeps it. */
23
+ tone?: 1 | 2 | 3 | 4 | 5 | 6;
24
+ /** A photo or a logo, filling the same shape. */
25
+ src?: string;
26
+ /** A record with no name: its kind's icon instead of a letter. */
27
+ icon?: React.ReactNode;
28
+ /** Whether a person is here now: here, a green dot; away, a hollow ring; offline, leave it out. Wins over a badge. */
29
+ presence?: AvatarPresence;
30
+ /** shadcn's AvatarBadge: a dot on its corner in the brand, or one holding an icon (shown from 32 up). */
31
+ badge?: true | React.ReactNode;
32
+ className?: string;
33
+ }
34
+ /** Who or what a row is about, at a glance. */
35
+ export declare function Avatar({ name, kind, size, id, tone, src, icon, presence, badge, className }: AvatarProps): import("react/jsx-runtime").JSX.Element;
36
+ /** One person on a stack. */
37
+ export type AvatarStackPerson = Omit<AvatarProps, "size" | "kind">;
38
+ export interface AvatarStackProps {
39
+ /** Who is on it, in order. */
40
+ people: AvatarStackPerson[];
41
+ /** How many to show before the rest become a count. */
42
+ max?: number;
43
+ size?: Exclude<AvatarSize, 16>;
44
+ className?: string;
45
+ /** What everyone is on ("Acme Robotics renewal"): the list's name to a screen reader. Left out, the stack's own words. */
46
+ label?: string;
47
+ /** The whole stack is one button: pressed, it opens everyone in a list (the Menu, All rows: a popup on a computer, the Sheet
48
+ * on a phone, its card rows pinned whatever the app picks for a menu's own sheet), and the person picked there is handed here. */
49
+ onPick?: (person: AvatarStackPerson) => void;
50
+ /** Someone added: "Add someone…" at the end of the list it opens; with addButton, the dashed + after it too. */
51
+ onAdd?: () => void;
52
+ /** Where adding is the main job: a dashed + after the stack, pressing onAdd; with nobody on it, the + alone. */
53
+ addButton?: boolean;
54
+ }
55
+ /** Several people on one thing: overlapping, each cut out of whatever it stands on, the rest as a count. Its accessible name
56
+ * lists them ("Ioana Vlad, Kwame Asante, Lea Brandt and 3 more"). With onPick the whole stack is one button that opens
57
+ * everyone (after Linear); with addButton a dashed + stands after it (after Asana). */
58
+ export declare function AvatarStack({ people, max, size, className, label, onPick, onAdd, addButton }: AvatarStackProps): import("react/jsx-runtime").JSX.Element | null;
@@ -0,0 +1,54 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import * as React from "react";
3
+ import { Avatar as BaseAvatar } from "@base-ui/react/avatar";
4
+ import { cx } from "../../internal/cx.js";
5
+ import { Button } from "../button/button.js";
6
+ import { MENU_LIST_CARD_FRAME } from "../menu-list/looks.js";
7
+ import { Menu } from "../menu/menu.js";
8
+ import { Icon } from "../internal/icons.js";
9
+ import { PhoneHost, usePhone } from "../internal/phone.js";
10
+ const SIZE = { 16: "o-avatar-2xs", 20: "o-avatar-xs", 24: "o-avatar-sm", 32: "", 40: "o-avatar-lg", 64: "o-avatar-xl" };
11
+ export function initials(name) {
12
+ const words = name.split(/\s+/).filter((w) => /^\p{L}/u.test(w));
13
+ if (!words.length)
14
+ return "";
15
+ const first = words[0].split("-").filter(Boolean);
16
+ if (first.length > 1)
17
+ return (first[0][0] + first[1][0]).toUpperCase();
18
+ return (words[0][0] + (words.length > 1 ? words[words.length - 1][0] : "")).toUpperCase();
19
+ }
20
+ export function toneOf(id) {
21
+ let h = 0;
22
+ for (const c of id)
23
+ h = (h * 31 + c.charCodeAt(0)) >>> 0;
24
+ return (h % 6) + 1;
25
+ }
26
+ export function Avatar({ name, kind = "person", size = 32, id, tone, src, icon, presence, badge, className }) {
27
+ const person = kind === "person";
28
+ const letters = icon ? null : kind === "thing" || kind === "agent" ? initials(name).slice(0, 1) : initials(name);
29
+ const avatar = (_jsxs(BaseAvatar.Root, { role: "img", "aria-label": presence ? `${name}, ${presence}` : name, "data-kit": "avatar", "data-tone": person ? tone ?? toneOf(id ?? name) : undefined, className: cx("o-avatar", SIZE[size], !person && "o-avatar-thing o-smooth o-smooth-ease", kind === "workspace" && "o-avatar-workspace", kind === "agent" && "o-avatar-agent", className), children: [src && _jsx(BaseAvatar.Image, { className: "o-avatar-image", src: src, alt: "" }), _jsx(BaseAvatar.Fallback, { className: "o-avatar-letters", "aria-hidden": "true", children: icon ?? letters })] }));
30
+ if (size === 16 || (!presence && (badge == null || badge === false)))
31
+ return avatar;
32
+ return (_jsxs("span", { className: "o-avatar-badged", "data-size": size, "data-thing": person ? undefined : "", children: [avatar, presence ? _jsx("span", { className: "o-avatar-badge", "data-presence": presence, "aria-hidden": "true" })
33
+ : _jsx("span", { className: "o-avatar-badge", "data-badge": "", "aria-hidden": "true", children: badge === true ? null : badge })] }));
34
+ }
35
+ const ADD_SIZE = { 20: "20", 24: "2xs", 32: "sm", 40: "md", 64: "lg" };
36
+ export function AvatarStack({ people, max = 3, size = 24, className, label, onPick, onAdd, addButton }) {
37
+ const screen = React.useContext(PhoneHost), phone = usePhone() || !!screen;
38
+ const shown = people.length > max + 1 ? people.slice(0, max) : people, rest = people.length - shown.length;
39
+ const names = shown.map((p) => p.name), said = rest ? `${names.join(", ")} and ${rest} more` : names.length > 1 ? `${names.slice(0, -1).join(", ")} and ${names[names.length - 1]}` : names.join("");
40
+ const faces = _jsxs(_Fragment, { children: [shown.map((p) => _jsx(Avatar, { ...p, size: size }, p.id ?? p.name)), rest > 0 && _jsxs("span", { className: cx("o-avatar o-avatar-more", SIZE[size]), "aria-hidden": "true", children: ["+", rest] })] });
41
+ const add = addButton && onAdd
42
+ ? _jsx(Button, { kind: "outline", shape: "round", size: ADD_SIZE[size], className: "o-avatar-add", "data-size": size, "aria-label": "Add someone", icon: _jsx(Icon, { name: "plus" }), onClick: onAdd })
43
+ : null;
44
+ if (!people.length)
45
+ return add;
46
+ const entries = [
47
+ ...people.map((p) => ({ icon: _jsx(Avatar, { ...p, size: phone ? 32 : 20 }), label: p.name, onSelect: () => onPick?.(p) })),
48
+ ...(onAdd ? [{ kind: "separator" }, { icon: _jsx(Icon, { name: "plus", size: 16 }), label: "Add someone…", onSelect: onAdd }] : []),
49
+ ];
50
+ const stack = onPick
51
+ ? _jsx(Menu, { label: label ?? said, align: "start", allRows: true, frame: MENU_LIST_CARD_FRAME, entries: entries, trigger: _jsx(Button, { kind: "quiet", className: cx("o-avatar-stack-button", className), "aria-label": said, children: _jsx("span", { className: "o-avatar-stack", "aria-hidden": "true", children: faces }) }) })
52
+ : _jsx("span", { className: cx("o-avatar-stack", className), role: "img", "aria-label": said, children: faces });
53
+ return add ? _jsxs("span", { className: "o-avatar-stack-group", children: [stack, add] }) : stack;
54
+ }
@@ -0,0 +1,4 @@
1
+ import type { PieceLooks } from "../../looks/looks.js";
2
+ export type AvatarLookOptionId = "corners" | "smoothing";
3
+ /** The Avatar's options; it has no looks. */
4
+ export declare const AVATAR_LOOKS: PieceLooks<AvatarLookOptionId>;
@@ -0,0 +1,5 @@
1
+ const options = [
2
+ { id: "corners", name: "Corners", def: "medium", kind: "steps", values: [{ id: "small", name: "Small" }, { id: "medium", name: "Medium" }, { id: "large", name: "Large" }, { id: "xlarge", name: "Extra large" }] },
3
+ { id: "smoothing", name: "Corner smoothing", def: "smooth", values: [{ id: "round", name: "Round" }, { id: "smooth", name: "Smooth" }] },
4
+ ];
5
+ export const AVATAR_LOOKS = { id: "avatar", name: "Avatar", options, looks: [] };
@@ -0,0 +1,131 @@
1
+ export declare const AVATAR_TOKENS: readonly [{
2
+ readonly name: "--vk-border-subtle";
3
+ readonly kind: "colour";
4
+ readonly outright: "--border-subtle";
5
+ }, {
6
+ readonly name: "--vk-brand";
7
+ readonly kind: "colour";
8
+ readonly outright: "--background-brand-bold";
9
+ }, {
10
+ readonly name: "--vk-fg";
11
+ readonly kind: "colour";
12
+ readonly outright: "--text";
13
+ }, {
14
+ readonly name: "--vk-fg-on-brand";
15
+ readonly kind: "colour";
16
+ readonly outright: "--text-brand-inverse";
17
+ }, {
18
+ readonly name: "--vk-fg-subtle";
19
+ readonly kind: "colour";
20
+ readonly outright: "--text-subtle";
21
+ }, {
22
+ readonly name: "--vk-fg-subtlest";
23
+ readonly kind: "colour";
24
+ readonly outright: "--text-subtlest";
25
+ }, {
26
+ readonly name: "--vk-neutral";
27
+ readonly kind: "colour";
28
+ readonly outright: "--background-neutral";
29
+ }, {
30
+ readonly name: "--vk-person-1";
31
+ readonly kind: "colour";
32
+ readonly outright: "--person-1";
33
+ }, {
34
+ readonly name: "--vk-person-2";
35
+ readonly kind: "colour";
36
+ readonly outright: "--person-2";
37
+ }, {
38
+ readonly name: "--vk-person-3";
39
+ readonly kind: "colour";
40
+ readonly outright: "--person-3";
41
+ }, {
42
+ readonly name: "--vk-person-4";
43
+ readonly kind: "colour";
44
+ readonly outright: "--person-4";
45
+ }, {
46
+ readonly name: "--vk-person-5";
47
+ readonly kind: "colour";
48
+ readonly outright: "--person-5";
49
+ }, {
50
+ readonly name: "--vk-person-6";
51
+ readonly kind: "colour";
52
+ readonly outright: "--person-6";
53
+ }, {
54
+ readonly name: "--vk-person-fg";
55
+ readonly kind: "colour";
56
+ readonly outright: "--person-foreground";
57
+ }, {
58
+ readonly name: "--vk-success-bold";
59
+ readonly kind: "colour";
60
+ readonly outright: "--background-success-bold";
61
+ }, {
62
+ readonly name: "--vk-border-width";
63
+ readonly kind: "size";
64
+ readonly outright: "--border-width";
65
+ }, {
66
+ readonly name: "--vk-dot-size";
67
+ readonly kind: "size";
68
+ readonly outright: "--dot-size";
69
+ }, {
70
+ readonly name: "--vk-font-size-2xl";
71
+ readonly kind: "size";
72
+ readonly outright: "--text-2xl";
73
+ }, {
74
+ readonly name: "--vk-font-size-2xs";
75
+ readonly kind: "size";
76
+ readonly outright: "--text-2xs";
77
+ }, {
78
+ readonly name: "--vk-font-size-3xs";
79
+ readonly kind: "size";
80
+ readonly outright: "--text-3xs";
81
+ }, {
82
+ readonly name: "--vk-font-size-sm";
83
+ readonly kind: "size";
84
+ readonly outright: "--text-sm";
85
+ }, {
86
+ readonly name: "--vk-font-size-xs";
87
+ readonly kind: "size";
88
+ readonly outright: "--text-xs";
89
+ }, {
90
+ readonly name: "--vk-font-weight-semibold";
91
+ readonly kind: "size";
92
+ readonly outright: "--font-weight-semibold";
93
+ }, {
94
+ readonly name: "--vk-radius-2xl";
95
+ readonly kind: "size";
96
+ readonly outright: "--radius-2xl";
97
+ }, {
98
+ readonly name: "--vk-radius-full";
99
+ readonly kind: "size";
100
+ readonly outright: "--radius-full";
101
+ }, {
102
+ readonly name: "--vk-radius-lg";
103
+ readonly kind: "size";
104
+ readonly outright: "--radius-lg";
105
+ }, {
106
+ readonly name: "--vk-radius-md";
107
+ readonly kind: "size";
108
+ readonly outright: "--radius-md";
109
+ }, {
110
+ readonly name: "--vk-radius-sm";
111
+ readonly kind: "size";
112
+ readonly outright: "--radius-sm";
113
+ }, {
114
+ readonly name: "--vk-radius-xl";
115
+ readonly kind: "size";
116
+ readonly outright: "--radius-xl";
117
+ }, {
118
+ readonly name: "--vk-radius-xs";
119
+ readonly kind: "size";
120
+ readonly outright: "--radius-xs";
121
+ }, {
122
+ readonly name: "--vk-spacing";
123
+ readonly kind: "size";
124
+ readonly outright: "--spacing";
125
+ }, {
126
+ readonly name: "--vk-tracking-normal";
127
+ readonly kind: "size";
128
+ readonly outright: "--tracking-normal";
129
+ }];
130
+ /** The Avatar's own machinery: its size, corners, badge and the cut round each face. */
131
+ export declare const AVATAR_PRIVATE: readonly ["--avatar-"];
@@ -0,0 +1,35 @@
1
+ export const AVATAR_TOKENS = [
2
+ { name: "--vk-border-subtle", kind: "colour", outright: "--border-subtle" },
3
+ { name: "--vk-brand", kind: "colour", outright: "--background-brand-bold" },
4
+ { name: "--vk-fg", kind: "colour", outright: "--text" },
5
+ { name: "--vk-fg-on-brand", kind: "colour", outright: "--text-brand-inverse" },
6
+ { name: "--vk-fg-subtle", kind: "colour", outright: "--text-subtle" },
7
+ { name: "--vk-fg-subtlest", kind: "colour", outright: "--text-subtlest" },
8
+ { name: "--vk-neutral", kind: "colour", outright: "--background-neutral" },
9
+ { name: "--vk-person-1", kind: "colour", outright: "--person-1" },
10
+ { name: "--vk-person-2", kind: "colour", outright: "--person-2" },
11
+ { name: "--vk-person-3", kind: "colour", outright: "--person-3" },
12
+ { name: "--vk-person-4", kind: "colour", outright: "--person-4" },
13
+ { name: "--vk-person-5", kind: "colour", outright: "--person-5" },
14
+ { name: "--vk-person-6", kind: "colour", outright: "--person-6" },
15
+ { name: "--vk-person-fg", kind: "colour", outright: "--person-foreground" },
16
+ { name: "--vk-success-bold", kind: "colour", outright: "--background-success-bold" },
17
+ { name: "--vk-border-width", kind: "size", outright: "--border-width" },
18
+ { name: "--vk-dot-size", kind: "size", outright: "--dot-size" },
19
+ { name: "--vk-font-size-2xl", kind: "size", outright: "--text-2xl" },
20
+ { name: "--vk-font-size-2xs", kind: "size", outright: "--text-2xs" },
21
+ { name: "--vk-font-size-3xs", kind: "size", outright: "--text-3xs" },
22
+ { name: "--vk-font-size-sm", kind: "size", outright: "--text-sm" },
23
+ { name: "--vk-font-size-xs", kind: "size", outright: "--text-xs" },
24
+ { name: "--vk-font-weight-semibold", kind: "size", outright: "--font-weight-semibold" },
25
+ { name: "--vk-radius-2xl", kind: "size", outright: "--radius-2xl" },
26
+ { name: "--vk-radius-full", kind: "size", outright: "--radius-full" },
27
+ { name: "--vk-radius-lg", kind: "size", outright: "--radius-lg" },
28
+ { name: "--vk-radius-md", kind: "size", outright: "--radius-md" },
29
+ { name: "--vk-radius-sm", kind: "size", outright: "--radius-sm" },
30
+ { name: "--vk-radius-xl", kind: "size", outright: "--radius-xl" },
31
+ { name: "--vk-radius-xs", kind: "size", outright: "--radius-xs" },
32
+ { name: "--vk-spacing", kind: "size", outright: "--spacing" },
33
+ { name: "--vk-tracking-normal", kind: "size", outright: "--tracking-normal" },
34
+ ];
35
+ export const AVATAR_PRIVATE = ["--avatar-"];
@@ -0,0 +1,163 @@
1
+ /* The Avatar. Every value it draws with is a
2
+ token (control tokens); this file only says which token each kind and size takes. People are circles on
3
+ their own tone (data-tone, 1 to 6); things are squares on a quiet ground; the workspace is the brand; an agent is a thing's
4
+ square holding its own icon. Its options, on the frame around it (looks.ts), are its squares' alone:
5
+
6
+ data-avatar-corners small · medium · large · xlarge a radius token per size; nothing set is Medium
7
+ data-avatar-smoothing round · smooth how a square's corners bend; nothing set is Smooth
8
+
9
+ The rules sit in the components layer, so a utility class on an avatar still wins. */
10
+ @layer components {
11
+
12
+ /* ── A person: a circle of their initials on their tone, 32px ──────────────────────────────────────── */
13
+ .o-avatar {
14
+ flex: none; display: inline-grid; place-items: center; box-sizing: border-box; overflow: hidden;
15
+ width: calc(var(--vk-spacing) * 8); height: calc(var(--vk-spacing) * 8); border-radius: var(--vk-radius-full);
16
+ background-color: var(--vk-person-1); color: var(--vk-person-fg);
17
+ font-size: var(--vk-font-size-xs); line-height: 1; font-weight: var(--vk-font-weight-semibold); letter-spacing: var(--vk-tracking-normal); user-select: none;
18
+ }
19
+ .o-avatar[data-tone="2"] { background-color: var(--vk-person-2); }
20
+ .o-avatar[data-tone="3"] { background-color: var(--vk-person-3); }
21
+ .o-avatar[data-tone="4"] { background-color: var(--vk-person-4); }
22
+ .o-avatar[data-tone="5"] { background-color: var(--vk-person-5); }
23
+ .o-avatar[data-tone="6"] { background-color: var(--vk-person-6); }
24
+ /* A photo or a logo fills the shape and replaces the tone. */
25
+ .o-avatar-image { width: 100%; height: 100%; object-fit: cover; }
26
+ .o-avatar-letters { display: grid; place-items: center; width: 100%; height: 100%; }
27
+ .o-avatar-letters svg { width: 55%; height: 55%; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; }
28
+
29
+ /* ── Sizes: 16 in a typed Select's chip, its initials at the 3xs type size; 20 in chips and text, 24 in dense rows and stacks,
30
+ 40 in headers, 64 on a record's page ── */
31
+ .o-avatar.o-avatar-2xs { width: calc(var(--vk-spacing) * 4); height: calc(var(--vk-spacing) * 4); font-size: var(--vk-font-size-3xs); }
32
+ .o-avatar.o-avatar-xs { width: calc(var(--vk-spacing) * 5); height: calc(var(--vk-spacing) * 5); font-size: var(--vk-font-size-2xs); }
33
+ .o-avatar.o-avatar-sm { width: calc(var(--vk-spacing) * 6); height: calc(var(--vk-spacing) * 6); font-size: var(--vk-font-size-2xs); }
34
+ .o-avatar.o-avatar-lg { width: calc(var(--vk-spacing) * 10); height: calc(var(--vk-spacing) * 10); font-size: var(--vk-font-size-sm); }
35
+ .o-avatar.o-avatar-xl { width: calc(var(--vk-spacing) * 16); height: calc(var(--vk-spacing) * 16); font-size: var(--vk-font-size-2xl); }
36
+
37
+ /* ── A thing: a square, its corners a step that grows with it, on the neutral ground, its edge inside ─ */
38
+ .o-avatar.o-avatar-thing { border-radius: var(--avatar-r); background-color: var(--vk-neutral); color: var(--vk-fg-subtle); box-shadow: inset 0 0 0 var(--vk-border-width) var(--vk-border-subtle); }
39
+ /* The workspace: the one square in the brand. */
40
+ .o-avatar.o-avatar-workspace { background-color: var(--vk-brand); color: var(--vk-fg-on-brand); box-shadow: none; }
41
+ /* An agent: a thing's square holding its own icon. Its mark comes in its own fills, so it is filled, never drawn as a
42
+ line as a record's icon is; a mark with no colour of its own (Codex's, Grok's) takes the text's ink, as the canvas drew it. */
43
+ .o-avatar-agent .o-avatar-letters svg { fill: var(--vk-fg); stroke: none; }
44
+
45
+ /* ── Corners: a radius token per size, in steps; Medium with nothing set: xs at 20, sm at 24 and 32, md at 40, lg at 64,
46
+ between Small and Large, the tokens holding nothing between xs and sm ────────────────────────────── */
47
+ .o-avatar.o-avatar-thing { --avatar-r: var(--vk-radius-sm); }
48
+ .o-avatar.o-avatar-thing:is(.o-avatar-2xs, .o-avatar-xs) { --avatar-r: var(--vk-radius-xs); }
49
+ .o-avatar.o-avatar-thing.o-avatar-lg { --avatar-r: var(--vk-radius-md); }
50
+ .o-avatar.o-avatar-thing.o-avatar-xl { --avatar-r: var(--vk-radius-lg); }
51
+ /* Small: xs at 20 and 24, sm at 32 and 40, md at 64. */
52
+ [data-avatar-corners="small"] .o-avatar.o-avatar-thing { --avatar-r: var(--vk-radius-sm); }
53
+ [data-avatar-corners="small"] .o-avatar.o-avatar-thing:is(.o-avatar-2xs, .o-avatar-xs, .o-avatar-sm) { --avatar-r: var(--vk-radius-xs); }
54
+ [data-avatar-corners="small"] .o-avatar.o-avatar-thing.o-avatar-xl { --avatar-r: var(--vk-radius-md); }
55
+ /* Large, the radii before Medium came: sm at 20 and 24, md at 32, lg at 40, xl at 64. */
56
+ [data-avatar-corners="large"] .o-avatar.o-avatar-thing { --avatar-r: var(--vk-radius-md); }
57
+ [data-avatar-corners="large"] .o-avatar.o-avatar-thing:is(.o-avatar-2xs, .o-avatar-xs, .o-avatar-sm) { --avatar-r: var(--vk-radius-sm); }
58
+ [data-avatar-corners="large"] .o-avatar.o-avatar-thing.o-avatar-lg { --avatar-r: var(--vk-radius-lg); }
59
+ [data-avatar-corners="large"] .o-avatar.o-avatar-thing.o-avatar-xl { --avatar-r: var(--vk-radius-xl); }
60
+ /* Extra large: md at 20 and 24, lg at 32, xl at 40, 2xl at 64. */
61
+ [data-avatar-corners="xlarge"] .o-avatar.o-avatar-thing { --avatar-r: var(--vk-radius-lg); }
62
+ [data-avatar-corners="xlarge"] .o-avatar.o-avatar-thing:is(.o-avatar-2xs, .o-avatar-xs, .o-avatar-sm) { --avatar-r: var(--vk-radius-md); }
63
+ [data-avatar-corners="xlarge"] .o-avatar.o-avatar-thing.o-avatar-lg { --avatar-r: var(--vk-radius-xl); }
64
+ [data-avatar-corners="xlarge"] .o-avatar.o-avatar-thing.o-avatar-xl { --avatar-r: var(--vk-radius-2xl); }
65
+
66
+ /* ── Corner smoothing: Smooth, with nothing set, draws a square's corners with the smooth outline (smooth.css),
67
+ every browser that knows shape() showing it; one that doesn't keeps the quarter circles above, and so does Round. Its
68
+ smoothing eases off where a side is too short for 1.7 radii at each end, as the canvas drew it (o-smooth-ease, from its size and
69
+ its radius, both tokens, so it follows Corner radius). The outline would cut the edge drawn inside the square, so under it the
70
+ edge is a ring of its own (::before), between the outline and the same outline drawn a hairline in, under whatever the square
71
+ holds; the workspace has none. Its smoothing is its own Corner smoothing, never a host's: the outline's amount inherits, and a
72
+ crumb, a tab or a list's card that follows the token sets it on itself, so the square sets it back. ─────── */
73
+ @supports (clip-path: shape(evenodd from 0 0, curve by 1px 1px with 1px 0 / 1px 0, close, move to 0 0, hline to 1px, close)) and (width: calc(tan(atan2(1px, 1px)) * 1px)) {
74
+ .o-avatar.o-avatar-thing { --smooth-amount: initial; }
75
+ .o-avatar.o-avatar-thing:not([data-avatar-smoothing="round"] *) {
76
+ --avatar-rr: min(var(--avatar-r), var(--avatar-size) / 2); --smooth-t: var(--avatar-rr); --smooth-side: var(--avatar-size);
77
+ position: relative; box-shadow: none; clip-path: shape(var(--smooth-outline));
78
+ }
79
+ /* Its edge, a hairline ring along the outline, under the picture or the letters it holds; the workspace has none. */
80
+ .o-avatar.o-avatar-thing:not(.o-avatar-workspace):not([data-avatar-smoothing="round"] *)::before {
81
+ --smooth-t: calc(var(--avatar-rr) - var(--vk-border-width)); --smooth-in: var(--vk-border-width);
82
+ content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none; background-color: var(--vk-border-subtle);
83
+ clip-path: shape(var(--smooth-ring));
84
+ }
85
+ }
86
+
87
+ /* ── A stack: each after the first overlaps by a fifth of its size, cut out of whatever it stands on (a cut, so a card,
88
+ a hovered row or the dark shows through it, never the page's colour) ──────────────────────────────────────────────── */
89
+ .o-avatar-stack { display: inline-flex; align-items: center; isolation: isolate; }
90
+ :is(.o-avatar, .o-avatar-badged) { --avatar-overlap: calc(var(--vk-spacing) * 1.6); }
91
+ :is(.o-avatar.o-avatar-xs, .o-avatar-badged[data-size="20"]) { --avatar-overlap: calc(var(--vk-spacing) * 1); }
92
+ :is(.o-avatar.o-avatar-sm, .o-avatar-badged[data-size="24"]) { --avatar-overlap: calc(var(--vk-spacing) * 1.2); }
93
+ :is(.o-avatar.o-avatar-lg, .o-avatar-badged[data-size="40"]) { --avatar-overlap: calc(var(--vk-spacing) * 2); }
94
+ :is(.o-avatar.o-avatar-xl, .o-avatar-badged[data-size="64"]) { --avatar-overlap: calc(var(--vk-spacing) * 3.2); }
95
+ .o-avatar-stack > :is(.o-avatar, .o-avatar-badged) + :is(.o-avatar, .o-avatar-badged) { margin-left: calc(var(--avatar-overlap) * -1); }
96
+ /* A face with a face after it: the next one's circle and its ring taken out of it. */
97
+ :is(.o-avatar-stack > .o-avatar:has(+ :is(.o-avatar, .o-avatar-badged)), .o-avatar-stack > .o-avatar-badged:has(+ :is(.o-avatar, .o-avatar-badged)) > .o-avatar) {
98
+ --avatar-next-at: calc(var(--avatar-size) - var(--avatar-overlap) - var(--avatar-cut)) calc(var(--avatar-cut) * -1);
99
+ --avatar-next-size: calc(var(--avatar-size) + var(--avatar-cut) * 2) calc(var(--avatar-size) + var(--avatar-cut) * 2);
100
+ }
101
+ /* A face after a badged one: that face's badge stands over it, its circle and ring taken out of it too. */
102
+ :is(.o-avatar-stack > .o-avatar-badged + .o-avatar, .o-avatar-stack > .o-avatar-badged + .o-avatar-badged > .o-avatar) {
103
+ --avatar-prev-at: calc(var(--avatar-overlap) - var(--avatar-dot-inset) - var(--avatar-dot) - var(--avatar-cut)) calc(var(--avatar-size) - var(--avatar-dot-inset) - var(--avatar-dot) - var(--avatar-cut));
104
+ --avatar-prev-size: calc(var(--avatar-dot) + var(--avatar-cut) * 2) calc(var(--avatar-dot) + var(--avatar-cut) * 2);
105
+ }
106
+ /* The whole stack as one button (after Linear): the quiet Button wearing it, its ground under the pointer showing through the cuts. */
107
+ .o-button.o-avatar-stack-button { height: auto; padding: var(--vk-spacing); --button-r: var(--vk-radius-full); --button-side: calc(var(--vk-spacing) * 10 + var(--button-line) * 2); }
108
+ /* Its side, its faces' size and its padding, which its own corner is fitted to where a frame's Corners outweighs its Full. */
109
+ .o-button.o-avatar-stack-button:has(.o-avatar-xs) { --button-side: calc(var(--vk-spacing) * 7 + var(--button-line) * 2); }
110
+ .o-button.o-avatar-stack-button:has(.o-avatar-sm) { --button-side: calc(var(--vk-spacing) * 8 + var(--button-line) * 2); }
111
+ .o-button.o-avatar-stack-button:has(.o-avatar-lg) { --button-side: calc(var(--vk-spacing) * 12 + var(--button-line) * 2); }
112
+ .o-button.o-avatar-stack-button:has(.o-avatar-xl) { --button-side: calc(var(--vk-spacing) * 18 + var(--button-line) * 2); }
113
+ /* Its add (after Asana): the outline Button the avatar's size, its edge dashed at rest, solid under the pointer. */
114
+ .o-avatar-add[data-size="20"] { --avatar-size: calc(var(--vk-spacing) * 5); }
115
+ .o-avatar-add[data-size="24"] { --avatar-size: calc(var(--vk-spacing) * 6); }
116
+ .o-avatar-add[data-size="32"] { --avatar-size: calc(var(--vk-spacing) * 8); }
117
+ .o-avatar-add[data-size="40"] { --avatar-size: calc(var(--vk-spacing) * 10); }
118
+ .o-avatar-add[data-size="64"] { --avatar-size: calc(var(--vk-spacing) * 16); }
119
+ .o-button.o-avatar-add { flex: none; width: var(--avatar-size); height: var(--avatar-size); --button-side: var(--avatar-size); padding: 0; border-style: dashed; }
120
+ @media (hover: hover) { .o-button.o-avatar-add:hover { border-style: solid; } }
121
+ /* A stack and its add stand together on one line. */
122
+ .o-avatar-stack-group { display: inline-flex; align-items: center; gap: var(--vk-spacing); }
123
+ /* The rest, as a count in a neutral circle. */
124
+ .o-avatar.o-avatar-more { background-color: var(--vk-neutral); color: var(--vk-fg-subtle); font-variant-numeric: tabular-nums; }
125
+ /* ── Presence and the badge: a dot on the corner, its size stepping with the avatar's (6,
126
+ 8, 10, 12, 16), cut out of whatever the avatar stands on by a mask, never a ring painted in the page's colour. The mask stands
127
+ only on a badged avatar and a stack's faces: a mask clips what is outside the box and makes a stacking context. ──────── */
128
+ :is(.o-avatar, .o-avatar-badged) { --avatar-size: calc(var(--vk-spacing) * 8); --avatar-dot: calc(var(--vk-spacing) * 2.5); --avatar-cut: calc(var(--vk-spacing) * 0.5); --avatar-dot-inset: 0px; }
129
+ .o-avatar.o-avatar-2xs { --avatar-size: calc(var(--vk-spacing) * 4); }
130
+ :is(.o-avatar.o-avatar-xs, .o-avatar-badged[data-size="20"]) { --avatar-size: calc(var(--vk-spacing) * 5); --avatar-dot: var(--vk-dot-size); --avatar-cut: calc(var(--vk-spacing) * 0.375); }
131
+ :is(.o-avatar.o-avatar-sm, .o-avatar-badged[data-size="24"]) { --avatar-size: calc(var(--vk-spacing) * 6); --avatar-dot: calc(var(--vk-spacing) * 2); }
132
+ :is(.o-avatar.o-avatar-lg, .o-avatar-badged[data-size="40"]) { --avatar-size: calc(var(--vk-spacing) * 10); --avatar-dot: calc(var(--vk-spacing) * 3); }
133
+ :is(.o-avatar.o-avatar-xl, .o-avatar-badged[data-size="64"]) { --avatar-size: calc(var(--vk-spacing) * 16); --avatar-dot: calc(var(--vk-spacing) * 4); --avatar-dot-inset: calc(var(--vk-spacing) * 0.5); }
134
+ :is(.o-avatar.o-avatar-thing, .o-avatar-badged[data-thing]) { --avatar-dot-inset: calc(var(--vk-spacing) * -0.75); }
135
+ .o-avatar-badged { position: relative; display: inline-flex; flex: none; vertical-align: middle; isolation: isolate; }
136
+ /* In a stack the badge stands over the next face, so the stack holds it, not the face. */
137
+ .o-avatar-stack > .o-avatar-badged { isolation: auto; }
138
+ .o-avatar-badge {
139
+ position: absolute; right: var(--avatar-dot-inset); bottom: var(--avatar-dot-inset); z-index: 1; box-sizing: border-box;
140
+ display: grid; place-items: center; width: var(--avatar-dot); height: var(--avatar-dot); border-radius: var(--vk-radius-full);
141
+ background-color: var(--vk-brand); color: var(--vk-fg-on-brand);
142
+ }
143
+ .o-avatar-badge > svg { display: none; width: 70%; height: 70%; fill: none; stroke: currentColor; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
144
+ .o-avatar-badged:is([data-size="32"], [data-size="40"], [data-size="64"]) > .o-avatar-badge > svg { display: block; }
145
+ /* Here, a green dot; away, a hollow ring whose middle shows the ground. */
146
+ .o-avatar-badge[data-presence="here"] { background-color: var(--vk-success-bold); }
147
+ .o-avatar-badge[data-presence="away"] { background-color: transparent; box-shadow: inset 0 0 0 calc(var(--vk-border-width) * 2) var(--vk-fg-subtlest); }
148
+ .o-avatar-badged[data-size="20"] > .o-avatar-badge[data-presence="away"] { box-shadow: inset 0 0 0 calc(var(--vk-border-width) * 1.5) var(--vk-fg-subtlest); }
149
+ /* The cut: circles taken out of the avatar, the ground showing through them. Each is an SVG circle (WebKit draws a gradient's
150
+ edge ragged in a mask), set where it stands and how big: the badge's own, with its ring; in a stack, the next face's and the
151
+ badge of the face before. Unused, a circle is drawn at no size. */
152
+ .o-avatar-badged > .o-avatar {
153
+ --avatar-own-at: calc(var(--avatar-size) - var(--avatar-dot-inset) - var(--avatar-dot) - var(--avatar-cut)) calc(var(--avatar-size) - var(--avatar-dot-inset) - var(--avatar-dot) - var(--avatar-cut));
154
+ --avatar-own-size: calc(var(--avatar-dot) + var(--avatar-cut) * 2) calc(var(--avatar-dot) + var(--avatar-cut) * 2);
155
+ }
156
+ :is(.o-avatar-badged > .o-avatar, .o-avatar-stack > .o-avatar, .o-avatar-stack > .o-avatar-badged > .o-avatar) {
157
+ --avatar-hole: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 2 2'%3E%3Ccircle cx='1' cy='1' r='1'/%3E%3C/svg%3E");
158
+ mask-image: linear-gradient(black 0 0), var(--avatar-hole), var(--avatar-hole), var(--avatar-hole);
159
+ mask-repeat: no-repeat; mask-composite: subtract, add, add;
160
+ mask-position: 0 0, var(--avatar-own-at, 0 0), var(--avatar-next-at, 0 0), var(--avatar-prev-at, 0 0);
161
+ mask-size: 100% 100%, var(--avatar-own-size, 0 0), var(--avatar-next-size, 0 0), var(--avatar-prev-size, 0 0);
162
+ }
163
+ }
@@ -4,6 +4,7 @@ import { MapPopover } from "./popover/map-popover.js";
4
4
  import { MapSheet } from "./sheet/map-sheet.js";
5
5
  import { MapCheckbox } from "./checkbox/map-checkbox.js";
6
6
  import { MapInput } from "./input/map-input.js";
7
+ import { MapMenu } from "./menu/map-menu.js";
7
8
  export declare const CONTROLS: {
8
9
  Button: typeof MapButton;
9
10
  Tooltip: typeof MapTooltip;
@@ -11,4 +12,5 @@ export declare const CONTROLS: {
11
12
  Sheet: typeof MapSheet;
12
13
  Input: typeof MapInput;
13
14
  Checkbox: typeof MapCheckbox;
15
+ Menu: typeof MapMenu;
14
16
  };
@@ -4,6 +4,7 @@ import { MapPopover } from "./popover/map-popover.js";
4
4
  import { MapSheet } from "./sheet/map-sheet.js";
5
5
  import { MapCheckbox } from "./checkbox/map-checkbox.js";
6
6
  import { MapInput } from "./input/map-input.js";
7
+ import { MapMenu } from "./menu/map-menu.js";
7
8
  export const CONTROLS = {
8
9
  Button: MapButton,
9
10
  Tooltip: MapTooltip,
@@ -11,4 +12,5 @@ export const CONTROLS = {
11
12
  Sheet: MapSheet,
12
13
  Input: MapInput,
13
14
  Checkbox: MapCheckbox,
15
+ Menu: MapMenu,
14
16
  };
@@ -41,3 +41,15 @@ export { useHoldDrag, type HoldDragProps, type HoldReads } from "./internal/hold
41
41
  export { dragAt, gapOf, moved, useReorder, type ReorderDrag, type RowEdges } from "./internal/reorder.js";
42
42
  export { rowFor, rowStarting } from "./menu-list/keys.js";
43
43
  export { MenuList, MenuListPanelRows, MenuListRow, MenuListRows, MenuListShown, MenuScroll, menuListCloseOf, menuListRowsOf, sheetFormOf, tilesOf, useMenuListOption, useMenuListRows, type MenuChoice, type MenuEntry, type MenuListEntry, type MenuListPanelRowsProps, type MenuListProps, type MenuListTile, } from "./menu-list/menu-list.js";
44
+ export { COMPUTER_HOST, ComputerHost, PhoneHost, usePhone } from "./internal/phone.js";
45
+ export { drawnAt, focusWhereItStands, focusesInPlace, holdsThePage, keepsToItsList, overflows, scaleOf, scrollInList, scrollTopFor, scrollTopForDrag, staysInView, tapsInPlace, typesInto, } from "./internal/scroll.js";
46
+ export { ContextMenu, Menu, MenuDots, useSheetMenus, type MenuChangeDetails, type MenuProps, } from "./menu/menu.js";
47
+ export { MapMenu, menuEntries } from "./menu/map-menu.js";
48
+ export { Avatar, AvatarStack, initials, toneOf, type AvatarPresence, type AvatarProps, type AvatarSize, type AvatarStackPerson, type AvatarStackProps, } from "./avatar/avatar.js";
49
+ export { Picker, PickerUnder, usePicker, type PickerAction, type PickerBoxSearch, type PickerDoing, type PickerLead, type PickerParts, type PickerProps, type PickerUnderProps, } from "./picker/picker.js";
50
+ export { exactMatch, findItem, fold, itemLabel, openLevels, orderMoved, pickerRows, searchShown, type PickerAs, type PickerItem, type PickerRow, type RowsInput, } from "./picker/rows.js";
51
+ export { pickerRead, pickerWornOf, type PickerWorn } from "./picker/looks.js";
52
+ export { Select, SelectShown, toPickerItems, type SelectAloneProps, type SelectItem, type SelectListProps, type SelectProps, type SelectShownProps, } from "./select/select.js";
53
+ export { listSide, type ListSide } from "./select/side.js";
54
+ export { chipsThatFit } from "./select/fit.js";
55
+ export { filledMatch } from "./select/filled.js";
@@ -35,3 +35,15 @@ export { useHoldDrag } from "./internal/hold.js";
35
35
  export { dragAt, gapOf, moved, useReorder } from "./internal/reorder.js";
36
36
  export { rowFor, rowStarting } from "./menu-list/keys.js";
37
37
  export { MenuList, MenuListPanelRows, MenuListRow, MenuListRows, MenuListShown, MenuScroll, menuListCloseOf, menuListRowsOf, sheetFormOf, tilesOf, useMenuListOption, useMenuListRows, } from "./menu-list/menu-list.js";
38
+ export { COMPUTER_HOST, ComputerHost, PhoneHost, usePhone } from "./internal/phone.js";
39
+ export { drawnAt, focusWhereItStands, focusesInPlace, holdsThePage, keepsToItsList, overflows, scaleOf, scrollInList, scrollTopFor, scrollTopForDrag, staysInView, tapsInPlace, typesInto, } from "./internal/scroll.js";
40
+ export { ContextMenu, Menu, MenuDots, useSheetMenus, } from "./menu/menu.js";
41
+ export { MapMenu, menuEntries } from "./menu/map-menu.js";
42
+ export { Avatar, AvatarStack, initials, toneOf, } from "./avatar/avatar.js";
43
+ export { Picker, PickerUnder, usePicker, } from "./picker/picker.js";
44
+ export { exactMatch, findItem, fold, itemLabel, openLevels, orderMoved, pickerRows, searchShown, } from "./picker/rows.js";
45
+ export { pickerRead, pickerWornOf } from "./picker/looks.js";
46
+ export { Select, SelectShown, toPickerItems, } from "./select/select.js";
47
+ export { listSide } from "./select/side.js";
48
+ export { chipsThatFit } from "./select/fit.js";
49
+ export { filledMatch } from "./select/filled.js";
@@ -0,0 +1,9 @@
1
+ import * as React from "react";
2
+ /** A screen standing on a page as a phone's: what stands in it behaves as on a phone, its popups put inside it. */
3
+ export declare const PhoneHost: React.Context<HTMLElement | null>;
4
+ /** The attribute that marks a computer host: a box standing for a computer's screen inside a phone's window. */
5
+ export declare const COMPUTER_HOST = "data-computer-host";
6
+ /** Inside a computer host: usePhone is false there. A PhoneHost screen inside it is still a phone's. */
7
+ export declare const ComputerHost: React.Context<boolean>;
8
+ /** True in a window narrower than 640px, outside a computer host; false through the server's first draw. */
9
+ export declare const usePhone: () => boolean;
@@ -0,0 +1,15 @@
1
+ import * as React from "react";
2
+ const SMALL = "(max-width: 639px)";
3
+ const listen = (change) => {
4
+ const m = matchMedia(SMALL);
5
+ m.addEventListener("change", change);
6
+ return () => m.removeEventListener("change", change);
7
+ };
8
+ export const PhoneHost = React.createContext(null);
9
+ export const COMPUTER_HOST = "data-computer-host";
10
+ export const ComputerHost = React.createContext(false);
11
+ export const usePhone = () => {
12
+ const computer = React.useContext(ComputerHost);
13
+ const narrow = React.useSyncExternalStore(listen, () => matchMedia(SMALL).matches, () => false);
14
+ return narrow && !computer;
15
+ };
@@ -2,5 +2,6 @@
2
2
  export declare function msOf(el: Element | null | undefined, prop: `--${string}`): number;
3
3
  /** A length in px ("1px" is 1), 0 where nothing declares it. */
4
4
  export declare function pxOf(el: Element | null | undefined, prop: `--${string}`): number;
5
- /** Steps of the spacing name, in px (1.5 steps is 6px at the default 4px). */
5
+ /** Steps of the spacing name, in px (1.5 steps is 6px at the default 4px), read off `el`; with no element (a popup outside any
6
+ * popup host), off the page's root, where the ready stylesheet declares it. */
6
7
  export declare const spacingPx: (steps: number, el: Element | null | undefined) => number;
@@ -8,4 +8,4 @@ export function msOf(el, prop) {
8
8
  export function pxOf(el, prop) {
9
9
  return parseFloat(read(el, prop)) || 0;
10
10
  }
11
- export const spacingPx = (steps, el) => pxOf(el, "--vk-spacing") * steps;
11
+ export const spacingPx = (steps, el) => pxOf(el ?? (typeof document === "undefined" ? undefined : document.documentElement), "--vk-spacing") * steps;