document-model 1.0.1 → 1.0.2
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.
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Draft } from 'immer';
|
|
2
|
+
import type { FC } from 'react';
|
|
2
3
|
import type { DocumentModelState } from '../document-model';
|
|
3
4
|
import type { BaseAction } from './actions/types';
|
|
4
5
|
import { BaseDocument } from './object';
|
|
@@ -152,3 +153,20 @@ export type DocumentModel<S = unknown, A extends Action = Action, C extends Base
|
|
|
152
153
|
utils: DocumentModelUtils<S, A>;
|
|
153
154
|
documentModel: DocumentModelState;
|
|
154
155
|
};
|
|
156
|
+
export type EditorContext = {
|
|
157
|
+
theme: 'light' | 'dark';
|
|
158
|
+
debug?: boolean;
|
|
159
|
+
};
|
|
160
|
+
export type EditorProps<S, A extends Action> = {
|
|
161
|
+
document: Document<S, A>;
|
|
162
|
+
dispatch: (action: A | BaseAction) => void;
|
|
163
|
+
editorContext: EditorContext;
|
|
164
|
+
};
|
|
165
|
+
export type Editor<S = unknown, A extends Action = Action> = {
|
|
166
|
+
Component: FC<EditorProps<S, A>>;
|
|
167
|
+
documentTypes: string[];
|
|
168
|
+
};
|
|
169
|
+
export type DocumentModelLib = {
|
|
170
|
+
documentModels: DocumentModel[];
|
|
171
|
+
editors: Editor[];
|
|
172
|
+
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Draft } from 'immer';
|
|
2
|
+
import type { FC } from 'react';
|
|
2
3
|
import type { DocumentModelState } from '../document-model';
|
|
3
4
|
import type { BaseAction } from './actions/types';
|
|
4
5
|
import { BaseDocument } from './object';
|
|
@@ -152,3 +153,20 @@ export type DocumentModel<S = unknown, A extends Action = Action, C extends Base
|
|
|
152
153
|
utils: DocumentModelUtils<S, A>;
|
|
153
154
|
documentModel: DocumentModelState;
|
|
154
155
|
};
|
|
156
|
+
export type EditorContext = {
|
|
157
|
+
theme: 'light' | 'dark';
|
|
158
|
+
debug?: boolean;
|
|
159
|
+
};
|
|
160
|
+
export type EditorProps<S, A extends Action> = {
|
|
161
|
+
document: Document<S, A>;
|
|
162
|
+
dispatch: (action: A | BaseAction) => void;
|
|
163
|
+
editorContext: EditorContext;
|
|
164
|
+
};
|
|
165
|
+
export type Editor<S = unknown, A extends Action = Action> = {
|
|
166
|
+
Component: FC<EditorProps<S, A>>;
|
|
167
|
+
documentTypes: string[];
|
|
168
|
+
};
|
|
169
|
+
export type DocumentModelLib = {
|
|
170
|
+
documentModels: DocumentModel[];
|
|
171
|
+
editors: Editor[];
|
|
172
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "document-model",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"license": "AGPL-3.0-only",
|
|
5
5
|
"private": false,
|
|
6
6
|
"files": [
|
|
@@ -63,6 +63,7 @@
|
|
|
63
63
|
"@rollup/plugin-node-resolve": "^15.2.1",
|
|
64
64
|
"@types/jest": "^29.5.4",
|
|
65
65
|
"@types/mime": "^3.0.1",
|
|
66
|
+
"@types/react": "^18.2.21",
|
|
66
67
|
"@typescript-eslint/eslint-plugin": "^6.4.1",
|
|
67
68
|
"@typescript-eslint/parser": "^6.4.1",
|
|
68
69
|
"eslint": "^8.48.0",
|
|
@@ -70,6 +71,7 @@
|
|
|
70
71
|
"jest": "^29.6.4",
|
|
71
72
|
"prettier": "^3.0.2",
|
|
72
73
|
"prettier-plugin-organize-imports": "^3.2.3",
|
|
74
|
+
"react": "^18.2.0",
|
|
73
75
|
"rollup-plugin-polyfill-node": "^0.12.0",
|
|
74
76
|
"ts-jest": "^29.1.1",
|
|
75
77
|
"ts-node": "^10.9.1",
|