@nisli/core 0.46.0 → 0.48.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 +24 -4
- package/dist/ref.d.ts +3 -3
- package/dist/ref.js +3 -3
- package/package.json +12 -7
package/README.md
CHANGED
|
@@ -16,7 +16,7 @@ import { signal, component, html } from '@nisli/core';
|
|
|
16
16
|
const Counter = component('x-counter', () => {
|
|
17
17
|
const count = signal(0);
|
|
18
18
|
return html`
|
|
19
|
-
<button @click=${() => count.
|
|
19
|
+
<button @click=${() => count.value++}>
|
|
20
20
|
Count: ${count}
|
|
21
21
|
</button>
|
|
22
22
|
`;
|
|
@@ -45,7 +45,7 @@ effect(() => { ... }) // Side effect that tracks dependencies
|
|
|
45
45
|
|
|
46
46
|
// Components
|
|
47
47
|
component('tag-name', (props, host) => html`...`)
|
|
48
|
-
component<Props>('tag-name',
|
|
48
|
+
component<Props>('tag-name', (props, host) => html`...`)
|
|
49
49
|
|
|
50
50
|
// Templates — signals are implicit, no .value needed
|
|
51
51
|
html`<div>${count}</div>`
|
|
@@ -69,11 +69,11 @@ const { data, loading, error } = query(
|
|
|
69
69
|
// Lifecycle
|
|
70
70
|
onMount(() => { ... })
|
|
71
71
|
onCleanup(() => { ... })
|
|
72
|
-
useHostEvent('click', handler)
|
|
72
|
+
useHostEvent(host, 'click', handler)
|
|
73
73
|
|
|
74
74
|
// Refs
|
|
75
75
|
const el = ref<HTMLDivElement>()
|
|
76
|
-
html`<div ${el}>...</div>`
|
|
76
|
+
html`<div ref="${el}">...</div>`
|
|
77
77
|
|
|
78
78
|
// Events
|
|
79
79
|
class Nav extends Emitter<{ select: { id: string } }> {}
|
|
@@ -81,6 +81,26 @@ inject(Nav).emit('select', { id })
|
|
|
81
81
|
inject(Nav).on('select', ({ id }) => { ... })
|
|
82
82
|
```
|
|
83
83
|
|
|
84
|
+
## Static Site Generation
|
|
85
|
+
|
|
86
|
+
Use the companion `@nisli/ssg` package when you want build-time pages,
|
|
87
|
+
publication output, feeds, or other DOM-free static output.
|
|
88
|
+
|
|
89
|
+
```typescript
|
|
90
|
+
import { buildStaticSite } from '@nisli/ssg';
|
|
91
|
+
|
|
92
|
+
await buildStaticSite({
|
|
93
|
+
outDir: 'dist',
|
|
94
|
+
routes: [
|
|
95
|
+
{ path: '/', render: () => '<article>...</article>' },
|
|
96
|
+
],
|
|
97
|
+
});
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
`@nisli/core` stays focused on component authoring and the browser runtime.
|
|
101
|
+
`@nisli/ssg` owns static site generation; static rendering internals stay behind
|
|
102
|
+
the build tool.
|
|
103
|
+
|
|
84
104
|
## Size
|
|
85
105
|
|
|
86
106
|
~2,600 lines of TypeScript. Zero dependencies.
|
package/dist/ref.d.ts
CHANGED
|
@@ -10,11 +10,11 @@
|
|
|
10
10
|
*
|
|
11
11
|
* onMount(() => inputRef.current?.focus());
|
|
12
12
|
*
|
|
13
|
-
* return html`<input ${inputRef} @keydown.enter=${onSubmit} />`;
|
|
13
|
+
* return html`<input ref="${inputRef}" @keydown.enter=${onSubmit} />`;
|
|
14
14
|
* ```
|
|
15
15
|
*
|
|
16
|
-
* The template engine detects `Ref` objects in
|
|
17
|
-
*
|
|
16
|
+
* The template engine detects `Ref` objects in `ref="${...}"`
|
|
17
|
+
* attribute bindings and assigns the referenced element.
|
|
18
18
|
*/
|
|
19
19
|
export declare const REF_BRAND: unique symbol;
|
|
20
20
|
export interface Ref<T extends Element = Element> {
|
package/dist/ref.js
CHANGED
|
@@ -10,11 +10,11 @@
|
|
|
10
10
|
*
|
|
11
11
|
* onMount(() => inputRef.current?.focus());
|
|
12
12
|
*
|
|
13
|
-
* return html`<input ${inputRef} @keydown.enter=${onSubmit} />`;
|
|
13
|
+
* return html`<input ref="${inputRef}" @keydown.enter=${onSubmit} />`;
|
|
14
14
|
* ```
|
|
15
15
|
*
|
|
16
|
-
* The template engine detects `Ref` objects in
|
|
17
|
-
*
|
|
16
|
+
* The template engine detects `Ref` objects in `ref="${...}"`
|
|
17
|
+
* attribute bindings and assigns the referenced element.
|
|
18
18
|
*/
|
|
19
19
|
// ── Brand for ref detection in templates ─────────────────────────────
|
|
20
20
|
export const REF_BRAND = Symbol.for('backlog.ref');
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nisli/core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.48.0",
|
|
4
4
|
"description": "A reactive web component framework. Signals, templates, dependency injection — no build step, no virtual DOM, no dependencies.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"repository": {
|
|
8
8
|
"type": "git",
|
|
9
|
-
"url": "https://github.com/gkoreli/
|
|
10
|
-
"directory": "packages/
|
|
9
|
+
"url": "https://github.com/gkoreli/nisli.git",
|
|
10
|
+
"directory": "packages/core"
|
|
11
11
|
},
|
|
12
12
|
"keywords": [
|
|
13
13
|
"web-components",
|
|
@@ -18,9 +18,14 @@
|
|
|
18
18
|
"dependency-injection"
|
|
19
19
|
],
|
|
20
20
|
"exports": {
|
|
21
|
-
".":
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
".": "./src/index.ts"
|
|
22
|
+
},
|
|
23
|
+
"publishConfig": {
|
|
24
|
+
"exports": {
|
|
25
|
+
".": {
|
|
26
|
+
"types": "./dist/index.d.ts",
|
|
27
|
+
"default": "./dist/index.js"
|
|
28
|
+
}
|
|
24
29
|
}
|
|
25
30
|
},
|
|
26
31
|
"files": [
|
|
@@ -34,4 +39,4 @@
|
|
|
34
39
|
"typecheck": "tsc --noEmit",
|
|
35
40
|
"clean": "rm -rf dist"
|
|
36
41
|
}
|
|
37
|
-
}
|
|
42
|
+
}
|