@datalayer/primer-addons 1.0.36 → 1.0.38

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 (60) hide show
  1. package/README.md +19 -1
  2. package/lib/components/appearance/AppearanceControls.js +5 -0
  3. package/lib/reactor/index.d.ts +1 -1
  4. package/lib/reactor/index.js +1 -1
  5. package/lib/reactor/page-layout/PageLayout.d.ts +6 -0
  6. package/lib/reactor/page-layout/PageLayout.js +26 -0
  7. package/lib/theme/DatalayerThemeProvider.js +5 -2
  8. package/lib/theme/css/createThemeCSSVars.d.ts +5 -0
  9. package/lib/theme/css/createThemeCSSVars.js +2 -0
  10. package/lib/theme/index.d.ts +1 -0
  11. package/lib/theme/index.js +1 -0
  12. package/lib/theme/loopEyes.d.ts +84 -0
  13. package/lib/theme/loopEyes.js +82 -0
  14. package/lib/theme/portable.d.ts +16 -0
  15. package/lib/theme/portable.js +20 -0
  16. package/lib/theme/portableTheme.d.ts +1 -1
  17. package/lib/theme/portableTheme.js +2 -2
  18. package/lib/theme/themeRegistry.d.ts +3 -75
  19. package/lib/theme/themeRegistry.js +38 -509
  20. package/lib/theme/themeTokens.d.ts +101 -0
  21. package/lib/theme/themeTokens.js +494 -0
  22. package/lib/theme/themes/datalayerTheme.d.ts +2 -9
  23. package/lib/theme/themes/datalayerTheme.js +8 -236
  24. package/lib/theme/themes/datalayerThemeStyles.d.ts +2 -0
  25. package/lib/theme/themes/datalayerThemeStyles.js +234 -0
  26. package/lib/theme/themes/earthTheme.d.ts +2 -9
  27. package/lib/theme/themes/earthTheme.js +8 -235
  28. package/lib/theme/themes/earthThemeStyles.d.ts +2 -0
  29. package/lib/theme/themes/earthThemeStyles.js +233 -0
  30. package/lib/theme/themes/ivoryTheme.d.ts +2 -9
  31. package/lib/theme/themes/ivoryTheme.js +8 -249
  32. package/lib/theme/themes/ivoryThemeStyles.d.ts +2 -0
  33. package/lib/theme/themes/ivoryThemeStyles.js +247 -0
  34. package/lib/theme/themes/loopTheme.d.ts +13 -144
  35. package/lib/theme/themes/loopTheme.js +20 -517
  36. package/lib/theme/themes/loopThemeStyles.d.ts +135 -0
  37. package/lib/theme/themes/loopThemeStyles.js +521 -0
  38. package/lib/theme/themes/lovelyTheme.d.ts +2 -9
  39. package/lib/theme/themes/lovelyTheme.js +8 -231
  40. package/lib/theme/themes/lovelyThemeStyles.d.ts +2 -0
  41. package/lib/theme/themes/lovelyThemeStyles.js +229 -0
  42. package/lib/theme/themes/matrixTheme.d.ts +2 -9
  43. package/lib/theme/themes/matrixTheme.js +8 -237
  44. package/lib/theme/themes/matrixThemeStyles.d.ts +2 -0
  45. package/lib/theme/themes/matrixThemeStyles.js +235 -0
  46. package/lib/theme/themes/sandTheme.d.ts +2 -9
  47. package/lib/theme/themes/sandTheme.js +8 -248
  48. package/lib/theme/themes/sandThemeStyles.d.ts +2 -0
  49. package/lib/theme/themes/sandThemeStyles.js +246 -0
  50. package/lib/theme/themes/spatialTheme.d.ts +2 -9
  51. package/lib/theme/themes/spatialTheme.js +8 -231
  52. package/lib/theme/themes/spatialThemeStyles.d.ts +2 -0
  53. package/lib/theme/themes/spatialThemeStyles.js +229 -0
  54. package/lib/theme/themes/sunTheme.d.ts +2 -9
  55. package/lib/theme/themes/sunTheme.js +8 -249
  56. package/lib/theme/themes/sunThemeStyles.d.ts +2 -0
  57. package/lib/theme/themes/sunThemeStyles.js +247 -0
  58. package/lib/utils/Portals.d.ts +7 -0
  59. package/lib/utils/Portals.js +7 -0
  60. package/package.json +1 -1
@@ -0,0 +1,135 @@
1
+ import { type ThemeColorDefs } from '../css/createThemeCSSVars';
2
+ export declare const loopLight: ThemeColorDefs;
3
+ export declare const loopDark: ThemeColorDefs;
4
+ /**
5
+ * What the Loop theme sets beside colour, the same in both modes.
6
+ *
7
+ * Primer's own radii are made rounder; the `--loop-*` properties are what
8
+ * an application is drawn with. A face is an emoji at one of three sizes;
9
+ * motion has three durations and one easing.
10
+ */
11
+ export declare const loopShapeVars: Record<string, string>;
12
+ /**
13
+ * Shadows, per mode: how a surface floats. Soft and low in the light —
14
+ * a card is told apart by its shadow more than by a line; in the dark a
15
+ * shadow shows little, so a surface gets a hairline of light and a
16
+ * deeper shadow. Primer's own shadow tokens take the same hand, so a menu
17
+ * or a dialog floats the way a frame does.
18
+ */
19
+ export declare const loopShadows: Record<'light' | 'dark', Record<string, string>>;
20
+ /**
21
+ * Type (LOOP T-04): one face, two weights, five sizes, one line-height per
22
+ * size — each line a multiple of 4px.
23
+ *
24
+ * | Size | Line | Tokens |
25
+ * |-----------------|---------------|--------------------------------------|
26
+ * | 2rem (32px) | 1.25 (40px) | display, title large |
27
+ * | 1.25rem (20px) | 1.4 (28px) | title medium, subtitle |
28
+ * | 1rem (16px) | 1.5 (24px) | title small, body large |
29
+ * | 0.875rem (14px) | 1.4286 (20px) | body medium — the body of the theme |
30
+ * | 0.75rem (12px) | 1.3333 (16px) | body small, caption |
31
+ *
32
+ * The weights are 400 (body, subtitle) and 600 (titles, display, and what
33
+ * Primer sets in its medium weight — a button's label); Primer's light weight
34
+ * is 400. The titles are set tight and a little closer, as a good display face
35
+ * is; the body left alone. The tracking is a token for a component to apply,
36
+ * since a CSS font shorthand carries none.
37
+ */
38
+ export declare const loopTypeScale: {
39
+ readonly display: {
40
+ readonly size: "2rem";
41
+ readonly lineHeight: "1.25";
42
+ };
43
+ readonly title: {
44
+ readonly size: "1.25rem";
45
+ readonly lineHeight: "1.4";
46
+ };
47
+ readonly heading: {
48
+ readonly size: "1rem";
49
+ readonly lineHeight: "1.5";
50
+ };
51
+ readonly body: {
52
+ readonly size: "0.875rem";
53
+ readonly lineHeight: "1.4286";
54
+ };
55
+ readonly small: {
56
+ readonly size: "0.75rem";
57
+ readonly lineHeight: "1.3333";
58
+ };
59
+ };
60
+ /** The two weights of the `loop` theme. */
61
+ export declare const loopFontWeights: {
62
+ readonly regular: 400;
63
+ readonly semibold: 600;
64
+ };
65
+ export declare const loopTypeVars: (font: string) => Record<string, string>;
66
+ /**
67
+ * The stage, lit: a soft fall from the stage tint at the top to the quiet
68
+ * tint at the bottom, for the page an application sits on. Both tints are
69
+ * the accent's, so an application's own colour lights its stage.
70
+ */
71
+ export declare const loopStageGradient = "radial-gradient(140% 100% at 50% 0%, var(--loop-stage) 0%, var(--loop-quiet) 100%)";
72
+ /**
73
+ * Inter, then its metric-matched fallback, then the system's own sans-serif
74
+ * (LOOP T-04). One face, two weights (400 and 600). The face is served by the
75
+ * page's own build: a page wearing the theme imports
76
+ * `@datalayer/primer-addons/style/loop-face.css`, which declares
77
+ * `Inter Variable` from `@fontsource-variable/inter` and `Inter Fallback`, a
78
+ * local Arial drawn to Inter's measure. The text paints in the fallback first
79
+ * and does not move when Inter arrives; a page that has not imported the
80
+ * stylesheet shows the system face.
81
+ */
82
+ export declare const loopFontFamily = "\"Inter Variable\", \"Inter Fallback\", ui-sans-serif, system-ui, -apple-system, \"Segoe UI\", Roboto, \"Helvetica Neue\", Arial, sans-serif";
83
+ /**
84
+ * Motion (LOOP T-10): three durations and one easing, for three things — a
85
+ * status changing, a message arriving, a pane opening. Nothing else moves.
86
+ */
87
+ export declare const loopMotionVars: Record<string, string>;
88
+ /**
89
+ * The focus ring (LOOP T-15): 3 to 1 against the page and around a pill of
90
+ * any accent, in both modes. In light mode the deep mint does it — darker than the text, the one place it is —
91
+ * a halo in the theme's colour, as a system's own focus ring is — 6.5 to 1
92
+ * on white and 3.28 or more around every pastel. In dark mode no
93
+ * colour clears 3 to 1 against both the near-black page and the six
94
+ * pastels, the light ink least of all (under 1.8 to 1 on the pastels): a
95
+ * mid grey does, at 3.04 to 1 — and 2.77 to 1 on the subtle dark surface,
96
+ * the one place it falls short.
97
+ */
98
+ export declare const loopFocusRing: {
99
+ readonly light: string;
100
+ readonly dark: "#636363";
101
+ };
102
+ /**
103
+ * The controls, as one family (LOOP T-09): every single-line control is a
104
+ * pill — a button, a text input, a select, a segmented control (outside and
105
+ * each segment), a button group's two ends, a toggle switch, an underline
106
+ * tab's hover. A multi-line text area keeps `--borderRadius-medium`: a pill
107
+ * of many lines is a lozenge. Menus and overlays keep the card's radius,
108
+ * `--borderRadius-large`, which the theme already sets.
109
+ *
110
+ * Primer takes every control's corners from `--borderRadius-medium`, which
111
+ * cards and list items take too, so this cannot be a token: it is a
112
+ * stylesheet, scoped by the theme provider (`ThemeStyles.css`). Primer's
113
+ * class names are CSS-module hashes (`prc-Button-ButtonBase-c50BI`), so the
114
+ * selectors match their stable prefix; the toggle switch is a
115
+ * styled-component, matched by its display name, which styled-components
116
+ * puts in its class (`ToggleSwitch__SwitchButton-sc-e6gszy-0`). A test reads each of them
117
+ * back from the installed `@primer/react`.
118
+ *
119
+ * Where a control draws more than one element from the token — a segmented
120
+ * control's track and segments, a button group's ends — the token itself is
121
+ * set on the control, and Primer's own rules draw the pill.
122
+ */
123
+ export declare const loopControlsSelectors: {
124
+ readonly button: "[class*=\"prc-Button-ButtonBase\"]";
125
+ readonly textInput: "[class*=\"prc-components-TextInputBaseWrapper\"]";
126
+ readonly textArea: "[class*=\"prc-Textarea-TextArea\"]";
127
+ readonly segmentedControl: "[class*=\"prc-SegmentedControl-SegmentedControl\"]";
128
+ readonly buttonGroup: "[class*=\"prc-ButtonGroup-ButtonGroup\"]";
129
+ readonly underlineTab: "[class*=\"prc-components-UnderlineItem\"]";
130
+ readonly toggleTrack: "[class*=\"ToggleSwitch__SwitchButton-\"]";
131
+ readonly toggleKnob: "[class*=\"ToggleSwitch__ToggleKnob-\"]";
132
+ };
133
+ export declare const loopControlsCss: string;
134
+ /** Comprehensive Primer CSS-variable overrides for light & dark mode. */
135
+ export declare const loopThemeStyles: import("../css/createThemeCSSVars").ThemeStyles;
@@ -0,0 +1,521 @@
1
+ /*
2
+ * Copyright (c) 2023-2025 Datalayer, Inc.
3
+ * Distributed under the terms of the Modified BSD License.
4
+ */
5
+ /**
6
+ * Loop Theme for Primer React.
7
+ *
8
+ * Soft and clear, for somebody who is not here for the software: one accent,
9
+ * neutral everything else. A white (or near-black) canvas, a deep-grey ink
10
+ * rather than black, faint hairlines, surfaces that float on soft shadows
11
+ * instead of sitting in boxes, generous rounding, and one filled button in
12
+ * the accent — the thing to press, plain to see. Inter, with the system
13
+ * sans-serif stack behind it, titles set tight.
14
+ * Theming is applied via **CSS custom-property overrides**.
15
+ *
16
+ * Unlike the other themes it also sets **shape**: rounder corners, and
17
+ * its own `--loop-*` properties for what an application is drawn with —
18
+ * its accent, the stage behind it, a bubble, a frame, a face.
19
+ */
20
+ import { loopAccentVars, loopAccents, loopColors } from '../colors/loopColors';
21
+ import { buildThemeStyles } from '../css/createThemeCSSVars';
22
+ /* ── Light-mode colour definitions ───────────────────────────────────── */
23
+ export const loopLight = {
24
+ canvas: {
25
+ default: loopColors.white,
26
+ subtle: loopColors.subtle,
27
+ },
28
+ fg: {
29
+ default: loopColors.ink,
30
+ muted: loopColors.gray,
31
+ onEmphasis: '#FFFFFF',
32
+ },
33
+ accent: {
34
+ fg: loopColors.loopText,
35
+ // The accent itself, as on dark: the soft mint that dark text sits on —
36
+ // the filled button, the person's bubble, the assistant's avatar. The
37
+ // chat pairs it with the button's text, so the two stay one colour.
38
+ emphasis: loopColors.loopBrand,
39
+ muted: loopColors.loopBrand,
40
+ subtle: loopColors.loopTint,
41
+ },
42
+ success: {
43
+ fg: loopColors.successBrand,
44
+ emphasis: loopColors.successBrand,
45
+ muted: loopColors.successAccent,
46
+ subtle: loopColors.successTint,
47
+ },
48
+ attention: {
49
+ fg: loopColors.attentionBrand,
50
+ emphasis: loopColors.attentionBrand,
51
+ muted: loopColors.attentionAccent,
52
+ subtle: loopColors.attentionTint,
53
+ },
54
+ danger: {
55
+ fg: loopColors.dangerBrand,
56
+ emphasis: loopColors.dangerBrand,
57
+ muted: loopColors.dangerAccent,
58
+ subtle: loopColors.dangerTint,
59
+ },
60
+ severe: {
61
+ fg: loopColors.severeBrand,
62
+ emphasis: loopColors.severeBrand,
63
+ muted: loopColors.severeAccent,
64
+ subtle: loopColors.severeTint,
65
+ },
66
+ done: {
67
+ fg: loopColors.doneBrand,
68
+ emphasis: loopColors.doneBrand,
69
+ muted: loopColors.doneAccent,
70
+ subtle: loopColors.doneTint,
71
+ },
72
+ border: {
73
+ // Hairlines: 7% of the ink, as solid colours on white — a surface is
74
+ // told apart by its shadow more than by a line.
75
+ default: '#ECECEE',
76
+ muted: '#F2F2F4',
77
+ },
78
+ btn: {
79
+ text: loopColors.ink,
80
+ bg: loopColors.subtle,
81
+ border: 'transparent',
82
+ hoverBg: '#ECECEF',
83
+ hoverBorder: 'transparent',
84
+ activeBg: '#E3E3E7',
85
+ activeBorder: 'transparent',
86
+ selectedBg: '#E3E3E7',
87
+ counterBg: 'rgba(29, 29, 31, 0.08)',
88
+ // The one filled button of a screen, in the accent: the soft mint, with
89
+ // its dark text — the same pastel as on dark, never the platform's deep green.
90
+ primary: {
91
+ text: loopColors.loopOn,
92
+ bg: loopColors.loopBrand,
93
+ border: loopColors.loopBrand,
94
+ hoverBg: loopColors.loopBrandHover,
95
+ hoverBorder: loopColors.loopBrandHover,
96
+ selectedBg: loopColors.loopAccent,
97
+ disabledText: 'rgba(6, 40, 30, 0.5)',
98
+ disabledBg: '#CDEFE2',
99
+ disabledBorder: '#CDEFE2',
100
+ icon: loopColors.loopOn,
101
+ counterBg: 'rgba(6, 40, 30, 0.12)',
102
+ },
103
+ outline: {
104
+ text: loopColors.loopText,
105
+ hoverText: loopColors.loopOn,
106
+ hoverBg: loopColors.loopBrand,
107
+ hoverBorder: loopColors.loopBrand,
108
+ hoverCounterBg: 'rgba(6, 40, 30, 0.12)',
109
+ selectedText: loopColors.loopOn,
110
+ selectedBg: loopColors.loopAccent,
111
+ selectedBorder: loopColors.loopAccent,
112
+ disabledText: loopColors.gray,
113
+ disabledBg: loopColors.subtle,
114
+ disabledCounterBg: 'rgba(0, 0, 0, 0.05)',
115
+ counterBg: 'rgba(0, 0, 0, 0.05)',
116
+ counterFg: loopColors.loopText,
117
+ hoverCounterFg: loopColors.loopOn,
118
+ disabledCounterFg: loopColors.gray,
119
+ },
120
+ danger: {
121
+ text: loopColors.dangerBrand,
122
+ hoverText: '#FFFFFF',
123
+ hoverBg: loopColors.dangerBrand,
124
+ hoverBorder: loopColors.dangerBrand,
125
+ hoverCounterBg: 'rgba(255, 255, 255, 0.2)',
126
+ selectedText: '#FFFFFF',
127
+ selectedBg: '#9C302A',
128
+ selectedBorder: '#9C302A',
129
+ disabledText: 'rgba(191, 63, 56, 0.5)',
130
+ disabledBg: loopColors.subtle,
131
+ disabledCounterBg: 'rgba(191, 63, 56, 0.05)',
132
+ counterBg: 'rgba(191, 63, 56, 0.1)',
133
+ counterFg: loopColors.dangerBrand,
134
+ hoverCounterFg: '#FFFFFF',
135
+ disabledCounterFg: 'rgba(191, 63, 56, 0.5)',
136
+ icon: loopColors.dangerBrand,
137
+ },
138
+ },
139
+ };
140
+ /* ── Dark-mode colour definitions ────────────────────────────────────── */
141
+ export const loopDark = {
142
+ canvas: {
143
+ default: loopColors.black,
144
+ subtle: loopColors.subtleDark,
145
+ },
146
+ fg: {
147
+ default: loopColors.inkDark,
148
+ muted: loopColors.grayDark,
149
+ onEmphasis: '#FFFFFF',
150
+ },
151
+ accent: {
152
+ fg: loopColors.loopBright,
153
+ // The accent itself, on dark: a pastel that dark text sits on.
154
+ emphasis: loopColors.loopBrand,
155
+ muted: loopColors.loopBrand,
156
+ subtle: loopColors.loopTintDark,
157
+ },
158
+ success: {
159
+ fg: loopColors.successAccent,
160
+ emphasis: loopColors.successBrand,
161
+ muted: loopColors.successAccent,
162
+ subtle: '#12241B',
163
+ },
164
+ attention: {
165
+ fg: loopColors.attentionAccent,
166
+ emphasis: '#8A5710',
167
+ muted: loopColors.attentionAccent,
168
+ subtle: '#2A2010',
169
+ },
170
+ danger: {
171
+ fg: loopColors.dangerAccent,
172
+ emphasis: loopColors.dangerBrand,
173
+ muted: loopColors.dangerAccent,
174
+ subtle: '#2C1615',
175
+ },
176
+ severe: {
177
+ fg: loopColors.severeAccent,
178
+ emphasis: loopColors.severeBrand,
179
+ muted: loopColors.severeAccent,
180
+ subtle: '#2B1B10',
181
+ },
182
+ done: {
183
+ fg: loopColors.doneAccent,
184
+ emphasis: loopColors.doneBrand,
185
+ muted: loopColors.doneAccent,
186
+ subtle: '#1C1A27',
187
+ },
188
+ border: {
189
+ // Hairlines: 10% of the ink, as solid colours on near-black.
190
+ default: '#2A2A2C',
191
+ muted: '#222224',
192
+ },
193
+ btn: {
194
+ text: loopColors.inkDark,
195
+ bg: loopColors.subtleDark,
196
+ border: 'transparent',
197
+ hoverBg: '#28282B',
198
+ hoverBorder: 'transparent',
199
+ activeBg: '#303033',
200
+ activeBorder: 'transparent',
201
+ selectedBg: '#303033',
202
+ counterBg: 'rgba(245, 245, 247, 0.12)',
203
+ // The one filled button of a screen, in the accent: the pastel, with
204
+ // its dark text, the brightest thing on a dark page.
205
+ primary: {
206
+ text: loopColors.loopOn,
207
+ bg: loopColors.loopBrand,
208
+ border: loopColors.loopBrand,
209
+ hoverBg: loopColors.loopBright,
210
+ hoverBorder: loopColors.loopBright,
211
+ selectedBg: '#6CCFAA',
212
+ disabledText: 'rgba(6, 40, 30, 0.6)',
213
+ disabledBg: 'rgba(122, 219, 184, 0.35)',
214
+ disabledBorder: 'transparent',
215
+ icon: loopColors.loopOn,
216
+ counterBg: 'rgba(6, 40, 30, 0.15)',
217
+ },
218
+ outline: {
219
+ text: loopColors.loopBright,
220
+ hoverText: loopColors.loopOn,
221
+ hoverBg: loopColors.loopBright,
222
+ hoverBorder: loopColors.loopBright,
223
+ hoverCounterBg: 'rgba(0, 0, 0, 0.2)',
224
+ selectedText: loopColors.loopOn,
225
+ selectedBg: loopColors.loopBrand,
226
+ selectedBorder: loopColors.loopBrand,
227
+ disabledText: 'rgba(143, 229, 198, 0.5)',
228
+ disabledBg: 'rgba(143, 229, 198, 0.1)',
229
+ disabledCounterBg: 'rgba(143, 229, 198, 0.05)',
230
+ counterBg: 'rgba(143, 229, 198, 0.1)',
231
+ counterFg: loopColors.loopBright,
232
+ hoverCounterFg: loopColors.loopOn,
233
+ disabledCounterFg: 'rgba(143, 229, 198, 0.5)',
234
+ },
235
+ danger: {
236
+ text: loopColors.dangerAccent,
237
+ hoverText: '#FFFFFF',
238
+ hoverBg: loopColors.dangerBrand,
239
+ hoverBorder: loopColors.dangerAccent,
240
+ hoverCounterBg: 'rgba(255, 255, 255, 0.2)',
241
+ selectedText: '#FFFFFF',
242
+ selectedBg: '#9C302A',
243
+ selectedBorder: loopColors.dangerAccent,
244
+ disabledText: 'rgba(240, 138, 131, 0.5)',
245
+ disabledBg: 'rgba(240, 138, 131, 0.1)',
246
+ disabledCounterBg: 'rgba(240, 138, 131, 0.05)',
247
+ counterBg: 'rgba(240, 138, 131, 0.1)',
248
+ counterFg: loopColors.dangerAccent,
249
+ hoverCounterFg: '#FFFFFF',
250
+ disabledCounterFg: 'rgba(240, 138, 131, 0.5)',
251
+ icon: loopColors.dangerAccent,
252
+ },
253
+ },
254
+ };
255
+ /* ── Shape, type and motion ──────────────────────────────────────────── */
256
+ /**
257
+ * What the Loop theme sets beside colour, the same in both modes.
258
+ *
259
+ * Primer's own radii are made rounder; the `--loop-*` properties are what
260
+ * an application is drawn with. A face is an emoji at one of three sizes;
261
+ * motion has three durations and one easing.
262
+ */
263
+ export const loopShapeVars = {
264
+ '--borderRadius-small': '10px',
265
+ '--borderRadius-medium': '14px',
266
+ '--borderRadius-large': '20px',
267
+ '--borderRadius-default': '14px',
268
+ '--loop-radius-control': '999px',
269
+ '--loop-radius-card': '20px',
270
+ '--loop-radius-bubble': '22px',
271
+ '--loop-radius-frame': '28px',
272
+ // Light mode's; `loopShadows` says dark mode's.
273
+ '--loop-shadow-frame': '0 1px 2px rgba(0, 0, 0, 0.03), 0 10px 30px rgba(0, 0, 0, 0.06)',
274
+ '--loop-face-large': '72px',
275
+ '--loop-face-medium': '40px',
276
+ '--loop-face-small': '20px',
277
+ '--loop-motion-fast': '120ms',
278
+ '--loop-motion-medium': '200ms',
279
+ '--loop-motion-slow': '320ms',
280
+ '--loop-motion-easing': 'cubic-bezier(0.2, 0.8, 0.2, 1)',
281
+ };
282
+ /** The hairline between two surfaces, per mode. */
283
+ const loopHairline = {
284
+ light: 'rgba(29, 29, 31, 0.07)',
285
+ dark: 'rgba(255, 255, 255, 0.10)',
286
+ };
287
+ /**
288
+ * Shadows, per mode: how a surface floats. Soft and low in the light —
289
+ * a card is told apart by its shadow more than by a line; in the dark a
290
+ * shadow shows little, so a surface gets a hairline of light and a
291
+ * deeper shadow. Primer's own shadow tokens take the same hand, so a menu
292
+ * or a dialog floats the way a frame does.
293
+ */
294
+ export const loopShadows = {
295
+ light: {
296
+ '--loop-shadow-frame': '0 1px 2px rgba(0, 0, 0, 0.03), 0 10px 30px rgba(0, 0, 0, 0.06)',
297
+ '--theme-shadow': '0 1px 2px rgba(0, 0, 0, 0.03), 0 10px 30px rgba(0, 0, 0, 0.06)',
298
+ '--shadow-resting-xsmall': '0 1px 1px rgba(0, 0, 0, 0.03)',
299
+ '--shadow-resting-small': '0 1px 2px rgba(0, 0, 0, 0.04)',
300
+ '--shadow-resting-medium': '0 2px 8px rgba(0, 0, 0, 0.05)',
301
+ '--shadow-floating-small': '0 0 0 1px rgba(29, 29, 31, 0.04), 0 4px 14px rgba(0, 0, 0, 0.08)',
302
+ '--shadow-floating-medium': '0 0 0 1px rgba(29, 29, 31, 0.04), 0 8px 24px rgba(0, 0, 0, 0.10)',
303
+ '--shadow-floating-large': '0 0 0 1px rgba(29, 29, 31, 0.04), 0 16px 48px rgba(0, 0, 0, 0.14)',
304
+ '--shadow-floating-xlarge': '0 0 0 1px rgba(29, 29, 31, 0.04), 0 24px 64px rgba(0, 0, 0, 0.18)',
305
+ },
306
+ dark: {
307
+ '--loop-shadow-frame': '0 0 0 1px rgba(255, 255, 255, 0.06), 0 12px 36px rgba(0, 0, 0, 0.45)',
308
+ '--theme-shadow': '0 0 0 1px rgba(255, 255, 255, 0.06), 0 12px 36px rgba(0, 0, 0, 0.45)',
309
+ '--shadow-resting-xsmall': '0 0 0 1px rgba(255, 255, 255, 0.05)',
310
+ '--shadow-resting-small': '0 0 0 1px rgba(255, 255, 255, 0.06), 0 1px 2px rgba(0, 0, 0, 0.3)',
311
+ '--shadow-resting-medium': '0 0 0 1px rgba(255, 255, 255, 0.06), 0 2px 8px rgba(0, 0, 0, 0.35)',
312
+ '--shadow-floating-small': '0 0 0 1px rgba(255, 255, 255, 0.08), 0 4px 14px rgba(0, 0, 0, 0.45)',
313
+ '--shadow-floating-medium': '0 0 0 1px rgba(255, 255, 255, 0.08), 0 8px 24px rgba(0, 0, 0, 0.5)',
314
+ '--shadow-floating-large': '0 0 0 1px rgba(255, 255, 255, 0.08), 0 16px 48px rgba(0, 0, 0, 0.55)',
315
+ '--shadow-floating-xlarge': '0 0 0 1px rgba(255, 255, 255, 0.08), 0 24px 64px rgba(0, 0, 0, 0.6)',
316
+ },
317
+ };
318
+ /**
319
+ * Type (LOOP T-04): one face, two weights, five sizes, one line-height per
320
+ * size — each line a multiple of 4px.
321
+ *
322
+ * | Size | Line | Tokens |
323
+ * |-----------------|---------------|--------------------------------------|
324
+ * | 2rem (32px) | 1.25 (40px) | display, title large |
325
+ * | 1.25rem (20px) | 1.4 (28px) | title medium, subtitle |
326
+ * | 1rem (16px) | 1.5 (24px) | title small, body large |
327
+ * | 0.875rem (14px) | 1.4286 (20px) | body medium — the body of the theme |
328
+ * | 0.75rem (12px) | 1.3333 (16px) | body small, caption |
329
+ *
330
+ * The weights are 400 (body, subtitle) and 600 (titles, display, and what
331
+ * Primer sets in its medium weight — a button's label); Primer's light weight
332
+ * is 400. The titles are set tight and a little closer, as a good display face
333
+ * is; the body left alone. The tracking is a token for a component to apply,
334
+ * since a CSS font shorthand carries none.
335
+ */
336
+ export const loopTypeScale = {
337
+ display: { size: '2rem', lineHeight: '1.25' },
338
+ title: { size: '1.25rem', lineHeight: '1.4' },
339
+ heading: { size: '1rem', lineHeight: '1.5' },
340
+ body: { size: '0.875rem', lineHeight: '1.4286' },
341
+ small: { size: '0.75rem', lineHeight: '1.3333' },
342
+ };
343
+ /** The two weights of the `loop` theme. */
344
+ export const loopFontWeights = { regular: 400, semibold: 600 };
345
+ export const loopTypeVars = (font) => {
346
+ const { display, title, heading, body, small } = loopTypeScale;
347
+ const { regular, semibold } = loopFontWeights;
348
+ const shorthand = (weight, step) => `${weight} ${step.size}/${step.lineHeight} ${font}`;
349
+ return {
350
+ '--base-text-weight-light': String(regular),
351
+ '--base-text-weight-normal': String(regular),
352
+ '--base-text-weight-medium': String(semibold),
353
+ '--base-text-weight-semibold': String(semibold),
354
+ '--text-display-size': display.size,
355
+ '--text-display-lineHeight': display.lineHeight,
356
+ '--text-display-lineBoxHeight': display.lineHeight,
357
+ '--text-display-weight': String(semibold),
358
+ '--text-title-size-large': display.size,
359
+ '--text-title-lineHeight-large': display.lineHeight,
360
+ '--text-title-size-medium': title.size,
361
+ '--text-title-lineHeight-medium': title.lineHeight,
362
+ '--text-subtitle-size': title.size,
363
+ '--text-subtitle-lineHeight': title.lineHeight,
364
+ '--text-title-size-small': heading.size,
365
+ '--text-title-lineHeight-small': heading.lineHeight,
366
+ '--text-body-size-large': heading.size,
367
+ '--text-body-lineHeight-large': heading.lineHeight,
368
+ '--text-body-size-medium': body.size,
369
+ '--text-body-lineHeight-medium': body.lineHeight,
370
+ '--text-body-size-small': small.size,
371
+ '--text-body-lineHeight-small': small.lineHeight,
372
+ '--text-caption-size': small.size,
373
+ '--text-caption-lineHeight': small.lineHeight,
374
+ '--text-display-shorthand': shorthand(semibold, display),
375
+ '--text-title-shorthand-large': shorthand(semibold, display),
376
+ '--text-title-shorthand-medium': shorthand(semibold, title),
377
+ '--text-title-shorthand-small': shorthand(semibold, heading),
378
+ '--text-subtitle-shorthand': shorthand(regular, title),
379
+ '--text-body-shorthand-large': shorthand(regular, heading),
380
+ '--text-body-shorthand-medium': shorthand(regular, body),
381
+ '--text-body-shorthand-small': shorthand(regular, small),
382
+ '--text-caption-shorthand': shorthand(regular, small),
383
+ '--loop-tracking-display': '-0.02em',
384
+ '--loop-tracking-title': '-0.012em',
385
+ '--loop-tracking-body': '0',
386
+ };
387
+ };
388
+ /**
389
+ * The stage, lit: a soft fall from the stage tint at the top to the quiet
390
+ * tint at the bottom, for the page an application sits on. Both tints are
391
+ * the accent's, so an application's own colour lights its stage.
392
+ */
393
+ export const loopStageGradient = 'radial-gradient(140% 100% at 50% 0%, var(--loop-stage) 0%, var(--loop-quiet) 100%)';
394
+ /* ── Exports ─────────────────────────────────────────────────────────── */
395
+ /**
396
+ * Inter, then its metric-matched fallback, then the system's own sans-serif
397
+ * (LOOP T-04). One face, two weights (400 and 600). The face is served by the
398
+ * page's own build: a page wearing the theme imports
399
+ * `@datalayer/primer-addons/style/loop-face.css`, which declares
400
+ * `Inter Variable` from `@fontsource-variable/inter` and `Inter Fallback`, a
401
+ * local Arial drawn to Inter's measure. The text paints in the fallback first
402
+ * and does not move when Inter arrives; a page that has not imported the
403
+ * stylesheet shows the system face.
404
+ */
405
+ export const loopFontFamily = '"Inter Variable", "Inter Fallback", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif';
406
+ /**
407
+ * Motion (LOOP T-10): three durations and one easing, for three things — a
408
+ * status changing, a message arriving, a pane opening. Nothing else moves.
409
+ */
410
+ export const loopMotionVars = {
411
+ '--loop-motion-status': '120ms',
412
+ '--loop-motion-message': '200ms',
413
+ '--loop-motion-pane': '320ms',
414
+ '--loop-motion-easing': 'cubic-bezier(0.2, 0, 0, 1)',
415
+ };
416
+ /**
417
+ * The focus ring (LOOP T-15): 3 to 1 against the page and around a pill of
418
+ * any accent, in both modes. In light mode the deep mint does it — darker than the text, the one place it is —
419
+ * a halo in the theme's colour, as a system's own focus ring is — 6.5 to 1
420
+ * on white and 3.28 or more around every pastel. In dark mode no
421
+ * colour clears 3 to 1 against both the near-black page and the six
422
+ * pastels, the light ink least of all (under 1.8 to 1 on the pastels): a
423
+ * mid grey does, at 3.04 to 1 — and 2.77 to 1 on the subtle dark surface,
424
+ * the one place it falls short.
425
+ */
426
+ export const loopFocusRing = { light: loopColors.loopRing, dark: '#636363' };
427
+ /**
428
+ * The controls, as one family (LOOP T-09): every single-line control is a
429
+ * pill — a button, a text input, a select, a segmented control (outside and
430
+ * each segment), a button group's two ends, a toggle switch, an underline
431
+ * tab's hover. A multi-line text area keeps `--borderRadius-medium`: a pill
432
+ * of many lines is a lozenge. Menus and overlays keep the card's radius,
433
+ * `--borderRadius-large`, which the theme already sets.
434
+ *
435
+ * Primer takes every control's corners from `--borderRadius-medium`, which
436
+ * cards and list items take too, so this cannot be a token: it is a
437
+ * stylesheet, scoped by the theme provider (`ThemeStyles.css`). Primer's
438
+ * class names are CSS-module hashes (`prc-Button-ButtonBase-c50BI`), so the
439
+ * selectors match their stable prefix; the toggle switch is a
440
+ * styled-component, matched by its display name, which styled-components
441
+ * puts in its class (`ToggleSwitch__SwitchButton-sc-e6gszy-0`). A test reads each of them
442
+ * back from the installed `@primer/react`.
443
+ *
444
+ * Where a control draws more than one element from the token — a segmented
445
+ * control's track and segments, a button group's ends — the token itself is
446
+ * set on the control, and Primer's own rules draw the pill.
447
+ */
448
+ export const loopControlsSelectors = {
449
+ button: '[class*="prc-Button-ButtonBase"]',
450
+ textInput: '[class*="prc-components-TextInputBaseWrapper"]',
451
+ textArea: '[class*="prc-Textarea-TextArea"]',
452
+ segmentedControl: '[class*="prc-SegmentedControl-SegmentedControl"]',
453
+ buttonGroup: '[class*="prc-ButtonGroup-ButtonGroup"]',
454
+ underlineTab: '[class*="prc-components-UnderlineItem"]',
455
+ toggleTrack: '[class*="ToggleSwitch__SwitchButton-"]',
456
+ toggleKnob: '[class*="ToggleSwitch__ToggleKnob-"]',
457
+ };
458
+ const sel = loopControlsSelectors;
459
+ export const loopControlsCss = `
460
+ :scope ${sel.button},
461
+ :scope ${sel.textInput}:not(:has(${sel.textArea})),
462
+ :scope ${sel.segmentedControl},
463
+ :scope ${sel.underlineTab},
464
+ :scope ${sel.toggleTrack},
465
+ :scope ${sel.toggleKnob} {
466
+ --borderRadius-medium: var(--loop-radius-control);
467
+ border-radius: var(--loop-radius-control);
468
+ }
469
+ :scope ${sel.buttonGroup} {
470
+ --borderRadius-medium: var(--loop-radius-control);
471
+ }
472
+ :scope b,
473
+ :scope strong {
474
+ font-weight: var(--base-text-weight-semibold);
475
+ }
476
+ `;
477
+ /** Comprehensive Primer CSS-variable overrides for light & dark mode. */
478
+ export const loopThemeStyles = buildThemeStyles(loopLight, loopDark, {
479
+ fontFamily: loopFontFamily,
480
+ css: loopControlsCss,
481
+ // Rounder than the others: a pill for a control, soft cards, round bubbles.
482
+ shape: {
483
+ radiusControl: loopShapeVars['--loop-radius-control'],
484
+ radiusCard: loopShapeVars['--loop-radius-card'],
485
+ radiusBubble: loopShapeVars['--loop-radius-bubble'],
486
+ radiusFrame: loopShapeVars['--loop-radius-frame'],
487
+ shadow: loopShapeVars['--loop-shadow-frame'],
488
+ motionStatus: loopMotionVars['--loop-motion-status'],
489
+ motionMessage: loopMotionVars['--loop-motion-message'],
490
+ motionPane: loopMotionVars['--loop-motion-pane'],
491
+ motionEasing: loopMotionVars['--loop-motion-easing'],
492
+ // Links plain in a message: the words' own colour, underlined (T-06).
493
+ messageLink: 'currentColor',
494
+ },
495
+ variables: {
496
+ light: {
497
+ ...loopShapeVars,
498
+ ...loopAccentVars('green', 'light'),
499
+ ...loopMotionVars,
500
+ ...loopShadows.light,
501
+ ...loopTypeVars(loopFontFamily),
502
+ '--loop-stage-gradient': loopStageGradient,
503
+ '--loop-hairline': loopHairline.light,
504
+ '--focus-outlineColor': loopFocusRing.light,
505
+ // The selected tab underlined in the accent, not Primer's coral (LOOP T-14).
506
+ '--underlineNav-borderColor-active': loopAccents.green.accent,
507
+ },
508
+ dark: {
509
+ ...loopShapeVars,
510
+ ...loopAccentVars('green', 'dark'),
511
+ ...loopMotionVars,
512
+ ...loopShadows.dark,
513
+ ...loopTypeVars(loopFontFamily),
514
+ '--loop-stage-gradient': loopStageGradient,
515
+ '--loop-hairline': loopHairline.dark,
516
+ '--focus-outlineColor': loopFocusRing.dark,
517
+ // The selected tab underlined in the accent, not Primer's coral (LOOP T-14).
518
+ '--underlineNav-borderColor-active': loopAccents.green.accent,
519
+ },
520
+ },
521
+ });
@@ -1,10 +1,5 @@
1
- /**
2
- * The Primer theme object.
3
- *
4
- * Since theming is now done entirely via CSS custom properties
5
- * (see `lovelyThemeStyles`), this is just the unmodified
6
- * default Primer theme kept for backward compatibility.
7
- */
1
+ export * from './lovelyThemeStyles';
2
+ /** The Primer theme object: Primer's default. */
8
3
  export declare const lovelyTheme: {
9
4
  animation: {
10
5
  easeOutCubic: string;
@@ -1086,6 +1081,4 @@ export declare const lovelyTheme: {
1086
1081
  }>;
1087
1082
  }>;
1088
1083
  };
1089
- /** Comprehensive Primer CSS-variable overrides for light & dark mode. */
1090
- export declare const lovelyThemeStyles: import("../css/createThemeCSSVars").ThemeStyles;
1091
1084
  export default lovelyTheme;