microboard-temp 0.4.5 → 0.4.7
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/dist/cjs/browser.js +590 -120
- package/dist/cjs/index.js +590 -120
- package/dist/cjs/node.js +590 -120
- package/dist/esm/browser.js +591 -121
- package/dist/esm/index.js +591 -121
- package/dist/esm/node.js +591 -121
- package/dist/types/BoardOperations.d.ts +7 -1
- package/dist/types/Items/AINode/AINode.d.ts +2 -1
- package/dist/types/Items/BaseItem/BaseItem.d.ts +1 -0
- package/dist/types/Items/Comment/Comment.d.ts +1 -0
- package/dist/types/Items/Curve/Curve.d.ts +2 -0
- package/dist/types/Items/Line/Line.d.ts +1 -0
- package/dist/types/Items/RichText/CanvasText/LayoutBlockNodes.d.ts +2 -1
- package/dist/types/Items/RichText/CanvasText/Render.d.ts +61 -0
- package/dist/types/Items/RichText/Editor/BlockNode.d.ts +5 -11
- package/dist/types/Items/RichText/editorHelpers/common/getAreAllChildrenEmpty.d.ts +2 -1
- package/dist/types/Items/RichText/setNodeStyles.d.ts +2 -2
- package/dist/types/Items/Shape/Shape.d.ts +1 -0
- package/dist/types/Selection/QuickAddButtons/quickAddHelpers.d.ts +1 -1
- package/dist/types/Selection/Selection.d.ts +3 -3
- package/dist/types/SpatialIndex/SpacialIndex.d.ts +3 -3
- package/dist/types/public/customWebComponents.d.ts +24 -0
- package/dist/types/public/loadLinkImages.d.ts +0 -0
- package/package.json +19 -19
|
@@ -32,6 +32,12 @@ export interface CreateLockedGroupItem extends SingleItemBoardOp {
|
|
|
32
32
|
export interface RemoveItem extends MultiItemBoardOp {
|
|
33
33
|
method: "remove";
|
|
34
34
|
}
|
|
35
|
+
export interface LockItem extends MultiItemBoardOp {
|
|
36
|
+
method: "lock";
|
|
37
|
+
}
|
|
38
|
+
export interface UnlockItem extends MultiItemBoardOp {
|
|
39
|
+
method: "unlock";
|
|
40
|
+
}
|
|
35
41
|
export interface RemoveLockedGroup extends MultiItemBoardOp {
|
|
36
42
|
method: "removeLockedGroup";
|
|
37
43
|
}
|
|
@@ -66,5 +72,5 @@ interface Paste extends ItemMapBoardOp {
|
|
|
66
72
|
interface Duplicate extends ItemMapBoardOp {
|
|
67
73
|
method: "duplicate";
|
|
68
74
|
}
|
|
69
|
-
export type BoardOps = CreateItem | CreateLockedGroupItem | RemoveItem | RemoveLockedGroup | MoveToZIndex | MoveManyToZIndex | MoveSecondBeforeFirst | MoveSecondAfterFirst | BringToFront | SendToBack | Paste | Duplicate;
|
|
75
|
+
export type BoardOps = CreateItem | CreateLockedGroupItem | RemoveItem | RemoveLockedGroup | MoveToZIndex | MoveManyToZIndex | MoveSecondBeforeFirst | MoveSecondAfterFirst | BringToFront | SendToBack | Paste | Duplicate | LockItem | UnlockItem;
|
|
70
76
|
export {};
|
|
@@ -15,7 +15,8 @@ import { Transformation } from "Items/Transformation/Transformation";
|
|
|
15
15
|
import { Subject } from "Subject";
|
|
16
16
|
import { BaseItem } from "Items/BaseItem/BaseItem";
|
|
17
17
|
export declare const CONTEXT_NODE_HIGHLIGHT_COLOR = "rgba(183, 138, 240, 1)";
|
|
18
|
-
export
|
|
18
|
+
export declare const threadDirections: readonly [0, 1, 2, 3];
|
|
19
|
+
export type ThreadDirection = typeof threadDirections[number];
|
|
19
20
|
export declare class AINode extends BaseItem {
|
|
20
21
|
private id;
|
|
21
22
|
readonly itemType = "AINode";
|
|
@@ -42,6 +42,7 @@ export declare class BaseItem extends Mbr implements Geometry {
|
|
|
42
42
|
apply(op: Operation | BaseOperation): void;
|
|
43
43
|
addOnRemoveCallback(cb: () => void): void;
|
|
44
44
|
onRemove(): void;
|
|
45
|
+
getPathMbr(): Mbr;
|
|
45
46
|
render(context: DrawingContext): void;
|
|
46
47
|
renderHTML(documentFactory: DocumentFactory): HTMLElement;
|
|
47
48
|
}
|
|
@@ -78,6 +78,7 @@ export declare class Comment implements Geometry {
|
|
|
78
78
|
getAnchorPoint(): Point;
|
|
79
79
|
getAnchorMbr(): Mbr;
|
|
80
80
|
getMbr(scale?: number): Mbr;
|
|
81
|
+
getPathMbr(): Mbr;
|
|
81
82
|
getNearestEdgePointTo(point: Point): Point;
|
|
82
83
|
getNormal(point: Point): GeometricNormal;
|
|
83
84
|
getRichText(): RichText | null;
|
|
@@ -30,6 +30,7 @@ export declare class QuadraticBezier extends BaseCurve {
|
|
|
30
30
|
constructor(start?: Point, control?: Point, end?: Point);
|
|
31
31
|
protected updateCache(): void;
|
|
32
32
|
getStartPoint(): Point;
|
|
33
|
+
getEndPoint(): Point;
|
|
33
34
|
moveToStart(ctx: Path2D | CanvasRenderingContext2D): void;
|
|
34
35
|
render(ctx: Path2D | CanvasRenderingContext2D): void;
|
|
35
36
|
transform(matrix: Matrix): void;
|
|
@@ -46,6 +47,7 @@ export declare class CubicBezier extends BaseCurve {
|
|
|
46
47
|
constructor(start?: Point, startControl?: Point, end?: Point, endControl?: Point);
|
|
47
48
|
protected updateCache(): void;
|
|
48
49
|
getStartPoint(): Point;
|
|
50
|
+
getEndPoint(): Point;
|
|
49
51
|
moveToStart(ctx: Path2D | CanvasRenderingContext2D): void;
|
|
50
52
|
render(ctx: Path2D | CanvasRenderingContext2D): void;
|
|
51
53
|
transform(matrix: Matrix): void;
|
|
@@ -31,6 +31,7 @@ export declare class Line {
|
|
|
31
31
|
isCenter: boolean;
|
|
32
32
|
constructor(start?: Point, end?: Point, isCenter?: boolean);
|
|
33
33
|
getStartPoint(): Point;
|
|
34
|
+
getEndPoint(): Point;
|
|
34
35
|
getLength(): number;
|
|
35
36
|
getNearestPointParameter(point: Point): number;
|
|
36
37
|
getPoint(parameter: number): Point;
|
|
@@ -1,3 +1,64 @@
|
|
|
1
1
|
import { BlockNode } from '../Editor/BlockNode';
|
|
2
2
|
import { LayoutBlockNodes } from './LayoutBlockNodes';
|
|
3
3
|
export declare function getBlockNodes(data: BlockNode[], maxWidth?: number, shrink?: boolean, isFrame?: boolean): LayoutBlockNodes;
|
|
4
|
+
export interface LayoutBlockNode {
|
|
5
|
+
type: 'paragraph' | 'heading_one' | 'heading_two' | 'heading_three' | 'heading_four' | 'heading_five' | 'code_block' | 'ul_list' | 'ol_list' | 'list_item' | 'text';
|
|
6
|
+
lineHeight: number;
|
|
7
|
+
children: LayoutTextNode[];
|
|
8
|
+
lines: LayoutTextBlock[][];
|
|
9
|
+
align: 'left' | 'center' | 'right' | undefined;
|
|
10
|
+
width: number;
|
|
11
|
+
height: number;
|
|
12
|
+
didBreakWords: boolean;
|
|
13
|
+
paddingTop: number;
|
|
14
|
+
marginLeft: number;
|
|
15
|
+
}
|
|
16
|
+
interface LayoutTextNode {
|
|
17
|
+
type: string;
|
|
18
|
+
text: string;
|
|
19
|
+
style: LeafStyle;
|
|
20
|
+
blocks: never[];
|
|
21
|
+
newLine: boolean;
|
|
22
|
+
paddingTop?: number;
|
|
23
|
+
marginLeft?: number;
|
|
24
|
+
listMark?: string;
|
|
25
|
+
link?: string;
|
|
26
|
+
}
|
|
27
|
+
interface LeafStyle {
|
|
28
|
+
fontStyle: string;
|
|
29
|
+
fontWeight: string;
|
|
30
|
+
color: string;
|
|
31
|
+
backgroundColor: string | undefined;
|
|
32
|
+
fontSize: number | "auto";
|
|
33
|
+
fontFamily: string;
|
|
34
|
+
textDecorationLine?: 'underline';
|
|
35
|
+
crossed?: 'line-through';
|
|
36
|
+
verticalAlign?: 'super' | 'sub';
|
|
37
|
+
font?: string;
|
|
38
|
+
}
|
|
39
|
+
interface LayoutTextBlock {
|
|
40
|
+
text: string;
|
|
41
|
+
style: LeafStyle;
|
|
42
|
+
width: number;
|
|
43
|
+
x: number;
|
|
44
|
+
y: number;
|
|
45
|
+
measure: MeasuredRect;
|
|
46
|
+
fontSize: number;
|
|
47
|
+
marginLeft?: number;
|
|
48
|
+
paddingTop?: number;
|
|
49
|
+
listMark?: string;
|
|
50
|
+
link?: string;
|
|
51
|
+
}
|
|
52
|
+
interface MeasuredRect {
|
|
53
|
+
actualBoundingBoxAscent: number;
|
|
54
|
+
actualBoundingBoxDescent: number;
|
|
55
|
+
actualBoundingBoxLeft: number;
|
|
56
|
+
actualBoundingBoxRight: number;
|
|
57
|
+
fontBoundingBoxAscent: number;
|
|
58
|
+
fontBoundingBoxDescent: number;
|
|
59
|
+
ascent: number;
|
|
60
|
+
descent: number;
|
|
61
|
+
width: number;
|
|
62
|
+
height: number;
|
|
63
|
+
}
|
|
64
|
+
export {};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { HorisontalAlignment } from "../../Alignment";
|
|
2
|
-
import {
|
|
2
|
+
import { TextNode } from "./TextNode";
|
|
3
3
|
export declare const ListTypes: readonly ["ol_list", "ul_list"];
|
|
4
4
|
export type ListType = (typeof ListTypes)[number];
|
|
5
|
-
export declare const BlockTypes: readonly ["paragraph", "ul_list", "ol_list", "list_item", "code_block", "heading_one", "heading_two", "heading_three", "heading_four", "heading_five"
|
|
5
|
+
export declare const BlockTypes: readonly ["paragraph", "ul_list", "ol_list", "list_item", "code_block", "heading_one", "heading_two", "heading_three", "heading_four", "heading_five"];
|
|
6
6
|
export type BlockType = (typeof BlockTypes)[number];
|
|
7
7
|
export type ParagraphNode = {
|
|
8
8
|
type: "paragraph";
|
|
9
|
-
children: TextNode[]
|
|
9
|
+
children: TextNode[];
|
|
10
10
|
horisontalAlignment?: HorisontalAlignment;
|
|
11
11
|
paddingTop?: number;
|
|
12
12
|
paddingBottom?: number;
|
|
@@ -55,13 +55,6 @@ export type HeadingFiveNode = {
|
|
|
55
55
|
paddingTop?: number;
|
|
56
56
|
paddingBottom?: number;
|
|
57
57
|
};
|
|
58
|
-
export type BlockQuoteNode = {
|
|
59
|
-
type: "block-quote";
|
|
60
|
-
children: TextNode[];
|
|
61
|
-
horisontalAlignment?: HorisontalAlignment;
|
|
62
|
-
paddingTop?: number;
|
|
63
|
-
paddingBottom?: number;
|
|
64
|
-
};
|
|
65
58
|
export type BulletedListNode = {
|
|
66
59
|
type: "ul_list";
|
|
67
60
|
children: ListItemNode[];
|
|
@@ -87,4 +80,5 @@ export type ListItemNode = {
|
|
|
87
80
|
paddingTop?: number;
|
|
88
81
|
paddingBottom?: number;
|
|
89
82
|
};
|
|
90
|
-
export type BlockNode = ParagraphNode | CodeBlockNode | HeadingOneNode | HeadingTwoNode | HeadingThreeNode | HeadingFourNode | HeadingFiveNode |
|
|
83
|
+
export type BlockNode = ParagraphNode | CodeBlockNode | HeadingOneNode | HeadingTwoNode | HeadingThreeNode | HeadingFourNode | HeadingFiveNode | BulletedListNode | NumberedListNode | ListItemNode;
|
|
84
|
+
export type NoneListBlockNode = ParagraphNode | CodeBlockNode | HeadingOneNode | HeadingTwoNode | HeadingThreeNode | HeadingFourNode | HeadingFiveNode;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { BaseEditor } from 'slate';
|
|
2
|
-
import { BlockNode } from 'Items/RichText/Editor/BlockNode';
|
|
2
|
+
import { BlockNode, NoneListBlockNode } from 'Items/RichText/Editor/BlockNode';
|
|
3
3
|
import { ReactEditor } from 'slate-react';
|
|
4
4
|
import { HistoryEditor } from 'slate-history';
|
|
5
5
|
import { HorisontalAlignment } from 'Items/Alignment';
|
|
6
6
|
export declare function setNodeChildrenStyles({ editor, horisontalAlignment, node, }: {
|
|
7
7
|
editor?: BaseEditor & ReactEditor & HistoryEditor;
|
|
8
8
|
horisontalAlignment?: HorisontalAlignment;
|
|
9
|
-
node:
|
|
9
|
+
node: NoneListBlockNode;
|
|
10
10
|
}): void;
|
|
11
11
|
export declare function setNodeStyles({ node, isPaddingTopNeeded, listLevel, editor, horisontalAlignment, }: {
|
|
12
12
|
node: BlockNode;
|
|
@@ -397,6 +397,7 @@ export declare class Shape extends BaseItem {
|
|
|
397
397
|
getIntersectionPoints(segment: Line): Point[];
|
|
398
398
|
updateMbr(): Mbr;
|
|
399
399
|
getMbr(): Mbr;
|
|
400
|
+
getPathMbr(): Mbr;
|
|
400
401
|
getNearestEdgePointTo(point: Point): Point;
|
|
401
402
|
getDistanceToPoint(point: Point): number;
|
|
402
403
|
isUnderPoint(point: Point, tolerance?: number): boolean;
|
|
@@ -6,5 +6,5 @@ import { ShapeType } from 'Items/Shape';
|
|
|
6
6
|
/** index represents the number of connection - left, right, top, bottom */
|
|
7
7
|
export declare function getControlPointData(item: Item, index: number, isRichText?: boolean): ControlPointData;
|
|
8
8
|
export declare function quickAddItem(board: Board, type: ShapeType | 'AINode' | 'Sticker' | 'RichText', connector: Connector): void;
|
|
9
|
-
export declare function createAINode(board: Board,
|
|
9
|
+
export declare function createAINode(board: Board, directionIndex: number, parentNodeId?: string): AINode;
|
|
10
10
|
export declare function createRichText(board: Board): RichText;
|
|
@@ -77,9 +77,10 @@ export declare class BoardSelection {
|
|
|
77
77
|
list(): Item[];
|
|
78
78
|
canChangeText(): boolean;
|
|
79
79
|
private handleItemCopy;
|
|
80
|
-
copy(skipImageBlobCopy
|
|
80
|
+
copy(skipImageBlobCopy: true): {
|
|
81
81
|
[key: string]: ItemData;
|
|
82
|
-
}
|
|
82
|
+
};
|
|
83
|
+
copy(skipImageBlobCopy?: false): {
|
|
83
84
|
imageElement: HTMLImageElement;
|
|
84
85
|
imageData: {
|
|
85
86
|
[key: string]: ItemData;
|
|
@@ -129,7 +130,6 @@ export declare class BoardSelection {
|
|
|
129
130
|
setFontHighlight(fontHighlight: string): void;
|
|
130
131
|
setHorisontalAlignment(horisontalAlignment: HorisontalAlignment): void;
|
|
131
132
|
setVerticalAlignment(verticalAlignment: VerticalAlignment): void;
|
|
132
|
-
getMediaStorageIds(): string[];
|
|
133
133
|
removeFromBoard(): void;
|
|
134
134
|
getIsLockedSelection(): boolean;
|
|
135
135
|
isLocked(): boolean;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { DocumentFactory } from 'api/DocumentFactory';
|
|
2
2
|
import { ItemsIndexRecord } from 'BoardOperations';
|
|
3
3
|
import { Camera } from 'Camera';
|
|
4
|
-
import { Item, Frame, Mbr, Point, Connector } from 'Items';
|
|
4
|
+
import { Item, Frame, Mbr, Point, Connector, Comment } from 'Items';
|
|
5
5
|
import { DrawingContext } from 'Items/DrawingContext';
|
|
6
6
|
import { Pointer } from 'Pointer';
|
|
7
7
|
import { Subject } from 'Subject';
|
|
@@ -30,7 +30,7 @@ export declare class SpatialIndex {
|
|
|
30
30
|
bringManyToFront(items: ItemWoFrames[]): void;
|
|
31
31
|
moveSecondAfterFirst(first: ItemWoFrames, second: ItemWoFrames): void;
|
|
32
32
|
moveSecondBeforeFirst(first: ItemWoFrames, second: ItemWoFrames): void;
|
|
33
|
-
getById(id: string):
|
|
33
|
+
getById(id: string): BaseItem | undefined;
|
|
34
34
|
findById(id: string): Item | undefined;
|
|
35
35
|
getEnclosed(left: number, top: number, right: number, bottom: number): Item[];
|
|
36
36
|
getEnclosedOrCrossed(left: number, top: number, right: number, bottom: number): Item[];
|
|
@@ -75,7 +75,7 @@ export declare class Items {
|
|
|
75
75
|
getLinkedConnectorsById(id: string): Connector[];
|
|
76
76
|
getConnectorsByItemIds(startPointerItemId?: string, endPointerItemId?: string): Connector[];
|
|
77
77
|
render(context: DrawingContext): void;
|
|
78
|
-
renderHTML(documentFactory: DocumentFactory):
|
|
78
|
+
renderHTML(documentFactory: DocumentFactory): string;
|
|
79
79
|
getWholeHTML(documentFactory: DocumentFactory): string;
|
|
80
80
|
getHTML(documentFactory: DocumentFactory, frames: Frame[], rest: ItemWoFrames[]): string;
|
|
81
81
|
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
declare class RichTextElement extends HTMLElement {
|
|
2
|
+
}
|
|
3
|
+
declare class ShapeItemElement extends HTMLElement {
|
|
4
|
+
}
|
|
5
|
+
declare class StickerElement extends HTMLElement {
|
|
6
|
+
}
|
|
7
|
+
declare class DrawingElement extends HTMLElement {
|
|
8
|
+
}
|
|
9
|
+
declare class ConnectorElement extends HTMLElement {
|
|
10
|
+
}
|
|
11
|
+
declare class FrameItemElement extends HTMLElement {
|
|
12
|
+
}
|
|
13
|
+
declare class ImageItemElement extends HTMLElement {
|
|
14
|
+
}
|
|
15
|
+
declare class LinkItemElement extends HTMLElement {
|
|
16
|
+
}
|
|
17
|
+
declare class AINodeItemElement extends HTMLElement {
|
|
18
|
+
}
|
|
19
|
+
declare class VideoItemElement extends HTMLElement {
|
|
20
|
+
}
|
|
21
|
+
declare class CommentElement extends HTMLElement {
|
|
22
|
+
}
|
|
23
|
+
declare class AudioItemElement extends HTMLElement {
|
|
24
|
+
}
|
|
File without changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "microboard-temp",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.7",
|
|
4
4
|
"description": "A flexible interactive whiteboard library",
|
|
5
5
|
"main": "dist/cjs/index.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -32,12 +32,11 @@
|
|
|
32
32
|
"test": "bun test",
|
|
33
33
|
"lint": "eslint src/**/*.{ts,tsx}"
|
|
34
34
|
},
|
|
35
|
-
"dependencies": {},
|
|
36
35
|
"peerDependencies": {
|
|
37
|
-
"slate": "^0.114.0",
|
|
38
|
-
"slate-react": "^0.114.2",
|
|
39
36
|
"canvas": "^3.1.0",
|
|
40
|
-
"jsdom": "26.0.0"
|
|
37
|
+
"jsdom": "26.0.0",
|
|
38
|
+
"slate": "^0.114.0",
|
|
39
|
+
"slate-react": "^0.114.2"
|
|
41
40
|
},
|
|
42
41
|
"peerDependenciesMeta": {
|
|
43
42
|
"slate-react": {
|
|
@@ -51,26 +50,27 @@
|
|
|
51
50
|
}
|
|
52
51
|
},
|
|
53
52
|
"devDependencies": {
|
|
54
|
-
"
|
|
55
|
-
"rbush": "^4.0.1",
|
|
56
|
-
"rbush-knn": "^4.0.0",
|
|
53
|
+
"@types/rbush": "^4.0.0",
|
|
57
54
|
"bezier-js": "^6.1.4",
|
|
58
|
-
"typescript": "^5.8.3",
|
|
59
|
-
"eslint": "^9.27.0",
|
|
60
55
|
"bun-types": "^1.2.13",
|
|
61
|
-
"slate-react": "^0.114.2",
|
|
62
|
-
"slate-history": "^0.113.1",
|
|
63
|
-
"unified": "^11.0.5",
|
|
64
|
-
"remark-parse": "^11.0.0",
|
|
65
|
-
"remark-stringify": "11.0.0",
|
|
66
|
-
"remark-slate": "^1.8.6",
|
|
67
|
-
"rehype-parse": "9.0.1",
|
|
68
|
-
"rehype-remark": "10.0.1",
|
|
69
56
|
"css.escape": "^1.5.1",
|
|
57
|
+
"eslint": "^9.27.0",
|
|
70
58
|
"i18next": "23.11.2",
|
|
71
59
|
"i18next-browser-languagedetector": "7.2.1",
|
|
60
|
+
"rbush": "^4.0.1",
|
|
61
|
+
"rbush-knn": "^4.0.0",
|
|
72
62
|
"react-i18next": "14.1.0",
|
|
73
|
-
"
|
|
63
|
+
"rehype-parse": "9.0.1",
|
|
64
|
+
"rehype-remark": "10.0.1",
|
|
65
|
+
"remark-parse": "^11.0.0",
|
|
66
|
+
"remark-slate": "^1.8.6",
|
|
67
|
+
"remark-stringify": "11.0.0",
|
|
68
|
+
"rimraf": "^6.0.1",
|
|
69
|
+
"slate-history": "^0.113.1",
|
|
70
|
+
"slate-react": "^0.114.2",
|
|
71
|
+
"typescript": "^5.8.3",
|
|
72
|
+
"unified": "^11.0.5",
|
|
73
|
+
"uuid": "^11.1.0"
|
|
74
74
|
},
|
|
75
75
|
"repository": {
|
|
76
76
|
"type": "git",
|