@polymarket-developers/clob-client 1.0.7
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/CHANGELOG.md +7 -0
- package/LICENSE +21 -0
- package/README.md +78 -0
- package/cache/LICENSE +21 -0
- package/cache/README.md +62 -0
- package/cache/dist/declarations/src/index.d.ts +2 -0
- package/cache/dist/declarations/types/index.d.ts +45 -0
- package/cache/dist/emotion-cache.browser.cjs.default.js +1 -0
- package/cache/dist/emotion-cache.browser.cjs.js +471 -0
- package/cache/dist/emotion-cache.browser.cjs.mjs +2 -0
- package/cache/dist/emotion-cache.browser.development.cjs.default.js +1 -0
- package/cache/dist/emotion-cache.browser.development.cjs.js +616 -0
- package/cache/dist/emotion-cache.browser.development.cjs.mjs +2 -0
- package/cache/dist/emotion-cache.browser.development.esm.js +612 -0
- package/cache/dist/emotion-cache.browser.esm.js +467 -0
- package/cache/dist/emotion-cache.cjs.d.mts +3 -0
- package/cache/dist/emotion-cache.cjs.d.ts +3 -0
- package/cache/dist/emotion-cache.cjs.default.d.ts +1 -0
- package/cache/dist/emotion-cache.cjs.default.js +1 -0
- package/cache/dist/emotion-cache.cjs.js +565 -0
- package/cache/dist/emotion-cache.cjs.mjs +2 -0
- package/cache/dist/emotion-cache.development.cjs.default.js +1 -0
- package/cache/dist/emotion-cache.development.cjs.js +714 -0
- package/cache/dist/emotion-cache.development.cjs.mjs +2 -0
- package/cache/dist/emotion-cache.development.edge-light.cjs.default.js +1 -0
- package/cache/dist/emotion-cache.development.edge-light.cjs.js +621 -0
- package/cache/dist/emotion-cache.development.edge-light.cjs.mjs +2 -0
- package/cache/dist/emotion-cache.development.edge-light.esm.js +612 -0
- package/cache/dist/emotion-cache.development.esm.js +705 -0
- package/cache/dist/emotion-cache.edge-light.cjs.default.js +1 -0
- package/cache/dist/emotion-cache.edge-light.cjs.js +490 -0
- package/cache/dist/emotion-cache.edge-light.cjs.mjs +2 -0
- package/cache/dist/emotion-cache.edge-light.esm.js +481 -0
- package/cache/dist/emotion-cache.esm.js +556 -0
- package/cache/package.json +100 -0
- package/cache/src/conditions/false.js +1 -0
- package/cache/src/conditions/is-browser.js +1 -0
- package/cache/src/conditions/true.js +1 -0
- package/cache/src/index.d.ts +2 -0
- package/cache/src/index.js +257 -0
- package/cache/src/prefixer.js +340 -0
- package/cache/src/stylis-plugins.js +269 -0
- package/cache/src/types.js +26 -0
- package/cache/types/index.d.ts +45 -0
- package/index.d.ts +63 -0
- package/index.js +204 -0
- package/package.json +27 -0
- package/utils.js +15 -0
|
@@ -0,0 +1,556 @@
|
|
|
1
|
+
import { StyleSheet } from '@emotion/sheet';
|
|
2
|
+
import { dealloc, alloc, next, token, from, peek, delimit, slice, position, RULESET, combine, match, serialize, copy, replace, WEBKIT, MOZ, MS, KEYFRAMES, DECLARATION, hash, charat, strlen, indexof, stringify, rulesheet, middleware, compile } from 'stylis';
|
|
3
|
+
import weakMemoize from '@emotion/weak-memoize';
|
|
4
|
+
import memoize from '@emotion/memoize';
|
|
5
|
+
|
|
6
|
+
var isBrowser = typeof document !== 'undefined';
|
|
7
|
+
|
|
8
|
+
var identifierWithPointTracking = function identifierWithPointTracking(begin, points, index) {
|
|
9
|
+
var previous = 0;
|
|
10
|
+
var character = 0;
|
|
11
|
+
|
|
12
|
+
while (true) {
|
|
13
|
+
previous = character;
|
|
14
|
+
character = peek(); // &\f
|
|
15
|
+
|
|
16
|
+
if (previous === 38 && character === 12) {
|
|
17
|
+
points[index] = 1;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
if (token(character)) {
|
|
21
|
+
break;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
next();
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
return slice(begin, position);
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
var toRules = function toRules(parsed, points) {
|
|
31
|
+
// pretend we've started with a comma
|
|
32
|
+
var index = -1;
|
|
33
|
+
var character = 44;
|
|
34
|
+
|
|
35
|
+
do {
|
|
36
|
+
switch (token(character)) {
|
|
37
|
+
case 0:
|
|
38
|
+
// &\f
|
|
39
|
+
if (character === 38 && peek() === 12) {
|
|
40
|
+
// this is not 100% correct, we don't account for literal sequences here - like for example quoted strings
|
|
41
|
+
// stylis inserts \f after & to know when & where it should replace this sequence with the context selector
|
|
42
|
+
// and when it should just concatenate the outer and inner selectors
|
|
43
|
+
// it's very unlikely for this sequence to actually appear in a different context, so we just leverage this fact here
|
|
44
|
+
points[index] = 1;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
parsed[index] += identifierWithPointTracking(position - 1, points, index);
|
|
48
|
+
break;
|
|
49
|
+
|
|
50
|
+
case 2:
|
|
51
|
+
parsed[index] += delimit(character);
|
|
52
|
+
break;
|
|
53
|
+
|
|
54
|
+
case 4:
|
|
55
|
+
// comma
|
|
56
|
+
if (character === 44) {
|
|
57
|
+
// colon
|
|
58
|
+
parsed[++index] = peek() === 58 ? '&\f' : '';
|
|
59
|
+
points[index] = parsed[index].length;
|
|
60
|
+
break;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
// fallthrough
|
|
64
|
+
|
|
65
|
+
default:
|
|
66
|
+
parsed[index] += from(character);
|
|
67
|
+
}
|
|
68
|
+
} while (character = next());
|
|
69
|
+
|
|
70
|
+
return parsed;
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
var getRules = function getRules(value, points) {
|
|
74
|
+
return dealloc(toRules(alloc(value), points));
|
|
75
|
+
}; // WeakSet would be more appropriate, but only WeakMap is supported in IE11
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
var fixedElements = /* #__PURE__ */new WeakMap();
|
|
79
|
+
var compat = function compat(element) {
|
|
80
|
+
if (element.type !== 'rule' || !element.parent || // positive .length indicates that this rule contains pseudo
|
|
81
|
+
// negative .length indicates that this rule has been already prefixed
|
|
82
|
+
element.length < 1) {
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
var value = element.value,
|
|
87
|
+
parent = element.parent;
|
|
88
|
+
var isImplicitRule = element.column === parent.column && element.line === parent.line;
|
|
89
|
+
|
|
90
|
+
while (parent.type !== 'rule') {
|
|
91
|
+
parent = parent.parent;
|
|
92
|
+
if (!parent) return;
|
|
93
|
+
} // short-circuit for the simplest case
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
if (element.props.length === 1 && value.charCodeAt(0) !== 58
|
|
97
|
+
/* colon */
|
|
98
|
+
&& !fixedElements.get(parent)) {
|
|
99
|
+
return;
|
|
100
|
+
} // if this is an implicitly inserted rule (the one eagerly inserted at the each new nested level)
|
|
101
|
+
// then the props has already been manipulated beforehand as they that array is shared between it and its "rule parent"
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
if (isImplicitRule) {
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
fixedElements.set(element, true);
|
|
109
|
+
var points = [];
|
|
110
|
+
var rules = getRules(value, points);
|
|
111
|
+
var parentRules = parent.props;
|
|
112
|
+
|
|
113
|
+
for (var i = 0, k = 0; i < rules.length; i++) {
|
|
114
|
+
for (var j = 0; j < parentRules.length; j++, k++) {
|
|
115
|
+
element.props[k] = points[i] ? rules[i].replace(/&\f/g, parentRules[j]) : parentRules[j] + " " + rules[i];
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
};
|
|
119
|
+
var removeLabel = function removeLabel(element) {
|
|
120
|
+
if (element.type === 'decl') {
|
|
121
|
+
var value = element.value;
|
|
122
|
+
|
|
123
|
+
if ( // charcode for l
|
|
124
|
+
value.charCodeAt(0) === 108 && // charcode for b
|
|
125
|
+
value.charCodeAt(2) === 98) {
|
|
126
|
+
// this ignores label
|
|
127
|
+
element["return"] = '';
|
|
128
|
+
element.value = '';
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
};
|
|
132
|
+
|
|
133
|
+
/* eslint-disable no-fallthrough */
|
|
134
|
+
|
|
135
|
+
function prefix(value, length) {
|
|
136
|
+
switch (hash(value, length)) {
|
|
137
|
+
// color-adjust
|
|
138
|
+
case 5103:
|
|
139
|
+
return WEBKIT + 'print-' + value + value;
|
|
140
|
+
// animation, animation-(delay|direction|duration|fill-mode|iteration-count|name|play-state|timing-function)
|
|
141
|
+
|
|
142
|
+
case 5737:
|
|
143
|
+
case 4201:
|
|
144
|
+
case 3177:
|
|
145
|
+
case 3433:
|
|
146
|
+
case 1641:
|
|
147
|
+
case 4457:
|
|
148
|
+
case 2921: // text-decoration, filter, clip-path, backface-visibility, column, box-decoration-break
|
|
149
|
+
|
|
150
|
+
case 5572:
|
|
151
|
+
case 6356:
|
|
152
|
+
case 5844:
|
|
153
|
+
case 3191:
|
|
154
|
+
case 6645:
|
|
155
|
+
case 3005: // mask, mask-image, mask-(mode|clip|size), mask-(repeat|origin), mask-position, mask-composite,
|
|
156
|
+
|
|
157
|
+
case 6391:
|
|
158
|
+
case 5879:
|
|
159
|
+
case 5623:
|
|
160
|
+
case 6135:
|
|
161
|
+
case 4599:
|
|
162
|
+
case 4855: // background-clip, columns, column-(count|fill|gap|rule|rule-color|rule-style|rule-width|span|width)
|
|
163
|
+
|
|
164
|
+
case 4215:
|
|
165
|
+
case 6389:
|
|
166
|
+
case 5109:
|
|
167
|
+
case 5365:
|
|
168
|
+
case 5621:
|
|
169
|
+
case 3829:
|
|
170
|
+
return WEBKIT + value + value;
|
|
171
|
+
// appearance, user-select, transform, hyphens, text-size-adjust
|
|
172
|
+
|
|
173
|
+
case 5349:
|
|
174
|
+
case 4246:
|
|
175
|
+
case 4810:
|
|
176
|
+
case 6968:
|
|
177
|
+
case 2756:
|
|
178
|
+
return WEBKIT + value + MOZ + value + MS + value + value;
|
|
179
|
+
// flex, flex-direction
|
|
180
|
+
|
|
181
|
+
case 6828:
|
|
182
|
+
case 4268:
|
|
183
|
+
return WEBKIT + value + MS + value + value;
|
|
184
|
+
// order
|
|
185
|
+
|
|
186
|
+
case 6165:
|
|
187
|
+
return WEBKIT + value + MS + 'flex-' + value + value;
|
|
188
|
+
// align-items
|
|
189
|
+
|
|
190
|
+
case 5187:
|
|
191
|
+
return WEBKIT + value + replace(value, /(\w+).+(:[^]+)/, WEBKIT + 'box-$1$2' + MS + 'flex-$1$2') + value;
|
|
192
|
+
// align-self
|
|
193
|
+
|
|
194
|
+
case 5443:
|
|
195
|
+
return WEBKIT + value + MS + 'flex-item-' + replace(value, /flex-|-self/, '') + value;
|
|
196
|
+
// align-content
|
|
197
|
+
|
|
198
|
+
case 4675:
|
|
199
|
+
return WEBKIT + value + MS + 'flex-line-pack' + replace(value, /align-content|flex-|-self/, '') + value;
|
|
200
|
+
// flex-shrink
|
|
201
|
+
|
|
202
|
+
case 5548:
|
|
203
|
+
return WEBKIT + value + MS + replace(value, 'shrink', 'negative') + value;
|
|
204
|
+
// flex-basis
|
|
205
|
+
|
|
206
|
+
case 5292:
|
|
207
|
+
return WEBKIT + value + MS + replace(value, 'basis', 'preferred-size') + value;
|
|
208
|
+
// flex-grow
|
|
209
|
+
|
|
210
|
+
case 6060:
|
|
211
|
+
return WEBKIT + 'box-' + replace(value, '-grow', '') + WEBKIT + value + MS + replace(value, 'grow', 'positive') + value;
|
|
212
|
+
// transition
|
|
213
|
+
|
|
214
|
+
case 4554:
|
|
215
|
+
return WEBKIT + replace(value, /([^-])(transform)/g, '$1' + WEBKIT + '$2') + value;
|
|
216
|
+
// cursor
|
|
217
|
+
|
|
218
|
+
case 6187:
|
|
219
|
+
return replace(replace(replace(value, /(zoom-|grab)/, WEBKIT + '$1'), /(image-set)/, WEBKIT + '$1'), value, '') + value;
|
|
220
|
+
// background, background-image
|
|
221
|
+
|
|
222
|
+
case 5495:
|
|
223
|
+
case 3959:
|
|
224
|
+
return replace(value, /(image-set\([^]*)/, WEBKIT + '$1' + '$`$1');
|
|
225
|
+
// justify-content
|
|
226
|
+
|
|
227
|
+
case 4968:
|
|
228
|
+
return replace(replace(value, /(.+:)(flex-)?(.*)/, WEBKIT + 'box-pack:$3' + MS + 'flex-pack:$3'), /s.+-b[^;]+/, 'justify') + WEBKIT + value + value;
|
|
229
|
+
// (margin|padding)-inline-(start|end)
|
|
230
|
+
|
|
231
|
+
case 4095:
|
|
232
|
+
case 3583:
|
|
233
|
+
case 4068:
|
|
234
|
+
case 2532:
|
|
235
|
+
return replace(value, /(.+)-inline(.+)/, WEBKIT + '$1$2') + value;
|
|
236
|
+
// (min|max)?(width|height|inline-size|block-size)
|
|
237
|
+
|
|
238
|
+
case 8116:
|
|
239
|
+
case 7059:
|
|
240
|
+
case 5753:
|
|
241
|
+
case 5535:
|
|
242
|
+
case 5445:
|
|
243
|
+
case 5701:
|
|
244
|
+
case 4933:
|
|
245
|
+
case 4677:
|
|
246
|
+
case 5533:
|
|
247
|
+
case 5789:
|
|
248
|
+
case 5021:
|
|
249
|
+
case 4765:
|
|
250
|
+
// stretch, max-content, min-content, fill-available
|
|
251
|
+
if (strlen(value) - 1 - length > 6) switch (charat(value, length + 1)) {
|
|
252
|
+
// (m)ax-content, (m)in-content
|
|
253
|
+
case 109:
|
|
254
|
+
// -
|
|
255
|
+
if (charat(value, length + 4) !== 45) break;
|
|
256
|
+
// (f)ill-available, (f)it-content
|
|
257
|
+
|
|
258
|
+
case 102:
|
|
259
|
+
return replace(value, /(.+:)(.+)-([^]+)/, '$1' + WEBKIT + '$2-$3' + '$1' + MOZ + (charat(value, length + 3) == 108 ? '$3' : '$2-$3')) + value;
|
|
260
|
+
// (s)tretch
|
|
261
|
+
|
|
262
|
+
case 115:
|
|
263
|
+
return ~indexof(value, 'stretch') ? prefix(replace(value, 'stretch', 'fill-available'), length) + value : value;
|
|
264
|
+
}
|
|
265
|
+
break;
|
|
266
|
+
// position: sticky
|
|
267
|
+
|
|
268
|
+
case 4949:
|
|
269
|
+
// (s)ticky?
|
|
270
|
+
if (charat(value, length + 1) !== 115) break;
|
|
271
|
+
// display: (flex|inline-flex)
|
|
272
|
+
|
|
273
|
+
case 6444:
|
|
274
|
+
switch (charat(value, strlen(value) - 3 - (~indexof(value, '!important') && 10))) {
|
|
275
|
+
// stic(k)y
|
|
276
|
+
case 107:
|
|
277
|
+
return replace(value, ':', ':' + WEBKIT) + value;
|
|
278
|
+
// (inline-)?fl(e)x
|
|
279
|
+
|
|
280
|
+
case 101:
|
|
281
|
+
return replace(value, /(.+:)([^;!]+)(;|!.+)?/, '$1' + WEBKIT + (charat(value, 14) === 45 ? 'inline-' : '') + 'box$3' + '$1' + WEBKIT + '$2$3' + '$1' + MS + '$2box$3') + value;
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
break;
|
|
285
|
+
// writing-mode
|
|
286
|
+
|
|
287
|
+
case 5936:
|
|
288
|
+
switch (charat(value, length + 11)) {
|
|
289
|
+
// vertical-l(r)
|
|
290
|
+
case 114:
|
|
291
|
+
return WEBKIT + value + MS + replace(value, /[svh]\w+-[tblr]{2}/, 'tb') + value;
|
|
292
|
+
// vertical-r(l)
|
|
293
|
+
|
|
294
|
+
case 108:
|
|
295
|
+
return WEBKIT + value + MS + replace(value, /[svh]\w+-[tblr]{2}/, 'tb-rl') + value;
|
|
296
|
+
// horizontal(-)tb
|
|
297
|
+
|
|
298
|
+
case 45:
|
|
299
|
+
return WEBKIT + value + MS + replace(value, /[svh]\w+-[tblr]{2}/, 'lr') + value;
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
return WEBKIT + value + MS + value + value;
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
return value;
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
var prefixer = function prefixer(element, index, children, callback) {
|
|
309
|
+
if (element.length > -1) if (!element["return"]) switch (element.type) {
|
|
310
|
+
case DECLARATION:
|
|
311
|
+
element["return"] = prefix(element.value, element.length);
|
|
312
|
+
break;
|
|
313
|
+
|
|
314
|
+
case KEYFRAMES:
|
|
315
|
+
return serialize([copy(element, {
|
|
316
|
+
value: replace(element.value, '@', '@' + WEBKIT)
|
|
317
|
+
})], callback);
|
|
318
|
+
|
|
319
|
+
case RULESET:
|
|
320
|
+
if (element.length) return combine(element.props, function (value) {
|
|
321
|
+
switch (match(value, /(::plac\w+|:read-\w+)/)) {
|
|
322
|
+
// :read-(only|write)
|
|
323
|
+
case ':read-only':
|
|
324
|
+
case ':read-write':
|
|
325
|
+
return serialize([copy(element, {
|
|
326
|
+
props: [replace(value, /:(read-\w+)/, ':' + MOZ + '$1')]
|
|
327
|
+
})], callback);
|
|
328
|
+
// :placeholder
|
|
329
|
+
|
|
330
|
+
case '::placeholder':
|
|
331
|
+
return serialize([copy(element, {
|
|
332
|
+
props: [replace(value, /:(plac\w+)/, ':' + WEBKIT + 'input-$1')]
|
|
333
|
+
}), copy(element, {
|
|
334
|
+
props: [replace(value, /:(plac\w+)/, ':' + MOZ + '$1')]
|
|
335
|
+
}), copy(element, {
|
|
336
|
+
props: [replace(value, /:(plac\w+)/, MS + 'input-$1')]
|
|
337
|
+
})], callback);
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
return '';
|
|
341
|
+
});
|
|
342
|
+
}
|
|
343
|
+
};
|
|
344
|
+
|
|
345
|
+
/* import type { StylisPlugin } from './types' */
|
|
346
|
+
|
|
347
|
+
/*
|
|
348
|
+
export type Options = {
|
|
349
|
+
nonce?: string,
|
|
350
|
+
stylisPlugins?: StylisPlugin[],
|
|
351
|
+
key: string,
|
|
352
|
+
container?: HTMLElement,
|
|
353
|
+
speedy?: boolean,
|
|
354
|
+
prepend?: boolean,
|
|
355
|
+
insertionPoint?: HTMLElement
|
|
356
|
+
}
|
|
357
|
+
*/
|
|
358
|
+
|
|
359
|
+
var getServerStylisCache = isBrowser ? undefined : weakMemoize(function () {
|
|
360
|
+
return memoize(function () {
|
|
361
|
+
var cache = {};
|
|
362
|
+
return function (name) {
|
|
363
|
+
return cache[name];
|
|
364
|
+
};
|
|
365
|
+
});
|
|
366
|
+
});
|
|
367
|
+
var defaultStylisPlugins = [prefixer];
|
|
368
|
+
|
|
369
|
+
var createCache = function
|
|
370
|
+
/*: EmotionCache */
|
|
371
|
+
createCache(options
|
|
372
|
+
/*: Options */
|
|
373
|
+
) {
|
|
374
|
+
var key = options.key;
|
|
375
|
+
|
|
376
|
+
if (isBrowser && key === 'css') {
|
|
377
|
+
var ssrStyles = document.querySelectorAll("style[data-emotion]:not([data-s])"); // get SSRed styles out of the way of React's hydration
|
|
378
|
+
// document.head is a safe place to move them to(though note document.head is not necessarily the last place they will be)
|
|
379
|
+
// note this very very intentionally targets all style elements regardless of the key to ensure
|
|
380
|
+
// that creating a cache works inside of render of a React component
|
|
381
|
+
|
|
382
|
+
Array.prototype.forEach.call(ssrStyles, function (node
|
|
383
|
+
/*: HTMLStyleElement */
|
|
384
|
+
) {
|
|
385
|
+
// we want to only move elements which have a space in the data-emotion attribute value
|
|
386
|
+
// because that indicates that it is an Emotion 11 server-side rendered style elements
|
|
387
|
+
// while we will already ignore Emotion 11 client-side inserted styles because of the :not([data-s]) part in the selector
|
|
388
|
+
// Emotion 10 client-side inserted styles did not have data-s (but importantly did not have a space in their data-emotion attributes)
|
|
389
|
+
// so checking for the space ensures that loading Emotion 11 after Emotion 10 has inserted some styles
|
|
390
|
+
// will not result in the Emotion 10 styles being destroyed
|
|
391
|
+
var dataEmotionAttribute = node.getAttribute('data-emotion');
|
|
392
|
+
|
|
393
|
+
if (dataEmotionAttribute.indexOf(' ') === -1) {
|
|
394
|
+
return;
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
document.head.appendChild(node);
|
|
398
|
+
node.setAttribute('data-s', '');
|
|
399
|
+
});
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
var stylisPlugins = options.stylisPlugins || defaultStylisPlugins;
|
|
403
|
+
|
|
404
|
+
var inserted = {};
|
|
405
|
+
var container;
|
|
406
|
+
/* : Node */
|
|
407
|
+
|
|
408
|
+
var nodesToHydrate = [];
|
|
409
|
+
|
|
410
|
+
if (isBrowser) {
|
|
411
|
+
container = options.container || document.head;
|
|
412
|
+
Array.prototype.forEach.call( // this means we will ignore elements which don't have a space in them which
|
|
413
|
+
// means that the style elements we're looking at are only Emotion 11 server-rendered style elements
|
|
414
|
+
document.querySelectorAll("style[data-emotion^=\"" + key + " \"]"), function (node
|
|
415
|
+
/*: HTMLStyleElement */
|
|
416
|
+
) {
|
|
417
|
+
var attrib = node.getAttribute("data-emotion").split(' ');
|
|
418
|
+
|
|
419
|
+
for (var i = 1; i < attrib.length; i++) {
|
|
420
|
+
inserted[attrib[i]] = true;
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
nodesToHydrate.push(node);
|
|
424
|
+
});
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
var _insert;
|
|
428
|
+
/*: (
|
|
429
|
+
selector: string,
|
|
430
|
+
serialized: SerializedStyles,
|
|
431
|
+
sheet: StyleSheet,
|
|
432
|
+
shouldCache: boolean
|
|
433
|
+
) => string | void */
|
|
434
|
+
|
|
435
|
+
|
|
436
|
+
var omnipresentPlugins = [compat, removeLabel];
|
|
437
|
+
|
|
438
|
+
if (isBrowser) {
|
|
439
|
+
var currentSheet;
|
|
440
|
+
var finalizingPlugins = [stringify, rulesheet(function (rule) {
|
|
441
|
+
currentSheet.insert(rule);
|
|
442
|
+
})];
|
|
443
|
+
var serializer = middleware(omnipresentPlugins.concat(stylisPlugins, finalizingPlugins));
|
|
444
|
+
|
|
445
|
+
var stylis = function stylis(styles) {
|
|
446
|
+
return serialize(compile(styles), serializer);
|
|
447
|
+
};
|
|
448
|
+
|
|
449
|
+
_insert = function
|
|
450
|
+
/*: void */
|
|
451
|
+
insert(selector
|
|
452
|
+
/*: string */
|
|
453
|
+
, serialized
|
|
454
|
+
/*: SerializedStyles */
|
|
455
|
+
, sheet
|
|
456
|
+
/*: StyleSheet */
|
|
457
|
+
, shouldCache
|
|
458
|
+
/*: boolean */
|
|
459
|
+
) {
|
|
460
|
+
currentSheet = sheet;
|
|
461
|
+
|
|
462
|
+
stylis(selector ? selector + "{" + serialized.styles + "}" : serialized.styles);
|
|
463
|
+
|
|
464
|
+
if (shouldCache) {
|
|
465
|
+
cache.inserted[serialized.name] = true;
|
|
466
|
+
}
|
|
467
|
+
};
|
|
468
|
+
} else {
|
|
469
|
+
var _finalizingPlugins = [stringify];
|
|
470
|
+
|
|
471
|
+
var _serializer = middleware(omnipresentPlugins.concat(stylisPlugins, _finalizingPlugins));
|
|
472
|
+
|
|
473
|
+
var _stylis = function _stylis(styles) {
|
|
474
|
+
return serialize(compile(styles), _serializer);
|
|
475
|
+
};
|
|
476
|
+
|
|
477
|
+
var serverStylisCache = getServerStylisCache(stylisPlugins)(key);
|
|
478
|
+
|
|
479
|
+
var getRules = function
|
|
480
|
+
/*: string */
|
|
481
|
+
getRules(selector
|
|
482
|
+
/*: string */
|
|
483
|
+
, serialized
|
|
484
|
+
/*: SerializedStyles */
|
|
485
|
+
) {
|
|
486
|
+
var name = serialized.name;
|
|
487
|
+
|
|
488
|
+
if (serverStylisCache[name] === undefined) {
|
|
489
|
+
serverStylisCache[name] = _stylis(selector ? selector + "{" + serialized.styles + "}" : serialized.styles);
|
|
490
|
+
}
|
|
491
|
+
|
|
492
|
+
return serverStylisCache[name];
|
|
493
|
+
};
|
|
494
|
+
|
|
495
|
+
_insert = function
|
|
496
|
+
/*: string | void */
|
|
497
|
+
_insert(selector
|
|
498
|
+
/*: string */
|
|
499
|
+
, serialized
|
|
500
|
+
/*: SerializedStyles */
|
|
501
|
+
, sheet
|
|
502
|
+
/*: StyleSheet */
|
|
503
|
+
, shouldCache
|
|
504
|
+
/*: boolean */
|
|
505
|
+
) {
|
|
506
|
+
var name = serialized.name;
|
|
507
|
+
var rules = getRules(selector, serialized);
|
|
508
|
+
|
|
509
|
+
if (cache.compat === undefined) {
|
|
510
|
+
// in regular mode, we don't set the styles on the inserted cache
|
|
511
|
+
// since we don't need to and that would be wasting memory
|
|
512
|
+
// we return them so that they are rendered in a style tag
|
|
513
|
+
if (shouldCache) {
|
|
514
|
+
cache.inserted[name] = true;
|
|
515
|
+
}
|
|
516
|
+
|
|
517
|
+
return rules;
|
|
518
|
+
} else {
|
|
519
|
+
// in compat mode, we put the styles on the inserted cache so
|
|
520
|
+
// that emotion-server can pull out the styles
|
|
521
|
+
// except when we don't want to cache it which was in Global but now
|
|
522
|
+
// is nowhere but we don't want to do a major right now
|
|
523
|
+
// and just in case we're going to leave the case here
|
|
524
|
+
// it's also not affecting client side bundle size
|
|
525
|
+
// so it's really not a big deal
|
|
526
|
+
if (shouldCache) {
|
|
527
|
+
cache.inserted[name] = rules;
|
|
528
|
+
} else {
|
|
529
|
+
return rules;
|
|
530
|
+
}
|
|
531
|
+
}
|
|
532
|
+
};
|
|
533
|
+
}
|
|
534
|
+
|
|
535
|
+
var cache
|
|
536
|
+
/*: EmotionCache */
|
|
537
|
+
= {
|
|
538
|
+
key: key,
|
|
539
|
+
sheet: new StyleSheet({
|
|
540
|
+
key: key,
|
|
541
|
+
container: container,
|
|
542
|
+
nonce: options.nonce,
|
|
543
|
+
speedy: options.speedy,
|
|
544
|
+
prepend: options.prepend,
|
|
545
|
+
insertionPoint: options.insertionPoint
|
|
546
|
+
}),
|
|
547
|
+
nonce: options.nonce,
|
|
548
|
+
inserted: inserted,
|
|
549
|
+
registered: {},
|
|
550
|
+
insert: _insert
|
|
551
|
+
};
|
|
552
|
+
cache.sheet.hydrate(nodesToHydrate);
|
|
553
|
+
return cache;
|
|
554
|
+
};
|
|
555
|
+
|
|
556
|
+
export { createCache as default };
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@emotion/cache",
|
|
3
|
+
"version": "11.13.1",
|
|
4
|
+
"description": "emotion's cache",
|
|
5
|
+
"main": "dist/emotion-cache.cjs.js",
|
|
6
|
+
"module": "dist/emotion-cache.esm.js",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"types": {
|
|
10
|
+
"import": "./dist/emotion-cache.cjs.mjs",
|
|
11
|
+
"default": "./dist/emotion-cache.cjs.js"
|
|
12
|
+
},
|
|
13
|
+
"development": {
|
|
14
|
+
"edge-light": {
|
|
15
|
+
"module": "./dist/emotion-cache.development.edge-light.esm.js",
|
|
16
|
+
"import": "./dist/emotion-cache.development.edge-light.cjs.mjs",
|
|
17
|
+
"default": "./dist/emotion-cache.development.edge-light.cjs.js"
|
|
18
|
+
},
|
|
19
|
+
"worker": {
|
|
20
|
+
"module": "./dist/emotion-cache.development.edge-light.esm.js",
|
|
21
|
+
"import": "./dist/emotion-cache.development.edge-light.cjs.mjs",
|
|
22
|
+
"default": "./dist/emotion-cache.development.edge-light.cjs.js"
|
|
23
|
+
},
|
|
24
|
+
"workerd": {
|
|
25
|
+
"module": "./dist/emotion-cache.development.edge-light.esm.js",
|
|
26
|
+
"import": "./dist/emotion-cache.development.edge-light.cjs.mjs",
|
|
27
|
+
"default": "./dist/emotion-cache.development.edge-light.cjs.js"
|
|
28
|
+
},
|
|
29
|
+
"browser": {
|
|
30
|
+
"module": "./dist/emotion-cache.browser.development.esm.js",
|
|
31
|
+
"import": "./dist/emotion-cache.browser.development.cjs.mjs",
|
|
32
|
+
"default": "./dist/emotion-cache.browser.development.cjs.js"
|
|
33
|
+
},
|
|
34
|
+
"module": "./dist/emotion-cache.development.esm.js",
|
|
35
|
+
"import": "./dist/emotion-cache.development.cjs.mjs",
|
|
36
|
+
"default": "./dist/emotion-cache.development.cjs.js"
|
|
37
|
+
},
|
|
38
|
+
"edge-light": {
|
|
39
|
+
"module": "./dist/emotion-cache.edge-light.esm.js",
|
|
40
|
+
"import": "./dist/emotion-cache.edge-light.cjs.mjs",
|
|
41
|
+
"default": "./dist/emotion-cache.edge-light.cjs.js"
|
|
42
|
+
},
|
|
43
|
+
"worker": {
|
|
44
|
+
"module": "./dist/emotion-cache.edge-light.esm.js",
|
|
45
|
+
"import": "./dist/emotion-cache.edge-light.cjs.mjs",
|
|
46
|
+
"default": "./dist/emotion-cache.edge-light.cjs.js"
|
|
47
|
+
},
|
|
48
|
+
"workerd": {
|
|
49
|
+
"module": "./dist/emotion-cache.edge-light.esm.js",
|
|
50
|
+
"import": "./dist/emotion-cache.edge-light.cjs.mjs",
|
|
51
|
+
"default": "./dist/emotion-cache.edge-light.cjs.js"
|
|
52
|
+
},
|
|
53
|
+
"browser": {
|
|
54
|
+
"module": "./dist/emotion-cache.browser.esm.js",
|
|
55
|
+
"import": "./dist/emotion-cache.browser.cjs.mjs",
|
|
56
|
+
"default": "./dist/emotion-cache.browser.cjs.js"
|
|
57
|
+
},
|
|
58
|
+
"module": "./dist/emotion-cache.esm.js",
|
|
59
|
+
"import": "./dist/emotion-cache.cjs.mjs",
|
|
60
|
+
"default": "./dist/emotion-cache.cjs.js"
|
|
61
|
+
},
|
|
62
|
+
"./package.json": "./package.json"
|
|
63
|
+
},
|
|
64
|
+
"imports": {
|
|
65
|
+
"#is-development": {
|
|
66
|
+
"development": "./src/conditions/true.js",
|
|
67
|
+
"default": "./src/conditions/false.js"
|
|
68
|
+
},
|
|
69
|
+
"#is-browser": {
|
|
70
|
+
"edge-light": "./src/conditions/false.js",
|
|
71
|
+
"workerd": "./src/conditions/false.js",
|
|
72
|
+
"worker": "./src/conditions/false.js",
|
|
73
|
+
"browser": "./src/conditions/true.js",
|
|
74
|
+
"default": "./src/conditions/is-browser.js"
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
"types": "types/index.d.ts",
|
|
78
|
+
"license": "MIT",
|
|
79
|
+
"repository": "https://github.com/emotion-js/emotion/tree/main/packages/cache",
|
|
80
|
+
"scripts": {
|
|
81
|
+
"test:typescript": "dtslint types"
|
|
82
|
+
},
|
|
83
|
+
"dependencies": {
|
|
84
|
+
"@emotion/memoize": "^0.9.0",
|
|
85
|
+
"@emotion/sheet": "^1.4.0",
|
|
86
|
+
"@emotion/utils": "^1.4.0",
|
|
87
|
+
"@emotion/weak-memoize": "^0.4.0",
|
|
88
|
+
"stylis": "4.2.0"
|
|
89
|
+
},
|
|
90
|
+
"devDependencies": {
|
|
91
|
+
"@definitelytyped/dtslint": "0.0.112",
|
|
92
|
+
"@emotion/hash": "*",
|
|
93
|
+
"typescript": "^5.4.5"
|
|
94
|
+
},
|
|
95
|
+
"files": [
|
|
96
|
+
"src",
|
|
97
|
+
"dist",
|
|
98
|
+
"types/*.d.ts"
|
|
99
|
+
]
|
|
100
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default false
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default typeof document !== 'undefined'
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default true
|