firstly 0.0.12 → 0.0.14

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.
Files changed (120) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/esm/ROUTES.d.ts +2 -0
  3. package/esm/ROUTES.js +1 -0
  4. package/esm/api/index.d.ts +9 -0
  5. package/esm/api/index.js +3 -1
  6. package/esm/auth/AuthController.d.ts +12 -23
  7. package/esm/auth/AuthController.js +12 -31
  8. package/esm/auth/server/AuthController.server.d.ts +11 -11
  9. package/esm/auth/server/AuthController.server.js +99 -34
  10. package/esm/auth/server/handleGuard.d.ts +16 -0
  11. package/esm/auth/server/handleGuard.js +67 -0
  12. package/esm/auth/server/helperFirstly.d.ts +1 -1
  13. package/esm/auth/server/helperFirstly.js +1 -0
  14. package/esm/auth/server/index.d.ts +3 -1
  15. package/esm/auth/server/index.js +3 -1
  16. package/esm/auth/server/module.d.ts +105 -89
  17. package/esm/auth/server/module.js +55 -42
  18. package/esm/auth/server/providers/github.d.ts +4 -2
  19. package/esm/auth/server/providers/github.js +2 -2
  20. package/esm/auth/static/assets/Page-B0XXxe0N.d.ts +6 -0
  21. package/esm/auth/static/assets/Page-B0XXxe0N.js +1 -0
  22. package/esm/auth/static/assets/Page-DdKMiUZn.d.ts +6 -0
  23. package/esm/auth/static/assets/Page-DdKMiUZn.js +20 -0
  24. package/esm/auth/static/assets/Page-UV_hqY7I.d.ts +6 -0
  25. package/esm/auth/static/assets/Page-UV_hqY7I.js +1 -0
  26. package/esm/auth/static/assets/Page-mK42zGEw.css +1 -0
  27. package/esm/auth/static/assets/index-C9jzxOBu.d.ts +151 -0
  28. package/esm/auth/static/assets/index-C9jzxOBu.js +42 -0
  29. package/esm/auth/static/assets/index-DKWpA6v7.css +4 -0
  30. package/esm/auth/static/index.html +11 -11
  31. package/esm/auth/types.d.ts +26 -3
  32. package/esm/bin/cmd.js +423 -152
  33. package/esm/cellsBuildor.js +1 -1
  34. package/esm/common.d.ts +5 -0
  35. package/esm/common.js +8 -0
  36. package/esm/cron/server/index.js +1 -1
  37. package/esm/feedback/FeedbackController.js +58 -53
  38. package/esm/feedback/server/index.d.ts +6 -15
  39. package/esm/feedback/server/index.js +4 -5
  40. package/esm/feedback/types.d.ts +14 -0
  41. package/esm/feedback/types.js +4 -0
  42. package/esm/feedback/ui/DialogIssue.svelte +131 -119
  43. package/esm/feedback/ui/DialogIssue.svelte.d.ts +20 -18
  44. package/esm/feedback/ui/DialogIssues.svelte +108 -99
  45. package/esm/feedback/ui/DialogIssues.svelte.d.ts +20 -18
  46. package/esm/feedback/ui/DialogMilestones.svelte +40 -34
  47. package/esm/feedback/ui/DialogMilestones.svelte.d.ts +18 -16
  48. package/esm/feedback/ui/Feedback.svelte +11 -9
  49. package/esm/feedback/ui/Feedback.svelte.d.ts +16 -14
  50. package/esm/index.d.ts +2 -5
  51. package/esm/index.js +2 -8
  52. package/esm/mail/server/index.d.ts +9 -2
  53. package/esm/mail/server/index.js +3 -1
  54. package/esm/mail/templates/DefaultMail.svelte +81 -61
  55. package/esm/mail/templates/DefaultMail.svelte.d.ts +28 -26
  56. package/esm/server/index.d.ts +0 -0
  57. package/esm/server/index.js +1 -0
  58. package/esm/storeItem.d.ts +1 -4
  59. package/esm/storeItem.js +1 -1
  60. package/esm/storeList.d.ts +1 -4
  61. package/esm/sveltekit/server/index.d.ts +3 -9
  62. package/esm/sveltekit/server/index.js +3 -0
  63. package/esm/ui/Button.svelte +112 -89
  64. package/esm/ui/Button.svelte.d.ts +34 -24
  65. package/esm/ui/Clipboardable.svelte +24 -17
  66. package/esm/ui/Clipboardable.svelte.d.ts +34 -23
  67. package/esm/ui/Field.svelte +328 -285
  68. package/esm/ui/Field.svelte.d.ts +15 -8
  69. package/esm/ui/FieldGroup.svelte +112 -91
  70. package/esm/ui/FieldGroup.svelte.d.ts +17 -6
  71. package/esm/ui/Grid.svelte +322 -308
  72. package/esm/ui/Grid.svelte.d.ts +17 -6
  73. package/esm/ui/GridLoading.svelte +28 -27
  74. package/esm/ui/GridLoading.svelte.d.ts +19 -17
  75. package/esm/ui/GridPaginate.svelte +68 -61
  76. package/esm/ui/GridPaginate.svelte.d.ts +21 -19
  77. package/esm/ui/Icon.svelte +116 -80
  78. package/esm/ui/Icon.svelte.d.ts +52 -43
  79. package/esm/ui/Loading.svelte +10 -8
  80. package/esm/ui/Loading.svelte.d.ts +29 -18
  81. package/esm/ui/Tooltip.svelte +38 -35
  82. package/esm/ui/Tooltip.svelte.d.ts +30 -20
  83. package/esm/ui/dialog/DialogForm.svelte +70 -63
  84. package/esm/ui/dialog/DialogForm.svelte.d.ts +18 -16
  85. package/esm/ui/dialog/DialogManagement.svelte +74 -74
  86. package/esm/ui/dialog/DialogManagement.svelte.d.ts +22 -21
  87. package/esm/ui/dialog/DialogPrimitive.svelte +82 -76
  88. package/esm/ui/dialog/DialogPrimitive.svelte.d.ts +35 -25
  89. package/esm/ui/dialog/FormEditAction.svelte +58 -50
  90. package/esm/ui/dialog/FormEditAction.svelte.d.ts +13 -6
  91. package/esm/ui/dialog/dialog.d.ts +1 -4
  92. package/esm/ui/internals/FieldContainer.svelte +24 -17
  93. package/esm/ui/internals/FieldContainer.svelte.d.ts +37 -28
  94. package/esm/ui/internals/Input.svelte +136 -102
  95. package/esm/ui/internals/Input.svelte.d.ts +34 -32
  96. package/esm/ui/internals/Textarea.svelte +60 -52
  97. package/esm/ui/internals/Textarea.svelte.d.ts +31 -28
  98. package/esm/ui/internals/select/MultiSelectMelt.svelte +243 -199
  99. package/esm/ui/internals/select/MultiSelectMelt.svelte.d.ts +29 -27
  100. package/esm/ui/internals/select/SelectMelt.svelte +254 -219
  101. package/esm/ui/internals/select/SelectMelt.svelte.d.ts +34 -32
  102. package/esm/ui/internals/select/SelectRadio.svelte +39 -33
  103. package/esm/ui/internals/select/SelectRadio.svelte.d.ts +24 -22
  104. package/esm/ui/link/Link.svelte +25 -20
  105. package/esm/ui/link/Link.svelte.d.ts +31 -23
  106. package/esm/ui/link/LinkPlus.svelte +52 -51
  107. package/esm/ui/link/LinkPlus.svelte.d.ts +20 -18
  108. package/esm/vite/index.d.ts +2 -3
  109. package/esm/vite/index.js +33 -26
  110. package/package.json +16 -20
  111. package/esm/auth/static/assets/Page-Bb8bFlrP.d.ts +0 -4
  112. package/esm/auth/static/assets/Page-Bb8bFlrP.js +0 -1
  113. package/esm/auth/static/assets/Page-BxomFlZ8.d.ts +0 -4
  114. package/esm/auth/static/assets/Page-BxomFlZ8.js +0 -1
  115. package/esm/auth/static/assets/Page-CaIYu0-y.d.ts +0 -6
  116. package/esm/auth/static/assets/Page-CaIYu0-y.js +0 -19
  117. package/esm/auth/static/assets/Page-MkYglNtu.css +0 -1
  118. package/esm/auth/static/assets/index-Bl0Bk5u0.d.ts +0 -64
  119. package/esm/auth/static/assets/index-Bl0Bk5u0.js +0 -2
  120. package/esm/auth/static/assets/index-R27C_TlP.css +0 -4
@@ -1,4 +1,3 @@
1
- import { SvelteComponent } from "svelte";
2
1
  import type { EntityOrderBy } from 'remult';
3
2
  import type { Cell } from '../cellsBuildor.js';
4
3
  import { type StoreList } from '../index.js';
@@ -38,10 +37,22 @@ declare class __sveltets_Render<T extends Record<any, any>> {
38
37
  };
39
38
  extra: {};
40
39
  };
40
+ bindings(): string;
41
+ exports(): {};
41
42
  }
42
- export type GridProps<T extends Record<any, any>> = ReturnType<__sveltets_Render<T>['props']>;
43
- export type GridEvents<T extends Record<any, any>> = ReturnType<__sveltets_Render<T>['events']>;
44
- export type GridSlots<T extends Record<any, any>> = ReturnType<__sveltets_Render<T>['slots']>;
45
- export default class Grid<T extends Record<any, any>> extends SvelteComponent<GridProps<T>, GridEvents<T>, GridSlots<T>> {
43
+ interface $$IsomorphicComponent {
44
+ new <T extends Record<any, any>>(options: import('svelte').ComponentConstructorOptions<ReturnType<__sveltets_Render<T>['props']> & {
45
+ children?: any;
46
+ }>): import('svelte').SvelteComponent<ReturnType<__sveltets_Render<T>['props']>, ReturnType<__sveltets_Render<T>['events']>, ReturnType<__sveltets_Render<T>['slots']>> & {
47
+ $$bindings?: ReturnType<__sveltets_Render<T>['bindings']>;
48
+ } & ReturnType<__sveltets_Render<T>['exports']>;
49
+ <T extends Record<any, any>>(internal: unknown, props: ReturnType<__sveltets_Render<T>['props']> & {
50
+ $$events?: ReturnType<__sveltets_Render<T>['events']>;
51
+ $$slots?: ReturnType<__sveltets_Render<T>['slots']>;
52
+ children?: any;
53
+ }): ReturnType<__sveltets_Render<T>['exports']>;
54
+ z_$$bindings?: ReturnType<__sveltets_Render<any>['bindings']>;
46
55
  }
47
- export {};
56
+ declare const Grid: $$IsomorphicComponent;
57
+ type Grid<T extends Record<any, any>> = InstanceType<typeof Grid<T>>;
58
+ export default Grid;
@@ -1,32 +1,33 @@
1
- <script>import { tw } from "../utils/tailwind";
2
- import Loading from "./Loading.svelte";
3
- export let columns;
4
- export let loadingRows = 5;
5
- let size = ["", "w-1/2", "w-1/3", "w-1/4", "w-1/5", "w-1/6"];
1
+ <script lang="ts">
2
+ import { tw } from '../utils/tailwind'
3
+ import type { Align } from './index.js'
4
+ import Loading from './Loading.svelte'
5
+
6
+ export let columns: Align[]
7
+ export let loadingRows = 5
8
+
9
+ // Random with different size
10
+ let size = ['', 'w-1/2', 'w-1/3', 'w-1/4', 'w-1/5', 'w-1/6']
6
11
  </script>
7
12
 
8
13
  <!-- Do 10 rows -->
9
14
  {#each new Array(loadingRows) as _row, r}
10
- <tr>
11
- {#each columns as column, c}
12
- <td class="{column} ">
13
- <div class={tw('flex justify-between', column === 'text-right' && 'flex-row-reverse')}>
14
- {#if column === 'text-center'}
15
- <div></div>
16
- {/if}
17
- <Loading
18
- class={tw(
19
- `h-4`,
20
- size[
21
- parseInt(
22
- (((r + 1) * (c + 1) * Math.random() * size.length) % size.length).toString(),
23
- )
24
- ],
25
- )}
26
- />
27
- <div></div>
28
- </div>
29
- </td>
30
- {/each}
31
- </tr>
15
+ <tr>
16
+ {#each columns as column, c}
17
+ <td class="{column} ">
18
+ <div class={tw('flex justify-between', column === 'text-right' && 'flex-row-reverse')}>
19
+ {#if column === 'text-center'}
20
+ <div></div>
21
+ {/if}
22
+ <Loading
23
+ class={tw(
24
+ `h-4`,
25
+ size[parseInt((((r + 1) * (c + 1) * Math.random() * size.length) % size.length).toString())],
26
+ )}
27
+ />
28
+ <div></div>
29
+ </div>
30
+ </td>
31
+ {/each}
32
+ </tr>
32
33
  {/each}
@@ -1,20 +1,22 @@
1
- import { SvelteComponent } from "svelte";
2
1
  import type { Align } from './index.js';
3
- declare const __propDef: {
4
- props: {
5
- columns: Align[];
6
- loadingRows?: number;
2
+ 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> {
3
+ new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
4
+ $$bindings?: Bindings;
5
+ } & Exports;
6
+ (internal: unknown, props: Props & {
7
+ $$events?: Events;
8
+ $$slots?: Slots;
9
+ }): Exports & {
10
+ $set?: any;
11
+ $on?: any;
7
12
  };
8
- events: {
9
- [evt: string]: CustomEvent<any>;
10
- };
11
- slots: {};
12
- exports?: {} | undefined;
13
- bindings?: string | undefined;
14
- };
15
- export type GridLoadingProps = typeof __propDef.props;
16
- export type GridLoadingEvents = typeof __propDef.events;
17
- export type GridLoadingSlots = typeof __propDef.slots;
18
- export default class GridLoading extends SvelteComponent<GridLoadingProps, GridLoadingEvents, GridLoadingSlots> {
13
+ z_$$bindings?: Bindings;
19
14
  }
20
- export {};
15
+ declare const GridLoading: $$__sveltets_2_IsomorphicComponent<{
16
+ columns: Align[];
17
+ loadingRows?: number;
18
+ }, {
19
+ [evt: string]: CustomEvent<any>;
20
+ }, {}, {}, string>;
21
+ type GridLoading = InstanceType<typeof GridLoading>;
22
+ export default GridLoading;
@@ -1,65 +1,72 @@
1
- <script>import Icon from "./Icon.svelte";
2
- import FieldContainer from "./internals/FieldContainer.svelte";
3
- import "./LibIcon";
4
- import { LibIcon_ChevronLeft, LibIcon_ChevronRight } from "./LibIcon";
5
- import Loading from "./Loading.svelte";
6
- export let label = "Pagination";
7
- export let pageDisplayed;
8
- export let totalCount = void 0;
9
- export let pageSize = 25;
10
- const update = (op) => {
11
- if (op === "+") {
12
- if (canGoNext) {
13
- pageDisplayed = pageDisplayed + 1;
14
- }
15
- } else {
16
- if (pageDisplayed > 1) {
17
- pageDisplayed = pageDisplayed - 1;
18
- }
19
- }
20
- };
21
- $: isValidValue = totalCount !== void 0 && totalCount !== null;
22
- $: needPaginate = isValidValue && (totalCount ?? 0) > pageSize;
23
- $: canGoNext = isValidValue && needPaginate && pageDisplayed < Math.ceil((totalCount ?? 0) / pageSize);
1
+ <script lang="ts">
2
+ import Icon from './Icon.svelte'
3
+ import FieldContainer from './internals/FieldContainer.svelte'
4
+
5
+ import './LibIcon'
6
+
7
+ import { LibIcon_ChevronLeft, LibIcon_ChevronRight } from './LibIcon'
8
+ import Loading from './Loading.svelte'
9
+
10
+ export let label = 'Pagination'
11
+ export let pageDisplayed: number
12
+ export let totalCount: number | undefined | null = undefined
13
+ export let pageSize: number = 25
14
+
15
+ const update = (op: '+' | '-') => {
16
+ if (op === '+') {
17
+ if (canGoNext) {
18
+ pageDisplayed = pageDisplayed + 1
19
+ }
20
+ } else {
21
+ if (pageDisplayed > 1) {
22
+ pageDisplayed = pageDisplayed - 1
23
+ }
24
+ }
25
+ }
26
+
27
+ $: isValidValue = totalCount !== undefined && totalCount !== null
28
+ $: needPaginate = isValidValue && (totalCount ?? 0) > pageSize
29
+ $: canGoNext =
30
+ isValidValue && needPaginate && pageDisplayed < Math.ceil((totalCount ?? 0) / pageSize)
24
31
  </script>
25
32
 
26
33
  <FieldContainer {label} forId="paginate" classes={{ label: 'justify-end' }}>
27
- <div class="flex w-36 items-center justify-end">
28
- {#if totalCount === undefined}
29
- <Loading class="ml-6 mr-2 h-3 w-1/6"></Loading>
30
- <Loading class="mx-2 h-4 w-1/2"></Loading>
31
- <Loading class="mx-2 h-3 w-1/6"></Loading>
32
- {:else if !needPaginate}
33
- <span class="text-primary justify-end px-2 font-bold">
34
- {totalCount}
35
- </span>
36
- {:else}
37
- <div class="join">
38
- <button
39
- aria-label="left"
40
- on:click={() => update('-')}
41
- class="btn join-item p-1 {pageDisplayed === 1 ? 'btn-disabled' : ''}"
42
- >
43
- <Icon data={LibIcon_ChevronLeft} />
44
- </button>
45
- {#if isValidValue}
46
- <button aria-label="current" class="btn join-item px-0">
47
- <span class="text-primary font-bold">{totalCount}</span>
48
- <span class="text-[0.55rem] italic"
49
- >({pageDisplayed} / {Math.ceil((totalCount ?? 0) / pageSize)})</span
50
- >
51
- </button>
52
- {:else}
53
- <button aria-label="loading" class="btn join-item animate-pulse">.....</button>
54
- {/if}
55
- <button
56
- aria-label="right"
57
- on:click={() => update('+')}
58
- class="btn join-item p-1 {!canGoNext ? 'btn-disabled' : ''}"
59
- >
60
- <Icon data={LibIcon_ChevronRight} />
61
- </button>
62
- </div>
63
- {/if}
64
- </div>
34
+ <div class="flex w-36 items-center justify-end">
35
+ {#if totalCount === undefined}
36
+ <Loading class="ml-6 mr-2 h-3 w-1/6"></Loading>
37
+ <Loading class="mx-2 h-4 w-1/2"></Loading>
38
+ <Loading class="mx-2 h-3 w-1/6"></Loading>
39
+ {:else if !needPaginate}
40
+ <span class="text-primary justify-end px-2 font-bold">
41
+ {totalCount}
42
+ </span>
43
+ {:else}
44
+ <div class="join">
45
+ <button
46
+ aria-label="left"
47
+ on:click={() => update('-')}
48
+ class="btn join-item p-1 {pageDisplayed === 1 ? 'btn-disabled' : ''}"
49
+ >
50
+ <Icon data={LibIcon_ChevronLeft} />
51
+ </button>
52
+ {#if isValidValue}
53
+ <button aria-label="current" class="btn join-item px-0">
54
+ <span class="text-primary font-bold">{totalCount}</span>
55
+ <span class="text-[0.55rem] italic"
56
+ >({pageDisplayed} / {Math.ceil((totalCount ?? 0) / pageSize)})</span
57
+ >
58
+ </button>
59
+ {:else}
60
+ <button aria-label="loading" class="btn join-item animate-pulse">.....</button>
61
+ {/if}
62
+ <button
63
+ aria-label="right"
64
+ on:click={() => update('+')}
65
+ class="btn join-item p-1 {!canGoNext ? 'btn-disabled' : ''}"
66
+ >
67
+ <Icon data={LibIcon_ChevronRight} />
68
+ </button>
69
+ </div>
70
+ {/if}
71
+ </div>
65
72
  </FieldContainer>
@@ -1,22 +1,24 @@
1
- import { SvelteComponent } from "svelte";
2
1
  import './LibIcon';
3
- declare const __propDef: {
4
- props: {
5
- label?: string;
6
- pageDisplayed: number;
7
- totalCount?: number | undefined | null;
8
- pageSize?: number;
2
+ 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> {
3
+ new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
4
+ $$bindings?: Bindings;
5
+ } & Exports;
6
+ (internal: unknown, props: Props & {
7
+ $$events?: Events;
8
+ $$slots?: Slots;
9
+ }): Exports & {
10
+ $set?: any;
11
+ $on?: any;
9
12
  };
10
- events: {
11
- [evt: string]: CustomEvent<any>;
12
- };
13
- slots: {};
14
- exports?: {} | undefined;
15
- bindings?: string | undefined;
16
- };
17
- export type GridPaginateProps = typeof __propDef.props;
18
- export type GridPaginateEvents = typeof __propDef.events;
19
- export type GridPaginateSlots = typeof __propDef.slots;
20
- export default class GridPaginate extends SvelteComponent<GridPaginateProps, GridPaginateEvents, GridPaginateSlots> {
13
+ z_$$bindings?: Bindings;
21
14
  }
22
- export {};
15
+ declare const GridPaginate: $$__sveltets_2_IsomorphicComponent<{
16
+ label?: string;
17
+ pageDisplayed: number;
18
+ totalCount?: number | undefined | null;
19
+ pageSize?: number;
20
+ }, {
21
+ [evt: string]: CustomEvent<any>;
22
+ }, {}, {}, string>;
23
+ type GridPaginate = InstanceType<typeof GridPaginate>;
24
+ export default GridPaginate;
@@ -1,85 +1,121 @@
1
- <script>import { BROWSER } from "esm-env";
2
- import "./LibIcon";
3
- import { LibIcon_Empty } from "./LibIcon";
4
- export let data = "";
5
- export let size = "1.5rem";
6
- export let caption = void 0;
7
- const rmvWarning = caption;
8
- export let ssr = false;
9
- let className = "";
10
- export { className as class };
11
- export let style = "";
12
- let width = size;
13
- let height = size;
14
- let viewBox = "0 0 24 24";
15
- let svg = "";
16
- let path = "";
17
- $: if (typeof data === "string") {
18
- if (data.toLowerCase().includes("<svg")) {
19
- svg = data.replace(/width="[^"]*"/, `width="${width}"`).replace(/height="[^"]*"/, `height="${height}"`);
20
- } else {
21
- path = data;
22
- }
23
- } else {
24
- path = data;
25
- }
26
- const getInfoProps = (props, i = 0) => {
27
- if (Array.isArray(props)) {
28
- return props[i] ?? "";
29
- }
30
- return props ?? "";
31
- };
1
+ <script lang="ts">
2
+ import { BROWSER } from 'esm-env'
3
+
4
+ import './LibIcon'
5
+
6
+ import { LibIcon_Empty } from './LibIcon'
7
+
8
+ /**
9
+ * directly <svg ... /> or d of <path ... />
10
+ *
11
+ * with \@mdi/js
12
+ * ```js
13
+ * import { mdiAccountTieWoman } from "@mdi/js";
14
+ * <Icon data={mdiAccountTieWoman} style="background-color: blue;" size={"4rem"}></Icon>
15
+ * ```
16
+ *
17
+ * with \@iconify-json/mdi && unplugin-icons with Icons({ compiler: "raw" })
18
+ * ```js
19
+ * import Woman from "virtual:icons/mdi/account-tie-woman";
20
+ * <Icon data={mdiAccountTieWoman} style="background-color: blue;" size={"4rem"}></Icon>
21
+ * ```
22
+ */
23
+ export let data: string | string[] = ''
24
+
25
+ export let size: string | number = '1.5rem'
26
+
27
+ export let caption: string | undefined = undefined
28
+ const rmvWarning = caption
29
+
30
+ /**
31
+ * By default, svg are not rendered on the server side.
32
+ * But the size will be respected to not have glitch on the client side when the icon is coming.
33
+ * @default false
34
+ */
35
+ export let ssr = false
36
+
37
+ let className: string | string[] | undefined = ''
38
+ export { className as class }
39
+ export let style: string | string[] | undefined = ''
40
+
41
+ let width = size
42
+ let height = size
43
+ let viewBox = '0 0 24 24'
44
+
45
+ let svg = ''
46
+ let path: string | string[] = ''
47
+
48
+ $: if (typeof data === 'string') {
49
+ if (data.toLowerCase().includes('<svg')) {
50
+ svg = data
51
+ .replace(/width="[^"]*"/, `width="${width}"`)
52
+ .replace(/height="[^"]*"/, `height="${height}"`)
53
+ } else {
54
+ path = data
55
+ }
56
+ } else {
57
+ path = data
58
+ }
59
+
60
+ const getInfoProps = (props: string | string[] | undefined, i: number = 0) => {
61
+ if (Array.isArray(props)) {
62
+ return props[i] ?? ''
63
+ }
64
+ return props ?? ''
65
+ }
66
+
67
+ const role = 'img'
32
68
  </script>
33
69
 
34
70
  {#if BROWSER || ssr}
35
- {#if svg || $$slots.default}
36
- <span
37
- class={getInfoProps(className)}
38
- style={getInfoProps(style)}
39
- style:width
40
- style:height
41
- role={'img'}
42
- on:click
43
- >
44
- <slot>
45
- {@html svg ?? ''}
46
- </slot>
47
- </span>
48
- {:else}
49
- <svg
50
- {width}
51
- {height}
52
- {viewBox}
53
- class={getInfoProps(className)}
54
- style={getInfoProps(style)}
55
- role={'img'}
56
- on:click
57
- >
58
- {#each Array.isArray(path) ? path : [path] as d, i}
59
- <path
60
- {d}
61
- fill="currentColor"
62
- class={getInfoProps(className, i)}
63
- style={getInfoProps(style, i)}
64
- />
65
- {/each}
66
- </svg>
67
- {/if}
71
+ {#if svg || $$slots.default}
72
+ <span
73
+ class={getInfoProps(className)}
74
+ style={getInfoProps(style)}
75
+ style:width
76
+ style:height
77
+ {role}
78
+ on:click
79
+ >
80
+ <slot>
81
+ {@html svg ?? ''}
82
+ </slot>
83
+ </span>
84
+ {:else}
85
+ <svg
86
+ {width}
87
+ {height}
88
+ {viewBox}
89
+ class={getInfoProps(className)}
90
+ style={getInfoProps(style)}
91
+ {role}
92
+ on:click
93
+ >
94
+ {#each Array.isArray(path) ? path : [path] as d, i}
95
+ <path
96
+ {d}
97
+ fill="currentColor"
98
+ class={getInfoProps(className, i)}
99
+ style={getInfoProps(style, i)}
100
+ />
101
+ {/each}
102
+ </svg>
103
+ {/if}
68
104
  {:else}
69
- <svg
70
- {width}
71
- {height}
72
- {viewBox}
73
- class={getInfoProps(className)}
74
- style={getInfoProps(style)}
75
- role={'img'}
76
- on:click
77
- >
78
- <path
79
- d={LibIcon_Empty}
80
- fill="currentColor"
81
- class={getInfoProps(className)}
82
- style={getInfoProps(style)}
83
- />
84
- </svg>
105
+ <svg
106
+ {width}
107
+ {height}
108
+ {viewBox}
109
+ class={getInfoProps(className)}
110
+ style={getInfoProps(style)}
111
+ {role}
112
+ on:click
113
+ >
114
+ <path
115
+ d={LibIcon_Empty}
116
+ fill="currentColor"
117
+ class={getInfoProps(className)}
118
+ style={getInfoProps(style)}
119
+ />
120
+ </svg>
85
121
  {/if}
@@ -1,46 +1,55 @@
1
- import { SvelteComponent } from "svelte";
2
1
  import './LibIcon';
3
- declare const __propDef: {
4
- props: {
5
- /**
6
- * directly <svg ... /> or d of <path ... />
7
- *
8
- * with \@mdi/js
9
- * ```js
10
- * import { mdiAccountTieWoman } from "@mdi/js";
11
- * <Icon data={mdiAccountTieWoman} style="background-color: blue;" size={"4rem"}></Icon>
12
- * ```
13
- *
14
- * with \@iconify-json/mdi && unplugin-icons with Icons({ compiler: "raw" })
15
- * ```js
16
- * import Woman from "virtual:icons/mdi/account-tie-woman";
17
- * <Icon data={mdiAccountTieWoman} style="background-color: blue;" size={"4rem"}></Icon>
18
- * ```
19
- */ data?: string | string[];
20
- size?: string | number;
21
- caption?: string | undefined;
22
- /**
23
- * By default, svg are not rendered on the server side.
24
- * But the size will be respected to not have glitch on the client side when the icon is coming.
25
- * @default false
26
- */ ssr?: boolean;
27
- class?: string | string[] | undefined;
28
- style?: string | string[] | undefined;
2
+ 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> {
3
+ new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
4
+ $$bindings?: Bindings;
5
+ } & Exports;
6
+ (internal: unknown, props: Props & {
7
+ $$events?: Events;
8
+ $$slots?: Slots;
9
+ }): Exports & {
10
+ $set?: any;
11
+ $on?: any;
29
12
  };
30
- events: {
31
- click: MouseEvent;
32
- } & {
33
- [evt: string]: CustomEvent<any>;
34
- };
35
- slots: {
36
- default: {};
37
- };
38
- exports?: {} | undefined;
39
- bindings?: string | undefined;
40
- };
41
- export type IconProps = typeof __propDef.props;
42
- export type IconEvents = typeof __propDef.events;
43
- export type IconSlots = typeof __propDef.slots;
44
- export default class Icon extends SvelteComponent<IconProps, IconEvents, IconSlots> {
13
+ z_$$bindings?: Bindings;
45
14
  }
46
- export {};
15
+ type $$__sveltets_2_PropsWithChildren<Props, Slots> = Props & (Slots extends {
16
+ default: any;
17
+ } ? Props extends Record<string, never> ? any : {
18
+ children?: any;
19
+ } : {});
20
+ declare const Icon: $$__sveltets_2_IsomorphicComponent<$$__sveltets_2_PropsWithChildren<{
21
+ /**
22
+ * directly <svg ... /> or d of <path ... />
23
+ *
24
+ * with \@mdi/js
25
+ * ```js
26
+ * import { mdiAccountTieWoman } from "@mdi/js";
27
+ * <Icon data={mdiAccountTieWoman} style="background-color: blue;" size={"4rem"}></Icon>
28
+ * ```
29
+ *
30
+ * with \@iconify-json/mdi && unplugin-icons with Icons({ compiler: "raw" })
31
+ * ```js
32
+ * import Woman from "virtual:icons/mdi/account-tie-woman";
33
+ * <Icon data={mdiAccountTieWoman} style="background-color: blue;" size={"4rem"}></Icon>
34
+ * ```
35
+ */ data?: string | string[];
36
+ size?: string | number;
37
+ caption?: string | undefined;
38
+ /**
39
+ * By default, svg are not rendered on the server side.
40
+ * But the size will be respected to not have glitch on the client side when the icon is coming.
41
+ * @default false
42
+ */ ssr?: boolean;
43
+ class?: string | string[] | undefined;
44
+ style?: string | string[] | undefined;
45
+ }, {
46
+ default: {};
47
+ }>, {
48
+ click: MouseEvent;
49
+ } & {
50
+ [evt: string]: CustomEvent<any>;
51
+ }, {
52
+ default: {};
53
+ }, {}, string>;
54
+ type Icon = InstanceType<typeof Icon>;
55
+ export default Icon;
@@ -1,14 +1,16 @@
1
- <script>import { tw } from "../utils/tailwind";
2
- export { extraClass as class };
3
- let extraClass = "";
1
+ <script lang="ts">
2
+ import { tw } from '../utils/tailwind'
3
+
4
+ export { extraClass as class }
5
+ let extraClass = ''
4
6
  </script>
5
7
 
6
8
  <!-- To fix one capa & cadb are on the same css -->
7
9
  <div
8
- class={tw(
9
- 'skeleton bg-base-content/20 flex h-4 w-full items-center justify-center rounded-lg',
10
- extraClass,
11
- )}
10
+ class={tw(
11
+ 'skeleton bg-base-content/20 flex h-4 w-full items-center justify-center rounded-lg',
12
+ extraClass,
13
+ )}
12
14
  >
13
- <slot />
15
+ <slot />
14
16
  </div>