@atlaskit/editor-common 72.5.1 → 72.6.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/CHANGELOG.md +47 -0
- package/dist/cjs/node-width/index.js +18 -4
- package/dist/cjs/preset/builder.js +180 -0
- package/dist/cjs/preset/index.js +19 -0
- package/dist/cjs/preset/plugin-injection-api.js +223 -0
- package/dist/cjs/styles/shared/media-single.js +1 -1
- package/dist/cjs/styles/shared/panel.js +2 -2
- package/dist/cjs/styles/shared/table.js +2 -1
- package/dist/cjs/styles/shared/tableCell.js +31 -0
- package/dist/cjs/ui/DropList/index.js +6 -3
- package/dist/cjs/ui-color/ColorPalette/Color/styles.js +1 -1
- package/dist/cjs/ui-color/ColorPalette/Palettes/index.js +14 -1
- package/dist/cjs/ui-color/ColorPalette/Palettes/paletteMessagesTokenModeNames.js +139 -8
- package/dist/cjs/ui-color/ColorPalette/index.js +10 -11
- package/dist/cjs/ui-color/index.js +13 -0
- package/dist/cjs/ui-menu/ArrowKeyNavigationProvider/MenuArrowKeyNavigationProvider/index.js +2 -2
- package/dist/cjs/ui-menu/Dropdown/index.js +18 -8
- package/dist/cjs/ui-menu/DropdownMenu/index.js +1 -1
- package/dist/cjs/utils/breakout.js +12 -4
- package/dist/cjs/utils/index.js +12 -7
- package/dist/cjs/utils/nodes.js +38 -2
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/node-width/index.js +18 -4
- package/dist/es2019/preset/builder.js +138 -0
- package/dist/es2019/preset/index.js +2 -0
- package/dist/es2019/preset/plugin-injection-api.js +176 -0
- package/dist/es2019/styles/shared/media-single.js +9 -0
- package/dist/es2019/styles/shared/panel.js +2 -2
- package/dist/es2019/styles/shared/table.js +2 -0
- package/dist/es2019/styles/shared/tableCell.js +27 -0
- package/dist/es2019/ui/DropList/index.js +6 -3
- package/dist/es2019/ui-color/ColorPalette/Color/styles.js +3 -1
- package/dist/es2019/ui-color/ColorPalette/Palettes/index.js +2 -1
- package/dist/es2019/ui-color/ColorPalette/Palettes/paletteMessagesTokenModeNames.js +137 -7
- package/dist/es2019/ui-color/ColorPalette/index.js +10 -8
- package/dist/es2019/ui-color/index.js +1 -0
- package/dist/es2019/ui-menu/ArrowKeyNavigationProvider/MenuArrowKeyNavigationProvider/index.js +2 -2
- package/dist/es2019/ui-menu/Dropdown/index.js +18 -6
- package/dist/es2019/ui-menu/DropdownMenu/index.js +1 -1
- package/dist/es2019/utils/breakout.js +13 -5
- package/dist/es2019/utils/index.js +1 -2
- package/dist/es2019/utils/nodes.js +34 -0
- package/dist/es2019/version.json +1 -1
- package/dist/esm/node-width/index.js +18 -4
- package/dist/esm/preset/builder.js +172 -0
- package/dist/esm/preset/index.js +2 -0
- package/dist/esm/preset/plugin-injection-api.js +213 -0
- package/dist/esm/styles/shared/media-single.js +1 -1
- package/dist/esm/styles/shared/panel.js +2 -2
- package/dist/esm/styles/shared/table.js +2 -1
- package/dist/esm/styles/shared/tableCell.js +24 -0
- package/dist/esm/ui/DropList/index.js +6 -3
- package/dist/esm/ui-color/ColorPalette/Color/styles.js +1 -1
- package/dist/esm/ui-color/ColorPalette/Palettes/index.js +2 -1
- package/dist/esm/ui-color/ColorPalette/Palettes/paletteMessagesTokenModeNames.js +132 -5
- package/dist/esm/ui-color/ColorPalette/index.js +10 -11
- package/dist/esm/ui-color/index.js +1 -0
- package/dist/esm/ui-menu/ArrowKeyNavigationProvider/MenuArrowKeyNavigationProvider/index.js +2 -2
- package/dist/esm/ui-menu/Dropdown/index.js +18 -8
- package/dist/esm/ui-menu/DropdownMenu/index.js +1 -1
- package/dist/esm/utils/breakout.js +13 -5
- package/dist/esm/utils/index.js +1 -2
- package/dist/esm/utils/nodes.js +34 -0
- package/dist/esm/version.json +1 -1
- package/dist/types/card/cardOptions.d.ts +1 -0
- package/dist/types/preset/builder.d.ts +30 -0
- package/dist/types/preset/index.d.ts +2 -0
- package/dist/types/preset/plugin-injection-api.d.ts +43 -0
- package/dist/types/provider-factory/provider-factory.d.ts +1 -1
- package/dist/types/styles/shared/tableCell.d.ts +1 -0
- package/dist/types/types/feature-flags.d.ts +28 -3
- package/dist/types/types/index.d.ts +1 -1
- package/dist/types/types/next-editor-plugin.d.ts +56 -28
- package/dist/types/ui/DropList/index.d.ts +2 -1
- package/dist/types/ui-color/ColorPalette/Palettes/index.d.ts +1 -0
- package/dist/types/ui-color/ColorPalette/Palettes/paletteMessagesTokenModeNames.d.ts +648 -2
- package/dist/types/ui-color/ColorPalette/Palettes/type.d.ts +4 -0
- package/dist/types/ui-color/ColorPalette/index.d.ts +36 -17
- package/dist/types/ui-color/index.d.ts +2 -1
- package/dist/types/ui-menu/Dropdown/index.d.ts +3 -0
- package/dist/types/utils/breakout.d.ts +10 -2
- package/dist/types/utils/index.d.ts +1 -2
- package/dist/types/utils/nodes.d.ts +15 -1
- package/package.json +13 -12
- package/preset/package.json +15 -0
- package/dist/cjs/utils/builder.js +0 -34
- package/dist/es2019/utils/builder.js +0 -14
- package/dist/esm/utils/builder.js +0 -26
- package/dist/types/utils/builder.d.ts +0 -8
|
@@ -6,47 +6,74 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import type { EditorState } from 'prosemirror-state';
|
|
8
8
|
import type { EditorPlugin } from './editor-plugin';
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
declare type IsAny<T> = 0 extends 1 & T ? true : false;
|
|
10
|
+
declare type PickSharedStatePropertyName<Metadata extends NextEditorPluginMetadata> = IsAny<Metadata> extends true ? never : ExtractSharedStateFromMetadata<Metadata> extends never ? never : 'getSharedState';
|
|
11
|
+
declare type WithSharedState<Metadata extends NextEditorPluginMetadata> = {
|
|
12
|
+
[Property in keyof Pick<Metadata, 'sharedState'> as PickSharedStatePropertyName<Metadata>]: (editorState: EditorState) => ExtractSharedStateFromMetadata<Metadata>;
|
|
13
|
+
};
|
|
14
|
+
declare type PickActionsPropertyName<Metadata extends NextEditorPluginMetadata> = IsAny<Metadata> extends true ? never : ExtractActionsFromMetadata<Metadata> extends never ? never : 'actions';
|
|
15
|
+
declare type WithActions<Metadata extends NextEditorPluginMetadata> = {
|
|
16
|
+
[Property in keyof Pick<Metadata, 'actions'> as PickActionsPropertyName<Metadata>]: ExtractActionsFromMetadata<Metadata>;
|
|
17
|
+
};
|
|
18
|
+
export declare type DefaultEditorPlugin<Name extends string, Metadata extends NextEditorPluginMetadata> = EditorPlugin & WithSharedState<Metadata> & WithActions<Metadata> & {
|
|
13
19
|
name: Name;
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
declare type
|
|
17
|
-
interface NextEditorPluginMetadata {
|
|
20
|
+
};
|
|
21
|
+
declare type MaybeAction = ((...agrs: any) => any) | ((...agrs: any) => void);
|
|
22
|
+
declare type NextEditorPluginActions = Record<string, MaybeAction>;
|
|
23
|
+
export interface NextEditorPluginMetadata {
|
|
18
24
|
readonly sharedState?: any;
|
|
19
25
|
readonly pluginConfiguration?: any;
|
|
20
|
-
readonly dependencies?:
|
|
26
|
+
readonly dependencies?: DependencyPlugin[];
|
|
27
|
+
readonly actions?: NextEditorPluginActions;
|
|
21
28
|
}
|
|
22
|
-
declare type
|
|
23
|
-
externalPlugins:
|
|
29
|
+
export declare type PluginInjectionAPI<Name extends string, Metadata extends NextEditorPluginMetadata> = {
|
|
30
|
+
externalPlugins: CreatePluginDependenciesAPI<[
|
|
31
|
+
NextEditorPlugin<Name, Metadata>,
|
|
32
|
+
...ExtractPluginDependenciesFromMetadata<Metadata>
|
|
33
|
+
]>;
|
|
34
|
+
};
|
|
35
|
+
declare type NextEditorPluginFunctionDefinition<Name extends string, Metadata extends NextEditorPluginMetadata, Configuration> = (config: Configuration, api?: PluginInjectionAPI<Name, Metadata>) => DefaultEditorPlugin<Name, Metadata>;
|
|
36
|
+
declare type NextEditorPluginFunctionOptionalConfigDefinition<Name extends string, Metadata extends NextEditorPluginMetadata, Configuration = undefined> = (config?: Configuration, api?: PluginInjectionAPI<Name, Metadata>) => DefaultEditorPlugin<Name, Metadata>;
|
|
37
|
+
declare type OptionalPrivateProperty = {
|
|
38
|
+
__optionalPluginType: true;
|
|
24
39
|
};
|
|
25
|
-
declare type
|
|
26
|
-
declare type
|
|
40
|
+
export declare type OptionalPlugin<EditorPlugin extends NextEditorPlugin<any, any>> = EditorPlugin & OptionalPrivateProperty;
|
|
41
|
+
declare type DependencyPlugin = OptionalPlugin<NextEditorPlugin<any, any>> | NextEditorPlugin<any, any>;
|
|
27
42
|
export declare type NextEditorPlugin<Name extends string, Metadata extends NextEditorPluginMetadata = {}> = Metadata extends NextEditorPluginMetadata ? 'pluginConfiguration' extends keyof Metadata ? undefined extends Metadata['pluginConfiguration'] ? NextEditorPluginFunctionOptionalConfigDefinition<Name, Metadata, Metadata['pluginConfiguration']> : NextEditorPluginFunctionDefinition<Name, Metadata, Metadata['pluginConfiguration']> : NextEditorPluginFunctionOptionalConfigDefinition<Name, Metadata> : never;
|
|
28
|
-
declare type
|
|
43
|
+
declare type FilterOptionalPlugins<T extends DependencyPlugin[]> = T extends [
|
|
44
|
+
infer Head,
|
|
45
|
+
...infer Tail
|
|
46
|
+
] ? Tail extends DependencyPlugin[] ? Head extends OptionalPlugin<NextEditorPlugin<any, any>> ? FilterOptionalPlugins<Tail> : [Head, ...FilterOptionalPlugins<Tail>] : T : T;
|
|
47
|
+
declare type ExtractPluginDependenciesFromMetadataWithoutOptionals<Metadata extends NextEditorPluginMetadata> = Metadata['dependencies'] extends DependencyPlugin[] ? FilterOptionalPlugins<Metadata['dependencies']> : [];
|
|
48
|
+
declare type ExtractPluginDependenciesFromMetadata<Metadata> = 'dependencies' extends keyof Metadata ? Metadata['dependencies'] extends DependencyPlugin[] ? Exclude<Metadata['dependencies'], undefined> : [] : [];
|
|
29
49
|
declare type ExtractSharedStateFromMetadata<Metadata> = 'sharedState' extends keyof Metadata ? Metadata['sharedState'] : never;
|
|
50
|
+
declare type ExtractActionsFromMetadata<Metadata> = 'actions' extends keyof Metadata ? Metadata['actions'] : never;
|
|
30
51
|
declare type ExtractPluginConfigurationFromMetadata<Metadata> = 'pluginConfiguration' extends keyof Metadata ? Metadata['pluginConfiguration'] : never;
|
|
31
|
-
declare type ExtractPluginDependencies<Plugin> = Plugin extends NextEditorPlugin<any, any> ? Plugin extends (config: any, api: any) =>
|
|
32
|
-
declare type ExtractPluginConfiguration<Plugin> = Plugin extends NextEditorPlugin<any, any> ? Plugin extends (config: any, api: any) =>
|
|
33
|
-
declare type ExtractPluginSharedState<Plugin> = Plugin extends NextEditorPlugin<any, any> ? Plugin extends (config: any, api: any) =>
|
|
34
|
-
declare type
|
|
35
|
-
declare type
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
52
|
+
export declare type ExtractPluginDependencies<Plugin> = Plugin extends NextEditorPlugin<any, any> ? Plugin extends (config: any, api: any) => DefaultEditorPlugin<any, infer Metadata> ? ExtractPluginDependenciesFromMetadataWithoutOptionals<Metadata> : never : never;
|
|
53
|
+
declare type ExtractPluginConfiguration<Plugin> = Plugin extends NextEditorPlugin<any, any> ? Plugin extends (config: any, api: any) => DefaultEditorPlugin<any, infer Metadata> ? ExtractPluginConfigurationFromMetadata<Metadata> : never : never;
|
|
54
|
+
declare type ExtractPluginSharedState<Plugin> = Plugin extends NextEditorPlugin<any, any> ? Plugin extends (config: any, api: any) => DefaultEditorPlugin<any, infer Metadata> ? ExtractSharedStateFromMetadata<Metadata> : never : never;
|
|
55
|
+
declare type ExtractPluginActions<Plugin> = Plugin extends NextEditorPlugin<any, any> ? Plugin extends (config: any, api: any) => DefaultEditorPlugin<any, infer Metadata> ? ExtractActionsFromMetadata<Metadata> : never : never;
|
|
56
|
+
declare type ExtractPluginName<Plugin> = Plugin extends NextEditorPlugin<any, any> ? Plugin extends (...args: any) => DefaultEditorPlugin<infer PluginName, any> ? PluginName : never : never;
|
|
57
|
+
declare type Unsubscribe = () => void;
|
|
58
|
+
export declare type PluginDependenciesAPI<Plugin extends NextEditorPlugin<any, any>> = {
|
|
59
|
+
sharedState: {
|
|
60
|
+
currentState: () => ExtractPluginSharedState<Plugin> | undefined;
|
|
61
|
+
onChange: (sub: (props: {
|
|
62
|
+
nextSharedState: ExtractPluginSharedState<Plugin>;
|
|
63
|
+
prevSharedState: ExtractPluginSharedState<Plugin>;
|
|
64
|
+
}) => void) => Unsubscribe;
|
|
39
65
|
};
|
|
66
|
+
actions: ExtractPluginActions<Plugin>;
|
|
40
67
|
};
|
|
41
|
-
declare type
|
|
42
|
-
[Plugin in PluginList[number] as ExtractPluginName<Plugin>]: Plugin extends NextEditorPlugin<any, any> ?
|
|
68
|
+
export declare type CreatePluginDependenciesAPI<PluginList extends NextEditorPlugin<any, any>[]> = {
|
|
69
|
+
[Plugin in PluginList[number] as ExtractPluginName<Plugin>]: Plugin extends OptionalPlugin<NextEditorPlugin<any, any>> ? PluginDependenciesAPI<Plugin> | undefined : Plugin extends NextEditorPlugin<any, any> ? PluginDependenciesAPI<Plugin> : never;
|
|
43
70
|
};
|
|
44
71
|
export declare type PluginAsArray<Plugin> = undefined extends ExtractPluginConfiguration<Plugin> ? [Plugin, ExtractPluginConfiguration<Plugin>?] : [Plugin, ExtractPluginConfiguration<Plugin>];
|
|
45
|
-
export declare type
|
|
72
|
+
export declare type AllEditorPresetPluginTypes = PluginAsArray<any> | NextEditorPlugin<any, any>;
|
|
46
73
|
declare type ExtractNextEditorPlugin<Plugin> = Plugin extends PluginAsArray<any> ? Plugin[0] : never;
|
|
47
|
-
export declare type VerifyPluginDependencies<Plugin, PluginsStack extends
|
|
74
|
+
export declare type VerifyPluginDependencies<Plugin, PluginsStack extends AllEditorPresetPluginTypes[]> = ExtractPluginDependencies<Plugin> extends [] ? Plugin extends PluginAsArray<any> | NextEditorPlugin<any, any> ? Plugin : never :
|
|
48
75
|
/**
|
|
49
|
-
* case 1: We're looking for its dependent plugins indexed on `
|
|
76
|
+
* case 1: We're looking for its dependent plugins indexed on `AllEditorPresetPluginTypes`
|
|
50
77
|
*/
|
|
51
78
|
ExtractPluginDependencies<Plugin>[number] extends (ExtractPluginDependencies<Plugin>[number] & PluginsStack[number])
|
|
52
79
|
/**
|
|
@@ -58,9 +85,10 @@ ExtractPluginDependencies<Plugin>[number] extends (ExtractPluginDependencies<Plu
|
|
|
58
85
|
/**
|
|
59
86
|
* Used to check if a plugin being added can be added to a Preset/builder
|
|
60
87
|
*/
|
|
61
|
-
export declare type SafePresetCheck<Plugin, StackPlugins extends
|
|
88
|
+
export declare type SafePresetCheck<Plugin, StackPlugins extends AllEditorPresetPluginTypes[]> = Plugin extends Plugin & VerifyPluginDependencies<Plugin, StackPlugins> ? Plugin extends NextEditorPlugin<any, any> ? CheckBasicPlugin<Plugin> : never : never;
|
|
62
89
|
declare type CheckTupleRequirements<Plugin, Config, ArrayType> = unknown extends Config ? Plugin | ArrayType : undefined extends Config ? Plugin | ArrayType : [
|
|
63
90
|
Config
|
|
64
91
|
] extends [never] ? Plugin : ArrayType;
|
|
65
92
|
declare type CheckBasicPlugin<Plugin> = Plugin extends (args: any, api: any) => EditorPlugin ? CheckTupleRequirements<Plugin, ExtractPluginConfiguration<Plugin>, PluginAsArray<Plugin>> : never;
|
|
93
|
+
export declare type ExtractPluginNameFromAllBuilderPlugins<Plugin extends AllEditorPresetPluginTypes> = Plugin extends Array<any> ? Plugin extends [infer MaybePlugin, ...any] ? MaybePlugin extends NextEditorPlugin<any, any> ? ExtractPluginName<MaybePlugin> : never : never : Plugin extends NextEditorPlugin<any, any> ? ExtractPluginName<Plugin> : never;
|
|
66
94
|
export {};
|
|
@@ -10,10 +10,11 @@ interface Props extends WithAnalyticsEventsProps {
|
|
|
10
10
|
testId?: string;
|
|
11
11
|
shouldFitContainer: boolean;
|
|
12
12
|
children?: ReactNode;
|
|
13
|
+
id?: string;
|
|
13
14
|
}
|
|
14
15
|
export declare type OpenChangedEvent = {
|
|
15
16
|
isOpen: boolean;
|
|
16
17
|
event: MouseEvent | KeyboardEvent;
|
|
17
18
|
};
|
|
18
|
-
declare const _default: import("react").ForwardRefExoticComponent<Pick<Omit<Props, keyof WithAnalyticsEventsProps> & import("react").RefAttributes<any> & import("@atlaskit/analytics-next").WithContextProps, "key" | "children" | "position" | "trigger" | "testId" | "analyticsContext" | "isOpen" | "onPositioned" | "onOpenChange" | "shouldFitContainer"> & import("react").RefAttributes<any>>;
|
|
19
|
+
declare const _default: import("react").ForwardRefExoticComponent<Pick<Omit<Props, keyof WithAnalyticsEventsProps> & import("react").RefAttributes<any> & import("@atlaskit/analytics-next").WithContextProps, "key" | "id" | "children" | "position" | "trigger" | "testId" | "analyticsContext" | "isOpen" | "onPositioned" | "onOpenChange" | "shouldFitContainer"> & import("react").RefAttributes<any>>;
|
|
19
20
|
export default _default;
|