pdfwright-web 0.1.2__tar.gz → 0.2.1__tar.gz

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 (85) hide show
  1. pdfwright_web-0.2.1/.gitignore +33 -0
  2. pdfwright_web-0.2.1/PKG-INFO +40 -0
  3. pdfwright_web-0.2.1/README.md +27 -0
  4. pdfwright_web-0.2.1/frontend/env.d.ts +21 -0
  5. pdfwright_web-0.2.1/frontend/eslint.config.js +40 -0
  6. pdfwright_web-0.2.1/frontend/index.html +12 -0
  7. pdfwright_web-0.2.1/frontend/package.json +47 -0
  8. pdfwright_web-0.2.1/frontend/pnpm-lock.yaml +2393 -0
  9. pdfwright_web-0.2.1/frontend/src/App.vue +327 -0
  10. pdfwright_web-0.2.1/frontend/src/api/client.ts +180 -0
  11. pdfwright_web-0.2.1/frontend/src/components/BoxInput.spec.ts +32 -0
  12. pdfwright_web-0.2.1/frontend/src/components/BoxInput.vue +142 -0
  13. pdfwright_web-0.2.1/frontend/src/components/UnitInput.vue +87 -0
  14. pdfwright_web-0.2.1/frontend/src/designer/CanvasArea.vue +392 -0
  15. pdfwright_web-0.2.1/frontend/src/designer/ComponentPalette.vue +101 -0
  16. pdfwright_web-0.2.1/frontend/src/designer/ElementTree.vue +56 -0
  17. pdfwright_web-0.2.1/frontend/src/designer/ElementTreeNode.vue +115 -0
  18. pdfwright_web-0.2.1/frontend/src/designer/JsonPanel.vue +83 -0
  19. pdfwright_web-0.2.1/frontend/src/designer/PropsPanel.spec.ts +115 -0
  20. pdfwright_web-0.2.1/frontend/src/designer/PropsPanel.vue +1361 -0
  21. pdfwright_web-0.2.1/frontend/src/fill/FillView.vue +218 -0
  22. pdfwright_web-0.2.1/frontend/src/lib/clone.ts +5 -0
  23. pdfwright_web-0.2.1/frontend/src/lib/download.ts +19 -0
  24. pdfwright_web-0.2.1/frontend/src/lib/expand.spec.ts +104 -0
  25. pdfwright_web-0.2.1/frontend/src/lib/expand.ts +340 -0
  26. pdfwright_web-0.2.1/frontend/src/lib/fonts.ts +63 -0
  27. pdfwright_web-0.2.1/frontend/src/lib/format.spec.ts +80 -0
  28. pdfwright_web-0.2.1/frontend/src/lib/format.ts +175 -0
  29. pdfwright_web-0.2.1/frontend/src/lib/markup.spec.ts +14 -0
  30. pdfwright_web-0.2.1/frontend/src/lib/markup.ts +182 -0
  31. pdfwright_web-0.2.1/frontend/src/lib/table.spec.ts +159 -0
  32. pdfwright_web-0.2.1/frontend/src/lib/table.ts +223 -0
  33. pdfwright_web-0.2.1/frontend/src/lib/template.ts +79 -0
  34. pdfwright_web-0.2.1/frontend/src/lib/tree.ts +163 -0
  35. pdfwright_web-0.2.1/frontend/src/lib/units.spec.ts +93 -0
  36. pdfwright_web-0.2.1/frontend/src/lib/units.ts +234 -0
  37. pdfwright_web-0.2.1/frontend/src/main.ts +15 -0
  38. pdfwright_web-0.2.1/frontend/src/renderer/ElementRenderer.spec.ts +214 -0
  39. pdfwright_web-0.2.1/frontend/src/renderer/ElementRenderer.vue +934 -0
  40. pdfwright_web-0.2.1/frontend/src/renderer/InlineText.vue +89 -0
  41. pdfwright_web-0.2.1/frontend/src/renderer/WatermarkLayer.vue +94 -0
  42. pdfwright_web-0.2.1/frontend/src/store/designer.spec.ts +547 -0
  43. pdfwright_web-0.2.1/frontend/src/store/designer.ts +1098 -0
  44. pdfwright_web-0.2.1/frontend/src/styles/main.css +32 -0
  45. pdfwright_web-0.2.1/frontend/src/types/schema.ts +222 -0
  46. pdfwright_web-0.2.1/frontend/tsconfig.json +45 -0
  47. pdfwright_web-0.2.1/frontend/vite.config.ts +32 -0
  48. pdfwright_web-0.2.1/pyproject.toml +79 -0
  49. pdfwright_web-0.2.1/src/pdfwright_web/__init__.py +9 -0
  50. pdfwright_web-0.2.1/src/pdfwright_web/app.py +221 -0
  51. pdfwright_web-0.2.1/src/pdfwright_web/concurrency.py +54 -0
  52. pdfwright_web-0.2.1/src/pdfwright_web/meta.py +911 -0
  53. pdfwright_web-0.2.1/src/pdfwright_web/routers/__init__.py +5 -0
  54. pdfwright_web-0.2.1/src/pdfwright_web/routers/batch.py +139 -0
  55. pdfwright_web-0.2.1/src/pdfwright_web/routers/codes.py +49 -0
  56. pdfwright_web-0.2.1/src/pdfwright_web/routers/convert.py +142 -0
  57. pdfwright_web-0.2.1/src/pdfwright_web/routers/examples.py +89 -0
  58. pdfwright_web-0.2.1/src/pdfwright_web/routers/meta.py +61 -0
  59. pdfwright_web-0.2.1/src/pdfwright_web/routers/options.py +214 -0
  60. pdfwright_web-0.2.1/src/pdfwright_web/routers/render.py +93 -0
  61. pdfwright_web-0.2.1/src/pdfwright_web/routers/verify.py +87 -0
  62. pdfwright_web-0.2.1/src/pdfwright_web/schemas.py +58 -0
  63. pdfwright_web-0.2.1/src/pdfwright_web/security_defaults.py +84 -0
  64. pdfwright_web-0.2.1/src/pdfwright_web/static/assets/index-CGEB_naM.js +86 -0
  65. pdfwright_web-0.2.1/src/pdfwright_web/static/assets/index-z4cHEGId.css +1 -0
  66. pdfwright_web-0.2.1/src/pdfwright_web/static/index.html +13 -0
  67. pdfwright_web-0.2.1/tests/test_api.py +639 -0
  68. pdfwright_web-0.1.2/PKG-INFO +0 -48
  69. pdfwright_web-0.1.2/README.md +0 -29
  70. pdfwright_web-0.1.2/pdfwright_web/__init__.py +0 -6
  71. pdfwright_web-0.1.2/pdfwright_web/cli.py +0 -50
  72. pdfwright_web-0.1.2/pdfwright_web/server.py +0 -646
  73. pdfwright_web-0.1.2/pdfwright_web/static/visual-app/assets/index-BdAuopo-.css +0 -1
  74. pdfwright_web-0.1.2/pdfwright_web/static/visual-app/assets/index-Bnls5JFy.js +0 -3991
  75. pdfwright_web-0.1.2/pdfwright_web/static/visual-app/assets/index-BumJ1qxS.js +0 -39
  76. pdfwright_web-0.1.2/pdfwright_web/static/visual-app/assets/vanilla-picker-B6E6ObS_.js +0 -8
  77. pdfwright_web-0.1.2/pdfwright_web/static/visual-app/index.html +0 -13
  78. pdfwright_web-0.1.2/pdfwright_web.egg-info/PKG-INFO +0 -48
  79. pdfwright_web-0.1.2/pdfwright_web.egg-info/SOURCES.txt +0 -16
  80. pdfwright_web-0.1.2/pdfwright_web.egg-info/dependency_links.txt +0 -1
  81. pdfwright_web-0.1.2/pdfwright_web.egg-info/entry_points.txt +0 -2
  82. pdfwright_web-0.1.2/pdfwright_web.egg-info/requires.txt +0 -1
  83. pdfwright_web-0.1.2/pdfwright_web.egg-info/top_level.txt +0 -1
  84. pdfwright_web-0.1.2/pyproject.toml +0 -58
  85. pdfwright_web-0.1.2/setup.cfg +0 -4
@@ -0,0 +1,33 @@
1
+ # Python
2
+ __pycache__/
3
+ *.py[cod]
4
+ .venv/
5
+ dist/
6
+ build/
7
+ *.egg-info/
8
+ .pytest_cache/
9
+ .ruff_cache/
10
+ .mypy_cache/
11
+ .coverage
12
+ htmlcov/
13
+ bandit-report.json
14
+
15
+ # Node / 前端
16
+ node_modules/
17
+ pdfwright-web/frontend/dist/
18
+ pdfwright-web/frontend/.vite/
19
+
20
+ # 前端构建产物(由 pdfwright-web 构建时生成,不入库;构建命令见 README)
21
+ pdfwright-web/src/pdfwright_web/static/
22
+
23
+ # 示例生成的输出文件
24
+ pdfwright/examples/output/
25
+
26
+ # 其它
27
+ .DS_Store
28
+ *.log
29
+ .idea/
30
+ .vscode/
31
+
32
+ # 本地发布凭据(scripts/publish.sh --config 默认读它)
33
+ .publish.env
@@ -0,0 +1,40 @@
1
+ Metadata-Version: 2.5
2
+ Name: pdfwright-web
3
+ Version: 0.2.1
4
+ Summary: pdfwright 的无状态 Web 服务:可视化配置编辑器 + HTML/PDF 预览 + 对外渲染 API(不存储任何数据与内容)
5
+ License: Proprietary
6
+ Requires-Python: >=3.12
7
+ Requires-Dist: fastapi>=0.115
8
+ Requires-Dist: pdfwright>=0.2.1
9
+ Requires-Dist: pydantic>=2.9
10
+ Requires-Dist: python-multipart>=0.0.9
11
+ Requires-Dist: uvicorn>=0.30
12
+ Description-Content-Type: text/markdown
13
+
14
+ # pdfwright-web — 无状态 Web 服务
15
+
16
+ 为 pdfwright 提供的配置 / 预览 / 对外渲染服务:
17
+
18
+ - **不存储任何数据与内容**(无数据库、无文件持久化),外部传入 JSON,回传 PDF / HTML / 校验结果。
19
+ - 提供可视化配置编辑器(Vue3 + TS + Element Plus 前端,构建产物内嵌于本包)。
20
+ - 依赖基础库 [`pdfwright`](../pdfwright/)。
21
+
22
+ ## 启动
23
+
24
+ ```bash
25
+ uv run uvicorn pdfwright_web.app:app --host 0.0.0.0 --port 8765
26
+ ```
27
+
28
+ ## API(骨架规划)
29
+
30
+ | 方法 | 路径 | 说明 |
31
+ |---|---|---|
32
+ | POST | /api/validate | schema 校验(返回错误列表) |
33
+ | POST | /api/render/html | schema + data → HTML 预览 |
34
+ | POST | /api/render/pdf | schema + data → PDF 二进制 |
35
+ | GET | /api/meta/components | 组件注册表(编辑器调色板/属性面板驱动) |
36
+ | POST | /api/options/fetch | 接口选项代理(动态下拉,解决 CORS) |
37
+ | POST | /api/convert/docx | DOCX → schema(高保真 + 自动字段 key) |
38
+ | POST | /api/convert/xlsx | Excel → schema |
39
+
40
+ 详细实现见后续迭代(当前为骨架)。
@@ -0,0 +1,27 @@
1
+ # pdfwright-web — 无状态 Web 服务
2
+
3
+ 为 pdfwright 提供的配置 / 预览 / 对外渲染服务:
4
+
5
+ - **不存储任何数据与内容**(无数据库、无文件持久化),外部传入 JSON,回传 PDF / HTML / 校验结果。
6
+ - 提供可视化配置编辑器(Vue3 + TS + Element Plus 前端,构建产物内嵌于本包)。
7
+ - 依赖基础库 [`pdfwright`](../pdfwright/)。
8
+
9
+ ## 启动
10
+
11
+ ```bash
12
+ uv run uvicorn pdfwright_web.app:app --host 0.0.0.0 --port 8765
13
+ ```
14
+
15
+ ## API(骨架规划)
16
+
17
+ | 方法 | 路径 | 说明 |
18
+ |---|---|---|
19
+ | POST | /api/validate | schema 校验(返回错误列表) |
20
+ | POST | /api/render/html | schema + data → HTML 预览 |
21
+ | POST | /api/render/pdf | schema + data → PDF 二进制 |
22
+ | GET | /api/meta/components | 组件注册表(编辑器调色板/属性面板驱动) |
23
+ | POST | /api/options/fetch | 接口选项代理(动态下拉,解决 CORS) |
24
+ | POST | /api/convert/docx | DOCX → schema(高保真 + 自动字段 key) |
25
+ | POST | /api/convert/xlsx | Excel → schema |
26
+
27
+ 详细实现见后续迭代(当前为骨架)。
@@ -0,0 +1,21 @@
1
+ /// <reference types="vite/client" />
2
+
3
+ declare module '*.vue' {
4
+ import type { DefineComponent } from 'vue'
5
+ const component: DefineComponent<Record<string, unknown>, Record<string, unknown>, unknown>
6
+ export default component
7
+ }
8
+
9
+ declare module 'nunjucks' {
10
+ export interface Environment {
11
+ render(template: string, context: Record<string, unknown>): string
12
+ renderString(template: string, context: Record<string, unknown>): string
13
+ addFilter(name: string, fn: (...args: unknown[]) => unknown): void
14
+ options: { autoescape: boolean }
15
+ }
16
+ export function configure(options: Record<string, unknown>): Environment
17
+ export class Template {
18
+ constructor(src: string, env?: Environment, path?: string)
19
+ render(context?: Record<string, unknown>): string
20
+ }
21
+ }
@@ -0,0 +1,40 @@
1
+ // ESLint 9 flat config:Vue 3 + TypeScript(项目红线要求 ESLint 强制通过)
2
+ import js from '@eslint/js'
3
+ import tseslint from 'typescript-eslint'
4
+ import pluginVue from 'eslint-plugin-vue'
5
+
6
+ export default tseslint.config(
7
+ { ignores: ['dist/**', 'node_modules/**', '../src/pdfwright_web/static/**'] },
8
+ js.configs.recommended,
9
+ ...tseslint.configs.recommended,
10
+ ...pluginVue.configs['flat/recommended'],
11
+ {
12
+ files: ['**/*.vue'],
13
+ languageOptions: {
14
+ parserOptions: { parser: tseslint.parser },
15
+ },
16
+ rules: {
17
+ // TS 已由 vue-tsc 做未定义变量检查(typescript-eslint 官方建议关闭 no-undef);
18
+ // eslint-plugin-vue v10 起不再为 .vue 注入 browser globals,故此处显式关闭。
19
+ 'no-undef': 'off',
20
+ },
21
+ },
22
+ {
23
+ rules: {
24
+ // 单文件组件名与模板属性顺序不做强制,避免与既有代码风格冲突
25
+ 'vue/multi-word-component-names': 'off',
26
+ 'vue/attributes-order': 'off',
27
+ 'vue/max-attributes-per-line': 'off',
28
+ 'vue/singleline-html-element-content-newline': 'off',
29
+ 'vue/html-self-closing': 'off',
30
+ 'vue/html-indent': 'off',
31
+ // 新版 core 规则不认识 Vue 模板里的使用(computed/常量只在模板引用)→ 误报
32
+ 'no-useless-assignment': 'off',
33
+ '@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_' }],
34
+ '@typescript-eslint/no-explicit-any': 'warn',
35
+ // v-html 只用于 markupToHtml 的输出:除白名单标签外全部转义,且属性来自
36
+ // 我们自己的 schema(非用户 HTML 输入),因此不存在注入面
37
+ 'vue/no-v-html': 'off',
38
+ },
39
+ },
40
+ )
@@ -0,0 +1,12 @@
1
+ <!doctype html>
2
+ <html lang="zh-CN">
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
+ <title>pdfwright 可视化页面设计器</title>
7
+ </head>
8
+ <body>
9
+ <div id="app"></div>
10
+ <script type="module" src="/src/main.ts"></script>
11
+ </body>
12
+ </html>
@@ -0,0 +1,47 @@
1
+ {
2
+ "name": "pdfwright-designer",
3
+ "private": true,
4
+ "version": "0.2.1",
5
+ "type": "module",
6
+ "scripts": {
7
+ "dev": "vite",
8
+ "build": "vue-tsc --noEmit && vite build",
9
+ "build:only": "vite build",
10
+ "typecheck": "vue-tsc --noEmit",
11
+ "lint:check": "eslint .",
12
+ "lint": "eslint . --fix",
13
+ "format": "prettier --write src",
14
+ "preview": "vite preview",
15
+ "test": "vitest run"
16
+ },
17
+ "dependencies": {
18
+ "@element-plus/icons-vue": "^2.3.2",
19
+ "element-plus": "^2.14.6",
20
+ "nunjucks": "^3.2.4",
21
+ "vue": "^3.5.43",
22
+ "vuedraggable": "^4.1.0"
23
+ },
24
+ "devDependencies": {
25
+ "@eslint/js": "^10.0.1",
26
+ "@tailwindcss/vite": "^4.3.3",
27
+ "@types/node": "^26.6.2",
28
+ "@types/nunjucks": "^3.2.6",
29
+ "@vitejs/plugin-vue": "^6.0.9",
30
+ "@vue/server-renderer": "^3.5.43",
31
+ "eslint": "^10.11.0",
32
+ "eslint-plugin-vue": "^10.11.0",
33
+ "prettier": "^3.9.8",
34
+ "tailwindcss": "^4.3.3",
35
+ "typescript": "^6.0.3",
36
+ "typescript-eslint": "^8.70.0",
37
+ "vite": "^8.3.0",
38
+ "vitest": "^5.0.1",
39
+ "vue-eslint-parser": "^10.4.1",
40
+ "vue-tsc": "^3.3.11"
41
+ },
42
+ "pnpm": {
43
+ "onlyBuiltDependencies": [
44
+ "esbuild"
45
+ ]
46
+ }
47
+ }