Skip to content

Commit

Permalink
Merge pull request #1341 from kaliber5/fix-embroider
Browse files Browse the repository at this point in the history
Fix optimized Embroider build
  • Loading branch information
simonihmig committed May 26, 2021
2 parents cec2ca8 + 73d19d3 commit 54c67a6
Show file tree
Hide file tree
Showing 35 changed files with 931 additions and 1,558 deletions.
7 changes: 3 additions & 4 deletions .github/workflows/ci.yml
Expand Up @@ -50,6 +50,7 @@ jobs:
test-try:
name: Scenario ${{ matrix.scenario }}, BS${{ matrix.bootstrap }}, ${{ matrix.browser}}
runs-on: ubuntu-latest
timeout-minutes: 10
continue-on-error: ${{ matrix.allow-failure || false }}
needs:
- test
Expand All @@ -67,6 +68,8 @@ jobs:
- ember-default-with-jquery
- ember-classic
- ember-concurrency-2.x
- embroider-safe
- embroider-optimized
bootstrap:
- 3
- 4
Expand All @@ -81,10 +84,6 @@ jobs:
browser: Firefox
bootstrap: 5
- scenario: node-tests
# - scenario: embroider-safe
# allow-failure: true
# - scenario: embroider-optimized
# allow-failure: true
steps:
- name: Checkout code
uses: actions/checkout@v2
Expand Down
2 changes: 1 addition & 1 deletion addon/components/bs-accordion.hbs
Expand Up @@ -5,7 +5,7 @@
>
{{yield
(hash
item=(component (bs-default @itemComponent (component "bs-accordion/item")) selected=this.isSelected onClick=this.doChange)
item=(component (ensure-safe-component (bs-default @itemComponent (component "bs-accordion/item"))) selected=this.isSelected onClick=this.doChange)
change=this.doChange
)
}}
Expand Down
44 changes: 24 additions & 20 deletions addon/components/bs-accordion/item.hbs
@@ -1,21 +1,25 @@
<div
class="{{if this.disabled "disabled"}} {{this.typeClass}} {{if (macroCondition (macroGetOwnConfig "isNotBS3")) "card"}} {{if (macroCondition (macroGetOwnConfig "isBS3")) "panel"}}"
...attributes
>
{{#if (has-block-params)}}
{{yield
(hash
title=(component (bs-default @titleComponent (component "bs-accordion/item/title")) collapsed=this.collapsed disabled=this.disabled onClick=(fn this.onClick this.value))
body=(component (bs-default @bodyComponent (component "bs-accordion/item/body")) collapsed=this.collapsed)
)
}}
{{else}}
{{#component (bs-default @titleComponent (component "bs-accordion/item/title")) collapsed=this.collapsed disabled=this.disabled onClick=(fn this.onClick this.value)}}
{{@title}}
{{/component}}
{{#component (bs-default @bodyComponent (component "bs-accordion/item/body")) collapsed=this.collapsed}}
{{#let
(component (ensure-safe-component (bs-default @titleComponent (component "bs-accordion/item/title"))) collapsed=this.collapsed disabled=this.disabled onClick=(fn (bs-default @onClick (bs-noop)) this.value))
(component (ensure-safe-component (bs-default @bodyComponent (component "bs-accordion/item/body"))) collapsed=this.collapsed)
as |Title Body|
}}
<div
class="{{if this.disabled "disabled"}} {{this.typeClass}} {{if (macroCondition (macroGetOwnConfig "isNotBS3")) "card"}} {{if (macroCondition (macroGetOwnConfig "isBS3")) "panel"}}"
...attributes
>
{{#if (has-block-params)}}
{{yield
(hash
title=Title
body=Body )
}}
{{else}}
<Title>
{{@title}}
</Title>
<Body>
{{yield}}
{{/component}}
{{/if}}

</div>
</Body>
{{/if}}
</div>
{{/let}}
2 changes: 1 addition & 1 deletion addon/components/bs-button-group.hbs
@@ -1,7 +1,7 @@
<div class="{{if @vertical "btn-group-vertical" "btn-group"}} {{bs-size-class "btn-group" @size}} {{if @justified (if (macroCondition (macroGetOwnConfig "isBS3")) "btn-group-justified")}}" role="group" ...attributes>
{{yield
(hash
button=(component (bs-default @buttonComponent (component "bs-button-group/button")) buttonGroupType=@type groupValue=@value onClick=this.buttonPressed)
button=(component (ensure-safe-component (bs-default @buttonComponent (component "bs-button-group/button"))) buttonGroupType=@type groupValue=@value onClick=this.buttonPressed)
)
}}
</div>
21 changes: 12 additions & 9 deletions addon/components/bs-button.js
@@ -1,6 +1,5 @@
import { tracked } from '@glimmer/tracking';
import { action } from '@ember/object';
import { equal, or } from 'macro-decorators';
import { warn } from '@ember/debug';
import Component from '@glimmer/component';
import arg from 'ember-bootstrap/utils/decorators/arg';
Expand Down Expand Up @@ -271,8 +270,9 @@ export default class Button extends Component {
* @type Boolean
* @private
*/
@equal('state', 'pending')
isPending;
get isPending() {
return this.state === 'pending';
}

/**
* Promise returned by `onClick` event has been succeeded.
Expand All @@ -281,8 +281,9 @@ export default class Button extends Component {
* @type Boolean
* @private
*/
@equal('state', 'fulfilled')
isFulfilled;
get isFulfilled() {
return this.state === 'fulfilled';
}

/**
* Promise returned by `onClick` event has been rejected.
Expand All @@ -291,8 +292,9 @@ export default class Button extends Component {
* @type Boolean
* @private
*/
@equal('state', 'rejected')
isRejected;
get isRejected() {
return this.state === 'rejected';
}

/**
* Promise returned by `onClick` event has been succeeded or rejected.
Expand All @@ -301,8 +303,9 @@ export default class Button extends Component {
* @type Boolean
* @private
*/
@or('isFulfilled', 'isRejected')
isSettled;
get isSettled() {
return this.isFulfilled || this.isRejected;
}

/**
* Set this to `true` to reset the `state`. A typical use case is to bind this attribute with ember-data isDirty flag.
Expand Down
2 changes: 1 addition & 1 deletion addon/components/bs-carousel.hbs
Expand Up @@ -18,7 +18,7 @@
<div class="carousel-inner" role="listbox">
{{yield
(hash
slide=(component (bs-default @slideComponent (component "bs-carousel/slide"))
slide=(component (ensure-safe-component (bs-default @slideComponent (component "bs-carousel/slide")))
currentSlide=this.currentSlide
directionalClassName=this.directionalClassName
followingSlide=this.followingSlide
Expand Down
6 changes: 3 additions & 3 deletions addon/components/bs-dropdown.hbs
Expand Up @@ -2,22 +2,22 @@
<Tag class="{{this.containerClass}} {{if this.inNav (if (macroCondition (macroGetOwnConfig "isNotBS3")) "nav-item")}} {{if this.isOpen (if (macroCondition (macroGetOwnConfig "isNotBS3")) "show" "open")}}" ...attributes>
{{yield
(hash
button=(component (bs-default @buttonComponent (component "bs-dropdown/button"))
button=(component (ensure-safe-component (bs-default @buttonComponent (component "bs-dropdown/button")))
isOpen=this.isOpen
onClick=this.toggleDropdown
onKeyDown=this.handleKeyEvent
registerChildElement=this.registerChildElement
unregisterChildElement=this.unregisterChildElement
)
toggle=(component (bs-default @toggleComponent (component "bs-dropdown/toggle"))
toggle=(component (ensure-safe-component (bs-default @toggleComponent (component "bs-dropdown/toggle")))
isOpen=this.isOpen
inNav=@inNav
onClick=this.toggleDropdown
onKeyDown=this.handleKeyEvent
registerChildElement=this.registerChildElement
unregisterChildElement=this.unregisterChildElement
)
menu=(component (bs-default @menuComponent (component "bs-dropdown/menu"))
menu=(component (ensure-safe-component (bs-default @menuComponent (component "bs-dropdown/menu")))
isOpen=this.isOpen
direction=this.direction
inNav=@inNav
Expand Down
16 changes: 8 additions & 8 deletions addon/components/bs-dropdown/menu.hbs
Expand Up @@ -16,10 +16,10 @@
>
{{yield
(hash
item=(bs-default @itemComponent (component "bs-dropdown/menu/item"))
link-to=(bs-default @linkToComponent (component "bs-link-to" class=(if (macroCondition (macroGetOwnConfig "isNotBS3")) "dropdown-item")))
linkTo=(bs-default @linkToComponent (component "bs-link-to" class=(if (macroCondition (macroGetOwnConfig "isNotBS3")) "dropdown-item")))
divider=(bs-default @dividerComponent (component "bs-dropdown/menu/divider"))
item=(ensure-safe-component (bs-default @itemComponent (component "bs-dropdown/menu/item")))
link-to=(ensure-safe-component (bs-default @linkToComponent (component "bs-link-to" class=(if (macroCondition (macroGetOwnConfig "isNotBS3")) "dropdown-item"))))
linkTo=(ensure-safe-component (bs-default @linkToComponent (component "bs-link-to" class=(if (macroCondition (macroGetOwnConfig "isNotBS3")) "dropdown-item"))))
divider=(ensure-safe-component (bs-default @dividerComponent (component "bs-dropdown/menu/divider")))
)
}}
</EmberPopper>
Expand All @@ -45,10 +45,10 @@
>
{{yield
(hash
item=(bs-default @itemComponent (component "bs-dropdown/menu/item"))
link-to=(bs-default @linkToComponent (component "bs-link-to" class=(if (macroCondition (macroGetOwnConfig "isNotBS3")) "dropdown-item")))
linkTo=(bs-default @linkToComponent (component "bs-link-to" class=(if (macroCondition (macroGetOwnConfig "isNotBS3")) "dropdown-item")))
divider=(bs-default @dividerComponent (component "bs-dropdown/menu/divider"))
item=(ensure-safe-component (bs-default @itemComponent (component "bs-dropdown/menu/item")))
link-to=(ensure-safe-component (bs-default @linkToComponent (component "bs-link-to" class=(if (macroCondition (macroGetOwnConfig "isNotBS3")) "dropdown-item"))))
linkTo=(ensure-safe-component (bs-default @linkToComponent (component "bs-link-to" class=(if (macroCondition (macroGetOwnConfig "isNotBS3")) "dropdown-item"))))
divider=(ensure-safe-component (bs-default @dividerComponent (component "bs-dropdown/menu/divider")))
)
}}
</ul>
Expand Down
6 changes: 3 additions & 3 deletions addon/components/bs-form.hbs
Expand Up @@ -8,7 +8,7 @@
>
{{yield
(hash
element=(component (bs-default @elementComponent (component "bs-form/element"))
element=(component (ensure-safe-component (bs-default @elementComponent (component "bs-form/element")))
model=this.model
formLayout=this.formLayout
horizontalLabelGridClass=this.horizontalLabelGridClass
Expand All @@ -18,13 +18,13 @@
onChange=this.elementChanged
_onChange=this.resetSubmissionState
)
group=(component (bs-default @groupComponent (component "bs-form/group")) formLayout=this.formLayout)
group=(component (ensure-safe-component (bs-default @groupComponent (component "bs-form/group")) formLayout=this.formLayout))
isSubmitting=this.isSubmitting
isSubmitted=this.isSubmitted
isRejected=this.isRejected
resetSubmissionState=this.resetSubmissionState
submit=this.doSubmit
submitButton=(component this.submitButtonComponent
submitButton=(component (ensure-safe-component (bs-default @submitButtonComponent (component "bs-button")))
buttonType="submit"
type="primary"
state=this.submitButtonState
Expand Down
2 changes: 0 additions & 2 deletions addon/components/bs-form.js
Expand Up @@ -214,8 +214,6 @@ export default class Form extends Component {
* @type {String}
* @private
*/
@defaultValue
submitButtonComponent = 'bs-button';

/**
* `isSubmitting` is `true` after `submit` event has been triggered and until Promise returned by `onSubmit` is
Expand Down
75 changes: 33 additions & 42 deletions addon/components/bs-form/element.hbs
Expand Up @@ -11,52 +11,56 @@
{{did-update this.handleShowAllValidationsChange this.showAllValidations}}
>
{{#component
(bs-default
@layoutComponent
(if
(bs-contains (array "checkbox" "switch") this.controlType)
(ensure-safe-component
(bs-default
@layoutComponent
(if
(bs-eq @formLayout "inline")
(component "bs-form/element/layout/inline/checkbox" controlType=this.controlType)
(bs-contains (array "checkbox" "switch") this.controlType)
(if
(bs-eq @formLayout "horizontal")
(component "bs-form/element/layout/horizontal/checkbox" controlType=this.controlType)
(component "bs-form/element/layout/vertical/checkbox" controlType=this.controlType)
(bs-eq @formLayout "inline")
(component "bs-form/element/layout/inline/checkbox" controlType=this.controlType)
(if
(bs-eq @formLayout "horizontal")
(component "bs-form/element/layout/horizontal/checkbox" controlType=this.controlType)
(component "bs-form/element/layout/vertical/checkbox" controlType=this.controlType)
)
)
)
(if
(bs-eq @formLayout "inline")
(component "bs-form/element/layout/inline")
(if
(bs-eq @formLayout "horizontal")
(component "bs-form/element/layout/horizontal")
(component "bs-form/element/layout/vertical")
(bs-eq @formLayout "inline")
(component "bs-form/element/layout/inline")
(if
(bs-eq @formLayout "horizontal")
(component "bs-form/element/layout/horizontal")
(component "bs-form/element/layout/vertical")
)
)
)
)
)
hasLabel=(if @label true false)
formElementId=this.formElementId
horizontalLabelGridClass=@horizontalLabelGridClass
errorsComponent=(component (bs-default @errorsComponent (component "bs-form/element/errors"))
errorsComponent=(component (ensure-safe-component (bs-default @errorsComponent (component "bs-form/element/errors")))
messages=this.validationMessages
show=this.showValidationMessages
showMultipleErrors=this.showMultipleErrors
)
feedbackIconComponent=(component (bs-default @feedbackIconComponent (component "bs-form/element/feedback-icon"))
feedbackIconComponent=(component (ensure-safe-component (bs-default @feedbackIconComponent (component "bs-form/element/feedback-icon")))
iconName=@iconName
show=this.hasFeedback
)
labelComponent=(component
(bs-default
@labelComponent
(if
(macroCondition (macroGetOwnConfig "isBS3"))
(component "bs-form/element/label")
(ensure-safe-component
(bs-default
@labelComponent
(if
(bs-eq this.controlType "radio")
(component "bs-form/element/legend")
(macroCondition (macroGetOwnConfig "isBS3"))
(component "bs-form/element/label")
(if
(bs-eq this.controlType "radio")
(component "bs-form/element/legend")
(component "bs-form/element/label")
)
)
)
)
Expand All @@ -68,7 +72,7 @@
size=@size
)
helpTextComponent=(if @helpText
(component (bs-default @helpTextComponent (component "bs-form/element/help-text"))
(component (ensure-safe-component (bs-default @helpTextComponent (component "bs-form/element/help-text")))
text=@helpText
id=this.ariaDescribedBy
)
Expand All @@ -81,23 +85,10 @@
{{!-- template-lint-disable no-args-paths --}}
{{#let
(component
(bs-default
@controlComponent
(ensure-safe-component
(bs-default
this.customControlComponent
(if
(bs-eq this.controlType "checkbox")
(component "bs-form/element/control/checkbox")
(if
(bs-eq this.controlType "radio")
(component "bs-form/element/control/radio")
(if
(bs-eq this.controlType "textarea")
(component "bs-form/element/control/textarea")
(component "bs-form/element/control/input")
)
)
)
@controlComponent
this.controlComponent
)
)
value=this.value
Expand Down

0 comments on commit 54c67a6

Please sign in to comment.