@pdfme/ui 1.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 (118) hide show
  1. package/.eslintrc.js +45 -0
  2. package/README.md +280 -0
  3. package/declaration.d.ts +8 -0
  4. package/dist/@pdfme/ui.js +3 -0
  5. package/dist/@pdfme/ui.js.LICENSE.txt +95 -0
  6. package/dist/@pdfme/ui.js.map +1 -0
  7. package/dist/types/common/src/barcode.d.ts +2 -0
  8. package/dist/types/common/src/constants.d.ts +6 -0
  9. package/dist/types/common/src/helper.d.ts +15 -0
  10. package/dist/types/common/src/index.d.ts +4 -0
  11. package/dist/types/common/src/schema.d.ts +3613 -0
  12. package/dist/types/common/src/type.d.ts +64 -0
  13. package/dist/types/common/src/utils.d.ts +12 -0
  14. package/dist/types/ui/src/Designer.d.ts +13 -0
  15. package/dist/types/ui/src/Form.d.ts +13 -0
  16. package/dist/types/ui/src/Viewer.d.ts +7 -0
  17. package/dist/types/ui/src/class.d.ts +72 -0
  18. package/dist/types/ui/src/components/Designer/Main/Guides.d.ts +9 -0
  19. package/dist/types/ui/src/components/Designer/Main/Mask.d.ts +3 -0
  20. package/dist/types/ui/src/components/Designer/Main/Moveable.d.ts +31 -0
  21. package/dist/types/ui/src/components/Designer/Main/Selecto.d.ts +8 -0
  22. package/dist/types/ui/src/components/Designer/Main/index.d.ts +24 -0
  23. package/dist/types/ui/src/components/Designer/Sidebar/DetailView/ExampleInputEditor.d.ts +3 -0
  24. package/dist/types/ui/src/components/Designer/Sidebar/DetailView/PositionAndSizeEditor.d.ts +3 -0
  25. package/dist/types/ui/src/components/Designer/Sidebar/DetailView/TextPropEditor.d.ts +3 -0
  26. package/dist/types/ui/src/components/Designer/Sidebar/DetailView/TypeAndKeyEditor.d.ts +3 -0
  27. package/dist/types/ui/src/components/Designer/Sidebar/DetailView/index.d.ts +3 -0
  28. package/dist/types/ui/src/components/Designer/Sidebar/ListView.d.ts +3 -0
  29. package/dist/types/ui/src/components/Designer/Sidebar/index.d.ts +26 -0
  30. package/dist/types/ui/src/components/Designer/index.d.ts +99 -0
  31. package/dist/types/ui/src/components/Divider.d.ts +2 -0
  32. package/dist/types/ui/src/components/Error.d.ts +7 -0
  33. package/dist/types/ui/src/components/Paper.d.ts +19 -0
  34. package/dist/types/ui/src/components/Preview/Pager/Page.d.ts +8 -0
  35. package/dist/types/ui/src/components/Preview/Pager/Unit.d.ts +8 -0
  36. package/dist/types/ui/src/components/Preview/index.d.ts +4 -0
  37. package/dist/types/ui/src/components/Root.d.ts +9 -0
  38. package/dist/types/ui/src/components/Schemas/BarcodeSchema.d.ts +15 -0
  39. package/dist/types/ui/src/components/Schemas/ImageSchema.d.ts +15 -0
  40. package/dist/types/ui/src/components/Schemas/SchemaUI.d.ts +14 -0
  41. package/dist/types/ui/src/components/Schemas/TextSchema.d.ts +22 -0
  42. package/dist/types/ui/src/components/Spinner.d.ts +2 -0
  43. package/dist/types/ui/src/constants.d.ts +5 -0
  44. package/dist/types/ui/src/contexts.d.ts +7 -0
  45. package/dist/types/ui/src/helper.d.ts +91 -0
  46. package/dist/types/ui/src/hooks.d.ts +26 -0
  47. package/dist/types/ui/src/i18n.d.ts +30 -0
  48. package/dist/types/ui/src/index.d.ts +5 -0
  49. package/dist/types/ui/src/libs/class.d.ts +84 -0
  50. package/dist/types/ui/src/libs/contexts.d.ts +7 -0
  51. package/dist/types/ui/src/libs/helper.d.ts +64 -0
  52. package/dist/types/ui/src/libs/hooks.d.ts +26 -0
  53. package/dist/types/ui/src/libs/i18n.d.ts +30 -0
  54. package/dist/types/ui/src/libs/ui.d.ts +64 -0
  55. package/package.json +80 -0
  56. package/public/Designer.html +90 -0
  57. package/public/Form.html +74 -0
  58. package/public/SauceHanSansJP.ttf +0 -0
  59. package/public/SauceHanSerifJP.ttf +0 -0
  60. package/public/Viewer.html +73 -0
  61. package/public/helper.js +51 -0
  62. package/public/index.html +54 -0
  63. package/src/Designer.tsx +72 -0
  64. package/src/Form.tsx +45 -0
  65. package/src/Viewer.tsx +27 -0
  66. package/src/assets/barcodeExamples/code128.png +0 -0
  67. package/src/assets/barcodeExamples/code39.png +0 -0
  68. package/src/assets/barcodeExamples/ean13.png +0 -0
  69. package/src/assets/barcodeExamples/ean8.png +0 -0
  70. package/src/assets/barcodeExamples/itf14.png +0 -0
  71. package/src/assets/barcodeExamples/japanpost.png +0 -0
  72. package/src/assets/barcodeExamples/nw7.png +0 -0
  73. package/src/assets/barcodeExamples/qrcode.png +0 -0
  74. package/src/assets/barcodeExamples/upca.png +0 -0
  75. package/src/assets/barcodeExamples/upce.png +0 -0
  76. package/src/assets/icons/back.svg +4 -0
  77. package/src/assets/icons/double-left.svg +11 -0
  78. package/src/assets/icons/double-right.svg +11 -0
  79. package/src/assets/icons/drag.svg +3 -0
  80. package/src/assets/icons/forward.svg +4 -0
  81. package/src/assets/icons/left.svg +4 -0
  82. package/src/assets/icons/right.svg +4 -0
  83. package/src/assets/icons/warning.svg +4 -0
  84. package/src/assets/imageExample.png +0 -0
  85. package/src/class.ts +147 -0
  86. package/src/components/Designer/Main/Guides.tsx +53 -0
  87. package/src/components/Designer/Main/Mask.tsx +19 -0
  88. package/src/components/Designer/Main/Moveable.tsx +79 -0
  89. package/src/components/Designer/Main/Selecto.tsx +29 -0
  90. package/src/components/Designer/Main/index.tsx +314 -0
  91. package/src/components/Designer/Sidebar/DetailView/ExampleInputEditor.tsx +62 -0
  92. package/src/components/Designer/Sidebar/DetailView/PositionAndSizeEditor.tsx +98 -0
  93. package/src/components/Designer/Sidebar/DetailView/TextPropEditor.tsx +178 -0
  94. package/src/components/Designer/Sidebar/DetailView/TypeAndKeyEditor.tsx +79 -0
  95. package/src/components/Designer/Sidebar/DetailView/index.tsx +39 -0
  96. package/src/components/Designer/Sidebar/ListView.tsx +180 -0
  97. package/src/components/Designer/Sidebar/index.tsx +102 -0
  98. package/src/components/Designer/index.tsx +283 -0
  99. package/src/components/Divider.tsx +7 -0
  100. package/src/components/Error.tsx +31 -0
  101. package/src/components/Paper.tsx +77 -0
  102. package/src/components/Preview/Pager/Page.tsx +85 -0
  103. package/src/components/Preview/Pager/Unit.tsx +87 -0
  104. package/src/components/Preview/index.tsx +102 -0
  105. package/src/components/Root.tsx +52 -0
  106. package/src/components/Schemas/BarcodeSchema.tsx +111 -0
  107. package/src/components/Schemas/ImageSchema.tsx +81 -0
  108. package/src/components/Schemas/SchemaUI.tsx +64 -0
  109. package/src/components/Schemas/TextSchema.tsx +62 -0
  110. package/src/components/Spinner.tsx +37 -0
  111. package/src/constants.ts +9 -0
  112. package/src/contexts.ts +8 -0
  113. package/src/helper.ts +516 -0
  114. package/src/hooks.ts +107 -0
  115. package/src/i18n.ts +64 -0
  116. package/src/index.ts +77 -0
  117. package/tsconfig.json +21 -0
  118. package/webpack.config.js +73 -0
package/src/index.ts ADDED
@@ -0,0 +1,77 @@
1
+ import Designer from './Designer';
2
+ import Form from './Form';
3
+ import Viewer from './Viewer';
4
+ import {
5
+ BLANK_PDF,
6
+ Lang,
7
+ Size,
8
+ Alignment,
9
+ SchemaType,
10
+ schemaTypes,
11
+ BarCodeType,
12
+ TextSchema,
13
+ isTextSchema,
14
+ ImageSchema,
15
+ isImageSchema,
16
+ BarcodeSchema,
17
+ isBarcodeSchema,
18
+ Schema,
19
+ SchemaForUI,
20
+ Font,
21
+ BasePdf,
22
+ Template,
23
+ CommonProps,
24
+ GeneratorOptions,
25
+ GenerateProps,
26
+ UIOptions,
27
+ UIProps,
28
+ PreviewProps,
29
+ PreviewReactProps,
30
+ DesignerProps,
31
+ DesignerReactProps,
32
+ checkTemplate,
33
+ checkUIProps,
34
+ checkPreviewProps,
35
+ checkDesignerProps,
36
+ checkGenerateProps,
37
+ validateBarcodeInput,
38
+ } from '@pdfme/common';
39
+
40
+ export {
41
+ Designer,
42
+ Viewer,
43
+ Form,
44
+ BLANK_PDF,
45
+ Lang,
46
+ Size,
47
+ Alignment,
48
+ SchemaType,
49
+ schemaTypes,
50
+ BarCodeType,
51
+ TextSchema,
52
+ isTextSchema,
53
+ ImageSchema,
54
+ isImageSchema,
55
+ BarcodeSchema,
56
+ isBarcodeSchema,
57
+ Schema,
58
+ SchemaForUI,
59
+ Font,
60
+ BasePdf,
61
+ Template,
62
+ CommonProps,
63
+ GeneratorOptions,
64
+ GenerateProps,
65
+ UIOptions,
66
+ UIProps,
67
+ PreviewProps,
68
+ PreviewReactProps,
69
+ DesignerProps,
70
+ DesignerReactProps,
71
+ checkTemplate,
72
+ checkUIProps,
73
+ checkPreviewProps,
74
+ checkDesignerProps,
75
+ checkGenerateProps,
76
+ validateBarcodeInput,
77
+ };
package/tsconfig.json ADDED
@@ -0,0 +1,21 @@
1
+ {
2
+ "compilerOptions": {
3
+ "noImplicitAny": true,
4
+ "target": "es5",
5
+ "jsx": "react",
6
+ "esModuleInterop": true,
7
+ "declaration": true,
8
+ "declarationDir": "dist/types",
9
+ "module": "ES2015",
10
+ "lib": ["es6", "dom", "es2016", "es2017"],
11
+ "moduleResolution": "node",
12
+ "allowSyntheticDefaultImports": true,
13
+ "strict": true,
14
+ "types": ["node", "jest", "@types/jest"],
15
+ "typeRoots": ["node_modules/@types"],
16
+ "sourceMap": true
17
+ },
18
+ "baseUrl": ".",
19
+ "include": ["declaration.d.ts", "src/**/*.ts", "src/**/*.tsx"],
20
+ "exclude": ["node_modules"]
21
+ }
@@ -0,0 +1,73 @@
1
+ const path = require('path');
2
+ const webpack = require('webpack');
3
+ // const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
4
+ const HtmlWebpackPlugin = require('html-webpack-plugin');
5
+ const pkg = require('./package.json');
6
+
7
+ const isProduction = process.env.NODE_ENV === 'production';
8
+
9
+ const BANNER = [
10
+ '@name ' + pkg.name,
11
+ '@version ' + pkg.version + ' | ' + new Date().toDateString(),
12
+ '@author ' + pkg.author,
13
+ '@license ' + pkg.license,
14
+ ].join('\n');
15
+
16
+ const config = {
17
+ optimization: { minimize: isProduction },
18
+ resolve: {
19
+ extensions: ['.ts', '.tsx', '.js', '.png', '.svg'],
20
+ alias: { process: 'process/browser' },
21
+ },
22
+ plugins: [
23
+ // new BundleAnalyzerPlugin(),
24
+ new webpack.ProvidePlugin({
25
+ process: 'process/browser',
26
+ }),
27
+ new webpack.BannerPlugin({
28
+ banner: BANNER,
29
+ entryOnly: true,
30
+ }),
31
+ new HtmlWebpackPlugin({
32
+ template: './public/Designer.html',
33
+ filename: 'Designer.html',
34
+ }),
35
+ new HtmlWebpackPlugin({
36
+ template: './public/Viewer.html',
37
+ filename: 'Viewer.html',
38
+ }),
39
+ new HtmlWebpackPlugin({
40
+ template: './public/Form.html',
41
+ filename: 'Form.html',
42
+ }),
43
+ ],
44
+ devtool: 'source-map',
45
+ devServer: {
46
+ historyApiFallback: false,
47
+ host: '0.0.0.0',
48
+ },
49
+ entry: './src/index.ts',
50
+ output: {
51
+ path: path.resolve(__dirname, 'dist'),
52
+ filename: `${pkg.name}.js`,
53
+ libraryTarget: 'umd',
54
+ globalObject: 'this',
55
+ library: {
56
+ name: pkg.name,
57
+ type: 'umd',
58
+ },
59
+ },
60
+ module: {
61
+ rules: [
62
+ {
63
+ test: /\.tsx?$/,
64
+ use: 'ts-loader',
65
+ },
66
+ {
67
+ test: /\.(png|svg|ttf)$/i,
68
+ use: ['url-loader'],
69
+ },
70
+ ],
71
+ },
72
+ };
73
+ module.exports = config;