You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
|`rl`|`SlotPath[]`| Repeat anchor slots aligned to `r[]`|
1238
-
|`e`|`[event, handler, argSpecs, targetPath][]`| Body events |
1238
+
|`e`|`[event, handler, argSpecs, targetPath][]`| Body events |
1239
1239
|`b`|`TemplateBlockMeta[]`| Nested compiled block table referenced by `c` / `r`|
1240
1240
|`sa`|`string`| Optional module-mode adopted stylesheet specifier copied from `shadowrootadoptedstylesheets`|
1241
-
|`re`|`[event, handler, argSpecs][]`| Root events, attached to the host element |
1241
+
|`re`|`[event, handler, argSpecs][]`| Root events, attached to the host element |
1242
1242
1243
1243
All arrays are optional — omitted from the output when empty to minimize payload.
1244
1244
@@ -1270,15 +1270,15 @@ Logical operators also match the protocol enum values:
1270
1270
-`[name, 2, ConditionExpr]` — boolean attribute binding, e.g. `?disabled="{{expr}}"`
1271
1271
-`[name, 3, parts]` — mixed/template attribute binding, e.g. `class="item {{state}}"`
1272
1272
1273
-
`argSpecs` for event handlers are resolved at dispatch time against the captured scope chain for the rendered template block:
1274
-
1275
-
-`["e"]` passes the DOM event object
1276
-
-`["p", path]` resolves a component or active `<for>` scope path, e.g. `item.id`
1277
-
-`["s", value]`, `["n", value]`, `["b", 0|1]`, and `["z"]` pass string, number, boolean, and `null` literals
1278
-
1279
-
For example, `@click="{selectItem(item.id)}"` calls `selectItem` with the current repeat item id, while `@click="{selectItem(item.id, e)}"` passes the item id followed by the event object. `@click="{selectItem(e)}"` keeps the existing event-passing behavior, and `@click="{selectItem()}"` calls the handler with no arguments.
1280
-
1281
-
### Compilation rules
1273
+
`argSpecs` for event handlers are resolved at dispatch time against the captured scope chain for the rendered template block:
1274
+
1275
+
-`["e"]` passes the DOM event object
1276
+
-`["p", path]` resolves a component or active `<for>` scope path, e.g. `item.id`
1277
+
-`["s", value]`, `["n", value]`, `["b", 0|1]`, and `["z"]` pass string, number, boolean, and `null` literals
1278
+
1279
+
For example, `@click="{selectItem(item.id)}"` calls `selectItem` with the current repeat item id, while `@click="{selectItem(item.id, e)}"` passes the item id followed by the event object. `@click="{selectItem(e)}"` keeps the existing event-passing behavior, and `@click="{selectItem()}"` calls the handler with no arguments.
1280
+
1281
+
### Compilation rules
1282
1282
1283
1283
The Rust compiler (`generate_compiled_template` in `webui-parser/src/plugin/webui.rs`) transforms the HTML template in a single forward pass, then finalizes it into marker-free client HTML plus locator metadata:
1284
1284
@@ -1291,7 +1291,7 @@ The Rust compiler (`generate_compiled_template` in `webui-parser/src/plugin/webu
1291
1291
|`:config="{{settings}}"`, `:value="{{searchQuery}}"`|`a[]` + `ag[]`| element kept marker-free |
|`@event="{handler(item.id, e)}"`|`e[]`| element kept marker-free |
1294
+
|`@event="{handler(item.id, e)}"`|`e[]`| element kept marker-free |
1295
1295
|`@event` on `<template>` wrapper |`re[N]`|*(stripped)*|
1296
1296
|`w-ref="name"`|*(stays)*|*(unchanged)*|
1297
1297
|`<outlet />`|*(stays)*|`<outlet></outlet>`|
@@ -1333,13 +1333,15 @@ WebUI SSR marker formats are:
1333
1333
1334
1334
The WebUI handler plugin emits only these five comment markers. Text bindings, attribute bindings, and event handlers are resolved from compiled metadata path indices at hydration time - no DOM attribute markers are needed. The handler only emits markers in active child scopes; the root page scope remains marker-free. During hydration the framework keeps `<!--wr-->` and `<!--wc-->` as runtime anchors and removes `<!--/wr-->`, `<!--/wc-->`, and `<!--wi-->` markers.
1335
1335
1336
+
WebUI Framework hydration assumes the SSR DOM, hydration markers, and compiled metadata were generated by the same trusted WebUI compiler/handler version. Hand-authored or partially modified marker streams are unsupported; missing structural closing markers are invalid input, not a recoverable runtime condition.
1337
+
1336
1338
### Runtime contract
1337
1339
1338
1340
`@microsoft/webui-framework` consumes the metadata object above plus the SSR markers emitted by `WebUIHydrationPlugin`. This follows an Islands Architecture approach: the server delivers fully-rendered HTML, and only interactive Web Components hydrate on the client — leaving static content untouched.
1339
1341
1340
1342
- SSR hydration uses one DOM walk to discover `<!--wr-->`, `<!--wi-->`, and `<!--wc-->` comment markers, wire the relevant bindings using compiled metadata path indices, then remove SSR-only markers.
1341
-
- Client-created DOM never reparses template syntax; it clones marker-free `h` and resolves `tx`, `ag`, `cl`, `rl`, and `el` locators directly.
1342
-
- Events are resolved from compiled `e[]` metadata entries using path indices. The runtime installs listeners on target elements and resolves handler arguments against the scope captured when that block was rendered. Root events from `re[]` attach directly to the host element.
1343
+
- Client-created DOM never reparses template syntax; it clones marker-free `h` and resolves `tx`, `ag`, `cl`, `rl`, and event target paths directly.
1344
+
- Events are resolved from compiled `e[]` metadata entries using path indices. The runtime installs listeners on target elements and resolves handler arguments against the scope captured when that block was rendered. Root events from `re[]` attach directly to the host element.
1343
1345
- The full package entrypoint supports repeat metadata (`r[]` / `rl[]`). The additive `@microsoft/webui-framework/element-no-repeat` entrypoint preserves the same public `WebUIElement` API but must reject compiled templates that contain repeat metadata.
1344
1346
1345
1347
Detailed component examples, decorators, and package entrypoint guidance live in [packages/webui-framework/README.md](packages/webui-framework/README.md) rather than being duplicated in this design spec.
0 commit comments