@typed/template 1.0.0-beta.0 → 1.0.0-beta.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 CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  > **Beta:** This package is in beta; APIs may change.
4
4
 
5
- `@typed/template` provides **declarative UI over Effect**: HTML literals (`html`), a stream of **RenderEvent**s, DOM and HTML rendering, hydration, and event handling. Templates are Fx streams; you provide **RenderTemplate** (e.g. **DomRenderTemplate** for the browser or **HtmlRenderTemplate** for SSR). Use it for type-safe, reactive UIs that integrate with Effect and RefSubject.
5
+ `@typed/template` provides **type-safe, reactive UIs that integrate with Effect**. It is the core UI layer for typed-smol apps: HTML literals (`html`), DOM rendering, SSR (HTML strings), hydration, event handlers with Effect, and keyed list rendering. Templates are **Fx streams** (`Fx<RenderEvent, E, R>`); you provide a `RenderTemplate` service (e.g. `DomRenderTemplate` for the browser or `HtmlRenderTemplate` for SSR).
6
6
 
7
7
  ## Dependencies
8
8
 
@@ -11,6 +11,19 @@
11
11
  - `html5parser`
12
12
  - `happy-dom` (dev)
13
13
 
14
+ ## Capabilities
15
+
16
+ - **Reactive interpolation**: Interpolate `Renderable` values—primitives, `Effect`, `Fx`/`Stream`—directly in `html` templates; updates stream through to the DOM.
17
+ - **DOM + SSR targets**: Same templates work in the browser (`DomRenderTemplate`) and on the server (`HtmlRenderTemplate`); choose the layer for your environment.
18
+ - **Hydration**: Use `makeHydrateContext` to attach to existing SSR DOM instead of creating new nodes; supports keyed lists (`many`).
19
+ - **Keyed lists**: `many(values, getKey, render)` renders reactive lists with efficient keyed diffing and per-item `RefSubject` state.
20
+ - **EventHandler with Effect**: `EventHandler.make` for type-safe event handlers that return `Effect`; supports `preventDefault`, `stopPropagation`, etc.
21
+ - **Batched render queue**: `RenderQueue` and `RenderPriority` (Sync, Raf, Idle) batch DOM updates for smoother rendering.
22
+
23
+ ## When to use
24
+
25
+ Use `@typed/template` when building Effect-based web UIs, when you need SSR + hydration, or when you want type-safe templates and event handlers. For routing, combine with `@typed/router`. For Link and SSR helpers, use `@typed/ui` on top of template.
26
+
14
27
  ## API overview
15
28
 
16
29
  - **Templates:** `html` tag; **Renderable**; **Template** module.
@@ -37,11 +50,12 @@ const Counter = Fx.gen(function* () {
37
50
  });
38
51
 
39
52
  // Inside Effect.gen(function* () { ... })
40
- yield* render(Counter, document.body).pipe(
41
- Fx.drainLayer,
42
- Layer.provide(DomRenderTemplate),
43
- Layer.launch,
44
- );
53
+ yield *
54
+ render(Counter, document.body).pipe(
55
+ Fx.drainLayer,
56
+ Layer.provide(DomRenderTemplate),
57
+ Layer.launch,
58
+ );
45
59
  ```
46
60
 
47
61
  See the [counter example](https://github.com/typed-smol/typed-smol/tree/main/examples/counter) for a full app.
@@ -50,62 +64,61 @@ See the [counter example](https://github.com/typed-smol/typed-smol/tree/main/exa
50
64
 
51
65
  ### Main entry (`@typed/template`)
52
66
 
53
- | Export | Description |
54
- |--------|-------------|
55
- | **Templates** | |
56
- | `html` | Tag function for HTML template literals; returns an `Fx<RenderEvent, E, R>`. Requires `RenderTemplate` in context. |
57
- | `many(values, getKey, render)` | Renders a reactive list with keyed diffing; `values` is an `Fx<ReadonlyArray<A>>`, `getKey` maps items to keys, `render(ref, key)` returns an Fx of RenderEvents. |
58
- | **RenderEvent** | |
59
- | `RenderEvent` | Union of `DomRenderEvent` and `HtmlRenderEvent`. |
60
- | `DomRenderEvent(content)` | Constructor for a DOM render result; `content` is `Rendered` (from `Wire`). |
61
- | `HtmlRenderEvent(html, last)` | Constructor for an HTML-string render result; `last` indicates final chunk. |
62
- | `isRenderEvent`, `isDomRenderEvent`, `isHtmlRenderEvent` | Type guards for `RenderEvent` variants. |
63
- | **Renderable** | |
64
- | `Renderable<A, E, R>` | Type of values that can be interpolated: primitives, arrays, `Effect`, `Fx`/`Stream`, objects. `Renderable.Any`, `Renderable.Services`, `Renderable.Error`, `Renderable.Success` for type-level helpers. |
65
- | **EventHandler** (`EventHandler` namespace) | |
66
- | `EventHandler.make(handler, options?)` | Creates an event handler; `handler` can return `void` or `Effect`; `options` can include `preventDefault`, `stopPropagation`, `once`, `passive`, etc. |
67
- | `EventHandler.provide`, `EventHandler.catchCause` | Provide services or recover from errors. |
68
- | `EventHandler.preventDefault`, `stopPropagation`, `stopImmediatePropagation`, `once`, `passive` | Combinators that add listener options. |
69
- | `EventHandler.fromEffectOrEventHandler`, `EventHandler.isEventHandler` | Coerce from Effect or check type. |
70
- | **EventSource** | |
71
- | `makeEventSource()` | Creates an `EventSource` with `addEventListener` and `setup(rendered, scope)`. |
72
- | **Hydration** | |
73
- | `HydrateContext` | Service tag for hydration context (internal shape). |
74
- | `makeHydrateContext(rootElement)` | Builds a service map with hydration context for the given root element. |
75
- | **Parser** | |
76
- | `parse(template)` | Parses a `TemplateStringsArray` (or readonly string array) into a `Template.Template`. |
77
- | **RenderTemplate** | |
78
- | `RenderTemplate` | Service that implements template rendering; callable as `(templateStrings, values) => Fx<RenderEvent, E, R>`. |
79
- | **Template** | |
80
- | `Template` (namespace) | `Template` class (nodes, hash, parts), part/element node types (`NodePart`, `AttrPartNode`, `EventPartNode`, etc.), and AST node types. |
81
- | **HtmlChunk** | |
82
- | `HtmlChunk`, `HtmlTextChunk`, `HtmlPartChunk`, `HtmlSparsePartChunk` | Types for pre-compiled HTML chunks. |
83
- | `templateToHtmlChunks(template)`, `addTemplateHash(chunks, template)` | Build chunks from a parsed template; add hash comments for hydration. |
84
- | **Wire** | |
85
- | `Wire`, `Rendered` | Wire is a persistent fragment-like type; `Rendered` is the DOM output type. `persistent(document, templateHash, fragment)`, `toHtml(rendered)`, and internal helpers. |
86
- | **RenderQueue** | |
87
- | `RenderQueue` (abstract), `MixedRenderQueue`, `RenderPriority` | Queue for batched DOM updates; priorities like `RenderPriority.Sync`, `RenderPriority.Raf(n)`, `RenderPriority.Idle(n)`. |
67
+ | Export | Description |
68
+ | ----------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
69
+ | **Templates** | |
70
+ | `html` | Tag function for HTML template literals; returns an `Fx<RenderEvent, E, R>`. Requires `RenderTemplate` in context. |
71
+ | `many(values, getKey, render)` | Renders a reactive list with keyed diffing; `values` is an `Fx<ReadonlyArray<A>>`, `getKey` maps items to keys, `render(ref, key)` returns an Fx of RenderEvents. |
72
+ | **RenderEvent** | |
73
+ | `RenderEvent` | Union of `DomRenderEvent` and `HtmlRenderEvent`. |
74
+ | `DomRenderEvent(content)` | Constructor for a DOM render result; `content` is `Rendered` (from `Wire`). |
75
+ | `HtmlRenderEvent(html, last)` | Constructor for an HTML-string render result; `last` indicates final chunk. |
76
+ | `isRenderEvent`, `isDomRenderEvent`, `isHtmlRenderEvent` | Type guards for `RenderEvent` variants. |
77
+ | **Renderable** | |
78
+ | `Renderable<A, E, R>` | Type of values that can be interpolated: primitives, arrays, `Effect`, `Fx`/`Stream`, objects. `Renderable.Any`, `Renderable.Services`, `Renderable.Error`, `Renderable.Success` for type-level helpers. |
79
+ | **EventHandler** (`EventHandler` namespace) | |
80
+ | `EventHandler.make(handler, options?)` | Creates an event handler; `handler` can return `void` or `Effect`; `options` can include `preventDefault`, `stopPropagation`, `once`, `passive`, etc. |
81
+ | `EventHandler.provide`, `EventHandler.catchCause` | Provide services or recover from errors. |
82
+ | `EventHandler.preventDefault`, `stopPropagation`, `stopImmediatePropagation`, `once`, `passive` | Combinators that add listener options. |
83
+ | `EventHandler.fromEffectOrEventHandler`, `EventHandler.isEventHandler` | Coerce from Effect or check type. |
84
+ | **EventSource** | |
85
+ | `makeEventSource()` | Creates an `EventSource` with `addEventListener` and `setup(rendered, scope)`. |
86
+ | **Hydration** | |
87
+ | `HydrateContext` | Service tag for hydration context (internal shape). |
88
+ | `makeHydrateContext(rootElement)` | Builds a service map with hydration context for the given root element. |
89
+ | **Parser** | |
90
+ | `parse(template)` | Parses a `TemplateStringsArray` (or readonly string array) into a `Template.Template`. |
91
+ | **RenderTemplate** | |
92
+ | `RenderTemplate` | Service that implements template rendering; callable as `(templateStrings, values) => Fx<RenderEvent, E, R>`. |
93
+ | **Template** | |
94
+ | `Template` (namespace) | `Template` class (nodes, hash, parts), part/element node types (`NodePart`, `AttrPartNode`, `EventPartNode`, etc.), and AST node types. |
95
+ | **HtmlChunk** | |
96
+ | `HtmlChunk`, `HtmlTextChunk`, `HtmlPartChunk`, `HtmlSparsePartChunk` | Types for pre-compiled HTML chunks. |
97
+ | `templateToHtmlChunks(template)`, `addTemplateHash(chunks, template)` | Build chunks from a parsed template; add hash comments for hydration. |
98
+ | **Wire** | |
99
+ | `Wire`, `Rendered` | Wire is a persistent fragment-like type; `Rendered` is the DOM output type. `persistent(document, templateHash, fragment)`, `toHtml(rendered)`, and internal helpers. |
100
+ | **RenderQueue** | |
101
+ | `RenderQueue` (abstract), `MixedRenderQueue`, `RenderPriority` | Queue for batched DOM updates; priorities like `RenderPriority.Sync`, `RenderPriority.Raf(n)`, `RenderPriority.Idle(n)`. |
88
102
 
89
103
  ### `@typed/template/Render`
90
104
 
91
- | Export | Description |
92
- |--------|-------------|
105
+ | Export | Description |
106
+ | ----------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------- |
93
107
  | `render(fx, where)` / `render(where)(fx)` | Mounts an Fx of `RenderEvent`s into the DOM element `where`; provides `HydrateContext` from `where`. Returns Fx of rendered DOM. |
94
- | `DomRenderTemplate` | Layer providing DOM-based `RenderTemplate`. `DomRenderTemplate.using(document)` for a custom document. |
95
- | `CurrentRenderDocument` | Service reference for the `Document` used when rendering (default: global `document`). |
96
- | `CurrentRenderQueue` | Service reference for the render queue (default: `MixedRenderQueue`). |
97
- | `CurrentRenderPriority` | Service reference for default task priority (default: `RenderPriority.Raf(10)`). |
98
- | `ToRendered<T>` | Type: rendered DOM for `RenderEvent` or `null`. |
99
- | `attemptHydration(ctx, hash)` | Internal helper for hydration. |
100
- | `TemplateContext` | Internal render context type. |
108
+ | `DomRenderTemplate` | Layer providing DOM-based `RenderTemplate`. `DomRenderTemplate.using(document)` for a custom document. |
109
+ | `CurrentRenderDocument` | Service reference for the `Document` used when rendering (default: global `document`). |
110
+ | `CurrentRenderQueue` | Service reference for the render queue (default: `MixedRenderQueue`). |
111
+ | `CurrentRenderPriority` | Service reference for default task priority (default: `RenderPriority.Raf(10)`). |
112
+ | `ToRendered<T>` | Type: rendered DOM for `RenderEvent` or `null`. |
113
+ | `attemptHydration(ctx, hash)` | Internal helper for hydration. |
114
+ | `TemplateContext` | Internal render context type. |
101
115
 
102
116
  ### `@typed/template/Html`
103
117
 
104
- | Export | Description |
105
- |--------|-------------|
106
- | `renderToHtml(fx)` | Converts an Fx of `RenderEvent`s into an Fx of HTML strings (for SSR). |
107
- | `renderToHtmlString(fx)` | Effect that collects `renderToHtml` output and joins into a single string. |
108
- | `HtmlRenderTemplate` | Layer providing HTML-string `RenderTemplate` (for SSR). |
109
- | `StaticHtmlRenderTemplate` | Like `HtmlRenderTemplate` with static rendering optimizations. |
110
- | `StaticRendering` | Service reference (boolean) for static rendering mode. |
111
-
118
+ | Export | Description |
119
+ | -------------------------- | -------------------------------------------------------------------------- |
120
+ | `renderToHtml(fx)` | Converts an Fx of `RenderEvent`s into an Fx of HTML strings (for SSR). |
121
+ | `renderToHtmlString(fx)` | Effect that collects `renderToHtml` output and joins into a single string. |
122
+ | `HtmlRenderTemplate` | Layer providing HTML-string `RenderTemplate` (for SSR). |
123
+ | `StaticHtmlRenderTemplate` | Like `HtmlRenderTemplate` with static rendering optimizations. |
124
+ | `StaticRendering` | Service reference (boolean) for static rendering mode. |
@@ -1 +1 @@
1
- {"version":3,"file":"RenderQueue.d.ts","sourceRoot":"","sources":["../src/RenderQueue.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,iBAAiB,gCAAgC,CAAC;AAC/D,MAAM,MAAM,iBAAiB,GAAG,OAAO,iBAAiB,CAAC;AAEzD,KAAK,KAAK,GAAG;IAAE,IAAI,EAAE,MAAM,IAAI,CAAC;IAAC,OA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,IAAI,GAAG,UAAU;CAMvE;AAED;;;GAGG;AACH,qBAAa,8BAA+B,SAAQ,WAAW;IAC7D,SAAS,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC,QAAQ,EAAE,YAAY,KAAK,IAAI,GAAG,UAAU;CAIvE;AAID;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,qBAAa,gBAAiB,SAAQ,WAAW;IAC/C,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAc;IACnC,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAc;IAClC,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAc;gBAEtB,eAAe,GAAE,MAAiC;IAa9D,SAAkB,GAAG,GACnB,KAAK,OAAO,EACZ,MAAM,MAAM,IAAI,EAChB,SAAS,MAAM,IAAI,EACnB,UAAU,MAAM,KACf,UAAU,CAWX;IAGF,SAAS,CAAC,QAAQ,IAAI,UAAU;IAIvB,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,MAAM,IAAI,CAInC;CACH;AAID;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,cAAc;IACzB;;OAEG;;IAEH;;;OAGG;6BACa,MAAM;IACtB;;OAEG;8BACc,MAAM;CACf,CAAC;AA2BX,KAAK,mBAAmB,CAAC,CAAC,IAAI,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC"}
@@ -38,6 +38,7 @@ export class RenderQueue {
38
38
  * @returns A Disposable that can be used to cancel the task.
39
39
  */
40
40
  add = (key, task, dispose, priority) => {
41
+ // Disposable is available under the "es2022" or later lib in tsconfig.json (e.g., "lib": ["es2022"])
41
42
  insert(this.buckets, priority, key, { task, dispose }, (entry) => entry.dispose());
42
43
  this.scheduleNext();
43
44
  return disposable(() => remove(this.buckets, priority, key));
package/package.json CHANGED
@@ -1,9 +1,6 @@
1
1
  {
2
2
  "name": "@typed/template",
3
- "version": "1.0.0-beta.0",
4
- "publishConfig": {
5
- "access": "public"
6
- },
3
+ "version": "1.0.0-beta.1",
7
4
  "type": "module",
8
5
  "exports": {
9
6
  ".": {
@@ -15,18 +12,25 @@
15
12
  "import": "./dist/*.js"
16
13
  }
17
14
  },
15
+ "publishConfig": {
16
+ "access": "public"
17
+ },
18
+ "scripts": {
19
+ "build": "[ -d dist ] || rm -f tsconfig.tsbuildinfo; tsc",
20
+ "test": "vitest run --passWithNoTests"
21
+ },
18
22
  "dependencies": {
19
- "effect": "4.0.0-beta.4",
20
- "html5parser": "2.0.2",
21
- "@typed/fx": "2.0.0-beta.0"
23
+ "@typed/fx": "workspace:*",
24
+ "effect": "catalog:",
25
+ "html5parser": "2.0.2"
22
26
  },
23
27
  "devDependencies": {
24
- "happy-dom": "*",
25
- "typescript": "5.9.3",
26
- "vitest": "4.0.18"
28
+ "happy-dom": "catalog:",
29
+ "typescript": "catalog:",
30
+ "vitest": "catalog:"
27
31
  },
28
- "scripts": {
29
- "build": "tsc",
30
- "test": "vitest run --passWithNoTests"
31
- }
32
- }
32
+ "files": [
33
+ "dist",
34
+ "src"
35
+ ]
36
+ }
@@ -1,5 +1,4 @@
1
- import assert from "node:assert";
2
- import { describe, it } from "vitest";
1
+ import { assert, describe, it } from "vitest";
3
2
  import type { Scope } from "effect";
4
3
  import { Effect } from "effect";
5
4
  import { Fx } from "@typed/fx";
@@ -1,8 +1,7 @@
1
- import { deepEqual, deepStrictEqual } from "assert";
1
+ import { assert, describe, expect, it } from "vitest";
2
2
  import { templateHash } from "./internal/templateHash.js";
3
3
  import * as Parser from "./Parser.js";
4
4
  import * as Template from "./Template.js";
5
- import { describe, expect, it } from "vitest";
6
5
 
7
6
  describe("Parser", () => {
8
7
  it("parses a simple template", () => {
@@ -82,7 +81,7 @@ describe("Parser", () => {
82
81
  const expected = new Template.Template([div], templateHash(template), [[sparse, [0]]]);
83
82
  const actual = Parser.parse(template);
84
83
 
85
- deepStrictEqual(actual, expected);
84
+ assert.deepStrictEqual(actual, expected);
86
85
  });
87
86
 
88
87
  it("parses boolean attributes", () => {
@@ -528,7 +527,7 @@ describe("Parser", () => {
528
527
  [],
529
528
  );
530
529
 
531
- deepStrictEqual(Parser.parse(template), expected);
530
+ assert.deepStrictEqual(Parser.parse(template), expected);
532
531
  });
533
532
 
534
533
  it("parses templates with spread props", () => {
@@ -540,7 +539,7 @@ describe("Parser", () => {
540
539
  [[props, [0]]],
541
540
  );
542
541
 
543
- deepStrictEqual(Parser.parse(template), expected);
542
+ assert.deepStrictEqual(Parser.parse(template), expected);
544
543
  });
545
544
 
546
545
  it("parses large svg templates", () => {
@@ -835,7 +834,7 @@ c192 -183 322 -427 380 -715 22 -107 22 -146 -10 -621 -11 -164 0 -383 25
835
834
  [],
836
835
  );
837
836
 
838
- deepEqual(actual, expected);
837
+ assert.deepEqual(actual, expected);
839
838
 
840
839
  const iterations = 1000;
841
840
  let totalTime = 0;
@@ -1,5 +1,4 @@
1
- import assert from "node:assert";
2
- import { describe, it } from "vitest";
1
+ import { assert, describe, it } from "vitest";
3
2
  import type { Scope } from "effect";
4
3
  import { Effect } from "effect";
5
4
  import { Fx } from "@typed/fx";
@@ -50,6 +50,7 @@ export abstract class RenderQueue implements Disposable {
50
50
  dispose: () => void,
51
51
  priority: number,
52
52
  ) => Disposable = (key, task, dispose, priority) => {
53
+ // Disposable is available under the "es2022" or later lib in tsconfig.json (e.g., "lib": ["es2022"])
53
54
  insert(this.buckets, priority, key, { task, dispose }, (entry) => entry.dispose());
54
55
  this.scheduleNext();
55
56
  return disposable(() => remove(this.buckets, priority, key));
package/tsconfig.json DELETED
@@ -1,6 +0,0 @@
1
- {
2
- "extends": "../../tsconfig.base.json",
3
- "compilerOptions": { "rootDir": "src", "outDir": "dist" },
4
- "include": ["src"],
5
- "exclude": ["**/*.test.ts"]
6
- }