Commit Graph

28 Commits

Author SHA1 Message Date
Pete Bacon Darwin 423ac01dcf refactor: rename `AttributeMarker.ProjectOnly` to `AttributeMarker.Bindings` (#29041)
PR Close #29041
2019-03-07 11:27:35 -08:00
Ben Lesh c64b13e593 refactor(ivy): split util functions into different files (#28382)
Google3 detected circular references here, so splitting up this rather hodge-podge list of functions into slightly better organizational units.

PR Close #28382
2019-02-22 13:17:30 -08:00
Olivier Combe ad6475ffac fix(ivy): re-create node links after creating/moving/removing nodes with i18n (#28827)
I18n can change the order of the nodes, or insert new dynamic nodes. When that happens it can break the existing links (`TNode.next`) or even create loops:
```
div1 → div2 → div3 → div4 → div5
```

Can become:
```
div1 → div4 → div2 → div3  div5
         🡑             │
         └─────────────┘
```

This PR fixes this issue by recreating the broken links between those nodes.
PR Close #28827
2019-02-19 15:54:33 -08:00
Olivier Combe 9d109929be fix(ivy): remove nested placeholders with i18n (#28595)
PR Close #28595
2019-02-07 16:56:36 -08:00
Olivier Combe baf103c98f fix(ivy): don't increment `expandoStartIndex` after directives are matched (#28424)
i18n instructions create text nodes dynamically and save them between bindings and the expando block in `LView`. e.g., they try to create the following order in `LView`.

```
| -- elements -- | -- bindings -- | -- dynamic i18n text -- | -- expando (dirs, injectors) -- |
```

Each time a new text node is created, it is pushed to the end of the array and the `expandoStartIndex` marker is incremented, so the section begins slightly later. This happens in `allocExpando`.

This is fine if no directives have been created yet. The end of the array will be in the "dynamic text node" section.

| -- elements -- | -- bindings -- | -- dynamic i18n text -- |

However, this approach doesn't work if dynamic text nodes are created after directives are matched (for example when the directive uses host bindings). In that case, there are already directives and injectors saved in the "expando" section. So pushing to the end of `LView` actually pushes after the expando section. What we get is this:

```
| -- elements -- | -- bindings -- | -- dynamic i18n text -- | -- expando -- | -- dynamic i18n text-- |
```

In this case, the `expandoStartIndex` shouldn't be incremented because we are not inserting anything before the expando section (it's now after the expando section). But because it is incremented in the code right now, it's now pointing to an index in the middle of the expando section.

This PR fixes that so that we only increment the `expandoStartIndex` if nothing was pushed into the expando section.

FW-978 #resolve

PR Close #28424
2019-02-05 23:30:37 -05:00
Andrew Kushnir 2da82db3bc fix(ivy): proper i18n postprocessing in case of nested templates (#28209)
Prior to this change the postprocess step relied on the order of placeholders combined in one group (e.g. [�#1�|�*1:1�]). The order is not guaranteed in case we have nested templates (since we use BFS to process templates) and some tags are represented using same placeholders. This change performs postprocessing more accurate by keeping track of currently active template and searching for matching placeholder.

PR Close #28209
2019-01-25 12:54:29 -08:00
Olivier Combe c61ea1d5bd fix(ivy): support for multiple ICU expressions in the same i18n block (#28083)
There were two issues with multiple ICU expressions in the same i18n block:
- the regexp that was used to parse the text wasn't able to handle multiple ICU expressions, I've replaced it with parsing the text and searching for brackets (which is what we ended up doing in the end anyway)
- we allocate node indexes for nodes generated by the ICU expressions which increases the expando value, but we would create the nodes for those cases during the update phase. In the mean time we would create some nodes during the creation phase (comment nodes for ICU expressions, text nodes, ...) with an auto increment index. This means that any node created after an ICU expression would get the following index value, but the ICU case nodes expected to use the same index as well... There was a mismatch between the auto generated index, and the expected index which was causing problems when we needed to select those nodes for updates later on. To fix it, I've added the expected node index to the list of mutate codes that we generate, and we do not use an auto increment value anymore.

FW-905 #resolve
PR Close #28083
2019-01-16 09:49:54 -08:00
Olivier Combe e6ab55daa0 fix(ivy): don't throw in `i18nAttributes` when a component is re-rendered (#27911)
`i18nAttributes` was throwing an error when it was called multiple times in the create part of the template function with the same index, for example when we create multiple components with the same template. It shouldn't throw in this case, and just use the cache when available.

FW-903 #resolve
PR Close #27911
2019-01-07 20:21:49 -08:00
Pawel Kozlowski e08feb7e54 refactor(ivy): unify native node handling around render parent and element / ICU containers (#27925)
PR Close #27925
2019-01-07 08:36:51 -08:00
Pawel Kozlowski 8a3cebde8b fix(ivy): support ICU messages inside <ng-container> (#27925)
PR Close #27925
2019-01-07 08:36:51 -08:00
Andrew Kushnir 3f2ebbd7ab fix(ivy): support bindings in ICUs in nested contexts (#27914)
Prior to this change, ICU extraction logic was not taking into account nested bindings (that look like this: �0:1�) and only accounted for top level bindings (like this �0�). As a result, ICUs were not parsed and remained as text in the output. Now the extraction logic (regular expressions) take into account the nested bindings format as well.

PR Close #27914
2019-01-04 12:19:46 -08:00
Andrew Kushnir dfbf6d72b0 fix(ivy): provide an ability to match <ng-template> tags (#27636)
Prior to this change, we were unable to match directives using `ng-template` tags (for example the following selector would not work even though there might be some <ng-template>s in a template: `ng-template[directiveA]`. As a result, that broke some components that relies on such selectors to work. In order to resolve the problem, we now pass tag name to the `template` instruction (where we passed `null` before) and this tag name is used for matching at runtime. This update should also help support projecting containers, because the tag name is required to properly match such elements.

PR Close #27636
2018-12-17 09:33:37 -08:00
Misko Hevery 816ec0b1c3 refactor(ivy): treate LView as the primary global state (#27282)
- rename `LViewData` to `LView` (to be consistent with `TView`)
- Remove `getRenderer`, `getRendererFactory`, `getTview`, `getCurrentQueries`,

PR Close #27282
2018-11-29 21:26:15 -08:00
Andrew Kushnir 92e80af875 feat(ivy): ICU support for Ivy (#26794)
PR Close #26794
2018-11-16 16:09:30 -08:00
Olivier Combe e22a302cad feat(ivy): support for i18n & ICU expressions (#27101)
PR Close #27101
2018-11-14 16:22:01 -08:00
Miško Hevery f8f1168fa6 Revert "feat(ivy): support for i18n & ICU expressions (#26275)"
This reverts commit a63fd2d0f5.
2018-11-14 10:23:21 -08:00
Olivier Combe a63fd2d0f5 feat(ivy): support for i18n & ICU expressions (#26275)
PR Close #26275
2018-11-13 14:50:30 -08:00
Miško Hevery c13f46c7c5 fix(ivy): enable packages/core/test/render3 test for AoT (#26863)
PR Close #26863
2018-11-02 15:44:05 -07:00
Kara Erickson d5b70e0c66 fix(ivy): create LViewData from blueprint (#25587)
PR Close #25587
2018-08-22 15:58:42 -04:00
Kara Erickson 21a14407f6 refactor(ivy): generate vars in component defs (#25562)
PR Close #25562
2018-08-20 11:08:10 -07:00
Kara Erickson f2aa9c6a7f refactor(ivy): use generated consts value to set binding index (#25533)
PR Close #25533
2018-08-17 14:32:55 -07:00
Kara Erickson 6482f6f0fe refactor(ivy): separate container into 2 instructions (#25509)
PR Close #25509
2018-08-16 13:47:14 -07:00
Olivier Combe 1ceddb6290 fix(ivy): support re-order embedded templates (#24805)
PR Close #24805
2018-07-24 16:41:05 -07:00
Olivier Combe 22731a7588 refactor(ivy): split i18nInterpolation into 8 functions (#24805)
PR Close #24805
2018-07-24 16:41:05 -07:00
Olivier Combe 72dd10f78f refactor(ivy): cleanup runtime i18n code (#24805)
Fixes #24785

PR Close #24805
2018-07-24 16:41:05 -07:00
Kara Erickson 3a19f70d1c refactor(ivy): replace pNextOrParent with TNode props (#24752)
PR Close #24752
2018-07-10 11:12:27 -07:00
Kara Erickson d243baf48a refactor(ivy): remove pChild from LNode (#24705)
PR Close #24705
2018-06-29 06:44:08 -07:00
Olivier Combe 84272e2227 feat(ivy): runtime i18n (#24037)
PR Close #24037
2018-06-21 13:13:30 -07:00