@3birds/midori-ui 0.0.15 → 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
@@ -1,15 +1,22 @@
1
1
  import { writable } from 'svelte/store';
2
- const initialState = {
2
+ const INITIAL_STATE = {
3
3
  show: false,
4
4
  message: '',
5
5
  type: 'info',
6
6
  duration: 3000
7
7
  };
8
- const { subscribe, set } = writable(initialState);
8
+ let timer;
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(initialState)
21
+ close
15
22
  };
@@ -0,0 +1,7 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
2
+ <title>face-man</title>
3
+ <path
4
+ fill="currentColor"
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
+ />
7
+ </svg>
@@ -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="currentColor"
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>
@@ -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,27 +34,15 @@
34
34
  }
35
35
  });
36
36
 
37
- $effect(() => {
38
- if ($alert.show) {
39
- dialog?.showModal();
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 bind:this={dialog} onclose={handleClose} onclick={alert.close} class="modal">
53
- <div class="fixed top-4 modal-box alert rounded-3xl {color} right-4 left-4" role="alert">
54
- <img src={icon} alt="アラート" class="size-6" />
55
- {$alert.message}
56
- </div>
57
- <form method="dialog" class="modal-backdrop">
58
- <button>close</button>
59
- </form>
60
- </dialog>
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()}
45
+ >
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/dist/index.d.ts CHANGED
@@ -17,6 +17,7 @@ export { default as deleteSvg } from './assets/delete.svg';
17
17
  export { default as emailOutlineSvg } from './assets/email-outline.svg';
18
18
  export { default as faceAgentSvg } from './assets/face-agent.svg';
19
19
  export { default as faceManSvg } from './assets/face-man.svg';
20
+ export { default as faceManWhiteSvg } from './assets/face-man-white.svg';
20
21
  export { default as faviconSvg } from './assets/favicon.svg';
21
22
  export { default as forestOutlineSvg } from './assets/forest-outline.svg';
22
23
  export { default as heartOutlineSvg } from './assets/heart-outline.svg';
package/dist/index.js CHANGED
@@ -18,6 +18,7 @@ export { default as deleteSvg } from './assets/delete.svg';
18
18
  export { default as emailOutlineSvg } from './assets/email-outline.svg';
19
19
  export { default as faceAgentSvg } from './assets/face-agent.svg';
20
20
  export { default as faceManSvg } from './assets/face-man.svg';
21
+ export { default as faceManWhiteSvg } from './assets/face-man-white.svg';
21
22
  export { default as faviconSvg } from './assets/favicon.svg';
22
23
  export { default as forestOutlineSvg } from './assets/forest-outline.svg';
23
24
  export { default as heartOutlineSvg } from './assets/heart-outline.svg';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@3birds/midori-ui",
3
- "version": "0.0.15",
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",