@esportsplus/ui 0.37.2 → 0.38.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.
|
@@ -3,28 +3,30 @@ import { html } from '@esportsplus/template';
|
|
|
3
3
|
import template from '../template/index.js';
|
|
4
4
|
import './scss/index.scss';
|
|
5
5
|
const hold = template.factory(function (attributes, content) {
|
|
6
|
-
let
|
|
6
|
+
let end = () => {
|
|
7
|
+
if (!state.complete) {
|
|
8
|
+
state.holding = false;
|
|
9
|
+
}
|
|
10
|
+
}, start = (e) => {
|
|
11
|
+
e.preventDefault();
|
|
12
|
+
state.holding = true;
|
|
13
|
+
}, state = reactive({
|
|
7
14
|
complete: false,
|
|
8
15
|
holding: false
|
|
9
16
|
});
|
|
10
17
|
return html `
|
|
11
18
|
<div
|
|
12
19
|
class='button ${() => state.holding && 'button--holding'} ${() => state.complete && '--active'}'
|
|
13
|
-
onanimationend
|
|
20
|
+
onanimationend=${(e) => {
|
|
14
21
|
if (e.animationName === 'buttonHolding') {
|
|
15
22
|
state.complete = true;
|
|
16
23
|
}
|
|
17
|
-
}}
|
|
18
|
-
onclick
|
|
19
|
-
onmousedown
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
onmouseup='${() => {
|
|
24
|
-
if (!state.complete) {
|
|
25
|
-
state.holding = false;
|
|
26
|
-
}
|
|
27
|
-
}}'
|
|
24
|
+
}}
|
|
25
|
+
onclick=${() => { }}
|
|
26
|
+
onmousedown=${start}
|
|
27
|
+
onmouseup=${end}
|
|
28
|
+
ontouchstart=${start}
|
|
29
|
+
ontouchend=${end}
|
|
28
30
|
${attributes}
|
|
29
31
|
>
|
|
30
32
|
${() => content(state)}
|
package/package.json
CHANGED
|
@@ -10,13 +10,13 @@
|
|
|
10
10
|
},
|
|
11
11
|
"devDependencies": {
|
|
12
12
|
"@esportsplus/typescript": "^0.9.2",
|
|
13
|
-
"@types/node": "^24.6.
|
|
13
|
+
"@types/node": "^24.6.2",
|
|
14
14
|
"autoprefixer": "^10.4.21",
|
|
15
15
|
"glob": "^11.0.3",
|
|
16
16
|
"lightningcss": "^1.30.2",
|
|
17
17
|
"npm-run-all": "^4.1.5",
|
|
18
18
|
"sass": "^1.93.2",
|
|
19
|
-
"vite": "^7.1.
|
|
19
|
+
"vite": "^7.1.9"
|
|
20
20
|
},
|
|
21
21
|
"exports": {
|
|
22
22
|
"./css-utilities.scss": "./build/css-utilities/index.scss",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"private": false,
|
|
43
43
|
"sideEffects": false,
|
|
44
44
|
"type": "module",
|
|
45
|
-
"version": "0.
|
|
45
|
+
"version": "0.38.0",
|
|
46
46
|
"scripts": {
|
|
47
47
|
"build": "run-s build:vite build:ts",
|
|
48
48
|
"build:ts": "tsc && tsc-alias",
|
|
@@ -6,7 +6,16 @@ import './scss/index.scss';
|
|
|
6
6
|
|
|
7
7
|
const hold = template.factory(
|
|
8
8
|
function(attributes, content: (state: { holding: boolean, complete: boolean }) => Renderable<any>) {
|
|
9
|
-
let
|
|
9
|
+
let end = () => {
|
|
10
|
+
if (!state.complete) {
|
|
11
|
+
state.holding = false;
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
start = (e: MouseEvent) => {
|
|
15
|
+
e.preventDefault();
|
|
16
|
+
state.holding = true;
|
|
17
|
+
},
|
|
18
|
+
state = reactive({
|
|
10
19
|
complete: false,
|
|
11
20
|
holding: false
|
|
12
21
|
});
|
|
@@ -14,21 +23,16 @@ const hold = template.factory(
|
|
|
14
23
|
return html`
|
|
15
24
|
<div
|
|
16
25
|
class='button ${() => state.holding && 'button--holding'} ${() => state.complete && '--active'}'
|
|
17
|
-
onanimationend
|
|
26
|
+
onanimationend=${(e: AnimationEvent) => {
|
|
18
27
|
if (e.animationName === 'buttonHolding') {
|
|
19
28
|
state.complete = true;
|
|
20
29
|
}
|
|
21
|
-
}}
|
|
22
|
-
onclick
|
|
23
|
-
onmousedown
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
}
|
|
27
|
-
onmouseup='${() => {
|
|
28
|
-
if (!state.complete) {
|
|
29
|
-
state.holding = false;
|
|
30
|
-
}
|
|
31
|
-
}}'
|
|
30
|
+
}}
|
|
31
|
+
onclick=${() => {}}
|
|
32
|
+
onmousedown=${start}
|
|
33
|
+
onmouseup=${end}
|
|
34
|
+
ontouchstart=${start}
|
|
35
|
+
ontouchend=${end}
|
|
32
36
|
${attributes}
|
|
33
37
|
>
|
|
34
38
|
${() => content(state)}
|