Skip to content

Commit f42ad68

Browse files
authored
Merge branch 'releases/fast-element-v3' into users/janechu/remove-shared-kernel
2 parents d496b46 + 7d2db2b commit f42ad68

30 files changed

Lines changed: 116 additions & 355 deletions
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"type": "major",
3+
"comment": "remove deprecated declarative event e support",
4+
"packageName": "@microsoft/fast-element",
5+
"email": "7559015+janechu@users.noreply.github.com",
6+
"dependentChangeType": "none"
7+
}

packages/fast-element/DECLARATIVE_DESIGN.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,6 @@ All delimiters used by the parser are defined in a single `Syntax` interface and
154154
| `whenDirectiveOpen` / `whenDirectiveClose` | `<f-when` / `</f-when>` | When directive |
155155
| `attributeDirectivePrefix` | `f-` | Attribute directive prefix |
156156
| `eventArgAccessor` | `$e` | DOM event argument |
157-
| `deprecatedEventArgAccessor` | `e` | Deprecated DOM event argument (emits a deduplicated warning once per component) |
158157
| `executionContextAccessor` | `$c` | Execution context argument |
159158

160159
---
@@ -351,7 +350,6 @@ sequenceDiagram
351350
|---|---|---|
352351
| `parse()` | public | Entry point: parses declarative HTML into `{ strings, values }`. |
353352
| `createTemplate()` | public | Creates a `ViewTemplate` from resolved strings and values. |
354-
| `hasDeprecatedEventSyntax` | public | Getter indicating whether the last parse encountered deprecated `e` event syntax. |
355353
| `resolveStringsAndValues()` | private | Creates `strings`/`values` arrays and delegates to `resolveInnerHTML()`. |
356354
| `resolveInnerHTML()` | private | Recursive HTML parser that dispatches to data binding or template directive handlers. |
357355
| `resolveDataBinding()` | private | Thin dispatcher that routes to `resolveContentBinding()`, `resolveAttributeBinding()`, or `resolveAttributeDirectiveBinding()`. |

packages/fast-element/DECLARATIVE_HTML.md

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -358,15 +358,12 @@ You can pass the DOM event object, the execution context, or both as arguments.
358358
<button @click="{handleClick($e, $c)}"></button>
359359
```
360360

361-
**Arbitrary binding expressions** — any token that is not `$e`, `$c`, or `e` is resolved as a binding path on the data source:
361+
**Arbitrary binding expressions** — any token that is not `$e` or `$c` is resolved as a binding path on the data source:
362362
```html
363363
<button @click="{handleClick(user.id)}"></button>
364364
```
365365

366-
> **Deprecated:** The bare `e` token still works but will emit a console warning once per component. The warning includes the component name to help locate usage. Migrate to `$e`.
367-
> ```html
368-
> <button @click="{handleClick(e)}"></button>
369-
> ```
366+
Use `$e` for the DOM event object.
370367

371368
### Directives
372369

packages/fast-element/DECLARATIVE_RENDERING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ Event bindings such as `@keydown` and `@click` can be represented with hydration
325325

326326
Example event binding:
327327
```html
328-
<button @click="{handleClick(e)}">Button</button>
328+
<button @click="{handleClick($e)}">Button</button>
329329
```
330330

331331
Should result in:

packages/fast-element/MIGRATION.md

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,30 @@ removed `@microsoft/fast-html` package.
5555
2. Update declarative utility imports such as `deepMerge` to
5656
`@microsoft/fast-element/declarative/utilities.js`.
5757
3. Keep importing core FAST Element APIs (for example `FASTElement`, `attr`,
58-
`observable`) from `@microsoft/fast-element`.
58+
`observable`) from `@microsoft/fast-element`.
5959
4. Do not switch to the root `@microsoft/fast-element` barrel for declarative
60-
APIs; the declarative entrypoint owns the debug-message and hydratable-view
61-
side effects.
60+
APIs; the declarative entrypoint owns the debug-message and hydratable-view
61+
side effects.
62+
63+
## Declarative event handler `e` removal (v3)
64+
65+
### Removed behavior
66+
67+
| Removed | Replacement |
68+
|---|---|
69+
| Bare `e` event arguments in declarative event handlers | `$e` |
70+
| `TemplateParser.hasDeprecatedEventSyntax` | No replacement |
71+
72+
Only `$e` and `$c` are reserved event handler arguments in declarative
73+
templates. Bare `e` now resolves like any other binding path on the current
74+
data source.
75+
76+
### Migration steps
77+
78+
1. Replace declarative event bindings such as
79+
`@click="{handleClick(e)}"` with `@click="{handleClick($e)}"`.
80+
2. Remove any `TemplateParser.hasDeprecatedEventSyntax` checks or warnings from
81+
custom tooling.
6282

6383
## Prerendered Content Optimization (v2 → v3)
6484

packages/fast-element/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,8 @@ TemplateElement.define({ name: "f-template" });
102102
Declarative utilities such as `deepMerge` are available from
103103
`@microsoft/fast-element/declarative/utilities.js`. See
104104
[`DECLARATIVE_HTML.md`](./DECLARATIVE_HTML.md) for declarative usage details.
105+
Declarative event bindings use `$e` for the DOM event object and `$c` for the
106+
execution context.
105107

106108
## Prerendered Content Optimization
107109

packages/fast-element/docs/declarative/api-report.api.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,6 @@ export class TemplateElement extends FASTElement {
138138
export class TemplateParser {
139139
// Warning: (ae-forgotten-export) The symbol "ViewTemplate" needs to be exported by the entry point declarative.d.ts
140140
createTemplate(strings: Array<string>, values: Array<any>): ViewTemplate<any, any>;
141-
get hasDeprecatedEventSyntax(): boolean;
142141
parse(innerHTML: string, schema: Schema): ResolvedStringsAndValues;
143142
}
144143

packages/fast-element/src/declarative/syntax.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ interface Syntax {
66
clientSideCloseExpression: string;
77
executionContextAccessor: string;
88
eventArgAccessor: string;
9-
deprecatedEventArgAccessor: string;
109
openExpression: string;
1110
closeExpression: string;
1211
unescapedOpenExpression: string;
@@ -26,7 +25,6 @@ export const {
2625
clientSideCloseExpression,
2726
clientSideOpenExpression,
2827
closeExpression,
29-
deprecatedEventArgAccessor,
3028
eventArgAccessor,
3129
executionContextAccessor,
3230
openExpression,
@@ -41,7 +39,6 @@ export const {
4139
clientSideCloseExpression: "}",
4240
clientSideOpenExpression: "{",
4341
closeExpression: "}}",
44-
deprecatedEventArgAccessor: "e",
4542
eventArgAccessor: "$e",
4643
executionContextAccessor: "$c",
4744
openExpression: "{{",

packages/fast-element/src/declarative/template-parser.ts

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -72,37 +72,18 @@ class StringsAccumulator {
7272
*
7373
* This class is intentionally stateless across invocations — all mutable
7474
* parsing state lives on the call stack or in the `TemplateResolutionContext`.
75-
* The only per-parse state is `_hasDeprecatedEventSyntax`, which is reset at
76-
* the start of each `parse()` call.
7775
*
7876
* The parsing pipeline is fully synchronous — no promises are allocated
7977
* during template resolution.
8078
*/
8179
export class TemplateParser {
82-
/**
83-
* Whether the template contains deprecated "e" event argument usage.
84-
* Set during template processing; checked after parsing to emit a
85-
* single warning per template.
86-
*/
87-
// TODO: remove per https://github.com/microsoft/fast/issues/7314
88-
private _hasDeprecatedEventSyntax = false;
89-
90-
/**
91-
* Whether the last parsed template contained deprecated "e" event syntax.
92-
*/
93-
public get hasDeprecatedEventSyntax(): boolean {
94-
return this._hasDeprecatedEventSyntax;
95-
}
96-
9780
/**
9881
* Parse declarative HTML into strings and values for ViewTemplate creation.
9982
* @param innerHTML - The transformed innerHTML to parse.
10083
* @param schema - The Schema instance for property tracking.
10184
* @returns The resolved strings and values.
10285
*/
10386
public parse(innerHTML: string, schema: Schema): ResolvedStringsAndValues {
104-
this._hasDeprecatedEventSyntax = false;
105-
10687
return this.resolveStringsAndValues(null, innerHTML, {
10788
parentContext: null,
10889
level: 0,
@@ -370,14 +351,9 @@ export class TemplateParser {
370351

371352
const parsedArgs = parseEventArgs(argsString);
372353

373-
if (parsedArgs.some(a => a.type === "deprecated-event")) {
374-
this._hasDeprecatedEventSyntax = true;
375-
}
376-
377354
const argResolvers = parsedArgs.map((parsedArg): ((x: any, c: any) => any) => {
378355
switch (parsedArg.type) {
379356
case "event":
380-
case "deprecated-event":
381357
return (_x, c) => c.event;
382358
case "context":
383359
return (_x, c) => c;

packages/fast-element/src/declarative/template.ts

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import { Message } from "./interfaces.js";
1616
import { ObserverMap, type ObserverMapOption } from "./observer-map.js";
1717
import { Schema } from "./schema.js";
1818
import { TemplateParser } from "./template-parser.js";
19-
import { eventArgAccessor, transformInnerHTML } from "./utilities.js";
19+
import { transformInnerHTML } from "./utilities.js";
2020

2121
/**
2222
* Checks whether a map option (observerMap or attributeMap) is enabled.
@@ -253,14 +253,6 @@ class TemplateElement extends FASTElement {
253253

254254
const { strings, values } = parser.parse(innerHTML, schema);
255255

256-
if (parser.hasDeprecatedEventSyntax) {
257-
console.warn(
258-
`[fast-element/declarative] Using "e" as an event argument is deprecated` +
259-
` in component "${name}".` +
260-
` Use "${eventArgAccessor}" instead.`,
261-
);
262-
}
263-
264256
// Define the root properties cached in the observer map as observable (only if observerMap exists)
265257
this.observerMap?.defineProperties();
266258

0 commit comments

Comments
 (0)