@pdfme/ui 3.0.1 → 3.1.0-dev.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 (64) hide show
  1. package/__mocks__/assetsTransformer.js +7 -0
  2. package/__mocks__/pdfjs-dist.js +15 -0
  3. package/dist/__vite-browser-external-jWVCDlBL.js +4 -0
  4. package/dist/index.js +1115 -3
  5. package/dist/path2d-polyfill.esm-yIGK7UQJ.js +214 -0
  6. package/dist/style.css +1 -0
  7. package/dist/types/class.d.ts +3 -3
  8. package/dist/types/components/AppContextProvider.d.ts +11 -0
  9. package/dist/types/components/{CtlBar/index.d.ts → CtlBar.d.ts} +2 -2
  10. package/dist/types/components/Designer/Canvas/Selecto.d.ts +3 -2
  11. package/dist/types/components/Designer/Sidebar/DetailView/AlignWidget.d.ts +1 -1
  12. package/dist/types/components/Designer/Sidebar/ListView/SelectableSortableContainer.d.ts +1 -1
  13. package/dist/types/components/Renderer.d.ts +1 -1
  14. package/dist/types/components/UnitPager.d.ts +1 -1
  15. package/dist/types/constants.d.ts +1 -0
  16. package/dist/types/contexts.d.ts +46 -4
  17. package/dist/types/helper.d.ts +2 -1
  18. package/dist/types/hooks.d.ts +19 -2
  19. package/dist/types/i18n.d.ts +3 -27
  20. package/dist/types/theme.d.ts +2 -0
  21. package/package.json +17 -11
  22. package/src/Designer.tsx +27 -53
  23. package/src/Form.tsx +22 -23
  24. package/src/Viewer.tsx +10 -11
  25. package/src/class.ts +5 -5
  26. package/src/components/AppContextProvider.tsx +63 -0
  27. package/src/components/CtlBar.tsx +125 -0
  28. package/src/components/Designer/Canvas/Guides.tsx +18 -23
  29. package/src/components/Designer/Canvas/Mask.tsx +2 -1
  30. package/src/components/Designer/Canvas/Moveable.tsx +60 -60
  31. package/src/components/Designer/Canvas/Selecto.tsx +33 -20
  32. package/src/components/Designer/Canvas/index.tsx +21 -15
  33. package/src/components/Designer/Sidebar/DetailView/AlignWidget.tsx +53 -89
  34. package/src/components/Designer/Sidebar/DetailView/index.tsx +41 -30
  35. package/src/components/Designer/Sidebar/ListView/Item.tsx +30 -19
  36. package/src/components/Designer/Sidebar/ListView/SelectableSortableContainer.tsx +9 -6
  37. package/src/components/Designer/Sidebar/ListView/SelectableSortableItem.tsx +4 -1
  38. package/src/components/Designer/Sidebar/ListView/index.tsx +76 -71
  39. package/src/components/Designer/Sidebar/index.tsx +25 -49
  40. package/src/components/Designer/index.tsx +24 -82
  41. package/src/components/ErrorScreen.tsx +13 -11
  42. package/src/components/Preview.tsx +5 -2
  43. package/src/components/Renderer.tsx +10 -6
  44. package/src/components/Root.tsx +2 -8
  45. package/src/components/Spinner.tsx +12 -31
  46. package/src/components/UnitPager.tsx +72 -55
  47. package/src/constants.ts +2 -0
  48. package/src/contexts.ts +4 -5
  49. package/src/helper.ts +8 -5
  50. package/src/hooks.ts +136 -3
  51. package/src/i18n.ts +168 -59
  52. package/src/theme.ts +20 -0
  53. package/tsconfig.json +35 -13
  54. package/vite.config.ts +27 -0
  55. package/dist/index.js.LICENSE.txt +0 -142
  56. package/dist/index.js.map +0 -1
  57. package/dist/types/components/CtlBar/Pager.d.ts +0 -8
  58. package/dist/types/components/CtlBar/Zoom.d.ts +0 -7
  59. package/dist/types/components/Divider.d.ts +0 -3
  60. package/src/components/CtlBar/Pager.tsx +0 -53
  61. package/src/components/CtlBar/Zoom.tsx +0 -56
  62. package/src/components/CtlBar/index.tsx +0 -46
  63. package/src/components/Divider.tsx +0 -7
  64. package/webpack.config.js +0 -40
package/src/theme.ts ADDED
@@ -0,0 +1,20 @@
1
+ import type { ThemeConfig } from 'antd';
2
+
3
+ export const defaultTheme: ThemeConfig = {
4
+ token: {
5
+ colorPrimary: '#38a0ff',
6
+ },
7
+ components: {
8
+ Form: {
9
+ fontSize: 12,
10
+ margin: 8,
11
+ marginLG: 12,
12
+ marginXS: 4,
13
+ padding: 8,
14
+ paddingLG: 12,
15
+ paddingXS: 4,
16
+ itemMarginBottom: 4,
17
+ verticalLabelPadding: '0 0 2px',
18
+ },
19
+ },
20
+ };
package/tsconfig.json CHANGED
@@ -1,27 +1,49 @@
1
1
  {
2
2
  "compilerOptions": {
3
3
  "noImplicitAny": true,
4
- "target": "ES2015",
4
+ "target": "ES2020",
5
5
  "jsx": "react",
6
6
  "esModuleInterop": true,
7
7
  "isolatedModules": true,
8
8
  "declaration": true,
9
9
  "declarationDir": "dist/types",
10
- "module": "ES2015",
11
- "lib": ["es6", "dom", "es2016", "es2017"],
10
+ "module": "ESNext",
11
+ "lib": [
12
+ "ES2020",
13
+ "DOM",
14
+ "DOM.Iterable"
15
+ ],
12
16
  "moduleResolution": "node",
13
17
  "allowSyntheticDefaultImports": true,
14
18
  "strict": true,
15
- "types": ["node", "jest", "@types/jest"],
16
- "typeRoots": ["../node_modules/@types"],
19
+ "types": [
20
+ "node",
21
+ "jest",
22
+ "@types/jest"
23
+ ],
24
+ "typeRoots": [
25
+ "../node_modules/@types"
26
+ ],
17
27
  "sourceMap": true,
18
- "baseUrl": "..",
28
+ "baseUrl": "..",
19
29
  "paths": {
20
- "@pdfme/common": ["packages/common/src"],
21
- "@pdfme/schemas": ["packages/schemas/src"]
22
- }
30
+ "@pdfme/common": [
31
+ "packages/common/src"
32
+ ],
33
+ "@pdfme/schemas": [
34
+ "packages/schemas/src"
35
+ ]
36
+ },
37
+ "skipLibCheck": true,
23
38
  },
24
- "baseUrl": ".",
25
- "include": ["src/**/*.ts", "src/**/*.tsx"],
26
- "exclude": ["node_modules"]
27
- }
39
+ "include": [
40
+ "src/**/*.ts",
41
+ "src/**/*.tsx"
42
+ ],
43
+ "exclude": [
44
+ "node_modules",
45
+ "dist",
46
+ "**/*.test.ts",
47
+ "**/*.spec.ts",
48
+ ]
49
+ }
package/vite.config.ts ADDED
@@ -0,0 +1,27 @@
1
+ import { defineConfig } from 'vite';
2
+ import react from '@vitejs/plugin-react';
3
+ import tsconfigPaths from 'vite-tsconfig-paths';
4
+ import topLevelAwait from 'vite-plugin-top-level-await';
5
+
6
+ export default defineConfig({
7
+ plugins: [
8
+ react(),
9
+ tsconfigPaths(),
10
+ topLevelAwait({
11
+ promiseExportName: '__tla',
12
+ promiseImportName: (i) => `__tla_${i}`,
13
+ }),
14
+ ],
15
+ build: {
16
+ lib: {
17
+ entry: 'src/index.ts',
18
+ name: '@pdfme/ui',
19
+ fileName: () => `index.js`,
20
+ formats: ['es'],
21
+ },
22
+ },
23
+ optimizeDeps: {
24
+ include: ['react', 'react-dom', 'pdfjs-dist', 'antd'],
25
+ exclude: ['@pdfme/common', '@pdfme/schemas'],
26
+ },
27
+ });
@@ -1,142 +0,0 @@
1
- /*
2
- object-assign
3
- (c) Sindre Sorhus
4
- @license MIT
5
- */
6
-
7
- /*!
8
- Copyright (c) 2018 Jed Watson.
9
- Licensed under the MIT License (MIT), see
10
- http://jedwatson.github.io/classnames
11
- */
12
-
13
- /*!
14
- * @name @pdfme/ui
15
- * @version 3.0.1 | Fri Nov 03 2023
16
- * @author hand-dot
17
- * @license MIT
18
- */
19
-
20
- /*!
21
- * Programatically add the following
22
- */
23
-
24
- /*!
25
- * The buffer module from node.js, for the browser.
26
- *
27
- * @author Feross Aboukhadijeh <https://feross.org>
28
- * @license MIT
29
- */
30
-
31
- /*! *****************************************************************************
32
- Copyright (c) Microsoft Corporation.
33
-
34
- Permission to use, copy, modify, and/or distribute this software for any
35
- purpose with or without fee is hereby granted.
36
-
37
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
38
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
39
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
40
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
41
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
42
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
43
- PERFORMANCE OF THIS SOFTWARE.
44
- ***************************************************************************** */
45
-
46
- /*! *****************************************************************************
47
- Copyright (c) Microsoft Corporation. All rights reserved.
48
- Licensed under the Apache License, Version 2.0 (the "License"); you may not use
49
- this file except in compliance with the License. You may obtain a copy of the
50
- License at http://www.apache.org/licenses/LICENSE-2.0
51
-
52
- THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
53
- KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
54
- WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
55
- MERCHANTABLITY OR NON-INFRINGEMENT.
56
-
57
- See the Apache Version 2.0 License for specific language governing permissions
58
- and limitations under the License.
59
- ***************************************************************************** */
60
-
61
- /*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
62
-
63
- /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
64
-
65
- /**
66
- * @license React
67
- * react-is.production.min.js
68
- *
69
- * Copyright (c) Facebook, Inc. and its affiliates.
70
- *
71
- * This source code is licensed under the MIT license found in the
72
- * LICENSE file in the root directory of this source tree.
73
- */
74
-
75
- /**
76
- * @license React
77
- * use-sync-external-store-shim.production.min.js
78
- *
79
- * Copyright (c) Facebook, Inc. and its affiliates.
80
- *
81
- * This source code is licensed under the MIT license found in the
82
- * LICENSE file in the root directory of this source tree.
83
- */
84
-
85
- /**
86
- * @license React
87
- * use-sync-external-store-shim/with-selector.production.min.js
88
- *
89
- * Copyright (c) Facebook, Inc. and its affiliates.
90
- *
91
- * This source code is licensed under the MIT license found in the
92
- * LICENSE file in the root directory of this source tree.
93
- */
94
-
95
- /**
96
- * @licstart The following is the entire license notice for the
97
- * Javascript code in this page
98
- *
99
- * Copyright 2021 Mozilla Foundation
100
- *
101
- * Licensed under the Apache License, Version 2.0 (the "License");
102
- * you may not use this file except in compliance with the License.
103
- * You may obtain a copy of the License at
104
- *
105
- * http://www.apache.org/licenses/LICENSE-2.0
106
- *
107
- * Unless required by applicable law or agreed to in writing, software
108
- * distributed under the License is distributed on an "AS IS" BASIS,
109
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
110
- * See the License for the specific language governing permissions and
111
- * limitations under the License.
112
- *
113
- * @licend The above is the entire license notice for the
114
- * Javascript code in this page
115
- */
116
-
117
- /** @license React v0.19.1
118
- * scheduler.production.min.js
119
- *
120
- * Copyright (c) Facebook, Inc. and its affiliates.
121
- *
122
- * This source code is licensed under the MIT license found in the
123
- * LICENSE file in the root directory of this source tree.
124
- */
125
-
126
- /** @license React v16.14.0
127
- * react-dom.production.min.js
128
- *
129
- * Copyright (c) Facebook, Inc. and its affiliates.
130
- *
131
- * This source code is licensed under the MIT license found in the
132
- * LICENSE file in the root directory of this source tree.
133
- */
134
-
135
- /** @license React v16.14.0
136
- * react.production.min.js
137
- *
138
- * Copyright (c) Facebook, Inc. and its affiliates.
139
- *
140
- * This source code is licensed under the MIT license found in the
141
- * LICENSE file in the root directory of this source tree.
142
- */