@worm-print-platform/canvas 1.5.2 → 1.6.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.
- package/README.md +26 -4
- package/dist/browser-bundle.d.ts +1 -1
- package/dist/canvas.css +2 -2
- package/dist/canvas.js +111 -64
- package/dist/core/default-template.d.ts +1 -1
- package/dist/core/element-definitions.d.ts +1 -1
- package/dist/core/format.d.ts +1 -1
- package/dist/core/h.d.ts +3 -17
- package/dist/core/icons.d.ts +1 -1
- package/dist/core/plugin.d.ts +1 -1
- package/dist/core/store.d.ts +1 -1
- package/dist/host-contract.d.ts +25 -7
- package/dist/index.cjs +57 -10
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1906 -1667
- package/dist/print-designer.d.ts +31 -4
- package/dist/shell/binding.d.ts +2 -2
- package/dist/shell/canvas.d.ts +2 -2
- package/dist/shell/code.d.ts +3 -3
- package/dist/shell/color-picker.d.ts +3 -39
- package/dist/shell/controls.d.ts +14 -11
- package/dist/shell/crop-anchor.d.ts +2 -2
- package/dist/shell/elements.d.ts +2 -2
- package/dist/shell/expression-editor.d.ts +3 -28
- package/dist/shell/flow-list.d.ts +2 -2
- package/dist/shell/font-select.d.ts +1 -1
- package/dist/shell/format-bar.d.ts +2 -2
- package/dist/shell/help-content/advanced-settings.d.ts +1 -1
- package/dist/shell/help-content/changelog.d.ts +1 -1
- package/dist/shell/help-content/faq.d.ts +1 -1
- package/dist/shell/help-content/features.d.ts +1 -1
- package/dist/shell/help-content/getting-started.d.ts +1 -1
- package/dist/shell/help-content/index.d.ts +1 -1
- package/dist/shell/help-content/shortcuts.d.ts +1 -1
- package/dist/shell/help-modal.d.ts +1 -1
- package/dist/shell/page-extras.d.ts +1 -1
- package/dist/shell/panels.d.ts +4 -4
- package/dist/shell/plugin-ui.d.ts +1 -1
- package/dist/shell/prop-group.d.ts +1 -1
- package/dist/shell/property-panel.d.ts +1 -1
- package/dist/shell/property-search.d.ts +1 -1
- package/dist/shell/ruler.d.ts +1 -1
- package/dist/shell/table-props.d.ts +1 -1
- package/dist/shell/table.d.ts +1 -1
- package/dist/shell/toolbar-overflow.d.ts +2 -2
- package/dist/shell/toolbar.d.ts +2 -2
- package/dist/shell/watermark.d.ts +1 -1
- package/dist/theme-tokens.d.ts +21 -0
- package/dist/version.d.ts +8 -0
- package/dist/vue3/PrintDesigner.d.ts +24 -1
- package/dist/vue3/PrintHtmlPreview.d.ts +1 -1
- package/dist/vue3/index.cjs +2 -2
- package/dist/vue3/index.d.ts +1 -1
- package/dist/vue3/index.js +70 -60
- package/dist/vue3/previewStyle.d.ts +1 -1
- package/dist/vue3/toolbarOverflow.d.ts +1 -1
- package/package.json +4 -4
package/dist/print-designer.d.ts
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @worm-print-platform/canvas v1.
|
|
2
|
+
* @worm-print-platform/canvas v1.6.0
|
|
3
3
|
* Copyright (c) 2026 worm <liu_long_qqcom@qq.com>
|
|
4
4
|
* SPDX-FileCopyrightText: 2026 worm <liu_long_qqcom@qq.com>
|
|
5
5
|
* SPDX-License-Identifier: MIT
|
|
6
6
|
*/
|
|
7
7
|
import type { UploadDesignBackgroundFn, UploadImageFn } from '@worm-print-platform/core/designer';
|
|
8
8
|
import type { PrintFontDeclaration } from '@worm-print-platform/core';
|
|
9
|
-
import type { PrintDesignerHostContract } from './host-contract';
|
|
9
|
+
import type { PrintDesignerHostContract, PrintDesignerThemeConfig, PrintDesignerThemeMode } from './host-contract';
|
|
10
|
+
import type { FieldDisplayMode } from './shell/expression-editor';
|
|
10
11
|
/**
|
|
11
12
|
* 插件 UI 的设计态示例数据统一成「数组信封」(data[0] 即数据根对象)。
|
|
12
13
|
* 宿主可传单个业务对象、对象数组或 JSON 字符串;非法/缺省值返回 undefined,
|
|
@@ -62,6 +63,14 @@ export declare class PrintDesignerElement extends HTMLElement {
|
|
|
62
63
|
private raf;
|
|
63
64
|
private lastSelKey;
|
|
64
65
|
private chromeKey;
|
|
66
|
+
/** 主题:预设 + 参数覆盖。参数 > 显式预设 > 系统偏好 > CSS 令牌 */
|
|
67
|
+
private _theme;
|
|
68
|
+
private _themeConfig?;
|
|
69
|
+
private systemDark;
|
|
70
|
+
private themeMedia;
|
|
71
|
+
private readonly onThemeMediaChange;
|
|
72
|
+
/** applyTheme 写入的行内变量键:精确清理,不碰宿主/插件写的其他行内样式 */
|
|
73
|
+
private appliedThemeTokens;
|
|
65
74
|
/** 宿主注入:图片上传,返回可访问 URL 或 data URL(对应 Vue 3 轨 的 UPLOAD_IMAGE_KEY) */
|
|
66
75
|
uploadImage?: UploadImageFn;
|
|
67
76
|
/** 宿主注入:设计背景图上传,返回可直接 <img src> 的完整路径(对应 Vue 3 轨 的 UPLOAD_DESIGN_BACKGROUND_KEY) */
|
|
@@ -92,18 +101,36 @@ export declare class PrintDesignerElement extends HTMLElement {
|
|
|
92
101
|
set showPreview(v: boolean);
|
|
93
102
|
/** 工具栏「保存」按钮显隐;默认显示,隐藏只影响按钮出图,save() 与 save 事件不受影响 */
|
|
94
103
|
set showSave(v: boolean);
|
|
104
|
+
/** 字段行显示模式:label / key / both(默认 both);非法值静默回退 both */
|
|
105
|
+
set fieldDisplay(v: unknown);
|
|
106
|
+
get fieldDisplay(): FieldDisplayMode;
|
|
107
|
+
/** 主题预设:auto(默认)跟随系统 prefers-color-scheme,light/dark 强制 */
|
|
108
|
+
set theme(v: PrintDesignerThemeMode | undefined);
|
|
109
|
+
get theme(): PrintDesignerThemeMode;
|
|
110
|
+
/** 主题色值覆盖:传参优先于预设、系统与 CSS 令牌;只作用于外壳,画布纸张与元素不受影响 */
|
|
111
|
+
set themeConfig(v: PrintDesignerThemeConfig | string | undefined);
|
|
112
|
+
get themeConfig(): PrintDesignerThemeConfig | undefined;
|
|
95
113
|
/**
|
|
96
114
|
* 宿主契约版本(机器可读);宿主可在挂载前用 `PrintDesignerElement.contractVersion`
|
|
97
115
|
* 判断是否需要降级或提示升级,避免把版本号埋在文档里。
|
|
98
116
|
*/
|
|
99
|
-
static readonly contractVersion = "1.
|
|
117
|
+
static readonly contractVersion = "1.3.0";
|
|
100
118
|
/** 返回完整契约快照(attributes / properties / methods / 事件 / parts / 主题令牌) */
|
|
101
119
|
static getHostContract(): PrintDesignerHostContract;
|
|
102
120
|
/** 实例侧同款读取入口,便于 `document.querySelector('print-designer').getHostContract()` */
|
|
103
121
|
getHostContract(): PrintDesignerHostContract;
|
|
104
|
-
static get observedAttributes(): ("
|
|
122
|
+
static get observedAttributes(): ("fields" | "name" | "fonts" | "template" | "design-data" | "theme" | "theme-config" | "field-display")[];
|
|
105
123
|
attributeChangedCallback(name: string, _old: string | null, value: string | null): void;
|
|
106
124
|
connectedCallback(): void;
|
|
125
|
+
/** 仅 auto 模式需要监听系统深浅色;matchMedia 缺失的环境(部分测试宿主)保持浅色 */
|
|
126
|
+
private attachThemeMedia;
|
|
127
|
+
private detachThemeMedia;
|
|
128
|
+
/**
|
|
129
|
+
* 主题落到内部 .designer-container 的行内 CSS 变量:行内声明优先级高于
|
|
130
|
+
* Shadow DOM 内 `.designer-container{--pd-*:浅色}` 规则,是唯一切实生效的通道。
|
|
131
|
+
* paint() 只 clear(shell) 清子节点,容器常驻,写入的变量不会被重绘冲掉。
|
|
132
|
+
*/
|
|
133
|
+
private applyTheme;
|
|
107
134
|
/** 面板折叠态:与 Vue 3 轨的 useStudioChrome 共用 localStorage 键,同一浏览器里两边偏好互通 */
|
|
108
135
|
private readChrome;
|
|
109
136
|
private persistChrome;
|
package/dist/shell/binding.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @worm-print-platform/canvas v1.
|
|
2
|
+
* @worm-print-platform/canvas v1.6.0
|
|
3
3
|
* Copyright (c) 2026 worm <liu_long_qqcom@qq.com>
|
|
4
4
|
* SPDX-FileCopyrightText: 2026 worm <liu_long_qqcom@qq.com>
|
|
5
5
|
* SPDX-License-Identifier: MIT
|
|
@@ -18,4 +18,4 @@ export declare function readBindingValue(element: RuntimeElement, targetPath: st
|
|
|
18
18
|
export declare function writeBindingValue(store: DesignerStore, element: RuntimeElement, targetPath: string, value: string): void;
|
|
19
19
|
/** 当前应渲染的绑定项:表格有选区时只出选中单元格,否则按注册表(与 Vue 3 轨同口径) */
|
|
20
20
|
export declare function bindingDescriptorsFor(ctx: ShellCtx, el: RuntimeElement): BindingDescriptor[];
|
|
21
|
-
export declare function bindingGroup(ctx: ShellCtx, el: RuntimeElement): import("
|
|
21
|
+
export declare function bindingGroup(ctx: ShellCtx, el: RuntimeElement): import("@worm-print-platform/plugin-kit/dom").El;
|
package/dist/shell/canvas.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @worm-print-platform/canvas v1.
|
|
2
|
+
* @worm-print-platform/canvas v1.6.0
|
|
3
3
|
* Copyright (c) 2026 worm <liu_long_qqcom@qq.com>
|
|
4
4
|
* SPDX-FileCopyrightText: 2026 worm <liu_long_qqcom@qq.com>
|
|
5
5
|
* SPDX-License-Identifier: MIT
|
|
@@ -58,4 +58,4 @@ export declare function zoneRectsMM(t: TemplateData, paper: {
|
|
|
58
58
|
};
|
|
59
59
|
/** 清徽标与锁存意图(drop 与拖拽会话结束时各调一次) */
|
|
60
60
|
export declare function clearDropDrag(area: HTMLElement | null | undefined): void;
|
|
61
|
-
export declare function renderCanvasArea(ctx: ShellCtx, ui: CanvasUI): import("
|
|
61
|
+
export declare function renderCanvasArea(ctx: ShellCtx, ui: CanvasUI): import("@worm-print-platform/plugin-kit/dom").El;
|
package/dist/shell/code.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @worm-print-platform/canvas v1.
|
|
2
|
+
* @worm-print-platform/canvas v1.6.0
|
|
3
3
|
* Copyright (c) 2026 worm <liu_long_qqcom@qq.com>
|
|
4
4
|
* SPDX-FileCopyrightText: 2026 worm <liu_long_qqcom@qq.com>
|
|
5
5
|
* SPDX-License-Identifier: MIT
|
|
6
6
|
*/
|
|
7
7
|
import type { RuntimeElement } from '@worm-print-platform/core/designer';
|
|
8
|
-
export declare function renderQrcode(el: RuntimeElement): import("
|
|
9
|
-
export declare function renderBarcode(el: RuntimeElement): import("
|
|
8
|
+
export declare function renderQrcode(el: RuntimeElement): import("@worm-print-platform/plugin-kit/dom").El;
|
|
9
|
+
export declare function renderBarcode(el: RuntimeElement): import("@worm-print-platform/plugin-kit/dom").El;
|
|
10
10
|
/** DOM 落位后绘制所有码类元素;listSource 为宿主注入的设计态数据(画布文本、插件元素同源) */
|
|
11
11
|
export declare function hydrateCodes(root: ShadowRoot, elements: RuntimeElement[], listSource?: readonly Record<string, unknown>[]): void;
|
|
@@ -1,44 +1,8 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @worm-print-platform/canvas v1.
|
|
2
|
+
* @worm-print-platform/canvas v1.6.0
|
|
3
3
|
* Copyright (c) 2026 worm <liu_long_qqcom@qq.com>
|
|
4
4
|
* SPDX-FileCopyrightText: 2026 worm <liu_long_qqcom@qq.com>
|
|
5
5
|
* SPDX-License-Identifier: MIT
|
|
6
6
|
*/
|
|
7
|
-
|
|
8
|
-
export
|
|
9
|
-
/** 当前色值;空串/undefined 均视为「未设置」 */
|
|
10
|
-
value?: string;
|
|
11
|
-
/** 是否允许清除(Vue 3 轨 边框等必填场景传 false),默认 true */
|
|
12
|
-
clearable?: boolean;
|
|
13
|
-
/** 触发按钮 title(Vue 3 轨 侧为色值或「自动」,本包保留调用方传入的字段名语义) */
|
|
14
|
-
title?: string;
|
|
15
|
-
/** 追加在触发钮上的类名(Vue 3 轨 给组件根挂的 class 会与其自身类名合并,如 `page-bg-picker`) */
|
|
16
|
-
triggerClass?: string;
|
|
17
|
-
/** 选中回调;undefined 表示清除(Vue 3 轨 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
|
-
/** 触发按钮(对应 Vue 3 轨 的 button.preset-color-trigger);点击在挂载根上开/关面板 */
|
|
42
|
-
export declare function colorPicker(opts: ColorPickerOptions): El;
|
|
43
|
-
/** 关闭当前打开的面板并解除全部监听(宿主 disconnectedCallback 亦可用) */
|
|
44
|
-
export declare function closeColorPicker(): void;
|
|
7
|
+
export { parseHex, normalizeHex, rgbToHex, rgbToHsv, hsvToRgb, colorPicker, closeColorPicker, } from '@worm-print-platform/plugin-kit/controls';
|
|
8
|
+
export type { ColorPickerOptions } from '@worm-print-platform/plugin-kit/controls';
|
package/dist/shell/controls.d.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @worm-print-platform/canvas v1.
|
|
2
|
+
* @worm-print-platform/canvas v1.6.0
|
|
3
3
|
* Copyright (c) 2026 worm <liu_long_qqcom@qq.com>
|
|
4
4
|
* SPDX-FileCopyrightText: 2026 worm <liu_long_qqcom@qq.com>
|
|
5
5
|
* SPDX-License-Identifier: MIT
|
|
6
6
|
*/
|
|
7
7
|
import type { PrintFontDeclaration } from '@worm-print-platform/core';
|
|
8
8
|
import type { PrintBusinessField } from '@worm-print-platform/core/designer';
|
|
9
|
+
import type { FieldDisplayMode } from '@worm-print-platform/plugin-kit/expression-editor';
|
|
9
10
|
import type { DesignerStore } from '../core/store';
|
|
10
11
|
/** 外壳局部 UI 状态(不落模板数据,仅影响渲染) */
|
|
11
12
|
export interface ShellState {
|
|
@@ -23,6 +24,8 @@ export interface ShellState {
|
|
|
23
24
|
openMore?: boolean;
|
|
24
25
|
/** 字段搜索关键字(仅影响左栏字段树) */
|
|
25
26
|
fieldSearch?: string;
|
|
27
|
+
/** 宿主注入的字段行显示模式(field-display attribute / property),缺省 both */
|
|
28
|
+
fieldDisplay?: FieldDisplayMode;
|
|
26
29
|
/** 折叠的字段分组 key */
|
|
27
30
|
collapsedGroups: Set<string>;
|
|
28
31
|
/** 最近一次复制成功的字段 key:素材台行内「已复制」提示,1.2s 后清空重绘(对齐 canvas) */
|
|
@@ -73,7 +76,7 @@ export declare function tbIconBtn(ctx: ShellCtx, iconName: string, action: strin
|
|
|
73
76
|
danger?: boolean;
|
|
74
77
|
arg?: unknown;
|
|
75
78
|
test?: string;
|
|
76
|
-
}): import("
|
|
79
|
+
}): import("@worm-print-platform/plugin-kit/dom").El;
|
|
77
80
|
/** 下拉壳:触发钮 + 面板,面板内容由调用方给出(对应 Vue 3 轨 的 ToolbarDropdown) */
|
|
78
81
|
export declare function dropdown(ctx: ShellCtx, id: string, opts: {
|
|
79
82
|
tip: string;
|
|
@@ -83,7 +86,7 @@ export declare function dropdown(ctx: ShellCtx, id: string, opts: {
|
|
|
83
86
|
disabled?: boolean;
|
|
84
87
|
testId?: string;
|
|
85
88
|
panelClass?: string;
|
|
86
|
-
}, panel: unknown[]): import("
|
|
89
|
+
}, panel: unknown[]): import("@worm-print-platform/plugin-kit/dom").El;
|
|
87
90
|
/** 步进数字输入(对应 Vue 3 轨 的 property/StepperInput) */
|
|
88
91
|
export declare function stepper(opts: {
|
|
89
92
|
value?: number;
|
|
@@ -93,13 +96,13 @@ export declare function stepper(opts: {
|
|
|
93
96
|
placeholder?: string;
|
|
94
97
|
disabled?: boolean;
|
|
95
98
|
onCommit: (v: number) => void;
|
|
96
|
-
}): import("
|
|
99
|
+
}): import("@worm-print-platform/plugin-kit/dom").El;
|
|
97
100
|
/** 属性行:pd-field > pd-label(.pd-label-t + 恢复默认值) + 控件 */
|
|
98
|
-
export declare function field(label: string, control: unknown, hint?: string, reset?: unknown): import("
|
|
101
|
+
export declare function field(label: string, control: unknown, hint?: string, reset?: unknown): import("@worm-print-platform/plugin-kit/dom").El;
|
|
99
102
|
/** 字段说明图标:说明不常驻行内,悬浮或点击聚焦时才浮出(对应 Vue 3 轨 的 button.pd-help) */
|
|
100
|
-
export declare const labelHelp: (tip: string) => import("
|
|
103
|
+
export declare const labelHelp: (tip: string) => import("@worm-print-platform/plugin-kit/dom").El;
|
|
101
104
|
/** 带说明图标的属性行:与 field() 同结构,差别只在说明挂图标而非常驻 .pd-hint 段落 */
|
|
102
|
-
export declare function fieldHelp(label: string, control: unknown, tip: string, reset?: unknown): import("
|
|
105
|
+
export declare function fieldHelp(label: string, control: unknown, tip: string, reset?: unknown): import("@worm-print-platform/plugin-kit/dom").El;
|
|
103
106
|
/**
|
|
104
107
|
* 「恢复默认值」按钮,与 Vue 3 轨的 property/ResetButton.vue 逐字同构。
|
|
105
108
|
* 落点派生自 base[propKey]:判据一律 === 比出厂值,base 里取到 undefined 即「未设」,
|
|
@@ -122,18 +125,18 @@ export declare function resetButton(o: {
|
|
|
122
125
|
onReset?: () => void;
|
|
123
126
|
/** 多选批量档:不显示"已改"脏点(判据取自单格会误导),但按钮恒可点,写回整选区 */
|
|
124
127
|
force?: boolean;
|
|
125
|
-
}): import("
|
|
128
|
+
}): import("@worm-print-platform/plugin-kit/dom").El;
|
|
126
129
|
/** 分节标题(对应 Vue 3 轨 的 h3.pd-divider) */
|
|
127
|
-
export declare const divider: (text: string) => import("
|
|
130
|
+
export declare const divider: (text: string) => import("@worm-print-platform/plugin-kit/dom").El;
|
|
128
131
|
/** 颜色触发钮:预设色板面板(移植 Vue 3 轨的 PresetColorPicker.vue,面板实现见 shell/color-picker.ts)。
|
|
129
132
|
* onPick 收到的 undefined 表示「清除颜色」:Vue 3 轨侧 emit '' 后由消费方归一化为未设置,
|
|
130
133
|
* 本包在触发器层直接归一后透传,调用方 patch 即删除该颜色属性(签名保持 (v: string) 不变)。 */
|
|
131
|
-
export declare function colorTrigger(value: string | undefined, onPick: (v: string) => void, title?: string, triggerClass?: string): import("
|
|
134
|
+
export declare function colorTrigger(value: string | undefined, onPick: (v: string) => void, title?: string, triggerClass?: string): import("@worm-print-platform/plugin-kit/dom").El;
|
|
132
135
|
/** 单选组(对应 Vue 3 轨 的 .pd-radio-group) */
|
|
133
136
|
export declare function radioGroup(name: string, options: {
|
|
134
137
|
value: string;
|
|
135
138
|
label: string;
|
|
136
|
-
}[], current: string, onChange: (v: string) => void, twoCol?: boolean): import("
|
|
139
|
+
}[], current: string, onChange: (v: string) => void, twoCol?: boolean): import("@worm-print-platform/plugin-kit/dom").El;
|
|
137
140
|
/**
|
|
138
141
|
* 裸下拉(无 label 包裹,用于 .border-style-row 这类横向控件行)。
|
|
139
142
|
* 不能只靠 <option selected> 属性:happy-dom/部分内核在"首项未选中、第三项选中"时会回落到第二项,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @worm-print-platform/canvas v1.
|
|
2
|
+
* @worm-print-platform/canvas v1.6.0
|
|
3
3
|
* Copyright (c) 2026 worm <liu_long_qqcom@qq.com>
|
|
4
4
|
* SPDX-FileCopyrightText: 2026 worm <liu_long_qqcom@qq.com>
|
|
5
5
|
* SPDX-License-Identifier: MIT
|
|
@@ -26,4 +26,4 @@ export interface CropAnchorOpts {
|
|
|
26
26
|
onCommit: (value: string | undefined) => void;
|
|
27
27
|
onScaleCommit: (value: number | undefined) => void;
|
|
28
28
|
}
|
|
29
|
-
export declare function cropAnchorField(ctx: ShellCtx, o: CropAnchorOpts): import("
|
|
29
|
+
export declare function cropAnchorField(ctx: ShellCtx, o: CropAnchorOpts): import("@worm-print-platform/plugin-kit/dom").El;
|
package/dist/shell/elements.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @worm-print-platform/canvas v1.
|
|
2
|
+
* @worm-print-platform/canvas v1.6.0
|
|
3
3
|
* Copyright (c) 2026 worm <liu_long_qqcom@qq.com>
|
|
4
4
|
* SPDX-FileCopyrightText: 2026 worm <liu_long_qqcom@qq.com>
|
|
5
5
|
* SPDX-License-Identifier: MIT
|
|
@@ -25,6 +25,6 @@ export declare function positionLabel(o: {
|
|
|
25
25
|
width: number;
|
|
26
26
|
height: number;
|
|
27
27
|
}): string;
|
|
28
|
-
export declare function renderDesignElement(ctx: ShellCtx, el: RuntimeElement, followMemberIds?: Set<string>): import("
|
|
28
|
+
export declare function renderDesignElement(ctx: ShellCtx, el: RuntimeElement, followMemberIds?: Set<string>): import("@worm-print-platform/plugin-kit/dom").El;
|
|
29
29
|
/** mm → px(供画布几何换算复用同一口径) */
|
|
30
30
|
export { mmToPx };
|
|
@@ -1,33 +1,8 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @worm-print-platform/canvas v1.
|
|
2
|
+
* @worm-print-platform/canvas v1.6.0
|
|
3
3
|
* Copyright (c) 2026 worm <liu_long_qqcom@qq.com>
|
|
4
4
|
* SPDX-FileCopyrightText: 2026 worm <liu_long_qqcom@qq.com>
|
|
5
5
|
* SPDX-License-Identifier: MIT
|
|
6
6
|
*/
|
|
7
|
-
|
|
8
|
-
|
|
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;
|
|
7
|
+
export { renderExpressionEditor, normalizeFieldDisplay } from '@worm-print-platform/plugin-kit/expression-editor';
|
|
8
|
+
export type { ExpressionEditorTarget, ExpressionEditorOptions, FieldDisplayMode } from '@worm-print-platform/plugin-kit/expression-editor';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @worm-print-platform/canvas v1.
|
|
2
|
+
* @worm-print-platform/canvas v1.6.0
|
|
3
3
|
* Copyright (c) 2026 worm <liu_long_qqcom@qq.com>
|
|
4
4
|
* SPDX-FileCopyrightText: 2026 worm <liu_long_qqcom@qq.com>
|
|
5
5
|
* SPDX-License-Identifier: MIT
|
|
@@ -9,4 +9,4 @@ import type { DesignerStore } from '../core/store';
|
|
|
9
9
|
/** 与 Vue 3 轨 FlowListElement 的 DESIGN_FALLBACK_ITEMS 逐字一致:新拖入的元素也要看得见形状 */
|
|
10
10
|
export declare const FLOW_LIST_DEMO_ITEMS: string[];
|
|
11
11
|
export declare function flowListCells(el: RuntimeElement, data?: Record<string, any>[]): string[];
|
|
12
|
-
export declare function renderFlowListElement(el: RuntimeElement, data?: Record<string, any>[], store?: DesignerStore): import("
|
|
12
|
+
export declare function renderFlowListElement(el: RuntimeElement, data?: Record<string, any>[], store?: DesignerStore): import("@worm-print-platform/plugin-kit/dom").El;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @worm-print-platform/canvas v1.
|
|
2
|
+
* @worm-print-platform/canvas v1.6.0
|
|
3
3
|
* Copyright (c) 2026 worm <liu_long_qqcom@qq.com>
|
|
4
4
|
* SPDX-FileCopyrightText: 2026 worm <liu_long_qqcom@qq.com>
|
|
5
5
|
* SPDX-License-Identifier: MIT
|
|
@@ -10,6 +10,6 @@ import type { FormatToolbar } from '../core/format';
|
|
|
10
10
|
type FormatCtx = ShellCtx & {
|
|
11
11
|
format: FormatToolbar;
|
|
12
12
|
};
|
|
13
|
-
export declare function renderFormatBar(ctx: FormatCtx): import("
|
|
13
|
+
export declare function renderFormatBar(ctx: FormatCtx): import("@worm-print-platform/plugin-kit/dom").El;
|
|
14
14
|
/** 供状态栏/属性面板复用的排版行(保持与 Vue 3 轨同类名) */
|
|
15
15
|
export { field as formatField };
|
package/dist/shell/panels.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @worm-print-platform/canvas v1.
|
|
2
|
+
* @worm-print-platform/canvas v1.6.0
|
|
3
3
|
* Copyright (c) 2026 worm <liu_long_qqcom@qq.com>
|
|
4
4
|
* SPDX-FileCopyrightText: 2026 worm <liu_long_qqcom@qq.com>
|
|
5
5
|
* SPDX-License-Identifier: MIT
|
|
@@ -15,6 +15,6 @@ export declare const ELEMENT_TYPES: {
|
|
|
15
15
|
label: string;
|
|
16
16
|
icon: string;
|
|
17
17
|
}[];
|
|
18
|
-
export declare function renderLeftPanel(ctx: ShellCtx): import("
|
|
19
|
-
export declare function renderPageTabs(ctx: ShellCtx): import("
|
|
20
|
-
export declare function renderStatusBar(ctx: ShellCtx): import("
|
|
18
|
+
export declare function renderLeftPanel(ctx: ShellCtx): import("@worm-print-platform/plugin-kit/dom").El;
|
|
19
|
+
export declare function renderPageTabs(ctx: ShellCtx): import("@worm-print-platform/plugin-kit/dom").El;
|
|
20
|
+
export declare function renderStatusBar(ctx: ShellCtx): import("@worm-print-platform/plugin-kit/dom").El;
|
package/dist/shell/ruler.d.ts
CHANGED
package/dist/shell/table.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @worm-print-platform/canvas v1.
|
|
2
|
+
* @worm-print-platform/canvas v1.6.0
|
|
3
3
|
* Copyright (c) 2026 worm <liu_long_qqcom@qq.com>
|
|
4
4
|
* SPDX-FileCopyrightText: 2026 worm <liu_long_qqcom@qq.com>
|
|
5
5
|
* SPDX-License-Identifier: MIT
|
|
@@ -21,7 +21,7 @@ export declare const TOOLBAR_UNITS: ToolbarUnitDef[];
|
|
|
21
21
|
* 「更多」分组节点:触发钮 + 常驻面板(收起时 .is-hidden,不能用条件渲染,
|
|
22
22
|
* 否则落位槽不存在,被收纳的单元会退回行内显示)。
|
|
23
23
|
*/
|
|
24
|
-
export declare function renderMoreGroup(ctx: ShellCtx): import("
|
|
24
|
+
export declare function renderMoreGroup(ctx: ShellCtx): import("@worm-print-platform/plugin-kit/dom").El;
|
|
25
25
|
export declare function applyToolbarOverflow(scope: ParentNode): {
|
|
26
26
|
movedIds: string[];
|
|
27
27
|
overflowRemains: boolean;
|
package/dist/shell/toolbar.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @worm-print-platform/canvas v1.
|
|
2
|
+
* @worm-print-platform/canvas v1.6.0
|
|
3
3
|
* Copyright (c) 2026 worm <liu_long_qqcom@qq.com>
|
|
4
4
|
* SPDX-FileCopyrightText: 2026 worm <liu_long_qqcom@qq.com>
|
|
5
5
|
* SPDX-License-Identifier: MIT
|
|
6
6
|
*/
|
|
7
7
|
import type { ShellCtx } from './controls';
|
|
8
|
-
export declare function renderToolbar(ctx: ShellCtx, formatSection: unknown): import("
|
|
8
|
+
export declare function renderToolbar(ctx: ShellCtx, formatSection: unknown): import("@worm-print-platform/plugin-kit/dom").El;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* @worm-print-platform/canvas v1.6.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
|
+
/**
|
|
8
|
+
* 内置主题预设的色值表,与 core/styles/theme.css 的浅色令牌一一对应。
|
|
9
|
+
*
|
|
10
|
+
* 只服务于 <print-designer> 的 theme 参数通道:applyTheme() 把这些值写成
|
|
11
|
+
* 内部 .designer-container 的行内 CSS 变量,优先级高于 Shadow DOM 内的令牌声明。
|
|
12
|
+
*
|
|
13
|
+
* 画布保持现状:纸张、画布背景、标尺、手柄与纸张阴影的令牌一律不进暗色表,
|
|
14
|
+
* 换肤只影响设计器外壳,预览所见即所得不失真。宿主如需调整画布外围背景,
|
|
15
|
+
* 可用 theme-config 显式覆盖 --pd-canvas-bg。
|
|
16
|
+
*/
|
|
17
|
+
import type { PrintDesignerThemeToken } from './host-contract';
|
|
18
|
+
/** 暗色模式下保持浅色原值的令牌(画布区 / 非颜色项),刻意不写入行内覆盖 */
|
|
19
|
+
export declare const CANVAS_UNCHANGED_TOKENS: readonly ["--pd-canvas-bg", "--pd-paper", "--pd-handle", "--pd-ruler", "--pd-ruler-bg", "--pd-ruler-cursor", "--pd-shadow-paper", "--pd-radius"];
|
|
20
|
+
/** 暗色外壳预设:47 项 = 55 项完整清单 - 8 项画布/非颜色令牌 */
|
|
21
|
+
export declare const DARK_THEME_TOKENS: Partial<Record<PrintDesignerThemeToken, string>>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* @worm-print-platform/canvas v1.6.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
|
+
/** 设计器(@worm-print-platform/canvas)当前版本,用于状态栏等 UI 展示 */
|
|
8
|
+
export declare const CANVAS_VERSION = "1.6.0";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @worm-print-platform/canvas v1.
|
|
2
|
+
* @worm-print-platform/canvas v1.6.0
|
|
3
3
|
* Copyright (c) 2026 worm <liu_long_qqcom@qq.com>
|
|
4
4
|
* SPDX-FileCopyrightText: 2026 worm <liu_long_qqcom@qq.com>
|
|
5
5
|
* SPDX-License-Identifier: MIT
|
|
@@ -8,6 +8,7 @@ import type { PropType } from 'vue';
|
|
|
8
8
|
import type { PrintFontDeclaration } from '@worm-print-platform/core';
|
|
9
9
|
import type { MultiPageTemplateData, PrintBusinessField, RuntimeElement, TemplateData, UploadDesignBackgroundFn, UploadImageFn } from '@worm-print-platform/core/designer';
|
|
10
10
|
import type { PrintDesignerElement } from '../print-designer';
|
|
11
|
+
import type { PrintDesignerThemeConfig, PrintDesignerThemeMode } from '../host-contract';
|
|
11
12
|
/** 与 Vue 3 轨的 expose 同形:getTemplateJson 返回对象而非 JSON 字符串 */
|
|
12
13
|
export interface PrintDesignerExpose {
|
|
13
14
|
getTemplateJson(): TemplateData | MultiPageTemplateData | undefined;
|
|
@@ -66,6 +67,16 @@ declare const component: import("vue").DefineComponent<import("vue").ExtractProp
|
|
|
66
67
|
type: PropType<Record<string, unknown> | readonly Record<string, unknown>[]>;
|
|
67
68
|
default: undefined;
|
|
68
69
|
};
|
|
70
|
+
/** 主题预设:auto(默认)跟随系统 prefers-color-scheme,light/dark 强制 */
|
|
71
|
+
theme: {
|
|
72
|
+
type: PropType<PrintDesignerThemeMode>;
|
|
73
|
+
default: undefined;
|
|
74
|
+
};
|
|
75
|
+
/** 主题色值覆盖:传参优先于预设、系统与 CSS 令牌;只影响外壳,画布纸张不受影响 */
|
|
76
|
+
themeConfig: {
|
|
77
|
+
type: PropType<PrintDesignerThemeConfig>;
|
|
78
|
+
default: undefined;
|
|
79
|
+
};
|
|
69
80
|
}>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
70
81
|
[key: string]: any;
|
|
71
82
|
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
@@ -123,6 +134,16 @@ declare const component: import("vue").DefineComponent<import("vue").ExtractProp
|
|
|
123
134
|
type: PropType<Record<string, unknown> | readonly Record<string, unknown>[]>;
|
|
124
135
|
default: undefined;
|
|
125
136
|
};
|
|
137
|
+
/** 主题预设:auto(默认)跟随系统 prefers-color-scheme,light/dark 强制 */
|
|
138
|
+
theme: {
|
|
139
|
+
type: PropType<PrintDesignerThemeMode>;
|
|
140
|
+
default: undefined;
|
|
141
|
+
};
|
|
142
|
+
/** 主题色值覆盖:传参优先于预设、系统与 CSS 令牌;只影响外壳,画布纸张不受影响 */
|
|
143
|
+
themeConfig: {
|
|
144
|
+
type: PropType<PrintDesignerThemeConfig>;
|
|
145
|
+
default: undefined;
|
|
146
|
+
};
|
|
126
147
|
}>> & Readonly<{
|
|
127
148
|
onSave?: ((json: string) => any) | undefined;
|
|
128
149
|
onPreview?: (() => any) | undefined;
|
|
@@ -130,10 +151,12 @@ declare const component: import("vue").DefineComponent<import("vue").ExtractProp
|
|
|
130
151
|
fields: PrintBusinessField[];
|
|
131
152
|
fonts: readonly PrintFontDeclaration[];
|
|
132
153
|
designData: Record<string, unknown> | readonly Record<string, unknown>[];
|
|
154
|
+
theme: PrintDesignerThemeMode;
|
|
133
155
|
isEdit: boolean;
|
|
134
156
|
showHelp: boolean;
|
|
135
157
|
showPreview: boolean;
|
|
136
158
|
showSave: boolean;
|
|
159
|
+
themeConfig: PrintDesignerThemeConfig;
|
|
137
160
|
uploadImage: UploadImageFn;
|
|
138
161
|
uploadDesignBackground: UploadDesignBackgroundFn;
|
|
139
162
|
initialTemplate: TemplateData | MultiPageTemplateData;
|