@xiongtao.xt/tau-plugins 0.7.0 → 0.9.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/SYNC.md +21 -0
- package/WHITEBOARD.md +115 -0
- package/package.json +12 -3
- package/tailwind.css +101 -0
- package/types/packages/plugins/src/contract.d.ts +4 -3
- package/types/packages/plugins/src/json.d.ts +3 -0
- package/types/packages/plugins/src/settings.d.ts +7 -0
- package/types/packages/plugins/src/sync.d.ts +23 -0
- package/types/packages/plugins/src/whiteboard.d.ts +7 -0
- package/types/packages/shared/entity-ref.d.ts +19 -0
- package/types/packages/whiteboard/src/author.d.ts +14 -0
- package/types/packages/whiteboard/src/authorSketch.d.ts +6 -0
- package/types/packages/whiteboard/src/chrome/index.d.ts +189 -0
- package/types/packages/whiteboard/src/components/SketchPaths/index.d.ts +9 -0
- package/types/packages/whiteboard/src/components/SketchPopover.d.ts +43 -0
- package/types/packages/whiteboard/src/extensions/api.d.ts +352 -0
- package/types/packages/whiteboard/src/extensions/authorHooks.d.ts +4 -0
- package/types/packages/whiteboard/src/extensions/context.d.ts +4 -0
- package/types/packages/whiteboard/src/extensions/events.d.ts +50 -0
- package/types/packages/whiteboard/src/extensions/standard-schema.d.ts +32 -0
- package/types/packages/whiteboard/src/types/containment.d.ts +3 -0
- package/types/packages/whiteboard/src/types/element.d.ts +33 -0
- package/types/packages/whiteboard/src/types/operation.d.ts +51 -0
- package/types/packages/whiteboard/src/types/path.d.ts +1 -0
- package/types/packages/whiteboard/src/types/point.d.ts +4 -0
- package/types/packages/whiteboard/src/types/presentation.d.ts +11 -0
- package/types/packages/whiteboard/src/types/schematic.d.ts +44 -0
- package/types/packages/whiteboard/src/types/selection.d.ts +11 -0
- package/types/packages/whiteboard/src/types/sketch.d.ts +25 -0
- package/types/packages/whiteboard/src/types/viewport.d.ts +8 -0
- package/types/packages/whiteboard/src/utils/sketch/geometry.d.ts +22 -0
- package/types/packages/whiteboard/src/utils/sketch/handText.d.ts +3 -0
- package/types/packages/whiteboard/src/utils/sketch/ink.d.ts +13 -0
- package/types/packages/whiteboard/src/utils/sketch/levels.d.ts +5 -0
- package/types/packages/whiteboard/src/utils/sketch/random.d.ts +4 -0
- package/types/packages/whiteboard/src/utils/sketch/shape.d.ts +38 -0
- package/types/packages/whiteboard/src/utils/sketch/types.d.ts +24 -0
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export type Vec = [number, number];
|
|
2
|
+
export interface Polyline {
|
|
3
|
+
points: Vec[];
|
|
4
|
+
closed: boolean;
|
|
5
|
+
}
|
|
6
|
+
export declare const distance: (a: Vec, b: Vec) => number;
|
|
7
|
+
export declare const clamp: (value: number, min: number, max: number) => number;
|
|
8
|
+
export declare function lengthOf(points: Vec[]): number;
|
|
9
|
+
export declare const polylineToD: (points: Vec[], closed?: boolean) => string;
|
|
10
|
+
/** 按弧长等距重采样,首尾点保留 */
|
|
11
|
+
export declare function resample(points: Vec[], step: number): Vec[];
|
|
12
|
+
/**
|
|
13
|
+
* 沿法线方向的低频摆动:两段正弦按弧长叠加,相位由 random 决定。
|
|
14
|
+
* 摆动是弧长的连续函数,端点移动时线形连续变化,不会整体跳变。
|
|
15
|
+
* waveScale 缩放波长:尺寸很小的图形(火柴人等)传 <1,否则一整笔都落在半个波长内、看不出手抖。
|
|
16
|
+
*/
|
|
17
|
+
export declare function wobble(points: Vec[], amplitude: number, random: () => number, waveScale?: number): Vec[];
|
|
18
|
+
/**
|
|
19
|
+
* SVG path d → 折线(每个子路径一条),支持 M/L/H/V/C/S/Q/T/A/Z 的绝对与相对形式。
|
|
20
|
+
* 白板里的几何轮廓与连线路径(ArrowUtil.getArrowPath)都只用到这些命令。
|
|
21
|
+
*/
|
|
22
|
+
export declare function flattenPath(d: string): Polyline[];
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type Vec } from "./geometry";
|
|
2
|
+
export interface InkOptions {
|
|
3
|
+
/** 起笔 / 收笔渐细长度(px),0 为平头 */
|
|
4
|
+
taperStart?: number;
|
|
5
|
+
taperEnd?: number;
|
|
6
|
+
thinning?: number;
|
|
7
|
+
streamline?: number;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* 一笔墨迹的轮廓(填充多边形):起笔略重、行笔饱满、收笔变细,压力带极小噪声。
|
|
11
|
+
* size 为墨迹最大宽度。
|
|
12
|
+
*/
|
|
13
|
+
export declare function inkOutline(points: Vec[], size: number, random: () => number, options?: InkOptions): string;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { SketchFillStyle, SketchLevel } from "../../types/sketch";
|
|
2
|
+
import { type Polyline, type Vec } from "./geometry";
|
|
3
|
+
import type { SketchPath } from "./types";
|
|
4
|
+
export type SketchOutline = {
|
|
5
|
+
kind: "rect";
|
|
6
|
+
cornerRadius?: number;
|
|
7
|
+
} | {
|
|
8
|
+
kind: "ellipse";
|
|
9
|
+
}
|
|
10
|
+
/** 已缩放到元素尺寸的 path d(几何配置经 transformPath 的结果) */
|
|
11
|
+
| {
|
|
12
|
+
kind: "path";
|
|
13
|
+
paths: string[];
|
|
14
|
+
};
|
|
15
|
+
export interface SketchShapeInput {
|
|
16
|
+
outline: SketchOutline;
|
|
17
|
+
width: number;
|
|
18
|
+
height: number;
|
|
19
|
+
stroke?: string;
|
|
20
|
+
strokeWidth: number;
|
|
21
|
+
strokeOpacity?: number;
|
|
22
|
+
fill?: string;
|
|
23
|
+
fillOpacity?: number;
|
|
24
|
+
fillStyle?: SketchFillStyle;
|
|
25
|
+
/** 描边线型:只对圆角矩形生效;缺省实线 */
|
|
26
|
+
strokeDash?: "dashed" | "dotted";
|
|
27
|
+
/** 淡涂叠在纸上的不透明度系数,缺省 WASH_ALPHA;底色承载文字对比度时(导图节点)传 1 */
|
|
28
|
+
washAlpha?: number;
|
|
29
|
+
level: SketchLevel;
|
|
30
|
+
seed: number;
|
|
31
|
+
}
|
|
32
|
+
export declare function outlinePolylines(outline: SketchOutline, width: number, height: number): Polyline[];
|
|
33
|
+
/** 闭合轮廓一笔绕一圈:随机起点,末尾一小段向外搭接,形成手绘的收口 */
|
|
34
|
+
export declare function loopStroke(loop: Vec[], amplitude: number, random: () => number, overlapRatio?: number): Vec[];
|
|
35
|
+
/** 排线间距随线宽变粗、随形状尺寸微调:大形状不稀、小形状不糊 */
|
|
36
|
+
export declare const hatchGap: (strokeWidth: number, width: number, height: number) => number;
|
|
37
|
+
/** 形状的手绘渲染:填充在下、轮廓墨迹在上。坐标系为元素局部坐标(0,0 ~ width,height) */
|
|
38
|
+
export declare function sketchShape(input: SketchShapeInput): SketchPath[];
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 手绘渲染的输出单元:纯数据,由组件渲染为 <path>。
|
|
3
|
+
* - ink:墨迹(填充多边形)
|
|
4
|
+
* - wash:淡涂填充
|
|
5
|
+
* - lines:线类填充(斜线 / 交叉 / 涂鸦),深色主题下需要再退一步
|
|
6
|
+
*/
|
|
7
|
+
export interface SketchPath {
|
|
8
|
+
role: "ink" | "wash" | "lines";
|
|
9
|
+
d: string;
|
|
10
|
+
color: string;
|
|
11
|
+
opacity?: number;
|
|
12
|
+
/** 限制在此轮廓内(线类填充) */
|
|
13
|
+
clip?: string;
|
|
14
|
+
/** 虚线遮罩:沿中心线描粗虚线,墨迹只露出虚线段;可多段(各自节奏) */
|
|
15
|
+
dashMask?: DashMask[];
|
|
16
|
+
}
|
|
17
|
+
export interface DashMask {
|
|
18
|
+
d: string;
|
|
19
|
+
width: number;
|
|
20
|
+
dash: number;
|
|
21
|
+
gap: number;
|
|
22
|
+
/** stroke-dashoffset,缺省 0 */
|
|
23
|
+
offset?: number;
|
|
24
|
+
}
|