@ttoss/ui 1.30.0 → 1.30.2
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/esm/index.js +2462 -121
- package/dist/index.d.ts +11 -10
- package/dist/index.js +2442 -119
- package/package.json +10 -10
- package/src/components/Button.tsx +54 -9
- package/src/components/Icon.tsx +374 -12
- package/src/index.ts +2 -5
- package/src/theme/ThemeProvider.tsx +13 -24
package/dist/esm/index.js
CHANGED
|
@@ -1,116 +1,400 @@
|
|
|
1
1
|
/** Powered by @ttoss/config. https://ttoss.dev/docs/modules/packages/config/ */
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
9
|
+
var __esm = (fn, res) => function __init() {
|
|
10
|
+
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
11
|
+
};
|
|
12
|
+
var __commonJS = (cb, mod) => function __require() {
|
|
13
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
14
|
+
};
|
|
15
|
+
var __copyProps = (to, from, except, desc) => {
|
|
16
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
17
|
+
for (let key of __getOwnPropNames(from))
|
|
18
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
19
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
20
|
+
}
|
|
21
|
+
return to;
|
|
22
|
+
};
|
|
23
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
24
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
25
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
26
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
27
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
28
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
29
|
+
mod
|
|
30
|
+
));
|
|
31
|
+
var __publicField = (obj, key, value) => {
|
|
32
|
+
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
33
|
+
return value;
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
// tsup.inject.js
|
|
37
|
+
import * as React from "react";
|
|
38
|
+
var init_tsup_inject = __esm({
|
|
39
|
+
"tsup.inject.js"() {
|
|
40
|
+
"use strict";
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
// ../../node_modules/deepmerge/dist/cjs.js
|
|
45
|
+
var require_cjs = __commonJS({
|
|
46
|
+
"../../node_modules/deepmerge/dist/cjs.js"(exports, module) {
|
|
47
|
+
"use strict";
|
|
48
|
+
init_tsup_inject();
|
|
49
|
+
var isMergeableObject = function isMergeableObject2(value) {
|
|
50
|
+
return isNonNullObject(value) && !isSpecial(value);
|
|
51
|
+
};
|
|
52
|
+
function isNonNullObject(value) {
|
|
53
|
+
return !!value && typeof value === "object";
|
|
54
|
+
}
|
|
55
|
+
function isSpecial(value) {
|
|
56
|
+
var stringValue = Object.prototype.toString.call(value);
|
|
57
|
+
return stringValue === "[object RegExp]" || stringValue === "[object Date]" || isReactElement(value);
|
|
58
|
+
}
|
|
59
|
+
var canUseSymbol = typeof Symbol === "function" && Symbol.for;
|
|
60
|
+
var REACT_ELEMENT_TYPE = canUseSymbol ? Symbol.for("react.element") : 60103;
|
|
61
|
+
function isReactElement(value) {
|
|
62
|
+
return value.$$typeof === REACT_ELEMENT_TYPE;
|
|
63
|
+
}
|
|
64
|
+
function emptyTarget(val) {
|
|
65
|
+
return Array.isArray(val) ? [] : {};
|
|
66
|
+
}
|
|
67
|
+
function cloneUnlessOtherwiseSpecified(value, options) {
|
|
68
|
+
return options.clone !== false && options.isMergeableObject(value) ? deepmerge2(emptyTarget(value), value, options) : value;
|
|
69
|
+
}
|
|
70
|
+
function defaultArrayMerge(target, source, options) {
|
|
71
|
+
return target.concat(source).map(function(element) {
|
|
72
|
+
return cloneUnlessOtherwiseSpecified(element, options);
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
function getMergeFunction(key, options) {
|
|
76
|
+
if (!options.customMerge) {
|
|
77
|
+
return deepmerge2;
|
|
78
|
+
}
|
|
79
|
+
var customMerge = options.customMerge(key);
|
|
80
|
+
return typeof customMerge === "function" ? customMerge : deepmerge2;
|
|
81
|
+
}
|
|
82
|
+
function getEnumerableOwnPropertySymbols(target) {
|
|
83
|
+
return Object.getOwnPropertySymbols ? Object.getOwnPropertySymbols(target).filter(function(symbol) {
|
|
84
|
+
return Object.propertyIsEnumerable.call(target, symbol);
|
|
85
|
+
}) : [];
|
|
86
|
+
}
|
|
87
|
+
function getKeys(target) {
|
|
88
|
+
return Object.keys(target).concat(getEnumerableOwnPropertySymbols(target));
|
|
89
|
+
}
|
|
90
|
+
function propertyIsOnObject(object, property) {
|
|
91
|
+
try {
|
|
92
|
+
return property in object;
|
|
93
|
+
} catch (_) {
|
|
94
|
+
return false;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
function propertyIsUnsafe(target, key) {
|
|
98
|
+
return propertyIsOnObject(target, key) && !(Object.hasOwnProperty.call(target, key) && Object.propertyIsEnumerable.call(target, key));
|
|
99
|
+
}
|
|
100
|
+
function mergeObject(target, source, options) {
|
|
101
|
+
var destination = {};
|
|
102
|
+
if (options.isMergeableObject(target)) {
|
|
103
|
+
getKeys(target).forEach(function(key) {
|
|
104
|
+
destination[key] = cloneUnlessOtherwiseSpecified(target[key], options);
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
getKeys(source).forEach(function(key) {
|
|
108
|
+
if (propertyIsUnsafe(target, key)) {
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
111
|
+
if (propertyIsOnObject(target, key) && options.isMergeableObject(source[key])) {
|
|
112
|
+
destination[key] = getMergeFunction(key, options)(target[key], source[key], options);
|
|
113
|
+
} else {
|
|
114
|
+
destination[key] = cloneUnlessOtherwiseSpecified(source[key], options);
|
|
115
|
+
}
|
|
116
|
+
});
|
|
117
|
+
return destination;
|
|
118
|
+
}
|
|
119
|
+
function deepmerge2(target, source, options) {
|
|
120
|
+
options = options || {};
|
|
121
|
+
options.arrayMerge = options.arrayMerge || defaultArrayMerge;
|
|
122
|
+
options.isMergeableObject = options.isMergeableObject || isMergeableObject;
|
|
123
|
+
options.cloneUnlessOtherwiseSpecified = cloneUnlessOtherwiseSpecified;
|
|
124
|
+
var sourceIsArray = Array.isArray(source);
|
|
125
|
+
var targetIsArray = Array.isArray(target);
|
|
126
|
+
var sourceAndTargetTypesMatch = sourceIsArray === targetIsArray;
|
|
127
|
+
if (!sourceAndTargetTypesMatch) {
|
|
128
|
+
return cloneUnlessOtherwiseSpecified(source, options);
|
|
129
|
+
} else if (sourceIsArray) {
|
|
130
|
+
return options.arrayMerge(target, source, options);
|
|
131
|
+
} else {
|
|
132
|
+
return mergeObject(target, source, options);
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
deepmerge2.all = function deepmergeAll(array, options) {
|
|
136
|
+
if (!Array.isArray(array)) {
|
|
137
|
+
throw new Error("first argument should be an array");
|
|
138
|
+
}
|
|
139
|
+
return array.reduce(function(prev, next) {
|
|
140
|
+
return deepmerge2(prev, next, options);
|
|
141
|
+
}, {});
|
|
142
|
+
};
|
|
143
|
+
var deepmerge_1 = deepmerge2;
|
|
144
|
+
module.exports = deepmerge_1;
|
|
145
|
+
}
|
|
146
|
+
});
|
|
2
147
|
|
|
3
148
|
// src/index.ts
|
|
149
|
+
init_tsup_inject();
|
|
150
|
+
import { BaseStyles } from "theme-ui";
|
|
4
151
|
import { useResponsiveValue, useBreakpointIndex } from "@theme-ui/match-media";
|
|
5
152
|
|
|
6
153
|
// src/theme/ThemeProvider.tsx
|
|
7
|
-
|
|
154
|
+
init_tsup_inject();
|
|
8
155
|
|
|
9
156
|
// ../theme/dist/esm/index.js
|
|
157
|
+
init_tsup_inject();
|
|
158
|
+
var import_deepmerge = __toESM(require_cjs());
|
|
159
|
+
var fontSizes = {
|
|
160
|
+
"2xs": "0.5rem",
|
|
161
|
+
xs: "0.75rem",
|
|
162
|
+
sm: "0.875rem",
|
|
163
|
+
base: "1rem",
|
|
164
|
+
lg: "1.125rem",
|
|
165
|
+
xl: "1.25rem",
|
|
166
|
+
"2xl": "1.5rem",
|
|
167
|
+
"3xl": "1.875rem",
|
|
168
|
+
"4xl": "2.25rem",
|
|
169
|
+
"5xl": "3rem",
|
|
170
|
+
"6xl": "3.75rem",
|
|
171
|
+
"7xl": "4.5rem",
|
|
172
|
+
"8xl": "6rem",
|
|
173
|
+
"9xl": "8rem"
|
|
174
|
+
};
|
|
175
|
+
var fontWeights = {
|
|
176
|
+
thin: 100,
|
|
177
|
+
extralight: 200,
|
|
178
|
+
light: 300,
|
|
179
|
+
normal: 400,
|
|
180
|
+
medium: 500,
|
|
181
|
+
semibold: 600,
|
|
182
|
+
bold: 700,
|
|
183
|
+
extrabold: 800
|
|
184
|
+
};
|
|
185
|
+
var letterSpacings = {
|
|
186
|
+
tighter: "-0.05em",
|
|
187
|
+
tight: "-0.025em",
|
|
188
|
+
normal: "0em",
|
|
189
|
+
wide: "0.025em",
|
|
190
|
+
wider: "0.05em",
|
|
191
|
+
widest: "0.1em"
|
|
192
|
+
};
|
|
193
|
+
var space = {
|
|
194
|
+
none: 0,
|
|
195
|
+
"2xs": "2px",
|
|
196
|
+
xs: "3px",
|
|
197
|
+
sm: "5px",
|
|
198
|
+
md: "8px",
|
|
199
|
+
lg: "13px",
|
|
200
|
+
xl: "21px",
|
|
201
|
+
"2xl": "34px",
|
|
202
|
+
"3xl": "55px",
|
|
203
|
+
"4xl": "89px",
|
|
204
|
+
"5xl": "144px",
|
|
205
|
+
"6xl": "233px",
|
|
206
|
+
"7xl": "377px"
|
|
207
|
+
};
|
|
208
|
+
var coreFonts = {
|
|
209
|
+
main: '"Atkinson Hyperlegible", sans-serif',
|
|
210
|
+
contrast: '"Work Sans", sans-serif',
|
|
211
|
+
monospace: '"Inconsolata", sans-serif'
|
|
212
|
+
};
|
|
213
|
+
var brandColors = {
|
|
214
|
+
complimentary: "#f5f5f5",
|
|
215
|
+
main: "#292c2a",
|
|
216
|
+
darkNeutral: "#515389",
|
|
217
|
+
accent: "#0000ff",
|
|
218
|
+
lightNeutral: "#e3e3e3"
|
|
219
|
+
};
|
|
220
|
+
var coreColors = {
|
|
221
|
+
...brandColors,
|
|
222
|
+
gray100: "#f0f1f3",
|
|
223
|
+
gray200: "#ced1d7",
|
|
224
|
+
gray300: "#acb1ba",
|
|
225
|
+
gray400: "#8b919e",
|
|
226
|
+
gray500: "#6b7280",
|
|
227
|
+
gray600: "#535863",
|
|
228
|
+
gray700: "#3b3f46",
|
|
229
|
+
gray800: "#23252a",
|
|
230
|
+
gray900: "#0b0b0d",
|
|
231
|
+
black: "#000000",
|
|
232
|
+
red100: "#ffebeb",
|
|
233
|
+
red200: "#fdbfbf",
|
|
234
|
+
red300: "#f99595",
|
|
235
|
+
red400: "#f56c6c",
|
|
236
|
+
red500: "#ef4444",
|
|
237
|
+
red600: "#e42828",
|
|
238
|
+
red700: "#c62121",
|
|
239
|
+
white: "#ffffff"
|
|
240
|
+
};
|
|
241
|
+
var coreBorders = {
|
|
242
|
+
none: "0px solid",
|
|
243
|
+
thin: "1px solid",
|
|
244
|
+
medium: "2px solid",
|
|
245
|
+
thick: "4px solid"
|
|
246
|
+
};
|
|
247
|
+
var coreRadii = {
|
|
248
|
+
sharp: "0px",
|
|
249
|
+
xs: "2px",
|
|
250
|
+
sm: "4px",
|
|
251
|
+
md: "6px",
|
|
252
|
+
lg: "8px",
|
|
253
|
+
xl: "12px",
|
|
254
|
+
"2xl": "16px",
|
|
255
|
+
"3xl": "24px",
|
|
256
|
+
circle: "9999px"
|
|
257
|
+
};
|
|
10
258
|
var BruttalTheme = {
|
|
259
|
+
/**
|
|
260
|
+
* Tokens
|
|
261
|
+
*/
|
|
262
|
+
fontSizes,
|
|
263
|
+
fontWeights,
|
|
264
|
+
letterSpacings,
|
|
265
|
+
space,
|
|
11
266
|
colors: {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
267
|
+
background: coreColors.lightNeutral,
|
|
268
|
+
text: coreColors.gray900,
|
|
269
|
+
muted: coreColors.gray200,
|
|
270
|
+
outline: coreColors.gray200,
|
|
271
|
+
primary: coreColors.main,
|
|
272
|
+
onPrimary: coreColors.white,
|
|
273
|
+
secondary: coreColors.gray500,
|
|
274
|
+
onSecondary: coreColors.white,
|
|
275
|
+
highlight: coreColors.darkNeutral,
|
|
276
|
+
onHighlight: coreColors.white,
|
|
277
|
+
accent: coreColors.accent,
|
|
278
|
+
onAccent: coreColors.white,
|
|
279
|
+
neutral: coreColors.white,
|
|
280
|
+
onNeutral: coreColors.gray900
|
|
22
281
|
},
|
|
23
|
-
space: [0, 4, 8, 16, 32, 64, 128, 256, 512, 1024],
|
|
24
282
|
fonts: {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
lg: "1.125rem",
|
|
35
|
-
xl: "1.25rem",
|
|
36
|
-
"2xl": "1.5rem",
|
|
37
|
-
"3xl": "1.875rem",
|
|
38
|
-
"4xl": "2.25rem",
|
|
39
|
-
"5xl": "3rem",
|
|
40
|
-
"6xl": "3.75rem",
|
|
41
|
-
"7xl": "4.5rem",
|
|
42
|
-
"8xl": "6rem",
|
|
43
|
-
"9xl": "8rem"
|
|
283
|
+
h1: coreFonts.contrast,
|
|
284
|
+
h2: coreFonts.contrast,
|
|
285
|
+
h3: coreFonts.contrast,
|
|
286
|
+
h4: coreFonts.contrast,
|
|
287
|
+
h5: coreFonts.contrast,
|
|
288
|
+
h6: coreFonts.contrast,
|
|
289
|
+
body: coreFonts.main,
|
|
290
|
+
highlight: coreFonts.main,
|
|
291
|
+
caption: coreFonts.monospace
|
|
44
292
|
},
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
extralight: 200,
|
|
48
|
-
light: 300,
|
|
49
|
-
normal: 400,
|
|
50
|
-
medium: 500,
|
|
51
|
-
semibold: 600,
|
|
52
|
-
bold: 700,
|
|
53
|
-
extrabold: 800
|
|
293
|
+
borders: {
|
|
294
|
+
default: coreBorders.medium
|
|
54
295
|
},
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
tight: "-0.025em",
|
|
58
|
-
normal: "0em",
|
|
59
|
-
wide: "0.025em",
|
|
60
|
-
wider: "0.05em",
|
|
61
|
-
widest: "0.1em"
|
|
296
|
+
radii: {
|
|
297
|
+
default: coreRadii.sm
|
|
62
298
|
},
|
|
299
|
+
/**
|
|
300
|
+
* Global styles
|
|
301
|
+
*/
|
|
63
302
|
styles: {
|
|
64
303
|
root: {
|
|
65
304
|
fontFamily: "body",
|
|
66
305
|
fontWeight: "normal"
|
|
67
|
-
},
|
|
68
|
-
a: {
|
|
69
|
-
color: "primary",
|
|
70
|
-
textDecoration: "underline",
|
|
71
|
-
cursor: "pointer",
|
|
72
|
-
fontFamily: "body"
|
|
73
|
-
},
|
|
74
|
-
progress: {
|
|
75
|
-
color: "primary",
|
|
76
|
-
backgroundColor: "background"
|
|
77
306
|
}
|
|
78
307
|
},
|
|
79
|
-
|
|
308
|
+
/**
|
|
309
|
+
* Components
|
|
310
|
+
*/
|
|
80
311
|
buttons: {
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
312
|
+
accent: {
|
|
313
|
+
backgroundColor: "accent",
|
|
314
|
+
color: "onAccent",
|
|
315
|
+
fontFamily: "highlight",
|
|
316
|
+
fontWeight: "bold",
|
|
317
|
+
border: "default",
|
|
318
|
+
borderRadius: "default",
|
|
319
|
+
borderColor: "accent",
|
|
320
|
+
":hover:not(:active,[disabled])": {
|
|
321
|
+
backgroundColor: "highlight",
|
|
322
|
+
color: "onHighlight",
|
|
323
|
+
borderColor: "highlight"
|
|
324
|
+
},
|
|
325
|
+
":disabled": {
|
|
326
|
+
cursor: "default",
|
|
327
|
+
backgroundColor: "muted",
|
|
328
|
+
borderColor: "muted"
|
|
329
|
+
}
|
|
92
330
|
},
|
|
93
331
|
primary: {
|
|
332
|
+
backgroundColor: "primary",
|
|
333
|
+
color: "onPrimary",
|
|
334
|
+
fontFamily: "body",
|
|
335
|
+
border: "default",
|
|
336
|
+
borderRadius: "default",
|
|
337
|
+
borderColor: "outline",
|
|
338
|
+
":hover:not(:active,[disabled])": {
|
|
339
|
+
backgroundColor: "highlight",
|
|
340
|
+
color: "onHighlight",
|
|
341
|
+
borderColor: "highlight"
|
|
342
|
+
},
|
|
343
|
+
":active": {
|
|
344
|
+
backgroundColor: "primary",
|
|
345
|
+
color: "onPrimary",
|
|
346
|
+
borderColor: "outline"
|
|
347
|
+
},
|
|
94
348
|
":disabled": {
|
|
95
|
-
|
|
96
|
-
|
|
349
|
+
cursor: "default",
|
|
350
|
+
backgroundColor: "muted",
|
|
351
|
+
borderColor: "muted"
|
|
97
352
|
}
|
|
98
353
|
},
|
|
99
354
|
secondary: {
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
355
|
+
backgroundColor: "secondary",
|
|
356
|
+
color: "onSecondary",
|
|
357
|
+
fontFamily: "body",
|
|
358
|
+
border: "default",
|
|
359
|
+
borderRadius: "default",
|
|
360
|
+
borderColor: "outline",
|
|
361
|
+
":hover:not(:active,[disabled])": {
|
|
362
|
+
backgroundColor: "highlight",
|
|
363
|
+
color: "onHighlight",
|
|
364
|
+
borderColor: "highlight"
|
|
365
|
+
},
|
|
105
366
|
":disabled": {
|
|
106
|
-
|
|
107
|
-
|
|
367
|
+
cursor: "default",
|
|
368
|
+
backgroundColor: "muted",
|
|
369
|
+
borderColor: "muted"
|
|
108
370
|
}
|
|
371
|
+
},
|
|
372
|
+
neutral: {
|
|
373
|
+
backgroundColor: "neutral",
|
|
374
|
+
color: "onNeutral",
|
|
375
|
+
fontFamily: "body",
|
|
376
|
+
border: "default",
|
|
377
|
+
borderRadius: "default",
|
|
378
|
+
borderColor: "outline",
|
|
379
|
+
":hover:not(:active,[disabled])": {
|
|
380
|
+
backgroundColor: "highlight",
|
|
381
|
+
color: "onHighlight",
|
|
382
|
+
borderColor: "highlight"
|
|
383
|
+
},
|
|
384
|
+
":disabled": {
|
|
385
|
+
cursor: "default",
|
|
386
|
+
backgroundColor: "muted",
|
|
387
|
+
borderColor: "muted"
|
|
388
|
+
}
|
|
389
|
+
},
|
|
390
|
+
danger: {
|
|
391
|
+
color: "white",
|
|
392
|
+
backgroundColor: "danger"
|
|
109
393
|
}
|
|
110
394
|
},
|
|
111
395
|
cards: {
|
|
112
396
|
primary: {
|
|
113
|
-
backgroundColor: "
|
|
397
|
+
backgroundColor: "primary",
|
|
114
398
|
border: "1px solid black",
|
|
115
399
|
padding: [4, 5],
|
|
116
400
|
display: "flex",
|
|
@@ -168,125 +452,2164 @@ var BruttalTheme = {
|
|
|
168
452
|
};
|
|
169
453
|
var BruttalFonts = [
|
|
170
454
|
"https://fonts.googleapis.com/css?family=Inconsolata:wght@100;200;300;400;500;700;800;900",
|
|
171
|
-
"https://fonts.googleapis.com/css?family=Work+Sans:wght@100;200;300;400;500;700;800;900"
|
|
455
|
+
"https://fonts.googleapis.com/css?family=Work+Sans:wght@100;200;300;400;500;700;800;900",
|
|
456
|
+
"https://fonts.googleapis.com/css2?family=Atkinson+Hyperlegible:ital,wght@0,400;0,700;1,400;1,700&display=swap"
|
|
172
457
|
];
|
|
173
458
|
|
|
174
459
|
// src/theme/ThemeProvider.tsx
|
|
175
460
|
import { Global, css } from "@emotion/react";
|
|
176
|
-
import { ThemeProvider as ThemeUiProvider
|
|
461
|
+
import { ThemeProvider as ThemeUiProvider } from "theme-ui";
|
|
177
462
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
178
463
|
var ThemeProvider = ({
|
|
179
464
|
children,
|
|
180
|
-
theme =
|
|
465
|
+
theme = BruttalTheme,
|
|
181
466
|
fonts = BruttalFonts
|
|
182
467
|
}) => {
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
styles: css`
|
|
195
|
-
@import url('${url}');
|
|
196
|
-
`
|
|
197
|
-
},
|
|
198
|
-
url
|
|
199
|
-
);
|
|
200
|
-
}),
|
|
468
|
+
return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs(ThemeUiProvider, { theme, children: [
|
|
469
|
+
/* @__PURE__ */ jsx(
|
|
470
|
+
Global,
|
|
471
|
+
{
|
|
472
|
+
styles: css`
|
|
473
|
+
${fonts.map((url) => {
|
|
474
|
+
return `@import url('${url}');`;
|
|
475
|
+
}).join("\n")}
|
|
476
|
+
`
|
|
477
|
+
}
|
|
478
|
+
),
|
|
201
479
|
children
|
|
202
480
|
] }) });
|
|
203
481
|
};
|
|
204
|
-
var ThemeProvider_default = ThemeProvider;
|
|
205
482
|
|
|
206
483
|
// src/theme/useTheme.ts
|
|
484
|
+
init_tsup_inject();
|
|
207
485
|
import { useThemeUI } from "theme-ui";
|
|
208
486
|
var useTheme = useThemeUI;
|
|
209
487
|
|
|
210
488
|
// src/components/Box.tsx
|
|
489
|
+
init_tsup_inject();
|
|
211
490
|
import { Box } from "theme-ui";
|
|
212
491
|
|
|
213
492
|
// src/components/Button.tsx
|
|
214
|
-
|
|
215
|
-
import
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
493
|
+
init_tsup_inject();
|
|
494
|
+
import * as React3 from "react";
|
|
495
|
+
import {
|
|
496
|
+
Button as ButtonUi
|
|
497
|
+
} from "theme-ui";
|
|
498
|
+
|
|
499
|
+
// src/components/Icon.tsx
|
|
500
|
+
init_tsup_inject();
|
|
501
|
+
|
|
502
|
+
// ../../node_modules/@iconify-icon/react/dist/iconify.mjs
|
|
503
|
+
init_tsup_inject();
|
|
504
|
+
import React2 from "react";
|
|
505
|
+
|
|
506
|
+
// ../../node_modules/iconify-icon/dist/iconify-icon.mjs
|
|
507
|
+
init_tsup_inject();
|
|
508
|
+
var defaultIconDimensions = Object.freeze(
|
|
509
|
+
{
|
|
510
|
+
left: 0,
|
|
511
|
+
top: 0,
|
|
512
|
+
width: 16,
|
|
513
|
+
height: 16
|
|
514
|
+
}
|
|
515
|
+
);
|
|
516
|
+
var defaultIconTransformations = Object.freeze({
|
|
517
|
+
rotate: 0,
|
|
518
|
+
vFlip: false,
|
|
519
|
+
hFlip: false
|
|
520
|
+
});
|
|
521
|
+
var defaultIconProps = Object.freeze({
|
|
522
|
+
...defaultIconDimensions,
|
|
523
|
+
...defaultIconTransformations
|
|
524
|
+
});
|
|
525
|
+
var defaultExtendedIconProps = Object.freeze({
|
|
526
|
+
...defaultIconProps,
|
|
527
|
+
body: "",
|
|
528
|
+
hidden: false
|
|
529
|
+
});
|
|
530
|
+
var defaultIconSizeCustomisations = Object.freeze({
|
|
531
|
+
width: null,
|
|
532
|
+
height: null
|
|
533
|
+
});
|
|
534
|
+
var defaultIconCustomisations = Object.freeze({
|
|
535
|
+
...defaultIconSizeCustomisations,
|
|
536
|
+
...defaultIconTransformations
|
|
537
|
+
});
|
|
538
|
+
function rotateFromString(value, defaultValue = 0) {
|
|
539
|
+
const units = value.replace(/^-?[0-9.]*/, "");
|
|
540
|
+
function cleanup(value2) {
|
|
541
|
+
while (value2 < 0) {
|
|
542
|
+
value2 += 4;
|
|
543
|
+
}
|
|
544
|
+
return value2 % 4;
|
|
545
|
+
}
|
|
546
|
+
if (units === "") {
|
|
547
|
+
const num = parseInt(value);
|
|
548
|
+
return isNaN(num) ? 0 : cleanup(num);
|
|
549
|
+
} else if (units !== value) {
|
|
550
|
+
let split = 0;
|
|
551
|
+
switch (units) {
|
|
552
|
+
case "%":
|
|
553
|
+
split = 25;
|
|
554
|
+
break;
|
|
555
|
+
case "deg":
|
|
556
|
+
split = 90;
|
|
557
|
+
}
|
|
558
|
+
if (split) {
|
|
559
|
+
let num = parseFloat(value.slice(0, value.length - units.length));
|
|
560
|
+
if (isNaN(num)) {
|
|
561
|
+
return 0;
|
|
562
|
+
}
|
|
563
|
+
num = num / split;
|
|
564
|
+
return num % 1 === 0 ? cleanup(num) : 0;
|
|
565
|
+
}
|
|
566
|
+
}
|
|
567
|
+
return defaultValue;
|
|
568
|
+
}
|
|
569
|
+
var separator = /[\s,]+/;
|
|
570
|
+
function flipFromString(custom, flip) {
|
|
571
|
+
flip.split(separator).forEach((str) => {
|
|
572
|
+
const value = str.trim();
|
|
573
|
+
switch (value) {
|
|
574
|
+
case "horizontal":
|
|
575
|
+
custom.hFlip = true;
|
|
576
|
+
break;
|
|
577
|
+
case "vertical":
|
|
578
|
+
custom.vFlip = true;
|
|
579
|
+
break;
|
|
580
|
+
}
|
|
581
|
+
});
|
|
582
|
+
}
|
|
583
|
+
var defaultCustomisations = {
|
|
584
|
+
...defaultIconCustomisations,
|
|
585
|
+
preserveAspectRatio: ""
|
|
586
|
+
};
|
|
587
|
+
function getCustomisations(node) {
|
|
588
|
+
const customisations = {
|
|
589
|
+
...defaultCustomisations
|
|
590
|
+
};
|
|
591
|
+
const attr = (key, def) => node.getAttribute(key) || def;
|
|
592
|
+
customisations.width = attr("width", null);
|
|
593
|
+
customisations.height = attr("height", null);
|
|
594
|
+
customisations.rotate = rotateFromString(attr("rotate", ""));
|
|
595
|
+
flipFromString(customisations, attr("flip", ""));
|
|
596
|
+
customisations.preserveAspectRatio = attr("preserveAspectRatio", attr("preserveaspectratio", ""));
|
|
597
|
+
return customisations;
|
|
598
|
+
}
|
|
599
|
+
function haveCustomisationsChanged(value1, value2) {
|
|
600
|
+
for (const key in defaultCustomisations) {
|
|
601
|
+
if (value1[key] !== value2[key]) {
|
|
602
|
+
return true;
|
|
603
|
+
}
|
|
604
|
+
}
|
|
605
|
+
return false;
|
|
606
|
+
}
|
|
607
|
+
var matchIconName = /^[a-z0-9]+(-[a-z0-9]+)*$/;
|
|
608
|
+
var stringToIcon = (value, validate, allowSimpleName, provider = "") => {
|
|
609
|
+
const colonSeparated = value.split(":");
|
|
610
|
+
if (value.slice(0, 1) === "@") {
|
|
611
|
+
if (colonSeparated.length < 2 || colonSeparated.length > 3) {
|
|
612
|
+
return null;
|
|
613
|
+
}
|
|
614
|
+
provider = colonSeparated.shift().slice(1);
|
|
615
|
+
}
|
|
616
|
+
if (colonSeparated.length > 3 || !colonSeparated.length) {
|
|
617
|
+
return null;
|
|
618
|
+
}
|
|
619
|
+
if (colonSeparated.length > 1) {
|
|
620
|
+
const name2 = colonSeparated.pop();
|
|
621
|
+
const prefix = colonSeparated.pop();
|
|
622
|
+
const result = {
|
|
623
|
+
provider: colonSeparated.length > 0 ? colonSeparated[0] : provider,
|
|
624
|
+
prefix,
|
|
625
|
+
name: name2
|
|
626
|
+
};
|
|
627
|
+
return validate && !validateIconName(result) ? null : result;
|
|
628
|
+
}
|
|
629
|
+
const name = colonSeparated[0];
|
|
630
|
+
const dashSeparated = name.split("-");
|
|
631
|
+
if (dashSeparated.length > 1) {
|
|
632
|
+
const result = {
|
|
633
|
+
provider,
|
|
634
|
+
prefix: dashSeparated.shift(),
|
|
635
|
+
name: dashSeparated.join("-")
|
|
636
|
+
};
|
|
637
|
+
return validate && !validateIconName(result) ? null : result;
|
|
638
|
+
}
|
|
639
|
+
if (allowSimpleName && provider === "") {
|
|
640
|
+
const result = {
|
|
641
|
+
provider,
|
|
642
|
+
prefix: "",
|
|
643
|
+
name
|
|
644
|
+
};
|
|
645
|
+
return validate && !validateIconName(result, allowSimpleName) ? null : result;
|
|
646
|
+
}
|
|
647
|
+
return null;
|
|
648
|
+
};
|
|
649
|
+
var validateIconName = (icon, allowSimpleName) => {
|
|
650
|
+
if (!icon) {
|
|
651
|
+
return false;
|
|
652
|
+
}
|
|
653
|
+
return !!((icon.provider === "" || icon.provider.match(matchIconName)) && (allowSimpleName && icon.prefix === "" || icon.prefix.match(matchIconName)) && icon.name.match(matchIconName));
|
|
654
|
+
};
|
|
655
|
+
function mergeIconTransformations(obj1, obj2) {
|
|
656
|
+
const result = {};
|
|
657
|
+
if (!obj1.hFlip !== !obj2.hFlip) {
|
|
658
|
+
result.hFlip = true;
|
|
659
|
+
}
|
|
660
|
+
if (!obj1.vFlip !== !obj2.vFlip) {
|
|
661
|
+
result.vFlip = true;
|
|
662
|
+
}
|
|
663
|
+
const rotate = ((obj1.rotate || 0) + (obj2.rotate || 0)) % 4;
|
|
664
|
+
if (rotate) {
|
|
665
|
+
result.rotate = rotate;
|
|
666
|
+
}
|
|
667
|
+
return result;
|
|
668
|
+
}
|
|
669
|
+
function mergeIconData(parent, child) {
|
|
670
|
+
const result = mergeIconTransformations(parent, child);
|
|
671
|
+
for (const key in defaultExtendedIconProps) {
|
|
672
|
+
if (key in defaultIconTransformations) {
|
|
673
|
+
if (key in parent && !(key in result)) {
|
|
674
|
+
result[key] = defaultIconTransformations[key];
|
|
675
|
+
}
|
|
676
|
+
} else if (key in child) {
|
|
677
|
+
result[key] = child[key];
|
|
678
|
+
} else if (key in parent) {
|
|
679
|
+
result[key] = parent[key];
|
|
680
|
+
}
|
|
681
|
+
}
|
|
682
|
+
return result;
|
|
683
|
+
}
|
|
684
|
+
function getIconsTree(data, names) {
|
|
685
|
+
const icons = data.icons;
|
|
686
|
+
const aliases = data.aliases || /* @__PURE__ */ Object.create(null);
|
|
687
|
+
const resolved = /* @__PURE__ */ Object.create(null);
|
|
688
|
+
function resolve(name) {
|
|
689
|
+
if (icons[name]) {
|
|
690
|
+
return resolved[name] = [];
|
|
691
|
+
}
|
|
692
|
+
if (!(name in resolved)) {
|
|
693
|
+
resolved[name] = null;
|
|
694
|
+
const parent = aliases[name] && aliases[name].parent;
|
|
695
|
+
const value = parent && resolve(parent);
|
|
696
|
+
if (value) {
|
|
697
|
+
resolved[name] = [parent].concat(value);
|
|
698
|
+
}
|
|
699
|
+
}
|
|
700
|
+
return resolved[name];
|
|
701
|
+
}
|
|
702
|
+
(names || Object.keys(icons).concat(Object.keys(aliases))).forEach(resolve);
|
|
703
|
+
return resolved;
|
|
704
|
+
}
|
|
705
|
+
function internalGetIconData(data, name, tree) {
|
|
706
|
+
const icons = data.icons;
|
|
707
|
+
const aliases = data.aliases || /* @__PURE__ */ Object.create(null);
|
|
708
|
+
let currentProps = {};
|
|
709
|
+
function parse(name2) {
|
|
710
|
+
currentProps = mergeIconData(
|
|
711
|
+
icons[name2] || aliases[name2],
|
|
712
|
+
currentProps
|
|
713
|
+
);
|
|
714
|
+
}
|
|
715
|
+
parse(name);
|
|
716
|
+
tree.forEach(parse);
|
|
717
|
+
return mergeIconData(data, currentProps);
|
|
718
|
+
}
|
|
719
|
+
function parseIconSet(data, callback) {
|
|
720
|
+
const names = [];
|
|
721
|
+
if (typeof data !== "object" || typeof data.icons !== "object") {
|
|
722
|
+
return names;
|
|
723
|
+
}
|
|
724
|
+
if (data.not_found instanceof Array) {
|
|
725
|
+
data.not_found.forEach((name) => {
|
|
726
|
+
callback(name, null);
|
|
727
|
+
names.push(name);
|
|
728
|
+
});
|
|
729
|
+
}
|
|
730
|
+
const tree = getIconsTree(data);
|
|
731
|
+
for (const name in tree) {
|
|
732
|
+
const item = tree[name];
|
|
733
|
+
if (item) {
|
|
734
|
+
callback(name, internalGetIconData(data, name, item));
|
|
735
|
+
names.push(name);
|
|
736
|
+
}
|
|
737
|
+
}
|
|
738
|
+
return names;
|
|
739
|
+
}
|
|
740
|
+
var optionalPropertyDefaults = {
|
|
741
|
+
provider: "",
|
|
742
|
+
aliases: {},
|
|
743
|
+
not_found: {},
|
|
744
|
+
...defaultIconDimensions
|
|
745
|
+
};
|
|
746
|
+
function checkOptionalProps(item, defaults) {
|
|
747
|
+
for (const prop in defaults) {
|
|
748
|
+
if (prop in item && typeof item[prop] !== typeof defaults[prop]) {
|
|
749
|
+
return false;
|
|
750
|
+
}
|
|
751
|
+
}
|
|
752
|
+
return true;
|
|
753
|
+
}
|
|
754
|
+
function quicklyValidateIconSet(obj) {
|
|
755
|
+
if (typeof obj !== "object" || obj === null) {
|
|
756
|
+
return null;
|
|
757
|
+
}
|
|
758
|
+
const data = obj;
|
|
759
|
+
if (typeof data.prefix !== "string" || !obj.icons || typeof obj.icons !== "object") {
|
|
760
|
+
return null;
|
|
761
|
+
}
|
|
762
|
+
if (!checkOptionalProps(obj, optionalPropertyDefaults)) {
|
|
763
|
+
return null;
|
|
764
|
+
}
|
|
765
|
+
const icons = data.icons;
|
|
766
|
+
for (const name in icons) {
|
|
767
|
+
const icon = icons[name];
|
|
768
|
+
if (!name.match(matchIconName) || typeof icon.body !== "string" || !checkOptionalProps(
|
|
769
|
+
icon,
|
|
770
|
+
defaultExtendedIconProps
|
|
771
|
+
)) {
|
|
772
|
+
return null;
|
|
773
|
+
}
|
|
774
|
+
}
|
|
775
|
+
const aliases = data.aliases || /* @__PURE__ */ Object.create(null);
|
|
776
|
+
for (const name in aliases) {
|
|
777
|
+
const icon = aliases[name];
|
|
778
|
+
const parent = icon.parent;
|
|
779
|
+
if (!name.match(matchIconName) || typeof parent !== "string" || !icons[parent] && !aliases[parent] || !checkOptionalProps(
|
|
780
|
+
icon,
|
|
781
|
+
defaultExtendedIconProps
|
|
782
|
+
)) {
|
|
783
|
+
return null;
|
|
784
|
+
}
|
|
785
|
+
}
|
|
786
|
+
return data;
|
|
787
|
+
}
|
|
788
|
+
var dataStorage = /* @__PURE__ */ Object.create(null);
|
|
789
|
+
function newStorage(provider, prefix) {
|
|
790
|
+
return {
|
|
791
|
+
provider,
|
|
792
|
+
prefix,
|
|
793
|
+
icons: /* @__PURE__ */ Object.create(null),
|
|
794
|
+
missing: /* @__PURE__ */ new Set()
|
|
795
|
+
};
|
|
796
|
+
}
|
|
797
|
+
function getStorage(provider, prefix) {
|
|
798
|
+
const providerStorage = dataStorage[provider] || (dataStorage[provider] = /* @__PURE__ */ Object.create(null));
|
|
799
|
+
return providerStorage[prefix] || (providerStorage[prefix] = newStorage(provider, prefix));
|
|
800
|
+
}
|
|
801
|
+
function addIconSet(storage2, data) {
|
|
802
|
+
if (!quicklyValidateIconSet(data)) {
|
|
803
|
+
return [];
|
|
804
|
+
}
|
|
805
|
+
return parseIconSet(data, (name, icon) => {
|
|
806
|
+
if (icon) {
|
|
807
|
+
storage2.icons[name] = icon;
|
|
808
|
+
} else {
|
|
809
|
+
storage2.missing.add(name);
|
|
810
|
+
}
|
|
811
|
+
});
|
|
812
|
+
}
|
|
813
|
+
function addIconToStorage(storage2, name, icon) {
|
|
814
|
+
try {
|
|
815
|
+
if (typeof icon.body === "string") {
|
|
816
|
+
storage2.icons[name] = { ...icon };
|
|
817
|
+
return true;
|
|
818
|
+
}
|
|
819
|
+
} catch (err) {
|
|
820
|
+
}
|
|
821
|
+
return false;
|
|
822
|
+
}
|
|
823
|
+
function listIcons$1(provider, prefix) {
|
|
824
|
+
let allIcons = [];
|
|
825
|
+
const providers = typeof provider === "string" ? [provider] : Object.keys(dataStorage);
|
|
826
|
+
providers.forEach((provider2) => {
|
|
827
|
+
const prefixes = typeof provider2 === "string" && typeof prefix === "string" ? [prefix] : Object.keys(dataStorage[provider2] || {});
|
|
828
|
+
prefixes.forEach((prefix2) => {
|
|
829
|
+
const storage2 = getStorage(provider2, prefix2);
|
|
830
|
+
allIcons = allIcons.concat(
|
|
831
|
+
Object.keys(storage2.icons).map(
|
|
832
|
+
(name) => (provider2 !== "" ? "@" + provider2 + ":" : "") + prefix2 + ":" + name
|
|
833
|
+
)
|
|
834
|
+
);
|
|
835
|
+
});
|
|
836
|
+
});
|
|
837
|
+
return allIcons;
|
|
838
|
+
}
|
|
839
|
+
var simpleNames = false;
|
|
840
|
+
function allowSimpleNames(allow) {
|
|
841
|
+
if (typeof allow === "boolean") {
|
|
842
|
+
simpleNames = allow;
|
|
843
|
+
}
|
|
844
|
+
return simpleNames;
|
|
845
|
+
}
|
|
846
|
+
function getIconData(name) {
|
|
847
|
+
const icon = typeof name === "string" ? stringToIcon(name, true, simpleNames) : name;
|
|
848
|
+
if (icon) {
|
|
849
|
+
const storage2 = getStorage(icon.provider, icon.prefix);
|
|
850
|
+
const iconName = icon.name;
|
|
851
|
+
return storage2.icons[iconName] || (storage2.missing.has(iconName) ? null : void 0);
|
|
852
|
+
}
|
|
853
|
+
}
|
|
854
|
+
function addIcon$1(name, data) {
|
|
855
|
+
const icon = stringToIcon(name, true, simpleNames);
|
|
856
|
+
if (!icon) {
|
|
857
|
+
return false;
|
|
858
|
+
}
|
|
859
|
+
const storage2 = getStorage(icon.provider, icon.prefix);
|
|
860
|
+
return addIconToStorage(storage2, icon.name, data);
|
|
861
|
+
}
|
|
862
|
+
function addCollection$1(data, provider) {
|
|
863
|
+
if (typeof data !== "object") {
|
|
864
|
+
return false;
|
|
865
|
+
}
|
|
866
|
+
if (typeof provider !== "string") {
|
|
867
|
+
provider = data.provider || "";
|
|
868
|
+
}
|
|
869
|
+
if (simpleNames && !provider && !data.prefix) {
|
|
870
|
+
let added = false;
|
|
871
|
+
if (quicklyValidateIconSet(data)) {
|
|
872
|
+
data.prefix = "";
|
|
873
|
+
parseIconSet(data, (name, icon) => {
|
|
874
|
+
if (icon && addIcon$1(name, icon)) {
|
|
875
|
+
added = true;
|
|
876
|
+
}
|
|
877
|
+
});
|
|
878
|
+
}
|
|
879
|
+
return added;
|
|
880
|
+
}
|
|
881
|
+
const prefix = data.prefix;
|
|
882
|
+
if (!validateIconName({
|
|
883
|
+
provider,
|
|
884
|
+
prefix,
|
|
885
|
+
name: "a"
|
|
886
|
+
})) {
|
|
887
|
+
return false;
|
|
888
|
+
}
|
|
889
|
+
const storage2 = getStorage(provider, prefix);
|
|
890
|
+
return !!addIconSet(storage2, data);
|
|
891
|
+
}
|
|
892
|
+
function iconExists$1(name) {
|
|
893
|
+
return !!getIconData(name);
|
|
894
|
+
}
|
|
895
|
+
function getIcon$1(name) {
|
|
896
|
+
const result = getIconData(name);
|
|
897
|
+
return result ? {
|
|
898
|
+
...defaultIconProps,
|
|
899
|
+
...result
|
|
900
|
+
} : null;
|
|
901
|
+
}
|
|
902
|
+
function sortIcons(icons) {
|
|
903
|
+
const result = {
|
|
904
|
+
loaded: [],
|
|
905
|
+
missing: [],
|
|
906
|
+
pending: []
|
|
907
|
+
};
|
|
908
|
+
const storage2 = /* @__PURE__ */ Object.create(null);
|
|
909
|
+
icons.sort((a, b) => {
|
|
910
|
+
if (a.provider !== b.provider) {
|
|
911
|
+
return a.provider.localeCompare(b.provider);
|
|
912
|
+
}
|
|
913
|
+
if (a.prefix !== b.prefix) {
|
|
914
|
+
return a.prefix.localeCompare(b.prefix);
|
|
915
|
+
}
|
|
916
|
+
return a.name.localeCompare(b.name);
|
|
917
|
+
});
|
|
918
|
+
let lastIcon = {
|
|
919
|
+
provider: "",
|
|
920
|
+
prefix: "",
|
|
921
|
+
name: ""
|
|
922
|
+
};
|
|
923
|
+
icons.forEach((icon) => {
|
|
924
|
+
if (lastIcon.name === icon.name && lastIcon.prefix === icon.prefix && lastIcon.provider === icon.provider) {
|
|
925
|
+
return;
|
|
926
|
+
}
|
|
927
|
+
lastIcon = icon;
|
|
928
|
+
const provider = icon.provider;
|
|
929
|
+
const prefix = icon.prefix;
|
|
930
|
+
const name = icon.name;
|
|
931
|
+
const providerStorage = storage2[provider] || (storage2[provider] = /* @__PURE__ */ Object.create(null));
|
|
932
|
+
const localStorage = providerStorage[prefix] || (providerStorage[prefix] = getStorage(provider, prefix));
|
|
933
|
+
let list;
|
|
934
|
+
if (name in localStorage.icons) {
|
|
935
|
+
list = result.loaded;
|
|
936
|
+
} else if (prefix === "" || localStorage.missing.has(name)) {
|
|
937
|
+
list = result.missing;
|
|
938
|
+
} else {
|
|
939
|
+
list = result.pending;
|
|
940
|
+
}
|
|
941
|
+
const item = {
|
|
942
|
+
provider,
|
|
943
|
+
prefix,
|
|
944
|
+
name
|
|
945
|
+
};
|
|
946
|
+
list.push(item);
|
|
947
|
+
});
|
|
948
|
+
return result;
|
|
949
|
+
}
|
|
950
|
+
function removeCallback(storages, id) {
|
|
951
|
+
storages.forEach((storage2) => {
|
|
952
|
+
const items = storage2.loaderCallbacks;
|
|
953
|
+
if (items) {
|
|
954
|
+
storage2.loaderCallbacks = items.filter((row) => row.id !== id);
|
|
955
|
+
}
|
|
956
|
+
});
|
|
957
|
+
}
|
|
958
|
+
function updateCallbacks(storage2) {
|
|
959
|
+
if (!storage2.pendingCallbacksFlag) {
|
|
960
|
+
storage2.pendingCallbacksFlag = true;
|
|
961
|
+
setTimeout(() => {
|
|
962
|
+
storage2.pendingCallbacksFlag = false;
|
|
963
|
+
const items = storage2.loaderCallbacks ? storage2.loaderCallbacks.slice(0) : [];
|
|
964
|
+
if (!items.length) {
|
|
965
|
+
return;
|
|
966
|
+
}
|
|
967
|
+
let hasPending = false;
|
|
968
|
+
const provider = storage2.provider;
|
|
969
|
+
const prefix = storage2.prefix;
|
|
970
|
+
items.forEach((item) => {
|
|
971
|
+
const icons = item.icons;
|
|
972
|
+
const oldLength = icons.pending.length;
|
|
973
|
+
icons.pending = icons.pending.filter((icon) => {
|
|
974
|
+
if (icon.prefix !== prefix) {
|
|
975
|
+
return true;
|
|
976
|
+
}
|
|
977
|
+
const name = icon.name;
|
|
978
|
+
if (storage2.icons[name]) {
|
|
979
|
+
icons.loaded.push({
|
|
980
|
+
provider,
|
|
981
|
+
prefix,
|
|
982
|
+
name
|
|
983
|
+
});
|
|
984
|
+
} else if (storage2.missing.has(name)) {
|
|
985
|
+
icons.missing.push({
|
|
986
|
+
provider,
|
|
987
|
+
prefix,
|
|
988
|
+
name
|
|
989
|
+
});
|
|
990
|
+
} else {
|
|
991
|
+
hasPending = true;
|
|
992
|
+
return true;
|
|
993
|
+
}
|
|
994
|
+
return false;
|
|
995
|
+
});
|
|
996
|
+
if (icons.pending.length !== oldLength) {
|
|
997
|
+
if (!hasPending) {
|
|
998
|
+
removeCallback([storage2], item.id);
|
|
999
|
+
}
|
|
1000
|
+
item.callback(
|
|
1001
|
+
icons.loaded.slice(0),
|
|
1002
|
+
icons.missing.slice(0),
|
|
1003
|
+
icons.pending.slice(0),
|
|
1004
|
+
item.abort
|
|
1005
|
+
);
|
|
1006
|
+
}
|
|
1007
|
+
});
|
|
1008
|
+
});
|
|
1009
|
+
}
|
|
1010
|
+
}
|
|
1011
|
+
var idCounter = 0;
|
|
1012
|
+
function storeCallback(callback, icons, pendingSources) {
|
|
1013
|
+
const id = idCounter++;
|
|
1014
|
+
const abort = removeCallback.bind(null, pendingSources, id);
|
|
1015
|
+
if (!icons.pending.length) {
|
|
1016
|
+
return abort;
|
|
1017
|
+
}
|
|
1018
|
+
const item = {
|
|
1019
|
+
id,
|
|
1020
|
+
icons,
|
|
1021
|
+
callback,
|
|
1022
|
+
abort
|
|
1023
|
+
};
|
|
1024
|
+
pendingSources.forEach((storage2) => {
|
|
1025
|
+
(storage2.loaderCallbacks || (storage2.loaderCallbacks = [])).push(item);
|
|
1026
|
+
});
|
|
1027
|
+
return abort;
|
|
1028
|
+
}
|
|
1029
|
+
var storage = /* @__PURE__ */ Object.create(null);
|
|
1030
|
+
function setAPIModule(provider, item) {
|
|
1031
|
+
storage[provider] = item;
|
|
1032
|
+
}
|
|
1033
|
+
function getAPIModule(provider) {
|
|
1034
|
+
return storage[provider] || storage[""];
|
|
1035
|
+
}
|
|
1036
|
+
function listToIcons(list, validate = true, simpleNames2 = false) {
|
|
1037
|
+
const result = [];
|
|
1038
|
+
list.forEach((item) => {
|
|
1039
|
+
const icon = typeof item === "string" ? stringToIcon(item, validate, simpleNames2) : item;
|
|
1040
|
+
if (icon) {
|
|
1041
|
+
result.push(icon);
|
|
1042
|
+
}
|
|
1043
|
+
});
|
|
1044
|
+
return result;
|
|
1045
|
+
}
|
|
1046
|
+
var defaultConfig = {
|
|
1047
|
+
resources: [],
|
|
1048
|
+
index: 0,
|
|
1049
|
+
timeout: 2e3,
|
|
1050
|
+
rotate: 750,
|
|
1051
|
+
random: false,
|
|
1052
|
+
dataAfterTimeout: false
|
|
1053
|
+
};
|
|
1054
|
+
function sendQuery(config, payload, query, done) {
|
|
1055
|
+
const resourcesCount = config.resources.length;
|
|
1056
|
+
const startIndex = config.random ? Math.floor(Math.random() * resourcesCount) : config.index;
|
|
1057
|
+
let resources;
|
|
1058
|
+
if (config.random) {
|
|
1059
|
+
let list = config.resources.slice(0);
|
|
1060
|
+
resources = [];
|
|
1061
|
+
while (list.length > 1) {
|
|
1062
|
+
const nextIndex = Math.floor(Math.random() * list.length);
|
|
1063
|
+
resources.push(list[nextIndex]);
|
|
1064
|
+
list = list.slice(0, nextIndex).concat(list.slice(nextIndex + 1));
|
|
1065
|
+
}
|
|
1066
|
+
resources = resources.concat(list);
|
|
1067
|
+
} else {
|
|
1068
|
+
resources = config.resources.slice(startIndex).concat(config.resources.slice(0, startIndex));
|
|
1069
|
+
}
|
|
1070
|
+
const startTime = Date.now();
|
|
1071
|
+
let status = "pending";
|
|
1072
|
+
let queriesSent = 0;
|
|
1073
|
+
let lastError;
|
|
1074
|
+
let timer = null;
|
|
1075
|
+
let queue = [];
|
|
1076
|
+
let doneCallbacks = [];
|
|
1077
|
+
if (typeof done === "function") {
|
|
1078
|
+
doneCallbacks.push(done);
|
|
1079
|
+
}
|
|
1080
|
+
function resetTimer() {
|
|
1081
|
+
if (timer) {
|
|
1082
|
+
clearTimeout(timer);
|
|
1083
|
+
timer = null;
|
|
1084
|
+
}
|
|
1085
|
+
}
|
|
1086
|
+
function abort() {
|
|
1087
|
+
if (status === "pending") {
|
|
1088
|
+
status = "aborted";
|
|
1089
|
+
}
|
|
1090
|
+
resetTimer();
|
|
1091
|
+
queue.forEach((item) => {
|
|
1092
|
+
if (item.status === "pending") {
|
|
1093
|
+
item.status = "aborted";
|
|
1094
|
+
}
|
|
1095
|
+
});
|
|
1096
|
+
queue = [];
|
|
1097
|
+
}
|
|
1098
|
+
function subscribe(callback, overwrite) {
|
|
1099
|
+
if (overwrite) {
|
|
1100
|
+
doneCallbacks = [];
|
|
1101
|
+
}
|
|
1102
|
+
if (typeof callback === "function") {
|
|
1103
|
+
doneCallbacks.push(callback);
|
|
1104
|
+
}
|
|
1105
|
+
}
|
|
1106
|
+
function getQueryStatus() {
|
|
1107
|
+
return {
|
|
1108
|
+
startTime,
|
|
1109
|
+
payload,
|
|
1110
|
+
status,
|
|
1111
|
+
queriesSent,
|
|
1112
|
+
queriesPending: queue.length,
|
|
1113
|
+
subscribe,
|
|
1114
|
+
abort
|
|
1115
|
+
};
|
|
1116
|
+
}
|
|
1117
|
+
function failQuery() {
|
|
1118
|
+
status = "failed";
|
|
1119
|
+
doneCallbacks.forEach((callback) => {
|
|
1120
|
+
callback(void 0, lastError);
|
|
1121
|
+
});
|
|
1122
|
+
}
|
|
1123
|
+
function clearQueue() {
|
|
1124
|
+
queue.forEach((item) => {
|
|
1125
|
+
if (item.status === "pending") {
|
|
1126
|
+
item.status = "aborted";
|
|
1127
|
+
}
|
|
1128
|
+
});
|
|
1129
|
+
queue = [];
|
|
1130
|
+
}
|
|
1131
|
+
function moduleResponse(item, response, data) {
|
|
1132
|
+
const isError = response !== "success";
|
|
1133
|
+
queue = queue.filter((queued) => queued !== item);
|
|
1134
|
+
switch (status) {
|
|
1135
|
+
case "pending":
|
|
1136
|
+
break;
|
|
1137
|
+
case "failed":
|
|
1138
|
+
if (isError || !config.dataAfterTimeout) {
|
|
1139
|
+
return;
|
|
1140
|
+
}
|
|
1141
|
+
break;
|
|
1142
|
+
default:
|
|
1143
|
+
return;
|
|
1144
|
+
}
|
|
1145
|
+
if (response === "abort") {
|
|
1146
|
+
lastError = data;
|
|
1147
|
+
failQuery();
|
|
1148
|
+
return;
|
|
1149
|
+
}
|
|
1150
|
+
if (isError) {
|
|
1151
|
+
lastError = data;
|
|
1152
|
+
if (!queue.length) {
|
|
1153
|
+
if (!resources.length) {
|
|
1154
|
+
failQuery();
|
|
1155
|
+
} else {
|
|
1156
|
+
execNext();
|
|
1157
|
+
}
|
|
1158
|
+
}
|
|
1159
|
+
return;
|
|
1160
|
+
}
|
|
1161
|
+
resetTimer();
|
|
1162
|
+
clearQueue();
|
|
1163
|
+
if (!config.random) {
|
|
1164
|
+
const index = config.resources.indexOf(item.resource);
|
|
1165
|
+
if (index !== -1 && index !== config.index) {
|
|
1166
|
+
config.index = index;
|
|
1167
|
+
}
|
|
1168
|
+
}
|
|
1169
|
+
status = "completed";
|
|
1170
|
+
doneCallbacks.forEach((callback) => {
|
|
1171
|
+
callback(data);
|
|
1172
|
+
});
|
|
1173
|
+
}
|
|
1174
|
+
function execNext() {
|
|
1175
|
+
if (status !== "pending") {
|
|
1176
|
+
return;
|
|
1177
|
+
}
|
|
1178
|
+
resetTimer();
|
|
1179
|
+
const resource = resources.shift();
|
|
1180
|
+
if (resource === void 0) {
|
|
1181
|
+
if (queue.length) {
|
|
1182
|
+
timer = setTimeout(() => {
|
|
1183
|
+
resetTimer();
|
|
1184
|
+
if (status === "pending") {
|
|
1185
|
+
clearQueue();
|
|
1186
|
+
failQuery();
|
|
1187
|
+
}
|
|
1188
|
+
}, config.timeout);
|
|
1189
|
+
return;
|
|
1190
|
+
}
|
|
1191
|
+
failQuery();
|
|
1192
|
+
return;
|
|
1193
|
+
}
|
|
1194
|
+
const item = {
|
|
1195
|
+
status: "pending",
|
|
1196
|
+
resource,
|
|
1197
|
+
callback: (status2, data) => {
|
|
1198
|
+
moduleResponse(item, status2, data);
|
|
1199
|
+
}
|
|
1200
|
+
};
|
|
1201
|
+
queue.push(item);
|
|
1202
|
+
queriesSent++;
|
|
1203
|
+
timer = setTimeout(execNext, config.rotate);
|
|
1204
|
+
query(resource, payload, item.callback);
|
|
1205
|
+
}
|
|
1206
|
+
setTimeout(execNext);
|
|
1207
|
+
return getQueryStatus;
|
|
1208
|
+
}
|
|
1209
|
+
function initRedundancy(cfg) {
|
|
1210
|
+
const config = {
|
|
1211
|
+
...defaultConfig,
|
|
1212
|
+
...cfg
|
|
1213
|
+
};
|
|
1214
|
+
let queries = [];
|
|
1215
|
+
function cleanup() {
|
|
1216
|
+
queries = queries.filter((item) => item().status === "pending");
|
|
1217
|
+
}
|
|
1218
|
+
function query(payload, queryCallback, doneCallback) {
|
|
1219
|
+
const query2 = sendQuery(
|
|
1220
|
+
config,
|
|
1221
|
+
payload,
|
|
1222
|
+
queryCallback,
|
|
1223
|
+
(data, error) => {
|
|
1224
|
+
cleanup();
|
|
1225
|
+
if (doneCallback) {
|
|
1226
|
+
doneCallback(data, error);
|
|
1227
|
+
}
|
|
1228
|
+
}
|
|
1229
|
+
);
|
|
1230
|
+
queries.push(query2);
|
|
1231
|
+
return query2;
|
|
1232
|
+
}
|
|
1233
|
+
function find(callback) {
|
|
1234
|
+
return queries.find((value) => {
|
|
1235
|
+
return callback(value);
|
|
1236
|
+
}) || null;
|
|
1237
|
+
}
|
|
1238
|
+
const instance = {
|
|
1239
|
+
query,
|
|
1240
|
+
find,
|
|
1241
|
+
setIndex: (index) => {
|
|
1242
|
+
config.index = index;
|
|
1243
|
+
},
|
|
1244
|
+
getIndex: () => config.index,
|
|
1245
|
+
cleanup
|
|
1246
|
+
};
|
|
1247
|
+
return instance;
|
|
1248
|
+
}
|
|
1249
|
+
function createAPIConfig(source) {
|
|
1250
|
+
let resources;
|
|
1251
|
+
if (typeof source.resources === "string") {
|
|
1252
|
+
resources = [source.resources];
|
|
1253
|
+
} else {
|
|
1254
|
+
resources = source.resources;
|
|
1255
|
+
if (!(resources instanceof Array) || !resources.length) {
|
|
1256
|
+
return null;
|
|
1257
|
+
}
|
|
1258
|
+
}
|
|
1259
|
+
const result = {
|
|
1260
|
+
resources,
|
|
1261
|
+
path: source.path || "/",
|
|
1262
|
+
maxURL: source.maxURL || 500,
|
|
1263
|
+
rotate: source.rotate || 750,
|
|
1264
|
+
timeout: source.timeout || 5e3,
|
|
1265
|
+
random: source.random === true,
|
|
1266
|
+
index: source.index || 0,
|
|
1267
|
+
dataAfterTimeout: source.dataAfterTimeout !== false
|
|
1268
|
+
};
|
|
1269
|
+
return result;
|
|
1270
|
+
}
|
|
1271
|
+
var configStorage = /* @__PURE__ */ Object.create(null);
|
|
1272
|
+
var fallBackAPISources = [
|
|
1273
|
+
"https://api.simplesvg.com",
|
|
1274
|
+
"https://api.unisvg.com"
|
|
1275
|
+
];
|
|
1276
|
+
var fallBackAPI = [];
|
|
1277
|
+
while (fallBackAPISources.length > 0) {
|
|
1278
|
+
if (fallBackAPISources.length === 1) {
|
|
1279
|
+
fallBackAPI.push(fallBackAPISources.shift());
|
|
1280
|
+
} else {
|
|
1281
|
+
if (Math.random() > 0.5) {
|
|
1282
|
+
fallBackAPI.push(fallBackAPISources.shift());
|
|
1283
|
+
} else {
|
|
1284
|
+
fallBackAPI.push(fallBackAPISources.pop());
|
|
1285
|
+
}
|
|
1286
|
+
}
|
|
1287
|
+
}
|
|
1288
|
+
configStorage[""] = createAPIConfig({
|
|
1289
|
+
resources: ["https://api.iconify.design"].concat(fallBackAPI)
|
|
1290
|
+
});
|
|
1291
|
+
function addAPIProvider$1(provider, customConfig) {
|
|
1292
|
+
const config = createAPIConfig(customConfig);
|
|
1293
|
+
if (config === null) {
|
|
1294
|
+
return false;
|
|
1295
|
+
}
|
|
1296
|
+
configStorage[provider] = config;
|
|
1297
|
+
return true;
|
|
1298
|
+
}
|
|
1299
|
+
function getAPIConfig(provider) {
|
|
1300
|
+
return configStorage[provider];
|
|
1301
|
+
}
|
|
1302
|
+
function listAPIProviders() {
|
|
1303
|
+
return Object.keys(configStorage);
|
|
1304
|
+
}
|
|
1305
|
+
function emptyCallback$1() {
|
|
1306
|
+
}
|
|
1307
|
+
var redundancyCache = /* @__PURE__ */ Object.create(null);
|
|
1308
|
+
function getRedundancyCache(provider) {
|
|
1309
|
+
if (!redundancyCache[provider]) {
|
|
1310
|
+
const config = getAPIConfig(provider);
|
|
1311
|
+
if (!config) {
|
|
1312
|
+
return;
|
|
1313
|
+
}
|
|
1314
|
+
const redundancy = initRedundancy(config);
|
|
1315
|
+
const cachedReundancy = {
|
|
1316
|
+
config,
|
|
1317
|
+
redundancy
|
|
1318
|
+
};
|
|
1319
|
+
redundancyCache[provider] = cachedReundancy;
|
|
1320
|
+
}
|
|
1321
|
+
return redundancyCache[provider];
|
|
1322
|
+
}
|
|
1323
|
+
function sendAPIQuery(target, query, callback) {
|
|
1324
|
+
let redundancy;
|
|
1325
|
+
let send2;
|
|
1326
|
+
if (typeof target === "string") {
|
|
1327
|
+
const api = getAPIModule(target);
|
|
1328
|
+
if (!api) {
|
|
1329
|
+
callback(void 0, 424);
|
|
1330
|
+
return emptyCallback$1;
|
|
1331
|
+
}
|
|
1332
|
+
send2 = api.send;
|
|
1333
|
+
const cached = getRedundancyCache(target);
|
|
1334
|
+
if (cached) {
|
|
1335
|
+
redundancy = cached.redundancy;
|
|
1336
|
+
}
|
|
1337
|
+
} else {
|
|
1338
|
+
const config = createAPIConfig(target);
|
|
1339
|
+
if (config) {
|
|
1340
|
+
redundancy = initRedundancy(config);
|
|
1341
|
+
const moduleKey = target.resources ? target.resources[0] : "";
|
|
1342
|
+
const api = getAPIModule(moduleKey);
|
|
1343
|
+
if (api) {
|
|
1344
|
+
send2 = api.send;
|
|
1345
|
+
}
|
|
1346
|
+
}
|
|
1347
|
+
}
|
|
1348
|
+
if (!redundancy || !send2) {
|
|
1349
|
+
callback(void 0, 424);
|
|
1350
|
+
return emptyCallback$1;
|
|
1351
|
+
}
|
|
1352
|
+
return redundancy.query(query, send2, callback)().abort;
|
|
1353
|
+
}
|
|
1354
|
+
var browserCacheVersion = "iconify2";
|
|
1355
|
+
var browserCachePrefix = "iconify";
|
|
1356
|
+
var browserCacheCountKey = browserCachePrefix + "-count";
|
|
1357
|
+
var browserCacheVersionKey = browserCachePrefix + "-version";
|
|
1358
|
+
var browserStorageHour = 36e5;
|
|
1359
|
+
var browserStorageCacheExpiration = 168;
|
|
1360
|
+
function getStoredItem(func, key) {
|
|
1361
|
+
try {
|
|
1362
|
+
return func.getItem(key);
|
|
1363
|
+
} catch (err) {
|
|
1364
|
+
}
|
|
1365
|
+
}
|
|
1366
|
+
function setStoredItem(func, key, value) {
|
|
1367
|
+
try {
|
|
1368
|
+
func.setItem(key, value);
|
|
1369
|
+
return true;
|
|
1370
|
+
} catch (err) {
|
|
1371
|
+
}
|
|
1372
|
+
}
|
|
1373
|
+
function removeStoredItem(func, key) {
|
|
1374
|
+
try {
|
|
1375
|
+
func.removeItem(key);
|
|
1376
|
+
} catch (err) {
|
|
1377
|
+
}
|
|
1378
|
+
}
|
|
1379
|
+
function setBrowserStorageItemsCount(storage2, value) {
|
|
1380
|
+
return setStoredItem(storage2, browserCacheCountKey, value.toString());
|
|
1381
|
+
}
|
|
1382
|
+
function getBrowserStorageItemsCount(storage2) {
|
|
1383
|
+
return parseInt(getStoredItem(storage2, browserCacheCountKey)) || 0;
|
|
1384
|
+
}
|
|
1385
|
+
var browserStorageConfig = {
|
|
1386
|
+
local: true,
|
|
1387
|
+
session: true
|
|
1388
|
+
};
|
|
1389
|
+
var browserStorageEmptyItems = {
|
|
1390
|
+
local: /* @__PURE__ */ new Set(),
|
|
1391
|
+
session: /* @__PURE__ */ new Set()
|
|
1392
|
+
};
|
|
1393
|
+
var browserStorageStatus = false;
|
|
1394
|
+
function setBrowserStorageStatus(status) {
|
|
1395
|
+
browserStorageStatus = status;
|
|
1396
|
+
}
|
|
1397
|
+
var _window = typeof window === "undefined" ? {} : window;
|
|
1398
|
+
function getBrowserStorage(key) {
|
|
1399
|
+
const attr = key + "Storage";
|
|
1400
|
+
try {
|
|
1401
|
+
if (_window && _window[attr] && typeof _window[attr].length === "number") {
|
|
1402
|
+
return _window[attr];
|
|
1403
|
+
}
|
|
1404
|
+
} catch (err) {
|
|
1405
|
+
}
|
|
1406
|
+
browserStorageConfig[key] = false;
|
|
1407
|
+
}
|
|
1408
|
+
function iterateBrowserStorage(key, callback) {
|
|
1409
|
+
const func = getBrowserStorage(key);
|
|
1410
|
+
if (!func) {
|
|
1411
|
+
return;
|
|
1412
|
+
}
|
|
1413
|
+
const version = getStoredItem(func, browserCacheVersionKey);
|
|
1414
|
+
if (version !== browserCacheVersion) {
|
|
1415
|
+
if (version) {
|
|
1416
|
+
const total2 = getBrowserStorageItemsCount(func);
|
|
1417
|
+
for (let i = 0; i < total2; i++) {
|
|
1418
|
+
removeStoredItem(func, browserCachePrefix + i.toString());
|
|
1419
|
+
}
|
|
1420
|
+
}
|
|
1421
|
+
setStoredItem(func, browserCacheVersionKey, browserCacheVersion);
|
|
1422
|
+
setBrowserStorageItemsCount(func, 0);
|
|
1423
|
+
return;
|
|
1424
|
+
}
|
|
1425
|
+
const minTime = Math.floor(Date.now() / browserStorageHour) - browserStorageCacheExpiration;
|
|
1426
|
+
const parseItem = (index) => {
|
|
1427
|
+
const name = browserCachePrefix + index.toString();
|
|
1428
|
+
const item = getStoredItem(func, name);
|
|
1429
|
+
if (typeof item !== "string") {
|
|
1430
|
+
return;
|
|
1431
|
+
}
|
|
1432
|
+
try {
|
|
1433
|
+
const data = JSON.parse(item);
|
|
1434
|
+
if (typeof data === "object" && typeof data.cached === "number" && data.cached > minTime && typeof data.provider === "string" && typeof data.data === "object" && typeof data.data.prefix === "string" && callback(data, index)) {
|
|
1435
|
+
return true;
|
|
1436
|
+
}
|
|
1437
|
+
} catch (err) {
|
|
1438
|
+
}
|
|
1439
|
+
removeStoredItem(func, name);
|
|
1440
|
+
};
|
|
1441
|
+
let total = getBrowserStorageItemsCount(func);
|
|
1442
|
+
for (let i = total - 1; i >= 0; i--) {
|
|
1443
|
+
if (!parseItem(i)) {
|
|
1444
|
+
if (i === total - 1) {
|
|
1445
|
+
total--;
|
|
1446
|
+
setBrowserStorageItemsCount(func, total);
|
|
1447
|
+
} else {
|
|
1448
|
+
browserStorageEmptyItems[key].add(i);
|
|
1449
|
+
}
|
|
1450
|
+
}
|
|
1451
|
+
}
|
|
1452
|
+
}
|
|
1453
|
+
function initBrowserStorage() {
|
|
1454
|
+
if (browserStorageStatus) {
|
|
1455
|
+
return;
|
|
1456
|
+
}
|
|
1457
|
+
setBrowserStorageStatus(true);
|
|
1458
|
+
for (const key in browserStorageConfig) {
|
|
1459
|
+
iterateBrowserStorage(key, (item) => {
|
|
1460
|
+
const iconSet = item.data;
|
|
1461
|
+
const provider = item.provider;
|
|
1462
|
+
const prefix = iconSet.prefix;
|
|
1463
|
+
const storage2 = getStorage(
|
|
1464
|
+
provider,
|
|
1465
|
+
prefix
|
|
1466
|
+
);
|
|
1467
|
+
if (!addIconSet(storage2, iconSet).length) {
|
|
1468
|
+
return false;
|
|
1469
|
+
}
|
|
1470
|
+
const lastModified = iconSet.lastModified || -1;
|
|
1471
|
+
storage2.lastModifiedCached = storage2.lastModifiedCached ? Math.min(storage2.lastModifiedCached, lastModified) : lastModified;
|
|
1472
|
+
return true;
|
|
1473
|
+
});
|
|
1474
|
+
}
|
|
1475
|
+
}
|
|
1476
|
+
function updateLastModified(storage2, lastModified) {
|
|
1477
|
+
const lastValue = storage2.lastModifiedCached;
|
|
1478
|
+
if (lastValue && lastValue >= lastModified) {
|
|
1479
|
+
return lastValue === lastModified;
|
|
1480
|
+
}
|
|
1481
|
+
storage2.lastModifiedCached = lastModified;
|
|
1482
|
+
if (lastValue) {
|
|
1483
|
+
for (const key in browserStorageConfig) {
|
|
1484
|
+
iterateBrowserStorage(key, (item) => {
|
|
1485
|
+
const iconSet = item.data;
|
|
1486
|
+
return item.provider !== storage2.provider || iconSet.prefix !== storage2.prefix || iconSet.lastModified === lastModified;
|
|
1487
|
+
});
|
|
1488
|
+
}
|
|
1489
|
+
}
|
|
1490
|
+
return true;
|
|
1491
|
+
}
|
|
1492
|
+
function storeInBrowserStorage(storage2, data) {
|
|
1493
|
+
if (!browserStorageStatus) {
|
|
1494
|
+
initBrowserStorage();
|
|
1495
|
+
}
|
|
1496
|
+
function store(key) {
|
|
1497
|
+
let func;
|
|
1498
|
+
if (!browserStorageConfig[key] || !(func = getBrowserStorage(key))) {
|
|
1499
|
+
return;
|
|
1500
|
+
}
|
|
1501
|
+
const set = browserStorageEmptyItems[key];
|
|
1502
|
+
let index;
|
|
1503
|
+
if (set.size) {
|
|
1504
|
+
set.delete(index = Array.from(set).shift());
|
|
1505
|
+
} else {
|
|
1506
|
+
index = getBrowserStorageItemsCount(func);
|
|
1507
|
+
if (!setBrowserStorageItemsCount(func, index + 1)) {
|
|
1508
|
+
return;
|
|
1509
|
+
}
|
|
1510
|
+
}
|
|
1511
|
+
const item = {
|
|
1512
|
+
cached: Math.floor(Date.now() / browserStorageHour),
|
|
1513
|
+
provider: storage2.provider,
|
|
1514
|
+
data
|
|
1515
|
+
};
|
|
1516
|
+
return setStoredItem(
|
|
1517
|
+
func,
|
|
1518
|
+
browserCachePrefix + index.toString(),
|
|
1519
|
+
JSON.stringify(item)
|
|
1520
|
+
);
|
|
1521
|
+
}
|
|
1522
|
+
if (data.lastModified && !updateLastModified(storage2, data.lastModified)) {
|
|
1523
|
+
return;
|
|
1524
|
+
}
|
|
1525
|
+
if (!Object.keys(data.icons).length) {
|
|
1526
|
+
return;
|
|
1527
|
+
}
|
|
1528
|
+
if (data.not_found) {
|
|
1529
|
+
data = Object.assign({}, data);
|
|
1530
|
+
delete data.not_found;
|
|
1531
|
+
}
|
|
1532
|
+
if (!store("local")) {
|
|
1533
|
+
store("session");
|
|
1534
|
+
}
|
|
1535
|
+
}
|
|
1536
|
+
function emptyCallback() {
|
|
1537
|
+
}
|
|
1538
|
+
function loadedNewIcons(storage2) {
|
|
1539
|
+
if (!storage2.iconsLoaderFlag) {
|
|
1540
|
+
storage2.iconsLoaderFlag = true;
|
|
1541
|
+
setTimeout(() => {
|
|
1542
|
+
storage2.iconsLoaderFlag = false;
|
|
1543
|
+
updateCallbacks(storage2);
|
|
1544
|
+
});
|
|
1545
|
+
}
|
|
1546
|
+
}
|
|
1547
|
+
function loadNewIcons(storage2, icons) {
|
|
1548
|
+
if (!storage2.iconsToLoad) {
|
|
1549
|
+
storage2.iconsToLoad = icons;
|
|
1550
|
+
} else {
|
|
1551
|
+
storage2.iconsToLoad = storage2.iconsToLoad.concat(icons).sort();
|
|
1552
|
+
}
|
|
1553
|
+
if (!storage2.iconsQueueFlag) {
|
|
1554
|
+
storage2.iconsQueueFlag = true;
|
|
1555
|
+
setTimeout(() => {
|
|
1556
|
+
storage2.iconsQueueFlag = false;
|
|
1557
|
+
const { provider, prefix } = storage2;
|
|
1558
|
+
const icons2 = storage2.iconsToLoad;
|
|
1559
|
+
delete storage2.iconsToLoad;
|
|
1560
|
+
let api;
|
|
1561
|
+
if (!icons2 || !(api = getAPIModule(provider))) {
|
|
1562
|
+
return;
|
|
1563
|
+
}
|
|
1564
|
+
const params = api.prepare(provider, prefix, icons2);
|
|
1565
|
+
params.forEach((item) => {
|
|
1566
|
+
sendAPIQuery(provider, item, (data) => {
|
|
1567
|
+
if (typeof data !== "object") {
|
|
1568
|
+
item.icons.forEach((name) => {
|
|
1569
|
+
storage2.missing.add(name);
|
|
1570
|
+
});
|
|
1571
|
+
} else {
|
|
1572
|
+
try {
|
|
1573
|
+
const parsed = addIconSet(
|
|
1574
|
+
storage2,
|
|
1575
|
+
data
|
|
1576
|
+
);
|
|
1577
|
+
if (!parsed.length) {
|
|
1578
|
+
return;
|
|
1579
|
+
}
|
|
1580
|
+
const pending = storage2.pendingIcons;
|
|
1581
|
+
if (pending) {
|
|
1582
|
+
parsed.forEach((name) => {
|
|
1583
|
+
pending.delete(name);
|
|
1584
|
+
});
|
|
1585
|
+
}
|
|
1586
|
+
storeInBrowserStorage(storage2, data);
|
|
1587
|
+
} catch (err) {
|
|
1588
|
+
console.error(err);
|
|
1589
|
+
}
|
|
1590
|
+
}
|
|
1591
|
+
loadedNewIcons(storage2);
|
|
1592
|
+
});
|
|
1593
|
+
});
|
|
1594
|
+
});
|
|
1595
|
+
}
|
|
1596
|
+
}
|
|
1597
|
+
var loadIcons$1 = (icons, callback) => {
|
|
1598
|
+
const cleanedIcons = listToIcons(icons, true, allowSimpleNames());
|
|
1599
|
+
const sortedIcons = sortIcons(cleanedIcons);
|
|
1600
|
+
if (!sortedIcons.pending.length) {
|
|
1601
|
+
let callCallback = true;
|
|
1602
|
+
if (callback) {
|
|
1603
|
+
setTimeout(() => {
|
|
1604
|
+
if (callCallback) {
|
|
1605
|
+
callback(
|
|
1606
|
+
sortedIcons.loaded,
|
|
1607
|
+
sortedIcons.missing,
|
|
1608
|
+
sortedIcons.pending,
|
|
1609
|
+
emptyCallback
|
|
1610
|
+
);
|
|
1611
|
+
}
|
|
1612
|
+
});
|
|
1613
|
+
}
|
|
1614
|
+
return () => {
|
|
1615
|
+
callCallback = false;
|
|
1616
|
+
};
|
|
1617
|
+
}
|
|
1618
|
+
const newIcons = /* @__PURE__ */ Object.create(null);
|
|
1619
|
+
const sources = [];
|
|
1620
|
+
let lastProvider, lastPrefix;
|
|
1621
|
+
sortedIcons.pending.forEach((icon) => {
|
|
1622
|
+
const { provider, prefix } = icon;
|
|
1623
|
+
if (prefix === lastPrefix && provider === lastProvider) {
|
|
1624
|
+
return;
|
|
1625
|
+
}
|
|
1626
|
+
lastProvider = provider;
|
|
1627
|
+
lastPrefix = prefix;
|
|
1628
|
+
sources.push(getStorage(provider, prefix));
|
|
1629
|
+
const providerNewIcons = newIcons[provider] || (newIcons[provider] = /* @__PURE__ */ Object.create(null));
|
|
1630
|
+
if (!providerNewIcons[prefix]) {
|
|
1631
|
+
providerNewIcons[prefix] = [];
|
|
1632
|
+
}
|
|
1633
|
+
});
|
|
1634
|
+
sortedIcons.pending.forEach((icon) => {
|
|
1635
|
+
const { provider, prefix, name } = icon;
|
|
1636
|
+
const storage2 = getStorage(provider, prefix);
|
|
1637
|
+
const pendingQueue = storage2.pendingIcons || (storage2.pendingIcons = /* @__PURE__ */ new Set());
|
|
1638
|
+
if (!pendingQueue.has(name)) {
|
|
1639
|
+
pendingQueue.add(name);
|
|
1640
|
+
newIcons[provider][prefix].push(name);
|
|
1641
|
+
}
|
|
1642
|
+
});
|
|
1643
|
+
sources.forEach((storage2) => {
|
|
1644
|
+
const { provider, prefix } = storage2;
|
|
1645
|
+
if (newIcons[provider][prefix].length) {
|
|
1646
|
+
loadNewIcons(storage2, newIcons[provider][prefix]);
|
|
1647
|
+
}
|
|
1648
|
+
});
|
|
1649
|
+
return callback ? storeCallback(callback, sortedIcons, sources) : emptyCallback;
|
|
1650
|
+
};
|
|
1651
|
+
var loadIcon$1 = (icon) => {
|
|
1652
|
+
return new Promise((fulfill, reject) => {
|
|
1653
|
+
const iconObj = typeof icon === "string" ? stringToIcon(icon, true) : icon;
|
|
1654
|
+
if (!iconObj) {
|
|
1655
|
+
reject(icon);
|
|
1656
|
+
return;
|
|
1657
|
+
}
|
|
1658
|
+
loadIcons$1([iconObj || icon], (loaded) => {
|
|
1659
|
+
if (loaded.length && iconObj) {
|
|
1660
|
+
const data = getIconData(iconObj);
|
|
1661
|
+
if (data) {
|
|
1662
|
+
fulfill({
|
|
1663
|
+
...defaultIconProps,
|
|
1664
|
+
...data
|
|
1665
|
+
});
|
|
1666
|
+
return;
|
|
1667
|
+
}
|
|
1668
|
+
}
|
|
1669
|
+
reject(icon);
|
|
1670
|
+
});
|
|
1671
|
+
});
|
|
1672
|
+
};
|
|
1673
|
+
function testIconObject(value) {
|
|
1674
|
+
try {
|
|
1675
|
+
const obj = typeof value === "string" ? JSON.parse(value) : value;
|
|
1676
|
+
if (typeof obj.body === "string") {
|
|
1677
|
+
return {
|
|
1678
|
+
...obj
|
|
1679
|
+
};
|
|
1680
|
+
}
|
|
1681
|
+
} catch (err) {
|
|
1682
|
+
}
|
|
1683
|
+
}
|
|
1684
|
+
function parseIconValue(value, onload) {
|
|
1685
|
+
const name = typeof value === "string" ? stringToIcon(value, true, true) : null;
|
|
1686
|
+
if (!name) {
|
|
1687
|
+
const data2 = testIconObject(value);
|
|
1688
|
+
return {
|
|
1689
|
+
value,
|
|
1690
|
+
data: data2
|
|
1691
|
+
};
|
|
1692
|
+
}
|
|
1693
|
+
const data = getIconData(name);
|
|
1694
|
+
if (data !== void 0 || !name.prefix) {
|
|
1695
|
+
return {
|
|
1696
|
+
value,
|
|
1697
|
+
name,
|
|
1698
|
+
data
|
|
1699
|
+
// could be 'null' -> icon is missing
|
|
1700
|
+
};
|
|
1701
|
+
}
|
|
1702
|
+
const loading = loadIcons$1([name], () => onload(value, name, getIconData(name)));
|
|
1703
|
+
return {
|
|
1704
|
+
value,
|
|
1705
|
+
name,
|
|
1706
|
+
loading
|
|
1707
|
+
};
|
|
1708
|
+
}
|
|
1709
|
+
function getInline(node) {
|
|
1710
|
+
return node.hasAttribute("inline");
|
|
1711
|
+
}
|
|
1712
|
+
var isBuggedSafari = false;
|
|
1713
|
+
try {
|
|
1714
|
+
isBuggedSafari = navigator.vendor.indexOf("Apple") === 0;
|
|
1715
|
+
} catch (err) {
|
|
1716
|
+
}
|
|
1717
|
+
function getRenderMode(body, mode) {
|
|
1718
|
+
switch (mode) {
|
|
1719
|
+
case "svg":
|
|
1720
|
+
case "bg":
|
|
1721
|
+
case "mask":
|
|
1722
|
+
return mode;
|
|
1723
|
+
}
|
|
1724
|
+
if (mode !== "style" && (isBuggedSafari || body.indexOf("<a") === -1)) {
|
|
1725
|
+
return "svg";
|
|
1726
|
+
}
|
|
1727
|
+
return body.indexOf("currentColor") === -1 ? "bg" : "mask";
|
|
1728
|
+
}
|
|
1729
|
+
var unitsSplit = /(-?[0-9.]*[0-9]+[0-9.]*)/g;
|
|
1730
|
+
var unitsTest = /^-?[0-9.]*[0-9]+[0-9.]*$/g;
|
|
1731
|
+
function calculateSize$1(size, ratio, precision) {
|
|
1732
|
+
if (ratio === 1) {
|
|
1733
|
+
return size;
|
|
1734
|
+
}
|
|
1735
|
+
precision = precision || 100;
|
|
1736
|
+
if (typeof size === "number") {
|
|
1737
|
+
return Math.ceil(size * ratio * precision) / precision;
|
|
1738
|
+
}
|
|
1739
|
+
if (typeof size !== "string") {
|
|
1740
|
+
return size;
|
|
1741
|
+
}
|
|
1742
|
+
const oldParts = size.split(unitsSplit);
|
|
1743
|
+
if (oldParts === null || !oldParts.length) {
|
|
1744
|
+
return size;
|
|
1745
|
+
}
|
|
1746
|
+
const newParts = [];
|
|
1747
|
+
let code = oldParts.shift();
|
|
1748
|
+
let isNumber = unitsTest.test(code);
|
|
1749
|
+
while (true) {
|
|
1750
|
+
if (isNumber) {
|
|
1751
|
+
const num = parseFloat(code);
|
|
1752
|
+
if (isNaN(num)) {
|
|
1753
|
+
newParts.push(code);
|
|
1754
|
+
} else {
|
|
1755
|
+
newParts.push(Math.ceil(num * ratio * precision) / precision);
|
|
1756
|
+
}
|
|
1757
|
+
} else {
|
|
1758
|
+
newParts.push(code);
|
|
1759
|
+
}
|
|
1760
|
+
code = oldParts.shift();
|
|
1761
|
+
if (code === void 0) {
|
|
1762
|
+
return newParts.join("");
|
|
1763
|
+
}
|
|
1764
|
+
isNumber = !isNumber;
|
|
1765
|
+
}
|
|
1766
|
+
}
|
|
1767
|
+
var isUnsetKeyword = (value) => value === "unset" || value === "undefined" || value === "none";
|
|
1768
|
+
function iconToSVG(icon, customisations) {
|
|
1769
|
+
const fullIcon = {
|
|
1770
|
+
...defaultIconProps,
|
|
1771
|
+
...icon
|
|
1772
|
+
};
|
|
1773
|
+
const fullCustomisations = {
|
|
1774
|
+
...defaultIconCustomisations,
|
|
1775
|
+
...customisations
|
|
1776
|
+
};
|
|
1777
|
+
const box = {
|
|
1778
|
+
left: fullIcon.left,
|
|
1779
|
+
top: fullIcon.top,
|
|
1780
|
+
width: fullIcon.width,
|
|
1781
|
+
height: fullIcon.height
|
|
1782
|
+
};
|
|
1783
|
+
let body = fullIcon.body;
|
|
1784
|
+
[fullIcon, fullCustomisations].forEach((props) => {
|
|
1785
|
+
const transformations = [];
|
|
1786
|
+
const hFlip = props.hFlip;
|
|
1787
|
+
const vFlip = props.vFlip;
|
|
1788
|
+
let rotation = props.rotate;
|
|
1789
|
+
if (hFlip) {
|
|
1790
|
+
if (vFlip) {
|
|
1791
|
+
rotation += 2;
|
|
1792
|
+
} else {
|
|
1793
|
+
transformations.push(
|
|
1794
|
+
"translate(" + (box.width + box.left).toString() + " " + (0 - box.top).toString() + ")"
|
|
1795
|
+
);
|
|
1796
|
+
transformations.push("scale(-1 1)");
|
|
1797
|
+
box.top = box.left = 0;
|
|
1798
|
+
}
|
|
1799
|
+
} else if (vFlip) {
|
|
1800
|
+
transformations.push(
|
|
1801
|
+
"translate(" + (0 - box.left).toString() + " " + (box.height + box.top).toString() + ")"
|
|
1802
|
+
);
|
|
1803
|
+
transformations.push("scale(1 -1)");
|
|
1804
|
+
box.top = box.left = 0;
|
|
1805
|
+
}
|
|
1806
|
+
let tempValue;
|
|
1807
|
+
if (rotation < 0) {
|
|
1808
|
+
rotation -= Math.floor(rotation / 4) * 4;
|
|
1809
|
+
}
|
|
1810
|
+
rotation = rotation % 4;
|
|
1811
|
+
switch (rotation) {
|
|
1812
|
+
case 1:
|
|
1813
|
+
tempValue = box.height / 2 + box.top;
|
|
1814
|
+
transformations.unshift(
|
|
1815
|
+
"rotate(90 " + tempValue.toString() + " " + tempValue.toString() + ")"
|
|
1816
|
+
);
|
|
1817
|
+
break;
|
|
1818
|
+
case 2:
|
|
1819
|
+
transformations.unshift(
|
|
1820
|
+
"rotate(180 " + (box.width / 2 + box.left).toString() + " " + (box.height / 2 + box.top).toString() + ")"
|
|
1821
|
+
);
|
|
1822
|
+
break;
|
|
1823
|
+
case 3:
|
|
1824
|
+
tempValue = box.width / 2 + box.left;
|
|
1825
|
+
transformations.unshift(
|
|
1826
|
+
"rotate(-90 " + tempValue.toString() + " " + tempValue.toString() + ")"
|
|
1827
|
+
);
|
|
1828
|
+
break;
|
|
1829
|
+
}
|
|
1830
|
+
if (rotation % 2 === 1) {
|
|
1831
|
+
if (box.left !== box.top) {
|
|
1832
|
+
tempValue = box.left;
|
|
1833
|
+
box.left = box.top;
|
|
1834
|
+
box.top = tempValue;
|
|
1835
|
+
}
|
|
1836
|
+
if (box.width !== box.height) {
|
|
1837
|
+
tempValue = box.width;
|
|
1838
|
+
box.width = box.height;
|
|
1839
|
+
box.height = tempValue;
|
|
1840
|
+
}
|
|
1841
|
+
}
|
|
1842
|
+
if (transformations.length) {
|
|
1843
|
+
body = '<g transform="' + transformations.join(" ") + '">' + body + "</g>";
|
|
1844
|
+
}
|
|
1845
|
+
});
|
|
1846
|
+
const customisationsWidth = fullCustomisations.width;
|
|
1847
|
+
const customisationsHeight = fullCustomisations.height;
|
|
1848
|
+
const boxWidth = box.width;
|
|
1849
|
+
const boxHeight = box.height;
|
|
1850
|
+
let width;
|
|
1851
|
+
let height;
|
|
1852
|
+
if (customisationsWidth === null) {
|
|
1853
|
+
height = customisationsHeight === null ? "1em" : customisationsHeight === "auto" ? boxHeight : customisationsHeight;
|
|
1854
|
+
width = calculateSize$1(height, boxWidth / boxHeight);
|
|
1855
|
+
} else {
|
|
1856
|
+
width = customisationsWidth === "auto" ? boxWidth : customisationsWidth;
|
|
1857
|
+
height = customisationsHeight === null ? calculateSize$1(width, boxHeight / boxWidth) : customisationsHeight === "auto" ? boxHeight : customisationsHeight;
|
|
1858
|
+
}
|
|
1859
|
+
const attributes = {};
|
|
1860
|
+
const setAttr = (prop, value) => {
|
|
1861
|
+
if (!isUnsetKeyword(value)) {
|
|
1862
|
+
attributes[prop] = value.toString();
|
|
1863
|
+
}
|
|
1864
|
+
};
|
|
1865
|
+
setAttr("width", width);
|
|
1866
|
+
setAttr("height", height);
|
|
1867
|
+
attributes.viewBox = box.left.toString() + " " + box.top.toString() + " " + boxWidth.toString() + " " + boxHeight.toString();
|
|
1868
|
+
return {
|
|
1869
|
+
attributes,
|
|
1870
|
+
body
|
|
1871
|
+
};
|
|
1872
|
+
}
|
|
1873
|
+
var detectFetch = () => {
|
|
1874
|
+
let callback;
|
|
1875
|
+
try {
|
|
1876
|
+
callback = fetch;
|
|
1877
|
+
if (typeof callback === "function") {
|
|
1878
|
+
return callback;
|
|
1879
|
+
}
|
|
1880
|
+
} catch (err) {
|
|
1881
|
+
}
|
|
1882
|
+
};
|
|
1883
|
+
var fetchModule = detectFetch();
|
|
1884
|
+
function setFetch(fetch2) {
|
|
1885
|
+
fetchModule = fetch2;
|
|
1886
|
+
}
|
|
1887
|
+
function getFetch() {
|
|
1888
|
+
return fetchModule;
|
|
1889
|
+
}
|
|
1890
|
+
function calculateMaxLength(provider, prefix) {
|
|
1891
|
+
const config = getAPIConfig(provider);
|
|
1892
|
+
if (!config) {
|
|
1893
|
+
return 0;
|
|
1894
|
+
}
|
|
1895
|
+
let result;
|
|
1896
|
+
if (!config.maxURL) {
|
|
1897
|
+
result = 0;
|
|
1898
|
+
} else {
|
|
1899
|
+
let maxHostLength = 0;
|
|
1900
|
+
config.resources.forEach((item) => {
|
|
1901
|
+
const host = item;
|
|
1902
|
+
maxHostLength = Math.max(maxHostLength, host.length);
|
|
1903
|
+
});
|
|
1904
|
+
const url = prefix + ".json?icons=";
|
|
1905
|
+
result = config.maxURL - maxHostLength - config.path.length - url.length;
|
|
1906
|
+
}
|
|
1907
|
+
return result;
|
|
1908
|
+
}
|
|
1909
|
+
function shouldAbort(status) {
|
|
1910
|
+
return status === 404;
|
|
1911
|
+
}
|
|
1912
|
+
var prepare = (provider, prefix, icons) => {
|
|
1913
|
+
const results = [];
|
|
1914
|
+
const maxLength = calculateMaxLength(provider, prefix);
|
|
1915
|
+
const type = "icons";
|
|
1916
|
+
let item = {
|
|
1917
|
+
type,
|
|
1918
|
+
provider,
|
|
1919
|
+
prefix,
|
|
1920
|
+
icons: []
|
|
1921
|
+
};
|
|
1922
|
+
let length = 0;
|
|
1923
|
+
icons.forEach((name, index) => {
|
|
1924
|
+
length += name.length + 1;
|
|
1925
|
+
if (length >= maxLength && index > 0) {
|
|
1926
|
+
results.push(item);
|
|
1927
|
+
item = {
|
|
1928
|
+
type,
|
|
1929
|
+
provider,
|
|
1930
|
+
prefix,
|
|
1931
|
+
icons: []
|
|
1932
|
+
};
|
|
1933
|
+
length = name.length;
|
|
1934
|
+
}
|
|
1935
|
+
item.icons.push(name);
|
|
1936
|
+
});
|
|
1937
|
+
results.push(item);
|
|
1938
|
+
return results;
|
|
1939
|
+
};
|
|
1940
|
+
function getPath(provider) {
|
|
1941
|
+
if (typeof provider === "string") {
|
|
1942
|
+
const config = getAPIConfig(provider);
|
|
1943
|
+
if (config) {
|
|
1944
|
+
return config.path;
|
|
1945
|
+
}
|
|
1946
|
+
}
|
|
1947
|
+
return "/";
|
|
1948
|
+
}
|
|
1949
|
+
var send = (host, params, callback) => {
|
|
1950
|
+
if (!fetchModule) {
|
|
1951
|
+
callback("abort", 424);
|
|
1952
|
+
return;
|
|
1953
|
+
}
|
|
1954
|
+
let path = getPath(params.provider);
|
|
1955
|
+
switch (params.type) {
|
|
1956
|
+
case "icons": {
|
|
1957
|
+
const prefix = params.prefix;
|
|
1958
|
+
const icons = params.icons;
|
|
1959
|
+
const iconsList = icons.join(",");
|
|
1960
|
+
const urlParams = new URLSearchParams({
|
|
1961
|
+
icons: iconsList
|
|
1962
|
+
});
|
|
1963
|
+
path += prefix + ".json?" + urlParams.toString();
|
|
1964
|
+
break;
|
|
1965
|
+
}
|
|
1966
|
+
case "custom": {
|
|
1967
|
+
const uri = params.uri;
|
|
1968
|
+
path += uri.slice(0, 1) === "/" ? uri.slice(1) : uri;
|
|
1969
|
+
break;
|
|
1970
|
+
}
|
|
1971
|
+
default:
|
|
1972
|
+
callback("abort", 400);
|
|
1973
|
+
return;
|
|
1974
|
+
}
|
|
1975
|
+
let defaultError = 503;
|
|
1976
|
+
fetchModule(host + path).then((response) => {
|
|
1977
|
+
const status = response.status;
|
|
1978
|
+
if (status !== 200) {
|
|
1979
|
+
setTimeout(() => {
|
|
1980
|
+
callback(shouldAbort(status) ? "abort" : "next", status);
|
|
1981
|
+
});
|
|
1982
|
+
return;
|
|
1983
|
+
}
|
|
1984
|
+
defaultError = 501;
|
|
1985
|
+
return response.json();
|
|
1986
|
+
}).then((data) => {
|
|
1987
|
+
if (typeof data !== "object" || data === null) {
|
|
1988
|
+
setTimeout(() => {
|
|
1989
|
+
if (data === 404) {
|
|
1990
|
+
callback("abort", data);
|
|
1991
|
+
} else {
|
|
1992
|
+
callback("next", defaultError);
|
|
1993
|
+
}
|
|
1994
|
+
});
|
|
1995
|
+
return;
|
|
1996
|
+
}
|
|
1997
|
+
setTimeout(() => {
|
|
1998
|
+
callback("success", data);
|
|
1999
|
+
});
|
|
2000
|
+
}).catch(() => {
|
|
2001
|
+
callback("next", defaultError);
|
|
2002
|
+
});
|
|
2003
|
+
};
|
|
2004
|
+
var fetchAPIModule = {
|
|
2005
|
+
prepare,
|
|
2006
|
+
send
|
|
2007
|
+
};
|
|
2008
|
+
function toggleBrowserCache(storage2, value) {
|
|
2009
|
+
switch (storage2) {
|
|
2010
|
+
case "local":
|
|
2011
|
+
case "session":
|
|
2012
|
+
browserStorageConfig[storage2] = value;
|
|
2013
|
+
break;
|
|
2014
|
+
case "all":
|
|
2015
|
+
for (const key in browserStorageConfig) {
|
|
2016
|
+
browserStorageConfig[key] = value;
|
|
2017
|
+
}
|
|
2018
|
+
break;
|
|
2019
|
+
}
|
|
2020
|
+
}
|
|
2021
|
+
var nodeAttr = "data-style";
|
|
2022
|
+
var customStyle = "";
|
|
2023
|
+
function appendCustomStyle(style) {
|
|
2024
|
+
customStyle = style;
|
|
2025
|
+
}
|
|
2026
|
+
function updateStyle(parent, inline) {
|
|
2027
|
+
let styleNode = Array.from(parent.childNodes).find((node) => node.hasAttribute && node.hasAttribute(nodeAttr));
|
|
2028
|
+
if (!styleNode) {
|
|
2029
|
+
styleNode = document.createElement("style");
|
|
2030
|
+
styleNode.setAttribute(nodeAttr, nodeAttr);
|
|
2031
|
+
parent.appendChild(styleNode);
|
|
2032
|
+
}
|
|
2033
|
+
styleNode.textContent = ":host{display:inline-block;vertical-align:" + (inline ? "-0.125em" : "0") + "}span,svg{display:block}" + customStyle;
|
|
2034
|
+
}
|
|
2035
|
+
function exportFunctions() {
|
|
2036
|
+
setAPIModule("", fetchAPIModule);
|
|
2037
|
+
allowSimpleNames(true);
|
|
2038
|
+
let _window2;
|
|
2039
|
+
try {
|
|
2040
|
+
_window2 = window;
|
|
2041
|
+
} catch (err) {
|
|
2042
|
+
}
|
|
2043
|
+
if (_window2) {
|
|
2044
|
+
initBrowserStorage();
|
|
2045
|
+
if (_window2.IconifyPreload !== void 0) {
|
|
2046
|
+
const preload = _window2.IconifyPreload;
|
|
2047
|
+
const err = "Invalid IconifyPreload syntax.";
|
|
2048
|
+
if (typeof preload === "object" && preload !== null) {
|
|
2049
|
+
(preload instanceof Array ? preload : [preload]).forEach((item) => {
|
|
2050
|
+
try {
|
|
2051
|
+
if (
|
|
2052
|
+
// Check if item is an object and not null/array
|
|
2053
|
+
typeof item !== "object" || item === null || item instanceof Array || // Check for 'icons' and 'prefix'
|
|
2054
|
+
typeof item.icons !== "object" || typeof item.prefix !== "string" || // Add icon set
|
|
2055
|
+
!addCollection$1(item)
|
|
2056
|
+
) {
|
|
2057
|
+
console.error(err);
|
|
2058
|
+
}
|
|
2059
|
+
} catch (e) {
|
|
2060
|
+
console.error(err);
|
|
2061
|
+
}
|
|
2062
|
+
});
|
|
2063
|
+
}
|
|
2064
|
+
}
|
|
2065
|
+
if (_window2.IconifyProviders !== void 0) {
|
|
2066
|
+
const providers = _window2.IconifyProviders;
|
|
2067
|
+
if (typeof providers === "object" && providers !== null) {
|
|
2068
|
+
for (const key in providers) {
|
|
2069
|
+
const err = "IconifyProviders[" + key + "] is invalid.";
|
|
2070
|
+
try {
|
|
2071
|
+
const value = providers[key];
|
|
2072
|
+
if (typeof value !== "object" || !value || value.resources === void 0) {
|
|
2073
|
+
continue;
|
|
2074
|
+
}
|
|
2075
|
+
if (!addAPIProvider$1(key, value)) {
|
|
2076
|
+
console.error(err);
|
|
2077
|
+
}
|
|
2078
|
+
} catch (e) {
|
|
2079
|
+
console.error(err);
|
|
2080
|
+
}
|
|
2081
|
+
}
|
|
2082
|
+
}
|
|
2083
|
+
}
|
|
2084
|
+
}
|
|
2085
|
+
const _api2 = {
|
|
2086
|
+
getAPIConfig,
|
|
2087
|
+
setAPIModule,
|
|
2088
|
+
sendAPIQuery,
|
|
2089
|
+
setFetch,
|
|
2090
|
+
getFetch,
|
|
2091
|
+
listAPIProviders
|
|
2092
|
+
};
|
|
2093
|
+
return {
|
|
2094
|
+
enableCache: (storage2) => toggleBrowserCache(storage2, true),
|
|
2095
|
+
disableCache: (storage2) => toggleBrowserCache(storage2, false),
|
|
2096
|
+
iconExists: iconExists$1,
|
|
2097
|
+
getIcon: getIcon$1,
|
|
2098
|
+
listIcons: listIcons$1,
|
|
2099
|
+
addIcon: addIcon$1,
|
|
2100
|
+
addCollection: addCollection$1,
|
|
2101
|
+
calculateSize: calculateSize$1,
|
|
2102
|
+
buildIcon: iconToSVG,
|
|
2103
|
+
loadIcons: loadIcons$1,
|
|
2104
|
+
loadIcon: loadIcon$1,
|
|
2105
|
+
addAPIProvider: addAPIProvider$1,
|
|
2106
|
+
appendCustomStyle,
|
|
2107
|
+
_api: _api2
|
|
2108
|
+
};
|
|
2109
|
+
}
|
|
2110
|
+
function iconToHTML(body, attributes) {
|
|
2111
|
+
let renderAttribsHTML = body.indexOf("xlink:") === -1 ? "" : ' xmlns:xlink="http://www.w3.org/1999/xlink"';
|
|
2112
|
+
for (const attr in attributes) {
|
|
2113
|
+
renderAttribsHTML += " " + attr + '="' + attributes[attr] + '"';
|
|
2114
|
+
}
|
|
2115
|
+
return '<svg xmlns="http://www.w3.org/2000/svg"' + renderAttribsHTML + ">" + body + "</svg>";
|
|
2116
|
+
}
|
|
2117
|
+
function encodeSVGforURL(svg) {
|
|
2118
|
+
return svg.replace(/"/g, "'").replace(/%/g, "%25").replace(/#/g, "%23").replace(/</g, "%3C").replace(/>/g, "%3E").replace(/\s+/g, " ");
|
|
2119
|
+
}
|
|
2120
|
+
function svgToURL(svg) {
|
|
2121
|
+
return 'url("data:image/svg+xml,' + encodeSVGforURL(svg) + '")';
|
|
2122
|
+
}
|
|
2123
|
+
var monotoneProps = {
|
|
2124
|
+
"background-color": "currentColor"
|
|
2125
|
+
};
|
|
2126
|
+
var coloredProps = {
|
|
2127
|
+
"background-color": "transparent"
|
|
2128
|
+
};
|
|
2129
|
+
var propsToAdd = {
|
|
2130
|
+
image: "var(--svg)",
|
|
2131
|
+
repeat: "no-repeat",
|
|
2132
|
+
size: "100% 100%"
|
|
2133
|
+
};
|
|
2134
|
+
var propsToAddTo = {
|
|
2135
|
+
"-webkit-mask": monotoneProps,
|
|
2136
|
+
"mask": monotoneProps,
|
|
2137
|
+
"background": coloredProps
|
|
2138
|
+
};
|
|
2139
|
+
for (const prefix in propsToAddTo) {
|
|
2140
|
+
const list = propsToAddTo[prefix];
|
|
2141
|
+
for (const prop in propsToAdd) {
|
|
2142
|
+
list[prefix + "-" + prop] = propsToAdd[prop];
|
|
2143
|
+
}
|
|
2144
|
+
}
|
|
2145
|
+
function fixSize(value) {
|
|
2146
|
+
return value + (value.match(/^[-0-9.]+$/) ? "px" : "");
|
|
2147
|
+
}
|
|
2148
|
+
function renderSPAN(data, icon, useMask) {
|
|
2149
|
+
const node = document.createElement("span");
|
|
2150
|
+
let body = data.body;
|
|
2151
|
+
if (body.indexOf("<a") !== -1) {
|
|
2152
|
+
body += "<!-- " + Date.now() + " -->";
|
|
2153
|
+
}
|
|
2154
|
+
const renderAttribs = data.attributes;
|
|
2155
|
+
const html = iconToHTML(body, {
|
|
2156
|
+
...renderAttribs,
|
|
2157
|
+
width: icon.width + "",
|
|
2158
|
+
height: icon.height + ""
|
|
2159
|
+
});
|
|
2160
|
+
const url = svgToURL(html);
|
|
2161
|
+
const svgStyle = node.style;
|
|
2162
|
+
const styles = {
|
|
2163
|
+
"--svg": url,
|
|
2164
|
+
"width": fixSize(renderAttribs.width),
|
|
2165
|
+
"height": fixSize(renderAttribs.height),
|
|
2166
|
+
...useMask ? monotoneProps : coloredProps
|
|
2167
|
+
};
|
|
2168
|
+
for (const prop in styles) {
|
|
2169
|
+
svgStyle.setProperty(prop, styles[prop]);
|
|
2170
|
+
}
|
|
2171
|
+
return node;
|
|
2172
|
+
}
|
|
2173
|
+
function renderSVG(data) {
|
|
2174
|
+
const node = document.createElement("span");
|
|
2175
|
+
node.innerHTML = iconToHTML(data.body, data.attributes);
|
|
2176
|
+
return node.firstChild;
|
|
2177
|
+
}
|
|
2178
|
+
function renderIcon(parent, state) {
|
|
2179
|
+
const iconData = state.icon.data;
|
|
2180
|
+
const customisations = state.customisations;
|
|
2181
|
+
const renderData = iconToSVG(iconData, customisations);
|
|
2182
|
+
if (customisations.preserveAspectRatio) {
|
|
2183
|
+
renderData.attributes["preserveAspectRatio"] = customisations.preserveAspectRatio;
|
|
2184
|
+
}
|
|
2185
|
+
const mode = state.renderedMode;
|
|
2186
|
+
let node;
|
|
2187
|
+
switch (mode) {
|
|
2188
|
+
case "svg":
|
|
2189
|
+
node = renderSVG(renderData);
|
|
2190
|
+
break;
|
|
2191
|
+
default:
|
|
2192
|
+
node = renderSPAN(renderData, {
|
|
2193
|
+
...defaultIconProps,
|
|
2194
|
+
...iconData
|
|
2195
|
+
}, mode === "mask");
|
|
2196
|
+
}
|
|
2197
|
+
const oldNode = Array.from(parent.childNodes).find((node2) => {
|
|
2198
|
+
const tag = node2.tagName && node2.tagName.toUpperCase();
|
|
2199
|
+
return tag === "SPAN" || tag === "SVG";
|
|
2200
|
+
});
|
|
2201
|
+
if (oldNode) {
|
|
2202
|
+
if (node.tagName === "SPAN" && oldNode.tagName === node.tagName) {
|
|
2203
|
+
oldNode.setAttribute("style", node.getAttribute("style"));
|
|
2204
|
+
} else {
|
|
2205
|
+
parent.replaceChild(node, oldNode);
|
|
2206
|
+
}
|
|
2207
|
+
} else {
|
|
2208
|
+
parent.appendChild(node);
|
|
2209
|
+
}
|
|
2210
|
+
}
|
|
2211
|
+
function setPendingState(icon, inline, lastState) {
|
|
2212
|
+
const lastRender = lastState && (lastState.rendered ? lastState : lastState.lastRender);
|
|
2213
|
+
return {
|
|
2214
|
+
rendered: false,
|
|
2215
|
+
inline,
|
|
2216
|
+
icon,
|
|
2217
|
+
lastRender
|
|
2218
|
+
};
|
|
2219
|
+
}
|
|
2220
|
+
function defineIconifyIcon(name = "iconify-icon") {
|
|
2221
|
+
let customElements;
|
|
2222
|
+
let ParentClass;
|
|
2223
|
+
try {
|
|
2224
|
+
customElements = window.customElements;
|
|
2225
|
+
ParentClass = window.HTMLElement;
|
|
2226
|
+
} catch (err) {
|
|
2227
|
+
return;
|
|
2228
|
+
}
|
|
2229
|
+
if (!customElements || !ParentClass) {
|
|
2230
|
+
return;
|
|
2231
|
+
}
|
|
2232
|
+
const ConflictingClass = customElements.get(name);
|
|
2233
|
+
if (ConflictingClass) {
|
|
2234
|
+
return ConflictingClass;
|
|
2235
|
+
}
|
|
2236
|
+
const attributes = [
|
|
2237
|
+
// Icon
|
|
2238
|
+
"icon",
|
|
2239
|
+
// Mode
|
|
2240
|
+
"mode",
|
|
2241
|
+
"inline",
|
|
2242
|
+
// Customisations
|
|
2243
|
+
"width",
|
|
2244
|
+
"height",
|
|
2245
|
+
"rotate",
|
|
2246
|
+
"flip"
|
|
2247
|
+
];
|
|
2248
|
+
const IconifyIcon = class extends ParentClass {
|
|
2249
|
+
/**
|
|
2250
|
+
* Constructor
|
|
2251
|
+
*/
|
|
2252
|
+
constructor() {
|
|
2253
|
+
super();
|
|
2254
|
+
// Root
|
|
2255
|
+
__publicField(this, "_shadowRoot");
|
|
2256
|
+
// State
|
|
2257
|
+
__publicField(this, "_state");
|
|
2258
|
+
// Attributes check queued
|
|
2259
|
+
__publicField(this, "_checkQueued", false);
|
|
2260
|
+
const root = this._shadowRoot = this.attachShadow({
|
|
2261
|
+
mode: "open"
|
|
2262
|
+
});
|
|
2263
|
+
const inline = getInline(this);
|
|
2264
|
+
updateStyle(root, inline);
|
|
2265
|
+
this._state = setPendingState({
|
|
2266
|
+
value: ""
|
|
2267
|
+
}, inline);
|
|
2268
|
+
this._queueCheck();
|
|
2269
|
+
}
|
|
2270
|
+
/**
|
|
2271
|
+
* Observed attributes
|
|
2272
|
+
*/
|
|
2273
|
+
static get observedAttributes() {
|
|
2274
|
+
return attributes.slice(0);
|
|
2275
|
+
}
|
|
2276
|
+
/**
|
|
2277
|
+
* Observed properties that are different from attributes
|
|
2278
|
+
*
|
|
2279
|
+
* Experimental! Need to test with various frameworks that support it
|
|
2280
|
+
*/
|
|
2281
|
+
/*
|
|
2282
|
+
static get properties() {
|
|
2283
|
+
return {
|
|
2284
|
+
inline: {
|
|
2285
|
+
type: Boolean,
|
|
2286
|
+
reflect: true,
|
|
2287
|
+
},
|
|
2288
|
+
// Not listing other attributes because they are strings or combination
|
|
2289
|
+
// of string and another type. Cannot have multiple types
|
|
2290
|
+
};
|
|
2291
|
+
}
|
|
2292
|
+
*/
|
|
2293
|
+
/**
|
|
2294
|
+
* Attribute has changed
|
|
2295
|
+
*/
|
|
2296
|
+
attributeChangedCallback(name2) {
|
|
2297
|
+
if (name2 === "inline") {
|
|
2298
|
+
const newInline = getInline(this);
|
|
2299
|
+
const state = this._state;
|
|
2300
|
+
if (newInline !== state.inline) {
|
|
2301
|
+
state.inline = newInline;
|
|
2302
|
+
updateStyle(this._shadowRoot, newInline);
|
|
2303
|
+
}
|
|
2304
|
+
} else {
|
|
2305
|
+
this._queueCheck();
|
|
2306
|
+
}
|
|
2307
|
+
}
|
|
2308
|
+
/**
|
|
2309
|
+
* Get/set icon
|
|
2310
|
+
*/
|
|
2311
|
+
get icon() {
|
|
2312
|
+
const value = this.getAttribute("icon");
|
|
2313
|
+
if (value && value.slice(0, 1) === "{") {
|
|
2314
|
+
try {
|
|
2315
|
+
return JSON.parse(value);
|
|
2316
|
+
} catch (err) {
|
|
2317
|
+
}
|
|
2318
|
+
}
|
|
2319
|
+
return value;
|
|
2320
|
+
}
|
|
2321
|
+
set icon(value) {
|
|
2322
|
+
if (typeof value === "object") {
|
|
2323
|
+
value = JSON.stringify(value);
|
|
2324
|
+
}
|
|
2325
|
+
this.setAttribute("icon", value);
|
|
2326
|
+
}
|
|
2327
|
+
/**
|
|
2328
|
+
* Get/set inline
|
|
2329
|
+
*/
|
|
2330
|
+
get inline() {
|
|
2331
|
+
return getInline(this);
|
|
2332
|
+
}
|
|
2333
|
+
set inline(value) {
|
|
2334
|
+
if (value) {
|
|
2335
|
+
this.setAttribute("inline", "true");
|
|
2336
|
+
} else {
|
|
2337
|
+
this.removeAttribute("inline");
|
|
2338
|
+
}
|
|
2339
|
+
}
|
|
2340
|
+
/**
|
|
2341
|
+
* Restart animation
|
|
2342
|
+
*/
|
|
2343
|
+
restartAnimation() {
|
|
2344
|
+
const state = this._state;
|
|
2345
|
+
if (state.rendered) {
|
|
2346
|
+
const root = this._shadowRoot;
|
|
2347
|
+
if (state.renderedMode === "svg") {
|
|
2348
|
+
try {
|
|
2349
|
+
root.lastChild.setCurrentTime(0);
|
|
2350
|
+
return;
|
|
2351
|
+
} catch (err) {
|
|
2352
|
+
}
|
|
2353
|
+
}
|
|
2354
|
+
renderIcon(root, state);
|
|
2355
|
+
}
|
|
2356
|
+
}
|
|
2357
|
+
/**
|
|
2358
|
+
* Get status
|
|
2359
|
+
*/
|
|
2360
|
+
get status() {
|
|
2361
|
+
const state = this._state;
|
|
2362
|
+
return state.rendered ? "rendered" : state.icon.data === null ? "failed" : "loading";
|
|
2363
|
+
}
|
|
2364
|
+
/**
|
|
2365
|
+
* Queue attributes re-check
|
|
2366
|
+
*/
|
|
2367
|
+
_queueCheck() {
|
|
2368
|
+
if (!this._checkQueued) {
|
|
2369
|
+
this._checkQueued = true;
|
|
2370
|
+
setTimeout(() => {
|
|
2371
|
+
this._check();
|
|
2372
|
+
});
|
|
2373
|
+
}
|
|
2374
|
+
}
|
|
2375
|
+
/**
|
|
2376
|
+
* Check for changes
|
|
2377
|
+
*/
|
|
2378
|
+
_check() {
|
|
2379
|
+
if (!this._checkQueued) {
|
|
2380
|
+
return;
|
|
2381
|
+
}
|
|
2382
|
+
this._checkQueued = false;
|
|
2383
|
+
const state = this._state;
|
|
2384
|
+
const newIcon = this.getAttribute("icon");
|
|
2385
|
+
if (newIcon !== state.icon.value) {
|
|
2386
|
+
this._iconChanged(newIcon);
|
|
2387
|
+
return;
|
|
2388
|
+
}
|
|
2389
|
+
if (!state.rendered) {
|
|
2390
|
+
return;
|
|
2391
|
+
}
|
|
2392
|
+
const mode = this.getAttribute("mode");
|
|
2393
|
+
const customisations = getCustomisations(this);
|
|
2394
|
+
if (state.attrMode !== mode || haveCustomisationsChanged(state.customisations, customisations)) {
|
|
2395
|
+
this._renderIcon(state.icon, customisations, mode);
|
|
2396
|
+
}
|
|
2397
|
+
}
|
|
2398
|
+
/**
|
|
2399
|
+
* Icon value has changed
|
|
2400
|
+
*/
|
|
2401
|
+
_iconChanged(newValue) {
|
|
2402
|
+
const icon = parseIconValue(newValue, (value, name2, data) => {
|
|
2403
|
+
const state = this._state;
|
|
2404
|
+
if (state.rendered || this.getAttribute("icon") !== value) {
|
|
2405
|
+
return;
|
|
2406
|
+
}
|
|
2407
|
+
const icon2 = {
|
|
2408
|
+
value,
|
|
2409
|
+
name: name2,
|
|
2410
|
+
data
|
|
2411
|
+
};
|
|
2412
|
+
if (icon2.data) {
|
|
2413
|
+
this._gotIconData(icon2);
|
|
2414
|
+
} else {
|
|
2415
|
+
state.icon = icon2;
|
|
2416
|
+
}
|
|
2417
|
+
});
|
|
2418
|
+
if (icon.data) {
|
|
2419
|
+
this._gotIconData(icon);
|
|
2420
|
+
} else {
|
|
2421
|
+
this._state = setPendingState(icon, this._state.inline, this._state);
|
|
2422
|
+
}
|
|
2423
|
+
}
|
|
2424
|
+
/**
|
|
2425
|
+
* Got new icon data, icon is ready to (re)render
|
|
2426
|
+
*/
|
|
2427
|
+
_gotIconData(icon) {
|
|
2428
|
+
this._checkQueued = false;
|
|
2429
|
+
this._renderIcon(icon, getCustomisations(this), this.getAttribute("mode"));
|
|
2430
|
+
}
|
|
2431
|
+
/**
|
|
2432
|
+
* Re-render based on icon data
|
|
2433
|
+
*/
|
|
2434
|
+
_renderIcon(icon, customisations, attrMode) {
|
|
2435
|
+
const renderedMode = getRenderMode(icon.data.body, attrMode);
|
|
2436
|
+
const inline = this._state.inline;
|
|
2437
|
+
renderIcon(this._shadowRoot, this._state = {
|
|
2438
|
+
rendered: true,
|
|
2439
|
+
icon,
|
|
2440
|
+
inline,
|
|
2441
|
+
customisations,
|
|
2442
|
+
attrMode,
|
|
2443
|
+
renderedMode
|
|
2444
|
+
});
|
|
2445
|
+
}
|
|
2446
|
+
};
|
|
2447
|
+
attributes.forEach((attr) => {
|
|
2448
|
+
if (!(attr in IconifyIcon.prototype)) {
|
|
2449
|
+
Object.defineProperty(IconifyIcon.prototype, attr, {
|
|
2450
|
+
get: function() {
|
|
2451
|
+
return this.getAttribute(attr);
|
|
2452
|
+
},
|
|
2453
|
+
set: function(value) {
|
|
2454
|
+
if (value !== null) {
|
|
2455
|
+
this.setAttribute(attr, value);
|
|
2456
|
+
} else {
|
|
2457
|
+
this.removeAttribute(attr);
|
|
2458
|
+
}
|
|
2459
|
+
}
|
|
2460
|
+
});
|
|
2461
|
+
}
|
|
2462
|
+
});
|
|
2463
|
+
const functions = exportFunctions();
|
|
2464
|
+
for (const key in functions) {
|
|
2465
|
+
IconifyIcon[key] = IconifyIcon.prototype[key] = functions[key];
|
|
2466
|
+
}
|
|
2467
|
+
customElements.define(name, IconifyIcon);
|
|
2468
|
+
return IconifyIcon;
|
|
2469
|
+
}
|
|
2470
|
+
var IconifyIconComponent = defineIconifyIcon() || exportFunctions();
|
|
2471
|
+
var { enableCache, disableCache, iconExists, getIcon, listIcons, addIcon, addCollection, calculateSize, buildIcon, loadIcons, loadIcon, addAPIProvider, _api } = IconifyIconComponent;
|
|
2472
|
+
|
|
2473
|
+
// ../../node_modules/@iconify-icon/react/dist/iconify.mjs
|
|
2474
|
+
var Icon = React2.forwardRef(
|
|
2475
|
+
(props, ref) => {
|
|
2476
|
+
const newProps = {
|
|
220
2477
|
...props,
|
|
221
|
-
|
|
2478
|
+
ref
|
|
2479
|
+
};
|
|
2480
|
+
if (typeof props.icon === "object") {
|
|
2481
|
+
newProps.icon = JSON.stringify(props.icon);
|
|
2482
|
+
}
|
|
2483
|
+
if (!props.inline) {
|
|
2484
|
+
delete newProps.inline;
|
|
222
2485
|
}
|
|
223
|
-
|
|
2486
|
+
if (props.className) {
|
|
2487
|
+
newProps["class"] = props.className;
|
|
2488
|
+
}
|
|
2489
|
+
return React2.createElement("iconify-icon", newProps);
|
|
2490
|
+
}
|
|
2491
|
+
);
|
|
2492
|
+
|
|
2493
|
+
// src/components/Icon.tsx
|
|
2494
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
2495
|
+
var Icon2 = (props) => {
|
|
2496
|
+
return /* @__PURE__ */ jsx2(Icon, { ...props });
|
|
2497
|
+
};
|
|
2498
|
+
|
|
2499
|
+
// src/components/Button.tsx
|
|
2500
|
+
import { Fragment as Fragment2, jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
2501
|
+
var RenderIcon = ({ icon }) => {
|
|
2502
|
+
if (!icon) {
|
|
2503
|
+
return null;
|
|
2504
|
+
}
|
|
2505
|
+
if (typeof icon === "string") {
|
|
2506
|
+
return /* @__PURE__ */ jsx3(Fragment2, { children: /* @__PURE__ */ jsx3(Icon2, { icon }) });
|
|
2507
|
+
}
|
|
2508
|
+
return /* @__PURE__ */ jsx3(Fragment2, { children: icon });
|
|
224
2509
|
};
|
|
2510
|
+
var MemoizedRenderIcon = React3.memo(RenderIcon);
|
|
2511
|
+
var Button = React3.forwardRef(
|
|
2512
|
+
(props, ref) => {
|
|
2513
|
+
const { children, leftIcon, rightIcon, ...restProps } = props;
|
|
2514
|
+
return /* @__PURE__ */ jsxs2(
|
|
2515
|
+
ButtonUi,
|
|
2516
|
+
{
|
|
2517
|
+
ref,
|
|
2518
|
+
...restProps,
|
|
2519
|
+
sx: {
|
|
2520
|
+
cursor: "pointer",
|
|
2521
|
+
paddingX: "lg",
|
|
2522
|
+
paddingY: "md",
|
|
2523
|
+
display: "inline-flex",
|
|
2524
|
+
alignItems: "center",
|
|
2525
|
+
gap: "lg",
|
|
2526
|
+
...restProps.sx
|
|
2527
|
+
},
|
|
2528
|
+
children: [
|
|
2529
|
+
/* @__PURE__ */ jsx3(MemoizedRenderIcon, { icon: leftIcon }),
|
|
2530
|
+
children,
|
|
2531
|
+
/* @__PURE__ */ jsx3(MemoizedRenderIcon, { icon: rightIcon })
|
|
2532
|
+
]
|
|
2533
|
+
}
|
|
2534
|
+
);
|
|
2535
|
+
}
|
|
2536
|
+
);
|
|
2537
|
+
Button.displayName = "Button";
|
|
225
2538
|
|
|
226
2539
|
// src/components/Card.tsx
|
|
2540
|
+
init_tsup_inject();
|
|
227
2541
|
import { Card } from "theme-ui";
|
|
228
2542
|
|
|
229
2543
|
// src/components/Divider.tsx
|
|
2544
|
+
init_tsup_inject();
|
|
230
2545
|
import { Divider } from "theme-ui";
|
|
231
2546
|
|
|
232
2547
|
// src/components/Flex.tsx
|
|
2548
|
+
init_tsup_inject();
|
|
233
2549
|
import { Flex } from "theme-ui";
|
|
234
2550
|
|
|
235
2551
|
// src/components/Grid.tsx
|
|
2552
|
+
init_tsup_inject();
|
|
236
2553
|
import { Grid } from "theme-ui";
|
|
237
2554
|
|
|
238
2555
|
// src/components/Heading.tsx
|
|
2556
|
+
init_tsup_inject();
|
|
239
2557
|
import { Heading } from "theme-ui";
|
|
240
2558
|
|
|
241
2559
|
// src/components/Image.tsx
|
|
2560
|
+
init_tsup_inject();
|
|
242
2561
|
import { Image } from "theme-ui";
|
|
243
2562
|
|
|
244
2563
|
// src/components/Input.tsx
|
|
2564
|
+
init_tsup_inject();
|
|
245
2565
|
import { Input } from "theme-ui";
|
|
246
2566
|
|
|
247
2567
|
// src/components/Label.tsx
|
|
2568
|
+
init_tsup_inject();
|
|
248
2569
|
import { Label } from "theme-ui";
|
|
249
2570
|
|
|
250
2571
|
// src/components/Link.tsx
|
|
2572
|
+
init_tsup_inject();
|
|
251
2573
|
import { Link } from "theme-ui";
|
|
252
2574
|
|
|
253
2575
|
// src/components/LinearProgress.tsx
|
|
2576
|
+
init_tsup_inject();
|
|
254
2577
|
import {
|
|
255
2578
|
Progress
|
|
256
2579
|
} from "theme-ui";
|
|
257
2580
|
|
|
258
2581
|
// src/components/Text.tsx
|
|
2582
|
+
init_tsup_inject();
|
|
259
2583
|
import { Text } from "theme-ui";
|
|
260
2584
|
|
|
261
2585
|
// src/components/Select.tsx
|
|
2586
|
+
init_tsup_inject();
|
|
262
2587
|
import { Select } from "theme-ui";
|
|
263
2588
|
|
|
264
2589
|
// src/components/Spinner.tsx
|
|
2590
|
+
init_tsup_inject();
|
|
265
2591
|
import { Spinner } from "theme-ui";
|
|
266
2592
|
|
|
267
2593
|
// src/components/Radio.tsx
|
|
2594
|
+
init_tsup_inject();
|
|
268
2595
|
import { Radio } from "theme-ui";
|
|
269
2596
|
|
|
270
|
-
// src/components/Icon.tsx
|
|
271
|
-
import { Icon as IconUI } from "@iconify/react";
|
|
272
|
-
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
273
|
-
var Icon = ({ icon, sx, iconProps, ...props }) => {
|
|
274
|
-
return /* @__PURE__ */ jsx3(Text, { sx, ...props, children: /* @__PURE__ */ jsx3(IconUI, { ...iconProps, icon }) });
|
|
275
|
-
};
|
|
276
|
-
|
|
277
2597
|
// src/components/Slider.tsx
|
|
2598
|
+
init_tsup_inject();
|
|
278
2599
|
import { Slider } from "theme-ui";
|
|
279
2600
|
|
|
280
2601
|
// src/components/Checkbox.tsx
|
|
2602
|
+
init_tsup_inject();
|
|
281
2603
|
import { Checkbox } from "theme-ui";
|
|
282
2604
|
|
|
283
2605
|
// src/components/InfiniteLinearProgress.tsx
|
|
284
|
-
|
|
2606
|
+
init_tsup_inject();
|
|
2607
|
+
import * as React4 from "react";
|
|
285
2608
|
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
286
2609
|
var MAX_PROGRESS = 100;
|
|
287
2610
|
var InfiniteLinearProgress = () => {
|
|
288
|
-
const [progress, setProgress] =
|
|
289
|
-
|
|
2611
|
+
const [progress, setProgress] = React4.useState(0);
|
|
2612
|
+
React4.useEffect(() => {
|
|
290
2613
|
const timer = setInterval(() => {
|
|
291
2614
|
setProgress((oldProgress) => {
|
|
292
2615
|
if (oldProgress === MAX_PROGRESS) {
|
|
@@ -311,11 +2634,14 @@ var InfiniteLinearProgress = () => {
|
|
|
311
2634
|
};
|
|
312
2635
|
|
|
313
2636
|
// src/components/Textarea.tsx
|
|
2637
|
+
init_tsup_inject();
|
|
314
2638
|
import { Textarea } from "theme-ui";
|
|
315
2639
|
|
|
316
2640
|
// src/components/Container.tsx
|
|
2641
|
+
init_tsup_inject();
|
|
317
2642
|
import { Container } from "theme-ui";
|
|
318
2643
|
export {
|
|
2644
|
+
BaseStyles,
|
|
319
2645
|
Box,
|
|
320
2646
|
Button,
|
|
321
2647
|
Card,
|
|
@@ -325,7 +2651,7 @@ export {
|
|
|
325
2651
|
Flex,
|
|
326
2652
|
Grid,
|
|
327
2653
|
Heading,
|
|
328
|
-
Icon,
|
|
2654
|
+
Icon2 as Icon,
|
|
329
2655
|
Image,
|
|
330
2656
|
InfiniteLinearProgress,
|
|
331
2657
|
Input,
|
|
@@ -338,8 +2664,23 @@ export {
|
|
|
338
2664
|
Spinner,
|
|
339
2665
|
Text,
|
|
340
2666
|
Textarea,
|
|
341
|
-
|
|
2667
|
+
ThemeProvider,
|
|
342
2668
|
useBreakpointIndex,
|
|
343
2669
|
useResponsiveValue,
|
|
344
2670
|
useTheme
|
|
345
2671
|
};
|
|
2672
|
+
/*! Bundled license information:
|
|
2673
|
+
|
|
2674
|
+
iconify-icon/dist/iconify-icon.mjs:
|
|
2675
|
+
(**
|
|
2676
|
+
* (c) Iconify
|
|
2677
|
+
*
|
|
2678
|
+
* For the full copyright and license information, please view the license.txt
|
|
2679
|
+
* files at https://github.com/iconify/iconify
|
|
2680
|
+
*
|
|
2681
|
+
* Licensed under MIT.
|
|
2682
|
+
*
|
|
2683
|
+
* @license MIT
|
|
2684
|
+
* @version 1.0.5
|
|
2685
|
+
*)
|
|
2686
|
+
*/
|