@yoopta/code 4.9.9 → 6.0.0-beta.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.
@@ -1,5 +1,5 @@
1
- import { YooEditor, YooptaPathIndex } from '@yoopta/editor';
2
- import { CodeElement, CodeElementProps } from '../types';
1
+ import type { YooEditor, YooptaPathIndex } from '@yoopta/editor';
2
+ import type { CodeElement, CodeElementProps } from '../types';
3
3
  type CodeElementOptions = {
4
4
  text?: string;
5
5
  props?: CodeElementProps;
@@ -14,7 +14,8 @@ export type CodeCommands = {
14
14
  deleteCode: (editor: YooEditor, blockId: string) => void;
15
15
  updateCodeTheme: (editor: YooEditor, blockId: string, theme: CodeElementProps['theme']) => void;
16
16
  updateCodeLanguage: (editor: YooEditor, blockId: string, language: CodeElementProps['language']) => void;
17
+ prettifyCode: (_editor: YooEditor, code: string, language: string) => Promise<string>;
17
18
  };
18
19
  export declare const CodeCommands: CodeCommands;
19
20
  export {};
20
- //# sourceMappingURL=index.d.ts.map
21
+ //# sourceMappingURL=code-commands.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"code-commands.d.ts","sourceRoot":"","sources":["../../src/commands/code-commands.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAMjE,OAAO,KAAK,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAG9D,KAAK,kBAAkB,GAAG;IACxB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,gBAAgB,CAAC;CAC1B,CAAC;AAEF,KAAK,iBAAiB,GAAG,kBAAkB,GAAG;IAC5C,EAAE,CAAC,EAAE,eAAe,CAAC;IACrB,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG;IACzB,iBAAiB,EAAE,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,CAAC,EAAE,OAAO,CAAC,kBAAkB,CAAC,KAAK,WAAW,CAAC;IAC7F,UAAU,EAAE,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,CAAC,EAAE,OAAO,CAAC,iBAAiB,CAAC,KAAK,IAAI,CAAC;IAC9E,UAAU,EAAE,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IACzD,eAAe,EAAE,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,gBAAgB,CAAC,OAAO,CAAC,KAAK,IAAI,CAAC;IAChG,kBAAkB,EAAE,CAClB,MAAM,EAAE,SAAS,EACjB,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,gBAAgB,CAAC,UAAU,CAAC,KACnC,IAAI,CAAC;IACV,YAAY,EAAE,CAAC,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;CACvF,CAAC;AAEF,eAAO,MAAM,YAAY,EAAE,YAqD1B,CAAC"}
@@ -0,0 +1,17 @@
1
+ import type { YooEditor } from '@yoopta/editor';
2
+ import type { Location } from 'slate';
3
+ import type { CodeGroupContainerElement } from '../types';
4
+ export type InsertTabOptions = {
5
+ afterTabId?: string;
6
+ at?: Location;
7
+ };
8
+ export type DeleteTabOptions = {
9
+ tabId: string;
10
+ };
11
+ export type CodeGroupCommandsType = {
12
+ buildCodeElements: (editor: YooEditor) => CodeGroupContainerElement;
13
+ addTabItem: (editor: YooEditor, blockId: string, options?: InsertTabOptions) => void;
14
+ deleteTabItem: (editor: YooEditor, blockId: string, options: DeleteTabOptions) => void;
15
+ };
16
+ export declare const CodeGroupCommands: CodeGroupCommandsType;
17
+ //# sourceMappingURL=code-group-commands.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"code-group-commands.d.ts","sourceRoot":"","sources":["../../src/commands/code-group-commands.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAgB,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE9D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAGtC,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,UAAU,CAAC;AAE1D,MAAM,MAAM,gBAAgB,GAAG;IAC7B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,EAAE,CAAC,EAAE,QAAQ,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG;IAC7B,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG;IAClC,iBAAiB,EAAE,CAAC,MAAM,EAAE,SAAS,KAAK,yBAAyB,CAAC;IACpE,UAAU,EAAE,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,gBAAgB,KAAK,IAAI,CAAC;IACrF,aAAa,EAAE,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,gBAAgB,KAAK,IAAI,CAAC;CACxF,CAAC;AAEF,eAAO,MAAM,iBAAiB,EAAE,qBA0N/B,CAAC"}
@@ -0,0 +1,13 @@
1
+ import type { SlateElement } from '@yoopta/editor';
2
+ import type { BundledLanguage, BundledTheme, HighlighterGeneric, SpecialLanguage } from 'shiki';
3
+ export declare const useHighlighter: () => {
4
+ highlighter: HighlighterGeneric<BundledLanguage, BundledTheme> | null;
5
+ };
6
+ type HighlightedOverlayProps = {
7
+ element: SlateElement;
8
+ language: SpecialLanguage;
9
+ theme: BundledTheme;
10
+ };
11
+ export declare const HighlightedCodeOverlay: ({ element, language, theme }: HighlightedOverlayProps) => import("react/jsx-runtime").JSX.Element;
12
+ export {};
13
+ //# sourceMappingURL=highlighted-code-overlay.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"highlighted-code-overlay.d.ts","sourceRoot":"","sources":["../../src/components/highlighted-code-overlay.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,KAAK,EACV,eAAe,EACf,YAAY,EACZ,kBAAkB,EAClB,eAAe,EAEhB,MAAM,OAAO,CAAC;AAOf,eAAO,MAAM,cAAc;;CAmB1B,CAAC;AASF,KAAK,uBAAuB,GAAG;IAC7B,OAAO,EAAE,YAAY,CAAC;IACtB,QAAQ,EAAE,eAAe,CAAC;IAC1B,KAAK,EAAE,YAAY,CAAC;CACrB,CAAC;AAEF,eAAO,MAAM,sBAAsB,iCAAkC,uBAAuB,4CA6C3F,CAAC"}
package/dist/index.d.ts CHANGED
@@ -1,12 +1,16 @@
1
- import { Code } from './plugin';
2
- import { CodeElement, CodeElementProps } from './types';
3
- import './styles.css';
4
- declare module 'slate' {
5
- interface CustomTypes {
6
- Element: CodeElement;
7
- }
8
- }
9
- export { CodeCommands } from './commands';
10
- export default Code;
1
+ import { CodeGroup } from './plugin/code-group-plugin';
2
+ import { Code } from './plugin/code-plugin';
3
+ import { CodeElement, CodeElementProps, CodeGroupElementMap, CodeGroupPluginBlockOptions } from './types';
4
+ export { HighlightedCodeOverlay, useHighlighter } from './components/highlighted-code-overlay';
5
+ export { CodeCommands } from './commands/code-commands';
6
+ export { CodeGroupCommands } from './commands/code-group-commands';
7
+ export { SHIKI_CODE_LANGUAGES, SHIKI_CODE_THEMES } from './utils/shiki';
11
8
  export { CodeElement, CodeElementProps };
9
+ export { CodeGroupElementMap, CodeGroupPluginBlockOptions };
10
+ export { CodeGroup, Code };
11
+ declare const CodePlugins: {
12
+ Code: import("@yoopta/editor").YooptaPlugin<import("./types").CodeElementMap, import("./types").CodePluginBlockOptions>;
13
+ CodeGroup: import("@yoopta/editor").YooptaPlugin<CodeGroupElementMap, CodeGroupPluginBlockOptions>;
14
+ };
15
+ export default CodePlugins;
12
16
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAChC,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AACxD,OAAO,cAAc,CAAC;AAEtB,OAAO,QAAQ,OAAO,CAAC;IACrB,UAAU,WAAW;QACnB,OAAO,EAAE,WAAW,CAAC;KACtB;CACF;AAED,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE1C,eAAe,IAAI,CAAC;AACpB,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AACvD,OAAO,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAC5C,OAAO,EACL,WAAW,EACX,gBAAgB,EAChB,mBAAmB,EACnB,2BAA2B,EAC5B,MAAM,SAAS,CAAC;AAKjB,OAAO,EAAE,sBAAsB,EAAE,cAAc,EAAE,MAAM,uCAAuC,CAAC;AAC/F,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AACnE,OAAO,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAExE,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,CAAC;AACzC,OAAO,EAAE,mBAAmB,EAAE,2BAA2B,EAAE,CAAC;AAC5D,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;AAE3B,QAAA,MAAM,WAAW;;;CAGhB,CAAC;AAEF,eAAe,WAAW,CAAC"}