tinacms 0.0.0-ad8dbc0-20241003000436 → 0.0.0-af203c6-20251216034843

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 (199) 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 -1
  15. package/dist/client.js +244 -147
  16. package/dist/hooks/create-page-plugin.d.ts +1 -1
  17. package/dist/index.d.ts +1 -1
  18. package/dist/index.js +122176 -31739
  19. package/dist/internalClient/index.d.ts +57 -4
  20. package/dist/react.d.ts +14 -6
  21. package/dist/react.js +209 -192
  22. package/dist/rich-text/index.d.ts +9 -0
  23. package/dist/rich-text/index.js +235 -192
  24. package/dist/rich-text/prism.js +16 -18
  25. package/dist/rich-text/static.d.ts +154 -0
  26. package/dist/rich-text/static.js +243 -0
  27. package/dist/tina-cms.d.ts +1 -1
  28. package/dist/toolkit/components/ProgressBar.d.ts +11 -0
  29. package/dist/toolkit/components/media/media-item.d.ts +11 -1
  30. package/dist/toolkit/components/media/media-manager.d.ts +1 -1
  31. package/dist/toolkit/components/ui/breadcrumb.d.ts +11 -0
  32. package/dist/toolkit/components/ui/button.d.ts +11 -0
  33. package/dist/toolkit/components/ui/calendar.d.ts +8 -0
  34. package/dist/toolkit/components/ui/date-time-picker.d.ts +111 -0
  35. package/dist/toolkit/components/ui/dropdown-menu.d.ts +25 -0
  36. package/dist/toolkit/components/ui/input.d.ts +3 -0
  37. package/dist/toolkit/components/ui/popover.d.ts +7 -0
  38. package/dist/toolkit/components/ui/select.d.ts +13 -0
  39. package/dist/toolkit/fields/components/color-picker/block-widget.d.ts +3 -0
  40. package/dist/toolkit/fields/components/color-picker/color-input.d.ts +35 -0
  41. package/dist/toolkit/fields/components/color-picker/color-picker.d.ts +6 -2
  42. package/dist/toolkit/fields/components/color-picker/color-utils.d.ts +37 -0
  43. package/dist/toolkit/fields/components/color-picker/sketch-widget.d.ts +3 -0
  44. package/dist/toolkit/fields/components/password-field.d.ts +1 -1
  45. package/dist/toolkit/fields/components/reference/components/button.d.ts +2 -2
  46. package/dist/toolkit/fields/components/reference/components/command.d.ts +21 -33
  47. package/dist/toolkit/fields/components/reference/components/popover.d.ts +1 -1
  48. package/dist/toolkit/fields/components/reference/model/reference-link-props.d.ts +2 -0
  49. package/dist/toolkit/fields/components/reference/reference-select.d.ts +2 -2
  50. package/dist/toolkit/fields/components/select.d.ts +2 -2
  51. package/dist/toolkit/fields/components/text-field.d.ts +1 -1
  52. package/dist/toolkit/fields/plugins/button-toggle-field-plugin.d.ts +2 -2
  53. package/dist/toolkit/fields/plugins/checkbox-group-field-plugin.d.ts +2 -2
  54. package/dist/toolkit/fields/plugins/color-field-plugin.d.ts +1 -0
  55. package/dist/toolkit/fields/plugins/date-field-plugin.d.ts +0 -2
  56. package/dist/toolkit/fields/plugins/dnd-kit-wrapper.d.ts +49 -0
  57. package/dist/toolkit/fields/plugins/group-field-plugin.d.ts +1 -1
  58. package/dist/toolkit/fields/plugins/group-list-field-plugin.d.ts +3 -1
  59. package/dist/toolkit/fields/plugins/list-field-meta.d.ts +1 -1
  60. package/dist/toolkit/fields/plugins/list-field-plugin.d.ts +3 -0
  61. package/dist/toolkit/fields/plugins/mdx-field-plugin/index.d.ts +5 -2
  62. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/components/editor.d.ts +20 -18
  63. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/components/fixed-toolbar-buttons.d.ts +0 -4
  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 +4 -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 +4 -0
  90. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/components/plate-ui/mermaid-toolbar-button.d.ts +18 -0
  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 +42 -0
  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/table-dropdown-menu.d.ts +4 -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/text-area.d.ts +5 -0
  104. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/components/plate-ui/toolbar.d.ts +7 -7
  105. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/components/plate-ui/use-floating-toolbar-hook.d.ts +10 -0
  106. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/components/plate-ui/use-floating-toolbar-state.d.ts +22 -0
  107. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/hooks/use-create-editor.d.ts +6 -0
  108. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/index.d.ts +1 -1
  109. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/plugins/core/autoformat/autoformat-block.d.ts +1 -1
  110. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/plugins/core/autoformat/autoformat-lists.d.ts +1 -1
  111. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/plugins/core/autoformat/autoformat-marks.d.ts +1 -1
  112. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/plugins/core/autoformat/autoformat-utils.d.ts +3 -5
  113. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/plugins/core/common.d.ts +12 -6
  114. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/plugins/core/formatting.d.ts +18 -2
  115. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/plugins/core/index.d.ts +0 -1
  116. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/plugins/create-html-block/index.d.ts +6 -0
  117. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/plugins/create-img-plugin/index.d.ts +2 -2
  118. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/plugins/create-invalid-markdown-plugin/index.d.ts +5 -5
  119. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/plugins/create-mdx-plugins/component.d.ts +7 -4
  120. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/plugins/create-mdx-plugins/index.d.ts +3 -5
  121. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/plugins/editor-plugins.d.ts +520 -0
  122. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/plugins/ui/components.d.ts +265 -156
  123. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/plugins/ui/floating-toolbar-plugin.d.ts +1 -0
  124. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/toolbar/toolbar-overrides.d.ts +11 -3
  125. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/toolbar/toolbar-provider.d.ts +3 -3
  126. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/transforms/is-url.d.ts +1 -2
  127. package/dist/toolkit/fields/plugins/radio-group-field-plugin.d.ts +2 -2
  128. package/dist/toolkit/fields/plugins/select-field-plugin.d.ts +2 -2
  129. package/dist/toolkit/fields/plugins/toggle-field-plugin.d.ts +2 -2
  130. package/dist/toolkit/fields/plugins/wrap-field-with-meta.d.ts +8 -0
  131. package/dist/toolkit/form-builder/create-branch-modal.d.ts +13 -0
  132. package/dist/toolkit/form-builder/editorial-workflow-constants.d.ts +17 -0
  133. package/dist/toolkit/form-builder/fields-builder.d.ts +1 -1
  134. package/dist/toolkit/form-builder/form-builder.d.ts +8 -9
  135. package/dist/toolkit/form-builder/index.d.ts +1 -0
  136. package/dist/toolkit/forms/field.d.ts +3 -0
  137. package/dist/toolkit/forms/form.d.ts +22 -3
  138. package/dist/toolkit/git-client/git-client.d.ts +25 -2
  139. package/dist/toolkit/git-client/git-file.d.ts +18 -0
  140. package/dist/toolkit/git-client/git-media-store.d.ts +13 -0
  141. package/dist/toolkit/git-client/use-git-file.d.ts +4 -0
  142. package/dist/toolkit/icons/Tina.d.ts +0 -5
  143. package/dist/toolkit/icons/TinaExtended.d.ts +4 -0
  144. package/dist/toolkit/icons/index.d.ts +1 -0
  145. package/dist/toolkit/index.d.ts +1 -1
  146. package/dist/toolkit/plugin-branch-switcher/branch-button.d.ts +4 -1
  147. package/dist/toolkit/plugin-branch-switcher/branch-switcher-legacy.d.ts +1 -1
  148. package/dist/toolkit/plugin-branch-switcher/branch-switcher.d.ts +1 -1
  149. package/dist/toolkit/plugin-branch-switcher/index.d.ts +0 -1
  150. package/dist/toolkit/react-cloud-config/cloud-config-plugin.d.ts +3 -3
  151. package/dist/toolkit/react-modals/modal/modal-actions.d.ts +2 -1
  152. package/dist/toolkit/react-modals/modal/modal-header.d.ts +1 -1
  153. package/dist/toolkit/react-sidebar/components/NavMenuTrigger.d.ts +11 -0
  154. package/dist/toolkit/react-sidebar/components/VersionInfo.d.ts +2 -0
  155. package/dist/toolkit/react-sidebar/components/badge.d.ts +6 -0
  156. package/dist/toolkit/react-sidebar/components/callout.d.ts +5 -0
  157. package/dist/toolkit/react-sidebar/components/form-list.d.ts +1 -1
  158. package/dist/toolkit/react-sidebar/components/local-warning.d.ts +3 -1
  159. package/dist/toolkit/react-sidebar/components/nav-components.d.ts +11 -0
  160. package/dist/toolkit/react-sidebar/components/nav-context.d.ts +15 -0
  161. package/dist/toolkit/react-sidebar/components/nav.d.ts +6 -3
  162. package/dist/toolkit/react-sidebar/components/resize-handle.d.ts +0 -5
  163. package/dist/toolkit/react-sidebar/components/sidebar-body.d.ts +33 -11
  164. package/dist/toolkit/react-sidebar/components/sidebar-loading-placeholder.d.ts +2 -0
  165. package/dist/toolkit/react-sidebar/components/sidebar-no-forms-placeholder.d.ts +2 -0
  166. package/dist/toolkit/react-sidebar/components/sidebar.d.ts +0 -7
  167. package/dist/toolkit/react-sidebar/components/sync-status.d.ts +5 -8
  168. package/dist/toolkit/react-sidebar/index.d.ts +4 -1
  169. package/dist/toolkit/react-sidebar/sidebar.d.ts +2 -2
  170. package/dist/toolkit/styles/button.d.ts +2 -2
  171. package/dist/toolkit/styles/dropdown-button.d.ts +75 -0
  172. package/dist/toolkit/styles/index.d.ts +1 -0
  173. package/dist/toolkit/tina-cms.d.ts +3 -3
  174. package/dist/toolkit/tina-state.d.ts +15 -0
  175. package/dist/unifiedClient/index.d.ts +9 -2
  176. package/dist/utils/cn.d.ts +2 -0
  177. package/dist/utils/index.d.ts +1 -0
  178. package/package.json +91 -113
  179. package/dist/__vite-browser-external-d06ac358.mjs +0 -4
  180. package/dist/admin/pages/IndexingPage.d.ts +0 -2
  181. package/dist/client.mjs +0 -109
  182. package/dist/index.mjs +0 -33188
  183. package/dist/node-cache-7fa2452c.mjs +0 -43
  184. package/dist/react.mjs +0 -234
  185. package/dist/rich-text/index.mjs +0 -210
  186. package/dist/rich-text/prism.mjs +0 -16
  187. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/components/plate-ui/code-block-element.d.ts +0 -11
  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/soft-break/create-soft-break-plugin.d.ts +0 -7
  192. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/plugins/soft-break/index.d.ts +0 -6
  193. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/plugins/soft-break/on-key-down-soft-break.d.ts +0 -5
  194. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/plugins/soft-break/types.d.ts +0 -11
  195. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/plugins/ui/code-block/index.d.ts +0 -9
  196. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/transforms/insert-empty-block.d.ts +0 -2
  197. package/dist/toolkit/plugin-branch-switcher/branch-banner.d.ts +0 -2
  198. package/dist/toolkit/react-datetime/DateTime.d.ts +0 -135
  199. package/dist/toolkit/react-sidebar/components/no-forms-placeholder.d.ts +0 -8
@@ -1,43 +0,0 @@
1
- const makeCacheDir = async (dir, fs) => {
2
- const path = await import("./__vite-browser-external-d06ac358.mjs");
3
- const os = await import("./__vite-browser-external-d06ac358.mjs");
4
- const parts = dir.split(path.sep).filter(Boolean);
5
- let cacheDir = dir;
6
- if (!fs.existsSync(path.join(path.sep, parts[0]))) {
7
- cacheDir = path.join(os.tmpdir(), parts[parts.length - 1]);
8
- }
9
- fs.mkdirSync(cacheDir, { recursive: true });
10
- return cacheDir;
11
- };
12
- const NodeCache = async (dir) => {
13
- const fs = await import("./__vite-browser-external-d06ac358.mjs");
14
- const { createHash } = await import("./__vite-browser-external-d06ac358.mjs");
15
- const cacheDir = await makeCacheDir(dir, fs);
16
- return {
17
- makeKey: (key) => {
18
- const input = key && key instanceof Object ? JSON.stringify(key) : key || "";
19
- return createHash("sha256").update(input).digest("hex");
20
- },
21
- get: async (key) => {
22
- try {
23
- const data = await fs.promises.readFile(`${cacheDir}/${key}`, "utf-8");
24
- return JSON.parse(data);
25
- } catch (e) {
26
- if (e.code === "ENOENT") {
27
- return void 0;
28
- }
29
- throw e;
30
- }
31
- },
32
- set: async (key, value) => {
33
- await fs.promises.writeFile(
34
- `${cacheDir}/${key}`,
35
- JSON.stringify(value),
36
- "utf-8"
37
- );
38
- }
39
- };
40
- };
41
- export {
42
- NodeCache
43
- };
package/dist/react.mjs DELETED
@@ -1,234 +0,0 @@
1
- import React from "react";
2
- function useTina(props) {
3
- const stringifiedQuery = JSON.stringify({
4
- query: props.query,
5
- variables: props.variables
6
- });
7
- const id = React.useMemo(
8
- () => hashFromQuery(stringifiedQuery),
9
- [stringifiedQuery]
10
- );
11
- const [data, setData] = React.useState(props.data);
12
- const [isClient, setIsClient] = React.useState(false);
13
- const [quickEditEnabled, setQuickEditEnabled] = React.useState(false);
14
- const [isInTinaIframe, setIsInTinaIframe] = React.useState(false);
15
- React.useEffect(() => {
16
- setIsClient(true);
17
- setData(props.data);
18
- }, [id]);
19
- React.useEffect(() => {
20
- if (quickEditEnabled) {
21
- let mouseDownHandler = function(e) {
22
- const attributeNames = e.target.getAttributeNames();
23
- const tinaAttribute = attributeNames.find(
24
- (name) => name.startsWith("data-tina-field")
25
- );
26
- let fieldName;
27
- if (tinaAttribute) {
28
- e.preventDefault();
29
- e.stopPropagation();
30
- fieldName = e.target.getAttribute(tinaAttribute);
31
- } else {
32
- const ancestor = e.target.closest(
33
- "[data-tina-field], [data-tina-field-overlay]"
34
- );
35
- if (ancestor) {
36
- const attributeNames2 = ancestor.getAttributeNames();
37
- const tinaAttribute2 = attributeNames2.find(
38
- (name) => name.startsWith("data-tina-field")
39
- );
40
- if (tinaAttribute2) {
41
- e.preventDefault();
42
- e.stopPropagation();
43
- fieldName = ancestor.getAttribute(tinaAttribute2);
44
- }
45
- }
46
- }
47
- if (fieldName) {
48
- if (isInTinaIframe) {
49
- parent.postMessage(
50
- { type: "field:selected", fieldName },
51
- window.location.origin
52
- );
53
- }
54
- }
55
- };
56
- const style = document.createElement("style");
57
- style.type = "text/css";
58
- style.textContent = `
59
- [data-tina-field] {
60
- outline: 2px dashed rgba(34,150,254,0.5);
61
- transition: box-shadow ease-out 150ms;
62
- }
63
- [data-tina-field]:hover {
64
- box-shadow: inset 100vi 100vh rgba(34,150,254,0.3);
65
- outline: 2px solid rgba(34,150,254,1);
66
- cursor: pointer;
67
- }
68
- [data-tina-field-overlay] {
69
- outline: 2px dashed rgba(34,150,254,0.5);
70
- position: relative;
71
- }
72
- [data-tina-field-overlay]:hover {
73
- cursor: pointer;
74
- outline: 2px solid rgba(34,150,254,1);
75
- }
76
- [data-tina-field-overlay]::after {
77
- content: '';
78
- position: absolute;
79
- inset: 0;
80
- z-index: 20;
81
- transition: opacity ease-out 150ms;
82
- background-color: rgba(34,150,254,0.3);
83
- opacity: 0;
84
- }
85
- [data-tina-field-overlay]:hover::after {
86
- opacity: 1;
87
- }
88
- `;
89
- document.head.appendChild(style);
90
- document.body.classList.add("__tina-quick-editing-enabled");
91
- document.addEventListener("click", mouseDownHandler, true);
92
- return () => {
93
- document.removeEventListener("click", mouseDownHandler, true);
94
- document.body.classList.remove("__tina-quick-editing-enabled");
95
- style.remove();
96
- };
97
- }
98
- }, [quickEditEnabled, isInTinaIframe]);
99
- React.useEffect(() => {
100
- parent.postMessage({ type: "open", ...props, id }, window.location.origin);
101
- window.addEventListener("message", (event) => {
102
- if (event.data.type === "quickEditEnabled") {
103
- setQuickEditEnabled(event.data.value);
104
- }
105
- if (event.data.id === id && event.data.type === "updateData") {
106
- setData(event.data.data);
107
- setIsInTinaIframe(true);
108
- const anyTinaField = document.querySelector("[data-tina-field]");
109
- if (anyTinaField) {
110
- parent.postMessage(
111
- { type: "quick-edit", value: true },
112
- window.location.origin
113
- );
114
- } else {
115
- parent.postMessage(
116
- { type: "quick-edit", value: false },
117
- window.location.origin
118
- );
119
- }
120
- }
121
- });
122
- return () => {
123
- parent.postMessage({ type: "close", id }, window.location.origin);
124
- };
125
- }, [id, setQuickEditEnabled]);
126
- return { data, isClient };
127
- }
128
- function useEditState() {
129
- const [edit, setEdit] = React.useState(false);
130
- React.useEffect(() => {
131
- if (typeof window !== "undefined") {
132
- parent.postMessage({ type: "isEditMode" }, window.location.origin);
133
- window.addEventListener("message", (event) => {
134
- var _a;
135
- if (((_a = event.data) == null ? void 0 : _a.type) === "tina:editMode") {
136
- setEdit(true);
137
- }
138
- });
139
- }
140
- }, []);
141
- return { edit };
142
- }
143
- const tinaField = (object, property, index) => {
144
- var _a, _b, _c;
145
- if (!object) {
146
- return "";
147
- }
148
- if (object._content_source) {
149
- if (!property) {
150
- return [
151
- (_a = object._content_source) == null ? void 0 : _a.queryId,
152
- object._content_source.path.join(".")
153
- ].join("---");
154
- }
155
- if (typeof index === "number") {
156
- return [
157
- (_b = object._content_source) == null ? void 0 : _b.queryId,
158
- [...object._content_source.path, property, index].join(".")
159
- ].join("---");
160
- }
161
- return [
162
- (_c = object._content_source) == null ? void 0 : _c.queryId,
163
- [...object._content_source.path, property].join(".")
164
- ].join("---");
165
- }
166
- return "";
167
- };
168
- const addMetadata = (id, object, path) => {
169
- Object.entries(object).forEach(([key, value]) => {
170
- if (Array.isArray(value)) {
171
- value.forEach((item, index) => {
172
- if (isScalarOrUndefined(item)) {
173
- return;
174
- }
175
- if (Array.isArray(item)) {
176
- return;
177
- }
178
- const itemObject = item;
179
- addMetadata(id, itemObject, [...path, key, index]);
180
- });
181
- } else {
182
- if (isScalarOrUndefined(value)) {
183
- return;
184
- }
185
- const itemObject = value;
186
- addMetadata(id, itemObject, [...path, key]);
187
- }
188
- });
189
- if ((object == null ? void 0 : object.type) === "root") {
190
- return;
191
- }
192
- object._content_source = {
193
- queryId: id,
194
- path
195
- };
196
- return object;
197
- };
198
- function isScalarOrUndefined(value) {
199
- const type = typeof value;
200
- if (type === "string")
201
- return true;
202
- if (type === "number")
203
- return true;
204
- if (type === "boolean")
205
- return true;
206
- if (type === "undefined")
207
- return true;
208
- if (value == null)
209
- return true;
210
- if (value instanceof String)
211
- return true;
212
- if (value instanceof Number)
213
- return true;
214
- if (value instanceof Boolean)
215
- return true;
216
- return false;
217
- }
218
- const hashFromQuery = (input) => {
219
- let hash = 0;
220
- for (let i = 0; i < input.length; i++) {
221
- const char = input.charCodeAt(i);
222
- hash = (hash << 5) - hash + char & 4294967295;
223
- }
224
- const nonNegativeHash = Math.abs(hash);
225
- const alphanumericHash = nonNegativeHash.toString(36);
226
- return alphanumericHash;
227
- };
228
- export {
229
- addMetadata,
230
- hashFromQuery,
231
- tinaField,
232
- useEditState,
233
- useTina
234
- };
@@ -1,210 +0,0 @@
1
- import React from "react";
2
- const TinaMarkdown = ({
3
- content,
4
- components = {}
5
- }) => {
6
- if (!content) {
7
- return null;
8
- }
9
- const nodes = Array.isArray(content) ? content : content.children;
10
- if (!nodes) {
11
- return null;
12
- }
13
- return /* @__PURE__ */ React.createElement(React.Fragment, null, nodes.map((child, index) => {
14
- return /* @__PURE__ */ React.createElement(MemoNode, { components, key: index, child });
15
- }));
16
- };
17
- const Leaf = (props) => {
18
- if (props.bold) {
19
- const { bold, ...rest } = props;
20
- if (props.components.bold) {
21
- const Component = props.components.bold;
22
- return /* @__PURE__ */ React.createElement(Component, null, /* @__PURE__ */ React.createElement(Leaf, { ...rest }));
23
- }
24
- return /* @__PURE__ */ React.createElement("strong", null, /* @__PURE__ */ React.createElement(Leaf, { ...rest }));
25
- }
26
- if (props.italic) {
27
- const { italic, ...rest } = props;
28
- if (props.components.italic) {
29
- const Component = props.components.italic;
30
- return /* @__PURE__ */ React.createElement(Component, null, /* @__PURE__ */ React.createElement(Leaf, { ...rest }));
31
- }
32
- return /* @__PURE__ */ React.createElement("em", null, /* @__PURE__ */ React.createElement(Leaf, { ...rest }));
33
- }
34
- if (props.underline) {
35
- const { underline, ...rest } = props;
36
- if (props.components.underline) {
37
- const Component = props.components.underline;
38
- return /* @__PURE__ */ React.createElement(Component, null, /* @__PURE__ */ React.createElement(Leaf, { ...rest }));
39
- }
40
- return /* @__PURE__ */ React.createElement("u", null, /* @__PURE__ */ React.createElement(Leaf, { ...rest }));
41
- }
42
- if (props.strikethrough) {
43
- const { strikethrough, ...rest } = props;
44
- if (props.components.strikethrough) {
45
- const Component = props.components.strikethrough;
46
- return /* @__PURE__ */ React.createElement(Component, null, /* @__PURE__ */ React.createElement(Leaf, { ...rest }));
47
- }
48
- return /* @__PURE__ */ React.createElement("s", null, /* @__PURE__ */ React.createElement(Leaf, { ...rest }));
49
- }
50
- if (props.code) {
51
- const { code, ...rest } = props;
52
- if (props.components.code) {
53
- const Component = props.components.code;
54
- return /* @__PURE__ */ React.createElement(Component, null, /* @__PURE__ */ React.createElement(Leaf, { ...rest }));
55
- }
56
- return /* @__PURE__ */ React.createElement("code", null, /* @__PURE__ */ React.createElement(Leaf, { ...rest }));
57
- }
58
- if (props.components.text) {
59
- const Component = props.components.text;
60
- return /* @__PURE__ */ React.createElement(Component, null, props.text);
61
- }
62
- return /* @__PURE__ */ React.createElement(React.Fragment, null, props.text);
63
- };
64
- const MemoNode = (props) => {
65
- const MNode = React.useMemo(
66
- () => /* @__PURE__ */ React.createElement(Node, { ...props }),
67
- [JSON.stringify(props)]
68
- );
69
- return MNode;
70
- };
71
- const Node = ({ components, child }) => {
72
- var _a, _b, _c, _d, _e, _f;
73
- const { children, ...props } = child;
74
- switch (child.type) {
75
- case "h1":
76
- case "h2":
77
- case "h3":
78
- case "h4":
79
- case "h5":
80
- case "h6":
81
- case "p":
82
- case "blockquote":
83
- case "ol":
84
- case "ul":
85
- case "li":
86
- if (components[child.type]) {
87
- const Component2 = components[child.type];
88
- return /* @__PURE__ */ React.createElement(Component2, { ...props }, /* @__PURE__ */ React.createElement(TinaMarkdown, { components, content: children }));
89
- }
90
- return React.createElement(child.type, {
91
- children: /* @__PURE__ */ React.createElement(TinaMarkdown, { components, content: children })
92
- });
93
- case "lic":
94
- if (components.lic) {
95
- const Component2 = components.lic;
96
- return /* @__PURE__ */ React.createElement(Component2, { ...props }, /* @__PURE__ */ React.createElement(TinaMarkdown, { components, content: children }));
97
- }
98
- return /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement(TinaMarkdown, { components, content: child.children }));
99
- case "img":
100
- if (components[child.type]) {
101
- const Component2 = components[child.type];
102
- return /* @__PURE__ */ React.createElement(Component2, { ...props });
103
- }
104
- return /* @__PURE__ */ React.createElement("img", { src: child.url, alt: child.alt });
105
- case "a":
106
- if (components[child.type]) {
107
- const Component2 = components[child.type];
108
- return (
109
- // @ts-ignore FIXME: TinaMarkdownContent needs to be a union of all possible node types
110
- /* @__PURE__ */ React.createElement(Component2, { ...props }, /* @__PURE__ */ React.createElement(TinaMarkdown, { components, content: children }))
111
- );
112
- }
113
- return (
114
- // @ts-ignore FIXME: TinaMarkdownContent needs to be a union of all possible node types
115
- /* @__PURE__ */ React.createElement("a", { href: child.url }, /* @__PURE__ */ React.createElement(TinaMarkdown, { components, content: children }))
116
- );
117
- case "code_block":
118
- const value = child.value;
119
- if (components[child.type]) {
120
- const Component2 = components[child.type];
121
- return (
122
- // @ts-ignore FIXME: TinaMarkdownContent needs to be a union of all possible node types
123
- /* @__PURE__ */ React.createElement(Component2, { ...props })
124
- );
125
- }
126
- return /* @__PURE__ */ React.createElement("pre", null, /* @__PURE__ */ React.createElement("code", null, value));
127
- case "hr":
128
- if (components[child.type]) {
129
- const Component2 = components[child.type];
130
- return /* @__PURE__ */ React.createElement(Component2, { ...props });
131
- }
132
- return /* @__PURE__ */ React.createElement("hr", null);
133
- case "break":
134
- if (components[child.type]) {
135
- const Component2 = components[child.type];
136
- return /* @__PURE__ */ React.createElement(Component2, { ...props });
137
- }
138
- return /* @__PURE__ */ React.createElement("br", null);
139
- case "text":
140
- return /* @__PURE__ */ React.createElement(Leaf, { components, ...child });
141
- case "mdxJsxTextElement":
142
- case "mdxJsxFlowElement":
143
- const Component = components[child.name];
144
- if (Component) {
145
- const props2 = child.props ? child.props : {};
146
- return /* @__PURE__ */ React.createElement(Component, { ...props2 });
147
- } else {
148
- if (child.name === "table") {
149
- const firstRowHeader = (_a = child.props) == null ? void 0 : _a.firstRowHeader;
150
- const rows = (firstRowHeader ? (_b = child.props) == null ? void 0 : _b.tableRows.filter((_, i) => i !== 0) : (_c = child.props) == null ? void 0 : _c.tableRows) || [];
151
- const header = (_e = (_d = child.props) == null ? void 0 : _d.tableRows) == null ? void 0 : _e.at(0);
152
- const TableComponent = components["table"] || ((props2) => /* @__PURE__ */ React.createElement("table", { ...props2 }));
153
- const TrComponent = components["tr"] || ((props2) => /* @__PURE__ */ React.createElement("tr", { ...props2 }));
154
- const ThComponent = components["th"] || ((props2) => /* @__PURE__ */ React.createElement("th", { style: { textAlign: (props2 == null ? void 0 : props2.align) || "auto" }, ...props2 }));
155
- const TdComponent = components["td"] || ((props2) => /* @__PURE__ */ React.createElement("td", { style: { textAlign: (props2 == null ? void 0 : props2.align) || "auto" }, ...props2 }));
156
- const align = ((_f = child.props) == null ? void 0 : _f.align) || [];
157
- return /* @__PURE__ */ React.createElement(TableComponent, null, firstRowHeader && /* @__PURE__ */ React.createElement("thead", null, /* @__PURE__ */ React.createElement(TrComponent, null, header.tableCells.map((c, i) => {
158
- return /* @__PURE__ */ React.createElement(
159
- TinaMarkdown,
160
- {
161
- key: i,
162
- components: {
163
- p: (props2) => /* @__PURE__ */ React.createElement(ThComponent, { align: align[i], ...props2 })
164
- },
165
- content: c.value
166
- }
167
- );
168
- }))), /* @__PURE__ */ React.createElement("tbody", null, rows.map((row, i) => {
169
- var _a2;
170
- return /* @__PURE__ */ React.createElement(TrComponent, { key: i }, (_a2 = row == null ? void 0 : row.tableCells) == null ? void 0 : _a2.map((c, i2) => {
171
- return /* @__PURE__ */ React.createElement(
172
- TinaMarkdown,
173
- {
174
- key: i2,
175
- components: {
176
- p: (props2) => /* @__PURE__ */ React.createElement(TdComponent, { align: align[i2], ...props2 })
177
- },
178
- content: c.value
179
- }
180
- );
181
- }));
182
- })));
183
- }
184
- const ComponentMissing = components["component_missing"];
185
- if (ComponentMissing) {
186
- return /* @__PURE__ */ React.createElement(ComponentMissing, { name: child.name });
187
- } else {
188
- return /* @__PURE__ */ React.createElement("span", null, `No component provided for ${child.name}`);
189
- }
190
- }
191
- case "maybe_mdx":
192
- return null;
193
- case "html":
194
- case "html_inline":
195
- if (components[child.type]) {
196
- const Component2 = components[child.type];
197
- return /* @__PURE__ */ React.createElement(Component2, { ...props });
198
- }
199
- return child.value;
200
- case "invalid_markdown":
201
- return /* @__PURE__ */ React.createElement("pre", null, child.value);
202
- default:
203
- if (typeof child.text === "string") {
204
- return /* @__PURE__ */ React.createElement(Leaf, { components, ...child });
205
- }
206
- }
207
- };
208
- export {
209
- TinaMarkdown
210
- };
@@ -1,16 +0,0 @@
1
- import React from "react";
2
- import { Highlight, themes } from "prism-react-renderer";
3
- const Prism = (props) => {
4
- return /* @__PURE__ */ React.createElement(
5
- Highlight,
6
- {
7
- theme: themes[props.theme || "github"],
8
- code: props.value,
9
- language: props.lang || ""
10
- },
11
- ({ className, style, tokens, getLineProps, getTokenProps }) => /* @__PURE__ */ React.createElement("pre", { className, style }, tokens.map((line, i) => /* @__PURE__ */ React.createElement("div", { ...getLineProps({ line, key: i }) }, line.map((token, key) => /* @__PURE__ */ React.createElement("span", { ...getTokenProps({ token, key }) })))))
12
- );
13
- };
14
- export {
15
- Prism
16
- };
@@ -1,11 +0,0 @@
1
- import React from 'react';
2
- export declare const CodeBlockElement: 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>>;
@@ -1,8 +0,0 @@
1
- /**
2
- *
3
- * This fixes a bug where you can't delete between two void nodes
4
- * without deleting the first node.
5
- *
6
- * https://github.com/ianstormtaylor/slate/issues/3991#issuecomment-832160304
7
- */
8
- export declare const withCorrectVoidBehavior: (editor: any) => any;
@@ -1,3 +0,0 @@
1
- export declare const createCodeBlockPlugin: <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>;
2
- export declare const createHTMLBlockPlugin: <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>;
3
- export declare const createHTMLInlinePlugin: <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,15 +0,0 @@
1
- import React from 'react';
2
- import { type BaseRange } from 'slate';
3
- import { createLinkPlugin } from '@udecode/plate-link';
4
- import { type PlateEditor } from '@udecode/plate-common';
5
- export { createLinkPlugin };
6
- type LinkElement = {
7
- url?: string;
8
- title?: string;
9
- text: string | undefined;
10
- };
11
- export declare const wrapOrRewrapLink: (editor: any) => void;
12
- export declare const LinkForm: (props: any) => React.JSX.Element;
13
- export declare const unwrapLink: (editor: PlateEditor, selection?: BaseRange) => void;
14
- export declare const getLinks: (editor: any) => Generator<import("@udecode/plate-common").TNodeEntry<LinkElement>, void, undefined>;
15
- export declare const isLinkActive: (editor: any) => boolean;
@@ -1,7 +0,0 @@
1
- import type { SoftBreakPlugin } from './types';
2
- export declare const KEY_SOFT_BREAK = "break";
3
- /**
4
- * This code is mostly copied from the plate soft-break plugin
5
- * [here](https://github.com/udecode/plate/blob/3c0de39a66308a9b718cf9f35623502702ae2af4/packages/editor/break/src/soft-break/index.ts)
6
- */
7
- export declare const createSoftBreakPlugin: <OP = SoftBreakPlugin, 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,6 +0,0 @@
1
- /**
2
- * @file Automatically generated by barrelsby.
3
- */
4
- export * from './create-soft-break-plugin';
5
- export * from './on-key-down-soft-break';
6
- export * from './types';
@@ -1,5 +0,0 @@
1
- export declare const onKeyDownSoftBreak: (editor: any, { options: { rules } }: {
2
- options: {
3
- rules?: any[];
4
- };
5
- }) => (event: any) => void;
@@ -1,11 +0,0 @@
1
- import type { QueryNodeOptions } from '@udecode/plate-common';
2
- export interface SoftBreakRule {
3
- hotkey: string;
4
- /**
5
- * Filter the block types where the rule applies.
6
- */
7
- query?: QueryNodeOptions;
8
- }
9
- export interface SoftBreakPlugin {
10
- rules?: SoftBreakRule[];
11
- }
@@ -1,9 +0,0 @@
1
- import React from 'react';
2
- import { type PlateEditor, type TElement } from '@udecode/plate-common';
3
- export declare const CodeBlock: ({ attributes, editor, element, language: restrictLanguage, ...props }: {
4
- attributes: Record<string, unknown>;
5
- element: TElement;
6
- editor: PlateEditor;
7
- language?: string;
8
- children: React.ReactNode;
9
- }) => React.JSX.Element;
@@ -1,2 +0,0 @@
1
- import { type PlateEditor } from '@udecode/plate-common';
2
- export declare const insertEmptyCodeBlock: (editor: PlateEditor) => void;
@@ -1,2 +0,0 @@
1
- import * as React from 'react';
2
- export declare const BranchBanner: () => React.JSX.Element;