@jobber/components 6.120.2 → 6.120.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Gallery-cjs.js +2 -8
- package/dist/Gallery-es.js +3 -9
- package/dist/Thumbnail-cjs.js +10 -8
- package/dist/Thumbnail-es.js +10 -8
- package/dist/styles.css +7 -7
- package/dist/unstyledPrimitives/index.cjs +431 -3
- package/dist/unstyledPrimitives/index.mjs +429 -1
- package/dist/utils/isPreviewableImage.d.ts +3 -0
- package/package.json +2 -2
package/dist/Gallery-cjs.js
CHANGED
|
@@ -39,7 +39,7 @@ function Gallery({ files, size = "base", max, onDelete }) {
|
|
|
39
39
|
function handleThumbnailClicked(index) {
|
|
40
40
|
return tslib_es6.__awaiter(this, void 0, void 0, function* () {
|
|
41
41
|
if (files[index].type.startsWith("image/") &&
|
|
42
|
-
|
|
42
|
+
Thumbnail.isPreviewableImage(files[index])) {
|
|
43
43
|
handleLightboxOpen(index);
|
|
44
44
|
}
|
|
45
45
|
else {
|
|
@@ -63,19 +63,13 @@ function getFileSrc(file) {
|
|
|
63
63
|
return typeof file.src === "string" ? file.src : file.src();
|
|
64
64
|
});
|
|
65
65
|
}
|
|
66
|
-
function isSupportedImageType(file) {
|
|
67
|
-
const userAgent = typeof document === "undefined" ? "" : window.navigator.userAgent;
|
|
68
|
-
const nonHeicImage = !file.type.startsWith("image/heic");
|
|
69
|
-
const nonSVGImage = !file.type.startsWith("image/svg");
|
|
70
|
-
return (nonHeicImage || Thumbnail.isSafari(userAgent)) && nonSVGImage;
|
|
71
|
-
}
|
|
72
66
|
function generateImagesArray(files) {
|
|
73
67
|
return tslib_es6.__awaiter(this, void 0, void 0, function* () {
|
|
74
68
|
const images = [];
|
|
75
69
|
const filesToImageIndex = [];
|
|
76
70
|
let imageIndex = 0;
|
|
77
71
|
for (let i = 0; i < files.length; i++) {
|
|
78
|
-
if (files[i].type.startsWith("image/") &&
|
|
72
|
+
if (files[i].type.startsWith("image/") && Thumbnail.isPreviewableImage(files[i])) {
|
|
79
73
|
images.push({ title: files[i].name, url: yield getFileSrc(files[i]) });
|
|
80
74
|
filesToImageIndex.push(imageIndex);
|
|
81
75
|
imageIndex++;
|
package/dist/Gallery-es.js
CHANGED
|
@@ -5,7 +5,7 @@ import { L as LightBox } from './LightBox-es.js';
|
|
|
5
5
|
import { F as FormatFile } from './FormatFile-es.js';
|
|
6
6
|
import 'filesize';
|
|
7
7
|
import { B as Button } from './Button-es.js';
|
|
8
|
-
import { i as
|
|
8
|
+
import { i as isPreviewableImage } from './Thumbnail-es.js';
|
|
9
9
|
|
|
10
10
|
var styles = {"gallery":"_6UhvrmKZdns-","galleryLarge":"f0hnJ8v-iHE-","showMoreButton":"EvHA4-Q7O9g-","showMoreButtonOverride":"CP3mpiod-4Q-","baseShowMoreButton":"VWW-3mSlumg-","largeShowMoreButton":"DNhegGxB75M-","spinning":"aqCoXiyvGKw-"};
|
|
11
11
|
|
|
@@ -37,7 +37,7 @@ function Gallery({ files, size = "base", max, onDelete }) {
|
|
|
37
37
|
function handleThumbnailClicked(index) {
|
|
38
38
|
return __awaiter(this, void 0, void 0, function* () {
|
|
39
39
|
if (files[index].type.startsWith("image/") &&
|
|
40
|
-
|
|
40
|
+
isPreviewableImage(files[index])) {
|
|
41
41
|
handleLightboxOpen(index);
|
|
42
42
|
}
|
|
43
43
|
else {
|
|
@@ -61,19 +61,13 @@ function getFileSrc(file) {
|
|
|
61
61
|
return typeof file.src === "string" ? file.src : file.src();
|
|
62
62
|
});
|
|
63
63
|
}
|
|
64
|
-
function isSupportedImageType(file) {
|
|
65
|
-
const userAgent = typeof document === "undefined" ? "" : window.navigator.userAgent;
|
|
66
|
-
const nonHeicImage = !file.type.startsWith("image/heic");
|
|
67
|
-
const nonSVGImage = !file.type.startsWith("image/svg");
|
|
68
|
-
return (nonHeicImage || isSafari(userAgent)) && nonSVGImage;
|
|
69
|
-
}
|
|
70
64
|
function generateImagesArray(files) {
|
|
71
65
|
return __awaiter(this, void 0, void 0, function* () {
|
|
72
66
|
const images = [];
|
|
73
67
|
const filesToImageIndex = [];
|
|
74
68
|
let imageIndex = 0;
|
|
75
69
|
for (let i = 0; i < files.length; i++) {
|
|
76
|
-
if (files[i].type.startsWith("image/") &&
|
|
70
|
+
if (files[i].type.startsWith("image/") && isPreviewableImage(files[i])) {
|
|
77
71
|
images.push({ title: files[i].name, url: yield getFileSrc(files[i]) });
|
|
78
72
|
filesToImageIndex.push(imageIndex);
|
|
79
73
|
imageIndex++;
|
package/dist/Thumbnail-cjs.js
CHANGED
|
@@ -64,11 +64,19 @@ function isSafari(userAgent) {
|
|
|
64
64
|
return getClientBrowser(userAgent) === "Apple Safari";
|
|
65
65
|
}
|
|
66
66
|
|
|
67
|
+
function isPreviewableImage(file) {
|
|
68
|
+
const userAgent = typeof document === "undefined" ? "" : window.navigator.userAgent;
|
|
69
|
+
const nonHeicImage = !file.type.startsWith("image/heic");
|
|
70
|
+
const nonSVGImage = !file.type.startsWith("image/svg");
|
|
71
|
+
const nonVendorImage = !/^image\/(vnd[.-]|x-)/i.test(file.type);
|
|
72
|
+
return (nonHeicImage || isSafari(userAgent)) && nonSVGImage && nonVendorImage;
|
|
73
|
+
}
|
|
74
|
+
|
|
67
75
|
function Thumbnail({ compact = false, size, file, UNSAFE_className, UNSAFE_style, }) {
|
|
68
76
|
const { name, type } = file;
|
|
69
77
|
const iconName = getIconNameFromType(type);
|
|
70
78
|
const hasName = Boolean(name) && compact;
|
|
71
|
-
if (type.startsWith("image/") &&
|
|
79
|
+
if (type.startsWith("image/") && isPreviewableImage(file)) {
|
|
72
80
|
return (React.createElement(InternalThumbnailImage, { file: file, UNSAFE_className: UNSAFE_className, UNSAFE_style: UNSAFE_style }));
|
|
73
81
|
}
|
|
74
82
|
return (React.createElement("div", { className: classnames(styles$1.content, styles$1[size], {
|
|
@@ -92,12 +100,6 @@ function getIconNameFromType(mimeType) {
|
|
|
92
100
|
return "file";
|
|
93
101
|
}
|
|
94
102
|
}
|
|
95
|
-
function isSupportedImageType(file) {
|
|
96
|
-
const userAgent = typeof document === "undefined" ? "" : window.navigator.userAgent;
|
|
97
|
-
const nonHeicImage = !file.type.startsWith("image/heic");
|
|
98
|
-
const nonSVGImage = !file.type.startsWith("image/svg");
|
|
99
|
-
return (nonHeicImage || isSafari(userAgent)) && nonSVGImage;
|
|
100
|
-
}
|
|
101
103
|
|
|
102
104
|
exports.Thumbnail = Thumbnail;
|
|
103
|
-
exports.
|
|
105
|
+
exports.isPreviewableImage = isPreviewableImage;
|
package/dist/Thumbnail-es.js
CHANGED
|
@@ -62,11 +62,19 @@ function isSafari(userAgent) {
|
|
|
62
62
|
return getClientBrowser(userAgent) === "Apple Safari";
|
|
63
63
|
}
|
|
64
64
|
|
|
65
|
+
function isPreviewableImage(file) {
|
|
66
|
+
const userAgent = typeof document === "undefined" ? "" : window.navigator.userAgent;
|
|
67
|
+
const nonHeicImage = !file.type.startsWith("image/heic");
|
|
68
|
+
const nonSVGImage = !file.type.startsWith("image/svg");
|
|
69
|
+
const nonVendorImage = !/^image\/(vnd[.-]|x-)/i.test(file.type);
|
|
70
|
+
return (nonHeicImage || isSafari(userAgent)) && nonSVGImage && nonVendorImage;
|
|
71
|
+
}
|
|
72
|
+
|
|
65
73
|
function Thumbnail({ compact = false, size, file, UNSAFE_className, UNSAFE_style, }) {
|
|
66
74
|
const { name, type } = file;
|
|
67
75
|
const iconName = getIconNameFromType(type);
|
|
68
76
|
const hasName = Boolean(name) && compact;
|
|
69
|
-
if (type.startsWith("image/") &&
|
|
77
|
+
if (type.startsWith("image/") && isPreviewableImage(file)) {
|
|
70
78
|
return (React__default.createElement(InternalThumbnailImage, { file: file, UNSAFE_className: UNSAFE_className, UNSAFE_style: UNSAFE_style }));
|
|
71
79
|
}
|
|
72
80
|
return (React__default.createElement("div", { className: classnames(styles$1.content, styles$1[size], {
|
|
@@ -90,11 +98,5 @@ function getIconNameFromType(mimeType) {
|
|
|
90
98
|
return "file";
|
|
91
99
|
}
|
|
92
100
|
}
|
|
93
|
-
function isSupportedImageType(file) {
|
|
94
|
-
const userAgent = typeof document === "undefined" ? "" : window.navigator.userAgent;
|
|
95
|
-
const nonHeicImage = !file.type.startsWith("image/heic");
|
|
96
|
-
const nonSVGImage = !file.type.startsWith("image/svg");
|
|
97
|
-
return (nonHeicImage || isSafari(userAgent)) && nonSVGImage;
|
|
98
|
-
}
|
|
99
101
|
|
|
100
|
-
export { Thumbnail as T,
|
|
102
|
+
export { Thumbnail as T, isPreviewableImage as i };
|
package/dist/styles.css
CHANGED
|
@@ -265,7 +265,7 @@
|
|
|
265
265
|
align-items: center;
|
|
266
266
|
padding: 2px 8px;
|
|
267
267
|
padding: var(--space-smallest) var(--space-small);
|
|
268
|
-
color: hsl(197,
|
|
268
|
+
color: hsl(197, 21%, 36%);
|
|
269
269
|
color: var(--color-text--secondary);
|
|
270
270
|
cursor: default;
|
|
271
271
|
transition: all 200ms;
|
|
@@ -456,7 +456,7 @@
|
|
|
456
456
|
}
|
|
457
457
|
|
|
458
458
|
._11dDD6Bevzg- {
|
|
459
|
-
color: hsl(197,
|
|
459
|
+
color: hsl(197, 21%, 36%);
|
|
460
460
|
color: var(--color-text--secondary);
|
|
461
461
|
}
|
|
462
462
|
|
|
@@ -1952,7 +1952,7 @@ a._7BLGtYNuJOU-.zgRx3ehZ2z8-:hover {
|
|
|
1952
1952
|
height: 32px;
|
|
1953
1953
|
height: var(--space-larger);
|
|
1954
1954
|
box-shadow: 0px 0px 4px 2px rgba(1, 41, 57, 0.4);
|
|
1955
|
-
border: solid hsl(
|
|
1955
|
+
border: solid hsl(197, 21%, 36%);
|
|
1956
1956
|
border: solid var(--color-inactive);
|
|
1957
1957
|
border-top-color: rgba(255, 255, 255, 1);
|
|
1958
1958
|
border-top-color: var(--color-white);
|
|
@@ -3787,7 +3787,7 @@ a._7BLGtYNuJOU-.zgRx3ehZ2z8-:hover {
|
|
|
3787
3787
|
height: var(--base-unit);
|
|
3788
3788
|
margin: 0 8px;
|
|
3789
3789
|
margin: 0 var(--space-small);
|
|
3790
|
-
background-color: hsl(197,
|
|
3790
|
+
background-color: hsl(197, 21%, 36%);
|
|
3791
3791
|
background-color: var(--color-text--secondary);
|
|
3792
3792
|
}
|
|
3793
3793
|
|
|
@@ -10746,7 +10746,7 @@ input.oOrjwubmsVA- {
|
|
|
10746
10746
|
border-radius: 8px;
|
|
10747
10747
|
border-radius: var(--radius-base);
|
|
10748
10748
|
overflow: hidden;
|
|
10749
|
-
color: hsl(197,
|
|
10749
|
+
color: hsl(197, 21%, 36%);
|
|
10750
10750
|
color: var(--color-text--secondary);
|
|
10751
10751
|
font-size: 14px;
|
|
10752
10752
|
font-size: var(--typography--fontSize-base);
|
|
@@ -11614,7 +11614,7 @@ ul.LfIIg9bwrhQ- {
|
|
|
11614
11614
|
border-radius: 8px 8px 0 0;
|
|
11615
11615
|
border-radius: var(--radius-base) var(--radius-base) 0 0;
|
|
11616
11616
|
outline: none;
|
|
11617
|
-
color: hsl(197,
|
|
11617
|
+
color: hsl(197, 21%, 36%);
|
|
11618
11618
|
color: var(--color-text--secondary);
|
|
11619
11619
|
background-color: rgba(255, 255, 255, 1);
|
|
11620
11620
|
background-color: var(--color-surface);
|
|
@@ -11741,7 +11741,7 @@ ul.LfIIg9bwrhQ- {
|
|
|
11741
11741
|
the reverse color scheme of Toast */
|
|
11742
11742
|
|
|
11743
11743
|
.ibhpdUt9YLo- * path {
|
|
11744
|
-
fill: hsl(197,
|
|
11744
|
+
fill: hsl(197, 21%, 36%) !important;
|
|
11745
11745
|
fill: var(--color-text--secondary) !important;
|
|
11746
11746
|
}
|
|
11747
11747
|
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
var React = require('react');
|
|
4
4
|
var jsxRuntime = require('react/jsx-runtime');
|
|
5
|
-
var reselect = require('reselect');
|
|
6
5
|
var ReactDOM = require('react-dom');
|
|
7
6
|
var floatingUi_reactDom = require('../floating-ui.react-dom-cjs.js');
|
|
8
7
|
var index = require('../index-cjs.js');
|
|
@@ -4127,10 +4126,439 @@ function useDismiss(context, props = {}) {
|
|
|
4127
4126
|
} : {}, [enabled, reference, floating]);
|
|
4128
4127
|
}
|
|
4129
4128
|
|
|
4129
|
+
// src/devModeChecks/identityFunctionCheck.ts
|
|
4130
|
+
var runIdentityFunctionCheck = (resultFunc, inputSelectorsResults, outputSelectorResult) => {
|
|
4131
|
+
if (inputSelectorsResults.length === 1 && inputSelectorsResults[0] === outputSelectorResult) {
|
|
4132
|
+
let isInputSameAsOutput = false;
|
|
4133
|
+
try {
|
|
4134
|
+
const emptyObject = {};
|
|
4135
|
+
if (resultFunc(emptyObject) === emptyObject)
|
|
4136
|
+
isInputSameAsOutput = true;
|
|
4137
|
+
} catch {
|
|
4138
|
+
}
|
|
4139
|
+
if (isInputSameAsOutput) {
|
|
4140
|
+
let stack = void 0;
|
|
4141
|
+
try {
|
|
4142
|
+
throw new Error();
|
|
4143
|
+
} catch (e) {
|
|
4144
|
+
({ stack } = e);
|
|
4145
|
+
}
|
|
4146
|
+
console.warn(
|
|
4147
|
+
"The result function returned its own inputs without modification. e.g\n`createSelector([state => state.todos], todos => todos)`\nThis could lead to inefficient memoization and unnecessary re-renders.\nEnsure transformation logic is in the result function, and extraction logic is in the input selectors.",
|
|
4148
|
+
{ stack }
|
|
4149
|
+
);
|
|
4150
|
+
}
|
|
4151
|
+
}
|
|
4152
|
+
};
|
|
4153
|
+
|
|
4154
|
+
// src/devModeChecks/inputStabilityCheck.ts
|
|
4155
|
+
var runInputStabilityCheck = (inputSelectorResultsObject, options, inputSelectorArgs) => {
|
|
4156
|
+
const { memoize, memoizeOptions } = options;
|
|
4157
|
+
const { inputSelectorResults, inputSelectorResultsCopy } = inputSelectorResultsObject;
|
|
4158
|
+
const createAnEmptyObject = memoize(() => ({}), ...memoizeOptions);
|
|
4159
|
+
const areInputSelectorResultsEqual = createAnEmptyObject.apply(null, inputSelectorResults) === createAnEmptyObject.apply(null, inputSelectorResultsCopy);
|
|
4160
|
+
if (!areInputSelectorResultsEqual) {
|
|
4161
|
+
let stack = void 0;
|
|
4162
|
+
try {
|
|
4163
|
+
throw new Error();
|
|
4164
|
+
} catch (e) {
|
|
4165
|
+
({ stack } = e);
|
|
4166
|
+
}
|
|
4167
|
+
console.warn(
|
|
4168
|
+
"An input selector returned a different result when passed same arguments.\nThis means your output selector will likely run more frequently than intended.\nAvoid returning a new reference inside your input selector, e.g.\n`createSelector([state => state.todos.map(todo => todo.id)], todoIds => todoIds.length)`",
|
|
4169
|
+
{
|
|
4170
|
+
arguments: inputSelectorArgs,
|
|
4171
|
+
firstInputs: inputSelectorResults,
|
|
4172
|
+
secondInputs: inputSelectorResultsCopy,
|
|
4173
|
+
stack
|
|
4174
|
+
}
|
|
4175
|
+
);
|
|
4176
|
+
}
|
|
4177
|
+
};
|
|
4178
|
+
|
|
4179
|
+
// src/devModeChecks/setGlobalDevModeChecks.ts
|
|
4180
|
+
var globalDevModeChecks = {
|
|
4181
|
+
inputStabilityCheck: "once",
|
|
4182
|
+
identityFunctionCheck: "once"
|
|
4183
|
+
};
|
|
4184
|
+
|
|
4185
|
+
// src/utils.ts
|
|
4186
|
+
var NOT_FOUND = /* @__PURE__ */ Symbol("NOT_FOUND");
|
|
4187
|
+
function assertIsFunction(func, errorMessage = `expected a function, instead received ${typeof func}`) {
|
|
4188
|
+
if (typeof func !== "function") {
|
|
4189
|
+
throw new TypeError(errorMessage);
|
|
4190
|
+
}
|
|
4191
|
+
}
|
|
4192
|
+
function assertIsObject(object, errorMessage = `expected an object, instead received ${typeof object}`) {
|
|
4193
|
+
if (typeof object !== "object") {
|
|
4194
|
+
throw new TypeError(errorMessage);
|
|
4195
|
+
}
|
|
4196
|
+
}
|
|
4197
|
+
function assertIsArrayOfFunctions(array, errorMessage = `expected all items to be functions, instead received the following types: `) {
|
|
4198
|
+
if (!array.every((item) => typeof item === "function")) {
|
|
4199
|
+
const itemTypes = array.map(
|
|
4200
|
+
(item) => typeof item === "function" ? `function ${item.name || "unnamed"}()` : typeof item
|
|
4201
|
+
).join(", ");
|
|
4202
|
+
throw new TypeError(`${errorMessage}[${itemTypes}]`);
|
|
4203
|
+
}
|
|
4204
|
+
}
|
|
4205
|
+
var ensureIsArray = (item) => {
|
|
4206
|
+
return Array.isArray(item) ? item : [item];
|
|
4207
|
+
};
|
|
4208
|
+
function getDependencies(createSelectorArgs) {
|
|
4209
|
+
const dependencies = Array.isArray(createSelectorArgs[0]) ? createSelectorArgs[0] : createSelectorArgs;
|
|
4210
|
+
assertIsArrayOfFunctions(
|
|
4211
|
+
dependencies,
|
|
4212
|
+
`createSelector expects all input-selectors to be functions, but received the following types: `
|
|
4213
|
+
);
|
|
4214
|
+
return dependencies;
|
|
4215
|
+
}
|
|
4216
|
+
function collectInputSelectorResults(dependencies, inputSelectorArgs) {
|
|
4217
|
+
const inputSelectorResults = [];
|
|
4218
|
+
const { length } = dependencies;
|
|
4219
|
+
for (let i = 0; i < length; i++) {
|
|
4220
|
+
inputSelectorResults.push(dependencies[i].apply(null, inputSelectorArgs));
|
|
4221
|
+
}
|
|
4222
|
+
return inputSelectorResults;
|
|
4223
|
+
}
|
|
4224
|
+
var getDevModeChecksExecutionInfo = (firstRun, devModeChecks) => {
|
|
4225
|
+
const { identityFunctionCheck, inputStabilityCheck } = {
|
|
4226
|
+
...globalDevModeChecks,
|
|
4227
|
+
...devModeChecks
|
|
4228
|
+
};
|
|
4229
|
+
return {
|
|
4230
|
+
identityFunctionCheck: {
|
|
4231
|
+
shouldRun: identityFunctionCheck === "always" || identityFunctionCheck === "once" && firstRun,
|
|
4232
|
+
run: runIdentityFunctionCheck
|
|
4233
|
+
},
|
|
4234
|
+
inputStabilityCheck: {
|
|
4235
|
+
shouldRun: inputStabilityCheck === "always" || inputStabilityCheck === "once" && firstRun,
|
|
4236
|
+
run: runInputStabilityCheck
|
|
4237
|
+
}
|
|
4238
|
+
};
|
|
4239
|
+
};
|
|
4240
|
+
|
|
4241
|
+
// src/lruMemoize.ts
|
|
4242
|
+
function createSingletonCache(equals) {
|
|
4243
|
+
let entry;
|
|
4244
|
+
return {
|
|
4245
|
+
get(key) {
|
|
4246
|
+
if (entry && equals(entry.key, key)) {
|
|
4247
|
+
return entry.value;
|
|
4248
|
+
}
|
|
4249
|
+
return NOT_FOUND;
|
|
4250
|
+
},
|
|
4251
|
+
put(key, value) {
|
|
4252
|
+
entry = { key, value };
|
|
4253
|
+
},
|
|
4254
|
+
getEntries() {
|
|
4255
|
+
return entry ? [entry] : [];
|
|
4256
|
+
},
|
|
4257
|
+
clear() {
|
|
4258
|
+
entry = void 0;
|
|
4259
|
+
}
|
|
4260
|
+
};
|
|
4261
|
+
}
|
|
4262
|
+
function createLruCache(maxSize, equals) {
|
|
4263
|
+
let entries = [];
|
|
4264
|
+
function get(key) {
|
|
4265
|
+
const cacheIndex = entries.findIndex((entry) => equals(key, entry.key));
|
|
4266
|
+
if (cacheIndex > -1) {
|
|
4267
|
+
const entry = entries[cacheIndex];
|
|
4268
|
+
if (cacheIndex > 0) {
|
|
4269
|
+
entries.splice(cacheIndex, 1);
|
|
4270
|
+
entries.unshift(entry);
|
|
4271
|
+
}
|
|
4272
|
+
return entry.value;
|
|
4273
|
+
}
|
|
4274
|
+
return NOT_FOUND;
|
|
4275
|
+
}
|
|
4276
|
+
function put(key, value) {
|
|
4277
|
+
if (get(key) === NOT_FOUND) {
|
|
4278
|
+
entries.unshift({ key, value });
|
|
4279
|
+
if (entries.length > maxSize) {
|
|
4280
|
+
entries.pop();
|
|
4281
|
+
}
|
|
4282
|
+
}
|
|
4283
|
+
}
|
|
4284
|
+
function getEntries() {
|
|
4285
|
+
return entries;
|
|
4286
|
+
}
|
|
4287
|
+
function clear() {
|
|
4288
|
+
entries = [];
|
|
4289
|
+
}
|
|
4290
|
+
return { get, put, getEntries, clear };
|
|
4291
|
+
}
|
|
4292
|
+
var referenceEqualityCheck = (a, b) => a === b;
|
|
4293
|
+
function createCacheKeyComparator(equalityCheck) {
|
|
4294
|
+
return function areArgumentsShallowlyEqual(prev, next) {
|
|
4295
|
+
if (prev === null || next === null || prev.length !== next.length) {
|
|
4296
|
+
return false;
|
|
4297
|
+
}
|
|
4298
|
+
const { length } = prev;
|
|
4299
|
+
for (let i = 0; i < length; i++) {
|
|
4300
|
+
if (!equalityCheck(prev[i], next[i])) {
|
|
4301
|
+
return false;
|
|
4302
|
+
}
|
|
4303
|
+
}
|
|
4304
|
+
return true;
|
|
4305
|
+
};
|
|
4306
|
+
}
|
|
4307
|
+
function lruMemoize(func, equalityCheckOrOptions) {
|
|
4308
|
+
const providedOptions = typeof equalityCheckOrOptions === "object" ? equalityCheckOrOptions : { equalityCheck: equalityCheckOrOptions };
|
|
4309
|
+
const {
|
|
4310
|
+
equalityCheck = referenceEqualityCheck,
|
|
4311
|
+
maxSize = 1,
|
|
4312
|
+
resultEqualityCheck
|
|
4313
|
+
} = providedOptions;
|
|
4314
|
+
const comparator = createCacheKeyComparator(equalityCheck);
|
|
4315
|
+
let resultsCount = 0;
|
|
4316
|
+
const cache = maxSize <= 1 ? createSingletonCache(comparator) : createLruCache(maxSize, comparator);
|
|
4317
|
+
function memoized() {
|
|
4318
|
+
let value = cache.get(arguments);
|
|
4319
|
+
if (value === NOT_FOUND) {
|
|
4320
|
+
value = func.apply(null, arguments);
|
|
4321
|
+
resultsCount++;
|
|
4322
|
+
if (resultEqualityCheck) {
|
|
4323
|
+
const entries = cache.getEntries();
|
|
4324
|
+
const matchingEntry = entries.find(
|
|
4325
|
+
(entry) => resultEqualityCheck(entry.value, value)
|
|
4326
|
+
);
|
|
4327
|
+
if (matchingEntry) {
|
|
4328
|
+
value = matchingEntry.value;
|
|
4329
|
+
resultsCount !== 0 && resultsCount--;
|
|
4330
|
+
}
|
|
4331
|
+
}
|
|
4332
|
+
cache.put(arguments, value);
|
|
4333
|
+
}
|
|
4334
|
+
return value;
|
|
4335
|
+
}
|
|
4336
|
+
memoized.clearCache = () => {
|
|
4337
|
+
cache.clear();
|
|
4338
|
+
memoized.resetResultsCount();
|
|
4339
|
+
};
|
|
4340
|
+
memoized.resultsCount = () => resultsCount;
|
|
4341
|
+
memoized.resetResultsCount = () => {
|
|
4342
|
+
resultsCount = 0;
|
|
4343
|
+
};
|
|
4344
|
+
return memoized;
|
|
4345
|
+
}
|
|
4346
|
+
|
|
4347
|
+
// src/weakMapMemoize.ts
|
|
4348
|
+
var StrongRef = class {
|
|
4349
|
+
constructor(value) {
|
|
4350
|
+
this.value = value;
|
|
4351
|
+
}
|
|
4352
|
+
deref() {
|
|
4353
|
+
return this.value;
|
|
4354
|
+
}
|
|
4355
|
+
};
|
|
4356
|
+
var Ref = typeof WeakRef !== "undefined" ? WeakRef : StrongRef;
|
|
4357
|
+
var UNTERMINATED = 0;
|
|
4358
|
+
var TERMINATED = 1;
|
|
4359
|
+
function createCacheNode() {
|
|
4360
|
+
return {
|
|
4361
|
+
s: UNTERMINATED,
|
|
4362
|
+
v: void 0,
|
|
4363
|
+
o: null,
|
|
4364
|
+
p: null
|
|
4365
|
+
};
|
|
4366
|
+
}
|
|
4367
|
+
function weakMapMemoize(func, options = {}) {
|
|
4368
|
+
let fnNode = createCacheNode();
|
|
4369
|
+
const { resultEqualityCheck } = options;
|
|
4370
|
+
let lastResult;
|
|
4371
|
+
let resultsCount = 0;
|
|
4372
|
+
function memoized() {
|
|
4373
|
+
let cacheNode = fnNode;
|
|
4374
|
+
const { length } = arguments;
|
|
4375
|
+
for (let i = 0, l = length; i < l; i++) {
|
|
4376
|
+
const arg = arguments[i];
|
|
4377
|
+
if (typeof arg === "function" || typeof arg === "object" && arg !== null) {
|
|
4378
|
+
let objectCache = cacheNode.o;
|
|
4379
|
+
if (objectCache === null) {
|
|
4380
|
+
cacheNode.o = objectCache = /* @__PURE__ */ new WeakMap();
|
|
4381
|
+
}
|
|
4382
|
+
const objectNode = objectCache.get(arg);
|
|
4383
|
+
if (objectNode === void 0) {
|
|
4384
|
+
cacheNode = createCacheNode();
|
|
4385
|
+
objectCache.set(arg, cacheNode);
|
|
4386
|
+
} else {
|
|
4387
|
+
cacheNode = objectNode;
|
|
4388
|
+
}
|
|
4389
|
+
} else {
|
|
4390
|
+
let primitiveCache = cacheNode.p;
|
|
4391
|
+
if (primitiveCache === null) {
|
|
4392
|
+
cacheNode.p = primitiveCache = /* @__PURE__ */ new Map();
|
|
4393
|
+
}
|
|
4394
|
+
const primitiveNode = primitiveCache.get(arg);
|
|
4395
|
+
if (primitiveNode === void 0) {
|
|
4396
|
+
cacheNode = createCacheNode();
|
|
4397
|
+
primitiveCache.set(arg, cacheNode);
|
|
4398
|
+
} else {
|
|
4399
|
+
cacheNode = primitiveNode;
|
|
4400
|
+
}
|
|
4401
|
+
}
|
|
4402
|
+
}
|
|
4403
|
+
const terminatedNode = cacheNode;
|
|
4404
|
+
let result;
|
|
4405
|
+
if (cacheNode.s === TERMINATED) {
|
|
4406
|
+
result = cacheNode.v;
|
|
4407
|
+
} else {
|
|
4408
|
+
result = func.apply(null, arguments);
|
|
4409
|
+
resultsCount++;
|
|
4410
|
+
if (resultEqualityCheck) {
|
|
4411
|
+
const lastResultValue = lastResult?.deref?.() ?? lastResult;
|
|
4412
|
+
if (lastResultValue != null && resultEqualityCheck(lastResultValue, result)) {
|
|
4413
|
+
result = lastResultValue;
|
|
4414
|
+
resultsCount !== 0 && resultsCount--;
|
|
4415
|
+
}
|
|
4416
|
+
const needsWeakRef = typeof result === "object" && result !== null || typeof result === "function";
|
|
4417
|
+
lastResult = needsWeakRef ? new Ref(result) : result;
|
|
4418
|
+
}
|
|
4419
|
+
}
|
|
4420
|
+
terminatedNode.s = TERMINATED;
|
|
4421
|
+
terminatedNode.v = result;
|
|
4422
|
+
return result;
|
|
4423
|
+
}
|
|
4424
|
+
memoized.clearCache = () => {
|
|
4425
|
+
fnNode = createCacheNode();
|
|
4426
|
+
memoized.resetResultsCount();
|
|
4427
|
+
};
|
|
4428
|
+
memoized.resultsCount = () => resultsCount;
|
|
4429
|
+
memoized.resetResultsCount = () => {
|
|
4430
|
+
resultsCount = 0;
|
|
4431
|
+
};
|
|
4432
|
+
return memoized;
|
|
4433
|
+
}
|
|
4434
|
+
|
|
4435
|
+
// src/createSelectorCreator.ts
|
|
4436
|
+
function createSelectorCreator(memoizeOrOptions, ...memoizeOptionsFromArgs) {
|
|
4437
|
+
const createSelectorCreatorOptions = typeof memoizeOrOptions === "function" ? {
|
|
4438
|
+
memoize: memoizeOrOptions,
|
|
4439
|
+
memoizeOptions: memoizeOptionsFromArgs
|
|
4440
|
+
} : memoizeOrOptions;
|
|
4441
|
+
const createSelector2 = (...createSelectorArgs) => {
|
|
4442
|
+
let recomputations = 0;
|
|
4443
|
+
let dependencyRecomputations = 0;
|
|
4444
|
+
let lastResult;
|
|
4445
|
+
let directlyPassedOptions = {};
|
|
4446
|
+
let resultFunc = createSelectorArgs.pop();
|
|
4447
|
+
if (typeof resultFunc === "object") {
|
|
4448
|
+
directlyPassedOptions = resultFunc;
|
|
4449
|
+
resultFunc = createSelectorArgs.pop();
|
|
4450
|
+
}
|
|
4451
|
+
assertIsFunction(
|
|
4452
|
+
resultFunc,
|
|
4453
|
+
`createSelector expects an output function after the inputs, but received: [${typeof resultFunc}]`
|
|
4454
|
+
);
|
|
4455
|
+
const combinedOptions = {
|
|
4456
|
+
...createSelectorCreatorOptions,
|
|
4457
|
+
...directlyPassedOptions
|
|
4458
|
+
};
|
|
4459
|
+
const {
|
|
4460
|
+
memoize,
|
|
4461
|
+
memoizeOptions = [],
|
|
4462
|
+
argsMemoize = weakMapMemoize,
|
|
4463
|
+
argsMemoizeOptions = [],
|
|
4464
|
+
devModeChecks = {}
|
|
4465
|
+
} = combinedOptions;
|
|
4466
|
+
const finalMemoizeOptions = ensureIsArray(memoizeOptions);
|
|
4467
|
+
const finalArgsMemoizeOptions = ensureIsArray(argsMemoizeOptions);
|
|
4468
|
+
const dependencies = getDependencies(createSelectorArgs);
|
|
4469
|
+
const memoizedResultFunc = memoize(function recomputationWrapper() {
|
|
4470
|
+
recomputations++;
|
|
4471
|
+
return resultFunc.apply(
|
|
4472
|
+
null,
|
|
4473
|
+
arguments
|
|
4474
|
+
);
|
|
4475
|
+
}, ...finalMemoizeOptions);
|
|
4476
|
+
let firstRun = true;
|
|
4477
|
+
const selector = argsMemoize(function dependenciesChecker() {
|
|
4478
|
+
dependencyRecomputations++;
|
|
4479
|
+
const inputSelectorResults = collectInputSelectorResults(
|
|
4480
|
+
dependencies,
|
|
4481
|
+
arguments
|
|
4482
|
+
);
|
|
4483
|
+
lastResult = memoizedResultFunc.apply(null, inputSelectorResults);
|
|
4484
|
+
if (process.env.NODE_ENV !== "production") {
|
|
4485
|
+
const { identityFunctionCheck, inputStabilityCheck } = getDevModeChecksExecutionInfo(firstRun, devModeChecks);
|
|
4486
|
+
if (identityFunctionCheck.shouldRun) {
|
|
4487
|
+
identityFunctionCheck.run(
|
|
4488
|
+
resultFunc,
|
|
4489
|
+
inputSelectorResults,
|
|
4490
|
+
lastResult
|
|
4491
|
+
);
|
|
4492
|
+
}
|
|
4493
|
+
if (inputStabilityCheck.shouldRun) {
|
|
4494
|
+
const inputSelectorResultsCopy = collectInputSelectorResults(
|
|
4495
|
+
dependencies,
|
|
4496
|
+
arguments
|
|
4497
|
+
);
|
|
4498
|
+
inputStabilityCheck.run(
|
|
4499
|
+
{ inputSelectorResults, inputSelectorResultsCopy },
|
|
4500
|
+
{ memoize, memoizeOptions: finalMemoizeOptions },
|
|
4501
|
+
arguments
|
|
4502
|
+
);
|
|
4503
|
+
}
|
|
4504
|
+
if (firstRun)
|
|
4505
|
+
firstRun = false;
|
|
4506
|
+
}
|
|
4507
|
+
return lastResult;
|
|
4508
|
+
}, ...finalArgsMemoizeOptions);
|
|
4509
|
+
return Object.assign(selector, {
|
|
4510
|
+
resultFunc,
|
|
4511
|
+
memoizedResultFunc,
|
|
4512
|
+
dependencies,
|
|
4513
|
+
dependencyRecomputations: () => dependencyRecomputations,
|
|
4514
|
+
resetDependencyRecomputations: () => {
|
|
4515
|
+
dependencyRecomputations = 0;
|
|
4516
|
+
},
|
|
4517
|
+
lastResult: () => lastResult,
|
|
4518
|
+
recomputations: () => recomputations,
|
|
4519
|
+
resetRecomputations: () => {
|
|
4520
|
+
recomputations = 0;
|
|
4521
|
+
},
|
|
4522
|
+
memoize,
|
|
4523
|
+
argsMemoize
|
|
4524
|
+
});
|
|
4525
|
+
};
|
|
4526
|
+
Object.assign(createSelector2, {
|
|
4527
|
+
withTypes: () => createSelector2
|
|
4528
|
+
});
|
|
4529
|
+
return createSelector2;
|
|
4530
|
+
}
|
|
4531
|
+
var createSelector$1 = /* @__PURE__ */ createSelectorCreator(weakMapMemoize);
|
|
4532
|
+
|
|
4533
|
+
// src/createStructuredSelector.ts
|
|
4534
|
+
var createStructuredSelector = Object.assign(
|
|
4535
|
+
(inputSelectorsObject, selectorCreator = createSelector$1) => {
|
|
4536
|
+
assertIsObject(
|
|
4537
|
+
inputSelectorsObject,
|
|
4538
|
+
`createStructuredSelector expects first argument to be an object where each property is a selector, instead received a ${typeof inputSelectorsObject}`
|
|
4539
|
+
);
|
|
4540
|
+
const inputSelectorKeys = Object.keys(inputSelectorsObject);
|
|
4541
|
+
const dependencies = inputSelectorKeys.map(
|
|
4542
|
+
(key) => inputSelectorsObject[key]
|
|
4543
|
+
);
|
|
4544
|
+
const structuredSelector = selectorCreator(
|
|
4545
|
+
dependencies,
|
|
4546
|
+
(...inputSelectorResults) => {
|
|
4547
|
+
return inputSelectorResults.reduce((composition, value, index) => {
|
|
4548
|
+
composition[inputSelectorKeys[index]] = value;
|
|
4549
|
+
return composition;
|
|
4550
|
+
}, {});
|
|
4551
|
+
}
|
|
4552
|
+
);
|
|
4553
|
+
return structuredSelector;
|
|
4554
|
+
},
|
|
4555
|
+
{ withTypes: () => createStructuredSelector }
|
|
4556
|
+
);
|
|
4557
|
+
|
|
4130
4558
|
/* eslint-disable no-underscore-dangle */ // __cacheKey__
|
|
4131
4559
|
|
|
4132
|
-
|
|
4133
|
-
memoize:
|
|
4560
|
+
createSelectorCreator({
|
|
4561
|
+
memoize: lruMemoize,
|
|
4134
4562
|
memoizeOptions: {
|
|
4135
4563
|
maxSize: 1,
|
|
4136
4564
|
equalityCheck: Object.is
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import React__default, { createElement } from 'react';
|
|
3
3
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
4
|
-
import { createSelectorCreator, lruMemoize } from 'reselect';
|
|
5
4
|
import * as ReactDOM from 'react-dom';
|
|
6
5
|
import { a as isHTMLElement, i as isShadowRoot, l as getComputedStyle, f as floor, t as tabbable, y as getWindow, z as isOverflowElement, d as getNodeName, c as isNode, e as isTabbable, h as focusable, m as isWebKit$1, b as isElement, j as isLastTraversableNode, k as getParentNode, u as useFloating$1, A as evaluate, B as getPaddingObject, C as getAlignmentAxis, D as getAlignment, E as getAxisLength, F as clamp, p as hide$1, n as flip, x as size, G as getSide, H as getSideAxis, q as autoUpdate, v as offset, s as shift, r as limitShift } from '../floating-ui.react-dom-es.js';
|
|
7
6
|
import { s as shimExports } from '../index-es.js';
|
|
@@ -4106,6 +4105,435 @@ function useDismiss(context, props = {}) {
|
|
|
4106
4105
|
} : {}, [enabled, reference, floating]);
|
|
4107
4106
|
}
|
|
4108
4107
|
|
|
4108
|
+
// src/devModeChecks/identityFunctionCheck.ts
|
|
4109
|
+
var runIdentityFunctionCheck = (resultFunc, inputSelectorsResults, outputSelectorResult) => {
|
|
4110
|
+
if (inputSelectorsResults.length === 1 && inputSelectorsResults[0] === outputSelectorResult) {
|
|
4111
|
+
let isInputSameAsOutput = false;
|
|
4112
|
+
try {
|
|
4113
|
+
const emptyObject = {};
|
|
4114
|
+
if (resultFunc(emptyObject) === emptyObject)
|
|
4115
|
+
isInputSameAsOutput = true;
|
|
4116
|
+
} catch {
|
|
4117
|
+
}
|
|
4118
|
+
if (isInputSameAsOutput) {
|
|
4119
|
+
let stack = void 0;
|
|
4120
|
+
try {
|
|
4121
|
+
throw new Error();
|
|
4122
|
+
} catch (e) {
|
|
4123
|
+
({ stack } = e);
|
|
4124
|
+
}
|
|
4125
|
+
console.warn(
|
|
4126
|
+
"The result function returned its own inputs without modification. e.g\n`createSelector([state => state.todos], todos => todos)`\nThis could lead to inefficient memoization and unnecessary re-renders.\nEnsure transformation logic is in the result function, and extraction logic is in the input selectors.",
|
|
4127
|
+
{ stack }
|
|
4128
|
+
);
|
|
4129
|
+
}
|
|
4130
|
+
}
|
|
4131
|
+
};
|
|
4132
|
+
|
|
4133
|
+
// src/devModeChecks/inputStabilityCheck.ts
|
|
4134
|
+
var runInputStabilityCheck = (inputSelectorResultsObject, options, inputSelectorArgs) => {
|
|
4135
|
+
const { memoize, memoizeOptions } = options;
|
|
4136
|
+
const { inputSelectorResults, inputSelectorResultsCopy } = inputSelectorResultsObject;
|
|
4137
|
+
const createAnEmptyObject = memoize(() => ({}), ...memoizeOptions);
|
|
4138
|
+
const areInputSelectorResultsEqual = createAnEmptyObject.apply(null, inputSelectorResults) === createAnEmptyObject.apply(null, inputSelectorResultsCopy);
|
|
4139
|
+
if (!areInputSelectorResultsEqual) {
|
|
4140
|
+
let stack = void 0;
|
|
4141
|
+
try {
|
|
4142
|
+
throw new Error();
|
|
4143
|
+
} catch (e) {
|
|
4144
|
+
({ stack } = e);
|
|
4145
|
+
}
|
|
4146
|
+
console.warn(
|
|
4147
|
+
"An input selector returned a different result when passed same arguments.\nThis means your output selector will likely run more frequently than intended.\nAvoid returning a new reference inside your input selector, e.g.\n`createSelector([state => state.todos.map(todo => todo.id)], todoIds => todoIds.length)`",
|
|
4148
|
+
{
|
|
4149
|
+
arguments: inputSelectorArgs,
|
|
4150
|
+
firstInputs: inputSelectorResults,
|
|
4151
|
+
secondInputs: inputSelectorResultsCopy,
|
|
4152
|
+
stack
|
|
4153
|
+
}
|
|
4154
|
+
);
|
|
4155
|
+
}
|
|
4156
|
+
};
|
|
4157
|
+
|
|
4158
|
+
// src/devModeChecks/setGlobalDevModeChecks.ts
|
|
4159
|
+
var globalDevModeChecks = {
|
|
4160
|
+
inputStabilityCheck: "once",
|
|
4161
|
+
identityFunctionCheck: "once"
|
|
4162
|
+
};
|
|
4163
|
+
|
|
4164
|
+
// src/utils.ts
|
|
4165
|
+
var NOT_FOUND = /* @__PURE__ */ Symbol("NOT_FOUND");
|
|
4166
|
+
function assertIsFunction(func, errorMessage = `expected a function, instead received ${typeof func}`) {
|
|
4167
|
+
if (typeof func !== "function") {
|
|
4168
|
+
throw new TypeError(errorMessage);
|
|
4169
|
+
}
|
|
4170
|
+
}
|
|
4171
|
+
function assertIsObject(object, errorMessage = `expected an object, instead received ${typeof object}`) {
|
|
4172
|
+
if (typeof object !== "object") {
|
|
4173
|
+
throw new TypeError(errorMessage);
|
|
4174
|
+
}
|
|
4175
|
+
}
|
|
4176
|
+
function assertIsArrayOfFunctions(array, errorMessage = `expected all items to be functions, instead received the following types: `) {
|
|
4177
|
+
if (!array.every((item) => typeof item === "function")) {
|
|
4178
|
+
const itemTypes = array.map(
|
|
4179
|
+
(item) => typeof item === "function" ? `function ${item.name || "unnamed"}()` : typeof item
|
|
4180
|
+
).join(", ");
|
|
4181
|
+
throw new TypeError(`${errorMessage}[${itemTypes}]`);
|
|
4182
|
+
}
|
|
4183
|
+
}
|
|
4184
|
+
var ensureIsArray = (item) => {
|
|
4185
|
+
return Array.isArray(item) ? item : [item];
|
|
4186
|
+
};
|
|
4187
|
+
function getDependencies(createSelectorArgs) {
|
|
4188
|
+
const dependencies = Array.isArray(createSelectorArgs[0]) ? createSelectorArgs[0] : createSelectorArgs;
|
|
4189
|
+
assertIsArrayOfFunctions(
|
|
4190
|
+
dependencies,
|
|
4191
|
+
`createSelector expects all input-selectors to be functions, but received the following types: `
|
|
4192
|
+
);
|
|
4193
|
+
return dependencies;
|
|
4194
|
+
}
|
|
4195
|
+
function collectInputSelectorResults(dependencies, inputSelectorArgs) {
|
|
4196
|
+
const inputSelectorResults = [];
|
|
4197
|
+
const { length } = dependencies;
|
|
4198
|
+
for (let i = 0; i < length; i++) {
|
|
4199
|
+
inputSelectorResults.push(dependencies[i].apply(null, inputSelectorArgs));
|
|
4200
|
+
}
|
|
4201
|
+
return inputSelectorResults;
|
|
4202
|
+
}
|
|
4203
|
+
var getDevModeChecksExecutionInfo = (firstRun, devModeChecks) => {
|
|
4204
|
+
const { identityFunctionCheck, inputStabilityCheck } = {
|
|
4205
|
+
...globalDevModeChecks,
|
|
4206
|
+
...devModeChecks
|
|
4207
|
+
};
|
|
4208
|
+
return {
|
|
4209
|
+
identityFunctionCheck: {
|
|
4210
|
+
shouldRun: identityFunctionCheck === "always" || identityFunctionCheck === "once" && firstRun,
|
|
4211
|
+
run: runIdentityFunctionCheck
|
|
4212
|
+
},
|
|
4213
|
+
inputStabilityCheck: {
|
|
4214
|
+
shouldRun: inputStabilityCheck === "always" || inputStabilityCheck === "once" && firstRun,
|
|
4215
|
+
run: runInputStabilityCheck
|
|
4216
|
+
}
|
|
4217
|
+
};
|
|
4218
|
+
};
|
|
4219
|
+
|
|
4220
|
+
// src/lruMemoize.ts
|
|
4221
|
+
function createSingletonCache(equals) {
|
|
4222
|
+
let entry;
|
|
4223
|
+
return {
|
|
4224
|
+
get(key) {
|
|
4225
|
+
if (entry && equals(entry.key, key)) {
|
|
4226
|
+
return entry.value;
|
|
4227
|
+
}
|
|
4228
|
+
return NOT_FOUND;
|
|
4229
|
+
},
|
|
4230
|
+
put(key, value) {
|
|
4231
|
+
entry = { key, value };
|
|
4232
|
+
},
|
|
4233
|
+
getEntries() {
|
|
4234
|
+
return entry ? [entry] : [];
|
|
4235
|
+
},
|
|
4236
|
+
clear() {
|
|
4237
|
+
entry = void 0;
|
|
4238
|
+
}
|
|
4239
|
+
};
|
|
4240
|
+
}
|
|
4241
|
+
function createLruCache(maxSize, equals) {
|
|
4242
|
+
let entries = [];
|
|
4243
|
+
function get(key) {
|
|
4244
|
+
const cacheIndex = entries.findIndex((entry) => equals(key, entry.key));
|
|
4245
|
+
if (cacheIndex > -1) {
|
|
4246
|
+
const entry = entries[cacheIndex];
|
|
4247
|
+
if (cacheIndex > 0) {
|
|
4248
|
+
entries.splice(cacheIndex, 1);
|
|
4249
|
+
entries.unshift(entry);
|
|
4250
|
+
}
|
|
4251
|
+
return entry.value;
|
|
4252
|
+
}
|
|
4253
|
+
return NOT_FOUND;
|
|
4254
|
+
}
|
|
4255
|
+
function put(key, value) {
|
|
4256
|
+
if (get(key) === NOT_FOUND) {
|
|
4257
|
+
entries.unshift({ key, value });
|
|
4258
|
+
if (entries.length > maxSize) {
|
|
4259
|
+
entries.pop();
|
|
4260
|
+
}
|
|
4261
|
+
}
|
|
4262
|
+
}
|
|
4263
|
+
function getEntries() {
|
|
4264
|
+
return entries;
|
|
4265
|
+
}
|
|
4266
|
+
function clear() {
|
|
4267
|
+
entries = [];
|
|
4268
|
+
}
|
|
4269
|
+
return { get, put, getEntries, clear };
|
|
4270
|
+
}
|
|
4271
|
+
var referenceEqualityCheck = (a, b) => a === b;
|
|
4272
|
+
function createCacheKeyComparator(equalityCheck) {
|
|
4273
|
+
return function areArgumentsShallowlyEqual(prev, next) {
|
|
4274
|
+
if (prev === null || next === null || prev.length !== next.length) {
|
|
4275
|
+
return false;
|
|
4276
|
+
}
|
|
4277
|
+
const { length } = prev;
|
|
4278
|
+
for (let i = 0; i < length; i++) {
|
|
4279
|
+
if (!equalityCheck(prev[i], next[i])) {
|
|
4280
|
+
return false;
|
|
4281
|
+
}
|
|
4282
|
+
}
|
|
4283
|
+
return true;
|
|
4284
|
+
};
|
|
4285
|
+
}
|
|
4286
|
+
function lruMemoize(func, equalityCheckOrOptions) {
|
|
4287
|
+
const providedOptions = typeof equalityCheckOrOptions === "object" ? equalityCheckOrOptions : { equalityCheck: equalityCheckOrOptions };
|
|
4288
|
+
const {
|
|
4289
|
+
equalityCheck = referenceEqualityCheck,
|
|
4290
|
+
maxSize = 1,
|
|
4291
|
+
resultEqualityCheck
|
|
4292
|
+
} = providedOptions;
|
|
4293
|
+
const comparator = createCacheKeyComparator(equalityCheck);
|
|
4294
|
+
let resultsCount = 0;
|
|
4295
|
+
const cache = maxSize <= 1 ? createSingletonCache(comparator) : createLruCache(maxSize, comparator);
|
|
4296
|
+
function memoized() {
|
|
4297
|
+
let value = cache.get(arguments);
|
|
4298
|
+
if (value === NOT_FOUND) {
|
|
4299
|
+
value = func.apply(null, arguments);
|
|
4300
|
+
resultsCount++;
|
|
4301
|
+
if (resultEqualityCheck) {
|
|
4302
|
+
const entries = cache.getEntries();
|
|
4303
|
+
const matchingEntry = entries.find(
|
|
4304
|
+
(entry) => resultEqualityCheck(entry.value, value)
|
|
4305
|
+
);
|
|
4306
|
+
if (matchingEntry) {
|
|
4307
|
+
value = matchingEntry.value;
|
|
4308
|
+
resultsCount !== 0 && resultsCount--;
|
|
4309
|
+
}
|
|
4310
|
+
}
|
|
4311
|
+
cache.put(arguments, value);
|
|
4312
|
+
}
|
|
4313
|
+
return value;
|
|
4314
|
+
}
|
|
4315
|
+
memoized.clearCache = () => {
|
|
4316
|
+
cache.clear();
|
|
4317
|
+
memoized.resetResultsCount();
|
|
4318
|
+
};
|
|
4319
|
+
memoized.resultsCount = () => resultsCount;
|
|
4320
|
+
memoized.resetResultsCount = () => {
|
|
4321
|
+
resultsCount = 0;
|
|
4322
|
+
};
|
|
4323
|
+
return memoized;
|
|
4324
|
+
}
|
|
4325
|
+
|
|
4326
|
+
// src/weakMapMemoize.ts
|
|
4327
|
+
var StrongRef = class {
|
|
4328
|
+
constructor(value) {
|
|
4329
|
+
this.value = value;
|
|
4330
|
+
}
|
|
4331
|
+
deref() {
|
|
4332
|
+
return this.value;
|
|
4333
|
+
}
|
|
4334
|
+
};
|
|
4335
|
+
var Ref = typeof WeakRef !== "undefined" ? WeakRef : StrongRef;
|
|
4336
|
+
var UNTERMINATED = 0;
|
|
4337
|
+
var TERMINATED = 1;
|
|
4338
|
+
function createCacheNode() {
|
|
4339
|
+
return {
|
|
4340
|
+
s: UNTERMINATED,
|
|
4341
|
+
v: void 0,
|
|
4342
|
+
o: null,
|
|
4343
|
+
p: null
|
|
4344
|
+
};
|
|
4345
|
+
}
|
|
4346
|
+
function weakMapMemoize(func, options = {}) {
|
|
4347
|
+
let fnNode = createCacheNode();
|
|
4348
|
+
const { resultEqualityCheck } = options;
|
|
4349
|
+
let lastResult;
|
|
4350
|
+
let resultsCount = 0;
|
|
4351
|
+
function memoized() {
|
|
4352
|
+
let cacheNode = fnNode;
|
|
4353
|
+
const { length } = arguments;
|
|
4354
|
+
for (let i = 0, l = length; i < l; i++) {
|
|
4355
|
+
const arg = arguments[i];
|
|
4356
|
+
if (typeof arg === "function" || typeof arg === "object" && arg !== null) {
|
|
4357
|
+
let objectCache = cacheNode.o;
|
|
4358
|
+
if (objectCache === null) {
|
|
4359
|
+
cacheNode.o = objectCache = /* @__PURE__ */ new WeakMap();
|
|
4360
|
+
}
|
|
4361
|
+
const objectNode = objectCache.get(arg);
|
|
4362
|
+
if (objectNode === void 0) {
|
|
4363
|
+
cacheNode = createCacheNode();
|
|
4364
|
+
objectCache.set(arg, cacheNode);
|
|
4365
|
+
} else {
|
|
4366
|
+
cacheNode = objectNode;
|
|
4367
|
+
}
|
|
4368
|
+
} else {
|
|
4369
|
+
let primitiveCache = cacheNode.p;
|
|
4370
|
+
if (primitiveCache === null) {
|
|
4371
|
+
cacheNode.p = primitiveCache = /* @__PURE__ */ new Map();
|
|
4372
|
+
}
|
|
4373
|
+
const primitiveNode = primitiveCache.get(arg);
|
|
4374
|
+
if (primitiveNode === void 0) {
|
|
4375
|
+
cacheNode = createCacheNode();
|
|
4376
|
+
primitiveCache.set(arg, cacheNode);
|
|
4377
|
+
} else {
|
|
4378
|
+
cacheNode = primitiveNode;
|
|
4379
|
+
}
|
|
4380
|
+
}
|
|
4381
|
+
}
|
|
4382
|
+
const terminatedNode = cacheNode;
|
|
4383
|
+
let result;
|
|
4384
|
+
if (cacheNode.s === TERMINATED) {
|
|
4385
|
+
result = cacheNode.v;
|
|
4386
|
+
} else {
|
|
4387
|
+
result = func.apply(null, arguments);
|
|
4388
|
+
resultsCount++;
|
|
4389
|
+
if (resultEqualityCheck) {
|
|
4390
|
+
const lastResultValue = lastResult?.deref?.() ?? lastResult;
|
|
4391
|
+
if (lastResultValue != null && resultEqualityCheck(lastResultValue, result)) {
|
|
4392
|
+
result = lastResultValue;
|
|
4393
|
+
resultsCount !== 0 && resultsCount--;
|
|
4394
|
+
}
|
|
4395
|
+
const needsWeakRef = typeof result === "object" && result !== null || typeof result === "function";
|
|
4396
|
+
lastResult = needsWeakRef ? new Ref(result) : result;
|
|
4397
|
+
}
|
|
4398
|
+
}
|
|
4399
|
+
terminatedNode.s = TERMINATED;
|
|
4400
|
+
terminatedNode.v = result;
|
|
4401
|
+
return result;
|
|
4402
|
+
}
|
|
4403
|
+
memoized.clearCache = () => {
|
|
4404
|
+
fnNode = createCacheNode();
|
|
4405
|
+
memoized.resetResultsCount();
|
|
4406
|
+
};
|
|
4407
|
+
memoized.resultsCount = () => resultsCount;
|
|
4408
|
+
memoized.resetResultsCount = () => {
|
|
4409
|
+
resultsCount = 0;
|
|
4410
|
+
};
|
|
4411
|
+
return memoized;
|
|
4412
|
+
}
|
|
4413
|
+
|
|
4414
|
+
// src/createSelectorCreator.ts
|
|
4415
|
+
function createSelectorCreator(memoizeOrOptions, ...memoizeOptionsFromArgs) {
|
|
4416
|
+
const createSelectorCreatorOptions = typeof memoizeOrOptions === "function" ? {
|
|
4417
|
+
memoize: memoizeOrOptions,
|
|
4418
|
+
memoizeOptions: memoizeOptionsFromArgs
|
|
4419
|
+
} : memoizeOrOptions;
|
|
4420
|
+
const createSelector2 = (...createSelectorArgs) => {
|
|
4421
|
+
let recomputations = 0;
|
|
4422
|
+
let dependencyRecomputations = 0;
|
|
4423
|
+
let lastResult;
|
|
4424
|
+
let directlyPassedOptions = {};
|
|
4425
|
+
let resultFunc = createSelectorArgs.pop();
|
|
4426
|
+
if (typeof resultFunc === "object") {
|
|
4427
|
+
directlyPassedOptions = resultFunc;
|
|
4428
|
+
resultFunc = createSelectorArgs.pop();
|
|
4429
|
+
}
|
|
4430
|
+
assertIsFunction(
|
|
4431
|
+
resultFunc,
|
|
4432
|
+
`createSelector expects an output function after the inputs, but received: [${typeof resultFunc}]`
|
|
4433
|
+
);
|
|
4434
|
+
const combinedOptions = {
|
|
4435
|
+
...createSelectorCreatorOptions,
|
|
4436
|
+
...directlyPassedOptions
|
|
4437
|
+
};
|
|
4438
|
+
const {
|
|
4439
|
+
memoize,
|
|
4440
|
+
memoizeOptions = [],
|
|
4441
|
+
argsMemoize = weakMapMemoize,
|
|
4442
|
+
argsMemoizeOptions = [],
|
|
4443
|
+
devModeChecks = {}
|
|
4444
|
+
} = combinedOptions;
|
|
4445
|
+
const finalMemoizeOptions = ensureIsArray(memoizeOptions);
|
|
4446
|
+
const finalArgsMemoizeOptions = ensureIsArray(argsMemoizeOptions);
|
|
4447
|
+
const dependencies = getDependencies(createSelectorArgs);
|
|
4448
|
+
const memoizedResultFunc = memoize(function recomputationWrapper() {
|
|
4449
|
+
recomputations++;
|
|
4450
|
+
return resultFunc.apply(
|
|
4451
|
+
null,
|
|
4452
|
+
arguments
|
|
4453
|
+
);
|
|
4454
|
+
}, ...finalMemoizeOptions);
|
|
4455
|
+
let firstRun = true;
|
|
4456
|
+
const selector = argsMemoize(function dependenciesChecker() {
|
|
4457
|
+
dependencyRecomputations++;
|
|
4458
|
+
const inputSelectorResults = collectInputSelectorResults(
|
|
4459
|
+
dependencies,
|
|
4460
|
+
arguments
|
|
4461
|
+
);
|
|
4462
|
+
lastResult = memoizedResultFunc.apply(null, inputSelectorResults);
|
|
4463
|
+
if (process.env.NODE_ENV !== "production") {
|
|
4464
|
+
const { identityFunctionCheck, inputStabilityCheck } = getDevModeChecksExecutionInfo(firstRun, devModeChecks);
|
|
4465
|
+
if (identityFunctionCheck.shouldRun) {
|
|
4466
|
+
identityFunctionCheck.run(
|
|
4467
|
+
resultFunc,
|
|
4468
|
+
inputSelectorResults,
|
|
4469
|
+
lastResult
|
|
4470
|
+
);
|
|
4471
|
+
}
|
|
4472
|
+
if (inputStabilityCheck.shouldRun) {
|
|
4473
|
+
const inputSelectorResultsCopy = collectInputSelectorResults(
|
|
4474
|
+
dependencies,
|
|
4475
|
+
arguments
|
|
4476
|
+
);
|
|
4477
|
+
inputStabilityCheck.run(
|
|
4478
|
+
{ inputSelectorResults, inputSelectorResultsCopy },
|
|
4479
|
+
{ memoize, memoizeOptions: finalMemoizeOptions },
|
|
4480
|
+
arguments
|
|
4481
|
+
);
|
|
4482
|
+
}
|
|
4483
|
+
if (firstRun)
|
|
4484
|
+
firstRun = false;
|
|
4485
|
+
}
|
|
4486
|
+
return lastResult;
|
|
4487
|
+
}, ...finalArgsMemoizeOptions);
|
|
4488
|
+
return Object.assign(selector, {
|
|
4489
|
+
resultFunc,
|
|
4490
|
+
memoizedResultFunc,
|
|
4491
|
+
dependencies,
|
|
4492
|
+
dependencyRecomputations: () => dependencyRecomputations,
|
|
4493
|
+
resetDependencyRecomputations: () => {
|
|
4494
|
+
dependencyRecomputations = 0;
|
|
4495
|
+
},
|
|
4496
|
+
lastResult: () => lastResult,
|
|
4497
|
+
recomputations: () => recomputations,
|
|
4498
|
+
resetRecomputations: () => {
|
|
4499
|
+
recomputations = 0;
|
|
4500
|
+
},
|
|
4501
|
+
memoize,
|
|
4502
|
+
argsMemoize
|
|
4503
|
+
});
|
|
4504
|
+
};
|
|
4505
|
+
Object.assign(createSelector2, {
|
|
4506
|
+
withTypes: () => createSelector2
|
|
4507
|
+
});
|
|
4508
|
+
return createSelector2;
|
|
4509
|
+
}
|
|
4510
|
+
var createSelector$1 = /* @__PURE__ */ createSelectorCreator(weakMapMemoize);
|
|
4511
|
+
|
|
4512
|
+
// src/createStructuredSelector.ts
|
|
4513
|
+
var createStructuredSelector = Object.assign(
|
|
4514
|
+
(inputSelectorsObject, selectorCreator = createSelector$1) => {
|
|
4515
|
+
assertIsObject(
|
|
4516
|
+
inputSelectorsObject,
|
|
4517
|
+
`createStructuredSelector expects first argument to be an object where each property is a selector, instead received a ${typeof inputSelectorsObject}`
|
|
4518
|
+
);
|
|
4519
|
+
const inputSelectorKeys = Object.keys(inputSelectorsObject);
|
|
4520
|
+
const dependencies = inputSelectorKeys.map(
|
|
4521
|
+
(key) => inputSelectorsObject[key]
|
|
4522
|
+
);
|
|
4523
|
+
const structuredSelector = selectorCreator(
|
|
4524
|
+
dependencies,
|
|
4525
|
+
(...inputSelectorResults) => {
|
|
4526
|
+
return inputSelectorResults.reduce((composition, value, index) => {
|
|
4527
|
+
composition[inputSelectorKeys[index]] = value;
|
|
4528
|
+
return composition;
|
|
4529
|
+
}, {});
|
|
4530
|
+
}
|
|
4531
|
+
);
|
|
4532
|
+
return structuredSelector;
|
|
4533
|
+
},
|
|
4534
|
+
{ withTypes: () => createStructuredSelector }
|
|
4535
|
+
);
|
|
4536
|
+
|
|
4109
4537
|
/* eslint-disable no-underscore-dangle */ // __cacheKey__
|
|
4110
4538
|
|
|
4111
4539
|
createSelectorCreator({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jobber/components",
|
|
3
|
-
"version": "6.120.
|
|
3
|
+
"version": "6.120.3",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.cjs",
|
|
@@ -552,5 +552,5 @@
|
|
|
552
552
|
"> 1%",
|
|
553
553
|
"IE 10"
|
|
554
554
|
],
|
|
555
|
-
"gitHead": "
|
|
555
|
+
"gitHead": "4b2d7ea4c8a4478d533c4213b14193d3ab106fc0"
|
|
556
556
|
}
|