x4js 1.4.9 → 1.4.10

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/src/x4.less CHANGED
@@ -1,4 +1,4 @@
1
- // out: ../x4.css
1
+ // out: ../lib/x4.css
2
2
 
3
3
  /**
4
4
  * ___ ___ __
@@ -69,6 +69,7 @@
69
69
  --x4-icon-rectangle-times: 'data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" fill="currentColor"><path d="M448 32C483.3 32 512 60.65 512 96V416C512 451.3 483.3 480 448 480H64C28.65 480 0 451.3 0 416V96C0 60.65 28.65 32 64 32H448zM175 208.1L222.1 255.1L175 303C165.7 312.4 165.7 327.6 175 336.1C184.4 346.3 199.6 346.3 208.1 336.1L255.1 289.9L303 336.1C312.4 346.3 327.6 346.3 336.1 336.1C346.3 327.6 346.3 312.4 336.1 303L289.9 255.1L336.1 208.1C346.3 199.6 346.3 184.4 336.1 175C327.6 165.7 312.4 165.7 303 175L255.1 222.1L208.1 175C199.6 165.7 184.4 165.7 175 175C165.7 184.4 165.7 199.6 175 208.1V208.1z"/></svg>';
70
70
  --x4-icon-xmark: 'data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 512" fill="currentColor"><path d="M310.6 361.4c12.5 12.5 12.5 32.75 0 45.25C304.4 412.9 296.2 416 288 416s-16.38-3.125-22.62-9.375L160 301.3L54.63 406.6C48.38 412.9 40.19 416 32 416S15.63 412.9 9.375 406.6c-12.5-12.5-12.5-32.75 0-45.25l105.4-105.4L9.375 150.6c-12.5-12.5-12.5-32.75 0-45.25s32.75-12.5 45.25 0L160 210.8l105.4-105.4c12.5-12.5 32.75-12.5 45.25 0s12.5 32.75 0 45.25l-105.4 105.4L310.6 361.4z"/></svg>';
71
71
  --x4-icon-angle-down: 'data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 384 512" fill="currentColor"><path d="M192 384c-8.188 0-16.38-3.125-22.62-9.375l-160-160c-12.5-12.5-12.5-32.75 0-45.25s32.75-12.5 45.25 0L192 306.8l137.4-137.4c12.5-12.5 32.75-12.5 45.25 0s12.5 32.75 0 45.25l-160 160C208.4 380.9 200.2 384 192 384z"/></svg>';
72
+ --x4-icon-calendar-days: 'data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512" fill="currentColor"><path d="M160 32V64H288V32C288 14.33 302.3 0 320 0C337.7 0 352 14.33 352 32V64H400C426.5 64 448 85.49 448 112V160H0V112C0 85.49 21.49 64 48 64H96V32C96 14.33 110.3 0 128 0C145.7 0 160 14.33 160 32zM0 192H448V464C448 490.5 426.5 512 400 512H48C21.49 512 0 490.5 0 464V192zM64 304C64 312.8 71.16 320 80 320H112C120.8 320 128 312.8 128 304V272C128 263.2 120.8 256 112 256H80C71.16 256 64 263.2 64 272V304zM192 304C192 312.8 199.2 320 208 320H240C248.8 320 256 312.8 256 304V272C256 263.2 248.8 256 240 256H208C199.2 256 192 263.2 192 272V304zM336 256C327.2 256 320 263.2 320 272V304C320 312.8 327.2 320 336 320H368C376.8 320 384 312.8 384 304V272C384 263.2 376.8 256 368 256H336zM64 432C64 440.8 71.16 448 80 448H112C120.8 448 128 440.8 128 432V400C128 391.2 120.8 384 112 384H80C71.16 384 64 391.2 64 400V432zM208 384C199.2 384 192 391.2 192 400V432C192 440.8 199.2 448 208 448H240C248.8 448 256 440.8 256 432V400C256 391.2 248.8 384 240 384H208zM320 432C320 440.8 327.2 448 336 448H368C376.8 448 384 440.8 384 432V400C384 391.2 376.8 384 368 384H336C327.2 384 320 391.2 320 400V432z"/></svg>';
72
73
  }
73
74
 
74
75
  @BLACK10: rgba(0,0,0,0.1);
@@ -95,6 +96,112 @@
95
96
  @WHITE90: rgba(255,255,255,0.9);
96
97
  @WHITE: #fff;
97
98
 
99
+ /* source: https://tailwindcss.com/docs/customizing-colors/#default-color-palette */
100
+ :root {
101
+ --black: #000000;
102
+ --white: #ffffff;
103
+
104
+ --gray-100: #f7fafc;
105
+ --gray-200: #edf2f7;
106
+ --gray-300: #e2e8f0;
107
+ --gray-400: #cbd5e0;
108
+ --gray-500: #a0aec0;
109
+ --gray-600: #718096;
110
+ --gray-700: #4a5568;
111
+ --gray-800: #2d3748;
112
+ --gray-900: #1a202c;
113
+
114
+ --red-100: #fff5f5;
115
+ --red-200: #fed7d7;
116
+ --red-300: #feb2b2;
117
+ --red-400: #fc8181;
118
+ --red-500: #f56565;
119
+ --red-600: #e53e3e;
120
+ --red-700: #c53030;
121
+ --red-800: #9b2c2c;
122
+ --red-900: #742a2a;
123
+
124
+ --orange-100: #fffaf0;
125
+ --orange-200: #feebc8;
126
+ --orange-300: #fbd38d;
127
+ --orange-400: #f6ad55;
128
+ --orange-500: #ed8936;
129
+ --orange-600: #dd6b20;
130
+ --orange-700: #c05621;
131
+ --orange-800: #9c4221;
132
+ --orange-900: #7b341e;
133
+
134
+ --yellow-100: #fffff0;
135
+ --yellow-200: #fefcbf;
136
+ --yellow-300: #faf089;
137
+ --yellow-400: #f6e05e;
138
+ --yellow-500: #ecc94b;
139
+ --yellow-600: #d69e2e;
140
+ --yellow-700: #b7791f;
141
+ --yellow-800: #975a16;
142
+ --yellow-900: #744210;
143
+
144
+ --green-100: #f0fff4;
145
+ --green-200: #c6f6d5;
146
+ --green-300: #9ae6b4;
147
+ --green-400: #68d391;
148
+ --green-500: #48bb78;
149
+ --green-600: #38a169;
150
+ --green-700: #2f855a;
151
+ --green-800: #276749;
152
+ --green-900: #22543d;
153
+
154
+ --teal-100: #e6fffa;
155
+ --teal-200: #b2f5ea;
156
+ --teal-300: #81e6d9;
157
+ --teal-400: #4fd1c5;
158
+ --teal-500: #38b2ac;
159
+ --teal-600: #319795;
160
+ --teal-700: #2c7a7b;
161
+ --teal-800: #285e61;
162
+ --teal-900: #234e52;
163
+
164
+ --blue-100: #ebf8ff;
165
+ --blue-200: #bee3f8;
166
+ --blue-300: #90cdf4;
167
+ --blue-400: #63b3ed;
168
+ --blue-500: #4299e1;
169
+ --blue-600: #3182ce;
170
+ --blue-700: #2b6cb0;
171
+ --blue-800: #2c5282;
172
+ --blue-900: #2a4365;
173
+
174
+ --indigo-100: #ebf4ff;
175
+ --indigo-200: #c3dafe;
176
+ --indigo-300: #a3bffa;
177
+ --indigo-400: #7f9cf5;
178
+ --indigo-500: #667eea;
179
+ --indigo-600: #5a67d8;
180
+ --indigo-700: #4c51bf;
181
+ --indigo-800: #434190;
182
+ --indigo-900: #3c366b;
183
+
184
+ --purple-100: #faf5ff;
185
+ --purple-200: #e9d8fd;
186
+ --purple-300: #d6bcfa;
187
+ --purple-400: #b794f4;
188
+ --purple-500: #9f7aea;
189
+ --purple-600: #805ad5;
190
+ --purple-700: #6b46c1;
191
+ --purple-800: #553c9a;
192
+ --purple-900: #44337a;
193
+
194
+ --pink-100: #fff5f7;
195
+ --pink-200: #fed7e2;
196
+ --pink-300: #fbb6ce;
197
+ --pink-400: #f687b3;
198
+ --pink-500: #ed64a6;
199
+ --pink-600: #d53f8c;
200
+ --pink-700: #b83280;
201
+ --pink-800: #97266d;
202
+ --pink-900: #702459;
203
+ }
204
+
98
205
  .x4-root-element {
99
206
  padding: 0;
100
207
  margin: 0;
@@ -424,7 +531,7 @@ textarea {
424
531
  }
425
532
 
426
533
  padding: 4px;
427
- color: @BLACK80;
534
+ color: var( --gray-900 );
428
535
  margin-top: 1px; // hack alignement label / edit
429
536
  line-height: 1.3em;
430
537
  min-height: 2em;
@@ -437,14 +544,13 @@ textarea {
437
544
  outline: none;
438
545
  border: none;
439
546
  padding: 4px;
440
- color: @BLACK90;
441
- background-color: @WHITE25;
547
+ color: var( --gray-900 );
442
548
  border-bottom: 1px solid transparent;
443
549
  margin-top: 1px; // hack alignement label / edit
444
550
  line-height: 1.3em;
445
551
 
446
552
  &::placeholder {
447
- color: @WHITE50;
553
+ color: var( --gray-800 );
448
554
  }
449
555
 
450
556
  &::selection {
@@ -466,7 +572,7 @@ textarea {
466
572
  .x-button.gadget {
467
573
  background-color: transparent;
468
574
  font-size: var( --x4-font-size );
469
- color: black;
575
+ color: var( --gray-900 );
470
576
  border: none;
471
577
 
472
578
  margin: 0;
@@ -474,6 +580,10 @@ textarea {
474
580
  height: 2em;
475
581
  margin-top: 1px;
476
582
 
583
+ &:hover {
584
+ background-color: transparent;
585
+ }
586
+
477
587
  &:focus {
478
588
  color: var( --x4-focus-color );
479
589
  }
@@ -524,6 +634,14 @@ textarea {
524
634
  }
525
635
  }
526
636
 
637
+ .x-text-edit {
638
+ // align with combo
639
+ .x-button.gadget {
640
+ margin-left:1 px;
641
+ margin-right:1 px;
642
+ }
643
+ }
644
+
527
645
  .x-combo-box {
528
646
 
529
647
  &> .x-label {
@@ -618,9 +736,10 @@ textarea {
618
736
 
619
737
  }
620
738
 
739
+ .x-radio-btn,
621
740
  .x-check-box {
622
741
  align-items: center;
623
- color: @BLACK80;
742
+ color: var( --gray-900 );
624
743
  outline: none;
625
744
  //min-height: 2em;
626
745
  padding: 4px 0;
@@ -725,7 +844,7 @@ textarea {
725
844
  outline: none;
726
845
 
727
846
  background-color: transparent;
728
- color: @BLACK80;
847
+ color: var( --gray-900 );
729
848
 
730
849
  padding: 0px 8px;
731
850
  min-width: 120px;
@@ -734,7 +853,7 @@ textarea {
734
853
  .x-icon {
735
854
  width: 1em;
736
855
  margin-right: 8px;
737
- color: @BLACK30;
856
+ color: var( --gray-700 );
738
857
  }
739
858
 
740
859
  .x-label {
@@ -743,9 +862,9 @@ textarea {
743
862
 
744
863
  &:hover {
745
864
  background-color: #c6d3d9;
746
- color: black;
865
+ color: var( --gray-900 );
747
866
  .x-icon {
748
- color: black;
867
+ color: var( --gray-900 );
749
868
  }
750
869
  }
751
870
  }
@@ -891,7 +1010,7 @@ textarea {
891
1010
  border: none;
892
1011
  box-shadow: none;
893
1012
  &:focus {
894
- color: black;
1013
+ color: var( --gray-900 );
895
1014
  }
896
1015
  }
897
1016
 
@@ -1200,7 +1319,7 @@ textarea {
1200
1319
  padding: 4px;
1201
1320
  white-space: nowrap;
1202
1321
  //min-width: 50px;
1203
- color: black;
1322
+ color: var( --gray-900 );
1204
1323
  height: @def-height;
1205
1324
  }
1206
1325
 
@@ -1484,7 +1603,7 @@ textarea {
1484
1603
  }
1485
1604
 
1486
1605
  overflow: auto;
1487
- color: black;
1606
+ color: var( --gray-900 );
1488
1607
  }
1489
1608
  }
1490
1609
 
@@ -1519,7 +1638,7 @@ textarea {
1519
1638
 
1520
1639
  .x-button {
1521
1640
  height: auto;
1522
- color: black;
1641
+ color: var( --gray-900 );
1523
1642
  }
1524
1643
 
1525
1644
  margin-bottom: 8px;
@@ -1527,16 +1646,16 @@ textarea {
1527
1646
 
1528
1647
  .week {
1529
1648
  align-items: center;
1530
- //border-bottom: 1px solid @BLACK10;
1649
+ border: 1px solid transparent;
1531
1650
 
1532
1651
  &:hover {
1533
- background-color: var( --x4-hover-color );
1652
+ border-color: var( --x4-hover-color );
1534
1653
  border-radius: 4px;
1535
1654
  }
1536
1655
 
1537
1656
  .cell {
1538
1657
  height: 100%;
1539
- color: @BLACK70;
1658
+ color: var( --gray-900 );
1540
1659
  text-align: center;
1541
1660
  span {
1542
1661
  margin: auto;
@@ -1577,7 +1696,7 @@ textarea {
1577
1696
 
1578
1697
  .header {
1579
1698
  .cell {
1580
- color: @BLACK50;
1699
+ color: var( --gray-800 );
1581
1700
  height: 1.5em;
1582
1701
  }
1583
1702
 
@@ -1950,7 +2069,7 @@ textarea {
1950
2069
 
1951
2070
  color: transparent;
1952
2071
  background-color: transparent;
1953
- caret-color: black;
2072
+ color: var( --gray-900 );
1954
2073
 
1955
2074
  -moz-tab-size : 4;
1956
2075
  -o-tab-size : 4;
package/src/x4_events.ts CHANGED
@@ -28,12 +28,12 @@
28
28
  **/
29
29
 
30
30
  // default stopPropagation implementation for Events
31
- const stopPropagation = function () {
31
+ const stopPropagation = function ( this: any ) {
32
32
  this.propagationStopped = true;
33
33
  }
34
34
 
35
35
  // default preventDefault implementation for Events
36
- const preventDefault = function () {
36
+ const preventDefault = function ( this: any ) {
37
37
  this.defaultPrevented = true;
38
38
  }
39
39
 
@@ -389,13 +389,14 @@ export class EventSource<Q extends EventMap, T extends EventTypes = MapEvents<Q>
389
389
  */
390
390
 
391
391
  once<K extends keyof Q>(type: K, callback: (ev: Q[K]) => any) {
392
+ //@ts-ignore
392
393
  this._once(type as string, callback);
393
394
  }
394
395
 
395
396
  _once(eventName: string, callback: EventCallback) {
396
397
 
397
398
  const newCallback = ( ev ) => {
398
- this.off(eventName, newCallback);
399
+ this._off(eventName, newCallback);
399
400
  callback( ev );
400
401
  }
401
402
 
@@ -489,6 +490,7 @@ export class EventSource<Q extends EventMap, T extends EventTypes = MapEvents<Q>
489
490
  */
490
491
 
491
492
  on<K extends keyof Q>(type: K, callback: (ev: Q[K]) => any) : EventDisposer {
493
+ //@ts-ignore
492
494
  return this._on(type as string, callback);
493
495
  }
494
496
 
@@ -514,7 +516,7 @@ export class EventSource<Q extends EventMap, T extends EventTypes = MapEvents<Q>
514
516
  }
515
517
 
516
518
  return {
517
- dispose: ( ) => { this.off( eventName, callback ); }
519
+ dispose: ( ) => { this._off( eventName, callback ); }
518
520
  }
519
521
  }
520
522
 
@@ -524,7 +526,12 @@ export class EventSource<Q extends EventMap, T extends EventTypes = MapEvents<Q>
524
526
  * @param callback - callback to remove (must be the same as in on )
525
527
  */
526
528
 
527
- off(eventName: string, callback: EventCallback ): void {
529
+ off<K extends keyof Q>(type: K, callback: (ev: Q[K]) => any) {
530
+ //@ts-ignore
531
+ return this._off(type as string, callback);
532
+ }
533
+
534
+ _off(eventName: string, callback: EventCallback ): void {
528
535
  if (!this.m_eventRegistry) {
529
536
  return;
530
537
  }
package/tsconfig.json CHANGED
@@ -7,7 +7,7 @@
7
7
  "outDir": "./lib",
8
8
  "declaration": true,
9
9
  "module": "commonjs",
10
- "strict": false,
10
+ "strict": true//false,
11
11
  },
12
12
  "include": [
13
13
  "./src/*",