@yoopta/code 2.0.1 → 4.0.0-rc.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.
@@ -0,0 +1,14 @@
1
+ import { YooptaPlugin } from '@yoopta/editor';
2
+ declare const Code: YooptaPlugin<"code", {
3
+ nodeType: "void";
4
+ language: string;
5
+ theme: string;
6
+ }, {
7
+ display: {
8
+ title: string;
9
+ description: string;
10
+ };
11
+ shortcuts: string[];
12
+ }>;
13
+ export { Code };
14
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/plugin/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAG9C,QAAA,MAAM,IAAI;;;;;;;;;;EAoBR,CAAC;AAEH,OAAO,EAAE,IAAI,EAAE,CAAC"}
package/dist/types.d.ts CHANGED
@@ -1,15 +1,8 @@
1
- import { Modify, YooptaBaseElement } from '@yoopta/editor';
2
- export type CodeElementData = {
3
- language: string;
4
- filename?: string;
1
+ import { SlateElement } from '@yoopta/editor';
2
+ export type CodePluginElements = 'code';
3
+ export type CodeElementProps = {
4
+ language?: string;
5
+ theme?: string;
5
6
  };
6
- export type CodeElement = Modify<YooptaBaseElement<'code'>, {
7
- data: CodeElementData;
8
- children: CodeChildElement[];
9
- }>;
10
- export type CodeChildElement = Modify<YooptaBaseElement<'code-line'>, {
11
- data: {
12
- skipSettings: boolean;
13
- skipDrag: boolean;
14
- };
15
- }>;
7
+ export type CodeElement = SlateElement<'code', CodeElementProps>;
8
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C,MAAM,MAAM,kBAAkB,GAAG,MAAM,CAAC;AACxC,MAAM,MAAM,gBAAgB,GAAG;IAC7B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AACF,MAAM,MAAM,WAAW,GAAG,YAAY,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC"}
@@ -0,0 +1,4 @@
1
+ import { PluginElementRenderProps } from '@yoopta/editor';
2
+ declare const CodeEditor: ({ blockId, attributes, children }: PluginElementRenderProps) => import("react/jsx-runtime").JSX.Element;
3
+ export { CodeEditor };
4
+ //# sourceMappingURL=Code.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Code.d.ts","sourceRoot":"","sources":["../../src/ui/Code.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAkD,MAAM,gBAAgB,CAAC;AAkB1G,QAAA,MAAM,UAAU,sCAAuC,wBAAwB,4CAsC9E,CAAC;AAEF,OAAO,EAAE,UAAU,EAAE,CAAC"}
@@ -0,0 +1,10 @@
1
+ import { YooEditor, YooptaBlockData } from '@yoopta/editor';
2
+ import { CodeElement } from '../types';
3
+ type Props = {
4
+ editor: YooEditor;
5
+ block: YooptaBlockData;
6
+ element: CodeElement;
7
+ };
8
+ export declare const CodeBlockOptions: ({ block, editor, element }: Props) => import("react/jsx-runtime").JSX.Element;
9
+ export {};
10
+ //# sourceMappingURL=CodeBlockOptions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CodeBlockOptions.d.ts","sourceRoot":"","sources":["../../src/ui/CodeBlockOptions.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAM,SAAS,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAShE,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAOvC,KAAK,KAAK,GAAG;IACX,MAAM,EAAE,SAAS,CAAC;IAClB,KAAK,EAAE,eAAe,CAAC;IACvB,OAAO,EAAE,WAAW,CAAC;CACtB,CAAC;AAEF,eAAO,MAAM,gBAAgB,+BAAgC,KAAK,4CA4DjE,CAAC"}
@@ -0,0 +1,28 @@
1
+ /// <reference types="react" />
2
+ import * as SelectPrimitive from '@radix-ui/react-select';
3
+ declare const SelectRoot: import("react").FC<SelectPrimitive.SelectProps>;
4
+ declare const SelectValue: import("react").ForwardRefExoticComponent<SelectPrimitive.SelectValueProps & import("react").RefAttributes<HTMLSpanElement>>;
5
+ declare const SelectTrigger: ({ children, className }: {
6
+ children: any;
7
+ className: any;
8
+ }) => import("react/jsx-runtime").JSX.Element;
9
+ declare const SelectContent: ({ children }: {
10
+ children: any;
11
+ }) => import("react/jsx-runtime").JSX.Element;
12
+ declare const SelectItem: ({ value, children }: {
13
+ value: any;
14
+ children: any;
15
+ }) => import("react/jsx-runtime").JSX.Element;
16
+ type SelectProps = {
17
+ options: {
18
+ label: string;
19
+ value: string;
20
+ }[];
21
+ onChange: (value: string) => void;
22
+ value: string;
23
+ className?: string;
24
+ children?: React.ReactNode;
25
+ };
26
+ declare const Select: ({ options, onChange, value, children, className }: SelectProps) => import("react/jsx-runtime").JSX.Element;
27
+ export { Select, SelectTrigger, SelectRoot, SelectValue, SelectContent, SelectItem };
28
+ //# sourceMappingURL=Select.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Select.d.ts","sourceRoot":"","sources":["../../src/ui/Select.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,eAAe,MAAM,wBAAwB,CAAC;AAG1D,QAAA,MAAM,UAAU,iDAAuB,CAAC;AACxC,QAAA,MAAM,WAAW,8HAAwB,CAAC;AAE1C,QAAA,MAAM,aAAa;;;6CAWlB,CAAC;AAEF,QAAA,MAAM,aAAa;;6CAiBlB,CAAC;AAEF,QAAA,MAAM,UAAU;;;6CASf,CAAC;AAEF,KAAK,WAAW,GAAG;IACjB,OAAO,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IAC5C,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B,CAAC;AAEF,QAAA,MAAM,MAAM,sDAAuD,WAAW,4CAe7E,CAAC;AAEF,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,UAAU,EAAE,WAAW,EAAE,aAAa,EAAE,UAAU,EAAE,CAAC"}
@@ -0,0 +1,4 @@
1
+ import { YooptaBlockData } from '@yoopta/editor';
2
+ export declare const getCodeElement: (block: YooptaBlockData) => import("slate").Descendant | import("@yoopta/editor").SlateElement<string, any>;
3
+ export declare const getCodeElementText: (block: YooptaBlockData) => any;
4
+ //# sourceMappingURL=element.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"element.d.ts","sourceRoot":"","sources":["../../src/utils/element.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAGjD,eAAO,MAAM,cAAc,UAAW,eAAe,oFAEpD,CAAC;AAEF,eAAO,MAAM,kBAAkB,UAAW,eAAe,QAGxD,CAAC"}
@@ -0,0 +1,19 @@
1
+ declare const LANGUAGES: {
2
+ HTML: any;
3
+ CSS: any;
4
+ JavaScript: import("@codemirror/language").LanguageSupport;
5
+ PHP: any;
6
+ 'C++': any;
7
+ Java: any;
8
+ Python: any;
9
+ Markdown: any;
10
+ Rust: any;
11
+ Vue: any;
12
+ SQL: any;
13
+ Angular: any;
14
+ JSON: any;
15
+ XML: any;
16
+ YAML: any;
17
+ };
18
+ export { LANGUAGES };
19
+ //# sourceMappingURL=languages.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"languages.d.ts","sourceRoot":"","sources":["../../src/utils/languages.tsx"],"names":[],"mappings":"AAgBA,QAAA,MAAM,SAAS;;;;;;;;;;;;;;;;CAgBd,CAAC;AAEF,OAAO,EAAE,SAAS,EAAE,CAAC"}
@@ -0,0 +1,15 @@
1
+ export declare const themes: {
2
+ BasicLight: import("@codemirror/state").Extension;
3
+ BasicDark: import("@codemirror/state").Extension;
4
+ VSCode: import("@codemirror/state").Extension;
5
+ Sublime: import("@codemirror/state").Extension;
6
+ Okaidia: import("@codemirror/state").Extension;
7
+ Monokai: import("@codemirror/state").Extension;
8
+ MaterialDark: import("@codemirror/state").Extension;
9
+ MaterialLight: import("@codemirror/state").Extension;
10
+ GithubDark: import("@codemirror/state").Extension;
11
+ GithubLight: import("@codemirror/state").Extension;
12
+ Dracula: import("@codemirror/state").Extension;
13
+ Copilot: import("@codemirror/state").Extension;
14
+ };
15
+ //# sourceMappingURL=themes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"themes.d.ts","sourceRoot":"","sources":["../../src/utils/themes.ts"],"names":[],"mappings":"AAUA,eAAO,MAAM,MAAM;;;;;;;;;;;;;CAalB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yoopta/code",
3
- "version": "2.0.1",
3
+ "version": "4.0.0-rc.0",
4
4
  "description": "> TODO: description",
5
5
  "author": "Darginec05 <devopsbanda@gmail.com>",
6
6
  "homepage": "https://github.com/Darginec05/Editor-Yoopta#readme",
@@ -14,11 +14,9 @@
14
14
  "dist/"
15
15
  ],
16
16
  "peerDependencies": {
17
- "@yoopta/editor": ">=1.9.18-rc",
17
+ "@yoopta/editor": ">=4.0.0-rc.0",
18
18
  "react": ">=17.0.2",
19
- "react-dom": ">=17.0.2",
20
- "slate": ">=0.72.3",
21
- "slate-react": ">=0.95.0"
19
+ "react-dom": ">=17.0.2"
22
20
  },
23
21
  "publishConfig": {
24
22
  "registry": "https://registry.yarnpkg.com"
@@ -28,13 +26,28 @@
28
26
  "url": "git+https://github.com/Darginec05/Editor-Yoopta.git"
29
27
  },
30
28
  "scripts": {
31
- "test": "node ./__tests__/yoopta-code.test.js"
29
+ "test": "node ./__tests__/yoopta-callout.test.js",
30
+ "start": "rollup --config rollup.config.js --watch --bundleConfigAsCjs --environment NODE_ENV:development",
31
+ "prepublishOnly": "yarn build",
32
+ "build": "rollup --config rollup.config.js --bundleConfigAsCjs --environment NODE_ENV:production"
32
33
  },
33
34
  "bugs": {
34
35
  "url": "https://github.com/Darginec05/Editor-Yoopta/issues"
35
36
  },
36
37
  "dependencies": {
37
- "prism-material-themes": "^1.0.4",
38
- "prismjs": "^1.29.0"
39
- }
38
+ "@codemirror/lang-javascript": "^6.2.2",
39
+ "@radix-ui/react-select": "^2.0.0",
40
+ "@uiw/codemirror-theme-basic": "^4.21.24",
41
+ "@uiw/codemirror-theme-copilot": "^4.21.24",
42
+ "@uiw/codemirror-theme-dracula": "^4.21.24",
43
+ "@uiw/codemirror-theme-github": "^4.21.24",
44
+ "@uiw/codemirror-theme-material": "^4.21.24",
45
+ "@uiw/codemirror-theme-monokai-dimmed": "^4.21.24",
46
+ "@uiw/codemirror-theme-okaidia": "^4.21.24",
47
+ "@uiw/codemirror-theme-sublime": "^4.21.24",
48
+ "@uiw/codemirror-theme-vscode": "^4.21.24",
49
+ "@uiw/react-codemirror": "^4.21.24",
50
+ "copy-to-clipboard": "^3.3.3"
51
+ },
52
+ "gitHead": "7e5c32bd4c48dd21d84359a3fe87ed82cdaf964f"
40
53
  }
package/dist/Code.d.ts DELETED
@@ -1,11 +0,0 @@
1
- import { YooEditor, YooptaPluginBaseOptions } from '@yoopta/editor';
2
- import { CodeChildElement, CodeElement } from './types';
3
- declare module 'slate' {
4
- interface CustomTypes {
5
- Editor: YooEditor;
6
- Element: CodeElement | CodeChildElement;
7
- }
8
- }
9
- declare const CodeLine: import("@yoopta/editor").YooptaPlugin<any, CodeChildElement>;
10
- declare const Code: import("@yoopta/editor").YooptaPlugin<YooptaPluginBaseOptions, CodeElement>;
11
- export { Code, CodeLine, CodeElement, CodeChildElement };
@@ -1,29 +0,0 @@
1
- /// <reference types="react" />
2
- import 'prismjs/components/prism-javascript';
3
- import 'prismjs/components/prism-go';
4
- import 'prismjs/components/prism-jsx';
5
- import 'prismjs/components/prism-kotlin';
6
- import 'prismjs/components/prism-typescript';
7
- import 'prismjs/components/prism-tsx';
8
- import 'prismjs/components/prism-markdown';
9
- import 'prismjs/components/prism-python';
10
- import 'prismjs/components/prism-php';
11
- import 'prismjs/components/prism-sql';
12
- import 'prismjs/components/prism-java';
13
- import 'prismjs/components/prism-csharp';
14
- import 'prismjs/components/prism-swift';
15
- import 'prismjs/components/prism-r';
16
- import 'prismjs/components/prism-bash';
17
- import 'prismjs/components/prism-ruby';
18
- import 'prismjs/components/prism-c';
19
- import 'prismjs/components/prism-cpp';
20
- import 'prismjs/components/prism-matlab';
21
- import 'prismjs/components/prism-scala';
22
- import 'prism-material-themes/themes/material-default.css';
23
- import { RenderYooptaElementProps, YooEditor } from '@yoopta/editor';
24
- import { CodeElement } from '../types';
25
- declare const CodeEditor: {
26
- (editor: YooEditor): ({ element, attributes, children, HTMLAttributes }: RenderYooptaElementProps<CodeElement>) => JSX.Element;
27
- displayName: string;
28
- };
29
- export { CodeEditor };
@@ -1,7 +0,0 @@
1
- /// <reference types="react" />
2
- declare const CodeLeaf: ({ leaf, attributes, children }: {
3
- leaf: any;
4
- attributes: any;
5
- children: any;
6
- }) => JSX.Element | null;
7
- export { CodeLeaf };
@@ -1,5 +0,0 @@
1
- /// <reference types="react" />
2
- import { RenderYooptaElementProps } from '@yoopta/editor';
3
- import { CodeChildElement } from '../types';
4
- declare const CodeLineRender: () => ({ attributes, children }: RenderYooptaElementProps<CodeChildElement>) => JSX.Element;
5
- export { CodeLineRender };
@@ -1,9 +0,0 @@
1
- /// <reference types="react" />
2
- import { RenderYooptaElementProps } from '@yoopta/editor';
3
- import 'prism-material-themes/themes/material-default.css';
4
- import { CodeElement } from '../types';
5
- declare function CodeRender({ element, attributes, children, HTMLAttributes }: RenderYooptaElementProps<CodeElement>): JSX.Element;
6
- declare namespace CodeRender {
7
- var displayName: string;
8
- }
9
- export { CodeRender };
@@ -1,6 +0,0 @@
1
- /// <reference types="react" />
2
- declare const LanguageSelect: ({ onChange, value }: {
3
- onChange: any;
4
- value: any;
5
- }) => JSX.Element;
6
- export { LanguageSelect };
@@ -1,5 +0,0 @@
1
- import { YooEditor } from '@yoopta/editor';
2
- import { Node, NodeEntry } from 'slate';
3
- export declare const mergeMaps: <K, V>(...maps: Map<K, V>[]) => Map<K, V>;
4
- export declare const getChildNodeToDecorations: ([block, blockPath]: NodeEntry<any>) => Map<import("..").CodeElement | import("..").CodeChildElement, import("slate").BaseRange[]>;
5
- export declare const codeLineDecorator: (editor: YooEditor) => ([node, path]: NodeEntry<Node>) => import("slate").BaseRange[];
@@ -1,13 +0,0 @@
1
- /**
2
- * Copied from prism-react-renderer repo
3
- * https://github.com/FormidableLabs/prism-react-renderer/blob/master/src/utils/normalizeTokens.js
4
- * */
5
- import Prism from 'prismjs';
6
- type PrismToken = Prism.Token;
7
- type Token = {
8
- types: string[];
9
- content: string;
10
- empty?: boolean;
11
- };
12
- export declare const normalizeTokens: (tokens: Array<PrismToken | string>) => Token[][];
13
- export {};