@nebula.js/stardust 5.2.0 → 5.4.0
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 +1637 -1531
- 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 +5 -5
- package/dist/stardust.dev.js +11714 -10738
- package/dist/stardust.dev.js.map +1 -1
- package/dist/stardust.js +14 -14
- package/dist/stardust.js.map +1 -1
- package/package.json +15 -15
- package/types/index.d.ts +24 -0
package/core/esm/dev.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* @nebula.js/stardust v5.
|
|
2
|
+
* @nebula.js/stardust v5.4.0
|
|
3
3
|
* Copyright (c) 2024 QlikTech International AB
|
|
4
4
|
* Released under the MIT license.
|
|
5
5
|
*/
|
|
@@ -717,14 +717,14 @@ function _defineProperty(e, r, t) {
|
|
|
717
717
|
writable: !0
|
|
718
718
|
}) : e[r] = t, e;
|
|
719
719
|
}
|
|
720
|
-
function _extends$
|
|
721
|
-
return _extends$
|
|
720
|
+
function _extends$6() {
|
|
721
|
+
return _extends$6 = Object.assign ? Object.assign.bind() : function (n) {
|
|
722
722
|
for (var e = 1; e < arguments.length; e++) {
|
|
723
723
|
var t = arguments[e];
|
|
724
724
|
for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
|
|
725
725
|
}
|
|
726
726
|
return n;
|
|
727
|
-
}, _extends$
|
|
727
|
+
}, _extends$6.apply(null, arguments);
|
|
728
728
|
}
|
|
729
729
|
function ownKeys(e, r) {
|
|
730
730
|
var t = Object.keys(e);
|
|
@@ -751,18 +751,18 @@ function _objectWithoutProperties(e, t) {
|
|
|
751
751
|
if (null == e) return {};
|
|
752
752
|
var o,
|
|
753
753
|
r,
|
|
754
|
-
i = _objectWithoutPropertiesLoose$
|
|
754
|
+
i = _objectWithoutPropertiesLoose$2(e, t);
|
|
755
755
|
if (Object.getOwnPropertySymbols) {
|
|
756
|
-
var
|
|
757
|
-
for (r = 0; r <
|
|
756
|
+
var s = Object.getOwnPropertySymbols(e);
|
|
757
|
+
for (r = 0; r < s.length; r++) o = s[r], t.includes(o) || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]);
|
|
758
758
|
}
|
|
759
759
|
return i;
|
|
760
760
|
}
|
|
761
|
-
function _objectWithoutPropertiesLoose$
|
|
761
|
+
function _objectWithoutPropertiesLoose$2(r, e) {
|
|
762
762
|
if (null == r) return {};
|
|
763
763
|
var t = {};
|
|
764
764
|
for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
|
|
765
|
-
if (e.
|
|
765
|
+
if (e.includes(n)) continue;
|
|
766
766
|
t[n] = r[n];
|
|
767
767
|
}
|
|
768
768
|
return t;
|
|
@@ -3923,24 +3923,32 @@ var formatMuiErrorMessage = /*#__PURE__*/Object.freeze({
|
|
|
3923
3923
|
|
|
3924
3924
|
var THEME_ID = '$$material';
|
|
3925
3925
|
|
|
3926
|
-
function _extends$
|
|
3927
|
-
|
|
3928
|
-
for (var
|
|
3929
|
-
var
|
|
3930
|
-
for (var
|
|
3926
|
+
function _extends$5() {
|
|
3927
|
+
_extends$5 = Object.assign ? Object.assign.bind() : function (target) {
|
|
3928
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
3929
|
+
var source = arguments[i];
|
|
3930
|
+
for (var key in source) {
|
|
3931
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
3932
|
+
target[key] = source[key];
|
|
3933
|
+
}
|
|
3934
|
+
}
|
|
3931
3935
|
}
|
|
3932
|
-
return
|
|
3933
|
-
}
|
|
3936
|
+
return target;
|
|
3937
|
+
};
|
|
3938
|
+
return _extends$5.apply(this, arguments);
|
|
3934
3939
|
}
|
|
3935
3940
|
|
|
3936
|
-
function _objectWithoutPropertiesLoose(
|
|
3937
|
-
if (
|
|
3938
|
-
var
|
|
3939
|
-
|
|
3940
|
-
|
|
3941
|
-
|
|
3941
|
+
function _objectWithoutPropertiesLoose$1(source, excluded) {
|
|
3942
|
+
if (source == null) return {};
|
|
3943
|
+
var target = {};
|
|
3944
|
+
var sourceKeys = Object.keys(source);
|
|
3945
|
+
var key, i;
|
|
3946
|
+
for (i = 0; i < sourceKeys.length; i++) {
|
|
3947
|
+
key = sourceKeys[i];
|
|
3948
|
+
if (excluded.indexOf(key) >= 0) continue;
|
|
3949
|
+
target[key] = source[key];
|
|
3942
3950
|
}
|
|
3943
|
-
return
|
|
3951
|
+
return target;
|
|
3944
3952
|
}
|
|
3945
3953
|
|
|
3946
3954
|
/*
|
|
@@ -5243,7 +5251,7 @@ function GlobalStyles(props) {
|
|
|
5243
5251
|
}
|
|
5244
5252
|
|
|
5245
5253
|
/**
|
|
5246
|
-
* @mui/styled-engine v5.
|
|
5254
|
+
* @mui/styled-engine v5.16.6
|
|
5247
5255
|
*
|
|
5248
5256
|
* @license MIT
|
|
5249
5257
|
* This source code is licensed under the MIT license found in the
|
|
@@ -5274,6 +5282,49 @@ var styledEngine = /*#__PURE__*/Object.freeze({
|
|
|
5274
5282
|
keyframes: keyframes
|
|
5275
5283
|
});
|
|
5276
5284
|
|
|
5285
|
+
function _extends$4() {
|
|
5286
|
+
_extends$4 = Object.assign ? Object.assign.bind() : function (target) {
|
|
5287
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
5288
|
+
var source = arguments[i];
|
|
5289
|
+
for (var key in source) {
|
|
5290
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
5291
|
+
target[key] = source[key];
|
|
5292
|
+
}
|
|
5293
|
+
}
|
|
5294
|
+
}
|
|
5295
|
+
return target;
|
|
5296
|
+
};
|
|
5297
|
+
return _extends$4.apply(this, arguments);
|
|
5298
|
+
}
|
|
5299
|
+
|
|
5300
|
+
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
5301
|
+
if (source == null) return {};
|
|
5302
|
+
var target = {};
|
|
5303
|
+
var sourceKeys = Object.keys(source);
|
|
5304
|
+
var key, i;
|
|
5305
|
+
for (i = 0; i < sourceKeys.length; i++) {
|
|
5306
|
+
key = sourceKeys[i];
|
|
5307
|
+
if (excluded.indexOf(key) >= 0) continue;
|
|
5308
|
+
target[key] = source[key];
|
|
5309
|
+
}
|
|
5310
|
+
return target;
|
|
5311
|
+
}
|
|
5312
|
+
|
|
5313
|
+
function _extends$3() {
|
|
5314
|
+
_extends$3 = Object.assign ? Object.assign.bind() : function (target) {
|
|
5315
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
5316
|
+
var source = arguments[i];
|
|
5317
|
+
for (var key in source) {
|
|
5318
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
5319
|
+
target[key] = source[key];
|
|
5320
|
+
}
|
|
5321
|
+
}
|
|
5322
|
+
}
|
|
5323
|
+
return target;
|
|
5324
|
+
};
|
|
5325
|
+
return _extends$3.apply(this, arguments);
|
|
5326
|
+
}
|
|
5327
|
+
|
|
5277
5328
|
// https://github.com/sindresorhus/is-plain-obj/blob/main/index.js
|
|
5278
5329
|
function isPlainObject(item) {
|
|
5279
5330
|
if (typeof item !== 'object' || item === null) {
|
|
@@ -5295,7 +5346,7 @@ function deepClone(source) {
|
|
|
5295
5346
|
function deepmerge$1(target, source, options = {
|
|
5296
5347
|
clone: true
|
|
5297
5348
|
}) {
|
|
5298
|
-
const output = options.clone ? _extends$
|
|
5349
|
+
const output = options.clone ? _extends$3({}, target) : target;
|
|
5299
5350
|
if (isPlainObject(target) && isPlainObject(source)) {
|
|
5300
5351
|
Object.keys(source).forEach(key => {
|
|
5301
5352
|
if (isPlainObject(source[key]) &&
|
|
@@ -5328,7 +5379,7 @@ const sortBreakpointsValues = values => {
|
|
|
5328
5379
|
// Sort in ascending order
|
|
5329
5380
|
breakpointsAsArray.sort((breakpoint1, breakpoint2) => breakpoint1.val - breakpoint2.val);
|
|
5330
5381
|
return breakpointsAsArray.reduce((acc, obj) => {
|
|
5331
|
-
return _extends$
|
|
5382
|
+
return _extends$4({}, acc, {
|
|
5332
5383
|
[obj.key]: obj.val
|
|
5333
5384
|
});
|
|
5334
5385
|
}, {});
|
|
@@ -5385,7 +5436,7 @@ function createBreakpoints(breakpoints) {
|
|
|
5385
5436
|
}
|
|
5386
5437
|
return between(key, keys[keys.indexOf(key) + 1]).replace('@media', '@media not all and');
|
|
5387
5438
|
}
|
|
5388
|
-
return _extends$
|
|
5439
|
+
return _extends$4({
|
|
5389
5440
|
keys,
|
|
5390
5441
|
values: sortedValues,
|
|
5391
5442
|
up,
|
|
@@ -6432,15 +6483,15 @@ function createTheme$2(options = {}, ...args) {
|
|
|
6432
6483
|
direction: 'ltr',
|
|
6433
6484
|
components: {},
|
|
6434
6485
|
// Inject component definitions.
|
|
6435
|
-
palette: _extends$
|
|
6486
|
+
palette: _extends$4({
|
|
6436
6487
|
mode: 'light'
|
|
6437
6488
|
}, paletteInput),
|
|
6438
6489
|
spacing,
|
|
6439
|
-
shape: _extends$
|
|
6490
|
+
shape: _extends$4({}, shape, shapeInput)
|
|
6440
6491
|
}, other);
|
|
6441
6492
|
muiTheme.applyStyles = applyStyles;
|
|
6442
6493
|
muiTheme = args.reduce((acc, argument) => deepmerge$1(acc, argument), muiTheme);
|
|
6443
|
-
muiTheme.unstable_sxConfig = _extends$
|
|
6494
|
+
muiTheme.unstable_sxConfig = _extends$4({}, defaultSxConfig, other == null ? void 0 : other.unstable_sxConfig);
|
|
6444
6495
|
muiTheme.unstable_sx = function sx(props) {
|
|
6445
6496
|
return styleFunctionSx$1({
|
|
6446
6497
|
sx: props,
|
|
@@ -6505,12 +6556,12 @@ function extendSxProp(props) {
|
|
|
6505
6556
|
if (!isPlainObject(result)) {
|
|
6506
6557
|
return systemProps;
|
|
6507
6558
|
}
|
|
6508
|
-
return _extends$
|
|
6559
|
+
return _extends$4({}, systemProps, result);
|
|
6509
6560
|
};
|
|
6510
6561
|
} else {
|
|
6511
|
-
finalSx = _extends$
|
|
6562
|
+
finalSx = _extends$4({}, systemProps, inSx);
|
|
6512
6563
|
}
|
|
6513
|
-
return _extends$
|
|
6564
|
+
return _extends$4({}, otherProps, {
|
|
6514
6565
|
sx: finalSx
|
|
6515
6566
|
});
|
|
6516
6567
|
}
|
|
@@ -6653,10 +6704,10 @@ var getDisplayName = /*#__PURE__*/Object.freeze({
|
|
|
6653
6704
|
* @returns {object} resolved props
|
|
6654
6705
|
*/
|
|
6655
6706
|
function resolveProps(defaultProps, props) {
|
|
6656
|
-
const output = _extends$
|
|
6707
|
+
const output = _extends$3({}, props);
|
|
6657
6708
|
Object.keys(defaultProps).forEach(propName => {
|
|
6658
6709
|
if (propName.toString().match(/^(components|slots)$/)) {
|
|
6659
|
-
output[propName] = _extends$
|
|
6710
|
+
output[propName] = _extends$3({}, defaultProps[propName], output[propName]);
|
|
6660
6711
|
} else if (propName.toString().match(/^(componentsProps|slotProps)$/)) {
|
|
6661
6712
|
const defaultSlotProps = defaultProps[propName] || {};
|
|
6662
6713
|
const slotProps = props[propName];
|
|
@@ -6668,7 +6719,7 @@ function resolveProps(defaultProps, props) {
|
|
|
6668
6719
|
// Reduce the iteration if the default slot props is empty
|
|
6669
6720
|
output[propName] = slotProps;
|
|
6670
6721
|
} else {
|
|
6671
|
-
output[propName] = _extends$
|
|
6722
|
+
output[propName] = _extends$3({}, slotProps);
|
|
6672
6723
|
Object.keys(defaultSlotProps).forEach(slotPropName => {
|
|
6673
6724
|
output[propName][slotPropName] = resolveProps(defaultSlotProps[slotPropName], slotProps[slotPropName]);
|
|
6674
6725
|
});
|
|
@@ -6680,36 +6731,6 @@ function resolveProps(defaultProps, props) {
|
|
|
6680
6731
|
return output;
|
|
6681
6732
|
}
|
|
6682
6733
|
|
|
6683
|
-
function getThemeProps(params) {
|
|
6684
|
-
const {
|
|
6685
|
-
theme,
|
|
6686
|
-
name,
|
|
6687
|
-
props
|
|
6688
|
-
} = params;
|
|
6689
|
-
if (!theme || !theme.components || !theme.components[name] || !theme.components[name].defaultProps) {
|
|
6690
|
-
return props;
|
|
6691
|
-
}
|
|
6692
|
-
return resolveProps(theme.components[name].defaultProps, props);
|
|
6693
|
-
}
|
|
6694
|
-
|
|
6695
|
-
function useThemeProps$1({
|
|
6696
|
-
props,
|
|
6697
|
-
name,
|
|
6698
|
-
defaultTheme,
|
|
6699
|
-
themeId
|
|
6700
|
-
}) {
|
|
6701
|
-
let theme = useTheme$3(defaultTheme);
|
|
6702
|
-
if (themeId) {
|
|
6703
|
-
theme = theme[themeId] || theme;
|
|
6704
|
-
}
|
|
6705
|
-
const mergedProps = getThemeProps({
|
|
6706
|
-
theme,
|
|
6707
|
-
name,
|
|
6708
|
-
props
|
|
6709
|
-
});
|
|
6710
|
-
return mergedProps;
|
|
6711
|
-
}
|
|
6712
|
-
|
|
6713
6734
|
/**
|
|
6714
6735
|
* A version of `React.useLayoutEffect` that does not show a warning when server-side rendering.
|
|
6715
6736
|
* This is useful for effects that are only needed for client-side rendering but not for SSR.
|
|
@@ -6728,6 +6749,21 @@ var clamp = /*#__PURE__*/Object.freeze({
|
|
|
6728
6749
|
default: clamp$1
|
|
6729
6750
|
});
|
|
6730
6751
|
|
|
6752
|
+
function _extends$2() {
|
|
6753
|
+
_extends$2 = Object.assign ? Object.assign.bind() : function (target) {
|
|
6754
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
6755
|
+
var source = arguments[i];
|
|
6756
|
+
for (var key in source) {
|
|
6757
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
6758
|
+
target[key] = source[key];
|
|
6759
|
+
}
|
|
6760
|
+
}
|
|
6761
|
+
}
|
|
6762
|
+
return target;
|
|
6763
|
+
};
|
|
6764
|
+
return _extends$2.apply(this, arguments);
|
|
6765
|
+
}
|
|
6766
|
+
|
|
6731
6767
|
/**
|
|
6732
6768
|
* Safe chained function.
|
|
6733
6769
|
*
|
|
@@ -7125,7 +7161,7 @@ function mergeOuterLocalTheme(outerTheme, localTheme) {
|
|
|
7125
7161
|
const mergedTheme = localTheme(outerTheme);
|
|
7126
7162
|
return mergedTheme;
|
|
7127
7163
|
}
|
|
7128
|
-
return _extends$
|
|
7164
|
+
return _extends$2({}, outerTheme, localTheme);
|
|
7129
7165
|
}
|
|
7130
7166
|
|
|
7131
7167
|
/**
|
|
@@ -7159,18 +7195,62 @@ function RtlProvider(_ref) {
|
|
|
7159
7195
|
value
|
|
7160
7196
|
} = _ref,
|
|
7161
7197
|
props = _objectWithoutPropertiesLoose(_ref, _excluded$e);
|
|
7162
|
-
return /*#__PURE__*/jsxRuntimeExports.jsx(RtlContext.Provider, _extends$
|
|
7198
|
+
return /*#__PURE__*/jsxRuntimeExports.jsx(RtlContext.Provider, _extends$4({
|
|
7163
7199
|
value: value != null ? value : true
|
|
7164
7200
|
}, props));
|
|
7165
7201
|
}
|
|
7166
7202
|
|
|
7203
|
+
const PropsContext = /*#__PURE__*/React.createContext(undefined);
|
|
7204
|
+
function DefaultPropsProvider({
|
|
7205
|
+
value,
|
|
7206
|
+
children
|
|
7207
|
+
}) {
|
|
7208
|
+
return /*#__PURE__*/jsxRuntimeExports.jsx(PropsContext.Provider, {
|
|
7209
|
+
value: value,
|
|
7210
|
+
children: children
|
|
7211
|
+
});
|
|
7212
|
+
}
|
|
7213
|
+
function getThemeProps(params) {
|
|
7214
|
+
const {
|
|
7215
|
+
theme,
|
|
7216
|
+
name,
|
|
7217
|
+
props
|
|
7218
|
+
} = params;
|
|
7219
|
+
if (!theme || !theme.components || !theme.components[name]) {
|
|
7220
|
+
return props;
|
|
7221
|
+
}
|
|
7222
|
+
const config = theme.components[name];
|
|
7223
|
+
if (config.defaultProps) {
|
|
7224
|
+
// compatible with v5 signature
|
|
7225
|
+
return resolveProps(config.defaultProps, props);
|
|
7226
|
+
}
|
|
7227
|
+
if (!config.styleOverrides && !config.variants) {
|
|
7228
|
+
// v6 signature, no property 'defaultProps'
|
|
7229
|
+
return resolveProps(config, props);
|
|
7230
|
+
}
|
|
7231
|
+
return props;
|
|
7232
|
+
}
|
|
7233
|
+
function useDefaultProps$1({
|
|
7234
|
+
props,
|
|
7235
|
+
name
|
|
7236
|
+
}) {
|
|
7237
|
+
const ctx = React.useContext(PropsContext);
|
|
7238
|
+
return getThemeProps({
|
|
7239
|
+
props,
|
|
7240
|
+
name,
|
|
7241
|
+
theme: {
|
|
7242
|
+
components: ctx
|
|
7243
|
+
}
|
|
7244
|
+
});
|
|
7245
|
+
}
|
|
7246
|
+
|
|
7167
7247
|
const EMPTY_THEME = {};
|
|
7168
7248
|
function useThemeScoping(themeId, upperTheme, localTheme, isPrivate = false) {
|
|
7169
7249
|
return React.useMemo(() => {
|
|
7170
7250
|
const resolvedTheme = themeId ? upperTheme[themeId] || upperTheme : upperTheme;
|
|
7171
7251
|
if (typeof localTheme === 'function') {
|
|
7172
7252
|
const mergedTheme = localTheme(resolvedTheme);
|
|
7173
|
-
const result = themeId ? _extends$
|
|
7253
|
+
const result = themeId ? _extends$4({}, upperTheme, {
|
|
7174
7254
|
[themeId]: mergedTheme
|
|
7175
7255
|
}) : mergedTheme;
|
|
7176
7256
|
// must return a function for the private theme to NOT merge with the upper theme.
|
|
@@ -7180,9 +7260,9 @@ function useThemeScoping(themeId, upperTheme, localTheme, isPrivate = false) {
|
|
|
7180
7260
|
}
|
|
7181
7261
|
return result;
|
|
7182
7262
|
}
|
|
7183
|
-
return themeId ? _extends$
|
|
7263
|
+
return themeId ? _extends$4({}, upperTheme, {
|
|
7184
7264
|
[themeId]: localTheme
|
|
7185
|
-
}) : _extends$
|
|
7265
|
+
}) : _extends$4({}, upperTheme, localTheme);
|
|
7186
7266
|
}, [themeId, upperTheme, localTheme, isPrivate]);
|
|
7187
7267
|
}
|
|
7188
7268
|
|
|
@@ -7210,7 +7290,10 @@ function ThemeProvider$1(props) {
|
|
|
7210
7290
|
value: engineTheme,
|
|
7211
7291
|
children: /*#__PURE__*/jsxRuntimeExports.jsx(RtlProvider, {
|
|
7212
7292
|
value: rtlValue,
|
|
7213
|
-
children:
|
|
7293
|
+
children: /*#__PURE__*/jsxRuntimeExports.jsx(DefaultPropsProvider, {
|
|
7294
|
+
value: engineTheme == null ? void 0 : engineTheme.components,
|
|
7295
|
+
children: children
|
|
7296
|
+
})
|
|
7214
7297
|
})
|
|
7215
7298
|
})
|
|
7216
7299
|
});
|
|
@@ -7227,8 +7310,8 @@ function adaptV4Theme(inputTheme) {
|
|
|
7227
7310
|
props = {},
|
|
7228
7311
|
styleOverrides = {}
|
|
7229
7312
|
} = inputTheme,
|
|
7230
|
-
other = _objectWithoutPropertiesLoose(inputTheme, _excluded$d);
|
|
7231
|
-
const theme = _extends$
|
|
7313
|
+
other = _objectWithoutPropertiesLoose$1(inputTheme, _excluded$d);
|
|
7314
|
+
const theme = _extends$5({}, other, {
|
|
7232
7315
|
components: {}
|
|
7233
7316
|
});
|
|
7234
7317
|
|
|
@@ -7262,13 +7345,13 @@ function adaptV4Theme(inputTheme) {
|
|
|
7262
7345
|
// theme.mixins.gutters
|
|
7263
7346
|
const breakpoints = createBreakpoints(inputTheme.breakpoints || {});
|
|
7264
7347
|
const spacing = theme.spacing;
|
|
7265
|
-
theme.mixins = _extends$
|
|
7348
|
+
theme.mixins = _extends$5({
|
|
7266
7349
|
gutters: (styles = {}) => {
|
|
7267
|
-
return _extends$
|
|
7350
|
+
return _extends$5({
|
|
7268
7351
|
paddingLeft: spacing(2),
|
|
7269
7352
|
paddingRight: spacing(2)
|
|
7270
7353
|
}, styles, {
|
|
7271
|
-
[breakpoints.up('sm')]: _extends$
|
|
7354
|
+
[breakpoints.up('sm')]: _extends$5({
|
|
7272
7355
|
paddingLeft: spacing(3),
|
|
7273
7356
|
paddingRight: spacing(3)
|
|
7274
7357
|
}, styles[breakpoints.up('sm')])
|
|
@@ -7279,9 +7362,9 @@ function adaptV4Theme(inputTheme) {
|
|
|
7279
7362
|
type: typeInput,
|
|
7280
7363
|
mode: modeInput
|
|
7281
7364
|
} = palette,
|
|
7282
|
-
paletteRest = _objectWithoutPropertiesLoose(palette, _excluded2$2);
|
|
7365
|
+
paletteRest = _objectWithoutPropertiesLoose$1(palette, _excluded2$2);
|
|
7283
7366
|
const finalMode = modeInput || typeInput || 'light';
|
|
7284
|
-
theme.palette = _extends$
|
|
7367
|
+
theme.palette = _extends$5({
|
|
7285
7368
|
// theme.palette.text.hint
|
|
7286
7369
|
text: {
|
|
7287
7370
|
hint: finalMode === 'dark' ? 'rgba(255, 255, 255, 0.5)' : 'rgba(0, 0, 0, 0.38)'
|
|
@@ -7293,7 +7376,7 @@ function adaptV4Theme(inputTheme) {
|
|
|
7293
7376
|
}
|
|
7294
7377
|
|
|
7295
7378
|
function createMixins(breakpoints, mixins) {
|
|
7296
|
-
return _extends$
|
|
7379
|
+
return _extends$5({
|
|
7297
7380
|
toolbar: {
|
|
7298
7381
|
minHeight: 56,
|
|
7299
7382
|
[breakpoints.up('xs')]: {
|
|
@@ -7310,24 +7393,24 @@ function createMixins(breakpoints, mixins) {
|
|
|
7310
7393
|
|
|
7311
7394
|
var colorManipulator = {};
|
|
7312
7395
|
|
|
7313
|
-
var interopRequireDefault = {exports: {}};
|
|
7396
|
+
var interopRequireDefault$1 = {exports: {}};
|
|
7314
7397
|
|
|
7315
7398
|
(function (module) {
|
|
7316
|
-
function _interopRequireDefault(
|
|
7317
|
-
return
|
|
7318
|
-
"default":
|
|
7399
|
+
function _interopRequireDefault(obj) {
|
|
7400
|
+
return obj && obj.__esModule ? obj : {
|
|
7401
|
+
"default": obj
|
|
7319
7402
|
};
|
|
7320
7403
|
}
|
|
7321
7404
|
module.exports = _interopRequireDefault, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
7322
|
-
} (interopRequireDefault));
|
|
7405
|
+
} (interopRequireDefault$1));
|
|
7323
7406
|
|
|
7324
|
-
var interopRequireDefaultExports = interopRequireDefault.exports;
|
|
7407
|
+
var interopRequireDefaultExports$1 = interopRequireDefault$1.exports;
|
|
7325
7408
|
|
|
7326
7409
|
var require$$1 = /*@__PURE__*/getAugmentedNamespace(formatMuiErrorMessage);
|
|
7327
7410
|
|
|
7328
7411
|
var require$$2 = /*@__PURE__*/getAugmentedNamespace(clamp);
|
|
7329
7412
|
|
|
7330
|
-
var _interopRequireDefault$2 = interopRequireDefaultExports;
|
|
7413
|
+
var _interopRequireDefault$2 = interopRequireDefaultExports$1;
|
|
7331
7414
|
Object.defineProperty(colorManipulator, "__esModule", {
|
|
7332
7415
|
value: true
|
|
7333
7416
|
});
|
|
@@ -7984,7 +8067,7 @@ function createPalette(palette) {
|
|
|
7984
8067
|
contrastThreshold = 3,
|
|
7985
8068
|
tonalOffset = 0.2
|
|
7986
8069
|
} = palette,
|
|
7987
|
-
other = _objectWithoutPropertiesLoose(palette, _excluded$c);
|
|
8070
|
+
other = _objectWithoutPropertiesLoose$1(palette, _excluded$c);
|
|
7988
8071
|
const primary = palette.primary || getDefaultPrimary(mode);
|
|
7989
8072
|
const secondary = palette.secondary || getDefaultSecondary(mode);
|
|
7990
8073
|
const error = palette.error || getDefaultError(mode);
|
|
@@ -8006,7 +8089,7 @@ function createPalette(palette) {
|
|
|
8006
8089
|
lightShade = 300,
|
|
8007
8090
|
darkShade = 700
|
|
8008
8091
|
}) => {
|
|
8009
|
-
color = _extends$
|
|
8092
|
+
color = _extends$5({}, color);
|
|
8010
8093
|
if (!color.main && color[mainShade]) {
|
|
8011
8094
|
color.main = color[mainShade];
|
|
8012
8095
|
}
|
|
@@ -8027,9 +8110,9 @@ function createPalette(palette) {
|
|
|
8027
8110
|
dark: dark$1,
|
|
8028
8111
|
light: light$1
|
|
8029
8112
|
};
|
|
8030
|
-
const paletteOutput = deepmerge$1(_extends$
|
|
8113
|
+
const paletteOutput = deepmerge$1(_extends$5({
|
|
8031
8114
|
// A collection of common colors.
|
|
8032
|
-
common: _extends$
|
|
8115
|
+
common: _extends$5({}, common),
|
|
8033
8116
|
// prevent mutable object.
|
|
8034
8117
|
// The palette mode, can be light or dark.
|
|
8035
8118
|
mode,
|
|
@@ -8114,10 +8197,10 @@ function createTypography(palette, typography) {
|
|
|
8114
8197
|
allVariants,
|
|
8115
8198
|
pxToRem: pxToRem2
|
|
8116
8199
|
} = _ref,
|
|
8117
|
-
other = _objectWithoutPropertiesLoose(_ref, _excluded$b);
|
|
8200
|
+
other = _objectWithoutPropertiesLoose$1(_ref, _excluded$b);
|
|
8118
8201
|
const coef = fontSize / 14;
|
|
8119
8202
|
const pxToRem = pxToRem2 || (size => `${size / htmlFontSize * coef}rem`);
|
|
8120
|
-
const buildVariant = (fontWeight, size, lineHeight, letterSpacing, casing) => _extends$
|
|
8203
|
+
const buildVariant = (fontWeight, size, lineHeight, letterSpacing, casing) => _extends$5({
|
|
8121
8204
|
fontFamily,
|
|
8122
8205
|
fontWeight,
|
|
8123
8206
|
fontSize: pxToRem(size),
|
|
@@ -8149,7 +8232,7 @@ function createTypography(palette, typography) {
|
|
|
8149
8232
|
letterSpacing: 'inherit'
|
|
8150
8233
|
}
|
|
8151
8234
|
};
|
|
8152
|
-
return deepmerge$1(_extends$
|
|
8235
|
+
return deepmerge$1(_extends$5({
|
|
8153
8236
|
htmlFontSize,
|
|
8154
8237
|
pxToRem,
|
|
8155
8238
|
fontFamily,
|
|
@@ -8216,18 +8299,18 @@ function getAutoHeightDuration(height) {
|
|
|
8216
8299
|
return Math.round((4 + 15 * constant ** 0.25 + constant / 5) * 10);
|
|
8217
8300
|
}
|
|
8218
8301
|
function createTransitions(inputTransitions) {
|
|
8219
|
-
const mergedEasing = _extends$
|
|
8220
|
-
const mergedDuration = _extends$
|
|
8302
|
+
const mergedEasing = _extends$5({}, easing, inputTransitions.easing);
|
|
8303
|
+
const mergedDuration = _extends$5({}, duration, inputTransitions.duration);
|
|
8221
8304
|
const create = (props = ['all'], options = {}) => {
|
|
8222
8305
|
const {
|
|
8223
8306
|
duration: durationOption = mergedDuration.standard,
|
|
8224
8307
|
easing: easingOption = mergedEasing.easeInOut,
|
|
8225
8308
|
delay = 0
|
|
8226
8309
|
} = options;
|
|
8227
|
-
_objectWithoutPropertiesLoose(options, _excluded$a);
|
|
8310
|
+
_objectWithoutPropertiesLoose$1(options, _excluded$a);
|
|
8228
8311
|
return (Array.isArray(props) ? props : [props]).map(animatedProp => `${animatedProp} ${typeof durationOption === 'string' ? durationOption : formatMs(durationOption)} ${easingOption} ${typeof delay === 'string' ? delay : formatMs(delay)}`).join(',');
|
|
8229
8312
|
};
|
|
8230
|
-
return _extends$
|
|
8313
|
+
return _extends$5({
|
|
8231
8314
|
getAutoHeightDuration,
|
|
8232
8315
|
create
|
|
8233
8316
|
}, inputTransitions, {
|
|
@@ -8257,7 +8340,7 @@ function createTheme(options = {}, ...args) {
|
|
|
8257
8340
|
transitions: transitionsInput = {},
|
|
8258
8341
|
typography: typographyInput = {}
|
|
8259
8342
|
} = options,
|
|
8260
|
-
other = _objectWithoutPropertiesLoose(options, _excluded$9);
|
|
8343
|
+
other = _objectWithoutPropertiesLoose$1(options, _excluded$9);
|
|
8261
8344
|
if (options.vars) {
|
|
8262
8345
|
throw new Error(formatMuiErrorMessage$1(18));
|
|
8263
8346
|
}
|
|
@@ -8270,11 +8353,11 @@ function createTheme(options = {}, ...args) {
|
|
|
8270
8353
|
shadows: shadows.slice(),
|
|
8271
8354
|
typography: createTypography(palette, typographyInput),
|
|
8272
8355
|
transitions: createTransitions(transitionsInput),
|
|
8273
|
-
zIndex: _extends$
|
|
8356
|
+
zIndex: _extends$5({}, zIndex)
|
|
8274
8357
|
});
|
|
8275
8358
|
muiTheme = deepmerge$1(muiTheme, other);
|
|
8276
8359
|
muiTheme = args.reduce((acc, argument) => deepmerge$1(acc, argument), muiTheme);
|
|
8277
|
-
muiTheme.unstable_sxConfig = _extends$
|
|
8360
|
+
muiTheme.unstable_sxConfig = _extends$5({}, defaultSxConfig, other == null ? void 0 : other.unstable_sxConfig);
|
|
8278
8361
|
muiTheme.unstable_sx = function sx(props) {
|
|
8279
8362
|
return styleFunctionSx$1({
|
|
8280
8363
|
sx: props,
|
|
@@ -8291,40 +8374,33 @@ function useTheme$1() {
|
|
|
8291
8374
|
return theme[THEME_ID] || theme;
|
|
8292
8375
|
}
|
|
8293
8376
|
|
|
8294
|
-
function useThemeProps({
|
|
8295
|
-
props,
|
|
8296
|
-
name
|
|
8297
|
-
}) {
|
|
8298
|
-
return useThemeProps$1({
|
|
8299
|
-
props,
|
|
8300
|
-
name,
|
|
8301
|
-
defaultTheme,
|
|
8302
|
-
themeId: THEME_ID
|
|
8303
|
-
});
|
|
8304
|
-
}
|
|
8305
|
-
|
|
8306
8377
|
var createStyled$1 = {};
|
|
8307
8378
|
|
|
8308
|
-
var _extends = {exports: {}};
|
|
8379
|
+
var _extends$1 = {exports: {}};
|
|
8309
8380
|
|
|
8310
8381
|
var hasRequired_extends;
|
|
8311
8382
|
|
|
8312
8383
|
function require_extends () {
|
|
8313
|
-
if (hasRequired_extends) return _extends.exports;
|
|
8384
|
+
if (hasRequired_extends) return _extends$1.exports;
|
|
8314
8385
|
hasRequired_extends = 1;
|
|
8315
8386
|
(function (module) {
|
|
8316
8387
|
function _extends() {
|
|
8317
|
-
|
|
8318
|
-
for (var
|
|
8319
|
-
var
|
|
8320
|
-
for (var
|
|
8388
|
+
module.exports = _extends = Object.assign ? Object.assign.bind() : function (target) {
|
|
8389
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
8390
|
+
var source = arguments[i];
|
|
8391
|
+
for (var key in source) {
|
|
8392
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
8393
|
+
target[key] = source[key];
|
|
8394
|
+
}
|
|
8395
|
+
}
|
|
8321
8396
|
}
|
|
8322
|
-
return
|
|
8323
|
-
}, module.exports.__esModule = true, module.exports["default"] = module.exports
|
|
8397
|
+
return target;
|
|
8398
|
+
}, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
8399
|
+
return _extends.apply(this, arguments);
|
|
8324
8400
|
}
|
|
8325
8401
|
module.exports = _extends, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
8326
|
-
} (_extends));
|
|
8327
|
-
return _extends.exports;
|
|
8402
|
+
} (_extends$1));
|
|
8403
|
+
return _extends$1.exports;
|
|
8328
8404
|
}
|
|
8329
8405
|
|
|
8330
8406
|
var objectWithoutPropertiesLoose = {exports: {}};
|
|
@@ -8335,14 +8411,17 @@ function requireObjectWithoutPropertiesLoose () {
|
|
|
8335
8411
|
if (hasRequiredObjectWithoutPropertiesLoose) return objectWithoutPropertiesLoose.exports;
|
|
8336
8412
|
hasRequiredObjectWithoutPropertiesLoose = 1;
|
|
8337
8413
|
(function (module) {
|
|
8338
|
-
function _objectWithoutPropertiesLoose(
|
|
8339
|
-
if (
|
|
8340
|
-
var
|
|
8341
|
-
|
|
8342
|
-
|
|
8343
|
-
|
|
8414
|
+
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
8415
|
+
if (source == null) return {};
|
|
8416
|
+
var target = {};
|
|
8417
|
+
var sourceKeys = Object.keys(source);
|
|
8418
|
+
var key, i;
|
|
8419
|
+
for (i = 0; i < sourceKeys.length; i++) {
|
|
8420
|
+
key = sourceKeys[i];
|
|
8421
|
+
if (excluded.indexOf(key) >= 0) continue;
|
|
8422
|
+
target[key] = source[key];
|
|
8344
8423
|
}
|
|
8345
|
-
return
|
|
8424
|
+
return target;
|
|
8346
8425
|
}
|
|
8347
8426
|
module.exports = _objectWithoutPropertiesLoose, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
8348
8427
|
} (objectWithoutPropertiesLoose));
|
|
@@ -8361,7 +8440,7 @@ var require$$7 = /*@__PURE__*/getAugmentedNamespace(createTheme$1);
|
|
|
8361
8440
|
|
|
8362
8441
|
var require$$8 = /*@__PURE__*/getAugmentedNamespace(styleFunctionSx);
|
|
8363
8442
|
|
|
8364
|
-
var _interopRequireDefault$1 = interopRequireDefaultExports;
|
|
8443
|
+
var _interopRequireDefault$1 = interopRequireDefaultExports$1;
|
|
8365
8444
|
Object.defineProperty(createStyled$1, "__esModule", {
|
|
8366
8445
|
value: true
|
|
8367
8446
|
});
|
|
@@ -8612,27 +8691,55 @@ function ThemeProvider(_ref) {
|
|
|
8612
8691
|
let {
|
|
8613
8692
|
theme: themeInput
|
|
8614
8693
|
} = _ref,
|
|
8615
|
-
props = _objectWithoutPropertiesLoose(_ref, _excluded$7);
|
|
8694
|
+
props = _objectWithoutPropertiesLoose$1(_ref, _excluded$7);
|
|
8616
8695
|
const scopedTheme = themeInput[THEME_ID];
|
|
8617
|
-
return /*#__PURE__*/jsxRuntimeExports.jsx(ThemeProvider$1, _extends$
|
|
8696
|
+
return /*#__PURE__*/jsxRuntimeExports.jsx(ThemeProvider$1, _extends$5({}, props, {
|
|
8618
8697
|
themeId: scopedTheme ? THEME_ID : undefined,
|
|
8619
8698
|
theme: scopedTheme || themeInput
|
|
8620
8699
|
}));
|
|
8621
8700
|
}
|
|
8622
8701
|
|
|
8623
|
-
function
|
|
8624
|
-
return
|
|
8625
|
-
|
|
8626
|
-
|
|
8702
|
+
function useDefaultProps(params) {
|
|
8703
|
+
return useDefaultProps$1(params);
|
|
8704
|
+
}
|
|
8705
|
+
|
|
8706
|
+
function _extends() {
|
|
8707
|
+
_extends = Object.assign ? Object.assign.bind() : function (target) {
|
|
8708
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
8709
|
+
var source = arguments[i];
|
|
8710
|
+
|
|
8711
|
+
for (var key in source) {
|
|
8712
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
8713
|
+
target[key] = source[key];
|
|
8714
|
+
}
|
|
8715
|
+
}
|
|
8716
|
+
}
|
|
8717
|
+
|
|
8718
|
+
return target;
|
|
8719
|
+
};
|
|
8720
|
+
return _extends.apply(this, arguments);
|
|
8721
|
+
}
|
|
8722
|
+
|
|
8723
|
+
function _setPrototypeOf(o, p) {
|
|
8724
|
+
_setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
|
|
8725
|
+
o.__proto__ = p;
|
|
8726
|
+
return o;
|
|
8727
|
+
};
|
|
8728
|
+
return _setPrototypeOf(o, p);
|
|
8627
8729
|
}
|
|
8628
8730
|
|
|
8629
|
-
function _inheritsLoose(
|
|
8630
|
-
|
|
8731
|
+
function _inheritsLoose(subClass, superClass) {
|
|
8732
|
+
subClass.prototype = Object.create(superClass.prototype);
|
|
8733
|
+
subClass.prototype.constructor = subClass;
|
|
8734
|
+
_setPrototypeOf(subClass, superClass);
|
|
8631
8735
|
}
|
|
8632
8736
|
|
|
8633
|
-
function _assertThisInitialized(
|
|
8634
|
-
if (
|
|
8635
|
-
|
|
8737
|
+
function _assertThisInitialized(self) {
|
|
8738
|
+
if (self === void 0) {
|
|
8739
|
+
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
8740
|
+
}
|
|
8741
|
+
|
|
8742
|
+
return self;
|
|
8636
8743
|
}
|
|
8637
8744
|
|
|
8638
8745
|
const buttonClasses = generateUtilityClasses('MuiButton', ['root', 'text', 'textInherit', 'textPrimary', 'textSecondary', 'textSuccess', 'textError', 'textInfo', 'textWarning', 'outlined', 'outlinedInherit', 'outlinedPrimary', 'outlinedSecondary', 'outlinedSuccess', 'outlinedError', 'outlinedInfo', 'outlinedWarning', 'contained', 'containedInherit', 'containedPrimary', 'containedSecondary', 'containedSuccess', 'containedError', 'containedInfo', 'containedWarning', 'disableElevation', 'focusVisible', 'disabled', 'colorInherit', 'colorPrimary', 'colorSecondary', 'colorSuccess', 'colorError', 'colorInfo', 'colorWarning', 'textSizeSmall', 'textSizeMedium', 'textSizeLarge', 'outlinedSizeSmall', 'outlinedSizeMedium', 'outlinedSizeLarge', 'containedSizeSmall', 'containedSizeMedium', 'containedSizeLarge', 'sizeMedium', 'sizeSmall', 'sizeLarge', 'fullWidth', 'startIcon', 'endIcon', 'icon', 'iconSizeSmall', 'iconSizeMedium', 'iconSizeLarge']);
|
|
@@ -8974,7 +9081,7 @@ function create$3(definition) {
|
|
|
8974
9081
|
return cache[key];
|
|
8975
9082
|
}
|
|
8976
9083
|
|
|
8977
|
-
const NEBULA_VERSION_HASH = "
|
|
9084
|
+
const NEBULA_VERSION_HASH = "4310";
|
|
8978
9085
|
ClassNameGenerator.configure(componentName => {
|
|
8979
9086
|
return "njs-".concat(NEBULA_VERSION_HASH, "-").concat(componentName.replace('Mui', ''));
|
|
8980
9087
|
});
|
|
@@ -9206,7 +9313,7 @@ function boot(_ref2) {
|
|
|
9206
9313
|
const appRef = React__default.createRef();
|
|
9207
9314
|
const element = document.createElement('div');
|
|
9208
9315
|
element.style.display = 'none';
|
|
9209
|
-
element.setAttribute('data-nebulajs-version', "5.
|
|
9316
|
+
element.setAttribute('data-nebulajs-version', "5.4.0");
|
|
9210
9317
|
element.setAttribute('data-app-id', app.id);
|
|
9211
9318
|
document.body.appendChild(element);
|
|
9212
9319
|
if (context) {
|
|
@@ -9590,7 +9697,7 @@ function SvgIcon$1(_ref) {
|
|
|
9590
9697
|
return (
|
|
9591
9698
|
/*#__PURE__*/
|
|
9592
9699
|
// eslint-disable-next-line react/no-array-index-key
|
|
9593
|
-
React__default.createElement(Type, _extends$
|
|
9700
|
+
React__default.createElement(Type, _extends$6({
|
|
9594
9701
|
key: ix
|
|
9595
9702
|
}, attrs))
|
|
9596
9703
|
);
|
|
@@ -11216,6 +11323,78 @@ const KEYS = Object.freeze({
|
|
|
11216
11323
|
isArrow: key => key === KEYS.ARROW_UP || key === KEYS.ARROW_DOWN || key === KEYS.ARROW_LEFT || key === KEYS.ARROW_RIGHT
|
|
11217
11324
|
});
|
|
11218
11325
|
|
|
11326
|
+
function removeInnnerTabStops(container) {
|
|
11327
|
+
container === null || container === void 0 || container.querySelectorAll('[tabIndex="0"]').forEach(elm => {
|
|
11328
|
+
elm.setAttribute('tabIndex', -1);
|
|
11329
|
+
});
|
|
11330
|
+
}
|
|
11331
|
+
function removeLastFocused(container) {
|
|
11332
|
+
container === null || container === void 0 || container.querySelectorAll('.last-focused').forEach(elm => {
|
|
11333
|
+
elm.classList.remove('last-focused');
|
|
11334
|
+
});
|
|
11335
|
+
}
|
|
11336
|
+
function getVizCell(container) {
|
|
11337
|
+
return (container === null || container === void 0 ? void 0 : container.closest('.njs-cell')) || (container === null || container === void 0 ? void 0 : container.closest('.qv-gridcell')) || (container === null || container === void 0 ? void 0 : container.closest('.qv-gs-listbox'));
|
|
11338
|
+
}
|
|
11339
|
+
|
|
11340
|
+
// Emulate the keyboard hook, until we support it in the Listbox.
|
|
11341
|
+
function useTempKeyboard(_ref) {
|
|
11342
|
+
let {
|
|
11343
|
+
containerRef,
|
|
11344
|
+
enabled
|
|
11345
|
+
} = _ref;
|
|
11346
|
+
const [keyboardActive, setKeyboardActive] = useState$1(false);
|
|
11347
|
+
const keyboard = {
|
|
11348
|
+
enabled,
|
|
11349
|
+
active: keyboardActive,
|
|
11350
|
+
// innerTabStops: whether keyboard permits inner tab stops
|
|
11351
|
+
// (inner = everything inside .listbox-container)
|
|
11352
|
+
|
|
11353
|
+
innerTabStops: !enabled || keyboardActive,
|
|
11354
|
+
blur(resetFocus) {
|
|
11355
|
+
var _containerRef$current;
|
|
11356
|
+
if (!enabled) {
|
|
11357
|
+
return;
|
|
11358
|
+
}
|
|
11359
|
+
setKeyboardActive(false);
|
|
11360
|
+
const vizCell = getVizCell(containerRef.current) || ((_containerRef$current = containerRef.current) === null || _containerRef$current === void 0 ? void 0 : _containerRef$current.parentElement);
|
|
11361
|
+
removeInnnerTabStops(containerRef.current);
|
|
11362
|
+
removeLastFocused(containerRef.current);
|
|
11363
|
+
if (resetFocus && vizCell) {
|
|
11364
|
+
// Move focus to the viz's cell.
|
|
11365
|
+
vizCell.setAttribute('tabIndex', 0);
|
|
11366
|
+
containerRef.current.setAttribute('tabIndex', -1);
|
|
11367
|
+
vizCell.focus();
|
|
11368
|
+
}
|
|
11369
|
+
},
|
|
11370
|
+
focus() {
|
|
11371
|
+
if (!enabled) {
|
|
11372
|
+
return;
|
|
11373
|
+
}
|
|
11374
|
+
setKeyboardActive(true);
|
|
11375
|
+
const c = containerRef.current;
|
|
11376
|
+
const searchField = c === null || c === void 0 ? void 0 : c.querySelector('.search input');
|
|
11377
|
+
const lastSelectedRow = c === null || c === void 0 ? void 0 : c.querySelector('.value.last-focused');
|
|
11378
|
+
const firstRowElement = c === null || c === void 0 ? void 0 : c.querySelector('.value.selector, .value');
|
|
11379
|
+
const confirmButton = c === null || c === void 0 ? void 0 : c.querySelector('.actions-toolbar-default-actions .actions-toolbar-confirm');
|
|
11380
|
+
const unlockCoverButton = c === null || c === void 0 ? void 0 : c.querySelector('#listbox-unlock-button');
|
|
11381
|
+
const cyclicButton = c === null || c === void 0 ? void 0 : c.querySelector('.listbox-cyclic-button');
|
|
11382
|
+
const elementToFocus = cyclicButton || searchField || lastSelectedRow || firstRowElement || unlockCoverButton || confirmButton;
|
|
11383
|
+
elementToFocus === null || elementToFocus === void 0 || elementToFocus.setAttribute('tabIndex', 0);
|
|
11384
|
+
elementToFocus === null || elementToFocus === void 0 || elementToFocus.focus();
|
|
11385
|
+
},
|
|
11386
|
+
focusSelection() {
|
|
11387
|
+
const unlockCoverButton = document.querySelector('#listbox-unlock-button');
|
|
11388
|
+
const confirmButton = document.querySelector('.actions-toolbar-default-actions .actions-toolbar-confirm:not(:disabled)');
|
|
11389
|
+
const btnToFocus = unlockCoverButton || confirmButton;
|
|
11390
|
+
btnToFocus === null || btnToFocus === void 0 || btnToFocus.setAttribute('tabIndex', 0);
|
|
11391
|
+
btnToFocus === null || btnToFocus === void 0 || btnToFocus.focus();
|
|
11392
|
+
return btnToFocus;
|
|
11393
|
+
}
|
|
11394
|
+
};
|
|
11395
|
+
return keyboard;
|
|
11396
|
+
}
|
|
11397
|
+
|
|
11219
11398
|
const getElementIndex = currentTarget => +currentTarget.getAttribute('data-n');
|
|
11220
11399
|
const focusSearch = container => {
|
|
11221
11400
|
const searchField = container === null || container === void 0 ? void 0 : container.querySelector('.search input');
|
|
@@ -11223,10 +11402,49 @@ const focusSearch = container => {
|
|
|
11223
11402
|
return searchField;
|
|
11224
11403
|
};
|
|
11225
11404
|
const focusRow = container => {
|
|
11226
|
-
const
|
|
11227
|
-
|
|
11228
|
-
row === null ||
|
|
11229
|
-
|
|
11405
|
+
const lastFocusedRow = container === null || container === void 0 ? void 0 : container.querySelector('.value.last-focused');
|
|
11406
|
+
const selectorRow = container === null || container === void 0 ? void 0 : container.querySelector('.value.selector');
|
|
11407
|
+
const row = container === null || container === void 0 ? void 0 : container.querySelector('.value');
|
|
11408
|
+
const rowToFocus = lastFocusedRow || selectorRow || row;
|
|
11409
|
+
rowToFocus === null || rowToFocus === void 0 || rowToFocus.setAttribute('tabIndex', 0);
|
|
11410
|
+
rowToFocus === null || rowToFocus === void 0 || rowToFocus.focus();
|
|
11411
|
+
removeLastFocused(container);
|
|
11412
|
+
return rowToFocus;
|
|
11413
|
+
};
|
|
11414
|
+
const focusCyclicButton = container => {
|
|
11415
|
+
const button = container === null || container === void 0 ? void 0 : container.querySelector('.listbox-cyclic-button:not(:disabled)');
|
|
11416
|
+
button === null || button === void 0 || button.setAttribute('tabIndex', 0);
|
|
11417
|
+
button === null || button === void 0 || button.focus();
|
|
11418
|
+
return button;
|
|
11419
|
+
};
|
|
11420
|
+
const blur$1 = (event, keyboard) => {
|
|
11421
|
+
if (!keyboard.enabled) return;
|
|
11422
|
+
const {
|
|
11423
|
+
currentTarget,
|
|
11424
|
+
target
|
|
11425
|
+
} = event;
|
|
11426
|
+
const isFocusedOnListbox = target.classList.contains('listbox-container');
|
|
11427
|
+
const container = currentTarget.closest('.listbox-container');
|
|
11428
|
+
const vizCell = getVizCell(container);
|
|
11429
|
+
const isSingleListbox = (vizCell === null || vizCell === void 0 ? void 0 : vizCell.querySelectorAll('.listbox-container').length) === 1;
|
|
11430
|
+
if (isFocusedOnListbox || isSingleListbox) {
|
|
11431
|
+
// Move the focus from listbox container to the viz container.
|
|
11432
|
+
keyboard.blur(true);
|
|
11433
|
+
} else {
|
|
11434
|
+
// More than one listbox: Move focus from row to listbox container.
|
|
11435
|
+
|
|
11436
|
+
// 1. Remove last-focused class from row siblings.
|
|
11437
|
+
removeLastFocused(container);
|
|
11438
|
+
|
|
11439
|
+
// 2. Add last-focused class so we can re-focus it later.
|
|
11440
|
+
currentTarget.classList.add('last-focused');
|
|
11441
|
+
|
|
11442
|
+
// 3. Blur row and focus the listbox container.
|
|
11443
|
+
keyboard.blur();
|
|
11444
|
+
const c = currentTarget.closest('.listbox-container');
|
|
11445
|
+
c.setAttribute('tabIndex', -1);
|
|
11446
|
+
c === null || c === void 0 || c.focus();
|
|
11447
|
+
}
|
|
11230
11448
|
};
|
|
11231
11449
|
|
|
11232
11450
|
// Find next item index to focus in the dom element list on key up and key down
|
|
@@ -11339,28 +11557,33 @@ function getRowsKeyboardNavigation(_ref) {
|
|
|
11339
11557
|
{
|
|
11340
11558
|
// Try to focus search field, otherwise confirm button.
|
|
11341
11559
|
const container = currentTarget.closest('.listbox-container');
|
|
11342
|
-
const inSelection = isModal();
|
|
11343
|
-
|
|
11560
|
+
const inSelection = typeof isModal !== 'undefined' ? isModal() : undefined;
|
|
11344
11561
|
// TODO: use a store to keep track of this row.
|
|
11345
11562
|
currentTarget.classList.add('last-focused'); // so that we can go back here when we tab back
|
|
11346
11563
|
|
|
11564
|
+
const useDefaultBrowserSupport = !(keyboard !== null && keyboard !== void 0 && keyboard.enabled);
|
|
11565
|
+
if (useDefaultBrowserSupport) {
|
|
11566
|
+
if (!inSelection) return;
|
|
11567
|
+
keyboard.focusSelection();
|
|
11568
|
+
event.preventDefault();
|
|
11569
|
+
event.stopPropagation();
|
|
11570
|
+
return;
|
|
11571
|
+
}
|
|
11347
11572
|
if (shiftKey) {
|
|
11348
|
-
if (!focusSearch(container)) {
|
|
11573
|
+
if (!focusSearch(container) && !focusCyclicButton(container)) {
|
|
11349
11574
|
if (inSelection) {
|
|
11350
11575
|
keyboard.focusSelection();
|
|
11351
11576
|
} else {
|
|
11352
|
-
|
|
11577
|
+
blur$1(event, keyboard);
|
|
11353
11578
|
}
|
|
11354
11579
|
}
|
|
11355
11580
|
break;
|
|
11356
11581
|
}
|
|
11357
11582
|
|
|
11358
11583
|
// Without shift key
|
|
11359
|
-
if (
|
|
11360
|
-
keyboard.focusSelection();
|
|
11361
|
-
} else {
|
|
11584
|
+
if (!keyboard.focusSelection() && !focusCyclicButton(container) && !focusSearch(container)) {
|
|
11362
11585
|
currentTarget.blur();
|
|
11363
|
-
|
|
11586
|
+
blur$1(event, keyboard);
|
|
11364
11587
|
}
|
|
11365
11588
|
break;
|
|
11366
11589
|
}
|
|
@@ -12352,7 +12575,7 @@ function createGridComponent(_ref2) {
|
|
|
12352
12575
|
className: className,
|
|
12353
12576
|
onScroll: this._onScroll,
|
|
12354
12577
|
ref: this._outerRefSetter,
|
|
12355
|
-
style: _extends
|
|
12578
|
+
style: _extends({
|
|
12356
12579
|
position: 'relative',
|
|
12357
12580
|
height: height,
|
|
12358
12581
|
width: width,
|
|
@@ -12851,7 +13074,7 @@ function createListComponent(_ref) {
|
|
|
12851
13074
|
className: className,
|
|
12852
13075
|
onScroll: onScroll,
|
|
12853
13076
|
ref: this._outerRefSetter,
|
|
12854
|
-
style: _extends
|
|
13077
|
+
style: _extends({
|
|
12855
13078
|
position: 'relative',
|
|
12856
13079
|
height: height,
|
|
12857
13080
|
width: width,
|
|
@@ -13406,7 +13629,7 @@ function getListBoxComponents(_ref) {
|
|
|
13406
13629
|
local.current.listRef = ref;
|
|
13407
13630
|
return /*#__PURE__*/React__default.createElement(StyledFixedSizeList
|
|
13408
13631
|
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
13409
|
-
, _extends$
|
|
13632
|
+
, _extends$6({}, commonComponentOptions, {
|
|
13410
13633
|
dataTestid: "fixed-size-list",
|
|
13411
13634
|
scrollDisabled: constraints === null || constraints === void 0 ? void 0 : constraints.active,
|
|
13412
13635
|
height: listHeight,
|
|
@@ -13483,7 +13706,7 @@ function getListBoxComponents(_ref) {
|
|
|
13483
13706
|
};
|
|
13484
13707
|
return /*#__PURE__*/React__default.createElement(StyledFixedSizeGrid
|
|
13485
13708
|
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
13486
|
-
, _extends$
|
|
13709
|
+
, _extends$6({}, commonComponentOptions, {
|
|
13487
13710
|
dataTestid: "fixed-size-grid",
|
|
13488
13711
|
scrollDisabled: constraints === null || constraints === void 0 ? void 0 : constraints.active,
|
|
13489
13712
|
height: gridHeight,
|
|
@@ -13907,6 +14130,19 @@ function ListBoxDisclaimer(_ref2) {
|
|
|
13907
14130
|
|
|
13908
14131
|
var Close$1 = {};
|
|
13909
14132
|
|
|
14133
|
+
var interopRequireDefault = {exports: {}};
|
|
14134
|
+
|
|
14135
|
+
(function (module) {
|
|
14136
|
+
function _interopRequireDefault(obj) {
|
|
14137
|
+
return obj && obj.__esModule ? obj : {
|
|
14138
|
+
"default": obj
|
|
14139
|
+
};
|
|
14140
|
+
}
|
|
14141
|
+
module.exports = _interopRequireDefault, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
14142
|
+
} (interopRequireDefault));
|
|
14143
|
+
|
|
14144
|
+
var interopRequireDefaultExports = interopRequireDefault.exports;
|
|
14145
|
+
|
|
13910
14146
|
var createSvgIcon$1 = {};
|
|
13911
14147
|
|
|
13912
14148
|
function getSvgIconUtilityClass(slot) {
|
|
@@ -13967,7 +14203,7 @@ const SvgIconRoot = styled('svg', {
|
|
|
13967
14203
|
};
|
|
13968
14204
|
});
|
|
13969
14205
|
const SvgIcon = /*#__PURE__*/React.forwardRef(function SvgIcon(inProps, ref) {
|
|
13970
|
-
const props =
|
|
14206
|
+
const props = useDefaultProps({
|
|
13971
14207
|
props: inProps,
|
|
13972
14208
|
name: 'MuiSvgIcon'
|
|
13973
14209
|
});
|
|
@@ -13982,9 +14218,9 @@ const SvgIcon = /*#__PURE__*/React.forwardRef(function SvgIcon(inProps, ref) {
|
|
|
13982
14218
|
titleAccess,
|
|
13983
14219
|
viewBox = '0 0 24 24'
|
|
13984
14220
|
} = props,
|
|
13985
|
-
other = _objectWithoutPropertiesLoose(props, _excluded$5);
|
|
14221
|
+
other = _objectWithoutPropertiesLoose$1(props, _excluded$5);
|
|
13986
14222
|
const hasSvgAsChild = /*#__PURE__*/React.isValidElement(children) && children.type === 'svg';
|
|
13987
|
-
const ownerState = _extends$
|
|
14223
|
+
const ownerState = _extends$5({}, props, {
|
|
13988
14224
|
color,
|
|
13989
14225
|
component,
|
|
13990
14226
|
fontSize,
|
|
@@ -13998,7 +14234,7 @@ const SvgIcon = /*#__PURE__*/React.forwardRef(function SvgIcon(inProps, ref) {
|
|
|
13998
14234
|
more.viewBox = viewBox;
|
|
13999
14235
|
}
|
|
14000
14236
|
const classes = useUtilityClasses(ownerState);
|
|
14001
|
-
return /*#__PURE__*/jsxRuntimeExports.jsxs(SvgIconRoot, _extends$
|
|
14237
|
+
return /*#__PURE__*/jsxRuntimeExports.jsxs(SvgIconRoot, _extends$5({
|
|
14002
14238
|
as: component,
|
|
14003
14239
|
className: clsx(classes.root, className),
|
|
14004
14240
|
focusable: "false",
|
|
@@ -14017,7 +14253,7 @@ SvgIcon.muiName = 'SvgIcon';
|
|
|
14017
14253
|
|
|
14018
14254
|
function createSvgIcon(path, displayName) {
|
|
14019
14255
|
function Component(props, ref) {
|
|
14020
|
-
return /*#__PURE__*/jsxRuntimeExports.jsx(SvgIcon, _extends$
|
|
14256
|
+
return /*#__PURE__*/jsxRuntimeExports.jsx(SvgIcon, _extends$5({
|
|
14021
14257
|
"data-testid": `${displayName}Icon`,
|
|
14022
14258
|
ref: ref
|
|
14023
14259
|
}, props, {
|
|
@@ -15006,14 +15242,11 @@ const More$1 = React__default.forwardRef((_ref3, ref) => {
|
|
|
15006
15242
|
const autoFocusIndex = actions.findIndex(action => !action.disabled);
|
|
15007
15243
|
return showActions && /*#__PURE__*/React__default.createElement(StyledPopover$1
|
|
15008
15244
|
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
15009
|
-
, _extends$
|
|
15245
|
+
, _extends$6({}, popoverProps, {
|
|
15010
15246
|
onClose: onCloseOrActionClick,
|
|
15011
15247
|
ref: ref,
|
|
15012
15248
|
open: show,
|
|
15013
15249
|
anchorEl: alignTo.current,
|
|
15014
|
-
getContentAnchorEl: null,
|
|
15015
|
-
container: alignTo.current,
|
|
15016
|
-
disablePortal: true,
|
|
15017
15250
|
hideBackdrop: true,
|
|
15018
15251
|
transitionDuration: 0,
|
|
15019
15252
|
slotProps: {
|
|
@@ -15433,7 +15666,7 @@ const StyledIconButton = styled(IconButton)(() => ({
|
|
|
15433
15666
|
boxShadow: 'inset 0 0 0 2px rgb(2, 117, 217)'
|
|
15434
15667
|
}
|
|
15435
15668
|
}));
|
|
15436
|
-
function ListBoxSearch(_ref2) {
|
|
15669
|
+
function ListBoxSearch(_ref2, ref) {
|
|
15437
15670
|
let {
|
|
15438
15671
|
popoverOpen,
|
|
15439
15672
|
selections,
|
|
@@ -15443,6 +15676,7 @@ function ListBoxSearch(_ref2) {
|
|
|
15443
15676
|
dense = false,
|
|
15444
15677
|
visible = true,
|
|
15445
15678
|
autoFocus = true,
|
|
15679
|
+
beginSelectionOnFocus = true,
|
|
15446
15680
|
wildCardSearch = false,
|
|
15447
15681
|
searchEnabled,
|
|
15448
15682
|
direction,
|
|
@@ -15500,11 +15734,20 @@ function ListBoxSearch(_ref2) {
|
|
|
15500
15734
|
}
|
|
15501
15735
|
return model.searchListObjectFor(TREE_PATH, searchValue);
|
|
15502
15736
|
};
|
|
15737
|
+
const beginSelection = () => {
|
|
15738
|
+
const shouldBeginSelection = !selectionState.selectDisabled() && !selections.isModal();
|
|
15739
|
+
if (shouldBeginSelection) {
|
|
15740
|
+
selections.begin('/qListObjectDef');
|
|
15741
|
+
}
|
|
15742
|
+
};
|
|
15503
15743
|
const handleFocus = () => {
|
|
15504
15744
|
if (wildCardSearch) {
|
|
15505
15745
|
setValue(WILDCARD);
|
|
15506
15746
|
setWildcardOn(true);
|
|
15507
15747
|
}
|
|
15748
|
+
if (beginSelectionOnFocus) {
|
|
15749
|
+
beginSelection();
|
|
15750
|
+
}
|
|
15508
15751
|
};
|
|
15509
15752
|
const hasHits = () => {
|
|
15510
15753
|
const listCount = getStoreValue("listCount");
|
|
@@ -15526,11 +15769,6 @@ function ListBoxSearch(_ref2) {
|
|
|
15526
15769
|
}
|
|
15527
15770
|
return response;
|
|
15528
15771
|
};
|
|
15529
|
-
function focusRow(container) {
|
|
15530
|
-
const row = (container === null || container === void 0 ? void 0 : container.querySelector('.last-focused')) || (container === null || container === void 0 ? void 0 : container.querySelector('[role="row"]:first-child'));
|
|
15531
|
-
row === null || row === void 0 || row.setAttribute('tabIndex', 0);
|
|
15532
|
-
row === null || row === void 0 || row.focus();
|
|
15533
|
-
}
|
|
15534
15772
|
const onKeyDown = async e => {
|
|
15535
15773
|
const {
|
|
15536
15774
|
currentTarget
|
|
@@ -15552,17 +15790,14 @@ function ListBoxSearch(_ref2) {
|
|
|
15552
15790
|
case 'Tab':
|
|
15553
15791
|
{
|
|
15554
15792
|
if (e.shiftKey) {
|
|
15555
|
-
|
|
15793
|
+
if (!focusCyclicButton(container)) {
|
|
15794
|
+
keyboard.focusSelection();
|
|
15795
|
+
}
|
|
15556
15796
|
} else if (clearSearchRef.current) {
|
|
15557
15797
|
clearSearchRef.current.focus();
|
|
15558
15798
|
} else {
|
|
15559
15799
|
// Focus the row we last visited or the first one.
|
|
15560
15800
|
focusRow(container);
|
|
15561
|
-
|
|
15562
|
-
// Clean up.
|
|
15563
|
-
container === null || container === void 0 || container.querySelectorAll('.last-focused').forEach(elm => {
|
|
15564
|
-
elm.classList.remove('last-focused');
|
|
15565
|
-
});
|
|
15566
15801
|
}
|
|
15567
15802
|
break;
|
|
15568
15803
|
}
|
|
@@ -15593,7 +15828,7 @@ function ListBoxSearch(_ref2) {
|
|
|
15593
15828
|
abortSearch();
|
|
15594
15829
|
focusOnInput();
|
|
15595
15830
|
};
|
|
15596
|
-
const onKeyDownClearSearch =
|
|
15831
|
+
const onKeyDownClearSearch = e => {
|
|
15597
15832
|
const container = e.currentTarget.closest('.listbox-container');
|
|
15598
15833
|
switch (e.key) {
|
|
15599
15834
|
case 'Enter':
|
|
@@ -15606,11 +15841,6 @@ function ListBoxSearch(_ref2) {
|
|
|
15606
15841
|
} else {
|
|
15607
15842
|
// Focus the row we last visited or the first one.
|
|
15608
15843
|
focusRow(container);
|
|
15609
|
-
|
|
15610
|
-
// Clean up.
|
|
15611
|
-
container === null || container === void 0 || container.querySelectorAll('.last-focused').forEach(elm => {
|
|
15612
|
-
elm.classList.remove('last-focused');
|
|
15613
|
-
});
|
|
15614
15844
|
}
|
|
15615
15845
|
break;
|
|
15616
15846
|
}
|
|
@@ -15621,6 +15851,11 @@ function ListBoxSearch(_ref2) {
|
|
|
15621
15851
|
e.stopPropagation();
|
|
15622
15852
|
return undefined;
|
|
15623
15853
|
};
|
|
15854
|
+
useImperativeHandle$1(ref, () => ({
|
|
15855
|
+
focus() {
|
|
15856
|
+
focusOnInput();
|
|
15857
|
+
}
|
|
15858
|
+
}));
|
|
15624
15859
|
if (!visible || searchEnabled === false) {
|
|
15625
15860
|
return null;
|
|
15626
15861
|
}
|
|
@@ -15668,6 +15903,7 @@ function ListBoxSearch(_ref2) {
|
|
|
15668
15903
|
}
|
|
15669
15904
|
});
|
|
15670
15905
|
}
|
|
15906
|
+
var ListBoxSearch$1 = forwardRef(ListBoxSearch);
|
|
15671
15907
|
|
|
15672
15908
|
/* eslint no-underscore-dangle: 0 */
|
|
15673
15909
|
function createAppSelections(_ref) {
|
|
@@ -18200,13 +18436,19 @@ function ListBoxPopover(_ref) {
|
|
|
18200
18436
|
components,
|
|
18201
18437
|
checkboxes: checkboxesOption,
|
|
18202
18438
|
selectDisabled = () => false,
|
|
18203
|
-
flags
|
|
18439
|
+
flags,
|
|
18440
|
+
sortCriteria = [{
|
|
18441
|
+
qSortByState: 1,
|
|
18442
|
+
qSortByAscii: 1,
|
|
18443
|
+
qSortByNumeric: 1,
|
|
18444
|
+
qSortByLoadOrder: 1
|
|
18445
|
+
}]
|
|
18204
18446
|
} = _ref;
|
|
18205
18447
|
const isMasterDim = Boolean(fieldName === null || fieldName === void 0 ? void 0 : fieldName.qLibraryId);
|
|
18206
18448
|
const open = show && Boolean(alignTo.current);
|
|
18207
18449
|
const [listCount, setListCount] = useState$1(0);
|
|
18208
18450
|
const theme = useTheme$1();
|
|
18209
|
-
const
|
|
18451
|
+
const searchInputRef = useRef();
|
|
18210
18452
|
const [model] = useSessionModel({
|
|
18211
18453
|
qInfo: {
|
|
18212
18454
|
qType: 'njsListbox'
|
|
@@ -18221,12 +18463,7 @@ function ListBoxPopover(_ref) {
|
|
|
18221
18463
|
qHeight: 0
|
|
18222
18464
|
}],
|
|
18223
18465
|
qDef: {
|
|
18224
|
-
qSortCriterias:
|
|
18225
|
-
qSortByState: 1,
|
|
18226
|
-
qSortByAscii: 1,
|
|
18227
|
-
qSortByNumeric: 1,
|
|
18228
|
-
qSortByLoadOrder: 1
|
|
18229
|
-
}],
|
|
18466
|
+
qSortCriterias: sortCriteria,
|
|
18230
18467
|
qFieldDefs: isMasterDim ? undefined : [fieldName]
|
|
18231
18468
|
},
|
|
18232
18469
|
qLibraryId: isMasterDim ? fieldName.qLibraryId : undefined
|
|
@@ -18240,7 +18477,8 @@ function ListBoxPopover(_ref) {
|
|
|
18240
18477
|
}, [model]);
|
|
18241
18478
|
const {
|
|
18242
18479
|
translator,
|
|
18243
|
-
themeApi
|
|
18480
|
+
themeApi,
|
|
18481
|
+
keyboardNavigation
|
|
18244
18482
|
} = useContext(InstanceContext);
|
|
18245
18483
|
const moreAlignTo = useRef();
|
|
18246
18484
|
const containerRef = useRef();
|
|
@@ -18249,10 +18487,14 @@ function ListBoxPopover(_ref) {
|
|
|
18249
18487
|
const [selectionState$1] = useState$1(() => selectionState({
|
|
18250
18488
|
selectDisabled
|
|
18251
18489
|
}));
|
|
18490
|
+
const keyboard = useTempKeyboard({
|
|
18491
|
+
containerRef,
|
|
18492
|
+
enabled: keyboardNavigation
|
|
18493
|
+
});
|
|
18252
18494
|
const {
|
|
18253
18495
|
checkboxes = checkboxesOption
|
|
18254
18496
|
} = layout || {};
|
|
18255
|
-
const themeSelectionColorsEnabled = flags.isEnabled('PS_22149_THEME_SELECTION_COLORS');
|
|
18497
|
+
const themeSelectionColorsEnabled = flags === null || flags === void 0 ? void 0 : flags.isEnabled('PS_22149_THEME_SELECTION_COLORS');
|
|
18256
18498
|
const styles = getStyles({
|
|
18257
18499
|
themeApi,
|
|
18258
18500
|
theme,
|
|
@@ -18280,14 +18522,15 @@ function ListBoxPopover(_ref) {
|
|
|
18280
18522
|
layout,
|
|
18281
18523
|
model,
|
|
18282
18524
|
translator,
|
|
18283
|
-
selectionState: selectionState$1
|
|
18525
|
+
selectionState: selectionState$1,
|
|
18526
|
+
selections
|
|
18284
18527
|
});
|
|
18285
18528
|
const onCtrlF = () => {
|
|
18286
|
-
|
|
18287
|
-
input === null || input === void 0 || input.focus();
|
|
18529
|
+
searchInputRef.current.focus();
|
|
18288
18530
|
};
|
|
18289
18531
|
const hasSelections$1 = hasSelections(layout);
|
|
18290
18532
|
return /*#__PURE__*/React__default.createElement(Popover, {
|
|
18533
|
+
className: "listbox-container",
|
|
18291
18534
|
open: open,
|
|
18292
18535
|
onClose: popoverClose,
|
|
18293
18536
|
anchorEl: alignTo.current,
|
|
@@ -18357,9 +18600,9 @@ function ListBoxPopover(_ref) {
|
|
|
18357
18600
|
}, /*#__PURE__*/React__default.createElement("div", {
|
|
18358
18601
|
ref: moreAlignTo
|
|
18359
18602
|
}), /*#__PURE__*/React__default.createElement(Grid, {
|
|
18360
|
-
item: true
|
|
18361
|
-
|
|
18362
|
-
|
|
18603
|
+
item: true
|
|
18604
|
+
}, /*#__PURE__*/React__default.createElement(ListBoxSearch$1, {
|
|
18605
|
+
ref: searchInputRef,
|
|
18363
18606
|
popoverOpen: open,
|
|
18364
18607
|
styles: styles,
|
|
18365
18608
|
visible: true,
|
|
@@ -18368,7 +18611,9 @@ function ListBoxPopover(_ref) {
|
|
|
18368
18611
|
selections: selections,
|
|
18369
18612
|
selectionState: selectionState$1,
|
|
18370
18613
|
keyboard: {
|
|
18371
|
-
enabled: false
|
|
18614
|
+
enabled: false,
|
|
18615
|
+
innerTabStops: true,
|
|
18616
|
+
focusSelection: keyboard.focusSelection
|
|
18372
18617
|
},
|
|
18373
18618
|
autoFocus: autoFocus !== null && autoFocus !== void 0 ? autoFocus : true
|
|
18374
18619
|
})), /*#__PURE__*/React__default.createElement(ListBox, {
|
|
@@ -18380,7 +18625,8 @@ function ListBoxPopover(_ref) {
|
|
|
18380
18625
|
direction: "ltr",
|
|
18381
18626
|
onSetListCount: c => setListCount(c),
|
|
18382
18627
|
onCtrlF: onCtrlF,
|
|
18383
|
-
styles: styles
|
|
18628
|
+
styles: styles,
|
|
18629
|
+
keyboard: keyboard
|
|
18384
18630
|
}))));
|
|
18385
18631
|
}
|
|
18386
18632
|
|
|
@@ -19537,114 +19783,17 @@ class AutoSizer extends Component {
|
|
|
19537
19783
|
}
|
|
19538
19784
|
}
|
|
19539
19785
|
|
|
19540
|
-
|
|
19541
|
-
|
|
19542
|
-
elm.setAttribute('tabIndex', -1);
|
|
19543
|
-
});
|
|
19544
|
-
}
|
|
19545
|
-
function removeLastFocused(container) {
|
|
19546
|
-
container === null || container === void 0 || container.querySelectorAll('.last-focused').forEach(elm => {
|
|
19547
|
-
elm.classList.remove('last-focused');
|
|
19548
|
-
});
|
|
19549
|
-
}
|
|
19550
|
-
function getVizCell(container) {
|
|
19551
|
-
return (container === null || container === void 0 ? void 0 : container.closest('.njs-cell')) || (container === null || container === void 0 ? void 0 : container.closest('.qv-gridcell'));
|
|
19552
|
-
}
|
|
19553
|
-
|
|
19554
|
-
// Emulate the keyboard hook, until we support it in the Listbox.
|
|
19555
|
-
function useTempKeyboard(_ref) {
|
|
19786
|
+
/* eslint-disable no-param-reassign */
|
|
19787
|
+
function getListboxContainerKeyboardNavigation(_ref) {
|
|
19556
19788
|
let {
|
|
19557
|
-
|
|
19558
|
-
|
|
19789
|
+
keyboard,
|
|
19790
|
+
hovering,
|
|
19791
|
+
updateKeyScroll,
|
|
19792
|
+
currentScrollIndex,
|
|
19793
|
+
isModal,
|
|
19794
|
+
constraints,
|
|
19795
|
+
selections
|
|
19559
19796
|
} = _ref;
|
|
19560
|
-
const [keyboardActive, setKeyboardActive] = useState$1(false);
|
|
19561
|
-
const keyboard = {
|
|
19562
|
-
enabled,
|
|
19563
|
-
active: keyboardActive,
|
|
19564
|
-
// innerTabStops: whether keyboard permits inner tab stops
|
|
19565
|
-
// (inner = everything inside .listbox-container)
|
|
19566
|
-
|
|
19567
|
-
innerTabStops: !enabled || keyboardActive,
|
|
19568
|
-
blur(resetFocus) {
|
|
19569
|
-
var _containerRef$current;
|
|
19570
|
-
if (!enabled) {
|
|
19571
|
-
return;
|
|
19572
|
-
}
|
|
19573
|
-
setKeyboardActive(false);
|
|
19574
|
-
const vizCell = getVizCell(containerRef.current) || ((_containerRef$current = containerRef.current) === null || _containerRef$current === void 0 ? void 0 : _containerRef$current.parentElement);
|
|
19575
|
-
removeInnnerTabStops(containerRef.current);
|
|
19576
|
-
removeLastFocused(containerRef.current);
|
|
19577
|
-
if (resetFocus && vizCell) {
|
|
19578
|
-
// Move focus to the viz's cell.
|
|
19579
|
-
vizCell.setAttribute('tabIndex', 0);
|
|
19580
|
-
vizCell.focus();
|
|
19581
|
-
}
|
|
19582
|
-
},
|
|
19583
|
-
focus() {
|
|
19584
|
-
if (!enabled) {
|
|
19585
|
-
return;
|
|
19586
|
-
}
|
|
19587
|
-
setKeyboardActive(true);
|
|
19588
|
-
const c = containerRef.current;
|
|
19589
|
-
const searchField = c === null || c === void 0 ? void 0 : c.querySelector('.search input');
|
|
19590
|
-
const lastSelectedRow = c === null || c === void 0 ? void 0 : c.querySelector('.value.last-focused');
|
|
19591
|
-
const firstRowElement = c === null || c === void 0 ? void 0 : c.querySelector('.value.selector, .value');
|
|
19592
|
-
const confirmButton = c === null || c === void 0 ? void 0 : c.querySelector('.actions-toolbar-default-actions .actions-toolbar-confirm');
|
|
19593
|
-
const unlockCoverButton = c === null || c === void 0 ? void 0 : c.querySelector('#listbox-unlock-button');
|
|
19594
|
-
const elementToFocus = searchField || lastSelectedRow || firstRowElement || unlockCoverButton || confirmButton;
|
|
19595
|
-
elementToFocus === null || elementToFocus === void 0 || elementToFocus.setAttribute('tabIndex', 0);
|
|
19596
|
-
elementToFocus === null || elementToFocus === void 0 || elementToFocus.focus();
|
|
19597
|
-
},
|
|
19598
|
-
focusSelection() {
|
|
19599
|
-
const unlockCoverButton = document.querySelector('#listbox-unlock-button');
|
|
19600
|
-
const confirmButton = document.querySelector('.actions-toolbar-default-actions .actions-toolbar-confirm');
|
|
19601
|
-
const btnToFocus = unlockCoverButton || confirmButton;
|
|
19602
|
-
btnToFocus === null || btnToFocus === void 0 || btnToFocus.setAttribute('tabIndex', 0);
|
|
19603
|
-
btnToFocus === null || btnToFocus === void 0 || btnToFocus.focus();
|
|
19604
|
-
}
|
|
19605
|
-
};
|
|
19606
|
-
return keyboard;
|
|
19607
|
-
}
|
|
19608
|
-
|
|
19609
|
-
/* eslint-disable no-param-reassign */
|
|
19610
|
-
function getListboxContainerKeyboardNavigation(_ref) {
|
|
19611
|
-
let {
|
|
19612
|
-
keyboard,
|
|
19613
|
-
hovering,
|
|
19614
|
-
updateKeyScroll,
|
|
19615
|
-
containerRef,
|
|
19616
|
-
currentScrollIndex,
|
|
19617
|
-
isModal,
|
|
19618
|
-
constraints
|
|
19619
|
-
} = _ref;
|
|
19620
|
-
const blur = event => {
|
|
19621
|
-
const {
|
|
19622
|
-
currentTarget,
|
|
19623
|
-
target
|
|
19624
|
-
} = event;
|
|
19625
|
-
const isFocusedOnListbox = target.classList.contains('listbox-container');
|
|
19626
|
-
const container = currentTarget.closest('.listbox-container');
|
|
19627
|
-
const vizCell = getVizCell(container);
|
|
19628
|
-
const isSingleListbox = (vizCell === null || vizCell === void 0 ? void 0 : vizCell.querySelectorAll('.listbox-container').length) === 1;
|
|
19629
|
-
if (isFocusedOnListbox || isSingleListbox) {
|
|
19630
|
-
// Move the focus from listbox container to the viz container.
|
|
19631
|
-
keyboard.blur(true);
|
|
19632
|
-
} else {
|
|
19633
|
-
// More than one listbox: Move focus from row to listbox container.
|
|
19634
|
-
|
|
19635
|
-
// 1. Remove last-focused class from row siblings.
|
|
19636
|
-
removeLastFocused(containerRef.current);
|
|
19637
|
-
|
|
19638
|
-
// 2. Add last-focused class so we can re-focus it later.
|
|
19639
|
-
currentTarget.classList.add('last-focused');
|
|
19640
|
-
|
|
19641
|
-
// 3. Blur row and focus the listbox container.
|
|
19642
|
-
keyboard.blur();
|
|
19643
|
-
const c = currentTarget.closest('.listbox-container');
|
|
19644
|
-
c.setAttribute('tabIndex', -1);
|
|
19645
|
-
c === null || c === void 0 || c.focus();
|
|
19646
|
-
}
|
|
19647
|
-
};
|
|
19648
19797
|
const handleKeyDown = event => {
|
|
19649
19798
|
const {
|
|
19650
19799
|
keyCode,
|
|
@@ -19662,16 +19811,18 @@ function getListboxContainerKeyboardNavigation(_ref) {
|
|
|
19662
19811
|
const inSelection = isModal();
|
|
19663
19812
|
switch (keyCode) {
|
|
19664
19813
|
case KEYS.TAB:
|
|
19665
|
-
|
|
19666
|
-
|
|
19667
|
-
|
|
19668
|
-
|
|
19669
|
-
|
|
19814
|
+
// Only react to tab after enter/space have been pressed or the target element is inside listbox (mouse case) or target is selection toolbar
|
|
19815
|
+
if (document.activeElement === container || !inSelection && !container.contains(document.activeElement)) return;
|
|
19816
|
+
if (shiftKey) {
|
|
19817
|
+
const focused = focusRow(container) || focusSearch(container);
|
|
19818
|
+
if (!focused) {
|
|
19819
|
+
blur$1(event, keyboard);
|
|
19670
19820
|
}
|
|
19671
|
-
} else if (shiftKey) {
|
|
19672
|
-
keyboard.blur(true);
|
|
19673
19821
|
} else {
|
|
19674
|
-
|
|
19822
|
+
const focused = focusCyclicButton(container) || focusSearch(container) || focusRow(container);
|
|
19823
|
+
if (!focused) {
|
|
19824
|
+
break;
|
|
19825
|
+
}
|
|
19675
19826
|
}
|
|
19676
19827
|
prevent();
|
|
19677
19828
|
break;
|
|
@@ -19684,7 +19835,10 @@ function getListboxContainerKeyboardNavigation(_ref) {
|
|
|
19684
19835
|
prevent();
|
|
19685
19836
|
break;
|
|
19686
19837
|
case KEYS.ESCAPE:
|
|
19687
|
-
blur(event);
|
|
19838
|
+
blur$1(event, keyboard);
|
|
19839
|
+
if (selections.isActive()) {
|
|
19840
|
+
selections.cancel();
|
|
19841
|
+
}
|
|
19688
19842
|
break;
|
|
19689
19843
|
}
|
|
19690
19844
|
};
|
|
@@ -19847,8 +20001,7 @@ function getListboxActionProps(_ref) {
|
|
|
19847
20001
|
},
|
|
19848
20002
|
extraItems,
|
|
19849
20003
|
more: {
|
|
19850
|
-
enabled: !isLocked
|
|
19851
|
-
// show more button even when popover is not in selection mode
|
|
20004
|
+
enabled: !isLocked,
|
|
19852
20005
|
actions: listboxSelectionToolbarItems,
|
|
19853
20006
|
popoverProps: {
|
|
19854
20007
|
elevation: 0
|
|
@@ -19859,7 +20012,7 @@ function getListboxActionProps(_ref) {
|
|
|
19859
20012
|
}
|
|
19860
20013
|
},
|
|
19861
20014
|
selections: {
|
|
19862
|
-
show: showToolbar
|
|
20015
|
+
show: showToolbar,
|
|
19863
20016
|
api: selections,
|
|
19864
20017
|
onConfirm: () => {
|
|
19865
20018
|
keyboard === null || keyboard === void 0 || keyboard.focus();
|
|
@@ -20002,7 +20155,8 @@ const createDimensionIconData = _ref => {
|
|
|
20002
20155
|
app,
|
|
20003
20156
|
selections,
|
|
20004
20157
|
isPopover,
|
|
20005
|
-
active
|
|
20158
|
+
active,
|
|
20159
|
+
keyboard
|
|
20006
20160
|
} = _ref;
|
|
20007
20161
|
switch (dimInfo.qGrouping) {
|
|
20008
20162
|
case dimensionTypes.drillDown:
|
|
@@ -20014,21 +20168,52 @@ const createDimensionIconData = _ref => {
|
|
|
20014
20168
|
case dimensionTypes.cyclic:
|
|
20015
20169
|
{
|
|
20016
20170
|
const clickable = app && active;
|
|
20171
|
+
const stepToNextField = () => {
|
|
20172
|
+
if (!isPopover) {
|
|
20173
|
+
selections.confirm();
|
|
20174
|
+
}
|
|
20175
|
+
app.getDimension(dimInfo.qLibraryId).then(dimensionModel => {
|
|
20176
|
+
if (!dimensionModel.stepCycle) {
|
|
20177
|
+
// eslint-disable-next-line no-console
|
|
20178
|
+
console.log("engine api spec version doesn't have support for function stepCycle");
|
|
20179
|
+
return;
|
|
20180
|
+
}
|
|
20181
|
+
dimensionModel.stepCycle(1);
|
|
20182
|
+
}).catch(() => null);
|
|
20183
|
+
};
|
|
20017
20184
|
return {
|
|
20018
20185
|
icon: clickable ? ReloadIcon : CyclicIcon,
|
|
20019
20186
|
tooltip: 'Listbox.Cyclic',
|
|
20020
|
-
onClick: clickable ?
|
|
20021
|
-
|
|
20022
|
-
|
|
20023
|
-
|
|
20024
|
-
|
|
20025
|
-
|
|
20026
|
-
|
|
20027
|
-
|
|
20187
|
+
onClick: clickable ? stepToNextField : undefined,
|
|
20188
|
+
onKeyDown: clickable ? event => {
|
|
20189
|
+
const container = event.currentTarget.closest('.listbox-container');
|
|
20190
|
+
switch (event.keyCode) {
|
|
20191
|
+
case KEYS.SPACE:
|
|
20192
|
+
case KEYS.ENTER:
|
|
20193
|
+
stepToNextField();
|
|
20194
|
+
break;
|
|
20195
|
+
case KEYS.TAB:
|
|
20196
|
+
{
|
|
20197
|
+
const useDefaultBrowserSupport = !keyboard.enabled;
|
|
20198
|
+
if (useDefaultBrowserSupport) {
|
|
20199
|
+
return;
|
|
20200
|
+
}
|
|
20201
|
+
let focused;
|
|
20202
|
+
if (event.shiftKey) {
|
|
20203
|
+
focused = keyboard.focusSelection();
|
|
20204
|
+
} else {
|
|
20205
|
+
focused = focusSearch(container) || focusRow(container);
|
|
20206
|
+
}
|
|
20207
|
+
if (!focused) {
|
|
20208
|
+
blur$1(event, keyboard);
|
|
20209
|
+
}
|
|
20210
|
+
}
|
|
20211
|
+
break;
|
|
20212
|
+
default:
|
|
20028
20213
|
return;
|
|
20029
|
-
|
|
20030
|
-
|
|
20031
|
-
|
|
20214
|
+
}
|
|
20215
|
+
event.preventDefault();
|
|
20216
|
+
event.stopPropagation();
|
|
20032
20217
|
} : undefined
|
|
20033
20218
|
};
|
|
20034
20219
|
}
|
|
@@ -20052,13 +20237,15 @@ function DimensionIcon(_ref) {
|
|
|
20052
20237
|
iconData,
|
|
20053
20238
|
translator,
|
|
20054
20239
|
iconStyle,
|
|
20055
|
-
disabled
|
|
20240
|
+
disabled,
|
|
20241
|
+
keyboard
|
|
20056
20242
|
} = _ref;
|
|
20057
20243
|
if (!iconData) return undefined;
|
|
20058
20244
|
const {
|
|
20059
20245
|
icon,
|
|
20060
20246
|
tooltip,
|
|
20061
|
-
onClick
|
|
20247
|
+
onClick = undefined,
|
|
20248
|
+
onKeyDown = undefined
|
|
20062
20249
|
} = iconData;
|
|
20063
20250
|
const Icon = icon;
|
|
20064
20251
|
const title = translator.get(tooltip);
|
|
@@ -20066,11 +20253,14 @@ function DimensionIcon(_ref) {
|
|
|
20066
20253
|
return isButton ? /*#__PURE__*/React__default.createElement(StyledButton, {
|
|
20067
20254
|
variant: "outlined",
|
|
20068
20255
|
onClick: onClick,
|
|
20069
|
-
tabIndex: -1,
|
|
20256
|
+
tabIndex: keyboard.innerTabStops ? 0 : -1,
|
|
20070
20257
|
title: title,
|
|
20071
20258
|
size: "large",
|
|
20072
20259
|
disableRipple: true,
|
|
20073
|
-
disabled: disabled
|
|
20260
|
+
disabled: disabled,
|
|
20261
|
+
onKeyDown: onKeyDown,
|
|
20262
|
+
className: "listbox-cyclic-button",
|
|
20263
|
+
"data-testid": "listbox-cyclic-button"
|
|
20074
20264
|
}, /*#__PURE__*/React__default.createElement(Icon, {
|
|
20075
20265
|
style: iconStyle
|
|
20076
20266
|
})) : /*#__PURE__*/React__default.createElement(Icon, {
|
|
@@ -20153,7 +20343,8 @@ function ListBoxHeader(_ref2) {
|
|
|
20153
20343
|
app,
|
|
20154
20344
|
selections,
|
|
20155
20345
|
isPopover,
|
|
20156
|
-
active: !(constraints !== null && constraints !== void 0 && constraints.active)
|
|
20346
|
+
active: !(constraints !== null && constraints !== void 0 && constraints.active),
|
|
20347
|
+
keyboard
|
|
20157
20348
|
});
|
|
20158
20349
|
const showUnlock = showLock && isLocked;
|
|
20159
20350
|
const showLockIcon = !showLock && isLocked; // shows instead of the cover button when field/dim is locked.
|
|
@@ -20229,7 +20420,7 @@ function ListBoxHeader(_ref2) {
|
|
|
20229
20420
|
keyboard,
|
|
20230
20421
|
autoConfirm
|
|
20231
20422
|
});
|
|
20232
|
-
const actionsToolbar = /*#__PURE__*/React__default.createElement(ActionsToolbar, _extends$
|
|
20423
|
+
const actionsToolbar = /*#__PURE__*/React__default.createElement(ActionsToolbar, _extends$6({
|
|
20233
20424
|
isRtl: isRtl,
|
|
20234
20425
|
layout: layout
|
|
20235
20426
|
}, toolbarProps));
|
|
@@ -20268,7 +20459,8 @@ function ListBoxHeader(_ref2) {
|
|
|
20268
20459
|
iconData: iconData,
|
|
20269
20460
|
iconStyle: iconStyle,
|
|
20270
20461
|
disabled: selections.isActive() && isPopover,
|
|
20271
|
-
translator: translator
|
|
20462
|
+
translator: translator,
|
|
20463
|
+
keyboard: keyboard
|
|
20272
20464
|
})), /*#__PURE__*/React__default.createElement(Grid, {
|
|
20273
20465
|
item: true,
|
|
20274
20466
|
xs: true,
|
|
@@ -20367,18 +20559,6 @@ function ListBoxInline(_ref3) {
|
|
|
20367
20559
|
selectDisabled = () => false,
|
|
20368
20560
|
flags
|
|
20369
20561
|
} = options;
|
|
20370
|
-
|
|
20371
|
-
// Hook that will trigger update when used in useEffects.
|
|
20372
|
-
// Modified from: https://medium.com/@teh_builder/ref-objects-inside-useeffect-hooks-eb7c15198780
|
|
20373
|
-
const useRefWithCallback = () => {
|
|
20374
|
-
const [ref, setInternalRef] = useState$1({});
|
|
20375
|
-
const setRef = useCallback(node => {
|
|
20376
|
-
setInternalRef({
|
|
20377
|
-
current: node
|
|
20378
|
-
});
|
|
20379
|
-
}, [setInternalRef]);
|
|
20380
|
-
return [ref, setRef];
|
|
20381
|
-
};
|
|
20382
20562
|
const theme = useTheme$1();
|
|
20383
20563
|
const {
|
|
20384
20564
|
translator,
|
|
@@ -20389,7 +20569,7 @@ function ListBoxInline(_ref3) {
|
|
|
20389
20569
|
const {
|
|
20390
20570
|
checkboxes = checkboxesOption
|
|
20391
20571
|
} = layout || {};
|
|
20392
|
-
const themeSelectionColorsEnabled = flags.isEnabled('PS_22149_THEME_SELECTION_COLORS');
|
|
20572
|
+
const themeSelectionColorsEnabled = flags === null || flags === void 0 ? void 0 : flags.isEnabled('PS_22149_THEME_SELECTION_COLORS');
|
|
20393
20573
|
const styles = getStyles({
|
|
20394
20574
|
app,
|
|
20395
20575
|
themeApi,
|
|
@@ -20402,8 +20582,8 @@ function ListBoxInline(_ref3) {
|
|
|
20402
20582
|
appLayout: app === null || app === void 0 ? void 0 : app.layout
|
|
20403
20583
|
});
|
|
20404
20584
|
const containerRef = useRef();
|
|
20585
|
+
const searchInputRef = useRef();
|
|
20405
20586
|
const [containerRectRef, containerRect] = useRect$1();
|
|
20406
|
-
const [searchContainer, searchContainerRef] = useRefWithCallback();
|
|
20407
20587
|
const [showToolbar, setShowToolbar] = useState$1(false);
|
|
20408
20588
|
const [showSearch, setShowSearch] = useState$1(false);
|
|
20409
20589
|
const hovering = useRef(false);
|
|
@@ -20445,7 +20625,8 @@ function ListBoxInline(_ref3) {
|
|
|
20445
20625
|
app,
|
|
20446
20626
|
appSelections,
|
|
20447
20627
|
constraints,
|
|
20448
|
-
isModal: isModalMode
|
|
20628
|
+
isModal: isModalMode,
|
|
20629
|
+
selections
|
|
20449
20630
|
}), [keyboard, hovering, updateKeyScroll, containerRef, currentScrollIndex, app, appSelections, constraints, isModalMode]);
|
|
20450
20631
|
useEffect$1(() => {
|
|
20451
20632
|
document.addEventListener('keydown', globalKeyDown);
|
|
@@ -20488,16 +20669,6 @@ function ListBoxInline(_ref3) {
|
|
|
20488
20669
|
}
|
|
20489
20670
|
};
|
|
20490
20671
|
}, [toolbar, selections, isPopover]);
|
|
20491
|
-
useEffect$1(() => {
|
|
20492
|
-
if (!searchContainer || !searchContainer.current) {
|
|
20493
|
-
return;
|
|
20494
|
-
}
|
|
20495
|
-
// Focus search field on toggle-show or when focusSearch is true.
|
|
20496
|
-
if (search && focusSearch || search === 'toggle' && showSearch) {
|
|
20497
|
-
const input = searchContainer.current.querySelector('input');
|
|
20498
|
-
input && input.focus();
|
|
20499
|
-
}
|
|
20500
|
-
}, [searchContainer && searchContainer.current, showSearch, search, focusSearch]);
|
|
20501
20672
|
const {
|
|
20502
20673
|
wildCardSearch,
|
|
20503
20674
|
searchEnabled,
|
|
@@ -20524,11 +20695,10 @@ function ListBoxInline(_ref3) {
|
|
|
20524
20695
|
if (search === 'toggle') {
|
|
20525
20696
|
handleShowSearch();
|
|
20526
20697
|
} else {
|
|
20527
|
-
|
|
20528
|
-
input === null || input === void 0 || input.focus();
|
|
20698
|
+
searchInputRef.current.focus();
|
|
20529
20699
|
}
|
|
20530
20700
|
};
|
|
20531
|
-
const shouldAutoFocus = searchVisible && search === 'toggle';
|
|
20701
|
+
const shouldAutoFocus = searchVisible && (search === 'toggle' || focusSearch);
|
|
20532
20702
|
|
|
20533
20703
|
// Add a container padding for grid mode to harmonize with the grid item margins (should sum to 8px).
|
|
20534
20704
|
const isGridMode = (layoutOptions === null || layoutOptions === void 0 ? void 0 : layoutOptions.dataLayout) === 'grid';
|
|
@@ -20595,9 +20765,9 @@ function ListBoxInline(_ref3) {
|
|
|
20595
20765
|
role: "region",
|
|
20596
20766
|
"aria-label": translator.get('Listbox.ResultFilterLabel')
|
|
20597
20767
|
}, /*#__PURE__*/React__default.createElement(Grid, {
|
|
20598
|
-
item: true
|
|
20599
|
-
|
|
20600
|
-
|
|
20768
|
+
item: true
|
|
20769
|
+
}, /*#__PURE__*/React__default.createElement(ListBoxSearch$1, {
|
|
20770
|
+
ref: searchInputRef,
|
|
20601
20771
|
selections: selections,
|
|
20602
20772
|
selectionState: selectionState$1,
|
|
20603
20773
|
model: model,
|
|
@@ -20606,6 +20776,7 @@ function ListBoxInline(_ref3) {
|
|
|
20606
20776
|
visible: searchVisible,
|
|
20607
20777
|
search: search,
|
|
20608
20778
|
autoFocus: shouldAutoFocus,
|
|
20779
|
+
beginSelectionOnFocus: !isPopover,
|
|
20609
20780
|
wildCardSearch: wildCardSearch,
|
|
20610
20781
|
searchEnabled: searchEnabled,
|
|
20611
20782
|
direction: direction,
|
|
@@ -21222,7 +21393,8 @@ function ListBoxPopoverWrapper(_ref) {
|
|
|
21222
21393
|
stateName: stateName,
|
|
21223
21394
|
autoFocus: options.autoFocus,
|
|
21224
21395
|
components: options.components,
|
|
21225
|
-
flags: flags
|
|
21396
|
+
flags: flags,
|
|
21397
|
+
sortCriteria: options.sortCriteria
|
|
21226
21398
|
});
|
|
21227
21399
|
}
|
|
21228
21400
|
|
|
@@ -22604,13 +22776,13 @@ function Progress(_ref2) {
|
|
|
22604
22776
|
const s = SIZES[size];
|
|
22605
22777
|
return /*#__PURE__*/React__default.createElement(Root, {
|
|
22606
22778
|
className: classes$3.root
|
|
22607
|
-
}, /*#__PURE__*/React__default.createElement(CircularProgress, _extends$
|
|
22779
|
+
}, /*#__PURE__*/React__default.createElement(CircularProgress, _extends$6({
|
|
22608
22780
|
variant: "determinate",
|
|
22609
22781
|
value: 100,
|
|
22610
22782
|
className: classes$3.back,
|
|
22611
22783
|
size: s,
|
|
22612
22784
|
thickness: 3
|
|
22613
|
-
}, props)), /*#__PURE__*/React__default.createElement(CircularProgress, _extends$
|
|
22785
|
+
}, props)), /*#__PURE__*/React__default.createElement(CircularProgress, _extends$6({
|
|
22614
22786
|
variant: "indeterminate",
|
|
22615
22787
|
disableShrink: true,
|
|
22616
22788
|
className: classes$3.front,
|
|
@@ -22660,7 +22832,7 @@ function Cancel(_ref) {
|
|
|
22660
22832
|
variant: "h6",
|
|
22661
22833
|
align: "center",
|
|
22662
22834
|
"data-tid": "update-active"
|
|
22663
|
-
}, translator.get('Object.Update.Active')))), /*#__PURE__*/React__default.createElement(Grid, _extends$
|
|
22835
|
+
}, translator.get('Object.Update.Active')))), /*#__PURE__*/React__default.createElement(Grid, _extends$6({
|
|
22664
22836
|
item: true
|
|
22665
22837
|
}, props), /*#__PURE__*/React__default.createElement(Button, {
|
|
22666
22838
|
variant: "contained",
|
|
@@ -22687,7 +22859,7 @@ function Retry(_ref2) {
|
|
|
22687
22859
|
"data-tid": "update-cancelled"
|
|
22688
22860
|
}, translator.get('Object.Update.Cancelled'))), /*#__PURE__*/React__default.createElement(Grid, {
|
|
22689
22861
|
item: true
|
|
22690
|
-
}, /*#__PURE__*/React__default.createElement(Button, _extends$
|
|
22862
|
+
}, /*#__PURE__*/React__default.createElement(Button, _extends$6({
|
|
22691
22863
|
variant: "contained",
|
|
22692
22864
|
onClick: retry
|
|
22693
22865
|
}, props), translator.get('Retry'))));
|
|
@@ -23356,7 +23528,8 @@ const loadType = async _ref5 => {
|
|
|
23356
23528
|
nebbie,
|
|
23357
23529
|
focusHandler,
|
|
23358
23530
|
emitter,
|
|
23359
|
-
onMount
|
|
23531
|
+
onMount,
|
|
23532
|
+
navigation
|
|
23360
23533
|
} = _ref5;
|
|
23361
23534
|
try {
|
|
23362
23535
|
const snType = await getType({
|
|
@@ -23370,7 +23543,8 @@ const loadType = async _ref5 => {
|
|
|
23370
23543
|
selections,
|
|
23371
23544
|
nebbie,
|
|
23372
23545
|
focusHandler,
|
|
23373
|
-
emitter
|
|
23546
|
+
emitter,
|
|
23547
|
+
navigation
|
|
23374
23548
|
});
|
|
23375
23549
|
if (sn) {
|
|
23376
23550
|
dispatch({
|
|
@@ -23408,7 +23582,8 @@ const Cell = forwardRef((_ref6, ref) => {
|
|
|
23408
23582
|
initialError,
|
|
23409
23583
|
onMount,
|
|
23410
23584
|
currentId,
|
|
23411
|
-
emitter
|
|
23585
|
+
emitter,
|
|
23586
|
+
navigation
|
|
23412
23587
|
} = _ref6;
|
|
23413
23588
|
const {
|
|
23414
23589
|
app,
|
|
@@ -23538,7 +23713,8 @@ const Cell = forwardRef((_ref6, ref) => {
|
|
|
23538
23713
|
nebbie,
|
|
23539
23714
|
focusHandler: focusHandler.current,
|
|
23540
23715
|
emitter,
|
|
23541
|
-
onMount
|
|
23716
|
+
onMount,
|
|
23717
|
+
navigation
|
|
23542
23718
|
});
|
|
23543
23719
|
};
|
|
23544
23720
|
|
|
@@ -23713,7 +23889,8 @@ function glue$1(_ref) {
|
|
|
23713
23889
|
initialSnPlugins,
|
|
23714
23890
|
onMount,
|
|
23715
23891
|
emitter,
|
|
23716
|
-
initialError
|
|
23892
|
+
initialError,
|
|
23893
|
+
navigation
|
|
23717
23894
|
} = _ref;
|
|
23718
23895
|
const {
|
|
23719
23896
|
root
|
|
@@ -23729,7 +23906,8 @@ function glue$1(_ref) {
|
|
|
23729
23906
|
initialSnPlugins: initialSnPlugins,
|
|
23730
23907
|
initialError: initialError,
|
|
23731
23908
|
onMount: onMount,
|
|
23732
|
-
emitter: emitter
|
|
23909
|
+
emitter: emitter,
|
|
23910
|
+
navigation: navigation
|
|
23733
23911
|
}), element, currentId);
|
|
23734
23912
|
const unmount = () => {
|
|
23735
23913
|
root.remove(portal);
|
|
@@ -24945,7 +25123,6 @@ function useTheme() {
|
|
|
24945
25123
|
/**
|
|
24946
25124
|
* Gets the embed instance used.
|
|
24947
25125
|
* @entry
|
|
24948
|
-
* @experimental
|
|
24949
25126
|
* @since 1.7.0
|
|
24950
25127
|
* @returns {Embed} The embed instance used.
|
|
24951
25128
|
* @example
|
|
@@ -24986,6 +25163,22 @@ function useDeviceType() {
|
|
|
24986
25163
|
return useInternalContext('deviceType');
|
|
24987
25164
|
}
|
|
24988
25165
|
|
|
25166
|
+
/**
|
|
25167
|
+
* Gets the navigation api to control sheet navigation. When useNavigation is used in Sense, it returns Sense.navigation.
|
|
25168
|
+
* @entry
|
|
25169
|
+
* @experimental
|
|
25170
|
+
* @since 5.4.0
|
|
25171
|
+
* @returns {Navigation} navigation api.
|
|
25172
|
+
* @example
|
|
25173
|
+
* import { useNavigation } from "@nebula.js/stardust";
|
|
25174
|
+
* // ...
|
|
25175
|
+
* const navigation = useNavigation();
|
|
25176
|
+
* const [activeSheetId, setActiveSheetId] = useState(navigation?.getCurrentSheetId() || "");
|
|
25177
|
+
*/
|
|
25178
|
+
function useNavigation() {
|
|
25179
|
+
return useInternalContext('navigation');
|
|
25180
|
+
}
|
|
25181
|
+
|
|
24989
25182
|
/**
|
|
24990
25183
|
* Gets the array of plugins provided when rendering the visualization.
|
|
24991
25184
|
* @entry
|
|
@@ -25311,7 +25504,6 @@ function onContextMenu(cb) {
|
|
|
25311
25504
|
*
|
|
25312
25505
|
* Used to update properties and get a new layout without triggering onInitialRender.
|
|
25313
25506
|
* @entry
|
|
25314
|
-
* @experimental
|
|
25315
25507
|
* @returns {RenderState} The render state.
|
|
25316
25508
|
* @example
|
|
25317
25509
|
* import { useRenderState } from '@nebula.js/stardust';
|
|
@@ -25348,7 +25540,6 @@ function useRenderState() {
|
|
|
25348
25540
|
/**
|
|
25349
25541
|
* Gets an event emitter instance for the visualization.
|
|
25350
25542
|
* @entry
|
|
25351
|
-
* @experimental
|
|
25352
25543
|
* @returns {Emitter}
|
|
25353
25544
|
* @example
|
|
25354
25545
|
* // In a Nebula visualization
|
|
@@ -25372,7 +25563,6 @@ function useEmitter() {
|
|
|
25372
25563
|
}
|
|
25373
25564
|
|
|
25374
25565
|
/**
|
|
25375
|
-
* @experimental
|
|
25376
25566
|
* @interface Keyboard
|
|
25377
25567
|
* @property {boolean} enabled Whether or not Nebula handles keyboard navigation or not.
|
|
25378
25568
|
* @property {boolean} active Set to true when the chart is activated, ie a user tabs to the chart and presses Enter or Space.
|
|
@@ -25563,6 +25753,7 @@ function createWithHooks(generator, opts, galaxy) {
|
|
|
25563
25753
|
deviceType: galaxy.deviceType,
|
|
25564
25754
|
theme: undefined,
|
|
25565
25755
|
translator: galaxy.translator,
|
|
25756
|
+
navigation: opts.navigation,
|
|
25566
25757
|
// --- dynamic values ---
|
|
25567
25758
|
layout: {},
|
|
25568
25759
|
appLayout: {},
|
|
@@ -26093,6 +26284,7 @@ function viz() {
|
|
|
26093
26284
|
let {
|
|
26094
26285
|
model,
|
|
26095
26286
|
halo,
|
|
26287
|
+
navigation,
|
|
26096
26288
|
initialError,
|
|
26097
26289
|
onDestroy = async () => {}
|
|
26098
26290
|
} = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
@@ -26334,7 +26526,8 @@ function viz() {
|
|
|
26334
26526
|
initialSnPlugins,
|
|
26335
26527
|
initialError,
|
|
26336
26528
|
onMount,
|
|
26337
|
-
emitter
|
|
26529
|
+
emitter,
|
|
26530
|
+
navigation
|
|
26338
26531
|
});
|
|
26339
26532
|
return mounted;
|
|
26340
26533
|
},
|
|
@@ -26429,11 +26622,12 @@ function viz() {
|
|
|
26429
26622
|
}
|
|
26430
26623
|
|
|
26431
26624
|
/* eslint no-underscore-dangle:0 */
|
|
26432
|
-
async function init(model, optional, halo, initialError) {
|
|
26433
|
-
let onDestroy = arguments.length >
|
|
26625
|
+
async function init(model, optional, halo, navigation, initialError) {
|
|
26626
|
+
let onDestroy = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : async () => {};
|
|
26434
26627
|
const api = viz({
|
|
26435
26628
|
model,
|
|
26436
26629
|
halo,
|
|
26630
|
+
navigation,
|
|
26437
26631
|
initialError,
|
|
26438
26632
|
onDestroy
|
|
26439
26633
|
});
|
|
@@ -26495,7 +26689,8 @@ async function createSessionObject(_ref, halo, store) {
|
|
|
26495
26689
|
options,
|
|
26496
26690
|
plugins,
|
|
26497
26691
|
element,
|
|
26498
|
-
extendProperties
|
|
26692
|
+
extendProperties,
|
|
26693
|
+
navigation
|
|
26499
26694
|
} = _ref;
|
|
26500
26695
|
let mergedProps = {};
|
|
26501
26696
|
const children = [];
|
|
@@ -26551,7 +26746,7 @@ async function createSessionObject(_ref, halo, store) {
|
|
|
26551
26746
|
options,
|
|
26552
26747
|
plugins,
|
|
26553
26748
|
element
|
|
26554
|
-
}, halo, error, onDestroy);
|
|
26749
|
+
}, halo, navigation, error, onDestroy);
|
|
26555
26750
|
}
|
|
26556
26751
|
|
|
26557
26752
|
/**
|
|
@@ -26665,7 +26860,7 @@ const SheetElement = {
|
|
|
26665
26860
|
/** @type {'njs-sheet'} */
|
|
26666
26861
|
className: 'njs-sheet'
|
|
26667
26862
|
};
|
|
26668
|
-
function getCellRenderer(cell, halo, initialSnOptions, initialSnPlugins, initialError, onMount) {
|
|
26863
|
+
function getCellRenderer(cell, halo, initialSnOptions, initialSnPlugins, initialError, onMount, navigation) {
|
|
26669
26864
|
const {
|
|
26670
26865
|
x,
|
|
26671
26866
|
y,
|
|
@@ -26679,7 +26874,8 @@ function getCellRenderer(cell, halo, initialSnOptions, initialSnPlugins, initial
|
|
|
26679
26874
|
width: "".concat(width, "%"),
|
|
26680
26875
|
height: "".concat(height, "%"),
|
|
26681
26876
|
position: 'absolute'
|
|
26682
|
-
}
|
|
26877
|
+
},
|
|
26878
|
+
key: cell.model.id
|
|
26683
26879
|
}, /*#__PURE__*/React__default.createElement(Cell, {
|
|
26684
26880
|
ref: cell.cellRef,
|
|
26685
26881
|
halo: halo,
|
|
@@ -26688,7 +26884,8 @@ function getCellRenderer(cell, halo, initialSnOptions, initialSnPlugins, initial
|
|
|
26688
26884
|
initialSnOptions: initialSnOptions,
|
|
26689
26885
|
initialSnPlugins: initialSnPlugins,
|
|
26690
26886
|
initialError: initialError,
|
|
26691
|
-
onMount: onMount
|
|
26887
|
+
onMount: onMount,
|
|
26888
|
+
navigation: navigation
|
|
26692
26889
|
}));
|
|
26693
26890
|
}
|
|
26694
26891
|
function getBounds(pos, columns, rows) {
|
|
@@ -26702,18 +26899,22 @@ function getBounds(pos, columns, rows) {
|
|
|
26702
26899
|
height: pos.rowspan / rows * 100
|
|
26703
26900
|
};
|
|
26704
26901
|
}
|
|
26705
|
-
|
|
26902
|
+
const Sheet = forwardRef((_ref, ref) => {
|
|
26903
|
+
var _navigation$setCurren;
|
|
26706
26904
|
let {
|
|
26707
|
-
model,
|
|
26905
|
+
model: inputModel,
|
|
26708
26906
|
halo,
|
|
26709
26907
|
initialSnOptions,
|
|
26710
26908
|
initialSnPlugins,
|
|
26711
26909
|
initialError,
|
|
26712
|
-
onMount
|
|
26910
|
+
onMount,
|
|
26911
|
+
unmount,
|
|
26912
|
+
navigation
|
|
26713
26913
|
} = _ref;
|
|
26714
26914
|
const {
|
|
26715
26915
|
root
|
|
26716
26916
|
} = halo;
|
|
26917
|
+
const [model, setModel] = useState$1(inputModel);
|
|
26717
26918
|
const [layout] = useLayout$1(model);
|
|
26718
26919
|
const {
|
|
26719
26920
|
theme: themeName,
|
|
@@ -26723,7 +26924,7 @@ function Sheet(_ref) {
|
|
|
26723
26924
|
const [bgColor, setBgColor] = useState$1(undefined);
|
|
26724
26925
|
const [bgImage, setBgImage] = useState$1(undefined);
|
|
26725
26926
|
const [deepHash, setDeepHash] = useState$1('');
|
|
26726
|
-
|
|
26927
|
+
navigation === null || navigation === void 0 || (_navigation$setCurren = navigation.setCurrentSheetId) === null || _navigation$setCurren === void 0 || _navigation$setCurren.call(navigation, model.id);
|
|
26727
26928
|
/// For each object
|
|
26728
26929
|
useEffect$1(() => {
|
|
26729
26930
|
if (layout) {
|
|
@@ -26734,8 +26935,8 @@ function Sheet(_ref) {
|
|
|
26734
26935
|
setDeepHash(hash);
|
|
26735
26936
|
const fetchObjects = async () => {
|
|
26736
26937
|
/*
|
|
26737
|
-
|
|
26738
|
-
|
|
26938
|
+
Need to always fetch and evaluate everything as the sheet need to support multiple instances of the same object?
|
|
26939
|
+
No, there is no way to add the same chart twice, so the optimization should be worth it.
|
|
26739
26940
|
*/
|
|
26740
26941
|
|
|
26741
26942
|
// Clear the cell list
|
|
@@ -26779,16 +26980,29 @@ function Sheet(_ref) {
|
|
|
26779
26980
|
fetchObjects();
|
|
26780
26981
|
}
|
|
26781
26982
|
}, [layout]);
|
|
26782
|
-
|
|
26983
|
+
useEffect$1(() => {
|
|
26984
|
+
const onModelClose = () => {
|
|
26985
|
+
model.removeListener('closed', onModelClose);
|
|
26986
|
+
unmount();
|
|
26987
|
+
};
|
|
26988
|
+
model.on('closed', onModelClose);
|
|
26989
|
+
return () => model.removeListener('closed', onModelClose);
|
|
26990
|
+
}, [model]);
|
|
26991
|
+
const cellRenderers = useMemo$1(() => cells ? cells.map(c => getCellRenderer(c, halo, initialSnOptions, initialSnPlugins, initialError, c.mounted, navigation)) : [], [cells]);
|
|
26783
26992
|
useEffect$1(() => {
|
|
26784
26993
|
const bgComp = layout !== null && layout !== void 0 && layout.components ? layout.components.find(comp => comp.key === 'general') : null;
|
|
26785
26994
|
setBgColor(resolveBgColor(bgComp, halo.public.theme));
|
|
26786
26995
|
setBgImage(resolveBgImage(bgComp, halo.app));
|
|
26787
26996
|
}, [layout, halo.public.theme, halo.app, themeName]);
|
|
26788
26997
|
|
|
26998
|
+
// Expose sheet ref api
|
|
26999
|
+
useImperativeHandle$1(ref, () => ({
|
|
27000
|
+
setModel
|
|
27001
|
+
}), []);
|
|
27002
|
+
|
|
26789
27003
|
/* TODO
|
|
26790
|
-
|
|
26791
|
-
|
|
27004
|
+
- sheet title + bg + logo etc + as option
|
|
27005
|
+
- sheet exposed classnames for theming
|
|
26792
27006
|
*/
|
|
26793
27007
|
|
|
26794
27008
|
const height = !layout || Number.isNaN(layout.height) ? '100%' : "".concat(Number(layout.height), "%");
|
|
@@ -26813,7 +27027,7 @@ function Sheet(_ref) {
|
|
|
26813
27027
|
backgroundPosition: bgImage && bgImage.pos
|
|
26814
27028
|
}
|
|
26815
27029
|
}, cellRenderers);
|
|
26816
|
-
}
|
|
27030
|
+
});
|
|
26817
27031
|
|
|
26818
27032
|
function glue(_ref) {
|
|
26819
27033
|
let {
|
|
@@ -26823,26 +27037,29 @@ function glue(_ref) {
|
|
|
26823
27037
|
initialSnOptions,
|
|
26824
27038
|
initialSnPlugins,
|
|
26825
27039
|
onMount,
|
|
26826
|
-
initialError
|
|
27040
|
+
initialError,
|
|
27041
|
+
navigation
|
|
26827
27042
|
} = _ref;
|
|
26828
27043
|
const {
|
|
26829
27044
|
root
|
|
26830
27045
|
} = halo;
|
|
26831
27046
|
const sheetRef = React__default.createRef();
|
|
26832
|
-
|
|
27047
|
+
let portal;
|
|
27048
|
+
const unmount = () => {
|
|
27049
|
+
root.remove(portal);
|
|
27050
|
+
};
|
|
27051
|
+
portal = ReactDOM.createPortal( /*#__PURE__*/React__default.createElement(Sheet, {
|
|
26833
27052
|
ref: sheetRef,
|
|
26834
27053
|
halo: halo,
|
|
26835
27054
|
model: model,
|
|
26836
27055
|
initialSnOptions: initialSnOptions,
|
|
26837
27056
|
initialSnPlugins: initialSnPlugins,
|
|
26838
27057
|
initialError: initialError,
|
|
26839
|
-
onMount: onMount
|
|
27058
|
+
onMount: onMount,
|
|
27059
|
+
unmount: unmount,
|
|
27060
|
+
navigation: navigation
|
|
26840
27061
|
}), element, model.id);
|
|
26841
|
-
|
|
26842
|
-
root.remove(portal);
|
|
26843
|
-
model.removeListener('closed', unmount);
|
|
26844
|
-
};
|
|
26845
|
-
model.on('closed', unmount);
|
|
27062
|
+
navigation.setSheetRef(sheetRef);
|
|
26846
27063
|
root.add(portal);
|
|
26847
27064
|
return [unmount, sheetRef];
|
|
26848
27065
|
}
|
|
@@ -26852,6 +27069,7 @@ function sheet() {
|
|
|
26852
27069
|
let {
|
|
26853
27070
|
model,
|
|
26854
27071
|
halo,
|
|
27072
|
+
navigation,
|
|
26855
27073
|
initialError,
|
|
26856
27074
|
onDestroy = async () => {}
|
|
26857
27075
|
} = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
@@ -26912,6 +27130,13 @@ function sheet() {
|
|
|
26912
27130
|
* @type {string}
|
|
26913
27131
|
*/
|
|
26914
27132
|
model,
|
|
27133
|
+
/**
|
|
27134
|
+
* The navigation api to control sheet navigation.
|
|
27135
|
+
* @experimental
|
|
27136
|
+
* @since 5.4.0
|
|
27137
|
+
* @type {Navigation}
|
|
27138
|
+
*/
|
|
27139
|
+
navigation,
|
|
26915
27140
|
/**
|
|
26916
27141
|
* Destroys the sheet and removes it from the the DOM.
|
|
26917
27142
|
* @example
|
|
@@ -26943,7 +27168,8 @@ function sheet() {
|
|
|
26943
27168
|
initialSnOptions,
|
|
26944
27169
|
initialSnPlugins,
|
|
26945
27170
|
initialError,
|
|
26946
|
-
onMount
|
|
27171
|
+
onMount,
|
|
27172
|
+
navigation
|
|
26947
27173
|
});
|
|
26948
27174
|
return mounted;
|
|
26949
27175
|
},
|
|
@@ -26976,11 +27202,12 @@ function sheet() {
|
|
|
26976
27202
|
}
|
|
26977
27203
|
|
|
26978
27204
|
/* eslint no-underscore-dangle:0 */
|
|
26979
|
-
async function initSheet(model, optional, halo, initialError) {
|
|
26980
|
-
let onDestroy = arguments.length >
|
|
27205
|
+
async function initSheet(model, optional, halo, navigation, initialError) {
|
|
27206
|
+
let onDestroy = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : async () => {};
|
|
26981
27207
|
const api = sheet({
|
|
26982
27208
|
model,
|
|
26983
27209
|
halo,
|
|
27210
|
+
navigation,
|
|
26984
27211
|
initialError,
|
|
26985
27212
|
onDestroy
|
|
26986
27213
|
});
|
|
@@ -26996,12 +27223,115 @@ async function initSheet(model, optional, halo, initialError) {
|
|
|
26996
27223
|
return api;
|
|
26997
27224
|
}
|
|
26998
27225
|
|
|
27226
|
+
function createNavigationApi(halo, store, model) {
|
|
27227
|
+
var _galaxy$anything;
|
|
27228
|
+
const {
|
|
27229
|
+
galaxy
|
|
27230
|
+
} = halo.public;
|
|
27231
|
+
if ((_galaxy$anything = galaxy.anything) !== null && _galaxy$anything !== void 0 && (_galaxy$anything = _galaxy$anything.sense) !== null && _galaxy$anything !== void 0 && _galaxy$anything.navigation) {
|
|
27232
|
+
var _galaxy$anything2;
|
|
27233
|
+
return (_galaxy$anything2 = galaxy.anything) === null || _galaxy$anything2 === void 0 || (_galaxy$anything2 = _galaxy$anything2.sense) === null || _galaxy$anything2 === void 0 ? void 0 : _galaxy$anything2.navigation;
|
|
27234
|
+
}
|
|
27235
|
+
const State = {
|
|
27236
|
+
model
|
|
27237
|
+
};
|
|
27238
|
+
|
|
27239
|
+
/**
|
|
27240
|
+
* @class Navigation
|
|
27241
|
+
* @description The navigation api instance.
|
|
27242
|
+
* @implements Emitter
|
|
27243
|
+
* @experimental
|
|
27244
|
+
* @since 5.4.0
|
|
27245
|
+
* @example
|
|
27246
|
+
* const navigation = useNavigation();
|
|
27247
|
+
* //...
|
|
27248
|
+
* useEffect(() => {
|
|
27249
|
+
* const onSheetChanged = () => {
|
|
27250
|
+
* // do something
|
|
27251
|
+
* };
|
|
27252
|
+
* if (navigation?.addListener) {
|
|
27253
|
+
* navigation.addListener("sheetChanged", onSheetChanged);
|
|
27254
|
+
* }
|
|
27255
|
+
* return () => {
|
|
27256
|
+
* if (navigation?.removeListener) {
|
|
27257
|
+
* navigation.removeListener("sheetChanged", onSheetChanged);
|
|
27258
|
+
* }
|
|
27259
|
+
* };
|
|
27260
|
+
* }, [navigation]);
|
|
27261
|
+
*
|
|
27262
|
+
* const onSheetClick = (sheetId: string) => {
|
|
27263
|
+
* navigation?.goToSheet(sheetId);
|
|
27264
|
+
* };
|
|
27265
|
+
*/
|
|
27266
|
+
const navigationAPI = /** @lends Navigation# */{
|
|
27267
|
+
/**
|
|
27268
|
+
* Navigate to the supplied sheet and emit 'sheetChanged' event if the target sheet Id is valid.
|
|
27269
|
+
* This allows a navigation object to synchronize its current sheet item with the active sheet.
|
|
27270
|
+
* @experimental
|
|
27271
|
+
* @since 5.4.0
|
|
27272
|
+
* @param {string} sheetId Id of the sheet to navigate to
|
|
27273
|
+
*/
|
|
27274
|
+
goToSheet: async sheetId => {
|
|
27275
|
+
var _State$sheetRef, _State$sheetRef$setMo;
|
|
27276
|
+
if (!State.sheetRef) {
|
|
27277
|
+
return;
|
|
27278
|
+
}
|
|
27279
|
+
const {
|
|
27280
|
+
modelStore,
|
|
27281
|
+
rpcRequestModelStore
|
|
27282
|
+
} = store;
|
|
27283
|
+
const key = "".concat(sheetId);
|
|
27284
|
+
let rpc = rpcRequestModelStore.get(key);
|
|
27285
|
+
if (!rpc) {
|
|
27286
|
+
rpc = halo.app.getObject(sheetId);
|
|
27287
|
+
rpcRequestModelStore.set(key, rpc);
|
|
27288
|
+
}
|
|
27289
|
+
let newModel;
|
|
27290
|
+
try {
|
|
27291
|
+
newModel = await rpc;
|
|
27292
|
+
if (newModel.genericType !== 'sheet') {
|
|
27293
|
+
return;
|
|
27294
|
+
}
|
|
27295
|
+
} catch (e) {
|
|
27296
|
+
return;
|
|
27297
|
+
}
|
|
27298
|
+
modelStore.set(key, newModel);
|
|
27299
|
+
(_State$sheetRef = State.sheetRef) === null || _State$sheetRef === void 0 || (_State$sheetRef = _State$sheetRef.current) === null || _State$sheetRef === void 0 || (_State$sheetRef$setMo = _State$sheetRef.setModel) === null || _State$sheetRef$setMo === void 0 || _State$sheetRef$setMo.call(_State$sheetRef, newModel);
|
|
27300
|
+
State.model = newModel;
|
|
27301
|
+
navigationAPI.emit('sheetChanged');
|
|
27302
|
+
},
|
|
27303
|
+
/**
|
|
27304
|
+
* @private
|
|
27305
|
+
* Set the sheet ref
|
|
27306
|
+
* @param {object} sheetRef sheet ref object
|
|
27307
|
+
*/
|
|
27308
|
+
setSheetRef: sheetRef => {
|
|
27309
|
+
State.sheetRef = sheetRef;
|
|
27310
|
+
},
|
|
27311
|
+
/**
|
|
27312
|
+
* Return the current sheet id
|
|
27313
|
+
* @experimental
|
|
27314
|
+
* @since 5.4.0
|
|
27315
|
+
* @returns {string|false} The current sheet Id. false means there is no current sheet.
|
|
27316
|
+
*/
|
|
27317
|
+
getCurrentSheetId: () => {
|
|
27318
|
+
if (State.model) {
|
|
27319
|
+
return State.model.id;
|
|
27320
|
+
}
|
|
27321
|
+
return false;
|
|
27322
|
+
}
|
|
27323
|
+
};
|
|
27324
|
+
eventmixin(navigationAPI);
|
|
27325
|
+
return navigationAPI;
|
|
27326
|
+
}
|
|
27327
|
+
|
|
26999
27328
|
async function getObject(_ref, halo, store) {
|
|
27000
27329
|
let {
|
|
27001
27330
|
id,
|
|
27002
27331
|
options,
|
|
27003
27332
|
plugins,
|
|
27004
|
-
element
|
|
27333
|
+
element,
|
|
27334
|
+
navigation: inputNavigation
|
|
27005
27335
|
} = _ref;
|
|
27006
27336
|
const {
|
|
27007
27337
|
modelStore,
|
|
@@ -27015,18 +27345,19 @@ async function getObject(_ref, halo, store) {
|
|
|
27015
27345
|
}
|
|
27016
27346
|
const model = await rpc;
|
|
27017
27347
|
modelStore.set(key, model);
|
|
27348
|
+
const navigation = inputNavigation || (model.genericType === 'sheet' ? createNavigationApi(halo, store, model) : undefined);
|
|
27018
27349
|
if (model.genericType === 'sheet') {
|
|
27019
27350
|
return initSheet(model, {
|
|
27020
27351
|
options,
|
|
27021
27352
|
plugins,
|
|
27022
27353
|
element
|
|
27023
|
-
}, halo);
|
|
27354
|
+
}, halo, navigation);
|
|
27024
27355
|
}
|
|
27025
27356
|
return init(model, {
|
|
27026
27357
|
options,
|
|
27027
27358
|
plugins,
|
|
27028
27359
|
element
|
|
27029
|
-
}, halo);
|
|
27360
|
+
}, halo, navigation);
|
|
27030
27361
|
}
|
|
27031
27362
|
|
|
27032
27363
|
function flagsFn () {
|
|
@@ -27046,59 +27377,52 @@ function flagsFn () {
|
|
|
27046
27377
|
}
|
|
27047
27378
|
|
|
27048
27379
|
class LRUCache {
|
|
27049
|
-
constructor
|
|
27380
|
+
constructor() {
|
|
27050
27381
|
this.max = 1000;
|
|
27051
27382
|
this.map = new Map();
|
|
27052
27383
|
}
|
|
27053
|
-
|
|
27054
|
-
get (key) {
|
|
27384
|
+
get(key) {
|
|
27055
27385
|
const value = this.map.get(key);
|
|
27056
27386
|
if (value === undefined) {
|
|
27057
|
-
return undefined
|
|
27387
|
+
return undefined;
|
|
27058
27388
|
} else {
|
|
27059
27389
|
// Remove the key from the map and add it to the end
|
|
27060
27390
|
this.map.delete(key);
|
|
27061
27391
|
this.map.set(key, value);
|
|
27062
|
-
return value
|
|
27392
|
+
return value;
|
|
27063
27393
|
}
|
|
27064
27394
|
}
|
|
27065
|
-
|
|
27066
|
-
|
|
27067
|
-
return this.map.delete(key)
|
|
27395
|
+
delete(key) {
|
|
27396
|
+
return this.map.delete(key);
|
|
27068
27397
|
}
|
|
27069
|
-
|
|
27070
|
-
set (key, value) {
|
|
27398
|
+
set(key, value) {
|
|
27071
27399
|
const deleted = this.delete(key);
|
|
27072
|
-
|
|
27073
27400
|
if (!deleted && value !== undefined) {
|
|
27074
27401
|
// If cache is full, delete the least recently used item
|
|
27075
27402
|
if (this.map.size >= this.max) {
|
|
27076
27403
|
const firstKey = this.map.keys().next().value;
|
|
27077
27404
|
this.delete(firstKey);
|
|
27078
27405
|
}
|
|
27079
|
-
|
|
27080
27406
|
this.map.set(key, value);
|
|
27081
27407
|
}
|
|
27082
|
-
|
|
27083
|
-
return this
|
|
27408
|
+
return this;
|
|
27084
27409
|
}
|
|
27085
27410
|
}
|
|
27086
|
-
|
|
27087
27411
|
var lrucache = LRUCache;
|
|
27088
27412
|
|
|
27089
27413
|
// parse out just the options we care about
|
|
27090
|
-
const looseOption = Object.freeze({
|
|
27091
|
-
|
|
27414
|
+
const looseOption = Object.freeze({
|
|
27415
|
+
loose: true
|
|
27416
|
+
});
|
|
27417
|
+
const emptyOpts = Object.freeze({});
|
|
27092
27418
|
const parseOptions$1 = options => {
|
|
27093
27419
|
if (!options) {
|
|
27094
|
-
return emptyOpts
|
|
27420
|
+
return emptyOpts;
|
|
27095
27421
|
}
|
|
27096
|
-
|
|
27097
27422
|
if (typeof options !== 'object') {
|
|
27098
|
-
return looseOption
|
|
27423
|
+
return looseOption;
|
|
27099
27424
|
}
|
|
27100
|
-
|
|
27101
|
-
return options
|
|
27425
|
+
return options;
|
|
27102
27426
|
};
|
|
27103
27427
|
var parseOptions_1 = parseOptions$1;
|
|
27104
27428
|
|
|
@@ -27107,10 +27431,8 @@ var re$1 = {exports: {}};
|
|
|
27107
27431
|
// Note: this is the semver.org version of the spec that it implements
|
|
27108
27432
|
// Not necessarily the package version of this code.
|
|
27109
27433
|
const SEMVER_SPEC_VERSION = '2.0.0';
|
|
27110
|
-
|
|
27111
27434
|
const MAX_LENGTH$1 = 256;
|
|
27112
|
-
const MAX_SAFE_INTEGER$1 = Number.MAX_SAFE_INTEGER ||
|
|
27113
|
-
/* istanbul ignore next */ 9007199254740991;
|
|
27435
|
+
const MAX_SAFE_INTEGER$1 = Number.MAX_SAFE_INTEGER || /* istanbul ignore next */9007199254740991;
|
|
27114
27436
|
|
|
27115
27437
|
// Max safe segment length for coercion.
|
|
27116
27438
|
const MAX_SAFE_COMPONENT_LENGTH = 16;
|
|
@@ -27118,17 +27440,7 @@ const MAX_SAFE_COMPONENT_LENGTH = 16;
|
|
|
27118
27440
|
// Max safe length for a build identifier. The max length minus 6 characters for
|
|
27119
27441
|
// the shortest version with a build 0.0.0+BUILD.
|
|
27120
27442
|
const MAX_SAFE_BUILD_LENGTH = MAX_LENGTH$1 - 6;
|
|
27121
|
-
|
|
27122
|
-
const RELEASE_TYPES = [
|
|
27123
|
-
'major',
|
|
27124
|
-
'premajor',
|
|
27125
|
-
'minor',
|
|
27126
|
-
'preminor',
|
|
27127
|
-
'patch',
|
|
27128
|
-
'prepatch',
|
|
27129
|
-
'prerelease',
|
|
27130
|
-
];
|
|
27131
|
-
|
|
27443
|
+
const RELEASE_TYPES = ['major', 'premajor', 'minor', 'preminor', 'patch', 'prepatch', 'prerelease'];
|
|
27132
27444
|
var constants = {
|
|
27133
27445
|
MAX_LENGTH: MAX_LENGTH$1,
|
|
27134
27446
|
MAX_SAFE_COMPONENT_LENGTH,
|
|
@@ -27137,443 +27449,352 @@ var constants = {
|
|
|
27137
27449
|
RELEASE_TYPES,
|
|
27138
27450
|
SEMVER_SPEC_VERSION,
|
|
27139
27451
|
FLAG_INCLUDE_PRERELEASE: 0b001,
|
|
27140
|
-
FLAG_LOOSE: 0b010
|
|
27452
|
+
FLAG_LOOSE: 0b010
|
|
27141
27453
|
};
|
|
27142
27454
|
|
|
27143
|
-
const debug$1 = (
|
|
27144
|
-
|
|
27145
|
-
|
|
27146
|
-
|
|
27147
|
-
|
|
27148
|
-
|
|
27149
|
-
: () => {};
|
|
27150
|
-
|
|
27455
|
+
const debug$1 = typeof process === 'object' && process.env && process.env.NODE_DEBUG && /\bsemver\b/i.test(process.env.NODE_DEBUG) ? function () {
|
|
27456
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
27457
|
+
args[_key] = arguments[_key];
|
|
27458
|
+
}
|
|
27459
|
+
return console.error('SEMVER', ...args);
|
|
27460
|
+
} : () => {};
|
|
27151
27461
|
var debug_1 = debug$1;
|
|
27152
27462
|
|
|
27153
27463
|
(function (module, exports) {
|
|
27154
|
-
|
|
27155
|
-
|
|
27156
|
-
|
|
27157
|
-
|
|
27158
|
-
|
|
27159
|
-
|
|
27160
|
-
|
|
27161
|
-
|
|
27162
|
-
|
|
27163
|
-
|
|
27164
|
-
|
|
27165
|
-
|
|
27166
|
-
|
|
27167
|
-
|
|
27168
|
-
|
|
27169
|
-
|
|
27170
|
-
|
|
27171
|
-
|
|
27172
|
-
|
|
27173
|
-
|
|
27174
|
-
|
|
27175
|
-
|
|
27176
|
-
|
|
27177
|
-
|
|
27178
|
-
|
|
27179
|
-
|
|
27180
|
-
|
|
27181
|
-
|
|
27182
|
-
|
|
27183
|
-
|
|
27184
|
-
|
|
27185
|
-
|
|
27186
|
-
|
|
27187
|
-
|
|
27188
|
-
|
|
27189
|
-
|
|
27190
|
-
|
|
27191
|
-
|
|
27192
|
-
const createToken = (name, value, isGlobal) => {
|
|
27193
|
-
const safe = makeSafeRegex(value);
|
|
27194
|
-
const index = R++;
|
|
27195
|
-
debug(name, index, value);
|
|
27196
|
-
t[name] = index;
|
|
27197
|
-
src[index] = value;
|
|
27198
|
-
re[index] = new RegExp(value, isGlobal ? 'g' : undefined);
|
|
27199
|
-
safeRe[index] = new RegExp(safe, isGlobal ? 'g' : undefined);
|
|
27200
|
-
};
|
|
27201
|
-
|
|
27202
|
-
// The following Regular Expressions can be used for tokenizing,
|
|
27203
|
-
// validating, and parsing SemVer version strings.
|
|
27204
|
-
|
|
27205
|
-
// ## Numeric Identifier
|
|
27206
|
-
// A single `0`, or a non-zero digit followed by zero or more digits.
|
|
27207
|
-
|
|
27208
|
-
createToken('NUMERICIDENTIFIER', '0|[1-9]\\d*');
|
|
27209
|
-
createToken('NUMERICIDENTIFIERLOOSE', '\\d+');
|
|
27210
|
-
|
|
27211
|
-
// ## Non-numeric Identifier
|
|
27212
|
-
// Zero or more digits, followed by a letter or hyphen, and then zero or
|
|
27213
|
-
// more letters, digits, or hyphens.
|
|
27214
|
-
|
|
27215
|
-
createToken('NONNUMERICIDENTIFIER', `\\d*[a-zA-Z-]${LETTERDASHNUMBER}*`);
|
|
27216
|
-
|
|
27217
|
-
// ## Main Version
|
|
27218
|
-
// Three dot-separated numeric identifiers.
|
|
27219
|
-
|
|
27220
|
-
createToken('MAINVERSION', `(${src[t.NUMERICIDENTIFIER]})\\.` +
|
|
27221
|
-
`(${src[t.NUMERICIDENTIFIER]})\\.` +
|
|
27222
|
-
`(${src[t.NUMERICIDENTIFIER]})`);
|
|
27223
|
-
|
|
27224
|
-
createToken('MAINVERSIONLOOSE', `(${src[t.NUMERICIDENTIFIERLOOSE]})\\.` +
|
|
27225
|
-
`(${src[t.NUMERICIDENTIFIERLOOSE]})\\.` +
|
|
27226
|
-
`(${src[t.NUMERICIDENTIFIERLOOSE]})`);
|
|
27227
|
-
|
|
27228
|
-
// ## Pre-release Version Identifier
|
|
27229
|
-
// A numeric identifier, or a non-numeric identifier.
|
|
27230
|
-
|
|
27231
|
-
createToken('PRERELEASEIDENTIFIER', `(?:${src[t.NUMERICIDENTIFIER]
|
|
27232
|
-
}|${src[t.NONNUMERICIDENTIFIER]})`);
|
|
27233
|
-
|
|
27234
|
-
createToken('PRERELEASEIDENTIFIERLOOSE', `(?:${src[t.NUMERICIDENTIFIERLOOSE]
|
|
27235
|
-
}|${src[t.NONNUMERICIDENTIFIER]})`);
|
|
27236
|
-
|
|
27237
|
-
// ## Pre-release Version
|
|
27238
|
-
// Hyphen, followed by one or more dot-separated pre-release version
|
|
27239
|
-
// identifiers.
|
|
27240
|
-
|
|
27241
|
-
createToken('PRERELEASE', `(?:-(${src[t.PRERELEASEIDENTIFIER]
|
|
27242
|
-
}(?:\\.${src[t.PRERELEASEIDENTIFIER]})*))`);
|
|
27243
|
-
|
|
27244
|
-
createToken('PRERELEASELOOSE', `(?:-?(${src[t.PRERELEASEIDENTIFIERLOOSE]
|
|
27245
|
-
}(?:\\.${src[t.PRERELEASEIDENTIFIERLOOSE]})*))`);
|
|
27246
|
-
|
|
27247
|
-
// ## Build Metadata Identifier
|
|
27248
|
-
// Any combination of digits, letters, or hyphens.
|
|
27249
|
-
|
|
27250
|
-
createToken('BUILDIDENTIFIER', `${LETTERDASHNUMBER}+`);
|
|
27251
|
-
|
|
27252
|
-
// ## Build Metadata
|
|
27253
|
-
// Plus sign, followed by one or more period-separated build metadata
|
|
27254
|
-
// identifiers.
|
|
27255
|
-
|
|
27256
|
-
createToken('BUILD', `(?:\\+(${src[t.BUILDIDENTIFIER]
|
|
27257
|
-
}(?:\\.${src[t.BUILDIDENTIFIER]})*))`);
|
|
27258
|
-
|
|
27259
|
-
// ## Full Version String
|
|
27260
|
-
// A main version, followed optionally by a pre-release version and
|
|
27261
|
-
// build metadata.
|
|
27262
|
-
|
|
27263
|
-
// Note that the only major, minor, patch, and pre-release sections of
|
|
27264
|
-
// the version string are capturing groups. The build metadata is not a
|
|
27265
|
-
// capturing group, because it should not ever be used in version
|
|
27266
|
-
// comparison.
|
|
27267
|
-
|
|
27268
|
-
createToken('FULLPLAIN', `v?${src[t.MAINVERSION]
|
|
27269
|
-
}${src[t.PRERELEASE]}?${
|
|
27270
|
-
src[t.BUILD]}?`);
|
|
27271
|
-
|
|
27272
|
-
createToken('FULL', `^${src[t.FULLPLAIN]}$`);
|
|
27273
|
-
|
|
27274
|
-
// like full, but allows v1.2.3 and =1.2.3, which people do sometimes.
|
|
27275
|
-
// also, 1.0.0alpha1 (prerelease without the hyphen) which is pretty
|
|
27276
|
-
// common in the npm registry.
|
|
27277
|
-
createToken('LOOSEPLAIN', `[v=\\s]*${src[t.MAINVERSIONLOOSE]
|
|
27278
|
-
}${src[t.PRERELEASELOOSE]}?${
|
|
27279
|
-
src[t.BUILD]}?`);
|
|
27280
|
-
|
|
27281
|
-
createToken('LOOSE', `^${src[t.LOOSEPLAIN]}$`);
|
|
27282
|
-
|
|
27283
|
-
createToken('GTLT', '((?:<|>)?=?)');
|
|
27284
|
-
|
|
27285
|
-
// Something like "2.*" or "1.2.x".
|
|
27286
|
-
// Note that "x.x" is a valid xRange identifer, meaning "any version"
|
|
27287
|
-
// Only the first item is strictly required.
|
|
27288
|
-
createToken('XRANGEIDENTIFIERLOOSE', `${src[t.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);
|
|
27289
|
-
createToken('XRANGEIDENTIFIER', `${src[t.NUMERICIDENTIFIER]}|x|X|\\*`);
|
|
27290
|
-
|
|
27291
|
-
createToken('XRANGEPLAIN', `[v=\\s]*(${src[t.XRANGEIDENTIFIER]})` +
|
|
27292
|
-
`(?:\\.(${src[t.XRANGEIDENTIFIER]})` +
|
|
27293
|
-
`(?:\\.(${src[t.XRANGEIDENTIFIER]})` +
|
|
27294
|
-
`(?:${src[t.PRERELEASE]})?${
|
|
27295
|
-
src[t.BUILD]}?` +
|
|
27296
|
-
`)?)?`);
|
|
27297
|
-
|
|
27298
|
-
createToken('XRANGEPLAINLOOSE', `[v=\\s]*(${src[t.XRANGEIDENTIFIERLOOSE]})` +
|
|
27299
|
-
`(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})` +
|
|
27300
|
-
`(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})` +
|
|
27301
|
-
`(?:${src[t.PRERELEASELOOSE]})?${
|
|
27302
|
-
src[t.BUILD]}?` +
|
|
27303
|
-
`)?)?`);
|
|
27304
|
-
|
|
27305
|
-
createToken('XRANGE', `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAIN]}$`);
|
|
27306
|
-
createToken('XRANGELOOSE', `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAINLOOSE]}$`);
|
|
27307
|
-
|
|
27308
|
-
// Coercion.
|
|
27309
|
-
// Extract anything that could conceivably be a part of a valid semver
|
|
27310
|
-
createToken('COERCEPLAIN', `${'(^|[^\\d])' +
|
|
27311
|
-
'(\\d{1,'}${MAX_SAFE_COMPONENT_LENGTH}})` +
|
|
27312
|
-
`(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?` +
|
|
27313
|
-
`(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?`);
|
|
27314
|
-
createToken('COERCE', `${src[t.COERCEPLAIN]}(?:$|[^\\d])`);
|
|
27315
|
-
createToken('COERCEFULL', src[t.COERCEPLAIN] +
|
|
27316
|
-
`(?:${src[t.PRERELEASE]})?` +
|
|
27317
|
-
`(?:${src[t.BUILD]})?` +
|
|
27318
|
-
`(?:$|[^\\d])`);
|
|
27319
|
-
createToken('COERCERTL', src[t.COERCE], true);
|
|
27320
|
-
createToken('COERCERTLFULL', src[t.COERCEFULL], true);
|
|
27321
|
-
|
|
27322
|
-
// Tilde ranges.
|
|
27323
|
-
// Meaning is "reasonably at or greater than"
|
|
27324
|
-
createToken('LONETILDE', '(?:~>?)');
|
|
27325
|
-
|
|
27326
|
-
createToken('TILDETRIM', `(\\s*)${src[t.LONETILDE]}\\s+`, true);
|
|
27327
|
-
exports.tildeTrimReplace = '$1~';
|
|
27328
|
-
|
|
27329
|
-
createToken('TILDE', `^${src[t.LONETILDE]}${src[t.XRANGEPLAIN]}$`);
|
|
27330
|
-
createToken('TILDELOOSE', `^${src[t.LONETILDE]}${src[t.XRANGEPLAINLOOSE]}$`);
|
|
27331
|
-
|
|
27332
|
-
// Caret ranges.
|
|
27333
|
-
// Meaning is "at least and backwards compatible with"
|
|
27334
|
-
createToken('LONECARET', '(?:\\^)');
|
|
27335
|
-
|
|
27336
|
-
createToken('CARETTRIM', `(\\s*)${src[t.LONECARET]}\\s+`, true);
|
|
27337
|
-
exports.caretTrimReplace = '$1^';
|
|
27338
|
-
|
|
27339
|
-
createToken('CARET', `^${src[t.LONECARET]}${src[t.XRANGEPLAIN]}$`);
|
|
27340
|
-
createToken('CARETLOOSE', `^${src[t.LONECARET]}${src[t.XRANGEPLAINLOOSE]}$`);
|
|
27341
|
-
|
|
27342
|
-
// A simple gt/lt/eq thing, or just "" to indicate "any version"
|
|
27343
|
-
createToken('COMPARATORLOOSE', `^${src[t.GTLT]}\\s*(${src[t.LOOSEPLAIN]})$|^$`);
|
|
27344
|
-
createToken('COMPARATOR', `^${src[t.GTLT]}\\s*(${src[t.FULLPLAIN]})$|^$`);
|
|
27345
|
-
|
|
27346
|
-
// An expression to strip any whitespace between the gtlt and the thing
|
|
27347
|
-
// it modifies, so that `> 1.2.3` ==> `>1.2.3`
|
|
27348
|
-
createToken('COMPARATORTRIM', `(\\s*)${src[t.GTLT]
|
|
27349
|
-
}\\s*(${src[t.LOOSEPLAIN]}|${src[t.XRANGEPLAIN]})`, true);
|
|
27350
|
-
exports.comparatorTrimReplace = '$1$2$3';
|
|
27351
|
-
|
|
27352
|
-
// Something like `1.2.3 - 1.2.4`
|
|
27353
|
-
// Note that these all use the loose form, because they'll be
|
|
27354
|
-
// checked against either the strict or loose comparator form
|
|
27355
|
-
// later.
|
|
27356
|
-
createToken('HYPHENRANGE', `^\\s*(${src[t.XRANGEPLAIN]})` +
|
|
27357
|
-
`\\s+-\\s+` +
|
|
27358
|
-
`(${src[t.XRANGEPLAIN]})` +
|
|
27359
|
-
`\\s*$`);
|
|
27360
|
-
|
|
27361
|
-
createToken('HYPHENRANGELOOSE', `^\\s*(${src[t.XRANGEPLAINLOOSE]})` +
|
|
27362
|
-
`\\s+-\\s+` +
|
|
27363
|
-
`(${src[t.XRANGEPLAINLOOSE]})` +
|
|
27364
|
-
`\\s*$`);
|
|
27365
|
-
|
|
27366
|
-
// Star ranges basically just allow anything at all.
|
|
27367
|
-
createToken('STAR', '(<|>)?=?\\s*\\*');
|
|
27368
|
-
// >=0.0.0 is like a star
|
|
27369
|
-
createToken('GTE0', '^\\s*>=\\s*0\\.0\\.0\\s*$');
|
|
27370
|
-
createToken('GTE0PRE', '^\\s*>=\\s*0\\.0\\.0-0\\s*$');
|
|
27371
|
-
} (re$1, re$1.exports));
|
|
27464
|
+
const {
|
|
27465
|
+
MAX_SAFE_COMPONENT_LENGTH,
|
|
27466
|
+
MAX_SAFE_BUILD_LENGTH,
|
|
27467
|
+
MAX_LENGTH
|
|
27468
|
+
} = constants;
|
|
27469
|
+
const debug = debug_1;
|
|
27470
|
+
exports = module.exports = {};
|
|
27471
|
+
|
|
27472
|
+
// The actual regexps go on exports.re
|
|
27473
|
+
const re = exports.re = [];
|
|
27474
|
+
const safeRe = exports.safeRe = [];
|
|
27475
|
+
const src = exports.src = [];
|
|
27476
|
+
const t = exports.t = {};
|
|
27477
|
+
let R = 0;
|
|
27478
|
+
const LETTERDASHNUMBER = '[a-zA-Z0-9-]';
|
|
27479
|
+
|
|
27480
|
+
// Replace some greedy regex tokens to prevent regex dos issues. These regex are
|
|
27481
|
+
// used internally via the safeRe object since all inputs in this library get
|
|
27482
|
+
// normalized first to trim and collapse all extra whitespace. The original
|
|
27483
|
+
// regexes are exported for userland consumption and lower level usage. A
|
|
27484
|
+
// future breaking change could export the safer regex only with a note that
|
|
27485
|
+
// all input should have extra whitespace removed.
|
|
27486
|
+
const safeRegexReplacements = [['\\s', 1], ['\\d', MAX_LENGTH], [LETTERDASHNUMBER, MAX_SAFE_BUILD_LENGTH]];
|
|
27487
|
+
const makeSafeRegex = value => {
|
|
27488
|
+
for (const [token, max] of safeRegexReplacements) {
|
|
27489
|
+
value = value.split("".concat(token, "*")).join("".concat(token, "{0,").concat(max, "}")).split("".concat(token, "+")).join("".concat(token, "{1,").concat(max, "}"));
|
|
27490
|
+
}
|
|
27491
|
+
return value;
|
|
27492
|
+
};
|
|
27493
|
+
const createToken = (name, value, isGlobal) => {
|
|
27494
|
+
const safe = makeSafeRegex(value);
|
|
27495
|
+
const index = R++;
|
|
27496
|
+
debug(name, index, value);
|
|
27497
|
+
t[name] = index;
|
|
27498
|
+
src[index] = value;
|
|
27499
|
+
re[index] = new RegExp(value, isGlobal ? 'g' : undefined);
|
|
27500
|
+
safeRe[index] = new RegExp(safe, isGlobal ? 'g' : undefined);
|
|
27501
|
+
};
|
|
27372
27502
|
|
|
27503
|
+
// The following Regular Expressions can be used for tokenizing,
|
|
27504
|
+
// validating, and parsing SemVer version strings.
|
|
27505
|
+
|
|
27506
|
+
// ## Numeric Identifier
|
|
27507
|
+
// A single `0`, or a non-zero digit followed by zero or more digits.
|
|
27508
|
+
|
|
27509
|
+
createToken('NUMERICIDENTIFIER', '0|[1-9]\\d*');
|
|
27510
|
+
createToken('NUMERICIDENTIFIERLOOSE', '\\d+');
|
|
27511
|
+
|
|
27512
|
+
// ## Non-numeric Identifier
|
|
27513
|
+
// Zero or more digits, followed by a letter or hyphen, and then zero or
|
|
27514
|
+
// more letters, digits, or hyphens.
|
|
27515
|
+
|
|
27516
|
+
createToken('NONNUMERICIDENTIFIER', "\\d*[a-zA-Z-]".concat(LETTERDASHNUMBER, "*"));
|
|
27517
|
+
|
|
27518
|
+
// ## Main Version
|
|
27519
|
+
// Three dot-separated numeric identifiers.
|
|
27520
|
+
|
|
27521
|
+
createToken('MAINVERSION', "(".concat(src[t.NUMERICIDENTIFIER], ")\\.") + "(".concat(src[t.NUMERICIDENTIFIER], ")\\.") + "(".concat(src[t.NUMERICIDENTIFIER], ")"));
|
|
27522
|
+
createToken('MAINVERSIONLOOSE', "(".concat(src[t.NUMERICIDENTIFIERLOOSE], ")\\.") + "(".concat(src[t.NUMERICIDENTIFIERLOOSE], ")\\.") + "(".concat(src[t.NUMERICIDENTIFIERLOOSE], ")"));
|
|
27523
|
+
|
|
27524
|
+
// ## Pre-release Version Identifier
|
|
27525
|
+
// A numeric identifier, or a non-numeric identifier.
|
|
27526
|
+
|
|
27527
|
+
createToken('PRERELEASEIDENTIFIER', "(?:".concat(src[t.NUMERICIDENTIFIER], "|").concat(src[t.NONNUMERICIDENTIFIER], ")"));
|
|
27528
|
+
createToken('PRERELEASEIDENTIFIERLOOSE', "(?:".concat(src[t.NUMERICIDENTIFIERLOOSE], "|").concat(src[t.NONNUMERICIDENTIFIER], ")"));
|
|
27529
|
+
|
|
27530
|
+
// ## Pre-release Version
|
|
27531
|
+
// Hyphen, followed by one or more dot-separated pre-release version
|
|
27532
|
+
// identifiers.
|
|
27533
|
+
|
|
27534
|
+
createToken('PRERELEASE', "(?:-(".concat(src[t.PRERELEASEIDENTIFIER], "(?:\\.").concat(src[t.PRERELEASEIDENTIFIER], ")*))"));
|
|
27535
|
+
createToken('PRERELEASELOOSE', "(?:-?(".concat(src[t.PRERELEASEIDENTIFIERLOOSE], "(?:\\.").concat(src[t.PRERELEASEIDENTIFIERLOOSE], ")*))"));
|
|
27536
|
+
|
|
27537
|
+
// ## Build Metadata Identifier
|
|
27538
|
+
// Any combination of digits, letters, or hyphens.
|
|
27539
|
+
|
|
27540
|
+
createToken('BUILDIDENTIFIER', "".concat(LETTERDASHNUMBER, "+"));
|
|
27541
|
+
|
|
27542
|
+
// ## Build Metadata
|
|
27543
|
+
// Plus sign, followed by one or more period-separated build metadata
|
|
27544
|
+
// identifiers.
|
|
27545
|
+
|
|
27546
|
+
createToken('BUILD', "(?:\\+(".concat(src[t.BUILDIDENTIFIER], "(?:\\.").concat(src[t.BUILDIDENTIFIER], ")*))"));
|
|
27547
|
+
|
|
27548
|
+
// ## Full Version String
|
|
27549
|
+
// A main version, followed optionally by a pre-release version and
|
|
27550
|
+
// build metadata.
|
|
27551
|
+
|
|
27552
|
+
// Note that the only major, minor, patch, and pre-release sections of
|
|
27553
|
+
// the version string are capturing groups. The build metadata is not a
|
|
27554
|
+
// capturing group, because it should not ever be used in version
|
|
27555
|
+
// comparison.
|
|
27556
|
+
|
|
27557
|
+
createToken('FULLPLAIN', "v?".concat(src[t.MAINVERSION]).concat(src[t.PRERELEASE], "?").concat(src[t.BUILD], "?"));
|
|
27558
|
+
createToken('FULL', "^".concat(src[t.FULLPLAIN], "$"));
|
|
27559
|
+
|
|
27560
|
+
// like full, but allows v1.2.3 and =1.2.3, which people do sometimes.
|
|
27561
|
+
// also, 1.0.0alpha1 (prerelease without the hyphen) which is pretty
|
|
27562
|
+
// common in the npm registry.
|
|
27563
|
+
createToken('LOOSEPLAIN', "[v=\\s]*".concat(src[t.MAINVERSIONLOOSE]).concat(src[t.PRERELEASELOOSE], "?").concat(src[t.BUILD], "?"));
|
|
27564
|
+
createToken('LOOSE', "^".concat(src[t.LOOSEPLAIN], "$"));
|
|
27565
|
+
createToken('GTLT', '((?:<|>)?=?)');
|
|
27566
|
+
|
|
27567
|
+
// Something like "2.*" or "1.2.x".
|
|
27568
|
+
// Note that "x.x" is a valid xRange identifer, meaning "any version"
|
|
27569
|
+
// Only the first item is strictly required.
|
|
27570
|
+
createToken('XRANGEIDENTIFIERLOOSE', "".concat(src[t.NUMERICIDENTIFIERLOOSE], "|x|X|\\*"));
|
|
27571
|
+
createToken('XRANGEIDENTIFIER', "".concat(src[t.NUMERICIDENTIFIER], "|x|X|\\*"));
|
|
27572
|
+
createToken('XRANGEPLAIN', "[v=\\s]*(".concat(src[t.XRANGEIDENTIFIER], ")") + "(?:\\.(".concat(src[t.XRANGEIDENTIFIER], ")") + "(?:\\.(".concat(src[t.XRANGEIDENTIFIER], ")") + "(?:".concat(src[t.PRERELEASE], ")?").concat(src[t.BUILD], "?") + ")?)?");
|
|
27573
|
+
createToken('XRANGEPLAINLOOSE', "[v=\\s]*(".concat(src[t.XRANGEIDENTIFIERLOOSE], ")") + "(?:\\.(".concat(src[t.XRANGEIDENTIFIERLOOSE], ")") + "(?:\\.(".concat(src[t.XRANGEIDENTIFIERLOOSE], ")") + "(?:".concat(src[t.PRERELEASELOOSE], ")?").concat(src[t.BUILD], "?") + ")?)?");
|
|
27574
|
+
createToken('XRANGE', "^".concat(src[t.GTLT], "\\s*").concat(src[t.XRANGEPLAIN], "$"));
|
|
27575
|
+
createToken('XRANGELOOSE', "^".concat(src[t.GTLT], "\\s*").concat(src[t.XRANGEPLAINLOOSE], "$"));
|
|
27576
|
+
|
|
27577
|
+
// Coercion.
|
|
27578
|
+
// Extract anything that could conceivably be a part of a valid semver
|
|
27579
|
+
createToken('COERCEPLAIN', "".concat('(^|[^\\d])' + '(\\d{1,').concat(MAX_SAFE_COMPONENT_LENGTH, "})") + "(?:\\.(\\d{1,".concat(MAX_SAFE_COMPONENT_LENGTH, "}))?") + "(?:\\.(\\d{1,".concat(MAX_SAFE_COMPONENT_LENGTH, "}))?"));
|
|
27580
|
+
createToken('COERCE', "".concat(src[t.COERCEPLAIN], "(?:$|[^\\d])"));
|
|
27581
|
+
createToken('COERCEFULL', src[t.COERCEPLAIN] + "(?:".concat(src[t.PRERELEASE], ")?") + "(?:".concat(src[t.BUILD], ")?") + "(?:$|[^\\d])");
|
|
27582
|
+
createToken('COERCERTL', src[t.COERCE], true);
|
|
27583
|
+
createToken('COERCERTLFULL', src[t.COERCEFULL], true);
|
|
27584
|
+
|
|
27585
|
+
// Tilde ranges.
|
|
27586
|
+
// Meaning is "reasonably at or greater than"
|
|
27587
|
+
createToken('LONETILDE', '(?:~>?)');
|
|
27588
|
+
createToken('TILDETRIM', "(\\s*)".concat(src[t.LONETILDE], "\\s+"), true);
|
|
27589
|
+
exports.tildeTrimReplace = '$1~';
|
|
27590
|
+
createToken('TILDE', "^".concat(src[t.LONETILDE]).concat(src[t.XRANGEPLAIN], "$"));
|
|
27591
|
+
createToken('TILDELOOSE', "^".concat(src[t.LONETILDE]).concat(src[t.XRANGEPLAINLOOSE], "$"));
|
|
27592
|
+
|
|
27593
|
+
// Caret ranges.
|
|
27594
|
+
// Meaning is "at least and backwards compatible with"
|
|
27595
|
+
createToken('LONECARET', '(?:\\^)');
|
|
27596
|
+
createToken('CARETTRIM', "(\\s*)".concat(src[t.LONECARET], "\\s+"), true);
|
|
27597
|
+
exports.caretTrimReplace = '$1^';
|
|
27598
|
+
createToken('CARET', "^".concat(src[t.LONECARET]).concat(src[t.XRANGEPLAIN], "$"));
|
|
27599
|
+
createToken('CARETLOOSE', "^".concat(src[t.LONECARET]).concat(src[t.XRANGEPLAINLOOSE], "$"));
|
|
27600
|
+
|
|
27601
|
+
// A simple gt/lt/eq thing, or just "" to indicate "any version"
|
|
27602
|
+
createToken('COMPARATORLOOSE', "^".concat(src[t.GTLT], "\\s*(").concat(src[t.LOOSEPLAIN], ")$|^$"));
|
|
27603
|
+
createToken('COMPARATOR', "^".concat(src[t.GTLT], "\\s*(").concat(src[t.FULLPLAIN], ")$|^$"));
|
|
27604
|
+
|
|
27605
|
+
// An expression to strip any whitespace between the gtlt and the thing
|
|
27606
|
+
// it modifies, so that `> 1.2.3` ==> `>1.2.3`
|
|
27607
|
+
createToken('COMPARATORTRIM', "(\\s*)".concat(src[t.GTLT], "\\s*(").concat(src[t.LOOSEPLAIN], "|").concat(src[t.XRANGEPLAIN], ")"), true);
|
|
27608
|
+
exports.comparatorTrimReplace = '$1$2$3';
|
|
27609
|
+
|
|
27610
|
+
// Something like `1.2.3 - 1.2.4`
|
|
27611
|
+
// Note that these all use the loose form, because they'll be
|
|
27612
|
+
// checked against either the strict or loose comparator form
|
|
27613
|
+
// later.
|
|
27614
|
+
createToken('HYPHENRANGE', "^\\s*(".concat(src[t.XRANGEPLAIN], ")") + "\\s+-\\s+" + "(".concat(src[t.XRANGEPLAIN], ")") + "\\s*$");
|
|
27615
|
+
createToken('HYPHENRANGELOOSE', "^\\s*(".concat(src[t.XRANGEPLAINLOOSE], ")") + "\\s+-\\s+" + "(".concat(src[t.XRANGEPLAINLOOSE], ")") + "\\s*$");
|
|
27616
|
+
|
|
27617
|
+
// Star ranges basically just allow anything at all.
|
|
27618
|
+
createToken('STAR', '(<|>)?=?\\s*\\*');
|
|
27619
|
+
// >=0.0.0 is like a star
|
|
27620
|
+
createToken('GTE0', '^\\s*>=\\s*0\\.0\\.0\\s*$');
|
|
27621
|
+
createToken('GTE0PRE', '^\\s*>=\\s*0\\.0\\.0-0\\s*$');
|
|
27622
|
+
})(re$1, re$1.exports);
|
|
27373
27623
|
var reExports = re$1.exports;
|
|
27374
27624
|
|
|
27375
27625
|
const numeric = /^[0-9]+$/;
|
|
27376
27626
|
const compareIdentifiers$1 = (a, b) => {
|
|
27377
27627
|
const anum = numeric.test(a);
|
|
27378
27628
|
const bnum = numeric.test(b);
|
|
27379
|
-
|
|
27380
27629
|
if (anum && bnum) {
|
|
27381
27630
|
a = +a;
|
|
27382
27631
|
b = +b;
|
|
27383
27632
|
}
|
|
27384
|
-
|
|
27385
|
-
return a === b ? 0
|
|
27386
|
-
: (anum && !bnum) ? -1
|
|
27387
|
-
: (bnum && !anum) ? 1
|
|
27388
|
-
: a < b ? -1
|
|
27389
|
-
: 1
|
|
27633
|
+
return a === b ? 0 : anum && !bnum ? -1 : bnum && !anum ? 1 : a < b ? -1 : 1;
|
|
27390
27634
|
};
|
|
27391
|
-
|
|
27392
27635
|
const rcompareIdentifiers = (a, b) => compareIdentifiers$1(b, a);
|
|
27393
|
-
|
|
27394
27636
|
var identifiers = {
|
|
27395
27637
|
compareIdentifiers: compareIdentifiers$1,
|
|
27396
|
-
rcompareIdentifiers
|
|
27638
|
+
rcompareIdentifiers
|
|
27397
27639
|
};
|
|
27398
27640
|
|
|
27399
27641
|
const debug = debug_1;
|
|
27400
|
-
const {
|
|
27401
|
-
|
|
27402
|
-
|
|
27642
|
+
const {
|
|
27643
|
+
MAX_LENGTH,
|
|
27644
|
+
MAX_SAFE_INTEGER
|
|
27645
|
+
} = constants;
|
|
27646
|
+
const {
|
|
27647
|
+
safeRe: re,
|
|
27648
|
+
t
|
|
27649
|
+
} = reExports;
|
|
27403
27650
|
const parseOptions = parseOptions_1;
|
|
27404
|
-
const {
|
|
27651
|
+
const {
|
|
27652
|
+
compareIdentifiers
|
|
27653
|
+
} = identifiers;
|
|
27405
27654
|
let SemVer$1 = class SemVer {
|
|
27406
|
-
constructor
|
|
27655
|
+
constructor(version, options) {
|
|
27407
27656
|
options = parseOptions(options);
|
|
27408
|
-
|
|
27409
27657
|
if (version instanceof SemVer) {
|
|
27410
|
-
if (version.loose === !!options.loose &&
|
|
27411
|
-
|
|
27412
|
-
return version
|
|
27658
|
+
if (version.loose === !!options.loose && version.includePrerelease === !!options.includePrerelease) {
|
|
27659
|
+
return version;
|
|
27413
27660
|
} else {
|
|
27414
27661
|
version = version.version;
|
|
27415
27662
|
}
|
|
27416
27663
|
} else if (typeof version !== 'string') {
|
|
27417
|
-
throw new TypeError(
|
|
27664
|
+
throw new TypeError("Invalid version. Must be a string. Got type \"".concat(typeof version, "\"."));
|
|
27418
27665
|
}
|
|
27419
|
-
|
|
27420
27666
|
if (version.length > MAX_LENGTH) {
|
|
27421
|
-
throw new TypeError(
|
|
27422
|
-
`version is longer than ${MAX_LENGTH} characters`
|
|
27423
|
-
)
|
|
27667
|
+
throw new TypeError("version is longer than ".concat(MAX_LENGTH, " characters"));
|
|
27424
27668
|
}
|
|
27425
|
-
|
|
27426
27669
|
debug('SemVer', version, options);
|
|
27427
27670
|
this.options = options;
|
|
27428
27671
|
this.loose = !!options.loose;
|
|
27429
27672
|
// this isn't actually relevant for versions, but keep it so that we
|
|
27430
27673
|
// don't run into trouble passing this.options around.
|
|
27431
27674
|
this.includePrerelease = !!options.includePrerelease;
|
|
27432
|
-
|
|
27433
27675
|
const m = version.trim().match(options.loose ? re[t.LOOSE] : re[t.FULL]);
|
|
27434
|
-
|
|
27435
27676
|
if (!m) {
|
|
27436
|
-
throw new TypeError(
|
|
27677
|
+
throw new TypeError("Invalid Version: ".concat(version));
|
|
27437
27678
|
}
|
|
27438
|
-
|
|
27439
27679
|
this.raw = version;
|
|
27440
27680
|
|
|
27441
27681
|
// these are actually numbers
|
|
27442
27682
|
this.major = +m[1];
|
|
27443
27683
|
this.minor = +m[2];
|
|
27444
27684
|
this.patch = +m[3];
|
|
27445
|
-
|
|
27446
27685
|
if (this.major > MAX_SAFE_INTEGER || this.major < 0) {
|
|
27447
|
-
throw new TypeError('Invalid major version')
|
|
27686
|
+
throw new TypeError('Invalid major version');
|
|
27448
27687
|
}
|
|
27449
|
-
|
|
27450
27688
|
if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) {
|
|
27451
|
-
throw new TypeError('Invalid minor version')
|
|
27689
|
+
throw new TypeError('Invalid minor version');
|
|
27452
27690
|
}
|
|
27453
|
-
|
|
27454
27691
|
if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) {
|
|
27455
|
-
throw new TypeError('Invalid patch version')
|
|
27692
|
+
throw new TypeError('Invalid patch version');
|
|
27456
27693
|
}
|
|
27457
27694
|
|
|
27458
27695
|
// numberify any prerelease numeric ids
|
|
27459
27696
|
if (!m[4]) {
|
|
27460
27697
|
this.prerelease = [];
|
|
27461
27698
|
} else {
|
|
27462
|
-
this.prerelease = m[4].split('.').map(
|
|
27699
|
+
this.prerelease = m[4].split('.').map(id => {
|
|
27463
27700
|
if (/^[0-9]+$/.test(id)) {
|
|
27464
27701
|
const num = +id;
|
|
27465
27702
|
if (num >= 0 && num < MAX_SAFE_INTEGER) {
|
|
27466
|
-
return num
|
|
27703
|
+
return num;
|
|
27467
27704
|
}
|
|
27468
27705
|
}
|
|
27469
|
-
return id
|
|
27706
|
+
return id;
|
|
27470
27707
|
});
|
|
27471
27708
|
}
|
|
27472
|
-
|
|
27473
27709
|
this.build = m[5] ? m[5].split('.') : [];
|
|
27474
27710
|
this.format();
|
|
27475
27711
|
}
|
|
27476
|
-
|
|
27477
|
-
|
|
27478
|
-
this.version = `${this.major}.${this.minor}.${this.patch}`;
|
|
27712
|
+
format() {
|
|
27713
|
+
this.version = "".concat(this.major, ".").concat(this.minor, ".").concat(this.patch);
|
|
27479
27714
|
if (this.prerelease.length) {
|
|
27480
|
-
this.version +=
|
|
27715
|
+
this.version += "-".concat(this.prerelease.join('.'));
|
|
27481
27716
|
}
|
|
27482
|
-
return this.version
|
|
27717
|
+
return this.version;
|
|
27483
27718
|
}
|
|
27484
|
-
|
|
27485
|
-
|
|
27486
|
-
return this.version
|
|
27719
|
+
toString() {
|
|
27720
|
+
return this.version;
|
|
27487
27721
|
}
|
|
27488
|
-
|
|
27489
|
-
compare (other) {
|
|
27722
|
+
compare(other) {
|
|
27490
27723
|
debug('SemVer.compare', this.version, this.options, other);
|
|
27491
27724
|
if (!(other instanceof SemVer)) {
|
|
27492
27725
|
if (typeof other === 'string' && other === this.version) {
|
|
27493
|
-
return 0
|
|
27726
|
+
return 0;
|
|
27494
27727
|
}
|
|
27495
27728
|
other = new SemVer(other, this.options);
|
|
27496
27729
|
}
|
|
27497
|
-
|
|
27498
27730
|
if (other.version === this.version) {
|
|
27499
|
-
return 0
|
|
27731
|
+
return 0;
|
|
27500
27732
|
}
|
|
27501
|
-
|
|
27502
|
-
return this.compareMain(other) || this.comparePre(other)
|
|
27733
|
+
return this.compareMain(other) || this.comparePre(other);
|
|
27503
27734
|
}
|
|
27504
|
-
|
|
27505
|
-
compareMain (other) {
|
|
27735
|
+
compareMain(other) {
|
|
27506
27736
|
if (!(other instanceof SemVer)) {
|
|
27507
27737
|
other = new SemVer(other, this.options);
|
|
27508
27738
|
}
|
|
27509
|
-
|
|
27510
|
-
return (
|
|
27511
|
-
compareIdentifiers(this.major, other.major) ||
|
|
27512
|
-
compareIdentifiers(this.minor, other.minor) ||
|
|
27513
|
-
compareIdentifiers(this.patch, other.patch)
|
|
27514
|
-
)
|
|
27739
|
+
return compareIdentifiers(this.major, other.major) || compareIdentifiers(this.minor, other.minor) || compareIdentifiers(this.patch, other.patch);
|
|
27515
27740
|
}
|
|
27516
|
-
|
|
27517
|
-
comparePre (other) {
|
|
27741
|
+
comparePre(other) {
|
|
27518
27742
|
if (!(other instanceof SemVer)) {
|
|
27519
27743
|
other = new SemVer(other, this.options);
|
|
27520
27744
|
}
|
|
27521
27745
|
|
|
27522
27746
|
// NOT having a prerelease is > having one
|
|
27523
27747
|
if (this.prerelease.length && !other.prerelease.length) {
|
|
27524
|
-
return -1
|
|
27748
|
+
return -1;
|
|
27525
27749
|
} else if (!this.prerelease.length && other.prerelease.length) {
|
|
27526
|
-
return 1
|
|
27750
|
+
return 1;
|
|
27527
27751
|
} else if (!this.prerelease.length && !other.prerelease.length) {
|
|
27528
|
-
return 0
|
|
27752
|
+
return 0;
|
|
27529
27753
|
}
|
|
27530
|
-
|
|
27531
27754
|
let i = 0;
|
|
27532
27755
|
do {
|
|
27533
27756
|
const a = this.prerelease[i];
|
|
27534
27757
|
const b = other.prerelease[i];
|
|
27535
27758
|
debug('prerelease compare', i, a, b);
|
|
27536
27759
|
if (a === undefined && b === undefined) {
|
|
27537
|
-
return 0
|
|
27760
|
+
return 0;
|
|
27538
27761
|
} else if (b === undefined) {
|
|
27539
|
-
return 1
|
|
27762
|
+
return 1;
|
|
27540
27763
|
} else if (a === undefined) {
|
|
27541
|
-
return -1
|
|
27764
|
+
return -1;
|
|
27542
27765
|
} else if (a === b) {
|
|
27543
|
-
continue
|
|
27766
|
+
continue;
|
|
27544
27767
|
} else {
|
|
27545
|
-
return compareIdentifiers(a, b)
|
|
27768
|
+
return compareIdentifiers(a, b);
|
|
27546
27769
|
}
|
|
27547
|
-
} while (++i)
|
|
27770
|
+
} while (++i);
|
|
27548
27771
|
}
|
|
27549
|
-
|
|
27550
|
-
compareBuild (other) {
|
|
27772
|
+
compareBuild(other) {
|
|
27551
27773
|
if (!(other instanceof SemVer)) {
|
|
27552
27774
|
other = new SemVer(other, this.options);
|
|
27553
27775
|
}
|
|
27554
|
-
|
|
27555
27776
|
let i = 0;
|
|
27556
27777
|
do {
|
|
27557
27778
|
const a = this.build[i];
|
|
27558
27779
|
const b = other.build[i];
|
|
27559
27780
|
debug('build compare', i, a, b);
|
|
27560
27781
|
if (a === undefined && b === undefined) {
|
|
27561
|
-
return 0
|
|
27782
|
+
return 0;
|
|
27562
27783
|
} else if (b === undefined) {
|
|
27563
|
-
return 1
|
|
27784
|
+
return 1;
|
|
27564
27785
|
} else if (a === undefined) {
|
|
27565
|
-
return -1
|
|
27786
|
+
return -1;
|
|
27566
27787
|
} else if (a === b) {
|
|
27567
|
-
continue
|
|
27788
|
+
continue;
|
|
27568
27789
|
} else {
|
|
27569
|
-
return compareIdentifiers(a, b)
|
|
27790
|
+
return compareIdentifiers(a, b);
|
|
27570
27791
|
}
|
|
27571
|
-
} while (++i)
|
|
27792
|
+
} while (++i);
|
|
27572
27793
|
}
|
|
27573
27794
|
|
|
27574
27795
|
// preminor will bump the version up to the next minor release, and immediately
|
|
27575
27796
|
// down to pre-release. premajor and prepatch work the same way.
|
|
27576
|
-
inc
|
|
27797
|
+
inc(release, identifier, identifierBase) {
|
|
27577
27798
|
switch (release) {
|
|
27578
27799
|
case 'premajor':
|
|
27579
27800
|
this.prerelease.length = 0;
|
|
@@ -27581,13 +27802,13 @@ let SemVer$1 = class SemVer {
|
|
|
27581
27802
|
this.minor = 0;
|
|
27582
27803
|
this.major++;
|
|
27583
27804
|
this.inc('pre', identifier, identifierBase);
|
|
27584
|
-
break
|
|
27805
|
+
break;
|
|
27585
27806
|
case 'preminor':
|
|
27586
27807
|
this.prerelease.length = 0;
|
|
27587
27808
|
this.patch = 0;
|
|
27588
27809
|
this.minor++;
|
|
27589
27810
|
this.inc('pre', identifier, identifierBase);
|
|
27590
|
-
break
|
|
27811
|
+
break;
|
|
27591
27812
|
case 'prepatch':
|
|
27592
27813
|
// If this is already a prerelease, it will bump to the next version
|
|
27593
27814
|
// drop any prereleases that might already exist, since they are not
|
|
@@ -27595,7 +27816,7 @@ let SemVer$1 = class SemVer {
|
|
|
27595
27816
|
this.prerelease.length = 0;
|
|
27596
27817
|
this.inc('patch', identifier, identifierBase);
|
|
27597
27818
|
this.inc('pre', identifier, identifierBase);
|
|
27598
|
-
break
|
|
27819
|
+
break;
|
|
27599
27820
|
// If the input is a non-prerelease version, this acts the same as
|
|
27600
27821
|
// prepatch.
|
|
27601
27822
|
case 'prerelease':
|
|
@@ -27603,24 +27824,19 @@ let SemVer$1 = class SemVer {
|
|
|
27603
27824
|
this.inc('patch', identifier, identifierBase);
|
|
27604
27825
|
}
|
|
27605
27826
|
this.inc('pre', identifier, identifierBase);
|
|
27606
|
-
break
|
|
27607
|
-
|
|
27827
|
+
break;
|
|
27608
27828
|
case 'major':
|
|
27609
27829
|
// If this is a pre-major version, bump up to the same major version.
|
|
27610
27830
|
// Otherwise increment major.
|
|
27611
27831
|
// 1.0.0-5 bumps to 1.0.0
|
|
27612
27832
|
// 1.1.0 bumps to 2.0.0
|
|
27613
|
-
if (
|
|
27614
|
-
this.minor !== 0 ||
|
|
27615
|
-
this.patch !== 0 ||
|
|
27616
|
-
this.prerelease.length === 0
|
|
27617
|
-
) {
|
|
27833
|
+
if (this.minor !== 0 || this.patch !== 0 || this.prerelease.length === 0) {
|
|
27618
27834
|
this.major++;
|
|
27619
27835
|
}
|
|
27620
27836
|
this.minor = 0;
|
|
27621
27837
|
this.patch = 0;
|
|
27622
27838
|
this.prerelease = [];
|
|
27623
|
-
break
|
|
27839
|
+
break;
|
|
27624
27840
|
case 'minor':
|
|
27625
27841
|
// If this is a pre-minor version, bump up to the same minor version.
|
|
27626
27842
|
// Otherwise increment minor.
|
|
@@ -27631,7 +27847,7 @@ let SemVer$1 = class SemVer {
|
|
|
27631
27847
|
}
|
|
27632
27848
|
this.patch = 0;
|
|
27633
27849
|
this.prerelease = [];
|
|
27634
|
-
break
|
|
27850
|
+
break;
|
|
27635
27851
|
case 'patch':
|
|
27636
27852
|
// If this is not a pre-release version, it will increment the patch.
|
|
27637
27853
|
// If it is a pre-release it will bump up to the same patch version.
|
|
@@ -27641,68 +27857,64 @@ let SemVer$1 = class SemVer {
|
|
|
27641
27857
|
this.patch++;
|
|
27642
27858
|
}
|
|
27643
27859
|
this.prerelease = [];
|
|
27644
|
-
break
|
|
27860
|
+
break;
|
|
27645
27861
|
// This probably shouldn't be used publicly.
|
|
27646
27862
|
// 1.0.0 'pre' would become 1.0.0-0 which is the wrong direction.
|
|
27647
|
-
case 'pre':
|
|
27648
|
-
|
|
27649
|
-
|
|
27650
|
-
|
|
27651
|
-
|
|
27652
|
-
}
|
|
27653
|
-
|
|
27654
|
-
if (this.prerelease.length === 0) {
|
|
27655
|
-
this.prerelease = [base];
|
|
27656
|
-
} else {
|
|
27657
|
-
let i = this.prerelease.length;
|
|
27658
|
-
while (--i >= 0) {
|
|
27659
|
-
if (typeof this.prerelease[i] === 'number') {
|
|
27660
|
-
this.prerelease[i]++;
|
|
27661
|
-
i = -2;
|
|
27662
|
-
}
|
|
27863
|
+
case 'pre':
|
|
27864
|
+
{
|
|
27865
|
+
const base = Number(identifierBase) ? 1 : 0;
|
|
27866
|
+
if (!identifier && identifierBase === false) {
|
|
27867
|
+
throw new Error('invalid increment argument: identifier is empty');
|
|
27663
27868
|
}
|
|
27664
|
-
if (
|
|
27665
|
-
|
|
27666
|
-
|
|
27667
|
-
|
|
27869
|
+
if (this.prerelease.length === 0) {
|
|
27870
|
+
this.prerelease = [base];
|
|
27871
|
+
} else {
|
|
27872
|
+
let i = this.prerelease.length;
|
|
27873
|
+
while (--i >= 0) {
|
|
27874
|
+
if (typeof this.prerelease[i] === 'number') {
|
|
27875
|
+
this.prerelease[i]++;
|
|
27876
|
+
i = -2;
|
|
27877
|
+
}
|
|
27878
|
+
}
|
|
27879
|
+
if (i === -1) {
|
|
27880
|
+
// didn't increment anything
|
|
27881
|
+
if (identifier === this.prerelease.join('.') && identifierBase === false) {
|
|
27882
|
+
throw new Error('invalid increment argument: identifier already exists');
|
|
27883
|
+
}
|
|
27884
|
+
this.prerelease.push(base);
|
|
27668
27885
|
}
|
|
27669
|
-
this.prerelease.push(base);
|
|
27670
|
-
}
|
|
27671
|
-
}
|
|
27672
|
-
if (identifier) {
|
|
27673
|
-
// 1.2.0-beta.1 bumps to 1.2.0-beta.2,
|
|
27674
|
-
// 1.2.0-beta.fooblz or 1.2.0-beta bumps to 1.2.0-beta.0
|
|
27675
|
-
let prerelease = [identifier, base];
|
|
27676
|
-
if (identifierBase === false) {
|
|
27677
|
-
prerelease = [identifier];
|
|
27678
27886
|
}
|
|
27679
|
-
if (
|
|
27680
|
-
|
|
27887
|
+
if (identifier) {
|
|
27888
|
+
// 1.2.0-beta.1 bumps to 1.2.0-beta.2,
|
|
27889
|
+
// 1.2.0-beta.fooblz or 1.2.0-beta bumps to 1.2.0-beta.0
|
|
27890
|
+
let prerelease = [identifier, base];
|
|
27891
|
+
if (identifierBase === false) {
|
|
27892
|
+
prerelease = [identifier];
|
|
27893
|
+
}
|
|
27894
|
+
if (compareIdentifiers(this.prerelease[0], identifier) === 0) {
|
|
27895
|
+
if (isNaN(this.prerelease[1])) {
|
|
27896
|
+
this.prerelease = prerelease;
|
|
27897
|
+
}
|
|
27898
|
+
} else {
|
|
27681
27899
|
this.prerelease = prerelease;
|
|
27682
27900
|
}
|
|
27683
|
-
} else {
|
|
27684
|
-
this.prerelease = prerelease;
|
|
27685
27901
|
}
|
|
27902
|
+
break;
|
|
27686
27903
|
}
|
|
27687
|
-
break
|
|
27688
|
-
}
|
|
27689
27904
|
default:
|
|
27690
|
-
throw new Error(
|
|
27905
|
+
throw new Error("invalid increment argument: ".concat(release));
|
|
27691
27906
|
}
|
|
27692
27907
|
this.raw = this.format();
|
|
27693
27908
|
if (this.build.length) {
|
|
27694
|
-
this.raw +=
|
|
27909
|
+
this.raw += "+".concat(this.build.join('.'));
|
|
27695
27910
|
}
|
|
27696
|
-
return this
|
|
27911
|
+
return this;
|
|
27697
27912
|
}
|
|
27698
27913
|
};
|
|
27699
|
-
|
|
27700
27914
|
var semver = SemVer$1;
|
|
27701
27915
|
|
|
27702
27916
|
const SemVer = semver;
|
|
27703
|
-
const compare$6 = (a, b, loose) =>
|
|
27704
|
-
new SemVer(a, loose).compare(new SemVer(b, loose));
|
|
27705
|
-
|
|
27917
|
+
const compare$6 = (a, b, loose) => new SemVer(a, loose).compare(new SemVer(b, loose));
|
|
27706
27918
|
var compare_1 = compare$6;
|
|
27707
27919
|
|
|
27708
27920
|
const compare$5 = compare_1;
|
|
@@ -27735,7 +27947,6 @@ const gt = gt_1;
|
|
|
27735
27947
|
const gte = gte_1;
|
|
27736
27948
|
const lt = lt_1;
|
|
27737
27949
|
const lte = lte_1;
|
|
27738
|
-
|
|
27739
27950
|
const cmp = (a, op, b, loose) => {
|
|
27740
27951
|
switch (op) {
|
|
27741
27952
|
case '===':
|
|
@@ -27745,8 +27956,7 @@ const cmp = (a, op, b, loose) => {
|
|
|
27745
27956
|
if (typeof b === 'object') {
|
|
27746
27957
|
b = b.version;
|
|
27747
27958
|
}
|
|
27748
|
-
return a === b
|
|
27749
|
-
|
|
27959
|
+
return a === b;
|
|
27750
27960
|
case '!==':
|
|
27751
27961
|
if (typeof a === 'object') {
|
|
27752
27962
|
a = a.version;
|
|
@@ -27754,731 +27964,628 @@ const cmp = (a, op, b, loose) => {
|
|
|
27754
27964
|
if (typeof b === 'object') {
|
|
27755
27965
|
b = b.version;
|
|
27756
27966
|
}
|
|
27757
|
-
return a !== b
|
|
27758
|
-
|
|
27967
|
+
return a !== b;
|
|
27759
27968
|
case '':
|
|
27760
27969
|
case '=':
|
|
27761
27970
|
case '==':
|
|
27762
|
-
return eq(a, b, loose)
|
|
27763
|
-
|
|
27971
|
+
return eq(a, b, loose);
|
|
27764
27972
|
case '!=':
|
|
27765
|
-
return neq(a, b, loose)
|
|
27766
|
-
|
|
27973
|
+
return neq(a, b, loose);
|
|
27767
27974
|
case '>':
|
|
27768
|
-
return gt(a, b, loose)
|
|
27769
|
-
|
|
27975
|
+
return gt(a, b, loose);
|
|
27770
27976
|
case '>=':
|
|
27771
|
-
return gte(a, b, loose)
|
|
27772
|
-
|
|
27977
|
+
return gte(a, b, loose);
|
|
27773
27978
|
case '<':
|
|
27774
|
-
return lt(a, b, loose)
|
|
27775
|
-
|
|
27979
|
+
return lt(a, b, loose);
|
|
27776
27980
|
case '<=':
|
|
27777
|
-
return lte(a, b, loose)
|
|
27778
|
-
|
|
27981
|
+
return lte(a, b, loose);
|
|
27779
27982
|
default:
|
|
27780
|
-
throw new TypeError(
|
|
27983
|
+
throw new TypeError("Invalid operator: ".concat(op));
|
|
27781
27984
|
}
|
|
27782
27985
|
};
|
|
27783
27986
|
var cmp_1 = cmp;
|
|
27784
27987
|
|
|
27785
27988
|
var comparator;
|
|
27786
27989
|
var hasRequiredComparator;
|
|
27990
|
+
function requireComparator() {
|
|
27991
|
+
if (hasRequiredComparator) return comparator;
|
|
27992
|
+
hasRequiredComparator = 1;
|
|
27993
|
+
const ANY = Symbol('SemVer ANY');
|
|
27994
|
+
// hoisted class for cyclic dependency
|
|
27995
|
+
class Comparator {
|
|
27996
|
+
static get ANY() {
|
|
27997
|
+
return ANY;
|
|
27998
|
+
}
|
|
27999
|
+
constructor(comp, options) {
|
|
28000
|
+
options = parseOptions(options);
|
|
28001
|
+
if (comp instanceof Comparator) {
|
|
28002
|
+
if (comp.loose === !!options.loose) {
|
|
28003
|
+
return comp;
|
|
28004
|
+
} else {
|
|
28005
|
+
comp = comp.value;
|
|
28006
|
+
}
|
|
28007
|
+
}
|
|
28008
|
+
comp = comp.trim().split(/\s+/).join(' ');
|
|
28009
|
+
debug('comparator', comp, options);
|
|
28010
|
+
this.options = options;
|
|
28011
|
+
this.loose = !!options.loose;
|
|
28012
|
+
this.parse(comp);
|
|
28013
|
+
if (this.semver === ANY) {
|
|
28014
|
+
this.value = '';
|
|
28015
|
+
} else {
|
|
28016
|
+
this.value = this.operator + this.semver.version;
|
|
28017
|
+
}
|
|
28018
|
+
debug('comp', this);
|
|
28019
|
+
}
|
|
28020
|
+
parse(comp) {
|
|
28021
|
+
const r = this.options.loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR];
|
|
28022
|
+
const m = comp.match(r);
|
|
28023
|
+
if (!m) {
|
|
28024
|
+
throw new TypeError("Invalid comparator: ".concat(comp));
|
|
28025
|
+
}
|
|
28026
|
+
this.operator = m[1] !== undefined ? m[1] : '';
|
|
28027
|
+
if (this.operator === '=') {
|
|
28028
|
+
this.operator = '';
|
|
28029
|
+
}
|
|
27787
28030
|
|
|
27788
|
-
|
|
27789
|
-
|
|
27790
|
-
|
|
27791
|
-
|
|
27792
|
-
|
|
27793
|
-
|
|
27794
|
-
|
|
27795
|
-
|
|
27796
|
-
|
|
27797
|
-
|
|
27798
|
-
|
|
27799
|
-
|
|
27800
|
-
|
|
27801
|
-
|
|
27802
|
-
|
|
27803
|
-
|
|
27804
|
-
|
|
27805
|
-
|
|
27806
|
-
|
|
27807
|
-
|
|
27808
|
-
|
|
27809
|
-
|
|
27810
|
-
|
|
27811
|
-
|
|
27812
|
-
|
|
27813
|
-
|
|
27814
|
-
|
|
27815
|
-
|
|
27816
|
-
|
|
27817
|
-
|
|
27818
|
-
|
|
27819
|
-
|
|
27820
|
-
|
|
27821
|
-
|
|
27822
|
-
|
|
27823
|
-
|
|
27824
|
-
|
|
27825
|
-
|
|
27826
|
-
|
|
27827
|
-
|
|
27828
|
-
if (!m) {
|
|
27829
|
-
throw new TypeError(`Invalid comparator: ${comp}`)
|
|
27830
|
-
}
|
|
27831
|
-
|
|
27832
|
-
this.operator = m[1] !== undefined ? m[1] : '';
|
|
27833
|
-
if (this.operator === '=') {
|
|
27834
|
-
this.operator = '';
|
|
27835
|
-
}
|
|
27836
|
-
|
|
27837
|
-
// if it literally is just '>' or '' then allow anything.
|
|
27838
|
-
if (!m[2]) {
|
|
27839
|
-
this.semver = ANY;
|
|
27840
|
-
} else {
|
|
27841
|
-
this.semver = new SemVer(m[2], this.options.loose);
|
|
27842
|
-
}
|
|
27843
|
-
}
|
|
27844
|
-
|
|
27845
|
-
toString () {
|
|
27846
|
-
return this.value
|
|
27847
|
-
}
|
|
27848
|
-
|
|
27849
|
-
test (version) {
|
|
27850
|
-
debug('Comparator.test', version, this.options.loose);
|
|
27851
|
-
|
|
27852
|
-
if (this.semver === ANY || version === ANY) {
|
|
27853
|
-
return true
|
|
27854
|
-
}
|
|
27855
|
-
|
|
27856
|
-
if (typeof version === 'string') {
|
|
27857
|
-
try {
|
|
27858
|
-
version = new SemVer(version, this.options);
|
|
27859
|
-
} catch (er) {
|
|
27860
|
-
return false
|
|
27861
|
-
}
|
|
27862
|
-
}
|
|
27863
|
-
|
|
27864
|
-
return cmp(version, this.operator, this.semver, this.options)
|
|
27865
|
-
}
|
|
27866
|
-
|
|
27867
|
-
intersects (comp, options) {
|
|
27868
|
-
if (!(comp instanceof Comparator)) {
|
|
27869
|
-
throw new TypeError('a Comparator is required')
|
|
27870
|
-
}
|
|
27871
|
-
|
|
27872
|
-
if (this.operator === '') {
|
|
27873
|
-
if (this.value === '') {
|
|
27874
|
-
return true
|
|
27875
|
-
}
|
|
27876
|
-
return new Range(comp.value, options).test(this.value)
|
|
27877
|
-
} else if (comp.operator === '') {
|
|
27878
|
-
if (comp.value === '') {
|
|
27879
|
-
return true
|
|
27880
|
-
}
|
|
27881
|
-
return new Range(this.value, options).test(comp.semver)
|
|
27882
|
-
}
|
|
27883
|
-
|
|
27884
|
-
options = parseOptions(options);
|
|
27885
|
-
|
|
27886
|
-
// Special cases where nothing can possibly be lower
|
|
27887
|
-
if (options.includePrerelease &&
|
|
27888
|
-
(this.value === '<0.0.0-0' || comp.value === '<0.0.0-0')) {
|
|
27889
|
-
return false
|
|
27890
|
-
}
|
|
27891
|
-
if (!options.includePrerelease &&
|
|
27892
|
-
(this.value.startsWith('<0.0.0') || comp.value.startsWith('<0.0.0'))) {
|
|
27893
|
-
return false
|
|
27894
|
-
}
|
|
27895
|
-
|
|
27896
|
-
// Same direction increasing (> or >=)
|
|
27897
|
-
if (this.operator.startsWith('>') && comp.operator.startsWith('>')) {
|
|
27898
|
-
return true
|
|
27899
|
-
}
|
|
27900
|
-
// Same direction decreasing (< or <=)
|
|
27901
|
-
if (this.operator.startsWith('<') && comp.operator.startsWith('<')) {
|
|
27902
|
-
return true
|
|
27903
|
-
}
|
|
27904
|
-
// same SemVer and both sides are inclusive (<= or >=)
|
|
27905
|
-
if (
|
|
27906
|
-
(this.semver.version === comp.semver.version) &&
|
|
27907
|
-
this.operator.includes('=') && comp.operator.includes('=')) {
|
|
27908
|
-
return true
|
|
27909
|
-
}
|
|
27910
|
-
// opposite directions less than
|
|
27911
|
-
if (cmp(this.semver, '<', comp.semver, options) &&
|
|
27912
|
-
this.operator.startsWith('>') && comp.operator.startsWith('<')) {
|
|
27913
|
-
return true
|
|
27914
|
-
}
|
|
27915
|
-
// opposite directions greater than
|
|
27916
|
-
if (cmp(this.semver, '>', comp.semver, options) &&
|
|
27917
|
-
this.operator.startsWith('<') && comp.operator.startsWith('>')) {
|
|
27918
|
-
return true
|
|
27919
|
-
}
|
|
27920
|
-
return false
|
|
27921
|
-
}
|
|
27922
|
-
}
|
|
28031
|
+
// if it literally is just '>' or '' then allow anything.
|
|
28032
|
+
if (!m[2]) {
|
|
28033
|
+
this.semver = ANY;
|
|
28034
|
+
} else {
|
|
28035
|
+
this.semver = new SemVer(m[2], this.options.loose);
|
|
28036
|
+
}
|
|
28037
|
+
}
|
|
28038
|
+
toString() {
|
|
28039
|
+
return this.value;
|
|
28040
|
+
}
|
|
28041
|
+
test(version) {
|
|
28042
|
+
debug('Comparator.test', version, this.options.loose);
|
|
28043
|
+
if (this.semver === ANY || version === ANY) {
|
|
28044
|
+
return true;
|
|
28045
|
+
}
|
|
28046
|
+
if (typeof version === 'string') {
|
|
28047
|
+
try {
|
|
28048
|
+
version = new SemVer(version, this.options);
|
|
28049
|
+
} catch (er) {
|
|
28050
|
+
return false;
|
|
28051
|
+
}
|
|
28052
|
+
}
|
|
28053
|
+
return cmp(version, this.operator, this.semver, this.options);
|
|
28054
|
+
}
|
|
28055
|
+
intersects(comp, options) {
|
|
28056
|
+
if (!(comp instanceof Comparator)) {
|
|
28057
|
+
throw new TypeError('a Comparator is required');
|
|
28058
|
+
}
|
|
28059
|
+
if (this.operator === '') {
|
|
28060
|
+
if (this.value === '') {
|
|
28061
|
+
return true;
|
|
28062
|
+
}
|
|
28063
|
+
return new Range(comp.value, options).test(this.value);
|
|
28064
|
+
} else if (comp.operator === '') {
|
|
28065
|
+
if (comp.value === '') {
|
|
28066
|
+
return true;
|
|
28067
|
+
}
|
|
28068
|
+
return new Range(this.value, options).test(comp.semver);
|
|
28069
|
+
}
|
|
28070
|
+
options = parseOptions(options);
|
|
27923
28071
|
|
|
27924
|
-
|
|
28072
|
+
// Special cases where nothing can possibly be lower
|
|
28073
|
+
if (options.includePrerelease && (this.value === '<0.0.0-0' || comp.value === '<0.0.0-0')) {
|
|
28074
|
+
return false;
|
|
28075
|
+
}
|
|
28076
|
+
if (!options.includePrerelease && (this.value.startsWith('<0.0.0') || comp.value.startsWith('<0.0.0'))) {
|
|
28077
|
+
return false;
|
|
28078
|
+
}
|
|
27925
28079
|
|
|
27926
|
-
|
|
27927
|
-
|
|
27928
|
-
|
|
27929
|
-
|
|
27930
|
-
|
|
27931
|
-
|
|
27932
|
-
|
|
28080
|
+
// Same direction increasing (> or >=)
|
|
28081
|
+
if (this.operator.startsWith('>') && comp.operator.startsWith('>')) {
|
|
28082
|
+
return true;
|
|
28083
|
+
}
|
|
28084
|
+
// Same direction decreasing (< or <=)
|
|
28085
|
+
if (this.operator.startsWith('<') && comp.operator.startsWith('<')) {
|
|
28086
|
+
return true;
|
|
28087
|
+
}
|
|
28088
|
+
// same SemVer and both sides are inclusive (<= or >=)
|
|
28089
|
+
if (this.semver.version === comp.semver.version && this.operator.includes('=') && comp.operator.includes('=')) {
|
|
28090
|
+
return true;
|
|
28091
|
+
}
|
|
28092
|
+
// opposite directions less than
|
|
28093
|
+
if (cmp(this.semver, '<', comp.semver, options) && this.operator.startsWith('>') && comp.operator.startsWith('<')) {
|
|
28094
|
+
return true;
|
|
28095
|
+
}
|
|
28096
|
+
// opposite directions greater than
|
|
28097
|
+
if (cmp(this.semver, '>', comp.semver, options) && this.operator.startsWith('<') && comp.operator.startsWith('>')) {
|
|
28098
|
+
return true;
|
|
28099
|
+
}
|
|
28100
|
+
return false;
|
|
28101
|
+
}
|
|
28102
|
+
}
|
|
28103
|
+
comparator = Comparator;
|
|
28104
|
+
const parseOptions = parseOptions_1;
|
|
28105
|
+
const {
|
|
28106
|
+
safeRe: re,
|
|
28107
|
+
t
|
|
28108
|
+
} = reExports;
|
|
28109
|
+
const cmp = cmp_1;
|
|
28110
|
+
const debug = debug_1;
|
|
28111
|
+
const SemVer = semver;
|
|
28112
|
+
const Range = requireRange();
|
|
28113
|
+
return comparator;
|
|
27933
28114
|
}
|
|
27934
28115
|
|
|
27935
28116
|
var range;
|
|
27936
28117
|
var hasRequiredRange;
|
|
28118
|
+
function requireRange() {
|
|
28119
|
+
if (hasRequiredRange) return range;
|
|
28120
|
+
hasRequiredRange = 1;
|
|
28121
|
+
const SPACE_CHARACTERS = /\s+/g;
|
|
28122
|
+
|
|
28123
|
+
// hoisted class for cyclic dependency
|
|
28124
|
+
class Range {
|
|
28125
|
+
constructor(range, options) {
|
|
28126
|
+
options = parseOptions(options);
|
|
28127
|
+
if (range instanceof Range) {
|
|
28128
|
+
if (range.loose === !!options.loose && range.includePrerelease === !!options.includePrerelease) {
|
|
28129
|
+
return range;
|
|
28130
|
+
} else {
|
|
28131
|
+
return new Range(range.raw, options);
|
|
28132
|
+
}
|
|
28133
|
+
}
|
|
28134
|
+
if (range instanceof Comparator) {
|
|
28135
|
+
// just put it in the set and return
|
|
28136
|
+
this.raw = range.value;
|
|
28137
|
+
this.set = [[range]];
|
|
28138
|
+
this.formatted = undefined;
|
|
28139
|
+
return this;
|
|
28140
|
+
}
|
|
28141
|
+
this.options = options;
|
|
28142
|
+
this.loose = !!options.loose;
|
|
28143
|
+
this.includePrerelease = !!options.includePrerelease;
|
|
28144
|
+
|
|
28145
|
+
// First reduce all whitespace as much as possible so we do not have to rely
|
|
28146
|
+
// on potentially slow regexes like \s*. This is then stored and used for
|
|
28147
|
+
// future error messages as well.
|
|
28148
|
+
this.raw = range.trim().replace(SPACE_CHARACTERS, ' ');
|
|
28149
|
+
|
|
28150
|
+
// First, split on ||
|
|
28151
|
+
this.set = this.raw.split('||')
|
|
28152
|
+
// map the range to a 2d array of comparators
|
|
28153
|
+
.map(r => this.parseRange(r.trim()))
|
|
28154
|
+
// throw out any comparator lists that are empty
|
|
28155
|
+
// this generally means that it was not a valid range, which is allowed
|
|
28156
|
+
// in loose mode, but will still throw if the WHOLE range is invalid.
|
|
28157
|
+
.filter(c => c.length);
|
|
28158
|
+
if (!this.set.length) {
|
|
28159
|
+
throw new TypeError("Invalid SemVer Range: ".concat(this.raw));
|
|
28160
|
+
}
|
|
28161
|
+
|
|
28162
|
+
// if we have any that are not the null set, throw out null sets.
|
|
28163
|
+
if (this.set.length > 1) {
|
|
28164
|
+
// keep the first one, in case they're all null sets
|
|
28165
|
+
const first = this.set[0];
|
|
28166
|
+
this.set = this.set.filter(c => !isNullSet(c[0]));
|
|
28167
|
+
if (this.set.length === 0) {
|
|
28168
|
+
this.set = [first];
|
|
28169
|
+
} else if (this.set.length > 1) {
|
|
28170
|
+
// if we have any that are *, then the range is just *
|
|
28171
|
+
for (const c of this.set) {
|
|
28172
|
+
if (c.length === 1 && isAny(c[0])) {
|
|
28173
|
+
this.set = [c];
|
|
28174
|
+
break;
|
|
28175
|
+
}
|
|
28176
|
+
}
|
|
28177
|
+
}
|
|
28178
|
+
}
|
|
28179
|
+
this.formatted = undefined;
|
|
28180
|
+
}
|
|
28181
|
+
get range() {
|
|
28182
|
+
if (this.formatted === undefined) {
|
|
28183
|
+
this.formatted = '';
|
|
28184
|
+
for (let i = 0; i < this.set.length; i++) {
|
|
28185
|
+
if (i > 0) {
|
|
28186
|
+
this.formatted += '||';
|
|
28187
|
+
}
|
|
28188
|
+
const comps = this.set[i];
|
|
28189
|
+
for (let k = 0; k < comps.length; k++) {
|
|
28190
|
+
if (k > 0) {
|
|
28191
|
+
this.formatted += ' ';
|
|
28192
|
+
}
|
|
28193
|
+
this.formatted += comps[k].toString().trim();
|
|
28194
|
+
}
|
|
28195
|
+
}
|
|
28196
|
+
}
|
|
28197
|
+
return this.formatted;
|
|
28198
|
+
}
|
|
28199
|
+
format() {
|
|
28200
|
+
return this.range;
|
|
28201
|
+
}
|
|
28202
|
+
toString() {
|
|
28203
|
+
return this.range;
|
|
28204
|
+
}
|
|
28205
|
+
parseRange(range) {
|
|
28206
|
+
// memoize range parsing for performance.
|
|
28207
|
+
// this is a very hot path, and fully deterministic.
|
|
28208
|
+
const memoOpts = (this.options.includePrerelease && FLAG_INCLUDE_PRERELEASE) | (this.options.loose && FLAG_LOOSE);
|
|
28209
|
+
const memoKey = memoOpts + ':' + range;
|
|
28210
|
+
const cached = cache.get(memoKey);
|
|
28211
|
+
if (cached) {
|
|
28212
|
+
return cached;
|
|
28213
|
+
}
|
|
28214
|
+
const loose = this.options.loose;
|
|
28215
|
+
// `1.2.3 - 1.2.4` => `>=1.2.3 <=1.2.4`
|
|
28216
|
+
const hr = loose ? re[t.HYPHENRANGELOOSE] : re[t.HYPHENRANGE];
|
|
28217
|
+
range = range.replace(hr, hyphenReplace(this.options.includePrerelease));
|
|
28218
|
+
debug('hyphen replace', range);
|
|
28219
|
+
|
|
28220
|
+
// `> 1.2.3 < 1.2.5` => `>1.2.3 <1.2.5`
|
|
28221
|
+
range = range.replace(re[t.COMPARATORTRIM], comparatorTrimReplace);
|
|
28222
|
+
debug('comparator trim', range);
|
|
28223
|
+
|
|
28224
|
+
// `~ 1.2.3` => `~1.2.3`
|
|
28225
|
+
range = range.replace(re[t.TILDETRIM], tildeTrimReplace);
|
|
28226
|
+
debug('tilde trim', range);
|
|
28227
|
+
|
|
28228
|
+
// `^ 1.2.3` => `^1.2.3`
|
|
28229
|
+
range = range.replace(re[t.CARETTRIM], caretTrimReplace);
|
|
28230
|
+
debug('caret trim', range);
|
|
28231
|
+
|
|
28232
|
+
// At this point, the range is completely trimmed and
|
|
28233
|
+
// ready to be split into comparators.
|
|
28234
|
+
|
|
28235
|
+
let rangeList = range.split(' ').map(comp => parseComparator(comp, this.options)).join(' ').split(/\s+/)
|
|
28236
|
+
// >=0.0.0 is equivalent to *
|
|
28237
|
+
.map(comp => replaceGTE0(comp, this.options));
|
|
28238
|
+
if (loose) {
|
|
28239
|
+
// in loose mode, throw out any that are not valid comparators
|
|
28240
|
+
rangeList = rangeList.filter(comp => {
|
|
28241
|
+
debug('loose invalid filter', comp, this.options);
|
|
28242
|
+
return !!comp.match(re[t.COMPARATORLOOSE]);
|
|
28243
|
+
});
|
|
28244
|
+
}
|
|
28245
|
+
debug('range list', rangeList);
|
|
27937
28246
|
|
|
27938
|
-
|
|
27939
|
-
|
|
27940
|
-
|
|
27941
|
-
|
|
27942
|
-
|
|
27943
|
-
|
|
27944
|
-
|
|
27945
|
-
|
|
27946
|
-
|
|
27947
|
-
|
|
27948
|
-
|
|
27949
|
-
|
|
27950
|
-
|
|
27951
|
-
|
|
27952
|
-
|
|
27953
|
-
|
|
27954
|
-
|
|
27955
|
-
|
|
27956
|
-
|
|
27957
|
-
|
|
27958
|
-
|
|
27959
|
-
|
|
27960
|
-
|
|
27961
|
-
|
|
27962
|
-
|
|
27963
|
-
|
|
27964
|
-
|
|
27965
|
-
|
|
27966
|
-
|
|
27967
|
-
|
|
27968
|
-
|
|
27969
|
-
|
|
27970
|
-
|
|
27971
|
-
|
|
27972
|
-
|
|
27973
|
-
|
|
27974
|
-
|
|
27975
|
-
|
|
27976
|
-
|
|
27977
|
-
|
|
27978
|
-
|
|
27979
|
-
|
|
27980
|
-
|
|
27981
|
-
|
|
27982
|
-
|
|
27983
|
-
|
|
27984
|
-
|
|
27985
|
-
|
|
27986
|
-
|
|
27987
|
-
|
|
27988
|
-
|
|
27989
|
-
|
|
27990
|
-
|
|
27991
|
-
|
|
27992
|
-
|
|
27993
|
-
|
|
27994
|
-
|
|
27995
|
-
|
|
27996
|
-
|
|
27997
|
-
|
|
27998
|
-
|
|
27999
|
-
|
|
28000
|
-
|
|
28001
|
-
|
|
28002
|
-
|
|
28003
|
-
|
|
28004
|
-
|
|
28005
|
-
|
|
28006
|
-
|
|
28007
|
-
|
|
28008
|
-
|
|
28009
|
-
|
|
28010
|
-
|
|
28011
|
-
|
|
28012
|
-
|
|
28013
|
-
|
|
28014
|
-
|
|
28015
|
-
|
|
28016
|
-
|
|
28017
|
-
|
|
28018
|
-
|
|
28019
|
-
|
|
28020
|
-
|
|
28021
|
-
|
|
28022
|
-
|
|
28023
|
-
|
|
28024
|
-
|
|
28025
|
-
|
|
28026
|
-
|
|
28027
|
-
|
|
28028
|
-
|
|
28029
|
-
|
|
28030
|
-
|
|
28031
|
-
|
|
28032
|
-
|
|
28033
|
-
|
|
28034
|
-
|
|
28035
|
-
|
|
28036
|
-
|
|
28037
|
-
|
|
28038
|
-
|
|
28039
|
-
|
|
28040
|
-
|
|
28041
|
-
|
|
28042
|
-
|
|
28043
|
-
|
|
28044
|
-
|
|
28045
|
-
|
|
28046
|
-
|
|
28047
|
-
|
|
28048
|
-
|
|
28049
|
-
|
|
28050
|
-
|
|
28051
|
-
|
|
28052
|
-
|
|
28053
|
-
|
|
28054
|
-
|
|
28055
|
-
|
|
28056
|
-
|
|
28057
|
-
|
|
28058
|
-
|
|
28059
|
-
|
|
28060
|
-
|
|
28061
|
-
|
|
28062
|
-
|
|
28063
|
-
|
|
28064
|
-
|
|
28065
|
-
|
|
28066
|
-
|
|
28067
|
-
|
|
28068
|
-
|
|
28069
|
-
|
|
28070
|
-
|
|
28071
|
-
|
|
28072
|
-
|
|
28073
|
-
|
|
28074
|
-
|
|
28075
|
-
|
|
28076
|
-
|
|
28077
|
-
|
|
28078
|
-
|
|
28079
|
-
|
|
28080
|
-
|
|
28081
|
-
|
|
28082
|
-
|
|
28083
|
-
|
|
28084
|
-
|
|
28085
|
-
|
|
28086
|
-
|
|
28087
|
-
|
|
28088
|
-
|
|
28089
|
-
|
|
28090
|
-
|
|
28091
|
-
|
|
28092
|
-
|
|
28093
|
-
|
|
28094
|
-
|
|
28095
|
-
|
|
28096
|
-
|
|
28097
|
-
|
|
28098
|
-
|
|
28099
|
-
|
|
28100
|
-
|
|
28101
|
-
|
|
28102
|
-
|
|
28103
|
-
|
|
28104
|
-
|
|
28105
|
-
|
|
28106
|
-
|
|
28107
|
-
|
|
28108
|
-
|
|
28109
|
-
|
|
28110
|
-
|
|
28111
|
-
|
|
28112
|
-
|
|
28113
|
-
|
|
28114
|
-
|
|
28115
|
-
|
|
28116
|
-
|
|
28117
|
-
|
|
28118
|
-
|
|
28119
|
-
|
|
28120
|
-
|
|
28121
|
-
|
|
28122
|
-
|
|
28123
|
-
|
|
28124
|
-
|
|
28125
|
-
|
|
28126
|
-
|
|
28127
|
-
|
|
28128
|
-
|
|
28129
|
-
|
|
28130
|
-
|
|
28131
|
-
|
|
28132
|
-
|
|
28133
|
-
|
|
28134
|
-
|
|
28135
|
-
|
|
28136
|
-
|
|
28137
|
-
|
|
28247
|
+
// if any comparators are the null set, then replace with JUST null set
|
|
28248
|
+
// if more than one comparator, remove any * comparators
|
|
28249
|
+
// also, don't include the same comparator more than once
|
|
28250
|
+
const rangeMap = new Map();
|
|
28251
|
+
const comparators = rangeList.map(comp => new Comparator(comp, this.options));
|
|
28252
|
+
for (const comp of comparators) {
|
|
28253
|
+
if (isNullSet(comp)) {
|
|
28254
|
+
return [comp];
|
|
28255
|
+
}
|
|
28256
|
+
rangeMap.set(comp.value, comp);
|
|
28257
|
+
}
|
|
28258
|
+
if (rangeMap.size > 1 && rangeMap.has('')) {
|
|
28259
|
+
rangeMap.delete('');
|
|
28260
|
+
}
|
|
28261
|
+
const result = [...rangeMap.values()];
|
|
28262
|
+
cache.set(memoKey, result);
|
|
28263
|
+
return result;
|
|
28264
|
+
}
|
|
28265
|
+
intersects(range, options) {
|
|
28266
|
+
if (!(range instanceof Range)) {
|
|
28267
|
+
throw new TypeError('a Range is required');
|
|
28268
|
+
}
|
|
28269
|
+
return this.set.some(thisComparators => {
|
|
28270
|
+
return isSatisfiable(thisComparators, options) && range.set.some(rangeComparators => {
|
|
28271
|
+
return isSatisfiable(rangeComparators, options) && thisComparators.every(thisComparator => {
|
|
28272
|
+
return rangeComparators.every(rangeComparator => {
|
|
28273
|
+
return thisComparator.intersects(rangeComparator, options);
|
|
28274
|
+
});
|
|
28275
|
+
});
|
|
28276
|
+
});
|
|
28277
|
+
});
|
|
28278
|
+
}
|
|
28279
|
+
|
|
28280
|
+
// if ANY of the sets match ALL of its comparators, then pass
|
|
28281
|
+
test(version) {
|
|
28282
|
+
if (!version) {
|
|
28283
|
+
return false;
|
|
28284
|
+
}
|
|
28285
|
+
if (typeof version === 'string') {
|
|
28286
|
+
try {
|
|
28287
|
+
version = new SemVer(version, this.options);
|
|
28288
|
+
} catch (er) {
|
|
28289
|
+
return false;
|
|
28290
|
+
}
|
|
28291
|
+
}
|
|
28292
|
+
for (let i = 0; i < this.set.length; i++) {
|
|
28293
|
+
if (testSet(this.set[i], version, this.options)) {
|
|
28294
|
+
return true;
|
|
28295
|
+
}
|
|
28296
|
+
}
|
|
28297
|
+
return false;
|
|
28298
|
+
}
|
|
28299
|
+
}
|
|
28300
|
+
range = Range;
|
|
28301
|
+
const LRU = lrucache;
|
|
28302
|
+
const cache = new LRU();
|
|
28303
|
+
const parseOptions = parseOptions_1;
|
|
28304
|
+
const Comparator = requireComparator();
|
|
28305
|
+
const debug = debug_1;
|
|
28306
|
+
const SemVer = semver;
|
|
28307
|
+
const {
|
|
28308
|
+
safeRe: re,
|
|
28309
|
+
t,
|
|
28310
|
+
comparatorTrimReplace,
|
|
28311
|
+
tildeTrimReplace,
|
|
28312
|
+
caretTrimReplace
|
|
28313
|
+
} = reExports;
|
|
28314
|
+
const {
|
|
28315
|
+
FLAG_INCLUDE_PRERELEASE,
|
|
28316
|
+
FLAG_LOOSE
|
|
28317
|
+
} = constants;
|
|
28318
|
+
const isNullSet = c => c.value === '<0.0.0-0';
|
|
28319
|
+
const isAny = c => c.value === '';
|
|
28320
|
+
|
|
28321
|
+
// take a set of comparators and determine whether there
|
|
28322
|
+
// exists a version which can satisfy it
|
|
28323
|
+
const isSatisfiable = (comparators, options) => {
|
|
28324
|
+
let result = true;
|
|
28325
|
+
const remainingComparators = comparators.slice();
|
|
28326
|
+
let testComparator = remainingComparators.pop();
|
|
28327
|
+
while (result && remainingComparators.length) {
|
|
28328
|
+
result = remainingComparators.every(otherComparator => {
|
|
28329
|
+
return testComparator.intersects(otherComparator, options);
|
|
28330
|
+
});
|
|
28331
|
+
testComparator = remainingComparators.pop();
|
|
28332
|
+
}
|
|
28333
|
+
return result;
|
|
28334
|
+
};
|
|
28335
|
+
|
|
28336
|
+
// comprised of xranges, tildes, stars, and gtlt's at this point.
|
|
28337
|
+
// already replaced the hyphen ranges
|
|
28338
|
+
// turn into a set of JUST comparators.
|
|
28339
|
+
const parseComparator = (comp, options) => {
|
|
28340
|
+
debug('comp', comp, options);
|
|
28341
|
+
comp = replaceCarets(comp, options);
|
|
28342
|
+
debug('caret', comp);
|
|
28343
|
+
comp = replaceTildes(comp, options);
|
|
28344
|
+
debug('tildes', comp);
|
|
28345
|
+
comp = replaceXRanges(comp, options);
|
|
28346
|
+
debug('xrange', comp);
|
|
28347
|
+
comp = replaceStars(comp, options);
|
|
28348
|
+
debug('stars', comp);
|
|
28349
|
+
return comp;
|
|
28350
|
+
};
|
|
28351
|
+
const isX = id => !id || id.toLowerCase() === 'x' || id === '*';
|
|
28352
|
+
|
|
28353
|
+
// ~, ~> --> * (any, kinda silly)
|
|
28354
|
+
// ~2, ~2.x, ~2.x.x, ~>2, ~>2.x ~>2.x.x --> >=2.0.0 <3.0.0-0
|
|
28355
|
+
// ~2.0, ~2.0.x, ~>2.0, ~>2.0.x --> >=2.0.0 <2.1.0-0
|
|
28356
|
+
// ~1.2, ~1.2.x, ~>1.2, ~>1.2.x --> >=1.2.0 <1.3.0-0
|
|
28357
|
+
// ~1.2.3, ~>1.2.3 --> >=1.2.3 <1.3.0-0
|
|
28358
|
+
// ~1.2.0, ~>1.2.0 --> >=1.2.0 <1.3.0-0
|
|
28359
|
+
// ~0.0.1 --> >=0.0.1 <0.1.0-0
|
|
28360
|
+
const replaceTildes = (comp, options) => {
|
|
28361
|
+
return comp.trim().split(/\s+/).map(c => replaceTilde(c, options)).join(' ');
|
|
28362
|
+
};
|
|
28363
|
+
const replaceTilde = (comp, options) => {
|
|
28364
|
+
const r = options.loose ? re[t.TILDELOOSE] : re[t.TILDE];
|
|
28365
|
+
return comp.replace(r, (_, M, m, p, pr) => {
|
|
28366
|
+
debug('tilde', comp, _, M, m, p, pr);
|
|
28367
|
+
let ret;
|
|
28368
|
+
if (isX(M)) {
|
|
28369
|
+
ret = '';
|
|
28370
|
+
} else if (isX(m)) {
|
|
28371
|
+
ret = ">=".concat(M, ".0.0 <").concat(+M + 1, ".0.0-0");
|
|
28372
|
+
} else if (isX(p)) {
|
|
28373
|
+
// ~1.2 == >=1.2.0 <1.3.0-0
|
|
28374
|
+
ret = ">=".concat(M, ".").concat(m, ".0 <").concat(M, ".").concat(+m + 1, ".0-0");
|
|
28375
|
+
} else if (pr) {
|
|
28376
|
+
debug('replaceTilde pr', pr);
|
|
28377
|
+
ret = ">=".concat(M, ".").concat(m, ".").concat(p, "-").concat(pr, " <").concat(M, ".").concat(+m + 1, ".0-0");
|
|
28378
|
+
} else {
|
|
28379
|
+
// ~1.2.3 == >=1.2.3 <1.3.0-0
|
|
28380
|
+
ret = ">=".concat(M, ".").concat(m, ".").concat(p, " <").concat(M, ".").concat(+m + 1, ".0-0");
|
|
28381
|
+
}
|
|
28382
|
+
debug('tilde return', ret);
|
|
28383
|
+
return ret;
|
|
28384
|
+
});
|
|
28385
|
+
};
|
|
28386
|
+
|
|
28387
|
+
// ^ --> * (any, kinda silly)
|
|
28388
|
+
// ^2, ^2.x, ^2.x.x --> >=2.0.0 <3.0.0-0
|
|
28389
|
+
// ^2.0, ^2.0.x --> >=2.0.0 <3.0.0-0
|
|
28390
|
+
// ^1.2, ^1.2.x --> >=1.2.0 <2.0.0-0
|
|
28391
|
+
// ^1.2.3 --> >=1.2.3 <2.0.0-0
|
|
28392
|
+
// ^1.2.0 --> >=1.2.0 <2.0.0-0
|
|
28393
|
+
// ^0.0.1 --> >=0.0.1 <0.0.2-0
|
|
28394
|
+
// ^0.1.0 --> >=0.1.0 <0.2.0-0
|
|
28395
|
+
const replaceCarets = (comp, options) => {
|
|
28396
|
+
return comp.trim().split(/\s+/).map(c => replaceCaret(c, options)).join(' ');
|
|
28397
|
+
};
|
|
28398
|
+
const replaceCaret = (comp, options) => {
|
|
28399
|
+
debug('caret', comp, options);
|
|
28400
|
+
const r = options.loose ? re[t.CARETLOOSE] : re[t.CARET];
|
|
28401
|
+
const z = options.includePrerelease ? '-0' : '';
|
|
28402
|
+
return comp.replace(r, (_, M, m, p, pr) => {
|
|
28403
|
+
debug('caret', comp, _, M, m, p, pr);
|
|
28404
|
+
let ret;
|
|
28405
|
+
if (isX(M)) {
|
|
28406
|
+
ret = '';
|
|
28407
|
+
} else if (isX(m)) {
|
|
28408
|
+
ret = ">=".concat(M, ".0.0").concat(z, " <").concat(+M + 1, ".0.0-0");
|
|
28409
|
+
} else if (isX(p)) {
|
|
28410
|
+
if (M === '0') {
|
|
28411
|
+
ret = ">=".concat(M, ".").concat(m, ".0").concat(z, " <").concat(M, ".").concat(+m + 1, ".0-0");
|
|
28412
|
+
} else {
|
|
28413
|
+
ret = ">=".concat(M, ".").concat(m, ".0").concat(z, " <").concat(+M + 1, ".0.0-0");
|
|
28414
|
+
}
|
|
28415
|
+
} else if (pr) {
|
|
28416
|
+
debug('replaceCaret pr', pr);
|
|
28417
|
+
if (M === '0') {
|
|
28418
|
+
if (m === '0') {
|
|
28419
|
+
ret = ">=".concat(M, ".").concat(m, ".").concat(p, "-").concat(pr, " <").concat(M, ".").concat(m, ".").concat(+p + 1, "-0");
|
|
28420
|
+
} else {
|
|
28421
|
+
ret = ">=".concat(M, ".").concat(m, ".").concat(p, "-").concat(pr, " <").concat(M, ".").concat(+m + 1, ".0-0");
|
|
28422
|
+
}
|
|
28423
|
+
} else {
|
|
28424
|
+
ret = ">=".concat(M, ".").concat(m, ".").concat(p, "-").concat(pr, " <").concat(+M + 1, ".0.0-0");
|
|
28425
|
+
}
|
|
28426
|
+
} else {
|
|
28427
|
+
debug('no pr');
|
|
28428
|
+
if (M === '0') {
|
|
28429
|
+
if (m === '0') {
|
|
28430
|
+
ret = ">=".concat(M, ".").concat(m, ".").concat(p).concat(z, " <").concat(M, ".").concat(m, ".").concat(+p + 1, "-0");
|
|
28431
|
+
} else {
|
|
28432
|
+
ret = ">=".concat(M, ".").concat(m, ".").concat(p).concat(z, " <").concat(M, ".").concat(+m + 1, ".0-0");
|
|
28433
|
+
}
|
|
28434
|
+
} else {
|
|
28435
|
+
ret = ">=".concat(M, ".").concat(m, ".").concat(p, " <").concat(+M + 1, ".0.0-0");
|
|
28436
|
+
}
|
|
28437
|
+
}
|
|
28438
|
+
debug('caret return', ret);
|
|
28439
|
+
return ret;
|
|
28440
|
+
});
|
|
28441
|
+
};
|
|
28442
|
+
const replaceXRanges = (comp, options) => {
|
|
28443
|
+
debug('replaceXRanges', comp, options);
|
|
28444
|
+
return comp.split(/\s+/).map(c => replaceXRange(c, options)).join(' ');
|
|
28445
|
+
};
|
|
28446
|
+
const replaceXRange = (comp, options) => {
|
|
28447
|
+
comp = comp.trim();
|
|
28448
|
+
const r = options.loose ? re[t.XRANGELOOSE] : re[t.XRANGE];
|
|
28449
|
+
return comp.replace(r, (ret, gtlt, M, m, p, pr) => {
|
|
28450
|
+
debug('xRange', comp, ret, gtlt, M, m, p, pr);
|
|
28451
|
+
const xM = isX(M);
|
|
28452
|
+
const xm = xM || isX(m);
|
|
28453
|
+
const xp = xm || isX(p);
|
|
28454
|
+
const anyX = xp;
|
|
28455
|
+
if (gtlt === '=' && anyX) {
|
|
28456
|
+
gtlt = '';
|
|
28457
|
+
}
|
|
28458
|
+
|
|
28459
|
+
// if we're including prereleases in the match, then we need
|
|
28460
|
+
// to fix this to -0, the lowest possible prerelease value
|
|
28461
|
+
pr = options.includePrerelease ? '-0' : '';
|
|
28462
|
+
if (xM) {
|
|
28463
|
+
if (gtlt === '>' || gtlt === '<') {
|
|
28464
|
+
// nothing is allowed
|
|
28465
|
+
ret = '<0.0.0-0';
|
|
28466
|
+
} else {
|
|
28467
|
+
// nothing is forbidden
|
|
28468
|
+
ret = '*';
|
|
28469
|
+
}
|
|
28470
|
+
} else if (gtlt && anyX) {
|
|
28471
|
+
// we know patch is an x, because we have any x at all.
|
|
28472
|
+
// replace X with 0
|
|
28473
|
+
if (xm) {
|
|
28474
|
+
m = 0;
|
|
28475
|
+
}
|
|
28476
|
+
p = 0;
|
|
28477
|
+
if (gtlt === '>') {
|
|
28478
|
+
// >1 => >=2.0.0
|
|
28479
|
+
// >1.2 => >=1.3.0
|
|
28480
|
+
gtlt = '>=';
|
|
28481
|
+
if (xm) {
|
|
28482
|
+
M = +M + 1;
|
|
28483
|
+
m = 0;
|
|
28484
|
+
p = 0;
|
|
28485
|
+
} else {
|
|
28486
|
+
m = +m + 1;
|
|
28487
|
+
p = 0;
|
|
28488
|
+
}
|
|
28489
|
+
} else if (gtlt === '<=') {
|
|
28490
|
+
// <=0.7.x is actually <0.8.0, since any 0.7.x should
|
|
28491
|
+
// pass. Similarly, <=7.x is actually <8.0.0, etc.
|
|
28492
|
+
gtlt = '<';
|
|
28493
|
+
if (xm) {
|
|
28494
|
+
M = +M + 1;
|
|
28495
|
+
} else {
|
|
28496
|
+
m = +m + 1;
|
|
28497
|
+
}
|
|
28498
|
+
}
|
|
28499
|
+
if (gtlt === '<') {
|
|
28500
|
+
pr = '-0';
|
|
28501
|
+
}
|
|
28502
|
+
ret = "".concat(gtlt + M, ".").concat(m, ".").concat(p).concat(pr);
|
|
28503
|
+
} else if (xm) {
|
|
28504
|
+
ret = ">=".concat(M, ".0.0").concat(pr, " <").concat(+M + 1, ".0.0-0");
|
|
28505
|
+
} else if (xp) {
|
|
28506
|
+
ret = ">=".concat(M, ".").concat(m, ".0").concat(pr, " <").concat(M, ".").concat(+m + 1, ".0-0");
|
|
28507
|
+
}
|
|
28508
|
+
debug('xRange return', ret);
|
|
28509
|
+
return ret;
|
|
28510
|
+
});
|
|
28511
|
+
};
|
|
28512
|
+
|
|
28513
|
+
// Because * is AND-ed with everything else in the comparator,
|
|
28514
|
+
// and '' means "any version", just remove the *s entirely.
|
|
28515
|
+
const replaceStars = (comp, options) => {
|
|
28516
|
+
debug('replaceStars', comp, options);
|
|
28517
|
+
// Looseness is ignored here. star is always as loose as it gets!
|
|
28518
|
+
return comp.trim().replace(re[t.STAR], '');
|
|
28519
|
+
};
|
|
28520
|
+
const replaceGTE0 = (comp, options) => {
|
|
28521
|
+
debug('replaceGTE0', comp, options);
|
|
28522
|
+
return comp.trim().replace(re[options.includePrerelease ? t.GTE0PRE : t.GTE0], '');
|
|
28523
|
+
};
|
|
28138
28524
|
|
|
28139
|
-
|
|
28140
|
-
|
|
28141
|
-
|
|
28142
|
-
|
|
28143
|
-
|
|
28144
|
-
|
|
28145
|
-
|
|
28146
|
-
|
|
28147
|
-
|
|
28148
|
-
|
|
28149
|
-
|
|
28150
|
-
|
|
28151
|
-
|
|
28152
|
-
|
|
28153
|
-
|
|
28154
|
-
|
|
28155
|
-
|
|
28156
|
-
|
|
28157
|
-
|
|
28158
|
-
|
|
28159
|
-
|
|
28160
|
-
|
|
28161
|
-
|
|
28162
|
-
|
|
28163
|
-
|
|
28164
|
-
|
|
28165
|
-
|
|
28166
|
-
|
|
28167
|
-
|
|
28168
|
-
|
|
28169
|
-
|
|
28170
|
-
|
|
28171
|
-
|
|
28172
|
-
|
|
28173
|
-
|
|
28174
|
-
|
|
28175
|
-
|
|
28176
|
-
|
|
28177
|
-
|
|
28178
|
-
|
|
28179
|
-
|
|
28180
|
-
|
|
28181
|
-
|
|
28182
|
-
|
|
28183
|
-
|
|
28184
|
-
|
|
28185
|
-
|
|
28186
|
-
|
|
28187
|
-
|
|
28188
|
-
|
|
28189
|
-
|
|
28190
|
-
|
|
28191
|
-
|
|
28192
|
-
|
|
28193
|
-
|
|
28194
|
-
|
|
28195
|
-
|
|
28196
|
-
|
|
28197
|
-
|
|
28198
|
-
|
|
28199
|
-
|
|
28200
|
-
|
|
28201
|
-
|
|
28202
|
-
|
|
28203
|
-
const replaceTildes = (comp, options) => {
|
|
28204
|
-
return comp
|
|
28205
|
-
.trim()
|
|
28206
|
-
.split(/\s+/)
|
|
28207
|
-
.map((c) => replaceTilde(c, options))
|
|
28208
|
-
.join(' ')
|
|
28209
|
-
};
|
|
28210
|
-
|
|
28211
|
-
const replaceTilde = (comp, options) => {
|
|
28212
|
-
const r = options.loose ? re[t.TILDELOOSE] : re[t.TILDE];
|
|
28213
|
-
return comp.replace(r, (_, M, m, p, pr) => {
|
|
28214
|
-
debug('tilde', comp, _, M, m, p, pr);
|
|
28215
|
-
let ret;
|
|
28216
|
-
|
|
28217
|
-
if (isX(M)) {
|
|
28218
|
-
ret = '';
|
|
28219
|
-
} else if (isX(m)) {
|
|
28220
|
-
ret = `>=${M}.0.0 <${+M + 1}.0.0-0`;
|
|
28221
|
-
} else if (isX(p)) {
|
|
28222
|
-
// ~1.2 == >=1.2.0 <1.3.0-0
|
|
28223
|
-
ret = `>=${M}.${m}.0 <${M}.${+m + 1}.0-0`;
|
|
28224
|
-
} else if (pr) {
|
|
28225
|
-
debug('replaceTilde pr', pr);
|
|
28226
|
-
ret = `>=${M}.${m}.${p}-${pr
|
|
28227
|
-
} <${M}.${+m + 1}.0-0`;
|
|
28228
|
-
} else {
|
|
28229
|
-
// ~1.2.3 == >=1.2.3 <1.3.0-0
|
|
28230
|
-
ret = `>=${M}.${m}.${p
|
|
28231
|
-
} <${M}.${+m + 1}.0-0`;
|
|
28232
|
-
}
|
|
28233
|
-
|
|
28234
|
-
debug('tilde return', ret);
|
|
28235
|
-
return ret
|
|
28236
|
-
})
|
|
28237
|
-
};
|
|
28238
|
-
|
|
28239
|
-
// ^ --> * (any, kinda silly)
|
|
28240
|
-
// ^2, ^2.x, ^2.x.x --> >=2.0.0 <3.0.0-0
|
|
28241
|
-
// ^2.0, ^2.0.x --> >=2.0.0 <3.0.0-0
|
|
28242
|
-
// ^1.2, ^1.2.x --> >=1.2.0 <2.0.0-0
|
|
28243
|
-
// ^1.2.3 --> >=1.2.3 <2.0.0-0
|
|
28244
|
-
// ^1.2.0 --> >=1.2.0 <2.0.0-0
|
|
28245
|
-
// ^0.0.1 --> >=0.0.1 <0.0.2-0
|
|
28246
|
-
// ^0.1.0 --> >=0.1.0 <0.2.0-0
|
|
28247
|
-
const replaceCarets = (comp, options) => {
|
|
28248
|
-
return comp
|
|
28249
|
-
.trim()
|
|
28250
|
-
.split(/\s+/)
|
|
28251
|
-
.map((c) => replaceCaret(c, options))
|
|
28252
|
-
.join(' ')
|
|
28253
|
-
};
|
|
28254
|
-
|
|
28255
|
-
const replaceCaret = (comp, options) => {
|
|
28256
|
-
debug('caret', comp, options);
|
|
28257
|
-
const r = options.loose ? re[t.CARETLOOSE] : re[t.CARET];
|
|
28258
|
-
const z = options.includePrerelease ? '-0' : '';
|
|
28259
|
-
return comp.replace(r, (_, M, m, p, pr) => {
|
|
28260
|
-
debug('caret', comp, _, M, m, p, pr);
|
|
28261
|
-
let ret;
|
|
28262
|
-
|
|
28263
|
-
if (isX(M)) {
|
|
28264
|
-
ret = '';
|
|
28265
|
-
} else if (isX(m)) {
|
|
28266
|
-
ret = `>=${M}.0.0${z} <${+M + 1}.0.0-0`;
|
|
28267
|
-
} else if (isX(p)) {
|
|
28268
|
-
if (M === '0') {
|
|
28269
|
-
ret = `>=${M}.${m}.0${z} <${M}.${+m + 1}.0-0`;
|
|
28270
|
-
} else {
|
|
28271
|
-
ret = `>=${M}.${m}.0${z} <${+M + 1}.0.0-0`;
|
|
28272
|
-
}
|
|
28273
|
-
} else if (pr) {
|
|
28274
|
-
debug('replaceCaret pr', pr);
|
|
28275
|
-
if (M === '0') {
|
|
28276
|
-
if (m === '0') {
|
|
28277
|
-
ret = `>=${M}.${m}.${p}-${pr
|
|
28278
|
-
} <${M}.${m}.${+p + 1}-0`;
|
|
28279
|
-
} else {
|
|
28280
|
-
ret = `>=${M}.${m}.${p}-${pr
|
|
28281
|
-
} <${M}.${+m + 1}.0-0`;
|
|
28282
|
-
}
|
|
28283
|
-
} else {
|
|
28284
|
-
ret = `>=${M}.${m}.${p}-${pr
|
|
28285
|
-
} <${+M + 1}.0.0-0`;
|
|
28286
|
-
}
|
|
28287
|
-
} else {
|
|
28288
|
-
debug('no pr');
|
|
28289
|
-
if (M === '0') {
|
|
28290
|
-
if (m === '0') {
|
|
28291
|
-
ret = `>=${M}.${m}.${p
|
|
28292
|
-
}${z} <${M}.${m}.${+p + 1}-0`;
|
|
28293
|
-
} else {
|
|
28294
|
-
ret = `>=${M}.${m}.${p
|
|
28295
|
-
}${z} <${M}.${+m + 1}.0-0`;
|
|
28296
|
-
}
|
|
28297
|
-
} else {
|
|
28298
|
-
ret = `>=${M}.${m}.${p
|
|
28299
|
-
} <${+M + 1}.0.0-0`;
|
|
28300
|
-
}
|
|
28301
|
-
}
|
|
28302
|
-
|
|
28303
|
-
debug('caret return', ret);
|
|
28304
|
-
return ret
|
|
28305
|
-
})
|
|
28306
|
-
};
|
|
28307
|
-
|
|
28308
|
-
const replaceXRanges = (comp, options) => {
|
|
28309
|
-
debug('replaceXRanges', comp, options);
|
|
28310
|
-
return comp
|
|
28311
|
-
.split(/\s+/)
|
|
28312
|
-
.map((c) => replaceXRange(c, options))
|
|
28313
|
-
.join(' ')
|
|
28314
|
-
};
|
|
28315
|
-
|
|
28316
|
-
const replaceXRange = (comp, options) => {
|
|
28317
|
-
comp = comp.trim();
|
|
28318
|
-
const r = options.loose ? re[t.XRANGELOOSE] : re[t.XRANGE];
|
|
28319
|
-
return comp.replace(r, (ret, gtlt, M, m, p, pr) => {
|
|
28320
|
-
debug('xRange', comp, ret, gtlt, M, m, p, pr);
|
|
28321
|
-
const xM = isX(M);
|
|
28322
|
-
const xm = xM || isX(m);
|
|
28323
|
-
const xp = xm || isX(p);
|
|
28324
|
-
const anyX = xp;
|
|
28325
|
-
|
|
28326
|
-
if (gtlt === '=' && anyX) {
|
|
28327
|
-
gtlt = '';
|
|
28328
|
-
}
|
|
28329
|
-
|
|
28330
|
-
// if we're including prereleases in the match, then we need
|
|
28331
|
-
// to fix this to -0, the lowest possible prerelease value
|
|
28332
|
-
pr = options.includePrerelease ? '-0' : '';
|
|
28333
|
-
|
|
28334
|
-
if (xM) {
|
|
28335
|
-
if (gtlt === '>' || gtlt === '<') {
|
|
28336
|
-
// nothing is allowed
|
|
28337
|
-
ret = '<0.0.0-0';
|
|
28338
|
-
} else {
|
|
28339
|
-
// nothing is forbidden
|
|
28340
|
-
ret = '*';
|
|
28341
|
-
}
|
|
28342
|
-
} else if (gtlt && anyX) {
|
|
28343
|
-
// we know patch is an x, because we have any x at all.
|
|
28344
|
-
// replace X with 0
|
|
28345
|
-
if (xm) {
|
|
28346
|
-
m = 0;
|
|
28347
|
-
}
|
|
28348
|
-
p = 0;
|
|
28349
|
-
|
|
28350
|
-
if (gtlt === '>') {
|
|
28351
|
-
// >1 => >=2.0.0
|
|
28352
|
-
// >1.2 => >=1.3.0
|
|
28353
|
-
gtlt = '>=';
|
|
28354
|
-
if (xm) {
|
|
28355
|
-
M = +M + 1;
|
|
28356
|
-
m = 0;
|
|
28357
|
-
p = 0;
|
|
28358
|
-
} else {
|
|
28359
|
-
m = +m + 1;
|
|
28360
|
-
p = 0;
|
|
28361
|
-
}
|
|
28362
|
-
} else if (gtlt === '<=') {
|
|
28363
|
-
// <=0.7.x is actually <0.8.0, since any 0.7.x should
|
|
28364
|
-
// pass. Similarly, <=7.x is actually <8.0.0, etc.
|
|
28365
|
-
gtlt = '<';
|
|
28366
|
-
if (xm) {
|
|
28367
|
-
M = +M + 1;
|
|
28368
|
-
} else {
|
|
28369
|
-
m = +m + 1;
|
|
28370
|
-
}
|
|
28371
|
-
}
|
|
28372
|
-
|
|
28373
|
-
if (gtlt === '<') {
|
|
28374
|
-
pr = '-0';
|
|
28375
|
-
}
|
|
28376
|
-
|
|
28377
|
-
ret = `${gtlt + M}.${m}.${p}${pr}`;
|
|
28378
|
-
} else if (xm) {
|
|
28379
|
-
ret = `>=${M}.0.0${pr} <${+M + 1}.0.0-0`;
|
|
28380
|
-
} else if (xp) {
|
|
28381
|
-
ret = `>=${M}.${m}.0${pr
|
|
28382
|
-
} <${M}.${+m + 1}.0-0`;
|
|
28383
|
-
}
|
|
28384
|
-
|
|
28385
|
-
debug('xRange return', ret);
|
|
28386
|
-
|
|
28387
|
-
return ret
|
|
28388
|
-
})
|
|
28389
|
-
};
|
|
28390
|
-
|
|
28391
|
-
// Because * is AND-ed with everything else in the comparator,
|
|
28392
|
-
// and '' means "any version", just remove the *s entirely.
|
|
28393
|
-
const replaceStars = (comp, options) => {
|
|
28394
|
-
debug('replaceStars', comp, options);
|
|
28395
|
-
// Looseness is ignored here. star is always as loose as it gets!
|
|
28396
|
-
return comp
|
|
28397
|
-
.trim()
|
|
28398
|
-
.replace(re[t.STAR], '')
|
|
28399
|
-
};
|
|
28400
|
-
|
|
28401
|
-
const replaceGTE0 = (comp, options) => {
|
|
28402
|
-
debug('replaceGTE0', comp, options);
|
|
28403
|
-
return comp
|
|
28404
|
-
.trim()
|
|
28405
|
-
.replace(re[options.includePrerelease ? t.GTE0PRE : t.GTE0], '')
|
|
28406
|
-
};
|
|
28407
|
-
|
|
28408
|
-
// This function is passed to string.replace(re[t.HYPHENRANGE])
|
|
28409
|
-
// M, m, patch, prerelease, build
|
|
28410
|
-
// 1.2 - 3.4.5 => >=1.2.0 <=3.4.5
|
|
28411
|
-
// 1.2.3 - 3.4 => >=1.2.0 <3.5.0-0 Any 3.4.x will do
|
|
28412
|
-
// 1.2 - 3.4 => >=1.2.0 <3.5.0-0
|
|
28413
|
-
// TODO build?
|
|
28414
|
-
const hyphenReplace = incPr => ($0,
|
|
28415
|
-
from, fM, fm, fp, fpr, fb,
|
|
28416
|
-
to, tM, tm, tp, tpr) => {
|
|
28417
|
-
if (isX(fM)) {
|
|
28418
|
-
from = '';
|
|
28419
|
-
} else if (isX(fm)) {
|
|
28420
|
-
from = `>=${fM}.0.0${incPr ? '-0' : ''}`;
|
|
28421
|
-
} else if (isX(fp)) {
|
|
28422
|
-
from = `>=${fM}.${fm}.0${incPr ? '-0' : ''}`;
|
|
28423
|
-
} else if (fpr) {
|
|
28424
|
-
from = `>=${from}`;
|
|
28425
|
-
} else {
|
|
28426
|
-
from = `>=${from}${incPr ? '-0' : ''}`;
|
|
28427
|
-
}
|
|
28428
|
-
|
|
28429
|
-
if (isX(tM)) {
|
|
28430
|
-
to = '';
|
|
28431
|
-
} else if (isX(tm)) {
|
|
28432
|
-
to = `<${+tM + 1}.0.0-0`;
|
|
28433
|
-
} else if (isX(tp)) {
|
|
28434
|
-
to = `<${tM}.${+tm + 1}.0-0`;
|
|
28435
|
-
} else if (tpr) {
|
|
28436
|
-
to = `<=${tM}.${tm}.${tp}-${tpr}`;
|
|
28437
|
-
} else if (incPr) {
|
|
28438
|
-
to = `<${tM}.${tm}.${+tp + 1}-0`;
|
|
28439
|
-
} else {
|
|
28440
|
-
to = `<=${to}`;
|
|
28441
|
-
}
|
|
28442
|
-
|
|
28443
|
-
return `${from} ${to}`.trim()
|
|
28444
|
-
};
|
|
28445
|
-
|
|
28446
|
-
const testSet = (set, version, options) => {
|
|
28447
|
-
for (let i = 0; i < set.length; i++) {
|
|
28448
|
-
if (!set[i].test(version)) {
|
|
28449
|
-
return false
|
|
28450
|
-
}
|
|
28451
|
-
}
|
|
28452
|
-
|
|
28453
|
-
if (version.prerelease.length && !options.includePrerelease) {
|
|
28454
|
-
// Find the set of versions that are allowed to have prereleases
|
|
28455
|
-
// For example, ^1.2.3-pr.1 desugars to >=1.2.3-pr.1 <2.0.0
|
|
28456
|
-
// That should allow `1.2.3-pr.2` to pass.
|
|
28457
|
-
// However, `1.2.4-alpha.notready` should NOT be allowed,
|
|
28458
|
-
// even though it's within the range set by the comparators.
|
|
28459
|
-
for (let i = 0; i < set.length; i++) {
|
|
28460
|
-
debug(set[i].semver);
|
|
28461
|
-
if (set[i].semver === Comparator.ANY) {
|
|
28462
|
-
continue
|
|
28463
|
-
}
|
|
28464
|
-
|
|
28465
|
-
if (set[i].semver.prerelease.length > 0) {
|
|
28466
|
-
const allowed = set[i].semver;
|
|
28467
|
-
if (allowed.major === version.major &&
|
|
28468
|
-
allowed.minor === version.minor &&
|
|
28469
|
-
allowed.patch === version.patch) {
|
|
28470
|
-
return true
|
|
28471
|
-
}
|
|
28472
|
-
}
|
|
28473
|
-
}
|
|
28474
|
-
|
|
28475
|
-
// Version has a -pre, but it's not one of the ones we like.
|
|
28476
|
-
return false
|
|
28477
|
-
}
|
|
28478
|
-
|
|
28479
|
-
return true
|
|
28480
|
-
};
|
|
28481
|
-
return range;
|
|
28525
|
+
// This function is passed to string.replace(re[t.HYPHENRANGE])
|
|
28526
|
+
// M, m, patch, prerelease, build
|
|
28527
|
+
// 1.2 - 3.4.5 => >=1.2.0 <=3.4.5
|
|
28528
|
+
// 1.2.3 - 3.4 => >=1.2.0 <3.5.0-0 Any 3.4.x will do
|
|
28529
|
+
// 1.2 - 3.4 => >=1.2.0 <3.5.0-0
|
|
28530
|
+
// TODO build?
|
|
28531
|
+
const hyphenReplace = incPr => ($0, from, fM, fm, fp, fpr, fb, to, tM, tm, tp, tpr) => {
|
|
28532
|
+
if (isX(fM)) {
|
|
28533
|
+
from = '';
|
|
28534
|
+
} else if (isX(fm)) {
|
|
28535
|
+
from = ">=".concat(fM, ".0.0").concat(incPr ? '-0' : '');
|
|
28536
|
+
} else if (isX(fp)) {
|
|
28537
|
+
from = ">=".concat(fM, ".").concat(fm, ".0").concat(incPr ? '-0' : '');
|
|
28538
|
+
} else if (fpr) {
|
|
28539
|
+
from = ">=".concat(from);
|
|
28540
|
+
} else {
|
|
28541
|
+
from = ">=".concat(from).concat(incPr ? '-0' : '');
|
|
28542
|
+
}
|
|
28543
|
+
if (isX(tM)) {
|
|
28544
|
+
to = '';
|
|
28545
|
+
} else if (isX(tm)) {
|
|
28546
|
+
to = "<".concat(+tM + 1, ".0.0-0");
|
|
28547
|
+
} else if (isX(tp)) {
|
|
28548
|
+
to = "<".concat(tM, ".").concat(+tm + 1, ".0-0");
|
|
28549
|
+
} else if (tpr) {
|
|
28550
|
+
to = "<=".concat(tM, ".").concat(tm, ".").concat(tp, "-").concat(tpr);
|
|
28551
|
+
} else if (incPr) {
|
|
28552
|
+
to = "<".concat(tM, ".").concat(tm, ".").concat(+tp + 1, "-0");
|
|
28553
|
+
} else {
|
|
28554
|
+
to = "<=".concat(to);
|
|
28555
|
+
}
|
|
28556
|
+
return "".concat(from, " ").concat(to).trim();
|
|
28557
|
+
};
|
|
28558
|
+
const testSet = (set, version, options) => {
|
|
28559
|
+
for (let i = 0; i < set.length; i++) {
|
|
28560
|
+
if (!set[i].test(version)) {
|
|
28561
|
+
return false;
|
|
28562
|
+
}
|
|
28563
|
+
}
|
|
28564
|
+
if (version.prerelease.length && !options.includePrerelease) {
|
|
28565
|
+
// Find the set of versions that are allowed to have prereleases
|
|
28566
|
+
// For example, ^1.2.3-pr.1 desugars to >=1.2.3-pr.1 <2.0.0
|
|
28567
|
+
// That should allow `1.2.3-pr.2` to pass.
|
|
28568
|
+
// However, `1.2.4-alpha.notready` should NOT be allowed,
|
|
28569
|
+
// even though it's within the range set by the comparators.
|
|
28570
|
+
for (let i = 0; i < set.length; i++) {
|
|
28571
|
+
debug(set[i].semver);
|
|
28572
|
+
if (set[i].semver === Comparator.ANY) {
|
|
28573
|
+
continue;
|
|
28574
|
+
}
|
|
28575
|
+
if (set[i].semver.prerelease.length > 0) {
|
|
28576
|
+
const allowed = set[i].semver;
|
|
28577
|
+
if (allowed.major === version.major && allowed.minor === version.minor && allowed.patch === version.patch) {
|
|
28578
|
+
return true;
|
|
28579
|
+
}
|
|
28580
|
+
}
|
|
28581
|
+
}
|
|
28582
|
+
|
|
28583
|
+
// Version has a -pre, but it's not one of the ones we like.
|
|
28584
|
+
return false;
|
|
28585
|
+
}
|
|
28586
|
+
return true;
|
|
28587
|
+
};
|
|
28588
|
+
return range;
|
|
28482
28589
|
}
|
|
28483
28590
|
|
|
28484
28591
|
const Range = requireRange();
|
|
@@ -28486,12 +28593,11 @@ const satisfies = (version, range, options) => {
|
|
|
28486
28593
|
try {
|
|
28487
28594
|
range = new Range(range, options);
|
|
28488
28595
|
} catch (er) {
|
|
28489
|
-
return false
|
|
28596
|
+
return false;
|
|
28490
28597
|
}
|
|
28491
|
-
return range.test(version)
|
|
28598
|
+
return range.test(version);
|
|
28492
28599
|
};
|
|
28493
28600
|
var satisfies_1 = satisfies;
|
|
28494
|
-
|
|
28495
28601
|
var satisfies$1 = /*@__PURE__*/getDefaultExportFromCjs(satisfies_1);
|
|
28496
28602
|
|
|
28497
28603
|
const LOADED = {};
|
|
@@ -29665,5 +29771,5 @@ const __DO_NOT_USE__ = {
|
|
|
29665
29771
|
locale
|
|
29666
29772
|
};
|
|
29667
29773
|
|
|
29668
|
-
export { mocker as EnigmaMocker, __DO_NOT_USE__, conversion, index as embed, onContextMenu, onTakeSnapshot, useAction, useApp, useAppLayout, useConstraints, useDeviceType, useEffect, useElement, useEmbed, useEmitter, useGlobal, useImperativeHandle, useInteractionState, useKeyboard, useLayout, useMemo, useModel, useOptions, usePlugins, usePromise, useRect, useRenderState, useSelections, useStaleLayout, useState, useTheme, useTranslator };
|
|
29774
|
+
export { mocker as EnigmaMocker, __DO_NOT_USE__, conversion, index as embed, onContextMenu, onTakeSnapshot, useAction, useApp, useAppLayout, useConstraints, useDeviceType, useEffect, useElement, useEmbed, useEmitter, useGlobal, useImperativeHandle, useInteractionState, useKeyboard, useLayout, useMemo, useModel, useNavigation, useOptions, usePlugins, usePromise, useRect, useRenderState, useSelections, useStaleLayout, useState, useTheme, useTranslator };
|
|
29669
29775
|
//# sourceMappingURL=dev.js.map
|