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