firstly 0.0.10 → 0.0.12

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 (112) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/esm/BaseEnum.d.ts +2 -0
  3. package/esm/BaseEnum.js +2 -0
  4. package/esm/FF_Fields.js +0 -1
  5. package/esm/ROUTES.d.ts +2 -2
  6. package/esm/ROUTES.js +10 -5
  7. package/esm/SqlDatabase/FF_LogToConsole.d.ts +1 -0
  8. package/esm/SqlDatabase/FF_LogToConsole.js +22 -16
  9. package/esm/api/index.d.ts +19 -21
  10. package/esm/api/index.js +72 -62
  11. package/esm/auth/{client/Auth.d.ts → AuthController.d.ts} +18 -25
  12. package/esm/auth/{client/Auth.js → AuthController.js} +48 -44
  13. package/esm/auth/{client/Entities.d.ts → Entities.d.ts} +4 -3
  14. package/esm/auth/{client/Entities.js → Entities.js} +7 -7
  15. package/esm/auth/README.md +0 -10
  16. package/esm/auth/index.d.ts +5 -149
  17. package/esm/auth/index.js +5 -316
  18. package/esm/auth/{AuthController.server.d.ts → server/AuthController.server.d.ts} +10 -10
  19. package/esm/auth/{AuthController.server.js → server/AuthController.server.js} +126 -164
  20. package/esm/auth/server/handleAuth.d.ts +2 -0
  21. package/esm/auth/server/handleAuth.js +140 -0
  22. package/esm/auth/server/helperDb.d.ts +10 -0
  23. package/esm/auth/server/helperDb.js +56 -0
  24. package/esm/auth/server/helperFirstly.d.ts +1 -0
  25. package/esm/auth/server/helperFirstly.js +8 -0
  26. package/esm/auth/server/helperOslo.d.ts +7 -0
  27. package/esm/auth/server/helperOslo.js +24 -0
  28. package/esm/auth/server/helperRemultServer.d.ts +5 -0
  29. package/esm/auth/server/helperRemultServer.js +44 -0
  30. package/esm/auth/{RoleHelpers.d.ts → server/helperRole.d.ts} +1 -1
  31. package/esm/auth/{RoleHelpers.js → server/helperRole.js} +1 -1
  32. package/esm/auth/server/index.d.ts +5 -0
  33. package/esm/auth/server/index.js +5 -0
  34. package/esm/auth/server/module.d.ts +238 -0
  35. package/esm/auth/server/module.js +184 -0
  36. package/esm/auth/{providers → server/providers}/github.d.ts +6 -5
  37. package/esm/auth/{providers → server/providers}/github.js +30 -21
  38. package/esm/auth/{providers/index.d.ts → server/providers/helperProvider.d.ts} +0 -2
  39. package/esm/auth/{providers/index.js → server/providers/helperProvider.js} +5 -6
  40. package/esm/auth/static/assets/{Page-BEFYPjis.d.ts → Page-Bb8bFlrP.d.ts} +1 -1
  41. package/esm/auth/static/assets/{Page-DtgkOCJs.js → Page-Bb8bFlrP.js} +1 -1
  42. package/esm/auth/static/assets/{Page-DtgkOCJs.d.ts → Page-BxomFlZ8.d.ts} +1 -1
  43. package/esm/auth/static/assets/{Page-BEFYPjis.js → Page-BxomFlZ8.js} +1 -1
  44. package/esm/auth/static/assets/Page-CaIYu0-y.d.ts +6 -0
  45. package/esm/auth/static/assets/Page-CaIYu0-y.js +19 -0
  46. package/esm/auth/static/assets/Page-MkYglNtu.css +1 -0
  47. package/esm/auth/static/assets/index-Bl0Bk5u0.d.ts +64 -0
  48. package/esm/auth/static/assets/index-Bl0Bk5u0.js +2 -0
  49. package/esm/auth/static/assets/{index-CR_3yNaJ.css → index-R27C_TlP.css} +1 -1
  50. package/esm/auth/static/index.html +2 -2
  51. package/esm/auth/types.d.ts +5 -0
  52. package/esm/bin/cmd.js +13 -22
  53. package/esm/cellsBuildor.js +6 -6
  54. package/esm/changeLog/index.d.ts +0 -36
  55. package/esm/changeLog/index.js +3 -43
  56. package/esm/changeLog/server/index.d.ts +36 -0
  57. package/esm/changeLog/server/index.js +42 -0
  58. package/esm/cron/{index.d.ts → server/index.d.ts} +1 -1
  59. package/esm/cron/server/index.js +103 -0
  60. package/esm/feedback/FeedbackController.js +3 -3
  61. package/esm/feedback/index.d.ts +0 -16
  62. package/esm/feedback/index.js +0 -11
  63. package/esm/feedback/server/index.d.ts +17 -0
  64. package/esm/feedback/server/index.js +13 -0
  65. package/esm/feedback/ui/DialogIssue.svelte +4 -2
  66. package/esm/feedback/ui/DialogIssues.svelte +13 -4
  67. package/esm/feedback/ui/DialogMilestones.svelte +1 -1
  68. package/esm/feedback/ui/Feedback.svelte +3 -1
  69. package/esm/helper.d.ts +0 -1
  70. package/esm/helper.js +3 -17
  71. package/esm/index.d.ts +3 -17
  72. package/esm/index.js +3 -4
  73. package/esm/mail/index.d.ts +2 -30
  74. package/esm/mail/index.js +2 -79
  75. package/esm/mail/server/index.d.ts +31 -0
  76. package/esm/mail/server/index.js +88 -0
  77. package/esm/storeItem.d.ts +4 -1
  78. package/esm/storeItem.js +8 -2
  79. package/esm/storeList.d.ts +5 -2
  80. package/esm/storeList.js +1 -1
  81. package/esm/sveltekit/server/index.d.ts +11 -0
  82. package/esm/sveltekit/server/index.js +21 -0
  83. package/esm/ui/Button.svelte +1 -1
  84. package/esm/ui/Clipboardable.svelte +5 -2
  85. package/esm/ui/Field.svelte +4 -1
  86. package/esm/ui/Loading.svelte +4 -1
  87. package/esm/ui/Tooltip.svelte +2 -2
  88. package/esm/ui/dialog/DialogForm.svelte +1 -1
  89. package/esm/ui/dialog/DialogPrimitive.svelte +1 -2
  90. package/esm/ui/dialog/dialog.d.ts +6 -3
  91. package/esm/ui/dialog/dialog.js +1 -1
  92. package/esm/ui/internals/FieldContainer.svelte +0 -1
  93. package/esm/ui/internals/Input.svelte +3 -1
  94. package/esm/ui/internals/Textarea.svelte +2 -2
  95. package/esm/vite/index.js +24 -25
  96. package/package.json +50 -38
  97. package/esm/auth/Adapter.d.ts +0 -10
  98. package/esm/auth/Adapter.js +0 -50
  99. package/esm/auth/client/index.d.ts +0 -7
  100. package/esm/auth/client/index.js +0 -7
  101. package/esm/auth/helper.d.ts +0 -6
  102. package/esm/auth/helper.js +0 -14
  103. package/esm/auth/providers/strava.d.ts +0 -30
  104. package/esm/auth/providers/strava.js +0 -60
  105. package/esm/auth/static/assets/Page-BGTO8LC5.css +0 -1
  106. package/esm/auth/static/assets/Page-Cfysx_UV.d.ts +0 -6
  107. package/esm/auth/static/assets/Page-Cfysx_UV.js +0 -18
  108. package/esm/auth/static/assets/index-QypqCYwC.d.ts +0 -63
  109. package/esm/auth/static/assets/index-QypqCYwC.js +0 -2
  110. package/esm/cron/index.js +0 -102
  111. package/esm/handle/index.d.ts +0 -7
  112. package/esm/handle/index.js +0 -40
@@ -1,30 +1,2 @@
1
- import type * as typeNodemailer from 'nodemailer';
2
- import type JSONTransport from 'nodemailer/lib/json-transport';
3
- import type Mail from 'nodemailer/lib/mailer';
4
- import type SendmailTransport from 'nodemailer/lib/sendmail-transport';
5
- import type SESTransport from 'nodemailer/lib/ses-transport';
6
- import type SMTPPool from 'nodemailer/lib/smtp-pool';
7
- import type SMTPTransport from 'nodemailer/lib/smtp-transport';
8
- import type StreamTransport from 'nodemailer/lib/stream-transport';
9
- import type { ComponentProps, ComponentType, SvelteComponent } from 'svelte';
10
- import { DefaultMail } from '../';
11
- export type TransportTypes = SMTPTransport | SMTPTransport.Options | string | SMTPPool | SMTPPool.Options | SendmailTransport | SendmailTransport.Options | StreamTransport | StreamTransport.Options | JSONTransport | JSONTransport.Options | SESTransport | SESTransport.Options | typeNodemailer.Transport<any> | typeNodemailer.TransportOptions;
12
- export type DefaultOptions = SMTPTransport.Options | SMTPPool.Options | SendmailTransport.Options | StreamTransport.Options | JSONTransport.Options | SESTransport.Options | typeNodemailer.TransportOptions;
13
- export type MailOptions<ComponentTemplateDefault extends SvelteComponent> = {
14
- from?: Mail.Options['from'];
15
- template?: {
16
- component?: ComponentType<ComponentTemplateDefault>;
17
- brandColor?: string;
18
- };
19
- transport?: TransportTypes;
20
- defaults?: DefaultOptions;
21
- apiUrl?: Parameters<typeof typeNodemailer.createTestAccount>[0];
22
- };
23
- declare let transporter: ReturnType<typeof typeNodemailer.createTransport>;
24
- export declare const mailInit: (nodemailer: typeof typeNodemailer, o?: MailOptions<SvelteComponent>) => void;
25
- export declare const sendMail: <ComponentTemplateDefault extends SvelteComponent = DefaultMail>(
26
- /** usefull for logs, it has NO impact on the mail itself */
27
- topic: string, mailOptions: Parameters<typeof transporter.sendMail>[0] & {
28
- templateProps?: ComponentProps<ComponentTemplateDefault> | undefined;
29
- }) => ReturnType<typeof transporter.sendMail>;
30
- export {};
1
+ import { default as DefaultMail } from './templates/DefaultMail.svelte';
2
+ export { DefaultMail };
package/esm/mail/index.js CHANGED
@@ -1,79 +1,2 @@
1
- import { render } from 'svelty-email';
2
- import { cyan, green, Log, magenta, red, sleep, white } from '@kitql/helpers';
3
- import { DefaultMail } from '../';
4
- const log = new Log('firstly | mail');
5
- let nodemailerHolder;
6
- let transporter;
7
- let globalOptions;
8
- export const mailInit = async (nodemailer, o) => {
9
- nodemailerHolder = nodemailer;
10
- globalOptions = o;
11
- if (o?.transport) {
12
- transporter = nodemailerHolder.createTransport(o?.transport, o?.defaults);
13
- }
14
- else {
15
- try {
16
- nodemailer.createTestAccount(globalOptions?.apiUrl ?? '', (err, account) => {
17
- if (account) {
18
- globalOptions = { ...globalOptions, from: account.user };
19
- transporter = nodemailer.createTransport({
20
- host: account.smtp.host,
21
- port: account.smtp.port,
22
- secure: account.smtp.secure,
23
- auth: {
24
- user: account.user,
25
- pass: account.pass,
26
- },
27
- });
28
- }
29
- else {
30
- log.error("Error nodemailer.createTestAccount() can't be done.");
31
- }
32
- });
33
- }
34
- catch (error) {
35
- log.error("Error nodemailer.createTestAccount() can't be done.");
36
- }
37
- }
38
- };
39
- export const sendMail = async (topic, mailOptions) => {
40
- // if the transporter is not ready, wait for it! (it can happen only if nothing is set...)
41
- for (let i = 0; i < 30; i++) {
42
- if (transporter !== undefined) {
43
- break;
44
- }
45
- await sleep(100);
46
- }
47
- try {
48
- if (!mailOptions.html) {
49
- const template = globalOptions?.template?.component ?? DefaultMail;
50
- const props = {
51
- brandColor: globalOptions?.template?.brandColor ?? '#5B68DF',
52
- ...mailOptions.templateProps,
53
- };
54
- mailOptions.text = render({ template, props, options: { plainText: true, pretty: true } });
55
- mailOptions.html = render({ template, props, options: { plainText: false, pretty: true } });
56
- }
57
- const info = await transporter.sendMail({
58
- ...mailOptions,
59
- ...{ from: mailOptions.from ?? globalOptions?.from },
60
- });
61
- if (!globalOptions?.transport) {
62
- log.error(`${magenta(`[${topic}]`)} - ⚠️ ${red(`mail not configured`)} ⚠️
63
- We are still nice and generated you an email preview link:
64
- 👉 ${cyan(String(nodemailerHolder.getTestMessageUrl(
65
- // @ts-ignore
66
- info)))}
67
-
68
- To really send mails, check out the doc ${white(`https://firstly.fun/modules/mail`)}.
69
- `);
70
- }
71
- else {
72
- log.success(`${magenta(`[${topic}]`)} - Sent to ${typeof mailOptions.to === 'string' ? green(mailOptions.to) : mailOptions.to}`);
73
- }
74
- return info;
75
- }
76
- catch (error) {
77
- log.error(`${magenta(`[${topic}]`)} - Error`, error);
78
- }
79
- };
1
+ import { default as DefaultMail } from './templates/DefaultMail.svelte';
2
+ export { DefaultMail };
@@ -0,0 +1,31 @@
1
+ import type * as typeNodemailer from 'nodemailer';
2
+ import type JSONTransport from 'nodemailer/lib/json-transport';
3
+ import type Mail from 'nodemailer/lib/mailer';
4
+ import type SendmailTransport from 'nodemailer/lib/sendmail-transport';
5
+ import type SESTransport from 'nodemailer/lib/ses-transport';
6
+ import type SMTPPool from 'nodemailer/lib/smtp-pool';
7
+ import type SMTPTransport from 'nodemailer/lib/smtp-transport';
8
+ import type StreamTransport from 'nodemailer/lib/stream-transport';
9
+ import type { ComponentProps, ComponentType, SvelteComponent } from 'svelte';
10
+ import { Module } from '../../api';
11
+ import { default as DefaultMail } from '../templates/DefaultMail.svelte';
12
+ export type TransportTypes = SMTPTransport | SMTPTransport.Options | string | SMTPPool | SMTPPool.Options | SendmailTransport | SendmailTransport.Options | StreamTransport | StreamTransport.Options | JSONTransport | JSONTransport.Options | SESTransport | SESTransport.Options | typeNodemailer.Transport<any> | typeNodemailer.TransportOptions;
13
+ export type DefaultOptions = SMTPTransport.Options | SMTPPool.Options | SendmailTransport.Options | StreamTransport.Options | JSONTransport.Options | SESTransport.Options | typeNodemailer.TransportOptions;
14
+ export type MailOptions<ComponentTemplateDefault extends SvelteComponent> = {
15
+ from?: Mail.Options['from'];
16
+ template?: {
17
+ component?: ComponentType<ComponentTemplateDefault>;
18
+ brandColor?: string;
19
+ };
20
+ transport?: TransportTypes;
21
+ defaults?: DefaultOptions;
22
+ apiUrl?: Parameters<typeof typeNodemailer.createTestAccount>[0];
23
+ };
24
+ declare let transporter: ReturnType<typeof typeNodemailer.createTransport>;
25
+ export declare const sendMail: <ComponentTemplateDefault extends SvelteComponent = DefaultMail>(
26
+ /** usefull for logs, it has NO impact on the mail itself */
27
+ topic: string, mailOptions: Parameters<typeof transporter.sendMail>[0] & {
28
+ templateProps?: ComponentProps<ComponentTemplateDefault> | undefined;
29
+ }) => ReturnType<typeof transporter.sendMail>;
30
+ export declare const mail: (o?: MailOptions<SvelteComponent>) => Module;
31
+ export {};
@@ -0,0 +1,88 @@
1
+ import nodemailer from 'nodemailer';
2
+ import { render } from 'svelty-email';
3
+ import { cyan, green, magenta, red, sleep, white } from '@kitql/helpers';
4
+ import { Module } from '../../api';
5
+ import { default as DefaultMail } from '../templates/DefaultMail.svelte';
6
+ let transporter;
7
+ let globalOptions;
8
+ const initMail = async (o) => {
9
+ globalOptions = o;
10
+ if (o?.transport) {
11
+ transporter = nodemailer.createTransport(o?.transport, o?.defaults);
12
+ }
13
+ else {
14
+ try {
15
+ nodemailer.createTestAccount(globalOptions?.apiUrl ?? '', (err, account) => {
16
+ if (account) {
17
+ globalOptions = { ...globalOptions, from: account.user };
18
+ transporter = nodemailer.createTransport({
19
+ host: account.smtp.host,
20
+ port: account.smtp.port,
21
+ secure: account.smtp.secure,
22
+ auth: {
23
+ user: account.user,
24
+ pass: account.pass,
25
+ },
26
+ });
27
+ }
28
+ else {
29
+ mailModule.log.error("Error nodemailer.createTestAccount() can't be done.");
30
+ }
31
+ });
32
+ }
33
+ catch (error) {
34
+ mailModule.log.error("Error nodemailer.createTestAccount() can't be done.");
35
+ }
36
+ }
37
+ };
38
+ export const sendMail = async (topic, mailOptions) => {
39
+ // if the transporter is not ready, wait for it! (it can happen only if nothing is set...)
40
+ for (let i = 0; i < 30; i++) {
41
+ if (transporter !== undefined) {
42
+ break;
43
+ }
44
+ await sleep(100);
45
+ }
46
+ try {
47
+ if (!mailOptions.html) {
48
+ const template = globalOptions?.template?.component ?? DefaultMail;
49
+ const props = {
50
+ brandColor: globalOptions?.template?.brandColor ?? '#5B68DF',
51
+ ...mailOptions.templateProps,
52
+ };
53
+ mailOptions.text = render({ template, props, options: { plainText: true, pretty: true } });
54
+ mailOptions.html = render({ template, props, options: { plainText: false, pretty: true } });
55
+ }
56
+ const info = await transporter.sendMail({
57
+ ...mailOptions,
58
+ ...{ from: mailOptions.from ?? globalOptions?.from },
59
+ });
60
+ if (!globalOptions?.transport) {
61
+ mailModule.log.error(`${magenta(`[${topic}]`)} - ⚠️ ${red(`mail not configured`)} ⚠️
62
+ We are still nice and generated you an email preview link:
63
+ 👉 ${cyan(String(nodemailer.getTestMessageUrl(
64
+ // @ts-ignore
65
+ info)))}
66
+
67
+ To really send mails, check out the doc ${white(`https://firstly.fun/modules/mail`)}.
68
+ `);
69
+ }
70
+ else {
71
+ mailModule.log.success(`${magenta(`[${topic}]`)} - Sent to ${typeof mailOptions.to === 'string' ? green(mailOptions.to) : mailOptions.to}`);
72
+ }
73
+ return info;
74
+ }
75
+ catch (error) {
76
+ mailModule.log.error(`${magenta(`[${topic}]`)} - Error`, error);
77
+ }
78
+ };
79
+ const mailModule = new Module({
80
+ name: 'mail',
81
+ priority: -778,
82
+ });
83
+ export const mail = (o) => {
84
+ mailModule.initApi = () => {
85
+ initMail(o);
86
+ };
87
+ return mailModule;
88
+ };
@@ -6,7 +6,10 @@ type TheStoreItem<T> = {
6
6
  globalError?: string | undefined;
7
7
  };
8
8
  export declare const storeItem: <T>(repo: Repository<T>, initValues?: TheStoreItem<T>) => {
9
- subscribe: (this: void, run: import("svelte/store").Subscriber<TheStoreItem<T>>, invalidate?: import("svelte/store").Invalidator<TheStoreItem<T>> | undefined) => import("svelte/store").Unsubscriber;
9
+ subscribe: {
10
+ (this: void, run: import("svelte/store").Subscriber<TheStoreItem<T>>, invalidate?: import("svelte/store").Invalidator<TheStoreItem<T>> | undefined): import("svelte/store").Unsubscriber;
11
+ (this: void, run: import("svelte/store").Subscriber<TheStoreItem<T>>, invalidate?: (() => void) | undefined): import("svelte/store").Unsubscriber;
12
+ };
10
13
  create: (item: Partial<T>) => void;
11
14
  set: (newItem: TheStoreItem<T>) => void;
12
15
  /**
package/esm/storeItem.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { BROWSER } from 'esm-env';
2
2
  import { derived, get, writable } from 'svelte/store';
3
- import { Log } from '@kitql/helpers';
3
+ import { ff_Log } from './';
4
4
  import { isError } from './helper';
5
5
  export const storeItem = (repo, initValues = {
6
6
  item: undefined,
@@ -87,6 +87,7 @@ export const storeItem = (repo, initValues = {
87
87
  if (!s.item) {
88
88
  return;
89
89
  }
90
+ internalStore.update((s) => ({ ...s, loading: true }));
90
91
  const item = await repo.save(s.item);
91
92
  internalStore.update((s) => ({
92
93
  ...s,
@@ -130,11 +131,16 @@ export const storeItem = (repo, initValues = {
130
131
  delete: async () => {
131
132
  const s = get(internalStore);
132
133
  if (!s.item) {
133
- new Log('firstly').error(`To delete an item, you need set it first.`);
134
+ ff_Log.error(`To delete an item, you need set it first.`);
134
135
  return;
135
136
  }
136
137
  try {
138
+ internalStore.update((s) => ({ ...s, loading: true }));
137
139
  await repo.delete(s.item);
140
+ internalStore.update((s) => ({
141
+ ...s,
142
+ loading: false,
143
+ }));
138
144
  }
139
145
  catch (error) {
140
146
  if (isError(error)) {
@@ -18,14 +18,17 @@ export type FF_FindOptions<T> = FindOptions<T> & {
18
18
  * Example
19
19
  * ```ts
20
20
  * // get the repo
21
- * const taskRepo = remult.repo(Task)
21
+ * const taskRepo = repo(Task)
22
22
  *
23
23
  * const tasks = kitStore(taskRepo, data.tasks)
24
24
  * $: browser && tasks.listen(data.options)
25
25
  * ```
26
26
  */
27
27
  export declare const storeList: <T>(repo: Repository<T>, initValues?: TheStoreList<T>) => {
28
- subscribe: (this: void, run: import("svelte/store").Subscriber<TheStoreList<T>>, invalidate?: import("svelte/store").Invalidator<TheStoreList<T>> | undefined) => import("svelte/store").Unsubscriber;
28
+ subscribe: {
29
+ (this: void, run: import("svelte/store").Subscriber<TheStoreList<T>>, invalidate?: import("svelte/store").Invalidator<TheStoreList<T>> | undefined): import("svelte/store").Unsubscriber;
30
+ (this: void, run: import("svelte/store").Subscriber<TheStoreList<T>>, invalidate?: (() => void) | undefined): import("svelte/store").Unsubscriber;
31
+ };
29
32
  manualSet: (info: TheStoreList<T>) => void;
30
33
  fetch: (options?: FF_FindOptions<T>, onNewData?: (items?: T[], totalCount?: number) => void) => Promise<void>;
31
34
  listen: (options?: FF_FindOptions<T>) => Promise<void>;
package/esm/storeList.js CHANGED
@@ -9,7 +9,7 @@ import { writable } from 'svelte/store';
9
9
  * Example
10
10
  * ```ts
11
11
  * // get the repo
12
- * const taskRepo = remult.repo(Task)
12
+ * const taskRepo = repo(Task)
13
13
  *
14
14
  * const tasks = kitStore(taskRepo, data.tasks)
15
15
  * $: browser && tasks.listen(data.options)
@@ -0,0 +1,11 @@
1
+ import type { RequestEvent } from '@sveltejs/kit';
2
+ import { Module } from '../../api';
3
+ declare module 'remult' {
4
+ interface RemultContext {
5
+ request: RequestEvent;
6
+ setHeaders(headers: Record<string, string>): void;
7
+ setCookie(...args: Parameters<RequestEvent['cookies']['set']>): void;
8
+ deleteCookie(...args: Parameters<RequestEvent['cookies']['delete']>): void;
9
+ }
10
+ }
11
+ export declare const sveltekit: () => Module;
@@ -0,0 +1,21 @@
1
+ import { remult } from 'remult';
2
+ import { Module } from '../../api';
3
+ export const sveltekit = () => {
4
+ return new Module({
5
+ name: 'sveltekit',
6
+ priority: -779,
7
+ entities: [],
8
+ controllers: [],
9
+ initRequest: async (kitEvent, op) => {
10
+ remult.context.setHeaders = (headers) => {
11
+ kitEvent.setHeaders(headers);
12
+ };
13
+ remult.context.setCookie = (name, value, opts) => {
14
+ kitEvent.cookies.set(name, value, opts);
15
+ };
16
+ remult.context.deleteCookie = (name, opts) => {
17
+ kitEvent.cookies.delete(name, opts);
18
+ };
19
+ },
20
+ });
21
+ };
@@ -81,7 +81,7 @@ const {
81
81
  transition:fade={{ duration: 100 }}
82
82
  class="bg-base-300 z-30 rounded-lg ring-1 ring-black"
83
83
  >
84
- <div {...$arrow} use:arrow />
84
+ <div {...$arrow} use:arrow></div>
85
85
  <div class="px-4 py-1">
86
86
  {#if $$slots.tooltip}
87
87
  <slot name="tooltip" />
@@ -1,9 +1,12 @@
1
1
  <script>export let value;
2
2
  export { extraClass as class };
3
3
  let extraClass = "";
4
- function clip(_value) {
4
+ async function clip(_value) {
5
5
  if (_value) {
6
- navigator.clipboard.writeText(_value);
6
+ try {
7
+ await navigator.clipboard.writeText(_value);
8
+ } catch (error) {
9
+ }
7
10
  }
8
11
  }
9
12
  </script>
@@ -61,6 +61,9 @@ const toInput = (_metadata, _value) => {
61
61
  };
62
62
  const fromInput = (_metadata, _value) => {
63
63
  try {
64
+ if (_metadata.allowNull && _value === null) {
65
+ return null;
66
+ }
64
67
  return _metadata?.valueConverter.fromInput(_value, metaType.subKind);
65
68
  } catch (error2) {
66
69
  console.error(`error fromInput w field '${_metadata.key}'`, error2);
@@ -138,7 +141,7 @@ const calcSuffix = (value2) => {
138
141
  label={cell?.header ?? cell.field?.caption ?? cell.field?.key}
139
142
  required={!cell.field?.allowNull && mode === 'edit' && metaType.subKind !== 'checkbox'}
140
143
  {error}
141
- classes={{ slot: metaType.subKind === 'textarea' ? 'h-32 items-start' : '' }}
144
+ classes={{ slot: metaType.subKind === 'textarea' ? 'h-24 items-start' : '' }}
142
145
  >
143
146
  {@const clearableComputed =
144
147
  cell.clearable || clearable || (mode === 'filtre' && clearable === undefined)}
@@ -5,7 +5,10 @@ let extraClass = "";
5
5
 
6
6
  <!-- To fix one capa & cadb are on the same css -->
7
7
  <div
8
- class={tw('skeleton bg-base-content/20 flex h-4 w-full items-center justify-center', extraClass)}
8
+ class={tw(
9
+ 'skeleton bg-base-content/20 flex h-4 w-full items-center justify-center rounded-lg',
10
+ extraClass,
11
+ )}
9
12
  >
10
13
  <slot />
11
14
  </div>
@@ -30,12 +30,12 @@ const {
30
30
  transition:fade={{ duration: 100 }}
31
31
  class="bg-base-300 z-30 rounded-lg ring-1 ring-black"
32
32
  >
33
- <div {...$arrow} use:arrow />
33
+ <div {...$arrow} use:arrow></div>
34
34
  <div class="px-4 py-1">
35
35
  {#if $$slots.tooltip}
36
36
  <slot name="tooltip" />
37
37
  {:else}
38
- {text}
38
+ {@html text}
39
39
  {/if}
40
40
  </div>
41
41
  </div>
@@ -25,7 +25,7 @@ const onInsert = async () => {
25
25
  dialog.close(toShow.id, { success: true, item: result });
26
26
  }
27
27
  } catch (e) {
28
- if (!toShow.noThrow) {
28
+ if (toShow.reThrow) {
29
29
  throw e;
30
30
  }
31
31
  } finally {
@@ -37,7 +37,7 @@ function dispatchChange(_data) {
37
37
  use:$overlay.action
38
38
  class="bg-base-300/80 fixed inset-0 z-40 blur-sm"
39
39
  transition:fade={{ duration: 150 }}
40
- />
40
+ ></div>
41
41
  <div
42
42
  class={tw(
43
43
  `border-base-content/60 bg-base-100 relative z-40 max-h-[90vh] overflow-auto rounded-xl border p-6 shadow-lg`,
@@ -69,7 +69,6 @@ function dispatchChange(_data) {
69
69
  </div>
70
70
 
71
71
  <div class="flex h-full min-w-[25rem] flex-col gap-4">
72
- <!-- FIXME: ERMIN? overflow? -->
73
72
  <!-- <div class="overflow-y-auto"> -->
74
73
  <slot />
75
74
 
@@ -19,7 +19,7 @@ export type DialogMetaData<entityType = any> = {
19
19
  component?: new (...args: any[]) => SvelteComponent;
20
20
  props?: any;
21
21
  children?: any;
22
- noThrow?: boolean;
22
+ reThrow?: boolean;
23
23
  wDelete?: boolean;
24
24
  focusKey?: string;
25
25
  topicPrefixText?: string;
@@ -33,7 +33,7 @@ export type DialogFormType<entityType> = {
33
33
  cells?: CellsInput<entityType>;
34
34
  defaults?: Partial<entityType>;
35
35
  classes?: DialogClasses;
36
- noThrow?: boolean;
36
+ reThrow?: boolean;
37
37
  wDelete?: boolean;
38
38
  topicPrefixText?: string;
39
39
  focusKey?: string;
@@ -50,6 +50,9 @@ export declare const dialog: {
50
50
  show: (dialog: DialogMetaData) => Promise<ResultClose<any>>;
51
51
  close: (id: number, result: ResultClose) => void;
52
52
  closeAll: () => void;
53
- subscribe: (this: void, run: import("svelte/store").Subscriber<DialogMetaDataInternal<any>[]>, invalidate?: import("svelte/store").Invalidator<DialogMetaDataInternal<any>[]> | undefined) => import("svelte/store").Unsubscriber;
53
+ subscribe: {
54
+ (this: void, run: import("svelte/store").Subscriber<DialogMetaDataInternal<any>[]>, invalidate?: import("svelte/store").Invalidator<DialogMetaDataInternal<any>[]> | undefined): import("svelte/store").Unsubscriber;
55
+ (this: void, run: import("svelte/store").Subscriber<DialogMetaDataInternal<any>[]>, invalidate?: (() => void) | undefined): import("svelte/store").Unsubscriber;
56
+ };
54
57
  };
55
58
  export {};
@@ -62,7 +62,7 @@ const createDialogManagement = () => {
62
62
  cells: settings.cells ?? [],
63
63
  defaults: settings?.defaults,
64
64
  classes: settings?.classes,
65
- noThrow: settings?.noThrow,
65
+ reThrow: settings?.reThrow,
66
66
  wDelete: settings?.wDelete,
67
67
  focusKey: settings?.focusKey,
68
68
  topicPrefixText,
@@ -12,7 +12,6 @@ export let classes = {};
12
12
  {label}{required ? ' *' : ''}
13
13
  </span>
14
14
  {#if error}
15
- <!-- TODO Ermin? hover popup if too long? -->
16
15
  <span class="label-text-alt text-error truncate">{error}</span>
17
16
  {/if}
18
17
  </label>
@@ -33,7 +33,9 @@ const handleInput = (e) => {
33
33
  const target = e.target;
34
34
  if ($$restProps.type === "number") {
35
35
  if (e.data === "." || e.data === ",") {
36
- e.preventDefault();
36
+ value = target.value.toString().replaceAll(",", ".");
37
+ } else if (target.value === "") {
38
+ value = null;
37
39
  } else {
38
40
  value = target.value.toString().replaceAll(",", ".");
39
41
  }
@@ -2,7 +2,7 @@
2
2
  import { scrollbar } from "../../theme";
3
3
  export let name = null;
4
4
  export let id = "";
5
- export let rows = 6;
5
+ export let rows = 4;
6
6
  export let placeholder = "";
7
7
  export let focus = false;
8
8
  export let value = "";
@@ -57,5 +57,5 @@ function dispatchInput(value2) {
57
57
  // @ts-ignore
58
58
  dispatchInput(e.target.value)
59
59
  }}
60
- />
60
+ ></textarea>
61
61
  {/if}
package/esm/vite/index.js CHANGED
@@ -1,34 +1,33 @@
1
- import { mergeConfig } from 'vite';
1
+ import {} from 'vite';
2
2
  import { kitRoutes } from 'vite-plugin-kit-routes';
3
3
  import { stripper } from 'vite-plugin-stripper';
4
4
  // import { Log } from '@kitql/helpers'
5
- // const toRemove = ['oslo/password', 'oslo', '@node-rs/argon2', '@node-rs/bcrypt']
5
+ // const toRemove = ['@node-rs/argon2', '@node-rs/bcrypt']
6
6
  // oslo needs to be in the dependencies (not devDependencies) !!
7
- const toRemove = ['oslo/password', 'oslo'];
7
+ // const toRemove = ['oslo/password', 'oslo']
8
8
  export function firstly(options) {
9
- // const log = new Log('firstly')
10
- // console.log(`toRemove`, toRemove)
9
+ // @ts-ignore
11
10
  return [
12
- {
13
- name: 'vite-plugin-firstly',
14
- enforce: 'pre',
15
- config: async (a) => {
16
- return mergeConfig(a, {
17
- build: {
18
- // THE ERROR:
19
- // RollupError: Unexpected character '�' or Unexpected character '\u{7f}'
20
- // This code (A) is to fix in `build` mode
21
- rollupOptions: {
22
- external: toRemove,
23
- },
24
- },
25
- // This code (B) is to fix in `dev` mode
26
- optimizeDeps: {
27
- exclude: toRemove,
28
- },
29
- });
30
- },
31
- },
11
+ // {
12
+ // name: 'vite-plugin-firstly',
13
+ // enforce: 'pre',
14
+ // config: async (a) => {
15
+ // return mergeConfig(a, {
16
+ // build: {
17
+ // // THE ERROR:
18
+ // // RollupError: Unexpected character '�' or Unexpected character '\u{7f}'
19
+ // // This code (A) is to fix in `build` mode
20
+ // rollupOptions: {
21
+ // external: toRemove,
22
+ // },
23
+ // },
24
+ // // This code (B) is to fix in `dev` mode
25
+ // optimizeDeps: {
26
+ // exclude: toRemove,
27
+ // },
28
+ // })
29
+ // },
30
+ // },
32
31
  // @ts-ignore
33
32
  ...kitRoutes({
34
33
  ...(options?.kitRoutes ?? {}),