fontastic 1.3.1 → 1.4.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.
Files changed (74) hide show
  1. package/.github/workflows/claude-code-review.yml +1 -1
  2. package/.github/workflows/claude.yml +1 -1
  3. package/.github/workflows/macos.yml +5 -5
  4. package/.github/workflows/release-please.yml +1 -1
  5. package/.github/workflows/release.yml +2 -2
  6. package/.github/workflows/ubuntu.yml +7 -7
  7. package/.github/workflows/windows.yml +5 -5
  8. package/.release-please-manifest.json +1 -1
  9. package/CHANGELOG.md +7 -0
  10. package/README.md +4 -4
  11. package/angular.json +8 -3
  12. package/app/core/FontFinder.js +17 -12
  13. package/app/core/FontFinder.ts +18 -12
  14. package/app/core/FontManager.js +13 -14
  15. package/app/core/FontManager.ts +12 -13
  16. package/app/core/MessageHandler.js +0 -1
  17. package/app/core/MessageHandler.ts +0 -4
  18. package/app/database/entity/Store.schema.js +1 -0
  19. package/app/database/entity/Store.schema.ts +1 -0
  20. package/app/database/repository/Collection.repository.js +0 -11
  21. package/app/database/repository/Collection.repository.ts +0 -22
  22. package/app/database/repository/Store.repository.js +50 -69
  23. package/app/database/repository/Store.repository.ts +47 -86
  24. package/app/enums/ChannelType.js +0 -1
  25. package/app/enums/ChannelType.ts +0 -1
  26. package/app/main.js +3 -2
  27. package/app/main.ts +3 -2
  28. package/app/package-lock.json +144 -1104
  29. package/app/package.json +4 -6
  30. package/app/preload.js +51 -0
  31. package/app/preload.ts +59 -0
  32. package/app/types/Bridge.js +3 -0
  33. package/app/types/Bridge.ts +19 -0
  34. package/app/types/index.js +1 -0
  35. package/app/types/index.ts +1 -0
  36. package/knip.json +18 -0
  37. package/package.json +44 -53
  38. package/src/app/app.component.spec.ts +3 -3
  39. package/src/app/app.component.ts +2 -15
  40. package/src/app/core/services/database/database.service.ts +8 -15
  41. package/src/app/core/services/electron/electron.service.ts +5 -46
  42. package/src/app/core/services/font-loader/font-loader.service.ts +60 -0
  43. package/src/app/core/services/index.ts +1 -0
  44. package/src/app/core/services/message/message.service.ts +19 -27
  45. package/src/app/core/services/presentation/presentation.service.ts +9 -2
  46. package/src/app/home/home.component.spec.ts +3 -3
  47. package/src/app/home/home.component.ts +4 -8
  48. package/src/app/layout/footer/footer.component.ts +6 -6
  49. package/src/app/shared/components/index.ts +0 -1
  50. package/src/app/shared/components/page-not-found/page-not-found.component.ts +2 -8
  51. package/src/app/shared/components/preview/preview.component.html +1 -0
  52. package/src/app/shared/components/preview/preview.component.ts +3 -31
  53. package/src/app/shared/components/rule-builder/rule-builder.component.html +4 -4
  54. package/src/app/shared/components/rule-builder/rule-builder.component.ts +13 -13
  55. package/src/app/shared/components/waterfall/waterfall.component.ts +1 -1
  56. package/src/app/shared/directives/index.ts +1 -1
  57. package/src/app/shared/directives/lazy-font/lazy-font.directive.ts +23 -0
  58. package/src/app/shared/shared.module.ts +3 -3
  59. package/src/main.ts +2 -2
  60. package/tsconfig.serve.json +4 -16
  61. package/app/helpers/command.js +0 -28
  62. package/app/helpers/command.ts +0 -20
  63. package/app/helpers/random.js +0 -16
  64. package/app/helpers/random.ts +0 -12
  65. package/src/app/shared/components/prompt-dialog/prompt-dialog.component.html +0 -36
  66. package/src/app/shared/components/prompt-dialog/prompt-dialog.component.ts +0 -40
  67. package/src/app/shared/directives/webview/webview.directive.spec.ts +0 -8
  68. package/src/app/shared/directives/webview/webview.directive.ts +0 -9
  69. package/src/styles/themes/dashboard.scss +0 -293
  70. package/src/styles/themes/euphoria.scss +0 -284
  71. package/src/styles/themes/mellow.scss +0 -281
  72. package/src/styles/themes/midnight.scss +0 -284
  73. package/src/styles/themes/passion.scss +0 -281
  74. package/src/styles/themes/swiss.scss +0 -284
@@ -227,77 +227,58 @@ exports.StoreRepository = {
227
227
  .getRawMany();
228
228
  });
229
229
  },
230
+ normalizeStore(item) {
231
+ const data = {
232
+ collection_id: item.collection_id,
233
+ file_name: item.file_name || '',
234
+ file_path: item.file_path || '',
235
+ file_size: item.file_size || 0,
236
+ file_size_pretty: item.file_size_pretty || '',
237
+ file_type: item.file_type || '',
238
+ installable: item.installable || 0,
239
+ temporary: item.temporary || 0,
240
+ favorite: item.favorite || 0,
241
+ system: item.system || 0,
242
+ };
243
+ const optionalTextFields = [
244
+ 'compatible_full_name',
245
+ 'copyright',
246
+ 'description',
247
+ 'designer',
248
+ 'designer_url',
249
+ 'font_family',
250
+ 'font_subfamily',
251
+ 'full_name',
252
+ 'license',
253
+ 'license_url',
254
+ 'manufacturer',
255
+ 'manufacturer_url',
256
+ 'post_script_name',
257
+ 'preferred_family',
258
+ 'preferred_sub_family',
259
+ 'sample_text',
260
+ 'trademark',
261
+ 'unique_id',
262
+ 'version',
263
+ ];
264
+ for (const field of optionalTextFields) {
265
+ if (item[field]) {
266
+ data[field] = item[field];
267
+ }
268
+ }
269
+ return data;
270
+ },
230
271
  create(item) {
231
272
  return __awaiter(this, void 0, void 0, function* () {
232
- let data = {};
233
- data.collection_id = item.collection_id;
234
- data.file_name = item.file_name ? item.file_name : '';
235
- data.file_path = item.file_path ? item.file_path : '';
236
- data.file_size = item.file_size ? item.file_size : 0;
237
- data.file_size_pretty = item.file_size_pretty ? item.file_size_pretty : '';
238
- data.file_type = item.file_type ? item.file_type : '';
239
- data.installable = item.installable ? item.installable : 0;
240
- data.temporary = item.temporary ? item.temporary : 0;
241
- data.favorite = item.favorite ? item.favorite : 0;
242
- data.system = item.system ? item.system : 0;
243
- if (item.compatible_full_name && item.compatible_full_name !== '') {
244
- data.compatible_full_name = item.compatible_full_name;
245
- }
246
- if (item.copyright && item.copyright !== '') {
247
- data.copyright = item.copyright;
248
- }
249
- if (item.description && item.description !== '') {
250
- data.description = item.description;
251
- }
252
- if (item.designer && item.designer !== '') {
253
- data.designer = item.designer;
254
- }
255
- if (item.designer_url && item.designer_url !== '') {
256
- data.designer_url = item.designer_url;
257
- }
258
- if (item.font_family && item.font_family !== '') {
259
- data.font_family = item.font_family;
260
- }
261
- if (item.font_subfamily && item.font_subfamily !== '') {
262
- data.font_subfamily = item.font_subfamily;
263
- }
264
- if (item.full_name && item.full_name !== '') {
265
- data.full_name = item.full_name;
266
- }
267
- if (item.license && item.license !== '') {
268
- data.license = item.license;
269
- }
270
- if (item.license_url && item.license_url !== '') {
271
- data.license_url = item.license_url;
272
- }
273
- if (item.manufacturer && item.manufacturer !== '') {
274
- data.manufacturer = item.manufacturer;
275
- }
276
- if (item.manufacturer_url && item.manufacturer_url !== '') {
277
- data.manufacturer_url = item.manufacturer_url;
278
- }
279
- if (item.post_script_name && item.post_script_name !== '') {
280
- data.post_script_name = item.post_script_name;
281
- }
282
- if (item.preferred_family && item.preferred_family !== '') {
283
- data.preferred_family = item.preferred_family;
284
- }
285
- if (item.preferred_sub_family && item.preferred_sub_family !== '') {
286
- data.preferred_sub_family = item.preferred_sub_family;
287
- }
288
- if (item.sample_text && item.sample_text !== '') {
289
- data.sample_text = item.sample_text;
290
- }
291
- if (item.trademark && item.trademark !== '') {
292
- data.trademark = item.trademark;
293
- }
294
- if (item.unique_id && item.unique_id !== '') {
295
- data.unique_id = item.unique_id;
296
- }
297
- if (item.version && item.version !== '') {
298
- data.version = item.version;
299
- }
300
- return yield this.createQueryBuilder().insert().into(entity_1.Store).values(data).execute();
273
+ return yield this.createQueryBuilder().insert().into(entity_1.Store).values(this.normalizeStore(item)).execute();
274
+ });
275
+ },
276
+ createMany(items) {
277
+ return __awaiter(this, void 0, void 0, function* () {
278
+ if (!items.length)
279
+ return;
280
+ const rows = items.map((item) => this.normalizeStore(item));
281
+ return yield this.createQueryBuilder().insert().into(entity_1.Store).values(rows).execute();
301
282
  });
302
283
  },
303
284
  evaluateSmartRules(rules_1, matchType_1) {
@@ -230,98 +230,59 @@ export const StoreRepository = {
230
230
  .getRawMany();
231
231
  },
232
232
 
233
- async create(item: Store) {
234
- let data = <Store>{};
235
-
236
- data.collection_id = item.collection_id;
237
- data.file_name = item.file_name ? item.file_name : '';
238
- data.file_path = item.file_path ? item.file_path : '';
239
- data.file_size = item.file_size ? item.file_size : 0;
240
- data.file_size_pretty = item.file_size_pretty ? item.file_size_pretty : '';
241
- data.file_type = item.file_type ? item.file_type : '';
242
-
243
- data.installable = item.installable ? item.installable : 0;
244
- data.temporary = item.temporary ? item.temporary : 0;
245
- data.favorite = item.favorite ? item.favorite : 0;
246
- data.system = item.system ? item.system : 0;
247
-
248
- if (item.compatible_full_name && item.compatible_full_name !== '') {
249
- data.compatible_full_name = item.compatible_full_name;
250
- }
251
-
252
- if (item.copyright && item.copyright !== '') {
253
- data.copyright = item.copyright;
254
- }
255
-
256
- if (item.description && item.description !== '') {
257
- data.description = item.description;
258
- }
259
-
260
- if (item.designer && item.designer !== '') {
261
- data.designer = item.designer;
262
- }
263
-
264
- if (item.designer_url && item.designer_url !== '') {
265
- data.designer_url = item.designer_url;
266
- }
267
-
268
- if (item.font_family && item.font_family !== '') {
269
- data.font_family = item.font_family;
270
- }
271
-
272
- if (item.font_subfamily && item.font_subfamily !== '') {
273
- data.font_subfamily = item.font_subfamily;
274
- }
275
-
276
- if (item.full_name && item.full_name !== '') {
277
- data.full_name = item.full_name;
278
- }
279
-
280
- if (item.license && item.license !== '') {
281
- data.license = item.license;
282
- }
283
-
284
- if (item.license_url && item.license_url !== '') {
285
- data.license_url = item.license_url;
286
- }
287
-
288
- if (item.manufacturer && item.manufacturer !== '') {
289
- data.manufacturer = item.manufacturer;
290
- }
291
-
292
- if (item.manufacturer_url && item.manufacturer_url !== '') {
293
- data.manufacturer_url = item.manufacturer_url;
294
- }
295
-
296
- if (item.post_script_name && item.post_script_name !== '') {
297
- data.post_script_name = item.post_script_name;
298
- }
299
-
300
- if (item.preferred_family && item.preferred_family !== '') {
301
- data.preferred_family = item.preferred_family;
302
- }
303
-
304
- if (item.preferred_sub_family && item.preferred_sub_family !== '') {
305
- data.preferred_sub_family = item.preferred_sub_family;
306
- }
233
+ normalizeStore(item: Store): Store {
234
+ const data = <Store>{
235
+ collection_id: item.collection_id,
236
+ file_name: item.file_name || '',
237
+ file_path: item.file_path || '',
238
+ file_size: item.file_size || 0,
239
+ file_size_pretty: item.file_size_pretty || '',
240
+ file_type: item.file_type || '',
241
+ installable: item.installable || 0,
242
+ temporary: item.temporary || 0,
243
+ favorite: item.favorite || 0,
244
+ system: item.system || 0,
245
+ };
307
246
 
308
- if (item.sample_text && item.sample_text !== '') {
309
- data.sample_text = item.sample_text;
310
- }
247
+ const optionalTextFields = [
248
+ 'compatible_full_name',
249
+ 'copyright',
250
+ 'description',
251
+ 'designer',
252
+ 'designer_url',
253
+ 'font_family',
254
+ 'font_subfamily',
255
+ 'full_name',
256
+ 'license',
257
+ 'license_url',
258
+ 'manufacturer',
259
+ 'manufacturer_url',
260
+ 'post_script_name',
261
+ 'preferred_family',
262
+ 'preferred_sub_family',
263
+ 'sample_text',
264
+ 'trademark',
265
+ 'unique_id',
266
+ 'version',
267
+ ] as const;
311
268
 
312
- if (item.trademark && item.trademark !== '') {
313
- data.trademark = item.trademark;
269
+ for (const field of optionalTextFields) {
270
+ if (item[field]) {
271
+ (data as any)[field] = item[field];
272
+ }
314
273
  }
315
274
 
316
- if (item.unique_id && item.unique_id !== '') {
317
- data.unique_id = item.unique_id;
318
- }
275
+ return data;
276
+ },
319
277
 
320
- if (item.version && item.version !== '') {
321
- data.version = item.version;
322
- }
278
+ async create(item: Store) {
279
+ return await this.createQueryBuilder().insert().into(Store).values(this.normalizeStore(item)).execute();
280
+ },
323
281
 
324
- return await this.createQueryBuilder().insert().into(Store).values(data).execute();
282
+ async createMany(items: Store[]) {
283
+ if (!items.length) return;
284
+ const rows = items.map((item: Store) => this.normalizeStore(item));
285
+ return await this.createQueryBuilder().insert().into(Store).values(rows).execute();
325
286
  },
326
287
 
327
288
  async evaluateSmartRules(rules: SmartCollectionRule[], matchType: string, options: any = {}) {
@@ -14,7 +14,6 @@ var ChannelType;
14
14
  ChannelType["IPC_DBCONNECTION_DELETE"] = "IPC_DBCONNECTION_DELETE";
15
15
  ChannelType["IPC_DBCONNECTION_TEST"] = "IPC_DBCONNECTION_TEST";
16
16
  ChannelType["IPC_DATABASE_DROP"] = "IPC_DATABASE_DROP";
17
- ChannelType["IPC_EXEC_CMD"] = "IPC_EXEC_CMD";
18
17
  ChannelType["IPC_AUTH_USER"] = "IPC_AUTH_USER";
19
18
  ChannelType["IPC_SCAN_FILES"] = "IPC_SCAN_FILES";
20
19
  ChannelType["IPC_SCAN_FOLDERS"] = "IPC_SCAN_FOLDERS";
@@ -14,7 +14,6 @@ export enum ChannelType {
14
14
  IPC_DBCONNECTION_TEST = 'IPC_DBCONNECTION_TEST',
15
15
  IPC_DATABASE_DROP = 'IPC_DATABASE_DROP',
16
16
 
17
- IPC_EXEC_CMD = 'IPC_EXEC_CMD',
18
17
  IPC_AUTH_USER = 'IPC_AUTH_USER',
19
18
  IPC_SCAN_FILES = 'IPC_SCAN_FILES',
20
19
  IPC_SCAN_FOLDERS = 'IPC_SCAN_FOLDERS',
package/app/main.js CHANGED
@@ -63,9 +63,10 @@ function createWindow() {
63
63
  width: size.width,
64
64
  height: size.height,
65
65
  webPreferences: {
66
- nodeIntegration: true,
66
+ preload: path.join(__dirname, 'preload.js'),
67
+ nodeIntegration: false,
67
68
  allowRunningInsecureContent: serve,
68
- contextIsolation: false,
69
+ contextIsolation: true,
69
70
  webSecurity: !serve,
70
71
  },
71
72
  });
package/app/main.ts CHANGED
@@ -80,9 +80,10 @@ function createWindow(): BrowserWindow {
80
80
  width: size.width,
81
81
  height: size.height,
82
82
  webPreferences: {
83
- nodeIntegration: true,
83
+ preload: path.join(__dirname, 'preload.js'),
84
+ nodeIntegration: false,
84
85
  allowRunningInsecureContent: serve,
85
- contextIsolation: false,
86
+ contextIsolation: true,
86
87
  webSecurity: !serve,
87
88
  },
88
89
  });