@yiitap/vue 0.13.0 → 0.14.0

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.
Files changed (41) hide show
  1. package/dist/index.cjs +262 -22
  2. package/dist/index.cjs.map +1 -1
  3. package/dist/index.js +262 -22
  4. package/dist/index.js.map +1 -1
  5. package/dist/index.mjs +52030 -25591
  6. package/dist/index.mjs.map +1 -1
  7. package/dist/vue.css +1 -1
  8. package/package.json +27 -31
  9. package/types/components/YiiEditor.vue.d.ts +8 -12
  10. package/types/components/common/OBlockPlaceholder.vue.d.ts +1 -1
  11. package/types/components/common/OBlockPopover.vue.d.ts +2 -2
  12. package/types/components/common/OCommandBtn.vue.d.ts +6 -6
  13. package/types/components/common/OCommonBtn.vue.d.ts +6 -6
  14. package/types/components/common/OMenubarBtn.vue.d.ts +6 -6
  15. package/types/components/common/OMetaInput.vue.d.ts +1 -1
  16. package/types/components/menus/OSideMenu.vue.d.ts +9 -0
  17. package/types/components/ui/OBtn.vue.d.ts +3 -3
  18. package/types/components/ui/OBtnGroup.vue.d.ts +3 -3
  19. package/types/components/ui/OCheckbox.vue.d.ts +1 -1
  20. package/types/components/ui/OIcon.vue.d.ts +1 -1
  21. package/types/components/ui/OImageViewer.vue.d.ts +1 -1
  22. package/types/components/ui/OInput.vue.d.ts +4 -4
  23. package/types/components/ui/OTextarea.vue.d.ts +2 -2
  24. package/types/constants/brand-color.d.ts +4 -0
  25. package/types/constants/index.d.ts +1 -1
  26. package/types/extensions/blockquote/index.d.ts +1 -1
  27. package/types/extensions/char-command/emoji/view.vue.d.ts +2 -2
  28. package/types/extensions/char-command/index.d.ts +4 -0
  29. package/types/extensions/char-command/slash/view.vue.d.ts +1 -1
  30. package/types/extensions/code-block/index.d.ts +3 -3
  31. package/types/extensions/details/index.d.ts +1 -1
  32. package/types/extensions/extensions.d.ts +55 -0
  33. package/types/extensions/factory.d.ts +110 -0
  34. package/types/extensions/heading/index.d.ts +2 -2
  35. package/types/extensions/horizontal-rule/index.d.ts +3 -1
  36. package/types/extensions/index.d.ts +3 -51
  37. package/types/extensions/paragraph/index.d.ts +3 -1
  38. package/types/extensions/starter-kit.d.ts +20 -0
  39. package/types/index.d.ts +1 -0
  40. package/types/constants/color.d.ts +0 -5
  41. package/types/extensions/dynamic.d.ts +0 -8
@@ -0,0 +1,110 @@
1
+ /**
2
+ * Extensions Registry Factory
3
+ */
4
+ import type { AnyExtension, BackgroundColorOptions, BlockMathOptions, CollaborationOptions, CollaborationCaretOptions, ColorOptions, FocusOptions, FontFamilyOptions, HighlightOptions, HorizontalRuleOptions, ImageOptions, InlineMathOptions, LinkOptions, MarkdownExtensionOptions, MentionOptions, SubscriptExtensionOptions, SuperscriptExtensionOptions, TaskItemOptions, TaskListOptions, TextAlignOptions, TextStyleOptions, TypographyOptions, UnderlineOptions, UniqueIDOptions, AiBlockOptions, CalloutOptions, OBlockquoteOptions, OCodeBlockOptions, ODetailsOptions, OHeadingOptions, ParagraphOptions, ShortcutOptions } from './extensions';
5
+ /**
6
+ * Define the factory type to hide internal Tiptap/Yiitap option types.
7
+ * This prevents "name from external module" errors.
8
+ */
9
+ type ExtensionFactory<K extends keyof ExtensionOptions = any> = (opts?: ExtensionOptions[K]) => AnyExtension | AnyExtension[];
10
+ /**
11
+ * Detailed options for each extension to provide full IntelliSense
12
+ */
13
+ export interface ExtensionOptions {
14
+ BackgroundColor: BackgroundColorOptions;
15
+ BlockMath: BlockMathOptions;
16
+ Collaboration: CollaborationOptions;
17
+ CollaborationCaret: CollaborationCaretOptions;
18
+ Color: ColorOptions;
19
+ Focus: FocusOptions;
20
+ FontFamily: FontFamilyOptions;
21
+ Highlight: HighlightOptions;
22
+ Image: ImageOptions;
23
+ InlineMath: InlineMathOptions;
24
+ Link: LinkOptions;
25
+ Markdown: MarkdownExtensionOptions;
26
+ Mention: MentionOptions;
27
+ Subscript: SubscriptExtensionOptions;
28
+ Superscript: SuperscriptExtensionOptions;
29
+ TaskItem: TaskItemOptions;
30
+ TaskList: TaskListOptions;
31
+ TextAlign: TextAlignOptions;
32
+ TextStyle: TextStyleOptions;
33
+ Typography: TypographyOptions;
34
+ Underline: UnderlineOptions;
35
+ UniqueID: UniqueIDOptions;
36
+ OAiBlock: AiBlockOptions;
37
+ OBlockMath: BlockMathOptions;
38
+ OColon: {
39
+ suggestion?: any;
40
+ HTMLAttributes?: Record<string, any>;
41
+ };
42
+ OSlash: {
43
+ suggestion?: any;
44
+ HTMLAttributes?: Record<string, any>;
45
+ };
46
+ OSlashZh: {
47
+ suggestion?: any;
48
+ HTMLAttributes?: Record<string, any>;
49
+ };
50
+ OBlockquote: OBlockquoteOptions;
51
+ OCallout: CalloutOptions;
52
+ OCodeBlock: OCodeBlockOptions;
53
+ OColorHighlighter: any;
54
+ OHeading: OHeadingOptions;
55
+ OHorizontalRule: HorizontalRuleOptions;
56
+ OImage: ImageOptions;
57
+ OInlinePlaceholder: {
58
+ char?: string;
59
+ HTMLAttributes?: Record<string, any>;
60
+ };
61
+ OLink: LinkOptions;
62
+ OParagraph: ParagraphOptions;
63
+ OShortcut: ShortcutOptions;
64
+ OSelectionDecoration: any;
65
+ OVideo: {
66
+ allowFullscreen?: boolean;
67
+ HTMLAttributes?: Record<string, any>;
68
+ };
69
+ ODetails: ODetailsOptions;
70
+ OTable: {
71
+ resizable?: boolean;
72
+ handleWidth?: number;
73
+ cellMinWidth?: number;
74
+ HTMLAttributes?: Record<string, any>;
75
+ };
76
+ [key: string]: any;
77
+ }
78
+ /**
79
+ * Extension Factory Registry
80
+ * Stores functions that return a configured extension instance
81
+ */
82
+ export declare const extensionRegistry: {
83
+ [K in keyof ExtensionOptions]?: ExtensionFactory<K>;
84
+ };
85
+ /**
86
+ * Derived Types for IntelliSense
87
+ */
88
+ export type ExtensionName = keyof typeof extensionRegistry;
89
+ /**
90
+ * A unified structure combining Name and its specific Config
91
+ */
92
+ export type ExtensionItem<T extends ExtensionName = ExtensionName> = {
93
+ name: T;
94
+ configure?: T extends keyof ExtensionOptions ? Partial<ExtensionOptions[T]> : any;
95
+ };
96
+ /**
97
+ * Custom Type Guard to check if an item is a Tiptap Extension instance
98
+ */
99
+ export declare const isExtensionInstance: (item: any) => item is AnyExtension;
100
+ /**
101
+ * Create a single extension from a unified item object
102
+ * @param item - An object containing both name and optional config
103
+ */
104
+ export declare const createExtension: <T extends ExtensionName>(item: ExtensionItem<T>) => AnyExtension | AnyExtension[];
105
+ /**
106
+ * Create a flattened list from a mix of names and configured items
107
+ * Allows passing either a simple string or a full { name, configure } object
108
+ */
109
+ export declare const createExtensionList: (items: (ExtensionName | ExtensionItem)[]) => AnyExtension[];
110
+ export {};
@@ -1,7 +1,7 @@
1
1
  export type Level = 1 | 2 | 3 | 4 | 5 | 6;
2
- export interface HeadingOptions {
2
+ export interface OHeadingOptions {
3
3
  levels: Level[];
4
4
  HTMLAttributes: Record<string, any>;
5
5
  }
6
- declare const OHeading: import("@tiptap/core").Node<HeadingOptions, any>;
6
+ declare const OHeading: import("@tiptap/core").Node<OHeadingOptions, any>;
7
7
  export default OHeading;
@@ -1,2 +1,4 @@
1
- declare const OHorizontalRule: import("@tiptap/core").Node<import("@tiptap/extension-horizontal-rule").HorizontalRuleOptions, any>;
1
+ import { type HorizontalRuleOptions } from '@tiptap/extension-horizontal-rule';
2
+ declare const OHorizontalRule: import("@tiptap/core").Node<HorizontalRuleOptions, any>;
2
3
  export default OHorizontalRule;
4
+ export type { HorizontalRuleOptions };
@@ -1,51 +1,3 @@
1
- import { Focus } from '@tiptap/extensions';
2
- import { Details, DetailsContent, DetailsSummary } from '@tiptap/extension-details';
3
- import { TaskItem, TaskList } from '@tiptap/extension-list';
4
- import { BlockMath, InlineMath } from '@tiptap/extension-mathematics';
5
- import { Table, TableRow, TableCell, TableHeader } from '@tiptap/extension-table';
6
- import { BackgroundColor, Color, FontFamily, TextStyle } from '@tiptap/extension-text-style';
7
- import { Markdown } from '@tiptap/markdown';
8
- import Highlight from '@tiptap/extension-highlight';
9
- import Emoji from '@tiptap/extension-emoji';
10
- import Image from '@tiptap/extension-image';
11
- import Link from '@tiptap/extension-link';
12
- import Mention from '@tiptap/extension-mention';
13
- import Subscript from '@tiptap/extension-subscript';
14
- import Superscript from '@tiptap/extension-superscript';
15
- import TextAlign from '@tiptap/extension-text-align';
16
- import Typography from '@tiptap/extension-typography';
17
- import Underline from '@tiptap/extension-underline';
18
- import UniqueID from '@tiptap/extension-unique-id';
19
- import OColorHighlighter from '@yiitap/extension-color-highlighter';
20
- import OFocus from '@yiitap/extension-focus';
21
- import OInlinePlaceholder from '@yiitap/extension-inline-placeholder';
22
- import OPlaceholder from '@yiitap/extension-placeholder';
23
- import OSelectionDecoration from '@yiitap/extension-selection-decoration';
24
- import OShortcut from '@yiitap/extension-shortcut';
25
- import OTable from '@yiitap/extension-table';
26
- import OTaskItem from '@yiitap/extension-task-item';
27
- import OCharCommand from '@yiitap/extension-char-command';
28
- import { ColonCommand as OColonCommand, SlashCommand as OSlashCommand, SlashZhCommand as OSlashZhCommand } from '@yiitap/extension-char-command';
29
- import OAiBlock from './ai-block';
30
- import OBlockMath from './block-math';
31
- import OBlockquote from './blockquote';
32
- import OCallout from './callout';
33
- import OCodeBlock from './code-block';
34
- import ODetails from './details';
35
- import OHeading from './heading';
36
- import OHorizontalRule from './horizontal-rule';
37
- import OImage from './image';
38
- import OLink from './link';
39
- import OParagraph from './paragraph';
40
- import OTableCell from './table-cell';
41
- import OTableHeader from './table-header';
42
- import OTableWrapper from './table-wrapper';
43
- import OVideo from './video';
44
- /**
45
- * Enable by default
46
- */
47
- export declare const DefaultExtensionNames: string[];
48
- export declare const TiptapExtensionNames: string[];
49
- export declare const YiitapExtensionNames: string[];
50
- export declare const BuiltinExtensionNames: string[];
51
- export { BackgroundColor, BlockMath, Color, Details, DetailsContent, DetailsSummary, Emoji, Focus, FontFamily, Highlight, Image, InlineMath, Link, Markdown, Mention, Subscript, Superscript, Table, TableHeader, TableCell, TableRow, TaskItem, TaskList, TextAlign, TextStyle, Typography, Underline, UniqueID, OAiBlock, OBlockMath, OBlockquote, OCallout, OCharCommand, OCodeBlock, OColonCommand, OColorHighlighter, ODetails, OFocus, OInlinePlaceholder, OHeading, OHorizontalRule, OImage, OLink, OParagraph, OPlaceholder, OSelectionDecoration, OShortcut, OSlashCommand, OSlashZhCommand, OTable, OTableCell, OTableHeader, OTableWrapper, OTaskItem, OVideo, };
1
+ export * from './extensions';
2
+ export * from './factory';
3
+ export * from './starter-kit';
@@ -1,2 +1,4 @@
1
- declare const OParagraph: import("@tiptap/core").Node<import("@tiptap/extension-paragraph").ParagraphOptions, any>;
1
+ import { type ParagraphOptions } from '@tiptap/extension-paragraph';
2
+ declare const OParagraph: import("@tiptap/core").Node<ParagraphOptions, any>;
2
3
  export default OParagraph;
4
+ export type { ParagraphOptions };
@@ -0,0 +1,20 @@
1
+ import { type ExtensionName, type ExtensionOptions } from './factory';
2
+ import { type AnyExtension } from './extensions';
3
+ /**
4
+ * Options for the custom StarterKit.
5
+ * Allows users to pass configuration objects for each extension,
6
+ * or set them to false to disable specific features.
7
+ */
8
+ export type StarterKitOptions = {
9
+ [K in ExtensionName]?: ExtensionOptions[K] | false;
10
+ };
11
+ /**
12
+ * StarterKit implementation
13
+ * This function returns a flattened array of extensions based on your DefaultExtensionNames.
14
+ */
15
+ export declare const OStarterKit: {
16
+ /**
17
+ * Configure and return the default suite of extensions
18
+ */
19
+ configure(options?: StarterKitOptions): AnyExtension[];
20
+ };
package/types/index.d.ts CHANGED
@@ -9,3 +9,4 @@ export { YiiEditor, YiiEditorPlugin };
9
9
  export * from './components';
10
10
  export * from './constants';
11
11
  export * from './hooks';
12
+ export * from './extensions';
@@ -1,5 +0,0 @@
1
- /**
2
- * Color
3
- */
4
- export declare const Color: Indexable;
5
- export declare const ColorList: OptionValue[];
@@ -1,8 +0,0 @@
1
- declare class DynamicClass {
2
- constructor(name: string);
3
- }
4
- export default DynamicClass;
5
- export declare const getDynamicExtension: (name: string) => DynamicClass;
6
- export declare const DetailsExtensions: import("@tiptap/core").Node<import("@tiptap/extension-details").DetailsContentOptions, any>[];
7
- export declare const TableExtensions: import("@tiptap/core").Node<any, any>[];
8
- export declare const DefaultTableExtensions: import("@tiptap/core").Node<import("@tiptap/extension-table").TableCellOptions, any>[];