@pdfme/schemas 3.1.5-dev.11 → 3.1.5-dev.13

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 (128) hide show
  1. package/dist/cjs/__tests__/renderUtils.test.js +8 -8
  2. package/dist/cjs/__tests__/renderUtils.test.js.map +1 -1
  3. package/dist/cjs/src/barcodes/pdfRender.js +2 -2
  4. package/dist/cjs/src/barcodes/pdfRender.js.map +1 -1
  5. package/dist/cjs/src/barcodes/uiRender.js +3 -3
  6. package/dist/cjs/src/barcodes/uiRender.js.map +1 -1
  7. package/dist/cjs/src/graphics/image.js +122 -0
  8. package/dist/cjs/src/graphics/image.js.map +1 -0
  9. package/dist/cjs/src/index.js +13 -10
  10. package/dist/cjs/src/index.js.map +1 -1
  11. package/dist/cjs/src/{renderUtils.js → pdfRenderUtils.js} +2 -5
  12. package/dist/cjs/src/pdfRenderUtils.js.map +1 -0
  13. package/dist/cjs/src/shapes/line.js +57 -0
  14. package/dist/cjs/src/shapes/line.js.map +1 -0
  15. package/dist/cjs/src/shapes/rectAndEllipse.js +100 -0
  16. package/dist/cjs/src/shapes/rectAndEllipse.js.map +1 -0
  17. package/dist/cjs/src/text/pdfRender.js +5 -5
  18. package/dist/cjs/src/text/pdfRender.js.map +1 -1
  19. package/dist/cjs/src/text/uiRender.js +3 -3
  20. package/dist/cjs/src/text/uiRender.js.map +1 -1
  21. package/dist/cjs/src/uiRenderUtils.js +29 -0
  22. package/dist/cjs/src/uiRenderUtils.js.map +1 -0
  23. package/dist/esm/__tests__/renderUtils.test.js +1 -1
  24. package/dist/esm/__tests__/renderUtils.test.js.map +1 -1
  25. package/dist/esm/src/barcodes/pdfRender.js +1 -1
  26. package/dist/esm/src/barcodes/pdfRender.js.map +1 -1
  27. package/dist/esm/src/barcodes/uiRender.js +1 -1
  28. package/dist/esm/src/barcodes/uiRender.js.map +1 -1
  29. package/dist/esm/src/graphics/image.js +120 -0
  30. package/dist/esm/src/graphics/image.js.map +1 -0
  31. package/dist/esm/src/index.js +5 -4
  32. package/dist/esm/src/index.js.map +1 -1
  33. package/dist/esm/src/{renderUtils.js → pdfRenderUtils.js} +2 -5
  34. package/dist/esm/src/pdfRenderUtils.js.map +1 -0
  35. package/dist/esm/src/shapes/line.js +55 -0
  36. package/dist/esm/src/shapes/line.js.map +1 -0
  37. package/dist/esm/src/shapes/rectAndEllipse.js +97 -0
  38. package/dist/esm/src/shapes/rectAndEllipse.js.map +1 -0
  39. package/dist/esm/src/text/pdfRender.js +1 -1
  40. package/dist/esm/src/text/pdfRender.js.map +1 -1
  41. package/dist/esm/src/text/uiRender.js +1 -1
  42. package/dist/esm/src/text/uiRender.js.map +1 -1
  43. package/dist/esm/src/uiRenderUtils.js +25 -0
  44. package/dist/esm/src/uiRenderUtils.js.map +1 -0
  45. package/dist/types/src/{image/index.d.ts → graphics/image.d.ts} +3 -1
  46. package/dist/types/src/index.d.ts +5 -4
  47. package/dist/types/src/shapes/line.d.ts +6 -0
  48. package/dist/types/src/shapes/rectAndEllipse.d.ts +138 -0
  49. package/dist/types/src/uiRenderUtils.d.ts +1 -0
  50. package/package.json +1 -1
  51. package/src/barcodes/pdfRender.ts +1 -1
  52. package/src/barcodes/uiRender.ts +1 -1
  53. package/src/graphics/image.ts +151 -0
  54. package/src/index.ts +15 -4
  55. package/src/{renderUtils.ts → pdfRenderUtils.ts} +1 -4
  56. package/src/shapes/line.ts +67 -0
  57. package/src/shapes/rectAndEllipse.ts +110 -0
  58. package/src/text/pdfRender.ts +1 -1
  59. package/src/text/uiRender.ts +1 -1
  60. package/src/uiRenderUtils.ts +27 -0
  61. package/dist/cjs/src/image/index.js +0 -8
  62. package/dist/cjs/src/image/index.js.map +0 -1
  63. package/dist/cjs/src/image/pdfRender.js +0 -22
  64. package/dist/cjs/src/image/pdfRender.js.map +0 -1
  65. package/dist/cjs/src/image/propPanel.js +0 -19
  66. package/dist/cjs/src/image/propPanel.js.map +0 -1
  67. package/dist/cjs/src/image/types.js +0 -3
  68. package/dist/cjs/src/image/types.js.map +0 -1
  69. package/dist/cjs/src/image/uiRender.js +0 -113
  70. package/dist/cjs/src/image/uiRender.js.map +0 -1
  71. package/dist/cjs/src/line/constants.js +0 -5
  72. package/dist/cjs/src/line/constants.js.map +0 -1
  73. package/dist/cjs/src/line/index.js +0 -8
  74. package/dist/cjs/src/line/index.js.map +0 -1
  75. package/dist/cjs/src/line/pdfRender.js +0 -20
  76. package/dist/cjs/src/line/pdfRender.js.map +0 -1
  77. package/dist/cjs/src/line/propPanel.js +0 -35
  78. package/dist/cjs/src/line/propPanel.js.map +0 -1
  79. package/dist/cjs/src/line/types.js +0 -3
  80. package/dist/cjs/src/line/types.js.map +0 -1
  81. package/dist/cjs/src/line/uiRender.js +0 -14
  82. package/dist/cjs/src/line/uiRender.js.map +0 -1
  83. package/dist/cjs/src/renderUtils.js.map +0 -1
  84. package/dist/esm/src/image/index.js +0 -6
  85. package/dist/esm/src/image/index.js.map +0 -1
  86. package/dist/esm/src/image/pdfRender.js +0 -18
  87. package/dist/esm/src/image/pdfRender.js.map +0 -1
  88. package/dist/esm/src/image/propPanel.js +0 -16
  89. package/dist/esm/src/image/propPanel.js.map +0 -1
  90. package/dist/esm/src/image/types.js +0 -2
  91. package/dist/esm/src/image/types.js.map +0 -1
  92. package/dist/esm/src/image/uiRender.js +0 -109
  93. package/dist/esm/src/image/uiRender.js.map +0 -1
  94. package/dist/esm/src/line/constants.js +0 -2
  95. package/dist/esm/src/line/constants.js.map +0 -1
  96. package/dist/esm/src/line/index.js +0 -6
  97. package/dist/esm/src/line/index.js.map +0 -1
  98. package/dist/esm/src/line/pdfRender.js +0 -16
  99. package/dist/esm/src/line/pdfRender.js.map +0 -1
  100. package/dist/esm/src/line/propPanel.js +0 -32
  101. package/dist/esm/src/line/propPanel.js.map +0 -1
  102. package/dist/esm/src/line/types.js +0 -2
  103. package/dist/esm/src/line/types.js.map +0 -1
  104. package/dist/esm/src/line/uiRender.js +0 -10
  105. package/dist/esm/src/line/uiRender.js.map +0 -1
  106. package/dist/esm/src/renderUtils.js.map +0 -1
  107. package/dist/types/src/image/pdfRender.d.ts +0 -3
  108. package/dist/types/src/image/propPanel.d.ts +0 -3
  109. package/dist/types/src/image/types.d.ts +0 -3
  110. package/dist/types/src/image/uiRender.d.ts +0 -3
  111. package/dist/types/src/line/constants.d.ts +0 -1
  112. package/dist/types/src/line/index.d.ts +0 -4
  113. package/dist/types/src/line/pdfRender.d.ts +0 -3
  114. package/dist/types/src/line/propPanel.d.ts +0 -3
  115. package/dist/types/src/line/types.d.ts +0 -4
  116. package/dist/types/src/line/uiRender.d.ts +0 -3
  117. package/src/image/index.ts +0 -8
  118. package/src/image/pdfRender.ts +0 -29
  119. package/src/image/propPanel.ts +0 -19
  120. package/src/image/types.ts +0 -3
  121. package/src/image/uiRender.ts +0 -123
  122. package/src/line/constants.ts +0 -1
  123. package/src/line/index.ts +0 -8
  124. package/src/line/pdfRender.ts +0 -24
  125. package/src/line/propPanel.ts +0 -34
  126. package/src/line/types.ts +0 -5
  127. package/src/line/uiRender.ts +0 -12
  128. /package/dist/types/src/{renderUtils.d.ts → pdfRenderUtils.d.ts} +0 -0
@@ -1,22 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.pdfRender = void 0;
4
- const renderUtils_js_1 = require("../renderUtils.js");
5
- const getCacheKey = (schema, input) => `${schema.type}${input}`;
6
- const pdfRender = async (arg) => {
7
- const { value, schema, pdfDoc, page, _cache } = arg;
8
- if (!value || !value.startsWith('data:image/'))
9
- return;
10
- const inputImageCacheKey = getCacheKey(schema, value);
11
- let image = _cache.get(inputImageCacheKey);
12
- if (!image) {
13
- const isPng = value.startsWith('data:image/png;');
14
- image = await (isPng ? pdfDoc.embedPng(value) : pdfDoc.embedJpg(value));
15
- _cache.set(inputImageCacheKey, image);
16
- }
17
- const pageHeight = page.getHeight();
18
- const { width, height, rotate, position: { x, y }, opacity, } = (0, renderUtils_js_1.convertForPdfLayoutProps)({ schema, pageHeight });
19
- page.drawImage(image, { x, y, rotate, width, height, opacity });
20
- };
21
- exports.pdfRender = pdfRender;
22
- //# sourceMappingURL=pdfRender.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"pdfRender.js","sourceRoot":"","sources":["../../../../src/image/pdfRender.ts"],"names":[],"mappings":";;;AAEA,sDAA6D;AAE7D,MAAM,WAAW,GAAG,CAAC,MAAc,EAAE,KAAa,EAAE,EAAE,CAAC,GAAG,MAAM,CAAC,IAAI,GAAG,KAAK,EAAE,CAAC;AAEzE,MAAM,SAAS,GAAG,KAAK,EAAE,GAAgC,EAAE,EAAE;IAClE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,GAAG,CAAC;IACpD,IAAI,CAAC,KAAK,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,aAAa,CAAC;QAAE,OAAO;IAEvD,MAAM,kBAAkB,GAAG,WAAW,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IACtD,IAAI,KAAK,GAAG,MAAM,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAC;IAC3C,IAAI,CAAC,KAAK,EAAE;QACV,MAAM,KAAK,GAAG,KAAK,CAAC,UAAU,CAAC,iBAAiB,CAAC,CAAC;QAClD,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC;QACxE,MAAM,CAAC,GAAG,CAAC,kBAAkB,EAAE,KAAK,CAAC,CAAC;KACvC;IAED,MAAM,UAAU,GAAG,IAAI,CAAC,SAAS,EAAE,CAAC;IACpC,MAAM,EACJ,KAAK,EACL,MAAM,EACN,MAAM,EACN,QAAQ,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,EAClB,OAAO,GACR,GAAG,IAAA,yCAAwB,EAAC,EAAE,MAAM,EAAE,UAAU,EAAE,CAAC,CAAC;IAErD,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,CAAC;AAClE,CAAC,CAAC;AAtBW,QAAA,SAAS,aAsBpB"}
@@ -1,19 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.propPanel = void 0;
4
- const constants_js_1 = require("../constants.js");
5
- exports.propPanel = {
6
- schema: {},
7
- defaultValue: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAu4AAALuAQMAAADL0wGJAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAGUExURbzAw+rv8fKruy0AAAPoSURBVHja7dwxbtwwEEBRCkKwRQodYftcYk+ROkcJz5NTsEuZK/AIKlIQAUEnke0VqQ0pA5zxWvFnZcD2s0CNuENxPOZBc0QDDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PD/+P8bkxvnTzzjTG0M2b5rh08rHNT518aPOnTt63+aGTd23edPJ2h//ax+/oO6Gzx6c78+cuPu7x01vmwx5/6uLnO/PjO+b/rGifvtWH3VnT9vmh/e3eqx/bc9d79af2YwEPDw8P/6r8r1GVt5VcUoZPtXxGhp9rGYEM72vbEBne1hJ5Gb6ayIvwqZppi/CxmgqL8KGaTIrwc3WDfATeV/ffIryr7r+PwNvq/vsIfH17D5/qbw/gb/mLKp/OqnycFPj14yqcJPm4vfp5VJ0cP6jyzqjy9rr2q/Dr4qzBp3V5E1wxp/V3rl8LXn32qF6fAY31Psv2NXi/5lQaH+Vuzak0eLsmPRppVPa3FPiU3QiFFDZmD4FCAh6yxV+Bn7O9isLmx2d/TGHr5rI7obDxtFkcKWyb89M2+U1/sX7Kv7Io8gaxFy5l2D/faRk++3x6PgsalV52+fwUW4j/+eGhDPuneyH/otHmp9jyfHHMLM6n4phZnI/FObA4H4qDWnF+Lo46xXlflG+I864o3xDnbVG+Ic6X9RXSfCrrK6T5WBZASPOhrFCQ5ufyjF+a92XdkjTvyrolad6WdUvS/KawSI7/sQn7JfDl+O+bsF8CX44fN2FvHnNnIT4Nm7BfAl+ON5uwXwJfjA/LCuk2BXvCvN0U7InxflmAtxV1gvx0U2N3luPtdZOlwj/FoR5vbuq85Pi48F6LD0scOk3+sq1cleP9ohlNfkpq/N9pGaMuH7T4ZVqGWYt/nBavyxstftblfaVIWJU/y72yODCfzJH5oMvPh+adLm+PzCdzZD5U/61ClT9Lnvyo8e7QvFHlE3ydj0zOu5ucickhcpgcJofJedUVk8j5b/nGgIeHh4d/I3x/RwLlhgfNH3DavSwGXf7YjT76uqCEQ/P37p9z7uKVmwspd17S7hul3PXK6fbsmnvWhO6GZlMnn3ri8gXN5GzHnX0B35ydj91814CHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHl+d/A9cKjmiL040TAAAAAElFTkSuQmCC',
8
- defaultSchema: {
9
- type: 'image',
10
- position: { x: 0, y: 0 },
11
- width: 40,
12
- height: 40,
13
- // If the value of "rotate" is set to undefined or not set at all, rotation will be disabled in the UI.
14
- // Check this document: https://pdfme.com//docs/custom-schemas#learning-how-to-create-from-pdfmeschemas-code
15
- rotate: 0,
16
- opacity: constants_js_1.DEFAULT_OPACITY,
17
- },
18
- };
19
- //# sourceMappingURL=propPanel.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"propPanel.js","sourceRoot":"","sources":["../../../../src/image/propPanel.ts"],"names":[],"mappings":";;;AAEA,kDAAkD;AAErC,QAAA,SAAS,GAA2B;IAC/C,MAAM,EAAE,EAAE;IACV,YAAY,EACV,w9CAAw9C;IAC19C,aAAa,EAAE;QACb,IAAI,EAAE,OAAO;QACb,QAAQ,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE;QACxB,KAAK,EAAE,EAAE;QACT,MAAM,EAAE,EAAE;QACV,uGAAuG;QACvG,4GAA4G;QAC5G,MAAM,EAAE,CAAC;QACT,OAAO,EAAE,8BAAe;KACzB;CACF,CAAC"}
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/image/types.ts"],"names":[],"mappings":""}
@@ -1,113 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.uiRender = void 0;
4
- const common_1 = require("@pdfme/common");
5
- const renderUtils_js_1 = require("../renderUtils.js");
6
- const propPanel_1 = require("./propPanel");
7
- const fullSize = { width: '100%', height: '100%' };
8
- const readFile = (input) => new Promise((resolve, reject) => {
9
- const fileReader = new FileReader();
10
- fileReader.onload = (e) => {
11
- if (e.target?.result) {
12
- resolve(e.target.result);
13
- }
14
- };
15
- fileReader.onerror = (e) => {
16
- reject(new Error('[@pdfme/schemas] File reading failed'));
17
- };
18
- let file = null;
19
- if (input instanceof FileList && input.length > 0) {
20
- file = input[0];
21
- }
22
- else if (input instanceof File) {
23
- file = input;
24
- }
25
- if (file) {
26
- fileReader.readAsDataURL(file);
27
- }
28
- else {
29
- reject(new Error('[@pdfme/schemas] No files provided'));
30
- }
31
- });
32
- const uiRender = async (arg) => {
33
- const { value, rootElement, mode, onChange, stopEditing, tabIndex, placeholder, schema, theme } = arg;
34
- const editable = (0, renderUtils_js_1.isEditable)(mode);
35
- const isDefault = value === propPanel_1.propPanel.defaultValue;
36
- const size = { width: schema.width * common_1.ZOOM, height: schema.height * common_1.ZOOM };
37
- const container = document.createElement('div');
38
- const backgroundStyle = placeholder ? `url(${placeholder})` : 'none';
39
- const containerStyle = {
40
- ...fullSize,
41
- backgroundImage: value ? 'none' : backgroundStyle,
42
- backgroundSize: `${size.width}px ${size.height}px`,
43
- };
44
- Object.assign(container.style, containerStyle);
45
- container.addEventListener('click', (e) => {
46
- if (editable) {
47
- e.stopPropagation();
48
- }
49
- });
50
- rootElement.appendChild(container);
51
- // image tag
52
- if (value) {
53
- const img = document.createElement('img');
54
- const imgStyle = { height: '100%', width: '100%', borderRadius: 0 };
55
- Object.assign(img.style, imgStyle);
56
- img.src = value;
57
- container.appendChild(img);
58
- }
59
- // remove button
60
- if (value && !isDefault && editable) {
61
- const button = document.createElement('button');
62
- button.textContent = 'x';
63
- const buttonStyle = {
64
- position: 'absolute',
65
- top: 0,
66
- left: 0,
67
- zIndex: 1,
68
- display: 'flex',
69
- justifyContent: 'center',
70
- alignItems: 'center',
71
- color: '#333',
72
- background: '#f2f2f2',
73
- borderRadius: '2px',
74
- border: '1px solid #767676',
75
- cursor: 'pointer',
76
- height: '24px',
77
- width: '24px',
78
- };
79
- Object.assign(button.style, buttonStyle);
80
- button.addEventListener('click', () => {
81
- onChange && onChange('');
82
- });
83
- container.appendChild(button);
84
- }
85
- // file input
86
- if ((!value || isDefault) && editable) {
87
- const label = document.createElement('label');
88
- const labelStyle = {
89
- ...fullSize,
90
- display: editable ? 'flex' : 'none',
91
- position: 'absolute',
92
- top: 0,
93
- backgroundColor: editable || value ? (0, renderUtils_js_1.addAlphaToHex)(theme.colorPrimaryBg, 30) : 'none',
94
- cursor: 'pointer',
95
- };
96
- Object.assign(label.style, labelStyle);
97
- container.appendChild(label);
98
- const input = document.createElement('input');
99
- const inputStyle = { ...fullSize, position: 'absolute', top: '50%' };
100
- Object.assign(input.style, inputStyle);
101
- input.tabIndex = tabIndex || 0;
102
- input.type = 'file';
103
- input.accept = 'image/jpeg, image/png';
104
- input.addEventListener('change', (event) => {
105
- const changeEvent = event;
106
- readFile(changeEvent.target.files).then((result) => onChange && onChange(result));
107
- });
108
- input.addEventListener('blur', () => stopEditing && stopEditing());
109
- label.appendChild(input);
110
- }
111
- };
112
- exports.uiRender = uiRender;
113
- //# sourceMappingURL=uiRender.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"uiRender.js","sourceRoot":"","sources":["../../../../src/image/uiRender.ts"],"names":[],"mappings":";;;AAGA,0CAAoD;AACpD,sDAA8D;AAC9D,2CAAwC;AAExC,MAAM,QAAQ,GAAG,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC;AAEnD,MAAM,QAAQ,GAAG,CAAC,KAA6B,EAAiC,EAAE,CAChF,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;IAC9B,MAAM,UAAU,GAAG,IAAI,UAAU,EAAE,CAAC;IAEpC,UAAU,CAAC,MAAM,GAAG,CAAC,CAAC,EAAE,EAAE;QACxB,IAAI,CAAC,CAAC,MAAM,EAAE,MAAM,EAAE;YACpB,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;SAC1B;IACH,CAAC,CAAC;IAEF,UAAU,CAAC,OAAO,GAAG,CAAC,CAAC,EAAE,EAAE;QACzB,MAAM,CAAC,IAAI,KAAK,CAAC,sCAAsC,CAAC,CAAC,CAAC;IAC5D,CAAC,CAAC;IAEF,IAAI,IAAI,GAAgB,IAAI,CAAC;IAC7B,IAAI,KAAK,YAAY,QAAQ,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE;QACjD,IAAI,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;KACjB;SAAM,IAAI,KAAK,YAAY,IAAI,EAAE;QAChC,IAAI,GAAG,KAAK,CAAC;KACd;IAED,IAAI,IAAI,EAAE;QACR,UAAU,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;KAChC;SAAM;QACL,MAAM,CAAC,IAAI,KAAK,CAAC,o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AAW,IAAI,WAAW,EAAE,CAAC,CAAC;QACnE,KAAK,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;KAC1B;AACH,CAAC,CAAC;AArFW,QAAA,QAAQ,YAqFnB"}
@@ -1,5 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DEFAULT_LINE_COLOR = void 0;
4
- exports.DEFAULT_LINE_COLOR = '#000000';
5
- //# sourceMappingURL=constants.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../src/line/constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,kBAAkB,GAAG,SAAS,CAAC"}
@@ -1,8 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const pdfRender_js_1 = require("./pdfRender.js");
4
- const propPanel_js_1 = require("./propPanel.js");
5
- const uiRender_js_1 = require("./uiRender.js");
6
- const schema = { pdf: pdfRender_js_1.pdfRender, ui: uiRender_js_1.uiRender, propPanel: propPanel_js_1.propPanel };
7
- exports.default = schema;
8
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/line/index.ts"],"names":[],"mappings":";;AACA,iDAA2C;AAC3C,iDAA2C;AAC3C,+CAAyC;AAGzC,MAAM,MAAM,GAAuB,EAAE,GAAG,EAAE,wBAAS,EAAE,EAAE,EAAE,sBAAQ,EAAE,SAAS,EAAT,wBAAS,EAAE,CAAC;AAC/E,kBAAe,MAAM,CAAC"}
@@ -1,20 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.pdfRender = void 0;
4
- const renderUtils_js_1 = require("../renderUtils.js");
5
- const constants_js_1 = require("./constants.js");
6
- const pdfRender = (arg) => {
7
- const { page, schema } = arg;
8
- const pageHeight = page.getHeight();
9
- const { width, height, rotate, position: { x, y }, opacity, } = (0, renderUtils_js_1.convertForPdfLayoutProps)({ schema, pageHeight, applyRotateTranslate: false });
10
- const pivot = { x: x + width / 2, y: y + height / 2 };
11
- page.drawLine({
12
- start: (0, renderUtils_js_1.rotatePoint)({ x, y: y + height / 2 }, pivot, rotate.angle),
13
- end: (0, renderUtils_js_1.rotatePoint)({ x: x + width, y: y + height / 2 }, pivot, rotate.angle),
14
- thickness: height,
15
- color: (0, renderUtils_js_1.hex2RgbColor)(schema.color ?? constants_js_1.DEFAULT_LINE_COLOR),
16
- opacity: opacity,
17
- });
18
- };
19
- exports.pdfRender = pdfRender;
20
- //# sourceMappingURL=pdfRender.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"pdfRender.js","sourceRoot":"","sources":["../../../../src/line/pdfRender.ts"],"names":[],"mappings":";;;AAEA,sDAAwF;AACxF,iDAAoD;AAE7C,MAAM,SAAS,GAAG,CAAC,GAA+B,EAAE,EAAE;IAC3D,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,GAAG,CAAC;IAC7B,MAAM,UAAU,GAAG,IAAI,CAAC,SAAS,EAAE,CAAC;IACpC,MAAM,EACJ,KAAK,EACL,MAAM,EACN,MAAM,EACN,QAAQ,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,EAClB,OAAO,GACR,GAAG,IAAA,yCAAwB,EAAC,EAAE,MAAM,EAAE,UAAU,EAAE,oBAAoB,EAAE,KAAK,EAAE,CAAC,CAAC;IAClF,MAAM,KAAK,GAAG,EAAE,CAAC,EAAE,CAAC,GAAG,KAAK,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC,GAAG,MAAM,GAAG,CAAC,EAAE,CAAC;IACtD,IAAI,CAAC,QAAQ,CAAC;QACZ,KAAK,EAAE,IAAA,4BAAW,EAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,GAAG,MAAM,GAAG,CAAC,EAAE,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC;QACjE,GAAG,EAAE,IAAA,4BAAW,EAAC,EAAE,CAAC,EAAE,CAAC,GAAG,KAAK,EAAE,CAAC,EAAE,CAAC,GAAG,MAAM,GAAG,CAAC,EAAE,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC;QAC1E,SAAS,EAAE,MAAM;QACjB,KAAK,EAAE,IAAA,6BAAY,EAAC,MAAM,CAAC,KAAK,IAAI,iCAAkB,CAAC;QACvD,OAAO,EAAE,OAAO;KACjB,CAAC,CAAC;AACL,CAAC,CAAC;AAlBW,QAAA,SAAS,aAkBpB"}
@@ -1,35 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.propPanel = void 0;
4
- const constants_js_1 = require("../constants.js");
5
- const constants_js_2 = require("./constants.js");
6
- exports.propPanel = {
7
- schema: ({ i18n }) => {
8
- return {
9
- color: {
10
- title: i18n('schemas.line.color'),
11
- type: 'string',
12
- widget: 'color',
13
- required: true,
14
- rules: [
15
- {
16
- pattern: constants_js_1.HEX_COLOR_PATTERN,
17
- message: i18n('hexColorPrompt'),
18
- },
19
- ],
20
- },
21
- };
22
- },
23
- defaultValue: '',
24
- defaultSchema: {
25
- type: 'line',
26
- position: { x: 0, y: 0 },
27
- width: 50,
28
- height: 1,
29
- rotate: 0,
30
- opacity: 1,
31
- readOnly: true,
32
- color: constants_js_2.DEFAULT_LINE_COLOR,
33
- },
34
- };
35
- //# sourceMappingURL=propPanel.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"propPanel.js","sourceRoot":"","sources":["../../../../src/line/propPanel.ts"],"names":[],"mappings":";;;AAEA,kDAAoD;AACpD,iDAAoD;AAEvC,QAAA,SAAS,GAA0B;IAC9C,MAAM,EAAE,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE;QACnB,OAAO;YACL,KAAK,EAAE;gBACL,KAAK,EAAE,IAAI,CAAC,oBAAoB,CAAC;gBACjC,IAAI,EAAE,QAAQ;gBACd,MAAM,EAAE,OAAO;gBACf,QAAQ,EAAE,IAAI;gBACd,KAAK,EAAE;oBACL;wBACE,OAAO,EAAE,gCAAiB;wBAC1B,OAAO,EAAE,IAAI,CAAC,gBAAgB,CAAC;qBAChC;iBACF;aACF;SACF,CAAC;IACJ,CAAC;IACD,YAAY,EAAE,EAAE;IAChB,aAAa,EAAE;QACb,IAAI,EAAE,MAAM;QACZ,QAAQ,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE;QACxB,KAAK,EAAE,EAAE;QACT,MAAM,EAAE,CAAC;QACT,MAAM,EAAE,CAAC;QACT,OAAO,EAAE,CAAC;QACV,QAAQ,EAAE,IAAI;QACd,KAAK,EAAE,iCAAkB;KAC1B;CACF,CAAC"}
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/line/types.ts"],"names":[],"mappings":""}
@@ -1,14 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.uiRender = void 0;
4
- const constants_js_1 = require("./constants.js");
5
- const uiRender = (arg) => {
6
- const { schema, rootElement } = arg;
7
- const div = document.createElement('div');
8
- div.style.backgroundColor = schema.color ?? constants_js_1.DEFAULT_LINE_COLOR;
9
- div.style.width = '100%';
10
- div.style.height = '100%';
11
- rootElement.appendChild(div);
12
- };
13
- exports.uiRender = uiRender;
14
- //# sourceMappingURL=uiRender.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"uiRender.js","sourceRoot":"","sources":["../../../../src/line/uiRender.ts"],"names":[],"mappings":";;;AAEA,iDAAoD;AAE7C,MAAM,QAAQ,GAAG,CAAC,GAA8B,EAAE,EAAE;IACzD,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,GAAG,GAAG,CAAC;IACpC,MAAM,GAAG,GAAG,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;IAC1C,GAAG,CAAC,KAAK,CAAC,eAAe,GAA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C,CAAC,EAAE,CAAC,CAAC,CAAC;IAEpB,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,QAAQ,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,CAAC;AAC7F,CAAC,CAAC;AAEK,MAAM,YAAY,GAAG,CAAC,SAA6B,EAAE,EAAE;IAC5D,IAAI,SAAS,EAAE;QACb,MAAM,OAAO,GAAG,IAAA,mBAAU,EAAC,SAAS,CAAC,CAAC;QAEtC,IAAI,CAAC,OAAO,EAAE;YACZ,MAAM,IAAI,KAAK,CAAC,2BAA2B,SAAS,EAAE,CAAC,CAAC;SACzD;QAED,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC;QAErC,OAAO,IAAA,aAAG,EAAC,CAAC,GAAG,GAAG,EAAE,CAAC,GAAG,GAAG,EAAE,CAAC,GAAG,GAAG,CAAC,CAAC;KACvC;IAED,OAAO,SAAS,CAAC;AACnB,CAAC,CAAC;AAdW,QAAA,YAAY,gBAcvB"}
@@ -1,6 +0,0 @@
1
- import { pdfRender } from './pdfRender.js';
2
- import { propPanel } from './propPanel.js';
3
- import { uiRender } from './uiRender.js';
4
- const schema = { pdf: pdfRender, ui: uiRender, propPanel };
5
- export default schema;
6
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/image/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAGzC,MAAM,MAAM,GAAwB,EAAE,GAAG,EAAE,SAAS,EAAE,EAAE,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC;AAChF,eAAe,MAAM,CAAC"}
@@ -1,18 +0,0 @@
1
- import { convertForPdfLayoutProps } from '../renderUtils.js';
2
- const getCacheKey = (schema, input) => `${schema.type}${input}`;
3
- export const pdfRender = async (arg) => {
4
- const { value, schema, pdfDoc, page, _cache } = arg;
5
- if (!value || !value.startsWith('data:image/'))
6
- return;
7
- const inputImageCacheKey = getCacheKey(schema, value);
8
- let image = _cache.get(inputImageCacheKey);
9
- if (!image) {
10
- const isPng = value.startsWith('data:image/png;');
11
- image = await (isPng ? pdfDoc.embedPng(value) : pdfDoc.embedJpg(value));
12
- _cache.set(inputImageCacheKey, image);
13
- }
14
- const pageHeight = page.getHeight();
15
- const { width, height, rotate, position: { x, y }, opacity, } = convertForPdfLayoutProps({ schema, pageHeight });
16
- page.drawImage(image, { x, y, rotate, width, height, opacity });
17
- };
18
- //# sourceMappingURL=pdfRender.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"pdfRender.js","sourceRoot":"","sources":["../../../../src/image/pdfRender.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAC;AAE7D,MAAM,WAAW,GAAG,CAAC,MAAc,EAAE,KAAa,EAAE,EAAE,CAAC,GAAG,MAAM,CAAC,IAAI,GAAG,KAAK,EAAE,CAAC;AAEhF,MAAM,CAAC,MAAM,SAAS,GAAG,KAAK,EAAE,GAAgC,EAAE,EAAE;IAClE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,GAAG,CAAC;IACpD,IAAI,CAAC,KAAK,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,aAAa,CAAC;QAAE,OAAO;IAEvD,MAAM,kBAAkB,GAAG,WAAW,CAAC,MAAM,EAAE,KAAK,CAAC,C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h4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHl+d/A9cKjmiL040TAAAAAElFTkSuQmCC',
5
- defaultSchema: {
6
- type: 'image',
7
- position: { x: 0, y: 0 },
8
- width: 40,
9
- height: 40,
10
- // If the value of "rotate" is set to undefined or not set at all, rotation will be disabled in the UI.
11
- // Check this document: https://pdfme.com//docs/custom-schemas#learning-how-to-create-from-pdfmeschemas-code
12
- rotate: 0,
13
- opacity: DEFAULT_OPACITY,
14
- },
15
- };
16
- //# sourceMappingURL=propPanel.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"propPanel.js","sourceRoot":"","sources":["../../../../src/image/propPanel.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAElD,MAAM,CAAC,MAAM,SAAS,GAA2B;IAC/C,MAAM,EAAE,EAAE;IACV,YAAY,EACV,w9CAAw9C;IAC19C,aAAa,EAAE;QACb,IAAI,EAAE,OAAO;QACb,QAAQ,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE;QACxB,KAAK,EAAE,EAAE;QACT,MAAM,EAAE,EAAE;QACV,uGAAuG;QACvG,4GAA4G;QAC5G,MAAM,EAAE,CAAC;QACT,OAAO,EAAE,eAAe;KACzB;CACF,CAAC"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/image/types.ts"],"names":[],"mappings":""}
@@ -1,109 +0,0 @@
1
- import { ZOOM } from '@pdfme/common';
2
- import { addAlphaToHex, isEditable } from '../renderUtils.js';
3
- import { propPanel } from "./propPanel";
4
- const fullSize = { width: '100%', height: '100%' };
5
- const readFile = (input) => new Promise((resolve, reject) => {
6
- const fileReader = new FileReader();
7
- fileReader.onload = (e) => {
8
- if (e.target?.result) {
9
- resolve(e.target.result);
10
- }
11
- };
12
- fileReader.onerror = (e) => {
13
- reject(new Error('[@pdfme/schemas] File reading failed'));
14
- };
15
- let file = null;
16
- if (input instanceof FileList && input.length > 0) {
17
- file = input[0];
18
- }
19
- else if (input instanceof File) {
20
- file = input;
21
- }
22
- if (file) {
23
- fileReader.readAsDataURL(file);
24
- }
25
- else {
26
- reject(new Error('[@pdfme/schemas] No files provided'));
27
- }
28
- });
29
- export const uiRender = async (arg) => {
30
- const { value, rootElement, mode, onChange, stopEditing, tabIndex, placeholder, schema, theme } = arg;
31
- const editable = isEditable(mode);
32
- const isDefault = value === propPanel.defaultValue;
33
- const size = { width: schema.width * ZOOM, height: schema.height * ZOOM };
34
- const container = document.createElement('div');
35
- const backgroundStyle = placeholder ? `url(${placeholder})` : 'none';
36
- const containerStyle = {
37
- ...fullSize,
38
- backgroundImage: value ? 'none' : backgroundStyle,
39
- backgroundSize: `${size.width}px ${size.height}px`,
40
- };
41
- Object.assign(container.style, containerStyle);
42
- container.addEventListener('click', (e) => {
43
- if (editable) {
44
- e.stopPropagation();
45
- }
46
- });
47
- rootElement.appendChild(container);
48
- // image tag
49
- if (value) {
50
- const img = document.createElement('img');
51
- const imgStyle = { height: '100%', width: '100%', borderRadius: 0 };
52
- Object.assign(img.style, imgStyle);
53
- img.src = value;
54
- container.appendChild(img);
55
- }
56
- // remove button
57
- if (value && !isDefault && editable) {
58
- const button = document.createElement('button');
59
- button.textContent = 'x';
60
- const buttonStyle = {
61
- position: 'absolute',
62
- top: 0,
63
- left: 0,
64
- zIndex: 1,
65
- display: 'flex',
66
- justifyContent: 'center',
67
- alignItems: 'center',
68
- color: '#333',
69
- background: '#f2f2f2',
70
- borderRadius: '2px',
71
- border: '1px solid #767676',
72
- cursor: 'pointer',
73
- height: '24px',
74
- width: '24px',
75
- };
76
- Object.assign(button.style, buttonStyle);
77
- button.addEventListener('click', () => {
78
- onChange && onChange('');
79
- });
80
- container.appendChild(button);
81
- }
82
- // file input
83
- if ((!value || isDefault) && editable) {
84
- const label = document.createElement('label');
85
- const labelStyle = {
86
- ...fullSize,
87
- display: editable ? 'flex' : 'none',
88
- position: 'absolute',
89
- top: 0,
90
- backgroundColor: editable || value ? addAlphaToHex(theme.colorPrimaryBg, 30) : 'none',
91
- cursor: 'pointer',
92
- };
93
- Object.assign(label.style, labelStyle);
94
- container.appendChild(label);
95
- const input = document.createElement('input');
96
- const inputStyle = { ...fullSize, position: 'absolute', top: '50%' };
97
- Object.assign(input.style, inputStyle);
98
- input.tabIndex = tabIndex || 0;
99
- input.type = 'file';
100
- input.accept = 'image/jpeg, image/png';
101
- input.addEventListener('change', (event) => {
102
- const changeEvent = event;
103
- readFile(changeEvent.target.files).then((result) => onChange && onChange(result));
104
- });
105
- input.addEventListener('blur', () => stopEditing && stopEditing());
106
- label.appendChild(input);
107
- }
108
- };
109
- //# sourceMappingURL=uiRender.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"uiRender.js","sourceRoot":"","sources":["../../../../src/image/uiRender.ts"],"names":[],"mappings":"AAGA,OAAO,EAAiB,IAAI,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC9D,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,MAAM,QAAQ,GAAG,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC;AAEnD,MAAM,QAAQ,GAAG,CAAC,KAA6B,EAAiC,EAAE,CAChF,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;IAC9B,MAAM,UAAU,GAAG,IAAI,UAAU,EAAE,CAAC;IAEpC,UAAU,CAAC,MAAM,GAAG,CAAC,CAAC,EAAE,EAAE;QACxB,IAAI,CAAC,CAAC,MAAM,EAAE,MAAM,EAAE;YACpB,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;SAC1B;IACH,CAAC,CAAC;IAEF,UAAU,CAAC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,GAAG,QAAQ,IAAI,CAAC,CAAC;QAC/B,KAAK,CAAC,IAAI,GAAG,MAAM,CAAC;QACpB,KAAK,CAAC,MAAM,GAAG,uBAAuB,CAAC;QACvC,KAAK,CAAC,gBAAgB,CAAC,QAAQ,EAAE,CAAC,KAAY,EAAE,EAAE;YAChD,MAAM,WAAW,GAAG,KAAiD,CAAC;YACtE,QAAQ,CAAC,WAAW,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,QAAQ,IAAI,QAAQ,CAAC,MAAgB,CAAC,CAAC,CAAC;QAC9F,CAAC,CAAC,CAAC;QACH,KAAK,CAAC,gBAAgB,CAAC,MAAM,EAAE,GAAG,EAAE,CAAC,WAAW,IAAI,WAAW,EAAE,CAAC,CAAC;QACnE,KAAK,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;KAC1B;AACH,CAAC,CAAC"}
@@ -1,2 +0,0 @@
1
- export const DEFAULT_LINE_COLOR = '#000000';
2
- //# sourceMappingURL=constants.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../src/line/constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,kBAAkB,GAAG,SAAS,CAAC"}
@@ -1,6 +0,0 @@
1
- import { pdfRender } from './pdfRender.js';
2
- import { propPanel } from './propPanel.js';
3
- import { uiRender } from './uiRender.js';
4
- const schema = { pdf: pdfRender, ui: uiRender, propPanel };
5
- export default schema;
6
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/line/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAGzC,MAAM,MAAM,GAAuB,EAAE,GAAG,EAAE,SAAS,EAAE,EAAE,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC;AAC/E,eAAe,MAAM,CAAC"}
@@ -1,16 +0,0 @@
1
- import { rotatePoint, convertForPdfLayoutProps, hex2RgbColor } from '../renderUtils.js';
2
- import { DEFAULT_LINE_COLOR } from './constants.js';
3
- export const pdfRender = (arg) => {
4
- const { page, schema } = arg;
5
- const pageHeight = page.getHeight();
6
- const { width, height, rotate, position: { x, y }, opacity, } = convertForPdfLayoutProps({ schema, pageHeight, applyRotateTranslate: false });
7
- const pivot = { x: x + width / 2, y: y + height / 2 };
8
- page.drawLine({
9
- start: rotatePoint({ x, y: y + height / 2 }, pivot, rotate.angle),
10
- end: rotatePoint({ x: x + width, y: y + height / 2 }, pivot, rotate.angle),
11
- thickness: height,
12
- color: hex2RgbColor(schema.color ?? DEFAULT_LINE_COLOR),
13
- opacity: opacity,
14
- });
15
- };
16
- //# sourceMappingURL=pdfRender.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"pdfRender.js","sourceRoot":"","sources":["../../../../src/line/pdfRender.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,wBAAwB,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACxF,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAEpD,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,GAA+B,EAAE,EAAE;IAC3D,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,GAAG,CAAC;IAC7B,MAAM,UAAU,GAAG,IAAI,CAAC,SAAS,EAAE,CAAC;IACpC,MAAM,EACJ,KAAK,EACL,MAAM,EACN,MAAM,EACN,QAAQ,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,EAClB,OAAO,GACR,GAAG,wBAAwB,CAAC,EAAE,MAAM,EAAE,UAAU,EAAE,oBAAoB,EAAE,KAAK,EAAE,CAAC,CAAC;IAClF,MAAM,KAAK,GAAG,EAAE,CAAC,EAAE,CAAC,GAAG,KAAK,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC,GAAG,MAAM,GAAG,CAAC,EAAE,CAAC;IACtD,IAAI,CAAC,QAAQ,CAAC;QACZ,KAAK,EAAE,WAAW,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,GAAG,MAAM,GAAG,CAAC,EAAE,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC;QACjE,GAAG,EAAE,WAAW,CAAC,EAAE,CAAC,EAAE,CAAC,GAAG,KAAK,EAAE,CAAC,EAAE,CAAC,GAAG,MAAM,GAAG,CAAC,EAAE,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC;QAC1E,SAAS,EAAE,MAAM;QACjB,KAAK,EAAE,YAAY,CAAC,MAAM,CAAC,KAAK,IAAI,kBAAkB,CAAC;QACvD,OAAO,EAAE,OAAO;KACjB,CAAC,CAAC;AACL,CAAC,CAAC"}
@@ -1,32 +0,0 @@
1
- import { HEX_COLOR_PATTERN } from '../constants.js';
2
- import { DEFAULT_LINE_COLOR } from './constants.js';
3
- export const propPanel = {
4
- schema: ({ i18n }) => {
5
- return {
6
- color: {
7
- title: i18n('schemas.line.color'),
8
- type: 'string',
9
- widget: 'color',
10
- required: true,
11
- rules: [
12
- {
13
- pattern: HEX_COLOR_PATTERN,
14
- message: i18n('hexColorPrompt'),
15
- },
16
- ],
17
- },
18
- };
19
- },
20
- defaultValue: '',
21
- defaultSchema: {
22
- type: 'line',
23
- position: { x: 0, y: 0 },
24
- width: 50,
25
- height: 1,
26
- rotate: 0,
27
- opacity: 1,
28
- readOnly: true,
29
- color: DEFAULT_LINE_COLOR,
30
- },
31
- };
32
- //# sourceMappingURL=propPanel.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"propPanel.js","sourceRoot":"","sources":["../../../../src/line/propPanel.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAEpD,MAAM,CAAC,MAAM,SAAS,GAA0B;IAC9C,MAAM,EAAE,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE;QACnB,OAAO;YACL,KAAK,EAAE;gBACL,KAAK,EAAE,IAAI,CAAC,oBAAoB,CAAC;gBACjC,IAAI,EAAE,QAAQ;gBACd,MAAM,EAAE,OAAO;gBACf,QAAQ,EAAE,IAAI;gBACd,KAAK,EAAE;oBACL;wBACE,OAAO,EAAE,iBAAiB;wBAC1B,OAAO,EAAE,IAAI,CAAC,gBAAgB,CAAC;qBAChC;iBACF;aACF;SACF,CAAC;IACJ,CAAC;IACD,YAAY,EAAE,EAAE;IAChB,aAAa,EAAE;QACb,IAAI,EAAE,MAAM;QACZ,QAAQ,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE;QACxB,KAAK,EAAE,EAAE;QACT,MAAM,EAAE,CAAC;QACT,MAAM,EAAE,CAAC;QACT,OAAO,EAAE,CAAC;QACV,QAAQ,EAAE,IAAI;QACd,KAAK,EAAE,kBAAkB;KAC1B;CACF,CAAC"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/line/types.ts"],"names":[],"mappings":""}
@@ -1,10 +0,0 @@
1
- import { DEFAULT_LINE_COLOR } from './constants.js';
2
- export const uiRender = (arg) => {
3
- const { schema, rootElement } = arg;
4
- const div = document.createElement('div');
5
- div.style.backgroundColor = schema.color ?? DEFAULT_LINE_COLOR;
6
- div.style.width = '100%';
7
- div.style.height = '100%';
8
- rootElement.appendChild(div);
9
- };
10
- //# sourceMappingURL=uiRender.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"uiRender.js","sourceRoot":"","sources":["../../../../src/line/uiRender.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAE,MAAM,gB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