@symbo.ls/sync 3.1.2 → 3.2.3
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/index.js +6 -6
- package/dist/esm/index.js +6 -6
- package/index.js +10 -8
- package/package.json +11 -11
package/dist/cjs/index.js
CHANGED
|
@@ -61,8 +61,10 @@ const onChange = (el, s, ctx) => {
|
|
|
61
61
|
}
|
|
62
62
|
if (state) {
|
|
63
63
|
const route = state.route;
|
|
64
|
-
if (route)
|
|
65
|
-
|
|
64
|
+
if (route)
|
|
65
|
+
(utils.router || import_router.router)(route.replace("/state", "") || "/", el, {});
|
|
66
|
+
else if (!(snippets && functions && components && pages))
|
|
67
|
+
s.update(state);
|
|
66
68
|
}
|
|
67
69
|
if (snippets || functions || components || pages) {
|
|
68
70
|
const { pathname, search, hash } = ctx.window.location;
|
|
@@ -78,7 +80,7 @@ const onChange = (el, s, ctx) => {
|
|
|
78
80
|
const connectToSocket = (el, s, ctx) => {
|
|
79
81
|
return (0, import_client.connect)(ctx.key, {
|
|
80
82
|
source: isLocalhost ? "localhost" : "client",
|
|
81
|
-
socketUrl: isLocalhost ? "localhost:
|
|
83
|
+
socketUrl: isLocalhost ? "localhost:8080" : "api.symbols.app",
|
|
82
84
|
location: import_utils.window.location.host,
|
|
83
85
|
onConnect: onConnect(el, s, ctx),
|
|
84
86
|
onDisconnect: onDisconnect(el, s, ctx),
|
|
@@ -86,9 +88,7 @@ const connectToSocket = (el, s, ctx) => {
|
|
|
86
88
|
});
|
|
87
89
|
};
|
|
88
90
|
const SyncComponent = {
|
|
89
|
-
|
|
90
|
-
initSync: connectToSocket
|
|
91
|
-
}
|
|
91
|
+
onInitSync: connectToSocket
|
|
92
92
|
};
|
|
93
93
|
const DefaultSyncApp = {
|
|
94
94
|
extends: [SyncComponent, import_Inspect.Inspect, import_SyncNotifications.Notifications]
|
package/dist/esm/index.js
CHANGED
|
@@ -34,8 +34,10 @@ const onChange = (el, s, ctx) => {
|
|
|
34
34
|
}
|
|
35
35
|
if (state) {
|
|
36
36
|
const route = state.route;
|
|
37
|
-
if (route)
|
|
38
|
-
|
|
37
|
+
if (route)
|
|
38
|
+
(utils.router || router)(route.replace("/state", "") || "/", el, {});
|
|
39
|
+
else if (!(snippets && functions && components && pages))
|
|
40
|
+
s.update(state);
|
|
39
41
|
}
|
|
40
42
|
if (snippets || functions || components || pages) {
|
|
41
43
|
const { pathname, search, hash } = ctx.window.location;
|
|
@@ -51,7 +53,7 @@ const onChange = (el, s, ctx) => {
|
|
|
51
53
|
const connectToSocket = (el, s, ctx) => {
|
|
52
54
|
return connect(ctx.key, {
|
|
53
55
|
source: isLocalhost ? "localhost" : "client",
|
|
54
|
-
socketUrl: isLocalhost ? "localhost:
|
|
56
|
+
socketUrl: isLocalhost ? "localhost:8080" : "api.symbols.app",
|
|
55
57
|
location: window.location.host,
|
|
56
58
|
onConnect: onConnect(el, s, ctx),
|
|
57
59
|
onDisconnect: onDisconnect(el, s, ctx),
|
|
@@ -59,9 +61,7 @@ const connectToSocket = (el, s, ctx) => {
|
|
|
59
61
|
});
|
|
60
62
|
};
|
|
61
63
|
const SyncComponent = {
|
|
62
|
-
|
|
63
|
-
initSync: connectToSocket
|
|
64
|
-
}
|
|
64
|
+
onInitSync: connectToSocket
|
|
65
65
|
};
|
|
66
66
|
const DefaultSyncApp = {
|
|
67
67
|
extends: [SyncComponent, Inspect, Notifications]
|
package/index.js
CHANGED
|
@@ -8,7 +8,8 @@ import { connectedToSymbols, Notifications } from './SyncNotifications'
|
|
|
8
8
|
import { Inspect } from './Inspect'
|
|
9
9
|
export { Inspect, Notifications }
|
|
10
10
|
|
|
11
|
-
const isLocalhost =
|
|
11
|
+
const isLocalhost =
|
|
12
|
+
window && window.location && window.location.host.includes('local')
|
|
12
13
|
|
|
13
14
|
const onConnect = (element, state) => {
|
|
14
15
|
return (socketId, socket) => {
|
|
@@ -25,7 +26,8 @@ const onChange = (el, s, ctx) => {
|
|
|
25
26
|
if (event === 'change') {
|
|
26
27
|
const obj = JSON.parse(data)
|
|
27
28
|
if (!obj?.DATA) return
|
|
28
|
-
const { state, designSystem, pages, components, snippets, functions } =
|
|
29
|
+
const { state, designSystem, pages, components, snippets, functions } =
|
|
30
|
+
obj.DATA
|
|
29
31
|
const { utils } = ctx
|
|
30
32
|
|
|
31
33
|
if (pages) {
|
|
@@ -47,8 +49,10 @@ const onChange = (el, s, ctx) => {
|
|
|
47
49
|
|
|
48
50
|
if (state) {
|
|
49
51
|
const route = state.route
|
|
50
|
-
if (route)
|
|
51
|
-
|
|
52
|
+
if (route)
|
|
53
|
+
(utils.router || router)(route.replace('/state', '') || '/', el, {})
|
|
54
|
+
else if (!(snippets && functions && components && pages))
|
|
55
|
+
s.update(state)
|
|
52
56
|
}
|
|
53
57
|
|
|
54
58
|
if (snippets || functions || components || pages) {
|
|
@@ -68,7 +72,7 @@ const onChange = (el, s, ctx) => {
|
|
|
68
72
|
export const connectToSocket = (el, s, ctx) => {
|
|
69
73
|
return connect(ctx.key, {
|
|
70
74
|
source: isLocalhost ? 'localhost' : 'client',
|
|
71
|
-
socketUrl: isLocalhost ? 'localhost:
|
|
75
|
+
socketUrl: isLocalhost ? 'localhost:8080' : 'api.symbols.app',
|
|
72
76
|
location: window.location.host,
|
|
73
77
|
onConnect: onConnect(el, s, ctx),
|
|
74
78
|
onDisconnect: onDisconnect(el, s, ctx),
|
|
@@ -77,9 +81,7 @@ export const connectToSocket = (el, s, ctx) => {
|
|
|
77
81
|
}
|
|
78
82
|
|
|
79
83
|
export const SyncComponent = {
|
|
80
|
-
|
|
81
|
-
initSync: connectToSocket
|
|
82
|
-
}
|
|
84
|
+
onInitSync: connectToSocket
|
|
83
85
|
}
|
|
84
86
|
|
|
85
87
|
export const DefaultSyncApp = {
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@symbo.ls/sync",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.2.3",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"module": "index.js",
|
|
6
|
-
"gitHead": "
|
|
6
|
+
"gitHead": "9fc1b79b41cdc725ca6b24aec64920a599634681",
|
|
7
7
|
"files": [
|
|
8
8
|
"*.js",
|
|
9
9
|
"dist"
|
|
@@ -22,19 +22,19 @@
|
|
|
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": "npx cross-env NODE_ENV=$NODE_ENV npx esbuild *.js --target=es2017 --format=esm --outdir=dist/esm --loader:.svg=text",
|
|
26
|
+
"build:cjs": "npx cross-env NODE_ENV=$NODE_ENV npx esbuild *.js --target=node16 --format=cjs --outdir=dist/cjs --loader:.svg=text",
|
|
27
|
+
"build:iife": "npx 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": "^3.
|
|
33
|
-
"@domql/utils": "^3.
|
|
34
|
-
"@symbo.ls/init": "^3.
|
|
35
|
-
"@symbo.ls/scratch": "^3.
|
|
36
|
-
"@symbo.ls/socket": "^3.
|
|
37
|
-
"@symbo.ls/uikit": "^3.
|
|
32
|
+
"@domql/router": "^3.2.3",
|
|
33
|
+
"@domql/utils": "^3.2.3",
|
|
34
|
+
"@symbo.ls/init": "^3.2.3",
|
|
35
|
+
"@symbo.ls/scratch": "^3.2.3",
|
|
36
|
+
"@symbo.ls/socket": "^3.2.3",
|
|
37
|
+
"@symbo.ls/uikit": "^3.2.3"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"@babel/core": "^7.26.0"
|