@datalayer/primer-addons 1.0.36 → 1.0.39

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