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

Update to glimmer components #685

Merged
merged 35 commits into from
Sep 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
6147597
Update to glimmer components
mkszepp Aug 3, 2023
772ea5d
fix lint errors in liquid-fire package
mkszepp Aug 3, 2023
e62c00d
remove lint rules in liquid-fire
mkszepp Aug 3, 2023
4fdf35b
Add lint rule for using const
mkszepp Aug 3, 2023
198c374
Tests to glimmer
mkszepp Aug 3, 2023
321ca76
Convert test-app components to glimmer
mkszepp Aug 3, 2023
b4c4256
let to const
mkszepp Aug 3, 2023
124d4e6
Convert docs to native class / glimmer components
mkszepp Aug 4, 2023
e25de64
update eslintrc in docs
mkszepp Aug 4, 2023
ceb643d
Fix template lints
mkszepp Aug 4, 2023
2bec6f9
fix code examples in docs
mkszepp Aug 4, 2023
be9cf0e
update packages and fix some lint
mkszepp Aug 4, 2023
dfe972c
Fix eslintrc
mkszepp Aug 4, 2023
f62eccd
try to fix test
mkszepp Aug 4, 2023
9ccd4b0
fix lint
mkszepp Aug 4, 2023
ea24726
fix test
mkszepp Aug 4, 2023
5d04cb6
fix Circular dependencies & Unresolved dependencies
mkszepp Aug 4, 2023
15dd774
try to fix test
mkszepp Aug 4, 2023
fc8cbaa
Move fastboot check
mkszepp Aug 4, 2023
5fb73a7
fix test
mkszepp Aug 4, 2023
9302035
fix lint
mkszepp Aug 4, 2023
fc50778
Add ember-try for ember 5
mkszepp Aug 4, 2023
818d70e
fix test
mkszepp Aug 4, 2023
4931249
fix test
mkszepp Aug 4, 2023
f8325d8
fix for ci test?
mkszepp Aug 4, 2023
6bafb50
fix ci test?
mkszepp Aug 4, 2023
9fe3e06
Remove fix tries
mkszepp Aug 4, 2023
6503ddd
Fix liquid spacer
mkszepp Aug 4, 2023
e140cd0
Try to fix test
mkszepp Aug 4, 2023
d7d39c6
try fix test
mkszepp Aug 4, 2023
5135563
fix test
mkszepp Aug 4, 2023
2cdfec7
reset growDuration
mkszepp Aug 4, 2023
0b2888d
readd support for ember 3.28
mkszepp Aug 4, 2023
1e70be4
readd changelog
mkszepp Aug 7, 2023
ac8a7b2
add ember compatibility table in repo
mkszepp Aug 7, 2023
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/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,11 @@ jobs:
fail-fast: false
matrix:
try-scenario:
- ember-lts-3.28
- ember-lts-4.4
- ember-lts-4.8
- ember-lts-4.12
- ember-5.0
- ember-release
- ember-beta
- ember-canary
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
23 changes: 7 additions & 16 deletions docs/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,22 +23,10 @@ module.exports = {
browser: true,
},
rules: {
'no-var': 'error',
semi: ['error', 'always'],
'ember/no-actions-hash': 'off',
'ember/no-classic-classes': 'off',
'ember/no-classic-components': 'off',
'ember/no-component-lifecycle-hooks': 'off',
'ember/no-get': 'off',
'ember/no-new-mixins': 'off',
'ember/no-old-shims': 'error',
'ember/new-module-imports': 'error',
'ember/no-jquery': 'off',
'ember/no-mixins': 'off',
'ember/no-side-effects': 'error',
'ember/require-return-from-computed': 'off',
'ember/require-tagless-components': 'off',
'no-prototype-builtins': 'off',
eqeqeq: ['error'],
'no-console': ['error'],
'no-var': ['error'],
'prefer-const': ['error'],
},
overrides: [
// node files
Expand Down Expand Up @@ -68,6 +56,9 @@ module.exports = {
// test files
files: ['tests/**/*-test.{js,ts}'],
extends: ['plugin:qunit/recommended'],
rules: {
'qunit/require-expect': 'off',
},
},
],
};
16 changes: 1 addition & 15 deletions docs/.template-lintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,9 @@
module.exports = {
extends: 'recommended',
rules: {
'block-indentation': false,
'link-href-attributes': false,
'no-action': false,
'no-curly-component-invocation': {
allow: [
'liquid-child',
'liquid-container',
'liquid-versions',
'liquid-outlet',
'-with-dynamic-vars',
],
allow: ['-with-dynamic-vars'],
},
'no-implicit-this': false,
'no-invalid-role': false,
'no-outlet-outside-routes': false,
'no-yield-only': false,
'require-input-label': false,
'require-valid-alt-text': false,
},
};
15 changes: 7 additions & 8 deletions docs/app/components/code-snippet.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import Component from '@ember/component';
import Component from '@glimmer/component';
import { getCodeSnippet } from 'ember-code-snippet';
import { htmlSafe } from '@ember/template';
import { computed } from '@ember/object';

import Prism from 'prismjs/components/prism-core';
import 'prismjs/components/prism-clike';
Expand All @@ -11,13 +10,13 @@ import 'prismjs/components/prism-markup';
import 'prismjs/components/prism-markup-templating';
import 'prismjs/components/prism-css';

export default Component.extend({
source: computed('name', function () {
let { source, language } = getCodeSnippet(this.name);
let grammar = Prism.languages[language];
export default class CodeSnippetComponent extends Component {
get source() {
const { source, language } = getCodeSnippet(this.args.name);
const grammar = Prism.languages[language];
if (!grammar) {
throw new Error(`missing language ${language}`);
}
return htmlSafe(Prism.highlight(source, grammar, language));
}),
});
}
}
41 changes: 24 additions & 17 deletions docs/app/components/grid-overlay.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,26 @@
import Component from '@ember/component';
import Component from '@glimmer/component';
import isBrowser from 'liquid-fire/is-browser';

export default class GridOverlayComponent extends Component {
constructor() {
super(...arguments);
if (isBrowser()) {
document.addEventListener('keydown', function (e) {
// Ctrl-Alt-g shows vertical rhythm
if (e.ctrlKey && e.altKey && e.keyCode === 71) {
toggleGrid(22);
}
});
}
}
}

function show_lead(space, offset) {
let max = document.querySelector('body').clientHeight / space;
const max = document.querySelector('body').clientHeight / space;
hide_lead();
for (let i = 0; i < max; i++) {
const element = document.createElement('div');
element.class = 'grid';
element.classList.add('grid');
element.id = `vgrid${i}`;
const body = document.querySelector('body');
body.appendChild(element);
Expand All @@ -31,11 +46,15 @@ function css(element, styles) {
}

function hide_lead() {
document.querySelector('.grid').remove();
if (document.querySelector('.grid')) {
document.querySelectorAll('.grid').forEach((grid) => {
grid.remove();
});
}
}

function toggleGrid(leading, leading_offset) {
if (leading_offset == null) {
if (!leading_offset) {
leading_offset = 0;
}
if (document.querySelector('#vgrid0')) {
Expand All @@ -44,15 +63,3 @@ function toggleGrid(leading, leading_offset) {
return show_lead(leading, leading_offset);
}
}

export default Component.extend({
didInsertElement: function () {
this._super(...arguments);
document.addEventListener('keydown', function (e) {
// Ctrl-Alt-g shows vertical rhythm
if (e.ctrlKey && e.altKey && e.keyCode === 71) {
toggleGrid(22);
}
});
},
});
71 changes: 40 additions & 31 deletions docs/app/components/liquid-bind-demo.js
Original file line number Diff line number Diff line change
@@ -1,42 +1,51 @@
import moment from 'moment';
import Component from '@ember/component';
import Component from '@glimmer/component';
import { action } from '@ember/object';
import { tracked } from '@glimmer/tracking';
import { run } from '@ember/runloop';
import isBrowser from 'liquid-fire/is-browser';
import moment from 'moment';

export default class LiquidBindDemoComponent extends Component {
@tracked now;
@tracked hours;
@tracked minutes;
@tracked seconds;

constructor() {
super(...arguments);

export default Component.extend({
init() {
this._super();
this.tick();
},

didInsertElement() {
this._super(...arguments);
let self = this;
const self = this;

if (!isBrowser()) {
return;
}

this.interval = setInterval(function () {
run(self, 'tick');
}, 1000);
},
}

willDestroyElement() {
clearInterval(this.interval);
this._super();
},

tick: function (now) {
tick(now) {
if (!now) {
now = moment();
}
this.setProperties({
now: now,
hours: now.format('hh'),
minutes: now.format('mm'),
seconds: now.format('ss'),
});
},

actions: {
forceTick: function () {
clearInterval(this.interval);
this.tick(this.now.add({ hours: 1, minutes: 1, seconds: 1 }));
},
},
});

this.now = now;
this.hours = now.format('hh');
this.minutes = now.format('mm');
this.seconds = now.format('ss');
}

@action
destroyElement() {
clearInterval(this.interval);
}

@action
forceTick() {
clearInterval(this.interval);
this.tick(this.now.add({ hours: 1, minutes: 1, seconds: 1 }));
}
}
22 changes: 9 additions & 13 deletions docs/app/components/nav-link.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
import { computed } from '@ember/object';
import Component from '@ember/component';
import Component from '@glimmer/component';

export default Component.extend({
classNames: ['page-item'],
classNameBindings: ['direction'],
export default class NavLinkComponent extends Component {
get back() {
return this.args.topic && this.args.direction === 'back';
}

back: computed('direction', 'topic', function () {
return this.topic && this.direction === 'back';
}),

forward: computed('direction', 'topic', function () {
return this.topic && this.direction === 'forward';
}),
});
get forward() {
return this.args.topic && this.args.direction === 'forward';
}
}
12 changes: 8 additions & 4 deletions docs/app/components/simple-select.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
import Component from '@ember/component';
import Component from '@glimmer/component';
import { action } from '@ember/object';

export default Component.extend({
value: null,
});
export default class SimpleSelectComponent extends Component {
@action
change(evt) {
this.args.onChange(evt.target.value);
}
}
Loading