@worm-vue3-print/common 0.0.0-stage → 1.3.7-beta.0

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 (43) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +99 -2
  3. package/dist/browser-bundle.d.ts +12 -0
  4. package/dist/common.css +462 -0
  5. package/dist/common.js +910 -0
  6. package/dist/core/default-template.d.ts +9 -0
  7. package/dist/core/font-catalog.d.ts +30 -0
  8. package/dist/core/format.d.ts +102 -0
  9. package/dist/core/h.d.ts +22 -0
  10. package/dist/core/icons.d.ts +10 -0
  11. package/dist/core/store.d.ts +163 -0
  12. package/dist/index.cjs +657 -0
  13. package/dist/index.d.ts +13 -0
  14. package/dist/index.js +7058 -0
  15. package/dist/print-designer.d.ts +182 -0
  16. package/dist/shell/binding.d.ts +21 -0
  17. package/dist/shell/canvas.d.ts +59 -0
  18. package/dist/shell/code.d.ts +11 -0
  19. package/dist/shell/color-picker.d.ts +44 -0
  20. package/dist/shell/controls.d.ts +101 -0
  21. package/dist/shell/elements.d.ts +27 -0
  22. package/dist/shell/expression-editor.d.ts +33 -0
  23. package/dist/shell/font-select.d.ts +24 -0
  24. package/dist/shell/format-bar.d.ts +15 -0
  25. package/dist/shell/help-content/changelog.d.ts +12 -0
  26. package/dist/shell/help-content/faq.d.ts +12 -0
  27. package/dist/shell/help-content/features.d.ts +12 -0
  28. package/dist/shell/help-content/getting-started.d.ts +12 -0
  29. package/dist/shell/help-content/index.d.ts +13 -0
  30. package/dist/shell/help-content/shortcuts.d.ts +12 -0
  31. package/dist/shell/help-modal.d.ts +19 -0
  32. package/dist/shell/page-extras.d.ts +10 -0
  33. package/dist/shell/panels.d.ts +17 -0
  34. package/dist/shell/prop-group.d.ts +11 -0
  35. package/dist/shell/property-panel.d.ts +14 -0
  36. package/dist/shell/property-search.d.ts +32 -0
  37. package/dist/shell/ruler.d.ts +29 -0
  38. package/dist/shell/table-props.d.ts +17 -0
  39. package/dist/shell/table.d.ts +22 -0
  40. package/dist/shell/toolbar-overflow.d.ts +28 -0
  41. package/dist/shell/toolbar.d.ts +8 -0
  42. package/dist/shell/watermark.d.ts +10 -0
  43. package/package.json +57 -4
@@ -0,0 +1,11 @@
1
+ /*!
2
+ * @worm-vue3-print/common v1.3.7-beta.0
3
+ * Copyright (c) 2026 worm <liu_long_qqcom@qq.com>
4
+ * SPDX-FileCopyrightText: 2026 worm <liu_long_qqcom@qq.com>
5
+ * SPDX-License-Identifier: MIT
6
+ */
7
+ import type { El } from '../core/h';
8
+ import type { ShellCtx } from './controls';
9
+ export declare function group(ctx: ShellCtx, key: string, title: string, icon: string, rows: unknown[], defaultExpanded?: boolean): El;
10
+ /** 表单壳:canvas 各分组内容恒为 form.pd-form 且屏蔽回车提交 */
11
+ export declare function pdForm(children: unknown[]): El;
@@ -0,0 +1,14 @@
1
+ /*!
2
+ * @worm-vue3-print/common v1.3.7-beta.0
3
+ * Copyright (c) 2026 worm <liu_long_qqcom@qq.com>
4
+ * SPDX-FileCopyrightText: 2026 worm <liu_long_qqcom@qq.com>
5
+ * SPDX-License-Identifier: MIT
6
+ */
7
+ import type { ShellCtx } from './controls';
8
+ /** 下拉属性行 */
9
+ /** 下拉属性行(导出仅供单测断言未设置态,包公开入口不导出) */
10
+ export declare function selectField(_ctx: ShellCtx, label: string, value: string, options: {
11
+ value: string;
12
+ label: string;
13
+ }[], onCommit: (v: string) => void, tip?: string): import("../core/h").El;
14
+ export declare function renderPropertyPanel(ctx: ShellCtx): import("../core/h").El;
@@ -0,0 +1,32 @@
1
+ /*!
2
+ * @worm-vue3-print/common v1.3.7-beta.0
3
+ * Copyright (c) 2026 worm <liu_long_qqcom@qq.com>
4
+ * SPDX-FileCopyrightText: 2026 worm <liu_long_qqcom@qq.com>
5
+ * SPDX-License-Identifier: MIT
6
+ */
7
+ import type { El } from '../core/h';
8
+ import type { ShellCtx } from './controls';
9
+ export interface PropertySearchResult {
10
+ groups: string[];
11
+ keys: Set<string>;
12
+ searching: boolean;
13
+ }
14
+ /** 命中结果(按关键字缓存:一次重绘要问几十次,避免重复扫描注册表) */
15
+ export declare function propertySearch(text?: string): PropertySearchResult;
16
+ /** 该分组是否受搜索门控:不在注册表内的分组(行属性/单元格)恒显示 */
17
+ export declare function searchGroupOf(groupKey: string): string;
18
+ /** 对应 canvas 各分组的 `v-if="filteredGroups.includes(key)"` */
19
+ export declare function showGroup(ctx: ShellCtx, groupKey: string): boolean;
20
+ /** 对应 canvas 分组内的 `v-show="showItem(key)"` */
21
+ export declare function showItem(ctx: ShellCtx, itemKey: string): boolean;
22
+ /** 字段门控:挂 data-prop-key(供输入时定点更新)+ 按搜索态决定显隐 */
23
+ export declare function gateItem(ctx: ShellCtx, itemKey: string, node: El): El;
24
+ /** 分组门控标记:挂 data-prop-group 并给出是否显示 */
25
+ export declare function gateGroup(ctx: ShellCtx, groupKey: string, node: El): El;
26
+ /**
27
+ * 定点重放:搜索框输入时只切显隐,不整体重绘;外壳 paint() 末尾同样调用它,
28
+ * 保证重绘后的 DOM 与当前过滤词一致。
29
+ */
30
+ export declare function applyPropertySearch(root: ParentNode, text?: string): void;
31
+ /** 搜索框:canvas 的 PropertySearch.vue 等价物(类名与结构逐字一致) */
32
+ export declare function renderPropertySearch(ctx: ShellCtx): El;
@@ -0,0 +1,29 @@
1
+ /*!
2
+ * @worm-vue3-print/common v1.3.7-beta.0
3
+ * Copyright (c) 2026 worm <liu_long_qqcom@qq.com>
4
+ * SPDX-FileCopyrightText: 2026 worm <liu_long_qqcom@qq.com>
5
+ * SPDX-License-Identifier: MIT
6
+ */
7
+ /** 设计区视口几何(与 CanvasArea.vue 的 rulerGeom 同构) */
8
+ export interface RulerGeom {
9
+ /** 纸张 0mm 点相对横尺起点的屏幕偏移(已扣除尺条厚度) */
10
+ originX: number;
11
+ /** 纸张 0mm 点相对竖尺起点的屏幕偏移 */
12
+ originY: number;
13
+ /** 横尺可见长度(屏幕 px) */
14
+ viewW: number;
15
+ /** 竖尺可见长度(屏幕 px) */
16
+ viewH: number;
17
+ /** 纸张当前缩放(1 = 100%) */
18
+ paperScale: number;
19
+ }
20
+ export interface RulerOptions {
21
+ orientation: 'horizontal' | 'vertical';
22
+ geom: RulerGeom;
23
+ /** 纸张该方向长度(mm),用于边界标记与纸外淡化范围 */
24
+ paperLengthMM: number;
25
+ scale: number;
26
+ /** 鼠标在尺条轴向上的位置(屏幕 px) */
27
+ cursorPx?: number | null;
28
+ }
29
+ export declare function drawRuler(canvas: HTMLCanvasElement, opts: RulerOptions): void;
@@ -0,0 +1,17 @@
1
+ /*!
2
+ * @worm-vue3-print/common v1.3.7-beta.0
3
+ * Copyright (c) 2026 worm <liu_long_qqcom@qq.com>
4
+ * SPDX-FileCopyrightText: 2026 worm <liu_long_qqcom@qq.com>
5
+ * SPDX-License-Identifier: MIT
6
+ */
7
+ import type { RuntimeElement } from '@worm-vue3-print/core/designer';
8
+ import type { El } from '../core/h';
9
+ import type { ShellCtx } from './controls';
10
+ /** 行属性:行类型 / 行高 / 表头每页重复(作用于整个表头区) */
11
+ export declare function tableRowGroup(ctx: ShellCtx, el: RuntimeElement): El;
12
+ /** 表格设置:列表数据源、表格级默认样式、逐列列宽 */
13
+ export declare function tableSettingsGroup(ctx: ShellCtx, el: RuntimeElement): El;
14
+ /** 分页配置:表格元素只有「启用分页」,非表格元素为「参与分页 / 与下元素同页」 */
15
+ export declare function paginationGroup(ctx: ShellCtx, el: RuntimeElement): El;
16
+ /** 单元格:内容类型与码制 / 内容表达式 / 样式 / 边框 / 合并拆分(作用于整个选区) */
17
+ export declare function tableCellGroup(ctx: ShellCtx, el: RuntimeElement): El;
@@ -0,0 +1,22 @@
1
+ /*!
2
+ * @worm-vue3-print/common v1.3.7-beta.0
3
+ * Copyright (c) 2026 worm <liu_long_qqcom@qq.com>
4
+ * SPDX-FileCopyrightText: 2026 worm <liu_long_qqcom@qq.com>
5
+ * SPDX-License-Identifier: MIT
6
+ */
7
+ import type { RuntimeElement } from '@worm-vue3-print/core/designer';
8
+ import type { DesignerStore } from '../core/store';
9
+ import type { El } from '../core/h';
10
+ export interface TableFire {
11
+ (action: string, arg?: unknown): void;
12
+ }
13
+ /** 表格右键菜单可见状态:由外层持有并逐帧传给 renderTableContextMenu */
14
+ export interface TableMenuState {
15
+ visible: boolean;
16
+ x: number;
17
+ y: number;
18
+ }
19
+ export declare function renderTableContextMenu(store: DesignerStore, fire: TableFire, menu: TableMenuState): El | '';
20
+ /** 强制解除列宽拖拽监听(宿主 disconnectedCallback 可用) */
21
+ export declare function abortTableColResize(): void;
22
+ export declare function renderTable(el: RuntimeElement, store: DesignerStore, fire: TableFire): El;
@@ -0,0 +1,28 @@
1
+ /*!
2
+ * @worm-vue3-print/common v1.3.7-beta.0
3
+ * Copyright (c) 2026 worm <liu_long_qqcom@qq.com>
4
+ * SPDX-FileCopyrightText: 2026 worm <liu_long_qqcom@qq.com>
5
+ * SPDX-License-Identifier: MIT
6
+ */
7
+ import type { ShellCtx } from './controls';
8
+ export declare const TOOLBAR_OVERFLOW_GAP = 2;
9
+ /** 「更多」触发钮占位宽,与 CSS 侧 .tb-dd-trigger 的 padding + 文字 + 箭头对齐 */
10
+ export declare const MORE_TRIGGER_WIDTH = 74;
11
+ export interface ToolbarUnitDef {
12
+ id: string;
13
+ /** 数值小者先被收进「更多」 */
14
+ order: number;
15
+ /** 面板内分组标题 */
16
+ label: string;
17
+ }
18
+ /** 收纳优先级链:与 canvas 的 DesignerToolbar / FormatToolbar 声明逐条对应 */
19
+ export declare const TOOLBAR_UNITS: ToolbarUnitDef[];
20
+ /**
21
+ * 「更多」分组节点:触发钮 + 常驻面板(收起时 .is-hidden,不能用条件渲染,
22
+ * 否则落位槽不存在,被收纳的单元会退回行内显示)。
23
+ */
24
+ export declare function renderMoreGroup(ctx: ShellCtx): import("../core/h").El;
25
+ export declare function applyToolbarOverflow(scope: ParentNode): {
26
+ movedIds: string[];
27
+ overflowRemains: boolean;
28
+ };
@@ -0,0 +1,8 @@
1
+ /*!
2
+ * @worm-vue3-print/common v1.3.7-beta.0
3
+ * Copyright (c) 2026 worm <liu_long_qqcom@qq.com>
4
+ * SPDX-FileCopyrightText: 2026 worm <liu_long_qqcom@qq.com>
5
+ * SPDX-License-Identifier: MIT
6
+ */
7
+ import type { ShellCtx } from './controls';
8
+ export declare function renderToolbar(ctx: ShellCtx, formatSection: unknown): import("../core/h").El;
@@ -0,0 +1,10 @@
1
+ /*!
2
+ * @worm-vue3-print/common v1.3.7-beta.0
3
+ * Copyright (c) 2026 worm <liu_long_qqcom@qq.com>
4
+ * SPDX-FileCopyrightText: 2026 worm <liu_long_qqcom@qq.com>
5
+ * SPDX-License-Identifier: MIT
6
+ */
7
+ import type { ShellCtx } from './controls';
8
+ /** 与 canvas 的 isExpressionText 同判定:花括号 / 函数调用 / 字段路径视为表达式 */
9
+ export declare function isExpressionText(text: string): boolean;
10
+ export declare function watermarkSection(ctx: ShellCtx): import("../core/h").El;
package/package.json CHANGED
@@ -1,6 +1,59 @@
1
1
  {
2
2
  "name": "@worm-vue3-print/common",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "1.3.7-beta.0",
4
+ "type": "module",
5
+ "description": "【预览版 · 实验性,不建议用于生产】打印模板设计器的通用宿主适配包:任意框架或无框架宿主均可直接接入(实现为零框架原生 Custom Elements + Shadow DOM),零 Vue/React 依赖,直接消费 @worm-vue3-print/core;Vue 3 项目请使用 @worm-vue3-print/canvas",
6
+ "main": "./dist/index.cjs",
7
+ "module": "./dist/index.js",
8
+ "types": "./dist/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "types": "./dist/index.d.ts",
12
+ "import": "./dist/index.js",
13
+ "require": "./dist/index.cjs"
14
+ },
15
+ "./browser": {
16
+ "types": "./dist/browser-bundle.d.ts",
17
+ "default": "./dist/common.js"
18
+ },
19
+ "./style.css": "./dist/common.css"
20
+ },
21
+ "files": [
22
+ "dist"
23
+ ],
24
+ "license": "MIT",
25
+ "author": "worm <liu_long_qqcom@qq.com>",
26
+ "repository": {
27
+ "type": "git",
28
+ "url": "git+https://gitee.com/liulong_oschina/worm-vue3-print.git"
29
+ },
30
+ "readme": "README.md",
31
+ "keywords": [
32
+ "print",
33
+ "template",
34
+ "designer",
35
+ "web-components",
36
+ "custom-elements",
37
+ "framework-agnostic"
38
+ ],
39
+ "scripts": {
40
+ "styles": "node scripts/gen-styles.mjs && node scripts/gen-icons.mjs",
41
+ "build": "npm run styles && vite build && vite build -c vite.bundle.config.ts && tsc -p tsconfig.build.json && node ../../scripts/inject-license-banner.mjs dist",
42
+ "dev": "npm run styles && vite build --watch",
43
+ "typecheck": "npm run styles && tsc -p tsconfig.json --noEmit",
44
+ "test": "npm run styles && vitest run"
45
+ },
46
+ "dependencies": {
47
+ "@worm-vue3-print/core": "^1.3.7",
48
+ "dompurify": "^3.4.12",
49
+ "jsbarcode": "^3.12.3",
50
+ "qrcode": "^1.5.4"
51
+ },
52
+ "devDependencies": {
53
+ "@types/qrcode": "^1.5.6",
54
+ "happy-dom": "^20.10.6",
55
+ "typescript": "~5.9.3",
56
+ "vite": "^7.3.6",
57
+ "vitest": "^1.6.0"
58
+ }
59
+ }