@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,182 @@
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 { UploadDesignBackgroundFn, UploadImageFn } from '@worm-vue3-print/core/designer';
8
+ import type { PrintFontDeclaration } from '@worm-vue3-print/core';
9
+ export declare class PrintDesignerElement extends HTMLElement {
10
+ private root;
11
+ private store;
12
+ private format;
13
+ private unsub;
14
+ private state;
15
+ private geom;
16
+ /** 接管全局快捷键的实例(同页多设计器时最后一个交互者),见 bindKeys */
17
+ private static active;
18
+ private docKeydown;
19
+ private ro;
20
+ private roArea;
21
+ /** 工具栏收纳的尺寸驱动源:容器宽度变化不触发重绘,需观察器重跑后置遍 */
22
+ private toolbarRo;
23
+ private scrollPos;
24
+ private marquee;
25
+ private menu;
26
+ private guidePreview;
27
+ private zoneResizing;
28
+ /** 表格右键菜单状态:由 shell/table.ts 读写,每帧随 renderTableContextMenu 一起出图 */
29
+ private tableMenu;
30
+ private exprTarget;
31
+ private exprMountedFor;
32
+ /** 帮助弹窗:canvas 的 helpVisible(showHelp 为 false 时强制收起,见 set showHelp) */
33
+ private helpVisible;
34
+ private unmountHelp;
35
+ private drag;
36
+ private snapTimer;
37
+ /** 页签 tooltip:挂在 shadow root 上的浮层(canvas 的 .page-tabs-tip 等价物) */
38
+ private pageTipEl;
39
+ private pageTipTimer;
40
+ private resize;
41
+ private raf;
42
+ private lastSelKey;
43
+ private chromeKey;
44
+ /** 宿主注入:图片上传,返回可访问 URL 或 data URL(对应 canvas 的 UPLOAD_IMAGE_KEY) */
45
+ uploadImage?: UploadImageFn;
46
+ /** 宿主注入:设计背景图上传,返回可直接 <img src> 的完整路径(对应 canvas 的 UPLOAD_DESIGN_BACKGROUND_KEY) */
47
+ uploadDesignBackground?: UploadDesignBackgroundFn;
48
+ /** 模板级字体声明(对应 canvas 的 fonts prop):注入 @font-face、列出字体候选、随保存/导出写回模板 */
49
+ private _fonts?;
50
+ set fonts(v: readonly PrintFontDeclaration[] | undefined);
51
+ get fonts(): readonly PrintFontDeclaration[] | undefined;
52
+ /** 字体声明的 @font-face 样式节点(挂在 shadow root 内,设计期所见即出图所得) */
53
+ private fontFaceStyle;
54
+ private docFontFaceStyle;
55
+ constructor();
56
+ set template(v: unknown);
57
+ get template(): unknown;
58
+ set fields(v: unknown);
59
+ set isEdit(v: boolean);
60
+ /** canvas 口径:showHelp 控制「帮助入口 + 弹窗」,关闭时强制收起已打开的弹窗 */
61
+ set showHelp(v: boolean);
62
+ static get observedAttributes(): string[];
63
+ attributeChangedCallback(name: string, _old: string | null, value: string | null): void;
64
+ connectedCallback(): void;
65
+ /** 面板折叠态:与 canvas 的 useStudioChrome 共用 localStorage 键,同一浏览器里两边偏好互通 */
66
+ private readChrome;
67
+ private persistChrome;
68
+ disconnectedCallback(): void;
69
+ /**
70
+ * 注入 @font-face:既进 shadow root(画布文档内),也进宿主文档 head。
71
+ * 原因:`@font-face` 只在文档作用域参与字体加载,shadow 内单独声明不会触发下载,
72
+ * 只挂 shadow 会出现「computed font-family 正确但字形回落」。canvas 本身就注到 document。
73
+ */
74
+ private applyFontFace;
75
+ /** 与 canvas 的 templateJsonWithFonts 同口径:宿主字体声明随保存/导出一起出图 */
76
+ private templateJsonWithFonts;
77
+ getTemplateJson(): string;
78
+ loadTemplate(input: unknown): void;
79
+ save(): void;
80
+ /** 拼版配置校验:getTemplateJson 是旁路,宿主导出/另存时需自行调用拦截 */
81
+ validateTemplate(): import("@worm-vue3-print/core").TilingIssue[];
82
+ private applyTemplate;
83
+ private openExpression;
84
+ private closeExpression;
85
+ private syncExpression;
86
+ private openHelp;
87
+ private closeHelp;
88
+ private syncHelp;
89
+ /** 回写:targetPath 为 options.<字段>(含 tableRows[r].cells[c] 下标形)/ watermark.content */
90
+ private applyExpression;
91
+ /** 画布双击元素:与 canvas 的 DBL_EDITABLE_FIELD 白名单一致,锁定元素只选中不弹框 */
92
+ private dblEditElement;
93
+ /** 表格单元格双击:定位合并主格后编辑其 formatter(对照 canvas 的 onDblClickCell) */
94
+ private dblEditCell;
95
+ private get ctx();
96
+ private canvasUi;
97
+ private repaint;
98
+ private paint;
99
+ /**
100
+ * 自动缩小实测遍:与 canvas 的 useShrinkFit 同一算法(core/browser fitTextNode),
101
+ * 让「设计态看到的字号」等于「出纸字号」。覆盖元素级与表格单元格级两类探针节点。
102
+ */
103
+ private applyShrinkFit;
104
+ private measureRuler;
105
+ /**
106
+ * 画布区尺寸变化(宿主改宽、面板折叠、窗口缩放、字体到位后重排)后重画标尺。
107
+ * 对应 canvas 的 ResizeObserver(measureRuler):整体重绘会换掉节点,故按当前节点重新挂载。
108
+ */
109
+ private observeCanvasArea;
110
+ private syncRulers;
111
+ /** 拖拽过程中只重写受影响元素的几何,避免全量重渲染打断输入态 */
112
+ private patchElementDom;
113
+ private fire;
114
+ private onDrop;
115
+ /** 纸面 mm 落点(对应 canvas 的 toPaperPoint):不取整,越出纸张左上角即视为无效 */
116
+ private pointToPaperMm;
117
+ private onCanvasMouseDown;
118
+ private onCanvasMouseMove;
119
+ private clearCoord;
120
+ private onContextMenu;
121
+ private onElementContextMenu;
122
+ private openMenu;
123
+ private startMarquee;
124
+ /**
125
+ * 双击判定:同一目标两次左键 mousedown,间隔 <500ms 且位移 ≤6px 即视为一次双击。
126
+ * 不能用原生 dblclick:paint 是 clear(shell) 全量重建,第一击选中元素后旧节点即被替换,
127
+ * 第二击落在新节点上时 Chrome 不再派发 dblclick(实测 30ms 间隔亦为空);
128
+ * canvas 侧 Vue 原地 patch 节点不换,才没有这个问题。
129
+ */
130
+ private taps;
131
+ private isDoubleTap;
132
+ private beginDrag;
133
+ /** 把 `.drag-ghost` 与 `.drag-preview` 同步到当前拖拽态(拖拽中不做整体重绘,定点改 DOM) */
134
+ private syncDragGhost;
135
+ /**
136
+ * Alt+拖拽落点生成副本(对应 canvas BaseElement.onDragEnd 的 alt 分支 + onCloneElement):
137
+ * 原元素留在原位、副本继承其全部样式但剥离组身份,选中落在副本、记一条历史。
138
+ */
139
+ private finishAltClone;
140
+ /** 吸附闪烁点(对应 canvas CanvasPaper.showSnapIndicator:300ms 后自动消失,重复吸附则重启动画) */
141
+ private flashSnapIndicator;
142
+ private beginResize;
143
+ private beginZoneResize;
144
+ private beginGuideDrag;
145
+ private beginRulerGuide;
146
+ /**
147
+ * 标尺拖出参考线时的 mm 换算。canvas 是 `(clientX - rulerRect.left - originPx) / pxPerMM`,
148
+ * 而 originPx = paperRect.left - areaRect.left - 尺宽、rulerRect.left = areaRect.left + 尺宽,
149
+ * 两项相消后等价于「相对纸张本体的像素距离 / pxPerMM」——这里直接用后一形式,
150
+ * 早期实现漏掉尺宽与滚动量,同一屏幕点会算出与 canvas 不同的 mm(成对拖拽对拍揭穿)。
151
+ */
152
+ private rulerPointToMM;
153
+ /**
154
+ * 统一缩放入口(对应 canvas CanvasArea.applyZoom):以容器内锚点为不动点,
155
+ * 缩放后校正滚动位置,保证锚点下的内容不漂移。
156
+ * 容器存在非对称 padding(44/28/32/44),锚点换算必须扣除,否则每次漂移 pad*(ratio-1)。
157
+ */
158
+ private applyZoom;
159
+ /** 工具栏放大/缩小:与滚轮同一乘性步进,以视口几何中心为锚点 */
160
+ private zoomByStep;
161
+ /** 适应窗口(对应 canvas PrintDesigner.onFitWindow + CanvasArea.fitToWindow) */
162
+ private fitToWindow;
163
+ private onWheel;
164
+ private onScroll;
165
+ private bindPointer;
166
+ private showPageTip;
167
+ private hidePageTip;
168
+ private manualGuides;
169
+ /** 仅重绘吸附引导线,避免拖拽中全量重建 DOM */
170
+ private paintGuidesOnly;
171
+ private bindKeys;
172
+ /** document 级快捷键监听:随挂载/卸载成对增删(重连场景 store 已存在,bindKeys 不再执行) */
173
+ private attachDocKeys;
174
+ private detachDocKeys;
175
+ private onGlobalKeydown;
176
+ }
177
+ declare global {
178
+ interface HTMLElementTagNameMap {
179
+ 'print-designer': PrintDesignerElement;
180
+ }
181
+ }
182
+ export declare function definePrintDesigner(tag?: string): string;
@@ -0,0 +1,21 @@
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 { BindingDescriptor, RuntimeElement } from '@worm-vue3-print/core/designer';
8
+ import type { ShellCtx } from './controls';
9
+ import type { DesignerStore } from '../core/store';
10
+ /**
11
+ * 统一解析带点分段与数组下标的 targetPath 为段/索引混排数组(与 canvas 的 parsePath 同实现)
12
+ * 例:'options.formatter' → ['options','formatter']
13
+ * 例:'options.tableRows[0].cells[1].formatter' → ['options','tableRows',0,'cells',1,'formatter']
14
+ */
15
+ export declare function parseBindingPath(targetPath: string): (string | number)[];
16
+ export declare function readBindingValue(element: RuntimeElement, targetPath: string): string;
17
+ /** 写回:canvas 的 setBindingValue 是「先赋值、后 recordHistory」,此处保持同序 */
18
+ export declare function writeBindingValue(store: DesignerStore, element: RuntimeElement, targetPath: string, value: string): void;
19
+ /** 当前应渲染的绑定项:表格有选区时只出选中单元格,否则按注册表(与 canvas 同口径) */
20
+ export declare function bindingDescriptorsFor(ctx: ShellCtx, el: RuntimeElement): BindingDescriptor[];
21
+ export declare function bindingGroup(ctx: ShellCtx, el: RuntimeElement): import("../core/h").El;
@@ -0,0 +1,59 @@
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 { TemplateData } from '@worm-vue3-print/core/designer';
8
+ import type { ShellCtx } from './controls';
9
+ import type { RulerGeom } from './ruler';
10
+ export interface CanvasUI {
11
+ geom: RulerGeom;
12
+ marquee: {
13
+ visible: boolean;
14
+ x: number;
15
+ y: number;
16
+ w: number;
17
+ h: number;
18
+ };
19
+ contextMenu: {
20
+ visible: boolean;
21
+ x: number;
22
+ y: number;
23
+ flipX: number;
24
+ flipY: number;
25
+ targetId: string | null;
26
+ };
27
+ guidePreview: {
28
+ type: 'vertical' | 'horizontal';
29
+ position: number;
30
+ } | null;
31
+ zoneResizing: 'header' | 'footer' | null;
32
+ scrollX: number;
33
+ scrollY: number;
34
+ }
35
+ /** 三区矩形(mm,纸面坐标系):上边距→页眉→内容→页脚→下边距(同 CanvasPaper.zoneRectsMM) */
36
+ export declare function zoneRectsMM(t: TemplateData, paper: {
37
+ width: number;
38
+ height: number;
39
+ }): {
40
+ header: {
41
+ left: number;
42
+ top: number;
43
+ width: number;
44
+ height: number;
45
+ };
46
+ content: {
47
+ left: number;
48
+ top: number;
49
+ width: number;
50
+ height: number;
51
+ };
52
+ footer: {
53
+ left: number;
54
+ top: number;
55
+ width: number;
56
+ height: number;
57
+ };
58
+ };
59
+ export declare function renderCanvasArea(ctx: ShellCtx, ui: CanvasUI): import("../core/h").El;
@@ -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 { RuntimeElement } from '@worm-vue3-print/core/designer';
8
+ export declare function renderQrcode(el: RuntimeElement): import("../core/h").El;
9
+ export declare function renderBarcode(el: RuntimeElement): import("../core/h").El;
10
+ /** DOM 落位后绘制所有码类元素 */
11
+ export declare function hydrateCodes(root: ShadowRoot, elements: RuntimeElement[]): void;
@@ -0,0 +1,44 @@
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
+ export interface ColorPickerOptions {
9
+ /** 当前色值;空串/undefined 均视为「未设置」 */
10
+ value?: string;
11
+ /** 是否允许清除(canvas 边框等必填场景传 false),默认 true */
12
+ clearable?: boolean;
13
+ /** 触发按钮 title(canvas 侧为色值或「自动」,本包保留调用方传入的字段名语义) */
14
+ title?: string;
15
+ /** 追加在触发钮上的类名(canvas 给组件根挂的 class 会与其自身类名合并,如 `page-bg-picker`) */
16
+ triggerClass?: string;
17
+ /** 选中回调;undefined 表示清除(canvas emit '' 的等价归一) */
18
+ onChange: (value: string | undefined) => void;
19
+ }
20
+ export declare function parseHex(color: string): {
21
+ r: number;
22
+ g: number;
23
+ b: number;
24
+ } | null;
25
+ export declare function normalizeHex(color: string): string;
26
+ export declare function rgbToHex({ r, g, b }: {
27
+ r: number;
28
+ g: number;
29
+ b: number;
30
+ }): string;
31
+ export declare function rgbToHsv(r: number, g: number, b: number): {
32
+ h: number;
33
+ s: number;
34
+ v: number;
35
+ };
36
+ export declare function hsvToRgb(h_: number, s: number, v: number): {
37
+ r: number;
38
+ g: number;
39
+ b: number;
40
+ };
41
+ /** 触发按钮(对应 canvas 的 button.preset-color-trigger);点击在挂载根上开/关面板 */
42
+ export declare function colorPicker(opts: ColorPickerOptions): El;
43
+ /** 关闭当前打开的面板并解除全部监听(宿主 disconnectedCallback 亦可用) */
44
+ export declare function closeColorPicker(): void;
@@ -0,0 +1,101 @@
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 { PrintFontDeclaration } from '@worm-vue3-print/core';
8
+ import type { DesignerStore } from '../core/store';
9
+ /** 外壳局部 UI 状态(不落模板数据,仅影响渲染) */
10
+ export interface ShellState {
11
+ leftTab: 'elements' | 'fields' | 'layers';
12
+ leftCollapsed: boolean;
13
+ propTab: 'element' | 'page';
14
+ propCollapsed: boolean;
15
+ /** 打开的下拉面板 id(同一时刻只允许一个) */
16
+ openDd: string | null;
17
+ /**
18
+ * 「更多」收纳面板的开关。与 openDd 分持:面板内还嵌着对齐/边框等下拉,
19
+ * 共用一个开关键会让内层下拉一打开就把外层「更多」顶掉(canvas 是每个实例独立 open)。
20
+ */
21
+ openMore?: boolean;
22
+ /** 字段搜索关键字(仅影响左栏字段树) */
23
+ fieldSearch?: string;
24
+ /** 折叠的字段分组 key */
25
+ collapsedGroups: Set<string>;
26
+ /** 正在行内重命名的页面下标 */
27
+ renamingPage: number | null;
28
+ renameText?: string;
29
+ /** 属性台搜索关键字(门控分组与字段,对应 canvas PropertyPanel 的 searchText) */
30
+ propSearch?: string;
31
+ /** 展开中的字体下拉:整体重绘模型下必须外置,否则 repaint() 会让候选列表闪断 */
32
+ fontOpen?: {
33
+ id: string;
34
+ query: string;
35
+ highlighted: number;
36
+ } | null;
37
+ }
38
+ /** 外壳渲染上下文:工具栏动作以 fire(name, arg) 上报,由自定义元素分发 */
39
+ export interface ShellCtx {
40
+ store: DesignerStore;
41
+ /** 格式栏语义内核(shell/format-bar.ts 需要;由自定义元素注入) */
42
+ format: import('../core/format').FormatToolbar;
43
+ state: ShellState;
44
+ repaint: () => void;
45
+ fire: (action: string, arg?: unknown) => void;
46
+ /** 宿主能力开关 */
47
+ showHelp: boolean;
48
+ isEdit: boolean;
49
+ /** 宿主注入能力(图片上传、设计背景上传、字体清单),未注入时相关入口置灰 */
50
+ host: {
51
+ uploadImage?: (file: File) => Promise<string>;
52
+ uploadDesignBackground?: (file: File) => Promise<string>;
53
+ fonts?: readonly (string | PrintFontDeclaration)[];
54
+ };
55
+ }
56
+ /** 带图标的工具栏按钮(对应 canvas 的 .tb-btn.tb-icon) */
57
+ export declare function tbIconBtn(ctx: ShellCtx, iconName: string, action: string, opts: {
58
+ tip: string;
59
+ disabled?: boolean;
60
+ on?: boolean;
61
+ danger?: boolean;
62
+ arg?: unknown;
63
+ test?: string;
64
+ }): import("../core/h").El;
65
+ /** 下拉壳:触发钮 + 面板,面板内容由调用方给出(对应 canvas 的 ToolbarDropdown) */
66
+ export declare function dropdown(ctx: ShellCtx, id: string, opts: {
67
+ tip: string;
68
+ icon?: string;
69
+ text?: string;
70
+ textClass?: string;
71
+ disabled?: boolean;
72
+ testId?: string;
73
+ panelClass?: string;
74
+ }, panel: unknown[]): import("../core/h").El;
75
+ /** 步进数字输入(对应 canvas 的 property/StepperInput) */
76
+ export declare function stepper(opts: {
77
+ value?: number;
78
+ min?: number;
79
+ max?: number;
80
+ step?: number;
81
+ placeholder?: string;
82
+ disabled?: boolean;
83
+ onCommit: (v: number) => void;
84
+ }): import("../core/h").El;
85
+ /** 属性行:pd-field > pd-label + 控件 */
86
+ export declare function field(label: string, control: unknown, hint?: string): import("../core/h").El;
87
+ /** 字段说明图标:说明不常驻行内,悬浮或点击聚焦时才浮出(对应 canvas 的 button.pd-help) */
88
+ export declare const labelHelp: (tip: string) => import("../core/h").El;
89
+ /** 带说明图标的属性行:与 field() 同结构,差别只在说明挂图标而非常驻 .pd-hint 段落 */
90
+ export declare function fieldHelp(label: string, control: unknown, tip: string): import("../core/h").El;
91
+ /** 分节标题(对应 canvas 的 h3.pd-divider) */
92
+ export declare const divider: (text: string) => import("../core/h").El;
93
+ /** 颜色触发钮:预设色板面板(移植 canvas 的 PresetColorPicker.vue,面板实现见 shell/color-picker.ts)。
94
+ * onPick 收到的 undefined 表示「清除颜色」:canvas 侧 emit '' 后由消费方归一化为未设置,
95
+ * 本包在触发器层直接归一后透传,调用方 patch 即删除该颜色属性(签名保持 (v: string) 不变)。 */
96
+ export declare function colorTrigger(value: string | undefined, onPick: (v: string) => void, title?: string, triggerClass?: string): import("../core/h").El;
97
+ /** 单选组(对应 canvas 的 .pd-radio-group) */
98
+ export declare function radioGroup(name: string, options: {
99
+ value: string;
100
+ label: string;
101
+ }[], current: string, onChange: (v: string) => void, twoCol?: boolean): import("../core/h").El;
@@ -0,0 +1,27 @@
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 { mmToPx } from '@worm-vue3-print/core/designer';
8
+ import type { RuntimeElement } from '@worm-vue3-print/core/designer';
9
+ import type { ShellCtx } from './controls';
10
+ /** 元素几何与边框(对齐 BaseElement.elementStyle) */
11
+ export declare function elementStyle(el: RuntimeElement): Record<string, string>;
12
+ /** 文本与长文本共用的行内样式:与 canvas 的 TextElement / LongTextElement 逐项一致(差异按类型分支) */
13
+ export declare function textLikeStyle(el: RuntimeElement): {
14
+ style: Record<string, string>;
15
+ fit: import("@worm-vue3-print/core").TextFit;
16
+ };
17
+ export declare function imageStyle(el: RuntimeElement): Record<string, string>;
18
+ /** 选中角标文本:与 canvas BaseElement 的 posLabel 逐字一致(四舍五入到整数 mm) */
19
+ export declare function positionLabel(o: {
20
+ left: number;
21
+ top: number;
22
+ width: number;
23
+ height: number;
24
+ }): string;
25
+ export declare function renderDesignElement(ctx: ShellCtx, el: RuntimeElement): import("../core/h").El;
26
+ /** mm → px(供画布几何换算复用同一口径) */
27
+ export { mmToPx };
@@ -0,0 +1,33 @@
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 { PrintBusinessField } from '@worm-vue3-print/core/designer';
8
+ import type { El } from '../core/h';
9
+ export interface ExpressionEditorTarget {
10
+ /** 元素 id(表格单元格时用于定位) */
11
+ elementId: string;
12
+ /** 要写回的目标路径,如 'options.formatter' 或 'cell:<rowId>:<colIndex>' */
13
+ targetPath: string;
14
+ /** 当前表达式文本 */
15
+ value: string;
16
+ /** 可选:字段绑定模式的初始字段 key */
17
+ binding?: string;
18
+ }
19
+ export interface ExpressionEditorOptions {
20
+ fields: PrintBusinessField[];
21
+ /** 求值预览用的样例行数据 */
22
+ demoData?: Record<string, any>;
23
+ /** 关闭弹窗 */
24
+ onClose: () => void;
25
+ /** 点确定:把最终表达式回写 */
26
+ onApply: (next: {
27
+ formatter?: string;
28
+ binding?: string;
29
+ title?: string;
30
+ }) => void;
31
+ }
32
+ /** 渲染表达式编辑器弹窗的 DOM 描述(内部已含遮罩层,render 进 shadow 根下即可) */
33
+ export declare function renderExpressionEditor(opts: ExpressionEditorOptions, target: ExpressionEditorTarget): El;
@@ -0,0 +1,24 @@
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 { FontOption } from '../core/font-catalog';
8
+ import type { ShellState } from './controls';
9
+ export interface FontSelectOptions {
10
+ /** 实例标识:同一时刻只允许一个字体下拉处于展开态 */
11
+ id: string;
12
+ /** 外壳状态:展开态落在这里,跨重绘保持 */
13
+ state: ShellState;
14
+ /** 宿主注入的字体清单(字符串或字体声明均可) */
15
+ fonts?: readonly (string | FontOption)[];
16
+ /** 当前族名;undefined 表示未设置,走全局兜底字体栈 */
17
+ value?: string;
18
+ /** 空值行文案(同时用作输入框 placeholder) */
19
+ placeholder?: string;
20
+ /** 禁用(如格式工具栏无可用目标时置灰) */
21
+ disabled?: boolean;
22
+ onChange: (value: string | undefined) => void;
23
+ }
24
+ export declare function renderFontSelect(opts: FontSelectOptions): HTMLElement;
@@ -0,0 +1,15 @@
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 { field } from './controls';
8
+ import type { ShellCtx } from './controls';
9
+ import type { FormatToolbar } from '../core/format';
10
+ type FormatCtx = ShellCtx & {
11
+ format: FormatToolbar;
12
+ };
13
+ export declare function renderFormatBar(ctx: FormatCtx): import("../core/h").El;
14
+ /** 供状态栏/属性面板复用的排版行(保持与 canvas 同类名) */
15
+ export { field as formatField };
@@ -0,0 +1,12 @@
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
+ declare const _default: {
8
+ id: string;
9
+ title: string;
10
+ content: string;
11
+ };
12
+ export default _default;
@@ -0,0 +1,12 @@
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
+ declare const _default: {
8
+ id: string;
9
+ title: string;
10
+ content: string;
11
+ };
12
+ export default _default;
@@ -0,0 +1,12 @@
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
+ declare const _default: {
8
+ id: string;
9
+ title: string;
10
+ content: string;
11
+ };
12
+ export default _default;
@@ -0,0 +1,12 @@
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
+ declare const _default: {
8
+ id: string;
9
+ title: string;
10
+ content: string;
11
+ };
12
+ export default _default;
@@ -0,0 +1,13 @@
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
+ export type HelpSection = {
8
+ id: string;
9
+ title: string;
10
+ content: string;
11
+ };
12
+ export declare const helpSections: HelpSection[];
13
+ export type { HelpSection as default };
@@ -0,0 +1,12 @@
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
+ declare const _default: {
8
+ id: string;
9
+ title: string;
10
+ content: string;
11
+ };
12
+ export default _default;
@@ -0,0 +1,19 @@
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
+ export interface HelpModalOptions {
9
+ /** 首次打开的页签(canvas 的 initialTab,默认「快速入门」) */
10
+ initialTab?: string;
11
+ onClose: () => void;
12
+ }
13
+ /** 渲染帮助弹窗(调用方负责挂到 shadow root 上) */
14
+ export declare function renderHelpModal(opts: HelpModalOptions): El;
15
+ /**
16
+ * 挂载弹窗并返回卸载函数。Esc 监听挂在 document(与 canvas 一致:焦点不在遮罩内也能关),
17
+ * 卸载时一并摘除,不留常驻监听。
18
+ */
19
+ export declare function mountHelpModal(parent: Element | ShadowRoot, opts: HelpModalOptions): () => void;
@@ -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
+ export declare function designBackgroundSection(ctx: ShellCtx): import("../core/h").El;
9
+ /** 拼版打印:开关 + 目标纸 + 留白 + 间距列数 + 校验与摘要 */
10
+ export declare function tilingSection(ctx: ShellCtx): import("../core/h").El;
@@ -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 { ElementType } from '@worm-vue3-print/core/designer';
8
+ import type { ShellCtx } from './controls';
9
+ /** 元素库:与 canvas LeftPanel.elementTypes 同序、同图标字符 */
10
+ export declare const ELEMENT_TYPES: {
11
+ type: ElementType;
12
+ label: string;
13
+ icon: string;
14
+ }[];
15
+ export declare function renderLeftPanel(ctx: ShellCtx): import("../core/h").El;
16
+ export declare function renderPageTabs(ctx: ShellCtx): import("../core/h").El;
17
+ export declare function renderStatusBar(ctx: ShellCtx): import("../core/h").El;