@symbiotejs/symbiote 3.5.2 → 3.5.4

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,13 @@
1
1
  # Changelog
2
2
 
3
+ ## 3.5.4
4
+
5
+ ### Fixed
6
+
7
+ - **SSR: `bindAttributes()` crash in linkedom.** `observedAttributes` is a getter-only property in linkedom — direct assignment threw. Now uses `Object.defineProperty` with a configurable getter.
8
+
9
+ - **SSR: `renderCallback()` crash from browser-only APIs.** Components using `IntersectionObserver`, `window.location`, etc. in `renderCallback` crashed the entire SSR process. Now wrapped in try-catch during SSR (`__SYMBIOTE_SSR`); browser-side errors still re-throw normally.
10
+
3
11
  ## 3.5.2
4
12
 
5
13
  ### Fixed
package/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  [![Tests](https://github.com/symbiotejs/symbiote.js/actions/workflows/tests.yml/badge.svg)](https://github.com/symbiotejs/symbiote.js/actions/workflows/tests.yml)
2
2
  [![npm version](https://img.shields.io/npm/v/@symbiotejs/symbiote)](https://www.npmjs.com/package/@symbiotejs/symbiote)
3
3
  [![npm downloads](https://img.shields.io/npm/dm/@symbiotejs/symbiote)](https://www.npmjs.com/package/@symbiotejs/symbiote)
4
- ![bundle size](https://img.shields.io/badge/brotli-6.4_kb-blue)
4
+ ![bundle size](https://img.shields.io/badge/brotli-5.9_kb-blue)
5
5
  ![types](https://img.shields.io/badge/types-JSDoc+d.ts-blue)
6
6
  ![license](https://img.shields.io/badge/license-MIT-green)
7
7
 
@@ -13,7 +13,7 @@ A lightweight, standards-first UI library built on Web Components. No virtual DO
13
13
 
14
14
  Symbiote.js gives you the convenience of a modern framework while staying close to the native platform — HTML, CSS, and DOM APIs. Components are real custom elements that work everywhere: in any framework, in plain HTML, or in a micro-frontend architecture. And with **isomorphic mode**, the same component code works on the server and the client — server-rendered pages hydrate automatically, no diffing, no mismatch errors.
15
15
 
16
- ## What's new in 3.x
16
+ ## What's new in v3
17
17
 
18
18
  - **Server-Side Rendering** — render components to HTML with `SSR.processHtml()` or stream chunks with `SSR.renderToStream()`. Client-side hydration via `ssrMode` attaches bindings to existing DOM without re-rendering.
19
19
  - **Isomorphic components** — `isoMode` flag makes components work in both SSR and client-only scenarios automatically. If server-rendered content exists, it hydrates; otherwise it renders the template from scratch. One component, zero conditional logic.
@@ -336,12 +336,12 @@ CSS values are parsed automatically — quoted strings become strings, numbers b
336
336
 
337
337
  | Library | Minified | Gzip | Brotli |
338
338
  |---------|----------|------|--------|
339
- | **Symbiote.js** (core) | 20.2 kb | 7.1 kb | **6.4 kb** |
340
- | **Symbiote.js** (full, with AppRouter) | 24.4 kb | 8.5 kb | **7.6 kb** |
339
+ | **Symbiote.js** (core) | 18.9 kb | 6.6 kb | **5.9 kb** |
340
+ | **Symbiote.js** (full, with AppRouter) | 23.2 kb | 7.9 kb | **7.2 kb** |
341
341
  | **Lit** 3.3 | 15.5 kb | 6.0 kb | **~5.1 kb** |
342
342
  | **React 19 + ReactDOM** | ~186 kb | ~59 kb | **~50 kb** |
343
343
 
344
- Symbiote and Lit have similar base sizes, but Symbiote's **6.4 kb** core includes more built-in features: global state management, lists (itemize API), exit animations, computed properties etc. Lit needs additional packages for comparable features. React is **~8× larger** before adding a router, state manager, or SSR framework.
344
+ Symbiote and Lit have similar base sizes, but Symbiote's **5.9 kb** core includes more built-in features: global state management, lists (itemize API), exit animations, computed properties etc. Lit needs additional packages for comparable features. React is **~8× larger** before adding a router, state manager, or SSR framework.
345
345
 
346
346
  ## Browser support
347
347
 
package/core/Symbiote.js CHANGED
@@ -142,7 +142,11 @@ export class Symbiote extends HTMLElement {
142
142
  fr && ((shadow && this.shadowRoot.appendChild(fr)) || this.appendChild(fr));
143
143
  }
144
144
  this.#initCallback();
145
- this.renderCallback?.();
145
+ try {
146
+ this.renderCallback?.();
147
+ } catch (e) {
148
+ if (!globalThis.__SYMBIOTE_SSR) throw e;
149
+ }
146
150
  };
147
151
 
148
152
  if (this.#super.shadowStyleSheets) {
@@ -587,9 +591,14 @@ export class Symbiote extends HTMLElement {
587
591
  /** @param {Object<string, string>} desc */
588
592
  static bindAttributes(desc) {
589
593
  /** @type {String[]} */
590
- this.observedAttributes = [
594
+ let attrs = [
595
+ // @ts-ignore - observedAttributes is a native HTMLElement static getter
591
596
  ...new Set((this.observedAttributes || []).concat(Object.keys(desc)))
592
597
  ];
598
+ Object.defineProperty(this, 'observedAttributes', {
599
+ configurable: true,
600
+ get() { return attrs; },
601
+ });
593
602
  /** @private */
594
603
  this.__attrDesc = desc;
595
604
  }
@@ -25,13 +25,13 @@ function fmt(code, body, doc, tag) {
25
25
  return `[Symbiote ${code}]${tag ? ` <${tag}>:` : ''} ${body}\n→ ${DOCS}${doc}.md`;
26
26
  }
27
27
  let isErr = code.startsWith('E');
28
- let parts = `%cSymbiote%c${code}%c`;
28
+ let parts = `%c Symbiote %c ${code} %c`;
29
29
  let styles = [S.badge, isErr ? S.errCode : S.code, S.reset];
30
30
  if (tag) {
31
31
  parts += ` %c<${tag}>%c`;
32
32
  styles.push(S.tag, S.reset);
33
33
  }
34
- parts += ` ${body} %c→ ${doc}`;
34
+ parts += ` ${body}\n%c→ ${DOCS}${doc}.md`;
35
35
  styles.push(S.dim);
36
36
  return [parts, ...styles];
37
37
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "type": "module",
3
3
  "name": "@symbiotejs/symbiote",
4
- "version": "3.5.2",
4
+ "version": "3.5.4",
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":"Symbiote.d.ts","sourceRoot":"","sources":["../../core/Symbiote.js"],"names":[],"mappings":";;AAoBA,sBADc,CAAC;IAuBb,cADW,mBAAmB,CACjB;IAEb,iCAEC;IAED,8BAEC;IAkBD,wBAAgB;IA0JhB,+BAJwB,CAAC,SA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