@angular/core 7.0.0-rc.1 → 7.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundles/core-testing.umd.js +36 -33
- package/bundles/core-testing.umd.js.map +1 -1
- package/bundles/core-testing.umd.min.js +3 -3
- package/bundles/core-testing.umd.min.js.map +1 -1
- package/bundles/core.umd.js +1856 -1463
- package/bundles/core.umd.js.map +1 -1
- package/bundles/core.umd.min.js +155 -94
- package/bundles/core.umd.min.js.map +1 -1
- package/core.d.ts +7 -6
- package/core.metadata.json +1 -1
- package/esm2015/core.externs.js +0 -3
- package/esm2015/core.js +6 -6
- package/esm2015/index.js +2 -2
- package/esm2015/public_api.js +2 -2
- package/esm2015/src/application_init.js +5 -1
- package/esm2015/src/application_module.js +2 -2
- package/esm2015/src/application_ref.js +11 -9
- package/esm2015/src/application_tokens.js +7 -7
- package/esm2015/src/change_detection/change_detection_util.js +3 -1
- package/esm2015/src/change_detection/change_detector_ref.js +2 -1
- package/esm2015/src/change_detection/constants.js +1 -1
- package/esm2015/src/change_detection/differs/default_iterable_differ.js +2 -1
- package/esm2015/src/change_detection/differs/iterable_differs.js +8 -6
- package/esm2015/src/change_detection/differs/keyvalue_differs.js +6 -5
- package/esm2015/src/change_detection/pipe_transform.js +2 -2
- package/esm2015/src/core.js +2 -2
- package/esm2015/src/core_render3_private_export.js +5 -4
- package/esm2015/src/debug/debug_node.js +6 -6
- package/esm2015/src/di/defs.js +5 -5
- package/esm2015/src/di/forward_ref.js +4 -4
- package/esm2015/src/di/injectable.js +5 -2
- package/esm2015/src/di/injection_token.js +3 -1
- package/esm2015/src/di/injector.js +3 -3
- package/esm2015/src/di/metadata.js +16 -1
- package/esm2015/src/di/provider.js +16 -6
- package/esm2015/src/di/r3_injector.js +2 -2
- package/esm2015/src/di/reflective_injector.js +2 -2
- package/esm2015/src/di/reflective_key.js +3 -1
- package/esm2015/src/di/reflective_provider.js +3 -3
- package/esm2015/src/error_handler.js +3 -1
- package/esm2015/src/event_emitter.js +2 -1
- package/esm2015/src/i18n/tokens.js +4 -4
- package/esm2015/src/is_dev_mode.js +4 -2
- package/esm2015/src/ivy_switch/runtime/index.js +2 -2
- package/esm2015/src/ivy_switch/runtime/ivy_switch_on.js +4 -2
- package/esm2015/src/ivy_switch/runtime/jit.js +2 -2
- package/esm2015/src/ivy_switch/runtime/legacy.js +7 -1
- package/esm2015/src/ivy_switch/runtime/local.js +2 -2
- package/esm2015/src/linker/compiler.js +5 -4
- package/esm2015/src/linker/component_factory.js +4 -2
- package/esm2015/src/linker/component_factory_resolver.js +2 -1
- package/esm2015/src/linker/element_ref.js +2 -2
- package/esm2015/src/linker/ng_module_factory.js +3 -3
- package/esm2015/src/linker/ng_module_factory_loader.js +4 -3
- package/esm2015/src/linker/query_list.js +3 -1
- package/esm2015/src/linker/system_js_ng_module_factory_loader.js +3 -3
- package/esm2015/src/linker/template_ref.js +2 -1
- package/esm2015/src/linker/view_container_ref.js +2 -1
- package/esm2015/src/linker/view_ref.js +4 -2
- package/esm2015/src/metadata/di.js +13 -5
- package/esm2015/src/metadata/directives.js +20 -7
- package/esm2015/src/metadata/lifecycle_hooks.js +10 -5
- package/esm2015/src/metadata/ng_module.js +8 -6
- package/esm2015/src/metadata/view.js +1 -1
- package/esm2015/src/platform_core_providers.js +2 -2
- package/esm2015/src/profile/profile.js +5 -5
- package/esm2015/src/profile/wtf_impl.js +2 -2
- package/esm2015/src/r3_symbols.js +1 -1
- package/esm2015/src/reflection/reflection_capabilities.js +3 -3
- package/esm2015/src/render/api.js +20 -7
- package/esm2015/src/render3/component.js +52 -18
- package/esm2015/src/render3/component_ref.js +15 -15
- package/esm2015/src/render3/context_discovery.js +35 -126
- package/esm2015/src/render3/debug.js +33 -56
- package/esm2015/src/render3/definition.js +42 -37
- package/esm2015/src/render3/di.js +4 -28
- package/esm2015/src/render3/discovery_utils.js +10 -7
- package/esm2015/src/render3/i18n.js +60 -34
- package/esm2015/src/render3/index.js +3 -3
- package/esm2015/src/render3/instructions.js +162 -275
- package/esm2015/src/render3/interfaces/container.js +7 -5
- package/esm2015/src/render3/interfaces/context.js +60 -0
- package/esm2015/src/render3/interfaces/definition.js +7 -1
- package/esm2015/src/render3/interfaces/i18n.js +338 -0
- package/esm2015/src/render3/interfaces/node.js +12 -126
- package/esm2015/src/render3/interfaces/player.js +73 -1
- package/esm2015/src/render3/interfaces/styling.js +18 -22
- package/esm2015/src/render3/interfaces/view.js +19 -26
- package/esm2015/src/render3/jit/compiler_facade.js +22 -0
- package/esm2015/src/render3/jit/compiler_facade_interface.js +229 -0
- package/esm2015/src/render3/jit/directive.js +57 -93
- package/esm2015/src/render3/jit/environment.js +7 -3
- package/esm2015/src/render3/jit/injectable.js +21 -46
- package/esm2015/src/render3/jit/module.js +16 -43
- package/esm2015/src/render3/jit/pipe.js +6 -12
- package/esm2015/src/render3/jit/util.js +14 -17
- package/esm2015/src/render3/node_assert.js +1 -1
- package/esm2015/src/render3/node_manipulation.js +99 -109
- package/esm2015/src/render3/players.js +67 -0
- package/esm2015/src/render3/styling/class_and_style_bindings.js +347 -88
- package/esm2015/src/render3/styling/core_player_handler.js +2 -2
- package/esm2015/src/render3/styling/player_factory.js +48 -0
- package/esm2015/src/render3/styling/util.js +165 -17
- package/esm2015/src/render3/util.js +73 -20
- package/esm2015/src/render3/view_engine_compatibility.js +56 -40
- package/esm2015/src/sanitization/security.js +2 -2
- package/esm2015/src/testability/testability.js +5 -6
- package/esm2015/src/type.js +5 -2
- package/esm2015/src/util/decorators.js +2 -1
- package/esm2015/src/util.js +15 -1
- package/esm2015/src/version.js +6 -4
- package/esm2015/src/view/refs.js +3 -3
- package/esm2015/src/view/services.js +8 -6
- package/esm2015/src/zone/ng_zone.js +2 -2
- package/esm2015/testing/src/async.js +2 -2
- package/esm2015/testing/src/component_fixture.js +2 -2
- package/esm2015/testing/src/fake_async.js +7 -7
- package/esm2015/testing/src/fake_async_fallback.js +7 -7
- package/esm2015/testing/src/metadata_override.js +1 -1
- package/esm2015/testing/src/r3_test_bed.js +8 -6
- package/esm2015/testing/src/test_bed.js +10 -8
- package/esm2015/testing/src/test_bed_common.js +6 -6
- package/esm2015/testing/src/test_compiler.js +3 -3
- package/esm5/core.js +6 -6
- package/esm5/src/application_init.js +5 -1
- package/esm5/src/application_module.js +2 -2
- package/esm5/src/application_ref.js +11 -9
- package/esm5/src/application_tokens.js +7 -7
- package/esm5/src/change_detection/change_detection_util.js +3 -1
- package/esm5/src/change_detection/change_detector_ref.js +2 -1
- package/esm5/src/change_detection/constants.js +2 -1
- package/esm5/src/change_detection/differs/default_iterable_differ.js +2 -1
- package/esm5/src/change_detection/differs/iterable_differs.js +2 -1
- package/esm5/src/change_detection/differs/keyvalue_differs.js +2 -1
- package/esm5/src/change_detection/pipe_transform.js +1 -1
- package/esm5/src/core_render3_private_export.js +5 -4
- package/esm5/src/debug/debug_node.js +5 -5
- package/esm5/src/di/defs.js +3 -3
- package/esm5/src/di/forward_ref.js +3 -3
- package/esm5/src/di/injectable.js +6 -5
- package/esm5/src/di/injection_token.js +3 -1
- package/esm5/src/di/injector.js +3 -3
- package/esm5/src/di/metadata.js +6 -1
- package/esm5/src/di/provider.js +1 -1
- package/esm5/src/di/r3_injector.js +2 -2
- package/esm5/src/di/reflective_injector.js +2 -2
- package/esm5/src/di/reflective_key.js +3 -1
- package/esm5/src/di/reflective_provider.js +2 -2
- package/esm5/src/error_handler.js +3 -1
- package/esm5/src/event_emitter.js +2 -1
- package/esm5/src/i18n/tokens.js +5 -5
- package/esm5/src/is_dev_mode.js +4 -2
- package/esm5/src/ivy_switch/runtime/ivy_switch_on.js +3 -2
- package/esm5/src/ivy_switch/runtime/legacy.js +4 -1
- package/esm5/src/linker/compiler.js +5 -4
- package/esm5/src/linker/component_factory.js +5 -1
- package/esm5/src/linker/component_factory_resolver.js +4 -1
- package/esm5/src/linker/element_ref.js +2 -2
- package/esm5/src/linker/ng_module_factory.js +3 -3
- package/esm5/src/linker/ng_module_factory_loader.js +4 -3
- package/esm5/src/linker/query_list.js +3 -1
- package/esm5/src/linker/system_js_ng_module_factory_loader.js +3 -3
- package/esm5/src/linker/template_ref.js +2 -1
- package/esm5/src/linker/view_container_ref.js +2 -1
- package/esm5/src/linker/view_ref.js +4 -2
- package/esm5/src/metadata/di.js +10 -3
- package/esm5/src/metadata/directives.js +9 -6
- package/esm5/src/metadata/lifecycle_hooks.js +1 -1
- package/esm5/src/metadata/ng_module.js +4 -3
- package/esm5/src/metadata/view.js +4 -1
- package/esm5/src/platform_core_providers.js +2 -2
- package/esm5/src/profile/profile.js +5 -5
- package/esm5/src/profile/wtf_impl.js +1 -1
- package/esm5/src/r3_symbols.js +1 -1
- package/esm5/src/reflection/reflection_capabilities.js +3 -3
- package/esm5/src/render/api.js +11 -5
- package/esm5/src/render3/component.js +45 -16
- package/esm5/src/render3/component_ref.js +12 -13
- package/esm5/src/render3/context_discovery.js +33 -65
- package/esm5/src/render3/debug.js +31 -50
- package/esm5/src/render3/definition.js +35 -31
- package/esm5/src/render3/di.js +4 -20
- package/esm5/src/render3/discovery_utils.js +12 -7
- package/esm5/src/render3/i18n.js +40 -30
- package/esm5/src/render3/index.js +3 -3
- package/esm5/src/render3/instructions.js +143 -230
- package/esm5/src/render3/interfaces/container.js +6 -5
- package/esm5/src/render3/interfaces/context.js +13 -0
- package/esm5/src/render3/interfaces/definition.js +1 -1
- package/esm5/src/render3/interfaces/i18n.js +25 -0
- package/esm5/src/render3/interfaces/node.js +1 -1
- package/esm5/src/render3/interfaces/player.js +1 -1
- package/esm5/src/render3/interfaces/styling.js +1 -8
- package/esm5/src/render3/interfaces/view.js +18 -17
- package/esm5/src/render3/jit/compiler_facade.js +21 -0
- package/esm5/src/render3/jit/compiler_facade_interface.js +15 -0
- package/esm5/src/render3/jit/directive.js +44 -79
- package/esm5/src/render3/jit/environment.js +7 -3
- package/esm5/src/render3/jit/injectable.js +26 -46
- package/esm5/src/render3/jit/module.js +16 -31
- package/esm5/src/render3/jit/pipe.js +6 -9
- package/esm5/src/render3/jit/util.js +12 -17
- package/esm5/src/render3/node_assert.js +1 -1
- package/esm5/src/render3/node_manipulation.js +89 -101
- package/esm5/src/render3/players.js +59 -0
- package/esm5/src/render3/styling/class_and_style_bindings.js +248 -85
- package/esm5/src/render3/styling/core_player_handler.js +2 -2
- package/esm5/src/render3/styling/player_factory.js +29 -0
- package/esm5/src/render3/styling/util.js +132 -14
- package/esm5/src/render3/util.js +54 -21
- package/esm5/src/render3/view_engine_compatibility.js +46 -32
- package/esm5/src/sanitization/security.js +3 -3
- package/esm5/src/testability/testability.js +4 -4
- package/esm5/src/type.js +2 -2
- package/esm5/src/util/decorators.js +1 -1
- package/esm5/src/util.js +13 -1
- package/esm5/src/version.js +6 -3
- package/esm5/src/view/refs.js +1 -1
- package/esm5/src/view/services.js +7 -10
- package/esm5/src/zone/ng_zone.js +2 -2
- package/esm5/testing/src/async.js +2 -2
- package/esm5/testing/src/component_fixture.js +2 -2
- package/esm5/testing/src/fake_async.js +7 -7
- package/esm5/testing/src/fake_async_fallback.js +7 -7
- package/esm5/testing/src/metadata_override.js +1 -1
- package/esm5/testing/src/r3_test_bed.js +8 -7
- package/esm5/testing/src/test_bed.js +10 -8
- package/esm5/testing/src/test_bed_common.js +4 -4
- package/esm5/testing/src/test_compiler.js +3 -3
- package/fesm2015/core.js +2486 -1951
- package/fesm2015/core.js.map +1 -1
- package/fesm2015/testing.js +36 -32
- package/fesm2015/testing.js.map +1 -1
- package/fesm5/core.js +1830 -1439
- package/fesm5/core.js.map +1 -1
- package/fesm5/testing.js +36 -33
- package/fesm5/testing.js.map +1 -1
- package/package.json +1 -2
- package/src/application_init.d.ts +4 -0
- package/src/application_module.d.ts +1 -1
- package/src/application_ref.d.ts +10 -8
- package/src/application_tokens.d.ts +6 -6
- package/src/change_detection/change_detection_util.d.ts +2 -0
- package/src/change_detection/change_detector_ref.d.ts +1 -0
- package/src/change_detection/constants.d.ts +1 -0
- package/src/change_detection/differs/default_iterable_differ.d.ts +1 -0
- package/src/change_detection/differs/iterable_differs.d.ts +8 -6
- package/src/change_detection/differs/keyvalue_differs.d.ts +5 -4
- package/src/change_detection/pipe_transform.d.ts +1 -1
- package/src/core_render3_private_export.d.ts +7 -5
- package/src/debug/debug_node.d.ts +5 -5
- package/src/di/defs.d.ts +4 -4
- package/src/di/forward_ref.d.ts +3 -3
- package/src/di/injectable.d.ts +10 -7
- package/src/di/injection_token.d.ts +2 -0
- package/src/di/injector.d.ts +5 -3
- package/src/di/metadata.d.ts +24 -1
- package/src/di/provider.d.ts +19 -5
- package/src/di/r3_injector.d.ts +1 -1
- package/src/di/reflective_injector.d.ts +1 -1
- package/src/di/reflective_key.d.ts +2 -0
- package/src/di/reflective_provider.d.ts +2 -2
- package/src/error_handler.d.ts +2 -0
- package/src/event_emitter.d.ts +1 -0
- package/src/i18n/tokens.d.ts +4 -4
- package/src/is_dev_mode.d.ts +3 -1
- package/src/ivy_switch/runtime/ivy_switch_on.d.ts +2 -1
- package/src/ivy_switch/runtime/legacy.d.ts +3 -0
- package/src/linker/compiler.d.ts +5 -4
- package/src/linker/component_factory.d.ts +5 -1
- package/src/linker/component_factory_resolver.d.ts +3 -0
- package/src/linker/element_ref.d.ts +1 -1
- package/src/linker/ng_module_factory.d.ts +2 -2
- package/src/linker/ng_module_factory_loader.d.ts +3 -2
- package/src/linker/query_list.d.ts +2 -0
- package/src/linker/system_js_ng_module_factory_loader.d.ts +2 -2
- package/src/linker/template_ref.d.ts +1 -0
- package/src/linker/view_container_ref.d.ts +1 -0
- package/src/linker/view_ref.d.ts +3 -1
- package/src/metadata/di.d.ts +13 -5
- package/src/metadata/directives.d.ts +19 -6
- package/src/metadata/lifecycle_hooks.d.ts +9 -4
- package/src/metadata/ng_module.d.ts +7 -7
- package/src/metadata/view.d.ts +3 -0
- package/src/platform_core_providers.d.ts +1 -1
- package/src/profile/profile.d.ts +4 -4
- package/src/profile/wtf_impl.d.ts +1 -1
- package/src/r3_symbols.d.ts +1 -1
- package/src/render/api.d.ts +10 -7
- package/src/render3/component.d.ts +14 -3
- package/src/render3/context_discovery.d.ts +6 -58
- package/src/render3/definition.d.ts +0 -4
- package/src/render3/di.d.ts +1 -3
- package/src/render3/discovery_utils.d.ts +7 -1
- package/src/render3/i18n.d.ts +4 -0
- package/src/render3/index.d.ts +2 -2
- package/src/render3/instructions.d.ts +43 -50
- package/src/render3/interfaces/container.d.ts +36 -22
- package/src/render3/interfaces/context.d.ts +52 -0
- package/src/render3/interfaces/definition.d.ts +8 -3
- package/src/render3/interfaces/i18n.d.ts +326 -0
- package/src/render3/interfaces/node.d.ts +12 -89
- package/src/render3/interfaces/player.d.ts +58 -4
- package/src/render3/interfaces/styling.d.ts +17 -15
- package/src/render3/interfaces/view.d.ts +28 -28
- package/src/render3/jit/compiler_facade.d.ts +3 -0
- package/src/render3/jit/compiler_facade_interface.d.ts +131 -0
- package/src/render3/jit/directive.d.ts +3 -0
- package/src/render3/jit/util.d.ts +3 -3
- package/src/render3/node_manipulation.d.ts +21 -22
- package/src/render3/players.d.ts +32 -0
- package/src/render3/styling/class_and_style_bindings.d.ts +31 -24
- package/src/render3/styling/player_factory.d.ts +31 -0
- package/src/render3/styling/util.d.ts +31 -9
- package/src/render3/util.d.ts +32 -15
- package/src/render3/view_engine_compatibility.d.ts +3 -0
- package/src/sanitization/security.d.ts +2 -2
- package/src/testability/testability.d.ts +5 -6
- package/src/type.d.ts +6 -1
- package/src/util/decorators.d.ts +1 -0
- package/src/util.d.ts +10 -0
- package/src/version.d.ts +4 -1
- package/src/view/services.d.ts +2 -2
- package/src/zone/ng_zone.d.ts +1 -1
- package/testing/src/async.d.ts +1 -1
- package/testing/src/component_fixture.d.ts +1 -1
- package/testing/src/fake_async.d.ts +6 -6
- package/testing/src/fake_async_fallback.d.ts +6 -6
- package/testing/src/metadata_override.d.ts +1 -1
- package/testing/src/r3_test_bed.d.ts +4 -4
- package/testing/src/test_bed.d.ts +12 -10
- package/testing/src/test_bed_common.d.ts +6 -6
- package/testing/src/test_compiler.d.ts +2 -2
- package/testing/testing.metadata.json +1 -1
- package/esm2015/src/render3/player.js +0 -51
- package/esm5/src/render3/player.js +0 -39
- package/src/render3/player.d.ts +0 -3
|
@@ -0,0 +1,326 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright Google Inc. All Rights Reserved.
|
|
4
|
+
*
|
|
5
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
6
|
+
* found in the LICENSE file at https://angular.io/license
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* `I18nMutateOpCode` defines OpCodes for `I18nMutateOpCodes` array.
|
|
10
|
+
*
|
|
11
|
+
* OpCodes contain three parts:
|
|
12
|
+
* 1) Parent node index offset.
|
|
13
|
+
* 2) Reference node index offset.
|
|
14
|
+
* 3) The OpCode to execute.
|
|
15
|
+
*
|
|
16
|
+
* See: `I18nCreateOpCodes` for example of usage.
|
|
17
|
+
*/
|
|
18
|
+
export declare const enum I18nMutateOpCode {
|
|
19
|
+
SHIFT_REF = 2,
|
|
20
|
+
SHIFT_PARENT = 17,
|
|
21
|
+
MASK_OPCODE = 3,
|
|
22
|
+
MASK_REF = 68,
|
|
23
|
+
Select = 0,
|
|
24
|
+
AppendChild = 1,
|
|
25
|
+
InsertBefore = 2,
|
|
26
|
+
Remove = 3
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Marks that the next string is for element.
|
|
30
|
+
*
|
|
31
|
+
* See `I18nMutateOpCodes` documentation.
|
|
32
|
+
*/
|
|
33
|
+
export declare const ELEMENT_MARKER: ELEMENT_MARKER;
|
|
34
|
+
export interface ELEMENT_MARKER {
|
|
35
|
+
marker: 'element';
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Marks that the next string is for comment.
|
|
39
|
+
*
|
|
40
|
+
* See `I18nMutateOpCodes` documentation.
|
|
41
|
+
*/
|
|
42
|
+
export declare const COMMENT_MARKER: COMMENT_MARKER;
|
|
43
|
+
export interface COMMENT_MARKER {
|
|
44
|
+
marker: 'comment';
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Array storing OpCode for dynamically creating `i18n` blocks.
|
|
48
|
+
*
|
|
49
|
+
* Example:
|
|
50
|
+
* ```
|
|
51
|
+
* <I18nCreateOpCode>[
|
|
52
|
+
* // For adding text nodes
|
|
53
|
+
* // ---------------------
|
|
54
|
+
* // Equivalent to:
|
|
55
|
+
* // const node = lViewData[index++] = document.createTextNode('abc');
|
|
56
|
+
* // lViewData[1].insertBefore(node, lViewData[2]);
|
|
57
|
+
* 'abc', 1 << SHIFT_PARENT | 2 << SHIFT_REF | InsertBefore,
|
|
58
|
+
*
|
|
59
|
+
* // Equivalent to:
|
|
60
|
+
* // const node = lViewData[index++] = document.createTextNode('xyz');
|
|
61
|
+
* // lViewData[1].appendChild(node);
|
|
62
|
+
* 'xyz', 1 << SHIFT_PARENT | AppendChild,
|
|
63
|
+
*
|
|
64
|
+
* // For adding element nodes
|
|
65
|
+
* // ---------------------
|
|
66
|
+
* // Equivalent to:
|
|
67
|
+
* // const node = lViewData[index++] = document.createElement('div');
|
|
68
|
+
* // lViewData[1].insertBefore(node, lViewData[2]);
|
|
69
|
+
* ELEMENT_MARKER, 'div', 1 << SHIFT_PARENT | 2 << SHIFT_REF | InsertBefore,
|
|
70
|
+
*
|
|
71
|
+
* // Equivalent to:
|
|
72
|
+
* // const node = lViewData[index++] = document.createElement('div');
|
|
73
|
+
* // lViewData[1].appendChild(node);
|
|
74
|
+
* ELEMENT_MARKER, 'div', 1 << SHIFT_PARENT | AppendChild,
|
|
75
|
+
*
|
|
76
|
+
* // For adding comment nodes
|
|
77
|
+
* // ---------------------
|
|
78
|
+
* // Equivalent to:
|
|
79
|
+
* // const node = lViewData[index++] = document.createComment('');
|
|
80
|
+
* // lViewData[1].insertBefore(node, lViewData[2]);
|
|
81
|
+
* COMMENT_MARKER, '', 1 << SHIFT_PARENT | 2 << SHIFT_REF | InsertBefore,
|
|
82
|
+
*
|
|
83
|
+
* // Equivalent to:
|
|
84
|
+
* // const node = lViewData[index++] = document.createComment('');
|
|
85
|
+
* // lViewData[1].appendChild(node);
|
|
86
|
+
* COMMENT_MARKER, '', 1 << SHIFT_PARENT | AppendChild,
|
|
87
|
+
*
|
|
88
|
+
* // For moving existing nodes to a different location
|
|
89
|
+
* // --------------------------------------------------
|
|
90
|
+
* // Equivalent to:
|
|
91
|
+
* // const node = lViewData[1];
|
|
92
|
+
* // lViewData[2].insertBefore(node, lViewData[3]);
|
|
93
|
+
* 1 << SHIFT_REF | Select, 2 << SHIFT_PARENT | 3 << SHIFT_REF | InsertBefore,
|
|
94
|
+
*
|
|
95
|
+
* // Equivalent to:
|
|
96
|
+
* // const node = lViewData[1];
|
|
97
|
+
* // lViewData[2].appendChild(node);
|
|
98
|
+
* 1 << SHIFT_REF | Select, 2 << SHIFT_PARENT | AppendChild,
|
|
99
|
+
*
|
|
100
|
+
* // For removing existing nodes
|
|
101
|
+
* // --------------------------------------------------
|
|
102
|
+
* // const node = lViewData[1];
|
|
103
|
+
* // lViewData[2].remove(node);
|
|
104
|
+
* 2 << SHIFT_PARENT | 1 << SHIFT_REF | Remove,
|
|
105
|
+
*
|
|
106
|
+
* // For writing attributes
|
|
107
|
+
* // --------------------------------------------------
|
|
108
|
+
* // const node = lViewData[1];
|
|
109
|
+
* // node.setAttribute('attr', 'value');
|
|
110
|
+
* 1 << SHIFT_REF | Select, 'attr', 'value'
|
|
111
|
+
* // NOTE: Select followed by two string (vs select followed by OpCode)
|
|
112
|
+
* ];
|
|
113
|
+
* ```
|
|
114
|
+
* NOTE:
|
|
115
|
+
* - `index` is initial location where the extra nodes should be stored in the EXPANDO section of
|
|
116
|
+
* `LVIewData`.
|
|
117
|
+
*
|
|
118
|
+
* See: `applyI18nCreateOpCodes`;
|
|
119
|
+
*/
|
|
120
|
+
export interface I18nMutateOpCodes extends Array<number | string | ELEMENT_MARKER | COMMENT_MARKER | null> {
|
|
121
|
+
}
|
|
122
|
+
export declare const enum I18nUpdateOpCode {
|
|
123
|
+
SHIFT_REF = 2,
|
|
124
|
+
SHIFT_ICU = 17,
|
|
125
|
+
MASK_OPCODE = 3,
|
|
126
|
+
MASK_REF = 68,
|
|
127
|
+
Text = 0,
|
|
128
|
+
Attr = 1,
|
|
129
|
+
IcuSwitch = 2,
|
|
130
|
+
IcuUpdate = 3
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Stores DOM operations which need to be applied to update DOM render tree due to changes in
|
|
134
|
+
* expressions.
|
|
135
|
+
*
|
|
136
|
+
* The basic idea is that `i18nExp` OpCodes capture expression changes and update a change
|
|
137
|
+
* mask bit. (Bit 1 for expression 1, bit 2 for expression 2 etc..., bit 32 for expression 32 and
|
|
138
|
+
* higher.) The OpCodes then compare its own change mask against the expression change mask to
|
|
139
|
+
* determine if the OpCodes should execute.
|
|
140
|
+
*
|
|
141
|
+
* These OpCodes can be used by both the i18n block as well as ICU sub-block.
|
|
142
|
+
*
|
|
143
|
+
* ## Example
|
|
144
|
+
*
|
|
145
|
+
* Assume
|
|
146
|
+
* ```
|
|
147
|
+
* if (rf & RenderFlags.Update) {
|
|
148
|
+
* i18nExp(bind(ctx.exp1)); // If changed set mask bit 1
|
|
149
|
+
* i18nExp(bind(ctx.exp2)); // If changed set mask bit 2
|
|
150
|
+
* i18nExp(bind(ctx.exp3)); // If changed set mask bit 3
|
|
151
|
+
* i18nExp(bind(ctx.exp4)); // If changed set mask bit 4
|
|
152
|
+
* i18nApply(0); // Apply all changes by executing the OpCodes.
|
|
153
|
+
* }
|
|
154
|
+
* ```
|
|
155
|
+
* We can assume that each call to `i18nExp` sets an internal `changeMask` bit depending on the
|
|
156
|
+
* index of `i18nExp` index.
|
|
157
|
+
*
|
|
158
|
+
* OpCodes
|
|
159
|
+
* ```
|
|
160
|
+
* <I18nUpdateOpCodes>[
|
|
161
|
+
* // The following OpCodes represent: `<div i18n-title="pre{{exp1}}in{{exp2}}post">`
|
|
162
|
+
* // If `changeMask & 0b11`
|
|
163
|
+
* // has changed then execute update OpCodes.
|
|
164
|
+
* // has NOT changed then skip `7` values and start processing next OpCodes.
|
|
165
|
+
* 0b11, 7,
|
|
166
|
+
* // Concatenate `newValue = 'pre'+lViewData[bindIndex-4]+'in'+lViewData[bindIndex-3]+'post';`.
|
|
167
|
+
* 'pre', -4, 'in', -3, 'post',
|
|
168
|
+
* // Update attribute: `elementAttribute(1, 'title', sanitizerFn(newValue));`
|
|
169
|
+
* 1 << SHIFT_REF | Attr, 'title', sanitizerFn,
|
|
170
|
+
*
|
|
171
|
+
* // The following OpCodes represent: `<div i18n>Hello {{exp3}}!">`
|
|
172
|
+
* // If `changeMask & 0b100`
|
|
173
|
+
* // has changed then execute update OpCodes.
|
|
174
|
+
* // has NOT changed then skip `4` values and start processing next OpCodes.
|
|
175
|
+
* 0b100, 4,
|
|
176
|
+
* // Concatenate `newValue = 'Hello ' + lViewData[bindIndex -2] + '!';`.
|
|
177
|
+
* 'Hello ', -2, '!',
|
|
178
|
+
* // Update text: `lViewData[1].textContent = newValue;`
|
|
179
|
+
* 1 << SHIFT_REF | Text,
|
|
180
|
+
*
|
|
181
|
+
* // The following OpCodes represent: `<div i18n>{exp4, plural, ... }">`
|
|
182
|
+
* // If `changeMask & 0b1000`
|
|
183
|
+
* // has changed then execute update OpCodes.
|
|
184
|
+
* // has NOT changed then skip `4` values and start processing next OpCodes.
|
|
185
|
+
* 0b1000, 4,
|
|
186
|
+
* // Concatenate `newValue = lViewData[bindIndex -1];`.
|
|
187
|
+
* -1,
|
|
188
|
+
* // Switch ICU: `icuSwitchCase(lViewData[1], 0, newValue);`
|
|
189
|
+
* 0 << SHIFT_ICU | 1 << SHIFT_REF | IcuSwitch,
|
|
190
|
+
*
|
|
191
|
+
* // Note `changeMask & -1` is always true, so the IcuUpdate will always execute.
|
|
192
|
+
* -1, 1,
|
|
193
|
+
* // Update ICU: `icuUpdateCase(lViewData[1], 0);`
|
|
194
|
+
* 0 << SHIFT_ICU | 1 << SHIFT_REF | IcuUpdate,
|
|
195
|
+
*
|
|
196
|
+
* ];
|
|
197
|
+
* ```
|
|
198
|
+
*
|
|
199
|
+
*/
|
|
200
|
+
export interface I18nUpdateOpCodes extends Array<string | number | ((text: string) => string | null)> {
|
|
201
|
+
}
|
|
202
|
+
/**
|
|
203
|
+
* Store information for the i18n translation block.
|
|
204
|
+
*/
|
|
205
|
+
export interface TI18n {
|
|
206
|
+
/**
|
|
207
|
+
* Number of slots to allocate in expando.
|
|
208
|
+
*
|
|
209
|
+
* This is the max number of DOM elements which will be created by this i18n + ICU blocks. When
|
|
210
|
+
* the DOM elements are being created they are stored in the EXPANDO, so that update OpCodes can
|
|
211
|
+
* write into them.
|
|
212
|
+
*/
|
|
213
|
+
vars: number;
|
|
214
|
+
/**
|
|
215
|
+
* Index in EXPANDO where the i18n stores its DOM nodes.
|
|
216
|
+
*
|
|
217
|
+
* When the bindings are processed by the `i18nEnd` instruction it is necessary to know where the
|
|
218
|
+
* newly created DOM nodes will be inserted.
|
|
219
|
+
*/
|
|
220
|
+
expandoStartIndex: number;
|
|
221
|
+
/**
|
|
222
|
+
* A set of OpCodes which will create the Text Nodes and ICU anchors for the translation blocks.
|
|
223
|
+
*
|
|
224
|
+
* NOTE: The ICU anchors are filled in with ICU Update OpCode.
|
|
225
|
+
*/
|
|
226
|
+
create: I18nMutateOpCodes;
|
|
227
|
+
/**
|
|
228
|
+
* A set of OpCodes which will be executed on each change detection to determine if any changes to
|
|
229
|
+
* DOM are required.
|
|
230
|
+
*/
|
|
231
|
+
update: I18nUpdateOpCodes;
|
|
232
|
+
/**
|
|
233
|
+
* A list of ICUs in a translation block (or `null` if block has no ICUs).
|
|
234
|
+
*
|
|
235
|
+
* Example:
|
|
236
|
+
* Given: `<div i18n>You have {count, plural, ...} and {state, switch, ...}</div>`
|
|
237
|
+
* There would be 2 ICUs in this array.
|
|
238
|
+
* 1. `{count, plural, ...}`
|
|
239
|
+
* 2. `{state, switch, ...}`
|
|
240
|
+
*/
|
|
241
|
+
icus: TIcu[] | null;
|
|
242
|
+
}
|
|
243
|
+
/**
|
|
244
|
+
* Defines the ICU type of `select` or `plural`
|
|
245
|
+
*/
|
|
246
|
+
export declare const enum IcuType {
|
|
247
|
+
select = 0,
|
|
248
|
+
plural = 1
|
|
249
|
+
}
|
|
250
|
+
export interface TIcu {
|
|
251
|
+
/**
|
|
252
|
+
* Defines the ICU type of `select` or `plural`
|
|
253
|
+
*/
|
|
254
|
+
type: IcuType;
|
|
255
|
+
/**
|
|
256
|
+
* Number of slots to allocate in expando for each case.
|
|
257
|
+
*
|
|
258
|
+
* This is the max number of DOM elements which will be created by this i18n + ICU blocks. When
|
|
259
|
+
* the DOM elements are being created they are stored in the EXPANDO, so that update OpCodes can
|
|
260
|
+
* write into them.
|
|
261
|
+
*/
|
|
262
|
+
vars: number[];
|
|
263
|
+
/**
|
|
264
|
+
* An optional array of child/sub ICUs.
|
|
265
|
+
*
|
|
266
|
+
* In case of nested ICUs such as:
|
|
267
|
+
* ```
|
|
268
|
+
* {�0�, plural,
|
|
269
|
+
* =0 {zero}
|
|
270
|
+
* other {�0� {�1�, select,
|
|
271
|
+
* cat {cats}
|
|
272
|
+
* dog {dogs}
|
|
273
|
+
* other {animals}
|
|
274
|
+
* }!
|
|
275
|
+
* }
|
|
276
|
+
* }
|
|
277
|
+
* ```
|
|
278
|
+
* When the parent ICU is changing it must clean up child ICUs as well. For this reason it needs
|
|
279
|
+
* to know which child ICUs to run clean up for as well.
|
|
280
|
+
*
|
|
281
|
+
* In the above example this would be:
|
|
282
|
+
* ```
|
|
283
|
+
* [
|
|
284
|
+
* [], // `=0` has no sub ICUs
|
|
285
|
+
* [1], // `other` has one subICU at `1`st index.
|
|
286
|
+
* ]
|
|
287
|
+
* ```
|
|
288
|
+
*
|
|
289
|
+
* The reason why it is Array of Arrays is because first array represents the case, and second
|
|
290
|
+
* represents the child ICUs to clean up. There may be more than one child ICUs per case.
|
|
291
|
+
*/
|
|
292
|
+
childIcus: number[][];
|
|
293
|
+
/**
|
|
294
|
+
* Index in EXPANDO where the i18n stores its DOM nodes.
|
|
295
|
+
*
|
|
296
|
+
* When the bindings are processed by the `i18nEnd` instruction it is necessary to know where the
|
|
297
|
+
* newly created DOM nodes will be inserted.
|
|
298
|
+
*/
|
|
299
|
+
expandoStartIndex: number;
|
|
300
|
+
/**
|
|
301
|
+
* A list of case values which the current ICU will try to match.
|
|
302
|
+
*
|
|
303
|
+
* The last value is `other`
|
|
304
|
+
*/
|
|
305
|
+
cases: any[];
|
|
306
|
+
/**
|
|
307
|
+
* A set of OpCodes to apply in order to build up the DOM render tree for the ICU
|
|
308
|
+
*/
|
|
309
|
+
create: I18nMutateOpCodes[];
|
|
310
|
+
/**
|
|
311
|
+
* A set of OpCodes to apply in order to destroy the DOM render tree for the ICU.
|
|
312
|
+
*/
|
|
313
|
+
remove: I18nMutateOpCodes[];
|
|
314
|
+
/**
|
|
315
|
+
* A set of OpCodes to apply in order to update the DOM render tree for the ICU bindings.
|
|
316
|
+
*/
|
|
317
|
+
update: I18nUpdateOpCodes[];
|
|
318
|
+
}
|
|
319
|
+
/**
|
|
320
|
+
* Stores currently selected case in each ICU.
|
|
321
|
+
*
|
|
322
|
+
* For each ICU in translation, the `Li18n` stores the currently selected case for the current
|
|
323
|
+
* `LView`. For perf reasons this array is only created if a translation block has an ICU.
|
|
324
|
+
*/
|
|
325
|
+
export interface LI18n extends Array<number> {
|
|
326
|
+
}
|
|
@@ -5,13 +5,11 @@
|
|
|
5
5
|
* Use of this source code is governed by an MIT-style license that can be
|
|
6
6
|
* found in the LICENSE file at https://angular.io/license
|
|
7
7
|
*/
|
|
8
|
-
import { LContainer } from './container';
|
|
9
|
-
import { RComment, RElement, RText } from './renderer';
|
|
10
8
|
import { StylingContext } from './styling';
|
|
11
9
|
import { LViewData, TView } from './view';
|
|
12
10
|
/**
|
|
13
11
|
* TNodeType corresponds to the TNode.type property. It contains information
|
|
14
|
-
* on how to map a particular set of bits in
|
|
12
|
+
* on how to map a particular set of bits in TNode.flags to the node type.
|
|
15
13
|
*/
|
|
16
14
|
export declare const enum TNodeType {
|
|
17
15
|
Container = 0,
|
|
@@ -36,77 +34,6 @@ export declare const enum TNodeFlags {
|
|
|
36
34
|
/** The index of the first directive on this node is encoded on the most significant bits */
|
|
37
35
|
DirectiveStartingIndexShift = 15
|
|
38
36
|
}
|
|
39
|
-
/**
|
|
40
|
-
* LNode is an internal data structure which is used for the incremental DOM algorithm.
|
|
41
|
-
* The "L" stands for "Logical" to differentiate between `RNodes` (actual rendered DOM
|
|
42
|
-
* node) and our logical representation of DOM nodes, `LNodes`.
|
|
43
|
-
*
|
|
44
|
-
* The data structure is optimized for speed and size.
|
|
45
|
-
*
|
|
46
|
-
* In order to be fast, all subtypes of `LNode` should have the same shape.
|
|
47
|
-
* Because size of the `LNode` matters, many fields have multiple roles depending
|
|
48
|
-
* on the `LNode` subtype.
|
|
49
|
-
*
|
|
50
|
-
* See: https://en.wikipedia.org/wiki/Inline_caching#Monomorphic_inline_caching
|
|
51
|
-
*
|
|
52
|
-
* NOTE: This is a private data structure and should not be exported by any of the
|
|
53
|
-
* instructions.
|
|
54
|
-
*/
|
|
55
|
-
export interface LNode {
|
|
56
|
-
/**
|
|
57
|
-
* The associated DOM node. Storing this allows us to:
|
|
58
|
-
* - append children to their element parents in the DOM (e.g. `parent.native.appendChild(...)`)
|
|
59
|
-
* - retrieve the sibling elements of text nodes whose creation / insertion has been delayed
|
|
60
|
-
*/
|
|
61
|
-
readonly native: RComment | RElement | RText | null;
|
|
62
|
-
/**
|
|
63
|
-
* If regular LElementNode, LTextNode, and LProjectionNode then `data` will be null.
|
|
64
|
-
* If LElementNode with component, then `data` contains LViewData.
|
|
65
|
-
* If LViewNode, then `data` contains the LViewData.
|
|
66
|
-
* If LContainerNode, then `data` contains LContainer.
|
|
67
|
-
*/
|
|
68
|
-
readonly data: LViewData | LContainer | null;
|
|
69
|
-
/**
|
|
70
|
-
* A pointer to an LContainerNode created by directives requesting ViewContainerRef
|
|
71
|
-
*/
|
|
72
|
-
dynamicLContainerNode: LContainerNode | null;
|
|
73
|
-
}
|
|
74
|
-
/** LNode representing an element. */
|
|
75
|
-
export interface LElementNode extends LNode {
|
|
76
|
-
/** The DOM element associated with this node. */
|
|
77
|
-
readonly native: RElement;
|
|
78
|
-
/** If Component then data has LView (light DOM) */
|
|
79
|
-
readonly data: LViewData | null;
|
|
80
|
-
}
|
|
81
|
-
/** LNode representing <ng-container>. */
|
|
82
|
-
export interface LElementContainerNode extends LNode {
|
|
83
|
-
/** The DOM comment associated with this node. */
|
|
84
|
-
readonly native: RComment;
|
|
85
|
-
readonly data: null;
|
|
86
|
-
}
|
|
87
|
-
/** LNode representing a #text node. */
|
|
88
|
-
export interface LTextNode extends LNode {
|
|
89
|
-
/** The text node associated with this node. */
|
|
90
|
-
native: RText;
|
|
91
|
-
readonly data: null;
|
|
92
|
-
dynamicLContainerNode: null;
|
|
93
|
-
}
|
|
94
|
-
/** Abstract node which contains root nodes of a view. */
|
|
95
|
-
export interface LViewNode extends LNode {
|
|
96
|
-
readonly native: null;
|
|
97
|
-
readonly data: LViewData;
|
|
98
|
-
dynamicLContainerNode: null;
|
|
99
|
-
}
|
|
100
|
-
/** Abstract node container which contains other views. */
|
|
101
|
-
export interface LContainerNode extends LNode {
|
|
102
|
-
native: RComment;
|
|
103
|
-
readonly data: LContainer;
|
|
104
|
-
}
|
|
105
|
-
export interface LProjectionNode extends LNode {
|
|
106
|
-
readonly native: null;
|
|
107
|
-
readonly data: null;
|
|
108
|
-
dynamicLContainerNode: null;
|
|
109
|
-
}
|
|
110
37
|
/**
|
|
111
38
|
* A set of marker values to be used in the attributes arrays. Those markers indicate that some
|
|
112
39
|
* items are not regular attributes and the processing should be adapted accordingly.
|
|
@@ -133,7 +60,7 @@ export declare const enum AttributeMarker {
|
|
|
133
60
|
*/
|
|
134
61
|
export declare type TAttributes = (string | AttributeMarker)[];
|
|
135
62
|
/**
|
|
136
|
-
*
|
|
63
|
+
* Binding data (flyweight) for a particular node that is shared between all templates
|
|
137
64
|
* of a specific type.
|
|
138
65
|
*
|
|
139
66
|
* If a property is:
|
|
@@ -147,9 +74,9 @@ export interface TNode {
|
|
|
147
74
|
/** The type of the TNode. See TNodeType. */
|
|
148
75
|
type: TNodeType;
|
|
149
76
|
/**
|
|
150
|
-
* Index of the TNode in TView.data and corresponding
|
|
77
|
+
* Index of the TNode in TView.data and corresponding native element in LViewData.
|
|
151
78
|
*
|
|
152
|
-
* This is necessary to get from any TNode to its corresponding
|
|
79
|
+
* This is necessary to get from any TNode to its corresponding native element when
|
|
153
80
|
* traversing the node tree.
|
|
154
81
|
*
|
|
155
82
|
* If index is -1, this is a dynamically created container node or embedded view node.
|
|
@@ -233,7 +160,7 @@ export interface TNode {
|
|
|
233
160
|
/**
|
|
234
161
|
* The TView or TViews attached to this node.
|
|
235
162
|
*
|
|
236
|
-
* If this TNode corresponds to an
|
|
163
|
+
* If this TNode corresponds to an LContainer with inline views, the container will
|
|
237
164
|
* need to store separate static data for each of its view blocks (TView[]). Otherwise,
|
|
238
165
|
* nodes in inline views with the same index as nodes in their parent views will overwrite
|
|
239
166
|
* each other, as they are in the same template.
|
|
@@ -245,10 +172,10 @@ export interface TNode {
|
|
|
245
172
|
* [{tagName: 'div', attrs: ...}, null], // V(0) TView
|
|
246
173
|
* [{tagName: 'button', attrs ...}, null] // V(1) TView
|
|
247
174
|
*
|
|
248
|
-
* If this TNode corresponds to an
|
|
175
|
+
* If this TNode corresponds to an LContainer with a template (e.g. structural
|
|
249
176
|
* directive), the template's TView will be stored here.
|
|
250
177
|
*
|
|
251
|
-
* If this TNode corresponds to an
|
|
178
|
+
* If this TNode corresponds to an element, tViews will be null .
|
|
252
179
|
*/
|
|
253
180
|
tViews: TView | TView[] | null;
|
|
254
181
|
/**
|
|
@@ -278,10 +205,6 @@ export interface TNode {
|
|
|
278
205
|
* If this is an inline view node (V), the parent will be its container.
|
|
279
206
|
*/
|
|
280
207
|
parent: TElementNode | TContainerNode | null;
|
|
281
|
-
/**
|
|
282
|
-
* A pointer to a TContainerNode created by directives requesting ViewContainerRef
|
|
283
|
-
*/
|
|
284
|
-
dynamicContainerNode: TNode | null;
|
|
285
208
|
/**
|
|
286
209
|
* If this node is part of an i18n block, it indicates whether this container is part of the DOM
|
|
287
210
|
* If this node is not part of an i18n block, this field is null.
|
|
@@ -326,7 +249,7 @@ export interface TNode {
|
|
|
326
249
|
*/
|
|
327
250
|
projection: (TNode | null)[] | number | null;
|
|
328
251
|
}
|
|
329
|
-
/** Static data for an
|
|
252
|
+
/** Static data for an element */
|
|
330
253
|
export interface TElementNode extends TNode {
|
|
331
254
|
/** Index in the data[] array */
|
|
332
255
|
index: number;
|
|
@@ -345,7 +268,7 @@ export interface TElementNode extends TNode {
|
|
|
345
268
|
*/
|
|
346
269
|
projection: (TNode | null)[] | null;
|
|
347
270
|
}
|
|
348
|
-
/** Static data for
|
|
271
|
+
/** Static data for a text node */
|
|
349
272
|
export interface TTextNode extends TNode {
|
|
350
273
|
/** Index in the data[] array */
|
|
351
274
|
index: number;
|
|
@@ -359,7 +282,7 @@ export interface TTextNode extends TNode {
|
|
|
359
282
|
tViews: null;
|
|
360
283
|
projection: null;
|
|
361
284
|
}
|
|
362
|
-
/** Static data for an
|
|
285
|
+
/** Static data for an LContainer */
|
|
363
286
|
export interface TContainerNode extends TNode {
|
|
364
287
|
/**
|
|
365
288
|
* Index in the data[] array.
|
|
@@ -379,7 +302,7 @@ export interface TContainerNode extends TNode {
|
|
|
379
302
|
tViews: TView | TView[] | null;
|
|
380
303
|
projection: null;
|
|
381
304
|
}
|
|
382
|
-
/** Static data for an
|
|
305
|
+
/** Static data for an <ng-container> */
|
|
383
306
|
export interface TElementContainerNode extends TNode {
|
|
384
307
|
/** Index in the LViewData[] array. */
|
|
385
308
|
index: number;
|
|
@@ -388,7 +311,7 @@ export interface TElementContainerNode extends TNode {
|
|
|
388
311
|
tViews: null;
|
|
389
312
|
projection: null;
|
|
390
313
|
}
|
|
391
|
-
/** Static data for
|
|
314
|
+
/** Static data for a view */
|
|
392
315
|
export interface TViewNode extends TNode {
|
|
393
316
|
/** If -1, it's a dynamically created view. Otherwise, it is the view block ID. */
|
|
394
317
|
index: number;
|
|
@@ -17,6 +17,43 @@ export interface Player {
|
|
|
17
17
|
destroy(): void;
|
|
18
18
|
addEventListener(state: PlayState | string, cb: (data?: any) => any): void;
|
|
19
19
|
}
|
|
20
|
+
export declare const enum BindingType {
|
|
21
|
+
Unset = 0,
|
|
22
|
+
Class = 2,
|
|
23
|
+
Style = 3
|
|
24
|
+
}
|
|
25
|
+
export interface BindingStore {
|
|
26
|
+
setValue(prop: string, value: any): void;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Defines the shape which produces the Player.
|
|
30
|
+
*
|
|
31
|
+
* Used to produce a player that will be placed on an element that contains
|
|
32
|
+
* styling bindings that make use of the player. This function is designed
|
|
33
|
+
* to be used with `PlayerFactory`.
|
|
34
|
+
*/
|
|
35
|
+
export interface PlayerFactoryBuildFn {
|
|
36
|
+
(element: HTMLElement, type: BindingType, values: {
|
|
37
|
+
[key: string]: any;
|
|
38
|
+
}, currentPlayer: Player | null): Player | null;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Used as a reference to build a player from a styling template binding
|
|
42
|
+
* (`[style]` and `[class]`).
|
|
43
|
+
*
|
|
44
|
+
* The `fn` function will be called once any styling-related changes are
|
|
45
|
+
* evaluated on an element and is expected to return a player that will
|
|
46
|
+
* be then run on the element.
|
|
47
|
+
*
|
|
48
|
+
* `[style]`, `[style.prop]`, `[class]` and `[class.name]` template bindings
|
|
49
|
+
* all accept a `PlayerFactory` as input and this player factories.
|
|
50
|
+
*/
|
|
51
|
+
export interface PlayerFactory {
|
|
52
|
+
'__brand__': 'Brand for PlayerFactory that nothing will match';
|
|
53
|
+
}
|
|
54
|
+
export interface PlayerBuilder extends BindingStore {
|
|
55
|
+
buildPlayer(currentPlayer: Player | null): Player | undefined | null;
|
|
56
|
+
}
|
|
20
57
|
/**
|
|
21
58
|
* The state of a given player
|
|
22
59
|
*
|
|
@@ -32,11 +69,15 @@ export declare const enum PlayState {
|
|
|
32
69
|
Destroyed = 200
|
|
33
70
|
}
|
|
34
71
|
/**
|
|
35
|
-
* The context that stores all active
|
|
72
|
+
* The context that stores all the active players and queued player factories present on an element.
|
|
36
73
|
*/
|
|
37
|
-
export
|
|
38
|
-
|
|
39
|
-
|
|
74
|
+
export interface PlayerContext extends Array<null | number | Player | PlayerBuilder> {
|
|
75
|
+
[PlayerIndex.NonBuilderPlayersStart]: number;
|
|
76
|
+
[PlayerIndex.ClassMapPlayerBuilderPosition]: PlayerBuilder | null;
|
|
77
|
+
[PlayerIndex.ClassMapPlayerPosition]: Player | null;
|
|
78
|
+
[PlayerIndex.StyleMapPlayerBuilderPosition]: PlayerBuilder | null;
|
|
79
|
+
[PlayerIndex.StyleMapPlayerPosition]: Player | null;
|
|
80
|
+
}
|
|
40
81
|
/**
|
|
41
82
|
* Designed to be used as an injection service to capture all animation players.
|
|
42
83
|
*
|
|
@@ -55,3 +96,16 @@ export interface PlayerHandler {
|
|
|
55
96
|
*/
|
|
56
97
|
queuePlayer(player: Player, context: ComponentInstance | DirectiveInstance | HTMLElement): void;
|
|
57
98
|
}
|
|
99
|
+
export declare const enum PlayerIndex {
|
|
100
|
+
NonBuilderPlayersStart = 0,
|
|
101
|
+
ClassMapPlayerBuilderPosition = 1,
|
|
102
|
+
ClassMapPlayerPosition = 2,
|
|
103
|
+
StyleMapPlayerBuilderPosition = 3,
|
|
104
|
+
StyleMapPlayerPosition = 4,
|
|
105
|
+
PlayerBuildersStartPosition = 1,
|
|
106
|
+
SinglePlayerBuildersStartPosition = 5,
|
|
107
|
+
PlayerAndPlayerBuildersTupleSize = 2,
|
|
108
|
+
PlayerOffsetPosition = 1
|
|
109
|
+
}
|
|
110
|
+
export declare type ComponentInstance = {};
|
|
111
|
+
export declare type DirectiveInstance = {};
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* found in the LICENSE file at https://angular.io/license
|
|
7
7
|
*/
|
|
8
8
|
import { StyleSanitizeFn } from '../../sanitization/style_sanitizer';
|
|
9
|
-
import {
|
|
9
|
+
import { RElement } from '../interfaces/renderer';
|
|
10
10
|
import { PlayerContext } from './player';
|
|
11
11
|
/**
|
|
12
12
|
* The styling context acts as a styling manifest (shaped as an array) for determining which
|
|
@@ -115,11 +115,7 @@ import { PlayerContext } from './player';
|
|
|
115
115
|
*/
|
|
116
116
|
export interface StylingContext extends Array<InitialStyles | {
|
|
117
117
|
[key: string]: any;
|
|
118
|
-
} | number | string | boolean |
|
|
119
|
-
/**
|
|
120
|
-
* Location of element that is used as a target for this context.
|
|
121
|
-
*/
|
|
122
|
-
[StylingIndex.ElementPosition]: LElementNode | null;
|
|
118
|
+
} | number | string | boolean | RElement | StyleSanitizeFn | PlayerContext | null> {
|
|
123
119
|
/**
|
|
124
120
|
* Location of animation context (which contains the active players) for this element styling
|
|
125
121
|
* context.
|
|
@@ -145,6 +141,10 @@ export interface StylingContext extends Array<InitialStyles | {
|
|
|
145
141
|
* need to take into account any style values that exist in the context.
|
|
146
142
|
*/
|
|
147
143
|
[StylingIndex.ClassOffsetPosition]: number;
|
|
144
|
+
/**
|
|
145
|
+
* Location of element that is used as a target for this context.
|
|
146
|
+
*/
|
|
147
|
+
[StylingIndex.ElementPosition]: RElement | null;
|
|
148
148
|
/**
|
|
149
149
|
* The last class value that was interpreted by elementStylingMap. This is cached
|
|
150
150
|
* So that the algorithm can exit early incase the value has not changed.
|
|
@@ -180,24 +180,26 @@ export declare const enum StylingFlags {
|
|
|
180
180
|
Dirty = 1,
|
|
181
181
|
Class = 2,
|
|
182
182
|
Sanitize = 4,
|
|
183
|
-
|
|
184
|
-
|
|
183
|
+
PlayerBuildersDirty = 8,
|
|
184
|
+
BitCountSize = 4,
|
|
185
|
+
BitMask = 15
|
|
185
186
|
}
|
|
186
187
|
/** Used as numeric pointer values to determine what cells to update in the `StylingContext` */
|
|
187
188
|
export declare const enum StylingIndex {
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
189
|
+
PlayerContext = 0,
|
|
190
|
+
StyleSanitizerPosition = 1,
|
|
191
|
+
InitialStylesPosition = 2,
|
|
192
|
+
MasterFlagPosition = 3,
|
|
193
|
+
ClassOffsetPosition = 4,
|
|
194
|
+
ElementPosition = 5,
|
|
194
195
|
PreviousMultiClassValue = 6,
|
|
195
196
|
PreviousMultiStyleValue = 7,
|
|
196
197
|
SingleStylesStartPosition = 8,
|
|
197
198
|
FlagsOffset = 0,
|
|
198
199
|
PropertyOffset = 1,
|
|
199
200
|
ValueOffset = 2,
|
|
200
|
-
|
|
201
|
+
PlayerBuilderIndexOffset = 3,
|
|
202
|
+
Size = 4,
|
|
201
203
|
BitCountSize = 14,
|
|
202
204
|
BitMask = 16383
|
|
203
205
|
}
|