@eqtylab/equality 3.2.3 → 3.2.5
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/dist/alert-dialog.module.module.css.module.css +0 -39
- package/dist/code-block.module.module.css.module.css +100 -5
- package/dist/dialog.module.module.css.module.css +0 -39
- package/dist/drawer.module.module.css.module.css +2 -39
- package/dist/global-theme-config.css +5 -3
- package/dist/index.cjs +117 -122
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +118 -121
- package/dist/index.js.map +1 -1
- package/dist/loading-overlay.module.module.css.module.css +0 -39
- package/dist/sheet.module.module.css.module.css +0 -39
- package/dist/theme-utilities.css +1 -1
- package/package.json +1 -1
|
@@ -7,9 +7,6 @@
|
|
|
7
7
|
@supports (color: color-mix(in lab, red, red)) {
|
|
8
8
|
background-color: color-mix(in oklab, var(--color-black, color(display-p3 0 0 0)) 80%, transparent);
|
|
9
9
|
}
|
|
10
|
-
--tw-backdrop-blur: blur(4px);
|
|
11
|
-
-webkit-backdrop-filter: var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,);
|
|
12
|
-
backdrop-filter: var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,);
|
|
13
10
|
&[data-state="open"] {
|
|
14
11
|
animation: enter var(--tw-animation-duration,var(--tw-duration,.15s))var(--tw-ease,ease)var(--tw-animation-delay,0s)var(--tw-animation-iteration-count,1)var(--tw-animation-direction,normal)var(--tw-animation-fill-mode,none);
|
|
15
12
|
}
|
|
@@ -120,42 +117,6 @@
|
|
|
120
117
|
margin-top: calc(0.25rem * 0);
|
|
121
118
|
}
|
|
122
119
|
}
|
|
123
|
-
@property --tw-backdrop-blur {
|
|
124
|
-
syntax: "*";
|
|
125
|
-
inherits: false;
|
|
126
|
-
}
|
|
127
|
-
@property --tw-backdrop-brightness {
|
|
128
|
-
syntax: "*";
|
|
129
|
-
inherits: false;
|
|
130
|
-
}
|
|
131
|
-
@property --tw-backdrop-contrast {
|
|
132
|
-
syntax: "*";
|
|
133
|
-
inherits: false;
|
|
134
|
-
}
|
|
135
|
-
@property --tw-backdrop-grayscale {
|
|
136
|
-
syntax: "*";
|
|
137
|
-
inherits: false;
|
|
138
|
-
}
|
|
139
|
-
@property --tw-backdrop-hue-rotate {
|
|
140
|
-
syntax: "*";
|
|
141
|
-
inherits: false;
|
|
142
|
-
}
|
|
143
|
-
@property --tw-backdrop-invert {
|
|
144
|
-
syntax: "*";
|
|
145
|
-
inherits: false;
|
|
146
|
-
}
|
|
147
|
-
@property --tw-backdrop-opacity {
|
|
148
|
-
syntax: "*";
|
|
149
|
-
inherits: false;
|
|
150
|
-
}
|
|
151
|
-
@property --tw-backdrop-saturate {
|
|
152
|
-
syntax: "*";
|
|
153
|
-
inherits: false;
|
|
154
|
-
}
|
|
155
|
-
@property --tw-backdrop-sepia {
|
|
156
|
-
syntax: "*";
|
|
157
|
-
inherits: false;
|
|
158
|
-
}
|
|
159
120
|
@property --tw-translate-x {
|
|
160
121
|
syntax: "*";
|
|
161
122
|
inherits: false;
|
|
@@ -50,6 +50,102 @@
|
|
|
50
50
|
overflow: auto;
|
|
51
51
|
min-width: calc(0.25rem * 0);
|
|
52
52
|
font-family: var(--font-mono);
|
|
53
|
+
--syntax-comment: slategray;
|
|
54
|
+
--syntax-punctuation: #999;
|
|
55
|
+
--syntax-tag: #905;
|
|
56
|
+
--syntax-number: #905;
|
|
57
|
+
--syntax-string: #690;
|
|
58
|
+
--syntax-operator: #9a6e3a;
|
|
59
|
+
--syntax-variable: #e90;
|
|
60
|
+
--syntax-atrule: #07a;
|
|
61
|
+
--syntax-keyword: #07a;
|
|
62
|
+
--syntax-function: #dd4a68;
|
|
63
|
+
--syntax-class-name: #dd4a68;
|
|
64
|
+
--syntax-regex: #e90;
|
|
65
|
+
&:where(html[data-equality-theme=dark], html[data-equality-theme=dark] *, [data-equality-theme=dark] .root, [data-equality-theme=dark] .root *) {
|
|
66
|
+
--syntax-comment: #d4d0ab;
|
|
67
|
+
--syntax-punctuation: #fefefe;
|
|
68
|
+
--syntax-tag: #ffa07a;
|
|
69
|
+
--syntax-number: #00e0e0;
|
|
70
|
+
--syntax-string: #abe338;
|
|
71
|
+
--syntax-operator: #00e0e0;
|
|
72
|
+
--syntax-variable: #00e0e0;
|
|
73
|
+
--syntax-atrule: #ffd700;
|
|
74
|
+
--syntax-keyword: #00e0e0;
|
|
75
|
+
--syntax-function: #ffd700;
|
|
76
|
+
--syntax-class-name: #ffd700;
|
|
77
|
+
--syntax-regex: #ffd700;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
.content :global(.token.comment),
|
|
81
|
+
.content :global(.token.prolog),
|
|
82
|
+
.content :global(.token.doctype),
|
|
83
|
+
.content :global(.token.cdata) {
|
|
84
|
+
color: var(--syntax-comment);
|
|
85
|
+
}
|
|
86
|
+
.content :global(.token.punctuation) {
|
|
87
|
+
color: var(--syntax-punctuation);
|
|
88
|
+
}
|
|
89
|
+
.content :global(.token.property),
|
|
90
|
+
.content :global(.token.tag),
|
|
91
|
+
.content :global(.token.constant),
|
|
92
|
+
.content :global(.token.symbol),
|
|
93
|
+
.content :global(.token.deleted) {
|
|
94
|
+
color: var(--syntax-tag);
|
|
95
|
+
}
|
|
96
|
+
.content :global(.token.boolean),
|
|
97
|
+
.content :global(.token.number) {
|
|
98
|
+
color: var(--syntax-number);
|
|
99
|
+
}
|
|
100
|
+
.content :global(.token.selector),
|
|
101
|
+
.content :global(.token.attr-name),
|
|
102
|
+
.content :global(.token.string),
|
|
103
|
+
.content :global(.token.char),
|
|
104
|
+
.content :global(.token.builtin),
|
|
105
|
+
.content :global(.token.inserted) {
|
|
106
|
+
color: var(--syntax-string);
|
|
107
|
+
}
|
|
108
|
+
.content :global(.token.operator),
|
|
109
|
+
.content :global(.token.entity),
|
|
110
|
+
.content :global(.token.url),
|
|
111
|
+
.content :global(.language-css .token.string),
|
|
112
|
+
.content :global(.style .token.string) {
|
|
113
|
+
color: var(--syntax-operator);
|
|
114
|
+
}
|
|
115
|
+
.content :global(.token.entity) {
|
|
116
|
+
cursor: help;
|
|
117
|
+
}
|
|
118
|
+
.content :global(.token.variable) {
|
|
119
|
+
color: var(--syntax-variable);
|
|
120
|
+
}
|
|
121
|
+
.content :global(.token.atrule),
|
|
122
|
+
.content :global(.token.attr-value) {
|
|
123
|
+
color: var(--syntax-atrule);
|
|
124
|
+
}
|
|
125
|
+
.content :global(.token.keyword) {
|
|
126
|
+
color: var(--syntax-keyword);
|
|
127
|
+
}
|
|
128
|
+
.content :global(.token.function) {
|
|
129
|
+
color: var(--syntax-function);
|
|
130
|
+
}
|
|
131
|
+
.content :global(.token.class-name) {
|
|
132
|
+
color: var(--syntax-class-name);
|
|
133
|
+
}
|
|
134
|
+
.content :global(.token.regex) {
|
|
135
|
+
color: var(--syntax-regex);
|
|
136
|
+
}
|
|
137
|
+
.content :global(.token.important) {
|
|
138
|
+
color: var(--syntax-regex);
|
|
139
|
+
font-weight: bold;
|
|
140
|
+
}
|
|
141
|
+
.content :global(.token.bold) {
|
|
142
|
+
font-weight: bold;
|
|
143
|
+
}
|
|
144
|
+
.content :global(.token.italic) {
|
|
145
|
+
font-style: italic;
|
|
146
|
+
}
|
|
147
|
+
.content :global(.namespace) {
|
|
148
|
+
opacity: 0.7;
|
|
53
149
|
}
|
|
54
150
|
.neutral {
|
|
55
151
|
border-color: var(--color-border, color(display-p3 0.7432 0.7432 0.7432));
|
|
@@ -79,11 +175,10 @@
|
|
|
79
175
|
font-family: var(--font-mono);
|
|
80
176
|
}
|
|
81
177
|
.pre {
|
|
82
|
-
margin-block: calc(0.25rem * 0)
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
padding-block: calc(0.25rem * 3);
|
|
178
|
+
margin-block: calc(0.25rem * 0);
|
|
179
|
+
padding: calc(0.25rem * 3);
|
|
180
|
+
line-height: 1.5;
|
|
181
|
+
tab-size: 4;
|
|
87
182
|
}
|
|
88
183
|
.code.wrap {
|
|
89
184
|
white-space: pre-wrap;
|
|
@@ -21,9 +21,6 @@
|
|
|
21
21
|
@supports (color: color-mix(in lab, red, red)) {
|
|
22
22
|
background-color: color-mix(in oklab, var(--color-black, color(display-p3 0 0 0)) 80%, transparent);
|
|
23
23
|
}
|
|
24
|
-
--tw-backdrop-blur: blur(4px);
|
|
25
|
-
-webkit-backdrop-filter: var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,);
|
|
26
|
-
backdrop-filter: var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,);
|
|
27
24
|
}
|
|
28
25
|
.dialog-content {
|
|
29
26
|
max-height: 85vh;
|
|
@@ -147,42 +144,6 @@
|
|
|
147
144
|
padding-inline: calc(0.25rem * 6);
|
|
148
145
|
padding-block: calc(0.25rem * 3);
|
|
149
146
|
}
|
|
150
|
-
@property --tw-backdrop-blur {
|
|
151
|
-
syntax: "*";
|
|
152
|
-
inherits: false;
|
|
153
|
-
}
|
|
154
|
-
@property --tw-backdrop-brightness {
|
|
155
|
-
syntax: "*";
|
|
156
|
-
inherits: false;
|
|
157
|
-
}
|
|
158
|
-
@property --tw-backdrop-contrast {
|
|
159
|
-
syntax: "*";
|
|
160
|
-
inherits: false;
|
|
161
|
-
}
|
|
162
|
-
@property --tw-backdrop-grayscale {
|
|
163
|
-
syntax: "*";
|
|
164
|
-
inherits: false;
|
|
165
|
-
}
|
|
166
|
-
@property --tw-backdrop-hue-rotate {
|
|
167
|
-
syntax: "*";
|
|
168
|
-
inherits: false;
|
|
169
|
-
}
|
|
170
|
-
@property --tw-backdrop-invert {
|
|
171
|
-
syntax: "*";
|
|
172
|
-
inherits: false;
|
|
173
|
-
}
|
|
174
|
-
@property --tw-backdrop-opacity {
|
|
175
|
-
syntax: "*";
|
|
176
|
-
inherits: false;
|
|
177
|
-
}
|
|
178
|
-
@property --tw-backdrop-saturate {
|
|
179
|
-
syntax: "*";
|
|
180
|
-
inherits: false;
|
|
181
|
-
}
|
|
182
|
-
@property --tw-backdrop-sepia {
|
|
183
|
-
syntax: "*";
|
|
184
|
-
inherits: false;
|
|
185
|
-
}
|
|
186
147
|
@property --tw-border-style {
|
|
187
148
|
syntax: "*";
|
|
188
149
|
inherits: false;
|
|
@@ -7,9 +7,6 @@
|
|
|
7
7
|
@supports (color: color-mix(in lab, red, red)) {
|
|
8
8
|
background-color: color-mix(in oklab, var(--color-black, color(display-p3 0 0 0)) 80%, transparent);
|
|
9
9
|
}
|
|
10
|
-
--tw-backdrop-blur: blur(4px);
|
|
11
|
-
-webkit-backdrop-filter: var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,);
|
|
12
|
-
backdrop-filter: var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,);
|
|
13
10
|
}
|
|
14
11
|
.drawer-content {
|
|
15
12
|
border-style: var(--tw-border-style);
|
|
@@ -30,6 +27,8 @@
|
|
|
30
27
|
bottom: calc(0.25rem * 0);
|
|
31
28
|
z-index: 50;
|
|
32
29
|
height: auto;
|
|
30
|
+
display: flex;
|
|
31
|
+
flex-direction: column;
|
|
33
32
|
}
|
|
34
33
|
.drawer-content-divider {
|
|
35
34
|
background-color: var(--color-border, color(display-p3 0.7432 0.7432 0.7432));
|
|
@@ -82,42 +81,6 @@
|
|
|
82
81
|
.drawer-inner-content {
|
|
83
82
|
padding-inline: calc(0.25rem * 4);
|
|
84
83
|
}
|
|
85
|
-
@property --tw-backdrop-blur {
|
|
86
|
-
syntax: "*";
|
|
87
|
-
inherits: false;
|
|
88
|
-
}
|
|
89
|
-
@property --tw-backdrop-brightness {
|
|
90
|
-
syntax: "*";
|
|
91
|
-
inherits: false;
|
|
92
|
-
}
|
|
93
|
-
@property --tw-backdrop-contrast {
|
|
94
|
-
syntax: "*";
|
|
95
|
-
inherits: false;
|
|
96
|
-
}
|
|
97
|
-
@property --tw-backdrop-grayscale {
|
|
98
|
-
syntax: "*";
|
|
99
|
-
inherits: false;
|
|
100
|
-
}
|
|
101
|
-
@property --tw-backdrop-hue-rotate {
|
|
102
|
-
syntax: "*";
|
|
103
|
-
inherits: false;
|
|
104
|
-
}
|
|
105
|
-
@property --tw-backdrop-invert {
|
|
106
|
-
syntax: "*";
|
|
107
|
-
inherits: false;
|
|
108
|
-
}
|
|
109
|
-
@property --tw-backdrop-opacity {
|
|
110
|
-
syntax: "*";
|
|
111
|
-
inherits: false;
|
|
112
|
-
}
|
|
113
|
-
@property --tw-backdrop-saturate {
|
|
114
|
-
syntax: "*";
|
|
115
|
-
inherits: false;
|
|
116
|
-
}
|
|
117
|
-
@property --tw-backdrop-sepia {
|
|
118
|
-
syntax: "*";
|
|
119
|
-
inherits: false;
|
|
120
|
-
}
|
|
121
84
|
@property --tw-border-style {
|
|
122
85
|
syntax: "*";
|
|
123
86
|
inherits: false;
|
|
@@ -16,8 +16,10 @@
|
|
|
16
16
|
/* NOTE: preflight is deliberately NOT imported here. It is an opt-in import so
|
|
17
17
|
that host sites with their own base styles can skip it or scope it:
|
|
18
18
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
preflight.css -> own the document
|
|
20
|
+
preflight-scoped.css -> reset only inside [data-equality-root]
|
|
21
|
+
|
|
22
|
+
Import whichever you want yourself, into layer(base).
|
|
23
|
+
|
|
22
24
|
Import this file first so the layer order above is registered before the
|
|
23
25
|
preflight lands in `base`. */
|
package/dist/index.cjs
CHANGED
|
@@ -25,8 +25,6 @@ var styles12 = require('./card.module.module.css.module.css');
|
|
|
25
25
|
var CheckboxPrimitive = require('@radix-ui/react-checkbox');
|
|
26
26
|
var styles13 = require('./checkbox.module.module.css.module.css');
|
|
27
27
|
var reactSyntaxHighlighter = require('react-syntax-highlighter');
|
|
28
|
-
var darkStyle = require('react-syntax-highlighter/dist/esm/styles/prism/a11y-dark');
|
|
29
|
-
var lightStyle = require('react-syntax-highlighter/dist/esm/styles/prism/prism');
|
|
30
28
|
var styles15 = require('./code-block.module.module.css.module.css');
|
|
31
29
|
var styles14 = require('./icon-button.module.module.css.module.css');
|
|
32
30
|
var cmdk = require('cmdk');
|
|
@@ -134,8 +132,6 @@ var styles11__default = /*#__PURE__*/_interopDefault(styles11);
|
|
|
134
132
|
var styles12__default = /*#__PURE__*/_interopDefault(styles12);
|
|
135
133
|
var CheckboxPrimitive__namespace = /*#__PURE__*/_interopNamespace(CheckboxPrimitive);
|
|
136
134
|
var styles13__default = /*#__PURE__*/_interopDefault(styles13);
|
|
137
|
-
var darkStyle__default = /*#__PURE__*/_interopDefault(darkStyle);
|
|
138
|
-
var lightStyle__default = /*#__PURE__*/_interopDefault(lightStyle);
|
|
139
135
|
var styles15__default = /*#__PURE__*/_interopDefault(styles15);
|
|
140
136
|
var styles14__default = /*#__PURE__*/_interopDefault(styles14);
|
|
141
137
|
var styles17__default = /*#__PURE__*/_interopDefault(styles17);
|
|
@@ -1222,122 +1218,6 @@ function CopyButton({
|
|
|
1222
1218
|
}
|
|
1223
1219
|
);
|
|
1224
1220
|
}
|
|
1225
|
-
|
|
1226
|
-
// src/theme/lib/utils.ts
|
|
1227
|
-
var STORAGE_KEY = "equality-theme";
|
|
1228
|
-
var UPDATE_EVENT = "equality-theme-change";
|
|
1229
|
-
var FALLBACK_THEME = "light";
|
|
1230
|
-
var getFallbackTheme = (options = {}) => {
|
|
1231
|
-
const { canFallbackToBrowserSettings = false } = options;
|
|
1232
|
-
if (typeof window === "undefined" || !canFallbackToBrowserSettings) {
|
|
1233
|
-
return FALLBACK_THEME;
|
|
1234
|
-
}
|
|
1235
|
-
return window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
|
|
1236
|
-
};
|
|
1237
|
-
var getDefaultTheme = () => {
|
|
1238
|
-
const themeProviderRootElement = document.querySelector("[data-equality-theme]") || document.documentElement;
|
|
1239
|
-
if (themeProviderRootElement) {
|
|
1240
|
-
return themeProviderRootElement.getAttribute("data-equality-theme") || void 0;
|
|
1241
|
-
} else {
|
|
1242
|
-
return void 0;
|
|
1243
|
-
}
|
|
1244
|
-
};
|
|
1245
|
-
var getThemeFromLocalStorage = () => {
|
|
1246
|
-
const safeReadStorage = (key) => {
|
|
1247
|
-
try {
|
|
1248
|
-
return window.localStorage.getItem(key);
|
|
1249
|
-
} catch {
|
|
1250
|
-
return null;
|
|
1251
|
-
}
|
|
1252
|
-
};
|
|
1253
|
-
const themeLocalStorageValue = safeReadStorage(STORAGE_KEY);
|
|
1254
|
-
return themeLocalStorageValue;
|
|
1255
|
-
};
|
|
1256
|
-
var getThemeFromWindow = () => {
|
|
1257
|
-
return window.__equalityTheme;
|
|
1258
|
-
};
|
|
1259
|
-
var applyThemeToDom = (theme) => {
|
|
1260
|
-
const themeProviderRootElement = document.querySelector("[data-equality-theme]") || document.documentElement;
|
|
1261
|
-
if (themeProviderRootElement) {
|
|
1262
|
-
themeProviderRootElement.setAttribute("data-equality-theme", theme);
|
|
1263
|
-
}
|
|
1264
|
-
};
|
|
1265
|
-
var setThemeInLocalStorage = (theme) => {
|
|
1266
|
-
try {
|
|
1267
|
-
window.localStorage.setItem(STORAGE_KEY, theme);
|
|
1268
|
-
window.dispatchEvent(new CustomEvent(UPDATE_EVENT, { detail: theme }));
|
|
1269
|
-
} catch {
|
|
1270
|
-
console.error("Failed to set theme in localStorage");
|
|
1271
|
-
}
|
|
1272
|
-
};
|
|
1273
|
-
var setThemeOnWindow = (theme) => {
|
|
1274
|
-
window.__equalityTheme = theme;
|
|
1275
|
-
window.dispatchEvent(new CustomEvent(UPDATE_EVENT, { detail: theme }));
|
|
1276
|
-
};
|
|
1277
|
-
var setTheme = (theme) => {
|
|
1278
|
-
const isUsingLocalStorage = window.__equalityIsUsingLocalStorage;
|
|
1279
|
-
if (isUsingLocalStorage) {
|
|
1280
|
-
setThemeInLocalStorage(theme);
|
|
1281
|
-
} else {
|
|
1282
|
-
setThemeOnWindow(theme);
|
|
1283
|
-
}
|
|
1284
|
-
applyThemeToDom(theme);
|
|
1285
|
-
};
|
|
1286
|
-
var getCurrentThemeState = (options = {}) => {
|
|
1287
|
-
const { canFallbackToBrowserSettings = false } = options;
|
|
1288
|
-
if (typeof window === "undefined") {
|
|
1289
|
-
return void 0;
|
|
1290
|
-
}
|
|
1291
|
-
const isUsingLocalStorage = window.__equalityIsUsingLocalStorage;
|
|
1292
|
-
const storedTheme = isUsingLocalStorage ? getThemeFromLocalStorage() : getThemeFromWindow();
|
|
1293
|
-
const theme = storedTheme || getDefaultTheme() || getFallbackTheme({ canFallbackToBrowserSettings });
|
|
1294
|
-
if (!storedTheme) {
|
|
1295
|
-
setTheme(theme);
|
|
1296
|
-
}
|
|
1297
|
-
return theme;
|
|
1298
|
-
};
|
|
1299
|
-
var subscribeToThemeChange = (listener) => {
|
|
1300
|
-
if (typeof window === "undefined") {
|
|
1301
|
-
return () => {
|
|
1302
|
-
};
|
|
1303
|
-
}
|
|
1304
|
-
const isUsingLocalStorage = window.__equalityIsUsingLocalStorage;
|
|
1305
|
-
if (isUsingLocalStorage) {
|
|
1306
|
-
const storageListener = (event) => {
|
|
1307
|
-
if (event.key === STORAGE_KEY) listener();
|
|
1308
|
-
};
|
|
1309
|
-
const updateListener = () => listener();
|
|
1310
|
-
window.addEventListener("storage", storageListener);
|
|
1311
|
-
window.addEventListener(UPDATE_EVENT, updateListener);
|
|
1312
|
-
return () => {
|
|
1313
|
-
window.removeEventListener("storage", storageListener);
|
|
1314
|
-
window.removeEventListener(UPDATE_EVENT, updateListener);
|
|
1315
|
-
};
|
|
1316
|
-
} else {
|
|
1317
|
-
const windowListener = () => {
|
|
1318
|
-
listener();
|
|
1319
|
-
};
|
|
1320
|
-
window.addEventListener(UPDATE_EVENT, windowListener);
|
|
1321
|
-
return () => {
|
|
1322
|
-
window.removeEventListener(UPDATE_EVENT, windowListener);
|
|
1323
|
-
};
|
|
1324
|
-
}
|
|
1325
|
-
};
|
|
1326
|
-
|
|
1327
|
-
// src/theme/hooks/use-theme.ts
|
|
1328
|
-
var subscribe = (listener) => {
|
|
1329
|
-
return subscribeToThemeChange(listener);
|
|
1330
|
-
};
|
|
1331
|
-
var getSnapshot = () => {
|
|
1332
|
-
return getCurrentThemeState();
|
|
1333
|
-
};
|
|
1334
|
-
var getServerSnapshot = () => {
|
|
1335
|
-
return void 0;
|
|
1336
|
-
};
|
|
1337
|
-
var useTheme = () => {
|
|
1338
|
-
const theme = React15.useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);
|
|
1339
|
-
return [theme, setTheme];
|
|
1340
|
-
};
|
|
1341
1221
|
var WRAP = true;
|
|
1342
1222
|
var CodeBlock = ({
|
|
1343
1223
|
className,
|
|
@@ -1348,7 +1228,6 @@ var CodeBlock = ({
|
|
|
1348
1228
|
codeLabel,
|
|
1349
1229
|
copy
|
|
1350
1230
|
}) => {
|
|
1351
|
-
const [theme] = useTheme();
|
|
1352
1231
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn(styles15__default.default["code-block"], styles15__default.default[variant], className), children: [
|
|
1353
1232
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles15__default.default.header, children: [
|
|
1354
1233
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles15__default.default["header-left"], children: [
|
|
@@ -1361,7 +1240,7 @@ var CodeBlock = ({
|
|
|
1361
1240
|
reactSyntaxHighlighter.Prism,
|
|
1362
1241
|
{
|
|
1363
1242
|
language,
|
|
1364
|
-
|
|
1243
|
+
useInlineStyles: false,
|
|
1365
1244
|
wrapLines: WRAP,
|
|
1366
1245
|
wrapLongLines: WRAP,
|
|
1367
1246
|
className: styles15__default.default.pre,
|
|
@@ -4286,6 +4165,122 @@ var ThemeProvider = ({ customVars, portalContainer, children }) => {
|
|
|
4286
4165
|
) });
|
|
4287
4166
|
};
|
|
4288
4167
|
|
|
4168
|
+
// src/theme/lib/utils.ts
|
|
4169
|
+
var STORAGE_KEY = "equality-theme";
|
|
4170
|
+
var UPDATE_EVENT = "equality-theme-change";
|
|
4171
|
+
var FALLBACK_THEME = "light";
|
|
4172
|
+
var getFallbackTheme = (options = {}) => {
|
|
4173
|
+
const { canFallbackToBrowserSettings = false } = options;
|
|
4174
|
+
if (typeof window === "undefined" || !canFallbackToBrowserSettings) {
|
|
4175
|
+
return FALLBACK_THEME;
|
|
4176
|
+
}
|
|
4177
|
+
return window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
|
|
4178
|
+
};
|
|
4179
|
+
var getDefaultTheme = () => {
|
|
4180
|
+
const themeProviderRootElement = document.querySelector("[data-equality-theme]") || document.documentElement;
|
|
4181
|
+
if (themeProviderRootElement) {
|
|
4182
|
+
return themeProviderRootElement.getAttribute("data-equality-theme") || void 0;
|
|
4183
|
+
} else {
|
|
4184
|
+
return void 0;
|
|
4185
|
+
}
|
|
4186
|
+
};
|
|
4187
|
+
var getThemeFromLocalStorage = () => {
|
|
4188
|
+
const safeReadStorage = (key) => {
|
|
4189
|
+
try {
|
|
4190
|
+
return window.localStorage.getItem(key);
|
|
4191
|
+
} catch {
|
|
4192
|
+
return null;
|
|
4193
|
+
}
|
|
4194
|
+
};
|
|
4195
|
+
const themeLocalStorageValue = safeReadStorage(STORAGE_KEY);
|
|
4196
|
+
return themeLocalStorageValue;
|
|
4197
|
+
};
|
|
4198
|
+
var getThemeFromWindow = () => {
|
|
4199
|
+
return window.__equalityTheme;
|
|
4200
|
+
};
|
|
4201
|
+
var applyThemeToDom = (theme) => {
|
|
4202
|
+
const themeProviderRootElement = document.querySelector("[data-equality-theme]") || document.documentElement;
|
|
4203
|
+
if (themeProviderRootElement) {
|
|
4204
|
+
themeProviderRootElement.setAttribute("data-equality-theme", theme);
|
|
4205
|
+
}
|
|
4206
|
+
};
|
|
4207
|
+
var setThemeInLocalStorage = (theme) => {
|
|
4208
|
+
try {
|
|
4209
|
+
window.localStorage.setItem(STORAGE_KEY, theme);
|
|
4210
|
+
window.dispatchEvent(new CustomEvent(UPDATE_EVENT, { detail: theme }));
|
|
4211
|
+
} catch {
|
|
4212
|
+
console.error("Failed to set theme in localStorage");
|
|
4213
|
+
}
|
|
4214
|
+
};
|
|
4215
|
+
var setThemeOnWindow = (theme) => {
|
|
4216
|
+
window.__equalityTheme = theme;
|
|
4217
|
+
window.dispatchEvent(new CustomEvent(UPDATE_EVENT, { detail: theme }));
|
|
4218
|
+
};
|
|
4219
|
+
var setTheme = (theme) => {
|
|
4220
|
+
const isUsingLocalStorage = window.__equalityIsUsingLocalStorage;
|
|
4221
|
+
if (isUsingLocalStorage) {
|
|
4222
|
+
setThemeInLocalStorage(theme);
|
|
4223
|
+
} else {
|
|
4224
|
+
setThemeOnWindow(theme);
|
|
4225
|
+
}
|
|
4226
|
+
applyThemeToDom(theme);
|
|
4227
|
+
};
|
|
4228
|
+
var getCurrentThemeState = (options = {}) => {
|
|
4229
|
+
const { canFallbackToBrowserSettings = false } = options;
|
|
4230
|
+
if (typeof window === "undefined") {
|
|
4231
|
+
return void 0;
|
|
4232
|
+
}
|
|
4233
|
+
const isUsingLocalStorage = window.__equalityIsUsingLocalStorage;
|
|
4234
|
+
const storedTheme = isUsingLocalStorage ? getThemeFromLocalStorage() : getThemeFromWindow();
|
|
4235
|
+
const theme = storedTheme || getDefaultTheme() || getFallbackTheme({ canFallbackToBrowserSettings });
|
|
4236
|
+
if (!storedTheme) {
|
|
4237
|
+
setTheme(theme);
|
|
4238
|
+
}
|
|
4239
|
+
return theme;
|
|
4240
|
+
};
|
|
4241
|
+
var subscribeToThemeChange = (listener) => {
|
|
4242
|
+
if (typeof window === "undefined") {
|
|
4243
|
+
return () => {
|
|
4244
|
+
};
|
|
4245
|
+
}
|
|
4246
|
+
const isUsingLocalStorage = window.__equalityIsUsingLocalStorage;
|
|
4247
|
+
if (isUsingLocalStorage) {
|
|
4248
|
+
const storageListener = (event) => {
|
|
4249
|
+
if (event.key === STORAGE_KEY) listener();
|
|
4250
|
+
};
|
|
4251
|
+
const updateListener = () => listener();
|
|
4252
|
+
window.addEventListener("storage", storageListener);
|
|
4253
|
+
window.addEventListener(UPDATE_EVENT, updateListener);
|
|
4254
|
+
return () => {
|
|
4255
|
+
window.removeEventListener("storage", storageListener);
|
|
4256
|
+
window.removeEventListener(UPDATE_EVENT, updateListener);
|
|
4257
|
+
};
|
|
4258
|
+
} else {
|
|
4259
|
+
const windowListener = () => {
|
|
4260
|
+
listener();
|
|
4261
|
+
};
|
|
4262
|
+
window.addEventListener(UPDATE_EVENT, windowListener);
|
|
4263
|
+
return () => {
|
|
4264
|
+
window.removeEventListener(UPDATE_EVENT, windowListener);
|
|
4265
|
+
};
|
|
4266
|
+
}
|
|
4267
|
+
};
|
|
4268
|
+
|
|
4269
|
+
// src/theme/hooks/use-theme.ts
|
|
4270
|
+
var subscribe = (listener) => {
|
|
4271
|
+
return subscribeToThemeChange(listener);
|
|
4272
|
+
};
|
|
4273
|
+
var getSnapshot = () => {
|
|
4274
|
+
return getCurrentThemeState();
|
|
4275
|
+
};
|
|
4276
|
+
var getServerSnapshot = () => {
|
|
4277
|
+
return void 0;
|
|
4278
|
+
};
|
|
4279
|
+
var useTheme = () => {
|
|
4280
|
+
const theme = React15.useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);
|
|
4281
|
+
return [theme, setTheme];
|
|
4282
|
+
};
|
|
4283
|
+
|
|
4289
4284
|
exports.Alert = Alert;
|
|
4290
4285
|
exports.AlertDialog = AlertDialog;
|
|
4291
4286
|
exports.AlertDialogAction = AlertDialogAction;
|