tinacms 3.6.3 → 3.7.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 (20) hide show
  1. package/dist/index.js +1092 -11
  2. package/dist/rich-text/index.d.ts +4 -0
  3. package/dist/rich-text/index.js +14 -0
  4. package/dist/toolkit/components/dashboard/dashboard-ui.d.ts +16 -0
  5. package/dist/toolkit/components/dashboard/media-usage-dashboard/index.d.ts +6 -0
  6. package/dist/toolkit/components/dashboard/media-usage-dashboard/media-lightbox.d.ts +6 -0
  7. package/dist/toolkit/components/dashboard/media-usage-dashboard/media-usage-scanner.d.ts +21 -0
  8. package/dist/toolkit/components/dashboard/media-usage-dashboard/media-usage-table.d.ts +7 -0
  9. package/dist/toolkit/components/dashboard/media-usage-dashboard/media-usage-thumbnails.d.ts +5 -0
  10. package/dist/toolkit/components/dashboard/media-usage-dashboard/useMediaUsageScanner.d.ts +8 -0
  11. package/dist/toolkit/components/ui/dialog.d.ts +16 -0
  12. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/components/plate-ui/icons.d.ts +1 -0
  13. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/components/plate-ui/mark-toolbar-button.d.ts +1 -0
  14. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/plugins/editor-plugins.d.ts +3 -3
  15. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/plugins/ui/components.d.ts +2 -0
  16. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/toolbar/toolbar-overrides.d.ts +1 -1
  17. package/dist/toolkit/form-builder/create-branch-modal.d.ts +3 -1
  18. package/dist/toolkit/plugin-screens/media-usage-dashboard-screen.d.ts +1 -0
  19. package/dist/toolkit/react-screens/screen-plugin.d.ts +2 -2
  20. package/package.json +5 -4
@@ -43,6 +43,10 @@ type BaseComponents = {
43
43
  code?: {
44
44
  children: JSX.Element;
45
45
  };
46
+ highlight?: {
47
+ children: JSX.Element;
48
+ color?: string;
49
+ };
46
50
  text?: {
47
51
  children: string;
48
52
  };
@@ -55,6 +55,20 @@ const Leaf = (props) => {
55
55
  }
56
56
  return /* @__PURE__ */ React.createElement("code", null, /* @__PURE__ */ React.createElement(Leaf, { ...rest }));
57
57
  }
58
+ if (props.highlight) {
59
+ const { highlight, highlightColor, ...rest } = props;
60
+ if (props.components.highlight) {
61
+ const Component = props.components.highlight;
62
+ return /* @__PURE__ */ React.createElement(Component, { color: highlightColor }, /* @__PURE__ */ React.createElement(Leaf, { ...rest }));
63
+ }
64
+ return /* @__PURE__ */ React.createElement(
65
+ "mark",
66
+ {
67
+ style: highlightColor ? { backgroundColor: highlightColor } : void 0
68
+ },
69
+ /* @__PURE__ */ React.createElement(Leaf, { ...rest })
70
+ );
71
+ }
58
72
  if (props.components.text) {
59
73
  const Component = props.components.text;
60
74
  return /* @__PURE__ */ React.createElement(Component, null, props.text);
@@ -0,0 +1,16 @@
1
+ import React from 'react';
2
+ export declare const DashboardLoadingState: ({ message, progress, }: {
3
+ message: string;
4
+ progress?: {
5
+ value: number;
6
+ label?: string;
7
+ };
8
+ }) => React.JSX.Element;
9
+ export declare const DashboardErrorState: ({ message }: {
10
+ message: string;
11
+ }) => React.JSX.Element;
12
+ export declare const DashboardTitleBar: ({ title, icon, controls, }: {
13
+ title: string;
14
+ icon: React.ReactNode;
15
+ controls?: React.ReactNode;
16
+ }) => React.JSX.Element;
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ import type { ScreenComponentProps } from '../../../react-screens';
3
+ /**
4
+ * Media Usage Dashboard component that displays media files and their usage across the CMS
5
+ */
6
+ export declare const MediaUsageDashboard: ({ close: onClose, }: ScreenComponentProps) => React.JSX.Element;
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ import type { MediaUsage } from './media-usage-scanner';
3
+ export declare const MediaLightbox: ({ item, onClose, }: {
4
+ item: MediaUsage | null;
5
+ onClose: () => void;
6
+ }) => React.JSX.Element;
@@ -0,0 +1,21 @@
1
+ import type { Media } from '../../../core/media';
2
+ import { TinaCMS } from '@tinacms/toolkit';
3
+ export interface DocumentReference {
4
+ collectionName: string;
5
+ collectionLabel: string;
6
+ breadcrumbs: string[];
7
+ editUrl: string;
8
+ }
9
+ export interface MediaUsage {
10
+ media: Media;
11
+ type: 'image' | 'video' | 'other';
12
+ usedIn: DocumentReference[];
13
+ }
14
+ /**
15
+ * Scans all media items in the CMS and counts their usage
16
+ * (multiple occurrences in a single document counts as 1 occurrence) across all documents in all collections.
17
+ * @param cms - The CMS instance
18
+ * @param onProgress - Optional callback invoked with progress percentage (0–100) as collections are scanned
19
+ * @returns A Promise resolving to an array of MediaItems with populated usage metrics
20
+ */
21
+ export declare const scanAllMedia: (cms: TinaCMS, onProgress?: (percent: number) => void) => Promise<MediaUsage[]>;
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ import type { MediaUsage } from './media-usage-scanner';
3
+ export declare const MediaUsageTable: ({ mediaItems, onClose, onPreview, }: {
4
+ mediaItems: MediaUsage[];
5
+ onClose?: () => void;
6
+ onPreview: (item: MediaUsage) => void;
7
+ }) => React.JSX.Element;
@@ -0,0 +1,5 @@
1
+ export declare const MEDIA_USAGE_THUMBNAIL_SIZE: {
2
+ readonly w: 75;
3
+ readonly h: 75;
4
+ };
5
+ export declare const MEDIA_USAGE_THUMBNAIL_KEY: string;
@@ -0,0 +1,8 @@
1
+ import { type MediaUsage } from './media-usage-scanner';
2
+ export declare const useMediaUsageScanner: () => {
3
+ mediaItems: MediaUsage[];
4
+ isLoading: boolean;
5
+ errorOccurred: boolean;
6
+ progress: number;
7
+ refresh: () => Promise<void>;
8
+ };
@@ -0,0 +1,16 @@
1
+ import * as React from 'react';
2
+ import * as DialogPrimitive from '@radix-ui/react-dialog';
3
+ declare function Dialog({ ...props }: React.ComponentProps<typeof DialogPrimitive.Root>): React.JSX.Element;
4
+ declare const DialogOverlay: React.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogOverlayProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
5
+ declare function DialogContent({ className, children, showCloseButton, ...props }: React.ComponentProps<typeof DialogPrimitive.Content> & {
6
+ showCloseButton?: boolean;
7
+ }): React.JSX.Element;
8
+ declare function DialogTitle({ className, ...props }: React.ComponentProps<typeof DialogPrimitive.Title>): React.JSX.Element;
9
+ declare namespace DialogTitle {
10
+ var displayName: string;
11
+ }
12
+ declare function DialogDescription({ className, ...props }: React.ComponentProps<typeof DialogPrimitive.Description>): React.JSX.Element;
13
+ declare namespace DialogDescription {
14
+ var displayName: string;
15
+ }
16
+ export { Dialog, DialogOverlay, DialogContent, DialogTitle, DialogDescription };
@@ -64,6 +64,7 @@ export declare const Icons: {
64
64
  row: React.ForwardRefExoticComponent<Omit<LucideProps, "ref"> & React.RefAttributes<SVGSVGElement>>;
65
65
  search: React.ForwardRefExoticComponent<Omit<LucideProps, "ref"> & React.RefAttributes<SVGSVGElement>>;
66
66
  settings: React.ForwardRefExoticComponent<Omit<LucideProps, "ref"> & React.RefAttributes<SVGSVGElement>>;
67
+ highlight: React.ForwardRefExoticComponent<Omit<LucideProps, "ref"> & React.RefAttributes<SVGSVGElement>>;
67
68
  strikethrough: React.ForwardRefExoticComponent<Omit<LucideProps, "ref"> & React.RefAttributes<SVGSVGElement>>;
68
69
  subscript: React.ForwardRefExoticComponent<Omit<LucideProps, "ref"> & React.RefAttributes<SVGSVGElement>>;
69
70
  superscript: React.ForwardRefExoticComponent<Omit<LucideProps, "ref"> & React.RefAttributes<SVGSVGElement>>;
@@ -3,3 +3,4 @@ export declare const BoldToolbarButton: () => React.JSX.Element;
3
3
  export declare const StrikethroughToolbarButton: () => React.JSX.Element;
4
4
  export declare const ItalicToolbarButton: () => React.JSX.Element;
5
5
  export declare const CodeToolbarButton: () => React.JSX.Element;
6
+ export declare const HighlightToolbarButton: () => React.JSX.Element;
@@ -3,7 +3,7 @@ import { AutoformatRule } from '@udecode/plate-autoformat';
3
3
  import { ListStyleType } from '@udecode/plate-indent-list';
4
4
  import { createLowlight } from 'lowlight';
5
5
  export declare const HANDLES_MDX: ("h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "p")[];
6
- export declare const viewPlugins: readonly [import("@udecode/plate/react").PlatePlugin<import("@udecode/plate").PluginConfig<"basicMarks", {}, {}, {}, {}>>, import("@udecode/plate/react").PlatePlugin<import("@udecode/plate").PluginConfig<"underline", {}, {}, {}, {}>>, import("@udecode/plate/react").PlatePlugin<import("@udecode/plate").PluginConfig<"heading", {
6
+ export declare const viewPlugins: readonly [import("@udecode/plate/react").PlatePlugin<import("@udecode/plate").PluginConfig<"basicMarks", {}, {}, {}, {}>>, import("@udecode/plate/react").PlatePlugin<import("@udecode/plate").PluginConfig<"underline", {}, {}, {}, {}>>, import("@udecode/plate/react").PlatePlugin<import("@udecode/plate").PluginConfig<"highlight", {}, {}, {}, {}>>, import("@udecode/plate/react").PlatePlugin<import("@udecode/plate").PluginConfig<"heading", {
7
7
  levels?: import("@udecode/plate-heading").HeadingLevel | import("@udecode/plate-heading").HeadingLevel[];
8
8
  }, {}, {}, {}>>, import("@udecode/plate/react").PlatePlugin<import("@udecode/plate").PluginConfig<"p", {}, {}, {}, {}>>, import("@udecode/plate/react").PlatePlugin<import("@udecode/plate").PluginConfig<"code_block", {
9
9
  defaultLanguage?: string | null;
@@ -13,7 +13,7 @@ export declare const editorPlugins: readonly [import("@udecode/plate/react").Pla
13
13
  isElement: boolean;
14
14
  isVoid: boolean;
15
15
  isInline: boolean;
16
- }, {}, {}, {}>>, import("@udecode/plate").SlatePlugin<import("@udecode/plate").PluginConfig<"WITH_CORRECT_NODE_BEHAVIOR", {}, {}, {}, {}>>, import("@udecode/plate/react").PlatePlugin<import("@udecode/plate").PluginConfig<"a", {
16
+ }, {}, {}, {}>>, import("@udecode/plate").SlatePlugin<import("@udecode/plate").PluginConfig<"WITH_CORRECT_NODE_BEHAVIOR", {}, {}, {}, {}>>, import("@udecode/plate").SlatePlugin<import("@udecode/plate").PluginConfig<"CLEAR_HIGHLIGHT_ON_ENTER", {}, {}, {}, {}>>, import("@udecode/plate/react").PlatePlugin<import("@udecode/plate").PluginConfig<"a", {
17
17
  allowedSchemes?: string[];
18
18
  dangerouslySkipSanitization?: boolean;
19
19
  defaultLinkAttributes?: React.AnchorHTMLAttributes<HTMLAnchorElement>;
@@ -337,7 +337,7 @@ export declare const editorPlugins: readonly [import("@udecode/plate/react").Pla
337
337
  };
338
338
  }, {}, {
339
339
  isOpen?: (editorId: string) => boolean;
340
- }>>, import("@udecode/plate/react").PlatePlugin<import("@udecode/plate").PluginConfig<"basicMarks", {}, {}, {}, {}>>, import("@udecode/plate/react").PlatePlugin<import("@udecode/plate").PluginConfig<"underline", {}, {}, {}, {}>>, import("@udecode/plate/react").PlatePlugin<import("@udecode/plate").PluginConfig<"heading", {
340
+ }>>, import("@udecode/plate/react").PlatePlugin<import("@udecode/plate").PluginConfig<"basicMarks", {}, {}, {}, {}>>, import("@udecode/plate/react").PlatePlugin<import("@udecode/plate").PluginConfig<"underline", {}, {}, {}, {}>>, import("@udecode/plate/react").PlatePlugin<import("@udecode/plate").PluginConfig<"highlight", {}, {}, {}, {}>>, import("@udecode/plate/react").PlatePlugin<import("@udecode/plate").PluginConfig<"heading", {
341
341
  levels?: import("@udecode/plate-heading").HeadingLevel | import("@udecode/plate-heading").HeadingLevel[];
342
342
  }, {}, {}, {}>>, import("@udecode/plate/react").PlatePlugin<import("@udecode/plate").PluginConfig<"p", {}, {}, {}, {}>>, import("@udecode/plate/react").PlatePlugin<import("@udecode/plate").PluginConfig<"code_block", {
343
343
  defaultLanguage?: string | null;
@@ -1,4 +1,5 @@
1
1
  import { CodeLinePlugin } from '@udecode/plate-code-block/react';
2
+ import { PlateLeaf } from '@udecode/plate/react';
2
3
  import React from 'react';
3
4
  import { CodeLeaf } from '../../components/plate-ui/code-leaf';
4
5
  import { CodeSyntaxLeaf } from '../../components/plate-ui/code-syntax-leaf';
@@ -207,6 +208,7 @@ export declare const Components: () => {
207
208
  }, "ref"> & React.RefAttributes<unknown>>;
208
209
  a: typeof LinkElement;
209
210
  code: typeof CodeLeaf;
211
+ highlight: ({ leaf, ...props }: React.ComponentProps<typeof PlateLeaf>) => React.JSX.Element;
210
212
  underline: React.ForwardRefExoticComponent<Omit<Omit<import("@udecode/plate/react").PlateLeafProps<import("@udecode/plate").TText, import("@udecode/plate").AnyPluginConfig>, keyof {
211
213
  className?: string;
212
214
  style?: React.CSSProperties;
@@ -1,4 +1,4 @@
1
- export type ToolbarOverrideType = 'heading' | 'link' | 'image' | 'quote' | 'ul' | 'ol' | 'code' | 'codeBlock' | 'bold' | 'strikethrough' | 'italic' | 'mermaid' | 'raw' | 'embed' | 'table' | 'hr';
1
+ export type ToolbarOverrideType = 'heading' | 'link' | 'image' | 'quote' | 'ul' | 'ol' | 'code' | 'codeBlock' | 'bold' | 'italic' | 'strikethrough' | 'highlight' | 'mermaid' | 'raw' | 'embed' | 'table' | 'hr';
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,10 +1,12 @@
1
1
  import * as React from 'react';
2
- export declare const CreateBranchModal: ({ close, safeSubmit, path, values, crudType, }: {
2
+ import { Form } from '../forms';
3
+ export declare const CreateBranchModal: ({ close, safeSubmit, path, values, crudType, tinaForm, }: {
3
4
  safeSubmit: () => Promise<void>;
4
5
  close: () => void;
5
6
  path: string;
6
7
  values: Record<string, unknown>;
7
8
  crudType: string;
9
+ tinaForm?: Form;
8
10
  }) => React.JSX.Element;
9
11
  export declare const PrefixedTextField: ({ label, prefix, ...props }: {
10
12
  [x: string]: any;
@@ -0,0 +1 @@
1
+ export declare const MediaUsageDashboardScreenPlugin: import("../react-screens").ScreenPlugin<unknown>;
@@ -17,7 +17,7 @@ export interface ScreenPlugin<ExtraProps = {}> extends Plugin {
17
17
  Component(props: ScreenComponentProps & ExtraProps): React.ReactElement;
18
18
  Icon: any;
19
19
  layout: 'fullscreen' | 'popup';
20
- navCategory?: 'Account' | 'Site';
20
+ navCategory?: 'Account' | 'Site' | 'Dashboard';
21
21
  }
22
22
  /**
23
23
  * The set of props passed to all Screen Components.
@@ -34,7 +34,7 @@ export interface ScreenOptions<ExtraProps = {}> {
34
34
  Icon: any;
35
35
  layout?: ScreenPlugin['layout'];
36
36
  props?: ExtraProps;
37
- navCategory?: 'Account' | 'Site';
37
+ navCategory?: 'Account' | 'Site' | 'Dashboard';
38
38
  }
39
39
  /**
40
40
  * Creates screen plugins.
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "tinacms",
3
3
  "type": "module",
4
4
  "typings": "dist/index.d.ts",
5
- "version": "3.6.3",
5
+ "version": "3.7.0",
6
6
  "main": "dist/index.js",
7
7
  "module": "./dist/index.js",
8
8
  "exports": {
@@ -65,6 +65,7 @@
65
65
  "@udecode/plate-dnd": "^48.0.0",
66
66
  "@udecode/plate-floating": "^48.0.0",
67
67
  "@udecode/plate-heading": "^48",
68
+ "@udecode/plate-highlight": "^48",
68
69
  "@udecode/plate-horizontal-rule": "^48",
69
70
  "@udecode/plate-indent-list": "^48.0.0",
70
71
  "@udecode/plate-link": "^48.0.0",
@@ -111,9 +112,9 @@
111
112
  "webfontloader": "1.6.28",
112
113
  "yup": "^1.6.1",
113
114
  "zod": "^3.24.2",
114
- "@tinacms/mdx": "2.0.7",
115
+ "@tinacms/mdx": "2.1.0",
115
116
  "@tinacms/schema-tools": "2.7.0",
116
- "@tinacms/search": "1.2.6"
117
+ "@tinacms/search": "1.2.7"
117
118
  },
118
119
  "devDependencies": {
119
120
  "@graphql-tools/utils": "^10.8.1",
@@ -141,7 +142,7 @@
141
142
  "typescript": "^5.7.3",
142
143
  "vite": "^5.4.14",
143
144
  "vitest": "^2.1.9",
144
- "@tinacms/scripts": "1.5.0"
145
+ "@tinacms/scripts": "1.6.0"
145
146
  },
146
147
  "peerDependencies": {
147
148
  "react": ">=16.14.0",