@blankdotpage/cake 0.1.0 → 0.1.1
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/cake/core/runtime.d.ts +20 -2
- package/dist/cake/engine/selection/selection-geometry.d.ts +0 -3
- package/dist/cake/extensions/index.d.ts +1 -1
- package/dist/cake/extensions/scrollbar/index.d.ts +2 -2
- package/dist/cake/index.d.ts +1 -0
- package/dist/cake/react/CakeEditor.d.ts +41 -7
- package/dist/index.cjs +10840 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.js +10823 -75
- package/package.json +8 -4
- package/dist/cake/extensions/overlay-types.d.ts +0 -31
- package/dist/editor.d.ts +0 -83
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blankdotpage/cake",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/index.cjs",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
"scripts": {
|
|
19
19
|
"dev": "vite",
|
|
20
20
|
"build": "vite build && tsc -p tsconfig.build.json",
|
|
21
|
+
"build:demo": "npm run build && npm --workspace demo run build",
|
|
21
22
|
"test": "vitest run",
|
|
22
23
|
"test:browser": "vitest run --project browser",
|
|
23
24
|
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
@@ -26,13 +27,16 @@
|
|
|
26
27
|
"demo": "npm --workspace demo run dev"
|
|
27
28
|
},
|
|
28
29
|
"dependencies": {
|
|
29
|
-
"@codemirror/state": "^6.4.1",
|
|
30
30
|
"lucide-react": "^0.395.0",
|
|
31
|
-
"react": "^18.3.1",
|
|
32
|
-
"react-dom": "^18.3.1",
|
|
33
31
|
"turndown": "^7.2.0"
|
|
34
32
|
},
|
|
33
|
+
"peerDependencies": {
|
|
34
|
+
"@codemirror/state": "^6.4.1",
|
|
35
|
+
"react": "^18.3.1",
|
|
36
|
+
"react-dom": "^18.3.1"
|
|
37
|
+
},
|
|
35
38
|
"devDependencies": {
|
|
39
|
+
"@codemirror/state": "^6.4.1",
|
|
36
40
|
"@types/node": "^20.12.7",
|
|
37
41
|
"@types/react": "^18.3.5",
|
|
38
42
|
"@types/react-dom": "^18.3.0",
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import type { ReactElement } from "react";
|
|
2
|
-
export type OverlayExtensionContext = {
|
|
3
|
-
container: HTMLElement;
|
|
4
|
-
insertText: (text: string) => void;
|
|
5
|
-
replaceText: (oldText: string, newText: string) => void;
|
|
6
|
-
getSelection: () => {
|
|
7
|
-
start: number;
|
|
8
|
-
end: number;
|
|
9
|
-
} | null;
|
|
10
|
-
contentRoot?: HTMLElement;
|
|
11
|
-
overlayRoot?: HTMLElement;
|
|
12
|
-
toOverlayRect?: (rect: DOMRectReadOnly) => {
|
|
13
|
-
top: number;
|
|
14
|
-
left: number;
|
|
15
|
-
width: number;
|
|
16
|
-
height: number;
|
|
17
|
-
};
|
|
18
|
-
};
|
|
19
|
-
export type OverlayExtension = {
|
|
20
|
-
type: "overlay";
|
|
21
|
-
name: string;
|
|
22
|
-
render: (context: OverlayExtensionContext) => ReactElement | null;
|
|
23
|
-
};
|
|
24
|
-
export type Extension = OverlayExtension | {
|
|
25
|
-
type: "inline" | "block";
|
|
26
|
-
name: string;
|
|
27
|
-
};
|
|
28
|
-
export type BlockExtension = {
|
|
29
|
-
type: "block";
|
|
30
|
-
name: string;
|
|
31
|
-
};
|
package/dist/editor.d.ts
DELETED
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
import type { StateCommand } from "@codemirror/state";
|
|
2
|
-
import type { BlockExtension, Extension } from "./cake/extensions/overlay-types";
|
|
3
|
-
export interface EditorSelectionRange {
|
|
4
|
-
anchor: number;
|
|
5
|
-
head: number;
|
|
6
|
-
}
|
|
7
|
-
export type EditorSelection = {
|
|
8
|
-
start: number;
|
|
9
|
-
end: number;
|
|
10
|
-
affinity?: "backward" | "forward";
|
|
11
|
-
};
|
|
12
|
-
export interface EditorChangeMetadata {
|
|
13
|
-
selectionBefore?: EditorSelectionRange | null;
|
|
14
|
-
selectionAfter?: EditorSelectionRange | null;
|
|
15
|
-
}
|
|
16
|
-
export type EditorSettings = {
|
|
17
|
-
theme: "light" | "dark";
|
|
18
|
-
fullScreenEnabled: boolean;
|
|
19
|
-
spellCheckEnabled: boolean;
|
|
20
|
-
showUpgradeSuccessModal: boolean;
|
|
21
|
-
counterVisible: boolean;
|
|
22
|
-
goalType: "word" | "character" | null;
|
|
23
|
-
goalValue: number | null;
|
|
24
|
-
};
|
|
25
|
-
export interface EditorUpdate {
|
|
26
|
-
value?: string;
|
|
27
|
-
selection?: EditorSelection;
|
|
28
|
-
focus?: boolean;
|
|
29
|
-
addToHistory?: boolean;
|
|
30
|
-
}
|
|
31
|
-
export interface EditorTextSegment {
|
|
32
|
-
textStart: number;
|
|
33
|
-
textEnd: number;
|
|
34
|
-
docStart: number;
|
|
35
|
-
docEnd: number;
|
|
36
|
-
}
|
|
37
|
-
export interface EditorTextSlice {
|
|
38
|
-
text: string;
|
|
39
|
-
segments: EditorTextSegment[] | null;
|
|
40
|
-
}
|
|
41
|
-
export declare const defaultEditorSettings: EditorSettings;
|
|
42
|
-
export interface EditorProps {
|
|
43
|
-
initialValue: string;
|
|
44
|
-
value: string;
|
|
45
|
-
disabled?: boolean;
|
|
46
|
-
ref: React.MutableRefObject<HTMLElement | null>;
|
|
47
|
-
extensions?: Extension[];
|
|
48
|
-
blockExtensions?: BlockExtension[];
|
|
49
|
-
onSelectionChange?: (start: number, end: number, affinity?: EditorSelection["affinity"]) => void;
|
|
50
|
-
selection?: EditorSelection;
|
|
51
|
-
onBlur?: (event?: FocusEvent) => void;
|
|
52
|
-
onChange: (value: string, metadata?: EditorChangeMetadata) => void;
|
|
53
|
-
settings: EditorSettings;
|
|
54
|
-
className?: string;
|
|
55
|
-
placeholder: string;
|
|
56
|
-
style?: React.CSSProperties;
|
|
57
|
-
headerHeight?: number;
|
|
58
|
-
pageId: string | null;
|
|
59
|
-
canUploadImage: () => boolean;
|
|
60
|
-
onHistoryChange?: (params: {
|
|
61
|
-
canUndo: boolean;
|
|
62
|
-
canRedo: boolean;
|
|
63
|
-
}) => void;
|
|
64
|
-
}
|
|
65
|
-
export interface EditorRefHandle {
|
|
66
|
-
element: HTMLElement | null;
|
|
67
|
-
focus: (props?: {
|
|
68
|
-
selection?: EditorSelection;
|
|
69
|
-
}) => void;
|
|
70
|
-
blur: () => void;
|
|
71
|
-
hasFocus: () => boolean;
|
|
72
|
-
selectAll: () => void;
|
|
73
|
-
executeCommand: (command: StateCommand) => boolean;
|
|
74
|
-
applyUpdate: (update: EditorUpdate) => void;
|
|
75
|
-
getValue?: () => string;
|
|
76
|
-
getSelectedText?: () => EditorTextSlice | null;
|
|
77
|
-
getSelectedMarkdown?: () => string | null;
|
|
78
|
-
getDocSelectionRange?: () => {
|
|
79
|
-
start: number;
|
|
80
|
-
end: number;
|
|
81
|
-
} | null;
|
|
82
|
-
getDocTextBetween?: (start: number, end: number) => EditorTextSlice | null;
|
|
83
|
-
}
|