@datalayer/primer-addons 1.0.38 → 1.0.40

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 (64) hide show
  1. package/README.md +52 -20
  2. package/lib/components/appearance/AppearanceControls.d.ts +6 -1
  3. package/lib/components/appearance/AppearanceControls.js +7 -3
  4. package/lib/components/appearance/AppearanceControlsWithStore.d.ts +4 -0
  5. package/lib/components/appearance/AppearanceControlsWithStore.js +4 -4
  6. package/lib/components/appearance/CollaboratorPalette.js +7 -20
  7. package/lib/components/box/Box.d.ts +103 -16
  8. package/lib/components/box/Box.js +157 -2
  9. package/lib/components/box/boxCss.d.ts +805 -0
  10. package/lib/components/box/boxCss.js +508 -0
  11. package/lib/components/box/boxTokens.d.ts +130 -0
  12. package/lib/components/box/boxTokens.js +125 -0
  13. package/lib/components/calendar-picker/CalendarPicker.js +2 -1
  14. package/lib/components/card/Card.d.ts +119 -5
  15. package/lib/components/card/Card.js +64 -41
  16. package/lib/components/card/Card.stories.d.ts +6 -0
  17. package/lib/components/card/Card.stories.js +26 -0
  18. package/lib/components/color/ColorSwatch.js +2 -1
  19. package/lib/components/color-picker/ColorPicker.js +8 -4
  20. package/lib/components/date-picker/DatePicker.d.ts +12 -3
  21. package/lib/components/date-picker/DatePicker.js +24 -8
  22. package/lib/components/entity-avatar/EntityAvatar.d.ts +73 -0
  23. package/lib/components/entity-avatar/EntityAvatar.js +63 -0
  24. package/lib/components/entity-avatar/index.d.ts +1 -0
  25. package/lib/components/entity-avatar/index.js +5 -0
  26. package/lib/components/hover-card/HoverCard.d.ts +63 -0
  27. package/lib/components/hover-card/HoverCard.js +55 -0
  28. package/lib/components/hover-card/HoverCardAnchor.d.ts +33 -0
  29. package/lib/components/hover-card/HoverCardAnchor.js +26 -0
  30. package/lib/components/hover-card/HoverCardDetails.d.ts +36 -0
  31. package/lib/components/hover-card/HoverCardDetails.js +65 -0
  32. package/lib/components/hover-card/HoverCardLayer.d.ts +34 -0
  33. package/lib/components/hover-card/HoverCardLayer.js +57 -0
  34. package/lib/components/hover-card/index.d.ts +12 -0
  35. package/lib/components/hover-card/index.js +16 -0
  36. package/lib/components/hover-card/useHoverCard.d.ts +57 -0
  37. package/lib/components/hover-card/useHoverCard.js +200 -0
  38. package/lib/components/hover-card/usePrefersReducedMotion.d.ts +10 -0
  39. package/lib/components/hover-card/usePrefersReducedMotion.js +28 -0
  40. package/lib/components/index.d.ts +3 -0
  41. package/lib/components/index.js +3 -0
  42. package/lib/components/sheet/Sheet.d.ts +15 -0
  43. package/lib/components/sheet/Sheet.js +21 -0
  44. package/lib/reactor/page-layout/PageLayout.js +4 -6
  45. package/lib/story-helpers.d.ts +2 -2
  46. package/lib/theme/DatalayerThemeProvider.d.ts +21 -0
  47. package/lib/theme/DatalayerThemeProvider.js +8 -2
  48. package/lib/theme/colors/index.d.ts +2 -1
  49. package/lib/theme/colors/index.js +2 -1
  50. package/lib/theme/colors/loopColors.d.ts +2 -48
  51. package/lib/theme/colors/loopColors.js +2 -98
  52. package/lib/theme/colors/themeAccents.d.ts +81 -0
  53. package/lib/theme/colors/themeAccents.js +139 -0
  54. package/lib/theme/css/createThemeCSSVars.d.ts +18 -1
  55. package/lib/theme/css/createThemeCSSVars.js +20 -1
  56. package/lib/theme/css/primerBaseVars.d.ts +1 -0
  57. package/lib/theme/css/primerBaseVars.js +72 -0
  58. package/lib/theme/css/primerComponentsCss.d.ts +47 -0
  59. package/lib/theme/css/primerComponentsCss.js +72 -0
  60. package/lib/theme/index.d.ts +2 -0
  61. package/lib/theme/index.js +2 -0
  62. package/lib/theme/themes/loopThemeStyles.d.ts +4 -37
  63. package/lib/theme/themes/loopThemeStyles.js +39 -56
  64. package/package.json +1 -1
@@ -0,0 +1,200 @@
1
+ /*
2
+ * Copyright (c) 2021-2026 Datalayer, Inc.
3
+ * Distributed under the terms of the Modified BSD License.
4
+ */
5
+ /**
6
+ * Hovering a card to see more of it, as a state machine.
7
+ *
8
+ * The gesture is the one a shelf of films uses: rest the pointer on
9
+ * something and it grows into a larger card; move off and the card plays its
10
+ * entrance backwards. Simple to describe and full of edges, all of which are
11
+ * about *time* rather than about what is drawn — which is why they live here,
12
+ * in a hook that draws nothing, instead of being written again beside every
13
+ * grid that wants the gesture.
14
+ *
15
+ * The edges, and what each one is for:
16
+ *
17
+ * - **Opening waits.** Dragging the pointer across a row would otherwise
18
+ * open a card over every item on the way, and the reader is chased by
19
+ * something they never asked for. The wait is the difference between
20
+ * passing over an item and stopping on it.
21
+ * - **Closing waits too, then plays.** First a grace, because the pointer has
22
+ * to cross the gap into the card and a card that vanished in that gap could
23
+ * never be reached. Then the exit, during which the card is still mounted
24
+ * and knows it is leaving, so it can shrink rather than blink out.
25
+ * - **Leaving is not interruptible.** A card on its way out keeps the stage
26
+ * until it is gone: two movements at once — one shrinking, one growing —
27
+ * read as a glitch rather than as a change of subject. An item reached
28
+ * mid-exit is queued, and the exit hands over to it.
29
+ * - **Moving between items plays the exit.** Sliding the open card across to
30
+ * the new one instead skips the gesture entirely: it teleports, at full
31
+ * size, and the two cards never read as two. The grace is dropped there,
32
+ * though — a pointer that has landed on another item is plainly not
33
+ * heading for the card.
34
+ * - **Escape closes it.** A card opened by resting on something can otherwise
35
+ * only be closed by moving off, and a reader who wants back what it covers
36
+ * reaches for the key every overlay answers. It also calls off a card that
37
+ * has not appeared yet: "no" is the same answer either side of the wait.
38
+ *
39
+ * The hook knows nothing about where the card goes. Callers hand it whatever
40
+ * they need to place one — a coordinate inside a scrolling row, a rectangle
41
+ * in the viewport — and get it back in `active`.
42
+ *
43
+ * @module components/hover-card/useHoverCard
44
+ */
45
+ import { useEffect, useRef, useState } from 'react';
46
+ /**
47
+ * How long the pointer must rest on something before its card opens.
48
+ *
49
+ * This is the wait that separates *reading a page* from *choosing something
50
+ * on it*: a card that opens while the eye is still travelling is an
51
+ * interruption, since the reader did not ask for it and has to wait for it
52
+ * to leave again. Set by feel, from the top of the range down — long enough
53
+ * that a pointer crossing the page is not chased by anything, short enough
54
+ * that stopping on something does not feel like waiting for it.
55
+ */
56
+ export const HOVER_CARD_OPEN_DELAY_MS = 320;
57
+ /** How long a card waits, after the pointer leaves, before it starts out. */
58
+ export const HOVER_CARD_CLOSE_DELAY_MS = 320;
59
+ /**
60
+ * How long a card takes to arrive, and to leave.
61
+ *
62
+ * The same number both ways: a card that leaves faster than it came reads as
63
+ * being dismissed rather than closed. Whatever draws the card has to animate
64
+ * for exactly this long, because the card is kept mounted for exactly this
65
+ * long after it is told it is leaving.
66
+ */
67
+ export const HOVER_CARD_MOTION_MS = 320;
68
+ export function useHoverCard({ enabled = true, openDelayMs = HOVER_CARD_OPEN_DELAY_MS, closeDelayMs = HOVER_CARD_CLOSE_DELAY_MS, motionMs = HOVER_CARD_MOTION_MS } = {}) {
69
+ const [opened, setOpened] = useState(null);
70
+ const [closing, setClosing] = useState(false);
71
+ const openTimer = useRef(null);
72
+ const closeTimer = useRef(null);
73
+ const exitTimer = useRef(null);
74
+ /**
75
+ * An item the pointer reached while a card was still leaving.
76
+ *
77
+ * A ref rather than state: nothing renders from it, and it is written and
78
+ * read inside timers that must see the latest value rather than the one
79
+ * captured when they were set.
80
+ */
81
+ const queued = useRef(null);
82
+ const clear = (timer) => {
83
+ if (timer.current !== null) {
84
+ window.clearTimeout(timer.current);
85
+ timer.current = null;
86
+ }
87
+ };
88
+ const cancelClose = () => {
89
+ queued.current = null;
90
+ clear(closeTimer);
91
+ clear(exitTimer);
92
+ setClosing(false);
93
+ };
94
+ /**
95
+ * The exit: the entrance played backwards.
96
+ *
97
+ * The card stays mounted through it, marked `closing` so it knows to
98
+ * shrink rather than to grow, and only then is it taken off the screen —
99
+ * or handed over to whichever item the pointer found in the meantime.
100
+ */
101
+ const beginExit = () => {
102
+ clear(closeTimer);
103
+ clear(exitTimer);
104
+ setClosing(true);
105
+ exitTimer.current = window.setTimeout(() => {
106
+ const next = queued.current;
107
+ queued.current = null;
108
+ setClosing(false);
109
+ // Straight into the next card if the pointer found one while this was
110
+ // leaving: the reader has already waited out the exit, and making them
111
+ // wait the hover intent again on top of it would read as being ignored.
112
+ setOpened(next ?? null);
113
+ }, motionMs);
114
+ };
115
+ const scheduleClose = () => {
116
+ /*
117
+ * The wait to open is called off, first of all.
118
+ *
119
+ * This is what makes the hover intent mean anything. Without it, a
120
+ * pointer that crossed an item and left again still had a timer running:
121
+ * it fired after the pointer had gone, opened a card over nothing, and
122
+ * the close that had been scheduled behind it took the card away again.
123
+ * Passing over a row of cards flashed one open at every item — the exact
124
+ * behaviour the wait exists to prevent, arriving a fifth of a second
125
+ * late.
126
+ */
127
+ clear(openTimer);
128
+ /*
129
+ * A card already on its way out is left to finish.
130
+ *
131
+ * Without this, the pointer leaving whatever it moved to next would
132
+ * clear the exit timer and start the whole close again — the card would
133
+ * shrink, stop, and shrink once more. Leaving is not interruptible; only
134
+ * coming back cancels it, and that goes through `cancelClose`.
135
+ */
136
+ queued.current = null;
137
+ if (closing) {
138
+ return;
139
+ }
140
+ clear(closeTimer);
141
+ clear(exitTimer);
142
+ closeTimer.current = window.setTimeout(beginExit, closeDelayMs);
143
+ };
144
+ const open = (key, at) => {
145
+ if (!enabled) {
146
+ return;
147
+ }
148
+ const next = { key, at };
149
+ if (closing) {
150
+ queued.current = next;
151
+ return;
152
+ }
153
+ if (opened !== null) {
154
+ if (opened.key === key) {
155
+ // Back on the thing it is already open for: nothing to do but stay.
156
+ cancelClose();
157
+ return;
158
+ }
159
+ queued.current = next;
160
+ beginExit();
161
+ return;
162
+ }
163
+ cancelClose();
164
+ clear(openTimer);
165
+ openTimer.current = window.setTimeout(() => setOpened(next), openDelayMs);
166
+ };
167
+ useEffect(() => () => {
168
+ clear(openTimer);
169
+ clear(closeTimer);
170
+ clear(exitTimer);
171
+ }, []);
172
+ useEffect(() => {
173
+ if (!enabled) {
174
+ return undefined;
175
+ }
176
+ const onKey = (event) => {
177
+ if (event.key !== 'Escape') {
178
+ return;
179
+ }
180
+ clear(openTimer);
181
+ if (opened !== null && !closing) {
182
+ beginExit();
183
+ }
184
+ };
185
+ document.addEventListener('keydown', onKey);
186
+ return () => document.removeEventListener('keydown', onKey);
187
+ // `beginExit` is rebuilt every render; what decides whether it should run
188
+ // is the state below, and the listener is re-attached when that changes.
189
+ // eslint-disable-next-line react-hooks/exhaustive-deps
190
+ }, [enabled, opened, closing]);
191
+ return {
192
+ active: opened?.at ?? null,
193
+ activeKey: opened?.key ?? null,
194
+ closing,
195
+ open,
196
+ scheduleClose,
197
+ cancelClose
198
+ };
199
+ }
200
+ export default useHoverCard;
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Whether the reader has asked for less movement.
3
+ *
4
+ * A hover card grows, and growing is the part somebody with vestibular
5
+ * trouble asked not to see. Everything else about it — that it appears,
6
+ * what it says — is unchanged; only the animation is dropped, and an exit
7
+ * that waited for an animation no longer waits.
8
+ */
9
+ export declare function usePrefersReducedMotion(): boolean;
10
+ export default usePrefersReducedMotion;
@@ -0,0 +1,28 @@
1
+ /*
2
+ * Copyright (c) 2021-2026 Datalayer, Inc.
3
+ * Distributed under the terms of the Modified BSD License.
4
+ */
5
+ import { useEffect, useState } from 'react';
6
+ /**
7
+ * Whether the reader has asked for less movement.
8
+ *
9
+ * A hover card grows, and growing is the part somebody with vestibular
10
+ * trouble asked not to see. Everything else about it — that it appears,
11
+ * what it says — is unchanged; only the animation is dropped, and an exit
12
+ * that waited for an animation no longer waits.
13
+ */
14
+ export function usePrefersReducedMotion() {
15
+ const [reduced, setReduced] = useState(false);
16
+ useEffect(() => {
17
+ const query = window.matchMedia?.('(prefers-reduced-motion: reduce)');
18
+ if (!query) {
19
+ return undefined;
20
+ }
21
+ setReduced(query.matches);
22
+ const listen = (event) => setReduced(event.matches);
23
+ query.addEventListener?.('change', listen);
24
+ return () => query.removeEventListener?.('change', listen);
25
+ }, []);
26
+ return reduced;
27
+ }
28
+ export default usePrefersReducedMotion;
@@ -9,6 +9,9 @@ export * from "./appearance/ThemeCircle";
9
9
  export * from "./box/Box";
10
10
  export * from "./calendar-picker";
11
11
  export * from "./card/Card";
12
+ export * from "./hover-card";
13
+ export * from "./entity-avatar";
14
+ export * from "./sheet/Sheet";
12
15
  export * from "./color";
13
16
  export * from "./color-picker";
14
17
  export * from "./content-loader/ContentLoader";
@@ -13,6 +13,9 @@ export * from "./appearance/ThemeCircle";
13
13
  export * from "./box/Box";
14
14
  export * from "./calendar-picker";
15
15
  export * from "./card/Card";
16
+ export * from "./hover-card";
17
+ export * from "./entity-avatar";
18
+ export * from "./sheet/Sheet";
16
19
  export * from "./color";
17
20
  export * from "./color-picker";
18
21
  export * from "./content-loader/ContentLoader";
@@ -0,0 +1,15 @@
1
+ /**
2
+ * `Sheet`: a page on a canvas — the canvas colour, its hairline, the theme's
3
+ * card corner (20px in loop) and the shadow a sheet of paper has, lifted off
4
+ * what is under it. The page layout draws its page with it; anything that
5
+ * shows a page of its own (a document, a gallery entry, a preview) can too.
6
+ *
7
+ * It owns its look only. Its size, padding and layout are the caller's,
8
+ * given as Box props (or `sx` while the migration lasts).
9
+ */
10
+ import { type BoxProps } from "../box/Box";
11
+ /** The shadow of a sheet: a hairline close under it, a soft fall far below. */
12
+ export declare const SHEET_SHADOW = "0 1px 2px rgba(0,0,0,0.06), 0 24px 48px -28px rgba(0,0,0,0.35)";
13
+ export type SheetProps = BoxProps;
14
+ export declare function Sheet(props: SheetProps): import("react").JSX.Element;
15
+ export default Sheet;
@@ -0,0 +1,21 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ /*
3
+ * Copyright (c) 2023-2026 Datalayer, Inc.
4
+ * Distributed under the terms of the Modified BSD License.
5
+ */
6
+ /**
7
+ * `Sheet`: a page on a canvas — the canvas colour, its hairline, the theme's
8
+ * card corner (20px in loop) and the shadow a sheet of paper has, lifted off
9
+ * what is under it. The page layout draws its page with it; anything that
10
+ * shows a page of its own (a document, a gallery entry, a preview) can too.
11
+ *
12
+ * It owns its look only. Its size, padding and layout are the caller's,
13
+ * given as Box props (or `sx` while the migration lasts).
14
+ */
15
+ import { Box } from "../box/Box";
16
+ /** The shadow of a sheet: a hairline close under it, a soft fall far below. */
17
+ export const SHEET_SHADOW = "0 1px 2px rgba(0,0,0,0.06), 0 24px 48px -28px rgba(0,0,0,0.35)";
18
+ export function Sheet(props) {
19
+ return (_jsx(Box, { bg: "canvas.default", border: "1px solid", borderColor: "border.default", borderRadius: "card", boxShadow: SHEET_SHADOW, ...props }));
20
+ }
21
+ export default Sheet;
@@ -45,6 +45,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
45
45
  */
46
46
  import { useEffect } from "react";
47
47
  import { Box, Text } from "@primer/react";
48
+ import { Sheet } from "../../components/sheet/Sheet";
48
49
  import { useSignalValue } from "@datalayer/reactor/react";
49
50
  import { pageLayoutActivity, pageLayoutPanelOpen, pageLayoutSheet, } from "./panelState";
50
51
  /** A page reads best at about this width; wider and lines run too long. */
@@ -212,7 +213,7 @@ export function PageLayout({ page, hasPage = page !== undefined && page !== null
212
213
  display: "flex",
213
214
  justifyContent: "flex-end",
214
215
  mb: 2,
215
- }, children: _jsx(ActivityLine, { label: activityLabel }) })) : null, _jsx(Box, { "data-page-sheet": "", sx: {
216
+ }, children: _jsx(ActivityLine, { label: activityLabel }) })) : null, _jsx(Sheet, { "data-page-sheet": "", sx: {
216
217
  width: "100%",
217
218
  maxWidth: pageWidth,
218
219
  /*
@@ -226,11 +227,8 @@ export function PageLayout({ page, hasPage = page !== undefined && page !== null
226
227
  change in the layout's height reaches the page at once.
227
228
  */
228
229
  flex: hasPage ? "1 0 auto" : "1 1 auto",
229
- bg: "canvas.default",
230
- border: "1px solid",
231
- borderColor: "border.default",
232
- borderRadius: "10px",
233
- boxShadow: "0 1px 2px rgba(0,0,0,0.06), 0 24px 48px -28px rgba(0,0,0,0.35)",
230
+ // Its look — canvas, hairline, the theme's card corner, the
231
+ // shadow — is the Sheet's.
234
232
  // The page's own margins. A page fills the sheet and reads
235
233
  // against these, as text on paper does; a panel's content
236
234
  // brings its own gutters, so it sits closer.
@@ -7,8 +7,8 @@ type StoryContext = Record<string, unknown> & {
7
7
  };
8
8
  parameters: Record<string, unknown>;
9
9
  };
10
- export declare const colormodeFromScheme: (colorScheme: string) => "light" | "dark";
11
- export declare const withThemeProvider: (Story: React.FC<React.PropsWithChildren<StoryContext>>, context: StoryContext) => string | number | bigint | boolean | Iterable<React.ReactNode> | Promise<React.ReactNode> | React.JSX.Element | null | undefined;
10
+ export declare const colormodeFromScheme: (colorScheme: string) => "dark" | "light";
11
+ export declare const withThemeProvider: (Story: React.FC<React.PropsWithChildren<StoryContext>>, context: StoryContext) => string | number | bigint | boolean | Iterable<React.ReactNode> | React.JSX.Element | Promise<React.ReactNode> | null | undefined;
12
12
  export declare const toolbarTypes: {
13
13
  colorScheme: {
14
14
  name: string;
@@ -1,6 +1,27 @@
1
1
  import { type CSSProperties } from "react";
2
2
  import { ThemeProviderProps } from "@primer/react";
3
3
  import { type ThemeStyles } from "./css/createThemeCSSVars";
4
+ /**
5
+ * System sans-serif font stack — shared between `fontFamily` and
6
+ * the Primer `--fontStack-*` CSS custom properties so that
7
+ * components using the CSS `font` shorthand (e.g. `Blankslate`)
8
+ * also pick up the themed typeface.
9
+ */
10
+ /**
11
+ * Shared typographic rhythm — clean, spacious feel inspired by
12
+ * modern developer-blog aesthetics (generous line-height, open
13
+ * letter-spacing on headings, crisp body text).
14
+ *
15
+ * Primer components like `Blankslate` use the CSS `font` shorthand
16
+ * through `--text-title-shorthand-*` / `--text-body-shorthand-*`.
17
+ * Those shorthand variables reference `--fontStack-sansSerif` (and
18
+ * `--fontStack-sansSerifDisplay`). If the `@primer/primitives`
19
+ * typography CSS isn't loaded, the shorthand vars are undefined and
20
+ * components fall back to a hardcoded system font stack baked into
21
+ * their CSS. We define the full set here so **every** theme gets
22
+ * correct font inheritance — no primitives CSS import required.
23
+ */
24
+ export declare const typographyVars: CSSProperties;
4
25
  export interface IDatalayerThemeProviderProps extends Omit<ThemeProviderProps, "theme" | "colorMode"> {
5
26
  /**
6
27
  * Color mode to use.
@@ -8,6 +8,7 @@ import { BaseStyles, ThemeProvider } from "@primer/react";
8
8
  import { useSystemColorMode } from "./useSystemColorMode";
9
9
  import { datalayerTheme, datalayerThemeStyles } from "./themes/datalayerTheme";
10
10
  import { systemFontStack } from "./fontStacks";
11
+ import { primerBaseVars } from "./css/primerBaseVars";
11
12
  import { APP_ROOT_ATTRIBUTE, THEME_SCOPE_ATTRIBUTE, injectThemeStylesheet, setupPrimerPortals, syncPortalThemeStyles, } from "../utils/Portals";
12
13
  /**
13
14
  * System sans-serif font stack — shared between `fontFamily` and
@@ -29,7 +30,7 @@ import { APP_ROOT_ATTRIBUTE, THEME_SCOPE_ATTRIBUTE, injectThemeStylesheet, setup
29
30
  * their CSS. We define the full set here so **every** theme gets
30
31
  * correct font inheritance — no primitives CSS import required.
31
32
  */
32
- const typographyVars = {
33
+ export const typographyVars = {
33
34
  /* ── Font stacks ───────────────────────────────────────────────── */
34
35
  "--fontStack-monospace": "ui-monospace, SFMono-Regular, SF Mono, Menlo, Consolas, Liberation Mono, monospace",
35
36
  "--fontStack-sansSerif": systemFontStack,
@@ -151,14 +152,18 @@ export function DatalayerThemeProvider(props) {
151
152
  const resolvedTheme = theme ?? datalayerTheme;
152
153
  const styles = themeStyles ?? datalayerThemeStyles;
153
154
  const resolvedStyles = isDark ? styles.dark : styles.light;
155
+ // Primer's variables no theme sets (radii, neutrals, shadows…), under the
156
+ // theme's own: `Box` emits them with no fallback (see primerBaseVars).
157
+ const baseVars = (isDark ? primerBaseVars.dark : primerBaseVars.light);
154
158
  // The full set of styles that <BaseStyles> receives — we also push
155
159
  // these to document.body so Primer portal content inherits theme
156
160
  // tokens, fonts, and colors.
157
161
  const portalStyles = useMemo(() => ({
158
162
  ...typographyVars,
163
+ ...baseVars,
159
164
  ...resolvedStyles,
160
165
  ...baseStyles,
161
- }), [resolvedStyles, baseStyles]);
166
+ }), [baseVars, resolvedStyles, baseStyles]);
162
167
  // Keep document.body portal-root attributes AND theme styles in sync
163
168
  // so that Primer portals (modals, dialogs, overlays) inherit the
164
169
  // correct color mode **and** theme tokens (fonts, colors, CSS vars).
@@ -200,6 +205,7 @@ export function DatalayerThemeProvider(props) {
200
205
  lineHeight: "1.7",
201
206
  transition: "background-color 0.25s ease, color 0.25s ease",
202
207
  ...typographyVars,
208
+ ...baseVars,
203
209
  ...resolvedStyles,
204
210
  ...baseStyles,
205
211
  }, children: [_jsx("span", { ref: sentinel, hidden: true, "data-datalayer-theme-root": "" }), children] }) }));
@@ -6,7 +6,8 @@ export { earthColors } from './earthColors';
6
6
  export { sandColors } from './sandColors';
7
7
  export { ivoryColors } from './ivoryColors';
8
8
  export { sunColors } from './sunColors';
9
- export { loopColors, loopAccents, loopAccentNames, loopAccentVars, loopAccentStyles, type LoopAccent, type LoopAccentName, } from './loopColors';
9
+ export { loopColors } from './loopColors';
10
+ export { themeAccents, themeAccentNames, themeAccentVars, themeAccentTints, themeStageGradient, themeTintVars, type ThemeAccent, type ThemeAccentName, } from './themeAccents';
10
11
  import type { ThemeVariant } from '../themeRegistry';
11
12
  /**
12
13
  * Themed color palettes — maps each `ThemeVariant` to its corresponding
@@ -10,7 +10,8 @@ export { earthColors } from './earthColors';
10
10
  export { sandColors } from './sandColors';
11
11
  export { ivoryColors } from './ivoryColors';
12
12
  export { sunColors } from './sunColors';
13
- export { loopColors, loopAccents, loopAccentNames, loopAccentVars, loopAccentStyles, } from './loopColors';
13
+ export { loopColors } from './loopColors';
14
+ export { themeAccents, themeAccentNames, themeAccentVars, themeAccentTints, themeStageGradient, themeTintVars, } from './themeAccents';
14
15
  import { datalayerColors } from './datalayerColors';
15
16
  import { spatialColors } from './spatialColors';
16
17
  import { lovelyColors } from './lovelyColors';
@@ -8,10 +8,8 @@
8
8
  *
9
9
  * The accent of the theme itself is mint — a soft green, lighter than
10
10
  * the platform's (decided 2026-10-03, after a day on sky). An
11
- * application may take one of five others (`loopAccents`); each is four
12
- * values: the accent, the text that sits
13
- * on it, the tint of the stage behind an application, and a quiet tint.
14
- * Dark text on every accent: the lowest contrast of the six is 8.8 to 1.
11
+ * application may take one of five others: the accents are the theme
12
+ * system's, over every theme (`themeAccents`, decided 2026-10-07).
15
13
  */
16
14
  export declare const loopColors: {
17
15
  black: string;
@@ -64,47 +62,3 @@ export declare const loopColors: {
64
62
  brightLightFlame: string;
65
63
  brightLightGold: string;
66
64
  };
67
- /** The accents an application may take, by name. */
68
- export type LoopAccentName = 'green' | 'rose' | 'sky' | 'lime' | 'sun' | 'violet';
69
- /** An accent: four values, in light and in dark. */
70
- export interface LoopAccent {
71
- /** The accent itself: a bubble, a send button. The same in both modes. */
72
- accent: string;
73
- /** The text that sits on the accent. */
74
- on: string;
75
- /** The stage behind an application. */
76
- stage: {
77
- light: string;
78
- dark: string;
79
- };
80
- /** A quiet tint: a draft, something waiting. */
81
- quiet: {
82
- light: string;
83
- dark: string;
84
- };
85
- /**
86
- * The accent as text: a link, a starter, an accent's word — deep enough on
87
- * white (4.5 to 1), and the pastel itself on dark.
88
- */
89
- text: {
90
- light: string;
91
- dark: string;
92
- };
93
- }
94
- /** The six accents. One per application; everything else is neutral. Green — mint — is the theme's own. */
95
- export declare const loopAccents: Record<LoopAccentName, LoopAccent>;
96
- /** The names of the accents, in the order a picker shows them. */
97
- export declare const loopAccentNames: LoopAccentName[];
98
- /**
99
- * An accent as CSS custom properties, for a color mode: what an
100
- * application sets on its root to take its colour.
101
- */
102
- export declare function loopAccentVars(name: LoopAccentName, mode?: 'light' | 'dark'): Record<string, string>;
103
- /**
104
- * An application's accent as everything it colours (LOOP T-05): the four
105
- * `--loop-*` properties of `loopAccentVars`, and Primer's accent fill and
106
- * filled button — the person's bubble, the assistant's avatar, the one
107
- * button to press — in the accent with the text that sits on it. Set on an
108
- * application's root, it wears its own colour; the page around keeps mint.
109
- */
110
- export declare function loopAccentStyles(name: LoopAccentName, mode?: 'light' | 'dark'): Record<string, string>;
@@ -12,10 +12,8 @@
12
12
  *
13
13
  * The accent of the theme itself is mint — a soft green, lighter than
14
14
  * the platform's (decided 2026-10-03, after a day on sky). An
15
- * application may take one of five others (`loopAccents`); each is four
16
- * values: the accent, the text that sits
17
- * on it, the tint of the stage behind an application, and a quiet tint.
18
- * Dark text on every accent: the lowest contrast of the six is 8.8 to 1.
15
+ * application may take one of five others: the accents are the theme
16
+ * system's, over every theme (`themeAccents`, decided 2026-10-07).
19
17
  */
20
18
  export const loopColors = {
21
19
  // Core neutrals
@@ -76,97 +74,3 @@ export const loopColors = {
76
74
  brightLightFlame: '#B4571A', // Deep orange
77
75
  brightLightGold: '#8A6A00', // Deep sun
78
76
  };
79
- /** The six accents. One per application; everything else is neutral. Green — mint — is the theme's own. */
80
- export const loopAccents = {
81
- green: {
82
- accent: '#7ADBB8',
83
- on: '#06281E',
84
- stage: { light: '#DDF5EC', dark: '#10261F' },
85
- quiet: { light: '#F0FAF6', dark: '#17211D' },
86
- text: { light: '#248462', dark: '#8FE5C6' },
87
- },
88
- rose: {
89
- accent: '#F6A5C1',
90
- on: '#3A0A1C',
91
- stage: { light: '#FCE3EC', dark: '#2B141C' },
92
- quiet: { light: '#FDF2F6', dark: '#22181C' },
93
- text: { light: '#B83A6B', dark: '#F6A5C1' },
94
- },
95
- sky: {
96
- accent: '#8CCBF9',
97
- on: '#06243B',
98
- stage: { light: '#DFF0FD', dark: '#0F2333' },
99
- quiet: { light: '#F0F8FE', dark: '#161E25' },
100
- text: { light: '#1F6FB0', dark: '#8CCBF9' },
101
- },
102
- lime: {
103
- accent: '#BEDC55',
104
- on: '#1F2A00',
105
- stage: { light: '#EEF6CC', dark: '#1E2609' },
106
- quiet: { light: '#F7FBE6', dark: '#1C2014' },
107
- text: { light: '#5F7A00', dark: '#BEDC55' },
108
- },
109
- sun: {
110
- accent: '#F8D469',
111
- on: '#2E2200',
112
- stage: { light: '#FDF3CD', dark: '#2A2209' },
113
- quiet: { light: '#FEF9E7', dark: '#221F14' },
114
- text: { light: '#8A6A00', dark: '#F8D469' },
115
- },
116
- violet: {
117
- accent: '#C0AEF6',
118
- on: '#1C0F47',
119
- stage: { light: '#ECE7FD', dark: '#1B1533' },
120
- quiet: { light: '#F6F3FE', dark: '#1C1A27' },
121
- text: { light: '#6B53C9', dark: '#C0AEF6' },
122
- },
123
- };
124
- /** The names of the accents, in the order a picker shows them. */
125
- export const loopAccentNames = ['green', 'rose', 'sky', 'lime', 'sun', 'violet'];
126
- /**
127
- * An accent as CSS custom properties, for a color mode: what an
128
- * application sets on its root to take its colour.
129
- */
130
- export function loopAccentVars(name, mode = 'light') {
131
- const accent = loopAccents[name] ?? loopAccents.green;
132
- return {
133
- '--loop-accent': accent.accent,
134
- '--loop-accent-on': accent.on,
135
- '--loop-stage': accent.stage[mode],
136
- '--loop-quiet': accent.quiet[mode],
137
- };
138
- }
139
- /**
140
- * An application's accent as everything it colours (LOOP T-05): the four
141
- * `--loop-*` properties of `loopAccentVars`, and Primer's accent fill and
142
- * filled button — the person's bubble, the assistant's avatar, the one
143
- * button to press — in the accent with the text that sits on it. Set on an
144
- * application's root, it wears its own colour; the page around keeps mint.
145
- */
146
- export function loopAccentStyles(name, mode = 'light') {
147
- const accent = loopAccents[name];
148
- if (!accent) {
149
- throw new Error(`There is no accent "${name}"; the accents are ${loopAccentNames.join(', ')}.`);
150
- }
151
- return {
152
- ...loopAccentVars(name, mode),
153
- '--bgColor-accent-emphasis': accent.accent,
154
- '--borderColor-accent-emphasis': accent.accent,
155
- // Its text, its muted border and tint: so that nothing on the page keeps
156
- // the theme's default accent beside the application's own (T-18).
157
- '--fgColor-accent': accent.text[mode],
158
- '--fgColor-link': accent.text[mode],
159
- '--borderColor-accent-muted': accent.accent,
160
- '--bgColor-accent-muted': accent.quiet[mode],
161
- // The selected tab: underlined in the accent (T-14).
162
- '--underlineNav-borderColor-active': accent.accent,
163
- '--button-primary-bgColor-rest': accent.accent,
164
- '--button-primary-borderColor-rest': accent.accent,
165
- '--button-primary-bgColor-hover': accent.accent,
166
- '--button-primary-borderColor-hover': accent.accent,
167
- '--button-primary-bgColor-active': accent.accent,
168
- '--button-primary-borderColor-active': accent.accent,
169
- '--button-primary-fgColor-rest': accent.on,
170
- '--button-primary-iconColor-rest': accent.on,
171
- };
172
- }