lakelib 0.1.14 → 0.1.16
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 +15 -5
- package/dist/lake.css +135 -56
- package/dist/lake.min.js +45 -43
- package/dist/lake.min.js.map +1 -1
- package/lib/lake.css +135 -56
- package/lib/lake.js +631 -574
- package/lib/lake.js.map +1 -1
- package/lib/types/boxes/emoji.d.ts +2 -0
- package/lib/types/css/index.d.ts +2 -1
- package/lib/types/editor.d.ts +4 -3
- package/lib/types/i18n/en-US/index.d.ts +1 -0
- package/lib/types/i18n/ja/index.d.ts +1 -0
- package/lib/types/i18n/ko/index.d.ts +1 -0
- package/lib/types/i18n/types.d.ts +8 -0
- package/lib/types/i18n/zh-CN/index.d.ts +1 -0
- package/lib/types/index.d.ts +4 -2
- package/lib/types/managers/selection.d.ts +0 -2
- package/lib/types/models/box.d.ts +0 -2
- package/lib/types/models/fragment.d.ts +3 -1
- package/lib/types/models/nodes.d.ts +2 -4
- package/lib/types/operations/insert-fragment.d.ts +2 -1
- package/lib/types/plugins/emoji.d.ts +3 -0
- package/lib/types/types/dropdown.d.ts +5 -3
- package/lib/types/utils/from-base64.d.ts +1 -0
- package/lib/types/utils/index.d.ts +3 -0
- package/lib/types/utils/to-base64.d.ts +1 -0
- package/package.json +17 -19
- package/lib/types/operations/insert-contents.d.ts +0 -2
- /package/lib/types/{ui/upload.d.ts → utils/upload-file.d.ts} +0 -0
package/lib/types/css/index.d.ts
CHANGED
|
@@ -14,8 +14,9 @@ import './list.css';
|
|
|
14
14
|
import './block-quote.css';
|
|
15
15
|
import './table.css';
|
|
16
16
|
import './hr.css';
|
|
17
|
-
import './video.css';
|
|
18
17
|
import './code-block.css';
|
|
19
18
|
import './image.css';
|
|
19
|
+
import './video.css';
|
|
20
20
|
import './file.css';
|
|
21
|
+
import './emoji.css';
|
|
21
22
|
import './toolbar.css';
|
package/lib/types/editor.d.ts
CHANGED
|
@@ -9,7 +9,7 @@ import { Keystroke } from './managers/keystroke';
|
|
|
9
9
|
import { BoxManager } from './managers/box-manager';
|
|
10
10
|
import { Plugin } from './managers/plugin';
|
|
11
11
|
import { Toolbar } from './ui/toolbar';
|
|
12
|
-
type
|
|
12
|
+
type OnMessage = (type: 'success' | 'error' | 'warning', message: string) => void;
|
|
13
13
|
type Config = {
|
|
14
14
|
value: string;
|
|
15
15
|
readonly: boolean;
|
|
@@ -19,7 +19,8 @@ type Config = {
|
|
|
19
19
|
indentWithTab: boolean;
|
|
20
20
|
lang: string;
|
|
21
21
|
minChangeSize: number;
|
|
22
|
-
|
|
22
|
+
historySize: number;
|
|
23
|
+
onMessage: OnMessage;
|
|
23
24
|
[name: string]: any;
|
|
24
25
|
};
|
|
25
26
|
type EditorConfig = {
|
|
@@ -33,7 +34,7 @@ type EditorConfig = {
|
|
|
33
34
|
indentWithTab?: boolean;
|
|
34
35
|
lang?: string;
|
|
35
36
|
minChangeSize?: number;
|
|
36
|
-
onMessage?:
|
|
37
|
+
onMessage?: OnMessage;
|
|
37
38
|
[name: string]: any;
|
|
38
39
|
};
|
|
39
40
|
export declare class Editor {
|
|
@@ -182,6 +182,10 @@ type RootTranslation = {
|
|
|
182
182
|
* File
|
|
183
183
|
*/
|
|
184
184
|
file: string;
|
|
185
|
+
/**
|
|
186
|
+
* Emoji
|
|
187
|
+
*/
|
|
188
|
+
emoji: string;
|
|
185
189
|
/**
|
|
186
190
|
* Remove color
|
|
187
191
|
*/
|
|
@@ -468,6 +472,10 @@ export type TranslationFunctions = {
|
|
|
468
472
|
* File
|
|
469
473
|
*/
|
|
470
474
|
file: () => LocalizedString;
|
|
475
|
+
/**
|
|
476
|
+
* Emoji
|
|
477
|
+
*/
|
|
478
|
+
emoji: () => LocalizedString;
|
|
471
479
|
/**
|
|
472
480
|
* Remove color
|
|
473
481
|
*/
|
package/lib/types/index.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import './elements/box';
|
|
|
3
3
|
import './elements/bookmark';
|
|
4
4
|
import { BoxComponent } from './types/box';
|
|
5
5
|
import { ToolbarItem } from './types/toolbar';
|
|
6
|
+
import { DropdownMenuItem } from './types/dropdown';
|
|
6
7
|
import { icons } from './icons';
|
|
7
8
|
import * as Utils from './utils';
|
|
8
9
|
import { Nodes } from './models/nodes';
|
|
@@ -15,7 +16,6 @@ import { insertBookmark } from './operations/insert-bookmark';
|
|
|
15
16
|
import { toBookmark } from './operations/to-bookmark';
|
|
16
17
|
import { insertNode } from './operations/insert-node';
|
|
17
18
|
import { insertFragment } from './operations/insert-fragment';
|
|
18
|
-
import { insertContents } from './operations/insert-contents';
|
|
19
19
|
import { deleteContents } from './operations/delete-contents';
|
|
20
20
|
import { setBlocks } from './operations/set-blocks';
|
|
21
21
|
import { splitBlock } from './operations/split-block';
|
|
@@ -24,8 +24,10 @@ import { addMark } from './operations/add-mark';
|
|
|
24
24
|
import { removeMark } from './operations/remove-mark';
|
|
25
25
|
import { fixList } from './operations/fix-list';
|
|
26
26
|
import { insertLink } from './operations/insert-link';
|
|
27
|
+
import { insertBox } from './operations/insert-box';
|
|
28
|
+
import { removeBox } from './operations/remove-box';
|
|
27
29
|
import { Button } from './ui/button';
|
|
28
30
|
import { Dropdown } from './ui/dropdown';
|
|
29
31
|
import { Editor } from './editor';
|
|
30
32
|
import { Toolbar } from './ui/toolbar';
|
|
31
|
-
export { Editor, Toolbar, ToolbarItem, BoxComponent, icons, Utils, Nodes, Fragment, Range, Box, HTMLParser, TextParser, insertBookmark, toBookmark, insertNode, insertFragment,
|
|
33
|
+
export { Editor, Toolbar, ToolbarItem, DropdownMenuItem, BoxComponent, icons, Utils, Nodes, Fragment, Range, Box, HTMLParser, TextParser, insertBookmark, toBookmark, insertNode, insertFragment, deleteContents, setBlocks, splitBlock, splitMarks, addMark, removeMark, fixList, insertLink, insertBox, removeBox, Button, Dropdown, };
|
|
@@ -6,7 +6,6 @@ import { insertBookmark } from '../operations/insert-bookmark';
|
|
|
6
6
|
import { toBookmark } from '../operations/to-bookmark';
|
|
7
7
|
import { insertNode } from '../operations/insert-node';
|
|
8
8
|
import { insertFragment } from '../operations/insert-fragment';
|
|
9
|
-
import { insertContents } from '../operations/insert-contents';
|
|
10
9
|
import { deleteContents } from '../operations/delete-contents';
|
|
11
10
|
import { setBlocks } from '../operations/set-blocks';
|
|
12
11
|
import { splitBlock } from '../operations/split-block';
|
|
@@ -31,7 +30,6 @@ export declare class Selection {
|
|
|
31
30
|
toBookmark(bookmark: Parameters<typeof toBookmark>[1]): ReturnType<typeof toBookmark>;
|
|
32
31
|
insertNode(node: Parameters<typeof insertNode>[1]): ReturnType<typeof insertNode>;
|
|
33
32
|
insertFragment(fragment: Parameters<typeof insertFragment>[1]): ReturnType<typeof insertFragment>;
|
|
34
|
-
insertContents(value: Parameters<typeof insertContents>[1]): ReturnType<typeof insertContents>;
|
|
35
33
|
deleteContents(): ReturnType<typeof deleteContents>;
|
|
36
34
|
setBlocks(value: Parameters<typeof setBlocks>[1]): ReturnType<typeof setBlocks>;
|
|
37
35
|
splitBlock(): ReturnType<typeof splitBlock>;
|
|
@@ -15,8 +15,6 @@ export declare class Box {
|
|
|
15
15
|
set value(value: BoxValue);
|
|
16
16
|
updateValue(valueKey: string, valueValue: string): void;
|
|
17
17
|
updateValue(valueKey: BoxValue): void;
|
|
18
|
-
getData(key: string): any;
|
|
19
|
-
setData(key: string, value: any): void;
|
|
20
18
|
getEditor(): Editor | undefined;
|
|
21
19
|
getContainer(): Nodes;
|
|
22
20
|
setToolbar(items: ('|' | BoxToolbarItem)[]): void;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
import { NativeNode } from '../types/native';
|
|
1
2
|
import { Nodes } from './nodes';
|
|
2
3
|
export declare class Fragment {
|
|
3
4
|
private fragment;
|
|
4
5
|
constructor(fragment?: DocumentFragment);
|
|
6
|
+
get(): DocumentFragment;
|
|
5
7
|
find(selector: string): Nodes;
|
|
6
|
-
append(node: Nodes): void;
|
|
8
|
+
append(node: string | NativeNode | Nodes): void;
|
|
7
9
|
}
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { KeyValue } from '../types/object';
|
|
2
2
|
import { NativeNode } from '../types/native';
|
|
3
3
|
import { NodePath } from '../types/node';
|
|
4
|
-
type EachCallback = (element: NativeNode, index: number) => boolean | void;
|
|
5
|
-
type EachElementCallback = (element: Element, index: number) => boolean | void;
|
|
6
4
|
type EventItem = {
|
|
7
5
|
type: string;
|
|
8
6
|
listener: EventListener;
|
|
@@ -36,8 +34,8 @@ export declare class Nodes {
|
|
|
36
34
|
get(index: number): NativeNode;
|
|
37
35
|
getAll(): NativeNode[];
|
|
38
36
|
eq(index: number): Nodes;
|
|
39
|
-
each(callback:
|
|
40
|
-
eachElement(callback:
|
|
37
|
+
each(callback: (element: NativeNode, index: number) => boolean | void): this;
|
|
38
|
+
eachElement(callback: (element: Element, index: number) => boolean | void): this;
|
|
41
39
|
reverse(): Nodes;
|
|
42
40
|
matches(selector: string): boolean;
|
|
43
41
|
find(selector: string | NodePath): Nodes;
|
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
import { Range } from '../models/range';
|
|
2
|
-
|
|
2
|
+
import { Fragment } from '../models/fragment';
|
|
3
|
+
export declare function insertFragment(range: Range, fragment: DocumentFragment | Fragment): void;
|
|
@@ -9,9 +9,11 @@ export type DropdownItem = {
|
|
|
9
9
|
icon?: string;
|
|
10
10
|
accentIcon?: string;
|
|
11
11
|
downIcon?: string;
|
|
12
|
-
defaultValue
|
|
12
|
+
defaultValue?: string;
|
|
13
13
|
tooltip: string | ((locale: TranslationFunctions) => string);
|
|
14
|
-
width
|
|
15
|
-
menuType: 'list' | 'color';
|
|
14
|
+
width?: string;
|
|
15
|
+
menuType: 'list' | 'icon' | 'character' | 'color';
|
|
16
16
|
menuItems: DropdownMenuItem[];
|
|
17
|
+
menuWidth?: string;
|
|
18
|
+
menuHeight?: string;
|
|
17
19
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function fromBase64(value: string): string;
|
|
@@ -3,6 +3,8 @@ export * from './safe-template';
|
|
|
3
3
|
export * from './camel-case';
|
|
4
4
|
export * from './in-string';
|
|
5
5
|
export * from './encode';
|
|
6
|
+
export * from './to-base64';
|
|
7
|
+
export * from './from-base64';
|
|
6
8
|
export * from './to-hex';
|
|
7
9
|
export * from './parse-style';
|
|
8
10
|
export * from './normalize-value';
|
|
@@ -26,4 +28,5 @@ export * from './morph';
|
|
|
26
28
|
export * from './node-and-view';
|
|
27
29
|
export * from './get-box';
|
|
28
30
|
export * from './request';
|
|
31
|
+
export * from './upload-file';
|
|
29
32
|
export * from './debug';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function toBase64(value: string): string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lakelib",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.16",
|
|
4
4
|
"description": "Rich text editor based on the browser",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"rich text",
|
|
@@ -27,27 +27,25 @@
|
|
|
27
27
|
"pre-commit": "pnpm sort:package && pnpm lint"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"
|
|
31
|
-
"@types/lodash": "^4.17.0",
|
|
32
|
-
"blueimp-md5": "^2.19.0",
|
|
30
|
+
"debounce": "^2.1.0",
|
|
33
31
|
"eventemitter3": "^5.0.1",
|
|
34
|
-
"
|
|
35
|
-
"
|
|
36
|
-
"photoswipe": "^5.4.3",
|
|
32
|
+
"fast-deep-equal": "^3.1.3",
|
|
33
|
+
"photoswipe": "^5.4.4",
|
|
37
34
|
"tinykeys": "^2.1.0",
|
|
38
35
|
"typesafe-i18n": "^5.26.2"
|
|
39
36
|
},
|
|
40
37
|
"devDependencies": {
|
|
41
|
-
"@rollup/plugin-commonjs": "^
|
|
38
|
+
"@rollup/plugin-commonjs": "^26.0.1",
|
|
42
39
|
"@rollup/plugin-json": "^6.1.0",
|
|
43
40
|
"@rollup/plugin-node-resolve": "^15.2.3",
|
|
44
41
|
"@rollup/plugin-terser": "^0.4.4",
|
|
45
42
|
"@rollup/plugin-typescript": "^11.1.6",
|
|
46
|
-
"@types/chai": "^4.3.
|
|
43
|
+
"@types/chai": "^4.3.16",
|
|
47
44
|
"@types/mocha": "^10.0.6",
|
|
48
45
|
"@types/sinon": "^17.0.3",
|
|
49
|
-
"@typescript-eslint/eslint-plugin": "^7.
|
|
50
|
-
"@typescript-eslint/parser": "^7.
|
|
46
|
+
"@typescript-eslint/eslint-plugin": "^7.13.1",
|
|
47
|
+
"@typescript-eslint/parser": "^7.13.1",
|
|
48
|
+
"bundle-phobia-cli": "^0.14.14",
|
|
51
49
|
"chai": "^4.4.1",
|
|
52
50
|
"eslint": "^8.57.0",
|
|
53
51
|
"eslint-config-airbnb-base": "^15.0.0",
|
|
@@ -58,22 +56,21 @@
|
|
|
58
56
|
"mocha": "^10.4.0",
|
|
59
57
|
"multer": "1.4.5-lts.1",
|
|
60
58
|
"npm-run-all": "^4.1.5",
|
|
61
|
-
"picocolors": "^1.0.
|
|
59
|
+
"picocolors": "^1.0.1",
|
|
62
60
|
"prompts": "^2.4.2",
|
|
63
|
-
"puppeteer": "^22.
|
|
64
|
-
"rimraf": "^5.0.
|
|
65
|
-
"rollup": "^4.
|
|
61
|
+
"puppeteer": "^22.11.2",
|
|
62
|
+
"rimraf": "^5.0.7",
|
|
63
|
+
"rollup": "^4.18.0",
|
|
66
64
|
"rollup-plugin-import-css": "^3.5.0",
|
|
67
65
|
"rollup-plugin-svg-import": "^3.0.0",
|
|
68
|
-
"semver": "^7.6.
|
|
66
|
+
"semver": "^7.6.2",
|
|
69
67
|
"simple-git-hooks": "^2.11.1",
|
|
70
|
-
"sinon": "^
|
|
68
|
+
"sinon": "^18.0.0",
|
|
71
69
|
"sort-package-json": "^2.10.0",
|
|
72
|
-
"tslib": "^2.6.
|
|
70
|
+
"tslib": "^2.6.3",
|
|
73
71
|
"typescript": "^5.4.5",
|
|
74
72
|
"wait-on": "^7.2.0"
|
|
75
73
|
},
|
|
76
|
-
"packageManager": "pnpm@8.15.6",
|
|
77
74
|
"scripts": {
|
|
78
75
|
"dev": "npm-run-all --parallel --print-label dev:express dev:rollup",
|
|
79
76
|
"dev:express": "node ./scripts/start-server.mjs",
|
|
@@ -81,6 +78,7 @@
|
|
|
81
78
|
"dev:lib": "rollup --watch --config rollup.config.mjs --es",
|
|
82
79
|
"build": "rimraf ./dist ./lib && rollup --config rollup.config.mjs --iife --es",
|
|
83
80
|
"i18n": "typesafe-i18n --no-watch",
|
|
81
|
+
"cost": "bundle-phobia debounce eventemitter3 fast-deep-equal photoswipe tinykeys typesafe-i18n",
|
|
84
82
|
"sort:package": "sort-package-json",
|
|
85
83
|
"lint": "eslint . --config .eslintrc.cjs --ext \".ts,.js,.cjs,.mjs\"",
|
|
86
84
|
"test": "node ./scripts/run-tests.mjs",
|
|
File without changes
|