ember-safe-button 2.1.1 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -3
- package/addon-main.cjs +6 -0
- package/dist/_app_/components/safe-button/animations/flip.js +1 -0
- package/dist/_app_/components/safe-button/animations/index.js +1 -0
- package/dist/_app_/components/safe-button/animations/lift-bars.js +1 -0
- package/dist/_app_/components/safe-button/animations/poing.js +1 -0
- package/dist/_app_/components/safe-button/animations/roll.js +1 -0
- package/dist/_app_/components/safe-button/animations/slide.js +1 -0
- package/dist/_app_/components/safe-button/animations/zoom.js +1 -0
- package/dist/_app_/components/safe-button/index.js +1 -0
- package/dist/_app_/components/safety/index.js +1 -0
- package/dist/_app_/components/trigger/index.js +1 -0
- package/dist/_app_/modifiers/animate-me.js +1 -0
- package/dist/components/safe-button/animations/flip.js +103 -0
- package/dist/components/safe-button/animations/flip.js.map +1 -0
- package/dist/components/safe-button/animations/index.js +18 -0
- package/dist/components/safe-button/animations/index.js.map +1 -0
- package/dist/components/safe-button/animations/lift-bars.js +53 -0
- package/dist/components/safe-button/animations/lift-bars.js.map +1 -0
- package/dist/components/safe-button/animations/poing.js +93 -0
- package/dist/components/safe-button/animations/poing.js.map +1 -0
- package/dist/components/safe-button/animations/roll.js +57 -0
- package/dist/components/safe-button/animations/roll.js.map +1 -0
- package/dist/components/safe-button/animations/slide.js +57 -0
- package/dist/components/safe-button/animations/slide.js.map +1 -0
- package/dist/components/safe-button/animations/zoom.js +73 -0
- package/dist/components/safe-button/animations/zoom.js.map +1 -0
- package/dist/components/safe-button/index.js +9 -0
- package/dist/components/safe-button/index.js.map +1 -0
- package/dist/components/safety/index.js +54 -0
- package/dist/components/safety/index.js.map +1 -0
- package/dist/components/trigger/index.js +44 -0
- package/dist/components/trigger/index.js.map +1 -0
- package/dist/index-65a73164.js +249 -0
- package/dist/index-65a73164.js.map +1 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -0
- package/dist/modifiers/animate-me.js +23 -0
- package/dist/modifiers/animate-me.js.map +1 -0
- package/package.json +70 -69
- package/.gitlab-ci.yml +0 -27
- package/.prettierignore +0 -21
- package/.prettierrc.js +0 -5
- package/.vscode/settings.json +0 -19
- package/CHANGELOG.md +0 -126
- package/LICENSE.md +0 -9
- package/addon/components/safe-button/animations/flip.js +0 -114
- package/addon/components/safe-button/animations/index.js +0 -15
- package/addon/components/safe-button/animations/lift-bars.js +0 -50
- package/addon/components/safe-button/animations/poing.js +0 -99
- package/addon/components/safe-button/animations/roll.js +0 -50
- package/addon/components/safe-button/animations/slide.js +0 -50
- package/addon/components/safe-button/animations/zoom.js +0 -52
- package/addon/components/safe-button/index.hbs +0 -35
- package/addon/components/safe-button/index.js +0 -184
- package/addon/components/safety/index.hbs +0 -20
- package/addon/components/safety/index.js +0 -41
- package/addon/components/trigger/index.hbs +0 -20
- package/addon/components/trigger/index.js +0 -31
- package/addon/modifiers/animate-me.js +0 -20
- package/app/components/safe-button.js +0 -1
- package/app/components/safety.js +0 -1
- package/app/components/trigger.js +0 -2
- package/app/modifiers/animate-me.js +0 -1
- package/app/templates/components/safe-button.js +0 -1
- package/app/templates/components/safety.js +0 -1
- package/app/templates/components/trigger.js +0 -1
- package/config/addon-docs.js +0 -13
- package/config/deploy.js +0 -29
- package/config/environment.js +0 -5
- package/config/tailwindcss-config.js +0 -924
- package/doc/demo.gif +0 -0
- package/doc/logo.png +0 -0
- package/index.js +0 -5
- package/netlify.toml +0 -3
- package/renovate.json +0 -75
- package/yarn-error.log +0 -13431
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { S as SAFETY_STATUS, _ as _defineProperty } from '../../index-65a73164.js';
|
|
2
|
+
import { setComponentTemplate } from '@ember/component';
|
|
3
|
+
import { hbs } from 'ember-cli-htmlbars';
|
|
4
|
+
import Component from '@glimmer/component';
|
|
5
|
+
|
|
6
|
+
var TEMPLATE = hbs("<button\n class={{this.BASIC_CLASS}}\n disabled={{this.isDisabled}}\n aria-label={{this.ariaLabel}}\n type=\'button\'\n tabindex={{if this.isDisabled \'-1\' \'0\'}}\n ...attributes\n {{on \'click\' @onClick}}\n {{animate-me\n safetyStatus=@safetyStatus\n webAnimations=@webAnimations\n focusMe=this.focusMe\n }}\n>\n {{#if (has-block)}}\n {{yield}}\n {{else}}\n {{@displayedMessage}}\n {{/if}}\n</button>");
|
|
7
|
+
|
|
8
|
+
const BASIC_CLASS = 'ember-safe-button-safety';
|
|
9
|
+
const ARIA_LABELS = {
|
|
10
|
+
[SAFETY_STATUS.LOCKED]: 'Deactivate safety',
|
|
11
|
+
[SAFETY_STATUS.UNLOCKING]: 'Deactivating safety',
|
|
12
|
+
[SAFETY_STATUS.UNLOCKED]: 'Safety not active',
|
|
13
|
+
[SAFETY_STATUS.LOCKING]: 'Activating safety'
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
Safety is a component that covers the trigger.
|
|
17
|
+
|
|
18
|
+
```hbs
|
|
19
|
+
<SafeButton
|
|
20
|
+
@onConfirm={{action safeButtonClicked}} as |button|
|
|
21
|
+
>
|
|
22
|
+
<button.safety class="bg-grey-light">
|
|
23
|
+
This is safety
|
|
24
|
+
</button.safety>
|
|
25
|
+
</SafeButton>
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
@class SafetyComponent
|
|
29
|
+
*/
|
|
30
|
+
|
|
31
|
+
class SafetyComponent extends Component {
|
|
32
|
+
constructor(...args) {
|
|
33
|
+
super(...args);
|
|
34
|
+
|
|
35
|
+
_defineProperty(this, "BASIC_CLASS", BASIC_CLASS);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
get isDisabled() {
|
|
39
|
+
return this.args.safetyStatus === SAFETY_STATUS.UNLOCKED;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
get focusMe() {
|
|
43
|
+
return !this.isDisabled;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
get ariaLabel() {
|
|
47
|
+
return ARIA_LABELS[this.args.safetyStatus];
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
}
|
|
51
|
+
setComponentTemplate(TEMPLATE, SafetyComponent);
|
|
52
|
+
|
|
53
|
+
export { ARIA_LABELS, BASIC_CLASS, SafetyComponent as default };
|
|
54
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/components/safety/index.hbs.js","../../../src/components/safety/index.js"],"sourcesContent":["import { hbs } from 'ember-cli-htmlbars';\nexport default hbs(\"<button\\n class={{this.BASIC_CLASS}}\\n disabled={{this.isDisabled}}\\n aria-label={{this.ariaLabel}}\\n type=\\'button\\'\\n tabindex={{if this.isDisabled \\'-1\\' \\'0\\'}}\\n ...attributes\\n {{on \\'click\\' @onClick}}\\n {{animate-me\\n safetyStatus=@safetyStatus\\n webAnimations=@webAnimations\\n focusMe=this.focusMe\\n }}\\n>\\n {{#if (has-block)}}\\n {{yield}}\\n {{else}}\\n {{@displayedMessage}}\\n {{/if}}\\n</button>\")","import Component from '@glimmer/component';\n\nimport { SAFETY_STATUS } from '../safe-button/index';\n\nexport const BASIC_CLASS = 'ember-safe-button-safety';\nexport const ARIA_LABELS = {\n [SAFETY_STATUS.LOCKED]: 'Deactivate safety',\n [SAFETY_STATUS.UNLOCKING]: 'Deactivating safety',\n [SAFETY_STATUS.UNLOCKED]: 'Safety not active',\n [SAFETY_STATUS.LOCKING]: 'Activating safety',\n};\n\n/**\n Safety is a component that covers the trigger.\n\n ```hbs\n <SafeButton\n @onConfirm={{action safeButtonClicked}} as |button|\n >\n <button.safety class=\"bg-grey-light\">\n This is safety\n </button.safety>\n </SafeButton>\n ```\n\n @class SafetyComponent\n */\nexport default class SafetyComponent extends Component {\n BASIC_CLASS = BASIC_CLASS;\n\n get isDisabled() {\n return this.args.safetyStatus === SAFETY_STATUS.UNLOCKED;\n }\n\n get focusMe() {\n return !this.isDisabled;\n }\n\n get ariaLabel() {\n return ARIA_LABELS[this.args.safetyStatus];\n }\n}\n"],"names":["hbs","BASIC_CLASS","ARIA_LABELS","SAFETY_STATUS","LOCKED","UNLOCKING","UNLOCKED","LOCKING","SafetyComponent","Component","isDisabled","args","safetyStatus","focusMe","ariaLabel"],"mappings":";;;;;AACA,eAAeA,GAAG,CAAC,ibAAD,CAAlB;;ACGO,MAAMC,WAAW,GAAG,2BAApB;AACA,MAAMC,WAAW,GAAG;AACzB,EAAA,CAACC,aAAa,CAACC,MAAf,GAAwB,mBADC;AAEzB,EAAA,CAACD,aAAa,CAACE,SAAf,GAA2B,qBAFF;AAGzB,EAAA,CAACF,aAAa,CAACG,QAAf,GAA0B,mBAHD;EAIzB,CAACH,aAAa,CAACI,OAAf,GAAyB,mBAAA;AAJA,EAApB;AAOP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACe,MAAMC,eAAN,SAA8BC,SAA9B,CAAwC;AAAA,EAAA,WAAA,CAAA,GAAA,IAAA,EAAA;AAAA,IAAA,KAAA,CAAA,GAAA,IAAA,CAAA,CAAA;;AAAA,IAAA,eAAA,CAAA,IAAA,EAAA,aAAA,EACvCR,WADuC,CAAA,CAAA;AAAA,GAAA;;AAGvC,EAAA,IAAVS,UAAU,GAAG;AACf,IAAA,OAAO,KAAKC,IAAL,CAAUC,YAAV,KAA2BT,aAAa,CAACG,QAAhD,CAAA;AACD,GAAA;;AAEU,EAAA,IAAPO,OAAO,GAAG;IACZ,OAAO,CAAC,KAAKH,UAAb,CAAA;AACD,GAAA;;AAEY,EAAA,IAATI,SAAS,GAAG;AACd,IAAA,OAAOZ,WAAW,CAAC,IAAA,CAAKS,IAAL,CAAUC,YAAX,CAAlB,CAAA;AACD,GAAA;;AAboD,CAAA;+BAAlCJ;;;;"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { _ as _defineProperty, S as SAFETY_STATUS } from '../../index-65a73164.js';
|
|
2
|
+
import { setComponentTemplate } from '@ember/component';
|
|
3
|
+
import { hbs } from 'ember-cli-htmlbars';
|
|
4
|
+
import Component from '@glimmer/component';
|
|
5
|
+
|
|
6
|
+
var TEMPLATE = hbs("<button\n class={{this.BASIC_CLASS}}\n disabled={{this.isDisabled}}\n aria-label=\'Confirm action\'\n type=\'button\'\n tabindex={{if this.isDisabled \'-1\' \'0\'}}\n ...attributes\n {{on \'click\' @onClick}}\n {{animate-me\n safetyStatus=@safetyStatus\n webAnimations=@webAnimations\n focusMe=this.focusMe\n }}\n>\n {{#if (has-block)}}\n {{yield}}\n {{else}}\n {{@displayedMessage}}\n {{/if}}\n</button>");
|
|
7
|
+
|
|
8
|
+
const BASIC_CLASS = 'ember-safe-button-trigger';
|
|
9
|
+
/**
|
|
10
|
+
Trigger is a component that is by default covered by safety and triggers the action passed to <SafeButton> when clicked.
|
|
11
|
+
|
|
12
|
+
```hbs
|
|
13
|
+
<SafeButton
|
|
14
|
+
@onConfirm={{action safeButtonClicked}} as |button|
|
|
15
|
+
>
|
|
16
|
+
<button.trigger class="bg-red-dark">
|
|
17
|
+
Trigger
|
|
18
|
+
</button.trigger>
|
|
19
|
+
</SafeButton>
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
@class SafetyComponent
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
class TriggerComponent extends Component {
|
|
26
|
+
constructor(...args) {
|
|
27
|
+
super(...args);
|
|
28
|
+
|
|
29
|
+
_defineProperty(this, "BASIC_CLASS", BASIC_CLASS);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
get isDisabled() {
|
|
33
|
+
return this.args.safetyStatus !== SAFETY_STATUS.UNLOCKED;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
get focusMe() {
|
|
37
|
+
return !this.isDisabled;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
}
|
|
41
|
+
setComponentTemplate(TEMPLATE, TriggerComponent);
|
|
42
|
+
|
|
43
|
+
export { BASIC_CLASS, TriggerComponent as default };
|
|
44
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/components/trigger/index.hbs.js","../../../src/components/trigger/index.js"],"sourcesContent":["import { hbs } from 'ember-cli-htmlbars';\nexport default hbs(\"<button\\n class={{this.BASIC_CLASS}}\\n disabled={{this.isDisabled}}\\n aria-label=\\'Confirm action\\'\\n type=\\'button\\'\\n tabindex={{if this.isDisabled \\'-1\\' \\'0\\'}}\\n ...attributes\\n {{on \\'click\\' @onClick}}\\n {{animate-me\\n safetyStatus=@safetyStatus\\n webAnimations=@webAnimations\\n focusMe=this.focusMe\\n }}\\n>\\n {{#if (has-block)}}\\n {{yield}}\\n {{else}}\\n {{@displayedMessage}}\\n {{/if}}\\n</button>\")","import Component from '@glimmer/component';\n\nimport { SAFETY_STATUS } from '../safe-button/index';\n\nexport const BASIC_CLASS = 'ember-safe-button-trigger';\n\n/**\n Trigger is a component that is by default covered by safety and triggers the action passed to <SafeButton> when clicked.\n\n ```hbs\n <SafeButton\n @onConfirm={{action safeButtonClicked}} as |button|\n >\n <button.trigger class=\"bg-red-dark\">\n Trigger\n </button.trigger>\n </SafeButton>\n ```\n\n @class SafetyComponent\n */\nexport default class TriggerComponent extends Component {\n BASIC_CLASS = BASIC_CLASS;\n\n get isDisabled() {\n return this.args.safetyStatus !== SAFETY_STATUS.UNLOCKED;\n }\n\n get focusMe() {\n return !this.isDisabled;\n }\n}\n"],"names":["hbs","BASIC_CLASS","TriggerComponent","Component","isDisabled","args","safetyStatus","SAFETY_STATUS","UNLOCKED","focusMe"],"mappings":";;;;;AACA,eAAeA,GAAG,CAAC,ibAAD,CAAlB;;ACGO,MAAMC,WAAW,GAAG,4BAApB;AAEP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACe,MAAMC,gBAAN,SAA+BC,SAA/B,CAAyC;AAAA,EAAA,WAAA,CAAA,GAAA,IAAA,EAAA;AAAA,IAAA,KAAA,CAAA,GAAA,IAAA,CAAA,CAAA;;AAAA,IAAA,eAAA,CAAA,IAAA,EAAA,aAAA,EACxCF,WADwC,CAAA,CAAA;AAAA,GAAA;;AAGxC,EAAA,IAAVG,UAAU,GAAG;AACf,IAAA,OAAO,KAAKC,IAAL,CAAUC,YAAV,KAA2BC,aAAa,CAACC,QAAhD,CAAA;AACD,GAAA;;AAEU,EAAA,IAAPC,OAAO,GAAG;IACZ,OAAO,CAAC,KAAKL,UAAb,CAAA;AACD,GAAA;;AATqD,CAAA;+BAAnCF;;;;"}
|
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
import { setComponentTemplate } from '@ember/component';
|
|
2
|
+
import { hbs } from 'ember-cli-htmlbars';
|
|
3
|
+
import Component from '@glimmer/component';
|
|
4
|
+
import { tracked } from '@glimmer/tracking';
|
|
5
|
+
import { assert } from '@ember/debug';
|
|
6
|
+
import { action } from '@ember/object';
|
|
7
|
+
import { task, timeout } from 'ember-concurrency';
|
|
8
|
+
import embeddedAnimations from './components/safe-button/animations/index.js';
|
|
9
|
+
|
|
10
|
+
function _defineProperty(obj, key, value) {
|
|
11
|
+
if (key in obj) {
|
|
12
|
+
Object.defineProperty(obj, key, {
|
|
13
|
+
value: value,
|
|
14
|
+
enumerable: true,
|
|
15
|
+
configurable: true,
|
|
16
|
+
writable: true
|
|
17
|
+
});
|
|
18
|
+
} else {
|
|
19
|
+
obj[key] = value;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
return obj;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function _initializerDefineProperty(target, property, descriptor, context) {
|
|
26
|
+
if (!descriptor) return;
|
|
27
|
+
Object.defineProperty(target, property, {
|
|
28
|
+
enumerable: descriptor.enumerable,
|
|
29
|
+
configurable: descriptor.configurable,
|
|
30
|
+
writable: descriptor.writable,
|
|
31
|
+
value: descriptor.initializer ? descriptor.initializer.call(context) : void 0
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function _applyDecoratedDescriptor(target, property, decorators, descriptor, context) {
|
|
36
|
+
var desc = {};
|
|
37
|
+
Object.keys(descriptor).forEach(function (key) {
|
|
38
|
+
desc[key] = descriptor[key];
|
|
39
|
+
});
|
|
40
|
+
desc.enumerable = !!desc.enumerable;
|
|
41
|
+
desc.configurable = !!desc.configurable;
|
|
42
|
+
|
|
43
|
+
if ('value' in desc || desc.initializer) {
|
|
44
|
+
desc.writable = true;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
desc = decorators.slice().reverse().reduce(function (desc, decorator) {
|
|
48
|
+
return decorator(target, property, desc) || desc;
|
|
49
|
+
}, desc);
|
|
50
|
+
|
|
51
|
+
if (context && desc.initializer !== void 0) {
|
|
52
|
+
desc.value = desc.initializer ? desc.initializer.call(context) : void 0;
|
|
53
|
+
desc.initializer = undefined;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
if (desc.initializer === void 0) {
|
|
57
|
+
Object.defineProperty(target, property, desc);
|
|
58
|
+
desc = null;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
return desc;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
var TEMPLATE = hbs("<div class=\'ember-safe-button\' ...attributes>\n {{#if (has-block)}}\n {{yield\n (hash\n trigger=(component\n \'trigger\'\n onClick=@onConfirm\n safetyStatus=this.safetyStatus\n displayedMessage=this.displayedMessage\n webAnimations=this.webAnimations.trigger\n )\n safety=(component\n \'safety\'\n onClick=this.onUnlocking\n safetyStatus=this.safetyStatus\n displayedMessage=this.displayedMessage\n webAnimations=this.webAnimations.safety\n )\n )\n }}\n {{else}}\n <Trigger\n @onClick={{@onConfirm}}\n @safetyStatus={{this.safetyStatus}}\n @displayedMessage={{this.displayedMessage}}\n @webAnimations={{this.webAnimations.trigger}}\n />\n <Safety\n @onClick={{this.onUnlocking}}\n @safetyStatus={{this.safetyStatus}}\n @displayedMessage={{this.displayedMessage}}\n @webAnimations={{this.webAnimations.safety}}\n />\n {{/if}}\n</div>");
|
|
65
|
+
|
|
66
|
+
var _dec, _class, _descriptor, _descriptor2;
|
|
67
|
+
const DEFAULT_TIMEOUT = 3000;
|
|
68
|
+
const DEFAULT_ANIMATION = 'slide';
|
|
69
|
+
const SAFETY_STATUS = {
|
|
70
|
+
LOCKED: 1,
|
|
71
|
+
UNLOCKING: 2,
|
|
72
|
+
UNLOCKED: 3,
|
|
73
|
+
LOCKING: 4
|
|
74
|
+
};
|
|
75
|
+
/**
|
|
76
|
+
Main component.
|
|
77
|
+
|
|
78
|
+
```hbs
|
|
79
|
+
<SafeButton
|
|
80
|
+
class="border-black"
|
|
81
|
+
@animation={{this.animation}}
|
|
82
|
+
@message="Delete me"
|
|
83
|
+
@timeout={{2000}}
|
|
84
|
+
@onConfirm={{action safeButtonClicked}} />
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
```
|
|
88
|
+
@class SafeButtonComponent
|
|
89
|
+
@param {string} [class="ember-safe-button"] CSS class to be applied on the wrapping element.
|
|
90
|
+
@param {object} [animation="slid"] Definition of animation; It can either be string and point to one of the pre-defined animations; Or it can be an object describing Web Animation API
|
|
91
|
+
@param {number} [timeout=3000] Number of millisenconds after which the safety rolls back over the trigger.
|
|
92
|
+
@param {string} [message="delete"] Text to be printed on the buttons in case block is not provided.
|
|
93
|
+
@param {function} onConfirm - Action to trigger whenever user clicks the trigger.
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
When trying to construct your own `@animation` object you can take inspiration from the simple `slide` animation. The thing to keep in mind is that these go directly as parameters to [element.animate()](https://developer.mozilla.org/en-US/docs/Web/API/Element/animate) and that there are in fact four animations of which always two fire at the same time:
|
|
97
|
+
|
|
98
|
+
- `safety.unlocking` and `trigger.unlocking`
|
|
99
|
+
- `safety.locking` and `trigger.locking`
|
|
100
|
+
|
|
101
|
+
```js
|
|
102
|
+
{
|
|
103
|
+
safety: {
|
|
104
|
+
unlocking: {
|
|
105
|
+
keyframes: [
|
|
106
|
+
{ transform: 'translateX(0)' },
|
|
107
|
+
{ transform: 'translateX(-100%)' },
|
|
108
|
+
],
|
|
109
|
+
options: {
|
|
110
|
+
duration: 1000,
|
|
111
|
+
fill: 'both',
|
|
112
|
+
easing: 'ease',
|
|
113
|
+
},
|
|
114
|
+
},
|
|
115
|
+
locking: {
|
|
116
|
+
keyframes: [
|
|
117
|
+
{ transform: 'translateX(-100%)' },
|
|
118
|
+
{ transform: 'translateX(0)' },
|
|
119
|
+
],
|
|
120
|
+
options: {
|
|
121
|
+
duration: 1000,
|
|
122
|
+
fill: 'both',
|
|
123
|
+
easing: 'ease',
|
|
124
|
+
},
|
|
125
|
+
},
|
|
126
|
+
},
|
|
127
|
+
trigger: {
|
|
128
|
+
unlocking: {
|
|
129
|
+
keyframes: [
|
|
130
|
+
{ transform: 'translateX(100%)' },
|
|
131
|
+
{ transform: 'translateX(0)' },
|
|
132
|
+
],
|
|
133
|
+
options: {
|
|
134
|
+
duration: 1000,
|
|
135
|
+
fill: 'both',
|
|
136
|
+
easing: 'ease',
|
|
137
|
+
},
|
|
138
|
+
},
|
|
139
|
+
locking: {
|
|
140
|
+
keyframes: [
|
|
141
|
+
{ transform: 'translateX(0)' },
|
|
142
|
+
{ transform: 'translateX(100%)' },
|
|
143
|
+
],
|
|
144
|
+
options: {
|
|
145
|
+
duration: 1000,
|
|
146
|
+
fill: 'both',
|
|
147
|
+
easing: 'ease',
|
|
148
|
+
},
|
|
149
|
+
},
|
|
150
|
+
},
|
|
151
|
+
}
|
|
152
|
+
```
|
|
153
|
+
*/
|
|
154
|
+
|
|
155
|
+
let SafeButtonComponent = (_dec = task(function* () {
|
|
156
|
+
yield timeout(this.timeout);
|
|
157
|
+
this.safetyStatus = SAFETY_STATUS.LOCKING;
|
|
158
|
+
}), (_class = class SafeButtonComponent extends Component {
|
|
159
|
+
constructor() {
|
|
160
|
+
super(...arguments);
|
|
161
|
+
|
|
162
|
+
_initializerDefineProperty(this, "safetyStatus", _descriptor, this);
|
|
163
|
+
|
|
164
|
+
_initializerDefineProperty(this, "triggerSafety", _descriptor2, this);
|
|
165
|
+
|
|
166
|
+
assert('@onConfirm attribute must be set', typeof this.args.onConfirm === 'function');
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
get activeAnimation() {
|
|
170
|
+
const animation = this.args.animation || DEFAULT_ANIMATION;
|
|
171
|
+
return typeof animation === 'string' ? embeddedAnimations[animation] : animation;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
get webAnimations() {
|
|
175
|
+
const {
|
|
176
|
+
activeAnimation,
|
|
177
|
+
onUnlocked,
|
|
178
|
+
onLocked
|
|
179
|
+
} = this;
|
|
180
|
+
return {
|
|
181
|
+
safety: {
|
|
182
|
+
unlocking: ({
|
|
183
|
+
element
|
|
184
|
+
}) => {
|
|
185
|
+
let animation = element.animate(activeAnimation.safety.unlocking.keyframes, activeAnimation.safety.unlocking.options);
|
|
186
|
+
animation.onfinish = onUnlocked;
|
|
187
|
+
},
|
|
188
|
+
locking: ({
|
|
189
|
+
element
|
|
190
|
+
}) => {
|
|
191
|
+
let animation = element.animate(activeAnimation.safety.locking.keyframes, activeAnimation.safety.locking.options);
|
|
192
|
+
animation.onfinish = onLocked;
|
|
193
|
+
}
|
|
194
|
+
},
|
|
195
|
+
trigger: {
|
|
196
|
+
unlocking({
|
|
197
|
+
element
|
|
198
|
+
}) {
|
|
199
|
+
element.animate(activeAnimation.trigger.unlocking.keyframes, activeAnimation.trigger.unlocking.options);
|
|
200
|
+
},
|
|
201
|
+
|
|
202
|
+
locking({
|
|
203
|
+
element
|
|
204
|
+
}) {
|
|
205
|
+
element.animate(activeAnimation.trigger.locking.keyframes, activeAnimation.trigger.locking.options);
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
}
|
|
209
|
+
};
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
get timeout() {
|
|
213
|
+
return this.args.timeout || DEFAULT_TIMEOUT;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
get displayedMessage() {
|
|
217
|
+
return this.args.message || 'delete';
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
onUnlocking() {
|
|
221
|
+
this.safetyStatus = SAFETY_STATUS.UNLOCKING;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
onUnlocked() {
|
|
225
|
+
this.safetyStatus = SAFETY_STATUS.UNLOCKED;
|
|
226
|
+
this.triggerSafety.perform();
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
onLocked() {
|
|
230
|
+
this.safetyStatus = SAFETY_STATUS.LOCKED;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
}, (_descriptor = _applyDecoratedDescriptor(_class.prototype, "safetyStatus", [tracked], {
|
|
234
|
+
configurable: true,
|
|
235
|
+
enumerable: true,
|
|
236
|
+
writable: true,
|
|
237
|
+
initializer: function () {
|
|
238
|
+
return SAFETY_STATUS.LOCKED;
|
|
239
|
+
}
|
|
240
|
+
}), _applyDecoratedDescriptor(_class.prototype, "onUnlocking", [action], Object.getOwnPropertyDescriptor(_class.prototype, "onUnlocking"), _class.prototype), _applyDecoratedDescriptor(_class.prototype, "onUnlocked", [action], Object.getOwnPropertyDescriptor(_class.prototype, "onUnlocked"), _class.prototype), _applyDecoratedDescriptor(_class.prototype, "onLocked", [action], Object.getOwnPropertyDescriptor(_class.prototype, "onLocked"), _class.prototype), _descriptor2 = _applyDecoratedDescriptor(_class.prototype, "triggerSafety", [_dec], {
|
|
241
|
+
configurable: true,
|
|
242
|
+
enumerable: true,
|
|
243
|
+
writable: true,
|
|
244
|
+
initializer: null
|
|
245
|
+
})), _class));
|
|
246
|
+
setComponentTemplate(TEMPLATE, SafeButtonComponent);
|
|
247
|
+
|
|
248
|
+
export { SAFETY_STATUS as S, _defineProperty as _, SafeButtonComponent as a };
|
|
249
|
+
//# sourceMappingURL=index-65a73164.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-65a73164.js","sources":["../src/components/safe-button/index.hbs.js","../src/components/safe-button/index.js"],"sourcesContent":["import { hbs } from 'ember-cli-htmlbars';\nexport default hbs(\"<div class=\\'ember-safe-button\\' ...attributes>\\n {{#if (has-block)}}\\n {{yield\\n (hash\\n trigger=(component\\n \\'trigger\\'\\n onClick=@onConfirm\\n safetyStatus=this.safetyStatus\\n displayedMessage=this.displayedMessage\\n webAnimations=this.webAnimations.trigger\\n )\\n safety=(component\\n \\'safety\\'\\n onClick=this.onUnlocking\\n safetyStatus=this.safetyStatus\\n displayedMessage=this.displayedMessage\\n webAnimations=this.webAnimations.safety\\n )\\n )\\n }}\\n {{else}}\\n <Trigger\\n @onClick={{@onConfirm}}\\n @safetyStatus={{this.safetyStatus}}\\n @displayedMessage={{this.displayedMessage}}\\n @webAnimations={{this.webAnimations.trigger}}\\n />\\n <Safety\\n @onClick={{this.onUnlocking}}\\n @safetyStatus={{this.safetyStatus}}\\n @displayedMessage={{this.displayedMessage}}\\n @webAnimations={{this.webAnimations.safety}}\\n />\\n {{/if}}\\n</div>\")","import Component from '@glimmer/component';\nimport { tracked } from '@glimmer/tracking';\nimport { assert } from '@ember/debug';\nimport { action } from '@ember/object';\n\nimport { timeout } from 'ember-concurrency';\nimport { task } from 'ember-concurrency';\n\nimport embeddedAnimations from './animations/index';\n\nconst DEFAULT_TIMEOUT = 3000;\nconst DEFAULT_ANIMATION = 'slide';\n\nexport const SAFETY_STATUS = {\n LOCKED: 1,\n UNLOCKING: 2,\n UNLOCKED: 3,\n LOCKING: 4,\n};\n\n/**\n Main component.\n\n ```hbs\n <SafeButton\n class=\"border-black\"\n @animation={{this.animation}}\n @message=\"Delete me\"\n @timeout={{2000}}\n @onConfirm={{action safeButtonClicked}} />\n ```\n\n ```\n @class SafeButtonComponent\n @param {string} [class=\"ember-safe-button\"] CSS class to be applied on the wrapping element.\n @param {object} [animation=\"slid\"] Definition of animation; It can either be string and point to one of the pre-defined animations; Or it can be an object describing Web Animation API\n @param {number} [timeout=3000] Number of millisenconds after which the safety rolls back over the trigger.\n @param {string} [message=\"delete\"] Text to be printed on the buttons in case block is not provided.\n @param {function} onConfirm - Action to trigger whenever user clicks the trigger.\n ```\n\n When trying to construct your own `@animation` object you can take inspiration from the simple `slide` animation. The thing to keep in mind is that these go directly as parameters to [element.animate()](https://developer.mozilla.org/en-US/docs/Web/API/Element/animate) and that there are in fact four animations of which always two fire at the same time:\n\n - `safety.unlocking` and `trigger.unlocking`\n - `safety.locking` and `trigger.locking`\n\n ```js\n {\n safety: {\n unlocking: {\n keyframes: [\n { transform: 'translateX(0)' },\n { transform: 'translateX(-100%)' },\n ],\n options: {\n duration: 1000,\n fill: 'both',\n easing: 'ease',\n },\n },\n locking: {\n keyframes: [\n { transform: 'translateX(-100%)' },\n { transform: 'translateX(0)' },\n ],\n options: {\n duration: 1000,\n fill: 'both',\n easing: 'ease',\n },\n },\n },\n trigger: {\n unlocking: {\n keyframes: [\n { transform: 'translateX(100%)' },\n { transform: 'translateX(0)' },\n ],\n options: {\n duration: 1000,\n fill: 'both',\n easing: 'ease',\n },\n },\n locking: {\n keyframes: [\n { transform: 'translateX(0)' },\n { transform: 'translateX(100%)' },\n ],\n options: {\n duration: 1000,\n fill: 'both',\n easing: 'ease',\n },\n },\n },\n }\n ```\n */\nexport default class SafeButtonComponent extends Component {\n constructor() {\n super(...arguments);\n\n assert('@onConfirm attribute must be set', typeof this.args.onConfirm === 'function');\n }\n\n @tracked safetyStatus = SAFETY_STATUS.LOCKED;\n\n get activeAnimation() {\n const animation = this.args.animation || DEFAULT_ANIMATION;\n\n return typeof animation === 'string' ? embeddedAnimations[animation] : animation;\n }\n\n get webAnimations() {\n const { activeAnimation, onUnlocked, onLocked } = this;\n\n return {\n safety: {\n unlocking: ({ element }) => {\n let animation = element.animate(\n activeAnimation.safety.unlocking.keyframes,\n activeAnimation.safety.unlocking.options\n );\n animation.onfinish = onUnlocked;\n },\n locking: ({ element }) => {\n let animation = element.animate(\n activeAnimation.safety.locking.keyframes,\n activeAnimation.safety.locking.options\n );\n animation.onfinish = onLocked;\n },\n },\n trigger: {\n unlocking({ element }) {\n element.animate(\n activeAnimation.trigger.unlocking.keyframes,\n activeAnimation.trigger.unlocking.options\n );\n },\n locking({ element }) {\n element.animate(\n activeAnimation.trigger.locking.keyframes,\n activeAnimation.trigger.locking.options\n );\n },\n },\n };\n }\n\n get timeout() {\n return this.args.timeout || DEFAULT_TIMEOUT;\n }\n\n get displayedMessage() {\n return this.args.message || 'delete';\n }\n\n @action\n onUnlocking() {\n this.safetyStatus = SAFETY_STATUS.UNLOCKING;\n }\n\n @action\n onUnlocked() {\n this.safetyStatus = SAFETY_STATUS.UNLOCKED;\n this.triggerSafety.perform();\n }\n\n @action\n onLocked() {\n this.safetyStatus = SAFETY_STATUS.LOCKED;\n }\n\n @task(function* () {\n yield timeout(this.timeout);\n this.safetyStatus = SAFETY_STATUS.LOCKING;\n })\n triggerSafety;\n}\n"],"names":["hbs","DEFAULT_TIMEOUT","DEFAULT_ANIMATION","SAFETY_STATUS","LOCKED","UNLOCKING","UNLOCKED","LOCKING","SafeButtonComponent","task","timeout","safetyStatus","Component","constructor","arguments","assert","args","onConfirm","activeAnimation","animation","embeddedAnimations","webAnimations","onUnlocked","onLocked","safety","unlocking","element","animate","keyframes","options","onfinish","locking","trigger","displayedMessage","message","onUnlocking","triggerSafety","perform","tracked","action"],"mappings":"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"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { modifier } from 'ember-modifier';
|
|
2
|
+
import { S as SAFETY_STATUS } from '../index-65a73164.js';
|
|
3
|
+
|
|
4
|
+
var animateMe = modifier((element, _, named) => {
|
|
5
|
+
if (named.focusMe) {
|
|
6
|
+
element.focus();
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
if (named.safetyStatus === SAFETY_STATUS.UNLOCKING) {
|
|
10
|
+
named.webAnimations.unlocking({
|
|
11
|
+
element
|
|
12
|
+
});
|
|
13
|
+
} else if (named.safetyStatus === SAFETY_STATUS.LOCKING) {
|
|
14
|
+
named.webAnimations.locking({
|
|
15
|
+
element
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
}, {
|
|
19
|
+
eager: false
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
export { animateMe as default };
|
|
23
|
+
//# sourceMappingURL=animate-me.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"animate-me.js","sources":["../../src/modifiers/animate-me.js"],"sourcesContent":["import { modifier } from 'ember-modifier';\n\nimport { SAFETY_STATUS } from '../components/safe-button/index';\n\nexport default modifier(\n (element, _, named) => {\n if (named.focusMe) {\n element.focus();\n }\n\n if (named.safetyStatus === SAFETY_STATUS.UNLOCKING) {\n named.webAnimations.unlocking({\n element,\n });\n } else if (named.safetyStatus === SAFETY_STATUS.LOCKING) {\n named.webAnimations.locking({\n element,\n });\n }\n },\n { eager: false }\n);\n"],"names":["modifier","element","_","named","focusMe","focus","safetyStatus","SAFETY_STATUS","UNLOCKING","webAnimations","unlocking","LOCKING","locking","eager"],"mappings":";;;AAIA,gBAAeA,QAAQ,CACrB,CAACC,OAAD,EAAUC,CAAV,EAAaC,KAAb,KAAuB;EACrB,IAAIA,KAAK,CAACC,OAAV,EAAmB;AACjBH,IAAAA,OAAO,CAACI,KAAR,EAAA,CAAA;AACD,GAAA;;AAED,EAAA,IAAIF,KAAK,CAACG,YAAN,KAAuBC,aAAa,CAACC,SAAzC,EAAoD;AAClDL,IAAAA,KAAK,CAACM,aAAN,CAAoBC,SAApB,CAA8B;AAC5BT,MAAAA,OAAAA;KADF,CAAA,CAAA;GADF,MAIO,IAAIE,KAAK,CAACG,YAAN,KAAuBC,aAAa,CAACI,OAAzC,EAAkD;AACvDR,IAAAA,KAAK,CAACM,aAAN,CAAoBG,OAApB,CAA4B;AAC1BX,MAAAA,OAAAA;KADF,CAAA,CAAA;AAGD,GAAA;AACF,CAfoB,EAgBrB;AAAEY,EAAAA,KAAK,EAAE,KAAA;AAAT,CAhBqB,CAAvB;;;;"}
|
package/package.json
CHANGED
|
@@ -1,93 +1,94 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ember-safe-button",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0",
|
|
4
4
|
"description": "For potentially dangerous actions that better needs a confirmation.",
|
|
5
|
-
"keywords": [
|
|
6
|
-
"ember-addon"
|
|
7
|
-
],
|
|
8
|
-
"private": false,
|
|
9
5
|
"repository": "https://gitlab.com/michal-bryxi/open-source/ember-safe-button",
|
|
10
6
|
"license": "MIT",
|
|
11
7
|
"author": "",
|
|
12
|
-
"
|
|
13
|
-
"
|
|
14
|
-
"
|
|
8
|
+
"exports": {
|
|
9
|
+
".": "./dist/index.js",
|
|
10
|
+
"./*": "./dist/*",
|
|
11
|
+
"./addon-main.js": "./addon-main.js"
|
|
15
12
|
},
|
|
13
|
+
"files": [
|
|
14
|
+
"dist",
|
|
15
|
+
"addon-main.cjs",
|
|
16
|
+
"CHANGELOG.md",
|
|
17
|
+
"README.md"
|
|
18
|
+
],
|
|
16
19
|
"scripts": {
|
|
17
|
-
"
|
|
18
|
-
"
|
|
19
|
-
"
|
|
20
|
-
"
|
|
21
|
-
"
|
|
20
|
+
"start": "concurrently 'npm:watch:*'",
|
|
21
|
+
"build": "concurrently 'npm:build:*'",
|
|
22
|
+
"build:js": "rollup -c ./rollup.config.js",
|
|
23
|
+
"build:docs": "cp ../README.md ./README.md",
|
|
24
|
+
"watch:js": "rollup -c --watch --no-watch.clearScreen",
|
|
25
|
+
"lint": "concurrently 'npm:lint:js'",
|
|
26
|
+
"lint:fix": "concurrently 'npm:lint:js:fix'",
|
|
22
27
|
"lint:js": "eslint . --cache",
|
|
23
28
|
"lint:js:fix": "eslint . --fix",
|
|
24
|
-
"
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
"format:hbs": "prettier **/*.hbs --write --parser=glimmer",
|
|
28
|
-
"!test:ember-compatibility": "ember try:each"
|
|
29
|
+
"test": "echo 'Addon does not have tests, run tests in test-app'",
|
|
30
|
+
"prepare": "yarn run build",
|
|
31
|
+
"prepublishOnly": "yarn run build"
|
|
29
32
|
},
|
|
30
33
|
"dependencies": {
|
|
31
|
-
"@ember/render-modifiers": "
|
|
32
|
-
"
|
|
33
|
-
"ember-cli-htmlbars": "
|
|
34
|
-
"ember-concurrency": "2.1
|
|
34
|
+
"@ember/render-modifiers": "2.0.4",
|
|
35
|
+
"@embroider/addon-shim": "1.8.3",
|
|
36
|
+
"ember-cli-htmlbars": "^6.1.0",
|
|
37
|
+
"ember-concurrency": "2.2.1",
|
|
38
|
+
"ember-modifier": "3.2.7"
|
|
35
39
|
},
|
|
36
40
|
"devDependencies": {
|
|
37
|
-
"@
|
|
38
|
-
"@
|
|
39
|
-
"@
|
|
40
|
-
"@
|
|
41
|
-
"@
|
|
42
|
-
"@
|
|
43
|
-
"
|
|
41
|
+
"@babel/core": "7.18.13",
|
|
42
|
+
"@babel/plugin-proposal-class-properties": "7.18.6",
|
|
43
|
+
"@babel/plugin-proposal-decorators": "7.18.10",
|
|
44
|
+
"@babel/plugin-syntax-decorators": "7.18.6",
|
|
45
|
+
"@embroider/addon-dev": "1.8.3",
|
|
46
|
+
"@nullvoxpopuli/eslint-configs": "2.2.50",
|
|
47
|
+
"@rollup/plugin-babel": "5.3.1",
|
|
44
48
|
"babel-eslint": "10.1.0",
|
|
45
|
-
"
|
|
46
|
-
"
|
|
47
|
-
"
|
|
48
|
-
"
|
|
49
|
-
"
|
|
50
|
-
"
|
|
51
|
-
"
|
|
52
|
-
"ember-cli-postcss": "7.0.2",
|
|
53
|
-
"ember-cli-sri": "2.1.1",
|
|
54
|
-
"ember-cli-terser": "4.0.2",
|
|
55
|
-
"ember-data": "3.27.1",
|
|
56
|
-
"ember-disable-prototype-extensions": "1.1.3",
|
|
57
|
-
"ember-export-application-global": "2.0.1",
|
|
58
|
-
"ember-load-initializers": "2.1.2",
|
|
59
|
-
"ember-maybe-import-regenerator": "0.1.6",
|
|
60
|
-
"ember-modifier": "2.1.2",
|
|
61
|
-
"ember-page-title": "6.2.2",
|
|
62
|
-
"ember-qunit": "5.1.3",
|
|
63
|
-
"ember-resolver": "8.0.2",
|
|
64
|
-
"ember-sinon-qunit": "6.0.0",
|
|
65
|
-
"ember-source": "3.27.5",
|
|
66
|
-
"ember-source-channel-url": "3.0.0",
|
|
67
|
-
"ember-template-lint": "2.18.1",
|
|
68
|
-
"ember-template-lint-plugin-prettier": "2.0.1",
|
|
69
|
-
"ember-try": "1.4.0",
|
|
70
|
-
"eslint": "7.20.0",
|
|
71
|
-
"eslint-config-prettier": "7.2.0",
|
|
72
|
-
"eslint-plugin-ember": "10.2.0",
|
|
49
|
+
"concurrently": "7.3.0",
|
|
50
|
+
"eslint": "^7.0.0",
|
|
51
|
+
"eslint-config-prettier": "8.5.0",
|
|
52
|
+
"eslint-plugin-decorator-position": "4.0.1",
|
|
53
|
+
"eslint-plugin-ember": "10.6.1",
|
|
54
|
+
"eslint-plugin-import": "2.26.0",
|
|
55
|
+
"eslint-plugin-json": "3.1.0",
|
|
73
56
|
"eslint-plugin-node": "11.1.0",
|
|
74
|
-
"eslint-plugin-prettier": "
|
|
75
|
-
"eslint-plugin-
|
|
76
|
-
"
|
|
77
|
-
"npm-run-all": "4.1.5",
|
|
78
|
-
"prettier": "2.2.1",
|
|
79
|
-
"qunit": "2.14.0",
|
|
80
|
-
"qunit-dom": "1.6.0",
|
|
81
|
-
"tailwindcss": "2.1.4"
|
|
57
|
+
"eslint-plugin-prettier": "4.2.1",
|
|
58
|
+
"eslint-plugin-simple-import-sort": "7.0.0",
|
|
59
|
+
"rollup": "2.78.1"
|
|
82
60
|
},
|
|
83
|
-
"
|
|
84
|
-
"
|
|
61
|
+
"publishConfig": {
|
|
62
|
+
"registry": "https://registry.npmjs.org"
|
|
85
63
|
},
|
|
86
64
|
"ember": {
|
|
87
65
|
"edition": "octane"
|
|
88
66
|
},
|
|
67
|
+
"keywords": [
|
|
68
|
+
"ember-addon"
|
|
69
|
+
],
|
|
89
70
|
"ember-addon": {
|
|
90
|
-
"
|
|
71
|
+
"version": 2,
|
|
72
|
+
"type": "addon",
|
|
73
|
+
"main": "./addon-main.cjs",
|
|
74
|
+
"app-js": {
|
|
75
|
+
"./components/safe-button/animations/flip.js": "./dist/_app_/components/safe-button/animations/flip.js",
|
|
76
|
+
"./components/safe-button/animations/index.js": "./dist/_app_/components/safe-button/animations/index.js",
|
|
77
|
+
"./components/safe-button/animations/lift-bars.js": "./dist/_app_/components/safe-button/animations/lift-bars.js",
|
|
78
|
+
"./components/safe-button/animations/poing.js": "./dist/_app_/components/safe-button/animations/poing.js",
|
|
79
|
+
"./components/safe-button/animations/roll.js": "./dist/_app_/components/safe-button/animations/roll.js",
|
|
80
|
+
"./components/safe-button/animations/slide.js": "./dist/_app_/components/safe-button/animations/slide.js",
|
|
81
|
+
"./components/safe-button/animations/zoom.js": "./dist/_app_/components/safe-button/animations/zoom.js",
|
|
82
|
+
"./components/safe-button/index.js": "./dist/_app_/components/safe-button/index.js",
|
|
83
|
+
"./components/safety/index.js": "./dist/_app_/components/safety/index.js",
|
|
84
|
+
"./components/trigger/index.js": "./dist/_app_/components/trigger/index.js",
|
|
85
|
+
"./modifiers/animate-me.js": "./dist/_app_/modifiers/animate-me.js"
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
"engines": {
|
|
89
|
+
"node": "12.* || 14.* || >= 16"
|
|
91
90
|
},
|
|
92
|
-
"
|
|
91
|
+
"volta": {
|
|
92
|
+
"extends": "../package.json"
|
|
93
|
+
}
|
|
93
94
|
}
|
package/.gitlab-ci.yml
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
image: timbru31/node-chrome:14-slim
|
|
2
|
-
|
|
3
|
-
stages:
|
|
4
|
-
- build
|
|
5
|
-
- test
|
|
6
|
-
|
|
7
|
-
cache:
|
|
8
|
-
paths:
|
|
9
|
-
- node_modules/
|
|
10
|
-
|
|
11
|
-
install_dependencies:
|
|
12
|
-
except:
|
|
13
|
-
refs:
|
|
14
|
-
- master
|
|
15
|
-
stage: build
|
|
16
|
-
script:
|
|
17
|
-
- yarn
|
|
18
|
-
artifacts:
|
|
19
|
-
paths:
|
|
20
|
-
- node_modules/
|
|
21
|
-
|
|
22
|
-
testing_testing:
|
|
23
|
-
except:
|
|
24
|
-
refs:
|
|
25
|
-
- master
|
|
26
|
-
stage: test
|
|
27
|
-
script: yarn test
|
package/.prettierignore
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
# unconventional js
|
|
2
|
-
/blueprints/*/files/
|
|
3
|
-
/vendor/
|
|
4
|
-
|
|
5
|
-
# compiled output
|
|
6
|
-
/dist/
|
|
7
|
-
/tmp/
|
|
8
|
-
|
|
9
|
-
# dependencies
|
|
10
|
-
/bower_components/
|
|
11
|
-
/node_modules/
|
|
12
|
-
|
|
13
|
-
# misc
|
|
14
|
-
/coverage/
|
|
15
|
-
!.*
|
|
16
|
-
.eslintcache
|
|
17
|
-
|
|
18
|
-
# ember-try
|
|
19
|
-
/.node_modules.ember-try/
|
|
20
|
-
/bower.json.ember-try
|
|
21
|
-
/package.json.ember-try
|