@esmalley/ts-utils 1.0.0
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/LICENSE +674 -0
- package/README.md +2 -0
- package/dist/Arithmetic.d.ts +4 -0
- package/dist/Arithmetic.d.ts.map +1 -0
- package/dist/Arithmetic.js +5 -0
- package/dist/Arrayifier.d.ts +29 -0
- package/dist/Arrayifier.d.ts.map +1 -0
- package/dist/Arrayifier.js +65 -0
- package/dist/CSV.d.ts +10 -0
- package/dist/CSV.d.ts.map +1 -0
- package/dist/CSV.js +35 -0
- package/dist/Color.d.ts +93 -0
- package/dist/Color.d.ts.map +1 -0
- package/dist/Color.js +344 -0
- package/dist/Dates.d.ts +51 -0
- package/dist/Dates.d.ts.map +1 -0
- package/dist/Dates.js +354 -0
- package/dist/Kontororu/Socket.d.ts +44 -0
- package/dist/Kontororu/Socket.d.ts.map +1 -0
- package/dist/Kontororu/Socket.js +218 -0
- package/dist/Kontororu.d.ts +8 -0
- package/dist/Kontororu.d.ts.map +1 -0
- package/dist/Kontororu.js +23 -0
- package/dist/Objector.d.ts +32 -0
- package/dist/Objector.d.ts.map +1 -0
- package/dist/Objector.js +120 -0
- package/dist/Sorter.d.ts +8 -0
- package/dist/Sorter.d.ts.map +1 -0
- package/dist/Sorter.js +28 -0
- package/dist/Style.d.ts +63 -0
- package/dist/Style.d.ts.map +1 -0
- package/dist/Style.js +471 -0
- package/dist/Text.d.ts +5 -0
- package/dist/Text.d.ts.map +1 -0
- package/dist/Text.js +35 -0
- package/dist/Theme.d.ts +1413 -0
- package/dist/Theme.d.ts.map +1 -0
- package/dist/Theme.js +503 -0
- package/dist/Toaster.d.ts +24 -0
- package/dist/Toaster.d.ts.map +1 -0
- package/dist/Toaster.js +46 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +11 -0
- package/package.json +58 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"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) {
|
|
6
|
+
this.mode = mode;
|
|
7
|
+
if (mode !== 'light' && mode !== 'dark') {
|
|
8
|
+
throw new Error(`Unknown theme: ${mode}`);
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
getTheme() {
|
|
12
|
+
if (this.mode === 'light') {
|
|
13
|
+
return this.getLightTheme();
|
|
14
|
+
}
|
|
15
|
+
return this.getDarkTheme();
|
|
16
|
+
}
|
|
17
|
+
getDarkTheme() {
|
|
18
|
+
return {
|
|
19
|
+
mode: 'dark',
|
|
20
|
+
background: {
|
|
21
|
+
main: '#121212',
|
|
22
|
+
},
|
|
23
|
+
header: {
|
|
24
|
+
main: this.getGrey()[900],
|
|
25
|
+
},
|
|
26
|
+
primary: {
|
|
27
|
+
main: '#90caf9',
|
|
28
|
+
light: '#e3f2fd',
|
|
29
|
+
dark: '#42a5f5',
|
|
30
|
+
},
|
|
31
|
+
secondary: {
|
|
32
|
+
main: '#ce93d8',
|
|
33
|
+
light: '#f3e5f5',
|
|
34
|
+
dark: '#ab47bc',
|
|
35
|
+
},
|
|
36
|
+
warning: {
|
|
37
|
+
main: '#ffa726',
|
|
38
|
+
light: '#ffb74d',
|
|
39
|
+
dark: '#f57c00',
|
|
40
|
+
},
|
|
41
|
+
success: {
|
|
42
|
+
main: '#66bb6a',
|
|
43
|
+
light: '#81c784',
|
|
44
|
+
dark: '#388e3c',
|
|
45
|
+
},
|
|
46
|
+
error: {
|
|
47
|
+
main: '#f44336',
|
|
48
|
+
dark: '#d32f2f',
|
|
49
|
+
light: '#e57373',
|
|
50
|
+
},
|
|
51
|
+
info: {
|
|
52
|
+
main: '#29b6f6',
|
|
53
|
+
dark: '#0288d1',
|
|
54
|
+
light: '#4fc3f7',
|
|
55
|
+
},
|
|
56
|
+
text: {
|
|
57
|
+
primary: '#fff',
|
|
58
|
+
secondary: '#B3B3B3',
|
|
59
|
+
disabled: '#808080',
|
|
60
|
+
icon: '#808080',
|
|
61
|
+
},
|
|
62
|
+
link: {
|
|
63
|
+
primary: '#90caf9',
|
|
64
|
+
},
|
|
65
|
+
action: {
|
|
66
|
+
active: '#fff',
|
|
67
|
+
disabled: 'rgba(255, 255, 255, 0.3)',
|
|
68
|
+
disabledBackground: 'rgba(255, 255, 255, 0.12)',
|
|
69
|
+
disabledOpacity: 0.38,
|
|
70
|
+
focus: 'rgba(255, 255, 255, 0.12)',
|
|
71
|
+
focusOpacity: 0.12,
|
|
72
|
+
hover: 'rgba(255, 255, 255, 0.08)',
|
|
73
|
+
hoverOpacity: 0.08,
|
|
74
|
+
selected: 'rgba(255, 255, 255, 0.16)',
|
|
75
|
+
selectedOpacity: 0.16,
|
|
76
|
+
},
|
|
77
|
+
grey: this.getGrey(),
|
|
78
|
+
red: this.getRed(),
|
|
79
|
+
pink: this.getPink(),
|
|
80
|
+
purple: this.getPurple(),
|
|
81
|
+
deepPurple: this.getDeepPurple(),
|
|
82
|
+
indigo: this.getIndigo(),
|
|
83
|
+
blue: this.getBlue(),
|
|
84
|
+
lightBlue: this.getLightBlue(),
|
|
85
|
+
cyan: this.getCyan(),
|
|
86
|
+
teal: this.getTeal(),
|
|
87
|
+
green: this.getGreen(),
|
|
88
|
+
lightGreen: this.getLightGreen(),
|
|
89
|
+
lime: this.getLime(),
|
|
90
|
+
yellow: this.getYellow(),
|
|
91
|
+
amber: this.getAmber(),
|
|
92
|
+
orange: this.getOrange(),
|
|
93
|
+
deepOrange: this.getDeepOrange(),
|
|
94
|
+
brown: this.getBrown(),
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
getLightTheme() {
|
|
98
|
+
return {
|
|
99
|
+
mode: 'light',
|
|
100
|
+
background: {
|
|
101
|
+
main: '#efefef',
|
|
102
|
+
light: '#fff',
|
|
103
|
+
},
|
|
104
|
+
header: {
|
|
105
|
+
main: this.getBlue()[700],
|
|
106
|
+
},
|
|
107
|
+
primary: {
|
|
108
|
+
main: '#1976d2',
|
|
109
|
+
light: '#42a5f5',
|
|
110
|
+
dark: '#1565c0',
|
|
111
|
+
contrastText: '#fff',
|
|
112
|
+
},
|
|
113
|
+
secondary: {
|
|
114
|
+
main: '#9c27b0',
|
|
115
|
+
light: '#ba68c8',
|
|
116
|
+
dark: '#7b1fa2',
|
|
117
|
+
contrastText: '#fff',
|
|
118
|
+
},
|
|
119
|
+
error: {
|
|
120
|
+
main: '#d32f2f',
|
|
121
|
+
light: '#ef5350',
|
|
122
|
+
dark: '#c62828',
|
|
123
|
+
contrastText: '#fff',
|
|
124
|
+
},
|
|
125
|
+
warning: {
|
|
126
|
+
main: '#ed6c02',
|
|
127
|
+
light: '#ff9800',
|
|
128
|
+
dark: '#e65100',
|
|
129
|
+
contrastText: '#fff',
|
|
130
|
+
},
|
|
131
|
+
info: {
|
|
132
|
+
main: '#0288d1',
|
|
133
|
+
light: '#03a9f4',
|
|
134
|
+
dark: '#01579b',
|
|
135
|
+
contrastText: '#fff',
|
|
136
|
+
},
|
|
137
|
+
success: {
|
|
138
|
+
main: '#2e7d32',
|
|
139
|
+
light: '#4caf50',
|
|
140
|
+
dark: '#1b5e20',
|
|
141
|
+
contrastText: '#fff',
|
|
142
|
+
},
|
|
143
|
+
text: {
|
|
144
|
+
primary: '#222222',
|
|
145
|
+
secondary: '#666666',
|
|
146
|
+
disabled: '#9E9E9E',
|
|
147
|
+
},
|
|
148
|
+
link: {
|
|
149
|
+
primary: '#1976d2',
|
|
150
|
+
},
|
|
151
|
+
action: {
|
|
152
|
+
active: 'rgba(0, 0, 0, 0.54)',
|
|
153
|
+
disabled: 'rgba(0, 0, 0, 0.26)',
|
|
154
|
+
disabledBackground: 'rgba(0, 0, 0, 0.12)',
|
|
155
|
+
disabledOpacity: 0.38,
|
|
156
|
+
focus: 'rgba(0, 0, 0, 0.12)',
|
|
157
|
+
focusOpacity: 0.12,
|
|
158
|
+
hover: 'rgba(0, 0, 0, 0.04)',
|
|
159
|
+
hoverOpacity: 0.04,
|
|
160
|
+
selected: 'rgba(0, 0, 0, 0.08)',
|
|
161
|
+
selectedOpacity: 0.08,
|
|
162
|
+
},
|
|
163
|
+
grey: this.getGrey(),
|
|
164
|
+
red: this.getRed(),
|
|
165
|
+
pink: this.getPink(),
|
|
166
|
+
purple: this.getPurple(),
|
|
167
|
+
deepPurple: this.getDeepPurple(),
|
|
168
|
+
indigo: this.getIndigo(),
|
|
169
|
+
blue: this.getBlue(),
|
|
170
|
+
lightBlue: this.getLightBlue(),
|
|
171
|
+
cyan: this.getCyan(),
|
|
172
|
+
teal: this.getTeal(),
|
|
173
|
+
green: this.getGreen(),
|
|
174
|
+
lightGreen: this.getLightGreen(),
|
|
175
|
+
lime: this.getLime(),
|
|
176
|
+
yellow: this.getYellow(),
|
|
177
|
+
amber: this.getAmber(),
|
|
178
|
+
orange: this.getOrange(),
|
|
179
|
+
deepOrange: this.getDeepOrange(),
|
|
180
|
+
brown: this.getBrown(),
|
|
181
|
+
};
|
|
182
|
+
}
|
|
183
|
+
getGrey() {
|
|
184
|
+
return {
|
|
185
|
+
50: '#fafafa',
|
|
186
|
+
100: '#f5f5f5',
|
|
187
|
+
200: '#eeeeee',
|
|
188
|
+
300: '#e0e0e0',
|
|
189
|
+
400: '#bdbdbd',
|
|
190
|
+
500: '#9e9e9e',
|
|
191
|
+
600: '#757575',
|
|
192
|
+
700: '#616161',
|
|
193
|
+
800: '#424242',
|
|
194
|
+
900: '#212121',
|
|
195
|
+
A100: '#f5f5f5',
|
|
196
|
+
A200: '#eeeeee',
|
|
197
|
+
A400: '#bdbdbd',
|
|
198
|
+
A700: '#616161',
|
|
199
|
+
};
|
|
200
|
+
}
|
|
201
|
+
getRed() {
|
|
202
|
+
return {
|
|
203
|
+
50: '#ffebee',
|
|
204
|
+
100: '#ffcdd2',
|
|
205
|
+
200: '#ef9a9a',
|
|
206
|
+
300: '#e57373',
|
|
207
|
+
400: '#ef5350',
|
|
208
|
+
500: '#f44336',
|
|
209
|
+
600: '#e53935',
|
|
210
|
+
700: '#d32f2f',
|
|
211
|
+
800: '#c62828',
|
|
212
|
+
900: '#b71c1c',
|
|
213
|
+
A100: '#ff8a80',
|
|
214
|
+
A200: '#ff5252',
|
|
215
|
+
A400: '#ff1744',
|
|
216
|
+
A700: '#d50000',
|
|
217
|
+
};
|
|
218
|
+
}
|
|
219
|
+
getPink() {
|
|
220
|
+
return {
|
|
221
|
+
50: '#fce4ec',
|
|
222
|
+
100: '#f8bbd0',
|
|
223
|
+
200: '#f48fb1',
|
|
224
|
+
300: '#f06292',
|
|
225
|
+
400: '#ec407a',
|
|
226
|
+
500: '#e91e63',
|
|
227
|
+
600: '#d81b60',
|
|
228
|
+
700: '#c2185b',
|
|
229
|
+
800: '#ad1457',
|
|
230
|
+
900: '#880e4f',
|
|
231
|
+
A100: '#ff80ab',
|
|
232
|
+
A200: '#ff4081',
|
|
233
|
+
A400: '#f50057',
|
|
234
|
+
A700: '#c51162',
|
|
235
|
+
};
|
|
236
|
+
}
|
|
237
|
+
getPurple() {
|
|
238
|
+
return {
|
|
239
|
+
50: '#f3e5f5',
|
|
240
|
+
100: '#e1bee7',
|
|
241
|
+
200: '#ce93d8',
|
|
242
|
+
300: '#ba68c8',
|
|
243
|
+
400: '#ab47bc',
|
|
244
|
+
500: '#9c27b0',
|
|
245
|
+
600: '#8e24aa',
|
|
246
|
+
700: '#7b1fa2',
|
|
247
|
+
800: '#6a1b9a',
|
|
248
|
+
900: '#4a148c',
|
|
249
|
+
A100: '#ea80fc',
|
|
250
|
+
A200: '#e040fb',
|
|
251
|
+
A400: '#d500f8',
|
|
252
|
+
A700: '#aa00ff',
|
|
253
|
+
};
|
|
254
|
+
}
|
|
255
|
+
getDeepPurple() {
|
|
256
|
+
return {
|
|
257
|
+
50: '#ede7f6',
|
|
258
|
+
100: '#d1c4e9',
|
|
259
|
+
200: '#b39ddb',
|
|
260
|
+
300: '#9575cd',
|
|
261
|
+
400: '#7e57c2',
|
|
262
|
+
500: '#673ab7',
|
|
263
|
+
600: '#5e35b1',
|
|
264
|
+
700: '#512da8',
|
|
265
|
+
800: '#4527a0',
|
|
266
|
+
900: '#311b92',
|
|
267
|
+
A100: '#b388ff',
|
|
268
|
+
A200: '#7c4dff',
|
|
269
|
+
A400: '#651fff',
|
|
270
|
+
A700: '#6200ea',
|
|
271
|
+
};
|
|
272
|
+
}
|
|
273
|
+
getIndigo() {
|
|
274
|
+
return {
|
|
275
|
+
50: '#e8eaf6',
|
|
276
|
+
100: '#c5cae9',
|
|
277
|
+
200: '#9fa8da',
|
|
278
|
+
300: '#7986cb',
|
|
279
|
+
400: '#5c6bc0',
|
|
280
|
+
500: '#3f51b5',
|
|
281
|
+
600: '#3949ab',
|
|
282
|
+
700: '#303f9f',
|
|
283
|
+
800: '#283593',
|
|
284
|
+
900: '#1a237e',
|
|
285
|
+
A100: '#8c9eff',
|
|
286
|
+
A200: '#536dfe',
|
|
287
|
+
A400: '#3d5afe',
|
|
288
|
+
A700: '#304ffe',
|
|
289
|
+
};
|
|
290
|
+
}
|
|
291
|
+
getBlue() {
|
|
292
|
+
return {
|
|
293
|
+
50: '#e3f2fd',
|
|
294
|
+
100: '#bbdefb',
|
|
295
|
+
200: '#90caf9',
|
|
296
|
+
300: '#64b5f6',
|
|
297
|
+
400: '#42a5f5',
|
|
298
|
+
500: '#2196f3',
|
|
299
|
+
600: '#1e88e5',
|
|
300
|
+
700: '#1976d2',
|
|
301
|
+
800: '#1565c0',
|
|
302
|
+
900: '#0d47a1',
|
|
303
|
+
A100: '#82b1ff',
|
|
304
|
+
A200: '#448aff',
|
|
305
|
+
A400: '#2979ff',
|
|
306
|
+
A700: '#2962ff',
|
|
307
|
+
};
|
|
308
|
+
}
|
|
309
|
+
getLightBlue() {
|
|
310
|
+
return {
|
|
311
|
+
50: '#e1f5fe',
|
|
312
|
+
100: '#b3e5fc',
|
|
313
|
+
200: '#81d4fa',
|
|
314
|
+
300: '#4fc3f7',
|
|
315
|
+
400: '#29b6f6',
|
|
316
|
+
500: '#03a9f4',
|
|
317
|
+
600: '#039be5',
|
|
318
|
+
700: '#0288d1',
|
|
319
|
+
800: '#0277bd',
|
|
320
|
+
900: '#01579b',
|
|
321
|
+
A100: '#80d8ff',
|
|
322
|
+
A200: '#40c4ff',
|
|
323
|
+
A400: '#00b0ff',
|
|
324
|
+
A700: '#0091ea',
|
|
325
|
+
};
|
|
326
|
+
}
|
|
327
|
+
getCyan() {
|
|
328
|
+
return {
|
|
329
|
+
50: '#e0f7fa',
|
|
330
|
+
100: '#b2ebf2',
|
|
331
|
+
200: '#80deea',
|
|
332
|
+
300: '#4dd0e1',
|
|
333
|
+
400: '#26c6da',
|
|
334
|
+
500: '#00bcd4',
|
|
335
|
+
600: '#00acc1',
|
|
336
|
+
700: '#0097a7',
|
|
337
|
+
800: '#00838f',
|
|
338
|
+
900: '#006064',
|
|
339
|
+
A100: '#84ffff',
|
|
340
|
+
A200: '#18ffff',
|
|
341
|
+
A400: '#00e5ff',
|
|
342
|
+
A700: '#00b8d4',
|
|
343
|
+
};
|
|
344
|
+
}
|
|
345
|
+
getTeal() {
|
|
346
|
+
return {
|
|
347
|
+
50: '#e0f2f1',
|
|
348
|
+
100: '#b2dfdb',
|
|
349
|
+
200: '#80cbc4',
|
|
350
|
+
300: '#4db6ac',
|
|
351
|
+
400: '#26a69a',
|
|
352
|
+
500: '#009688',
|
|
353
|
+
600: '#00897b',
|
|
354
|
+
700: '#00796b',
|
|
355
|
+
800: '#00695c',
|
|
356
|
+
900: '#004d40',
|
|
357
|
+
A100: '#a7ffeb',
|
|
358
|
+
A200: '#64ffda',
|
|
359
|
+
A400: '#1de9b6',
|
|
360
|
+
A700: '#00bfa5',
|
|
361
|
+
};
|
|
362
|
+
}
|
|
363
|
+
getGreen() {
|
|
364
|
+
return {
|
|
365
|
+
50: '#e8f5e9',
|
|
366
|
+
100: '#c8e6c9',
|
|
367
|
+
200: '#a5d6a7',
|
|
368
|
+
300: '#81c784',
|
|
369
|
+
400: '#66bb6a',
|
|
370
|
+
500: '#4caf50',
|
|
371
|
+
600: '#43a047',
|
|
372
|
+
700: '#388e3c',
|
|
373
|
+
800: '#2e7d32',
|
|
374
|
+
900: '#1b5e20',
|
|
375
|
+
A100: '#b9f6ca',
|
|
376
|
+
A200: '#69f0ae',
|
|
377
|
+
A400: '#00e676',
|
|
378
|
+
A700: '#00c853',
|
|
379
|
+
};
|
|
380
|
+
}
|
|
381
|
+
getLightGreen() {
|
|
382
|
+
return {
|
|
383
|
+
50: '#f1f8e9',
|
|
384
|
+
100: '#dcedc8',
|
|
385
|
+
200: '#c5e1a5',
|
|
386
|
+
300: '#aed581',
|
|
387
|
+
400: '#9ccc65',
|
|
388
|
+
500: '#8bc34a',
|
|
389
|
+
600: '#7cb342',
|
|
390
|
+
700: '#689f38',
|
|
391
|
+
800: '#558b2f',
|
|
392
|
+
900: '#33691e',
|
|
393
|
+
A100: '#ccff90',
|
|
394
|
+
A200: '#b2ff59',
|
|
395
|
+
A400: '#76ff03',
|
|
396
|
+
A700: '#64dd17',
|
|
397
|
+
};
|
|
398
|
+
}
|
|
399
|
+
getLime() {
|
|
400
|
+
return {
|
|
401
|
+
50: '#f9fbe7',
|
|
402
|
+
100: '#f0f4c3',
|
|
403
|
+
200: '#e6ee9c',
|
|
404
|
+
300: '#dce775',
|
|
405
|
+
400: '#d4e157',
|
|
406
|
+
500: '#cddc39',
|
|
407
|
+
600: '#c0ca33',
|
|
408
|
+
700: '#afb42b',
|
|
409
|
+
800: '#9fa827',
|
|
410
|
+
900: '#827717',
|
|
411
|
+
A100: '#f4ff81',
|
|
412
|
+
A200: '#eeff41',
|
|
413
|
+
A400: '#c6ff00',
|
|
414
|
+
A700: '#aeea00',
|
|
415
|
+
};
|
|
416
|
+
}
|
|
417
|
+
getYellow() {
|
|
418
|
+
return {
|
|
419
|
+
50: '#fffde7',
|
|
420
|
+
100: '#fff9c4',
|
|
421
|
+
200: '#fff59d',
|
|
422
|
+
300: '#fff176',
|
|
423
|
+
400: '#ffee58',
|
|
424
|
+
500: '#ffeb3b',
|
|
425
|
+
600: '#fdd835',
|
|
426
|
+
700: '#fbc02d',
|
|
427
|
+
800: '#f9a825',
|
|
428
|
+
900: '#f57f17',
|
|
429
|
+
A100: '#ffff8d',
|
|
430
|
+
A200: '#ffff00',
|
|
431
|
+
A400: '#ffea00',
|
|
432
|
+
A700: '#ffd600',
|
|
433
|
+
};
|
|
434
|
+
}
|
|
435
|
+
getAmber() {
|
|
436
|
+
return {
|
|
437
|
+
50: '#fff8e1',
|
|
438
|
+
100: '#ffecb3',
|
|
439
|
+
200: '#ffe082',
|
|
440
|
+
300: '#ffd54f',
|
|
441
|
+
400: '#ffca28',
|
|
442
|
+
500: '#ffc107',
|
|
443
|
+
600: '#ffb300',
|
|
444
|
+
700: '#ffa000',
|
|
445
|
+
800: '#ff8f00',
|
|
446
|
+
900: '#ff6f00',
|
|
447
|
+
A100: '#ffe57f',
|
|
448
|
+
A200: '#ffd740',
|
|
449
|
+
A400: '#ffc400',
|
|
450
|
+
A700: '#ffab00',
|
|
451
|
+
};
|
|
452
|
+
}
|
|
453
|
+
getOrange() {
|
|
454
|
+
return {
|
|
455
|
+
50: '#fff3e0',
|
|
456
|
+
100: '#ffe0b2',
|
|
457
|
+
200: '#ffcc80',
|
|
458
|
+
300: '#ffb74d',
|
|
459
|
+
400: '#ffa726',
|
|
460
|
+
500: '#ff9800',
|
|
461
|
+
600: '#fb8c00',
|
|
462
|
+
700: '#f57c00',
|
|
463
|
+
800: '#ef6c00',
|
|
464
|
+
900: '#e65100',
|
|
465
|
+
A100: '#ffd180',
|
|
466
|
+
A200: '#ffab40',
|
|
467
|
+
A400: '#ff9100',
|
|
468
|
+
A700: '#ff6d00',
|
|
469
|
+
};
|
|
470
|
+
}
|
|
471
|
+
getDeepOrange() {
|
|
472
|
+
return {
|
|
473
|
+
50: '#fbe9e7',
|
|
474
|
+
100: '#ffccbc',
|
|
475
|
+
200: '#ffab91',
|
|
476
|
+
300: '#ff8a65',
|
|
477
|
+
400: '#ff7043',
|
|
478
|
+
500: '#ff5722',
|
|
479
|
+
600: '#f4511e',
|
|
480
|
+
700: '#e64a19',
|
|
481
|
+
800: '#d84315',
|
|
482
|
+
900: '#bf360c',
|
|
483
|
+
A100: '#ff9e80',
|
|
484
|
+
A200: '#ff6e40',
|
|
485
|
+
A400: '#ff3d00',
|
|
486
|
+
A700: '#dd2c00',
|
|
487
|
+
};
|
|
488
|
+
}
|
|
489
|
+
getBrown() {
|
|
490
|
+
return {
|
|
491
|
+
50: '#efebe9',
|
|
492
|
+
100: '#d7ccc8',
|
|
493
|
+
200: '#bcaaa4',
|
|
494
|
+
300: '#a1887f',
|
|
495
|
+
400: '#8d6e63',
|
|
496
|
+
500: '#795548',
|
|
497
|
+
600: '#6d4c41',
|
|
498
|
+
700: '#5d4037',
|
|
499
|
+
800: '#4e342e',
|
|
500
|
+
900: '#3e2723',
|
|
501
|
+
};
|
|
502
|
+
}
|
|
503
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export interface ToastItem {
|
|
2
|
+
id: number;
|
|
3
|
+
message: string;
|
|
4
|
+
type: string;
|
|
5
|
+
exiting?: boolean;
|
|
6
|
+
}
|
|
7
|
+
export type ToastListener = (toasts: ToastItem[]) => void;
|
|
8
|
+
declare class Toaster {
|
|
9
|
+
private listeners;
|
|
10
|
+
private toasts;
|
|
11
|
+
subscribe(listener: ToastListener): () => void;
|
|
12
|
+
notify(): void;
|
|
13
|
+
requestClose(id: number): void;
|
|
14
|
+
add(message: string, type?: string): void;
|
|
15
|
+
remove(id: number): void;
|
|
16
|
+
}
|
|
17
|
+
export declare const toaster: Toaster;
|
|
18
|
+
export declare const toast: {
|
|
19
|
+
info: (msg: string) => void;
|
|
20
|
+
error: (msg: string) => void;
|
|
21
|
+
success: (msg: string) => void;
|
|
22
|
+
};
|
|
23
|
+
export {};
|
|
24
|
+
//# sourceMappingURL=Toaster.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Toaster.d.ts","sourceRoot":"","sources":["../src/Toaster.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,SAAS;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAGD,MAAM,MAAM,aAAa,GAAG,CAAC,MAAM,EAAE,SAAS,EAAE,KAAK,IAAI,CAAC;AAE1D,cAAM,OAAO;IACX,OAAO,CAAC,SAAS,CAAuB;IAExC,OAAO,CAAC,MAAM,CAAmB;IAGjC,SAAS,CAAC,QAAQ,EAAE,aAAa;IAOjC,MAAM;IAIN,YAAY,CAAC,EAAE,EAAE,MAAM;IAUvB,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,SAAS;IAWlC,MAAM,CAAC,EAAE,EAAE,MAAM;CAIlB;AAED,eAAO,MAAM,OAAO,SAAgB,CAAC;AAGrC,eAAO,MAAM,KAAK;gBACJ,MAAM;iBACL,MAAM;mBACJ,MAAM;CACtB,CAAC"}
|
package/dist/Toaster.js
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
// Handles toast components throughout the app
|
|
2
|
+
class Toaster {
|
|
3
|
+
constructor() {
|
|
4
|
+
this.listeners = [];
|
|
5
|
+
this.toasts = [];
|
|
6
|
+
}
|
|
7
|
+
// React component will subscribe to this
|
|
8
|
+
subscribe(listener) {
|
|
9
|
+
this.listeners.push(listener);
|
|
10
|
+
return () => {
|
|
11
|
+
this.listeners = this.listeners.filter((l) => l !== listener);
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
notify() {
|
|
15
|
+
this.listeners.forEach((listener) => listener(this.toasts));
|
|
16
|
+
}
|
|
17
|
+
requestClose(id) {
|
|
18
|
+
this.toasts = this.toasts.map((t) => {
|
|
19
|
+
if (t.id === id) {
|
|
20
|
+
return { ...t, exiting: true };
|
|
21
|
+
}
|
|
22
|
+
return t;
|
|
23
|
+
});
|
|
24
|
+
this.notify();
|
|
25
|
+
}
|
|
26
|
+
add(message, type = 'info') {
|
|
27
|
+
const id = Date.now();
|
|
28
|
+
this.toasts = [...this.toasts, { id, message, type }];
|
|
29
|
+
this.notify();
|
|
30
|
+
// Auto-remove
|
|
31
|
+
setTimeout(() => {
|
|
32
|
+
this.requestClose(id);
|
|
33
|
+
}, 4000);
|
|
34
|
+
}
|
|
35
|
+
remove(id) {
|
|
36
|
+
this.toasts = this.toasts.filter((t) => t.id !== id);
|
|
37
|
+
this.notify();
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
export const toaster = new Toaster();
|
|
41
|
+
// Helper function for cleaner usage in your app
|
|
42
|
+
export const toast = {
|
|
43
|
+
info: (msg) => toaster.add(msg, 'info'),
|
|
44
|
+
error: (msg) => toaster.add(msg, 'error'),
|
|
45
|
+
success: (msg) => toaster.add(msg, 'success'),
|
|
46
|
+
};
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export * from './Kontororu.js';
|
|
2
|
+
export * from './Kontororu/Socket.js';
|
|
3
|
+
export * from './Arrayifier.js';
|
|
4
|
+
export * from './Color.js';
|
|
5
|
+
export * from './Dates.js';
|
|
6
|
+
export * from './Objector.js';
|
|
7
|
+
export * from './Sorter.js';
|
|
8
|
+
export * from './Style.js';
|
|
9
|
+
export * from './Text.js';
|
|
10
|
+
export * from './Theme.js';
|
|
11
|
+
export * from './Toaster.js';
|
|
12
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,uBAAuB,CAAC;AACtC,cAAc,iBAAiB,CAAC;AAChC,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export * from './Kontororu.js';
|
|
2
|
+
export * from './Kontororu/Socket.js';
|
|
3
|
+
export * from './Arrayifier.js';
|
|
4
|
+
export * from './Color.js';
|
|
5
|
+
export * from './Dates.js';
|
|
6
|
+
export * from './Objector.js';
|
|
7
|
+
export * from './Sorter.js';
|
|
8
|
+
export * from './Style.js';
|
|
9
|
+
export * from './Text.js';
|
|
10
|
+
export * from './Theme.js';
|
|
11
|
+
export * from './Toaster.js';
|
package/package.json
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@esmalley/ts-utils",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"private": false,
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"files": [
|
|
9
|
+
"dist"
|
|
10
|
+
],
|
|
11
|
+
"scripts": {
|
|
12
|
+
"build": "tsc -p tsconfig.build.json",
|
|
13
|
+
"test": "node --experimental-vm-modules node_modules/jest/bin/jest.js",
|
|
14
|
+
"prepublishOnly": "npm run build"
|
|
15
|
+
},
|
|
16
|
+
"exports": {
|
|
17
|
+
".": {
|
|
18
|
+
"types": "./dist/index.d.ts",
|
|
19
|
+
"import": "./dist/index.js",
|
|
20
|
+
"require": "./dist/index.cjs"
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
"publishConfig": {
|
|
24
|
+
"access": "public"
|
|
25
|
+
},
|
|
26
|
+
"eslintConfig": {
|
|
27
|
+
"extends": [
|
|
28
|
+
"./eslint.config.mjs"
|
|
29
|
+
]
|
|
30
|
+
},
|
|
31
|
+
"browserslist": {
|
|
32
|
+
"production": [
|
|
33
|
+
">0.2%",
|
|
34
|
+
"not dead",
|
|
35
|
+
"not op_mini all"
|
|
36
|
+
],
|
|
37
|
+
"development": [
|
|
38
|
+
"last 1 chrome version",
|
|
39
|
+
"last 1 firefox version",
|
|
40
|
+
"last 1 safari version"
|
|
41
|
+
]
|
|
42
|
+
},
|
|
43
|
+
"devDependencies": {
|
|
44
|
+
"@eslint/js": "^9.17.0",
|
|
45
|
+
"@testing-library/jest-dom": "^6.1.5",
|
|
46
|
+
"@testing-library/react": "^16.2.0",
|
|
47
|
+
"@testing-library/user-event": "^14.5.1",
|
|
48
|
+
"@types/jest": "^30.0.0",
|
|
49
|
+
"@types/react-dom": "^19.1.9",
|
|
50
|
+
"eslint": "^9.22.0",
|
|
51
|
+
"eslint-plugin-react": "^7.37.3",
|
|
52
|
+
"eslint-plugin-react-hooks": "^5.1.0",
|
|
53
|
+
"globals": "^16.0.0",
|
|
54
|
+
"ts-jest": "^29.4.6",
|
|
55
|
+
"typescript": "^5.5.3",
|
|
56
|
+
"typescript-eslint": "^8.26.1"
|
|
57
|
+
}
|
|
58
|
+
}
|