@symbo.ls/sync 2.29.62 → 2.29.64

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 CHANGED
@@ -109,7 +109,6 @@ const fetchServiceToken = async () => {
109
109
  }
110
110
  };
111
111
  const onSnapshot = (el, s, ctx) => (payload = {}) => {
112
- var _a;
113
112
  let { data } = payload;
114
113
  const { schema } = payload;
115
114
  if (!data) {
@@ -118,7 +117,11 @@ const onSnapshot = (el, s, ctx) => (payload = {}) => {
118
117
  data = el.call("deepDestringify", data, Array.isArray(data) ? [] : {});
119
118
  Object.entries(data).forEach(([key, val]) => {
120
119
  if (ctx[key] && typeof ctx[key] === "object") {
121
- (0, import_utils.overwriteShallow)(ctx[key], val);
120
+ if (key === "designSystem") {
121
+ (0, import_init.init)(val);
122
+ } else {
123
+ (0, import_utils.overwriteShallow)(ctx[key], val);
124
+ }
122
125
  } else {
123
126
  ctx[key] = val;
124
127
  }
@@ -127,7 +130,13 @@ const onSnapshot = (el, s, ctx) => (payload = {}) => {
127
130
  ctx.schema = schema;
128
131
  }
129
132
  const { pathname, search, hash } = ctx.window.location;
130
- (((_a = ctx.utils) == null ? void 0 : _a.router) || import_router.router)(pathname + search + hash, el, {});
133
+ el.call(
134
+ "router",
135
+ pathname + search + hash,
136
+ el.__ref.root,
137
+ {},
138
+ { scrollToTop: false }
139
+ );
131
140
  };
132
141
  const onOps = (el, s, ctx) => (payload = {}) => {
133
142
  var _a;
@@ -144,7 +153,13 @@ const onOps = (el, s, ctx) => (payload = {}) => {
144
153
  if (changed.has("state")) {
145
154
  const route = (_a = ctx.state) == null ? void 0 : _a.route;
146
155
  if (route) {
147
- el.call("router", route.replace("/state", "") || "/");
156
+ el.call(
157
+ "router",
158
+ route.replace("/state", "") || "/",
159
+ el.__ref.root,
160
+ {},
161
+ { scrollToTop: false }
162
+ );
148
163
  } else {
149
164
  s.update(ctx.state);
150
165
  }
@@ -153,7 +168,13 @@ const onOps = (el, s, ctx) => (payload = {}) => {
153
168
  (k) => changed.has(k)
154
169
  )) {
155
170
  const { pathname, search, hash } = ctx.window.location;
156
- el.call("router", pathname + search + hash);
171
+ el.call(
172
+ "router",
173
+ pathname + search + hash,
174
+ el.__ref.root,
175
+ {},
176
+ { scrollToTop: false }
177
+ );
157
178
  }
158
179
  if (changed.has("designSystem")) {
159
180
  (0, import_init.init)(ctx.designSystem);
package/dist/esm/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { router } from "@domql/router";
2
2
  import { init } from "@symbo.ls/init";
3
3
  import { io } from "socket.io-client";
4
- import { window, overwriteShallow } from "@domql/utils";
4
+ import { window, overwriteShallow, overwriteDeep } from "@domql/utils";
5
5
  import { connectedToSymbols, Notifications } from "./SyncNotifications";
6
6
  import { Inspect } from "./Inspect";
7
7
  const isLocal = false;
@@ -83,7 +83,6 @@ const fetchServiceToken = async () => {
83
83
  }
84
84
  };
85
85
  const onSnapshot = (el, s, ctx) => (payload = {}) => {
86
- var _a;
87
86
  let { data } = payload;
88
87
  const { schema } = payload;
89
88
  if (!data) {
@@ -92,7 +91,11 @@ const onSnapshot = (el, s, ctx) => (payload = {}) => {
92
91
  data = el.call("deepDestringify", data, Array.isArray(data) ? [] : {});
93
92
  Object.entries(data).forEach(([key, val]) => {
94
93
  if (ctx[key] && typeof ctx[key] === "object") {
95
- overwriteShallow(ctx[key], val);
94
+ if (key === "designSystem") {
95
+ init(val);
96
+ } else {
97
+ overwriteShallow(ctx[key], val);
98
+ }
96
99
  } else {
97
100
  ctx[key] = val;
98
101
  }
@@ -101,7 +104,13 @@ const onSnapshot = (el, s, ctx) => (payload = {}) => {
101
104
  ctx.schema = schema;
102
105
  }
103
106
  const { pathname, search, hash } = ctx.window.location;
104
- (((_a = ctx.utils) == null ? void 0 : _a.router) || router)(pathname + search + hash, el, {});
107
+ el.call(
108
+ "router",
109
+ pathname + search + hash,
110
+ el.__ref.root,
111
+ {},
112
+ { scrollToTop: false }
113
+ );
105
114
  };
106
115
  const onOps = (el, s, ctx) => (payload = {}) => {
107
116
  var _a;
@@ -118,7 +127,13 @@ const onOps = (el, s, ctx) => (payload = {}) => {
118
127
  if (changed.has("state")) {
119
128
  const route = (_a = ctx.state) == null ? void 0 : _a.route;
120
129
  if (route) {
121
- el.call("router", route.replace("/state", "") || "/");
130
+ el.call(
131
+ "router",
132
+ route.replace("/state", "") || "/",
133
+ el.__ref.root,
134
+ {},
135
+ { scrollToTop: false }
136
+ );
122
137
  } else {
123
138
  s.update(ctx.state);
124
139
  }
@@ -127,7 +142,13 @@ const onOps = (el, s, ctx) => (payload = {}) => {
127
142
  (k) => changed.has(k)
128
143
  )) {
129
144
  const { pathname, search, hash } = ctx.window.location;
130
- el.call("router", pathname + search + hash);
145
+ el.call(
146
+ "router",
147
+ pathname + search + hash,
148
+ el.__ref.root,
149
+ {},
150
+ { scrollToTop: false }
151
+ );
131
152
  }
132
153
  if (changed.has("designSystem")) {
133
154
  init(ctx.designSystem);
package/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { router } from '@domql/router'
2
2
  import { init } from '@symbo.ls/init'
3
3
  import { io } from 'socket.io-client'
4
- import { window, overwriteShallow } from '@domql/utils'
4
+ import { window, overwriteShallow, overwriteDeep } from '@domql/utils'
5
5
  import { connectedToSymbols, Notifications } from './SyncNotifications'
6
6
  import { Inspect } from './Inspect'
7
7
  export { Inspect, Notifications }
@@ -111,12 +111,17 @@ const onSnapshot =
111
111
  if (!data) {
112
112
  return
113
113
  }
114
+
114
115
  data = el.call('deepDestringify', data, Array.isArray(data) ? [] : {})
115
116
 
116
117
  // Overwrite high-level objects shallowly so references are preserved
117
118
  Object.entries(data).forEach(([key, val]) => {
118
119
  if (ctx[key] && typeof ctx[key] === 'object') {
119
- overwriteShallow(ctx[key], val)
120
+ if (key === 'designSystem') {
121
+ init(val)
122
+ } else {
123
+ overwriteShallow(ctx[key], val)
124
+ }
120
125
  } else {
121
126
  ctx[key] = val
122
127
  }
@@ -129,7 +134,13 @@ const onSnapshot =
129
134
 
130
135
  // Trigger routing so UI reflects latest data
131
136
  const { pathname, search, hash } = ctx.window.location
132
- ;(ctx.utils?.router || router)(pathname + search + hash, el, {})
137
+ el.call(
138
+ 'router',
139
+ pathname + search + hash,
140
+ el.__ref.root,
141
+ {},
142
+ { scrollToTop: false }
143
+ )
133
144
  }
134
145
 
135
146
  const onOps =
@@ -152,7 +163,13 @@ const onOps =
152
163
  if (changed.has('state')) {
153
164
  const route = ctx.state?.route
154
165
  if (route) {
155
- el.call('router', route.replace('/state', '') || '/')
166
+ el.call(
167
+ 'router',
168
+ route.replace('/state', '') || '/',
169
+ el.__ref.root,
170
+ {},
171
+ { scrollToTop: false }
172
+ )
156
173
  } else {
157
174
  s.update(ctx.state)
158
175
  }
@@ -164,7 +181,13 @@ const onOps =
164
181
  )
165
182
  ) {
166
183
  const { pathname, search, hash } = ctx.window.location
167
- el.call('router', pathname + search + hash)
184
+ el.call(
185
+ 'router',
186
+ pathname + search + hash,
187
+ el.__ref.root,
188
+ {},
189
+ { scrollToTop: false }
190
+ )
168
191
  }
169
192
 
170
193
  if (changed.has('designSystem')) {
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "@symbo.ls/sync",
3
- "version": "2.29.62",
3
+ "version": "2.29.64",
4
4
  "main": "index.js",
5
5
  "module": "index.js",
6
- "gitHead": "ef55f04122303f2f7386ab9076cafe54b883dcce",
6
+ "gitHead": "9ca1d85168f72178a86206c16cf02d0d762386f0",
7
7
  "files": [
8
8
  "*.js",
9
9
  "dist"
@@ -29,12 +29,12 @@
29
29
  "prepublish": "rimraf -I dist && npm run build && npm run copy:package:cjs"
30
30
  },
31
31
  "dependencies": {
32
- "@domql/router": "^2.29.62",
33
- "@domql/utils": "^2.29.62",
34
- "@symbo.ls/init": "^2.29.62",
35
- "@symbo.ls/scratch": "^2.29.62",
36
- "@symbo.ls/socket": "^2.29.62",
37
- "@symbo.ls/uikit": "^2.29.62",
32
+ "@domql/router": "^2.29.64",
33
+ "@domql/utils": "^2.29.64",
34
+ "@symbo.ls/init": "^2.29.64",
35
+ "@symbo.ls/scratch": "^2.29.64",
36
+ "@symbo.ls/socket": "^2.29.64",
37
+ "@symbo.ls/uikit": "^2.29.64",
38
38
  "socket.io-client": "^4.8.1"
39
39
  },
40
40
  "devDependencies": {