firstly 0.0.11 → 0.0.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -0
- package/esm/BaseEnum.d.ts +2 -0
- package/esm/BaseEnum.js +2 -0
- package/esm/FF_Fields.js +0 -1
- package/esm/ROUTES.d.ts +2 -2
- package/esm/ROUTES.js +10 -5
- package/esm/SqlDatabase/FF_LogToConsole.d.ts +1 -0
- package/esm/SqlDatabase/FF_LogToConsole.js +22 -16
- package/esm/api/index.d.ts +20 -21
- package/esm/api/index.js +74 -62
- package/esm/auth/{client/Auth.d.ts → AuthController.d.ts} +18 -25
- package/esm/auth/{client/Auth.js → AuthController.js} +48 -44
- package/esm/auth/{client/Entities.d.ts → Entities.d.ts} +4 -3
- package/esm/auth/{client/Entities.js → Entities.js} +7 -7
- package/esm/auth/README.md +0 -10
- package/esm/auth/index.d.ts +5 -149
- package/esm/auth/index.js +5 -316
- package/esm/auth/{AuthController.server.d.ts → server/AuthController.server.d.ts} +10 -10
- package/esm/auth/{AuthController.server.js → server/AuthController.server.js} +133 -171
- package/esm/auth/server/handleAuth.d.ts +2 -0
- package/esm/auth/server/handleAuth.js +140 -0
- package/esm/auth/server/handleGuard.d.ts +16 -0
- package/esm/auth/server/handleGuard.js +67 -0
- package/esm/auth/server/helperDb.d.ts +10 -0
- package/esm/auth/server/helperDb.js +56 -0
- package/esm/auth/server/helperFirstly.d.ts +1 -0
- package/esm/auth/server/helperFirstly.js +8 -0
- package/esm/auth/server/helperOslo.d.ts +7 -0
- package/esm/auth/server/helperOslo.js +24 -0
- package/esm/auth/server/helperRemultServer.d.ts +5 -0
- package/esm/auth/server/helperRemultServer.js +44 -0
- package/esm/auth/{RoleHelpers.d.ts → server/helperRole.d.ts} +1 -1
- package/esm/auth/{RoleHelpers.js → server/helperRole.js} +1 -1
- package/esm/auth/server/index.d.ts +7 -0
- package/esm/auth/server/index.js +7 -0
- package/esm/auth/server/module.d.ts +257 -0
- package/esm/auth/server/module.js +197 -0
- package/esm/auth/{providers → server/providers}/github.d.ts +6 -4
- package/esm/auth/{providers → server/providers}/github.js +29 -20
- package/esm/auth/{providers/index.d.ts → server/providers/helperProvider.d.ts} +0 -2
- package/esm/auth/{providers/index.js → server/providers/helperProvider.js} +5 -6
- package/esm/auth/static/assets/Page-BUfjaN-D.d.ts +5 -0
- package/esm/auth/static/assets/Page-BUfjaN-D.js +19 -0
- package/esm/auth/static/assets/Page-CJ58H1vl.css +1 -0
- package/esm/auth/static/assets/Page-CaDAqmBS.d.ts +5 -0
- package/esm/auth/static/assets/Page-CaDAqmBS.js +1 -0
- package/esm/auth/static/assets/Page-DhdZddzJ.d.ts +5 -0
- package/esm/auth/static/assets/Page-DhdZddzJ.js +1 -0
- package/esm/auth/static/assets/index-BDy4A_14.css +4 -0
- package/esm/auth/static/assets/index-D-Ztdt2o.d.ts +54 -0
- package/esm/auth/static/assets/index-D-Ztdt2o.js +2 -0
- package/esm/auth/static/index.html +11 -11
- package/esm/auth/types.d.ts +5 -0
- package/esm/bin/cmd.js +122 -54
- package/esm/cellsBuildor.js +7 -7
- package/esm/changeLog/index.d.ts +0 -36
- package/esm/changeLog/index.js +3 -43
- package/esm/changeLog/server/index.d.ts +36 -0
- package/esm/changeLog/server/index.js +42 -0
- package/esm/common.d.ts +5 -0
- package/esm/common.js +8 -0
- package/esm/cron/{index.d.ts → server/index.d.ts} +1 -1
- package/esm/cron/server/index.js +103 -0
- package/esm/feedback/FeedbackController.js +4 -5
- package/esm/feedback/index.d.ts +0 -16
- package/esm/feedback/index.js +0 -11
- package/esm/feedback/server/index.d.ts +17 -0
- package/esm/feedback/server/index.js +13 -0
- package/esm/feedback/ui/DialogIssue.svelte +52 -56
- package/esm/feedback/ui/DialogIssues.svelte +71 -71
- package/esm/feedback/ui/DialogMilestones.svelte +22 -22
- package/esm/helper.js +3 -3
- package/esm/index.d.ts +3 -20
- package/esm/index.js +3 -10
- package/esm/mail/index.d.ts +2 -30
- package/esm/mail/index.js +2 -79
- package/esm/mail/server/index.d.ts +31 -0
- package/esm/mail/server/index.js +88 -0
- package/esm/mail/templates/DefaultMail.svelte +17 -17
- package/esm/storeItem.js +8 -2
- package/esm/storeList.d.ts +1 -1
- package/esm/storeList.js +1 -1
- package/esm/sveltekit/server/index.d.ts +14 -0
- package/esm/sveltekit/server/index.js +24 -0
- package/esm/ui/Button.svelte +33 -33
- package/esm/ui/Button.svelte.d.ts +2 -2
- package/esm/ui/Clipboardable.svelte +11 -8
- package/esm/ui/Clipboardable.svelte.d.ts +4 -4
- package/esm/ui/Field.svelte +142 -149
- package/esm/ui/Field.svelte.d.ts +2 -2
- package/esm/ui/FieldGroup.svelte +38 -38
- package/esm/ui/Grid.svelte +212 -222
- package/esm/ui/GridLoading.svelte +18 -22
- package/esm/ui/GridPaginate.svelte +38 -38
- package/esm/ui/Icon.svelte +50 -49
- package/esm/ui/Icon.svelte.d.ts +18 -18
- package/esm/ui/Loading.svelte +5 -2
- package/esm/ui/Tooltip.svelte +16 -16
- package/esm/ui/dialog/DialogForm.svelte +23 -23
- package/esm/ui/dialog/DialogManagement.svelte +74 -74
- package/esm/ui/dialog/DialogPrimitive.svelte +50 -51
- package/esm/ui/dialog/FormEditAction.svelte +34 -34
- package/esm/ui/dialog/dialog.d.ts +2 -2
- package/esm/ui/dialog/dialog.js +1 -1
- package/esm/ui/internals/FieldContainer.svelte +11 -12
- package/esm/ui/internals/FieldContainer.svelte.d.ts +3 -3
- package/esm/ui/internals/Input.svelte +25 -25
- package/esm/ui/internals/Input.svelte.d.ts +1 -1
- package/esm/ui/internals/Textarea.svelte +21 -21
- package/esm/ui/internals/Textarea.svelte.d.ts +2 -2
- package/esm/ui/internals/select/MultiSelectMelt.svelte +69 -73
- package/esm/ui/internals/select/SelectMelt.svelte +86 -86
- package/esm/ui/internals/select/SelectRadio.svelte +22 -22
- package/esm/ui/link/Link.svelte +14 -14
- package/esm/ui/link/Link.svelte.d.ts +3 -4
- package/esm/ui/link/LinkPlus.svelte +33 -35
- package/esm/vite/index.js +24 -25
- package/package.json +50 -42
- package/esm/auth/Adapter.d.ts +0 -10
- package/esm/auth/Adapter.js +0 -50
- package/esm/auth/client/index.d.ts +0 -7
- package/esm/auth/client/index.js +0 -7
- package/esm/auth/helper.d.ts +0 -6
- package/esm/auth/helper.js +0 -14
- package/esm/auth/providers/strava.d.ts +0 -30
- package/esm/auth/providers/strava.js +0 -60
- package/esm/auth/static/assets/Page-BEFYPjis.d.ts +0 -4
- package/esm/auth/static/assets/Page-BEFYPjis.js +0 -1
- package/esm/auth/static/assets/Page-BGTO8LC5.css +0 -1
- package/esm/auth/static/assets/Page-Cfysx_UV.d.ts +0 -6
- package/esm/auth/static/assets/Page-Cfysx_UV.js +0 -18
- package/esm/auth/static/assets/Page-DtgkOCJs.d.ts +0 -4
- package/esm/auth/static/assets/Page-DtgkOCJs.js +0 -1
- package/esm/auth/static/assets/index-CR_3yNaJ.css +0 -4
- package/esm/auth/static/assets/index-QypqCYwC.d.ts +0 -63
- package/esm/auth/static/assets/index-QypqCYwC.js +0 -2
- package/esm/cron/index.js +0 -102
- package/esm/handle/index.d.ts +0 -7
- package/esm/handle/index.js +0 -40
package/esm/mail/index.js
CHANGED
|
@@ -1,79 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
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
|
+
};
|
|
@@ -45,22 +45,22 @@ const button = {
|
|
|
45
45
|
</script>
|
|
46
46
|
|
|
47
47
|
<Html>
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
48
|
+
<Head />
|
|
49
|
+
<Preview preview={previewText ?? title + '...'} />
|
|
50
|
+
<Section style={main}>
|
|
51
|
+
<Container style={container}>
|
|
52
|
+
{#if title}
|
|
53
|
+
<Heading style={heading}>{title}</Heading>
|
|
54
|
+
{/if}
|
|
55
55
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
56
|
+
{#each sections as s}
|
|
57
|
+
<Text style={s.highlighted ? highlighted : paragraph}>
|
|
58
|
+
{s.text}
|
|
59
|
+
</Text>
|
|
60
|
+
{#if s.cta}
|
|
61
|
+
<Button pY={19} style={button} href={s.cta.link}>{s.cta.text}</Button>
|
|
62
|
+
{/if}
|
|
63
|
+
{/each}
|
|
64
|
+
</Container>
|
|
65
|
+
</Section>
|
|
66
66
|
</Html>
|
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 {
|
|
3
|
+
import { ff_Log } from './common.js';
|
|
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
|
-
|
|
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)) {
|
package/esm/storeList.d.ts
CHANGED
|
@@ -18,7 +18,7 @@ export type FF_FindOptions<T> = FindOptions<T> & {
|
|
|
18
18
|
* Example
|
|
19
19
|
* ```ts
|
|
20
20
|
* // get the repo
|
|
21
|
-
* const taskRepo =
|
|
21
|
+
* const taskRepo = repo(Task)
|
|
22
22
|
*
|
|
23
23
|
* const tasks = kitStore(taskRepo, data.tasks)
|
|
24
24
|
* $: browser && tasks.listen(data.options)
|
package/esm/storeList.js
CHANGED
|
@@ -0,0 +1,14 @@
|
|
|
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
|
+
/**
|
|
12
|
+
* @deprecated will be done directly in remult when modules will be in 😉
|
|
13
|
+
*/
|
|
14
|
+
export declare const sveltekit: () => Module;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { remult } from 'remult';
|
|
2
|
+
import { Module } from '../../api';
|
|
3
|
+
/**
|
|
4
|
+
* @deprecated will be done directly in remult when modules will be in 😉
|
|
5
|
+
*/
|
|
6
|
+
export const sveltekit = () => {
|
|
7
|
+
return new Module({
|
|
8
|
+
name: 'sveltekit',
|
|
9
|
+
priority: -779,
|
|
10
|
+
entities: [],
|
|
11
|
+
controllers: [],
|
|
12
|
+
initRequest: async (kitEvent, op) => {
|
|
13
|
+
remult.context.setHeaders = (headers) => {
|
|
14
|
+
kitEvent.setHeaders(headers);
|
|
15
|
+
};
|
|
16
|
+
remult.context.setCookie = (name, value, opts) => {
|
|
17
|
+
kitEvent.cookies.set(name, value, opts);
|
|
18
|
+
};
|
|
19
|
+
remult.context.deleteCookie = (name, opts) => {
|
|
20
|
+
kitEvent.cookies.delete(name, opts);
|
|
21
|
+
};
|
|
22
|
+
},
|
|
23
|
+
});
|
|
24
|
+
};
|
package/esm/ui/Button.svelte
CHANGED
|
@@ -57,44 +57,44 @@ const {
|
|
|
57
57
|
</script>
|
|
58
58
|
|
|
59
59
|
<button
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
60
|
+
{...$trigger}
|
|
61
|
+
use:trigger
|
|
62
|
+
use:isAllowed={{ permission }}
|
|
63
|
+
on:click
|
|
64
|
+
{...$$restProps}
|
|
65
|
+
class={tw(['btn text-white', disabled ? '' : 'btn-primary', className])}
|
|
66
|
+
{disabled}
|
|
67
67
|
>
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
68
|
+
<!-- btn-outline -->
|
|
69
|
+
<slot />
|
|
70
|
+
{#if triggerAnnimation && isLoading}
|
|
71
|
+
<div in:fly={{ x: -20 }}>
|
|
72
|
+
<span class="loading loading-spinner"></span>
|
|
73
|
+
</div>
|
|
74
|
+
{/if}
|
|
75
75
|
</button>
|
|
76
76
|
|
|
77
77
|
{#if $open && (disabledWhy || $$slots.tooltip)}
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
78
|
+
<div
|
|
79
|
+
{...$content}
|
|
80
|
+
use:content
|
|
81
|
+
transition:fade={{ duration: 100 }}
|
|
82
|
+
class="bg-base-300 z-30 rounded-lg ring-1 ring-black"
|
|
83
|
+
>
|
|
84
|
+
<div {...$arrow} use:arrow></div>
|
|
85
|
+
<div class="px-4 py-1">
|
|
86
|
+
{#if $$slots.tooltip}
|
|
87
|
+
<slot name="tooltip" />
|
|
88
|
+
{:else}
|
|
89
|
+
{disabledWhy}
|
|
90
|
+
{/if}
|
|
91
|
+
</div>
|
|
92
|
+
</div>
|
|
93
93
|
{/if}
|
|
94
94
|
|
|
95
95
|
<style>
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
96
|
+
.btn[disabled] {
|
|
97
|
+
pointer-events: all;
|
|
98
|
+
cursor: not-allowed;
|
|
99
|
+
}
|
|
100
100
|
</style>
|
|
@@ -4,8 +4,8 @@ declare const __propDef: {
|
|
|
4
4
|
props: {
|
|
5
5
|
[x: string]: any;
|
|
6
6
|
isLoading?: boolean | undefined;
|
|
7
|
-
class?: string | undefined | null;
|
|
8
|
-
permission?: BaseEnum
|
|
7
|
+
class?: string | undefined | null | undefined;
|
|
8
|
+
permission?: BaseEnum<any> | BaseEnum<any>[] | undefined;
|
|
9
9
|
};
|
|
10
10
|
events: {
|
|
11
11
|
click: MouseEvent;
|
|
@@ -1,19 +1,22 @@
|
|
|
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
|
-
|
|
6
|
+
try {
|
|
7
|
+
await navigator.clipboard.writeText(_value);
|
|
8
|
+
} catch (error) {
|
|
9
|
+
}
|
|
7
10
|
}
|
|
8
11
|
}
|
|
9
12
|
</script>
|
|
10
13
|
|
|
11
14
|
<span
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
role="button"
|
|
16
|
+
tabindex="0"
|
|
17
|
+
on:keyup={() => {}}
|
|
18
|
+
on:click={() => clip(value)}
|
|
19
|
+
class={`${value ? 'cursor-copy' : ''} ${extraClass}`}
|
|
17
20
|
>
|
|
18
|
-
|
|
21
|
+
<slot />
|
|
19
22
|
</span>
|
|
@@ -2,10 +2,10 @@ import { SvelteComponent } from "svelte";
|
|
|
2
2
|
declare const __propDef: {
|
|
3
3
|
props: {
|
|
4
4
|
/**
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
* @param value to set in the clipboard if not null.
|
|
6
|
+
*
|
|
7
|
+
* 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)!
|
|
8
|
+
*/ value: string | null;
|
|
9
9
|
class?: string;
|
|
10
10
|
};
|
|
11
11
|
events: {
|