@3birds/midori-ui 0.0.16 → 0.0.18
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/alert.d.ts +3 -1
- package/dist/alert.js +8 -1
- package/dist/assets/face-man-white.svg +1 -1
- package/dist/assets/face-man.svg +1 -1
- package/dist/components/Alert.svelte +10 -24
- package/dist/components/Loading.svelte +9 -1
- package/dist/components/Loading.svelte.d.ts +5 -25
- package/package.json +7 -2
package/dist/alert.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import type { AlertState, AlertType } from './types';
|
|
2
|
+
declare function close(): void;
|
|
2
3
|
export declare const alert: {
|
|
3
4
|
subscribe: (this: void, run: import("svelte/store").Subscriber<AlertState>, invalidate?: () => void) => import("svelte/store").Unsubscriber;
|
|
4
5
|
trigger: (message: string, type?: AlertType, duration?: number) => void;
|
|
5
|
-
close:
|
|
6
|
+
close: typeof close;
|
|
6
7
|
};
|
|
8
|
+
export {};
|
package/dist/alert.js
CHANGED
|
@@ -5,11 +5,18 @@ const INITIAL_STATE = {
|
|
|
5
5
|
type: 'info',
|
|
6
6
|
duration: 3000
|
|
7
7
|
};
|
|
8
|
+
let timer;
|
|
8
9
|
const { subscribe, set } = writable(INITIAL_STATE);
|
|
10
|
+
function close() {
|
|
11
|
+
clearTimeout(timer);
|
|
12
|
+
set(INITIAL_STATE);
|
|
13
|
+
}
|
|
9
14
|
export const alert = {
|
|
10
15
|
subscribe,
|
|
11
16
|
trigger: (message, type = 'info', duration = 3000) => {
|
|
17
|
+
clearTimeout(timer);
|
|
12
18
|
set({ show: true, message, type, duration });
|
|
19
|
+
timer = setTimeout(close, duration);
|
|
13
20
|
},
|
|
14
|
-
close
|
|
21
|
+
close
|
|
15
22
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
|
|
2
2
|
<title>face-man</title>
|
|
3
3
|
<path
|
|
4
|
-
fill="
|
|
4
|
+
fill="#e0f1e8"
|
|
5
5
|
d="M9,11.75A1.25,1.25 0 0,0 7.75,13A1.25,1.25 0 0,0 9,14.25A1.25,1.25 0 0,0 10.25,13A1.25,1.25 0 0,0 9,11.75M15,11.75A1.25,1.25 0 0,0 13.75,13A1.25,1.25 0 0,0 15,14.25A1.25,1.25 0 0,0 16.25,13A1.25,1.25 0 0,0 15,11.75M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2M12,20C7.59,20 4,16.41 4,12C4,11.71 4,11.42 4.05,11.14C6.41,10.09 8.28,8.16 9.26,5.77C11.07,8.33 14.05,10 17.42,10C18.2,10 18.95,9.91 19.67,9.74C19.88,10.45 20,11.21 20,12C20,16.41 16.41,20 12,20Z"
|
|
6
6
|
/>
|
|
7
7
|
</svg>
|
package/dist/assets/face-man.svg
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
|
|
2
2
|
<title>face-man</title>
|
|
3
3
|
<path
|
|
4
|
-
fill="
|
|
4
|
+
fill="currentColor"
|
|
5
5
|
d="M9,11.75A1.25,1.25 0 0,0 7.75,13A1.25,1.25 0 0,0 9,14.25A1.25,1.25 0 0,0 10.25,13A1.25,1.25 0 0,0 9,11.75M15,11.75A1.25,1.25 0 0,0 13.75,13A1.25,1.25 0 0,0 15,14.25A1.25,1.25 0 0,0 16.25,13A1.25,1.25 0 0,0 15,11.75M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2M12,20C7.59,20 4,16.41 4,12C4,11.71 4,11.42 4.05,11.14C6.41,10.09 8.28,8.16 9.26,5.77C11.07,8.33 14.05,10 17.42,10C18.2,10 18.95,9.91 19.67,9.74C19.88,10.45 20,11.21 20,12C20,16.41 16.41,20 12,20Z"
|
|
6
6
|
/>
|
|
7
7
|
</svg>
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { alert } from '../alert';
|
|
3
3
|
import { alertSvg, checkCircleSvg, closeCircleSvg, informationSvg } from '@3birds/midori-ui';
|
|
4
4
|
|
|
5
|
-
let
|
|
5
|
+
let popover: HTMLButtonElement | undefined = $state(undefined);
|
|
6
6
|
|
|
7
7
|
let color: string = $derived.by(() => {
|
|
8
8
|
switch ($alert.type) {
|
|
@@ -34,29 +34,15 @@
|
|
|
34
34
|
}
|
|
35
35
|
});
|
|
36
36
|
|
|
37
|
-
$effect(() =>
|
|
38
|
-
if ($alert.show) {
|
|
39
|
-
dialog?.show();
|
|
40
|
-
|
|
41
|
-
setInterval(() => dialog?.close(), $alert.duration);
|
|
42
|
-
} else {
|
|
43
|
-
dialog?.close();
|
|
44
|
-
}
|
|
45
|
-
});
|
|
46
|
-
|
|
47
|
-
function handleClose() {
|
|
48
|
-
alert.close();
|
|
49
|
-
}
|
|
37
|
+
$effect(() => ($alert.show ? popover?.showPopover() : popover?.hidePopover()));
|
|
50
38
|
</script>
|
|
51
39
|
|
|
52
|
-
<
|
|
53
|
-
bind:this={
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
40
|
+
<button
|
|
41
|
+
bind:this={popover}
|
|
42
|
+
popover="manual"
|
|
43
|
+
class="alert rounded-3xl {color} fixed top-4 right-4 left-4 {$alert.show ? 'flex' : 'hidden'}"
|
|
44
|
+
onclick={() => alert.close()}
|
|
57
45
|
>
|
|
58
|
-
<
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
</div>
|
|
62
|
-
</dialog>
|
|
46
|
+
<img src={icon} alt="アラート" class="size-6" />
|
|
47
|
+
{$alert.message}
|
|
48
|
+
</button>
|
|
@@ -1,26 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
[x: string]: never;
|
|
4
|
-
}, {
|
|
5
|
-
[evt: string]: CustomEvent<any>;
|
|
6
|
-
}, {}> & {
|
|
7
|
-
$$bindings?: string | undefined;
|
|
1
|
+
type $$ComponentProps = {
|
|
2
|
+
class?: string;
|
|
8
3
|
};
|
|
9
|
-
declare const Loading:
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
[evt: string]: CustomEvent<any>;
|
|
13
|
-
}, {}, {}, string>;
|
|
14
|
-
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
15
|
-
new (options: import("svelte").ComponentConstructorOptions<Props>): import("svelte").SvelteComponent<Props, Events, Slots> & {
|
|
16
|
-
$$bindings?: Bindings;
|
|
17
|
-
} & Exports;
|
|
18
|
-
(internal: unknown, props: {
|
|
19
|
-
$$events?: Events;
|
|
20
|
-
$$slots?: Slots;
|
|
21
|
-
}): Exports & {
|
|
22
|
-
$set?: any;
|
|
23
|
-
$on?: any;
|
|
24
|
-
};
|
|
25
|
-
z_$$bindings?: Bindings;
|
|
26
|
-
}
|
|
4
|
+
declare const Loading: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
5
|
+
type Loading = ReturnType<typeof Loading>;
|
|
6
|
+
export default Loading;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@3birds/midori-ui",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.18",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"dev": "vite dev",
|
|
@@ -25,7 +25,12 @@
|
|
|
25
25
|
}
|
|
26
26
|
},
|
|
27
27
|
"peerDependencies": {
|
|
28
|
-
"svelte": "^5.0.0"
|
|
28
|
+
"svelte": "^5.0.0",
|
|
29
|
+
"@sveltejs/kit": "^2.0.0",
|
|
30
|
+
"firebase": "^12.0.0",
|
|
31
|
+
"daisyui": "^5.7.38",
|
|
32
|
+
"tailwindcss": "^4.3.0",
|
|
33
|
+
"typescript": "^6.0.3"
|
|
29
34
|
},
|
|
30
35
|
"devDependencies": {
|
|
31
36
|
"@eslint/js": "^10.0.1",
|