lithent 1.22.1 → 1.23.0
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 +15 -0
- package/dist/lithent-agent-addon.md +11 -1
- package/dist/lithent.mjs +270 -271
- package/dist/lithent.mjs.map +1 -1
- package/dist/lithent.umd.js +1 -1
- package/dist/lithent.umd.js.map +1 -1
- package/dist/skills/lithent/SKILL.md +25 -3
- package/dist/skills/lithent/constraints/mistakes.md +1 -1
- package/dist/skills/lithent/constraints/rules.md +1 -1
- package/dist/skills/lithent/constraints/troubleshooting.md +1 -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 +1 -1
- package/dist/skills/lithent/reference/element.md +69 -0
- package/dist/skills/lithent/reference/lstore-inference.md +1 -1
- package/dist/skills/lithent/reference/props-types.md +1 -1
- package/dist/utils/predicator.d.ts +1 -0
- package/element/dist/index.d.ts +56 -0
- package/element/dist/lithentElement.mjs +99 -0
- package/element/dist/lithentElement.mjs.map +1 -0
- package/element/dist/lithentElement.umd.js +3 -0
- package/element/dist/lithentElement.umd.js.map +1 -0
- package/element/package.json +37 -0
- package/element/src/index.ts +295 -0
- package/element/src/tests/element-attributes.test.ts +176 -0
- package/element/src/tests/element-boundaries.test.ts +198 -0
- package/element/src/tests/element-events.test.ts +198 -0
- package/element/src/tests/element-hardening.test.ts +268 -0
- package/element/src/tests/element-lifecycle.test.ts +175 -0
- package/element/src/tests/element-move.test.ts +146 -0
- package/element/src/tests/element-properties.test.ts +149 -0
- package/element/src/tests/element-shadow.test.ts +221 -0
- package/element/src/tests/element-smoke.test.ts +21 -0
- package/element/src/tests/element-ssr.test.ts +20 -0
- package/element/src/tests/element-types.test.ts +104 -0
- package/examples/dist/assets/index-BZ7HvV5V.js +2 -0
- package/examples/dist/assets/index-BZ7HvV5V.js.map +1 -0
- package/examples/dist/index.html +1 -1
- package/package.json +16 -3
- package/src/render.ts +27 -1
- package/src/tests/core-accessorUpgrade.test.tsx +288 -0
- package/src/tests/core-destroyUnmount.test.tsx +77 -0
- package/src/utils/predicator.ts +17 -10
- package/examples/dist/assets/index-oBwBT33f.js +0 -2
- package/examples/dist/assets/index-oBwBT33f.js.map +0 -1
package/README.md
CHANGED
|
@@ -53,6 +53,8 @@ npm install lithent
|
|
|
53
53
|
```html
|
|
54
54
|
<script src="https://cdn.jsdelivr.net/npm/lithent/dist/lithent.umd.js"></script>
|
|
55
55
|
<script src="https://cdn.jsdelivr.net/npm/lithent/ftags/dist/lithentFTags.umd.js"></script>
|
|
56
|
+
<!-- Custom Elements (optional) -->
|
|
57
|
+
<script src="https://cdn.jsdelivr.net/npm/lithent/element/dist/lithentElement.umd.js"></script>
|
|
56
58
|
```
|
|
57
59
|
|
|
58
60
|
> **[📦 View all available CDN URLs](https://superlucky84.github.io/lithent/#/guide/quick-start)**
|
|
@@ -103,6 +105,18 @@ const Counter = lmount(() => {
|
|
|
103
105
|
- **store / lstore** — Global state
|
|
104
106
|
- **context / lcontext** — Cross-component data sharing
|
|
105
107
|
|
|
108
|
+
### Custom Elements (optional)
|
|
109
|
+
- **lithent/element** — Register a component as a standard Custom Element and embed it in any page (plain HTML, server templates, React, Vue) with a script and a tag. Shadow DOM style isolation, attribute/property props, DOM events. Under 1KB on top of the core.
|
|
110
|
+
|
|
111
|
+
```js
|
|
112
|
+
import { defineElement, emit } from 'lithent/element';
|
|
113
|
+
|
|
114
|
+
defineElement('pay-button', PayButton, { props: { amount: Number } });
|
|
115
|
+
// <pay-button amount="1000"></pay-button>
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
> **[🧩 Custom Elements guide](https://superlucky84.github.io/lithent/#/guide/element)**
|
|
119
|
+
|
|
106
120
|
### Template options
|
|
107
121
|
- **JSX** — Via Vite plugin
|
|
108
122
|
- **FTags** — Function-style tags (no build step)
|
|
@@ -122,6 +136,7 @@ const Counter = lmount(() => {
|
|
|
122
136
|
| [lithent/ssr](https://www.npmjs.com/package/lithent) | Server‑side rendering |
|
|
123
137
|
| [lithent/ftags](https://www.npmjs.com/package/lithent) | Function‑style tag API |
|
|
124
138
|
| [lithent/tag](https://www.npmjs.com/package/lithent) | HTM template support |
|
|
139
|
+
| [lithent/element](./element/README.md) | Register components as Custom Elements, embeddable in any page ([guide](https://superlucky84.github.io/lithent/#/guide/element)) |
|
|
125
140
|
| [lithent-concurrent](./lithentConcurrent/README.md) | Separate core with priority scheduling and interruptible low-priority builds |
|
|
126
141
|
| [lithent-concurrent/helper](./lithentConcurrent/README.md#lithent-concurrenthelper) | Deferred state and component-local pending queries |
|
|
127
142
|
| [create-lithent](https://www.npmjs.com/package/create-lithent) | Project scaffolding tool |
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Lithent Agent Addon
|
|
2
2
|
|
|
3
|
-
> Version: 1.
|
|
3
|
+
> Version: 1.23.0
|
|
4
4
|
|
|
5
5
|
You are a coding agent with Lithent virtual DOM guidance enabled.
|
|
6
6
|
|
|
@@ -91,6 +91,14 @@ CODING GUIDELINES:
|
|
|
91
91
|
- `hasPendingRender` is a query, not reactive; show pending from a sync parent
|
|
92
92
|
- No Suspense or `use()`; updateCallback's return value is not an unmount cleanup
|
|
93
93
|
|
|
94
|
+
12. CUSTOM ELEMENTS (when the user embeds UI in pages they do not own)
|
|
95
|
+
- Suggest `lithent/element`: `defineElement('my-widget', Component, { props: { amount: Number } })`
|
|
96
|
+
- Declared props are optional in the component (Boolean props are boolean); never require them
|
|
97
|
+
- Objects, arrays, functions go through properties; attributes only carry strings
|
|
98
|
+
- Use `props.host` with `emit(host, name, detail)` for events out; `host` is reserved
|
|
99
|
+
- Default is an open shadow root; ship CSS with `styles`, theme via CSS variables and `::part()`
|
|
100
|
+
- Avoid native property names (`title`, `hidden`) as props
|
|
101
|
+
|
|
94
102
|
IMPORT PATHS:
|
|
95
103
|
- Core: `import { mount, lmount, render, h, Fragment, portal, ref, nextTick } from 'lithent'`
|
|
96
104
|
- Lifecycle: `import { mountCallback, updateCallback, mountReadyCallback } from 'lithent'`
|
|
@@ -99,6 +107,7 @@ IMPORT PATHS:
|
|
|
99
107
|
- Helper (utils): `import { cacheUpdate, nextTickRender, unwrapChildren } from 'lithent/helper'`
|
|
100
108
|
- Concurrent (optional): `import { deferRender, whenIdle } from 'lithent-concurrent'` and `import { deferred, ldeferred, hasPendingRender } from 'lithent-concurrent/helper'`
|
|
101
109
|
- SSR: `import { renderToString, hydration } from 'lithent/ssr'`
|
|
110
|
+
- Custom Elements: `import { defineElement, emit } from 'lithent/element'`
|
|
102
111
|
- FTags: `import { fTags, fFragment, fMount } from 'lithent/ftags'`
|
|
103
112
|
- HTM: `import { lTag } from 'lithent/tag'`
|
|
104
113
|
|
|
@@ -134,6 +143,7 @@ REFERENCE MATERIALS (NOT PART OF BEHAVIORAL RULES):
|
|
|
134
143
|
For detailed code examples and API usage, refer to:
|
|
135
144
|
node_modules/lithent/dist/skills/lithent/SKILL.md
|
|
136
145
|
(concurrent details: node_modules/lithent/dist/skills/lithent/reference/concurrent.md)
|
|
146
|
+
(custom elements: node_modules/lithent/dist/skills/lithent/reference/element.md)
|
|
137
147
|
|
|
138
148
|
This reference material provides comprehensive examples, patterns,
|
|
139
149
|
and import references that complement the behavioral guidelines above.
|