@measured/puck-plugin-emotion-cache 0.15.0 → 0.16.0-canary.28a62c5
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/index.d.mts +229 -0
- package/dist/index.d.ts +39 -39
- package/dist/index.mjs +833 -0
- package/package.json +8 -5
package/dist/index.d.mts
ADDED
@@ -0,0 +1,229 @@
|
|
1
|
+
import { ReactElement, ReactNode } from 'react';
|
2
|
+
|
3
|
+
type ItemSelector = {
|
4
|
+
index: number;
|
5
|
+
zone?: string;
|
6
|
+
};
|
7
|
+
|
8
|
+
type FieldOption = {
|
9
|
+
label: string;
|
10
|
+
value: string | number | boolean;
|
11
|
+
};
|
12
|
+
type FieldOptions = Array<FieldOption> | ReadonlyArray<FieldOption>;
|
13
|
+
type BaseField = {
|
14
|
+
label?: string;
|
15
|
+
};
|
16
|
+
type TextField = BaseField & {
|
17
|
+
type: "text";
|
18
|
+
};
|
19
|
+
type NumberField = BaseField & {
|
20
|
+
type: "number";
|
21
|
+
min?: number;
|
22
|
+
max?: number;
|
23
|
+
};
|
24
|
+
type TextareaField = BaseField & {
|
25
|
+
type: "textarea";
|
26
|
+
};
|
27
|
+
type SelectField = BaseField & {
|
28
|
+
type: "select";
|
29
|
+
options: FieldOptions;
|
30
|
+
};
|
31
|
+
type RadioField = BaseField & {
|
32
|
+
type: "radio";
|
33
|
+
options: FieldOptions;
|
34
|
+
};
|
35
|
+
type ArrayField<Props extends {
|
36
|
+
[key: string]: any;
|
37
|
+
} = {
|
38
|
+
[key: string]: any;
|
39
|
+
}> = BaseField & {
|
40
|
+
type: "array";
|
41
|
+
arrayFields: {
|
42
|
+
[SubPropName in keyof Props[0]]: Field<Props[0][SubPropName]>;
|
43
|
+
};
|
44
|
+
defaultItemProps?: Props[0];
|
45
|
+
getItemSummary?: (item: Props[0], index?: number) => string;
|
46
|
+
max?: number;
|
47
|
+
min?: number;
|
48
|
+
};
|
49
|
+
type ObjectField<Props extends {
|
50
|
+
[key: string]: any;
|
51
|
+
} = {
|
52
|
+
[key: string]: any;
|
53
|
+
}> = BaseField & {
|
54
|
+
type: "object";
|
55
|
+
objectFields: Props extends any[] ? never : {
|
56
|
+
[SubPropName in keyof Props]: Field<Props[SubPropName]>;
|
57
|
+
};
|
58
|
+
};
|
59
|
+
type Adaptor<AdaptorParams = {}, TableShape extends Record<string, any> = {}, PropShape = TableShape> = {
|
60
|
+
name: string;
|
61
|
+
fetchList: (adaptorParams?: AdaptorParams) => Promise<TableShape[] | null>;
|
62
|
+
mapProp?: (value: TableShape) => PropShape;
|
63
|
+
};
|
64
|
+
type ExternalFieldWithAdaptor<Props extends {
|
65
|
+
[key: string]: any;
|
66
|
+
} = {
|
67
|
+
[key: string]: any;
|
68
|
+
}> = BaseField & {
|
69
|
+
type: "external";
|
70
|
+
placeholder?: string;
|
71
|
+
adaptor: Adaptor<any, any, Props>;
|
72
|
+
adaptorParams?: object;
|
73
|
+
getItemSummary: (item: Props, index?: number) => string;
|
74
|
+
};
|
75
|
+
type ExternalField<Props extends {
|
76
|
+
[key: string]: any;
|
77
|
+
} = {
|
78
|
+
[key: string]: any;
|
79
|
+
}> = BaseField & {
|
80
|
+
type: "external";
|
81
|
+
placeholder?: string;
|
82
|
+
fetchList: (params: {
|
83
|
+
query: string;
|
84
|
+
filters: Record<string, any>;
|
85
|
+
}) => Promise<any[] | null>;
|
86
|
+
mapProp?: (value: any) => Props;
|
87
|
+
mapRow?: (value: any) => Record<string, string | number>;
|
88
|
+
getItemSummary?: (item: Props, index?: number) => string;
|
89
|
+
showSearch?: boolean;
|
90
|
+
initialQuery?: string;
|
91
|
+
filterFields?: Record<string, Field>;
|
92
|
+
initialFilters?: Record<string, any>;
|
93
|
+
};
|
94
|
+
type CustomField<Props extends any = {}> = BaseField & {
|
95
|
+
type: "custom";
|
96
|
+
render: (props: {
|
97
|
+
field: CustomField<Props>;
|
98
|
+
name: string;
|
99
|
+
id: string;
|
100
|
+
value: Props;
|
101
|
+
onChange: (value: Props) => void;
|
102
|
+
readOnly?: boolean;
|
103
|
+
}) => ReactElement;
|
104
|
+
};
|
105
|
+
type Field<Props extends any = any> = TextField | NumberField | TextareaField | SelectField | RadioField | ArrayField<Props extends {
|
106
|
+
[key: string]: any;
|
107
|
+
} ? Props : any> | ObjectField<Props extends {
|
108
|
+
[key: string]: any;
|
109
|
+
} ? Props : any> | ExternalField<Props extends {
|
110
|
+
[key: string]: any;
|
111
|
+
} ? Props : any> | ExternalFieldWithAdaptor<Props extends {
|
112
|
+
[key: string]: any;
|
113
|
+
} ? Props : any> | CustomField<Props>;
|
114
|
+
type FieldProps<ValueType = any, F = Field<any>> = {
|
115
|
+
field: F;
|
116
|
+
value: ValueType;
|
117
|
+
id?: string;
|
118
|
+
onChange: (value: ValueType, uiState?: Partial<UiState>) => void;
|
119
|
+
readOnly?: boolean;
|
120
|
+
};
|
121
|
+
|
122
|
+
type ItemWithId = {
|
123
|
+
_arrayId: string;
|
124
|
+
_originalIndex: number;
|
125
|
+
};
|
126
|
+
type ArrayState = {
|
127
|
+
items: ItemWithId[];
|
128
|
+
openId: string;
|
129
|
+
};
|
130
|
+
type UiState = {
|
131
|
+
leftSideBarVisible: boolean;
|
132
|
+
rightSideBarVisible: boolean;
|
133
|
+
itemSelector: ItemSelector | null;
|
134
|
+
arrayState: Record<string, ArrayState | undefined>;
|
135
|
+
componentList: Record<string, {
|
136
|
+
components?: string[];
|
137
|
+
title?: string;
|
138
|
+
visible?: boolean;
|
139
|
+
expanded?: boolean;
|
140
|
+
}>;
|
141
|
+
isDragging: boolean;
|
142
|
+
viewports: {
|
143
|
+
current: {
|
144
|
+
width: number;
|
145
|
+
height: number | "auto";
|
146
|
+
};
|
147
|
+
controlsVisible: boolean;
|
148
|
+
options: Viewport[];
|
149
|
+
};
|
150
|
+
};
|
151
|
+
|
152
|
+
type RenderFunc<Props extends {
|
153
|
+
[key: string]: any;
|
154
|
+
} = {
|
155
|
+
children: ReactNode;
|
156
|
+
}> = (props: Props) => ReactElement;
|
157
|
+
declare const overrideKeys: readonly ["header", "headerActions", "fields", "fieldLabel", "components", "componentItem", "outline", "puck", "preview"];
|
158
|
+
type OverrideKey = (typeof overrideKeys)[number];
|
159
|
+
type OverridesGeneric<Shape extends {
|
160
|
+
[key in OverrideKey]: any;
|
161
|
+
}> = Shape;
|
162
|
+
type Overrides = OverridesGeneric<{
|
163
|
+
fieldTypes: Partial<FieldRenderFunctions>;
|
164
|
+
header: RenderFunc<{
|
165
|
+
actions: ReactNode;
|
166
|
+
children: ReactNode;
|
167
|
+
}>;
|
168
|
+
actionBar: RenderFunc<{
|
169
|
+
label?: string;
|
170
|
+
children: ReactNode;
|
171
|
+
}>;
|
172
|
+
headerActions: RenderFunc<{
|
173
|
+
children: ReactNode;
|
174
|
+
}>;
|
175
|
+
preview: RenderFunc;
|
176
|
+
fields: RenderFunc<{
|
177
|
+
children: ReactNode;
|
178
|
+
isLoading: boolean;
|
179
|
+
itemSelector?: ItemSelector | null;
|
180
|
+
}>;
|
181
|
+
fieldLabel: RenderFunc<{
|
182
|
+
children?: ReactNode;
|
183
|
+
icon?: ReactNode;
|
184
|
+
label: string;
|
185
|
+
el?: "label" | "div";
|
186
|
+
readOnly?: boolean;
|
187
|
+
className?: string;
|
188
|
+
}>;
|
189
|
+
components: RenderFunc;
|
190
|
+
componentItem: RenderFunc<{
|
191
|
+
children: ReactNode;
|
192
|
+
name: string;
|
193
|
+
}>;
|
194
|
+
iframe: RenderFunc<{
|
195
|
+
children: ReactNode;
|
196
|
+
document?: Document;
|
197
|
+
}>;
|
198
|
+
outline: RenderFunc;
|
199
|
+
puck: RenderFunc;
|
200
|
+
}>;
|
201
|
+
type FieldRenderFunctions = Omit<{
|
202
|
+
[Type in Field["type"]]: React.FunctionComponent<FieldProps<Extract<Field, {
|
203
|
+
type: Type;
|
204
|
+
}>> & {
|
205
|
+
children: ReactNode;
|
206
|
+
name: string;
|
207
|
+
}>;
|
208
|
+
}, "custom"> & {
|
209
|
+
[key: string]: React.FunctionComponent<FieldProps<any> & {
|
210
|
+
children: ReactNode;
|
211
|
+
name: string;
|
212
|
+
}>;
|
213
|
+
};
|
214
|
+
|
215
|
+
type iconTypes = "Smartphone" | "Monitor" | "Tablet";
|
216
|
+
type Viewport = {
|
217
|
+
width: number;
|
218
|
+
height?: number | "auto";
|
219
|
+
label?: string;
|
220
|
+
icon?: iconTypes | ReactNode;
|
221
|
+
};
|
222
|
+
|
223
|
+
type Plugin = {
|
224
|
+
overrides: Partial<Overrides>;
|
225
|
+
};
|
226
|
+
|
227
|
+
declare const createEmotionCachePlugin: (key: string) => Plugin;
|
228
|
+
|
229
|
+
export { createEmotionCachePlugin as default };
|
package/dist/index.d.ts
CHANGED
@@ -1,48 +1,10 @@
|
|
1
|
-
import {
|
1
|
+
import { ReactElement, ReactNode } from 'react';
|
2
2
|
|
3
3
|
type ItemSelector = {
|
4
4
|
index: number;
|
5
5
|
zone?: string;
|
6
6
|
};
|
7
7
|
|
8
|
-
type iconTypes = "Smartphone" | "Monitor" | "Tablet";
|
9
|
-
type Viewport = {
|
10
|
-
width: number;
|
11
|
-
height?: number | "auto";
|
12
|
-
label?: string;
|
13
|
-
icon?: iconTypes | ReactNode;
|
14
|
-
};
|
15
|
-
|
16
|
-
type ItemWithId = {
|
17
|
-
_arrayId: string;
|
18
|
-
_originalIndex: number;
|
19
|
-
};
|
20
|
-
type ArrayState = {
|
21
|
-
items: ItemWithId[];
|
22
|
-
openId: string;
|
23
|
-
};
|
24
|
-
type UiState = {
|
25
|
-
leftSideBarVisible: boolean;
|
26
|
-
rightSideBarVisible: boolean;
|
27
|
-
itemSelector: ItemSelector | null;
|
28
|
-
arrayState: Record<string, ArrayState | undefined>;
|
29
|
-
componentList: Record<string, {
|
30
|
-
components?: string[];
|
31
|
-
title?: string;
|
32
|
-
visible?: boolean;
|
33
|
-
expanded?: boolean;
|
34
|
-
}>;
|
35
|
-
isDragging: boolean;
|
36
|
-
viewports: {
|
37
|
-
current: {
|
38
|
-
width: number;
|
39
|
-
height: number | "auto";
|
40
|
-
};
|
41
|
-
controlsVisible: boolean;
|
42
|
-
options: Viewport[];
|
43
|
-
};
|
44
|
-
};
|
45
|
-
|
46
8
|
type FieldOption = {
|
47
9
|
label: string;
|
48
10
|
value: string | number | boolean;
|
@@ -157,6 +119,36 @@ type FieldProps<ValueType = any, F = Field<any>> = {
|
|
157
119
|
readOnly?: boolean;
|
158
120
|
};
|
159
121
|
|
122
|
+
type ItemWithId = {
|
123
|
+
_arrayId: string;
|
124
|
+
_originalIndex: number;
|
125
|
+
};
|
126
|
+
type ArrayState = {
|
127
|
+
items: ItemWithId[];
|
128
|
+
openId: string;
|
129
|
+
};
|
130
|
+
type UiState = {
|
131
|
+
leftSideBarVisible: boolean;
|
132
|
+
rightSideBarVisible: boolean;
|
133
|
+
itemSelector: ItemSelector | null;
|
134
|
+
arrayState: Record<string, ArrayState | undefined>;
|
135
|
+
componentList: Record<string, {
|
136
|
+
components?: string[];
|
137
|
+
title?: string;
|
138
|
+
visible?: boolean;
|
139
|
+
expanded?: boolean;
|
140
|
+
}>;
|
141
|
+
isDragging: boolean;
|
142
|
+
viewports: {
|
143
|
+
current: {
|
144
|
+
width: number;
|
145
|
+
height: number | "auto";
|
146
|
+
};
|
147
|
+
controlsVisible: boolean;
|
148
|
+
options: Viewport[];
|
149
|
+
};
|
150
|
+
};
|
151
|
+
|
160
152
|
type RenderFunc<Props extends {
|
161
153
|
[key: string]: any;
|
162
154
|
} = {
|
@@ -220,6 +212,14 @@ type FieldRenderFunctions = Omit<{
|
|
220
212
|
}>;
|
221
213
|
};
|
222
214
|
|
215
|
+
type iconTypes = "Smartphone" | "Monitor" | "Tablet";
|
216
|
+
type Viewport = {
|
217
|
+
width: number;
|
218
|
+
height?: number | "auto";
|
219
|
+
label?: string;
|
220
|
+
icon?: iconTypes | ReactNode;
|
221
|
+
};
|
222
|
+
|
223
223
|
type Plugin = {
|
224
224
|
overrides: Partial<Overrides>;
|
225
225
|
};
|
package/dist/index.mjs
ADDED
@@ -0,0 +1,833 @@
|
|
1
|
+
// ../tsup-config/react-import.js
|
2
|
+
import React from "react";
|
3
|
+
|
4
|
+
// index.tsx
|
5
|
+
import { useEffect, useState } from "react";
|
6
|
+
|
7
|
+
// ../../node_modules/@emotion/sheet/dist/emotion-sheet.esm.js
|
8
|
+
var isDevelopment = false;
|
9
|
+
function sheetForTag(tag) {
|
10
|
+
if (tag.sheet) {
|
11
|
+
return tag.sheet;
|
12
|
+
}
|
13
|
+
for (var i = 0; i < document.styleSheets.length; i++) {
|
14
|
+
if (document.styleSheets[i].ownerNode === tag) {
|
15
|
+
return document.styleSheets[i];
|
16
|
+
}
|
17
|
+
}
|
18
|
+
return void 0;
|
19
|
+
}
|
20
|
+
function createStyleElement(options) {
|
21
|
+
var tag = document.createElement("style");
|
22
|
+
tag.setAttribute("data-emotion", options.key);
|
23
|
+
if (options.nonce !== void 0) {
|
24
|
+
tag.setAttribute("nonce", options.nonce);
|
25
|
+
}
|
26
|
+
tag.appendChild(document.createTextNode(""));
|
27
|
+
tag.setAttribute("data-s", "");
|
28
|
+
return tag;
|
29
|
+
}
|
30
|
+
var StyleSheet = /* @__PURE__ */ function() {
|
31
|
+
function StyleSheet2(options) {
|
32
|
+
var _this = this;
|
33
|
+
this._insertTag = function(tag) {
|
34
|
+
var before;
|
35
|
+
if (_this.tags.length === 0) {
|
36
|
+
if (_this.insertionPoint) {
|
37
|
+
before = _this.insertionPoint.nextSibling;
|
38
|
+
} else if (_this.prepend) {
|
39
|
+
before = _this.container.firstChild;
|
40
|
+
} else {
|
41
|
+
before = _this.before;
|
42
|
+
}
|
43
|
+
} else {
|
44
|
+
before = _this.tags[_this.tags.length - 1].nextSibling;
|
45
|
+
}
|
46
|
+
_this.container.insertBefore(tag, before);
|
47
|
+
_this.tags.push(tag);
|
48
|
+
};
|
49
|
+
this.isSpeedy = options.speedy === void 0 ? !isDevelopment : options.speedy;
|
50
|
+
this.tags = [];
|
51
|
+
this.ctr = 0;
|
52
|
+
this.nonce = options.nonce;
|
53
|
+
this.key = options.key;
|
54
|
+
this.container = options.container;
|
55
|
+
this.prepend = options.prepend;
|
56
|
+
this.insertionPoint = options.insertionPoint;
|
57
|
+
this.before = null;
|
58
|
+
}
|
59
|
+
var _proto = StyleSheet2.prototype;
|
60
|
+
_proto.hydrate = function hydrate(nodes) {
|
61
|
+
nodes.forEach(this._insertTag);
|
62
|
+
};
|
63
|
+
_proto.insert = function insert(rule) {
|
64
|
+
if (this.ctr % (this.isSpeedy ? 65e3 : 1) === 0) {
|
65
|
+
this._insertTag(createStyleElement(this));
|
66
|
+
}
|
67
|
+
var tag = this.tags[this.tags.length - 1];
|
68
|
+
if (this.isSpeedy) {
|
69
|
+
var sheet = sheetForTag(tag);
|
70
|
+
try {
|
71
|
+
sheet.insertRule(rule, sheet.cssRules.length);
|
72
|
+
} catch (e) {
|
73
|
+
}
|
74
|
+
} else {
|
75
|
+
tag.appendChild(document.createTextNode(rule));
|
76
|
+
}
|
77
|
+
this.ctr++;
|
78
|
+
};
|
79
|
+
_proto.flush = function flush() {
|
80
|
+
this.tags.forEach(function(tag) {
|
81
|
+
var _tag$parentNode;
|
82
|
+
return (_tag$parentNode = tag.parentNode) == null ? void 0 : _tag$parentNode.removeChild(tag);
|
83
|
+
});
|
84
|
+
this.tags = [];
|
85
|
+
this.ctr = 0;
|
86
|
+
};
|
87
|
+
return StyleSheet2;
|
88
|
+
}();
|
89
|
+
|
90
|
+
// ../../node_modules/stylis/src/Enum.js
|
91
|
+
var MS = "-ms-";
|
92
|
+
var MOZ = "-moz-";
|
93
|
+
var WEBKIT = "-webkit-";
|
94
|
+
var COMMENT = "comm";
|
95
|
+
var RULESET = "rule";
|
96
|
+
var DECLARATION = "decl";
|
97
|
+
var IMPORT = "@import";
|
98
|
+
var KEYFRAMES = "@keyframes";
|
99
|
+
var LAYER = "@layer";
|
100
|
+
|
101
|
+
// ../../node_modules/stylis/src/Utility.js
|
102
|
+
var abs = Math.abs;
|
103
|
+
var from = String.fromCharCode;
|
104
|
+
var assign = Object.assign;
|
105
|
+
function hash(value, length2) {
|
106
|
+
return charat(value, 0) ^ 45 ? (((length2 << 2 ^ charat(value, 0)) << 2 ^ charat(value, 1)) << 2 ^ charat(value, 2)) << 2 ^ charat(value, 3) : 0;
|
107
|
+
}
|
108
|
+
function trim(value) {
|
109
|
+
return value.trim();
|
110
|
+
}
|
111
|
+
function match(value, pattern) {
|
112
|
+
return (value = pattern.exec(value)) ? value[0] : value;
|
113
|
+
}
|
114
|
+
function replace(value, pattern, replacement) {
|
115
|
+
return value.replace(pattern, replacement);
|
116
|
+
}
|
117
|
+
function indexof(value, search) {
|
118
|
+
return value.indexOf(search);
|
119
|
+
}
|
120
|
+
function charat(value, index) {
|
121
|
+
return value.charCodeAt(index) | 0;
|
122
|
+
}
|
123
|
+
function substr(value, begin, end) {
|
124
|
+
return value.slice(begin, end);
|
125
|
+
}
|
126
|
+
function strlen(value) {
|
127
|
+
return value.length;
|
128
|
+
}
|
129
|
+
function sizeof(value) {
|
130
|
+
return value.length;
|
131
|
+
}
|
132
|
+
function append(value, array) {
|
133
|
+
return array.push(value), value;
|
134
|
+
}
|
135
|
+
function combine(array, callback) {
|
136
|
+
return array.map(callback).join("");
|
137
|
+
}
|
138
|
+
|
139
|
+
// ../../node_modules/stylis/src/Tokenizer.js
|
140
|
+
var line = 1;
|
141
|
+
var column = 1;
|
142
|
+
var length = 0;
|
143
|
+
var position = 0;
|
144
|
+
var character = 0;
|
145
|
+
var characters = "";
|
146
|
+
function node(value, root, parent, type, props, children, length2) {
|
147
|
+
return { value, root, parent, type, props, children, line, column, length: length2, return: "" };
|
148
|
+
}
|
149
|
+
function copy(root, props) {
|
150
|
+
return assign(node("", null, null, "", null, null, 0), root, { length: -root.length }, props);
|
151
|
+
}
|
152
|
+
function char() {
|
153
|
+
return character;
|
154
|
+
}
|
155
|
+
function prev() {
|
156
|
+
character = position > 0 ? charat(characters, --position) : 0;
|
157
|
+
if (column--, character === 10)
|
158
|
+
column = 1, line--;
|
159
|
+
return character;
|
160
|
+
}
|
161
|
+
function next() {
|
162
|
+
character = position < length ? charat(characters, position++) : 0;
|
163
|
+
if (column++, character === 10)
|
164
|
+
column = 1, line++;
|
165
|
+
return character;
|
166
|
+
}
|
167
|
+
function peek() {
|
168
|
+
return charat(characters, position);
|
169
|
+
}
|
170
|
+
function caret() {
|
171
|
+
return position;
|
172
|
+
}
|
173
|
+
function slice(begin, end) {
|
174
|
+
return substr(characters, begin, end);
|
175
|
+
}
|
176
|
+
function token(type) {
|
177
|
+
switch (type) {
|
178
|
+
case 0:
|
179
|
+
case 9:
|
180
|
+
case 10:
|
181
|
+
case 13:
|
182
|
+
case 32:
|
183
|
+
return 5;
|
184
|
+
case 33:
|
185
|
+
case 43:
|
186
|
+
case 44:
|
187
|
+
case 47:
|
188
|
+
case 62:
|
189
|
+
case 64:
|
190
|
+
case 126:
|
191
|
+
case 59:
|
192
|
+
case 123:
|
193
|
+
case 125:
|
194
|
+
return 4;
|
195
|
+
case 58:
|
196
|
+
return 3;
|
197
|
+
case 34:
|
198
|
+
case 39:
|
199
|
+
case 40:
|
200
|
+
case 91:
|
201
|
+
return 2;
|
202
|
+
case 41:
|
203
|
+
case 93:
|
204
|
+
return 1;
|
205
|
+
}
|
206
|
+
return 0;
|
207
|
+
}
|
208
|
+
function alloc(value) {
|
209
|
+
return line = column = 1, length = strlen(characters = value), position = 0, [];
|
210
|
+
}
|
211
|
+
function dealloc(value) {
|
212
|
+
return characters = "", value;
|
213
|
+
}
|
214
|
+
function delimit(type) {
|
215
|
+
return trim(slice(position - 1, delimiter(type === 91 ? type + 2 : type === 40 ? type + 1 : type)));
|
216
|
+
}
|
217
|
+
function whitespace(type) {
|
218
|
+
while (character = peek())
|
219
|
+
if (character < 33)
|
220
|
+
next();
|
221
|
+
else
|
222
|
+
break;
|
223
|
+
return token(type) > 2 || token(character) > 3 ? "" : " ";
|
224
|
+
}
|
225
|
+
function escaping(index, count) {
|
226
|
+
while (--count && next())
|
227
|
+
if (character < 48 || character > 102 || character > 57 && character < 65 || character > 70 && character < 97)
|
228
|
+
break;
|
229
|
+
return slice(index, caret() + (count < 6 && peek() == 32 && next() == 32));
|
230
|
+
}
|
231
|
+
function delimiter(type) {
|
232
|
+
while (next())
|
233
|
+
switch (character) {
|
234
|
+
case type:
|
235
|
+
return position;
|
236
|
+
case 34:
|
237
|
+
case 39:
|
238
|
+
if (type !== 34 && type !== 39)
|
239
|
+
delimiter(character);
|
240
|
+
break;
|
241
|
+
case 40:
|
242
|
+
if (type === 41)
|
243
|
+
delimiter(type);
|
244
|
+
break;
|
245
|
+
case 92:
|
246
|
+
next();
|
247
|
+
break;
|
248
|
+
}
|
249
|
+
return position;
|
250
|
+
}
|
251
|
+
function commenter(type, index) {
|
252
|
+
while (next())
|
253
|
+
if (type + character === 47 + 10)
|
254
|
+
break;
|
255
|
+
else if (type + character === 42 + 42 && peek() === 47)
|
256
|
+
break;
|
257
|
+
return "/*" + slice(index, position - 1) + "*" + from(type === 47 ? type : next());
|
258
|
+
}
|
259
|
+
function identifier(index) {
|
260
|
+
while (!token(peek()))
|
261
|
+
next();
|
262
|
+
return slice(index, position);
|
263
|
+
}
|
264
|
+
|
265
|
+
// ../../node_modules/stylis/src/Parser.js
|
266
|
+
function compile(value) {
|
267
|
+
return dealloc(parse("", null, null, null, [""], value = alloc(value), 0, [0], value));
|
268
|
+
}
|
269
|
+
function parse(value, root, parent, rule, rules, rulesets, pseudo, points, declarations) {
|
270
|
+
var index = 0;
|
271
|
+
var offset = 0;
|
272
|
+
var length2 = pseudo;
|
273
|
+
var atrule = 0;
|
274
|
+
var property = 0;
|
275
|
+
var previous = 0;
|
276
|
+
var variable = 1;
|
277
|
+
var scanning = 1;
|
278
|
+
var ampersand = 1;
|
279
|
+
var character2 = 0;
|
280
|
+
var type = "";
|
281
|
+
var props = rules;
|
282
|
+
var children = rulesets;
|
283
|
+
var reference = rule;
|
284
|
+
var characters2 = type;
|
285
|
+
while (scanning)
|
286
|
+
switch (previous = character2, character2 = next()) {
|
287
|
+
case 40:
|
288
|
+
if (previous != 108 && charat(characters2, length2 - 1) == 58) {
|
289
|
+
if (indexof(characters2 += replace(delimit(character2), "&", "&\f"), "&\f") != -1)
|
290
|
+
ampersand = -1;
|
291
|
+
break;
|
292
|
+
}
|
293
|
+
case 34:
|
294
|
+
case 39:
|
295
|
+
case 91:
|
296
|
+
characters2 += delimit(character2);
|
297
|
+
break;
|
298
|
+
case 9:
|
299
|
+
case 10:
|
300
|
+
case 13:
|
301
|
+
case 32:
|
302
|
+
characters2 += whitespace(previous);
|
303
|
+
break;
|
304
|
+
case 92:
|
305
|
+
characters2 += escaping(caret() - 1, 7);
|
306
|
+
continue;
|
307
|
+
case 47:
|
308
|
+
switch (peek()) {
|
309
|
+
case 42:
|
310
|
+
case 47:
|
311
|
+
append(comment(commenter(next(), caret()), root, parent), declarations);
|
312
|
+
break;
|
313
|
+
default:
|
314
|
+
characters2 += "/";
|
315
|
+
}
|
316
|
+
break;
|
317
|
+
case 123 * variable:
|
318
|
+
points[index++] = strlen(characters2) * ampersand;
|
319
|
+
case 125 * variable:
|
320
|
+
case 59:
|
321
|
+
case 0:
|
322
|
+
switch (character2) {
|
323
|
+
case 0:
|
324
|
+
case 125:
|
325
|
+
scanning = 0;
|
326
|
+
case 59 + offset:
|
327
|
+
if (ampersand == -1) characters2 = replace(characters2, /\f/g, "");
|
328
|
+
if (property > 0 && strlen(characters2) - length2)
|
329
|
+
append(property > 32 ? declaration(characters2 + ";", rule, parent, length2 - 1) : declaration(replace(characters2, " ", "") + ";", rule, parent, length2 - 2), declarations);
|
330
|
+
break;
|
331
|
+
case 59:
|
332
|
+
characters2 += ";";
|
333
|
+
default:
|
334
|
+
append(reference = ruleset(characters2, root, parent, index, offset, rules, points, type, props = [], children = [], length2), rulesets);
|
335
|
+
if (character2 === 123)
|
336
|
+
if (offset === 0)
|
337
|
+
parse(characters2, root, reference, reference, props, rulesets, length2, points, children);
|
338
|
+
else
|
339
|
+
switch (atrule === 99 && charat(characters2, 3) === 110 ? 100 : atrule) {
|
340
|
+
case 100:
|
341
|
+
case 108:
|
342
|
+
case 109:
|
343
|
+
case 115:
|
344
|
+
parse(value, reference, reference, rule && append(ruleset(value, reference, reference, 0, 0, rules, points, type, rules, props = [], length2), children), rules, children, length2, points, rule ? props : children);
|
345
|
+
break;
|
346
|
+
default:
|
347
|
+
parse(characters2, reference, reference, reference, [""], children, 0, points, children);
|
348
|
+
}
|
349
|
+
}
|
350
|
+
index = offset = property = 0, variable = ampersand = 1, type = characters2 = "", length2 = pseudo;
|
351
|
+
break;
|
352
|
+
case 58:
|
353
|
+
length2 = 1 + strlen(characters2), property = previous;
|
354
|
+
default:
|
355
|
+
if (variable < 1) {
|
356
|
+
if (character2 == 123)
|
357
|
+
--variable;
|
358
|
+
else if (character2 == 125 && variable++ == 0 && prev() == 125)
|
359
|
+
continue;
|
360
|
+
}
|
361
|
+
switch (characters2 += from(character2), character2 * variable) {
|
362
|
+
case 38:
|
363
|
+
ampersand = offset > 0 ? 1 : (characters2 += "\f", -1);
|
364
|
+
break;
|
365
|
+
case 44:
|
366
|
+
points[index++] = (strlen(characters2) - 1) * ampersand, ampersand = 1;
|
367
|
+
break;
|
368
|
+
case 64:
|
369
|
+
if (peek() === 45)
|
370
|
+
characters2 += delimit(next());
|
371
|
+
atrule = peek(), offset = length2 = strlen(type = characters2 += identifier(caret())), character2++;
|
372
|
+
break;
|
373
|
+
case 45:
|
374
|
+
if (previous === 45 && strlen(characters2) == 2)
|
375
|
+
variable = 0;
|
376
|
+
}
|
377
|
+
}
|
378
|
+
return rulesets;
|
379
|
+
}
|
380
|
+
function ruleset(value, root, parent, index, offset, rules, points, type, props, children, length2) {
|
381
|
+
var post = offset - 1;
|
382
|
+
var rule = offset === 0 ? rules : [""];
|
383
|
+
var size = sizeof(rule);
|
384
|
+
for (var i = 0, j = 0, k = 0; i < index; ++i)
|
385
|
+
for (var x = 0, y = substr(value, post + 1, post = abs(j = points[i])), z = value; x < size; ++x)
|
386
|
+
if (z = trim(j > 0 ? rule[x] + " " + y : replace(y, /&\f/g, rule[x])))
|
387
|
+
props[k++] = z;
|
388
|
+
return node(value, root, parent, offset === 0 ? RULESET : type, props, children, length2);
|
389
|
+
}
|
390
|
+
function comment(value, root, parent) {
|
391
|
+
return node(value, root, parent, COMMENT, from(char()), substr(value, 2, -2), 0);
|
392
|
+
}
|
393
|
+
function declaration(value, root, parent, length2) {
|
394
|
+
return node(value, root, parent, DECLARATION, substr(value, 0, length2), substr(value, length2 + 1, -1), length2);
|
395
|
+
}
|
396
|
+
|
397
|
+
// ../../node_modules/stylis/src/Serializer.js
|
398
|
+
function serialize(children, callback) {
|
399
|
+
var output = "";
|
400
|
+
var length2 = sizeof(children);
|
401
|
+
for (var i = 0; i < length2; i++)
|
402
|
+
output += callback(children[i], i, children, callback) || "";
|
403
|
+
return output;
|
404
|
+
}
|
405
|
+
function stringify(element, index, children, callback) {
|
406
|
+
switch (element.type) {
|
407
|
+
case LAYER:
|
408
|
+
if (element.children.length) break;
|
409
|
+
case IMPORT:
|
410
|
+
case DECLARATION:
|
411
|
+
return element.return = element.return || element.value;
|
412
|
+
case COMMENT:
|
413
|
+
return "";
|
414
|
+
case KEYFRAMES:
|
415
|
+
return element.return = element.value + "{" + serialize(element.children, callback) + "}";
|
416
|
+
case RULESET:
|
417
|
+
element.value = element.props.join(",");
|
418
|
+
}
|
419
|
+
return strlen(children = serialize(element.children, callback)) ? element.return = element.value + "{" + children + "}" : "";
|
420
|
+
}
|
421
|
+
|
422
|
+
// ../../node_modules/stylis/src/Middleware.js
|
423
|
+
function middleware(collection) {
|
424
|
+
var length2 = sizeof(collection);
|
425
|
+
return function(element, index, children, callback) {
|
426
|
+
var output = "";
|
427
|
+
for (var i = 0; i < length2; i++)
|
428
|
+
output += collection[i](element, index, children, callback) || "";
|
429
|
+
return output;
|
430
|
+
};
|
431
|
+
}
|
432
|
+
function rulesheet(callback) {
|
433
|
+
return function(element) {
|
434
|
+
if (!element.root) {
|
435
|
+
if (element = element.return)
|
436
|
+
callback(element);
|
437
|
+
}
|
438
|
+
};
|
439
|
+
}
|
440
|
+
|
441
|
+
// ../../node_modules/@emotion/weak-memoize/dist/emotion-weak-memoize.esm.js
|
442
|
+
var weakMemoize = function weakMemoize2(func) {
|
443
|
+
var cache = /* @__PURE__ */ new WeakMap();
|
444
|
+
return function(arg) {
|
445
|
+
if (cache.has(arg)) {
|
446
|
+
return cache.get(arg);
|
447
|
+
}
|
448
|
+
var ret = func(arg);
|
449
|
+
cache.set(arg, ret);
|
450
|
+
return ret;
|
451
|
+
};
|
452
|
+
};
|
453
|
+
|
454
|
+
// ../../node_modules/@emotion/memoize/dist/emotion-memoize.esm.js
|
455
|
+
function memoize(fn) {
|
456
|
+
var cache = /* @__PURE__ */ Object.create(null);
|
457
|
+
return function(arg) {
|
458
|
+
if (cache[arg] === void 0) cache[arg] = fn(arg);
|
459
|
+
return cache[arg];
|
460
|
+
};
|
461
|
+
}
|
462
|
+
|
463
|
+
// ../../node_modules/@emotion/cache/dist/emotion-cache.esm.js
|
464
|
+
var isBrowser = typeof document !== "undefined";
|
465
|
+
var identifierWithPointTracking = function identifierWithPointTracking2(begin, points, index) {
|
466
|
+
var previous = 0;
|
467
|
+
var character2 = 0;
|
468
|
+
while (true) {
|
469
|
+
previous = character2;
|
470
|
+
character2 = peek();
|
471
|
+
if (previous === 38 && character2 === 12) {
|
472
|
+
points[index] = 1;
|
473
|
+
}
|
474
|
+
if (token(character2)) {
|
475
|
+
break;
|
476
|
+
}
|
477
|
+
next();
|
478
|
+
}
|
479
|
+
return slice(begin, position);
|
480
|
+
};
|
481
|
+
var toRules = function toRules2(parsed, points) {
|
482
|
+
var index = -1;
|
483
|
+
var character2 = 44;
|
484
|
+
do {
|
485
|
+
switch (token(character2)) {
|
486
|
+
case 0:
|
487
|
+
if (character2 === 38 && peek() === 12) {
|
488
|
+
points[index] = 1;
|
489
|
+
}
|
490
|
+
parsed[index] += identifierWithPointTracking(position - 1, points, index);
|
491
|
+
break;
|
492
|
+
case 2:
|
493
|
+
parsed[index] += delimit(character2);
|
494
|
+
break;
|
495
|
+
case 4:
|
496
|
+
if (character2 === 44) {
|
497
|
+
parsed[++index] = peek() === 58 ? "&\f" : "";
|
498
|
+
points[index] = parsed[index].length;
|
499
|
+
break;
|
500
|
+
}
|
501
|
+
default:
|
502
|
+
parsed[index] += from(character2);
|
503
|
+
}
|
504
|
+
} while (character2 = next());
|
505
|
+
return parsed;
|
506
|
+
};
|
507
|
+
var getRules = function getRules2(value, points) {
|
508
|
+
return dealloc(toRules(alloc(value), points));
|
509
|
+
};
|
510
|
+
var fixedElements = /* @__PURE__ */ new WeakMap();
|
511
|
+
var compat = function compat2(element) {
|
512
|
+
if (element.type !== "rule" || !element.parent || // positive .length indicates that this rule contains pseudo
|
513
|
+
// negative .length indicates that this rule has been already prefixed
|
514
|
+
element.length < 1) {
|
515
|
+
return;
|
516
|
+
}
|
517
|
+
var value = element.value, parent = element.parent;
|
518
|
+
var isImplicitRule = element.column === parent.column && element.line === parent.line;
|
519
|
+
while (parent.type !== "rule") {
|
520
|
+
parent = parent.parent;
|
521
|
+
if (!parent) return;
|
522
|
+
}
|
523
|
+
if (element.props.length === 1 && value.charCodeAt(0) !== 58 && !fixedElements.get(parent)) {
|
524
|
+
return;
|
525
|
+
}
|
526
|
+
if (isImplicitRule) {
|
527
|
+
return;
|
528
|
+
}
|
529
|
+
fixedElements.set(element, true);
|
530
|
+
var points = [];
|
531
|
+
var rules = getRules(value, points);
|
532
|
+
var parentRules = parent.props;
|
533
|
+
for (var i = 0, k = 0; i < rules.length; i++) {
|
534
|
+
for (var j = 0; j < parentRules.length; j++, k++) {
|
535
|
+
element.props[k] = points[i] ? rules[i].replace(/&\f/g, parentRules[j]) : parentRules[j] + " " + rules[i];
|
536
|
+
}
|
537
|
+
}
|
538
|
+
};
|
539
|
+
var removeLabel = function removeLabel2(element) {
|
540
|
+
if (element.type === "decl") {
|
541
|
+
var value = element.value;
|
542
|
+
if (
|
543
|
+
// charcode for l
|
544
|
+
value.charCodeAt(0) === 108 && // charcode for b
|
545
|
+
value.charCodeAt(2) === 98
|
546
|
+
) {
|
547
|
+
element["return"] = "";
|
548
|
+
element.value = "";
|
549
|
+
}
|
550
|
+
}
|
551
|
+
};
|
552
|
+
function prefix(value, length2) {
|
553
|
+
switch (hash(value, length2)) {
|
554
|
+
case 5103:
|
555
|
+
return WEBKIT + "print-" + value + value;
|
556
|
+
case 5737:
|
557
|
+
case 4201:
|
558
|
+
case 3177:
|
559
|
+
case 3433:
|
560
|
+
case 1641:
|
561
|
+
case 4457:
|
562
|
+
case 2921:
|
563
|
+
case 5572:
|
564
|
+
case 6356:
|
565
|
+
case 5844:
|
566
|
+
case 3191:
|
567
|
+
case 6645:
|
568
|
+
case 3005:
|
569
|
+
case 6391:
|
570
|
+
case 5879:
|
571
|
+
case 5623:
|
572
|
+
case 6135:
|
573
|
+
case 4599:
|
574
|
+
case 4855:
|
575
|
+
case 4215:
|
576
|
+
case 6389:
|
577
|
+
case 5109:
|
578
|
+
case 5365:
|
579
|
+
case 5621:
|
580
|
+
case 3829:
|
581
|
+
return WEBKIT + value + value;
|
582
|
+
case 5349:
|
583
|
+
case 4246:
|
584
|
+
case 4810:
|
585
|
+
case 6968:
|
586
|
+
case 2756:
|
587
|
+
return WEBKIT + value + MOZ + value + MS + value + value;
|
588
|
+
case 6828:
|
589
|
+
case 4268:
|
590
|
+
return WEBKIT + value + MS + value + value;
|
591
|
+
case 6165:
|
592
|
+
return WEBKIT + value + MS + "flex-" + value + value;
|
593
|
+
case 5187:
|
594
|
+
return WEBKIT + value + replace(value, /(\w+).+(:[^]+)/, WEBKIT + "box-$1$2" + MS + "flex-$1$2") + value;
|
595
|
+
case 5443:
|
596
|
+
return WEBKIT + value + MS + "flex-item-" + replace(value, /flex-|-self/, "") + value;
|
597
|
+
case 4675:
|
598
|
+
return WEBKIT + value + MS + "flex-line-pack" + replace(value, /align-content|flex-|-self/, "") + value;
|
599
|
+
case 5548:
|
600
|
+
return WEBKIT + value + MS + replace(value, "shrink", "negative") + value;
|
601
|
+
case 5292:
|
602
|
+
return WEBKIT + value + MS + replace(value, "basis", "preferred-size") + value;
|
603
|
+
case 6060:
|
604
|
+
return WEBKIT + "box-" + replace(value, "-grow", "") + WEBKIT + value + MS + replace(value, "grow", "positive") + value;
|
605
|
+
case 4554:
|
606
|
+
return WEBKIT + replace(value, /([^-])(transform)/g, "$1" + WEBKIT + "$2") + value;
|
607
|
+
case 6187:
|
608
|
+
return replace(replace(replace(value, /(zoom-|grab)/, WEBKIT + "$1"), /(image-set)/, WEBKIT + "$1"), value, "") + value;
|
609
|
+
case 5495:
|
610
|
+
case 3959:
|
611
|
+
return replace(value, /(image-set\([^]*)/, WEBKIT + "$1$`$1");
|
612
|
+
case 4968:
|
613
|
+
return replace(replace(value, /(.+:)(flex-)?(.*)/, WEBKIT + "box-pack:$3" + MS + "flex-pack:$3"), /s.+-b[^;]+/, "justify") + WEBKIT + value + value;
|
614
|
+
case 4095:
|
615
|
+
case 3583:
|
616
|
+
case 4068:
|
617
|
+
case 2532:
|
618
|
+
return replace(value, /(.+)-inline(.+)/, WEBKIT + "$1$2") + value;
|
619
|
+
case 8116:
|
620
|
+
case 7059:
|
621
|
+
case 5753:
|
622
|
+
case 5535:
|
623
|
+
case 5445:
|
624
|
+
case 5701:
|
625
|
+
case 4933:
|
626
|
+
case 4677:
|
627
|
+
case 5533:
|
628
|
+
case 5789:
|
629
|
+
case 5021:
|
630
|
+
case 4765:
|
631
|
+
if (strlen(value) - 1 - length2 > 6) switch (charat(value, length2 + 1)) {
|
632
|
+
case 109:
|
633
|
+
if (charat(value, length2 + 4) !== 45) break;
|
634
|
+
case 102:
|
635
|
+
return replace(value, /(.+:)(.+)-([^]+)/, "$1" + WEBKIT + "$2-$3$1" + MOZ + (charat(value, length2 + 3) == 108 ? "$3" : "$2-$3")) + value;
|
636
|
+
case 115:
|
637
|
+
return ~indexof(value, "stretch") ? prefix(replace(value, "stretch", "fill-available"), length2) + value : value;
|
638
|
+
}
|
639
|
+
break;
|
640
|
+
case 4949:
|
641
|
+
if (charat(value, length2 + 1) !== 115) break;
|
642
|
+
case 6444:
|
643
|
+
switch (charat(value, strlen(value) - 3 - (~indexof(value, "!important") && 10))) {
|
644
|
+
case 107:
|
645
|
+
return replace(value, ":", ":" + WEBKIT) + value;
|
646
|
+
case 101:
|
647
|
+
return replace(value, /(.+:)([^;!]+)(;|!.+)?/, "$1" + WEBKIT + (charat(value, 14) === 45 ? "inline-" : "") + "box$3$1" + WEBKIT + "$2$3$1" + MS + "$2box$3") + value;
|
648
|
+
}
|
649
|
+
break;
|
650
|
+
case 5936:
|
651
|
+
switch (charat(value, length2 + 11)) {
|
652
|
+
case 114:
|
653
|
+
return WEBKIT + value + MS + replace(value, /[svh]\w+-[tblr]{2}/, "tb") + value;
|
654
|
+
case 108:
|
655
|
+
return WEBKIT + value + MS + replace(value, /[svh]\w+-[tblr]{2}/, "tb-rl") + value;
|
656
|
+
case 45:
|
657
|
+
return WEBKIT + value + MS + replace(value, /[svh]\w+-[tblr]{2}/, "lr") + value;
|
658
|
+
}
|
659
|
+
return WEBKIT + value + MS + value + value;
|
660
|
+
}
|
661
|
+
return value;
|
662
|
+
}
|
663
|
+
var prefixer = function prefixer2(element, index, children, callback) {
|
664
|
+
if (element.length > -1) {
|
665
|
+
if (!element["return"]) switch (element.type) {
|
666
|
+
case DECLARATION:
|
667
|
+
element["return"] = prefix(element.value, element.length);
|
668
|
+
break;
|
669
|
+
case KEYFRAMES:
|
670
|
+
return serialize([copy(element, {
|
671
|
+
value: replace(element.value, "@", "@" + WEBKIT)
|
672
|
+
})], callback);
|
673
|
+
case RULESET:
|
674
|
+
if (element.length) return combine(element.props, function(value) {
|
675
|
+
switch (match(value, /(::plac\w+|:read-\w+)/)) {
|
676
|
+
case ":read-only":
|
677
|
+
case ":read-write":
|
678
|
+
return serialize([copy(element, {
|
679
|
+
props: [replace(value, /:(read-\w+)/, ":" + MOZ + "$1")]
|
680
|
+
})], callback);
|
681
|
+
case "::placeholder":
|
682
|
+
return serialize([copy(element, {
|
683
|
+
props: [replace(value, /:(plac\w+)/, ":" + WEBKIT + "input-$1")]
|
684
|
+
}), copy(element, {
|
685
|
+
props: [replace(value, /:(plac\w+)/, ":" + MOZ + "$1")]
|
686
|
+
}), copy(element, {
|
687
|
+
props: [replace(value, /:(plac\w+)/, MS + "input-$1")]
|
688
|
+
})], callback);
|
689
|
+
}
|
690
|
+
return "";
|
691
|
+
});
|
692
|
+
}
|
693
|
+
}
|
694
|
+
};
|
695
|
+
var getServerStylisCache = isBrowser ? void 0 : weakMemoize(function() {
|
696
|
+
return memoize(function() {
|
697
|
+
var cache = {};
|
698
|
+
return function(name) {
|
699
|
+
return cache[name];
|
700
|
+
};
|
701
|
+
});
|
702
|
+
});
|
703
|
+
var defaultStylisPlugins = [prefixer];
|
704
|
+
var createCache = function createCache2(options) {
|
705
|
+
var key = options.key;
|
706
|
+
if (isBrowser && key === "css") {
|
707
|
+
var ssrStyles = document.querySelectorAll("style[data-emotion]:not([data-s])");
|
708
|
+
Array.prototype.forEach.call(ssrStyles, function(node2) {
|
709
|
+
var dataEmotionAttribute = node2.getAttribute("data-emotion");
|
710
|
+
if (dataEmotionAttribute.indexOf(" ") === -1) {
|
711
|
+
return;
|
712
|
+
}
|
713
|
+
document.head.appendChild(node2);
|
714
|
+
node2.setAttribute("data-s", "");
|
715
|
+
});
|
716
|
+
}
|
717
|
+
var stylisPlugins = options.stylisPlugins || defaultStylisPlugins;
|
718
|
+
var inserted = {};
|
719
|
+
var container;
|
720
|
+
var nodesToHydrate = [];
|
721
|
+
if (isBrowser) {
|
722
|
+
container = options.container || document.head;
|
723
|
+
Array.prototype.forEach.call(
|
724
|
+
// this means we will ignore elements which don't have a space in them which
|
725
|
+
// means that the style elements we're looking at are only Emotion 11 server-rendered style elements
|
726
|
+
document.querySelectorAll('style[data-emotion^="' + key + ' "]'),
|
727
|
+
function(node2) {
|
728
|
+
var attrib = node2.getAttribute("data-emotion").split(" ");
|
729
|
+
for (var i = 1; i < attrib.length; i++) {
|
730
|
+
inserted[attrib[i]] = true;
|
731
|
+
}
|
732
|
+
nodesToHydrate.push(node2);
|
733
|
+
}
|
734
|
+
);
|
735
|
+
}
|
736
|
+
var _insert;
|
737
|
+
var omnipresentPlugins = [compat, removeLabel];
|
738
|
+
if (isBrowser) {
|
739
|
+
var currentSheet;
|
740
|
+
var finalizingPlugins = [stringify, rulesheet(function(rule) {
|
741
|
+
currentSheet.insert(rule);
|
742
|
+
})];
|
743
|
+
var serializer = middleware(omnipresentPlugins.concat(stylisPlugins, finalizingPlugins));
|
744
|
+
var stylis = function stylis2(styles) {
|
745
|
+
return serialize(compile(styles), serializer);
|
746
|
+
};
|
747
|
+
_insert = function insert(selector, serialized, sheet, shouldCache) {
|
748
|
+
currentSheet = sheet;
|
749
|
+
stylis(selector ? selector + "{" + serialized.styles + "}" : serialized.styles);
|
750
|
+
if (shouldCache) {
|
751
|
+
cache.inserted[serialized.name] = true;
|
752
|
+
}
|
753
|
+
};
|
754
|
+
} else {
|
755
|
+
var _finalizingPlugins = [stringify];
|
756
|
+
var _serializer = middleware(omnipresentPlugins.concat(stylisPlugins, _finalizingPlugins));
|
757
|
+
var _stylis = function _stylis2(styles) {
|
758
|
+
return serialize(compile(styles), _serializer);
|
759
|
+
};
|
760
|
+
var serverStylisCache = getServerStylisCache(stylisPlugins)(key);
|
761
|
+
var getRules3 = function getRules4(selector, serialized) {
|
762
|
+
var name = serialized.name;
|
763
|
+
if (serverStylisCache[name] === void 0) {
|
764
|
+
serverStylisCache[name] = _stylis(selector ? selector + "{" + serialized.styles + "}" : serialized.styles);
|
765
|
+
}
|
766
|
+
return serverStylisCache[name];
|
767
|
+
};
|
768
|
+
_insert = function _insert2(selector, serialized, sheet, shouldCache) {
|
769
|
+
var name = serialized.name;
|
770
|
+
var rules = getRules3(selector, serialized);
|
771
|
+
if (cache.compat === void 0) {
|
772
|
+
if (shouldCache) {
|
773
|
+
cache.inserted[name] = true;
|
774
|
+
}
|
775
|
+
return rules;
|
776
|
+
} else {
|
777
|
+
if (shouldCache) {
|
778
|
+
cache.inserted[name] = rules;
|
779
|
+
} else {
|
780
|
+
return rules;
|
781
|
+
}
|
782
|
+
}
|
783
|
+
};
|
784
|
+
}
|
785
|
+
var cache = {
|
786
|
+
key,
|
787
|
+
sheet: new StyleSheet({
|
788
|
+
key,
|
789
|
+
container,
|
790
|
+
nonce: options.nonce,
|
791
|
+
speedy: options.speedy,
|
792
|
+
prepend: options.prepend,
|
793
|
+
insertionPoint: options.insertionPoint
|
794
|
+
}),
|
795
|
+
nonce: options.nonce,
|
796
|
+
inserted,
|
797
|
+
registered: {},
|
798
|
+
insert: _insert
|
799
|
+
};
|
800
|
+
cache.sheet.hydrate(nodesToHydrate);
|
801
|
+
return cache;
|
802
|
+
};
|
803
|
+
|
804
|
+
// index.tsx
|
805
|
+
import { CacheProvider } from "@emotion/react";
|
806
|
+
import { Fragment, jsx } from "react/jsx-runtime";
|
807
|
+
var createEmotionCachePlugin = (key) => {
|
808
|
+
return {
|
809
|
+
overrides: {
|
810
|
+
iframe: ({ children, document: document2 }) => {
|
811
|
+
const [cache, setCache] = useState(null);
|
812
|
+
useEffect(() => {
|
813
|
+
if (document2) {
|
814
|
+
setCache(
|
815
|
+
createCache({
|
816
|
+
key,
|
817
|
+
container: document2.head
|
818
|
+
})
|
819
|
+
);
|
820
|
+
}
|
821
|
+
}, [document2, key]);
|
822
|
+
if (cache) {
|
823
|
+
return /* @__PURE__ */ jsx(CacheProvider, { value: cache, children });
|
824
|
+
}
|
825
|
+
return /* @__PURE__ */ jsx(Fragment, { children });
|
826
|
+
}
|
827
|
+
}
|
828
|
+
};
|
829
|
+
};
|
830
|
+
var plugin_emotion_cache_default = createEmotionCachePlugin;
|
831
|
+
export {
|
832
|
+
plugin_emotion_cache_default as default
|
833
|
+
};
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@measured/puck-plugin-emotion-cache",
|
3
|
-
"version": "0.
|
3
|
+
"version": "0.16.0-canary.28a62c5",
|
4
4
|
"author": "Measured Corporation Ltd <hello@measured.co>",
|
5
5
|
"repository": "measuredco/puck",
|
6
6
|
"bugs": "https://github.com/measuredco/puck/issues",
|
@@ -8,6 +8,10 @@
|
|
8
8
|
"private": false,
|
9
9
|
"main": "./dist/index.js",
|
10
10
|
"types": "./dist/index.d.ts",
|
11
|
+
"exports": {
|
12
|
+
"import": "./dist/index.mjs",
|
13
|
+
"types": "./dist/index.d.ts"
|
14
|
+
},
|
11
15
|
"license": "MIT",
|
12
16
|
"scripts": {
|
13
17
|
"lint": "eslint \"**/*.ts*\"",
|
@@ -19,7 +23,7 @@
|
|
19
23
|
],
|
20
24
|
"devDependencies": {
|
21
25
|
"@emotion/react": "^11.13.3",
|
22
|
-
"@measured/puck": "^0.
|
26
|
+
"@measured/puck": "^0.16.0-canary.28a62c5",
|
23
27
|
"@types/react": "^18.2.0",
|
24
28
|
"@types/react-dom": "^18.2.0",
|
25
29
|
"eslint": "^7.32.0",
|
@@ -29,9 +33,8 @@
|
|
29
33
|
"tsup-config": "*",
|
30
34
|
"typescript": "^5.5.4"
|
31
35
|
},
|
32
|
-
"dependencies": {},
|
33
36
|
"peerDependencies": {
|
34
|
-
"react": "^
|
35
|
-
"
|
37
|
+
"@emotion/react": "^11.0.0",
|
38
|
+
"react": "^17.0.0 || ^18.0.0"
|
36
39
|
}
|
37
40
|
}
|