@datalayer/primer-addons 1.0.8 → 1.0.10

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 (40) hide show
  1. package/lib/components/overlay/Overlay.js +15 -2
  2. package/lib/index.d.ts +1 -0
  3. package/lib/index.js +2 -0
  4. package/lib/theme/DatalayerBrandThemeProvider.d.ts +41 -0
  5. package/lib/theme/DatalayerBrandThemeProvider.js +32 -0
  6. package/lib/theme/DatalayerThemeProvider.d.ts +36 -0
  7. package/lib/theme/DatalayerThemeProvider.js +46 -0
  8. package/lib/theme/Palette.d.ts +4 -0
  9. package/lib/theme/Palette.js +10 -0
  10. package/lib/theme/colors/datalayerColors.d.ts +15 -0
  11. package/lib/theme/colors/datalayerColors.js +21 -0
  12. package/lib/theme/colors/index.d.ts +4 -0
  13. package/lib/theme/colors/index.js +8 -0
  14. package/lib/theme/colors/lovelyColors.d.ts +15 -0
  15. package/lib/theme/colors/lovelyColors.js +21 -0
  16. package/lib/theme/colors/matrixColors.d.ts +20 -0
  17. package/lib/theme/colors/matrixColors.js +26 -0
  18. package/lib/theme/colors/spatialColors.d.ts +15 -0
  19. package/lib/theme/colors/spatialColors.js +21 -0
  20. package/lib/theme/index.d.ts +12 -0
  21. package/lib/theme/index.js +16 -0
  22. package/lib/theme/themeRegistry.d.ts +30 -0
  23. package/lib/theme/themeRegistry.js +53 -0
  24. package/lib/theme/themes/createThemeCSSVars.d.ts +135 -0
  25. package/lib/theme/themes/createThemeCSSVars.js +172 -0
  26. package/lib/theme/themes/datalayerTheme.d.ts +1093 -0
  27. package/lib/theme/themes/datalayerTheme.js +195 -0
  28. package/lib/theme/themes/lovelyTheme.d.ts +1093 -0
  29. package/lib/theme/themes/lovelyTheme.js +190 -0
  30. package/lib/theme/themes/matrixTheme.d.ts +1096 -0
  31. package/lib/theme/themes/matrixTheme.js +202 -0
  32. package/lib/theme/themes/spatialTheme.d.ts +1093 -0
  33. package/lib/theme/themes/spatialTheme.js +190 -0
  34. package/lib/theme/themes-brand/index.d.ts +1 -0
  35. package/lib/theme/themes-brand/index.js +5 -0
  36. package/lib/theme/themes-brand/spatialBrandTheme.d.ts +16 -0
  37. package/lib/theme/themes-brand/spatialBrandTheme.js +157 -0
  38. package/lib/theme/useSystemColorMode.d.ts +9 -0
  39. package/lib/theme/useSystemColorMode.js +26 -0
  40. package/package.json +1 -1
@@ -0,0 +1,202 @@
1
+ /*
2
+ * Copyright (c) 2023-2025 Datalayer, Inc.
3
+ * Distributed under the terms of the Modified BSD License.
4
+ */
5
+ /**
6
+ * Matrix Theme for Primer React.
7
+ *
8
+ * Phosphor green on black — CRT terminal aesthetic.
9
+ * Theming is applied via **CSS custom-property overrides**.
10
+ */
11
+ import { theme as primerTheme } from '@primer/react';
12
+ import { matrixColors } from '../colors';
13
+ import { buildThemeStyles } from './createThemeCSSVars';
14
+ // Re-export so existing consumers keep working.
15
+ export { matrixColors };
16
+ /* ── Light-mode colour definitions ───────────────────────────────────── */
17
+ const matrixLight = {
18
+ canvas: {
19
+ default: matrixColors.white,
20
+ },
21
+ fg: {
22
+ default: '#0A2E1A',
23
+ muted: matrixColors.gray,
24
+ onEmphasis: matrixColors.white,
25
+ },
26
+ accent: {
27
+ fg: matrixColors.greenText,
28
+ emphasis: matrixColors.greenBrand,
29
+ muted: matrixColors.greenAccent,
30
+ },
31
+ success: {
32
+ fg: matrixColors.greenText,
33
+ emphasis: matrixColors.greenBrand,
34
+ muted: matrixColors.greenAccent,
35
+ },
36
+ btn: {
37
+ text: '#0A2E1A',
38
+ bg: matrixColors.white,
39
+ border: '#A5D6A7',
40
+ hoverBg: matrixColors.greenTint,
41
+ hoverBorder: matrixColors.gray,
42
+ activeBg: matrixColors.greenTint,
43
+ activeBorder: matrixColors.gray,
44
+ selectedBg: matrixColors.white,
45
+ counterBg: matrixColors.gray,
46
+ primary: {
47
+ text: matrixColors.white,
48
+ bg: matrixColors.greenText,
49
+ border: matrixColors.greenText,
50
+ hoverBg: matrixColors.greenHover,
51
+ hoverBorder: matrixColors.greenHover,
52
+ selectedBg: matrixColors.greenHover,
53
+ disabledText: 'rgba(255, 255, 255, 0.8)',
54
+ disabledBg: '#94C9B9',
55
+ disabledBorder: '#94C9B9',
56
+ icon: matrixColors.white,
57
+ counterBg: 'rgba(0, 0, 0, 0.2)',
58
+ },
59
+ outline: {
60
+ text: matrixColors.greenText,
61
+ hoverText: matrixColors.white,
62
+ hoverBg: matrixColors.greenText,
63
+ hoverBorder: matrixColors.greenText,
64
+ hoverCounterBg: 'rgba(255, 255, 255, 0.2)',
65
+ selectedText: matrixColors.white,
66
+ selectedBg: matrixColors.greenHover,
67
+ selectedBorder: matrixColors.greenHover,
68
+ disabledText: matrixColors.gray,
69
+ disabledBg: matrixColors.greenTint,
70
+ disabledCounterBg: 'rgba(0, 0, 0, 0.05)',
71
+ counterBg: 'rgba(0, 0, 0, 0.05)',
72
+ counterFg: matrixColors.greenText,
73
+ hoverCounterFg: matrixColors.white,
74
+ disabledCounterFg: matrixColors.gray,
75
+ },
76
+ danger: {
77
+ text: '#d32f2f',
78
+ hoverText: matrixColors.white,
79
+ hoverBg: '#d32f2f',
80
+ hoverBorder: '#d32f2f',
81
+ hoverCounterBg: 'rgba(255, 255, 255, 0.2)',
82
+ selectedText: matrixColors.white,
83
+ selectedBg: '#b71c1c',
84
+ selectedBorder: '#b71c1c',
85
+ disabledText: 'rgba(211, 47, 47, 0.5)',
86
+ disabledBg: matrixColors.greenTint,
87
+ disabledCounterBg: 'rgba(211, 47, 47, 0.05)',
88
+ counterBg: 'rgba(211, 47, 47, 0.1)',
89
+ counterFg: '#d32f2f',
90
+ hoverCounterFg: matrixColors.white,
91
+ disabledCounterFg: 'rgba(211, 47, 47, 0.5)',
92
+ icon: '#d32f2f',
93
+ },
94
+ },
95
+ };
96
+ /* ── Dark-mode colour definitions ────────────────────────────────────── */
97
+ const matrixDark = {
98
+ canvas: {
99
+ default: matrixColors.black,
100
+ subtle: matrixColors.greenTerminal,
101
+ },
102
+ fg: {
103
+ default: '#C8E6C9',
104
+ muted: '#66BB6A',
105
+ onEmphasis: matrixColors.white,
106
+ },
107
+ accent: {
108
+ fg: matrixColors.greenPhosphor,
109
+ emphasis: matrixColors.greenGlow,
110
+ muted: matrixColors.greenAccent,
111
+ subtle: '#0A1F0A',
112
+ },
113
+ success: {
114
+ fg: matrixColors.greenPhosphor,
115
+ emphasis: matrixColors.greenGlow,
116
+ muted: matrixColors.greenAccent,
117
+ subtle: '#0A1F0A',
118
+ },
119
+ btn: {
120
+ text: '#C8E6C9',
121
+ bg: '#0A1F0A',
122
+ border: 'rgba(0, 255, 65, 0.15)',
123
+ hoverBg: '#122812',
124
+ hoverBorder: '#66BB6A',
125
+ activeBg: '#0A1F0A',
126
+ activeBorder: '#4A7856',
127
+ selectedBg: '#061206',
128
+ counterBg: '#122812',
129
+ primary: {
130
+ text: matrixColors.black,
131
+ bg: matrixColors.greenPhosphor,
132
+ border: 'rgba(0, 255, 65, 0.15)',
133
+ hoverBg: matrixColors.greenGlow,
134
+ hoverBorder: 'rgba(0, 255, 65, 0.15)',
135
+ selectedBg: matrixColors.greenGlow,
136
+ disabledText: 'rgba(13, 2, 8, 0.5)',
137
+ disabledBg: 'rgba(0, 255, 65, 0.35)',
138
+ disabledBorder: 'rgba(0, 255, 65, 0.2)',
139
+ icon: matrixColors.black,
140
+ counterBg: 'rgba(0, 0, 0, 0.2)',
141
+ },
142
+ outline: {
143
+ text: matrixColors.greenPhosphor,
144
+ hoverText: matrixColors.black,
145
+ hoverBg: matrixColors.greenPhosphor,
146
+ hoverBorder: matrixColors.greenPhosphor,
147
+ hoverCounterBg: 'rgba(0, 0, 0, 0.2)',
148
+ selectedText: matrixColors.black,
149
+ selectedBg: matrixColors.greenGlow,
150
+ selectedBorder: matrixColors.greenGlow,
151
+ disabledText: 'rgba(0, 255, 65, 0.5)',
152
+ disabledBg: 'rgba(0, 255, 65, 0.1)',
153
+ disabledCounterBg: 'rgba(0, 255, 65, 0.05)',
154
+ counterBg: 'rgba(0, 255, 65, 0.1)',
155
+ counterFg: matrixColors.greenPhosphor,
156
+ hoverCounterFg: matrixColors.black,
157
+ disabledCounterFg: 'rgba(0, 255, 65, 0.5)',
158
+ },
159
+ danger: {
160
+ text: '#f85149',
161
+ hoverText: matrixColors.white,
162
+ hoverBg: '#da3633',
163
+ hoverBorder: '#f85149',
164
+ hoverCounterBg: 'rgba(255, 255, 255, 0.2)',
165
+ selectedText: matrixColors.white,
166
+ selectedBg: '#b62324',
167
+ selectedBorder: '#ff7b72',
168
+ disabledText: 'rgba(248, 81, 73, 0.5)',
169
+ disabledBg: 'rgba(248, 81, 73, 0.1)',
170
+ disabledCounterBg: 'rgba(248, 81, 73, 0.05)',
171
+ counterBg: 'rgba(248, 81, 73, 0.1)',
172
+ counterFg: '#f85149',
173
+ hoverCounterFg: matrixColors.white,
174
+ disabledCounterFg: 'rgba(248, 81, 73, 0.5)',
175
+ icon: '#f85149',
176
+ },
177
+ },
178
+ };
179
+ /* ── Exports ─────────────────────────────────────────────────────────── */
180
+ /**
181
+ * The Primer theme object.
182
+ *
183
+ * Since theming is now done entirely via CSS custom properties
184
+ * (see `matrixThemeStyles`), this is just the unmodified
185
+ * default Primer theme kept for backward compatibility.
186
+ */
187
+ export const matrixTheme = primerTheme;
188
+ /**
189
+ * Monospace font stack for the Matrix terminal aesthetic.
190
+ * Uses fonts pre-installed across macOS / Windows / Linux so no
191
+ * web-font loading is required.
192
+ */
193
+ const matrixFontFamily = '"SF Mono", "Cascadia Code", "Fira Code", Menlo, Consolas, "Liberation Mono", "Courier New", monospace';
194
+ /** Comprehensive Primer CSS-variable overrides for light & dark mode. */
195
+ export const matrixThemeStyles = (() => {
196
+ const base = buildThemeStyles(matrixLight, matrixDark);
197
+ return {
198
+ light: { ...base.light, fontFamily: matrixFontFamily },
199
+ dark: { ...base.dark, fontFamily: matrixFontFamily },
200
+ };
201
+ })();
202
+ export default matrixTheme;