From 60cd03e9b54b72caf088ba774512bb675791bfba Mon Sep 17 00:00:00 2001 From: Jonas Metzener Date: Thu, 28 Nov 2024 10:15:51 +0100 Subject: [PATCH] fix(deps): remove ember-composable-helpers dependency --- addon/-private/optional-argument.js | 14 ++ addon/components/uk-button.hbs | 2 +- addon/components/uk-button.js | 3 + addon/components/uk-sortable.hbs | 10 +- addon/components/uk-sortable.js | 11 + addon/components/uk-switcher/content/item.hbs | 12 +- addon/components/uk-switcher/content/item.js | 12 + blueprints/ember-uikit/index.js | 1 - package.json | 1 - pnpm-lock.yaml | 209 +++++++----------- tests/dummy/app/helpers/includes.js | 5 + tests/dummy/app/templates/index.hbs | 1 - 12 files changed, 143 insertions(+), 138 deletions(-) create mode 100644 addon/-private/optional-argument.js create mode 100644 addon/components/uk-sortable.js create mode 100644 addon/components/uk-switcher/content/item.js create mode 100644 tests/dummy/app/helpers/includes.js diff --git a/addon/-private/optional-argument.js b/addon/-private/optional-argument.js new file mode 100644 index 00000000..ab83177b --- /dev/null +++ b/addon/-private/optional-argument.js @@ -0,0 +1,14 @@ +import createDecorator from "ember-uikit/-private/decorator"; + +export default createDecorator(function ( + target, + property, + descriptor, + defaultValue = () => {}, +) { + return { + get() { + return this.args[property] ?? defaultValue; + }, + }; +}); diff --git a/addon/components/uk-button.hbs b/addon/components/uk-button.hbs index 82db56b3..ab993688 100644 --- a/addon/components/uk-button.hbs +++ b/addon/components/uk-button.hbs @@ -9,7 +9,7 @@ }} disabled={{@disabled}} title={{@title}} - {{on "click" (optional @onClick)}} + {{on "click" this.onClick}} ...attributes > {{#if @loading}} diff --git a/addon/components/uk-button.js b/addon/components/uk-button.js index b36e5b03..32bb6f68 100644 --- a/addon/components/uk-button.js +++ b/addon/components/uk-button.js @@ -1,6 +1,7 @@ import Component from "@glimmer/component"; import color, { COLOR_OPTIONS } from "ember-uikit/-private/color"; +import optionalArgument from "ember-uikit/-private/optional-argument"; import size from "ember-uikit/-private/size"; import width from "ember-uikit/-private/width"; @@ -22,4 +23,6 @@ export default class UkButtonComponent extends Component { @size({ template: "uk-button-$value$" }) size; @width width; + + @optionalArgument onClick; } diff --git a/addon/components/uk-sortable.hbs b/addon/components/uk-sortable.hbs index 4d0c5618..edf58fe9 100644 --- a/addon/components/uk-sortable.hbs +++ b/addon/components/uk-sortable.hbs @@ -14,11 +14,11 @@ cls-empty={{@clsEmpty}} cls-custom={{@clsCustom}} {{register-uikit-events - start=(optional @onStart) - stop=(optional @onStop) - moved=(optional @onMoved) - added=(optional @onAdded) - removed=(optional @onRemoved) + start=this.onStart + stop=this.onStop + moved=this.onMoved + added=this.onAdded + removed=this.onRemoved }} ...attributes > diff --git a/addon/components/uk-sortable.js b/addon/components/uk-sortable.js new file mode 100644 index 00000000..e12d1312 --- /dev/null +++ b/addon/components/uk-sortable.js @@ -0,0 +1,11 @@ +import Component from "@glimmer/component"; + +import optionalArgument from "ember-uikit/-private/optional-argument"; + +export default class UkSortableComponent extends Component { + @optionalArgument onStart; + @optionalArgument onStop; + @optionalArgument onMoved; + @optionalArgument onAdded; + @optionalArgument onRemoved; +} diff --git a/addon/components/uk-switcher/content/item.hbs b/addon/components/uk-switcher/content/item.hbs index 34f971b4..0a074d5e 100644 --- a/addon/components/uk-switcher/content/item.hbs +++ b/addon/components/uk-switcher/content/item.hbs @@ -1,11 +1,11 @@