5htp-core 0.6.0-5 → 0.6.0-65

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.
@@ -177,10 +177,10 @@
177
177
 
178
178
  .apply-theme({
179
179
  alpha: false;
180
- background: #D7FEEE;
181
- foreground: darken( #D7FEEE, 80% );
182
- accent1: #111;
183
- accent2: #111;
180
+ background: #179e50;
181
+ foreground: #fff;
182
+ accent1: #fff;
183
+ accent2: #fff;
184
184
  });
185
185
 
186
186
  &.light {
@@ -236,10 +236,10 @@
236
236
 
237
237
  .apply-theme({
238
238
  alpha: false;
239
- background: lighten( @cInfo, 50% );
240
- foreground: darken( @cInfo, 50% );
241
- accent1: #111;
242
- accent2: #111;
239
+ background: #6C5DD3;
240
+ foreground: #fff;
241
+ accent1: #fff;
242
+ accent2: #fff;
243
243
  });
244
244
 
245
245
  &.light {
@@ -26,7 +26,11 @@ export default (initProps: Props) => {
26
26
  - INIT
27
27
  ----------------------------------*/
28
28
 
29
- const [{ title, onChange }, { errors, required, ...props }] = useMantineInput<Props>(initProps);
29
+ const [{ title, onChange, value }, { errors, required, ...props }] = useMantineInput<Props>(initProps);
30
+
31
+ if (initProps.title === 'Exact match')
32
+ console.log("Checkbox", initProps, props);
33
+
30
34
 
31
35
  /*----------------------------------
32
36
  - RENDER
@@ -36,6 +40,7 @@ export default (initProps: Props) => {
36
40
  label={title}
37
41
  error={errors?.join(', ')}
38
42
  required={required}
43
+ checked={value}
39
44
  {...props}
40
45
  onChange={e => onChange?.(e.target.checked)}
41
46
  />
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "5htp-core",
3
3
  "description": "Convenient TypeScript framework designed for Performance and Productivity.",
4
- "version": "0.6.0-5",
4
+ "version": "0.6.0-65",
5
5
  "author": "Gaetan Le Gac (https://github.com/gaetanlegac)",
6
6
  "repository": "git://github.com/gaetanlegac/5htp-core.git",
7
7
  "license": "MIT",
@@ -2,10 +2,6 @@
2
2
  - DEPENDANCES
3
3
  ----------------------------------*/
4
4
 
5
- /* NOTE: On évite d'utiliser les alias ici,
6
- Afin que l'envoi des rapports de bug fonctionne même en cas d'erreur avec les alias
7
- */
8
-
9
5
  // Core
10
6
  import type { Application } from '@server/app';
11
7
  import Service from '@server/app/service';
@@ -13,7 +9,6 @@ import markdown from '@common/data/markdown';
13
9
 
14
10
  // Speciic
15
11
  import { jsonToHtml } from './utils';
16
- import type { Transporter } from './transporter';
17
12
 
18
13
  /*----------------------------------
19
14
  - SERVICE CONFIG
@@ -25,16 +20,12 @@ export type Config = {
25
20
  debug: boolean,
26
21
  simulateWhenLocal: boolean,
27
22
  default: {
28
- transporter: string,
29
23
  from: TPerson
30
24
  },
31
25
  bugReport: {
32
26
  from: TPerson,
33
27
  to: TPerson
34
28
  },
35
- transporters: {
36
- [transporterId: string]: Transporter
37
- }
38
29
  }
39
30
 
40
31
  export type Hooks = {
@@ -49,9 +40,7 @@ export type Services = {
49
40
  - TYPES: EMAILS
50
41
  ----------------------------------*/
51
42
 
52
- export { Transporter } from './transporter';
53
-
54
- export type TEmail = THtmlEmail | TMarkdownEmail// | TTemplateEmail;
43
+ export type TEmail = THtmlEmail | TMarkdownEmail;
55
44
 
56
45
  type TPerson = {
57
46
  name?: string,
@@ -74,11 +63,6 @@ export type TMarkdownEmail = TBaseEmail & {
74
63
  markdown: string,
75
64
  }
76
65
 
77
- /*export type TTemplateEmail = TBaseEmail & {
78
- template: keyof typeof templates,
79
- data?: TObjetDonnees
80
- }*/
81
-
82
66
  export type TCompleteEmail = With<THtmlEmail, {
83
67
  to: TPerson[],
84
68
  from: TPerson,
@@ -109,14 +93,15 @@ type TOptions = {
109
93
  /*----------------------------------
110
94
  - FONCTIONS
111
95
  ----------------------------------*/
112
- export default class Email extends Service<Config, Hooks, Application> {
113
-
114
- private transporters = this.config.transporters;
96
+ export default abstract class Email<TConfig extends Config>
97
+ extends Service<TConfig, Hooks, Application> {
115
98
 
116
99
  /*----------------------------------
117
100
  - ACTIONS
118
101
  ----------------------------------*/
119
102
 
103
+ protected abstract sendNow( emails: TCompleteEmail[] ): Promise<void>;
104
+
120
105
  public async send( to: string, subject: string, markdown: string, options?: TOptions );
121
106
  public async send( emails: TEmail | TEmail[], options?: TOptions ): Promise<void>;
122
107
  public async send( ...args: TEmailSendArgs ): Promise<void> {
@@ -162,30 +147,7 @@ export default class Email extends Service<Config, Hooks, Application> {
162
147
  ? email.to
163
148
  : [email.to];
164
149
 
165
- // Via template
166
- // TODO: Restore templates feature
167
- /*if ('template' in email) {
168
-
169
- const template = templates[email.template];
170
-
171
- if (template === undefined)
172
- throw new Error(`Impossible de charger la template email ${email.template} depuis le cache (NotFound).`);
173
-
174
- const txt = template(email.data || {})
175
-
176
- const delimTitre = txt.indexOf('\n\n');
177
-
178
- return {
179
- ...email,
180
- // Vire le "> " au début
181
- subject: txt.substring(2, delimTitre),
182
- html: htmlWarning + txt.substring(delimTitre + 2),
183
- from,
184
- to,
185
- cc
186
- }
187
-
188
- } else */if ('markdown' in email) {
150
+ if ('markdown' in email) {
189
151
 
190
152
  return {
191
153
  ...email,
@@ -209,11 +171,7 @@ export default class Email extends Service<Config, Hooks, Application> {
209
171
 
210
172
  });
211
173
 
212
- const transporterName = options.transporter || this.config.default.transporter;
213
- if (transporterName === undefined)
214
- throw new Error(`Please define at least one mail transporter.`);
215
-
216
- console.info(LogPrefix, `Sending ${emailsToSend.length} emails via transporter "${transporterName}"`, emailsToSend[0].subject);
174
+ console.info(LogPrefix, `Sending ${emailsToSend.length} emails via transporter`, emailsToSend[0].subject);
217
175
 
218
176
  // Pas d'envoi d'email quand local
219
177
  if (this.app.env.name === 'local' && this.config.simulateWhenLocal === true) {
@@ -224,8 +182,7 @@ export default class Email extends Service<Config, Hooks, Application> {
224
182
  return;
225
183
  }
226
184
 
227
- const transporter = this.transporters[ transporterName ];
228
- await transporter.send(emailsToSend);
185
+ await this.sendNow(emailsToSend);
229
186
 
230
187
  }
231
188
  }
package/types/icons.d.ts CHANGED
@@ -1 +1 @@
1
- export type TIcones = "times"|"solid/spinner-third"|"long-arrow-right"|"sack-dollar"|"bell"|"bullseye"|"project-diagram"|"user-friends"|"eye"|"lock"|"comments"|"phone"|"chalkboard-teacher"|"rocket"|"planet-ringed"|"brands/linkedin"|"user-circle"|"crosshairs"|"plus-circle"|"comments-alt"|"arrow-right"|"chart-bar"|"user-shield"|"shield-alt"|"chart-line"|"money-bill-wave"|"star"|"link"|"file-alt"|"long-arrow-left"|"calendar-alt"|"paper-plane"|"at"|"search"|"lightbulb"|"magnet"|"key"|"user"|"binoculars"|"times-circle"|"user-plus"|"mouse-pointer"|"thumbs-up"|"dollar-sign"|"angle-up"|"angle-down"|"solid/crown"|"brands/discord"|"pen"|"plus"|"file"|"envelope"|"info-circle"|"check-circle"|"exclamation-circle"|"check"|"arrow-left"|"meh-rolling-eyes"|"bars"|"trash"|"solid/star"|"solid/star-half-alt"|"regular/star"|"chevron-left"|"cog"|"power-off"|"question-circle"|"play"|"minus-circle"|"external-link"|"plane-departure"|"brands/whatsapp"|"wind"|"usd-circle"|"users"|"home"|"home-alt"|"trophy"|"map-marker-alt"|"clock"|"arrow-to-bottom"|"ellipsis-h"|"exclamation-triangle"|"industry"|"map-marker"|"calendar"|"briefcase"|"fire"|"globe"|"solid/magic"|"magic"|"building"|"graduation-cap"|"unlink"|"bold"|"italic"|"underline"|"strikethrough"|"subscript"|"superscript"|"code"|"font"|"empty-set"|"horizontal-rule"|"page-break"|"image"|"table"|"poll"|"columns"|"sticky-note"|"caret-right"|"align-left"|"align-center"|"align-right"|"align-justify"|"indent"|"outdent"|"list-ul"|"check-square"|"h1"|"h2"|"h3"|"h4"|"list-ol"|"paragraph"|"quote-left"
1
+ export type TIcones = "long-arrow-right"|"times"|"solid/spinner-third"|"sack-dollar"|"bell"|"bullseye"|"project-diagram"|"user-friends"|"eye"|"lock"|"comments"|"phone"|"chalkboard-teacher"|"rocket"|"chart-bar"|"planet-ringed"|"user-circle"|"brands/linkedin"|"crosshairs"|"plus-circle"|"comments-alt"|"arrow-right"|"user-shield"|"shield-alt"|"chart-line"|"money-bill-wave"|"star"|"link"|"file-alt"|"long-arrow-left"|"at"|"search"|"lightbulb"|"magnet"|"calendar-alt"|"paper-plane"|"angle-up"|"angle-down"|"user-plus"|"mouse-pointer"|"thumbs-up"|"dollar-sign"|"key"|"user"|"envelope"|"plus"|"solid/crown"|"brands/discord"|"pen"|"file"|"binoculars"|"times-circle"|"info-circle"|"check-circle"|"exclamation-circle"|"check"|"arrow-left"|"meh-rolling-eyes"|"trash"|"solid/star"|"solid/star-half-alt"|"regular/star"|"chevron-left"|"cog"|"power-off"|"usd-circle"|"users"|"home"|"home-alt"|"trophy"|"bars"|"question-circle"|"plane-departure"|"brands/whatsapp"|"wind"|"play"|"minus-circle"|"external-link"|"map-marker-alt"|"clock"|"arrow-to-bottom"|"ellipsis-h"|"exclamation-triangle"|"magic"|"globe"|"industry"|"briefcase"|"map-marker"|"calendar"|"fire"|"building"|"graduation-cap"|"unlink"|"bold"|"italic"|"underline"|"strikethrough"|"subscript"|"superscript"|"code"|"font"|"empty-set"|"horizontal-rule"|"page-break"|"image"|"table"|"poll"|"columns"|"sticky-note"|"caret-right"|"align-left"|"align-center"|"align-right"|"align-justify"|"indent"|"outdent"|"list-ul"|"check-square"|"h1"|"h2"|"h3"|"h4"|"list-ol"|"paragraph"|"quote-left"|"solid/magic"
@@ -1,6 +0,0 @@
1
- {
2
- "id": "Core/Email",
3
- "name": "Email",
4
- "parent": "app",
5
- "dependences": []
6
- }
@@ -1,49 +0,0 @@
1
- /*----------------------------------
2
- - DEPENDANCES
3
- ----------------------------------*/
4
-
5
- import Handlebars, { TemplateDelegate } from 'handlebars';
6
-
7
- //import * as templates from '@cache/serveur/emails';
8
- import templatesDefault from '@root/default/serveur/emails/*.hbs';
9
- import templatesProjet from '@/*/serveur/emails/*.hbs';
10
- const templates = { ...templatesDefault, ...templatesProjet }
11
- import url from '@commun/routeur/url';
12
-
13
- /*----------------------------------
14
- - HELPERS
15
- ----------------------------------*/
16
-
17
- Handlebars.registerHelper('plur', (mot: string, nb: number) =>
18
- mot + (nb > 1 ? 's' : '')
19
- )
20
-
21
- Handlebars.registerHelper('url', (route: string, params?: any, absolu?: boolean) =>
22
- url(route, params, absolu)
23
- )
24
-
25
- /*----------------------------------
26
- - FONCTIONS
27
- ----------------------------------*/
28
- const cache: {[nomTemplate: string]: TemplateDelegate} = {}
29
-
30
- export const compiler = async () => {
31
-
32
- console.log(`[boot] Précompilation de ${Object.keys(templates).length} templates email`);
33
-
34
- try {
35
- for (const nomTemplate in templates) {
36
-
37
- const template = templates[nomTemplate];
38
-
39
- cache[ nomTemplate ] = Handlebars.compile(template, {
40
- strict: true, // Erreur quand variable inexistante
41
- });
42
-
43
- }
44
- } catch (error) {
45
- console.error(`Erreur lors de la précompilation des templates email:`, error);
46
- }
47
- }
48
-
49
- export default cache
@@ -1,31 +0,0 @@
1
- /*----------------------------------
2
- - DEPENDANCES
3
- ----------------------------------*/
4
-
5
- // Npm
6
-
7
- // Core
8
- import type Application from "@server/app";
9
- import Service from '@server/app/service';
10
- import type EmailService from '@server/services/email';
11
-
12
- // Specific
13
- import type { TCompleteEmail } from ".";
14
-
15
- /*----------------------------------
16
- - TYPES
17
- ----------------------------------*/
18
-
19
- export type TBasicConfig = {
20
- api: string,
21
- debug: boolean
22
- }
23
-
24
- /*----------------------------------
25
- - CLASS
26
- ----------------------------------*/
27
- export abstract class Transporter<TConfig extends TBasicConfig = TBasicConfig>
28
- extends Service<TConfig, {}, Application> {
29
-
30
- public abstract send( emails: TCompleteEmail[] ): Promise<void>;
31
- }