lithent 1.21.7 → 1.22.1
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 +9 -0
- package/dist/lithent-agent-addon.md +15 -2
- package/dist/lithent.mjs +453 -376
- package/dist/lithent.mjs.map +1 -1
- package/dist/lithent.umd.js +1 -1
- package/dist/lithent.umd.js.map +1 -1
- package/dist/render.d.ts +4 -0
- package/dist/skills/lithent/SKILL.md +32 -3
- package/dist/skills/lithent/constraints/mistakes.md +4 -1
- package/dist/skills/lithent/constraints/rules.md +2 -1
- package/dist/skills/lithent/constraints/troubleshooting.md +4 -1
- package/dist/skills/lithent/examples/quick-examples.md +1 -1
- package/dist/skills/lithent/reference/children-type.md +1 -1
- package/dist/skills/lithent/reference/concurrent.md +104 -0
- package/dist/skills/lithent/reference/lstore-inference.md +1 -1
- package/dist/skills/lithent/reference/props-types.md +1 -1
- package/dist/types/index.d.ts +2 -1
- package/dist/utils/predicator.d.ts +2 -2
- package/examples/dist/assets/index-oBwBT33f.js +2 -0
- package/examples/dist/assets/index-oBwBT33f.js.map +1 -0
- package/examples/dist/index.html +1 -1
- package/helper/dist/lithentHelper.mjs +96 -87
- package/helper/dist/lithentHelper.mjs.map +1 -1
- package/helper/dist/lithentHelper.umd.js +1 -1
- package/helper/dist/lithentHelper.umd.js.map +1 -1
- package/helper/package.json +4 -2
- package/helper/src/hook/lstore.ts +14 -0
- package/helper/src/hook/store.ts +14 -0
- package/helper/src/tests/contextRemoval.tsx +83 -0
- package/helper/src/tests/laneInteraction.tsx +324 -0
- package/helper/src/tests/storeVersion.tsx +88 -0
- package/jsx-runtime/dist/index.d.ts +8 -2
- package/jsx-runtime/dist/jsxRuntime.mjs +10 -7
- package/jsx-runtime/dist/jsxRuntime.mjs.map +1 -1
- package/jsx-runtime/dist/jsxRuntime.umd.js +1 -1
- package/jsx-runtime/dist/jsxRuntime.umd.js.map +1 -1
- package/jsx-runtime/package.json +4 -2
- package/jsx-runtime/src/index.ts +17 -5
- package/package.json +28 -4
- package/src/diff.ts +56 -81
- package/src/hook/internal/unmount.ts +3 -0
- package/src/render.ts +250 -63
- package/src/tests/core-loopLifecycleOrder.tsx +68 -0
- package/src/tests/core-loopMoveOrder.tsx +77 -0
- package/src/tests/core-removedRedraw.test.tsx +70 -0
- package/src/types/index.ts +1 -1
- package/src/utils/predicator.ts +20 -8
- package/src/wDom.ts +10 -4
- package/ssr/dist/lithentSsr.mjs +80 -77
- package/ssr/dist/lithentSsr.mjs.map +1 -1
- package/ssr/dist/lithentSsr.umd.js +2 -2
- package/ssr/dist/lithentSsr.umd.js.map +1 -1
- package/ssr/src/tests/laneHydration.tsx +91 -0
- package/examples/dist/assets/index-CLyQ20Qs.js +0 -2
- package/examples/dist/assets/index-CLyQ20Qs.js.map +0 -1
package/README.md
CHANGED
|
@@ -122,8 +122,17 @@ const Counter = lmount(() => {
|
|
|
122
122
|
| [lithent/ssr](https://www.npmjs.com/package/lithent) | Server‑side rendering |
|
|
123
123
|
| [lithent/ftags](https://www.npmjs.com/package/lithent) | Function‑style tag API |
|
|
124
124
|
| [lithent/tag](https://www.npmjs.com/package/lithent) | HTM template support |
|
|
125
|
+
| [lithent-concurrent](./lithentConcurrent/README.md) | Separate core with priority scheduling and interruptible low-priority builds |
|
|
126
|
+
| [lithent-concurrent/helper](./lithentConcurrent/README.md#lithent-concurrenthelper) | Deferred state and component-local pending queries |
|
|
125
127
|
| [create-lithent](https://www.npmjs.com/package/create-lithent) | Project scaffolding tool |
|
|
126
128
|
|
|
129
|
+
For expensive component trees, select the concurrent core with an exact
|
|
130
|
+
`/^lithent$/` bundler alias. `deferRender` defers rendering while state writes
|
|
131
|
+
remain immediate; `whenIdle` waits for deferred work. Keep urgent input and
|
|
132
|
+
heavy rendering in separate components. See the [concurrent rendering
|
|
133
|
+
guide](https://superlucky84.github.io/lithent/#/guide/concurrent-rendering) and
|
|
134
|
+
[release notes](./CHANGELOG.md).
|
|
135
|
+
|
|
127
136
|
<br />
|
|
128
137
|
|
|
129
138
|
## License
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Lithent Agent Addon
|
|
2
2
|
|
|
3
|
-
> Version: 1.
|
|
3
|
+
> Version: 1.22.1
|
|
4
4
|
|
|
5
5
|
You are a coding agent with Lithent virtual DOM guidance enabled.
|
|
6
6
|
|
|
@@ -47,7 +47,7 @@ CODING GUIDELINES:
|
|
|
47
47
|
4. LIFECYCLE HOOKS
|
|
48
48
|
- Use `mountCallback` for setup after mount (return cleanup function)
|
|
49
49
|
- Use `updateCallback` for logic before each update
|
|
50
|
-
- Use `mountReadyCallback` for logic after
|
|
50
|
+
- Use `mountReadyCallback` for logic right after the WDom is created (before DOM insertion)
|
|
51
51
|
- Place hooks in mounter function, not in updater
|
|
52
52
|
|
|
53
53
|
5. LIST RENDERING
|
|
@@ -82,12 +82,22 @@ CODING GUIDELINES:
|
|
|
82
82
|
- Access children as third parameter in mounter function
|
|
83
83
|
- Don't modify children directly, wrap or filter them
|
|
84
84
|
|
|
85
|
+
11. CONCURRENT RENDERING (only when `lithent-concurrent` is installed or requested)
|
|
86
|
+
- Suggest it only for very large trees (thousands of rows); plain `lithent` otherwise
|
|
87
|
+
- Select the core with an exact `/^lithent$/` alias; never alias `lithent/*` subpaths
|
|
88
|
+
- Keep urgent input state and the heavy list in separate components
|
|
89
|
+
- `deferRender` runs its scope synchronously; only rendering is deferred
|
|
90
|
+
- `await nextTick()` covers sync commits; use `await whenIdle()` for deferred renders
|
|
91
|
+
- `hasPendingRender` is a query, not reactive; show pending from a sync parent
|
|
92
|
+
- No Suspense or `use()`; updateCallback's return value is not an unmount cleanup
|
|
93
|
+
|
|
85
94
|
IMPORT PATHS:
|
|
86
95
|
- Core: `import { mount, lmount, render, h, Fragment, portal, ref, nextTick } from 'lithent'`
|
|
87
96
|
- Lifecycle: `import { mountCallback, updateCallback, mountReadyCallback } from 'lithent'`
|
|
88
97
|
- Helper (manual): `import { state, store, createContext, computed, effect } from 'lithent/helper'`
|
|
89
98
|
- Helper (light): `import { lstate, lstore, createLContext } from 'lithent/helper'`
|
|
90
99
|
- Helper (utils): `import { cacheUpdate, nextTickRender, unwrapChildren } from 'lithent/helper'`
|
|
100
|
+
- Concurrent (optional): `import { deferRender, whenIdle } from 'lithent-concurrent'` and `import { deferred, ldeferred, hasPendingRender } from 'lithent-concurrent/helper'`
|
|
91
101
|
- SSR: `import { renderToString, hydration } from 'lithent/ssr'`
|
|
92
102
|
- FTags: `import { fTags, fFragment, fMount } from 'lithent/ftags'`
|
|
93
103
|
- HTM: `import { lTag } from 'lithent/tag'`
|
|
@@ -116,11 +126,14 @@ COMMON MISTAKES TO CATCH:
|
|
|
116
126
|
- Missing `key` prop in list iterations
|
|
117
127
|
- Calling hooks inside updater instead of mounter
|
|
118
128
|
- Mutating state directly instead of using `.value`
|
|
129
|
+
- Using `deferRender` while the urgent state and heavy list share one component
|
|
130
|
+
- Aliasing `lithent` with a prefix match so `lithent/helper` is rewritten too
|
|
119
131
|
|
|
120
132
|
REFERENCE MATERIALS (NOT PART OF BEHAVIORAL RULES):
|
|
121
133
|
|
|
122
134
|
For detailed code examples and API usage, refer to:
|
|
123
135
|
node_modules/lithent/dist/skills/lithent/SKILL.md
|
|
136
|
+
(concurrent details: node_modules/lithent/dist/skills/lithent/reference/concurrent.md)
|
|
124
137
|
|
|
125
138
|
This reference material provides comprehensive examples, patterns,
|
|
126
139
|
and import references that complement the behavioral guidelines above.
|