@symbo.ls/sync 2.25.3 → 2.27.8
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/Inspect.js +11 -22
- package/dist/cjs/SyncNotifications.js +1 -2
- package/dist/cjs/index.js +7 -11
- package/dist/esm/Inspect.js +11 -22
- package/dist/esm/SyncNotifications.js +1 -2
- package/dist/esm/index.js +4 -8
- package/package.json +12 -12
package/dist/cjs/Inspect.js
CHANGED
|
@@ -38,22 +38,19 @@ function returnStringExtend(extend) {
|
|
|
38
38
|
return (0, import_utils.isString)(extend) ? extend : (0, import_utils.isArray)(extend) ? extend.find((extItem) => (0, import_utils.isString)(extItem)) : "";
|
|
39
39
|
}
|
|
40
40
|
function getComponentKey(el) {
|
|
41
|
-
if (!el)
|
|
42
|
-
return;
|
|
41
|
+
if (!el) return;
|
|
43
42
|
const __componentKey = el.__ref.__componentKey;
|
|
44
43
|
const extendStr = el.extend && returnStringExtend(el.extend);
|
|
45
44
|
const parentChildExtendStr = el.parent && el.parent.childExtend && returnStringExtend(el.parent.childExtend);
|
|
46
45
|
return (__componentKey || extendStr || parentChildExtendStr || "").split("_")[0].split(".")[0].split("+")[0];
|
|
47
46
|
}
|
|
48
47
|
function findComponent(el) {
|
|
49
|
-
if (!el || !el.__ref)
|
|
50
|
-
return;
|
|
48
|
+
if (!el || !el.__ref) return;
|
|
51
49
|
const { components, pages, editor } = el.context;
|
|
52
50
|
const componentKey = getComponentKey(el);
|
|
53
51
|
if (editor && editor.onInitInspect) {
|
|
54
52
|
const initInspectReturns = editor.onInitInspect(componentKey, el, el.state);
|
|
55
|
-
if (!initInspectReturns)
|
|
56
|
-
return findComponent(el.parent);
|
|
53
|
+
if (!initInspectReturns) return findComponent(el.parent);
|
|
57
54
|
}
|
|
58
55
|
if (componentKey && (components[componentKey] || pages[componentKey])) {
|
|
59
56
|
return el;
|
|
@@ -91,8 +88,7 @@ const Inspect = {
|
|
|
91
88
|
const el = ev.target.ref;
|
|
92
89
|
const component = findComponent(el);
|
|
93
90
|
const focusState = e.Inspector.state;
|
|
94
|
-
if (!component || !state.debugging || !component.__ref)
|
|
95
|
-
return focusState.update({ area: false });
|
|
91
|
+
if (!component || !state.debugging || !component.__ref) return focusState.update({ area: false });
|
|
96
92
|
const componentKey = getComponentKey(component);
|
|
97
93
|
const updateValue = (area) => {
|
|
98
94
|
focusState.update({ area, focusKey: componentKey });
|
|
@@ -101,10 +97,8 @@ const Inspect = {
|
|
|
101
97
|
if (ev.altKey && ev.shiftKey) {
|
|
102
98
|
const { x, y, width, height } = component.node.getBoundingClientRect();
|
|
103
99
|
const area = { x, y, width, height };
|
|
104
|
-
if (!focusState.area)
|
|
105
|
-
|
|
106
|
-
if (focusState.area.x !== area.x)
|
|
107
|
-
updateValue(area);
|
|
100
|
+
if (!focusState.area) return updateValue(area);
|
|
101
|
+
if (focusState.area.x !== area.x) updateValue(area);
|
|
108
102
|
} else if (focusState.area) {
|
|
109
103
|
focusState.update({ area: false });
|
|
110
104
|
}
|
|
@@ -115,15 +109,12 @@ const Inspect = {
|
|
|
115
109
|
});
|
|
116
110
|
},
|
|
117
111
|
onMousedown: (ev, elem, state) => {
|
|
118
|
-
if (!state.debugging)
|
|
119
|
-
return;
|
|
112
|
+
if (!state.debugging) return;
|
|
120
113
|
const el = ev.target.ref;
|
|
121
114
|
const component = findComponent(el);
|
|
122
|
-
if (!component)
|
|
123
|
-
return;
|
|
115
|
+
if (!component) return;
|
|
124
116
|
const componentKey = getComponentKey(component);
|
|
125
|
-
if (!componentKey)
|
|
126
|
-
return;
|
|
117
|
+
if (!componentKey) return;
|
|
127
118
|
const editor = el.context.editor;
|
|
128
119
|
if (editor && editor.onInspect) {
|
|
129
120
|
return editor.onInspect(componentKey, el, el.state, { allowRouterWhileInspect: true });
|
|
@@ -175,10 +166,8 @@ const Inspect = {
|
|
|
175
166
|
if ((0, import_utils.isObject)(components)) {
|
|
176
167
|
const { Content, ...rest } = components;
|
|
177
168
|
for (const key in rest) {
|
|
178
|
-
if (smblsUI[key])
|
|
179
|
-
|
|
180
|
-
if (!rest[key].__ref)
|
|
181
|
-
rest[key].__ref = {};
|
|
169
|
+
if (smblsUI[key]) continue;
|
|
170
|
+
if (!rest[key].__ref) rest[key].__ref = {};
|
|
182
171
|
if (!rest[key].__ref.__componentKey) {
|
|
183
172
|
rest[key].__ref.__componentKey = key;
|
|
184
173
|
}
|
package/dist/cjs/index.js
CHANGED
|
@@ -16,15 +16,15 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
16
16
|
return to;
|
|
17
17
|
};
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var
|
|
20
|
-
__export(
|
|
19
|
+
var index_exports = {};
|
|
20
|
+
__export(index_exports, {
|
|
21
21
|
DefaultSyncApp: () => DefaultSyncApp,
|
|
22
22
|
Inspect: () => import_Inspect.Inspect,
|
|
23
23
|
Notifications: () => import_SyncNotifications.Notifications,
|
|
24
24
|
SyncComponent: () => SyncComponent,
|
|
25
25
|
connectToSocket: () => connectToSocket
|
|
26
26
|
});
|
|
27
|
-
module.exports = __toCommonJS(
|
|
27
|
+
module.exports = __toCommonJS(index_exports);
|
|
28
28
|
var import_router = require("@domql/router");
|
|
29
29
|
var import_init = require("@symbo.ls/init");
|
|
30
30
|
var import_client = require("@symbo.ls/socket/client");
|
|
@@ -44,8 +44,7 @@ const onChange = (el, s, ctx) => {
|
|
|
44
44
|
return (event, data) => {
|
|
45
45
|
if (event === "change") {
|
|
46
46
|
const obj = JSON.parse(data);
|
|
47
|
-
if (!(obj == null ? void 0 : obj.DATA))
|
|
48
|
-
return;
|
|
47
|
+
if (!(obj == null ? void 0 : obj.DATA)) return;
|
|
49
48
|
const { state, designSystem, pages, components, snippets, functions } = obj.DATA;
|
|
50
49
|
const { utils } = ctx;
|
|
51
50
|
if (pages) {
|
|
@@ -62,17 +61,14 @@ const onChange = (el, s, ctx) => {
|
|
|
62
61
|
}
|
|
63
62
|
if (state) {
|
|
64
63
|
const route = state.route;
|
|
65
|
-
if (route)
|
|
66
|
-
|
|
67
|
-
else if (!(snippets && functions && components && pages))
|
|
68
|
-
s.update(state);
|
|
64
|
+
if (route) (utils.router || import_router.router)(route.replace("/state", "") || "/", el, {});
|
|
65
|
+
else if (!(snippets && functions && components && pages)) s.update(state);
|
|
69
66
|
}
|
|
70
67
|
if (snippets || functions || components || pages) {
|
|
71
68
|
const { pathname, search, hash } = ctx.window.location;
|
|
72
69
|
(utils.router || import_router.router)(pathname + search + hash, el, {});
|
|
73
70
|
}
|
|
74
|
-
if (designSystem)
|
|
75
|
-
(0, import_init.init)(designSystem);
|
|
71
|
+
if (designSystem) (0, import_init.init)(designSystem);
|
|
76
72
|
}
|
|
77
73
|
if (ctx.editor.verbose && event === "clients") {
|
|
78
74
|
(0, import_SyncNotifications.connectedToSymbols)(data, el, s);
|
package/dist/esm/Inspect.js
CHANGED
|
@@ -20,22 +20,19 @@ function returnStringExtend(extend) {
|
|
|
20
20
|
return isString(extend) ? extend : isArray(extend) ? extend.find((extItem) => isString(extItem)) : "";
|
|
21
21
|
}
|
|
22
22
|
function getComponentKey(el) {
|
|
23
|
-
if (!el)
|
|
24
|
-
return;
|
|
23
|
+
if (!el) return;
|
|
25
24
|
const __componentKey = el.__ref.__componentKey;
|
|
26
25
|
const extendStr = el.extend && returnStringExtend(el.extend);
|
|
27
26
|
const parentChildExtendStr = el.parent && el.parent.childExtend && returnStringExtend(el.parent.childExtend);
|
|
28
27
|
return (__componentKey || extendStr || parentChildExtendStr || "").split("_")[0].split(".")[0].split("+")[0];
|
|
29
28
|
}
|
|
30
29
|
function findComponent(el) {
|
|
31
|
-
if (!el || !el.__ref)
|
|
32
|
-
return;
|
|
30
|
+
if (!el || !el.__ref) return;
|
|
33
31
|
const { components, pages, editor } = el.context;
|
|
34
32
|
const componentKey = getComponentKey(el);
|
|
35
33
|
if (editor && editor.onInitInspect) {
|
|
36
34
|
const initInspectReturns = editor.onInitInspect(componentKey, el, el.state);
|
|
37
|
-
if (!initInspectReturns)
|
|
38
|
-
return findComponent(el.parent);
|
|
35
|
+
if (!initInspectReturns) return findComponent(el.parent);
|
|
39
36
|
}
|
|
40
37
|
if (componentKey && (components[componentKey] || pages[componentKey])) {
|
|
41
38
|
return el;
|
|
@@ -73,8 +70,7 @@ const Inspect = {
|
|
|
73
70
|
const el = ev.target.ref;
|
|
74
71
|
const component = findComponent(el);
|
|
75
72
|
const focusState = e.Inspector.state;
|
|
76
|
-
if (!component || !state.debugging || !component.__ref)
|
|
77
|
-
return focusState.update({ area: false });
|
|
73
|
+
if (!component || !state.debugging || !component.__ref) return focusState.update({ area: false });
|
|
78
74
|
const componentKey = getComponentKey(component);
|
|
79
75
|
const updateValue = (area) => {
|
|
80
76
|
focusState.update({ area, focusKey: componentKey });
|
|
@@ -83,10 +79,8 @@ const Inspect = {
|
|
|
83
79
|
if (ev.altKey && ev.shiftKey) {
|
|
84
80
|
const { x, y, width, height } = component.node.getBoundingClientRect();
|
|
85
81
|
const area = { x, y, width, height };
|
|
86
|
-
if (!focusState.area)
|
|
87
|
-
|
|
88
|
-
if (focusState.area.x !== area.x)
|
|
89
|
-
updateValue(area);
|
|
82
|
+
if (!focusState.area) return updateValue(area);
|
|
83
|
+
if (focusState.area.x !== area.x) updateValue(area);
|
|
90
84
|
} else if (focusState.area) {
|
|
91
85
|
focusState.update({ area: false });
|
|
92
86
|
}
|
|
@@ -97,15 +91,12 @@ const Inspect = {
|
|
|
97
91
|
});
|
|
98
92
|
},
|
|
99
93
|
onMousedown: (ev, elem, state) => {
|
|
100
|
-
if (!state.debugging)
|
|
101
|
-
return;
|
|
94
|
+
if (!state.debugging) return;
|
|
102
95
|
const el = ev.target.ref;
|
|
103
96
|
const component = findComponent(el);
|
|
104
|
-
if (!component)
|
|
105
|
-
return;
|
|
97
|
+
if (!component) return;
|
|
106
98
|
const componentKey = getComponentKey(component);
|
|
107
|
-
if (!componentKey)
|
|
108
|
-
return;
|
|
99
|
+
if (!componentKey) return;
|
|
109
100
|
const editor = el.context.editor;
|
|
110
101
|
if (editor && editor.onInspect) {
|
|
111
102
|
return editor.onInspect(componentKey, el, el.state, { allowRouterWhileInspect: true });
|
|
@@ -157,10 +148,8 @@ const Inspect = {
|
|
|
157
148
|
if (isObject(components)) {
|
|
158
149
|
const _a = components, { Content } = _a, rest = __objRest(_a, ["Content"]);
|
|
159
150
|
for (const key in rest) {
|
|
160
|
-
if (smblsUI[key])
|
|
161
|
-
|
|
162
|
-
if (!rest[key].__ref)
|
|
163
|
-
rest[key].__ref = {};
|
|
151
|
+
if (smblsUI[key]) continue;
|
|
152
|
+
if (!rest[key].__ref) rest[key].__ref = {};
|
|
164
153
|
if (!rest[key].__ref.__componentKey) {
|
|
165
154
|
rest[key].__ref.__componentKey = key;
|
|
166
155
|
}
|
package/dist/esm/index.js
CHANGED
|
@@ -17,8 +17,7 @@ const onChange = (el, s, ctx) => {
|
|
|
17
17
|
return (event, data) => {
|
|
18
18
|
if (event === "change") {
|
|
19
19
|
const obj = JSON.parse(data);
|
|
20
|
-
if (!(obj == null ? void 0 : obj.DATA))
|
|
21
|
-
return;
|
|
20
|
+
if (!(obj == null ? void 0 : obj.DATA)) return;
|
|
22
21
|
const { state, designSystem, pages, components, snippets, functions } = obj.DATA;
|
|
23
22
|
const { utils } = ctx;
|
|
24
23
|
if (pages) {
|
|
@@ -35,17 +34,14 @@ const onChange = (el, s, ctx) => {
|
|
|
35
34
|
}
|
|
36
35
|
if (state) {
|
|
37
36
|
const route = state.route;
|
|
38
|
-
if (route)
|
|
39
|
-
|
|
40
|
-
else if (!(snippets && functions && components && pages))
|
|
41
|
-
s.update(state);
|
|
37
|
+
if (route) (utils.router || router)(route.replace("/state", "") || "/", el, {});
|
|
38
|
+
else if (!(snippets && functions && components && pages)) s.update(state);
|
|
42
39
|
}
|
|
43
40
|
if (snippets || functions || components || pages) {
|
|
44
41
|
const { pathname, search, hash } = ctx.window.location;
|
|
45
42
|
(utils.router || router)(pathname + search + hash, el, {});
|
|
46
43
|
}
|
|
47
|
-
if (designSystem)
|
|
48
|
-
init(designSystem);
|
|
44
|
+
if (designSystem) init(designSystem);
|
|
49
45
|
}
|
|
50
46
|
if (ctx.editor.verbose && event === "clients") {
|
|
51
47
|
connectedToSymbols(data, el, s);
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@symbo.ls/sync",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.27.8",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"module": "index.js",
|
|
6
|
-
"gitHead": "
|
|
6
|
+
"gitHead": "e783fd54228d5c7aaab9d4b5624199a17a6c4713",
|
|
7
7
|
"files": [
|
|
8
8
|
"*.js",
|
|
9
9
|
"dist"
|
|
@@ -22,21 +22,21 @@
|
|
|
22
22
|
"publishConfig": {},
|
|
23
23
|
"scripts": {
|
|
24
24
|
"copy:package:cjs": "cp ../../build/package-cjs.json dist/cjs/package.json",
|
|
25
|
-
"build:esm": "npx esbuild *.js --target=es2017 --format=esm --outdir=dist/esm --loader:.svg=text",
|
|
26
|
-
"build:cjs": "npx esbuild *.js --target=node16 --format=cjs --outdir=dist/cjs --loader:.svg=text",
|
|
27
|
-
"build:iife": "npx esbuild ./index.js --target=es2017 --format=iife --outdir=dist/iife --loader:.svg=text --bundle --minify",
|
|
25
|
+
"build:esm": "cross-env NODE_ENV=$NODE_ENV npx esbuild *.js --target=es2017 --format=esm --outdir=dist/esm --loader:.svg=text",
|
|
26
|
+
"build:cjs": "cross-env NODE_ENV=$NODE_ENV npx esbuild *.js --target=node16 --format=cjs --outdir=dist/cjs --loader:.svg=text",
|
|
27
|
+
"build:iife": "cross-env NODE_ENV=$NODE_ENV npx esbuild ./index.js --target=es2017 --format=iife --outdir=dist/iife --loader:.svg=text --bundle --minify",
|
|
28
28
|
"build": "npm run build:esm; npm run build:cjs",
|
|
29
29
|
"prepublish": "rimraf -I dist && npm run build && npm run copy:package:cjs"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@domql/router": "^2.
|
|
33
|
-
"@domql/utils": "^2.
|
|
34
|
-
"@symbo.ls/init": "^2.
|
|
35
|
-
"@symbo.ls/scratch": "^2.
|
|
36
|
-
"@symbo.ls/socket": "^2.
|
|
37
|
-
"@symbo.ls/uikit": "^2.
|
|
32
|
+
"@domql/router": "^2.27.8",
|
|
33
|
+
"@domql/utils": "^2.27.8",
|
|
34
|
+
"@symbo.ls/init": "^2.27.8",
|
|
35
|
+
"@symbo.ls/scratch": "^2.27.8",
|
|
36
|
+
"@symbo.ls/socket": "^2.27.8",
|
|
37
|
+
"@symbo.ls/uikit": "^2.27.8"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
|
-
"@babel/core": "^7.
|
|
40
|
+
"@babel/core": "^7.26.0"
|
|
41
41
|
}
|
|
42
42
|
}
|