@nisli/core 0.47.4 → 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 CHANGED
@@ -34,7 +34,6 @@ const Counter = component('x-counter', () => {
34
34
  - **Lifecycle** — `onMount`, `onCleanup`, `useHostEvent`
35
35
  - **Refs** — Direct element access via `ref()`
36
36
  - **Control Flow** — `when()` for toggles, `each()` for keyed list rendering
37
- - **Static Rendering** — DOM-free HTML string rendering via `@nisli/core/static`
38
37
 
39
38
  ## API
40
39
 
@@ -82,20 +81,25 @@ inject(Nav).emit('select', { id })
82
81
  inject(Nav).on('select', ({ id }) => { ... })
83
82
  ```
84
83
 
85
- ## Static Rendering
84
+ ## Static Site Generation
86
85
 
87
- Use the static entry point when you want HTML strings for build-time pages,
88
- feeds, emails, or other DOM-free output.
86
+ Use the companion `@nisli/ssg` package when you want build-time pages,
87
+ publication output, feeds, or other DOM-free static output.
89
88
 
90
89
  ```typescript
91
- import { staticHtml, raw, renderToString } from '@nisli/core/static';
90
+ import { buildStaticSite } from '@nisli/ssg';
92
91
 
93
- const page = staticHtml`<article>${raw(markdownHtml)}</article>`;
94
- const output = renderToString(page);
92
+ await buildStaticSite({
93
+ outDir: 'dist',
94
+ routes: [
95
+ { path: '/', render: () => '<article>...</article>' },
96
+ ],
97
+ });
95
98
  ```
96
99
 
97
- `staticHtml` is intentionally separate from browser `html`. Browser `html`
98
- returns mountable DOM bindings; `staticHtml` returns escaped static HTML strings.
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.
99
103
 
100
104
  ## Size
101
105
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nisli/core",
3
- "version": "0.47.4",
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",
@@ -18,13 +18,14 @@
18
18
  "dependency-injection"
19
19
  ],
20
20
  "exports": {
21
- ".": {
22
- "types": "./dist/index.d.ts",
23
- "default": "./dist/index.js"
24
- },
25
- "./static": {
26
- "types": "./dist/static/index.d.ts",
27
- "default": "./dist/static/index.js"
21
+ ".": "./src/index.ts"
22
+ },
23
+ "publishConfig": {
24
+ "exports": {
25
+ ".": {
26
+ "types": "./dist/index.d.ts",
27
+ "default": "./dist/index.js"
28
+ }
28
29
  }
29
30
  },
30
31
  "files": [
@@ -38,4 +39,4 @@
38
39
  "typecheck": "tsc --noEmit",
39
40
  "clean": "rm -rf dist"
40
41
  }
41
- }
42
+ }
@@ -1,4 +0,0 @@
1
- /**
2
- * Static rendering public API.
3
- */
4
- export { staticHtml, raw, renderToString, type StaticResult, type RawHtml, } from './render.js';
@@ -1,5 +0,0 @@
1
- /**
2
- * Static rendering public API.
3
- */
4
- export { staticHtml, raw, renderToString, } from './render.js';
5
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/static/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EACL,UAAU,EACV,GAAG,EACH,cAAc,GAGf,MAAM,aAAa,CAAC"}
@@ -1,17 +0,0 @@
1
- /**
2
- * Static HTML renderer for Nisli-style templates.
3
- *
4
- * This module is intentionally DOM-free. It renders tagged templates to HTML
5
- * strings for build-time/static use cases, not live browser bindings.
6
- */
7
- export interface StaticResult {
8
- toString(): string;
9
- __staticResult: true;
10
- }
11
- export interface RawHtml {
12
- value: string;
13
- __raw: true;
14
- }
15
- export declare function staticHtml(strings: TemplateStringsArray, ...values: unknown[]): StaticResult;
16
- export declare function raw(value: string): RawHtml;
17
- export declare function renderToString(value: unknown): string;
@@ -1,66 +0,0 @@
1
- /**
2
- * Static HTML renderer for Nisli-style templates.
3
- *
4
- * This module is intentionally DOM-free. It renders tagged templates to HTML
5
- * strings for build-time/static use cases, not live browser bindings.
6
- */
7
- const ESCAPE_MAP = {
8
- '&': '&amp;',
9
- '<': '&lt;',
10
- '>': '&gt;',
11
- '"': '&quot;',
12
- "'": '&#39;',
13
- };
14
- function escapeHtml(value) {
15
- return value.replace(/[&<>"']/g, ch => ESCAPE_MAP[ch] ?? ch);
16
- }
17
- function isStaticResult(value) {
18
- return (typeof value === 'object' &&
19
- value !== null &&
20
- '__staticResult' in value &&
21
- value.__staticResult === true &&
22
- typeof value.toString === 'function');
23
- }
24
- function isRawHtml(value) {
25
- return (typeof value === 'object' &&
26
- value !== null &&
27
- '__raw' in value &&
28
- value.__raw === true &&
29
- typeof value.value === 'string');
30
- }
31
- export function staticHtml(strings, ...values) {
32
- const result = [];
33
- for (let i = 0; i < strings.length; i++) {
34
- result.push(strings[i] ?? '');
35
- if (i < values.length) {
36
- result.push(renderToString(values[i]));
37
- }
38
- }
39
- const output = result.join('');
40
- return {
41
- __staticResult: true,
42
- toString: () => output,
43
- };
44
- }
45
- export function raw(value) {
46
- return {
47
- __raw: true,
48
- value,
49
- };
50
- }
51
- export function renderToString(value) {
52
- if (value == null || value === false || value === true) {
53
- return '';
54
- }
55
- if (isStaticResult(value)) {
56
- return value.toString();
57
- }
58
- if (isRawHtml(value)) {
59
- return value.value;
60
- }
61
- if (Array.isArray(value)) {
62
- return value.map(renderToString).join('');
63
- }
64
- return escapeHtml(String(value));
65
- }
66
- //# sourceMappingURL=render.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"render.js","sourceRoot":"","sources":["../../src/static/render.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAYH,MAAM,UAAU,GAA2B;IACzC,GAAG,EAAE,OAAO;IACZ,GAAG,EAAE,MAAM;IACX,GAAG,EAAE,MAAM;IACX,GAAG,EAAE,QAAQ;IACb,GAAG,EAAE,OAAO;CACb,CAAC;AAEF,SAAS,UAAU,CAAC,KAAa;IAC/B,OAAO,KAAK,CAAC,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC,EAAE,CA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