solid-tag-runtime 0.0.8 → 0.0.9

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/ARCHITECTURE.md CHANGED
@@ -42,7 +42,9 @@ The runtime should allow applications to:
42
42
  9. observe runtime lifecycle transitions for tooling/tracing
43
43
  10. inspect dependencies and compiled source
44
44
  11. support normal JavaScript modules in the same graph
45
- 12. keep the JSX compiler replaceable behind a narrow adapter
45
+ 12. declaratively mount runtime component exports through the HTML adapter
46
+ 13. reuse existing runtime modules through a light-DOM `solid-render` custom element
47
+ 14. keep the JSX compiler replaceable behind a narrow adapter
46
48
 
47
49
  ## 3. Current non-goals
48
50
 
@@ -1144,3 +1146,53 @@ Implementation note: core and HTML event streams share a small internal dispatch
1144
1146
 
1145
1147
  Regression coverage: package tests cover catch-all, single-type, and multi-type subscriptions; independent unsubscribe; listener exception isolation; update/batch events; resolution/link/evaluation ordering and payloads; structured resolution errors; HTML ownership origins; observer connect/disconnect/batch events; root and append-target events; external source loading; entry execution; update/removal events; HTML error reporting; and HTML subscriber exception isolation.
1146
1148
 
1149
+
1150
+
1151
+ ### 0.0.9 — shared declarative rendering and `solid-render`
1152
+
1153
+ Decision: rendering remains entirely inside `solid-tag-runtime/html`. The core runtime still owns module identity, resolution, linking, execution, caching, invalidation, and host-module injection; it has no DOM or component-mounting responsibility.
1154
+
1155
+ Two public rendering forms now share one internal rendering core:
1156
+
1157
+ ```text
1158
+ <script module render>
1159
+ define source + mount one component instance
1160
+
1161
+ <solid-render module>
1162
+ reference an existing module + mount one component instance
1163
+ ```
1164
+
1165
+ Declarative script rendering follows these invariants:
1166
+
1167
+ - `render="#selector"` imports the module, selects `default` unless `component="Name"` is present, and uses normal Solid container rendering.
1168
+ - bare `render` replaces the declaration with start/end comment markers and mounts with positional insertion before the end marker; no wrapper element is introduced.
1169
+ - every discovered module in a batch is defined before any `entry` or render action executes.
1170
+ - `entry` and `render` on the same declaration are rejected as ambiguous.
1171
+ - anonymous `render` declarations receive internal runtime IDs just like anonymous entries.
1172
+ - render ownership/disposal is stored on the HTML declaration record and remains separate from module lifetime.
1173
+ - `updateElement()` remounts a rendered declaration after source/component/render metadata changes while preserving the same logical module identity.
1174
+ - `removeElement()` disposes mounted UI before releasing declaration/module ownership.
1175
+ - observer-discovered render declarations use the same batch/ownership pipeline as ordinary declarations.
1176
+
1177
+ The shared render adapter lazily resolves the host application's own `solid-js` and `@solidjs/web` modules through the runtime (with `solid-js/web` as a compatibility fallback). This preserves the no-duplicate-Solid invariant and keeps the HTML package free of a direct Solid dependency. Tests/special hosts may inject a render adapter.
1178
+
1179
+ `solid-render` invariants:
1180
+
1181
+ 1. It references an existing runtime module; it never defines source.
1182
+ 2. Missing `component` means `namespace.default`; `component="Name"` selects a named export.
1183
+ 3. `data-solid-runtime` selects the HTML runtime through the shared controller registry. With no attribute, a single unambiguous controller may be used.
1184
+ 4. The element remains in the DOM and is the light-DOM mount container. Wrapperless rendering belongs to bare `<script render>`.
1185
+ 5. Renderer configuration (`module`, `component`, `data-solid-runtime`) is never forwarded as component props.
1186
+ 6. Declarative props use `prop:*`; kebab names normalize to camelCase. Empty/presence values are boolean `true`, other values remain strings.
1187
+ 7. `.props` carries arbitrary JavaScript references and overrides declarative props.
1188
+ 8. Prop changes update a reactive prop facade and do not remount the component, preserving local state.
1189
+ 9. Module/component/runtime identity changes increment a generation token, dispose the current owner, and remount. Stale async import successes and failures are ignored; they cannot mount or report an error against a newer identity.
1190
+ 10. Initial light-DOM child nodes are captured once and exposed as reusable `props.children`; named slots and dynamic child recapture are not part of this phase.
1191
+ 11. Multiple elements may share one evaluated module namespace while owning independent Solid component roots.
1192
+ 12. Disconnect disposes the mounted root; reconnect mounts a fresh component instance from the retained declaration inputs.
1193
+ 13. Custom-element registration is global/idempotent per `CustomElementRegistry`. `createHTMLRuntime()` registers it after installing the controller in the shared registry; registration/observation paths remain idempotent. `registerSolidRenderElement()` remains available for explicit/custom-registry use.
1194
+ 14. Runtime/controller disposal tears down both script-owned mounts and connected `solid-render` instances so no Solid owners are orphaned.
1195
+
1196
+ Rendering lifecycle joins the existing HTML event stream through `render-mounting`, `render-mounted`, `render-disposing`, and `render-disposed`; failures are also reported through `html-error` with `render`/`solid-render` operations. Lifecycle subscriptions remain observational and cannot alter rendering.
1197
+
1198
+ The first `solid-render` phase intentionally excludes named slots, Shadow DOM, automatic numeric/JSON coercion, arbitrary unprefixed prop forwarding, loading/fallback templates, and expression evaluation inside attributes.
package/README.md CHANGED
@@ -107,8 +107,8 @@ Browser import maps must map the subpath explicitly as well as the package root:
107
107
  ```json
108
108
  {
109
109
  "imports": {
110
- "solid-tag-runtime": "https://esm.sh/solid-tag-runtime@0.0.8",
111
- "solid-tag-runtime/html": "https://esm.sh/solid-tag-runtime@0.0.8/html"
110
+ "solid-tag-runtime": "https://esm.sh/solid-tag-runtime@0.0.9",
111
+ "solid-tag-runtime/html": "https://esm.sh/solid-tag-runtime@0.0.9/html"
112
112
  }
113
113
  }
114
114
  ```
@@ -138,6 +138,155 @@ await html.register();
138
138
  await html.observe({ registerExisting: false });
139
139
  ```
140
140
 
141
+
142
+ ## Render runtime UI
143
+
144
+ `solid-tag-runtime/html` can now mount component exports as an HTML-adapter concern while the core runtime remains DOM-independent.
145
+
146
+ There are two complementary forms:
147
+
148
+ ```text
149
+ <script module>
150
+ define a runtime module
151
+
152
+ <script module render>
153
+ define a module + mount one instance
154
+
155
+ <solid-render module>
156
+ reference an existing module + mount one instance
157
+ ```
158
+
159
+ ### Define and render in one declaration
160
+
161
+ Render the default export into a normal Solid container:
162
+
163
+ ```html
164
+ <div id="app"></div>
165
+
166
+ <script
167
+ type="solid-jsx"
168
+ data-solid-runtime="main"
169
+ module="/App.jsx"
170
+ render="#app"
171
+ >
172
+ export default function App() {
173
+ return <h1>Hello from runtime JSX</h1>;
174
+ }
175
+ </script>
176
+ ```
177
+
178
+ `render` defaults to `module.default`. Select a named export with `component`:
179
+
180
+ ```html
181
+ <script
182
+ type="solid-jsx"
183
+ module="/widgets.jsx"
184
+ render="#app"
185
+ component="Counter"
186
+ >
187
+ export function Counter() {
188
+ return <button>Counter</button>;
189
+ }
190
+ </script>
191
+ ```
192
+
193
+ Bare `render` mounts at the declaration's exact sibling position without adding a wrapper:
194
+
195
+ ```html
196
+ <p>Before</p>
197
+
198
+ <script type="solid-jsx" module="/Message.jsx" render>
199
+ export default function Message() {
200
+ return <strong>Hello</strong>;
201
+ }
202
+ </script>
203
+
204
+ <p>After</p>
205
+ ```
206
+
207
+ The adapter replaces the declaration with an owned start/end marker range and inserts the component between the markers. The module definition and mount lifecycle remain separate: removing the declaration through `html.removeElement()` disposes the Solid owner while module removal follows the existing lifecycle options.
208
+
209
+ `entry` and `render` are intentionally mutually exclusive on one declaration. Use separate declarations when a side-effect entry and a mounted component are both needed.
210
+
211
+ All matching modules in one scan/observer batch are defined before any `entry` or `render` action executes, so a render declaration may import a dependency declared later in the same batch.
212
+
213
+ ### Reuse an existing module with `<solid-render>`
214
+
215
+ `<solid-render>` references an already-defined module and remains as the light-DOM mount container:
216
+
217
+ ```html
218
+ <solid-render
219
+ data-solid-runtime="main"
220
+ module="/Counter.jsx"
221
+ ></solid-render>
222
+ ```
223
+
224
+ Named export:
225
+
226
+ ```html
227
+ <solid-render
228
+ data-solid-runtime="main"
229
+ module="/widgets.jsx"
230
+ component="Counter"
231
+ ></solid-render>
232
+ ```
233
+
234
+ Component props use an explicit namespace so renderer configuration can never collide with component prop names:
235
+
236
+ ```html
237
+ <solid-render
238
+ module="/UserCard.jsx"
239
+ prop:name="Alice"
240
+ prop:module="billing"
241
+ prop:compact
242
+ ></solid-render>
243
+ ```
244
+
245
+ Declarative values are conservative:
246
+
247
+ ```text
248
+ prop:name="Alice" → "Alice"
249
+ prop:compact → true
250
+ prop:count="42" → "42"
251
+ ```
252
+
253
+ Kebab-case prop names normalize to camelCase (`prop:user-id` → `userId`). Arbitrary JavaScript references use the `.props` property:
254
+
255
+ ```ts
256
+ const renderer = document.querySelector("solid-render");
257
+
258
+ renderer.props = {
259
+ user,
260
+ onSave,
261
+ service,
262
+ };
263
+ ```
264
+
265
+ Programmatic props override `prop:*` attributes. Prop changes update the existing component instance reactively and preserve local Solid state. Changes to `module`, `component`, or `data-solid-runtime` dispose the current component and mount a new identity.
266
+
267
+ Initial light-DOM children become `props.children`:
268
+
269
+ ```html
270
+ <solid-render module="/Card.jsx" prop:title="Profile">
271
+ <p>Hello from HTML.</p>
272
+ <solid-render module="/SaveButton.jsx"></solid-render>
273
+ </solid-render>
274
+ ```
275
+
276
+ The first implementation deliberately has no named-slot system and no Shadow DOM. Nested `<solid-render>` elements work through normal custom-element connection when captured children are instantiated.
277
+
278
+ `createHTMLRuntime()` ensures the custom element is registered globally once after the controller has entered the shared runtime registry. `registerHTML()` / `observeHTML()` keep the same idempotent guarantee. Most applications therefore do not need to call a registration helper directly.
279
+
280
+ For custom registries, tests, or explicit registration, the helper remains available:
281
+
282
+ ```ts
283
+ import { registerSolidRenderElement } from "solid-tag-runtime/html";
284
+
285
+ registerSolidRenderElement();
286
+ ```
287
+
288
+ Multiple `<solid-render>` elements may share one cached runtime module namespace while each mounted component owns independent Solid state. Async module changes are generation-guarded so a stale import can never replace a newer `module`/`component`/runtime selection.
289
+
141
290
  A scope is written to owned script elements as:
142
291
 
143
292
  ```html
@@ -689,12 +838,17 @@ append-target-changed
689
838
  entry-executing
690
839
  entry-executed
691
840
 
841
+ render-mounting
842
+ render-mounted
843
+ render-disposing
844
+ render-disposed
845
+
692
846
  html-error
693
847
  ```
694
848
 
695
849
  Ownership-related events include an `origin` describing how the element entered the controller (`observer`, `append`, `register-element`, `add-module`, and related internal scan origins). This is useful for tracing observer/manual-registration races and proving that an explicit `append()` was not processed a second time by the observer.
696
850
 
697
- `observer-batch` summarizes a DOM discovery pass instead of exposing noisy raw `MutationRecord` objects. `element-loading` / `element-loaded` are emitted for `src`-backed modules, and entry events distinguish evaluation caused by an HTML `entry` declaration from an ordinary `runtime.import()`.
851
+ `observer-batch` summarizes a DOM discovery pass instead of exposing noisy raw `MutationRecord` objects. `element-loading` / `element-loaded` are emitted for `src`-backed modules, and entry events distinguish evaluation caused by an HTML `entry` declaration from an ordinary `runtime.import()`. Render events cover both `<script render>` and `<solid-render>`; `source` identifies `script-render` versus `solid-render`, and `mode` identifies selector, in-place, or container mounting.
698
852
 
699
853
  Like core runtime subscribers, HTML subscribers are observational and exception-isolated.
700
854
 
package/html.d.ts CHANGED
@@ -1,17 +1,31 @@
1
1
  import { SolidTagRuntimeError } from "./index.js";
2
2
  import type { ModuleFormat, ModuleNamespaceLike, SolidTagRuntime } from "./index.js";
3
3
 
4
- export interface HTMLModuleScriptElement {
4
+ export interface HTMLAttributeElementLike {
5
5
  textContent?: string | null;
6
6
  baseURI?: string;
7
7
  ownerDocument?: HTMLDocumentLike | null;
8
- parentNode?: { removeChild?(element: any): unknown } | null;
8
+ parentNode?: {
9
+ removeChild?(element: any): unknown;
10
+ insertBefore?(element: any, reference: any): unknown;
11
+ } | null;
9
12
  remove?(): void;
13
+ replaceWith?(...nodes: any[]): void;
10
14
  getAttribute(name: string): string | null;
11
15
  hasAttribute?(name: string): boolean;
12
16
  setAttribute?(name: string, value: string): void;
13
17
  }
14
18
 
19
+ export interface HTMLModuleScriptElement extends HTMLAttributeElementLike {}
20
+
21
+ export interface SolidRenderElement extends HTMLAttributeElementLike, HTMLAppendTarget {
22
+ props: Record<string, unknown>;
23
+ childNodes?: ArrayLike<any> | Iterable<any>;
24
+ attributes?: ArrayLike<{ name: string; value: string }> | Iterable<{ name: string; value: string }>;
25
+ replaceChildren?(...nodes: any[]): void;
26
+ dispatchEvent?(event: unknown): boolean;
27
+ }
28
+
15
29
  export interface HTMLAppendTarget {
16
30
  append?(...nodes: any[]): void;
17
31
  appendChild?(element: any): unknown;
@@ -21,6 +35,8 @@ export interface HTMLDocumentLike extends HTMLModuleRoot, HTMLAppendTarget {
21
35
  body?: HTMLAppendTarget;
22
36
  documentElement?: HTMLAppendTarget;
23
37
  createElement?(tagName: string): any;
38
+ createComment?(data: string): any;
39
+ createDocumentFragment?(): any;
24
40
  }
25
41
 
26
42
  export interface HTMLModuleRoot {
@@ -28,7 +44,9 @@ export interface HTMLModuleRoot {
28
44
  ownerDocument?: HTMLDocumentLike | null;
29
45
  body?: HTMLAppendTarget;
30
46
  documentElement?: HTMLAppendTarget;
31
- querySelectorAll(selector: string): Iterable<HTMLModuleScriptElement> | ArrayLike<HTMLModuleScriptElement>;
47
+ querySelectorAll(selector: string): Iterable<any> | ArrayLike<any>;
48
+ querySelector?(selector: string): any;
49
+ contains?(node: any): boolean;
32
50
  }
33
51
 
34
52
  export interface HTMLFetchResponse {
@@ -44,8 +62,9 @@ export interface HTMLMutationObserverLike {
44
62
  observe(
45
63
  target: unknown,
46
64
  options: {
47
- childList: boolean;
48
- subtree: boolean;
65
+ childList?: boolean;
66
+ subtree?: boolean;
67
+ attributes?: boolean;
49
68
  },
50
69
  ): void;
51
70
  disconnect(): void;
@@ -53,12 +72,44 @@ export interface HTMLMutationObserverLike {
53
72
 
54
73
  export interface HTMLMutationObserverConstructor {
55
74
  new (
56
- callback: (...args: unknown[]) => void,
75
+ callback: (...args: any[]) => void,
57
76
  ): HTMLMutationObserverLike;
58
77
  }
59
78
 
79
+ export interface HTMLMountRecord {
80
+ kind?: "container" | "range" | string;
81
+ target?: unknown;
82
+ updateProps?(props: Record<string, unknown>): void;
83
+ dispose?(): void | Promise<void>;
84
+ }
85
+
86
+ export interface HTMLRenderAdapter {
87
+ mountContainer(options: {
88
+ runtime: SolidTagRuntime;
89
+ target: any;
90
+ Component: Function;
91
+ props: Record<string, unknown>;
92
+ element?: HTMLAttributeElementLike | SolidRenderElement;
93
+ moduleId?: string;
94
+ }): HTMLMountRecord | Promise<HTMLMountRecord>;
95
+
96
+ mountRange(options: {
97
+ runtime: SolidTagRuntime;
98
+ parent: any;
99
+ before: any;
100
+ startMarker: any;
101
+ endMarker: any;
102
+ Component: Function;
103
+ props: Record<string, unknown>;
104
+ element?: HTMLModuleScriptElement;
105
+ moduleId?: string;
106
+ }): HTMLMountRecord | Promise<HTMLMountRecord>;
107
+ }
108
+
60
109
  export interface DefineScriptOptions {
61
110
  root?: HTMLModuleRoot;
111
+ /** Optional selector-resolution root for declarative render="...". */
112
+ renderRoot?: HTMLModuleRoot;
62
113
  baseUrl?: string;
63
114
  format?: ModuleFormat | "javascript";
64
115
  fetch?: HTMLFetch;
@@ -72,15 +123,28 @@ export interface HTMLModuleDefinition {
72
123
  id: string;
73
124
  format: ModuleFormat;
74
125
  entry: boolean;
126
+ /** undefined = no render, true = in-place, string = selector target. */
127
+ render?: true | string;
128
+ /** Named component export. Missing means default export. */
129
+ component?: string;
75
130
  sourceUrl?: string;
76
131
  inline: boolean;
77
132
  element: HTMLModuleScriptElement;
78
133
  }
79
134
 
135
+ export interface HTMLRenderedModule {
136
+ id: string;
137
+ namespace: ModuleNamespaceLike;
138
+ component: string;
139
+ mode: "selector" | "in-place";
140
+ target?: unknown;
141
+ element: HTMLModuleScriptElement;
142
+ }
143
+
80
144
  export interface RemoveHTMLElementOptions {
81
145
  /** Remove the runtime module as well as releasing HTML ownership. Default: true. */
82
146
  removeModule?: boolean;
83
- /** Remove the script element from the DOM. Default: true. */
147
+ /** Remove the script declaration/range from the DOM. Default: true. */
84
148
  removeFromDOM?: boolean;
85
149
  /** Invalidate runtime dependents when removing the module. Default: true. */
86
150
  invalidateDependents?: boolean;
@@ -96,6 +160,8 @@ export interface RemoveHTMLElementResult {
96
160
  export interface RegisterHTMLOptions extends DefineScriptOptions {
97
161
  selector?: string;
98
162
  executeEntries?: boolean;
163
+ /** Execute declarative render actions. Default: true. */
164
+ executeRenders?: boolean;
99
165
  }
100
166
 
101
167
  export interface RegisterHTMLResult {
@@ -105,6 +171,8 @@ export interface RegisterHTMLResult {
105
171
  id: string;
106
172
  namespace: ModuleNamespaceLike;
107
173
  }>;
174
+ renders: string[];
175
+ rendered: HTMLRenderedModule[];
108
176
  }
109
177
 
110
178
  export type HTMLRegistrationOrigin =
@@ -119,11 +187,15 @@ export type HTMLRegistrationOrigin =
119
187
  | "add-module"
120
188
  | "update-element"
121
189
  | "remove-element"
190
+ | "solid-render"
122
191
  | string;
123
192
 
193
+ export type HTMLRenderSource = "script-render" | "solid-render";
194
+ export type HTMLRenderMode = "selector" | "in-place" | "container";
195
+
124
196
  export type HTMLRuntimeEvent =
125
197
  | { htmlRuntimeId: string; scope?: string; timestamp: number; type: "element-discovered"; element: HTMLModuleScriptElement; moduleId?: string; origin: HTMLRegistrationOrigin; accepted: boolean }
126
- | { htmlRuntimeId: string; scope?: string; timestamp: number; type: "element-claimed"; element: HTMLModuleScriptElement; moduleId: string; format: ModuleFormat; entry: boolean; sourceUrl?: string; origin: HTMLRegistrationOrigin }
198
+ | { htmlRuntimeId: string; scope?: string; timestamp: number; type: "element-claimed"; element: HTMLModuleScriptElement; moduleId: string; format: ModuleFormat; entry: boolean; render?: true | string; component?: string; sourceUrl?: string; origin: HTMLRegistrationOrigin }
127
199
  | { htmlRuntimeId: string; scope?: string; timestamp: number; type: "element-loading"; element: HTMLModuleScriptElement; moduleId: string; sourceUrl: string; origin: HTMLRegistrationOrigin }
128
200
  | { htmlRuntimeId: string; scope?: string; timestamp: number; type: "element-loaded"; element: HTMLModuleScriptElement; moduleId: string; sourceUrl: string; origin: HTMLRegistrationOrigin; bytes: number; durationMs: number }
129
201
  | { htmlRuntimeId: string; scope?: string; timestamp: number; type: "element-registered"; element: HTMLModuleScriptElement; moduleId: string; definition: HTMLModuleDefinition; origin: HTMLRegistrationOrigin }
@@ -140,7 +212,11 @@ export type HTMLRuntimeEvent =
140
212
  | { htmlRuntimeId: string; scope?: string; timestamp: number; type: "append-target-changed"; previousTarget?: HTMLAppendTarget; target: HTMLAppendTarget }
141
213
  | { htmlRuntimeId: string; scope?: string; timestamp: number; type: "entry-executing"; element: HTMLModuleScriptElement; moduleId: string; origin: HTMLRegistrationOrigin }
142
214
  | { htmlRuntimeId: string; scope?: string; timestamp: number; type: "entry-executed"; element: HTMLModuleScriptElement; moduleId: string; namespace: ModuleNamespaceLike; origin: HTMLRegistrationOrigin }
143
- | { htmlRuntimeId: string; scope?: string; timestamp: number; type: "html-error"; operation: "discover" | "claim" | "fetch" | "register" | "update" | "remove" | "entry" | "root-change" | "observer" | string; error: unknown; element?: HTMLModuleScriptElement; moduleId?: string; origin?: HTMLRegistrationOrigin };
215
+ | { htmlRuntimeId: string; scope?: string; timestamp: number; type: "render-mounting"; element: HTMLModuleScriptElement | SolidRenderElement; moduleId?: string; component: string; mode: HTMLRenderMode; origin: HTMLRegistrationOrigin; source: HTMLRenderSource }
216
+ | { htmlRuntimeId: string; scope?: string; timestamp: number; type: "render-mounted"; element: HTMLModuleScriptElement | SolidRenderElement; moduleId?: string; component: string; mode: HTMLRenderMode; target?: unknown; origin: HTMLRegistrationOrigin; source: HTMLRenderSource }
217
+ | { htmlRuntimeId: string; scope?: string; timestamp: number; type: "render-disposing"; element: HTMLModuleScriptElement | SolidRenderElement; moduleId?: string; component: string; mode: HTMLRenderMode; reason: string; origin: HTMLRegistrationOrigin; source: HTMLRenderSource }
218
+ | { htmlRuntimeId: string; scope?: string; timestamp: number; type: "render-disposed"; element: HTMLModuleScriptElement | SolidRenderElement; moduleId?: string; component: string; mode: HTMLRenderMode; reason: string; origin: HTMLRegistrationOrigin; source: HTMLRenderSource }
219
+ | { htmlRuntimeId: string; scope?: string; timestamp: number; type: "html-error"; operation: "discover" | "claim" | "fetch" | "register" | "update" | "remove" | "entry" | "render" | "solid-render" | "root-change" | "observer" | string; error: unknown; element?: HTMLModuleScriptElement | SolidRenderElement; moduleId?: string; origin?: HTMLRegistrationOrigin };
144
220
 
145
221
  export type HTMLRuntimeEventType = HTMLRuntimeEvent["type"];
146
222
  export type HTMLRuntimeEventOfType<T extends HTMLRuntimeEventType> =
@@ -163,9 +239,12 @@ export interface AddHTMLModuleOptions extends DefineScriptOptions {
163
239
  source?: string;
164
240
  src?: string;
165
241
  entry?: boolean;
242
+ render?: true | string;
243
+ component?: string;
166
244
  type?: string;
167
245
  language?: string;
168
246
  executeEntries?: boolean;
247
+ executeRenders?: boolean;
169
248
  appendTo?: HTMLAppendTarget;
170
249
  document?: HTMLDocumentLike;
171
250
  createElement?: (tagName: string) => HTMLModuleScriptElement;
@@ -174,6 +253,8 @@ export interface AddHTMLModuleOptions extends DefineScriptOptions {
174
253
  export interface HTMLRuntimeOptions extends ObserveHTMLOptions {
175
254
  appendTo?: HTMLAppendTarget;
176
255
  createElement?: (tagName: string) => HTMLModuleScriptElement;
256
+ /** Override Solid mounting for tests/special hosts. */
257
+ renderAdapter?: HTMLRenderAdapter;
177
258
  }
178
259
 
179
260
  export interface SetHTMLRootOptions extends RegisterHTMLOptions {
@@ -190,11 +271,8 @@ export interface HTMLRuntimeController {
190
271
  readonly runtime: SolidTagRuntime;
191
272
  readonly scope?: string;
192
273
  readonly connected: boolean;
193
- /** Current configured/effective discovery root when available. */
194
274
  readonly root?: HTMLModuleRoot;
195
- /** Current effective target used by append()/addModule() when available. */
196
275
  readonly appendTarget?: HTMLAppendTarget;
197
- /** Result of the observer's initial scan. */
198
276
  readonly initial: RegisterHTMLResult;
199
277
 
200
278
  subscribe(listener: (event: HTMLRuntimeEvent) => void): () => boolean;
@@ -207,65 +285,22 @@ export interface HTMLRuntimeController {
207
285
  listener: (event: HTMLRuntimeEventOfType<T[number]>) => void,
208
286
  ): () => boolean;
209
287
 
210
- /** One-shot scan of matching scripts under the configured/root override. */
211
288
  register(options?: RegisterHTMLOptions): Promise<RegisterHTMLResult>;
212
-
213
- /** Start live addition observation. Returns this controller. */
214
289
  observe(options?: ObserveHTMLOptions): Promise<HTMLRuntimeController>;
215
-
216
- /** Wait for queued observer work and scan for newly discoverable scripts. */
217
290
  flush(options?: RegisterHTMLOptions): Promise<RegisterHTMLResult>;
218
291
  disconnect(): void;
292
+ /** Dispose HTML-owned mounts/registry state without disposing the core runtime. */
293
+ dispose(): Promise<void>;
219
294
 
220
- /**
221
- * Change the discovery/observation root. A connected observer is rebound to
222
- * the new node automatically.
223
- */
224
- setRoot(
225
- root: HTMLModuleRoot,
226
- options?: SetHTMLRootOptions,
227
- ): Promise<RegisterHTMLResult>;
228
-
229
- /** Change both the discovery root and append target to the selected root. */
230
- moveTo(
231
- root: HTMLModuleRoot,
232
- options?: SetHTMLRootOptions,
233
- ): Promise<RegisterHTMLResult>;
234
-
235
- /** Change only where append()/addModule() insert future elements. */
295
+ setRoot(root: HTMLModuleRoot, options?: SetHTMLRootOptions): Promise<RegisterHTMLResult>;
296
+ moveTo(root: HTMLModuleRoot, options?: SetHTMLRootOptions): Promise<RegisterHTMLResult>;
236
297
  setAppendTarget(target: HTMLAppendTarget): HTMLRuntimeController;
237
298
 
238
- /** Define one element without auto-running an entry. */
239
- defineElement(
240
- element: HTMLModuleScriptElement,
241
- options?: DefineScriptOptions,
242
- ): Promise<HTMLModuleDefinition>;
243
-
244
- /** Explicitly claim/register an existing element for this runtime. */
245
- registerElement(
246
- element: HTMLModuleScriptElement,
247
- options?: RegisterHTMLOptions,
248
- ): Promise<HTMLModuleDefinition>;
249
-
250
- /** Re-read and replace source for an element already owned by this controller. */
251
- updateElement(
252
- element: HTMLModuleScriptElement,
253
- options?: RegisterHTMLOptions,
254
- ): Promise<HTMLModuleDefinition>;
255
-
256
- /** Release an owned element and optionally remove its module and DOM node. */
257
- removeElement(
258
- element: HTMLModuleScriptElement,
259
- options?: RemoveHTMLElementOptions,
260
- ): Promise<RemoveHTMLElementResult>;
261
-
262
- /** Claim first, append a user-created element, then register it directly. */
263
- append(
264
- element: HTMLModuleScriptElement,
265
- options?: RegisterHTMLOptions & { appendTo?: HTMLAppendTarget },
266
- ): Promise<HTMLModuleDefinition>;
267
-
268
- /** Create a runtime script element and add it through the controller. */
299
+ defineElement(element: HTMLModuleScriptElement, options?: DefineScriptOptions): Promise<HTMLModuleDefinition>;
300
+ registerElement(element: HTMLModuleScriptElement, options?: RegisterHTMLOptions): Promise<HTMLModuleDefinition>;
301
+ updateElement(element: HTMLModuleScriptElement, options?: RegisterHTMLOptions): Promise<HTMLModuleDefinition>;
302
+ removeElement(element: HTMLModuleScriptElement, options?: RemoveHTMLElementOptions): Promise<RemoveHTMLElementResult>;
303
+ append(element: HTMLModuleScriptElement, options?: RegisterHTMLOptions & { appendTo?: HTMLAppendTarget }): Promise<HTMLModuleDefinition>;
269
304
  addModule(options: AddHTMLModuleOptions): Promise<HTMLModuleDefinition>;
270
305
 
271
306
  owns(element: HTMLModuleScriptElement): boolean;
@@ -273,7 +308,16 @@ export interface HTMLRuntimeController {
273
308
  getElement(id: string): HTMLModuleScriptElement | undefined;
274
309
  }
275
310
 
276
- /** Legacy observer shape is now the full HTML runtime controller. */
311
+ export interface CustomElementRegistryLike {
312
+ define(name: string, constructor: any): void;
313
+ get(name: string): any;
314
+ }
315
+
316
+ export interface RegisterSolidRenderElementOptions {
317
+ customElements?: CustomElementRegistryLike;
318
+ HTMLElement?: new (...args: any[]) => any;
319
+ }
320
+
277
321
  export type HTMLObserverController = HTMLRuntimeController;
278
322
 
279
323
  export declare class HTMLModuleError extends SolidTagRuntimeError {
@@ -287,6 +331,12 @@ export declare class HTMLModuleOwnershipError extends HTMLModuleError {
287
331
  requestedScope?: string;
288
332
  }
289
333
 
334
+ export declare class HTMLRenderError extends SolidTagRuntimeError {
335
+ element?: HTMLModuleScriptElement | SolidRenderElement;
336
+ moduleId?: string;
337
+ component?: string;
338
+ }
339
+
290
340
  export declare const htmlModuleSelector: string;
291
341
  export declare const htmlRuntimeScopeAttribute: "data-solid-runtime";
292
342
 
@@ -295,6 +345,10 @@ export declare function createHTMLRuntime(
295
345
  options?: HTMLRuntimeOptions,
296
346
  ): HTMLRuntimeController;
297
347
 
348
+ export declare function registerSolidRenderElement(
349
+ options?: RegisterSolidRenderElementOptions,
350
+ ): any | undefined;
351
+
298
352
  export declare function defineScript(
299
353
  runtime: SolidTagRuntime,
300
354
  element: HTMLModuleScriptElement,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "solid-tag-runtime",
3
- "version": "0.0.8",
3
+ "version": "0.0.9",
4
4
  "description": "Runtime module system for JSX modules compiled with solid-tag and executed through @solidjs/html",
5
5
  "type": "module",
6
6
  "exports": {