@nebula.js/stardust 3.1.0-alpha.1 → 3.1.0-alpha.3
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/core/esm/dev.js +978 -654
- package/core/esm/dev.js.map +1 -1
- package/core/esm/index.js +4 -4
- package/core/esm/index.js.map +1 -1
- package/core/package.json +2 -2
- package/dist/stardust.dev.js +1906 -3364
- package/dist/stardust.dev.js.map +1 -1
- package/dist/stardust.js +14 -14
- package/dist/stardust.js.map +1 -1
- package/package.json +12 -12
- package/types/index.d.ts +28 -3
package/core/esm/dev.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* @nebula.js/stardust v3.1.0-alpha.
|
|
2
|
+
* @nebula.js/stardust v3.1.0-alpha.3
|
|
3
3
|
* Copyright (c) 2022 QlikTech International AB
|
|
4
4
|
* Released under the MIT license.
|
|
5
5
|
*/
|
|
@@ -8,7 +8,7 @@ import * as React from 'react';
|
|
|
8
8
|
import React__default, { useState as useState$1, useEffect as useEffect$1, useReducer, forwardRef, useMemo as useMemo$1, useImperativeHandle as useImperativeHandle$1, useCallback, useLayoutEffect as useLayoutEffect$1, createElement, PureComponent, useRef, useContext } from 'react';
|
|
9
9
|
import ReactDOM from 'react-dom';
|
|
10
10
|
import { CacheProvider, ThemeContext as ThemeContext$2 } from '@emotion/react';
|
|
11
|
-
import { Checkbox, Radio, Grid, Typography, FormControlLabel, IconButton, Popover, MenuList, MenuItem, ListItemIcon, Divider,
|
|
11
|
+
import { Checkbox, Radio, Grid, Typography, FormControlLabel, IconButton, Popover, MenuList, MenuItem, ListItemIcon, Divider, InputAdornment, OutlinedInput, Badge, List, ListItem, Button, Box, Icon, CircularProgress, Paper } from '@mui/material';
|
|
12
12
|
import emStyled from '@emotion/styled';
|
|
13
13
|
|
|
14
14
|
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
@@ -316,27 +316,30 @@ var runtime = {exports: {}};
|
|
|
316
316
|
// delegate iterator, or by modifying context.method and context.arg,
|
|
317
317
|
// setting context.delegate to null, and returning the ContinueSentinel.
|
|
318
318
|
function maybeInvokeDelegate(delegate, context) {
|
|
319
|
-
var
|
|
319
|
+
var methodName = context.method;
|
|
320
|
+
var method = delegate.iterator[methodName];
|
|
320
321
|
if (method === undefined$1) {
|
|
321
322
|
// A .throw or .return when the delegate iterator has no .throw
|
|
322
|
-
// method always
|
|
323
|
+
// method, or a missing .next mehtod, always terminate the
|
|
324
|
+
// yield* loop.
|
|
323
325
|
context.delegate = null;
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
}
|
|
326
|
+
|
|
327
|
+
// Note: ["return"] must be used for ES3 parsing compatibility.
|
|
328
|
+
if (methodName === "throw" && delegate.iterator["return"]) {
|
|
329
|
+
// If the delegate iterator has a return method, give it a
|
|
330
|
+
// chance to clean up.
|
|
331
|
+
context.method = "return";
|
|
332
|
+
context.arg = undefined$1;
|
|
333
|
+
maybeInvokeDelegate(delegate, context);
|
|
334
|
+
if (context.method === "throw") {
|
|
335
|
+
// If maybeInvokeDelegate(context) changed context.method from
|
|
336
|
+
// "return" to "throw", let that override the TypeError below.
|
|
337
|
+
return ContinueSentinel;
|
|
337
338
|
}
|
|
339
|
+
}
|
|
340
|
+
if (methodName !== "return") {
|
|
338
341
|
context.method = "throw";
|
|
339
|
-
context.arg = new TypeError("The iterator does not provide a '
|
|
342
|
+
context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method");
|
|
340
343
|
}
|
|
341
344
|
return ContinueSentinel;
|
|
342
345
|
}
|
|
@@ -708,6 +711,7 @@ function _objectSpread2(target) {
|
|
|
708
711
|
return target;
|
|
709
712
|
}
|
|
710
713
|
function _defineProperty(obj, key, value) {
|
|
714
|
+
key = _toPropertyKey(key);
|
|
711
715
|
if (key in obj) {
|
|
712
716
|
Object.defineProperty(obj, key, {
|
|
713
717
|
value: value,
|
|
@@ -761,6 +765,20 @@ function _objectWithoutProperties(source, excluded) {
|
|
|
761
765
|
}
|
|
762
766
|
return target;
|
|
763
767
|
}
|
|
768
|
+
function _toPrimitive(input, hint) {
|
|
769
|
+
if (typeof input !== "object" || input === null) return input;
|
|
770
|
+
var prim = input[Symbol.toPrimitive];
|
|
771
|
+
if (prim !== undefined) {
|
|
772
|
+
var res = prim.call(input, hint || "default");
|
|
773
|
+
if (typeof res !== "object") return res;
|
|
774
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
775
|
+
}
|
|
776
|
+
return (hint === "string" ? String : Number)(input);
|
|
777
|
+
}
|
|
778
|
+
function _toPropertyKey(arg) {
|
|
779
|
+
var key = _toPrimitive(arg, "string");
|
|
780
|
+
return typeof key === "symbol" ? key : String(key);
|
|
781
|
+
}
|
|
764
782
|
|
|
765
783
|
const format = function () {
|
|
766
784
|
let message = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
@@ -1869,15 +1887,15 @@ var darker = 0.7;
|
|
|
1869
1887
|
var brighter = 1 / darker;
|
|
1870
1888
|
|
|
1871
1889
|
var reI = "\\s*([+-]?\\d+)\\s*",
|
|
1872
|
-
reN = "\\s*([+-]?\\d
|
|
1873
|
-
reP = "\\s*([+-]?\\d
|
|
1890
|
+
reN = "\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",
|
|
1891
|
+
reP = "\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",
|
|
1874
1892
|
reHex = /^#([0-9a-f]{3,8})$/,
|
|
1875
|
-
reRgbInteger = new RegExp(
|
|
1876
|
-
reRgbPercent = new RegExp(
|
|
1877
|
-
reRgbaInteger = new RegExp(
|
|
1878
|
-
reRgbaPercent = new RegExp(
|
|
1879
|
-
reHslPercent = new RegExp(
|
|
1880
|
-
reHslaPercent = new RegExp(
|
|
1893
|
+
reRgbInteger = new RegExp(`^rgb\\(${reI},${reI},${reI}\\)$`),
|
|
1894
|
+
reRgbPercent = new RegExp(`^rgb\\(${reP},${reP},${reP}\\)$`),
|
|
1895
|
+
reRgbaInteger = new RegExp(`^rgba\\(${reI},${reI},${reI},${reN}\\)$`),
|
|
1896
|
+
reRgbaPercent = new RegExp(`^rgba\\(${reP},${reP},${reP},${reN}\\)$`),
|
|
1897
|
+
reHslPercent = new RegExp(`^hsl\\(${reN},${reP},${reP}\\)$`),
|
|
1898
|
+
reHslaPercent = new RegExp(`^hsla\\(${reN},${reP},${reP},${reN}\\)$`);
|
|
1881
1899
|
|
|
1882
1900
|
var named = {
|
|
1883
1901
|
aliceblue: 0xf0f8ff,
|
|
@@ -2031,14 +2049,15 @@ var named = {
|
|
|
2031
2049
|
};
|
|
2032
2050
|
|
|
2033
2051
|
define(Color, color$3, {
|
|
2034
|
-
copy
|
|
2052
|
+
copy(channels) {
|
|
2035
2053
|
return Object.assign(new this.constructor, this, channels);
|
|
2036
2054
|
},
|
|
2037
|
-
displayable
|
|
2055
|
+
displayable() {
|
|
2038
2056
|
return this.rgb().displayable();
|
|
2039
2057
|
},
|
|
2040
2058
|
hex: color_formatHex, // Deprecated! Use color.formatHex.
|
|
2041
2059
|
formatHex: color_formatHex,
|
|
2060
|
+
formatHex8: color_formatHex8,
|
|
2042
2061
|
formatHsl: color_formatHsl,
|
|
2043
2062
|
formatRgb: color_formatRgb,
|
|
2044
2063
|
toString: color_formatRgb
|
|
@@ -2048,6 +2067,10 @@ function color_formatHex() {
|
|
|
2048
2067
|
return this.rgb().formatHex();
|
|
2049
2068
|
}
|
|
2050
2069
|
|
|
2070
|
+
function color_formatHex8() {
|
|
2071
|
+
return this.rgb().formatHex8();
|
|
2072
|
+
}
|
|
2073
|
+
|
|
2051
2074
|
function color_formatHsl() {
|
|
2052
2075
|
return hslConvert(this).formatHsl();
|
|
2053
2076
|
}
|
|
@@ -2103,18 +2126,21 @@ function Rgb(r, g, b, opacity) {
|
|
|
2103
2126
|
}
|
|
2104
2127
|
|
|
2105
2128
|
define(Rgb, rgb, extend$2(Color, {
|
|
2106
|
-
brighter
|
|
2129
|
+
brighter(k) {
|
|
2107
2130
|
k = k == null ? brighter : Math.pow(brighter, k);
|
|
2108
2131
|
return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity);
|
|
2109
2132
|
},
|
|
2110
|
-
darker
|
|
2133
|
+
darker(k) {
|
|
2111
2134
|
k = k == null ? darker : Math.pow(darker, k);
|
|
2112
2135
|
return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity);
|
|
2113
2136
|
},
|
|
2114
|
-
rgb
|
|
2137
|
+
rgb() {
|
|
2115
2138
|
return this;
|
|
2116
2139
|
},
|
|
2117
|
-
|
|
2140
|
+
clamp() {
|
|
2141
|
+
return new Rgb(clampi(this.r), clampi(this.g), clampi(this.b), clampa(this.opacity));
|
|
2142
|
+
},
|
|
2143
|
+
displayable() {
|
|
2118
2144
|
return (-0.5 <= this.r && this.r < 255.5)
|
|
2119
2145
|
&& (-0.5 <= this.g && this.g < 255.5)
|
|
2120
2146
|
&& (-0.5 <= this.b && this.b < 255.5)
|
|
@@ -2122,25 +2148,34 @@ define(Rgb, rgb, extend$2(Color, {
|
|
|
2122
2148
|
},
|
|
2123
2149
|
hex: rgb_formatHex, // Deprecated! Use color.formatHex.
|
|
2124
2150
|
formatHex: rgb_formatHex,
|
|
2151
|
+
formatHex8: rgb_formatHex8,
|
|
2125
2152
|
formatRgb: rgb_formatRgb,
|
|
2126
2153
|
toString: rgb_formatRgb
|
|
2127
2154
|
}));
|
|
2128
2155
|
|
|
2129
2156
|
function rgb_formatHex() {
|
|
2130
|
-
return
|
|
2157
|
+
return `#${hex(this.r)}${hex(this.g)}${hex(this.b)}`;
|
|
2158
|
+
}
|
|
2159
|
+
|
|
2160
|
+
function rgb_formatHex8() {
|
|
2161
|
+
return `#${hex(this.r)}${hex(this.g)}${hex(this.b)}${hex((isNaN(this.opacity) ? 1 : this.opacity) * 255)}`;
|
|
2131
2162
|
}
|
|
2132
2163
|
|
|
2133
2164
|
function rgb_formatRgb() {
|
|
2134
|
-
|
|
2135
|
-
return
|
|
2136
|
-
|
|
2137
|
-
|
|
2138
|
-
|
|
2139
|
-
|
|
2165
|
+
const a = clampa(this.opacity);
|
|
2166
|
+
return `${a === 1 ? "rgb(" : "rgba("}${clampi(this.r)}, ${clampi(this.g)}, ${clampi(this.b)}${a === 1 ? ")" : `, ${a})`}`;
|
|
2167
|
+
}
|
|
2168
|
+
|
|
2169
|
+
function clampa(opacity) {
|
|
2170
|
+
return isNaN(opacity) ? 1 : Math.max(0, Math.min(1, opacity));
|
|
2171
|
+
}
|
|
2172
|
+
|
|
2173
|
+
function clampi(value) {
|
|
2174
|
+
return Math.max(0, Math.min(255, Math.round(value) || 0));
|
|
2140
2175
|
}
|
|
2141
2176
|
|
|
2142
2177
|
function hex(value) {
|
|
2143
|
-
value =
|
|
2178
|
+
value = clampi(value);
|
|
2144
2179
|
return (value < 16 ? "0" : "") + value.toString(16);
|
|
2145
2180
|
}
|
|
2146
2181
|
|
|
@@ -2189,15 +2224,15 @@ function Hsl(h, s, l, opacity) {
|
|
|
2189
2224
|
}
|
|
2190
2225
|
|
|
2191
2226
|
define(Hsl, hsl, extend$2(Color, {
|
|
2192
|
-
brighter
|
|
2227
|
+
brighter(k) {
|
|
2193
2228
|
k = k == null ? brighter : Math.pow(brighter, k);
|
|
2194
2229
|
return new Hsl(this.h, this.s, this.l * k, this.opacity);
|
|
2195
2230
|
},
|
|
2196
|
-
darker
|
|
2231
|
+
darker(k) {
|
|
2197
2232
|
k = k == null ? darker : Math.pow(darker, k);
|
|
2198
2233
|
return new Hsl(this.h, this.s, this.l * k, this.opacity);
|
|
2199
2234
|
},
|
|
2200
|
-
rgb
|
|
2235
|
+
rgb() {
|
|
2201
2236
|
var h = this.h % 360 + (this.h < 0) * 360,
|
|
2202
2237
|
s = isNaN(h) || isNaN(this.s) ? 0 : this.s,
|
|
2203
2238
|
l = this.l,
|
|
@@ -2210,21 +2245,29 @@ define(Hsl, hsl, extend$2(Color, {
|
|
|
2210
2245
|
this.opacity
|
|
2211
2246
|
);
|
|
2212
2247
|
},
|
|
2213
|
-
|
|
2248
|
+
clamp() {
|
|
2249
|
+
return new Hsl(clamph(this.h), clampt(this.s), clampt(this.l), clampa(this.opacity));
|
|
2250
|
+
},
|
|
2251
|
+
displayable() {
|
|
2214
2252
|
return (0 <= this.s && this.s <= 1 || isNaN(this.s))
|
|
2215
2253
|
&& (0 <= this.l && this.l <= 1)
|
|
2216
2254
|
&& (0 <= this.opacity && this.opacity <= 1);
|
|
2217
2255
|
},
|
|
2218
|
-
formatHsl
|
|
2219
|
-
|
|
2220
|
-
return
|
|
2221
|
-
+ (this.h || 0) + ", "
|
|
2222
|
-
+ (this.s || 0) * 100 + "%, "
|
|
2223
|
-
+ (this.l || 0) * 100 + "%"
|
|
2224
|
-
+ (a === 1 ? ")" : ", " + a + ")");
|
|
2256
|
+
formatHsl() {
|
|
2257
|
+
const a = clampa(this.opacity);
|
|
2258
|
+
return `${a === 1 ? "hsl(" : "hsla("}${clamph(this.h)}, ${clampt(this.s) * 100}%, ${clampt(this.l) * 100}%${a === 1 ? ")" : `, ${a})`}`;
|
|
2225
2259
|
}
|
|
2226
2260
|
}));
|
|
2227
2261
|
|
|
2262
|
+
function clamph(value) {
|
|
2263
|
+
value = (value || 0) % 360;
|
|
2264
|
+
return value < 0 ? value + 360 : value;
|
|
2265
|
+
}
|
|
2266
|
+
|
|
2267
|
+
function clampt(value) {
|
|
2268
|
+
return Math.max(0, Math.min(1, value || 0));
|
|
2269
|
+
}
|
|
2270
|
+
|
|
2228
2271
|
/* From FvD 13.37, CSS Color Module Level 3 */
|
|
2229
2272
|
function hsl2rgb(h, m1, m2) {
|
|
2230
2273
|
return (h < 60 ? m1 + (m2 - m1) * h / 60
|
|
@@ -2699,7 +2742,9 @@ function theme$1(resolvedTheme) {
|
|
|
2699
2742
|
}
|
|
2700
2743
|
);
|
|
2701
2744
|
},
|
|
2702
|
-
uiColor(c) {
|
|
2745
|
+
uiColor(c, shift) {
|
|
2746
|
+
// eslint-disable-next-line no-param-reassign
|
|
2747
|
+
shift = !!shift;
|
|
2703
2748
|
if (c.index < 0 || typeof c.index === 'undefined') {
|
|
2704
2749
|
return c.color;
|
|
2705
2750
|
}
|
|
@@ -2709,10 +2754,10 @@ function theme$1(resolvedTheme) {
|
|
|
2709
2754
|
if (!uiPalette) {
|
|
2710
2755
|
return c.color;
|
|
2711
2756
|
}
|
|
2712
|
-
if (typeof uiPalette.colors[c.index] === 'undefined') {
|
|
2757
|
+
if (typeof uiPalette.colors[c.index - shift] === 'undefined') {
|
|
2713
2758
|
return c.color;
|
|
2714
2759
|
}
|
|
2715
|
-
return uiPalette.colors[c.index];
|
|
2760
|
+
return uiPalette.colors[c.index - shift];
|
|
2716
2761
|
}
|
|
2717
2762
|
};
|
|
2718
2763
|
}
|
|
@@ -2935,7 +2980,7 @@ function constructPaths(pathSteps, baseSteps) {
|
|
|
2935
2980
|
}
|
|
2936
2981
|
return ret;
|
|
2937
2982
|
}
|
|
2938
|
-
function getObject$
|
|
2983
|
+
function getObject$2(root, steps) {
|
|
2939
2984
|
let obj = root;
|
|
2940
2985
|
for (let i = 0; i < steps.length; i++) {
|
|
2941
2986
|
if (obj[steps[i]]) {
|
|
@@ -2949,7 +2994,7 @@ function getObject$1(root, steps) {
|
|
|
2949
2994
|
function searchPathArray(pathArray, attribute, theme) {
|
|
2950
2995
|
const attributeArray = attribute.split('.');
|
|
2951
2996
|
for (let i = 0; i < pathArray.length; i++) {
|
|
2952
|
-
const restult = getObject$
|
|
2997
|
+
const restult = getObject$2(theme, [...pathArray[i], ...attributeArray]);
|
|
2953
2998
|
if (restult !== undefined) return restult;
|
|
2954
2999
|
}
|
|
2955
3000
|
return undefined;
|
|
@@ -3118,10 +3163,12 @@ function theme() {
|
|
|
3118
3163
|
* @param {object} c
|
|
3119
3164
|
* @param {number=} c.index
|
|
3120
3165
|
* @param {string=} c.color
|
|
3166
|
+
* @param {boolean=} supportNone Shifts the palette index by one to account for the "none" color
|
|
3121
3167
|
* @returns {string} The resolved color.
|
|
3122
3168
|
*
|
|
3123
3169
|
* @example
|
|
3124
3170
|
* theme.getColorPickerColor({ index: 1 });
|
|
3171
|
+
* theme.getColorPickerColor({ index: 1 }, true);
|
|
3125
3172
|
* theme.getColorPickerColor({ color: 'red' });
|
|
3126
3173
|
*/
|
|
3127
3174
|
getColorPickerColor() {
|
|
@@ -3289,14 +3336,12 @@ function _extends$5() {
|
|
|
3289
3336
|
_extends$5 = Object.assign ? Object.assign.bind() : function (target) {
|
|
3290
3337
|
for (var i = 1; i < arguments.length; i++) {
|
|
3291
3338
|
var source = arguments[i];
|
|
3292
|
-
|
|
3293
3339
|
for (var key in source) {
|
|
3294
3340
|
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
3295
3341
|
target[key] = source[key];
|
|
3296
3342
|
}
|
|
3297
3343
|
}
|
|
3298
3344
|
}
|
|
3299
|
-
|
|
3300
3345
|
return target;
|
|
3301
3346
|
};
|
|
3302
3347
|
return _extends$5.apply(this, arguments);
|
|
@@ -3307,13 +3352,11 @@ function _objectWithoutPropertiesLoose$1(source, excluded) {
|
|
|
3307
3352
|
var target = {};
|
|
3308
3353
|
var sourceKeys = Object.keys(source);
|
|
3309
3354
|
var key, i;
|
|
3310
|
-
|
|
3311
3355
|
for (i = 0; i < sourceKeys.length; i++) {
|
|
3312
3356
|
key = sourceKeys[i];
|
|
3313
3357
|
if (excluded.indexOf(key) >= 0) continue;
|
|
3314
3358
|
target[key] = source[key];
|
|
3315
3359
|
}
|
|
3316
|
-
|
|
3317
3360
|
return target;
|
|
3318
3361
|
}
|
|
3319
3362
|
|
|
@@ -3485,7 +3528,7 @@ var assign = Object.assign;
|
|
|
3485
3528
|
* @return {number}
|
|
3486
3529
|
*/
|
|
3487
3530
|
function hash (value, length) {
|
|
3488
|
-
return (((((((length << 2) ^ charat(value, 0)) << 2) ^ charat(value, 1)) << 2) ^ charat(value, 2)) << 2) ^ charat(value, 3)
|
|
3531
|
+
return charat(value, 0) ^ 45 ? (((((((length << 2) ^ charat(value, 0)) << 2) ^ charat(value, 1)) << 2) ^ charat(value, 2)) << 2) ^ charat(value, 3) : 0
|
|
3489
3532
|
}
|
|
3490
3533
|
|
|
3491
3534
|
/**
|
|
@@ -3838,7 +3881,7 @@ function parse (value, root, parent, rule, rules, rulesets, pseudo, points, decl
|
|
|
3838
3881
|
switch (previous = character, character = next()) {
|
|
3839
3882
|
// (
|
|
3840
3883
|
case 40:
|
|
3841
|
-
if (previous != 108 && characters
|
|
3884
|
+
if (previous != 108 && charat(characters, length - 1) == 58) {
|
|
3842
3885
|
if (indexof(characters += replace(delimit(character), '&', '&\f'), '&\f') != -1)
|
|
3843
3886
|
ampersand = -1;
|
|
3844
3887
|
break
|
|
@@ -3888,7 +3931,7 @@ function parse (value, root, parent, rule, rules, rulesets, pseudo, points, decl
|
|
|
3888
3931
|
if (offset === 0)
|
|
3889
3932
|
parse(characters, root, reference, reference, props, rulesets, length, points, children);
|
|
3890
3933
|
else
|
|
3891
|
-
switch (atrule) {
|
|
3934
|
+
switch (atrule === 99 && charat(characters, 3) === 110 ? 100 : atrule) {
|
|
3892
3935
|
// d m s
|
|
3893
3936
|
case 100: case 109: case 115:
|
|
3894
3937
|
parse(value, reference, reference, rule && append(ruleset(value, reference, reference, 0, 0, rules, points, type, rules, props = [], length), children), rules, children, length, points, rule ? props : children);
|
|
@@ -3985,123 +4028,6 @@ function declaration (value, root, parent, length) {
|
|
|
3985
4028
|
return node(value, root, parent, DECLARATION, substr(value, 0, length), substr(value, length + 1, -1), length)
|
|
3986
4029
|
}
|
|
3987
4030
|
|
|
3988
|
-
/**
|
|
3989
|
-
* @param {string} value
|
|
3990
|
-
* @param {number} length
|
|
3991
|
-
* @return {string}
|
|
3992
|
-
*/
|
|
3993
|
-
function prefix (value, length) {
|
|
3994
|
-
switch (hash(value, length)) {
|
|
3995
|
-
// color-adjust
|
|
3996
|
-
case 5103:
|
|
3997
|
-
return WEBKIT + 'print-' + value + value
|
|
3998
|
-
// animation, animation-(delay|direction|duration|fill-mode|iteration-count|name|play-state|timing-function)
|
|
3999
|
-
case 5737: case 4201: case 3177: case 3433: case 1641: case 4457: case 2921:
|
|
4000
|
-
// text-decoration, filter, clip-path, backface-visibility, column, box-decoration-break
|
|
4001
|
-
case 5572: case 6356: case 5844: case 3191: case 6645: case 3005:
|
|
4002
|
-
// mask, mask-image, mask-(mode|clip|size), mask-(repeat|origin), mask-position, mask-composite,
|
|
4003
|
-
case 6391: case 5879: case 5623: case 6135: case 4599: case 4855:
|
|
4004
|
-
// background-clip, columns, column-(count|fill|gap|rule|rule-color|rule-style|rule-width|span|width)
|
|
4005
|
-
case 4215: case 6389: case 5109: case 5365: case 5621: case 3829:
|
|
4006
|
-
return WEBKIT + value + value
|
|
4007
|
-
// appearance, user-select, transform, hyphens, text-size-adjust
|
|
4008
|
-
case 5349: case 4246: case 4810: case 6968: case 2756:
|
|
4009
|
-
return WEBKIT + value + MOZ + value + MS + value + value
|
|
4010
|
-
// flex, flex-direction
|
|
4011
|
-
case 6828: case 4268:
|
|
4012
|
-
return WEBKIT + value + MS + value + value
|
|
4013
|
-
// order
|
|
4014
|
-
case 6165:
|
|
4015
|
-
return WEBKIT + value + MS + 'flex-' + value + value
|
|
4016
|
-
// align-items
|
|
4017
|
-
case 5187:
|
|
4018
|
-
return WEBKIT + value + replace(value, /(\w+).+(:[^]+)/, WEBKIT + 'box-$1$2' + MS + 'flex-$1$2') + value
|
|
4019
|
-
// align-self
|
|
4020
|
-
case 5443:
|
|
4021
|
-
return WEBKIT + value + MS + 'flex-item-' + replace(value, /flex-|-self/, '') + value
|
|
4022
|
-
// align-content
|
|
4023
|
-
case 4675:
|
|
4024
|
-
return WEBKIT + value + MS + 'flex-line-pack' + replace(value, /align-content|flex-|-self/, '') + value
|
|
4025
|
-
// flex-shrink
|
|
4026
|
-
case 5548:
|
|
4027
|
-
return WEBKIT + value + MS + replace(value, 'shrink', 'negative') + value
|
|
4028
|
-
// flex-basis
|
|
4029
|
-
case 5292:
|
|
4030
|
-
return WEBKIT + value + MS + replace(value, 'basis', 'preferred-size') + value
|
|
4031
|
-
// flex-grow
|
|
4032
|
-
case 6060:
|
|
4033
|
-
return WEBKIT + 'box-' + replace(value, '-grow', '') + WEBKIT + value + MS + replace(value, 'grow', 'positive') + value
|
|
4034
|
-
// transition
|
|
4035
|
-
case 4554:
|
|
4036
|
-
return WEBKIT + replace(value, /([^-])(transform)/g, '$1' + WEBKIT + '$2') + value
|
|
4037
|
-
// cursor
|
|
4038
|
-
case 6187:
|
|
4039
|
-
return replace(replace(replace(value, /(zoom-|grab)/, WEBKIT + '$1'), /(image-set)/, WEBKIT + '$1'), value, '') + value
|
|
4040
|
-
// background, background-image
|
|
4041
|
-
case 5495: case 3959:
|
|
4042
|
-
return replace(value, /(image-set\([^]*)/, WEBKIT + '$1' + '$`$1')
|
|
4043
|
-
// justify-content
|
|
4044
|
-
case 4968:
|
|
4045
|
-
return replace(replace(value, /(.+:)(flex-)?(.*)/, WEBKIT + 'box-pack:$3' + MS + 'flex-pack:$3'), /s.+-b[^;]+/, 'justify') + WEBKIT + value + value
|
|
4046
|
-
// (margin|padding)-inline-(start|end)
|
|
4047
|
-
case 4095: case 3583: case 4068: case 2532:
|
|
4048
|
-
return replace(value, /(.+)-inline(.+)/, WEBKIT + '$1$2') + value
|
|
4049
|
-
// (min|max)?(width|height|inline-size|block-size)
|
|
4050
|
-
case 8116: case 7059: case 5753: case 5535:
|
|
4051
|
-
case 5445: case 5701: case 4933: case 4677:
|
|
4052
|
-
case 5533: case 5789: case 5021: case 4765:
|
|
4053
|
-
// stretch, max-content, min-content, fill-available
|
|
4054
|
-
if (strlen(value) - 1 - length > 6)
|
|
4055
|
-
switch (charat(value, length + 1)) {
|
|
4056
|
-
// (m)ax-content, (m)in-content
|
|
4057
|
-
case 109:
|
|
4058
|
-
// -
|
|
4059
|
-
if (charat(value, length + 4) !== 45)
|
|
4060
|
-
break
|
|
4061
|
-
// (f)ill-available, (f)it-content
|
|
4062
|
-
case 102:
|
|
4063
|
-
return replace(value, /(.+:)(.+)-([^]+)/, '$1' + WEBKIT + '$2-$3' + '$1' + MOZ + (charat(value, length + 3) == 108 ? '$3' : '$2-$3')) + value
|
|
4064
|
-
// (s)tretch
|
|
4065
|
-
case 115:
|
|
4066
|
-
return ~indexof(value, 'stretch') ? prefix(replace(value, 'stretch', 'fill-available'), length) + value : value
|
|
4067
|
-
}
|
|
4068
|
-
break
|
|
4069
|
-
// position: sticky
|
|
4070
|
-
case 4949:
|
|
4071
|
-
// (s)ticky?
|
|
4072
|
-
if (charat(value, length + 1) !== 115)
|
|
4073
|
-
break
|
|
4074
|
-
// display: (flex|inline-flex)
|
|
4075
|
-
case 6444:
|
|
4076
|
-
switch (charat(value, strlen(value) - 3 - (~indexof(value, '!important') && 10))) {
|
|
4077
|
-
// stic(k)y
|
|
4078
|
-
case 107:
|
|
4079
|
-
return replace(value, ':', ':' + WEBKIT) + value
|
|
4080
|
-
// (inline-)?fl(e)x
|
|
4081
|
-
case 101:
|
|
4082
|
-
return replace(value, /(.+:)([^;!]+)(;|!.+)?/, '$1' + WEBKIT + (charat(value, 14) === 45 ? 'inline-' : '') + 'box$3' + '$1' + WEBKIT + '$2$3' + '$1' + MS + '$2box$3') + value
|
|
4083
|
-
}
|
|
4084
|
-
break
|
|
4085
|
-
// writing-mode
|
|
4086
|
-
case 5936:
|
|
4087
|
-
switch (charat(value, length + 11)) {
|
|
4088
|
-
// vertical-l(r)
|
|
4089
|
-
case 114:
|
|
4090
|
-
return WEBKIT + value + MS + replace(value, /[svh]\w+-[tblr]{2}/, 'tb') + value
|
|
4091
|
-
// vertical-r(l)
|
|
4092
|
-
case 108:
|
|
4093
|
-
return WEBKIT + value + MS + replace(value, /[svh]\w+-[tblr]{2}/, 'tb-rl') + value
|
|
4094
|
-
// horizontal(-)tb
|
|
4095
|
-
case 45:
|
|
4096
|
-
return WEBKIT + value + MS + replace(value, /[svh]\w+-[tblr]{2}/, 'lr') + value
|
|
4097
|
-
}
|
|
4098
|
-
|
|
4099
|
-
return WEBKIT + value + MS + value + value
|
|
4100
|
-
}
|
|
4101
|
-
|
|
4102
|
-
return value
|
|
4103
|
-
}
|
|
4104
|
-
|
|
4105
4031
|
/**
|
|
4106
4032
|
* @param {object[]} children
|
|
4107
4033
|
* @param {function} callback
|
|
@@ -4164,41 +4090,6 @@ function rulesheet (callback) {
|
|
|
4164
4090
|
}
|
|
4165
4091
|
}
|
|
4166
4092
|
|
|
4167
|
-
/**
|
|
4168
|
-
* @param {object} element
|
|
4169
|
-
* @param {number} index
|
|
4170
|
-
* @param {object[]} children
|
|
4171
|
-
* @param {function} callback
|
|
4172
|
-
*/
|
|
4173
|
-
function prefixer (element, index, children, callback) {
|
|
4174
|
-
if (element.length > -1)
|
|
4175
|
-
if (!element.return)
|
|
4176
|
-
switch (element.type) {
|
|
4177
|
-
case DECLARATION: element.return = prefix(element.value, element.length);
|
|
4178
|
-
break
|
|
4179
|
-
case KEYFRAMES:
|
|
4180
|
-
return serialize([copy(element, {value: replace(element.value, '@', '@' + WEBKIT)})], callback)
|
|
4181
|
-
case RULESET:
|
|
4182
|
-
if (element.length)
|
|
4183
|
-
return combine(element.props, function (value) {
|
|
4184
|
-
switch (match(value, /(::plac\w+|:read-\w+)/)) {
|
|
4185
|
-
// :read-(only|write)
|
|
4186
|
-
case ':read-only': case ':read-write':
|
|
4187
|
-
return serialize([copy(element, {props: [replace(value, /:(read-\w+)/, ':' + MOZ + '$1')]})], callback)
|
|
4188
|
-
// :placeholder
|
|
4189
|
-
case '::placeholder':
|
|
4190
|
-
return serialize([
|
|
4191
|
-
copy(element, {props: [replace(value, /:(plac\w+)/, ':' + WEBKIT + 'input-$1')]}),
|
|
4192
|
-
copy(element, {props: [replace(value, /:(plac\w+)/, ':' + MOZ + '$1')]}),
|
|
4193
|
-
copy(element, {props: [replace(value, /:(plac\w+)/, MS + 'input-$1')]})
|
|
4194
|
-
], callback)
|
|
4195
|
-
}
|
|
4196
|
-
|
|
4197
|
-
return ''
|
|
4198
|
-
})
|
|
4199
|
-
}
|
|
4200
|
-
}
|
|
4201
|
-
|
|
4202
4093
|
var weakMemoize = function weakMemoize(func) {
|
|
4203
4094
|
// $FlowFixMe flow doesn't include all non-primitive types as allowed for weakmaps
|
|
4204
4095
|
var cache = new WeakMap();
|
|
@@ -4347,6 +4238,218 @@ var removeLabel = function removeLabel(element) {
|
|
|
4347
4238
|
}
|
|
4348
4239
|
};
|
|
4349
4240
|
|
|
4241
|
+
/* eslint-disable no-fallthrough */
|
|
4242
|
+
|
|
4243
|
+
function prefix(value, length) {
|
|
4244
|
+
switch (hash(value, length)) {
|
|
4245
|
+
// color-adjust
|
|
4246
|
+
case 5103:
|
|
4247
|
+
return WEBKIT + 'print-' + value + value;
|
|
4248
|
+
// animation, animation-(delay|direction|duration|fill-mode|iteration-count|name|play-state|timing-function)
|
|
4249
|
+
|
|
4250
|
+
case 5737:
|
|
4251
|
+
case 4201:
|
|
4252
|
+
case 3177:
|
|
4253
|
+
case 3433:
|
|
4254
|
+
case 1641:
|
|
4255
|
+
case 4457:
|
|
4256
|
+
case 2921: // text-decoration, filter, clip-path, backface-visibility, column, box-decoration-break
|
|
4257
|
+
|
|
4258
|
+
case 5572:
|
|
4259
|
+
case 6356:
|
|
4260
|
+
case 5844:
|
|
4261
|
+
case 3191:
|
|
4262
|
+
case 6645:
|
|
4263
|
+
case 3005: // mask, mask-image, mask-(mode|clip|size), mask-(repeat|origin), mask-position, mask-composite,
|
|
4264
|
+
|
|
4265
|
+
case 6391:
|
|
4266
|
+
case 5879:
|
|
4267
|
+
case 5623:
|
|
4268
|
+
case 6135:
|
|
4269
|
+
case 4599:
|
|
4270
|
+
case 4855: // background-clip, columns, column-(count|fill|gap|rule|rule-color|rule-style|rule-width|span|width)
|
|
4271
|
+
|
|
4272
|
+
case 4215:
|
|
4273
|
+
case 6389:
|
|
4274
|
+
case 5109:
|
|
4275
|
+
case 5365:
|
|
4276
|
+
case 5621:
|
|
4277
|
+
case 3829:
|
|
4278
|
+
return WEBKIT + value + value;
|
|
4279
|
+
// appearance, user-select, transform, hyphens, text-size-adjust
|
|
4280
|
+
|
|
4281
|
+
case 5349:
|
|
4282
|
+
case 4246:
|
|
4283
|
+
case 4810:
|
|
4284
|
+
case 6968:
|
|
4285
|
+
case 2756:
|
|
4286
|
+
return WEBKIT + value + MOZ + value + MS + value + value;
|
|
4287
|
+
// flex, flex-direction
|
|
4288
|
+
|
|
4289
|
+
case 6828:
|
|
4290
|
+
case 4268:
|
|
4291
|
+
return WEBKIT + value + MS + value + value;
|
|
4292
|
+
// order
|
|
4293
|
+
|
|
4294
|
+
case 6165:
|
|
4295
|
+
return WEBKIT + value + MS + 'flex-' + value + value;
|
|
4296
|
+
// align-items
|
|
4297
|
+
|
|
4298
|
+
case 5187:
|
|
4299
|
+
return WEBKIT + value + replace(value, /(\w+).+(:[^]+)/, WEBKIT + 'box-$1$2' + MS + 'flex-$1$2') + value;
|
|
4300
|
+
// align-self
|
|
4301
|
+
|
|
4302
|
+
case 5443:
|
|
4303
|
+
return WEBKIT + value + MS + 'flex-item-' + replace(value, /flex-|-self/, '') + value;
|
|
4304
|
+
// align-content
|
|
4305
|
+
|
|
4306
|
+
case 4675:
|
|
4307
|
+
return WEBKIT + value + MS + 'flex-line-pack' + replace(value, /align-content|flex-|-self/, '') + value;
|
|
4308
|
+
// flex-shrink
|
|
4309
|
+
|
|
4310
|
+
case 5548:
|
|
4311
|
+
return WEBKIT + value + MS + replace(value, 'shrink', 'negative') + value;
|
|
4312
|
+
// flex-basis
|
|
4313
|
+
|
|
4314
|
+
case 5292:
|
|
4315
|
+
return WEBKIT + value + MS + replace(value, 'basis', 'preferred-size') + value;
|
|
4316
|
+
// flex-grow
|
|
4317
|
+
|
|
4318
|
+
case 6060:
|
|
4319
|
+
return WEBKIT + 'box-' + replace(value, '-grow', '') + WEBKIT + value + MS + replace(value, 'grow', 'positive') + value;
|
|
4320
|
+
// transition
|
|
4321
|
+
|
|
4322
|
+
case 4554:
|
|
4323
|
+
return WEBKIT + replace(value, /([^-])(transform)/g, '$1' + WEBKIT + '$2') + value;
|
|
4324
|
+
// cursor
|
|
4325
|
+
|
|
4326
|
+
case 6187:
|
|
4327
|
+
return replace(replace(replace(value, /(zoom-|grab)/, WEBKIT + '$1'), /(image-set)/, WEBKIT + '$1'), value, '') + value;
|
|
4328
|
+
// background, background-image
|
|
4329
|
+
|
|
4330
|
+
case 5495:
|
|
4331
|
+
case 3959:
|
|
4332
|
+
return replace(value, /(image-set\([^]*)/, WEBKIT + '$1' + '$`$1');
|
|
4333
|
+
// justify-content
|
|
4334
|
+
|
|
4335
|
+
case 4968:
|
|
4336
|
+
return replace(replace(value, /(.+:)(flex-)?(.*)/, WEBKIT + 'box-pack:$3' + MS + 'flex-pack:$3'), /s.+-b[^;]+/, 'justify') + WEBKIT + value + value;
|
|
4337
|
+
// (margin|padding)-inline-(start|end)
|
|
4338
|
+
|
|
4339
|
+
case 4095:
|
|
4340
|
+
case 3583:
|
|
4341
|
+
case 4068:
|
|
4342
|
+
case 2532:
|
|
4343
|
+
return replace(value, /(.+)-inline(.+)/, WEBKIT + '$1$2') + value;
|
|
4344
|
+
// (min|max)?(width|height|inline-size|block-size)
|
|
4345
|
+
|
|
4346
|
+
case 8116:
|
|
4347
|
+
case 7059:
|
|
4348
|
+
case 5753:
|
|
4349
|
+
case 5535:
|
|
4350
|
+
case 5445:
|
|
4351
|
+
case 5701:
|
|
4352
|
+
case 4933:
|
|
4353
|
+
case 4677:
|
|
4354
|
+
case 5533:
|
|
4355
|
+
case 5789:
|
|
4356
|
+
case 5021:
|
|
4357
|
+
case 4765:
|
|
4358
|
+
// stretch, max-content, min-content, fill-available
|
|
4359
|
+
if (strlen(value) - 1 - length > 6) switch (charat(value, length + 1)) {
|
|
4360
|
+
// (m)ax-content, (m)in-content
|
|
4361
|
+
case 109:
|
|
4362
|
+
// -
|
|
4363
|
+
if (charat(value, length + 4) !== 45) break;
|
|
4364
|
+
// (f)ill-available, (f)it-content
|
|
4365
|
+
|
|
4366
|
+
case 102:
|
|
4367
|
+
return replace(value, /(.+:)(.+)-([^]+)/, '$1' + WEBKIT + '$2-$3' + '$1' + MOZ + (charat(value, length + 3) == 108 ? '$3' : '$2-$3')) + value;
|
|
4368
|
+
// (s)tretch
|
|
4369
|
+
|
|
4370
|
+
case 115:
|
|
4371
|
+
return ~indexof(value, 'stretch') ? prefix(replace(value, 'stretch', 'fill-available'), length) + value : value;
|
|
4372
|
+
}
|
|
4373
|
+
break;
|
|
4374
|
+
// position: sticky
|
|
4375
|
+
|
|
4376
|
+
case 4949:
|
|
4377
|
+
// (s)ticky?
|
|
4378
|
+
if (charat(value, length + 1) !== 115) break;
|
|
4379
|
+
// display: (flex|inline-flex)
|
|
4380
|
+
|
|
4381
|
+
case 6444:
|
|
4382
|
+
switch (charat(value, strlen(value) - 3 - (~indexof(value, '!important') && 10))) {
|
|
4383
|
+
// stic(k)y
|
|
4384
|
+
case 107:
|
|
4385
|
+
return replace(value, ':', ':' + WEBKIT) + value;
|
|
4386
|
+
// (inline-)?fl(e)x
|
|
4387
|
+
|
|
4388
|
+
case 101:
|
|
4389
|
+
return replace(value, /(.+:)([^;!]+)(;|!.+)?/, '$1' + WEBKIT + (charat(value, 14) === 45 ? 'inline-' : '') + 'box$3' + '$1' + WEBKIT + '$2$3' + '$1' + MS + '$2box$3') + value;
|
|
4390
|
+
}
|
|
4391
|
+
|
|
4392
|
+
break;
|
|
4393
|
+
// writing-mode
|
|
4394
|
+
|
|
4395
|
+
case 5936:
|
|
4396
|
+
switch (charat(value, length + 11)) {
|
|
4397
|
+
// vertical-l(r)
|
|
4398
|
+
case 114:
|
|
4399
|
+
return WEBKIT + value + MS + replace(value, /[svh]\w+-[tblr]{2}/, 'tb') + value;
|
|
4400
|
+
// vertical-r(l)
|
|
4401
|
+
|
|
4402
|
+
case 108:
|
|
4403
|
+
return WEBKIT + value + MS + replace(value, /[svh]\w+-[tblr]{2}/, 'tb-rl') + value;
|
|
4404
|
+
// horizontal(-)tb
|
|
4405
|
+
|
|
4406
|
+
case 45:
|
|
4407
|
+
return WEBKIT + value + MS + replace(value, /[svh]\w+-[tblr]{2}/, 'lr') + value;
|
|
4408
|
+
}
|
|
4409
|
+
|
|
4410
|
+
return WEBKIT + value + MS + value + value;
|
|
4411
|
+
}
|
|
4412
|
+
|
|
4413
|
+
return value;
|
|
4414
|
+
}
|
|
4415
|
+
|
|
4416
|
+
var prefixer = function prefixer(element, index, children, callback) {
|
|
4417
|
+
if (element.length > -1) if (!element["return"]) switch (element.type) {
|
|
4418
|
+
case DECLARATION:
|
|
4419
|
+
element["return"] = prefix(element.value, element.length);
|
|
4420
|
+
break;
|
|
4421
|
+
|
|
4422
|
+
case KEYFRAMES:
|
|
4423
|
+
return serialize([copy(element, {
|
|
4424
|
+
value: replace(element.value, '@', '@' + WEBKIT)
|
|
4425
|
+
})], callback);
|
|
4426
|
+
|
|
4427
|
+
case RULESET:
|
|
4428
|
+
if (element.length) return combine(element.props, function (value) {
|
|
4429
|
+
switch (match(value, /(::plac\w+|:read-\w+)/)) {
|
|
4430
|
+
// :read-(only|write)
|
|
4431
|
+
case ':read-only':
|
|
4432
|
+
case ':read-write':
|
|
4433
|
+
return serialize([copy(element, {
|
|
4434
|
+
props: [replace(value, /:(read-\w+)/, ':' + MOZ + '$1')]
|
|
4435
|
+
})], callback);
|
|
4436
|
+
// :placeholder
|
|
4437
|
+
|
|
4438
|
+
case '::placeholder':
|
|
4439
|
+
return serialize([copy(element, {
|
|
4440
|
+
props: [replace(value, /:(plac\w+)/, ':' + WEBKIT + 'input-$1')]
|
|
4441
|
+
}), copy(element, {
|
|
4442
|
+
props: [replace(value, /:(plac\w+)/, ':' + MOZ + '$1')]
|
|
4443
|
+
}), copy(element, {
|
|
4444
|
+
props: [replace(value, /:(plac\w+)/, MS + 'input-$1')]
|
|
4445
|
+
})], callback);
|
|
4446
|
+
}
|
|
4447
|
+
|
|
4448
|
+
return '';
|
|
4449
|
+
});
|
|
4450
|
+
}
|
|
4451
|
+
};
|
|
4452
|
+
|
|
4350
4453
|
var isBrowser = typeof document !== 'undefined';
|
|
4351
4454
|
var getServerStylisCache = isBrowser ? undefined : weakMemoize(function () {
|
|
4352
4455
|
return memoize$1(function () {
|
|
@@ -4540,17 +4643,17 @@ function StyledEngineProvider(props) {
|
|
|
4540
4643
|
}) : children;
|
|
4541
4644
|
}
|
|
4542
4645
|
|
|
4543
|
-
/** @license MUI v5.10.
|
|
4646
|
+
/** @license MUI v5.10.16
|
|
4544
4647
|
*
|
|
4545
4648
|
* This source code is licensed under the MIT license found in the
|
|
4546
4649
|
* LICENSE file in the root directory of this source tree.
|
|
4547
4650
|
*/
|
|
4548
4651
|
function styled$2(tag, options) {
|
|
4549
4652
|
const stylesFactory = emStyled(tag, options);
|
|
4550
|
-
|
|
4551
4653
|
return stylesFactory;
|
|
4552
|
-
}
|
|
4654
|
+
}
|
|
4553
4655
|
|
|
4656
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
4554
4657
|
const internal_processStyles = (tag, processor) => {
|
|
4555
4658
|
// Emotion attaches all the styles as `__emotion_styles`.
|
|
4556
4659
|
// Ref: https://github.com/emotion-js/emotion/blob/16d971d0da229596d6bcc39d282ba9753c9ee7cf/packages/styled/src/base.js#L186
|
|
@@ -4563,14 +4666,12 @@ function _extends$4() {
|
|
|
4563
4666
|
_extends$4 = Object.assign ? Object.assign.bind() : function (target) {
|
|
4564
4667
|
for (var i = 1; i < arguments.length; i++) {
|
|
4565
4668
|
var source = arguments[i];
|
|
4566
|
-
|
|
4567
4669
|
for (var key in source) {
|
|
4568
4670
|
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
4569
4671
|
target[key] = source[key];
|
|
4570
4672
|
}
|
|
4571
4673
|
}
|
|
4572
4674
|
}
|
|
4573
|
-
|
|
4574
4675
|
return target;
|
|
4575
4676
|
};
|
|
4576
4677
|
return _extends$4.apply(this, arguments);
|
|
@@ -4583,14 +4684,12 @@ function deepmerge(target, source, options = {
|
|
|
4583
4684
|
clone: true
|
|
4584
4685
|
}) {
|
|
4585
4686
|
const output = options.clone ? _extends$4({}, target) : target;
|
|
4586
|
-
|
|
4587
4687
|
if (isPlainObject(target) && isPlainObject(source)) {
|
|
4588
4688
|
Object.keys(source).forEach(key => {
|
|
4589
4689
|
// Avoid prototype pollution
|
|
4590
4690
|
if (key === '__proto__') {
|
|
4591
4691
|
return;
|
|
4592
4692
|
}
|
|
4593
|
-
|
|
4594
4693
|
if (isPlainObject(source[key]) && key in target && isPlainObject(target[key])) {
|
|
4595
4694
|
// Since `output` is a clone of `target` and we have narrowed `target` in this block we can cast to the same type.
|
|
4596
4695
|
output[key] = deepmerge(target[key], source[key], options);
|
|
@@ -4599,7 +4698,6 @@ function deepmerge(target, source, options = {
|
|
|
4599
4698
|
}
|
|
4600
4699
|
});
|
|
4601
4700
|
}
|
|
4602
|
-
|
|
4603
4701
|
return output;
|
|
4604
4702
|
}
|
|
4605
4703
|
|
|
@@ -4612,16 +4710,13 @@ function formatMuiErrorMessage(code) {
|
|
|
4612
4710
|
// Apply babel-plugin-transform-template-literals in loose mode
|
|
4613
4711
|
// loose mode is safe iff we're concatenating primitives
|
|
4614
4712
|
// see https://babeljs.io/docs/en/babel-plugin-transform-template-literals#loose
|
|
4615
|
-
|
|
4616
4713
|
/* eslint-disable prefer-template */
|
|
4617
4714
|
let url = 'https://mui.com/production-error/?code=' + code;
|
|
4618
|
-
|
|
4619
4715
|
for (let i = 1; i < arguments.length; i += 1) {
|
|
4620
4716
|
// rest params over-transpile for this case
|
|
4621
4717
|
// eslint-disable-next-line prefer-rest-params
|
|
4622
4718
|
url += '&args[]=' + encodeURIComponent(arguments[i]);
|
|
4623
4719
|
}
|
|
4624
|
-
|
|
4625
4720
|
return 'Minified MUI error #' + code + '; visit ' + url + ' for the full message.';
|
|
4626
4721
|
/* eslint-enable prefer-template */
|
|
4627
4722
|
}
|
|
@@ -4634,30 +4729,24 @@ function capitalize(string) {
|
|
|
4634
4729
|
if (typeof string !== 'string') {
|
|
4635
4730
|
throw new Error(formatMuiErrorMessage(7));
|
|
4636
4731
|
}
|
|
4637
|
-
|
|
4638
4732
|
return string.charAt(0).toUpperCase() + string.slice(1);
|
|
4639
4733
|
}
|
|
4640
4734
|
|
|
4641
4735
|
const defaultGenerator = componentName => componentName;
|
|
4642
|
-
|
|
4643
4736
|
const createClassNameGenerator = () => {
|
|
4644
4737
|
let generate = defaultGenerator;
|
|
4645
4738
|
return {
|
|
4646
4739
|
configure(generator) {
|
|
4647
4740
|
generate = generator;
|
|
4648
4741
|
},
|
|
4649
|
-
|
|
4650
4742
|
generate(componentName) {
|
|
4651
4743
|
return generate(componentName);
|
|
4652
4744
|
},
|
|
4653
|
-
|
|
4654
4745
|
reset() {
|
|
4655
4746
|
generate = defaultGenerator;
|
|
4656
4747
|
}
|
|
4657
|
-
|
|
4658
4748
|
};
|
|
4659
4749
|
};
|
|
4660
|
-
|
|
4661
4750
|
const ClassNameGenerator = createClassNameGenerator();
|
|
4662
4751
|
var ClassNameGenerator$1 = ClassNameGenerator;
|
|
4663
4752
|
|
|
@@ -4690,14 +4779,12 @@ function _extends$3() {
|
|
|
4690
4779
|
_extends$3 = Object.assign ? Object.assign.bind() : function (target) {
|
|
4691
4780
|
for (var i = 1; i < arguments.length; i++) {
|
|
4692
4781
|
var source = arguments[i];
|
|
4693
|
-
|
|
4694
4782
|
for (var key in source) {
|
|
4695
4783
|
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
4696
4784
|
target[key] = source[key];
|
|
4697
4785
|
}
|
|
4698
4786
|
}
|
|
4699
4787
|
}
|
|
4700
|
-
|
|
4701
4788
|
return target;
|
|
4702
4789
|
};
|
|
4703
4790
|
return _extends$3.apply(this, arguments);
|
|
@@ -4707,15 +4794,13 @@ function merge(acc, item) {
|
|
|
4707
4794
|
if (!item) {
|
|
4708
4795
|
return acc;
|
|
4709
4796
|
}
|
|
4710
|
-
|
|
4711
4797
|
return deepmerge(acc, item, {
|
|
4712
4798
|
clone: false // No need to clone deep, it's way faster.
|
|
4713
|
-
|
|
4714
4799
|
});
|
|
4715
4800
|
}
|
|
4716
4801
|
|
|
4802
|
+
// The breakpoint **start** at this value.
|
|
4717
4803
|
// For instance with the first breakpoint xs: [xs, sm[.
|
|
4718
|
-
|
|
4719
4804
|
const values = {
|
|
4720
4805
|
xs: 0,
|
|
4721
4806
|
// phone
|
|
@@ -4726,8 +4811,8 @@ const values = {
|
|
|
4726
4811
|
lg: 1200,
|
|
4727
4812
|
// desktop
|
|
4728
4813
|
xl: 1536 // large screen
|
|
4729
|
-
|
|
4730
4814
|
};
|
|
4815
|
+
|
|
4731
4816
|
const defaultBreakpoints = {
|
|
4732
4817
|
// Sorted ASC by size. That's important.
|
|
4733
4818
|
// It can't be configured as it's used statically for propTypes.
|
|
@@ -4736,7 +4821,6 @@ const defaultBreakpoints = {
|
|
|
4736
4821
|
};
|
|
4737
4822
|
function handleBreakpoints(props, propValue, styleFromPropValue) {
|
|
4738
4823
|
const theme = props.theme || {};
|
|
4739
|
-
|
|
4740
4824
|
if (Array.isArray(propValue)) {
|
|
4741
4825
|
const themeBreakpoints = theme.breakpoints || defaultBreakpoints;
|
|
4742
4826
|
return propValue.reduce((acc, item, index) => {
|
|
@@ -4744,7 +4828,6 @@ function handleBreakpoints(props, propValue, styleFromPropValue) {
|
|
|
4744
4828
|
return acc;
|
|
4745
4829
|
}, {});
|
|
4746
4830
|
}
|
|
4747
|
-
|
|
4748
4831
|
if (typeof propValue === 'object') {
|
|
4749
4832
|
const themeBreakpoints = theme.breakpoints || defaultBreakpoints;
|
|
4750
4833
|
return Object.keys(propValue).reduce((acc, breakpoint) => {
|
|
@@ -4756,18 +4839,14 @@ function handleBreakpoints(props, propValue, styleFromPropValue) {
|
|
|
4756
4839
|
const cssKey = breakpoint;
|
|
4757
4840
|
acc[cssKey] = propValue[cssKey];
|
|
4758
4841
|
}
|
|
4759
|
-
|
|
4760
4842
|
return acc;
|
|
4761
4843
|
}, {});
|
|
4762
4844
|
}
|
|
4763
|
-
|
|
4764
4845
|
const output = styleFromPropValue(propValue);
|
|
4765
4846
|
return output;
|
|
4766
4847
|
}
|
|
4767
|
-
|
|
4768
4848
|
function createEmptyBreakpointObject(breakpointsInput = {}) {
|
|
4769
4849
|
var _breakpointsInput$key;
|
|
4770
|
-
|
|
4771
4850
|
const breakpointsInOrder = (_breakpointsInput$key = breakpointsInput.keys) == null ? void 0 : _breakpointsInput$key.reduce((acc, key) => {
|
|
4772
4851
|
const breakpointStyleKey = breakpointsInput.up(key);
|
|
4773
4852
|
acc[breakpointStyleKey] = {};
|
|
@@ -4779,11 +4858,9 @@ function removeUnusedBreakpoints(breakpointKeys, style) {
|
|
|
4779
4858
|
return breakpointKeys.reduce((acc, key) => {
|
|
4780
4859
|
const breakpointOutput = acc[key];
|
|
4781
4860
|
const isBreakpointUnused = !breakpointOutput || Object.keys(breakpointOutput).length === 0;
|
|
4782
|
-
|
|
4783
4861
|
if (isBreakpointUnused) {
|
|
4784
4862
|
delete acc[key];
|
|
4785
4863
|
}
|
|
4786
|
-
|
|
4787
4864
|
return acc;
|
|
4788
4865
|
}, style);
|
|
4789
4866
|
}
|
|
@@ -4791,29 +4868,24 @@ function removeUnusedBreakpoints(breakpointKeys, style) {
|
|
|
4791
4868
|
function getPath$1(obj, path, checkVars = true) {
|
|
4792
4869
|
if (!path || typeof path !== 'string') {
|
|
4793
4870
|
return null;
|
|
4794
|
-
}
|
|
4795
|
-
|
|
4871
|
+
}
|
|
4796
4872
|
|
|
4873
|
+
// Check if CSS variables are used
|
|
4797
4874
|
if (obj && obj.vars && checkVars) {
|
|
4798
4875
|
const val = `vars.${path}`.split('.').reduce((acc, item) => acc && acc[item] ? acc[item] : null, obj);
|
|
4799
|
-
|
|
4800
4876
|
if (val != null) {
|
|
4801
4877
|
return val;
|
|
4802
4878
|
}
|
|
4803
4879
|
}
|
|
4804
|
-
|
|
4805
4880
|
return path.split('.').reduce((acc, item) => {
|
|
4806
4881
|
if (acc && acc[item] != null) {
|
|
4807
4882
|
return acc[item];
|
|
4808
4883
|
}
|
|
4809
|
-
|
|
4810
4884
|
return null;
|
|
4811
4885
|
}, obj);
|
|
4812
4886
|
}
|
|
4813
|
-
|
|
4814
|
-
function getValue$3(themeMapping, transform, propValueFinal, userValue = propValueFinal) {
|
|
4887
|
+
function getStyleValue(themeMapping, transform, propValueFinal, userValue = propValueFinal) {
|
|
4815
4888
|
let value;
|
|
4816
|
-
|
|
4817
4889
|
if (typeof themeMapping === 'function') {
|
|
4818
4890
|
value = themeMapping(propValueFinal);
|
|
4819
4891
|
} else if (Array.isArray(themeMapping)) {
|
|
@@ -4821,14 +4893,11 @@ function getValue$3(themeMapping, transform, propValueFinal, userValue = propVal
|
|
|
4821
4893
|
} else {
|
|
4822
4894
|
value = getPath$1(themeMapping, propValueFinal) || userValue;
|
|
4823
4895
|
}
|
|
4824
|
-
|
|
4825
4896
|
if (transform) {
|
|
4826
4897
|
value = transform(value, userValue);
|
|
4827
4898
|
}
|
|
4828
|
-
|
|
4829
4899
|
return value;
|
|
4830
4900
|
}
|
|
4831
|
-
|
|
4832
4901
|
function style$1(options) {
|
|
4833
4902
|
const {
|
|
4834
4903
|
prop,
|
|
@@ -4836,36 +4905,28 @@ function style$1(options) {
|
|
|
4836
4905
|
themeKey,
|
|
4837
4906
|
transform
|
|
4838
4907
|
} = options;
|
|
4839
|
-
|
|
4840
4908
|
const fn = props => {
|
|
4841
4909
|
if (props[prop] == null) {
|
|
4842
4910
|
return null;
|
|
4843
4911
|
}
|
|
4844
|
-
|
|
4845
4912
|
const propValue = props[prop];
|
|
4846
4913
|
const theme = props.theme;
|
|
4847
4914
|
const themeMapping = getPath$1(theme, themeKey) || {};
|
|
4848
|
-
|
|
4849
4915
|
const styleFromPropValue = propValueFinal => {
|
|
4850
|
-
let value =
|
|
4851
|
-
|
|
4916
|
+
let value = getStyleValue(themeMapping, transform, propValueFinal);
|
|
4852
4917
|
if (propValueFinal === value && typeof propValueFinal === 'string') {
|
|
4853
4918
|
// Haven't found value
|
|
4854
|
-
value =
|
|
4919
|
+
value = getStyleValue(themeMapping, transform, `${prop}${propValueFinal === 'default' ? '' : capitalize(propValueFinal)}`, propValueFinal);
|
|
4855
4920
|
}
|
|
4856
|
-
|
|
4857
4921
|
if (cssProperty === false) {
|
|
4858
4922
|
return value;
|
|
4859
4923
|
}
|
|
4860
|
-
|
|
4861
4924
|
return {
|
|
4862
4925
|
[cssProperty]: value
|
|
4863
4926
|
};
|
|
4864
4927
|
};
|
|
4865
|
-
|
|
4866
4928
|
return handleBreakpoints(props, propValue, styleFromPropValue);
|
|
4867
4929
|
};
|
|
4868
|
-
|
|
4869
4930
|
fn.propTypes = {};
|
|
4870
4931
|
fn.filterProps = [prop];
|
|
4871
4932
|
return fn;
|
|
@@ -4878,17 +4939,14 @@ function compose(...styles) {
|
|
|
4878
4939
|
});
|
|
4879
4940
|
return acc;
|
|
4880
4941
|
}, {});
|
|
4881
|
-
|
|
4882
4942
|
const fn = props => {
|
|
4883
4943
|
return Object.keys(props).reduce((acc, prop) => {
|
|
4884
4944
|
if (handlers[prop]) {
|
|
4885
4945
|
return merge(acc, handlers[prop](props));
|
|
4886
4946
|
}
|
|
4887
|
-
|
|
4888
4947
|
return acc;
|
|
4889
4948
|
}, {});
|
|
4890
4949
|
};
|
|
4891
|
-
|
|
4892
4950
|
fn.propTypes = {};
|
|
4893
4951
|
fn.filterProps = styles.reduce((acc, style) => acc.concat(style.filterProps), []);
|
|
4894
4952
|
return fn;
|
|
@@ -4900,7 +4958,6 @@ function memoize(fn) {
|
|
|
4900
4958
|
if (cache[arg] === undefined) {
|
|
4901
4959
|
cache[arg] = fn(arg);
|
|
4902
4960
|
}
|
|
4903
|
-
|
|
4904
4961
|
return cache[arg];
|
|
4905
4962
|
};
|
|
4906
4963
|
}
|
|
@@ -4922,10 +4979,11 @@ const aliases = {
|
|
|
4922
4979
|
marginY: 'my',
|
|
4923
4980
|
paddingX: 'px',
|
|
4924
4981
|
paddingY: 'py'
|
|
4925
|
-
};
|
|
4982
|
+
};
|
|
4983
|
+
|
|
4984
|
+
// memoize() impact:
|
|
4926
4985
|
// From 300,000 ops/sec
|
|
4927
4986
|
// To 350,000 ops/sec
|
|
4928
|
-
|
|
4929
4987
|
const getCssProperties = memoize(prop => {
|
|
4930
4988
|
// It's not a shorthand notation.
|
|
4931
4989
|
if (prop.length > 2) {
|
|
@@ -4935,7 +4993,6 @@ const getCssProperties = memoize(prop => {
|
|
|
4935
4993
|
return [prop];
|
|
4936
4994
|
}
|
|
4937
4995
|
}
|
|
4938
|
-
|
|
4939
4996
|
const [a, b] = prop.split('');
|
|
4940
4997
|
const property = properties[a];
|
|
4941
4998
|
const direction = directions[b] || '';
|
|
@@ -4946,33 +5003,26 @@ const paddingKeys = ['p', 'pt', 'pr', 'pb', 'pl', 'px', 'py', 'padding', 'paddin
|
|
|
4946
5003
|
const spacingKeys = [...marginKeys, ...paddingKeys];
|
|
4947
5004
|
function createUnaryUnit(theme, themeKey, defaultValue, propName) {
|
|
4948
5005
|
var _getPath;
|
|
4949
|
-
|
|
4950
5006
|
const themeSpacing = (_getPath = getPath$1(theme, themeKey, false)) != null ? _getPath : defaultValue;
|
|
4951
|
-
|
|
4952
5007
|
if (typeof themeSpacing === 'number') {
|
|
4953
5008
|
return abs => {
|
|
4954
5009
|
if (typeof abs === 'string') {
|
|
4955
5010
|
return abs;
|
|
4956
5011
|
}
|
|
4957
|
-
|
|
4958
5012
|
return themeSpacing * abs;
|
|
4959
5013
|
};
|
|
4960
5014
|
}
|
|
4961
|
-
|
|
4962
5015
|
if (Array.isArray(themeSpacing)) {
|
|
4963
5016
|
return abs => {
|
|
4964
5017
|
if (typeof abs === 'string') {
|
|
4965
5018
|
return abs;
|
|
4966
5019
|
}
|
|
4967
|
-
|
|
4968
5020
|
return themeSpacing[abs];
|
|
4969
5021
|
};
|
|
4970
5022
|
}
|
|
4971
|
-
|
|
4972
5023
|
if (typeof themeSpacing === 'function') {
|
|
4973
5024
|
return themeSpacing;
|
|
4974
5025
|
}
|
|
4975
|
-
|
|
4976
5026
|
return () => undefined;
|
|
4977
5027
|
}
|
|
4978
5028
|
function createUnarySpacing(theme) {
|
|
@@ -4982,18 +5032,14 @@ function getValue$2(transformer, propValue) {
|
|
|
4982
5032
|
if (typeof propValue === 'string' || propValue == null) {
|
|
4983
5033
|
return propValue;
|
|
4984
5034
|
}
|
|
4985
|
-
|
|
4986
5035
|
const abs = Math.abs(propValue);
|
|
4987
5036
|
const transformed = transformer(abs);
|
|
4988
|
-
|
|
4989
5037
|
if (propValue >= 0) {
|
|
4990
5038
|
return transformed;
|
|
4991
5039
|
}
|
|
4992
|
-
|
|
4993
5040
|
if (typeof transformed === 'number') {
|
|
4994
5041
|
return -transformed;
|
|
4995
5042
|
}
|
|
4996
|
-
|
|
4997
5043
|
return `-${transformed}`;
|
|
4998
5044
|
}
|
|
4999
5045
|
function getStyleFromPropValue(cssProperties, transformer) {
|
|
@@ -5002,29 +5048,24 @@ function getStyleFromPropValue(cssProperties, transformer) {
|
|
|
5002
5048
|
return acc;
|
|
5003
5049
|
}, {});
|
|
5004
5050
|
}
|
|
5005
|
-
|
|
5006
5051
|
function resolveCssProperty(props, keys, prop, transformer) {
|
|
5007
5052
|
// Using a hash computation over an array iteration could be faster, but with only 28 items,
|
|
5008
5053
|
// it's doesn't worth the bundle size.
|
|
5009
5054
|
if (keys.indexOf(prop) === -1) {
|
|
5010
5055
|
return null;
|
|
5011
5056
|
}
|
|
5012
|
-
|
|
5013
5057
|
const cssProperties = getCssProperties(prop);
|
|
5014
5058
|
const styleFromPropValue = getStyleFromPropValue(cssProperties, transformer);
|
|
5015
5059
|
const propValue = props[prop];
|
|
5016
5060
|
return handleBreakpoints(props, propValue, styleFromPropValue);
|
|
5017
5061
|
}
|
|
5018
|
-
|
|
5019
5062
|
function style(props, keys) {
|
|
5020
5063
|
const transformer = createUnarySpacing(props.theme);
|
|
5021
5064
|
return Object.keys(props).map(prop => resolveCssProperty(props, keys, prop, transformer)).reduce(merge, {});
|
|
5022
5065
|
}
|
|
5023
|
-
|
|
5024
5066
|
function spacing(props) {
|
|
5025
5067
|
return style(props, spacingKeys);
|
|
5026
5068
|
}
|
|
5027
|
-
|
|
5028
5069
|
spacing.propTypes = {};
|
|
5029
5070
|
spacing.filterProps = spacingKeys;
|
|
5030
5071
|
|
|
@@ -5032,10 +5073,8 @@ function getBorder(value) {
|
|
|
5032
5073
|
if (typeof value !== 'number') {
|
|
5033
5074
|
return value;
|
|
5034
5075
|
}
|
|
5035
|
-
|
|
5036
5076
|
return `${value}px solid`;
|
|
5037
5077
|
}
|
|
5038
|
-
|
|
5039
5078
|
const border = style$1({
|
|
5040
5079
|
prop: 'border',
|
|
5041
5080
|
themeKey: 'borders',
|
|
@@ -5084,14 +5123,11 @@ const borderLeftColor = style$1({
|
|
|
5084
5123
|
const borderRadius$1 = props => {
|
|
5085
5124
|
if (props.borderRadius !== undefined && props.borderRadius !== null) {
|
|
5086
5125
|
const transformer = createUnaryUnit(props.theme, 'shape.borderRadius', 4);
|
|
5087
|
-
|
|
5088
5126
|
const styleFromPropValue = propValue => ({
|
|
5089
5127
|
borderRadius: getValue$2(transformer, propValue)
|
|
5090
5128
|
});
|
|
5091
|
-
|
|
5092
5129
|
return handleBreakpoints(props, props.borderRadius, styleFromPropValue);
|
|
5093
5130
|
}
|
|
5094
|
-
|
|
5095
5131
|
return null;
|
|
5096
5132
|
};
|
|
5097
5133
|
borderRadius$1.propTypes = {};
|
|
@@ -5170,14 +5206,11 @@ var flexbox$1 = flexbox;
|
|
|
5170
5206
|
const gap = props => {
|
|
5171
5207
|
if (props.gap !== undefined && props.gap !== null) {
|
|
5172
5208
|
const transformer = createUnaryUnit(props.theme, 'spacing', 8);
|
|
5173
|
-
|
|
5174
5209
|
const styleFromPropValue = propValue => ({
|
|
5175
5210
|
gap: getValue$2(transformer, propValue)
|
|
5176
5211
|
});
|
|
5177
|
-
|
|
5178
5212
|
return handleBreakpoints(props, props.gap, styleFromPropValue);
|
|
5179
5213
|
}
|
|
5180
|
-
|
|
5181
5214
|
return null;
|
|
5182
5215
|
};
|
|
5183
5216
|
gap.propTypes = {};
|
|
@@ -5185,14 +5218,11 @@ gap.filterProps = ['gap'];
|
|
|
5185
5218
|
const columnGap = props => {
|
|
5186
5219
|
if (props.columnGap !== undefined && props.columnGap !== null) {
|
|
5187
5220
|
const transformer = createUnaryUnit(props.theme, 'spacing', 8);
|
|
5188
|
-
|
|
5189
5221
|
const styleFromPropValue = propValue => ({
|
|
5190
5222
|
columnGap: getValue$2(transformer, propValue)
|
|
5191
5223
|
});
|
|
5192
|
-
|
|
5193
5224
|
return handleBreakpoints(props, props.columnGap, styleFromPropValue);
|
|
5194
5225
|
}
|
|
5195
|
-
|
|
5196
5226
|
return null;
|
|
5197
5227
|
};
|
|
5198
5228
|
columnGap.propTypes = {};
|
|
@@ -5200,14 +5230,11 @@ columnGap.filterProps = ['columnGap'];
|
|
|
5200
5230
|
const rowGap = props => {
|
|
5201
5231
|
if (props.rowGap !== undefined && props.rowGap !== null) {
|
|
5202
5232
|
const transformer = createUnaryUnit(props.theme, 'spacing', 8);
|
|
5203
|
-
|
|
5204
5233
|
const styleFromPropValue = propValue => ({
|
|
5205
5234
|
rowGap: getValue$2(transformer, propValue)
|
|
5206
5235
|
});
|
|
5207
|
-
|
|
5208
5236
|
return handleBreakpoints(props, props.rowGap, styleFromPropValue);
|
|
5209
5237
|
}
|
|
5210
|
-
|
|
5211
5238
|
return null;
|
|
5212
5239
|
};
|
|
5213
5240
|
rowGap.propTypes = {};
|
|
@@ -5246,10 +5273,8 @@ function transform$1(value, userValue) {
|
|
|
5246
5273
|
if (userValue === 'grey') {
|
|
5247
5274
|
return userValue;
|
|
5248
5275
|
}
|
|
5249
|
-
|
|
5250
5276
|
return value;
|
|
5251
5277
|
}
|
|
5252
|
-
|
|
5253
5278
|
const color = style$1({
|
|
5254
5279
|
prop: 'color',
|
|
5255
5280
|
themeKey: 'palette',
|
|
@@ -5299,7 +5324,6 @@ var shadows$2 = boxShadow;
|
|
|
5299
5324
|
function transform(value) {
|
|
5300
5325
|
return value <= 1 && value !== 0 ? `${value * 100}%` : value;
|
|
5301
5326
|
}
|
|
5302
|
-
|
|
5303
5327
|
const width = style$1({
|
|
5304
5328
|
prop: 'width',
|
|
5305
5329
|
transform
|
|
@@ -5308,16 +5332,13 @@ const maxWidth = props => {
|
|
|
5308
5332
|
if (props.maxWidth !== undefined && props.maxWidth !== null) {
|
|
5309
5333
|
const styleFromPropValue = propValue => {
|
|
5310
5334
|
var _props$theme, _props$theme$breakpoi, _props$theme$breakpoi2;
|
|
5311
|
-
|
|
5312
5335
|
const breakpoint = ((_props$theme = props.theme) == null ? void 0 : (_props$theme$breakpoi = _props$theme.breakpoints) == null ? void 0 : (_props$theme$breakpoi2 = _props$theme$breakpoi.values) == null ? void 0 : _props$theme$breakpoi2[propValue]) || values[propValue];
|
|
5313
5336
|
return {
|
|
5314
5337
|
maxWidth: breakpoint || transform(propValue)
|
|
5315
5338
|
};
|
|
5316
5339
|
};
|
|
5317
|
-
|
|
5318
5340
|
return handleBreakpoints(props, props.maxWidth, styleFromPropValue);
|
|
5319
5341
|
}
|
|
5320
|
-
|
|
5321
5342
|
return null;
|
|
5322
5343
|
};
|
|
5323
5344
|
maxWidth.filterProps = ['maxWidth'];
|
|
@@ -5425,12 +5446,11 @@ function objectsHaveSameKeys(...objects) {
|
|
|
5425
5446
|
const union = new Set(allKeys);
|
|
5426
5447
|
return objects.every(object => union.size === Object.keys(object).length);
|
|
5427
5448
|
}
|
|
5428
|
-
|
|
5429
5449
|
function callIfFn(maybeFn, arg) {
|
|
5430
5450
|
return typeof maybeFn === 'function' ? maybeFn(arg) : maybeFn;
|
|
5431
|
-
}
|
|
5432
|
-
|
|
5451
|
+
}
|
|
5433
5452
|
|
|
5453
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
5434
5454
|
function unstable_createStyleFunctionSx(styleFunctionMapping$1 = styleFunctionMapping) {
|
|
5435
5455
|
const propToStyleFunction = Object.keys(styleFunctionMapping$1).reduce((acc, styleFnName) => {
|
|
5436
5456
|
styleFunctionMapping$1[styleFnName].filterProps.forEach(propName => {
|
|
@@ -5438,7 +5458,6 @@ function unstable_createStyleFunctionSx(styleFunctionMapping$1 = styleFunctionMa
|
|
|
5438
5458
|
});
|
|
5439
5459
|
return acc;
|
|
5440
5460
|
}, {});
|
|
5441
|
-
|
|
5442
5461
|
function getThemeValue(prop, value, theme) {
|
|
5443
5462
|
const inputProps = {
|
|
5444
5463
|
[prop]: value,
|
|
@@ -5449,43 +5468,36 @@ function unstable_createStyleFunctionSx(styleFunctionMapping$1 = styleFunctionMa
|
|
|
5449
5468
|
[prop]: value
|
|
5450
5469
|
};
|
|
5451
5470
|
}
|
|
5452
|
-
|
|
5453
5471
|
function styleFunctionSx(props) {
|
|
5454
5472
|
const {
|
|
5455
5473
|
sx,
|
|
5456
5474
|
theme = {}
|
|
5457
5475
|
} = props || {};
|
|
5458
|
-
|
|
5459
5476
|
if (!sx) {
|
|
5460
5477
|
return null; // Emotion & styled-components will neglect null
|
|
5461
5478
|
}
|
|
5479
|
+
|
|
5462
5480
|
/*
|
|
5463
5481
|
* Receive `sxInput` as object or callback
|
|
5464
5482
|
* and then recursively check keys & values to create media query object styles.
|
|
5465
5483
|
* (the result will be used in `styled`)
|
|
5466
5484
|
*/
|
|
5467
|
-
|
|
5468
|
-
|
|
5469
5485
|
function traverse(sxInput) {
|
|
5470
5486
|
let sxObject = sxInput;
|
|
5471
|
-
|
|
5472
5487
|
if (typeof sxInput === 'function') {
|
|
5473
5488
|
sxObject = sxInput(theme);
|
|
5474
5489
|
} else if (typeof sxInput !== 'object') {
|
|
5475
5490
|
// value
|
|
5476
5491
|
return sxInput;
|
|
5477
5492
|
}
|
|
5478
|
-
|
|
5479
5493
|
if (!sxObject) {
|
|
5480
5494
|
return null;
|
|
5481
5495
|
}
|
|
5482
|
-
|
|
5483
5496
|
const emptyBreakpoints = createEmptyBreakpointObject(theme.breakpoints);
|
|
5484
5497
|
const breakpointsKeys = Object.keys(emptyBreakpoints);
|
|
5485
5498
|
let css = emptyBreakpoints;
|
|
5486
5499
|
Object.keys(sxObject).forEach(styleKey => {
|
|
5487
5500
|
const value = callIfFn(sxObject[styleKey], theme);
|
|
5488
|
-
|
|
5489
5501
|
if (value !== null && value !== undefined) {
|
|
5490
5502
|
if (typeof value === 'object') {
|
|
5491
5503
|
if (propToStyleFunction[styleKey]) {
|
|
@@ -5496,7 +5508,6 @@ function unstable_createStyleFunctionSx(styleFunctionMapping$1 = styleFunctionMa
|
|
|
5496
5508
|
}, value, x => ({
|
|
5497
5509
|
[styleKey]: x
|
|
5498
5510
|
}));
|
|
5499
|
-
|
|
5500
5511
|
if (objectsHaveSameKeys(breakpointsValues, value)) {
|
|
5501
5512
|
css[styleKey] = styleFunctionSx({
|
|
5502
5513
|
sx: value,
|
|
@@ -5513,10 +5524,8 @@ function unstable_createStyleFunctionSx(styleFunctionMapping$1 = styleFunctionMa
|
|
|
5513
5524
|
});
|
|
5514
5525
|
return removeUnusedBreakpoints(breakpointsKeys, css);
|
|
5515
5526
|
}
|
|
5516
|
-
|
|
5517
5527
|
return Array.isArray(sx) ? sx.map(traverse) : traverse(sx);
|
|
5518
5528
|
}
|
|
5519
|
-
|
|
5520
5529
|
return styleFunctionSx;
|
|
5521
5530
|
}
|
|
5522
5531
|
const styleFunctionSx = unstable_createStyleFunctionSx();
|
|
@@ -5528,95 +5537,81 @@ function _objectWithoutPropertiesLoose(source, excluded) {
|
|
|
5528
5537
|
var target = {};
|
|
5529
5538
|
var sourceKeys = Object.keys(source);
|
|
5530
5539
|
var key, i;
|
|
5531
|
-
|
|
5532
5540
|
for (i = 0; i < sourceKeys.length; i++) {
|
|
5533
5541
|
key = sourceKeys[i];
|
|
5534
5542
|
if (excluded.indexOf(key) >= 0) continue;
|
|
5535
5543
|
target[key] = source[key];
|
|
5536
5544
|
}
|
|
5537
|
-
|
|
5538
5545
|
return target;
|
|
5539
5546
|
}
|
|
5540
5547
|
|
|
5541
5548
|
const _excluded$b = ["values", "unit", "step"];
|
|
5542
|
-
|
|
5543
5549
|
const sortBreakpointsValues = values => {
|
|
5544
5550
|
const breakpointsAsArray = Object.keys(values).map(key => ({
|
|
5545
5551
|
key,
|
|
5546
5552
|
val: values[key]
|
|
5547
|
-
})) || [];
|
|
5548
|
-
|
|
5553
|
+
})) || [];
|
|
5554
|
+
// Sort in ascending order
|
|
5549
5555
|
breakpointsAsArray.sort((breakpoint1, breakpoint2) => breakpoint1.val - breakpoint2.val);
|
|
5550
5556
|
return breakpointsAsArray.reduce((acc, obj) => {
|
|
5551
5557
|
return _extends$3({}, acc, {
|
|
5552
5558
|
[obj.key]: obj.val
|
|
5553
5559
|
});
|
|
5554
5560
|
}, {});
|
|
5555
|
-
};
|
|
5556
|
-
|
|
5561
|
+
};
|
|
5557
5562
|
|
|
5563
|
+
// Keep in mind that @media is inclusive by the CSS specification.
|
|
5558
5564
|
function createBreakpoints(breakpoints) {
|
|
5559
5565
|
const {
|
|
5560
|
-
|
|
5561
|
-
|
|
5562
|
-
|
|
5563
|
-
|
|
5564
|
-
|
|
5565
|
-
|
|
5566
|
-
|
|
5567
|
-
|
|
5568
|
-
|
|
5569
|
-
|
|
5570
|
-
|
|
5571
|
-
|
|
5572
|
-
|
|
5573
|
-
},
|
|
5574
|
-
unit = 'px',
|
|
5575
|
-
step = 5
|
|
5576
|
-
} = breakpoints,
|
|
5577
|
-
other = _objectWithoutPropertiesLoose(breakpoints, _excluded$b);
|
|
5566
|
+
// The breakpoint **start** at this value.
|
|
5567
|
+
// For instance with the first breakpoint xs: [xs, sm).
|
|
5568
|
+
values = {
|
|
5569
|
+
xs: 0,
|
|
5570
|
+
// phone
|
|
5571
|
+
sm: 600,
|
|
5572
|
+
// tablet
|
|
5573
|
+
md: 900,
|
|
5574
|
+
// small laptop
|
|
5575
|
+
lg: 1200,
|
|
5576
|
+
// desktop
|
|
5577
|
+
xl: 1536 // large screen
|
|
5578
|
+
},
|
|
5578
5579
|
|
|
5580
|
+
unit = 'px',
|
|
5581
|
+
step = 5
|
|
5582
|
+
} = breakpoints,
|
|
5583
|
+
other = _objectWithoutPropertiesLoose(breakpoints, _excluded$b);
|
|
5579
5584
|
const sortedValues = sortBreakpointsValues(values);
|
|
5580
5585
|
const keys = Object.keys(sortedValues);
|
|
5581
|
-
|
|
5582
5586
|
function up(key) {
|
|
5583
5587
|
const value = typeof values[key] === 'number' ? values[key] : key;
|
|
5584
5588
|
return `@media (min-width:${value}${unit})`;
|
|
5585
5589
|
}
|
|
5586
|
-
|
|
5587
5590
|
function down(key) {
|
|
5588
5591
|
const value = typeof values[key] === 'number' ? values[key] : key;
|
|
5589
5592
|
return `@media (max-width:${value - step / 100}${unit})`;
|
|
5590
5593
|
}
|
|
5591
|
-
|
|
5592
5594
|
function between(start, end) {
|
|
5593
5595
|
const endIndex = keys.indexOf(end);
|
|
5594
5596
|
return `@media (min-width:${typeof values[start] === 'number' ? values[start] : start}${unit}) and ` + `(max-width:${(endIndex !== -1 && typeof values[keys[endIndex]] === 'number' ? values[keys[endIndex]] : end) - step / 100}${unit})`;
|
|
5595
5597
|
}
|
|
5596
|
-
|
|
5597
5598
|
function only(key) {
|
|
5598
5599
|
if (keys.indexOf(key) + 1 < keys.length) {
|
|
5599
5600
|
return between(key, keys[keys.indexOf(key) + 1]);
|
|
5600
5601
|
}
|
|
5601
|
-
|
|
5602
5602
|
return up(key);
|
|
5603
5603
|
}
|
|
5604
|
-
|
|
5605
5604
|
function not(key) {
|
|
5606
5605
|
// handle first and last key separately, for better readability
|
|
5607
5606
|
const keyIndex = keys.indexOf(key);
|
|
5608
|
-
|
|
5609
5607
|
if (keyIndex === 0) {
|
|
5610
5608
|
return up(keys[1]);
|
|
5611
5609
|
}
|
|
5612
|
-
|
|
5613
5610
|
if (keyIndex === keys.length - 1) {
|
|
5614
5611
|
return down(keys[keyIndex]);
|
|
5615
5612
|
}
|
|
5616
|
-
|
|
5617
5613
|
return between(key, keys[keys.indexOf(key) + 1]).replace('@media', '@media not all and');
|
|
5618
5614
|
}
|
|
5619
|
-
|
|
5620
5615
|
return _extends$3({
|
|
5621
5616
|
keys,
|
|
5622
5617
|
values: sortedValues,
|
|
@@ -5635,43 +5630,39 @@ const shape = {
|
|
|
5635
5630
|
var shape$1 = shape;
|
|
5636
5631
|
|
|
5637
5632
|
/* tslint:enable:unified-signatures */
|
|
5633
|
+
|
|
5638
5634
|
function createSpacing(spacingInput = 8) {
|
|
5639
5635
|
// Already transformed.
|
|
5640
5636
|
if (spacingInput.mui) {
|
|
5641
5637
|
return spacingInput;
|
|
5642
|
-
}
|
|
5638
|
+
}
|
|
5639
|
+
|
|
5640
|
+
// Material Design layouts are visually balanced. Most measurements align to an 8dp grid, which aligns both spacing and the overall layout.
|
|
5643
5641
|
// Smaller components, such as icons, can align to a 4dp grid.
|
|
5644
5642
|
// https://m2.material.io/design/layout/understanding-layout.html
|
|
5645
|
-
|
|
5646
|
-
|
|
5647
5643
|
const transform = createUnarySpacing({
|
|
5648
5644
|
spacing: spacingInput
|
|
5649
5645
|
});
|
|
5650
|
-
|
|
5651
5646
|
const spacing = (...argsInput) => {
|
|
5652
|
-
|
|
5653
5647
|
const args = argsInput.length === 0 ? [1] : argsInput;
|
|
5654
5648
|
return args.map(argument => {
|
|
5655
5649
|
const output = transform(argument);
|
|
5656
5650
|
return typeof output === 'number' ? `${output}px` : output;
|
|
5657
5651
|
}).join(' ');
|
|
5658
5652
|
};
|
|
5659
|
-
|
|
5660
5653
|
spacing.mui = true;
|
|
5661
5654
|
return spacing;
|
|
5662
5655
|
}
|
|
5663
5656
|
|
|
5664
5657
|
const _excluded$a = ["breakpoints", "palette", "spacing", "shape"];
|
|
5665
|
-
|
|
5666
5658
|
function createTheme$1(options = {}, ...args) {
|
|
5667
5659
|
const {
|
|
5668
|
-
|
|
5669
|
-
|
|
5670
|
-
|
|
5671
|
-
|
|
5672
|
-
|
|
5673
|
-
|
|
5674
|
-
|
|
5660
|
+
breakpoints: breakpointsInput = {},
|
|
5661
|
+
palette: paletteInput = {},
|
|
5662
|
+
spacing: spacingInput,
|
|
5663
|
+
shape: shapeInput = {}
|
|
5664
|
+
} = options,
|
|
5665
|
+
other = _objectWithoutPropertiesLoose(options, _excluded$a);
|
|
5675
5666
|
const breakpoints = createBreakpoints(breakpointsInput);
|
|
5676
5667
|
const spacing = createSpacing(spacingInput);
|
|
5677
5668
|
let muiTheme = deepmerge({
|
|
@@ -5693,26 +5684,22 @@ function _extends$2() {
|
|
|
5693
5684
|
_extends$2 = Object.assign ? Object.assign.bind() : function (target) {
|
|
5694
5685
|
for (var i = 1; i < arguments.length; i++) {
|
|
5695
5686
|
var source = arguments[i];
|
|
5696
|
-
|
|
5697
5687
|
for (var key in source) {
|
|
5698
5688
|
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
5699
5689
|
target[key] = source[key];
|
|
5700
5690
|
}
|
|
5701
5691
|
}
|
|
5702
5692
|
}
|
|
5703
|
-
|
|
5704
5693
|
return target;
|
|
5705
5694
|
};
|
|
5706
5695
|
return _extends$2.apply(this, arguments);
|
|
5707
5696
|
}
|
|
5708
5697
|
|
|
5709
5698
|
const ThemeContext = /*#__PURE__*/React.createContext(null);
|
|
5710
|
-
|
|
5711
5699
|
var ThemeContext$1 = ThemeContext;
|
|
5712
5700
|
|
|
5713
5701
|
function useTheme$4() {
|
|
5714
5702
|
const theme = React.useContext(ThemeContext$1);
|
|
5715
|
-
|
|
5716
5703
|
return theme;
|
|
5717
5704
|
}
|
|
5718
5705
|
|
|
@@ -5722,33 +5709,27 @@ var nested = hasSymbol ? Symbol.for('mui.nested') : '__THEME_NESTED__';
|
|
|
5722
5709
|
function mergeOuterLocalTheme(outerTheme, localTheme) {
|
|
5723
5710
|
if (typeof localTheme === 'function') {
|
|
5724
5711
|
const mergedTheme = localTheme(outerTheme);
|
|
5725
|
-
|
|
5726
5712
|
return mergedTheme;
|
|
5727
5713
|
}
|
|
5728
|
-
|
|
5729
5714
|
return _extends$2({}, outerTheme, localTheme);
|
|
5730
5715
|
}
|
|
5716
|
+
|
|
5731
5717
|
/**
|
|
5732
5718
|
* This component takes a `theme` prop.
|
|
5733
5719
|
* It makes the `theme` available down the React tree thanks to React context.
|
|
5734
5720
|
* This component should preferably be used at **the root of your component tree**.
|
|
5735
5721
|
*/
|
|
5736
|
-
|
|
5737
|
-
|
|
5738
5722
|
function ThemeProvider$1(props) {
|
|
5739
5723
|
const {
|
|
5740
5724
|
children,
|
|
5741
5725
|
theme: localTheme
|
|
5742
5726
|
} = props;
|
|
5743
5727
|
const outerTheme = useTheme$4();
|
|
5744
|
-
|
|
5745
5728
|
const theme = React.useMemo(() => {
|
|
5746
5729
|
const output = outerTheme === null ? localTheme : mergeOuterLocalTheme(outerTheme, localTheme);
|
|
5747
|
-
|
|
5748
5730
|
if (output != null) {
|
|
5749
5731
|
output[nested] = outerTheme !== null;
|
|
5750
5732
|
}
|
|
5751
|
-
|
|
5752
5733
|
return output;
|
|
5753
5734
|
}, [localTheme, outerTheme]);
|
|
5754
5735
|
return /*#__PURE__*/jsxRuntime.exports.jsx(ThemeContext$1.Provider, {
|
|
@@ -5760,36 +5741,31 @@ function ThemeProvider$1(props) {
|
|
|
5760
5741
|
function isObjectEmpty(obj) {
|
|
5761
5742
|
return Object.keys(obj).length === 0;
|
|
5762
5743
|
}
|
|
5763
|
-
|
|
5764
5744
|
function useTheme$3(defaultTheme = null) {
|
|
5765
5745
|
const contextTheme = useTheme$4();
|
|
5766
5746
|
return !contextTheme || isObjectEmpty(contextTheme) ? defaultTheme : contextTheme;
|
|
5767
5747
|
}
|
|
5768
5748
|
|
|
5769
5749
|
const systemDefaultTheme$1 = createTheme$1();
|
|
5770
|
-
|
|
5771
5750
|
function useTheme$2(defaultTheme = systemDefaultTheme$1) {
|
|
5772
5751
|
return useTheme$3(defaultTheme);
|
|
5773
5752
|
}
|
|
5774
5753
|
|
|
5775
5754
|
const _excluded$9 = ["variant"];
|
|
5776
|
-
|
|
5777
5755
|
function isEmpty$2(string) {
|
|
5778
5756
|
return string.length === 0;
|
|
5779
5757
|
}
|
|
5758
|
+
|
|
5780
5759
|
/**
|
|
5781
5760
|
* Generates string classKey based on the properties provided. It starts with the
|
|
5782
5761
|
* variant if defined, and then it appends all other properties in alphabetical order.
|
|
5783
5762
|
* @param {object} props - the properties for which the classKey should be created.
|
|
5784
5763
|
*/
|
|
5785
|
-
|
|
5786
|
-
|
|
5787
5764
|
function propsToClassKey(props) {
|
|
5788
5765
|
const {
|
|
5789
|
-
|
|
5790
|
-
|
|
5791
|
-
|
|
5792
|
-
|
|
5766
|
+
variant
|
|
5767
|
+
} = props,
|
|
5768
|
+
other = _objectWithoutPropertiesLoose(props, _excluded$9);
|
|
5793
5769
|
let classKey = variant || '';
|
|
5794
5770
|
Object.keys(other).sort().forEach(key => {
|
|
5795
5771
|
if (key === 'color') {
|
|
@@ -5802,36 +5778,31 @@ function propsToClassKey(props) {
|
|
|
5802
5778
|
}
|
|
5803
5779
|
|
|
5804
5780
|
const _excluded$8 = ["name", "slot", "skipVariantsResolver", "skipSx", "overridesResolver"],
|
|
5805
|
-
|
|
5806
|
-
|
|
5807
|
-
|
|
5781
|
+
_excluded2$2 = ["theme"],
|
|
5782
|
+
_excluded3 = ["theme"];
|
|
5808
5783
|
function isEmpty$1(obj) {
|
|
5809
5784
|
return Object.keys(obj).length === 0;
|
|
5810
|
-
}
|
|
5811
|
-
|
|
5785
|
+
}
|
|
5812
5786
|
|
|
5787
|
+
// https://github.com/emotion-js/emotion/blob/26ded6109fcd8ca9875cc2ce4564fee678a3f3c5/packages/styled/src/utils.js#L40
|
|
5813
5788
|
function isStringTag(tag) {
|
|
5814
|
-
return typeof tag === 'string' &&
|
|
5789
|
+
return typeof tag === 'string' &&
|
|
5790
|
+
// 96 is one less than the char code
|
|
5815
5791
|
// for "a" so this is checking that
|
|
5816
5792
|
// it's a lowercase character
|
|
5817
5793
|
tag.charCodeAt(0) > 96;
|
|
5818
5794
|
}
|
|
5819
|
-
|
|
5820
5795
|
const getStyleOverrides = (name, theme) => {
|
|
5821
5796
|
if (theme.components && theme.components[name] && theme.components[name].styleOverrides) {
|
|
5822
5797
|
return theme.components[name].styleOverrides;
|
|
5823
5798
|
}
|
|
5824
|
-
|
|
5825
5799
|
return null;
|
|
5826
5800
|
};
|
|
5827
|
-
|
|
5828
5801
|
const getVariantStyles = (name, theme) => {
|
|
5829
5802
|
let variants = [];
|
|
5830
|
-
|
|
5831
5803
|
if (theme && theme.components && theme.components[name] && theme.components[name].variants) {
|
|
5832
5804
|
variants = theme.components[name].variants;
|
|
5833
5805
|
}
|
|
5834
|
-
|
|
5835
5806
|
const variantsStyles = {};
|
|
5836
5807
|
variants.forEach(definition => {
|
|
5837
5808
|
const key = propsToClassKey(definition.props);
|
|
@@ -5839,16 +5810,13 @@ const getVariantStyles = (name, theme) => {
|
|
|
5839
5810
|
});
|
|
5840
5811
|
return variantsStyles;
|
|
5841
5812
|
};
|
|
5842
|
-
|
|
5843
5813
|
const variantsResolver = (props, styles, theme, name) => {
|
|
5844
5814
|
var _theme$components, _theme$components$nam;
|
|
5845
|
-
|
|
5846
5815
|
const {
|
|
5847
5816
|
ownerState = {}
|
|
5848
5817
|
} = props;
|
|
5849
5818
|
const variantsStyles = [];
|
|
5850
5819
|
const themeVariants = theme == null ? void 0 : (_theme$components = theme.components) == null ? void 0 : (_theme$components$nam = _theme$components[name]) == null ? void 0 : _theme$components$nam.variants;
|
|
5851
|
-
|
|
5852
5820
|
if (themeVariants) {
|
|
5853
5821
|
themeVariants.forEach(themeVariant => {
|
|
5854
5822
|
let isMatch = true;
|
|
@@ -5857,22 +5825,19 @@ const variantsResolver = (props, styles, theme, name) => {
|
|
|
5857
5825
|
isMatch = false;
|
|
5858
5826
|
}
|
|
5859
5827
|
});
|
|
5860
|
-
|
|
5861
5828
|
if (isMatch) {
|
|
5862
5829
|
variantsStyles.push(styles[propsToClassKey(themeVariant.props)]);
|
|
5863
5830
|
}
|
|
5864
5831
|
});
|
|
5865
5832
|
}
|
|
5866
|
-
|
|
5867
5833
|
return variantsStyles;
|
|
5868
|
-
};
|
|
5869
|
-
|
|
5834
|
+
};
|
|
5870
5835
|
|
|
5836
|
+
// Update /system/styled/#api in case if this changes
|
|
5871
5837
|
function shouldForwardProp(prop) {
|
|
5872
5838
|
return prop !== 'ownerState' && prop !== 'theme' && prop !== 'sx' && prop !== 'as';
|
|
5873
5839
|
}
|
|
5874
5840
|
const systemDefaultTheme = createTheme$1();
|
|
5875
|
-
|
|
5876
5841
|
function createStyled(input = {}) {
|
|
5877
5842
|
const {
|
|
5878
5843
|
defaultTheme = systemDefaultTheme,
|
|
@@ -5880,35 +5845,30 @@ function createStyled(input = {}) {
|
|
|
5880
5845
|
slotShouldForwardProp = shouldForwardProp,
|
|
5881
5846
|
styleFunctionSx = defaultStyleFunctionSx
|
|
5882
5847
|
} = input;
|
|
5883
|
-
|
|
5884
5848
|
const systemSx = props => {
|
|
5885
5849
|
const theme = isEmpty$1(props.theme) ? defaultTheme : props.theme;
|
|
5886
5850
|
return styleFunctionSx(_extends$3({}, props, {
|
|
5887
5851
|
theme
|
|
5888
5852
|
}));
|
|
5889
5853
|
};
|
|
5890
|
-
|
|
5891
5854
|
systemSx.__mui_systemSx = true;
|
|
5892
5855
|
return (tag, inputOptions = {}) => {
|
|
5893
5856
|
// Filter out the `sx` style function from the previous styled component to prevent unnecessary styles generated by the composite components.
|
|
5894
5857
|
internal_processStyles(tag, styles => styles.filter(style => !(style != null && style.__mui_systemSx)));
|
|
5895
|
-
|
|
5896
5858
|
const {
|
|
5897
|
-
|
|
5898
|
-
|
|
5899
|
-
|
|
5900
|
-
|
|
5901
|
-
|
|
5902
|
-
|
|
5903
|
-
|
|
5904
|
-
|
|
5905
|
-
|
|
5859
|
+
name: componentName,
|
|
5860
|
+
slot: componentSlot,
|
|
5861
|
+
skipVariantsResolver: inputSkipVariantsResolver,
|
|
5862
|
+
skipSx: inputSkipSx,
|
|
5863
|
+
overridesResolver
|
|
5864
|
+
} = inputOptions,
|
|
5865
|
+
options = _objectWithoutPropertiesLoose(inputOptions, _excluded$8);
|
|
5866
|
+
|
|
5867
|
+
// if skipVariantsResolver option is defined, take the value, otherwise, true for root and false for other slots.
|
|
5906
5868
|
const skipVariantsResolver = inputSkipVariantsResolver !== undefined ? inputSkipVariantsResolver : componentSlot && componentSlot !== 'Root' || false;
|
|
5907
5869
|
const skipSx = inputSkipSx || false;
|
|
5908
5870
|
let label;
|
|
5909
|
-
|
|
5910
5871
|
let shouldForwardPropOption = shouldForwardProp;
|
|
5911
|
-
|
|
5912
5872
|
if (componentSlot === 'Root') {
|
|
5913
5873
|
shouldForwardPropOption = rootShouldForwardProp;
|
|
5914
5874
|
} else if (componentSlot) {
|
|
@@ -5918,12 +5878,10 @@ function createStyled(input = {}) {
|
|
|
5918
5878
|
// for string (html) tag, preserve the behavior in emotion & styled-components.
|
|
5919
5879
|
shouldForwardPropOption = undefined;
|
|
5920
5880
|
}
|
|
5921
|
-
|
|
5922
5881
|
const defaultStyledResolver = styled$2(tag, _extends$3({
|
|
5923
5882
|
shouldForwardProp: shouldForwardPropOption,
|
|
5924
5883
|
label
|
|
5925
5884
|
}, options));
|
|
5926
|
-
|
|
5927
5885
|
const muiStyledResolver = (styleArg, ...expressions) => {
|
|
5928
5886
|
const expressionsWithDefaultTheme = expressions ? expressions.map(stylesArg => {
|
|
5929
5887
|
// On the server Emotion doesn't use React.forwardRef for creating components, so the created
|
|
@@ -5931,22 +5889,19 @@ function createStyled(input = {}) {
|
|
|
5931
5889
|
// which are basically components used as a selectors.
|
|
5932
5890
|
return typeof stylesArg === 'function' && stylesArg.__emotion_real !== stylesArg ? _ref => {
|
|
5933
5891
|
let {
|
|
5934
|
-
|
|
5935
|
-
|
|
5936
|
-
|
|
5937
|
-
|
|
5892
|
+
theme: themeInput
|
|
5893
|
+
} = _ref,
|
|
5894
|
+
other = _objectWithoutPropertiesLoose(_ref, _excluded2$2);
|
|
5938
5895
|
return stylesArg(_extends$3({
|
|
5939
5896
|
theme: isEmpty$1(themeInput) ? defaultTheme : themeInput
|
|
5940
5897
|
}, other));
|
|
5941
5898
|
} : stylesArg;
|
|
5942
5899
|
}) : [];
|
|
5943
5900
|
let transformedStyleArg = styleArg;
|
|
5944
|
-
|
|
5945
5901
|
if (componentName && overridesResolver) {
|
|
5946
5902
|
expressionsWithDefaultTheme.push(props => {
|
|
5947
5903
|
const theme = isEmpty$1(props.theme) ? defaultTheme : props.theme;
|
|
5948
5904
|
const styleOverrides = getStyleOverrides(componentName, theme);
|
|
5949
|
-
|
|
5950
5905
|
if (styleOverrides) {
|
|
5951
5906
|
const resolvedStyleOverrides = {};
|
|
5952
5907
|
Object.entries(styleOverrides).forEach(([slotKey, slotStyle]) => {
|
|
@@ -5956,55 +5911,46 @@ function createStyled(input = {}) {
|
|
|
5956
5911
|
});
|
|
5957
5912
|
return overridesResolver(props, resolvedStyleOverrides);
|
|
5958
5913
|
}
|
|
5959
|
-
|
|
5960
5914
|
return null;
|
|
5961
5915
|
});
|
|
5962
5916
|
}
|
|
5963
|
-
|
|
5964
5917
|
if (componentName && !skipVariantsResolver) {
|
|
5965
5918
|
expressionsWithDefaultTheme.push(props => {
|
|
5966
5919
|
const theme = isEmpty$1(props.theme) ? defaultTheme : props.theme;
|
|
5967
5920
|
return variantsResolver(props, getVariantStyles(componentName, theme), theme, componentName);
|
|
5968
5921
|
});
|
|
5969
5922
|
}
|
|
5970
|
-
|
|
5971
5923
|
if (!skipSx) {
|
|
5972
5924
|
expressionsWithDefaultTheme.push(systemSx);
|
|
5973
5925
|
}
|
|
5974
|
-
|
|
5975
5926
|
const numOfCustomFnsApplied = expressionsWithDefaultTheme.length - expressions.length;
|
|
5976
|
-
|
|
5977
5927
|
if (Array.isArray(styleArg) && numOfCustomFnsApplied > 0) {
|
|
5978
|
-
const placeholders = new Array(numOfCustomFnsApplied).fill('');
|
|
5979
|
-
|
|
5928
|
+
const placeholders = new Array(numOfCustomFnsApplied).fill('');
|
|
5929
|
+
// If the type is array, than we need to add placeholders in the template for the overrides, variants and the sx styles.
|
|
5980
5930
|
transformedStyleArg = [...styleArg, ...placeholders];
|
|
5981
5931
|
transformedStyleArg.raw = [...styleArg.raw, ...placeholders];
|
|
5982
|
-
} else if (typeof styleArg === 'function' &&
|
|
5932
|
+
} else if (typeof styleArg === 'function' &&
|
|
5933
|
+
// On the server Emotion doesn't use React.forwardRef for creating components, so the created
|
|
5983
5934
|
// component stays as a function. This condition makes sure that we do not interpolate functions
|
|
5984
5935
|
// which are basically components used as a selectors.
|
|
5985
5936
|
styleArg.__emotion_real !== styleArg) {
|
|
5986
5937
|
// If the type is function, we need to define the default theme.
|
|
5987
5938
|
transformedStyleArg = _ref2 => {
|
|
5988
5939
|
let {
|
|
5989
|
-
|
|
5990
|
-
|
|
5991
|
-
|
|
5992
|
-
|
|
5940
|
+
theme: themeInput
|
|
5941
|
+
} = _ref2,
|
|
5942
|
+
other = _objectWithoutPropertiesLoose(_ref2, _excluded3);
|
|
5993
5943
|
return styleArg(_extends$3({
|
|
5994
5944
|
theme: isEmpty$1(themeInput) ? defaultTheme : themeInput
|
|
5995
5945
|
}, other));
|
|
5996
5946
|
};
|
|
5997
5947
|
}
|
|
5998
|
-
|
|
5999
5948
|
const Component = defaultStyledResolver(transformedStyleArg, ...expressionsWithDefaultTheme);
|
|
6000
|
-
|
|
6001
5949
|
return Component;
|
|
6002
5950
|
};
|
|
6003
|
-
|
|
6004
5951
|
if (defaultStyledResolver.withConfig) {
|
|
6005
5952
|
muiStyledResolver.withConfig = defaultStyledResolver.withConfig;
|
|
6006
5953
|
}
|
|
6007
|
-
|
|
6008
5954
|
return muiStyledResolver;
|
|
6009
5955
|
};
|
|
6010
5956
|
}
|
|
@@ -6017,29 +5963,26 @@ function createStyled(input = {}) {
|
|
|
6017
5963
|
* @returns {number} A number in the range [min, max]
|
|
6018
5964
|
*/
|
|
6019
5965
|
function clamp(value, min = 0, max = 1) {
|
|
6020
|
-
|
|
6021
5966
|
return Math.min(Math.max(min, value), max);
|
|
6022
5967
|
}
|
|
5968
|
+
|
|
6023
5969
|
/**
|
|
6024
5970
|
* Converts a color from CSS hex format to CSS rgb format.
|
|
6025
5971
|
* @param {string} color - Hex color, i.e. #nnn or #nnnnnn
|
|
6026
5972
|
* @returns {string} A CSS rgb color string
|
|
6027
5973
|
*/
|
|
6028
|
-
|
|
6029
|
-
|
|
6030
5974
|
function hexToRgb(color) {
|
|
6031
5975
|
color = color.slice(1);
|
|
6032
5976
|
const re = new RegExp(`.{1,${color.length >= 6 ? 2 : 1}}`, 'g');
|
|
6033
5977
|
let colors = color.match(re);
|
|
6034
|
-
|
|
6035
5978
|
if (colors && colors[0].length === 1) {
|
|
6036
5979
|
colors = colors.map(n => n + n);
|
|
6037
5980
|
}
|
|
6038
|
-
|
|
6039
5981
|
return colors ? `rgb${colors.length === 4 ? 'a' : ''}(${colors.map((n, index) => {
|
|
6040
5982
|
return index < 3 ? parseInt(n, 16) : Math.round(parseInt(n, 16) / 255 * 1000) / 1000;
|
|
6041
5983
|
}).join(', ')})` : '';
|
|
6042
5984
|
}
|
|
5985
|
+
|
|
6043
5986
|
/**
|
|
6044
5987
|
* Returns an object with the type and values of a color.
|
|
6045
5988
|
*
|
|
@@ -6047,43 +5990,33 @@ function hexToRgb(color) {
|
|
|
6047
5990
|
* @param {string} color - CSS color, i.e. one of: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla(), color()
|
|
6048
5991
|
* @returns {object} - A MUI color object: {type: string, values: number[]}
|
|
6049
5992
|
*/
|
|
6050
|
-
|
|
6051
|
-
|
|
6052
5993
|
function decomposeColor(color) {
|
|
6053
5994
|
// Idempotent
|
|
6054
5995
|
if (color.type) {
|
|
6055
5996
|
return color;
|
|
6056
5997
|
}
|
|
6057
|
-
|
|
6058
5998
|
if (color.charAt(0) === '#') {
|
|
6059
5999
|
return decomposeColor(hexToRgb(color));
|
|
6060
6000
|
}
|
|
6061
|
-
|
|
6062
6001
|
const marker = color.indexOf('(');
|
|
6063
6002
|
const type = color.substring(0, marker);
|
|
6064
|
-
|
|
6065
6003
|
if (['rgb', 'rgba', 'hsl', 'hsla', 'color'].indexOf(type) === -1) {
|
|
6066
6004
|
throw new Error(formatMuiErrorMessage(9, color));
|
|
6067
6005
|
}
|
|
6068
|
-
|
|
6069
6006
|
let values = color.substring(marker + 1, color.length - 1);
|
|
6070
6007
|
let colorSpace;
|
|
6071
|
-
|
|
6072
6008
|
if (type === 'color') {
|
|
6073
6009
|
values = values.split(' ');
|
|
6074
6010
|
colorSpace = values.shift();
|
|
6075
|
-
|
|
6076
6011
|
if (values.length === 4 && values[3].charAt(0) === '/') {
|
|
6077
6012
|
values[3] = values[3].slice(1);
|
|
6078
6013
|
}
|
|
6079
|
-
|
|
6080
6014
|
if (['srgb', 'display-p3', 'a98-rgb', 'prophoto-rgb', 'rec-2020'].indexOf(colorSpace) === -1) {
|
|
6081
6015
|
throw new Error(formatMuiErrorMessage(10, colorSpace));
|
|
6082
6016
|
}
|
|
6083
6017
|
} else {
|
|
6084
6018
|
values = values.split(',');
|
|
6085
6019
|
}
|
|
6086
|
-
|
|
6087
6020
|
values = values.map(value => parseFloat(value));
|
|
6088
6021
|
return {
|
|
6089
6022
|
type,
|
|
@@ -6091,6 +6024,7 @@ function decomposeColor(color) {
|
|
|
6091
6024
|
colorSpace
|
|
6092
6025
|
};
|
|
6093
6026
|
}
|
|
6027
|
+
|
|
6094
6028
|
/**
|
|
6095
6029
|
* Converts a color object with type and values to a string.
|
|
6096
6030
|
* @param {object} color - Decomposed color
|
|
@@ -6098,7 +6032,6 @@ function decomposeColor(color) {
|
|
|
6098
6032
|
* @param {array} color.values - [n,n,n] or [n,n,n,n]
|
|
6099
6033
|
* @returns {string} A CSS color string
|
|
6100
6034
|
*/
|
|
6101
|
-
|
|
6102
6035
|
function recomposeColor(color) {
|
|
6103
6036
|
const {
|
|
6104
6037
|
type,
|
|
@@ -6107,7 +6040,6 @@ function recomposeColor(color) {
|
|
|
6107
6040
|
let {
|
|
6108
6041
|
values
|
|
6109
6042
|
} = color;
|
|
6110
|
-
|
|
6111
6043
|
if (type.indexOf('rgb') !== -1) {
|
|
6112
6044
|
// Only convert the first 3 values to int (i.e. not alpha)
|
|
6113
6045
|
values = values.map((n, i) => i < 3 ? parseInt(n, 10) : n);
|
|
@@ -6115,21 +6047,19 @@ function recomposeColor(color) {
|
|
|
6115
6047
|
values[1] = `${values[1]}%`;
|
|
6116
6048
|
values[2] = `${values[2]}%`;
|
|
6117
6049
|
}
|
|
6118
|
-
|
|
6119
6050
|
if (type.indexOf('color') !== -1) {
|
|
6120
6051
|
values = `${colorSpace} ${values.join(' ')}`;
|
|
6121
6052
|
} else {
|
|
6122
6053
|
values = `${values.join(', ')}`;
|
|
6123
6054
|
}
|
|
6124
|
-
|
|
6125
6055
|
return `${type}(${values})`;
|
|
6126
6056
|
}
|
|
6057
|
+
|
|
6127
6058
|
/**
|
|
6128
6059
|
* Converts a color from hsl format to rgb format.
|
|
6129
6060
|
* @param {string} color - HSL color values
|
|
6130
6061
|
* @returns {string} rgb color values
|
|
6131
6062
|
*/
|
|
6132
|
-
|
|
6133
6063
|
function hslToRgb(color) {
|
|
6134
6064
|
color = decomposeColor(color);
|
|
6135
6065
|
const {
|
|
@@ -6139,17 +6069,13 @@ function hslToRgb(color) {
|
|
|
6139
6069
|
const s = values[1] / 100;
|
|
6140
6070
|
const l = values[2] / 100;
|
|
6141
6071
|
const a = s * Math.min(l, 1 - l);
|
|
6142
|
-
|
|
6143
6072
|
const f = (n, k = (n + h / 30) % 12) => l - a * Math.max(Math.min(k - 3, 9 - k, 1), -1);
|
|
6144
|
-
|
|
6145
6073
|
let type = 'rgb';
|
|
6146
6074
|
const rgb = [Math.round(f(0) * 255), Math.round(f(8) * 255), Math.round(f(4) * 255)];
|
|
6147
|
-
|
|
6148
6075
|
if (color.type === 'hsla') {
|
|
6149
6076
|
type += 'a';
|
|
6150
6077
|
rgb.push(values[3]);
|
|
6151
6078
|
}
|
|
6152
|
-
|
|
6153
6079
|
return recomposeColor({
|
|
6154
6080
|
type,
|
|
6155
6081
|
values: rgb
|
|
@@ -6163,7 +6089,6 @@ function hslToRgb(color) {
|
|
|
6163
6089
|
* @param {string} color - CSS color, i.e. one of: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla(), color()
|
|
6164
6090
|
* @returns {number} The relative brightness of the color in the range 0 - 1
|
|
6165
6091
|
*/
|
|
6166
|
-
|
|
6167
6092
|
function getLuminance(color) {
|
|
6168
6093
|
color = decomposeColor(color);
|
|
6169
6094
|
let rgb = color.type === 'hsl' || color.type === 'hsla' ? decomposeColor(hslToRgb(color)).values : color.values;
|
|
@@ -6173,10 +6098,12 @@ function getLuminance(color) {
|
|
|
6173
6098
|
}
|
|
6174
6099
|
|
|
6175
6100
|
return val <= 0.03928 ? val / 12.92 : ((val + 0.055) / 1.055) ** 2.4;
|
|
6176
|
-
});
|
|
6101
|
+
});
|
|
6177
6102
|
|
|
6103
|
+
// Truncate at 3 digits
|
|
6178
6104
|
return Number((0.2126 * rgb[0] + 0.7152 * rgb[1] + 0.0722 * rgb[2]).toFixed(3));
|
|
6179
6105
|
}
|
|
6106
|
+
|
|
6180
6107
|
/**
|
|
6181
6108
|
* Calculates the contrast ratio between two colors.
|
|
6182
6109
|
*
|
|
@@ -6185,23 +6112,21 @@ function getLuminance(color) {
|
|
|
6185
6112
|
* @param {string} background - CSS color, i.e. one of: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla()
|
|
6186
6113
|
* @returns {number} A contrast ratio value in the range 0 - 21.
|
|
6187
6114
|
*/
|
|
6188
|
-
|
|
6189
6115
|
function getContrastRatio(foreground, background) {
|
|
6190
6116
|
const lumA = getLuminance(foreground);
|
|
6191
6117
|
const lumB = getLuminance(background);
|
|
6192
6118
|
return (Math.max(lumA, lumB) + 0.05) / (Math.min(lumA, lumB) + 0.05);
|
|
6193
6119
|
}
|
|
6120
|
+
|
|
6194
6121
|
/**
|
|
6195
6122
|
* Darkens a color.
|
|
6196
6123
|
* @param {string} color - CSS color, i.e. one of: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla(), color()
|
|
6197
6124
|
* @param {number} coefficient - multiplier in the range 0 - 1
|
|
6198
6125
|
* @returns {string} A CSS color string. Hex input values are returned as rgb
|
|
6199
6126
|
*/
|
|
6200
|
-
|
|
6201
6127
|
function darken(color, coefficient) {
|
|
6202
6128
|
color = decomposeColor(color);
|
|
6203
6129
|
coefficient = clamp(coefficient);
|
|
6204
|
-
|
|
6205
6130
|
if (color.type.indexOf('hsl') !== -1) {
|
|
6206
6131
|
color.values[2] *= 1 - coefficient;
|
|
6207
6132
|
} else if (color.type.indexOf('rgb') !== -1 || color.type.indexOf('color') !== -1) {
|
|
@@ -6209,20 +6134,18 @@ function darken(color, coefficient) {
|
|
|
6209
6134
|
color.values[i] *= 1 - coefficient;
|
|
6210
6135
|
}
|
|
6211
6136
|
}
|
|
6212
|
-
|
|
6213
6137
|
return recomposeColor(color);
|
|
6214
6138
|
}
|
|
6139
|
+
|
|
6215
6140
|
/**
|
|
6216
6141
|
* Lightens a color.
|
|
6217
6142
|
* @param {string} color - CSS color, i.e. one of: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla(), color()
|
|
6218
6143
|
* @param {number} coefficient - multiplier in the range 0 - 1
|
|
6219
6144
|
* @returns {string} A CSS color string. Hex input values are returned as rgb
|
|
6220
6145
|
*/
|
|
6221
|
-
|
|
6222
6146
|
function lighten(color, coefficient) {
|
|
6223
6147
|
color = decomposeColor(color);
|
|
6224
6148
|
coefficient = clamp(coefficient);
|
|
6225
|
-
|
|
6226
6149
|
if (color.type.indexOf('hsl') !== -1) {
|
|
6227
6150
|
color.values[2] += (100 - color.values[2]) * coefficient;
|
|
6228
6151
|
} else if (color.type.indexOf('rgb') !== -1) {
|
|
@@ -6234,12 +6157,10 @@ function lighten(color, coefficient) {
|
|
|
6234
6157
|
color.values[i] += (1 - color.values[i]) * coefficient;
|
|
6235
6158
|
}
|
|
6236
6159
|
}
|
|
6237
|
-
|
|
6238
6160
|
return recomposeColor(color);
|
|
6239
6161
|
}
|
|
6240
6162
|
|
|
6241
6163
|
const EMPTY_THEME = {};
|
|
6242
|
-
|
|
6243
6164
|
function InnerThemeProvider(props) {
|
|
6244
6165
|
const theme = useTheme$2();
|
|
6245
6166
|
return /*#__PURE__*/jsxRuntime.exports.jsx(ThemeContext$2.Provider, {
|
|
@@ -6247,11 +6168,11 @@ function InnerThemeProvider(props) {
|
|
|
6247
6168
|
children: props.children
|
|
6248
6169
|
});
|
|
6249
6170
|
}
|
|
6171
|
+
|
|
6250
6172
|
/**
|
|
6251
6173
|
* This component makes the `theme` available down the React tree.
|
|
6252
6174
|
* It should preferably be used at **the root of your component tree**.
|
|
6253
6175
|
*/
|
|
6254
|
-
|
|
6255
6176
|
function ThemeProvider(props) {
|
|
6256
6177
|
const {
|
|
6257
6178
|
children,
|
|
@@ -6266,24 +6187,22 @@ function ThemeProvider(props) {
|
|
|
6266
6187
|
}
|
|
6267
6188
|
|
|
6268
6189
|
const _excluded$7 = ["defaultProps", "mixins", "overrides", "palette", "props", "styleOverrides"],
|
|
6269
|
-
|
|
6190
|
+
_excluded2$1 = ["type", "mode"];
|
|
6270
6191
|
function adaptV4Theme(inputTheme) {
|
|
6271
|
-
|
|
6272
6192
|
const {
|
|
6273
|
-
|
|
6274
|
-
|
|
6275
|
-
|
|
6276
|
-
|
|
6277
|
-
|
|
6278
|
-
|
|
6279
|
-
|
|
6280
|
-
|
|
6281
|
-
|
|
6193
|
+
defaultProps = {},
|
|
6194
|
+
mixins = {},
|
|
6195
|
+
overrides = {},
|
|
6196
|
+
palette = {},
|
|
6197
|
+
props = {},
|
|
6198
|
+
styleOverrides = {}
|
|
6199
|
+
} = inputTheme,
|
|
6200
|
+
other = _objectWithoutPropertiesLoose$1(inputTheme, _excluded$7);
|
|
6282
6201
|
const theme = _extends$5({}, other, {
|
|
6283
6202
|
components: {}
|
|
6284
|
-
});
|
|
6285
|
-
|
|
6203
|
+
});
|
|
6286
6204
|
|
|
6205
|
+
// default props
|
|
6287
6206
|
Object.keys(defaultProps).forEach(component => {
|
|
6288
6207
|
const componentValue = theme.components[component] || {};
|
|
6289
6208
|
componentValue.defaultProps = defaultProps[component];
|
|
@@ -6293,8 +6212,9 @@ function adaptV4Theme(inputTheme) {
|
|
|
6293
6212
|
const componentValue = theme.components[component] || {};
|
|
6294
6213
|
componentValue.defaultProps = props[component];
|
|
6295
6214
|
theme.components[component] = componentValue;
|
|
6296
|
-
});
|
|
6215
|
+
});
|
|
6297
6216
|
|
|
6217
|
+
// CSS overrides
|
|
6298
6218
|
Object.keys(styleOverrides).forEach(component => {
|
|
6299
6219
|
const componentValue = theme.components[component] || {};
|
|
6300
6220
|
componentValue.styleOverrides = styleOverrides[component];
|
|
@@ -6304,10 +6224,12 @@ function adaptV4Theme(inputTheme) {
|
|
|
6304
6224
|
const componentValue = theme.components[component] || {};
|
|
6305
6225
|
componentValue.styleOverrides = overrides[component];
|
|
6306
6226
|
theme.components[component] = componentValue;
|
|
6307
|
-
});
|
|
6227
|
+
});
|
|
6308
6228
|
|
|
6309
|
-
|
|
6229
|
+
// theme.spacing
|
|
6230
|
+
theme.spacing = createSpacing(inputTheme.spacing);
|
|
6310
6231
|
|
|
6232
|
+
// theme.mixins.gutters
|
|
6311
6233
|
const breakpoints = createBreakpoints(inputTheme.breakpoints || {});
|
|
6312
6234
|
const spacing = theme.spacing;
|
|
6313
6235
|
theme.mixins = _extends$5({
|
|
@@ -6323,13 +6245,11 @@ function adaptV4Theme(inputTheme) {
|
|
|
6323
6245
|
});
|
|
6324
6246
|
}
|
|
6325
6247
|
}, mixins);
|
|
6326
|
-
|
|
6327
6248
|
const {
|
|
6328
|
-
|
|
6329
|
-
|
|
6330
|
-
|
|
6331
|
-
|
|
6332
|
-
|
|
6249
|
+
type: typeInput,
|
|
6250
|
+
mode: modeInput
|
|
6251
|
+
} = palette,
|
|
6252
|
+
paletteRest = _objectWithoutPropertiesLoose$1(palette, _excluded2$1);
|
|
6333
6253
|
const finalMode = modeInput || typeInput || 'light';
|
|
6334
6254
|
theme.palette = _extends$5({
|
|
6335
6255
|
// theme.palette.text.hint
|
|
@@ -6555,11 +6475,9 @@ const dark$1 = {
|
|
|
6555
6475
|
activatedOpacity: 0.24
|
|
6556
6476
|
}
|
|
6557
6477
|
};
|
|
6558
|
-
|
|
6559
6478
|
function addLightOrDark(intent, direction, shade, tonalOffset) {
|
|
6560
6479
|
const tonalOffsetLight = tonalOffset.light || tonalOffset;
|
|
6561
6480
|
const tonalOffsetDark = tonalOffset.dark || tonalOffset * 1.5;
|
|
6562
|
-
|
|
6563
6481
|
if (!intent[direction]) {
|
|
6564
6482
|
if (intent.hasOwnProperty(shade)) {
|
|
6565
6483
|
intent[direction] = intent[shade];
|
|
@@ -6570,7 +6488,6 @@ function addLightOrDark(intent, direction, shade, tonalOffset) {
|
|
|
6570
6488
|
}
|
|
6571
6489
|
}
|
|
6572
6490
|
}
|
|
6573
|
-
|
|
6574
6491
|
function getDefaultPrimary(mode = 'light') {
|
|
6575
6492
|
if (mode === 'dark') {
|
|
6576
6493
|
return {
|
|
@@ -6579,14 +6496,12 @@ function getDefaultPrimary(mode = 'light') {
|
|
|
6579
6496
|
dark: blue$1[400]
|
|
6580
6497
|
};
|
|
6581
6498
|
}
|
|
6582
|
-
|
|
6583
6499
|
return {
|
|
6584
6500
|
main: blue$1[700],
|
|
6585
6501
|
light: blue$1[400],
|
|
6586
6502
|
dark: blue$1[800]
|
|
6587
6503
|
};
|
|
6588
6504
|
}
|
|
6589
|
-
|
|
6590
6505
|
function getDefaultSecondary(mode = 'light') {
|
|
6591
6506
|
if (mode === 'dark') {
|
|
6592
6507
|
return {
|
|
@@ -6595,14 +6510,12 @@ function getDefaultSecondary(mode = 'light') {
|
|
|
6595
6510
|
dark: purple$1[400]
|
|
6596
6511
|
};
|
|
6597
6512
|
}
|
|
6598
|
-
|
|
6599
6513
|
return {
|
|
6600
6514
|
main: purple$1[500],
|
|
6601
6515
|
light: purple$1[300],
|
|
6602
6516
|
dark: purple$1[700]
|
|
6603
6517
|
};
|
|
6604
6518
|
}
|
|
6605
|
-
|
|
6606
6519
|
function getDefaultError(mode = 'light') {
|
|
6607
6520
|
if (mode === 'dark') {
|
|
6608
6521
|
return {
|
|
@@ -6611,14 +6524,12 @@ function getDefaultError(mode = 'light') {
|
|
|
6611
6524
|
dark: red$1[700]
|
|
6612
6525
|
};
|
|
6613
6526
|
}
|
|
6614
|
-
|
|
6615
6527
|
return {
|
|
6616
6528
|
main: red$1[700],
|
|
6617
6529
|
light: red$1[400],
|
|
6618
6530
|
dark: red$1[800]
|
|
6619
6531
|
};
|
|
6620
6532
|
}
|
|
6621
|
-
|
|
6622
6533
|
function getDefaultInfo(mode = 'light') {
|
|
6623
6534
|
if (mode === 'dark') {
|
|
6624
6535
|
return {
|
|
@@ -6627,14 +6538,12 @@ function getDefaultInfo(mode = 'light') {
|
|
|
6627
6538
|
dark: lightBlue$1[700]
|
|
6628
6539
|
};
|
|
6629
6540
|
}
|
|
6630
|
-
|
|
6631
6541
|
return {
|
|
6632
6542
|
main: lightBlue$1[700],
|
|
6633
6543
|
light: lightBlue$1[500],
|
|
6634
6544
|
dark: lightBlue$1[900]
|
|
6635
6545
|
};
|
|
6636
6546
|
}
|
|
6637
|
-
|
|
6638
6547
|
function getDefaultSuccess(mode = 'light') {
|
|
6639
6548
|
if (mode === 'dark') {
|
|
6640
6549
|
return {
|
|
@@ -6643,14 +6552,12 @@ function getDefaultSuccess(mode = 'light') {
|
|
|
6643
6552
|
dark: green$1[700]
|
|
6644
6553
|
};
|
|
6645
6554
|
}
|
|
6646
|
-
|
|
6647
6555
|
return {
|
|
6648
6556
|
main: green$1[800],
|
|
6649
6557
|
light: green$1[500],
|
|
6650
6558
|
dark: green$1[900]
|
|
6651
6559
|
};
|
|
6652
6560
|
}
|
|
6653
|
-
|
|
6654
6561
|
function getDefaultWarning(mode = 'light') {
|
|
6655
6562
|
if (mode === 'dark') {
|
|
6656
6563
|
return {
|
|
@@ -6659,7 +6566,6 @@ function getDefaultWarning(mode = 'light') {
|
|
|
6659
6566
|
dark: orange$1[700]
|
|
6660
6567
|
};
|
|
6661
6568
|
}
|
|
6662
|
-
|
|
6663
6569
|
return {
|
|
6664
6570
|
main: '#ed6c02',
|
|
6665
6571
|
// closest to orange[800] that pass 3:1.
|
|
@@ -6667,30 +6573,27 @@ function getDefaultWarning(mode = 'light') {
|
|
|
6667
6573
|
dark: orange$1[900]
|
|
6668
6574
|
};
|
|
6669
6575
|
}
|
|
6670
|
-
|
|
6671
6576
|
function createPalette(palette) {
|
|
6672
6577
|
const {
|
|
6673
|
-
|
|
6674
|
-
|
|
6675
|
-
|
|
6676
|
-
|
|
6677
|
-
|
|
6678
|
-
|
|
6578
|
+
mode = 'light',
|
|
6579
|
+
contrastThreshold = 3,
|
|
6580
|
+
tonalOffset = 0.2
|
|
6581
|
+
} = palette,
|
|
6582
|
+
other = _objectWithoutPropertiesLoose$1(palette, _excluded$6);
|
|
6679
6583
|
const primary = palette.primary || getDefaultPrimary(mode);
|
|
6680
6584
|
const secondary = palette.secondary || getDefaultSecondary(mode);
|
|
6681
6585
|
const error = palette.error || getDefaultError(mode);
|
|
6682
6586
|
const info = palette.info || getDefaultInfo(mode);
|
|
6683
6587
|
const success = palette.success || getDefaultSuccess(mode);
|
|
6684
|
-
const warning = palette.warning || getDefaultWarning(mode);
|
|
6588
|
+
const warning = palette.warning || getDefaultWarning(mode);
|
|
6589
|
+
|
|
6590
|
+
// Use the same logic as
|
|
6685
6591
|
// Bootstrap: https://github.com/twbs/bootstrap/blob/1d6e3710dd447de1a200f29e8fa521f8a0908f70/scss/_functions.scss#L59
|
|
6686
6592
|
// and material-components-web https://github.com/material-components/material-components-web/blob/ac46b8863c4dab9fc22c4c662dc6bd1b65dd652f/packages/mdc-theme/_functions.scss#L54
|
|
6687
|
-
|
|
6688
6593
|
function getContrastText(background) {
|
|
6689
6594
|
const contrastText = getContrastRatio(background, dark$1.text.primary) >= contrastThreshold ? dark$1.text.primary : light$1.text.primary;
|
|
6690
|
-
|
|
6691
6595
|
return contrastText;
|
|
6692
6596
|
}
|
|
6693
|
-
|
|
6694
6597
|
const augmentColor = ({
|
|
6695
6598
|
color,
|
|
6696
6599
|
name,
|
|
@@ -6699,34 +6602,26 @@ function createPalette(palette) {
|
|
|
6699
6602
|
darkShade = 700
|
|
6700
6603
|
}) => {
|
|
6701
6604
|
color = _extends$5({}, color);
|
|
6702
|
-
|
|
6703
6605
|
if (!color.main && color[mainShade]) {
|
|
6704
6606
|
color.main = color[mainShade];
|
|
6705
6607
|
}
|
|
6706
|
-
|
|
6707
6608
|
if (!color.hasOwnProperty('main')) {
|
|
6708
6609
|
throw new Error(formatMuiErrorMessage(11, name ? ` (${name})` : '', mainShade));
|
|
6709
6610
|
}
|
|
6710
|
-
|
|
6711
6611
|
if (typeof color.main !== 'string') {
|
|
6712
6612
|
throw new Error(formatMuiErrorMessage(12, name ? ` (${name})` : '', JSON.stringify(color.main)));
|
|
6713
6613
|
}
|
|
6714
|
-
|
|
6715
6614
|
addLightOrDark(color, 'light', lightShade, tonalOffset);
|
|
6716
6615
|
addLightOrDark(color, 'dark', darkShade, tonalOffset);
|
|
6717
|
-
|
|
6718
6616
|
if (!color.contrastText) {
|
|
6719
6617
|
color.contrastText = getContrastText(color.main);
|
|
6720
6618
|
}
|
|
6721
|
-
|
|
6722
6619
|
return color;
|
|
6723
6620
|
};
|
|
6724
|
-
|
|
6725
6621
|
const modes = {
|
|
6726
6622
|
dark: dark$1,
|
|
6727
6623
|
light: light$1
|
|
6728
6624
|
};
|
|
6729
|
-
|
|
6730
6625
|
const paletteOutput = deepmerge(_extends$5({
|
|
6731
6626
|
// A collection of common colors.
|
|
6732
6627
|
common: _extends$5({}, common$1),
|
|
@@ -6784,44 +6679,39 @@ function createPalette(palette) {
|
|
|
6784
6679
|
}
|
|
6785
6680
|
|
|
6786
6681
|
const _excluded$5 = ["fontFamily", "fontSize", "fontWeightLight", "fontWeightRegular", "fontWeightMedium", "fontWeightBold", "htmlFontSize", "allVariants", "pxToRem"];
|
|
6787
|
-
|
|
6788
6682
|
function round(value) {
|
|
6789
6683
|
return Math.round(value * 1e5) / 1e5;
|
|
6790
6684
|
}
|
|
6791
|
-
|
|
6792
6685
|
const caseAllCaps = {
|
|
6793
6686
|
textTransform: 'uppercase'
|
|
6794
6687
|
};
|
|
6795
6688
|
const defaultFontFamily = '"Roboto", "Helvetica", "Arial", sans-serif';
|
|
6689
|
+
|
|
6796
6690
|
/**
|
|
6797
6691
|
* @see @link{https://m2.material.io/design/typography/the-type-system.html}
|
|
6798
6692
|
* @see @link{https://m2.material.io/design/typography/understanding-typography.html}
|
|
6799
6693
|
*/
|
|
6800
|
-
|
|
6801
6694
|
function createTypography(palette, typography) {
|
|
6802
6695
|
const _ref = typeof typography === 'function' ? typography(palette) : typography,
|
|
6803
|
-
|
|
6804
|
-
|
|
6805
|
-
|
|
6806
|
-
|
|
6807
|
-
|
|
6808
|
-
|
|
6809
|
-
|
|
6810
|
-
|
|
6811
|
-
|
|
6812
|
-
|
|
6813
|
-
|
|
6814
|
-
|
|
6815
|
-
|
|
6816
|
-
|
|
6817
|
-
|
|
6818
|
-
|
|
6819
|
-
|
|
6820
|
-
|
|
6696
|
+
{
|
|
6697
|
+
fontFamily = defaultFontFamily,
|
|
6698
|
+
// The default font size of the Material Specification.
|
|
6699
|
+
fontSize = 14,
|
|
6700
|
+
// px
|
|
6701
|
+
fontWeightLight = 300,
|
|
6702
|
+
fontWeightRegular = 400,
|
|
6703
|
+
fontWeightMedium = 500,
|
|
6704
|
+
fontWeightBold = 700,
|
|
6705
|
+
// Tell MUI what's the font-size on the html element.
|
|
6706
|
+
// 16px is the default font-size used by browsers.
|
|
6707
|
+
htmlFontSize = 16,
|
|
6708
|
+
// Apply the CSS properties to all the variants.
|
|
6709
|
+
allVariants,
|
|
6710
|
+
pxToRem: pxToRem2
|
|
6711
|
+
} = _ref,
|
|
6712
|
+
other = _objectWithoutPropertiesLoose$1(_ref, _excluded$5);
|
|
6821
6713
|
const coef = fontSize / 14;
|
|
6822
|
-
|
|
6823
6714
|
const pxToRem = pxToRem2 || (size => `${size / htmlFontSize * coef}rem`);
|
|
6824
|
-
|
|
6825
6715
|
const buildVariant = (fontWeight, size, lineHeight, letterSpacing, casing) => _extends$5({
|
|
6826
6716
|
fontFamily,
|
|
6827
6717
|
fontWeight,
|
|
@@ -6831,7 +6721,6 @@ function createTypography(palette, typography) {
|
|
|
6831
6721
|
}, fontFamily === defaultFontFamily ? {
|
|
6832
6722
|
letterSpacing: `${round(letterSpacing / size)}em`
|
|
6833
6723
|
} : {}, casing, allVariants);
|
|
6834
|
-
|
|
6835
6724
|
const variants = {
|
|
6836
6725
|
h1: buildVariant(fontWeightLight, 96, 1.167, -1.5),
|
|
6837
6726
|
h2: buildVariant(fontWeightLight, 60, 1.2, -0.5),
|
|
@@ -6858,19 +6747,17 @@ function createTypography(palette, typography) {
|
|
|
6858
6747
|
fontWeightBold
|
|
6859
6748
|
}, variants), other, {
|
|
6860
6749
|
clone: false // No need to clone deep
|
|
6861
|
-
|
|
6862
6750
|
});
|
|
6863
6751
|
}
|
|
6864
6752
|
|
|
6865
6753
|
const shadowKeyUmbraOpacity = 0.2;
|
|
6866
6754
|
const shadowKeyPenumbraOpacity = 0.14;
|
|
6867
6755
|
const shadowAmbientShadowOpacity = 0.12;
|
|
6868
|
-
|
|
6869
6756
|
function createShadow(...px) {
|
|
6870
6757
|
return [`${px[0]}px ${px[1]}px ${px[2]}px ${px[3]}px rgba(0,0,0,${shadowKeyUmbraOpacity})`, `${px[4]}px ${px[5]}px ${px[6]}px ${px[7]}px rgba(0,0,0,${shadowKeyPenumbraOpacity})`, `${px[8]}px ${px[9]}px ${px[10]}px ${px[11]}px rgba(0,0,0,${shadowAmbientShadowOpacity})`].join(',');
|
|
6871
|
-
}
|
|
6872
|
-
|
|
6758
|
+
}
|
|
6873
6759
|
|
|
6760
|
+
// Values from https://github.com/material-components/material-components-web/blob/be8747f94574669cb5e7add1a7c54fa41a89cec7/packages/mdc-elevation/_variables.scss
|
|
6874
6761
|
const shadows = ['none', createShadow(0, 2, 1, -1, 0, 1, 1, 0, 0, 1, 3, 0), createShadow(0, 3, 1, -2, 0, 2, 2, 0, 0, 1, 5, 0), createShadow(0, 3, 3, -2, 0, 3, 4, 0, 0, 1, 8, 0), createShadow(0, 2, 4, -1, 0, 4, 5, 0, 0, 1, 10, 0), createShadow(0, 3, 5, -1, 0, 5, 8, 0, 0, 1, 14, 0), createShadow(0, 3, 5, -1, 0, 6, 10, 0, 0, 1, 18, 0), createShadow(0, 4, 5, -2, 0, 7, 10, 1, 0, 2, 16, 1), createShadow(0, 5, 5, -3, 0, 8, 10, 1, 0, 3, 14, 2), createShadow(0, 5, 6, -3, 0, 9, 12, 1, 0, 3, 16, 2), createShadow(0, 6, 6, -3, 0, 10, 14, 1, 0, 4, 18, 3), createShadow(0, 6, 7, -4, 0, 11, 15, 1, 0, 4, 20, 3), createShadow(0, 7, 8, -4, 0, 12, 17, 2, 0, 5, 22, 4), createShadow(0, 7, 8, -4, 0, 13, 19, 2, 0, 5, 24, 4), createShadow(0, 7, 9, -4, 0, 14, 21, 2, 0, 5, 26, 4), createShadow(0, 8, 9, -5, 0, 15, 22, 2, 0, 6, 28, 5), createShadow(0, 8, 10, -5, 0, 16, 24, 2, 0, 6, 30, 5), createShadow(0, 8, 11, -5, 0, 17, 26, 2, 0, 6, 32, 5), createShadow(0, 9, 11, -5, 0, 18, 28, 2, 0, 7, 34, 6), createShadow(0, 9, 12, -6, 0, 19, 29, 2, 0, 7, 36, 6), createShadow(0, 10, 13, -6, 0, 20, 31, 3, 0, 8, 38, 7), createShadow(0, 10, 13, -6, 0, 21, 33, 3, 0, 8, 40, 7), createShadow(0, 10, 14, -6, 0, 22, 35, 3, 0, 8, 42, 7), createShadow(0, 11, 14, -7, 0, 23, 36, 3, 0, 9, 44, 8), createShadow(0, 11, 15, -7, 0, 24, 38, 3, 0, 9, 46, 8)];
|
|
6875
6762
|
var shadows$1 = shadows;
|
|
6876
6763
|
|
|
@@ -6887,9 +6774,10 @@ const easing = {
|
|
|
6887
6774
|
easeIn: 'cubic-bezier(0.4, 0, 1, 1)',
|
|
6888
6775
|
// The sharp curve is used by objects that may return to the screen at any time.
|
|
6889
6776
|
sharp: 'cubic-bezier(0.4, 0, 0.6, 1)'
|
|
6890
|
-
};
|
|
6891
|
-
// to learn when use what timing
|
|
6777
|
+
};
|
|
6892
6778
|
|
|
6779
|
+
// Follow https://m2.material.io/guidelines/motion/duration-easing.html#duration-easing-common-durations
|
|
6780
|
+
// to learn when use what timing
|
|
6893
6781
|
const duration = {
|
|
6894
6782
|
shortest: 150,
|
|
6895
6783
|
shorter: 200,
|
|
@@ -6903,37 +6791,30 @@ const duration = {
|
|
|
6903
6791
|
// recommended when something is leaving screen
|
|
6904
6792
|
leavingScreen: 195
|
|
6905
6793
|
};
|
|
6906
|
-
|
|
6907
6794
|
function formatMs(milliseconds) {
|
|
6908
6795
|
return `${Math.round(milliseconds)}ms`;
|
|
6909
6796
|
}
|
|
6910
|
-
|
|
6911
6797
|
function getAutoHeightDuration(height) {
|
|
6912
6798
|
if (!height) {
|
|
6913
6799
|
return 0;
|
|
6914
6800
|
}
|
|
6801
|
+
const constant = height / 36;
|
|
6915
6802
|
|
|
6916
|
-
|
|
6917
|
-
|
|
6803
|
+
// https://www.wolframalpha.com/input/?i=(4+%2B+15+*+(x+%2F+36+)+**+0.25+%2B+(x+%2F+36)+%2F+5)+*+10
|
|
6918
6804
|
return Math.round((4 + 15 * constant ** 0.25 + constant / 5) * 10);
|
|
6919
6805
|
}
|
|
6920
|
-
|
|
6921
6806
|
function createTransitions(inputTransitions) {
|
|
6922
6807
|
const mergedEasing = _extends$5({}, easing, inputTransitions.easing);
|
|
6923
|
-
|
|
6924
6808
|
const mergedDuration = _extends$5({}, duration, inputTransitions.duration);
|
|
6925
|
-
|
|
6926
6809
|
const create = (props = ['all'], options = {}) => {
|
|
6927
6810
|
const {
|
|
6928
|
-
|
|
6929
|
-
|
|
6930
|
-
|
|
6931
|
-
|
|
6932
|
-
|
|
6933
|
-
|
|
6811
|
+
duration: durationOption = mergedDuration.standard,
|
|
6812
|
+
easing: easingOption = mergedEasing.easeInOut,
|
|
6813
|
+
delay = 0
|
|
6814
|
+
} = options;
|
|
6815
|
+
_objectWithoutPropertiesLoose$1(options, _excluded$4);
|
|
6934
6816
|
return (Array.isArray(props) ? props : [props]).map(animatedProp => `${animatedProp} ${typeof durationOption === 'string' ? durationOption : formatMs(durationOption)} ${easingOption} ${typeof delay === 'string' ? delay : formatMs(delay)}`).join(',');
|
|
6935
6817
|
};
|
|
6936
|
-
|
|
6937
6818
|
return _extends$5({
|
|
6938
6819
|
getAutoHeightDuration,
|
|
6939
6820
|
create
|
|
@@ -6958,20 +6839,17 @@ const zIndex = {
|
|
|
6958
6839
|
var zIndex$1 = zIndex;
|
|
6959
6840
|
|
|
6960
6841
|
const _excluded$3 = ["breakpoints", "mixins", "spacing", "palette", "transitions", "typography", "shape"];
|
|
6961
|
-
|
|
6962
6842
|
function createTheme(options = {}, ...args) {
|
|
6963
6843
|
const {
|
|
6964
|
-
|
|
6965
|
-
|
|
6966
|
-
|
|
6967
|
-
|
|
6968
|
-
|
|
6969
|
-
|
|
6970
|
-
|
|
6844
|
+
mixins: mixinsInput = {},
|
|
6845
|
+
palette: paletteInput = {},
|
|
6846
|
+
transitions: transitionsInput = {},
|
|
6847
|
+
typography: typographyInput = {}
|
|
6848
|
+
} = options,
|
|
6849
|
+
other = _objectWithoutPropertiesLoose$1(options, _excluded$3);
|
|
6971
6850
|
if (options.vars) {
|
|
6972
6851
|
throw new Error(formatMuiErrorMessage(18));
|
|
6973
6852
|
}
|
|
6974
|
-
|
|
6975
6853
|
const palette = createPalette(paletteInput);
|
|
6976
6854
|
const systemTheme = createTheme$1(options);
|
|
6977
6855
|
let muiTheme = deepmerge(systemTheme, {
|
|
@@ -6985,7 +6863,6 @@ function createTheme(options = {}, ...args) {
|
|
|
6985
6863
|
});
|
|
6986
6864
|
muiTheme = deepmerge(muiTheme, other);
|
|
6987
6865
|
muiTheme = args.reduce((acc, argument) => deepmerge(acc, argument), muiTheme);
|
|
6988
|
-
|
|
6989
6866
|
return muiTheme;
|
|
6990
6867
|
}
|
|
6991
6868
|
|
|
@@ -6994,7 +6871,6 @@ var defaultTheme$1 = defaultTheme;
|
|
|
6994
6871
|
|
|
6995
6872
|
function useTheme$1() {
|
|
6996
6873
|
const theme = useTheme$2(defaultTheme$1);
|
|
6997
|
-
|
|
6998
6874
|
return theme;
|
|
6999
6875
|
}
|
|
7000
6876
|
|
|
@@ -7354,7 +7230,7 @@ function create$3(definition) {
|
|
|
7354
7230
|
return cache[key];
|
|
7355
7231
|
}
|
|
7356
7232
|
|
|
7357
|
-
const NEBULA_VERSION_HASH = "
|
|
7233
|
+
const NEBULA_VERSION_HASH = "d1ab" ;
|
|
7358
7234
|
ClassNameGenerator$1.configure(componentName => {
|
|
7359
7235
|
return "njs-".concat(NEBULA_VERSION_HASH, "-").concat(componentName.replace('Mui', ''));
|
|
7360
7236
|
});
|
|
@@ -7363,7 +7239,8 @@ var InstanceContext = React__default.createContext({
|
|
|
7363
7239
|
language: null,
|
|
7364
7240
|
theme: null,
|
|
7365
7241
|
translator: null,
|
|
7366
|
-
constraints: {}
|
|
7242
|
+
constraints: {},
|
|
7243
|
+
themeApi: null
|
|
7367
7244
|
});
|
|
7368
7245
|
|
|
7369
7246
|
var createKeyStore = (function () {
|
|
@@ -7872,7 +7749,7 @@ function boot(_ref2) {
|
|
|
7872
7749
|
const appRef = React__default.createRef();
|
|
7873
7750
|
const element = document.createElement('div');
|
|
7874
7751
|
element.style.display = 'none';
|
|
7875
|
-
element.setAttribute('data-nebulajs-version', "3.1.0-alpha.
|
|
7752
|
+
element.setAttribute('data-nebulajs-version', "3.1.0-alpha.3" );
|
|
7876
7753
|
element.setAttribute('data-app-id', app.id);
|
|
7877
7754
|
document.body.appendChild(element);
|
|
7878
7755
|
ReactDOM.render( /*#__PURE__*/React__default.createElement(NebulaApp, {
|
|
@@ -7891,6 +7768,9 @@ function boot(_ref2) {
|
|
|
7891
7768
|
addCell(id, cell) {
|
|
7892
7769
|
cells[id] = cell;
|
|
7893
7770
|
},
|
|
7771
|
+
removeCell(id) {
|
|
7772
|
+
delete cells[id];
|
|
7773
|
+
},
|
|
7894
7774
|
add(component) {
|
|
7895
7775
|
(async () => {
|
|
7896
7776
|
await rendered;
|
|
@@ -9662,7 +9542,7 @@ const ellipsis = {
|
|
|
9662
9542
|
const barPadPx = 4;
|
|
9663
9543
|
const barBorderWidthPx = 1;
|
|
9664
9544
|
const barWithCheckboxLeftPadPx = 29;
|
|
9665
|
-
const frequencyTextNone = '
|
|
9545
|
+
const frequencyTextNone = '-';
|
|
9666
9546
|
const getSelectedStyle = _ref => {
|
|
9667
9547
|
let {
|
|
9668
9548
|
theme
|
|
@@ -9680,13 +9560,14 @@ const getSelectedStyle = _ref => {
|
|
|
9680
9560
|
};
|
|
9681
9561
|
};
|
|
9682
9562
|
const Root$1 = styled$1('div')(_ref2 => {
|
|
9563
|
+
var _theme$listBox$conten, _theme$listBox, _theme$listBox$conten2, _theme$listBox$conten3, _theme$listBox2, _theme$listBox2$conte, _theme$listBox3, _theme$listBox3$conte, _theme$listBox4, _theme$listBox4$conte;
|
|
9683
9564
|
let {
|
|
9684
9565
|
theme
|
|
9685
9566
|
} = _ref2;
|
|
9686
9567
|
return {
|
|
9687
9568
|
["& .".concat(classes$a.row)]: {
|
|
9688
9569
|
flexWrap: 'nowrap',
|
|
9689
|
-
color: theme.palette.text.primary
|
|
9570
|
+
color: (_theme$listBox$conten = (_theme$listBox = theme.listBox) === null || _theme$listBox === void 0 ? void 0 : (_theme$listBox$conten2 = _theme$listBox.content) === null || _theme$listBox$conten2 === void 0 ? void 0 : _theme$listBox$conten2.color) !== null && _theme$listBox$conten !== void 0 ? _theme$listBox$conten : theme.palette.text.primary
|
|
9690
9571
|
},
|
|
9691
9572
|
["& .".concat(classes$a.rowBorderBottom)]: {
|
|
9692
9573
|
borderBottom: "1px solid ".concat(theme.palette.divider)
|
|
@@ -9694,7 +9575,7 @@ const Root$1 = styled$1('div')(_ref2 => {
|
|
|
9694
9575
|
["& .".concat(classes$a.column)]: {
|
|
9695
9576
|
flexWrap: 'nowrap',
|
|
9696
9577
|
borderRight: "1px solid ".concat(theme.palette.divider),
|
|
9697
|
-
color: theme.palette.text.primary
|
|
9578
|
+
color: (_theme$listBox$conten3 = (_theme$listBox2 = theme.listBox) === null || _theme$listBox2 === void 0 ? void 0 : (_theme$listBox2$conte = _theme$listBox2.content) === null || _theme$listBox2$conte === void 0 ? void 0 : _theme$listBox2$conte.color) !== null && _theme$listBox$conten3 !== void 0 ? _theme$listBox$conten3 : theme.palette.text.primary
|
|
9698
9579
|
},
|
|
9699
9580
|
["& .".concat(classes$a.fieldRoot)]: {
|
|
9700
9581
|
'&:focus': {
|
|
@@ -9715,12 +9596,15 @@ const Root$1 = styled$1('div')(_ref2 => {
|
|
|
9715
9596
|
paddingRight: '9px'
|
|
9716
9597
|
},
|
|
9717
9598
|
// The leaf node, containing the label text.
|
|
9718
|
-
["& .".concat(classes$a.labelText)]: _objectSpread2({
|
|
9599
|
+
["& .".concat(classes$a.labelText)]: _objectSpread2(_objectSpread2({
|
|
9719
9600
|
flexBasis: 'max-content',
|
|
9720
9601
|
lineHeight: '16px',
|
|
9721
9602
|
userSelect: 'none',
|
|
9722
9603
|
whiteSpace: 'pre'
|
|
9723
|
-
}, ellipsis),
|
|
9604
|
+
}, ellipsis), {}, {
|
|
9605
|
+
fontSize: (_theme$listBox3 = theme.listBox) === null || _theme$listBox3 === void 0 ? void 0 : (_theme$listBox3$conte = _theme$listBox3.content) === null || _theme$listBox3$conte === void 0 ? void 0 : _theme$listBox3$conte.fontSize,
|
|
9606
|
+
fontFamily: (_theme$listBox4 = theme.listBox) === null || _theme$listBox4 === void 0 ? void 0 : (_theme$listBox4$conte = _theme$listBox4.content) === null || _theme$listBox4$conte === void 0 ? void 0 : _theme$listBox4$conte.fontFamily
|
|
9607
|
+
}),
|
|
9724
9608
|
["& .".concat(classes$a.labelDense)]: {
|
|
9725
9609
|
fontSize: 12
|
|
9726
9610
|
},
|
|
@@ -9826,7 +9710,7 @@ function RowColumn(_ref3) {
|
|
|
9826
9710
|
column = false,
|
|
9827
9711
|
checkboxes = false,
|
|
9828
9712
|
dense = false,
|
|
9829
|
-
|
|
9713
|
+
freqIsAllowed,
|
|
9830
9714
|
isSingleSelect,
|
|
9831
9715
|
actions,
|
|
9832
9716
|
frequencyMax = '',
|
|
@@ -10019,7 +9903,7 @@ function RowColumn(_ref3) {
|
|
|
10019
9903
|
color: 'inherit'
|
|
10020
9904
|
}) : getFieldWithRanges({
|
|
10021
9905
|
lbls: labels
|
|
10022
|
-
})),
|
|
9906
|
+
})), freqIsAllowed && /*#__PURE__*/React__default.createElement(Grid, {
|
|
10023
9907
|
item: true,
|
|
10024
9908
|
style: {
|
|
10025
9909
|
display: 'flex',
|
|
@@ -10048,6 +9932,7 @@ const scrollBarThumb = '#BBB';
|
|
|
10048
9932
|
const scrollBarThumbHover = '#555';
|
|
10049
9933
|
const scrollBarBackground = '#f1f1f1';
|
|
10050
9934
|
const MINIMUM_BATCH_SIZE = 100;
|
|
9935
|
+
const FREQUENCY_MIN_SHOW_WIDTH = 80;
|
|
10051
9936
|
const classes$9 = {
|
|
10052
9937
|
styledScrollbars: "".concat(PREFIX$9, "-styledScrollbars")
|
|
10053
9938
|
};
|
|
@@ -10098,7 +9983,7 @@ function ListBox(_ref2) {
|
|
|
10098
9983
|
height,
|
|
10099
9984
|
width,
|
|
10100
9985
|
listLayout = 'vertical',
|
|
10101
|
-
frequencyMode
|
|
9986
|
+
frequencyMode,
|
|
10102
9987
|
histogram = false,
|
|
10103
9988
|
checkboxes = false,
|
|
10104
9989
|
update = undefined,
|
|
@@ -10238,6 +10123,14 @@ function ListBox(_ref2) {
|
|
|
10238
10123
|
const h = Math.max(...ps.map(page => page.qArea.qTop + page.qArea.qHeight));
|
|
10239
10124
|
return hasFilteredValues ? h : count;
|
|
10240
10125
|
};
|
|
10126
|
+
const getFrequencyAllowed = () => {
|
|
10127
|
+
const widthPermitsFreq = width > FREQUENCY_MIN_SHOW_WIDTH;
|
|
10128
|
+
const {
|
|
10129
|
+
frequencyEnabled = false
|
|
10130
|
+
} = layout.qListObject;
|
|
10131
|
+
const hasValidFreqOption = !['none', undefined].includes(frequencyMode);
|
|
10132
|
+
return widthPermitsFreq && (hasValidFreqOption || frequencyEnabled);
|
|
10133
|
+
};
|
|
10241
10134
|
const listCount = pages && pages.length && calculatePagesHeight ? getCalculatedHeight(pages) : count;
|
|
10242
10135
|
onSetListCount === null || onSetListCount === void 0 ? void 0 : onSetListCount(listCount);
|
|
10243
10136
|
const dense = (_layout$layoutOptions = (_layout$layoutOptions2 = layout.layoutOptions) === null || _layout$layoutOptions2 === void 0 ? void 0 : _layout$layoutOptions2.dense) !== null && _layout$layoutOptions !== void 0 ? _layout$layoutOptions : false;
|
|
@@ -10254,6 +10147,7 @@ function ListBox(_ref2) {
|
|
|
10254
10147
|
const {
|
|
10255
10148
|
frequencyMax
|
|
10256
10149
|
} = layout;
|
|
10150
|
+
const freqIsAllowed = getFrequencyAllowed();
|
|
10257
10151
|
return /*#__PURE__*/React__default.createElement(InfiniteLoader, {
|
|
10258
10152
|
isItemLoaded: isItemLoaded,
|
|
10259
10153
|
itemCount: listCount || 1 // must be more than 0 or loadMoreItems will never be called again
|
|
@@ -10287,6 +10181,7 @@ function ListBox(_ref2) {
|
|
|
10287
10181
|
checkboxes,
|
|
10288
10182
|
dense,
|
|
10289
10183
|
frequencyMode,
|
|
10184
|
+
freqIsAllowed,
|
|
10290
10185
|
isSingleSelect,
|
|
10291
10186
|
actions: {
|
|
10292
10187
|
select,
|
|
@@ -10873,7 +10768,25 @@ const search = props => _objectSpread2(_objectSpread2({}, props), {}, {
|
|
|
10873
10768
|
var SearchIcon = (props => SvgIcon(search(props)));
|
|
10874
10769
|
|
|
10875
10770
|
const TREE_PATH = '/qListObjectDef';
|
|
10876
|
-
|
|
10771
|
+
const StyledInputAdornment = styled$1(InputAdornment)(_ref => {
|
|
10772
|
+
var _theme$listBox, _theme$listBox$conten;
|
|
10773
|
+
let {
|
|
10774
|
+
theme
|
|
10775
|
+
} = _ref;
|
|
10776
|
+
return {
|
|
10777
|
+
color: (_theme$listBox = theme.listBox) === null || _theme$listBox === void 0 ? void 0 : (_theme$listBox$conten = _theme$listBox.content) === null || _theme$listBox$conten === void 0 ? void 0 : _theme$listBox$conten.color
|
|
10778
|
+
};
|
|
10779
|
+
});
|
|
10780
|
+
const StyledOutlinedInput = styled$1(OutlinedInput)(_ref2 => {
|
|
10781
|
+
var _theme$listBox2, _theme$listBox2$conte;
|
|
10782
|
+
let {
|
|
10783
|
+
theme
|
|
10784
|
+
} = _ref2;
|
|
10785
|
+
return {
|
|
10786
|
+
color: (_theme$listBox2 = theme.listBox) === null || _theme$listBox2 === void 0 ? void 0 : (_theme$listBox2$conte = _theme$listBox2.content) === null || _theme$listBox2$conte === void 0 ? void 0 : _theme$listBox2$conte.color
|
|
10787
|
+
};
|
|
10788
|
+
});
|
|
10789
|
+
function ListBoxSearch(_ref3) {
|
|
10877
10790
|
let {
|
|
10878
10791
|
selections,
|
|
10879
10792
|
model,
|
|
@@ -10881,7 +10794,7 @@ function ListBoxSearch(_ref) {
|
|
|
10881
10794
|
listCount,
|
|
10882
10795
|
dense = false,
|
|
10883
10796
|
visible = true
|
|
10884
|
-
} =
|
|
10797
|
+
} = _ref3;
|
|
10885
10798
|
const {
|
|
10886
10799
|
translator
|
|
10887
10800
|
} = useContext(InstanceContext);
|
|
@@ -10950,8 +10863,8 @@ function ListBoxSearch(_ref) {
|
|
|
10950
10863
|
if (!visible) {
|
|
10951
10864
|
return null;
|
|
10952
10865
|
}
|
|
10953
|
-
return /*#__PURE__*/React__default.createElement(
|
|
10954
|
-
startAdornment: /*#__PURE__*/React__default.createElement(
|
|
10866
|
+
return /*#__PURE__*/React__default.createElement(StyledOutlinedInput, {
|
|
10867
|
+
startAdornment: /*#__PURE__*/React__default.createElement(StyledInputAdornment, {
|
|
10955
10868
|
position: "start"
|
|
10956
10869
|
}, /*#__PURE__*/React__default.createElement(SearchIcon, {
|
|
10957
10870
|
size: dense ? 'small' : 'normal'
|
|
@@ -10960,6 +10873,7 @@ function ListBoxSearch(_ref) {
|
|
|
10960
10873
|
sx: [{
|
|
10961
10874
|
border: 'none',
|
|
10962
10875
|
borderRadius: 0,
|
|
10876
|
+
backgroundColor: 'transparent',
|
|
10963
10877
|
'& fieldset': {
|
|
10964
10878
|
border: "1px solid ".concat(theme.palette.divider),
|
|
10965
10879
|
borderWidth: '1px 0 1px 0',
|
|
@@ -12598,28 +12512,65 @@ AutoSizer.defaultProps = {
|
|
|
12598
12512
|
style: {}
|
|
12599
12513
|
};
|
|
12600
12514
|
|
|
12515
|
+
const addListboxTheme = themeApi => {
|
|
12516
|
+
const getListboxStyle = prop => themeApi.getStyle('object', '', "listBox.".concat(prop));
|
|
12517
|
+
return {
|
|
12518
|
+
backgroundColor: getListboxStyle('backgroundColor'),
|
|
12519
|
+
title: {
|
|
12520
|
+
main: {
|
|
12521
|
+
color: getListboxStyle('title.main.color'),
|
|
12522
|
+
fontSize: getListboxStyle('title.main.fontSize'),
|
|
12523
|
+
fontFamily: getListboxStyle('title.main.fontFamily')
|
|
12524
|
+
}
|
|
12525
|
+
},
|
|
12526
|
+
content: {
|
|
12527
|
+
color: getListboxStyle('content.color'),
|
|
12528
|
+
fontSize: getListboxStyle('content.fontSize'),
|
|
12529
|
+
fontFamily: getListboxStyle('content.fontFamily')
|
|
12530
|
+
}
|
|
12531
|
+
};
|
|
12532
|
+
};
|
|
12533
|
+
|
|
12601
12534
|
const PREFIX$4 = 'ListBoxInline';
|
|
12602
12535
|
const classes$4 = {
|
|
12603
12536
|
listBoxHeader: "".concat(PREFIX$4, "-listBoxHeader"),
|
|
12604
12537
|
screenReaderOnly: "".concat(PREFIX$4, "-screenReaderOnly")
|
|
12605
12538
|
};
|
|
12606
|
-
const StyledGrid$3 = styled$1(Grid)(
|
|
12607
|
-
|
|
12608
|
-
|
|
12609
|
-
|
|
12610
|
-
}
|
|
12611
|
-
|
|
12612
|
-
|
|
12613
|
-
|
|
12614
|
-
|
|
12615
|
-
|
|
12616
|
-
|
|
12617
|
-
|
|
12618
|
-
|
|
12539
|
+
const StyledGrid$3 = styled$1(Grid)(_ref => {
|
|
12540
|
+
var _theme$listBox$backgr, _theme$listBox;
|
|
12541
|
+
let {
|
|
12542
|
+
theme
|
|
12543
|
+
} = _ref;
|
|
12544
|
+
return {
|
|
12545
|
+
backgroundColor: (_theme$listBox$backgr = (_theme$listBox = theme.listBox) === null || _theme$listBox === void 0 ? void 0 : _theme$listBox.backgroundColor) !== null && _theme$listBox$backgr !== void 0 ? _theme$listBox$backgr : theme.palette.background.default,
|
|
12546
|
+
["& .".concat(classes$4.listBoxHeader)]: {
|
|
12547
|
+
alignSelf: 'center',
|
|
12548
|
+
display: 'inline-flex'
|
|
12549
|
+
},
|
|
12550
|
+
["& .".concat(classes$4.screenReaderOnly)]: {
|
|
12551
|
+
position: 'absolute',
|
|
12552
|
+
height: 0,
|
|
12553
|
+
width: 0,
|
|
12554
|
+
overflow: 'hidden'
|
|
12555
|
+
}
|
|
12556
|
+
};
|
|
12557
|
+
});
|
|
12558
|
+
const Title = styled$1(Typography)(_ref2 => {
|
|
12559
|
+
var _theme$listBox2, _theme$listBox2$title, _theme$listBox2$title2, _theme$listBox3, _theme$listBox3$title, _theme$listBox3$title2, _theme$listBox4, _theme$listBox4$title, _theme$listBox4$title2;
|
|
12560
|
+
let {
|
|
12561
|
+
theme
|
|
12562
|
+
} = _ref2;
|
|
12563
|
+
return {
|
|
12564
|
+
color: (_theme$listBox2 = theme.listBox) === null || _theme$listBox2 === void 0 ? void 0 : (_theme$listBox2$title = _theme$listBox2.title) === null || _theme$listBox2$title === void 0 ? void 0 : (_theme$listBox2$title2 = _theme$listBox2$title.main) === null || _theme$listBox2$title2 === void 0 ? void 0 : _theme$listBox2$title2.color,
|
|
12565
|
+
fontSize: (_theme$listBox3 = theme.listBox) === null || _theme$listBox3 === void 0 ? void 0 : (_theme$listBox3$title = _theme$listBox3.title) === null || _theme$listBox3$title === void 0 ? void 0 : (_theme$listBox3$title2 = _theme$listBox3$title.main) === null || _theme$listBox3$title2 === void 0 ? void 0 : _theme$listBox3$title2.fontSize,
|
|
12566
|
+
fontFamily: (_theme$listBox4 = theme.listBox) === null || _theme$listBox4 === void 0 ? void 0 : (_theme$listBox4$title = _theme$listBox4.title) === null || _theme$listBox4$title === void 0 ? void 0 : (_theme$listBox4$title2 = _theme$listBox4$title.main) === null || _theme$listBox4$title2 === void 0 ? void 0 : _theme$listBox4$title2.fontFamily
|
|
12567
|
+
};
|
|
12568
|
+
});
|
|
12569
|
+
function ListBoxInline(_ref3) {
|
|
12619
12570
|
var _layout$layoutOptions, _layout$layoutOptions2;
|
|
12620
12571
|
let {
|
|
12621
12572
|
options = {}
|
|
12622
|
-
} =
|
|
12573
|
+
} = _ref3;
|
|
12623
12574
|
const {
|
|
12624
12575
|
direction,
|
|
12625
12576
|
frequencyMode,
|
|
@@ -12662,8 +12613,10 @@ function ListBoxInline(_ref) {
|
|
|
12662
12613
|
}, [model]);
|
|
12663
12614
|
const {
|
|
12664
12615
|
translator,
|
|
12665
|
-
keyboardNavigation
|
|
12616
|
+
keyboardNavigation,
|
|
12617
|
+
themeApi
|
|
12666
12618
|
} = useContext(InstanceContext);
|
|
12619
|
+
theme.listBox = addListboxTheme(themeApi);
|
|
12667
12620
|
const moreAlignTo = useRef();
|
|
12668
12621
|
const [searchContainer, searchContainerRef] = useRefWithCallback();
|
|
12669
12622
|
const [layout] = useLayout$1(model);
|
|
@@ -12778,7 +12731,7 @@ function ListBoxInline(_ref) {
|
|
|
12778
12731
|
})) : getSearchOrUnlock()), /*#__PURE__*/React__default.createElement(Grid, {
|
|
12779
12732
|
item: true,
|
|
12780
12733
|
className: classes$4.listBoxHeader
|
|
12781
|
-
}, /*#__PURE__*/React__default.createElement(
|
|
12734
|
+
}, /*#__PURE__*/React__default.createElement(Title, {
|
|
12782
12735
|
variant: "h6",
|
|
12783
12736
|
noWrap: true
|
|
12784
12737
|
}, layout.title || layout.qListObject.qDimensionInfo.qFallbackTitle)), /*#__PURE__*/React__default.createElement(Grid, {
|
|
@@ -12835,11 +12788,11 @@ function ListBoxInline(_ref) {
|
|
|
12835
12788
|
ref: moreAlignTo
|
|
12836
12789
|
}), /*#__PURE__*/React__default.createElement("div", {
|
|
12837
12790
|
className: classes$4.screenReaderOnly
|
|
12838
|
-
}, translator.get('Listbox.ScreenReaderInstructions')), /*#__PURE__*/React__default.createElement(AutoSizer, null,
|
|
12791
|
+
}, translator.get('Listbox.ScreenReaderInstructions')), /*#__PURE__*/React__default.createElement(AutoSizer, null, _ref4 => {
|
|
12839
12792
|
let {
|
|
12840
12793
|
height,
|
|
12841
12794
|
width
|
|
12842
|
-
} =
|
|
12795
|
+
} = _ref4;
|
|
12843
12796
|
return /*#__PURE__*/React__default.createElement(ListBox, {
|
|
12844
12797
|
model: model,
|
|
12845
12798
|
selections: selections,
|
|
@@ -12879,6 +12832,9 @@ function useExistingModel(_ref) {
|
|
|
12879
12832
|
if (options.dense) {
|
|
12880
12833
|
throw new Error('Option "dense" is not applicable for existing objects.');
|
|
12881
12834
|
}
|
|
12835
|
+
if (options.frequencyMode) {
|
|
12836
|
+
throw new Error('Option "frequencyMode" is not applicable for existing objects.');
|
|
12837
|
+
}
|
|
12882
12838
|
useEffect$1(() => {
|
|
12883
12839
|
async function fetchObject() {
|
|
12884
12840
|
const modelFromStore = modelStore.get(qId);
|
|
@@ -14862,7 +14818,7 @@ const resolveBgImage = (bgComp, app) => {
|
|
|
14862
14818
|
const bgImageDef = bgComp === null || bgComp === void 0 ? void 0 : bgComp.bgImage;
|
|
14863
14819
|
if (bgImageDef) {
|
|
14864
14820
|
let url = '';
|
|
14865
|
-
if (bgImageDef.mode === 'media') {
|
|
14821
|
+
if (bgImageDef.mode === 'media' || bgComp.useImage === 'media') {
|
|
14866
14822
|
var _bgImageDef$mediaUrl, _bgImageDef$mediaUrl$;
|
|
14867
14823
|
url = bgImageDef !== null && bgImageDef !== void 0 && (_bgImageDef$mediaUrl = bgImageDef.mediaUrl) !== null && _bgImageDef$mediaUrl !== void 0 && (_bgImageDef$mediaUrl$ = _bgImageDef$mediaUrl.qStaticContentUrl) !== null && _bgImageDef$mediaUrl$ !== void 0 && _bgImageDef$mediaUrl$.qUrl ? decodeURIComponent(bgImageDef.mediaUrl.qStaticContentUrl.qUrl) : undefined;
|
|
14868
14824
|
url = resolveImageUrl(app, url);
|
|
@@ -14886,7 +14842,7 @@ const resolveBgColor = (bgComp, theme) => {
|
|
|
14886
14842
|
if (bgColor.useColorExpression) {
|
|
14887
14843
|
return theme.validateColor(bgColor.colorExpression);
|
|
14888
14844
|
}
|
|
14889
|
-
return bgColor.color && bgColor.color.color !== 'none' ? theme.getColorPickerColor(bgColor.color) : undefined;
|
|
14845
|
+
return bgColor.color && bgColor.color.color !== 'none' ? theme.getColorPickerColor(bgColor.color, true) : undefined;
|
|
14890
14846
|
}
|
|
14891
14847
|
return undefined;
|
|
14892
14848
|
};
|
|
@@ -15178,6 +15134,7 @@ const Cell = forwardRef((_ref6, ref) => {
|
|
|
15178
15134
|
disableCellPadding = false
|
|
15179
15135
|
} = halo.context || {};
|
|
15180
15136
|
const {
|
|
15137
|
+
theme: themeName,
|
|
15181
15138
|
translator,
|
|
15182
15139
|
language,
|
|
15183
15140
|
keyboardNavigation
|
|
@@ -15194,11 +15151,8 @@ const Cell = forwardRef((_ref6, ref) => {
|
|
|
15194
15151
|
const [contentRef, contentRect, contentNode] = useRect$1();
|
|
15195
15152
|
const [snOptions, setSnOptions] = useState$1(initialSnOptions);
|
|
15196
15153
|
const [snPlugins, setSnPlugins] = useState$1(initialSnPlugins);
|
|
15197
|
-
const
|
|
15198
|
-
const
|
|
15199
|
-
current: clickOutElement
|
|
15200
|
-
}, '.njs-action-toolbar-popover']; // elements which will not trigger the click out listener
|
|
15201
|
-
const [selections] = useObjectSelections(app, model, clickOutElements);
|
|
15154
|
+
const cellElementId = "njs-cell-".concat(currentId);
|
|
15155
|
+
const [selections] = useObjectSelections(app, model, ["#".concat(cellElementId), '.njs-action-toolbar-popover']); // elements which will not trigger the click out listener
|
|
15202
15156
|
const [hovering, setHover] = useState$1(false);
|
|
15203
15157
|
const hoveringDebouncer = useRef({
|
|
15204
15158
|
enter: null,
|
|
@@ -15216,17 +15170,11 @@ const Cell = forwardRef((_ref6, ref) => {
|
|
|
15216
15170
|
useEffect$1(() => {
|
|
15217
15171
|
eventmixin(focusHandler.current);
|
|
15218
15172
|
}, []);
|
|
15219
|
-
useEffect$1(() => {
|
|
15220
|
-
if (!contentNode) {
|
|
15221
|
-
return;
|
|
15222
|
-
}
|
|
15223
|
-
setClickOutElement(cellNode);
|
|
15224
|
-
}, [cellRect]);
|
|
15225
15173
|
useEffect$1(() => {
|
|
15226
15174
|
const bgComp = layout !== null && layout !== void 0 && layout.components ? layout.components.find(comp => comp.key === 'general') : null;
|
|
15227
15175
|
setBgColor(resolveBgColor(bgComp, halo.public.theme));
|
|
15228
15176
|
setBgImage(resolveBgImage(bgComp, halo.app));
|
|
15229
|
-
}, [layout, halo.public.theme, halo.app]);
|
|
15177
|
+
}, [layout, halo.public.theme, halo.app, themeName]);
|
|
15230
15178
|
focusHandler.current.blurCallback = resetFocus => {
|
|
15231
15179
|
halo.root.toggleFocusOfCells();
|
|
15232
15180
|
if (resetFocus && contentNode) {
|
|
@@ -15417,7 +15365,7 @@ const Cell = forwardRef((_ref6, ref) => {
|
|
|
15417
15365
|
width: '100%',
|
|
15418
15366
|
height: '100%',
|
|
15419
15367
|
overflow: 'hidden',
|
|
15420
|
-
backgroundColor: bgColor,
|
|
15368
|
+
backgroundColor: bgColor || 'unset',
|
|
15421
15369
|
backgroundImage: bgImage && bgImage.url ? "url(".concat(bgImage.url, ")") : undefined,
|
|
15422
15370
|
backgroundRepeat: 'no-repeat',
|
|
15423
15371
|
backgroundSize: bgImage && bgImage.size,
|
|
@@ -15427,6 +15375,7 @@ const Cell = forwardRef((_ref6, ref) => {
|
|
|
15427
15375
|
square: true,
|
|
15428
15376
|
className: CellElement.className,
|
|
15429
15377
|
ref: cellRef,
|
|
15378
|
+
id: cellElementId,
|
|
15430
15379
|
onMouseEnter: handleOnMouseEnter,
|
|
15431
15380
|
onMouseLeave: handleOnMouseLeave
|
|
15432
15381
|
}, /*#__PURE__*/React__default.createElement(Grid, {
|
|
@@ -15466,7 +15415,7 @@ const Cell = forwardRef((_ref6, ref) => {
|
|
|
15466
15415
|
}));
|
|
15467
15416
|
});
|
|
15468
15417
|
|
|
15469
|
-
function glue(_ref) {
|
|
15418
|
+
function glue$1(_ref) {
|
|
15470
15419
|
let {
|
|
15471
15420
|
halo,
|
|
15472
15421
|
element,
|
|
@@ -15572,7 +15521,7 @@ function validatePlugins(plugins) {
|
|
|
15572
15521
|
});
|
|
15573
15522
|
}
|
|
15574
15523
|
|
|
15575
|
-
const noopi = () => {};
|
|
15524
|
+
const noopi$1 = () => {};
|
|
15576
15525
|
function viz() {
|
|
15577
15526
|
let {
|
|
15578
15527
|
model,
|
|
@@ -15580,7 +15529,7 @@ function viz() {
|
|
|
15580
15529
|
initialError,
|
|
15581
15530
|
onDestroy = async () => {}
|
|
15582
15531
|
} = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
15583
|
-
let unmountCell = noopi;
|
|
15532
|
+
let unmountCell = noopi$1;
|
|
15584
15533
|
let cellRef = null;
|
|
15585
15534
|
let mountedReference = null;
|
|
15586
15535
|
let onMount = null;
|
|
@@ -15630,6 +15579,11 @@ function viz() {
|
|
|
15630
15579
|
* @type {string}
|
|
15631
15580
|
*/
|
|
15632
15581
|
id: model.id,
|
|
15582
|
+
/**
|
|
15583
|
+
* This visualizations Enigma model, a representation of the generic object.
|
|
15584
|
+
* @type {string}
|
|
15585
|
+
*/
|
|
15586
|
+
model,
|
|
15633
15587
|
/**
|
|
15634
15588
|
* Destroys the visualization and removes it from the the DOM.
|
|
15635
15589
|
* @example
|
|
@@ -15642,7 +15596,7 @@ function viz() {
|
|
|
15642
15596
|
async destroy() {
|
|
15643
15597
|
await onDestroy();
|
|
15644
15598
|
unmountCell();
|
|
15645
|
-
unmountCell = noopi;
|
|
15599
|
+
unmountCell = noopi$1;
|
|
15646
15600
|
},
|
|
15647
15601
|
/**
|
|
15648
15602
|
* Converts the visualization to a different registered type
|
|
@@ -15681,7 +15635,7 @@ function viz() {
|
|
|
15681
15635
|
throw new Error('Already mounted');
|
|
15682
15636
|
}
|
|
15683
15637
|
mountedReference = element;
|
|
15684
|
-
[unmountCell, cellRef] = glue({
|
|
15638
|
+
[unmountCell, cellRef] = glue$1({
|
|
15685
15639
|
halo,
|
|
15686
15640
|
element,
|
|
15687
15641
|
model,
|
|
@@ -15821,6 +15775,350 @@ async function createSessionObject(_ref, halo) {
|
|
|
15821
15775
|
}, halo, error, onDestroy);
|
|
15822
15776
|
}
|
|
15823
15777
|
|
|
15778
|
+
async function getObject$1(_ref, halo) {
|
|
15779
|
+
let {
|
|
15780
|
+
id,
|
|
15781
|
+
options,
|
|
15782
|
+
plugins,
|
|
15783
|
+
element
|
|
15784
|
+
} = _ref;
|
|
15785
|
+
const key = "".concat(id);
|
|
15786
|
+
let rpc = rpcRequestModelStore.get(key);
|
|
15787
|
+
if (!rpc) {
|
|
15788
|
+
rpc = halo.app.getObject(id);
|
|
15789
|
+
rpcRequestModelStore.set(key, rpc);
|
|
15790
|
+
}
|
|
15791
|
+
const model = await rpc;
|
|
15792
|
+
modelStore.set(key, model);
|
|
15793
|
+
return init(model, {
|
|
15794
|
+
options,
|
|
15795
|
+
plugins,
|
|
15796
|
+
element
|
|
15797
|
+
}, halo);
|
|
15798
|
+
}
|
|
15799
|
+
|
|
15800
|
+
/**
|
|
15801
|
+
* @interface
|
|
15802
|
+
* @extends HTMLElement
|
|
15803
|
+
* @experimental
|
|
15804
|
+
* @since 3.1.0
|
|
15805
|
+
*/
|
|
15806
|
+
const SheetElement = {
|
|
15807
|
+
/** @type {'njs-sheet'} */
|
|
15808
|
+
className: 'njs-sheet'
|
|
15809
|
+
};
|
|
15810
|
+
function getCellRenderer(cell, halo, initialSnOptions, initialSnPlugins, initialError, onMount) {
|
|
15811
|
+
const {
|
|
15812
|
+
x,
|
|
15813
|
+
y,
|
|
15814
|
+
width,
|
|
15815
|
+
height
|
|
15816
|
+
} = cell.bounds;
|
|
15817
|
+
return /*#__PURE__*/React__default.createElement("div", {
|
|
15818
|
+
style: {
|
|
15819
|
+
left: "".concat(x, "%"),
|
|
15820
|
+
top: "".concat(y, "%"),
|
|
15821
|
+
width: "".concat(width, "%"),
|
|
15822
|
+
height: "".concat(height, "%"),
|
|
15823
|
+
position: 'absolute'
|
|
15824
|
+
}
|
|
15825
|
+
}, /*#__PURE__*/React__default.createElement(Cell, {
|
|
15826
|
+
ref: cell.cellRef,
|
|
15827
|
+
halo: halo,
|
|
15828
|
+
model: cell.model,
|
|
15829
|
+
currentId: cell.currentId,
|
|
15830
|
+
initialSnOptions: initialSnOptions,
|
|
15831
|
+
initialSnPlugins: initialSnPlugins,
|
|
15832
|
+
initialError: initialError,
|
|
15833
|
+
onMount: onMount
|
|
15834
|
+
}));
|
|
15835
|
+
}
|
|
15836
|
+
function Sheet(_ref) {
|
|
15837
|
+
let {
|
|
15838
|
+
model,
|
|
15839
|
+
halo,
|
|
15840
|
+
initialSnOptions,
|
|
15841
|
+
initialSnPlugins,
|
|
15842
|
+
initialError,
|
|
15843
|
+
onMount
|
|
15844
|
+
} = _ref;
|
|
15845
|
+
const {
|
|
15846
|
+
root
|
|
15847
|
+
} = halo;
|
|
15848
|
+
const [layout] = useLayout$1(model);
|
|
15849
|
+
const {
|
|
15850
|
+
theme: themeName
|
|
15851
|
+
} = useContext(InstanceContext);
|
|
15852
|
+
const [cells, setCells] = useState$1([]);
|
|
15853
|
+
const [bgColor, setBgColor] = useState$1(undefined);
|
|
15854
|
+
const [bgImage, setBgImage] = useState$1(undefined);
|
|
15855
|
+
const [deepHash, setDeepHash] = useState$1('');
|
|
15856
|
+
|
|
15857
|
+
/// For each object
|
|
15858
|
+
useEffect$1(() => {
|
|
15859
|
+
if (layout) {
|
|
15860
|
+
const hash = JSON.stringify(layout.cells);
|
|
15861
|
+
if (hash === deepHash) {
|
|
15862
|
+
return;
|
|
15863
|
+
}
|
|
15864
|
+
setDeepHash(hash);
|
|
15865
|
+
const fetchObjects = async () => {
|
|
15866
|
+
/*
|
|
15867
|
+
Need to always fetch and evaluate everything as the sheet need to support multiple instances of the same object?
|
|
15868
|
+
No, there is no way to add the same chart twice, so the optimization should be worth it.
|
|
15869
|
+
*/
|
|
15870
|
+
|
|
15871
|
+
// Clear the cell list
|
|
15872
|
+
cells.forEach(c => {
|
|
15873
|
+
root.removeCell(c.currentId);
|
|
15874
|
+
});
|
|
15875
|
+
const lCells = layout.cells;
|
|
15876
|
+
// TODO - should try reuse existing objects on subsequent renders
|
|
15877
|
+
// Non-id updates should only change the "css"
|
|
15878
|
+
const cs = await Promise.all(lCells.map(async c => {
|
|
15879
|
+
let mounted;
|
|
15880
|
+
const mountedPromise = new Promise(resolve => {
|
|
15881
|
+
mounted = resolve;
|
|
15882
|
+
});
|
|
15883
|
+
const cell = cells.find(ce => ce.id === c.name);
|
|
15884
|
+
if (cell) {
|
|
15885
|
+
cell.bounds = c.bounds;
|
|
15886
|
+
delete cell.mountedPromise;
|
|
15887
|
+
return cell;
|
|
15888
|
+
}
|
|
15889
|
+
const vs = await getObject$1({
|
|
15890
|
+
id: c.name
|
|
15891
|
+
}, halo);
|
|
15892
|
+
return {
|
|
15893
|
+
model: vs.model,
|
|
15894
|
+
id: c.name,
|
|
15895
|
+
bounds: c.bounds,
|
|
15896
|
+
cellRef: React__default.createRef(),
|
|
15897
|
+
currentId: uid(),
|
|
15898
|
+
mounted,
|
|
15899
|
+
mountedPromise
|
|
15900
|
+
};
|
|
15901
|
+
}));
|
|
15902
|
+
cs.forEach(c => root.addCell(c.currentId, c.cellRef));
|
|
15903
|
+
setCells(cs);
|
|
15904
|
+
};
|
|
15905
|
+
fetchObjects();
|
|
15906
|
+
}
|
|
15907
|
+
}, [layout]);
|
|
15908
|
+
const cellRenderers = useMemo$1(() => cells ? cells.map(c => getCellRenderer(c, halo, initialSnOptions, initialSnPlugins, initialError, c.mounted)) : [], [cells]);
|
|
15909
|
+
useEffect$1(() => {
|
|
15910
|
+
const bgComp = layout !== null && layout !== void 0 && layout.components ? layout.components.find(comp => comp.key === 'general') : null;
|
|
15911
|
+
setBgColor(resolveBgColor(bgComp, halo.public.theme));
|
|
15912
|
+
setBgImage(resolveBgImage(bgComp, halo.app));
|
|
15913
|
+
}, [layout, halo.public.theme, halo.app, themeName]);
|
|
15914
|
+
|
|
15915
|
+
/* TODO
|
|
15916
|
+
- sheet title + bg + logo etc + as option
|
|
15917
|
+
- sheet exposed classnames for theming
|
|
15918
|
+
*/
|
|
15919
|
+
|
|
15920
|
+
const height = !layout || Number.isNaN(layout.height) ? '100%' : "".concat(Number(layout.height), "%");
|
|
15921
|
+
const promises = cells.map(c => c.mountedPromise);
|
|
15922
|
+
const ps = promises.filter(p => !!p);
|
|
15923
|
+
if (ps.length) {
|
|
15924
|
+
Promise.all(promises).then(() => {
|
|
15925
|
+
// TODO - correct? Currently called each time a new cell is mounted?
|
|
15926
|
+
onMount();
|
|
15927
|
+
});
|
|
15928
|
+
}
|
|
15929
|
+
return /*#__PURE__*/React__default.createElement("div", {
|
|
15930
|
+
className: SheetElement.className,
|
|
15931
|
+
style: {
|
|
15932
|
+
width: "100%",
|
|
15933
|
+
height,
|
|
15934
|
+
position: 'relative',
|
|
15935
|
+
backgroundColor: bgColor,
|
|
15936
|
+
backgroundImage: bgImage && bgImage.url ? "url(".concat(bgImage.url, ")") : undefined,
|
|
15937
|
+
backgroundRepeat: 'no-repeat',
|
|
15938
|
+
backgroundSize: bgImage && bgImage.size,
|
|
15939
|
+
backgroundPosition: bgImage && bgImage.pos
|
|
15940
|
+
}
|
|
15941
|
+
}, cellRenderers);
|
|
15942
|
+
}
|
|
15943
|
+
|
|
15944
|
+
function glue(_ref) {
|
|
15945
|
+
let {
|
|
15946
|
+
halo,
|
|
15947
|
+
element,
|
|
15948
|
+
model,
|
|
15949
|
+
initialSnOptions,
|
|
15950
|
+
initialSnPlugins,
|
|
15951
|
+
onMount,
|
|
15952
|
+
initialError
|
|
15953
|
+
} = _ref;
|
|
15954
|
+
const {
|
|
15955
|
+
root
|
|
15956
|
+
} = halo;
|
|
15957
|
+
const sheetRef = React__default.createRef();
|
|
15958
|
+
const portal = ReactDOM.createPortal( /*#__PURE__*/React__default.createElement(Sheet, {
|
|
15959
|
+
ref: sheetRef,
|
|
15960
|
+
halo: halo,
|
|
15961
|
+
model: model,
|
|
15962
|
+
initialSnOptions: initialSnOptions,
|
|
15963
|
+
initialSnPlugins: initialSnPlugins,
|
|
15964
|
+
initialError: initialError,
|
|
15965
|
+
onMount: onMount
|
|
15966
|
+
}), element, model.id);
|
|
15967
|
+
const unmount = () => {
|
|
15968
|
+
root.remove(portal);
|
|
15969
|
+
model.removeListener('closed', unmount);
|
|
15970
|
+
};
|
|
15971
|
+
model.on('closed', unmount);
|
|
15972
|
+
root.add(portal);
|
|
15973
|
+
return [unmount, sheetRef];
|
|
15974
|
+
}
|
|
15975
|
+
|
|
15976
|
+
const noopi = () => {};
|
|
15977
|
+
function sheet() {
|
|
15978
|
+
let {
|
|
15979
|
+
model,
|
|
15980
|
+
halo,
|
|
15981
|
+
initialError,
|
|
15982
|
+
onDestroy = async () => {}
|
|
15983
|
+
} = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
15984
|
+
let unmountSheet = noopi;
|
|
15985
|
+
let sheetRef = null;
|
|
15986
|
+
let mountedReference = null;
|
|
15987
|
+
let onMount = null;
|
|
15988
|
+
const mounted = new Promise(resolve => {
|
|
15989
|
+
onMount = resolve;
|
|
15990
|
+
});
|
|
15991
|
+
let initialSnOptions = {};
|
|
15992
|
+
let initialSnPlugins = [];
|
|
15993
|
+
const setSnOptions = async opts => {
|
|
15994
|
+
if (mountedReference) {
|
|
15995
|
+
(async () => {
|
|
15996
|
+
await mounted;
|
|
15997
|
+
sheetRef.current.setSnOptions(_objectSpread2(_objectSpread2({}, initialSnOptions), opts));
|
|
15998
|
+
})();
|
|
15999
|
+
} else {
|
|
16000
|
+
// Handle setting options before mount
|
|
16001
|
+
initialSnOptions = _objectSpread2(_objectSpread2({}, initialSnOptions), opts);
|
|
16002
|
+
}
|
|
16003
|
+
};
|
|
16004
|
+
const setSnPlugins = async plugins => {
|
|
16005
|
+
validatePlugins(plugins);
|
|
16006
|
+
if (mountedReference) {
|
|
16007
|
+
(async () => {
|
|
16008
|
+
await mounted;
|
|
16009
|
+
sheetRef.current.setSnPlugins(plugins);
|
|
16010
|
+
})();
|
|
16011
|
+
} else {
|
|
16012
|
+
// Handle setting plugins before mount
|
|
16013
|
+
initialSnPlugins = plugins;
|
|
16014
|
+
}
|
|
16015
|
+
};
|
|
16016
|
+
|
|
16017
|
+
/**
|
|
16018
|
+
* @class
|
|
16019
|
+
* @alias Sheet
|
|
16020
|
+
* @classdesc A controller to further modify a visualization after it has been rendered.
|
|
16021
|
+
* @experimental
|
|
16022
|
+
* @since 3.1.0
|
|
16023
|
+
* @example
|
|
16024
|
+
* const sheet = await embed(app).render({
|
|
16025
|
+
* element,
|
|
16026
|
+
* id: "jD5Gd"
|
|
16027
|
+
* });
|
|
16028
|
+
* sheet.destroy();
|
|
16029
|
+
*/
|
|
16030
|
+
const api = /** @lends Sheet# */{
|
|
16031
|
+
/**
|
|
16032
|
+
* The id of this sheets's generic object.
|
|
16033
|
+
* @type {string}
|
|
16034
|
+
*/
|
|
16035
|
+
id: model.id,
|
|
16036
|
+
/**
|
|
16037
|
+
* This sheets Enigma model, a representation of the generic object.
|
|
16038
|
+
* @type {string}
|
|
16039
|
+
*/
|
|
16040
|
+
model,
|
|
16041
|
+
/**
|
|
16042
|
+
* Destroys the sheet and removes it from the the DOM.
|
|
16043
|
+
* @example
|
|
16044
|
+
* const sheet = await embed(app).render({
|
|
16045
|
+
* element,
|
|
16046
|
+
* id: "jD5Gd"
|
|
16047
|
+
* });
|
|
16048
|
+
* sheet.destroy();
|
|
16049
|
+
*/
|
|
16050
|
+
async destroy() {
|
|
16051
|
+
await onDestroy();
|
|
16052
|
+
unmountSheet();
|
|
16053
|
+
unmountSheet = noopi;
|
|
16054
|
+
},
|
|
16055
|
+
// ===== unexposed experimental API - use at own risk ======
|
|
16056
|
+
__DO_NOT_USE__: {
|
|
16057
|
+
mount(element) {
|
|
16058
|
+
if (mountedReference) {
|
|
16059
|
+
throw new Error('Already mounted');
|
|
16060
|
+
}
|
|
16061
|
+
mountedReference = element;
|
|
16062
|
+
[unmountSheet, sheetRef] = glue({
|
|
16063
|
+
halo,
|
|
16064
|
+
element,
|
|
16065
|
+
model,
|
|
16066
|
+
initialSnOptions,
|
|
16067
|
+
initialSnPlugins,
|
|
16068
|
+
initialError,
|
|
16069
|
+
onMount
|
|
16070
|
+
});
|
|
16071
|
+
return mounted;
|
|
16072
|
+
},
|
|
16073
|
+
async applyProperties(props) {
|
|
16074
|
+
const current = await model.getEffectiveProperties();
|
|
16075
|
+
const patches = getPatches('/', props, current);
|
|
16076
|
+
if (patches.length) {
|
|
16077
|
+
return model.applyPatches(patches, true);
|
|
16078
|
+
}
|
|
16079
|
+
return undefined;
|
|
16080
|
+
},
|
|
16081
|
+
options(opts) {
|
|
16082
|
+
setSnOptions(opts);
|
|
16083
|
+
},
|
|
16084
|
+
plugins(plugins) {
|
|
16085
|
+
setSnPlugins(plugins);
|
|
16086
|
+
},
|
|
16087
|
+
exportImage() {
|
|
16088
|
+
throw new Error('Not implemented');
|
|
16089
|
+
},
|
|
16090
|
+
takeSnapshot() {
|
|
16091
|
+
throw new Error('Not implemented');
|
|
16092
|
+
},
|
|
16093
|
+
getModel() {
|
|
16094
|
+
return model;
|
|
16095
|
+
}
|
|
16096
|
+
}
|
|
16097
|
+
};
|
|
16098
|
+
return api;
|
|
16099
|
+
}
|
|
16100
|
+
|
|
16101
|
+
/* eslint no-underscore-dangle:0 */
|
|
16102
|
+
async function initSheet(model, optional, halo, initialError) {
|
|
16103
|
+
let onDestroy = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : async () => {};
|
|
16104
|
+
const api = sheet({
|
|
16105
|
+
model,
|
|
16106
|
+
halo,
|
|
16107
|
+
initialError,
|
|
16108
|
+
onDestroy
|
|
16109
|
+
});
|
|
16110
|
+
if (optional.options) {
|
|
16111
|
+
api.__DO_NOT_USE__.options(optional.options);
|
|
16112
|
+
}
|
|
16113
|
+
if (optional.plugins) {
|
|
16114
|
+
api.__DO_NOT_USE__.plugins(optional.plugins);
|
|
16115
|
+
}
|
|
16116
|
+
if (optional.element) {
|
|
16117
|
+
await api.__DO_NOT_USE__.mount(optional.element);
|
|
16118
|
+
}
|
|
16119
|
+
return api;
|
|
16120
|
+
}
|
|
16121
|
+
|
|
15824
16122
|
/**
|
|
15825
16123
|
* @interface BaseConfig
|
|
15826
16124
|
* @description Basic rendering configuration for rendering an object
|
|
@@ -15851,6 +16149,13 @@ async function getObject(_ref, halo) {
|
|
|
15851
16149
|
}
|
|
15852
16150
|
const model = await rpc;
|
|
15853
16151
|
modelStore.set(key, model);
|
|
16152
|
+
if (model.genericType === 'sheet') {
|
|
16153
|
+
return initSheet(model, {
|
|
16154
|
+
options,
|
|
16155
|
+
plugins,
|
|
16156
|
+
element
|
|
16157
|
+
}, halo);
|
|
16158
|
+
}
|
|
15854
16159
|
return init(model, {
|
|
15855
16160
|
options,
|
|
15856
16161
|
plugins,
|
|
@@ -19720,6 +20025,7 @@ function nuked() {
|
|
|
19720
20025
|
themes: configuration.themes,
|
|
19721
20026
|
root
|
|
19722
20027
|
});
|
|
20028
|
+
currentContext.themeApi = appTheme$1.externalAPI;
|
|
19723
20029
|
const publicAPIs = {
|
|
19724
20030
|
galaxy: /** @lends Galaxy */{
|
|
19725
20031
|
/** @type {Translator} */
|
|
@@ -19765,9 +20071,10 @@ function nuked() {
|
|
|
19765
20071
|
*/
|
|
19766
20072
|
const api = /** @lends Embed# */{
|
|
19767
20073
|
/**
|
|
19768
|
-
* Renders a visualization into an HTMLElement.
|
|
20074
|
+
* Renders a visualization or sheet into an HTMLElement.
|
|
20075
|
+
* Support for sense sheets is experimental.
|
|
19769
20076
|
* @param {CreateConfig | GetConfig} cfg - The render configuration.
|
|
19770
|
-
* @returns {Promise<Viz>} A controller to the rendered visualization.
|
|
20077
|
+
* @returns {Promise<Viz|Sheet>} A controller to the rendered visualization or sheet.
|
|
19771
20078
|
* @example
|
|
19772
20079
|
* // render from existing object
|
|
19773
20080
|
* n.render({
|
|
@@ -20051,7 +20358,7 @@ var enigmaMocker = {exports: {}};
|
|
|
20051
20358
|
var enigmaMocker_dev = {exports: {}};
|
|
20052
20359
|
|
|
20053
20360
|
/*
|
|
20054
|
-
* @nebula.js/enigma-mocker v3.1.0-alpha.
|
|
20361
|
+
* @nebula.js/enigma-mocker v3.1.0-alpha.2
|
|
20055
20362
|
* Copyright (c) 2022 QlikTech International AB
|
|
20056
20363
|
* Released under the MIT license.
|
|
20057
20364
|
*/
|
|
@@ -20091,6 +20398,7 @@ var enigmaMocker_dev = {exports: {}};
|
|
|
20091
20398
|
return target;
|
|
20092
20399
|
}
|
|
20093
20400
|
function _defineProperty(obj, key, value) {
|
|
20401
|
+
key = _toPropertyKey(key);
|
|
20094
20402
|
if (key in obj) {
|
|
20095
20403
|
Object.defineProperty(obj, key, {
|
|
20096
20404
|
value: value,
|
|
@@ -20130,6 +20438,20 @@ var enigmaMocker_dev = {exports: {}};
|
|
|
20130
20438
|
}
|
|
20131
20439
|
return target;
|
|
20132
20440
|
}
|
|
20441
|
+
function _toPrimitive(input, hint) {
|
|
20442
|
+
if (typeof input !== "object" || input === null) return input;
|
|
20443
|
+
var prim = input[Symbol.toPrimitive];
|
|
20444
|
+
if (prim !== undefined) {
|
|
20445
|
+
var res = prim.call(input, hint || "default");
|
|
20446
|
+
if (typeof res !== "object") return res;
|
|
20447
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
20448
|
+
}
|
|
20449
|
+
return (hint === "string" ? String : Number)(input);
|
|
20450
|
+
}
|
|
20451
|
+
function _toPropertyKey(arg) {
|
|
20452
|
+
var key = _toPrimitive(arg, "string");
|
|
20453
|
+
return typeof key === "symbol" ? key : String(key);
|
|
20454
|
+
}
|
|
20133
20455
|
var hasOwn = Object.prototype.hasOwnProperty;
|
|
20134
20456
|
var toStr = Object.prototype.toString;
|
|
20135
20457
|
var defineProperty = Object.defineProperty;
|
|
@@ -20410,7 +20732,7 @@ var enigmaMocker_dev = {exports: {}};
|
|
|
20410
20732
|
throw new Error("Generic object has multiple IDs, qInfo.qId: ".concat(qId, ", id: ").concat(id));
|
|
20411
20733
|
}
|
|
20412
20734
|
qId = qId || id || "object - ".concat(+Date.now());
|
|
20413
|
-
const mock = _objectSpread2({
|
|
20735
|
+
const mock = _objectSpread2(_objectSpread2({
|
|
20414
20736
|
id: qId,
|
|
20415
20737
|
session: getPropValue(session, {
|
|
20416
20738
|
defaultValue: true
|
|
@@ -20425,7 +20747,9 @@ var enigmaMocker_dev = {exports: {}};
|
|
|
20425
20747
|
delay
|
|
20426
20748
|
})
|
|
20427
20749
|
});
|
|
20428
|
-
}, {}))
|
|
20750
|
+
}, {})), {}, {
|
|
20751
|
+
genericType: genericObject.type
|
|
20752
|
+
});
|
|
20429
20753
|
return {
|
|
20430
20754
|
[qId]: mock
|
|
20431
20755
|
};
|