tinacms 0.0.0-c1132cd-20241024060747 → 0.0.0-c19d29e-20251224001156

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 (200) hide show
  1. package/README.md +1 -1
  2. package/dist/admin/api.d.ts +5 -1
  3. package/dist/admin/components/{Sidebar.d.ts → AdminNav.d.ts} +0 -3
  4. package/dist/admin/components/GetCollection.d.ts +2 -2
  5. package/dist/admin/components/Page.d.ts +3 -9
  6. package/dist/admin/components/ui/tooltip.d.ts +7 -0
  7. package/dist/admin/pages/CollectionCreatePage.d.ts +1 -1
  8. package/dist/admin/pages/CollectionListPage.d.ts +2 -2
  9. package/dist/admin/pages/DashboardPage.d.ts +0 -3
  10. package/dist/admin/pages/ScreenPage.d.ts +0 -3
  11. package/dist/admin/types.d.ts +3 -0
  12. package/dist/auth/AuthModal.d.ts +1 -4
  13. package/dist/auth/TinaCloudProvider.d.ts +1 -2
  14. package/dist/cache/node-cache.d.ts +6 -2
  15. package/dist/client.js +243 -148
  16. package/dist/hooks/create-page-plugin.d.ts +1 -1
  17. package/dist/index.d.ts +1 -1
  18. package/dist/index.js +122381 -32381
  19. package/dist/internalClient/index.d.ts +50 -32
  20. package/dist/react.d.ts +14 -6
  21. package/dist/react.js +295 -184
  22. package/dist/rich-text/index.d.ts +6 -0
  23. package/dist/rich-text/index.js +234 -224
  24. package/dist/rich-text/prism.js +16 -18
  25. package/dist/rich-text/static.d.ts +154 -0
  26. package/dist/rich-text/{index.mjs → static.js} +99 -99
  27. package/dist/tina-cms.d.ts +1 -1
  28. package/dist/toolkit/components/ProgressBar.d.ts +11 -0
  29. package/dist/toolkit/components/active-field-indicator.d.ts +1 -0
  30. package/dist/toolkit/components/media/media-item.d.ts +11 -1
  31. package/dist/toolkit/components/media/media-manager.d.ts +1 -1
  32. package/dist/toolkit/components/ui/breadcrumb.d.ts +11 -0
  33. package/dist/toolkit/components/ui/button.d.ts +11 -0
  34. package/dist/toolkit/components/ui/calendar.d.ts +8 -0
  35. package/dist/toolkit/components/ui/date-time-picker.d.ts +111 -0
  36. package/dist/toolkit/components/ui/dropdown-menu.d.ts +25 -0
  37. package/dist/toolkit/components/ui/input.d.ts +3 -0
  38. package/dist/toolkit/components/ui/popover.d.ts +7 -0
  39. package/dist/toolkit/components/ui/select.d.ts +13 -0
  40. package/dist/toolkit/fields/components/color-picker/block-widget.d.ts +3 -0
  41. package/dist/toolkit/fields/components/color-picker/color-input.d.ts +35 -0
  42. package/dist/toolkit/fields/components/color-picker/color-picker.d.ts +6 -2
  43. package/dist/toolkit/fields/components/color-picker/color-utils.d.ts +37 -0
  44. package/dist/toolkit/fields/components/color-picker/sketch-widget.d.ts +3 -0
  45. package/dist/toolkit/fields/components/password-field.d.ts +1 -1
  46. package/dist/toolkit/fields/components/reference/components/button.d.ts +2 -2
  47. package/dist/toolkit/fields/components/reference/components/command.d.ts +21 -33
  48. package/dist/toolkit/fields/components/reference/components/popover.d.ts +1 -1
  49. package/dist/toolkit/fields/components/reference/model/reference-link-props.d.ts +2 -0
  50. package/dist/toolkit/fields/components/reference/reference-select.d.ts +2 -2
  51. package/dist/toolkit/fields/components/select.d.ts +2 -2
  52. package/dist/toolkit/fields/components/text-field.d.ts +1 -1
  53. package/dist/toolkit/fields/plugins/button-toggle-field-plugin.d.ts +2 -2
  54. package/dist/toolkit/fields/plugins/checkbox-group-field-plugin.d.ts +2 -2
  55. package/dist/toolkit/fields/plugins/color-field-plugin.d.ts +1 -0
  56. package/dist/toolkit/fields/plugins/date-field-plugin.d.ts +0 -2
  57. package/dist/toolkit/fields/plugins/dnd-kit-wrapper.d.ts +49 -0
  58. package/dist/toolkit/fields/plugins/group-field-plugin.d.ts +1 -1
  59. package/dist/toolkit/fields/plugins/group-list-field-plugin.d.ts +3 -1
  60. package/dist/toolkit/fields/plugins/list-field-meta.d.ts +1 -1
  61. package/dist/toolkit/fields/plugins/list-field-plugin.d.ts +3 -0
  62. package/dist/toolkit/fields/plugins/mdx-field-plugin/index.d.ts +5 -2
  63. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/components/editor.d.ts +20 -18
  64. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/components/plate-ui/blockquote-element.d.ts +14 -10
  65. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/components/plate-ui/button.d.ts +5 -5
  66. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/components/plate-ui/code-block/code-block-element.d.ts +17 -0
  67. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/components/plate-ui/code-block/error-message.d.ts +6 -0
  68. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/components/plate-ui/code-block-combobox.d.ts +6 -0
  69. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/components/plate-ui/code-block-toolbar-button.d.ts +6 -6
  70. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/components/plate-ui/code-leaf.d.ts +2 -11
  71. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/components/plate-ui/code-line-element.d.ts +14 -10
  72. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/components/plate-ui/code-syntax-leaf.d.ts +2 -11
  73. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/components/plate-ui/command.d.ts +112 -0
  74. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/components/plate-ui/dialog.d.ts +12 -0
  75. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/components/plate-ui/dropdown-menu.d.ts +10 -10
  76. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/components/plate-ui/floating-toolbar.d.ts +2 -2
  77. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/components/plate-ui/hr-element.d.ts +3 -0
  78. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/components/plate-ui/hr-toolbar-button.d.ts +18 -0
  79. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/components/plate-ui/icons.d.ts +2 -1
  80. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/components/plate-ui/image-toolbar-button.d.ts +6 -6
  81. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/components/plate-ui/indent-list-toolbar-button.d.ts +6 -7
  82. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/components/plate-ui/inline-combobox.d.ts +1 -1
  83. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/components/plate-ui/input.d.ts +3 -3
  84. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/components/plate-ui/link-element.d.ts +4 -11
  85. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/components/plate-ui/link-floating-toolbar.d.ts +4 -5
  86. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/components/plate-ui/link-toolbar-button.d.ts +4 -4
  87. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/components/plate-ui/list-element.d.ts +28 -11
  88. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/components/plate-ui/mark-toolbar-button.d.ts +4 -18
  89. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/components/plate-ui/mermaid-element.d.ts +3 -10
  90. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/components/plate-ui/mermaid-toolbar-button.d.ts +6 -8
  91. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/components/plate-ui/paragraph-element.d.ts +15 -0
  92. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/components/plate-ui/popover.d.ts +7 -2
  93. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/components/plate-ui/quote-toolbar-button.d.ts +6 -6
  94. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/components/plate-ui/raw-markdown-toolbar-button.d.ts +6 -6
  95. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/components/plate-ui/resizable.d.ts +24 -21
  96. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/components/plate-ui/separator.d.ts +2 -2
  97. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/components/plate-ui/slash-input-element.d.ts +15 -11
  98. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/components/plate-ui/table/block-selection.d.ts +6 -0
  99. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/components/plate-ui/table/table-cell-element.d.ts +33 -0
  100. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/components/plate-ui/{table-dropdown-menu.d.ts → table/table-dropdown-menu.d.ts} +1 -0
  101. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/components/plate-ui/table/table-element.d.ts +20 -0
  102. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/components/plate-ui/table/table-row-element.d.ts +15 -0
  103. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/components/plate-ui/toolbar.d.ts +7 -7
  104. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/components/plate-ui/use-floating-toolbar-hook.d.ts +10 -0
  105. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/components/plate-ui/use-floating-toolbar-state.d.ts +22 -0
  106. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/hooks/use-create-editor.d.ts +6 -0
  107. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/index.d.ts +1 -1
  108. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/plugins/core/autoformat/autoformat-block.d.ts +1 -1
  109. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/plugins/core/autoformat/autoformat-lists.d.ts +1 -1
  110. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/plugins/core/autoformat/autoformat-marks.d.ts +1 -1
  111. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/plugins/core/autoformat/autoformat-utils.d.ts +3 -5
  112. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/plugins/core/common.d.ts +11 -6
  113. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/plugins/core/formatting.d.ts +18 -2
  114. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/plugins/core/index.d.ts +0 -1
  115. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/plugins/create-html-block/index.d.ts +6 -0
  116. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/plugins/create-img-plugin/index.d.ts +2 -2
  117. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/plugins/create-invalid-markdown-plugin/index.d.ts +5 -5
  118. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/plugins/create-mdx-plugins/component.d.ts +7 -4
  119. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/plugins/create-mdx-plugins/index.d.ts +3 -5
  120. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/plugins/editor-plugins.d.ts +520 -0
  121. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/plugins/ui/components.d.ts +263 -212
  122. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/plugins/ui/floating-toolbar-plugin.d.ts +1 -0
  123. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/toolbar/toolbar-overrides.d.ts +5 -1
  124. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/toolbar/toolbar-provider.d.ts +2 -2
  125. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/transforms/is-url.d.ts +1 -2
  126. package/dist/toolkit/fields/plugins/radio-group-field-plugin.d.ts +2 -2
  127. package/dist/toolkit/fields/plugins/select-field-plugin.d.ts +2 -2
  128. package/dist/toolkit/fields/plugins/toggle-field-plugin.d.ts +2 -2
  129. package/dist/toolkit/fields/plugins/wrap-field-with-meta.d.ts +14 -2
  130. package/dist/toolkit/form-builder/create-branch-modal.d.ts +13 -0
  131. package/dist/toolkit/form-builder/editorial-workflow-constants.d.ts +17 -0
  132. package/dist/toolkit/form-builder/fields-builder.d.ts +3 -2
  133. package/dist/toolkit/form-builder/form-builder.d.ts +9 -9
  134. package/dist/toolkit/form-builder/index.d.ts +1 -0
  135. package/dist/toolkit/forms/field.d.ts +6 -2
  136. package/dist/toolkit/forms/form.d.ts +22 -3
  137. package/dist/toolkit/git-client/git-client.d.ts +25 -2
  138. package/dist/toolkit/git-client/git-file.d.ts +18 -0
  139. package/dist/toolkit/git-client/git-media-store.d.ts +13 -0
  140. package/dist/toolkit/git-client/use-git-file.d.ts +4 -0
  141. package/dist/toolkit/icons/Tina.d.ts +0 -5
  142. package/dist/toolkit/icons/TinaExtended.d.ts +4 -0
  143. package/dist/toolkit/icons/index.d.ts +1 -0
  144. package/dist/toolkit/index.d.ts +1 -1
  145. package/dist/toolkit/plugin-branch-switcher/branch-button.d.ts +4 -1
  146. package/dist/toolkit/plugin-branch-switcher/branch-switcher-legacy.d.ts +1 -1
  147. package/dist/toolkit/plugin-branch-switcher/branch-switcher.d.ts +1 -1
  148. package/dist/toolkit/plugin-branch-switcher/index.d.ts +0 -1
  149. package/dist/toolkit/react-cloud-config/cloud-config-plugin.d.ts +3 -3
  150. package/dist/toolkit/react-modals/modal/modal-actions.d.ts +2 -1
  151. package/dist/toolkit/react-modals/modal/modal-header.d.ts +1 -1
  152. package/dist/toolkit/react-sidebar/components/NavMenuTrigger.d.ts +11 -0
  153. package/dist/toolkit/react-sidebar/components/VersionInfo.d.ts +2 -0
  154. package/dist/toolkit/react-sidebar/components/badge.d.ts +6 -0
  155. package/dist/toolkit/react-sidebar/components/callout.d.ts +5 -0
  156. package/dist/toolkit/react-sidebar/components/form-list.d.ts +1 -1
  157. package/dist/toolkit/react-sidebar/components/local-warning.d.ts +3 -1
  158. package/dist/toolkit/react-sidebar/components/nav-components.d.ts +11 -0
  159. package/dist/toolkit/react-sidebar/components/nav-context.d.ts +15 -0
  160. package/dist/toolkit/react-sidebar/components/nav.d.ts +6 -3
  161. package/dist/toolkit/react-sidebar/components/resize-handle.d.ts +0 -5
  162. package/dist/toolkit/react-sidebar/components/sidebar-body.d.ts +33 -11
  163. package/dist/toolkit/react-sidebar/components/sidebar-loading-placeholder.d.ts +2 -0
  164. package/dist/toolkit/react-sidebar/components/sidebar-no-forms-placeholder.d.ts +2 -0
  165. package/dist/toolkit/react-sidebar/components/sidebar.d.ts +0 -7
  166. package/dist/toolkit/react-sidebar/components/sync-status.d.ts +5 -8
  167. package/dist/toolkit/react-sidebar/index.d.ts +4 -1
  168. package/dist/toolkit/react-sidebar/sidebar.d.ts +2 -2
  169. package/dist/toolkit/styles/button.d.ts +2 -2
  170. package/dist/toolkit/styles/dropdown-button.d.ts +75 -0
  171. package/dist/toolkit/styles/index.d.ts +1 -0
  172. package/dist/toolkit/tina-cms.d.ts +3 -3
  173. package/dist/toolkit/tina-state.d.ts +56 -15
  174. package/dist/unifiedClient/index.d.ts +9 -2
  175. package/dist/utils/cn.d.ts +2 -0
  176. package/dist/utils/index.d.ts +1 -0
  177. package/package.json +90 -114
  178. package/dist/admin/pages/IndexingPage.d.ts +0 -2
  179. package/dist/client.mjs +0 -109
  180. package/dist/index.mjs +0 -33820
  181. package/dist/node-cache-4c336858.mjs +0 -50
  182. package/dist/react.mjs +0 -234
  183. package/dist/rich-text/prism.mjs +0 -16
  184. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/components/plate-ui/code-block-element.d.ts +0 -11
  185. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/components/plate-ui/table-cell-element.d.ts +0 -27
  186. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/components/plate-ui/table-element.d.ts +0 -14
  187. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/components/plate-ui/table-row-element.d.ts +0 -13
  188. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/plugins/core/with-correct-void-behavior.d.ts +0 -8
  189. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/plugins/create-code-block/index.d.ts +0 -3
  190. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/plugins/create-link-plugin/index.d.ts +0 -15
  191. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/plugins/custom/mermaid-plugin.d.ts +0 -2
  192. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/plugins/soft-break/create-soft-break-plugin.d.ts +0 -7
  193. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/plugins/soft-break/index.d.ts +0 -6
  194. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/plugins/soft-break/on-key-down-soft-break.d.ts +0 -5
  195. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/plugins/soft-break/types.d.ts +0 -11
  196. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/plugins/ui/code-block/index.d.ts +0 -11
  197. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/transforms/insert-empty-block.d.ts +0 -2
  198. package/dist/toolkit/plugin-branch-switcher/branch-banner.d.ts +0 -2
  199. package/dist/toolkit/react-datetime/DateTime.d.ts +0 -135
  200. package/dist/toolkit/react-sidebar/components/no-forms-placeholder.d.ts +0 -8
package/README.md CHANGED
@@ -24,7 +24,7 @@ Test a TinaCMS starter site locally
24
24
  npx create-tina-app@latest
25
25
  ```
26
26
 
27
- Or try a [demo site](https://app.tina.io/quickstart) on Tina Cloud.
27
+ Or try a [demo site](https://app.tina.io/quickstart) on TinaCloud.
28
28
 
29
29
  ## Documentation
30
30
 
@@ -2,11 +2,15 @@ import type { TinaCMS } from '@tinacms/toolkit';
2
2
  import type { Collection, TinaSchema } from '@tinacms/schema-tools';
3
3
  import type { Client } from '../internalClient';
4
4
  import type { CollectionResponse, DocumentForm } from './types';
5
- import { SearchClient } from '@tinacms/search/dist/index-client';
5
+ import { SearchClient } from '@tinacms/search/index-client';
6
+ export declare const CREATE_DOCUMENT_GQL = "#graphql\nmutation($collection: String!, $relativePath: String!, $params: DocumentMutation!) {\n createDocument(\n collection: $collection,\n relativePath: $relativePath,\n params: $params\n ){__typename}\n}";
7
+ export declare const UPDATE_DOCUMENT_GQL = "#graphql\nmutation($collection: String!, $relativePath: String!, $params: DocumentUpdateMutation!) {\n updateDocument(\n collection: $collection,\n relativePath: $relativePath,\n params: $params\n ){__typename}\n}";
8
+ export declare const DELETE_DOCUMENT_GQL = "#graphql\nmutation DeleteDocument($collection: String!, $relativePath: String!){\n deleteDocument(collection: $collection, relativePath: $relativePath){\n __typename\n }\n}";
6
9
  export interface FilterArgs {
7
10
  filterField: string;
8
11
  collection?: string;
9
12
  relativePath?: string;
13
+ relativePathWithoutExtension?: string;
10
14
  newRelativePath?: string;
11
15
  startsWith?: string;
12
16
  endsWith?: string;
@@ -1,6 +1,3 @@
1
- /**
2
-
3
- */
4
1
  import React from 'react';
5
2
  import type { TinaCMS } from '@tinacms/toolkit';
6
3
  export declare const slugify: (text: any) => any;
@@ -1,9 +1,9 @@
1
1
  /**
2
2
 
3
3
  */
4
- import React from 'react';
5
- import type { TinaCMS } from '@tinacms/toolkit';
6
4
  import type { Collection } from '@tinacms/schema-tools';
5
+ import type { TinaCMS } from '@tinacms/toolkit';
6
+ import React from 'react';
7
7
  import { FilterArgs } from '../api';
8
8
  import type { CollectionResponse } from '../types';
9
9
  export declare const useGetCollection: (cms: TinaCMS, collectionName: string, includeDocuments: boolean, folder: {
@@ -1,17 +1,11 @@
1
- /**
2
-
3
- */
4
1
  import React from 'react';
5
- export declare const PageWrapper: ({ children }: {
2
+ export declare const PageWrapper: ({ headerClassName, children, }: {
3
+ headerClassName?: string;
6
4
  children: React.ReactNode;
7
5
  }) => React.JSX.Element;
8
- export declare const PageHeader: ({ isLocalMode, children, }: {
9
- isLocalMode?: boolean;
6
+ export declare const PageHeader: ({ children, }: {
10
7
  children: React.ReactNode;
11
8
  }) => React.JSX.Element;
12
9
  export declare const PageBody: ({ children }: {
13
10
  children: React.ReactNode;
14
11
  }) => React.JSX.Element;
15
- export declare const PageBodyNarrow: ({ children }: {
16
- children: React.ReactNode;
17
- }) => React.JSX.Element;
@@ -0,0 +1,7 @@
1
+ import * as TooltipPrimitive from '@radix-ui/react-tooltip';
2
+ import * as React from 'react';
3
+ declare const TooltipProvider: React.FC<TooltipPrimitive.TooltipProviderProps>;
4
+ declare const Tooltip: React.FC<TooltipPrimitive.TooltipProps>;
5
+ declare const TooltipTrigger: React.ForwardRefExoticComponent<TooltipPrimitive.TooltipTriggerProps & React.RefAttributes<HTMLButtonElement>>;
6
+ declare const TooltipContent: React.ForwardRefExoticComponent<Omit<TooltipPrimitive.TooltipContentProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
7
+ export { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider };
@@ -1,5 +1,5 @@
1
- import React from 'react';
2
1
  import { Collection } from '@tinacms/schema-tools';
2
+ import React from 'react';
3
3
  import type { TinaCMS } from '@tinacms/toolkit';
4
4
  declare const CollectionCreatePage: () => React.JSX.Element;
5
5
  export declare const RenderForm: ({ cms, collection, folder, templateName, mutationInfo, customDefaults, }: {
@@ -1,8 +1,8 @@
1
+ import type { Collection } from '@tinacms/schema-tools';
2
+ import { type TinaCMS } from '@tinacms/toolkit';
1
3
  import React from 'react';
2
4
  import { type NavigateFunction } from 'react-router-dom';
3
- import { type TinaCMS } from '@tinacms/toolkit';
4
5
  import type { CollectionResponse, DocumentSys } from '../types';
5
- import type { Collection } from '@tinacms/schema-tools';
6
6
  export declare const handleNavigate: (navigate: NavigateFunction, cms: TinaCMS, collection: CollectionResponse, collectionDefinition: Collection<true>, document: DocumentSys) => Promise<any>;
7
7
  declare const CollectionListPage: () => React.JSX.Element;
8
8
  export default CollectionListPage;
@@ -1,6 +1,3 @@
1
- /**
2
-
3
- */
4
1
  import React from 'react';
5
2
  declare const DashboardPage: () => React.JSX.Element;
6
3
  export default DashboardPage;
@@ -1,6 +1,3 @@
1
- /**
2
-
3
- */
4
1
  import React from 'react';
5
2
  declare const ScreenPage: () => React.JSX.Element;
6
3
  export default ScreenPage;
@@ -25,6 +25,9 @@ export interface DocumentNode {
25
25
  }
26
26
  export interface DocumentForm {
27
27
  _values: Object;
28
+ _sys?: {
29
+ hasReferences?: boolean;
30
+ };
28
31
  }
29
32
  export interface DocumentSys {
30
33
  _sys: {
@@ -1,10 +1,7 @@
1
- /**
2
-
3
- */
4
1
  import React from 'react';
5
2
  interface ModalBuilderProps {
6
3
  title: string;
7
- message?: string;
4
+ message?: React.ReactNode;
8
5
  error?: string;
9
6
  actions: ButtonProps[];
10
7
  close(): void;
@@ -1,5 +1,5 @@
1
+ import { MediaStore, StaticMedia, TinaCMS } from '@tinacms/toolkit';
1
2
  import React from 'react';
2
- import { TinaCMS, MediaStore, StaticMedia } from '@tinacms/toolkit';
3
3
  import { Client, TinaIOConfig } from '../internalClient';
4
4
  import { CreateClientProps } from '../utils';
5
5
  export interface TinaCloudMediaStoreClass {
@@ -18,7 +18,6 @@ export interface TinaCloudAuthWallProps {
18
18
  }[];
19
19
  mediaStore?: TinaCloudMediaStoreClass | (() => Promise<TinaCloudMediaStoreClass>);
20
20
  }
21
- export declare const AuthWallInner: ({ children, cms, getModalActions, }: TinaCloudAuthWallProps) => React.JSX.Element;
22
21
  /**
23
22
  * Provides the ability to setup your CMS and media while also providing an authentication wall so Tina is not enabled without a valid user session.
24
23
  *
@@ -1,3 +1,7 @@
1
1
  import type { Cache } from './index';
2
- export declare const makeCacheDir: (dir: string, fs: any, path: any, os: any) => Promise<string>;
3
- export declare const NodeCache: (dir: string) => Promise<Cache>;
2
+ type FsModule = typeof import('node:fs');
3
+ type PathModule = typeof import('node:path');
4
+ type OsModule = typeof import('node:os');
5
+ export declare const makeCacheDir: (dir: string, fsArg: FsModule, pathArg: PathModule, osArg: OsModule) => string | null;
6
+ export declare const NodeCache: (dir: string) => Promise<Cache | null>;
7
+ export {};
package/dist/client.js CHANGED
@@ -1,163 +1,258 @@
1
- (function(global, factory) {
2
- typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("fetch-ponyfill")) : typeof define === "function" && define.amd ? define(["exports", "fetch-ponyfill"], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, factory(global.tinacms = {}, global.NOOP));
3
- })(this, function(exports2, fetchPonyfill) {
4
- "use strict";
5
- const { fetch: fetchPonyfillFN, Headers: HeadersPonyfill } = fetchPonyfill();
6
- const fetchDefined = typeof fetch === "undefined" ? fetchPonyfillFN : fetch;
7
- const HeadersDefined = typeof Headers === "undefined" ? HeadersPonyfill : Headers;
8
- const TINA_HOST = "content.tinajs.io";
9
- class TinaClient {
10
- constructor({
11
- token,
12
- url,
13
- queries,
14
- errorPolicy,
15
- cacheDir
16
- }) {
17
- this.initialized = false;
18
- this.apiUrl = url;
19
- this.readonlyToken = token == null ? void 0 : token.trim();
20
- this.queries = queries(this);
21
- this.errorPolicy = errorPolicy || "throw";
22
- this.cacheDir = cacheDir || "";
23
- }
24
- async init() {
25
- if (this.initialized) {
26
- return;
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropNames = Object.getOwnPropertyNames;
3
+ var __esm = (fn, res) => function __init() {
4
+ return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
5
+ };
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+
11
+ // src/cache/node-cache.ts
12
+ var node_cache_exports = {};
13
+ __export(node_cache_exports, {
14
+ NodeCache: () => NodeCache,
15
+ makeCacheDir: () => makeCacheDir
16
+ });
17
+ var resolveModule, getRootPath, makeCacheDir, NodeCache;
18
+ var init_node_cache = __esm({
19
+ "src/cache/node-cache.ts"() {
20
+ resolveModule = (mod) => {
21
+ if (mod && typeof mod === "object" && "default" in mod && mod.default) {
22
+ return mod.default;
27
23
  }
24
+ return mod;
25
+ };
26
+ getRootPath = (pathParts, pathArg) => {
27
+ if (pathParts.length === 0) return null;
28
+ const isWindows = pathArg.sep === "\\";
29
+ const root = pathParts[0];
30
+ return isWindows ? `${root}${pathArg.sep}` : `${pathArg.sep}${root}`;
31
+ };
32
+ makeCacheDir = (dir, fsArg, pathArg, osArg) => {
33
+ const normalizedDir = pathArg.normalize(dir);
34
+ const pathParts = normalizedDir.split(pathArg.sep).filter(Boolean);
35
+ const cacheHash = pathParts[pathParts.length - 1];
36
+ const rootPath = getRootPath(pathParts, pathArg);
37
+ const rootExists = rootPath && fsArg.existsSync(rootPath);
38
+ const cacheDir = rootExists ? normalizedDir : pathArg.join(osArg.tmpdir(), cacheHash);
28
39
  try {
29
- if (this.cacheDir && typeof window === "undefined" && typeof require !== "undefined") {
30
- const { NodeCache: NodeCache2 } = await Promise.resolve().then(() => nodeCache);
31
- this.cache = await NodeCache2(this.cacheDir);
32
- }
33
- } catch (e) {
34
- console.error(e);
35
- }
36
- this.initialized = true;
37
- }
38
- async request({ errorPolicy, ...args }, options) {
39
- var _a;
40
- await this.init();
41
- const errorPolicyDefined = errorPolicy || this.errorPolicy;
42
- const headers = new HeadersDefined();
43
- if (this.readonlyToken) {
44
- headers.append("X-API-KEY", this.readonlyToken);
45
- }
46
- headers.append("Content-Type", "application/json");
47
- if (options == null ? void 0 : options.fetchOptions) {
48
- if ((_a = options == null ? void 0 : options.fetchOptions) == null ? void 0 : _a.headers) {
49
- Object.entries(options.fetchOptions.headers).forEach(([key2, value]) => {
50
- headers.append(key2, value);
51
- });
52
- }
40
+ fsArg.mkdirSync(cacheDir, { recursive: true });
41
+ } catch (error) {
42
+ console.warn(
43
+ `Warning: Failed to create cache directory: ${error.message}. Caching will be disabled.`
44
+ );
45
+ return null;
53
46
  }
54
- const { headers: _, ...providedFetchOptions } = (options == null ? void 0 : options.fetchOptions) || {};
55
- const bodyString = JSON.stringify({
56
- query: args.query,
57
- variables: (args == null ? void 0 : args.variables) || {}
58
- });
59
- const url = (args == null ? void 0 : args.url) || this.apiUrl;
60
- const optionsObject = {
61
- method: "POST",
62
- headers,
63
- body: bodyString,
64
- redirect: "follow",
65
- ...providedFetchOptions
66
- };
67
- let key = "";
68
- if (this.cache) {
69
- key = this.cache.makeKey(bodyString);
70
- const value = await this.cache.get(key);
71
- if (value) {
72
- return value;
47
+ return cacheDir;
48
+ };
49
+ NodeCache = async (dir) => {
50
+ try {
51
+ const [fsModule, pathModule, osModule, cryptoModule] = await Promise.all([
52
+ import("node:fs"),
53
+ import("node:path"),
54
+ import("node:os"),
55
+ import("node:crypto")
56
+ ]);
57
+ const fs = resolveModule(fsModule);
58
+ const path = resolveModule(pathModule);
59
+ const os = resolveModule(osModule);
60
+ const crypto = resolveModule(cryptoModule);
61
+ if (typeof path?.join !== "function") {
62
+ console.warn(
63
+ "Warning: Node.js path module not available. Caching will be disabled."
64
+ );
65
+ return null;
73
66
  }
74
- }
75
- const res = await fetchDefined(url, optionsObject);
76
- if (!res.ok) {
77
- let additionalInfo = "";
78
- if (res.status === 401) {
79
- additionalInfo = "Please check that your client ID, URL and read only token are configured properly.";
67
+ const cacheDir = makeCacheDir(dir, fs, path, os);
68
+ if (cacheDir === null) {
69
+ return null;
80
70
  }
81
- throw new Error(
82
- `Server responded with status code ${res.status}, ${res.statusText}. ${additionalInfo ? additionalInfo : ""} Please see our FAQ for more information: https://tina.io/docs/errors/faq/`
83
- );
84
- }
85
- const json = await res.json();
86
- if (json.errors && errorPolicyDefined === "throw") {
87
- throw new Error(
88
- `Unable to fetch, please see our FAQ for more information: https://tina.io/docs/errors/faq/
89
- Errors:
90
- ${json.errors.map((error) => error.message).join("\n")}`
71
+ return {
72
+ makeKey: (key) => {
73
+ const input = key && key instanceof Object ? JSON.stringify(key) : key || "";
74
+ return crypto.createHash("sha256").update(input).digest("hex");
75
+ },
76
+ get: async (key) => {
77
+ let readValue;
78
+ const cacheFilename = path.join(cacheDir, key);
79
+ try {
80
+ const data = await fs.promises.readFile(cacheFilename, "utf-8");
81
+ readValue = JSON.parse(data);
82
+ } catch (e) {
83
+ if (e.code !== "ENOENT") {
84
+ console.warn(
85
+ `Warning: Failed to read cache file ${cacheFilename}: ${e.message}`
86
+ );
87
+ }
88
+ }
89
+ return readValue;
90
+ },
91
+ set: async (key, value) => {
92
+ const cacheFilename = path.join(cacheDir, key);
93
+ try {
94
+ await fs.promises.writeFile(cacheFilename, JSON.stringify(value), {
95
+ encoding: "utf-8",
96
+ flag: "wx"
97
+ });
98
+ } catch (e) {
99
+ if (e.code !== "EEXIST") {
100
+ console.warn(
101
+ `Warning: Failed to write cache file ${cacheFilename}: ${e.message}`
102
+ );
103
+ }
104
+ }
105
+ }
106
+ };
107
+ } catch (e) {
108
+ console.warn(
109
+ "Warning: Failed to initialize cache. Caching will be disabled.",
110
+ e.message
91
111
  );
112
+ return null;
92
113
  }
93
- const result = {
94
- data: json == null ? void 0 : json.data,
95
- errors: (json == null ? void 0 : json.errors) || null,
96
- query: args.query
97
- };
98
- if (this.cache) {
99
- await this.cache.set(key, result);
100
- }
101
- return result;
102
- }
114
+ };
115
+ }
116
+ });
117
+
118
+ // src/unifiedClient/index.ts
119
+ import AsyncLock from "async-lock";
120
+ var TINA_HOST = "content.tinajs.io";
121
+ function replaceGithubPathSplit(url, replacement) {
122
+ const parts = url.split("github/");
123
+ if (parts.length > 1 && replacement) {
124
+ return parts[0] + "github/" + replacement;
125
+ } else {
126
+ return url;
103
127
  }
104
- function createClient(args) {
105
- const client = new TinaClient(args);
106
- return client;
128
+ }
129
+ var TinaClient = class {
130
+ apiUrl;
131
+ readonlyToken;
132
+ queries;
133
+ errorPolicy;
134
+ initialized = false;
135
+ cacheLock;
136
+ cacheDir;
137
+ cache;
138
+ constructor({
139
+ token,
140
+ url,
141
+ queries,
142
+ errorPolicy,
143
+ cacheDir
144
+ }) {
145
+ this.apiUrl = url;
146
+ this.readonlyToken = token?.trim();
147
+ this.queries = queries(this);
148
+ this.errorPolicy = errorPolicy || "throw";
149
+ this.cacheDir = cacheDir || "";
107
150
  }
108
- const makeCacheDir = async (dir, fs, path, os) => {
109
- const pathParts = dir.split(path.sep).filter(Boolean);
110
- const cacheHash = pathParts[pathParts.length - 1];
111
- const rootUser = pathParts[0];
112
- let cacheDir = dir;
113
- if (!fs.existsSync(path.join(path.sep, rootUser))) {
114
- cacheDir = path.join(os.tmpdir(), cacheHash);
151
+ async init() {
152
+ if (this.initialized) {
153
+ return;
115
154
  }
116
155
  try {
117
- fs.mkdirSync(cacheDir, { recursive: true });
118
- } catch (error) {
119
- throw new Error(`Failed to create cache directory: ${error.message}`);
120
- }
121
- return cacheDir;
122
- };
123
- const NodeCache = async (dir) => {
124
- const fs = require("node:fs");
125
- const path = require("node:path");
126
- const os = require("node:os");
127
- const { createHash } = require("node:crypto");
128
- const cacheDir = await makeCacheDir(dir, fs, path, os);
129
- return {
130
- makeKey: (key) => {
131
- const input = key && key instanceof Object ? JSON.stringify(key) : key || "";
132
- return createHash("sha256").update(input).digest("hex");
133
- },
134
- get: async (key) => {
135
- try {
136
- const data = await fs.promises.readFile(`${cacheDir}/${key}`, "utf-8");
137
- return JSON.parse(data);
138
- } catch (e) {
139
- if (e.code === "ENOENT") {
140
- return void 0;
141
- }
142
- throw e;
156
+ if (this.cacheDir && typeof window === "undefined") {
157
+ const { NodeCache: NodeCache2 } = await Promise.resolve().then(() => (init_node_cache(), node_cache_exports));
158
+ this.cache = await NodeCache2(this.cacheDir);
159
+ if (this.cache) {
160
+ this.cacheLock = new AsyncLock();
143
161
  }
144
- },
145
- set: async (key, value) => {
146
- await fs.promises.writeFile(
147
- `${cacheDir}/${key}`,
148
- JSON.stringify(value),
149
- "utf-8"
150
- );
151
162
  }
163
+ } catch (e) {
164
+ console.error(e);
165
+ }
166
+ this.initialized = true;
167
+ }
168
+ async request({ errorPolicy, ...args }, options) {
169
+ await this.init();
170
+ const errorPolicyDefined = errorPolicy || this.errorPolicy;
171
+ const headers = new Headers();
172
+ if (this.readonlyToken) {
173
+ headers.append("X-API-KEY", this.readonlyToken);
174
+ }
175
+ headers.append("Content-Type", "application/json");
176
+ if (options?.fetchOptions) {
177
+ if (options?.fetchOptions?.headers) {
178
+ Object.entries(options.fetchOptions.headers).forEach(([key2, value]) => {
179
+ headers.append(key2, value);
180
+ });
181
+ }
182
+ }
183
+ const { headers: _, ...providedFetchOptions } = options?.fetchOptions || {};
184
+ const bodyString = JSON.stringify({
185
+ query: args.query,
186
+ variables: args?.variables || {}
187
+ });
188
+ const optionsObject = {
189
+ method: "POST",
190
+ headers,
191
+ body: bodyString,
192
+ redirect: "follow",
193
+ ...providedFetchOptions
152
194
  };
195
+ const draftBranch = headers.get("x-branch");
196
+ const url = replaceGithubPathSplit(args?.url || this.apiUrl, draftBranch);
197
+ let key = "";
198
+ let result;
199
+ if (this.cache) {
200
+ key = this.cache.makeKey(bodyString);
201
+ await this.cacheLock.acquire(key, async () => {
202
+ result = await this.cache.get(key);
203
+ if (!result) {
204
+ result = await requestFromServer(
205
+ url,
206
+ args.query,
207
+ optionsObject,
208
+ errorPolicyDefined
209
+ );
210
+ await this.cache.set(key, result);
211
+ }
212
+ });
213
+ } else {
214
+ result = await requestFromServer(
215
+ url,
216
+ args.query,
217
+ optionsObject,
218
+ errorPolicyDefined
219
+ );
220
+ }
221
+ return result;
222
+ }
223
+ };
224
+ async function requestFromServer(url, query, optionsObject, errorPolicyDefined) {
225
+ const res = await fetch(url, optionsObject);
226
+ if (!res.ok) {
227
+ let additionalInfo = "";
228
+ if (res.status === 401) {
229
+ additionalInfo = "Please check that your client ID, URL and read only token are configured properly.";
230
+ }
231
+ throw new Error(
232
+ `Server responded with status code ${res.status}, ${res.statusText}. ${additionalInfo ? additionalInfo : ""} Please see our FAQ for more information: https://tina.io/docs/r/FAQ/`
233
+ );
234
+ }
235
+ const json = await res.json();
236
+ if (json.errors && errorPolicyDefined === "throw") {
237
+ throw new Error(
238
+ `Unable to fetch, please see our FAQ for more information: https://tina.io/docs/r/FAQ/
239
+ Errors:
240
+ ${json.errors.map((error) => error.message).join("\n")}`
241
+ );
242
+ }
243
+ const result = {
244
+ data: json?.data,
245
+ errors: json?.errors || null,
246
+ query
153
247
  };
154
- const nodeCache = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
155
- __proto__: null,
156
- NodeCache,
157
- makeCacheDir
158
- }, Symbol.toStringTag, { value: "Module" }));
159
- exports2.TINA_HOST = TINA_HOST;
160
- exports2.TinaClient = TinaClient;
161
- exports2.createClient = createClient;
162
- Object.defineProperty(exports2, Symbol.toStringTag, { value: "Module" });
163
- });
248
+ return result;
249
+ }
250
+ function createClient(args) {
251
+ const client = new TinaClient(args);
252
+ return client;
253
+ }
254
+ export {
255
+ TINA_HOST,
256
+ TinaClient,
257
+ createClient
258
+ };
@@ -29,7 +29,7 @@ export type OnNewDocument = (args: {
29
29
  path: string;
30
30
  }) => void;
31
31
  export declare class ContentCreatorPlugin implements AddContentPlugin<FormShape> {
32
- __type: 'content-creator';
32
+ __type: "content-creator";
33
33
  fields: AddContentPlugin<FormShape>['fields'];
34
34
  onNewDocument?: OnNewDocument;
35
35
  onChange: (values: any) => void;
package/dist/index.d.ts CHANGED
@@ -53,7 +53,7 @@ export type TinaCollection = Collection;
53
53
  export type TinaCloudSchema = Schema;
54
54
  export declare const defineSchema: (config: Schema) => Schema<false>;
55
55
  export declare const defineLegacyConfig: (config: Omit<TinaCMSProviderDefaultProps, "children">) => Omit<TinaCMSProviderDefaultProps, "children">;
56
- interface MediaStoreClass {
56
+ export interface MediaStoreClass {
57
57
  new (...args: any[]): MediaStore;
58
58
  }
59
59
  export declare const defineStaticConfig: (config: Config<(cms: TinaCMS) => TinaCMS, formifyCallback, DocumentCreatorCallback, MediaStoreClass>) => Config<(cms: TinaCMS) => TinaCMS, formifyCallback, import("./hooks/use-content-creator").DocumentCreatorArgs, MediaStoreClass, undefined>;