@3birds/midori-ui 0.0.16 → 0.0.17

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 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: () => void;
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: () => set(INITIAL_STATE)
21
+ close
15
22
  };
@@ -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 dialog: HTMLDialogElement | undefined;
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
- <dialog
53
- bind:this={dialog}
54
- onclose={handleClose}
55
- onclick={alert.close}
56
- class="modal h-0 w-0 bg-transparent"
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
- <div class="fixed top-4 modal-box alert rounded-3xl {color} right-4 left-4" role="alert">
59
- <img src={icon} alt="アラート" class="size-6" />
60
- {$alert.message}
61
- </div>
62
- </dialog>
46
+ <img src={icon} alt="アラート" class="size-6" />
47
+ {$alert.message}
48
+ </button>
@@ -1 +1,9 @@
1
- <span class="loading loading-spinner"></span>
1
+ <script lang="ts">
2
+ let {
3
+ class: className
4
+ }: {
5
+ class?: string;
6
+ } = $props();
7
+ </script>
8
+
9
+ <span class="loading loading-spinner {className}"></span>
@@ -1,26 +1,6 @@
1
- export default Loading;
2
- type Loading = SvelteComponent<{
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: $$__sveltets_2_IsomorphicComponent<{
10
- [x: string]: never;
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.16",
3
+ "version": "0.0.17",
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",