@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.
- package/README.md +69 -19
- package/lib/components/appearance/AppearanceControls.d.ts +6 -1
- package/lib/components/appearance/AppearanceControls.js +12 -3
- package/lib/components/appearance/AppearanceControlsWithStore.d.ts +4 -0
- package/lib/components/appearance/AppearanceControlsWithStore.js +4 -4
- package/lib/components/appearance/CollaboratorPalette.js +7 -20
- package/lib/components/box/Box.d.ts +103 -16
- package/lib/components/box/Box.js +157 -2
- package/lib/components/box/boxCss.d.ts +805 -0
- package/lib/components/box/boxCss.js +492 -0
- package/lib/components/box/boxTokens.d.ts +129 -0
- package/lib/components/box/boxTokens.js +124 -0
- package/lib/components/calendar-picker/CalendarPicker.js +2 -1
- package/lib/components/card/Card.js +19 -10
- package/lib/components/color/ColorSwatch.js +2 -1
- package/lib/components/color-picker/ColorPicker.js +8 -4
- package/lib/components/date-picker/DatePicker.d.ts +12 -3
- package/lib/components/date-picker/DatePicker.js +24 -8
- package/lib/components/index.d.ts +1 -0
- package/lib/components/index.js +1 -0
- package/lib/components/sheet/Sheet.d.ts +15 -0
- package/lib/components/sheet/Sheet.js +21 -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 +30 -6
- package/lib/story-helpers.d.ts +2 -2
- package/lib/theme/DatalayerThemeProvider.d.ts +21 -0
- package/lib/theme/DatalayerThemeProvider.js +13 -4
- package/lib/theme/colors/index.d.ts +2 -1
- package/lib/theme/colors/index.js +2 -1
- package/lib/theme/colors/loopColors.d.ts +2 -48
- package/lib/theme/colors/loopColors.js +2 -98
- package/lib/theme/colors/themeAccents.d.ts +81 -0
- package/lib/theme/colors/themeAccents.js +139 -0
- package/lib/theme/css/createThemeCSSVars.d.ts +5 -0
- package/lib/theme/css/createThemeCSSVars.js +5 -0
- package/lib/theme/css/primerBaseVars.d.ts +1 -0
- package/lib/theme/css/primerBaseVars.js +72 -0
- package/lib/theme/index.d.ts +2 -0
- package/lib/theme/index.js +2 -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 -517
- package/lib/theme/themes/loopThemeStyles.d.ts +129 -0
- package/lib/theme/themes/loopThemeStyles.js +531 -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
|
@@ -8,10 +8,8 @@
|
|
|
8
8
|
*
|
|
9
9
|
* The accent of the theme itself is mint ā a soft green, lighter than
|
|
10
10
|
* the platform's (decided 2026-10-03, after a day on sky). An
|
|
11
|
-
* application may take one of five others
|
|
12
|
-
*
|
|
13
|
-
* on it, the tint of the stage behind an application, and a quiet tint.
|
|
14
|
-
* Dark text on every accent: the lowest contrast of the six is 8.8 to 1.
|
|
11
|
+
* application may take one of five others: the accents are the theme
|
|
12
|
+
* system's, over every theme (`themeAccents`, decided 2026-10-07).
|
|
15
13
|
*/
|
|
16
14
|
export declare const loopColors: {
|
|
17
15
|
black: string;
|
|
@@ -64,47 +62,3 @@ export declare const loopColors: {
|
|
|
64
62
|
brightLightFlame: string;
|
|
65
63
|
brightLightGold: string;
|
|
66
64
|
};
|
|
67
|
-
/** The accents an application may take, by name. */
|
|
68
|
-
export type LoopAccentName = 'green' | 'rose' | 'sky' | 'lime' | 'sun' | 'violet';
|
|
69
|
-
/** An accent: four values, in light and in dark. */
|
|
70
|
-
export interface LoopAccent {
|
|
71
|
-
/** The accent itself: a bubble, a send button. The same in both modes. */
|
|
72
|
-
accent: string;
|
|
73
|
-
/** The text that sits on the accent. */
|
|
74
|
-
on: string;
|
|
75
|
-
/** The stage behind an application. */
|
|
76
|
-
stage: {
|
|
77
|
-
light: string;
|
|
78
|
-
dark: string;
|
|
79
|
-
};
|
|
80
|
-
/** A quiet tint: a draft, something waiting. */
|
|
81
|
-
quiet: {
|
|
82
|
-
light: string;
|
|
83
|
-
dark: string;
|
|
84
|
-
};
|
|
85
|
-
/**
|
|
86
|
-
* The accent as text: a link, a starter, an accent's word ā deep enough on
|
|
87
|
-
* white (4.5 to 1), and the pastel itself on dark.
|
|
88
|
-
*/
|
|
89
|
-
text: {
|
|
90
|
-
light: string;
|
|
91
|
-
dark: string;
|
|
92
|
-
};
|
|
93
|
-
}
|
|
94
|
-
/** The six accents. One per application; everything else is neutral. Green ā mint ā is the theme's own. */
|
|
95
|
-
export declare const loopAccents: Record<LoopAccentName, LoopAccent>;
|
|
96
|
-
/** The names of the accents, in the order a picker shows them. */
|
|
97
|
-
export declare const loopAccentNames: LoopAccentName[];
|
|
98
|
-
/**
|
|
99
|
-
* An accent as CSS custom properties, for a color mode: what an
|
|
100
|
-
* application sets on its root to take its colour.
|
|
101
|
-
*/
|
|
102
|
-
export declare function loopAccentVars(name: LoopAccentName, mode?: 'light' | 'dark'): Record<string, string>;
|
|
103
|
-
/**
|
|
104
|
-
* An application's accent as everything it colours (LOOP T-05): the four
|
|
105
|
-
* `--loop-*` properties of `loopAccentVars`, and Primer's accent fill and
|
|
106
|
-
* filled button ā the person's bubble, the assistant's avatar, the one
|
|
107
|
-
* button to press ā in the accent with the text that sits on it. Set on an
|
|
108
|
-
* application's root, it wears its own colour; the page around keeps mint.
|
|
109
|
-
*/
|
|
110
|
-
export declare function loopAccentStyles(name: LoopAccentName, mode?: 'light' | 'dark'): Record<string, string>;
|
|
@@ -12,10 +12,8 @@
|
|
|
12
12
|
*
|
|
13
13
|
* The accent of the theme itself is mint ā a soft green, lighter than
|
|
14
14
|
* the platform's (decided 2026-10-03, after a day on sky). An
|
|
15
|
-
* application may take one of five others
|
|
16
|
-
*
|
|
17
|
-
* on it, the tint of the stage behind an application, and a quiet tint.
|
|
18
|
-
* Dark text on every accent: the lowest contrast of the six is 8.8 to 1.
|
|
15
|
+
* application may take one of five others: the accents are the theme
|
|
16
|
+
* system's, over every theme (`themeAccents`, decided 2026-10-07).
|
|
19
17
|
*/
|
|
20
18
|
export const loopColors = {
|
|
21
19
|
// Core neutrals
|
|
@@ -76,97 +74,3 @@ export const loopColors = {
|
|
|
76
74
|
brightLightFlame: '#B4571A', // Deep orange
|
|
77
75
|
brightLightGold: '#8A6A00', // Deep sun
|
|
78
76
|
};
|
|
79
|
-
/** The six accents. One per application; everything else is neutral. Green ā mint ā is the theme's own. */
|
|
80
|
-
export const loopAccents = {
|
|
81
|
-
green: {
|
|
82
|
-
accent: '#7ADBB8',
|
|
83
|
-
on: '#06281E',
|
|
84
|
-
stage: { light: '#DDF5EC', dark: '#10261F' },
|
|
85
|
-
quiet: { light: '#F0FAF6', dark: '#17211D' },
|
|
86
|
-
text: { light: '#248462', dark: '#8FE5C6' },
|
|
87
|
-
},
|
|
88
|
-
rose: {
|
|
89
|
-
accent: '#F6A5C1',
|
|
90
|
-
on: '#3A0A1C',
|
|
91
|
-
stage: { light: '#FCE3EC', dark: '#2B141C' },
|
|
92
|
-
quiet: { light: '#FDF2F6', dark: '#22181C' },
|
|
93
|
-
text: { light: '#B83A6B', dark: '#F6A5C1' },
|
|
94
|
-
},
|
|
95
|
-
sky: {
|
|
96
|
-
accent: '#8CCBF9',
|
|
97
|
-
on: '#06243B',
|
|
98
|
-
stage: { light: '#DFF0FD', dark: '#0F2333' },
|
|
99
|
-
quiet: { light: '#F0F8FE', dark: '#161E25' },
|
|
100
|
-
text: { light: '#1F6FB0', dark: '#8CCBF9' },
|
|
101
|
-
},
|
|
102
|
-
lime: {
|
|
103
|
-
accent: '#BEDC55',
|
|
104
|
-
on: '#1F2A00',
|
|
105
|
-
stage: { light: '#EEF6CC', dark: '#1E2609' },
|
|
106
|
-
quiet: { light: '#F7FBE6', dark: '#1C2014' },
|
|
107
|
-
text: { light: '#5F7A00', dark: '#BEDC55' },
|
|
108
|
-
},
|
|
109
|
-
sun: {
|
|
110
|
-
accent: '#F8D469',
|
|
111
|
-
on: '#2E2200',
|
|
112
|
-
stage: { light: '#FDF3CD', dark: '#2A2209' },
|
|
113
|
-
quiet: { light: '#FEF9E7', dark: '#221F14' },
|
|
114
|
-
text: { light: '#8A6A00', dark: '#F8D469' },
|
|
115
|
-
},
|
|
116
|
-
violet: {
|
|
117
|
-
accent: '#C0AEF6',
|
|
118
|
-
on: '#1C0F47',
|
|
119
|
-
stage: { light: '#ECE7FD', dark: '#1B1533' },
|
|
120
|
-
quiet: { light: '#F6F3FE', dark: '#1C1A27' },
|
|
121
|
-
text: { light: '#6B53C9', dark: '#C0AEF6' },
|
|
122
|
-
},
|
|
123
|
-
};
|
|
124
|
-
/** The names of the accents, in the order a picker shows them. */
|
|
125
|
-
export const loopAccentNames = ['green', 'rose', 'sky', 'lime', 'sun', 'violet'];
|
|
126
|
-
/**
|
|
127
|
-
* An accent as CSS custom properties, for a color mode: what an
|
|
128
|
-
* application sets on its root to take its colour.
|
|
129
|
-
*/
|
|
130
|
-
export function loopAccentVars(name, mode = 'light') {
|
|
131
|
-
const accent = loopAccents[name] ?? loopAccents.green;
|
|
132
|
-
return {
|
|
133
|
-
'--loop-accent': accent.accent,
|
|
134
|
-
'--loop-accent-on': accent.on,
|
|
135
|
-
'--loop-stage': accent.stage[mode],
|
|
136
|
-
'--loop-quiet': accent.quiet[mode],
|
|
137
|
-
};
|
|
138
|
-
}
|
|
139
|
-
/**
|
|
140
|
-
* An application's accent as everything it colours (LOOP T-05): the four
|
|
141
|
-
* `--loop-*` properties of `loopAccentVars`, and Primer's accent fill and
|
|
142
|
-
* filled button ā the person's bubble, the assistant's avatar, the one
|
|
143
|
-
* button to press ā in the accent with the text that sits on it. Set on an
|
|
144
|
-
* application's root, it wears its own colour; the page around keeps mint.
|
|
145
|
-
*/
|
|
146
|
-
export function loopAccentStyles(name, mode = 'light') {
|
|
147
|
-
const accent = loopAccents[name];
|
|
148
|
-
if (!accent) {
|
|
149
|
-
throw new Error(`There is no accent "${name}"; the accents are ${loopAccentNames.join(', ')}.`);
|
|
150
|
-
}
|
|
151
|
-
return {
|
|
152
|
-
...loopAccentVars(name, mode),
|
|
153
|
-
'--bgColor-accent-emphasis': accent.accent,
|
|
154
|
-
'--borderColor-accent-emphasis': accent.accent,
|
|
155
|
-
// Its text, its muted border and tint: so that nothing on the page keeps
|
|
156
|
-
// the theme's default accent beside the application's own (T-18).
|
|
157
|
-
'--fgColor-accent': accent.text[mode],
|
|
158
|
-
'--fgColor-link': accent.text[mode],
|
|
159
|
-
'--borderColor-accent-muted': accent.accent,
|
|
160
|
-
'--bgColor-accent-muted': accent.quiet[mode],
|
|
161
|
-
// The selected tab: underlined in the accent (T-14).
|
|
162
|
-
'--underlineNav-borderColor-active': accent.accent,
|
|
163
|
-
'--button-primary-bgColor-rest': accent.accent,
|
|
164
|
-
'--button-primary-borderColor-rest': accent.accent,
|
|
165
|
-
'--button-primary-bgColor-hover': accent.accent,
|
|
166
|
-
'--button-primary-borderColor-hover': accent.accent,
|
|
167
|
-
'--button-primary-bgColor-active': accent.accent,
|
|
168
|
-
'--button-primary-borderColor-active': accent.accent,
|
|
169
|
-
'--button-primary-fgColor-rest': accent.on,
|
|
170
|
-
'--button-primary-iconColor-rest': accent.on,
|
|
171
|
-
};
|
|
172
|
-
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Theme accents ā the colour an application names, over any theme.
|
|
3
|
+
*
|
|
4
|
+
* Six soft accents, each with the dark text that sits on it (the lowest
|
|
5
|
+
* contrast of the six is 8.8 to 1), the tint of the stage behind an
|
|
6
|
+
* application, a quiet tint, and the accent as text. They were drawn for
|
|
7
|
+
* the `loop` theme ā green, mint, is `loop`'s own ā and, since 2026-10-07
|
|
8
|
+
* (decided by the user), they colour every theme: `themeAccentVars` sets
|
|
9
|
+
* Primer's own accent and primary properties, so the filled button, links,
|
|
10
|
+
* the accent tokens and a selected tab take the accent whatever theme an
|
|
11
|
+
* application wears.
|
|
12
|
+
*/
|
|
13
|
+
import type { ThemeColorDefs } from '../css/createThemeCSSVars';
|
|
14
|
+
/** The accents an application may take, by name. */
|
|
15
|
+
export type ThemeAccentName = 'green' | 'rose' | 'sky' | 'lime' | 'sun' | 'violet';
|
|
16
|
+
/** An accent: its values, in light and in dark. */
|
|
17
|
+
export interface ThemeAccent {
|
|
18
|
+
/** The accent itself: a bubble, a send button. The same in both modes. */
|
|
19
|
+
accent: string;
|
|
20
|
+
/** The text that sits on the accent. */
|
|
21
|
+
on: string;
|
|
22
|
+
/** The stage behind an application. */
|
|
23
|
+
stage: {
|
|
24
|
+
light: string;
|
|
25
|
+
dark: string;
|
|
26
|
+
};
|
|
27
|
+
/** A quiet tint: a draft, something waiting. */
|
|
28
|
+
quiet: {
|
|
29
|
+
light: string;
|
|
30
|
+
dark: string;
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* The accent as text: a link, a starter, an accent's word ā deep enough on
|
|
34
|
+
* white (4.5 to 1), and the pastel itself on dark.
|
|
35
|
+
*/
|
|
36
|
+
text: {
|
|
37
|
+
light: string;
|
|
38
|
+
dark: string;
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
/** The six accents. One per application; everything else is the theme's. Green ā mint ā is `loop`'s own. */
|
|
42
|
+
export declare const themeAccents: Record<ThemeAccentName, ThemeAccent>;
|
|
43
|
+
/** The names of the accents, in the order a picker shows them. */
|
|
44
|
+
export declare const themeAccentNames: ThemeAccentName[];
|
|
45
|
+
/**
|
|
46
|
+
* The stage, lit: a soft fall from the stage tint at the top to the quiet
|
|
47
|
+
* tint at the bottom, for the page an application sits on. Written with the
|
|
48
|
+
* colours themselves, not with `var(--theme-stage)`: a custom property is
|
|
49
|
+
* resolved where it is set, so a gradient inherited from the theme's root
|
|
50
|
+
* would keep the theme's tints under an application's own.
|
|
51
|
+
*/
|
|
52
|
+
export declare function themeStageGradient(stage: string, quiet: string): string;
|
|
53
|
+
/**
|
|
54
|
+
* The accent's own custom properties, which every theme sets (its default
|
|
55
|
+
* from its colours, `themeTintVars`) and an application's accent replaces:
|
|
56
|
+
* the accent, the text on it, the stage, the quiet tint and the stage lit.
|
|
57
|
+
*/
|
|
58
|
+
export declare function themeAccentTints(accent: Pick<ThemeAccent, 'accent' | 'on'> & {
|
|
59
|
+
stage: string;
|
|
60
|
+
quiet: string;
|
|
61
|
+
}): Record<string, string>;
|
|
62
|
+
/**
|
|
63
|
+
* A theme's default accent properties, from its own colours: its accent
|
|
64
|
+
* fill and the text of its filled button, the accent's subtle tint as the
|
|
65
|
+
* stage, the subtle canvas as the quiet tint.
|
|
66
|
+
*/
|
|
67
|
+
export declare function themeTintVars(defs: ThemeColorDefs): Record<string, string>;
|
|
68
|
+
/**
|
|
69
|
+
* An application's accent as everything it colours, over any theme (LOOP
|
|
70
|
+
* T-05, T-30): the accent's own properties (`--theme-accent`,
|
|
71
|
+
* `--theme-accent-on`, `--theme-stage`, `--theme-quiet`,
|
|
72
|
+
* `--theme-stage-gradient`), and Primer's ā the accent fill, text, links,
|
|
73
|
+
* muted border and tint, the filled button, a checked switch, a selected
|
|
74
|
+
* tab ā so that nothing on its page keeps the theme's default accent beside
|
|
75
|
+
* its own (T-18). The theme's focus ring is kept: it is drawn to show around
|
|
76
|
+
* every accent (T-15). Set on an application's root, it wears its own
|
|
77
|
+
* colour; the page around keeps the theme's.
|
|
78
|
+
*
|
|
79
|
+
* An unknown name is refused.
|
|
80
|
+
*/
|
|
81
|
+
export declare function themeAccentVars(name: ThemeAccentName, mode?: 'light' | 'dark'): Record<string, string>;
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2023-2026 Datalayer, Inc.
|
|
3
|
+
* Distributed under the terms of the Modified BSD License.
|
|
4
|
+
*/
|
|
5
|
+
/** The six accents. One per application; everything else is the theme's. Green ā mint ā is `loop`'s own. */
|
|
6
|
+
export const themeAccents = {
|
|
7
|
+
green: {
|
|
8
|
+
accent: '#7ADBB8',
|
|
9
|
+
on: '#06281E',
|
|
10
|
+
stage: { light: '#DDF5EC', dark: '#10261F' },
|
|
11
|
+
quiet: { light: '#F0FAF6', dark: '#17211D' },
|
|
12
|
+
text: { light: '#248462', dark: '#8FE5C6' },
|
|
13
|
+
},
|
|
14
|
+
rose: {
|
|
15
|
+
accent: '#F6A5C1',
|
|
16
|
+
on: '#3A0A1C',
|
|
17
|
+
stage: { light: '#FCE3EC', dark: '#2B141C' },
|
|
18
|
+
quiet: { light: '#FDF2F6', dark: '#22181C' },
|
|
19
|
+
text: { light: '#B83A6B', dark: '#F6A5C1' },
|
|
20
|
+
},
|
|
21
|
+
sky: {
|
|
22
|
+
accent: '#8CCBF9',
|
|
23
|
+
on: '#06243B',
|
|
24
|
+
stage: { light: '#DFF0FD', dark: '#0F2333' },
|
|
25
|
+
quiet: { light: '#F0F8FE', dark: '#161E25' },
|
|
26
|
+
text: { light: '#1F6FB0', dark: '#8CCBF9' },
|
|
27
|
+
},
|
|
28
|
+
lime: {
|
|
29
|
+
accent: '#BEDC55',
|
|
30
|
+
on: '#1F2A00',
|
|
31
|
+
stage: { light: '#EEF6CC', dark: '#1E2609' },
|
|
32
|
+
quiet: { light: '#F7FBE6', dark: '#1C2014' },
|
|
33
|
+
text: { light: '#5F7A00', dark: '#BEDC55' },
|
|
34
|
+
},
|
|
35
|
+
sun: {
|
|
36
|
+
accent: '#F8D469',
|
|
37
|
+
on: '#2E2200',
|
|
38
|
+
stage: { light: '#FDF3CD', dark: '#2A2209' },
|
|
39
|
+
quiet: { light: '#FEF9E7', dark: '#221F14' },
|
|
40
|
+
text: { light: '#8A6A00', dark: '#F8D469' },
|
|
41
|
+
},
|
|
42
|
+
violet: {
|
|
43
|
+
accent: '#C0AEF6',
|
|
44
|
+
on: '#1C0F47',
|
|
45
|
+
stage: { light: '#ECE7FD', dark: '#1B1533' },
|
|
46
|
+
quiet: { light: '#F6F3FE', dark: '#1C1A27' },
|
|
47
|
+
text: { light: '#6B53C9', dark: '#C0AEF6' },
|
|
48
|
+
},
|
|
49
|
+
};
|
|
50
|
+
/** The names of the accents, in the order a picker shows them. */
|
|
51
|
+
export const themeAccentNames = ['green', 'rose', 'sky', 'lime', 'sun', 'violet'];
|
|
52
|
+
/**
|
|
53
|
+
* The stage, lit: a soft fall from the stage tint at the top to the quiet
|
|
54
|
+
* tint at the bottom, for the page an application sits on. Written with the
|
|
55
|
+
* colours themselves, not with `var(--theme-stage)`: a custom property is
|
|
56
|
+
* resolved where it is set, so a gradient inherited from the theme's root
|
|
57
|
+
* would keep the theme's tints under an application's own.
|
|
58
|
+
*/
|
|
59
|
+
export function themeStageGradient(stage, quiet) {
|
|
60
|
+
return `radial-gradient(140% 100% at 50% 0%, ${stage} 0%, ${quiet} 100%)`;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* The accent's own custom properties, which every theme sets (its default
|
|
64
|
+
* from its colours, `themeTintVars`) and an application's accent replaces:
|
|
65
|
+
* the accent, the text on it, the stage, the quiet tint and the stage lit.
|
|
66
|
+
*/
|
|
67
|
+
export function themeAccentTints(accent) {
|
|
68
|
+
return {
|
|
69
|
+
'--theme-accent': accent.accent,
|
|
70
|
+
'--theme-accent-on': accent.on,
|
|
71
|
+
'--theme-stage': accent.stage,
|
|
72
|
+
'--theme-quiet': accent.quiet,
|
|
73
|
+
'--theme-stage-gradient': themeStageGradient(accent.stage, accent.quiet),
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* A theme's default accent properties, from its own colours: its accent
|
|
78
|
+
* fill and the text of its filled button, the accent's subtle tint as the
|
|
79
|
+
* stage, the subtle canvas as the quiet tint.
|
|
80
|
+
*/
|
|
81
|
+
export function themeTintVars(defs) {
|
|
82
|
+
return themeAccentTints({
|
|
83
|
+
accent: defs.accent.emphasis,
|
|
84
|
+
on: defs.btn.primary.text,
|
|
85
|
+
stage: defs.accent.subtle ?? defs.canvas.subtle ?? defs.canvas.default,
|
|
86
|
+
quiet: defs.canvas.subtle ?? defs.canvas.default,
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* An application's accent as everything it colours, over any theme (LOOP
|
|
91
|
+
* T-05, T-30): the accent's own properties (`--theme-accent`,
|
|
92
|
+
* `--theme-accent-on`, `--theme-stage`, `--theme-quiet`,
|
|
93
|
+
* `--theme-stage-gradient`), and Primer's ā the accent fill, text, links,
|
|
94
|
+
* muted border and tint, the filled button, a checked switch, a selected
|
|
95
|
+
* tab ā so that nothing on its page keeps the theme's default accent beside
|
|
96
|
+
* its own (T-18). The theme's focus ring is kept: it is drawn to show around
|
|
97
|
+
* every accent (T-15). Set on an application's root, it wears its own
|
|
98
|
+
* colour; the page around keeps the theme's.
|
|
99
|
+
*
|
|
100
|
+
* An unknown name is refused.
|
|
101
|
+
*/
|
|
102
|
+
export function themeAccentVars(name, mode = 'light') {
|
|
103
|
+
const accent = themeAccents[name];
|
|
104
|
+
if (!accent) {
|
|
105
|
+
throw new Error(`There is no accent "${name}"; the accents are ${themeAccentNames.join(', ')}.`);
|
|
106
|
+
}
|
|
107
|
+
return {
|
|
108
|
+
...themeAccentTints({
|
|
109
|
+
accent: accent.accent,
|
|
110
|
+
on: accent.on,
|
|
111
|
+
stage: accent.stage[mode],
|
|
112
|
+
quiet: accent.quiet[mode],
|
|
113
|
+
}),
|
|
114
|
+
'--bgColor-accent-emphasis': accent.accent,
|
|
115
|
+
'--borderColor-accent-emphasis': accent.accent,
|
|
116
|
+
'--fgColor-accent': accent.text[mode],
|
|
117
|
+
'--fgColor-link': accent.text[mode],
|
|
118
|
+
'--borderColor-accent-muted': accent.accent,
|
|
119
|
+
'--bgColor-accent-muted': accent.quiet[mode],
|
|
120
|
+
'--underlineNav-borderColor-active': accent.accent,
|
|
121
|
+
'--button-primary-bgColor-rest': accent.accent,
|
|
122
|
+
'--button-primary-borderColor-rest': accent.accent,
|
|
123
|
+
'--button-primary-bgColor-hover': accent.accent,
|
|
124
|
+
'--button-primary-borderColor-hover': accent.accent,
|
|
125
|
+
'--button-primary-bgColor-active': accent.accent,
|
|
126
|
+
'--button-primary-borderColor-active': accent.accent,
|
|
127
|
+
'--button-primary-fgColor-rest': accent.on,
|
|
128
|
+
'--button-primary-iconColor-rest': accent.on,
|
|
129
|
+
'--buttonCounter-primary-fgColor-rest': accent.on,
|
|
130
|
+
'--color-btn-primary-bg': accent.accent,
|
|
131
|
+
'--color-btn-primary-hover-bg': accent.accent,
|
|
132
|
+
'--control-checked-bgColor-rest': accent.accent,
|
|
133
|
+
'--control-checked-bgColor-hover': accent.accent,
|
|
134
|
+
'--control-checked-bgColor-active': accent.accent,
|
|
135
|
+
'--control-checked-fgColor-rest': accent.on,
|
|
136
|
+
'--controlKnob-borderColor-checked': accent.accent,
|
|
137
|
+
'--datalayer-icon-fg': accent.text[mode],
|
|
138
|
+
};
|
|
139
|
+
}
|
|
@@ -191,6 +191,10 @@ export interface ThemeStyles {
|
|
|
191
191
|
* And its motion (LOOP T-10): three durations ā a status changing, a message
|
|
192
192
|
* arriving, a pane opening ā and one easing. Today's is no motion at all, so
|
|
193
193
|
* a component that moves by them moves only in a theme that says so.
|
|
194
|
+
*
|
|
195
|
+
* And how a link reads in a message (LOOP T-06): in the accent, as today, or
|
|
196
|
+
* ā `currentColor` ā plain, the colour of the words around it, underlined in
|
|
197
|
+
* every theme.
|
|
194
198
|
*/
|
|
195
199
|
export interface ThemeShape {
|
|
196
200
|
radiusControl: string;
|
|
@@ -203,6 +207,7 @@ export interface ThemeShape {
|
|
|
203
207
|
motionMessage: string;
|
|
204
208
|
motionPane: string;
|
|
205
209
|
motionEasing: string;
|
|
210
|
+
messageLink: string;
|
|
206
211
|
}
|
|
207
212
|
/** Today's shape, which every theme has unless it says otherwise. */
|
|
208
213
|
export declare const DEFAULT_THEME_SHAPE: ThemeShape;
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* Copyright (c) 2023-2025 Datalayer, Inc.
|
|
3
3
|
* Distributed under the terms of the Modified BSD License.
|
|
4
4
|
*/
|
|
5
|
+
import { themeTintVars } from '../colors/themeAccents';
|
|
5
6
|
/* āāā Helper āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā */
|
|
6
7
|
/**
|
|
7
8
|
* Convert a structured `ThemeColorDefs` object into a flat
|
|
@@ -258,6 +259,7 @@ export const DEFAULT_THEME_SHAPE = {
|
|
|
258
259
|
motionMessage: '0ms',
|
|
259
260
|
motionPane: '0ms',
|
|
260
261
|
motionEasing: 'ease',
|
|
262
|
+
messageLink: 'var(--fgColor-accent, #0969da)',
|
|
261
263
|
};
|
|
262
264
|
/** A shape as custom properties. */
|
|
263
265
|
export function shapeVars(shape = {}) {
|
|
@@ -273,6 +275,7 @@ export function shapeVars(shape = {}) {
|
|
|
273
275
|
'--theme-motion-message': full.motionMessage,
|
|
274
276
|
'--theme-motion-pane': full.motionPane,
|
|
275
277
|
'--theme-motion-easing': full.motionEasing,
|
|
278
|
+
'--theme-message-link': full.messageLink,
|
|
276
279
|
};
|
|
277
280
|
}
|
|
278
281
|
export function buildThemeStyles(light, dark, options) {
|
|
@@ -308,6 +311,7 @@ export function buildThemeStyles(light, dark, options) {
|
|
|
308
311
|
...colorDefsToCSS(light, 'light'),
|
|
309
312
|
...fontVars,
|
|
310
313
|
...shapeVars(options?.shape),
|
|
314
|
+
...themeTintVars(light),
|
|
311
315
|
...(options?.variables?.light ?? {}),
|
|
312
316
|
},
|
|
313
317
|
dark: {
|
|
@@ -318,6 +322,7 @@ export function buildThemeStyles(light, dark, options) {
|
|
|
318
322
|
...colorDefsToCSS(dark, 'dark'),
|
|
319
323
|
...fontVars,
|
|
320
324
|
...shapeVars(options?.shape),
|
|
325
|
+
...themeTintVars(dark),
|
|
321
326
|
...(options?.variables?.dark ?? {}),
|
|
322
327
|
},
|
|
323
328
|
...(options?.css ? { css: options.css } : {}),
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const primerBaseVars: Record<'light' | 'dark', Record<string, string>>;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2023-2026 Datalayer, Inc.
|
|
3
|
+
* Distributed under the terms of the Modified BSD License.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Primer's own CSS variables that no theme sets but that a page still reads
|
|
7
|
+
* ā the radii, the neutral and sponsor colours, the open and closed states,
|
|
8
|
+
* the four elevation shadows ā at Primer's own values (`@primer/primitives`,
|
|
9
|
+
* functional themes light and dark).
|
|
10
|
+
*
|
|
11
|
+
* The apps do not load the primitives' stylesheets, so Primer components
|
|
12
|
+
* draw these through the fallbacks written in their own CSS. `Box` emits
|
|
13
|
+
* the variable alone, with no fallback (see `components/box/Box.tsx`), so
|
|
14
|
+
* the theme provider sets every variable `Box` can emit: these, under the
|
|
15
|
+
* theme's own (`themeStyles`), which win where a theme says otherwise ā the
|
|
16
|
+
* `loop` theme's radii and shadows.
|
|
17
|
+
*/
|
|
18
|
+
const radii = {
|
|
19
|
+
'--borderRadius-small': '3px',
|
|
20
|
+
'--borderRadius-medium': '6px',
|
|
21
|
+
'--borderRadius-large': '12px',
|
|
22
|
+
'--borderRadius-full': '9999px',
|
|
23
|
+
};
|
|
24
|
+
/** The open and closed states are success and danger, as in Primer. */
|
|
25
|
+
const states = {
|
|
26
|
+
'--fgColor-open': 'var(--fgColor-success)',
|
|
27
|
+
'--bgColor-open-emphasis': 'var(--bgColor-success-emphasis)',
|
|
28
|
+
'--borderColor-open-muted': 'var(--borderColor-success-muted)',
|
|
29
|
+
'--bgColor-open-muted': 'var(--bgColor-success-muted)',
|
|
30
|
+
'--fgColor-closed': 'var(--fgColor-danger)',
|
|
31
|
+
'--bgColor-closed-emphasis': 'var(--bgColor-danger-emphasis)',
|
|
32
|
+
'--borderColor-closed-muted': 'var(--borderColor-danger-muted)',
|
|
33
|
+
'--bgColor-closed-muted': 'var(--bgColor-danger-muted)',
|
|
34
|
+
};
|
|
35
|
+
export const primerBaseVars = {
|
|
36
|
+
light: {
|
|
37
|
+
...radii,
|
|
38
|
+
...states,
|
|
39
|
+
'--bgColor-emphasis': '#25292e',
|
|
40
|
+
'--bgColor-neutral-emphasis': '#59636e',
|
|
41
|
+
'--bgColor-neutral-muted': '#818b981f',
|
|
42
|
+
'--fgColor-sponsors': '#bf3989',
|
|
43
|
+
'--bgColor-sponsors-emphasis': '#bf3989',
|
|
44
|
+
'--borderColor-sponsors-muted': '#ff80c866',
|
|
45
|
+
'--bgColor-sponsors-muted': '#ffeff7',
|
|
46
|
+
'--shadow-resting-xsmall': '0px 1px 1px 0px #1f23280f',
|
|
47
|
+
'--shadow-resting-small': '0px 1px 1px 0px #1f23280f, 0px 1px 3px 0px #1f23280f',
|
|
48
|
+
'--shadow-resting-medium': '0px 1px 1px 0px #25292e1a, 0px 3px 6px 0px #25292e1f',
|
|
49
|
+
'--shadow-floating-small': '0px 0px 0px 1px #d1d9e080, 0px 6px 12px -3px #25292e0a, 0px 6px 18px 0px #25292e1f',
|
|
50
|
+
'--shadow-floating-medium': '0px 0px 0px 1px #d1d9e0, 0px 8px 16px -4px #25292e14, 0px 4px 32px -4px #25292e14, 0px 24px 48px -12px #25292e14, 0px 48px 96px -24px #25292e14',
|
|
51
|
+
'--shadow-floating-large': '0px 0px 0px 1px #d1d9e0, 0px 40px 80px 0px #25292e3d',
|
|
52
|
+
'--shadow-floating-xlarge': '0px 0px 0px 1px #d1d9e0, 0px 56px 112px 0px #25292e52',
|
|
53
|
+
},
|
|
54
|
+
dark: {
|
|
55
|
+
...radii,
|
|
56
|
+
...states,
|
|
57
|
+
'--bgColor-emphasis': '#3d444d',
|
|
58
|
+
'--bgColor-neutral-emphasis': '#656c76',
|
|
59
|
+
'--bgColor-neutral-muted': '#656c7633',
|
|
60
|
+
'--fgColor-sponsors': '#db61a2',
|
|
61
|
+
'--bgColor-sponsors-emphasis': '#bf4b8a',
|
|
62
|
+
'--borderColor-sponsors-muted': '#db61a266',
|
|
63
|
+
'--bgColor-sponsors-muted': '#db61a21a',
|
|
64
|
+
'--shadow-resting-xsmall': '0px 1px 1px 0px #010409cc',
|
|
65
|
+
'--shadow-resting-small': '0px 1px 1px 0px #01040999, 0px 1px 3px 0px #01040999',
|
|
66
|
+
'--shadow-resting-medium': '0px 1px 1px 0px #01040966, 0px 3px 6px 0px #010409cc',
|
|
67
|
+
'--shadow-floating-small': '0px 0px 0px 1px #3d444d, 0px 6px 12px -3px #01040966, 0px 6px 18px 0px #01040966',
|
|
68
|
+
'--shadow-floating-medium': '0px 0px 0px 1px #3d444d, 0px 8px 16px -4px #01040966, 0px 4px 32px -4px #01040966, 0px 24px 48px -12px #01040966, 0px 48px 96px -24px #01040966',
|
|
69
|
+
'--shadow-floating-large': '0px 0px 0px 1px #3d444d, 0px 24px 48px 0px #010409',
|
|
70
|
+
'--shadow-floating-xlarge': '0px 0px 0px 1px #3d444d, 0px 32px 64px 0px #010409',
|
|
71
|
+
},
|
|
72
|
+
};
|
package/lib/theme/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export * from './colors';
|
|
2
2
|
export * from './indicators';
|
|
3
3
|
export * from './css/createThemeCSSVars';
|
|
4
|
+
export * from './css/primerBaseVars';
|
|
4
5
|
export * from './themes/datalayerTheme';
|
|
5
6
|
export * from './DatalayerThemeProvider';
|
|
6
7
|
export * from './DatalayerBrandThemeProvider';
|
|
@@ -16,6 +17,7 @@ export * from './themes-brand/spatialBrandTheme';
|
|
|
16
17
|
export * from './themeRegistry';
|
|
17
18
|
export * from './portableTheme';
|
|
18
19
|
export * from './fontStacks';
|
|
20
|
+
export * from './loopEyes';
|
|
19
21
|
export * from './palettes';
|
|
20
22
|
export * from './useSystemColorMode';
|
|
21
23
|
export * from './useThemeStore';
|
package/lib/theme/index.js
CHANGED
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
export * from './colors';
|
|
6
6
|
export * from './indicators';
|
|
7
7
|
export * from './css/createThemeCSSVars';
|
|
8
|
+
export * from './css/primerBaseVars';
|
|
8
9
|
export * from './themes/datalayerTheme';
|
|
9
10
|
export * from './DatalayerThemeProvider';
|
|
10
11
|
export * from './DatalayerBrandThemeProvider';
|
|
@@ -20,6 +21,7 @@ export * from './themes-brand/spatialBrandTheme';
|
|
|
20
21
|
export * from './themeRegistry';
|
|
21
22
|
export * from './portableTheme';
|
|
22
23
|
export * from './fontStacks';
|
|
24
|
+
export * from './loopEyes';
|
|
23
25
|
export * from './palettes';
|
|
24
26
|
export * from './useSystemColorMode';
|
|
25
27
|
export * from './useThemeStore';
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The eyes of LšP, as geometry (`plans/STUDIO.md`, N-02).
|
|
3
|
+
*
|
|
4
|
+
* The name is displayed with two eyes where its two O's are. They are drawn,
|
|
5
|
+
* not typed: the emoji is a different picture on every platform, is missing
|
|
6
|
+
* on some, and is read aloud as "eyes". Two ovals and two pupils, in the
|
|
7
|
+
* colour of the text around them, look the same everywhere ā the web's SVG
|
|
8
|
+
* and the mobile app's native views draw this same geometry.
|
|
9
|
+
*
|
|
10
|
+
* An eye is about as wide and as tall as a capital O of the face beside it,
|
|
11
|
+
* so that the two of them read as the O's they stand for.
|
|
12
|
+
*
|
|
13
|
+
* Pure: nothing here renders.
|
|
14
|
+
*/
|
|
15
|
+
/** The box the two eyes are drawn in. */
|
|
16
|
+
export declare const EYES_VIEW: {
|
|
17
|
+
readonly width: 52;
|
|
18
|
+
readonly height: 32;
|
|
19
|
+
};
|
|
20
|
+
/** Where the eyes look: a point from -1 to 1 each way, right and down positive. */
|
|
21
|
+
export type Gaze = {
|
|
22
|
+
x: number;
|
|
23
|
+
y: number;
|
|
24
|
+
};
|
|
25
|
+
/** The ways of looking that have a name. */
|
|
26
|
+
export declare const GAZES: {
|
|
27
|
+
/** As the emoji does: to the left, a little down. What the logotype shows. */
|
|
28
|
+
readonly aside: {
|
|
29
|
+
readonly x: -0.7;
|
|
30
|
+
readonly y: 0.25;
|
|
31
|
+
};
|
|
32
|
+
readonly ahead: {
|
|
33
|
+
readonly x: 0;
|
|
34
|
+
readonly y: 0;
|
|
35
|
+
};
|
|
36
|
+
readonly left: {
|
|
37
|
+
readonly x: -1;
|
|
38
|
+
readonly y: 0;
|
|
39
|
+
};
|
|
40
|
+
readonly right: {
|
|
41
|
+
readonly x: 1;
|
|
42
|
+
readonly y: 0;
|
|
43
|
+
};
|
|
44
|
+
readonly up: {
|
|
45
|
+
readonly x: 0;
|
|
46
|
+
readonly y: -1;
|
|
47
|
+
};
|
|
48
|
+
readonly down: {
|
|
49
|
+
readonly x: 0;
|
|
50
|
+
readonly y: 1;
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
export type GazeName = keyof typeof GAZES;
|
|
54
|
+
export type Ellipse = {
|
|
55
|
+
cx: number;
|
|
56
|
+
cy: number;
|
|
57
|
+
rx: number;
|
|
58
|
+
ry: number;
|
|
59
|
+
};
|
|
60
|
+
export type Circle = {
|
|
61
|
+
cx: number;
|
|
62
|
+
cy: number;
|
|
63
|
+
r: number;
|
|
64
|
+
};
|
|
65
|
+
/** The stroke of an eye's outline: about the stem of a bold letter at this size. */
|
|
66
|
+
export declare const EYE_STROKE = 4;
|
|
67
|
+
/** A gaze no longer than 1: a look to a corner does not leave the eye. */
|
|
68
|
+
export declare function boundedGaze(gaze: Gaze): Gaze;
|
|
69
|
+
/** The two eyes and their pupils, looking somewhere. */
|
|
70
|
+
export declare function eyesGeometry(gaze?: Gaze | GazeName): {
|
|
71
|
+
eyes: [Ellipse, Ellipse];
|
|
72
|
+
pupils: [Circle, Circle];
|
|
73
|
+
};
|
|
74
|
+
/**
|
|
75
|
+
* Where the eyes look when something is at a point: the gaze towards it from
|
|
76
|
+
* the middle of the eyes, full when it is `far` away or more.
|
|
77
|
+
*/
|
|
78
|
+
export declare function gazeTowards(from: {
|
|
79
|
+
x: number;
|
|
80
|
+
y: number;
|
|
81
|
+
}, to: {
|
|
82
|
+
x: number;
|
|
83
|
+
y: number;
|
|
84
|
+
}, far?: number): Gaze;
|