@milkdown/crepe 7.12.1 → 7.13.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/lib/cjs/feature/block-edit/index.js +248 -229
- package/lib/cjs/feature/block-edit/index.js.map +1 -1
- package/lib/cjs/feature/latex/index.js +41 -3
- package/lib/cjs/feature/latex/index.js.map +1 -1
- package/lib/cjs/feature/placeholder/index.js.map +1 -1
- package/lib/cjs/feature/toolbar/index.js +213 -160
- package/lib/cjs/feature/toolbar/index.js.map +1 -1
- package/lib/cjs/index.js +408 -390
- package/lib/cjs/index.js.map +1 -1
- package/lib/esm/feature/block-edit/index.js +250 -231
- package/lib/esm/feature/block-edit/index.js.map +1 -1
- package/lib/esm/feature/latex/index.js +42 -4
- package/lib/esm/feature/latex/index.js.map +1 -1
- package/lib/esm/feature/placeholder/index.js.map +1 -1
- package/lib/esm/feature/toolbar/index.js +217 -164
- package/lib/esm/feature/toolbar/index.js.map +1 -1
- package/lib/esm/index.js +414 -396
- package/lib/esm/index.js.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/lib/types/feature/block-edit/index.d.ts +78 -38
- package/lib/types/feature/block-edit/index.d.ts.map +1 -1
- package/lib/types/feature/block-edit/menu/config.d.ts +3 -2
- package/lib/types/feature/block-edit/menu/config.d.ts.map +1 -1
- package/lib/types/feature/block-edit/menu/utils.d.ts +2 -24
- package/lib/types/feature/block-edit/menu/utils.d.ts.map +1 -1
- package/lib/types/feature/latex/command.d.ts +2 -0
- package/lib/types/feature/latex/command.d.ts.map +1 -0
- package/lib/types/feature/latex/index.d.ts.map +1 -1
- package/lib/types/feature/toolbar/component.d.ts +1 -1
- package/lib/types/feature/toolbar/component.d.ts.map +1 -1
- package/lib/types/feature/toolbar/config.d.ts +12 -0
- package/lib/types/feature/toolbar/config.d.ts.map +1 -0
- package/lib/types/feature/toolbar/index.d.ts +3 -0
- package/lib/types/feature/toolbar/index.d.ts.map +1 -1
- package/lib/types/utils/checker.d.ts +4 -0
- package/lib/types/utils/checker.d.ts.map +1 -0
- package/lib/types/utils/group-builder.d.ts +43 -0
- package/lib/types/utils/group-builder.d.ts.map +1 -0
- package/lib/types/utils/index.d.ts +3 -3
- package/lib/types/utils/index.d.ts.map +1 -1
- package/lib/types/utils/types.d.ts +4 -0
- package/lib/types/utils/types.d.ts.map +1 -0
- package/package.json +2 -2
- package/src/feature/block-edit/index.ts +78 -38
- package/src/feature/block-edit/menu/config.ts +306 -240
- package/src/feature/block-edit/menu/utils.ts +1 -106
- package/src/feature/latex/command.ts +48 -0
- package/src/feature/latex/index.ts +2 -0
- package/src/feature/toolbar/component.tsx +44 -194
- package/src/feature/toolbar/config.ts +136 -0
- package/src/feature/toolbar/index.ts +3 -0
- package/src/utils/checker.ts +11 -0
- package/src/utils/group-builder.ts +68 -0
- package/src/utils/index.ts +3 -11
- package/src/utils/types.ts +9 -0
- package/lib/types/feature/block-edit/menu/group-builder.d.ts +0 -29
- package/lib/types/feature/block-edit/menu/group-builder.d.ts.map +0 -1
- package/src/feature/block-edit/menu/group-builder.ts +0 -49
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export type DeepPartial<T> = {
|
|
2
|
+
[K in keyof T]?: T[K] extends (...args: any[]) => any
|
|
3
|
+
? T[K]
|
|
4
|
+
: T[K] extends Record<string, any>
|
|
5
|
+
? DeepPartial<T[K]>
|
|
6
|
+
: T[K] extends Record<string, any> | null | undefined
|
|
7
|
+
? DeepPartial<T[K]> | null | undefined
|
|
8
|
+
: T[K]
|
|
9
|
+
}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import type { MenuItem } from './utils';
|
|
2
|
-
export declare class GroupBuilder {
|
|
3
|
-
#private;
|
|
4
|
-
clear: () => this;
|
|
5
|
-
addGroup: (key: string, label: string) => {
|
|
6
|
-
group: {
|
|
7
|
-
key: string;
|
|
8
|
-
label: string;
|
|
9
|
-
items: Omit<MenuItem, "index">[];
|
|
10
|
-
};
|
|
11
|
-
addItem: (key: string, item: Omit<MenuItem, "key" | "index">) => /*elided*/ any;
|
|
12
|
-
clear: () => /*elided*/ any;
|
|
13
|
-
};
|
|
14
|
-
getGroup: (key: string) => {
|
|
15
|
-
group: {
|
|
16
|
-
key: string;
|
|
17
|
-
label: string;
|
|
18
|
-
items: Omit<MenuItem, "index">[];
|
|
19
|
-
};
|
|
20
|
-
addItem: (key: string, item: Omit<MenuItem, "key" | "index">) => /*elided*/ any;
|
|
21
|
-
clear: () => /*elided*/ any;
|
|
22
|
-
};
|
|
23
|
-
build: () => {
|
|
24
|
-
key: string;
|
|
25
|
-
label: string;
|
|
26
|
-
items: Omit<MenuItem, "index">[];
|
|
27
|
-
}[];
|
|
28
|
-
}
|
|
29
|
-
//# sourceMappingURL=group-builder.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"group-builder.d.ts","sourceRoot":"","sources":["../../../../../src/feature/block-edit/menu/group-builder.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAiB,MAAM,SAAS,CAAA;AAEtD,qBAAa,YAAY;;IAGvB,KAAK,aAGJ;IAkBD,QAAQ,GAAI,KAAK,MAAM,EAAE,OAAO,MAAM;;;;;;uBAbnB,MAAM,QAAQ,IAAI,CAAC,QAAQ,EAAE,KAAK,GAAG,OAAO,CAAC;;MAuB/D;IAED,QAAQ,GAAI,KAAK,MAAM;;;;;;uBAzBJ,MAAM,QAAQ,IAAI,CAAC,QAAQ,EAAE,KAAK,GAAG,OAAO,CAAC;;MA8B/D;IAED,KAAK;;;;QAEJ;CACF"}
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import type { MenuItem, MenuItemGroup } from './utils'
|
|
2
|
-
|
|
3
|
-
export class GroupBuilder {
|
|
4
|
-
#groups: MenuItemGroup<false>[] = []
|
|
5
|
-
|
|
6
|
-
clear = () => {
|
|
7
|
-
this.#groups = []
|
|
8
|
-
return this
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
#getGroupInstance = (group: MenuItemGroup<false>) => {
|
|
12
|
-
const groupInstance = {
|
|
13
|
-
group,
|
|
14
|
-
addItem: (key: string, item: Omit<MenuItem, 'key' | 'index'>) => {
|
|
15
|
-
const data = { key, ...item }
|
|
16
|
-
group.items.push(data)
|
|
17
|
-
return groupInstance
|
|
18
|
-
},
|
|
19
|
-
clear: () => {
|
|
20
|
-
group.items = []
|
|
21
|
-
return groupInstance
|
|
22
|
-
},
|
|
23
|
-
}
|
|
24
|
-
return groupInstance
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
addGroup = (key: string, label: string) => {
|
|
28
|
-
const items: Omit<MenuItem, 'index'>[] = []
|
|
29
|
-
const group: MenuItemGroup<false> = {
|
|
30
|
-
key,
|
|
31
|
-
label,
|
|
32
|
-
items,
|
|
33
|
-
}
|
|
34
|
-
this.#groups.push(group)
|
|
35
|
-
|
|
36
|
-
return this.#getGroupInstance(group)
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
getGroup = (key: string) => {
|
|
40
|
-
const group = this.#groups.find((group) => group.key === key)
|
|
41
|
-
if (!group) throw new Error(`Group with key ${key} not found`)
|
|
42
|
-
|
|
43
|
-
return this.#getGroupInstance(group)
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
build = () => {
|
|
47
|
-
return this.#groups
|
|
48
|
-
}
|
|
49
|
-
}
|