tinacms 2.10.1 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/dist/__vite-browser-external-d06ac358.js +4 -0
  2. package/dist/admin/api.d.ts +1 -1
  3. package/dist/client.js +131 -185
  4. package/dist/index.js +118242 -118350
  5. package/dist/internalClient/index.d.ts +1 -1
  6. package/dist/{node-cache-5e8db9f0.mjs → node-cache-c9558e1e.js} +5 -5
  7. package/dist/react.js +210 -213
  8. package/dist/rich-text/index.js +234 -237
  9. package/dist/rich-text/prism.js +16 -18
  10. package/dist/rich-text/static.js +229 -232
  11. package/dist/toolkit/components/ui/button.d.ts +11 -0
  12. package/dist/toolkit/components/ui/calendar.d.ts +8 -0
  13. package/dist/toolkit/components/ui/date-time-picker.d.ts +111 -0
  14. package/dist/toolkit/components/ui/input.d.ts +3 -0
  15. package/dist/toolkit/components/ui/popover.d.ts +7 -0
  16. package/dist/toolkit/components/ui/select.d.ts +13 -0
  17. package/dist/toolkit/fields/plugins/button-toggle-field-plugin.d.ts +2 -2
  18. package/dist/toolkit/fields/plugins/checkbox-group-field-plugin.d.ts +2 -2
  19. package/dist/toolkit/fields/plugins/date-field-plugin.d.ts +0 -2
  20. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/components/plate-ui/blockquote-element.d.ts +1 -1
  21. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/components/plate-ui/code-block/code-block-element.d.ts +1 -1
  22. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/components/plate-ui/code-line-element.d.ts +1 -1
  23. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/components/plate-ui/list-element.d.ts +2 -2
  24. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/components/plate-ui/paragraph-element.d.ts +1 -1
  25. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/components/plate-ui/slash-input-element.d.ts +1 -1
  26. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/components/plate-ui/table/table-cell-element.d.ts +2 -2
  27. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/components/plate-ui/table/table-element.d.ts +1 -1
  28. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/components/plate-ui/table/table-row-element.d.ts +1 -1
  29. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/components/plate-ui/use-floating-toolbar-hook.d.ts +1 -1
  30. package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/plugins/ui/components.d.ts +18 -18
  31. package/dist/toolkit/fields/plugins/radio-group-field-plugin.d.ts +2 -2
  32. package/dist/toolkit/fields/plugins/select-field-plugin.d.ts +2 -2
  33. package/dist/toolkit/fields/plugins/toggle-field-plugin.d.ts +2 -2
  34. package/package.json +20 -43
  35. package/dist/client.mjs +0 -132
  36. package/dist/index.mjs +0 -123232
  37. package/dist/react.mjs +0 -254
  38. package/dist/rich-text/index.mjs +0 -256
  39. package/dist/rich-text/prism.mjs +0 -16
  40. package/dist/rich-text/static.mjs +0 -243
  41. package/dist/toolkit/react-datetime/DateTime.d.ts +0 -135
@@ -1,243 +0,0 @@
1
- import React from "react";
2
- const StaticTinaMarkdown = ({
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(Node, { components, key: index, child });
15
- }));
16
- };
17
- const Leaf = (props) => {
18
- let el = /* @__PURE__ */ React.createElement(React.Fragment, null, props.text);
19
- if (props.components.text) {
20
- const Component = props.components.text;
21
- el = /* @__PURE__ */ React.createElement(Component, null, props.text);
22
- }
23
- if (props.bold) {
24
- const Component = props.components.bold || "strong";
25
- el = /* @__PURE__ */ React.createElement(Component, null, el);
26
- }
27
- if (props.italic) {
28
- const Component = props.components.italic || "em";
29
- el = /* @__PURE__ */ React.createElement(Component, null, el);
30
- }
31
- if (props.underline) {
32
- const Component = props.components.underline || "u";
33
- el = /* @__PURE__ */ React.createElement(Component, null, el);
34
- }
35
- if (props.strikethrough) {
36
- const Component = props.components.strikethrough || "s";
37
- el = /* @__PURE__ */ React.createElement(Component, null, el);
38
- }
39
- if (props.code) {
40
- const Component = props.components.code || "code";
41
- el = /* @__PURE__ */ React.createElement(Component, null, el);
42
- }
43
- return el;
44
- };
45
- const Node = ({
46
- components,
47
- child
48
- }) => {
49
- var _a, _b, _c, _d, _e, _f, _g;
50
- const { children, ...props } = child;
51
- switch (child.type) {
52
- case "h1":
53
- case "h2":
54
- case "h3":
55
- case "h4":
56
- case "h5":
57
- case "h6":
58
- case "p":
59
- case "ol":
60
- case "ul":
61
- case "li":
62
- if (components[child.type]) {
63
- const Component2 = components[child.type];
64
- return /* @__PURE__ */ React.createElement(Component2, { ...props }, /* @__PURE__ */ React.createElement(StaticTinaMarkdown, { components, content: children }));
65
- }
66
- return React.createElement(child.type, {
67
- children: /* @__PURE__ */ React.createElement(StaticTinaMarkdown, { components, content: children })
68
- });
69
- case "blockquote":
70
- const BlockquoteComponent = components.blockquote || components.block_quote;
71
- if (BlockquoteComponent) {
72
- return /* @__PURE__ */ React.createElement(BlockquoteComponent, { ...props }, /* @__PURE__ */ React.createElement(StaticTinaMarkdown, { components, content: children }));
73
- }
74
- return React.createElement("blockquote", {
75
- children: /* @__PURE__ */ React.createElement(StaticTinaMarkdown, { components, content: children })
76
- });
77
- case "lic":
78
- if (components.lic) {
79
- const Component2 = components.lic;
80
- return /* @__PURE__ */ React.createElement(Component2, { ...props }, /* @__PURE__ */ React.createElement(StaticTinaMarkdown, { components, content: children }));
81
- }
82
- return /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement(
83
- StaticTinaMarkdown,
84
- {
85
- components,
86
- content: child.children
87
- }
88
- ));
89
- case "img":
90
- if (components[child.type]) {
91
- const Component2 = components[child.type];
92
- return /* @__PURE__ */ React.createElement(Component2, { ...props });
93
- }
94
- return /* @__PURE__ */ React.createElement("img", { src: child.url, alt: child.alt });
95
- case "a":
96
- if (components[child.type]) {
97
- const Component2 = components[child.type];
98
- return (
99
- //@ts-ignore Same issue with TinaMarkdown
100
- /* @__PURE__ */ React.createElement(Component2, { ...props }, /* @__PURE__ */ React.createElement(StaticTinaMarkdown, { components, content: children }))
101
- );
102
- }
103
- return /* @__PURE__ */ React.createElement("a", { href: child.url }, /* @__PURE__ */ React.createElement(StaticTinaMarkdown, { components, content: children }));
104
- case "code_block": {
105
- let codeString = "";
106
- if (Array.isArray(child.children)) {
107
- codeString = child.children.map(
108
- (line) => Array.isArray(line.children) ? line.children.map((t) => t.text).join("") : ""
109
- ).join("\n");
110
- } else if (typeof child.value === "string") {
111
- codeString = child.value;
112
- }
113
- if (components[child.type]) {
114
- const Component2 = components[child.type];
115
- return /* @__PURE__ */ React.createElement(Component2, { ...props, value: codeString });
116
- }
117
- return /* @__PURE__ */ React.createElement("pre", null, /* @__PURE__ */ React.createElement("code", null, codeString));
118
- }
119
- case "hr":
120
- if (components[child.type]) {
121
- const Component2 = components[child.type];
122
- return /* @__PURE__ */ React.createElement(Component2, { ...props });
123
- }
124
- return /* @__PURE__ */ React.createElement("hr", null);
125
- case "break":
126
- if (components[child.type]) {
127
- const Component2 = components[child.type];
128
- return /* @__PURE__ */ React.createElement(Component2, { ...props });
129
- }
130
- return /* @__PURE__ */ React.createElement("br", null);
131
- case "text":
132
- return /* @__PURE__ */ React.createElement(Leaf, { components, ...child });
133
- case "mdxJsxTextElement":
134
- case "mdxJsxFlowElement":
135
- const Component = components[child.name];
136
- if (Component) {
137
- const props2 = child.props ? child.props : {};
138
- return /* @__PURE__ */ React.createElement(Component, { ...props2 });
139
- } else {
140
- if (child.name === "table") {
141
- const firstRowHeader = (_a = child.props) == null ? void 0 : _a.firstRowHeader;
142
- const rows2 = (firstRowHeader ? (_b = child.props) == null ? void 0 : _b.tableRows.filter((_, i) => i !== 0) : (_c = child.props) == null ? void 0 : _c.tableRows) || [];
143
- const header = (_e = (_d = child.props) == null ? void 0 : _d.tableRows) == null ? void 0 : _e.at(0);
144
- const TableComponent2 = (
145
- //@ts-ignore Same issue with TinaMarkdown
146
- components["table"] || ((props2) => /* @__PURE__ */ React.createElement("table", { ...props2 }))
147
- );
148
- const TrComponent2 = components["tr"] || ((props2) => /* @__PURE__ */ React.createElement("tr", { ...props2 }));
149
- const ThComponent = components["th"] || ((props2) => /* @__PURE__ */ React.createElement("th", { style: { textAlign: (props2 == null ? void 0 : props2.align) || "auto" }, ...props2 }));
150
- const TdComponent2 = components["td"] || ((props2) => /* @__PURE__ */ React.createElement("td", { style: { textAlign: (props2 == null ? void 0 : props2.align) || "auto" }, ...props2 }));
151
- const align2 = ((_f = child.props) == null ? void 0 : _f.align) || [];
152
- return (
153
- //@ts-ignore Same issue with TinaMarkdown
154
- /* @__PURE__ */ React.createElement(TableComponent2, null, firstRowHeader && /* @__PURE__ */ React.createElement("thead", null, /* @__PURE__ */ React.createElement(TrComponent2, null, header.tableCells.map((c, i) => {
155
- return /* @__PURE__ */ React.createElement(
156
- StaticTinaMarkdown,
157
- {
158
- key: i,
159
- components: {
160
- p: (props2) => /* @__PURE__ */ React.createElement(ThComponent, { align: align2[i], ...props2 })
161
- },
162
- content: c.value
163
- }
164
- );
165
- }))), /* @__PURE__ */ React.createElement("tbody", null, rows2.map((row, i) => {
166
- var _a2;
167
- return /* @__PURE__ */ React.createElement(TrComponent2, { key: i }, (_a2 = row == null ? void 0 : row.tableCells) == null ? void 0 : _a2.map((c, i2) => {
168
- return /* @__PURE__ */ React.createElement(
169
- StaticTinaMarkdown,
170
- {
171
- key: i2,
172
- components: {
173
- p: (props2) => /* @__PURE__ */ React.createElement(TdComponent2, { align: align2[i2], ...props2 })
174
- },
175
- content: c.value
176
- }
177
- );
178
- }));
179
- })))
180
- );
181
- }
182
- const ComponentMissing = components["component_missing"];
183
- if (ComponentMissing) {
184
- return /* @__PURE__ */ React.createElement(ComponentMissing, { name: child.name });
185
- } else {
186
- return /* @__PURE__ */ React.createElement("span", null, `No component provided for ${child.name}`);
187
- }
188
- }
189
- case "table":
190
- const rows = child.children || [];
191
- const TableComponent = components["table"] || ((props2) => /* @__PURE__ */ React.createElement("table", { style: { border: "1px solid #EDECF3" }, ...props2 }));
192
- const TrComponent = components["tr"] || ((props2) => /* @__PURE__ */ React.createElement("tr", { ...props2 }));
193
- const TdComponent = components["td"] || ((props2) => /* @__PURE__ */ React.createElement(
194
- "td",
195
- {
196
- style: {
197
- textAlign: (props2 == null ? void 0 : props2.align) || "auto",
198
- border: "1px solid #EDECF3",
199
- padding: "0.25rem"
200
- },
201
- ...props2
202
- }
203
- ));
204
- const align = ((_g = child.props) == null ? void 0 : _g.align) || [];
205
- return (
206
- //@ts-ignore Same issue with TinaMarkdown
207
- /* @__PURE__ */ React.createElement(TableComponent, null, /* @__PURE__ */ React.createElement("tbody", null, rows.map((row, i) => {
208
- var _a2;
209
- return /* @__PURE__ */ React.createElement(TrComponent, { key: i }, (_a2 = row.children) == null ? void 0 : _a2.map((cell, i2) => {
210
- return /* @__PURE__ */ React.createElement(
211
- StaticTinaMarkdown,
212
- {
213
- key: i2,
214
- components: {
215
- p: (props2) => /* @__PURE__ */ React.createElement(TdComponent, { align: align[i2], ...props2 })
216
- },
217
- content: cell.children
218
- }
219
- );
220
- }));
221
- })))
222
- );
223
- case "maybe_mdx":
224
- return null;
225
- case "html":
226
- case "html_inline":
227
- if (components[child.type]) {
228
- const Component2 = components[child.type];
229
- return /* @__PURE__ */ React.createElement(Component2, { ...props });
230
- }
231
- return child.value;
232
- case "invalid_markdown":
233
- return /* @__PURE__ */ React.createElement("pre", null, child.value);
234
- default:
235
- if (typeof child.text === "string") {
236
- return /* @__PURE__ */ React.createElement(Leaf, { components, ...child });
237
- }
238
- return null;
239
- }
240
- };
241
- export {
242
- StaticTinaMarkdown
243
- };
@@ -1,135 +0,0 @@
1
- export default class Datetime extends React.Component<any, any, any> {
2
- static propTypes: {
3
- value: PropTypes.Requireable<NonNullable<string | Date>>;
4
- initialValue: PropTypes.Requireable<NonNullable<string | Date>>;
5
- initialViewDate: PropTypes.Requireable<NonNullable<string | Date>>;
6
- initialViewMode: PropTypes.Requireable<string>;
7
- onOpen: PropTypes.Requireable<(...args: any[]) => any>;
8
- onClose: PropTypes.Requireable<(...args: any[]) => any>;
9
- onChange: PropTypes.Requireable<(...args: any[]) => any>;
10
- onNavigate: PropTypes.Requireable<(...args: any[]) => any>;
11
- onBeforeNavigate: PropTypes.Requireable<(...args: any[]) => any>;
12
- onNavigateBack: PropTypes.Requireable<(...args: any[]) => any>;
13
- onNavigateForward: PropTypes.Requireable<(...args: any[]) => any>;
14
- updateOnView: PropTypes.Requireable<string>;
15
- locale: PropTypes.Requireable<string>;
16
- utc: PropTypes.Requireable<boolean>;
17
- displayTimeZone: PropTypes.Requireable<string>;
18
- input: PropTypes.Requireable<boolean>;
19
- dateFormat: PropTypes.Requireable<NonNullable<string | boolean>>;
20
- timeFormat: PropTypes.Requireable<NonNullable<string | boolean>>;
21
- inputProps: PropTypes.Requireable<object>;
22
- timeConstraints: PropTypes.Requireable<object>;
23
- isValidDate: PropTypes.Requireable<(...args: any[]) => any>;
24
- open: PropTypes.Requireable<boolean>;
25
- strictParsing: PropTypes.Requireable<boolean>;
26
- closeOnSelect: PropTypes.Requireable<boolean>;
27
- closeOnTab: PropTypes.Requireable<boolean>;
28
- renderView: PropTypes.Requireable<(...args: any[]) => any>;
29
- renderInput: PropTypes.Requireable<(...args: any[]) => any>;
30
- renderDay: PropTypes.Requireable<(...args: any[]) => any>;
31
- renderMonth: PropTypes.Requireable<(...args: any[]) => any>;
32
- renderYear: PropTypes.Requireable<(...args: any[]) => any>;
33
- };
34
- static defaultProps: {
35
- onOpen: () => void;
36
- onClose: () => void;
37
- onCalendarOpen: () => void;
38
- onCalendarClose: () => void;
39
- onChange: () => void;
40
- onNavigate: () => void;
41
- onBeforeNavigate: (next: any) => any;
42
- onNavigateBack: () => void;
43
- onNavigateForward: () => void;
44
- dateFormat: boolean;
45
- timeFormat: boolean;
46
- utc: boolean;
47
- className: string;
48
- input: boolean;
49
- inputProps: {};
50
- timeConstraints: {};
51
- isValidDate: () => boolean;
52
- strictParsing: boolean;
53
- closeOnSelect: boolean;
54
- closeOnTab: boolean;
55
- closeOnClickOutside: boolean;
56
- renderView: (_: any, renderFunc: any) => any;
57
- };
58
- static moment: typeof moment;
59
- constructor(props: any);
60
- state: {
61
- open: boolean;
62
- currentView: any;
63
- viewDate: any;
64
- selectedDate: any;
65
- inputValue: any;
66
- };
67
- render(): React.JSX.Element;
68
- renderInput(): React.JSX.Element;
69
- renderView(): any;
70
- _renderCalendar: () => React.JSX.Element;
71
- getInitialState(): {
72
- open: boolean;
73
- currentView: any;
74
- viewDate: any;
75
- selectedDate: any;
76
- inputValue: any;
77
- };
78
- getInitialViewDate(selectedDate: any): any;
79
- getInitialDate(): any;
80
- getInitialView(): any;
81
- parseDate(date: any, dateFormat: any): any;
82
- getClassName(): string;
83
- isOpen(): any;
84
- getUpdateOn(dateFormat: any): any;
85
- getLocaleData(): any;
86
- getDateFormat(): any;
87
- getTimeFormat(): any;
88
- getFormat(type: any): any;
89
- _showView: (view: any, date: any) => void;
90
- updateTime(op: any, amount: any, type: any, toSelected: any): void;
91
- viewToMethod: {
92
- days: string;
93
- months: string;
94
- years: string;
95
- };
96
- nextView: {
97
- days: string;
98
- months: string;
99
- years: string;
100
- };
101
- _updateDate: (e: any) => void;
102
- _viewNavigate: (modifier: any, unit: any) => void;
103
- _setTime: (type: any, value: any) => void;
104
- _openCalendar: () => void;
105
- _closeCalendar: () => void;
106
- _handleClickOutside: () => void;
107
- localMoment(date: any, format: any, props: any): any;
108
- checkTZ(): void;
109
- tzWarning: boolean;
110
- componentDidUpdate(prevProps: any): void;
111
- regenerateDates(): void;
112
- getSelectedDate(): any;
113
- getInitialInputValue(selectedDate: any): any;
114
- getInputValue(): any;
115
- /**
116
- * Set the date that is currently shown in the calendar.
117
- * This is independent from the selected date and it's the one used to navigate through months or days in the calendar.
118
- * @param dateType date
119
- * @public
120
- */
121
- public setViewDate(date: any): void;
122
- /**
123
- * Set the view currently shown by the calendar. View modes shipped with react-datetime are 'years', 'months', 'days' and 'time'.
124
- * @param TYPES.string mode
125
- */
126
- navigate(mode: any): void;
127
- _onInputFocus: (e: any) => void;
128
- _onInputChange: (e: any) => void;
129
- _onInputKeyDown: (e: any) => void;
130
- _onInputClick: (e: any) => void;
131
- callHandler(method: any, e: any): boolean;
132
- }
133
- import React from 'react';
134
- import PropTypes from 'prop-types';
135
- import moment from 'moment';