@libs-ui/services-config-project 0.1.1-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.
@@ -0,0 +1,957 @@
1
+ import * as i0 from '@angular/core';
2
+ import { signal, computed, effect, Injectable } from '@angular/core';
3
+ import { colorStepContrastFromOrigin, get } from '@libs-ui/utils';
4
+
5
+ const fontConfig = {
6
+ name: 'SVN-Poppins',
7
+ uri_regular: 'SVN-Poppins-Regular.ttf',
8
+ uri_medium: 'SVN-Poppins-Medium.ttf',
9
+ uri_semibold: 'SVN-Poppins-SemiBold.ttf',
10
+ };
11
+ const weights = {
12
+ uri_regular: '400',
13
+ uri_medium: '500',
14
+ uri_semibold: '600',
15
+ uri_bold: '700',
16
+ };
17
+ const configHeading = {
18
+ h1r: {
19
+ 'font-size': '30px',
20
+ 'font-weight': '400',
21
+ 'line-height': '42px',
22
+ 'letter-spacing': 'calc(30px * (0.5 / 100))',
23
+ },
24
+ h1m: {
25
+ 'font-size': '30px',
26
+ 'font-weight': '500',
27
+ 'line-height': '42px',
28
+ 'letter-spacing': 'calc(30px * (0.5 / 100))',
29
+ },
30
+ h1s: {
31
+ 'font-size': '30px',
32
+ 'font-weight': '600',
33
+ 'line-height': '42px',
34
+ 'letter-spacing': 'calc(30px * (0.5 / 100))',
35
+ },
36
+ h1b: {
37
+ 'font-size': '30px',
38
+ 'font-weight': '700',
39
+ 'line-height': '42px',
40
+ 'letter-spacing': 'calc(30px * (0.5 / 100))',
41
+ },
42
+ h2r: {
43
+ 'font-size': '20px',
44
+ 'font-weight': '400',
45
+ 'line-height': '28px',
46
+ 'letter-spacing': 'calc(20px * (0.5 / 100))',
47
+ },
48
+ h2m: {
49
+ 'font-size': '20px',
50
+ 'font-weight': '500',
51
+ 'line-height': '28px',
52
+ 'letter-spacing': 'calc(20px * (0.5 / 100))',
53
+ },
54
+ h2s: {
55
+ 'font-size': '20px',
56
+ 'font-weight': '600',
57
+ 'line-height': '28px',
58
+ 'letter-spacing': 'calc(20px * (0.5 / 100))',
59
+ },
60
+ h2b: {
61
+ 'font-size': '20px',
62
+ 'font-weight': '400',
63
+ 'line-height': '28px',
64
+ 'letter-spacing': 'calc(20px * (0.5 / 100))',
65
+ },
66
+ h3r: {
67
+ 'font-size': '16px',
68
+ 'font-weight': '400',
69
+ 'line-height': '24px',
70
+ 'letter-spacing': 'calc(16px * (0.5 / 100))',
71
+ },
72
+ h3m: {
73
+ 'font-size': '16px',
74
+ 'font-weight': '500',
75
+ 'line-height': '24px',
76
+ 'letter-spacing': 'calc(16px * (0.5 / 100))',
77
+ },
78
+ h3s: {
79
+ 'font-size': '16px',
80
+ 'font-weight': '600',
81
+ 'line-height': '24px',
82
+ 'letter-spacing': 'calc(16px * (0.5 / 100))',
83
+ },
84
+ h3b: {
85
+ 'font-size': '16px',
86
+ 'font-weight': '700',
87
+ 'line-height': '24px',
88
+ 'letter-spacing': 'calc(16px * (0.5 / 100))',
89
+ },
90
+ h4r: {
91
+ 'font-size': '13px',
92
+ 'font-weight': '400',
93
+ 'line-height': '20px',
94
+ 'letter-spacing': 'calc(13px * (0.5 / 100))',
95
+ },
96
+ h4m: {
97
+ 'font-size': '13px',
98
+ 'font-weight': '500',
99
+ 'line-height': '20px',
100
+ 'letter-spacing': 'calc(13px * (0.5 / 100))',
101
+ },
102
+ h4s: {
103
+ 'font-size': '13px',
104
+ 'font-weight': '600',
105
+ 'line-height': '20px',
106
+ 'letter-spacing': 'calc(13px * (0.5 / 100))',
107
+ },
108
+ h4b: {
109
+ 'font-size': '13px',
110
+ 'font-weight': '700',
111
+ 'line-height': '20px',
112
+ 'letter-spacing': 'calc(13px * (0.5 / 100))',
113
+ },
114
+ h5r: {
115
+ 'font-size': '12px',
116
+ 'font-weight': '400',
117
+ 'line-height': '18px',
118
+ 'letter-spacing': 'calc(12px * (0.5 / 100))',
119
+ },
120
+ h5m: {
121
+ 'font-size': '12px',
122
+ 'font-weight': '500',
123
+ 'line-height': '18px',
124
+ 'letter-spacing': 'calc(12px * (0.5 / 100))',
125
+ },
126
+ h5s: {
127
+ 'font-size': '12px',
128
+ 'font-weight': '600',
129
+ 'line-height': '18px',
130
+ 'letter-spacing': 'calc(12px * (0.5 / 100))',
131
+ },
132
+ h5b: {
133
+ 'font-size': '12px',
134
+ 'font-weight': '700',
135
+ 'line-height': '18px',
136
+ 'letter-spacing': 'calc(12px * (0.5 / 100))',
137
+ },
138
+ h6r: {
139
+ 'font-size': '11px',
140
+ 'font-weight': '400',
141
+ 'line-height': '16px',
142
+ 'letter-spacing': 'calc(11px * (0.5 / 100))',
143
+ },
144
+ h6m: {
145
+ 'font-size': '11px',
146
+ 'font-weight': '500',
147
+ 'line-height': '16px',
148
+ 'letter-spacing': 'calc(11px * (0.5 / 100))',
149
+ },
150
+ h6s: {
151
+ 'font-size': '11px',
152
+ 'font-weight': '600',
153
+ 'line-height': '16px',
154
+ 'letter-spacing': 'calc(11px * (0.5 / 100))',
155
+ },
156
+ h6b: {
157
+ 'font-size': '11px',
158
+ 'font-weight': '700',
159
+ 'line-height': '16px',
160
+ 'letter-spacing': 'calc(11px * (0.5 / 100))',
161
+ },
162
+ h7r: {
163
+ 'font-size': '10px',
164
+ 'font-weight': '400',
165
+ 'line-height': '14px',
166
+ 'letter-spacing': 'calc(11px * (0.5 / 100))',
167
+ },
168
+ h7m: {
169
+ 'font-size': '10px',
170
+ 'font-weight': '500',
171
+ 'line-height': '14px',
172
+ 'letter-spacing': 'calc(11px * (0.5 / 100))',
173
+ },
174
+ h7s: {
175
+ 'font-size': '10px',
176
+ 'font-weight': '600',
177
+ 'line-height': '14px',
178
+ 'letter-spacing': 'calc(11px * (0.5 / 100))',
179
+ },
180
+ h7b: {
181
+ 'font-size': '10px',
182
+ 'font-weight': '700',
183
+ 'line-height': '14px',
184
+ 'letter-spacing': 'calc(11px * (0.5 / 100))',
185
+ },
186
+ };
187
+ const sizeButtonConfig = () => ({
188
+ icon: {
189
+ large: '20px',
190
+ medium: '16px',
191
+ small: '16px',
192
+ smaller: '16px',
193
+ },
194
+ large: {
195
+ font_size: '16px',
196
+ line_height: '24px',
197
+ },
198
+ medium: {
199
+ font_size: '12px',
200
+ line_height: '18px',
201
+ },
202
+ small: {
203
+ font_size: '12px',
204
+ line_height: '18px',
205
+ },
206
+ smaller: {
207
+ font_size: '11px',
208
+ line_height: '16px',
209
+ },
210
+ });
211
+ const configButtonColor = (rootColorInTheme) => {
212
+ return {
213
+ 'button-primary': {
214
+ configStepColor: {
215
+ text: 'white',
216
+ text_hover: 'white',
217
+ text_active: 'white',
218
+ text_disable: '#CDD0D6',
219
+ background: 0,
220
+ background_hover: 20,
221
+ background_active: -20,
222
+ background_disable: '#F8F9FA',
223
+ border: 0,
224
+ border_hover: 20,
225
+ border_active: -20,
226
+ border_disable: '#F8F9FA',
227
+ },
228
+ rootColor: rootColorInTheme,
229
+ },
230
+ 'button-primary-revert': {
231
+ configStepColor: {
232
+ text: 0,
233
+ text_hover: 'white',
234
+ text_active: 'white',
235
+ text_disable: '#CDD0D6',
236
+ background: 'white',
237
+ background_hover: 20,
238
+ background_active: -20,
239
+ background_disable: '#F8F9FA',
240
+ border: 0,
241
+ border_hover: 20,
242
+ border_active: -20,
243
+ border_disable: '#F8F9FA',
244
+ },
245
+ rootColor: rootColorInTheme,
246
+ },
247
+ 'button-secondary': {
248
+ configStepColor: {
249
+ text: 0,
250
+ text_hover: 20,
251
+ text_active: -20,
252
+ text_disable: '#CDD0D6',
253
+ background: 90,
254
+ background_hover: 90,
255
+ background_active: 90,
256
+ background_disable: '#F8F9FA',
257
+ border: 90,
258
+ border_hover: 90,
259
+ border_active: 90,
260
+ border_disable: '#F8F9FA',
261
+ },
262
+ rootColor: rootColorInTheme,
263
+ },
264
+ 'button-third': {
265
+ configStepColor: {
266
+ text: '#6A7383',
267
+ text_hover: 20,
268
+ text_active: -20,
269
+ text_disable: '#CDD0D6',
270
+ background: '#F8F9FA',
271
+ background_hover: 90,
272
+ background_active: 90,
273
+ background_disable: '#F8F9FA',
274
+ border: '#F8F9FA',
275
+ border_hover: 90,
276
+ border_active: 90,
277
+ border_disable: '#F8F9FA',
278
+ },
279
+ rootColor: rootColorInTheme,
280
+ },
281
+ 'button-secondary-red': {
282
+ configStepColor: {
283
+ text: 0,
284
+ text_hover: -20,
285
+ text_active: -20,
286
+ text_disable: '#CDD0D6',
287
+ background: 90,
288
+ background_hover: 90,
289
+ background_active: 90,
290
+ background_disable: '#F8F9FA',
291
+ border: 90,
292
+ border_hover: 90,
293
+ border_active: 90,
294
+ border_disable: '#F8F9FA',
295
+ },
296
+ rootColor: '#EE2D41',
297
+ },
298
+ 'button-outline': {
299
+ configStepColor: {
300
+ text: '#6A7383',
301
+ text_hover: 20,
302
+ text_active: -20,
303
+ text_disable: '#CDD0D6',
304
+ background: 'white',
305
+ background_hover: 'white',
306
+ background_active: 'white',
307
+ background_disable: '#F8F9FA',
308
+ border: '#e6e7ea',
309
+ border_hover: 20,
310
+ border_active: -20,
311
+ border_disable: '#E6E7EA',
312
+ },
313
+ rootColor: rootColorInTheme,
314
+ },
315
+ 'button-danger-high': {
316
+ configStepColor: {
317
+ text: 'white',
318
+ text_hover: 'white',
319
+ text_active: 'white',
320
+ text_disable: '#CDD0D6',
321
+ background: 0,
322
+ background_hover: 20,
323
+ background_active: -20,
324
+ background_disable: '#F8F9FA',
325
+ border: 0,
326
+ border_hover: 20,
327
+ border_active: -20,
328
+ border_disable: '#F8F9FA',
329
+ },
330
+ rootColor: '#ee2d41',
331
+ },
332
+ 'button-danger-low': {
333
+ configStepColor: {
334
+ text: 'white',
335
+ text_hover: 'white',
336
+ text_active: 'white',
337
+ text_disable: '#CDD0D6',
338
+ background: 0,
339
+ background_hover: 20,
340
+ background_active: -20,
341
+ background_disable: '#F8F9FA',
342
+ border: 0,
343
+ border_hover: 20,
344
+ border_active: -20,
345
+ border_disable: '#F8F9FA',
346
+ },
347
+ rootColor: '#ffa621',
348
+ },
349
+ 'button-green': {
350
+ configStepColor: {
351
+ text: 'white',
352
+ text_hover: 'white',
353
+ text_active: 'white',
354
+ text_disable: '#CDD0D6',
355
+ background: 0,
356
+ background_hover: 20,
357
+ background_active: -20,
358
+ background_disable: '#F8F9FA',
359
+ border: 0,
360
+ border_hover: 20,
361
+ border_active: -20,
362
+ border_disable: '#F8F9FA',
363
+ },
364
+ rootColor: '#00d16d',
365
+ },
366
+ 'button-violet': {
367
+ configStepColor: {
368
+ text: 'white',
369
+ text_hover: 'white',
370
+ text_active: 'white',
371
+ text_disable: '#CDD0D6',
372
+ background: 0,
373
+ background_hover: 20,
374
+ background_active: -20,
375
+ background_disable: '#F8F9FA',
376
+ border: 0,
377
+ border_hover: 20,
378
+ border_active: -20,
379
+ border_disable: '#F8F9FA',
380
+ },
381
+ rootColor: '#7239ea',
382
+ },
383
+ 'button-outline-green': {
384
+ configStepColor: {
385
+ text: '#6A7383',
386
+ text_hover: 20,
387
+ text_active: -20,
388
+ text_disable: '#CDD0D6',
389
+ background: 'white',
390
+ background_hover: 'white',
391
+ background_active: 'white',
392
+ background_disable: '#F8F9FA',
393
+ border: '#e6e7ea',
394
+ border_hover: 20,
395
+ border_active: -20,
396
+ border_disable: '#E6E7EA',
397
+ },
398
+ rootColor: '#00d16d',
399
+ },
400
+ 'button-secondary-green': {
401
+ configStepColor: {
402
+ text: 0,
403
+ text_hover: 'white',
404
+ text_active: 'white',
405
+ text_disable: '#CDD0D6',
406
+ background: 90,
407
+ background_hover: 0,
408
+ background_active: 0,
409
+ background_disable: '#F8F9FA',
410
+ border: 0,
411
+ border_hover: 0,
412
+ border_active: 0,
413
+ border_disable: '#F8F9FA',
414
+ },
415
+ rootColor: '#00d16d',
416
+ },
417
+ 'button-outline-secondary': {
418
+ configStepColor: {
419
+ text: 0,
420
+ text_hover: 'white',
421
+ text_active: 'white',
422
+ text_disable: '#CDD0D6',
423
+ background: 90,
424
+ background_hover: 0,
425
+ background_active: 0,
426
+ background_disable: '#F8F9FA',
427
+ border: 0,
428
+ border_hover: 0,
429
+ border_active: 0,
430
+ border_disable: '#E6E7EA',
431
+ },
432
+ rootColor: rootColorInTheme,
433
+ },
434
+ 'button-outline-hover-danger': {
435
+ configStepColor: {
436
+ text: '#6A7383',
437
+ text_hover: 0,
438
+ text_active: -20,
439
+ text_disable: '#CDD0D6',
440
+ background: 'white',
441
+ background_hover: 'white',
442
+ background_active: 'white',
443
+ background_disable: '#F8F9FA',
444
+ border: '#e6e7ea',
445
+ border_hover: 0,
446
+ border_active: -20,
447
+ border_disable: '#e6e7ea',
448
+ },
449
+ rootColor: '#f15767',
450
+ },
451
+ 'button-third-hover-danger': {
452
+ configStepColor: {
453
+ text: '#6A7383',
454
+ text_hover: 20,
455
+ text_active: -20,
456
+ text_disable: '#CDD0D6',
457
+ background: '#F8F9FA',
458
+ background_hover: 90,
459
+ background_active: 90,
460
+ background_disable: '#F8F9FA',
461
+ border: '#F8F9FA',
462
+ border_hover: 90,
463
+ border_active: 90,
464
+ border_disable: '#F8F9FA',
465
+ },
466
+ rootColor: '#EE2D41',
467
+ },
468
+ };
469
+ };
470
+ const configLinkButton = (rootColorInTheme) => {
471
+ return {
472
+ 'button-link-primary': {
473
+ configStepColor: {
474
+ text: 0,
475
+ text_hover: 20,
476
+ text_active: -20,
477
+ text_disable: '#CDD0D6',
478
+ },
479
+ rootColor: rootColorInTheme,
480
+ },
481
+ 'button-link-third': {
482
+ configStepColor: {
483
+ text: '#6A7383',
484
+ text_hover: 20,
485
+ text_active: -20,
486
+ text_disable: '#CDD0D6',
487
+ },
488
+ rootColor: rootColorInTheme,
489
+ },
490
+ 'button-link-danger-high': {
491
+ configStepColor: {
492
+ text: 0,
493
+ text_hover: 20,
494
+ text_active: -20,
495
+ text_disable: '#CDD0D6',
496
+ },
497
+ rootColor: '#ee2d41',
498
+ },
499
+ 'button-link-danger-low': {
500
+ configStepColor: {
501
+ text: 0,
502
+ text_hover: 20,
503
+ text_active: -20,
504
+ text_disable: '#CDD0D6',
505
+ },
506
+ rootColor: '#ffa621',
507
+ },
508
+ 'button-link-green': {
509
+ configStepColor: {
510
+ text: 0,
511
+ text_hover: 20,
512
+ text_active: -20,
513
+ text_disable: '#CDD0D6',
514
+ },
515
+ rootColor: '#00d16d',
516
+ },
517
+ 'button-link-violet': {
518
+ configStepColor: {
519
+ text: 0,
520
+ text_hover: 20,
521
+ text_active: -20,
522
+ text_disable: '#CDD0D6',
523
+ },
524
+ rootColor: '#7239ea',
525
+ },
526
+ };
527
+ };
528
+ const configButtonStatus = () => {
529
+ return {
530
+ blue: {
531
+ color: '#226FF5',
532
+ background: '#E9F1FE',
533
+ },
534
+ green: {
535
+ color: '#00D16D',
536
+ background: '#E6FAF0',
537
+ },
538
+ red: {
539
+ color: '#EE2D41',
540
+ background: '#FDEAEC',
541
+ },
542
+ orange: {
543
+ color: '#F05800',
544
+ background: '#FEEEE6',
545
+ },
546
+ yellow: {
547
+ color: '#FFA621',
548
+ background: '#FFF6E9',
549
+ },
550
+ cyan: {
551
+ color: '#04C8C8',
552
+ background: '#E6FAFA',
553
+ },
554
+ purple: {
555
+ color: '#7239EA',
556
+ background: '#F1EBFD',
557
+ },
558
+ brown: {
559
+ color: '#663259',
560
+ background: '#F0EBEE',
561
+ },
562
+ };
563
+ };
564
+ const configButtonTab = () => {
565
+ return {
566
+ blue: {
567
+ color: '#226FF5',
568
+ background: '#F4F8FF',
569
+ background_badge: '#E9F1FE',
570
+ },
571
+ green: {
572
+ color: '#00D16D',
573
+ background: '#F2FCF7',
574
+ background_badge: '#E6FAF0',
575
+ },
576
+ red: {
577
+ color: '#EE2D41',
578
+ background: '#FDEAEC',
579
+ background_badge: '#FEE9F1',
580
+ },
581
+ orange: {
582
+ color: '#F05800',
583
+ background: '#FEF7F2',
584
+ background_badge: '#FEEEE6',
585
+ },
586
+ yellow: {
587
+ color: '#FFA621',
588
+ background: '#FFFBF4',
589
+ background_badge: '#FFF6E9',
590
+ },
591
+ cyan: {
592
+ color: '#04C8C8',
593
+ background: '#F2FCFC',
594
+ background_badge: '#E6FAFA',
595
+ },
596
+ purple: {
597
+ color: '#7239EA',
598
+ background: '#F8F5FE',
599
+ background_badge: '#F1EBFD',
600
+ },
601
+ brown: {
602
+ color: '#663259',
603
+ background: '#F7F5F7',
604
+ background_badge: '#F0EBEE',
605
+ },
606
+ };
607
+ };
608
+ const styleButtonTab = (type, config) => {
609
+ const background = config.background || colorStepContrastFromOrigin(config.color, 95)?.light;
610
+ const backgroundBadge = config.background_badge || colorStepContrastFromOrigin(config.color, 90)?.light;
611
+ return `.libs-ui-button-tab-${type}[active="true"] {
612
+ background-color: ${background} !important;
613
+ }
614
+
615
+ .libs-ui-button-tab-${type}[active="true"] > .libs-ui-button-tab-label {
616
+ color: ${config.color} !important;
617
+ }
618
+
619
+ .libs-ui-button-tab-${type}[active="true"] > .libs-ui-button-tab-badge > .libs-ui-button-tab-badge-circle {
620
+ color: ${config.color} !important;
621
+ background-color: ${backgroundBadge} !important;
622
+ }`;
623
+ };
624
+
625
+ /* eslint-disable @typescript-eslint/no-explicit-any */
626
+ class LibsUiConfigProjectService {
627
+ themeColor = signal('#226ff5');
628
+ borderColor = signal('#e6e7ea');
629
+ textErrorColor = signal('#ff5454');
630
+ iconHoverDangerColor = signal('#f15767');
631
+ borderErrorColor = signal('#ee2d41');
632
+ backgroundDisableColor = signal('#f8f9fa');
633
+ textReadonlyColor = signal('#071631');
634
+ textDisableColor = signal('#9ca2ad');
635
+ backgroundReadonlyColor = signal('#f8f9fa');
636
+ backgroundUserSelection = signal('#00000040');
637
+ backgroundList = signal('#f8f9fa');
638
+ backgroundListHover = signal('#f8f9fa');
639
+ backgroundListHoverDanger = signal('#fef5f6');
640
+ configFont = signal(fontConfig);
641
+ configHead = signal(configHeading);
642
+ functionGetConfigButtonIncludes = signal(() => {
643
+ return {};
644
+ });
645
+ configButton = computed(() => {
646
+ return { ...configButtonColor(this.themeColor()), ...configLinkButton(this.themeColor()), ...this.functionGetConfigButtonIncludes()(this.themeColor()) };
647
+ });
648
+ configButtonSize = signal(sizeButtonConfig());
649
+ configButtonStatus = signal(configButtonStatus());
650
+ configButtonTab = signal(configButtonTab());
651
+ styleClassGlobalEl = document.createElement('style');
652
+ styleClassHeadEl = document.createElement('style');
653
+ styleClassButtonTabEl = document.createElement('style');
654
+ constructor() {
655
+ effect(() => {
656
+ this.setThemeColor();
657
+ });
658
+ effect(() => {
659
+ this.setupFontFamily();
660
+ });
661
+ effect(() => {
662
+ this.setupFontHead();
663
+ });
664
+ effect(() => {
665
+ this.setupButtonTab();
666
+ });
667
+ effect(() => {
668
+ this.setupButtonSize();
669
+ });
670
+ this.configString();
671
+ this.setClassGlobal();
672
+ }
673
+ set ThemeColor(color) {
674
+ this.themeColor.set(color || '#226ff5');
675
+ }
676
+ set BorderColor(color) {
677
+ this.borderColor.set(color || '#e6e7ea');
678
+ }
679
+ set BorderErrorColor(color) {
680
+ this.borderErrorColor.set(color || '#ee2d41');
681
+ }
682
+ set TextErrorColor(color) {
683
+ this.textErrorColor.set(color || '#ff5454');
684
+ }
685
+ set IconHoverDangerColor(color) {
686
+ this.iconHoverDangerColor.set(color || '#ff5454');
687
+ }
688
+ set BackgroundReadonlyColor(color) {
689
+ this.backgroundReadonlyColor.set(color || '#f15767');
690
+ }
691
+ set TextReadonlyColor(color) {
692
+ this.textReadonlyColor.set(color || '#071631');
693
+ }
694
+ set BackgroundUserSelection(color) {
695
+ this.backgroundUserSelection.set(color || '#00000040');
696
+ }
697
+ set BackgroundList(color) {
698
+ this.backgroundList.set(color || '#f8f9fa');
699
+ }
700
+ set BackgroundListHover(color) {
701
+ this.backgroundListHover.set(color || '#f8f9fa');
702
+ }
703
+ set BackgroundListHoverDanger(color) {
704
+ this.backgroundListHover.set(color || '#fef5f6');
705
+ }
706
+ set BackgroundDisableColor(color) {
707
+ this.backgroundDisableColor.set(color || '#f8f9fa');
708
+ }
709
+ set TextDisableColor(color) {
710
+ this.textDisableColor.set(color || '#9ca2ad');
711
+ }
712
+ set ConfigFont(configFont) {
713
+ this.configFont.set({ ...configFont });
714
+ }
715
+ set ConfigFontHead(configHead) {
716
+ this.configHead.set({ ...configHead });
717
+ }
718
+ get ConfigButton() {
719
+ return this.configButton;
720
+ }
721
+ set FunctionGetConfigButtonIncludes(functionGetConfigButtonIncludes) {
722
+ this.functionGetConfigButtonIncludes.set(functionGetConfigButtonIncludes);
723
+ }
724
+ get ConfigButtonStatus() {
725
+ return this.configButtonStatus();
726
+ }
727
+ set ConfigButtonStatus(config) {
728
+ this.configButtonStatus.set(config);
729
+ }
730
+ set ConfigButtonTab(config) {
731
+ this.configButtonTab.set(config);
732
+ }
733
+ // public hàm để sử dụng cho component input sử dụng tagInput = frameArea;
734
+ setupFontFamily(currentDoc) {
735
+ try {
736
+ currentDoc = currentDoc || document;
737
+ const doc = currentDoc.documentElement;
738
+ doc.style.setProperty('--libs-ui-font-family-name', `${this.configFont().name},Arial, Helvetica, sans-serif`);
739
+ Object.keys(weights).forEach((key) => {
740
+ if (!get(this.configFont(), key)) {
741
+ return;
742
+ }
743
+ const fontFace = new FontFace(this.configFont().name, `url(${get(this.configFont(), key)})`, { weight: get(weights, key) });
744
+ fontFace.load().then((loadedFont) => {
745
+ if (currentDoc && 'add' in currentDoc.fonts) {
746
+ currentDoc.fonts.add(loadedFont);
747
+ }
748
+ });
749
+ });
750
+ }
751
+ catch (error) {
752
+ console.log(error);
753
+ }
754
+ }
755
+ setupFontHead() {
756
+ const configHeadsData = this.configHead();
757
+ let styles = '';
758
+ Object.keys(configHeadsData).forEach((keyConfig) => {
759
+ let style = `font-family:var(--libs-ui-font-family-name,'Arial');`;
760
+ const config = get(configHeadsData, keyConfig);
761
+ Object.keys(config).forEach((key) => {
762
+ style = `${style}${key}:${get(config, key)};`;
763
+ });
764
+ styles = `${styles} .libs-ui-font-${keyConfig}{${style}}.libs-ui-font-${keyConfig}i{${style.replace(/;/g, ' !important;')}}`;
765
+ });
766
+ styles = `*{box-sizing: border-box !important;}${styles}`;
767
+ this.styleClassHeadEl.innerHTML = styles;
768
+ document.head.append(this.styleClassHeadEl);
769
+ }
770
+ setupButtonSize() {
771
+ const configButtonSize = this.configButtonSize();
772
+ const doc = document.documentElement;
773
+ Object.keys(configButtonSize).forEach((keySize) => {
774
+ const config = get(configButtonSize, keySize);
775
+ Object.keys(config).forEach((keyType) => {
776
+ const name = `--libs-ui-button-size-${keySize}-${keyType.replace(/[_]/g, '-')}`;
777
+ doc.style.setProperty(name, get(config, keyType));
778
+ });
779
+ });
780
+ }
781
+ setupButtonTab() {
782
+ const configButtonTab = this.configButtonTab();
783
+ let styles = '';
784
+ Object.keys(configButtonTab).forEach((key) => {
785
+ const config = get(configButtonTab, key);
786
+ const style = config ? styleButtonTab(key, config) : '';
787
+ styles = `${styles}${style}`;
788
+ });
789
+ this.styleClassButtonTabEl.innerHTML = styles;
790
+ document.head.append(this.styleClassButtonTabEl);
791
+ }
792
+ setThemeColor() {
793
+ const doc = document.documentElement;
794
+ [
795
+ {
796
+ group: 'libs-ui',
797
+ type: 'color',
798
+ property: {
799
+ default: colorStepContrastFromOrigin(this.themeColor(), 0)?.light,
800
+ light_1: colorStepContrastFromOrigin(this.themeColor(), 20)?.light,
801
+ light_2: colorStepContrastFromOrigin(this.themeColor(), 90)?.light,
802
+ light_3: colorStepContrastFromOrigin(this.themeColor(), 95)?.light,
803
+ light_4: colorStepContrastFromOrigin(this.themeColor(), 50)?.light,
804
+ light_5: colorStepContrastFromOrigin(this.themeColor(), 70)?.light,
805
+ light_6: colorStepContrastFromOrigin(this.themeColor(), 80)?.light,
806
+ dark: colorStepContrastFromOrigin(this.themeColor(), 20)?.dark,
807
+ background_list: this.backgroundList(),
808
+ background_list_hover: this.backgroundListHover(),
809
+ background_list_hover_danger: this.backgroundListHoverDanger(),
810
+ background_selection: this.backgroundUserSelection(),
811
+ border: this.borderColor(),
812
+ border_error: this.borderErrorColor(),
813
+ text_error: this.textErrorColor(),
814
+ icon_hover_danger: this.iconHoverDangerColor(),
815
+ background_readonly: this.backgroundReadonlyColor(),
816
+ text_readonly: this.textReadonlyColor(),
817
+ background_disable: this.backgroundDisableColor(),
818
+ text_disable: this.textDisableColor(),
819
+ gradient_from: this.themeColor().toLocaleUpperCase() === '#226FF5' ? colorStepContrastFromOrigin(this.themeColor(), 10)?.light : colorStepContrastFromOrigin(this.themeColor(), 0)?.light,
820
+ gradient_to: this.themeColor().toLocaleUpperCase() === '#226FF5' ? colorStepContrastFromOrigin('#5B2EBB', 10)?.light : colorStepContrastFromOrigin(this.themeColor(), 20)?.dark,
821
+ },
822
+ },
823
+ ].forEach((item) => {
824
+ const name = `--${item.group.replace(/[_]/g, '-')}-${item.type.replace(/[_]/g, '-')}`;
825
+ Object.keys(item.property).forEach((key) => doc.style.setProperty(`${name}-${key.replace(/[_]/g, '-')}`, item.property[key]));
826
+ });
827
+ }
828
+ colorStepContrastFromOrigin(step, color) {
829
+ return colorStepContrastFromOrigin(color || this.themeColor(), step || 0);
830
+ }
831
+ setClassGlobal() {
832
+ this.styleClassGlobalEl.innerHTML = `
833
+ .libs-ui-border-primary-general{border: 1px solid var(--libs-ui-color-default, #226FF5);}
834
+ .libs-ui-border-primary-focus-general{border: 1px solid var(--libs-ui-color-light-1, #4e8cf7);}
835
+ .libs-ui-border-primary-hover-general{border: 1px solid var(--libs-ui-color-light-3, #f4f8ff);}
836
+ .libs-ui-border-general{ border: 1px solid var(--libs-ui-color-border, #e6e7ea);}
837
+ .libs-ui-border-top-general{border-top: 1px solid var(--libs-ui-color-border, #e6e7ea);}
838
+ .libs-ui-border-right-general{border-right: 1px solid var(--libs-ui-color-border, #e6e7ea);}
839
+ .libs-ui-border-bottom-general{border-bottom: 1px solid var(--libs-ui-color-border, #e6e7ea);}
840
+ .libs-ui-border-dashed-general{border: dashed 1px var(--libs-ui-color-border, #e6e7ea);}
841
+ .libs-ui-border-top-dashed-general{border-top: dashed 1px var(--libs-ui-color-border, #e6e7ea);}
842
+ .libs-ui-border-left-dashed-general{border-left: dashed 1px var(--libs-ui-color-border, #e6e7ea);}
843
+ .libs-ui-border-right-dashed-general{border-right: dashed 1px var(--libs-ui-color-border, #e6e7ea);}
844
+ .libs-ui-border-bottom-dashed-general{border-bottom: dashed 1px var(--libs-ui-color-border, #e6e7ea);}
845
+ .libs-ui-border-left-general{border-left: 1px solid var(--libs-ui-color-border, #e6e7ea);}
846
+ .libs-ui-border-x-general{border-left: 1px solid var(--libs-ui-color-border, #e6e7ea); border-right: 1px solid var(--libs-ui-color-border, #e6e7ea);}
847
+ .libs-ui-border-y-general{border-top: 1px solid var(--libs-ui-color-border, #e6e7ea); border-bottom: 1px solid var(--libs-ui-color-border, #e6e7ea);}
848
+ .libs-ui-border-left-top-general{border-left: 1px solid var(--libs-ui-color-border, #e6e7ea); border-top: 1px solid var(--libs-ui-color-border, #e6e7ea);}
849
+ .libs-ui-border-left-bottom-general{border-left: 1px solid var(--libs-ui-color-border, #e6e7ea); border-bottom: 1px solid var(--libs-ui-color-border, #e6e7ea);}
850
+ .libs-ui-border-right-top-general{border-right: 1px solid var(--libs-ui-color-border, #e6e7ea); border-top: 1px solid var(--libs-ui-color-border, #e6e7ea);}
851
+ .libs-ui-border-right-bottom-general{border-right: 1px solid var(--libs-ui-color-border, #e6e7ea); border-bottom: 1px solid var(--libs-ui-color-border, #e6e7ea);}
852
+ .libs-ui-border-error-general{border: 1px solid var(--libs-ui-color-border-error, #ee2d41) !important;}
853
+ .libs-ui-bg-list {background-color: var(--libs-ui-background-list, #f8f9fa);}
854
+ .libs-ui-bg-list-hover:hover {background-color: var(--libs-ui-background-list-hover, #f8f9fa);}
855
+ .libs-ui-bg-list-active {background-color: var(--libs-ui-color-light-3, #f4f8ff);}
856
+ .libs-ui-bg-list-hover-active:hover {background-color: #f8f9fa;}
857
+ .libs-ui-bg-list-hover-active:active {background-color: var(--libs-ui-color-light-3, #f4f8ff);}
858
+ .libs-ui-bg-list-hover-danger:hover {background-color: var(--libs-ui-background-list-hover-danger, #fef5f6); color: var(--libs-ui-color-icon-hover-danger, #f15767) !important; [class*="libs-ui-icon-"],[class*="icon-font-3rd"]{&:before,&:after{color: var(--libs-ui-color-icon-hover-danger, #f15767) !important;}}}
859
+ .libs-ui-text-error {color: var(--libs-ui-color-text-error, #ff5454) !important;}
860
+ .libs-ui-text-error::before {color: var(--libs-ui-color-text-error, #ff5454) !important;}
861
+ .libs-ui-disable {cursor: not-allowed !important;text-decoration: none;color:var(--libs-ui-color-text-disable, #cdd0d6) !important;}
862
+ .libs-ui-disable::before {color:var(--libs-ui-color-text-disable, #9ca2ad) !important;}
863
+ .libs-ui-disable-background{background: var(--libs-ui-color-background-disable, #f8f9fa) !important;}
864
+ .libs-ui-disable-active {color:var(--libs-ui-color-light-4,#91b7fa) !important;}
865
+ .libs-ui-disable-active::before {color:var(--libs-ui-color-light-4,#91b7fa) !important;}
866
+ .libs-ui-disable-active-background{background: var(--libs-ui-color-light-4,#91b7fa) !important;}
867
+ .libs-ui-readonly {cursor: not-allowed !important;color:var(--libs-ui-color-text-readonly, #071631) !important;}
868
+ .libs-ui-readonly::before {color:var(--libs-ui-color-text-readonly, #071631) !important;}
869
+ .libs-ui-readonly-background{background: var(--libs-ui-color-background-readonly, #f8f9fa) !important;}
870
+ .libs-ui-icon-hover-danger:hover {color: var(--libs-ui-color-icon-hover-danger, #f15767) !important; [class*="libs-ui-icon-"],[class*="icon-font-3rd"]{&:before,&:after{color: var(--libs-ui-color-icon-hover-danger, #f15767) !important;}}}
871
+ .break-word{word-break: break-word !important;}
872
+ .libs-ui-shadow {box-shadow: 0 2px 10px 1px rgba(51, 51, 51, 0.1);}
873
+ .libs-ui-shadow-md {box-shadow: 0 4px 8px 0 rgba(51, 51, 51, 0.1);}
874
+ .libs-ui-shadow-lg {box-shadow: 0 15px 30px 0 rgba(51, 51, 51, 0.1);}
875
+ .libs-ui-shadow-top {box-shadow: 0 -5px 5px -5px rgba(51, 51, 51, 0.1);}
876
+ .libs-ui-shadow-right {box-shadow: -5px 0 5px -5px rgba(51, 51, 51, 0.1);}
877
+ .libs-ui-shadow-bottom {box-shadow: 0 5px 5px -5px rgba(51, 51, 51, 0.1);}
878
+ .libs-ui-shadow-left {box-shadow: 5px 0 5px -5px rgba(51, 51, 51, 0.1);}
879
+ .libs-ui-shadow-sm {box-shadow: 0 1px 2px 0 rgba(51, 51, 51, 0.1);}
880
+ .libs-ui-shadow-popup {box-shadow: -2px 0 4px 0 rgba(51, 51, 51, 0.1);}
881
+ .libs-ui-shadow-none {box-shadow: none !important;}
882
+ .libs-ui-shadow-small {box-shadow: 0px 1px 2px 0px rgba(0,20,51,.04), 0px 1px 1px 0px rgba(0,20,51,.02);}
883
+ .libs-ui-shadow-medium {box-shadow: 0px 4px 8px 0px rgba(0, 20, 51, 0.04), 0px 1px 1px 0px rgba(0, 20, 51, 0.02);}
884
+ .libs-ui-shadow-large {box-shadow: 0px 4px 16px 0px rgba(0,20,51,.1), 0px 1px 1px 0px rgba(0,20,51,.02);}
885
+ .libs-ui-shadow-extra-large {box-shadow: 0px 8px 56px 0px rgba(0,20,51,.05), 0px 1px 1px 0px rgba(0,20,51,.02);}
886
+ ::-moz-selection {background: var(--libs-ui-color-background-selection, #00000040) !important;}
887
+ ::selection {background: var(--libs-ui-color-background-selection, #00000040) !important;}
888
+ `.replace(/\n+/g, '');
889
+ document.head.append(this.styleClassGlobalEl);
890
+ }
891
+ configString() {
892
+ const prototype = String.prototype;
893
+ prototype.replaceAt = function (index, replacement) {
894
+ const values = this.split('');
895
+ values[index] = replacement;
896
+ return values.join('');
897
+ };
898
+ prototype.replaceAll = function (index, separator, replacement) {
899
+ const regex = new RegExp(separator, 'g');
900
+ return `${this.substr(0, index)}${this.substr(index + 1 + (replacement?.length || 0)).replace(regex, replacement)}`;
901
+ };
902
+ prototype.occurrencesByCharacter = function (character) {
903
+ const values = this.split('');
904
+ if (!values || !values.length) {
905
+ return 0;
906
+ }
907
+ return values.filter((char) => char === character).length;
908
+ };
909
+ prototype.indexesOfCharacter = function (character) {
910
+ const values = this.split('');
911
+ const indexes = [];
912
+ if (!values || !values.length) {
913
+ return indexes;
914
+ }
915
+ for (const indexValue in values) {
916
+ if (values[indexValue] === character) {
917
+ indexes.push(+indexValue);
918
+ }
919
+ }
920
+ return indexes;
921
+ };
922
+ prototype.indexesByString = function (str) {
923
+ const values = this;
924
+ const indexes = [];
925
+ if (!values || !values.length || !str || !str.length || values.length < str.length) {
926
+ return indexes;
927
+ }
928
+ for (const indexValue in values) {
929
+ if (values[indexValue] !== str[0] || +indexValue + str.length > values.length) {
930
+ continue;
931
+ }
932
+ for (const index in str.split('')) {
933
+ if (values[+indexValue + +index] !== str[index]) {
934
+ break;
935
+ }
936
+ }
937
+ indexes.push(+indexValue);
938
+ }
939
+ return indexes;
940
+ };
941
+ }
942
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: LibsUiConfigProjectService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
943
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: LibsUiConfigProjectService, providedIn: 'root' });
944
+ }
945
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: LibsUiConfigProjectService, decorators: [{
946
+ type: Injectable,
947
+ args: [{
948
+ providedIn: 'root',
949
+ }]
950
+ }], ctorParameters: () => [] });
951
+
952
+ /**
953
+ * Generated bundle index. Do not edit.
954
+ */
955
+
956
+ export { LibsUiConfigProjectService, configButtonColor, configButtonStatus, configButtonTab, configHeading, configLinkButton, fontConfig, sizeButtonConfig, styleButtonTab, weights };
957
+ //# sourceMappingURL=libs-ui-services-config-project.mjs.map