diff --git a/.ember-cli b/.ember-cli index 978eea2..4defd28 100644 --- a/.ember-cli +++ b/.ember-cli @@ -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. diff --git a/.eslintignore b/.eslintignore index d474a40..768fab3 100644 --- a/.eslintignore +++ b/.eslintignore @@ -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 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c926ebe..5cdd9cd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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 diff --git a/.gitignore b/.gitignore index f1e859b..71ad79d 100644 --- a/.gitignore +++ b/.gitignore @@ -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 diff --git a/.node-version b/.node-version index 3f430af..9a2a0e2 100644 --- a/.node-version +++ b/.node-version @@ -1 +1 @@ -v18 +v20 diff --git a/.prettierignore b/.prettierignore index 4178fd5..9385391 100644 --- a/.prettierignore +++ b/.prettierignore @@ -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 diff --git a/.watchmanconfig b/.watchmanconfig index e7834e3..f9c3d8f 100644 --- a/.watchmanconfig +++ b/.watchmanconfig @@ -1,3 +1,3 @@ { - "ignore_dirs": ["tmp", "dist"] + "ignore_dirs": ["dist"] } diff --git a/app/components/settings-form/handle.hbs b/app/components/settings-form/handle.hbs index 4352e3a..db78185 100644 --- a/app/components/settings-form/handle.hbs +++ b/app/components/settings-form/handle.hbs @@ -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' @@ -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' @@ -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' @@ -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' diff --git a/app/components/settings-form/support.hbs b/app/components/settings-form/support.hbs index b64163d..7cbf8ca 100644 --- a/app/components/settings-form/support.hbs +++ b/app/components/settings-form/support.hbs @@ -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' @@ -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' @@ -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}} @@ -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' diff --git a/app/components/settings-form/text.hbs b/app/components/settings-form/text.hbs index 45825a1..50c18f7 100644 --- a/app/components/settings-form/text.hbs +++ b/app/components/settings-form/text.hbs @@ -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' @@ -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' @@ -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' @@ -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' diff --git a/app/modifiers/scrollable-input-number.ts b/app/modifiers/scrollable-input-number.ts new file mode 100644 index 0000000..1d9b62e --- /dev/null +++ b/app/modifiers/scrollable-input-number.ts @@ -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 { + element?: CalciteInputText; + + constructor(owner: Owner, args: ArgsFor) { + 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); + } +} diff --git a/app/routes/app.ts b/app/routes/app.ts index ebb873b..24640be 100644 --- a/app/routes/app.ts +++ b/app/routes/app.ts @@ -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(); @@ -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('link[rel="canonical"]'); diff --git a/app/routes/index.ts b/app/routes/index.ts index f783df6..af593f1 100644 --- a/app/routes/index.ts +++ b/app/routes/index.ts @@ -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]); } } diff --git a/app/templates/application.hbs b/app/templates/application.hbs index 47db852..af6d348 100644 --- a/app/templates/application.hbs +++ b/app/templates/application.hbs @@ -2,7 +2,6 @@