ember-source 7.2.0-alpha.4 → 7.3.0-alpha.1
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/blueprints/-addon-import.js +4 -6
- package/blueprints/-utils.js +6 -9
- package/build-metadata.json +3 -3
- package/dist/dev/packages/@ember/-internals/browser-environment/index.js +1 -1
- package/dist/dev/packages/@ember/-internals/deprecations/index.js +10 -0
- package/dist/dev/packages/@ember/-internals/glimmer/index.js +11 -11
- package/dist/dev/packages/@ember/-internals/metal/index.js +18 -18
- package/dist/dev/packages/@ember/-internals/routing/index.js +3 -3
- package/dist/dev/packages/@ember/-internals/runtime/index.js +1 -1
- package/dist/dev/packages/@ember/-internals/runtime/lib/ext/rsvp.js +1 -1
- package/dist/dev/packages/@ember/-internals/runtime/lib/mixins/-proxy.js +8 -8
- package/dist/dev/packages/@ember/-internals/runtime/lib/mixins/action_handler.js +1 -1
- package/dist/dev/packages/@ember/-internals/runtime/lib/mixins/comparable.js +5 -0
- package/dist/dev/packages/@ember/-internals/runtime/lib/mixins/target_action_support.js +3 -3
- package/dist/dev/packages/@ember/-internals/utils/index.js +2 -2
- package/dist/dev/packages/@ember/-internals/views/lib/mixins/action_support.js +1 -1
- package/dist/dev/packages/@ember/-internals/views/lib/system/event_dispatcher.js +2 -2
- 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 -1
- package/dist/dev/packages/@ember/application/index.js +6 -7
- package/dist/dev/packages/@ember/application/instance.js +24 -4
- package/dist/dev/packages/@ember/application/namespace.js +3 -3
- package/dist/dev/packages/@ember/array/index.js +10 -64
- package/dist/dev/packages/@ember/array/lib/is-array.js +71 -0
- package/dist/dev/packages/@ember/array/proxy.js +8 -8
- package/dist/dev/packages/@ember/component/helper.js +321 -1
- package/dist/dev/packages/@ember/component/index.js +21 -15
- package/dist/dev/packages/@ember/component/template-only.js +1 -1
- package/dist/dev/packages/@ember/controller/index.js +3 -3
- package/dist/dev/packages/@ember/debug/data-adapter.js +3 -3
- package/dist/dev/packages/@ember/debug/index.js +1 -1
- package/dist/dev/packages/@ember/engine/index.js +5 -5
- package/dist/dev/packages/@ember/engine/instance.js +2 -2
- package/dist/dev/packages/@ember/helper/index.js +8 -27
- package/dist/dev/packages/@ember/modifier/index.js +2 -2
- package/dist/dev/packages/@ember/modifier/on.js +1 -1
- package/dist/dev/packages/@ember/object/-internals.js +2 -2
- package/dist/dev/packages/@ember/object/compat.js +3 -3
- package/dist/dev/packages/@ember/object/computed.js +2 -2
- package/dist/dev/packages/@ember/object/core.js +7 -7
- package/dist/dev/packages/@ember/object/evented.js +2 -2
- package/dist/dev/packages/@ember/object/events.js +1 -1
- package/dist/dev/packages/@ember/object/index.js +30 -25
- package/dist/dev/packages/@ember/object/internals.js +1 -1
- package/dist/dev/packages/@ember/object/lib/computed/computed_macros.js +5 -5
- package/dist/dev/packages/@ember/object/lib/computed/reduce_computed_macros.js +3 -3
- package/dist/dev/packages/@ember/object/mixin.js +6 -6
- package/dist/dev/packages/@ember/object/observable.js +7 -7
- package/dist/dev/packages/@ember/object/observers.js +1 -1
- package/dist/dev/packages/@ember/object/promise-proxy-mixin.js +3 -3
- package/dist/dev/packages/@ember/reactive/collections.js +153 -153
- package/dist/dev/packages/@ember/renderer/index.js +1 -1
- package/dist/dev/packages/@ember/routing/-internals.js +3 -3
- package/dist/dev/packages/@ember/routing/index.js +12 -8
- package/dist/dev/packages/@ember/routing/lib/generate_controller.js +2 -3
- package/dist/dev/packages/@ember/routing/lib/routing-service.js +5 -6
- package/dist/dev/packages/@ember/routing/lib/utils.js +3 -3
- package/dist/dev/packages/@ember/routing/route.js +12 -12
- package/dist/dev/packages/@ember/routing/router-service.js +25 -19
- package/dist/dev/packages/@ember/routing/router.js +5 -5
- package/dist/dev/packages/@ember/runloop/index.js +1 -1
- package/dist/dev/packages/@ember/service/index.js +1 -1
- package/dist/dev/packages/@ember/template-compiler/lib/compile-options.js +3 -3
- package/dist/dev/packages/@ember/template-compiler/lib/template.js +2 -2
- package/dist/dev/packages/@ember/template-factory/index.js +1 -1
- package/dist/dev/packages/@ember/utils/lib/compare.js +5 -2
- package/dist/dev/packages/@ember/utils/lib/is_empty.js +1 -1
- package/dist/dev/packages/@glimmer/encoder/index.js +1 -1
- package/dist/dev/packages/@glimmer/manager/index.js +4 -4
- package/dist/dev/packages/@glimmer/node/index.js +3 -3
- package/dist/dev/packages/@glimmer/opcode-compiler/index.js +2 -2
- package/dist/dev/packages/@glimmer/program/index.js +10 -10
- package/dist/dev/packages/@glimmer/reference/index.js +5 -5
- package/dist/dev/packages/@glimmer/runtime/index.js +13 -13
- package/dist/dev/packages/@glimmer/tracking/index.js +2 -2
- package/dist/dev/packages/@glimmer/tracking/primitives/cache/index.js +1 -1
- package/dist/dev/packages/@glimmer/util/index.js +4 -4
- package/dist/dev/packages/@glimmer/validator/index.js +3 -3
- package/dist/dev/packages/@glimmer/vm/index.js +2 -2
- package/dist/dev/packages/ember/version.js +1 -1
- package/dist/dev/packages/ember-template-compiler/index.js +4 -4
- package/dist/dev/packages/router_js/index.js +3 -3
- package/dist/dev/packages/rsvp/index.js +2281 -1
- package/dist/dev/packages/shared-chunks/{alias-RGbDZoAB.js → alias-DpqL1qx6.js} +7 -7
- package/dist/dev/packages/shared-chunks/{api-BT9M3UaD.js → api-BlZDPg1n.js} +6 -6
- package/dist/dev/packages/shared-chunks/{element-builder-Cl1kHFJE.js → api-C0PAtEgQ.js} +139 -120
- package/dist/dev/packages/shared-chunks/{api-DG5kRT-o.js → api-DuLOZMO_.js} +3 -3
- package/dist/dev/packages/shared-chunks/{args-proxy-CB0SM6jC.js → args-proxy-CS5Brs3_.js} +2 -2
- package/dist/dev/packages/shared-chunks/{untouchable-this-BHdAERUu.js → arguments-CDkbOqTS.js} +236 -236
- package/dist/dev/packages/shared-chunks/{array-BMaSKezP.js → array-CVEnNWng.js} +3 -3
- package/dist/dev/packages/shared-chunks/{array-utils-BEaSKdEb.js → array-utils-CZQxrdD3.js} +1 -1
- package/dist/dev/packages/shared-chunks/{cache-CeWOBNQg.js → cache-DGDPVCpC.js} +2 -3
- package/dist/dev/packages/shared-chunks/{capabilities-CZkuOqqC.js → capabilities-CajW4QjE.js} +1 -1
- package/dist/dev/packages/shared-chunks/{chain-tags-DfmU63mS.js → chain-tags-uWSImHzB.js} +4 -4
- package/dist/dev/packages/shared-chunks/{collections-DEt-i-8B.js → collections-DPkjqeA3.js} +2 -2
- package/dist/dev/packages/shared-chunks/{compiler-DhH2WLpA.js → compiler-QUSl_urU.js} +3 -3
- package/dist/dev/packages/shared-chunks/{computed-Daavz6vC.js → computed-BPCtuOxQ.js} +6 -6
- package/dist/dev/packages/shared-chunks/{curly-YoYS2vXw.js → curly-DGUCLOud.js} +10 -11
- package/dist/dev/packages/shared-chunks/curly-brand-B_F79Dep.js +12 -0
- package/dist/dev/packages/shared-chunks/{curried-Cnjy9_ug.js → curried-BZnYakIg.js} +1 -1
- package/dist/dev/packages/shared-chunks/{decorator-DYQwMItS.js → decorator-B5Uh5NFI.js} +1 -1
- package/dist/dev/packages/shared-chunks/{element-bBwMD8cw.js → element-BYLB-q7a.js} +5 -3
- package/dist/dev/packages/shared-chunks/{events-B1lx9T1I.js → events-6aFVjD4k.js} +1 -1
- package/dist/{prod/packages/shared-chunks/flags-B9qxc-pB.js → dev/packages/shared-chunks/flags-BZxHQ0yn.js} +1 -1
- package/dist/dev/packages/shared-chunks/{get-CO3EIWsm.js → get-6I3sjd-I.js} +33 -36
- package/dist/{prod/packages/shared-chunks/get_properties-wj_Qmotj.js → dev/packages/shared-chunks/get_properties-Cm2sWt5f.js} +1 -1
- package/dist/dev/packages/shared-chunks/{guid-PO2v9BaN.js → guid-Cbq2sNV_.js} +1 -1
- package/dist/dev/packages/shared-chunks/{hash-2-93qikL.js → hash-6NDs_5_f.js} +18 -12
- package/dist/dev/packages/shared-chunks/helper-brand-C9_8vvOf.js +12 -0
- package/dist/dev/packages/shared-chunks/{index-DX90CU4L.js → index-BGP1rw3B.js} +1 -1
- package/dist/dev/packages/shared-chunks/{index-dyv6rcBf.js → index-CCyXUNBa.js} +655 -1633
- package/dist/dev/packages/shared-chunks/{index-DkwVSPP5.js → index-DaFzpTIE.js} +10 -9
- package/dist/dev/packages/shared-chunks/{injected_property-B075jH6c.js → injected_property-CbBLr5jt.js} +2 -2
- package/dist/dev/packages/shared-chunks/{internal-Bpr6ihB_.js → internal-DTOXyEGM.js} +4 -4
- package/dist/dev/packages/shared-chunks/{internal-helper-IC87S6iZ.js → internal-helper-CKrni0b_.js} +1 -1
- package/dist/dev/packages/shared-chunks/{invoke-Ds0KEfP_.js → invoke-d9sqa50M.js} +3 -3
- package/dist/dev/packages/shared-chunks/{libraries-P8Ins5CB.js → libraries-DwffpMGE.js} +1 -1
- package/dist/dev/packages/shared-chunks/{meta-Cjo3zQJq.js → meta-BqC7f9Ia.js} +1 -1
- package/dist/{prod/packages/shared-chunks/namespace_search-TFdmjK_a.js → dev/packages/shared-chunks/namespace_search-BfvzEQzN.js} +1 -1
- package/dist/dev/packages/shared-chunks/{normalize-CxG_iVLJ.js → normalize-CKySQVU7.js} +2 -2
- package/dist/dev/packages/shared-chunks/{or-Bg6rCMF8.js → not-DYh6AY9Z.js} +36 -36
- package/dist/dev/packages/shared-chunks/{observers-CejcZw5s.js → observers-DMlX2nCi.js} +5 -5
- package/dist/dev/packages/shared-chunks/{on-Ch_lyozr.js → on-DlF0Wy7P.js} +10 -10
- package/dist/dev/packages/shared-chunks/outlet-CHFL7tun.js +135 -0
- package/dist/dev/packages/shared-chunks/{present-D0EfKzC6.js → present-B1rrjAVM.js} +1 -1
- package/dist/{prod/packages/shared-chunks/program-CF651Zuj.js → dev/packages/shared-chunks/program-DlgjqLa6.js} +3 -3
- package/dist/dev/packages/shared-chunks/{program-context-BaYVr5GA.js → program-context-Dq8xN2HI.js} +5 -4
- package/dist/dev/packages/shared-chunks/{property_get-BjbsrgpU.js → property_get-CRP7MFz_.js} +3 -3
- package/dist/dev/packages/shared-chunks/{property_set-LJskl202.js → property_set-qCUylPEK.js} +3 -3
- package/dist/dev/packages/shared-chunks/{reference-C-OXd_kp.js → reference-BqOLhKFy.js} +3 -3
- package/dist/dev/packages/shared-chunks/{registers-Buvdhhxx.js → registers-C_W2qYHJ.js} +1 -1
- package/dist/dev/packages/shared-chunks/{rehydrate-builder-IH4d_JQy.js → rehydrate-builder-C6k1XhET.js} +4 -4
- package/dist/dev/packages/shared-chunks/{render-Dz3OWqXy.js → render-87_sKZ_k.js} +94 -94
- package/dist/dev/packages/shared-chunks/{rsvp-C6j8G1D1.js → rsvp.es-DR7yS7qg.js} +150 -154
- package/dist/dev/packages/shared-chunks/{serialize-builder-DKliZPPG.js → serialize-builder-BlxBjwO-.js} +2 -2
- package/dist/dev/packages/shared-chunks/{set_properties-CNds2HCH.js → set_properties-C4TSebH6.js} +2 -2
- package/dist/dev/packages/shared-chunks/setup-registry-BHdDJATP.js +951 -0
- package/dist/{prod/packages/shared-chunks/simple-cast-BXTrayoV.js → dev/packages/shared-chunks/simple-cast-DCvJLSin.js} +1 -1
- package/dist/{prod/packages/shared-chunks/super-D4qkU4uq.js → dev/packages/shared-chunks/super-BBBjgF69.js} +1 -1
- package/dist/{prod/packages/shared-chunks/syscall-ops-nrBHMOTp.js → dev/packages/shared-chunks/syscall-ops-CN7STuUn.js} +1 -1
- package/dist/dev/packages/shared-chunks/{template-B0Apv9g2.js → template-BRrQR6KS.js} +1 -1
- package/dist/dev/packages/shared-chunks/{template-only-BxYzSEnC.js → template-only-Cu639ICT.js} +2 -4
- package/dist/dev/packages/shared-chunks/{textarea-DHjEFpZu.js → textarea-C4lYkaHj.js} +12 -8
- package/dist/dev/packages/shared-chunks/{tracked-B76E1nGz.js → tracked-DEyf0T_X.js} +5 -5
- package/dist/dev/packages/shared-chunks/{tracked-data-CH1USZZy.js → tracked-data-DgqqRdYO.js} +2 -2
- package/dist/dev/packages/shared-chunks/{unique-id-Hd96VZlE.js → unique-id-DQOhouG1.js} +2 -2
- package/dist/dev/packages/shared-chunks/{unrecognized-url-error-BQdkjTtZ.js → unrecognized-url-error-B8loxkay.js} +3 -3
- package/dist/{prod/packages/shared-chunks/vm-ops-5QCUIRx4.js → dev/packages/shared-chunks/vm-ops-ImHv0Wtg.js} +1 -1
- package/dist/prod/packages/@ember/-internals/deprecations/index.js +10 -0
- package/dist/prod/packages/@ember/-internals/glimmer/index.js +11 -11
- package/dist/prod/packages/@ember/-internals/metal/index.js +18 -18
- package/dist/prod/packages/@ember/-internals/routing/index.js +3 -3
- package/dist/prod/packages/@ember/-internals/runtime/index.js +1 -1
- package/dist/prod/packages/@ember/-internals/runtime/lib/ext/rsvp.js +1 -1
- package/dist/prod/packages/@ember/-internals/runtime/lib/mixins/-proxy.js +8 -8
- package/dist/prod/packages/@ember/-internals/runtime/lib/mixins/action_handler.js +1 -1
- package/dist/prod/packages/@ember/-internals/runtime/lib/mixins/comparable.js +5 -0
- package/dist/prod/packages/@ember/-internals/runtime/lib/mixins/target_action_support.js +3 -3
- package/dist/prod/packages/@ember/-internals/utils/index.js +2 -2
- package/dist/prod/packages/@ember/-internals/views/lib/mixins/action_support.js +1 -1
- package/dist/prod/packages/@ember/-internals/views/lib/system/event_dispatcher.js +2 -2
- package/dist/prod/packages/@ember/-internals/views/lib/system/utils.js +1 -1
- package/dist/prod/packages/@ember/-internals/views/lib/views/core_view.js +1 -1
- package/dist/prod/packages/@ember/application/index.js +5 -6
- package/dist/prod/packages/@ember/application/instance.js +19 -4
- package/dist/prod/packages/@ember/application/namespace.js +3 -3
- package/dist/prod/packages/@ember/array/index.js +11 -58
- package/dist/prod/packages/@ember/array/lib/is-array.js +64 -0
- package/dist/prod/packages/@ember/array/proxy.js +8 -8
- package/dist/prod/packages/@ember/component/helper.js +305 -1
- package/dist/prod/packages/@ember/component/index.js +20 -14
- package/dist/prod/packages/@ember/component/template-only.js +1 -1
- package/dist/prod/packages/@ember/controller/index.js +3 -3
- package/dist/prod/packages/@ember/debug/data-adapter.js +3 -3
- package/dist/prod/packages/@ember/engine/index.js +5 -5
- package/dist/prod/packages/@ember/engine/instance.js +2 -2
- package/dist/prod/packages/@ember/helper/index.js +8 -27
- package/dist/prod/packages/@ember/modifier/index.js +2 -2
- package/dist/prod/packages/@ember/modifier/on.js +1 -1
- package/dist/prod/packages/@ember/object/-internals.js +2 -2
- package/dist/prod/packages/@ember/object/compat.js +3 -3
- package/dist/prod/packages/@ember/object/computed.js +2 -2
- package/dist/prod/packages/@ember/object/core.js +7 -7
- package/dist/prod/packages/@ember/object/evented.js +2 -2
- package/dist/prod/packages/@ember/object/events.js +1 -1
- package/dist/prod/packages/@ember/object/index.js +30 -25
- package/dist/prod/packages/@ember/object/internals.js +2 -2
- package/dist/prod/packages/@ember/object/lib/computed/computed_macros.js +4 -4
- package/dist/prod/packages/@ember/object/lib/computed/reduce_computed_macros.js +2 -2
- package/dist/prod/packages/@ember/object/mixin.js +6 -6
- package/dist/prod/packages/@ember/object/observable.js +7 -7
- package/dist/prod/packages/@ember/object/observers.js +1 -1
- package/dist/prod/packages/@ember/object/promise-proxy-mixin.js +3 -3
- package/dist/prod/packages/@ember/reactive/collections.js +153 -153
- package/dist/prod/packages/@ember/renderer/index.js +1 -1
- package/dist/prod/packages/@ember/routing/index.js +12 -8
- package/dist/prod/packages/@ember/routing/lib/generate_controller.js +1 -2
- package/dist/prod/packages/@ember/routing/lib/routing-service.js +4 -5
- package/dist/prod/packages/@ember/routing/lib/utils.js +3 -3
- package/dist/prod/packages/@ember/routing/route.js +12 -12
- package/dist/prod/packages/@ember/routing/router-service.js +24 -18
- package/dist/prod/packages/@ember/routing/router.js +5 -5
- package/dist/prod/packages/@ember/runloop/index.js +1 -1
- package/dist/prod/packages/@ember/service/index.js +1 -1
- package/dist/prod/packages/@ember/template-compiler/lib/compile-options.js +3 -3
- package/dist/prod/packages/@ember/template-compiler/lib/template.js +2 -2
- package/dist/prod/packages/@ember/template-factory/index.js +1 -1
- package/dist/prod/packages/@ember/utils/lib/compare.js +5 -2
- package/dist/prod/packages/@ember/utils/lib/is_empty.js +1 -1
- package/dist/prod/packages/@glimmer/encoder/index.js +1 -1
- package/dist/prod/packages/@glimmer/manager/index.js +4 -4
- package/dist/prod/packages/@glimmer/node/index.js +3 -3
- package/dist/prod/packages/@glimmer/opcode-compiler/index.js +2 -2
- package/dist/prod/packages/@glimmer/program/index.js +10 -10
- package/dist/prod/packages/@glimmer/reference/index.js +5 -5
- package/dist/prod/packages/@glimmer/runtime/index.js +13 -13
- package/dist/prod/packages/@glimmer/tracking/index.js +2 -2
- package/dist/prod/packages/@glimmer/tracking/primitives/cache/index.js +1 -1
- package/dist/prod/packages/@glimmer/util/index.js +4 -4
- package/dist/prod/packages/@glimmer/validator/index.js +3 -3
- package/dist/prod/packages/@glimmer/vm/index.js +2 -2
- package/dist/prod/packages/ember/version.js +1 -1
- package/dist/prod/packages/ember-template-compiler/index.js +4 -4
- package/dist/prod/packages/router_js/index.js +3 -3
- package/dist/prod/packages/rsvp/index.js +2281 -1
- package/dist/prod/packages/shared-chunks/{alias-DsIh-16z.js → alias-Bod6qdNp.js} +7 -7
- package/dist/prod/packages/shared-chunks/{api-CGZbGcvX.js → api-B_poQGXS.js} +6 -6
- package/dist/prod/packages/shared-chunks/{element-builder-CZePCkbA.js → api-CQexacBn.js} +139 -120
- package/dist/prod/packages/shared-chunks/{api-DOLN_cR2.js → api-DlJKfm_f.js} +3 -3
- package/dist/prod/packages/shared-chunks/{args-proxy-CaXVcI8G.js → args-proxy-CCoFtYLS.js} +2 -2
- package/dist/prod/packages/shared-chunks/{debug-render-tree-CYENUjgX.js → arguments-BzAkZVBa.js} +198 -198
- package/dist/prod/packages/shared-chunks/{array-DYFI95FA.js → array-BzReKMeW.js} +3 -3
- package/dist/prod/packages/shared-chunks/{array-utils-BEaSKdEb.js → array-utils-CZQxrdD3.js} +1 -1
- package/dist/prod/packages/shared-chunks/{cache-CG6_L9db.js → cache-CofLhaS4.js} +1 -2
- package/dist/prod/packages/shared-chunks/{capabilities-_5e35539.js → capabilities-BuVYh-vx.js} +1 -1
- package/dist/prod/packages/shared-chunks/{chain-tags-BP0V2LnZ.js → chain-tags-B2J7DsxO.js} +4 -4
- package/dist/prod/packages/shared-chunks/{collections-By4M3cTy.js → collections-GpG8lT2g.js} +10 -10
- package/dist/prod/packages/shared-chunks/{compiler-DQmEjFyx.js → compiler-lBSssiWp.js} +2 -2
- package/dist/prod/packages/shared-chunks/{computed-D6MVTTDd.js → computed-DtIStxvq.js} +6 -6
- package/dist/prod/packages/shared-chunks/{curly-DCYSwLtz.js → curly-a6DP7r87.js} +10 -11
- package/dist/prod/packages/shared-chunks/curly-brand-B_F79Dep.js +12 -0
- package/dist/prod/packages/shared-chunks/{curried-Cnjy9_ug.js → curried-BZnYakIg.js} +1 -1
- package/dist/prod/packages/shared-chunks/{decorator-B8Lpq40g.js → decorator-9ikVwsjY.js} +1 -1
- package/dist/prod/packages/shared-chunks/{element-CT5H5uxF.js → element-DgHdPZ8u.js} +5 -3
- package/dist/prod/packages/shared-chunks/{events-C7aYCy0N.js → events-DYrYz3V8.js} +1 -1
- package/dist/{dev/packages/shared-chunks/flags-B9qxc-pB.js → prod/packages/shared-chunks/flags-BZxHQ0yn.js} +1 -1
- package/dist/prod/packages/shared-chunks/{get-tlL23wmp.js → get-Dago5uGl.js} +33 -36
- package/dist/{dev/packages/shared-chunks/get_properties-B203vZpz.js → prod/packages/shared-chunks/get_properties-Dg3xFpiS.js} +1 -1
- package/dist/prod/packages/shared-chunks/{guid-PO2v9BaN.js → guid-Cbq2sNV_.js} +1 -1
- package/dist/prod/packages/shared-chunks/{hash-C6IoC4eR.js → hash-gEXIsSO4.js} +24 -18
- package/dist/prod/packages/shared-chunks/helper-brand-C9_8vvOf.js +12 -0
- package/dist/prod/packages/shared-chunks/{index-D-rcNBLp.js → index-Bf53M8eS.js} +9 -8
- package/dist/prod/packages/shared-chunks/{index-DabsnYit.js → index-npr2B-vu.js} +541 -1465
- package/dist/prod/packages/shared-chunks/{injected_property-COGiYHKc.js → injected_property-Y-FadDej.js} +2 -2
- package/dist/prod/packages/shared-chunks/{internal-BEJC2IJ-.js → internal-BQ7zHrqS.js} +4 -4
- package/dist/prod/packages/shared-chunks/{internal-helper-CoxiRnnb.js → internal-helper-Bz1lpDXr.js} +1 -1
- package/dist/prod/packages/shared-chunks/{invoke-D_jsLbsj.js → invoke-DhQ5QRp2.js} +3 -3
- package/dist/prod/packages/shared-chunks/{libraries-Bs3H8iwC.js → libraries-DBql0hdn.js} +2 -2
- package/dist/prod/packages/shared-chunks/{meta-Ce6-qROq.js → meta-BJtIZDir.js} +1 -1
- package/dist/{dev/packages/shared-chunks/namespace_search-TFdmjK_a.js → prod/packages/shared-chunks/namespace_search-BfvzEQzN.js} +1 -1
- package/dist/prod/packages/shared-chunks/{normalize-Bx4H3NjB.js → normalize-C_IStty9.js} +2 -2
- package/dist/prod/packages/shared-chunks/{or-sYlRiUn_.js → not-BOIVROuv.js} +28 -28
- package/dist/prod/packages/shared-chunks/{observers-Ci31SE36.js → observers-BmobpXAF.js} +5 -5
- package/dist/prod/packages/shared-chunks/{on-Dgmychhk.js → on-BZHAxzdq.js} +10 -10
- package/dist/prod/packages/shared-chunks/outlet--lIm3q7t.js +132 -0
- package/dist/{dev/packages/shared-chunks/program-CPXeXWVB.js → prod/packages/shared-chunks/program-BAh__OXZ.js} +3 -3
- package/dist/prod/packages/shared-chunks/{program-context-DmI53TzJ.js → program-context-COSioH46.js} +5 -4
- package/dist/prod/packages/shared-chunks/{property_get-Sw0SicEZ.js → property_get-DAKgbeJX.js} +2 -2
- package/dist/prod/packages/shared-chunks/{property_set-SHEIPMUG.js → property_set-BaQJdVfS.js} +3 -3
- package/dist/prod/packages/shared-chunks/{reference-D2agTt1V.js → reference-CG0yPgLy.js} +3 -3
- package/dist/prod/packages/shared-chunks/{registers-Buvdhhxx.js → registers-C_W2qYHJ.js} +1 -1
- package/dist/prod/packages/shared-chunks/{rehydrate-builder-B7MtrWip.js → rehydrate-builder-Blt1x9MP.js} +4 -4
- package/dist/prod/packages/shared-chunks/{render-B790-vbk.js → render-Dx7lr1hR.js} +94 -94
- package/dist/prod/packages/shared-chunks/{rsvp-C6j8G1D1.js → rsvp.es-DR7yS7qg.js} +150 -154
- package/dist/prod/packages/shared-chunks/{serialize-builder-kEyOKbzp.js → serialize-builder-BvAXYHTr.js} +2 -2
- package/dist/prod/packages/shared-chunks/{set_properties-CcLLHg1w.js → set_properties-Qxhw4qzw.js} +2 -2
- package/dist/prod/packages/shared-chunks/setup-registry-Dfu8EyLU.js +886 -0
- package/dist/{dev/packages/shared-chunks/simple-cast-BXTrayoV.js → prod/packages/shared-chunks/simple-cast-DCvJLSin.js} +1 -1
- package/dist/{dev/packages/shared-chunks/super-D4qkU4uq.js → prod/packages/shared-chunks/super-BBBjgF69.js} +1 -1
- package/dist/{dev/packages/shared-chunks/syscall-ops-nrBHMOTp.js → prod/packages/shared-chunks/syscall-ops-CN7STuUn.js} +1 -1
- package/dist/prod/packages/shared-chunks/{template-B0Apv9g2.js → template-BRrQR6KS.js} +1 -1
- package/dist/prod/packages/shared-chunks/{template-only-CP0NT7ce.js → template-only-DKNcKM5b.js} +2 -4
- package/dist/prod/packages/shared-chunks/{textarea-B_JYBuE8.js → textarea-DOmZ1x0E.js} +11 -7
- package/dist/prod/packages/shared-chunks/{tracked-CXcapuAm.js → tracked-B9380JtC.js} +5 -5
- package/dist/prod/packages/shared-chunks/{tracked-data-DNDzhYXf.js → tracked-data-CHq42QHb.js} +2 -2
- package/dist/prod/packages/shared-chunks/{unique-id-Hn8Qp4dS.js → unique-id-o2pS74go.js} +2 -2
- package/dist/prod/packages/shared-chunks/{unrecognized-url-error-ClNyMFJt.js → unrecognized-url-error-jjQ-FqKB.js} +3 -3
- package/dist/{dev/packages/shared-chunks/vm-ops-5QCUIRx4.js → prod/packages/shared-chunks/vm-ops-ImHv0Wtg.js} +1 -1
- package/docs/data.json +616 -569
- package/package.json +8 -6
- package/types/stable/@ember/-internals/deprecations/index.d.ts +6 -0
- package/types/stable/@ember/-internals/glimmer/index.d.ts +165 -121
- package/types/stable/@ember/-internals/glimmer/lib/base-renderer.d.ts +150 -0
- package/types/stable/@ember/-internals/glimmer/lib/component-managers/curly-brand.d.ts +10 -0
- package/types/stable/@ember/-internals/glimmer/lib/component-managers/curly.d.ts +3 -2
- 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.d.ts +8 -2
- package/types/stable/@ember/-internals/glimmer/lib/glimmer-tracking-docs.d.ts +12 -12
- package/types/stable/@ember/-internals/glimmer/lib/helper-brand.d.ts +10 -0
- package/types/stable/@ember/-internals/glimmer/lib/helper.d.ts +20 -10
- package/types/stable/@ember/-internals/glimmer/lib/helpers/array.d.ts +3 -1
- package/types/stable/@ember/-internals/glimmer/lib/helpers/component.d.ts +65 -121
- package/types/stable/@ember/-internals/glimmer/lib/helpers/concat.d.ts +8 -4
- package/types/stable/@ember/-internals/glimmer/lib/helpers/each-in.d.ts +16 -14
- package/types/stable/@ember/-internals/glimmer/lib/helpers/element.d.ts +2 -0
- package/types/stable/@ember/-internals/glimmer/lib/helpers/fn.d.ts +11 -7
- package/types/stable/@ember/-internals/glimmer/lib/helpers/get.d.ts +23 -29
- package/types/stable/@ember/-internals/glimmer/lib/helpers/hash.d.ts +3 -1
- package/types/stable/@ember/-internals/glimmer/lib/helpers/if-unless.d.ts +95 -49
- package/types/stable/@ember/-internals/glimmer/lib/helpers/mut.d.ts +23 -54
- package/types/stable/@ember/-internals/glimmer/lib/helpers/page-title.d.ts +6 -2
- package/types/stable/@ember/-internals/glimmer/lib/helpers/readonly.d.ts +4 -8
- package/types/stable/@ember/-internals/glimmer/lib/modifiers/on.d.ts +10 -10
- package/types/stable/@ember/-internals/glimmer/lib/renderer.d.ts +7 -155
- package/types/stable/@ember/-internals/glimmer/lib/router-resolver.d.ts +17 -0
- package/types/stable/@ember/-internals/glimmer/lib/syntax/in-element.d.ts +2 -0
- package/types/stable/@ember/-internals/glimmer/lib/syntax/let.d.ts +2 -14
- package/types/stable/@ember/-internals/glimmer/lib/syntax/mount.d.ts +15 -11
- package/types/stable/@ember/-internals/glimmer/lib/syntax/outlet.d.ts +17 -10
- package/types/stable/@ember/-internals/runtime/lib/mixins/target_action_support.d.ts +1 -1
- package/types/stable/@ember/array/index.d.ts +6 -29
- package/types/stable/@ember/array/lib/is-array.d.ts +35 -0
- package/types/stable/@ember/component/template-only.d.ts +1 -3
- package/types/stable/@ember/controller/index.d.ts +1 -1
- package/types/stable/@ember/helper/index.d.ts +0 -19
- package/types/stable/@ember/object/index.d.ts +4 -3
- package/types/stable/@ember/object/observable.d.ts +4 -0
- package/types/stable/@ember/reactive/collections.d.ts +0 -6
- package/types/stable/@ember/renderer/index.d.ts +2 -2
- package/types/stable/@ember/routing/lib/generate_controller.d.ts +1 -1
- package/types/stable/@ember/routing/route.d.ts +2 -2
- package/types/stable/@ember/routing/router-service.d.ts +20 -12
- package/types/stable/@glimmer/runtime/lib/component/template-only.d.ts +0 -2
- package/types/stable/@glimmer/runtime/lib/dom/sanitized-values.d.ts +2 -2
- package/types/stable/@glimmer/runtime/lib/helpers/array.d.ts +1 -1
- package/types/stable/@glimmer/runtime/lib/helpers/concat.d.ts +8 -3
- package/types/stable/@glimmer/runtime/lib/helpers/fn.d.ts +13 -7
- package/types/stable/@glimmer/runtime/lib/helpers/get.d.ts +21 -29
- package/types/stable/@glimmer/runtime/lib/helpers/hash.d.ts +1 -1
- package/types/stable/@glimmer/syntax/lib/get-template-locals.d.ts +1 -1
- package/types/stable/@glimmer/tracking/index.d.ts +12 -12
- package/types/stable/index.d.ts +590 -585
- package/dist/dev/packages/shared-chunks/helper-Bm6EhgSW.js +0 -314
- package/dist/dev/packages/shared-chunks/setup-registry-C_YovxNX.js +0 -77
- package/dist/prod/packages/shared-chunks/helper-CCK8Ef0x.js +0 -298
- package/dist/prod/packages/shared-chunks/setup-registry-D14I0iDX.js +0 -74
|
@@ -1,252 +1,160 @@
|
|
|
1
|
-
import { privatize } from '../@ember/-internals/container/index.js';
|
|
2
1
|
import { E as ENV } from './env-g-kaAFLN.js';
|
|
3
|
-
import { isFactory, getOwner } from '../@ember/-internals/owner/index.js';
|
|
4
|
-
import { a as guidFor } from './guid-PO2v9BaN.js';
|
|
5
|
-
import { constructStyleDeprecationMessage, getViewId, getViewElement } from '../@ember/-internals/views/lib/system/utils.js';
|
|
6
2
|
import { deprecate, warn } from '../@ember/debug/index.js';
|
|
7
3
|
import { schedule, _backburner, _getCurrentRunLoop } from '../@ember/runloop/index.js';
|
|
8
|
-
import { associateDestroyableChild,
|
|
4
|
+
import { associateDestroyableChild, destroy, registerDestructor, isDestroyed, isDestroying } from '../@glimmer/destroyable/index.js';
|
|
9
5
|
import { artifacts } from '../@glimmer/program/index.js';
|
|
10
|
-
import { R as RuntimeOpImpl } from './program-
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import { b as CONSTANT_TAG, k as consumeTag, u as isTracking, o as debug, D as DIRTY_TAG$1, m as createTag, B as valueForTag, c as CURRENT_TAG, z as validateTag } from './cache-CeWOBNQg.js';
|
|
18
|
-
import { a as RSVP } from './rsvp-C6j8G1D1.js';
|
|
19
|
-
import { h as hasDOM } from './index-DX90CU4L.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 { h as templateFactory } from './index-DkwVSPP5.js';
|
|
24
|
-
import { assert } from '../@ember/debug/lib/assert.js';
|
|
25
|
-
import { g as getFactoryFor } from './container-BzzHmCNj.js';
|
|
26
|
-
import { g as get, a as _getProp } from './property_get-BjbsrgpU.js';
|
|
27
|
-
import { _ as _setProp, s as set } from './property_set-LJskl202.js';
|
|
6
|
+
import { R as RuntimeOpImpl } from './program-DlgjqLa6.js';
|
|
7
|
+
import { c as clientBuilder } from './api-C0PAtEgQ.js';
|
|
8
|
+
import { g as runtimeOptions, i as inTransaction, r as renderComponent$1 } from './render-87_sKZ_k.js';
|
|
9
|
+
import { c as consumeTag, z as isTracking, e as debug, a as valueForTag, k as CURRENT_TAG, v as validateTag } from './cache-DGDPVCpC.js';
|
|
10
|
+
import { h as hasDOM } from './index-BGP1rw3B.js';
|
|
11
|
+
import { g as get$1, b as _getProp } from './property_get-CRP7MFz_.js';
|
|
12
|
+
import { _ as _setProp, s as set } from './property_set-qCUylPEK.js';
|
|
28
13
|
import { g as getDebugName } from './get-debug-name-CSniHBsn.js';
|
|
14
|
+
import { constructStyleDeprecationMessage } from '../@ember/-internals/views/lib/system/utils.js';
|
|
29
15
|
import setGlobalContext from '../@glimmer/global-context/index.js';
|
|
30
|
-
import {
|
|
16
|
+
import { a as tagForProperty, t as tagForObject, o as objectAt } from './chain-tags-uWSImHzB.js';
|
|
31
17
|
import { isEmberArray } from '../@ember/array/-internals.js';
|
|
32
18
|
import { i as isObject } from './spec-BXl1reqK.js';
|
|
33
|
-
import { t as tagFor } from './meta-
|
|
19
|
+
import { t as tagFor } from './meta-BqC7f9Ia.js';
|
|
34
20
|
import { contentFor } from '../@ember/-internals/runtime/lib/mixins/-proxy.js';
|
|
35
21
|
import { i as isProxy } from './is_proxy-Bzg0d4m4.js';
|
|
36
|
-
import { i as
|
|
22
|
+
import { v as valueForRef, c as createComputeRef, i as isConstRef, a as createConstRef, d as isUpdatableRef, j as createInvokableRef, k as createReadOnlyRef, l as createUnboundRef } from './reference-BqOLhKFy.js';
|
|
23
|
+
import { i as internalHelper } from './internal-helper-CKrni0b_.js';
|
|
24
|
+
import { assert } from '../@ember/debug/lib/assert.js';
|
|
37
25
|
import { i as isHTMLSafe } from './index-D-xTBV4B.js';
|
|
38
|
-
import
|
|
26
|
+
import isArray from '../@ember/array/lib/is-array.js';
|
|
27
|
+
import { isFactory } from '../@ember/-internals/owner/index.js';
|
|
28
|
+
import { _instrumentStart } from '../@ember/instrumentation/index.js';
|
|
39
29
|
import { g as getComponentTemplate } from './template-R_5UMHhb.js';
|
|
40
|
-
import {
|
|
41
|
-
import { h as hash, f as fn, a as array } from './hash-
|
|
42
|
-
import { g as get
|
|
43
|
-
import { o as on } from './on-
|
|
44
|
-
import { T as TEMPLATE_ONLY_COMPONENT_MANAGER, t as templateOnlyComponent } from './template-only-
|
|
45
|
-
import { i as
|
|
30
|
+
import { a as getInternalHelperManager, j as setInternalHelperManager, g as getInternalComponentManager } from './api-DuLOZMO_.js';
|
|
31
|
+
import { h as hash, f as fn, a as array } from './hash-6NDs_5_f.js';
|
|
32
|
+
import { g as get, c as concat } from './get-6I3sjd-I.js';
|
|
33
|
+
import { o as on } from './on-DlF0Wy7P.js';
|
|
34
|
+
import { T as TEMPLATE_ONLY_COMPONENT_MANAGER, t as templateOnlyComponent } from './template-only-Cu639ICT.js';
|
|
35
|
+
import { i as isCurlyManager } from './curly-brand-B_F79Dep.js';
|
|
36
|
+
import { i as isClassicHelper } from './helper-brand-C9_8vvOf.js';
|
|
46
37
|
import { dasherize } from '../@ember/-internals/string/index.js';
|
|
47
|
-
import { a as uniqueId } from './unique-id-
|
|
48
|
-
import '
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
import { E as EvaluationContextImpl } from './program-context-BaYVr5GA.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}} />
|
|
38
|
+
import { a as uniqueId } from './unique-id-DQOhouG1.js';
|
|
39
|
+
import { E as EvaluationContextImpl } from './program-context-Dq8xN2HI.js';
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
@module ember
|
|
155
43
|
*/
|
|
156
|
-
{
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
44
|
+
const disallowDynamicResolution = internalHelper(({
|
|
45
|
+
positional,
|
|
46
|
+
named
|
|
47
|
+
}) => {
|
|
48
|
+
const nameOrValueRef = positional[0];
|
|
49
|
+
(!(positional.length === 1 && nameOrValueRef) && assert(`[BUG] wrong number of positional arguments, expecting 1, got ${positional.length}`, positional.length === 1 && nameOrValueRef));
|
|
50
|
+
let typeRef = named['type'];
|
|
51
|
+
let locRef = named['loc'];
|
|
52
|
+
let originalRef = named['original'];
|
|
53
|
+
(!(typeRef) && assert(`[BUG] expecting \`type\` named argument`, typeRef));
|
|
54
|
+
(!(locRef) && assert(`[BUG] expecting \`loc\` named argument`, locRef));
|
|
55
|
+
(!(originalRef) && assert(`[BUG] expecting \`original\` named argument`, originalRef)); // Bug: why do these fail?
|
|
56
|
+
// assert('[BUG] expecting a string literal for the `type` argument', isConstRef(typeRef));
|
|
57
|
+
// assert('[BUG] expecting a string literal for the `loc` argument', isConstRef(locRef));
|
|
58
|
+
// assert('[BUG] expecting a string literal for the `original` argument', isConstRef(originalRef));
|
|
59
|
+
const type = valueForRef(typeRef);
|
|
60
|
+
const loc = valueForRef(locRef);
|
|
61
|
+
const original = valueForRef(originalRef);
|
|
62
|
+
(!(typeof type === 'string') && assert('[BUG] expecting a string literal for the `type` argument', typeof type === 'string'));
|
|
63
|
+
(!(typeof loc === 'string') && assert('[BUG] expecting a string literal for the `loc` argument', typeof loc === 'string'));
|
|
64
|
+
(!(typeof original === 'string') && assert('[BUG] expecting a string literal for the `original` argument', typeof original === 'string'));
|
|
65
|
+
return createComputeRef(() => {
|
|
66
|
+
let nameOrValue = valueForRef(nameOrValueRef);
|
|
67
|
+
(!(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'));
|
|
68
|
+
return nameOrValue;
|
|
69
|
+
});
|
|
161
70
|
});
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
}
|
|
174
|
-
function createRootOutlet(outletView) {
|
|
175
|
-
return new OutletComponent(outletView.owner, outletView.state);
|
|
71
|
+
|
|
72
|
+
let helper;
|
|
73
|
+
{
|
|
74
|
+
helper = args => {
|
|
75
|
+
const inner = args.positional[0];
|
|
76
|
+
(!(inner) && assert('expected at least one positional arg', inner));
|
|
77
|
+
return createComputeRef(() => {
|
|
78
|
+
let value = valueForRef(inner);
|
|
79
|
+
(!(value !== null && value !== undefined) && assert('You cannot pass a null or undefined destination element to in-element', value !== null && value !== undefined));
|
|
80
|
+
return value;
|
|
81
|
+
});
|
|
82
|
+
};
|
|
176
83
|
}
|
|
84
|
+
const inElementNullCheckHelper = internalHelper(helper);
|
|
177
85
|
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
let
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
component.trigger('willRender');
|
|
196
|
-
}
|
|
197
|
-
component._transitionTo('hasElement');
|
|
198
|
-
if (isInteractive) {
|
|
199
|
-
component.trigger('willInsertElement');
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
{
|
|
203
|
-
processComponentInitializationAssertions(component, {});
|
|
86
|
+
const normalizeClassHelper = internalHelper(({
|
|
87
|
+
positional
|
|
88
|
+
}) => {
|
|
89
|
+
return createComputeRef(() => {
|
|
90
|
+
let classNameArg = positional[0];
|
|
91
|
+
let valueArg = positional[1];
|
|
92
|
+
(!(classNameArg && valueArg) && assert('expected at least two positional args', classNameArg && valueArg));
|
|
93
|
+
let classNameParts = valueForRef(classNameArg).split('.');
|
|
94
|
+
let className = classNameParts[classNameParts.length - 1];
|
|
95
|
+
(!(className) && assert('has className', className)); // Always at least one split result
|
|
96
|
+
let value = valueForRef(valueArg);
|
|
97
|
+
if (value === true) {
|
|
98
|
+
return dasherize(className);
|
|
99
|
+
} else if (!value && value !== 0) {
|
|
100
|
+
return '';
|
|
101
|
+
} else {
|
|
102
|
+
return String(value);
|
|
204
103
|
}
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
return bucket;
|
|
208
|
-
}
|
|
209
|
-
}
|
|
104
|
+
});
|
|
105
|
+
});
|
|
210
106
|
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
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;
|
|
107
|
+
/**
|
|
108
|
+
@module ember
|
|
109
|
+
*/
|
|
110
|
+
|
|
111
|
+
const resolve = internalHelper(({
|
|
112
|
+
positional
|
|
113
|
+
}, owner) => {
|
|
114
|
+
// why is this allowed to be undefined in the first place?
|
|
115
|
+
(!(owner) && assert('[BUG] missing owner', owner));
|
|
116
|
+
(!(positional.length === 1) && assert(`[BUG] wrong number of positional arguments, expecting 1, got ${positional.length}`, positional.length === 1));
|
|
117
|
+
let fullNameRef = positional[0];
|
|
118
|
+
(!(fullNameRef && isConstRef(fullNameRef)) && assert('[BUG] expecting a string literal as argument', fullNameRef && isConstRef(fullNameRef)));
|
|
119
|
+
let fullName = valueForRef(fullNameRef);
|
|
120
|
+
(!(typeof fullName === 'string') && assert('[BUG] expecting a string literal as argument', typeof fullName === 'string'));
|
|
121
|
+
(!((s => s.split(':').length === 2)(fullName)) && assert('[BUG] expecting a valid full name', (s => s.split(':').length === 2)(fullName)));
|
|
122
|
+
{
|
|
123
|
+
let [type, name] = fullName.split(':');
|
|
124
|
+
(!(owner.hasRegistration(fullName)) && assert(`Attempted to invoke \`(-resolve "${fullName}")\`, but ${name} was not a valid ${type} name.`, owner.hasRegistration(fullName)));
|
|
241
125
|
}
|
|
242
|
-
}
|
|
126
|
+
return createConstRef(owner.factoryFor(fullName)?.class, `(-resolve "${fullName}")`);
|
|
127
|
+
});
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
@module ember
|
|
131
|
+
*/
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
This reference is used to get the `[]` tag of iterables, so we can trigger
|
|
135
|
+
updates to `{{each}}` when it changes. It is put into place by a template
|
|
136
|
+
transform at build time, similar to the (-each-in) helper
|
|
137
|
+
*/
|
|
138
|
+
const trackArray = internalHelper(({
|
|
139
|
+
positional
|
|
140
|
+
}) => {
|
|
141
|
+
const inner = positional[0];
|
|
142
|
+
(!(inner) && assert('expected at least one positional arg', inner));
|
|
143
|
+
return createComputeRef(() => {
|
|
144
|
+
let iterable = valueForRef(inner);
|
|
145
|
+
if (isObject(iterable)) {
|
|
146
|
+
consumeTag(tagForProperty(iterable, '[]'));
|
|
147
|
+
}
|
|
148
|
+
return iterable;
|
|
149
|
+
});
|
|
150
|
+
});
|
|
243
151
|
|
|
244
152
|
/**
|
|
245
153
|
@module ember
|
|
246
154
|
*/
|
|
247
155
|
|
|
248
156
|
/**
|
|
249
|
-
The `{{#each}}`
|
|
157
|
+
The `{{#each}}` keyword loops over elements in a collection. It is an extension
|
|
250
158
|
of the base Handlebars `{{#each}}` helper.
|
|
251
159
|
|
|
252
160
|
The default behavior of `{{#each}}` is to yield its inner block once for every
|
|
@@ -290,6 +198,8 @@ class RootComponentDefinition {
|
|
|
290
198
|
{{/each}}
|
|
291
199
|
</ul>
|
|
292
200
|
```
|
|
201
|
+
|
|
202
|
+
`#each` is a keyword and does not need to be imported.
|
|
293
203
|
|
|
294
204
|
### Specifying Keys
|
|
295
205
|
|
|
@@ -357,11 +267,11 @@ class RootComponentDefinition {
|
|
|
357
267
|
*/
|
|
358
268
|
|
|
359
269
|
/**
|
|
360
|
-
The `{{each-in}}`
|
|
270
|
+
The `{{#each-in}}` keyword loops over properties on an object.
|
|
361
271
|
|
|
362
272
|
For example, given this component definition:
|
|
363
273
|
|
|
364
|
-
```app/components/developer-details.
|
|
274
|
+
```app/components/developer-details.gjs
|
|
365
275
|
import Component from '@glimmer/component';
|
|
366
276
|
import { tracked } from '@glimmer/tracking';
|
|
367
277
|
|
|
@@ -370,21 +280,19 @@ class RootComponentDefinition {
|
|
|
370
280
|
"name": "Shelly Sails",
|
|
371
281
|
"age": 42
|
|
372
282
|
};
|
|
283
|
+
|
|
284
|
+
<template>
|
|
285
|
+
<ul>
|
|
286
|
+
{{#each-in this.developer as |key value|}}
|
|
287
|
+
<li>{{key}}: {{value}}</li>
|
|
288
|
+
{{/each-in}}
|
|
289
|
+
</ul>
|
|
290
|
+
</template>
|
|
373
291
|
}
|
|
374
292
|
```
|
|
375
293
|
|
|
376
294
|
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:
|
|
295
|
+
object in a list, outputting their name and age:
|
|
388
296
|
|
|
389
297
|
```html
|
|
390
298
|
<ul>
|
|
@@ -392,6 +300,8 @@ class RootComponentDefinition {
|
|
|
392
300
|
<li>age: 42</li>
|
|
393
301
|
</ul>
|
|
394
302
|
```
|
|
303
|
+
|
|
304
|
+
`#each-in` is a keyword and does not need to be imported.
|
|
395
305
|
|
|
396
306
|
@method each-in
|
|
397
307
|
@for Ember.Templates.helpers
|
|
@@ -420,575 +330,104 @@ const eachIn = internalHelper(({
|
|
|
420
330
|
});
|
|
421
331
|
});
|
|
422
332
|
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
333
|
+
/**
|
|
334
|
+
@module ember
|
|
335
|
+
*/
|
|
336
|
+
|
|
337
|
+
/**
|
|
338
|
+
The `mut` helper is a shortcut for updating for args.
|
|
339
|
+
|
|
340
|
+
However, defining update functions on your backing class is preferable to using `mut`.
|
|
341
|
+
|
|
342
|
+
More directly: Don't use `mut`.
|
|
343
|
+
|
|
344
|
+
The `mut` helper, when used with `fn`, will return a function that
|
|
345
|
+
sets the value passed to `mut` to its first argument. As an example, we can create a
|
|
346
|
+
button that increments a value passing the value directly to the `fn`:
|
|
347
|
+
|
|
348
|
+
```handlebars
|
|
349
|
+
<MyChild @childClickCount={{this.totalClicks}} @clickCountChange={{fn (mut this.totalClicks)}} />
|
|
350
|
+
```
|
|
351
|
+
|
|
352
|
+
The child `Component` would invoke the function with the new click count:
|
|
353
|
+
|
|
354
|
+
```app/components/my-child.gjs
|
|
355
|
+
import Component from '@glimmer/component';
|
|
356
|
+
import { action } from '@ember/object';
|
|
357
|
+
|
|
358
|
+
export default class MyChild extends Component {
|
|
359
|
+
@action
|
|
360
|
+
update() {
|
|
361
|
+
this.args.clickCountChange(this.args.childClickCount + 1);
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
<template>
|
|
365
|
+
<button {{on "click" this.update}}>
|
|
366
|
+
Click me!
|
|
367
|
+
</button>
|
|
368
|
+
</template>
|
|
442
369
|
}
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
370
|
+
```
|
|
371
|
+
|
|
372
|
+
The `mut` helper changes the `totalClicks` value to what was provided as the `fn` argument.
|
|
373
|
+
|
|
374
|
+
@method mut
|
|
375
|
+
@param {Object} [attr] the "two-way" attribute that can be modified.
|
|
376
|
+
@for Ember.Templates.helpers
|
|
377
|
+
@public
|
|
378
|
+
*/
|
|
379
|
+
|
|
380
|
+
const mut = internalHelper(({
|
|
381
|
+
positional
|
|
382
|
+
}) => {
|
|
383
|
+
let ref = positional[0];
|
|
384
|
+
(!(ref) && assert('expected at least one positional arg', ref)); // TODO: Improve this error message. This covers at least two distinct
|
|
385
|
+
// cases:
|
|
386
|
+
//
|
|
387
|
+
// 1. (mut "not a path") – passing a literal, result from a helper
|
|
388
|
+
// invocation, etc
|
|
389
|
+
//
|
|
390
|
+
// 2. (mut receivedValue) – passing a value received from the caller
|
|
391
|
+
// that was originally derived from a literal, result from a helper
|
|
392
|
+
// invocation, etc
|
|
393
|
+
//
|
|
394
|
+
// This message is alright for the first case, but could be quite
|
|
395
|
+
// confusing for the second case.
|
|
396
|
+
(!(isUpdatableRef(ref)) && assert('You can only pass a path to mut', isUpdatableRef(ref)));
|
|
397
|
+
return createInvokableRef(ref);
|
|
398
|
+
});
|
|
399
|
+
|
|
400
|
+
/**
|
|
401
|
+
@module ember
|
|
402
|
+
*/
|
|
403
|
+
|
|
404
|
+
|
|
405
|
+
/**
|
|
406
|
+
The `readonly` helper let's you specify that a binding is one-way only,
|
|
407
|
+
instead of two-way.
|
|
408
|
+
|
|
409
|
+
This is a vestigial helper from the days of `@ember/component` and does not apply to
|
|
410
|
+
components extending from `@glimmer/component`.
|
|
411
|
+
|
|
412
|
+
When you pass a `readonly` binding from an outer context (e.g. parent component),
|
|
413
|
+
to to an inner context (e.g. child component), you are saying that changing that
|
|
414
|
+
property in the inner context does not change the value in the outer context.
|
|
415
|
+
|
|
416
|
+
To specify that a binding is read-only, when invoking the child `Component`:
|
|
417
|
+
|
|
418
|
+
```app/components/my-parent.js
|
|
419
|
+
export default class MyParent extends Component {
|
|
420
|
+
totalClicks = 3;
|
|
447
421
|
}
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
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
|
-
}
|
|
422
|
+
```
|
|
423
|
+
|
|
424
|
+
Now, when you update `childClickCount`:
|
|
425
|
+
|
|
426
|
+
```app/components/my-child.js
|
|
427
|
+
export default class MyChild extends Component {
|
|
428
|
+
click() {
|
|
429
|
+
this.incrementProperty('childClickCount');
|
|
430
|
+
}
|
|
992
431
|
}
|
|
993
432
|
```
|
|
994
433
|
|
|
@@ -1077,516 +516,51 @@ const mut = internalHelper(({
|
|
|
1077
516
|
const readonly = internalHelper(({
|
|
1078
517
|
positional
|
|
1079
518
|
}) => {
|
|
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();
|
|
519
|
+
let firstArg = positional[0];
|
|
520
|
+
(!(firstArg) && assert('has first arg', firstArg));
|
|
521
|
+
return createReadOnlyRef(firstArg);
|
|
522
|
+
});
|
|
1393
523
|
|
|
1394
524
|
/**
|
|
1395
|
-
|
|
1396
|
-
|
|
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
|
-
}
|
|
525
|
+
@module ember
|
|
526
|
+
*/
|
|
1420
527
|
|
|
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
528
|
|
|
1433
529
|
/**
|
|
1434
|
-
The `{{
|
|
1435
|
-
|
|
1436
|
-
|
|
530
|
+
The `{{unbound}}` helper disconnects the one-way binding of a property,
|
|
531
|
+
essentially freezing its value at the moment of rendering. For example,
|
|
532
|
+
in this example the display of the variable `name` will not change even
|
|
533
|
+
if it is set with a new value:
|
|
1437
534
|
|
|
1438
|
-
```
|
|
1439
|
-
|
|
535
|
+
```handlebars
|
|
536
|
+
{{unbound this.name}}
|
|
537
|
+
```
|
|
1440
538
|
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
{{outlet}}
|
|
1444
|
-
</div>
|
|
539
|
+
Like any helper, the `unbound` helper can accept a nested helper expression.
|
|
540
|
+
This allows for custom helpers to be rendered unbound:
|
|
1445
541
|
|
|
1446
|
-
|
|
542
|
+
```handlebars
|
|
543
|
+
{{unbound (some-custom-helper)}}
|
|
544
|
+
{{unbound (capitalize this.name)}}
|
|
545
|
+
{{! You can use any helper, including unbound, in a nested expression }}
|
|
546
|
+
{{capitalize (unbound this.name)}}
|
|
1447
547
|
```
|
|
1448
548
|
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
Note: Your content __will not render__ if there isn't an `{{outlet}}` for it.
|
|
549
|
+
The `unbound` helper only accepts a single argument, and it return an
|
|
550
|
+
unbound value.
|
|
1452
551
|
|
|
1453
|
-
@method
|
|
552
|
+
@method unbound
|
|
1454
553
|
@for Ember.Templates.helpers
|
|
1455
554
|
@public
|
|
1456
555
|
*/
|
|
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
556
|
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
return outlet;
|
|
1566
|
-
});
|
|
557
|
+
const unbound = internalHelper(({
|
|
558
|
+
positional,
|
|
559
|
+
named
|
|
560
|
+
}) => {
|
|
561
|
+
(!(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));
|
|
562
|
+
return createUnboundRef(valueForRef(positional[0]), '(result of an `unbound` helper)');
|
|
1567
563
|
});
|
|
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
564
|
|
|
1591
565
|
function instrumentationPayload(name) {
|
|
1592
566
|
return {
|
|
@@ -1626,8 +600,6 @@ const BUILTIN_KEYWORD_HELPERS = {
|
|
|
1626
600
|
'-normalize-class': normalizeClassHelper,
|
|
1627
601
|
'-resolve': resolve,
|
|
1628
602
|
'-track-array': trackArray,
|
|
1629
|
-
'-mount': mountHelper,
|
|
1630
|
-
'-outlet': outletHelper,
|
|
1631
603
|
'-in-el-null': inElementNullCheckHelper
|
|
1632
604
|
};
|
|
1633
605
|
const BUILTIN_HELPERS = {
|
|
@@ -1635,13 +607,19 @@ const BUILTIN_HELPERS = {
|
|
|
1635
607
|
array,
|
|
1636
608
|
concat,
|
|
1637
609
|
fn,
|
|
1638
|
-
get
|
|
610
|
+
get,
|
|
1639
611
|
hash,
|
|
1640
|
-
'unique-id': uniqueId
|
|
612
|
+
'unique-id': uniqueId,
|
|
613
|
+
// In prod builds, this is a no-op helper and is unused in practice. We shouldn't need
|
|
614
|
+
// to add it at all, but the current test build doesn't produce a "prod compiler", so
|
|
615
|
+
// we ended up running the debug-build for the template compliler in prod tests. Once
|
|
616
|
+
// that is fixed, this can be conditionally included only in DEBUG. For now, this
|
|
617
|
+
// allows the test to work and does not really harm anything, since it's just a no-op
|
|
618
|
+
// pass-through helper. Keeping it inside the object literal (rather than a top-level
|
|
619
|
+
// conditional assignment) keeps this module free of top-level side effects so that
|
|
620
|
+
// consumers that never resolve anything dynamically can tree-shake the whole table.
|
|
621
|
+
'-disallow-dynamic-resolution': disallowDynamicResolution
|
|
1641
622
|
};
|
|
1642
|
-
{
|
|
1643
|
-
BUILTIN_HELPERS['-disallow-dynamic-resolution'] = disallowDynamicResolution;
|
|
1644
|
-
}
|
|
1645
623
|
|
|
1646
624
|
// 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
625
|
// only built-in keyword modifier, so this object is currently empty.
|
|
@@ -1675,12 +653,17 @@ class ResolverImpl {
|
|
|
1675
653
|
// than the raw value (`factoryFor(...).class`). This is because injections are already
|
|
1676
654
|
// bound in the factoryFor result, including type-based injections
|
|
1677
655
|
|
|
656
|
+
// The classic helper manager is registered on the classic `Helper` base
|
|
657
|
+
// class; deriving it from the definition (rather than importing it from
|
|
658
|
+
// the module that defines `Helper`) keeps this module from pulling in
|
|
659
|
+
// the classic object model when no classic helpers are in use.
|
|
660
|
+
let manager = getInternalHelperManager(definition);
|
|
1678
661
|
{
|
|
1679
662
|
// In DEBUG we need to only set the associated value once, otherwise
|
|
1680
663
|
// we'll trigger an assertion
|
|
1681
664
|
if (!CLASSIC_HELPER_MANAGER_ASSOCIATED.has(factory)) {
|
|
1682
665
|
CLASSIC_HELPER_MANAGER_ASSOCIATED.add(factory);
|
|
1683
|
-
setInternalHelperManager(
|
|
666
|
+
setInternalHelperManager(manager, factory);
|
|
1684
667
|
}
|
|
1685
668
|
}
|
|
1686
669
|
return factory;
|
|
@@ -1688,6 +671,7 @@ class ResolverImpl {
|
|
|
1688
671
|
return definition;
|
|
1689
672
|
}
|
|
1690
673
|
lookupBuiltInHelper(name) {
|
|
674
|
+
(!(name !== '-outlet' && name !== '-mount') && assert(`The \`{{${name.slice(1)}}}\` keyword requires the router, which is not available here. ` + `It is only supported in templates rendered by an Ember application (e.g. not via \`renderComponent\`).`, name !== '-outlet' && name !== '-mount'));
|
|
1691
675
|
return BUILTIN_KEYWORD_HELPERS[name] ?? null;
|
|
1692
676
|
}
|
|
1693
677
|
lookupModifier(name, owner) {
|
|
@@ -1704,159 +688,377 @@ class ResolverImpl {
|
|
|
1704
688
|
lookupBuiltInModifier(name) {
|
|
1705
689
|
return BUILTIN_KEYWORD_MODIFIERS[name] ?? null;
|
|
1706
690
|
}
|
|
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'));
|
|
691
|
+
lookupComponent(name, owner) {
|
|
692
|
+
let pair = lookupComponentPair(owner, name);
|
|
693
|
+
if (pair === null) {
|
|
694
|
+
(!(name !== 'text-area') && assert('Could not find component `<TextArea />` (did you mean `<Textarea />`?)', name !== 'text-area'));
|
|
695
|
+
return null;
|
|
696
|
+
}
|
|
697
|
+
let template = null;
|
|
698
|
+
let key;
|
|
699
|
+
if (pair.component === null) {
|
|
700
|
+
key = template = pair.layout(owner);
|
|
701
|
+
} else {
|
|
702
|
+
key = pair.component;
|
|
703
|
+
}
|
|
704
|
+
let cachedComponentDefinition = this.componentDefinitionCache.get(key);
|
|
705
|
+
if (cachedComponentDefinition !== undefined) {
|
|
706
|
+
return cachedComponentDefinition;
|
|
707
|
+
}
|
|
708
|
+
if (template === null && pair.layout !== null) {
|
|
709
|
+
template = pair.layout(owner);
|
|
710
|
+
}
|
|
711
|
+
let finalizer = _instrumentStart('render.getComponentDefinition', instrumentationPayload, name);
|
|
712
|
+
let definition = null;
|
|
713
|
+
if (pair.component === null) {
|
|
714
|
+
definition = {
|
|
715
|
+
state: templateOnlyComponent(undefined, name),
|
|
716
|
+
manager: TEMPLATE_ONLY_COMPONENT_MANAGER,
|
|
717
|
+
template
|
|
718
|
+
};
|
|
719
|
+
} else {
|
|
720
|
+
let factory = pair.component;
|
|
721
|
+
(!(factory.class !== undefined) && assert(`missing component class ${name}`, factory.class !== undefined));
|
|
722
|
+
let ComponentClass = factory.class;
|
|
723
|
+
let manager = getInternalComponentManager(ComponentClass);
|
|
724
|
+
definition = {
|
|
725
|
+
state: isCurlyManager(manager) ? factory : ComponentClass,
|
|
726
|
+
manager,
|
|
727
|
+
template
|
|
728
|
+
};
|
|
729
|
+
}
|
|
730
|
+
finalizer();
|
|
731
|
+
this.componentDefinitionCache.set(key, definition);
|
|
732
|
+
(!(!(definition === null && name === 'text-area')) && assert('Could not find component `<TextArea />` (did you mean `<Textarea />`?)', !(definition === null && name === 'text-area')));
|
|
733
|
+
return definition;
|
|
734
|
+
}
|
|
735
|
+
}
|
|
736
|
+
|
|
737
|
+
function toIterator(iterable) {
|
|
738
|
+
if (iterable instanceof EachInWrapper) {
|
|
739
|
+
return toEachInIterator(iterable.inner);
|
|
740
|
+
} else {
|
|
741
|
+
return toEachIterator(iterable);
|
|
742
|
+
}
|
|
743
|
+
}
|
|
744
|
+
function toEachInIterator(iterable) {
|
|
745
|
+
if (!isIndexable(iterable)) {
|
|
746
|
+
return null;
|
|
747
|
+
}
|
|
748
|
+
if (Array.isArray(iterable) || isEmberArray(iterable)) {
|
|
749
|
+
return ObjectIterator.fromIndexable(iterable);
|
|
750
|
+
} else if (isNativeIterable(iterable)) {
|
|
751
|
+
return MapLikeNativeIterator.from(iterable);
|
|
752
|
+
} else if (hasForEach(iterable)) {
|
|
753
|
+
return ObjectIterator.fromForEachable(iterable);
|
|
754
|
+
} else {
|
|
755
|
+
return ObjectIterator.fromIndexable(iterable);
|
|
756
|
+
}
|
|
757
|
+
}
|
|
758
|
+
function toEachIterator(iterable) {
|
|
759
|
+
if (!isObject(iterable)) {
|
|
760
|
+
return null;
|
|
761
|
+
}
|
|
762
|
+
if (Array.isArray(iterable)) {
|
|
763
|
+
return ArrayIterator.from(iterable);
|
|
764
|
+
} else if (isEmberArray(iterable)) {
|
|
765
|
+
return EmberArrayIterator.from(iterable);
|
|
766
|
+
} else if (isNativeIterable(iterable)) {
|
|
767
|
+
return ArrayLikeNativeIterator.from(iterable);
|
|
768
|
+
} else if (hasForEach(iterable)) {
|
|
769
|
+
return ArrayIterator.fromForEachable(iterable);
|
|
770
|
+
} else {
|
|
771
|
+
return null;
|
|
772
|
+
}
|
|
773
|
+
}
|
|
774
|
+
class BoundedIterator {
|
|
775
|
+
position = 0;
|
|
776
|
+
constructor(length) {
|
|
777
|
+
this.length = length;
|
|
778
|
+
}
|
|
779
|
+
isEmpty() {
|
|
780
|
+
return false;
|
|
781
|
+
}
|
|
782
|
+
memoFor(position) {
|
|
783
|
+
return position;
|
|
784
|
+
}
|
|
785
|
+
next() {
|
|
786
|
+
let {
|
|
787
|
+
length,
|
|
788
|
+
position
|
|
789
|
+
} = this;
|
|
790
|
+
if (position >= length) {
|
|
791
|
+
return null;
|
|
792
|
+
}
|
|
793
|
+
let value = this.valueFor(position);
|
|
794
|
+
let memo = this.memoFor(position);
|
|
795
|
+
this.position++;
|
|
796
|
+
return {
|
|
797
|
+
value,
|
|
798
|
+
memo
|
|
799
|
+
};
|
|
800
|
+
}
|
|
801
|
+
}
|
|
802
|
+
class ArrayIterator extends BoundedIterator {
|
|
803
|
+
static from(iterable) {
|
|
804
|
+
return iterable.length > 0 ? new this(iterable) : null;
|
|
805
|
+
}
|
|
806
|
+
static fromForEachable(object) {
|
|
807
|
+
let array = [];
|
|
808
|
+
object.forEach(item => array.push(item));
|
|
809
|
+
return this.from(array);
|
|
810
|
+
}
|
|
811
|
+
constructor(array) {
|
|
812
|
+
super(array.length);
|
|
813
|
+
this.array = array;
|
|
814
|
+
}
|
|
815
|
+
valueFor(position) {
|
|
816
|
+
return this.array[position];
|
|
817
|
+
}
|
|
818
|
+
}
|
|
819
|
+
class EmberArrayIterator extends BoundedIterator {
|
|
820
|
+
static from(iterable) {
|
|
821
|
+
return iterable.length > 0 ? new this(iterable) : null;
|
|
822
|
+
}
|
|
823
|
+
constructor(array) {
|
|
824
|
+
super(array.length);
|
|
825
|
+
this.array = array;
|
|
826
|
+
}
|
|
827
|
+
valueFor(position) {
|
|
828
|
+
return objectAt(this.array, position);
|
|
829
|
+
}
|
|
830
|
+
}
|
|
831
|
+
class ObjectIterator extends BoundedIterator {
|
|
832
|
+
static fromIndexable(obj) {
|
|
833
|
+
let keys = Object.keys(obj);
|
|
834
|
+
if (keys.length === 0) {
|
|
835
|
+
return null;
|
|
836
|
+
} else {
|
|
837
|
+
let values = [];
|
|
838
|
+
for (let key of keys) {
|
|
839
|
+
let value;
|
|
840
|
+
value = obj[key];
|
|
841
|
+
|
|
842
|
+
// Add the tag of the returned value if it is an array, since arrays
|
|
843
|
+
// should always cause updates if they are consumed and then changed
|
|
844
|
+
if (isTracking()) {
|
|
845
|
+
consumeTag(tagFor(obj, key));
|
|
846
|
+
if (Array.isArray(value)) {
|
|
847
|
+
consumeTag(tagFor(value, '[]'));
|
|
848
|
+
}
|
|
849
|
+
}
|
|
850
|
+
values.push(value);
|
|
851
|
+
}
|
|
852
|
+
return new this(keys, values);
|
|
853
|
+
}
|
|
854
|
+
}
|
|
855
|
+
static fromForEachable(obj) {
|
|
856
|
+
let keys = [];
|
|
857
|
+
let values = [];
|
|
858
|
+
let length = 0;
|
|
859
|
+
let isMapLike = false;
|
|
860
|
+
|
|
861
|
+
// Not using an arrow function here so we can get an accurate `arguments`
|
|
862
|
+
obj.forEach(function (value, key) {
|
|
863
|
+
isMapLike = isMapLike || arguments.length >= 2;
|
|
864
|
+
if (isMapLike) {
|
|
865
|
+
keys.push(key);
|
|
866
|
+
}
|
|
867
|
+
values.push(value);
|
|
868
|
+
length++;
|
|
869
|
+
});
|
|
870
|
+
if (length === 0) {
|
|
871
|
+
return null;
|
|
872
|
+
} else if (isMapLike) {
|
|
873
|
+
return new this(keys, values);
|
|
874
|
+
} else {
|
|
875
|
+
return new ArrayIterator(values);
|
|
876
|
+
}
|
|
877
|
+
}
|
|
878
|
+
constructor(keys, values) {
|
|
879
|
+
super(values.length);
|
|
880
|
+
this.keys = keys;
|
|
881
|
+
this.values = values;
|
|
882
|
+
}
|
|
883
|
+
valueFor(position) {
|
|
884
|
+
return this.values[position];
|
|
885
|
+
}
|
|
886
|
+
memoFor(position) {
|
|
887
|
+
return this.keys[position];
|
|
888
|
+
}
|
|
889
|
+
}
|
|
890
|
+
class NativeIterator {
|
|
891
|
+
static from(iterable) {
|
|
892
|
+
let iterator = iterable[Symbol.iterator]();
|
|
893
|
+
let result = iterator.next();
|
|
894
|
+
let {
|
|
895
|
+
done
|
|
896
|
+
} = result;
|
|
897
|
+
if (done) {
|
|
1711
898
|
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
899
|
} else {
|
|
1736
|
-
|
|
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
|
-
};
|
|
900
|
+
return new this(iterator, result);
|
|
1745
901
|
}
|
|
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
902
|
}
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
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
|
-
};
|
|
903
|
+
position = 0;
|
|
904
|
+
constructor(iterable, result) {
|
|
905
|
+
this.iterable = iterable;
|
|
906
|
+
this.result = result;
|
|
1769
907
|
}
|
|
1770
|
-
|
|
1771
|
-
|
|
908
|
+
isEmpty() {
|
|
909
|
+
return false;
|
|
1772
910
|
}
|
|
1773
|
-
|
|
911
|
+
next() {
|
|
1774
912
|
let {
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
} =
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
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
|
|
913
|
+
iterable,
|
|
914
|
+
result,
|
|
915
|
+
position
|
|
916
|
+
} = this;
|
|
917
|
+
if (result.done) {
|
|
918
|
+
return null;
|
|
919
|
+
}
|
|
920
|
+
let value = this.valueFor(result, position);
|
|
921
|
+
let memo = this.memoFor(result, position);
|
|
922
|
+
this.position++;
|
|
923
|
+
this.result = iterable.next();
|
|
924
|
+
return {
|
|
925
|
+
value,
|
|
926
|
+
memo
|
|
1816
927
|
};
|
|
1817
928
|
}
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
|
|
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);
|
|
929
|
+
}
|
|
930
|
+
class ArrayLikeNativeIterator extends NativeIterator {
|
|
931
|
+
valueFor(result) {
|
|
932
|
+
return result.value;
|
|
1830
933
|
}
|
|
1831
|
-
|
|
1832
|
-
|
|
934
|
+
memoFor(_result, position) {
|
|
935
|
+
return position;
|
|
1833
936
|
}
|
|
1834
|
-
|
|
1835
|
-
|
|
937
|
+
}
|
|
938
|
+
class MapLikeNativeIterator extends NativeIterator {
|
|
939
|
+
valueFor(result) {
|
|
940
|
+
return result.value[1];
|
|
1836
941
|
}
|
|
1837
|
-
|
|
1838
|
-
|
|
942
|
+
memoFor(result) {
|
|
943
|
+
return result.value[0];
|
|
1839
944
|
}
|
|
1840
945
|
}
|
|
946
|
+
function hasForEach(value) {
|
|
947
|
+
return value != null && typeof value['forEach'] === 'function';
|
|
948
|
+
}
|
|
949
|
+
function isNativeIterable(value) {
|
|
950
|
+
return value != null && typeof value[Symbol.iterator] === 'function';
|
|
951
|
+
}
|
|
952
|
+
function isIndexable(value) {
|
|
953
|
+
return value !== null && (typeof value === 'object' || typeof value === 'function');
|
|
954
|
+
}
|
|
1841
955
|
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
956
|
+
function toBool(predicate) {
|
|
957
|
+
if (isProxy(predicate)) {
|
|
958
|
+
consumeTag(tagForProperty(predicate, 'content'));
|
|
959
|
+
return Boolean(get$1(predicate, 'isTruthy'));
|
|
960
|
+
} else if (isArray(predicate)) {
|
|
961
|
+
consumeTag(tagForProperty(predicate, '[]'));
|
|
962
|
+
return predicate.length !== 0;
|
|
963
|
+
} else if (isHTMLSafe(predicate)) {
|
|
964
|
+
return Boolean(predicate.toString());
|
|
965
|
+
} else {
|
|
966
|
+
return Boolean(predicate);
|
|
1846
967
|
}
|
|
1847
|
-
|
|
1848
|
-
|
|
968
|
+
}
|
|
969
|
+
|
|
970
|
+
///////////
|
|
971
|
+
|
|
972
|
+
// Setup global context
|
|
973
|
+
|
|
974
|
+
setGlobalContext({
|
|
975
|
+
scheduleRevalidate() {
|
|
976
|
+
_backburner.ensureInstance();
|
|
977
|
+
},
|
|
978
|
+
toBool,
|
|
979
|
+
toIterator,
|
|
980
|
+
getProp: _getProp,
|
|
981
|
+
setProp: _setProp,
|
|
982
|
+
getPath: get$1,
|
|
983
|
+
setPath: set,
|
|
984
|
+
scheduleDestroy(destroyable, destructor) {
|
|
985
|
+
schedule('actions', null, destructor, destroyable);
|
|
986
|
+
},
|
|
987
|
+
scheduleDestroyed(finalizeDestructor) {
|
|
988
|
+
schedule('destroy', null, finalizeDestructor);
|
|
989
|
+
},
|
|
990
|
+
warnIfStyleNotTrusted(value) {
|
|
991
|
+
(warn(constructStyleDeprecationMessage(String(value)), (() => {
|
|
992
|
+
if (value === null || value === undefined || isHTMLSafe(value)) {
|
|
993
|
+
return true;
|
|
994
|
+
}
|
|
995
|
+
return false;
|
|
996
|
+
})(), {
|
|
997
|
+
id: 'ember-htmlbars.style-xss-warning'
|
|
998
|
+
}));
|
|
999
|
+
},
|
|
1000
|
+
assert(test, msg, options) {
|
|
1001
|
+
{
|
|
1002
|
+
let id = options?.id;
|
|
1003
|
+
let override = VM_ASSERTION_OVERRIDES.filter(o => o.id === id)[0];
|
|
1004
|
+
(!(test) && assert(override?.message ?? msg, test));
|
|
1005
|
+
}
|
|
1006
|
+
},
|
|
1007
|
+
deprecate(msg, test, options) {
|
|
1008
|
+
{
|
|
1009
|
+
let {
|
|
1010
|
+
id
|
|
1011
|
+
} = options;
|
|
1012
|
+
if (id === 'argument-less-helper-paren-less-invocation') {
|
|
1013
|
+
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)}}\`.`);
|
|
1014
|
+
}
|
|
1015
|
+
let override = VM_DEPRECATION_OVERRIDES.filter(o => o.id === id)[0];
|
|
1016
|
+
if (!override) throw new Error(`deprecation override for ${id} not found`);
|
|
1017
|
+
|
|
1018
|
+
// allow deprecations to be disabled in the VM_DEPRECATION_OVERRIDES array below
|
|
1019
|
+
if (!override.disabled) {
|
|
1020
|
+
(!(Boolean(test)) && deprecate(override.message ?? msg, Boolean(test), override));
|
|
1021
|
+
}
|
|
1022
|
+
}
|
|
1849
1023
|
}
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1024
|
+
});
|
|
1025
|
+
{
|
|
1026
|
+
debug?.setTrackingTransactionEnv?.({
|
|
1027
|
+
debugMessage(obj, keyName) {
|
|
1028
|
+
let dirtyString = keyName ? `\`${keyName}\` on \`${getDebugName?.(obj)}\`` : `\`${getDebugName?.(obj)}\``;
|
|
1029
|
+
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.`;
|
|
1030
|
+
}
|
|
1031
|
+
});
|
|
1032
|
+
}
|
|
1033
|
+
|
|
1034
|
+
///////////
|
|
1035
|
+
|
|
1036
|
+
// VM Assertion/Deprecation overrides
|
|
1037
|
+
|
|
1038
|
+
const VM_DEPRECATION_OVERRIDES = [{
|
|
1039
|
+
id: 'setting-on-hash',
|
|
1040
|
+
until: '4.4.0',
|
|
1041
|
+
for: 'ember-source',
|
|
1042
|
+
since: {
|
|
1043
|
+
available: '3.28.0',
|
|
1044
|
+
enabled: '3.28.0'
|
|
1853
1045
|
}
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
|
|
1046
|
+
}];
|
|
1047
|
+
const VM_ASSERTION_OVERRIDES = [];
|
|
1048
|
+
|
|
1049
|
+
///////////
|
|
1050
|
+
|
|
1051
|
+
// Define environment delegate
|
|
1052
|
+
|
|
1053
|
+
class EmberEnvironmentDelegate {
|
|
1054
|
+
enableDebugTooling = ENV._DEBUG_RENDER_TREE;
|
|
1055
|
+
constructor(owner, isInteractive) {
|
|
1056
|
+
this.owner = owner;
|
|
1057
|
+
this.isInteractive = isInteractive;
|
|
1858
1058
|
}
|
|
1059
|
+
onTransactionCommit() {}
|
|
1859
1060
|
}
|
|
1061
|
+
|
|
1860
1062
|
const NO_OP = () => {};
|
|
1861
1063
|
|
|
1862
1064
|
// This wrapper logic prevents us from rerendering in case of a hard failure
|
|
@@ -1882,6 +1084,13 @@ function errorLoopTransaction(fn) {
|
|
|
1882
1084
|
};
|
|
1883
1085
|
}
|
|
1884
1086
|
}
|
|
1087
|
+
|
|
1088
|
+
/**
|
|
1089
|
+
* The interface the `RendererState` needs from a render root. The base
|
|
1090
|
+
* renderer only ever creates `ComponentRootState`s; the classic renderer
|
|
1091
|
+
* (`./renderer`) adds `ClassicRootState` for outlet/classic-component roots.
|
|
1092
|
+
*/
|
|
1093
|
+
|
|
1885
1094
|
class ComponentRootState {
|
|
1886
1095
|
type = 'component';
|
|
1887
1096
|
#result;
|
|
@@ -1899,7 +1108,7 @@ class ComponentRootState {
|
|
|
1899
1108
|
});
|
|
1900
1109
|
});
|
|
1901
1110
|
}
|
|
1902
|
-
isFor(
|
|
1111
|
+
isFor(_possibleRoot) {
|
|
1903
1112
|
return false;
|
|
1904
1113
|
}
|
|
1905
1114
|
render() {
|
|
@@ -1915,62 +1124,6 @@ class ComponentRootState {
|
|
|
1915
1124
|
return this.#result;
|
|
1916
1125
|
}
|
|
1917
1126
|
}
|
|
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
1127
|
const renderers = [];
|
|
1975
1128
|
function _resetRenderers() {
|
|
1976
1129
|
renderers.length = 0;
|
|
@@ -2001,7 +1154,12 @@ let renderSettledDeferred = null;
|
|
|
2001
1154
|
*/
|
|
2002
1155
|
function renderSettled() {
|
|
2003
1156
|
if (renderSettledDeferred === null) {
|
|
2004
|
-
|
|
1157
|
+
let resolve;
|
|
1158
|
+
let promise = new Promise(r => resolve = r);
|
|
1159
|
+
renderSettledDeferred = {
|
|
1160
|
+
promise,
|
|
1161
|
+
resolve
|
|
1162
|
+
};
|
|
2005
1163
|
// if there is no current runloop, the promise created above will not have
|
|
2006
1164
|
// a chance to resolve (because its resolved in backburner's "end" event)
|
|
2007
1165
|
if (!_getCurrentRunLoop()) {
|
|
@@ -2359,142 +1517,6 @@ class BaseRenderer {
|
|
|
2359
1517
|
rerender() {
|
|
2360
1518
|
this.state.scheduleRevalidate(this);
|
|
2361
1519
|
}
|
|
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
1520
|
}
|
|
2499
1521
|
|
|
2500
|
-
export {
|
|
1522
|
+
export { BaseRenderer as B, ResolverImpl as R, _resetRenderers as _, renderSettled as a, errorLoopTransaction as e, renderComponent as r };
|