tinacms 3.9.3 → 3.10.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.
@@ -170,6 +170,7 @@ export declare class Client {
170
170
  branchName: string;
171
171
  baseBranch: string;
172
172
  prTitle?: string;
173
+ isDraft?: boolean;
173
174
  graphQLContentOp?: {
174
175
  query: string;
175
176
  variables: Record<string, unknown>;
@@ -23,6 +23,12 @@ export type SaveContentErrorPayload = {
23
23
  documentPath?: string;
24
24
  error?: string;
25
25
  };
26
+ export declare const EditorialWorkflowSaveEvent: string;
27
+ export type EditorialWorkflowSavePayload = {
28
+ choice: 'draft' | 'review' | 'publish';
29
+ success: boolean;
30
+ error?: string;
31
+ };
26
32
  export declare const FormResetEvent: string;
27
33
  export declare const MediaManagerContentUploadedEvent: string;
28
34
  export type MediaManagerContentUploadedPayload = {
package/dist/react.js CHANGED
@@ -147,17 +147,24 @@ function useTina(props) {
147
147
  }
148
148
  function useEditState() {
149
149
  const [edit, setEdit] = React.useState(false);
150
+ const trustedAdminOrigins = useTrustedAdminOrigins();
150
151
  React.useEffect(() => {
151
- if (typeof window !== "undefined") {
152
- parent.postMessage({ type: "isEditMode" }, window.location.origin);
153
- window.addEventListener("message", (event) => {
154
- var _a;
155
- if (((_a = event.data) == null ? void 0 : _a.type) === "tina:editMode") {
156
- setEdit(true);
157
- }
158
- });
159
- }
160
- }, []);
152
+ if (typeof window === "undefined")
153
+ return;
154
+ parent.postMessage({ type: "isEditMode" }, window.location.origin);
155
+ const handleMessage = (event) => {
156
+ var _a;
157
+ if (!isFromAdmin(event, trustedAdminOrigins))
158
+ return;
159
+ if (((_a = event.data) == null ? void 0 : _a.type) === "tina:editMode") {
160
+ setEdit(true);
161
+ }
162
+ };
163
+ window.addEventListener("message", handleMessage);
164
+ return () => {
165
+ window.removeEventListener("message", handleMessage);
166
+ };
167
+ }, [trustedAdminOrigins]);
161
168
  return { edit };
162
169
  }
163
170
  export {
@@ -1,4 +1,3 @@
1
- import 'moment-timezone';
2
1
  import * as React from 'react';
3
2
  import { type DayPickerProps } from 'react-day-picker';
4
3
  type TimePickerType = 'minutes' | 'seconds' | 'hours' | '12hours';
@@ -106,6 +105,6 @@ declare const DateTimePicker: React.ForwardRefExoticComponent<{
106
105
  * Show the default month and time when popup the calendar. Default is the current Date().
107
106
  **/
108
107
  defaultPopupValue?: Date;
109
- } & Pick<DayPickerProps, "showOutsideDays" | "showWeekNumber" | "locale" | "weekStartsOn"> & React.RefAttributes<Partial<DateTimePickerRef>>>;
108
+ } & Pick<DayPickerProps, "locale" | "showOutsideDays" | "showWeekNumber" | "weekStartsOn"> & React.RefAttributes<Partial<DateTimePickerRef>>>;
110
109
  export { DateTimePicker, TimePickerInput, TimePicker, formatCurrentDate };
111
110
  export type { TimePickerType, DateTimePickerProps, DateTimePickerRef };
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Converts a moment.js format string to the equivalent date-fns format string.
3
+ * This is a non-breaking shim so callers that pass moment tokens (the public API
4
+ * contract for the date field's dateFormat/timeFormat options) continue to work
5
+ * after moment has been removed.
6
+ */
7
+ export declare function momentToDateFns(momentFormat: string): string;
@@ -1,12 +1,12 @@
1
1
  import React from 'react';
2
2
  import { type InputProps } from '../components';
3
- import type { DatetimepickerProps } from 'react-datetime';
4
- export declare const DateField: (props: import("./wrap-field-with-meta").InputFieldType<InputProps, DatetimepickerProps>) => React.JSX.Element;
3
+ import { type DateFieldProps } from './date-format';
4
+ export declare const DateField: (props: import("./wrap-field-with-meta").InputFieldType<InputProps, DateFieldProps>) => React.JSX.Element;
5
5
  export declare const DateFieldPlugin: {
6
6
  __type: string;
7
7
  name: string;
8
- Component: (props: import("./wrap-field-with-meta").InputFieldType<InputProps, DatetimepickerProps>) => React.JSX.Element;
9
- format: (val: string, _name: string, field: DatetimepickerProps) => string;
8
+ Component: (props: import("./wrap-field-with-meta").InputFieldType<InputProps, DateFieldProps>) => React.JSX.Element;
9
+ format: (val: string, _name: string, field: DateFieldProps) => string;
10
10
  parse: (val: string) => string;
11
11
  validate(value: any, values: any, meta: any, field: any): string;
12
12
  };
@@ -1,5 +1,13 @@
1
- import type { DatetimepickerProps } from 'react-datetime';
1
+ export interface DateFieldProps {
2
+ dateFormat?: string | boolean;
3
+ timeFormat?: string | boolean;
4
+ locale?: string;
5
+ experimental_focusIntent?: boolean;
6
+ onChange?: (value: unknown) => void;
7
+ required?: boolean;
8
+ [key: string]: unknown;
9
+ }
2
10
  export declare const DEFAULT_DATE_DISPLAY_FORMAT = "MMM DD, YYYY";
3
11
  export declare const DEFAULT_TIME_DISPLAY_FORMAT = "h:mm A";
4
- export declare const format: (val: string, _name: string, field: DatetimepickerProps) => string;
12
+ export declare const format: (val: string, _name: string, field: DateFieldProps) => string;
5
13
  export declare const parse: (val: string) => string;
@@ -1,7 +1,8 @@
1
1
  import * as React from 'react';
2
2
  import { Form } from '../forms';
3
+ import { type SaveChoice } from './save-options';
3
4
  export declare const CreateBranchModal: ({ close, safeSubmit, path, values, crudType, tinaForm, onBaseBranchDeleted, }: {
4
- safeSubmit: () => Promise<void>;
5
+ safeSubmit: (editorialWorkflowChoice?: SaveChoice) => Promise<void>;
5
6
  close: () => void;
6
7
  path: string;
7
8
  values: Record<string, unknown>;
@@ -9,14 +10,16 @@ export declare const CreateBranchModal: ({ close, safeSubmit, path, values, crud
9
10
  tinaForm?: Form;
10
11
  onBaseBranchDeleted?: () => void;
11
12
  }) => React.JSX.Element;
12
- export declare const CreateBranchPromptModal: ({ branchName, close, disabled, errorMessage, onBranchNameChange, onCreateBranch, onSaveToProtectedBranch, }: {
13
+ export declare const CreateBranchPromptModal: ({ branchName, close, disabled, errorMessage, onBranchNameChange, onCreateBranch, onSaveToProtectedBranch, showSaveOptions, disablePublish, }: {
13
14
  branchName: string;
14
15
  close: () => void;
15
16
  disabled?: boolean;
16
17
  errorMessage?: string;
17
18
  onBranchNameChange: (value: string) => void;
18
- onCreateBranch: () => void;
19
+ onCreateBranch: (isDraft: boolean) => void;
19
20
  onSaveToProtectedBranch: () => void;
21
+ showSaveOptions?: boolean;
22
+ disablePublish?: boolean;
20
23
  }) => React.JSX.Element;
21
24
  export declare const PrefixedTextField: ({ label, prefix, ...props }: {
22
25
  [x: string]: any;
@@ -0,0 +1,7 @@
1
+ export type SaveChoice = 'draft' | 'review' | 'publish';
2
+ export declare const SAVE_CHOICE_KEY = "tina.editorialWorkflow.saveChoice";
3
+ export declare const SAVE_CHOICE_ORDER: SaveChoice[];
4
+ export declare const resolveSaveOptions: (lastChoice: SaveChoice, disablePublish: boolean) => {
5
+ main: SaveChoice;
6
+ menu: SaveChoice[];
7
+ };
@@ -13,14 +13,18 @@ export interface ExecuteWorkflowOptions {
13
13
  crudType: string;
14
14
  tinaForm?: Form;
15
15
  signal?: AbortSignal;
16
+ isDraft?: boolean;
16
17
  }
17
18
  export interface UseEditorialWorkflowResult {
18
19
  isExecuting: boolean;
19
20
  errorMessage: string;
20
21
  currentStep: number;
21
22
  elapsedTime: number;
22
- /** Returns true on success, false on failure (error captured in errorMessage) */
23
- executeWorkflow: (opts: ExecuteWorkflowOptions) => Promise<boolean>;
23
+ /** Resolves with the outcome; on failure `error` holds the message. */
24
+ executeWorkflow: (opts: ExecuteWorkflowOptions) => Promise<{
25
+ success: boolean;
26
+ error?: string;
27
+ }>;
24
28
  /** Reset error/executing state so the form can be retried */
25
29
  reset: () => void;
26
30
  }
@@ -0,0 +1,5 @@
1
+ export declare const documentListPath: (collectionName: string, filePath: string) => string;
2
+ export declare const collectionListPathForDocument: (fullPath: string, collection: {
3
+ name: string;
4
+ path?: string;
5
+ }) => string;
@@ -5,6 +5,9 @@ interface NavCollection {
5
5
  label?: string;
6
6
  name: string;
7
7
  isAuthCollection?: boolean;
8
+ ui?: {
9
+ global?: boolean | object;
10
+ };
8
11
  }
9
12
  interface NavProps {
10
13
  isLocalMode: boolean;
@@ -28,6 +31,12 @@ interface NavProps {
28
31
  RenderNavCloud: React.ComponentType<{
29
32
  config: CloudConfigPlugin;
30
33
  }>;
34
+ RenderNavGlobal: React.ComponentType<{
35
+ collection: {
36
+ label?: string;
37
+ name: string;
38
+ };
39
+ }>;
31
40
  RenderNavCollection: React.ComponentType<{
32
41
  collection: {
33
42
  label: string;
@@ -41,5 +50,5 @@ interface NavProps {
41
50
  };
42
51
  }>;
43
52
  }
44
- export declare const Nav: ({ isLocalMode, showHamburger, menuIsOpen: menuIsOpenProp, toggleMenu: toggleMenuProp, className, children, showCollections, collectionsInfo, screens, cloudConfigs, contentCreators, sidebarWidth, RenderNavSite, RenderNavCloud, RenderNavCollection, AuthRenderNavCollection, ...props }: NavProps) => React.JSX.Element;
53
+ export declare const Nav: ({ isLocalMode, showHamburger, menuIsOpen: menuIsOpenProp, toggleMenu: toggleMenuProp, className, children, showCollections, collectionsInfo, screens, cloudConfigs, contentCreators, sidebarWidth, RenderNavSite, RenderNavCloud, RenderNavGlobal, RenderNavCollection, AuthRenderNavCollection, ...props }: NavProps) => React.JSX.Element;
45
54
  export {};
@@ -21,6 +21,7 @@ export interface FormHeaderProps {
21
21
  };
22
22
  };
23
23
  }
24
+ export declare const getFilename: (path?: string) => string;
24
25
  export declare const FormHeader: ({ activeForm, repoProvider, branch, isLocalMode, }: FormHeaderProps) => React.JSX.Element;
25
26
  interface RepositoryProviderProps {
26
27
  contentRelativePath: string;
@@ -35,8 +36,12 @@ interface RepositoryProviderProps {
35
36
  };
36
37
  }
37
38
  export declare const FileHistoryProvider: ({ contentRelativePath, tinaBranch, defaultBranchName, historyUrl, isLocalMode, }: RepositoryProviderProps) => React.JSX.Element;
38
- export declare const FormBreadcrumbs: ({ rootBreadcrumbName, contentPath, ...props }: {
39
+ export declare const FormBreadcrumbs: ({ rootBreadcrumbName, contentPath, collectionCrumb, ...props }: {
39
40
  rootBreadcrumbName?: string;
40
41
  contentPath?: string;
42
+ collectionCrumb?: {
43
+ label: string;
44
+ onClick: () => void;
45
+ };
41
46
  } & React.HTMLAttributes<HTMLDivElement>) => React.JSX.Element;
42
47
  export {};
@@ -6,6 +6,8 @@ export interface DropdownButtonItem {
6
6
  variant?: 'default' | 'destructive';
7
7
  icon?: React.ReactNode;
8
8
  disabled?: boolean;
9
+ /** Optional hover tooltip. Shown even when the item is disabled. */
10
+ tooltip?: string;
9
11
  }
10
12
  export interface DropdownButtonProps extends Omit<ButtonProps, 'onClick'> {
11
13
  /**
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.9.3",
5
+ "version": "3.10.0",
6
6
  "main": "dist/index.js",
7
7
  "module": "./dist/index.js",
8
8
  "exports": {
@@ -45,15 +45,14 @@
45
45
  "@headlessui/react": "2.1.8",
46
46
  "@heroicons/react": "^1.0.6",
47
47
  "@monaco-editor/react": "4.7.0-rc.0",
48
- "@radix-ui/react-checkbox": "^1.1.4",
49
- "@radix-ui/react-dialog": "^1.1.6",
50
- "@radix-ui/react-dropdown-menu": "^2.1.6",
51
- "@radix-ui/react-popover": "^1.1.15",
52
- "@radix-ui/react-select": "^2.2.6",
53
- "@radix-ui/react-separator": "^1.1.2",
54
- "@radix-ui/react-slot": "^1.1.2",
55
- "@radix-ui/react-toolbar": "^1.1.2",
56
- "@radix-ui/react-tooltip": "^1.2.8",
48
+ "@radix-ui/react-dialog": "^1.1.18",
49
+ "@radix-ui/react-dropdown-menu": "^2.1.19",
50
+ "@radix-ui/react-popover": "^1.1.18",
51
+ "@radix-ui/react-select": "^2.3.2",
52
+ "@radix-ui/react-separator": "^1.1.11",
53
+ "@radix-ui/react-slot": "^1.3.0",
54
+ "@radix-ui/react-toolbar": "^1.1.14",
55
+ "@radix-ui/react-tooltip": "^1.2.11",
57
56
  "@react-hook/window-size": "^3.1.1",
58
57
  "@tanstack/react-table": "^8.21.3",
59
58
  "@udecode/cmdk": "^0.2.1",
@@ -80,7 +79,6 @@
80
79
  "@udecode/plate-slash-command": "^48.0.0",
81
80
  "@udecode/plate-table": "^48.0.0",
82
81
  "@udecode/plate-trailing-block": "^48.0.0",
83
- "add": "^2.0.6",
84
82
  "async-lock": "^1.4.1",
85
83
  "class-variance-authority": "^0.7.1",
86
84
  "clsx": "^2.1.1",
@@ -97,14 +95,11 @@
97
95
  "is-hotkey": "^0.2.0",
98
96
  "lucide-react": "^0.424.0",
99
97
  "mermaid": "^11.12.2",
100
- "moment": "2.29.4",
101
- "moment-timezone": "^0.6.0",
102
98
  "monaco-editor": "0.31.0",
103
99
  "posthog-js": "^1.347.1",
104
100
  "prism-react-renderer": "^2.4.1",
105
101
  "prop-types": "15.7.2",
106
102
  "react-colorful": "^5.6.1",
107
- "react-datetime": "^3.3.1",
108
103
  "react-day-picker": "^9.13.0",
109
104
  "react-dnd": "^16.0.1",
110
105
  "react-dnd-html5-backend": "^16.0.1",
@@ -118,9 +113,9 @@
118
113
  "yup": "^1.6.1",
119
114
  "zod": "^3.24.2",
120
115
  "@tinacms/bridge": "0.3.0",
121
- "@tinacms/mdx": "2.1.7",
122
- "@tinacms/schema-tools": "2.8.1",
123
- "@tinacms/search": "1.2.19"
116
+ "@tinacms/schema-tools": "2.8.3",
117
+ "@tinacms/search": "1.2.21",
118
+ "@tinacms/mdx": "2.1.9"
124
119
  },
125
120
  "devDependencies": {
126
121
  "@graphql-tools/utils": "^10.8.1",
@@ -148,7 +143,7 @@
148
143
  "typescript": "^5.7.3",
149
144
  "vite": "^5.4.14",
150
145
  "vitest": "^2.1.9",
151
- "@tinacms/scripts": "1.6.1"
146
+ "@tinacms/scripts": "1.6.2"
152
147
  },
153
148
  "peerDependencies": {
154
149
  "react": ">=16.14.0",
@@ -1,24 +0,0 @@
1
- import React from 'react';
2
- export declare const ToolbarIcon: ({ name }: {
3
- name: string;
4
- }) => any;
5
- export declare const EllipsisIcon: ({ title }: {
6
- title: any;
7
- }) => React.JSX.Element;
8
- export declare function UnorderedListIcon(props: any): React.JSX.Element;
9
- export declare function HeadingIcon(props: any): React.JSX.Element;
10
- export declare function OrderedListIcon(props: any): React.JSX.Element;
11
- export declare function QuoteIcon(props: any): React.JSX.Element;
12
- export declare function LinkIcon(props: any): React.JSX.Element;
13
- export declare function CodeIcon(props: any): React.JSX.Element;
14
- export declare function CodeBlockIcon(props: any): React.JSX.Element;
15
- export declare function ImageIcon(props: any): React.JSX.Element;
16
- export declare function BoldIcon(props: any): React.JSX.Element;
17
- export declare function ItalicIcon(props: any): React.JSX.Element;
18
- export declare function UnderlineIcon(props: any): React.JSX.Element;
19
- export declare function StrikethroughIcon(props: any): React.JSX.Element;
20
- export declare function LightningIcon(props: any): React.JSX.Element;
21
- export declare function ArrowDownIcon(props: any): React.JSX.Element;
22
- export declare function PlusIcon({ className }: {
23
- className?: string;
24
- }): React.JSX.Element;
@@ -1,9 +0,0 @@
1
- export default function ViewNavigation({ onClickPrev, onClickSwitch, onClickNext, switchContent, switchColSpan, switchProps, }: {
2
- onClickPrev: any;
3
- onClickSwitch: any;
4
- onClickNext: any;
5
- switchContent: any;
6
- switchColSpan: any;
7
- switchProps: any;
8
- }): React.JSX.Element;
9
- import React from 'react';
@@ -1,16 +0,0 @@
1
- export default class DaysView extends React.Component<any, any, any> {
2
- static defaultProps: {
3
- isValidDate: () => boolean;
4
- renderDay: (props: any, date: any) => React.JSX.Element;
5
- };
6
- constructor(props: any);
7
- constructor(props: any, context: any);
8
- render(): React.JSX.Element;
9
- renderNavigation(): React.JSX.Element;
10
- renderDayHeaders(): React.JSX.Element;
11
- renderDays(): React.JSX.Element[];
12
- renderDay(date: any, startOfMonth: any, endOfMonth: any): any;
13
- renderFooter(): React.JSX.Element;
14
- _setDate: (e: any) => void;
15
- }
16
- import React from 'react';
@@ -1,12 +0,0 @@
1
- export default class MonthsView extends React.Component<any, any, any> {
2
- constructor(props: any);
3
- constructor(props: any, context: any);
4
- render(): React.JSX.Element;
5
- renderNavigation(): React.JSX.Element;
6
- renderMonths(): React.JSX.Element[];
7
- renderMonth(month: any): any;
8
- isDisabledMonth(month: any): boolean;
9
- getMonthText(month: any): any;
10
- _updateSelectedMonth: (event: any) => void;
11
- }
12
- import React from 'react';
@@ -1,32 +0,0 @@
1
- export default class TimeView extends React.Component<any, any, any> {
2
- constructor(props: any);
3
- constraints: {};
4
- state: {
5
- hours: string;
6
- minutes: string;
7
- seconds: string;
8
- milliseconds: string;
9
- ampm: string;
10
- };
11
- render(): React.JSX.Element;
12
- renderCounter(type: any, value: any): React.JSX.Element;
13
- renderHeader(): React.JSX.Element;
14
- onStartClicking(e: any, action: any, type: any): void;
15
- timer: NodeJS.Timeout;
16
- increaseTimer: NodeJS.Timeout;
17
- mouseUpListener: any;
18
- toggleDayPart(): void;
19
- increase(type: any): string;
20
- decrease(type: any): string;
21
- getCounters(): string[];
22
- isAMPM(): boolean;
23
- getTimeParts(date: any): {
24
- hours: string;
25
- minutes: string;
26
- seconds: string;
27
- milliseconds: string;
28
- ampm: string;
29
- };
30
- componentDidUpdate(prevProps: any): void;
31
- }
32
- import React from 'react';
@@ -1,17 +0,0 @@
1
- export default class YearsView extends React.Component<any, any, any> {
2
- static defaultProps: {
3
- renderYear: (props: any, year: any) => React.JSX.Element;
4
- };
5
- constructor(props: any);
6
- constructor(props: any, context: any);
7
- render(): React.JSX.Element;
8
- renderNavigation(): React.JSX.Element;
9
- renderYears(): React.JSX.Element[];
10
- renderYear(year: any): any;
11
- getViewYear(): number;
12
- getSelectedYear(): any;
13
- disabledYearsCache: {};
14
- isDisabledYear(year: any): any;
15
- _updateSelectedYear: (event: any) => void;
16
- }
17
- import React from 'react';