firstly 0.2.0 → 0.2.1

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 (96) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/esm/auth/server/AuthController.server.js +32 -12
  3. package/esm/auth/static/assets/Page-BRNWcY5Z.js +1 -0
  4. package/esm/auth/static/assets/Page-CFcEsGK8.d.ts +2 -0
  5. package/esm/auth/static/assets/Page-CFcEsGK8.js +7 -0
  6. package/esm/auth/static/assets/Page-tLVs5slF.js +1 -0
  7. package/esm/auth/static/assets/index-D38rqu4x.d.ts +201 -0
  8. package/esm/auth/static/assets/index-D38rqu4x.js +2 -0
  9. package/esm/auth/static/index.html +1 -1
  10. package/esm/bin/cmd.js +2 -2
  11. package/esm/feedback/FeedbackController.d.ts +6 -2
  12. package/esm/feedback/FeedbackController.js +145 -143
  13. package/esm/feedback/server/index.d.ts +2 -2
  14. package/esm/feedback/server/index.js +3 -3
  15. package/esm/feedback/types.d.ts +5 -0
  16. package/esm/feedback/ui/DialogIssue.svelte +5 -5
  17. package/esm/feedback/ui/DialogIssues.svelte +5 -5
  18. package/esm/feedback/ui/DialogMilestones.svelte +1 -1
  19. package/esm/internals/BaseEnum.d.ts +1 -0
  20. package/esm/internals/FF_Fields.d.ts +4 -3
  21. package/esm/internals/FF_Fields.js +14 -55
  22. package/esm/internals/cellsBuildor.d.ts +2 -1
  23. package/esm/internals/index.d.ts +6 -7
  24. package/esm/internals/storeItem.d.ts +1 -0
  25. package/esm/mail/server/index.d.ts +8 -2
  26. package/esm/mail/server/index.js +35 -7
  27. package/esm/server/index.d.ts +1 -1
  28. package/esm/svelte/FF_Cell.svelte +3 -5
  29. package/esm/svelte/FF_Cell.svelte.d.ts +4 -2
  30. package/esm/svelte/FF_Form.svelte +4 -5
  31. package/esm/svelte/FF_Grid.svelte +2 -2
  32. package/esm/svelte/FF_Layout.svelte +3 -3
  33. package/esm/svelte/dialog/DialogManagement.svelte +2 -5
  34. package/esm/svelte/dialog/DialogPrimitive.svelte +1 -2
  35. package/esm/svelte/dialog/dialog.js +2 -2
  36. package/esm/svelte/ff_Config.svelte.js +2 -2
  37. package/esm/svelte/index.d.ts +2 -7
  38. package/esm/svelte/index.js +2 -7
  39. package/esm/ui/Button.svelte +38 -22
  40. package/esm/ui/Button.svelte.d.ts +10 -34
  41. package/esm/ui/Clipboardable.svelte +13 -17
  42. package/esm/ui/Clipboardable.svelte.d.ts +9 -33
  43. package/esm/ui/Field.svelte +38 -8
  44. package/esm/ui/FieldGroup.svelte.d.ts +1 -1
  45. package/esm/ui/Grid.svelte +11 -82
  46. package/esm/ui/Grid.svelte.d.ts +0 -1
  47. package/esm/ui/Grid2.svelte +25 -86
  48. package/esm/ui/Grid2.svelte.d.ts +1 -2
  49. package/esm/ui/GridPaginate.svelte +1 -1
  50. package/esm/ui/GridPaginate2.svelte +2 -2
  51. package/esm/ui/Icon.svelte +2 -18
  52. package/esm/ui/Icon.svelte.d.ts +0 -2
  53. package/esm/ui/LibIcon.js +2 -2
  54. package/esm/ui/Loading.svelte +1 -1
  55. package/esm/ui/dialog/DialogManagement.svelte +14 -5
  56. package/esm/ui/dialog/DialogPrimitive.svelte +3 -3
  57. package/esm/ui/dialog/FormEditAction.svelte +4 -4
  58. package/esm/ui/dialog/dialog.d.ts +5 -2
  59. package/esm/ui/dialog/dialog.js +2 -2
  60. package/esm/ui/index.d.ts +1 -0
  61. package/esm/ui/index.js +1 -0
  62. package/esm/ui/internals/FieldContainer.svelte +25 -14
  63. package/esm/ui/internals/FieldContainer.svelte.d.ts +9 -30
  64. package/esm/ui/internals/Input.svelte.d.ts +1 -1
  65. package/esm/ui/internals/Textarea.svelte +2 -5
  66. package/esm/ui/internals/select/MultiSelectMelt.svelte +6 -4
  67. package/esm/ui/internals/select/Select2.svelte +88 -0
  68. package/esm/ui/internals/select/Select2.svelte.d.ts +12 -0
  69. package/esm/ui/internals/select/SelectMelt.svelte +5 -5
  70. package/esm/ui/internals/select/SelectRadio.svelte +1 -1
  71. package/esm/ui/link/Link.svelte +1 -1
  72. package/esm/ui/link/LinkPlus.svelte +9 -5
  73. package/esm/ui/link/LinkPlus.svelte.d.ts +5 -19
  74. package/esm/virtual/Customer.js +1 -2
  75. package/esm/virtual/UIEntity.js +9 -5
  76. package/package.json +7 -8
  77. package/esm/auth/static/assets/Page-9Ytj29NS.js +0 -1
  78. package/esm/auth/static/assets/Page-C1pM-UDt.d.ts +0 -2
  79. package/esm/auth/static/assets/Page-C1pM-UDt.js +0 -20
  80. package/esm/auth/static/assets/Page-CPz6KCw_.js +0 -1
  81. package/esm/auth/static/assets/index-AoBb9Ds5.d.ts +0 -232
  82. package/esm/auth/static/assets/index-AoBb9Ds5.js +0 -2
  83. package/esm/svelte/FF_Display.svelte +0 -51
  84. package/esm/svelte/FF_Display.svelte.d.ts +0 -29
  85. package/esm/svelte/FF_Edit.svelte +0 -104
  86. package/esm/svelte/FF_Edit.svelte.d.ts +0 -32
  87. package/esm/svelte/FF_Error.svelte +0 -23
  88. package/esm/svelte/FF_Error.svelte.d.ts +0 -29
  89. package/esm/svelte/FF_Field.svelte +0 -62
  90. package/esm/svelte/FF_Field.svelte.d.ts +0 -29
  91. package/esm/svelte/FF_Hint.svelte +0 -21
  92. package/esm/svelte/FF_Hint.svelte.d.ts +0 -29
  93. package/esm/svelte/FF_Label.svelte +0 -23
  94. package/esm/svelte/FF_Label.svelte.d.ts +0 -29
  95. /package/esm/auth/static/assets/{Page-CPz6KCw_.d.ts → Page-BRNWcY5Z.d.ts} +0 -0
  96. /package/esm/auth/static/assets/{Page-9Ytj29NS.d.ts → Page-tLVs5slF.d.ts} +0 -0
@@ -18,20 +18,19 @@ import { default as Link } from '../ui/link/Link.svelte';
18
18
  import { default as LinkPlus } from '../ui/link/LinkPlus.svelte';
19
19
  import { default as Loading } from '../ui/Loading.svelte';
20
20
  import { default as Tooltip } from '../ui/Tooltip.svelte';
21
- import type { BaseEnum, BaseItem, FF_Icon } from './BaseEnum.js';
22
- import type { CellsInput as CellsInput_ForExport } from './cellsBuildor.js';
21
+ import type { BaseEnum, BaseItem, BaseItemLight, FF_Icon } from './BaseEnum.js';
22
+ import type { CellsInput } from './cellsBuildor.js';
23
23
  import { FF_Role } from './common.js';
24
- import { storeItem } from './storeItem.js';
24
+ import { storeItem, type StoreItem } from './storeItem.js';
25
25
  import { storeList } from './storeList.js';
26
26
  export { Field, FormEditAction, Grid, Grid2, GridPaginate, GridPaginate2, FieldGroup, Icon, Link, LinkPlus, Loading, Button, Tooltip, DialogManagement, FieldContainer, SelectMelt, Clipboardable, };
27
27
  export type { BaseEnumOptions } from './BaseEnum.js';
28
- export type { BaseItem };
29
- export type BaseItemLight = Partial<BaseItem>;
28
+ export type { BaseItem, BaseItemLight };
30
29
  export type { DialogMetaDataInternal } from '../ui/dialog/dialog.js';
31
- export type CellsInput<entityType> = CellsInput_ForExport<entityType>;
30
+ export type { CellsInput };
32
31
  export type { Cell, VisibilityMode } from './cellsBuildor.js';
33
32
  export type { FF_FindOptions } from './storeList.js';
34
- export type StoreItem<T> = ReturnType<typeof storeItem<T>>;
33
+ export type { StoreItem };
35
34
  export type StoreList<T> = ReturnType<typeof storeList<T>>;
36
35
  export type { ResolvedType, UnArray, RecursivePartial } from '../utils/types.js';
37
36
  export { FF_Fields } from './FF_Fields.js';
@@ -1,4 +1,5 @@
1
1
  import type { ErrorInfo, FindOptions, Repository } from 'remult';
2
+ export type StoreItem<T> = ReturnType<typeof storeItem<T>>;
2
3
  type TheStoreItem<T> = {
3
4
  item: T | undefined;
4
5
  loading?: boolean;
@@ -29,8 +29,14 @@ export type MailOptions = GlobalEasyOptions & {
29
29
  defaults?: DefaultOptions;
30
30
  };
31
31
  };
32
- declare let transporter: ReturnType<typeof typeNodemailer.createTransport>;
33
32
  export type SendMail = typeof sendMail;
33
+ export type SendMailResult = {
34
+ data: SMTPTransport.SentMessageInfo;
35
+ error?: undefined;
36
+ } | {
37
+ error: any;
38
+ data?: undefined;
39
+ };
34
40
  export declare const sendMail: (
35
41
  /** usefull for logs, it has NO impact on the mail itself */
36
42
  topic: string, easyOptions: GlobalEasyOptions & {
@@ -46,6 +52,6 @@ topic: string, easyOptions: GlobalEasyOptions & {
46
52
  }[];
47
53
  }, options?: {
48
54
  nodemailer?: MailOptions['nodemailer'];
49
- }) => ReturnType<typeof transporter.sendMail>;
55
+ }) => Promise<SendMailResult>;
50
56
  export declare const mail: (o?: MailOptions) => Module<unknown>;
51
57
  export {};
@@ -99,10 +99,10 @@ export const sendMail = async (topic, easyOptions, options) => {
99
99
  }
100
100
  try {
101
101
  if (!globalOptions?.nodemailer?.transport) {
102
- const info = await transporter.sendMail({ ...nodemailerOptions.defaults });
102
+ const data = await transporter.sendMail({ ...nodemailerOptions.defaults });
103
103
  log.error(`${magenta(`[${topic}]`)} - ⚠️ ${red(`mail not configured`)} ⚠️
104
104
  We are still nice and generated you an email preview link (the mail we not really sent):
105
- 👉 ${cyan(String(nodemailer.getTestMessageUrl(info)))}
105
+ 👉 ${cyan(String(nodemailer.getTestMessageUrl(data)))}
106
106
 
107
107
  To really send mails, check out the doc ${white(`https://firstly.fun/modules/mail`)}.
108
108
  `);
@@ -113,10 +113,10 @@ export const sendMail = async (topic, easyOptions, options) => {
113
113
  topic,
114
114
  metadata,
115
115
  });
116
- return info;
116
+ return { data };
117
117
  }
118
118
  else {
119
- const info = await transporter.sendMail({ ...nodemailerOptions.defaults });
119
+ const data = await transporter.sendMail({ ...nodemailerOptions.defaults });
120
120
  log.success(`${magenta(`[${topic}]`)} - Sent to ${typeof nodemailerOptions.defaults?.to === 'string' ? green(nodemailerOptions.defaults?.to) : nodemailerOptions.defaults?.to}`);
121
121
  await repo(mailEntities.Mail).insert({
122
122
  status: 'sent',
@@ -125,7 +125,7 @@ export const sendMail = async (topic, easyOptions, options) => {
125
125
  topic,
126
126
  metadata,
127
127
  });
128
- return info;
128
+ return { data };
129
129
  }
130
130
  }
131
131
  catch (error) {
@@ -138,15 +138,43 @@ ${cyan(JSON.stringify(globalOptions?.nodemailer?.transport, null, 2))}
138
138
  else {
139
139
  log.error(`${magenta(`[${topic}]`)} - Error`, error);
140
140
  }
141
+ // TODO
142
+ // Build comprehensive error info for JSON storage
143
+ const errorInfoJSON = {
144
+ message: error instanceof Error ? error.message : String(error),
145
+ name: error instanceof Error ? error.name : 'Unknown',
146
+ // stack: error instanceof Error ? error.stack : undefined,
147
+ code: error?.code,
148
+ errno: error?.errno,
149
+ syscall: error?.syscall,
150
+ hostname: error?.hostname,
151
+ port: error?.port,
152
+ address: error?.address,
153
+ response: error?.response,
154
+ responseCode: error?.responseCode,
155
+ command: error?.command,
156
+ // Capture any other enumerable properties
157
+ ...Object.getOwnPropertyNames(error).reduce((acc, key) => {
158
+ if (!['message', 'name', 'stack'].includes(key)) {
159
+ try {
160
+ acc[key] = error[key];
161
+ }
162
+ catch (e) {
163
+ // Ignore properties that can't be accessed
164
+ }
165
+ }
166
+ return acc;
167
+ }, {}),
168
+ };
141
169
  await repo(mailEntities.Mail).insert({
142
170
  status: 'error',
143
- errorInfo: JSON.stringify(error),
171
+ errorInfo: JSON.stringify(errorInfoJSON),
144
172
  to: JSON.stringify(to),
145
173
  html: easyOptionsToUse.saveHtml ? html : '',
146
174
  topic,
147
175
  metadata,
148
176
  });
149
- throw error;
177
+ return { error };
150
178
  }
151
179
  };
152
180
  const mailModule = new Module({
@@ -27,7 +27,7 @@ export declare class ModuleFF {
27
27
  modulesFF?: ModuleFF[];
28
28
  constructor(input: ModuleInput);
29
29
  }
30
- type Options = RemultServerOptions<RequestEvent<Partial<Record<string, string>>, string | null>> & {
30
+ type Options = RemultServerOptions<RequestEvent<Partial<Record<string, string>>, any>> & {
31
31
  /** @deprecated use `remult` modules instead */
32
32
  modulesFF?: ModuleFF[] | undefined;
33
33
  };
@@ -13,10 +13,11 @@
13
13
  cell: CellMetadata<valueType, entityType>
14
14
  r?: FF_Repo<entityType>
15
15
  class?: string
16
+ value?: valueType
17
+ error?: string
16
18
  }
17
19
 
18
- // eslint-disable-next-line svelte/no-unused-props
19
- let props: Props<valueType, entityType> = $props()
20
+ let { value = $bindable(), error, ...props }: Props<valueType, entityType> = $props()
20
21
 
21
22
  // let classes = $derived(getClasses('field', props.classes))
22
23
 
@@ -25,9 +26,6 @@
25
26
  let hint = $derived(props.cell.field?.options.ui?.hint ?? props.cell.ui?.hint)
26
27
  // @ts-ignore
27
28
  let ui = $derived(deepMerge(props.cell.field?.options.ui ?? {}, props.cell.ui ?? {}))
28
-
29
- let error = ''
30
- let value: any = $state('')
31
29
  </script>
32
30
 
33
31
  <!-- Snippets sections -->
@@ -4,11 +4,13 @@ interface Props<valueType = unknown, entityType = unknown> {
4
4
  cell: CellMetadata<valueType, entityType>;
5
5
  r?: FF_Repo<entityType>;
6
6
  class?: string;
7
+ value?: valueType;
8
+ error?: string;
7
9
  }
8
10
  declare function $$render<valueType = unknown, entityType = unknown>(): {
9
11
  props: Props<valueType, entityType>;
10
12
  exports: {};
11
- bindings: "";
13
+ bindings: "value";
12
14
  slots: {};
13
15
  events: {};
14
16
  };
@@ -16,7 +18,7 @@ declare class __sveltets_Render<valueType = unknown, entityType = unknown> {
16
18
  props(): ReturnType<typeof $$render<valueType, entityType>>['props'];
17
19
  events(): ReturnType<typeof $$render<valueType, entityType>>['events'];
18
20
  slots(): ReturnType<typeof $$render<valueType, entityType>>['slots'];
19
- bindings(): "";
21
+ bindings(): "value";
20
22
  exports(): {};
21
23
  }
22
24
  interface $$IsomorphicComponent {
@@ -1,7 +1,7 @@
1
1
  <script lang="ts" generics="entityType = unknown">
2
2
  import { EntityError, getEntityRef } from 'remult'
3
3
 
4
- import { FF_Field, getClasses } from './'
4
+ import { FF_Cell, getClasses } from './'
5
5
  import type { FF_Repo, FieldGroup, FormTheme } from './'
6
6
 
7
7
  const default_uid = $props.id()
@@ -91,11 +91,10 @@
91
91
  {/if}
92
92
  <div data-ff-form-fields class="{classes?.fields} {group.class}">
93
93
  {#each group.fields as field}
94
- <FF_Field
95
- uid="{ToUse}-{field.key}"
96
- {field}
94
+ <FF_Cell
95
+ cell={{ field, mode: 'edit' }}
97
96
  bind:value={valuesToUse[field.key as keyof entityType]}
98
- error={errors[field.key]}
97
+ error={errors[field.key ?? '']}
99
98
  />
100
99
  {/each}
101
100
  </div>
@@ -3,7 +3,7 @@
3
3
 
4
4
  import Icon from '../ui/Icon.svelte'
5
5
  import { LibIcon_Add, LibIcon_Delete, LibIcon_Edit } from '../ui/LibIcon'
6
- import { dialog, FF_Display, FF_Repo, getClasses, type GridTheme } from './'
6
+ import { dialog, FF_Cell_Display, FF_Repo, getClasses, type GridTheme } from './'
7
7
 
8
8
  interface Props<entityType> {
9
9
  // uid?: string
@@ -100,7 +100,7 @@
100
100
  <tr data-ff-grid-row class={classes?.row}>
101
101
  {#each fields as f (f.key)}
102
102
  <td data-ff-grid-row-cell class="{classes?.rowCell} td-{f.inputType}">
103
- <FF_Display field={f} value={item[f.key as keyof entityType]}></FF_Display>
103
+ <FF_Cell_Display field={f} value={item[f.key as keyof entityType]}></FF_Cell_Display>
104
104
  </td>
105
105
  {/each}
106
106
  {#if showActions}
@@ -28,7 +28,7 @@
28
28
  {:else if layoutToUse.type === 'grid'}
29
29
  <FF_Grid {r}></FF_Grid>
30
30
  {:else if layoutToUse.type === 'tab'}
31
- <div role="tablist" class="tabs tabs-lifted">
31
+ <div role="tablist" class="tabs-lift tabs">
32
32
  {#each layoutToUse.groups ?? [] as group (group.key)}
33
33
  <input
34
34
  type="radio"
@@ -39,14 +39,14 @@
39
39
  onchange={() => (selectedThing = group.key)}
40
40
  aria-label={group.caption}
41
41
  />
42
- <div role="tabpanel" class="tab-content rounded-box border-base-300 bg-base-100 p-6">
42
+ <div role="tabpanel" class="tab-content border-base-300 bg-base-100 p-6">
43
43
  <FF_Form {r} groups={[group]} show={{ title: false }}></FF_Form>
44
44
  </div>
45
45
  {/each}
46
46
  </div>
47
47
  {:else if layoutToUse.type === 'accordion'}
48
48
  {#each layoutToUse.groups ?? [] as group (group.key)}
49
- <div class="collapse bg-base-100">
49
+ <div class="collapse-arrow collapse bg-base-100">
50
50
  <input
51
51
  type="radio"
52
52
  name="my-accordion"
@@ -16,7 +16,7 @@
16
16
  >
17
17
  {@html toShow.children}
18
18
  <svelte:fragment slot="actions">
19
- <Button class="text-white" on:click={() => dialog.close(toShow.id, { success: true })}
19
+ <Button class="text-white" onclick={() => dialog.close(toShow.id, { success: true })}
20
20
  >Confirmer</Button
21
21
  >
22
22
  </svelte:fragment>
@@ -29,10 +29,7 @@
29
29
  >
30
30
  {@html toShow.children}
31
31
  <svelte:fragment slot="actions">
32
- <Button
33
- class="btn-outline btn-error"
34
- on:click={() => dialog.close(toShow.id, { success: true })}
35
- >
32
+ <Button class="btn-error" onclick={() => dialog.close(toShow.id, { success: true })}>
36
33
  Confirmer
37
34
  </Button>
38
35
  </svelte:fragment>
@@ -91,8 +91,7 @@
91
91
  inset: 0;
92
92
  z-index: 40;
93
93
  background-color: var(--ff-dialog-overlay);
94
- -webkit-backdrop-filter: blur(2px);
95
- backdrop-filter: blur(2px);
94
+ backdrop-filter: blur(2px);
96
95
  }
97
96
 
98
97
  [data-ff-dialog-content] {
@@ -18,7 +18,7 @@ const createDialogManagement = () => {
18
18
  confirm: (topic, text, icon) => {
19
19
  const detail = {
20
20
  detail: {
21
- caption: 'Confirmez',
21
+ caption: 'A Confirmer',
22
22
  icon: { data: icon },
23
23
  },
24
24
  children: `
@@ -34,7 +34,7 @@ const createDialogManagement = () => {
34
34
  confirmDelete: (topic) => {
35
35
  const detail = {
36
36
  detail: {
37
- caption: 'Supprimer',
37
+ caption: 'A Supprimer',
38
38
  icon: { data: LibIcon_Delete },
39
39
  },
40
40
  children: topic
@@ -40,8 +40,8 @@ export const daisyTheme = {
40
40
  },
41
41
  edit: {
42
42
  checkbox: 'checkbox',
43
- input: 'input input-bordered',
44
- select: 'select select-bordered',
43
+ input: 'input',
44
+ select: 'select',
45
45
  },
46
46
  grid: {
47
47
  root: 'table',
@@ -1,18 +1,13 @@
1
1
  import type { CellMetadata, getLayout } from './customField';
2
+ import { default as FF_Cell_Display } from './FF_Cell_Display.svelte';
2
3
  import { default as FF_Cell } from './FF_Cell.svelte';
3
4
  import { default as FF_Config } from './FF_Config.svelte';
4
- import { default as FF_Display } from './FF_Display.svelte';
5
- import { default as FF_Edit } from './FF_Edit.svelte';
6
- import { default as FF_Error } from './FF_Error.svelte';
7
- import { default as FF_Field } from './FF_Field.svelte';
8
5
  import { default as FF_Form } from './FF_Form.svelte';
9
6
  import { default as FF_Grid } from './FF_Grid.svelte';
10
- import { default as FF_Hint } from './FF_Hint.svelte';
11
- import { default as FF_Label } from './FF_Label.svelte';
12
7
  import { default as FF_Layout } from './FF_Layout.svelte';
13
8
  export type { FieldTheme, FormTheme, GridTheme, Theme, EditTheme, DisplayTheme, } from './ff_Config.svelte.js';
14
9
  export { getDynamicCustomField, getTheme, setDynamicCustomField, setTheme, getClasses, daisyTheme, defaultTheme, emptyTheme, FF_Theme, } from './ff_Config.svelte.js';
15
- export { FF_Grid, FF_Form, FF_Field, FF_Edit, FF_Config, FF_Display, FF_Label, FF_Error, FF_Hint, FF_Layout, FF_Cell, };
10
+ export { FF_Grid, FF_Form, FF_Config, FF_Layout, FF_Cell, FF_Cell_Display };
16
11
  export type { DynamicCustomField, FieldGroup } from './customField';
17
12
  export { FF_Repo } from './FF_Repo.svelte.js';
18
13
  export { tryCatch, tryCatchSync } from './tryCatch';
@@ -1,16 +1,11 @@
1
+ import { default as FF_Cell_Display } from './FF_Cell_Display.svelte';
1
2
  import { default as FF_Cell } from './FF_Cell.svelte';
2
3
  import { default as FF_Config } from './FF_Config.svelte';
3
- import { default as FF_Display } from './FF_Display.svelte';
4
- import { default as FF_Edit } from './FF_Edit.svelte';
5
- import { default as FF_Error } from './FF_Error.svelte';
6
- import { default as FF_Field } from './FF_Field.svelte';
7
4
  import { default as FF_Form } from './FF_Form.svelte';
8
5
  import { default as FF_Grid } from './FF_Grid.svelte';
9
- import { default as FF_Hint } from './FF_Hint.svelte';
10
- import { default as FF_Label } from './FF_Label.svelte';
11
6
  import { default as FF_Layout } from './FF_Layout.svelte';
12
7
  export { getDynamicCustomField, getTheme, setDynamicCustomField, setTheme, getClasses, daisyTheme, defaultTheme, emptyTheme, FF_Theme, } from './ff_Config.svelte.js';
13
- export { FF_Grid, FF_Form, FF_Field, FF_Edit, FF_Config, FF_Display, FF_Label, FF_Error, FF_Hint, FF_Layout, FF_Cell, };
8
+ export { FF_Grid, FF_Form, FF_Config, FF_Layout, FF_Cell, FF_Cell_Display };
14
9
  export { FF_Repo } from './FF_Repo.svelte.js';
15
10
  export { tryCatch, tryCatchSync } from './tryCatch';
16
11
  export { overwriteOptions, deepMerge, isOfType } from './helpers';
@@ -7,24 +7,40 @@
7
7
 
8
8
  import { BaseEnum, tw } from '../internals'
9
9
 
10
- export let isLoading = false
11
- let className: string | undefined | null = undefined
12
- export { className as class }
10
+ // TODO: extend HTMLButtonAttributes ?
11
+ interface Props {
12
+ isLoading?: boolean
13
+ permission?: BaseEnum[] | BaseEnum | undefined
14
+ tooltip?: import('svelte').Snippet
15
+ class?: string
16
+ children?: import('svelte').Snippet
17
+ disabled?: boolean | null
18
+ [key: string]: any
19
+ }
13
20
 
14
- export let permission: BaseEnum[] | BaseEnum | undefined = undefined
21
+ let {
22
+ isLoading = false,
23
+ class: className = '',
24
+ permission = undefined,
25
+ children,
26
+ tooltip,
27
+ disabled: disabledProp,
28
+ ...rest
29
+ }: Props = $props()
15
30
 
16
- let permissionDisabled = false
17
- $: disabled = $$restProps.disabled || permissionDisabled || isLoading
31
+ let permissionDisabled = $state(false)
32
+ let disabled = $derived(disabledProp || permissionDisabled || isLoading)
18
33
 
19
34
  // let's trigger the annimation if it's more than 200ms
20
- let triggerAnnimation = false
21
- $: isLoading &&
22
- setTimeout(() => {
23
- if (isLoading) {
24
- // eslint-disable-next-line
25
- triggerAnnimation = true
26
- }
27
- }, 200)
35
+ let triggerAnnimation = $state(false)
36
+ $effect(() => {
37
+ isLoading &&
38
+ setTimeout(() => {
39
+ if (isLoading) {
40
+ triggerAnnimation = true
41
+ }
42
+ }, 200)
43
+ })
28
44
 
29
45
  let updates = (param: { permission: BaseEnum[] | BaseEnum | undefined }) => {
30
46
  if (param && param.permission) {
@@ -42,7 +58,7 @@
42
58
  }
43
59
  }
44
60
 
45
- let disabledWhy = ''
61
+ let disabledWhy = $state('')
46
62
  const isAllowed: Action<HTMLElement, { permission: BaseEnum[] | BaseEnum | undefined }> = (
47
63
  node,
48
64
  param,
@@ -81,14 +97,14 @@
81
97
 
82
98
  <button
83
99
  {...$trigger}
100
+ use:trigger
84
101
  use:isAllowed={{ permission }}
85
- on:click
86
- {...$$restProps}
87
- class={tw(['btn text-white', disabled ? '' : 'btn-primary', className])}
102
+ {...rest}
103
+ class={tw(['btn', className])}
88
104
  {disabled}
89
105
  >
90
106
  <!-- btn-outline -->
91
- <slot />
107
+ {@render children?.()}
92
108
  {#if triggerAnnimation && isLoading}
93
109
  <div in:fly={{ x: -20 }}>
94
110
  <span class="loading loading-spinner"></span>
@@ -96,7 +112,7 @@
96
112
  {/if}
97
113
  </button>
98
114
 
99
- {#if $open && (disabledWhy || $$slots.tooltip)}
115
+ {#if $open && (disabledWhy || tooltip)}
100
116
  <div
101
117
  {...$content}
102
118
  use:content
@@ -105,8 +121,8 @@
105
121
  >
106
122
  <div {...$arrow} use:arrow></div>
107
123
  <div class="px-4 py-1">
108
- {#if $$slots.tooltip}
109
- <slot name="tooltip" />
124
+ {#if tooltip}
125
+ {@render tooltip?.()}
110
126
  {:else}
111
127
  {disabledWhy}
112
128
  {/if}
@@ -1,37 +1,13 @@
1
1
  import { BaseEnum } from '../internals';
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;
12
- };
13
- z_$$bindings?: Bindings;
2
+ interface Props {
3
+ isLoading?: boolean;
4
+ permission?: BaseEnum[] | BaseEnum | undefined;
5
+ tooltip?: import('svelte').Snippet;
6
+ class?: string;
7
+ children?: import('svelte').Snippet;
8
+ disabled?: boolean | null;
9
+ [key: string]: any;
14
10
  }
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 Button: $$__sveltets_2_IsomorphicComponent<$$__sveltets_2_PropsWithChildren<{
21
- [x: string]: any;
22
- isLoading?: boolean | undefined;
23
- class?: string | undefined | null | undefined;
24
- permission?: BaseEnum<any> | BaseEnum<any>[] | undefined;
25
- }, {
26
- default: {};
27
- tooltip: {};
28
- }>, {
29
- click: MouseEvent;
30
- } & {
31
- [evt: string]: CustomEvent<any>;
32
- }, {
33
- default: {};
34
- tooltip: {};
35
- }, {}, string>;
36
- type Button = InstanceType<typeof Button>;
11
+ declare const Button: import("svelte").Component<Props, {}, "">;
12
+ type Button = ReturnType<typeof Button>;
37
13
  export default Button;
@@ -1,13 +1,15 @@
1
1
  <script lang="ts">
2
- /**
3
- * @param value to set in the clipboard if not null.
4
- *
5
- * Don't put this on an input, if not, when a user will select the input via the mouse, this clipboard will be copied (usually you wanted to paste)!
6
- */
7
- export let value: string | null
8
- export { extraClass as class }
2
+ interface Props {
3
+ /**
4
+ * @param value to set in the clipboard if not null. *
5
+ * Don't put this on an input, if not, when a user will select the input via the mouse, this clipboard will be copied (usually you wanted to paste)!
6
+ */
7
+ value: string | null
8
+ class?: string
9
+ children?: import('svelte').Snippet
10
+ }
9
11
 
10
- let extraClass = ''
12
+ let { value, class: extraClass = '', children }: Props = $props()
11
13
 
12
14
  async function clip(_value: string | null) {
13
15
  if (_value) {
@@ -18,12 +20,6 @@
18
20
  }
19
21
  </script>
20
22
 
21
- <span
22
- role="button"
23
- tabindex="0"
24
- on:keyup={() => {}}
25
- on:click={() => clip(value)}
26
- class={`${value ? 'cursor-copy' : ''} ${extraClass}`}
27
- >
28
- <slot />
29
- </span>
23
+ <button onclick={() => clip(value)} class={`text-left ${value ? 'cursor-copy' : ''} ${extraClass}`}>
24
+ {@render children?.()}
25
+ </button>
@@ -1,36 +1,12 @@
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;
11
- };
12
- z_$$bindings?: Bindings;
13
- }
14
- type $$__sveltets_2_PropsWithChildren<Props, Slots> = Props & (Slots extends {
15
- default: any;
16
- } ? Props extends Record<string, never> ? any : {
17
- children?: any;
18
- } : {});
19
- declare const Clipboardable: $$__sveltets_2_IsomorphicComponent<$$__sveltets_2_PropsWithChildren<{
1
+ interface Props {
20
2
  /**
21
- * @param value to set in the clipboard if not null.
22
- *
23
- * Don't put this on an input, if not, when a user will select the input via the mouse, this clipboard will be copied (usually you wanted to paste)!
24
- */ value: string | null;
3
+ * @param value to set in the clipboard if not null. *
4
+ * Don't put this on an input, if not, when a user will select the input via the mouse, this clipboard will be copied (usually you wanted to paste)!
5
+ */
6
+ value: string | null;
25
7
  class?: string;
26
- }, {
27
- default: {};
28
- }>, {
29
- [evt: string]: CustomEvent<any>;
30
- }, {
31
- default: {};
32
- }, {
33
- class: string;
34
- }, string>;
35
- type Clipboardable = InstanceType<typeof Clipboardable>;
8
+ children?: import('svelte').Snippet;
9
+ }
10
+ declare const Clipboardable: import("svelte").Component<Props, {}, "">;
11
+ type Clipboardable = ReturnType<typeof Clipboardable>;
36
12
  export default Clipboardable;