@symbo.ls/create 2.27.8 → 2.27.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/createDomql.js +17 -11
- package/dist/cjs/index.js +31 -10
- package/dist/cjs/initEmotion.js +1 -1
- package/dist/cjs/options.js +1 -1
- package/dist/cjs/prepare.js +13 -6
- package/dist/esm/createDomql.js +21 -10
- package/dist/esm/index.js +19 -7
- package/dist/esm/initEmotion.js +1 -1
- package/dist/esm/options.js +1 -1
- package/dist/esm/prepare.js +7 -6
- package/package.json +18 -18
- package/src/createDomql.js +23 -12
- package/src/index.js +57 -19
- package/src/initEmotion.js +7 -5
- package/src/options.js +1 -1
- package/src/prepare.js +28 -13
package/dist/cjs/createDomql.js
CHANGED
|
@@ -36,15 +36,18 @@ var import_domql = __toESM(require("domql"), 1);
|
|
|
36
36
|
var uikit = __toESM(require("@symbo.ls/uikit"), 1);
|
|
37
37
|
var import_utils = require("@domql/utils");
|
|
38
38
|
var import_event = require("@domql/event");
|
|
39
|
-
var import_define = require("./define");
|
|
40
|
-
var import_router = require("./router");
|
|
41
|
-
var import_syncExtend = require("./syncExtend");
|
|
42
|
-
var import_prepare = require("./prepare");
|
|
39
|
+
var import_define = require("./define.js");
|
|
40
|
+
var import_router = require("./router.js");
|
|
41
|
+
var import_syncExtend = require("./syncExtend.js");
|
|
42
|
+
var import_prepare = require("./prepare.js");
|
|
43
43
|
const prepareContext = (app, context = {}) => {
|
|
44
44
|
const key = context.key = context.key || ((0, import_utils.isString)(app) ? app : "smblsapp");
|
|
45
45
|
context.define = context.define || import_define.defaultDefine;
|
|
46
46
|
context.window = (0, import_prepare.prepareWindow)(context);
|
|
47
|
-
const [scratcDesignSystem, emotion, registry] = (0, import_prepare.prepareDesignSystem)(
|
|
47
|
+
const [scratcDesignSystem, emotion, registry] = (0, import_prepare.prepareDesignSystem)(
|
|
48
|
+
key,
|
|
49
|
+
context
|
|
50
|
+
);
|
|
48
51
|
context.designSystem = scratcDesignSystem;
|
|
49
52
|
context.registry = registry;
|
|
50
53
|
context.emotion = emotion;
|
|
@@ -79,12 +82,15 @@ const createDomqlElement = async (app, ctx) => {
|
|
|
79
82
|
app.context = ctx;
|
|
80
83
|
app.data = app.data || {};
|
|
81
84
|
app.data.frameListeners = (0, import_event.initAnimationFrame)(ctx);
|
|
82
|
-
(0, import_prepare.prepareRequire)(
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
85
|
+
(0, import_prepare.prepareRequire)(
|
|
86
|
+
{
|
|
87
|
+
functions: ctx.functions,
|
|
88
|
+
utils: ctx.utils,
|
|
89
|
+
snippets: ctx.snippets,
|
|
90
|
+
...ctx.files
|
|
91
|
+
},
|
|
92
|
+
ctx
|
|
93
|
+
);
|
|
88
94
|
(0, import_syncExtend.initializeSync)(app, ctx);
|
|
89
95
|
(0, import_syncExtend.initializeInspect)(app, ctx);
|
|
90
96
|
(0, import_syncExtend.initializeNotifications)(app, ctx);
|
package/dist/cjs/index.js
CHANGED
|
@@ -36,36 +36,57 @@ __export(index_exports, {
|
|
|
36
36
|
});
|
|
37
37
|
module.exports = __toCommonJS(index_exports);
|
|
38
38
|
var import_utils = require("@domql/utils");
|
|
39
|
-
var utils = __toESM(require("./utilImports"), 1);
|
|
40
|
-
var import_router = require("./router");
|
|
41
|
-
var import_ferchOnCreate = require("./ferchOnCreate");
|
|
42
|
-
var import_options = __toESM(require("./options"), 1);
|
|
39
|
+
var utils = __toESM(require("./utilImports.js"), 1);
|
|
40
|
+
var import_router = require("./router.js");
|
|
41
|
+
var import_ferchOnCreate = require("./ferchOnCreate.js");
|
|
42
|
+
var import_options = __toESM(require("./options.js"), 1);
|
|
43
43
|
var import_dynamic = __toESM(require("@symbo.ls/init/dynamic.json"), 1);
|
|
44
|
-
var import_createDomql = require("./createDomql");
|
|
44
|
+
var import_createDomql = require("./createDomql.js");
|
|
45
45
|
const mergeWithLocalFile = (options, optionsExternalFile) => (0, import_utils.deepMerge)(
|
|
46
46
|
options,
|
|
47
47
|
(0, import_utils.isObject)(optionsExternalFile) ? optionsExternalFile : import_dynamic.default || {}
|
|
48
48
|
);
|
|
49
49
|
const create = (App, options = import_options.default, optionsExternalFile) => {
|
|
50
|
-
const redefinedOptions = {
|
|
50
|
+
const redefinedOptions = {
|
|
51
|
+
...import_options.default,
|
|
52
|
+
...mergeWithLocalFile(options, optionsExternalFile)
|
|
53
|
+
};
|
|
51
54
|
const domqlApp = (0, import_createDomql.createDomqlElement)(App, redefinedOptions);
|
|
52
55
|
(0, import_router.popStateRouter)(domqlApp, redefinedOptions);
|
|
53
|
-
if (redefinedOptions.on && redefinedOptions.on.create)
|
|
56
|
+
if (redefinedOptions.on && redefinedOptions.on.create)
|
|
57
|
+
redefinedOptions.on.create(
|
|
58
|
+
domqlApp,
|
|
59
|
+
domqlApp.state,
|
|
60
|
+
domqlApp.context,
|
|
61
|
+
redefinedOptions
|
|
62
|
+
);
|
|
54
63
|
return domqlApp;
|
|
55
64
|
};
|
|
56
65
|
const createAsync = (App, options = import_options.default, optionsExternalFile) => {
|
|
57
66
|
const domqlApp = create(App, options, optionsExternalFile);
|
|
58
|
-
const redefinedOptions = {
|
|
67
|
+
const redefinedOptions = {
|
|
68
|
+
...import_options.default,
|
|
69
|
+
...mergeWithLocalFile(options, optionsExternalFile)
|
|
70
|
+
};
|
|
59
71
|
const key = redefinedOptions.key;
|
|
60
72
|
(0, import_ferchOnCreate.fetchAsync)(domqlApp, key, { utils, ...redefinedOptions });
|
|
61
73
|
return domqlApp;
|
|
62
74
|
};
|
|
63
75
|
const createSync = async (App, options = import_options.default, optionsExternalFile) => {
|
|
64
|
-
const redefinedOptions = {
|
|
76
|
+
const redefinedOptions = {
|
|
77
|
+
...import_options.default,
|
|
78
|
+
...mergeWithLocalFile(options, optionsExternalFile)
|
|
79
|
+
};
|
|
65
80
|
const key = options.key;
|
|
66
81
|
await (0, import_ferchOnCreate.fetchSync)(key, redefinedOptions);
|
|
67
82
|
const domqlApp = await (0, import_createDomql.createDomqlElement)(App, redefinedOptions);
|
|
68
|
-
if (redefinedOptions.on && redefinedOptions.on.create)
|
|
83
|
+
if (redefinedOptions.on && redefinedOptions.on.create)
|
|
84
|
+
await redefinedOptions.on.create(
|
|
85
|
+
domqlApp,
|
|
86
|
+
domqlApp.state,
|
|
87
|
+
domqlApp.context,
|
|
88
|
+
redefinedOptions
|
|
89
|
+
);
|
|
69
90
|
return domqlApp;
|
|
70
91
|
};
|
|
71
92
|
const createSkeleton = (App = {}, options = import_options.default, optionsExternalFile) => {
|
package/dist/cjs/initEmotion.js
CHANGED
|
@@ -25,7 +25,7 @@ var import_emotion = require("@domql/emotion");
|
|
|
25
25
|
var import_emotion2 = require("@symbo.ls/emotion");
|
|
26
26
|
var import_init = require("@symbo.ls/init");
|
|
27
27
|
var import_utils = require("@domql/utils");
|
|
28
|
-
var import_options = require("./options");
|
|
28
|
+
var import_options = require("./options.js");
|
|
29
29
|
var import_default_config = require("@symbo.ls/default-config");
|
|
30
30
|
const initEmotion = (key, options = {}) => {
|
|
31
31
|
var _a;
|
package/dist/cjs/options.js
CHANGED
|
@@ -23,7 +23,7 @@ __export(options_exports, {
|
|
|
23
23
|
default: () => options_default
|
|
24
24
|
});
|
|
25
25
|
module.exports = __toCommonJS(options_exports);
|
|
26
|
-
var import_define = require("./define");
|
|
26
|
+
var import_define = require("./define.js");
|
|
27
27
|
const DESIGN_SYSTEM_OPTIONS = {
|
|
28
28
|
useReset: true,
|
|
29
29
|
useVariable: true,
|
package/dist/cjs/prepare.js
CHANGED
|
@@ -41,11 +41,11 @@ __export(prepare_exports, {
|
|
|
41
41
|
});
|
|
42
42
|
module.exports = __toCommonJS(prepare_exports);
|
|
43
43
|
var import_utils = require("@domql/utils");
|
|
44
|
-
var import_initEmotion = require("./initEmotion");
|
|
44
|
+
var import_initEmotion = require("./initEmotion.js");
|
|
45
45
|
var uikit = __toESM(require("@symbo.ls/uikit"), 1);
|
|
46
|
-
var utils = __toESM(require("./utilImports"), 1);
|
|
46
|
+
var utils = __toESM(require("./utilImports.js"), 1);
|
|
47
47
|
var routerUtils = __toESM(require("@domql/router"), 1);
|
|
48
|
-
|
|
48
|
+
// @preserve-env
|
|
49
49
|
const prepareWindow = (context) => {
|
|
50
50
|
if (typeof window === "undefined") window = globalThis || {};
|
|
51
51
|
if (typeof document === "undefined") {
|
|
@@ -75,7 +75,14 @@ const prepareComponents = (context) => {
|
|
|
75
75
|
return context.components ? { ...UIkitWithPrefix(), ...context.components } : UIkitWithPrefix();
|
|
76
76
|
};
|
|
77
77
|
const prepareUtils = (context) => {
|
|
78
|
-
return {
|
|
78
|
+
return {
|
|
79
|
+
...utils,
|
|
80
|
+
...routerUtils,
|
|
81
|
+
...utils.scratchUtils,
|
|
82
|
+
...context.utils,
|
|
83
|
+
...context.snippets,
|
|
84
|
+
...context.functions
|
|
85
|
+
};
|
|
79
86
|
};
|
|
80
87
|
const prepareMethods = (context) => {
|
|
81
88
|
return {
|
|
@@ -101,7 +108,7 @@ const prepareDependencies = ({
|
|
|
101
108
|
if (version === "loading" || version === "error") {
|
|
102
109
|
continue;
|
|
103
110
|
}
|
|
104
|
-
const random =
|
|
111
|
+
const random = (0, import_utils.isDevelopment)() ? `?${Math.random()}` : "";
|
|
105
112
|
let url = `https://pkg.symbo.ls/${dependency}/${version}.js${random}`;
|
|
106
113
|
if (dependency.split("/").length > 2 || !onlyDotsAndNumbers(version)) {
|
|
107
114
|
url = `https://pkg.symbo.ls/${dependency}${random}`;
|
|
@@ -130,7 +137,7 @@ const prepareRequire = (packages, ctx) => {
|
|
|
130
137
|
const documentOpts = ctx2.document || document;
|
|
131
138
|
const windowOpts2 = ctx2.window || window;
|
|
132
139
|
if (!windowOpts2.packages[key]) {
|
|
133
|
-
const random =
|
|
140
|
+
const random = (0, import_utils.isDevelopment)() ? `?${Math.random()}` : "";
|
|
134
141
|
if (dependenciesOnDemand && dependenciesOnDemand[key]) {
|
|
135
142
|
const version = dependenciesOnDemand[key];
|
|
136
143
|
const url = `https://pkg.symbo.ls/${key}/${version}.js${random}`;
|
package/dist/esm/createDomql.js
CHANGED
|
@@ -18,9 +18,14 @@ import DOM from "domql";
|
|
|
18
18
|
import * as uikit from "@symbo.ls/uikit";
|
|
19
19
|
import { isString, isNode, isObject } from "@domql/utils";
|
|
20
20
|
import { initAnimationFrame } from "@domql/event";
|
|
21
|
-
import { defaultDefine } from "./define";
|
|
22
|
-
import { initRouter } from "./router";
|
|
23
|
-
import {
|
|
21
|
+
import { defaultDefine } from "./define.js";
|
|
22
|
+
import { initRouter } from "./router.js";
|
|
23
|
+
import {
|
|
24
|
+
initializeExtend,
|
|
25
|
+
initializeInspect,
|
|
26
|
+
initializeNotifications,
|
|
27
|
+
initializeSync
|
|
28
|
+
} from "./syncExtend.js";
|
|
24
29
|
import {
|
|
25
30
|
prepareComponents,
|
|
26
31
|
prepareDependencies,
|
|
@@ -31,12 +36,15 @@ import {
|
|
|
31
36
|
prepareState,
|
|
32
37
|
prepareUtils,
|
|
33
38
|
prepareMethods
|
|
34
|
-
} from "./prepare";
|
|
39
|
+
} from "./prepare.js";
|
|
35
40
|
const prepareContext = (app, context = {}) => {
|
|
36
41
|
const key = context.key = context.key || (isString(app) ? app : "smblsapp");
|
|
37
42
|
context.define = context.define || defaultDefine;
|
|
38
43
|
context.window = prepareWindow(context);
|
|
39
|
-
const [scratcDesignSystem, emotion, registry] = prepareDesignSystem(
|
|
44
|
+
const [scratcDesignSystem, emotion, registry] = prepareDesignSystem(
|
|
45
|
+
key,
|
|
46
|
+
context
|
|
47
|
+
);
|
|
40
48
|
context.designSystem = scratcDesignSystem;
|
|
41
49
|
context.registry = registry;
|
|
42
50
|
context.emotion = emotion;
|
|
@@ -71,11 +79,14 @@ const createDomqlElement = async (app, ctx) => {
|
|
|
71
79
|
app.context = ctx;
|
|
72
80
|
app.data = app.data || {};
|
|
73
81
|
app.data.frameListeners = initAnimationFrame(ctx);
|
|
74
|
-
prepareRequire(
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
82
|
+
prepareRequire(
|
|
83
|
+
__spreadValues({
|
|
84
|
+
functions: ctx.functions,
|
|
85
|
+
utils: ctx.utils,
|
|
86
|
+
snippets: ctx.snippets
|
|
87
|
+
}, ctx.files),
|
|
88
|
+
ctx
|
|
89
|
+
);
|
|
79
90
|
initializeSync(app, ctx);
|
|
80
91
|
initializeInspect(app, ctx);
|
|
81
92
|
initializeNotifications(app, ctx);
|
package/dist/esm/index.js
CHANGED
|
@@ -15,12 +15,12 @@ var __spreadValues = (a, b) => {
|
|
|
15
15
|
return a;
|
|
16
16
|
};
|
|
17
17
|
import { deepMerge, isObject, isUndefined } from "@domql/utils";
|
|
18
|
-
import * as utils from "./utilImports";
|
|
19
|
-
import { popStateRouter } from "./router";
|
|
20
|
-
import { fetchAsync, fetchSync } from "./ferchOnCreate";
|
|
21
|
-
import DEFAULT_CREATE_OPTIONS from "./options";
|
|
18
|
+
import * as utils from "./utilImports.js";
|
|
19
|
+
import { popStateRouter } from "./router.js";
|
|
20
|
+
import { fetchAsync, fetchSync } from "./ferchOnCreate.js";
|
|
21
|
+
import DEFAULT_CREATE_OPTIONS from "./options.js";
|
|
22
22
|
import DYNAMIC_JSON from "@symbo.ls/init/dynamic.json";
|
|
23
|
-
import { createDomqlElement } from "./createDomql";
|
|
23
|
+
import { createDomqlElement } from "./createDomql.js";
|
|
24
24
|
const mergeWithLocalFile = (options, optionsExternalFile) => deepMerge(
|
|
25
25
|
options,
|
|
26
26
|
isObject(optionsExternalFile) ? optionsExternalFile : DYNAMIC_JSON || {}
|
|
@@ -29,7 +29,13 @@ const create = (App, options = DEFAULT_CREATE_OPTIONS, optionsExternalFile) => {
|
|
|
29
29
|
const redefinedOptions = __spreadValues(__spreadValues({}, DEFAULT_CREATE_OPTIONS), mergeWithLocalFile(options, optionsExternalFile));
|
|
30
30
|
const domqlApp = createDomqlElement(App, redefinedOptions);
|
|
31
31
|
popStateRouter(domqlApp, redefinedOptions);
|
|
32
|
-
if (redefinedOptions.on && redefinedOptions.on.create)
|
|
32
|
+
if (redefinedOptions.on && redefinedOptions.on.create)
|
|
33
|
+
redefinedOptions.on.create(
|
|
34
|
+
domqlApp,
|
|
35
|
+
domqlApp.state,
|
|
36
|
+
domqlApp.context,
|
|
37
|
+
redefinedOptions
|
|
38
|
+
);
|
|
33
39
|
return domqlApp;
|
|
34
40
|
};
|
|
35
41
|
const createAsync = (App, options = DEFAULT_CREATE_OPTIONS, optionsExternalFile) => {
|
|
@@ -44,7 +50,13 @@ const createSync = async (App, options = DEFAULT_CREATE_OPTIONS, optionsExternal
|
|
|
44
50
|
const key = options.key;
|
|
45
51
|
await fetchSync(key, redefinedOptions);
|
|
46
52
|
const domqlApp = await createDomqlElement(App, redefinedOptions);
|
|
47
|
-
if (redefinedOptions.on && redefinedOptions.on.create)
|
|
53
|
+
if (redefinedOptions.on && redefinedOptions.on.create)
|
|
54
|
+
await redefinedOptions.on.create(
|
|
55
|
+
domqlApp,
|
|
56
|
+
domqlApp.state,
|
|
57
|
+
domqlApp.context,
|
|
58
|
+
redefinedOptions
|
|
59
|
+
);
|
|
48
60
|
return domqlApp;
|
|
49
61
|
};
|
|
50
62
|
const createSkeleton = (App = {}, options = DEFAULT_CREATE_OPTIONS, optionsExternalFile) => {
|
package/dist/esm/initEmotion.js
CHANGED
|
@@ -18,7 +18,7 @@ import { transformDOMQLEmotion } from "@domql/emotion";
|
|
|
18
18
|
import { emotion as defaultEmotion } from "@symbo.ls/emotion";
|
|
19
19
|
import { init } from "@symbo.ls/init";
|
|
20
20
|
import { deepClone, deepMerge } from "@domql/utils";
|
|
21
|
-
import { DESIGN_SYSTEM_OPTIONS } from "./options";
|
|
21
|
+
import { DESIGN_SYSTEM_OPTIONS } from "./options.js";
|
|
22
22
|
import { DEFAULT_CONFIG } from "@symbo.ls/default-config";
|
|
23
23
|
const initEmotion = (key, options = {}) => {
|
|
24
24
|
var _a;
|
package/dist/esm/options.js
CHANGED
package/dist/esm/prepare.js
CHANGED
|
@@ -22,13 +22,14 @@ import {
|
|
|
22
22
|
deepMerge,
|
|
23
23
|
deepClone,
|
|
24
24
|
merge,
|
|
25
|
-
checkIfKeyIsComponent
|
|
25
|
+
checkIfKeyIsComponent,
|
|
26
|
+
isDevelopment
|
|
26
27
|
} from "@domql/utils";
|
|
27
|
-
import { initEmotion } from "./initEmotion";
|
|
28
|
+
import { initEmotion } from "./initEmotion.js";
|
|
28
29
|
import * as uikit from "@symbo.ls/uikit";
|
|
29
|
-
import * as utils from "./utilImports";
|
|
30
|
+
import * as utils from "./utilImports.js";
|
|
30
31
|
import * as routerUtils from "@domql/router";
|
|
31
|
-
|
|
32
|
+
// @preserve-env
|
|
32
33
|
const prepareWindow = (context) => {
|
|
33
34
|
if (typeof window === "undefined") window = globalThis || {};
|
|
34
35
|
if (typeof document === "undefined") {
|
|
@@ -83,7 +84,7 @@ const prepareDependencies = ({
|
|
|
83
84
|
if (version === "loading" || version === "error") {
|
|
84
85
|
continue;
|
|
85
86
|
}
|
|
86
|
-
const random =
|
|
87
|
+
const random = isDevelopment() ? `?${Math.random()}` : "";
|
|
87
88
|
let url = `https://pkg.symbo.ls/${dependency}/${version}.js${random}`;
|
|
88
89
|
if (dependency.split("/").length > 2 || !onlyDotsAndNumbers(version)) {
|
|
89
90
|
url = `https://pkg.symbo.ls/${dependency}${random}`;
|
|
@@ -112,7 +113,7 @@ const prepareRequire = (packages, ctx) => {
|
|
|
112
113
|
const documentOpts = ctx2.document || document;
|
|
113
114
|
const windowOpts2 = ctx2.window || window;
|
|
114
115
|
if (!windowOpts2.packages[key]) {
|
|
115
|
-
const random =
|
|
116
|
+
const random = isDevelopment() ? `?${Math.random()}` : "";
|
|
116
117
|
if (dependenciesOnDemand && dependenciesOnDemand[key]) {
|
|
117
118
|
const version = dependenciesOnDemand[key];
|
|
118
119
|
const url = `https://pkg.symbo.ls/${key}/${version}.js${random}`;
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@symbo.ls/create",
|
|
3
|
-
"version": "2.27.
|
|
3
|
+
"version": "2.27.10",
|
|
4
4
|
"license": "MIT",
|
|
5
|
-
"gitHead": "
|
|
5
|
+
"gitHead": "668d24f518bdb163357897504c5912c085638d3e",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"module": "src/index.js",
|
|
8
8
|
"main": "src/index.js",
|
|
@@ -10,9 +10,9 @@
|
|
|
10
10
|
"jsdelivr": "dist/iife/index.js",
|
|
11
11
|
"exports": {
|
|
12
12
|
".": {
|
|
13
|
-
"default": "./dist/esm/index.js",
|
|
14
13
|
"import": "./dist/esm/index.js",
|
|
15
|
-
"require": "./dist/cjs/index.js"
|
|
14
|
+
"require": "./dist/cjs/index.js",
|
|
15
|
+
"default": "./dist/esm/index.js"
|
|
16
16
|
}
|
|
17
17
|
},
|
|
18
18
|
"source": "src/index.js",
|
|
@@ -22,24 +22,24 @@
|
|
|
22
22
|
],
|
|
23
23
|
"scripts": {
|
|
24
24
|
"copy:package:cjs": "cp ../../build/package-cjs.json dist/cjs/package.json",
|
|
25
|
-
"build:esm": "cross-env NODE_ENV=$NODE_ENV npx esbuild src/*.js --target=es2017 --format=esm --outdir=dist/esm",
|
|
26
|
-
"build:cjs": "cross-env NODE_ENV=$NODE_ENV npx esbuild src/*.js --target=node16 --format=cjs --outdir=dist/cjs",
|
|
27
|
-
"build:iife": "cross-env NODE_ENV=$NODE_ENV npx esbuild src/*.js --target=node16 --format=iife --outdir=dist/iife",
|
|
25
|
+
"build:esm": "npx cross-env NODE_ENV=$NODE_ENV npx esbuild src/*.js --target=es2017 --format=esm --outdir=dist/esm",
|
|
26
|
+
"build:cjs": "npx cross-env NODE_ENV=$NODE_ENV npx esbuild src/*.js --target=node16 --format=cjs --outdir=dist/cjs",
|
|
27
|
+
"build:iife": "npx cross-env NODE_ENV=$NODE_ENV npx esbuild src/*.js --target=node16 --format=iife --outdir=dist/iife",
|
|
28
28
|
"build": "rimraf -I dist; npm run build:cjs; npm run build:esm",
|
|
29
29
|
"prepublish": "npm run build; npm run copy:package:cjs"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@domql/emotion": "^2.27.
|
|
33
|
-
"@domql/event": "^2.27.
|
|
34
|
-
"@domql/report": "^2.27.
|
|
35
|
-
"@domql/router": "^2.27.
|
|
36
|
-
"@symbo.ls/fetch": "^2.27.
|
|
37
|
-
"@symbo.ls/init": "^2.27.
|
|
38
|
-
"@symbo.ls/scratch": "^2.27.
|
|
39
|
-
"@symbo.ls/sync": "^2.27.
|
|
40
|
-
"@symbo.ls/uikit": "^2.27.
|
|
41
|
-
"@symbo.ls/utils": "^2.27.
|
|
42
|
-
"domql": "^2.27.
|
|
32
|
+
"@domql/emotion": "^2.27.10",
|
|
33
|
+
"@domql/event": "^2.27.10",
|
|
34
|
+
"@domql/report": "^2.27.10",
|
|
35
|
+
"@domql/router": "^2.27.10",
|
|
36
|
+
"@symbo.ls/fetch": "^2.27.10",
|
|
37
|
+
"@symbo.ls/init": "^2.27.10",
|
|
38
|
+
"@symbo.ls/scratch": "^2.27.10",
|
|
39
|
+
"@symbo.ls/sync": "^2.27.10",
|
|
40
|
+
"@symbo.ls/uikit": "^2.27.10",
|
|
41
|
+
"@symbo.ls/utils": "^2.27.10",
|
|
42
|
+
"domql": "^2.27.10"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"@babel/core": "^7.26.0"
|
package/src/createDomql.js
CHANGED
|
@@ -5,9 +5,14 @@ import * as uikit from '@symbo.ls/uikit'
|
|
|
5
5
|
|
|
6
6
|
import { isString, isNode, isObject } from '@domql/utils'
|
|
7
7
|
import { initAnimationFrame } from '@domql/event'
|
|
8
|
-
import { defaultDefine } from './define'
|
|
9
|
-
import { initRouter } from './router'
|
|
10
|
-
import {
|
|
8
|
+
import { defaultDefine } from './define.js'
|
|
9
|
+
import { initRouter } from './router.js'
|
|
10
|
+
import {
|
|
11
|
+
initializeExtend,
|
|
12
|
+
initializeInspect,
|
|
13
|
+
initializeNotifications,
|
|
14
|
+
initializeSync
|
|
15
|
+
} from './syncExtend.js'
|
|
11
16
|
|
|
12
17
|
import {
|
|
13
18
|
prepareComponents,
|
|
@@ -19,14 +24,17 @@ import {
|
|
|
19
24
|
prepareState,
|
|
20
25
|
prepareUtils,
|
|
21
26
|
prepareMethods
|
|
22
|
-
} from './prepare'
|
|
27
|
+
} from './prepare.js'
|
|
23
28
|
|
|
24
29
|
export const prepareContext = (app, context = {}) => {
|
|
25
30
|
// const rcFileKey = process?.env?.SYMBOLS_KEY
|
|
26
|
-
const key = context.key = context.key || (isString(app) ? app : 'smblsapp')
|
|
31
|
+
const key = (context.key = context.key || (isString(app) ? app : 'smblsapp'))
|
|
27
32
|
context.define = context.define || defaultDefine
|
|
28
33
|
context.window = prepareWindow(context)
|
|
29
|
-
const [scratcDesignSystem, emotion, registry] = prepareDesignSystem(
|
|
34
|
+
const [scratcDesignSystem, emotion, registry] = prepareDesignSystem(
|
|
35
|
+
key,
|
|
36
|
+
context
|
|
37
|
+
)
|
|
30
38
|
context.designSystem = scratcDesignSystem
|
|
31
39
|
context.registry = registry
|
|
32
40
|
context.emotion = emotion
|
|
@@ -65,12 +73,15 @@ export const createDomqlElement = async (app, ctx) => {
|
|
|
65
73
|
app.data = app.data || {}
|
|
66
74
|
app.data.frameListeners = initAnimationFrame(ctx)
|
|
67
75
|
|
|
68
|
-
prepareRequire(
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
76
|
+
prepareRequire(
|
|
77
|
+
{
|
|
78
|
+
functions: ctx.functions,
|
|
79
|
+
utils: ctx.utils,
|
|
80
|
+
snippets: ctx.snippets,
|
|
81
|
+
...ctx.files
|
|
82
|
+
},
|
|
83
|
+
ctx
|
|
84
|
+
)
|
|
74
85
|
|
|
75
86
|
initializeSync(app, ctx)
|
|
76
87
|
initializeInspect(app, ctx)
|
package/src/index.js
CHANGED
|
@@ -2,36 +2,57 @@
|
|
|
2
2
|
|
|
3
3
|
import { deepMerge, isObject, isUndefined } from '@domql/utils'
|
|
4
4
|
|
|
5
|
-
import * as utils from './utilImports'
|
|
5
|
+
import * as utils from './utilImports.js'
|
|
6
6
|
|
|
7
|
-
import { popStateRouter } from './router'
|
|
8
|
-
import { fetchAsync, fetchSync } from './ferchOnCreate'
|
|
7
|
+
import { popStateRouter } from './router.js'
|
|
8
|
+
import { fetchAsync, fetchSync } from './ferchOnCreate.js'
|
|
9
9
|
|
|
10
|
-
import DEFAULT_CREATE_OPTIONS from './options'
|
|
11
|
-
import DYNAMIC_JSON from '@symbo.ls/init/dynamic.json'
|
|
12
|
-
import { createDomqlElement } from './createDomql'
|
|
10
|
+
import DEFAULT_CREATE_OPTIONS from './options.js'
|
|
11
|
+
import DYNAMIC_JSON from '@symbo.ls/init/dynamic.json' with { type: 'json' }
|
|
12
|
+
import { createDomqlElement } from './createDomql.js'
|
|
13
13
|
|
|
14
|
-
const mergeWithLocalFile = (options, optionsExternalFile) =>
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
)
|
|
14
|
+
const mergeWithLocalFile = (options, optionsExternalFile) =>
|
|
15
|
+
deepMerge(
|
|
16
|
+
options,
|
|
17
|
+
isObject(optionsExternalFile) ? optionsExternalFile : DYNAMIC_JSON || {}
|
|
18
|
+
)
|
|
18
19
|
|
|
19
|
-
export const create = (
|
|
20
|
-
|
|
20
|
+
export const create = (
|
|
21
|
+
App,
|
|
22
|
+
options = DEFAULT_CREATE_OPTIONS,
|
|
23
|
+
optionsExternalFile
|
|
24
|
+
) => {
|
|
25
|
+
const redefinedOptions = {
|
|
26
|
+
...DEFAULT_CREATE_OPTIONS,
|
|
27
|
+
...mergeWithLocalFile(options, optionsExternalFile)
|
|
28
|
+
}
|
|
21
29
|
|
|
22
30
|
const domqlApp = createDomqlElement(App, redefinedOptions)
|
|
23
31
|
|
|
24
32
|
popStateRouter(domqlApp, redefinedOptions)
|
|
25
33
|
|
|
26
|
-
if (redefinedOptions.on && redefinedOptions.on.create)
|
|
34
|
+
if (redefinedOptions.on && redefinedOptions.on.create)
|
|
35
|
+
redefinedOptions.on.create(
|
|
36
|
+
domqlApp,
|
|
37
|
+
domqlApp.state,
|
|
38
|
+
domqlApp.context,
|
|
39
|
+
redefinedOptions
|
|
40
|
+
)
|
|
27
41
|
|
|
28
42
|
return domqlApp
|
|
29
43
|
}
|
|
30
44
|
|
|
31
|
-
export const createAsync = (
|
|
45
|
+
export const createAsync = (
|
|
46
|
+
App,
|
|
47
|
+
options = DEFAULT_CREATE_OPTIONS,
|
|
48
|
+
optionsExternalFile
|
|
49
|
+
) => {
|
|
32
50
|
const domqlApp = create(App, options, optionsExternalFile)
|
|
33
51
|
|
|
34
|
-
const redefinedOptions = {
|
|
52
|
+
const redefinedOptions = {
|
|
53
|
+
...DEFAULT_CREATE_OPTIONS,
|
|
54
|
+
...mergeWithLocalFile(options, optionsExternalFile)
|
|
55
|
+
}
|
|
35
56
|
// const SYMBOLS_KEY = process.env.SYMBOLS_KEY
|
|
36
57
|
const key = redefinedOptions.key
|
|
37
58
|
fetchAsync(domqlApp, key, { utils, ...redefinedOptions })
|
|
@@ -39,20 +60,37 @@ export const createAsync = (App, options = DEFAULT_CREATE_OPTIONS, optionsExtern
|
|
|
39
60
|
return domqlApp
|
|
40
61
|
}
|
|
41
62
|
|
|
42
|
-
export const createSync = async (
|
|
43
|
-
|
|
63
|
+
export const createSync = async (
|
|
64
|
+
App,
|
|
65
|
+
options = DEFAULT_CREATE_OPTIONS,
|
|
66
|
+
optionsExternalFile
|
|
67
|
+
) => {
|
|
68
|
+
const redefinedOptions = {
|
|
69
|
+
...DEFAULT_CREATE_OPTIONS,
|
|
70
|
+
...mergeWithLocalFile(options, optionsExternalFile)
|
|
71
|
+
}
|
|
44
72
|
|
|
45
73
|
// const SYMBOLS_KEY = process.env.SYMBOLS_KEY
|
|
46
74
|
const key = options.key
|
|
47
75
|
await fetchSync(key, redefinedOptions)
|
|
48
76
|
|
|
49
77
|
const domqlApp = await createDomqlElement(App, redefinedOptions)
|
|
50
|
-
if (redefinedOptions.on && redefinedOptions.on.create)
|
|
78
|
+
if (redefinedOptions.on && redefinedOptions.on.create)
|
|
79
|
+
await redefinedOptions.on.create(
|
|
80
|
+
domqlApp,
|
|
81
|
+
domqlApp.state,
|
|
82
|
+
domqlApp.context,
|
|
83
|
+
redefinedOptions
|
|
84
|
+
)
|
|
51
85
|
|
|
52
86
|
return domqlApp
|
|
53
87
|
}
|
|
54
88
|
|
|
55
|
-
export const createSkeleton = (
|
|
89
|
+
export const createSkeleton = (
|
|
90
|
+
App = {},
|
|
91
|
+
options = DEFAULT_CREATE_OPTIONS,
|
|
92
|
+
optionsExternalFile
|
|
93
|
+
) => {
|
|
56
94
|
return create(
|
|
57
95
|
{
|
|
58
96
|
deps: { isUndefined },
|
package/src/initEmotion.js
CHANGED
|
@@ -5,7 +5,7 @@ import { emotion as defaultEmotion } from '@symbo.ls/emotion'
|
|
|
5
5
|
import { init } from '@symbo.ls/init'
|
|
6
6
|
import { deepClone, deepMerge } from '@domql/utils'
|
|
7
7
|
|
|
8
|
-
import { DESIGN_SYSTEM_OPTIONS } from './options'
|
|
8
|
+
import { DESIGN_SYSTEM_OPTIONS } from './options.js'
|
|
9
9
|
import { DEFAULT_CONFIG } from '@symbo.ls/default-config'
|
|
10
10
|
|
|
11
11
|
export const initEmotion = (key, options = {}) => {
|
|
@@ -15,10 +15,12 @@ export const initEmotion = (key, options = {}) => {
|
|
|
15
15
|
|
|
16
16
|
if (!initOptions.emotion) initOptions.emotion = defaultEmotion
|
|
17
17
|
|
|
18
|
-
const registry =
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
18
|
+
const registry =
|
|
19
|
+
options.registry || transformDOMQLEmotion(initOptions.emotion, options)
|
|
20
|
+
const designSystem =
|
|
21
|
+
initOptions.useDefaultConfig || options.designSystem?.useDefaultConfig
|
|
22
|
+
? deepMerge(options.designSystem, deepClone(DEFAULT_CONFIG))
|
|
23
|
+
: options.designSystem || deepClone(DEFAULT_CONFIG)
|
|
22
24
|
|
|
23
25
|
const scratchSystem = init(designSystem, {
|
|
24
26
|
key,
|
package/src/options.js
CHANGED
package/src/prepare.js
CHANGED
|
@@ -5,19 +5,20 @@ import {
|
|
|
5
5
|
deepMerge,
|
|
6
6
|
deepClone,
|
|
7
7
|
merge,
|
|
8
|
-
checkIfKeyIsComponent
|
|
8
|
+
checkIfKeyIsComponent,
|
|
9
|
+
isDevelopment
|
|
9
10
|
} from '@domql/utils'
|
|
10
|
-
import { initEmotion } from './initEmotion'
|
|
11
|
+
import { initEmotion } from './initEmotion.js'
|
|
11
12
|
|
|
12
13
|
import * as uikit from '@symbo.ls/uikit'
|
|
13
|
-
import * as utils from './utilImports'
|
|
14
|
+
import * as utils from './utilImports.js'
|
|
14
15
|
import * as routerUtils from '@domql/router'
|
|
15
16
|
|
|
16
|
-
|
|
17
|
+
// @preserve-env
|
|
17
18
|
|
|
18
|
-
export const prepareWindow =
|
|
19
|
-
if (typeof
|
|
20
|
-
if (typeof
|
|
19
|
+
export const prepareWindow = context => {
|
|
20
|
+
if (typeof window === 'undefined') window = globalThis || {} // eslint-disable-line
|
|
21
|
+
if (typeof document === 'undefined') {
|
|
21
22
|
if (!window.document) window.document = globalThis.document || { body: {} }
|
|
22
23
|
document = window.document // eslint-disable-line
|
|
23
24
|
}
|
|
@@ -44,20 +45,34 @@ export const UIkitWithPrefix = () => {
|
|
|
44
45
|
}
|
|
45
46
|
|
|
46
47
|
export const prepareComponents = context => {
|
|
47
|
-
return context.components
|
|
48
|
+
return context.components
|
|
49
|
+
? { ...UIkitWithPrefix(), ...context.components }
|
|
50
|
+
: UIkitWithPrefix()
|
|
48
51
|
}
|
|
49
52
|
|
|
50
53
|
export const prepareUtils = context => {
|
|
51
|
-
return {
|
|
54
|
+
return {
|
|
55
|
+
...utils,
|
|
56
|
+
...routerUtils,
|
|
57
|
+
...utils.scratchUtils,
|
|
58
|
+
...context.utils,
|
|
59
|
+
...context.snippets,
|
|
60
|
+
...context.functions
|
|
61
|
+
}
|
|
52
62
|
}
|
|
53
63
|
|
|
54
|
-
export const prepareMethods =
|
|
64
|
+
export const prepareMethods = context => {
|
|
55
65
|
return {
|
|
56
66
|
...(context.methods || {}),
|
|
57
67
|
require: context.utils.require,
|
|
58
68
|
requireOnDemand: context.utils.requireOnDemand,
|
|
59
69
|
call: function (fnKey, ...args) {
|
|
60
|
-
return (
|
|
70
|
+
return (
|
|
71
|
+
context.utils[fnKey] ||
|
|
72
|
+
context.functions[fnKey] ||
|
|
73
|
+
context.methods[fnKey] ||
|
|
74
|
+
context.snippets[fnKey]
|
|
75
|
+
)?.call(this, ...args)
|
|
61
76
|
}
|
|
62
77
|
}
|
|
63
78
|
}
|
|
@@ -77,7 +92,7 @@ export const prepareDependencies = ({
|
|
|
77
92
|
continue
|
|
78
93
|
}
|
|
79
94
|
|
|
80
|
-
const random =
|
|
95
|
+
const random = isDevelopment() ? `?${Math.random()}` : ''
|
|
81
96
|
let url = `https://pkg.symbo.ls/${dependency}/${version}.js${random}`
|
|
82
97
|
|
|
83
98
|
if (dependency.split('/').length > 2 || !onlyDotsAndNumbers(version)) {
|
|
@@ -113,7 +128,7 @@ export const prepareRequire = (packages, ctx) => {
|
|
|
113
128
|
const documentOpts = ctx.document || document
|
|
114
129
|
const windowOpts = ctx.window || window
|
|
115
130
|
if (!windowOpts.packages[key]) {
|
|
116
|
-
const random =
|
|
131
|
+
const random = isDevelopment() ? `?${Math.random()}` : ''
|
|
117
132
|
if (dependenciesOnDemand && dependenciesOnDemand[key]) {
|
|
118
133
|
const version = dependenciesOnDemand[key]
|
|
119
134
|
const url = `https://pkg.symbo.ls/${key}/${version}.js${random}`
|