@symbiotejs/symbiote 3.8.1 → 3.8.2
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/README.md +19 -106
- package/docs/README.md +0 -6
- package/docs/animations.md +1 -1
- package/docs/attributes.md +2 -2
- package/docs/common-mistakes.md +63 -1
- package/docs/context.md +212 -73
- package/docs/ecosystem.md +0 -3
- package/docs/llms-index.md +0 -1
- package/llms-full.txt +297 -183
- package/llms.txt +0 -1
- package/package.json +1 -2
- package/scripts/build-llms.js +0 -2
- package/CHANGELOG.md +0 -372
- package/docs/lit-vs-symbiote.md +0 -200
- package/docs/migration-2x-to-3x.md +0 -171
|
@@ -1,171 +0,0 @@
|
|
|
1
|
-
# Migration Guide: 2.x → 3.x
|
|
2
|
-
|
|
3
|
-
## Breaking Changes
|
|
4
|
-
|
|
5
|
-
### `AppRouter.applyRoute()` → `AppRouter.navigate()`
|
|
6
|
-
|
|
7
|
-
```js
|
|
8
|
-
// 2.x:
|
|
9
|
-
AppRouter.applyRoute('settings', { tab: 'general' });
|
|
10
|
-
|
|
11
|
-
// 3.x:
|
|
12
|
-
AppRouter.navigate('settings', { tab: 'general' });
|
|
13
|
-
```
|
|
14
|
-
|
|
15
|
-
### `AppRouter` removed from main entry point
|
|
16
|
-
|
|
17
|
-
```js
|
|
18
|
-
// 2.x:
|
|
19
|
-
import { AppRouter } from '@symbiotejs/symbiote';
|
|
20
|
-
|
|
21
|
-
// 3.x:
|
|
22
|
-
import { AppRouter } from '@symbiotejs/symbiote/core/AppRouter.js';
|
|
23
|
-
```
|
|
24
|
-
|
|
25
|
-
### `tplProcessors` → `templateProcessors`
|
|
26
|
-
|
|
27
|
-
The `addTemplateProcessor()` method is removed. Use native `Set` methods:
|
|
28
|
-
```js
|
|
29
|
-
// 2.x:
|
|
30
|
-
this.addTemplateProcessor(myProcessor);
|
|
31
|
-
|
|
32
|
-
// 3.x:
|
|
33
|
-
this.templateProcessors.add(myProcessor);
|
|
34
|
-
```
|
|
35
|
-
|
|
36
|
-
### Computed properties: cross-context requires explicit deps
|
|
37
|
-
|
|
38
|
-
Local computeds (same-context) keep working unchanged. Cross-context now uses object syntax:
|
|
39
|
-
```js
|
|
40
|
-
// 2.x — implicit via global scan:
|
|
41
|
-
init$ = {
|
|
42
|
-
'+total': () => this.$['APP/score'] + this.$.local,
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
// 3.x — explicit deps:
|
|
46
|
-
init$ = {
|
|
47
|
-
'+total': {
|
|
48
|
-
deps: ['APP/score'],
|
|
49
|
-
fn: () => this.$['APP/score'] + this.$.local,
|
|
50
|
-
},
|
|
51
|
-
};
|
|
52
|
-
```
|
|
53
|
-
|
|
54
|
-
### Shared context (`*prop`) simplified
|
|
55
|
-
|
|
56
|
-
- Removed `ctxOwner` flag and `ctx-owner` HTML attribute
|
|
57
|
-
- First-registered value always wins
|
|
58
|
-
- Dev-mode warnings when `*prop` used without `ctx` attribute
|
|
59
|
-
|
|
60
|
-
## New Features
|
|
61
|
-
|
|
62
|
-
### Server-Side Rendering
|
|
63
|
-
|
|
64
|
-
`SSR` class with static methods for server-side rendering:
|
|
65
|
-
```js
|
|
66
|
-
import { SSR } from '@symbiotejs/symbiote/node/SSR.js';
|
|
67
|
-
|
|
68
|
-
await SSR.init();
|
|
69
|
-
await import('./my-app.js');
|
|
70
|
-
let html = await SSR.processHtml('<my-app>content</my-app>');
|
|
71
|
-
SSR.destroy();
|
|
72
|
-
```
|
|
73
|
-
|
|
74
|
-
See [SSR documentation](./ssr.md).
|
|
75
|
-
|
|
76
|
-
### Path-based routing
|
|
77
|
-
|
|
78
|
-
Routes with `pattern` key use path-based URLs with `:param` extraction:
|
|
79
|
-
```js
|
|
80
|
-
AppRouter.initRoutingCtx('R', {
|
|
81
|
-
home: { pattern: '/', title: 'Home', default: true },
|
|
82
|
-
user: { pattern: '/users/:id', title: 'User' },
|
|
83
|
-
});
|
|
84
|
-
// /users/42 → { route: 'user', options: { id: '42' } }
|
|
85
|
-
```
|
|
86
|
-
|
|
87
|
-
Query-string routes remain fully backward compatible. See [Routing documentation](./routing.md).
|
|
88
|
-
|
|
89
|
-
### Route guards
|
|
90
|
-
|
|
91
|
-
```js
|
|
92
|
-
let unsub = AppRouter.beforeRoute((to, from) => {
|
|
93
|
-
if (!isAuth && to.route === 'settings') return 'login';
|
|
94
|
-
});
|
|
95
|
-
```
|
|
96
|
-
|
|
97
|
-
### Lazy loaded routes
|
|
98
|
-
|
|
99
|
-
```js
|
|
100
|
-
{ pattern: '/settings', load: () => import('./pages/settings.js') }
|
|
101
|
-
```
|
|
102
|
-
|
|
103
|
-
### Exit animations
|
|
104
|
-
|
|
105
|
-
`animateOut(el)` for CSS-driven exit transitions:
|
|
106
|
-
```css
|
|
107
|
-
my-item {
|
|
108
|
-
transition: opacity 0.3s;
|
|
109
|
-
&[leaving] { opacity: 0; }
|
|
110
|
-
}
|
|
111
|
-
```
|
|
112
|
-
|
|
113
|
-
See [Animations documentation](./animations.md).
|
|
114
|
-
|
|
115
|
-
### Class property fallback
|
|
116
|
-
|
|
117
|
-
Bindings fall back to own class properties when no `init$` key found. Functions are auto-bound to the instance:
|
|
118
|
-
```js
|
|
119
|
-
class MyComp extends Symbiote {
|
|
120
|
-
label = 'Click me';
|
|
121
|
-
onSubmit() { console.log('submitted'); }
|
|
122
|
-
}
|
|
123
|
-
```
|
|
124
|
-
|
|
125
|
-
### Dev mode
|
|
126
|
-
|
|
127
|
-
```js
|
|
128
|
-
Symbiote.devMode = true;
|
|
129
|
-
```
|
|
130
|
-
|
|
131
|
-
Enables verbose warnings for unresolved bindings, tag names, and context issues. See [Dev Mode documentation](./dev-mode.md).
|
|
132
|
-
|
|
133
|
-
### `destructionDelay`
|
|
134
|
-
|
|
135
|
-
Configurable delay (default 100ms) before cleanup in `disconnectedCallback`:
|
|
136
|
-
```js
|
|
137
|
-
class MyComp extends Symbiote {
|
|
138
|
-
destructionDelay = 500;
|
|
139
|
-
}
|
|
140
|
-
```
|
|
141
|
-
|
|
142
|
-
### `reg()` returns the class
|
|
143
|
-
|
|
144
|
-
Enables:
|
|
145
|
-
```js
|
|
146
|
-
export default MyComponent.reg('my-component');
|
|
147
|
-
```
|
|
148
|
-
|
|
149
|
-
### Trusted Types
|
|
150
|
-
|
|
151
|
-
Template writes use `'symbiote'` Trusted Types policy when available. See [Security documentation](./security.md).
|
|
152
|
-
|
|
153
|
-
### Declarative Shadow DOM hydration
|
|
154
|
-
|
|
155
|
-
`ssrMode = true` hydrates pre-rendered content (light DOM + `<template shadowrootmode>`). See [SSR documentation](./ssr.md).
|
|
156
|
-
|
|
157
|
-
## Performance Improvements
|
|
158
|
-
|
|
159
|
-
- **Computed properties**: per-instance dependency tracking — up to **676× faster** for local computeds
|
|
160
|
-
- **Microtask batching**: all computed recalculation uses `queueMicrotask` instead of `setTimeout`
|
|
161
|
-
- **`$` proxy fast path**: `get` and `set` traps bypass parsing for local props
|
|
162
|
-
- **`PubSub.pub()` direct value pass**: eliminates redundant `read()` on every update
|
|
163
|
-
- **`txtNodesProcessor` early exit**: skips scanning when template contains no `{{` tokens
|
|
164
|
-
- **Dev warnings gated**: type-mismatch checks have zero overhead in production
|
|
165
|
-
- **Optional keyed itemize processor**: up to **3×** faster for appends, **32×** for no-ops
|
|
166
|
-
|
|
167
|
-
## Fixes
|
|
168
|
-
|
|
169
|
-
- `css()` trailing `undefined` when no interpolations exist
|
|
170
|
-
- `new DocumentFragment()` → `document.createDocumentFragment()` for linkedom compatibility
|
|
171
|
-
- `txtNodesProcessor` null check for `fr.textContent` in SSR environments
|