@mekari/pixel3-loader 0.0.1
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/dist/chunk-6Q7HPFR6.mjs +22 -0
- package/dist/chunk-HTTW3RII.mjs +31 -0
- package/dist/chunk-QZ7VFGWC.mjs +6 -0
- package/dist/chunk-YF2MAEL3.mjs +136 -0
- package/dist/index.d.mts +3 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +201 -0
- package/dist/index.mjs +9 -0
- package/dist/loader.d.mts +42 -0
- package/dist/loader.d.ts +42 -0
- package/dist/loader.js +199 -0
- package/dist/loader.mjs +9 -0
- package/dist/metafile-cjs.json +1 -0
- package/dist/metafile-esm.json +1 -0
- package/dist/modules/loader.props.d.mts +22 -0
- package/dist/modules/loader.props.d.ts +22 -0
- package/dist/modules/loader.props.js +46 -0
- package/dist/modules/loader.props.mjs +7 -0
- package/dist/modules/useLoader.d.mts +10 -0
- package/dist/modules/useLoader.d.ts +10 -0
- package/dist/modules/useLoader.js +157 -0
- package/dist/modules/useLoader.mjs +7 -0
- package/package.json +41 -0
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
// src/modules/loader.props.ts
|
|
2
|
+
var loaderProps = {
|
|
3
|
+
id: {
|
|
4
|
+
type: String
|
|
5
|
+
},
|
|
6
|
+
size: {
|
|
7
|
+
type: [Number],
|
|
8
|
+
default: 24
|
|
9
|
+
},
|
|
10
|
+
spacing: {
|
|
11
|
+
type: [Number],
|
|
12
|
+
default: 12
|
|
13
|
+
},
|
|
14
|
+
duration: {
|
|
15
|
+
type: String,
|
|
16
|
+
default: "1250ms"
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export {
|
|
21
|
+
loaderProps
|
|
22
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import {
|
|
2
|
+
loaderProps
|
|
3
|
+
} from "./chunk-6Q7HPFR6.mjs";
|
|
4
|
+
import {
|
|
5
|
+
useLoader
|
|
6
|
+
} from "./chunk-YF2MAEL3.mjs";
|
|
7
|
+
|
|
8
|
+
// src/loader.tsx
|
|
9
|
+
import { createVNode as _createVNode, mergeProps as _mergeProps } from "vue";
|
|
10
|
+
import { defineComponent } from "vue";
|
|
11
|
+
var MpLoader = defineComponent({
|
|
12
|
+
name: "MpLoader",
|
|
13
|
+
props: loaderProps,
|
|
14
|
+
setup(props) {
|
|
15
|
+
const {
|
|
16
|
+
wrapperAttrs,
|
|
17
|
+
loaderAttrs
|
|
18
|
+
} = useLoader(props);
|
|
19
|
+
return () => {
|
|
20
|
+
return _createVNode("div", _mergeProps({
|
|
21
|
+
"data-pixel-component": "MpLoader"
|
|
22
|
+
}, wrapperAttrs.value), [_createVNode("div", _mergeProps({
|
|
23
|
+
"data-pixel-component": "MpLoaderDot"
|
|
24
|
+
}, loaderAttrs.value), null)]);
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
export {
|
|
30
|
+
MpLoader
|
|
31
|
+
};
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import {
|
|
2
|
+
__name
|
|
3
|
+
} from "./chunk-QZ7VFGWC.mjs";
|
|
4
|
+
|
|
5
|
+
// src/modules/useLoader.ts
|
|
6
|
+
import { computed, onMounted, onBeforeUnmount, watch } from "vue";
|
|
7
|
+
import { useStyleTag, useId } from "@mekari/pixel3-utils";
|
|
8
|
+
function useLoader(props) {
|
|
9
|
+
const identifierClass = `pixel-loader-${useId(4)}`;
|
|
10
|
+
const colors = {
|
|
11
|
+
mekari: "var(--mp-colors-brand-mekari)",
|
|
12
|
+
talenta: "var(--mp-colors-brand-talenta)",
|
|
13
|
+
jurnal: "var(--mp-colors-brand-jurnal)",
|
|
14
|
+
klikpajak: "var(--mp-colors-brand-klikpajak)"
|
|
15
|
+
};
|
|
16
|
+
const getLoaderData = computed(() => {
|
|
17
|
+
const jumpHeight = -(2.5 * props.size);
|
|
18
|
+
const bounceHeight = Math.floor(props.size * 0.2) + props.size;
|
|
19
|
+
const dotCalculation = {
|
|
20
|
+
first: 0,
|
|
21
|
+
second: props.spacing + props.size,
|
|
22
|
+
third: 2 * (props.spacing + props.size),
|
|
23
|
+
fourth: 3 * (props.spacing + props.size)
|
|
24
|
+
};
|
|
25
|
+
const maxWidth = 3 * (props.size + props.spacing) + props.size;
|
|
26
|
+
const keyframeStyle = `@keyframes animation-pixel-loader {
|
|
27
|
+
0% {
|
|
28
|
+
box-shadow: ${colors.mekari} ${dotCalculation.first}px -${props.size}px 0px 0px,
|
|
29
|
+
${colors.talenta} ${dotCalculation.second}px -${props.size}px 0px 0px,
|
|
30
|
+
${colors.jurnal} ${dotCalculation.third}px -${props.size}px 0px 0px,
|
|
31
|
+
${colors.klikpajak} ${dotCalculation.fourth}px -${props.size}px 0px 0px;
|
|
32
|
+
}
|
|
33
|
+
15% {
|
|
34
|
+
box-shadow: ${colors.mekari} ${dotCalculation.first}px ${jumpHeight}px 0px 0px,
|
|
35
|
+
${colors.talenta} ${dotCalculation.second}px -${props.size}px 0px 0px,
|
|
36
|
+
${colors.jurnal} ${dotCalculation.third}px -${props.size}px 0px 0px,
|
|
37
|
+
${colors.klikpajak} ${dotCalculation.fourth}px -${props.size}px 0px 0px;
|
|
38
|
+
}
|
|
39
|
+
30% {
|
|
40
|
+
box-shadow: ${colors.mekari} ${dotCalculation.first}px -${props.size}px 0px 0px,
|
|
41
|
+
${colors.talenta} ${dotCalculation.second}px ${jumpHeight}px 0px 0px,
|
|
42
|
+
${colors.jurnal} ${dotCalculation.third}px -${props.size}px 0px 0px,
|
|
43
|
+
${colors.klikpajak} ${dotCalculation.fourth}px -${props.size}px 0px 0px;
|
|
44
|
+
}
|
|
45
|
+
45% {
|
|
46
|
+
box-shadow: ${colors.mekari} ${dotCalculation.first}px -${bounceHeight}px 0px 0px,
|
|
47
|
+
${colors.talenta}${dotCalculation.second}px -${props.size}px 0px 0px,
|
|
48
|
+
${colors.jurnal} ${dotCalculation.third}px ${jumpHeight}px 0px 0px,
|
|
49
|
+
${colors.klikpajak} ${dotCalculation.fourth}px -${props.size}px 0px 0px;
|
|
50
|
+
}
|
|
51
|
+
60% {
|
|
52
|
+
box-shadow: ${colors.mekari} ${dotCalculation.first}px -${props.size}px 0px 0px,
|
|
53
|
+
${colors.talenta} ${dotCalculation.second}px -${bounceHeight}px 0px 0px,
|
|
54
|
+
${colors.jurnal} ${dotCalculation.third}px -${props.size}px 0px 0px,
|
|
55
|
+
${colors.klikpajak} ${dotCalculation.fourth}px ${jumpHeight}px 0px 0px;
|
|
56
|
+
}
|
|
57
|
+
75% {
|
|
58
|
+
box-shadow: ${colors.mekari} 0px -${props.size}px 0px 0px,
|
|
59
|
+
${colors.talenta} ${dotCalculation.second}px -${props.size}px 0px 0px,
|
|
60
|
+
${colors.jurnal} ${dotCalculation.third}px -${bounceHeight}px 0px 0px,
|
|
61
|
+
${colors.klikpajak} ${dotCalculation.fourth}px -${props.size}px 0px 0px;
|
|
62
|
+
}
|
|
63
|
+
90% {
|
|
64
|
+
box-shadow: ${colors.mekari} 0px -${props.size}px 0px 0px,
|
|
65
|
+
${colors.talenta} ${dotCalculation.second}px -${props.size}px 0px 0px,
|
|
66
|
+
${colors.jurnal} ${dotCalculation.third}px -${props.size}px 0px 0px,
|
|
67
|
+
${colors.klikpajak} ${dotCalculation.fourth}px -${bounceHeight}px 0px 0px;
|
|
68
|
+
}
|
|
69
|
+
100% {
|
|
70
|
+
box-shadow: ${colors.mekari} 0px -${props.size}px 0px 0px,
|
|
71
|
+
${colors.talenta} ${dotCalculation.second}px -${props.size}px 0px 0px,
|
|
72
|
+
${colors.jurnal} ${dotCalculation.third}px -${props.size}px 0px 0px,
|
|
73
|
+
${colors.klikpajak} ${dotCalculation.fourth}px -${props.size}px 0px 0px;
|
|
74
|
+
}
|
|
75
|
+
}`;
|
|
76
|
+
const loaderStyle = `
|
|
77
|
+
${keyframeStyle}
|
|
78
|
+
|
|
79
|
+
.${identifierClass} {
|
|
80
|
+
border-radius: 999px;
|
|
81
|
+
background: transparent;
|
|
82
|
+
width: ${props.size}px;
|
|
83
|
+
height: ${props.size}px;
|
|
84
|
+
position: absolute;
|
|
85
|
+
transform: translateY(${props.size}px);
|
|
86
|
+
animation: 1250ms ease 0s infinite normal backwards running animation-pixel-loader;
|
|
87
|
+
}`;
|
|
88
|
+
return {
|
|
89
|
+
jumpHeight,
|
|
90
|
+
bounceHeight,
|
|
91
|
+
dotCalculation,
|
|
92
|
+
maxWidth,
|
|
93
|
+
loaderStyle
|
|
94
|
+
};
|
|
95
|
+
});
|
|
96
|
+
const {
|
|
97
|
+
css,
|
|
98
|
+
load,
|
|
99
|
+
unload,
|
|
100
|
+
isLoaded
|
|
101
|
+
} = useStyleTag(getLoaderData.value.loaderStyle, {
|
|
102
|
+
id: identifierClass
|
|
103
|
+
});
|
|
104
|
+
const wrapperAttrs = computed(() => {
|
|
105
|
+
return {
|
|
106
|
+
style: {
|
|
107
|
+
position: "absolute",
|
|
108
|
+
height: props.size + "px",
|
|
109
|
+
width: getLoaderData.value.maxWidth + "px"
|
|
110
|
+
}
|
|
111
|
+
};
|
|
112
|
+
});
|
|
113
|
+
const loaderAttrs = computed(() => {
|
|
114
|
+
return {
|
|
115
|
+
class: isLoaded.value ? identifierClass : ""
|
|
116
|
+
};
|
|
117
|
+
});
|
|
118
|
+
onMounted(() => {
|
|
119
|
+
load();
|
|
120
|
+
});
|
|
121
|
+
onBeforeUnmount(() => {
|
|
122
|
+
unload();
|
|
123
|
+
});
|
|
124
|
+
watch(() => getLoaderData.value.loaderStyle, () => {
|
|
125
|
+
css.value = getLoaderData.value.loaderStyle;
|
|
126
|
+
});
|
|
127
|
+
return {
|
|
128
|
+
wrapperAttrs,
|
|
129
|
+
loaderAttrs
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
__name(useLoader, "useLoader");
|
|
133
|
+
|
|
134
|
+
export {
|
|
135
|
+
useLoader
|
|
136
|
+
};
|
package/dist/index.d.mts
ADDED
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
|
+
|
|
21
|
+
// src/index.ts
|
|
22
|
+
var src_exports = {};
|
|
23
|
+
__export(src_exports, {
|
|
24
|
+
MpLoader: () => MpLoader
|
|
25
|
+
});
|
|
26
|
+
module.exports = __toCommonJS(src_exports);
|
|
27
|
+
|
|
28
|
+
// src/loader.tsx
|
|
29
|
+
var import_vue2 = require("vue");
|
|
30
|
+
var import_vue3 = require("vue");
|
|
31
|
+
|
|
32
|
+
// src/modules/useLoader.ts
|
|
33
|
+
var import_vue = require("vue");
|
|
34
|
+
var import_pixel3_utils = require("@mekari/pixel3-utils");
|
|
35
|
+
function useLoader(props) {
|
|
36
|
+
const identifierClass = `pixel-loader-${(0, import_pixel3_utils.useId)(4)}`;
|
|
37
|
+
const colors = {
|
|
38
|
+
mekari: "var(--mp-colors-brand-mekari)",
|
|
39
|
+
talenta: "var(--mp-colors-brand-talenta)",
|
|
40
|
+
jurnal: "var(--mp-colors-brand-jurnal)",
|
|
41
|
+
klikpajak: "var(--mp-colors-brand-klikpajak)"
|
|
42
|
+
};
|
|
43
|
+
const getLoaderData = (0, import_vue.computed)(() => {
|
|
44
|
+
const jumpHeight = -(2.5 * props.size);
|
|
45
|
+
const bounceHeight = Math.floor(props.size * 0.2) + props.size;
|
|
46
|
+
const dotCalculation = {
|
|
47
|
+
first: 0,
|
|
48
|
+
second: props.spacing + props.size,
|
|
49
|
+
third: 2 * (props.spacing + props.size),
|
|
50
|
+
fourth: 3 * (props.spacing + props.size)
|
|
51
|
+
};
|
|
52
|
+
const maxWidth = 3 * (props.size + props.spacing) + props.size;
|
|
53
|
+
const keyframeStyle = `@keyframes animation-pixel-loader {
|
|
54
|
+
0% {
|
|
55
|
+
box-shadow: ${colors.mekari} ${dotCalculation.first}px -${props.size}px 0px 0px,
|
|
56
|
+
${colors.talenta} ${dotCalculation.second}px -${props.size}px 0px 0px,
|
|
57
|
+
${colors.jurnal} ${dotCalculation.third}px -${props.size}px 0px 0px,
|
|
58
|
+
${colors.klikpajak} ${dotCalculation.fourth}px -${props.size}px 0px 0px;
|
|
59
|
+
}
|
|
60
|
+
15% {
|
|
61
|
+
box-shadow: ${colors.mekari} ${dotCalculation.first}px ${jumpHeight}px 0px 0px,
|
|
62
|
+
${colors.talenta} ${dotCalculation.second}px -${props.size}px 0px 0px,
|
|
63
|
+
${colors.jurnal} ${dotCalculation.third}px -${props.size}px 0px 0px,
|
|
64
|
+
${colors.klikpajak} ${dotCalculation.fourth}px -${props.size}px 0px 0px;
|
|
65
|
+
}
|
|
66
|
+
30% {
|
|
67
|
+
box-shadow: ${colors.mekari} ${dotCalculation.first}px -${props.size}px 0px 0px,
|
|
68
|
+
${colors.talenta} ${dotCalculation.second}px ${jumpHeight}px 0px 0px,
|
|
69
|
+
${colors.jurnal} ${dotCalculation.third}px -${props.size}px 0px 0px,
|
|
70
|
+
${colors.klikpajak} ${dotCalculation.fourth}px -${props.size}px 0px 0px;
|
|
71
|
+
}
|
|
72
|
+
45% {
|
|
73
|
+
box-shadow: ${colors.mekari} ${dotCalculation.first}px -${bounceHeight}px 0px 0px,
|
|
74
|
+
${colors.talenta}${dotCalculation.second}px -${props.size}px 0px 0px,
|
|
75
|
+
${colors.jurnal} ${dotCalculation.third}px ${jumpHeight}px 0px 0px,
|
|
76
|
+
${colors.klikpajak} ${dotCalculation.fourth}px -${props.size}px 0px 0px;
|
|
77
|
+
}
|
|
78
|
+
60% {
|
|
79
|
+
box-shadow: ${colors.mekari} ${dotCalculation.first}px -${props.size}px 0px 0px,
|
|
80
|
+
${colors.talenta} ${dotCalculation.second}px -${bounceHeight}px 0px 0px,
|
|
81
|
+
${colors.jurnal} ${dotCalculation.third}px -${props.size}px 0px 0px,
|
|
82
|
+
${colors.klikpajak} ${dotCalculation.fourth}px ${jumpHeight}px 0px 0px;
|
|
83
|
+
}
|
|
84
|
+
75% {
|
|
85
|
+
box-shadow: ${colors.mekari} 0px -${props.size}px 0px 0px,
|
|
86
|
+
${colors.talenta} ${dotCalculation.second}px -${props.size}px 0px 0px,
|
|
87
|
+
${colors.jurnal} ${dotCalculation.third}px -${bounceHeight}px 0px 0px,
|
|
88
|
+
${colors.klikpajak} ${dotCalculation.fourth}px -${props.size}px 0px 0px;
|
|
89
|
+
}
|
|
90
|
+
90% {
|
|
91
|
+
box-shadow: ${colors.mekari} 0px -${props.size}px 0px 0px,
|
|
92
|
+
${colors.talenta} ${dotCalculation.second}px -${props.size}px 0px 0px,
|
|
93
|
+
${colors.jurnal} ${dotCalculation.third}px -${props.size}px 0px 0px,
|
|
94
|
+
${colors.klikpajak} ${dotCalculation.fourth}px -${bounceHeight}px 0px 0px;
|
|
95
|
+
}
|
|
96
|
+
100% {
|
|
97
|
+
box-shadow: ${colors.mekari} 0px -${props.size}px 0px 0px,
|
|
98
|
+
${colors.talenta} ${dotCalculation.second}px -${props.size}px 0px 0px,
|
|
99
|
+
${colors.jurnal} ${dotCalculation.third}px -${props.size}px 0px 0px,
|
|
100
|
+
${colors.klikpajak} ${dotCalculation.fourth}px -${props.size}px 0px 0px;
|
|
101
|
+
}
|
|
102
|
+
}`;
|
|
103
|
+
const loaderStyle = `
|
|
104
|
+
${keyframeStyle}
|
|
105
|
+
|
|
106
|
+
.${identifierClass} {
|
|
107
|
+
border-radius: 999px;
|
|
108
|
+
background: transparent;
|
|
109
|
+
width: ${props.size}px;
|
|
110
|
+
height: ${props.size}px;
|
|
111
|
+
position: absolute;
|
|
112
|
+
transform: translateY(${props.size}px);
|
|
113
|
+
animation: 1250ms ease 0s infinite normal backwards running animation-pixel-loader;
|
|
114
|
+
}`;
|
|
115
|
+
return {
|
|
116
|
+
jumpHeight,
|
|
117
|
+
bounceHeight,
|
|
118
|
+
dotCalculation,
|
|
119
|
+
maxWidth,
|
|
120
|
+
loaderStyle
|
|
121
|
+
};
|
|
122
|
+
});
|
|
123
|
+
const {
|
|
124
|
+
css,
|
|
125
|
+
load,
|
|
126
|
+
unload,
|
|
127
|
+
isLoaded
|
|
128
|
+
} = (0, import_pixel3_utils.useStyleTag)(getLoaderData.value.loaderStyle, {
|
|
129
|
+
id: identifierClass
|
|
130
|
+
});
|
|
131
|
+
const wrapperAttrs = (0, import_vue.computed)(() => {
|
|
132
|
+
return {
|
|
133
|
+
style: {
|
|
134
|
+
position: "absolute",
|
|
135
|
+
height: props.size + "px",
|
|
136
|
+
width: getLoaderData.value.maxWidth + "px"
|
|
137
|
+
}
|
|
138
|
+
};
|
|
139
|
+
});
|
|
140
|
+
const loaderAttrs = (0, import_vue.computed)(() => {
|
|
141
|
+
return {
|
|
142
|
+
class: isLoaded.value ? identifierClass : ""
|
|
143
|
+
};
|
|
144
|
+
});
|
|
145
|
+
(0, import_vue.onMounted)(() => {
|
|
146
|
+
load();
|
|
147
|
+
});
|
|
148
|
+
(0, import_vue.onBeforeUnmount)(() => {
|
|
149
|
+
unload();
|
|
150
|
+
});
|
|
151
|
+
(0, import_vue.watch)(() => getLoaderData.value.loaderStyle, () => {
|
|
152
|
+
css.value = getLoaderData.value.loaderStyle;
|
|
153
|
+
});
|
|
154
|
+
return {
|
|
155
|
+
wrapperAttrs,
|
|
156
|
+
loaderAttrs
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
__name(useLoader, "useLoader");
|
|
160
|
+
|
|
161
|
+
// src/modules/loader.props.ts
|
|
162
|
+
var loaderProps = {
|
|
163
|
+
id: {
|
|
164
|
+
type: String
|
|
165
|
+
},
|
|
166
|
+
size: {
|
|
167
|
+
type: [Number],
|
|
168
|
+
default: 24
|
|
169
|
+
},
|
|
170
|
+
spacing: {
|
|
171
|
+
type: [Number],
|
|
172
|
+
default: 12
|
|
173
|
+
},
|
|
174
|
+
duration: {
|
|
175
|
+
type: String,
|
|
176
|
+
default: "1250ms"
|
|
177
|
+
}
|
|
178
|
+
};
|
|
179
|
+
|
|
180
|
+
// src/loader.tsx
|
|
181
|
+
var MpLoader = (0, import_vue3.defineComponent)({
|
|
182
|
+
name: "MpLoader",
|
|
183
|
+
props: loaderProps,
|
|
184
|
+
setup(props) {
|
|
185
|
+
const {
|
|
186
|
+
wrapperAttrs,
|
|
187
|
+
loaderAttrs
|
|
188
|
+
} = useLoader(props);
|
|
189
|
+
return () => {
|
|
190
|
+
return (0, import_vue2.createVNode)("div", (0, import_vue2.mergeProps)({
|
|
191
|
+
"data-pixel-component": "MpLoader"
|
|
192
|
+
}, wrapperAttrs.value), [(0, import_vue2.createVNode)("div", (0, import_vue2.mergeProps)({
|
|
193
|
+
"data-pixel-component": "MpLoaderDot"
|
|
194
|
+
}, loaderAttrs.value), null)]);
|
|
195
|
+
};
|
|
196
|
+
}
|
|
197
|
+
});
|
|
198
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
199
|
+
0 && (module.exports = {
|
|
200
|
+
MpLoader
|
|
201
|
+
});
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import * as vue_jsx_runtime from 'vue/jsx-runtime';
|
|
2
|
+
import * as vue from 'vue';
|
|
3
|
+
|
|
4
|
+
declare const MpLoader: vue.DefineComponent<{
|
|
5
|
+
id: {
|
|
6
|
+
type: vue.PropType<string>;
|
|
7
|
+
};
|
|
8
|
+
size: {
|
|
9
|
+
type: vue.PropType<number>;
|
|
10
|
+
default: number;
|
|
11
|
+
};
|
|
12
|
+
spacing: {
|
|
13
|
+
type: vue.PropType<number>;
|
|
14
|
+
default: number;
|
|
15
|
+
};
|
|
16
|
+
duration: {
|
|
17
|
+
type: vue.PropType<string>;
|
|
18
|
+
default: string;
|
|
19
|
+
};
|
|
20
|
+
}, () => vue_jsx_runtime.JSX.Element, unknown, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.VNodeProps & vue.AllowedComponentProps & vue.ComponentCustomProps, Readonly<vue.ExtractPropTypes<{
|
|
21
|
+
id: {
|
|
22
|
+
type: vue.PropType<string>;
|
|
23
|
+
};
|
|
24
|
+
size: {
|
|
25
|
+
type: vue.PropType<number>;
|
|
26
|
+
default: number;
|
|
27
|
+
};
|
|
28
|
+
spacing: {
|
|
29
|
+
type: vue.PropType<number>;
|
|
30
|
+
default: number;
|
|
31
|
+
};
|
|
32
|
+
duration: {
|
|
33
|
+
type: vue.PropType<string>;
|
|
34
|
+
default: string;
|
|
35
|
+
};
|
|
36
|
+
}>>, {
|
|
37
|
+
size: number;
|
|
38
|
+
spacing: number;
|
|
39
|
+
duration: string;
|
|
40
|
+
}>;
|
|
41
|
+
|
|
42
|
+
export { MpLoader };
|
package/dist/loader.d.ts
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import * as vue_jsx_runtime from 'vue/jsx-runtime';
|
|
2
|
+
import * as vue from 'vue';
|
|
3
|
+
|
|
4
|
+
declare const MpLoader: vue.DefineComponent<{
|
|
5
|
+
id: {
|
|
6
|
+
type: vue.PropType<string>;
|
|
7
|
+
};
|
|
8
|
+
size: {
|
|
9
|
+
type: vue.PropType<number>;
|
|
10
|
+
default: number;
|
|
11
|
+
};
|
|
12
|
+
spacing: {
|
|
13
|
+
type: vue.PropType<number>;
|
|
14
|
+
default: number;
|
|
15
|
+
};
|
|
16
|
+
duration: {
|
|
17
|
+
type: vue.PropType<string>;
|
|
18
|
+
default: string;
|
|
19
|
+
};
|
|
20
|
+
}, () => vue_jsx_runtime.JSX.Element, unknown, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.VNodeProps & vue.AllowedComponentProps & vue.ComponentCustomProps, Readonly<vue.ExtractPropTypes<{
|
|
21
|
+
id: {
|
|
22
|
+
type: vue.PropType<string>;
|
|
23
|
+
};
|
|
24
|
+
size: {
|
|
25
|
+
type: vue.PropType<number>;
|
|
26
|
+
default: number;
|
|
27
|
+
};
|
|
28
|
+
spacing: {
|
|
29
|
+
type: vue.PropType<number>;
|
|
30
|
+
default: number;
|
|
31
|
+
};
|
|
32
|
+
duration: {
|
|
33
|
+
type: vue.PropType<string>;
|
|
34
|
+
default: string;
|
|
35
|
+
};
|
|
36
|
+
}>>, {
|
|
37
|
+
size: number;
|
|
38
|
+
spacing: number;
|
|
39
|
+
duration: string;
|
|
40
|
+
}>;
|
|
41
|
+
|
|
42
|
+
export { MpLoader };
|
package/dist/loader.js
ADDED
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
|
+
|
|
21
|
+
// src/loader.tsx
|
|
22
|
+
var loader_exports = {};
|
|
23
|
+
__export(loader_exports, {
|
|
24
|
+
MpLoader: () => MpLoader
|
|
25
|
+
});
|
|
26
|
+
module.exports = __toCommonJS(loader_exports);
|
|
27
|
+
var import_vue2 = require("vue");
|
|
28
|
+
var import_vue3 = require("vue");
|
|
29
|
+
|
|
30
|
+
// src/modules/useLoader.ts
|
|
31
|
+
var import_vue = require("vue");
|
|
32
|
+
var import_pixel3_utils = require("@mekari/pixel3-utils");
|
|
33
|
+
function useLoader(props) {
|
|
34
|
+
const identifierClass = `pixel-loader-${(0, import_pixel3_utils.useId)(4)}`;
|
|
35
|
+
const colors = {
|
|
36
|
+
mekari: "var(--mp-colors-brand-mekari)",
|
|
37
|
+
talenta: "var(--mp-colors-brand-talenta)",
|
|
38
|
+
jurnal: "var(--mp-colors-brand-jurnal)",
|
|
39
|
+
klikpajak: "var(--mp-colors-brand-klikpajak)"
|
|
40
|
+
};
|
|
41
|
+
const getLoaderData = (0, import_vue.computed)(() => {
|
|
42
|
+
const jumpHeight = -(2.5 * props.size);
|
|
43
|
+
const bounceHeight = Math.floor(props.size * 0.2) + props.size;
|
|
44
|
+
const dotCalculation = {
|
|
45
|
+
first: 0,
|
|
46
|
+
second: props.spacing + props.size,
|
|
47
|
+
third: 2 * (props.spacing + props.size),
|
|
48
|
+
fourth: 3 * (props.spacing + props.size)
|
|
49
|
+
};
|
|
50
|
+
const maxWidth = 3 * (props.size + props.spacing) + props.size;
|
|
51
|
+
const keyframeStyle = `@keyframes animation-pixel-loader {
|
|
52
|
+
0% {
|
|
53
|
+
box-shadow: ${colors.mekari} ${dotCalculation.first}px -${props.size}px 0px 0px,
|
|
54
|
+
${colors.talenta} ${dotCalculation.second}px -${props.size}px 0px 0px,
|
|
55
|
+
${colors.jurnal} ${dotCalculation.third}px -${props.size}px 0px 0px,
|
|
56
|
+
${colors.klikpajak} ${dotCalculation.fourth}px -${props.size}px 0px 0px;
|
|
57
|
+
}
|
|
58
|
+
15% {
|
|
59
|
+
box-shadow: ${colors.mekari} ${dotCalculation.first}px ${jumpHeight}px 0px 0px,
|
|
60
|
+
${colors.talenta} ${dotCalculation.second}px -${props.size}px 0px 0px,
|
|
61
|
+
${colors.jurnal} ${dotCalculation.third}px -${props.size}px 0px 0px,
|
|
62
|
+
${colors.klikpajak} ${dotCalculation.fourth}px -${props.size}px 0px 0px;
|
|
63
|
+
}
|
|
64
|
+
30% {
|
|
65
|
+
box-shadow: ${colors.mekari} ${dotCalculation.first}px -${props.size}px 0px 0px,
|
|
66
|
+
${colors.talenta} ${dotCalculation.second}px ${jumpHeight}px 0px 0px,
|
|
67
|
+
${colors.jurnal} ${dotCalculation.third}px -${props.size}px 0px 0px,
|
|
68
|
+
${colors.klikpajak} ${dotCalculation.fourth}px -${props.size}px 0px 0px;
|
|
69
|
+
}
|
|
70
|
+
45% {
|
|
71
|
+
box-shadow: ${colors.mekari} ${dotCalculation.first}px -${bounceHeight}px 0px 0px,
|
|
72
|
+
${colors.talenta}${dotCalculation.second}px -${props.size}px 0px 0px,
|
|
73
|
+
${colors.jurnal} ${dotCalculation.third}px ${jumpHeight}px 0px 0px,
|
|
74
|
+
${colors.klikpajak} ${dotCalculation.fourth}px -${props.size}px 0px 0px;
|
|
75
|
+
}
|
|
76
|
+
60% {
|
|
77
|
+
box-shadow: ${colors.mekari} ${dotCalculation.first}px -${props.size}px 0px 0px,
|
|
78
|
+
${colors.talenta} ${dotCalculation.second}px -${bounceHeight}px 0px 0px,
|
|
79
|
+
${colors.jurnal} ${dotCalculation.third}px -${props.size}px 0px 0px,
|
|
80
|
+
${colors.klikpajak} ${dotCalculation.fourth}px ${jumpHeight}px 0px 0px;
|
|
81
|
+
}
|
|
82
|
+
75% {
|
|
83
|
+
box-shadow: ${colors.mekari} 0px -${props.size}px 0px 0px,
|
|
84
|
+
${colors.talenta} ${dotCalculation.second}px -${props.size}px 0px 0px,
|
|
85
|
+
${colors.jurnal} ${dotCalculation.third}px -${bounceHeight}px 0px 0px,
|
|
86
|
+
${colors.klikpajak} ${dotCalculation.fourth}px -${props.size}px 0px 0px;
|
|
87
|
+
}
|
|
88
|
+
90% {
|
|
89
|
+
box-shadow: ${colors.mekari} 0px -${props.size}px 0px 0px,
|
|
90
|
+
${colors.talenta} ${dotCalculation.second}px -${props.size}px 0px 0px,
|
|
91
|
+
${colors.jurnal} ${dotCalculation.third}px -${props.size}px 0px 0px,
|
|
92
|
+
${colors.klikpajak} ${dotCalculation.fourth}px -${bounceHeight}px 0px 0px;
|
|
93
|
+
}
|
|
94
|
+
100% {
|
|
95
|
+
box-shadow: ${colors.mekari} 0px -${props.size}px 0px 0px,
|
|
96
|
+
${colors.talenta} ${dotCalculation.second}px -${props.size}px 0px 0px,
|
|
97
|
+
${colors.jurnal} ${dotCalculation.third}px -${props.size}px 0px 0px,
|
|
98
|
+
${colors.klikpajak} ${dotCalculation.fourth}px -${props.size}px 0px 0px;
|
|
99
|
+
}
|
|
100
|
+
}`;
|
|
101
|
+
const loaderStyle = `
|
|
102
|
+
${keyframeStyle}
|
|
103
|
+
|
|
104
|
+
.${identifierClass} {
|
|
105
|
+
border-radius: 999px;
|
|
106
|
+
background: transparent;
|
|
107
|
+
width: ${props.size}px;
|
|
108
|
+
height: ${props.size}px;
|
|
109
|
+
position: absolute;
|
|
110
|
+
transform: translateY(${props.size}px);
|
|
111
|
+
animation: 1250ms ease 0s infinite normal backwards running animation-pixel-loader;
|
|
112
|
+
}`;
|
|
113
|
+
return {
|
|
114
|
+
jumpHeight,
|
|
115
|
+
bounceHeight,
|
|
116
|
+
dotCalculation,
|
|
117
|
+
maxWidth,
|
|
118
|
+
loaderStyle
|
|
119
|
+
};
|
|
120
|
+
});
|
|
121
|
+
const {
|
|
122
|
+
css,
|
|
123
|
+
load,
|
|
124
|
+
unload,
|
|
125
|
+
isLoaded
|
|
126
|
+
} = (0, import_pixel3_utils.useStyleTag)(getLoaderData.value.loaderStyle, {
|
|
127
|
+
id: identifierClass
|
|
128
|
+
});
|
|
129
|
+
const wrapperAttrs = (0, import_vue.computed)(() => {
|
|
130
|
+
return {
|
|
131
|
+
style: {
|
|
132
|
+
position: "absolute",
|
|
133
|
+
height: props.size + "px",
|
|
134
|
+
width: getLoaderData.value.maxWidth + "px"
|
|
135
|
+
}
|
|
136
|
+
};
|
|
137
|
+
});
|
|
138
|
+
const loaderAttrs = (0, import_vue.computed)(() => {
|
|
139
|
+
return {
|
|
140
|
+
class: isLoaded.value ? identifierClass : ""
|
|
141
|
+
};
|
|
142
|
+
});
|
|
143
|
+
(0, import_vue.onMounted)(() => {
|
|
144
|
+
load();
|
|
145
|
+
});
|
|
146
|
+
(0, import_vue.onBeforeUnmount)(() => {
|
|
147
|
+
unload();
|
|
148
|
+
});
|
|
149
|
+
(0, import_vue.watch)(() => getLoaderData.value.loaderStyle, () => {
|
|
150
|
+
css.value = getLoaderData.value.loaderStyle;
|
|
151
|
+
});
|
|
152
|
+
return {
|
|
153
|
+
wrapperAttrs,
|
|
154
|
+
loaderAttrs
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
__name(useLoader, "useLoader");
|
|
158
|
+
|
|
159
|
+
// src/modules/loader.props.ts
|
|
160
|
+
var loaderProps = {
|
|
161
|
+
id: {
|
|
162
|
+
type: String
|
|
163
|
+
},
|
|
164
|
+
size: {
|
|
165
|
+
type: [Number],
|
|
166
|
+
default: 24
|
|
167
|
+
},
|
|
168
|
+
spacing: {
|
|
169
|
+
type: [Number],
|
|
170
|
+
default: 12
|
|
171
|
+
},
|
|
172
|
+
duration: {
|
|
173
|
+
type: String,
|
|
174
|
+
default: "1250ms"
|
|
175
|
+
}
|
|
176
|
+
};
|
|
177
|
+
|
|
178
|
+
// src/loader.tsx
|
|
179
|
+
var MpLoader = (0, import_vue3.defineComponent)({
|
|
180
|
+
name: "MpLoader",
|
|
181
|
+
props: loaderProps,
|
|
182
|
+
setup(props) {
|
|
183
|
+
const {
|
|
184
|
+
wrapperAttrs,
|
|
185
|
+
loaderAttrs
|
|
186
|
+
} = useLoader(props);
|
|
187
|
+
return () => {
|
|
188
|
+
return (0, import_vue2.createVNode)("div", (0, import_vue2.mergeProps)({
|
|
189
|
+
"data-pixel-component": "MpLoader"
|
|
190
|
+
}, wrapperAttrs.value), [(0, import_vue2.createVNode)("div", (0, import_vue2.mergeProps)({
|
|
191
|
+
"data-pixel-component": "MpLoaderDot"
|
|
192
|
+
}, loaderAttrs.value), null)]);
|
|
193
|
+
};
|
|
194
|
+
}
|
|
195
|
+
});
|
|
196
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
197
|
+
0 && (module.exports = {
|
|
198
|
+
MpLoader
|
|
199
|
+
});
|
package/dist/loader.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"inputs":{"src/modules/useLoader.ts":{"bytes":5037,"imports":[{"path":"vue","kind":"import-statement","external":true},{"path":"@mekari/pixel3-utils","kind":"import-statement","external":true},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/modules/loader.props.ts":{"bytes":516,"imports":[],"format":"esm"},"src/loader.tsx":{"bytes":754,"imports":[{"path":"vue","kind":"import-statement","external":true},{"path":"vue","kind":"import-statement","external":true},{"path":"src/modules/useLoader.ts","kind":"import-statement","original":"./modules/useLoader"},{"path":"src/modules/loader.props.ts","kind":"import-statement","original":"./modules/loader.props"}],"format":"esm"},"src/index.ts":{"bytes":110,"imports":[{"path":"src/loader.tsx","kind":"import-statement","original":"./loader"}],"format":"esm"}},"outputs":{"dist/index.js":{"imports":[{"path":"vue","kind":"require-call","external":true},{"path":"vue","kind":"require-call","external":true},{"path":"vue","kind":"require-call","external":true},{"path":"@mekari/pixel3-utils","kind":"require-call","external":true}],"exports":[],"entryPoint":"src/index.ts","inputs":{"src/index.ts":{"bytesInOutput":121},"src/loader.tsx":{"bytesInOutput":590},"src/modules/useLoader.ts":{"bytesInOutput":4936},"src/modules/loader.props.ts":{"bytesInOutput":216}},"bytes":6970},"dist/loader.js":{"imports":[{"path":"vue","kind":"require-call","external":true},{"path":"vue","kind":"require-call","external":true},{"path":"vue","kind":"require-call","external":true},{"path":"@mekari/pixel3-utils","kind":"require-call","external":true}],"exports":[],"entryPoint":"src/loader.tsx","inputs":{"src/loader.tsx":{"bytesInOutput":720},"src/modules/useLoader.ts":{"bytesInOutput":4936},"src/modules/loader.props.ts":{"bytesInOutput":216}},"bytes":6962},"dist/modules/loader.props.js":{"imports":[],"exports":[],"entryPoint":"src/modules/loader.props.ts","inputs":{"src/modules/loader.props.ts":{"bytesInOutput":370}},"bytes":1306},"dist/modules/useLoader.js":{"imports":[{"path":"vue","kind":"require-call","external":true},{"path":"@mekari/pixel3-utils","kind":"require-call","external":true}],"exports":[],"entryPoint":"src/modules/useLoader.ts","inputs":{"src/modules/useLoader.ts":{"bytesInOutput":5077}},"bytes":6098}}}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"inputs":{"src/modules/useLoader.ts":{"bytes":5037,"imports":[{"path":"vue","kind":"import-statement","external":true},{"path":"@mekari/pixel3-utils","kind":"import-statement","external":true},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/modules/loader.props.ts":{"bytes":516,"imports":[],"format":"esm"},"src/loader.tsx":{"bytes":754,"imports":[{"path":"vue","kind":"import-statement","external":true},{"path":"vue","kind":"import-statement","external":true},{"path":"src/modules/useLoader.ts","kind":"import-statement","original":"./modules/useLoader"},{"path":"src/modules/loader.props.ts","kind":"import-statement","original":"./modules/loader.props"}],"format":"esm"},"src/index.ts":{"bytes":110,"imports":[{"path":"src/loader.tsx","kind":"import-statement","original":"./loader"}],"format":"esm"}},"outputs":{"dist/index.mjs":{"imports":[{"path":"dist/chunk-HTTW3RII.mjs","kind":"import-statement"},{"path":"dist/chunk-6Q7HPFR6.mjs","kind":"import-statement"},{"path":"dist/chunk-YF2MAEL3.mjs","kind":"import-statement"},{"path":"dist/chunk-QZ7VFGWC.mjs","kind":"import-statement"}],"exports":["MpLoader"],"entryPoint":"src/index.ts","inputs":{"src/index.ts":{"bytesInOutput":0}},"bytes":167},"dist/loader.mjs":{"imports":[{"path":"dist/chunk-HTTW3RII.mjs","kind":"import-statement"},{"path":"dist/chunk-6Q7HPFR6.mjs","kind":"import-statement"},{"path":"dist/chunk-YF2MAEL3.mjs","kind":"import-statement"},{"path":"dist/chunk-QZ7VFGWC.mjs","kind":"import-statement"}],"exports":["MpLoader"],"entryPoint":"src/loader.tsx","inputs":{},"bytes":167},"dist/chunk-HTTW3RII.mjs":{"imports":[{"path":"dist/chunk-6Q7HPFR6.mjs","kind":"import-statement"},{"path":"dist/chunk-YF2MAEL3.mjs","kind":"import-statement"},{"path":"vue","kind":"import-statement","external":true},{"path":"vue","kind":"import-statement","external":true}],"exports":["MpLoader"],"inputs":{"src/loader.tsx":{"bytesInOutput":558}},"bytes":707},"dist/modules/loader.props.mjs":{"imports":[{"path":"dist/chunk-6Q7HPFR6.mjs","kind":"import-statement"},{"path":"dist/chunk-QZ7VFGWC.mjs","kind":"import-statement"}],"exports":["loaderProps"],"entryPoint":"src/modules/loader.props.ts","inputs":{},"bytes":113},"dist/chunk-6Q7HPFR6.mjs":{"imports":[],"exports":["loaderProps"],"inputs":{"src/modules/loader.props.ts":{"bytesInOutput":216}},"bytes":274},"dist/modules/useLoader.mjs":{"imports":[{"path":"dist/chunk-YF2MAEL3.mjs","kind":"import-statement"},{"path":"dist/chunk-QZ7VFGWC.mjs","kind":"import-statement"}],"exports":["useLoader"],"entryPoint":"src/modules/useLoader.ts","inputs":{},"bytes":109},"dist/chunk-YF2MAEL3.mjs":{"imports":[{"path":"dist/chunk-QZ7VFGWC.mjs","kind":"import-statement"},{"path":"vue","kind":"import-statement","external":true},{"path":"@mekari/pixel3-utils","kind":"import-statement","external":true}],"exports":["useLoader"],"inputs":{"src/modules/useLoader.ts":{"bytesInOutput":4824}},"bytes":4927},"dist/chunk-QZ7VFGWC.mjs":{"imports":[],"exports":["__name"],"inputs":{},"bytes":151}}}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { PropType, ExtractPropTypes } from 'vue';
|
|
2
|
+
|
|
3
|
+
declare const loaderProps: {
|
|
4
|
+
id: {
|
|
5
|
+
type: PropType<string>;
|
|
6
|
+
};
|
|
7
|
+
size: {
|
|
8
|
+
type: PropType<number>;
|
|
9
|
+
default: number;
|
|
10
|
+
};
|
|
11
|
+
spacing: {
|
|
12
|
+
type: PropType<number>;
|
|
13
|
+
default: number;
|
|
14
|
+
};
|
|
15
|
+
duration: {
|
|
16
|
+
type: PropType<string>;
|
|
17
|
+
default: string;
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
type LoaderProps = ExtractPropTypes<typeof loaderProps>;
|
|
21
|
+
|
|
22
|
+
export { LoaderProps, loaderProps };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { PropType, ExtractPropTypes } from 'vue';
|
|
2
|
+
|
|
3
|
+
declare const loaderProps: {
|
|
4
|
+
id: {
|
|
5
|
+
type: PropType<string>;
|
|
6
|
+
};
|
|
7
|
+
size: {
|
|
8
|
+
type: PropType<number>;
|
|
9
|
+
default: number;
|
|
10
|
+
};
|
|
11
|
+
spacing: {
|
|
12
|
+
type: PropType<number>;
|
|
13
|
+
default: number;
|
|
14
|
+
};
|
|
15
|
+
duration: {
|
|
16
|
+
type: PropType<string>;
|
|
17
|
+
default: string;
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
type LoaderProps = ExtractPropTypes<typeof loaderProps>;
|
|
21
|
+
|
|
22
|
+
export { LoaderProps, loaderProps };
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/modules/loader.props.ts
|
|
21
|
+
var loader_props_exports = {};
|
|
22
|
+
__export(loader_props_exports, {
|
|
23
|
+
loaderProps: () => loaderProps
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(loader_props_exports);
|
|
26
|
+
var loaderProps = {
|
|
27
|
+
id: {
|
|
28
|
+
type: String
|
|
29
|
+
},
|
|
30
|
+
size: {
|
|
31
|
+
type: [Number],
|
|
32
|
+
default: 24
|
|
33
|
+
},
|
|
34
|
+
spacing: {
|
|
35
|
+
type: [Number],
|
|
36
|
+
default: 12
|
|
37
|
+
},
|
|
38
|
+
duration: {
|
|
39
|
+
type: String,
|
|
40
|
+
default: "1250ms"
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
44
|
+
0 && (module.exports = {
|
|
45
|
+
loaderProps
|
|
46
|
+
});
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as vue from 'vue';
|
|
2
|
+
import { HTMLAttributes } from 'vue';
|
|
3
|
+
import { LoaderProps } from './loader.props.mjs';
|
|
4
|
+
|
|
5
|
+
declare function useLoader(props: LoaderProps): {
|
|
6
|
+
wrapperAttrs: vue.ComputedRef<HTMLAttributes>;
|
|
7
|
+
loaderAttrs: vue.ComputedRef<HTMLAttributes>;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export { useLoader };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as vue from 'vue';
|
|
2
|
+
import { HTMLAttributes } from 'vue';
|
|
3
|
+
import { LoaderProps } from './loader.props.js';
|
|
4
|
+
|
|
5
|
+
declare function useLoader(props: LoaderProps): {
|
|
6
|
+
wrapperAttrs: vue.ComputedRef<HTMLAttributes>;
|
|
7
|
+
loaderAttrs: vue.ComputedRef<HTMLAttributes>;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export { useLoader };
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
|
+
|
|
21
|
+
// src/modules/useLoader.ts
|
|
22
|
+
var useLoader_exports = {};
|
|
23
|
+
__export(useLoader_exports, {
|
|
24
|
+
useLoader: () => useLoader
|
|
25
|
+
});
|
|
26
|
+
module.exports = __toCommonJS(useLoader_exports);
|
|
27
|
+
var import_vue = require("vue");
|
|
28
|
+
var import_pixel3_utils = require("@mekari/pixel3-utils");
|
|
29
|
+
function useLoader(props) {
|
|
30
|
+
const identifierClass = `pixel-loader-${(0, import_pixel3_utils.useId)(4)}`;
|
|
31
|
+
const colors = {
|
|
32
|
+
mekari: "var(--mp-colors-brand-mekari)",
|
|
33
|
+
talenta: "var(--mp-colors-brand-talenta)",
|
|
34
|
+
jurnal: "var(--mp-colors-brand-jurnal)",
|
|
35
|
+
klikpajak: "var(--mp-colors-brand-klikpajak)"
|
|
36
|
+
};
|
|
37
|
+
const getLoaderData = (0, import_vue.computed)(() => {
|
|
38
|
+
const jumpHeight = -(2.5 * props.size);
|
|
39
|
+
const bounceHeight = Math.floor(props.size * 0.2) + props.size;
|
|
40
|
+
const dotCalculation = {
|
|
41
|
+
first: 0,
|
|
42
|
+
second: props.spacing + props.size,
|
|
43
|
+
third: 2 * (props.spacing + props.size),
|
|
44
|
+
fourth: 3 * (props.spacing + props.size)
|
|
45
|
+
};
|
|
46
|
+
const maxWidth = 3 * (props.size + props.spacing) + props.size;
|
|
47
|
+
const keyframeStyle = `@keyframes animation-pixel-loader {
|
|
48
|
+
0% {
|
|
49
|
+
box-shadow: ${colors.mekari} ${dotCalculation.first}px -${props.size}px 0px 0px,
|
|
50
|
+
${colors.talenta} ${dotCalculation.second}px -${props.size}px 0px 0px,
|
|
51
|
+
${colors.jurnal} ${dotCalculation.third}px -${props.size}px 0px 0px,
|
|
52
|
+
${colors.klikpajak} ${dotCalculation.fourth}px -${props.size}px 0px 0px;
|
|
53
|
+
}
|
|
54
|
+
15% {
|
|
55
|
+
box-shadow: ${colors.mekari} ${dotCalculation.first}px ${jumpHeight}px 0px 0px,
|
|
56
|
+
${colors.talenta} ${dotCalculation.second}px -${props.size}px 0px 0px,
|
|
57
|
+
${colors.jurnal} ${dotCalculation.third}px -${props.size}px 0px 0px,
|
|
58
|
+
${colors.klikpajak} ${dotCalculation.fourth}px -${props.size}px 0px 0px;
|
|
59
|
+
}
|
|
60
|
+
30% {
|
|
61
|
+
box-shadow: ${colors.mekari} ${dotCalculation.first}px -${props.size}px 0px 0px,
|
|
62
|
+
${colors.talenta} ${dotCalculation.second}px ${jumpHeight}px 0px 0px,
|
|
63
|
+
${colors.jurnal} ${dotCalculation.third}px -${props.size}px 0px 0px,
|
|
64
|
+
${colors.klikpajak} ${dotCalculation.fourth}px -${props.size}px 0px 0px;
|
|
65
|
+
}
|
|
66
|
+
45% {
|
|
67
|
+
box-shadow: ${colors.mekari} ${dotCalculation.first}px -${bounceHeight}px 0px 0px,
|
|
68
|
+
${colors.talenta}${dotCalculation.second}px -${props.size}px 0px 0px,
|
|
69
|
+
${colors.jurnal} ${dotCalculation.third}px ${jumpHeight}px 0px 0px,
|
|
70
|
+
${colors.klikpajak} ${dotCalculation.fourth}px -${props.size}px 0px 0px;
|
|
71
|
+
}
|
|
72
|
+
60% {
|
|
73
|
+
box-shadow: ${colors.mekari} ${dotCalculation.first}px -${props.size}px 0px 0px,
|
|
74
|
+
${colors.talenta} ${dotCalculation.second}px -${bounceHeight}px 0px 0px,
|
|
75
|
+
${colors.jurnal} ${dotCalculation.third}px -${props.size}px 0px 0px,
|
|
76
|
+
${colors.klikpajak} ${dotCalculation.fourth}px ${jumpHeight}px 0px 0px;
|
|
77
|
+
}
|
|
78
|
+
75% {
|
|
79
|
+
box-shadow: ${colors.mekari} 0px -${props.size}px 0px 0px,
|
|
80
|
+
${colors.talenta} ${dotCalculation.second}px -${props.size}px 0px 0px,
|
|
81
|
+
${colors.jurnal} ${dotCalculation.third}px -${bounceHeight}px 0px 0px,
|
|
82
|
+
${colors.klikpajak} ${dotCalculation.fourth}px -${props.size}px 0px 0px;
|
|
83
|
+
}
|
|
84
|
+
90% {
|
|
85
|
+
box-shadow: ${colors.mekari} 0px -${props.size}px 0px 0px,
|
|
86
|
+
${colors.talenta} ${dotCalculation.second}px -${props.size}px 0px 0px,
|
|
87
|
+
${colors.jurnal} ${dotCalculation.third}px -${props.size}px 0px 0px,
|
|
88
|
+
${colors.klikpajak} ${dotCalculation.fourth}px -${bounceHeight}px 0px 0px;
|
|
89
|
+
}
|
|
90
|
+
100% {
|
|
91
|
+
box-shadow: ${colors.mekari} 0px -${props.size}px 0px 0px,
|
|
92
|
+
${colors.talenta} ${dotCalculation.second}px -${props.size}px 0px 0px,
|
|
93
|
+
${colors.jurnal} ${dotCalculation.third}px -${props.size}px 0px 0px,
|
|
94
|
+
${colors.klikpajak} ${dotCalculation.fourth}px -${props.size}px 0px 0px;
|
|
95
|
+
}
|
|
96
|
+
}`;
|
|
97
|
+
const loaderStyle = `
|
|
98
|
+
${keyframeStyle}
|
|
99
|
+
|
|
100
|
+
.${identifierClass} {
|
|
101
|
+
border-radius: 999px;
|
|
102
|
+
background: transparent;
|
|
103
|
+
width: ${props.size}px;
|
|
104
|
+
height: ${props.size}px;
|
|
105
|
+
position: absolute;
|
|
106
|
+
transform: translateY(${props.size}px);
|
|
107
|
+
animation: 1250ms ease 0s infinite normal backwards running animation-pixel-loader;
|
|
108
|
+
}`;
|
|
109
|
+
return {
|
|
110
|
+
jumpHeight,
|
|
111
|
+
bounceHeight,
|
|
112
|
+
dotCalculation,
|
|
113
|
+
maxWidth,
|
|
114
|
+
loaderStyle
|
|
115
|
+
};
|
|
116
|
+
});
|
|
117
|
+
const {
|
|
118
|
+
css,
|
|
119
|
+
load,
|
|
120
|
+
unload,
|
|
121
|
+
isLoaded
|
|
122
|
+
} = (0, import_pixel3_utils.useStyleTag)(getLoaderData.value.loaderStyle, {
|
|
123
|
+
id: identifierClass
|
|
124
|
+
});
|
|
125
|
+
const wrapperAttrs = (0, import_vue.computed)(() => {
|
|
126
|
+
return {
|
|
127
|
+
style: {
|
|
128
|
+
position: "absolute",
|
|
129
|
+
height: props.size + "px",
|
|
130
|
+
width: getLoaderData.value.maxWidth + "px"
|
|
131
|
+
}
|
|
132
|
+
};
|
|
133
|
+
});
|
|
134
|
+
const loaderAttrs = (0, import_vue.computed)(() => {
|
|
135
|
+
return {
|
|
136
|
+
class: isLoaded.value ? identifierClass : ""
|
|
137
|
+
};
|
|
138
|
+
});
|
|
139
|
+
(0, import_vue.onMounted)(() => {
|
|
140
|
+
load();
|
|
141
|
+
});
|
|
142
|
+
(0, import_vue.onBeforeUnmount)(() => {
|
|
143
|
+
unload();
|
|
144
|
+
});
|
|
145
|
+
(0, import_vue.watch)(() => getLoaderData.value.loaderStyle, () => {
|
|
146
|
+
css.value = getLoaderData.value.loaderStyle;
|
|
147
|
+
});
|
|
148
|
+
return {
|
|
149
|
+
wrapperAttrs,
|
|
150
|
+
loaderAttrs
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
__name(useLoader, "useLoader");
|
|
154
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
155
|
+
0 && (module.exports = {
|
|
156
|
+
useLoader
|
|
157
|
+
});
|
package/package.json
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@mekari/pixel3-loader",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"main": "dist/index.js",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"files": [
|
|
7
|
+
"dist"
|
|
8
|
+
],
|
|
9
|
+
"dependencies": {
|
|
10
|
+
"@mekari/pixel3-styled-system": "0.0.1",
|
|
11
|
+
"@mekari/pixel3-utils": "0.0.2"
|
|
12
|
+
},
|
|
13
|
+
"peerDependencies": {
|
|
14
|
+
"vue": "3.2.47"
|
|
15
|
+
},
|
|
16
|
+
"devDependencies": {
|
|
17
|
+
"vue": "3.2.47"
|
|
18
|
+
},
|
|
19
|
+
"publishConfig": {
|
|
20
|
+
"access": "public"
|
|
21
|
+
},
|
|
22
|
+
"module": "dist/index.mjs",
|
|
23
|
+
"types": "dist/index.d.ts",
|
|
24
|
+
"exports": {
|
|
25
|
+
".": {
|
|
26
|
+
"types": "./dist/index.d.ts",
|
|
27
|
+
"require": "./dist/index.js",
|
|
28
|
+
"default": "./dist/index.mjs"
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
"scripts": {
|
|
32
|
+
"clean": "rimraf dist .turbo",
|
|
33
|
+
"build": "tsup && pnpm build:types",
|
|
34
|
+
"build:fast": "tsup",
|
|
35
|
+
"build:types": "tsup src --dts-only",
|
|
36
|
+
"build:external": "tsup src/index.tsx --external @acme-org/styled-system",
|
|
37
|
+
"types:check": "tsc --noEmit",
|
|
38
|
+
"replace-config": "clean-package",
|
|
39
|
+
"restore-config": "clean-package restore"
|
|
40
|
+
}
|
|
41
|
+
}
|