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

[WIP] Create bootstrap 3, ember 4 compatible fork #1837

Open
wants to merge 28 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
73c09d2
update tests
Gaurav0 Aug 13, 2022
26e2a54
update minimum node version
Gaurav0 Aug 13, 2022
9689f9a
fix existing tests
Gaurav0 Aug 13, 2022
6bc0f5e
Drop support for ember-concurrency 1.x as a dependency
simonihmig Aug 6, 2021
c328572
Drop node 10 support
simonihmig Aug 6, 2021
0a7763a
Drop IE11 support
simonihmig Aug 6, 2021
c072dad
Revert IE11 workaround of #775
simonihmig Aug 11, 2021
784daa1
Drop IE11 from docs app targets
simonihmig Aug 11, 2021
6437050
Fix linting
simonihmig Aug 11, 2021
58c8ba9
Update dependencies that break for Ember 4
simonihmig Sep 2, 2021
8dd8ed6
Fix use of global `Ember` in tests
simonihmig Sep 2, 2021
1a3cbd0
Remove ember-maybe-import-regenerator
simonihmig Sep 2, 2021
134b7be
Revert ember-source update
simonihmig Sep 2, 2021
267fa0f
Migrate from `ember-popper` to `ember-popper-modifier` w/ popper.js v2
simonihmig Sep 2, 2021
5a07b55
Use ember-popper-modifier for tooltips
simonihmig Sep 2, 2021
4773a60
Use ember-popper-modifier for popovers
simonihmig Sep 3, 2021
271439a
Use ember-popper-modifier for dropdowns
simonihmig Sep 3, 2021
4b8da36
run yarn
Gaurav0 Aug 14, 2022
f59fde7
fix tests
Gaurav0 Aug 14, 2022
c497431
Upgrade to ember-auto-import v2
simonihmig Oct 4, 2021
7496b0e
Remove use of curly component invocation for link components
simonihmig Nov 18, 2021
8252b02
Update render modifiers
simonihmig Nov 6, 2021
84fc8db
Fix BsCollapse
simonihmig Nov 6, 2021
4927b8c
Fix same computation assertion for BsAlert
simonihmig Nov 6, 2021
bbdda64
Update ember-focus-trap, fixing Ember 4 compatibility
simonihmig Nov 18, 2021
97a8929
Test on ember 4.x
Gaurav0 Aug 15, 2022
435fb01
update fastboot
Gaurav0 Aug 15, 2022
768218d
fix use of @ember/polyfills
Gaurav0 Aug 15, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
57 changes: 21 additions & 36 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ on:
tags:
- '*'
pull_request:
schedule:
- cron: '0 4 * * 5' # Fridays at 4am

jobs:
test:
Expand All @@ -20,7 +18,7 @@ jobs:
- name: Setup node.js
uses: actions/setup-node@v1
with:
node-version: 10
node-version: 12
- name: Install dependencies
uses: bahmutov/npm-install@v1
- name: Lint
Expand All @@ -39,7 +37,7 @@ jobs:
- name: Setup node.js
uses: actions/setup-node@v1
with:
node-version: 10
node-version: 12
- name: Install dependencies
uses: bahmutov/npm-install@v1
with:
Expand All @@ -50,7 +48,7 @@ jobs:
test-try:
name: Scenario ${{ matrix.scenario }}, BS${{ matrix.bootstrap }}, ${{ matrix.browser}}
runs-on: ubuntu-latest
timeout-minutes: 10
timeout-minutes: 14
continue-on-error: ${{ matrix.allow-failure || false }}
needs:
- test
Expand All @@ -62,12 +60,14 @@ jobs:
scenario:
- ember-lts-3.16
- ember-lts-3.20
- ember-lts-3.24
- ember-lts-3.28
- ember-lts-4.4
- ember-release
- ember-beta
- ember-canary
- ember-default-with-jquery
- ember-classic
- ember-concurrency-2.x
- embroider-safe
- embroider-optimized
bootstrap:
Expand All @@ -77,10 +77,22 @@ jobs:
browser:
- Chrome
include:
- scenario: ember-release
- scenario: ember-lts-3.28
browser: Firefox
bootstrap: 3
- scenario: ember-lts-3.28
browser: Firefox
bootstrap: 4
- scenario: ember-release
- scenario: ember-lts-3.28
browser: Firefox
bootstrap: 5
- scenario: ember-lts-4.4
browser: Firefox
bootstrap: 3
- scenario: ember-lts-4.4
browser: Firefox
bootstrap: 4
- scenario: ember-lts-4.4
browser: Firefox
bootstrap: 5
- scenario: node-tests
Expand All @@ -90,37 +102,10 @@ jobs:
- name: Setup node.js
uses: actions/setup-node@v1
with:
node-version: 10
node-version: 12
- name: Install dependencies
uses: bahmutov/npm-install@v1
- name: Test
run: yarn ember try:one ${{ matrix.scenario }} --- ember test --launch ${{ matrix.browser }}
env:
BOOTSTRAPVERSION: ${{ matrix.bootstrap }}

# test-browserstack:
# name: Browserstack Tests
# runs-on: ubuntu-latest
# needs:
# - test
# env:
# BROWSERSTACK_USERNAME: simonihmig1
# BROWSERSTACK_ACCESS_KEY: ${{ secrets.BROWSERSTACK_ACCESS_KEY }}
# steps:
# - name: Checkout code
# uses: actions/checkout@v2
# - name: Setup node.js
# uses: actions/setup-node@v1
# with:
# node-version: 10
# - name: Install dependencies
# uses: bahmutov/npm-install@v1
# - name: Connect to Browserstack
# run: yarn ember browserstack:connect
# - name: Test
# run: yarn ember test --filter !FastBoot --config-file testem.browserstack.js
# env:
# BABELPOLYFILL: true
# - name: Disconnect from Browserstack
# if: always()
# run: yarn ember browserstack:disconnect
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,9 @@ Ember Bootstrap works and is fully [tested](https://github.com/kaliber5/ember-bo
* Ember.js 3.16+ (including all optional features)
* Ember CLI 3.15+
* Bootstrap 3 and 4
* all modern evergreen browsers (Chrome, Firefox, Safari, Edge) and IE 11 (the latter requires the use of the [Babel polyfill](https://github.com/babel/ember-cli-babel#polyfill)).
* FastBoot 1.0+
* all modern evergreen browsers (Chrome, Firefox, Safari, Edge)
* node.js 12+
* FastBoot 3.0+
* Embroider: we strive (and test) for maximum compatibility with Embroider, including the most aggressive setting
(`staticComponents`) for tree shaking and code splitting. However as Embroider itself is still considered beta software,
we won't be able to *guarantee* that for the time being.
Expand Down
14 changes: 10 additions & 4 deletions addon/components/bs-alert.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,12 @@ export default class Alert extends Component {
@tracked
hidden = !this.visible;

/**
* This is an unfortunate duplication of the previous property, but this is untracked to avoid causing the dreaded "same computation" assertion in GlimmerVM when reading a tracked property before setting it.
* @private
*/
_hidden = !this.visible;

/**
* This property controls if the alert should be visible. If false it might still be in the DOM until the fade animation
* has completed.
Expand Down Expand Up @@ -174,7 +180,7 @@ export default class Alert extends Component {
* @private
*/
show() {
this.hidden = false;
this.hidden = this._hidden = false;
}

/**
Expand All @@ -185,7 +191,7 @@ export default class Alert extends Component {
* @private
*/
hide() {
if (this.hidden) {
if (this._hidden) {
return;
}

Expand All @@ -194,14 +200,14 @@ export default class Alert extends Component {
this,
function () {
if (!this.isDestroyed) {
this.hidden = true;
this.hidden = this._hidden = true;
this.args.onDismissed?.();
}
},
this.fadeDuration
);
} else {
this.hidden = true;
this.hidden = this._hidden = true;
this.args.onDismissed?.();
}
}
Expand Down
1 change: 0 additions & 1 deletion addon/components/bs-collapse.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ export default class Collapse extends Component {
* @property active
* @private
*/
@tracked
active = !this.collapsed;

get collapse() {
Expand Down
82 changes: 40 additions & 42 deletions addon/components/bs-contextual-help/element.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import { action } from '@ember/object';
import Component from '@glimmer/component';
import { assert } from '@ember/debug';
import { scheduleOnce } from '@ember/runloop';
import arg from 'ember-bootstrap/utils/decorators/arg';
import { tracked } from '@glimmer/tracking';
import { getOwnConfig, macroCondition } from '@embroider/macros';
Expand Down Expand Up @@ -106,54 +104,52 @@ export default class ContextualHelpElement extends Component {
* @type {object}
* @private
*/
get popperModifiers() {
const context = this;
get popperOptions() {
let options = {
placement: this.placement,
onFirstUpdate: this.updatePlacement,
};

// We need popeerElement, so we wait for this getter to recompute once it's available
// We need popperElement, so we wait for this getter to recompute once it's available
if (!this.popperElement) {
return {};
return options;
}

return {
arrow: {
element: this.popperElement.querySelector(`.${this.arrowClass}`),
options.modifiers = [
{
name: 'arrow',
options: {
element: this.popperElement.querySelector(`.${this.arrowClass}`),
padding: 4,
},
},
offset: {
offset: this.offset.join(','),
fn(data) {
let tip = context.popperElement;
assert('Contextual help element needs existing popper element', tip);

// manually read margins because getBoundingClientRect includes difference
let marginTop = parseInt(window.getComputedStyle(tip).marginTop, 10);
let marginLeft = parseInt(window.getComputedStyle(tip).marginLeft, 10);

// we must check for NaN for ie 8/9
if (isNaN(marginTop) || marginTop > 0) {
marginTop = 0;
}
if (isNaN(marginLeft) || marginLeft > 0) {
marginLeft = 0;
}

data.offsets.popper.top += marginTop;
data.offsets.popper.left += marginLeft;

return window.Popper.Defaults.modifiers.offset.fn.apply(this, arguments);
{
name: 'offset',
options: {
offset: this.offset,
},
},
preventOverflow: {
{
name: 'preventOverflow',
enabled: this.args.autoPlacement,
boundariesElement: this.args.viewportElement,
padding: this.args.viewportPadding,
options: {
boundary: this.args.viewportElement,
padding: this.args.viewportPadding,
},
},
hide: {
{
name: 'flip',
enabled: this.args.autoPlacement,
},
flip: {
enabled: this.args.autoPlacement,
{
name: 'onChange',
enabled: true,
phase: 'afterWrite',
fn: this.updatePlacement,
},
};
];

return options;
}

get actualPlacementClass() {
Expand All @@ -173,11 +169,13 @@ export default class ContextualHelpElement extends Component {
}

@action
updatePlacement(popperDataObject) {
if (this.actualPlacement === popperDataObject.placement) {
updatePlacement(state) {
// normalize argument
state = state.state ?? state;

if (this.actualPlacement === state.placement) {
return;
}
this.actualPlacement = popperDataObject.placement;
scheduleOnce('afterRender', popperDataObject.instance, popperDataObject.instance.scheduleUpdate);
this.actualPlacement = state.placement;
}
}
1 change: 0 additions & 1 deletion addon/components/bs-dropdown.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
menu=(component (ensure-safe-component (bs-default @menuComponent (component "bs-dropdown/menu")))
isOpen=this.isOpen
direction=this.direction
inNav=@inNav
toggleElement=this.toggleElement
registerChildElement=this.registerChildElement
unregisterChildElement=this.unregisterChildElement
Expand Down