tinacms 0.0.0-8a702b8-20241010053417 → 0.0.0-9d5e351-20241023053720

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,16 +1,25 @@
1
1
  const makeCacheDir = async (dir, fs) => {
2
2
  const path = await import("./__vite-browser-external-d06ac358.mjs");
3
3
  const os = await import("./__vite-browser-external-d06ac358.mjs");
4
- const parts = dir.split(path.sep).filter(Boolean);
4
+ if (typeof dir !== "string" || !dir.trim()) {
5
+ throw new Error("Invalid directory path");
6
+ }
7
+ const pathParts = dir.split(path.sep);
8
+ const cacheHash = pathParts[pathParts.length - 1];
5
9
  let cacheDir = dir;
6
- if (!fs.existsSync(path.join(path.sep, parts[0]))) {
7
- cacheDir = path.join(os.tmpdir(), parts[parts.length - 1]);
10
+ if (!fs.existsSync(dir)) {
11
+ cacheDir = path.join(os.tmpdir(), cacheHash);
12
+ }
13
+ try {
14
+ fs.mkdirSync(cacheDir, { recursive: true });
15
+ } catch (error) {
16
+ throw new Error(`Failed to create cache directory: ${error.message}`);
8
17
  }
9
- fs.mkdirSync(cacheDir, { recursive: true });
10
18
  return cacheDir;
11
19
  };
12
20
  const NodeCache = async (dir) => {
13
- const fs = await import("./__vite-browser-external-d06ac358.mjs");
21
+ const fs = (await import("./__vite-browser-external-d06ac358.mjs")).default;
22
+ console.log("fs", JSON.stringify(fs));
14
23
  const { createHash } = await import("./__vite-browser-external-d06ac358.mjs");
15
24
  const cacheDir = await makeCacheDir(dir, fs);
16
25
  return {
@@ -65,6 +65,9 @@ type BaseComponents = {
65
65
  lang?: string;
66
66
  value: string;
67
67
  };
68
+ mermaid?: {
69
+ value: string;
70
+ };
68
71
  img?: {
69
72
  url: string;
70
73
  caption?: string;
@@ -117,7 +117,8 @@
117
117
  // @ts-ignore FIXME: TinaMarkdownContent needs to be a union of all possible node types
118
118
  /* @__PURE__ */ React.createElement("a", { href: child.url }, /* @__PURE__ */ React.createElement(TinaMarkdown, { components, content: children }))
119
119
  );
120
- case "code_block":
120
+ case "mermaid":
121
+ case "code_block": {
121
122
  const value = child.value;
122
123
  if (components[child.type]) {
123
124
  const Component2 = components[child.type];
@@ -127,6 +128,7 @@
127
128
  );
128
129
  }
129
130
  return /* @__PURE__ */ React.createElement("pre", null, /* @__PURE__ */ React.createElement("code", null, value));
131
+ }
130
132
  case "hr":
131
133
  if (components[child.type]) {
132
134
  const Component2 = components[child.type];
@@ -114,7 +114,8 @@ const Node = ({ components, child }) => {
114
114
  // @ts-ignore FIXME: TinaMarkdownContent needs to be a union of all possible node types
115
115
  /* @__PURE__ */ React.createElement("a", { href: child.url }, /* @__PURE__ */ React.createElement(TinaMarkdown, { components, content: children }))
116
116
  );
117
- case "code_block":
117
+ case "mermaid":
118
+ case "code_block": {
118
119
  const value = child.value;
119
120
  if (components[child.type]) {
120
121
  const Component2 = components[child.type];
@@ -124,6 +125,7 @@ const Node = ({ components, child }) => {
124
125
  );
125
126
  }
126
127
  return /* @__PURE__ */ React.createElement("pre", null, /* @__PURE__ */ React.createElement("code", null, value));
128
+ }
127
129
  case "hr":
128
130
  if (components[child.type]) {
129
131
  const Component2 = components[child.type];
@@ -33,6 +33,7 @@ export declare const Icons: {
33
33
  chevronsUpDown: React.ForwardRefExoticComponent<Omit<LucideProps, "ref"> & React.RefAttributes<SVGSVGElement>>;
34
34
  clear: React.ForwardRefExoticComponent<Omit<LucideProps, "ref"> & React.RefAttributes<SVGSVGElement>>;
35
35
  close: React.ForwardRefExoticComponent<Omit<LucideProps, "ref"> & React.RefAttributes<SVGSVGElement>>;
36
+ paint: React.ForwardRefExoticComponent<Omit<LucideProps, "ref"> & React.RefAttributes<SVGSVGElement>>;
36
37
  codeblock: React.ForwardRefExoticComponent<Omit<LucideProps, "ref"> & React.RefAttributes<SVGSVGElement>>;
37
38
  color: React.ForwardRefExoticComponent<Omit<LucideProps, "ref"> & React.RefAttributes<SVGSVGElement>>;
38
39
  column: React.ForwardRefExoticComponent<Omit<LucideProps, "ref"> & React.RefAttributes<SVGSVGElement>>;
@@ -55,6 +56,7 @@ export declare const Icons: {
55
56
  kbd: React.ForwardRefExoticComponent<Omit<LucideProps, "ref"> & React.RefAttributes<SVGSVGElement>>;
56
57
  lineHeight: React.ForwardRefExoticComponent<Omit<LucideProps, "ref"> & React.RefAttributes<SVGSVGElement>>;
57
58
  minus: React.ForwardRefExoticComponent<Omit<LucideProps, "ref"> & React.RefAttributes<SVGSVGElement>>;
59
+ mermaid: () => React.JSX.Element;
58
60
  more: React.ForwardRefExoticComponent<Omit<LucideProps, "ref"> & React.RefAttributes<SVGSVGElement>>;
59
61
  outdent: React.ForwardRefExoticComponent<Omit<LucideProps, "ref"> & React.RefAttributes<SVGSVGElement>>;
60
62
  paragraph: React.ForwardRefExoticComponent<Omit<LucideProps, "ref"> & React.RefAttributes<SVGSVGElement>>;
@@ -0,0 +1,11 @@
1
+ import React from 'react';
2
+ export declare const MermaidElement: React.ForwardRefExoticComponent<Omit<Omit<{
3
+ elementToAttributes?: (element: import("@udecode/plate-common").TElement) => any;
4
+ } & Omit<{
5
+ as?: React.ElementType<any, keyof React.JSX.IntrinsicElements> | undefined;
6
+ asChild?: boolean | undefined;
7
+ } & Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & React.RefAttributes<any>, "ref"> & {
8
+ ref?: React.Ref<any>;
9
+ } & import("@udecode/plate-common").PlateRenderNodeProps<import("@udecode/plate-common").Value, import("@udecode/plate-common").PlateEditor<import("@udecode/plate-common").Value>> & {
10
+ element: import("@udecode/plate-common").TElement;
11
+ } & Omit<import("slate-react").RenderElementProps, "element"> & React.RefAttributes<HTMLDivElement>, "ref">, never> & React.RefAttributes<any>>;
@@ -0,0 +1,20 @@
1
+ import { type PlateEditor } from '@udecode/plate-common';
2
+ import React from 'react';
3
+ export declare const insertEmptyMermaid: (editor: PlateEditor) => void;
4
+ export declare const MermaidToolbarButton: React.ForwardRefExoticComponent<{
5
+ clear?: string | string[];
6
+ } & Omit<Omit<{
7
+ tooltip?: React.ReactNode;
8
+ tooltipContentProps?: Omit<React.ComponentPropsWithoutRef<React.ForwardRefExoticComponent<import("@radix-ui/react-tooltip").TooltipContentProps & React.RefAttributes<HTMLDivElement>>>, "children">;
9
+ tooltipProps?: Omit<React.ComponentPropsWithoutRef<React.FC<import("@radix-ui/react-tooltip").TooltipProps>>, "children">;
10
+ } & Omit<{
11
+ isDropdown?: boolean;
12
+ pressed?: boolean;
13
+ showArrow?: boolean;
14
+ } & Omit<Omit<Omit<import("@radix-ui/react-toolbar").ToolbarToggleItemProps & React.RefAttributes<HTMLButtonElement>, "ref"> & import("class-variance-authority").VariantProps<(props?: {
15
+ size?: "default" | "sm" | "lg";
16
+ variant?: "default" | "outline";
17
+ } & import("class-variance-authority/dist/types").ClassProp) => string> & React.RefAttributes<HTMLButtonElement>, "ref">, "value" | "asChild"> & import("class-variance-authority").VariantProps<(props?: {
18
+ size?: "default" | "sm" | "lg";
19
+ variant?: "default" | "outline";
20
+ } & import("class-variance-authority/dist/types").ClassProp) => string> & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>, "ref">, "clear"> & React.RefAttributes<HTMLButtonElement>>;
@@ -0,0 +1,5 @@
1
+ import * as React from 'react';
2
+ export interface TextareaProps extends React.TextareaHTMLAttributes<HTMLTextAreaElement> {
3
+ }
4
+ declare const Textarea: React.ForwardRefExoticComponent<TextareaProps & React.RefAttributes<HTMLTextAreaElement>>;
5
+ export { Textarea };
@@ -0,0 +1,2 @@
1
+ export declare const ELEMENT_MERMAID = "mermaid";
2
+ export declare const createMermaidPlugin: <OP = import("@udecode/plate-common").AnyObject, OV extends import("@udecode/plate-common").Value = import("@udecode/plate-common").Value, OE extends import("@udecode/plate-common").PlateEditor<OV> = import("@udecode/plate-common").PlateEditor<OV>>(override?: Partial<import("@udecode/plate-common").PlatePlugin<import("@udecode/plate-common").NoInfer<OP>, OV, OE>>, overrideByKey?: import("@udecode/plate-common").OverrideByKey<OV, OE>) => import("@udecode/plate-common").PlatePlugin<import("@udecode/plate-common").NoInfer<OP>, OV, OE>;
@@ -1,9 +1,11 @@
1
- import React from 'react';
2
1
  import { type PlateEditor, type TElement } from '@udecode/plate-common';
3
- export declare const CodeBlock: ({ attributes, editor, element, language: restrictLanguage, ...props }: {
2
+ import React from 'react';
3
+ export declare const CodeBlock: ({ attributes, editor, element, language: restrictLanguage, onChangeCallback, defaultValue, ...props }: {
4
4
  attributes: Record<string, unknown>;
5
5
  element: TElement;
6
6
  editor: PlateEditor;
7
7
  language?: string;
8
8
  children: React.ReactNode;
9
+ defaultValue?: unknown;
10
+ onChangeCallback?: (value: string) => void;
9
11
  }) => React.JSX.Element;
@@ -60,6 +60,16 @@ export declare const Components: () => {
60
60
  editor: any;
61
61
  element: any;
62
62
  }) => React.JSX.Element;
63
+ mermaid: React.ForwardRefExoticComponent<Omit<Omit<{
64
+ elementToAttributes?: (element: import("@udecode/plate-common").TElement) => any;
65
+ } & Omit<{
66
+ as?: React.ElementType<any, keyof React.JSX.IntrinsicElements> | undefined;
67
+ asChild?: boolean | undefined;
68
+ } & Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & React.RefAttributes<any>, "ref"> & {
69
+ ref?: React.Ref<any>;
70
+ } & import("@udecode/plate-common").PlateRenderNodeProps<import("@udecode/plate-common").Value, import("@udecode/plate-common").PlateEditor<import("@udecode/plate-common").Value>> & {
71
+ element: import("@udecode/plate-common").TElement;
72
+ } & Omit<import("slate-react").RenderElementProps, "element"> & React.RefAttributes<HTMLDivElement>, "ref">, never> & React.RefAttributes<any>>;
63
73
  blockquote: React.ForwardRefExoticComponent<Omit<Omit<{
64
74
  elementToAttributes?: (element: import("@udecode/plate-common").TElement) => any;
65
75
  } & Omit<{
@@ -1,4 +1,4 @@
1
- export type ToolbarOverrideType = 'heading' | 'link' | 'image' | 'quote' | 'ul' | 'ol' | 'code' | 'codeBlock' | 'bold' | 'italic' | 'raw' | 'embed' | 'table';
1
+ export type ToolbarOverrideType = 'heading' | 'link' | 'image' | 'quote' | 'ul' | 'ol' | 'code' | 'codeBlock' | 'bold' | 'italic' | 'mermaid' | 'raw' | 'embed' | 'table';
2
2
  export declare const STANDARD_ICON_WIDTH = 32;
3
3
  export declare const HEADING_ICON_WITH_TEXT = 127;
4
4
  export declare const HEADING_ICON_ONLY = 58;
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import { type ReactNode } from 'react';
3
- import type { MdxTemplate } from '../types';
4
3
  import type { Form } from '../../../../../forms';
4
+ import type { MdxTemplate } from '../types';
5
5
  import type { ToolbarOverrideType } from './toolbar-overrides';
6
6
  interface ToolbarContextProps {
7
7
  tinaForm: Form;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tinacms",
3
- "version": "0.0.0-8a702b8-20241010053417",
3
+ "version": "0.0.0-9d5e351-20241023053720",
4
4
  "main": "dist/index.js",
5
5
  "module": "./dist/index.mjs",
6
6
  "exports": {
@@ -108,6 +108,7 @@
108
108
  "lodash.get": "^4.4.2",
109
109
  "lodash.set": "^4.3.2",
110
110
  "lucide-react": "^0.424.0",
111
+ "mermaid": "9.3.0",
111
112
  "moment": "2.29.4",
112
113
  "monaco-editor": "0.31.0",
113
114
  "prism-react-renderer": "^2.4.0",
@@ -128,9 +129,9 @@
128
129
  "webfontloader": "1.6.28",
129
130
  "yup": "^1.4.0",
130
131
  "zod": "^3.23.8",
131
- "@tinacms/mdx": "0.0.0-8a702b8-20241010053417",
132
- "@tinacms/schema-tools": "1.6.5",
133
- "@tinacms/search": "0.0.0-8a702b8-20241010053417"
132
+ "@tinacms/mdx": "1.5.0",
133
+ "@tinacms/schema-tools": "1.6.6",
134
+ "@tinacms/search": "1.0.33"
134
135
  },
135
136
  "devDependencies": {
136
137
  "@graphql-tools/utils": "^10.5.4",
@@ -163,7 +164,7 @@
163
164
  "typescript": "^5.6.2",
164
165
  "vite": "^5.4.8",
165
166
  "vitest": "^2.1.1",
166
- "@tinacms/scripts": "0.0.0-8a702b8-20241010053417"
167
+ "@tinacms/scripts": "1.3.0"
167
168
  },
168
169
  "peerDependencies": {
169
170
  "react": ">=16.14.0",