@blueshed/joined 0.1.20 → 0.2.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 (71) hide show
  1. package/.claude/skills/joined/SKILL.md +1 -1
  2. package/.claude/skills/joined/reference.md +96 -17
  3. package/docs/design.md +31 -8
  4. package/examples/cafe/kitchen.ts +2 -2
  5. package/examples/desk/card.ts +43 -0
  6. package/examples/desk/desk.css +17 -0
  7. package/examples/desk/desk.json +41 -0
  8. package/examples/desk/generated/elements.ts +69 -0
  9. package/examples/desk/generated/queries.ts +33 -0
  10. package/examples/desk/generated/rules.ts +94 -0
  11. package/examples/desk/index.html +34 -0
  12. package/examples/desk/lanes.css +126 -0
  13. package/examples/desk/lanes.ts +133 -0
  14. package/examples/desk/migrations/001-desk.ts +8 -0
  15. package/examples/desk/page.ts +29 -0
  16. package/examples/desk/pulse.ts +20 -0
  17. package/examples/desk/routes.ts +9 -0
  18. package/examples/desk/steps.ts +32 -0
  19. package/examples/desk/stories.jsonl +18 -0
  20. package/examples/desk/tally.css +62 -0
  21. package/examples/desk/tally.ts +76 -0
  22. package/examples/desk/thumbs.ts +45 -0
  23. package/examples/desk/trust.ts +24 -0
  24. package/examples/desk/words.ts +17 -0
  25. package/examples/trip/bar.ts +1 -1
  26. package/examples/trip/calendar-map.css +2 -0
  27. package/examples/trip/drags.ts +3 -3
  28. package/examples/trip/drawer.ts +5 -5
  29. package/examples/trip/event-form.ts +8 -7
  30. package/examples/trip/holding.ts +1 -1
  31. package/examples/trip/ics.ts +22 -112
  32. package/examples/trip/line-stops.ts +1 -1
  33. package/examples/trip/line-words.ts +1 -1
  34. package/examples/trip/line.ts +1 -1
  35. package/examples/trip/map.ts +1 -1
  36. package/examples/trip/month.ts +1 -1
  37. package/examples/trip/other-weeks.ts +1 -1
  38. package/examples/trip/page.ts +2 -2
  39. package/examples/trip/peek.ts +1 -1
  40. package/examples/trip/routes.ts +3 -3
  41. package/examples/trip/shell.ts +3 -3
  42. package/examples/trip/stays.ts +1 -1
  43. package/examples/trip/week.ts +1 -1
  44. package/examples/trip/writes.ts +1 -1
  45. package/examples/trips/card.ts +1 -1
  46. package/examples/trips/map.ts +1 -1
  47. package/examples/weeks/derive.ts +1 -1
  48. package/package.json +7 -1
  49. package/src/attachment.ts +7 -2
  50. package/src/demo.css +29 -26
  51. package/src/demo.ts +2 -2
  52. package/src/draft.ts +23 -8
  53. package/src/files.ts +24 -8
  54. package/{examples/trip/mercator.ts → src/geo.ts} +13 -3
  55. package/src/icon-names.ts +4 -0
  56. package/src/ics.ts +130 -0
  57. package/src/members/panel.css +208 -201
  58. package/src/members/panel.ts +17 -8
  59. package/src/outbox.ts +70 -0
  60. package/src/page.css +76 -70
  61. package/src/page.ts +79 -14
  62. package/src/parts.css +575 -428
  63. package/src/parts.ts +18 -5
  64. package/{examples/trip → src}/place-search.ts +5 -5
  65. package/{examples/trip → src}/places.ts +9 -7
  66. package/src/rank.ts +20 -0
  67. package/src/scrim.ts +81 -0
  68. package/src/server.ts +28 -1
  69. package/{examples/trip → src}/time.ts +37 -5
  70. package/src/tokens.css +5 -0
  71. package/src/tokens.json +35 -0
package/src/parts.ts CHANGED
@@ -1,16 +1,29 @@
1
- // joined's parts (src/parts.css), one sheet: the page adopts it as this is first imported, and a
2
- // display adopts it in its shadow, before its own. A display or the group imports this; a page holding the group
3
- // needn't, unless it wants a part's behaviour (the page's line said, a modal that asks first, a button showing it's
4
- // open), and a page without one (anonymous: hello) imports it for the look.
1
+ // joined's parts (src/parts.css), one sheet, a layer (joined) beneath anything of an app's own, so any rule of an
2
+ // app's wins, whatever its specificity: the page adopts it as this is first imported, and a display adopts it in its
3
+ // shadow by adopt(), before its own. A display or the group imports this; a page holding the group needn't, unless
4
+ // it wants a part's behaviour (the page's line said, a modal that asks first, a button showing it's open), and a page
5
+ // without one (anonymous: hello) imports it for the look. The page's surfaces, and each adopted shadow's, dim the
6
+ // page by its one scrim (./scrim.ts).
5
7
 
6
8
  import STYLE from "./parts.css" with { type: "text" };
7
9
  import { hueOf } from "./hues.ts";
8
10
  import { keep } from "./keep.ts";
9
11
  import type { Answer } from "./page.ts";
12
+ import { watch } from "./scrim.ts";
10
13
 
11
14
  export const PARTS = new CSSStyleSheet();
12
15
  PARTS.replaceSync(STYLE);
13
- document.adoptedStyleSheets = [...document.adoptedStyleSheets, PARTS];
16
+ /** Where the scrim watches, a modal's and a sheet's own ::backdrop let go: the scrim dims for them. */
17
+ const WATCHED = new CSSStyleSheet();
18
+ WATCHED.replaceSync(`@layer joined { :is(dialog, .sheet)::backdrop { background: transparent; } }`);
19
+ document.adoptedStyleSheets = [...document.adoptedStyleSheets, PARTS, WATCHED];
20
+
21
+ /** A display's shadow given joined's parts, then its own sheets (which win, joined's being a layer beneath), its
22
+ * modals, sheets and drawers dimming the page by its one scrim as the page's do. */
23
+ export function adopt(root: ShadowRoot, ...sheets: CSSStyleSheet[]) {
24
+ root.adoptedStyleSheets = [PARTS, WATCHED, ...sheets];
25
+ watch(root);
26
+ }
14
27
 
15
28
  /** A person's face (Identity): their initial in their hue, their name its title; or, where there's no room (an
16
29
  * event's block), their dot. */
@@ -1,8 +1,8 @@
1
- // The place search in an event's form: what's typed as its place, asked of Photon (./places.ts) near the map's
2
- // middle a moment after the typing stops, and the places found offered beneath it to pick from. An answer to a
3
- // search typed past since is let go, so what's offered is always what's typed.
1
+ // A place search in a form (joined/place-search): what's typed as its place, asked of Photon (./places.ts) near a
2
+ // point (the map's middle, a board's pins) a moment after the typing stops, and the places found offered beneath it
3
+ // to pick from. An answer to a search typed past since is let go, so what's offered is always what's typed.
4
4
 
5
- import { keep } from "joined/keep";
5
+ import { keep } from "./keep.ts";
6
6
  import { find, type Place } from "./places.ts";
7
7
 
8
8
  export class PlaceSearch {
@@ -16,7 +16,7 @@ export class PlaceSearch {
16
16
  ) {}
17
17
 
18
18
  /** Places called `q`, near the point `near` gives, offered to pick from; under three letters, none. */
19
- search(q: string, near: () => { lat: number; lng: number }) {
19
+ search(q: string, near: () => { lat: number; lng: number } | undefined) {
20
20
  const asked = ++this.#asked;
21
21
  if (q.length < 3) return this.found([]);
22
22
  const at = near();
@@ -1,6 +1,8 @@
1
- // Places by name, and the name of a point: Photon, komoot's search over OpenStreetMap, open to all and
2
- // asked from the page, as the map's tiles are. Nothing found, or Photon away, is no place: the form
3
- // keeps what it had.
1
+ // Places by name, and the name of a point (joined/places): Photon, komoot's search over OpenStreetMap, open to all
2
+ // and asked from the page, as the map's tiles are. Only what's typed, or the point, is sent. Nothing found, or
3
+ // Photon away, is no place: the form keeps what it had.
4
+
5
+ import { geoOf } from "./geo.ts";
4
6
 
5
7
  const PHOTON = "https://photon.komoot.io";
6
8
  export type Place = { name: string; coordinates: string };
@@ -13,7 +15,7 @@ type Feature = {
13
15
  const placeOf = ({ geometry, properties: p }: Feature): Place => {
14
16
  const [lng, lat] = geometry.coordinates;
15
17
  const name = [...new Set([p.name ?? p.street, p.district, p.city ?? p.county ?? p.state])].filter(Boolean).join(", ");
16
- return { name, coordinates: `geo:${lat.toFixed(4)},${lng.toFixed(4)}` };
18
+ return { name, coordinates: geoOf({ lat, lng }) };
17
19
  };
18
20
  const ask = async (path: string): Promise<Place[]> => {
19
21
  try {
@@ -26,9 +28,9 @@ const ask = async (path: string): Promise<Place[]> => {
26
28
  }
27
29
  };
28
30
 
29
- /** Places called this, those near a point first. */
30
- export const find = (q: string, near: { lat: number; lng: number }) =>
31
- ask(`/api/?q=${encodeURIComponent(q)}&limit=5&lang=en&lat=${near.lat}&lon=${near.lng}`);
31
+ /** Places called this, those near a point first (none: anywhere). */
32
+ export const find = (q: string, near?: { lat: number; lng: number }) =>
33
+ ask(`/api/?q=${encodeURIComponent(q)}&limit=5&lang=en${near ? `&lat=${near.lat}&lon=${near.lng}` : ""}`);
32
34
  /** The name of the place at a point, or none. */
33
35
  export const nameOf = async ({ lat, lng }: { lat: number; lng: number }) =>
34
36
  (await ask(`/reverse?lat=${lat}&lon=${lng}&lang=en`))[0]?.name ?? null;
package/src/rank.ts ADDED
@@ -0,0 +1,20 @@
1
+ // Where an item let go lands among others (joined/rank), as a rank between theirs: halfway between the one above and
2
+ // the one below, one less than the first, one more than the last. One write moves it, and none of the others: a list
3
+ // held in a number's order (`{"order":{"tasks":"rank"}}`) puts it in its place on every page. The desk's lanes,
4
+ // cardlet's columns and idea-cards' stacks are this.
5
+
6
+ /** The rank between `before` and `after` (either none, at an end); none at all: 1. */
7
+ export const between = (before?: number, after?: number) =>
8
+ before === undefined ? (after ?? 2) - 1 : after === undefined ? before + 1 : (before + after) / 2;
9
+
10
+ /** Where among `rows` (the others in the list, in their order, each with its rank in `ranks`) a thing let go at `y`
11
+ * lands: its place among them, and its rank there. */
12
+ export function landing(
13
+ rows: Pick<HTMLElement, "getBoundingClientRect" | "offsetHeight">[],
14
+ ranks: number[],
15
+ y: number,
16
+ ) {
17
+ const i = rows.findIndex((r) => y < r.getBoundingClientRect().top + r.offsetHeight / 2),
18
+ at = i < 0 ? rows.length : i;
19
+ return { at, rank: between(ranks[at - 1], ranks[at]) };
20
+ }
package/src/scrim.ts ADDED
@@ -0,0 +1,81 @@
1
+ // The scrim: one, on the page (.j-scrim, src/parts.css), behind what's open: a modal, anywhere; on a phone, a drawer
2
+ // or a sheet too, which there are a phone's sheets risen from the foot. It fades in and out with them in every browser,
3
+ // where a ::backdrop doesn't in Safari; a modal's own ::backdrop and a sheet's are let go wherever this watches. While a
4
+ // modal asks over a drawer, the scrim is over the drawer too. A tap on it closes the drawer on top, as its × does
5
+ // (its control named close); so does Escape, wherever you are, but where a modal or a sheet is open (Escape is theirs)
6
+ // or something before it took Escape for its own (preventDefault: a list of places found, closing).
7
+ //
8
+ // It watches the page, and each shadow a display gives joined's parts by adopt() (src/parts.ts): which of its
9
+ // surfaces are open, as they open and close (a drawer's hidden, a modal's open, a sheet's toggle), never searching
10
+ // the page for them again.
11
+
12
+ const phone = matchMedia("(max-width: 40rem)");
13
+ /** The surfaces open, in the order they opened: the last is on top. */
14
+ const open = new Set<HTMLElement>();
15
+ const watched = new WeakSet<Document | ShadowRoot>();
16
+ let scrim: HTMLElement | undefined;
17
+
18
+ /** Whether a surface is open: a drawer shown, a modal shown modal, a sheet's popover open. */
19
+ const isOpen = (el: HTMLElement) =>
20
+ el.isConnected &&
21
+ (el instanceof HTMLDialogElement
22
+ ? el.open && el.matches(":modal")
23
+ : el.classList.contains("drawer")
24
+ ? !el.hidden
25
+ : el.matches(":popover-open"));
26
+
27
+ /** A surface, as it is now: open (on top), or not. */
28
+ function note(el: Element) {
29
+ if (!(el instanceof HTMLElement) || !el.matches("dialog, .drawer, .sheet")) return;
30
+ open.delete(el);
31
+ if (isOpen(el)) open.add(el);
32
+ }
33
+
34
+ const drawers = () => [...open].filter((el) => el.isConnected && el.classList.contains("drawer") && !el.hidden);
35
+ const asking = () => [...open].some((el) => el instanceof HTMLDialogElement && isOpen(el));
36
+ const sheet = () => [...open].some((el) => el.classList.contains("sheet") && isOpen(el));
37
+
38
+ /** The scrim as what's open says: on behind a modal, and on a phone behind a drawer or a sheet. */
39
+ function dim() {
40
+ for (const el of open) if (!isOpen(el)) open.delete(el);
41
+ const on = asking() || (phone.matches && (drawers().length > 0 || sheet()));
42
+ if (!scrim && !on) return;
43
+ scrim ??= made();
44
+ scrim.classList.toggle("j-on", on);
45
+ scrim.classList.toggle("j-asking", asking());
46
+ }
47
+
48
+ /** The drawer on top closed, by its own ×, so it closes as it would. */
49
+ const closeTop = () => drawers().at(-1)?.querySelector<HTMLButtonElement>("[name=close]")?.click();
50
+
51
+ function made() {
52
+ const el = Object.assign(document.createElement("div"), { className: "j-scrim" });
53
+ el.ariaHidden = "true";
54
+ // a tap on it closes the drawer on top; unless it was the tap that took a sheet away (the popover closes itself)
55
+ let wasSheet = false;
56
+ el.addEventListener("pointerdown", () => (wasSheet = sheet()));
57
+ el.addEventListener("click", () => !wasSheet && closeTop());
58
+ document.body.append(el);
59
+ return el;
60
+ }
61
+
62
+ /** Watch a root's surfaces: the page, or a display's shadow. */
63
+ export function watch(root: Document | ShadowRoot) {
64
+ if (watched.has(root)) return;
65
+ watched.add(root);
66
+ for (const el of root.querySelectorAll("dialog, .drawer, .sheet")) note(el);
67
+ new MutationObserver((changes) => {
68
+ for (const c of changes) note(c.target as Element);
69
+ dim();
70
+ }).observe(root, { subtree: true, attributes: true, attributeFilter: ["hidden", "open"] });
71
+ // a popover says it's opened or closed by toggle, which doesn't bubble: heard as it passes, on its way down
72
+ root.addEventListener("toggle", (e) => (note(e.target as Element), dim()), true);
73
+ dim();
74
+ }
75
+
76
+ phone.addEventListener("change", dim);
77
+ document.addEventListener("keydown", (e) => {
78
+ if (e.key !== "Escape" || e.defaultPrevented || asking() || sheet()) return;
79
+ closeTop();
80
+ });
81
+ watch(document);
package/src/server.ts CHANGED
@@ -52,6 +52,8 @@ type Message = {
52
52
  ops?: Op[];
53
53
  why?: string;
54
54
  writes?: Part[];
55
+ /** A change of the document to undo, by its version: the page's own. */
56
+ undo?: number;
55
57
  } & Asked;
56
58
 
57
59
  /** A page's message, read; or why it isn't one joined reads. */
@@ -63,7 +65,7 @@ export function messageOf(text: string): Message | string {
63
65
  return "that isn't JSON";
64
66
  }
65
67
  if (typeof m !== "object" || m === null || Array.isArray(m)) return "a message is a JSON object";
66
- const { id, subscribe, since, unsubscribe, doc, ops, why, writes } = m as Record<string, unknown>;
68
+ const { id, subscribe, since, unsubscribe, doc, ops, why, writes, undo } = m as Record<string, unknown>;
67
69
  const op = (o: any) =>
68
70
  typeof o === "object" && o !== null && ["add", "replace", "remove"].includes(o.op) && typeof o.path === "string";
69
71
  const part = (w: any) =>
@@ -82,6 +84,8 @@ export function messageOf(text: string): Message | string {
82
84
  if ([subscribe, unsubscribe, doc, why].some((s) => s !== undefined && typeof s !== "string"))
83
85
  return "subscribe, unsubscribe, doc and why are strings";
84
86
  if (since !== undefined && !Number.isInteger(since)) return "since is a version";
87
+ if (undo !== undefined && !(Number.isInteger(undo) && typeof doc === "string"))
88
+ return "an undo is a document's version";
85
89
  if (ops !== undefined && !(Array.isArray(ops) && ops.every(op)))
86
90
  return "ops are each an add, a replace or a remove, at a path";
87
91
  return m as Message;
@@ -659,6 +663,29 @@ export async function start({
659
663
  if (ws.data.docs.delete(m.unsubscribe) && !derives.has(m.unsubscribe)) ws.unsubscribe(topicOf(ws, m.unsubscribe));
660
664
  return void forget(ws, m.unsubscribe);
661
665
  }
666
+ // a page undoes a change of a document it holds, its own (who made it, or nobody where there are no members): its
667
+ // inverse, guarded, as the server's undo is; answered done with the version the undo made, which the page may undo
668
+ // in turn (a redo)
669
+ if (m.undo !== undefined) {
670
+ const doc = m.doc!,
671
+ by = who?.member ?? null;
672
+ const made = store.change(docParts(doc).base, m.undo);
673
+ const no = !ws.data.docs.has(doc)
674
+ ? `this page isn't subscribed to ${docParts(doc).base}`
675
+ : made && made.by !== by
676
+ ? "a change is undone by whoever made it"
677
+ : null;
678
+ try {
679
+ if (no) throw new Refused(no);
680
+ const { version } = undo(doc, m.undo, by);
681
+ log?.(`undo ${docParts(doc).base} ${m.undo} by ${byOf(who)}: done, version ${version}`);
682
+ return say(ws, { done: m.id, version });
683
+ } catch (e) {
684
+ if (!(e instanceof Refused)) throw e;
685
+ log?.(`undo ${docParts(doc).base} ${m.undo} by ${byOf(who)}: refused, ${e.message}`);
686
+ return say(ws, { refused: m.id, why: e.message });
687
+ }
688
+ }
662
689
  if (!m.ops && !m.writes) {
663
690
  return say(ws, await group.asked(ws, m as Message & { id: number }));
664
691
  }
@@ -1,5 +1,6 @@
1
- // The trip's time: a start is a wall clock (floating time, kept as if UTC), a length an ISO 8601 duration
2
- // (PT1H30M), a day a count from 1 January 1970.
1
+ // Time on the page (joined/time): a start is a wall clock (floating time, kept as if UTC), a length an ISO 8601
2
+ // duration (PT1H30M), a day a count from 1 January 1970. Pure: the trip's calendar is drawn by it, and an app's
3
+ // timeline, a stay's nights or a day's heading take it as they are, rather than a copy each.
3
4
 
4
5
  export const DAY = 86_400_000,
5
6
  MIN = 60_000,
@@ -25,11 +26,41 @@ export const stayed = (s: { from: string; until: string }) => {
25
26
  /** An event's hours, from its start for its length: 09:00–10:30. */
26
27
  export const hours = (start: string, duration: string) =>
27
28
  `${hhmm(wall(start))}–${hhmm(wall(start) + seconds(duration) * 1000)}`;
29
+ /** A length's seconds: days, hours, minutes and seconds (P1DT2H, PT90M, PT30S); one that can't be read, none. */
28
30
  export const seconds = (d: string) => {
29
- const [days = 0, h = 0, m = 0] = (/^P(?:(\d+)D)?(?:T(?:(\d+)H)?(?:(\d+)M)?)?$/.exec(d) ?? [])
31
+ const [days = 0, h = 0, m = 0, s = 0] = (/^P(?:(\d+)D)?(?:T(?:(\d+)H)?(?:(\d+)M)?(?:(\d+)S)?)?$/.exec(d) ?? [])
30
32
  .slice(1)
31
33
  .map((n) => Number(n ?? 0));
32
- return ((days * 24 + h) * 60 + m) * 60;
34
+ return ((days * 24 + h) * 60 + m) * 60 + s;
35
+ };
36
+ /** The wall clock a start's length ends at. */
37
+ export const ends = (start: string, duration: string) => local(wall(start) + seconds(duration) * 1000);
38
+ /** A length as people say it: PT2H30M is 2h 30m, P1DT3H 1d 3h; none, or one that can't be read, nothing. */
39
+ export const lasts = (d: string | undefined) => {
40
+ const n = Math.round(seconds(d ?? "") / 60);
41
+ return [
42
+ Math.floor(n / 1440) && `${Math.floor(n / 1440)}d`,
43
+ Math.floor(n / 60) % 24 && `${Math.floor(n / 60) % 24}h`,
44
+ n % 60 && `${n % 60}m`,
45
+ ]
46
+ .filter(Boolean)
47
+ .join(" ");
48
+ };
49
+ /** What people say a length is, as a duration: 2h 30m, 90m, 1.5h, 1d 3h, 2 (hours), or a duration as it is (pt2h is
50
+ * PT2H); what can't be read, or no length at all, none. */
51
+ export const lengthOf = (words: string) => {
52
+ const w = words.trim().toLowerCase();
53
+ if (/^p/.test(w)) return seconds(w.toUpperCase()) ? w.toUpperCase() : null;
54
+ const hours = /^(\d+(?:\.\d+)?)\s*h?$/.exec(w),
55
+ parts = /^(?:(\d+)\s*d)?\s*(?:(\d+)\s*h)?\s*(?:(\d+)\s*m)?$/.exec(w);
56
+ const mins = hours
57
+ ? Math.round(Number(hours[1]) * 60)
58
+ : parts?.slice(1).some(Boolean)
59
+ ? (Number(parts[1] ?? 0) * 24 + Number(parts[2] ?? 0)) * 60 + Number(parts[3] ?? 0)
60
+ : null;
61
+ if (!mins) return null;
62
+ const d = Math.floor(mins / 1440);
63
+ return `P${d ? `${d}D` : ""}${mins % 1440 ? iso(mins % 1440).slice(1) : ""}`;
33
64
  };
34
65
  /** The first of a day's month, and the Monday a month's grid starts on (its six weeks hold the whole month). */
35
66
  export const firstOf = (day: number) => {
@@ -42,5 +73,6 @@ export const on = (e: { start: string; duration: string }, day: number) => {
42
73
  const from = wall(e.start);
43
74
  return Math.floor(from / DAY) <= day && day * DAY < from + Math.max(1, seconds(e.duration)) * 1000;
44
75
  };
76
+ /** Minutes as a length: PT1H30M; none at all, PT0M (a moment, which a calendar reads). */
45
77
  export const iso = (mins: number) =>
46
- `PT${Math.floor(mins / 60) ? `${Math.floor(mins / 60)}H` : ""}${mins % 60 ? `${mins % 60}M` : ""}`;
78
+ `PT${Math.floor(mins / 60) ? `${Math.floor(mins / 60)}H` : ""}${mins % 60 || !mins ? `${mins % 60}M` : ""}`;
package/src/tokens.css CHANGED
@@ -60,6 +60,11 @@
60
60
  --space-48: 48px;
61
61
  --space-64: 64px;
62
62
  --gutter: clamp(1rem, 4vw, 1.5rem);
63
+ --rise: 420ms cubic-bezier(0.32, 0.72, 0, 1);
64
+ --fall: 280ms cubic-bezier(0.4, 0, 1, 1);
65
+ --ask: 220ms cubic-bezier(0.32, 0.72, 0, 1);
66
+ --ask-out: 160ms ease-out;
67
+ --drop: 160ms ease-out;
63
68
  }
64
69
  @media (prefers-color-scheme: dark) {
65
70
  :root {
package/src/tokens.json CHANGED
@@ -375,6 +375,11 @@
375
375
  "value": "4px",
376
376
  "usage": "Everything that has a corner: a button, a field, a block, the calendar, the map, a drawer, a modal, a sheet, the toast."
377
377
  },
378
+ {
379
+ "name": "radius-sheet",
380
+ "value": "14px",
381
+ "usage": "A drawer's and a sheet's top corners on a phone, where it rises from the foot: rounder, as an iPhone's sheet."
382
+ },
378
383
  {
379
384
  "name": "radius-inner",
380
385
  "value": "3px",
@@ -453,5 +458,35 @@
453
458
  "dark": "40%"
454
459
  }
455
460
  ]
461
+ },
462
+ "motion": {
463
+ "note": "How a surface comes and goes, as an iPhone's do: a drawer or a sheet rises, a modal settles, a menu drops; the scrim fades with them. Under prefers-reduced-motion, nothing moves.",
464
+ "tokens": [
465
+ {
466
+ "name": "rise",
467
+ "value": "420ms cubic-bezier(0.32, 0.72, 0, 1)",
468
+ "usage": "A drawer or a sheet coming into place (from the foot on a phone, from the right where it docks), and the scrim fading in behind it: quick, then a long soft settle."
469
+ },
470
+ {
471
+ "name": "fall",
472
+ "value": "280ms cubic-bezier(0.4, 0, 1, 1)",
473
+ "usage": "A drawer or a sheet going back the way it came, and the scrim fading out: quicker than it came, gathering speed."
474
+ },
475
+ {
476
+ "name": "ask",
477
+ "value": "220ms cubic-bezier(0.32, 0.72, 0, 1)",
478
+ "usage": "A modal fading in and settling from a little larger, as an iPhone's alert."
479
+ },
480
+ {
481
+ "name": "ask-out",
482
+ "value": "160ms ease-out",
483
+ "usage": "A modal fading as it shrinks a little, gone."
484
+ },
485
+ {
486
+ "name": "drop",
487
+ "value": "160ms ease-out",
488
+ "usage": "A menu dropping a few pixels from its button as it fades in."
489
+ }
490
+ ]
456
491
  }
457
492
  }