storybook 10.0.0-rc.1 → 10.0.0-rc.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_browser-chunks/{Color-KPLIACXP.js → Color-7ZNS6F6B.js} +112 -5
- package/dist/_browser-chunks/chunk-AB7OOPUX.js +12 -0
- package/dist/_browser-chunks/{chunk-6E2SHJSL.js → chunk-B4A3ADP3.js} +2 -2
- package/dist/_browser-chunks/chunk-FSBVR7H5.js +106 -0
- package/dist/_browser-chunks/{chunk-2DK2T7MP.js → chunk-SYS437NN.js} +38 -1
- package/dist/_browser-chunks/chunk-U46RQHA4.js +12 -0
- package/dist/_browser-chunks/{chunk-QK3L5AXO.js → chunk-UTNZYD2N.js} +87 -148
- package/dist/_browser-chunks/{chunk-OTSQMN22.js → chunk-W4QKLQSC.js} +7 -7
- package/dist/_browser-chunks/{chunk-JJZMHC3A.js → chunk-ZNRFDIVA.js} +35 -203
- package/dist/_node-chunks/{builder-manager-UDVVFBHZ.js → builder-manager-ZNPRP22E.js} +12 -12
- package/dist/_node-chunks/camelcase-EY6MYFU4.js +18 -0
- package/dist/_node-chunks/{chunk-YIM5CHEY.js → chunk-2IEV7XG2.js} +9 -9
- package/dist/_node-chunks/{chunk-SV4BYPXK.js → chunk-54MOKOMZ.js} +8 -8
- package/dist/_node-chunks/{chunk-7MPLFWHG.js → chunk-62KDMWXX.js} +7 -7
- package/dist/_node-chunks/{chunk-ZCRAXS3E.js → chunk-6SGQF6CF.js} +8 -8
- package/dist/_node-chunks/{chunk-NWPHCXHG.js → chunk-6VEWXDI5.js} +6 -6
- package/dist/_node-chunks/{chunk-VUU6O7VI.js → chunk-AFW3U6QG.js} +7 -7
- package/dist/_node-chunks/{chunk-2BDCE3L3.js → chunk-BPYW7SFB.js} +7 -7
- package/dist/_node-chunks/{chunk-GHCHUCI6.js → chunk-D5WSRTEX.js} +7 -7
- package/dist/_node-chunks/{chunk-Y5P4UWNE.js → chunk-DOCRBDQH.js} +7 -7
- package/dist/_node-chunks/{chunk-UJWKT624.js → chunk-FWBLOTP7.js} +7 -7
- package/dist/_node-chunks/{chunk-N2JV6FZG.js → chunk-FXGD2HHQ.js} +7 -7
- package/dist/_node-chunks/{chunk-CRG33JWE.js → chunk-H6J6LJQQ.js} +6 -6
- package/dist/_node-chunks/{chunk-LU3G37SK.js → chunk-J34Y4L4Q.js} +9 -9
- package/dist/_node-chunks/chunk-JT5JXOKC.js +61 -0
- package/dist/_node-chunks/{chunk-O6V3EWUU.js → chunk-K5GJVTVF.js} +7 -7
- package/dist/_node-chunks/{chunk-6EIKR7ZS.js → chunk-LR47LSEQ.js} +8 -8
- package/dist/_node-chunks/{chunk-FJPST7C2.js → chunk-LUDM5RD2.js} +8 -8
- package/dist/_node-chunks/{chunk-ETMGL223.js → chunk-M2Y5JVSX.js} +8 -8
- package/dist/_node-chunks/{chunk-2WCW6WBN.js → chunk-MTIN3LKM.js} +7 -7
- package/dist/_node-chunks/chunk-N4S7XZKB.js +18 -0
- package/dist/_node-chunks/{chunk-WRNOJIKJ.js → chunk-OCPCEJ7D.js} +7 -7
- package/dist/_node-chunks/{chunk-SIW4GO4H.js → chunk-QD4TA2GK.js} +7 -7
- package/dist/_node-chunks/{chunk-HB37PYB7.js → chunk-SF4YWMS2.js} +21 -21
- package/dist/_node-chunks/{chunk-P2Y2WO7H.js → chunk-SSK6CTPD.js} +12 -12
- package/dist/_node-chunks/{chunk-UVZAIPBG.js → chunk-TR7IYGK4.js} +7 -7
- package/dist/_node-chunks/{chunk-S27PS53I.js → chunk-VDCU2LFF.js} +7 -7
- package/dist/_node-chunks/{chunk-BQLZIX2Q.js → chunk-VHPYGR5X.js} +7 -7
- package/dist/_node-chunks/{chunk-IPXSLDLA.js → chunk-VSPERFYF.js} +15 -15
- package/dist/_node-chunks/{chunk-VF6KHP6R.js → chunk-WD2QJDGV.js} +7 -7
- package/dist/_node-chunks/{chunk-3R5LD45Z.js → chunk-X35XJZ7G.js} +7 -7
- package/dist/_node-chunks/{chunk-WT75CKIP.js → chunk-XJRUDTSD.js} +7 -7
- package/dist/_node-chunks/{chunk-VFMZOJVS.js → chunk-ZZMPRSOL.js} +10 -10
- package/dist/_node-chunks/{dist-KKBN5NK7.js → dist-47EE2CMC.js} +9 -9
- package/dist/_node-chunks/{globby-DCTHVPS7.js → globby-ZEUQ6QPC.js} +9 -9
- package/dist/_node-chunks/{lib-AAIV2OLH.js → lib-LCU5VXJS.js} +7 -7
- package/dist/_node-chunks/{mdx-N42X6CFJ-7FIB6GQ2.js → mdx-N42X6CFJ-7LUZM4HR.js} +8 -8
- package/dist/_node-chunks/{p-limit-Y5VDO334.js → p-limit-XJGTO6H5.js} +7 -7
- package/dist/_node-chunks/{plugin-ZUT5HESO.js → plugin-YZRPWYO5.js} +10 -10
- package/dist/_node-chunks/{plugin-AOOT7HFP.js → plugin-ZN5KCYM2.js} +10 -10
- package/dist/_node-chunks/{webpack-inject-mocker-runtime-plugin-6H3PHE5K.js → webpack-inject-mocker-runtime-plugin-CRH6N7YZ.js} +10 -10
- package/dist/_node-chunks/{webpack-mock-plugin-RSJCOU6H.js → webpack-mock-plugin-NQXGMVTF.js} +9 -9
- package/dist/babel/index.js +11 -11
- package/dist/bin/core.js +11 -11
- package/dist/bin/dispatcher.js +11 -11
- package/dist/bin/loader.js +9 -9
- package/dist/cli/index.js +846 -19510
- package/dist/common/index.js +20 -20
- package/dist/core-server/index.js +713 -7719
- package/dist/core-server/presets/common-manager.js +11 -11
- package/dist/core-server/presets/common-override-preset.js +9 -9
- package/dist/core-server/presets/common-preset.js +23 -23
- package/dist/core-server/presets/webpack/loaders/storybook-mock-transform-loader.js +9 -9
- package/dist/core-server/presets/webpack/loaders/webpack-automock-loader.js +10 -10
- package/dist/csf/index.js +6 -6
- package/dist/csf-tools/index.js +9 -9
- package/dist/docs-tools/index.js +5 -5
- package/dist/manager/globals-runtime.js +98 -7182
- package/dist/manager/runtime.js +309 -7317
- package/dist/manager-api/index.d.ts +1 -1
- package/dist/manager-api/index.js +15 -45
- package/dist/node-logger/index.js +14 -14
- package/dist/preview/runtime.js +99 -7183
- package/dist/preview-api/index.js +6 -6
- package/dist/router/index.js +5 -3
- package/dist/server-errors.js +10 -10
- package/dist/telemetry/index.js +24 -24
- package/dist/test/index.js +97 -7181
- package/package.json +3 -3
- package/dist/_browser-chunks/chunk-FA42P6MO.js +0 -107
- package/dist/_browser-chunks/chunk-G33S6YM3.js +0 -521
- package/dist/_browser-chunks/chunk-KSCAWCCE.js +0 -6093
- package/dist/_browser-chunks/chunk-WKCVJYVJ.js +0 -0
- package/dist/_node-chunks/camelcase-OLULABBT.js +0 -18
- package/dist/_node-chunks/chunk-V6MYZCMZ.js +0 -61
- package/dist/_node-chunks/chunk-XNSVOMTF.js +0 -18
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "storybook",
|
|
3
|
-
"version": "10.0.0-rc.
|
|
3
|
+
"version": "10.0.0-rc.2",
|
|
4
4
|
"description": "Storybook: Develop, document, and test UI components in isolation",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"storybook",
|
|
@@ -223,7 +223,6 @@
|
|
|
223
223
|
"@emotion/styled": "^11.14.0",
|
|
224
224
|
"@fal-works/esbuild-plugin-global-externals": "^2.1.2",
|
|
225
225
|
"@happy-dom/global-registrator": "^18.0.1",
|
|
226
|
-
"@ndelangen/get-tarball": "^3.0.7",
|
|
227
226
|
"@ngard/tiny-isequal": "^1.1.0",
|
|
228
227
|
"@polka/compression": "^1.0.0-next.28",
|
|
229
228
|
"@radix-ui/react-dialog": "^1.1.2",
|
|
@@ -232,7 +231,7 @@
|
|
|
232
231
|
"@rolldown/pluginutils": "1.0.0-beta.18",
|
|
233
232
|
"@storybook/docs-mdx": "4.0.0-next.1",
|
|
234
233
|
"@tanstack/react-virtual": "^3.3.0",
|
|
235
|
-
"@testing-library/dom": "10.4.
|
|
234
|
+
"@testing-library/dom": "^10.4.1",
|
|
236
235
|
"@testing-library/react": "^14.0.0",
|
|
237
236
|
"@types/cross-spawn": "^6.0.6",
|
|
238
237
|
"@types/detect-port": "^1.3.0",
|
|
@@ -290,6 +289,7 @@
|
|
|
290
289
|
"leven": "^4.0.0",
|
|
291
290
|
"memfs": "^4.11.1",
|
|
292
291
|
"memoizerific": "^1.11.3",
|
|
292
|
+
"modern-tar": "^0.5.5",
|
|
293
293
|
"nanoid": "^4.0.2",
|
|
294
294
|
"npmlog": "^7.0.0",
|
|
295
295
|
"open": "^10.2.0",
|
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
cloneDeep,
|
|
3
|
-
isObjectLike,
|
|
4
|
-
isUnsafeProperty
|
|
5
|
-
} from "./chunk-QK3L5AXO.js";
|
|
6
|
-
import {
|
|
7
|
-
isPlainObject
|
|
8
|
-
} from "./chunk-JJZMHC3A.js";
|
|
9
|
-
import {
|
|
10
|
-
__name
|
|
11
|
-
} from "./chunk-MM7DTO55.js";
|
|
12
|
-
|
|
13
|
-
// ../node_modules/es-toolkit/dist/object/mergeWith.mjs
|
|
14
|
-
function mergeWith(target, source, merge2) {
|
|
15
|
-
const sourceKeys = Object.keys(source);
|
|
16
|
-
for (let i = 0; i < sourceKeys.length; i++) {
|
|
17
|
-
const key = sourceKeys[i];
|
|
18
|
-
if (isUnsafeProperty(key)) {
|
|
19
|
-
continue;
|
|
20
|
-
}
|
|
21
|
-
const sourceValue = source[key];
|
|
22
|
-
const targetValue = target[key];
|
|
23
|
-
const merged = merge2(targetValue, sourceValue, key, target, source);
|
|
24
|
-
if (merged !== void 0) {
|
|
25
|
-
target[key] = merged;
|
|
26
|
-
} else if (Array.isArray(sourceValue)) {
|
|
27
|
-
target[key] = mergeWith(targetValue ?? [], sourceValue, merge2);
|
|
28
|
-
} else if (isObjectLike(targetValue) && isObjectLike(sourceValue)) {
|
|
29
|
-
target[key] = mergeWith(targetValue ?? {}, sourceValue, merge2);
|
|
30
|
-
} else if (targetValue === void 0 || sourceValue !== void 0) {
|
|
31
|
-
target[key] = sourceValue;
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
return target;
|
|
35
|
-
}
|
|
36
|
-
__name(mergeWith, "mergeWith");
|
|
37
|
-
|
|
38
|
-
// ../node_modules/es-toolkit/dist/object/pick.mjs
|
|
39
|
-
function pick(obj, keys) {
|
|
40
|
-
const result = {};
|
|
41
|
-
for (let i = 0; i < keys.length; i++) {
|
|
42
|
-
const key = keys[i];
|
|
43
|
-
if (Object.hasOwn(obj, key)) {
|
|
44
|
-
result[key] = obj[key];
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
return result;
|
|
48
|
-
}
|
|
49
|
-
__name(pick, "pick");
|
|
50
|
-
|
|
51
|
-
// ../node_modules/es-toolkit/dist/object/pickBy.mjs
|
|
52
|
-
function pickBy(obj, shouldPick) {
|
|
53
|
-
const result = {};
|
|
54
|
-
const keys = Object.keys(obj);
|
|
55
|
-
for (let i = 0; i < keys.length; i++) {
|
|
56
|
-
const key = keys[i];
|
|
57
|
-
const value = obj[key];
|
|
58
|
-
if (shouldPick(value, key)) {
|
|
59
|
-
result[key] = value;
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
return result;
|
|
63
|
-
}
|
|
64
|
-
__name(pickBy, "pickBy");
|
|
65
|
-
|
|
66
|
-
// ../node_modules/es-toolkit/dist/object/merge.mjs
|
|
67
|
-
function merge(target, source) {
|
|
68
|
-
const sourceKeys = Object.keys(source);
|
|
69
|
-
for (let i = 0; i < sourceKeys.length; i++) {
|
|
70
|
-
const key = sourceKeys[i];
|
|
71
|
-
if (isUnsafeProperty(key)) {
|
|
72
|
-
continue;
|
|
73
|
-
}
|
|
74
|
-
const sourceValue = source[key];
|
|
75
|
-
const targetValue = target[key];
|
|
76
|
-
if (Array.isArray(sourceValue)) {
|
|
77
|
-
if (Array.isArray(targetValue)) {
|
|
78
|
-
target[key] = merge(targetValue, sourceValue);
|
|
79
|
-
} else {
|
|
80
|
-
target[key] = merge([], sourceValue);
|
|
81
|
-
}
|
|
82
|
-
} else if (isPlainObject(sourceValue)) {
|
|
83
|
-
if (isPlainObject(targetValue)) {
|
|
84
|
-
target[key] = merge(targetValue, sourceValue);
|
|
85
|
-
} else {
|
|
86
|
-
target[key] = merge({}, sourceValue);
|
|
87
|
-
}
|
|
88
|
-
} else if (targetValue === void 0 || sourceValue !== void 0) {
|
|
89
|
-
target[key] = sourceValue;
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
return target;
|
|
93
|
-
}
|
|
94
|
-
__name(merge, "merge");
|
|
95
|
-
|
|
96
|
-
// ../node_modules/es-toolkit/dist/object/toMerged.mjs
|
|
97
|
-
function toMerged(target, source) {
|
|
98
|
-
return merge(cloneDeep(target), source);
|
|
99
|
-
}
|
|
100
|
-
__name(toMerged, "toMerged");
|
|
101
|
-
|
|
102
|
-
export {
|
|
103
|
-
mergeWith,
|
|
104
|
-
pick,
|
|
105
|
-
pickBy,
|
|
106
|
-
toMerged
|
|
107
|
-
};
|
|
@@ -1,521 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
__name
|
|
3
|
-
} from "./chunk-MM7DTO55.js";
|
|
4
|
-
|
|
5
|
-
// ../node_modules/es-toolkit/dist/compat/predicate/isSymbol.mjs
|
|
6
|
-
function isSymbol(value) {
|
|
7
|
-
return typeof value === "symbol" || value instanceof Symbol;
|
|
8
|
-
}
|
|
9
|
-
__name(isSymbol, "isSymbol");
|
|
10
|
-
|
|
11
|
-
// ../node_modules/es-toolkit/dist/compat/util/toNumber.mjs
|
|
12
|
-
function toNumber(value) {
|
|
13
|
-
if (isSymbol(value)) {
|
|
14
|
-
return NaN;
|
|
15
|
-
}
|
|
16
|
-
return Number(value);
|
|
17
|
-
}
|
|
18
|
-
__name(toNumber, "toNumber");
|
|
19
|
-
|
|
20
|
-
// ../node_modules/es-toolkit/dist/compat/util/toFinite.mjs
|
|
21
|
-
function toFinite(value) {
|
|
22
|
-
if (!value) {
|
|
23
|
-
return value === 0 ? value : 0;
|
|
24
|
-
}
|
|
25
|
-
value = toNumber(value);
|
|
26
|
-
if (value === Infinity || value === -Infinity) {
|
|
27
|
-
const sign = value < 0 ? -1 : 1;
|
|
28
|
-
return sign * Number.MAX_VALUE;
|
|
29
|
-
}
|
|
30
|
-
return value === value ? value : 0;
|
|
31
|
-
}
|
|
32
|
-
__name(toFinite, "toFinite");
|
|
33
|
-
|
|
34
|
-
// ../node_modules/es-toolkit/dist/compat/util/toInteger.mjs
|
|
35
|
-
function toInteger(value) {
|
|
36
|
-
const finite = toFinite(value);
|
|
37
|
-
const remainder = finite % 1;
|
|
38
|
-
return remainder ? finite - remainder : finite;
|
|
39
|
-
}
|
|
40
|
-
__name(toInteger, "toInteger");
|
|
41
|
-
|
|
42
|
-
// ../node_modules/es-toolkit/dist/array/chunk.mjs
|
|
43
|
-
function chunk(arr, size) {
|
|
44
|
-
if (!Number.isInteger(size) || size <= 0) {
|
|
45
|
-
throw new Error("Size must be an integer greater than zero.");
|
|
46
|
-
}
|
|
47
|
-
const chunkLength = Math.ceil(arr.length / size);
|
|
48
|
-
const result = Array(chunkLength);
|
|
49
|
-
for (let index = 0; index < chunkLength; index++) {
|
|
50
|
-
const start = index * size;
|
|
51
|
-
const end = start + size;
|
|
52
|
-
result[index] = arr.slice(start, end);
|
|
53
|
-
}
|
|
54
|
-
return result;
|
|
55
|
-
}
|
|
56
|
-
__name(chunk, "chunk");
|
|
57
|
-
|
|
58
|
-
// ../node_modules/es-toolkit/dist/array/compact.mjs
|
|
59
|
-
function compact(arr) {
|
|
60
|
-
const result = [];
|
|
61
|
-
for (let i = 0; i < arr.length; i++) {
|
|
62
|
-
const item = arr[i];
|
|
63
|
-
if (item) {
|
|
64
|
-
result.push(item);
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
return result;
|
|
68
|
-
}
|
|
69
|
-
__name(compact, "compact");
|
|
70
|
-
|
|
71
|
-
// ../node_modules/es-toolkit/dist/array/flatten.mjs
|
|
72
|
-
function flatten(arr, depth = 1) {
|
|
73
|
-
const result = [];
|
|
74
|
-
const flooredDepth = Math.floor(depth);
|
|
75
|
-
const recursive = /* @__PURE__ */ __name((arr2, currentDepth) => {
|
|
76
|
-
for (let i = 0; i < arr2.length; i++) {
|
|
77
|
-
const item = arr2[i];
|
|
78
|
-
if (Array.isArray(item) && currentDepth < flooredDepth) {
|
|
79
|
-
recursive(item, currentDepth + 1);
|
|
80
|
-
} else {
|
|
81
|
-
result.push(item);
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
}, "recursive");
|
|
85
|
-
recursive(arr, 0);
|
|
86
|
-
return result;
|
|
87
|
-
}
|
|
88
|
-
__name(flatten, "flatten");
|
|
89
|
-
|
|
90
|
-
// ../node_modules/es-toolkit/dist/array/difference.mjs
|
|
91
|
-
function difference(firstArr, secondArr) {
|
|
92
|
-
const secondSet = new Set(secondArr);
|
|
93
|
-
return firstArr.filter((item) => !secondSet.has(item));
|
|
94
|
-
}
|
|
95
|
-
__name(difference, "difference");
|
|
96
|
-
|
|
97
|
-
// ../node_modules/es-toolkit/dist/array/last.mjs
|
|
98
|
-
function last(arr) {
|
|
99
|
-
return arr[arr.length - 1];
|
|
100
|
-
}
|
|
101
|
-
__name(last, "last");
|
|
102
|
-
|
|
103
|
-
// ../node_modules/es-toolkit/dist/array/differenceBy.mjs
|
|
104
|
-
function differenceBy(firstArr, secondArr, mapper) {
|
|
105
|
-
const mappedSecondSet = new Set(secondArr.map((item) => mapper(item)));
|
|
106
|
-
return firstArr.filter((item) => {
|
|
107
|
-
return !mappedSecondSet.has(mapper(item));
|
|
108
|
-
});
|
|
109
|
-
}
|
|
110
|
-
__name(differenceBy, "differenceBy");
|
|
111
|
-
|
|
112
|
-
// ../node_modules/es-toolkit/dist/array/differenceWith.mjs
|
|
113
|
-
function differenceWith(firstArr, secondArr, areItemsEqual) {
|
|
114
|
-
return firstArr.filter((firstItem) => {
|
|
115
|
-
return secondArr.every((secondItem) => {
|
|
116
|
-
return !areItemsEqual(firstItem, secondItem);
|
|
117
|
-
});
|
|
118
|
-
});
|
|
119
|
-
}
|
|
120
|
-
__name(differenceWith, "differenceWith");
|
|
121
|
-
|
|
122
|
-
// ../node_modules/es-toolkit/dist/array/drop.mjs
|
|
123
|
-
function drop(arr, itemsCount) {
|
|
124
|
-
itemsCount = Math.max(itemsCount, 0);
|
|
125
|
-
return arr.slice(itemsCount);
|
|
126
|
-
}
|
|
127
|
-
__name(drop, "drop");
|
|
128
|
-
|
|
129
|
-
// ../node_modules/es-toolkit/dist/array/dropRight.mjs
|
|
130
|
-
function dropRight(arr, itemsCount) {
|
|
131
|
-
itemsCount = Math.min(-itemsCount, 0);
|
|
132
|
-
if (itemsCount === 0) {
|
|
133
|
-
return arr.slice();
|
|
134
|
-
}
|
|
135
|
-
return arr.slice(0, itemsCount);
|
|
136
|
-
}
|
|
137
|
-
__name(dropRight, "dropRight");
|
|
138
|
-
|
|
139
|
-
// ../node_modules/es-toolkit/dist/array/dropRightWhile.mjs
|
|
140
|
-
function dropRightWhile(arr, canContinueDropping) {
|
|
141
|
-
for (let i = arr.length - 1; i >= 0; i--) {
|
|
142
|
-
if (!canContinueDropping(arr[i], i, arr)) {
|
|
143
|
-
return arr.slice(0, i + 1);
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
return [];
|
|
147
|
-
}
|
|
148
|
-
__name(dropRightWhile, "dropRightWhile");
|
|
149
|
-
|
|
150
|
-
// ../node_modules/es-toolkit/dist/array/dropWhile.mjs
|
|
151
|
-
function dropWhile(arr, canContinueDropping) {
|
|
152
|
-
const dropEndIndex = arr.findIndex((item, index, arr2) => !canContinueDropping(item, index, arr2));
|
|
153
|
-
if (dropEndIndex === -1) {
|
|
154
|
-
return [];
|
|
155
|
-
}
|
|
156
|
-
return arr.slice(dropEndIndex);
|
|
157
|
-
}
|
|
158
|
-
__name(dropWhile, "dropWhile");
|
|
159
|
-
|
|
160
|
-
// ../node_modules/es-toolkit/dist/array/fill.mjs
|
|
161
|
-
function fill(array, value, start = 0, end = array.length) {
|
|
162
|
-
const length = array.length;
|
|
163
|
-
const finalStart = Math.max(start >= 0 ? start : length + start, 0);
|
|
164
|
-
const finalEnd = Math.min(end >= 0 ? end : length + end, length);
|
|
165
|
-
for (let i = finalStart; i < finalEnd; i++) {
|
|
166
|
-
array[i] = value;
|
|
167
|
-
}
|
|
168
|
-
return array;
|
|
169
|
-
}
|
|
170
|
-
__name(fill, "fill");
|
|
171
|
-
|
|
172
|
-
// ../node_modules/es-toolkit/dist/array/head.mjs
|
|
173
|
-
function head(arr) {
|
|
174
|
-
return arr[0];
|
|
175
|
-
}
|
|
176
|
-
__name(head, "head");
|
|
177
|
-
|
|
178
|
-
// ../node_modules/es-toolkit/dist/array/groupBy.mjs
|
|
179
|
-
function groupBy(arr, getKeyFromItem) {
|
|
180
|
-
const result = {};
|
|
181
|
-
for (let i = 0; i < arr.length; i++) {
|
|
182
|
-
const item = arr[i];
|
|
183
|
-
const key = getKeyFromItem(item);
|
|
184
|
-
if (!Object.hasOwn(result, key)) {
|
|
185
|
-
result[key] = [];
|
|
186
|
-
}
|
|
187
|
-
result[key].push(item);
|
|
188
|
-
}
|
|
189
|
-
return result;
|
|
190
|
-
}
|
|
191
|
-
__name(groupBy, "groupBy");
|
|
192
|
-
|
|
193
|
-
// ../node_modules/es-toolkit/dist/array/initial.mjs
|
|
194
|
-
function initial(arr) {
|
|
195
|
-
return arr.slice(0, -1);
|
|
196
|
-
}
|
|
197
|
-
__name(initial, "initial");
|
|
198
|
-
|
|
199
|
-
// ../node_modules/es-toolkit/dist/array/intersection.mjs
|
|
200
|
-
function intersection(firstArr, secondArr) {
|
|
201
|
-
const secondSet = new Set(secondArr);
|
|
202
|
-
return firstArr.filter((item) => {
|
|
203
|
-
return secondSet.has(item);
|
|
204
|
-
});
|
|
205
|
-
}
|
|
206
|
-
__name(intersection, "intersection");
|
|
207
|
-
|
|
208
|
-
// ../node_modules/es-toolkit/dist/array/uniq.mjs
|
|
209
|
-
function uniq(arr) {
|
|
210
|
-
return Array.from(new Set(arr));
|
|
211
|
-
}
|
|
212
|
-
__name(uniq, "uniq");
|
|
213
|
-
|
|
214
|
-
// ../node_modules/es-toolkit/dist/array/intersectionBy.mjs
|
|
215
|
-
function intersectionBy(firstArr, secondArr, mapper) {
|
|
216
|
-
const mappedSecondSet = new Set(secondArr.map(mapper));
|
|
217
|
-
return firstArr.filter((item) => mappedSecondSet.has(mapper(item)));
|
|
218
|
-
}
|
|
219
|
-
__name(intersectionBy, "intersectionBy");
|
|
220
|
-
|
|
221
|
-
// ../node_modules/es-toolkit/dist/array/intersectionWith.mjs
|
|
222
|
-
function intersectionWith(firstArr, secondArr, areItemsEqual) {
|
|
223
|
-
return firstArr.filter((firstItem) => {
|
|
224
|
-
return secondArr.some((secondItem) => {
|
|
225
|
-
return areItemsEqual(firstItem, secondItem);
|
|
226
|
-
});
|
|
227
|
-
});
|
|
228
|
-
}
|
|
229
|
-
__name(intersectionWith, "intersectionWith");
|
|
230
|
-
|
|
231
|
-
// ../node_modules/es-toolkit/dist/array/pull.mjs
|
|
232
|
-
function pull(arr, valuesToRemove) {
|
|
233
|
-
const valuesSet = new Set(valuesToRemove);
|
|
234
|
-
let resultIndex = 0;
|
|
235
|
-
for (let i = 0; i < arr.length; i++) {
|
|
236
|
-
if (valuesSet.has(arr[i])) {
|
|
237
|
-
continue;
|
|
238
|
-
}
|
|
239
|
-
if (!Object.hasOwn(arr, i)) {
|
|
240
|
-
delete arr[resultIndex++];
|
|
241
|
-
continue;
|
|
242
|
-
}
|
|
243
|
-
arr[resultIndex++] = arr[i];
|
|
244
|
-
}
|
|
245
|
-
arr.length = resultIndex;
|
|
246
|
-
return arr;
|
|
247
|
-
}
|
|
248
|
-
__name(pull, "pull");
|
|
249
|
-
|
|
250
|
-
// ../node_modules/es-toolkit/dist/array/remove.mjs
|
|
251
|
-
function remove(arr, shouldRemoveElement) {
|
|
252
|
-
const originalArr = arr.slice();
|
|
253
|
-
const removed = [];
|
|
254
|
-
let resultIndex = 0;
|
|
255
|
-
for (let i = 0; i < arr.length; i++) {
|
|
256
|
-
if (shouldRemoveElement(arr[i], i, originalArr)) {
|
|
257
|
-
removed.push(arr[i]);
|
|
258
|
-
continue;
|
|
259
|
-
}
|
|
260
|
-
if (!Object.hasOwn(arr, i)) {
|
|
261
|
-
delete arr[resultIndex++];
|
|
262
|
-
continue;
|
|
263
|
-
}
|
|
264
|
-
arr[resultIndex++] = arr[i];
|
|
265
|
-
}
|
|
266
|
-
arr.length = resultIndex;
|
|
267
|
-
return removed;
|
|
268
|
-
}
|
|
269
|
-
__name(remove, "remove");
|
|
270
|
-
|
|
271
|
-
// ../node_modules/es-toolkit/dist/array/sample.mjs
|
|
272
|
-
function sample(arr) {
|
|
273
|
-
const randomIndex = Math.floor(Math.random() * arr.length);
|
|
274
|
-
return arr[randomIndex];
|
|
275
|
-
}
|
|
276
|
-
__name(sample, "sample");
|
|
277
|
-
|
|
278
|
-
// ../node_modules/es-toolkit/dist/math/random.mjs
|
|
279
|
-
function random(minimum, maximum) {
|
|
280
|
-
if (maximum == null) {
|
|
281
|
-
maximum = minimum;
|
|
282
|
-
minimum = 0;
|
|
283
|
-
}
|
|
284
|
-
if (minimum >= maximum) {
|
|
285
|
-
throw new Error("Invalid input: The maximum value must be greater than the minimum value.");
|
|
286
|
-
}
|
|
287
|
-
return Math.random() * (maximum - minimum) + minimum;
|
|
288
|
-
}
|
|
289
|
-
__name(random, "random");
|
|
290
|
-
|
|
291
|
-
// ../node_modules/es-toolkit/dist/math/randomInt.mjs
|
|
292
|
-
function randomInt(minimum, maximum) {
|
|
293
|
-
return Math.floor(random(minimum, maximum));
|
|
294
|
-
}
|
|
295
|
-
__name(randomInt, "randomInt");
|
|
296
|
-
|
|
297
|
-
// ../node_modules/es-toolkit/dist/array/sampleSize.mjs
|
|
298
|
-
function sampleSize(array, size) {
|
|
299
|
-
if (size > array.length) {
|
|
300
|
-
throw new Error("Size must be less than or equal to the length of array.");
|
|
301
|
-
}
|
|
302
|
-
const result = new Array(size);
|
|
303
|
-
const selected = /* @__PURE__ */ new Set();
|
|
304
|
-
for (let step = array.length - size, resultIndex = 0; step < array.length; step++, resultIndex++) {
|
|
305
|
-
let index = randomInt(0, step + 1);
|
|
306
|
-
if (selected.has(index)) {
|
|
307
|
-
index = step;
|
|
308
|
-
}
|
|
309
|
-
selected.add(index);
|
|
310
|
-
result[resultIndex] = array[index];
|
|
311
|
-
}
|
|
312
|
-
return result;
|
|
313
|
-
}
|
|
314
|
-
__name(sampleSize, "sampleSize");
|
|
315
|
-
|
|
316
|
-
// ../node_modules/es-toolkit/dist/array/shuffle.mjs
|
|
317
|
-
function shuffle(arr) {
|
|
318
|
-
const result = arr.slice();
|
|
319
|
-
for (let i = result.length - 1; i >= 1; i--) {
|
|
320
|
-
const j = Math.floor(Math.random() * (i + 1));
|
|
321
|
-
[result[i], result[j]] = [result[j], result[i]];
|
|
322
|
-
}
|
|
323
|
-
return result;
|
|
324
|
-
}
|
|
325
|
-
__name(shuffle, "shuffle");
|
|
326
|
-
|
|
327
|
-
// ../node_modules/es-toolkit/dist/array/tail.mjs
|
|
328
|
-
function tail(arr) {
|
|
329
|
-
return arr.slice(1);
|
|
330
|
-
}
|
|
331
|
-
__name(tail, "tail");
|
|
332
|
-
|
|
333
|
-
// ../node_modules/es-toolkit/dist/array/take.mjs
|
|
334
|
-
function take(arr, count, guard) {
|
|
335
|
-
count = guard || count === void 0 ? 1 : toInteger(count);
|
|
336
|
-
return arr.slice(0, count);
|
|
337
|
-
}
|
|
338
|
-
__name(take, "take");
|
|
339
|
-
|
|
340
|
-
// ../node_modules/es-toolkit/dist/array/takeRight.mjs
|
|
341
|
-
function takeRight(arr, count = 1, guard) {
|
|
342
|
-
count = guard || count === void 0 ? 1 : toInteger(count);
|
|
343
|
-
if (count <= 0 || arr == null || arr.length === 0) {
|
|
344
|
-
return [];
|
|
345
|
-
}
|
|
346
|
-
return arr.slice(-count);
|
|
347
|
-
}
|
|
348
|
-
__name(takeRight, "takeRight");
|
|
349
|
-
|
|
350
|
-
// ../node_modules/es-toolkit/dist/array/uniqBy.mjs
|
|
351
|
-
function uniqBy(arr, mapper) {
|
|
352
|
-
const map = /* @__PURE__ */ new Map();
|
|
353
|
-
for (let i = 0; i < arr.length; i++) {
|
|
354
|
-
const item = arr[i];
|
|
355
|
-
const key = mapper(item);
|
|
356
|
-
if (!map.has(key)) {
|
|
357
|
-
map.set(key, item);
|
|
358
|
-
}
|
|
359
|
-
}
|
|
360
|
-
return Array.from(map.values());
|
|
361
|
-
}
|
|
362
|
-
__name(uniqBy, "uniqBy");
|
|
363
|
-
|
|
364
|
-
// ../node_modules/es-toolkit/dist/array/uniqWith.mjs
|
|
365
|
-
function uniqWith(arr, areItemsEqual) {
|
|
366
|
-
const result = [];
|
|
367
|
-
for (let i = 0; i < arr.length; i++) {
|
|
368
|
-
const item = arr[i];
|
|
369
|
-
const isUniq = result.every((v) => !areItemsEqual(v, item));
|
|
370
|
-
if (isUniq) {
|
|
371
|
-
result.push(item);
|
|
372
|
-
}
|
|
373
|
-
}
|
|
374
|
-
return result;
|
|
375
|
-
}
|
|
376
|
-
__name(uniqWith, "uniqWith");
|
|
377
|
-
|
|
378
|
-
// ../node_modules/es-toolkit/dist/array/unzip.mjs
|
|
379
|
-
function unzip(zipped) {
|
|
380
|
-
let maxLen = 0;
|
|
381
|
-
for (let i = 0; i < zipped.length; i++) {
|
|
382
|
-
if (zipped[i].length > maxLen) {
|
|
383
|
-
maxLen = zipped[i].length;
|
|
384
|
-
}
|
|
385
|
-
}
|
|
386
|
-
const result = new Array(maxLen);
|
|
387
|
-
for (let i = 0; i < maxLen; i++) {
|
|
388
|
-
result[i] = new Array(zipped.length);
|
|
389
|
-
for (let j = 0; j < zipped.length; j++) {
|
|
390
|
-
result[i][j] = zipped[j][i];
|
|
391
|
-
}
|
|
392
|
-
}
|
|
393
|
-
return result;
|
|
394
|
-
}
|
|
395
|
-
__name(unzip, "unzip");
|
|
396
|
-
|
|
397
|
-
// ../node_modules/es-toolkit/dist/array/without.mjs
|
|
398
|
-
function without(array, ...values) {
|
|
399
|
-
return difference(array, values);
|
|
400
|
-
}
|
|
401
|
-
__name(without, "without");
|
|
402
|
-
|
|
403
|
-
// ../node_modules/es-toolkit/dist/array/windowed.mjs
|
|
404
|
-
function windowed(arr, size, step = 1, { partialWindows = false } = {}) {
|
|
405
|
-
if (size <= 0 || !Number.isInteger(size)) {
|
|
406
|
-
throw new Error("Size must be a positive integer.");
|
|
407
|
-
}
|
|
408
|
-
if (step <= 0 || !Number.isInteger(step)) {
|
|
409
|
-
throw new Error("Step must be a positive integer.");
|
|
410
|
-
}
|
|
411
|
-
const result = [];
|
|
412
|
-
const end = partialWindows ? arr.length : arr.length - size + 1;
|
|
413
|
-
for (let i = 0; i < end; i += step) {
|
|
414
|
-
result.push(arr.slice(i, i + size));
|
|
415
|
-
}
|
|
416
|
-
return result;
|
|
417
|
-
}
|
|
418
|
-
__name(windowed, "windowed");
|
|
419
|
-
|
|
420
|
-
// ../node_modules/es-toolkit/dist/array/zip.mjs
|
|
421
|
-
function zip(...arrs) {
|
|
422
|
-
let rowCount = 0;
|
|
423
|
-
for (let i = 0; i < arrs.length; i++) {
|
|
424
|
-
if (arrs[i].length > rowCount) {
|
|
425
|
-
rowCount = arrs[i].length;
|
|
426
|
-
}
|
|
427
|
-
}
|
|
428
|
-
const columnCount = arrs.length;
|
|
429
|
-
const result = Array(rowCount);
|
|
430
|
-
for (let i = 0; i < rowCount; ++i) {
|
|
431
|
-
const row = Array(columnCount);
|
|
432
|
-
for (let j = 0; j < columnCount; ++j) {
|
|
433
|
-
row[j] = arrs[j][i];
|
|
434
|
-
}
|
|
435
|
-
result[i] = row;
|
|
436
|
-
}
|
|
437
|
-
return result;
|
|
438
|
-
}
|
|
439
|
-
__name(zip, "zip");
|
|
440
|
-
|
|
441
|
-
// ../node_modules/es-toolkit/dist/array/maxBy.mjs
|
|
442
|
-
function maxBy(items, getValue) {
|
|
443
|
-
if (items.length === 0) {
|
|
444
|
-
return void 0;
|
|
445
|
-
}
|
|
446
|
-
let maxElement = items[0];
|
|
447
|
-
let max = getValue(maxElement);
|
|
448
|
-
for (let i = 1; i < items.length; i++) {
|
|
449
|
-
const element = items[i];
|
|
450
|
-
const value = getValue(element);
|
|
451
|
-
if (value > max) {
|
|
452
|
-
max = value;
|
|
453
|
-
maxElement = element;
|
|
454
|
-
}
|
|
455
|
-
}
|
|
456
|
-
return maxElement;
|
|
457
|
-
}
|
|
458
|
-
__name(maxBy, "maxBy");
|
|
459
|
-
|
|
460
|
-
// ../node_modules/es-toolkit/dist/array/minBy.mjs
|
|
461
|
-
function minBy(items, getValue) {
|
|
462
|
-
if (items.length === 0) {
|
|
463
|
-
return void 0;
|
|
464
|
-
}
|
|
465
|
-
let minElement = items[0];
|
|
466
|
-
let min = getValue(minElement);
|
|
467
|
-
for (let i = 1; i < items.length; i++) {
|
|
468
|
-
const element = items[i];
|
|
469
|
-
const value = getValue(element);
|
|
470
|
-
if (value < min) {
|
|
471
|
-
min = value;
|
|
472
|
-
minElement = element;
|
|
473
|
-
}
|
|
474
|
-
}
|
|
475
|
-
return minElement;
|
|
476
|
-
}
|
|
477
|
-
__name(minBy, "minBy");
|
|
478
|
-
|
|
479
|
-
export {
|
|
480
|
-
chunk,
|
|
481
|
-
compact,
|
|
482
|
-
flatten,
|
|
483
|
-
difference,
|
|
484
|
-
last,
|
|
485
|
-
differenceBy,
|
|
486
|
-
differenceWith,
|
|
487
|
-
drop,
|
|
488
|
-
isSymbol,
|
|
489
|
-
toNumber,
|
|
490
|
-
toFinite,
|
|
491
|
-
toInteger,
|
|
492
|
-
dropRight,
|
|
493
|
-
dropRightWhile,
|
|
494
|
-
dropWhile,
|
|
495
|
-
fill,
|
|
496
|
-
head,
|
|
497
|
-
groupBy,
|
|
498
|
-
initial,
|
|
499
|
-
intersection,
|
|
500
|
-
uniq,
|
|
501
|
-
intersectionBy,
|
|
502
|
-
intersectionWith,
|
|
503
|
-
pull,
|
|
504
|
-
remove,
|
|
505
|
-
sample,
|
|
506
|
-
random,
|
|
507
|
-
randomInt,
|
|
508
|
-
sampleSize,
|
|
509
|
-
shuffle,
|
|
510
|
-
tail,
|
|
511
|
-
take,
|
|
512
|
-
takeRight,
|
|
513
|
-
uniqBy,
|
|
514
|
-
uniqWith,
|
|
515
|
-
unzip,
|
|
516
|
-
without,
|
|
517
|
-
windowed,
|
|
518
|
-
zip,
|
|
519
|
-
maxBy,
|
|
520
|
-
minBy
|
|
521
|
-
};
|