@pdfme/common 2.2.0 → 3.0.0-beta.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.
Files changed (54) hide show
  1. package/dist/cjs/__tests__/helper.test.js +292 -231
  2. package/dist/cjs/__tests__/helper.test.js.map +1 -1
  3. package/dist/cjs/src/constants.js +3 -15
  4. package/dist/cjs/src/constants.js.map +1 -1
  5. package/dist/cjs/src/helper.js +72 -98
  6. package/dist/cjs/src/helper.js.map +1 -1
  7. package/dist/cjs/src/index.js +7 -33
  8. package/dist/cjs/src/index.js.map +1 -1
  9. package/dist/cjs/src/schema.js +18 -67
  10. package/dist/cjs/src/schema.js.map +1 -1
  11. package/dist/cjs/src/types.js +3 -0
  12. package/dist/cjs/src/types.js.map +1 -0
  13. package/dist/esm/__tests__/helper.test.js +270 -232
  14. package/dist/esm/__tests__/helper.test.js.map +1 -1
  15. package/dist/esm/src/constants.js +2 -14
  16. package/dist/esm/src/constants.js.map +1 -1
  17. package/dist/esm/src/helper.js +68 -97
  18. package/dist/esm/src/helper.js.map +1 -1
  19. package/dist/esm/src/index.js +3 -5
  20. package/dist/esm/src/index.js.map +1 -1
  21. package/dist/esm/src/schema.js +15 -64
  22. package/dist/esm/src/schema.js.map +1 -1
  23. package/dist/esm/src/types.js +2 -0
  24. package/dist/esm/src/types.js.map +1 -0
  25. package/dist/types/src/constants.d.ts +2 -14
  26. package/dist/types/src/helper.d.ts +11 -2
  27. package/dist/types/src/index.d.ts +5 -7
  28. package/dist/types/src/schema.d.ts +715 -3383
  29. package/dist/types/src/types.d.ts +127 -0
  30. package/package.json +5 -6
  31. package/src/constants.ts +2 -16
  32. package/src/helper.ts +108 -115
  33. package/src/index.ts +28 -81
  34. package/src/schema.ts +20 -80
  35. package/src/types.ts +124 -0
  36. package/tsconfig.cjs.json +3 -2
  37. package/tsconfig.esm.json +3 -2
  38. package/dist/cjs/__tests__/font.test.js +0 -464
  39. package/dist/cjs/__tests__/font.test.js.map +0 -1
  40. package/dist/cjs/src/font.js +0 -304
  41. package/dist/cjs/src/font.js.map +0 -1
  42. package/dist/cjs/src/type.js +0 -12
  43. package/dist/cjs/src/type.js.map +0 -1
  44. package/dist/esm/__tests__/font.test.js +0 -439
  45. package/dist/esm/__tests__/font.test.js.map +0 -1
  46. package/dist/esm/src/font.js +0 -268
  47. package/dist/esm/src/font.js.map +0 -1
  48. package/dist/esm/src/type.js +0 -6
  49. package/dist/esm/src/type.js.map +0 -1
  50. package/dist/types/__tests__/font.test.d.ts +0 -1
  51. package/dist/types/src/font.d.ts +0 -34
  52. package/dist/types/src/type.d.ts +0 -78
  53. package/src/font.ts +0 -350
  54. package/src/type.ts +0 -69
package/src/types.ts ADDED
@@ -0,0 +1,124 @@
1
+ import { z } from 'zod';
2
+ import type { PDFPage, PDFDocument } from '@pdfme/pdf-lib';
3
+ import type { WidgetProps as _PropPanelWidgetProps, Schema as _PropPanelSchema } from 'form-render';
4
+ // prettier-ignore
5
+ import {Lang, Size, Schema, Font, SchemaForUI, BasePdf, Template, GeneratorOptions, GenerateProps, UIOptions, UIProps, PreviewProps, DesignerProps} from './schema.js';
6
+
7
+ export type PropPanelSchema = _PropPanelSchema;
8
+ export type ChangeSchemas = (objs: { key: string; value: any; schemaId: string }[]) => void;
9
+
10
+ /**
11
+ * Properties used for PDF rendering.
12
+ * @template T Type of the extended Schema object.
13
+ * @property {string} value The string used for PDF rendering.
14
+ * @property {T} schema Extended Schema object for rendering.
15
+ * @property {typeof import('@pdfme/pdf-lib')} pdfLib The pdf-lib library used for rendering.
16
+ * @property {PDFDocument} pdfDoc PDFDocument object from pdf-lib.
17
+ * @property {PDFPage} page PDFPage object from pdf-lib.
18
+ * @property {GeneratorOptions} options Options object passed from the generator.
19
+ * @property {Map<string, any>} _cache Cache shared only during the execution of the generate function (useful for caching images, etc. if needed).
20
+ */
21
+ export interface PDFRenderProps<T extends Schema> {
22
+ value: string;
23
+ schema: T;
24
+ pdfLib: typeof import('@pdfme/pdf-lib');
25
+ pdfDoc: PDFDocument;
26
+ page: PDFPage;
27
+ options: GeneratorOptions;
28
+
29
+ _cache: Map<string, any>;
30
+ }
31
+
32
+ /**
33
+ * Type for properties used in UI rendering.
34
+ *
35
+ * @template T - Type of the extended Schema object.
36
+ * @property {T} schema - Extended Schema object for rendering.
37
+ * @property {'viewer' | 'form' | 'designer'} mode - String indicating the rendering state. 'designer' is only used when the field is in edit mode in the Designer.
38
+ * @property {number} [tabIndex] - Tab index for Form.
39
+ * @property {string} [placeholder] - Placeholder text for Form.
40
+ * @property {() => void} [stopEditing] - Stops editing mode, can be used when the mode is 'designer'.
41
+ * @property {string} value - The string used for UI rendering.
42
+ * @property {(value: string) => void} [onChange] - Used to change the value. Only applicable when the mode is 'form' or 'designer'.
43
+ * @property {HTMLDivElement} rootElement - The root HTMLDivElement for the UI.
44
+ * @property {UIOptions} options - Options object passed from the Viewer, Form, or Designer.
45
+ */
46
+ export type UIRenderProps<T extends Schema> = {
47
+ schema: T;
48
+ mode: 'viewer' | 'form' | 'designer';
49
+ tabIndex?: number;
50
+ placeholder?: string;
51
+ stopEditing?: () => void;
52
+ value: string;
53
+ onChange?: (value: string) => void;
54
+ rootElement: HTMLDivElement;
55
+ options: UIOptions;
56
+ };
57
+
58
+ type PropPanelProps = {
59
+ rootElement: HTMLDivElement;
60
+ activeSchema: SchemaForUI;
61
+ activeElements: HTMLElement[];
62
+ changeSchemas: ChangeSchemas;
63
+ schemas: SchemaForUI[];
64
+ pageSize: Size;
65
+ options: UIOptions;
66
+ };
67
+ export type PropPanelWidgetProps = _PropPanelWidgetProps & PropPanelProps;
68
+
69
+ /**
70
+ * Used for customizing the property panel.
71
+ * @template T - Type of the extended Schema object.
72
+ * @property {Record<string, PropPanelSchema> | ((propPanelProps: Omit<PropPanelProps, 'rootElement'>) => Record<string, PropPanelSchema>)} propPanelSchema - A function returning a form-render schema object or the schema object itself. When a function, it takes properties passed from the designer as arguments.
73
+ * @property {Record<string, (props: PropPanelWidgetProps) => void>} [widgets] - An object of functions returning form-render widgets. The functions take, as arguments, both form-render's WidgetProps and properties passed from the designer.
74
+ * @property {string} defaultValue - The default input value set when adding the schema.
75
+ * @property {T} defaultSchema - The default schema set when adding the schema.
76
+ */
77
+ export interface PropPanel<T extends Schema> {
78
+ propPanelSchema:
79
+ | ((propPanelProps: Omit<PropPanelProps, 'rootElement'>) => Record<string, PropPanelSchema>)
80
+ | Record<string, PropPanelSchema>;
81
+
82
+ widgets?: Record<string, (props: PropPanelWidgetProps) => void>;
83
+ defaultValue: string;
84
+ defaultSchema: T;
85
+ }
86
+
87
+ /**
88
+ * The Plugin interface is used for PDF and UI rendering, as well as defining the property panel.
89
+ * The 'pdf' is used in the generator package, 'ui' is used in the viewer, form, and designer packages, and 'propPanel' is used in the designer package.
90
+ * Objects defined as Plugins using this interface can be used with a consistent interface across all packages.
91
+ * @template T Type of the extended Schema object.
92
+ * @property {function} pdf Function for rendering PDFs.
93
+ * @property {function} ui Function for rendering UI.
94
+ * @property {PropPanel} propPanel Object for defining the property panel.
95
+ */
96
+ export type Plugin<T extends Schema & { [key: string]: any }> = {
97
+ pdf: (arg: PDFRenderProps<T>) => Promise<void>;
98
+ ui: (arg: UIRenderProps<T>) => Promise<void>;
99
+ propPanel: PropPanel<T>;
100
+ };
101
+
102
+ export type Plugins = { [key: string]: Plugin<any> | undefined };
103
+
104
+ export type Lang = z.infer<typeof Lang>;
105
+ export type Size = z.infer<typeof Size>;
106
+ export type Schema = z.infer<typeof Schema>;
107
+ export type SchemaForUI = z.infer<typeof SchemaForUI>;
108
+
109
+ /**
110
+ * Represents the Font type definition.
111
+ * @property {Object} [x: string] - Object key is the font name.
112
+ * @property {(string | ArrayBuffer | Uint8Array)} data - The font data.
113
+ * @property {boolean} [fallback] - Please set to true for the fallback font when no font is specified. Only one value within the given Font object needs to be set to true.
114
+ * @property {boolean} [subset] - The default is true (use subset font). So if you don't want to use a subset font, please set it to false.
115
+ */
116
+ export type Font = z.infer<typeof Font>;
117
+ export type BasePdf = z.infer<typeof BasePdf>;
118
+ export type Template = z.infer<typeof Template>;
119
+ export type GeneratorOptions = z.infer<typeof GeneratorOptions>;
120
+ export type GenerateProps = z.infer<typeof GenerateProps> & { plugins?: Plugins };
121
+ export type UIOptions = z.infer<typeof UIOptions>;
122
+ export type UIProps = z.infer<typeof UIProps> & { plugins?: Plugins };
123
+ export type PreviewProps = z.infer<typeof PreviewProps> & { plugins?: Plugins };
124
+ export type DesignerProps = z.infer<typeof DesignerProps> & { plugins?: Plugins };
package/tsconfig.cjs.json CHANGED
@@ -4,6 +4,7 @@
4
4
  "module": "commonjs",
5
5
  "outDir": "./dist/cjs",
6
6
  "declaration": true,
7
- "declarationDir": "dist/types"
7
+ "declarationDir": "dist/types",
8
+ "skipLibCheck": true,
8
9
  }
9
- }
10
+ }
package/tsconfig.esm.json CHANGED
@@ -4,6 +4,7 @@
4
4
  "module": "ESNext",
5
5
  "outDir": "./dist/esm",
6
6
  "declaration": true,
7
- "declarationDir": "dist/types"
7
+ "declarationDir": "dist/types",
8
+ "skipLibCheck": true,
8
9
  }
9
- }
10
+ }
@@ -1,464 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
26
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
27
- return new (P || (P = Promise))(function (resolve, reject) {
28
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
29
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
30
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
31
- step((generator = generator.apply(thisArg, _arguments || [])).next());
32
- });
33
- };
34
- Object.defineProperty(exports, "__esModule", { value: true });
35
- const fs_1 = require("fs");
36
- const path = __importStar(require("path"));
37
- const font_1 = require("../src/font");
38
- const src_1 = require("../src");
39
- const sansData = (0, fs_1.readFileSync)(path.join(__dirname, `/assets/fonts/SauceHanSansJP.ttf`));
40
- const serifData = (0, fs_1.readFileSync)(path.join(__dirname, `/assets/fonts/SauceHanSerifJP.ttf`));
41
- const getSampleFont = () => ({
42
- SauceHanSansJP: { fallback: true, data: sansData },
43
- SauceHanSerifJP: { data: serifData },
44
- });
45
- const getTemplate = () => ({
46
- basePdf: src_1.BLANK_PDF,
47
- schemas: [
48
- {
49
- a: {
50
- type: 'text',
51
- fontName: 'SauceHanSansJP',
52
- position: { x: 0, y: 0 },
53
- width: 100,
54
- height: 100,
55
- },
56
- b: {
57
- type: 'text',
58
- position: { x: 0, y: 0 },
59
- width: 100,
60
- height: 100,
61
- },
62
- },
63
- ],
64
- });
65
- const getTextSchema = () => {
66
- const textSchema = {
67
- position: { x: 0, y: 0 }, type: 'text', fontSize: 14, characterSpacing: 1, width: 50, height: 20
68
- };
69
- return textSchema;
70
- };
71
- describe('checkFont test', () => {
72
- test('success test: no fontName in Schemas', () => {
73
- const _getTemplate = () => ({
74
- basePdf: src_1.BLANK_PDF,
75
- schemas: [
76
- {
77
- a: {
78
- type: 'text',
79
- position: { x: 0, y: 0 },
80
- width: 100,
81
- height: 100,
82
- },
83
- b: {
84
- type: 'text',
85
- position: { x: 0, y: 0 },
86
- width: 100,
87
- height: 100,
88
- },
89
- },
90
- ],
91
- });
92
- try {
93
- (0, font_1.checkFont)({ template: _getTemplate(), font: getSampleFont() });
94
- expect.anything();
95
- }
96
- catch (e) {
97
- fail();
98
- }
99
- });
100
- test('success test: fontName in Schemas(fallback font)', () => {
101
- try {
102
- (0, font_1.checkFont)({ template: getTemplate(), font: getSampleFont() });
103
- expect.anything();
104
- }
105
- catch (e) {
106
- fail();
107
- }
108
- });
109
- test('success test: fontName in Schemas(not fallback font)', () => {
110
- const getFont = () => ({
111
- SauceHanSansJP: { data: sansData },
112
- SauceHanSerifJP: { fallback: true, data: serifData },
113
- });
114
- try {
115
- (0, font_1.checkFont)({ template: getTemplate(), font: getFont() });
116
- expect.anything();
117
- }
118
- catch (e) {
119
- fail();
120
- }
121
- });
122
- test('fail test: no fallback font', () => {
123
- const getFont = () => ({
124
- SauceHanSansJP: { data: sansData },
125
- SauceHanSerifJP: { data: serifData },
126
- });
127
- try {
128
- (0, font_1.checkFont)({ template: getTemplate(), font: getFont() });
129
- fail();
130
- }
131
- catch (e) {
132
- expect(e.message).toEqual('fallback flag is not found in font. true fallback flag must be only one.');
133
- }
134
- });
135
- test('fail test: too many fallback font', () => {
136
- const getFont = () => ({
137
- SauceHanSansJP: { data: sansData, fallback: true },
138
- SauceHanSerifJP: { data: serifData, fallback: true },
139
- });
140
- try {
141
- (0, font_1.checkFont)({ template: getTemplate(), font: getFont() });
142
- fail();
143
- }
144
- catch (e) {
145
- expect(e.message).toEqual('2 fallback flags found in font. true fallback flag must be only one.');
146
- }
147
- });
148
- test('fail test: fontName in Schemas not found in font(single)', () => {
149
- const _getTemplate = () => ({
150
- basePdf: src_1.BLANK_PDF,
151
- schemas: [
152
- {
153
- a: {
154
- type: 'text',
155
- fontName: 'SauceHanSansJP2',
156
- position: { x: 0, y: 0 },
157
- width: 100,
158
- height: 100,
159
- },
160
- b: {
161
- type: 'text',
162
- position: { x: 0, y: 0 },
163
- width: 100,
164
- height: 100,
165
- },
166
- },
167
- ],
168
- });
169
- try {
170
- (0, font_1.checkFont)({ template: _getTemplate(), font: getSampleFont() });
171
- fail();
172
- }
173
- catch (e) {
174
- expect(e.message).toEqual('SauceHanSansJP2 of template.schemas is not found in font.');
175
- }
176
- });
177
- test('fail test: fontName in Schemas not found in font(single)', () => {
178
- const _getTemplate = () => ({
179
- basePdf: src_1.BLANK_PDF,
180
- schemas: [
181
- {
182
- a: {
183
- type: 'text',
184
- fontName: 'SauceHanSansJP2',
185
- position: { x: 0, y: 0 },
186
- width: 100,
187
- height: 100,
188
- },
189
- b: {
190
- type: 'text',
191
- fontName: 'SauceHanSerifJP2',
192
- position: { x: 0, y: 0 },
193
- width: 100,
194
- height: 100,
195
- },
196
- },
197
- ],
198
- });
199
- try {
200
- (0, font_1.checkFont)({ template: _getTemplate(), font: getSampleFont() });
201
- fail();
202
- }
203
- catch (e) {
204
- expect(e.message).toEqual('SauceHanSansJP2,SauceHanSerifJP2 of template.schemas is not found in font.');
205
- }
206
- });
207
- });
208
- describe('getSplitPosition test with mocked font width calculations', () => {
209
- /**
210
- * To simplify these tests we mock the widthOfTextAtSize function to return
211
- * the length of the text in number of characters.
212
- * Therefore, setting the boxWidthInPt to 5 should result in a split after 5 characters.
213
- */
214
- let widthOfTextAtSizeSpy;
215
- beforeAll(() => {
216
- // @ts-ignore
217
- widthOfTextAtSizeSpy = jest.spyOn(require('../src/font'), 'widthOfTextAtSize');
218
- widthOfTextAtSizeSpy.mockImplementation((text) => {
219
- return text.length;
220
- });
221
- });
222
- afterAll(() => {
223
- widthOfTextAtSizeSpy.mockRestore();
224
- });
225
- const mockedFont = {};
226
- const mockCalcValues = {
227
- font: mockedFont,
228
- fontSize: 12,
229
- characterSpacing: 1,
230
- boxWidthInPt: 5,
231
- };
232
- it('does not split an empty string', () => {
233
- expect((0, font_1.getSplittedLines)('', mockCalcValues)).toEqual(['']);
234
- });
235
- it('does not split a short line', () => {
236
- expect((0, font_1.getSplittedLines)('a', mockCalcValues)).toEqual(['a']);
237
- expect((0, font_1.getSplittedLines)('aaaa', mockCalcValues)).toEqual(['aaaa']);
238
- });
239
- it('splits a line to the nearest previous space', () => {
240
- expect((0, font_1.getSplittedLines)('aaa bbb', mockCalcValues)).toEqual(['aaa', 'bbb']);
241
- });
242
- it('splits a line where the split point is on a space', () => {
243
- expect((0, font_1.getSplittedLines)('aaaaa bbbbb', mockCalcValues)).toEqual(['aaaaa', 'bbbbb']);
244
- });
245
- it('splits a long line in the middle of a word if too long', () => {
246
- expect((0, font_1.getSplittedLines)('aaaaaa bbb', mockCalcValues)).toEqual(['aaaaa', 'a bbb']);
247
- });
248
- it('splits a long line without spaces at exactly 5 chars', () => {
249
- expect((0, font_1.getSplittedLines)('abcdef', mockCalcValues)).toEqual(['abcde', 'f']);
250
- });
251
- it('splits a very long line without spaces at exactly 5 chars', () => {
252
- expect((0, font_1.getSplittedLines)('abcdefghijklmn', mockCalcValues)).toEqual(['abcde', 'fghij', 'klmn']);
253
- });
254
- it('splits a line with lots of words', () => {
255
- expect((0, font_1.getSplittedLines)('a b c d e', mockCalcValues)).toEqual(['a b c', 'd e']);
256
- });
257
- });
258
- describe('getSplittedLines test with real font width calculations', () => {
259
- const font = (0, font_1.getDefaultFont)();
260
- const baseCalcValues = {
261
- fontSize: 12,
262
- characterSpacing: 1,
263
- boxWidthInPt: 40,
264
- };
265
- it('should not split a line when the text is shorter than the width', () => {
266
- (0, font_1.getFontKitFont)(getTextSchema(), font).then((fontKitFont) => {
267
- const fontWidthCalcs = Object.assign({}, baseCalcValues, { font: fontKitFont });
268
- const result = (0, font_1.getSplittedLines)('short', fontWidthCalcs);
269
- expect(result).toEqual(['short']);
270
- });
271
- });
272
- it('should split a line when the text is longer than the width', () => {
273
- (0, font_1.getFontKitFont)(getTextSchema(), font).then((fontKitFont) => {
274
- const fontWidthCalcs = Object.assign({}, baseCalcValues, { font: fontKitFont });
275
- const result = (0, font_1.getSplittedLines)('this will wrap', fontWidthCalcs);
276
- expect(result).toEqual(['this', 'will', 'wrap']);
277
- });
278
- });
279
- it('should split a line in the middle when unspaced text will not fit on a line', () => {
280
- (0, font_1.getFontKitFont)(getTextSchema(), font).then((fontKitFont) => {
281
- const fontWidthCalcs = Object.assign({}, baseCalcValues, { font: fontKitFont });
282
- const result = (0, font_1.getSplittedLines)('thiswillbecut', fontWidthCalcs);
283
- expect(result).toEqual(['thiswi', 'llbecu', 't']);
284
- });
285
- });
286
- it('should not split text when it is impossible due to size constraints', () => {
287
- (0, font_1.getFontKitFont)(getTextSchema(), font).then((fontKitFont) => {
288
- const fontWidthCalcs = Object.assign({}, baseCalcValues, { font: fontKitFont });
289
- fontWidthCalcs.boxWidthInPt = 2;
290
- const result = (0, font_1.getSplittedLines)('thiswillnotbecut', fontWidthCalcs);
291
- expect(result).toEqual(['thiswillnotbecut']);
292
- });
293
- });
294
- });
295
- describe('calculateDynamicFontSize with Default font', () => {
296
- const font = (0, font_1.getDefaultFont)();
297
- it('should return default font size when dynamicFontSizeSetting is not provided', () => __awaiter(void 0, void 0, void 0, function* () {
298
- const textSchema = getTextSchema();
299
- const result = yield (0, font_1.calculateDynamicFontSize)({ textSchema, font, input: 'test' });
300
- expect(result).toBe(14);
301
- }));
302
- it('should return default font size when dynamicFontSizeSetting max is less than min', () => __awaiter(void 0, void 0, void 0, function* () {
303
- const textSchema = getTextSchema();
304
- textSchema.dynamicFontSize = { min: 11, max: 10 };
305
- const result = yield (0, font_1.calculateDynamicFontSize)({ textSchema, font, input: 'test' });
306
- expect(result).toBe(14);
307
- }));
308
- it('should calculate a dynamic font size of vertical fit between min and max', () => __awaiter(void 0, void 0, void 0, function* () {
309
- const textSchema = getTextSchema();
310
- textSchema.dynamicFontSize = { min: 10, max: 30, fit: 'vertical' };
311
- const input = 'test with a length string\n and a new line';
312
- const result = yield (0, font_1.calculateDynamicFontSize)({ textSchema, font, input });
313
- expect(result).toBe(19.25);
314
- }));
315
- it('should calculate a dynamic font size of horizontal fit between min and max', () => __awaiter(void 0, void 0, void 0, function* () {
316
- const textSchema = getTextSchema();
317
- textSchema.dynamicFontSize = { min: 10, max: 30, fit: 'horizontal' };
318
- const input = 'test with a length string\n and a new line';
319
- const result = yield (0, font_1.calculateDynamicFontSize)({ textSchema, font, input });
320
- expect(result).toBe(11.25);
321
- }));
322
- it('should calculate a dynamic font size between min and max regardless of current font size', () => __awaiter(void 0, void 0, void 0, function* () {
323
- const textSchema = getTextSchema();
324
- textSchema.fontSize = 2;
325
- textSchema.dynamicFontSize = { min: 10, max: 30, fit: 'vertical' };
326
- const input = 'test with a length string\n and a new line';
327
- let result = yield (0, font_1.calculateDynamicFontSize)({ textSchema, font, input });
328
- expect(result).toBe(19.25);
329
- textSchema.fontSize = 40;
330
- result = yield (0, font_1.calculateDynamicFontSize)({ textSchema, font, input });
331
- expect(result).toBe(19.25);
332
- }));
333
- it('should return min font size when content is too big to fit given constraints', () => __awaiter(void 0, void 0, void 0, function* () {
334
- const textSchema = getTextSchema();
335
- textSchema.width = 10;
336
- textSchema.dynamicFontSize = { min: 10, max: 30, fit: 'vertical' };
337
- const input = 'test with a length string\n and a new line';
338
- const result = yield (0, font_1.calculateDynamicFontSize)({ textSchema, font, input });
339
- expect(result).toBe(10);
340
- }));
341
- it('should return max font size when content is too small to fit given constraints', () => __awaiter(void 0, void 0, void 0, function* () {
342
- const textSchema = getTextSchema();
343
- textSchema.width = 1000;
344
- textSchema.dynamicFontSize = { min: 10, max: 30 };
345
- const input = 'test with a length string\n and a new line';
346
- const result = yield (0, font_1.calculateDynamicFontSize)({ textSchema, font, input });
347
- expect(result).toBe(30);
348
- }));
349
- it('should not reduce font size below 0', () => __awaiter(void 0, void 0, void 0, function* () {
350
- const textSchema = getTextSchema();
351
- textSchema.dynamicFontSize = { min: -5, max: 10 };
352
- textSchema.width = 4;
353
- textSchema.height = 1;
354
- const input = 'a very \nlong \nmulti-line \nstring\nto';
355
- const result = yield (0, font_1.calculateDynamicFontSize)({ textSchema, font, input });
356
- expect(result).toBeGreaterThan(0);
357
- }));
358
- it('should calculate a dynamic font size when a starting font size is passed that is lower than the eventual', () => __awaiter(void 0, void 0, void 0, function* () {
359
- const textSchema = getTextSchema();
360
- textSchema.dynamicFontSize = { min: 10, max: 30, fit: 'vertical' };
361
- const input = 'test with a length string\n and a new line';
362
- const startingFontSize = 18;
363
- const result = yield (0, font_1.calculateDynamicFontSize)({ textSchema, font, input, startingFontSize });
364
- expect(result).toBe(19.25);
365
- }));
366
- it('should calculate a dynamic font size when a starting font size is passed that is higher than the eventual', () => __awaiter(void 0, void 0, void 0, function* () {
367
- const textSchema = getTextSchema();
368
- textSchema.dynamicFontSize = { min: 10, max: 30, fit: 'horizontal' };
369
- const input = 'test with a length string\n and a new line';
370
- const startingFontSize = 36;
371
- const result = yield (0, font_1.calculateDynamicFontSize)({ textSchema, font, input, startingFontSize });
372
- expect(result).toBe(11.25);
373
- }));
374
- it('should calculate a dynamic font size using vertical fit as a default if no fit provided', () => __awaiter(void 0, void 0, void 0, function* () {
375
- const textSchema = getTextSchema();
376
- textSchema.dynamicFontSize = { min: 10, max: 30 };
377
- const input = 'test with a length string\n and a new line';
378
- const result = yield (0, font_1.calculateDynamicFontSize)({ textSchema, font, input });
379
- expect(result).toBe(19.25);
380
- }));
381
- });
382
- describe('calculateDynamicFontSize with Custom font', () => {
383
- const font = getSampleFont();
384
- it('should return smaller font size when dynamicFontSizeSetting is provided with horizontal fit', () => __awaiter(void 0, void 0, void 0, function* () {
385
- const textSchema = getTextSchema();
386
- textSchema.dynamicFontSize = { min: 10, max: 30, fit: 'horizontal' };
387
- const input = 'あいうあいうあい';
388
- const result = yield (0, font_1.calculateDynamicFontSize)({ textSchema, font, input });
389
- expect(result).toBe(16.75);
390
- }));
391
- it('should return smaller font size when dynamicFontSizeSetting is provided with vertical fit', () => __awaiter(void 0, void 0, void 0, function* () {
392
- const textSchema = getTextSchema();
393
- textSchema.dynamicFontSize = { min: 10, max: 30, fit: 'vertical' };
394
- const input = 'あいうあいうあい';
395
- const result = yield (0, font_1.calculateDynamicFontSize)({ textSchema, font, input });
396
- expect(result).toBe(24.25);
397
- }));
398
- it('should return min font size when content is too big to fit given constraints', () => __awaiter(void 0, void 0, void 0, function* () {
399
- const textSchema = getTextSchema();
400
- textSchema.dynamicFontSize = { min: 20, max: 30 };
401
- const input = 'あいうあいうあいうあいうあいうあいうあいうあいうあいう';
402
- const result = yield (0, font_1.calculateDynamicFontSize)({ textSchema, font, input });
403
- expect(result).toBe(20);
404
- }));
405
- it('should return max font size when content is too small to fit given constraints', () => __awaiter(void 0, void 0, void 0, function* () {
406
- const textSchema = getTextSchema();
407
- textSchema.dynamicFontSize = { min: 10, max: 30 };
408
- const input = 'あ';
409
- const result = yield (0, font_1.calculateDynamicFontSize)({ textSchema, font, input });
410
- expect(result).toBe(30);
411
- }));
412
- it('should return min font size when content is multi-line with too many lines for the container', () => __awaiter(void 0, void 0, void 0, function* () {
413
- const textSchema = getTextSchema();
414
- textSchema.dynamicFontSize = { min: 5, max: 20 };
415
- const input = 'あ\nいう\nあ\nいう\nあ\nいう\nあ\nいう\nあ\nいう\nあ\nいう';
416
- const result = yield (0, font_1.calculateDynamicFontSize)({ textSchema, font, input });
417
- expect(result).toBe(5);
418
- }));
419
- });
420
- describe('getFontDescentInPt test', () => {
421
- test('it gets a descent size relative to the font size', () => {
422
- expect((0, font_1.getFontDescentInPt)({ descent: -400, unitsPerEm: 1000 }, 12)).toBe(-4.800000000000001);
423
- expect((0, font_1.getFontDescentInPt)({ descent: 54, unitsPerEm: 1000 }, 20)).toBe(1.08);
424
- expect((0, font_1.getFontDescentInPt)({ descent: -512, unitsPerEm: 2048 }, 54)).toBe(-13.5);
425
- });
426
- });
427
- describe('getBrowserVerticalFontAdjustments test', () => {
428
- // Font with a base line-height of 1.349
429
- const font = { ascent: 1037, descent: -312, unitsPerEm: 1000 };
430
- test('it gets a top adjustment when vertically aligning top', () => {
431
- expect((0, font_1.getBrowserVerticalFontAdjustments)(font, 12, 1.0, 'top')).toEqual({
432
- topAdj: 2.791301999999999,
433
- bottomAdj: 0,
434
- });
435
- expect((0, font_1.getBrowserVerticalFontAdjustments)(font, 36, 2.0, 'top')).toEqual({
436
- topAdj: 8.373906,
437
- bottomAdj: 0,
438
- });
439
- });
440
- test('it gets a bottom adjustment when vertically aligning middle or bottom', () => {
441
- expect((0, font_1.getBrowserVerticalFontAdjustments)(font, 12, 1.0, 'bottom')).toEqual({
442
- topAdj: 0,
443
- bottomAdj: 2.791302,
444
- });
445
- expect((0, font_1.getBrowserVerticalFontAdjustments)(font, 12, 1.15, 'middle')).toEqual({
446
- topAdj: 0,
447
- bottomAdj: 1.5916020000000004,
448
- });
449
- });
450
- test('it does not get a bottom adjustment if the line height exceeds that of the font', () => {
451
- expect((0, font_1.getBrowserVerticalFontAdjustments)(font, 12, 1.35, 'bottom')).toEqual({
452
- topAdj: 0,
453
- bottomAdj: 0,
454
- });
455
- });
456
- test('it does not get a bottom adjustment if the font base line-height is 1.0 or less', () => {
457
- const thisFont = { ascent: 900, descent: -50, unitsPerEm: 1000 };
458
- expect((0, font_1.getBrowserVerticalFontAdjustments)(thisFont, 20, 1.0, 'bottom')).toEqual({
459
- topAdj: 0,
460
- bottomAdj: 0,
461
- });
462
- });
463
- });
464
- //# sourceMappingURL=font.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"font.test.js","sourceRoot":"","sources":["../../../__tests__/font.test.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2BAAkC;AAClC,2CAA6B;AAE7B,sCAQoB;AAEpB,gCAAmC;AAEnC,MAAM,QAAQ,GAAG,IAAA,iBAAY,EAAC,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,kCAAkC,CAAC,CAAC,CAAC;AACxF,MAAM,SAAS,GAAG,IA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