@symbo.ls/create 2.11.416 → 2.11.417
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 +30 -20
- package/dist/cjs/prepare.js +16 -6
- package/package.json +2 -2
- package/src/prepare.js +18 -7
package/dist/cjs/bundle/index.js
CHANGED
|
@@ -3214,7 +3214,7 @@ var require_cjs2 = __commonJS({
|
|
|
3214
3214
|
};
|
|
3215
3215
|
var import_globals2 = __toESM2(require_cjs18(), 1);
|
|
3216
3216
|
var import_utils32 = __toESM2(require_cjs22(), 1);
|
|
3217
|
-
var
|
|
3217
|
+
var ENV3 = "development";
|
|
3218
3218
|
var colorStringToRgbaArray = (color) => {
|
|
3219
3219
|
if (color === "")
|
|
3220
3220
|
return [0, 0, 0, 0];
|
|
@@ -3337,7 +3337,7 @@ var require_cjs2 = __commonJS({
|
|
|
3337
3337
|
var opacify2 = (color, opacity) => {
|
|
3338
3338
|
const arr = colorStringToRgbaArray(color);
|
|
3339
3339
|
if (!arr) {
|
|
3340
|
-
if (
|
|
3340
|
+
if (ENV3 === "test" || ENV3 === "development")
|
|
3341
3341
|
console.warn(color + " color is not rgba");
|
|
3342
3342
|
return;
|
|
3343
3343
|
}
|
|
@@ -11405,7 +11405,7 @@ var require_extendUtils = __commonJS({
|
|
|
11405
11405
|
});
|
|
11406
11406
|
module2.exports = __toCommonJS2(extendUtils_exports);
|
|
11407
11407
|
var import_utils32 = require_cjs();
|
|
11408
|
-
var
|
|
11408
|
+
var ENV3 = "development";
|
|
11409
11409
|
var generateHash = () => Math.random().toString(36).substring(2);
|
|
11410
11410
|
var extendStackRegistry = {};
|
|
11411
11411
|
var extendCachedRegistry = {};
|
|
@@ -11486,7 +11486,7 @@ var require_extendUtils = __commonJS({
|
|
|
11486
11486
|
else if (pageExists)
|
|
11487
11487
|
return pageExists;
|
|
11488
11488
|
else {
|
|
11489
|
-
if (options.verbose && (
|
|
11489
|
+
if (options.verbose && (ENV3 === "test" || ENV3 === "development")) {
|
|
11490
11490
|
console.warn("Extend is string but component was not found:", extend);
|
|
11491
11491
|
}
|
|
11492
11492
|
return {};
|
|
@@ -11540,7 +11540,7 @@ var require_extend = __commonJS({
|
|
|
11540
11540
|
module2.exports = __toCommonJS2(extend_exports);
|
|
11541
11541
|
var import_utils32 = require_cjs();
|
|
11542
11542
|
var import_utils210 = require_utils();
|
|
11543
|
-
var
|
|
11543
|
+
var ENV3 = "development";
|
|
11544
11544
|
var mainExtend;
|
|
11545
11545
|
var applyExtend = (element, parent, options = {}) => {
|
|
11546
11546
|
if ((0, import_utils32.isFunction)(element))
|
|
@@ -11549,7 +11549,7 @@ var require_extend = __commonJS({
|
|
|
11549
11549
|
const context = element.context || parent.context;
|
|
11550
11550
|
extend = (0, import_utils210.fallbackStringExtend)(extend, context, options);
|
|
11551
11551
|
const extendStack = (0, import_utils210.getExtendStack)(extend, context);
|
|
11552
|
-
if (
|
|
11552
|
+
if (ENV3 !== "test" || ENV3 !== "development")
|
|
11553
11553
|
delete element.extend;
|
|
11554
11554
|
let childExtendStack = [];
|
|
11555
11555
|
if (parent) {
|
|
@@ -11639,7 +11639,7 @@ var require_component = __commonJS({
|
|
|
11639
11639
|
module2.exports = __toCommonJS2(component_exports);
|
|
11640
11640
|
var import_utils32 = require_cjs();
|
|
11641
11641
|
var import_extend = require_extend();
|
|
11642
|
-
var
|
|
11642
|
+
var ENV3 = "development";
|
|
11643
11643
|
var DOMQL_BUILTINS = [
|
|
11644
11644
|
"extend",
|
|
11645
11645
|
"childExtend",
|
|
@@ -11743,7 +11743,7 @@ var require_component = __commonJS({
|
|
|
11743
11743
|
if (componentExists)
|
|
11744
11744
|
element.extend = componentExists;
|
|
11745
11745
|
else {
|
|
11746
|
-
if ((
|
|
11746
|
+
if ((ENV3 === "test" || ENV3 === "development") && options.verbose) {
|
|
11747
11747
|
console.warn(execExtend, "is not in library", components, element);
|
|
11748
11748
|
console.warn("replacing with ", {});
|
|
11749
11749
|
}
|
|
@@ -12079,7 +12079,7 @@ var require_node2 = __commonJS({
|
|
|
12079
12079
|
var import_applyParam = require_applyParam();
|
|
12080
12080
|
var import_utils210 = require_utils();
|
|
12081
12081
|
var import_propEvents = require_propEvents();
|
|
12082
|
-
var
|
|
12082
|
+
var ENV3 = "development";
|
|
12083
12083
|
var createNode = (element, options) => {
|
|
12084
12084
|
let { node: node3, tag, __ref: ref } = element;
|
|
12085
12085
|
let isNewNode;
|
|
@@ -12093,7 +12093,7 @@ var require_node2 = __commonJS({
|
|
|
12093
12093
|
node3 = element.node = (0, import_render.cacheNode)(element);
|
|
12094
12094
|
(0, import_event.triggerEventOn)("attachNode", element, options);
|
|
12095
12095
|
}
|
|
12096
|
-
if (
|
|
12096
|
+
if (ENV3 === "test" || ENV3 === "development" || options.alowRefReference) {
|
|
12097
12097
|
node3.ref = element;
|
|
12098
12098
|
if ((0, import_utils32.isFunction)(node3.setAttribute))
|
|
12099
12099
|
node3.setAttribute("key", element.key);
|
|
@@ -14090,7 +14090,7 @@ var require_create4 = __commonJS({
|
|
|
14090
14090
|
var import_utils32 = require_cjs();
|
|
14091
14091
|
var import_options3 = __toESM2(require_options(), 1);
|
|
14092
14092
|
var import_component = require_component();
|
|
14093
|
-
var
|
|
14093
|
+
var ENV3 = "development";
|
|
14094
14094
|
var create2 = (element, parent, key, options = import_options3.default.create || {}, attachOptions) => {
|
|
14095
14095
|
cacheOptions(element, options);
|
|
14096
14096
|
if (checkIfPrimitive(element)) {
|
|
@@ -14138,13 +14138,13 @@ var require_create4 = __commonJS({
|
|
|
14138
14138
|
};
|
|
14139
14139
|
var createBasedOnType = (element, parent, key, options) => {
|
|
14140
14140
|
if (element === void 0) {
|
|
14141
|
-
if (
|
|
14141
|
+
if (ENV3 === "test" || ENV3 === "development") {
|
|
14142
14142
|
console.warn(key, "element is undefined in", parent && parent.__ref && parent.__ref.path);
|
|
14143
14143
|
}
|
|
14144
14144
|
return {};
|
|
14145
14145
|
}
|
|
14146
14146
|
if ((0, import_utils32.isString)(key) && key.slice(0, 2 === "__")) {
|
|
14147
|
-
if (
|
|
14147
|
+
if (ENV3 === "test" || ENV3 === "development") {
|
|
14148
14148
|
console.warn(key, "seems like to be in __ref");
|
|
14149
14149
|
}
|
|
14150
14150
|
}
|
|
@@ -14215,7 +14215,7 @@ var require_create4 = __commonJS({
|
|
|
14215
14215
|
try {
|
|
14216
14216
|
(0, import_node.default)(element, options);
|
|
14217
14217
|
} catch (e) {
|
|
14218
|
-
if (
|
|
14218
|
+
if (ENV3 === "test" || ENV3 === "development")
|
|
14219
14219
|
console.warn(element, e);
|
|
14220
14220
|
}
|
|
14221
14221
|
if (!ref.__if) {
|
|
@@ -27930,6 +27930,7 @@ var initEmotion = (key, options = {}) => {
|
|
|
27930
27930
|
};
|
|
27931
27931
|
|
|
27932
27932
|
// src/prepare.js
|
|
27933
|
+
var ENV2 = "development";
|
|
27933
27934
|
var checkIfKeyIsComponent = (key) => {
|
|
27934
27935
|
const isFirstKeyString = (0, import_utils29.isString)(key);
|
|
27935
27936
|
if (!isFirstKeyString)
|
|
@@ -27956,17 +27957,18 @@ var prepareComponents = (options) => {
|
|
|
27956
27957
|
var prepareUtils = (options) => {
|
|
27957
27958
|
return { ...utilImports_exports, ...import_scratch2.scratchUtils, ...options.snippets || options.utils || options.functions || {} };
|
|
27958
27959
|
};
|
|
27959
|
-
var prepareDependencies = ({ dependencies, document: document2 }) => {
|
|
27960
|
+
var prepareDependencies = ({ dependencies, dependenciesOnDemand, document: document2 }) => {
|
|
27960
27961
|
if (!dependencies || Object.keys(dependencies).length === 0) {
|
|
27961
27962
|
return null;
|
|
27962
27963
|
}
|
|
27963
|
-
const ENV2 = "development";
|
|
27964
27964
|
for (const [dependency, version] of Object.entries(dependencies)) {
|
|
27965
27965
|
if (version === "loading" || version === "error") {
|
|
27966
27966
|
continue;
|
|
27967
27967
|
}
|
|
27968
27968
|
const random = ENV2 === "development" ? `?${Math.random()}` : "";
|
|
27969
27969
|
const url2 = `https://pkg.symbo.ls/${dependency}/${version}.js${random}`;
|
|
27970
|
+
if (dependenciesOnDemand && dependenciesOnDemand[dependency])
|
|
27971
|
+
continue;
|
|
27970
27972
|
try {
|
|
27971
27973
|
utilImports_exports.loadJavascriptFileSync(url2, document2);
|
|
27972
27974
|
} catch (e) {
|
|
@@ -27993,10 +27995,18 @@ var preparePackages = (packages, opts) => {
|
|
|
27993
27995
|
if (!windowOpts.requireOnDemand) {
|
|
27994
27996
|
windowOpts.requireOnDemand = (key) => {
|
|
27995
27997
|
const { dependenciesOnDemand, document: document2 } = opts;
|
|
27996
|
-
if (!windowOpts.packages[key]
|
|
27997
|
-
const
|
|
27998
|
-
|
|
27999
|
-
|
|
27998
|
+
if (!windowOpts.packages[key]) {
|
|
27999
|
+
const random = ENV2 === "development" ? `?${Math.random()}` : "";
|
|
28000
|
+
if (dependenciesOnDemand && dependenciesOnDemand[key]) {
|
|
28001
|
+
const version = dependenciesOnDemand[key];
|
|
28002
|
+
const url2 = `https://pkg.symbo.ls/${key}/${version}.js${random}`;
|
|
28003
|
+
utilImports_exports.loadJavascriptFileSync(url2, document2);
|
|
28004
|
+
} else {
|
|
28005
|
+
const url2 = `https://pkg.symbo.ls/${key}${random}`;
|
|
28006
|
+
utilImports_exports.loadJavascriptFileSync(url2, document2, () => {
|
|
28007
|
+
windowOpts.packages[key] = "loadedOnDeman";
|
|
28008
|
+
});
|
|
28009
|
+
}
|
|
28000
28010
|
}
|
|
28001
28011
|
return windowOpts.require(key);
|
|
28002
28012
|
};
|
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/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
|
}
|