mikuru 1.0.26 → 1.0.28
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/CHANGELOG.md +7 -0
- package/README.md +36 -4
- package/components/MikuruAudioPlayer.mikuru +263 -0
- package/components/MikuruCarousel.mikuru +280 -0
- package/components/MikuruCodeBlock.mikuru +96 -0
- package/components/MikuruDropdown.mikuru +153 -0
- package/components/MikuruImageViewer.mikuru +269 -0
- package/components/MikuruModal.mikuru +159 -0
- package/components/MikuruProgress.mikuru +85 -0
- package/components/MikuruToast.mikuru +128 -0
- package/components/MikuruToolTip.mikuru +95 -0
- package/components/MikuruVideoPlayer.mikuru +635 -0
- package/dist/compiler/compile.js +9 -2
- package/dist/compiler/compile.js.map +1 -1
- package/dist/compiler/compileHydration.js +9 -2
- package/dist/compiler/compileHydration.js.map +1 -1
- package/dist/compiler/compileSsr.js +4 -1
- package/dist/compiler/compileSsr.js.map +1 -1
- package/dist/compiler/generate.d.ts +1 -0
- package/dist/compiler/generate.js +17 -2
- package/dist/compiler/generate.js.map +1 -1
- package/dist/compiler/generateHydration.js +1 -1
- package/dist/compiler/generateHydration.js.map +1 -1
- package/dist/compiler/index.d.ts +2 -0
- package/dist/compiler/index.js +1 -0
- package/dist/compiler/index.js.map +1 -1
- package/dist/compiler/parseSfc.js +20 -2
- package/dist/compiler/parseSfc.js.map +1 -1
- package/dist/compiler/sourceMap.js +72 -16
- package/dist/compiler/sourceMap.js.map +1 -1
- package/dist/compiler/templateTypeCheck.d.ts +19 -0
- package/dist/compiler/templateTypeCheck.js +270 -0
- package/dist/compiler/templateTypeCheck.js.map +1 -0
- package/dist/compiler/types.d.ts +7 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/runtime/devtools.d.ts +19 -5
- package/dist/runtime/devtools.js +26 -3
- package/dist/runtime/devtools.js.map +1 -1
- package/dist/runtime/index.d.ts +2 -2
- package/dist/runtime/index.js +1 -1
- package/dist/runtime/index.js.map +1 -1
- package/dist/vite.d.ts +1 -0
- package/dist/vite.js +65 -3
- package/dist/vite.js.map +1 -1
- package/package.json +84 -2
- package/types/components/MikuruAudioPlayer.d.ts +12 -0
- package/types/components/MikuruCarousel.d.ts +21 -0
- package/types/components/MikuruCodeBlock.d.ts +11 -0
- package/types/components/MikuruDropdown.d.ts +17 -0
- package/types/components/MikuruImageViewer.d.ts +14 -0
- package/types/components/MikuruModal.d.ts +14 -0
- package/types/components/MikuruProgress.d.ts +12 -0
- package/types/components/MikuruToast.d.ts +17 -0
- package/types/components/MikuruToolTip.d.ts +11 -0
- package/types/components/MikuruVideoPlayer.d.ts +13 -0
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="mikuru-progress" :class="{ indeterminate }">
|
|
3
|
+
<div class="progress-label">
|
|
4
|
+
<span>{{ label }}</span>
|
|
5
|
+
<strong m-if="!indeterminate">{{ percentLabel }}</strong>
|
|
6
|
+
</div>
|
|
7
|
+
<div
|
|
8
|
+
class="progress-track"
|
|
9
|
+
role="progressbar"
|
|
10
|
+
:aria-label="label"
|
|
11
|
+
aria-valuemin="0"
|
|
12
|
+
:aria-valuemax="max"
|
|
13
|
+
:aria-valuenow="indeterminate ? undefined : clampedValue"
|
|
14
|
+
>
|
|
15
|
+
<span class="progress-fill" :style="fillStyle"></span>
|
|
16
|
+
</div>
|
|
17
|
+
</div>
|
|
18
|
+
</template>
|
|
19
|
+
|
|
20
|
+
<script>
|
|
21
|
+
import { computed } from "mikuru";
|
|
22
|
+
|
|
23
|
+
const {
|
|
24
|
+
value = 0,
|
|
25
|
+
max = 100,
|
|
26
|
+
label = "Progress",
|
|
27
|
+
indeterminate = false
|
|
28
|
+
} = defineProps({
|
|
29
|
+
value: Number,
|
|
30
|
+
max: Number,
|
|
31
|
+
label: String,
|
|
32
|
+
indeterminate: Boolean
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
const safeMax = computed(() => max.value > 0 ? max.value : 100);
|
|
36
|
+
const clampedValue = computed(() => Math.min(Math.max(value.value, 0), safeMax.value));
|
|
37
|
+
const percent = computed(() => Math.round((clampedValue.value / safeMax.value) * 100));
|
|
38
|
+
const percentLabel = computed(() => `${percent.value}%`);
|
|
39
|
+
const fillStyle = computed(() => ({
|
|
40
|
+
width: indeterminate.value ? "45%" : `${percent.value}%`
|
|
41
|
+
}));
|
|
42
|
+
</script>
|
|
43
|
+
|
|
44
|
+
<style scoped>
|
|
45
|
+
.mikuru-progress {
|
|
46
|
+
display: grid;
|
|
47
|
+
gap: 7px;
|
|
48
|
+
color: #111827;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.progress-label {
|
|
52
|
+
display: flex;
|
|
53
|
+
justify-content: space-between;
|
|
54
|
+
gap: 12px;
|
|
55
|
+
font-size: 0.9rem;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.progress-track {
|
|
59
|
+
height: 10px;
|
|
60
|
+
overflow: hidden;
|
|
61
|
+
border-radius: 999px;
|
|
62
|
+
background: #e2e8f0;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.progress-fill {
|
|
66
|
+
display: block;
|
|
67
|
+
height: 100%;
|
|
68
|
+
border-radius: inherit;
|
|
69
|
+
background: #2563eb;
|
|
70
|
+
transition: width 180ms ease;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.indeterminate .progress-fill {
|
|
74
|
+
animation: mikuru-progress-slide 1.2s ease-in-out infinite;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
@keyframes mikuru-progress-slide {
|
|
78
|
+
0% {
|
|
79
|
+
transform: translateX(-120%);
|
|
80
|
+
}
|
|
81
|
+
100% {
|
|
82
|
+
transform: translateX(240%);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
</style>
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<section class="mikuru-toast-stack" :class="positionClass" aria-live="polite" aria-label="Notifications">
|
|
3
|
+
<article
|
|
4
|
+
class="toast"
|
|
5
|
+
m-for="toast in normalizedToasts"
|
|
6
|
+
:key="toast.id"
|
|
7
|
+
:class="toast.toneClass"
|
|
8
|
+
role="status"
|
|
9
|
+
>
|
|
10
|
+
<div class="toast-body">
|
|
11
|
+
<strong>{{ toast.title }}</strong>
|
|
12
|
+
<span>{{ toast.message }}</span>
|
|
13
|
+
</div>
|
|
14
|
+
<button type="button" @click="dismissToast(toast.id)" :aria-label="toast.dismissLabel">Close</button>
|
|
15
|
+
</article>
|
|
16
|
+
</section>
|
|
17
|
+
</template>
|
|
18
|
+
|
|
19
|
+
<script>
|
|
20
|
+
import { computed } from "mikuru";
|
|
21
|
+
|
|
22
|
+
const {
|
|
23
|
+
toasts = [],
|
|
24
|
+
position = "bottom-right"
|
|
25
|
+
} = defineProps({
|
|
26
|
+
toasts: Array,
|
|
27
|
+
position: String
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
const emit = defineEmits(["dismiss"]);
|
|
31
|
+
const positionClass = computed(() => `position-${position.value}`);
|
|
32
|
+
const normalizedToasts = computed(() => {
|
|
33
|
+
const source = Array.isArray(toasts.value) ? toasts.value : [];
|
|
34
|
+
return source.map((toast, index) => {
|
|
35
|
+
const id = toast.id ?? index;
|
|
36
|
+
const tone = toast.tone || "info";
|
|
37
|
+
return {
|
|
38
|
+
id,
|
|
39
|
+
title: toast.title || "Notification",
|
|
40
|
+
message: toast.message || "",
|
|
41
|
+
toneClass: `tone-${tone}`,
|
|
42
|
+
dismissLabel: `Dismiss ${toast.title || "notification"}`
|
|
43
|
+
};
|
|
44
|
+
});
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
function dismissToast(id) {
|
|
48
|
+
emit("dismiss", id);
|
|
49
|
+
}
|
|
50
|
+
</script>
|
|
51
|
+
|
|
52
|
+
<style scoped>
|
|
53
|
+
.mikuru-toast-stack {
|
|
54
|
+
position: fixed;
|
|
55
|
+
z-index: 60;
|
|
56
|
+
display: grid;
|
|
57
|
+
width: min(360px, calc(100vw - 32px));
|
|
58
|
+
gap: 10px;
|
|
59
|
+
pointer-events: none;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.position-bottom-right {
|
|
63
|
+
right: 16px;
|
|
64
|
+
bottom: 16px;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.position-bottom-left {
|
|
68
|
+
bottom: 16px;
|
|
69
|
+
left: 16px;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.position-top-right {
|
|
73
|
+
top: 16px;
|
|
74
|
+
right: 16px;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.position-top-left {
|
|
78
|
+
top: 16px;
|
|
79
|
+
left: 16px;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.toast {
|
|
83
|
+
display: flex;
|
|
84
|
+
align-items: start;
|
|
85
|
+
justify-content: space-between;
|
|
86
|
+
gap: 12px;
|
|
87
|
+
border: 1px solid #e5e7eb;
|
|
88
|
+
border-left: 4px solid #2563eb;
|
|
89
|
+
border-radius: 8px;
|
|
90
|
+
padding: 12px;
|
|
91
|
+
color: #111827;
|
|
92
|
+
background: #ffffff;
|
|
93
|
+
box-shadow: 0 16px 44px rgb(15 23 42 / 18%);
|
|
94
|
+
pointer-events: auto;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
.tone-success {
|
|
98
|
+
border-left-color: #059669;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
.tone-warning {
|
|
102
|
+
border-left-color: #d97706;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
.tone-danger {
|
|
106
|
+
border-left-color: #dc2626;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
.toast-body {
|
|
110
|
+
display: grid;
|
|
111
|
+
gap: 3px;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
.toast-body span {
|
|
115
|
+
color: #475569;
|
|
116
|
+
font-size: 0.92rem;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
.toast button {
|
|
120
|
+
border: 0;
|
|
121
|
+
border-radius: 6px;
|
|
122
|
+
padding: 6px 8px;
|
|
123
|
+
color: #334155;
|
|
124
|
+
background: #f1f5f9;
|
|
125
|
+
font: inherit;
|
|
126
|
+
cursor: pointer;
|
|
127
|
+
}
|
|
128
|
+
</style>
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<span
|
|
3
|
+
class="mikuru-tooltip"
|
|
4
|
+
:class="placementClass"
|
|
5
|
+
@mouseenter="show"
|
|
6
|
+
@mouseleave="hide"
|
|
7
|
+
@focusin="show"
|
|
8
|
+
@focusout="hide"
|
|
9
|
+
>
|
|
10
|
+
<span class="tooltip-trigger" tabindex="0">
|
|
11
|
+
<slot>{{ label }}</slot>
|
|
12
|
+
</span>
|
|
13
|
+
<span m-if="visible" class="tooltip-bubble" role="tooltip">{{ text }}</span>
|
|
14
|
+
</span>
|
|
15
|
+
</template>
|
|
16
|
+
|
|
17
|
+
<script>
|
|
18
|
+
import { computed, ref } from "mikuru";
|
|
19
|
+
|
|
20
|
+
const {
|
|
21
|
+
text = "Tooltip",
|
|
22
|
+
label = "?",
|
|
23
|
+
placement = "top"
|
|
24
|
+
} = defineProps({
|
|
25
|
+
text: String,
|
|
26
|
+
label: String,
|
|
27
|
+
placement: String
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
const visible = ref(false);
|
|
31
|
+
const placementClass = computed(() => `placement-${placement.value}`);
|
|
32
|
+
|
|
33
|
+
function show() {
|
|
34
|
+
visible.value = true;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function hide() {
|
|
38
|
+
visible.value = false;
|
|
39
|
+
}
|
|
40
|
+
</script>
|
|
41
|
+
|
|
42
|
+
<style scoped>
|
|
43
|
+
.mikuru-tooltip {
|
|
44
|
+
position: relative;
|
|
45
|
+
display: inline-flex;
|
|
46
|
+
width: max-content;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.tooltip-trigger {
|
|
50
|
+
display: inline-flex;
|
|
51
|
+
outline: none;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.tooltip-trigger:focus-visible {
|
|
55
|
+
box-shadow: 0 0 0 3px #38bdf8;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.tooltip-bubble {
|
|
59
|
+
position: absolute;
|
|
60
|
+
z-index: 45;
|
|
61
|
+
width: max-content;
|
|
62
|
+
max-width: 240px;
|
|
63
|
+
border-radius: 6px;
|
|
64
|
+
padding: 7px 9px;
|
|
65
|
+
color: #f8fafc;
|
|
66
|
+
background: #111827;
|
|
67
|
+
font-size: 0.82rem;
|
|
68
|
+
line-height: 1.3;
|
|
69
|
+
overflow-wrap: anywhere;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.placement-top .tooltip-bubble {
|
|
73
|
+
bottom: calc(100% + 8px);
|
|
74
|
+
left: 50%;
|
|
75
|
+
transform: translateX(-50%);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.placement-bottom .tooltip-bubble {
|
|
79
|
+
top: calc(100% + 8px);
|
|
80
|
+
left: 50%;
|
|
81
|
+
transform: translateX(-50%);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
.placement-left .tooltip-bubble {
|
|
85
|
+
top: 50%;
|
|
86
|
+
right: calc(100% + 8px);
|
|
87
|
+
transform: translateY(-50%);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.placement-right .tooltip-bubble {
|
|
91
|
+
top: 50%;
|
|
92
|
+
left: calc(100% + 8px);
|
|
93
|
+
transform: translateY(-50%);
|
|
94
|
+
}
|
|
95
|
+
</style>
|