@datalayer/primer-addons 1.0.35 → 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.
- package/README.md +20 -2
- package/lib/components/appearance/AppearanceControls.js +5 -0
- package/lib/reactor/index.d.ts +1 -1
- package/lib/reactor/index.js +1 -1
- package/lib/reactor/page-layout/PageLayout.d.ts +6 -0
- package/lib/reactor/page-layout/PageLayout.js +26 -0
- package/lib/theme/DatalayerThemeProvider.js +5 -2
- package/lib/theme/colors/loopColors.js +2 -0
- package/lib/theme/css/createThemeCSSVars.d.ts +5 -0
- package/lib/theme/css/createThemeCSSVars.js +2 -0
- package/lib/theme/index.d.ts +1 -0
- package/lib/theme/index.js +1 -0
- package/lib/theme/loopEyes.d.ts +84 -0
- package/lib/theme/loopEyes.js +82 -0
- package/lib/theme/portable.d.ts +16 -0
- package/lib/theme/portable.js +20 -0
- package/lib/theme/portableTheme.d.ts +1 -1
- package/lib/theme/portableTheme.js +2 -2
- package/lib/theme/themeRegistry.d.ts +3 -75
- package/lib/theme/themeRegistry.js +38 -509
- package/lib/theme/themeTokens.d.ts +101 -0
- package/lib/theme/themeTokens.js +494 -0
- package/lib/theme/themes/datalayerTheme.d.ts +2 -9
- package/lib/theme/themes/datalayerTheme.js +8 -236
- package/lib/theme/themes/datalayerThemeStyles.d.ts +2 -0
- package/lib/theme/themes/datalayerThemeStyles.js +234 -0
- package/lib/theme/themes/earthTheme.d.ts +2 -9
- package/lib/theme/themes/earthTheme.js +8 -235
- package/lib/theme/themes/earthThemeStyles.d.ts +2 -0
- package/lib/theme/themes/earthThemeStyles.js +233 -0
- package/lib/theme/themes/ivoryTheme.d.ts +2 -9
- package/lib/theme/themes/ivoryTheme.js +8 -249
- package/lib/theme/themes/ivoryThemeStyles.d.ts +2 -0
- package/lib/theme/themes/ivoryThemeStyles.js +247 -0
- package/lib/theme/themes/loopTheme.d.ts +13 -144
- package/lib/theme/themes/loopTheme.js +20 -513
- package/lib/theme/themes/loopThemeStyles.d.ts +135 -0
- package/lib/theme/themes/loopThemeStyles.js +521 -0
- package/lib/theme/themes/lovelyTheme.d.ts +2 -9
- package/lib/theme/themes/lovelyTheme.js +8 -231
- package/lib/theme/themes/lovelyThemeStyles.d.ts +2 -0
- package/lib/theme/themes/lovelyThemeStyles.js +229 -0
- package/lib/theme/themes/matrixTheme.d.ts +2 -9
- package/lib/theme/themes/matrixTheme.js +8 -237
- package/lib/theme/themes/matrixThemeStyles.d.ts +2 -0
- package/lib/theme/themes/matrixThemeStyles.js +235 -0
- package/lib/theme/themes/sandTheme.d.ts +2 -9
- package/lib/theme/themes/sandTheme.js +8 -248
- package/lib/theme/themes/sandThemeStyles.d.ts +2 -0
- package/lib/theme/themes/sandThemeStyles.js +246 -0
- package/lib/theme/themes/spatialTheme.d.ts +2 -9
- package/lib/theme/themes/spatialTheme.js +8 -231
- package/lib/theme/themes/spatialThemeStyles.d.ts +2 -0
- package/lib/theme/themes/spatialThemeStyles.js +229 -0
- package/lib/theme/themes/sunTheme.d.ts +2 -9
- package/lib/theme/themes/sunTheme.js +8 -249
- package/lib/theme/themes/sunThemeStyles.d.ts +2 -0
- package/lib/theme/themes/sunThemeStyles.js +247 -0
- package/lib/utils/Portals.d.ts +7 -0
- package/lib/utils/Portals.js +7 -0
- package/package.json +1 -1
|
@@ -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
|
-
|
|
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;
|