@symbiotejs/symbiote 3.3.4 → 3.3.6

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/CHANGELOG.md CHANGED
@@ -1,5 +1,22 @@
1
1
  # Changelog
2
2
 
3
+ ## 3.3.6
4
+
5
+ ### Improved
6
+
7
+ - **SSR hydration: generic property preservation.**
8
+ During SSR/ISO hydration, all primitive-valued bindings (`textContent`, `innerHTML`, `style.*`, `value`, etc.) now skip the initial write, preserving server-rendered DOM. Function bindings (event handlers) and non-null object bindings (component state) still fire immediately. Previously only `textContent` and attribute bindings were preserved.
9
+
10
+ - **SSR hydration: Itemize API support.**
11
+ Auto-generated itemize item components now inherit `ssrMode`/`isoMode` from the parent. Server-rendered list items are preserved during hydration instead of being cleared and re-created.
12
+
13
+ ## 3.3.5
14
+
15
+ ### Fixed
16
+
17
+ - **AppRouter: SSR context populated with default route.**
18
+ `initRoutingCtx()` in SSR now populates the PubSub context with the default route's `route`, `title`, and `options` instead of leaving them as `null`. Components can access `this.$['R/route']` during server rendering.
19
+
3
20
  ## 3.3.4
4
21
 
5
22
  ### Fixed
package/core/AppRouter.js CHANGED
@@ -360,6 +360,13 @@ export class AppRouter {
360
360
  });
361
361
  AppRouter.notify();
362
362
  this.#initPopstateListener();
363
+ } else if (this.defaultRoute) {
364
+ let defaultDesc = this.appMap[this.defaultRoute];
365
+ routingCtx.multiPub({
366
+ route: this.defaultRoute,
367
+ options: {},
368
+ title: defaultDesc?.title || this.defaultTitle || '',
369
+ });
363
370
  }
364
371
  return routingCtx;
365
372
  }
@@ -21,6 +21,8 @@ export function itemizeProcessor(fr, fnCtx) {
21
21
  itemClass = class extends fnCtx.Symbiote {
22
22
  constructor() {
23
23
  super();
24
+ this.ssrMode = fnCtx.ssrMode;
25
+ this.isoMode = fnCtx.isoMode;
24
26
  if (!itemTag) {
25
27
  this.style.display = 'contents';
26
28
  }
@@ -29,8 +31,10 @@ export function itemizeProcessor(fr, fnCtx) {
29
31
  itemClass.template = el.querySelector('template')?.innerHTML || el.innerHTML;
30
32
  itemClass.reg(itemTag);
31
33
  }
32
- while (el.firstChild) {
33
- el.firstChild.remove();
34
+ if (!(fnCtx.ssrMode && !globalThis.__SYMBIOTE_SSR)) {
35
+ while (el.firstChild) {
36
+ el.firstChild.remove();
37
+ }
34
38
  }
35
39
  let repeatDataKey = el.getAttribute(DICT.LIST_ATTR);
36
40
  if (!fnCtx.has(repeatDataKey) && fnCtx.allowTemplateInits) {
@@ -70,6 +70,9 @@ function domBindProcessor(fr, fnCtx) {
70
70
  );
71
71
  }
72
72
  }
73
+ let initVal = fnCtx.$[valKey];
74
+ let skipInit = fnCtx.ssrMode && !globalThis.__SYMBIOTE_SSR
75
+ && (isAttr || (typeof initVal !== 'function' && (initVal === null || typeof initVal !== 'object')));
73
76
  fnCtx.sub(valKey, (val) => {
74
77
  if (castType === 'double') {
75
78
  val = !!val;
@@ -91,7 +94,7 @@ function domBindProcessor(fr, fnCtx) {
91
94
  el[DICT.SET_LATER_KEY][prop] = val;
92
95
  }
93
96
  }
94
- }, !(fnCtx.ssrMode && !globalThis.__SYMBIOTE_SSR && (prop === 'textContent' || isAttr)));
97
+ }, !skipInit);
95
98
  }
96
99
  });
97
100
  if (!globalThis.__SYMBIOTE_SSR) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "type": "module",
3
3
  "name": "@symbiotejs/symbiote",
4
- "version": "3.3.4",
4
+ "version": "3.3.6",
5
5
  "description": "Symbiote.js - zero-dependency close-to-platform frontend library to build super-powered web components",
6
6
  "author": "team@rnd-pro.com",
7
7
  "license": "MIT",
@@ -1 +1 @@
1
- {"version":3,"file":"AppRouter.d.ts","sourceRoot":"","sources":["../../core/AppRouter.js"],"names":[],"mappings":"AAEA;IA4BE,iCADW,MAAM,IAAI,CACF;IAEnB,uCAAkB;IAElB,8CAAyB;IAEzB;;;;;;mBA1BY,MAAM,OAAO,CAAC,GAAC,CAAC;;;M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IAEpB,mCADW;;;;;QAAa,IAAI,CACA;IAE5B,kCADW,OAAO,CACU;IAE5B,uCADW,KAAK,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,EAAE,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAC,CAAC,CAClC;IAE9B,8CAEC;IAED,2CAEC;IAGD,4CAEC;IAGD;;aAgBC;IAMD,6CAuBC;IAGD,0CAGC;IAGD,sCAEC;IAED;;;MAKC;IAED;;;MAiBC;IAED;;;MAwBC;IAMD;;;;;QAFa,OAAO,CAAC,MAAM,GAAG,OAAO,GAAG,IAAI,CAAC,CAS5C;IAED,+BAsEC;IAMD;;aAwCC;IAMD;;aAGC;IAQD;;;;;aAnSW;;;;;QAAa,IAAI,KACf,MAAM,GAAG,OAAO,GAAG,IAAI,GAAG,OAAO,CAAC,MAAM,GAAG,OAAO,GAAG,IAAI,CAAC,GAgS1D,MAAM,IAAI,CAUtB;IAGD,wCAGC;IAGD,+BAEC;IAOD;;;;;;mBA5UY,MAAM,OAAO,CAAC,GAAC,CAAC;;;oBAyW3B;IAED,kDAQC;IAED,sCAIC;CACF;;mBApYkB,aAAa"}
@@ -1 +1 @@
1
- {"version":3,"file":"itemizeProcessor.d.ts","sourceRoot":"","sources":["../../core/itemizeProcessor.js"],"names":[],"mappings":"AAUA,iCAJgD,CAAC,SAApC,qCAAkC,MACpC,gBAAgB,SAChB,CAAC,QAuFX"}
1
+ {"version":3,"file":"itemizeProcessor.d.ts","sourceRoot":"","sources":["../../core/itemizeProcessor.js"],"names":[],"mappings":"AAUA,iCAJgD,CAAC,SAApC,qCAAkC,MACpC,gBAAgB,SAChB,CAAC,QA2FX"}
@@ -1 +1 @@
1
- {"version":3,"file":"tpl-processors.d.ts","sourceRoot":"","sources":["../../core/tpl-processors.js"],"names":[],"mappings":";0BA0HgD,CAAC,SAApC,qCAAkC,MACpC,gBAAgB,SAChB,CAAC;;iCAzHqB,uBAAuB"}
1
+ {"version":3,"file":"tpl-processors.d.ts","sourceRoot":"","sources":["../../core/tpl-processors.js"],"names":[],"mappings":";0BA6HgD,CAAC,SAApC,qCAAkC,MACpC,gBAAgB,SAChB,CAAC;;iCA5HqB,uBAAuB"}