angular/packages/compiler/src
Kristiyan Kostadinov 8be2c48b7c feat(core): implement new block syntax (#51891)
Switches the syntax for blocks from `{#block}{/block}` to `@block {}` based on the feedback from the community.

Read more about the decision-making process in our blog: https://blog.angular.io/meet-angulars-new-control-flow-a02c6eee7843

The existing block types changed in the following ways:

**Conditional blocks:**
```html
<!-- Before -->
{#if cond}
  Main content
  {:else if otherCond}
    Else if content
  {:else}
    Else content
{/if}

<!-- After -->
@if (cond) {
  Main content
} @else if (otherCond) {
  Else if content
} @else {
  Else content
}
```

**Deferred blocks**
```html
<!-- Before -->
{#defer when isLoaded}
  Main content
  {:loading} Loading...
  {:placeholder} <icon>pending</icon>
  {:error} Failed to load
{/defer}

<!-- After -->
@defer (when isLoaded) {
  Main content
} @loading {
  Loading...
} @placeholder {
  <icon>pending</icon>
} @error {
  Failed to load
}
```

**Switch blocks:**
```html
<!-- Before -->
{#switch value}
  {:case 1}
    One
  {:case 2}
    Two
  {:default}
    Default
{/switch}

<!-- After -->
@switch (value) {
  @case (1) {
    One
  }

  @case (2) {
    Two
  }

  @default {
    Default
  }
}
```

**For loops**
```html
<!-- Before -->
{#for item of items; track item}
  {{item.name}}
  {:empty} No items
{/for}

<!-- After -->
@for (item of items; track item) {
  {{item.name}}
} @empty {
  No items
}
```

PR Close #51891
2023-09-26 09:10:04 -07:00
..
compiler_util refactor(compiler): add support for advanced tracking expressions (#51618) 2023-09-05 14:19:18 +00:00
expression_parser refactor(compiler): Prepare the template pipeline to support host bindings. (#50899) 2023-07-27 15:08:04 -07:00
i18n feat(core): implement new block syntax (#51891) 2023-09-26 09:10:04 -07:00
ml_parser feat(core): implement new block syntax (#51891) 2023-09-26 09:10:04 -07:00
output build: align with internal tsconfig options (#51728) 2023-09-12 11:39:42 -07:00
render3 feat(core): implement new block syntax (#51891) 2023-09-26 09:10:04 -07:00
schema fix(core): hardening attribute and property binding rules for <iframe> elements (#47964) 2022-11-09 00:47:56 -08:00
template/pipeline feat(core): implement new block syntax (#51891) 2023-09-26 09:10:04 -07:00
template_parser refactor(compiler): introduce deferred block AST (#51050) 2023-07-17 21:05:47 +00:00
assertions.ts refactor(compiler): remove unused assertion function (#44411) 2022-01-04 15:54:09 -08:00
chars.ts refactor(compiler): share isQuote() via chars.ts (#43129) 2021-08-16 13:07:23 -07:00
compiler.ts refactor(compiler): extract deferred block trigger information (#51830) 2023-09-22 12:17:54 -07:00
compiler_facade_interface.ts refactor(compiler): introduce compiler infrastructure for input transforms (#50225) 2023-05-22 14:48:02 +00:00
config.ts fix(core): update isDevMode to rely on ngDevMode (#47475) 2022-09-23 13:58:45 -07:00
constant_pool.ts perf(core): generate arrow functions for pure function calls (#51668) 2023-09-06 15:32:02 +00:00
core.ts refactor(compiler): introduce compiler infrastructure for input transforms (#50225) 2023-05-22 14:48:02 +00:00
injectable_compiler_2.ts refactor(compiler-cli): only use a single type expression (#49136) 2023-04-03 19:20:00 -07:00
jit_compiler_facade.ts refactor(compiler): implement final instruction generation for interaction triggers (#51830) 2023-09-22 12:17:54 -07:00
parse_util.ts refactor: replace deprecated String.prototype.substr() (#45397) 2022-03-24 11:48:09 -07:00
resource_loader.ts refactor(compiler): ensure compatibility with noImplicitOverride (#42512) 2021-07-12 13:11:14 -07:00
selector.ts feat(compiler): allow self-closing tags on custom elements (#48535) 2023-01-04 12:07:37 -08:00
shadow_css.ts feat(compiler): scope selectors in @scope queries (#50747) 2023-07-11 08:29:53 -07:00
style_url_resolver.ts refactor(compiler): make template preparser null-safe (#44411) 2022-01-04 15:54:10 -08:00
util.ts refactor(compiler): use globalThis for global (#50063) 2023-07-14 18:32:01 +00:00
version.ts docs: fix package name in version.ts files in different packages (#41208) 2021-05-10 10:26:34 -04:00