@guardian/stand 0.0.0 → 0.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.
- package/.changeset/README.md +8 -0
- package/.changeset/config.json +11 -0
- package/.prettierrc +1 -0
- package/.storybook/main.ts +12 -0
- package/.storybook/preview.tsx +83 -0
- package/CHANGELOG.md +7 -0
- package/README.md +15 -0
- package/dist/byline/Byline.cjs +375 -0
- package/dist/byline/Byline.js +273 -0
- package/dist/byline/Preview.cjs +52 -0
- package/dist/byline/Preview.js +26 -0
- package/dist/byline/lib.cjs +240 -0
- package/dist/byline/lib.js +181 -0
- package/dist/byline/placeholder.cjs +29 -0
- package/dist/byline/placeholder.js +27 -0
- package/dist/byline/plugins.cjs +144 -0
- package/dist/byline/plugins.js +123 -0
- package/dist/byline/schema.cjs +66 -0
- package/dist/byline/schema.js +59 -0
- package/dist/byline/styles.cjs +244 -0
- package/dist/byline/styles.js +234 -0
- package/dist/index.cjs +4 -4
- package/dist/index.js +1 -5
- package/dist/types/.storybook/main.d.ts +3 -0
- package/dist/types/.storybook/preview.d.ts +3 -0
- package/dist/types/jest-setup-after-env.d.ts +1 -0
- package/dist/types/src/byline/Byline.d.ts +17 -0
- package/dist/types/src/byline/Byline.stories.d.ts +206 -0
- package/dist/types/src/byline/Byline.test.d.ts +1 -0
- package/dist/types/src/byline/Preview.d.ts +4 -0
- package/dist/types/src/byline/contributors-fixture.d.ts +1 -0
- package/dist/types/src/byline/lib.d.ts +48 -0
- package/dist/types/src/byline/lib.test.d.ts +1 -0
- package/dist/types/src/byline/placeholder.d.ts +2 -0
- package/dist/types/src/byline/plugins.d.ts +4 -0
- package/dist/types/src/byline/schema.d.ts +2 -0
- package/dist/types/src/byline/styles.d.ts +11 -0
- package/dist/types/src/byline/theme.d.ts +44 -0
- package/dist/types/src/byline/util.d.ts +3 -0
- package/dist/types/src/index.d.ts +2 -0
- package/dist/types/src/mocks/prosemirror-view.d.ts +10 -0
- package/eslint.config.js +14 -0
- package/jest-setup-after-env.ts +1 -0
- package/jest.config.js +12 -0
- package/package.json +60 -129
- package/rollup.config.js +49 -0
- package/src/byline/Byline.stories.tsx +186 -0
- package/src/byline/Byline.test.tsx +450 -0
- package/src/byline/Byline.tsx +524 -0
- package/src/byline/Preview.tsx +59 -0
- package/src/byline/contributors-fixture.ts +1006 -0
- package/src/byline/lib.test.ts +179 -0
- package/src/byline/lib.ts +426 -0
- package/src/byline/placeholder.ts +30 -0
- package/src/byline/plugins.ts +186 -0
- package/src/byline/schema.ts +62 -0
- package/src/byline/styles.ts +246 -0
- package/src/byline/theme.ts +45 -0
- package/src/byline/util.ts +5 -0
- package/src/index.ts +2 -0
- package/src/mocks/prosemirror-view.ts +19 -0
- package/tsconfig.json +19 -0
- package/LICENSE +0 -201
- package/dist/index.d.ts +0 -3
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { TaggedContributor } from './lib';
|
|
3
|
+
declare const meta: {
|
|
4
|
+
title: string;
|
|
5
|
+
component: ({ theme, allowUntaggedContributors, contributorLimit, enablePreview, placeholder, initialValue, readOnly, handleSave, searchContributors, onBlur, }: {
|
|
6
|
+
theme?: {
|
|
7
|
+
editor?: {
|
|
8
|
+
invisibles?: {
|
|
9
|
+
color?: string | undefined;
|
|
10
|
+
} | undefined;
|
|
11
|
+
color?: string | undefined;
|
|
12
|
+
border?: string | undefined;
|
|
13
|
+
background?: string | undefined;
|
|
14
|
+
chip?: {
|
|
15
|
+
color?: string | undefined;
|
|
16
|
+
border?: string | undefined;
|
|
17
|
+
padding?: string | undefined;
|
|
18
|
+
borderRadius?: string | undefined;
|
|
19
|
+
taggedBackground?: string | undefined;
|
|
20
|
+
untagged?: {
|
|
21
|
+
color?: string | undefined;
|
|
22
|
+
} | undefined;
|
|
23
|
+
selected?: {
|
|
24
|
+
border?: string | undefined;
|
|
25
|
+
} | undefined;
|
|
26
|
+
} | undefined;
|
|
27
|
+
lineHeight?: string | undefined;
|
|
28
|
+
placeholder?: {
|
|
29
|
+
color?: string | undefined;
|
|
30
|
+
} | undefined;
|
|
31
|
+
readOnlyBackground?: string | undefined;
|
|
32
|
+
} | undefined;
|
|
33
|
+
dropdown?: {
|
|
34
|
+
background?: string | undefined;
|
|
35
|
+
border?: string | undefined;
|
|
36
|
+
maxHeight?: string | undefined;
|
|
37
|
+
li?: {
|
|
38
|
+
color?: string | undefined;
|
|
39
|
+
borderBottom?: string | undefined;
|
|
40
|
+
selected?: {
|
|
41
|
+
background?: string | undefined;
|
|
42
|
+
color?: string | undefined;
|
|
43
|
+
} | undefined;
|
|
44
|
+
} | undefined;
|
|
45
|
+
} | undefined;
|
|
46
|
+
} | undefined;
|
|
47
|
+
allowUntaggedContributors?: boolean | undefined;
|
|
48
|
+
contributorLimit?: number | undefined;
|
|
49
|
+
enablePreview?: boolean | undefined;
|
|
50
|
+
placeholder?: string | undefined;
|
|
51
|
+
initialValue?: import("./lib").BylineModel | undefined;
|
|
52
|
+
readOnly?: boolean | undefined;
|
|
53
|
+
handleSave: (newValue: import("./lib").BylineModel) => void;
|
|
54
|
+
searchContributors?: ((selectedText: string) => Promise<TaggedContributor[]>) | undefined;
|
|
55
|
+
onBlur?: import("react").FocusEventHandler<HTMLDivElement> | undefined;
|
|
56
|
+
}) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
57
|
+
parameters: {};
|
|
58
|
+
args: {
|
|
59
|
+
handleSave: () => void;
|
|
60
|
+
initialValue: never[];
|
|
61
|
+
searchContributors: (selectedText: string) => Promise<TaggedContributor[]>;
|
|
62
|
+
enablePreview: true;
|
|
63
|
+
};
|
|
64
|
+
};
|
|
65
|
+
export declare const Default: {};
|
|
66
|
+
export declare const WithTheme: {
|
|
67
|
+
args: {
|
|
68
|
+
allowUntaggedContributors: true;
|
|
69
|
+
searchContributors: (selectedText: string) => Promise<TaggedContributor[]>;
|
|
70
|
+
theme: {
|
|
71
|
+
editor: {
|
|
72
|
+
invisibles: {
|
|
73
|
+
color: string;
|
|
74
|
+
};
|
|
75
|
+
color: string;
|
|
76
|
+
background: string;
|
|
77
|
+
border: string;
|
|
78
|
+
chip: {
|
|
79
|
+
color: string;
|
|
80
|
+
taggedBackground: string;
|
|
81
|
+
border: string;
|
|
82
|
+
borderRadius: string;
|
|
83
|
+
padding: string;
|
|
84
|
+
untagged: {
|
|
85
|
+
color: string;
|
|
86
|
+
};
|
|
87
|
+
};
|
|
88
|
+
};
|
|
89
|
+
dropdown: {
|
|
90
|
+
background: string;
|
|
91
|
+
li: {
|
|
92
|
+
color: string;
|
|
93
|
+
borderBottom: string;
|
|
94
|
+
selected: {
|
|
95
|
+
color: string;
|
|
96
|
+
background: string;
|
|
97
|
+
};
|
|
98
|
+
};
|
|
99
|
+
};
|
|
100
|
+
};
|
|
101
|
+
};
|
|
102
|
+
};
|
|
103
|
+
export declare const WithUntaggedContributors: {
|
|
104
|
+
parameters: {
|
|
105
|
+
chromatic: {
|
|
106
|
+
disableSnapshot: boolean;
|
|
107
|
+
};
|
|
108
|
+
};
|
|
109
|
+
args: {
|
|
110
|
+
allowUntaggedContributors: true;
|
|
111
|
+
};
|
|
112
|
+
};
|
|
113
|
+
export declare const WithInitialValue: {
|
|
114
|
+
args: {
|
|
115
|
+
allowUntaggedContributors: true;
|
|
116
|
+
initialValue: ({
|
|
117
|
+
type: "contributor";
|
|
118
|
+
value: string;
|
|
119
|
+
tagId: string;
|
|
120
|
+
path: string;
|
|
121
|
+
} | {
|
|
122
|
+
type: "text";
|
|
123
|
+
value: string;
|
|
124
|
+
tagId?: undefined;
|
|
125
|
+
path?: undefined;
|
|
126
|
+
} | {
|
|
127
|
+
type: "contributor";
|
|
128
|
+
value: string;
|
|
129
|
+
tagId?: undefined;
|
|
130
|
+
path?: undefined;
|
|
131
|
+
})[];
|
|
132
|
+
};
|
|
133
|
+
};
|
|
134
|
+
export declare const WithNoSearch: {
|
|
135
|
+
parameters: {
|
|
136
|
+
chromatic: {
|
|
137
|
+
disableSnapshot: boolean;
|
|
138
|
+
};
|
|
139
|
+
};
|
|
140
|
+
args: {
|
|
141
|
+
allowUntaggedContributors: true;
|
|
142
|
+
searchContributors: undefined;
|
|
143
|
+
};
|
|
144
|
+
};
|
|
145
|
+
export declare const WithNoSearchAndNoUntagged: {
|
|
146
|
+
parameters: {
|
|
147
|
+
chromatic: {
|
|
148
|
+
disableSnapshot: boolean;
|
|
149
|
+
};
|
|
150
|
+
};
|
|
151
|
+
args: {
|
|
152
|
+
allowUntaggedContributors: false;
|
|
153
|
+
searchContributors: undefined;
|
|
154
|
+
};
|
|
155
|
+
};
|
|
156
|
+
export declare const WithCustomPlaceholder: {
|
|
157
|
+
args: {
|
|
158
|
+
allowUntaggedContributors: true;
|
|
159
|
+
placeholder: string;
|
|
160
|
+
};
|
|
161
|
+
};
|
|
162
|
+
export declare const WithContributorLimit: {
|
|
163
|
+
parameters: {
|
|
164
|
+
chromatic: {
|
|
165
|
+
disableSnapshot: boolean;
|
|
166
|
+
};
|
|
167
|
+
};
|
|
168
|
+
args: {
|
|
169
|
+
contributorLimit: number;
|
|
170
|
+
};
|
|
171
|
+
};
|
|
172
|
+
export declare const WithoutPreview: {
|
|
173
|
+
parameters: {
|
|
174
|
+
chromatic: {
|
|
175
|
+
disableSnapshot: boolean;
|
|
176
|
+
};
|
|
177
|
+
};
|
|
178
|
+
args: {
|
|
179
|
+
allowUntaggedContributors: true;
|
|
180
|
+
enablePreview: false;
|
|
181
|
+
};
|
|
182
|
+
};
|
|
183
|
+
export declare const ReadOnly: {
|
|
184
|
+
args: {
|
|
185
|
+
readOnly: true;
|
|
186
|
+
allowUntaggedContributors: true;
|
|
187
|
+
enablePreview: true;
|
|
188
|
+
initialValue: ({
|
|
189
|
+
type: "contributor";
|
|
190
|
+
value: string;
|
|
191
|
+
tagId: string;
|
|
192
|
+
path: string;
|
|
193
|
+
} | {
|
|
194
|
+
type: "text";
|
|
195
|
+
value: string;
|
|
196
|
+
tagId?: undefined;
|
|
197
|
+
path?: undefined;
|
|
198
|
+
} | {
|
|
199
|
+
type: "contributor";
|
|
200
|
+
value: string;
|
|
201
|
+
tagId?: undefined;
|
|
202
|
+
path?: undefined;
|
|
203
|
+
})[];
|
|
204
|
+
};
|
|
205
|
+
};
|
|
206
|
+
export default meta;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const contributors: string[];
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type { Node } from 'prosemirror-model';
|
|
2
|
+
import type { Command } from 'prosemirror-state';
|
|
3
|
+
import type { EditorView } from 'prosemirror-view';
|
|
4
|
+
export type TypingFromStartRange = {
|
|
5
|
+
start: number;
|
|
6
|
+
maxReached: number;
|
|
7
|
+
lastPosition: number;
|
|
8
|
+
};
|
|
9
|
+
export declare const detectNameInText: (text: string, cursorOffset: number, isTypingFromStartRange?: TypingFromStartRange) => {
|
|
10
|
+
name: string;
|
|
11
|
+
startIndex: number;
|
|
12
|
+
endIndex: number;
|
|
13
|
+
} | undefined;
|
|
14
|
+
export declare function insertChip(text: string, from: number, to: number, type: 'tagged', tagId: string, path?: string, meta?: unknown): Command;
|
|
15
|
+
export declare function insertChip(text: string, from: number, to: number, type: 'untagged', tagId?: undefined, meta?: undefined): Command;
|
|
16
|
+
export declare const getCurrentText: (doc: Node, currentOffset: number, toOffset: number, isTypingFromStartRange?: TypingFromStartRange) => {
|
|
17
|
+
currentTextNode: Node | null;
|
|
18
|
+
startOffset: number;
|
|
19
|
+
endOffset: number;
|
|
20
|
+
selectedText: string;
|
|
21
|
+
hasSelection: boolean;
|
|
22
|
+
};
|
|
23
|
+
export declare const hasHitContributorLimit: (doc: Node, contributorLimit?: number) => boolean;
|
|
24
|
+
export type TaggedContributor = {
|
|
25
|
+
tagId: string;
|
|
26
|
+
label: string;
|
|
27
|
+
internalLabel?: string;
|
|
28
|
+
path?: string;
|
|
29
|
+
meta?: unknown;
|
|
30
|
+
};
|
|
31
|
+
export declare const addUntaggedContributor: (viewRef: React.MutableRefObject<EditorView | null>, setShowDropdown: React.Dispatch<React.SetStateAction<boolean>>, contributorLimit?: number, isTypingFromStartRange?: TypingFromStartRange) => boolean | undefined;
|
|
32
|
+
export declare const addTaggedContributor: (contributor: TaggedContributor, viewRef: React.MutableRefObject<EditorView | null>, setShowDropdown: React.Dispatch<React.SetStateAction<boolean>>, contributorLimit?: number, isTypingFromStartRange?: TypingFromStartRange) => boolean | undefined;
|
|
33
|
+
type BylineText = {
|
|
34
|
+
type: 'text';
|
|
35
|
+
value: string;
|
|
36
|
+
};
|
|
37
|
+
type BylineContributor = {
|
|
38
|
+
type: 'contributor';
|
|
39
|
+
value: string;
|
|
40
|
+
tagId?: string;
|
|
41
|
+
path?: string;
|
|
42
|
+
meta?: unknown;
|
|
43
|
+
};
|
|
44
|
+
type BylinePart = BylineText | BylineContributor;
|
|
45
|
+
export type BylineModel = BylinePart[];
|
|
46
|
+
export declare const convertBylineModelToNode: (value?: BylineModel) => Node;
|
|
47
|
+
export declare const convertNodeToBylineModel: (doc: Node) => BylineModel;
|
|
48
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Node } from 'prosemirror-model';
|
|
2
|
+
import type { PartialBylineTheme } from './theme';
|
|
3
|
+
export declare const bylineContainerStyles: import("@emotion/react").SerializedStyles;
|
|
4
|
+
export declare const bylineEditorStyles: (theme: PartialBylineTheme['editor']) => import("@emotion/react").SerializedStyles;
|
|
5
|
+
export declare const dropdownContainerStyles: (showDropdown: boolean, theme?: PartialBylineTheme['dropdown']) => import("@emotion/react").SerializedStyles;
|
|
6
|
+
export declare const dropdownUlStyles: import("@emotion/react").SerializedStyles;
|
|
7
|
+
export declare const dropdownLiStyles: (theme?: PartialBylineTheme) => import("@emotion/react").SerializedStyles;
|
|
8
|
+
export declare const selectedDropdownLiStyles: (theme?: PartialBylineTheme) => import("@emotion/react").SerializedStyles;
|
|
9
|
+
export declare const previewStyles: import("@emotion/react").SerializedStyles;
|
|
10
|
+
export declare const previewFreeTextStyles: import("@emotion/react").SerializedStyles;
|
|
11
|
+
export declare const previewContributorStyles: (node: Node) => import("@emotion/react").SerializedStyles;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { DeepPartial } from './util';
|
|
2
|
+
type BylineTheme = {
|
|
3
|
+
editor: {
|
|
4
|
+
invisibles: {
|
|
5
|
+
color: string;
|
|
6
|
+
};
|
|
7
|
+
color: string;
|
|
8
|
+
border: string;
|
|
9
|
+
background: string;
|
|
10
|
+
chip: {
|
|
11
|
+
color: string;
|
|
12
|
+
border: string;
|
|
13
|
+
padding: string;
|
|
14
|
+
borderRadius: string;
|
|
15
|
+
taggedBackground: string;
|
|
16
|
+
untagged: {
|
|
17
|
+
color: string;
|
|
18
|
+
};
|
|
19
|
+
selected: {
|
|
20
|
+
border: string;
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
lineHeight: string;
|
|
24
|
+
placeholder: {
|
|
25
|
+
color: string;
|
|
26
|
+
};
|
|
27
|
+
readOnlyBackground: string;
|
|
28
|
+
};
|
|
29
|
+
dropdown: {
|
|
30
|
+
background: string;
|
|
31
|
+
border: string;
|
|
32
|
+
maxHeight: string;
|
|
33
|
+
li: {
|
|
34
|
+
color: string;
|
|
35
|
+
borderBottom: string;
|
|
36
|
+
selected: {
|
|
37
|
+
background: string;
|
|
38
|
+
color: string;
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
export type PartialBylineTheme = DeepPartial<BylineTheme>;
|
|
44
|
+
export {};
|
package/eslint.config.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// For more info, see https://github.com/storybookjs/eslint-plugin-storybook#configuration-flat-config-format
|
|
2
|
+
import storybook from 'eslint-plugin-storybook';
|
|
3
|
+
|
|
4
|
+
import guardian from '@guardian/eslint-config';
|
|
5
|
+
|
|
6
|
+
export default [
|
|
7
|
+
{
|
|
8
|
+
ignores: ['dist'],
|
|
9
|
+
},
|
|
10
|
+
...guardian.configs.recommended,
|
|
11
|
+
...guardian.configs.jest,
|
|
12
|
+
...guardian.configs.react,
|
|
13
|
+
...storybook.configs['flat/recommended'],
|
|
14
|
+
];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import '@testing-library/jest-dom';
|
package/jest.config.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { createDefaultPreset } from 'ts-jest';
|
|
2
|
+
|
|
3
|
+
const tsJestTransformCfg = createDefaultPreset().transform;
|
|
4
|
+
|
|
5
|
+
/** @type {import("jest").Config} **/
|
|
6
|
+
export default {
|
|
7
|
+
testEnvironment: 'jsdom',
|
|
8
|
+
setupFilesAfterEnv: ['<rootDir>/jest-setup-after-env.ts'],
|
|
9
|
+
transform: {
|
|
10
|
+
...tsJestTransformCfg,
|
|
11
|
+
},
|
|
12
|
+
};
|
package/package.json
CHANGED
|
@@ -1,143 +1,74 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@guardian/stand",
|
|
3
|
-
"version": "0.0.
|
|
4
|
-
"private": false,
|
|
5
|
-
"description": "",
|
|
6
|
-
"license": "Apache-2.0",
|
|
7
|
-
"sideEffects": false,
|
|
3
|
+
"version": "0.0.2",
|
|
8
4
|
"type": "module",
|
|
9
5
|
"exports": {
|
|
10
|
-
"types": "./dist/index.d.ts",
|
|
6
|
+
"types": "./dist/types/src/index.d.ts",
|
|
11
7
|
"import": "./dist/index.js",
|
|
12
8
|
"require": "./dist/index.cjs"
|
|
13
9
|
},
|
|
14
|
-
"main": "./dist/index.
|
|
15
|
-
"types": "./dist/index.d.ts",
|
|
16
|
-
"
|
|
17
|
-
"
|
|
18
|
-
|
|
10
|
+
"main": "./dist/index.cjs",
|
|
11
|
+
"types": "./dist/types/src/index.d.ts",
|
|
12
|
+
"dependencies": {
|
|
13
|
+
"@emotion/react": "11.11.4",
|
|
14
|
+
"@guardian/prosemirror-invisibles": "3.1.1",
|
|
15
|
+
"prosemirror-dropcursor": "1.8.2",
|
|
16
|
+
"prosemirror-history": "1.4.1",
|
|
17
|
+
"prosemirror-keymap": "1.2.2",
|
|
18
|
+
"prosemirror-model": "1.25.0",
|
|
19
|
+
"prosemirror-state": "1.4.3",
|
|
20
|
+
"prosemirror-view": "1.37.2",
|
|
21
|
+
"react": "17.0.2",
|
|
22
|
+
"react-dom": "17.0.2"
|
|
23
|
+
},
|
|
19
24
|
"devDependencies": {
|
|
20
|
-
"@
|
|
21
|
-
"eslint": "
|
|
22
|
-
"
|
|
23
|
-
"
|
|
24
|
-
"
|
|
25
|
-
"
|
|
26
|
-
"typescript": "
|
|
27
|
-
"
|
|
28
|
-
"@
|
|
25
|
+
"@changesets/cli": "^2.29.7",
|
|
26
|
+
"@guardian/eslint-config": "12.0.0",
|
|
27
|
+
"@guardian/prettier": "8.0.1",
|
|
28
|
+
"@guardian/tsconfig": "1.0.0",
|
|
29
|
+
"@rollup/plugin-commonjs": "28.0.6",
|
|
30
|
+
"@rollup/plugin-node-resolve": "16.0.1",
|
|
31
|
+
"@rollup/plugin-typescript": "12.1.4",
|
|
32
|
+
"@storybook/addon-docs": "^9.1.7",
|
|
33
|
+
"@storybook/addon-themes": "^9.1.7",
|
|
34
|
+
"@storybook/react-vite": "^9.1.7",
|
|
35
|
+
"@testing-library/jest-dom": "6.8.0",
|
|
36
|
+
"@testing-library/react": "12.1.5",
|
|
37
|
+
"@testing-library/user-event": "14.6.1",
|
|
38
|
+
"@types/jest": "30.0.0",
|
|
39
|
+
"@types/react": "17.0.76",
|
|
40
|
+
"@types/react-dom": "17.0.25",
|
|
41
|
+
"eslint": "9.36.0",
|
|
42
|
+
"eslint-plugin-storybook": "^9.1.7",
|
|
43
|
+
"jest": "30.1.3",
|
|
44
|
+
"jest-environment-jsdom": "^30.1.2",
|
|
45
|
+
"prettier": "3.6.2",
|
|
46
|
+
"rimraf": "6.0.1",
|
|
47
|
+
"rollup": "4.52.1",
|
|
48
|
+
"rollup-plugin-esbuild": "6.2.1",
|
|
49
|
+
"rollup-plugin-node-externals": "8.1.1",
|
|
50
|
+
"storybook": "^9.1.7",
|
|
51
|
+
"ts-jest": "29.4.4",
|
|
52
|
+
"tslib": "2.8.1",
|
|
53
|
+
"typescript": "5.1.3"
|
|
29
54
|
},
|
|
30
55
|
"peerDependencies": {
|
|
31
|
-
"
|
|
32
|
-
"
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
"
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
"
|
|
41
|
-
|
|
42
|
-
"wireit": {
|
|
43
|
-
"__deps__": {
|
|
44
|
-
"dependencies": [
|
|
45
|
-
"../libs:build"
|
|
46
|
-
]
|
|
47
|
-
},
|
|
48
|
-
"build": {
|
|
49
|
-
"command": "rollup -c",
|
|
50
|
-
"dependencies": [
|
|
51
|
-
"__deps__"
|
|
52
|
-
],
|
|
53
|
-
"files": [
|
|
54
|
-
"src/**",
|
|
55
|
-
"package.json",
|
|
56
|
-
"tsconfig.json",
|
|
57
|
-
"rollup.config.js",
|
|
58
|
-
"../../../configs/rollup/rollup.config.js"
|
|
59
|
-
],
|
|
60
|
-
"output": [
|
|
61
|
-
"dist"
|
|
62
|
-
]
|
|
63
|
-
},
|
|
64
|
-
"fix": {
|
|
65
|
-
"command": "eslint --cache --color . --fix",
|
|
66
|
-
"dependencies": [
|
|
67
|
-
"__deps__"
|
|
68
|
-
],
|
|
69
|
-
"files": [
|
|
70
|
-
"**",
|
|
71
|
-
"!(dist)/**",
|
|
72
|
-
"!.eslintcache"
|
|
73
|
-
],
|
|
74
|
-
"clean": false,
|
|
75
|
-
"output": [
|
|
76
|
-
"."
|
|
77
|
-
]
|
|
78
|
-
},
|
|
79
|
-
"lint": {
|
|
80
|
-
"command": "eslint --cache --color .",
|
|
81
|
-
"dependencies": [
|
|
82
|
-
"__deps__"
|
|
83
|
-
],
|
|
84
|
-
"files": [
|
|
85
|
-
"**",
|
|
86
|
-
"!(dist)/**",
|
|
87
|
-
"!.eslintcache"
|
|
88
|
-
],
|
|
89
|
-
"output": []
|
|
90
|
-
},
|
|
91
|
-
"test": {
|
|
92
|
-
"command": "jest",
|
|
93
|
-
"dependencies": [
|
|
94
|
-
"__deps__"
|
|
95
|
-
],
|
|
96
|
-
"files": [
|
|
97
|
-
"**",
|
|
98
|
-
"../../../configs/jest.*",
|
|
99
|
-
"!(dist)/**",
|
|
100
|
-
"!.eslintcache"
|
|
101
|
-
],
|
|
102
|
-
"output": []
|
|
103
|
-
},
|
|
104
|
-
"tsc": {
|
|
105
|
-
"command": "tsc --pretty",
|
|
106
|
-
"dependencies": [
|
|
107
|
-
"__deps__"
|
|
108
|
-
],
|
|
109
|
-
"files": [
|
|
110
|
-
"**",
|
|
111
|
-
"tsconfig.json",
|
|
112
|
-
"../tsconfig/tsconfig.json",
|
|
113
|
-
"../../../@types/**",
|
|
114
|
-
"../../../tsconfig.base.json",
|
|
115
|
-
"!(dist)/**",
|
|
116
|
-
"!.eslintcache"
|
|
117
|
-
],
|
|
118
|
-
"output": []
|
|
119
|
-
},
|
|
120
|
-
"verify-dist": {
|
|
121
|
-
"command": "jest --setupFilesAfterEnv ./jest.dist.setup.js",
|
|
122
|
-
"dependencies": [
|
|
123
|
-
"build"
|
|
124
|
-
],
|
|
125
|
-
"files": [
|
|
126
|
-
"**",
|
|
127
|
-
"../../../configs/jest.*",
|
|
128
|
-
"!(dist)/**",
|
|
129
|
-
"!.eslintcache"
|
|
130
|
-
],
|
|
131
|
-
"output": []
|
|
132
|
-
}
|
|
56
|
+
"@emotion/react": "11.11.4",
|
|
57
|
+
"@guardian/prosemirror-invisibles": "3.1.1",
|
|
58
|
+
"prosemirror-dropcursor": "1.8.2",
|
|
59
|
+
"prosemirror-history": "1.4.1",
|
|
60
|
+
"prosemirror-keymap": "1.2.2",
|
|
61
|
+
"prosemirror-model": "1.25.0",
|
|
62
|
+
"prosemirror-state": "1.4.3",
|
|
63
|
+
"prosemirror-view": "1.37.2",
|
|
64
|
+
"react": "^17.0.2",
|
|
65
|
+
"react-dom": "^17.0.2",
|
|
66
|
+
"typescript": "5.5.2"
|
|
133
67
|
},
|
|
134
68
|
"scripts": {
|
|
135
|
-
"build": "
|
|
136
|
-
"
|
|
137
|
-
"
|
|
138
|
-
"
|
|
139
|
-
"test": "wireit",
|
|
140
|
-
"tsc": "wireit",
|
|
141
|
-
"verify-dist": "wireit"
|
|
69
|
+
"build": "rimraf dist && rollup -c",
|
|
70
|
+
"storybook": "storybook dev -p 6007",
|
|
71
|
+
"build-storybook": "storybook build",
|
|
72
|
+
"test": "jest"
|
|
142
73
|
}
|
|
143
74
|
}
|
package/rollup.config.js
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import commonjs from '@rollup/plugin-commonjs';
|
|
2
|
+
import resolve from '@rollup/plugin-node-resolve';
|
|
3
|
+
import typescript from '@rollup/plugin-typescript';
|
|
4
|
+
import esbuild from 'rollup-plugin-esbuild';
|
|
5
|
+
import { nodeExternals } from 'rollup-plugin-node-externals';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* @returns {import("rollup").RollupOptions[]}
|
|
9
|
+
*/
|
|
10
|
+
export default [
|
|
11
|
+
{
|
|
12
|
+
input: 'src/index.ts',
|
|
13
|
+
output: {
|
|
14
|
+
dir: 'dist',
|
|
15
|
+
format: 'esm',
|
|
16
|
+
preserveModules: true,
|
|
17
|
+
preserveModulesRoot: 'src',
|
|
18
|
+
},
|
|
19
|
+
plugins: [
|
|
20
|
+
resolve(),
|
|
21
|
+
nodeExternals(),
|
|
22
|
+
esbuild({
|
|
23
|
+
jsx: 'automatic',
|
|
24
|
+
}),
|
|
25
|
+
typescript({
|
|
26
|
+
tsconfig: './tsconfig.json',
|
|
27
|
+
outDir: 'dist/types',
|
|
28
|
+
}),
|
|
29
|
+
],
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
input: 'src/index.ts',
|
|
33
|
+
output: {
|
|
34
|
+
dir: 'dist',
|
|
35
|
+
format: 'cjs',
|
|
36
|
+
preserveModules: true,
|
|
37
|
+
preserveModulesRoot: 'src',
|
|
38
|
+
entryFileNames: '[name].cjs',
|
|
39
|
+
},
|
|
40
|
+
plugins: [
|
|
41
|
+
resolve(),
|
|
42
|
+
nodeExternals(),
|
|
43
|
+
commonjs(),
|
|
44
|
+
esbuild({
|
|
45
|
+
jsx: 'automatic',
|
|
46
|
+
}),
|
|
47
|
+
],
|
|
48
|
+
},
|
|
49
|
+
];
|