tinacms 0.0.0-c8b1d84-20241003015733 → 0.0.0-cef656e-20250119001929

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 (32) hide show
  1. package/dist/admin/types.d.ts +3 -0
  2. package/dist/cache/node-cache.d.ts +1 -0
  3. package/dist/client.js +23 -24
  4. package/dist/client.mjs +4 -8
  5. package/dist/index.d.ts +1 -1
  6. package/dist/index.js +1589 -1029
  7. package/dist/index.mjs +1579 -1015
  8. package/dist/{node-cache-7fa2452c.mjs → node-cache-4c336858.mjs} +18 -11
  9. package/dist/rich-text/index.d.ts +3 -0
  10. package/dist/rich-text/index.js +45 -12
  11. package/dist/rich-text/index.mjs +45 -12
  12. package/dist/toolkit/fields/plugins/mdx-field-plugin/index.d.ts +4 -1
  13. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/components/fixed-toolbar-buttons.d.ts +0 -4
  14. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/components/plate-ui/icons.d.ts +2 -0
  15. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/components/plate-ui/mermaid-element.d.ts +11 -0
  16. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/components/plate-ui/mermaid-toolbar-button.d.ts +20 -0
  17. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/components/plate-ui/resizable.d.ts +39 -0
  18. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/components/plate-ui/table-cell-element.d.ts +27 -0
  19. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/components/plate-ui/table-dropdown-menu.d.ts +3 -0
  20. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/components/plate-ui/table-element.d.ts +14 -0
  21. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/components/plate-ui/table-row-element.d.ts +13 -0
  22. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/components/plate-ui/text-area.d.ts +5 -0
  23. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/index.d.ts +1 -1
  24. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/plugins/core/common.d.ts +1 -0
  25. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/plugins/custom/mermaid-plugin.d.ts +2 -0
  26. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/plugins/ui/code-block/index.d.ts +4 -2
  27. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/plugins/ui/components.d.ts +58 -0
  28. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/toolbar/toolbar-overrides.d.ts +11 -3
  29. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/toolbar/toolbar-provider.d.ts +3 -3
  30. package/dist/toolkit/fields/plugins/wrap-field-with-meta.d.ts +8 -0
  31. package/package.json +29 -28
  32. package/dist/__vite-browser-external-d06ac358.mjs +0 -4
@@ -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,2 +1,3 @@
1
1
  import type { Cache } from './index';
2
+ export declare const makeCacheDir: (dir: string, fs: any, path: any, os: any) => Promise<string>;
2
3
  export declare const NodeCache: (dir: string) => Promise<Cache>;
package/dist/client.js CHANGED
@@ -1,10 +1,7 @@
1
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) {
2
+ typeof exports === "object" && typeof module !== "undefined" ? factory(exports) : typeof define === "function" && define.amd ? define(["exports"], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, factory(global.tinacms = {}));
3
+ })(this, function(exports2) {
4
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
5
  const TINA_HOST = "content.tinajs.io";
9
6
  class TinaClient {
10
7
  constructor({
@@ -26,7 +23,7 @@
26
23
  return;
27
24
  }
28
25
  try {
29
- if (this.cacheDir && window === void 0 && typeof require !== "undefined") {
26
+ if (this.cacheDir && typeof window === "undefined" && typeof require !== "undefined") {
30
27
  const { NodeCache: NodeCache2 } = await Promise.resolve().then(() => nodeCache);
31
28
  this.cache = await NodeCache2(this.cacheDir);
32
29
  }
@@ -39,7 +36,7 @@
39
36
  var _a;
40
37
  await this.init();
41
38
  const errorPolicyDefined = errorPolicy || this.errorPolicy;
42
- const headers = new HeadersDefined();
39
+ const headers = new Headers();
43
40
  if (this.readonlyToken) {
44
41
  headers.append("X-API-KEY", this.readonlyToken);
45
42
  }
@@ -72,7 +69,7 @@
72
69
  return value;
73
70
  }
74
71
  }
75
- const res = await fetchDefined(url, optionsObject);
72
+ const res = await fetch(url, optionsObject);
76
73
  if (!res.ok) {
77
74
  let additionalInfo = "";
78
75
  if (res.status === 401) {
@@ -105,21 +102,27 @@
105
102
  const client = new TinaClient(args);
106
103
  return client;
107
104
  }
108
- const makeCacheDir = async (dir, fs) => {
109
- const path = await Promise.resolve().then(() => __viteBrowserExternal$1);
110
- const os = await Promise.resolve().then(() => __viteBrowserExternal$1);
111
- const parts = dir.split(path.sep).filter(Boolean);
105
+ const makeCacheDir = async (dir, fs, path, os) => {
106
+ const pathParts = dir.split(path.sep).filter(Boolean);
107
+ const cacheHash = pathParts[pathParts.length - 1];
108
+ const rootUser = pathParts[0];
112
109
  let cacheDir = dir;
113
- if (!fs.existsSync(path.join(path.sep, parts[0]))) {
114
- cacheDir = path.join(os.tmpdir(), parts[parts.length - 1]);
110
+ if (!fs.existsSync(path.join(path.sep, rootUser))) {
111
+ cacheDir = path.join(os.tmpdir(), cacheHash);
112
+ }
113
+ try {
114
+ fs.mkdirSync(cacheDir, { recursive: true });
115
+ } catch (error) {
116
+ throw new Error(`Failed to create cache directory: ${error.message}`);
115
117
  }
116
- fs.mkdirSync(cacheDir, { recursive: true });
117
118
  return cacheDir;
118
119
  };
119
120
  const NodeCache = async (dir) => {
120
- const fs = await Promise.resolve().then(() => __viteBrowserExternal$1);
121
- const { createHash } = await Promise.resolve().then(() => __viteBrowserExternal$1);
122
- const cacheDir = await makeCacheDir(dir, fs);
121
+ const fs = require("node:fs");
122
+ const path = require("node:path");
123
+ const os = require("node:os");
124
+ const { createHash } = require("node:crypto");
125
+ const cacheDir = await makeCacheDir(dir, fs, path, os);
123
126
  return {
124
127
  makeKey: (key) => {
125
128
  const input = key && key instanceof Object ? JSON.stringify(key) : key || "";
@@ -147,12 +150,8 @@
147
150
  };
148
151
  const nodeCache = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
149
152
  __proto__: null,
150
- NodeCache
151
- }, Symbol.toStringTag, { value: "Module" }));
152
- const __viteBrowserExternal = {};
153
- const __viteBrowserExternal$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
154
- __proto__: null,
155
- default: __viteBrowserExternal
153
+ NodeCache,
154
+ makeCacheDir
156
155
  }, Symbol.toStringTag, { value: "Module" }));
157
156
  exports2.TINA_HOST = TINA_HOST;
158
157
  exports2.TinaClient = TinaClient;
package/dist/client.mjs CHANGED
@@ -1,7 +1,3 @@
1
- import fetchPonyfill from "fetch-ponyfill";
2
- const { fetch: fetchPonyfillFN, Headers: HeadersPonyfill } = fetchPonyfill();
3
- const fetchDefined = typeof fetch === "undefined" ? fetchPonyfillFN : fetch;
4
- const HeadersDefined = typeof Headers === "undefined" ? HeadersPonyfill : Headers;
5
1
  const TINA_HOST = "content.tinajs.io";
6
2
  class TinaClient {
7
3
  constructor({
@@ -23,8 +19,8 @@ class TinaClient {
23
19
  return;
24
20
  }
25
21
  try {
26
- if (this.cacheDir && window === void 0 && typeof require !== "undefined") {
27
- const { NodeCache } = await import("./node-cache-7fa2452c.mjs");
22
+ if (this.cacheDir && typeof window === "undefined" && typeof require !== "undefined") {
23
+ const { NodeCache } = await import("./node-cache-4c336858.mjs");
28
24
  this.cache = await NodeCache(this.cacheDir);
29
25
  }
30
26
  } catch (e) {
@@ -36,7 +32,7 @@ class TinaClient {
36
32
  var _a;
37
33
  await this.init();
38
34
  const errorPolicyDefined = errorPolicy || this.errorPolicy;
39
- const headers = new HeadersDefined();
35
+ const headers = new Headers();
40
36
  if (this.readonlyToken) {
41
37
  headers.append("X-API-KEY", this.readonlyToken);
42
38
  }
@@ -69,7 +65,7 @@ class TinaClient {
69
65
  return value;
70
66
  }
71
67
  }
72
- const res = await fetchDefined(url, optionsObject);
68
+ const res = await fetch(url, optionsObject);
73
69
  if (!res.ok) {
74
70
  let additionalInfo = "";
75
71
  if (res.status === 401) {
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>;