@openlettermarketing/olc-react-sdk 0.0.8 → 0.0.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.
Files changed (135) hide show
  1. package/.eslintignore +1 -0
  2. package/.eslintrc.cjs +18 -0
  3. package/.eslintrc.yml +47 -0
  4. package/.prettierignore +3 -0
  5. package/.prettierrc.yml +5 -0
  6. package/CHANGELOG.md +4 -0
  7. package/babel.config.json +10 -0
  8. package/build/index.js +2 -2
  9. package/build/index.js.map +1 -1
  10. package/examples/.eslintrc.yml +4 -0
  11. package/index.html +18 -0
  12. package/package.json +6 -6
  13. package/public/vite.svg +1 -0
  14. package/src/App.tsx +76 -0
  15. package/src/assets/Fonts/Lexi-Regular.ttf +0 -0
  16. package/src/assets/images/input/cancel.tsx +20 -0
  17. package/src/assets/images/input/search.tsx +20 -0
  18. package/src/assets/images/modal-icons/cancelIcon.png +0 -0
  19. package/src/assets/images/modal-icons/del.tsx +19 -0
  20. package/src/assets/images/modal-icons/delete.svg +3 -0
  21. package/src/assets/images/modal-icons/modal-cross.tsx +23 -0
  22. package/src/assets/images/modal-icons/save.tsx +23 -0
  23. package/src/assets/images/templates/add-icon.svg +5 -0
  24. package/src/assets/images/templates/back-arrow.tsx +19 -0
  25. package/src/assets/images/templates/back-dialog-icon.png +0 -0
  26. package/src/assets/images/templates/back-dialog-icon.svg +3 -0
  27. package/src/assets/images/templates/barcode.png +0 -0
  28. package/src/assets/images/templates/bi-fold-self-mailers.tsx +28 -0
  29. package/src/assets/images/templates/black-trash-icon.svg +3 -0
  30. package/src/assets/images/templates/cancel.svg +4 -0
  31. package/src/assets/images/templates/cancelIcon.png +0 -0
  32. package/src/assets/images/templates/clipboard.svg +3 -0
  33. package/src/assets/images/templates/contact-search.svg +3 -0
  34. package/src/assets/images/templates/content-copy-icon.tsx +24 -0
  35. package/src/assets/images/templates/cross.svg +3 -0
  36. package/src/assets/images/templates/custom-template-icon-black.svg +3 -0
  37. package/src/assets/images/templates/custom-template-icon.svg +3 -0
  38. package/src/assets/images/templates/custom-template.tsx +23 -0
  39. package/src/assets/images/templates/dummy-template.svg +21 -0
  40. package/src/assets/images/templates/dynamic-field.tsx +119 -0
  41. package/src/assets/images/templates/edit-pencil-icon.tsx +21 -0
  42. package/src/assets/images/templates/filter-2.svg +13 -0
  43. package/src/assets/images/templates/info-icon.svg +12 -0
  44. package/src/assets/images/templates/info-icon.tsx +37 -0
  45. package/src/assets/images/templates/one-barcode.png +0 -0
  46. package/src/assets/images/templates/personal-letter.tsx +53 -0
  47. package/src/assets/images/templates/plus-icon.svg +5 -0
  48. package/src/assets/images/templates/postcard.tsx +32 -0
  49. package/src/assets/images/templates/professional-letter.tsx +53 -0
  50. package/src/assets/images/templates/real-penned-letters.tsx +57 -0
  51. package/src/assets/images/templates/search.svg +3 -0
  52. package/src/assets/images/templates/size-image-lg.tsx +20 -0
  53. package/src/assets/images/templates/size-image-mid.tsx +20 -0
  54. package/src/assets/images/templates/size-image.tsx +20 -0
  55. package/src/assets/images/templates/template-copy.svg +3 -0
  56. package/src/assets/images/templates/template-default-design.tsx +21 -0
  57. package/src/assets/images/templates/template-delete.svg +3 -0
  58. package/src/assets/images/templates/template-edit.svg +4 -0
  59. package/src/assets/images/templates/template-save-icon.svg +3 -0
  60. package/src/assets/images/templates/template-search-2.svg +9 -0
  61. package/src/assets/images/templates/template-search.svg +4 -0
  62. package/src/assets/images/templates/thumbnail.svg +10 -0
  63. package/src/assets/images/templates/trash-icon.svg +13 -0
  64. package/src/assets/images/templates/tri-fold-self-mailers.tsx +93 -0
  65. package/src/components/CreateTemplate/index.tsx +377 -0
  66. package/src/components/CreateTemplate/styles.scss +363 -0
  67. package/src/components/GenericUIBlocks/Button/index.tsx +21 -0
  68. package/src/components/GenericUIBlocks/Button/styles.scss +15 -0
  69. package/src/components/GenericUIBlocks/CircularProgress/index.tsx +18 -0
  70. package/src/components/GenericUIBlocks/CircularProgress/styles.scss +98 -0
  71. package/src/components/GenericUIBlocks/Dialog/index.tsx +127 -0
  72. package/src/components/GenericUIBlocks/Dialog/styles.scss +106 -0
  73. package/src/components/GenericUIBlocks/Divider/index.tsx +12 -0
  74. package/src/components/GenericUIBlocks/Divider/styles.scss +7 -0
  75. package/src/components/GenericUIBlocks/GeneralSelect/index.tsx +86 -0
  76. package/src/components/GenericUIBlocks/GeneralSelect/styles.scss +77 -0
  77. package/src/components/GenericUIBlocks/GeneralTooltip/index.tsx +24 -0
  78. package/src/components/GenericUIBlocks/GeneralTooltip/styles.scss +9 -0
  79. package/src/components/GenericUIBlocks/GenericSnackbar/index.tsx +53 -0
  80. package/src/components/GenericUIBlocks/GenericSnackbar/styles.scss +34 -0
  81. package/src/components/GenericUIBlocks/Grid/index.tsx +82 -0
  82. package/src/components/GenericUIBlocks/Input/index.tsx +89 -0
  83. package/src/components/GenericUIBlocks/Input/styles.scss +80 -0
  84. package/src/components/GenericUIBlocks/Snackbar/index.tsx +66 -0
  85. package/src/components/GenericUIBlocks/Typography/index.tsx +18 -0
  86. package/src/components/GenericUIBlocks/Typography/styles.scss +27 -0
  87. package/src/components/SidePanel/customFields/customFieldSection.tsx +162 -0
  88. package/src/components/SidePanel/customFields/styles.scss +47 -0
  89. package/src/components/SidePanel/index.tsx +30 -0
  90. package/src/components/SidePanel/templates/customTemplateSection.tsx +505 -0
  91. package/src/components/SidePanel/templates/styles.scss +151 -0
  92. package/src/components/TemplateBuilder/index.tsx +295 -0
  93. package/src/components/TemplateBuilder/styles.scss +66 -0
  94. package/src/components/TopNavigation/ConfirmNavigateDialog/index.tsx +58 -0
  95. package/src/components/TopNavigation/ConfirmNavigateDialog/styles.scss +123 -0
  96. package/src/components/TopNavigation/EditTemplateNameModel/index.tsx +98 -0
  97. package/src/components/TopNavigation/EditTemplateNameModel/styles.scss +88 -0
  98. package/src/components/TopNavigation/SaveTemplateModel/index.tsx +60 -0
  99. package/src/components/TopNavigation/SaveTemplateModel/styles.scss +128 -0
  100. package/src/components/TopNavigation/index.tsx +388 -0
  101. package/src/components/TopNavigation/styles.scss +83 -0
  102. package/src/importMeta.d.ts +9 -0
  103. package/src/index.scss +130 -0
  104. package/src/index.tsx +82 -0
  105. package/src/libs/test.ts +7 -0
  106. package/src/redux/actions/action-types.ts +42 -0
  107. package/src/redux/actions/customFieldAction.ts +28 -0
  108. package/src/redux/actions/snackbarActions.ts +16 -0
  109. package/src/redux/actions/templateActions.ts +456 -0
  110. package/src/redux/reducers/customFieldReducer.ts +97 -0
  111. package/src/redux/reducers/index.ts +14 -0
  112. package/src/redux/reducers/snackbarReducer.ts +41 -0
  113. package/src/redux/reducers/templateReducer.ts +353 -0
  114. package/src/redux/store.ts +18 -0
  115. package/src/styles/colors.scss +61 -0
  116. package/src/test/mocks.js +89 -0
  117. package/src/test/setupJest.js +1 -0
  118. package/src/utils/api.ts +36 -0
  119. package/src/utils/constants.ts +40 -0
  120. package/src/utils/customStyles.ts +135 -0
  121. package/src/utils/fetchWrapper.ts +68 -0
  122. package/src/utils/fonts.json +1597 -0
  123. package/src/utils/helper.ts +19 -0
  124. package/src/utils/local-storage.ts +15 -0
  125. package/src/utils/message.ts +71 -0
  126. package/src/utils/template-builder.ts +147 -0
  127. package/src/utils/templateRestrictedArea/biFold.ts +433 -0
  128. package/src/utils/templateRestrictedArea/postCard.ts +439 -0
  129. package/src/utils/templateRestrictedArea/professional.ts +422 -0
  130. package/src/utils/templateRestrictedArea/realPenned.ts +283 -0
  131. package/src/utils/templateRestrictedArea/triFold.ts +434 -0
  132. package/tsconfig.json +29 -0
  133. package/tsconfig.node.json +12 -0
  134. package/vite.config.ts +8 -0
  135. package/webpack.config.js +80 -0
@@ -0,0 +1,434 @@
1
+ import { DPI } from "../constants";
2
+
3
+ // Define the type for the element being added
4
+ interface Element {
5
+ id: string;
6
+ type: string;
7
+ name: string;
8
+ opacity: number;
9
+ visible: boolean;
10
+ selectable: boolean;
11
+ removable: boolean;
12
+ alwaysOnTop: boolean;
13
+ showInExport: boolean;
14
+ x: number;
15
+ y: number;
16
+ width: number;
17
+ height: number;
18
+ rotation: number;
19
+ animations?: any[];
20
+ blurEnabled?: boolean;
21
+ blurRadius?: number;
22
+ brightnessEnabled?: boolean;
23
+ brightness?: number;
24
+ sepiaEnabled?: boolean;
25
+ grayscaleEnabled?: boolean;
26
+ shadowEnabled?: boolean;
27
+ shadowBlur?: number;
28
+ shadowOffsetX?: number;
29
+ shadowOffsetY?: number;
30
+ shadowColor?: string;
31
+ shadowOpacity?: number;
32
+ draggable?: boolean;
33
+ resizable?: boolean;
34
+ contentEditable: boolean;
35
+ styleEditable: boolean;
36
+ subType?: string;
37
+ fill?: string;
38
+ dash?: any[];
39
+ strokeWidth?: number;
40
+ stroke?: string;
41
+ cornerRadius?: number;
42
+ text?: string;
43
+ placeholder?: string;
44
+ fontSize?: number;
45
+ fontFamily?: string;
46
+ fontStyle?: string;
47
+ fontWeight?: string;
48
+ textDecoration?: string;
49
+ align?: string;
50
+ verticalAlign?: string;
51
+ lineHeight?: number;
52
+ letterSpacing?: number;
53
+ backgroundEnabled?: boolean;
54
+ backgroundColor?: string;
55
+ backgroundOpacity?: number;
56
+ backgroundCornerRadius?: number;
57
+ backgroundPadding?: number;
58
+ src?: string;
59
+ cropX?: number;
60
+ cropY?: number;
61
+ cropWidth?: number;
62
+ cropHeight?: number;
63
+ flipX?: boolean;
64
+ flipY?: boolean;
65
+ clipSrc?: string;
66
+ borderSize?: number;
67
+ keepRatio?: boolean;
68
+ }
69
+
70
+ // Define the type for the page
71
+ interface Page {
72
+ addElement: (element: Element) => void;
73
+ }
74
+
75
+ // Define the type for the store
76
+ interface Store {
77
+ width: number;
78
+ height: number;
79
+ pages: Page[];
80
+ history: {
81
+ clear: () => void;
82
+ };
83
+ }
84
+
85
+
86
+ export const addRestrictedAreaToTriFold = (store: Store, size: [number, number], barcodeSrc: string): void => {
87
+ const page = store.pages[0];
88
+
89
+ const elements: Element[] = [
90
+ {
91
+ id: 'figure-1',
92
+ type: 'figure',
93
+ name: '',
94
+ opacity: 1,
95
+ visible: true,
96
+ selectable: false,
97
+ removable: false,
98
+ alwaysOnTop: true,
99
+ showInExport: true,
100
+ x: store.width - size[0] * DPI - 0.15 * DPI,
101
+ y: store.height - size[1] * DPI - 0.125 * DPI - 4 * DPI,
102
+ width: size[0] * DPI,
103
+ height: size[1] * DPI,
104
+ rotation: 0,
105
+ animations: [],
106
+ blurEnabled: false,
107
+ blurRadius: 10,
108
+ brightnessEnabled: false,
109
+ brightness: 0,
110
+ sepiaEnabled: false,
111
+ grayscaleEnabled: false,
112
+ shadowEnabled: false,
113
+ shadowBlur: 5,
114
+ shadowOffsetX: 0,
115
+ shadowOffsetY: 0,
116
+ shadowColor: 'black',
117
+ shadowOpacity: 1,
118
+ draggable: false,
119
+ resizable: false,
120
+ contentEditable: false,
121
+ styleEditable: false,
122
+ subType: 'rect',
123
+ fill: 'white',
124
+ dash: [],
125
+ strokeWidth: 0,
126
+ stroke: '#0c0c0c',
127
+ cornerRadius: 0,
128
+ },
129
+ {
130
+ id: 'return-address',
131
+ type: 'text',
132
+ name: '',
133
+ opacity: 1,
134
+ visible: true,
135
+ selectable: false,
136
+ removable: false,
137
+ alwaysOnTop: true,
138
+ showInExport: true,
139
+ x: store.width - size[0] * DPI - 0.15 * DPI + 10,
140
+ y: store.height - size[1] * DPI - 0.125 * DPI + 20 - 4 * DPI,
141
+ width: 240,
142
+ height: 20,
143
+ rotation: 0,
144
+ animations: [],
145
+ blurEnabled: false,
146
+ blurRadius: 10,
147
+ brightnessEnabled: false,
148
+ brightness: 0,
149
+ sepiaEnabled: false,
150
+ grayscaleEnabled: false,
151
+ shadowEnabled: false,
152
+ shadowBlur: 5,
153
+ shadowOffsetX: 0,
154
+ shadowOffsetY: 0,
155
+ shadowColor: 'black',
156
+ shadowOpacity: 1,
157
+ draggable: false,
158
+ resizable: false,
159
+ contentEditable: false,
160
+ styleEditable: false,
161
+ text: 'YOUR RETURN ADDRESS \nWILL AUTOMATICALLY \nBE PRINTED IN THIS \nPOSITION',
162
+ placeholder: '',
163
+ fontSize: 12,
164
+ fontFamily: 'Roboto',
165
+ fontStyle: 'normal',
166
+ fontWeight: 'normal',
167
+ textDecoration: '',
168
+ fill: 'black',
169
+ align: 'start',
170
+ verticalAlign: 'top',
171
+ strokeWidth: 0,
172
+ stroke: 'black',
173
+ lineHeight: 1.2,
174
+ letterSpacing: 0,
175
+ backgroundEnabled: false,
176
+ backgroundColor: '#7ED321',
177
+ backgroundOpacity: 1,
178
+ backgroundCornerRadius: 0.5,
179
+ backgroundPadding: 0.5,
180
+ },
181
+ {
182
+ id: 'indicia',
183
+ type: 'text',
184
+ name: '',
185
+ opacity: 1,
186
+ visible: true,
187
+ selectable: false,
188
+ removable: false,
189
+ alwaysOnTop: true,
190
+ showInExport: true,
191
+ x: store.width - 111 - 0.15 * DPI,
192
+ y: store.height - size[1] * DPI + 10 - 4 * DPI,
193
+ width: 111,
194
+ height: 40,
195
+ rotation: 0,
196
+ animations: [],
197
+ blurEnabled: false,
198
+ blurRadius: 10,
199
+ brightnessEnabled: false,
200
+ brightness: 0,
201
+ sepiaEnabled: false,
202
+ grayscaleEnabled: false,
203
+ shadowEnabled: false,
204
+ shadowBlur: 5,
205
+ shadowOffsetX: 0,
206
+ shadowOffsetY: 0,
207
+ shadowColor: 'black',
208
+ shadowOpacity: 1,
209
+ draggable: false,
210
+ resizable: false,
211
+ contentEditable: false,
212
+ styleEditable: false,
213
+ text: `POSTAGE\nINDICIA`,
214
+ placeholder: '',
215
+ fontSize: 12,
216
+ fontFamily: 'Roboto',
217
+ fontStyle: 'normal',
218
+ fontWeight: 'normal',
219
+ textDecoration: '',
220
+ fill: 'black',
221
+ align: 'center',
222
+ verticalAlign: 'top',
223
+ strokeWidth: 0,
224
+ stroke: 'black',
225
+ lineHeight: 1.2,
226
+ letterSpacing: 0,
227
+ backgroundEnabled: false,
228
+ backgroundColor: '#7ED321',
229
+ backgroundOpacity: 1,
230
+ backgroundCornerRadius: 0.5,
231
+ backgroundPadding: 0.5,
232
+ },
233
+ {
234
+ id: 'barcode',
235
+ type: 'image',
236
+ name: '',
237
+ opacity: 1,
238
+ visible: true,
239
+ selectable: false,
240
+ removable: false,
241
+ alwaysOnTop: true,
242
+ showInExport: true,
243
+ y: store.height - 12 - size[1] * DPI + 110 - 4 * DPI,
244
+ x: store.width - size[0] * DPI - 0.15 * DPI + 40,
245
+ width: size[0] * DPI - 80,
246
+ height: 12,
247
+ rotation: 0,
248
+ animations: [],
249
+ blurEnabled: false,
250
+ brightnessEnabled: false,
251
+ brightness: 0,
252
+ sepiaEnabled: false,
253
+ grayscaleEnabled: false,
254
+ shadowEnabled: false,
255
+ shadowOffsetX: 0,
256
+ shadowOffsetY: 0,
257
+ shadowOpacity: 1,
258
+ draggable: false,
259
+ resizable: false,
260
+ contentEditable: false,
261
+ styleEditable: false,
262
+ src: barcodeSrc,
263
+ cropX: 0,
264
+ cropY: 0,
265
+ cropWidth: 1,
266
+ cropHeight: 1,
267
+ cornerRadius: 0,
268
+ flipX: false,
269
+ flipY: false,
270
+ clipSrc: '',
271
+ borderSize: 0,
272
+ keepRatio: false,
273
+ },
274
+ {
275
+ id: 'recipient-address',
276
+ type: 'text',
277
+ name: '',
278
+ opacity: 1,
279
+ visible: true,
280
+ selectable: false,
281
+ removable: false,
282
+ alwaysOnTop: true,
283
+ showInExport: true,
284
+ x: store.width - size[0] * DPI - 0.15 * DPI + 10,
285
+ y: store.height - size[1] * DPI - 0.125 * DPI + 150 - 4 * DPI,
286
+ width: 240,
287
+ height: 20,
288
+ rotation: 0,
289
+ animations: [],
290
+ blurEnabled: false,
291
+ blurRadius: 10,
292
+ brightnessEnabled: false,
293
+ brightness: 0,
294
+ sepiaEnabled: false,
295
+ grayscaleEnabled: false,
296
+ shadowEnabled: false,
297
+ shadowBlur: 5,
298
+ shadowOffsetX: 0,
299
+ shadowOffsetY: 0,
300
+ shadowColor: 'black',
301
+ shadowOpacity: 1,
302
+ draggable: false,
303
+ resizable: false,
304
+ contentEditable: false,
305
+ styleEditable: false,
306
+ text: 'RECIPIENT ADDRESS \nWILL AUTOMATICALLY \nBE PRINTED IN THIS \nPOSITION',
307
+ placeholder: '',
308
+ fontSize: 12,
309
+ fontFamily: 'Roboto',
310
+ fontStyle: 'normal',
311
+ fontWeight: 'normal',
312
+ textDecoration: '',
313
+ fill: 'black',
314
+ align: 'start',
315
+ verticalAlign: 'top',
316
+ strokeWidth: 0,
317
+ stroke: 'black',
318
+ lineHeight: 1.2,
319
+ letterSpacing: 0,
320
+ backgroundEnabled: false,
321
+ backgroundColor: '#7ED321',
322
+ backgroundOpacity: 1,
323
+ backgroundCornerRadius: 0.5,
324
+ backgroundPadding: 0.5,
325
+ },
326
+ {
327
+ id: 'sequence',
328
+ type: 'text',
329
+ name: '',
330
+ opacity: 1,
331
+ visible: true,
332
+ selectable: false,
333
+ removable: false,
334
+ alwaysOnTop: true,
335
+ showInExport: true,
336
+ x: store.width - 111 - 0.15 * DPI,
337
+ y: store.height - size[1] * DPI + 170 - 4 * DPI,
338
+ width: 111,
339
+ height: 40,
340
+ rotation: 0,
341
+ animations: [],
342
+ blurEnabled: false,
343
+ blurRadius: 10,
344
+ brightnessEnabled: false,
345
+ brightness: 0,
346
+ sepiaEnabled: false,
347
+ grayscaleEnabled: false,
348
+ shadowEnabled: false,
349
+ shadowBlur: 5,
350
+ shadowOffsetX: 0,
351
+ shadowOffsetY: 0,
352
+ shadowColor: 'black',
353
+ shadowOpacity: 1,
354
+ draggable: false,
355
+ resizable: false,
356
+ contentEditable: false,
357
+ styleEditable: false,
358
+ text: `Sequence`,
359
+ placeholder: '',
360
+ fontSize: 8,
361
+ fontFamily: 'Roboto',
362
+ fontStyle: 'normal',
363
+ fontWeight: 'normal',
364
+ textDecoration: '',
365
+ fill: 'black',
366
+ align: 'center',
367
+ verticalAlign: 'top',
368
+ strokeWidth: 0,
369
+ stroke: 'black',
370
+ lineHeight: 1.2,
371
+ letterSpacing: 0,
372
+ backgroundEnabled: false,
373
+ backgroundColor: '#7ED321',
374
+ backgroundOpacity: 1,
375
+ backgroundCornerRadius: 0.5,
376
+ backgroundPadding: 0.5,
377
+ },
378
+ {
379
+ id: 'contId',
380
+ type: 'text',
381
+ name: '',
382
+ opacity: 1,
383
+ visible: true,
384
+ selectable: false,
385
+ removable: false,
386
+ alwaysOnTop: true,
387
+ showInExport: true,
388
+ x: store.width - 111 - 0.15 * DPI,
389
+ y: store.height - size[1] * DPI + 180 - 4 * DPI,
390
+ width: 111,
391
+ height: 40,
392
+ rotation: 0,
393
+ animations: [],
394
+ blurEnabled: false,
395
+ blurRadius: 10,
396
+ brightnessEnabled: false,
397
+ brightness: 0,
398
+ sepiaEnabled: false,
399
+ grayscaleEnabled: false,
400
+ shadowEnabled: false,
401
+ shadowBlur: 5,
402
+ shadowOffsetX: 0,
403
+ shadowOffsetY: 0,
404
+ shadowColor: 'black',
405
+ shadowOpacity: 1,
406
+ draggable: false,
407
+ resizable: false,
408
+ contentEditable: false,
409
+ styleEditable: false,
410
+ text: `Cont ID`,
411
+ placeholder: '',
412
+ fontSize: 8,
413
+ fontFamily: 'Roboto',
414
+ fontStyle: 'normal',
415
+ fontWeight: 'normal',
416
+ textDecoration: '',
417
+ fill: 'black',
418
+ align: 'center',
419
+ verticalAlign: 'top',
420
+ strokeWidth: 0,
421
+ stroke: 'black',
422
+ lineHeight: 1.2,
423
+ letterSpacing: 0,
424
+ backgroundEnabled: false,
425
+ backgroundColor: '#7ED321',
426
+ backgroundOpacity: 1,
427
+ backgroundCornerRadius: 0.5,
428
+ backgroundPadding: 0.5,
429
+ }
430
+ ];
431
+
432
+ elements.forEach(element => page.addElement(element));
433
+ store.history.clear();
434
+ };
package/tsconfig.json ADDED
@@ -0,0 +1,29 @@
1
+ {
2
+ "compilerOptions": {
3
+ "noImplicitAny": true,
4
+ "outDir": "build/types",
5
+ "module": "es2020",
6
+ "target": "es5",
7
+ "jsx": "react",
8
+ "strict": true,
9
+ "esModuleInterop": true,
10
+ "allowJs": true,
11
+ "sourceMap": true,
12
+ "declaration": true,
13
+ "emitDeclarationOnly": true,
14
+ "lib": ["es2018", "dom"],
15
+ "moduleResolution": "node",
16
+ "skipLibCheck": true,
17
+ "allowSyntheticDefaultImports": true,
18
+ "forceConsistentCasingInFileNames": true,
19
+ "resolveJsonModule": true,
20
+ "isolatedModules": true,
21
+ "noEmitOnError": false,
22
+ "baseUrl" : ".",
23
+ "paths": {
24
+ "~/*": ["./src/*"]
25
+ }
26
+ },
27
+ "include": ["src/*.tsx", "src/importMeta.d.ts"],
28
+ "exclude": ["src/**/tests", "node_modules", "assets/**"],
29
+ }
@@ -0,0 +1,12 @@
1
+ {
2
+ "compilerOptions": {
3
+ "noImplicitAny": false,
4
+ "composite": true,
5
+ "skipLibCheck": true,
6
+ "module": "ESNext",
7
+ "moduleResolution": "bundler",
8
+ "allowSyntheticDefaultImports": true,
9
+ "strict": true
10
+ },
11
+ "include": ["vite.config.ts"]
12
+ }
package/vite.config.ts ADDED
@@ -0,0 +1,8 @@
1
+ import { defineConfig } from 'vite';
2
+ import react from '@vitejs/plugin-react';
3
+
4
+ // https://vitejs.dev/config/
5
+ export default defineConfig({
6
+ plugins: [react()],
7
+ assetsInclude: ['**/*.ttf'],
8
+ });
@@ -0,0 +1,80 @@
1
+ import webpack from 'webpack';
2
+ import path from 'node:path';
3
+ import TerserPlugin from 'terser-webpack-plugin';
4
+
5
+ const __dirname = path.resolve();
6
+
7
+ export default {
8
+ mode: 'production',
9
+ devtool: 'source-map',
10
+ entry: './src/index.tsx',
11
+ output: {
12
+ filename: 'index.js',
13
+ path: path.resolve(__dirname, 'build'),
14
+ library: {
15
+ type: 'module',
16
+ },
17
+ clean: true,
18
+ module: true,
19
+ },
20
+ optimization: {
21
+ minimize: true,
22
+ minimizer: [new TerserPlugin({ extractComments: false })],
23
+ },
24
+ experiments: {
25
+ outputModule: true,
26
+ },
27
+ module: {
28
+ rules: [
29
+ {
30
+ test: /\.(ts|tsx)$/,
31
+ exclude: /node_modules/,
32
+ use: {
33
+ loader: 'babel-loader',
34
+ options: {
35
+ presets: ['@babel/preset-env', '@babel/preset-typescript', '@babel/preset-react'],
36
+ plugins: ['@babel/plugin-transform-class-properties'],
37
+ },
38
+ },
39
+ },
40
+ {
41
+ test: /\.css$/,
42
+ use: ['style-loader', 'css-loader'],
43
+ },
44
+ {
45
+ test: /\.scss$/,
46
+ use: ['style-loader', 'css-loader', 'sass-loader'],
47
+ },
48
+ {
49
+ test: /\.svg$/,
50
+ use: [
51
+ {
52
+ loader: 'svg-url-loader',
53
+ options: {
54
+ noquotes: true,
55
+ },
56
+ }
57
+ ],
58
+ },
59
+ {
60
+ test: /\.(woff|woff2|eot|ttf|otf)$/,
61
+ type: "asset/inline"
62
+ },
63
+ {
64
+ test: /\.(png|jpe?g|gif)$/i,
65
+ use: ['file-loader'],
66
+ },
67
+ ],
68
+ },
69
+ resolve: {
70
+ extensions: ['.ts', '.tsx', '.js', '.jsx', '.json'],
71
+ alias: {
72
+ '~': path.resolve(__dirname, 'src'),
73
+ },
74
+ },
75
+ plugins: [
76
+ new webpack.optimize.LimitChunkCountPlugin({
77
+ maxChunks: 1,
78
+ }),
79
+ ],
80
+ };