ember-source 7.1.0-alpha.4 → 7.1.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build-metadata.json +3 -3
- package/dist/dev/packages/@ember/-internals/container/index.js +4 -401
- package/dist/dev/packages/@ember/-internals/deprecations/index.js +1 -1
- package/dist/dev/packages/@ember/-internals/environment/index.js +3 -161
- package/dist/dev/packages/@ember/-internals/glimmer/index.js +14 -15
- package/dist/dev/packages/@ember/-internals/meta/lib/meta.js +0 -1
- package/dist/dev/packages/@ember/-internals/metal/index.js +18 -9
- package/dist/dev/packages/@ember/-internals/routing/index.js +1 -10
- package/dist/dev/packages/@ember/-internals/runtime/lib/mixins/-proxy.js +10 -12
- package/dist/dev/packages/@ember/-internals/runtime/lib/mixins/action_handler.js +1 -10
- package/dist/dev/packages/@ember/-internals/runtime/lib/mixins/target_action_support.js +3 -10
- package/dist/dev/packages/@ember/-internals/string/index.js +0 -1
- package/dist/dev/packages/@ember/-internals/utils/index.js +8 -3
- package/dist/dev/packages/@ember/-internals/views/index.js +0 -1
- package/dist/dev/packages/@ember/-internals/views/lib/compat/fallback-view-registry.js +0 -1
- package/dist/dev/packages/@ember/-internals/views/lib/mixins/action_support.js +3 -12
- package/dist/dev/packages/@ember/-internals/views/lib/system/event_dispatcher.js +2 -11
- package/dist/dev/packages/@ember/-internals/views/lib/system/utils.js +1 -1
- package/dist/dev/packages/@ember/-internals/views/lib/views/core_view.js +2 -19
- package/dist/dev/packages/@ember/-internals/views/lib/views/states.js +1 -1
- package/dist/dev/packages/@ember/application/index.js +5 -28
- package/dist/dev/packages/@ember/application/instance.js +3 -22
- package/dist/dev/packages/@ember/application/namespace.js +4 -11
- package/dist/dev/packages/@ember/array/index.js +7 -15
- package/dist/dev/packages/@ember/array/proxy.js +10 -14
- package/dist/dev/packages/@ember/canary-features/index.js +1 -1
- package/dist/dev/packages/@ember/component/helper.js +1 -14
- package/dist/dev/packages/@ember/component/index.js +1356 -17
- package/dist/dev/packages/@ember/component/template-only.js +1 -9
- package/dist/dev/packages/@ember/controller/index.js +3 -19
- package/dist/dev/packages/@ember/debug/container-debug-adapter.js +0 -19
- package/dist/dev/packages/@ember/debug/data-adapter.js +4 -11
- package/dist/dev/packages/@ember/debug/index.js +1 -1
- package/dist/dev/packages/@ember/debug/lib/deprecate.js +1 -1
- package/dist/dev/packages/@ember/engine/index.js +3 -31
- package/dist/dev/packages/@ember/engine/instance.js +3 -8
- package/dist/dev/packages/@ember/helper/index.js +159 -21
- package/dist/dev/packages/@ember/instrumentation/index.js +1 -1
- package/dist/dev/packages/@ember/modifier/index.js +2 -16
- package/dist/dev/packages/@ember/modifier/on.js +1 -9
- package/dist/dev/packages/@ember/object/-internals.js +3 -11
- package/dist/dev/packages/@ember/object/compat.js +3 -10
- package/dist/dev/packages/@ember/object/computed.js +2 -12
- package/dist/dev/packages/@ember/object/core.js +10 -18
- package/dist/dev/packages/@ember/object/evented.js +2 -12
- package/dist/dev/packages/@ember/object/events.js +1 -11
- package/dist/dev/packages/@ember/object/index.js +10 -14
- package/dist/dev/packages/@ember/object/internals.js +1 -1
- package/dist/dev/packages/@ember/object/lib/computed/computed_macros.js +6 -23
- package/dist/dev/packages/@ember/object/lib/computed/reduce_computed_macros.js +3 -12
- package/dist/dev/packages/@ember/object/mixin.js +7 -10
- package/dist/dev/packages/@ember/object/observable.js +8 -12
- package/dist/dev/packages/@ember/object/observers.js +1 -11
- package/dist/dev/packages/@ember/object/promise-proxy-mixin.js +3 -13
- package/dist/dev/packages/@ember/object/proxy.js +0 -7
- package/dist/dev/packages/@ember/reactive/collections.js +591 -1
- package/dist/dev/packages/@ember/renderer/index.js +1 -14
- package/dist/dev/packages/@ember/routing/-internals.js +1 -10
- package/dist/dev/packages/@ember/routing/index.js +614 -14
- package/dist/dev/packages/@ember/routing/lib/generate_controller.js +2 -11
- package/dist/dev/packages/@ember/routing/lib/routing-service.js +7 -17
- package/dist/dev/packages/@ember/routing/lib/utils.js +2 -11
- package/dist/dev/packages/@ember/routing/route.js +13 -24
- package/dist/dev/packages/@ember/routing/router-service.js +9 -18
- package/dist/dev/packages/@ember/routing/router.js +5 -21
- package/dist/dev/packages/@ember/runloop/index.js +1 -10
- package/dist/dev/packages/@ember/service/index.js +1 -11
- package/dist/dev/packages/@ember/template/index.js +1 -14
- package/dist/dev/packages/@ember/template-compiler/lib/compile-options.js +12 -15
- package/dist/dev/packages/@ember/template-compiler/lib/dasherize-component-name.js +0 -1
- package/dist/dev/packages/@ember/template-compiler/lib/plugins/auto-import-builtins.js +13 -60
- package/dist/dev/packages/@ember/template-compiler/lib/plugins/index.js +1 -1
- package/dist/dev/packages/@ember/template-compiler/lib/plugins/transform-resolutions.js +1 -3
- package/dist/dev/packages/@ember/template-compiler/lib/template.js +3 -11
- package/dist/dev/packages/@ember/template-factory/index.js +1 -8
- package/dist/dev/packages/@ember/utils/lib/compare.js +0 -7
- package/dist/dev/packages/@ember/utils/lib/is_empty.js +1 -12
- package/dist/dev/packages/@glimmer/destroyable/index.js +1 -1
- package/dist/dev/packages/@glimmer/manager/index.js +5 -315
- package/dist/dev/packages/@glimmer/node/index.js +3 -11
- package/dist/dev/packages/@glimmer/opcode-compiler/index.js +2 -7
- package/dist/dev/packages/@glimmer/program/index.js +194 -3
- package/dist/dev/packages/@glimmer/reference/index.js +4 -5
- package/dist/dev/packages/@glimmer/runtime/index.js +15 -10
- package/dist/dev/packages/@glimmer/tracking/index.js +2 -11
- package/dist/dev/packages/@glimmer/tracking/primitives/cache/index.js +1 -11
- package/dist/dev/packages/@glimmer/util/index.js +1 -2
- package/dist/dev/packages/@glimmer/validator/index.js +4 -1253
- package/dist/dev/packages/@glimmer/vm/index.js +1 -1
- package/dist/dev/packages/@glimmer/wire-format/index.js +3 -65
- package/dist/dev/packages/ember/version.js +1 -1
- package/dist/dev/packages/ember-template-compiler/index.js +7 -7
- package/dist/dev/packages/shared-chunks/{alias-CSC0WIbj.js → alias-ZcMQckQV.js} +8 -4
- package/dist/dev/packages/shared-chunks/api-BAmlf_CN.js +310 -0
- package/dist/dev/packages/shared-chunks/{api-BQMslHhq.js → api-BawZUDYD.js} +5 -6
- package/dist/dev/packages/shared-chunks/{args-proxy-DgXMc9b5.js → args-proxy-BNLuRFlO.js} +2 -4
- package/dist/dev/packages/shared-chunks/{array-D8PfjQHi.js → array-Bh_kUjzy.js} +2 -1
- package/dist/dev/packages/shared-chunks/assert-Zqc4wiAV.js +6 -0
- package/dist/dev/packages/shared-chunks/cache-B7dqAS38.js +596 -0
- package/dist/dev/packages/shared-chunks/{capabilities-O_xc7Yqk.js → capabilities-CZkuOqqC.js} +0 -5
- package/dist/dev/packages/shared-chunks/chain-tags-D6tuFUj_.js +190 -0
- package/dist/dev/packages/shared-chunks/{collections-D_nY_0UJ.js → collections-DPkjqeA3.js} +0 -1
- package/dist/dev/packages/shared-chunks/{compiler-D1leQ3Gl.js → compiler-QUSl_urU.js} +7043 -235
- package/dist/dev/packages/shared-chunks/computed-CJnghmXC.js +980 -0
- package/dist/dev/packages/shared-chunks/container-BzzHmCNj.js +404 -0
- package/dist/dev/packages/shared-chunks/curly-BBzF_bI8.js +617 -0
- package/dist/dev/packages/shared-chunks/curried-BZnYakIg.js +5 -0
- package/dist/dev/packages/shared-chunks/{debug-to-string-CFb7h0lY.js → debug-to-string-C6LsA_qz.js} +1 -2
- package/dist/dev/packages/shared-chunks/decorator-B5Uh5NFI.js +135 -0
- package/dist/dev/packages/shared-chunks/element-DQJOvSlQ.js +109 -0
- package/dist/dev/packages/shared-chunks/element-builder--iTIJyCB.js +812 -0
- package/dist/dev/packages/shared-chunks/env-g-kaAFLN.js +161 -0
- package/dist/dev/packages/shared-chunks/events-6aFVjD4k.js +180 -0
- package/dist/dev/packages/shared-chunks/get-D5b5QlqE.js +138 -0
- package/dist/dev/packages/shared-chunks/get-debug-name-CSniHBsn.js +45 -0
- package/dist/dev/packages/shared-chunks/get_properties-CIm8IAtP.js +55 -0
- package/dist/dev/packages/shared-chunks/guid-Cbq2sNV_.js +123 -0
- package/dist/dev/packages/shared-chunks/hash-BRRFQJ99.js +192 -0
- package/dist/dev/packages/shared-chunks/helper-Do7NCZHI.js +314 -0
- package/dist/dev/packages/shared-chunks/index-CwnQYqK5.js +2500 -0
- package/dist/dev/packages/shared-chunks/{index-BUPd6pkm.js → index-CyZiGiEI.js} +28 -29
- package/dist/dev/packages/shared-chunks/index-D-xTBV4B.js +220 -0
- package/dist/dev/packages/shared-chunks/injected_property-B4T-FzZZ.js +70 -0
- package/dist/dev/packages/shared-chunks/intern-zquhAEIg.js +51 -0
- package/dist/dev/packages/shared-chunks/internal-CAL-jHZt.js +140 -0
- package/dist/dev/packages/shared-chunks/internal-helper-Ez7zbEIa.js +7 -0
- package/dist/dev/packages/shared-chunks/{neq-DujMPv1k.js → invoke-B8M5fQQS.js} +4 -32
- package/dist/{prod/packages/shared-chunks/is_proxy-Cr1qlMv_.js → dev/packages/shared-chunks/is_proxy-Bzg0d4m4.js} +1 -1
- package/dist/dev/packages/shared-chunks/libraries-CHBwbR72.js +79 -0
- package/dist/dev/packages/shared-chunks/mandatory-setter-BpbAMTzV.js +107 -0
- package/dist/dev/packages/shared-chunks/meta-BmRXesrk.js +46 -0
- package/dist/{prod/packages/shared-chunks/name-C68GLLO3.js → dev/packages/shared-chunks/name-Clp4Vsod.js} +1 -1
- package/dist/dev/packages/shared-chunks/{namespace_search-uT8odThF.js → namespace_search-BfvzEQzN.js} +1 -2
- package/dist/dev/packages/shared-chunks/normalize-CKySQVU7.js +84 -0
- package/dist/dev/packages/shared-chunks/observers-C2DurkLG.js +199 -0
- package/dist/dev/packages/shared-chunks/on-BueSMv9L.js +253 -0
- package/dist/dev/packages/shared-chunks/opcodes-CplRyHl_.js +50 -0
- package/dist/dev/packages/shared-chunks/or-O0eJQ4K-.js +118 -0
- package/dist/{prod/packages/shared-chunks/program-B7SJZ5NF.js → dev/packages/shared-chunks/program-DzAfcWFj.js} +1 -1
- package/dist/{prod/packages/shared-chunks/program-context-DFiwaPMR.js → dev/packages/shared-chunks/program-context-CadjldRr.js} +4 -3
- package/dist/dev/packages/shared-chunks/property_get-CIBS9umw.js +139 -0
- package/dist/dev/packages/shared-chunks/{property_set-DaoZXGM5.js → property_set-D3PKyisF.js} +4 -2
- package/dist/dev/packages/shared-chunks/props-fiqxqhAH.js +85 -0
- package/dist/dev/packages/shared-chunks/{reference-C3TKDRnP.js → reference-BoPB2LfI.js} +3 -4
- package/dist/{prod/packages/shared-chunks/registers-ylirb0dq.js → dev/packages/shared-chunks/registers-C_W2qYHJ.js} +1 -1
- package/dist/{prod/packages/shared-chunks/rehydrate-builder-D3t52iGR.js → dev/packages/shared-chunks/rehydrate-builder-DCyIgnCR.js} +7 -4
- package/dist/dev/packages/shared-chunks/{render-DCchifOK.js → render-CpKaO-BO.js} +512 -16
- package/dist/{prod/packages/shared-chunks/chunk-3SQBS3Y5-Cj4eryg1.js → dev/packages/shared-chunks/runtime-CYyqkz5q-BOdRhmsS.js} +4 -59
- package/dist/{prod/packages/shared-chunks/serialize-builder-iXiRs1Pg.js → dev/packages/shared-chunks/serialize-builder-DxgGRvH_.js} +2 -7
- package/dist/dev/packages/shared-chunks/set_properties-BghuuGJx.js +48 -0
- package/dist/dev/packages/shared-chunks/{setup-registry-DxchCIL2.js → setup-registry-BC5VMvei.js} +34 -14
- package/dist/dev/packages/shared-chunks/spec-BXl1reqK.js +16 -0
- package/dist/dev/packages/shared-chunks/super-BBBjgF69.js +91 -0
- package/dist/dev/packages/shared-chunks/syscall-ops-BPFtDquC.js +133 -0
- package/dist/dev/packages/shared-chunks/template-BRrQR6KS.js +16 -0
- package/dist/dev/packages/shared-chunks/{template-kM-7TTcc.js → template-R_5UMHhb.js} +1 -1
- package/dist/dev/packages/shared-chunks/template-only-BqOt8bDl.js +78 -0
- package/dist/dev/packages/shared-chunks/textarea-WSlUEr0y.js +468 -0
- package/dist/dev/packages/shared-chunks/tracked-CKE4wnE6.js +148 -0
- package/dist/dev/packages/shared-chunks/tracked-data-CGnA4ytZ.js +31 -0
- package/dist/dev/packages/shared-chunks/transform-resolutions-h1ik8gqW.js +645 -0
- package/dist/dev/packages/shared-chunks/unique-id-CgmHQiwi.js +32 -0
- package/dist/{prod/packages/shared-chunks/on-CersD7PL.js → dev/packages/shared-chunks/untouchable-this-B3DVwpHS.js} +215 -1397
- package/dist/dev/packages/shared-chunks/vm-ops-ImHv0Wtg.js +12 -0
- package/dist/dev/packages/shared-chunks/well-known-_EVO9RaV.js +17 -0
- package/dist/prod/packages/@ember/-internals/container/index.js +4 -315
- package/dist/prod/packages/@ember/-internals/deprecations/index.js +1 -1
- package/dist/prod/packages/@ember/-internals/environment/index.js +3 -158
- package/dist/prod/packages/@ember/-internals/glimmer/index.js +14 -13
- package/dist/prod/packages/@ember/-internals/meta/lib/meta.js +0 -3
- package/dist/prod/packages/@ember/-internals/metal/index.js +18 -13
- package/dist/prod/packages/@ember/-internals/routing/index.js +1 -6
- package/dist/prod/packages/@ember/-internals/runtime/lib/ext/rsvp.js +0 -1
- package/dist/prod/packages/@ember/-internals/runtime/lib/mixins/-proxy.js +9 -10
- package/dist/prod/packages/@ember/-internals/runtime/lib/mixins/action_handler.js +1 -6
- package/dist/prod/packages/@ember/-internals/runtime/lib/mixins/registry_proxy.js +0 -1
- package/dist/prod/packages/@ember/-internals/runtime/lib/mixins/target_action_support.js +2 -6
- package/dist/prod/packages/@ember/-internals/string/index.js +0 -2
- package/dist/prod/packages/@ember/-internals/utils/index.js +32 -30
- package/dist/prod/packages/@ember/-internals/views/index.js +0 -1
- package/dist/prod/packages/@ember/-internals/views/lib/compat/fallback-view-registry.js +0 -2
- package/dist/prod/packages/@ember/-internals/views/lib/mixins/action_support.js +1 -6
- package/dist/prod/packages/@ember/-internals/views/lib/system/event_dispatcher.js +2 -7
- package/dist/prod/packages/@ember/-internals/views/lib/system/utils.js +1 -2
- package/dist/prod/packages/@ember/-internals/views/lib/views/core_view.js +2 -15
- package/dist/prod/packages/@ember/-internals/views/lib/views/states.js +0 -2
- package/dist/prod/packages/@ember/application/index.js +5 -24
- package/dist/prod/packages/@ember/application/instance.js +5 -18
- package/dist/prod/packages/@ember/application/namespace.js +4 -8
- package/dist/prod/packages/@ember/array/index.js +7 -12
- package/dist/prod/packages/@ember/array/proxy.js +9 -10
- package/dist/prod/packages/@ember/canary-features/index.js +1 -1
- package/dist/prod/packages/@ember/component/helper.js +1 -12
- package/dist/prod/packages/@ember/component/index.js +1291 -15
- package/dist/prod/packages/@ember/component/template-only.js +1 -6
- package/dist/prod/packages/@ember/controller/index.js +3 -16
- package/dist/prod/packages/@ember/debug/container-debug-adapter.js +1 -15
- package/dist/prod/packages/@ember/debug/data-adapter.js +5 -7
- package/dist/prod/packages/@ember/debug/index.js +1 -1
- package/dist/prod/packages/@ember/debug/lib/deprecate.js +1 -1
- package/dist/prod/packages/@ember/engine/index.js +3 -27
- package/dist/prod/packages/@ember/engine/instance.js +3 -9
- package/dist/prod/packages/@ember/helper/index.js +159 -19
- package/dist/prod/packages/@ember/instrumentation/index.js +1 -1
- package/dist/prod/packages/@ember/modifier/index.js +2 -14
- package/dist/prod/packages/@ember/modifier/on.js +1 -6
- package/dist/prod/packages/@ember/object/-internals.js +2 -6
- package/dist/prod/packages/@ember/object/compat.js +3 -7
- package/dist/prod/packages/@ember/object/computed.js +2 -8
- package/dist/prod/packages/@ember/object/core.js +8 -15
- package/dist/prod/packages/@ember/object/evented.js +2 -7
- package/dist/prod/packages/@ember/object/events.js +1 -6
- package/dist/prod/packages/@ember/object/index.js +10 -12
- package/dist/prod/packages/@ember/object/internals.js +2 -6
- package/dist/prod/packages/@ember/object/lib/computed/computed_macros.js +5 -20
- package/dist/prod/packages/@ember/object/lib/computed/reduce_computed_macros.js +2 -9
- package/dist/prod/packages/@ember/object/mixin.js +6 -9
- package/dist/prod/packages/@ember/object/observable.js +7 -9
- package/dist/prod/packages/@ember/object/observers.js +1 -6
- package/dist/prod/packages/@ember/object/promise-proxy-mixin.js +3 -9
- package/dist/prod/packages/@ember/object/proxy.js +0 -7
- package/dist/prod/packages/@ember/reactive/collections.js +591 -1
- package/dist/prod/packages/@ember/renderer/index.js +1 -12
- package/dist/prod/packages/@ember/routing/history-location.js +0 -1
- package/dist/prod/packages/@ember/routing/index.js +580 -12
- package/dist/prod/packages/@ember/routing/lib/dsl.js +0 -2
- package/dist/prod/packages/@ember/routing/lib/generate_controller.js +1 -6
- package/dist/prod/packages/@ember/routing/lib/routing-service.js +4 -14
- package/dist/prod/packages/@ember/routing/lib/utils.js +1 -6
- package/dist/prod/packages/@ember/routing/none-location.js +0 -1
- package/dist/prod/packages/@ember/routing/route.js +12 -22
- package/dist/prod/packages/@ember/routing/router-service.js +6 -15
- package/dist/prod/packages/@ember/routing/router.js +4 -17
- package/dist/prod/packages/@ember/runloop/index.js +1 -6
- package/dist/prod/packages/@ember/service/index.js +1 -7
- package/dist/prod/packages/@ember/template/index.js +1 -12
- package/dist/prod/packages/@ember/template-compiler/lib/compile-options.js +12 -14
- package/dist/prod/packages/@ember/template-compiler/lib/dasherize-component-name.js +0 -2
- package/dist/prod/packages/@ember/template-compiler/lib/plugins/assert-against-attrs.js +0 -1
- package/dist/prod/packages/@ember/template-compiler/lib/plugins/assert-against-named-outlets.js +0 -1
- package/dist/prod/packages/@ember/template-compiler/lib/plugins/assert-input-helper-without-block.js +0 -1
- package/dist/prod/packages/@ember/template-compiler/lib/plugins/assert-reserved-named-arguments.js +0 -2
- package/dist/prod/packages/@ember/template-compiler/lib/plugins/auto-import-builtins.js +13 -60
- package/dist/prod/packages/@ember/template-compiler/lib/plugins/index.js +1 -1
- package/dist/prod/packages/@ember/template-compiler/lib/plugins/transform-each-track-array.js +0 -1
- package/dist/prod/packages/@ember/template-compiler/lib/plugins/transform-in-element.js +0 -1
- package/dist/prod/packages/@ember/template-compiler/lib/plugins/transform-resolutions.js +126 -4
- package/dist/prod/packages/@ember/template-compiler/lib/template.js +2 -7
- package/dist/prod/packages/@ember/template-factory/index.js +1 -5
- package/dist/prod/packages/@ember/utils/lib/compare.js +0 -8
- package/dist/prod/packages/@ember/utils/lib/is_empty.js +1 -7
- package/dist/prod/packages/@glimmer/manager/index.js +4 -292
- package/dist/prod/packages/@glimmer/node/index.js +3 -8
- package/dist/prod/packages/@glimmer/opcode-compiler/index.js +2 -5
- package/dist/prod/packages/@glimmer/program/index.js +194 -3
- package/dist/prod/packages/@glimmer/reference/index.js +4 -4
- package/dist/prod/packages/@glimmer/runtime/index.js +14 -8
- package/dist/prod/packages/@glimmer/tracking/index.js +2 -7
- package/dist/prod/packages/@glimmer/tracking/primitives/cache/index.js +1 -6
- package/dist/prod/packages/@glimmer/util/index.js +2 -2
- package/dist/prod/packages/@glimmer/validator/index.js +5 -1016
- package/dist/prod/packages/@glimmer/vm/index.js +1 -1
- package/dist/prod/packages/@glimmer/wire-format/index.js +3 -65
- package/dist/prod/packages/ember/version.js +1 -1
- package/dist/prod/packages/ember-template-compiler/index.js +4 -7
- package/dist/prod/packages/shared-chunks/{alias-BLBQkche.js → alias-DBW_V5vD.js} +7 -6
- package/dist/prod/packages/shared-chunks/api-CM1trl_4.js +289 -0
- package/dist/prod/packages/shared-chunks/{api-B5UrgITK.js → api-zh_k31vb.js} +4 -5
- package/dist/prod/packages/shared-chunks/{args-proxy-Dl0A0YWI.js → args-proxy-BDXbXCF9.js} +2 -2
- package/dist/prod/packages/shared-chunks/{array-kVQfzrQn.js → array-D6Couewv.js} +2 -3
- package/dist/prod/packages/shared-chunks/assert-Zqc4wiAV.js +6 -0
- package/dist/prod/packages/shared-chunks/cache-BIlOoPA7.js +371 -0
- package/dist/prod/packages/shared-chunks/{capabilities-DXA-L0iT.js → capabilities-_5e35539.js} +0 -3
- package/dist/prod/packages/shared-chunks/chain-tags-C9rFtQ_x.js +178 -0
- package/dist/prod/packages/shared-chunks/{compiler-Bbki2GT_.js → compiler-c4yUVrl_.js} +7044 -193
- package/dist/prod/packages/shared-chunks/{namespace_search-Dcdalhj6.js → computed-DjCIU_ht.js} +108 -239
- package/dist/prod/packages/shared-chunks/container-BYOnjnwz.js +315 -0
- package/dist/prod/packages/shared-chunks/curly-ZzX43b50.js +545 -0
- package/dist/prod/packages/shared-chunks/curried-BZnYakIg.js +5 -0
- package/dist/prod/packages/shared-chunks/debug-render-tree-CF5O4-WI.js +2049 -0
- package/dist/prod/packages/shared-chunks/{decorator-BdDDBUd2.js → decorator-9ikVwsjY.js} +0 -1
- package/dist/prod/packages/shared-chunks/element-DUOVW5Ho.js +100 -0
- package/dist/prod/packages/shared-chunks/{element-builder-CzXb9l1W.js → element-builder-CnlTPNyw.js} +109 -88
- package/dist/prod/packages/shared-chunks/env-DXxsTFkM.js +158 -0
- package/dist/prod/packages/shared-chunks/events-DYrYz3V8.js +174 -0
- package/dist/prod/packages/shared-chunks/get-t0-itmA-.js +138 -0
- package/dist/prod/packages/shared-chunks/get_properties-Nn08mLAH.js +55 -0
- package/dist/prod/packages/shared-chunks/guid-Cbq2sNV_.js +123 -0
- package/dist/prod/packages/shared-chunks/hash-mcs3pEFO.js +192 -0
- package/dist/prod/packages/shared-chunks/helper-DLjV2ZZW.js +298 -0
- package/dist/prod/packages/shared-chunks/{index-CjaDF9kC.js → index-Bj71BDDA.js} +17 -10
- package/dist/prod/packages/shared-chunks/index-D-xTBV4B.js +220 -0
- package/dist/prod/packages/shared-chunks/index-qDFz6Mfe.js +2322 -0
- package/dist/prod/packages/shared-chunks/{injected_property-CTVs5FPh.js → injected_property--eJunJph.js} +2 -3
- package/dist/prod/packages/shared-chunks/intern-zquhAEIg.js +51 -0
- package/dist/prod/packages/shared-chunks/internal-DidurjJB.js +137 -0
- package/dist/prod/packages/shared-chunks/internal-helper-DIbr1RgC.js +7 -0
- package/dist/prod/packages/shared-chunks/{neq-BqdovTuC.js → invoke-Cj5zMqHz.js} +4 -24
- package/dist/{dev/packages/shared-chunks/is_proxy-B0smdQy8.js → prod/packages/shared-chunks/is_proxy-Bzg0d4m4.js} +1 -1
- package/dist/prod/packages/shared-chunks/libraries-_k-4KK5_.js +59 -0
- package/dist/prod/packages/shared-chunks/meta-B9mldqPL.js +36 -0
- package/dist/{dev/packages/shared-chunks/name-Z7dpqvzn.js → prod/packages/shared-chunks/name-Clp4Vsod.js} +1 -1
- package/dist/prod/packages/shared-chunks/namespace_search-BfvzEQzN.js +134 -0
- package/dist/prod/packages/shared-chunks/normalize-D9jDJVGg.js +84 -0
- package/dist/prod/packages/shared-chunks/observers-CDkeR0nI.js +199 -0
- package/dist/prod/packages/shared-chunks/on-B5NVufs_.js +228 -0
- package/dist/prod/packages/shared-chunks/opcodes-CplRyHl_.js +50 -0
- package/dist/prod/packages/shared-chunks/or-3AxY5TPj.js +91 -0
- package/dist/{dev/packages/shared-chunks/program-DfV0v8aa.js → prod/packages/shared-chunks/program-B7CWdS8W.js} +1 -2
- package/dist/{dev/packages/shared-chunks/program-context-sJz0oHOA.js → prod/packages/shared-chunks/program-context-B8HKU7wu.js} +4 -3
- package/dist/prod/packages/shared-chunks/property_get-CAFdpRyu.js +121 -0
- package/dist/prod/packages/shared-chunks/{property_set-B2sZxeCw.js → property_set-BunbMFtp.js} +3 -5
- package/dist/prod/packages/shared-chunks/props-fiqxqhAH.js +85 -0
- package/dist/prod/packages/shared-chunks/{reference-BNqcwZWH.js → reference-BshxG6wn.js} +3 -3
- package/dist/{dev/packages/shared-chunks/registers-ylirb0dq.js → prod/packages/shared-chunks/registers-C_W2qYHJ.js} +1 -1
- package/dist/{dev/packages/shared-chunks/rehydrate-builder-BRH0p0wA.js → prod/packages/shared-chunks/rehydrate-builder-DJ8k-6fg.js} +7 -7
- package/dist/prod/packages/shared-chunks/{render-D78XHdek.js → render-DkJJmoI4.js} +488 -12
- package/dist/{dev/packages/shared-chunks/chunk-3SQBS3Y5-Cj4eryg1.js → prod/packages/shared-chunks/runtime-CYyqkz5q-BOdRhmsS.js} +4 -59
- package/dist/{dev/packages/shared-chunks/serialize-builder-DiO7Ak9_.js → prod/packages/shared-chunks/serialize-builder-R3Ozg0sC.js} +2 -10
- package/dist/prod/packages/shared-chunks/set_properties-LT3RzRmJ.js +48 -0
- package/dist/prod/packages/shared-chunks/{setup-registry-Cs-7NIJU.js → setup-registry-C2KfZJWI.js} +34 -13
- package/dist/prod/packages/shared-chunks/spec-BXl1reqK.js +16 -0
- package/dist/prod/packages/shared-chunks/super-BBBjgF69.js +91 -0
- package/dist/prod/packages/shared-chunks/syscall-ops-BPFtDquC.js +133 -0
- package/dist/prod/packages/shared-chunks/template-BRrQR6KS.js +16 -0
- package/dist/prod/packages/shared-chunks/template-only-BtLl0uH0.js +78 -0
- package/dist/prod/packages/shared-chunks/textarea-CHqL0Rdh.js +454 -0
- package/dist/prod/packages/shared-chunks/{tracked-Cl5l4v8b.js → tracked-DAVrVqJl.js} +5 -4
- package/dist/prod/packages/shared-chunks/tracked-data-C83f5V5S.js +31 -0
- package/dist/prod/packages/shared-chunks/unique-id-CfHImDRV.js +32 -0
- package/dist/prod/packages/shared-chunks/vm-ops-ImHv0Wtg.js +12 -0
- package/dist/prod/packages/shared-chunks/well-known-_EVO9RaV.js +17 -0
- package/docs/data.json +1237 -1023
- package/lib/index.js +0 -1
- package/package.json +14 -12
- package/types/stable/@ember/-internals/container/lib/registry.d.ts +1 -1
- package/types/stable/@ember/-internals/deprecations/index.d.ts +1 -1
- package/types/stable/@ember/-internals/glimmer/index.d.ts +1 -1
- package/types/stable/@ember/-internals/glimmer/lib/component-managers/curly.d.ts +1 -1
- package/types/stable/@ember/-internals/glimmer/lib/component-managers/mount.d.ts +1 -1
- package/types/stable/@ember/-internals/glimmer/lib/component-managers/outlet.d.ts +1 -1
- package/types/stable/@ember/-internals/glimmer/lib/component-managers/route-template.d.ts +2 -2
- package/types/stable/@ember/-internals/glimmer/lib/component.d.ts +9 -7
- package/types/stable/@ember/-internals/glimmer/lib/components/abstract-input.d.ts +1 -1
- package/types/stable/@ember/-internals/glimmer/lib/dom.d.ts +6 -2
- package/types/stable/@ember/-internals/glimmer/lib/environment.d.ts +1 -1
- package/types/stable/@ember/-internals/glimmer/lib/helper.d.ts +1 -1
- package/types/stable/@ember/-internals/glimmer/lib/renderer.d.ts +3 -3
- package/types/stable/@ember/-internals/glimmer/lib/setup-registry.d.ts +1 -1
- package/types/stable/@ember/-internals/glimmer/lib/utils/bindings.d.ts +1 -1
- package/types/stable/@ember/-internals/glimmer/lib/utils/curly-component-state-bucket.d.ts +3 -2
- package/types/stable/@ember/-internals/glimmer/lib/utils/iterator.d.ts +1 -1
- package/types/stable/@ember/-internals/glimmer/lib/utils/managers.d.ts +2 -1
- package/types/stable/@ember/-internals/glimmer/lib/utils/serialization-first-node-helpers.d.ts +1 -1
- package/types/stable/@ember/-internals/glimmer/lib/utils/string.d.ts +1 -1
- package/types/stable/@ember/-internals/meta/lib/meta.d.ts +3 -2
- package/types/stable/@ember/-internals/metal/lib/cache.d.ts +1 -1
- package/types/stable/@ember/-internals/metal/lib/chain-tags.d.ts +3 -2
- package/types/stable/@ember/-internals/metal/lib/computed.d.ts +1 -1
- package/types/stable/@ember/-internals/metal/lib/decorator.d.ts +1 -1
- package/types/stable/@ember/-internals/metal/lib/deprecate_property.d.ts +1 -1
- package/types/stable/@ember/-internals/metal/lib/events.d.ts +1 -1
- package/types/stable/@ember/-internals/metal/lib/observer.d.ts +1 -1
- package/types/stable/@ember/-internals/metal/lib/properties.d.ts +1 -1
- package/types/stable/@ember/-internals/metal/lib/property_events.d.ts +1 -1
- package/types/stable/@ember/-internals/metal/lib/tags.d.ts +2 -1
- package/types/stable/@ember/-internals/runtime/lib/mixins/container_proxy.d.ts +1 -1
- package/types/stable/@ember/-internals/runtime/lib/mixins/registry_proxy.d.ts +1 -1
- package/types/stable/@ember/-internals/utils/lib/is_proxy.d.ts +1 -1
- package/types/stable/@ember/-internals/utils/lib/mandatory-setter.d.ts +1 -1
- package/types/stable/@ember/-internals/views/index.d.ts +0 -1
- package/types/stable/@ember/-internals/views/lib/system/utils.d.ts +1 -1
- package/types/stable/@ember/-internals/views/lib/views/core_view.d.ts +2 -2
- package/types/stable/@ember/-internals/views/lib/views/states.d.ts +1 -1
- package/types/stable/@ember/application/index.d.ts +5 -4
- package/types/stable/@ember/application/instance.d.ts +4 -3
- package/types/stable/@ember/application/namespace.d.ts +1 -1
- package/types/stable/@ember/array/proxy.d.ts +4 -3
- package/types/stable/@ember/component/helper.d.ts +1 -1
- package/types/stable/@ember/component/index.d.ts +6 -3
- package/types/stable/@ember/controller/index.d.ts +2 -2
- package/types/stable/@ember/debug/container-debug-adapter.d.ts +1 -1
- package/types/stable/@ember/engine/index.d.ts +3 -3
- package/types/stable/@ember/engine/instance.d.ts +4 -3
- package/types/stable/@ember/helper/index.d.ts +167 -5
- package/types/stable/@ember/modifier/index.d.ts +1 -1
- package/types/stable/@ember/object/-internals.d.ts +2 -2
- package/types/stable/@ember/object/compat.d.ts +2 -2
- package/types/stable/@ember/object/computed.d.ts +3 -1
- package/types/stable/@ember/object/evented.d.ts +1 -1
- package/types/stable/@ember/object/events.d.ts +1 -1
- package/types/stable/@ember/object/index.d.ts +8 -2
- package/types/stable/@ember/object/lib/computed/computed_macros.d.ts +1 -1
- package/types/stable/@ember/object/mixin.d.ts +1 -1
- package/types/stable/@ember/object/observers.d.ts +1 -1
- package/types/stable/@ember/object/proxy.d.ts +1 -1
- package/types/stable/@ember/reactive/collections.d.ts +6 -6
- package/types/stable/@ember/renderer/index.d.ts +2 -2
- package/types/stable/@ember/routing/index.d.ts +1 -1
- package/types/stable/@ember/routing/lib/controller_for.d.ts +2 -2
- package/types/stable/@ember/routing/route.d.ts +2 -2
- package/types/stable/@ember/routing/router.d.ts +2 -2
- package/types/stable/@ember/service/index.d.ts +1 -1
- package/types/stable/@ember/template/index.d.ts +1 -1
- package/types/stable/@ember/template-compiler/lib/dasherize-component-name.d.ts +1 -1
- package/types/stable/@ember/template-compiler/lib/plugins/assert-against-attrs.d.ts +1 -1
- package/types/stable/@ember/template-compiler/lib/plugins/assert-against-named-outlets.d.ts +1 -1
- package/types/stable/@ember/template-compiler/lib/plugins/assert-input-helper-without-block.d.ts +1 -1
- package/types/stable/@ember/template-compiler/lib/plugins/assert-reserved-named-arguments.d.ts +1 -1
- package/types/stable/@ember/template-compiler/lib/plugins/auto-import-builtins.d.ts +1 -4
- package/types/stable/@ember/template-compiler/lib/plugins/transform-action-syntax.d.ts +1 -1
- package/types/stable/@ember/template-compiler/lib/plugins/transform-each-in-into-each.d.ts +1 -1
- package/types/stable/@ember/template-compiler/lib/plugins/transform-each-track-array.d.ts +1 -1
- package/types/stable/@ember/template-compiler/lib/plugins/transform-in-element.d.ts +1 -1
- package/types/stable/@ember/template-compiler/lib/plugins/transform-quoted-bindings-into-just-bindings.d.ts +1 -1
- package/types/stable/@ember/template-compiler/lib/plugins/transform-resolutions.d.ts +1 -1
- package/types/stable/@ember/template-compiler/lib/plugins/transform-wrap-mount-and-outlet.d.ts +1 -1
- package/types/stable/@ember/template-compiler/lib/plugins/utils.d.ts +1 -1
- package/types/stable/@ember/template-compiler/lib/system/calculate-location-display.d.ts +1 -1
- package/types/stable/@ember/template-compiler/lib/types.d.ts +2 -1
- package/types/stable/@ember/template-factory/index.d.ts +1 -1
- package/types/stable/@glimmer/compiler/lib/builder/builder-interface.d.ts +2 -2
- package/types/stable/@glimmer/compiler/lib/builder/builder.d.ts +2 -2
- package/types/stable/@glimmer/compiler/lib/compiler.d.ts +1 -1
- package/types/stable/@glimmer/compiler/lib/passes/1-normalization/context.d.ts +2 -1
- package/types/stable/@glimmer/compiler/lib/passes/1-normalization/index.d.ts +2 -1
- package/types/stable/@glimmer/compiler/lib/passes/1-normalization/keywords/impl.d.ts +2 -1
- package/types/stable/@glimmer/compiler/lib/passes/1-normalization/keywords/utils/curry.d.ts +1 -1
- package/types/stable/@glimmer/compiler/lib/passes/1-normalization/keywords/utils/dynamic-vars.d.ts +1 -1
- package/types/stable/@glimmer/compiler/lib/passes/1-normalization/keywords/utils/has-block.d.ts +2 -1
- package/types/stable/@glimmer/compiler/lib/passes/1-normalization/keywords/utils/if-unless.d.ts +1 -1
- package/types/stable/@glimmer/compiler/lib/passes/1-normalization/keywords/utils/log.d.ts +1 -1
- package/types/stable/@glimmer/compiler/lib/passes/1-normalization/visitors/element/classified.d.ts +1 -1
- package/types/stable/@glimmer/compiler/lib/passes/1-normalization/visitors/element/component.d.ts +1 -1
- package/types/stable/@glimmer/compiler/lib/passes/1-normalization/visitors/element/simple-element.d.ts +2 -1
- package/types/stable/@glimmer/compiler/lib/passes/1-normalization/visitors/expressions.d.ts +1 -1
- package/types/stable/@glimmer/compiler/lib/passes/1-normalization/visitors/statements.d.ts +1 -1
- package/types/stable/@glimmer/compiler/lib/passes/1-normalization/visitors/strict-mode.d.ts +1 -1
- package/types/stable/@glimmer/compiler/lib/passes/2-encoding/expressions.d.ts +1 -1
- package/types/stable/@glimmer/compiler/lib/passes/2-encoding/mir.d.ts +3 -1
- package/types/stable/@glimmer/compiler/lib/shared/result.d.ts +1 -1
- package/types/stable/@glimmer/manager/lib/public/component.d.ts +1 -1
- package/types/stable/@glimmer/manager/lib/util/args-proxy.d.ts +1 -1
- package/types/stable/@glimmer/manager/lib/util/capabilities.d.ts +1 -1
- package/types/stable/@glimmer/node/lib/node-dom-helper.d.ts +1 -1
- package/types/stable/@glimmer/opcode-compiler/lib/opcode-builder/helpers/components.d.ts +1 -1
- package/types/stable/@glimmer/runtime/index.d.ts +7 -4
- package/types/stable/@glimmer/runtime/lib/compiled/expressions/concat.d.ts +1 -1
- package/types/stable/@glimmer/runtime/lib/compiled/opcodes/-debug-strip.d.ts +4 -3
- package/types/stable/@glimmer/runtime/lib/compiled/opcodes/component.d.ts +1 -1
- package/types/stable/@glimmer/runtime/lib/compiled/opcodes/dom.d.ts +2 -2
- package/types/stable/@glimmer/runtime/lib/compiled/opcodes/vm.d.ts +2 -2
- package/types/stable/@glimmer/runtime/lib/component/template-only.d.ts +1 -1
- package/types/stable/@glimmer/runtime/lib/curried-value.d.ts +1 -1
- package/types/stable/@glimmer/runtime/lib/helpers/and.d.ts +3 -0
- package/types/stable/@glimmer/runtime/lib/helpers/gt.d.ts +8 -0
- package/types/stable/@glimmer/runtime/lib/helpers/gte.d.ts +8 -0
- package/types/stable/@glimmer/runtime/lib/helpers/invoke.d.ts +1 -1
- package/types/stable/@glimmer/runtime/lib/helpers/lt.d.ts +8 -0
- package/types/stable/@glimmer/runtime/lib/helpers/lte.d.ts +8 -0
- package/types/stable/@glimmer/runtime/lib/helpers/not.d.ts +3 -0
- package/types/stable/@glimmer/runtime/lib/helpers/or.d.ts +3 -0
- package/types/stable/@glimmer/runtime/lib/opcodes.d.ts +2 -2
- package/types/stable/@glimmer/runtime/lib/references/class-list.d.ts +1 -1
- package/types/stable/@glimmer/runtime/lib/references/curry-value.d.ts +1 -1
- package/types/stable/@glimmer/runtime/lib/render.d.ts +1 -1
- package/types/stable/@glimmer/runtime/lib/scope.d.ts +1 -1
- package/types/stable/@glimmer/runtime/lib/vm/append.d.ts +3 -2
- package/types/stable/@glimmer/runtime/lib/vm/arguments.d.ts +2 -2
- package/types/stable/@glimmer/runtime/lib/vm/content/text.d.ts +1 -1
- package/types/stable/@glimmer/runtime/lib/vm/element-builder.d.ts +1 -1
- package/types/stable/@glimmer/runtime/lib/vm/low-level.d.ts +2 -1
- package/types/stable/@glimmer/runtime/lib/vm/rehydrate-builder.d.ts +1 -1
- package/types/stable/@glimmer/runtime/lib/vm/update.d.ts +2 -1
- package/types/stable/@glimmer/syntax/lib/keywords.d.ts +2 -2
- package/types/stable/@glimmer/tracking/index.d.ts +2 -1
- package/types/stable/@glimmer/tracking/primitives/cache.d.ts +1 -1
- package/types/stable/index.d.ts +7 -1
- package/dist/dev/packages/@ember/-internals/views/lib/component_lookup.js +0 -14
- package/dist/dev/packages/shared-chunks/assert-CUCJBR2C.js +0 -19
- package/dist/dev/packages/shared-chunks/constants-BbdWMvgs.js +0 -213
- package/dist/dev/packages/shared-chunks/dynamic-CgX8M02_.js +0 -3823
- package/dist/dev/packages/shared-chunks/element-builder-BpJIoi99.js +0 -404
- package/dist/dev/packages/shared-chunks/fragment-Cc5k9Oy4.js +0 -911
- package/dist/dev/packages/shared-chunks/index-RzG0Jvjx.js +0 -6306
- package/dist/dev/packages/shared-chunks/mandatory-setter-DHZe7-kW.js +0 -425
- package/dist/dev/packages/shared-chunks/observers-Bj9qLVau.js +0 -2062
- package/dist/dev/packages/shared-chunks/set_properties-kVGzZL_a.js +0 -100
- package/dist/dev/packages/shared-chunks/transform-resolutions-D-YtZ0_g.js +0 -7458
- package/dist/prod/packages/@ember/-internals/views/lib/component_lookup.js +0 -14
- package/dist/prod/packages/shared-chunks/constants-DThhT5fu.js +0 -210
- package/dist/prod/packages/shared-chunks/fragment-D7nBU9ae.js +0 -925
- package/dist/prod/packages/shared-chunks/index-r-Dz_hzt.js +0 -5931
- package/dist/prod/packages/shared-chunks/observers-tZ2aOzr4.js +0 -714
- package/dist/prod/packages/shared-chunks/set_properties-C1T46IiN.js +0 -101
- package/dist/prod/packages/shared-chunks/super-Cm_a_cLQ.js +0 -275
- package/dist/prod/packages/shared-chunks/transform-resolutions-DR4GLmR2.js +0 -6936
- package/types/stable/@ember/-internals/views/lib/component_lookup.d.ts +0 -8
- package/dist/prod/packages/shared-chunks/{collections-GpG8lT2g.js → collections-C3Y8z_9v.js} +9 -9
|
@@ -1,18 +1,1294 @@
|
|
|
1
|
-
import '../../@glimmer/validator/index.js';
|
|
2
|
-
import '../../shared-chunks/reference-BNqcwZWH.js';
|
|
3
|
-
import '../../shared-chunks/capabilities-DXA-L0iT.js';
|
|
4
|
-
import { setComponentManager as setComponentManager$1 } from '../../@glimmer/manager/index.js';
|
|
5
|
-
export { componentCapabilities as capabilities } from '../../@glimmer/manager/index.js';
|
|
6
1
|
export { g as getComponentTemplate, s as setComponentTemplate } from '../../shared-chunks/template-Dc_cBOoX.js';
|
|
7
|
-
import '../../shared-chunks/
|
|
8
|
-
import '../../shared-chunks/
|
|
9
|
-
|
|
10
|
-
import '../-internals/
|
|
11
|
-
import '
|
|
12
|
-
import '../-internals/
|
|
13
|
-
import '
|
|
14
|
-
import '
|
|
15
|
-
import '../
|
|
2
|
+
import { n as nativeDescDecorator } from '../../shared-chunks/decorator-9ikVwsjY.js';
|
|
3
|
+
import { g as get } from '../../shared-chunks/property_get-CAFdpRyu.js';
|
|
4
|
+
import { P as PROPERTY_DID_CHANGE } from '../../shared-chunks/computed-DjCIU_ht.js';
|
|
5
|
+
import { getOwner } from '../-internals/owner/index.js';
|
|
6
|
+
import TargetActionSupport from '../-internals/runtime/lib/mixins/target_action_support.js';
|
|
7
|
+
import ActionSupport from '../-internals/views/lib/mixins/action_support.js';
|
|
8
|
+
import { getViewElement, getChildViews, addChildView } from '../-internals/views/lib/system/utils.js';
|
|
9
|
+
import CoreView from '../-internals/views/lib/views/core_view.js';
|
|
10
|
+
import '../object/index.js';
|
|
11
|
+
import { g as guidFor } from '../../shared-chunks/guid-Cbq2sNV_.js';
|
|
12
|
+
import { s as setInternalComponentManager } from '../../shared-chunks/api-zh_k31vb.js';
|
|
13
|
+
import { d as isUpdatableRef, u as updateRef } from '../../shared-chunks/reference-BshxG6wn.js';
|
|
14
|
+
import { n as normalizeProperty } from '../../shared-chunks/props-fiqxqhAH.js';
|
|
15
|
+
import { p as createTag, D as DIRTY_TAG$1 } from '../../shared-chunks/cache-BIlOoPA7.js';
|
|
16
|
+
import { I as IS_DISPATCHING_ATTRS, D as DIRTY_TAG, B as BOUNDS, g as getComponentCapturedArgs, C as CURLY_COMPONENT_MANAGER } from '../../shared-chunks/curly-ZzX43b50.js';
|
|
17
|
+
import { h as hasDOM } from '../../shared-chunks/has-dom-DdQORPzI.js';
|
|
18
|
+
import { a as decorateMethodV2 } from '../../shared-chunks/runtime-CYyqkz5q-BOdRhmsS.js';
|
|
19
|
+
export { I as Input, T as Textarea } from '../../shared-chunks/textarea-CHqL0Rdh.js';
|
|
20
|
+
import { s as setComponentManager$1 } from '../../shared-chunks/api-CM1trl_4.js';
|
|
21
|
+
export { c as capabilities } from '../../shared-chunks/api-CM1trl_4.js';
|
|
22
|
+
import '../../shared-chunks/capabilities-_5e35539.js';
|
|
23
|
+
|
|
24
|
+
let lazyEventsProcessed = new WeakMap();
|
|
25
|
+
const EMPTY_ARRAY = Object.freeze([]);
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
@module @ember/component
|
|
29
|
+
*/
|
|
30
|
+
|
|
31
|
+
// A zero-runtime-overhead private symbol to use in branding the component to
|
|
32
|
+
// preserve its type parameter.
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
A component is a reusable UI element that consists of a `.hbs` template and an
|
|
36
|
+
optional JavaScript class that defines its behavior. For example, someone
|
|
37
|
+
might make a `button` in the template and handle the click behavior in the
|
|
38
|
+
JavaScript file that shares the same name as the template.
|
|
39
|
+
|
|
40
|
+
Components are broken down into two categories:
|
|
41
|
+
|
|
42
|
+
- Components _without_ JavaScript, that are based only on a template. These
|
|
43
|
+
are called Template-only or TO components.
|
|
44
|
+
- Components _with_ JavaScript, which consist of a template and a backing
|
|
45
|
+
class.
|
|
46
|
+
|
|
47
|
+
Ember ships with two types of JavaScript classes for components:
|
|
48
|
+
|
|
49
|
+
1. Glimmer components, imported from `@glimmer/component`, which are the
|
|
50
|
+
default component's for Ember Octane (3.15) and more recent editions.
|
|
51
|
+
2. Classic components, imported from `@ember/component`, which were the
|
|
52
|
+
default for older editions of Ember (pre 3.15).
|
|
53
|
+
|
|
54
|
+
Below is the documentation for Classic components. If you are looking for the
|
|
55
|
+
API documentation for Template-only or Glimmer components, it is [available
|
|
56
|
+
here](/ember/release/modules/@glimmer%2Fcomponent).
|
|
57
|
+
|
|
58
|
+
## Defining a Classic Component
|
|
59
|
+
|
|
60
|
+
If you want to customize the component in order to handle events, transform
|
|
61
|
+
arguments or maintain internal state, you implement a subclass of `Component`.
|
|
62
|
+
|
|
63
|
+
One example is to add computed properties to your component:
|
|
64
|
+
|
|
65
|
+
```app/components/person-profile.js
|
|
66
|
+
import Component from '@ember/component';
|
|
67
|
+
|
|
68
|
+
export default class extends Component {
|
|
69
|
+
@computed('person.title', 'person.firstName', 'person.lastName')
|
|
70
|
+
get displayName() {
|
|
71
|
+
let { title, firstName, lastName } = this.person;
|
|
72
|
+
|
|
73
|
+
if (title) {
|
|
74
|
+
return `${title} ${lastName}`;
|
|
75
|
+
} else {
|
|
76
|
+
return `${firstName} ${lastName}`;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
And then use it in the component's template:
|
|
83
|
+
|
|
84
|
+
```app/templates/components/person-profile.hbs
|
|
85
|
+
<h1>{{this.displayName}}</h1>
|
|
86
|
+
{{yield}}
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
## Customizing a Classic Component's HTML Element in JavaScript
|
|
90
|
+
|
|
91
|
+
### HTML Tag
|
|
92
|
+
|
|
93
|
+
The default HTML tag name used for a component's HTML representation is `div`.
|
|
94
|
+
This can be customized by setting the `tagName` property.
|
|
95
|
+
|
|
96
|
+
Consider the following component class:
|
|
97
|
+
|
|
98
|
+
```app/components/emphasized-paragraph.js
|
|
99
|
+
import Component from '@ember/component';
|
|
100
|
+
|
|
101
|
+
export default class extends Component {
|
|
102
|
+
tagName = 'em';
|
|
103
|
+
}
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
When invoked, this component would produce output that looks something like
|
|
107
|
+
this:
|
|
108
|
+
|
|
109
|
+
```html
|
|
110
|
+
<em id="ember1" class="ember-view"></em>
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
### HTML `class` Attribute
|
|
114
|
+
|
|
115
|
+
The HTML `class` attribute of a component's tag can be set by providing a
|
|
116
|
+
`classNames` property that is set to an array of strings:
|
|
117
|
+
|
|
118
|
+
```app/components/my-widget.js
|
|
119
|
+
import Component from '@ember/component';
|
|
120
|
+
|
|
121
|
+
export default class extends Component {
|
|
122
|
+
classNames = ['my-class', 'my-other-class'];
|
|
123
|
+
}
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
Invoking this component will produce output that looks like this:
|
|
127
|
+
|
|
128
|
+
```html
|
|
129
|
+
<div id="ember1" class="ember-view my-class my-other-class"></div>
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
`class` attribute values can also be set by providing a `classNameBindings`
|
|
133
|
+
property set to an array of properties names for the component. The return
|
|
134
|
+
value of these properties will be added as part of the value for the
|
|
135
|
+
components's `class` attribute. These properties can be computed properties:
|
|
136
|
+
|
|
137
|
+
```app/components/my-widget.js
|
|
138
|
+
import Component from '@ember/component';
|
|
139
|
+
import { computed } from '@ember/object';
|
|
140
|
+
|
|
141
|
+
export default class extends Component {
|
|
142
|
+
classNames = ['my-class', 'my-other-class'];
|
|
143
|
+
classNameBindings = ['propertyA', 'propertyB'];
|
|
144
|
+
|
|
145
|
+
propertyA = 'from-a';
|
|
146
|
+
|
|
147
|
+
get propertyB {
|
|
148
|
+
if (someLogic) { return 'from-b'; }
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
Invoking this component will produce HTML that looks like:
|
|
154
|
+
|
|
155
|
+
```html
|
|
156
|
+
<div id="ember1" class="ember-view my-class my-other-class from-a from-b"></div>
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
Note that `classNames` and `classNameBindings` is in addition to the `class`
|
|
160
|
+
attribute passed with the angle bracket invocation syntax. Therefore, if this
|
|
161
|
+
component was invoked like so:
|
|
162
|
+
|
|
163
|
+
```handlebars
|
|
164
|
+
<MyWidget class="from-invocation" />
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
The resulting HTML will look similar to this:
|
|
168
|
+
|
|
169
|
+
```html
|
|
170
|
+
<div id="ember1" class="from-invocation ember-view my-class my-other-class from-a from-b"></div>
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
If the value of a class name binding returns a boolean the property name
|
|
174
|
+
itself will be used as the class name if the property is true. The class name
|
|
175
|
+
will not be added if the value is `false` or `undefined`.
|
|
176
|
+
|
|
177
|
+
```app/components/my-widget.js
|
|
178
|
+
import Component from '@ember/component';
|
|
179
|
+
|
|
180
|
+
export default class extends Component {
|
|
181
|
+
classNameBindings = ['hovered'];
|
|
182
|
+
|
|
183
|
+
hovered = true;
|
|
184
|
+
}
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
Invoking this component will produce HTML that looks like:
|
|
188
|
+
|
|
189
|
+
```html
|
|
190
|
+
<div id="ember1" class="ember-view hovered"></div>
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
### Custom Class Names for Boolean Values
|
|
194
|
+
|
|
195
|
+
When using boolean class name bindings you can supply a string value other
|
|
196
|
+
than the property name for use as the `class` HTML attribute by appending the
|
|
197
|
+
preferred value after a ":" character when defining the binding:
|
|
198
|
+
|
|
199
|
+
```app/components/my-widget.js
|
|
200
|
+
import Component from '@ember/component';
|
|
201
|
+
|
|
202
|
+
export default class extends Component {
|
|
203
|
+
classNameBindings = ['awesome:so-very-cool'];
|
|
204
|
+
|
|
205
|
+
awesome = true;
|
|
206
|
+
}
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
Invoking this component will produce HTML that looks like:
|
|
210
|
+
|
|
211
|
+
```html
|
|
212
|
+
<div id="ember1" class="ember-view so-very-cool"></div>
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
Boolean value class name bindings whose property names are in a
|
|
216
|
+
camelCase-style format will be converted to a dasherized format:
|
|
217
|
+
|
|
218
|
+
```app/components/my-widget.js
|
|
219
|
+
import Component from '@ember/component';
|
|
220
|
+
|
|
221
|
+
export default class extends Component {
|
|
222
|
+
classNameBindings = ['isUrgent'];
|
|
223
|
+
|
|
224
|
+
isUrgent = true;
|
|
225
|
+
}
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
Invoking this component will produce HTML that looks like:
|
|
229
|
+
|
|
230
|
+
```html
|
|
231
|
+
<div id="ember1" class="ember-view is-urgent"></div>
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
Class name bindings can also refer to object values that are found by
|
|
235
|
+
traversing a path relative to the component itself:
|
|
236
|
+
|
|
237
|
+
```app/components/my-widget.js
|
|
238
|
+
import Component from '@ember/component';
|
|
239
|
+
import EmberObject from '@ember/object';
|
|
240
|
+
|
|
241
|
+
export default class extends Component {
|
|
242
|
+
classNameBindings = ['messages.empty'];
|
|
243
|
+
|
|
244
|
+
messages = EmberObject.create({
|
|
245
|
+
empty: true
|
|
246
|
+
});
|
|
247
|
+
}
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
Invoking this component will produce HTML that looks like:
|
|
251
|
+
|
|
252
|
+
```html
|
|
253
|
+
<div id="ember1" class="ember-view empty"></div>
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
If you want to add a class name for a property which evaluates to true and and
|
|
257
|
+
a different class name if it evaluates to false, you can pass a binding like
|
|
258
|
+
this:
|
|
259
|
+
|
|
260
|
+
```app/components/my-widget.js
|
|
261
|
+
import Component from '@ember/component';
|
|
262
|
+
|
|
263
|
+
export default class extends Component {
|
|
264
|
+
classNameBindings = ['isEnabled:enabled:disabled'];
|
|
265
|
+
|
|
266
|
+
isEnabled = true;
|
|
267
|
+
}
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
Invoking this component will produce HTML that looks like:
|
|
271
|
+
|
|
272
|
+
```html
|
|
273
|
+
<div id="ember1" class="ember-view enabled"></div>
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
When isEnabled is `false`, the resulting HTML representation looks like this:
|
|
277
|
+
|
|
278
|
+
```html
|
|
279
|
+
<div id="ember1" class="ember-view disabled"></div>
|
|
280
|
+
```
|
|
281
|
+
|
|
282
|
+
This syntax offers the convenience to add a class if a property is `false`:
|
|
283
|
+
|
|
284
|
+
```app/components/my-widget.js
|
|
285
|
+
import Component from '@ember/component';
|
|
286
|
+
|
|
287
|
+
// Applies no class when isEnabled is true and class 'disabled' when isEnabled is false
|
|
288
|
+
export default class extends Component {
|
|
289
|
+
classNameBindings = ['isEnabled::disabled'];
|
|
290
|
+
|
|
291
|
+
isEnabled = true;
|
|
292
|
+
}
|
|
293
|
+
```
|
|
294
|
+
|
|
295
|
+
Invoking this component when the `isEnabled` property is true will produce
|
|
296
|
+
HTML that looks like:
|
|
297
|
+
|
|
298
|
+
```html
|
|
299
|
+
<div id="ember1" class="ember-view"></div>
|
|
300
|
+
```
|
|
301
|
+
|
|
302
|
+
Invoking it when the `isEnabled` property on the component is `false` will
|
|
303
|
+
produce HTML that looks like:
|
|
304
|
+
|
|
305
|
+
```html
|
|
306
|
+
<div id="ember1" class="ember-view disabled"></div>
|
|
307
|
+
```
|
|
308
|
+
|
|
309
|
+
Updates to the value of a class name binding will result in automatic update
|
|
310
|
+
of the HTML `class` attribute in the component's rendered HTML
|
|
311
|
+
representation. If the value becomes `false` or `undefined` the class name
|
|
312
|
+
will be removed.
|
|
313
|
+
|
|
314
|
+
Both `classNames` and `classNameBindings` are concatenated properties. See
|
|
315
|
+
[EmberObject](/ember/release/classes/EmberObject) documentation for more
|
|
316
|
+
information about concatenated properties.
|
|
317
|
+
|
|
318
|
+
### Other HTML Attributes
|
|
319
|
+
|
|
320
|
+
The HTML attribute section of a component's tag can be set by providing an
|
|
321
|
+
`attributeBindings` property set to an array of property names on the
|
|
322
|
+
component. The return value of these properties will be used as the value of
|
|
323
|
+
the component's HTML associated attribute:
|
|
324
|
+
|
|
325
|
+
```app/components/my-anchor.js
|
|
326
|
+
import Component from '@ember/component';
|
|
327
|
+
|
|
328
|
+
export default class extends Component {
|
|
329
|
+
tagName = 'a';
|
|
330
|
+
attributeBindings = ['href'];
|
|
331
|
+
|
|
332
|
+
href = 'http://google.com';
|
|
333
|
+
};
|
|
334
|
+
```
|
|
335
|
+
|
|
336
|
+
Invoking this component will produce HTML that looks like:
|
|
337
|
+
|
|
338
|
+
```html
|
|
339
|
+
<a id="ember1" class="ember-view" href="http://google.com"></a>
|
|
340
|
+
```
|
|
341
|
+
|
|
342
|
+
One property can be mapped on to another by placing a ":" between the source
|
|
343
|
+
property and the destination property:
|
|
344
|
+
|
|
345
|
+
```app/components/my-anchor.js
|
|
346
|
+
import Component from '@ember/component';
|
|
347
|
+
|
|
348
|
+
export default class extends Component {
|
|
349
|
+
tagName = 'a';
|
|
350
|
+
attributeBindings = ['url:href'];
|
|
351
|
+
|
|
352
|
+
url = 'http://google.com';
|
|
353
|
+
};
|
|
354
|
+
```
|
|
355
|
+
|
|
356
|
+
Invoking this component will produce HTML that looks like:
|
|
357
|
+
|
|
358
|
+
```html
|
|
359
|
+
<a id="ember1" class="ember-view" href="http://google.com"></a>
|
|
360
|
+
```
|
|
361
|
+
|
|
362
|
+
HTML attributes passed with angle bracket invocations will take precedence
|
|
363
|
+
over those specified in `attributeBindings`. Therefore, if this component was
|
|
364
|
+
invoked like so:
|
|
365
|
+
|
|
366
|
+
```handlebars
|
|
367
|
+
<MyAnchor href="http://bing.com" @url="http://google.com" />
|
|
368
|
+
```
|
|
369
|
+
|
|
370
|
+
The resulting HTML will looks like this:
|
|
371
|
+
|
|
372
|
+
```html
|
|
373
|
+
<a id="ember1" class="ember-view" href="http://bing.com"></a>
|
|
374
|
+
```
|
|
375
|
+
|
|
376
|
+
Note that the `href` attribute is ultimately set to `http://bing.com`, despite
|
|
377
|
+
it having attribute binidng to the `url` property, which was set to
|
|
378
|
+
`http://google.com`.
|
|
379
|
+
|
|
380
|
+
Namespaced attributes (e.g. `xlink:href`) are supported, but have to be
|
|
381
|
+
mapped, since `:` is not a valid character for properties in Javascript:
|
|
382
|
+
|
|
383
|
+
```app/components/my-use.js
|
|
384
|
+
import Component from '@ember/component';
|
|
385
|
+
|
|
386
|
+
export default class extends Component {
|
|
387
|
+
tagName = 'use';
|
|
388
|
+
attributeBindings = ['xlinkHref:xlink:href'];
|
|
389
|
+
|
|
390
|
+
xlinkHref = '#triangle';
|
|
391
|
+
};
|
|
392
|
+
```
|
|
393
|
+
|
|
394
|
+
Invoking this component will produce HTML that looks like:
|
|
395
|
+
|
|
396
|
+
```html
|
|
397
|
+
<use xlink:href="#triangle"></use>
|
|
398
|
+
```
|
|
399
|
+
|
|
400
|
+
If the value of a property monitored by `attributeBindings` is a boolean, the
|
|
401
|
+
attribute will be present or absent depending on the value:
|
|
402
|
+
|
|
403
|
+
```app/components/my-text-input.js
|
|
404
|
+
import Component from '@ember/component';
|
|
405
|
+
|
|
406
|
+
export default class extends Component {
|
|
407
|
+
tagName = 'input';
|
|
408
|
+
attributeBindings = ['disabled'];
|
|
409
|
+
|
|
410
|
+
disabled = false;
|
|
411
|
+
};
|
|
412
|
+
```
|
|
413
|
+
|
|
414
|
+
Invoking this component will produce HTML that looks like:
|
|
415
|
+
|
|
416
|
+
```html
|
|
417
|
+
<input id="ember1" class="ember-view" />
|
|
418
|
+
```
|
|
419
|
+
|
|
420
|
+
`attributeBindings` can refer to computed properties:
|
|
421
|
+
|
|
422
|
+
```app/components/my-text-input.js
|
|
423
|
+
import Component from '@ember/component';
|
|
424
|
+
import { computed } from '@ember/object';
|
|
425
|
+
|
|
426
|
+
export default class extends Component {
|
|
427
|
+
tagName = 'input';
|
|
428
|
+
attributeBindings = ['disabled'];
|
|
429
|
+
|
|
430
|
+
get disabled() {
|
|
431
|
+
if (someLogic) {
|
|
432
|
+
return true;
|
|
433
|
+
} else {
|
|
434
|
+
return false;
|
|
435
|
+
}
|
|
436
|
+
}
|
|
437
|
+
};
|
|
438
|
+
```
|
|
439
|
+
|
|
440
|
+
To prevent setting an attribute altogether, use `null` or `undefined` as the
|
|
441
|
+
value of the property used in `attributeBindings`:
|
|
442
|
+
|
|
443
|
+
```app/components/my-text-input.js
|
|
444
|
+
import Component from '@ember/component';
|
|
445
|
+
|
|
446
|
+
export default class extends Component {
|
|
447
|
+
tagName = 'form';
|
|
448
|
+
attributeBindings = ['novalidate'];
|
|
449
|
+
novalidate = null;
|
|
450
|
+
};
|
|
451
|
+
```
|
|
452
|
+
|
|
453
|
+
Updates to the property of an attribute binding will result in automatic
|
|
454
|
+
update of the HTML attribute in the component's HTML output.
|
|
455
|
+
|
|
456
|
+
`attributeBindings` is a concatenated property. See
|
|
457
|
+
[EmberObject](/ember/release/classes/EmberObject) documentation for more
|
|
458
|
+
information about concatenated properties.
|
|
459
|
+
|
|
460
|
+
## Layouts
|
|
461
|
+
|
|
462
|
+
The `layout` property can be used to dynamically specify a template associated
|
|
463
|
+
with a component class, instead of relying on Ember to link together a
|
|
464
|
+
component class and a template based on file names.
|
|
465
|
+
|
|
466
|
+
In general, applications should not use this feature, but it's commonly used
|
|
467
|
+
in addons for historical reasons.
|
|
468
|
+
|
|
469
|
+
The `layout` property should be set to the default export of a template
|
|
470
|
+
module, which is the name of a template file without the `.hbs` extension.
|
|
471
|
+
|
|
472
|
+
```app/templates/components/person-profile.hbs
|
|
473
|
+
<h1>Person's Title</h1>
|
|
474
|
+
<div class='details'>{{yield}}</div>
|
|
475
|
+
```
|
|
476
|
+
|
|
477
|
+
```app/components/person-profile.js
|
|
478
|
+
import Component from '@ember/component';
|
|
479
|
+
import layout from '../templates/components/person-profile';
|
|
480
|
+
|
|
481
|
+
export default class extends Component {
|
|
482
|
+
layout = layout;
|
|
483
|
+
}
|
|
484
|
+
```
|
|
485
|
+
|
|
486
|
+
If you invoke the component:
|
|
487
|
+
|
|
488
|
+
```handlebars
|
|
489
|
+
<PersonProfile>
|
|
490
|
+
<h2>Chief Basket Weaver</h2>
|
|
491
|
+
<h3>Fisherman Industries</h3>
|
|
492
|
+
</PersonProfile>
|
|
493
|
+
```
|
|
494
|
+
|
|
495
|
+
or
|
|
496
|
+
|
|
497
|
+
```handlebars
|
|
498
|
+
{{#person-profile}}
|
|
499
|
+
<h2>Chief Basket Weaver</h2>
|
|
500
|
+
<h3>Fisherman Industries</h3>
|
|
501
|
+
{{/person-profile}}
|
|
502
|
+
```
|
|
503
|
+
|
|
504
|
+
It will result in the following HTML output:
|
|
505
|
+
|
|
506
|
+
```html
|
|
507
|
+
<h1>Person's Title</h1>
|
|
508
|
+
<div class="details">
|
|
509
|
+
<h2>Chief Basket Weaver</h2>
|
|
510
|
+
<h3>Fisherman Industries</h3>
|
|
511
|
+
</div>
|
|
512
|
+
```
|
|
513
|
+
|
|
514
|
+
## Handling Browser Events
|
|
515
|
+
|
|
516
|
+
There are two ways to handle user-initiated events:
|
|
517
|
+
|
|
518
|
+
### Using the `on` modifier to capture browser events
|
|
519
|
+
|
|
520
|
+
In a component's template, you can attach an event handler to any element with the `on` modifier:
|
|
521
|
+
|
|
522
|
+
```handlebars
|
|
523
|
+
<button {{on 'click' this.doSomething}} />
|
|
524
|
+
```
|
|
525
|
+
|
|
526
|
+
This will call the function on your component:
|
|
527
|
+
|
|
528
|
+
```js
|
|
529
|
+
import Component from '@ember/component';
|
|
530
|
+
|
|
531
|
+
export default class ExampleComponent extends Component {
|
|
532
|
+
doSomething = (event) => {
|
|
533
|
+
// `event` is the native click Event
|
|
534
|
+
console.log('clicked on the button');
|
|
535
|
+
};
|
|
536
|
+
}
|
|
537
|
+
```
|
|
538
|
+
|
|
539
|
+
See the [Guide on Component event
|
|
540
|
+
handlers](https://guides.emberjs.com/release/components/component-state-and-actions/#toc_html-modifiers-and-actions)
|
|
541
|
+
and the [API docs for `on`](../Ember.Templates.helpers/methods/on?anchor=on)
|
|
542
|
+
for more details.
|
|
543
|
+
|
|
544
|
+
### Event Handler Methods
|
|
545
|
+
|
|
546
|
+
Components can also respond to user-initiated events by implementing a method
|
|
547
|
+
that matches the event name. This approach is appropriate when the same event
|
|
548
|
+
should be handled by all instances of the same component.
|
|
549
|
+
|
|
550
|
+
An event object will be passed as the argument to the event handler method.
|
|
551
|
+
|
|
552
|
+
```app/components/my-widget.js
|
|
553
|
+
import Component from '@ember/component';
|
|
554
|
+
|
|
555
|
+
export default class extends Component {
|
|
556
|
+
click(event) {
|
|
557
|
+
// `event.target` is either the component's element or one of its children
|
|
558
|
+
let tag = event.target.tagName.toLowerCase();
|
|
559
|
+
console.log('clicked on a `<${tag}>` HTML element!');
|
|
560
|
+
}
|
|
561
|
+
}
|
|
562
|
+
```
|
|
563
|
+
|
|
564
|
+
In this example, whenever the user clicked anywhere inside the component, it
|
|
565
|
+
will log a message to the console.
|
|
566
|
+
|
|
567
|
+
It is possible to handle event types other than `click` by implementing the
|
|
568
|
+
following event handler methods. In addition, custom events can be registered
|
|
569
|
+
by using `Application.customEvents`.
|
|
570
|
+
|
|
571
|
+
Touch events:
|
|
572
|
+
|
|
573
|
+
* `touchStart`
|
|
574
|
+
* `touchMove`
|
|
575
|
+
* `touchEnd`
|
|
576
|
+
* `touchCancel`
|
|
577
|
+
|
|
578
|
+
Keyboard events:
|
|
579
|
+
|
|
580
|
+
* `keyDown`
|
|
581
|
+
* `keyUp`
|
|
582
|
+
* `keyPress`
|
|
583
|
+
|
|
584
|
+
Mouse events:
|
|
585
|
+
|
|
586
|
+
* `mouseDown`
|
|
587
|
+
* `mouseUp`
|
|
588
|
+
* `contextMenu`
|
|
589
|
+
* `click`
|
|
590
|
+
* `doubleClick`
|
|
591
|
+
* `focusIn`
|
|
592
|
+
* `focusOut`
|
|
593
|
+
|
|
594
|
+
Form events:
|
|
595
|
+
|
|
596
|
+
* `submit`
|
|
597
|
+
* `change`
|
|
598
|
+
* `focusIn`
|
|
599
|
+
* `focusOut`
|
|
600
|
+
* `input`
|
|
601
|
+
|
|
602
|
+
Drag and drop events:
|
|
603
|
+
|
|
604
|
+
* `dragStart`
|
|
605
|
+
* `drag`
|
|
606
|
+
* `dragEnter`
|
|
607
|
+
* `dragLeave`
|
|
608
|
+
* `dragOver`
|
|
609
|
+
* `dragEnd`
|
|
610
|
+
* `drop`
|
|
611
|
+
|
|
612
|
+
@class Component
|
|
613
|
+
@extends Ember.CoreView
|
|
614
|
+
@uses Ember.TargetActionSupport
|
|
615
|
+
@uses Ember.ActionSupport
|
|
616
|
+
@public
|
|
617
|
+
*/
|
|
618
|
+
// This type param is used in the class, so must appear here.
|
|
619
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
620
|
+
|
|
621
|
+
class Component extends CoreView.extend(TargetActionSupport, ActionSupport, {
|
|
622
|
+
// These need to be overridable via extend/create but should still
|
|
623
|
+
// have a default. Defining them here is the best way to achieve that.
|
|
624
|
+
didReceiveAttrs() {},
|
|
625
|
+
didRender() {},
|
|
626
|
+
didUpdate() {},
|
|
627
|
+
didUpdateAttrs() {},
|
|
628
|
+
willRender() {},
|
|
629
|
+
willUpdate() {}
|
|
630
|
+
}, {
|
|
631
|
+
concatenatedProperties: ['attributeBindings', 'classNames', 'classNameBindings'],
|
|
632
|
+
classNames: EMPTY_ARRAY,
|
|
633
|
+
classNameBindings: EMPTY_ARRAY
|
|
634
|
+
}) {
|
|
635
|
+
isComponent = true;
|
|
636
|
+
|
|
637
|
+
// SAFETY: this has no runtime existence whatsoever; it is a "phantom type"
|
|
638
|
+
// here to preserve the type param.
|
|
639
|
+
|
|
640
|
+
// SAFTEY: This is set in `init`.
|
|
641
|
+
|
|
642
|
+
/**
|
|
643
|
+
Standard CSS class names to apply to the view's outer element. This
|
|
644
|
+
property automatically inherits any class names defined by the view's
|
|
645
|
+
superclasses as well.
|
|
646
|
+
@property classNames
|
|
647
|
+
@type Array
|
|
648
|
+
@default ['ember-view']
|
|
649
|
+
@public
|
|
650
|
+
*/
|
|
651
|
+
|
|
652
|
+
/**
|
|
653
|
+
A list of properties of the view to apply as class names. If the property
|
|
654
|
+
is a string value, the value of that string will be applied as a class
|
|
655
|
+
name.
|
|
656
|
+
```javascript
|
|
657
|
+
// Applies the 'high' class to the view element
|
|
658
|
+
import Component from '@ember/component';
|
|
659
|
+
Component.extend({
|
|
660
|
+
classNameBindings: ['priority'],
|
|
661
|
+
priority: 'high'
|
|
662
|
+
});
|
|
663
|
+
```
|
|
664
|
+
If the value of the property is a Boolean, the name of that property is
|
|
665
|
+
added as a dasherized class name.
|
|
666
|
+
```javascript
|
|
667
|
+
// Applies the 'is-urgent' class to the view element
|
|
668
|
+
import Component from '@ember/component';
|
|
669
|
+
Component.extend({
|
|
670
|
+
classNameBindings: ['isUrgent'],
|
|
671
|
+
isUrgent: true
|
|
672
|
+
});
|
|
673
|
+
```
|
|
674
|
+
If you would prefer to use a custom value instead of the dasherized
|
|
675
|
+
property name, you can pass a binding like this:
|
|
676
|
+
```javascript
|
|
677
|
+
// Applies the 'urgent' class to the view element
|
|
678
|
+
import Component from '@ember/component';
|
|
679
|
+
Component.extend({
|
|
680
|
+
classNameBindings: ['isUrgent:urgent'],
|
|
681
|
+
isUrgent: true
|
|
682
|
+
});
|
|
683
|
+
```
|
|
684
|
+
If you would like to specify a class that should only be added when the
|
|
685
|
+
property is false, you can declare a binding like this:
|
|
686
|
+
```javascript
|
|
687
|
+
// Applies the 'disabled' class to the view element
|
|
688
|
+
import Component from '@ember/component';
|
|
689
|
+
Component.extend({
|
|
690
|
+
classNameBindings: ['isEnabled::disabled'],
|
|
691
|
+
isEnabled: false
|
|
692
|
+
});
|
|
693
|
+
```
|
|
694
|
+
This list of properties is inherited from the component's superclasses as well.
|
|
695
|
+
@property classNameBindings
|
|
696
|
+
@type Array
|
|
697
|
+
@default []
|
|
698
|
+
@public
|
|
699
|
+
*/
|
|
700
|
+
|
|
701
|
+
init(properties) {
|
|
702
|
+
super.init(properties);
|
|
703
|
+
|
|
704
|
+
// Handle methods from ViewMixin.
|
|
705
|
+
// The native class inheritance will not work for mixins. To work around this,
|
|
706
|
+
// we copy the existing rerender method provided by the mixin and swap in the
|
|
707
|
+
// new rerender method from our class.
|
|
708
|
+
this._superRerender = this.rerender;
|
|
709
|
+
this.rerender = this._rerender;
|
|
710
|
+
this[IS_DISPATCHING_ATTRS] = false;
|
|
711
|
+
this[DIRTY_TAG] = createTag();
|
|
712
|
+
this[BOUNDS] = null;
|
|
713
|
+
const eventDispatcher = this._dispatcher;
|
|
714
|
+
if (eventDispatcher) {
|
|
715
|
+
let lazyEventsProcessedForComponentClass = lazyEventsProcessed.get(eventDispatcher);
|
|
716
|
+
if (!lazyEventsProcessedForComponentClass) {
|
|
717
|
+
lazyEventsProcessedForComponentClass = new WeakSet();
|
|
718
|
+
lazyEventsProcessed.set(eventDispatcher, lazyEventsProcessedForComponentClass);
|
|
719
|
+
}
|
|
720
|
+
let proto = Object.getPrototypeOf(this);
|
|
721
|
+
if (!lazyEventsProcessedForComponentClass.has(proto)) {
|
|
722
|
+
let lazyEvents = eventDispatcher.lazyEvents;
|
|
723
|
+
lazyEvents.forEach((mappedEventName, event) => {
|
|
724
|
+
if (mappedEventName !== null && typeof this[mappedEventName] === 'function') {
|
|
725
|
+
eventDispatcher.setupHandlerForBrowserEvent(event);
|
|
726
|
+
}
|
|
727
|
+
});
|
|
728
|
+
lazyEventsProcessedForComponentClass.add(proto);
|
|
729
|
+
}
|
|
730
|
+
}
|
|
731
|
+
if (!this.elementId && this.tagName !== '') {
|
|
732
|
+
this.elementId = guidFor(this);
|
|
733
|
+
}
|
|
734
|
+
}
|
|
735
|
+
__dispatcher;
|
|
736
|
+
get _dispatcher() {
|
|
737
|
+
if (this.__dispatcher === undefined) {
|
|
738
|
+
let owner = getOwner(this);
|
|
739
|
+
if (owner.lookup('-environment:main').isInteractive) {
|
|
740
|
+
let dispatcher = owner.lookup('event_dispatcher:main');
|
|
741
|
+
this.__dispatcher = dispatcher;
|
|
742
|
+
} else {
|
|
743
|
+
// In FastBoot we have no EventDispatcher. Set to null to not try again to look it up.
|
|
744
|
+
this.__dispatcher = null;
|
|
745
|
+
}
|
|
746
|
+
}
|
|
747
|
+
return this.__dispatcher;
|
|
748
|
+
}
|
|
749
|
+
on(name, target, method) {
|
|
750
|
+
this._dispatcher?.setupHandlerForEmberEvent(name);
|
|
751
|
+
// The `on` method here comes from the Evented mixin. Since this mixin
|
|
752
|
+
// is applied to the parent of this class, however, we are still able
|
|
753
|
+
// to use `super`.
|
|
754
|
+
return super.on(name, target, method);
|
|
755
|
+
}
|
|
756
|
+
|
|
757
|
+
// Changed to `rerender` on init
|
|
758
|
+
_rerender() {
|
|
759
|
+
DIRTY_TAG$1(this[DIRTY_TAG]);
|
|
760
|
+
this._superRerender();
|
|
761
|
+
}
|
|
762
|
+
[PROPERTY_DID_CHANGE](key, value) {
|
|
763
|
+
if (this[IS_DISPATCHING_ATTRS]) {
|
|
764
|
+
return;
|
|
765
|
+
}
|
|
766
|
+
let args = getComponentCapturedArgs(this);
|
|
767
|
+
let reference = args !== undefined ? args[key] : undefined;
|
|
768
|
+
if (reference !== undefined && isUpdatableRef(reference)) {
|
|
769
|
+
updateRef(reference, arguments.length === 2 ? value : get(this, key));
|
|
770
|
+
}
|
|
771
|
+
}
|
|
772
|
+
getAttr(key) {
|
|
773
|
+
// TODO Intimate API should be deprecated
|
|
774
|
+
return this.get(key);
|
|
775
|
+
}
|
|
776
|
+
|
|
777
|
+
/**
|
|
778
|
+
Normally, Ember's component model is "write-only". The component takes a
|
|
779
|
+
bunch of attributes that it got passed in, and uses them to render its
|
|
780
|
+
template.
|
|
781
|
+
One nice thing about this model is that if you try to set a value to the
|
|
782
|
+
same thing as last time, Ember (through HTMLBars) will avoid doing any
|
|
783
|
+
work on the DOM.
|
|
784
|
+
This is not just a performance optimization. If an attribute has not
|
|
785
|
+
changed, it is important not to clobber the element's "hidden state".
|
|
786
|
+
For example, if you set an input's `value` to the same value as before,
|
|
787
|
+
it will clobber selection state and cursor position. In other words,
|
|
788
|
+
setting an attribute is not **always** idempotent.
|
|
789
|
+
This method provides a way to read an element's attribute and also
|
|
790
|
+
update the last value Ember knows about at the same time. This makes
|
|
791
|
+
setting an attribute idempotent.
|
|
792
|
+
In particular, what this means is that if you get an `<input>` element's
|
|
793
|
+
`value` attribute and then re-render the template with the same value,
|
|
794
|
+
it will avoid clobbering the cursor and selection position.
|
|
795
|
+
Since most attribute sets are idempotent in the browser, you typically
|
|
796
|
+
can get away with reading attributes using jQuery, but the most reliable
|
|
797
|
+
way to do so is through this method.
|
|
798
|
+
@method readDOMAttr
|
|
799
|
+
@param {String} name the name of the attribute
|
|
800
|
+
@return String
|
|
801
|
+
@public
|
|
802
|
+
*/
|
|
803
|
+
readDOMAttr(name) {
|
|
804
|
+
// TODO revisit this
|
|
805
|
+
let _element = getViewElement(this);
|
|
806
|
+
let element = _element;
|
|
807
|
+
let isSVG = element.namespaceURI === 'http://www.w3.org/2000/svg';
|
|
808
|
+
let {
|
|
809
|
+
type,
|
|
810
|
+
normalized
|
|
811
|
+
} = normalizeProperty(element, name);
|
|
812
|
+
if (isSVG || type === 'attr') {
|
|
813
|
+
return element.getAttribute(normalized);
|
|
814
|
+
}
|
|
815
|
+
return element[normalized];
|
|
816
|
+
}
|
|
817
|
+
|
|
818
|
+
// --- Declarations which support mixins ---
|
|
819
|
+
// We use `declare` on these properties, even though they are optional, so
|
|
820
|
+
// that they do not get created on the class *at all* when emitting the
|
|
821
|
+
// transpiled code. Otherwise, since declared class properties are equivalent
|
|
822
|
+
// to calling `defineProperty` in the class constructor, they would "stomp"
|
|
823
|
+
// the properties supplied by mixins.
|
|
824
|
+
|
|
825
|
+
/**
|
|
826
|
+
A list of properties of the view to apply as attributes. If the property
|
|
827
|
+
is a string value, the value of that string will be applied as the value
|
|
828
|
+
for an attribute of the property's name.
|
|
829
|
+
The following example creates a tag like `<div priority="high" />`.
|
|
830
|
+
```app/components/my-component.js
|
|
831
|
+
import Component from '@ember/component';
|
|
832
|
+
export default Component.extend({
|
|
833
|
+
attributeBindings: ['priority'],
|
|
834
|
+
priority: 'high'
|
|
835
|
+
});
|
|
836
|
+
```
|
|
837
|
+
If the value of the property is a Boolean, the attribute is treated as
|
|
838
|
+
an HTML Boolean attribute. It will be present if the property is `true`
|
|
839
|
+
and omitted if the property is `false`.
|
|
840
|
+
The following example creates markup like `<div visible />`.
|
|
841
|
+
```app/components/my-component.js
|
|
842
|
+
import Component from '@ember/component';
|
|
843
|
+
export default Component.extend({
|
|
844
|
+
attributeBindings: ['visible'],
|
|
845
|
+
visible: true
|
|
846
|
+
});
|
|
847
|
+
```
|
|
848
|
+
If you would prefer to use a custom value instead of the property name,
|
|
849
|
+
you can create the same markup as the last example with a binding like
|
|
850
|
+
this:
|
|
851
|
+
```app/components/my-component.js
|
|
852
|
+
import Component from '@ember/component';
|
|
853
|
+
export default Component.extend({
|
|
854
|
+
attributeBindings: ['isVisible:visible'],
|
|
855
|
+
isVisible: true
|
|
856
|
+
});
|
|
857
|
+
```
|
|
858
|
+
This list of attributes is inherited from the component's superclasses,
|
|
859
|
+
as well.
|
|
860
|
+
@property attributeBindings
|
|
861
|
+
@type Array
|
|
862
|
+
@default []
|
|
863
|
+
@public
|
|
864
|
+
*/
|
|
865
|
+
|
|
866
|
+
/**
|
|
867
|
+
Enables components to take a list of parameters as arguments.
|
|
868
|
+
For example, a component that takes two parameters with the names
|
|
869
|
+
`name` and `age`:
|
|
870
|
+
```app/components/my-component.js
|
|
871
|
+
import Component from '@ember/component';
|
|
872
|
+
export default class MyComponent extends Component {
|
|
873
|
+
static positionalParams = ['name', 'age'];
|
|
874
|
+
}
|
|
875
|
+
```
|
|
876
|
+
It can then be invoked like this:
|
|
877
|
+
```hbs
|
|
878
|
+
{{my-component "John" 38}}
|
|
879
|
+
```
|
|
880
|
+
The parameters can be referred to just like named parameters:
|
|
881
|
+
```hbs
|
|
882
|
+
Name: {{name}}, Age: {{age}}.
|
|
883
|
+
```
|
|
884
|
+
Using a string instead of an array allows for an arbitrary number of
|
|
885
|
+
parameters:
|
|
886
|
+
```app/components/my-component.js
|
|
887
|
+
import Component from '@ember/component';
|
|
888
|
+
export default class MyComponent extends Component {
|
|
889
|
+
static positionalParams = 'names';
|
|
890
|
+
}
|
|
891
|
+
```
|
|
892
|
+
It can then be invoked like this:
|
|
893
|
+
```hbs
|
|
894
|
+
{{my-component "John" "Michael" "Scott"}}
|
|
895
|
+
```
|
|
896
|
+
The parameters can then be referred to by enumerating over the list:
|
|
897
|
+
```hbs
|
|
898
|
+
{{#each names as |name|}}{{name}}{{/each}}
|
|
899
|
+
```
|
|
900
|
+
@static
|
|
901
|
+
@public
|
|
902
|
+
@property positionalParams
|
|
903
|
+
@since 1.13.0
|
|
904
|
+
*/ /**
|
|
905
|
+
Enables components to take a list of parameters as arguments.
|
|
906
|
+
For example, a component that takes two parameters with the names
|
|
907
|
+
`name` and `age`:
|
|
908
|
+
```app/components/my-component.js
|
|
909
|
+
import Component from '@ember/component';
|
|
910
|
+
export default class MyComponent extends Component {
|
|
911
|
+
static positionalParams = ['name', 'age'];
|
|
912
|
+
}
|
|
913
|
+
```
|
|
914
|
+
It can then be invoked like this:
|
|
915
|
+
```hbs
|
|
916
|
+
{{my-component "John" 38}}
|
|
917
|
+
```
|
|
918
|
+
The parameters can be referred to just like named parameters:
|
|
919
|
+
```hbs
|
|
920
|
+
Name: {{name}}, Age: {{age}}.
|
|
921
|
+
```
|
|
922
|
+
Using a string instead of an array allows for an arbitrary number of
|
|
923
|
+
parameters:
|
|
924
|
+
```app/components/my-component.js
|
|
925
|
+
import Component from '@ember/component';
|
|
926
|
+
export default class MyComponent extends Component {
|
|
927
|
+
static positionalParams = 'names';
|
|
928
|
+
}
|
|
929
|
+
```
|
|
930
|
+
It can then be invoked like this:
|
|
931
|
+
```hbs
|
|
932
|
+
{{my-component "John" "Michael" "Scott"}}
|
|
933
|
+
```
|
|
934
|
+
The parameters can then be referred to by enumerating over the list:
|
|
935
|
+
```hbs
|
|
936
|
+
{{#each names as |name|}}{{name}}{{/each}}
|
|
937
|
+
```
|
|
938
|
+
@static
|
|
939
|
+
@public
|
|
940
|
+
@property positionalParams
|
|
941
|
+
@since 1.13.0
|
|
942
|
+
*/
|
|
943
|
+
|
|
944
|
+
/**
|
|
945
|
+
Layout can be used to wrap content in a component.
|
|
946
|
+
@property layout
|
|
947
|
+
@type Function
|
|
948
|
+
@public
|
|
949
|
+
*/
|
|
950
|
+
|
|
951
|
+
/**
|
|
952
|
+
The name of the layout to lookup if no layout is provided.
|
|
953
|
+
By default `Component` will lookup a template with this name in
|
|
954
|
+
`Ember.TEMPLATES` (a shared global object).
|
|
955
|
+
@property layoutName
|
|
956
|
+
@type String
|
|
957
|
+
@default undefined
|
|
958
|
+
@private
|
|
959
|
+
*/
|
|
960
|
+
|
|
961
|
+
/**
|
|
962
|
+
The WAI-ARIA role of the control represented by this view. For example, a
|
|
963
|
+
button may have a role of type 'button', or a pane may have a role of
|
|
964
|
+
type 'alertdialog'. This property is used by assistive software to help
|
|
965
|
+
visually challenged users navigate rich web applications.
|
|
966
|
+
The full list of valid WAI-ARIA roles is available at:
|
|
967
|
+
[https://www.w3.org/TR/wai-aria/#roles_categorization](https://www.w3.org/TR/wai-aria/#roles_categorization)
|
|
968
|
+
@property ariaRole
|
|
969
|
+
@type String
|
|
970
|
+
@default undefined
|
|
971
|
+
@public
|
|
972
|
+
*/
|
|
973
|
+
|
|
974
|
+
/**
|
|
975
|
+
Array of child views. You should never edit this array directly.
|
|
976
|
+
@property childViews
|
|
977
|
+
@type Array
|
|
978
|
+
@default []
|
|
979
|
+
@private
|
|
980
|
+
*/
|
|
981
|
+
// @ts-expect-error TODO: Fix these types
|
|
982
|
+
get childViews() {
|
|
983
|
+
return getChildViews(this);
|
|
984
|
+
}
|
|
985
|
+
static {
|
|
986
|
+
decorateMethodV2(this.prototype, "childViews", [nativeDescDecorator({
|
|
987
|
+
configurable: false,
|
|
988
|
+
enumerable: false
|
|
989
|
+
})]);
|
|
990
|
+
}
|
|
991
|
+
appendChild(view) {
|
|
992
|
+
addChildView(this, view);
|
|
993
|
+
}
|
|
994
|
+
_transitionTo(state) {
|
|
995
|
+
let priorState = this._currentState;
|
|
996
|
+
let currentState = this._currentState = this._states[state];
|
|
997
|
+
this._state = state;
|
|
998
|
+
if (priorState && priorState.exit) {
|
|
999
|
+
priorState.exit(this);
|
|
1000
|
+
}
|
|
1001
|
+
if (currentState.enter) {
|
|
1002
|
+
currentState.enter(this);
|
|
1003
|
+
}
|
|
1004
|
+
}
|
|
1005
|
+
|
|
1006
|
+
// Begin ViewMixin
|
|
1007
|
+
|
|
1008
|
+
// ..........................................................
|
|
1009
|
+
// TEMPLATE SUPPORT
|
|
1010
|
+
//
|
|
1011
|
+
|
|
1012
|
+
/**
|
|
1013
|
+
Return the nearest ancestor that is an instance of the provided
|
|
1014
|
+
class or mixin.
|
|
1015
|
+
@method nearestOfType
|
|
1016
|
+
@param {Class,Mixin} klass Subclass of Ember.View (or Ember.View itself),
|
|
1017
|
+
or an instance of Mixin.
|
|
1018
|
+
@return Ember.View
|
|
1019
|
+
@deprecated use `yield` and contextual components for composition instead.
|
|
1020
|
+
@private
|
|
1021
|
+
*/
|
|
1022
|
+
nearestOfType(klass) {
|
|
1023
|
+
let view = this.parentView;
|
|
1024
|
+
while (view) {
|
|
1025
|
+
if (klass.detect(view.constructor)) {
|
|
1026
|
+
return view;
|
|
1027
|
+
}
|
|
1028
|
+
view = view.parentView;
|
|
1029
|
+
}
|
|
1030
|
+
return;
|
|
1031
|
+
}
|
|
1032
|
+
|
|
1033
|
+
/**
|
|
1034
|
+
Return the nearest ancestor that has a given property.
|
|
1035
|
+
@method nearestWithProperty
|
|
1036
|
+
@param {String} property A property name
|
|
1037
|
+
@return Ember.View
|
|
1038
|
+
@deprecated use `yield` and contextual components for composition instead.
|
|
1039
|
+
@private
|
|
1040
|
+
*/
|
|
1041
|
+
nearestWithProperty(property) {
|
|
1042
|
+
let view = this.parentView;
|
|
1043
|
+
while (view) {
|
|
1044
|
+
if (property in view) {
|
|
1045
|
+
return view;
|
|
1046
|
+
}
|
|
1047
|
+
view = view.parentView;
|
|
1048
|
+
}
|
|
1049
|
+
return;
|
|
1050
|
+
}
|
|
1051
|
+
|
|
1052
|
+
/**
|
|
1053
|
+
Renders the view again. This will work regardless of whether the
|
|
1054
|
+
view is already in the DOM or not. If the view is in the DOM, the
|
|
1055
|
+
rendering process will be deferred to give bindings a chance
|
|
1056
|
+
to synchronize.
|
|
1057
|
+
If children were added during the rendering process using `appendChild`,
|
|
1058
|
+
`rerender` will remove them, because they will be added again
|
|
1059
|
+
if needed by the next `render`.
|
|
1060
|
+
In general, if the display of your view changes, you should modify
|
|
1061
|
+
the DOM element directly instead of manually calling `rerender`, which can
|
|
1062
|
+
be slow.
|
|
1063
|
+
@method rerender
|
|
1064
|
+
@public
|
|
1065
|
+
*/
|
|
1066
|
+
rerender() {
|
|
1067
|
+
return this._currentState.rerender(this);
|
|
1068
|
+
}
|
|
1069
|
+
|
|
1070
|
+
// ..........................................................
|
|
1071
|
+
// ELEMENT SUPPORT
|
|
1072
|
+
//
|
|
1073
|
+
|
|
1074
|
+
/**
|
|
1075
|
+
Returns the current DOM element for the view.
|
|
1076
|
+
@property element
|
|
1077
|
+
@type DOMElement
|
|
1078
|
+
@public
|
|
1079
|
+
*/
|
|
1080
|
+
// @ts-expect-error The types are not correct here
|
|
1081
|
+
get element() {
|
|
1082
|
+
return this.renderer.getElement(this);
|
|
1083
|
+
}
|
|
1084
|
+
|
|
1085
|
+
/**
|
|
1086
|
+
Appends the view's element to the specified parent element.
|
|
1087
|
+
Note that this method just schedules the view to be appended; the DOM
|
|
1088
|
+
element will not be appended to the given element until all bindings have
|
|
1089
|
+
finished synchronizing.
|
|
1090
|
+
This is not typically a function that you will need to call directly when
|
|
1091
|
+
building your application. If you do need to use `appendTo`, be sure that
|
|
1092
|
+
the target element you are providing is associated with an `Application`
|
|
1093
|
+
and does not have an ancestor element that is associated with an Ember view.
|
|
1094
|
+
@method appendTo
|
|
1095
|
+
@param {String|DOMElement} A selector, element, HTML string
|
|
1096
|
+
@return {Ember.View} receiver
|
|
1097
|
+
@private
|
|
1098
|
+
*/
|
|
1099
|
+
static {
|
|
1100
|
+
decorateMethodV2(this.prototype, "element", [nativeDescDecorator({
|
|
1101
|
+
configurable: false,
|
|
1102
|
+
enumerable: false
|
|
1103
|
+
})]);
|
|
1104
|
+
}
|
|
1105
|
+
appendTo(selector) {
|
|
1106
|
+
let target;
|
|
1107
|
+
if (hasDOM) {
|
|
1108
|
+
target = typeof selector === 'string' ? document.querySelector(selector) : selector;
|
|
1109
|
+
} else {
|
|
1110
|
+
target = selector;
|
|
1111
|
+
}
|
|
1112
|
+
|
|
1113
|
+
// SAFETY: SimpleElement is supposed to be a subset of Element so this _should_ be safe.
|
|
1114
|
+
// However, the types are more specific in some places which necessitates the `as`.
|
|
1115
|
+
this.renderer.appendTo(this, target);
|
|
1116
|
+
return this;
|
|
1117
|
+
}
|
|
1118
|
+
|
|
1119
|
+
/**
|
|
1120
|
+
Appends the view's element to the document body. If the view does
|
|
1121
|
+
not have an HTML representation yet
|
|
1122
|
+
the element will be generated automatically.
|
|
1123
|
+
If your application uses the `rootElement` property, you must append
|
|
1124
|
+
the view within that element. Rendering views outside of the `rootElement`
|
|
1125
|
+
is not supported.
|
|
1126
|
+
Note that this method just schedules the view to be appended; the DOM
|
|
1127
|
+
element will not be appended to the document body until all bindings have
|
|
1128
|
+
finished synchronizing.
|
|
1129
|
+
@method append
|
|
1130
|
+
@return {Ember.View} receiver
|
|
1131
|
+
@private
|
|
1132
|
+
*/
|
|
1133
|
+
append() {
|
|
1134
|
+
return this.appendTo(document.body);
|
|
1135
|
+
}
|
|
1136
|
+
|
|
1137
|
+
/**
|
|
1138
|
+
The HTML `id` of the view's element in the DOM. You can provide this
|
|
1139
|
+
value yourself but it must be unique (just as in HTML):
|
|
1140
|
+
```handlebars
|
|
1141
|
+
{{my-component elementId="a-really-cool-id"}}
|
|
1142
|
+
```
|
|
1143
|
+
If not manually set a default value will be provided by the framework.
|
|
1144
|
+
Once rendered an element's `elementId` is considered immutable and you
|
|
1145
|
+
should never change it. If you need to compute a dynamic value for the
|
|
1146
|
+
`elementId`, you should do this when the component or element is being
|
|
1147
|
+
instantiated:
|
|
1148
|
+
```app/components/my-component.js
|
|
1149
|
+
import Component from '@ember/component';
|
|
1150
|
+
export default Component.extend({
|
|
1151
|
+
init() {
|
|
1152
|
+
this._super(...arguments);
|
|
1153
|
+
let index = this.get('index');
|
|
1154
|
+
this.set('elementId', 'component-id' + index);
|
|
1155
|
+
}
|
|
1156
|
+
});
|
|
1157
|
+
```
|
|
1158
|
+
@property elementId
|
|
1159
|
+
@type String
|
|
1160
|
+
@public
|
|
1161
|
+
*/
|
|
1162
|
+
|
|
1163
|
+
/**
|
|
1164
|
+
Called when a view is going to insert an element into the DOM.
|
|
1165
|
+
@event willInsertElement
|
|
1166
|
+
@public
|
|
1167
|
+
*/
|
|
1168
|
+
willInsertElement() {
|
|
1169
|
+
return this;
|
|
1170
|
+
}
|
|
1171
|
+
|
|
1172
|
+
/**
|
|
1173
|
+
Called when the element of the view has been inserted into the DOM.
|
|
1174
|
+
Override this function to do any set up that requires an element
|
|
1175
|
+
in the document body.
|
|
1176
|
+
When a view has children, didInsertElement will be called on the
|
|
1177
|
+
child view(s) first and on itself afterwards.
|
|
1178
|
+
@event didInsertElement
|
|
1179
|
+
@public
|
|
1180
|
+
*/
|
|
1181
|
+
didInsertElement() {
|
|
1182
|
+
return this;
|
|
1183
|
+
}
|
|
1184
|
+
|
|
1185
|
+
/**
|
|
1186
|
+
Called when the view is about to rerender, but before anything has
|
|
1187
|
+
been torn down. This is a good opportunity to tear down any manual
|
|
1188
|
+
observers you have installed based on the DOM state
|
|
1189
|
+
@event willClearRender
|
|
1190
|
+
@public
|
|
1191
|
+
*/
|
|
1192
|
+
willClearRender() {
|
|
1193
|
+
return this;
|
|
1194
|
+
}
|
|
1195
|
+
|
|
1196
|
+
/**
|
|
1197
|
+
You must call `destroy` on a view to destroy the view (and all of its
|
|
1198
|
+
child views). This will remove the view from any parent node, then make
|
|
1199
|
+
sure that the DOM element managed by the view can be released by the
|
|
1200
|
+
memory manager.
|
|
1201
|
+
@method destroy
|
|
1202
|
+
@private
|
|
1203
|
+
*/
|
|
1204
|
+
destroy() {
|
|
1205
|
+
super.destroy();
|
|
1206
|
+
this._currentState.destroy(this);
|
|
1207
|
+
return this;
|
|
1208
|
+
}
|
|
1209
|
+
|
|
1210
|
+
/**
|
|
1211
|
+
Called when the element of the view is going to be destroyed. Override
|
|
1212
|
+
this function to do any teardown that requires an element, like removing
|
|
1213
|
+
event listeners.
|
|
1214
|
+
Please note: any property changes made during this event will have no
|
|
1215
|
+
effect on object observers.
|
|
1216
|
+
@event willDestroyElement
|
|
1217
|
+
@public
|
|
1218
|
+
*/
|
|
1219
|
+
willDestroyElement() {
|
|
1220
|
+
return this;
|
|
1221
|
+
}
|
|
1222
|
+
|
|
1223
|
+
/**
|
|
1224
|
+
Called after the element of the view is destroyed.
|
|
1225
|
+
@event willDestroyElement
|
|
1226
|
+
@public
|
|
1227
|
+
*/
|
|
1228
|
+
didDestroyElement() {
|
|
1229
|
+
return this;
|
|
1230
|
+
}
|
|
1231
|
+
|
|
1232
|
+
/**
|
|
1233
|
+
Called when the parentView property has changed.
|
|
1234
|
+
@event parentViewDidChange
|
|
1235
|
+
@private
|
|
1236
|
+
*/
|
|
1237
|
+
parentViewDidChange() {
|
|
1238
|
+
return this;
|
|
1239
|
+
}
|
|
1240
|
+
|
|
1241
|
+
// ..........................................................
|
|
1242
|
+
// STANDARD RENDER PROPERTIES
|
|
1243
|
+
//
|
|
1244
|
+
|
|
1245
|
+
/**
|
|
1246
|
+
Tag name for the view's outer element. The tag name is only used when an
|
|
1247
|
+
element is first created. If you change the `tagName` for an element, you
|
|
1248
|
+
must destroy and recreate the view element.
|
|
1249
|
+
By default, the render buffer will use a `<div>` tag for views.
|
|
1250
|
+
If the tagName is `''`, the view will be tagless, with no outer element.
|
|
1251
|
+
Component properties that depend on the presence of an outer element, such
|
|
1252
|
+
as `classNameBindings` and `attributeBindings`, do not work with tagless
|
|
1253
|
+
components. Tagless components cannot implement methods to handle events,
|
|
1254
|
+
and their `element` property has a `null` value.
|
|
1255
|
+
@property tagName
|
|
1256
|
+
@type String
|
|
1257
|
+
@default null
|
|
1258
|
+
@public
|
|
1259
|
+
*/
|
|
1260
|
+
|
|
1261
|
+
// We leave this null by default so we can tell the difference between
|
|
1262
|
+
// the default case and a user-specified tag.
|
|
1263
|
+
|
|
1264
|
+
// .......................................................
|
|
1265
|
+
// EVENT HANDLING
|
|
1266
|
+
//
|
|
1267
|
+
|
|
1268
|
+
/**
|
|
1269
|
+
Handle events from `EventDispatcher`
|
|
1270
|
+
@method handleEvent
|
|
1271
|
+
@param eventName {String}
|
|
1272
|
+
@param evt {Event}
|
|
1273
|
+
@private
|
|
1274
|
+
*/
|
|
1275
|
+
handleEvent(eventName, evt) {
|
|
1276
|
+
return this._currentState.handleEvent(this, eventName, evt);
|
|
1277
|
+
}
|
|
1278
|
+
|
|
1279
|
+
// End ViewMixin
|
|
1280
|
+
|
|
1281
|
+
static isComponentFactory = true;
|
|
1282
|
+
static toString() {
|
|
1283
|
+
return '@ember/component';
|
|
1284
|
+
}
|
|
1285
|
+
}
|
|
1286
|
+
|
|
1287
|
+
// We continue to use reopenClass here so that positionalParams can be overridden with reopenClass in subclasses.
|
|
1288
|
+
Component.reopenClass({
|
|
1289
|
+
positionalParams: []
|
|
1290
|
+
});
|
|
1291
|
+
setInternalComponentManager(CURLY_COMPONENT_MANAGER, Component);
|
|
16
1292
|
|
|
17
1293
|
/**
|
|
18
1294
|
Associate a class with a component manager (an object that is responsible for
|
|
@@ -29,4 +1305,4 @@ function setComponentManager(manager, obj) {
|
|
|
29
1305
|
return setComponentManager$1(manager, obj);
|
|
30
1306
|
}
|
|
31
1307
|
|
|
32
|
-
export { setComponentManager };
|
|
1308
|
+
export { Component as default, setComponentManager };
|