@headless-tree/core 1.2.1 → 1.3.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/CHANGELOG.md +19 -0
- package/dist/index.d.mts +577 -0
- package/dist/index.d.ts +577 -0
- package/dist/index.js +2321 -0
- package/dist/index.mjs +2276 -0
- package/package.json +18 -10
- package/src/core/create-tree.ts +26 -15
- package/src/features/async-data-loader/feature.ts +5 -0
- package/src/features/async-data-loader/types.ts +2 -0
- package/src/features/checkboxes/checkboxes.spec.ts +20 -5
- package/src/features/checkboxes/feature.ts +31 -16
- package/src/features/checkboxes/types.ts +1 -0
- package/src/features/drag-and-drop/drag-and-drop.spec.ts +11 -2
- package/src/features/drag-and-drop/feature.ts +51 -16
- package/src/features/drag-and-drop/types.ts +17 -0
- package/src/features/keyboard-drag-and-drop/feature.ts +8 -1
- package/src/features/keyboard-drag-and-drop/keyboard-drag-and-drop.spec.ts +34 -3
- package/src/features/main/types.ts +0 -2
- package/src/features/sync-data-loader/feature.ts +5 -1
- package/src/features/tree/feature.ts +4 -3
- package/src/features/tree/tree.spec.ts +14 -4
- package/src/test-utils/test-tree-do.ts +2 -0
- package/src/test-utils/test-tree.ts +1 -0
- package/tsconfig.json +1 -4
- package/vitest.config.ts +3 -1
- package/lib/cjs/core/build-proxified-instance.d.ts +0 -2
- package/lib/cjs/core/build-proxified-instance.js +0 -58
- package/lib/cjs/core/build-static-instance.d.ts +0 -2
- package/lib/cjs/core/build-static-instance.js +0 -26
- package/lib/cjs/core/create-tree.d.ts +0 -2
- package/lib/cjs/core/create-tree.js +0 -191
- package/lib/cjs/features/async-data-loader/feature.d.ts +0 -2
- package/lib/cjs/features/async-data-loader/feature.js +0 -135
- package/lib/cjs/features/async-data-loader/types.d.ts +0 -47
- package/lib/cjs/features/async-data-loader/types.js +0 -2
- package/lib/cjs/features/checkboxes/feature.d.ts +0 -2
- package/lib/cjs/features/checkboxes/feature.js +0 -94
- package/lib/cjs/features/checkboxes/types.d.ts +0 -26
- package/lib/cjs/features/checkboxes/types.js +0 -9
- package/lib/cjs/features/drag-and-drop/feature.d.ts +0 -2
- package/lib/cjs/features/drag-and-drop/feature.js +0 -205
- package/lib/cjs/features/drag-and-drop/types.d.ts +0 -71
- package/lib/cjs/features/drag-and-drop/types.js +0 -9
- package/lib/cjs/features/drag-and-drop/utils.d.ts +0 -27
- package/lib/cjs/features/drag-and-drop/utils.js +0 -182
- package/lib/cjs/features/expand-all/feature.d.ts +0 -2
- package/lib/cjs/features/expand-all/feature.js +0 -70
- package/lib/cjs/features/expand-all/types.d.ts +0 -19
- package/lib/cjs/features/expand-all/types.js +0 -2
- package/lib/cjs/features/hotkeys-core/feature.d.ts +0 -2
- package/lib/cjs/features/hotkeys-core/feature.js +0 -107
- package/lib/cjs/features/hotkeys-core/types.d.ts +0 -27
- package/lib/cjs/features/hotkeys-core/types.js +0 -2
- package/lib/cjs/features/keyboard-drag-and-drop/feature.d.ts +0 -2
- package/lib/cjs/features/keyboard-drag-and-drop/feature.js +0 -206
- package/lib/cjs/features/keyboard-drag-and-drop/types.d.ts +0 -27
- package/lib/cjs/features/keyboard-drag-and-drop/types.js +0 -11
- package/lib/cjs/features/main/types.d.ts +0 -47
- package/lib/cjs/features/main/types.js +0 -2
- package/lib/cjs/features/prop-memoization/feature.d.ts +0 -2
- package/lib/cjs/features/prop-memoization/feature.js +0 -70
- package/lib/cjs/features/prop-memoization/types.d.ts +0 -15
- package/lib/cjs/features/prop-memoization/types.js +0 -2
- package/lib/cjs/features/renaming/feature.d.ts +0 -2
- package/lib/cjs/features/renaming/feature.js +0 -86
- package/lib/cjs/features/renaming/types.d.ts +0 -27
- package/lib/cjs/features/renaming/types.js +0 -2
- package/lib/cjs/features/search/feature.d.ts +0 -2
- package/lib/cjs/features/search/feature.js +0 -119
- package/lib/cjs/features/search/types.d.ts +0 -32
- package/lib/cjs/features/search/types.js +0 -2
- package/lib/cjs/features/selection/feature.d.ts +0 -2
- package/lib/cjs/features/selection/feature.js +0 -132
- package/lib/cjs/features/selection/types.d.ts +0 -21
- package/lib/cjs/features/selection/types.js +0 -2
- package/lib/cjs/features/sync-data-loader/feature.d.ts +0 -2
- package/lib/cjs/features/sync-data-loader/feature.js +0 -49
- package/lib/cjs/features/sync-data-loader/types.d.ts +0 -28
- package/lib/cjs/features/sync-data-loader/types.js +0 -2
- package/lib/cjs/features/tree/feature.d.ts +0 -2
- package/lib/cjs/features/tree/feature.js +0 -244
- package/lib/cjs/features/tree/types.d.ts +0 -63
- package/lib/cjs/features/tree/types.js +0 -2
- package/lib/cjs/index.d.ts +0 -33
- package/lib/cjs/index.js +0 -51
- package/lib/cjs/mddocs-entry.d.ts +0 -121
- package/lib/cjs/mddocs-entry.js +0 -17
- package/lib/cjs/test-utils/test-tree-do.d.ts +0 -23
- package/lib/cjs/test-utils/test-tree-do.js +0 -112
- package/lib/cjs/test-utils/test-tree-expect.d.ts +0 -17
- package/lib/cjs/test-utils/test-tree-expect.js +0 -66
- package/lib/cjs/test-utils/test-tree.d.ts +0 -48
- package/lib/cjs/test-utils/test-tree.js +0 -207
- package/lib/cjs/types/core.d.ts +0 -84
- package/lib/cjs/types/core.js +0 -2
- package/lib/cjs/types/deep-merge.d.ts +0 -13
- package/lib/cjs/types/deep-merge.js +0 -2
- package/lib/cjs/utilities/create-on-drop-handler.d.ts +0 -3
- package/lib/cjs/utilities/create-on-drop-handler.js +0 -20
- package/lib/cjs/utilities/errors.d.ts +0 -2
- package/lib/cjs/utilities/errors.js +0 -9
- package/lib/cjs/utilities/insert-items-at-target.d.ts +0 -3
- package/lib/cjs/utilities/insert-items-at-target.js +0 -40
- package/lib/cjs/utilities/remove-items-from-parents.d.ts +0 -2
- package/lib/cjs/utilities/remove-items-from-parents.js +0 -32
- package/lib/cjs/utils.d.ts +0 -6
- package/lib/cjs/utils.js +0 -53
- package/lib/esm/core/build-proxified-instance.d.ts +0 -2
- package/lib/esm/core/build-proxified-instance.js +0 -54
- package/lib/esm/core/build-static-instance.d.ts +0 -2
- package/lib/esm/core/build-static-instance.js +0 -22
- package/lib/esm/core/create-tree.d.ts +0 -2
- package/lib/esm/core/create-tree.js +0 -187
- package/lib/esm/features/async-data-loader/feature.d.ts +0 -2
- package/lib/esm/features/async-data-loader/feature.js +0 -132
- package/lib/esm/features/async-data-loader/types.d.ts +0 -47
- package/lib/esm/features/async-data-loader/types.js +0 -1
- package/lib/esm/features/checkboxes/feature.d.ts +0 -2
- package/lib/esm/features/checkboxes/feature.js +0 -91
- package/lib/esm/features/checkboxes/types.d.ts +0 -26
- package/lib/esm/features/checkboxes/types.js +0 -6
- package/lib/esm/features/drag-and-drop/feature.d.ts +0 -2
- package/lib/esm/features/drag-and-drop/feature.js +0 -202
- package/lib/esm/features/drag-and-drop/types.d.ts +0 -71
- package/lib/esm/features/drag-and-drop/types.js +0 -6
- package/lib/esm/features/drag-and-drop/utils.d.ts +0 -27
- package/lib/esm/features/drag-and-drop/utils.js +0 -172
- package/lib/esm/features/expand-all/feature.d.ts +0 -2
- package/lib/esm/features/expand-all/feature.js +0 -67
- package/lib/esm/features/expand-all/types.d.ts +0 -19
- package/lib/esm/features/expand-all/types.js +0 -1
- package/lib/esm/features/hotkeys-core/feature.d.ts +0 -2
- package/lib/esm/features/hotkeys-core/feature.js +0 -104
- package/lib/esm/features/hotkeys-core/types.d.ts +0 -27
- package/lib/esm/features/hotkeys-core/types.js +0 -1
- package/lib/esm/features/keyboard-drag-and-drop/feature.d.ts +0 -2
- package/lib/esm/features/keyboard-drag-and-drop/feature.js +0 -203
- package/lib/esm/features/keyboard-drag-and-drop/types.d.ts +0 -27
- package/lib/esm/features/keyboard-drag-and-drop/types.js +0 -8
- package/lib/esm/features/main/types.d.ts +0 -47
- package/lib/esm/features/main/types.js +0 -1
- package/lib/esm/features/prop-memoization/feature.d.ts +0 -2
- package/lib/esm/features/prop-memoization/feature.js +0 -67
- package/lib/esm/features/prop-memoization/types.d.ts +0 -15
- package/lib/esm/features/prop-memoization/types.js +0 -1
- package/lib/esm/features/renaming/feature.d.ts +0 -2
- package/lib/esm/features/renaming/feature.js +0 -83
- package/lib/esm/features/renaming/types.d.ts +0 -27
- package/lib/esm/features/renaming/types.js +0 -1
- package/lib/esm/features/search/feature.d.ts +0 -2
- package/lib/esm/features/search/feature.js +0 -116
- package/lib/esm/features/search/types.d.ts +0 -32
- package/lib/esm/features/search/types.js +0 -1
- package/lib/esm/features/selection/feature.d.ts +0 -2
- package/lib/esm/features/selection/feature.js +0 -129
- package/lib/esm/features/selection/types.d.ts +0 -21
- package/lib/esm/features/selection/types.js +0 -1
- package/lib/esm/features/sync-data-loader/feature.d.ts +0 -2
- package/lib/esm/features/sync-data-loader/feature.js +0 -46
- package/lib/esm/features/sync-data-loader/types.d.ts +0 -28
- package/lib/esm/features/sync-data-loader/types.js +0 -1
- package/lib/esm/features/tree/feature.d.ts +0 -2
- package/lib/esm/features/tree/feature.js +0 -241
- package/lib/esm/features/tree/types.d.ts +0 -63
- package/lib/esm/features/tree/types.js +0 -1
- package/lib/esm/index.d.ts +0 -33
- package/lib/esm/index.js +0 -32
- package/lib/esm/mddocs-entry.d.ts +0 -121
- package/lib/esm/mddocs-entry.js +0 -1
- package/lib/esm/test-utils/test-tree-do.d.ts +0 -23
- package/lib/esm/test-utils/test-tree-do.js +0 -108
- package/lib/esm/test-utils/test-tree-expect.d.ts +0 -17
- package/lib/esm/test-utils/test-tree-expect.js +0 -62
- package/lib/esm/test-utils/test-tree.d.ts +0 -48
- package/lib/esm/test-utils/test-tree.js +0 -203
- package/lib/esm/types/core.d.ts +0 -84
- package/lib/esm/types/core.js +0 -1
- package/lib/esm/types/deep-merge.d.ts +0 -13
- package/lib/esm/types/deep-merge.js +0 -1
- package/lib/esm/utilities/create-on-drop-handler.d.ts +0 -3
- package/lib/esm/utilities/create-on-drop-handler.js +0 -16
- package/lib/esm/utilities/errors.d.ts +0 -2
- package/lib/esm/utilities/errors.js +0 -4
- package/lib/esm/utilities/insert-items-at-target.d.ts +0 -3
- package/lib/esm/utilities/insert-items-at-target.js +0 -36
- package/lib/esm/utilities/remove-items-from-parents.d.ts +0 -2
- package/lib/esm/utilities/remove-items-from-parents.js +0 -28
- package/lib/esm/utils.d.ts +0 -6
- package/lib/esm/utils.js +0 -46
|
@@ -1,207 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.TestTree = void 0;
|
|
13
|
-
/* eslint-disable import/no-extraneous-dependencies */
|
|
14
|
-
const vitest_1 = require("vitest");
|
|
15
|
-
const create_tree_1 = require("../core/create-tree");
|
|
16
|
-
const test_tree_do_1 = require("./test-tree-do");
|
|
17
|
-
const test_tree_expect_1 = require("./test-tree-expect");
|
|
18
|
-
const feature_1 = require("../features/sync-data-loader/feature");
|
|
19
|
-
const feature_2 = require("../features/async-data-loader/feature");
|
|
20
|
-
const build_proxified_instance_1 = require("../core/build-proxified-instance");
|
|
21
|
-
vitest_1.vi.useFakeTimers({ shouldAdvanceTime: true });
|
|
22
|
-
class TestTree {
|
|
23
|
-
forSuits(runSuite) {
|
|
24
|
-
vitest_1.describe.for([
|
|
25
|
-
this.suits.sync(),
|
|
26
|
-
this.suits.async(),
|
|
27
|
-
this.suits.proxifiedSync(),
|
|
28
|
-
this.suits.proxifiedAsync(),
|
|
29
|
-
])("$title", ({ tree }) => {
|
|
30
|
-
tree.resetBeforeEach();
|
|
31
|
-
runSuite(tree);
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
get instance() {
|
|
35
|
-
if (!this.treeInstance) {
|
|
36
|
-
this.treeInstance = (0, create_tree_1.createTree)(this.config);
|
|
37
|
-
this.treeInstance.rebuildTree();
|
|
38
|
-
}
|
|
39
|
-
return this.treeInstance;
|
|
40
|
-
}
|
|
41
|
-
constructor(config) {
|
|
42
|
-
this.config = config;
|
|
43
|
-
this.do = new test_tree_do_1.TestTreeDo(this);
|
|
44
|
-
this.expect = new test_tree_expect_1.TestTreeExpect(this);
|
|
45
|
-
this.treeInstance = null;
|
|
46
|
-
this.asyncDataLoaderImp = {
|
|
47
|
-
getItem: (id) => __awaiter(this, void 0, void 0, function* () {
|
|
48
|
-
yield new Promise((r) => {
|
|
49
|
-
r.debugName = `Loading getItem ${id}`;
|
|
50
|
-
TestTree.asyncLoaderResolvers.push(r);
|
|
51
|
-
});
|
|
52
|
-
return id;
|
|
53
|
-
}),
|
|
54
|
-
getChildren: (id) => __awaiter(this, void 0, void 0, function* () {
|
|
55
|
-
yield new Promise((r) => {
|
|
56
|
-
r.debugName = `Loading getChildren ${id}`;
|
|
57
|
-
TestTree.asyncLoaderResolvers.push(r);
|
|
58
|
-
});
|
|
59
|
-
return [`${id}1`, `${id}2`, `${id}3`, `${id}4`];
|
|
60
|
-
}),
|
|
61
|
-
};
|
|
62
|
-
this.suits = {
|
|
63
|
-
sync: () => ({
|
|
64
|
-
tree: this.withFeatures(feature_1.syncDataLoaderFeature),
|
|
65
|
-
title: "Synchronous Data Loader",
|
|
66
|
-
}),
|
|
67
|
-
async: () => ({
|
|
68
|
-
tree: this.withFeatures(feature_2.asyncDataLoaderFeature).with({
|
|
69
|
-
dataLoader: this.asyncDataLoaderImp,
|
|
70
|
-
}),
|
|
71
|
-
title: "Asynchronous Data Loader",
|
|
72
|
-
}),
|
|
73
|
-
proxifiedSync: () => ({
|
|
74
|
-
tree: this.withFeatures(feature_1.syncDataLoaderFeature).with({
|
|
75
|
-
instanceBuilder: build_proxified_instance_1.buildProxiedInstance,
|
|
76
|
-
}),
|
|
77
|
-
title: "Proxified Synchronous Data Loader",
|
|
78
|
-
}),
|
|
79
|
-
proxifiedAsync: () => ({
|
|
80
|
-
tree: this.withFeatures(feature_2.asyncDataLoaderFeature).with({
|
|
81
|
-
instanceBuilder: build_proxified_instance_1.buildProxiedInstance,
|
|
82
|
-
}),
|
|
83
|
-
title: "Proxified Asynchronous Data Loader",
|
|
84
|
-
}),
|
|
85
|
-
};
|
|
86
|
-
}
|
|
87
|
-
static resolveAsyncLoaders() {
|
|
88
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
89
|
-
var _a;
|
|
90
|
-
do {
|
|
91
|
-
(_a = TestTree.asyncLoaderResolvers.shift()) === null || _a === void 0 ? void 0 : _a();
|
|
92
|
-
yield new Promise((r) => {
|
|
93
|
-
setTimeout(r);
|
|
94
|
-
});
|
|
95
|
-
} while (TestTree.asyncLoaderResolvers.length);
|
|
96
|
-
});
|
|
97
|
-
}
|
|
98
|
-
resolveAsyncVisibleItems() {
|
|
99
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
100
|
-
this.instance.getItems();
|
|
101
|
-
yield TestTree.resolveAsyncLoaders();
|
|
102
|
-
this.instance.getItems().forEach((i) => i.getItemName());
|
|
103
|
-
yield TestTree.resolveAsyncLoaders();
|
|
104
|
-
});
|
|
105
|
-
}
|
|
106
|
-
static default(config) {
|
|
107
|
-
return new TestTree(Object.assign({ rootItemId: "x", createLoadingItemData: () => "loading", dataLoader: {
|
|
108
|
-
getItem: (id) => id,
|
|
109
|
-
getChildren: (id) => [`${id}1`, `${id}2`, `${id}3`, `${id}4`],
|
|
110
|
-
}, getItemName: (item) => item.getItemData(), indent: 20, isItemFolder: (item) => item.getItemMeta().level < 2, initialState: {
|
|
111
|
-
expandedItems: ["x1", "x11"],
|
|
112
|
-
}, features: [] }, config));
|
|
113
|
-
}
|
|
114
|
-
with(config) {
|
|
115
|
-
return new TestTree(Object.assign(Object.assign({}, this.config), config));
|
|
116
|
-
}
|
|
117
|
-
resetBeforeEach() {
|
|
118
|
-
(0, vitest_1.beforeEach)(() => __awaiter(this, void 0, void 0, function* () {
|
|
119
|
-
yield this.createTestCaseTree();
|
|
120
|
-
}));
|
|
121
|
-
}
|
|
122
|
-
createTestCaseTree() {
|
|
123
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
124
|
-
this.reset();
|
|
125
|
-
vitest_1.vi.clearAllMocks();
|
|
126
|
-
// trigger instance creation
|
|
127
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-expressions
|
|
128
|
-
this.instance;
|
|
129
|
-
yield this.resolveAsyncVisibleItems();
|
|
130
|
-
return this;
|
|
131
|
-
});
|
|
132
|
-
}
|
|
133
|
-
withFeatures(...features) {
|
|
134
|
-
var _a;
|
|
135
|
-
return this.with({
|
|
136
|
-
features: [...((_a = this.config.features) !== null && _a !== void 0 ? _a : []), ...features],
|
|
137
|
-
});
|
|
138
|
-
}
|
|
139
|
-
mockedHandler(handlerName) {
|
|
140
|
-
var _a;
|
|
141
|
-
const mock = vitest_1.vi.fn();
|
|
142
|
-
if (this.treeInstance) {
|
|
143
|
-
(_a = this.treeInstance) === null || _a === void 0 ? void 0 : _a.setConfig((prev) => (Object.assign(Object.assign({}, prev), { [handlerName]: mock })));
|
|
144
|
-
}
|
|
145
|
-
else {
|
|
146
|
-
this.config[handlerName] = mock;
|
|
147
|
-
}
|
|
148
|
-
return mock;
|
|
149
|
-
}
|
|
150
|
-
item(itemId) {
|
|
151
|
-
return this.instance.getItemInstance(itemId);
|
|
152
|
-
}
|
|
153
|
-
reset() {
|
|
154
|
-
this.treeInstance = null;
|
|
155
|
-
TestTree.asyncLoaderResolvers = [];
|
|
156
|
-
}
|
|
157
|
-
debug() {
|
|
158
|
-
console.log(this.instance
|
|
159
|
-
.getItems()
|
|
160
|
-
.map((item) => [
|
|
161
|
-
" ".repeat(item.getItemMeta().level),
|
|
162
|
-
'"',
|
|
163
|
-
item.getItemName(),
|
|
164
|
-
'"',
|
|
165
|
-
].join(""))
|
|
166
|
-
.join("\n"));
|
|
167
|
-
}
|
|
168
|
-
setElementBoundingBox(itemId, bb = {
|
|
169
|
-
left: 0,
|
|
170
|
-
width: 100,
|
|
171
|
-
top: 0,
|
|
172
|
-
height: 20,
|
|
173
|
-
}) {
|
|
174
|
-
this.instance.registerElement({
|
|
175
|
-
getBoundingClientRect: () => ({
|
|
176
|
-
left: 0,
|
|
177
|
-
width: 100,
|
|
178
|
-
top: 0,
|
|
179
|
-
height: 10000,
|
|
180
|
-
}),
|
|
181
|
-
});
|
|
182
|
-
this.instance.getItemInstance(itemId).registerElement({
|
|
183
|
-
getBoundingClientRect: () => bb,
|
|
184
|
-
});
|
|
185
|
-
}
|
|
186
|
-
static dragEvent(clientX = 1000, clientY = 0) {
|
|
187
|
-
return {
|
|
188
|
-
preventDefault: vitest_1.vi.fn(),
|
|
189
|
-
stopPropagation: vitest_1.vi.fn(),
|
|
190
|
-
dataTransfer: {
|
|
191
|
-
setData: vitest_1.vi.fn(),
|
|
192
|
-
getData: vitest_1.vi.fn(),
|
|
193
|
-
dropEffect: "unchaged-from-test",
|
|
194
|
-
},
|
|
195
|
-
clientX,
|
|
196
|
-
clientY,
|
|
197
|
-
};
|
|
198
|
-
}
|
|
199
|
-
createTopDragEvent(indent = 0) {
|
|
200
|
-
return TestTree.dragEvent(indent * 20, 1);
|
|
201
|
-
}
|
|
202
|
-
createBottomDragEvent(indent = 0) {
|
|
203
|
-
return TestTree.dragEvent(indent * 20, 19);
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
exports.TestTree = TestTree;
|
|
207
|
-
TestTree.asyncLoaderResolvers = [];
|
package/lib/cjs/types/core.d.ts
DELETED
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
import { DragAndDropFeatureDef } from "../features/drag-and-drop/types";
|
|
2
|
-
import { MainFeatureDef } from "../features/main/types";
|
|
3
|
-
import { SelectionFeatureDef } from "../features/selection/types";
|
|
4
|
-
import { TreeFeatureDef } from "../features/tree/types";
|
|
5
|
-
import { HotkeyConfig, HotkeysCoreFeatureDef } from "../features/hotkeys-core/types";
|
|
6
|
-
import { SyncDataLoaderFeatureDef } from "../features/sync-data-loader/types";
|
|
7
|
-
import { AsyncDataLoaderFeatureDef } from "../features/async-data-loader/types";
|
|
8
|
-
import { SearchFeatureDef } from "../features/search/types";
|
|
9
|
-
import { RenamingFeatureDef } from "../features/renaming/types";
|
|
10
|
-
import { ExpandAllFeatureDef } from "../features/expand-all/types";
|
|
11
|
-
import { PropMemoizationFeatureDef } from "../features/prop-memoization/types";
|
|
12
|
-
import { KeyboardDragAndDropFeatureDef } from "../features/keyboard-drag-and-drop/types";
|
|
13
|
-
import { CheckboxesFeatureDef } from "../features/checkboxes/types";
|
|
14
|
-
export type Updater<T> = T | ((old: T) => T);
|
|
15
|
-
export type SetStateFn<T> = (updaterOrValue: Updater<T>) => void;
|
|
16
|
-
export type FeatureDef = {
|
|
17
|
-
state: any;
|
|
18
|
-
config: any;
|
|
19
|
-
treeInstance: any;
|
|
20
|
-
itemInstance: any;
|
|
21
|
-
hotkeys: string;
|
|
22
|
-
};
|
|
23
|
-
export type EmptyFeatureDef = {
|
|
24
|
-
state: {};
|
|
25
|
-
config: {};
|
|
26
|
-
treeInstance: {};
|
|
27
|
-
itemInstance: {};
|
|
28
|
-
hotkeys: never;
|
|
29
|
-
};
|
|
30
|
-
type UnionToIntersection<T> = (T extends any ? (x: T) => any : never) extends (x: infer R) => any ? R : never;
|
|
31
|
-
type MergedFeatures<F extends FeatureDef> = {
|
|
32
|
-
state: UnionToIntersection<F["state"]>;
|
|
33
|
-
config: UnionToIntersection<F["config"]>;
|
|
34
|
-
treeInstance: UnionToIntersection<F["treeInstance"]>;
|
|
35
|
-
itemInstance: UnionToIntersection<F["itemInstance"]>;
|
|
36
|
-
hotkeys: F["hotkeys"];
|
|
37
|
-
};
|
|
38
|
-
export type RegisteredFeatures<T> = MainFeatureDef<T> | TreeFeatureDef<T> | SelectionFeatureDef<T> | CheckboxesFeatureDef<T> | DragAndDropFeatureDef<T> | KeyboardDragAndDropFeatureDef<T> | HotkeysCoreFeatureDef<T> | SyncDataLoaderFeatureDef<T> | AsyncDataLoaderFeatureDef<T> | SearchFeatureDef<T> | RenamingFeatureDef<T> | ExpandAllFeatureDef | PropMemoizationFeatureDef;
|
|
39
|
-
type TreeStateType<T> = MergedFeatures<RegisteredFeatures<T>>["state"];
|
|
40
|
-
export interface TreeState<T> extends TreeStateType<T> {
|
|
41
|
-
}
|
|
42
|
-
type TreeConfigType<T> = MergedFeatures<RegisteredFeatures<T>>["config"];
|
|
43
|
-
export interface TreeConfig<T> extends TreeConfigType<T> {
|
|
44
|
-
}
|
|
45
|
-
type TreeInstanceType<T> = MergedFeatures<RegisteredFeatures<T>>["treeInstance"];
|
|
46
|
-
export interface TreeInstance<T> extends TreeInstanceType<T> {
|
|
47
|
-
}
|
|
48
|
-
type ItemInstanceType<T> = MergedFeatures<RegisteredFeatures<T>>["itemInstance"];
|
|
49
|
-
export interface ItemInstance<T> extends ItemInstanceType<T> {
|
|
50
|
-
}
|
|
51
|
-
export type HotkeyName = MergedFeatures<RegisteredFeatures<any>>["hotkeys"];
|
|
52
|
-
export type HotkeysConfig<T> = Record<HotkeyName, HotkeyConfig<T>>;
|
|
53
|
-
export type CustomHotkeysConfig<T> = Partial<Record<HotkeyName | `custom${string}`, Partial<HotkeyConfig<T>>>>;
|
|
54
|
-
type MayReturnNull<T extends (...x: any[]) => any> = (...args: Parameters<T>) => ReturnType<T> | null;
|
|
55
|
-
export type ItemInstanceOpts<Key extends keyof ItemInstance<any>> = {
|
|
56
|
-
item: ItemInstance<any>;
|
|
57
|
-
tree: TreeInstance<any>;
|
|
58
|
-
itemId: string;
|
|
59
|
-
prev?: MayReturnNull<ItemInstance<any>[Key]>;
|
|
60
|
-
};
|
|
61
|
-
export type TreeInstanceOpts<Key extends keyof TreeInstance<any>> = {
|
|
62
|
-
tree: TreeInstance<any>;
|
|
63
|
-
prev?: MayReturnNull<TreeInstance<any>[Key]>;
|
|
64
|
-
};
|
|
65
|
-
export type FeatureImplementation<T = any> = {
|
|
66
|
-
key?: string;
|
|
67
|
-
deps?: string[];
|
|
68
|
-
overwrites?: string[];
|
|
69
|
-
stateHandlerNames?: Partial<Record<keyof TreeState<T>, keyof TreeConfig<T>>>;
|
|
70
|
-
getInitialState?: (initialState: Partial<TreeState<T>>, tree: TreeInstance<T>) => Partial<TreeState<T>>;
|
|
71
|
-
getDefaultConfig?: (defaultConfig: Partial<TreeConfig<T>>, tree: TreeInstance<T>) => Partial<TreeConfig<T>>;
|
|
72
|
-
treeInstance?: {
|
|
73
|
-
[key in keyof TreeInstance<T>]?: (opts: TreeInstanceOpts<key>, ...args: Parameters<TreeInstance<T>[key]>) => void;
|
|
74
|
-
};
|
|
75
|
-
itemInstance?: {
|
|
76
|
-
[key in keyof ItemInstance<T>]?: (opts: ItemInstanceOpts<key>, ...args: Parameters<ItemInstance<T>[key]>) => void;
|
|
77
|
-
};
|
|
78
|
-
onTreeMount?: (instance: TreeInstance<T>, treeElement: HTMLElement) => void;
|
|
79
|
-
onTreeUnmount?: (instance: TreeInstance<T>, treeElement: HTMLElement) => void;
|
|
80
|
-
onItemMount?: (instance: ItemInstance<T>, itemElement: HTMLElement, tree: TreeInstance<T>) => void;
|
|
81
|
-
onItemUnmount?: (instance: ItemInstance<T>, itemElement: HTMLElement, tree: TreeInstance<T>) => void;
|
|
82
|
-
hotkeys?: Partial<HotkeysConfig<T>>;
|
|
83
|
-
};
|
|
84
|
-
export {};
|
package/lib/cjs/types/core.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
type TAllKeys<T> = T extends any ? keyof T : never;
|
|
2
|
-
type TIndexValue<T, K extends PropertyKey, D = never> = T extends any ? K extends keyof T ? T[K] : D : never;
|
|
3
|
-
type TPartialKeys<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>> extends infer O ? {
|
|
4
|
-
[P in keyof O]: O[P];
|
|
5
|
-
} : never;
|
|
6
|
-
type TFunction = (...a: any[]) => any;
|
|
7
|
-
type TPrimitives = string | number | boolean | bigint | symbol | Date | TFunction;
|
|
8
|
-
export type TMerged<T> = [T] extends [Array<any>] ? {
|
|
9
|
-
[K in keyof T]: TMerged<T[K]>;
|
|
10
|
-
} : [T] extends [TPrimitives] ? T : [T] extends [object] ? TPartialKeys<{
|
|
11
|
-
[K in TAllKeys<T>]: TMerged<TIndexValue<T, K>>;
|
|
12
|
-
}, never> : T;
|
|
13
|
-
export {};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import { ItemInstance } from "../types/core";
|
|
2
|
-
import { DragTarget } from "../features/drag-and-drop/types";
|
|
3
|
-
export declare const createOnDropHandler: <T>(onChangeChildren: (item: ItemInstance<T>, newChildren: string[]) => void) => (items: ItemInstance<T>[], target: DragTarget<T>) => Promise<void>;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.createOnDropHandler = void 0;
|
|
13
|
-
const remove_items_from_parents_1 = require("./remove-items-from-parents");
|
|
14
|
-
const insert_items_at_target_1 = require("./insert-items-at-target");
|
|
15
|
-
const createOnDropHandler = (onChangeChildren) => (items, target) => __awaiter(void 0, void 0, void 0, function* () {
|
|
16
|
-
const itemIds = items.map((item) => item.getId());
|
|
17
|
-
yield (0, remove_items_from_parents_1.removeItemsFromParents)(items, onChangeChildren);
|
|
18
|
-
yield (0, insert_items_at_target_1.insertItemsAtTarget)(itemIds, target, onChangeChildren);
|
|
19
|
-
});
|
|
20
|
-
exports.createOnDropHandler = createOnDropHandler;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.logWarning = exports.throwError = void 0;
|
|
4
|
-
const prefix = "Headless Tree: ";
|
|
5
|
-
const throwError = (message) => Error(prefix + message);
|
|
6
|
-
exports.throwError = throwError;
|
|
7
|
-
// eslint-disable-next-line no-console
|
|
8
|
-
const logWarning = (message) => console.warn(prefix + message);
|
|
9
|
-
exports.logWarning = logWarning;
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import { ItemInstance } from "../types/core";
|
|
2
|
-
import { DragTarget } from "../features/drag-and-drop/types";
|
|
3
|
-
export declare const insertItemsAtTarget: <T>(itemIds: string[], target: DragTarget<T>, onChangeChildren: (item: ItemInstance<T>, newChildrenIds: string[]) => Promise<void> | void) => Promise<void>;
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.insertItemsAtTarget = void 0;
|
|
13
|
-
const insertItemsAtTarget = (itemIds, target, onChangeChildren) => __awaiter(void 0, void 0, void 0, function* () {
|
|
14
|
-
yield target.item.getTree().waitForItemChildrenLoaded(target.item.getId());
|
|
15
|
-
const oldChildrenIds = target.item
|
|
16
|
-
.getTree()
|
|
17
|
-
.retrieveChildrenIds(target.item.getId());
|
|
18
|
-
// add moved items to new common parent, if dropped onto parent
|
|
19
|
-
if (!("childIndex" in target)) {
|
|
20
|
-
const newChildren = [...oldChildrenIds, ...itemIds];
|
|
21
|
-
yield onChangeChildren(target.item, newChildren);
|
|
22
|
-
if (target.item && "updateCachedChildrenIds" in target.item) {
|
|
23
|
-
target.item.updateCachedChildrenIds(newChildren);
|
|
24
|
-
}
|
|
25
|
-
target.item.getTree().rebuildTree();
|
|
26
|
-
return;
|
|
27
|
-
}
|
|
28
|
-
// add moved items to new common parent, if dropped between siblings
|
|
29
|
-
const newChildren = [
|
|
30
|
-
...oldChildrenIds.slice(0, target.insertionIndex),
|
|
31
|
-
...itemIds,
|
|
32
|
-
...oldChildrenIds.slice(target.insertionIndex),
|
|
33
|
-
];
|
|
34
|
-
yield onChangeChildren(target.item, newChildren);
|
|
35
|
-
if (target.item && "updateCachedChildrenIds" in target.item) {
|
|
36
|
-
target.item.updateCachedChildrenIds(newChildren);
|
|
37
|
-
}
|
|
38
|
-
target.item.getTree().rebuildTree();
|
|
39
|
-
});
|
|
40
|
-
exports.insertItemsAtTarget = insertItemsAtTarget;
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.removeItemsFromParents = void 0;
|
|
13
|
-
const removeItemsFromParents = (movedItems, onChangeChildren) => __awaiter(void 0, void 0, void 0, function* () {
|
|
14
|
-
const movedItemsIds = movedItems.map((item) => item.getId());
|
|
15
|
-
const uniqueParents = [
|
|
16
|
-
...new Set(movedItems.map((item) => item.getParent())),
|
|
17
|
-
];
|
|
18
|
-
for (const parent of uniqueParents) {
|
|
19
|
-
const siblings = parent === null || parent === void 0 ? void 0 : parent.getChildren();
|
|
20
|
-
if (siblings && parent) {
|
|
21
|
-
const newChildren = siblings
|
|
22
|
-
.filter((sibling) => !movedItemsIds.includes(sibling.getId()))
|
|
23
|
-
.map((i) => i.getId());
|
|
24
|
-
yield onChangeChildren(parent, newChildren);
|
|
25
|
-
if (parent && "updateCachedChildrenIds" in parent) {
|
|
26
|
-
parent === null || parent === void 0 ? void 0 : parent.updateCachedChildrenIds(newChildren);
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
movedItems[0].getTree().rebuildTree();
|
|
31
|
-
});
|
|
32
|
-
exports.removeItemsFromParents = removeItemsFromParents;
|
package/lib/cjs/utils.d.ts
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { SetStateFn, TreeState, Updater } from "./types/core";
|
|
2
|
-
export type NoInfer<T> = [T][T extends any ? 0 : never];
|
|
3
|
-
export declare const memo: <D extends readonly any[], P extends readonly any[], R>(deps: (...args: [...P]) => [...D], fn: (...args: [...D]) => R) => (...a: P) => R;
|
|
4
|
-
export declare function functionalUpdate<T>(updater: Updater<T>, input: T): T;
|
|
5
|
-
export declare function makeStateUpdater<K extends keyof TreeState<any>>(key: K, instance: unknown): SetStateFn<TreeState<any>[K]>;
|
|
6
|
-
export declare const poll: (fn: () => boolean, interval?: number, timeout?: number) => Promise<void>;
|
package/lib/cjs/utils.js
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.poll = exports.memo = void 0;
|
|
4
|
-
exports.functionalUpdate = functionalUpdate;
|
|
5
|
-
exports.makeStateUpdater = makeStateUpdater;
|
|
6
|
-
const memo = (deps, fn) => {
|
|
7
|
-
let value;
|
|
8
|
-
let oldDeps = null;
|
|
9
|
-
return (...a) => {
|
|
10
|
-
const newDeps = deps(...a);
|
|
11
|
-
if (!value) {
|
|
12
|
-
value = fn(...newDeps);
|
|
13
|
-
oldDeps = newDeps;
|
|
14
|
-
return value;
|
|
15
|
-
}
|
|
16
|
-
const match = oldDeps &&
|
|
17
|
-
oldDeps.length === newDeps.length &&
|
|
18
|
-
!oldDeps.some((dep, i) => dep !== newDeps[i]);
|
|
19
|
-
if (match) {
|
|
20
|
-
return value;
|
|
21
|
-
}
|
|
22
|
-
value = fn(...newDeps);
|
|
23
|
-
oldDeps = newDeps;
|
|
24
|
-
return value;
|
|
25
|
-
};
|
|
26
|
-
};
|
|
27
|
-
exports.memo = memo;
|
|
28
|
-
function functionalUpdate(updater, input) {
|
|
29
|
-
return typeof updater === "function"
|
|
30
|
-
? updater(input)
|
|
31
|
-
: updater;
|
|
32
|
-
}
|
|
33
|
-
function makeStateUpdater(key, instance) {
|
|
34
|
-
return (updater) => {
|
|
35
|
-
instance.setState((old) => {
|
|
36
|
-
return Object.assign(Object.assign({}, old), { [key]: functionalUpdate(updater, old[key]) });
|
|
37
|
-
});
|
|
38
|
-
};
|
|
39
|
-
}
|
|
40
|
-
const poll = (fn, interval = 100, timeout = 1000) => new Promise((resolve) => {
|
|
41
|
-
let clear;
|
|
42
|
-
const i = setInterval(() => {
|
|
43
|
-
if (fn()) {
|
|
44
|
-
resolve();
|
|
45
|
-
clearInterval(i);
|
|
46
|
-
clearTimeout(clear);
|
|
47
|
-
}
|
|
48
|
-
}, interval);
|
|
49
|
-
clear = setTimeout(() => {
|
|
50
|
-
clearInterval(i);
|
|
51
|
-
}, timeout);
|
|
52
|
-
});
|
|
53
|
-
exports.poll = poll;
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import { throwError } from "../utilities/errors";
|
|
2
|
-
const noop = () => { };
|
|
3
|
-
const findPrevInstanceMethod = (features, instanceType, methodKey, featureSearchIndex) => {
|
|
4
|
-
var _a;
|
|
5
|
-
for (let i = featureSearchIndex; i >= 0; i--) {
|
|
6
|
-
const feature = features[i];
|
|
7
|
-
const itemInstanceMethod = (_a = feature[instanceType]) === null || _a === void 0 ? void 0 : _a[methodKey];
|
|
8
|
-
if (itemInstanceMethod) {
|
|
9
|
-
return i;
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
return null;
|
|
13
|
-
};
|
|
14
|
-
const invokeInstanceMethod = (features, instanceType, opts, methodKey, featureIndex, args) => {
|
|
15
|
-
var _a;
|
|
16
|
-
const prevIndex = findPrevInstanceMethod(features, instanceType, methodKey, featureIndex - 1);
|
|
17
|
-
const itemInstanceMethod = (_a = features[featureIndex][instanceType]) === null || _a === void 0 ? void 0 : _a[methodKey];
|
|
18
|
-
return itemInstanceMethod(Object.assign(Object.assign({}, opts), { prev: prevIndex !== null
|
|
19
|
-
? (...newArgs) => invokeInstanceMethod(features, instanceType, opts, methodKey, prevIndex, newArgs)
|
|
20
|
-
: null }), ...args);
|
|
21
|
-
};
|
|
22
|
-
export const buildProxiedInstance = (features, instanceType, buildOpts) => {
|
|
23
|
-
// demo with prototypes: https://jsfiddle.net/bgenc58r/
|
|
24
|
-
const opts = {};
|
|
25
|
-
const item = new Proxy({}, {
|
|
26
|
-
has(target, key) {
|
|
27
|
-
if (typeof key === "symbol") {
|
|
28
|
-
return false;
|
|
29
|
-
}
|
|
30
|
-
if (key === "toJSON") {
|
|
31
|
-
return false;
|
|
32
|
-
}
|
|
33
|
-
const hasInstanceMethod = findPrevInstanceMethod(features, instanceType, key, features.length - 1);
|
|
34
|
-
return Boolean(hasInstanceMethod);
|
|
35
|
-
},
|
|
36
|
-
get(target, key) {
|
|
37
|
-
if (typeof key === "symbol") {
|
|
38
|
-
return undefined;
|
|
39
|
-
}
|
|
40
|
-
if (key === "toJSON") {
|
|
41
|
-
return {};
|
|
42
|
-
}
|
|
43
|
-
return (...args) => {
|
|
44
|
-
const featureIndex = findPrevInstanceMethod(features, instanceType, key, features.length - 1);
|
|
45
|
-
if (featureIndex === null) {
|
|
46
|
-
throw throwError(`feature missing for method ${key}`);
|
|
47
|
-
}
|
|
48
|
-
return invokeInstanceMethod(features, instanceType, opts, key, featureIndex, args);
|
|
49
|
-
};
|
|
50
|
-
},
|
|
51
|
-
});
|
|
52
|
-
Object.assign(opts, buildOpts(item));
|
|
53
|
-
return [item, noop];
|
|
54
|
-
};
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/* eslint-disable no-continue,no-labels,no-extra-label */
|
|
2
|
-
export const buildStaticInstance = (features, instanceType, buildOpts) => {
|
|
3
|
-
const instance = {};
|
|
4
|
-
const finalize = () => {
|
|
5
|
-
const opts = buildOpts(instance);
|
|
6
|
-
featureLoop: for (let i = 0; i < features.length; i++) {
|
|
7
|
-
// Loop goes in forward order, each features overwrite previous ones and wraps those in a prev() fn
|
|
8
|
-
const definition = features[i][instanceType];
|
|
9
|
-
if (!definition)
|
|
10
|
-
continue featureLoop;
|
|
11
|
-
methodLoop: for (const [key, method] of Object.entries(definition)) {
|
|
12
|
-
if (!method)
|
|
13
|
-
continue methodLoop;
|
|
14
|
-
const prev = instance[key];
|
|
15
|
-
instance[key] = (...args) => {
|
|
16
|
-
return method(Object.assign(Object.assign({}, opts), { prev }), ...args);
|
|
17
|
-
};
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
};
|
|
21
|
-
return [instance, finalize];
|
|
22
|
-
};
|