ember-source 7.1.0-alpha.3 → 7.1.0-alpha.5
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/build-metadata.json +3 -3
- package/dist/dev/packages/@ember/-internals/container/index.js +4 -401
- package/dist/dev/packages/@ember/-internals/deprecations/index.js +1 -1
- package/dist/dev/packages/@ember/-internals/environment/index.js +3 -151
- package/dist/dev/packages/@ember/-internals/glimmer/index.js +14 -15
- package/dist/dev/packages/@ember/-internals/meta/lib/meta.js +0 -1
- package/dist/dev/packages/@ember/-internals/metal/index.js +18 -9
- package/dist/dev/packages/@ember/-internals/routing/index.js +1 -10
- package/dist/dev/packages/@ember/-internals/runtime/lib/mixins/-proxy.js +10 -12
- package/dist/dev/packages/@ember/-internals/runtime/lib/mixins/action_handler.js +1 -10
- package/dist/dev/packages/@ember/-internals/runtime/lib/mixins/target_action_support.js +3 -10
- package/dist/dev/packages/@ember/-internals/string/index.js +0 -1
- package/dist/dev/packages/@ember/-internals/utils/index.js +8 -3
- package/dist/dev/packages/@ember/-internals/views/lib/compat/fallback-view-registry.js +0 -1
- package/dist/dev/packages/@ember/-internals/views/lib/mixins/action_support.js +3 -12
- package/dist/dev/packages/@ember/-internals/views/lib/system/event_dispatcher.js +2 -11
- package/dist/dev/packages/@ember/-internals/views/lib/system/utils.js +1 -1
- package/dist/dev/packages/@ember/-internals/views/lib/views/core_view.js +1 -18
- package/dist/dev/packages/@ember/-internals/views/lib/views/states.js +1 -1
- package/dist/dev/packages/@ember/application/index.js +5 -28
- package/dist/dev/packages/@ember/application/instance.js +3 -22
- package/dist/dev/packages/@ember/application/namespace.js +4 -11
- package/dist/dev/packages/@ember/array/index.js +7 -15
- package/dist/dev/packages/@ember/array/proxy.js +10 -14
- package/dist/dev/packages/@ember/canary-features/index.js +1 -1
- package/dist/dev/packages/@ember/component/helper.js +1 -14
- package/dist/dev/packages/@ember/component/index.js +1355 -16
- package/dist/dev/packages/@ember/component/template-only.js +1 -9
- package/dist/dev/packages/@ember/controller/index.js +3 -19
- package/dist/dev/packages/@ember/debug/container-debug-adapter.js +0 -19
- package/dist/dev/packages/@ember/debug/data-adapter.js +4 -11
- package/dist/dev/packages/@ember/debug/index.js +2 -1
- package/dist/dev/packages/@ember/debug/lib/deprecate.js +1 -1
- package/dist/dev/packages/@ember/engine/index.js +3 -29
- package/dist/dev/packages/@ember/engine/instance.js +3 -8
- package/dist/dev/packages/@ember/helper/index.js +211 -19
- package/dist/dev/packages/@ember/instrumentation/index.js +1 -1
- package/dist/dev/packages/@ember/modifier/index.js +2 -16
- package/dist/dev/packages/@ember/modifier/on.js +1 -9
- package/dist/dev/packages/@ember/object/-internals.js +3 -11
- package/dist/dev/packages/@ember/object/compat.js +3 -10
- package/dist/dev/packages/@ember/object/computed.js +2 -12
- package/dist/dev/packages/@ember/object/core.js +10 -18
- package/dist/dev/packages/@ember/object/evented.js +2 -12
- package/dist/dev/packages/@ember/object/events.js +1 -11
- package/dist/dev/packages/@ember/object/index.js +10 -14
- package/dist/dev/packages/@ember/object/internals.js +1 -1
- package/dist/dev/packages/@ember/object/lib/computed/computed_macros.js +6 -23
- package/dist/dev/packages/@ember/object/lib/computed/reduce_computed_macros.js +3 -12
- package/dist/dev/packages/@ember/object/mixin.js +7 -10
- package/dist/dev/packages/@ember/object/observable.js +8 -12
- package/dist/dev/packages/@ember/object/observers.js +1 -11
- package/dist/dev/packages/@ember/object/promise-proxy-mixin.js +3 -13
- package/dist/dev/packages/@ember/object/proxy.js +0 -7
- package/dist/dev/packages/@ember/reactive/collections.js +589 -1
- package/dist/dev/packages/@ember/renderer/index.js +1 -14
- package/dist/dev/packages/@ember/routing/-internals.js +1 -10
- package/dist/dev/packages/@ember/routing/index.js +614 -14
- package/dist/dev/packages/@ember/routing/lib/generate_controller.js +2 -11
- package/dist/dev/packages/@ember/routing/lib/routing-service.js +7 -17
- package/dist/dev/packages/@ember/routing/lib/utils.js +2 -11
- package/dist/dev/packages/@ember/routing/route.js +12 -23
- package/dist/dev/packages/@ember/routing/router-service.js +8 -17
- package/dist/dev/packages/@ember/routing/router.js +5 -21
- package/dist/dev/packages/@ember/runloop/index.js +1 -10
- package/dist/dev/packages/@ember/service/index.js +1 -11
- package/dist/dev/packages/@ember/template/index.js +1 -14
- package/dist/dev/packages/@ember/template-compiler/lib/compile-options.js +14 -15
- package/dist/dev/packages/@ember/template-compiler/lib/dasherize-component-name.js +0 -1
- package/dist/dev/packages/@ember/template-compiler/lib/plugins/auto-import-builtins.js +13 -42
- package/dist/dev/packages/@ember/template-compiler/lib/plugins/index.js +1 -1
- package/dist/dev/packages/@ember/template-compiler/lib/plugins/transform-resolutions.js +1 -3
- package/dist/dev/packages/@ember/template-compiler/lib/template.js +2 -10
- package/dist/dev/packages/@ember/template-factory/index.js +1 -8
- package/dist/dev/packages/@ember/utils/lib/compare.js +0 -7
- package/dist/dev/packages/@ember/utils/lib/is_empty.js +1 -12
- package/dist/dev/packages/@glimmer/manager/index.js +4 -314
- package/dist/dev/packages/@glimmer/node/index.js +3 -11
- package/dist/dev/packages/@glimmer/opcode-compiler/index.js +5 -7
- package/dist/dev/packages/@glimmer/program/index.js +194 -3
- package/dist/dev/packages/@glimmer/reference/index.js +4 -5
- package/dist/dev/packages/@glimmer/runtime/index.js +17 -10
- package/dist/dev/packages/@glimmer/tracking/index.js +2 -11
- package/dist/dev/packages/@glimmer/tracking/primitives/cache/index.js +1 -11
- package/dist/dev/packages/@glimmer/util/index.js +1 -2
- package/dist/dev/packages/@glimmer/validator/index.js +4 -1253
- package/dist/dev/packages/@glimmer/vm/index.js +1 -1
- package/dist/dev/packages/@glimmer/wire-format/index.js +3 -65
- package/dist/dev/packages/ember/version.js +1 -1
- package/dist/dev/packages/ember-template-compiler/index.js +7 -7
- package/dist/dev/packages/shared-chunks/{alias-CSC0WIbj.js → alias-ZcMQckQV.js} +8 -4
- package/dist/dev/packages/shared-chunks/api-AYt3zE12.js +310 -0
- package/dist/dev/packages/shared-chunks/{api-BqXkkT0p.js → api-WvJPuo9z.js} +4 -5
- package/dist/dev/packages/shared-chunks/{args-proxy-DgXMc9b5.js → args-proxy-BNLuRFlO.js} +2 -4
- package/dist/dev/packages/shared-chunks/{array-D8PfjQHi.js → array-Bh_kUjzy.js} +2 -1
- package/dist/dev/packages/shared-chunks/cache-B7dqAS38.js +596 -0
- package/dist/dev/packages/shared-chunks/{capabilities-O_xc7Yqk.js → capabilities-CZkuOqqC.js} +0 -5
- package/dist/dev/packages/shared-chunks/chain-tags-D6tuFUj_.js +190 -0
- package/dist/dev/packages/shared-chunks/{collections-D_nY_0UJ.js → collections-DPkjqeA3.js} +0 -1
- package/dist/dev/packages/shared-chunks/{compiler-D1leQ3Gl.js → compiler-CXB_8GdR.js} +7043 -234
- package/dist/dev/packages/shared-chunks/computed-CJnghmXC.js +980 -0
- package/dist/dev/packages/shared-chunks/container-BzzHmCNj.js +404 -0
- package/dist/dev/packages/shared-chunks/curly-CvC8E_4-.js +617 -0
- package/dist/dev/packages/shared-chunks/{fragment-Cc5k9Oy4.js → curried-BVwSNqpf.js} +5 -288
- package/dist/dev/packages/shared-chunks/decorator-B5Uh5NFI.js +135 -0
- package/dist/dev/packages/shared-chunks/element-C-QcIABg.js +109 -0
- package/dist/dev/packages/shared-chunks/element-builder-kHVx0F__.js +812 -0
- package/dist/dev/packages/shared-chunks/env-g-kaAFLN.js +161 -0
- package/dist/dev/packages/shared-chunks/events-6aFVjD4k.js +180 -0
- package/dist/dev/packages/shared-chunks/get-CpJjYeJO.js +138 -0
- package/dist/dev/packages/shared-chunks/get-debug-name-CSniHBsn.js +45 -0
- package/dist/dev/packages/shared-chunks/get_properties-CIm8IAtP.js +55 -0
- package/dist/dev/packages/shared-chunks/guid-Cbq2sNV_.js +123 -0
- package/dist/dev/packages/shared-chunks/hash-D3BENmhU.js +192 -0
- package/dist/dev/packages/shared-chunks/helper-DlC4YesW.js +314 -0
- package/dist/dev/packages/shared-chunks/index-CTxkmV78.js +2500 -0
- package/dist/dev/packages/shared-chunks/index-D-xTBV4B.js +220 -0
- package/dist/dev/packages/shared-chunks/{index-BUPd6pkm.js → index-DmGmwWPJ.js} +29 -29
- package/dist/dev/packages/shared-chunks/injected_property-B4T-FzZZ.js +70 -0
- package/dist/dev/packages/shared-chunks/intern-zquhAEIg.js +51 -0
- package/dist/dev/packages/shared-chunks/internal-CbQSKXEm.js +140 -0
- package/dist/dev/packages/shared-chunks/internal-helper-Dsl9_7H_.js +7 -0
- package/dist/dev/packages/shared-chunks/{invoke-CgfoEtMT.js → invoke-B6j6DdDz.js} +3 -7
- package/dist/{prod/packages/shared-chunks/is_proxy-Cr1qlMv_.js → dev/packages/shared-chunks/is_proxy-Bzg0d4m4.js} +1 -1
- package/dist/dev/packages/shared-chunks/libraries-CHBwbR72.js +79 -0
- package/dist/dev/packages/shared-chunks/mandatory-setter-BpbAMTzV.js +107 -0
- package/dist/dev/packages/shared-chunks/meta-BmRXesrk.js +46 -0
- package/dist/{prod/packages/shared-chunks/name-C68GLLO3.js → dev/packages/shared-chunks/name-Clp4Vsod.js} +1 -1
- package/dist/dev/packages/shared-chunks/{namespace_search-uT8odThF.js → namespace_search-BfvzEQzN.js} +1 -2
- package/dist/dev/packages/shared-chunks/normalize-CKySQVU7.js +84 -0
- package/dist/dev/packages/shared-chunks/observers-C2DurkLG.js +199 -0
- package/dist/dev/packages/shared-chunks/on-D8QwT-eN.js +253 -0
- package/dist/dev/packages/shared-chunks/opcode-metadata-9iSW5JGP.js +285 -0
- package/dist/dev/packages/shared-chunks/opcodes-CplRyHl_.js +50 -0
- package/dist/dev/packages/shared-chunks/or-DBU9Ge4r.js +118 -0
- package/dist/{prod/packages/shared-chunks/program-B7SJZ5NF.js → dev/packages/shared-chunks/program-DzAfcWFj.js} +1 -1
- package/dist/dev/packages/shared-chunks/{program-context-sJz0oHOA.js → program-context-CqcQMsfa.js} +3 -3
- package/dist/dev/packages/shared-chunks/property_get-CIBS9umw.js +139 -0
- package/dist/dev/packages/shared-chunks/{property_set-DaoZXGM5.js → property_set-D3PKyisF.js} +4 -2
- package/dist/dev/packages/shared-chunks/props-fiqxqhAH.js +85 -0
- package/dist/dev/packages/shared-chunks/{reference-C3TKDRnP.js → reference-BoPB2LfI.js} +3 -4
- package/dist/dev/packages/shared-chunks/{registers-ylirb0dq.js → registers-DoamZwaG.js} +1 -1
- package/dist/{prod/packages/shared-chunks/rehydrate-builder-CUefZL4I.js → dev/packages/shared-chunks/rehydrate-builder-DdzXTaJk.js} +7 -4
- package/dist/dev/packages/shared-chunks/{render-C1HzKUcM.js → render-DDdabL30.js} +510 -15
- package/dist/{prod/packages/shared-chunks/serialize-builder-DgpXSc2Q.js → dev/packages/shared-chunks/serialize-builder-B3u9Wr3n.js} +2 -7
- package/dist/dev/packages/shared-chunks/set_properties-BghuuGJx.js +48 -0
- package/dist/dev/packages/shared-chunks/{setup-registry-B7-RknRf.js → setup-registry-XxD0xvgf.js} +34 -14
- package/dist/dev/packages/shared-chunks/spec-BXl1reqK.js +16 -0
- package/dist/dev/packages/shared-chunks/super-BBBjgF69.js +91 -0
- package/dist/dev/packages/shared-chunks/template-BRrQR6KS.js +16 -0
- package/dist/dev/packages/shared-chunks/template-only-Yluyu0DY.js +78 -0
- package/dist/dev/packages/shared-chunks/textarea-C0Us0PNJ.js +468 -0
- package/dist/dev/packages/shared-chunks/tracked-CKE4wnE6.js +148 -0
- package/dist/dev/packages/shared-chunks/tracked-data-CGnA4ytZ.js +31 -0
- package/dist/dev/packages/shared-chunks/transform-resolutions-h1ik8gqW.js +645 -0
- package/dist/dev/packages/shared-chunks/unique-id-A83bjEE-.js +32 -0
- package/dist/{prod/packages/shared-chunks/on-CLxdmpmk.js → dev/packages/shared-chunks/untouchable-this-cH6_N2LJ.js} +215 -1397
- package/dist/dev/packages/shared-chunks/well-known-_EVO9RaV.js +17 -0
- package/dist/prod/packages/@ember/-internals/container/index.js +5 -315
- package/dist/prod/packages/@ember/-internals/deprecations/index.js +1 -1
- package/dist/prod/packages/@ember/-internals/environment/index.js +3 -148
- package/dist/prod/packages/@ember/-internals/glimmer/index.js +14 -13
- package/dist/prod/packages/@ember/-internals/meta/lib/meta.js +1 -2
- package/dist/prod/packages/@ember/-internals/metal/index.js +19 -13
- package/dist/prod/packages/@ember/-internals/routing/index.js +2 -6
- package/dist/prod/packages/@ember/-internals/runtime/lib/ext/rsvp.js +1 -1
- package/dist/prod/packages/@ember/-internals/runtime/lib/mixins/-proxy.js +10 -10
- package/dist/prod/packages/@ember/-internals/runtime/lib/mixins/action_handler.js +2 -6
- package/dist/prod/packages/@ember/-internals/runtime/lib/mixins/registry_proxy.js +1 -1
- package/dist/prod/packages/@ember/-internals/runtime/lib/mixins/target_action_support.js +3 -6
- package/dist/prod/packages/@ember/-internals/string/index.js +0 -2
- package/dist/prod/packages/@ember/-internals/utils/index.js +33 -30
- package/dist/prod/packages/@ember/-internals/views/lib/compat/fallback-view-registry.js +0 -2
- package/dist/prod/packages/@ember/-internals/views/lib/mixins/action_support.js +2 -6
- package/dist/prod/packages/@ember/-internals/views/lib/system/event_dispatcher.js +3 -7
- package/dist/prod/packages/@ember/-internals/views/lib/system/utils.js +2 -2
- package/dist/prod/packages/@ember/-internals/views/lib/views/core_view.js +1 -14
- package/dist/prod/packages/@ember/-internals/views/lib/views/states.js +1 -2
- package/dist/prod/packages/@ember/application/index.js +5 -24
- package/dist/prod/packages/@ember/application/instance.js +6 -18
- package/dist/prod/packages/@ember/application/namespace.js +5 -8
- package/dist/prod/packages/@ember/array/index.js +8 -12
- package/dist/prod/packages/@ember/array/proxy.js +10 -10
- package/dist/prod/packages/@ember/canary-features/index.js +1 -1
- package/dist/prod/packages/@ember/component/helper.js +1 -12
- package/dist/prod/packages/@ember/component/index.js +1292 -15
- package/dist/prod/packages/@ember/component/template-only.js +1 -6
- package/dist/prod/packages/@ember/controller/index.js +3 -16
- package/dist/prod/packages/@ember/debug/container-debug-adapter.js +1 -15
- package/dist/prod/packages/@ember/debug/data-adapter.js +5 -7
- package/dist/prod/packages/@ember/debug/index.js +1 -0
- package/dist/prod/packages/@ember/debug/lib/deprecate.js +1 -1
- package/dist/prod/packages/@ember/engine/index.js +4 -25
- package/dist/prod/packages/@ember/engine/instance.js +4 -9
- package/dist/prod/packages/@ember/helper/index.js +211 -17
- package/dist/prod/packages/@ember/instrumentation/index.js +1 -1
- package/dist/prod/packages/@ember/modifier/index.js +2 -14
- package/dist/prod/packages/@ember/modifier/on.js +1 -6
- package/dist/prod/packages/@ember/object/-internals.js +3 -6
- package/dist/prod/packages/@ember/object/compat.js +4 -7
- package/dist/prod/packages/@ember/object/computed.js +2 -8
- package/dist/prod/packages/@ember/object/core.js +9 -15
- package/dist/prod/packages/@ember/object/evented.js +2 -7
- package/dist/prod/packages/@ember/object/events.js +1 -6
- package/dist/prod/packages/@ember/object/index.js +10 -12
- package/dist/prod/packages/@ember/object/internals.js +3 -6
- package/dist/prod/packages/@ember/object/lib/computed/computed_macros.js +6 -20
- package/dist/prod/packages/@ember/object/lib/computed/reduce_computed_macros.js +3 -9
- package/dist/prod/packages/@ember/object/mixin.js +7 -9
- package/dist/prod/packages/@ember/object/observable.js +8 -9
- package/dist/prod/packages/@ember/object/observers.js +1 -6
- package/dist/prod/packages/@ember/object/promise-proxy-mixin.js +3 -9
- package/dist/prod/packages/@ember/object/proxy.js +0 -7
- package/dist/prod/packages/@ember/reactive/collections.js +589 -1
- package/dist/prod/packages/@ember/renderer/index.js +1 -12
- package/dist/prod/packages/@ember/routing/history-location.js +1 -1
- package/dist/prod/packages/@ember/routing/index.js +581 -12
- package/dist/prod/packages/@ember/routing/lib/dsl.js +1 -1
- package/dist/prod/packages/@ember/routing/lib/generate_controller.js +2 -6
- package/dist/prod/packages/@ember/routing/lib/routing-service.js +5 -14
- package/dist/prod/packages/@ember/routing/lib/utils.js +2 -6
- package/dist/prod/packages/@ember/routing/none-location.js +1 -1
- package/dist/prod/packages/@ember/routing/route.js +12 -21
- package/dist/prod/packages/@ember/routing/router-service.js +6 -14
- package/dist/prod/packages/@ember/routing/router.js +5 -17
- package/dist/prod/packages/@ember/runloop/index.js +2 -6
- package/dist/prod/packages/@ember/service/index.js +1 -7
- package/dist/prod/packages/@ember/template/index.js +1 -12
- package/dist/prod/packages/@ember/template-compiler/lib/compile-options.js +15 -14
- package/dist/prod/packages/@ember/template-compiler/lib/dasherize-component-name.js +0 -2
- package/dist/prod/packages/@ember/template-compiler/lib/plugins/assert-against-attrs.js +1 -1
- package/dist/prod/packages/@ember/template-compiler/lib/plugins/assert-against-named-outlets.js +1 -1
- package/dist/prod/packages/@ember/template-compiler/lib/plugins/assert-input-helper-without-block.js +1 -1
- package/dist/prod/packages/@ember/template-compiler/lib/plugins/assert-reserved-named-arguments.js +1 -1
- package/dist/prod/packages/@ember/template-compiler/lib/plugins/auto-import-builtins.js +13 -42
- package/dist/prod/packages/@ember/template-compiler/lib/plugins/index.js +1 -1
- package/dist/prod/packages/@ember/template-compiler/lib/plugins/transform-each-track-array.js +1 -1
- package/dist/prod/packages/@ember/template-compiler/lib/plugins/transform-in-element.js +1 -1
- package/dist/prod/packages/@ember/template-compiler/lib/plugins/transform-resolutions.js +127 -4
- package/dist/prod/packages/@ember/template-compiler/lib/template.js +2 -7
- package/dist/prod/packages/@ember/template-factory/index.js +1 -5
- package/dist/prod/packages/@ember/utils/lib/compare.js +1 -8
- package/dist/prod/packages/@ember/utils/lib/is_empty.js +1 -7
- package/dist/prod/packages/@glimmer/manager/index.js +4 -292
- package/dist/prod/packages/@glimmer/node/index.js +3 -8
- package/dist/prod/packages/@glimmer/opcode-compiler/index.js +5 -5
- package/dist/prod/packages/@glimmer/program/index.js +194 -3
- package/dist/prod/packages/@glimmer/reference/index.js +4 -4
- package/dist/prod/packages/@glimmer/runtime/index.js +16 -8
- package/dist/prod/packages/@glimmer/tracking/index.js +2 -7
- package/dist/prod/packages/@glimmer/tracking/primitives/cache/index.js +1 -6
- package/dist/prod/packages/@glimmer/util/index.js +2 -2
- package/dist/prod/packages/@glimmer/validator/index.js +5 -1016
- package/dist/prod/packages/@glimmer/vm/index.js +1 -1
- package/dist/prod/packages/@glimmer/wire-format/index.js +3 -65
- package/dist/prod/packages/ember/version.js +1 -1
- package/dist/prod/packages/ember-template-compiler/index.js +5 -7
- package/dist/prod/packages/shared-chunks/{alias-BLBQkche.js → alias-CLuFeKoV.js} +8 -6
- package/dist/prod/packages/shared-chunks/api-CM1trl_4.js +289 -0
- package/dist/prod/packages/shared-chunks/{api-DtWa0ZaF.js → api-zh_k31vb.js} +4 -5
- package/dist/prod/packages/shared-chunks/{args-proxy-Dl0A0YWI.js → args-proxy-BDXbXCF9.js} +2 -2
- package/dist/prod/packages/shared-chunks/{array-kVQfzrQn.js → array-DHdr4__s.js} +3 -3
- package/dist/prod/packages/shared-chunks/assert-CUCJBR2C.js +19 -0
- package/dist/prod/packages/shared-chunks/cache-BIlOoPA7.js +371 -0
- package/dist/prod/packages/shared-chunks/{capabilities-DXA-L0iT.js → capabilities-_5e35539.js} +0 -3
- package/dist/prod/packages/shared-chunks/chain-tags-BJqcuCM1.js +179 -0
- package/dist/prod/packages/shared-chunks/{compiler-Bbki2GT_.js → compiler-DjQtTQGk.js} +7045 -193
- package/dist/prod/packages/shared-chunks/{namespace_search-Dcdalhj6.js → computed-2Udcmflw.js} +109 -239
- package/dist/prod/packages/shared-chunks/container-D5NwW5Fd.js +316 -0
- package/dist/prod/packages/shared-chunks/curly-BsqvV8G0.js +546 -0
- package/dist/prod/packages/shared-chunks/{fragment-D7nBU9ae.js → curried-BVwSNqpf.js} +6 -303
- package/dist/prod/packages/shared-chunks/debug-render-tree-BLtnOSbb.js +2049 -0
- package/dist/prod/packages/shared-chunks/{decorator-BdDDBUd2.js → decorator-DBCISop4.js} +1 -1
- package/dist/prod/packages/shared-chunks/element-BjFr0tO0.js +101 -0
- package/dist/prod/packages/shared-chunks/{element-builder-BmLF0C-1.js → element-builder-BPjq0rxK.js} +109 -88
- package/dist/prod/packages/shared-chunks/env-DXxsTFkM.js +158 -0
- package/dist/prod/packages/shared-chunks/events-970OxD6Q.js +175 -0
- package/dist/prod/packages/shared-chunks/get-D5wxdTkY.js +138 -0
- package/dist/prod/packages/shared-chunks/get_properties-BcAC5sGx.js +55 -0
- package/dist/prod/packages/shared-chunks/guid-Cbq2sNV_.js +123 -0
- package/dist/prod/packages/shared-chunks/hash-DcUe-meU.js +192 -0
- package/dist/prod/packages/shared-chunks/helper-Da672z4a.js +299 -0
- package/dist/prod/packages/shared-chunks/{index-CjaDF9kC.js → index--2U-v2nf.js} +18 -10
- package/dist/prod/packages/shared-chunks/index-D-xTBV4B.js +220 -0
- package/dist/prod/packages/shared-chunks/index-D87qoERP.js +2322 -0
- package/dist/prod/packages/shared-chunks/{injected_property-CTVs5FPh.js → injected_property-D9B-fPiH.js} +3 -3
- package/dist/prod/packages/shared-chunks/intern-zquhAEIg.js +51 -0
- package/dist/prod/packages/shared-chunks/internal-DidurjJB.js +137 -0
- package/dist/prod/packages/shared-chunks/internal-helper-DIbr1RgC.js +7 -0
- package/dist/prod/packages/shared-chunks/{invoke-BdJCXD-b.js → invoke-Dr_CRwA_.js} +3 -5
- package/dist/{dev/packages/shared-chunks/is_proxy-B0smdQy8.js → prod/packages/shared-chunks/is_proxy-Bzg0d4m4.js} +1 -1
- package/dist/prod/packages/shared-chunks/libraries-DaXpIDYN.js +60 -0
- package/dist/prod/packages/shared-chunks/meta-B9mldqPL.js +36 -0
- package/dist/{dev/packages/shared-chunks/name-Z7dpqvzn.js → prod/packages/shared-chunks/name-Clp4Vsod.js} +1 -1
- package/dist/prod/packages/shared-chunks/namespace_search-BfvzEQzN.js +134 -0
- package/dist/prod/packages/shared-chunks/normalize-D9jDJVGg.js +84 -0
- package/dist/prod/packages/shared-chunks/observers-Co4JALkS.js +199 -0
- package/dist/prod/packages/shared-chunks/on-C3ZQiUUD.js +228 -0
- package/dist/prod/packages/shared-chunks/opcode-metadata-9iSW5JGP.js +285 -0
- package/dist/prod/packages/shared-chunks/opcodes-CplRyHl_.js +50 -0
- package/dist/prod/packages/shared-chunks/or-oTVMuHc8.js +91 -0
- package/dist/{dev/packages/shared-chunks/program-DfV0v8aa.js → prod/packages/shared-chunks/program-B7CWdS8W.js} +1 -2
- package/dist/prod/packages/shared-chunks/{program-context-DFiwaPMR.js → program-context-CGMN-aQM.js} +3 -3
- package/dist/prod/packages/shared-chunks/property_get-hWJ0nGhW.js +122 -0
- package/dist/prod/packages/shared-chunks/{property_set-B2sZxeCw.js → property_set-Dj5-ScWk.js} +4 -5
- package/dist/prod/packages/shared-chunks/props-fiqxqhAH.js +85 -0
- package/dist/prod/packages/shared-chunks/{reference-BNqcwZWH.js → reference-BshxG6wn.js} +3 -3
- package/dist/prod/packages/shared-chunks/{registers-ylirb0dq.js → registers-DoamZwaG.js} +1 -1
- package/dist/{dev/packages/shared-chunks/rehydrate-builder-CEk2KOIk.js → prod/packages/shared-chunks/rehydrate-builder-BKg2X6Lo.js} +7 -7
- package/dist/prod/packages/shared-chunks/{render-BlriW61t.js → render-nx5-PsDW.js} +487 -12
- package/dist/{dev/packages/shared-chunks/serialize-builder-CPKxdfiH.js → prod/packages/shared-chunks/serialize-builder-BGbC30SN.js} +2 -10
- package/dist/prod/packages/shared-chunks/set_properties-oPyURk67.js +48 -0
- package/dist/prod/packages/shared-chunks/{setup-registry-DeObnZ2Z.js → setup-registry-TiaKLj5k.js} +35 -13
- package/dist/prod/packages/shared-chunks/spec-BXl1reqK.js +16 -0
- package/dist/prod/packages/shared-chunks/super-BBBjgF69.js +91 -0
- package/dist/prod/packages/shared-chunks/template-BRrQR6KS.js +16 -0
- package/dist/prod/packages/shared-chunks/template-only-BtLl0uH0.js +78 -0
- package/dist/prod/packages/shared-chunks/textarea-CPKZ1c_O.js +455 -0
- package/dist/prod/packages/shared-chunks/{tracked-Cl5l4v8b.js → tracked-CffAABMz.js} +6 -4
- package/dist/prod/packages/shared-chunks/tracked-data-C83f5V5S.js +31 -0
- package/dist/prod/packages/shared-chunks/unique-id-CfHImDRV.js +32 -0
- package/dist/prod/packages/shared-chunks/well-known-_EVO9RaV.js +17 -0
- package/docs/data.json +1368 -1031
- package/package.json +1 -1
- package/types/stable/@ember/-internals/container/lib/registry.d.ts +1 -1
- package/types/stable/@ember/-internals/deprecations/index.d.ts +1 -1
- package/types/stable/@ember/-internals/environment/lib/env.d.ts +11 -0
- package/types/stable/@ember/-internals/glimmer/index.d.ts +1 -1
- package/types/stable/@ember/-internals/glimmer/lib/component-managers/curly.d.ts +1 -1
- package/types/stable/@ember/-internals/glimmer/lib/component-managers/mount.d.ts +1 -1
- package/types/stable/@ember/-internals/glimmer/lib/component-managers/outlet.d.ts +1 -1
- package/types/stable/@ember/-internals/glimmer/lib/component-managers/route-template.d.ts +2 -2
- package/types/stable/@ember/-internals/glimmer/lib/component.d.ts +9 -7
- package/types/stable/@ember/-internals/glimmer/lib/components/abstract-input.d.ts +1 -1
- package/types/stable/@ember/-internals/glimmer/lib/dom.d.ts +6 -2
- package/types/stable/@ember/-internals/glimmer/lib/environment.d.ts +1 -1
- package/types/stable/@ember/-internals/glimmer/lib/helper.d.ts +1 -1
- package/types/stable/@ember/-internals/glimmer/lib/renderer.d.ts +3 -3
- package/types/stable/@ember/-internals/glimmer/lib/setup-registry.d.ts +1 -1
- package/types/stable/@ember/-internals/glimmer/lib/utils/bindings.d.ts +1 -1
- package/types/stable/@ember/-internals/glimmer/lib/utils/curly-component-state-bucket.d.ts +3 -2
- package/types/stable/@ember/-internals/glimmer/lib/utils/iterator.d.ts +1 -1
- package/types/stable/@ember/-internals/glimmer/lib/utils/managers.d.ts +2 -1
- package/types/stable/@ember/-internals/glimmer/lib/utils/serialization-first-node-helpers.d.ts +1 -1
- package/types/stable/@ember/-internals/glimmer/lib/utils/string.d.ts +1 -1
- package/types/stable/@ember/-internals/meta/lib/meta.d.ts +3 -2
- package/types/stable/@ember/-internals/metal/lib/cache.d.ts +1 -1
- package/types/stable/@ember/-internals/metal/lib/chain-tags.d.ts +3 -2
- package/types/stable/@ember/-internals/metal/lib/computed.d.ts +1 -1
- package/types/stable/@ember/-internals/metal/lib/decorator.d.ts +1 -1
- package/types/stable/@ember/-internals/metal/lib/deprecate_property.d.ts +1 -1
- package/types/stable/@ember/-internals/metal/lib/events.d.ts +1 -1
- package/types/stable/@ember/-internals/metal/lib/observer.d.ts +1 -1
- package/types/stable/@ember/-internals/metal/lib/properties.d.ts +1 -1
- package/types/stable/@ember/-internals/metal/lib/property_events.d.ts +1 -1
- package/types/stable/@ember/-internals/metal/lib/tags.d.ts +2 -1
- package/types/stable/@ember/-internals/runtime/lib/mixins/container_proxy.d.ts +1 -1
- package/types/stable/@ember/-internals/runtime/lib/mixins/registry_proxy.d.ts +1 -1
- package/types/stable/@ember/-internals/utils/lib/is_proxy.d.ts +1 -1
- package/types/stable/@ember/-internals/utils/lib/mandatory-setter.d.ts +1 -1
- package/types/stable/@ember/-internals/views/lib/system/utils.d.ts +1 -1
- package/types/stable/@ember/-internals/views/lib/views/core_view.d.ts +2 -2
- package/types/stable/@ember/-internals/views/lib/views/states.d.ts +1 -1
- package/types/stable/@ember/application/index.d.ts +5 -4
- package/types/stable/@ember/application/instance.d.ts +4 -3
- package/types/stable/@ember/application/namespace.d.ts +1 -1
- package/types/stable/@ember/array/proxy.d.ts +4 -3
- package/types/stable/@ember/component/helper.d.ts +1 -1
- package/types/stable/@ember/component/index.d.ts +6 -3
- package/types/stable/@ember/controller/index.d.ts +2 -2
- package/types/stable/@ember/debug/container-debug-adapter.d.ts +1 -1
- package/types/stable/@ember/engine/index.d.ts +3 -3
- package/types/stable/@ember/engine/instance.d.ts +4 -3
- package/types/stable/@ember/helper/index.d.ts +223 -3
- package/types/stable/@ember/modifier/index.d.ts +1 -1
- package/types/stable/@ember/object/-internals.d.ts +2 -2
- package/types/stable/@ember/object/compat.d.ts +2 -2
- package/types/stable/@ember/object/computed.d.ts +3 -1
- package/types/stable/@ember/object/evented.d.ts +1 -1
- package/types/stable/@ember/object/events.d.ts +1 -1
- package/types/stable/@ember/object/index.d.ts +8 -2
- package/types/stable/@ember/object/lib/computed/computed_macros.d.ts +1 -1
- package/types/stable/@ember/object/mixin.d.ts +1 -1
- package/types/stable/@ember/object/observers.d.ts +1 -1
- package/types/stable/@ember/object/proxy.d.ts +1 -1
- package/types/stable/@ember/reactive/collections.d.ts +6 -6
- package/types/stable/@ember/renderer/index.d.ts +2 -2
- package/types/stable/@ember/routing/index.d.ts +1 -1
- package/types/stable/@ember/routing/lib/controller_for.d.ts +2 -2
- package/types/stable/@ember/routing/route.d.ts +2 -2
- package/types/stable/@ember/routing/router.d.ts +2 -2
- package/types/stable/@ember/service/index.d.ts +1 -1
- package/types/stable/@ember/template/index.d.ts +1 -1
- package/types/stable/@ember/template-compiler/lib/dasherize-component-name.d.ts +1 -1
- package/types/stable/@ember/template-compiler/lib/plugins/assert-against-attrs.d.ts +1 -1
- package/types/stable/@ember/template-compiler/lib/plugins/assert-against-named-outlets.d.ts +1 -1
- package/types/stable/@ember/template-compiler/lib/plugins/assert-input-helper-without-block.d.ts +1 -1
- package/types/stable/@ember/template-compiler/lib/plugins/assert-reserved-named-arguments.d.ts +1 -1
- package/types/stable/@ember/template-compiler/lib/plugins/auto-import-builtins.d.ts +1 -4
- package/types/stable/@ember/template-compiler/lib/plugins/transform-action-syntax.d.ts +1 -1
- package/types/stable/@ember/template-compiler/lib/plugins/transform-each-in-into-each.d.ts +1 -1
- package/types/stable/@ember/template-compiler/lib/plugins/transform-each-track-array.d.ts +1 -1
- package/types/stable/@ember/template-compiler/lib/plugins/transform-in-element.d.ts +1 -1
- package/types/stable/@ember/template-compiler/lib/plugins/transform-quoted-bindings-into-just-bindings.d.ts +1 -1
- package/types/stable/@ember/template-compiler/lib/plugins/transform-resolutions.d.ts +1 -1
- package/types/stable/@ember/template-compiler/lib/plugins/transform-wrap-mount-and-outlet.d.ts +1 -1
- package/types/stable/@ember/template-compiler/lib/plugins/utils.d.ts +1 -1
- package/types/stable/@ember/template-compiler/lib/system/calculate-location-display.d.ts +1 -1
- package/types/stable/@ember/template-compiler/lib/types.d.ts +2 -1
- package/types/stable/@ember/template-factory/index.d.ts +1 -1
- package/types/stable/@glimmer/compiler/lib/builder/builder-interface.d.ts +2 -2
- package/types/stable/@glimmer/compiler/lib/builder/builder.d.ts +2 -2
- package/types/stable/@glimmer/compiler/lib/compiler.d.ts +1 -1
- package/types/stable/@glimmer/compiler/lib/passes/1-normalization/context.d.ts +2 -1
- package/types/stable/@glimmer/compiler/lib/passes/1-normalization/index.d.ts +2 -1
- package/types/stable/@glimmer/compiler/lib/passes/1-normalization/keywords/impl.d.ts +2 -1
- package/types/stable/@glimmer/compiler/lib/passes/1-normalization/keywords/utils/curry.d.ts +1 -1
- package/types/stable/@glimmer/compiler/lib/passes/1-normalization/keywords/utils/dynamic-vars.d.ts +1 -1
- package/types/stable/@glimmer/compiler/lib/passes/1-normalization/keywords/utils/has-block.d.ts +2 -1
- package/types/stable/@glimmer/compiler/lib/passes/1-normalization/keywords/utils/if-unless.d.ts +1 -1
- package/types/stable/@glimmer/compiler/lib/passes/1-normalization/keywords/utils/log.d.ts +1 -1
- package/types/stable/@glimmer/compiler/lib/passes/1-normalization/visitors/element/classified.d.ts +1 -1
- package/types/stable/@glimmer/compiler/lib/passes/1-normalization/visitors/element/component.d.ts +1 -1
- package/types/stable/@glimmer/compiler/lib/passes/1-normalization/visitors/element/simple-element.d.ts +2 -1
- package/types/stable/@glimmer/compiler/lib/passes/1-normalization/visitors/expressions.d.ts +1 -1
- package/types/stable/@glimmer/compiler/lib/passes/1-normalization/visitors/statements.d.ts +1 -1
- package/types/stable/@glimmer/compiler/lib/passes/1-normalization/visitors/strict-mode.d.ts +1 -1
- package/types/stable/@glimmer/compiler/lib/passes/2-encoding/expressions.d.ts +1 -1
- package/types/stable/@glimmer/compiler/lib/passes/2-encoding/mir.d.ts +3 -1
- package/types/stable/@glimmer/compiler/lib/shared/result.d.ts +1 -1
- package/types/stable/@glimmer/manager/lib/public/component.d.ts +1 -1
- package/types/stable/@glimmer/manager/lib/util/args-proxy.d.ts +1 -1
- package/types/stable/@glimmer/manager/lib/util/capabilities.d.ts +1 -1
- package/types/stable/@glimmer/node/lib/node-dom-helper.d.ts +1 -1
- package/types/stable/@glimmer/opcode-compiler/lib/opcode-builder/helpers/components.d.ts +1 -1
- package/types/stable/@glimmer/runtime/index.d.ts +9 -4
- package/types/stable/@glimmer/runtime/lib/compiled/expressions/concat.d.ts +1 -1
- package/types/stable/@glimmer/runtime/lib/compiled/opcodes/-debug-strip.d.ts +4 -3
- package/types/stable/@glimmer/runtime/lib/compiled/opcodes/component.d.ts +1 -1
- package/types/stable/@glimmer/runtime/lib/compiled/opcodes/dom.d.ts +2 -2
- package/types/stable/@glimmer/runtime/lib/compiled/opcodes/vm.d.ts +2 -2
- package/types/stable/@glimmer/runtime/lib/component/template-only.d.ts +1 -1
- package/types/stable/@glimmer/runtime/lib/curried-value.d.ts +1 -1
- package/types/stable/@glimmer/runtime/lib/helpers/and.d.ts +3 -0
- package/types/stable/@glimmer/runtime/lib/helpers/eq.d.ts +8 -0
- package/types/stable/@glimmer/runtime/lib/helpers/gt.d.ts +8 -0
- package/types/stable/@glimmer/runtime/lib/helpers/gte.d.ts +8 -0
- package/types/stable/@glimmer/runtime/lib/helpers/invoke.d.ts +1 -1
- package/types/stable/@glimmer/runtime/lib/helpers/lt.d.ts +8 -0
- package/types/stable/@glimmer/runtime/lib/helpers/lte.d.ts +8 -0
- package/types/stable/@glimmer/runtime/lib/helpers/neq.d.ts +8 -0
- package/types/stable/@glimmer/runtime/lib/helpers/not.d.ts +3 -0
- package/types/stable/@glimmer/runtime/lib/helpers/or.d.ts +3 -0
- package/types/stable/@glimmer/runtime/lib/opcodes.d.ts +2 -2
- package/types/stable/@glimmer/runtime/lib/references/class-list.d.ts +1 -1
- package/types/stable/@glimmer/runtime/lib/references/curry-value.d.ts +1 -1
- package/types/stable/@glimmer/runtime/lib/render.d.ts +1 -1
- package/types/stable/@glimmer/runtime/lib/scope.d.ts +1 -1
- package/types/stable/@glimmer/runtime/lib/vm/append.d.ts +3 -2
- package/types/stable/@glimmer/runtime/lib/vm/arguments.d.ts +2 -2
- package/types/stable/@glimmer/runtime/lib/vm/content/text.d.ts +1 -1
- package/types/stable/@glimmer/runtime/lib/vm/element-builder.d.ts +1 -1
- package/types/stable/@glimmer/runtime/lib/vm/low-level.d.ts +2 -1
- package/types/stable/@glimmer/runtime/lib/vm/rehydrate-builder.d.ts +1 -1
- package/types/stable/@glimmer/runtime/lib/vm/update.d.ts +2 -1
- package/types/stable/@glimmer/syntax/lib/keywords.d.ts +2 -2
- package/types/stable/@glimmer/tracking/index.d.ts +2 -1
- package/types/stable/@glimmer/tracking/primitives/cache.d.ts +1 -1
- package/types/stable/index.d.ts +9 -0
- package/dist/dev/packages/shared-chunks/constants-p7AL-pog.js +0 -213
- package/dist/dev/packages/shared-chunks/dynamic-BfDKO5NI.js +0 -3823
- package/dist/dev/packages/shared-chunks/element-builder-DO43ztVP.js +0 -404
- package/dist/dev/packages/shared-chunks/index-QZstta6s.js +0 -6306
- package/dist/dev/packages/shared-chunks/mandatory-setter-DHZe7-kW.js +0 -425
- package/dist/dev/packages/shared-chunks/observers-Bj9qLVau.js +0 -2062
- package/dist/dev/packages/shared-chunks/set_properties-kVGzZL_a.js +0 -100
- package/dist/dev/packages/shared-chunks/transform-resolutions-D-YtZ0_g.js +0 -7458
- package/dist/prod/packages/shared-chunks/constants-2M371WiB.js +0 -210
- package/dist/prod/packages/shared-chunks/index-6pnzcm45.js +0 -5931
- package/dist/prod/packages/shared-chunks/observers-tZ2aOzr4.js +0 -714
- package/dist/prod/packages/shared-chunks/set_properties-C1T46IiN.js +0 -101
- package/dist/prod/packages/shared-chunks/super-Cm_a_cLQ.js +0 -275
- package/dist/prod/packages/shared-chunks/transform-resolutions-DR4GLmR2.js +0 -6936
- package/dist/prod/packages/shared-chunks/{collections-GpG8lT2g.js → collections-C3Y8z_9v.js} +9 -9
|
@@ -0,0 +1,2500 @@
|
|
|
1
|
+
import { privatize } from '../@ember/-internals/container/index.js';
|
|
2
|
+
import { E as ENV } from './env-g-kaAFLN.js';
|
|
3
|
+
import { isFactory, getOwner } from '../@ember/-internals/owner/index.js';
|
|
4
|
+
import { g as guidFor } from './guid-Cbq2sNV_.js';
|
|
5
|
+
import { constructStyleDeprecationMessage, getViewId, getViewElement } from '../@ember/-internals/views/lib/system/utils.js';
|
|
6
|
+
import { deprecate, warn } from '../@ember/debug/index.js';
|
|
7
|
+
import { schedule, _backburner, _getCurrentRunLoop } from '../@ember/runloop/index.js';
|
|
8
|
+
import { associateDestroyableChild, isDestroyed, destroy, registerDestructor, isDestroying } from '../@glimmer/destroyable/index.js';
|
|
9
|
+
import { artifacts } from '../@glimmer/program/index.js';
|
|
10
|
+
import { R as RuntimeOpImpl } from './program-DzAfcWFj.js';
|
|
11
|
+
import { v as valueForRef, U as UNDEFINED_REFERENCE, a as createComputeRef, i as isConstRef, c as createConstRef, d as isUpdatableRef, j as createInvokableRef, k as createReadOnlyRef, l as createUnboundRef, h as createDebugAliasRef, g as childRefFromParts, u as updateRef } from './reference-BoPB2LfI.js';
|
|
12
|
+
import { c as clientBuilder } from './element-builder-kHVx0F__.js';
|
|
13
|
+
import { E as EMPTY_ARGS, c as createCapturedArgs, b as EMPTY_POSITIONAL, d as curry } from './untouchable-this-cH6_N2LJ.js';
|
|
14
|
+
import { g as runtimeOptions, i as inTransaction, r as renderComponent$1, d as renderMain } from './render-DDdabL30.js';
|
|
15
|
+
import { d as dict } from './collections-DPkjqeA3.js';
|
|
16
|
+
import { u as unwrapTemplate, a as CurlyComponentManager, i as initialRenderInstrumentDetails, p as processComponentInitializationAssertions, b as ComponentStateBucket, D as DIRTY_TAG, c as isCurlyManager, B as BOUNDS } from './curly-CvC8E_4-.js';
|
|
17
|
+
import { b as CONSTANT_TAG, k as consumeTag, u as isTracking, o as debug, D as DIRTY_TAG$1, m as createTag, z as valueForTag, c as CURRENT_TAG, y as validateTag } from './cache-B7dqAS38.js';
|
|
18
|
+
import { a as RSVP } from './rsvp-CnCSY930.js';
|
|
19
|
+
import { h as hasDOM } from './index-BGP1rw3B.js';
|
|
20
|
+
import EngineInstance from '../@ember/engine/instance.js';
|
|
21
|
+
import { _instrumentStart } from '../@ember/instrumentation/index.js';
|
|
22
|
+
import { c as capabilityFlagsFrom } from './capabilities-CZkuOqqC.js';
|
|
23
|
+
import { t as templateFactory } from './index-DmGmwWPJ.js';
|
|
24
|
+
import { assert } from '../@ember/debug/lib/assert.js';
|
|
25
|
+
import { g as getFactoryFor } from './container-BzzHmCNj.js';
|
|
26
|
+
import { g as get, b as _getProp } from './property_get-CIBS9umw.js';
|
|
27
|
+
import { _ as _setProp, s as set } from './property_set-D3PKyisF.js';
|
|
28
|
+
import { g as getDebugName } from './get-debug-name-CSniHBsn.js';
|
|
29
|
+
import setGlobalContext from '../@glimmer/global-context/index.js';
|
|
30
|
+
import { t as tagForObject, o as objectAt, a as tagForProperty } from './chain-tags-D6tuFUj_.js';
|
|
31
|
+
import { isEmberArray } from '../@ember/array/-internals.js';
|
|
32
|
+
import { i as isObject } from './spec-BXl1reqK.js';
|
|
33
|
+
import { t as tagFor } from './meta-BmRXesrk.js';
|
|
34
|
+
import { contentFor } from '../@ember/-internals/runtime/lib/mixins/-proxy.js';
|
|
35
|
+
import { i as isProxy } from './is_proxy-Bzg0d4m4.js';
|
|
36
|
+
import { i as internalHelper } from './internal-helper-Dsl9_7H_.js';
|
|
37
|
+
import { i as isHTMLSafe } from './index-D-xTBV4B.js';
|
|
38
|
+
import { isArray } from '../@ember/array/index.js';
|
|
39
|
+
import { g as getComponentTemplate } from './template-kM-7TTcc.js';
|
|
40
|
+
import { c as hasInternalComponentManager, j as setInternalHelperManager, g as getInternalComponentManager } from './api-WvJPuo9z.js';
|
|
41
|
+
import { h as hash, f as fn, a as array } from './hash-D3BENmhU.js';
|
|
42
|
+
import { g as get$1, c as concat } from './get-CpJjYeJO.js';
|
|
43
|
+
import { o as on } from './on-D8QwT-eN.js';
|
|
44
|
+
import { T as TEMPLATE_ONLY_COMPONENT_MANAGER, t as templateOnlyComponent } from './template-only-Yluyu0DY.js';
|
|
45
|
+
import { i as isClassicHelper, C as CLASSIC_HELPER_MANAGER } from './helper-DlC4YesW.js';
|
|
46
|
+
import { dasherize } from '../@ember/-internals/string/index.js';
|
|
47
|
+
import { a as uniqueId } from './unique-id-A83bjEE-.js';
|
|
48
|
+
import '../route-recognizer/index.js';
|
|
49
|
+
import './unrecognized-url-error-B3wUTorp.js';
|
|
50
|
+
import '../@ember/routing/lib/routing-service.js';
|
|
51
|
+
import { generateControllerFactory } from '../@ember/routing/lib/generate_controller.js';
|
|
52
|
+
import { E as EvaluationContextImpl } from './program-context-CqcQMsfa.js';
|
|
53
|
+
|
|
54
|
+
function instrumentationPayload$1(def) {
|
|
55
|
+
// "main" used to be the outlet name, keeping it around for compatibility
|
|
56
|
+
return {
|
|
57
|
+
object: `${def.name}:main`
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
const CAPABILITIES$2 = {
|
|
61
|
+
dynamicLayout: false,
|
|
62
|
+
dynamicTag: false,
|
|
63
|
+
prepareArgs: false,
|
|
64
|
+
createArgs: false,
|
|
65
|
+
attributeHook: false,
|
|
66
|
+
elementHook: false,
|
|
67
|
+
createCaller: false,
|
|
68
|
+
dynamicScope: true,
|
|
69
|
+
updateHook: false,
|
|
70
|
+
createInstance: true,
|
|
71
|
+
wrapped: false,
|
|
72
|
+
willDestroy: false,
|
|
73
|
+
hasSubOwner: false
|
|
74
|
+
};
|
|
75
|
+
const CAPABILITIES_MASK$1 = capabilityFlagsFrom(CAPABILITIES$2);
|
|
76
|
+
class OutletComponentManager {
|
|
77
|
+
create(_owner, definition, _args, env, dynamicScope) {
|
|
78
|
+
let parentStateRef = dynamicScope.get('outletState');
|
|
79
|
+
let currentStateRef = definition.ref;
|
|
80
|
+
|
|
81
|
+
// This is the actual primary responsibility of the outlet component –
|
|
82
|
+
// it represents the switching from one route component/template into
|
|
83
|
+
// the next. The rest only exists to support the debug render tree and
|
|
84
|
+
// the old-school (and unreliable) instrumentation.
|
|
85
|
+
dynamicScope.set('outletState', currentStateRef);
|
|
86
|
+
let state = {
|
|
87
|
+
finalize: _instrumentStart('render.outlet', instrumentationPayload$1, definition)
|
|
88
|
+
};
|
|
89
|
+
if (env.debugRenderTree !== undefined) {
|
|
90
|
+
let parentState = valueForRef(parentStateRef);
|
|
91
|
+
let parentOwner = parentState?.render?.owner;
|
|
92
|
+
let currentState = valueForRef(currentStateRef);
|
|
93
|
+
let currentOwner = currentState?.render?.owner;
|
|
94
|
+
if (parentOwner && parentOwner !== currentOwner) {
|
|
95
|
+
(!(currentOwner instanceof EngineInstance) && assert('Expected currentOwner to be an EngineInstance', currentOwner instanceof EngineInstance));
|
|
96
|
+
let {
|
|
97
|
+
mountPoint
|
|
98
|
+
} = currentOwner;
|
|
99
|
+
if (mountPoint) {
|
|
100
|
+
state.engine = {
|
|
101
|
+
mountPoint,
|
|
102
|
+
instance: currentOwner
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
return state;
|
|
108
|
+
}
|
|
109
|
+
getDebugName({
|
|
110
|
+
name
|
|
111
|
+
}) {
|
|
112
|
+
return `{{outlet}} for ${name}`;
|
|
113
|
+
}
|
|
114
|
+
getDebugCustomRenderTree(_definition, state) {
|
|
115
|
+
let nodes = [];
|
|
116
|
+
nodes.push({
|
|
117
|
+
bucket: state,
|
|
118
|
+
type: 'outlet',
|
|
119
|
+
// "main" used to be the outlet name, keeping it around for compatibility
|
|
120
|
+
name: 'main',
|
|
121
|
+
args: EMPTY_ARGS,
|
|
122
|
+
instance: undefined
|
|
123
|
+
});
|
|
124
|
+
if (state.engine) {
|
|
125
|
+
nodes.push({
|
|
126
|
+
bucket: state.engine,
|
|
127
|
+
type: 'engine',
|
|
128
|
+
name: state.engine.mountPoint,
|
|
129
|
+
args: EMPTY_ARGS,
|
|
130
|
+
instance: state.engine.instance
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
return nodes;
|
|
134
|
+
}
|
|
135
|
+
getCapabilities() {
|
|
136
|
+
return CAPABILITIES$2;
|
|
137
|
+
}
|
|
138
|
+
getSelf() {
|
|
139
|
+
return UNDEFINED_REFERENCE;
|
|
140
|
+
}
|
|
141
|
+
didCreate() {}
|
|
142
|
+
didUpdate() {}
|
|
143
|
+
didRenderLayout(state) {
|
|
144
|
+
state.finalize();
|
|
145
|
+
}
|
|
146
|
+
didUpdateLayout() {}
|
|
147
|
+
getDestroyable() {
|
|
148
|
+
return null;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
const OUTLET_MANAGER = new OutletComponentManager();
|
|
152
|
+
const OUTLET_COMPONENT_TEMPLATE = templateFactory(
|
|
153
|
+
/*
|
|
154
|
+
<@Component @controller={{@controller}} @model={{@model}} />
|
|
155
|
+
*/
|
|
156
|
+
{
|
|
157
|
+
"id": null,
|
|
158
|
+
"block": "[[[8,[30,1],null,[[\"@controller\",\"@model\"],[[30,2],[30,3]]],null]],[\"@Component\",\"@controller\",\"@model\"],[]]",
|
|
159
|
+
"moduleName": "(unknown template module)",
|
|
160
|
+
"isStrictMode": true
|
|
161
|
+
});
|
|
162
|
+
class OutletComponent {
|
|
163
|
+
// handle is not used by this custom definition
|
|
164
|
+
handle = -1;
|
|
165
|
+
resolvedName = null;
|
|
166
|
+
manager = OUTLET_MANAGER;
|
|
167
|
+
capabilities = CAPABILITIES_MASK$1;
|
|
168
|
+
compilable;
|
|
169
|
+
constructor(owner, state) {
|
|
170
|
+
this.state = state;
|
|
171
|
+
this.compilable = unwrapTemplate(OUTLET_COMPONENT_TEMPLATE(owner)).asLayout();
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
function createRootOutlet(outletView) {
|
|
175
|
+
return new OutletComponent(outletView.owner, outletView.state);
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
class RootComponentManager extends CurlyComponentManager {
|
|
179
|
+
component;
|
|
180
|
+
constructor(component) {
|
|
181
|
+
super();
|
|
182
|
+
this.component = component;
|
|
183
|
+
}
|
|
184
|
+
create(_owner, _state, _args, {
|
|
185
|
+
isInteractive
|
|
186
|
+
}, dynamicScope) {
|
|
187
|
+
let component = this.component;
|
|
188
|
+
let finalizer = _instrumentStart('render.component', initialRenderInstrumentDetails, component);
|
|
189
|
+
dynamicScope.view = component;
|
|
190
|
+
let hasWrappedElement = component.tagName !== '';
|
|
191
|
+
|
|
192
|
+
// We usually do this in the `didCreateElement`, but that hook doesn't fire for tagless components
|
|
193
|
+
if (!hasWrappedElement) {
|
|
194
|
+
if (isInteractive) {
|
|
195
|
+
component.trigger('willRender');
|
|
196
|
+
}
|
|
197
|
+
component._transitionTo('hasElement');
|
|
198
|
+
if (isInteractive) {
|
|
199
|
+
component.trigger('willInsertElement');
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
{
|
|
203
|
+
processComponentInitializationAssertions(component, {});
|
|
204
|
+
}
|
|
205
|
+
let bucket = new ComponentStateBucket(component, null, CONSTANT_TAG, finalizer, hasWrappedElement, isInteractive);
|
|
206
|
+
consumeTag(component[DIRTY_TAG]);
|
|
207
|
+
return bucket;
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
// ROOT is the top-level template it has nothing but one yield.
|
|
212
|
+
// it is supposed to have a dummy element
|
|
213
|
+
const ROOT_CAPABILITIES = {
|
|
214
|
+
dynamicLayout: true,
|
|
215
|
+
dynamicTag: true,
|
|
216
|
+
prepareArgs: false,
|
|
217
|
+
createArgs: false,
|
|
218
|
+
attributeHook: true,
|
|
219
|
+
elementHook: true,
|
|
220
|
+
createCaller: true,
|
|
221
|
+
dynamicScope: true,
|
|
222
|
+
updateHook: true,
|
|
223
|
+
createInstance: true,
|
|
224
|
+
wrapped: true,
|
|
225
|
+
willDestroy: false,
|
|
226
|
+
hasSubOwner: false
|
|
227
|
+
};
|
|
228
|
+
class RootComponentDefinition {
|
|
229
|
+
// handle is not used by this custom definition
|
|
230
|
+
handle = -1;
|
|
231
|
+
resolvedName = '-top-level';
|
|
232
|
+
state;
|
|
233
|
+
manager;
|
|
234
|
+
capabilities = capabilityFlagsFrom(ROOT_CAPABILITIES);
|
|
235
|
+
compilable = null;
|
|
236
|
+
constructor(component) {
|
|
237
|
+
this.manager = new RootComponentManager(component);
|
|
238
|
+
let factory = getFactoryFor(component);
|
|
239
|
+
(!(factory !== undefined) && assert('missing factory for component', factory !== undefined));
|
|
240
|
+
this.state = factory;
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
/**
|
|
245
|
+
@module ember
|
|
246
|
+
*/
|
|
247
|
+
|
|
248
|
+
/**
|
|
249
|
+
The `{{#each}}` helper loops over elements in a collection. It is an extension
|
|
250
|
+
of the base Handlebars `{{#each}}` helper.
|
|
251
|
+
|
|
252
|
+
The default behavior of `{{#each}}` is to yield its inner block once for every
|
|
253
|
+
item in an array passing the item as the first block parameter.
|
|
254
|
+
|
|
255
|
+
Assuming the `@developers` argument contains this array:
|
|
256
|
+
|
|
257
|
+
```javascript
|
|
258
|
+
[{ name: 'Yehuda' },{ name: 'Tom' }, { name: 'Paul' }];
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
```handlebars
|
|
262
|
+
<ul>
|
|
263
|
+
{{#each @developers as |person|}}
|
|
264
|
+
<li>Hello, {{person.name}}!</li>
|
|
265
|
+
{{/each}}
|
|
266
|
+
</ul>
|
|
267
|
+
```
|
|
268
|
+
|
|
269
|
+
The same rules apply to arrays of primitives.
|
|
270
|
+
|
|
271
|
+
```javascript
|
|
272
|
+
['Yehuda', 'Tom', 'Paul']
|
|
273
|
+
```
|
|
274
|
+
|
|
275
|
+
```handlebars
|
|
276
|
+
<ul>
|
|
277
|
+
{{#each @developerNames as |name|}}
|
|
278
|
+
<li>Hello, {{name}}!</li>
|
|
279
|
+
{{/each}}
|
|
280
|
+
</ul>
|
|
281
|
+
```
|
|
282
|
+
|
|
283
|
+
During iteration, the index of each item in the array is provided as a second block
|
|
284
|
+
parameter.
|
|
285
|
+
|
|
286
|
+
```handlebars
|
|
287
|
+
<ul>
|
|
288
|
+
{{#each @developers as |person index|}}
|
|
289
|
+
<li>Hello, {{person.name}}! You're number {{index}} in line</li>
|
|
290
|
+
{{/each}}
|
|
291
|
+
</ul>
|
|
292
|
+
```
|
|
293
|
+
|
|
294
|
+
### Specifying Keys
|
|
295
|
+
|
|
296
|
+
In order to improve rendering speed, Ember will try to reuse the DOM elements
|
|
297
|
+
where possible. Specifically, if the same item is present in the array both
|
|
298
|
+
before and after the change, its DOM output will be reused.
|
|
299
|
+
|
|
300
|
+
The `key` option is used to tell Ember how to determine if the items in the
|
|
301
|
+
array being iterated over with `{{#each}}` has changed between renders. By
|
|
302
|
+
default the item's object identity is used.
|
|
303
|
+
|
|
304
|
+
This is usually sufficient, so in most cases, the `key` option is simply not
|
|
305
|
+
needed. However, in some rare cases, the objects' identities may change even
|
|
306
|
+
though they represent the same underlying data.
|
|
307
|
+
|
|
308
|
+
For example:
|
|
309
|
+
|
|
310
|
+
```javascript
|
|
311
|
+
people.map(person => {
|
|
312
|
+
return { ...person, type: 'developer' };
|
|
313
|
+
});
|
|
314
|
+
```
|
|
315
|
+
|
|
316
|
+
In this case, each time the `people` array is `map`-ed over, it will produce
|
|
317
|
+
an new array with completely different objects between renders. In these cases,
|
|
318
|
+
you can help Ember determine how these objects related to each other with the
|
|
319
|
+
`key` option:
|
|
320
|
+
|
|
321
|
+
```handlebars
|
|
322
|
+
<ul>
|
|
323
|
+
{{#each @developers key="name" as |person|}}
|
|
324
|
+
<li>Hello, {{person.name}}!</li>
|
|
325
|
+
{{/each}}
|
|
326
|
+
</ul>
|
|
327
|
+
```
|
|
328
|
+
|
|
329
|
+
By doing so, Ember will use the value of the property specified (`person.name`
|
|
330
|
+
in the example) to find a "match" from the previous render. That is, if Ember
|
|
331
|
+
has previously seen an object from the `@developers` array with a matching
|
|
332
|
+
name, its DOM elements will be re-used.
|
|
333
|
+
|
|
334
|
+
There are two special values for `key`:
|
|
335
|
+
|
|
336
|
+
* `@index` - The index of the item in the array.
|
|
337
|
+
* `@identity` - The item in the array itself.
|
|
338
|
+
|
|
339
|
+
### {{else}} condition
|
|
340
|
+
|
|
341
|
+
`{{#each}}` can have a matching `{{else}}`. The contents of this block will render
|
|
342
|
+
if the collection is empty.
|
|
343
|
+
|
|
344
|
+
```handlebars
|
|
345
|
+
<ul>
|
|
346
|
+
{{#each @developers as |person|}}
|
|
347
|
+
<li>{{person.name}} is available!</li>
|
|
348
|
+
{{else}}
|
|
349
|
+
<li>Sorry, nobody is available for this task.</li>
|
|
350
|
+
{{/each}}
|
|
351
|
+
</ul>
|
|
352
|
+
```
|
|
353
|
+
|
|
354
|
+
@method each
|
|
355
|
+
@for Ember.Templates.helpers
|
|
356
|
+
@public
|
|
357
|
+
*/
|
|
358
|
+
|
|
359
|
+
/**
|
|
360
|
+
The `{{each-in}}` helper loops over properties on an object.
|
|
361
|
+
|
|
362
|
+
For example, given this component definition:
|
|
363
|
+
|
|
364
|
+
```app/components/developer-details.js
|
|
365
|
+
import Component from '@glimmer/component';
|
|
366
|
+
import { tracked } from '@glimmer/tracking';
|
|
367
|
+
|
|
368
|
+
export default class extends Component {
|
|
369
|
+
@tracked developer = {
|
|
370
|
+
"name": "Shelly Sails",
|
|
371
|
+
"age": 42
|
|
372
|
+
};
|
|
373
|
+
}
|
|
374
|
+
```
|
|
375
|
+
|
|
376
|
+
This template would display all properties on the `developer`
|
|
377
|
+
object in a list:
|
|
378
|
+
|
|
379
|
+
```app/components/developer-details.hbs
|
|
380
|
+
<ul>
|
|
381
|
+
{{#each-in this.developer as |key value|}}
|
|
382
|
+
<li>{{key}}: {{value}}</li>
|
|
383
|
+
{{/each-in}}
|
|
384
|
+
</ul>
|
|
385
|
+
```
|
|
386
|
+
|
|
387
|
+
Outputting their name and age:
|
|
388
|
+
|
|
389
|
+
```html
|
|
390
|
+
<ul>
|
|
391
|
+
<li>name: Shelly Sails</li>
|
|
392
|
+
<li>age: 42</li>
|
|
393
|
+
</ul>
|
|
394
|
+
```
|
|
395
|
+
|
|
396
|
+
@method each-in
|
|
397
|
+
@for Ember.Templates.helpers
|
|
398
|
+
@public
|
|
399
|
+
@since 2.1.0
|
|
400
|
+
*/
|
|
401
|
+
class EachInWrapper {
|
|
402
|
+
constructor(inner) {
|
|
403
|
+
this.inner = inner;
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
const eachIn = internalHelper(({
|
|
407
|
+
positional
|
|
408
|
+
}) => {
|
|
409
|
+
const inner = positional[0];
|
|
410
|
+
(!(inner) && assert('expected at least one positional arg', inner));
|
|
411
|
+
return createComputeRef(() => {
|
|
412
|
+
let iterable = valueForRef(inner);
|
|
413
|
+
consumeTag(tagForObject(iterable));
|
|
414
|
+
if (isProxy(iterable)) {
|
|
415
|
+
// this is because the each-in doesn't actually get(proxy, 'key') but bypasses it
|
|
416
|
+
// and the proxy's tag is lazy updated on access
|
|
417
|
+
iterable = contentFor(iterable);
|
|
418
|
+
}
|
|
419
|
+
return new EachInWrapper(iterable);
|
|
420
|
+
});
|
|
421
|
+
});
|
|
422
|
+
|
|
423
|
+
function toIterator(iterable) {
|
|
424
|
+
if (iterable instanceof EachInWrapper) {
|
|
425
|
+
return toEachInIterator(iterable.inner);
|
|
426
|
+
} else {
|
|
427
|
+
return toEachIterator(iterable);
|
|
428
|
+
}
|
|
429
|
+
}
|
|
430
|
+
function toEachInIterator(iterable) {
|
|
431
|
+
if (!isIndexable(iterable)) {
|
|
432
|
+
return null;
|
|
433
|
+
}
|
|
434
|
+
if (Array.isArray(iterable) || isEmberArray(iterable)) {
|
|
435
|
+
return ObjectIterator.fromIndexable(iterable);
|
|
436
|
+
} else if (isNativeIterable(iterable)) {
|
|
437
|
+
return MapLikeNativeIterator.from(iterable);
|
|
438
|
+
} else if (hasForEach(iterable)) {
|
|
439
|
+
return ObjectIterator.fromForEachable(iterable);
|
|
440
|
+
} else {
|
|
441
|
+
return ObjectIterator.fromIndexable(iterable);
|
|
442
|
+
}
|
|
443
|
+
}
|
|
444
|
+
function toEachIterator(iterable) {
|
|
445
|
+
if (!isObject(iterable)) {
|
|
446
|
+
return null;
|
|
447
|
+
}
|
|
448
|
+
if (Array.isArray(iterable)) {
|
|
449
|
+
return ArrayIterator.from(iterable);
|
|
450
|
+
} else if (isEmberArray(iterable)) {
|
|
451
|
+
return EmberArrayIterator.from(iterable);
|
|
452
|
+
} else if (isNativeIterable(iterable)) {
|
|
453
|
+
return ArrayLikeNativeIterator.from(iterable);
|
|
454
|
+
} else if (hasForEach(iterable)) {
|
|
455
|
+
return ArrayIterator.fromForEachable(iterable);
|
|
456
|
+
} else {
|
|
457
|
+
return null;
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
class BoundedIterator {
|
|
461
|
+
position = 0;
|
|
462
|
+
constructor(length) {
|
|
463
|
+
this.length = length;
|
|
464
|
+
}
|
|
465
|
+
isEmpty() {
|
|
466
|
+
return false;
|
|
467
|
+
}
|
|
468
|
+
memoFor(position) {
|
|
469
|
+
return position;
|
|
470
|
+
}
|
|
471
|
+
next() {
|
|
472
|
+
let {
|
|
473
|
+
length,
|
|
474
|
+
position
|
|
475
|
+
} = this;
|
|
476
|
+
if (position >= length) {
|
|
477
|
+
return null;
|
|
478
|
+
}
|
|
479
|
+
let value = this.valueFor(position);
|
|
480
|
+
let memo = this.memoFor(position);
|
|
481
|
+
this.position++;
|
|
482
|
+
return {
|
|
483
|
+
value,
|
|
484
|
+
memo
|
|
485
|
+
};
|
|
486
|
+
}
|
|
487
|
+
}
|
|
488
|
+
class ArrayIterator extends BoundedIterator {
|
|
489
|
+
static from(iterable) {
|
|
490
|
+
return iterable.length > 0 ? new this(iterable) : null;
|
|
491
|
+
}
|
|
492
|
+
static fromForEachable(object) {
|
|
493
|
+
let array = [];
|
|
494
|
+
object.forEach(item => array.push(item));
|
|
495
|
+
return this.from(array);
|
|
496
|
+
}
|
|
497
|
+
constructor(array) {
|
|
498
|
+
super(array.length);
|
|
499
|
+
this.array = array;
|
|
500
|
+
}
|
|
501
|
+
valueFor(position) {
|
|
502
|
+
return this.array[position];
|
|
503
|
+
}
|
|
504
|
+
}
|
|
505
|
+
class EmberArrayIterator extends BoundedIterator {
|
|
506
|
+
static from(iterable) {
|
|
507
|
+
return iterable.length > 0 ? new this(iterable) : null;
|
|
508
|
+
}
|
|
509
|
+
constructor(array) {
|
|
510
|
+
super(array.length);
|
|
511
|
+
this.array = array;
|
|
512
|
+
}
|
|
513
|
+
valueFor(position) {
|
|
514
|
+
return objectAt(this.array, position);
|
|
515
|
+
}
|
|
516
|
+
}
|
|
517
|
+
class ObjectIterator extends BoundedIterator {
|
|
518
|
+
static fromIndexable(obj) {
|
|
519
|
+
let keys = Object.keys(obj);
|
|
520
|
+
if (keys.length === 0) {
|
|
521
|
+
return null;
|
|
522
|
+
} else {
|
|
523
|
+
let values = [];
|
|
524
|
+
for (let key of keys) {
|
|
525
|
+
let value;
|
|
526
|
+
value = obj[key];
|
|
527
|
+
|
|
528
|
+
// Add the tag of the returned value if it is an array, since arrays
|
|
529
|
+
// should always cause updates if they are consumed and then changed
|
|
530
|
+
if (isTracking()) {
|
|
531
|
+
consumeTag(tagFor(obj, key));
|
|
532
|
+
if (Array.isArray(value)) {
|
|
533
|
+
consumeTag(tagFor(value, '[]'));
|
|
534
|
+
}
|
|
535
|
+
}
|
|
536
|
+
values.push(value);
|
|
537
|
+
}
|
|
538
|
+
return new this(keys, values);
|
|
539
|
+
}
|
|
540
|
+
}
|
|
541
|
+
static fromForEachable(obj) {
|
|
542
|
+
let keys = [];
|
|
543
|
+
let values = [];
|
|
544
|
+
let length = 0;
|
|
545
|
+
let isMapLike = false;
|
|
546
|
+
|
|
547
|
+
// Not using an arrow function here so we can get an accurate `arguments`
|
|
548
|
+
obj.forEach(function (value, key) {
|
|
549
|
+
isMapLike = isMapLike || arguments.length >= 2;
|
|
550
|
+
if (isMapLike) {
|
|
551
|
+
keys.push(key);
|
|
552
|
+
}
|
|
553
|
+
values.push(value);
|
|
554
|
+
length++;
|
|
555
|
+
});
|
|
556
|
+
if (length === 0) {
|
|
557
|
+
return null;
|
|
558
|
+
} else if (isMapLike) {
|
|
559
|
+
return new this(keys, values);
|
|
560
|
+
} else {
|
|
561
|
+
return new ArrayIterator(values);
|
|
562
|
+
}
|
|
563
|
+
}
|
|
564
|
+
constructor(keys, values) {
|
|
565
|
+
super(values.length);
|
|
566
|
+
this.keys = keys;
|
|
567
|
+
this.values = values;
|
|
568
|
+
}
|
|
569
|
+
valueFor(position) {
|
|
570
|
+
return this.values[position];
|
|
571
|
+
}
|
|
572
|
+
memoFor(position) {
|
|
573
|
+
return this.keys[position];
|
|
574
|
+
}
|
|
575
|
+
}
|
|
576
|
+
class NativeIterator {
|
|
577
|
+
static from(iterable) {
|
|
578
|
+
let iterator = iterable[Symbol.iterator]();
|
|
579
|
+
let result = iterator.next();
|
|
580
|
+
let {
|
|
581
|
+
done
|
|
582
|
+
} = result;
|
|
583
|
+
if (done) {
|
|
584
|
+
return null;
|
|
585
|
+
} else {
|
|
586
|
+
return new this(iterator, result);
|
|
587
|
+
}
|
|
588
|
+
}
|
|
589
|
+
position = 0;
|
|
590
|
+
constructor(iterable, result) {
|
|
591
|
+
this.iterable = iterable;
|
|
592
|
+
this.result = result;
|
|
593
|
+
}
|
|
594
|
+
isEmpty() {
|
|
595
|
+
return false;
|
|
596
|
+
}
|
|
597
|
+
next() {
|
|
598
|
+
let {
|
|
599
|
+
iterable,
|
|
600
|
+
result,
|
|
601
|
+
position
|
|
602
|
+
} = this;
|
|
603
|
+
if (result.done) {
|
|
604
|
+
return null;
|
|
605
|
+
}
|
|
606
|
+
let value = this.valueFor(result, position);
|
|
607
|
+
let memo = this.memoFor(result, position);
|
|
608
|
+
this.position++;
|
|
609
|
+
this.result = iterable.next();
|
|
610
|
+
return {
|
|
611
|
+
value,
|
|
612
|
+
memo
|
|
613
|
+
};
|
|
614
|
+
}
|
|
615
|
+
}
|
|
616
|
+
class ArrayLikeNativeIterator extends NativeIterator {
|
|
617
|
+
valueFor(result) {
|
|
618
|
+
return result.value;
|
|
619
|
+
}
|
|
620
|
+
memoFor(_result, position) {
|
|
621
|
+
return position;
|
|
622
|
+
}
|
|
623
|
+
}
|
|
624
|
+
class MapLikeNativeIterator extends NativeIterator {
|
|
625
|
+
valueFor(result) {
|
|
626
|
+
return result.value[1];
|
|
627
|
+
}
|
|
628
|
+
memoFor(result) {
|
|
629
|
+
return result.value[0];
|
|
630
|
+
}
|
|
631
|
+
}
|
|
632
|
+
function hasForEach(value) {
|
|
633
|
+
return value != null && typeof value['forEach'] === 'function';
|
|
634
|
+
}
|
|
635
|
+
function isNativeIterable(value) {
|
|
636
|
+
return value != null && typeof value[Symbol.iterator] === 'function';
|
|
637
|
+
}
|
|
638
|
+
function isIndexable(value) {
|
|
639
|
+
return value !== null && (typeof value === 'object' || typeof value === 'function');
|
|
640
|
+
}
|
|
641
|
+
|
|
642
|
+
function toBool(predicate) {
|
|
643
|
+
if (isProxy(predicate)) {
|
|
644
|
+
consumeTag(tagForProperty(predicate, 'content'));
|
|
645
|
+
return Boolean(get(predicate, 'isTruthy'));
|
|
646
|
+
} else if (isArray(predicate)) {
|
|
647
|
+
consumeTag(tagForProperty(predicate, '[]'));
|
|
648
|
+
return predicate.length !== 0;
|
|
649
|
+
} else if (isHTMLSafe(predicate)) {
|
|
650
|
+
return Boolean(predicate.toString());
|
|
651
|
+
} else {
|
|
652
|
+
return Boolean(predicate);
|
|
653
|
+
}
|
|
654
|
+
}
|
|
655
|
+
|
|
656
|
+
///////////
|
|
657
|
+
|
|
658
|
+
// Setup global context
|
|
659
|
+
|
|
660
|
+
setGlobalContext({
|
|
661
|
+
scheduleRevalidate() {
|
|
662
|
+
_backburner.ensureInstance();
|
|
663
|
+
},
|
|
664
|
+
toBool,
|
|
665
|
+
toIterator,
|
|
666
|
+
getProp: _getProp,
|
|
667
|
+
setProp: _setProp,
|
|
668
|
+
getPath: get,
|
|
669
|
+
setPath: set,
|
|
670
|
+
scheduleDestroy(destroyable, destructor) {
|
|
671
|
+
schedule('actions', null, destructor, destroyable);
|
|
672
|
+
},
|
|
673
|
+
scheduleDestroyed(finalizeDestructor) {
|
|
674
|
+
schedule('destroy', null, finalizeDestructor);
|
|
675
|
+
},
|
|
676
|
+
warnIfStyleNotTrusted(value) {
|
|
677
|
+
(warn(constructStyleDeprecationMessage(String(value)), (() => {
|
|
678
|
+
if (value === null || value === undefined || isHTMLSafe(value)) {
|
|
679
|
+
return true;
|
|
680
|
+
}
|
|
681
|
+
return false;
|
|
682
|
+
})(), {
|
|
683
|
+
id: 'ember-htmlbars.style-xss-warning'
|
|
684
|
+
}));
|
|
685
|
+
},
|
|
686
|
+
assert(test, msg, options) {
|
|
687
|
+
{
|
|
688
|
+
let id = options?.id;
|
|
689
|
+
let override = VM_ASSERTION_OVERRIDES.filter(o => o.id === id)[0];
|
|
690
|
+
(!(test) && assert(override?.message ?? msg, test));
|
|
691
|
+
}
|
|
692
|
+
},
|
|
693
|
+
deprecate(msg, test, options) {
|
|
694
|
+
{
|
|
695
|
+
let {
|
|
696
|
+
id
|
|
697
|
+
} = options;
|
|
698
|
+
if (id === 'argument-less-helper-paren-less-invocation') {
|
|
699
|
+
throw new Error(`A resolved helper cannot be passed as a named argument as the syntax is ` + `ambiguously a pass-by-reference or invocation. Use the ` + `\`{{helper 'foo-helper}}\` helper to pass by reference or explicitly ` + `invoke the helper with parens: \`{{(fooHelper)}}\`.`);
|
|
700
|
+
}
|
|
701
|
+
let override = VM_DEPRECATION_OVERRIDES.filter(o => o.id === id)[0];
|
|
702
|
+
if (!override) throw new Error(`deprecation override for ${id} not found`);
|
|
703
|
+
|
|
704
|
+
// allow deprecations to be disabled in the VM_DEPRECATION_OVERRIDES array below
|
|
705
|
+
if (!override.disabled) {
|
|
706
|
+
(!(Boolean(test)) && deprecate(override.message ?? msg, Boolean(test), override));
|
|
707
|
+
}
|
|
708
|
+
}
|
|
709
|
+
}
|
|
710
|
+
});
|
|
711
|
+
{
|
|
712
|
+
debug?.setTrackingTransactionEnv?.({
|
|
713
|
+
debugMessage(obj, keyName) {
|
|
714
|
+
let dirtyString = keyName ? `\`${keyName}\` on \`${getDebugName?.(obj)}\`` : `\`${getDebugName?.(obj)}\``;
|
|
715
|
+
return `You attempted to update ${dirtyString}, but it had already been used previously in the same computation. Attempting to update a value after using it in a computation can cause logical errors, infinite revalidation bugs, and performance issues, and is not supported.`;
|
|
716
|
+
}
|
|
717
|
+
});
|
|
718
|
+
}
|
|
719
|
+
|
|
720
|
+
///////////
|
|
721
|
+
|
|
722
|
+
// VM Assertion/Deprecation overrides
|
|
723
|
+
|
|
724
|
+
const VM_DEPRECATION_OVERRIDES = [{
|
|
725
|
+
id: 'setting-on-hash',
|
|
726
|
+
until: '4.4.0',
|
|
727
|
+
for: 'ember-source',
|
|
728
|
+
since: {
|
|
729
|
+
available: '3.28.0',
|
|
730
|
+
enabled: '3.28.0'
|
|
731
|
+
}
|
|
732
|
+
}];
|
|
733
|
+
const VM_ASSERTION_OVERRIDES = [];
|
|
734
|
+
|
|
735
|
+
///////////
|
|
736
|
+
|
|
737
|
+
// Define environment delegate
|
|
738
|
+
|
|
739
|
+
class EmberEnvironmentDelegate {
|
|
740
|
+
enableDebugTooling = ENV._DEBUG_RENDER_TREE;
|
|
741
|
+
constructor(owner, isInteractive) {
|
|
742
|
+
this.owner = owner;
|
|
743
|
+
this.isInteractive = isInteractive;
|
|
744
|
+
}
|
|
745
|
+
onTransactionCommit() {}
|
|
746
|
+
}
|
|
747
|
+
|
|
748
|
+
/**
|
|
749
|
+
@module ember
|
|
750
|
+
*/
|
|
751
|
+
const disallowDynamicResolution = internalHelper(({
|
|
752
|
+
positional,
|
|
753
|
+
named
|
|
754
|
+
}) => {
|
|
755
|
+
const nameOrValueRef = positional[0];
|
|
756
|
+
(!(positional.length === 1 && nameOrValueRef) && assert(`[BUG] wrong number of positional arguments, expecting 1, got ${positional.length}`, positional.length === 1 && nameOrValueRef));
|
|
757
|
+
let typeRef = named['type'];
|
|
758
|
+
let locRef = named['loc'];
|
|
759
|
+
let originalRef = named['original'];
|
|
760
|
+
(!(typeRef) && assert(`[BUG] expecting \`type\` named argument`, typeRef));
|
|
761
|
+
(!(locRef) && assert(`[BUG] expecting \`loc\` named argument`, locRef));
|
|
762
|
+
(!(originalRef) && assert(`[BUG] expecting \`original\` named argument`, originalRef)); // Bug: why do these fail?
|
|
763
|
+
// assert('[BUG] expecting a string literal for the `type` argument', isConstRef(typeRef));
|
|
764
|
+
// assert('[BUG] expecting a string literal for the `loc` argument', isConstRef(locRef));
|
|
765
|
+
// assert('[BUG] expecting a string literal for the `original` argument', isConstRef(originalRef));
|
|
766
|
+
const type = valueForRef(typeRef);
|
|
767
|
+
const loc = valueForRef(locRef);
|
|
768
|
+
const original = valueForRef(originalRef);
|
|
769
|
+
(!(typeof type === 'string') && assert('[BUG] expecting a string literal for the `type` argument', typeof type === 'string'));
|
|
770
|
+
(!(typeof loc === 'string') && assert('[BUG] expecting a string literal for the `loc` argument', typeof loc === 'string'));
|
|
771
|
+
(!(typeof original === 'string') && assert('[BUG] expecting a string literal for the `original` argument', typeof original === 'string'));
|
|
772
|
+
return createComputeRef(() => {
|
|
773
|
+
let nameOrValue = valueForRef(nameOrValueRef);
|
|
774
|
+
(!(typeof nameOrValue !== 'string') && assert(`Passing a dynamic string to the \`(${type})\` keyword is disallowed. ` + `(You specified \`(${type} ${original})\` and \`${original}\` evaluated into "${nameOrValue}".) ` + `This ensures we can statically analyze the template and determine which ${type}s are used. ` + `If the ${type} name is always the same, use a string literal instead, i.e. \`(${type} "${nameOrValue}")\`. ` + `Otherwise, import the ${type}s into JavaScript and pass them directly. ` + 'See https://github.com/emberjs/rfcs/blob/master/text/0496-handlebars-strict-mode.md#4-no-dynamic-resolution for details. ' + loc, typeof nameOrValue !== 'string'));
|
|
775
|
+
return nameOrValue;
|
|
776
|
+
});
|
|
777
|
+
});
|
|
778
|
+
|
|
779
|
+
let helper;
|
|
780
|
+
{
|
|
781
|
+
helper = args => {
|
|
782
|
+
const inner = args.positional[0];
|
|
783
|
+
(!(inner) && assert('expected at least one positional arg', inner));
|
|
784
|
+
return createComputeRef(() => {
|
|
785
|
+
let value = valueForRef(inner);
|
|
786
|
+
(!(value !== null && value !== undefined) && assert('You cannot pass a null or undefined destination element to in-element', value !== null && value !== undefined));
|
|
787
|
+
return value;
|
|
788
|
+
});
|
|
789
|
+
};
|
|
790
|
+
}
|
|
791
|
+
const inElementNullCheckHelper = internalHelper(helper);
|
|
792
|
+
|
|
793
|
+
const normalizeClassHelper = internalHelper(({
|
|
794
|
+
positional
|
|
795
|
+
}) => {
|
|
796
|
+
return createComputeRef(() => {
|
|
797
|
+
let classNameArg = positional[0];
|
|
798
|
+
let valueArg = positional[1];
|
|
799
|
+
(!(classNameArg && valueArg) && assert('expected at least two positional args', classNameArg && valueArg));
|
|
800
|
+
let classNameParts = valueForRef(classNameArg).split('.');
|
|
801
|
+
let className = classNameParts[classNameParts.length - 1];
|
|
802
|
+
(!(className) && assert('has className', className)); // Always at least one split result
|
|
803
|
+
let value = valueForRef(valueArg);
|
|
804
|
+
if (value === true) {
|
|
805
|
+
return dasherize(className);
|
|
806
|
+
} else if (!value && value !== 0) {
|
|
807
|
+
return '';
|
|
808
|
+
} else {
|
|
809
|
+
return String(value);
|
|
810
|
+
}
|
|
811
|
+
});
|
|
812
|
+
});
|
|
813
|
+
|
|
814
|
+
/**
|
|
815
|
+
@module ember
|
|
816
|
+
*/
|
|
817
|
+
|
|
818
|
+
const resolve = internalHelper(({
|
|
819
|
+
positional
|
|
820
|
+
}, owner) => {
|
|
821
|
+
// why is this allowed to be undefined in the first place?
|
|
822
|
+
(!(owner) && assert('[BUG] missing owner', owner));
|
|
823
|
+
(!(positional.length === 1) && assert(`[BUG] wrong number of positional arguments, expecting 1, got ${positional.length}`, positional.length === 1));
|
|
824
|
+
let fullNameRef = positional[0];
|
|
825
|
+
(!(fullNameRef && isConstRef(fullNameRef)) && assert('[BUG] expecting a string literal as argument', fullNameRef && isConstRef(fullNameRef)));
|
|
826
|
+
let fullName = valueForRef(fullNameRef);
|
|
827
|
+
(!(typeof fullName === 'string') && assert('[BUG] expecting a string literal as argument', typeof fullName === 'string'));
|
|
828
|
+
(!((s => s.split(':').length === 2)(fullName)) && assert('[BUG] expecting a valid full name', (s => s.split(':').length === 2)(fullName)));
|
|
829
|
+
{
|
|
830
|
+
let [type, name] = fullName.split(':');
|
|
831
|
+
(!(owner.hasRegistration(fullName)) && assert(`Attempted to invoke \`(-resolve "${fullName}")\`, but ${name} was not a valid ${type} name.`, owner.hasRegistration(fullName)));
|
|
832
|
+
}
|
|
833
|
+
return createConstRef(owner.factoryFor(fullName)?.class, `(-resolve "${fullName}")`);
|
|
834
|
+
});
|
|
835
|
+
|
|
836
|
+
/**
|
|
837
|
+
@module ember
|
|
838
|
+
*/
|
|
839
|
+
|
|
840
|
+
/**
|
|
841
|
+
This reference is used to get the `[]` tag of iterables, so we can trigger
|
|
842
|
+
updates to `{{each}}` when it changes. It is put into place by a template
|
|
843
|
+
transform at build time, similar to the (-each-in) helper
|
|
844
|
+
*/
|
|
845
|
+
const trackArray = internalHelper(({
|
|
846
|
+
positional
|
|
847
|
+
}) => {
|
|
848
|
+
const inner = positional[0];
|
|
849
|
+
(!(inner) && assert('expected at least one positional arg', inner));
|
|
850
|
+
return createComputeRef(() => {
|
|
851
|
+
let iterable = valueForRef(inner);
|
|
852
|
+
if (isObject(iterable)) {
|
|
853
|
+
consumeTag(tagForProperty(iterable, '[]'));
|
|
854
|
+
}
|
|
855
|
+
return iterable;
|
|
856
|
+
});
|
|
857
|
+
});
|
|
858
|
+
|
|
859
|
+
/**
|
|
860
|
+
@module ember
|
|
861
|
+
*/
|
|
862
|
+
|
|
863
|
+
/**
|
|
864
|
+
The `mut` helper lets you __clearly specify__ that a child `Component` can update the
|
|
865
|
+
(mutable) value passed to it, which will __change the value of the parent component__.
|
|
866
|
+
|
|
867
|
+
To specify that a parameter is mutable, when invoking the child `Component`:
|
|
868
|
+
|
|
869
|
+
```handlebars
|
|
870
|
+
<MyChild @childClickCount={{fn (mut totalClicks)}} />
|
|
871
|
+
```
|
|
872
|
+
|
|
873
|
+
or
|
|
874
|
+
|
|
875
|
+
```handlebars
|
|
876
|
+
{{my-child childClickCount=(mut totalClicks)}}
|
|
877
|
+
```
|
|
878
|
+
|
|
879
|
+
The child `Component` can then modify the parent's value just by modifying its own
|
|
880
|
+
property:
|
|
881
|
+
|
|
882
|
+
```javascript
|
|
883
|
+
// my-child.js
|
|
884
|
+
export default class MyChild extends Component {
|
|
885
|
+
click() {
|
|
886
|
+
this.incrementProperty('childClickCount');
|
|
887
|
+
}
|
|
888
|
+
}
|
|
889
|
+
```
|
|
890
|
+
|
|
891
|
+
Note that for curly components (`{{my-component}}`) the bindings are already mutable,
|
|
892
|
+
making the `mut` unnecessary.
|
|
893
|
+
|
|
894
|
+
Additionally, the `mut` helper can be combined with the `fn` helper to
|
|
895
|
+
mutate a value. For example:
|
|
896
|
+
|
|
897
|
+
```handlebars
|
|
898
|
+
<MyChild @childClickCount={{this.totalClicks}} @click-count-change={{fn (mut totalClicks))}} />
|
|
899
|
+
```
|
|
900
|
+
|
|
901
|
+
or
|
|
902
|
+
|
|
903
|
+
```handlebars
|
|
904
|
+
{{my-child childClickCount=totalClicks click-count-change=(fn (mut totalClicks))}}
|
|
905
|
+
```
|
|
906
|
+
|
|
907
|
+
The child `Component` would invoke the function with the new click value:
|
|
908
|
+
|
|
909
|
+
```javascript
|
|
910
|
+
// my-child.js
|
|
911
|
+
export default class MyChild extends Component {
|
|
912
|
+
click() {
|
|
913
|
+
this.get('click-count-change')(this.get('childClickCount') + 1);
|
|
914
|
+
}
|
|
915
|
+
}
|
|
916
|
+
```
|
|
917
|
+
|
|
918
|
+
The `mut` helper changes the `totalClicks` value to what was provided as the `fn` argument.
|
|
919
|
+
|
|
920
|
+
The `mut` helper, when used with `fn`, will return a function that
|
|
921
|
+
sets the value passed to `mut` to its first argument. As an example, we can create a
|
|
922
|
+
button that increments a value passing the value directly to the `fn`:
|
|
923
|
+
|
|
924
|
+
```handlebars
|
|
925
|
+
{{! inc helper is not provided by Ember }}
|
|
926
|
+
<button onclick={{fn (mut count) (inc count)}}>
|
|
927
|
+
Increment count
|
|
928
|
+
</button>
|
|
929
|
+
```
|
|
930
|
+
|
|
931
|
+
@method mut
|
|
932
|
+
@param {Object} [attr] the "two-way" attribute that can be modified.
|
|
933
|
+
@for Ember.Templates.helpers
|
|
934
|
+
@public
|
|
935
|
+
*/
|
|
936
|
+
|
|
937
|
+
const mut = internalHelper(({
|
|
938
|
+
positional
|
|
939
|
+
}) => {
|
|
940
|
+
let ref = positional[0];
|
|
941
|
+
(!(ref) && assert('expected at least one positional arg', ref)); // TODO: Improve this error message. This covers at least two distinct
|
|
942
|
+
// cases:
|
|
943
|
+
//
|
|
944
|
+
// 1. (mut "not a path") – passing a literal, result from a helper
|
|
945
|
+
// invocation, etc
|
|
946
|
+
//
|
|
947
|
+
// 2. (mut receivedValue) – passing a value received from the caller
|
|
948
|
+
// that was originally derived from a literal, result from a helper
|
|
949
|
+
// invocation, etc
|
|
950
|
+
//
|
|
951
|
+
// This message is alright for the first case, but could be quite
|
|
952
|
+
// confusing for the second case.
|
|
953
|
+
(!(isUpdatableRef(ref)) && assert('You can only pass a path to mut', isUpdatableRef(ref)));
|
|
954
|
+
return createInvokableRef(ref);
|
|
955
|
+
});
|
|
956
|
+
|
|
957
|
+
/**
|
|
958
|
+
@module ember
|
|
959
|
+
*/
|
|
960
|
+
|
|
961
|
+
|
|
962
|
+
/**
|
|
963
|
+
The `readonly` helper let's you specify that a binding is one-way only,
|
|
964
|
+
instead of two-way.
|
|
965
|
+
When you pass a `readonly` binding from an outer context (e.g. parent component),
|
|
966
|
+
to to an inner context (e.g. child component), you are saying that changing that
|
|
967
|
+
property in the inner context does not change the value in the outer context.
|
|
968
|
+
|
|
969
|
+
To specify that a binding is read-only, when invoking the child `Component`:
|
|
970
|
+
|
|
971
|
+
```app/components/my-parent.js
|
|
972
|
+
export default class MyParent extends Component {
|
|
973
|
+
totalClicks = 3;
|
|
974
|
+
}
|
|
975
|
+
```
|
|
976
|
+
|
|
977
|
+
```app/templates/components/my-parent.hbs
|
|
978
|
+
{{log totalClicks}} // -> 3
|
|
979
|
+
<MyChild @childClickCount={{readonly totalClicks}} />
|
|
980
|
+
```
|
|
981
|
+
```
|
|
982
|
+
{{my-child childClickCount=(readonly totalClicks)}}
|
|
983
|
+
```
|
|
984
|
+
|
|
985
|
+
Now, when you update `childClickCount`:
|
|
986
|
+
|
|
987
|
+
```app/components/my-child.js
|
|
988
|
+
export default class MyChild extends Component {
|
|
989
|
+
click() {
|
|
990
|
+
this.incrementProperty('childClickCount');
|
|
991
|
+
}
|
|
992
|
+
}
|
|
993
|
+
```
|
|
994
|
+
|
|
995
|
+
The value updates in the child component, but not the parent component:
|
|
996
|
+
|
|
997
|
+
```app/templates/components/my-child.hbs
|
|
998
|
+
{{log childClickCount}} //-> 4
|
|
999
|
+
```
|
|
1000
|
+
|
|
1001
|
+
```app/templates/components/my-parent.hbs
|
|
1002
|
+
{{log totalClicks}} //-> 3
|
|
1003
|
+
<MyChild @childClickCount={{readonly totalClicks}} />
|
|
1004
|
+
```
|
|
1005
|
+
or
|
|
1006
|
+
```app/templates/components/my-parent.hbs
|
|
1007
|
+
{{log totalClicks}} //-> 3
|
|
1008
|
+
{{my-child childClickCount=(readonly totalClicks)}}
|
|
1009
|
+
```
|
|
1010
|
+
|
|
1011
|
+
### Objects and Arrays
|
|
1012
|
+
|
|
1013
|
+
When passing a property that is a complex object (e.g. object, array) instead of a primitive object (e.g. number, string),
|
|
1014
|
+
only the reference to the object is protected using the readonly helper.
|
|
1015
|
+
This means that you can change properties of the object both on the parent component, as well as the child component.
|
|
1016
|
+
The `readonly` binding behaves similar to the `const` keyword in JavaScript.
|
|
1017
|
+
|
|
1018
|
+
Let's look at an example:
|
|
1019
|
+
|
|
1020
|
+
First let's set up the parent component:
|
|
1021
|
+
|
|
1022
|
+
```app/components/my-parent.js
|
|
1023
|
+
import Component from '@ember/component';
|
|
1024
|
+
|
|
1025
|
+
export default class MyParent extends Component {
|
|
1026
|
+
clicks: null,
|
|
1027
|
+
|
|
1028
|
+
init() {
|
|
1029
|
+
this._super(...arguments);
|
|
1030
|
+
this.set('clicks', { total: 3 });
|
|
1031
|
+
}
|
|
1032
|
+
}
|
|
1033
|
+
```
|
|
1034
|
+
|
|
1035
|
+
```app/templates/components/my-parent.hbs
|
|
1036
|
+
{{log clicks.total}} //-> 3
|
|
1037
|
+
<MyChild @childClicks={{readonly clicks}} />
|
|
1038
|
+
```
|
|
1039
|
+
```app/templates/components/my-parent.hbs
|
|
1040
|
+
{{log clicks.total}} //-> 3
|
|
1041
|
+
{{my-child childClicks=(readonly clicks)}}
|
|
1042
|
+
```
|
|
1043
|
+
|
|
1044
|
+
Now, if you update the `total` property of `childClicks`:
|
|
1045
|
+
|
|
1046
|
+
```app/components/my-child.js
|
|
1047
|
+
import Component from '@ember/component';
|
|
1048
|
+
|
|
1049
|
+
export default class MyChild extends Component {
|
|
1050
|
+
click() {
|
|
1051
|
+
this.get('clicks').incrementProperty('total');
|
|
1052
|
+
}
|
|
1053
|
+
}
|
|
1054
|
+
```
|
|
1055
|
+
|
|
1056
|
+
You will see the following happen:
|
|
1057
|
+
|
|
1058
|
+
```app/templates/components/my-parent.hbs
|
|
1059
|
+
{{log clicks.total}} //-> 4
|
|
1060
|
+
<MyChild @childClicks={{readonly clicks}} />
|
|
1061
|
+
```
|
|
1062
|
+
or
|
|
1063
|
+
```app/templates/components/my-parent.hbs
|
|
1064
|
+
{{log clicks.total}} //-> 4
|
|
1065
|
+
{{my-child childClicks=(readonly clicks)}}
|
|
1066
|
+
```
|
|
1067
|
+
|
|
1068
|
+
```app/templates/components/my-child.hbs
|
|
1069
|
+
{{log childClicks.total}} //-> 4
|
|
1070
|
+
```
|
|
1071
|
+
|
|
1072
|
+
@method readonly
|
|
1073
|
+
@param {Object} [attr] the read-only attribute.
|
|
1074
|
+
@for Ember.Templates.helpers
|
|
1075
|
+
@private
|
|
1076
|
+
*/
|
|
1077
|
+
const readonly = internalHelper(({
|
|
1078
|
+
positional
|
|
1079
|
+
}) => {
|
|
1080
|
+
let firstArg = positional[0];
|
|
1081
|
+
(!(firstArg) && assert('has first arg', firstArg));
|
|
1082
|
+
return createReadOnlyRef(firstArg);
|
|
1083
|
+
});
|
|
1084
|
+
|
|
1085
|
+
/**
|
|
1086
|
+
@module ember
|
|
1087
|
+
*/
|
|
1088
|
+
|
|
1089
|
+
|
|
1090
|
+
/**
|
|
1091
|
+
The `{{unbound}}` helper disconnects the one-way binding of a property,
|
|
1092
|
+
essentially freezing its value at the moment of rendering. For example,
|
|
1093
|
+
in this example the display of the variable `name` will not change even
|
|
1094
|
+
if it is set with a new value:
|
|
1095
|
+
|
|
1096
|
+
```handlebars
|
|
1097
|
+
{{unbound this.name}}
|
|
1098
|
+
```
|
|
1099
|
+
|
|
1100
|
+
Like any helper, the `unbound` helper can accept a nested helper expression.
|
|
1101
|
+
This allows for custom helpers to be rendered unbound:
|
|
1102
|
+
|
|
1103
|
+
```handlebars
|
|
1104
|
+
{{unbound (some-custom-helper)}}
|
|
1105
|
+
{{unbound (capitalize this.name)}}
|
|
1106
|
+
{{! You can use any helper, including unbound, in a nested expression }}
|
|
1107
|
+
{{capitalize (unbound this.name)}}
|
|
1108
|
+
```
|
|
1109
|
+
|
|
1110
|
+
The `unbound` helper only accepts a single argument, and it return an
|
|
1111
|
+
unbound value.
|
|
1112
|
+
|
|
1113
|
+
@method unbound
|
|
1114
|
+
@for Ember.Templates.helpers
|
|
1115
|
+
@public
|
|
1116
|
+
*/
|
|
1117
|
+
|
|
1118
|
+
const unbound = internalHelper(({
|
|
1119
|
+
positional,
|
|
1120
|
+
named
|
|
1121
|
+
}) => {
|
|
1122
|
+
(!(positional.length === 1 && Object.keys(named).length === 0) && assert('unbound helper cannot be called with multiple params or hash params', positional.length === 1 && Object.keys(named).length === 0));
|
|
1123
|
+
return createUnboundRef(valueForRef(positional[0]), '(result of an `unbound` helper)');
|
|
1124
|
+
});
|
|
1125
|
+
|
|
1126
|
+
const CAPABILITIES$1 = {
|
|
1127
|
+
dynamicLayout: true,
|
|
1128
|
+
dynamicTag: false,
|
|
1129
|
+
prepareArgs: false,
|
|
1130
|
+
createArgs: true,
|
|
1131
|
+
attributeHook: false,
|
|
1132
|
+
elementHook: false,
|
|
1133
|
+
createCaller: true,
|
|
1134
|
+
dynamicScope: true,
|
|
1135
|
+
updateHook: true,
|
|
1136
|
+
createInstance: true,
|
|
1137
|
+
wrapped: false,
|
|
1138
|
+
willDestroy: false,
|
|
1139
|
+
hasSubOwner: true
|
|
1140
|
+
};
|
|
1141
|
+
class MountManager {
|
|
1142
|
+
getDynamicLayout(state) {
|
|
1143
|
+
let templateFactory = state.engine.lookup('template:application');
|
|
1144
|
+
return unwrapTemplate(templateFactory(state.engine)).asLayout();
|
|
1145
|
+
}
|
|
1146
|
+
getCapabilities() {
|
|
1147
|
+
return CAPABILITIES$1;
|
|
1148
|
+
}
|
|
1149
|
+
getOwner(state) {
|
|
1150
|
+
return state.engine;
|
|
1151
|
+
}
|
|
1152
|
+
create(owner, {
|
|
1153
|
+
name
|
|
1154
|
+
}, args, env) {
|
|
1155
|
+
// TODO
|
|
1156
|
+
// mount is a runtime helper, this shouldn't use dynamic layout
|
|
1157
|
+
// we should resolve the engine app template in the helper
|
|
1158
|
+
// it also should use the owner that looked up the mount helper.
|
|
1159
|
+
(!(owner instanceof EngineInstance) && assert('Expected owner to be an EngineInstance', owner instanceof EngineInstance));
|
|
1160
|
+
let engine = owner.buildChildEngineInstance(name);
|
|
1161
|
+
engine.boot();
|
|
1162
|
+
let applicationFactory = engine.factoryFor(`controller:application`);
|
|
1163
|
+
let controllerFactory = applicationFactory || generateControllerFactory(engine, 'application');
|
|
1164
|
+
let controller;
|
|
1165
|
+
let self;
|
|
1166
|
+
let bucket;
|
|
1167
|
+
let modelRef;
|
|
1168
|
+
if (args.named.has('model')) {
|
|
1169
|
+
modelRef = args.named.get('model');
|
|
1170
|
+
}
|
|
1171
|
+
if (modelRef === undefined) {
|
|
1172
|
+
controller = controllerFactory.create();
|
|
1173
|
+
self = createConstRef(controller, 'this');
|
|
1174
|
+
bucket = {
|
|
1175
|
+
engine,
|
|
1176
|
+
controller,
|
|
1177
|
+
self,
|
|
1178
|
+
modelRef
|
|
1179
|
+
};
|
|
1180
|
+
} else {
|
|
1181
|
+
let model = valueForRef(modelRef);
|
|
1182
|
+
controller = controllerFactory.create({
|
|
1183
|
+
model
|
|
1184
|
+
});
|
|
1185
|
+
self = createConstRef(controller, 'this');
|
|
1186
|
+
bucket = {
|
|
1187
|
+
engine,
|
|
1188
|
+
controller,
|
|
1189
|
+
self,
|
|
1190
|
+
modelRef
|
|
1191
|
+
};
|
|
1192
|
+
}
|
|
1193
|
+
if (env.debugRenderTree) {
|
|
1194
|
+
associateDestroyableChild(engine, controller);
|
|
1195
|
+
}
|
|
1196
|
+
return bucket;
|
|
1197
|
+
}
|
|
1198
|
+
getDebugName({
|
|
1199
|
+
name
|
|
1200
|
+
}) {
|
|
1201
|
+
return name;
|
|
1202
|
+
}
|
|
1203
|
+
getDebugCustomRenderTree(definition, state, args) {
|
|
1204
|
+
return [{
|
|
1205
|
+
bucket: state.engine,
|
|
1206
|
+
instance: state.engine,
|
|
1207
|
+
type: 'engine',
|
|
1208
|
+
name: definition.name,
|
|
1209
|
+
args
|
|
1210
|
+
}, {
|
|
1211
|
+
bucket: state.controller,
|
|
1212
|
+
instance: state.controller,
|
|
1213
|
+
type: 'route-template',
|
|
1214
|
+
name: 'application',
|
|
1215
|
+
args
|
|
1216
|
+
}];
|
|
1217
|
+
}
|
|
1218
|
+
getSelf({
|
|
1219
|
+
self
|
|
1220
|
+
}) {
|
|
1221
|
+
return self;
|
|
1222
|
+
}
|
|
1223
|
+
getDestroyable(bucket) {
|
|
1224
|
+
return bucket.engine;
|
|
1225
|
+
}
|
|
1226
|
+
didCreate() {}
|
|
1227
|
+
didUpdate() {}
|
|
1228
|
+
didRenderLayout() {}
|
|
1229
|
+
didUpdateLayout() {}
|
|
1230
|
+
update(bucket) {
|
|
1231
|
+
let {
|
|
1232
|
+
controller,
|
|
1233
|
+
modelRef
|
|
1234
|
+
} = bucket;
|
|
1235
|
+
if (modelRef !== undefined) {
|
|
1236
|
+
controller.set('model', valueForRef(modelRef));
|
|
1237
|
+
}
|
|
1238
|
+
}
|
|
1239
|
+
}
|
|
1240
|
+
const MOUNT_MANAGER = new MountManager();
|
|
1241
|
+
class MountDefinition {
|
|
1242
|
+
// handle is not used by this custom definition
|
|
1243
|
+
handle = -1;
|
|
1244
|
+
state;
|
|
1245
|
+
manager = MOUNT_MANAGER;
|
|
1246
|
+
compilable = null;
|
|
1247
|
+
capabilities = capabilityFlagsFrom(CAPABILITIES$1);
|
|
1248
|
+
constructor(resolvedName) {
|
|
1249
|
+
this.resolvedName = resolvedName;
|
|
1250
|
+
this.state = {
|
|
1251
|
+
name: resolvedName
|
|
1252
|
+
};
|
|
1253
|
+
}
|
|
1254
|
+
}
|
|
1255
|
+
|
|
1256
|
+
/**
|
|
1257
|
+
@module ember
|
|
1258
|
+
*/
|
|
1259
|
+
|
|
1260
|
+
|
|
1261
|
+
/**
|
|
1262
|
+
The `{{mount}}` helper lets you embed a routeless engine in a template.
|
|
1263
|
+
Mounting an engine will cause an instance to be booted and its `application`
|
|
1264
|
+
template to be rendered.
|
|
1265
|
+
|
|
1266
|
+
For example, the following template mounts the `ember-chat` engine:
|
|
1267
|
+
|
|
1268
|
+
```handlebars
|
|
1269
|
+
{{! application.hbs }}
|
|
1270
|
+
{{mount "ember-chat"}}
|
|
1271
|
+
```
|
|
1272
|
+
|
|
1273
|
+
Additionally, you can also pass in a `model` argument that will be
|
|
1274
|
+
set as the engines model. This can be an existing object:
|
|
1275
|
+
|
|
1276
|
+
```
|
|
1277
|
+
<div>
|
|
1278
|
+
{{mount 'admin' model=userSettings}}
|
|
1279
|
+
</div>
|
|
1280
|
+
```
|
|
1281
|
+
|
|
1282
|
+
Or an inline `hash`, and you can even pass components:
|
|
1283
|
+
|
|
1284
|
+
```
|
|
1285
|
+
<div>
|
|
1286
|
+
<h1>Application template!</h1>
|
|
1287
|
+
{{mount 'admin' model=(hash
|
|
1288
|
+
title='Secret Admin'
|
|
1289
|
+
signInButton=(component 'sign-in-button')
|
|
1290
|
+
)}}
|
|
1291
|
+
</div>
|
|
1292
|
+
```
|
|
1293
|
+
|
|
1294
|
+
@method mount
|
|
1295
|
+
@param {String} name Name of the engine to mount.
|
|
1296
|
+
@param {Object} [model] Object that will be set as
|
|
1297
|
+
the model of the engine.
|
|
1298
|
+
@for Ember.Templates.helpers
|
|
1299
|
+
@public
|
|
1300
|
+
*/
|
|
1301
|
+
const mountHelper = internalHelper((args, owner) => {
|
|
1302
|
+
(!(owner) && assert('{{mount}} must be used within a component that has an owner', owner));
|
|
1303
|
+
let nameRef = args.positional[0];
|
|
1304
|
+
let captured;
|
|
1305
|
+
(!(args.positional.length === 1) && assert('You can only pass a single positional argument to the {{mount}} helper, e.g. {{mount "chat-engine"}}.', args.positional.length === 1));
|
|
1306
|
+
if (args.named) {
|
|
1307
|
+
let keys = Object.keys(args.named);
|
|
1308
|
+
let extra = keys.filter(k => k !== 'model');
|
|
1309
|
+
(!(extra.length === 0) && assert('You can only pass a `model` argument to the {{mount}} helper, ' + 'e.g. {{mount "profile-engine" model=this.profile}}. ' + `You passed ${extra.join(',')}.`, extra.length === 0));
|
|
1310
|
+
}
|
|
1311
|
+
captured = createCapturedArgs(args.named, EMPTY_POSITIONAL);
|
|
1312
|
+
let lastName, lastDef;
|
|
1313
|
+
return createComputeRef(() => {
|
|
1314
|
+
let name = valueForRef(nameRef);
|
|
1315
|
+
if (typeof name === 'string') {
|
|
1316
|
+
if (lastName === name) {
|
|
1317
|
+
return lastDef;
|
|
1318
|
+
}
|
|
1319
|
+
(!(owner.hasRegistration(`engine:${name}`)) && assert(`You used \`{{mount '${name}'}}\`, but the engine '${name}' can not be found.`, owner.hasRegistration(`engine:${name}`)));
|
|
1320
|
+
lastName = name;
|
|
1321
|
+
lastDef = curry(0, new MountDefinition(name), owner, captured, true);
|
|
1322
|
+
return lastDef;
|
|
1323
|
+
} else {
|
|
1324
|
+
(!(name === null || name === undefined) && assert(`Invalid engine name '${name}' specified, engine name must be either a string, null or undefined.`, name === null || name === undefined));
|
|
1325
|
+
lastDef = null;
|
|
1326
|
+
lastName = null;
|
|
1327
|
+
return null;
|
|
1328
|
+
}
|
|
1329
|
+
});
|
|
1330
|
+
});
|
|
1331
|
+
|
|
1332
|
+
const CAPABILITIES = {
|
|
1333
|
+
dynamicLayout: false,
|
|
1334
|
+
dynamicTag: false,
|
|
1335
|
+
prepareArgs: false,
|
|
1336
|
+
createArgs: true,
|
|
1337
|
+
attributeHook: false,
|
|
1338
|
+
elementHook: false,
|
|
1339
|
+
createCaller: false,
|
|
1340
|
+
dynamicScope: false,
|
|
1341
|
+
updateHook: false,
|
|
1342
|
+
createInstance: true,
|
|
1343
|
+
wrapped: false,
|
|
1344
|
+
willDestroy: false,
|
|
1345
|
+
hasSubOwner: false
|
|
1346
|
+
};
|
|
1347
|
+
const CAPABILITIES_MASK = capabilityFlagsFrom(CAPABILITIES);
|
|
1348
|
+
class RouteTemplateManager {
|
|
1349
|
+
create(_owner, _definition, args) {
|
|
1350
|
+
let self = args.named.get('controller');
|
|
1351
|
+
{
|
|
1352
|
+
self = createDebugAliasRef('this', self);
|
|
1353
|
+
}
|
|
1354
|
+
let controller = valueForRef(self);
|
|
1355
|
+
return {
|
|
1356
|
+
self,
|
|
1357
|
+
controller
|
|
1358
|
+
};
|
|
1359
|
+
}
|
|
1360
|
+
getSelf({
|
|
1361
|
+
self
|
|
1362
|
+
}) {
|
|
1363
|
+
return self;
|
|
1364
|
+
}
|
|
1365
|
+
getDebugName({
|
|
1366
|
+
name
|
|
1367
|
+
}) {
|
|
1368
|
+
return `route-template (${name})`;
|
|
1369
|
+
}
|
|
1370
|
+
getDebugCustomRenderTree({
|
|
1371
|
+
name
|
|
1372
|
+
}, state, args) {
|
|
1373
|
+
return [{
|
|
1374
|
+
bucket: state,
|
|
1375
|
+
type: 'route-template',
|
|
1376
|
+
name,
|
|
1377
|
+
args,
|
|
1378
|
+
instance: state.controller
|
|
1379
|
+
}];
|
|
1380
|
+
}
|
|
1381
|
+
getCapabilities() {
|
|
1382
|
+
return CAPABILITIES;
|
|
1383
|
+
}
|
|
1384
|
+
didRenderLayout() {}
|
|
1385
|
+
didUpdateLayout() {}
|
|
1386
|
+
didCreate() {}
|
|
1387
|
+
didUpdate() {}
|
|
1388
|
+
getDestroyable() {
|
|
1389
|
+
return null;
|
|
1390
|
+
}
|
|
1391
|
+
}
|
|
1392
|
+
const ROUTE_TEMPLATE_MANAGER = new RouteTemplateManager();
|
|
1393
|
+
|
|
1394
|
+
/**
|
|
1395
|
+
* This "upgrades" a route template into a invocable component. Conceptually
|
|
1396
|
+
* it can be 1:1 for each unique `Template`, but it's also cheap to construct,
|
|
1397
|
+
* so unless the stability is desirable for other reasons, it's probably not
|
|
1398
|
+
* worth caching this.
|
|
1399
|
+
*/
|
|
1400
|
+
class RouteTemplate {
|
|
1401
|
+
// handle is not used by this custom definition
|
|
1402
|
+
handle = -1;
|
|
1403
|
+
resolvedName;
|
|
1404
|
+
state;
|
|
1405
|
+
manager = ROUTE_TEMPLATE_MANAGER;
|
|
1406
|
+
capabilities = CAPABILITIES_MASK;
|
|
1407
|
+
compilable;
|
|
1408
|
+
constructor(name, template) {
|
|
1409
|
+
let unwrapped = unwrapTemplate(template);
|
|
1410
|
+
// TODO This actually seems inaccurate – it ultimately came from the
|
|
1411
|
+
// outlet's name. Also, setting this overrides `getDebugName()` in that
|
|
1412
|
+
// message. Is that desirable?
|
|
1413
|
+
this.resolvedName = name;
|
|
1414
|
+
this.state = {
|
|
1415
|
+
name
|
|
1416
|
+
};
|
|
1417
|
+
this.compilable = unwrapped.asLayout();
|
|
1418
|
+
}
|
|
1419
|
+
}
|
|
1420
|
+
|
|
1421
|
+
// TODO a lot these fields are copied from the adjacent existing components
|
|
1422
|
+
// implementation, haven't looked into who cares about `ComponentDefinition`
|
|
1423
|
+
// and if it is appropriate here. It seems like this version is intended to
|
|
1424
|
+
// be used with `curry` which probably isn't necessary here. It could be the
|
|
1425
|
+
// case that we just want to do something more similar to `InternalComponent`
|
|
1426
|
+
// (the one we used to implement `Input` and `LinkTo`). For now it follows
|
|
1427
|
+
// the same pattern to get things going.
|
|
1428
|
+
function makeRouteTemplate(owner, name, template) {
|
|
1429
|
+
let routeTemplate = new RouteTemplate(name, template);
|
|
1430
|
+
return curry(0, routeTemplate, owner, null, true);
|
|
1431
|
+
}
|
|
1432
|
+
|
|
1433
|
+
/**
|
|
1434
|
+
The `{{outlet}}` helper lets you specify where a child route will render in
|
|
1435
|
+
your template. An important use of the `{{outlet}}` helper is in your
|
|
1436
|
+
application's `application.hbs` file:
|
|
1437
|
+
|
|
1438
|
+
```app/templates/application.hbs
|
|
1439
|
+
<MyHeader />
|
|
1440
|
+
|
|
1441
|
+
<div class="my-dynamic-content">
|
|
1442
|
+
<!-- this content will change based on the current route, which depends on the current URL -->
|
|
1443
|
+
{{outlet}}
|
|
1444
|
+
</div>
|
|
1445
|
+
|
|
1446
|
+
<MyFooter />
|
|
1447
|
+
```
|
|
1448
|
+
|
|
1449
|
+
See the [routing guide](https://guides.emberjs.com/release/routing/rendering-a-template/) for more
|
|
1450
|
+
information on how your `route` interacts with the `{{outlet}}` helper.
|
|
1451
|
+
Note: Your content __will not render__ if there isn't an `{{outlet}}` for it.
|
|
1452
|
+
|
|
1453
|
+
@method outlet
|
|
1454
|
+
@for Ember.Templates.helpers
|
|
1455
|
+
@public
|
|
1456
|
+
*/
|
|
1457
|
+
const outletHelper = internalHelper((_args, owner, scope) => {
|
|
1458
|
+
(!(owner) && assert('Expected owner to be present, {{outlet}} requires an owner', owner));
|
|
1459
|
+
(!(scope) && assert('Expected dynamic scope to be present. You may have attempted to use the {{outlet}} keyword dynamically. This keyword cannot be used dynamically.', scope));
|
|
1460
|
+
let outletRef = createComputeRef(() => {
|
|
1461
|
+
let state = valueForRef(scope.get('outletState'));
|
|
1462
|
+
return state?.outlets?.main;
|
|
1463
|
+
});
|
|
1464
|
+
let lastState = null;
|
|
1465
|
+
let outlet = null;
|
|
1466
|
+
return createComputeRef(() => {
|
|
1467
|
+
let outletState = valueForRef(outletRef);
|
|
1468
|
+
let state = stateFor(outletRef, outletState);
|
|
1469
|
+
|
|
1470
|
+
// This code is deliberately using the behavior in glimmer-vm where in
|
|
1471
|
+
// <@Component />, the component is considered stabled via `===`, and
|
|
1472
|
+
// will continue to re-render in-place as long as the `===` holds, but
|
|
1473
|
+
// when it changes to a different object, it teardown the old component
|
|
1474
|
+
// (running destructors, etc), and render the component in its place (or
|
|
1475
|
+
// nothing if the new value is nullish. Here we are carefully exploiting
|
|
1476
|
+
// that fact, and returns the same stable object so long as it is the
|
|
1477
|
+
// same route, but return a different one when the route changes. On the
|
|
1478
|
+
// other hand, changing the model only intentionally do not teardown the
|
|
1479
|
+
// component and instead re-render in-place.
|
|
1480
|
+
if (!isStable(state, lastState)) {
|
|
1481
|
+
lastState = state;
|
|
1482
|
+
if (state !== null) {
|
|
1483
|
+
// If we are crossing an engine mount point, this is how the owner
|
|
1484
|
+
// gets switched.
|
|
1485
|
+
let outletOwner = outletState?.render?.owner ?? owner;
|
|
1486
|
+
let named = dict();
|
|
1487
|
+
|
|
1488
|
+
// Here we either have a raw template that needs to be normalized,
|
|
1489
|
+
// or a component that we can render as-is. `RouteTemplate` upgrades
|
|
1490
|
+
// the template into a component so we can have a unified code path.
|
|
1491
|
+
// We still store the original `template` value, because we rely on
|
|
1492
|
+
// its identity for the stability check, and the `RouteTemplate`
|
|
1493
|
+
// wrapper doesn't dedup for us.
|
|
1494
|
+
let template = state.template;
|
|
1495
|
+
let component;
|
|
1496
|
+
if (hasInternalComponentManager(template)) {
|
|
1497
|
+
component = template;
|
|
1498
|
+
} else {
|
|
1499
|
+
{
|
|
1500
|
+
// We don't appear to have a standard way or a brand to check, but for the
|
|
1501
|
+
// purpose of avoiding obvious user errors, this probably gets you close
|
|
1502
|
+
// enough.
|
|
1503
|
+
let isTemplate = template => {
|
|
1504
|
+
if (template === null || typeof template !== 'object') {
|
|
1505
|
+
return false;
|
|
1506
|
+
} else {
|
|
1507
|
+
let t = template;
|
|
1508
|
+
return t.result === 'ok' || t.result === 'error';
|
|
1509
|
+
}
|
|
1510
|
+
};
|
|
1511
|
+
|
|
1512
|
+
// We made it past the `TemplateFactory` instantiation before
|
|
1513
|
+
// getting here, so either we got unlucky where the invalid type
|
|
1514
|
+
// happens to be a function that didn't mind taking owner as an
|
|
1515
|
+
// argument, or this was directly set by something like test
|
|
1516
|
+
// helpers.
|
|
1517
|
+
if (!isTemplate(template)) {
|
|
1518
|
+
let label;
|
|
1519
|
+
try {
|
|
1520
|
+
label = `\`${String(template)}\``;
|
|
1521
|
+
} catch {
|
|
1522
|
+
label = 'an unknown object';
|
|
1523
|
+
}
|
|
1524
|
+
(assert(`Failed to render the \`${state.name}\` route: expected ` + `a component or Template object, but got ${label}.`));
|
|
1525
|
+
}
|
|
1526
|
+
}
|
|
1527
|
+
component = makeRouteTemplate(outletOwner, state.name, template);
|
|
1528
|
+
}
|
|
1529
|
+
|
|
1530
|
+
// Component is stable for the lifetime of the outlet
|
|
1531
|
+
named['Component'] = createConstRef(component, '@Component');
|
|
1532
|
+
|
|
1533
|
+
// Controller is stable for the lifetime of the outlet
|
|
1534
|
+
named['controller'] = createConstRef(state.controller, '@controller');
|
|
1535
|
+
|
|
1536
|
+
// Create a ref for the model
|
|
1537
|
+
let modelRef = childRefFromParts(outletRef, ['render', 'model']);
|
|
1538
|
+
|
|
1539
|
+
// Store the value of the model
|
|
1540
|
+
let model = valueForRef(modelRef);
|
|
1541
|
+
|
|
1542
|
+
// Create a compute ref which we pass in as the `{{@model}}` reference
|
|
1543
|
+
// for the outlet. This ref will update and return the value of the
|
|
1544
|
+
// model _until_ the outlet itself changes. Once the outlet changes,
|
|
1545
|
+
// dynamic scope also changes, and so the original model ref would not
|
|
1546
|
+
// provide the correct updated value. So we stop updating and return
|
|
1547
|
+
// the _last_ model value for that outlet.
|
|
1548
|
+
named['model'] = createComputeRef(() => {
|
|
1549
|
+
if (lastState === state) {
|
|
1550
|
+
model = valueForRef(modelRef);
|
|
1551
|
+
}
|
|
1552
|
+
return model;
|
|
1553
|
+
});
|
|
1554
|
+
{
|
|
1555
|
+
named['model'] = createDebugAliasRef('@model', named['model']);
|
|
1556
|
+
}
|
|
1557
|
+
let args = createCapturedArgs(named, EMPTY_POSITIONAL);
|
|
1558
|
+
|
|
1559
|
+
// Package up everything
|
|
1560
|
+
outlet = curry(0, new OutletComponent(owner, state), outletOwner, args, true);
|
|
1561
|
+
} else {
|
|
1562
|
+
outlet = null;
|
|
1563
|
+
}
|
|
1564
|
+
}
|
|
1565
|
+
return outlet;
|
|
1566
|
+
});
|
|
1567
|
+
});
|
|
1568
|
+
function stateFor(ref, outlet) {
|
|
1569
|
+
if (outlet === undefined) return null;
|
|
1570
|
+
let render = outlet.render;
|
|
1571
|
+
if (render === undefined) return null;
|
|
1572
|
+
let template = render.template;
|
|
1573
|
+
// The type doesn't actually allow for `null`, but if we make it past this
|
|
1574
|
+
// point it is really important that we have _something_ to render. We could
|
|
1575
|
+
// assert, but that is probably overly strict for very little to gain.
|
|
1576
|
+
if (template === undefined || template === null) return null;
|
|
1577
|
+
return {
|
|
1578
|
+
ref,
|
|
1579
|
+
name: render.name,
|
|
1580
|
+
template,
|
|
1581
|
+
controller: render.controller
|
|
1582
|
+
};
|
|
1583
|
+
}
|
|
1584
|
+
function isStable(state, lastState) {
|
|
1585
|
+
if (state === null || lastState === null) {
|
|
1586
|
+
return false;
|
|
1587
|
+
}
|
|
1588
|
+
return state.template === lastState.template && state.controller === lastState.controller;
|
|
1589
|
+
}
|
|
1590
|
+
|
|
1591
|
+
function instrumentationPayload(name) {
|
|
1592
|
+
return {
|
|
1593
|
+
object: `component:${name}`
|
|
1594
|
+
};
|
|
1595
|
+
}
|
|
1596
|
+
function componentFor(name, owner) {
|
|
1597
|
+
let fullName = `component:${name}`;
|
|
1598
|
+
return owner.factoryFor(fullName) || null;
|
|
1599
|
+
}
|
|
1600
|
+
function lookupComponentPair(owner, name) {
|
|
1601
|
+
let component = componentFor(name, owner);
|
|
1602
|
+
if (isFactory(component) && component.class) {
|
|
1603
|
+
let layout = getComponentTemplate(component.class);
|
|
1604
|
+
if (layout !== undefined) {
|
|
1605
|
+
return {
|
|
1606
|
+
component,
|
|
1607
|
+
layout
|
|
1608
|
+
};
|
|
1609
|
+
}
|
|
1610
|
+
}
|
|
1611
|
+
if (component === null) {
|
|
1612
|
+
return null;
|
|
1613
|
+
} else {
|
|
1614
|
+
return {
|
|
1615
|
+
component,
|
|
1616
|
+
layout: null
|
|
1617
|
+
};
|
|
1618
|
+
}
|
|
1619
|
+
}
|
|
1620
|
+
const BUILTIN_KEYWORD_HELPERS = {
|
|
1621
|
+
mut,
|
|
1622
|
+
readonly,
|
|
1623
|
+
unbound,
|
|
1624
|
+
'-hash': hash,
|
|
1625
|
+
'-each-in': eachIn,
|
|
1626
|
+
'-normalize-class': normalizeClassHelper,
|
|
1627
|
+
'-resolve': resolve,
|
|
1628
|
+
'-track-array': trackArray,
|
|
1629
|
+
'-mount': mountHelper,
|
|
1630
|
+
'-outlet': outletHelper,
|
|
1631
|
+
'-in-el-null': inElementNullCheckHelper
|
|
1632
|
+
};
|
|
1633
|
+
const BUILTIN_HELPERS = {
|
|
1634
|
+
...BUILTIN_KEYWORD_HELPERS,
|
|
1635
|
+
array,
|
|
1636
|
+
concat,
|
|
1637
|
+
fn,
|
|
1638
|
+
get: get$1,
|
|
1639
|
+
hash,
|
|
1640
|
+
'unique-id': uniqueId
|
|
1641
|
+
};
|
|
1642
|
+
{
|
|
1643
|
+
BUILTIN_HELPERS['-disallow-dynamic-resolution'] = disallowDynamicResolution;
|
|
1644
|
+
}
|
|
1645
|
+
|
|
1646
|
+
// With the implementation of RFC #1006(https://rfcs.emberjs.com/id/1006-deprecate-action-template-helper), the `action` modifer was removed. It was the
|
|
1647
|
+
// only built-in keyword modifier, so this object is currently empty.
|
|
1648
|
+
const BUILTIN_KEYWORD_MODIFIERS = {};
|
|
1649
|
+
const BUILTIN_MODIFIERS = {
|
|
1650
|
+
...BUILTIN_KEYWORD_MODIFIERS,
|
|
1651
|
+
on
|
|
1652
|
+
};
|
|
1653
|
+
const CLASSIC_HELPER_MANAGER_ASSOCIATED = new WeakSet();
|
|
1654
|
+
class ResolverImpl {
|
|
1655
|
+
componentDefinitionCache = new Map();
|
|
1656
|
+
lookupPartial() {
|
|
1657
|
+
return null;
|
|
1658
|
+
}
|
|
1659
|
+
lookupHelper(name, owner) {
|
|
1660
|
+
(!(!(BUILTIN_HELPERS[name] && owner.hasRegistration(`helper:${name}`))) && assert(`You attempted to overwrite the built-in helper "${name}" which is not allowed. Please rename the helper.`, !(BUILTIN_HELPERS[name] && owner.hasRegistration(`helper:${name}`))));
|
|
1661
|
+
let helper = BUILTIN_HELPERS[name];
|
|
1662
|
+
if (helper !== undefined) {
|
|
1663
|
+
return helper;
|
|
1664
|
+
}
|
|
1665
|
+
let factory = owner.factoryFor(`helper:${name}`);
|
|
1666
|
+
if (factory === undefined) {
|
|
1667
|
+
return null;
|
|
1668
|
+
}
|
|
1669
|
+
let definition = factory.class;
|
|
1670
|
+
if (definition === undefined) {
|
|
1671
|
+
return null;
|
|
1672
|
+
}
|
|
1673
|
+
if (typeof definition === 'function' && isClassicHelper(definition)) {
|
|
1674
|
+
// For classic class based helpers, we need to pass the factoryFor result itself rather
|
|
1675
|
+
// than the raw value (`factoryFor(...).class`). This is because injections are already
|
|
1676
|
+
// bound in the factoryFor result, including type-based injections
|
|
1677
|
+
|
|
1678
|
+
{
|
|
1679
|
+
// In DEBUG we need to only set the associated value once, otherwise
|
|
1680
|
+
// we'll trigger an assertion
|
|
1681
|
+
if (!CLASSIC_HELPER_MANAGER_ASSOCIATED.has(factory)) {
|
|
1682
|
+
CLASSIC_HELPER_MANAGER_ASSOCIATED.add(factory);
|
|
1683
|
+
setInternalHelperManager(CLASSIC_HELPER_MANAGER, factory);
|
|
1684
|
+
}
|
|
1685
|
+
}
|
|
1686
|
+
return factory;
|
|
1687
|
+
}
|
|
1688
|
+
return definition;
|
|
1689
|
+
}
|
|
1690
|
+
lookupBuiltInHelper(name) {
|
|
1691
|
+
return BUILTIN_KEYWORD_HELPERS[name] ?? null;
|
|
1692
|
+
}
|
|
1693
|
+
lookupModifier(name, owner) {
|
|
1694
|
+
let builtin = BUILTIN_MODIFIERS[name];
|
|
1695
|
+
if (builtin !== undefined) {
|
|
1696
|
+
return builtin;
|
|
1697
|
+
}
|
|
1698
|
+
let modifier = owner.factoryFor(`modifier:${name}`);
|
|
1699
|
+
if (modifier === undefined) {
|
|
1700
|
+
return null;
|
|
1701
|
+
}
|
|
1702
|
+
return modifier.class || null;
|
|
1703
|
+
}
|
|
1704
|
+
lookupBuiltInModifier(name) {
|
|
1705
|
+
return BUILTIN_KEYWORD_MODIFIERS[name] ?? null;
|
|
1706
|
+
}
|
|
1707
|
+
lookupComponent(name, owner) {
|
|
1708
|
+
let pair = lookupComponentPair(owner, name);
|
|
1709
|
+
if (pair === null) {
|
|
1710
|
+
(!(name !== 'text-area') && assert('Could not find component `<TextArea />` (did you mean `<Textarea />`?)', name !== 'text-area'));
|
|
1711
|
+
return null;
|
|
1712
|
+
}
|
|
1713
|
+
let template = null;
|
|
1714
|
+
let key;
|
|
1715
|
+
if (pair.component === null) {
|
|
1716
|
+
key = template = pair.layout(owner);
|
|
1717
|
+
} else {
|
|
1718
|
+
key = pair.component;
|
|
1719
|
+
}
|
|
1720
|
+
let cachedComponentDefinition = this.componentDefinitionCache.get(key);
|
|
1721
|
+
if (cachedComponentDefinition !== undefined) {
|
|
1722
|
+
return cachedComponentDefinition;
|
|
1723
|
+
}
|
|
1724
|
+
if (template === null && pair.layout !== null) {
|
|
1725
|
+
template = pair.layout(owner);
|
|
1726
|
+
}
|
|
1727
|
+
let finalizer = _instrumentStart('render.getComponentDefinition', instrumentationPayload, name);
|
|
1728
|
+
let definition = null;
|
|
1729
|
+
if (pair.component === null) {
|
|
1730
|
+
definition = {
|
|
1731
|
+
state: templateOnlyComponent(undefined, name),
|
|
1732
|
+
manager: TEMPLATE_ONLY_COMPONENT_MANAGER,
|
|
1733
|
+
template
|
|
1734
|
+
};
|
|
1735
|
+
} else {
|
|
1736
|
+
let factory = pair.component;
|
|
1737
|
+
(!(factory.class !== undefined) && assert(`missing component class ${name}`, factory.class !== undefined));
|
|
1738
|
+
let ComponentClass = factory.class;
|
|
1739
|
+
let manager = getInternalComponentManager(ComponentClass);
|
|
1740
|
+
definition = {
|
|
1741
|
+
state: isCurlyManager(manager) ? factory : ComponentClass,
|
|
1742
|
+
manager,
|
|
1743
|
+
template
|
|
1744
|
+
};
|
|
1745
|
+
}
|
|
1746
|
+
finalizer();
|
|
1747
|
+
this.componentDefinitionCache.set(key, definition);
|
|
1748
|
+
(!(!(definition === null && name === 'text-area')) && assert('Could not find component `<TextArea />` (did you mean `<Textarea />`?)', !(definition === null && name === 'text-area')));
|
|
1749
|
+
return definition;
|
|
1750
|
+
}
|
|
1751
|
+
}
|
|
1752
|
+
|
|
1753
|
+
// We use the `InternalOwner` notion here because we actually need all of its
|
|
1754
|
+
// API for using with renderers (normally, it will be `EngineInstance`).
|
|
1755
|
+
// We use `getOwner` from our internal home for it rather than the narrower
|
|
1756
|
+
// public API for the same reason.
|
|
1757
|
+
const TOP_LEVEL_NAME = '-top-level';
|
|
1758
|
+
class OutletView {
|
|
1759
|
+
static extend(injections) {
|
|
1760
|
+
return class extends OutletView {
|
|
1761
|
+
static create(options) {
|
|
1762
|
+
if (options) {
|
|
1763
|
+
return super.create(Object.assign({}, injections, options));
|
|
1764
|
+
} else {
|
|
1765
|
+
return super.create(injections);
|
|
1766
|
+
}
|
|
1767
|
+
}
|
|
1768
|
+
};
|
|
1769
|
+
}
|
|
1770
|
+
static reopenClass(injections) {
|
|
1771
|
+
Object.assign(this, injections);
|
|
1772
|
+
}
|
|
1773
|
+
static create(options) {
|
|
1774
|
+
let {
|
|
1775
|
+
environment: _environment,
|
|
1776
|
+
application: namespace,
|
|
1777
|
+
template: templateFactory
|
|
1778
|
+
} = options;
|
|
1779
|
+
let owner = getOwner(options);
|
|
1780
|
+
(!(owner) && assert('OutletView is unexpectedly missing an owner', owner));
|
|
1781
|
+
let template = templateFactory(owner);
|
|
1782
|
+
return new OutletView(_environment, owner, template, namespace);
|
|
1783
|
+
}
|
|
1784
|
+
ref;
|
|
1785
|
+
state;
|
|
1786
|
+
constructor(_environment, owner, template, namespace) {
|
|
1787
|
+
this._environment = _environment;
|
|
1788
|
+
this.owner = owner;
|
|
1789
|
+
this.template = template;
|
|
1790
|
+
this.namespace = namespace;
|
|
1791
|
+
let outletStateTag = createTag();
|
|
1792
|
+
let outletState = {
|
|
1793
|
+
outlets: {
|
|
1794
|
+
main: undefined
|
|
1795
|
+
},
|
|
1796
|
+
render: {
|
|
1797
|
+
owner: owner,
|
|
1798
|
+
name: TOP_LEVEL_NAME,
|
|
1799
|
+
controller: undefined,
|
|
1800
|
+
model: undefined,
|
|
1801
|
+
template
|
|
1802
|
+
}
|
|
1803
|
+
};
|
|
1804
|
+
let ref = this.ref = createComputeRef(() => {
|
|
1805
|
+
consumeTag(outletStateTag);
|
|
1806
|
+
return outletState;
|
|
1807
|
+
}, state => {
|
|
1808
|
+
DIRTY_TAG$1(outletStateTag);
|
|
1809
|
+
outletState.outlets['main'] = state;
|
|
1810
|
+
});
|
|
1811
|
+
this.state = {
|
|
1812
|
+
ref,
|
|
1813
|
+
name: TOP_LEVEL_NAME,
|
|
1814
|
+
template,
|
|
1815
|
+
controller: undefined
|
|
1816
|
+
};
|
|
1817
|
+
}
|
|
1818
|
+
appendTo(selector) {
|
|
1819
|
+
let target;
|
|
1820
|
+
if (this._environment.hasDOM) {
|
|
1821
|
+
target = typeof selector === 'string' ? document.querySelector(selector) : selector;
|
|
1822
|
+
} else {
|
|
1823
|
+
target = selector;
|
|
1824
|
+
}
|
|
1825
|
+
let renderer = this.owner.lookup('renderer:-dom');
|
|
1826
|
+
|
|
1827
|
+
// SAFETY: It's not clear that this cast is safe.
|
|
1828
|
+
// The types for appendOutletView may be incorrect or this is a potential bug.
|
|
1829
|
+
schedule('render', renderer, 'appendOutletView', this, target);
|
|
1830
|
+
}
|
|
1831
|
+
rerender() {
|
|
1832
|
+
/**/
|
|
1833
|
+
}
|
|
1834
|
+
setOutletState(state) {
|
|
1835
|
+
updateRef(this.ref, state);
|
|
1836
|
+
}
|
|
1837
|
+
destroy() {
|
|
1838
|
+
/**/
|
|
1839
|
+
}
|
|
1840
|
+
}
|
|
1841
|
+
|
|
1842
|
+
class DynamicScope {
|
|
1843
|
+
constructor(view, outletState) {
|
|
1844
|
+
this.view = view;
|
|
1845
|
+
this.outletState = outletState;
|
|
1846
|
+
}
|
|
1847
|
+
child() {
|
|
1848
|
+
return new DynamicScope(this.view, this.outletState);
|
|
1849
|
+
}
|
|
1850
|
+
get(key) {
|
|
1851
|
+
(!(key === 'outletState') && assert(`Using \`-get-dynamic-scope\` is only supported for \`outletState\` (you used \`${key}\`).`, key === 'outletState'));
|
|
1852
|
+
return this.outletState;
|
|
1853
|
+
}
|
|
1854
|
+
set(key, value) {
|
|
1855
|
+
(!(key === 'outletState') && assert(`Using \`-with-dynamic-scope\` is only supported for \`outletState\` (you used \`${key}\`).`, key === 'outletState'));
|
|
1856
|
+
this.outletState = value;
|
|
1857
|
+
return value;
|
|
1858
|
+
}
|
|
1859
|
+
}
|
|
1860
|
+
const NO_OP = () => {};
|
|
1861
|
+
|
|
1862
|
+
// This wrapper logic prevents us from rerendering in case of a hard failure
|
|
1863
|
+
// during render. This prevents infinite revalidation type loops from occuring,
|
|
1864
|
+
// and ensures that errors are not swallowed by subsequent follow on failures.
|
|
1865
|
+
function errorLoopTransaction(fn) {
|
|
1866
|
+
{
|
|
1867
|
+
return () => {
|
|
1868
|
+
let didError = true;
|
|
1869
|
+
try {
|
|
1870
|
+
fn();
|
|
1871
|
+
didError = false;
|
|
1872
|
+
} finally {
|
|
1873
|
+
if (didError) {
|
|
1874
|
+
// Noop the function so that we won't keep calling it and causing
|
|
1875
|
+
// infinite looping failures;
|
|
1876
|
+
fn = () => {
|
|
1877
|
+
// eslint-disable-next-line no-console
|
|
1878
|
+
console.warn('Attempted to rerender, but the Ember application has had an unrecoverable error occur during render. You should reload the application after fixing the cause of the error.');
|
|
1879
|
+
};
|
|
1880
|
+
}
|
|
1881
|
+
}
|
|
1882
|
+
};
|
|
1883
|
+
}
|
|
1884
|
+
}
|
|
1885
|
+
class ComponentRootState {
|
|
1886
|
+
type = 'component';
|
|
1887
|
+
#result;
|
|
1888
|
+
#render;
|
|
1889
|
+
constructor(state, definition, options) {
|
|
1890
|
+
this.#render = errorLoopTransaction(() => {
|
|
1891
|
+
let iterator = renderComponent$1(state.context, state.builder(state.env, options.into), state.owner, definition, options?.args);
|
|
1892
|
+
let result = this.#result = iterator.sync();
|
|
1893
|
+
associateDestroyableChild(this, this.#result);
|
|
1894
|
+
this.#render = errorLoopTransaction(() => {
|
|
1895
|
+
if (isDestroying(result) || isDestroyed(result)) return;
|
|
1896
|
+
return result.rerender({
|
|
1897
|
+
alwaysRevalidate: false
|
|
1898
|
+
});
|
|
1899
|
+
});
|
|
1900
|
+
});
|
|
1901
|
+
}
|
|
1902
|
+
isFor(_component) {
|
|
1903
|
+
return false;
|
|
1904
|
+
}
|
|
1905
|
+
render() {
|
|
1906
|
+
this.#render();
|
|
1907
|
+
}
|
|
1908
|
+
destroy() {
|
|
1909
|
+
destroy(this);
|
|
1910
|
+
}
|
|
1911
|
+
get destroyed() {
|
|
1912
|
+
return isDestroyed(this);
|
|
1913
|
+
}
|
|
1914
|
+
get result() {
|
|
1915
|
+
return this.#result;
|
|
1916
|
+
}
|
|
1917
|
+
}
|
|
1918
|
+
class ClassicRootState {
|
|
1919
|
+
type = 'classic';
|
|
1920
|
+
id;
|
|
1921
|
+
result;
|
|
1922
|
+
destroyed;
|
|
1923
|
+
render;
|
|
1924
|
+
env;
|
|
1925
|
+
constructor(root, context, owner, template, self, parentElement, dynamicScope, builder) {
|
|
1926
|
+
this.root = root;
|
|
1927
|
+
(!(template !== undefined) && assert(`You cannot render \`${valueForRef(self)}\` without a template.`, template !== undefined));
|
|
1928
|
+
this.id = root instanceof OutletView ? guidFor(root) : getViewId(root);
|
|
1929
|
+
this.result = undefined;
|
|
1930
|
+
this.destroyed = false;
|
|
1931
|
+
this.env = context.env;
|
|
1932
|
+
this.render = errorLoopTransaction(() => {
|
|
1933
|
+
let layout = unwrapTemplate(template).asLayout();
|
|
1934
|
+
let iterator = renderMain(context, owner, self, builder(context.env, {
|
|
1935
|
+
element: parentElement,
|
|
1936
|
+
nextSibling: null
|
|
1937
|
+
}), layout, dynamicScope);
|
|
1938
|
+
let result = this.result = iterator.sync();
|
|
1939
|
+
associateDestroyableChild(this, result);
|
|
1940
|
+
this.render = errorLoopTransaction(() => {
|
|
1941
|
+
if (isDestroying(result) || isDestroyed(result)) return;
|
|
1942
|
+
return result.rerender({
|
|
1943
|
+
alwaysRevalidate: false
|
|
1944
|
+
});
|
|
1945
|
+
});
|
|
1946
|
+
});
|
|
1947
|
+
}
|
|
1948
|
+
isFor(possibleRoot) {
|
|
1949
|
+
return this.root === possibleRoot;
|
|
1950
|
+
}
|
|
1951
|
+
destroy() {
|
|
1952
|
+
let {
|
|
1953
|
+
result,
|
|
1954
|
+
env
|
|
1955
|
+
} = this;
|
|
1956
|
+
this.destroyed = true;
|
|
1957
|
+
this.root = null;
|
|
1958
|
+
this.result = undefined;
|
|
1959
|
+
this.render = undefined;
|
|
1960
|
+
if (result !== undefined) {
|
|
1961
|
+
/*
|
|
1962
|
+
Handles these scenarios:
|
|
1963
|
+
* When roots are removed during standard rendering process, a transaction exists already
|
|
1964
|
+
`.begin()` / `.commit()` are not needed.
|
|
1965
|
+
* When roots are being destroyed manually (`component.append(); component.destroy() case), no
|
|
1966
|
+
transaction exists already.
|
|
1967
|
+
* When roots are being destroyed during `Renderer#destroy`, no transaction exists
|
|
1968
|
+
*/
|
|
1969
|
+
|
|
1970
|
+
inTransaction(env, () => destroy(result));
|
|
1971
|
+
}
|
|
1972
|
+
}
|
|
1973
|
+
}
|
|
1974
|
+
const renderers = [];
|
|
1975
|
+
function _resetRenderers() {
|
|
1976
|
+
renderers.length = 0;
|
|
1977
|
+
}
|
|
1978
|
+
function register(renderer) {
|
|
1979
|
+
(!(renderers.indexOf(renderer) === -1) && assert('Cannot register the same renderer twice', renderers.indexOf(renderer) === -1));
|
|
1980
|
+
renderers.push(renderer);
|
|
1981
|
+
}
|
|
1982
|
+
function deregister(renderer) {
|
|
1983
|
+
let index = renderers.indexOf(renderer);
|
|
1984
|
+
(!(index !== -1) && assert('Cannot deregister unknown unregistered renderer', index !== -1));
|
|
1985
|
+
renderers.splice(index, 1);
|
|
1986
|
+
}
|
|
1987
|
+
function loopBegin() {
|
|
1988
|
+
for (let renderer of renderers) {
|
|
1989
|
+
renderer.rerender();
|
|
1990
|
+
}
|
|
1991
|
+
}
|
|
1992
|
+
let renderSettledDeferred = null;
|
|
1993
|
+
/*
|
|
1994
|
+
Returns a promise which will resolve when rendering has settled. Settled in
|
|
1995
|
+
this context is defined as when all of the tags in use are "current" (e.g.
|
|
1996
|
+
`renderers.every(r => r._isValid())`). When this is checked at the _end_ of
|
|
1997
|
+
the run loop, this essentially guarantees that all rendering is completed.
|
|
1998
|
+
|
|
1999
|
+
@method renderSettled
|
|
2000
|
+
@returns {Promise<void>} a promise which fulfills when rendering has settled
|
|
2001
|
+
*/
|
|
2002
|
+
function renderSettled() {
|
|
2003
|
+
if (renderSettledDeferred === null) {
|
|
2004
|
+
renderSettledDeferred = RSVP.defer();
|
|
2005
|
+
// if there is no current runloop, the promise created above will not have
|
|
2006
|
+
// a chance to resolve (because its resolved in backburner's "end" event)
|
|
2007
|
+
if (!_getCurrentRunLoop()) {
|
|
2008
|
+
// ensure a runloop has been kicked off
|
|
2009
|
+
_backburner.schedule('actions', null, NO_OP);
|
|
2010
|
+
}
|
|
2011
|
+
}
|
|
2012
|
+
return renderSettledDeferred.promise;
|
|
2013
|
+
}
|
|
2014
|
+
function resolveRenderPromise() {
|
|
2015
|
+
if (renderSettledDeferred !== null) {
|
|
2016
|
+
let resolve = renderSettledDeferred.resolve;
|
|
2017
|
+
renderSettledDeferred = null;
|
|
2018
|
+
_backburner.join(null, resolve);
|
|
2019
|
+
}
|
|
2020
|
+
}
|
|
2021
|
+
let loops = 0;
|
|
2022
|
+
function loopEnd() {
|
|
2023
|
+
for (let renderer of renderers) {
|
|
2024
|
+
if (!renderer.isValid()) {
|
|
2025
|
+
if (loops > ENV._RERENDER_LOOP_LIMIT) {
|
|
2026
|
+
loops = 0;
|
|
2027
|
+
// TODO: do something better
|
|
2028
|
+
renderer.destroy();
|
|
2029
|
+
throw new Error('infinite rendering invalidation detected');
|
|
2030
|
+
}
|
|
2031
|
+
loops++;
|
|
2032
|
+
return _backburner.join(null, NO_OP);
|
|
2033
|
+
}
|
|
2034
|
+
}
|
|
2035
|
+
loops = 0;
|
|
2036
|
+
resolveRenderPromise();
|
|
2037
|
+
}
|
|
2038
|
+
_backburner.on('begin', loopBegin);
|
|
2039
|
+
_backburner.on('end', loopEnd);
|
|
2040
|
+
class RendererState {
|
|
2041
|
+
static create(data, renderer) {
|
|
2042
|
+
const state = new RendererState(data, renderer);
|
|
2043
|
+
associateDestroyableChild(renderer, state);
|
|
2044
|
+
return state;
|
|
2045
|
+
}
|
|
2046
|
+
#data;
|
|
2047
|
+
#lastRevision = -1;
|
|
2048
|
+
#inRenderTransaction = false;
|
|
2049
|
+
#destroyed = false;
|
|
2050
|
+
#roots = [];
|
|
2051
|
+
#removedRoots = [];
|
|
2052
|
+
constructor(data, renderer) {
|
|
2053
|
+
this.#data = data;
|
|
2054
|
+
registerDestructor(this, () => {
|
|
2055
|
+
this.clearAllRoots(renderer);
|
|
2056
|
+
});
|
|
2057
|
+
}
|
|
2058
|
+
get debug() {
|
|
2059
|
+
return {
|
|
2060
|
+
roots: this.#roots,
|
|
2061
|
+
inRenderTransaction: this.#inRenderTransaction,
|
|
2062
|
+
isInteractive: this.isInteractive
|
|
2063
|
+
};
|
|
2064
|
+
}
|
|
2065
|
+
get roots() {
|
|
2066
|
+
return this.#roots;
|
|
2067
|
+
}
|
|
2068
|
+
get owner() {
|
|
2069
|
+
return this.#data.owner;
|
|
2070
|
+
}
|
|
2071
|
+
get builder() {
|
|
2072
|
+
return this.#data.builder;
|
|
2073
|
+
}
|
|
2074
|
+
get context() {
|
|
2075
|
+
return this.#data.context;
|
|
2076
|
+
}
|
|
2077
|
+
get env() {
|
|
2078
|
+
return this.context.env;
|
|
2079
|
+
}
|
|
2080
|
+
get isInteractive() {
|
|
2081
|
+
return this.#data.context.env.isInteractive;
|
|
2082
|
+
}
|
|
2083
|
+
renderRoot(root, renderer) {
|
|
2084
|
+
let roots = this.#roots;
|
|
2085
|
+
roots.push(root);
|
|
2086
|
+
associateDestroyableChild(this, root);
|
|
2087
|
+
if (roots.length === 1) {
|
|
2088
|
+
register(renderer);
|
|
2089
|
+
}
|
|
2090
|
+
this.#renderRootsTransaction(renderer);
|
|
2091
|
+
return root;
|
|
2092
|
+
}
|
|
2093
|
+
#renderRootsTransaction(renderer) {
|
|
2094
|
+
if (this.#inRenderTransaction) {
|
|
2095
|
+
// currently rendering roots, a new root was added and will
|
|
2096
|
+
// be processed by the existing _renderRoots invocation
|
|
2097
|
+
return;
|
|
2098
|
+
}
|
|
2099
|
+
|
|
2100
|
+
// used to prevent calling _renderRoots again (see above)
|
|
2101
|
+
// while we are actively rendering roots
|
|
2102
|
+
this.#inRenderTransaction = true;
|
|
2103
|
+
let completedWithoutError = false;
|
|
2104
|
+
try {
|
|
2105
|
+
this.renderRoots(renderer);
|
|
2106
|
+
completedWithoutError = true;
|
|
2107
|
+
} finally {
|
|
2108
|
+
if (!completedWithoutError) {
|
|
2109
|
+
this.#lastRevision = valueForTag(CURRENT_TAG);
|
|
2110
|
+
}
|
|
2111
|
+
this.#inRenderTransaction = false;
|
|
2112
|
+
}
|
|
2113
|
+
}
|
|
2114
|
+
renderRoots(renderer) {
|
|
2115
|
+
let roots = this.#roots;
|
|
2116
|
+
let removedRoots = this.#removedRoots;
|
|
2117
|
+
let initialRootsLength;
|
|
2118
|
+
do {
|
|
2119
|
+
initialRootsLength = roots.length;
|
|
2120
|
+
inTransaction(this.context.env, () => {
|
|
2121
|
+
// ensure that for the first iteration of the loop
|
|
2122
|
+
// each root is processed
|
|
2123
|
+
for (let i = 0; i < roots.length; i++) {
|
|
2124
|
+
let root = roots[i];
|
|
2125
|
+
(true && !(root) && assert('has root', root));
|
|
2126
|
+
if (root.destroyed) {
|
|
2127
|
+
// add to the list of roots to be removed
|
|
2128
|
+
// they will be removed from `this._roots` later
|
|
2129
|
+
removedRoots.push(root);
|
|
2130
|
+
|
|
2131
|
+
// skip over roots that have been marked as destroyed
|
|
2132
|
+
continue;
|
|
2133
|
+
}
|
|
2134
|
+
|
|
2135
|
+
// when processing non-initial reflush loops,
|
|
2136
|
+
// do not process more roots than needed
|
|
2137
|
+
if (i >= initialRootsLength) {
|
|
2138
|
+
continue;
|
|
2139
|
+
}
|
|
2140
|
+
root.render();
|
|
2141
|
+
}
|
|
2142
|
+
this.#lastRevision = valueForTag(CURRENT_TAG);
|
|
2143
|
+
});
|
|
2144
|
+
} while (roots.length > initialRootsLength);
|
|
2145
|
+
|
|
2146
|
+
// remove any roots that were destroyed during this transaction
|
|
2147
|
+
while (removedRoots.length) {
|
|
2148
|
+
let root = removedRoots.pop();
|
|
2149
|
+
let rootIndex = roots.indexOf(root);
|
|
2150
|
+
roots.splice(rootIndex, 1);
|
|
2151
|
+
}
|
|
2152
|
+
if (this.#roots.length === 0) {
|
|
2153
|
+
deregister(renderer);
|
|
2154
|
+
}
|
|
2155
|
+
}
|
|
2156
|
+
scheduleRevalidate(renderer) {
|
|
2157
|
+
_backburner.scheduleOnce('render', this, this.revalidate, renderer);
|
|
2158
|
+
}
|
|
2159
|
+
isValid() {
|
|
2160
|
+
return this.#destroyed || this.#roots.length === 0 || validateTag(CURRENT_TAG, this.#lastRevision);
|
|
2161
|
+
}
|
|
2162
|
+
revalidate(renderer) {
|
|
2163
|
+
if (this.isValid()) {
|
|
2164
|
+
return;
|
|
2165
|
+
}
|
|
2166
|
+
this.#renderRootsTransaction(renderer);
|
|
2167
|
+
}
|
|
2168
|
+
clearAllRoots(renderer) {
|
|
2169
|
+
let roots = this.#roots;
|
|
2170
|
+
for (let root of roots) {
|
|
2171
|
+
destroy(root);
|
|
2172
|
+
}
|
|
2173
|
+
this.#removedRoots.length = 0;
|
|
2174
|
+
this.#roots = [];
|
|
2175
|
+
|
|
2176
|
+
// if roots were present before destroying
|
|
2177
|
+
// deregister this renderer instance
|
|
2178
|
+
if (roots.length) {
|
|
2179
|
+
deregister(renderer);
|
|
2180
|
+
}
|
|
2181
|
+
}
|
|
2182
|
+
}
|
|
2183
|
+
|
|
2184
|
+
/**
|
|
2185
|
+
* The returned object from `renderComponent`
|
|
2186
|
+
* @public
|
|
2187
|
+
* @module @ember/renderer
|
|
2188
|
+
*/
|
|
2189
|
+
|
|
2190
|
+
function intoTarget(into) {
|
|
2191
|
+
if ('element' in into) {
|
|
2192
|
+
return into;
|
|
2193
|
+
} else {
|
|
2194
|
+
return {
|
|
2195
|
+
element: into,
|
|
2196
|
+
nextSibling: null
|
|
2197
|
+
};
|
|
2198
|
+
}
|
|
2199
|
+
}
|
|
2200
|
+
|
|
2201
|
+
/**
|
|
2202
|
+
* Render a component into a DOM element.
|
|
2203
|
+
*
|
|
2204
|
+
* @method renderComponent
|
|
2205
|
+
* @static
|
|
2206
|
+
* @for @ember/renderer
|
|
2207
|
+
* @param {Object} component The component to render.
|
|
2208
|
+
* @param {Object} options
|
|
2209
|
+
* @param {Element} options.into Where to render the component in to.
|
|
2210
|
+
* @param {Object} [options.owner] Optionally specify the owner to use. This will be used for injections, and overall cleanup.
|
|
2211
|
+
* @param {Object} [options.env] Optional renderer configuration
|
|
2212
|
+
* @param {Object} [options.args] Optionally pass args in to the component. These may be reactive as long as it is an object or object-like
|
|
2213
|
+
* @public
|
|
2214
|
+
*/
|
|
2215
|
+
function renderComponent(
|
|
2216
|
+
/**
|
|
2217
|
+
* The component definition to render.
|
|
2218
|
+
*
|
|
2219
|
+
* Any component that has had its manager registered is valid.
|
|
2220
|
+
* For the component-types that ship with ember, manager registration
|
|
2221
|
+
* does not need to be worried about.
|
|
2222
|
+
*/
|
|
2223
|
+
component, {
|
|
2224
|
+
owner = {},
|
|
2225
|
+
env,
|
|
2226
|
+
into,
|
|
2227
|
+
args
|
|
2228
|
+
}) {
|
|
2229
|
+
/**
|
|
2230
|
+
* SAFETY: we should figure out what we need out of a `document` and narrow the API.
|
|
2231
|
+
* this exercise should also end up beginning to define what we need for CLI rendering (or to other outputs)
|
|
2232
|
+
*/
|
|
2233
|
+
let document = env && 'document' in env ? env?.['document'] : globalThis.document;
|
|
2234
|
+
|
|
2235
|
+
// Reuse renderer per owner to avoid creating multiple EvaluationContexts
|
|
2236
|
+
// which can cause tracking frame conflicts
|
|
2237
|
+
let renderer = RENDERER_CACHE.get(owner);
|
|
2238
|
+
if (!renderer) {
|
|
2239
|
+
renderer = BaseRenderer.strict(owner, document, {
|
|
2240
|
+
...env,
|
|
2241
|
+
isInteractive: env?.isInteractive ?? true,
|
|
2242
|
+
hasDOM: env && 'hasDOM' in env ? Boolean(env?.['hasDOM']) : true
|
|
2243
|
+
});
|
|
2244
|
+
RENDERER_CACHE.set(owner, renderer);
|
|
2245
|
+
}
|
|
2246
|
+
|
|
2247
|
+
/**
|
|
2248
|
+
* Replace all contents, if we've rendered multiple times.
|
|
2249
|
+
*
|
|
2250
|
+
* https://github.com/emberjs/rfcs/pull/1099/files#diff-2b962105b9083ca84579cdc957f27f49407440f3c5078083fa369ec18cc46da8R365
|
|
2251
|
+
*
|
|
2252
|
+
* We could later add an option to not do this behavior
|
|
2253
|
+
*
|
|
2254
|
+
* NOTE: destruction is async
|
|
2255
|
+
*/
|
|
2256
|
+
let existing = RENDER_CACHE.get(into);
|
|
2257
|
+
existing?.result.destroy();
|
|
2258
|
+
/**
|
|
2259
|
+
* We can only replace the inner HTML the first time.
|
|
2260
|
+
* Because destruction is async, it won't be safe to
|
|
2261
|
+
* do this again, and we'll have to rely on the above destroy.
|
|
2262
|
+
*/
|
|
2263
|
+
if (!existing && into instanceof Element) {
|
|
2264
|
+
into.innerHTML = '';
|
|
2265
|
+
}
|
|
2266
|
+
|
|
2267
|
+
/**
|
|
2268
|
+
* If there's an existing render result with valid bounds, use its
|
|
2269
|
+
* firstNode as the nextSibling so that new content is inserted at
|
|
2270
|
+
* the same DOM position. This ensures stable ordering when multiple
|
|
2271
|
+
* renderComponent calls target the same element and one is re-invoked
|
|
2272
|
+
* (e.g., due to tracked dependency changes).
|
|
2273
|
+
*
|
|
2274
|
+
* The old content's DOM nodes are still present (destruction is async),
|
|
2275
|
+
* so firstNode() is a valid position reference. The new content is placed
|
|
2276
|
+
* BEFORE the old content. When the old content is eventually destroyed
|
|
2277
|
+
* (async clear of bounds), the new content remains in the correct position.
|
|
2278
|
+
*/
|
|
2279
|
+
let renderTarget = into;
|
|
2280
|
+
if (existing?.glimmerResult) {
|
|
2281
|
+
let parentElement = into instanceof Element ? into : into.element;
|
|
2282
|
+
let firstNode = existing.glimmerResult.firstNode();
|
|
2283
|
+
renderTarget = {
|
|
2284
|
+
element: parentElement,
|
|
2285
|
+
nextSibling: firstNode
|
|
2286
|
+
};
|
|
2287
|
+
}
|
|
2288
|
+
let innerResult = renderer.render(component, {
|
|
2289
|
+
into: renderTarget,
|
|
2290
|
+
args
|
|
2291
|
+
}).result;
|
|
2292
|
+
if (innerResult) {
|
|
2293
|
+
associateDestroyableChild(owner, innerResult);
|
|
2294
|
+
}
|
|
2295
|
+
let result = {
|
|
2296
|
+
destroy() {
|
|
2297
|
+
if (innerResult) {
|
|
2298
|
+
destroy(innerResult);
|
|
2299
|
+
}
|
|
2300
|
+
}
|
|
2301
|
+
};
|
|
2302
|
+
RENDER_CACHE.set(into, {
|
|
2303
|
+
result,
|
|
2304
|
+
glimmerResult: innerResult
|
|
2305
|
+
});
|
|
2306
|
+
return result;
|
|
2307
|
+
}
|
|
2308
|
+
const RENDER_CACHE = new WeakMap();
|
|
2309
|
+
const RENDERER_CACHE = new WeakMap();
|
|
2310
|
+
class BaseRenderer {
|
|
2311
|
+
static strict(owner, document, options) {
|
|
2312
|
+
return new BaseRenderer(owner, {
|
|
2313
|
+
hasDOM: hasDOM,
|
|
2314
|
+
...options
|
|
2315
|
+
}, document, new ResolverImpl(), clientBuilder);
|
|
2316
|
+
}
|
|
2317
|
+
state;
|
|
2318
|
+
constructor(owner, envOptions, document, resolver, builder) {
|
|
2319
|
+
let sharedArtifacts = artifacts();
|
|
2320
|
+
|
|
2321
|
+
/**
|
|
2322
|
+
* SAFETY: are there consequences for being looser with *this* owner?
|
|
2323
|
+
* the public API for `owner` is kinda `Partial<InternalOwner>`
|
|
2324
|
+
* aka: implement only what you need.
|
|
2325
|
+
* But for actual ember apps, you *need* to implement everything
|
|
2326
|
+
* an app needs (which will actually change and become less over time)
|
|
2327
|
+
*/
|
|
2328
|
+
let env = new EmberEnvironmentDelegate(owner, envOptions.isInteractive);
|
|
2329
|
+
let options = runtimeOptions({
|
|
2330
|
+
document
|
|
2331
|
+
}, env, sharedArtifacts, resolver);
|
|
2332
|
+
let context = new EvaluationContextImpl(sharedArtifacts, heap => new RuntimeOpImpl(heap), options);
|
|
2333
|
+
this.state = RendererState.create({
|
|
2334
|
+
owner,
|
|
2335
|
+
context,
|
|
2336
|
+
builder
|
|
2337
|
+
}, this);
|
|
2338
|
+
}
|
|
2339
|
+
get debugRenderTree() {
|
|
2340
|
+
let {
|
|
2341
|
+
debugRenderTree
|
|
2342
|
+
} = this.state.env;
|
|
2343
|
+
(!(debugRenderTree) && assert('Attempted to access the DebugRenderTree, but it did not exist. Is the Ember Inspector open?', debugRenderTree));
|
|
2344
|
+
return debugRenderTree;
|
|
2345
|
+
}
|
|
2346
|
+
isValid() {
|
|
2347
|
+
return this.state.isValid();
|
|
2348
|
+
}
|
|
2349
|
+
destroy() {
|
|
2350
|
+
destroy(this);
|
|
2351
|
+
}
|
|
2352
|
+
render(component, options) {
|
|
2353
|
+
const root = new ComponentRootState(this.state, component, {
|
|
2354
|
+
args: options.args,
|
|
2355
|
+
into: intoTarget(options.into)
|
|
2356
|
+
});
|
|
2357
|
+
return this.state.renderRoot(root, this);
|
|
2358
|
+
}
|
|
2359
|
+
rerender() {
|
|
2360
|
+
this.state.scheduleRevalidate(this);
|
|
2361
|
+
}
|
|
2362
|
+
|
|
2363
|
+
// render(component: Component, options: { into: Cursor; args?: Record<string, unknown> }): void {
|
|
2364
|
+
// this.state.renderRoot(component);
|
|
2365
|
+
// }
|
|
2366
|
+
}
|
|
2367
|
+
class Renderer extends BaseRenderer {
|
|
2368
|
+
static strict(owner, document, options) {
|
|
2369
|
+
return new BaseRenderer(owner, {
|
|
2370
|
+
hasDOM: hasDOM,
|
|
2371
|
+
...options
|
|
2372
|
+
}, document, new ResolverImpl(), clientBuilder);
|
|
2373
|
+
}
|
|
2374
|
+
_rootTemplate;
|
|
2375
|
+
_viewRegistry;
|
|
2376
|
+
static create(props) {
|
|
2377
|
+
let {
|
|
2378
|
+
_viewRegistry
|
|
2379
|
+
} = props;
|
|
2380
|
+
let owner = getOwner(props);
|
|
2381
|
+
(!(owner) && assert('Renderer is unexpectedly missing an owner', owner));
|
|
2382
|
+
let document = owner.lookup('service:-document');
|
|
2383
|
+
let env = owner.lookup('-environment:main');
|
|
2384
|
+
let rootTemplate = owner.lookup(privatize`template:-root`);
|
|
2385
|
+
let builder = owner.lookup('service:-dom-builder');
|
|
2386
|
+
return new this(owner, document, env, rootTemplate, _viewRegistry, builder);
|
|
2387
|
+
}
|
|
2388
|
+
constructor(owner, document, env, rootTemplate, viewRegistry, builder = clientBuilder, resolver = new ResolverImpl()) {
|
|
2389
|
+
super(owner, env, document, resolver, builder);
|
|
2390
|
+
this._rootTemplate = rootTemplate(owner);
|
|
2391
|
+
this._viewRegistry = viewRegistry || owner.lookup('-view-registry:main');
|
|
2392
|
+
}
|
|
2393
|
+
|
|
2394
|
+
// renderer HOOKS
|
|
2395
|
+
|
|
2396
|
+
appendOutletView(view, target) {
|
|
2397
|
+
// TODO: This bypasses the {{outlet}} syntax so logically duplicates
|
|
2398
|
+
// some of the set up code. Since this is all internal (or is it?),
|
|
2399
|
+
// we can refactor this to do something more direct/less convoluted
|
|
2400
|
+
// and with less setup, but get it working first
|
|
2401
|
+
let outlet = createRootOutlet(view);
|
|
2402
|
+
let {
|
|
2403
|
+
name,
|
|
2404
|
+
/* controller, */template
|
|
2405
|
+
} = view.state;
|
|
2406
|
+
let named = dict();
|
|
2407
|
+
named['Component'] = createConstRef(makeRouteTemplate(view.owner, name, template), '@Component');
|
|
2408
|
+
|
|
2409
|
+
// TODO: is this guaranteed to be undefined? It seems to be the
|
|
2410
|
+
// case in the `OutletView` class. Investigate how much that class
|
|
2411
|
+
// exists as an internal implementation detail only, or if it was
|
|
2412
|
+
// used outside of core. As far as I can tell, test-helpers uses
|
|
2413
|
+
// it but only for `setOutletState`.
|
|
2414
|
+
// named['controller'] = createConstRef(controller, '@controller');
|
|
2415
|
+
// Update: at least according to the debug render tree tests, we
|
|
2416
|
+
// appear to always expect this to be undefined. Not a definitive
|
|
2417
|
+
// source by any means, but is useful evidence
|
|
2418
|
+
named['controller'] = UNDEFINED_REFERENCE;
|
|
2419
|
+
named['model'] = UNDEFINED_REFERENCE;
|
|
2420
|
+
let args = createCapturedArgs(named, EMPTY_POSITIONAL);
|
|
2421
|
+
this._appendDefinition(view, curry(0, outlet, view.owner, args, true), target);
|
|
2422
|
+
}
|
|
2423
|
+
appendTo(view, target) {
|
|
2424
|
+
let definition = new RootComponentDefinition(view);
|
|
2425
|
+
this._appendDefinition(view, curry(0, definition, this.state.owner, null, true), target);
|
|
2426
|
+
}
|
|
2427
|
+
_appendDefinition(root, definition, target) {
|
|
2428
|
+
let self = createConstRef(definition, 'this');
|
|
2429
|
+
let dynamicScope = new DynamicScope(null, UNDEFINED_REFERENCE);
|
|
2430
|
+
let rootState = new ClassicRootState(root, this.state.context, this.state.owner, this._rootTemplate, self, target, dynamicScope, this.state.builder);
|
|
2431
|
+
this.state.renderRoot(rootState, this);
|
|
2432
|
+
}
|
|
2433
|
+
cleanupRootFor(component) {
|
|
2434
|
+
// no need to cleanup roots if we have already been destroyed
|
|
2435
|
+
if (isDestroyed(this)) {
|
|
2436
|
+
return;
|
|
2437
|
+
}
|
|
2438
|
+
let roots = this.state.roots;
|
|
2439
|
+
|
|
2440
|
+
// traverse in reverse so we can remove items
|
|
2441
|
+
// without mucking up the index
|
|
2442
|
+
let i = roots.length;
|
|
2443
|
+
while (i--) {
|
|
2444
|
+
let root = roots[i];
|
|
2445
|
+
(!(root) && assert('has root', root));
|
|
2446
|
+
if (root.type === 'classic' && root.isFor(component)) {
|
|
2447
|
+
root.destroy();
|
|
2448
|
+
roots.splice(i, 1);
|
|
2449
|
+
}
|
|
2450
|
+
}
|
|
2451
|
+
}
|
|
2452
|
+
remove(view) {
|
|
2453
|
+
view._transitionTo('destroying');
|
|
2454
|
+
this.cleanupRootFor(view);
|
|
2455
|
+
if (this.state.isInteractive) {
|
|
2456
|
+
view.trigger('didDestroyElement');
|
|
2457
|
+
}
|
|
2458
|
+
}
|
|
2459
|
+
get _roots() {
|
|
2460
|
+
return this.state.debug.roots;
|
|
2461
|
+
}
|
|
2462
|
+
get _inRenderTransaction() {
|
|
2463
|
+
return this.state.debug.inRenderTransaction;
|
|
2464
|
+
}
|
|
2465
|
+
get _isInteractive() {
|
|
2466
|
+
return this.state.debug.isInteractive;
|
|
2467
|
+
}
|
|
2468
|
+
get _context() {
|
|
2469
|
+
return this.state.context;
|
|
2470
|
+
}
|
|
2471
|
+
register(view) {
|
|
2472
|
+
let id = getViewId(view);
|
|
2473
|
+
(!(!this._viewRegistry[id]) && assert('Attempted to register a view with an id already in use: ' + id, !this._viewRegistry[id]));
|
|
2474
|
+
this._viewRegistry[id] = view;
|
|
2475
|
+
}
|
|
2476
|
+
unregister(view) {
|
|
2477
|
+
delete this._viewRegistry[getViewId(view)];
|
|
2478
|
+
}
|
|
2479
|
+
getElement(component) {
|
|
2480
|
+
if (this._isInteractive) {
|
|
2481
|
+
return getViewElement(component);
|
|
2482
|
+
} else {
|
|
2483
|
+
throw new Error('Accessing `this.element` is not allowed in non-interactive environments (such as FastBoot).');
|
|
2484
|
+
}
|
|
2485
|
+
}
|
|
2486
|
+
getBounds(component) {
|
|
2487
|
+
let bounds = component[BOUNDS];
|
|
2488
|
+
(!(bounds) && assert('object passed to getBounds must have the BOUNDS symbol as a property', bounds));
|
|
2489
|
+
let parentElement = bounds.parentElement();
|
|
2490
|
+
let firstNode = bounds.firstNode();
|
|
2491
|
+
let lastNode = bounds.lastNode();
|
|
2492
|
+
return {
|
|
2493
|
+
parentElement,
|
|
2494
|
+
firstNode,
|
|
2495
|
+
lastNode
|
|
2496
|
+
};
|
|
2497
|
+
}
|
|
2498
|
+
}
|
|
2499
|
+
|
|
2500
|
+
export { OutletView as O, Renderer as R, _resetRenderers as _, renderComponent as a, outletHelper as o, renderSettled as r };
|