Skip to content

Commit

Permalink
Renovate ember and deps (#133)
Browse files Browse the repository at this point in the history
* chore: run ember-cli-update to 5.8.1

* chore: update types

* chore: npx update-browserslist-db@latest

* fix: fix issue & tests

* feat: make number input "scroll updatable"

* fix: fix some lint errors

* chore: update @percy/cli

* feat: update to node 20 & renovate yarn.lock

* chore: try to fix this f******* test

* fix: fix translation
  • Loading branch information
romgere authored May 31, 2024
1 parent 81fbf53 commit d394328
Show file tree
Hide file tree
Showing 33 changed files with 2,914 additions and 4,075 deletions.
8 changes: 0 additions & 8 deletions .ember-cli
Original file line number Diff line number Diff line change
@@ -1,12 +1,4 @@
{
/**
Ember CLI sends analytics information by default. The data is completely
anonymous, but there are times when you might want to disable this behavior.

Setting `disableAnalytics` to true will prevent any data from being sent.
*/
"disableAnalytics": false,

/**
Setting `isTypeScriptProject` to true will force the blueprint generators to generate TypeScript
rather than JavaScript by default, when a TypeScript version of a given blueprint is available.
Expand Down
13 changes: 1 addition & 12 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,25 +1,14 @@
# unconventional js
/blueprints/*/files/
/vendor/

# compiled output
/declarations/
/dist/
/tmp/

# dependencies
/bower_components/
/node_modules/

# misc
/coverage/
!.*
.*/
.eslintcache

# ember-try
/.node_modules.ember-try/
/bower.json.ember-try
/npm-shrinkwrap.json.ember-try
/package.json.ember-try
/package-lock.json.ember-try
/yarn.lock.ember-try
10 changes: 5 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ jobs:
name: Lint & Tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Install Node
uses: actions/setup-node@v3
with:
fetch-depth: 1
- uses: actions/setup-node@v2-beta
with:
node-version: '18'
node-version: 20
cache: npm
- name: Install Dependencies
run: yarn install --frozen-lockfile
- name: Lint
Expand Down
9 changes: 1 addition & 8 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,28 +1,21 @@
# See https://help.github.com/ignore-files/ for more about ignoring files.

# compiled output
/dist/
/tmp/
/declarations/

# dependencies
/bower_components/
/node_modules/

# misc
/.env*
/.pnp*
/.sass-cache
/.eslintcache
/connect.lock
/coverage/
/libpeerconnection.log
/npm-debug.log*
/testem.log
/yarn-error.log

# ember-try
/.node_modules.ember-try/
/bower.json.ember-try
/npm-shrinkwrap.json.ember-try
/package.json.ember-try
/package-lock.json.ember-try
Expand Down
2 changes: 1 addition & 1 deletion .node-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v18
v20
14 changes: 1 addition & 13 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1,25 +1,13 @@
# unconventional js
/blueprints/*/files/
/vendor/

# compiled output
/dist/
/tmp/

# dependencies
/bower_components/
/node_modules/

# misc
/coverage/
!.*
.eslintcache
.lint-todo/
.*/

# ember-try
/.node_modules.ember-try/
/bower.json.ember-try
/npm-shrinkwrap.json.ember-try
/package.json.ember-try
/package-lock.json.ember-try
/yarn.lock.ember-try
2 changes: 1 addition & 1 deletion .watchmanconfig
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"ignore_dirs": ["tmp", "dist"]
"ignore_dirs": ["dist"]
}
4 changes: 4 additions & 0 deletions app/components/settings-form/handle.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
suffix-text={{t 'mm_unit'}}
value={{@model.handleSettings.size}}
{{on 'calciteInputNumberChange' (fn this.setHandleSettingsValue 'size')}}
{{scrollable-input-number}}
step='1'
number-button-type='horizontal'
icon='measure'
Expand All @@ -64,6 +65,7 @@
suffix-text={{t 'mm_unit'}}
value={{@model.handleSettings.size2}}
{{on 'calciteInputNumberChange' (fn this.setHandleSettingsValue 'size2')}}
{{scrollable-input-number}}
step='1'
number-button-type='horizontal'
icon='dimensions'
Expand All @@ -79,6 +81,7 @@
suffix-text={{t 'mm_unit'}}
value={{@model.handleSettings.offsetX}}
{{on 'calciteInputNumberChange' (fn this.setHandleSettingsValue 'offsetX')}}
{{scrollable-input-number}}
step='1'
number-button-type='horizontal'
icon='center-horizontal'
Expand All @@ -93,6 +96,7 @@
suffix-text={{t 'mm_unit'}}
value={{@model.handleSettings.offsetY}}
{{on 'calciteInputNumberChange' (fn this.setHandleSettingsValue 'offsetY')}}
{{scrollable-input-number}}
step='1'
number-button-type='horizontal'
icon='center-vertical'
Expand Down
4 changes: 4 additions & 0 deletions app/components/settings-form/support.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
suffix-text={{t 'mm_unit'}}
value={{@model.supportHeight}}
{{on 'calciteInputNumberChange' (fn this.setNumber 'supportHeight')}}
{{scrollable-input-number}}
step='1'
number-button-type='horizontal'
icon='antenna-height'
Expand All @@ -19,6 +20,7 @@
suffix-text={{t 'mm_unit'}}
value={{@model.supportBorderRadius}}
{{on 'calciteInputNumberChange' (fn this.setNumber 'supportBorderRadius')}}
{{scrollable-input-number}}
step='1'
number-button-type='horizontal'
icon='border-radius-rounded'
Expand All @@ -44,6 +46,7 @@
suffix-text={{t 'mm_unit'}}
value={{get @model.supportPadding pos}}
{{on 'calciteInputNumberChange' (fn this.setSupportPaddingDir pos)}}
{{scrollable-input-number}}
step='1'
icon={{get this.supportPositionIcon pos}}
data-test-settings-supportPadding={{pos}}
Expand All @@ -58,6 +61,7 @@
suffix-text={{t 'mm_unit'}}
value={{this.supportPadding}}
{{on 'calciteInputNumberChange' this.setSupportPadding}}
{{scrollable-input-number}}
step='1'
number-button-type='horizontal'
icon='dimensions-unit'
Expand Down
4 changes: 4 additions & 0 deletions app/components/settings-form/text.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@
{{!-- suffix-text={{t "mm_unit"}} --}}
value={{@model.size}}
{{on 'calciteInputNumberChange' (fn this.setNumber 'size')}}
{{scrollable-input-number}}
step='1'
number-button-type='horizontal'
icon='change-font-size'
Expand All @@ -87,6 +88,7 @@
suffix-text={{t 'mm_unit'}}
value={{@model.height}}
{{on 'calciteInputNumberChange' (fn this.setNumber 'height')}}
{{scrollable-input-number}}
step='1'
number-button-type='horizontal'
icon='dimensions-wall'
Expand All @@ -101,6 +103,7 @@
suffix-text={{t 'mm_unit'}}
value={{@model.spacing}}
{{on 'calciteInputNumberChange' (fn this.setNumber 'spacing')}}
{{scrollable-input-number}}
step='1'
number-button-type='horizontal'
icon='distribute-width-evenly'
Expand All @@ -116,6 +119,7 @@
suffix-text={{t 'mm_unit'}}
value={{@model.vSpacing}}
{{on 'calciteInputNumberChange' (fn this.setNumber 'vSpacing')}}
{{scrollable-input-number}}
step='1'
number-button-type='horizontal'
icon='distribute-height-evenly'
Expand Down
45 changes: 45 additions & 0 deletions app/modifiers/scrollable-input-number.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import Modifier from 'ember-modifier';
import type DefaultSignature from 'ember-modifier';
import type { ArgsFor } from 'ember-modifier';

import type { CalciteInputText } from '@esri/calcite-components/dist/components/calcite-input-text';
import { registerDestructor } from '@ember/destroyable';
import { action } from '@ember/object';

import type Owner from '@ember/owner';

export default class ThreeRendererModifier extends Modifier<DefaultSignature> {
element?: CalciteInputText;

constructor(owner: Owner, args: ArgsFor<DefaultSignature>) {
super(owner, args);
registerDestructor(this, this.cleanup);
}

@action
onWHeel(e: WheelEvent) {
if (!e.deltaY) {
return;
}

const step = e.ctrlKey ? 10 : e.altKey ? 0.1 : 1;
const factor = e.deltaY < 0 ? 1 : -1;
const newValue = Number(parseFloat(this.element!.value) + step * factor).toFixed(2);

this.element!.value = `${newValue}`;
this.element!.dispatchEvent(new Event('calciteInputNumberChange'));

e.preventDefault();
e.stopPropagation();
}

@action
cleanup() {
this.element?.removeEventListener('wheel', this.onWHeel);
}

modify(element: CalciteInputText) {
this.element = element;
element.addEventListener('wheel', this.onWHeel);
}
}
6 changes: 4 additions & 2 deletions app/routes/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ export default class AppRoute extends Route {
}

async model({ locale }: { locale: string }) {
this.intl.locale = locale === 'en-us' ? locale : [locale, 'en-us'];
if (this.intl.locale[0] !== locale) {
this.intl.locale = locale === 'en-us' ? locale : [locale, 'en-us'];
}
// No await here, let's the loading happen & await for it in generator route
this.harfbuzz.loadWASM();
this.fontManager.loadFont();
Expand All @@ -40,7 +42,7 @@ export default class AppRoute extends Route {
metaDescription.content = this.intl.t('seo.description');
}

const { name: toRouteName } = transition.to;
const toRouteName = transition.to?.name || 'app';
const canonicalHref = this.router.urlFor(toRouteName, { locale: this.intl.primaryLocale });

const canonicalLink = document.head.querySelector<HTMLLinkElement>('link[rel="canonical"]');
Expand Down
4 changes: 3 additions & 1 deletion app/routes/index.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import Route from '@ember/routing/route';
import { inject as service } from '@ember/service';
import RouterService from '@ember/routing/router-service';
import IntlService from 'ember-intl/services/intl';

export default class IndexRoute extends Route {
@service declare intl: IntlService;
@service declare router: RouterService;

async model() {
this.transitionTo('app.index', this.intl.locale[0]);
this.router.transitionTo('app.index', this.intl.locale[0]);
}
}
1 change: 0 additions & 1 deletion app/templates/application.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

<calcite-shell>
<div slot='header' id='header'>

<h2 id='header-title'>
<LinkTo @route='app.index'>{{t 'app_name'}}</LinkTo>
</h2>
Expand Down
2 changes: 1 addition & 1 deletion config/ember-cli-update.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"packages": [
{
"name": "ember-cli",
"version": "4.12.1",
"version": "5.8.1",
"blueprints": [
{
"name": "app",
Expand Down
3 changes: 2 additions & 1 deletion config/optional-features.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
"application-template-wrapper": false,
"default-async-observers": true,
"jquery-integration": false,
"template-only-glimmer-components": true
"template-only-glimmer-components": true,
"no-implicit-route-model": true
}
Loading

0 comments on commit d394328

Please sign in to comment.