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.
Files changed (347) hide show
  1. package/blueprints/-addon-import.js +4 -6
  2. package/blueprints/-utils.js +6 -9
  3. package/build-metadata.json +3 -3
  4. package/dist/dev/packages/@ember/-internals/browser-environment/index.js +1 -1
  5. package/dist/dev/packages/@ember/-internals/deprecations/index.js +10 -0
  6. package/dist/dev/packages/@ember/-internals/glimmer/index.js +11 -11
  7. package/dist/dev/packages/@ember/-internals/metal/index.js +18 -18
  8. package/dist/dev/packages/@ember/-internals/routing/index.js +3 -3
  9. package/dist/dev/packages/@ember/-internals/runtime/index.js +1 -1
  10. package/dist/dev/packages/@ember/-internals/runtime/lib/ext/rsvp.js +1 -1
  11. package/dist/dev/packages/@ember/-internals/runtime/lib/mixins/-proxy.js +8 -8
  12. package/dist/dev/packages/@ember/-internals/runtime/lib/mixins/action_handler.js +1 -1
  13. package/dist/dev/packages/@ember/-internals/runtime/lib/mixins/comparable.js +5 -0
  14. package/dist/dev/packages/@ember/-internals/runtime/lib/mixins/target_action_support.js +3 -3
  15. package/dist/dev/packages/@ember/-internals/utils/index.js +2 -2
  16. package/dist/dev/packages/@ember/-internals/views/lib/mixins/action_support.js +1 -1
  17. package/dist/dev/packages/@ember/-internals/views/lib/system/event_dispatcher.js +2 -2
  18. package/dist/dev/packages/@ember/-internals/views/lib/system/utils.js +1 -1
  19. package/dist/dev/packages/@ember/-internals/views/lib/views/core_view.js +1 -1
  20. package/dist/dev/packages/@ember/application/index.js +6 -7
  21. package/dist/dev/packages/@ember/application/instance.js +24 -4
  22. package/dist/dev/packages/@ember/application/namespace.js +3 -3
  23. package/dist/dev/packages/@ember/array/index.js +10 -64
  24. package/dist/dev/packages/@ember/array/lib/is-array.js +71 -0
  25. package/dist/dev/packages/@ember/array/proxy.js +8 -8
  26. package/dist/dev/packages/@ember/component/helper.js +321 -1
  27. package/dist/dev/packages/@ember/component/index.js +21 -15
  28. package/dist/dev/packages/@ember/component/template-only.js +1 -1
  29. package/dist/dev/packages/@ember/controller/index.js +3 -3
  30. package/dist/dev/packages/@ember/debug/data-adapter.js +3 -3
  31. package/dist/dev/packages/@ember/debug/index.js +1 -1
  32. package/dist/dev/packages/@ember/engine/index.js +5 -5
  33. package/dist/dev/packages/@ember/engine/instance.js +2 -2
  34. package/dist/dev/packages/@ember/helper/index.js +8 -27
  35. package/dist/dev/packages/@ember/modifier/index.js +2 -2
  36. package/dist/dev/packages/@ember/modifier/on.js +1 -1
  37. package/dist/dev/packages/@ember/object/-internals.js +2 -2
  38. package/dist/dev/packages/@ember/object/compat.js +3 -3
  39. package/dist/dev/packages/@ember/object/computed.js +2 -2
  40. package/dist/dev/packages/@ember/object/core.js +7 -7
  41. package/dist/dev/packages/@ember/object/evented.js +2 -2
  42. package/dist/dev/packages/@ember/object/events.js +1 -1
  43. package/dist/dev/packages/@ember/object/index.js +30 -25
  44. package/dist/dev/packages/@ember/object/internals.js +1 -1
  45. package/dist/dev/packages/@ember/object/lib/computed/computed_macros.js +5 -5
  46. package/dist/dev/packages/@ember/object/lib/computed/reduce_computed_macros.js +3 -3
  47. package/dist/dev/packages/@ember/object/mixin.js +6 -6
  48. package/dist/dev/packages/@ember/object/observable.js +7 -7
  49. package/dist/dev/packages/@ember/object/observers.js +1 -1
  50. package/dist/dev/packages/@ember/object/promise-proxy-mixin.js +3 -3
  51. package/dist/dev/packages/@ember/reactive/collections.js +153 -153
  52. package/dist/dev/packages/@ember/renderer/index.js +1 -1
  53. package/dist/dev/packages/@ember/routing/-internals.js +3 -3
  54. package/dist/dev/packages/@ember/routing/index.js +12 -8
  55. package/dist/dev/packages/@ember/routing/lib/generate_controller.js +2 -3
  56. package/dist/dev/packages/@ember/routing/lib/routing-service.js +5 -6
  57. package/dist/dev/packages/@ember/routing/lib/utils.js +3 -3
  58. package/dist/dev/packages/@ember/routing/route.js +12 -12
  59. package/dist/dev/packages/@ember/routing/router-service.js +25 -19
  60. package/dist/dev/packages/@ember/routing/router.js +5 -5
  61. package/dist/dev/packages/@ember/runloop/index.js +1 -1
  62. package/dist/dev/packages/@ember/service/index.js +1 -1
  63. package/dist/dev/packages/@ember/template-compiler/lib/compile-options.js +3 -3
  64. package/dist/dev/packages/@ember/template-compiler/lib/template.js +2 -2
  65. package/dist/dev/packages/@ember/template-factory/index.js +1 -1
  66. package/dist/dev/packages/@ember/utils/lib/compare.js +5 -2
  67. package/dist/dev/packages/@ember/utils/lib/is_empty.js +1 -1
  68. package/dist/dev/packages/@glimmer/encoder/index.js +1 -1
  69. package/dist/dev/packages/@glimmer/manager/index.js +4 -4
  70. package/dist/dev/packages/@glimmer/node/index.js +3 -3
  71. package/dist/dev/packages/@glimmer/opcode-compiler/index.js +2 -2
  72. package/dist/dev/packages/@glimmer/program/index.js +10 -10
  73. package/dist/dev/packages/@glimmer/reference/index.js +5 -5
  74. package/dist/dev/packages/@glimmer/runtime/index.js +13 -13
  75. package/dist/dev/packages/@glimmer/tracking/index.js +2 -2
  76. package/dist/dev/packages/@glimmer/tracking/primitives/cache/index.js +1 -1
  77. package/dist/dev/packages/@glimmer/util/index.js +4 -4
  78. package/dist/dev/packages/@glimmer/validator/index.js +3 -3
  79. package/dist/dev/packages/@glimmer/vm/index.js +2 -2
  80. package/dist/dev/packages/ember/version.js +1 -1
  81. package/dist/dev/packages/ember-template-compiler/index.js +4 -4
  82. package/dist/dev/packages/router_js/index.js +3 -3
  83. package/dist/dev/packages/rsvp/index.js +2281 -1
  84. package/dist/dev/packages/shared-chunks/{alias-RGbDZoAB.js → alias-DpqL1qx6.js} +7 -7
  85. package/dist/dev/packages/shared-chunks/{api-BT9M3UaD.js → api-BlZDPg1n.js} +6 -6
  86. package/dist/dev/packages/shared-chunks/{element-builder-Cl1kHFJE.js → api-C0PAtEgQ.js} +139 -120
  87. package/dist/dev/packages/shared-chunks/{api-DG5kRT-o.js → api-DuLOZMO_.js} +3 -3
  88. package/dist/dev/packages/shared-chunks/{args-proxy-CB0SM6jC.js → args-proxy-CS5Brs3_.js} +2 -2
  89. package/dist/dev/packages/shared-chunks/{untouchable-this-BHdAERUu.js → arguments-CDkbOqTS.js} +236 -236
  90. package/dist/dev/packages/shared-chunks/{array-BMaSKezP.js → array-CVEnNWng.js} +3 -3
  91. package/dist/dev/packages/shared-chunks/{array-utils-BEaSKdEb.js → array-utils-CZQxrdD3.js} +1 -1
  92. package/dist/dev/packages/shared-chunks/{cache-CeWOBNQg.js → cache-DGDPVCpC.js} +2 -3
  93. package/dist/dev/packages/shared-chunks/{capabilities-CZkuOqqC.js → capabilities-CajW4QjE.js} +1 -1
  94. package/dist/dev/packages/shared-chunks/{chain-tags-DfmU63mS.js → chain-tags-uWSImHzB.js} +4 -4
  95. package/dist/dev/packages/shared-chunks/{collections-DEt-i-8B.js → collections-DPkjqeA3.js} +2 -2
  96. package/dist/dev/packages/shared-chunks/{compiler-DhH2WLpA.js → compiler-QUSl_urU.js} +3 -3
  97. package/dist/dev/packages/shared-chunks/{computed-Daavz6vC.js → computed-BPCtuOxQ.js} +6 -6
  98. package/dist/dev/packages/shared-chunks/{curly-YoYS2vXw.js → curly-DGUCLOud.js} +10 -11
  99. package/dist/dev/packages/shared-chunks/curly-brand-B_F79Dep.js +12 -0
  100. package/dist/dev/packages/shared-chunks/{curried-Cnjy9_ug.js → curried-BZnYakIg.js} +1 -1
  101. package/dist/dev/packages/shared-chunks/{decorator-DYQwMItS.js → decorator-B5Uh5NFI.js} +1 -1
  102. package/dist/dev/packages/shared-chunks/{element-bBwMD8cw.js → element-BYLB-q7a.js} +5 -3
  103. package/dist/dev/packages/shared-chunks/{events-B1lx9T1I.js → events-6aFVjD4k.js} +1 -1
  104. package/dist/{prod/packages/shared-chunks/flags-B9qxc-pB.js → dev/packages/shared-chunks/flags-BZxHQ0yn.js} +1 -1
  105. package/dist/dev/packages/shared-chunks/{get-CO3EIWsm.js → get-6I3sjd-I.js} +33 -36
  106. package/dist/{prod/packages/shared-chunks/get_properties-wj_Qmotj.js → dev/packages/shared-chunks/get_properties-Cm2sWt5f.js} +1 -1
  107. package/dist/dev/packages/shared-chunks/{guid-PO2v9BaN.js → guid-Cbq2sNV_.js} +1 -1
  108. package/dist/dev/packages/shared-chunks/{hash-2-93qikL.js → hash-6NDs_5_f.js} +18 -12
  109. package/dist/dev/packages/shared-chunks/helper-brand-C9_8vvOf.js +12 -0
  110. package/dist/dev/packages/shared-chunks/{index-DX90CU4L.js → index-BGP1rw3B.js} +1 -1
  111. package/dist/dev/packages/shared-chunks/{index-dyv6rcBf.js → index-CCyXUNBa.js} +655 -1633
  112. package/dist/dev/packages/shared-chunks/{index-DkwVSPP5.js → index-DaFzpTIE.js} +10 -9
  113. package/dist/dev/packages/shared-chunks/{injected_property-B075jH6c.js → injected_property-CbBLr5jt.js} +2 -2
  114. package/dist/dev/packages/shared-chunks/{internal-Bpr6ihB_.js → internal-DTOXyEGM.js} +4 -4
  115. package/dist/dev/packages/shared-chunks/{internal-helper-IC87S6iZ.js → internal-helper-CKrni0b_.js} +1 -1
  116. package/dist/dev/packages/shared-chunks/{invoke-Ds0KEfP_.js → invoke-d9sqa50M.js} +3 -3
  117. package/dist/dev/packages/shared-chunks/{libraries-P8Ins5CB.js → libraries-DwffpMGE.js} +1 -1
  118. package/dist/dev/packages/shared-chunks/{meta-Cjo3zQJq.js → meta-BqC7f9Ia.js} +1 -1
  119. package/dist/{prod/packages/shared-chunks/namespace_search-TFdmjK_a.js → dev/packages/shared-chunks/namespace_search-BfvzEQzN.js} +1 -1
  120. package/dist/dev/packages/shared-chunks/{normalize-CxG_iVLJ.js → normalize-CKySQVU7.js} +2 -2
  121. package/dist/dev/packages/shared-chunks/{or-Bg6rCMF8.js → not-DYh6AY9Z.js} +36 -36
  122. package/dist/dev/packages/shared-chunks/{observers-CejcZw5s.js → observers-DMlX2nCi.js} +5 -5
  123. package/dist/dev/packages/shared-chunks/{on-Ch_lyozr.js → on-DlF0Wy7P.js} +10 -10
  124. package/dist/dev/packages/shared-chunks/outlet-CHFL7tun.js +135 -0
  125. package/dist/dev/packages/shared-chunks/{present-D0EfKzC6.js → present-B1rrjAVM.js} +1 -1
  126. package/dist/{prod/packages/shared-chunks/program-CF651Zuj.js → dev/packages/shared-chunks/program-DlgjqLa6.js} +3 -3
  127. package/dist/dev/packages/shared-chunks/{program-context-BaYVr5GA.js → program-context-Dq8xN2HI.js} +5 -4
  128. package/dist/dev/packages/shared-chunks/{property_get-BjbsrgpU.js → property_get-CRP7MFz_.js} +3 -3
  129. package/dist/dev/packages/shared-chunks/{property_set-LJskl202.js → property_set-qCUylPEK.js} +3 -3
  130. package/dist/dev/packages/shared-chunks/{reference-C-OXd_kp.js → reference-BqOLhKFy.js} +3 -3
  131. package/dist/dev/packages/shared-chunks/{registers-Buvdhhxx.js → registers-C_W2qYHJ.js} +1 -1
  132. package/dist/dev/packages/shared-chunks/{rehydrate-builder-IH4d_JQy.js → rehydrate-builder-C6k1XhET.js} +4 -4
  133. package/dist/dev/packages/shared-chunks/{render-Dz3OWqXy.js → render-87_sKZ_k.js} +94 -94
  134. package/dist/dev/packages/shared-chunks/{rsvp-C6j8G1D1.js → rsvp.es-DR7yS7qg.js} +150 -154
  135. package/dist/dev/packages/shared-chunks/{serialize-builder-DKliZPPG.js → serialize-builder-BlxBjwO-.js} +2 -2
  136. package/dist/dev/packages/shared-chunks/{set_properties-CNds2HCH.js → set_properties-C4TSebH6.js} +2 -2
  137. package/dist/dev/packages/shared-chunks/setup-registry-BHdDJATP.js +951 -0
  138. package/dist/{prod/packages/shared-chunks/simple-cast-BXTrayoV.js → dev/packages/shared-chunks/simple-cast-DCvJLSin.js} +1 -1
  139. package/dist/{prod/packages/shared-chunks/super-D4qkU4uq.js → dev/packages/shared-chunks/super-BBBjgF69.js} +1 -1
  140. package/dist/{prod/packages/shared-chunks/syscall-ops-nrBHMOTp.js → dev/packages/shared-chunks/syscall-ops-CN7STuUn.js} +1 -1
  141. package/dist/dev/packages/shared-chunks/{template-B0Apv9g2.js → template-BRrQR6KS.js} +1 -1
  142. package/dist/dev/packages/shared-chunks/{template-only-BxYzSEnC.js → template-only-Cu639ICT.js} +2 -4
  143. package/dist/dev/packages/shared-chunks/{textarea-DHjEFpZu.js → textarea-C4lYkaHj.js} +12 -8
  144. package/dist/dev/packages/shared-chunks/{tracked-B76E1nGz.js → tracked-DEyf0T_X.js} +5 -5
  145. package/dist/dev/packages/shared-chunks/{tracked-data-CH1USZZy.js → tracked-data-DgqqRdYO.js} +2 -2
  146. package/dist/dev/packages/shared-chunks/{unique-id-Hd96VZlE.js → unique-id-DQOhouG1.js} +2 -2
  147. package/dist/dev/packages/shared-chunks/{unrecognized-url-error-BQdkjTtZ.js → unrecognized-url-error-B8loxkay.js} +3 -3
  148. package/dist/{prod/packages/shared-chunks/vm-ops-5QCUIRx4.js → dev/packages/shared-chunks/vm-ops-ImHv0Wtg.js} +1 -1
  149. package/dist/prod/packages/@ember/-internals/deprecations/index.js +10 -0
  150. package/dist/prod/packages/@ember/-internals/glimmer/index.js +11 -11
  151. package/dist/prod/packages/@ember/-internals/metal/index.js +18 -18
  152. package/dist/prod/packages/@ember/-internals/routing/index.js +3 -3
  153. package/dist/prod/packages/@ember/-internals/runtime/index.js +1 -1
  154. package/dist/prod/packages/@ember/-internals/runtime/lib/ext/rsvp.js +1 -1
  155. package/dist/prod/packages/@ember/-internals/runtime/lib/mixins/-proxy.js +8 -8
  156. package/dist/prod/packages/@ember/-internals/runtime/lib/mixins/action_handler.js +1 -1
  157. package/dist/prod/packages/@ember/-internals/runtime/lib/mixins/comparable.js +5 -0
  158. package/dist/prod/packages/@ember/-internals/runtime/lib/mixins/target_action_support.js +3 -3
  159. package/dist/prod/packages/@ember/-internals/utils/index.js +2 -2
  160. package/dist/prod/packages/@ember/-internals/views/lib/mixins/action_support.js +1 -1
  161. package/dist/prod/packages/@ember/-internals/views/lib/system/event_dispatcher.js +2 -2
  162. package/dist/prod/packages/@ember/-internals/views/lib/system/utils.js +1 -1
  163. package/dist/prod/packages/@ember/-internals/views/lib/views/core_view.js +1 -1
  164. package/dist/prod/packages/@ember/application/index.js +5 -6
  165. package/dist/prod/packages/@ember/application/instance.js +19 -4
  166. package/dist/prod/packages/@ember/application/namespace.js +3 -3
  167. package/dist/prod/packages/@ember/array/index.js +11 -58
  168. package/dist/prod/packages/@ember/array/lib/is-array.js +64 -0
  169. package/dist/prod/packages/@ember/array/proxy.js +8 -8
  170. package/dist/prod/packages/@ember/component/helper.js +305 -1
  171. package/dist/prod/packages/@ember/component/index.js +20 -14
  172. package/dist/prod/packages/@ember/component/template-only.js +1 -1
  173. package/dist/prod/packages/@ember/controller/index.js +3 -3
  174. package/dist/prod/packages/@ember/debug/data-adapter.js +3 -3
  175. package/dist/prod/packages/@ember/engine/index.js +5 -5
  176. package/dist/prod/packages/@ember/engine/instance.js +2 -2
  177. package/dist/prod/packages/@ember/helper/index.js +8 -27
  178. package/dist/prod/packages/@ember/modifier/index.js +2 -2
  179. package/dist/prod/packages/@ember/modifier/on.js +1 -1
  180. package/dist/prod/packages/@ember/object/-internals.js +2 -2
  181. package/dist/prod/packages/@ember/object/compat.js +3 -3
  182. package/dist/prod/packages/@ember/object/computed.js +2 -2
  183. package/dist/prod/packages/@ember/object/core.js +7 -7
  184. package/dist/prod/packages/@ember/object/evented.js +2 -2
  185. package/dist/prod/packages/@ember/object/events.js +1 -1
  186. package/dist/prod/packages/@ember/object/index.js +30 -25
  187. package/dist/prod/packages/@ember/object/internals.js +2 -2
  188. package/dist/prod/packages/@ember/object/lib/computed/computed_macros.js +4 -4
  189. package/dist/prod/packages/@ember/object/lib/computed/reduce_computed_macros.js +2 -2
  190. package/dist/prod/packages/@ember/object/mixin.js +6 -6
  191. package/dist/prod/packages/@ember/object/observable.js +7 -7
  192. package/dist/prod/packages/@ember/object/observers.js +1 -1
  193. package/dist/prod/packages/@ember/object/promise-proxy-mixin.js +3 -3
  194. package/dist/prod/packages/@ember/reactive/collections.js +153 -153
  195. package/dist/prod/packages/@ember/renderer/index.js +1 -1
  196. package/dist/prod/packages/@ember/routing/index.js +12 -8
  197. package/dist/prod/packages/@ember/routing/lib/generate_controller.js +1 -2
  198. package/dist/prod/packages/@ember/routing/lib/routing-service.js +4 -5
  199. package/dist/prod/packages/@ember/routing/lib/utils.js +3 -3
  200. package/dist/prod/packages/@ember/routing/route.js +12 -12
  201. package/dist/prod/packages/@ember/routing/router-service.js +24 -18
  202. package/dist/prod/packages/@ember/routing/router.js +5 -5
  203. package/dist/prod/packages/@ember/runloop/index.js +1 -1
  204. package/dist/prod/packages/@ember/service/index.js +1 -1
  205. package/dist/prod/packages/@ember/template-compiler/lib/compile-options.js +3 -3
  206. package/dist/prod/packages/@ember/template-compiler/lib/template.js +2 -2
  207. package/dist/prod/packages/@ember/template-factory/index.js +1 -1
  208. package/dist/prod/packages/@ember/utils/lib/compare.js +5 -2
  209. package/dist/prod/packages/@ember/utils/lib/is_empty.js +1 -1
  210. package/dist/prod/packages/@glimmer/encoder/index.js +1 -1
  211. package/dist/prod/packages/@glimmer/manager/index.js +4 -4
  212. package/dist/prod/packages/@glimmer/node/index.js +3 -3
  213. package/dist/prod/packages/@glimmer/opcode-compiler/index.js +2 -2
  214. package/dist/prod/packages/@glimmer/program/index.js +10 -10
  215. package/dist/prod/packages/@glimmer/reference/index.js +5 -5
  216. package/dist/prod/packages/@glimmer/runtime/index.js +13 -13
  217. package/dist/prod/packages/@glimmer/tracking/index.js +2 -2
  218. package/dist/prod/packages/@glimmer/tracking/primitives/cache/index.js +1 -1
  219. package/dist/prod/packages/@glimmer/util/index.js +4 -4
  220. package/dist/prod/packages/@glimmer/validator/index.js +3 -3
  221. package/dist/prod/packages/@glimmer/vm/index.js +2 -2
  222. package/dist/prod/packages/ember/version.js +1 -1
  223. package/dist/prod/packages/ember-template-compiler/index.js +4 -4
  224. package/dist/prod/packages/router_js/index.js +3 -3
  225. package/dist/prod/packages/rsvp/index.js +2281 -1
  226. package/dist/prod/packages/shared-chunks/{alias-DsIh-16z.js → alias-Bod6qdNp.js} +7 -7
  227. package/dist/prod/packages/shared-chunks/{api-CGZbGcvX.js → api-B_poQGXS.js} +6 -6
  228. package/dist/prod/packages/shared-chunks/{element-builder-CZePCkbA.js → api-CQexacBn.js} +139 -120
  229. package/dist/prod/packages/shared-chunks/{api-DOLN_cR2.js → api-DlJKfm_f.js} +3 -3
  230. package/dist/prod/packages/shared-chunks/{args-proxy-CaXVcI8G.js → args-proxy-CCoFtYLS.js} +2 -2
  231. package/dist/prod/packages/shared-chunks/{debug-render-tree-CYENUjgX.js → arguments-BzAkZVBa.js} +198 -198
  232. package/dist/prod/packages/shared-chunks/{array-DYFI95FA.js → array-BzReKMeW.js} +3 -3
  233. package/dist/prod/packages/shared-chunks/{array-utils-BEaSKdEb.js → array-utils-CZQxrdD3.js} +1 -1
  234. package/dist/prod/packages/shared-chunks/{cache-CG6_L9db.js → cache-CofLhaS4.js} +1 -2
  235. package/dist/prod/packages/shared-chunks/{capabilities-_5e35539.js → capabilities-BuVYh-vx.js} +1 -1
  236. package/dist/prod/packages/shared-chunks/{chain-tags-BP0V2LnZ.js → chain-tags-B2J7DsxO.js} +4 -4
  237. package/dist/prod/packages/shared-chunks/{collections-By4M3cTy.js → collections-GpG8lT2g.js} +10 -10
  238. package/dist/prod/packages/shared-chunks/{compiler-DQmEjFyx.js → compiler-lBSssiWp.js} +2 -2
  239. package/dist/prod/packages/shared-chunks/{computed-D6MVTTDd.js → computed-DtIStxvq.js} +6 -6
  240. package/dist/prod/packages/shared-chunks/{curly-DCYSwLtz.js → curly-a6DP7r87.js} +10 -11
  241. package/dist/prod/packages/shared-chunks/curly-brand-B_F79Dep.js +12 -0
  242. package/dist/prod/packages/shared-chunks/{curried-Cnjy9_ug.js → curried-BZnYakIg.js} +1 -1
  243. package/dist/prod/packages/shared-chunks/{decorator-B8Lpq40g.js → decorator-9ikVwsjY.js} +1 -1
  244. package/dist/prod/packages/shared-chunks/{element-CT5H5uxF.js → element-DgHdPZ8u.js} +5 -3
  245. package/dist/prod/packages/shared-chunks/{events-C7aYCy0N.js → events-DYrYz3V8.js} +1 -1
  246. package/dist/{dev/packages/shared-chunks/flags-B9qxc-pB.js → prod/packages/shared-chunks/flags-BZxHQ0yn.js} +1 -1
  247. package/dist/prod/packages/shared-chunks/{get-tlL23wmp.js → get-Dago5uGl.js} +33 -36
  248. package/dist/{dev/packages/shared-chunks/get_properties-B203vZpz.js → prod/packages/shared-chunks/get_properties-Dg3xFpiS.js} +1 -1
  249. package/dist/prod/packages/shared-chunks/{guid-PO2v9BaN.js → guid-Cbq2sNV_.js} +1 -1
  250. package/dist/prod/packages/shared-chunks/{hash-C6IoC4eR.js → hash-gEXIsSO4.js} +24 -18
  251. package/dist/prod/packages/shared-chunks/helper-brand-C9_8vvOf.js +12 -0
  252. package/dist/prod/packages/shared-chunks/{index-D-rcNBLp.js → index-Bf53M8eS.js} +9 -8
  253. package/dist/prod/packages/shared-chunks/{index-DabsnYit.js → index-npr2B-vu.js} +541 -1465
  254. package/dist/prod/packages/shared-chunks/{injected_property-COGiYHKc.js → injected_property-Y-FadDej.js} +2 -2
  255. package/dist/prod/packages/shared-chunks/{internal-BEJC2IJ-.js → internal-BQ7zHrqS.js} +4 -4
  256. package/dist/prod/packages/shared-chunks/{internal-helper-CoxiRnnb.js → internal-helper-Bz1lpDXr.js} +1 -1
  257. package/dist/prod/packages/shared-chunks/{invoke-D_jsLbsj.js → invoke-DhQ5QRp2.js} +3 -3
  258. package/dist/prod/packages/shared-chunks/{libraries-Bs3H8iwC.js → libraries-DBql0hdn.js} +2 -2
  259. package/dist/prod/packages/shared-chunks/{meta-Ce6-qROq.js → meta-BJtIZDir.js} +1 -1
  260. package/dist/{dev/packages/shared-chunks/namespace_search-TFdmjK_a.js → prod/packages/shared-chunks/namespace_search-BfvzEQzN.js} +1 -1
  261. package/dist/prod/packages/shared-chunks/{normalize-Bx4H3NjB.js → normalize-C_IStty9.js} +2 -2
  262. package/dist/prod/packages/shared-chunks/{or-sYlRiUn_.js → not-BOIVROuv.js} +28 -28
  263. package/dist/prod/packages/shared-chunks/{observers-Ci31SE36.js → observers-BmobpXAF.js} +5 -5
  264. package/dist/prod/packages/shared-chunks/{on-Dgmychhk.js → on-BZHAxzdq.js} +10 -10
  265. package/dist/prod/packages/shared-chunks/outlet--lIm3q7t.js +132 -0
  266. package/dist/{dev/packages/shared-chunks/program-CPXeXWVB.js → prod/packages/shared-chunks/program-BAh__OXZ.js} +3 -3
  267. package/dist/prod/packages/shared-chunks/{program-context-DmI53TzJ.js → program-context-COSioH46.js} +5 -4
  268. package/dist/prod/packages/shared-chunks/{property_get-Sw0SicEZ.js → property_get-DAKgbeJX.js} +2 -2
  269. package/dist/prod/packages/shared-chunks/{property_set-SHEIPMUG.js → property_set-BaQJdVfS.js} +3 -3
  270. package/dist/prod/packages/shared-chunks/{reference-D2agTt1V.js → reference-CG0yPgLy.js} +3 -3
  271. package/dist/prod/packages/shared-chunks/{registers-Buvdhhxx.js → registers-C_W2qYHJ.js} +1 -1
  272. package/dist/prod/packages/shared-chunks/{rehydrate-builder-B7MtrWip.js → rehydrate-builder-Blt1x9MP.js} +4 -4
  273. package/dist/prod/packages/shared-chunks/{render-B790-vbk.js → render-Dx7lr1hR.js} +94 -94
  274. package/dist/prod/packages/shared-chunks/{rsvp-C6j8G1D1.js → rsvp.es-DR7yS7qg.js} +150 -154
  275. package/dist/prod/packages/shared-chunks/{serialize-builder-kEyOKbzp.js → serialize-builder-BvAXYHTr.js} +2 -2
  276. package/dist/prod/packages/shared-chunks/{set_properties-CcLLHg1w.js → set_properties-Qxhw4qzw.js} +2 -2
  277. package/dist/prod/packages/shared-chunks/setup-registry-Dfu8EyLU.js +886 -0
  278. package/dist/{dev/packages/shared-chunks/simple-cast-BXTrayoV.js → prod/packages/shared-chunks/simple-cast-DCvJLSin.js} +1 -1
  279. package/dist/{dev/packages/shared-chunks/super-D4qkU4uq.js → prod/packages/shared-chunks/super-BBBjgF69.js} +1 -1
  280. package/dist/{dev/packages/shared-chunks/syscall-ops-nrBHMOTp.js → prod/packages/shared-chunks/syscall-ops-CN7STuUn.js} +1 -1
  281. package/dist/prod/packages/shared-chunks/{template-B0Apv9g2.js → template-BRrQR6KS.js} +1 -1
  282. package/dist/prod/packages/shared-chunks/{template-only-CP0NT7ce.js → template-only-DKNcKM5b.js} +2 -4
  283. package/dist/prod/packages/shared-chunks/{textarea-B_JYBuE8.js → textarea-DOmZ1x0E.js} +11 -7
  284. package/dist/prod/packages/shared-chunks/{tracked-CXcapuAm.js → tracked-B9380JtC.js} +5 -5
  285. package/dist/prod/packages/shared-chunks/{tracked-data-DNDzhYXf.js → tracked-data-CHq42QHb.js} +2 -2
  286. package/dist/prod/packages/shared-chunks/{unique-id-Hn8Qp4dS.js → unique-id-o2pS74go.js} +2 -2
  287. package/dist/prod/packages/shared-chunks/{unrecognized-url-error-ClNyMFJt.js → unrecognized-url-error-jjQ-FqKB.js} +3 -3
  288. package/dist/{dev/packages/shared-chunks/vm-ops-5QCUIRx4.js → prod/packages/shared-chunks/vm-ops-ImHv0Wtg.js} +1 -1
  289. package/docs/data.json +616 -569
  290. package/package.json +8 -6
  291. package/types/stable/@ember/-internals/deprecations/index.d.ts +6 -0
  292. package/types/stable/@ember/-internals/glimmer/index.d.ts +165 -121
  293. package/types/stable/@ember/-internals/glimmer/lib/base-renderer.d.ts +150 -0
  294. package/types/stable/@ember/-internals/glimmer/lib/component-managers/curly-brand.d.ts +10 -0
  295. package/types/stable/@ember/-internals/glimmer/lib/component-managers/curly.d.ts +3 -2
  296. package/types/stable/@ember/-internals/glimmer/lib/component-managers/mount.d.ts +1 -1
  297. package/types/stable/@ember/-internals/glimmer/lib/component-managers/outlet.d.ts +1 -1
  298. package/types/stable/@ember/-internals/glimmer/lib/component.d.ts +8 -2
  299. package/types/stable/@ember/-internals/glimmer/lib/glimmer-tracking-docs.d.ts +12 -12
  300. package/types/stable/@ember/-internals/glimmer/lib/helper-brand.d.ts +10 -0
  301. package/types/stable/@ember/-internals/glimmer/lib/helper.d.ts +20 -10
  302. package/types/stable/@ember/-internals/glimmer/lib/helpers/array.d.ts +3 -1
  303. package/types/stable/@ember/-internals/glimmer/lib/helpers/component.d.ts +65 -121
  304. package/types/stable/@ember/-internals/glimmer/lib/helpers/concat.d.ts +8 -4
  305. package/types/stable/@ember/-internals/glimmer/lib/helpers/each-in.d.ts +16 -14
  306. package/types/stable/@ember/-internals/glimmer/lib/helpers/element.d.ts +2 -0
  307. package/types/stable/@ember/-internals/glimmer/lib/helpers/fn.d.ts +11 -7
  308. package/types/stable/@ember/-internals/glimmer/lib/helpers/get.d.ts +23 -29
  309. package/types/stable/@ember/-internals/glimmer/lib/helpers/hash.d.ts +3 -1
  310. package/types/stable/@ember/-internals/glimmer/lib/helpers/if-unless.d.ts +95 -49
  311. package/types/stable/@ember/-internals/glimmer/lib/helpers/mut.d.ts +23 -54
  312. package/types/stable/@ember/-internals/glimmer/lib/helpers/page-title.d.ts +6 -2
  313. package/types/stable/@ember/-internals/glimmer/lib/helpers/readonly.d.ts +4 -8
  314. package/types/stable/@ember/-internals/glimmer/lib/modifiers/on.d.ts +10 -10
  315. package/types/stable/@ember/-internals/glimmer/lib/renderer.d.ts +7 -155
  316. package/types/stable/@ember/-internals/glimmer/lib/router-resolver.d.ts +17 -0
  317. package/types/stable/@ember/-internals/glimmer/lib/syntax/in-element.d.ts +2 -0
  318. package/types/stable/@ember/-internals/glimmer/lib/syntax/let.d.ts +2 -14
  319. package/types/stable/@ember/-internals/glimmer/lib/syntax/mount.d.ts +15 -11
  320. package/types/stable/@ember/-internals/glimmer/lib/syntax/outlet.d.ts +17 -10
  321. package/types/stable/@ember/-internals/runtime/lib/mixins/target_action_support.d.ts +1 -1
  322. package/types/stable/@ember/array/index.d.ts +6 -29
  323. package/types/stable/@ember/array/lib/is-array.d.ts +35 -0
  324. package/types/stable/@ember/component/template-only.d.ts +1 -3
  325. package/types/stable/@ember/controller/index.d.ts +1 -1
  326. package/types/stable/@ember/helper/index.d.ts +0 -19
  327. package/types/stable/@ember/object/index.d.ts +4 -3
  328. package/types/stable/@ember/object/observable.d.ts +4 -0
  329. package/types/stable/@ember/reactive/collections.d.ts +0 -6
  330. package/types/stable/@ember/renderer/index.d.ts +2 -2
  331. package/types/stable/@ember/routing/lib/generate_controller.d.ts +1 -1
  332. package/types/stable/@ember/routing/route.d.ts +2 -2
  333. package/types/stable/@ember/routing/router-service.d.ts +20 -12
  334. package/types/stable/@glimmer/runtime/lib/component/template-only.d.ts +0 -2
  335. package/types/stable/@glimmer/runtime/lib/dom/sanitized-values.d.ts +2 -2
  336. package/types/stable/@glimmer/runtime/lib/helpers/array.d.ts +1 -1
  337. package/types/stable/@glimmer/runtime/lib/helpers/concat.d.ts +8 -3
  338. package/types/stable/@glimmer/runtime/lib/helpers/fn.d.ts +13 -7
  339. package/types/stable/@glimmer/runtime/lib/helpers/get.d.ts +21 -29
  340. package/types/stable/@glimmer/runtime/lib/helpers/hash.d.ts +1 -1
  341. package/types/stable/@glimmer/syntax/lib/get-template-locals.d.ts +1 -1
  342. package/types/stable/@glimmer/tracking/index.d.ts +12 -12
  343. package/types/stable/index.d.ts +590 -585
  344. package/dist/dev/packages/shared-chunks/helper-Bm6EhgSW.js +0 -314
  345. package/dist/dev/packages/shared-chunks/setup-registry-C_YovxNX.js +0 -77
  346. package/dist/prod/packages/shared-chunks/helper-CCK8Ef0x.js +0 -298
  347. package/dist/prod/packages/shared-chunks/setup-registry-D14I0iDX.js +0 -74
@@ -1,245 +1,132 @@
1
- import { privatize } from '../@ember/-internals/container/index.js';
2
1
  import { E as ENV } from './env-DXxsTFkM.js';
3
- import { isFactory, getOwner } from '../@ember/-internals/owner/index.js';
4
- import { a as guidFor } from './guid-PO2v9BaN.js';
5
- import { getViewId, getViewElement } from '../@ember/-internals/views/lib/system/utils.js';
6
2
  import { h as hasDOM } from './has-dom-DdQORPzI.js';
7
3
  import { assert } from '../@ember/debug/lib/assert.js';
8
4
  import { schedule, _backburner, _getCurrentRunLoop } from '../@ember/runloop/index.js';
9
- import { associateDestroyableChild, isDestroyed, destroy, registerDestructor, isDestroying } from '../@glimmer/destroyable/index.js';
5
+ import { associateDestroyableChild, destroy, registerDestructor, isDestroyed, isDestroying } from '../@glimmer/destroyable/index.js';
10
6
  import { artifacts } from '../@glimmer/program/index.js';
11
- import { R as RuntimeOpImpl } from './program-CF651Zuj.js';
12
- import { v as valueForRef, U as UNDEFINED_REFERENCE, b as createComputeRef, d as createConstRef, f as createInvokableRef, h as createReadOnlyRef, i as createUnboundRef, a as childRefFromParts, u as updateRef } from './reference-D2agTt1V.js';
13
- import { e as clientBuilder } from './element-builder-CZePCkbA.js';
14
- import { E as EMPTY_ARGS, f as createCapturedArgs, c as EMPTY_POSITIONAL, g as curry } from './debug-render-tree-CYENUjgX.js';
15
- import { g as runtimeOptions, i as inTransaction, r as renderComponent$1, d as renderMain } from './render-B790-vbk.js';
16
- import { d as dict } from './collections-By4M3cTy.js';
17
- import { u as unwrapTemplate, b as CurlyComponentManager, i as initialRenderInstrumentDetails, a as ComponentStateBucket, D as DIRTY_TAG, c as isCurlyManager, B as BOUNDS } from './curly-DCYSwLtz.js';
18
- import { b as CONSTANT_TAG, k as consumeTag, t as isTracking, D as DIRTY_TAG$1, m as createTag, y as valueForTag, c as CURRENT_TAG, x as validateTag } from './cache-CG6_L9db.js';
19
- import { a as RSVP } from './rsvp-C6j8G1D1.js';
20
- import '../@ember/engine/instance.js';
21
- import { _instrumentStart } from '../@ember/instrumentation/index.js';
22
- import { c as capabilityFlagsFrom } from './capabilities-_5e35539.js';
23
- import { h as templateFactory } from './index-D-rcNBLp.js';
24
- import { g as getFactoryFor } from './container-BYOnjnwz.js';
25
- import { g as get, a as _getProp } from './property_get-Sw0SicEZ.js';
26
- import { _ as _setProp, s as set } from './property_set-SHEIPMUG.js';
7
+ import { R as RuntimeOpImpl } from './program-BAh__OXZ.js';
8
+ import { c as clientBuilder } from './api-CQexacBn.js';
9
+ import { g as runtimeOptions, i as inTransaction, r as renderComponent$1 } from './render-Dx7lr1hR.js';
10
+ import { c as consumeTag, f as isTracking, a as valueForTag, k as CURRENT_TAG, v as validateTag } from './cache-CofLhaS4.js';
11
+ import { g as get$1, a as _getProp } from './property_get-DAKgbeJX.js';
12
+ import { _ as _setProp, s as set } from './property_set-BaQJdVfS.js';
13
+ import './guid-Cbq2sNV_.js';
27
14
  import setGlobalContext from '../@glimmer/global-context/index.js';
28
- import { t as tagForObject, o as objectAt, b as tagForProperty } from './chain-tags-BP0V2LnZ.js';
15
+ import { a as tagForProperty, t as tagForObject, o as objectAt } from './chain-tags-B2J7DsxO.js';
29
16
  import { isEmberArray } from '../@ember/array/-internals.js';
30
17
  import { i as isObject } from './spec-BXl1reqK.js';
31
- import { t as tagFor } from './meta-Ce6-qROq.js';
18
+ import { t as tagFor } from './meta-BJtIZDir.js';
32
19
  import { contentFor } from '../@ember/-internals/runtime/lib/mixins/-proxy.js';
33
20
  import { i as isProxy } from './is_proxy-Bzg0d4m4.js';
34
- import { i as internalHelper } from './internal-helper-CoxiRnnb.js';
21
+ import { v as valueForRef, c as createComputeRef, a as createConstRef, h as createInvokableRef, j as createReadOnlyRef, k as createUnboundRef } from './reference-CG0yPgLy.js';
22
+ import { i as internalHelper } from './internal-helper-Bz1lpDXr.js';
35
23
  import { i as isHTMLSafe } from './index-D-xTBV4B.js';
36
- import { isArray } from '../@ember/array/index.js';
24
+ import isArray from '../@ember/array/lib/is-array.js';
25
+ import { isFactory } from '../@ember/-internals/owner/index.js';
26
+ import { _instrumentStart } from '../@ember/instrumentation/index.js';
37
27
  import { g as getComponentTemplate } from './template-Dc_cBOoX.js';
38
- import { c as hasInternalComponentManager, j as setInternalHelperManager, g as getInternalComponentManager } from './api-DOLN_cR2.js';
39
- import { h as hash, f as fn, a as array } from './hash-C6IoC4eR.js';
40
- import { g as get$1, c as concat } from './get-tlL23wmp.js';
41
- import { o as on } from './on-Dgmychhk.js';
42
- import { T as TEMPLATE_ONLY_COMPONENT_MANAGER, t as templateOnlyComponent } from './template-only-CP0NT7ce.js';
43
- import { i as isClassicHelper, C as CLASSIC_HELPER_MANAGER } from './helper-CCK8Ef0x.js';
28
+ import { a as getInternalHelperManager, j as setInternalHelperManager, g as getInternalComponentManager } from './api-DlJKfm_f.js';
29
+ import { h as hash, f as fn, a as array } from './hash-gEXIsSO4.js';
30
+ import { g as get, c as concat } from './get-Dago5uGl.js';
31
+ import { o as on } from './on-BZHAxzdq.js';
32
+ import { T as TEMPLATE_ONLY_COMPONENT_MANAGER, t as templateOnlyComponent } from './template-only-DKNcKM5b.js';
33
+ import { i as isCurlyManager } from './curly-brand-B_F79Dep.js';
34
+ import { i as isClassicHelper } from './helper-brand-C9_8vvOf.js';
44
35
  import { dasherize } from '../@ember/-internals/string/index.js';
45
- import { a as uniqueId } from './unique-id-Hn8Qp4dS.js';
46
- import '../route-recognizer/index.js';
47
- import './unrecognized-url-error-ClNyMFJt.js';
48
- import '../@ember/routing/lib/routing-service.js';
49
- import { generateControllerFactory } from '../@ember/routing/lib/generate_controller.js';
50
- import { E as EvaluationContextImpl } from './program-context-DmI53TzJ.js';
51
-
52
- function instrumentationPayload$1(def) {
53
- // "main" used to be the outlet name, keeping it around for compatibility
54
- return {
55
- object: `${def.name}:main`
36
+ import { a as uniqueId } from './unique-id-o2pS74go.js';
37
+ import { E as EvaluationContextImpl } from './program-context-COSioH46.js';
38
+
39
+ /**
40
+ @module ember
41
+ */
42
+ const disallowDynamicResolution = internalHelper(({
43
+ positional,
44
+ named
45
+ }) => {
46
+ const nameOrValueRef = positional[0];
47
+ let typeRef = named['type'];
48
+ let locRef = named['loc'];
49
+ let originalRef = named['original'];
50
+ // assert('[BUG] expecting a string literal for the `type` argument', isConstRef(typeRef));
51
+ // assert('[BUG] expecting a string literal for the `loc` argument', isConstRef(locRef));
52
+ // assert('[BUG] expecting a string literal for the `original` argument', isConstRef(originalRef));
53
+ valueForRef(typeRef);
54
+ valueForRef(locRef);
55
+ valueForRef(originalRef);
56
+ return createComputeRef(() => {
57
+ let nameOrValue = valueForRef(nameOrValueRef);
58
+ return nameOrValue;
59
+ });
60
+ });
61
+
62
+ let helper;
63
+ {
64
+ helper = args => {
65
+ let arg = args.positional[0];
66
+ return arg;
56
67
  };
57
68
  }
58
- const CAPABILITIES$2 = {
59
- dynamicLayout: false,
60
- dynamicTag: false,
61
- prepareArgs: false,
62
- createArgs: false,
63
- attributeHook: false,
64
- elementHook: false,
65
- createCaller: false,
66
- dynamicScope: true,
67
- updateHook: false,
68
- createInstance: true,
69
- wrapped: false,
70
- willDestroy: false,
71
- hasSubOwner: false
72
- };
73
- const CAPABILITIES_MASK$1 = capabilityFlagsFrom(CAPABILITIES$2);
74
- class OutletComponentManager {
75
- create(_owner, definition, _args, env, dynamicScope) {
76
- let parentStateRef = dynamicScope.get('outletState');
77
- let currentStateRef = definition.ref;
78
-
79
- // This is the actual primary responsibility of the outlet component –
80
- // it represents the switching from one route component/template into
81
- // the next. The rest only exists to support the debug render tree and
82
- // the old-school (and unreliable) instrumentation.
83
- dynamicScope.set('outletState', currentStateRef);
84
- let state = {
85
- finalize: _instrumentStart('render.outlet', instrumentationPayload$1, definition)
86
- };
87
- if (env.debugRenderTree !== undefined) {
88
- let parentState = valueForRef(parentStateRef);
89
- let parentOwner = parentState?.render?.owner;
90
- let currentState = valueForRef(currentStateRef);
91
- let currentOwner = currentState?.render?.owner;
92
- if (parentOwner && parentOwner !== currentOwner) {
93
- let {
94
- mountPoint
95
- } = currentOwner;
96
- if (mountPoint) {
97
- state.engine = {
98
- mountPoint,
99
- instance: currentOwner
100
- };
101
- }
102
- }
103
- }
104
- return state;
105
- }
106
- getDebugName({
107
- name
108
- }) {
109
- return `{{outlet}} for ${name}`;
110
- }
111
- getDebugCustomRenderTree(_definition, state) {
112
- let nodes = [];
113
- nodes.push({
114
- bucket: state,
115
- type: 'outlet',
116
- // "main" used to be the outlet name, keeping it around for compatibility
117
- name: 'main',
118
- args: EMPTY_ARGS,
119
- instance: undefined
120
- });
121
- if (state.engine) {
122
- nodes.push({
123
- bucket: state.engine,
124
- type: 'engine',
125
- name: state.engine.mountPoint,
126
- args: EMPTY_ARGS,
127
- instance: state.engine.instance
128
- });
69
+ const inElementNullCheckHelper = internalHelper(helper);
70
+
71
+ const normalizeClassHelper = internalHelper(({
72
+ positional
73
+ }) => {
74
+ return createComputeRef(() => {
75
+ let classNameArg = positional[0];
76
+ let valueArg = positional[1];
77
+ let classNameParts = valueForRef(classNameArg).split('.');
78
+ let className = classNameParts[classNameParts.length - 1];
79
+ let value = valueForRef(valueArg);
80
+ if (value === true) {
81
+ return dasherize(className);
82
+ } else if (!value && value !== 0) {
83
+ return '';
84
+ } else {
85
+ return String(value);
129
86
  }
130
- return nodes;
131
- }
132
- getCapabilities() {
133
- return CAPABILITIES$2;
134
- }
135
- getSelf() {
136
- return UNDEFINED_REFERENCE;
137
- }
138
- didCreate() {}
139
- didUpdate() {}
140
- didRenderLayout(state) {
141
- state.finalize();
142
- }
143
- didUpdateLayout() {}
144
- getDestroyable() {
145
- return null;
146
- }
147
- }
148
- const OUTLET_MANAGER = new OutletComponentManager();
149
- const OUTLET_COMPONENT_TEMPLATE = templateFactory(
150
- /*
151
- <@Component @controller={{@controller}} @model={{@model}} />
87
+ });
88
+ });
89
+
90
+ /**
91
+ @module ember
152
92
  */
153
- {
154
- "id": null,
155
- "block": "[[[8,[30,1],null,[[\"@controller\",\"@model\"],[[30,2],[30,3]]],null]],[\"@Component\",\"@controller\",\"@model\"],[]]",
156
- "moduleName": "(unknown template module)",
157
- "isStrictMode": true
93
+
94
+ const resolve = internalHelper(({
95
+ positional
96
+ }, owner) => {
97
+ let fullNameRef = positional[0];
98
+ let fullName = valueForRef(fullNameRef);
99
+ return createConstRef(owner.factoryFor(fullName)?.class);
158
100
  });
159
- class OutletComponent {
160
- // handle is not used by this custom definition
161
- handle = -1;
162
- resolvedName = null;
163
- manager = OUTLET_MANAGER;
164
- capabilities = CAPABILITIES_MASK$1;
165
- compilable;
166
- constructor(owner, state) {
167
- this.state = state;
168
- this.compilable = unwrapTemplate(OUTLET_COMPONENT_TEMPLATE(owner)).asLayout();
169
- }
170
- }
171
- function createRootOutlet(outletView) {
172
- return new OutletComponent(outletView.owner, outletView.state);
173
- }
174
101
 
175
- class RootComponentManager extends CurlyComponentManager {
176
- component;
177
- constructor(component) {
178
- super();
179
- this.component = component;
180
- }
181
- create(_owner, _state, _args, {
182
- isInteractive
183
- }, dynamicScope) {
184
- let component = this.component;
185
- let finalizer = _instrumentStart('render.component', initialRenderInstrumentDetails, component);
186
- dynamicScope.view = component;
187
- let hasWrappedElement = component.tagName !== '';
188
-
189
- // We usually do this in the `didCreateElement`, but that hook doesn't fire for tagless components
190
- if (!hasWrappedElement) {
191
- if (isInteractive) {
192
- component.trigger('willRender');
193
- }
194
- component._transitionTo('hasElement');
195
- if (isInteractive) {
196
- component.trigger('willInsertElement');
197
- }
198
- }
199
- let bucket = new ComponentStateBucket(component, null, CONSTANT_TAG, finalizer, hasWrappedElement, isInteractive);
200
- consumeTag(component[DIRTY_TAG]);
201
- return bucket;
202
- }
203
- }
102
+ /**
103
+ @module ember
104
+ */
204
105
 
205
- // ROOT is the top-level template it has nothing but one yield.
206
- // it is supposed to have a dummy element
207
- const ROOT_CAPABILITIES = {
208
- dynamicLayout: true,
209
- dynamicTag: true,
210
- prepareArgs: false,
211
- createArgs: false,
212
- attributeHook: true,
213
- elementHook: true,
214
- createCaller: true,
215
- dynamicScope: true,
216
- updateHook: true,
217
- createInstance: true,
218
- wrapped: true,
219
- willDestroy: false,
220
- hasSubOwner: false
221
- };
222
- class RootComponentDefinition {
223
- // handle is not used by this custom definition
224
- handle = -1;
225
- resolvedName = '-top-level';
226
- state;
227
- manager;
228
- capabilities = capabilityFlagsFrom(ROOT_CAPABILITIES);
229
- compilable = null;
230
- constructor(component) {
231
- this.manager = new RootComponentManager(component);
232
- let factory = getFactoryFor(component);
233
- this.state = factory;
234
- }
235
- }
106
+ /**
107
+ This reference is used to get the `[]` tag of iterables, so we can trigger
108
+ updates to `{{each}}` when it changes. It is put into place by a template
109
+ transform at build time, similar to the (-each-in) helper
110
+ */
111
+ const trackArray = internalHelper(({
112
+ positional
113
+ }) => {
114
+ const inner = positional[0];
115
+ return createComputeRef(() => {
116
+ let iterable = valueForRef(inner);
117
+ if (isObject(iterable)) {
118
+ consumeTag(tagForProperty(iterable, '[]'));
119
+ }
120
+ return iterable;
121
+ });
122
+ });
236
123
 
237
124
  /**
238
125
  @module ember
239
126
  */
240
127
 
241
128
  /**
242
- The `{{#each}}` helper loops over elements in a collection. It is an extension
129
+ The `{{#each}}` keyword loops over elements in a collection. It is an extension
243
130
  of the base Handlebars `{{#each}}` helper.
244
131
 
245
132
  The default behavior of `{{#each}}` is to yield its inner block once for every
@@ -283,6 +170,8 @@ class RootComponentDefinition {
283
170
  {{/each}}
284
171
  </ul>
285
172
  ```
173
+
174
+ `#each` is a keyword and does not need to be imported.
286
175
 
287
176
  ### Specifying Keys
288
177
 
@@ -350,11 +239,11 @@ class RootComponentDefinition {
350
239
  */
351
240
 
352
241
  /**
353
- The `{{each-in}}` helper loops over properties on an object.
242
+ The `{{#each-in}}` keyword loops over properties on an object.
354
243
 
355
244
  For example, given this component definition:
356
245
 
357
- ```app/components/developer-details.js
246
+ ```app/components/developer-details.gjs
358
247
  import Component from '@glimmer/component';
359
248
  import { tracked } from '@glimmer/tracking';
360
249
 
@@ -363,21 +252,19 @@ class RootComponentDefinition {
363
252
  "name": "Shelly Sails",
364
253
  "age": 42
365
254
  };
255
+
256
+ <template>
257
+ <ul>
258
+ {{#each-in this.developer as |key value|}}
259
+ <li>{{key}}: {{value}}</li>
260
+ {{/each-in}}
261
+ </ul>
262
+ </template>
366
263
  }
367
264
  ```
368
265
 
369
266
  This template would display all properties on the `developer`
370
- object in a list:
371
-
372
- ```app/components/developer-details.hbs
373
- <ul>
374
- {{#each-in this.developer as |key value|}}
375
- <li>{{key}}: {{value}}</li>
376
- {{/each-in}}
377
- </ul>
378
- ```
379
-
380
- Outputting their name and age:
267
+ object in a list, outputting their name and age:
381
268
 
382
269
  ```html
383
270
  <ul>
@@ -385,6 +272,8 @@ class RootComponentDefinition {
385
272
  <li>age: 42</li>
386
273
  </ul>
387
274
  ```
275
+
276
+ `#each-in` is a keyword and does not need to be imported.
388
277
 
389
278
  @method each-in
390
279
  @for Ember.Templates.helpers
@@ -412,437 +301,47 @@ const eachIn = internalHelper(({
412
301
  });
413
302
  });
414
303
 
415
- function toIterator(iterable) {
416
- if (iterable instanceof EachInWrapper) {
417
- return toEachInIterator(iterable.inner);
418
- } else {
419
- return toEachIterator(iterable);
420
- }
421
- }
422
- function toEachInIterator(iterable) {
423
- if (!isIndexable(iterable)) {
424
- return null;
425
- }
426
- if (Array.isArray(iterable) || isEmberArray(iterable)) {
427
- return ObjectIterator.fromIndexable(iterable);
428
- } else if (isNativeIterable(iterable)) {
429
- return MapLikeNativeIterator.from(iterable);
430
- } else if (hasForEach(iterable)) {
431
- return ObjectIterator.fromForEachable(iterable);
432
- } else {
433
- return ObjectIterator.fromIndexable(iterable);
434
- }
435
- }
436
- function toEachIterator(iterable) {
437
- if (!isObject(iterable)) {
438
- return null;
439
- }
440
- if (Array.isArray(iterable)) {
441
- return ArrayIterator.from(iterable);
442
- } else if (isEmberArray(iterable)) {
443
- return EmberArrayIterator.from(iterable);
444
- } else if (isNativeIterable(iterable)) {
445
- return ArrayLikeNativeIterator.from(iterable);
446
- } else if (hasForEach(iterable)) {
447
- return ArrayIterator.fromForEachable(iterable);
448
- } else {
449
- return null;
450
- }
451
- }
452
- class BoundedIterator {
453
- position = 0;
454
- constructor(length) {
455
- this.length = length;
456
- }
457
- isEmpty() {
458
- return false;
459
- }
460
- memoFor(position) {
461
- return position;
462
- }
463
- next() {
464
- let {
465
- length,
466
- position
467
- } = this;
468
- if (position >= length) {
469
- return null;
470
- }
471
- let value = this.valueFor(position);
472
- let memo = this.memoFor(position);
473
- this.position++;
474
- return {
475
- value,
476
- memo
477
- };
478
- }
479
- }
480
- class ArrayIterator extends BoundedIterator {
481
- static from(iterable) {
482
- return iterable.length > 0 ? new this(iterable) : null;
483
- }
484
- static fromForEachable(object) {
485
- let array = [];
486
- object.forEach(item => array.push(item));
487
- return this.from(array);
488
- }
489
- constructor(array) {
490
- super(array.length);
491
- this.array = array;
492
- }
493
- valueFor(position) {
494
- return this.array[position];
495
- }
496
- }
497
- class EmberArrayIterator extends BoundedIterator {
498
- static from(iterable) {
499
- return iterable.length > 0 ? new this(iterable) : null;
500
- }
501
- constructor(array) {
502
- super(array.length);
503
- this.array = array;
504
- }
505
- valueFor(position) {
506
- return objectAt(this.array, position);
507
- }
508
- }
509
- class ObjectIterator extends BoundedIterator {
510
- static fromIndexable(obj) {
511
- let keys = Object.keys(obj);
512
- if (keys.length === 0) {
513
- return null;
514
- } else {
515
- let values = [];
516
- for (let key of keys) {
517
- let value;
518
- value = obj[key];
304
+ /**
305
+ @module ember
306
+ */
519
307
 
520
- // Add the tag of the returned value if it is an array, since arrays
521
- // should always cause updates if they are consumed and then changed
522
- if (isTracking()) {
523
- consumeTag(tagFor(obj, key));
524
- if (Array.isArray(value)) {
525
- consumeTag(tagFor(value, '[]'));
526
- }
527
- }
528
- values.push(value);
529
- }
530
- return new this(keys, values);
308
+ /**
309
+ The `mut` helper is a shortcut for updating for args.
310
+
311
+ However, defining update functions on your backing class is preferable to using `mut`.
312
+
313
+ More directly: Don't use `mut`.
314
+
315
+ The `mut` helper, when used with `fn`, will return a function that
316
+ sets the value passed to `mut` to its first argument. As an example, we can create a
317
+ button that increments a value passing the value directly to the `fn`:
318
+
319
+ ```handlebars
320
+ <MyChild @childClickCount={{this.totalClicks}} @clickCountChange={{fn (mut this.totalClicks)}} />
321
+ ```
322
+
323
+ The child `Component` would invoke the function with the new click count:
324
+
325
+ ```app/components/my-child.gjs
326
+ import Component from '@glimmer/component';
327
+ import { action } from '@ember/object';
328
+
329
+ export default class MyChild extends Component {
330
+ @action
331
+ update() {
332
+ this.args.clickCountChange(this.args.childClickCount + 1);
531
333
  }
334
+
335
+ <template>
336
+ <button {{on "click" this.update}}>
337
+ Click me!
338
+ </button>
339
+ </template>
532
340
  }
533
- static fromForEachable(obj) {
534
- let keys = [];
535
- let values = [];
536
- let length = 0;
537
- let isMapLike = false;
538
-
539
- // Not using an arrow function here so we can get an accurate `arguments`
540
- obj.forEach(function (value, key) {
541
- isMapLike = isMapLike || arguments.length >= 2;
542
- if (isMapLike) {
543
- keys.push(key);
544
- }
545
- values.push(value);
546
- length++;
547
- });
548
- if (length === 0) {
549
- return null;
550
- } else if (isMapLike) {
551
- return new this(keys, values);
552
- } else {
553
- return new ArrayIterator(values);
554
- }
555
- }
556
- constructor(keys, values) {
557
- super(values.length);
558
- this.keys = keys;
559
- this.values = values;
560
- }
561
- valueFor(position) {
562
- return this.values[position];
563
- }
564
- memoFor(position) {
565
- return this.keys[position];
566
- }
567
- }
568
- class NativeIterator {
569
- static from(iterable) {
570
- let iterator = iterable[Symbol.iterator]();
571
- let result = iterator.next();
572
- let {
573
- done
574
- } = result;
575
- if (done) {
576
- return null;
577
- } else {
578
- return new this(iterator, result);
579
- }
580
- }
581
- position = 0;
582
- constructor(iterable, result) {
583
- this.iterable = iterable;
584
- this.result = result;
585
- }
586
- isEmpty() {
587
- return false;
588
- }
589
- next() {
590
- let {
591
- iterable,
592
- result,
593
- position
594
- } = this;
595
- if (result.done) {
596
- return null;
597
- }
598
- let value = this.valueFor(result, position);
599
- let memo = this.memoFor(result, position);
600
- this.position++;
601
- this.result = iterable.next();
602
- return {
603
- value,
604
- memo
605
- };
606
- }
607
- }
608
- class ArrayLikeNativeIterator extends NativeIterator {
609
- valueFor(result) {
610
- return result.value;
611
- }
612
- memoFor(_result, position) {
613
- return position;
614
- }
615
- }
616
- class MapLikeNativeIterator extends NativeIterator {
617
- valueFor(result) {
618
- return result.value[1];
619
- }
620
- memoFor(result) {
621
- return result.value[0];
622
- }
623
- }
624
- function hasForEach(value) {
625
- return value != null && typeof value['forEach'] === 'function';
626
- }
627
- function isNativeIterable(value) {
628
- return value != null && typeof value[Symbol.iterator] === 'function';
629
- }
630
- function isIndexable(value) {
631
- return value !== null && (typeof value === 'object' || typeof value === 'function');
632
- }
633
-
634
- function toBool(predicate) {
635
- if (isProxy(predicate)) {
636
- consumeTag(tagForProperty(predicate, 'content'));
637
- return Boolean(get(predicate, 'isTruthy'));
638
- } else if (isArray(predicate)) {
639
- consumeTag(tagForProperty(predicate, '[]'));
640
- return predicate.length !== 0;
641
- } else if (isHTMLSafe(predicate)) {
642
- return Boolean(predicate.toString());
643
- } else {
644
- return Boolean(predicate);
645
- }
646
- }
647
-
648
- ///////////
649
-
650
- // Setup global context
651
-
652
- setGlobalContext({
653
- scheduleRevalidate() {
654
- _backburner.ensureInstance();
655
- },
656
- toBool,
657
- toIterator,
658
- getProp: _getProp,
659
- setProp: _setProp,
660
- getPath: get,
661
- setPath: set,
662
- scheduleDestroy(destroyable, destructor) {
663
- schedule('actions', null, destructor, destroyable);
664
- },
665
- scheduleDestroyed(finalizeDestructor) {
666
- schedule('destroy', null, finalizeDestructor);
667
- },
668
- warnIfStyleNotTrusted(value) {
669
- },
670
- assert(test, msg, options) {
671
- },
672
- deprecate(msg, test, options) {
673
- }
674
- });
675
-
676
- ///////////
677
-
678
- // Define environment delegate
679
-
680
- class EmberEnvironmentDelegate {
681
- enableDebugTooling = ENV._DEBUG_RENDER_TREE;
682
- constructor(owner, isInteractive) {
683
- this.owner = owner;
684
- this.isInteractive = isInteractive;
685
- }
686
- onTransactionCommit() {}
687
- }
688
-
689
- /**
690
- @module ember
691
- */
692
- const disallowDynamicResolution = internalHelper(({
693
- positional,
694
- named
695
- }) => {
696
- const nameOrValueRef = positional[0];
697
- let typeRef = named['type'];
698
- let locRef = named['loc'];
699
- let originalRef = named['original'];
700
- // assert('[BUG] expecting a string literal for the `type` argument', isConstRef(typeRef));
701
- // assert('[BUG] expecting a string literal for the `loc` argument', isConstRef(locRef));
702
- // assert('[BUG] expecting a string literal for the `original` argument', isConstRef(originalRef));
703
- valueForRef(typeRef);
704
- valueForRef(locRef);
705
- valueForRef(originalRef);
706
- return createComputeRef(() => {
707
- let nameOrValue = valueForRef(nameOrValueRef);
708
- return nameOrValue;
709
- });
710
- });
711
-
712
- let helper;
713
- {
714
- helper = args => {
715
- let arg = args.positional[0];
716
- return arg;
717
- };
718
- }
719
- const inElementNullCheckHelper = internalHelper(helper);
720
-
721
- const normalizeClassHelper = internalHelper(({
722
- positional
723
- }) => {
724
- return createComputeRef(() => {
725
- let classNameArg = positional[0];
726
- let valueArg = positional[1];
727
- let classNameParts = valueForRef(classNameArg).split('.');
728
- let className = classNameParts[classNameParts.length - 1];
729
- let value = valueForRef(valueArg);
730
- if (value === true) {
731
- return dasherize(className);
732
- } else if (!value && value !== 0) {
733
- return '';
734
- } else {
735
- return String(value);
736
- }
737
- });
738
- });
739
-
740
- /**
741
- @module ember
742
- */
743
-
744
- const resolve = internalHelper(({
745
- positional
746
- }, owner) => {
747
- let fullNameRef = positional[0];
748
- let fullName = valueForRef(fullNameRef);
749
- return createConstRef(owner.factoryFor(fullName)?.class);
750
- });
751
-
752
- /**
753
- @module ember
754
- */
755
-
756
- /**
757
- This reference is used to get the `[]` tag of iterables, so we can trigger
758
- updates to `{{each}}` when it changes. It is put into place by a template
759
- transform at build time, similar to the (-each-in) helper
760
- */
761
- const trackArray = internalHelper(({
762
- positional
763
- }) => {
764
- const inner = positional[0];
765
- return createComputeRef(() => {
766
- let iterable = valueForRef(inner);
767
- if (isObject(iterable)) {
768
- consumeTag(tagForProperty(iterable, '[]'));
769
- }
770
- return iterable;
771
- });
772
- });
773
-
774
- /**
775
- @module ember
776
- */
777
-
778
- /**
779
- The `mut` helper lets you __clearly specify__ that a child `Component` can update the
780
- (mutable) value passed to it, which will __change the value of the parent component__.
781
-
782
- To specify that a parameter is mutable, when invoking the child `Component`:
783
-
784
- ```handlebars
785
- <MyChild @childClickCount={{fn (mut totalClicks)}} />
786
- ```
787
-
788
- or
789
-
790
- ```handlebars
791
- {{my-child childClickCount=(mut totalClicks)}}
792
- ```
793
-
794
- The child `Component` can then modify the parent's value just by modifying its own
795
- property:
796
-
797
- ```javascript
798
- // my-child.js
799
- export default class MyChild extends Component {
800
- click() {
801
- this.incrementProperty('childClickCount');
802
- }
803
- }
804
- ```
805
-
806
- Note that for curly components (`{{my-component}}`) the bindings are already mutable,
807
- making the `mut` unnecessary.
808
-
809
- Additionally, the `mut` helper can be combined with the `fn` helper to
810
- mutate a value. For example:
811
-
812
- ```handlebars
813
- <MyChild @childClickCount={{this.totalClicks}} @click-count-change={{fn (mut totalClicks))}} />
814
- ```
815
-
816
- or
817
-
818
- ```handlebars
819
- {{my-child childClickCount=totalClicks click-count-change=(fn (mut totalClicks))}}
820
- ```
821
-
822
- The child `Component` would invoke the function with the new click value:
823
-
824
- ```javascript
825
- // my-child.js
826
- export default class MyChild extends Component {
827
- click() {
828
- this.get('click-count-change')(this.get('childClickCount') + 1);
829
- }
830
- }
831
- ```
341
+ ```
832
342
 
833
343
  The `mut` helper changes the `totalClicks` value to what was provided as the `fn` argument.
834
344
 
835
- The `mut` helper, when used with `fn`, will return a function that
836
- sets the value passed to `mut` to its first argument. As an example, we can create a
837
- button that increments a value passing the value directly to the `fn`:
838
-
839
- ```handlebars
840
- {{! inc helper is not provided by Ember }}
841
- <button onclick={{fn (mut count) (inc count)}}>
842
- Increment count
843
- </button>
844
- ```
845
-
846
345
  @method mut
847
346
  @param {Object} [attr] the "two-way" attribute that can be modified.
848
347
  @for Ember.Templates.helpers
@@ -864,6 +363,10 @@ const mut = internalHelper(({
864
363
  /**
865
364
  The `readonly` helper let's you specify that a binding is one-way only,
866
365
  instead of two-way.
366
+
367
+ This is a vestigial helper from the days of `@ember/component` and does not apply to
368
+ components extending from `@glimmer/component`.
369
+
867
370
  When you pass a `readonly` binding from an outer context (e.g. parent component),
868
371
  to to an inner context (e.g. child component), you are saying that changing that
869
372
  property in the inner context does not change the value in the outer context.
@@ -876,14 +379,6 @@ const mut = internalHelper(({
876
379
  }
877
380
  ```
878
381
 
879
- ```app/templates/components/my-parent.hbs
880
- {{log totalClicks}} // -> 3
881
- <MyChild @childClickCount={{readonly totalClicks}} />
882
- ```
883
- ```
884
- {{my-child childClickCount=(readonly totalClicks)}}
885
- ```
886
-
887
382
  Now, when you update `childClickCount`:
888
383
 
889
384
  ```app/components/my-child.js
@@ -971,472 +466,57 @@ const mut = internalHelper(({
971
466
  {{log childClicks.total}} //-> 4
972
467
  ```
973
468
 
974
- @method readonly
975
- @param {Object} [attr] the read-only attribute.
976
- @for Ember.Templates.helpers
977
- @private
978
- */
979
- const readonly = internalHelper(({
980
- positional
981
- }) => {
982
- let firstArg = positional[0];
983
- return createReadOnlyRef(firstArg);
984
- });
985
-
986
- /**
987
- @module ember
988
- */
989
-
990
-
991
- /**
992
- The `{{unbound}}` helper disconnects the one-way binding of a property,
993
- essentially freezing its value at the moment of rendering. For example,
994
- in this example the display of the variable `name` will not change even
995
- if it is set with a new value:
996
-
997
- ```handlebars
998
- {{unbound this.name}}
999
- ```
1000
-
1001
- Like any helper, the `unbound` helper can accept a nested helper expression.
1002
- This allows for custom helpers to be rendered unbound:
1003
-
1004
- ```handlebars
1005
- {{unbound (some-custom-helper)}}
1006
- {{unbound (capitalize this.name)}}
1007
- {{! You can use any helper, including unbound, in a nested expression }}
1008
- {{capitalize (unbound this.name)}}
1009
- ```
1010
-
1011
- The `unbound` helper only accepts a single argument, and it return an
1012
- unbound value.
1013
-
1014
- @method unbound
1015
- @for Ember.Templates.helpers
1016
- @public
1017
- */
1018
-
1019
- const unbound = internalHelper(({
1020
- positional,
1021
- named
1022
- }) => {
1023
- return createUnboundRef(valueForRef(positional[0]));
1024
- });
1025
-
1026
- const CAPABILITIES$1 = {
1027
- dynamicLayout: true,
1028
- dynamicTag: false,
1029
- prepareArgs: false,
1030
- createArgs: true,
1031
- attributeHook: false,
1032
- elementHook: false,
1033
- createCaller: true,
1034
- dynamicScope: true,
1035
- updateHook: true,
1036
- createInstance: true,
1037
- wrapped: false,
1038
- willDestroy: false,
1039
- hasSubOwner: true
1040
- };
1041
- class MountManager {
1042
- getDynamicLayout(state) {
1043
- let templateFactory = state.engine.lookup('template:application');
1044
- return unwrapTemplate(templateFactory(state.engine)).asLayout();
1045
- }
1046
- getCapabilities() {
1047
- return CAPABILITIES$1;
1048
- }
1049
- getOwner(state) {
1050
- return state.engine;
1051
- }
1052
- create(owner, {
1053
- name
1054
- }, args, env) {
1055
- let engine = owner.buildChildEngineInstance(name);
1056
- engine.boot();
1057
- let applicationFactory = engine.factoryFor(`controller:application`);
1058
- let controllerFactory = applicationFactory || generateControllerFactory(engine, 'application');
1059
- let controller;
1060
- let self;
1061
- let bucket;
1062
- let modelRef;
1063
- if (args.named.has('model')) {
1064
- modelRef = args.named.get('model');
1065
- }
1066
- if (modelRef === undefined) {
1067
- controller = controllerFactory.create();
1068
- self = createConstRef(controller);
1069
- bucket = {
1070
- engine,
1071
- controller,
1072
- self,
1073
- modelRef
1074
- };
1075
- } else {
1076
- let model = valueForRef(modelRef);
1077
- controller = controllerFactory.create({
1078
- model
1079
- });
1080
- self = createConstRef(controller);
1081
- bucket = {
1082
- engine,
1083
- controller,
1084
- self,
1085
- modelRef
1086
- };
1087
- }
1088
- if (env.debugRenderTree) {
1089
- associateDestroyableChild(engine, controller);
1090
- }
1091
- return bucket;
1092
- }
1093
- getDebugName({
1094
- name
1095
- }) {
1096
- return name;
1097
- }
1098
- getDebugCustomRenderTree(definition, state, args) {
1099
- return [{
1100
- bucket: state.engine,
1101
- instance: state.engine,
1102
- type: 'engine',
1103
- name: definition.name,
1104
- args
1105
- }, {
1106
- bucket: state.controller,
1107
- instance: state.controller,
1108
- type: 'route-template',
1109
- name: 'application',
1110
- args
1111
- }];
1112
- }
1113
- getSelf({
1114
- self
1115
- }) {
1116
- return self;
1117
- }
1118
- getDestroyable(bucket) {
1119
- return bucket.engine;
1120
- }
1121
- didCreate() {}
1122
- didUpdate() {}
1123
- didRenderLayout() {}
1124
- didUpdateLayout() {}
1125
- update(bucket) {
1126
- let {
1127
- controller,
1128
- modelRef
1129
- } = bucket;
1130
- if (modelRef !== undefined) {
1131
- controller.set('model', valueForRef(modelRef));
1132
- }
1133
- }
1134
- }
1135
- const MOUNT_MANAGER = new MountManager();
1136
- class MountDefinition {
1137
- // handle is not used by this custom definition
1138
- handle = -1;
1139
- state;
1140
- manager = MOUNT_MANAGER;
1141
- compilable = null;
1142
- capabilities = capabilityFlagsFrom(CAPABILITIES$1);
1143
- constructor(resolvedName) {
1144
- this.resolvedName = resolvedName;
1145
- this.state = {
1146
- name: resolvedName
1147
- };
1148
- }
1149
- }
1150
-
1151
- /**
1152
- @module ember
1153
- */
1154
-
1155
-
1156
- /**
1157
- The `{{mount}}` helper lets you embed a routeless engine in a template.
1158
- Mounting an engine will cause an instance to be booted and its `application`
1159
- template to be rendered.
1160
-
1161
- For example, the following template mounts the `ember-chat` engine:
1162
-
1163
- ```handlebars
1164
- {{! application.hbs }}
1165
- {{mount "ember-chat"}}
1166
- ```
1167
-
1168
- Additionally, you can also pass in a `model` argument that will be
1169
- set as the engines model. This can be an existing object:
1170
-
1171
- ```
1172
- <div>
1173
- {{mount 'admin' model=userSettings}}
1174
- </div>
1175
- ```
1176
-
1177
- Or an inline `hash`, and you can even pass components:
1178
-
1179
- ```
1180
- <div>
1181
- <h1>Application template!</h1>
1182
- {{mount 'admin' model=(hash
1183
- title='Secret Admin'
1184
- signInButton=(component 'sign-in-button')
1185
- )}}
1186
- </div>
1187
- ```
1188
-
1189
- @method mount
1190
- @param {String} name Name of the engine to mount.
1191
- @param {Object} [model] Object that will be set as
1192
- the model of the engine.
1193
- @for Ember.Templates.helpers
1194
- @public
1195
- */
1196
- const mountHelper = internalHelper((args, owner) => {
1197
- let nameRef = args.positional[0];
1198
- let captured;
1199
- captured = createCapturedArgs(args.named, EMPTY_POSITIONAL);
1200
- let lastName, lastDef;
1201
- return createComputeRef(() => {
1202
- let name = valueForRef(nameRef);
1203
- if (typeof name === 'string') {
1204
- if (lastName === name) {
1205
- return lastDef;
1206
- }
1207
- lastName = name;
1208
- lastDef = curry(0, new MountDefinition(name), owner, captured, true);
1209
- return lastDef;
1210
- } else {
1211
- lastDef = null;
1212
- lastName = null;
1213
- return null;
1214
- }
1215
- });
1216
- });
1217
-
1218
- const CAPABILITIES = {
1219
- dynamicLayout: false,
1220
- dynamicTag: false,
1221
- prepareArgs: false,
1222
- createArgs: true,
1223
- attributeHook: false,
1224
- elementHook: false,
1225
- createCaller: false,
1226
- dynamicScope: false,
1227
- updateHook: false,
1228
- createInstance: true,
1229
- wrapped: false,
1230
- willDestroy: false,
1231
- hasSubOwner: false
1232
- };
1233
- const CAPABILITIES_MASK = capabilityFlagsFrom(CAPABILITIES);
1234
- class RouteTemplateManager {
1235
- create(_owner, _definition, args) {
1236
- let self = args.named.get('controller');
1237
- let controller = valueForRef(self);
1238
- return {
1239
- self,
1240
- controller
1241
- };
1242
- }
1243
- getSelf({
1244
- self
1245
- }) {
1246
- return self;
1247
- }
1248
- getDebugName({
1249
- name
1250
- }) {
1251
- return `route-template (${name})`;
1252
- }
1253
- getDebugCustomRenderTree({
1254
- name
1255
- }, state, args) {
1256
- return [{
1257
- bucket: state,
1258
- type: 'route-template',
1259
- name,
1260
- args,
1261
- instance: state.controller
1262
- }];
1263
- }
1264
- getCapabilities() {
1265
- return CAPABILITIES;
1266
- }
1267
- didRenderLayout() {}
1268
- didUpdateLayout() {}
1269
- didCreate() {}
1270
- didUpdate() {}
1271
- getDestroyable() {
1272
- return null;
1273
- }
1274
- }
1275
- const ROUTE_TEMPLATE_MANAGER = new RouteTemplateManager();
469
+ @method readonly
470
+ @param {Object} [attr] the read-only attribute.
471
+ @for Ember.Templates.helpers
472
+ @private
473
+ */
474
+ const readonly = internalHelper(({
475
+ positional
476
+ }) => {
477
+ let firstArg = positional[0];
478
+ return createReadOnlyRef(firstArg);
479
+ });
1276
480
 
1277
481
  /**
1278
- * This "upgrades" a route template into a invocable component. Conceptually
1279
- * it can be 1:1 for each unique `Template`, but it's also cheap to construct,
1280
- * so unless the stability is desirable for other reasons, it's probably not
1281
- * worth caching this.
1282
- */
1283
- class RouteTemplate {
1284
- // handle is not used by this custom definition
1285
- handle = -1;
1286
- resolvedName;
1287
- state;
1288
- manager = ROUTE_TEMPLATE_MANAGER;
1289
- capabilities = CAPABILITIES_MASK;
1290
- compilable;
1291
- constructor(name, template) {
1292
- let unwrapped = unwrapTemplate(template);
1293
- // TODO This actually seems inaccurate – it ultimately came from the
1294
- // outlet's name. Also, setting this overrides `getDebugName()` in that
1295
- // message. Is that desirable?
1296
- this.resolvedName = name;
1297
- this.state = {
1298
- name
1299
- };
1300
- this.compilable = unwrapped.asLayout();
1301
- }
1302
- }
482
+ @module ember
483
+ */
1303
484
 
1304
- // TODO a lot these fields are copied from the adjacent existing components
1305
- // implementation, haven't looked into who cares about `ComponentDefinition`
1306
- // and if it is appropriate here. It seems like this version is intended to
1307
- // be used with `curry` which probably isn't necessary here. It could be the
1308
- // case that we just want to do something more similar to `InternalComponent`
1309
- // (the one we used to implement `Input` and `LinkTo`). For now it follows
1310
- // the same pattern to get things going.
1311
- function makeRouteTemplate(owner, name, template) {
1312
- let routeTemplate = new RouteTemplate(name, template);
1313
- return curry(0, routeTemplate, owner, null, true);
1314
- }
1315
485
 
1316
486
  /**
1317
- The `{{outlet}}` helper lets you specify where a child route will render in
1318
- your template. An important use of the `{{outlet}}` helper is in your
1319
- application's `application.hbs` file:
487
+ The `{{unbound}}` helper disconnects the one-way binding of a property,
488
+ essentially freezing its value at the moment of rendering. For example,
489
+ in this example the display of the variable `name` will not change even
490
+ if it is set with a new value:
1320
491
 
1321
- ```app/templates/application.hbs
1322
- <MyHeader />
492
+ ```handlebars
493
+ {{unbound this.name}}
494
+ ```
1323
495
 
1324
- <div class="my-dynamic-content">
1325
- <!-- this content will change based on the current route, which depends on the current URL -->
1326
- {{outlet}}
1327
- </div>
496
+ Like any helper, the `unbound` helper can accept a nested helper expression.
497
+ This allows for custom helpers to be rendered unbound:
1328
498
 
1329
- <MyFooter />
499
+ ```handlebars
500
+ {{unbound (some-custom-helper)}}
501
+ {{unbound (capitalize this.name)}}
502
+ {{! You can use any helper, including unbound, in a nested expression }}
503
+ {{capitalize (unbound this.name)}}
1330
504
  ```
1331
505
 
1332
- See the [routing guide](https://guides.emberjs.com/release/routing/rendering-a-template/) for more
1333
- information on how your `route` interacts with the `{{outlet}}` helper.
1334
- Note: Your content __will not render__ if there isn't an `{{outlet}}` for it.
506
+ The `unbound` helper only accepts a single argument, and it return an
507
+ unbound value.
1335
508
 
1336
- @method outlet
509
+ @method unbound
1337
510
  @for Ember.Templates.helpers
1338
511
  @public
1339
512
  */
1340
- const outletHelper = internalHelper((_args, owner, scope) => {
1341
- let outletRef = createComputeRef(() => {
1342
- let state = valueForRef(scope.get('outletState'));
1343
- return state?.outlets?.main;
1344
- });
1345
- let lastState = null;
1346
- let outlet = null;
1347
- return createComputeRef(() => {
1348
- let outletState = valueForRef(outletRef);
1349
- let state = stateFor(outletRef, outletState);
1350
-
1351
- // This code is deliberately using the behavior in glimmer-vm where in
1352
- // <@Component />, the component is considered stabled via `===`, and
1353
- // will continue to re-render in-place as long as the `===` holds, but
1354
- // when it changes to a different object, it teardown the old component
1355
- // (running destructors, etc), and render the component in its place (or
1356
- // nothing if the new value is nullish. Here we are carefully exploiting
1357
- // that fact, and returns the same stable object so long as it is the
1358
- // same route, but return a different one when the route changes. On the
1359
- // other hand, changing the model only intentionally do not teardown the
1360
- // component and instead re-render in-place.
1361
- if (!isStable(state, lastState)) {
1362
- lastState = state;
1363
- if (state !== null) {
1364
- // If we are crossing an engine mount point, this is how the owner
1365
- // gets switched.
1366
- let outletOwner = outletState?.render?.owner ?? owner;
1367
- let named = dict();
1368
-
1369
- // Here we either have a raw template that needs to be normalized,
1370
- // or a component that we can render as-is. `RouteTemplate` upgrades
1371
- // the template into a component so we can have a unified code path.
1372
- // We still store the original `template` value, because we rely on
1373
- // its identity for the stability check, and the `RouteTemplate`
1374
- // wrapper doesn't dedup for us.
1375
- let template = state.template;
1376
- let component;
1377
- if (hasInternalComponentManager(template)) {
1378
- component = template;
1379
- } else {
1380
- component = makeRouteTemplate(outletOwner, state.name, template);
1381
- }
1382
-
1383
- // Component is stable for the lifetime of the outlet
1384
- named['Component'] = createConstRef(component);
1385
-
1386
- // Controller is stable for the lifetime of the outlet
1387
- named['controller'] = createConstRef(state.controller);
1388
513
 
1389
- // Create a ref for the model
1390
- let modelRef = childRefFromParts(outletRef, ['render', 'model']);
1391
-
1392
- // Store the value of the model
1393
- let model = valueForRef(modelRef);
1394
-
1395
- // Create a compute ref which we pass in as the `{{@model}}` reference
1396
- // for the outlet. This ref will update and return the value of the
1397
- // model _until_ the outlet itself changes. Once the outlet changes,
1398
- // dynamic scope also changes, and so the original model ref would not
1399
- // provide the correct updated value. So we stop updating and return
1400
- // the _last_ model value for that outlet.
1401
- named['model'] = createComputeRef(() => {
1402
- if (lastState === state) {
1403
- model = valueForRef(modelRef);
1404
- }
1405
- return model;
1406
- });
1407
- let args = createCapturedArgs(named, EMPTY_POSITIONAL);
1408
-
1409
- // Package up everything
1410
- outlet = curry(0, new OutletComponent(owner, state), outletOwner, args, true);
1411
- } else {
1412
- outlet = null;
1413
- }
1414
- }
1415
- return outlet;
1416
- });
514
+ const unbound = internalHelper(({
515
+ positional,
516
+ named
517
+ }) => {
518
+ return createUnboundRef(valueForRef(positional[0]));
1417
519
  });
1418
- function stateFor(ref, outlet) {
1419
- if (outlet === undefined) return null;
1420
- let render = outlet.render;
1421
- if (render === undefined) return null;
1422
- let template = render.template;
1423
- // The type doesn't actually allow for `null`, but if we make it past this
1424
- // point it is really important that we have _something_ to render. We could
1425
- // assert, but that is probably overly strict for very little to gain.
1426
- if (template === undefined || template === null) return null;
1427
- return {
1428
- ref,
1429
- name: render.name,
1430
- template,
1431
- controller: render.controller
1432
- };
1433
- }
1434
- function isStable(state, lastState) {
1435
- if (state === null || lastState === null) {
1436
- return false;
1437
- }
1438
- return state.template === lastState.template && state.controller === lastState.controller;
1439
- }
1440
520
 
1441
521
  function instrumentationPayload(name) {
1442
522
  return {
@@ -1476,8 +556,6 @@ const BUILTIN_KEYWORD_HELPERS = {
1476
556
  '-normalize-class': normalizeClassHelper,
1477
557
  '-resolve': resolve,
1478
558
  '-track-array': trackArray,
1479
- '-mount': mountHelper,
1480
- '-outlet': outletHelper,
1481
559
  '-in-el-null': inElementNullCheckHelper
1482
560
  };
1483
561
  const BUILTIN_HELPERS = {
@@ -1485,21 +563,19 @@ const BUILTIN_HELPERS = {
1485
563
  array,
1486
564
  concat,
1487
565
  fn,
1488
- get: get$1,
566
+ get,
1489
567
  hash,
1490
- 'unique-id': uniqueId
1491
- };
1492
- {
1493
- // Bug: this may be a quirk of our test setup?
568
+ 'unique-id': uniqueId,
1494
569
  // In prod builds, this is a no-op helper and is unused in practice. We shouldn't need
1495
570
  // to add it at all, but the current test build doesn't produce a "prod compiler", so
1496
571
  // we ended up running the debug-build for the template compliler in prod tests. Once
1497
- // that is fixed, this can be removed. For now, this allows the test to work and does
1498
- // not really harm anything, since it's just a no-op pass-through helper and the bytes
1499
- // has to be included anyway. In the future, perhaps we can avoid the latter by using
1500
- // `import(...)`?
1501
- BUILTIN_HELPERS['-disallow-dynamic-resolution'] = disallowDynamicResolution;
1502
- }
572
+ // that is fixed, this can be conditionally included only in DEBUG. For now, this
573
+ // allows the test to work and does not really harm anything, since it's just a no-op
574
+ // pass-through helper. Keeping it inside the object literal (rather than a top-level
575
+ // conditional assignment) keeps this module free of top-level side effects so that
576
+ // consumers that never resolve anything dynamically can tree-shake the whole table.
577
+ '-disallow-dynamic-resolution': disallowDynamicResolution
578
+ };
1503
579
 
1504
580
  // With the implementation of RFC #1006(https://rfcs.emberjs.com/id/1006-deprecate-action-template-helper), the `action` modifer was removed. It was the
1505
581
  // only built-in keyword modifier, so this object is currently empty.
@@ -1526,182 +602,357 @@ class ResolverImpl {
1526
602
  if (definition === undefined) {
1527
603
  return null;
1528
604
  }
1529
- if (typeof definition === 'function' && isClassicHelper(definition)) {
1530
- // For classic class based helpers, we need to pass the factoryFor result itself rather
1531
- // than the raw value (`factoryFor(...).class`). This is because injections are already
1532
- // bound in the factoryFor result, including type-based injections
605
+ if (typeof definition === 'function' && isClassicHelper(definition)) {
606
+ // For classic class based helpers, we need to pass the factoryFor result itself rather
607
+ // than the raw value (`factoryFor(...).class`). This is because injections are already
608
+ // bound in the factoryFor result, including type-based injections
609
+
610
+ // The classic helper manager is registered on the classic `Helper` base
611
+ // class; deriving it from the definition (rather than importing it from
612
+ // the module that defines `Helper`) keeps this module from pulling in
613
+ // the classic object model when no classic helpers are in use.
614
+ let manager = getInternalHelperManager(definition);
615
+ {
616
+ setInternalHelperManager(manager, factory);
617
+ }
618
+ return factory;
619
+ }
620
+ return definition;
621
+ }
622
+ lookupBuiltInHelper(name) {
623
+ return BUILTIN_KEYWORD_HELPERS[name] ?? null;
624
+ }
625
+ lookupModifier(name, owner) {
626
+ let builtin = BUILTIN_MODIFIERS[name];
627
+ if (builtin !== undefined) {
628
+ return builtin;
629
+ }
630
+ let modifier = owner.factoryFor(`modifier:${name}`);
631
+ if (modifier === undefined) {
632
+ return null;
633
+ }
634
+ return modifier.class || null;
635
+ }
636
+ lookupBuiltInModifier(name) {
637
+ return BUILTIN_KEYWORD_MODIFIERS[name] ?? null;
638
+ }
639
+ lookupComponent(name, owner) {
640
+ let pair = lookupComponentPair(owner, name);
641
+ if (pair === null) {
642
+ return null;
643
+ }
644
+ let template = null;
645
+ let key;
646
+ if (pair.component === null) {
647
+ key = template = pair.layout(owner);
648
+ } else {
649
+ key = pair.component;
650
+ }
651
+ let cachedComponentDefinition = this.componentDefinitionCache.get(key);
652
+ if (cachedComponentDefinition !== undefined) {
653
+ return cachedComponentDefinition;
654
+ }
655
+ if (template === null && pair.layout !== null) {
656
+ template = pair.layout(owner);
657
+ }
658
+ let finalizer = _instrumentStart('render.getComponentDefinition', instrumentationPayload, name);
659
+ let definition = null;
660
+ if (pair.component === null) {
661
+ definition = {
662
+ state: templateOnlyComponent(undefined, name),
663
+ manager: TEMPLATE_ONLY_COMPONENT_MANAGER,
664
+ template
665
+ };
666
+ } else {
667
+ let factory = pair.component;
668
+ let ComponentClass = factory.class;
669
+ let manager = getInternalComponentManager(ComponentClass);
670
+ definition = {
671
+ state: isCurlyManager(manager) ? factory : ComponentClass,
672
+ manager,
673
+ template
674
+ };
675
+ }
676
+ finalizer();
677
+ this.componentDefinitionCache.set(key, definition);
678
+ return definition;
679
+ }
680
+ }
681
+
682
+ function toIterator(iterable) {
683
+ if (iterable instanceof EachInWrapper) {
684
+ return toEachInIterator(iterable.inner);
685
+ } else {
686
+ return toEachIterator(iterable);
687
+ }
688
+ }
689
+ function toEachInIterator(iterable) {
690
+ if (!isIndexable(iterable)) {
691
+ return null;
692
+ }
693
+ if (Array.isArray(iterable) || isEmberArray(iterable)) {
694
+ return ObjectIterator.fromIndexable(iterable);
695
+ } else if (isNativeIterable(iterable)) {
696
+ return MapLikeNativeIterator.from(iterable);
697
+ } else if (hasForEach(iterable)) {
698
+ return ObjectIterator.fromForEachable(iterable);
699
+ } else {
700
+ return ObjectIterator.fromIndexable(iterable);
701
+ }
702
+ }
703
+ function toEachIterator(iterable) {
704
+ if (!isObject(iterable)) {
705
+ return null;
706
+ }
707
+ if (Array.isArray(iterable)) {
708
+ return ArrayIterator.from(iterable);
709
+ } else if (isEmberArray(iterable)) {
710
+ return EmberArrayIterator.from(iterable);
711
+ } else if (isNativeIterable(iterable)) {
712
+ return ArrayLikeNativeIterator.from(iterable);
713
+ } else if (hasForEach(iterable)) {
714
+ return ArrayIterator.fromForEachable(iterable);
715
+ } else {
716
+ return null;
717
+ }
718
+ }
719
+ class BoundedIterator {
720
+ position = 0;
721
+ constructor(length) {
722
+ this.length = length;
723
+ }
724
+ isEmpty() {
725
+ return false;
726
+ }
727
+ memoFor(position) {
728
+ return position;
729
+ }
730
+ next() {
731
+ let {
732
+ length,
733
+ position
734
+ } = this;
735
+ if (position >= length) {
736
+ return null;
737
+ }
738
+ let value = this.valueFor(position);
739
+ let memo = this.memoFor(position);
740
+ this.position++;
741
+ return {
742
+ value,
743
+ memo
744
+ };
745
+ }
746
+ }
747
+ class ArrayIterator extends BoundedIterator {
748
+ static from(iterable) {
749
+ return iterable.length > 0 ? new this(iterable) : null;
750
+ }
751
+ static fromForEachable(object) {
752
+ let array = [];
753
+ object.forEach(item => array.push(item));
754
+ return this.from(array);
755
+ }
756
+ constructor(array) {
757
+ super(array.length);
758
+ this.array = array;
759
+ }
760
+ valueFor(position) {
761
+ return this.array[position];
762
+ }
763
+ }
764
+ class EmberArrayIterator extends BoundedIterator {
765
+ static from(iterable) {
766
+ return iterable.length > 0 ? new this(iterable) : null;
767
+ }
768
+ constructor(array) {
769
+ super(array.length);
770
+ this.array = array;
771
+ }
772
+ valueFor(position) {
773
+ return objectAt(this.array, position);
774
+ }
775
+ }
776
+ class ObjectIterator extends BoundedIterator {
777
+ static fromIndexable(obj) {
778
+ let keys = Object.keys(obj);
779
+ if (keys.length === 0) {
780
+ return null;
781
+ } else {
782
+ let values = [];
783
+ for (let key of keys) {
784
+ let value;
785
+ value = obj[key];
786
+
787
+ // Add the tag of the returned value if it is an array, since arrays
788
+ // should always cause updates if they are consumed and then changed
789
+ if (isTracking()) {
790
+ consumeTag(tagFor(obj, key));
791
+ if (Array.isArray(value)) {
792
+ consumeTag(tagFor(value, '[]'));
793
+ }
794
+ }
795
+ values.push(value);
796
+ }
797
+ return new this(keys, values);
798
+ }
799
+ }
800
+ static fromForEachable(obj) {
801
+ let keys = [];
802
+ let values = [];
803
+ let length = 0;
804
+ let isMapLike = false;
1533
805
 
1534
- {
1535
- setInternalHelperManager(CLASSIC_HELPER_MANAGER, factory);
806
+ // Not using an arrow function here so we can get an accurate `arguments`
807
+ obj.forEach(function (value, key) {
808
+ isMapLike = isMapLike || arguments.length >= 2;
809
+ if (isMapLike) {
810
+ keys.push(key);
1536
811
  }
1537
- return factory;
812
+ values.push(value);
813
+ length++;
814
+ });
815
+ if (length === 0) {
816
+ return null;
817
+ } else if (isMapLike) {
818
+ return new this(keys, values);
819
+ } else {
820
+ return new ArrayIterator(values);
1538
821
  }
1539
- return definition;
1540
822
  }
1541
- lookupBuiltInHelper(name) {
1542
- return BUILTIN_KEYWORD_HELPERS[name] ?? null;
823
+ constructor(keys, values) {
824
+ super(values.length);
825
+ this.keys = keys;
826
+ this.values = values;
1543
827
  }
1544
- lookupModifier(name, owner) {
1545
- let builtin = BUILTIN_MODIFIERS[name];
1546
- if (builtin !== undefined) {
1547
- return builtin;
1548
- }
1549
- let modifier = owner.factoryFor(`modifier:${name}`);
1550
- if (modifier === undefined) {
1551
- return null;
1552
- }
1553
- return modifier.class || null;
828
+ valueFor(position) {
829
+ return this.values[position];
1554
830
  }
1555
- lookupBuiltInModifier(name) {
1556
- return BUILTIN_KEYWORD_MODIFIERS[name] ?? null;
831
+ memoFor(position) {
832
+ return this.keys[position];
1557
833
  }
1558
- lookupComponent(name, owner) {
1559
- let pair = lookupComponentPair(owner, name);
1560
- if (pair === null) {
834
+ }
835
+ class NativeIterator {
836
+ static from(iterable) {
837
+ let iterator = iterable[Symbol.iterator]();
838
+ let result = iterator.next();
839
+ let {
840
+ done
841
+ } = result;
842
+ if (done) {
1561
843
  return null;
1562
- }
1563
- let template = null;
1564
- let key;
1565
- if (pair.component === null) {
1566
- key = template = pair.layout(owner);
1567
- } else {
1568
- key = pair.component;
1569
- }
1570
- let cachedComponentDefinition = this.componentDefinitionCache.get(key);
1571
- if (cachedComponentDefinition !== undefined) {
1572
- return cachedComponentDefinition;
1573
- }
1574
- if (template === null && pair.layout !== null) {
1575
- template = pair.layout(owner);
1576
- }
1577
- let finalizer = _instrumentStart('render.getComponentDefinition', instrumentationPayload, name);
1578
- let definition = null;
1579
- if (pair.component === null) {
1580
- definition = {
1581
- state: templateOnlyComponent(undefined, name),
1582
- manager: TEMPLATE_ONLY_COMPONENT_MANAGER,
1583
- template
1584
- };
1585
844
  } else {
1586
- let factory = pair.component;
1587
- let ComponentClass = factory.class;
1588
- let manager = getInternalComponentManager(ComponentClass);
1589
- definition = {
1590
- state: isCurlyManager(manager) ? factory : ComponentClass,
1591
- manager,
1592
- template
1593
- };
845
+ return new this(iterator, result);
1594
846
  }
1595
- finalizer();
1596
- this.componentDefinitionCache.set(key, definition);
1597
- return definition;
1598
847
  }
1599
- }
1600
-
1601
- // We use the `InternalOwner` notion here because we actually need all of its
1602
- // API for using with renderers (normally, it will be `EngineInstance`).
1603
- // We use `getOwner` from our internal home for it rather than the narrower
1604
- // public API for the same reason.
1605
- const TOP_LEVEL_NAME = '-top-level';
1606
- class OutletView {
1607
- static extend(injections) {
1608
- return class extends OutletView {
1609
- static create(options) {
1610
- if (options) {
1611
- return super.create(Object.assign({}, injections, options));
1612
- } else {
1613
- return super.create(injections);
1614
- }
1615
- }
1616
- };
848
+ position = 0;
849
+ constructor(iterable, result) {
850
+ this.iterable = iterable;
851
+ this.result = result;
1617
852
  }
1618
- static reopenClass(injections) {
1619
- Object.assign(this, injections);
853
+ isEmpty() {
854
+ return false;
1620
855
  }
1621
- static create(options) {
856
+ next() {
1622
857
  let {
1623
- environment: _environment,
1624
- application: namespace,
1625
- template: templateFactory
1626
- } = options;
1627
- let owner = getOwner(options);
1628
- let template = templateFactory(owner);
1629
- return new OutletView(_environment, owner, template, namespace);
1630
- }
1631
- ref;
1632
- state;
1633
- constructor(_environment, owner, template, namespace) {
1634
- this._environment = _environment;
1635
- this.owner = owner;
1636
- this.template = template;
1637
- this.namespace = namespace;
1638
- let outletStateTag = createTag();
1639
- let outletState = {
1640
- outlets: {
1641
- main: undefined
1642
- },
1643
- render: {
1644
- owner: owner,
1645
- name: TOP_LEVEL_NAME,
1646
- controller: undefined,
1647
- model: undefined,
1648
- template
1649
- }
1650
- };
1651
- let ref = this.ref = createComputeRef(() => {
1652
- consumeTag(outletStateTag);
1653
- return outletState;
1654
- }, state => {
1655
- DIRTY_TAG$1(outletStateTag);
1656
- outletState.outlets['main'] = state;
1657
- });
1658
- this.state = {
1659
- ref,
1660
- name: TOP_LEVEL_NAME,
1661
- template,
1662
- controller: undefined
858
+ iterable,
859
+ result,
860
+ position
861
+ } = this;
862
+ if (result.done) {
863
+ return null;
864
+ }
865
+ let value = this.valueFor(result, position);
866
+ let memo = this.memoFor(result, position);
867
+ this.position++;
868
+ this.result = iterable.next();
869
+ return {
870
+ value,
871
+ memo
1663
872
  };
1664
873
  }
1665
- appendTo(selector) {
1666
- let target;
1667
- if (this._environment.hasDOM) {
1668
- target = typeof selector === 'string' ? document.querySelector(selector) : selector;
1669
- } else {
1670
- target = selector;
1671
- }
1672
- let renderer = this.owner.lookup('renderer:-dom');
1673
-
1674
- // SAFETY: It's not clear that this cast is safe.
1675
- // The types for appendOutletView may be incorrect or this is a potential bug.
1676
- schedule('render', renderer, 'appendOutletView', this, target);
874
+ }
875
+ class ArrayLikeNativeIterator extends NativeIterator {
876
+ valueFor(result) {
877
+ return result.value;
1677
878
  }
1678
- rerender() {
1679
- /**/
879
+ memoFor(_result, position) {
880
+ return position;
1680
881
  }
1681
- setOutletState(state) {
1682
- updateRef(this.ref, state);
882
+ }
883
+ class MapLikeNativeIterator extends NativeIterator {
884
+ valueFor(result) {
885
+ return result.value[1];
1683
886
  }
1684
- destroy() {
1685
- /**/
887
+ memoFor(result) {
888
+ return result.value[0];
1686
889
  }
1687
890
  }
891
+ function hasForEach(value) {
892
+ return value != null && typeof value['forEach'] === 'function';
893
+ }
894
+ function isNativeIterable(value) {
895
+ return value != null && typeof value[Symbol.iterator] === 'function';
896
+ }
897
+ function isIndexable(value) {
898
+ return value !== null && (typeof value === 'object' || typeof value === 'function');
899
+ }
1688
900
 
1689
- class DynamicScope {
1690
- constructor(view, outletState) {
1691
- this.view = view;
1692
- this.outletState = outletState;
1693
- }
1694
- child() {
1695
- return new DynamicScope(this.view, this.outletState);
901
+ function toBool(predicate) {
902
+ if (isProxy(predicate)) {
903
+ consumeTag(tagForProperty(predicate, 'content'));
904
+ return Boolean(get$1(predicate, 'isTruthy'));
905
+ } else if (isArray(predicate)) {
906
+ consumeTag(tagForProperty(predicate, '[]'));
907
+ return predicate.length !== 0;
908
+ } else if (isHTMLSafe(predicate)) {
909
+ return Boolean(predicate.toString());
910
+ } else {
911
+ return Boolean(predicate);
1696
912
  }
1697
- get(key) {
1698
- return this.outletState;
913
+ }
914
+
915
+ ///////////
916
+
917
+ // Setup global context
918
+
919
+ setGlobalContext({
920
+ scheduleRevalidate() {
921
+ _backburner.ensureInstance();
922
+ },
923
+ toBool,
924
+ toIterator,
925
+ getProp: _getProp,
926
+ setProp: _setProp,
927
+ getPath: get$1,
928
+ setPath: set,
929
+ scheduleDestroy(destroyable, destructor) {
930
+ schedule('actions', null, destructor, destroyable);
931
+ },
932
+ scheduleDestroyed(finalizeDestructor) {
933
+ schedule('destroy', null, finalizeDestructor);
934
+ },
935
+ warnIfStyleNotTrusted(value) {
936
+ },
937
+ assert(test, msg, options) {
938
+ },
939
+ deprecate(msg, test, options) {
1699
940
  }
1700
- set(key, value) {
1701
- this.outletState = value;
1702
- return value;
941
+ });
942
+
943
+ ///////////
944
+
945
+ // Define environment delegate
946
+
947
+ class EmberEnvironmentDelegate {
948
+ enableDebugTooling = ENV._DEBUG_RENDER_TREE;
949
+ constructor(owner, isInteractive) {
950
+ this.owner = owner;
951
+ this.isInteractive = isInteractive;
1703
952
  }
953
+ onTransactionCommit() {}
1704
954
  }
955
+
1705
956
  const NO_OP = () => {};
1706
957
 
1707
958
  // This wrapper logic prevents us from rerendering in case of a hard failure
@@ -1712,6 +963,13 @@ function errorLoopTransaction(fn) {
1712
963
  return fn;
1713
964
  }
1714
965
  }
966
+
967
+ /**
968
+ * The interface the `RendererState` needs from a render root. The base
969
+ * renderer only ever creates `ComponentRootState`s; the classic renderer
970
+ * (`./renderer`) adds `ClassicRootState` for outlet/classic-component roots.
971
+ */
972
+
1715
973
  class ComponentRootState {
1716
974
  type = 'component';
1717
975
  #result;
@@ -1729,7 +987,7 @@ class ComponentRootState {
1729
987
  });
1730
988
  });
1731
989
  }
1732
- isFor(_component) {
990
+ isFor(_possibleRoot) {
1733
991
  return false;
1734
992
  }
1735
993
  render() {
@@ -1745,61 +1003,6 @@ class ComponentRootState {
1745
1003
  return this.#result;
1746
1004
  }
1747
1005
  }
1748
- class ClassicRootState {
1749
- type = 'classic';
1750
- id;
1751
- result;
1752
- destroyed;
1753
- render;
1754
- env;
1755
- constructor(root, context, owner, template, self, parentElement, dynamicScope, builder) {
1756
- this.root = root;
1757
- this.id = root instanceof OutletView ? guidFor(root) : getViewId(root);
1758
- this.result = undefined;
1759
- this.destroyed = false;
1760
- this.env = context.env;
1761
- this.render = errorLoopTransaction(() => {
1762
- let layout = unwrapTemplate(template).asLayout();
1763
- let iterator = renderMain(context, owner, self, builder(context.env, {
1764
- element: parentElement,
1765
- nextSibling: null
1766
- }), layout, dynamicScope);
1767
- let result = this.result = iterator.sync();
1768
- associateDestroyableChild(this, result);
1769
- this.render = errorLoopTransaction(() => {
1770
- if (isDestroying(result) || isDestroyed(result)) return;
1771
- return result.rerender({
1772
- alwaysRevalidate: false
1773
- });
1774
- });
1775
- });
1776
- }
1777
- isFor(possibleRoot) {
1778
- return this.root === possibleRoot;
1779
- }
1780
- destroy() {
1781
- let {
1782
- result,
1783
- env
1784
- } = this;
1785
- this.destroyed = true;
1786
- this.root = null;
1787
- this.result = undefined;
1788
- this.render = undefined;
1789
- if (result !== undefined) {
1790
- /*
1791
- Handles these scenarios:
1792
- * When roots are removed during standard rendering process, a transaction exists already
1793
- `.begin()` / `.commit()` are not needed.
1794
- * When roots are being destroyed manually (`component.append(); component.destroy() case), no
1795
- transaction exists already.
1796
- * When roots are being destroyed during `Renderer#destroy`, no transaction exists
1797
- */
1798
-
1799
- inTransaction(env, () => destroy(result));
1800
- }
1801
- }
1802
- }
1803
1006
  const renderers = [];
1804
1007
  function _resetRenderers() {
1805
1008
  renderers.length = 0;
@@ -1828,7 +1031,12 @@ let renderSettledDeferred = null;
1828
1031
  */
1829
1032
  function renderSettled() {
1830
1033
  if (renderSettledDeferred === null) {
1831
- renderSettledDeferred = RSVP.defer();
1034
+ let resolve;
1035
+ let promise = new Promise(r => resolve = r);
1036
+ renderSettledDeferred = {
1037
+ promise,
1038
+ resolve
1039
+ };
1832
1040
  // if there is no current runloop, the promise created above will not have
1833
1041
  // a chance to resolve (because its resolved in backburner's "end" event)
1834
1042
  if (!_getCurrentRunLoop()) {
@@ -2185,138 +1393,6 @@ class BaseRenderer {
2185
1393
  rerender() {
2186
1394
  this.state.scheduleRevalidate(this);
2187
1395
  }
2188
-
2189
- // render(component: Component, options: { into: Cursor; args?: Record<string, unknown> }): void {
2190
- // this.state.renderRoot(component);
2191
- // }
2192
- }
2193
- class Renderer extends BaseRenderer {
2194
- static strict(owner, document, options) {
2195
- return new BaseRenderer(owner, {
2196
- hasDOM: hasDOM,
2197
- ...options
2198
- }, document, new ResolverImpl(), clientBuilder);
2199
- }
2200
- _rootTemplate;
2201
- _viewRegistry;
2202
- static create(props) {
2203
- let {
2204
- _viewRegistry
2205
- } = props;
2206
- let owner = getOwner(props);
2207
- let document = owner.lookup('service:-document');
2208
- let env = owner.lookup('-environment:main');
2209
- let rootTemplate = owner.lookup(privatize`template:-root`);
2210
- let builder = owner.lookup('service:-dom-builder');
2211
- return new this(owner, document, env, rootTemplate, _viewRegistry, builder);
2212
- }
2213
- constructor(owner, document, env, rootTemplate, viewRegistry, builder = clientBuilder, resolver = new ResolverImpl()) {
2214
- super(owner, env, document, resolver, builder);
2215
- this._rootTemplate = rootTemplate(owner);
2216
- this._viewRegistry = viewRegistry || owner.lookup('-view-registry:main');
2217
- }
2218
-
2219
- // renderer HOOKS
2220
-
2221
- appendOutletView(view, target) {
2222
- // TODO: This bypasses the {{outlet}} syntax so logically duplicates
2223
- // some of the set up code. Since this is all internal (or is it?),
2224
- // we can refactor this to do something more direct/less convoluted
2225
- // and with less setup, but get it working first
2226
- let outlet = createRootOutlet(view);
2227
- let {
2228
- name,
2229
- /* controller, */template
2230
- } = view.state;
2231
- let named = dict();
2232
- named['Component'] = createConstRef(makeRouteTemplate(view.owner, name, template));
2233
-
2234
- // TODO: is this guaranteed to be undefined? It seems to be the
2235
- // case in the `OutletView` class. Investigate how much that class
2236
- // exists as an internal implementation detail only, or if it was
2237
- // used outside of core. As far as I can tell, test-helpers uses
2238
- // it but only for `setOutletState`.
2239
- // named['controller'] = createConstRef(controller, '@controller');
2240
- // Update: at least according to the debug render tree tests, we
2241
- // appear to always expect this to be undefined. Not a definitive
2242
- // source by any means, but is useful evidence
2243
- named['controller'] = UNDEFINED_REFERENCE;
2244
- named['model'] = UNDEFINED_REFERENCE;
2245
- let args = createCapturedArgs(named, EMPTY_POSITIONAL);
2246
- this._appendDefinition(view, curry(0, outlet, view.owner, args, true), target);
2247
- }
2248
- appendTo(view, target) {
2249
- let definition = new RootComponentDefinition(view);
2250
- this._appendDefinition(view, curry(0, definition, this.state.owner, null, true), target);
2251
- }
2252
- _appendDefinition(root, definition, target) {
2253
- let self = createConstRef(definition);
2254
- let dynamicScope = new DynamicScope(null, UNDEFINED_REFERENCE);
2255
- let rootState = new ClassicRootState(root, this.state.context, this.state.owner, this._rootTemplate, self, target, dynamicScope, this.state.builder);
2256
- this.state.renderRoot(rootState, this);
2257
- }
2258
- cleanupRootFor(component) {
2259
- // no need to cleanup roots if we have already been destroyed
2260
- if (isDestroyed(this)) {
2261
- return;
2262
- }
2263
- let roots = this.state.roots;
2264
-
2265
- // traverse in reverse so we can remove items
2266
- // without mucking up the index
2267
- let i = roots.length;
2268
- while (i--) {
2269
- let root = roots[i];
2270
- if (root.type === 'classic' && root.isFor(component)) {
2271
- root.destroy();
2272
- roots.splice(i, 1);
2273
- }
2274
- }
2275
- }
2276
- remove(view) {
2277
- view._transitionTo('destroying');
2278
- this.cleanupRootFor(view);
2279
- if (this.state.isInteractive) {
2280
- view.trigger('didDestroyElement');
2281
- }
2282
- }
2283
- get _roots() {
2284
- return this.state.debug.roots;
2285
- }
2286
- get _inRenderTransaction() {
2287
- return this.state.debug.inRenderTransaction;
2288
- }
2289
- get _isInteractive() {
2290
- return this.state.debug.isInteractive;
2291
- }
2292
- get _context() {
2293
- return this.state.context;
2294
- }
2295
- register(view) {
2296
- let id = getViewId(view);
2297
- this._viewRegistry[id] = view;
2298
- }
2299
- unregister(view) {
2300
- delete this._viewRegistry[getViewId(view)];
2301
- }
2302
- getElement(component) {
2303
- if (this._isInteractive) {
2304
- return getViewElement(component);
2305
- } else {
2306
- throw new Error('Accessing `this.element` is not allowed in non-interactive environments (such as FastBoot).');
2307
- }
2308
- }
2309
- getBounds(component) {
2310
- let bounds = component[BOUNDS];
2311
- let parentElement = bounds.parentElement();
2312
- let firstNode = bounds.firstNode();
2313
- let lastNode = bounds.lastNode();
2314
- return {
2315
- parentElement,
2316
- firstNode,
2317
- lastNode
2318
- };
2319
- }
2320
1396
  }
2321
1397
 
2322
- export { OutletView as O, Renderer as R, _resetRenderers as _, renderSettled as a, outletHelper as o, renderComponent as r };
1398
+ export { BaseRenderer as B, ResolverImpl as R, _resetRenderers as _, renderSettled as a, errorLoopTransaction as e, renderComponent as r };