@symbo.ls/create 2.11.416 → 2.11.422
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/bundle/index.js +124 -78
- package/dist/cjs/prepare.js +16 -6
- package/dist/cjs/router.js +4 -4
- package/package.json +2 -2
- package/src/prepare.js +18 -7
- package/src/router.js +4 -4
package/dist/cjs/bundle/index.js
CHANGED
|
@@ -607,7 +607,7 @@ var require_object = __commonJS({
|
|
|
607
607
|
diff: () => diff,
|
|
608
608
|
diffArrays: () => diffArrays,
|
|
609
609
|
diffObjects: () => diffObjects,
|
|
610
|
-
exec: () =>
|
|
610
|
+
exec: () => exec5,
|
|
611
611
|
flattenRecursive: () => flattenRecursive,
|
|
612
612
|
getChildrenComponentsByKey: () => getChildrenComponentsByKey,
|
|
613
613
|
getExtendsInElement: () => getExtendsInElement,
|
|
@@ -632,7 +632,7 @@ var require_object = __commonJS({
|
|
|
632
632
|
var import_types = require_types();
|
|
633
633
|
var import_array = require_array();
|
|
634
634
|
var import_string = require_string();
|
|
635
|
-
var
|
|
635
|
+
var exec5 = (param, element, state, context) => {
|
|
636
636
|
if ((0, import_types.isFunction)(param)) {
|
|
637
637
|
return param(
|
|
638
638
|
element,
|
|
@@ -644,7 +644,7 @@ var require_object = __commonJS({
|
|
|
644
644
|
};
|
|
645
645
|
var map2 = (obj, extention, element) => {
|
|
646
646
|
for (const e in extention) {
|
|
647
|
-
obj[e] =
|
|
647
|
+
obj[e] = exec5(extention[e], element);
|
|
648
648
|
}
|
|
649
649
|
};
|
|
650
650
|
var merge6 = (element, obj, excludeFrom = []) => {
|
|
@@ -733,7 +733,7 @@ var require_object = __commonJS({
|
|
|
733
733
|
return o;
|
|
734
734
|
};
|
|
735
735
|
var deepCloneWithExtend3 = (obj, excludeFrom = ["node"], options = {}) => {
|
|
736
|
-
const o = (0, import_types.isArray)(obj) ? [] : {};
|
|
736
|
+
const o = options.window ? (0, import_types.isArray)(obj) ? new options.window.Array([]) : new options.window.Object({}) : (0, import_types.isArray)(obj) ? [] : {};
|
|
737
737
|
for (const prop in obj) {
|
|
738
738
|
if (!Object.prototype.hasOwnProperty.call(obj, prop))
|
|
739
739
|
continue;
|
|
@@ -1109,6 +1109,12 @@ var require_object = __commonJS({
|
|
|
1109
1109
|
if (foundString || foundInArray)
|
|
1110
1110
|
return el;
|
|
1111
1111
|
}
|
|
1112
|
+
if (el.parent && el.parent.childExtend) {
|
|
1113
|
+
const foundString = (0, import_types.isString)(el.parent.childExtend) && el.parent.childExtend === key;
|
|
1114
|
+
const foundInArray = (0, import_types.isArray)(el.parent.childExtend) && el.parent.childExtend.filter((v) => v === key).length;
|
|
1115
|
+
if (foundString || foundInArray)
|
|
1116
|
+
return el;
|
|
1117
|
+
}
|
|
1112
1118
|
};
|
|
1113
1119
|
var getExtendsInElement = (obj) => {
|
|
1114
1120
|
let result = [];
|
|
@@ -2142,7 +2148,7 @@ var require_cjs2 = __commonJS({
|
|
|
2142
2148
|
diff: () => diff,
|
|
2143
2149
|
diffArrays: () => diffArrays,
|
|
2144
2150
|
diffObjects: () => diffObjects,
|
|
2145
|
-
exec: () =>
|
|
2151
|
+
exec: () => exec5,
|
|
2146
2152
|
flattenRecursive: () => flattenRecursive,
|
|
2147
2153
|
getChildrenComponentsByKey: () => getChildrenComponentsByKey,
|
|
2148
2154
|
getExtendsInElement: () => getExtendsInElement,
|
|
@@ -2167,7 +2173,7 @@ var require_cjs2 = __commonJS({
|
|
|
2167
2173
|
var import_types = require_types4();
|
|
2168
2174
|
var import_array = require_array4();
|
|
2169
2175
|
var import_string = require_string4();
|
|
2170
|
-
var
|
|
2176
|
+
var exec5 = (param, element, state, context) => {
|
|
2171
2177
|
if ((0, import_types.isFunction)(param)) {
|
|
2172
2178
|
return param(
|
|
2173
2179
|
element,
|
|
@@ -2179,7 +2185,7 @@ var require_cjs2 = __commonJS({
|
|
|
2179
2185
|
};
|
|
2180
2186
|
var map2 = (obj, extention, element) => {
|
|
2181
2187
|
for (const e in extention) {
|
|
2182
|
-
obj[e] =
|
|
2188
|
+
obj[e] = exec5(extention[e], element);
|
|
2183
2189
|
}
|
|
2184
2190
|
};
|
|
2185
2191
|
var merge52 = (element, obj, excludeFrom = []) => {
|
|
@@ -3214,7 +3220,7 @@ var require_cjs2 = __commonJS({
|
|
|
3214
3220
|
};
|
|
3215
3221
|
var import_globals2 = __toESM2(require_cjs18(), 1);
|
|
3216
3222
|
var import_utils32 = __toESM2(require_cjs22(), 1);
|
|
3217
|
-
var
|
|
3223
|
+
var ENV3 = "development";
|
|
3218
3224
|
var colorStringToRgbaArray = (color) => {
|
|
3219
3225
|
if (color === "")
|
|
3220
3226
|
return [0, 0, 0, 0];
|
|
@@ -3337,7 +3343,7 @@ var require_cjs2 = __commonJS({
|
|
|
3337
3343
|
var opacify2 = (color, opacity) => {
|
|
3338
3344
|
const arr = colorStringToRgbaArray(color);
|
|
3339
3345
|
if (!arr) {
|
|
3340
|
-
if (
|
|
3346
|
+
if (ENV3 === "test" || ENV3 === "development")
|
|
3341
3347
|
console.warn(color + " color is not rgba");
|
|
3342
3348
|
return;
|
|
3343
3349
|
}
|
|
@@ -4004,7 +4010,7 @@ var require_cjs2 = __commonJS({
|
|
|
4004
4010
|
diff: () => diff,
|
|
4005
4011
|
diffArrays: () => diffArrays,
|
|
4006
4012
|
diffObjects: () => diffObjects,
|
|
4007
|
-
exec: () =>
|
|
4013
|
+
exec: () => exec5,
|
|
4008
4014
|
flattenRecursive: () => flattenRecursive,
|
|
4009
4015
|
getChildrenComponentsByKey: () => getChildrenComponentsByKey,
|
|
4010
4016
|
getExtendsInElement: () => getExtendsInElement,
|
|
@@ -4029,7 +4035,7 @@ var require_cjs2 = __commonJS({
|
|
|
4029
4035
|
var import_types = require_types22();
|
|
4030
4036
|
var import_array = require_array22();
|
|
4031
4037
|
var import_string = require_string22();
|
|
4032
|
-
var
|
|
4038
|
+
var exec5 = (param, element, state, context) => {
|
|
4033
4039
|
if ((0, import_types.isFunction)(param)) {
|
|
4034
4040
|
return param(
|
|
4035
4041
|
element,
|
|
@@ -4041,7 +4047,7 @@ var require_cjs2 = __commonJS({
|
|
|
4041
4047
|
};
|
|
4042
4048
|
var map2 = (obj, extention, element) => {
|
|
4043
4049
|
for (const e in extention) {
|
|
4044
|
-
obj[e] =
|
|
4050
|
+
obj[e] = exec5(extention[e], element);
|
|
4045
4051
|
}
|
|
4046
4052
|
};
|
|
4047
4053
|
var merge52 = (element, obj, excludeFrom = []) => {
|
|
@@ -7265,7 +7271,7 @@ var require_cjs3 = __commonJS({
|
|
|
7265
7271
|
diff: () => diff,
|
|
7266
7272
|
diffArrays: () => diffArrays,
|
|
7267
7273
|
diffObjects: () => diffObjects,
|
|
7268
|
-
exec: () =>
|
|
7274
|
+
exec: () => exec5,
|
|
7269
7275
|
flattenRecursive: () => flattenRecursive,
|
|
7270
7276
|
getChildrenComponentsByKey: () => getChildrenComponentsByKey,
|
|
7271
7277
|
getExtendsInElement: () => getExtendsInElement,
|
|
@@ -7290,7 +7296,7 @@ var require_cjs3 = __commonJS({
|
|
|
7290
7296
|
var import_types = require_types4();
|
|
7291
7297
|
var import_array = require_array4();
|
|
7292
7298
|
var import_string = require_string4();
|
|
7293
|
-
var
|
|
7299
|
+
var exec5 = (param, element, state, context) => {
|
|
7294
7300
|
if ((0, import_types.isFunction)(param)) {
|
|
7295
7301
|
return param(
|
|
7296
7302
|
element,
|
|
@@ -7302,7 +7308,7 @@ var require_cjs3 = __commonJS({
|
|
|
7302
7308
|
};
|
|
7303
7309
|
var map2 = (obj, extention, element) => {
|
|
7304
7310
|
for (const e in extention) {
|
|
7305
|
-
obj[e] =
|
|
7311
|
+
obj[e] = exec5(extention[e], element);
|
|
7306
7312
|
}
|
|
7307
7313
|
};
|
|
7308
7314
|
var merge6 = (element, obj, excludeFrom = []) => {
|
|
@@ -7391,7 +7397,7 @@ var require_cjs3 = __commonJS({
|
|
|
7391
7397
|
return o;
|
|
7392
7398
|
};
|
|
7393
7399
|
var deepCloneWithExtend3 = (obj, excludeFrom = ["node"], options = {}) => {
|
|
7394
|
-
const o = (0, import_types.isArray)(obj) ? [] : {};
|
|
7400
|
+
const o = options.window ? (0, import_types.isArray)(obj) ? new options.window.Array([]) : new options.window.Object({}) : (0, import_types.isArray)(obj) ? [] : {};
|
|
7395
7401
|
for (const prop in obj) {
|
|
7396
7402
|
if (!Object.prototype.hasOwnProperty.call(obj, prop))
|
|
7397
7403
|
continue;
|
|
@@ -7767,6 +7773,12 @@ var require_cjs3 = __commonJS({
|
|
|
7767
7773
|
if (foundString || foundInArray)
|
|
7768
7774
|
return el;
|
|
7769
7775
|
}
|
|
7776
|
+
if (el.parent && el.parent.childExtend) {
|
|
7777
|
+
const foundString = (0, import_types.isString)(el.parent.childExtend) && el.parent.childExtend === key;
|
|
7778
|
+
const foundInArray = (0, import_types.isArray)(el.parent.childExtend) && el.parent.childExtend.filter((v) => v === key).length;
|
|
7779
|
+
if (foundString || foundInArray)
|
|
7780
|
+
return el;
|
|
7781
|
+
}
|
|
7770
7782
|
};
|
|
7771
7783
|
var getExtendsInElement = (obj) => {
|
|
7772
7784
|
let result = [];
|
|
@@ -8182,13 +8194,15 @@ var require_cjs3 = __commonJS({
|
|
|
8182
8194
|
});
|
|
8183
8195
|
module2.exports = __toCommonJS2(src_exports2);
|
|
8184
8196
|
var import_utils210 = __toESM2(require_cjs18(), 1);
|
|
8185
|
-
var toggleFullscreen = (el) => {
|
|
8197
|
+
var toggleFullscreen = async (el) => {
|
|
8186
8198
|
if (!document.fullscreenElement) {
|
|
8187
|
-
|
|
8199
|
+
try {
|
|
8200
|
+
await (el.node || document).requestFullscreen();
|
|
8201
|
+
} catch (err) {
|
|
8188
8202
|
console.warn(`Error attempting to enable fullscreen mode: ${err.message} (${err.name})`);
|
|
8189
|
-
}
|
|
8203
|
+
}
|
|
8190
8204
|
} else {
|
|
8191
|
-
document.exitFullscreen();
|
|
8205
|
+
await document.exitFullscreen();
|
|
8192
8206
|
}
|
|
8193
8207
|
};
|
|
8194
8208
|
var import_utils32 = __toESM2(require_cjs18(), 1);
|
|
@@ -8243,7 +8257,7 @@ var require_cjs3 = __commonJS({
|
|
|
8243
8257
|
}
|
|
8244
8258
|
});
|
|
8245
8259
|
};
|
|
8246
|
-
var loadJavascriptFileSync2 = (FILE_URL, doc = document, type = "text/javascript") => {
|
|
8260
|
+
var loadJavascriptFileSync2 = (FILE_URL, doc = document, fallback, type = "text/javascript") => {
|
|
8247
8261
|
const xhr = new window.XMLHttpRequest();
|
|
8248
8262
|
xhr.open("GET", FILE_URL, false);
|
|
8249
8263
|
xhr.send();
|
|
@@ -8252,6 +8266,8 @@ var require_cjs3 = __commonJS({
|
|
|
8252
8266
|
scriptEle.type = type;
|
|
8253
8267
|
scriptEle.text = xhr.responseText;
|
|
8254
8268
|
doc.body.appendChild(scriptEle);
|
|
8269
|
+
if (typeof fallback === "function")
|
|
8270
|
+
fallback();
|
|
8255
8271
|
} else {
|
|
8256
8272
|
throw new Error(`Failed to load the script ${FILE_URL}`);
|
|
8257
8273
|
}
|
|
@@ -9971,7 +9987,7 @@ var require_attr = __commonJS({
|
|
|
9971
9987
|
if (params) {
|
|
9972
9988
|
for (const attr in params) {
|
|
9973
9989
|
const val = (0, import_utils32.exec)(params[attr], element);
|
|
9974
|
-
if ((0, import_utils32.
|
|
9990
|
+
if (val !== false && !(0, import_utils32.isUndefined)(val) && !(0, import_utils32.isNull)(val) && node3.setAttribute)
|
|
9975
9991
|
node3.setAttribute(attr, val);
|
|
9976
9992
|
else if (node3.removeAttribute)
|
|
9977
9993
|
node3.removeAttribute(attr);
|
|
@@ -10145,11 +10161,9 @@ var require_set = __commonJS({
|
|
|
10145
10161
|
...options
|
|
10146
10162
|
});
|
|
10147
10163
|
};
|
|
10148
|
-
var reset = (
|
|
10164
|
+
var reset = (options) => {
|
|
10149
10165
|
const element = void 0;
|
|
10150
|
-
|
|
10151
|
-
(0, import_content.removeContent)(element, options);
|
|
10152
|
-
(0, import_create.default)(params, element, options.contentElementKey || "content", {
|
|
10166
|
+
(0, import_create.default)(element, element.parent, void 0, {
|
|
10153
10167
|
ignoreChildExtend: true,
|
|
10154
10168
|
...import_mixins.registry.defaultOptions,
|
|
10155
10169
|
...import_options3.default.create,
|
|
@@ -10335,7 +10349,8 @@ var require_html = __commonJS({
|
|
|
10335
10349
|
module2.exports = __toCommonJS2(html_exports);
|
|
10336
10350
|
var import_utils32 = require_cjs();
|
|
10337
10351
|
var html_default = (param, element, node3) => {
|
|
10338
|
-
|
|
10352
|
+
var _a;
|
|
10353
|
+
const prop = (0, import_utils32.exec)(param, element) || (0, import_utils32.exec)((_a = element == null ? void 0 : element.props) == null ? void 0 : _a.html, element);
|
|
10339
10354
|
const { __ref } = element;
|
|
10340
10355
|
if (prop !== __ref.__html) {
|
|
10341
10356
|
if (node3.nodeName === "SVG")
|
|
@@ -10780,6 +10795,7 @@ var require_methods2 = __commonJS({
|
|
|
10780
10795
|
return parent;
|
|
10781
10796
|
};
|
|
10782
10797
|
var lookdown = function(param) {
|
|
10798
|
+
var _a;
|
|
10783
10799
|
const el = this;
|
|
10784
10800
|
const { __ref: ref } = el;
|
|
10785
10801
|
const children = ref.__children;
|
|
@@ -10789,18 +10805,19 @@ var require_methods2 = __commonJS({
|
|
|
10789
10805
|
if (v === param)
|
|
10790
10806
|
return childElem;
|
|
10791
10807
|
else if ((0, import_utils32.isFunction)(param)) {
|
|
10792
|
-
const
|
|
10793
|
-
if (childElem.state &&
|
|
10808
|
+
const exec5 = param(childElem, childElem.state, childElem.context);
|
|
10809
|
+
if (childElem.state && exec5) {
|
|
10794
10810
|
return childElem;
|
|
10795
10811
|
}
|
|
10796
10812
|
}
|
|
10797
|
-
const lookdown2 = childElem == null ? void 0 : childElem.lookdown(param);
|
|
10813
|
+
const lookdown2 = (_a = childElem == null ? void 0 : childElem.lookdown) == null ? void 0 : _a.call(childElem, param);
|
|
10798
10814
|
if (lookdown2)
|
|
10799
10815
|
return lookdown2;
|
|
10800
10816
|
}
|
|
10801
10817
|
return null;
|
|
10802
10818
|
};
|
|
10803
10819
|
var lookdownAll = function(param, results = []) {
|
|
10820
|
+
var _a;
|
|
10804
10821
|
const el = this;
|
|
10805
10822
|
const { __ref: ref } = el;
|
|
10806
10823
|
const children = ref.__children;
|
|
@@ -10810,11 +10827,11 @@ var require_methods2 = __commonJS({
|
|
|
10810
10827
|
if (v === param)
|
|
10811
10828
|
results.push(childElem);
|
|
10812
10829
|
else if ((0, import_utils32.isFunction)(param)) {
|
|
10813
|
-
const
|
|
10814
|
-
if (childElem.state &&
|
|
10830
|
+
const exec5 = param(childElem, childElem.state, childElem.context);
|
|
10831
|
+
if (childElem.state && exec5)
|
|
10815
10832
|
results.push(childElem);
|
|
10816
10833
|
}
|
|
10817
|
-
childElem == null ? void 0 : childElem.lookdownAll(param, results);
|
|
10834
|
+
(_a = childElem == null ? void 0 : childElem.lookdownAll) == null ? void 0 : _a.call(childElem, param, results);
|
|
10818
10835
|
}
|
|
10819
10836
|
return results.length ? results : null;
|
|
10820
10837
|
};
|
|
@@ -11405,7 +11422,7 @@ var require_extendUtils = __commonJS({
|
|
|
11405
11422
|
});
|
|
11406
11423
|
module2.exports = __toCommonJS2(extendUtils_exports);
|
|
11407
11424
|
var import_utils32 = require_cjs();
|
|
11408
|
-
var
|
|
11425
|
+
var ENV3 = "development";
|
|
11409
11426
|
var generateHash = () => Math.random().toString(36).substring(2);
|
|
11410
11427
|
var extendStackRegistry = {};
|
|
11411
11428
|
var extendCachedRegistry = {};
|
|
@@ -11486,7 +11503,7 @@ var require_extendUtils = __commonJS({
|
|
|
11486
11503
|
else if (pageExists)
|
|
11487
11504
|
return pageExists;
|
|
11488
11505
|
else {
|
|
11489
|
-
if (options.verbose && (
|
|
11506
|
+
if (options.verbose && (ENV3 === "test" || ENV3 === "development")) {
|
|
11490
11507
|
console.warn("Extend is string but component was not found:", extend);
|
|
11491
11508
|
}
|
|
11492
11509
|
return {};
|
|
@@ -11540,7 +11557,7 @@ var require_extend = __commonJS({
|
|
|
11540
11557
|
module2.exports = __toCommonJS2(extend_exports);
|
|
11541
11558
|
var import_utils32 = require_cjs();
|
|
11542
11559
|
var import_utils210 = require_utils();
|
|
11543
|
-
var
|
|
11560
|
+
var ENV3 = "development";
|
|
11544
11561
|
var mainExtend;
|
|
11545
11562
|
var applyExtend = (element, parent, options = {}) => {
|
|
11546
11563
|
if ((0, import_utils32.isFunction)(element))
|
|
@@ -11549,7 +11566,7 @@ var require_extend = __commonJS({
|
|
|
11549
11566
|
const context = element.context || parent.context;
|
|
11550
11567
|
extend = (0, import_utils210.fallbackStringExtend)(extend, context, options);
|
|
11551
11568
|
const extendStack = (0, import_utils210.getExtendStack)(extend, context);
|
|
11552
|
-
if (
|
|
11569
|
+
if (ENV3 !== "test" || ENV3 !== "development")
|
|
11553
11570
|
delete element.extend;
|
|
11554
11571
|
let childExtendStack = [];
|
|
11555
11572
|
if (parent) {
|
|
@@ -11639,7 +11656,7 @@ var require_component = __commonJS({
|
|
|
11639
11656
|
module2.exports = __toCommonJS2(component_exports);
|
|
11640
11657
|
var import_utils32 = require_cjs();
|
|
11641
11658
|
var import_extend = require_extend();
|
|
11642
|
-
var
|
|
11659
|
+
var ENV3 = "development";
|
|
11643
11660
|
var DOMQL_BUILTINS = [
|
|
11644
11661
|
"extend",
|
|
11645
11662
|
"childExtend",
|
|
@@ -11743,7 +11760,7 @@ var require_component = __commonJS({
|
|
|
11743
11760
|
if (componentExists)
|
|
11744
11761
|
element.extend = componentExists;
|
|
11745
11762
|
else {
|
|
11746
|
-
if ((
|
|
11763
|
+
if ((ENV3 === "test" || ENV3 === "development") && options.verbose) {
|
|
11747
11764
|
console.warn(execExtend, "is not in library", components, element);
|
|
11748
11765
|
console.warn("replacing with ", {});
|
|
11749
11766
|
}
|
|
@@ -12079,7 +12096,7 @@ var require_node2 = __commonJS({
|
|
|
12079
12096
|
var import_applyParam = require_applyParam();
|
|
12080
12097
|
var import_utils210 = require_utils();
|
|
12081
12098
|
var import_propEvents = require_propEvents();
|
|
12082
|
-
var
|
|
12099
|
+
var ENV3 = "development";
|
|
12083
12100
|
var createNode = (element, options) => {
|
|
12084
12101
|
let { node: node3, tag, __ref: ref } = element;
|
|
12085
12102
|
let isNewNode;
|
|
@@ -12093,7 +12110,7 @@ var require_node2 = __commonJS({
|
|
|
12093
12110
|
node3 = element.node = (0, import_render.cacheNode)(element);
|
|
12094
12111
|
(0, import_event.triggerEventOn)("attachNode", element, options);
|
|
12095
12112
|
}
|
|
12096
|
-
if (
|
|
12113
|
+
if (ENV3 === "test" || ENV3 === "development" || options.alowRefReference) {
|
|
12097
12114
|
node3.ref = element;
|
|
12098
12115
|
if ((0, import_utils32.isFunction)(node3.setAttribute))
|
|
12099
12116
|
node3.setAttribute("key", element.key);
|
|
@@ -12599,7 +12616,7 @@ var require_object3 = __commonJS({
|
|
|
12599
12616
|
diff: () => diff,
|
|
12600
12617
|
diffArrays: () => diffArrays,
|
|
12601
12618
|
diffObjects: () => diffObjects,
|
|
12602
|
-
exec: () =>
|
|
12619
|
+
exec: () => exec5,
|
|
12603
12620
|
flattenRecursive: () => flattenRecursive,
|
|
12604
12621
|
hasOwnProperty: () => hasOwnProperty,
|
|
12605
12622
|
isEmpty: () => isEmpty,
|
|
@@ -12622,7 +12639,7 @@ var require_object3 = __commonJS({
|
|
|
12622
12639
|
var import_types = require_types2();
|
|
12623
12640
|
var import_array = require_array2();
|
|
12624
12641
|
var import_string = require_string2();
|
|
12625
|
-
var
|
|
12642
|
+
var exec5 = (param, element, state, context) => {
|
|
12626
12643
|
if ((0, import_types.isFunction)(param)) {
|
|
12627
12644
|
return param(
|
|
12628
12645
|
element,
|
|
@@ -12634,7 +12651,7 @@ var require_object3 = __commonJS({
|
|
|
12634
12651
|
};
|
|
12635
12652
|
var map2 = (obj, extention, element) => {
|
|
12636
12653
|
for (const e in extention) {
|
|
12637
|
-
obj[e] =
|
|
12654
|
+
obj[e] = exec5(extention[e], element);
|
|
12638
12655
|
}
|
|
12639
12656
|
};
|
|
12640
12657
|
var merge6 = (element, obj, excludeFrom = []) => {
|
|
@@ -14090,7 +14107,7 @@ var require_create4 = __commonJS({
|
|
|
14090
14107
|
var import_utils32 = require_cjs();
|
|
14091
14108
|
var import_options3 = __toESM2(require_options(), 1);
|
|
14092
14109
|
var import_component = require_component();
|
|
14093
|
-
var
|
|
14110
|
+
var ENV3 = "development";
|
|
14094
14111
|
var create2 = (element, parent, key, options = import_options3.default.create || {}, attachOptions) => {
|
|
14095
14112
|
cacheOptions(element, options);
|
|
14096
14113
|
if (checkIfPrimitive(element)) {
|
|
@@ -14138,13 +14155,13 @@ var require_create4 = __commonJS({
|
|
|
14138
14155
|
};
|
|
14139
14156
|
var createBasedOnType = (element, parent, key, options) => {
|
|
14140
14157
|
if (element === void 0) {
|
|
14141
|
-
if (
|
|
14158
|
+
if (ENV3 === "test" || ENV3 === "development") {
|
|
14142
14159
|
console.warn(key, "element is undefined in", parent && parent.__ref && parent.__ref.path);
|
|
14143
14160
|
}
|
|
14144
14161
|
return {};
|
|
14145
14162
|
}
|
|
14146
14163
|
if ((0, import_utils32.isString)(key) && key.slice(0, 2 === "__")) {
|
|
14147
|
-
if (
|
|
14164
|
+
if (ENV3 === "test" || ENV3 === "development") {
|
|
14148
14165
|
console.warn(key, "seems like to be in __ref");
|
|
14149
14166
|
}
|
|
14150
14167
|
}
|
|
@@ -14215,7 +14232,7 @@ var require_create4 = __commonJS({
|
|
|
14215
14232
|
try {
|
|
14216
14233
|
(0, import_node.default)(element, options);
|
|
14217
14234
|
} catch (e) {
|
|
14218
|
-
if (
|
|
14235
|
+
if (ENV3 === "test" || ENV3 === "development")
|
|
14219
14236
|
console.warn(element, e);
|
|
14220
14237
|
}
|
|
14221
14238
|
if (!ref.__if) {
|
|
@@ -14954,7 +14971,7 @@ var require_object4 = __commonJS({
|
|
|
14954
14971
|
diff: () => diff,
|
|
14955
14972
|
diffArrays: () => diffArrays,
|
|
14956
14973
|
diffObjects: () => diffObjects,
|
|
14957
|
-
exec: () =>
|
|
14974
|
+
exec: () => exec5,
|
|
14958
14975
|
flattenRecursive: () => flattenRecursive,
|
|
14959
14976
|
hasOwnProperty: () => hasOwnProperty,
|
|
14960
14977
|
isEmpty: () => isEmpty,
|
|
@@ -14977,7 +14994,7 @@ var require_object4 = __commonJS({
|
|
|
14977
14994
|
var import_types = require_types3();
|
|
14978
14995
|
var import_array = require_array3();
|
|
14979
14996
|
var import_string = require_string3();
|
|
14980
|
-
var
|
|
14997
|
+
var exec5 = (param, element, state, context) => {
|
|
14981
14998
|
if ((0, import_types.isFunction)(param)) {
|
|
14982
14999
|
return param(
|
|
14983
15000
|
element,
|
|
@@ -14989,7 +15006,7 @@ var require_object4 = __commonJS({
|
|
|
14989
15006
|
};
|
|
14990
15007
|
var map2 = (obj, extention, element) => {
|
|
14991
15008
|
for (const e in extention) {
|
|
14992
|
-
obj[e] =
|
|
15009
|
+
obj[e] = exec5(extention[e], element);
|
|
14993
15010
|
}
|
|
14994
15011
|
};
|
|
14995
15012
|
var merge6 = (element, obj, excludeFrom = []) => {
|
|
@@ -17334,6 +17351,7 @@ __export(uikit_exports, {
|
|
|
17334
17351
|
CommonField: () => CommonField,
|
|
17335
17352
|
CommonFieldTemplate: () => CommonFieldTemplate,
|
|
17336
17353
|
CountIndicator: () => CountIndicator,
|
|
17354
|
+
Data: () => Data,
|
|
17337
17355
|
Dialog: () => Dialog,
|
|
17338
17356
|
DialogFooter: () => DialogFooter,
|
|
17339
17357
|
DialogHeader: () => DialogHeader,
|
|
@@ -17826,8 +17844,8 @@ var Img = {
|
|
|
17826
17844
|
attr: {
|
|
17827
17845
|
src: (el) => {
|
|
17828
17846
|
const { props: props2, context } = el;
|
|
17829
|
-
const { exec:
|
|
17830
|
-
let src = (props2.preSrc || "") +
|
|
17847
|
+
const { exec: exec5, isString: isString14, replaceLiteralsWithObjectFields: replaceLiteralsWithObjectFields3 } = context.utils;
|
|
17848
|
+
let src = (props2.preSrc || "") + exec5(props2.src, el);
|
|
17831
17849
|
if (isString14(src) && src.includes("{{")) {
|
|
17832
17850
|
src = replaceLiteralsWithObjectFields3(src, el.state);
|
|
17833
17851
|
}
|
|
@@ -17912,8 +17930,8 @@ var getComputedBackgroundColor = ({ props: props2 }) => {
|
|
|
17912
17930
|
return (0, import_scratch6.getColor)(props2.shapeDirectionColor) || (0, import_scratch6.getColor)(props2.borderColor) || (0, import_scratch6.getColor)(props2.backgroundColor) || (0, import_scratch6.getColor)(props2.background);
|
|
17913
17931
|
};
|
|
17914
17932
|
var inheritTransition = ({ props: props2, deps }) => {
|
|
17915
|
-
const
|
|
17916
|
-
return
|
|
17933
|
+
const exec5 = Timing.class.transition({ props: props2, deps });
|
|
17934
|
+
return exec5 && exec5.transition;
|
|
17917
17935
|
};
|
|
17918
17936
|
var SHAPES = {
|
|
17919
17937
|
rectangle: {},
|
|
@@ -18578,9 +18596,10 @@ var Collection = {
|
|
|
18578
18596
|
$collection: (param, el, state) => {
|
|
18579
18597
|
const { __ref: ref } = el;
|
|
18580
18598
|
const { children, childrenAs, childrenExtend } = el.props || {};
|
|
18581
|
-
const
|
|
18599
|
+
const childrenExec = children && (0, import_utils8.exec)(children, el, state);
|
|
18600
|
+
const hasChildren = (0, import_utils8.isArray)(childrenExec);
|
|
18582
18601
|
if (hasChildren) {
|
|
18583
|
-
param =
|
|
18602
|
+
param = (0, import_utils8.deepCloneWithExtend)(childrenExec);
|
|
18584
18603
|
if (childrenAs)
|
|
18585
18604
|
param = param.map((v) => ({ extend: childrenExtend, [childrenAs]: v }));
|
|
18586
18605
|
} else if (!param)
|
|
@@ -18641,7 +18660,8 @@ var Collection = {
|
|
|
18641
18660
|
return data;
|
|
18642
18661
|
},
|
|
18643
18662
|
$stateCollection: (param, el, state, ctx) => {
|
|
18644
|
-
|
|
18663
|
+
const { children, childrenAs } = el.props || {};
|
|
18664
|
+
if (!param || children || childrenAs)
|
|
18645
18665
|
return;
|
|
18646
18666
|
if ((0, import_utils8.isString)(param)) {
|
|
18647
18667
|
if (param === "state")
|
|
@@ -18682,7 +18702,8 @@ var Collection = {
|
|
|
18682
18702
|
el.content = obj;
|
|
18683
18703
|
},
|
|
18684
18704
|
$propsCollection: (param, el, state) => {
|
|
18685
|
-
|
|
18705
|
+
const { children, childrenAs } = el.props || {};
|
|
18706
|
+
if (!param || children || childrenAs)
|
|
18686
18707
|
return;
|
|
18687
18708
|
if ((0, import_utils8.isString)(param)) {
|
|
18688
18709
|
if (param === "state")
|
|
@@ -18816,6 +18837,8 @@ var Svg = {
|
|
|
18816
18837
|
const { designSystem, utils: utils2 } = context;
|
|
18817
18838
|
const SVG = designSystem && designSystem.SVG;
|
|
18818
18839
|
const useSvgSprite = props2.spriteId || context.designSystem && context.designSystem.useSvgSprite;
|
|
18840
|
+
if (props2.html)
|
|
18841
|
+
return props2.html;
|
|
18819
18842
|
if (!useSvgSprite && props2.src)
|
|
18820
18843
|
return props2.src;
|
|
18821
18844
|
const useSVGSymbol = (icon) => `<use xlink:href="#${icon}" />`;
|
|
@@ -18942,6 +18965,7 @@ var Footnote = {
|
|
|
18942
18965
|
};
|
|
18943
18966
|
var B = { tag: "b" };
|
|
18944
18967
|
var I = { tag: "i" };
|
|
18968
|
+
var Data = { tag: "data" };
|
|
18945
18969
|
|
|
18946
18970
|
// ../uikit/Atoms/Transform.js
|
|
18947
18971
|
var import_utils11 = __toESM(require_cjs());
|
|
@@ -19435,8 +19459,8 @@ var Link = {
|
|
|
19435
19459
|
},
|
|
19436
19460
|
attr: {
|
|
19437
19461
|
href: (el, s, ctx) => {
|
|
19438
|
-
const { isString: isString14, exec:
|
|
19439
|
-
const href =
|
|
19462
|
+
const { isString: isString14, exec: exec5, replaceLiteralsWithObjectFields: replaceLiteralsWithObjectFields3 } = ctx.utils;
|
|
19463
|
+
const href = exec5(el.props.href, el) || exec5(el.props, el).href;
|
|
19440
19464
|
if (isString14(href) && href.includes("{{")) {
|
|
19441
19465
|
return replaceLiteralsWithObjectFields3(href, s);
|
|
19442
19466
|
}
|
|
@@ -19452,8 +19476,8 @@ var RouterLink = {
|
|
|
19452
19476
|
click: (event, el, s) => {
|
|
19453
19477
|
const { props: props2, context: ctx } = el;
|
|
19454
19478
|
const { href: h, scrollToTop, stopPropagation } = props2;
|
|
19455
|
-
const { exec:
|
|
19456
|
-
let href =
|
|
19479
|
+
const { exec: exec5, isString: isString14, replaceLiteralsWithObjectFields: replaceLiteralsWithObjectFields3, isDefined: isDefined2 } = ctx.utils;
|
|
19480
|
+
let href = exec5(h, el, s);
|
|
19457
19481
|
if (isString14(href) && href.includes("{{")) {
|
|
19458
19482
|
href = replaceLiteralsWithObjectFields3(href, s);
|
|
19459
19483
|
}
|
|
@@ -22171,8 +22195,8 @@ var initRouter = (element, options) => {
|
|
|
22171
22195
|
const routerOptions = options.router;
|
|
22172
22196
|
const router2 = options.snippets && options.snippets.router ? options.snippets.router : import_router2.router;
|
|
22173
22197
|
const onRouterRenderDefault = (el, s) => {
|
|
22174
|
-
const { pathname, hash: hash3 } = import_utils20.window.location;
|
|
22175
|
-
const url2 = pathname + hash3;
|
|
22198
|
+
const { pathname, search, hash: hash3 } = import_utils20.window.location;
|
|
22199
|
+
const url2 = pathname + search + hash3;
|
|
22176
22200
|
if (el.routes)
|
|
22177
22201
|
router2(url2, el, {}, { initialRender: true });
|
|
22178
22202
|
};
|
|
@@ -22199,8 +22223,8 @@ var popStateRouter = (element, options) => {
|
|
|
22199
22223
|
return;
|
|
22200
22224
|
const router2 = options.snippets && options.snippets.router ? options.snippets.router : import_router2.router;
|
|
22201
22225
|
import_utils20.window.onpopstate = (e) => {
|
|
22202
|
-
const { pathname, hash: hash3 } = import_utils20.window.location;
|
|
22203
|
-
const url2 = pathname + hash3;
|
|
22226
|
+
const { pathname, search, hash: hash3 } = import_utils20.window.location;
|
|
22227
|
+
const url2 = pathname + search + hash3;
|
|
22204
22228
|
router2(url2, element, {}, { pushState: false, scrollToTop: false, level: 0 });
|
|
22205
22229
|
};
|
|
22206
22230
|
};
|
|
@@ -25591,19 +25615,29 @@ var ENV = "development";
|
|
|
25591
25615
|
var defautlOpts = {};
|
|
25592
25616
|
var CONNECT_ATTEPT = 0;
|
|
25593
25617
|
var CONNECT_ATTEPT_MAX_ALLOWED = 1;
|
|
25594
|
-
var
|
|
25595
|
-
|
|
25618
|
+
var getIsDev = (options) => {
|
|
25619
|
+
return options.development || window3 && window3.location && window3.location.host.includes("local") || (ENV === "test" || ENV === "development");
|
|
25620
|
+
};
|
|
25621
|
+
var getSocketUrl = (options, isDev) => {
|
|
25596
25622
|
const SOCKET_BACKEND_URL = isDev ? "http://localhost:13336/" : "https://socket.symbols.app/";
|
|
25597
25623
|
const socketUrls = isArray3(options.socketUrl) ? options.socketUrl : [options.socketUrl || SOCKET_BACKEND_URL];
|
|
25598
25624
|
const primaryUrl = socketUrls[0];
|
|
25599
25625
|
const secondaryUrl = socketUrls[1] || "socket.symbols.app";
|
|
25600
|
-
|
|
25626
|
+
return {
|
|
25627
|
+
primaryUrl: primaryUrl || SOCKET_BACKEND_URL,
|
|
25628
|
+
secondaryUrl
|
|
25629
|
+
};
|
|
25630
|
+
};
|
|
25631
|
+
var connect = (key, options = {}) => {
|
|
25632
|
+
const isDev = getIsDev(options);
|
|
25633
|
+
const { primaryUrl, secondaryUrl } = getSocketUrl(options, isDev);
|
|
25634
|
+
const socket = lookup2(primaryUrl || secondaryUrl, {
|
|
25601
25635
|
// withCredentials: true
|
|
25602
25636
|
});
|
|
25603
25637
|
socket.on("connect", () => {
|
|
25604
25638
|
if (isDev) {
|
|
25605
25639
|
console.log(
|
|
25606
|
-
`Connected to %c${primaryUrl
|
|
25640
|
+
`Connected to %c${primaryUrl} %c${key} %c${socket.id}`,
|
|
25607
25641
|
"font-weight: bold; color: green;",
|
|
25608
25642
|
"font-weight: bold;",
|
|
25609
25643
|
""
|
|
@@ -25868,7 +25902,9 @@ var connectedToSymbols = (clients, element, state) => {
|
|
|
25868
25902
|
state.update({ connected: false });
|
|
25869
25903
|
const t = setTimeout(() => {
|
|
25870
25904
|
delete state.notifications.connected;
|
|
25871
|
-
element.notifications.content.connected
|
|
25905
|
+
if (element.notifications.content.connected) {
|
|
25906
|
+
element.notifications.content.connected.setProps({ animation: "fadeOutDown" });
|
|
25907
|
+
}
|
|
25872
25908
|
state.update({ connected: true });
|
|
25873
25909
|
clearTimeout(t);
|
|
25874
25910
|
}, 3e3);
|
|
@@ -27930,6 +27966,7 @@ var initEmotion = (key, options = {}) => {
|
|
|
27930
27966
|
};
|
|
27931
27967
|
|
|
27932
27968
|
// src/prepare.js
|
|
27969
|
+
var ENV2 = "development";
|
|
27933
27970
|
var checkIfKeyIsComponent = (key) => {
|
|
27934
27971
|
const isFirstKeyString = (0, import_utils29.isString)(key);
|
|
27935
27972
|
if (!isFirstKeyString)
|
|
@@ -27956,17 +27993,18 @@ var prepareComponents = (options) => {
|
|
|
27956
27993
|
var prepareUtils = (options) => {
|
|
27957
27994
|
return { ...utilImports_exports, ...import_scratch2.scratchUtils, ...options.snippets || options.utils || options.functions || {} };
|
|
27958
27995
|
};
|
|
27959
|
-
var prepareDependencies = ({ dependencies, document: document2 }) => {
|
|
27996
|
+
var prepareDependencies = ({ dependencies, dependenciesOnDemand, document: document2 }) => {
|
|
27960
27997
|
if (!dependencies || Object.keys(dependencies).length === 0) {
|
|
27961
27998
|
return null;
|
|
27962
27999
|
}
|
|
27963
|
-
const ENV2 = "development";
|
|
27964
28000
|
for (const [dependency, version] of Object.entries(dependencies)) {
|
|
27965
28001
|
if (version === "loading" || version === "error") {
|
|
27966
28002
|
continue;
|
|
27967
28003
|
}
|
|
27968
28004
|
const random = ENV2 === "development" ? `?${Math.random()}` : "";
|
|
27969
28005
|
const url2 = `https://pkg.symbo.ls/${dependency}/${version}.js${random}`;
|
|
28006
|
+
if (dependenciesOnDemand && dependenciesOnDemand[dependency])
|
|
28007
|
+
continue;
|
|
27970
28008
|
try {
|
|
27971
28009
|
utilImports_exports.loadJavascriptFileSync(url2, document2);
|
|
27972
28010
|
} catch (e) {
|
|
@@ -27993,10 +28031,18 @@ var preparePackages = (packages, opts) => {
|
|
|
27993
28031
|
if (!windowOpts.requireOnDemand) {
|
|
27994
28032
|
windowOpts.requireOnDemand = (key) => {
|
|
27995
28033
|
const { dependenciesOnDemand, document: document2 } = opts;
|
|
27996
|
-
if (!windowOpts.packages[key]
|
|
27997
|
-
const
|
|
27998
|
-
|
|
27999
|
-
|
|
28034
|
+
if (!windowOpts.packages[key]) {
|
|
28035
|
+
const random = ENV2 === "development" ? `?${Math.random()}` : "";
|
|
28036
|
+
if (dependenciesOnDemand && dependenciesOnDemand[key]) {
|
|
28037
|
+
const version = dependenciesOnDemand[key];
|
|
28038
|
+
const url2 = `https://pkg.symbo.ls/${key}/${version}.js${random}`;
|
|
28039
|
+
utilImports_exports.loadJavascriptFileSync(url2, document2);
|
|
28040
|
+
} else {
|
|
28041
|
+
const url2 = `https://pkg.symbo.ls/${key}${random}`;
|
|
28042
|
+
utilImports_exports.loadJavascriptFileSync(url2, document2, () => {
|
|
28043
|
+
windowOpts.packages[key] = "loadedOnDeman";
|
|
28044
|
+
});
|
|
28045
|
+
}
|
|
28000
28046
|
}
|
|
28001
28047
|
return windowOpts.require(key);
|
|
28002
28048
|
};
|
package/dist/cjs/prepare.js
CHANGED
|
@@ -43,6 +43,7 @@ var import_utils = require("@domql/utils");
|
|
|
43
43
|
var import_initEmotion = require("./initEmotion");
|
|
44
44
|
var uikit = __toESM(require("@symbo.ls/uikit"), 1);
|
|
45
45
|
var utils = __toESM(require("./utilImports"), 1);
|
|
46
|
+
const ENV = "development";
|
|
46
47
|
const checkIfKeyIsComponent = (key) => {
|
|
47
48
|
const isFirstKeyString = (0, import_utils.isString)(key);
|
|
48
49
|
if (!isFirstKeyString)
|
|
@@ -69,17 +70,18 @@ const prepareComponents = (options) => {
|
|
|
69
70
|
const prepareUtils = (options) => {
|
|
70
71
|
return { ...utils, ...utils.scratchUtils, ...options.snippets || options.utils || options.functions || {} };
|
|
71
72
|
};
|
|
72
|
-
const prepareDependencies = ({ dependencies, document: document2 }) => {
|
|
73
|
+
const prepareDependencies = ({ dependencies, dependenciesOnDemand, document: document2 }) => {
|
|
73
74
|
if (!dependencies || Object.keys(dependencies).length === 0) {
|
|
74
75
|
return null;
|
|
75
76
|
}
|
|
76
|
-
const ENV = "development";
|
|
77
77
|
for (const [dependency, version] of Object.entries(dependencies)) {
|
|
78
78
|
if (version === "loading" || version === "error") {
|
|
79
79
|
continue;
|
|
80
80
|
}
|
|
81
81
|
const random = ENV === "development" ? `?${Math.random()}` : "";
|
|
82
82
|
const url = `https://pkg.symbo.ls/${dependency}/${version}.js${random}`;
|
|
83
|
+
if (dependenciesOnDemand && dependenciesOnDemand[dependency])
|
|
84
|
+
continue;
|
|
83
85
|
try {
|
|
84
86
|
utils.loadJavascriptFileSync(url, document2);
|
|
85
87
|
} catch (e) {
|
|
@@ -106,10 +108,18 @@ const preparePackages = (packages, opts) => {
|
|
|
106
108
|
if (!windowOpts.requireOnDemand) {
|
|
107
109
|
windowOpts.requireOnDemand = (key) => {
|
|
108
110
|
const { dependenciesOnDemand, document: document2 } = opts;
|
|
109
|
-
if (!windowOpts.packages[key]
|
|
110
|
-
const
|
|
111
|
-
|
|
112
|
-
|
|
111
|
+
if (!windowOpts.packages[key]) {
|
|
112
|
+
const random = ENV === "development" ? `?${Math.random()}` : "";
|
|
113
|
+
if (dependenciesOnDemand && dependenciesOnDemand[key]) {
|
|
114
|
+
const version = dependenciesOnDemand[key];
|
|
115
|
+
const url = `https://pkg.symbo.ls/${key}/${version}.js${random}`;
|
|
116
|
+
utils.loadJavascriptFileSync(url, document2);
|
|
117
|
+
} else {
|
|
118
|
+
const url = `https://pkg.symbo.ls/${key}${random}`;
|
|
119
|
+
utils.loadJavascriptFileSync(url, document2, () => {
|
|
120
|
+
windowOpts.packages[key] = "loadedOnDeman";
|
|
121
|
+
});
|
|
122
|
+
}
|
|
113
123
|
}
|
|
114
124
|
return windowOpts.require(key);
|
|
115
125
|
};
|
package/dist/cjs/router.js
CHANGED
|
@@ -41,8 +41,8 @@ const initRouter = (element, options) => {
|
|
|
41
41
|
const routerOptions = options.router;
|
|
42
42
|
const router = options.snippets && options.snippets.router ? options.snippets.router : import_router.router;
|
|
43
43
|
const onRouterRenderDefault = (el, s) => {
|
|
44
|
-
const { pathname, hash } = import_utils.window.location;
|
|
45
|
-
const url = pathname + hash;
|
|
44
|
+
const { pathname, search, hash } = import_utils.window.location;
|
|
45
|
+
const url = pathname + search + hash;
|
|
46
46
|
if (el.routes)
|
|
47
47
|
router(url, el, {}, { initialRender: true });
|
|
48
48
|
};
|
|
@@ -69,8 +69,8 @@ const popStateRouter = (element, options) => {
|
|
|
69
69
|
return;
|
|
70
70
|
const router = options.snippets && options.snippets.router ? options.snippets.router : import_router.router;
|
|
71
71
|
import_utils.window.onpopstate = (e) => {
|
|
72
|
-
const { pathname, hash } = import_utils.window.location;
|
|
73
|
-
const url = pathname + hash;
|
|
72
|
+
const { pathname, search, hash } = import_utils.window.location;
|
|
73
|
+
const url = pathname + search + hash;
|
|
74
74
|
router(url, element, {}, { pushState: false, scrollToTop: false, level: 0 });
|
|
75
75
|
};
|
|
76
76
|
};
|
package/package.json
CHANGED
package/src/prepare.js
CHANGED
|
@@ -6,6 +6,8 @@ import { initEmotion } from './initEmotion'
|
|
|
6
6
|
import * as uikit from '@symbo.ls/uikit'
|
|
7
7
|
import * as utils from './utilImports'
|
|
8
8
|
|
|
9
|
+
const ENV = process.env.NODE_ENV
|
|
10
|
+
|
|
9
11
|
const checkIfKeyIsComponent = (key) => {
|
|
10
12
|
const isFirstKeyString = isString(key)
|
|
11
13
|
if (!isFirstKeyString) return
|
|
@@ -35,13 +37,11 @@ export const prepareUtils = options => {
|
|
|
35
37
|
return { ...utils, ...utils.scratchUtils, ...(options.snippets || options.utils || options.functions || {}) }
|
|
36
38
|
}
|
|
37
39
|
|
|
38
|
-
export const prepareDependencies = ({ dependencies, document }) => {
|
|
40
|
+
export const prepareDependencies = ({ dependencies, dependenciesOnDemand, document }) => {
|
|
39
41
|
if (!dependencies || Object.keys(dependencies).length === 0) {
|
|
40
42
|
return null
|
|
41
43
|
}
|
|
42
44
|
|
|
43
|
-
const ENV = process.env.NODE_ENV
|
|
44
|
-
|
|
45
45
|
for (const [dependency, version] of Object.entries(dependencies)) {
|
|
46
46
|
if (version === 'loading' || version === 'error') {
|
|
47
47
|
continue
|
|
@@ -50,12 +50,15 @@ export const prepareDependencies = ({ dependencies, document }) => {
|
|
|
50
50
|
const random = ENV === 'development' ? `?${Math.random()}` : ''
|
|
51
51
|
const url = `https://pkg.symbo.ls/${dependency}/${version}.js${random}`
|
|
52
52
|
|
|
53
|
+
if (dependenciesOnDemand && dependenciesOnDemand[dependency]) continue
|
|
54
|
+
|
|
53
55
|
try {
|
|
54
56
|
utils.loadJavascriptFileSync(url, document)
|
|
55
57
|
} catch (e) {
|
|
56
58
|
console.error(`Failed to load ${dependency}:`, e)
|
|
57
59
|
}
|
|
58
60
|
}
|
|
61
|
+
|
|
59
62
|
return dependencies
|
|
60
63
|
}
|
|
61
64
|
|
|
@@ -79,10 +82,18 @@ export const preparePackages = (packages, opts) => {
|
|
|
79
82
|
if (!windowOpts.requireOnDemand) {
|
|
80
83
|
windowOpts.requireOnDemand = key => {
|
|
81
84
|
const { dependenciesOnDemand, document } = opts
|
|
82
|
-
if (!windowOpts.packages[key]
|
|
83
|
-
const
|
|
84
|
-
|
|
85
|
-
|
|
85
|
+
if (!windowOpts.packages[key]) {
|
|
86
|
+
const random = ENV === 'development' ? `?${Math.random()}` : ''
|
|
87
|
+
if (dependenciesOnDemand && dependenciesOnDemand[key]) {
|
|
88
|
+
const version = dependenciesOnDemand[key]
|
|
89
|
+
const url = `https://pkg.symbo.ls/${key}/${version}.js${random}`
|
|
90
|
+
utils.loadJavascriptFileSync(url, document)
|
|
91
|
+
} else {
|
|
92
|
+
const url = `https://pkg.symbo.ls/${key}${random}`
|
|
93
|
+
utils.loadJavascriptFileSync(url, document, () => {
|
|
94
|
+
windowOpts.packages[key] = 'loadedOnDeman'
|
|
95
|
+
})
|
|
96
|
+
}
|
|
86
97
|
}
|
|
87
98
|
return windowOpts.require(key)
|
|
88
99
|
}
|
package/src/router.js
CHANGED
|
@@ -19,8 +19,8 @@ export const initRouter = (element, options) => {
|
|
|
19
19
|
const router = (options.snippets && options.snippets.router) ? options.snippets.router : defaultRouter
|
|
20
20
|
|
|
21
21
|
const onRouterRenderDefault = (el, s) => {
|
|
22
|
-
const { pathname, hash } = window.location
|
|
23
|
-
const url = pathname + hash
|
|
22
|
+
const { pathname, search, hash } = window.location
|
|
23
|
+
const url = pathname + search + hash
|
|
24
24
|
if (el.routes) router(url, el, {}, { initialRender: true })
|
|
25
25
|
}
|
|
26
26
|
|
|
@@ -50,8 +50,8 @@ export const popStateRouter = (element, options) => {
|
|
|
50
50
|
? options.snippets.router
|
|
51
51
|
: defaultRouter
|
|
52
52
|
window.onpopstate = e => {
|
|
53
|
-
const { pathname, hash } = window.location
|
|
54
|
-
const url = pathname + hash
|
|
53
|
+
const { pathname, search, hash } = window.location
|
|
54
|
+
const url = pathname + search + hash
|
|
55
55
|
router(url, element, {}, { pushState: false, scrollToTop: false, level: 0 })
|
|
56
56
|
}
|
|
57
57
|
}
|