@nocobase/plugin-multi-portal 2.2.0-alpha.10
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/LICENSE.txt +107 -0
- package/README.md +14 -0
- package/client-v2.d.ts +2 -0
- package/client-v2.js +1 -0
- package/client.d.ts +2 -0
- package/client.js +1 -0
- package/dist/client/index.d.ts +9 -0
- package/dist/client/index.js +10 -0
- package/dist/client/locale.d.ts +10 -0
- package/dist/client/models/index.d.ts +11 -0
- package/dist/client/plugin.d.ts +13 -0
- package/dist/client-v2/354.ead3e96143164cd5.js +10 -0
- package/dist/client-v2/499.ef2ff0c022687485.js +10 -0
- package/dist/client-v2/778.23ba409a924ee34a.js +10 -0
- package/dist/client-v2/845.f2b0ce44ae4be707.js +10 -0
- package/dist/client-v2/entryActions/PortalEntryActionModel.d.ts +52 -0
- package/dist/client-v2/entryActions/portalEntryActionStore.d.ts +36 -0
- package/dist/client-v2/entryActions/registerPortalEntryActions.d.ts +10 -0
- package/dist/client-v2/entryActions/types.d.ts +41 -0
- package/dist/client-v2/entryActions/url.d.ts +10 -0
- package/dist/client-v2/index.d.ts +9 -0
- package/dist/client-v2/index.js +10 -0
- package/dist/client-v2/layoutRegistration.d.ts +38 -0
- package/dist/client-v2/locale.d.ts +13 -0
- package/dist/client-v2/models/MultiPortalBlockModel.d.ts +13 -0
- package/dist/client-v2/models/MultiPortalMobilePageModels.d.ts +34 -0
- package/dist/client-v2/pages/MultiPortalsPage.d.ts +80 -0
- package/dist/client-v2/permissions/MultiPortalPermissionsTab.d.ts +21 -0
- package/dist/client-v2/permissions/multiPortalPermissions.d.ts +12 -0
- package/dist/client-v2/plugin.d.ts +13 -0
- package/dist/client-v2/routeRepositoryScope.d.ts +11 -0
- package/dist/client-v2/routeUrl.d.ts +18 -0
- package/dist/externalVersion.js +25 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.js +48 -0
- package/dist/locale/en-US.json +82 -0
- package/dist/locale/zh-CN.json +82 -0
- package/dist/node_modules/tar/dist/commonjs/create.d.ts +3 -0
- package/dist/node_modules/tar/dist/commonjs/create.js +82 -0
- package/dist/node_modules/tar/dist/commonjs/cwd-error.d.ts +8 -0
- package/dist/node_modules/tar/dist/commonjs/cwd-error.js +18 -0
- package/dist/node_modules/tar/dist/commonjs/extract.d.ts +3 -0
- package/dist/node_modules/tar/dist/commonjs/extract.js +88 -0
- package/dist/node_modules/tar/dist/commonjs/get-write-flag.d.ts +2 -0
- package/dist/node_modules/tar/dist/commonjs/get-write-flag.js +32 -0
- package/dist/node_modules/tar/dist/commonjs/header.d.ts +53 -0
- package/dist/node_modules/tar/dist/commonjs/header.js +312 -0
- package/dist/node_modules/tar/dist/commonjs/index.d.ts +20 -0
- package/dist/node_modules/tar/dist/commonjs/index.js +64 -0
- package/dist/node_modules/tar/dist/commonjs/index.min.js +1 -0
- package/dist/node_modules/tar/dist/commonjs/large-numbers.d.ts +3 -0
- package/dist/node_modules/tar/dist/commonjs/large-numbers.js +99 -0
- package/dist/node_modules/tar/dist/commonjs/list.d.ts +7 -0
- package/dist/node_modules/tar/dist/commonjs/list.js +145 -0
- package/dist/node_modules/tar/dist/commonjs/make-command.d.ts +49 -0
- package/dist/node_modules/tar/dist/commonjs/make-command.js +52 -0
- package/dist/node_modules/tar/dist/commonjs/mkdir.d.ts +25 -0
- package/dist/node_modules/tar/dist/commonjs/mkdir.js +187 -0
- package/dist/node_modules/tar/dist/commonjs/mode-fix.d.ts +2 -0
- package/dist/node_modules/tar/dist/commonjs/mode-fix.js +29 -0
- package/dist/node_modules/tar/dist/commonjs/normalize-unicode.d.ts +2 -0
- package/dist/node_modules/tar/dist/commonjs/normalize-unicode.js +38 -0
- package/dist/node_modules/tar/dist/commonjs/normalize-windows-path.d.ts +2 -0
- package/dist/node_modules/tar/dist/commonjs/normalize-windows-path.js +12 -0
- package/dist/node_modules/tar/dist/commonjs/options.d.ts +596 -0
- package/dist/node_modules/tar/dist/commonjs/options.js +66 -0
- package/dist/node_modules/tar/dist/commonjs/pack.d.ts +105 -0
- package/dist/node_modules/tar/dist/commonjs/pack.js +545 -0
- package/dist/node_modules/tar/dist/commonjs/package.json +3 -0
- package/dist/node_modules/tar/dist/commonjs/parse.d.ts +85 -0
- package/dist/node_modules/tar/dist/commonjs/parse.js +610 -0
- package/dist/node_modules/tar/dist/commonjs/path-reservations.d.ts +11 -0
- package/dist/node_modules/tar/dist/commonjs/path-reservations.js +170 -0
- package/dist/node_modules/tar/dist/commonjs/pax.d.ts +26 -0
- package/dist/node_modules/tar/dist/commonjs/pax.js +158 -0
- package/dist/node_modules/tar/dist/commonjs/process-umask.d.ts +2 -0
- package/dist/node_modules/tar/dist/commonjs/process-umask.js +7 -0
- package/dist/node_modules/tar/dist/commonjs/read-entry.d.ts +36 -0
- package/dist/node_modules/tar/dist/commonjs/read-entry.js +136 -0
- package/dist/node_modules/tar/dist/commonjs/replace.d.ts +2 -0
- package/dist/node_modules/tar/dist/commonjs/replace.js +227 -0
- package/dist/node_modules/tar/dist/commonjs/strip-absolute-path.d.ts +2 -0
- package/dist/node_modules/tar/dist/commonjs/strip-absolute-path.js +29 -0
- package/dist/node_modules/tar/dist/commonjs/strip-trailing-slashes.d.ts +2 -0
- package/dist/node_modules/tar/dist/commonjs/strip-trailing-slashes.js +18 -0
- package/dist/node_modules/tar/dist/commonjs/symlink-error.d.ts +9 -0
- package/dist/node_modules/tar/dist/commonjs/symlink-error.js +19 -0
- package/dist/node_modules/tar/dist/commonjs/types.d.ts +7 -0
- package/dist/node_modules/tar/dist/commonjs/types.js +50 -0
- package/dist/node_modules/tar/dist/commonjs/unpack.d.ts +101 -0
- package/dist/node_modules/tar/dist/commonjs/unpack.js +932 -0
- package/dist/node_modules/tar/dist/commonjs/update.d.ts +2 -0
- package/dist/node_modules/tar/dist/commonjs/update.js +33 -0
- package/dist/node_modules/tar/dist/commonjs/warn-method.d.ts +24 -0
- package/dist/node_modules/tar/dist/commonjs/warn-method.js +31 -0
- package/dist/node_modules/tar/dist/commonjs/winchars.d.ts +3 -0
- package/dist/node_modules/tar/dist/commonjs/winchars.js +14 -0
- package/dist/node_modules/tar/dist/commonjs/write-entry.d.ts +129 -0
- package/dist/node_modules/tar/dist/commonjs/write-entry.js +698 -0
- package/dist/node_modules/tar/dist/esm/create.d.ts +3 -0
- package/dist/node_modules/tar/dist/esm/create.js +76 -0
- package/dist/node_modules/tar/dist/esm/cwd-error.d.ts +8 -0
- package/dist/node_modules/tar/dist/esm/cwd-error.js +14 -0
- package/dist/node_modules/tar/dist/esm/extract.d.ts +3 -0
- package/dist/node_modules/tar/dist/esm/extract.js +49 -0
- package/dist/node_modules/tar/dist/esm/get-write-flag.d.ts +2 -0
- package/dist/node_modules/tar/dist/esm/get-write-flag.js +26 -0
- package/dist/node_modules/tar/dist/esm/header.d.ts +53 -0
- package/dist/node_modules/tar/dist/esm/header.js +275 -0
- package/dist/node_modules/tar/dist/esm/index.d.ts +20 -0
- package/dist/node_modules/tar/dist/esm/index.js +20 -0
- package/dist/node_modules/tar/dist/esm/index.min.js +4 -0
- package/dist/node_modules/tar/dist/esm/large-numbers.d.ts +3 -0
- package/dist/node_modules/tar/dist/esm/large-numbers.js +94 -0
- package/dist/node_modules/tar/dist/esm/list.d.ts +7 -0
- package/dist/node_modules/tar/dist/esm/list.js +105 -0
- package/dist/node_modules/tar/dist/esm/make-command.d.ts +49 -0
- package/dist/node_modules/tar/dist/esm/make-command.js +48 -0
- package/dist/node_modules/tar/dist/esm/mkdir.d.ts +25 -0
- package/dist/node_modules/tar/dist/esm/mkdir.js +179 -0
- package/dist/node_modules/tar/dist/esm/mode-fix.d.ts +2 -0
- package/dist/node_modules/tar/dist/esm/mode-fix.js +25 -0
- package/dist/node_modules/tar/dist/esm/normalize-unicode.d.ts +2 -0
- package/dist/node_modules/tar/dist/esm/normalize-unicode.js +34 -0
- package/dist/node_modules/tar/dist/esm/normalize-windows-path.d.ts +2 -0
- package/dist/node_modules/tar/dist/esm/normalize-windows-path.js +9 -0
- package/dist/node_modules/tar/dist/esm/options.d.ts +596 -0
- package/dist/node_modules/tar/dist/esm/options.js +54 -0
- package/dist/node_modules/tar/dist/esm/pack.d.ts +105 -0
- package/dist/node_modules/tar/dist/esm/pack.js +503 -0
- package/dist/node_modules/tar/dist/esm/package.json +3 -0
- package/dist/node_modules/tar/dist/esm/parse.d.ts +85 -0
- package/dist/node_modules/tar/dist/esm/parse.js +606 -0
- package/dist/node_modules/tar/dist/esm/path-reservations.d.ts +11 -0
- package/dist/node_modules/tar/dist/esm/path-reservations.js +166 -0
- package/dist/node_modules/tar/dist/esm/pax.d.ts +26 -0
- package/dist/node_modules/tar/dist/esm/pax.js +154 -0
- package/dist/node_modules/tar/dist/esm/process-umask.d.ts +2 -0
- package/dist/node_modules/tar/dist/esm/process-umask.js +3 -0
- package/dist/node_modules/tar/dist/esm/read-entry.d.ts +36 -0
- package/dist/node_modules/tar/dist/esm/read-entry.js +132 -0
- package/dist/node_modules/tar/dist/esm/replace.d.ts +2 -0
- package/dist/node_modules/tar/dist/esm/replace.js +221 -0
- package/dist/node_modules/tar/dist/esm/strip-absolute-path.d.ts +2 -0
- package/dist/node_modules/tar/dist/esm/strip-absolute-path.js +25 -0
- package/dist/node_modules/tar/dist/esm/strip-trailing-slashes.d.ts +2 -0
- package/dist/node_modules/tar/dist/esm/strip-trailing-slashes.js +14 -0
- package/dist/node_modules/tar/dist/esm/symlink-error.d.ts +9 -0
- package/dist/node_modules/tar/dist/esm/symlink-error.js +15 -0
- package/dist/node_modules/tar/dist/esm/types.d.ts +7 -0
- package/dist/node_modules/tar/dist/esm/types.js +45 -0
- package/dist/node_modules/tar/dist/esm/unpack.d.ts +101 -0
- package/dist/node_modules/tar/dist/esm/unpack.js +891 -0
- package/dist/node_modules/tar/dist/esm/update.d.ts +2 -0
- package/dist/node_modules/tar/dist/esm/update.js +30 -0
- package/dist/node_modules/tar/dist/esm/warn-method.d.ts +24 -0
- package/dist/node_modules/tar/dist/esm/warn-method.js +27 -0
- package/dist/node_modules/tar/dist/esm/winchars.d.ts +3 -0
- package/dist/node_modules/tar/dist/esm/winchars.js +9 -0
- package/dist/node_modules/tar/dist/esm/write-entry.d.ts +129 -0
- package/dist/node_modules/tar/dist/esm/write-entry.js +656 -0
- package/dist/node_modules/tar/node_modules/chownr/dist/commonjs/index.d.ts +3 -0
- package/dist/node_modules/tar/node_modules/chownr/dist/commonjs/index.js +93 -0
- package/dist/node_modules/tar/node_modules/chownr/dist/commonjs/package.json +3 -0
- package/dist/node_modules/tar/node_modules/chownr/dist/esm/index.d.ts +3 -0
- package/dist/node_modules/tar/node_modules/chownr/dist/esm/index.js +85 -0
- package/dist/node_modules/tar/node_modules/chownr/dist/esm/package.json +3 -0
- package/dist/node_modules/tar/node_modules/chownr/package.json +69 -0
- package/dist/node_modules/tar/node_modules/minipass/dist/commonjs/index.d.ts +549 -0
- package/dist/node_modules/tar/node_modules/minipass/dist/commonjs/index.js +1028 -0
- package/dist/node_modules/tar/node_modules/minipass/dist/commonjs/package.json +3 -0
- package/dist/node_modules/tar/node_modules/minipass/dist/esm/index.d.ts +549 -0
- package/dist/node_modules/tar/node_modules/minipass/dist/esm/index.js +1018 -0
- package/dist/node_modules/tar/node_modules/minipass/dist/esm/package.json +3 -0
- package/dist/node_modules/tar/node_modules/minipass/package.json +82 -0
- package/dist/node_modules/tar/node_modules/minizlib/dist/commonjs/constants.d.ts +2 -0
- package/dist/node_modules/tar/node_modules/minizlib/dist/commonjs/constants.js +123 -0
- package/dist/node_modules/tar/node_modules/minizlib/dist/commonjs/index.d.ts +99 -0
- package/dist/node_modules/tar/node_modules/minizlib/dist/commonjs/index.js +416 -0
- package/dist/node_modules/tar/node_modules/minizlib/dist/commonjs/package.json +3 -0
- package/dist/node_modules/tar/node_modules/minizlib/dist/esm/constants.d.ts +2 -0
- package/dist/node_modules/tar/node_modules/minizlib/dist/esm/constants.js +117 -0
- package/dist/node_modules/tar/node_modules/minizlib/dist/esm/index.d.ts +99 -0
- package/dist/node_modules/tar/node_modules/minizlib/dist/esm/index.js +363 -0
- package/dist/node_modules/tar/node_modules/minizlib/dist/esm/package.json +3 -0
- package/dist/node_modules/tar/node_modules/minizlib/package.json +80 -0
- package/dist/node_modules/tar/node_modules/yallist/dist/commonjs/index.d.ts +39 -0
- package/dist/node_modules/tar/node_modules/yallist/dist/commonjs/index.js +384 -0
- package/dist/node_modules/tar/node_modules/yallist/dist/commonjs/package.json +3 -0
- package/dist/node_modules/tar/node_modules/yallist/dist/esm/index.d.ts +39 -0
- package/dist/node_modules/tar/node_modules/yallist/dist/esm/index.js +379 -0
- package/dist/node_modules/tar/node_modules/yallist/dist/esm/package.json +3 -0
- package/dist/node_modules/tar/node_modules/yallist/package.json +68 -0
- package/dist/node_modules/tar/package.json +1 -0
- package/dist/server/collections/desktopRoutes.d.ts +14 -0
- package/dist/server/collections/desktopRoutes.js +48 -0
- package/dist/server/collections/extendRoleField.d.ts +14 -0
- package/dist/server/collections/extendRoleField.js +51 -0
- package/dist/server/collections/multiPortals.d.ts +10 -0
- package/dist/server/collections/multiPortals.js +128 -0
- package/dist/server/collections/rolesMultiPortalDesktopRoutes.d.ts +10 -0
- package/dist/server/collections/rolesMultiPortalDesktopRoutes.js +76 -0
- package/dist/server/collections/rolesMultiPortalRoutePolicies.d.ts +10 -0
- package/dist/server/collections/rolesMultiPortalRoutePolicies.js +73 -0
- package/dist/server/collections/rolesMultiPortals.d.ts +10 -0
- package/dist/server/collections/rolesMultiPortals.js +68 -0
- package/dist/server/ensureDefaultRoleMultiPortalAccess.d.ts +11 -0
- package/dist/server/ensureDefaultRoleMultiPortalAccess.js +70 -0
- package/dist/server/index.d.ts +9 -0
- package/dist/server/index.js +42 -0
- package/dist/server/migrations/20260723105200-drop-ui-layout-foreign-key-constraint.d.ts +13 -0
- package/dist/server/migrations/20260723105200-drop-ui-layout-foreign-key-constraint.js +104 -0
- package/dist/server/plugin.d.ts +63 -0
- package/dist/server/plugin.js +2130 -0
- package/package.json +34 -0
- package/server.d.ts +2 -0
- package/server.js +1 -0
|
@@ -0,0 +1,384 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Node = exports.Yallist = void 0;
|
|
4
|
+
class Yallist {
|
|
5
|
+
tail;
|
|
6
|
+
head;
|
|
7
|
+
length = 0;
|
|
8
|
+
static create(list = []) {
|
|
9
|
+
return new Yallist(list);
|
|
10
|
+
}
|
|
11
|
+
constructor(list = []) {
|
|
12
|
+
for (const item of list) {
|
|
13
|
+
this.push(item);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
*[Symbol.iterator]() {
|
|
17
|
+
for (let walker = this.head; walker; walker = walker.next) {
|
|
18
|
+
yield walker.value;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
removeNode(node) {
|
|
22
|
+
if (node.list !== this) {
|
|
23
|
+
throw new Error('removing node which does not belong to this list');
|
|
24
|
+
}
|
|
25
|
+
const next = node.next;
|
|
26
|
+
const prev = node.prev;
|
|
27
|
+
if (next) {
|
|
28
|
+
next.prev = prev;
|
|
29
|
+
}
|
|
30
|
+
if (prev) {
|
|
31
|
+
prev.next = next;
|
|
32
|
+
}
|
|
33
|
+
if (node === this.head) {
|
|
34
|
+
this.head = next;
|
|
35
|
+
}
|
|
36
|
+
if (node === this.tail) {
|
|
37
|
+
this.tail = prev;
|
|
38
|
+
}
|
|
39
|
+
this.length--;
|
|
40
|
+
node.next = undefined;
|
|
41
|
+
node.prev = undefined;
|
|
42
|
+
node.list = undefined;
|
|
43
|
+
return next;
|
|
44
|
+
}
|
|
45
|
+
unshiftNode(node) {
|
|
46
|
+
if (node === this.head) {
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
if (node.list) {
|
|
50
|
+
node.list.removeNode(node);
|
|
51
|
+
}
|
|
52
|
+
const head = this.head;
|
|
53
|
+
node.list = this;
|
|
54
|
+
node.next = head;
|
|
55
|
+
if (head) {
|
|
56
|
+
head.prev = node;
|
|
57
|
+
}
|
|
58
|
+
this.head = node;
|
|
59
|
+
if (!this.tail) {
|
|
60
|
+
this.tail = node;
|
|
61
|
+
}
|
|
62
|
+
this.length++;
|
|
63
|
+
}
|
|
64
|
+
pushNode(node) {
|
|
65
|
+
if (node === this.tail) {
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
if (node.list) {
|
|
69
|
+
node.list.removeNode(node);
|
|
70
|
+
}
|
|
71
|
+
const tail = this.tail;
|
|
72
|
+
node.list = this;
|
|
73
|
+
node.prev = tail;
|
|
74
|
+
if (tail) {
|
|
75
|
+
tail.next = node;
|
|
76
|
+
}
|
|
77
|
+
this.tail = node;
|
|
78
|
+
if (!this.head) {
|
|
79
|
+
this.head = node;
|
|
80
|
+
}
|
|
81
|
+
this.length++;
|
|
82
|
+
}
|
|
83
|
+
push(...args) {
|
|
84
|
+
for (let i = 0, l = args.length; i < l; i++) {
|
|
85
|
+
push(this, args[i]);
|
|
86
|
+
}
|
|
87
|
+
return this.length;
|
|
88
|
+
}
|
|
89
|
+
unshift(...args) {
|
|
90
|
+
for (var i = 0, l = args.length; i < l; i++) {
|
|
91
|
+
unshift(this, args[i]);
|
|
92
|
+
}
|
|
93
|
+
return this.length;
|
|
94
|
+
}
|
|
95
|
+
pop() {
|
|
96
|
+
if (!this.tail) {
|
|
97
|
+
return undefined;
|
|
98
|
+
}
|
|
99
|
+
const res = this.tail.value;
|
|
100
|
+
const t = this.tail;
|
|
101
|
+
this.tail = this.tail.prev;
|
|
102
|
+
if (this.tail) {
|
|
103
|
+
this.tail.next = undefined;
|
|
104
|
+
}
|
|
105
|
+
else {
|
|
106
|
+
this.head = undefined;
|
|
107
|
+
}
|
|
108
|
+
t.list = undefined;
|
|
109
|
+
this.length--;
|
|
110
|
+
return res;
|
|
111
|
+
}
|
|
112
|
+
shift() {
|
|
113
|
+
if (!this.head) {
|
|
114
|
+
return undefined;
|
|
115
|
+
}
|
|
116
|
+
const res = this.head.value;
|
|
117
|
+
const h = this.head;
|
|
118
|
+
this.head = this.head.next;
|
|
119
|
+
if (this.head) {
|
|
120
|
+
this.head.prev = undefined;
|
|
121
|
+
}
|
|
122
|
+
else {
|
|
123
|
+
this.tail = undefined;
|
|
124
|
+
}
|
|
125
|
+
h.list = undefined;
|
|
126
|
+
this.length--;
|
|
127
|
+
return res;
|
|
128
|
+
}
|
|
129
|
+
forEach(fn, thisp) {
|
|
130
|
+
thisp = thisp || this;
|
|
131
|
+
for (let walker = this.head, i = 0; !!walker; i++) {
|
|
132
|
+
fn.call(thisp, walker.value, i, this);
|
|
133
|
+
walker = walker.next;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
forEachReverse(fn, thisp) {
|
|
137
|
+
thisp = thisp || this;
|
|
138
|
+
for (let walker = this.tail, i = this.length - 1; !!walker; i--) {
|
|
139
|
+
fn.call(thisp, walker.value, i, this);
|
|
140
|
+
walker = walker.prev;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
get(n) {
|
|
144
|
+
let i = 0;
|
|
145
|
+
let walker = this.head;
|
|
146
|
+
for (; !!walker && i < n; i++) {
|
|
147
|
+
walker = walker.next;
|
|
148
|
+
}
|
|
149
|
+
if (i === n && !!walker) {
|
|
150
|
+
return walker.value;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
getReverse(n) {
|
|
154
|
+
let i = 0;
|
|
155
|
+
let walker = this.tail;
|
|
156
|
+
for (; !!walker && i < n; i++) {
|
|
157
|
+
// abort out of the list early if we hit a cycle
|
|
158
|
+
walker = walker.prev;
|
|
159
|
+
}
|
|
160
|
+
if (i === n && !!walker) {
|
|
161
|
+
return walker.value;
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
map(fn, thisp) {
|
|
165
|
+
thisp = thisp || this;
|
|
166
|
+
const res = new Yallist();
|
|
167
|
+
for (let walker = this.head; !!walker;) {
|
|
168
|
+
res.push(fn.call(thisp, walker.value, this));
|
|
169
|
+
walker = walker.next;
|
|
170
|
+
}
|
|
171
|
+
return res;
|
|
172
|
+
}
|
|
173
|
+
mapReverse(fn, thisp) {
|
|
174
|
+
thisp = thisp || this;
|
|
175
|
+
var res = new Yallist();
|
|
176
|
+
for (let walker = this.tail; !!walker;) {
|
|
177
|
+
res.push(fn.call(thisp, walker.value, this));
|
|
178
|
+
walker = walker.prev;
|
|
179
|
+
}
|
|
180
|
+
return res;
|
|
181
|
+
}
|
|
182
|
+
reduce(fn, initial) {
|
|
183
|
+
let acc;
|
|
184
|
+
let walker = this.head;
|
|
185
|
+
if (arguments.length > 1) {
|
|
186
|
+
acc = initial;
|
|
187
|
+
}
|
|
188
|
+
else if (this.head) {
|
|
189
|
+
walker = this.head.next;
|
|
190
|
+
acc = this.head.value;
|
|
191
|
+
}
|
|
192
|
+
else {
|
|
193
|
+
throw new TypeError('Reduce of empty list with no initial value');
|
|
194
|
+
}
|
|
195
|
+
for (var i = 0; !!walker; i++) {
|
|
196
|
+
acc = fn(acc, walker.value, i);
|
|
197
|
+
walker = walker.next;
|
|
198
|
+
}
|
|
199
|
+
return acc;
|
|
200
|
+
}
|
|
201
|
+
reduceReverse(fn, initial) {
|
|
202
|
+
let acc;
|
|
203
|
+
let walker = this.tail;
|
|
204
|
+
if (arguments.length > 1) {
|
|
205
|
+
acc = initial;
|
|
206
|
+
}
|
|
207
|
+
else if (this.tail) {
|
|
208
|
+
walker = this.tail.prev;
|
|
209
|
+
acc = this.tail.value;
|
|
210
|
+
}
|
|
211
|
+
else {
|
|
212
|
+
throw new TypeError('Reduce of empty list with no initial value');
|
|
213
|
+
}
|
|
214
|
+
for (let i = this.length - 1; !!walker; i--) {
|
|
215
|
+
acc = fn(acc, walker.value, i);
|
|
216
|
+
walker = walker.prev;
|
|
217
|
+
}
|
|
218
|
+
return acc;
|
|
219
|
+
}
|
|
220
|
+
toArray() {
|
|
221
|
+
const arr = new Array(this.length);
|
|
222
|
+
for (let i = 0, walker = this.head; !!walker; i++) {
|
|
223
|
+
arr[i] = walker.value;
|
|
224
|
+
walker = walker.next;
|
|
225
|
+
}
|
|
226
|
+
return arr;
|
|
227
|
+
}
|
|
228
|
+
toArrayReverse() {
|
|
229
|
+
const arr = new Array(this.length);
|
|
230
|
+
for (let i = 0, walker = this.tail; !!walker; i++) {
|
|
231
|
+
arr[i] = walker.value;
|
|
232
|
+
walker = walker.prev;
|
|
233
|
+
}
|
|
234
|
+
return arr;
|
|
235
|
+
}
|
|
236
|
+
slice(from = 0, to = this.length) {
|
|
237
|
+
if (to < 0) {
|
|
238
|
+
to += this.length;
|
|
239
|
+
}
|
|
240
|
+
if (from < 0) {
|
|
241
|
+
from += this.length;
|
|
242
|
+
}
|
|
243
|
+
const ret = new Yallist();
|
|
244
|
+
if (to < from || to < 0) {
|
|
245
|
+
return ret;
|
|
246
|
+
}
|
|
247
|
+
if (from < 0) {
|
|
248
|
+
from = 0;
|
|
249
|
+
}
|
|
250
|
+
if (to > this.length) {
|
|
251
|
+
to = this.length;
|
|
252
|
+
}
|
|
253
|
+
let walker = this.head;
|
|
254
|
+
let i = 0;
|
|
255
|
+
for (i = 0; !!walker && i < from; i++) {
|
|
256
|
+
walker = walker.next;
|
|
257
|
+
}
|
|
258
|
+
for (; !!walker && i < to; i++, walker = walker.next) {
|
|
259
|
+
ret.push(walker.value);
|
|
260
|
+
}
|
|
261
|
+
return ret;
|
|
262
|
+
}
|
|
263
|
+
sliceReverse(from = 0, to = this.length) {
|
|
264
|
+
if (to < 0) {
|
|
265
|
+
to += this.length;
|
|
266
|
+
}
|
|
267
|
+
if (from < 0) {
|
|
268
|
+
from += this.length;
|
|
269
|
+
}
|
|
270
|
+
const ret = new Yallist();
|
|
271
|
+
if (to < from || to < 0) {
|
|
272
|
+
return ret;
|
|
273
|
+
}
|
|
274
|
+
if (from < 0) {
|
|
275
|
+
from = 0;
|
|
276
|
+
}
|
|
277
|
+
if (to > this.length) {
|
|
278
|
+
to = this.length;
|
|
279
|
+
}
|
|
280
|
+
let i = this.length;
|
|
281
|
+
let walker = this.tail;
|
|
282
|
+
for (; !!walker && i > to; i--) {
|
|
283
|
+
walker = walker.prev;
|
|
284
|
+
}
|
|
285
|
+
for (; !!walker && i > from; i--, walker = walker.prev) {
|
|
286
|
+
ret.push(walker.value);
|
|
287
|
+
}
|
|
288
|
+
return ret;
|
|
289
|
+
}
|
|
290
|
+
splice(start, deleteCount = 0, ...nodes) {
|
|
291
|
+
if (start > this.length) {
|
|
292
|
+
start = this.length - 1;
|
|
293
|
+
}
|
|
294
|
+
if (start < 0) {
|
|
295
|
+
start = this.length + start;
|
|
296
|
+
}
|
|
297
|
+
let walker = this.head;
|
|
298
|
+
for (let i = 0; !!walker && i < start; i++) {
|
|
299
|
+
walker = walker.next;
|
|
300
|
+
}
|
|
301
|
+
const ret = [];
|
|
302
|
+
for (let i = 0; !!walker && i < deleteCount; i++) {
|
|
303
|
+
ret.push(walker.value);
|
|
304
|
+
walker = this.removeNode(walker);
|
|
305
|
+
}
|
|
306
|
+
if (!walker) {
|
|
307
|
+
walker = this.tail;
|
|
308
|
+
}
|
|
309
|
+
else if (walker !== this.tail) {
|
|
310
|
+
walker = walker.prev;
|
|
311
|
+
}
|
|
312
|
+
for (const v of nodes) {
|
|
313
|
+
walker = insertAfter(this, walker, v);
|
|
314
|
+
}
|
|
315
|
+
return ret;
|
|
316
|
+
}
|
|
317
|
+
reverse() {
|
|
318
|
+
const head = this.head;
|
|
319
|
+
const tail = this.tail;
|
|
320
|
+
for (let walker = head; !!walker; walker = walker.prev) {
|
|
321
|
+
const p = walker.prev;
|
|
322
|
+
walker.prev = walker.next;
|
|
323
|
+
walker.next = p;
|
|
324
|
+
}
|
|
325
|
+
this.head = tail;
|
|
326
|
+
this.tail = head;
|
|
327
|
+
return this;
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
exports.Yallist = Yallist;
|
|
331
|
+
// insertAfter undefined means "make the node the new head of list"
|
|
332
|
+
function insertAfter(self, node, value) {
|
|
333
|
+
const prev = node;
|
|
334
|
+
const next = node ? node.next : self.head;
|
|
335
|
+
const inserted = new Node(value, prev, next, self);
|
|
336
|
+
if (inserted.next === undefined) {
|
|
337
|
+
self.tail = inserted;
|
|
338
|
+
}
|
|
339
|
+
if (inserted.prev === undefined) {
|
|
340
|
+
self.head = inserted;
|
|
341
|
+
}
|
|
342
|
+
self.length++;
|
|
343
|
+
return inserted;
|
|
344
|
+
}
|
|
345
|
+
function push(self, item) {
|
|
346
|
+
self.tail = new Node(item, self.tail, undefined, self);
|
|
347
|
+
if (!self.head) {
|
|
348
|
+
self.head = self.tail;
|
|
349
|
+
}
|
|
350
|
+
self.length++;
|
|
351
|
+
}
|
|
352
|
+
function unshift(self, item) {
|
|
353
|
+
self.head = new Node(item, undefined, self.head, self);
|
|
354
|
+
if (!self.tail) {
|
|
355
|
+
self.tail = self.head;
|
|
356
|
+
}
|
|
357
|
+
self.length++;
|
|
358
|
+
}
|
|
359
|
+
class Node {
|
|
360
|
+
list;
|
|
361
|
+
next;
|
|
362
|
+
prev;
|
|
363
|
+
value;
|
|
364
|
+
constructor(value, prev, next, list) {
|
|
365
|
+
this.list = list;
|
|
366
|
+
this.value = value;
|
|
367
|
+
if (prev) {
|
|
368
|
+
prev.next = this;
|
|
369
|
+
this.prev = prev;
|
|
370
|
+
}
|
|
371
|
+
else {
|
|
372
|
+
this.prev = undefined;
|
|
373
|
+
}
|
|
374
|
+
if (next) {
|
|
375
|
+
next.prev = this;
|
|
376
|
+
this.next = next;
|
|
377
|
+
}
|
|
378
|
+
else {
|
|
379
|
+
this.next = undefined;
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
exports.Node = Node;
|
|
384
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
export declare class Yallist<T = unknown> {
|
|
2
|
+
tail?: Node<T>;
|
|
3
|
+
head?: Node<T>;
|
|
4
|
+
length: number;
|
|
5
|
+
static create<T = unknown>(list?: Iterable<T>): Yallist<T>;
|
|
6
|
+
constructor(list?: Iterable<T>);
|
|
7
|
+
[Symbol.iterator](): Generator<T, void, unknown>;
|
|
8
|
+
removeNode(node: Node<T>): Node<T> | undefined;
|
|
9
|
+
unshiftNode(node: Node<T>): void;
|
|
10
|
+
pushNode(node: Node<T>): void;
|
|
11
|
+
push(...args: T[]): number;
|
|
12
|
+
unshift(...args: T[]): number;
|
|
13
|
+
pop(): T | undefined;
|
|
14
|
+
shift(): T | undefined;
|
|
15
|
+
forEach(fn: (value: T, i: number, list: Yallist<T>) => any, thisp?: any): void;
|
|
16
|
+
forEachReverse(fn: (value: T, i: number, list: Yallist<T>) => any, thisp?: any): void;
|
|
17
|
+
get(n: number): T | undefined;
|
|
18
|
+
getReverse(n: number): T | undefined;
|
|
19
|
+
map<R = any>(fn: (value: T, list: Yallist<T>) => R, thisp?: any): Yallist<R>;
|
|
20
|
+
mapReverse<R = any>(fn: (value: T, list: Yallist<T>) => R, thisp?: any): Yallist<R>;
|
|
21
|
+
reduce(fn: (left: T, right: T, i: number) => T): T;
|
|
22
|
+
reduce<R = any>(fn: (acc: R, next: T, i: number) => R, initial: R): R;
|
|
23
|
+
reduceReverse(fn: (left: T, right: T, i: number) => T): T;
|
|
24
|
+
reduceReverse<R = any>(fn: (acc: R, next: T, i: number) => R, initial: R): R;
|
|
25
|
+
toArray(): any[];
|
|
26
|
+
toArrayReverse(): any[];
|
|
27
|
+
slice(from?: number, to?: number): Yallist<unknown>;
|
|
28
|
+
sliceReverse(from?: number, to?: number): Yallist<unknown>;
|
|
29
|
+
splice(start: number, deleteCount?: number, ...nodes: T[]): T[];
|
|
30
|
+
reverse(): this;
|
|
31
|
+
}
|
|
32
|
+
export declare class Node<T = unknown> {
|
|
33
|
+
list?: Yallist<T>;
|
|
34
|
+
next?: Node<T>;
|
|
35
|
+
prev?: Node<T>;
|
|
36
|
+
value: T;
|
|
37
|
+
constructor(value: T, prev?: Node<T> | undefined, next?: Node<T> | undefined, list?: Yallist<T> | undefined);
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=index.d.ts.map
|