Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Start on embroider support #358

Merged
merged 4 commits into from
Sep 13, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ jobs:
- ember-canary
- ember-default-with-jquery
- ember-classic
- embroider-safe
- embroider-optimized

steps:
- uses: actions/checkout@v2
Expand Down
21 changes: 11 additions & 10 deletions addon/components/modal-dialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import { isEmpty, typeOf, isNone } from '@ember/utils';
import layout from '../templates/components/modal-dialog';
import { assert, warn } from '@ember/debug';
import { DEBUG } from '@glimmer/env';
import { importSync } from '@embroider/macros';
import { ensureSafeComponent } from '@embroider/util';

const VALID_OVERLAY_POSITIONS = ['parent', 'sibling'];

Expand All @@ -34,28 +36,27 @@ export default class ModalDialog extends Component {
'hasLiquidWormhole',
'hasLiquidTether'
)
get modalDialogComponentName() {
let tetherTarget = this.tetherTarget;
let hasLiquidTether = this.hasLiquidTether;
let hasLiquidWormhole = this.hasLiquidWormhole;
let animatable = this.animatable;
get whichModalDialogComponent() {
let { animatable, hasLiquidTether, hasLiquidWormhole, tetherTarget } = this;
let componentName = 'basic-dialog';

if (this.renderInPlace) {
return 'ember-modal-dialog/-in-place-dialog';
componentName = 'in-place-dialog';
} else if (
tetherTarget &&
hasLiquidTether &&
hasLiquidWormhole &&
animatable === true
) {
return 'ember-modal-dialog/-liquid-tether-dialog';
componentName = 'liquid-tether-dialog';
} else if (tetherTarget) {
this.ensureEmberTetherPresent();
return 'ember-modal-dialog/-tether-dialog';
componentName = 'tether-dialog';
} else if (hasLiquidWormhole && animatable === true) {
return 'ember-modal-dialog/-liquid-dialog';
componentName = 'liquid-dialog';
}
return 'ember-modal-dialog/-basic-dialog';
let module = importSync(`ember-modal-dialog/components/${componentName}`);
return ensureSafeComponent(module.default, this);
}

animatable = null;
Expand Down
57 changes: 28 additions & 29 deletions addon/templates/components/modal-dialog.hbs
Original file line number Diff line number Diff line change
@@ -1,30 +1,29 @@
{{#component
this.modalDialogComponentName
wrapperClass=this.wrapperClass
wrapperClassNames=this.wrapperClassNames
overlayClass=this.overlayClass
overlayClassNames=this.overlayClassNames
containerClass=this.containerClass
containerClassNames=this.containerClassNames
hasOverlay=this.hasOverlay
translucentOverlay=this.translucentOverlay
clickOutsideToClose=this.clickOutsideToClose
destinationElementId=this.destinationElementId
overlayPosition=this.overlayPosition
tetherTarget=this.tetherTarget
legacyTarget=this.target
attachment=this.attachment
targetAttachment=this.targetAttachment
targetModifier=this.targetModifier
targetOffset=this.targetOffset
offset=this.offset
tetherClassPrefix=this.tetherClassPrefix
constraints=this.constraints
attachmentClass=this.attachmentClass
stack=this.stack
value=this.value
onClickOverlay=this.onClickOverlayAction
onClose=this.onCloseAction
}}
<this.whichModalDialogComponent
@wrapperClass={{this.wrapperClass}}
@wrapperClassNames={{this.wrapperClassNames}}
@overlayClass={{this.overlayClass}}
@overlayClassNames={{this.overlayClassNames}}
@containerClass={{this.containerClass}}
@containerClassNames={{this.containerClassNames}}
@hasOverlay={{this.hasOverlay}}
@translucentOverlay={{this.translucentOverlay}}
@clickOutsideToClose={{this.clickOutsideToClose}}
@destinationElementId={{this.destinationElementId}}
@overlayPosition={{this.overlayPosition}}
@tetherTarget={{this.tetherTarget}}
@legacyTarget={{this.target}}
@attachment={{this.attachment}}
@targetAttachment={{this.targetAttachment}}
@targetModifier={{this.targetModifier}}
@targetOffset={{this.targetOffset}}
@offset={{this.offset}}
@tetherClassPrefix={{this.tetherClassPrefix}}
@constraints={{this.constraints}}
@attachmentClass={{this.attachmentClass}}
@stack={{this.stack}}
@value={{this.value}}
@onClickOverlay={{this.onClickOverlayAction}}
@onClose={{this.onCloseAction}}
>
{{yield}}
{{/component}}
</this.whichModalDialogComponent>
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
"test:ember-compatibility": "ember try:each"
},
"dependencies": {
"@embroider/macros": "^0.43.5",
"@embroider/util": "^0.43.5",
"ember-cli-babel": "^7.26.6",
"ember-cli-htmlbars": "^5.7.1",
"ember-cli-version-checker": "^2.1.0",
Expand Down
49 changes: 45 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1971,6 +1971,31 @@
resolve "^1.8.1"
semver "^7.3.2"

"@embroider/[email protected]", "@embroider/macros@^0.43.5":
version "0.43.5"
resolved "https://registry.yarnpkg.com/@embroider/macros/-/macros-0.43.5.tgz#f846bb883482436611a58a3512c687d4f9fddfad"
integrity sha512-WmLa0T3dyG2XyN5Gr7k1RINDirFzAzh6CRvykRMcuahq1rCrav8ADrWgQzKpPWxdR6DgQCuoyimopJhLbYOpgQ==
dependencies:
"@embroider/shared-internals" "0.43.5"
assert-never "^1.2.1"
ember-cli-babel "^7.26.6"
find-up "^5.0.0"
lodash "^4.17.21"
resolve "^1.20.0"
semver "^7.3.2"

"@embroider/[email protected]":
version "0.43.5"
resolved "https://registry.yarnpkg.com/@embroider/shared-internals/-/shared-internals-0.43.5.tgz#4269208095452c23bfa4f08554fd8f7ed7b83a83"
integrity sha512-vydU3kRS5hH/hWOBHiHP06427d0C5t2p+UTPtbH09+Jlyj0WvvtgUfiNltEneY6jjpLXlqOfgs4LjsRdmBFksw==
dependencies:
ember-rfc176-data "^0.3.17"
fs-extra "^9.1.0"
lodash "^4.17.21"
resolve-package-path "^4.0.1"
semver "^7.3.5"
typescript-memoize "^1.0.1"

"@embroider/test-setup@^0.41.0":
version "0.41.0"
resolved "https://registry.yarnpkg.com/@embroider/test-setup/-/test-setup-0.41.0.tgz#7e18fb266ba2f0b131256b303ef4e682f3ca9b20"
Expand All @@ -1979,6 +2004,15 @@
lodash "^4.17.20"
resolve "^1.17.0"

"@embroider/util@^0.43.5":
version "0.43.5"
resolved "https://registry.yarnpkg.com/@embroider/util/-/util-0.43.5.tgz#d3acc98b3f92fbb26fa9265cff4f245ca8e6b61e"
integrity sha512-jSIYx671RB957jbhh4T4kN3StTyA/Q+XReRlYIqgJmUW/u5+UEreqtXASSVKY6mJdPTjXY3zn1EY0vZKMbj9gw==
dependencies:
"@embroider/macros" "0.43.5"
broccoli-funnel "^3.0.5"
ember-cli-babel "^7.23.1"

"@eslint/eslintrc@^0.4.3":
version "0.4.3"
resolved "https://registry.yarnpkg.com/@eslint/eslintrc/-/eslintrc-0.4.3.tgz#9e42981ef035beb3dd49add17acb96e8ff6f394c"
Expand Down Expand Up @@ -3059,7 +3093,7 @@ asn1.js@^5.2.0:
minimalistic-assert "^1.0.0"
safer-buffer "^2.1.0"

assert-never@^1.1.0:
assert-never@^1.1.0, assert-never@^1.2.1:
version "1.2.1"
resolved "https://registry.yarnpkg.com/assert-never/-/assert-never-1.2.1.tgz#11f0e363bf146205fb08193b5c7b90f4d1cf44fe"
integrity sha512-TaTivMB6pYI1kXwrFlEhLeGfOqoDNdTxjCdwRfFFkEA30Eu+k48W34nlok2EYWJfFFzqaEmichdNM7th6M5HNw==
Expand Down Expand Up @@ -4291,7 +4325,7 @@ broccoli-funnel@^2.0.0, broccoli-funnel@^2.0.1, broccoli-funnel@^2.0.2:
symlink-or-copy "^1.0.0"
walk-sync "^0.3.1"

broccoli-funnel@^3.0.3, broccoli-funnel@^3.0.6, broccoli-funnel@^3.0.8:
broccoli-funnel@^3.0.3, broccoli-funnel@^3.0.5, broccoli-funnel@^3.0.6, broccoli-funnel@^3.0.8:
version "3.0.8"
resolved "https://registry.yarnpkg.com/broccoli-funnel/-/broccoli-funnel-3.0.8.tgz#f5b62e2763c3918026a15a3c833edc889971279b"
integrity sha512-ng4eIhPYiXqMw6SyGoxPHR3YAwEd2lr9FgBI1CyTbspl4txZovOsmzFkMkGAlu88xyvYXJqHiM2crfLa65T1BQ==
Expand Down Expand Up @@ -10205,7 +10239,7 @@ [email protected], lodash@^4.17.15, lodash@^4.17.4, lodash@^4.5.1, lodash@^4.6.1:
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.19.tgz#e48ddedbe30b3321783c5b4301fbd353bc1e4a4b"
integrity sha512-JNvd8XER9GQX0v2qJgsaN/mzFCNA5BRe/j8JN9d+tWyGLSodKQHKFicdwNYzWwI3wjRnaKPsGj1XkBjx/F96DQ==

lodash@^4.17.10, lodash@^4.17.11, lodash@^4.17.14, lodash@^4.17.19, lodash@^4.17.20, lodash@^4.7.0:
lodash@^4.17.10, lodash@^4.17.11, lodash@^4.17.14, lodash@^4.17.19, lodash@^4.17.20, lodash@^4.17.21, lodash@^4.7.0:
version "4.17.21"
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c"
integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==
Expand Down Expand Up @@ -12416,6 +12450,13 @@ resolve-package-path@^3.1.0:
path-root "^0.1.1"
resolve "^1.17.0"

resolve-package-path@^4.0.1:
version "4.0.1"
resolved "https://registry.yarnpkg.com/resolve-package-path/-/resolve-package-path-4.0.1.tgz#0e77271e06c8cc41740d28ef974806a77fdc8880"
integrity sha512-2gb/yU2fSfX22pjDYyevzyOKK9q72XKUFqlAsrfPzZArM4JkIH/Qcme4n3EbaZttObWm/fIFLbPxrXIyiL8wdQ==
dependencies:
path-root "^0.1.1"

resolve-path@^1.4.0:
version "1.4.0"
resolved "https://registry.yarnpkg.com/resolve-path/-/resolve-path-1.4.0.tgz#c4bda9f5efb2fce65247873ab36bb4d834fe16f7"
Expand Down Expand Up @@ -13845,7 +13886,7 @@ typedarray@^0.0.6:
resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777"
integrity sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=

typescript-memoize@^1.0.0-alpha.3:
typescript-memoize@^1.0.0-alpha.3, typescript-memoize@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/typescript-memoize/-/typescript-memoize-1.0.1.tgz#0a8199aa28f6fe18517f6e9308ef7bfbe9a98d59"
integrity sha512-oJNge1qUrOK37d5Y6Ly2txKeuelYVsFtNF6U9kXIN7juudcQaHJQg2MxLOy0CqtkW65rVDYuTCOjnSIVPd8z3w==
Expand Down