@retailcrm/embed-ui-v1-endpoint 0.9.11-alpha.1
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/README.md +3 -0
- package/dist/common/extension.d.ts +11 -0
- package/dist/common/pages.d.ts +3 -0
- package/dist/common/targets.cjs +142 -0
- package/dist/common/targets.d.ts +34 -0
- package/dist/common/targets.js +142 -0
- package/dist/common/widgets.d.ts +7 -0
- package/dist/common.cjs +5 -0
- package/dist/common.d.ts +1 -0
- package/dist/common.js +5 -0
- package/dist/remote/endpoint.d.ts +14 -0
- package/dist/remote/pages.cjs +47 -0
- package/dist/remote/pages.d.ts +17 -0
- package/dist/remote/pages.js +47 -0
- package/dist/remote/widgets.cjs +47 -0
- package/dist/remote/widgets.d.ts +21 -0
- package/dist/remote/widgets.js +47 -0
- package/dist/remote/worker.d.ts +4 -0
- package/dist/remote.cjs +2900 -0
- package/dist/remote.d.ts +6 -0
- package/dist/remote.js +2900 -0
- package/package.json +106 -0
package/dist/remote.cjs
ADDED
|
@@ -0,0 +1,2900 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const remote_pages = require("./remote/pages.cjs");
|
|
4
|
+
const remote_widgets = require("./remote/widgets.cjs");
|
|
5
|
+
const rpc = require("@remote-ui/rpc");
|
|
6
|
+
const pinia = require("pinia");
|
|
7
|
+
const vue = require("vue");
|
|
8
|
+
const KIND_COMPONENT$1 = "component";
|
|
9
|
+
const KIND_TEXT$1 = "text";
|
|
10
|
+
function isRemoteComponent(value) {
|
|
11
|
+
return value != null && value.kind === KIND_COMPONENT$1;
|
|
12
|
+
}
|
|
13
|
+
function isRemoteText(value) {
|
|
14
|
+
return value != null && value.kind === KIND_TEXT$1;
|
|
15
|
+
}
|
|
16
|
+
const nextSibling = (node) => {
|
|
17
|
+
const { parent } = node;
|
|
18
|
+
if (parent == null) {
|
|
19
|
+
return null;
|
|
20
|
+
}
|
|
21
|
+
const { children } = parent;
|
|
22
|
+
return children[children.indexOf(node) + 1] ?? null;
|
|
23
|
+
};
|
|
24
|
+
const setElementText = (element, text) => {
|
|
25
|
+
const [node] = element.children;
|
|
26
|
+
if (node && isRemoteText(node)) {
|
|
27
|
+
node.update(text);
|
|
28
|
+
} else {
|
|
29
|
+
element.replace(text);
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
const setText = (node, text) => {
|
|
33
|
+
if (isRemoteText(node)) {
|
|
34
|
+
node.update(text);
|
|
35
|
+
} else {
|
|
36
|
+
setElementText(node, text);
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
const createRemoteRenderer = (root) => vue.createRenderer({
|
|
40
|
+
patchProp(element, key, _, next) {
|
|
41
|
+
if (!isRemoteComponent(element)) {
|
|
42
|
+
throw new Error("Unexpected: Attempt to patch props on a root node");
|
|
43
|
+
}
|
|
44
|
+
element.updateProperties({ [key]: next });
|
|
45
|
+
},
|
|
46
|
+
insert: (child, parent, anchor) => parent.insertBefore(child, anchor),
|
|
47
|
+
remove: (node) => {
|
|
48
|
+
var _a;
|
|
49
|
+
return (_a = node.parent) == null ? void 0 : _a.removeChild(node);
|
|
50
|
+
},
|
|
51
|
+
createElement: (type) => root.createComponent(type),
|
|
52
|
+
createText: (text) => root.createText(text),
|
|
53
|
+
createComment: (text) => root.createComment(text),
|
|
54
|
+
parentNode: (node) => node.parent,
|
|
55
|
+
nextSibling,
|
|
56
|
+
setText,
|
|
57
|
+
setElementText
|
|
58
|
+
});
|
|
59
|
+
const CustomContextAccessorKey = Symbol("CustomContextAccessor");
|
|
60
|
+
const injectAccessor = (endpoint) => {
|
|
61
|
+
return (context) => {
|
|
62
|
+
context.store[CustomContextAccessorKey] = endpoint.call;
|
|
63
|
+
};
|
|
64
|
+
};
|
|
65
|
+
pinia.defineStore("@retailcrm/embed-ui/_dictionary", {
|
|
66
|
+
actions: {
|
|
67
|
+
async query(code, parameters = {}) {
|
|
68
|
+
const accessor = this[CustomContextAccessorKey];
|
|
69
|
+
return new Promise((resolve, reject) => {
|
|
70
|
+
let rejection = null;
|
|
71
|
+
accessor.getCustomDictionary(code, parameters, (r) => rejection = r).then((dictionary) => {
|
|
72
|
+
if (!rejection) {
|
|
73
|
+
resolve(dictionary);
|
|
74
|
+
} else {
|
|
75
|
+
reject(rejection);
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
const injectEndpoint = (endpoint) => {
|
|
83
|
+
return (context) => {
|
|
84
|
+
context.store.endpoint = endpoint;
|
|
85
|
+
};
|
|
86
|
+
};
|
|
87
|
+
var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
|
|
88
|
+
function getDefaultExportFromCjs(x) {
|
|
89
|
+
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
|
|
90
|
+
}
|
|
91
|
+
var lodash_isequal = { exports: {} };
|
|
92
|
+
lodash_isequal.exports;
|
|
93
|
+
var hasRequiredLodash_isequal;
|
|
94
|
+
function requireLodash_isequal() {
|
|
95
|
+
if (hasRequiredLodash_isequal) return lodash_isequal.exports;
|
|
96
|
+
hasRequiredLodash_isequal = 1;
|
|
97
|
+
(function(module2, exports$1) {
|
|
98
|
+
var LARGE_ARRAY_SIZE = 200;
|
|
99
|
+
var HASH_UNDEFINED = "__lodash_hash_undefined__";
|
|
100
|
+
var COMPARE_PARTIAL_FLAG = 1, COMPARE_UNORDERED_FLAG = 2;
|
|
101
|
+
var MAX_SAFE_INTEGER = 9007199254740991;
|
|
102
|
+
var argsTag = "[object Arguments]", arrayTag = "[object Array]", asyncTag = "[object AsyncFunction]", boolTag = "[object Boolean]", dateTag = "[object Date]", errorTag = "[object Error]", funcTag = "[object Function]", genTag = "[object GeneratorFunction]", mapTag = "[object Map]", numberTag = "[object Number]", nullTag = "[object Null]", objectTag = "[object Object]", promiseTag = "[object Promise]", proxyTag = "[object Proxy]", regexpTag = "[object RegExp]", setTag = "[object Set]", stringTag = "[object String]", symbolTag = "[object Symbol]", undefinedTag = "[object Undefined]", weakMapTag = "[object WeakMap]";
|
|
103
|
+
var arrayBufferTag = "[object ArrayBuffer]", dataViewTag = "[object DataView]", float32Tag = "[object Float32Array]", float64Tag = "[object Float64Array]", int8Tag = "[object Int8Array]", int16Tag = "[object Int16Array]", int32Tag = "[object Int32Array]", uint8Tag = "[object Uint8Array]", uint8ClampedTag = "[object Uint8ClampedArray]", uint16Tag = "[object Uint16Array]", uint32Tag = "[object Uint32Array]";
|
|
104
|
+
var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
|
|
105
|
+
var reIsHostCtor = /^\[object .+?Constructor\]$/;
|
|
106
|
+
var reIsUint = /^(?:0|[1-9]\d*)$/;
|
|
107
|
+
var typedArrayTags = {};
|
|
108
|
+
typedArrayTags[float32Tag] = typedArrayTags[float64Tag] = typedArrayTags[int8Tag] = typedArrayTags[int16Tag] = typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] = typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] = typedArrayTags[uint32Tag] = true;
|
|
109
|
+
typedArrayTags[argsTag] = typedArrayTags[arrayTag] = typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] = typedArrayTags[dataViewTag] = typedArrayTags[dateTag] = typedArrayTags[errorTag] = typedArrayTags[funcTag] = typedArrayTags[mapTag] = typedArrayTags[numberTag] = typedArrayTags[objectTag] = typedArrayTags[regexpTag] = typedArrayTags[setTag] = typedArrayTags[stringTag] = typedArrayTags[weakMapTag] = false;
|
|
110
|
+
var freeGlobal = typeof commonjsGlobal == "object" && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
|
|
111
|
+
var freeSelf = typeof self == "object" && self && self.Object === Object && self;
|
|
112
|
+
var root = freeGlobal || freeSelf || Function("return this")();
|
|
113
|
+
var freeExports = exports$1 && !exports$1.nodeType && exports$1;
|
|
114
|
+
var freeModule = freeExports && true && module2 && !module2.nodeType && module2;
|
|
115
|
+
var moduleExports = freeModule && freeModule.exports === freeExports;
|
|
116
|
+
var freeProcess = moduleExports && freeGlobal.process;
|
|
117
|
+
var nodeUtil = (function() {
|
|
118
|
+
try {
|
|
119
|
+
return freeProcess && freeProcess.binding && freeProcess.binding("util");
|
|
120
|
+
} catch (e) {
|
|
121
|
+
}
|
|
122
|
+
})();
|
|
123
|
+
var nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
|
|
124
|
+
function arrayFilter(array, predicate) {
|
|
125
|
+
var index = -1, length = array == null ? 0 : array.length, resIndex = 0, result = [];
|
|
126
|
+
while (++index < length) {
|
|
127
|
+
var value = array[index];
|
|
128
|
+
if (predicate(value, index, array)) {
|
|
129
|
+
result[resIndex++] = value;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
return result;
|
|
133
|
+
}
|
|
134
|
+
function arrayPush(array, values) {
|
|
135
|
+
var index = -1, length = values.length, offset = array.length;
|
|
136
|
+
while (++index < length) {
|
|
137
|
+
array[offset + index] = values[index];
|
|
138
|
+
}
|
|
139
|
+
return array;
|
|
140
|
+
}
|
|
141
|
+
function arraySome(array, predicate) {
|
|
142
|
+
var index = -1, length = array == null ? 0 : array.length;
|
|
143
|
+
while (++index < length) {
|
|
144
|
+
if (predicate(array[index], index, array)) {
|
|
145
|
+
return true;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
return false;
|
|
149
|
+
}
|
|
150
|
+
function baseTimes(n, iteratee) {
|
|
151
|
+
var index = -1, result = Array(n);
|
|
152
|
+
while (++index < n) {
|
|
153
|
+
result[index] = iteratee(index);
|
|
154
|
+
}
|
|
155
|
+
return result;
|
|
156
|
+
}
|
|
157
|
+
function baseUnary(func) {
|
|
158
|
+
return function(value) {
|
|
159
|
+
return func(value);
|
|
160
|
+
};
|
|
161
|
+
}
|
|
162
|
+
function cacheHas(cache, key) {
|
|
163
|
+
return cache.has(key);
|
|
164
|
+
}
|
|
165
|
+
function getValue(object, key) {
|
|
166
|
+
return object == null ? void 0 : object[key];
|
|
167
|
+
}
|
|
168
|
+
function mapToArray(map) {
|
|
169
|
+
var index = -1, result = Array(map.size);
|
|
170
|
+
map.forEach(function(value, key) {
|
|
171
|
+
result[++index] = [key, value];
|
|
172
|
+
});
|
|
173
|
+
return result;
|
|
174
|
+
}
|
|
175
|
+
function overArg(func, transform) {
|
|
176
|
+
return function(arg) {
|
|
177
|
+
return func(transform(arg));
|
|
178
|
+
};
|
|
179
|
+
}
|
|
180
|
+
function setToArray(set) {
|
|
181
|
+
var index = -1, result = Array(set.size);
|
|
182
|
+
set.forEach(function(value) {
|
|
183
|
+
result[++index] = value;
|
|
184
|
+
});
|
|
185
|
+
return result;
|
|
186
|
+
}
|
|
187
|
+
var arrayProto = Array.prototype, funcProto = Function.prototype, objectProto = Object.prototype;
|
|
188
|
+
var coreJsData = root["__core-js_shared__"];
|
|
189
|
+
var funcToString = funcProto.toString;
|
|
190
|
+
var hasOwnProperty = objectProto.hasOwnProperty;
|
|
191
|
+
var maskSrcKey = (function() {
|
|
192
|
+
var uid2 = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || "");
|
|
193
|
+
return uid2 ? "Symbol(src)_1." + uid2 : "";
|
|
194
|
+
})();
|
|
195
|
+
var nativeObjectToString = objectProto.toString;
|
|
196
|
+
var reIsNative = RegExp(
|
|
197
|
+
"^" + funcToString.call(hasOwnProperty).replace(reRegExpChar, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
|
|
198
|
+
);
|
|
199
|
+
var Buffer = moduleExports ? root.Buffer : void 0, Symbol2 = root.Symbol, Uint8Array = root.Uint8Array, propertyIsEnumerable = objectProto.propertyIsEnumerable, splice = arrayProto.splice, symToStringTag = Symbol2 ? Symbol2.toStringTag : void 0;
|
|
200
|
+
var nativeGetSymbols = Object.getOwnPropertySymbols, nativeIsBuffer = Buffer ? Buffer.isBuffer : void 0, nativeKeys = overArg(Object.keys, Object);
|
|
201
|
+
var DataView = getNative(root, "DataView"), Map2 = getNative(root, "Map"), Promise2 = getNative(root, "Promise"), Set2 = getNative(root, "Set"), WeakMap2 = getNative(root, "WeakMap"), nativeCreate = getNative(Object, "create");
|
|
202
|
+
var dataViewCtorString = toSource(DataView), mapCtorString = toSource(Map2), promiseCtorString = toSource(Promise2), setCtorString = toSource(Set2), weakMapCtorString = toSource(WeakMap2);
|
|
203
|
+
var symbolProto = Symbol2 ? Symbol2.prototype : void 0, symbolValueOf = symbolProto ? symbolProto.valueOf : void 0;
|
|
204
|
+
function Hash(entries) {
|
|
205
|
+
var index = -1, length = entries == null ? 0 : entries.length;
|
|
206
|
+
this.clear();
|
|
207
|
+
while (++index < length) {
|
|
208
|
+
var entry = entries[index];
|
|
209
|
+
this.set(entry[0], entry[1]);
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
function hashClear() {
|
|
213
|
+
this.__data__ = nativeCreate ? nativeCreate(null) : {};
|
|
214
|
+
this.size = 0;
|
|
215
|
+
}
|
|
216
|
+
function hashDelete(key) {
|
|
217
|
+
var result = this.has(key) && delete this.__data__[key];
|
|
218
|
+
this.size -= result ? 1 : 0;
|
|
219
|
+
return result;
|
|
220
|
+
}
|
|
221
|
+
function hashGet(key) {
|
|
222
|
+
var data = this.__data__;
|
|
223
|
+
if (nativeCreate) {
|
|
224
|
+
var result = data[key];
|
|
225
|
+
return result === HASH_UNDEFINED ? void 0 : result;
|
|
226
|
+
}
|
|
227
|
+
return hasOwnProperty.call(data, key) ? data[key] : void 0;
|
|
228
|
+
}
|
|
229
|
+
function hashHas(key) {
|
|
230
|
+
var data = this.__data__;
|
|
231
|
+
return nativeCreate ? data[key] !== void 0 : hasOwnProperty.call(data, key);
|
|
232
|
+
}
|
|
233
|
+
function hashSet(key, value) {
|
|
234
|
+
var data = this.__data__;
|
|
235
|
+
this.size += this.has(key) ? 0 : 1;
|
|
236
|
+
data[key] = nativeCreate && value === void 0 ? HASH_UNDEFINED : value;
|
|
237
|
+
return this;
|
|
238
|
+
}
|
|
239
|
+
Hash.prototype.clear = hashClear;
|
|
240
|
+
Hash.prototype["delete"] = hashDelete;
|
|
241
|
+
Hash.prototype.get = hashGet;
|
|
242
|
+
Hash.prototype.has = hashHas;
|
|
243
|
+
Hash.prototype.set = hashSet;
|
|
244
|
+
function ListCache(entries) {
|
|
245
|
+
var index = -1, length = entries == null ? 0 : entries.length;
|
|
246
|
+
this.clear();
|
|
247
|
+
while (++index < length) {
|
|
248
|
+
var entry = entries[index];
|
|
249
|
+
this.set(entry[0], entry[1]);
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
function listCacheClear() {
|
|
253
|
+
this.__data__ = [];
|
|
254
|
+
this.size = 0;
|
|
255
|
+
}
|
|
256
|
+
function listCacheDelete(key) {
|
|
257
|
+
var data = this.__data__, index = assocIndexOf(data, key);
|
|
258
|
+
if (index < 0) {
|
|
259
|
+
return false;
|
|
260
|
+
}
|
|
261
|
+
var lastIndex = data.length - 1;
|
|
262
|
+
if (index == lastIndex) {
|
|
263
|
+
data.pop();
|
|
264
|
+
} else {
|
|
265
|
+
splice.call(data, index, 1);
|
|
266
|
+
}
|
|
267
|
+
--this.size;
|
|
268
|
+
return true;
|
|
269
|
+
}
|
|
270
|
+
function listCacheGet(key) {
|
|
271
|
+
var data = this.__data__, index = assocIndexOf(data, key);
|
|
272
|
+
return index < 0 ? void 0 : data[index][1];
|
|
273
|
+
}
|
|
274
|
+
function listCacheHas(key) {
|
|
275
|
+
return assocIndexOf(this.__data__, key) > -1;
|
|
276
|
+
}
|
|
277
|
+
function listCacheSet(key, value) {
|
|
278
|
+
var data = this.__data__, index = assocIndexOf(data, key);
|
|
279
|
+
if (index < 0) {
|
|
280
|
+
++this.size;
|
|
281
|
+
data.push([key, value]);
|
|
282
|
+
} else {
|
|
283
|
+
data[index][1] = value;
|
|
284
|
+
}
|
|
285
|
+
return this;
|
|
286
|
+
}
|
|
287
|
+
ListCache.prototype.clear = listCacheClear;
|
|
288
|
+
ListCache.prototype["delete"] = listCacheDelete;
|
|
289
|
+
ListCache.prototype.get = listCacheGet;
|
|
290
|
+
ListCache.prototype.has = listCacheHas;
|
|
291
|
+
ListCache.prototype.set = listCacheSet;
|
|
292
|
+
function MapCache(entries) {
|
|
293
|
+
var index = -1, length = entries == null ? 0 : entries.length;
|
|
294
|
+
this.clear();
|
|
295
|
+
while (++index < length) {
|
|
296
|
+
var entry = entries[index];
|
|
297
|
+
this.set(entry[0], entry[1]);
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
function mapCacheClear() {
|
|
301
|
+
this.size = 0;
|
|
302
|
+
this.__data__ = {
|
|
303
|
+
"hash": new Hash(),
|
|
304
|
+
"map": new (Map2 || ListCache)(),
|
|
305
|
+
"string": new Hash()
|
|
306
|
+
};
|
|
307
|
+
}
|
|
308
|
+
function mapCacheDelete(key) {
|
|
309
|
+
var result = getMapData(this, key)["delete"](key);
|
|
310
|
+
this.size -= result ? 1 : 0;
|
|
311
|
+
return result;
|
|
312
|
+
}
|
|
313
|
+
function mapCacheGet(key) {
|
|
314
|
+
return getMapData(this, key).get(key);
|
|
315
|
+
}
|
|
316
|
+
function mapCacheHas(key) {
|
|
317
|
+
return getMapData(this, key).has(key);
|
|
318
|
+
}
|
|
319
|
+
function mapCacheSet(key, value) {
|
|
320
|
+
var data = getMapData(this, key), size = data.size;
|
|
321
|
+
data.set(key, value);
|
|
322
|
+
this.size += data.size == size ? 0 : 1;
|
|
323
|
+
return this;
|
|
324
|
+
}
|
|
325
|
+
MapCache.prototype.clear = mapCacheClear;
|
|
326
|
+
MapCache.prototype["delete"] = mapCacheDelete;
|
|
327
|
+
MapCache.prototype.get = mapCacheGet;
|
|
328
|
+
MapCache.prototype.has = mapCacheHas;
|
|
329
|
+
MapCache.prototype.set = mapCacheSet;
|
|
330
|
+
function SetCache(values) {
|
|
331
|
+
var index = -1, length = values == null ? 0 : values.length;
|
|
332
|
+
this.__data__ = new MapCache();
|
|
333
|
+
while (++index < length) {
|
|
334
|
+
this.add(values[index]);
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
function setCacheAdd(value) {
|
|
338
|
+
this.__data__.set(value, HASH_UNDEFINED);
|
|
339
|
+
return this;
|
|
340
|
+
}
|
|
341
|
+
function setCacheHas(value) {
|
|
342
|
+
return this.__data__.has(value);
|
|
343
|
+
}
|
|
344
|
+
SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
|
|
345
|
+
SetCache.prototype.has = setCacheHas;
|
|
346
|
+
function Stack(entries) {
|
|
347
|
+
var data = this.__data__ = new ListCache(entries);
|
|
348
|
+
this.size = data.size;
|
|
349
|
+
}
|
|
350
|
+
function stackClear() {
|
|
351
|
+
this.__data__ = new ListCache();
|
|
352
|
+
this.size = 0;
|
|
353
|
+
}
|
|
354
|
+
function stackDelete(key) {
|
|
355
|
+
var data = this.__data__, result = data["delete"](key);
|
|
356
|
+
this.size = data.size;
|
|
357
|
+
return result;
|
|
358
|
+
}
|
|
359
|
+
function stackGet(key) {
|
|
360
|
+
return this.__data__.get(key);
|
|
361
|
+
}
|
|
362
|
+
function stackHas(key) {
|
|
363
|
+
return this.__data__.has(key);
|
|
364
|
+
}
|
|
365
|
+
function stackSet(key, value) {
|
|
366
|
+
var data = this.__data__;
|
|
367
|
+
if (data instanceof ListCache) {
|
|
368
|
+
var pairs = data.__data__;
|
|
369
|
+
if (!Map2 || pairs.length < LARGE_ARRAY_SIZE - 1) {
|
|
370
|
+
pairs.push([key, value]);
|
|
371
|
+
this.size = ++data.size;
|
|
372
|
+
return this;
|
|
373
|
+
}
|
|
374
|
+
data = this.__data__ = new MapCache(pairs);
|
|
375
|
+
}
|
|
376
|
+
data.set(key, value);
|
|
377
|
+
this.size = data.size;
|
|
378
|
+
return this;
|
|
379
|
+
}
|
|
380
|
+
Stack.prototype.clear = stackClear;
|
|
381
|
+
Stack.prototype["delete"] = stackDelete;
|
|
382
|
+
Stack.prototype.get = stackGet;
|
|
383
|
+
Stack.prototype.has = stackHas;
|
|
384
|
+
Stack.prototype.set = stackSet;
|
|
385
|
+
function arrayLikeKeys(value, inherited) {
|
|
386
|
+
var isArr = isArray(value), isArg = !isArr && isArguments(value), isBuff = !isArr && !isArg && isBuffer(value), isType = !isArr && !isArg && !isBuff && isTypedArray(value), skipIndexes = isArr || isArg || isBuff || isType, result = skipIndexes ? baseTimes(value.length, String) : [], length = result.length;
|
|
387
|
+
for (var key in value) {
|
|
388
|
+
if (hasOwnProperty.call(value, key) && !(skipIndexes && // Safari 9 has enumerable `arguments.length` in strict mode.
|
|
389
|
+
(key == "length" || // Node.js 0.10 has enumerable non-index properties on buffers.
|
|
390
|
+
isBuff && (key == "offset" || key == "parent") || // PhantomJS 2 has enumerable non-index properties on typed arrays.
|
|
391
|
+
isType && (key == "buffer" || key == "byteLength" || key == "byteOffset") || // Skip index properties.
|
|
392
|
+
isIndex(key, length)))) {
|
|
393
|
+
result.push(key);
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
return result;
|
|
397
|
+
}
|
|
398
|
+
function assocIndexOf(array, key) {
|
|
399
|
+
var length = array.length;
|
|
400
|
+
while (length--) {
|
|
401
|
+
if (eq(array[length][0], key)) {
|
|
402
|
+
return length;
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
return -1;
|
|
406
|
+
}
|
|
407
|
+
function baseGetAllKeys(object, keysFunc, symbolsFunc) {
|
|
408
|
+
var result = keysFunc(object);
|
|
409
|
+
return isArray(object) ? result : arrayPush(result, symbolsFunc(object));
|
|
410
|
+
}
|
|
411
|
+
function baseGetTag(value) {
|
|
412
|
+
if (value == null) {
|
|
413
|
+
return value === void 0 ? undefinedTag : nullTag;
|
|
414
|
+
}
|
|
415
|
+
return symToStringTag && symToStringTag in Object(value) ? getRawTag(value) : objectToString(value);
|
|
416
|
+
}
|
|
417
|
+
function baseIsArguments(value) {
|
|
418
|
+
return isObjectLike(value) && baseGetTag(value) == argsTag;
|
|
419
|
+
}
|
|
420
|
+
function baseIsEqual(value, other, bitmask, customizer, stack) {
|
|
421
|
+
if (value === other) {
|
|
422
|
+
return true;
|
|
423
|
+
}
|
|
424
|
+
if (value == null || other == null || !isObjectLike(value) && !isObjectLike(other)) {
|
|
425
|
+
return value !== value && other !== other;
|
|
426
|
+
}
|
|
427
|
+
return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);
|
|
428
|
+
}
|
|
429
|
+
function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
|
|
430
|
+
var objIsArr = isArray(object), othIsArr = isArray(other), objTag = objIsArr ? arrayTag : getTag(object), othTag = othIsArr ? arrayTag : getTag(other);
|
|
431
|
+
objTag = objTag == argsTag ? objectTag : objTag;
|
|
432
|
+
othTag = othTag == argsTag ? objectTag : othTag;
|
|
433
|
+
var objIsObj = objTag == objectTag, othIsObj = othTag == objectTag, isSameTag = objTag == othTag;
|
|
434
|
+
if (isSameTag && isBuffer(object)) {
|
|
435
|
+
if (!isBuffer(other)) {
|
|
436
|
+
return false;
|
|
437
|
+
}
|
|
438
|
+
objIsArr = true;
|
|
439
|
+
objIsObj = false;
|
|
440
|
+
}
|
|
441
|
+
if (isSameTag && !objIsObj) {
|
|
442
|
+
stack || (stack = new Stack());
|
|
443
|
+
return objIsArr || isTypedArray(object) ? equalArrays(object, other, bitmask, customizer, equalFunc, stack) : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);
|
|
444
|
+
}
|
|
445
|
+
if (!(bitmask & COMPARE_PARTIAL_FLAG)) {
|
|
446
|
+
var objIsWrapped = objIsObj && hasOwnProperty.call(object, "__wrapped__"), othIsWrapped = othIsObj && hasOwnProperty.call(other, "__wrapped__");
|
|
447
|
+
if (objIsWrapped || othIsWrapped) {
|
|
448
|
+
var objUnwrapped = objIsWrapped ? object.value() : object, othUnwrapped = othIsWrapped ? other.value() : other;
|
|
449
|
+
stack || (stack = new Stack());
|
|
450
|
+
return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
|
|
451
|
+
}
|
|
452
|
+
}
|
|
453
|
+
if (!isSameTag) {
|
|
454
|
+
return false;
|
|
455
|
+
}
|
|
456
|
+
stack || (stack = new Stack());
|
|
457
|
+
return equalObjects(object, other, bitmask, customizer, equalFunc, stack);
|
|
458
|
+
}
|
|
459
|
+
function baseIsNative(value) {
|
|
460
|
+
if (!isObject2(value) || isMasked(value)) {
|
|
461
|
+
return false;
|
|
462
|
+
}
|
|
463
|
+
var pattern = isFunction2(value) ? reIsNative : reIsHostCtor;
|
|
464
|
+
return pattern.test(toSource(value));
|
|
465
|
+
}
|
|
466
|
+
function baseIsTypedArray(value) {
|
|
467
|
+
return isObjectLike(value) && isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
|
|
468
|
+
}
|
|
469
|
+
function baseKeys(object) {
|
|
470
|
+
if (!isPrototype(object)) {
|
|
471
|
+
return nativeKeys(object);
|
|
472
|
+
}
|
|
473
|
+
var result = [];
|
|
474
|
+
for (var key in Object(object)) {
|
|
475
|
+
if (hasOwnProperty.call(object, key) && key != "constructor") {
|
|
476
|
+
result.push(key);
|
|
477
|
+
}
|
|
478
|
+
}
|
|
479
|
+
return result;
|
|
480
|
+
}
|
|
481
|
+
function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {
|
|
482
|
+
var isPartial = bitmask & COMPARE_PARTIAL_FLAG, arrLength = array.length, othLength = other.length;
|
|
483
|
+
if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
|
|
484
|
+
return false;
|
|
485
|
+
}
|
|
486
|
+
var stacked = stack.get(array);
|
|
487
|
+
if (stacked && stack.get(other)) {
|
|
488
|
+
return stacked == other;
|
|
489
|
+
}
|
|
490
|
+
var index = -1, result = true, seen = bitmask & COMPARE_UNORDERED_FLAG ? new SetCache() : void 0;
|
|
491
|
+
stack.set(array, other);
|
|
492
|
+
stack.set(other, array);
|
|
493
|
+
while (++index < arrLength) {
|
|
494
|
+
var arrValue = array[index], othValue = other[index];
|
|
495
|
+
if (customizer) {
|
|
496
|
+
var compared = isPartial ? customizer(othValue, arrValue, index, other, array, stack) : customizer(arrValue, othValue, index, array, other, stack);
|
|
497
|
+
}
|
|
498
|
+
if (compared !== void 0) {
|
|
499
|
+
if (compared) {
|
|
500
|
+
continue;
|
|
501
|
+
}
|
|
502
|
+
result = false;
|
|
503
|
+
break;
|
|
504
|
+
}
|
|
505
|
+
if (seen) {
|
|
506
|
+
if (!arraySome(other, function(othValue2, othIndex) {
|
|
507
|
+
if (!cacheHas(seen, othIndex) && (arrValue === othValue2 || equalFunc(arrValue, othValue2, bitmask, customizer, stack))) {
|
|
508
|
+
return seen.push(othIndex);
|
|
509
|
+
}
|
|
510
|
+
})) {
|
|
511
|
+
result = false;
|
|
512
|
+
break;
|
|
513
|
+
}
|
|
514
|
+
} else if (!(arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
|
|
515
|
+
result = false;
|
|
516
|
+
break;
|
|
517
|
+
}
|
|
518
|
+
}
|
|
519
|
+
stack["delete"](array);
|
|
520
|
+
stack["delete"](other);
|
|
521
|
+
return result;
|
|
522
|
+
}
|
|
523
|
+
function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
|
|
524
|
+
switch (tag) {
|
|
525
|
+
case dataViewTag:
|
|
526
|
+
if (object.byteLength != other.byteLength || object.byteOffset != other.byteOffset) {
|
|
527
|
+
return false;
|
|
528
|
+
}
|
|
529
|
+
object = object.buffer;
|
|
530
|
+
other = other.buffer;
|
|
531
|
+
case arrayBufferTag:
|
|
532
|
+
if (object.byteLength != other.byteLength || !equalFunc(new Uint8Array(object), new Uint8Array(other))) {
|
|
533
|
+
return false;
|
|
534
|
+
}
|
|
535
|
+
return true;
|
|
536
|
+
case boolTag:
|
|
537
|
+
case dateTag:
|
|
538
|
+
case numberTag:
|
|
539
|
+
return eq(+object, +other);
|
|
540
|
+
case errorTag:
|
|
541
|
+
return object.name == other.name && object.message == other.message;
|
|
542
|
+
case regexpTag:
|
|
543
|
+
case stringTag:
|
|
544
|
+
return object == other + "";
|
|
545
|
+
case mapTag:
|
|
546
|
+
var convert = mapToArray;
|
|
547
|
+
case setTag:
|
|
548
|
+
var isPartial = bitmask & COMPARE_PARTIAL_FLAG;
|
|
549
|
+
convert || (convert = setToArray);
|
|
550
|
+
if (object.size != other.size && !isPartial) {
|
|
551
|
+
return false;
|
|
552
|
+
}
|
|
553
|
+
var stacked = stack.get(object);
|
|
554
|
+
if (stacked) {
|
|
555
|
+
return stacked == other;
|
|
556
|
+
}
|
|
557
|
+
bitmask |= COMPARE_UNORDERED_FLAG;
|
|
558
|
+
stack.set(object, other);
|
|
559
|
+
var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack);
|
|
560
|
+
stack["delete"](object);
|
|
561
|
+
return result;
|
|
562
|
+
case symbolTag:
|
|
563
|
+
if (symbolValueOf) {
|
|
564
|
+
return symbolValueOf.call(object) == symbolValueOf.call(other);
|
|
565
|
+
}
|
|
566
|
+
}
|
|
567
|
+
return false;
|
|
568
|
+
}
|
|
569
|
+
function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
|
|
570
|
+
var isPartial = bitmask & COMPARE_PARTIAL_FLAG, objProps = getAllKeys(object), objLength = objProps.length, othProps = getAllKeys(other), othLength = othProps.length;
|
|
571
|
+
if (objLength != othLength && !isPartial) {
|
|
572
|
+
return false;
|
|
573
|
+
}
|
|
574
|
+
var index = objLength;
|
|
575
|
+
while (index--) {
|
|
576
|
+
var key = objProps[index];
|
|
577
|
+
if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) {
|
|
578
|
+
return false;
|
|
579
|
+
}
|
|
580
|
+
}
|
|
581
|
+
var stacked = stack.get(object);
|
|
582
|
+
if (stacked && stack.get(other)) {
|
|
583
|
+
return stacked == other;
|
|
584
|
+
}
|
|
585
|
+
var result = true;
|
|
586
|
+
stack.set(object, other);
|
|
587
|
+
stack.set(other, object);
|
|
588
|
+
var skipCtor = isPartial;
|
|
589
|
+
while (++index < objLength) {
|
|
590
|
+
key = objProps[index];
|
|
591
|
+
var objValue = object[key], othValue = other[key];
|
|
592
|
+
if (customizer) {
|
|
593
|
+
var compared = isPartial ? customizer(othValue, objValue, key, other, object, stack) : customizer(objValue, othValue, key, object, other, stack);
|
|
594
|
+
}
|
|
595
|
+
if (!(compared === void 0 ? objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack) : compared)) {
|
|
596
|
+
result = false;
|
|
597
|
+
break;
|
|
598
|
+
}
|
|
599
|
+
skipCtor || (skipCtor = key == "constructor");
|
|
600
|
+
}
|
|
601
|
+
if (result && !skipCtor) {
|
|
602
|
+
var objCtor = object.constructor, othCtor = other.constructor;
|
|
603
|
+
if (objCtor != othCtor && ("constructor" in object && "constructor" in other) && !(typeof objCtor == "function" && objCtor instanceof objCtor && typeof othCtor == "function" && othCtor instanceof othCtor)) {
|
|
604
|
+
result = false;
|
|
605
|
+
}
|
|
606
|
+
}
|
|
607
|
+
stack["delete"](object);
|
|
608
|
+
stack["delete"](other);
|
|
609
|
+
return result;
|
|
610
|
+
}
|
|
611
|
+
function getAllKeys(object) {
|
|
612
|
+
return baseGetAllKeys(object, keys, getSymbols);
|
|
613
|
+
}
|
|
614
|
+
function getMapData(map, key) {
|
|
615
|
+
var data = map.__data__;
|
|
616
|
+
return isKeyable(key) ? data[typeof key == "string" ? "string" : "hash"] : data.map;
|
|
617
|
+
}
|
|
618
|
+
function getNative(object, key) {
|
|
619
|
+
var value = getValue(object, key);
|
|
620
|
+
return baseIsNative(value) ? value : void 0;
|
|
621
|
+
}
|
|
622
|
+
function getRawTag(value) {
|
|
623
|
+
var isOwn = hasOwnProperty.call(value, symToStringTag), tag = value[symToStringTag];
|
|
624
|
+
try {
|
|
625
|
+
value[symToStringTag] = void 0;
|
|
626
|
+
var unmasked = true;
|
|
627
|
+
} catch (e) {
|
|
628
|
+
}
|
|
629
|
+
var result = nativeObjectToString.call(value);
|
|
630
|
+
if (unmasked) {
|
|
631
|
+
if (isOwn) {
|
|
632
|
+
value[symToStringTag] = tag;
|
|
633
|
+
} else {
|
|
634
|
+
delete value[symToStringTag];
|
|
635
|
+
}
|
|
636
|
+
}
|
|
637
|
+
return result;
|
|
638
|
+
}
|
|
639
|
+
var getSymbols = !nativeGetSymbols ? stubArray : function(object) {
|
|
640
|
+
if (object == null) {
|
|
641
|
+
return [];
|
|
642
|
+
}
|
|
643
|
+
object = Object(object);
|
|
644
|
+
return arrayFilter(nativeGetSymbols(object), function(symbol) {
|
|
645
|
+
return propertyIsEnumerable.call(object, symbol);
|
|
646
|
+
});
|
|
647
|
+
};
|
|
648
|
+
var getTag = baseGetTag;
|
|
649
|
+
if (DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag || Map2 && getTag(new Map2()) != mapTag || Promise2 && getTag(Promise2.resolve()) != promiseTag || Set2 && getTag(new Set2()) != setTag || WeakMap2 && getTag(new WeakMap2()) != weakMapTag) {
|
|
650
|
+
getTag = function(value) {
|
|
651
|
+
var result = baseGetTag(value), Ctor = result == objectTag ? value.constructor : void 0, ctorString = Ctor ? toSource(Ctor) : "";
|
|
652
|
+
if (ctorString) {
|
|
653
|
+
switch (ctorString) {
|
|
654
|
+
case dataViewCtorString:
|
|
655
|
+
return dataViewTag;
|
|
656
|
+
case mapCtorString:
|
|
657
|
+
return mapTag;
|
|
658
|
+
case promiseCtorString:
|
|
659
|
+
return promiseTag;
|
|
660
|
+
case setCtorString:
|
|
661
|
+
return setTag;
|
|
662
|
+
case weakMapCtorString:
|
|
663
|
+
return weakMapTag;
|
|
664
|
+
}
|
|
665
|
+
}
|
|
666
|
+
return result;
|
|
667
|
+
};
|
|
668
|
+
}
|
|
669
|
+
function isIndex(value, length) {
|
|
670
|
+
length = length == null ? MAX_SAFE_INTEGER : length;
|
|
671
|
+
return !!length && (typeof value == "number" || reIsUint.test(value)) && (value > -1 && value % 1 == 0 && value < length);
|
|
672
|
+
}
|
|
673
|
+
function isKeyable(value) {
|
|
674
|
+
var type = typeof value;
|
|
675
|
+
return type == "string" || type == "number" || type == "symbol" || type == "boolean" ? value !== "__proto__" : value === null;
|
|
676
|
+
}
|
|
677
|
+
function isMasked(func) {
|
|
678
|
+
return !!maskSrcKey && maskSrcKey in func;
|
|
679
|
+
}
|
|
680
|
+
function isPrototype(value) {
|
|
681
|
+
var Ctor = value && value.constructor, proto = typeof Ctor == "function" && Ctor.prototype || objectProto;
|
|
682
|
+
return value === proto;
|
|
683
|
+
}
|
|
684
|
+
function objectToString(value) {
|
|
685
|
+
return nativeObjectToString.call(value);
|
|
686
|
+
}
|
|
687
|
+
function toSource(func) {
|
|
688
|
+
if (func != null) {
|
|
689
|
+
try {
|
|
690
|
+
return funcToString.call(func);
|
|
691
|
+
} catch (e) {
|
|
692
|
+
}
|
|
693
|
+
try {
|
|
694
|
+
return func + "";
|
|
695
|
+
} catch (e) {
|
|
696
|
+
}
|
|
697
|
+
}
|
|
698
|
+
return "";
|
|
699
|
+
}
|
|
700
|
+
function eq(value, other) {
|
|
701
|
+
return value === other || value !== value && other !== other;
|
|
702
|
+
}
|
|
703
|
+
var isArguments = baseIsArguments(/* @__PURE__ */ (function() {
|
|
704
|
+
return arguments;
|
|
705
|
+
})()) ? baseIsArguments : function(value) {
|
|
706
|
+
return isObjectLike(value) && hasOwnProperty.call(value, "callee") && !propertyIsEnumerable.call(value, "callee");
|
|
707
|
+
};
|
|
708
|
+
var isArray = Array.isArray;
|
|
709
|
+
function isArrayLike(value) {
|
|
710
|
+
return value != null && isLength(value.length) && !isFunction2(value);
|
|
711
|
+
}
|
|
712
|
+
var isBuffer = nativeIsBuffer || stubFalse;
|
|
713
|
+
function isEqual2(value, other) {
|
|
714
|
+
return baseIsEqual(value, other);
|
|
715
|
+
}
|
|
716
|
+
function isFunction2(value) {
|
|
717
|
+
if (!isObject2(value)) {
|
|
718
|
+
return false;
|
|
719
|
+
}
|
|
720
|
+
var tag = baseGetTag(value);
|
|
721
|
+
return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
|
|
722
|
+
}
|
|
723
|
+
function isLength(value) {
|
|
724
|
+
return typeof value == "number" && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
|
|
725
|
+
}
|
|
726
|
+
function isObject2(value) {
|
|
727
|
+
var type = typeof value;
|
|
728
|
+
return value != null && (type == "object" || type == "function");
|
|
729
|
+
}
|
|
730
|
+
function isObjectLike(value) {
|
|
731
|
+
return value != null && typeof value == "object";
|
|
732
|
+
}
|
|
733
|
+
var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
|
|
734
|
+
function keys(object) {
|
|
735
|
+
return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
|
|
736
|
+
}
|
|
737
|
+
function stubArray() {
|
|
738
|
+
return [];
|
|
739
|
+
}
|
|
740
|
+
function stubFalse() {
|
|
741
|
+
return false;
|
|
742
|
+
}
|
|
743
|
+
module2.exports = isEqual2;
|
|
744
|
+
})(lodash_isequal, lodash_isequal.exports);
|
|
745
|
+
return lodash_isequal.exports;
|
|
746
|
+
}
|
|
747
|
+
var lodash_isequalExports = requireLodash_isequal();
|
|
748
|
+
const isEqual = /* @__PURE__ */ getDefaultExportFromCjs(lodash_isequalExports);
|
|
749
|
+
const ACTION_MOUNT = "mount";
|
|
750
|
+
const ACTION_INSERT_CHILD = "insert-child";
|
|
751
|
+
const ACTION_REMOVE_CHILD = "remove-child";
|
|
752
|
+
const ACTION_UPDATE_TEXT = "update-text";
|
|
753
|
+
const ACTION_UPDATE_PROPERTIES = "update-properties";
|
|
754
|
+
const ACTION_INVOKE = "invoke";
|
|
755
|
+
const KIND_COMMENT = "comment";
|
|
756
|
+
const KIND_COMPONENT = "component";
|
|
757
|
+
const KIND_FRAGMENT = "fragment";
|
|
758
|
+
const KIND_ROOT = "root";
|
|
759
|
+
const KIND_TEXT = "text";
|
|
760
|
+
const ROOT_ID = "~";
|
|
761
|
+
const addMethod = (o, name, fn) => {
|
|
762
|
+
return Object.defineProperty(o, name, {
|
|
763
|
+
value: fn,
|
|
764
|
+
configurable: true,
|
|
765
|
+
writable: false,
|
|
766
|
+
enumerable: false
|
|
767
|
+
});
|
|
768
|
+
};
|
|
769
|
+
const arraify = (value) => Array.isArray(value) ? [...value] : [value];
|
|
770
|
+
const capture = (o, freeze) => {
|
|
771
|
+
return freeze ? Object.freeze(o) : o;
|
|
772
|
+
};
|
|
773
|
+
const isFunction = (value) => {
|
|
774
|
+
return typeof value === "function";
|
|
775
|
+
};
|
|
776
|
+
const isObject = (value) => {
|
|
777
|
+
if (value == null || typeof value !== "object") {
|
|
778
|
+
return false;
|
|
779
|
+
}
|
|
780
|
+
const prototype = Object.getPrototypeOf(value);
|
|
781
|
+
return prototype == null || prototype === Object.prototype;
|
|
782
|
+
};
|
|
783
|
+
const keysOf = (o) => Object.keys(o);
|
|
784
|
+
const visitArray = (value, visited, visit) => {
|
|
785
|
+
const result = [];
|
|
786
|
+
visited.set(value, result);
|
|
787
|
+
for (const nested of value) {
|
|
788
|
+
result.push(visit(nested, visited));
|
|
789
|
+
}
|
|
790
|
+
return result;
|
|
791
|
+
};
|
|
792
|
+
const visitObject = (value, visited, visit) => {
|
|
793
|
+
const result = {};
|
|
794
|
+
visited.set(value, result);
|
|
795
|
+
for (const key of keysOf(value)) {
|
|
796
|
+
result[key] = visit(value[key], visited);
|
|
797
|
+
}
|
|
798
|
+
return result;
|
|
799
|
+
};
|
|
800
|
+
const REMOTE_SLOT = "RemoteSlot";
|
|
801
|
+
const HTMLTagList = [
|
|
802
|
+
"a",
|
|
803
|
+
"abbr",
|
|
804
|
+
"address",
|
|
805
|
+
"area",
|
|
806
|
+
"article",
|
|
807
|
+
"aside",
|
|
808
|
+
"audio",
|
|
809
|
+
"b",
|
|
810
|
+
"base",
|
|
811
|
+
"bdi",
|
|
812
|
+
"bdo",
|
|
813
|
+
"blockquote",
|
|
814
|
+
"body",
|
|
815
|
+
"br",
|
|
816
|
+
"button",
|
|
817
|
+
"canvas",
|
|
818
|
+
"caption",
|
|
819
|
+
"cite",
|
|
820
|
+
"code",
|
|
821
|
+
"col",
|
|
822
|
+
"colgroup",
|
|
823
|
+
"datalist",
|
|
824
|
+
"dd",
|
|
825
|
+
"del",
|
|
826
|
+
"details",
|
|
827
|
+
"dfn",
|
|
828
|
+
"dialog",
|
|
829
|
+
"div",
|
|
830
|
+
"dl",
|
|
831
|
+
"dt",
|
|
832
|
+
"em",
|
|
833
|
+
"embed",
|
|
834
|
+
"fieldset",
|
|
835
|
+
"figcaption",
|
|
836
|
+
"figure",
|
|
837
|
+
"footer",
|
|
838
|
+
"form",
|
|
839
|
+
"h1",
|
|
840
|
+
"h2",
|
|
841
|
+
"h3",
|
|
842
|
+
"h4",
|
|
843
|
+
"h5",
|
|
844
|
+
"h6",
|
|
845
|
+
"head",
|
|
846
|
+
"header",
|
|
847
|
+
"hgroup",
|
|
848
|
+
"hr",
|
|
849
|
+
"html",
|
|
850
|
+
"i",
|
|
851
|
+
"iframe",
|
|
852
|
+
"img",
|
|
853
|
+
"input",
|
|
854
|
+
"ins",
|
|
855
|
+
"kbd",
|
|
856
|
+
"keygen",
|
|
857
|
+
"label",
|
|
858
|
+
"legend",
|
|
859
|
+
"li",
|
|
860
|
+
"link",
|
|
861
|
+
"main",
|
|
862
|
+
"map",
|
|
863
|
+
"mark",
|
|
864
|
+
"menu",
|
|
865
|
+
"menuitem",
|
|
866
|
+
"meta",
|
|
867
|
+
"meter",
|
|
868
|
+
"nav",
|
|
869
|
+
"noscript",
|
|
870
|
+
"object",
|
|
871
|
+
"ol",
|
|
872
|
+
"optgroup",
|
|
873
|
+
"option",
|
|
874
|
+
"output",
|
|
875
|
+
"p",
|
|
876
|
+
"param",
|
|
877
|
+
"picture",
|
|
878
|
+
"pre",
|
|
879
|
+
"progress",
|
|
880
|
+
"q",
|
|
881
|
+
"rp",
|
|
882
|
+
"rt",
|
|
883
|
+
"ruby",
|
|
884
|
+
"s",
|
|
885
|
+
"samp",
|
|
886
|
+
"script",
|
|
887
|
+
"section",
|
|
888
|
+
"select",
|
|
889
|
+
"small",
|
|
890
|
+
"source",
|
|
891
|
+
"span",
|
|
892
|
+
"strong",
|
|
893
|
+
"style",
|
|
894
|
+
"sub",
|
|
895
|
+
"summary",
|
|
896
|
+
"sup",
|
|
897
|
+
"table",
|
|
898
|
+
"tbody",
|
|
899
|
+
"td",
|
|
900
|
+
"textarea",
|
|
901
|
+
"tfoot",
|
|
902
|
+
"th",
|
|
903
|
+
"thead",
|
|
904
|
+
"time",
|
|
905
|
+
"title",
|
|
906
|
+
"tr",
|
|
907
|
+
"track",
|
|
908
|
+
"u",
|
|
909
|
+
"ul",
|
|
910
|
+
"var",
|
|
911
|
+
"video",
|
|
912
|
+
"wbr"
|
|
913
|
+
];
|
|
914
|
+
const MathMLTagList = [
|
|
915
|
+
"math",
|
|
916
|
+
"maction",
|
|
917
|
+
"maligngroup",
|
|
918
|
+
"malignmark",
|
|
919
|
+
"menclose",
|
|
920
|
+
"merror",
|
|
921
|
+
"mfenced",
|
|
922
|
+
"mfrac",
|
|
923
|
+
"mglyph",
|
|
924
|
+
"mi",
|
|
925
|
+
"mlabeledtr",
|
|
926
|
+
"mlongdiv",
|
|
927
|
+
"mmultiscripts",
|
|
928
|
+
"mn",
|
|
929
|
+
"mo",
|
|
930
|
+
"mover",
|
|
931
|
+
"mpadded",
|
|
932
|
+
"mphantom",
|
|
933
|
+
"mroot",
|
|
934
|
+
"mrow",
|
|
935
|
+
"ms",
|
|
936
|
+
"mscarries",
|
|
937
|
+
"mscarry",
|
|
938
|
+
"msgroup",
|
|
939
|
+
"msline",
|
|
940
|
+
"mstack",
|
|
941
|
+
"mspace",
|
|
942
|
+
"msqrt",
|
|
943
|
+
"msrow",
|
|
944
|
+
"mstyle",
|
|
945
|
+
"msub",
|
|
946
|
+
"msup",
|
|
947
|
+
"msubsup",
|
|
948
|
+
"mtable",
|
|
949
|
+
"mtd",
|
|
950
|
+
"mtext",
|
|
951
|
+
"mtr",
|
|
952
|
+
"munder",
|
|
953
|
+
"munderover",
|
|
954
|
+
"none",
|
|
955
|
+
"semantics",
|
|
956
|
+
"annotation",
|
|
957
|
+
"annotation-xml"
|
|
958
|
+
];
|
|
959
|
+
const SVGTagList = [
|
|
960
|
+
"a",
|
|
961
|
+
"altGlyph",
|
|
962
|
+
"altGlyphDef",
|
|
963
|
+
"altGlyphItem",
|
|
964
|
+
"animate",
|
|
965
|
+
"animateColor",
|
|
966
|
+
"animateMotion",
|
|
967
|
+
"animateTransform",
|
|
968
|
+
"circle",
|
|
969
|
+
"clipPath",
|
|
970
|
+
"color-profile",
|
|
971
|
+
"cursor",
|
|
972
|
+
"defs",
|
|
973
|
+
"desc",
|
|
974
|
+
"discard",
|
|
975
|
+
"ellipse",
|
|
976
|
+
"feBlend",
|
|
977
|
+
"feColorMatrix",
|
|
978
|
+
"feComponentTransfer",
|
|
979
|
+
"feComposite",
|
|
980
|
+
"feConvolveMatrix",
|
|
981
|
+
"feDiffuseLighting",
|
|
982
|
+
"feDisplacementMap",
|
|
983
|
+
"feDistantLight",
|
|
984
|
+
"feDropShadow",
|
|
985
|
+
"feFlood",
|
|
986
|
+
"feFuncA",
|
|
987
|
+
"feFuncB",
|
|
988
|
+
"feFuncG",
|
|
989
|
+
"feFuncR",
|
|
990
|
+
"feGaussianBlur",
|
|
991
|
+
"feImage",
|
|
992
|
+
"feMerge",
|
|
993
|
+
"feMergeNode",
|
|
994
|
+
"feMorphology",
|
|
995
|
+
"feOffset",
|
|
996
|
+
"fePointLight",
|
|
997
|
+
"feSpecularLighting",
|
|
998
|
+
"feSpotLight",
|
|
999
|
+
"feTile",
|
|
1000
|
+
"feTurbulence",
|
|
1001
|
+
"filter",
|
|
1002
|
+
"font",
|
|
1003
|
+
"font-face",
|
|
1004
|
+
"font-face-format",
|
|
1005
|
+
"font-face-name",
|
|
1006
|
+
"font-face-src",
|
|
1007
|
+
"font-face-uri",
|
|
1008
|
+
"foreignObject",
|
|
1009
|
+
"g",
|
|
1010
|
+
"glyph",
|
|
1011
|
+
"glyphRef",
|
|
1012
|
+
"hkern",
|
|
1013
|
+
"image",
|
|
1014
|
+
"line",
|
|
1015
|
+
"linearGradient",
|
|
1016
|
+
"marker",
|
|
1017
|
+
"mask",
|
|
1018
|
+
"metadata",
|
|
1019
|
+
"missing-glyph",
|
|
1020
|
+
"mpath",
|
|
1021
|
+
"path",
|
|
1022
|
+
"pattern",
|
|
1023
|
+
"polygon",
|
|
1024
|
+
"polyline",
|
|
1025
|
+
"radialGradient",
|
|
1026
|
+
"rect",
|
|
1027
|
+
"script",
|
|
1028
|
+
"set",
|
|
1029
|
+
"stop",
|
|
1030
|
+
"style",
|
|
1031
|
+
"svg",
|
|
1032
|
+
"switch",
|
|
1033
|
+
"symbol",
|
|
1034
|
+
"text",
|
|
1035
|
+
"textPath",
|
|
1036
|
+
"title",
|
|
1037
|
+
"tref",
|
|
1038
|
+
"tspan",
|
|
1039
|
+
"use",
|
|
1040
|
+
"view",
|
|
1041
|
+
"vkern"
|
|
1042
|
+
];
|
|
1043
|
+
function isRemoteFragment(value) {
|
|
1044
|
+
return value != null && value.kind === KIND_FRAGMENT;
|
|
1045
|
+
}
|
|
1046
|
+
const normalizeChild = (child, root) => typeof child === "string" ? root.createText(child) : child;
|
|
1047
|
+
const normalizeChildren = (children, root) => children.map((child) => normalizeChild(child, root));
|
|
1048
|
+
const traverse = (element, each) => {
|
|
1049
|
+
const _traverse = (element2) => {
|
|
1050
|
+
if ("children" in element2) {
|
|
1051
|
+
for (const child of element2.children) {
|
|
1052
|
+
each(child);
|
|
1053
|
+
_traverse(child);
|
|
1054
|
+
}
|
|
1055
|
+
}
|
|
1056
|
+
};
|
|
1057
|
+
_traverse(element);
|
|
1058
|
+
};
|
|
1059
|
+
function attach(context, parent, node) {
|
|
1060
|
+
const { progenitors, parents } = context;
|
|
1061
|
+
const progenitor = parent.kind === KIND_ROOT ? parent : parent.progenitor;
|
|
1062
|
+
if (progenitor) {
|
|
1063
|
+
progenitors.set(node, progenitor);
|
|
1064
|
+
}
|
|
1065
|
+
parents.set(node, parent);
|
|
1066
|
+
attachFragments(context, node);
|
|
1067
|
+
traverse(node, (descendant) => {
|
|
1068
|
+
if (progenitor) {
|
|
1069
|
+
progenitors.set(descendant, progenitor);
|
|
1070
|
+
}
|
|
1071
|
+
attachFragments(context, descendant);
|
|
1072
|
+
});
|
|
1073
|
+
}
|
|
1074
|
+
function attachFragments(context, node) {
|
|
1075
|
+
if (node.kind === KIND_COMPONENT) {
|
|
1076
|
+
Object.values(node.properties).forEach((prop) => {
|
|
1077
|
+
if (isRemoteFragment(prop)) {
|
|
1078
|
+
attach(context, node, prop);
|
|
1079
|
+
}
|
|
1080
|
+
});
|
|
1081
|
+
}
|
|
1082
|
+
}
|
|
1083
|
+
function detach(context, node) {
|
|
1084
|
+
const { progenitors, parents } = context;
|
|
1085
|
+
progenitors.delete(node);
|
|
1086
|
+
parents.delete(node);
|
|
1087
|
+
traverse(node, (descendant) => {
|
|
1088
|
+
progenitors.delete(descendant);
|
|
1089
|
+
detachFragments(context, descendant);
|
|
1090
|
+
});
|
|
1091
|
+
detachFragments(context, node);
|
|
1092
|
+
}
|
|
1093
|
+
function detachFragments(context, node) {
|
|
1094
|
+
if (node.kind !== KIND_COMPONENT) {
|
|
1095
|
+
return;
|
|
1096
|
+
}
|
|
1097
|
+
const properties = node.properties;
|
|
1098
|
+
for (const key of Object.keys(properties)) {
|
|
1099
|
+
const p = properties[key];
|
|
1100
|
+
if (isRemoteFragment(p)) {
|
|
1101
|
+
detach(context, p);
|
|
1102
|
+
}
|
|
1103
|
+
}
|
|
1104
|
+
}
|
|
1105
|
+
const update = (context, node, remote, local) => {
|
|
1106
|
+
var _a;
|
|
1107
|
+
if (context.mounted && (node.kind === KIND_ROOT || ((_a = node.progenitor) == null ? void 0 : _a.kind) === KIND_ROOT)) {
|
|
1108
|
+
remote(context.channel);
|
|
1109
|
+
}
|
|
1110
|
+
local();
|
|
1111
|
+
};
|
|
1112
|
+
function dataOf(context, parent) {
|
|
1113
|
+
switch (parent == null ? void 0 : parent.kind) {
|
|
1114
|
+
case KIND_COMPONENT:
|
|
1115
|
+
return context.components.get(parent);
|
|
1116
|
+
case KIND_FRAGMENT:
|
|
1117
|
+
return context.fragments.get(parent);
|
|
1118
|
+
case KIND_ROOT:
|
|
1119
|
+
return context;
|
|
1120
|
+
}
|
|
1121
|
+
}
|
|
1122
|
+
const insertToArray = (target, el, before) => {
|
|
1123
|
+
if (before == null) {
|
|
1124
|
+
target.push(el);
|
|
1125
|
+
} else {
|
|
1126
|
+
target.splice(target.indexOf(before), 0, el);
|
|
1127
|
+
}
|
|
1128
|
+
return target;
|
|
1129
|
+
};
|
|
1130
|
+
const remoteFromArray = (target, index) => {
|
|
1131
|
+
const result = [...target];
|
|
1132
|
+
result.splice(index, 1);
|
|
1133
|
+
return result;
|
|
1134
|
+
};
|
|
1135
|
+
const insert = (context, parent, child, before = null) => {
|
|
1136
|
+
const currentParent = child.parent;
|
|
1137
|
+
const currentIndex = (currentParent == null ? void 0 : currentParent.children.indexOf(child)) ?? -1;
|
|
1138
|
+
attach(context, parent, child);
|
|
1139
|
+
let newChildren;
|
|
1140
|
+
const parentData = dataOf(context, parent);
|
|
1141
|
+
if (currentParent) {
|
|
1142
|
+
const currentParentData = dataOf(context, currentParent);
|
|
1143
|
+
const currentChildren = remoteFromArray(currentParentData.children, currentIndex);
|
|
1144
|
+
if (currentParent === parent) {
|
|
1145
|
+
newChildren = currentChildren;
|
|
1146
|
+
} else {
|
|
1147
|
+
currentParentData.children = capture(currentChildren, context.strict);
|
|
1148
|
+
newChildren = [...parentData.children];
|
|
1149
|
+
}
|
|
1150
|
+
} else {
|
|
1151
|
+
newChildren = [...parentData.children];
|
|
1152
|
+
}
|
|
1153
|
+
parentData.children = capture(insertToArray(newChildren, child, before), context.strict);
|
|
1154
|
+
};
|
|
1155
|
+
const appendChild = (context, parent, child) => {
|
|
1156
|
+
if (!context.nodes.has(child)) {
|
|
1157
|
+
throw new Error("Cannot append a node that was not created by this remote root");
|
|
1158
|
+
}
|
|
1159
|
+
const currentParent = child.parent;
|
|
1160
|
+
const currentIndex = (currentParent == null ? void 0 : currentParent.children.indexOf(child)) ?? -1;
|
|
1161
|
+
return update(context, parent, (channel) => {
|
|
1162
|
+
channel(
|
|
1163
|
+
ACTION_INSERT_CHILD,
|
|
1164
|
+
parent.id,
|
|
1165
|
+
currentIndex < 0 ? parent.children.length : parent.children.length - 1,
|
|
1166
|
+
child.serialize(),
|
|
1167
|
+
currentParent ? currentParent.id : false
|
|
1168
|
+
);
|
|
1169
|
+
}, () => insert(context, parent, child));
|
|
1170
|
+
};
|
|
1171
|
+
const insertBefore = (context, parent, child, before) => {
|
|
1172
|
+
if (!context.nodes.has(child)) {
|
|
1173
|
+
throw new Error("Cannot insert a node that was not created by this remote root");
|
|
1174
|
+
}
|
|
1175
|
+
if (before && before.id === child.id) return;
|
|
1176
|
+
if (before && !parent.children.includes(before)) {
|
|
1177
|
+
throw new DOMException(
|
|
1178
|
+
"Cannot add a child before an element that is not a child of the target parent.",
|
|
1179
|
+
"HierarchyRequestError"
|
|
1180
|
+
);
|
|
1181
|
+
}
|
|
1182
|
+
const oldIndex = parent.children.indexOf(child) ?? -1;
|
|
1183
|
+
const oldParent = child.parent;
|
|
1184
|
+
const beforeIndex = before ? parent.children.indexOf(before) : -1;
|
|
1185
|
+
return update(context, parent, (channel) => channel(
|
|
1186
|
+
ACTION_INSERT_CHILD,
|
|
1187
|
+
parent.id,
|
|
1188
|
+
beforeIndex < 0 ? parent.children.length : oldIndex < 0 || oldIndex > beforeIndex ? beforeIndex : beforeIndex - 1,
|
|
1189
|
+
child.serialize(),
|
|
1190
|
+
oldParent ? oldParent.id : false
|
|
1191
|
+
), () => insert(context, parent, child, before));
|
|
1192
|
+
};
|
|
1193
|
+
const removeChild = (context, parent, child) => {
|
|
1194
|
+
const data = dataOf(context, parent);
|
|
1195
|
+
return update(context, parent, (channel) => channel(
|
|
1196
|
+
ACTION_REMOVE_CHILD,
|
|
1197
|
+
parent.id,
|
|
1198
|
+
parent.children.indexOf(child)
|
|
1199
|
+
), () => {
|
|
1200
|
+
detach(context, child);
|
|
1201
|
+
data.children = capture(remoteFromArray(
|
|
1202
|
+
data.children,
|
|
1203
|
+
data.children.indexOf(child)
|
|
1204
|
+
), context.strict);
|
|
1205
|
+
});
|
|
1206
|
+
};
|
|
1207
|
+
const addAttachMethod = (context) => addMethod(context, "attach", (parent, node) => attach(context, parent, node));
|
|
1208
|
+
const addDetachMethod = (context) => addMethod(context, "detach", (node) => detach(context, node));
|
|
1209
|
+
const addAppendMethod$1 = (context) => addMethod(context, "append", (parent, children) => {
|
|
1210
|
+
for (const child of children) {
|
|
1211
|
+
appendChild(context, parent, child);
|
|
1212
|
+
}
|
|
1213
|
+
});
|
|
1214
|
+
const addUpdateMethod = (context) => addMethod(context, "update", (node, remote, local) => update(context, node, remote, local));
|
|
1215
|
+
const addReplaceMethod$1 = (context) => addMethod(context, "replace", (parent, children) => {
|
|
1216
|
+
for (const child of parent.children) {
|
|
1217
|
+
removeChild(context, parent, child);
|
|
1218
|
+
}
|
|
1219
|
+
for (const child of children) {
|
|
1220
|
+
appendChild(context, parent, child);
|
|
1221
|
+
}
|
|
1222
|
+
});
|
|
1223
|
+
const addCollectMethod = (context) => addMethod(context, "collect", (node) => {
|
|
1224
|
+
if (context.nodes.has(node)) {
|
|
1225
|
+
return;
|
|
1226
|
+
}
|
|
1227
|
+
context.nodes.add(node);
|
|
1228
|
+
Object.defineProperty(node, "parent", {
|
|
1229
|
+
get: () => context.parents.get(node) ?? null,
|
|
1230
|
+
configurable: true,
|
|
1231
|
+
enumerable: true
|
|
1232
|
+
});
|
|
1233
|
+
Object.defineProperty(node, "progenitor", {
|
|
1234
|
+
get: () => context.progenitors.get(node) ?? null,
|
|
1235
|
+
configurable: true,
|
|
1236
|
+
enumerable: true
|
|
1237
|
+
});
|
|
1238
|
+
});
|
|
1239
|
+
const addInvokeMethod = (context) => addMethod(context, "invoke", (node, method, payload) => {
|
|
1240
|
+
if (!context.nodes.has(node)) {
|
|
1241
|
+
throw new Error("Cannot invoke method for a node that was not created by this remote root");
|
|
1242
|
+
}
|
|
1243
|
+
return new Promise((resolve, reject) => {
|
|
1244
|
+
context.channel(
|
|
1245
|
+
ACTION_INVOKE,
|
|
1246
|
+
node.id,
|
|
1247
|
+
method,
|
|
1248
|
+
payload,
|
|
1249
|
+
resolve,
|
|
1250
|
+
reject
|
|
1251
|
+
);
|
|
1252
|
+
});
|
|
1253
|
+
});
|
|
1254
|
+
const createRemoteRootData = (channel, { components, strict = true } = {}) => {
|
|
1255
|
+
if (strict) {
|
|
1256
|
+
Object.freeze(components);
|
|
1257
|
+
}
|
|
1258
|
+
return {
|
|
1259
|
+
strict,
|
|
1260
|
+
mounted: false,
|
|
1261
|
+
channel,
|
|
1262
|
+
children: [],
|
|
1263
|
+
nodes: /* @__PURE__ */ new WeakSet(),
|
|
1264
|
+
parents: /* @__PURE__ */ new WeakMap(),
|
|
1265
|
+
progenitors: /* @__PURE__ */ new WeakMap(),
|
|
1266
|
+
components: /* @__PURE__ */ new WeakMap(),
|
|
1267
|
+
fragments: /* @__PURE__ */ new WeakMap()
|
|
1268
|
+
};
|
|
1269
|
+
};
|
|
1270
|
+
const createTreeContext = (channel, options = {}) => {
|
|
1271
|
+
const context = createRemoteRootData(channel, options);
|
|
1272
|
+
let lastId = 0;
|
|
1273
|
+
addMethod(context, "nextId", () => `${++lastId}`);
|
|
1274
|
+
addCollectMethod(context);
|
|
1275
|
+
addAttachMethod(context);
|
|
1276
|
+
addDetachMethod(context);
|
|
1277
|
+
addAppendMethod$1(context);
|
|
1278
|
+
addUpdateMethod(context);
|
|
1279
|
+
addMethod(context, "insert", (parent, child, before) => insertBefore(context, parent, child, before));
|
|
1280
|
+
addMethod(context, "removeChild", (parent, child) => removeChild(context, parent, child));
|
|
1281
|
+
addReplaceMethod$1(context);
|
|
1282
|
+
addInvokeMethod(context);
|
|
1283
|
+
return context;
|
|
1284
|
+
};
|
|
1285
|
+
const createRemoteComment = (content, root, context) => {
|
|
1286
|
+
const id = context.nextId();
|
|
1287
|
+
const data = { text: content };
|
|
1288
|
+
const node = {
|
|
1289
|
+
kind: KIND_COMMENT,
|
|
1290
|
+
get id() {
|
|
1291
|
+
return id;
|
|
1292
|
+
},
|
|
1293
|
+
get root() {
|
|
1294
|
+
return root;
|
|
1295
|
+
},
|
|
1296
|
+
get text() {
|
|
1297
|
+
return data.text;
|
|
1298
|
+
},
|
|
1299
|
+
update: (text) => context.update(
|
|
1300
|
+
node,
|
|
1301
|
+
(channel) => channel(ACTION_UPDATE_TEXT, node.id, text),
|
|
1302
|
+
() => data.text = text
|
|
1303
|
+
),
|
|
1304
|
+
serialize: () => ({ id, kind: KIND_COMMENT, text: data.text }),
|
|
1305
|
+
remove: () => {
|
|
1306
|
+
var _a;
|
|
1307
|
+
return (_a = node.parent) == null ? void 0 : _a.removeChild(node);
|
|
1308
|
+
},
|
|
1309
|
+
print: () => `Comment(${data.text})`
|
|
1310
|
+
};
|
|
1311
|
+
context.collect(node);
|
|
1312
|
+
return node;
|
|
1313
|
+
};
|
|
1314
|
+
const isProxy = (value) => {
|
|
1315
|
+
return value instanceof Function && "__current" in value;
|
|
1316
|
+
};
|
|
1317
|
+
const toProxy = (value) => {
|
|
1318
|
+
const _proxy = (...args) => {
|
|
1319
|
+
return _proxy.__current ? _proxy.__current(...args) : void 0;
|
|
1320
|
+
};
|
|
1321
|
+
Object.defineProperty(_proxy, "__current", {
|
|
1322
|
+
value,
|
|
1323
|
+
configurable: false,
|
|
1324
|
+
enumerable: false,
|
|
1325
|
+
writable: true
|
|
1326
|
+
});
|
|
1327
|
+
return _proxy;
|
|
1328
|
+
};
|
|
1329
|
+
function proxyFunctionsIn(value, visited = /* @__PURE__ */ new Map()) {
|
|
1330
|
+
if (visited.has(value)) {
|
|
1331
|
+
return visited.get(value);
|
|
1332
|
+
}
|
|
1333
|
+
if (isRemoteFragment(value)) {
|
|
1334
|
+
visited.set(value, value);
|
|
1335
|
+
return value;
|
|
1336
|
+
}
|
|
1337
|
+
if (Array.isArray(value)) {
|
|
1338
|
+
return visitArray(value, visited, proxyFunctionsIn);
|
|
1339
|
+
}
|
|
1340
|
+
if (isObject(value)) {
|
|
1341
|
+
return visitObject(value, visited, proxyFunctionsIn);
|
|
1342
|
+
}
|
|
1343
|
+
if (isFunction(value)) {
|
|
1344
|
+
const proxy = toProxy(value);
|
|
1345
|
+
visited.set(value, proxy);
|
|
1346
|
+
return proxy;
|
|
1347
|
+
}
|
|
1348
|
+
visited.set(value, value);
|
|
1349
|
+
return value;
|
|
1350
|
+
}
|
|
1351
|
+
const collectProxies = (value, visited = /* @__PURE__ */ new Set()) => {
|
|
1352
|
+
if (visited.has(value)) {
|
|
1353
|
+
return void 0;
|
|
1354
|
+
}
|
|
1355
|
+
visited.add(value);
|
|
1356
|
+
if (Array.isArray(value)) {
|
|
1357
|
+
return value.reduce((all, element) => {
|
|
1358
|
+
const nested = collectProxies(element, visited);
|
|
1359
|
+
return nested ? [...all, ...nested] : all;
|
|
1360
|
+
}, []);
|
|
1361
|
+
}
|
|
1362
|
+
if (isObject(value)) {
|
|
1363
|
+
return keysOf(value).reduce((all, key) => {
|
|
1364
|
+
const nested = collectProxies(value[key], visited);
|
|
1365
|
+
return nested ? [...all, ...nested] : all;
|
|
1366
|
+
}, []);
|
|
1367
|
+
}
|
|
1368
|
+
return isProxy(value) ? [value] : void 0;
|
|
1369
|
+
};
|
|
1370
|
+
const prepareProxiesUnset = (value) => {
|
|
1371
|
+
var _a;
|
|
1372
|
+
return ((_a = collectProxies(value)) == null ? void 0 : _a.map((p) => [p, void 0])) ?? [];
|
|
1373
|
+
};
|
|
1374
|
+
function prepareProxies(oldValue, newValue, visited = /* @__PURE__ */ new Set()) {
|
|
1375
|
+
if (visited.has(oldValue)) {
|
|
1376
|
+
return [oldValue, [], true];
|
|
1377
|
+
}
|
|
1378
|
+
visited.add(oldValue);
|
|
1379
|
+
if (isProxy(oldValue)) {
|
|
1380
|
+
return isFunction(newValue) ? [oldValue, [[oldValue, newValue]], true] : [proxyFunctionsIn(newValue), [], false];
|
|
1381
|
+
}
|
|
1382
|
+
if (Array.isArray(oldValue)) {
|
|
1383
|
+
return !Array.isArray(newValue) ? [proxyFunctionsIn(newValue), prepareProxiesUnset(oldValue), false] : prepareProxiesInArray(oldValue, newValue, visited);
|
|
1384
|
+
}
|
|
1385
|
+
if (isObject(oldValue) && !isRemoteFragment(oldValue)) {
|
|
1386
|
+
return !isObject(newValue) ? [proxyFunctionsIn(newValue), prepareProxiesUnset(oldValue), false] : prepareProxiesInObject(oldValue, newValue, visited);
|
|
1387
|
+
}
|
|
1388
|
+
return [newValue, [], oldValue === newValue];
|
|
1389
|
+
}
|
|
1390
|
+
function prepareProxiesInObject(oldValue, newValue, visited) {
|
|
1391
|
+
const normalized = {};
|
|
1392
|
+
const records = [];
|
|
1393
|
+
let changed = false;
|
|
1394
|
+
for (const key of keysOf(oldValue)) {
|
|
1395
|
+
const oldEl = oldValue[key];
|
|
1396
|
+
if (!(key in newValue)) {
|
|
1397
|
+
records.push(...prepareProxiesUnset(oldEl));
|
|
1398
|
+
changed = true;
|
|
1399
|
+
}
|
|
1400
|
+
const newEl = newValue[key];
|
|
1401
|
+
const [updated, record, skip] = prepareProxies(oldEl, newEl, visited);
|
|
1402
|
+
records.push(...record);
|
|
1403
|
+
if (!skip) {
|
|
1404
|
+
normalized[key] = updated;
|
|
1405
|
+
changed = true;
|
|
1406
|
+
}
|
|
1407
|
+
}
|
|
1408
|
+
for (const key of keysOf(newValue)) {
|
|
1409
|
+
if (!(key in normalized)) {
|
|
1410
|
+
normalized[key] = proxyFunctionsIn(newValue[key]);
|
|
1411
|
+
changed = true;
|
|
1412
|
+
}
|
|
1413
|
+
}
|
|
1414
|
+
return [normalized, records, !changed];
|
|
1415
|
+
}
|
|
1416
|
+
function prepareProxiesInArray(oldValue, newValue, visited) {
|
|
1417
|
+
const normalized = [];
|
|
1418
|
+
const records = [];
|
|
1419
|
+
let changed = false;
|
|
1420
|
+
for (let i = 0; i < Math.max(oldValue.length, newValue.length); i++) {
|
|
1421
|
+
const oldEl = oldValue[i];
|
|
1422
|
+
const newEl = newValue[i];
|
|
1423
|
+
if (i >= newValue.length) {
|
|
1424
|
+
records.push(...prepareProxiesUnset(oldEl));
|
|
1425
|
+
changed = true;
|
|
1426
|
+
continue;
|
|
1427
|
+
}
|
|
1428
|
+
if (i >= oldValue.length) {
|
|
1429
|
+
normalized[i] = proxyFunctionsIn(newEl);
|
|
1430
|
+
changed = true;
|
|
1431
|
+
continue;
|
|
1432
|
+
}
|
|
1433
|
+
const [updated, record, skip] = prepareProxies(oldEl, newEl, visited);
|
|
1434
|
+
records.push(...record);
|
|
1435
|
+
normalized[i] = skip ? oldEl : updated;
|
|
1436
|
+
changed = !skip || changed;
|
|
1437
|
+
}
|
|
1438
|
+
return [normalized, records, !changed];
|
|
1439
|
+
}
|
|
1440
|
+
const updateProxies = (records) => {
|
|
1441
|
+
for (const [fn, current] of records) {
|
|
1442
|
+
if (fn.__current !== current) {
|
|
1443
|
+
fn.__current = current;
|
|
1444
|
+
}
|
|
1445
|
+
}
|
|
1446
|
+
};
|
|
1447
|
+
function createRemoteComponent(type, properties, children, root, context) {
|
|
1448
|
+
const id = context.nextId();
|
|
1449
|
+
const descriptor = typeof type === "object" && "type" in type ? type : null;
|
|
1450
|
+
const data = createRemoteComponentData(properties, children, root, context);
|
|
1451
|
+
const node = {
|
|
1452
|
+
kind: KIND_COMPONENT,
|
|
1453
|
+
get id() {
|
|
1454
|
+
return id;
|
|
1455
|
+
},
|
|
1456
|
+
get type() {
|
|
1457
|
+
return descriptor ? descriptor.type : type;
|
|
1458
|
+
},
|
|
1459
|
+
get root() {
|
|
1460
|
+
return root;
|
|
1461
|
+
},
|
|
1462
|
+
get children() {
|
|
1463
|
+
return data.children;
|
|
1464
|
+
},
|
|
1465
|
+
get properties() {
|
|
1466
|
+
return data.properties.original;
|
|
1467
|
+
},
|
|
1468
|
+
append: (...children2) => context.append(
|
|
1469
|
+
node,
|
|
1470
|
+
normalizeChildren(children2, root)
|
|
1471
|
+
),
|
|
1472
|
+
insertBefore: (child, before) => context.insert(
|
|
1473
|
+
node,
|
|
1474
|
+
normalizeChild(child, root),
|
|
1475
|
+
before
|
|
1476
|
+
),
|
|
1477
|
+
updateProperties: (properties2) => updateProperties(
|
|
1478
|
+
context,
|
|
1479
|
+
node,
|
|
1480
|
+
properties2
|
|
1481
|
+
),
|
|
1482
|
+
replace: (...children2) => context.replace(
|
|
1483
|
+
node,
|
|
1484
|
+
normalizeChildren(children2, root)
|
|
1485
|
+
),
|
|
1486
|
+
removeChild: (child) => context.removeChild(node, child),
|
|
1487
|
+
remove: () => node.parent ? context.removeChild(node.parent, node) : null,
|
|
1488
|
+
invoke: (method, ...payload) => !descriptor || (descriptor == null ? void 0 : descriptor.hasMethod(method)) ? context.invoke(node, method, payload) : Promise.reject(`Method ${method} is not supported`),
|
|
1489
|
+
serialize: () => ({
|
|
1490
|
+
id,
|
|
1491
|
+
kind: KIND_COMPONENT,
|
|
1492
|
+
type,
|
|
1493
|
+
properties: data.properties.serializable,
|
|
1494
|
+
children: data.children.map((c) => c.serialize())
|
|
1495
|
+
}),
|
|
1496
|
+
print: () => _print(id, type, data.properties.original, data.children)
|
|
1497
|
+
};
|
|
1498
|
+
context.collect(node);
|
|
1499
|
+
context.components.set(node, data);
|
|
1500
|
+
data.children.forEach((c) => context.attach(node, c));
|
|
1501
|
+
return node;
|
|
1502
|
+
}
|
|
1503
|
+
const RESERVED = ["children"];
|
|
1504
|
+
const notReserved = (name) => !RESERVED.includes(name);
|
|
1505
|
+
function createRemoteComponentData(properties, children, root, context) {
|
|
1506
|
+
const original = properties ?? {};
|
|
1507
|
+
const serializable = {};
|
|
1508
|
+
for (const key of keysOf(original).filter(notReserved)) {
|
|
1509
|
+
serializable[key] = proxyFunctionsIn(serializeProperty(original[key]));
|
|
1510
|
+
}
|
|
1511
|
+
return {
|
|
1512
|
+
properties: {
|
|
1513
|
+
original: capture(original, context.strict),
|
|
1514
|
+
serializable
|
|
1515
|
+
},
|
|
1516
|
+
children: capture(normalizeChildren(children, root), context.strict)
|
|
1517
|
+
};
|
|
1518
|
+
}
|
|
1519
|
+
function updateProperties(context, component, properties) {
|
|
1520
|
+
const componentData = context.components.get(component);
|
|
1521
|
+
const normalized = {};
|
|
1522
|
+
const records = [];
|
|
1523
|
+
let changed = false;
|
|
1524
|
+
for (const key of keysOf(properties).filter(notReserved)) {
|
|
1525
|
+
const oldOriginal = componentData.properties.original[key];
|
|
1526
|
+
const newOriginal = properties[key];
|
|
1527
|
+
const oldSerializable = componentData.properties.serializable[key];
|
|
1528
|
+
const newSerializable = serializeProperty(newOriginal);
|
|
1529
|
+
if (oldSerializable === newSerializable && (newSerializable == null || typeof newSerializable !== "object")) {
|
|
1530
|
+
continue;
|
|
1531
|
+
}
|
|
1532
|
+
const [value, record, skip] = prepareProxies(oldSerializable, newSerializable);
|
|
1533
|
+
records.push(...record);
|
|
1534
|
+
if (!skip) {
|
|
1535
|
+
normalized[key] = value;
|
|
1536
|
+
changed = true;
|
|
1537
|
+
if (isRemoteFragment(oldOriginal)) {
|
|
1538
|
+
context.detach(oldOriginal);
|
|
1539
|
+
}
|
|
1540
|
+
if (isRemoteFragment(newOriginal)) {
|
|
1541
|
+
context.attach(component, newOriginal);
|
|
1542
|
+
}
|
|
1543
|
+
}
|
|
1544
|
+
}
|
|
1545
|
+
return context.update(component, (channel) => {
|
|
1546
|
+
if (changed) {
|
|
1547
|
+
channel(ACTION_UPDATE_PROPERTIES, component.id, normalized);
|
|
1548
|
+
}
|
|
1549
|
+
}, () => {
|
|
1550
|
+
componentData.properties.original = capture({ ...componentData.properties.original, ...properties }, context.strict);
|
|
1551
|
+
componentData.properties.serializable = { ...componentData.properties.serializable, ...normalized };
|
|
1552
|
+
updateProxies(records);
|
|
1553
|
+
});
|
|
1554
|
+
}
|
|
1555
|
+
function serializeProperty(property) {
|
|
1556
|
+
return isRemoteFragment(property) ? property.serialize() : property;
|
|
1557
|
+
}
|
|
1558
|
+
function _print(id, type, _properties, children) {
|
|
1559
|
+
const _head = `${typeof type === "string" ? type : type.type}:${id}`;
|
|
1560
|
+
const _children = children.map((c) => typeof c === "string" ? c : c.print());
|
|
1561
|
+
const _body = _children.length > 0 ? `
|
|
1562
|
+
${_indent(_children.join(",\n"))}
|
|
1563
|
+
` : "";
|
|
1564
|
+
return `${_head}[${_body}]`;
|
|
1565
|
+
}
|
|
1566
|
+
function _indent(text) {
|
|
1567
|
+
return text.split("\n").map((line) => ` ${line}`).join("\n");
|
|
1568
|
+
}
|
|
1569
|
+
const createRemoteFragment = (root, context) => {
|
|
1570
|
+
const id = context.nextId();
|
|
1571
|
+
const data = { children: capture([], context.strict) };
|
|
1572
|
+
const fragment = {
|
|
1573
|
+
kind: KIND_FRAGMENT,
|
|
1574
|
+
get id() {
|
|
1575
|
+
return id;
|
|
1576
|
+
},
|
|
1577
|
+
get root() {
|
|
1578
|
+
return root;
|
|
1579
|
+
},
|
|
1580
|
+
get children() {
|
|
1581
|
+
return data.children;
|
|
1582
|
+
},
|
|
1583
|
+
append: (...children) => context.append(fragment, normalizeChildren(children, root)),
|
|
1584
|
+
insertBefore: (child, before) => context.insert(
|
|
1585
|
+
fragment,
|
|
1586
|
+
normalizeChild(child, root),
|
|
1587
|
+
before
|
|
1588
|
+
),
|
|
1589
|
+
replace: (...children) => context.replace(fragment, normalizeChildren(children, root)),
|
|
1590
|
+
removeChild: (child) => context.removeChild(fragment, child),
|
|
1591
|
+
serialize: () => ({
|
|
1592
|
+
id,
|
|
1593
|
+
kind: KIND_FRAGMENT,
|
|
1594
|
+
children: data.children.map((c) => c.serialize())
|
|
1595
|
+
})
|
|
1596
|
+
};
|
|
1597
|
+
context.collect(fragment);
|
|
1598
|
+
context.fragments.set(fragment, data);
|
|
1599
|
+
return fragment;
|
|
1600
|
+
};
|
|
1601
|
+
const createRemoteText = (content, root, context) => {
|
|
1602
|
+
const id = context.nextId();
|
|
1603
|
+
const data = { text: content };
|
|
1604
|
+
const node = {
|
|
1605
|
+
kind: KIND_TEXT,
|
|
1606
|
+
get id() {
|
|
1607
|
+
return id;
|
|
1608
|
+
},
|
|
1609
|
+
get root() {
|
|
1610
|
+
return root;
|
|
1611
|
+
},
|
|
1612
|
+
get text() {
|
|
1613
|
+
return data.text;
|
|
1614
|
+
},
|
|
1615
|
+
update: (text) => context.update(
|
|
1616
|
+
node,
|
|
1617
|
+
(channel) => channel(ACTION_UPDATE_TEXT, node.id, text),
|
|
1618
|
+
() => data.text = text
|
|
1619
|
+
),
|
|
1620
|
+
serialize: () => ({ id, kind: KIND_TEXT, text: data.text }),
|
|
1621
|
+
remove: () => {
|
|
1622
|
+
var _a;
|
|
1623
|
+
return (_a = node.parent) == null ? void 0 : _a.removeChild(node);
|
|
1624
|
+
},
|
|
1625
|
+
print: () => `Text(${data.text})`
|
|
1626
|
+
};
|
|
1627
|
+
context.collect(node);
|
|
1628
|
+
return node;
|
|
1629
|
+
};
|
|
1630
|
+
function createRemoteRoot$1(channel, {
|
|
1631
|
+
components,
|
|
1632
|
+
strict = true
|
|
1633
|
+
} = {}) {
|
|
1634
|
+
const context = createTreeContext(channel, {
|
|
1635
|
+
components,
|
|
1636
|
+
strict
|
|
1637
|
+
});
|
|
1638
|
+
const root = {
|
|
1639
|
+
kind: KIND_ROOT,
|
|
1640
|
+
options: capture({ strict, components }, strict),
|
|
1641
|
+
get id() {
|
|
1642
|
+
return ROOT_ID;
|
|
1643
|
+
},
|
|
1644
|
+
get children() {
|
|
1645
|
+
return context.children;
|
|
1646
|
+
},
|
|
1647
|
+
removeChild: (child) => context.removeChild(root, child)
|
|
1648
|
+
};
|
|
1649
|
+
addCreateCommentMethod(root, context);
|
|
1650
|
+
addCreateComponentMethod(root, context);
|
|
1651
|
+
addCreateFragmentMethod(root, context);
|
|
1652
|
+
addCreateTextMethod(root, context);
|
|
1653
|
+
addMountMethod(root, context);
|
|
1654
|
+
addAppendMethod(root, context);
|
|
1655
|
+
addInsertMethod(root, context);
|
|
1656
|
+
addReplaceMethod(root, context);
|
|
1657
|
+
return root;
|
|
1658
|
+
}
|
|
1659
|
+
function addCreateCommentMethod(root, context) {
|
|
1660
|
+
addMethod(root, "createComment", (text = "") => {
|
|
1661
|
+
return createRemoteComment(text, root, context);
|
|
1662
|
+
});
|
|
1663
|
+
}
|
|
1664
|
+
function addCreateComponentMethod(root, context) {
|
|
1665
|
+
addMethod(root, "createComponent", (type, ...rest) => {
|
|
1666
|
+
const components = root.options.components;
|
|
1667
|
+
if (components && !components.some((c) => c === type || c.type === type)) {
|
|
1668
|
+
throw new Error(`Unsupported component: ${type}`);
|
|
1669
|
+
}
|
|
1670
|
+
const _type = (components == null ? void 0 : components.find((c) => c === type || c.type === type)) ?? type;
|
|
1671
|
+
const [properties, children, ...restChildren] = rest;
|
|
1672
|
+
return createRemoteComponent(_type, properties, [
|
|
1673
|
+
...arraify(children ?? []),
|
|
1674
|
+
...restChildren
|
|
1675
|
+
], root, context);
|
|
1676
|
+
});
|
|
1677
|
+
}
|
|
1678
|
+
function addCreateFragmentMethod(root, context) {
|
|
1679
|
+
addMethod(root, "createFragment", () => createRemoteFragment(root, context));
|
|
1680
|
+
}
|
|
1681
|
+
function addCreateTextMethod(root, context) {
|
|
1682
|
+
addMethod(root, "createText", (text = "") => {
|
|
1683
|
+
return createRemoteText(text, root, context);
|
|
1684
|
+
});
|
|
1685
|
+
}
|
|
1686
|
+
function addMountMethod(root, context) {
|
|
1687
|
+
addMethod(root, "mount", () => {
|
|
1688
|
+
if (context.mounted) {
|
|
1689
|
+
return Promise.resolve();
|
|
1690
|
+
}
|
|
1691
|
+
context.mounted = true;
|
|
1692
|
+
return Promise.resolve(context.channel(
|
|
1693
|
+
ACTION_MOUNT,
|
|
1694
|
+
context.children.map((c) => c.serialize())
|
|
1695
|
+
));
|
|
1696
|
+
});
|
|
1697
|
+
}
|
|
1698
|
+
function addAppendMethod(root, context) {
|
|
1699
|
+
addMethod(root, "append", (...children) => {
|
|
1700
|
+
context.append(root, normalizeChildren(children, root));
|
|
1701
|
+
});
|
|
1702
|
+
}
|
|
1703
|
+
function addInsertMethod(root, context) {
|
|
1704
|
+
addMethod(root, "insertBefore", (child, before) => {
|
|
1705
|
+
context.insert(root, normalizeChild(child, root), before);
|
|
1706
|
+
});
|
|
1707
|
+
}
|
|
1708
|
+
function addReplaceMethod(root, context) {
|
|
1709
|
+
addMethod(root, "replace", (...children) => {
|
|
1710
|
+
context.replace(root, normalizeChildren(children, root));
|
|
1711
|
+
});
|
|
1712
|
+
}
|
|
1713
|
+
const createRemoteRoot = (channel, options = {}) => createRemoteRoot$1(channel, {
|
|
1714
|
+
...options,
|
|
1715
|
+
components: [
|
|
1716
|
+
...HTMLTagList,
|
|
1717
|
+
...MathMLTagList,
|
|
1718
|
+
...SVGTagList,
|
|
1719
|
+
REMOTE_SLOT,
|
|
1720
|
+
...options.components ?? []
|
|
1721
|
+
]
|
|
1722
|
+
});
|
|
1723
|
+
const toRemoteSlots = (named, slots) => {
|
|
1724
|
+
const actual = named.filter((slotName) => slotName in slots);
|
|
1725
|
+
if (actual.length === 0) {
|
|
1726
|
+
return slots;
|
|
1727
|
+
}
|
|
1728
|
+
return {
|
|
1729
|
+
default: () => {
|
|
1730
|
+
var _a;
|
|
1731
|
+
return [
|
|
1732
|
+
..."default" in slots ? [(_a = slots.default) == null ? void 0 : _a.call(slots)] : [],
|
|
1733
|
+
...actual.map((slotName) => vue.h(REMOTE_SLOT, { name: slotName }, {
|
|
1734
|
+
default: slots[slotName]
|
|
1735
|
+
}))
|
|
1736
|
+
];
|
|
1737
|
+
}
|
|
1738
|
+
};
|
|
1739
|
+
};
|
|
1740
|
+
const capitalize = (text) => text.charAt(0).toUpperCase() + text.slice(1);
|
|
1741
|
+
const fallthroughEvents = (emits, emit) => {
|
|
1742
|
+
if (emits === void 0) {
|
|
1743
|
+
return {};
|
|
1744
|
+
}
|
|
1745
|
+
const events2 = Array.isArray(emits) ? emits : Object.keys(emits);
|
|
1746
|
+
return events2.reduce((processed, event) => {
|
|
1747
|
+
processed["on" + capitalize(event)] = (...args) => emit(event, ...args);
|
|
1748
|
+
return processed;
|
|
1749
|
+
}, {});
|
|
1750
|
+
};
|
|
1751
|
+
const defineRemoteComponent = (type, emits = void 0, slots = []) => vue.defineComponent({
|
|
1752
|
+
name: type,
|
|
1753
|
+
inheritAttrs: false,
|
|
1754
|
+
...emits ? { emits } : {},
|
|
1755
|
+
setup(props, { attrs, emit, slots: internalSlots }) {
|
|
1756
|
+
return () => vue.h(type, {
|
|
1757
|
+
...props,
|
|
1758
|
+
...attrs,
|
|
1759
|
+
...fallthroughEvents(emits, emit)
|
|
1760
|
+
}, toRemoteSlots(slots, internalSlots));
|
|
1761
|
+
}
|
|
1762
|
+
});
|
|
1763
|
+
const UiAddButtonType = "UiAddButton";
|
|
1764
|
+
defineRemoteComponent(
|
|
1765
|
+
UiAddButtonType,
|
|
1766
|
+
["click", "focus", "blur"],
|
|
1767
|
+
[
|
|
1768
|
+
"icon",
|
|
1769
|
+
"description"
|
|
1770
|
+
]
|
|
1771
|
+
);
|
|
1772
|
+
const UiAlertType = "UiAlert";
|
|
1773
|
+
defineRemoteComponent(
|
|
1774
|
+
UiAlertType,
|
|
1775
|
+
[
|
|
1776
|
+
"showing",
|
|
1777
|
+
"shown",
|
|
1778
|
+
"hiding",
|
|
1779
|
+
"hidden"
|
|
1780
|
+
]
|
|
1781
|
+
);
|
|
1782
|
+
const UiAvatarType = "UiAvatar";
|
|
1783
|
+
defineRemoteComponent(UiAvatarType);
|
|
1784
|
+
const UiAvatarListType = "UiAvatarList";
|
|
1785
|
+
defineRemoteComponent(UiAvatarListType);
|
|
1786
|
+
const UiButtonType = "UiButton";
|
|
1787
|
+
defineRemoteComponent(
|
|
1788
|
+
UiButtonType,
|
|
1789
|
+
["click", "focus", "blur"]
|
|
1790
|
+
);
|
|
1791
|
+
const UiCalendarType = "UiCalendar";
|
|
1792
|
+
defineRemoteComponent(
|
|
1793
|
+
UiCalendarType,
|
|
1794
|
+
[
|
|
1795
|
+
"change",
|
|
1796
|
+
"update:value"
|
|
1797
|
+
]
|
|
1798
|
+
);
|
|
1799
|
+
const UiCheckboxType = "UiCheckbox";
|
|
1800
|
+
defineRemoteComponent(
|
|
1801
|
+
UiCheckboxType,
|
|
1802
|
+
["click", "focus", "blur"]
|
|
1803
|
+
);
|
|
1804
|
+
const UiCollapseType = "UiCollapse";
|
|
1805
|
+
defineRemoteComponent(
|
|
1806
|
+
UiCollapseType,
|
|
1807
|
+
[
|
|
1808
|
+
"collapsed",
|
|
1809
|
+
"collapsing",
|
|
1810
|
+
"expanded",
|
|
1811
|
+
"expanding"
|
|
1812
|
+
],
|
|
1813
|
+
[
|
|
1814
|
+
"default"
|
|
1815
|
+
]
|
|
1816
|
+
);
|
|
1817
|
+
const UiCollapseBoxType = "UiCollapseBox";
|
|
1818
|
+
defineRemoteComponent(
|
|
1819
|
+
UiCollapseBoxType,
|
|
1820
|
+
[
|
|
1821
|
+
"collapsed",
|
|
1822
|
+
"collapse-cancel",
|
|
1823
|
+
"expanded",
|
|
1824
|
+
"expand-cancel",
|
|
1825
|
+
"toggle",
|
|
1826
|
+
"update:expanded"
|
|
1827
|
+
],
|
|
1828
|
+
[
|
|
1829
|
+
"icon",
|
|
1830
|
+
"title",
|
|
1831
|
+
"description",
|
|
1832
|
+
"body",
|
|
1833
|
+
"body-content",
|
|
1834
|
+
"footer",
|
|
1835
|
+
"footer-content"
|
|
1836
|
+
]
|
|
1837
|
+
);
|
|
1838
|
+
const UiCollapseGroupType = "UiCollapseGroup";
|
|
1839
|
+
defineRemoteComponent(
|
|
1840
|
+
UiCollapseGroupType,
|
|
1841
|
+
[
|
|
1842
|
+
"expand-cancelled",
|
|
1843
|
+
"expanded",
|
|
1844
|
+
"update:activeBoxId"
|
|
1845
|
+
],
|
|
1846
|
+
[
|
|
1847
|
+
"default"
|
|
1848
|
+
]
|
|
1849
|
+
);
|
|
1850
|
+
const UiCopyButtonType = "UiCopyButton";
|
|
1851
|
+
defineRemoteComponent(
|
|
1852
|
+
UiCopyButtonType,
|
|
1853
|
+
["click", "focus", "blur"],
|
|
1854
|
+
[
|
|
1855
|
+
"trigger",
|
|
1856
|
+
"hint",
|
|
1857
|
+
"hint-copied"
|
|
1858
|
+
]
|
|
1859
|
+
);
|
|
1860
|
+
const UiDateType = "UiDate";
|
|
1861
|
+
defineRemoteComponent(UiDateType);
|
|
1862
|
+
const UiDatePickerType = "UiDatePicker";
|
|
1863
|
+
defineRemoteComponent(
|
|
1864
|
+
UiDatePickerType,
|
|
1865
|
+
[
|
|
1866
|
+
"open",
|
|
1867
|
+
"close",
|
|
1868
|
+
"change",
|
|
1869
|
+
"update:value"
|
|
1870
|
+
]
|
|
1871
|
+
);
|
|
1872
|
+
const UiErrorType = "UiError";
|
|
1873
|
+
defineRemoteComponent(
|
|
1874
|
+
UiErrorType,
|
|
1875
|
+
["click", "focus", "blur"]
|
|
1876
|
+
);
|
|
1877
|
+
const UiPopperType = "UiPopper";
|
|
1878
|
+
defineRemoteComponent(UiPopperType);
|
|
1879
|
+
const UiPopperConnectorType = "UiPopperConnector";
|
|
1880
|
+
const UiPopperConnector = defineRemoteComponent(UiPopperConnectorType);
|
|
1881
|
+
const UiPopperTargetType = "UiPopperTarget";
|
|
1882
|
+
defineRemoteComponent(UiPopperTargetType);
|
|
1883
|
+
const UiTooltipType = "UiTooltip";
|
|
1884
|
+
defineRemoteComponent(UiTooltipType);
|
|
1885
|
+
const UiInfoboxType = "UiInfobox";
|
|
1886
|
+
defineRemoteComponent(
|
|
1887
|
+
UiInfoboxType,
|
|
1888
|
+
[
|
|
1889
|
+
"show",
|
|
1890
|
+
"hide",
|
|
1891
|
+
"update:expanded",
|
|
1892
|
+
"update:shown"
|
|
1893
|
+
],
|
|
1894
|
+
[
|
|
1895
|
+
"icon",
|
|
1896
|
+
"title",
|
|
1897
|
+
"toggle",
|
|
1898
|
+
"default"
|
|
1899
|
+
]
|
|
1900
|
+
);
|
|
1901
|
+
const UiLinkType = "UiLink";
|
|
1902
|
+
defineRemoteComponent(
|
|
1903
|
+
UiLinkType,
|
|
1904
|
+
["click", "focus", "blur"],
|
|
1905
|
+
["icon"]
|
|
1906
|
+
);
|
|
1907
|
+
const UiLoaderType = "UiLoader";
|
|
1908
|
+
defineRemoteComponent(
|
|
1909
|
+
UiLoaderType,
|
|
1910
|
+
["click", "focus", "blur"]
|
|
1911
|
+
);
|
|
1912
|
+
const UiModalSidebarType = "UiModalSidebar";
|
|
1913
|
+
defineRemoteComponent(
|
|
1914
|
+
UiModalSidebarType,
|
|
1915
|
+
[
|
|
1916
|
+
"open",
|
|
1917
|
+
"close",
|
|
1918
|
+
"close-cancel",
|
|
1919
|
+
"toggle",
|
|
1920
|
+
"shown",
|
|
1921
|
+
"showing",
|
|
1922
|
+
"hidden",
|
|
1923
|
+
"hiding",
|
|
1924
|
+
"update:opened",
|
|
1925
|
+
"update:overlapped",
|
|
1926
|
+
"scroll:y:end"
|
|
1927
|
+
],
|
|
1928
|
+
[
|
|
1929
|
+
"title",
|
|
1930
|
+
"footer"
|
|
1931
|
+
]
|
|
1932
|
+
);
|
|
1933
|
+
const UiModalWindowType = "UiModalWindow";
|
|
1934
|
+
defineRemoteComponent(
|
|
1935
|
+
UiModalWindowType,
|
|
1936
|
+
[
|
|
1937
|
+
"open",
|
|
1938
|
+
"opened",
|
|
1939
|
+
"close",
|
|
1940
|
+
"close-cancel",
|
|
1941
|
+
"closed",
|
|
1942
|
+
"container:scroll:y",
|
|
1943
|
+
"container:scroll:y:end",
|
|
1944
|
+
"content:scroll:y:end",
|
|
1945
|
+
"toggle",
|
|
1946
|
+
"update:opened"
|
|
1947
|
+
],
|
|
1948
|
+
[
|
|
1949
|
+
"icon",
|
|
1950
|
+
"title",
|
|
1951
|
+
"footer"
|
|
1952
|
+
]
|
|
1953
|
+
);
|
|
1954
|
+
const UiModalWindowSurfaceType = "UiModalWindowSurface";
|
|
1955
|
+
defineRemoteComponent(
|
|
1956
|
+
UiModalWindowSurfaceType,
|
|
1957
|
+
[
|
|
1958
|
+
"open",
|
|
1959
|
+
"close",
|
|
1960
|
+
"close-cancel",
|
|
1961
|
+
"shown",
|
|
1962
|
+
"showing",
|
|
1963
|
+
"hidden",
|
|
1964
|
+
"hiding",
|
|
1965
|
+
"scroll:y",
|
|
1966
|
+
"scroll:y:end",
|
|
1967
|
+
"update:opened",
|
|
1968
|
+
"update:overlapped"
|
|
1969
|
+
]
|
|
1970
|
+
);
|
|
1971
|
+
const UiNumberStepperType = "UiNumberStepper";
|
|
1972
|
+
defineRemoteComponent(
|
|
1973
|
+
UiNumberStepperType,
|
|
1974
|
+
[
|
|
1975
|
+
"change",
|
|
1976
|
+
"update:value",
|
|
1977
|
+
"focus",
|
|
1978
|
+
"blur",
|
|
1979
|
+
"increase",
|
|
1980
|
+
"decrease",
|
|
1981
|
+
"violation"
|
|
1982
|
+
]
|
|
1983
|
+
);
|
|
1984
|
+
const UiRadioType = "UiRadio";
|
|
1985
|
+
defineRemoteComponent(
|
|
1986
|
+
UiRadioType,
|
|
1987
|
+
["click", "focus", "blur"]
|
|
1988
|
+
);
|
|
1989
|
+
const UiScrollBoxType = "UiScrollBox";
|
|
1990
|
+
defineRemoteComponent(
|
|
1991
|
+
UiScrollBoxType,
|
|
1992
|
+
[
|
|
1993
|
+
"click",
|
|
1994
|
+
"focus",
|
|
1995
|
+
"blur",
|
|
1996
|
+
"ps-y-reach-start",
|
|
1997
|
+
"ps-y-reach-end"
|
|
1998
|
+
]
|
|
1999
|
+
);
|
|
2000
|
+
const UiSliderType = "UiSlider";
|
|
2001
|
+
defineRemoteComponent(
|
|
2002
|
+
UiSliderType,
|
|
2003
|
+
["update:value"]
|
|
2004
|
+
);
|
|
2005
|
+
const UiSwitchType = "UiSwitch";
|
|
2006
|
+
defineRemoteComponent(
|
|
2007
|
+
UiSwitchType,
|
|
2008
|
+
["click", "focus", "blur"]
|
|
2009
|
+
);
|
|
2010
|
+
const UiTagType = "UiTag";
|
|
2011
|
+
defineRemoteComponent(
|
|
2012
|
+
UiTagType,
|
|
2013
|
+
["click", "focus", "blur", "remove"]
|
|
2014
|
+
);
|
|
2015
|
+
var SIZE$1 = /* @__PURE__ */ ((SIZE2) => {
|
|
2016
|
+
SIZE2["XS"] = "xs";
|
|
2017
|
+
SIZE2["SM"] = "sm";
|
|
2018
|
+
SIZE2["MD"] = "md";
|
|
2019
|
+
SIZE2["LG"] = "lg";
|
|
2020
|
+
SIZE2["XL"] = "xl";
|
|
2021
|
+
return SIZE2;
|
|
2022
|
+
})(SIZE$1 || {});
|
|
2023
|
+
const events = [
|
|
2024
|
+
"input",
|
|
2025
|
+
"keydown",
|
|
2026
|
+
"change",
|
|
2027
|
+
"paste",
|
|
2028
|
+
"focus",
|
|
2029
|
+
"blur",
|
|
2030
|
+
"update:focused",
|
|
2031
|
+
"update:value",
|
|
2032
|
+
"clear"
|
|
2033
|
+
];
|
|
2034
|
+
const UiTextboxType = "UiTextbox";
|
|
2035
|
+
defineRemoteComponent(
|
|
2036
|
+
UiTextboxType,
|
|
2037
|
+
events
|
|
2038
|
+
);
|
|
2039
|
+
const UiTimePickerType = "UiTimePicker";
|
|
2040
|
+
defineRemoteComponent(
|
|
2041
|
+
UiTimePickerType,
|
|
2042
|
+
[
|
|
2043
|
+
"change",
|
|
2044
|
+
"update:value",
|
|
2045
|
+
"focus",
|
|
2046
|
+
"blur"
|
|
2047
|
+
]
|
|
2048
|
+
);
|
|
2049
|
+
const UiToolbarButtonType = "UiToolbarButton";
|
|
2050
|
+
defineRemoteComponent(
|
|
2051
|
+
UiToolbarButtonType,
|
|
2052
|
+
["click", "focus", "blur"]
|
|
2053
|
+
);
|
|
2054
|
+
const UiToolbarLinkType = "UiToolbarLink";
|
|
2055
|
+
defineRemoteComponent(
|
|
2056
|
+
UiToolbarLinkType,
|
|
2057
|
+
["click", "focus", "blur"]
|
|
2058
|
+
);
|
|
2059
|
+
const UiTransitionType = "UiTransition";
|
|
2060
|
+
defineRemoteComponent(UiTransitionType);
|
|
2061
|
+
const UiYandexMapType = "UiYandexMap";
|
|
2062
|
+
defineRemoteComponent(
|
|
2063
|
+
UiYandexMapType,
|
|
2064
|
+
[
|
|
2065
|
+
"change",
|
|
2066
|
+
"update:address"
|
|
2067
|
+
]
|
|
2068
|
+
);
|
|
2069
|
+
const UiMenuItemType = "UiMenuItem";
|
|
2070
|
+
const UiMenuItem = defineRemoteComponent(
|
|
2071
|
+
UiMenuItemType,
|
|
2072
|
+
[],
|
|
2073
|
+
[
|
|
2074
|
+
"default",
|
|
2075
|
+
"avatar",
|
|
2076
|
+
"leading-icon",
|
|
2077
|
+
"description",
|
|
2078
|
+
"trailing-icon"
|
|
2079
|
+
]
|
|
2080
|
+
);
|
|
2081
|
+
const UiMenuItemGroupType = "UiMenuItemGroup";
|
|
2082
|
+
defineRemoteComponent(
|
|
2083
|
+
UiMenuItemGroupType,
|
|
2084
|
+
[],
|
|
2085
|
+
[
|
|
2086
|
+
"default",
|
|
2087
|
+
"option",
|
|
2088
|
+
"label",
|
|
2089
|
+
"quantity"
|
|
2090
|
+
]
|
|
2091
|
+
);
|
|
2092
|
+
const pluralization_en_GB = (choice) => choice === 1 ? 0 : 1;
|
|
2093
|
+
const pluralization_es_ES = (choice) => choice === 1 ? 0 : 1;
|
|
2094
|
+
const pluralization_ru_RU = (choice, choicesLength) => {
|
|
2095
|
+
if (choicesLength === 2) {
|
|
2096
|
+
return choice === 1 ? 0 : 1;
|
|
2097
|
+
}
|
|
2098
|
+
const mod100 = choice % 100;
|
|
2099
|
+
return mod100 % 10 === 1 && mod100 !== 11 ? 0 : mod100 % 10 >= 2 && mod100 % 10 <= 4 && !(mod100 >= 10 && mod100 < 15) ? 1 : 2;
|
|
2100
|
+
};
|
|
2101
|
+
const get = (messages, path) => {
|
|
2102
|
+
let i = 0;
|
|
2103
|
+
let slice = messages[path[0]];
|
|
2104
|
+
while (i < path.length) {
|
|
2105
|
+
if (typeof slice === "string" && i + 1 === path.length) {
|
|
2106
|
+
return slice;
|
|
2107
|
+
}
|
|
2108
|
+
if (typeof slice !== "object") {
|
|
2109
|
+
return void 0;
|
|
2110
|
+
}
|
|
2111
|
+
slice = slice[path[++i]];
|
|
2112
|
+
}
|
|
2113
|
+
return slice;
|
|
2114
|
+
};
|
|
2115
|
+
const replace = (message, values) => {
|
|
2116
|
+
return Object.keys(values).reduce((message2, key) => {
|
|
2117
|
+
const pattern = new RegExp(`\\{${key}\\}`, "g");
|
|
2118
|
+
const replacement = String(values[key]);
|
|
2119
|
+
return message2.replace(pattern, replacement);
|
|
2120
|
+
}, message);
|
|
2121
|
+
};
|
|
2122
|
+
const compile = (messages, path, values = void 0) => {
|
|
2123
|
+
const message = get(messages, path);
|
|
2124
|
+
if (typeof message === "string" && values) {
|
|
2125
|
+
return replace(message, values);
|
|
2126
|
+
}
|
|
2127
|
+
return message;
|
|
2128
|
+
};
|
|
2129
|
+
const fail = (message) => {
|
|
2130
|
+
throw new Error(message);
|
|
2131
|
+
};
|
|
2132
|
+
const t = (locale, messages, path, values = void 0) => {
|
|
2133
|
+
const keys = path.split(".");
|
|
2134
|
+
if (locale) {
|
|
2135
|
+
const message = compile(messages[locale] ?? {}, keys, values);
|
|
2136
|
+
return typeof message !== "object" ? message : fail(`Translation for "${locale}:${path}" is not translatable`);
|
|
2137
|
+
}
|
|
2138
|
+
return void 0;
|
|
2139
|
+
};
|
|
2140
|
+
const plural = (template, choice, rule) => {
|
|
2141
|
+
const forms = template.split("|");
|
|
2142
|
+
return forms[rule(choice, forms.length)];
|
|
2143
|
+
};
|
|
2144
|
+
class I18n {
|
|
2145
|
+
parent;
|
|
2146
|
+
messages;
|
|
2147
|
+
computed;
|
|
2148
|
+
pluralization;
|
|
2149
|
+
fallback;
|
|
2150
|
+
constructor(options = void 0, parent = void 0) {
|
|
2151
|
+
this.parent = parent;
|
|
2152
|
+
this.messages = options?.messages ?? {};
|
|
2153
|
+
this.computed = options?.computed ?? {};
|
|
2154
|
+
this.pluralization = {
|
|
2155
|
+
"en-GB": pluralization_en_GB,
|
|
2156
|
+
"es-ES": pluralization_es_ES,
|
|
2157
|
+
"ru-RU": pluralization_ru_RU,
|
|
2158
|
+
...options?.pluralization ?? {}
|
|
2159
|
+
};
|
|
2160
|
+
this.fallback = options?.fallback;
|
|
2161
|
+
}
|
|
2162
|
+
t(locale, path, values = void 0) {
|
|
2163
|
+
try {
|
|
2164
|
+
const _t = (locale2) => t(locale2, this.messages, path, values);
|
|
2165
|
+
return _t(locale) ?? _t(this.fallback) ?? fail(`Translation for "${path}" does not exists`);
|
|
2166
|
+
} catch (e) {
|
|
2167
|
+
if (this.parent) {
|
|
2168
|
+
return this.parent.t(locale, path, values);
|
|
2169
|
+
}
|
|
2170
|
+
throw e;
|
|
2171
|
+
}
|
|
2172
|
+
}
|
|
2173
|
+
tc(locale, path, choice, values = void 0) {
|
|
2174
|
+
return plural(
|
|
2175
|
+
this.t(
|
|
2176
|
+
locale,
|
|
2177
|
+
path,
|
|
2178
|
+
values
|
|
2179
|
+
),
|
|
2180
|
+
choice,
|
|
2181
|
+
this.pluralization[locale]
|
|
2182
|
+
);
|
|
2183
|
+
}
|
|
2184
|
+
compute(locale, key, values) {
|
|
2185
|
+
const computed2 = this.computed[key];
|
|
2186
|
+
if (computed2) {
|
|
2187
|
+
return computed2(localize$3(this, locale), values);
|
|
2188
|
+
}
|
|
2189
|
+
if (this.parent) {
|
|
2190
|
+
return this.parent.compute(locale, key, values);
|
|
2191
|
+
}
|
|
2192
|
+
return fail("Key " + key + " is not registered");
|
|
2193
|
+
}
|
|
2194
|
+
extend(options) {
|
|
2195
|
+
return new I18n({
|
|
2196
|
+
pluralization: this.pluralization,
|
|
2197
|
+
fallback: this.fallback,
|
|
2198
|
+
...options
|
|
2199
|
+
}, this);
|
|
2200
|
+
}
|
|
2201
|
+
}
|
|
2202
|
+
const localize$3 = (i18n, locale) => ({
|
|
2203
|
+
t(path, values = void 0) {
|
|
2204
|
+
return i18n.t(locale, path, values);
|
|
2205
|
+
},
|
|
2206
|
+
tc(path, choice, values = void 0) {
|
|
2207
|
+
return i18n.tc(locale, path, choice, values);
|
|
2208
|
+
},
|
|
2209
|
+
compute(key, values) {
|
|
2210
|
+
return i18n.compute(locale, key, values);
|
|
2211
|
+
}
|
|
2212
|
+
});
|
|
2213
|
+
const fallback = "en-GB";
|
|
2214
|
+
const define = (options = void 0, parent = void 0) => {
|
|
2215
|
+
const i18n = new I18n({
|
|
2216
|
+
...options,
|
|
2217
|
+
fallback
|
|
2218
|
+
}, parent);
|
|
2219
|
+
const extend = (i18n2, options2 = void 0) => options2 ? i18n2.extend(options2) : i18n2;
|
|
2220
|
+
return {
|
|
2221
|
+
i18n,
|
|
2222
|
+
init: (locale, options2 = void 0) => localize$3(
|
|
2223
|
+
extend(i18n, options2),
|
|
2224
|
+
locale
|
|
2225
|
+
),
|
|
2226
|
+
fallback
|
|
2227
|
+
};
|
|
2228
|
+
};
|
|
2229
|
+
const selected$2 = "Selected";
|
|
2230
|
+
const search$2 = { "placeholder": "", "noResult": "Nothing found" };
|
|
2231
|
+
const messages_en_GB = {
|
|
2232
|
+
selected: selected$2,
|
|
2233
|
+
search: search$2
|
|
2234
|
+
};
|
|
2235
|
+
const selected$1 = "Seleccionado";
|
|
2236
|
+
const search$1 = { "placeholder": "", "noResult": "No se ha encontrado" };
|
|
2237
|
+
const messages_es_ES = {
|
|
2238
|
+
selected: selected$1,
|
|
2239
|
+
search: search$1
|
|
2240
|
+
};
|
|
2241
|
+
const selected = "Выбрано";
|
|
2242
|
+
const search = { "placeholder": "", "noResult": "Ничего не найдено" };
|
|
2243
|
+
const messages_ru_RU = {
|
|
2244
|
+
selected,
|
|
2245
|
+
search
|
|
2246
|
+
};
|
|
2247
|
+
const _18n = define({
|
|
2248
|
+
messages: {
|
|
2249
|
+
"en-GB": messages_en_GB,
|
|
2250
|
+
"es-ES": messages_es_ES,
|
|
2251
|
+
"ru-RU": messages_ru_RU
|
|
2252
|
+
}
|
|
2253
|
+
});
|
|
2254
|
+
var PLACEMENT = /* @__PURE__ */ ((PLACEMENT2) => {
|
|
2255
|
+
PLACEMENT2["TOP"] = "top";
|
|
2256
|
+
PLACEMENT2["TOP_START"] = "top-start";
|
|
2257
|
+
PLACEMENT2["TOP_END"] = "top-end";
|
|
2258
|
+
PLACEMENT2["BOTTOM"] = "bottom";
|
|
2259
|
+
PLACEMENT2["BOTTOM_START"] = "bottom-start";
|
|
2260
|
+
PLACEMENT2["BOTTOM_END"] = "bottom-end";
|
|
2261
|
+
PLACEMENT2["LEFT"] = "left";
|
|
2262
|
+
PLACEMENT2["LEFT_START"] = "left-start";
|
|
2263
|
+
return PLACEMENT2;
|
|
2264
|
+
})(PLACEMENT || {});
|
|
2265
|
+
const escapeSpecialSymbols = (text) => text.replace(
|
|
2266
|
+
/([\\^$.*+?()[\]{}|=!<>:-])/g,
|
|
2267
|
+
"\\$1"
|
|
2268
|
+
);
|
|
2269
|
+
const highlight = (text, term, style) => text.replace(
|
|
2270
|
+
new RegExp(`(${escapeSpecialSymbols(term)})`, "gi"),
|
|
2271
|
+
`<span style="${style}">$1</span>`
|
|
2272
|
+
);
|
|
2273
|
+
let counter = 0;
|
|
2274
|
+
const uid = (prefix = "ui-v1-select") => `${prefix}-${++counter}`;
|
|
2275
|
+
const IsSelectedKey = Symbol("UiSelectedIsSelected");
|
|
2276
|
+
const RegisterKey = Symbol("UiSelectRegister");
|
|
2277
|
+
const SyncKey = Symbol("UiSelectSync");
|
|
2278
|
+
const UnregisterKey = Symbol("UiSelectUnregister");
|
|
2279
|
+
const ToggleKey = Symbol("UiSelectToggle");
|
|
2280
|
+
const FilterKey = Symbol("UiSelectFilter");
|
|
2281
|
+
const FilteredKey = Symbol("UiSelectFiltered");
|
|
2282
|
+
const TickerKey = Symbol("UiSelectTicker");
|
|
2283
|
+
const MultipleKey = Symbol("UiSelectMultiple");
|
|
2284
|
+
const FastenedKey = Symbol("UiSelectFastened");
|
|
2285
|
+
const UnregisterOptionKey = Symbol("UiSelectUnregisterOption");
|
|
2286
|
+
const RegisterOptionKey = Symbol("UiSelectRegisterOption");
|
|
2287
|
+
const I18nInjectKey = Symbol("$embedI18n");
|
|
2288
|
+
const UiSelectTriggerType = "UiSelectTrigger";
|
|
2289
|
+
const UiSelectTrigger = defineRemoteComponent(
|
|
2290
|
+
UiSelectTriggerType,
|
|
2291
|
+
[
|
|
2292
|
+
"input",
|
|
2293
|
+
"focus",
|
|
2294
|
+
"blur",
|
|
2295
|
+
"clear",
|
|
2296
|
+
"update:value",
|
|
2297
|
+
"update:expanded"
|
|
2298
|
+
]
|
|
2299
|
+
);
|
|
2300
|
+
const UiSelectPopperType = "UiSelectPopper";
|
|
2301
|
+
const UiSelectPopper = defineRemoteComponent(
|
|
2302
|
+
UiSelectPopperType,
|
|
2303
|
+
[
|
|
2304
|
+
"update:visible",
|
|
2305
|
+
"show",
|
|
2306
|
+
"hide",
|
|
2307
|
+
"shown",
|
|
2308
|
+
"hidden",
|
|
2309
|
+
"dispose"
|
|
2310
|
+
]
|
|
2311
|
+
);
|
|
2312
|
+
const UiSelectOptionType = "UiSelectOption";
|
|
2313
|
+
defineRemoteComponent(
|
|
2314
|
+
UiSelectOptionType
|
|
2315
|
+
);
|
|
2316
|
+
const _hoisted_1$3 = {
|
|
2317
|
+
key: 0,
|
|
2318
|
+
class: "ui-v1-select__no-results-text"
|
|
2319
|
+
};
|
|
2320
|
+
/* @__PURE__ */ vue.defineComponent({
|
|
2321
|
+
__name: "UiSelect",
|
|
2322
|
+
props: {
|
|
2323
|
+
/** Атрибут id корневого элемента выпадающего списка. Должен быть уникальным на странице */
|
|
2324
|
+
id: {
|
|
2325
|
+
type: String,
|
|
2326
|
+
default: void 0
|
|
2327
|
+
},
|
|
2328
|
+
/** Атрибут value, содержащий выбранный элемент из выпадающего списка */
|
|
2329
|
+
value: {
|
|
2330
|
+
type: null,
|
|
2331
|
+
default: void 0
|
|
2332
|
+
},
|
|
2333
|
+
/** Атрибут placeholder нативного поля ввода input */
|
|
2334
|
+
placeholder: {
|
|
2335
|
+
type: String,
|
|
2336
|
+
default: "test"
|
|
2337
|
+
},
|
|
2338
|
+
/** Отображает иконку сброса введённого или выбранного значения в виде крестика */
|
|
2339
|
+
clearable: {
|
|
2340
|
+
type: Boolean,
|
|
2341
|
+
default: false
|
|
2342
|
+
},
|
|
2343
|
+
/** Фильтрация строк выпадающего списка на соответствие введённого выражения в input */
|
|
2344
|
+
filterable: {
|
|
2345
|
+
type: Boolean,
|
|
2346
|
+
default: false
|
|
2347
|
+
},
|
|
2348
|
+
/** Подсвечивает поле как содержащее некорректное значение */
|
|
2349
|
+
invalid: {
|
|
2350
|
+
type: Boolean,
|
|
2351
|
+
default: false
|
|
2352
|
+
},
|
|
2353
|
+
/** Устанавливает поле ввода в состояние доступное только для чтения */
|
|
2354
|
+
readonly: {
|
|
2355
|
+
type: Boolean,
|
|
2356
|
+
default: false
|
|
2357
|
+
},
|
|
2358
|
+
/** Блокировка поля ввода */
|
|
2359
|
+
disabled: {
|
|
2360
|
+
type: Boolean,
|
|
2361
|
+
default: false
|
|
2362
|
+
},
|
|
2363
|
+
/** Функция для проверки равенства элементов */
|
|
2364
|
+
equalsFn: {
|
|
2365
|
+
type: Function,
|
|
2366
|
+
default: (a, b) => a === b
|
|
2367
|
+
},
|
|
2368
|
+
/**
|
|
2369
|
+
* Сторона цели, у которой появится плавающий элемент,
|
|
2370
|
+
* или подробный объект настройки положения и адаптации положения при нехватке места
|
|
2371
|
+
*/
|
|
2372
|
+
placement: {
|
|
2373
|
+
type: String,
|
|
2374
|
+
validator: (placement) => Object.values(PLACEMENT).includes(placement),
|
|
2375
|
+
default: PLACEMENT.BOTTOM
|
|
2376
|
+
},
|
|
2377
|
+
/** События целевого элемента, по которым производится переключение видимости */
|
|
2378
|
+
targetTriggers: {
|
|
2379
|
+
type: [Array, Object],
|
|
2380
|
+
default: () => ({
|
|
2381
|
+
show: ["click"]
|
|
2382
|
+
})
|
|
2383
|
+
},
|
|
2384
|
+
/** События плавающего элемента, по которым производится переключение видимости */
|
|
2385
|
+
popperTriggers: {
|
|
2386
|
+
type: [Array, Object],
|
|
2387
|
+
default: () => []
|
|
2388
|
+
},
|
|
2389
|
+
/**
|
|
2390
|
+
* Флаг, устанавливающий ширину выпадающего списка по ширине целевого элемента.
|
|
2391
|
+
* По-умолчанию отключает такое поведение
|
|
2392
|
+
*/
|
|
2393
|
+
popperFitTrigger: {
|
|
2394
|
+
type: Boolean,
|
|
2395
|
+
default: false
|
|
2396
|
+
},
|
|
2397
|
+
/** Стиль для плавающего элемента */
|
|
2398
|
+
popperClass: {
|
|
2399
|
+
type: String,
|
|
2400
|
+
default: null
|
|
2401
|
+
},
|
|
2402
|
+
/** Набор свойств плавающего элемента. See @/common/components/popper */
|
|
2403
|
+
popperOptions: {
|
|
2404
|
+
type: Object,
|
|
2405
|
+
default: () => ({})
|
|
2406
|
+
},
|
|
2407
|
+
/** Размер поля ввода */
|
|
2408
|
+
textboxSize: {
|
|
2409
|
+
type: String,
|
|
2410
|
+
validator: (size) => Object.values(SIZE$1).includes(size),
|
|
2411
|
+
default: SIZE$1.SM
|
|
2412
|
+
},
|
|
2413
|
+
/** Наличие множественного выбора среди элементов выпадающего списка */
|
|
2414
|
+
multiple: {
|
|
2415
|
+
type: Boolean,
|
|
2416
|
+
default: false
|
|
2417
|
+
},
|
|
2418
|
+
/** Состояние открытия выпадающего списка */
|
|
2419
|
+
expanded: {
|
|
2420
|
+
type: Boolean,
|
|
2421
|
+
default: false
|
|
2422
|
+
},
|
|
2423
|
+
/** Устанавливает в качестве выводимого в input значения только содержимое placeholder */
|
|
2424
|
+
placeholderOnly: {
|
|
2425
|
+
type: Boolean,
|
|
2426
|
+
default: false
|
|
2427
|
+
},
|
|
2428
|
+
/** Добавляет анимацию показала полной строки при переполнении */
|
|
2429
|
+
ticker: {
|
|
2430
|
+
type: Boolean,
|
|
2431
|
+
default: false
|
|
2432
|
+
}
|
|
2433
|
+
},
|
|
2434
|
+
setup(__props) {
|
|
2435
|
+
const props = __props;
|
|
2436
|
+
const state = vue.reactive({
|
|
2437
|
+
expanded: props.expanded,
|
|
2438
|
+
filter: "",
|
|
2439
|
+
value: props.value
|
|
2440
|
+
});
|
|
2441
|
+
const i18n = vue.computed(() => _18n.init(vue.inject(I18nInjectKey, null)?.locale ?? _18n.fallback));
|
|
2442
|
+
const noResult = vue.computed(() => i18n.value.t("search.noResult", { filter: state.filter }));
|
|
2443
|
+
const optionsRegistry = vue.ref([]);
|
|
2444
|
+
const selection = vue.computed(() => {
|
|
2445
|
+
const model = arraify2(state.value);
|
|
2446
|
+
const selectedOptions = [];
|
|
2447
|
+
model.forEach((item) => {
|
|
2448
|
+
const option = optionsRegistry.value.find((o) => equals(o.value, item));
|
|
2449
|
+
if (option) {
|
|
2450
|
+
selectedOptions.push(option);
|
|
2451
|
+
}
|
|
2452
|
+
});
|
|
2453
|
+
return selectedOptions;
|
|
2454
|
+
});
|
|
2455
|
+
const arraify2 = (value) => Array.isArray(value) ? [...value] : typeof value === "number" || typeof value === "boolean" || value ? [value] : [];
|
|
2456
|
+
const equals = (a, b) => props.equalsFn(a, b);
|
|
2457
|
+
const contains = (array, value) => array.some((v) => equals(v, value));
|
|
2458
|
+
vue.provide(RegisterKey, (option) => {
|
|
2459
|
+
if (optionsRegistry.value.some((item) => item.id === option.id)) {
|
|
2460
|
+
throw new Error(`[UiSelect] Component with id ${option.id} already registered. Unregister it before using again.`);
|
|
2461
|
+
}
|
|
2462
|
+
optionsRegistry.value.push(option);
|
|
2463
|
+
});
|
|
2464
|
+
vue.provide(SyncKey, (id, data) => {
|
|
2465
|
+
const option = optionsRegistry.value.find((option2) => option2.id === id);
|
|
2466
|
+
if (option) {
|
|
2467
|
+
option.label = data.label;
|
|
2468
|
+
option.value = data.value;
|
|
2469
|
+
}
|
|
2470
|
+
});
|
|
2471
|
+
vue.provide(UnregisterKey, (id) => {
|
|
2472
|
+
const index = optionsRegistry.value.findIndex((option) => option.id === id);
|
|
2473
|
+
if (index !== -1) {
|
|
2474
|
+
optionsRegistry.value.splice(index, 1);
|
|
2475
|
+
}
|
|
2476
|
+
});
|
|
2477
|
+
vue.provide(IsSelectedKey, vue.computed(() => (value) => {
|
|
2478
|
+
return Array.isArray(state.value) ? contains(state.value, value) : equals(state.value, value);
|
|
2479
|
+
}));
|
|
2480
|
+
vue.provide(ToggleKey, (value) => {
|
|
2481
|
+
if (props.multiple) {
|
|
2482
|
+
const model = arraify2(state.value);
|
|
2483
|
+
const index = model.findIndex((item) => equals(item, value));
|
|
2484
|
+
if (index !== -1) {
|
|
2485
|
+
model.splice(index, 1);
|
|
2486
|
+
} else {
|
|
2487
|
+
model.push(value);
|
|
2488
|
+
}
|
|
2489
|
+
state.value = model;
|
|
2490
|
+
if (!props.multiple) {
|
|
2491
|
+
close();
|
|
2492
|
+
}
|
|
2493
|
+
} else {
|
|
2494
|
+
state.value = value;
|
|
2495
|
+
close();
|
|
2496
|
+
}
|
|
2497
|
+
});
|
|
2498
|
+
vue.provide(FilterKey, vue.computed(() => state.filter));
|
|
2499
|
+
vue.provide(FilteredKey, vue.computed(() => props.filterable && state.filter.length > 0));
|
|
2500
|
+
vue.provide(TickerKey, vue.computed(() => props.ticker));
|
|
2501
|
+
vue.provide(MultipleKey, vue.computed(() => props.multiple));
|
|
2502
|
+
const onInput = (value) => {
|
|
2503
|
+
state.filter = value;
|
|
2504
|
+
};
|
|
2505
|
+
const close = () => {
|
|
2506
|
+
if (state.expanded) {
|
|
2507
|
+
state.expanded = false;
|
|
2508
|
+
state.filter = "";
|
|
2509
|
+
}
|
|
2510
|
+
};
|
|
2511
|
+
vue.watch(() => props.expanded, (newVal) => {
|
|
2512
|
+
state.expanded = newVal;
|
|
2513
|
+
if (!newVal) {
|
|
2514
|
+
state.filter = "";
|
|
2515
|
+
}
|
|
2516
|
+
});
|
|
2517
|
+
vue.watch(() => props.value, (newVal) => {
|
|
2518
|
+
state.value = newVal;
|
|
2519
|
+
});
|
|
2520
|
+
return (_ctx, _cache) => {
|
|
2521
|
+
return vue.openBlock(), vue.createBlock(vue.unref(UiPopperConnector), null, {
|
|
2522
|
+
default: vue.withCtx(() => [
|
|
2523
|
+
vue.createVNode(vue.unref(UiSelectTrigger), {
|
|
2524
|
+
id: __props.id,
|
|
2525
|
+
value: state.value,
|
|
2526
|
+
multiple: __props.multiple,
|
|
2527
|
+
selection: selection.value,
|
|
2528
|
+
filter: state.filter,
|
|
2529
|
+
filterable: __props.filterable,
|
|
2530
|
+
clearable: __props.clearable,
|
|
2531
|
+
expanded: state.expanded,
|
|
2532
|
+
invalid: __props.invalid,
|
|
2533
|
+
disabled: __props.disabled,
|
|
2534
|
+
readonly: __props.readonly,
|
|
2535
|
+
"placeholder-only": __props.placeholderOnly,
|
|
2536
|
+
placeholder: __props.placeholder,
|
|
2537
|
+
"textbox-size": __props.textboxSize,
|
|
2538
|
+
onInput,
|
|
2539
|
+
"onUpdate:value": _cache[0] || (_cache[0] = ($event) => state.value = $event),
|
|
2540
|
+
"onUpdate:expanded": _cache[1] || (_cache[1] = ($event) => state.expanded = $event)
|
|
2541
|
+
}, null, 8, ["id", "value", "multiple", "selection", "filter", "filterable", "clearable", "expanded", "invalid", "disabled", "readonly", "placeholder-only", "placeholder", "textbox-size"]),
|
|
2542
|
+
vue.createVNode(vue.unref(UiSelectPopper), {
|
|
2543
|
+
id: __props.id,
|
|
2544
|
+
disabled: __props.disabled || __props.readonly,
|
|
2545
|
+
multiple: __props.multiple,
|
|
2546
|
+
opened: state.expanded,
|
|
2547
|
+
placement: __props.placement,
|
|
2548
|
+
"popper-class": __props.popperClass,
|
|
2549
|
+
"popper-fit-trigger": __props.popperFitTrigger,
|
|
2550
|
+
"popper-options": __props.popperOptions,
|
|
2551
|
+
"popper-triggers": __props.popperTriggers,
|
|
2552
|
+
readonly: __props.readonly,
|
|
2553
|
+
"target-triggers": __props.targetTriggers,
|
|
2554
|
+
ticker: __props.ticker,
|
|
2555
|
+
filterable: __props.filterable,
|
|
2556
|
+
"options-registry": optionsRegistry.value,
|
|
2557
|
+
onHide: close
|
|
2558
|
+
}, {
|
|
2559
|
+
default: vue.withCtx(() => [
|
|
2560
|
+
__props.filterable && optionsRegistry.value.every((o) => !o.isMatched()) && noResult.value ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$3, vue.toDisplayString(noResult.value), 1)) : vue.createCommentVNode("", true),
|
|
2561
|
+
vue.renderSlot(_ctx.$slots, "default")
|
|
2562
|
+
]),
|
|
2563
|
+
_: 3
|
|
2564
|
+
}, 8, ["id", "disabled", "multiple", "opened", "placement", "popper-class", "popper-fit-trigger", "popper-options", "popper-triggers", "readonly", "target-triggers", "ticker", "filterable", "options-registry"])
|
|
2565
|
+
]),
|
|
2566
|
+
_: 3
|
|
2567
|
+
});
|
|
2568
|
+
};
|
|
2569
|
+
}
|
|
2570
|
+
});
|
|
2571
|
+
const _hoisted_1$2 = {
|
|
2572
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
2573
|
+
viewBox: "0 0 24 24"
|
|
2574
|
+
};
|
|
2575
|
+
function render$1(_ctx, _cache) {
|
|
2576
|
+
return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1$2, [..._cache[0] || (_cache[0] = [
|
|
2577
|
+
vue.createElementVNode("path", {
|
|
2578
|
+
fill: "currentColor",
|
|
2579
|
+
"fill-rule": "evenodd",
|
|
2580
|
+
d: "M12 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10A10 10 0 0 0 12 2m0 18a8 8 0 1 1 0-16 8 8 0 0 1 0 16m1-9h2.5a.5.5 0 0 1 .5.5v1a.5.5 0 0 1-.5.5H13v2.5a.5.5 0 0 1-.5.5h-1a.5.5 0 0 1-.5-.5V13H8.5a.5.5 0 0 1-.5-.5v-1a.5.5 0 0 1 .5-.5H11V8.5a.5.5 0 0 1 .5-.5h1a.5.5 0 0 1 .5.5z",
|
|
2581
|
+
"clip-rule": "evenodd"
|
|
2582
|
+
}, null, -1)
|
|
2583
|
+
])]);
|
|
2584
|
+
}
|
|
2585
|
+
const IconAddCircleOutlined = { render: render$1 };
|
|
2586
|
+
const _hoisted_1$1 = {
|
|
2587
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
2588
|
+
viewBox: "0 0 24 24"
|
|
2589
|
+
};
|
|
2590
|
+
function render(_ctx, _cache) {
|
|
2591
|
+
return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1$1, [..._cache[0] || (_cache[0] = [
|
|
2592
|
+
vue.createElementVNode("path", {
|
|
2593
|
+
fill: "currentColor",
|
|
2594
|
+
"fill-rule": "evenodd",
|
|
2595
|
+
d: "M2 12C2 6.477 6.477 2 12 2A10 10 0 1 1 2 12m8.73 3.35 5.62-5.62a.5.5 0 0 0 0-.69l-.53-.53a.5.5 0 0 0-.7 0l-4.74 4.74-1.5-1.49a.48.48 0 0 0-.7 0l-.53.53a.5.5 0 0 0 0 .71l2.38 2.35a.48.48 0 0 0 .7 0",
|
|
2596
|
+
"clip-rule": "evenodd"
|
|
2597
|
+
}, null, -1)
|
|
2598
|
+
])]);
|
|
2599
|
+
}
|
|
2600
|
+
const IconCheckmarkCircle = { render };
|
|
2601
|
+
var SIZE = /* @__PURE__ */ ((SIZE2) => {
|
|
2602
|
+
SIZE2["XS"] = "xs";
|
|
2603
|
+
SIZE2["SM"] = "sm";
|
|
2604
|
+
SIZE2["MD"] = "md";
|
|
2605
|
+
SIZE2["LG"] = "lg";
|
|
2606
|
+
return SIZE2;
|
|
2607
|
+
})(SIZE || {});
|
|
2608
|
+
const _hoisted_1 = ["aria-selected"];
|
|
2609
|
+
const _hoisted_2 = ["innerHTML"];
|
|
2610
|
+
const _hoisted_3 = ["innerHTML"];
|
|
2611
|
+
/* @__PURE__ */ vue.defineComponent({
|
|
2612
|
+
__name: "UiSelectOption",
|
|
2613
|
+
props: {
|
|
2614
|
+
/** Значение опции */
|
|
2615
|
+
value: {
|
|
2616
|
+
type: null,
|
|
2617
|
+
required: true
|
|
2618
|
+
},
|
|
2619
|
+
/** Заголовок */
|
|
2620
|
+
label: {
|
|
2621
|
+
type: String,
|
|
2622
|
+
required: true
|
|
2623
|
+
},
|
|
2624
|
+
/** Описание */
|
|
2625
|
+
description: {
|
|
2626
|
+
type: String,
|
|
2627
|
+
default: ""
|
|
2628
|
+
},
|
|
2629
|
+
/** Опция выбрана/не выбрана в списке */
|
|
2630
|
+
active: {
|
|
2631
|
+
type: Boolean,
|
|
2632
|
+
default: false
|
|
2633
|
+
},
|
|
2634
|
+
/** Заблокированный */
|
|
2635
|
+
disabled: {
|
|
2636
|
+
type: Boolean,
|
|
2637
|
+
default: false
|
|
2638
|
+
},
|
|
2639
|
+
/** Размер шрифта, иконок и внутренних отступов компонента */
|
|
2640
|
+
size: {
|
|
2641
|
+
type: String,
|
|
2642
|
+
validator: (size) => Object.values(SIZE).includes(size),
|
|
2643
|
+
default: SIZE.MD
|
|
2644
|
+
},
|
|
2645
|
+
/** Счетчик количества */
|
|
2646
|
+
counter: {
|
|
2647
|
+
type: null,
|
|
2648
|
+
validator: (counter2) => counter2 === null || ["string", "number"].includes(typeof counter2),
|
|
2649
|
+
default: null
|
|
2650
|
+
},
|
|
2651
|
+
/** Жирное начертание текста */
|
|
2652
|
+
accent: {
|
|
2653
|
+
type: Boolean,
|
|
2654
|
+
default: false
|
|
2655
|
+
}
|
|
2656
|
+
},
|
|
2657
|
+
setup(__props) {
|
|
2658
|
+
const props = __props;
|
|
2659
|
+
const id = uid("u1-v1-select-option");
|
|
2660
|
+
const isSelected = vue.inject(
|
|
2661
|
+
IsSelectedKey,
|
|
2662
|
+
vue.computed(() => () => false)
|
|
2663
|
+
);
|
|
2664
|
+
const syncInSelect = vue.inject(SyncKey, () => {
|
|
2665
|
+
});
|
|
2666
|
+
const registerInGroup = vue.inject(RegisterOptionKey, () => {
|
|
2667
|
+
});
|
|
2668
|
+
const registerInSelect = vue.inject(RegisterKey, () => {
|
|
2669
|
+
});
|
|
2670
|
+
const unregisterInGroup = vue.inject(UnregisterOptionKey, () => {
|
|
2671
|
+
});
|
|
2672
|
+
const unregisterInSelect = vue.inject(UnregisterKey, () => {
|
|
2673
|
+
});
|
|
2674
|
+
const toggle = vue.inject(ToggleKey, () => {
|
|
2675
|
+
});
|
|
2676
|
+
const fastened = vue.inject(FastenedKey, false);
|
|
2677
|
+
const filter = vue.inject(FilterKey, vue.ref(""));
|
|
2678
|
+
const filtered = vue.inject(FilteredKey, vue.ref(false));
|
|
2679
|
+
const ticker = vue.inject(TickerKey, vue.ref(false));
|
|
2680
|
+
const multiple = vue.inject(MultipleKey, vue.ref(false));
|
|
2681
|
+
const highlight$1 = (text, style = "font-weight: 500;") => highlight(text, filter.value, style);
|
|
2682
|
+
const texts = vue.computed(() => ({
|
|
2683
|
+
label: filtered.value ? highlight$1(props.label) : props.label,
|
|
2684
|
+
description: filtered.value ? highlight$1(props.description, "font-weight: 600;") : props.description
|
|
2685
|
+
}));
|
|
2686
|
+
const matched = vue.computed(() => texts.value.label !== props.label || texts.value.description !== props.description);
|
|
2687
|
+
const selected2 = vue.computed(() => props.active || isSelected.value(props.value));
|
|
2688
|
+
const hidden = vue.computed(() => !(fastened || !filtered.value || matched.value));
|
|
2689
|
+
const onClick = () => {
|
|
2690
|
+
if (!props.disabled) {
|
|
2691
|
+
toggle(props.value);
|
|
2692
|
+
}
|
|
2693
|
+
};
|
|
2694
|
+
const off = vue.watch([
|
|
2695
|
+
() => props.label,
|
|
2696
|
+
() => props.value
|
|
2697
|
+
], ([newLabel, newValue], [oldLabel, oldValue]) => {
|
|
2698
|
+
if (newLabel !== oldLabel || !isEqual(newValue, oldValue)) {
|
|
2699
|
+
syncInSelect(id, {
|
|
2700
|
+
label: newLabel,
|
|
2701
|
+
value: newValue
|
|
2702
|
+
});
|
|
2703
|
+
}
|
|
2704
|
+
});
|
|
2705
|
+
vue.onBeforeMount(() => {
|
|
2706
|
+
const option = {
|
|
2707
|
+
id,
|
|
2708
|
+
value: props.value,
|
|
2709
|
+
label: props.label,
|
|
2710
|
+
isMatched: () => !filtered.value || matched.value
|
|
2711
|
+
};
|
|
2712
|
+
registerInSelect(option);
|
|
2713
|
+
registerInGroup(option);
|
|
2714
|
+
});
|
|
2715
|
+
vue.onBeforeUnmount(() => {
|
|
2716
|
+
off();
|
|
2717
|
+
unregisterInSelect(id);
|
|
2718
|
+
unregisterInGroup(id);
|
|
2719
|
+
});
|
|
2720
|
+
return (_ctx, _cache) => {
|
|
2721
|
+
return vue.openBlock(), vue.createElementBlock("div", vue.mergeProps(_ctx.$attrs, {
|
|
2722
|
+
"aria-selected": selected2.value ? "true" : "false",
|
|
2723
|
+
class: {
|
|
2724
|
+
"ui-v1-select-option": true,
|
|
2725
|
+
"ui-v1-select-option_selected": selected2.value,
|
|
2726
|
+
"ui-v1-select-option_disabled": __props.disabled,
|
|
2727
|
+
"ui-v1-select-option_hidden": hidden.value
|
|
2728
|
+
},
|
|
2729
|
+
role: "option",
|
|
2730
|
+
onClick
|
|
2731
|
+
}), [
|
|
2732
|
+
vue.renderSlot(_ctx.$slots, "default", {
|
|
2733
|
+
highlight: highlight$1,
|
|
2734
|
+
selected: selected2.value
|
|
2735
|
+
}, () => [
|
|
2736
|
+
vue.createVNode(vue.unref(UiMenuItem), {
|
|
2737
|
+
accent: __props.accent,
|
|
2738
|
+
counter: __props.counter,
|
|
2739
|
+
disabled: __props.disabled,
|
|
2740
|
+
size: __props.size,
|
|
2741
|
+
ticker: vue.unref(ticker)
|
|
2742
|
+
}, vue.createSlots({
|
|
2743
|
+
"trailing-icon": vue.withCtx(() => [
|
|
2744
|
+
vue.renderSlot(_ctx.$slots, "trailing-icon", { selected: selected2.value }, () => [
|
|
2745
|
+
selected2.value ? (vue.openBlock(), vue.createBlock(vue.unref(IconCheckmarkCircle), {
|
|
2746
|
+
key: 0,
|
|
2747
|
+
class: "ui-v1-select-option__checkmark-icon",
|
|
2748
|
+
"aria-hidden": "true"
|
|
2749
|
+
})) : vue.unref(multiple) ? (vue.openBlock(), vue.createBlock(vue.unref(IconAddCircleOutlined), {
|
|
2750
|
+
key: 1,
|
|
2751
|
+
class: "ui-v1-select-option__add-icon",
|
|
2752
|
+
"aria-hidden": "true"
|
|
2753
|
+
})) : vue.createCommentVNode("", true)
|
|
2754
|
+
])
|
|
2755
|
+
]),
|
|
2756
|
+
default: vue.withCtx(() => [
|
|
2757
|
+
vue.renderSlot(_ctx.$slots, "value", { selected: selected2.value }, () => [
|
|
2758
|
+
vue.createElementVNode("span", {
|
|
2759
|
+
innerHTML: texts.value.label
|
|
2760
|
+
}, null, 8, _hoisted_2)
|
|
2761
|
+
])
|
|
2762
|
+
]),
|
|
2763
|
+
_: 2
|
|
2764
|
+
}, [
|
|
2765
|
+
_ctx.$slots["leading-icon"] ? {
|
|
2766
|
+
name: "leading-icon",
|
|
2767
|
+
fn: vue.withCtx(() => [
|
|
2768
|
+
vue.renderSlot(_ctx.$slots, "leading-icon", { selected: selected2.value })
|
|
2769
|
+
]),
|
|
2770
|
+
key: "0"
|
|
2771
|
+
} : void 0,
|
|
2772
|
+
texts.value.description ? {
|
|
2773
|
+
name: "description",
|
|
2774
|
+
fn: vue.withCtx(() => [
|
|
2775
|
+
vue.createElementVNode("span", {
|
|
2776
|
+
innerHTML: texts.value.description
|
|
2777
|
+
}, null, 8, _hoisted_3)
|
|
2778
|
+
]),
|
|
2779
|
+
key: "1"
|
|
2780
|
+
} : void 0
|
|
2781
|
+
]), 1032, ["accent", "counter", "disabled", "size", "ticker"])
|
|
2782
|
+
])
|
|
2783
|
+
], 16, _hoisted_1);
|
|
2784
|
+
};
|
|
2785
|
+
}
|
|
2786
|
+
});
|
|
2787
|
+
const createEndpointRoot = async (channel) => {
|
|
2788
|
+
const defaultRemoteEndpointComponents = [
|
|
2789
|
+
"UiAddButton",
|
|
2790
|
+
"UiAvatar",
|
|
2791
|
+
"UiAvatarList",
|
|
2792
|
+
"UiAlert",
|
|
2793
|
+
"UiButton",
|
|
2794
|
+
"UiCheckbox",
|
|
2795
|
+
"UiCollapse",
|
|
2796
|
+
"UiCollapseBox",
|
|
2797
|
+
"UiCollapseGroup",
|
|
2798
|
+
"UiCopyButton",
|
|
2799
|
+
"UiDate",
|
|
2800
|
+
"UiDatePicker",
|
|
2801
|
+
"UiError",
|
|
2802
|
+
"UiImage",
|
|
2803
|
+
"UiInfobox",
|
|
2804
|
+
"UiLink",
|
|
2805
|
+
"UiLoader",
|
|
2806
|
+
"UiMenuItem",
|
|
2807
|
+
"UiMenuItemGroup",
|
|
2808
|
+
"UiModalSidebar",
|
|
2809
|
+
"UiModalWindow",
|
|
2810
|
+
"UiModalWindowSurface",
|
|
2811
|
+
"UiNumberStepper",
|
|
2812
|
+
"UiPopper",
|
|
2813
|
+
"UiPopperConnector",
|
|
2814
|
+
"UiPopperTarget",
|
|
2815
|
+
"UiRadio",
|
|
2816
|
+
"UiScrollBox",
|
|
2817
|
+
"UiSlider",
|
|
2818
|
+
"UiSwitch",
|
|
2819
|
+
"UiSelectPopper",
|
|
2820
|
+
"UiSelectTrigger",
|
|
2821
|
+
"UiTag",
|
|
2822
|
+
"UiTextbox",
|
|
2823
|
+
"UiTimePicker",
|
|
2824
|
+
"UiToolbarButton",
|
|
2825
|
+
"UiToolbarLink",
|
|
2826
|
+
"UiTooltip",
|
|
2827
|
+
"UiTransition",
|
|
2828
|
+
"UiYandexMap"
|
|
2829
|
+
];
|
|
2830
|
+
return createRemoteRoot(channel, {
|
|
2831
|
+
components: defaultRemoteEndpointComponents
|
|
2832
|
+
});
|
|
2833
|
+
};
|
|
2834
|
+
const mountEndpointRoot = async (channel) => {
|
|
2835
|
+
const root = await createEndpointRoot(channel);
|
|
2836
|
+
await root.mount();
|
|
2837
|
+
return root;
|
|
2838
|
+
};
|
|
2839
|
+
const defineRunner = (config) => ({
|
|
2840
|
+
page: remote_pages.defineRunner(...config.pages),
|
|
2841
|
+
widget: remote_widgets.defineRunner(...config.widgets)
|
|
2842
|
+
});
|
|
2843
|
+
const createEndpoint = (runner, messenger) => {
|
|
2844
|
+
const endpoint = rpc.createEndpoint(messenger);
|
|
2845
|
+
const destructors = {
|
|
2846
|
+
widgets: /* @__PURE__ */ new Map(),
|
|
2847
|
+
pages: /* @__PURE__ */ new Map()
|
|
2848
|
+
};
|
|
2849
|
+
endpoint.expose({
|
|
2850
|
+
async run(channel, config) {
|
|
2851
|
+
if ("id" in config) {
|
|
2852
|
+
destructors.widgets.get(config.id)?.();
|
|
2853
|
+
destructors.widgets.delete(config.id);
|
|
2854
|
+
} else {
|
|
2855
|
+
destructors.pages.get(config.code)?.();
|
|
2856
|
+
destructors.pages.delete(config.code);
|
|
2857
|
+
}
|
|
2858
|
+
rpc.retain(channel);
|
|
2859
|
+
const root = await mountEndpointRoot(channel);
|
|
2860
|
+
const { createApp } = createRemoteRenderer(root);
|
|
2861
|
+
const pinia$1 = pinia.createPinia();
|
|
2862
|
+
pinia$1.use(injectEndpoint(endpoint));
|
|
2863
|
+
pinia$1.use(injectAccessor(endpoint));
|
|
2864
|
+
const destroy = "id" in config ? await runner.widget.run(createApp, root, pinia$1, config.target) : await runner.page.run(createApp, root, pinia$1, config.code);
|
|
2865
|
+
if ("id" in config) {
|
|
2866
|
+
destructors.widgets.set(config.id, () => {
|
|
2867
|
+
destroy();
|
|
2868
|
+
rpc.release(channel);
|
|
2869
|
+
});
|
|
2870
|
+
} else {
|
|
2871
|
+
destructors.pages.set(config.code, () => {
|
|
2872
|
+
destroy();
|
|
2873
|
+
rpc.release(channel);
|
|
2874
|
+
});
|
|
2875
|
+
}
|
|
2876
|
+
},
|
|
2877
|
+
release(config) {
|
|
2878
|
+
if ("id" in config) {
|
|
2879
|
+
destructors.widgets.get(config.id)?.();
|
|
2880
|
+
destructors.widgets.delete(config.id);
|
|
2881
|
+
} else {
|
|
2882
|
+
destructors.pages.get(config.code)?.();
|
|
2883
|
+
destructors.pages.delete(config.code);
|
|
2884
|
+
}
|
|
2885
|
+
},
|
|
2886
|
+
reset() {
|
|
2887
|
+
destructors.widgets.forEach((destroy) => destroy());
|
|
2888
|
+
destructors.widgets.clear();
|
|
2889
|
+
destructors.pages.forEach((destroy) => destroy());
|
|
2890
|
+
destructors.pages.clear();
|
|
2891
|
+
}
|
|
2892
|
+
});
|
|
2893
|
+
return endpoint;
|
|
2894
|
+
};
|
|
2895
|
+
const runEndpoint = (runner) => createEndpoint(runner, self);
|
|
2896
|
+
exports.definePageRunner = remote_pages.defineRunner;
|
|
2897
|
+
exports.defineWidgetRunner = remote_widgets.defineRunner;
|
|
2898
|
+
exports.createEndpoint = createEndpoint;
|
|
2899
|
+
exports.defineRunner = defineRunner;
|
|
2900
|
+
exports.runEndpoint = runEndpoint;
|