tinacms 1.5.10 → 1.5.11

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.
@@ -0,0 +1,21 @@
1
+ /// <reference types="react" />
2
+ import type { TinaMarkdownContent } from './rich-text';
3
+ declare type RenderValue = (args: {
4
+ value: unknown;
5
+ keyName: string;
6
+ parentValue: object | object[];
7
+ parentKeyName: string;
8
+ }) => JSX.Element;
9
+ declare type RenderRichText = (args: {
10
+ value: TinaMarkdownContent;
11
+ }) => JSX.Element;
12
+ export declare const Explorer: (props: {
13
+ value: object;
14
+ renderValue: RenderValue;
15
+ renderRichText: RenderRichText;
16
+ }) => JSX.Element;
17
+ export declare function Json({ src, withDataTinaFieldState, }: {
18
+ src: object;
19
+ withDataTinaFieldState?: boolean;
20
+ }): JSX.Element;
21
+ export {};
@@ -0,0 +1,486 @@
1
+ import React, { useContext, useState, useEffect, Suspense } 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, {
15
+ components,
16
+ key: index,
17
+ child
18
+ });
19
+ }));
20
+ };
21
+ const Leaf = (props) => {
22
+ if (props.bold) {
23
+ const { bold, ...rest } = props;
24
+ if (props.components.bold) {
25
+ const Component = props.components.bold;
26
+ return /* @__PURE__ */ React.createElement(Component, null, /* @__PURE__ */ React.createElement(Leaf, {
27
+ ...rest
28
+ }));
29
+ }
30
+ return /* @__PURE__ */ React.createElement("strong", null, /* @__PURE__ */ React.createElement(Leaf, {
31
+ ...rest
32
+ }));
33
+ }
34
+ if (props.italic) {
35
+ const { italic, ...rest } = props;
36
+ if (props.components.italic) {
37
+ const Component = props.components.italic;
38
+ return /* @__PURE__ */ React.createElement(Component, null, /* @__PURE__ */ React.createElement(Leaf, {
39
+ ...rest
40
+ }));
41
+ }
42
+ return /* @__PURE__ */ React.createElement("em", null, /* @__PURE__ */ React.createElement(Leaf, {
43
+ ...rest
44
+ }));
45
+ }
46
+ if (props.underline) {
47
+ const { underline, ...rest } = props;
48
+ if (props.components.underline) {
49
+ const Component = props.components.underline;
50
+ return /* @__PURE__ */ React.createElement(Component, null, /* @__PURE__ */ React.createElement(Leaf, {
51
+ ...rest
52
+ }));
53
+ }
54
+ return /* @__PURE__ */ React.createElement("u", null, /* @__PURE__ */ React.createElement(Leaf, {
55
+ ...rest
56
+ }));
57
+ }
58
+ if (props.strikethrough) {
59
+ const { strikethrough, ...rest } = props;
60
+ if (props.components.strikethrough) {
61
+ const Component = props.components.strikethrough;
62
+ return /* @__PURE__ */ React.createElement(Component, null, /* @__PURE__ */ React.createElement(Leaf, {
63
+ ...rest
64
+ }));
65
+ }
66
+ return /* @__PURE__ */ React.createElement("s", null, /* @__PURE__ */ React.createElement(Leaf, {
67
+ ...rest
68
+ }));
69
+ }
70
+ if (props.code) {
71
+ const { code, ...rest } = props;
72
+ if (props.components.code) {
73
+ const Component = props.components.code;
74
+ return /* @__PURE__ */ React.createElement(Component, null, /* @__PURE__ */ React.createElement(Leaf, {
75
+ ...rest
76
+ }));
77
+ }
78
+ return /* @__PURE__ */ React.createElement("code", null, /* @__PURE__ */ React.createElement(Leaf, {
79
+ ...rest
80
+ }));
81
+ }
82
+ if (props.components.text) {
83
+ const Component = props.components.text;
84
+ return /* @__PURE__ */ React.createElement(Component, null, props.text);
85
+ }
86
+ return /* @__PURE__ */ React.createElement(React.Fragment, null, props.text);
87
+ };
88
+ const MemoNode = (props) => {
89
+ const MNode = React.useMemo(() => /* @__PURE__ */ React.createElement(Node, {
90
+ ...props
91
+ }), [JSON.stringify(props)]);
92
+ return MNode;
93
+ };
94
+ const Node = ({ components, child }) => {
95
+ const { children, ...props } = child;
96
+ switch (child.type) {
97
+ case "h1":
98
+ case "h2":
99
+ case "h3":
100
+ case "h4":
101
+ case "h5":
102
+ case "h6":
103
+ case "p":
104
+ case "blockquote":
105
+ case "ol":
106
+ case "ul":
107
+ case "li":
108
+ if (components[child.type]) {
109
+ const Component2 = components[child.type];
110
+ return /* @__PURE__ */ React.createElement(Component2, {
111
+ ...props
112
+ }, /* @__PURE__ */ React.createElement(TinaMarkdown, {
113
+ components,
114
+ content: children
115
+ }));
116
+ }
117
+ return React.createElement(child.type, {
118
+ children: /* @__PURE__ */ React.createElement(TinaMarkdown, {
119
+ components,
120
+ content: children
121
+ })
122
+ });
123
+ case "lic":
124
+ if (components.lic) {
125
+ const Component2 = components.lic;
126
+ return /* @__PURE__ */ React.createElement(Component2, {
127
+ ...props
128
+ }, /* @__PURE__ */ React.createElement(TinaMarkdown, {
129
+ components,
130
+ content: children
131
+ }));
132
+ }
133
+ return /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement(TinaMarkdown, {
134
+ components,
135
+ content: child.children
136
+ }));
137
+ case "img":
138
+ if (components[child.type]) {
139
+ const Component2 = components[child.type];
140
+ return /* @__PURE__ */ React.createElement(Component2, {
141
+ ...props
142
+ });
143
+ }
144
+ return /* @__PURE__ */ React.createElement("img", {
145
+ src: child.url,
146
+ alt: child.caption
147
+ });
148
+ case "a":
149
+ if (components[child.type]) {
150
+ const Component2 = components[child.type];
151
+ return /* @__PURE__ */ React.createElement(Component2, {
152
+ ...props
153
+ }, /* @__PURE__ */ React.createElement(TinaMarkdown, {
154
+ components,
155
+ content: children
156
+ }));
157
+ }
158
+ return /* @__PURE__ */ React.createElement("a", {
159
+ href: child.url
160
+ }, /* @__PURE__ */ React.createElement(TinaMarkdown, {
161
+ components,
162
+ content: children
163
+ }));
164
+ case "code_block":
165
+ const value = child.value;
166
+ if (components[child.type]) {
167
+ const Component2 = components[child.type];
168
+ return /* @__PURE__ */ React.createElement(Component2, {
169
+ ...props
170
+ });
171
+ }
172
+ return /* @__PURE__ */ React.createElement("pre", null, /* @__PURE__ */ React.createElement("code", null, value));
173
+ case "hr":
174
+ if (components[child.type]) {
175
+ const Component2 = components[child.type];
176
+ return /* @__PURE__ */ React.createElement(Component2, {
177
+ ...props
178
+ });
179
+ }
180
+ return /* @__PURE__ */ React.createElement("hr", null);
181
+ case "break":
182
+ if (components[child.type]) {
183
+ const Component2 = components[child.type];
184
+ return /* @__PURE__ */ React.createElement(Component2, {
185
+ ...props
186
+ });
187
+ }
188
+ return /* @__PURE__ */ React.createElement("br", null);
189
+ case "text":
190
+ return /* @__PURE__ */ React.createElement(Leaf, {
191
+ components,
192
+ ...child
193
+ });
194
+ case "mdxJsxTextElement":
195
+ case "mdxJsxFlowElement":
196
+ const Component = components[child.name];
197
+ if (Component) {
198
+ const props2 = child.props ? child.props : {};
199
+ return /* @__PURE__ */ React.createElement(Component, {
200
+ ...props2
201
+ });
202
+ } else {
203
+ const ComponentMissing = components["component_missing"];
204
+ if (ComponentMissing) {
205
+ return /* @__PURE__ */ React.createElement(ComponentMissing, {
206
+ name: child.name
207
+ });
208
+ } else {
209
+ return /* @__PURE__ */ React.createElement("span", null, `No component provided for ${child.name}`);
210
+ }
211
+ }
212
+ case "maybe_mdx":
213
+ return null;
214
+ case "html":
215
+ case "html_inline":
216
+ if (components[child.type]) {
217
+ const Component2 = components[child.type];
218
+ return /* @__PURE__ */ React.createElement(Component2, {
219
+ ...props
220
+ });
221
+ }
222
+ return child.value;
223
+ case "invalid_markdown":
224
+ return /* @__PURE__ */ React.createElement("pre", null, child.value);
225
+ default:
226
+ if (typeof child.text === "string") {
227
+ return /* @__PURE__ */ React.createElement(Leaf, {
228
+ components,
229
+ ...child
230
+ });
231
+ }
232
+ }
233
+ };
234
+ const tinaField = (object, property, index) => {
235
+ var _a, _b, _c;
236
+ if (!object) {
237
+ return "";
238
+ }
239
+ if (object._content_source) {
240
+ if (!property) {
241
+ return [
242
+ (_a = object._content_source) == null ? void 0 : _a.queryId,
243
+ object._content_source.path.join(".")
244
+ ].join("---");
245
+ }
246
+ if (typeof index === "number") {
247
+ return [
248
+ (_b = object._content_source) == null ? void 0 : _b.queryId,
249
+ [...object._content_source.path, property, index].join(".")
250
+ ].join("---");
251
+ }
252
+ return [
253
+ (_c = object._content_source) == null ? void 0 : _c.queryId,
254
+ [...object._content_source.path, property].join(".")
255
+ ].join("---");
256
+ }
257
+ return "";
258
+ };
259
+ const Explorer = (props) => {
260
+ return /* @__PURE__ */ React.createElement("div", {
261
+ className: "font-mono"
262
+ }, /* @__PURE__ */ React.createElement(ObjectValueRenderer, {
263
+ ...props
264
+ }));
265
+ };
266
+ const ObjectValueRenderer = (props) => {
267
+ const subEntries = Object.entries(props.value).map(([keyName, subValue]) => {
268
+ return /* @__PURE__ */ React.createElement("div", {
269
+ key: keyName,
270
+ className: "gap-2"
271
+ }, /* @__PURE__ */ React.createElement(UnknownRenderer, {
272
+ keyName,
273
+ value: subValue,
274
+ parentValue: props.value,
275
+ parentKeyName: props.parentKeyName,
276
+ renderValue: props.renderValue,
277
+ renderRichText: props.renderRichText,
278
+ showMetaFields: props.showMetaFields
279
+ }));
280
+ });
281
+ return /* @__PURE__ */ React.createElement("div", null, subEntries);
282
+ };
283
+ const UnknownRenderer = ({
284
+ keyName,
285
+ value,
286
+ parentValue,
287
+ parentKeyName,
288
+ renderValue,
289
+ renderRichText,
290
+ showMetaFields
291
+ }) => {
292
+ const typeOfValue = typeof value;
293
+ const [expanded, setExpanded] = React.useState((value == null ? void 0 : value.type) === "root" ? false : true);
294
+ if (!showMetaFields) {
295
+ if ([
296
+ "_sys",
297
+ "__typename",
298
+ "_internalValues",
299
+ "_internalSys"
300
+ ].includes(keyName)) {
301
+ return;
302
+ }
303
+ }
304
+ if (Array.isArray(value)) {
305
+ return /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement("button", {
306
+ onClick: () => setExpanded((exp) => !exp),
307
+ className: "min-w-[48px] flex justify-start gap-2"
308
+ }, keyName, ": ", "[", !expanded && `...]`), expanded && /* @__PURE__ */ React.createElement("div", {
309
+ className: "pl-4"
310
+ }, value.map((item, index) => /* @__PURE__ */ React.createElement(UnknownRenderer, {
311
+ key: String(index),
312
+ keyName: String(index),
313
+ value: item,
314
+ parentKeyName: keyName,
315
+ parentValue,
316
+ renderValue,
317
+ renderRichText
318
+ }))), expanded && /* @__PURE__ */ React.createElement("div", null, "]"));
319
+ }
320
+ if (typeOfValue === "object") {
321
+ if ((value == null ? void 0 : value.type) === "root" && renderRichText) {
322
+ return /* @__PURE__ */ React.createElement("div", {
323
+ className: "flex gap-2"
324
+ }, /* @__PURE__ */ React.createElement("button", {
325
+ onClick: () => setExpanded((exp) => !exp),
326
+ className: "min-w-[48px] flex justify-start gap-2"
327
+ }, keyName, ": ", !expanded && "{...}"), /* @__PURE__ */ React.createElement("div", null, expanded && renderRichText({ value, keyName, parentValue, parentKeyName })));
328
+ }
329
+ return /* @__PURE__ */ React.createElement(ObjectRenderer, {
330
+ keyName,
331
+ value,
332
+ parentValue,
333
+ parentKeyName,
334
+ renderValue,
335
+ renderRichText
336
+ });
337
+ }
338
+ return /* @__PURE__ */ React.createElement(Value, {
339
+ keyName,
340
+ value,
341
+ parentValue,
342
+ parentKeyName,
343
+ renderValue
344
+ });
345
+ };
346
+ const Value = ({
347
+ keyName,
348
+ value,
349
+ parentValue,
350
+ parentKeyName,
351
+ renderValue
352
+ }) => {
353
+ const keyDisplay = isNaN(Number(keyName)) ? `${keyName}: ` : ``;
354
+ return /* @__PURE__ */ React.createElement("div", {
355
+ className: "flex gap-2"
356
+ }, /* @__PURE__ */ React.createElement("div", null, keyDisplay), /* @__PURE__ */ React.createElement("div", null, renderValue({ value, keyName, parentValue, parentKeyName })));
357
+ };
358
+ const ObjectRenderer = ({
359
+ keyName,
360
+ value,
361
+ parentValue,
362
+ parentKeyName,
363
+ renderValue,
364
+ renderRichText
365
+ }) => {
366
+ const { withDataTinaFieldState } = useContext(JsonContext);
367
+ const [showMetaFields, setShowMetaFields] = React.useState(false);
368
+ const [expanded, setExpanded] = React.useState(true);
369
+ const v = value;
370
+ const keyDisplay = isNaN(Number(keyName)) ? `${keyName}: ` : ``;
371
+ if (value === null) {
372
+ return /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement("div", {
373
+ className: "flex gap-2"
374
+ }, /* @__PURE__ */ React.createElement("div", {
375
+ className: ""
376
+ }, keyDisplay), /* @__PURE__ */ React.createElement("div", {
377
+ className: "text-gray-400"
378
+ }, "null")));
379
+ } else {
380
+ const fieldName = tinaField(v);
381
+ const extraProps = {};
382
+ if (fieldName !== "undefined#undefined" && withDataTinaFieldState) {
383
+ extraProps["data-tina-field"] = fieldName;
384
+ }
385
+ return /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement("div", {
386
+ className: "flex justify-between"
387
+ }, /* @__PURE__ */ React.createElement("button", {
388
+ onClick: () => setExpanded((exp) => !exp),
389
+ className: "min-w-[48px] flex justify-start gap-2"
390
+ }, keyDisplay, "{", !expanded && `...}`), expanded && /* @__PURE__ */ React.createElement("button", {
391
+ onClick: () => {
392
+ setShowMetaFields((show) => !show);
393
+ },
394
+ className: "min-w-[48px] text-sm text-gray-400"
395
+ }, showMetaFields ? "Hide meta fields" : "Show meta fields")), expanded && /* @__PURE__ */ React.createElement("div", {
396
+ className: "pl-4",
397
+ ...extraProps
398
+ }, /* @__PURE__ */ React.createElement(ObjectValueRenderer, {
399
+ value: v,
400
+ parentValue,
401
+ parentKeyName,
402
+ renderValue,
403
+ renderRichText,
404
+ showMetaFields
405
+ })), expanded && /* @__PURE__ */ React.createElement("div", null, "}"));
406
+ }
407
+ };
408
+ const JsonContext = React.createContext({ withDataTinaFieldState: true });
409
+ function Json({
410
+ src,
411
+ withDataTinaFieldState = true
412
+ }) {
413
+ const [isClient, setIsClient] = useState(false);
414
+ useEffect(() => {
415
+ setIsClient(true);
416
+ }, []);
417
+ if (!isClient) {
418
+ return null;
419
+ }
420
+ return /* @__PURE__ */ React.createElement(Suspense, {
421
+ fallback: /* @__PURE__ */ React.createElement("div", {
422
+ className: ""
423
+ }, "Loading...")
424
+ }, /* @__PURE__ */ React.createElement(JsonContext.Provider, {
425
+ value: {
426
+ withDataTinaFieldState: withDataTinaFieldState === false ? false : true
427
+ }
428
+ }, /* @__PURE__ */ React.createElement("div", {
429
+ className: "px-4"
430
+ }, /* @__PURE__ */ React.createElement("div", {
431
+ className: "mx-auto my-8 border rounded-lg p-8 shadow-lg max-w-5xl mx-auto shadow-lg"
432
+ }, /* @__PURE__ */ React.createElement("div", {
433
+ className: "h-full overflow-scroll"
434
+ }, /* @__PURE__ */ React.createElement(Explorer, {
435
+ value: src,
436
+ renderRichText: ({
437
+ value,
438
+ keyName,
439
+ parentValue,
440
+ parentKeyName
441
+ }) => {
442
+ let fieldName = "";
443
+ if (!isNaN(Number(keyName))) {
444
+ fieldName = `${tinaField(parentValue, parentKeyName)}.${keyName}`;
445
+ } else {
446
+ fieldName = tinaField(parentValue, keyName);
447
+ }
448
+ const extraProps = {};
449
+ if (fieldName !== "undefined#undefined") {
450
+ if (fieldName && withDataTinaFieldState) {
451
+ extraProps["data-tina-field"] = fieldName;
452
+ }
453
+ }
454
+ return /* @__PURE__ */ React.createElement("div", {
455
+ className: "font-sans px-2 border-l-2 bg-gray-50 w-full prose",
456
+ ...extraProps
457
+ }, /* @__PURE__ */ React.createElement(TinaMarkdown, {
458
+ content: value
459
+ }));
460
+ },
461
+ renderValue: ({
462
+ value,
463
+ keyName,
464
+ parentValue,
465
+ parentKeyName
466
+ }) => {
467
+ let fieldName = "";
468
+ if (!isNaN(Number(keyName))) {
469
+ fieldName = `${tinaField(parentValue, parentKeyName)}.${keyName}`;
470
+ } else {
471
+ fieldName = tinaField(parentValue, keyName);
472
+ }
473
+ const extraProps = {};
474
+ if (fieldName !== "undefined#undefined") {
475
+ if (fieldName && withDataTinaFieldState) {
476
+ extraProps["data-tina-field"] = fieldName;
477
+ }
478
+ }
479
+ return /* @__PURE__ */ React.createElement("span", {
480
+ className: "text-orange-600",
481
+ ...extraProps
482
+ }, value);
483
+ }
484
+ }))))));
485
+ }
486
+ export { Explorer, Json };
@@ -0,0 +1,496 @@
1
+ (function(global, factory) {
2
+ typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("react")) : typeof define === "function" && define.amd ? define(["exports", "react"], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, factory(global.tinacms = {}, global.NOOP));
3
+ })(this, function(exports2, React) {
4
+ "use strict";
5
+ function _interopDefaultLegacy(e) {
6
+ return e && typeof e === "object" && "default" in e ? e : { "default": e };
7
+ }
8
+ var React__default = /* @__PURE__ */ _interopDefaultLegacy(React);
9
+ const TinaMarkdown = ({
10
+ content,
11
+ components = {}
12
+ }) => {
13
+ if (!content) {
14
+ return null;
15
+ }
16
+ const nodes = Array.isArray(content) ? content : content.children;
17
+ if (!nodes) {
18
+ return null;
19
+ }
20
+ return /* @__PURE__ */ React__default["default"].createElement(React__default["default"].Fragment, null, nodes.map((child, index) => {
21
+ return /* @__PURE__ */ React__default["default"].createElement(MemoNode, {
22
+ components,
23
+ key: index,
24
+ child
25
+ });
26
+ }));
27
+ };
28
+ const Leaf = (props) => {
29
+ if (props.bold) {
30
+ const { bold, ...rest } = props;
31
+ if (props.components.bold) {
32
+ const Component = props.components.bold;
33
+ return /* @__PURE__ */ React__default["default"].createElement(Component, null, /* @__PURE__ */ React__default["default"].createElement(Leaf, {
34
+ ...rest
35
+ }));
36
+ }
37
+ return /* @__PURE__ */ React__default["default"].createElement("strong", null, /* @__PURE__ */ React__default["default"].createElement(Leaf, {
38
+ ...rest
39
+ }));
40
+ }
41
+ if (props.italic) {
42
+ const { italic, ...rest } = props;
43
+ if (props.components.italic) {
44
+ const Component = props.components.italic;
45
+ return /* @__PURE__ */ React__default["default"].createElement(Component, null, /* @__PURE__ */ React__default["default"].createElement(Leaf, {
46
+ ...rest
47
+ }));
48
+ }
49
+ return /* @__PURE__ */ React__default["default"].createElement("em", null, /* @__PURE__ */ React__default["default"].createElement(Leaf, {
50
+ ...rest
51
+ }));
52
+ }
53
+ if (props.underline) {
54
+ const { underline, ...rest } = props;
55
+ if (props.components.underline) {
56
+ const Component = props.components.underline;
57
+ return /* @__PURE__ */ React__default["default"].createElement(Component, null, /* @__PURE__ */ React__default["default"].createElement(Leaf, {
58
+ ...rest
59
+ }));
60
+ }
61
+ return /* @__PURE__ */ React__default["default"].createElement("u", null, /* @__PURE__ */ React__default["default"].createElement(Leaf, {
62
+ ...rest
63
+ }));
64
+ }
65
+ if (props.strikethrough) {
66
+ const { strikethrough, ...rest } = props;
67
+ if (props.components.strikethrough) {
68
+ const Component = props.components.strikethrough;
69
+ return /* @__PURE__ */ React__default["default"].createElement(Component, null, /* @__PURE__ */ React__default["default"].createElement(Leaf, {
70
+ ...rest
71
+ }));
72
+ }
73
+ return /* @__PURE__ */ React__default["default"].createElement("s", null, /* @__PURE__ */ React__default["default"].createElement(Leaf, {
74
+ ...rest
75
+ }));
76
+ }
77
+ if (props.code) {
78
+ const { code, ...rest } = props;
79
+ if (props.components.code) {
80
+ const Component = props.components.code;
81
+ return /* @__PURE__ */ React__default["default"].createElement(Component, null, /* @__PURE__ */ React__default["default"].createElement(Leaf, {
82
+ ...rest
83
+ }));
84
+ }
85
+ return /* @__PURE__ */ React__default["default"].createElement("code", null, /* @__PURE__ */ React__default["default"].createElement(Leaf, {
86
+ ...rest
87
+ }));
88
+ }
89
+ if (props.components.text) {
90
+ const Component = props.components.text;
91
+ return /* @__PURE__ */ React__default["default"].createElement(Component, null, props.text);
92
+ }
93
+ return /* @__PURE__ */ React__default["default"].createElement(React__default["default"].Fragment, null, props.text);
94
+ };
95
+ const MemoNode = (props) => {
96
+ const MNode = React__default["default"].useMemo(() => /* @__PURE__ */ React__default["default"].createElement(Node, {
97
+ ...props
98
+ }), [JSON.stringify(props)]);
99
+ return MNode;
100
+ };
101
+ const Node = ({ components, child }) => {
102
+ const { children, ...props } = child;
103
+ switch (child.type) {
104
+ case "h1":
105
+ case "h2":
106
+ case "h3":
107
+ case "h4":
108
+ case "h5":
109
+ case "h6":
110
+ case "p":
111
+ case "blockquote":
112
+ case "ol":
113
+ case "ul":
114
+ case "li":
115
+ if (components[child.type]) {
116
+ const Component2 = components[child.type];
117
+ return /* @__PURE__ */ React__default["default"].createElement(Component2, {
118
+ ...props
119
+ }, /* @__PURE__ */ React__default["default"].createElement(TinaMarkdown, {
120
+ components,
121
+ content: children
122
+ }));
123
+ }
124
+ return React__default["default"].createElement(child.type, {
125
+ children: /* @__PURE__ */ React__default["default"].createElement(TinaMarkdown, {
126
+ components,
127
+ content: children
128
+ })
129
+ });
130
+ case "lic":
131
+ if (components.lic) {
132
+ const Component2 = components.lic;
133
+ return /* @__PURE__ */ React__default["default"].createElement(Component2, {
134
+ ...props
135
+ }, /* @__PURE__ */ React__default["default"].createElement(TinaMarkdown, {
136
+ components,
137
+ content: children
138
+ }));
139
+ }
140
+ return /* @__PURE__ */ React__default["default"].createElement("div", null, /* @__PURE__ */ React__default["default"].createElement(TinaMarkdown, {
141
+ components,
142
+ content: child.children
143
+ }));
144
+ case "img":
145
+ if (components[child.type]) {
146
+ const Component2 = components[child.type];
147
+ return /* @__PURE__ */ React__default["default"].createElement(Component2, {
148
+ ...props
149
+ });
150
+ }
151
+ return /* @__PURE__ */ React__default["default"].createElement("img", {
152
+ src: child.url,
153
+ alt: child.caption
154
+ });
155
+ case "a":
156
+ if (components[child.type]) {
157
+ const Component2 = components[child.type];
158
+ return /* @__PURE__ */ React__default["default"].createElement(Component2, {
159
+ ...props
160
+ }, /* @__PURE__ */ React__default["default"].createElement(TinaMarkdown, {
161
+ components,
162
+ content: children
163
+ }));
164
+ }
165
+ return /* @__PURE__ */ React__default["default"].createElement("a", {
166
+ href: child.url
167
+ }, /* @__PURE__ */ React__default["default"].createElement(TinaMarkdown, {
168
+ components,
169
+ content: children
170
+ }));
171
+ case "code_block":
172
+ const value = child.value;
173
+ if (components[child.type]) {
174
+ const Component2 = components[child.type];
175
+ return /* @__PURE__ */ React__default["default"].createElement(Component2, {
176
+ ...props
177
+ });
178
+ }
179
+ return /* @__PURE__ */ React__default["default"].createElement("pre", null, /* @__PURE__ */ React__default["default"].createElement("code", null, value));
180
+ case "hr":
181
+ if (components[child.type]) {
182
+ const Component2 = components[child.type];
183
+ return /* @__PURE__ */ React__default["default"].createElement(Component2, {
184
+ ...props
185
+ });
186
+ }
187
+ return /* @__PURE__ */ React__default["default"].createElement("hr", null);
188
+ case "break":
189
+ if (components[child.type]) {
190
+ const Component2 = components[child.type];
191
+ return /* @__PURE__ */ React__default["default"].createElement(Component2, {
192
+ ...props
193
+ });
194
+ }
195
+ return /* @__PURE__ */ React__default["default"].createElement("br", null);
196
+ case "text":
197
+ return /* @__PURE__ */ React__default["default"].createElement(Leaf, {
198
+ components,
199
+ ...child
200
+ });
201
+ case "mdxJsxTextElement":
202
+ case "mdxJsxFlowElement":
203
+ const Component = components[child.name];
204
+ if (Component) {
205
+ const props2 = child.props ? child.props : {};
206
+ return /* @__PURE__ */ React__default["default"].createElement(Component, {
207
+ ...props2
208
+ });
209
+ } else {
210
+ const ComponentMissing = components["component_missing"];
211
+ if (ComponentMissing) {
212
+ return /* @__PURE__ */ React__default["default"].createElement(ComponentMissing, {
213
+ name: child.name
214
+ });
215
+ } else {
216
+ return /* @__PURE__ */ React__default["default"].createElement("span", null, `No component provided for ${child.name}`);
217
+ }
218
+ }
219
+ case "maybe_mdx":
220
+ return null;
221
+ case "html":
222
+ case "html_inline":
223
+ if (components[child.type]) {
224
+ const Component2 = components[child.type];
225
+ return /* @__PURE__ */ React__default["default"].createElement(Component2, {
226
+ ...props
227
+ });
228
+ }
229
+ return child.value;
230
+ case "invalid_markdown":
231
+ return /* @__PURE__ */ React__default["default"].createElement("pre", null, child.value);
232
+ default:
233
+ if (typeof child.text === "string") {
234
+ return /* @__PURE__ */ React__default["default"].createElement(Leaf, {
235
+ components,
236
+ ...child
237
+ });
238
+ }
239
+ }
240
+ };
241
+ const tinaField = (object, property, index) => {
242
+ var _a, _b, _c;
243
+ if (!object) {
244
+ return "";
245
+ }
246
+ if (object._content_source) {
247
+ if (!property) {
248
+ return [
249
+ (_a = object._content_source) == null ? void 0 : _a.queryId,
250
+ object._content_source.path.join(".")
251
+ ].join("---");
252
+ }
253
+ if (typeof index === "number") {
254
+ return [
255
+ (_b = object._content_source) == null ? void 0 : _b.queryId,
256
+ [...object._content_source.path, property, index].join(".")
257
+ ].join("---");
258
+ }
259
+ return [
260
+ (_c = object._content_source) == null ? void 0 : _c.queryId,
261
+ [...object._content_source.path, property].join(".")
262
+ ].join("---");
263
+ }
264
+ return "";
265
+ };
266
+ const Explorer = (props) => {
267
+ return /* @__PURE__ */ React__default["default"].createElement("div", {
268
+ className: "font-mono"
269
+ }, /* @__PURE__ */ React__default["default"].createElement(ObjectValueRenderer, {
270
+ ...props
271
+ }));
272
+ };
273
+ const ObjectValueRenderer = (props) => {
274
+ const subEntries = Object.entries(props.value).map(([keyName, subValue]) => {
275
+ return /* @__PURE__ */ React__default["default"].createElement("div", {
276
+ key: keyName,
277
+ className: "gap-2"
278
+ }, /* @__PURE__ */ React__default["default"].createElement(UnknownRenderer, {
279
+ keyName,
280
+ value: subValue,
281
+ parentValue: props.value,
282
+ parentKeyName: props.parentKeyName,
283
+ renderValue: props.renderValue,
284
+ renderRichText: props.renderRichText,
285
+ showMetaFields: props.showMetaFields
286
+ }));
287
+ });
288
+ return /* @__PURE__ */ React__default["default"].createElement("div", null, subEntries);
289
+ };
290
+ const UnknownRenderer = ({
291
+ keyName,
292
+ value,
293
+ parentValue,
294
+ parentKeyName,
295
+ renderValue,
296
+ renderRichText,
297
+ showMetaFields
298
+ }) => {
299
+ const typeOfValue = typeof value;
300
+ const [expanded, setExpanded] = React__default["default"].useState((value == null ? void 0 : value.type) === "root" ? false : true);
301
+ if (!showMetaFields) {
302
+ if ([
303
+ "_sys",
304
+ "__typename",
305
+ "_internalValues",
306
+ "_internalSys"
307
+ ].includes(keyName)) {
308
+ return;
309
+ }
310
+ }
311
+ if (Array.isArray(value)) {
312
+ return /* @__PURE__ */ React__default["default"].createElement("div", null, /* @__PURE__ */ React__default["default"].createElement("button", {
313
+ onClick: () => setExpanded((exp) => !exp),
314
+ className: "min-w-[48px] flex justify-start gap-2"
315
+ }, keyName, ": ", "[", !expanded && `...]`), expanded && /* @__PURE__ */ React__default["default"].createElement("div", {
316
+ className: "pl-4"
317
+ }, value.map((item, index) => /* @__PURE__ */ React__default["default"].createElement(UnknownRenderer, {
318
+ key: String(index),
319
+ keyName: String(index),
320
+ value: item,
321
+ parentKeyName: keyName,
322
+ parentValue,
323
+ renderValue,
324
+ renderRichText
325
+ }))), expanded && /* @__PURE__ */ React__default["default"].createElement("div", null, "]"));
326
+ }
327
+ if (typeOfValue === "object") {
328
+ if ((value == null ? void 0 : value.type) === "root" && renderRichText) {
329
+ return /* @__PURE__ */ React__default["default"].createElement("div", {
330
+ className: "flex gap-2"
331
+ }, /* @__PURE__ */ React__default["default"].createElement("button", {
332
+ onClick: () => setExpanded((exp) => !exp),
333
+ className: "min-w-[48px] flex justify-start gap-2"
334
+ }, keyName, ": ", !expanded && "{...}"), /* @__PURE__ */ React__default["default"].createElement("div", null, expanded && renderRichText({ value, keyName, parentValue, parentKeyName })));
335
+ }
336
+ return /* @__PURE__ */ React__default["default"].createElement(ObjectRenderer, {
337
+ keyName,
338
+ value,
339
+ parentValue,
340
+ parentKeyName,
341
+ renderValue,
342
+ renderRichText
343
+ });
344
+ }
345
+ return /* @__PURE__ */ React__default["default"].createElement(Value, {
346
+ keyName,
347
+ value,
348
+ parentValue,
349
+ parentKeyName,
350
+ renderValue
351
+ });
352
+ };
353
+ const Value = ({
354
+ keyName,
355
+ value,
356
+ parentValue,
357
+ parentKeyName,
358
+ renderValue
359
+ }) => {
360
+ const keyDisplay = isNaN(Number(keyName)) ? `${keyName}: ` : ``;
361
+ return /* @__PURE__ */ React__default["default"].createElement("div", {
362
+ className: "flex gap-2"
363
+ }, /* @__PURE__ */ React__default["default"].createElement("div", null, keyDisplay), /* @__PURE__ */ React__default["default"].createElement("div", null, renderValue({ value, keyName, parentValue, parentKeyName })));
364
+ };
365
+ const ObjectRenderer = ({
366
+ keyName,
367
+ value,
368
+ parentValue,
369
+ parentKeyName,
370
+ renderValue,
371
+ renderRichText
372
+ }) => {
373
+ const { withDataTinaFieldState } = React.useContext(JsonContext);
374
+ const [showMetaFields, setShowMetaFields] = React__default["default"].useState(false);
375
+ const [expanded, setExpanded] = React__default["default"].useState(true);
376
+ const v = value;
377
+ const keyDisplay = isNaN(Number(keyName)) ? `${keyName}: ` : ``;
378
+ if (value === null) {
379
+ return /* @__PURE__ */ React__default["default"].createElement("div", null, /* @__PURE__ */ React__default["default"].createElement("div", {
380
+ className: "flex gap-2"
381
+ }, /* @__PURE__ */ React__default["default"].createElement("div", {
382
+ className: ""
383
+ }, keyDisplay), /* @__PURE__ */ React__default["default"].createElement("div", {
384
+ className: "text-gray-400"
385
+ }, "null")));
386
+ } else {
387
+ const fieldName = tinaField(v);
388
+ const extraProps = {};
389
+ if (fieldName !== "undefined#undefined" && withDataTinaFieldState) {
390
+ extraProps["data-tina-field"] = fieldName;
391
+ }
392
+ return /* @__PURE__ */ React__default["default"].createElement("div", null, /* @__PURE__ */ React__default["default"].createElement("div", {
393
+ className: "flex justify-between"
394
+ }, /* @__PURE__ */ React__default["default"].createElement("button", {
395
+ onClick: () => setExpanded((exp) => !exp),
396
+ className: "min-w-[48px] flex justify-start gap-2"
397
+ }, keyDisplay, "{", !expanded && `...}`), expanded && /* @__PURE__ */ React__default["default"].createElement("button", {
398
+ onClick: () => {
399
+ setShowMetaFields((show) => !show);
400
+ },
401
+ className: "min-w-[48px] text-sm text-gray-400"
402
+ }, showMetaFields ? "Hide meta fields" : "Show meta fields")), expanded && /* @__PURE__ */ React__default["default"].createElement("div", {
403
+ className: "pl-4",
404
+ ...extraProps
405
+ }, /* @__PURE__ */ React__default["default"].createElement(ObjectValueRenderer, {
406
+ value: v,
407
+ parentValue,
408
+ parentKeyName,
409
+ renderValue,
410
+ renderRichText,
411
+ showMetaFields
412
+ })), expanded && /* @__PURE__ */ React__default["default"].createElement("div", null, "}"));
413
+ }
414
+ };
415
+ const JsonContext = React__default["default"].createContext({ withDataTinaFieldState: true });
416
+ function Json({
417
+ src,
418
+ withDataTinaFieldState = true
419
+ }) {
420
+ const [isClient, setIsClient] = React.useState(false);
421
+ React.useEffect(() => {
422
+ setIsClient(true);
423
+ }, []);
424
+ if (!isClient) {
425
+ return null;
426
+ }
427
+ return /* @__PURE__ */ React__default["default"].createElement(React.Suspense, {
428
+ fallback: /* @__PURE__ */ React__default["default"].createElement("div", {
429
+ className: ""
430
+ }, "Loading...")
431
+ }, /* @__PURE__ */ React__default["default"].createElement(JsonContext.Provider, {
432
+ value: {
433
+ withDataTinaFieldState: withDataTinaFieldState === false ? false : true
434
+ }
435
+ }, /* @__PURE__ */ React__default["default"].createElement("div", {
436
+ className: "px-4"
437
+ }, /* @__PURE__ */ React__default["default"].createElement("div", {
438
+ className: "mx-auto my-8 border rounded-lg p-8 shadow-lg max-w-5xl mx-auto shadow-lg"
439
+ }, /* @__PURE__ */ React__default["default"].createElement("div", {
440
+ className: "h-full overflow-scroll"
441
+ }, /* @__PURE__ */ React__default["default"].createElement(Explorer, {
442
+ value: src,
443
+ renderRichText: ({
444
+ value,
445
+ keyName,
446
+ parentValue,
447
+ parentKeyName
448
+ }) => {
449
+ let fieldName = "";
450
+ if (!isNaN(Number(keyName))) {
451
+ fieldName = `${tinaField(parentValue, parentKeyName)}.${keyName}`;
452
+ } else {
453
+ fieldName = tinaField(parentValue, keyName);
454
+ }
455
+ const extraProps = {};
456
+ if (fieldName !== "undefined#undefined") {
457
+ if (fieldName && withDataTinaFieldState) {
458
+ extraProps["data-tina-field"] = fieldName;
459
+ }
460
+ }
461
+ return /* @__PURE__ */ React__default["default"].createElement("div", {
462
+ className: "font-sans px-2 border-l-2 bg-gray-50 w-full prose",
463
+ ...extraProps
464
+ }, /* @__PURE__ */ React__default["default"].createElement(TinaMarkdown, {
465
+ content: value
466
+ }));
467
+ },
468
+ renderValue: ({
469
+ value,
470
+ keyName,
471
+ parentValue,
472
+ parentKeyName
473
+ }) => {
474
+ let fieldName = "";
475
+ if (!isNaN(Number(keyName))) {
476
+ fieldName = `${tinaField(parentValue, parentKeyName)}.${keyName}`;
477
+ } else {
478
+ fieldName = tinaField(parentValue, keyName);
479
+ }
480
+ const extraProps = {};
481
+ if (fieldName !== "undefined#undefined") {
482
+ if (fieldName && withDataTinaFieldState) {
483
+ extraProps["data-tina-field"] = fieldName;
484
+ }
485
+ }
486
+ return /* @__PURE__ */ React__default["default"].createElement("span", {
487
+ className: "text-orange-600",
488
+ ...extraProps
489
+ }, value);
490
+ }
491
+ }))))));
492
+ }
493
+ exports2.Explorer = Explorer;
494
+ exports2.Json = Json;
495
+ Object.defineProperties(exports2, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
496
+ });
package/dist/index.es.js CHANGED
@@ -1621,6 +1621,10 @@ var styles = `.tina-tailwind {
1621
1621
  margin-left: auto;
1622
1622
  margin-right: auto;
1623
1623
  }
1624
+ .tina-tailwind .my-8 {
1625
+ margin-top: 32px;
1626
+ margin-bottom: 32px;
1627
+ }
1624
1628
  .tina-tailwind .-ml-px {
1625
1629
  margin-left: -1px;
1626
1630
  }
@@ -1738,9 +1742,15 @@ var styles = `.tina-tailwind {
1738
1742
  .tina-tailwind .min-w-\\[200px\\] {
1739
1743
  min-width: 200px;
1740
1744
  }
1745
+ .tina-tailwind .min-w-\\[48px\\] {
1746
+ min-width: 48px;
1747
+ }
1741
1748
  .tina-tailwind .max-w-0 {
1742
1749
  max-width: 0rem;
1743
1750
  }
1751
+ .tina-tailwind .max-w-5xl {
1752
+ max-width: 64rem;
1753
+ }
1744
1754
  .tina-tailwind .max-w-form {
1745
1755
  max-width: 900px;
1746
1756
  }
@@ -1872,6 +1882,9 @@ var styles = `.tina-tailwind {
1872
1882
  .tina-tailwind .overflow-hidden {
1873
1883
  overflow: hidden;
1874
1884
  }
1885
+ .tina-tailwind .overflow-scroll {
1886
+ overflow: scroll;
1887
+ }
1875
1888
  .tina-tailwind .overflow-y-auto {
1876
1889
  overflow-y: auto;
1877
1890
  }
@@ -1911,6 +1924,9 @@ var styles = `.tina-tailwind {
1911
1924
  .tina-tailwind .border-b {
1912
1925
  border-bottom-width: 1px;
1913
1926
  }
1927
+ .tina-tailwind .border-l-2 {
1928
+ border-left-width: 2px;
1929
+ }
1914
1930
  .tina-tailwind .border-r {
1915
1931
  border-right-width: 1px;
1916
1932
  }
@@ -1988,10 +2004,17 @@ var styles = `.tina-tailwind {
1988
2004
  .tina-tailwind .p-0 {
1989
2005
  padding: 0px;
1990
2006
  }
2007
+ .tina-tailwind .p-8 {
2008
+ padding: 32px;
2009
+ }
1991
2010
  .tina-tailwind .px-12 {
1992
2011
  padding-left: 48px;
1993
2012
  padding-right: 48px;
1994
2013
  }
2014
+ .tina-tailwind .px-2 {
2015
+ padding-left: 8px;
2016
+ padding-right: 8px;
2017
+ }
1995
2018
  .tina-tailwind .px-20 {
1996
2019
  padding-left: 80px;
1997
2020
  padding-right: 80px;
@@ -2050,6 +2073,9 @@ var styles = `.tina-tailwind {
2050
2073
  .tina-tailwind .pl-3 {
2051
2074
  padding-left: 12px;
2052
2075
  }
2076
+ .tina-tailwind .pl-4 {
2077
+ padding-left: 16px;
2078
+ }
2053
2079
  .tina-tailwind .pl-5 {
2054
2080
  padding-left: 20px;
2055
2081
  }
@@ -2077,6 +2103,9 @@ var styles = `.tina-tailwind {
2077
2103
  .tina-tailwind .text-center {
2078
2104
  text-align: center;
2079
2105
  }
2106
+ .tina-tailwind .font-mono {
2107
+ font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
2108
+ }
2080
2109
  .tina-tailwind .font-sans {
2081
2110
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
2082
2111
  }
@@ -2175,6 +2204,10 @@ var styles = `.tina-tailwind {
2175
2204
  --tw-text-opacity: 1;
2176
2205
  color: rgb(37 35 54 / var(--tw-text-opacity));
2177
2206
  }
2207
+ .tina-tailwind .text-orange-600 {
2208
+ --tw-text-opacity: 1;
2209
+ color: rgb(220 68 25 / var(--tw-text-opacity));
2210
+ }
2178
2211
  .tina-tailwind .text-red-400 {
2179
2212
  --tw-text-opacity: 1;
2180
2213
  color: rgb(248 113 113 / var(--tw-text-opacity));
@@ -3672,6 +3705,8 @@ const CollectionListPage = () => {
3672
3705
  }));
3673
3706
  setEndCursor("");
3674
3707
  setPrevCursors([]);
3708
+ setSearch("");
3709
+ setSearchInput("");
3675
3710
  }, [loc]);
3676
3711
  useEffect(() => {
3677
3712
  setVars((old) => ({
package/dist/index.js CHANGED
@@ -1636,6 +1636,10 @@ mutation addPendingDocumentMutation(
1636
1636
  margin-left: auto;
1637
1637
  margin-right: auto;
1638
1638
  }
1639
+ .tina-tailwind .my-8 {
1640
+ margin-top: 32px;
1641
+ margin-bottom: 32px;
1642
+ }
1639
1643
  .tina-tailwind .-ml-px {
1640
1644
  margin-left: -1px;
1641
1645
  }
@@ -1753,9 +1757,15 @@ mutation addPendingDocumentMutation(
1753
1757
  .tina-tailwind .min-w-\\[200px\\] {
1754
1758
  min-width: 200px;
1755
1759
  }
1760
+ .tina-tailwind .min-w-\\[48px\\] {
1761
+ min-width: 48px;
1762
+ }
1756
1763
  .tina-tailwind .max-w-0 {
1757
1764
  max-width: 0rem;
1758
1765
  }
1766
+ .tina-tailwind .max-w-5xl {
1767
+ max-width: 64rem;
1768
+ }
1759
1769
  .tina-tailwind .max-w-form {
1760
1770
  max-width: 900px;
1761
1771
  }
@@ -1887,6 +1897,9 @@ mutation addPendingDocumentMutation(
1887
1897
  .tina-tailwind .overflow-hidden {
1888
1898
  overflow: hidden;
1889
1899
  }
1900
+ .tina-tailwind .overflow-scroll {
1901
+ overflow: scroll;
1902
+ }
1890
1903
  .tina-tailwind .overflow-y-auto {
1891
1904
  overflow-y: auto;
1892
1905
  }
@@ -1926,6 +1939,9 @@ mutation addPendingDocumentMutation(
1926
1939
  .tina-tailwind .border-b {
1927
1940
  border-bottom-width: 1px;
1928
1941
  }
1942
+ .tina-tailwind .border-l-2 {
1943
+ border-left-width: 2px;
1944
+ }
1929
1945
  .tina-tailwind .border-r {
1930
1946
  border-right-width: 1px;
1931
1947
  }
@@ -2003,10 +2019,17 @@ mutation addPendingDocumentMutation(
2003
2019
  .tina-tailwind .p-0 {
2004
2020
  padding: 0px;
2005
2021
  }
2022
+ .tina-tailwind .p-8 {
2023
+ padding: 32px;
2024
+ }
2006
2025
  .tina-tailwind .px-12 {
2007
2026
  padding-left: 48px;
2008
2027
  padding-right: 48px;
2009
2028
  }
2029
+ .tina-tailwind .px-2 {
2030
+ padding-left: 8px;
2031
+ padding-right: 8px;
2032
+ }
2010
2033
  .tina-tailwind .px-20 {
2011
2034
  padding-left: 80px;
2012
2035
  padding-right: 80px;
@@ -2065,6 +2088,9 @@ mutation addPendingDocumentMutation(
2065
2088
  .tina-tailwind .pl-3 {
2066
2089
  padding-left: 12px;
2067
2090
  }
2091
+ .tina-tailwind .pl-4 {
2092
+ padding-left: 16px;
2093
+ }
2068
2094
  .tina-tailwind .pl-5 {
2069
2095
  padding-left: 20px;
2070
2096
  }
@@ -2092,6 +2118,9 @@ mutation addPendingDocumentMutation(
2092
2118
  .tina-tailwind .text-center {
2093
2119
  text-align: center;
2094
2120
  }
2121
+ .tina-tailwind .font-mono {
2122
+ font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
2123
+ }
2095
2124
  .tina-tailwind .font-sans {
2096
2125
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
2097
2126
  }
@@ -2190,6 +2219,10 @@ mutation addPendingDocumentMutation(
2190
2219
  --tw-text-opacity: 1;
2191
2220
  color: rgb(37 35 54 / var(--tw-text-opacity));
2192
2221
  }
2222
+ .tina-tailwind .text-orange-600 {
2223
+ --tw-text-opacity: 1;
2224
+ color: rgb(220 68 25 / var(--tw-text-opacity));
2225
+ }
2193
2226
  .tina-tailwind .text-red-400 {
2194
2227
  --tw-text-opacity: 1;
2195
2228
  color: rgb(248 113 113 / var(--tw-text-opacity));
@@ -3687,6 +3720,8 @@ This will work when developing locally but NOT when deployed to production.
3687
3720
  }));
3688
3721
  setEndCursor("");
3689
3722
  setPrevCursors([]);
3723
+ setSearch("");
3724
+ setSearchInput("");
3690
3725
  }, [loc]);
3691
3726
  React.useEffect(() => {
3692
3727
  setVars((old) => ({
package/dist/react.d.ts CHANGED
@@ -19,7 +19,7 @@ export declare const tinaField: <T extends object & {
19
19
  queryId: string;
20
20
  path: (number | string)[];
21
21
  };
22
- }>(object: T, property?: Exclude<keyof T, "__typename" | "_sys">, index?: number) => string;
22
+ }>(object: T, property?: Exclude<keyof NonNullable<T>, "__typename" | "_sys">, index?: number) => string;
23
23
  export declare const addMetadata: <T extends object>(id: string, object: T & {
24
24
  type?: string;
25
25
  _content_source?: unknown;
package/dist/react.es.js CHANGED
@@ -124,6 +124,9 @@ function useEditState() {
124
124
  }
125
125
  const tinaField = (object, property, index) => {
126
126
  var _a, _b, _c;
127
+ if (!object) {
128
+ return "";
129
+ }
127
130
  if (object._content_source) {
128
131
  if (!property) {
129
132
  return [
package/dist/react.js CHANGED
@@ -131,6 +131,9 @@
131
131
  }
132
132
  const tinaField = (object, property, index) => {
133
133
  var _a, _b, _c;
134
+ if (!object) {
135
+ return "";
136
+ }
134
137
  if (object._content_source) {
135
138
  if (!property) {
136
139
  return [
package/dist/style.css CHANGED
@@ -375,6 +375,10 @@
375
375
  margin-left: auto;
376
376
  margin-right: auto;
377
377
  }
378
+ .tina-tailwind .my-8 {
379
+ margin-top: 32px;
380
+ margin-bottom: 32px;
381
+ }
378
382
  .tina-tailwind .-ml-px {
379
383
  margin-left: -1px;
380
384
  }
@@ -492,9 +496,15 @@
492
496
  .tina-tailwind .min-w-\[200px\] {
493
497
  min-width: 200px;
494
498
  }
499
+ .tina-tailwind .min-w-\[48px\] {
500
+ min-width: 48px;
501
+ }
495
502
  .tina-tailwind .max-w-0 {
496
503
  max-width: 0rem;
497
504
  }
505
+ .tina-tailwind .max-w-5xl {
506
+ max-width: 64rem;
507
+ }
498
508
  .tina-tailwind .max-w-form {
499
509
  max-width: 900px;
500
510
  }
@@ -626,6 +636,9 @@
626
636
  .tina-tailwind .overflow-hidden {
627
637
  overflow: hidden;
628
638
  }
639
+ .tina-tailwind .overflow-scroll {
640
+ overflow: scroll;
641
+ }
629
642
  .tina-tailwind .overflow-y-auto {
630
643
  overflow-y: auto;
631
644
  }
@@ -665,6 +678,9 @@
665
678
  .tina-tailwind .border-b {
666
679
  border-bottom-width: 1px;
667
680
  }
681
+ .tina-tailwind .border-l-2 {
682
+ border-left-width: 2px;
683
+ }
668
684
  .tina-tailwind .border-r {
669
685
  border-right-width: 1px;
670
686
  }
@@ -742,10 +758,17 @@
742
758
  .tina-tailwind .p-0 {
743
759
  padding: 0px;
744
760
  }
761
+ .tina-tailwind .p-8 {
762
+ padding: 32px;
763
+ }
745
764
  .tina-tailwind .px-12 {
746
765
  padding-left: 48px;
747
766
  padding-right: 48px;
748
767
  }
768
+ .tina-tailwind .px-2 {
769
+ padding-left: 8px;
770
+ padding-right: 8px;
771
+ }
749
772
  .tina-tailwind .px-20 {
750
773
  padding-left: 80px;
751
774
  padding-right: 80px;
@@ -804,6 +827,9 @@
804
827
  .tina-tailwind .pl-3 {
805
828
  padding-left: 12px;
806
829
  }
830
+ .tina-tailwind .pl-4 {
831
+ padding-left: 16px;
832
+ }
807
833
  .tina-tailwind .pl-5 {
808
834
  padding-left: 20px;
809
835
  }
@@ -831,6 +857,9 @@
831
857
  .tina-tailwind .text-center {
832
858
  text-align: center;
833
859
  }
860
+ .tina-tailwind .font-mono {
861
+ font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
862
+ }
834
863
  .tina-tailwind .font-sans {
835
864
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
836
865
  }
@@ -929,6 +958,10 @@
929
958
  --tw-text-opacity: 1;
930
959
  color: rgb(37 35 54 / var(--tw-text-opacity));
931
960
  }
961
+ .tina-tailwind .text-orange-600 {
962
+ --tw-text-opacity: 1;
963
+ color: rgb(220 68 25 / var(--tw-text-opacity));
964
+ }
932
965
  .tina-tailwind .text-red-400 {
933
966
  --tw-text-opacity: 1;
934
967
  color: rgb(248 113 113 / var(--tw-text-opacity));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tinacms",
3
- "version": "1.5.10",
3
+ "version": "1.5.11",
4
4
  "main": "dist/index.js",
5
5
  "module": "./dist/index.es.js",
6
6
  "exports": {
@@ -29,6 +29,11 @@
29
29
  "import": "./dist/rich-text/index.es.js",
30
30
  "require": "./dist/rich-text/index.js"
31
31
  },
32
+ "./dist/dev-tools": {
33
+ "types": "./dist/dev-tools.d.ts",
34
+ "import": "./dist/dev-tools.es.js",
35
+ "require": "./dist/dev-tools.js"
36
+ },
32
37
  "./dist/rich-text/prism": {
33
38
  "types": "./dist/rich-text/prism.d.ts",
34
39
  "import": "./dist/rich-text/prism.es.js",
@@ -45,7 +50,8 @@
45
50
  "src/rich-text/index.tsx",
46
51
  "src/rich-text/prism.tsx",
47
52
  "src/react.tsx",
48
- "src/client.ts"
53
+ "src/client.ts",
54
+ "src/dev-tools.tsx"
49
55
  ]
50
56
  },
51
57
  "typings": "dist/index.d.ts",
@@ -56,10 +62,10 @@
56
62
  "@headlessui/react": "^1.5.0",
57
63
  "@heroicons/react": "^1.0.4",
58
64
  "@react-hook/window-size": "^3.0.7",
59
- "@tinacms/search": "1.0.2",
60
- "@tinacms/schema-tools": "1.4.6",
65
+ "@tinacms/search": "1.0.3",
66
+ "@tinacms/schema-tools": "1.4.7",
61
67
  "@tinacms/sharedctx": "1.0.1",
62
- "@tinacms/toolkit": "1.7.6",
68
+ "@tinacms/toolkit": "1.7.7",
63
69
  "crypto-js": "^4.0.0",
64
70
  "encoding": "0.1.13",
65
71
  "fetch-ponyfill": "^7.1.0",