Skip to content

Commit e28fed9

Browse files
benleshwKoza
authored andcommitted
refactor(ivy): Add docs to i18n interfaces (angular#29344)
PR Close angular#29344
1 parent 0d69d64 commit e28fed9

File tree

1 file changed

+62
-24
lines changed
  • packages/core/src/render3/interfaces

1 file changed

+62
-24
lines changed

packages/core/src/render3/interfaces/i18n.ts

Lines changed: 62 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -19,28 +19,50 @@
1919
import {SanitizerFn} from './sanitization';
2020

2121
export const enum I18nMutateOpCode {
22-
/// Stores shift amount for bits 17-3 that contain reference index.
22+
/**
23+
* Stores shift amount for bits 17-3 that contain reference index.
24+
*/
2325
SHIFT_REF = 3,
24-
/// Stores shift amount for bits 31-17 that contain parent index.
26+
/**
27+
* Stores shift amount for bits 31-17 that contain parent index.
28+
*/
2529
SHIFT_PARENT = 17,
26-
/// Mask for OpCode
30+
/**
31+
* Mask for OpCode
32+
*/
2733
MASK_OPCODE = 0b111,
28-
/// Mask for reference index.
34+
/**
35+
* Mask for reference index
36+
*/
2937
MASK_REF = ((2 ^ 16) - 1) << SHIFT_REF,
3038

31-
/// OpCode to select a node. (next OpCode will contain the operation.)
39+
/**
40+
* OpCode to select a node. (next OpCode will contain the operation.)
41+
*/
3242
Select = 0b000,
33-
/// OpCode to append the current node to `PARENT`.
43+
/**
44+
* OpCode to append the current node to `PARENT`.
45+
*/
3446
AppendChild = 0b001,
35-
/// OpCode to insert the current node to `PARENT` before `REF`.
47+
/**
48+
* OpCode to insert the current node to `PARENT` before `REF`.
49+
*/
3650
InsertBefore = 0b010,
37-
/// OpCode to remove the `REF` node from `PARENT`.
51+
/**
52+
* OpCode to remove the `REF` node from `PARENT`.
53+
*/
3854
Remove = 0b011,
39-
/// OpCode to set the attribute of a node.
55+
/**
56+
* OpCode to set the attribute of a node.
57+
*/
4058
Attr = 0b100,
41-
/// OpCode to simulate elementEnd()
59+
/**
60+
* OpCode to simulate elementEnd()
61+
*/
4262
ElementEnd = 0b101,
43-
/// OpCode to read the remove OpCodes for the nested ICU
63+
/**
64+
* OpCode to read the remove OpCodes for the nested ICU
65+
*/
4466
RemoveNestedIcu = 0b110,
4567
}
4668

@@ -69,7 +91,7 @@ export interface COMMENT_MARKER { marker: 'comment'; }
6991
* Array storing OpCode for dynamically creating `i18n` blocks.
7092
*
7193
* Example:
72-
* ```
94+
* ```ts
7395
* <I18nCreateOpCode>[
7496
* // For adding text nodes
7597
* // ---------------------
@@ -143,22 +165,38 @@ export interface I18nMutateOpCodes extends Array<number|string|ELEMENT_MARKER|CO
143165
}
144166

145167
export const enum I18nUpdateOpCode {
146-
/// Stores shift amount for bits 17-2 that contain reference index.
168+
/**
169+
* Stores shift amount for bits 17-2 that contain reference index.
170+
*/
147171
SHIFT_REF = 2,
148-
/// Stores shift amount for bits 31-17 that contain which ICU in i18n block are we referring to.
172+
/**
173+
* Stores shift amount for bits 31-17 that contain which ICU in i18n block are we referring to.
174+
*/
149175
SHIFT_ICU = 17,
150-
/// Mask for OpCode
176+
/**
177+
* Mask for OpCode
178+
*/
151179
MASK_OPCODE = 0b11,
152-
/// Mask for reference index.
180+
/**
181+
* Mask for reference index.
182+
*/
153183
MASK_REF = ((2 ^ 16) - 1) << SHIFT_REF,
154184

155-
/// OpCode to update a text node.
185+
/**
186+
* OpCode to update a text node.
187+
*/
156188
Text = 0b00,
157-
/// OpCode to update a attribute of a node.
189+
/**
190+
* OpCode to update a attribute of a node.
191+
*/
158192
Attr = 0b01,
159-
/// OpCode to switch the current ICU case.
193+
/**
194+
* OpCode to switch the current ICU case.
195+
*/
160196
IcuSwitch = 0b10,
161-
/// OpCode to update the current ICU case.
197+
/**
198+
* OpCode to update the current ICU case.
199+
*/
162200
IcuUpdate = 0b11,
163201
}
164202

@@ -176,7 +214,7 @@ export const enum I18nUpdateOpCode {
176214
* ## Example
177215
*
178216
* Assume
179-
* ```
217+
* ```ts
180218
* if (rf & RenderFlags.Update) {
181219
* i18nExp(bind(ctx.exp1)); // If changed set mask bit 1
182220
* i18nExp(bind(ctx.exp2)); // If changed set mask bit 2
@@ -188,8 +226,8 @@ export const enum I18nUpdateOpCode {
188226
* We can assume that each call to `i18nExp` sets an internal `changeMask` bit depending on the
189227
* index of `i18nExp`.
190228
*
191-
* OpCodes
192-
* ```
229+
* ### OpCodes
230+
* ```ts
193231
* <I18nUpdateOpCodes>[
194232
* // The following OpCodes represent: `<div i18n-title="pre{{exp1}}in{{exp2}}post">`
195233
* // If `changeMask & 0b11`
@@ -312,7 +350,7 @@ export interface TIcu {
312350
* to know which child ICUs to run clean up for as well.
313351
*
314352
* In the above example this would be:
315-
* ```
353+
* ```ts
316354
* [
317355
* [], // `=0` has no sub ICUs
318356
* [1], // `other` has one subICU at `1`st index.

0 commit comments

Comments
 (0)