fuma 1.0.20 → 2.0.0

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 (195) hide show
  1. package/README.md +1 -1
  2. package/dist/action/list/handlers.d.ts +2 -2
  3. package/dist/action/list/index.d.ts +2 -0
  4. package/dist/action/list/index.js +1 -0
  5. package/dist/action/list/trigger.d.ts +7 -1
  6. package/dist/action/list/trigger.js +2 -2
  7. package/dist/private/Meta.svelte +32 -27
  8. package/dist/private/Meta.svelte.d.ts +29 -17
  9. package/dist/private/api.d.ts +1 -1
  10. package/dist/private/store.d.ts +0 -1
  11. package/dist/server/parseFormData.d.ts +1 -1
  12. package/dist/server/parseQuery.d.ts +1 -1
  13. package/dist/server/sse.d.ts +0 -1
  14. package/dist/store/isSmallScreen.d.ts +0 -1
  15. package/dist/store/param.d.ts +0 -2
  16. package/dist/store/session.d.ts +0 -1
  17. package/dist/ui/badge/Badge.svelte +4 -3
  18. package/dist/ui/badge/Badge.svelte.d.ts +19 -15
  19. package/dist/ui/button/ButtonCopy.svelte +35 -32
  20. package/dist/ui/button/ButtonCopy.svelte.d.ts +23 -21
  21. package/dist/ui/button/ButtonDelete.svelte +23 -21
  22. package/dist/ui/button/ButtonDelete.svelte.d.ts +32 -20
  23. package/dist/ui/card/Card.svelte +13 -10
  24. package/dist/ui/card/Card.svelte.d.ts +39 -24
  25. package/dist/ui/card/CardBasic.svelte +5 -4
  26. package/dist/ui/card/CardBasic.svelte.d.ts +29 -18
  27. package/dist/ui/card/CardCollapse.svelte +35 -31
  28. package/dist/ui/card/CardCollapse.svelte.d.ts +37 -23
  29. package/dist/ui/card/CardFullScreen.svelte +8 -6
  30. package/dist/ui/card/CardFullScreen.svelte.d.ts +35 -20
  31. package/dist/ui/card/CardLink.svelte +5 -4
  32. package/dist/ui/card/CardLink.svelte.d.ts +29 -18
  33. package/dist/ui/dialog/Dialog.svelte +41 -34
  34. package/dist/ui/dialog/Dialog.svelte.d.ts +36 -23
  35. package/dist/ui/dialog/DialogConfirm.svelte +6 -4
  36. package/dist/ui/dialog/DialogConfirm.svelte.d.ts +33 -19
  37. package/dist/ui/drawer/Drawer.svelte +47 -38
  38. package/dist/ui/drawer/Drawer.svelte.d.ts +81 -46
  39. package/dist/ui/drawer/drawerFly.d.ts +0 -1
  40. package/dist/ui/drawer/layers.d.ts +0 -1
  41. package/dist/ui/form/Form.svelte +106 -87
  42. package/dist/ui/form/Form.svelte.d.ts +29 -16
  43. package/dist/ui/form/FormInput.svelte +12 -6
  44. package/dist/ui/form/FormSection.svelte +24 -17
  45. package/dist/ui/form/FormSection.svelte.d.ts +37 -25
  46. package/dist/ui/icon/Icon.svelte +35 -32
  47. package/dist/ui/icon/Icon.svelte.d.ts +25 -21
  48. package/dist/ui/index.d.ts +0 -1
  49. package/dist/ui/index.js +0 -1
  50. package/dist/ui/input/FormControl.svelte +48 -36
  51. package/dist/ui/input/FormControl.svelte.d.ts +32 -30
  52. package/dist/ui/input/InputBoolean.svelte +29 -22
  53. package/dist/ui/input/InputBoolean.svelte.d.ts +43 -35
  54. package/dist/ui/input/InputCheckboxs.svelte +37 -34
  55. package/dist/ui/input/InputCheckboxs.svelte.d.ts +54 -39
  56. package/dist/ui/input/InputCheckboxsMenu.svelte +64 -47
  57. package/dist/ui/input/InputCheckboxsMenu.svelte.d.ts +56 -41
  58. package/dist/ui/input/InputCheckboxsTree.svelte +9 -6
  59. package/dist/ui/input/InputCheckboxsTree.svelte.d.ts +22 -18
  60. package/dist/ui/input/InputCheckboxsTreeNodes.svelte +36 -28
  61. package/dist/ui/input/InputCheckboxsTreeNodes.svelte.d.ts +20 -16
  62. package/dist/ui/input/InputCombo.svelte +76 -65
  63. package/dist/ui/input/InputCombo.svelte.d.ts +55 -39
  64. package/dist/ui/input/InputDate.svelte +36 -29
  65. package/dist/ui/input/InputDate.svelte.d.ts +20 -16
  66. package/dist/ui/input/InputDateTime.svelte +37 -30
  67. package/dist/ui/input/InputDateTime.svelte.d.ts +20 -16
  68. package/dist/ui/input/InputImage.svelte +52 -45
  69. package/dist/ui/input/InputImage.svelte.d.ts +40 -27
  70. package/dist/ui/input/InputImagePreview.svelte +24 -20
  71. package/dist/ui/input/InputImagePreview.svelte.d.ts +25 -21
  72. package/dist/ui/input/InputNumber.svelte +28 -22
  73. package/dist/ui/input/InputNumber.svelte.d.ts +20 -20
  74. package/dist/ui/input/InputOptionInParam.svelte +12 -10
  75. package/dist/ui/input/InputOptionInParam.svelte.d.ts +21 -17
  76. package/dist/ui/input/InputOptions.svelte +40 -34
  77. package/dist/ui/input/InputOptions.svelte.d.ts +19 -15
  78. package/dist/ui/input/InputPassword.svelte +22 -18
  79. package/dist/ui/input/InputPassword.svelte.d.ts +43 -35
  80. package/dist/ui/input/InputRadio.svelte +51 -46
  81. package/dist/ui/input/InputRadio.svelte.d.ts +53 -38
  82. package/dist/ui/input/InputRelation.svelte +129 -112
  83. package/dist/ui/input/InputRelation.svelte.d.ts +39 -53
  84. package/dist/ui/input/InputRelations.svelte +96 -90
  85. package/dist/ui/input/InputRelations.svelte.d.ts +35 -37
  86. package/dist/ui/input/InputSearch.svelte +14 -11
  87. package/dist/ui/input/InputSearch.svelte.d.ts +25 -21
  88. package/dist/ui/input/InputSelect.svelte +59 -46
  89. package/dist/ui/input/InputSelect.svelte.d.ts +23 -19
  90. package/dist/ui/input/InputText.svelte +29 -28
  91. package/dist/ui/input/InputText.svelte.d.ts +41 -28
  92. package/dist/ui/input/InputTextarea.svelte +20 -19
  93. package/dist/ui/input/InputTextarea.svelte.d.ts +20 -20
  94. package/dist/ui/input/InputTime.svelte +43 -36
  95. package/dist/ui/input/InputTime.svelte.d.ts +21 -36
  96. package/dist/ui/input/RelationAfter.svelte +13 -9
  97. package/dist/ui/input/RelationAfter.svelte.d.ts +24 -20
  98. package/dist/ui/input/SelectorList.svelte +16 -12
  99. package/dist/ui/input/SelectorList.svelte.d.ts +29 -20
  100. package/dist/ui/input/textRich/InputTextRich.svelte +63 -59
  101. package/dist/ui/input/textRich/InputTextRich.svelte.d.ts +36 -38
  102. package/dist/ui/input/textRich/SuggesionList.svelte +13 -9
  103. package/dist/ui/input/textRich/SuggesionList.svelte.d.ts +19 -15
  104. package/dist/ui/input/textRich/ToolMark.svelte +12 -9
  105. package/dist/ui/input/textRich/ToolMark.svelte.d.ts +22 -18
  106. package/dist/ui/input/textRich/ToolMarkColor.svelte +16 -12
  107. package/dist/ui/input/textRich/ToolMarkColor.svelte.d.ts +21 -17
  108. package/dist/ui/input/textRich/ToolMarkLink.svelte +46 -38
  109. package/dist/ui/input/textRich/ToolMarkLink.svelte.d.ts +18 -14
  110. package/dist/ui/input/textRich/ToolMenu.svelte +34 -19
  111. package/dist/ui/input/textRich/ToolMenu.svelte.d.ts +30 -26
  112. package/dist/ui/input/textRich/ToolMenuAlign.svelte +13 -9
  113. package/dist/ui/input/textRich/ToolMenuAlign.svelte.d.ts +18 -14
  114. package/dist/ui/input/textRich/ToolMenuInsert.svelte +12 -7
  115. package/dist/ui/input/textRich/ToolMenuInsert.svelte.d.ts +20 -16
  116. package/dist/ui/input/textRich/ToolMenuNode.svelte +14 -10
  117. package/dist/ui/input/textRich/ToolMenuNode.svelte.d.ts +18 -14
  118. package/dist/ui/input/textRich/ToolsBar.svelte +21 -14
  119. package/dist/ui/input/textRich/ToolsBar.svelte.d.ts +19 -17
  120. package/dist/ui/input/textRich/suggestion.d.ts +0 -1
  121. package/dist/ui/login/Login.svelte +37 -31
  122. package/dist/ui/login/Login.svelte.d.ts +18 -14
  123. package/dist/ui/menu/ContextMenu.svelte +37 -31
  124. package/dist/ui/menu/ContextMenu.svelte.d.ts +38 -25
  125. package/dist/ui/menu/DropDown.svelte +92 -83
  126. package/dist/ui/menu/DropDown.svelte.d.ts +46 -33
  127. package/dist/ui/menu/DropDownMenu.svelte +25 -18
  128. package/dist/ui/menu/DropDownMenu.svelte.d.ts +30 -19
  129. package/dist/ui/mode/ToggleMode.svelte +28 -16
  130. package/dist/ui/mode/ToggleMode.svelte.d.ts +34 -17
  131. package/dist/ui/pagination/Pagination.svelte +9 -8
  132. package/dist/ui/pagination/Pagination.svelte.d.ts +18 -14
  133. package/dist/ui/placeholder/Placeholder.svelte +4 -3
  134. package/dist/ui/placeholder/Placeholder.svelte.d.ts +28 -17
  135. package/dist/ui/placeholder/PlaceholderImage.svelte +6 -4
  136. package/dist/ui/placeholder/PlaceholderImage.svelte.d.ts +28 -17
  137. package/dist/ui/range/RangePicker.svelte +76 -63
  138. package/dist/ui/range/RangePicker.svelte.d.ts +29 -24
  139. package/dist/ui/range/RangePickerButton.svelte +43 -35
  140. package/dist/ui/range/RangePickerButton.svelte.d.ts +21 -17
  141. package/dist/ui/table/Table.svelte +35 -28
  142. package/dist/ui/table/Table.svelte.d.ts +24 -19
  143. package/dist/ui/table/TableBody.svelte +18 -12
  144. package/dist/ui/table/TableBody.svelte.d.ts +20 -15
  145. package/dist/ui/table/TableCell.svelte +13 -10
  146. package/dist/ui/table/TableCell.svelte.d.ts +19 -14
  147. package/dist/ui/table/TableFieldsEdition.svelte +58 -52
  148. package/dist/ui/table/TableFieldsEdition.svelte.d.ts +20 -15
  149. package/dist/ui/table/TableHead.svelte +20 -21
  150. package/dist/ui/table/TableHead.svelte.d.ts +19 -14
  151. package/dist/ui/table/TableViewSelect.svelte +50 -37
  152. package/dist/ui/table/TableViewSelect.svelte.d.ts +27 -23
  153. package/dist/ui/table/cell/TableCellArray.svelte +5 -3
  154. package/dist/ui/table/cell/TableCellArray.svelte.d.ts +18 -14
  155. package/dist/ui/table/cell/TableCellBoolean.svelte +4 -3
  156. package/dist/ui/table/cell/TableCellBoolean.svelte.d.ts +18 -14
  157. package/dist/ui/table/cell/TableCellNumber.svelte +2 -1
  158. package/dist/ui/table/cell/TableCellNumber.svelte.d.ts +18 -14
  159. package/dist/ui/table/cell/TableCellString.svelte +5 -2
  160. package/dist/ui/table/cell/TableCellString.svelte.d.ts +19 -25
  161. package/dist/ui/table/field.d.ts +32 -40
  162. package/dist/ui/table/field.js +1 -1
  163. package/dist/ui/table/head/TableHeadBoolean.svelte +6 -3
  164. package/dist/ui/table/head/TableHeadBoolean.svelte.d.ts +18 -24
  165. package/dist/ui/table/head/TableHeadDate.svelte +61 -113
  166. package/dist/ui/table/head/TableHeadDate.svelte.d.ts +18 -24
  167. package/dist/ui/table/head/TableHeadDefault.svelte +5 -2
  168. package/dist/ui/table/head/TableHeadDefault.svelte.d.ts +18 -24
  169. package/dist/ui/table/head/TableHeadNumber.svelte +67 -76
  170. package/dist/ui/table/head/TableHeadNumber.svelte.d.ts +18 -24
  171. package/dist/ui/table/head/TableHeadSelect.svelte +47 -41
  172. package/dist/ui/table/head/TableHeadSelect.svelte.d.ts +21 -27
  173. package/dist/ui/table/head/TableHeadString.svelte +14 -8
  174. package/dist/ui/table/head/TableHeadString.svelte.d.ts +18 -24
  175. package/dist/ui/tabs/Tabs.svelte +8 -5
  176. package/dist/ui/tabs/Tabs.svelte.d.ts +19 -15
  177. package/dist/ui/tabs/TabsIcon.svelte +31 -28
  178. package/dist/ui/tabs/TabsIcon.svelte.d.ts +21 -17
  179. package/dist/utils/eventEmitter.d.ts +4 -4
  180. package/dist/utils/tippy.d.ts +1 -1
  181. package/dist/validation/form.d.ts +0 -1
  182. package/dist/validation/zod.d.ts +96 -162
  183. package/dist/validation/zod.js +2 -4
  184. package/package.json +134 -138
  185. package/dist/ui/form/FormInput.svelte.d.ts +0 -152
  186. package/dist/ui/form/formInput.d.ts +0 -90
  187. package/dist/ui/slot/Slot.svelte +0 -35
  188. package/dist/ui/slot/Slot.svelte.d.ts +0 -22
  189. package/dist/ui/slot/Span.svelte +0 -4
  190. package/dist/ui/slot/Span.svelte.d.ts +0 -16
  191. package/dist/ui/slot/index.d.ts +0 -1
  192. package/dist/ui/slot/index.js +0 -1
  193. package/dist/ui/table/head/OrderButtons.svelte +0 -37
  194. package/dist/ui/table/head/OrderButtons.svelte.d.ts +0 -20
  195. package/dist/ui/table/head/index.d.ts +0 -19
@@ -1,33 +1,40 @@
1
- <script>import { createEventDispatcher } from "svelte";
2
- import dayjs from "dayjs";
3
- import { FormControl } from "./index.js";
4
- import { USE_COERCE_DATE } from "../../utils/constant.js";
5
- export let value = void 0;
6
- export let input = {};
7
- $:
8
- ({ class: inputClass = "", ...inputProps } = input);
9
- const dispatch = createEventDispatcher();
10
- const handleInput = ({ currentTarget }) => {
11
- const newValue = currentTarget.valueAsDate;
12
- if (newValue === null)
13
- value = null;
14
- newValue?.setHours(value?.getHours() || 0, value?.getMinutes() || 0, value?.getSeconds() || 0);
15
- value = newValue;
16
- dispatch("input", value);
17
- };
1
+ <script lang="ts">
2
+ import { createEventDispatcher } from 'svelte'
3
+ import type { FormEventHandler, HTMLInputAttributes } from 'svelte/elements'
4
+ import dayjs from 'dayjs'
5
+
6
+ import { FormControl, type InputProps } from './index.js'
7
+ import { USE_COERCE_DATE } from '../../utils/constant.js'
8
+
9
+ type $$Props = InputProps<Date | null | undefined>
10
+ export let value: Date | null | undefined = undefined
11
+ export let input: HTMLInputAttributes = {}
12
+ $: ({ class: inputClass = '', ...inputProps } = input)
13
+
14
+ const dispatch = createEventDispatcher<{ input: Date | null }>()
15
+
16
+ const handleInput: FormEventHandler<HTMLInputElement> = ({ currentTarget }) => {
17
+ const newValue = currentTarget.valueAsDate
18
+ if (newValue === null) value = null
19
+ newValue?.setHours(value?.getHours() || 0, value?.getMinutes() || 0, value?.getSeconds() || 0)
20
+ value = newValue
21
+ dispatch('input', value)
22
+ }
18
23
  </script>
19
24
 
20
- <FormControl {...$$restProps} let:key>
21
- <input
22
- value={value && dayjs(value).format('YYYY-MM-DD')}
23
- on:input={handleInput}
24
- on:focus
25
- on:blur
26
- type="date"
27
- id={key}
28
- class="input input-bordered {inputClass}"
29
- {...inputProps}
30
- />
25
+ <FormControl {...$$restProps}>
26
+ {#snippet children({ key })}
27
+ <input
28
+ value={value && dayjs(value).format('YYYY-MM-DD')}
29
+ on:input={handleInput}
30
+ on:focus
31
+ on:blur
32
+ type="date"
33
+ id={key}
34
+ class="input input-bordered {inputClass}"
35
+ {...inputProps}
36
+ />
31
37
 
32
- <input type="hidden" name={key} value="{USE_COERCE_DATE}{value?.toJSON()}" />
38
+ <input type="hidden" name={key} value="{USE_COERCE_DATE}{value?.toJSON()}" />
39
+ {/snippet}
33
40
  </FormControl>
@@ -1,19 +1,23 @@
1
- import { SvelteComponent } from "svelte";
2
1
  import { type InputProps } from './index.js';
3
- declare const __propDef: {
4
- props: InputProps<Date | null | undefined>;
5
- events: {
6
- focus: FocusEvent;
7
- blur: FocusEvent;
8
- input: CustomEvent<Date | null>;
9
- } & {
10
- [evt: string]: CustomEvent<any>;
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;
11
12
  };
12
- slots: {};
13
- };
14
- export type InputDateProps = typeof __propDef.props;
15
- export type InputDateEvents = typeof __propDef.events;
16
- export type InputDateSlots = typeof __propDef.slots;
17
- export default class InputDate extends SvelteComponent<InputDateProps, InputDateEvents, InputDateSlots> {
13
+ z_$$bindings?: Bindings;
18
14
  }
19
- export {};
15
+ declare const InputDate: $$__sveltets_2_IsomorphicComponent<InputProps<Date | null | undefined>, {
16
+ focus: FocusEvent;
17
+ blur: FocusEvent;
18
+ input: CustomEvent<Date | null>;
19
+ } & {
20
+ [evt: string]: CustomEvent<any>;
21
+ }, {}, {}, string>;
22
+ type InputDate = InstanceType<typeof InputDate>;
23
+ export default InputDate;
@@ -1,34 +1,41 @@
1
- <script>import { USE_COERCE_DATE } from "../../utils/constant.js";
2
- import { FormControl } from "./index.js";
3
- import { createEventDispatcher } from "svelte";
4
- import dayjs from "dayjs";
5
- export let value = void 0;
6
- export let input = {};
7
- $:
8
- ({ class: inputClass = "", ...inputProps } = input);
9
- const dispatch = createEventDispatcher();
10
- const handleInput = ({ currentTarget }) => {
11
- value = getDateTime(currentTarget.value);
12
- dispatch("input", value);
13
- };
14
- function getDateTime(v) {
15
- if (typeof v !== "string")
16
- return null;
17
- return new Date(v);
18
- }
1
+ <script lang="ts">
2
+ import type { FormEventHandler, HTMLInputAttributes } from 'svelte/elements'
3
+ import { USE_COERCE_DATE } from '../../utils/constant.js'
4
+ import { FormControl, type InputProps } from './index.js'
5
+ import { createEventDispatcher } from 'svelte'
6
+ import dayjs from 'dayjs'
7
+
8
+ type $$Props = InputProps<Date | null | undefined>
9
+ export let value: Date | null | undefined = undefined
10
+ export let input: HTMLInputAttributes = {}
11
+ $: ({ class: inputClass = '', ...inputProps } = input)
12
+
13
+ const dispatch = createEventDispatcher<{ input: Date | null }>()
14
+
15
+ const handleInput: FormEventHandler<HTMLInputElement> = ({ currentTarget }) => {
16
+ value = getDateTime(currentTarget.value)
17
+ dispatch('input', value)
18
+ }
19
+
20
+ function getDateTime(v: string | null | undefined): Date | null {
21
+ if (typeof v !== 'string') return null
22
+ return new Date(v)
23
+ }
19
24
  </script>
20
25
 
21
- <FormControl {...$$restProps} let:key>
22
- <input
23
- value={value && dayjs(value).format('YYYY-MM-DDTHH:mm')}
24
- on:input={handleInput}
25
- on:focus
26
- on:blur
27
- type="datetime-local"
28
- id={key}
29
- class="input input-bordered {inputClass}"
30
- {...inputProps}
31
- />
26
+ <FormControl {...$$restProps}>
27
+ {#snippet children({ key })}
28
+ <input
29
+ value={value && dayjs(value).format('YYYY-MM-DDTHH:mm')}
30
+ on:input={handleInput}
31
+ on:focus
32
+ on:blur
33
+ type="datetime-local"
34
+ id={key}
35
+ class="input input-bordered {inputClass}"
36
+ {...inputProps}
37
+ />
32
38
 
33
- <input type="hidden" name={key} value="{USE_COERCE_DATE}{value?.toJSON()}" />
39
+ <input type="hidden" name={key} value="{USE_COERCE_DATE}{value?.toJSON()}" />
40
+ {/snippet}
34
41
  </FormControl>
@@ -1,19 +1,23 @@
1
- import { SvelteComponent } from "svelte";
2
1
  import { type InputProps } from './index.js';
3
- declare const __propDef: {
4
- props: InputProps<Date | null | undefined>;
5
- events: {
6
- focus: FocusEvent;
7
- blur: FocusEvent;
8
- input: CustomEvent<Date | null>;
9
- } & {
10
- [evt: string]: CustomEvent<any>;
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;
11
12
  };
12
- slots: {};
13
- };
14
- export type InputDateTimeProps = typeof __propDef.props;
15
- export type InputDateTimeEvents = typeof __propDef.events;
16
- export type InputDateTimeSlots = typeof __propDef.slots;
17
- export default class InputDateTime extends SvelteComponent<InputDateTimeProps, InputDateTimeEvents, InputDateTimeSlots> {
13
+ z_$$bindings?: Bindings;
18
14
  }
19
- export {};
15
+ declare const InputDateTime: $$__sveltets_2_IsomorphicComponent<InputProps<Date | null | undefined>, {
16
+ focus: FocusEvent;
17
+ blur: FocusEvent;
18
+ input: CustomEvent<Date | null>;
19
+ } & {
20
+ [evt: string]: CustomEvent<any>;
21
+ }, {}, {}, string>;
22
+ type InputDateTime = InstanceType<typeof InputDateTime>;
23
+ export default InputDateTime;
@@ -1,49 +1,56 @@
1
- <script context="module"></script>
1
+ <script lang="ts" context="module">
2
+ export type Crop = { width: number; height: number; x: number; y: number }
3
+ </script>
4
+
5
+ <script lang="ts">
6
+ import { onMount, createEventDispatcher } from 'svelte'
7
+ import Cropper from 'svelte-easy-crop'
8
+ import { mdiTrayArrowUp } from '@mdi/js'
9
+
10
+ import type { TippyInstance } from '../../utils/tippy.js'
11
+ import { Icon } from '../icon/index.js'
12
+ import { DropDown } from '../menu/index.js'
13
+ import { Dialog } from '../dialog/index.js'
14
+
15
+ export let aspect = 1
16
+ export let title = 'Image'
17
+ export let formaction: string | undefined = undefined
18
+ export let key = ''
19
+ let dialog: HTMLDialogElement
20
+ let tip: TippyInstance
21
+ let image = ''
22
+ let crop: Crop | undefined = undefined
23
+ let inputFile: HTMLInputElement
24
+
25
+ const dispatch = createEventDispatcher<{ submit: { crop: Crop; image: string } }>()
26
+
27
+ function onFileSelected() {
28
+ if (!inputFile.files) return
29
+ const file = inputFile.files[0]
30
+ const reader = new FileReader()
31
+ reader.onload = ({ target }) => {
32
+ image = (target?.result || '') as string
33
+ dialog?.showModal()
34
+ }
35
+ reader.readAsDataURL(file)
36
+ }
37
+
38
+ export function close() {
39
+ tip?.hide()
40
+ dialog?.close()
41
+ }
42
+
43
+ onMount(() => {
44
+ if (!$$slots.actions) tip.disable()
45
+ })
46
+ function handleClickActivator() {
47
+ if (!$$slots.actions) inputFile.click()
48
+ }
2
49
 
3
- <script>import { onMount, createEventDispatcher } from "svelte";
4
- import Cropper from "svelte-easy-crop";
5
- import { mdiTrayArrowUp } from "@mdi/js";
6
- import { Icon } from "../icon/index.js";
7
- import { DropDown } from "../menu/index.js";
8
- import { Dialog } from "../dialog/index.js";
9
- export let aspect = 1;
10
- export let title = "Image";
11
- export let formaction = void 0;
12
- export let key = "";
13
- let dialog;
14
- let tip;
15
- let image = "";
16
- let crop = void 0;
17
- let inputFile;
18
- const dispatch = createEventDispatcher();
19
- function onFileSelected() {
20
- if (!inputFile.files)
21
- return;
22
- const file = inputFile.files[0];
23
- const reader = new FileReader();
24
- reader.onload = ({ target }) => {
25
- image = target?.result || "";
26
- dialog?.showModal();
27
- };
28
- reader.readAsDataURL(file);
29
- }
30
- export function close() {
31
- tip?.hide();
32
- dialog?.close();
33
- }
34
- onMount(() => {
35
- if (!$$slots.actions)
36
- tip.disable();
37
- });
38
- function handleClickActivator() {
39
- if (!$$slots.actions)
40
- inputFile.click();
41
- }
42
- function handleValidation() {
43
- close();
44
- if (crop && image)
45
- dispatch("submit", { crop, image });
46
- }
50
+ function handleValidation() {
51
+ close()
52
+ if (crop && image) dispatch('submit', { crop, image })
53
+ }
47
54
  </script>
48
55
 
49
56
  <DropDown tippyProps={{ arrow: true }} hideOnBlur bind:tip>
@@ -1,35 +1,48 @@
1
- import { SvelteComponent } from "svelte";
2
1
  export type Crop = {
3
2
  width: number;
4
3
  height: number;
5
4
  x: number;
6
5
  y: number;
7
6
  };
8
- declare const __propDef: {
9
- props: {
10
- aspect?: number | undefined;
11
- title?: string | undefined;
12
- formaction?: string | undefined;
13
- key?: string | undefined;
14
- close?: (() => void) | undefined;
7
+ 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> {
8
+ new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
9
+ $$bindings?: Bindings;
10
+ } & Exports;
11
+ (internal: unknown, props: Props & {
12
+ $$events?: Events;
13
+ $$slots?: Slots;
14
+ }): Exports & {
15
+ $set?: any;
16
+ $on?: any;
15
17
  };
16
- events: {
17
- submit: CustomEvent<{
18
- crop: Crop;
19
- image: string;
20
- }>;
21
- } & {
22
- [evt: string]: CustomEvent<any>;
23
- };
24
- slots: {
25
- default: {};
26
- actions: {};
27
- };
28
- };
29
- export type InputImageProps = typeof __propDef.props;
30
- export type InputImageEvents = typeof __propDef.events;
31
- export type InputImageSlots = typeof __propDef.slots;
32
- export default class InputImage extends SvelteComponent<InputImageProps, InputImageEvents, InputImageSlots> {
33
- get close(): () => void;
18
+ z_$$bindings?: Bindings;
34
19
  }
35
- export {};
20
+ type $$__sveltets_2_PropsWithChildren<Props, Slots> = Props & (Slots extends {
21
+ default: any;
22
+ } ? Props extends Record<string, never> ? any : {
23
+ children?: any;
24
+ } : {});
25
+ declare const InputImage: $$__sveltets_2_IsomorphicComponent<$$__sveltets_2_PropsWithChildren<{
26
+ aspect?: number;
27
+ title?: string;
28
+ formaction?: string | undefined;
29
+ key?: string;
30
+ close?: () => void;
31
+ }, {
32
+ default: {};
33
+ actions: {};
34
+ }>, {
35
+ submit: CustomEvent<{
36
+ crop: Crop;
37
+ image: string;
38
+ }>;
39
+ } & {
40
+ [evt: string]: CustomEvent<any>;
41
+ }, {
42
+ default: {};
43
+ actions: {};
44
+ }, {
45
+ close: () => void;
46
+ }, string>;
47
+ type InputImage = InstanceType<typeof InputImage>;
48
+ export default InputImage;
@@ -1,23 +1,27 @@
1
- <script>import { InputImage } from "./index.js";
2
- import { PlaceholderImage } from "../placeholder/index.js";
3
- export let key = "";
4
- export let src = "";
5
- export let alt = "";
6
- let klass = "";
7
- export { klass as class };
8
- export let title = "Image";
9
- export let x;
10
- export let y;
11
- export let aspect = x / y;
12
- let crop = null;
13
- let image = "";
14
- let scale = 0;
15
- let preview;
16
- async function handleSubmit(detail) {
17
- crop = detail.crop;
18
- image = detail.image;
19
- scale = x / crop.width;
20
- }
1
+ <script lang="ts">
2
+ import { InputImage, type Crop } from './index.js'
3
+ import { PlaceholderImage } from '../placeholder/index.js'
4
+
5
+ export let key = ''
6
+ export let src = ''
7
+ export let alt = ''
8
+ let klass = ''
9
+ export { klass as class }
10
+ export let title = 'Image'
11
+ export let x: number
12
+ export let y: number
13
+ export let aspect = x / y
14
+
15
+ let crop: Crop | null = null
16
+ let image = ''
17
+ let scale = 0
18
+ let preview: HTMLImageElement
19
+
20
+ async function handleSubmit(detail: { crop: Crop; image: string }) {
21
+ crop = detail.crop
22
+ image = detail.image
23
+ scale = x / crop.width
24
+ }
21
25
  </script>
22
26
 
23
27
  <InputImage {key} {title} {aspect} on:submit={({ detail }) => handleSubmit(detail)}>
@@ -1,23 +1,27 @@
1
- import { SvelteComponent } from "svelte";
2
- declare const __propDef: {
3
- props: {
4
- key?: string | undefined;
5
- src?: string | undefined;
6
- alt?: string | undefined;
7
- class?: string | undefined;
8
- title?: string | undefined;
9
- x: number;
10
- y: number;
11
- aspect?: number | undefined;
1
+ 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> {
2
+ new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
3
+ $$bindings?: Bindings;
4
+ } & Exports;
5
+ (internal: unknown, props: Props & {
6
+ $$events?: Events;
7
+ $$slots?: Slots;
8
+ }): Exports & {
9
+ $set?: any;
10
+ $on?: any;
12
11
  };
13
- events: {
14
- [evt: string]: CustomEvent<any>;
15
- };
16
- slots: {};
17
- };
18
- export type InputImagePreviewProps = typeof __propDef.props;
19
- export type InputImagePreviewEvents = typeof __propDef.events;
20
- export type InputImagePreviewSlots = typeof __propDef.slots;
21
- export default class InputImagePreview extends SvelteComponent<InputImagePreviewProps, InputImagePreviewEvents, InputImagePreviewSlots> {
12
+ z_$$bindings?: Bindings;
22
13
  }
23
- export {};
14
+ declare const InputImagePreview: $$__sveltets_2_IsomorphicComponent<{
15
+ key?: string;
16
+ src?: string;
17
+ alt?: string;
18
+ class?: string;
19
+ title?: string;
20
+ x: number;
21
+ y: number;
22
+ aspect?: number;
23
+ }, {
24
+ [evt: string]: CustomEvent<any>;
25
+ }, {}, {}, string>;
26
+ type InputImagePreview = InstanceType<typeof InputImagePreview>;
27
+ export default InputImagePreview;
@@ -1,25 +1,31 @@
1
- <script>import { USE_COERCE_NUMBER } from "../../utils/constant.js";
2
- import { FormControl } from "./index.js";
3
- export let value = void 0;
4
- export let input = void 0;
5
- export let inputElement = void 0;
1
+ <script lang="ts">
2
+ import { USE_COERCE_NUMBER } from '../../utils/constant.js'
3
+ import { FormControl, type InputProps } from './index.js'
4
+ import type { HTMLInputAttributes } from 'svelte/elements'
5
+
6
+ type $$Props = InputProps<number>
7
+
8
+ export let value: number | null | undefined = undefined
9
+ export let input: HTMLInputAttributes | undefined = undefined
10
+ export let inputElement: HTMLInputElement | undefined = undefined
6
11
  </script>
7
12
 
8
- <FormControl {...$$restProps} let:key>
9
- <slot name="label_append" slot="label_append" />
10
- <input
11
- bind:value
12
- bind:this={inputElement}
13
- on:input
14
- on:focus
15
- on:blur
16
- type="number"
17
- id={key}
18
- inputmode="numeric"
19
- class="input input-bordered"
20
- {...input}
21
- />
22
- {#if value !== undefined}
23
- <input type="hidden" name={key} value="{USE_COERCE_NUMBER}{value}" />
24
- {/if}
13
+ <FormControl {...$$restProps}>
14
+ {#snippet children({ key })}
15
+ <input
16
+ bind:value
17
+ bind:this={inputElement}
18
+ on:input
19
+ on:focus
20
+ on:blur
21
+ type="number"
22
+ id={key}
23
+ inputmode="numeric"
24
+ class="input input-bordered"
25
+ {...input}
26
+ />
27
+ {#if value !== undefined}
28
+ <input type="hidden" name={key} value="{USE_COERCE_NUMBER}{value}" />
29
+ {/if}
30
+ {/snippet}
25
31
  </FormControl>
@@ -1,23 +1,23 @@
1
- import { SvelteComponent } from "svelte";
2
1
  import { type InputProps } from './index.js';
3
- declare const __propDef: {
4
- props: InputProps<number>;
5
- events: {
6
- input: Event;
7
- focus: FocusEvent;
8
- blur: FocusEvent;
9
- } & {
10
- [evt: string]: CustomEvent<any>;
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;
11
12
  };
12
- slots: {
13
- label_append: {
14
- slot: string;
15
- };
16
- };
17
- };
18
- export type InputNumberProps = typeof __propDef.props;
19
- export type InputNumberEvents = typeof __propDef.events;
20
- export type InputNumberSlots = typeof __propDef.slots;
21
- export default class InputNumber extends SvelteComponent<InputNumberProps, InputNumberEvents, InputNumberSlots> {
13
+ z_$$bindings?: Bindings;
22
14
  }
23
- export {};
15
+ declare const InputNumber: $$__sveltets_2_IsomorphicComponent<InputProps<number>, {
16
+ input: Event;
17
+ focus: FocusEvent;
18
+ blur: FocusEvent;
19
+ } & {
20
+ [evt: string]: CustomEvent<any>;
21
+ }, {}, {}, string>;
22
+ type InputNumber = InstanceType<typeof InputNumber>;
23
+ export default InputNumber;
@@ -1,13 +1,15 @@
1
- <script>import { Icon } from "../icon/index.js";
2
- import { parseOptions } from "../../utils/options.js";
3
- import { urlParam } from "../../store/param.js";
4
- let klass = "";
5
- export { klass as class };
6
- export let key;
7
- export let options;
8
- export let removeKeys = [];
9
- $:
10
- _options = parseOptions(options);
1
+ <script lang="ts">
2
+ import { Icon } from '../icon/index.js'
3
+ import { parseOptions, type Options } from '../../utils/options.js'
4
+ import { urlParam } from '../../store/param.js'
5
+
6
+ let klass = ''
7
+ export { klass as class }
8
+ export let key: string
9
+ export let options: Options
10
+ export let removeKeys: string[] = []
11
+
12
+ $: _options = parseOptions(options)
11
13
  </script>
12
14
 
13
15
  <div class="join {klass}">