tinacms 2.2.5 → 2.2.7
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.
- package/README.md +78 -3
- package/dist/__vite-browser-external-d06ac358.mjs +4 -0
- package/dist/admin/pages/CollectionCreatePage.d.ts +2 -1
- package/dist/cache/node-cache.d.ts +1 -1
- package/dist/client.js +65 -3
- package/dist/client.mjs +16 -3
- package/dist/index.js +110 -64
- package/dist/index.mjs +112 -66
- package/dist/node-cache-7fa2452c.mjs +43 -0
- package/dist/unifiedClient/index.d.ts +3 -0
- package/package.json +21 -17
- package/dist/cache.js +0 -36
- package/dist/cache.mjs +0 -32
package/README.md
CHANGED
|
@@ -1,4 +1,79 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
[](https://github.com/tinacms/tinacms/blob/main/LICENSE)
|
|
2
|
+
[](https://www.npmjs.com/package/tinacms)
|
|
3
|
+
[](https://github.com/tinacms/tinacms/actions/workflows/main.yml)
|
|
3
4
|
|
|
4
|
-
[
|
|
5
|
+
# [](https://tina.io)
|
|
6
|
+
|
|
7
|
+
[](https://tina.io/)
|
|
8
|
+
|
|
9
|
+
Tina is a headless content management system with support for **Markdown**, MDX, JSON, YAML, and more.
|
|
10
|
+
|
|
11
|
+
It comes with a GraphQL API:
|
|
12
|
+
|
|
13
|
+
- Query your Markdown content like this 👉 `post.author.firstName`
|
|
14
|
+
- Supports statically generated and server side rendered pages
|
|
15
|
+
- Supports references between documents
|
|
16
|
+
|
|
17
|
+
Tina offers a live preview (optional and opt-in) that makes editing Markdown files very intuitive for less-technical people.
|
|
18
|
+
|
|
19
|
+
## Getting Started
|
|
20
|
+
|
|
21
|
+
Test a TinaCMS starter site locally
|
|
22
|
+
|
|
23
|
+
```
|
|
24
|
+
npx create-tina-app@latest
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
Or try a [demo site](https://app.tina.io/quickstart) on Tina Cloud.
|
|
28
|
+
|
|
29
|
+
## Documentation
|
|
30
|
+
|
|
31
|
+
Visit [Tina's documentation](https://tina.io/docs/) to learn more.
|
|
32
|
+
|
|
33
|
+
## Questions?
|
|
34
|
+
|
|
35
|
+
[](https://twitter.com/intent/tweet?url=https%3A%2F%2Ftinacms.org&text=I%20just%20checked%20out%20@tinacms%20on%20GitHub%20and%20it%20is%20sweet%21&hashtags=TinaCMS%2Cjamstack%2Cheadlesscms)
|
|
36
|
+
[](https://github.com/tinacms/tinacms/discussions)
|
|
37
|
+
|
|
38
|
+
Visit the [GitHub Discussions](https://github.com/tinacms/tinacms/discussions) or our [Community Discord](https://discord.com/invite/zumN63Ybpf) to ask questions, or look us up on on Twitter at [@tinacms](https://twitter.com/tinacms).
|
|
39
|
+
|
|
40
|
+
<!-- ## Changelog
|
|
41
|
+
|
|
42
|
+
Check the [CHANGELOG](./CHANGELOG.md) for the latest updates to TinaCMS. -->
|
|
43
|
+
|
|
44
|
+
## Vision
|
|
45
|
+
|
|
46
|
+
To be the world-leading CMS with Git support that developers love.
|
|
47
|
+
|
|
48
|
+
## Tech Stack
|
|
49
|
+
|
|
50
|
+
See
|
|
51
|
+
https://tina.io/docs/introduction/faq/#what-is-tinas-tech-stack
|
|
52
|
+
|
|
53
|
+
## Roadmap
|
|
54
|
+
|
|
55
|
+
Our development priorities can be read on our [Public Roadmap](https://tina.io/roadmap/).
|
|
56
|
+
|
|
57
|
+
## Contributing
|
|
58
|
+
|
|
59
|
+
Please see our [./CONTRIBUTING.md](https://github.com/tinacms/tinacms/blob/main/CONTRIBUTING.md)
|
|
60
|
+
|
|
61
|
+
### Maintainers
|
|
62
|
+
|
|
63
|
+
- Kelly Davis ([@kldavis](https://github.com/kldavis4))
|
|
64
|
+
- Jeff See ([@jeffsee55](https://github.com/jeffsee55))
|
|
65
|
+
- Matt Wicks ([@wicksipedia](https://github.com/wicksipedia))
|
|
66
|
+
- Jack Pettit ([@JackDevAU](https://github.com/JackDevAU))
|
|
67
|
+
- Jord Gui ([@Jord-Gui](https://github.com/Jord-Gui))
|
|
68
|
+
- Nick Curran ([@ncn-ssw](https://github.com/ncn-ssw))
|
|
69
|
+
- Brook Jeynes ([@brookjeynes-ssw](https://github.com/brookjeynes-ssw))
|
|
70
|
+
- Ben Neoh ([@Ben0189](https://github.com/Ben0189))
|
|
71
|
+
- Warwick Leahy ([@leahy268](https://github.com/leahy268))
|
|
72
|
+
- Seth Daily ([@sethdaily ](https://github.com/sethdaily))
|
|
73
|
+
- Josh Berman ([@joshbermanssw](https://github.com/joshbermanssw))
|
|
74
|
+
- Scott Gallant ([@scottgallant](https://github.com/scottgallant))
|
|
75
|
+
- Adam Cogan ([@adamcogan](https://github.com/adamcogan))
|
|
76
|
+
|
|
77
|
+
View our awesome SSW devs at [ssw.com.au/people](https://www.ssw.com.au/people/?skill=%F0%9F%A6%99-TinaCMS).
|
|
78
|
+
|
|
79
|
+

|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { Collection } from '@tinacms/schema-tools';
|
|
2
3
|
import type { TinaCMS } from '@tinacms/toolkit';
|
|
3
4
|
declare const CollectionCreatePage: () => React.JSX.Element;
|
|
4
5
|
export declare const RenderForm: ({ cms, collection, folder, templateName, mutationInfo, customDefaults, }: {
|
|
5
6
|
cms: TinaCMS;
|
|
6
|
-
collection:
|
|
7
|
+
collection: Collection;
|
|
7
8
|
folder: any;
|
|
8
9
|
templateName: any;
|
|
9
10
|
mutationInfo: any;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { Cache } from './index';
|
|
2
|
-
export declare const NodeCache: (dir: string
|
|
2
|
+
export declare const NodeCache: (dir: string) => Promise<Cache>;
|
package/dist/client.js
CHANGED
|
@@ -14,17 +14,30 @@
|
|
|
14
14
|
errorPolicy,
|
|
15
15
|
cacheDir
|
|
16
16
|
}) {
|
|
17
|
+
this.initialized = false;
|
|
17
18
|
this.apiUrl = url;
|
|
18
19
|
this.readonlyToken = token == null ? void 0 : token.trim();
|
|
19
20
|
this.queries = queries(this);
|
|
20
21
|
this.errorPolicy = errorPolicy || "throw";
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
this.cacheDir = cacheDir || "";
|
|
23
|
+
}
|
|
24
|
+
async init() {
|
|
25
|
+
if (this.initialized) {
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
try {
|
|
29
|
+
if (this.cacheDir && window === void 0 && typeof require !== "undefined") {
|
|
30
|
+
const { NodeCache: NodeCache2 } = await Promise.resolve().then(() => nodeCache);
|
|
31
|
+
this.cache = await NodeCache2(this.cacheDir);
|
|
32
|
+
}
|
|
33
|
+
} catch (e) {
|
|
34
|
+
console.error(e);
|
|
24
35
|
}
|
|
36
|
+
this.initialized = true;
|
|
25
37
|
}
|
|
26
38
|
async request({ errorPolicy, ...args }, options) {
|
|
27
39
|
var _a;
|
|
40
|
+
await this.init();
|
|
28
41
|
const errorPolicyDefined = errorPolicy || this.errorPolicy;
|
|
29
42
|
const headers = new HeadersDefined();
|
|
30
43
|
if (this.readonlyToken) {
|
|
@@ -92,6 +105,55 @@
|
|
|
92
105
|
const client = new TinaClient(args);
|
|
93
106
|
return client;
|
|
94
107
|
}
|
|
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);
|
|
112
|
+
let cacheDir = dir;
|
|
113
|
+
if (!fs.existsSync(path.join(path.sep, parts[0]))) {
|
|
114
|
+
cacheDir = path.join(os.tmpdir(), parts[parts.length - 1]);
|
|
115
|
+
}
|
|
116
|
+
fs.mkdirSync(cacheDir, { recursive: true });
|
|
117
|
+
return cacheDir;
|
|
118
|
+
};
|
|
119
|
+
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);
|
|
123
|
+
return {
|
|
124
|
+
makeKey: (key) => {
|
|
125
|
+
const input = key && key instanceof Object ? JSON.stringify(key) : key || "";
|
|
126
|
+
return createHash("sha256").update(input).digest("hex");
|
|
127
|
+
},
|
|
128
|
+
get: async (key) => {
|
|
129
|
+
try {
|
|
130
|
+
const data = await fs.promises.readFile(`${cacheDir}/${key}`, "utf-8");
|
|
131
|
+
return JSON.parse(data);
|
|
132
|
+
} catch (e) {
|
|
133
|
+
if (e.code === "ENOENT") {
|
|
134
|
+
return void 0;
|
|
135
|
+
}
|
|
136
|
+
throw e;
|
|
137
|
+
}
|
|
138
|
+
},
|
|
139
|
+
set: async (key, value) => {
|
|
140
|
+
await fs.promises.writeFile(
|
|
141
|
+
`${cacheDir}/${key}`,
|
|
142
|
+
JSON.stringify(value),
|
|
143
|
+
"utf-8"
|
|
144
|
+
);
|
|
145
|
+
}
|
|
146
|
+
};
|
|
147
|
+
};
|
|
148
|
+
const nodeCache = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
149
|
+
__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
|
|
156
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
95
157
|
exports2.TINA_HOST = TINA_HOST;
|
|
96
158
|
exports2.TinaClient = TinaClient;
|
|
97
159
|
exports2.createClient = createClient;
|
package/dist/client.mjs
CHANGED
|
@@ -11,17 +11,30 @@ class TinaClient {
|
|
|
11
11
|
errorPolicy,
|
|
12
12
|
cacheDir
|
|
13
13
|
}) {
|
|
14
|
+
this.initialized = false;
|
|
14
15
|
this.apiUrl = url;
|
|
15
16
|
this.readonlyToken = token == null ? void 0 : token.trim();
|
|
16
17
|
this.queries = queries(this);
|
|
17
18
|
this.errorPolicy = errorPolicy || "throw";
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
this.cacheDir = cacheDir || "";
|
|
20
|
+
}
|
|
21
|
+
async init() {
|
|
22
|
+
if (this.initialized) {
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
try {
|
|
26
|
+
if (this.cacheDir && window === void 0 && typeof require !== "undefined") {
|
|
27
|
+
const { NodeCache } = await import("./node-cache-7fa2452c.mjs");
|
|
28
|
+
this.cache = await NodeCache(this.cacheDir);
|
|
29
|
+
}
|
|
30
|
+
} catch (e) {
|
|
31
|
+
console.error(e);
|
|
21
32
|
}
|
|
33
|
+
this.initialized = true;
|
|
22
34
|
}
|
|
23
35
|
async request({ errorPolicy, ...args }, options) {
|
|
24
36
|
var _a;
|
|
37
|
+
await this.init();
|
|
25
38
|
const errorPolicyDefined = errorPolicy || this.errorPolicy;
|
|
26
39
|
const headers = new HeadersDefined();
|
|
27
40
|
if (this.readonlyToken) {
|
package/dist/index.js
CHANGED
|
@@ -1859,7 +1859,6 @@ var __publicField = (obj, key, value) => {
|
|
|
1859
1859
|
/* @__PURE__ */ React.createElement(
|
|
1860
1860
|
react$1.Transition,
|
|
1861
1861
|
{
|
|
1862
|
-
as: React.Fragment,
|
|
1863
1862
|
enter: "transition ease-out duration-100",
|
|
1864
1863
|
enterFrom: "transform opacity-0 scale-95",
|
|
1865
1864
|
enterTo: "transform opacity-100 scale-100",
|
|
@@ -3348,6 +3347,9 @@ var __publicField = (obj, key, value) => {
|
|
|
3348
3347
|
function BiCopy(props) {
|
|
3349
3348
|
return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "d": "M20 2H10c-1.103 0-2 .897-2 2v4H4c-1.103 0-2 .897-2 2v10c0 1.103.897 2 2 2h10c1.103 0 2-.897 2-2v-4h4c1.103 0 2-.897 2-2V4c0-1.103-.897-2-2-2zM4 20V10h10l.002 10H4zm16-6h-4v-4c0-1.103-.897-2-2-2h-4V4h10v10z" }, "child": [] }] })(props);
|
|
3350
3349
|
}
|
|
3350
|
+
function BiDotsVertical(props) {
|
|
3351
|
+
return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "d": "M10 10h4v4h-4zm0-6h4v4h-4zm0 12h4v4h-4z" }, "child": [] }] })(props);
|
|
3352
|
+
}
|
|
3351
3353
|
function BiEdit(props) {
|
|
3352
3354
|
return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "d": "m7 17.013 4.413-.015 9.632-9.54c.378-.378.586-.88.586-1.414s-.208-1.036-.586-1.414l-1.586-1.586c-.756-.756-2.075-.752-2.825-.003L7 12.583v4.43zM18.045 4.458l1.589 1.583-1.597 1.582-1.586-1.585 1.594-1.58zM9 13.417l6.03-5.973 1.586 1.586-6.029 5.971L9 15.006v-1.589z" }, "child": [] }, { "tag": "path", "attr": { "d": "M5 21h14c1.103 0 2-.897 2-2v-8.668l-2 2V19H8.158c-.026 0-.053.01-.079.01-.033 0-.066-.009-.1-.01H5V5h6.847l2-2H5c-1.103 0-2 .897-2 2v14c0 1.103.897 2 2 2z" }, "child": [] }] })(props);
|
|
3353
3355
|
}
|
|
@@ -5305,7 +5307,6 @@ var __publicField = (obj, key, value) => {
|
|
|
5305
5307
|
), /* @__PURE__ */ React__namespace.createElement(FormPortal, null, ({ zIndexShift }) => /* @__PURE__ */ React__namespace.createElement(react$1.Transition, { show: pickerIsOpen }, /* @__PURE__ */ React__namespace.createElement(
|
|
5306
5308
|
react$1.TransitionChild,
|
|
5307
5309
|
{
|
|
5308
|
-
as: React__namespace.Fragment,
|
|
5309
5310
|
enter: "transform transition-all ease-out duration-200",
|
|
5310
5311
|
enterFrom: "opacity-0 -translate-x-1/2",
|
|
5311
5312
|
enterTo: "opacity-100 translate-x-0",
|
|
@@ -5398,7 +5399,7 @@ var __publicField = (obj, key, value) => {
|
|
|
5398
5399
|
className: `left-0 right-0 relative`
|
|
5399
5400
|
},
|
|
5400
5401
|
({ open: open2 }) => /* @__PURE__ */ React__namespace.createElement(React__namespace.Fragment, null, /* @__PURE__ */ React__namespace.createElement(
|
|
5401
|
-
react$1.
|
|
5402
|
+
react$1.DisclosureButton,
|
|
5402
5403
|
{
|
|
5403
5404
|
className: `relative block group text-left w-full text-base font-bold tracking-wide py-2 truncate ${templates.length === 0 ? `pointer-events-none` : ``} ${!isLast && (!open2 || templates.length === 0) && `border-b border-gray-100`}`
|
|
5404
5405
|
},
|
|
@@ -9243,11 +9244,12 @@ var __publicField = (obj, key, value) => {
|
|
|
9243
9244
|
};
|
|
9244
9245
|
const FormLists = (props) => {
|
|
9245
9246
|
const cms = useCMS();
|
|
9246
|
-
return /* @__PURE__ */ React__namespace.createElement(
|
|
9247
|
+
return /* @__PURE__ */ React__namespace.createElement(
|
|
9247
9248
|
react$1.Transition,
|
|
9248
9249
|
{
|
|
9249
9250
|
appear: true,
|
|
9250
9251
|
show: true,
|
|
9252
|
+
as: "div",
|
|
9251
9253
|
enter: "transition-all ease-out duration-150",
|
|
9252
9254
|
enterFrom: "opacity-0 -translate-x-1/2",
|
|
9253
9255
|
enterTo: "opacity-100",
|
|
@@ -9265,7 +9267,7 @@ var __publicField = (obj, key, value) => {
|
|
|
9265
9267
|
formList
|
|
9266
9268
|
}
|
|
9267
9269
|
)))
|
|
9268
|
-
)
|
|
9270
|
+
);
|
|
9269
9271
|
};
|
|
9270
9272
|
const FormList = (props) => {
|
|
9271
9273
|
const cms = useCMS();
|
|
@@ -9388,19 +9390,46 @@ var __publicField = (obj, key, value) => {
|
|
|
9388
9390
|
}
|
|
9389
9391
|
}
|
|
9390
9392
|
},
|
|
9393
|
+
/* @__PURE__ */ React__namespace.createElement(BiDotsVertical, { className: "h-auto w-5 inline-block opacity-70" })
|
|
9394
|
+
), /* @__PURE__ */ React__namespace.createElement(
|
|
9395
|
+
"button",
|
|
9396
|
+
{
|
|
9397
|
+
type: "button",
|
|
9398
|
+
className: "pointer-events-auto text-xs text-blue-400 hover:text-blue-500 hover:underline transition-all ease-out duration-150",
|
|
9399
|
+
onClick: () => {
|
|
9400
|
+
const collectionName = cms.api.tina.schema.getCollectionByFullPath(
|
|
9401
|
+
cms.state.activeFormId
|
|
9402
|
+
).name;
|
|
9403
|
+
window.location.href = `${new URL(window.location.href).pathname}#/collections/${collectionName}/~`;
|
|
9404
|
+
}
|
|
9405
|
+
},
|
|
9391
9406
|
/* @__PURE__ */ React__namespace.createElement(BiHomeAlt, { className: "h-auto w-5 inline-block opacity-70" })
|
|
9392
9407
|
), /* @__PURE__ */ React__namespace.createElement("span", { className: "opacity-30 text-sm leading-tight whitespace-nowrap flex-0" }, "/"), /* @__PURE__ */ React__namespace.createElement("span", { className: "block w-full text-sm leading-tight whitespace-nowrap truncate" }, activeForm.tinaForm.label || activeForm.tinaForm.id), /* @__PURE__ */ React__namespace.createElement(FormStatus, { pristine: formIsPristine }))
|
|
9393
9408
|
);
|
|
9394
9409
|
};
|
|
9395
9410
|
const FormHeader = ({ activeForm }) => {
|
|
9396
9411
|
const { formIsPristine } = React__namespace.useContext(SidebarContext);
|
|
9412
|
+
const cms = useCMS$1();
|
|
9397
9413
|
const shortFormLabel = activeForm.tinaForm.label ? activeForm.tinaForm.label.replace(/^.*[\\\/]/, "") : false;
|
|
9398
9414
|
return /* @__PURE__ */ React__namespace.createElement(
|
|
9399
9415
|
"div",
|
|
9400
9416
|
{
|
|
9401
9417
|
className: "pt-18 pb-4 px-6 border-b border-gray-200 bg-gradient-to-t from-white to-gray-50"
|
|
9402
9418
|
},
|
|
9403
|
-
/* @__PURE__ */ React__namespace.createElement("div", { className: "max-w-form mx-auto flex gap-2 justify-between items-center" },
|
|
9419
|
+
/* @__PURE__ */ React__namespace.createElement("div", { className: "max-w-form mx-auto flex gap-2 justify-between items-center" }, /* @__PURE__ */ React__namespace.createElement(
|
|
9420
|
+
"button",
|
|
9421
|
+
{
|
|
9422
|
+
type: "button",
|
|
9423
|
+
className: "pointer-events-auto text-xs text-blue-400 hover:text-blue-500 hover:underline transition-all ease-out duration-150",
|
|
9424
|
+
onClick: () => {
|
|
9425
|
+
const collectionName = cms.api.tina.schema.getCollectionByFullPath(
|
|
9426
|
+
cms.state.activeFormId
|
|
9427
|
+
).name;
|
|
9428
|
+
window.location.href = `${new URL(window.location.href).pathname}#/collections/${collectionName}/~`;
|
|
9429
|
+
}
|
|
9430
|
+
},
|
|
9431
|
+
/* @__PURE__ */ React__namespace.createElement(BiHomeAlt, { className: "h-auto w-5 inline-block opacity-70" })
|
|
9432
|
+
), shortFormLabel && /* @__PURE__ */ React__namespace.createElement("span", { className: "block w-full text-sm leading-tight whitespace-nowrap truncate" }, shortFormLabel), /* @__PURE__ */ React__namespace.createElement(FormStatus, { pristine: formIsPristine }))
|
|
9404
9433
|
);
|
|
9405
9434
|
};
|
|
9406
9435
|
function ImFilesEmpty(props) {
|
|
@@ -9645,6 +9674,7 @@ var __publicField = (obj, key, value) => {
|
|
|
9645
9674
|
"Event Log"
|
|
9646
9675
|
));
|
|
9647
9676
|
};
|
|
9677
|
+
const version = "2.2.6";
|
|
9648
9678
|
const Nav = ({
|
|
9649
9679
|
isLocalMode,
|
|
9650
9680
|
className = "",
|
|
@@ -9774,7 +9804,7 @@ var __publicField = (obj, key, value) => {
|
|
|
9774
9804
|
))))),
|
|
9775
9805
|
eventsOpen && /* @__PURE__ */ React__namespace.createElement(SyncStatusModal, { cms, closeEventsModal }),
|
|
9776
9806
|
children,
|
|
9777
|
-
/* @__PURE__ */ React__namespace.createElement("div", { className: "px-6 flex-1 overflow-auto" }, showCollections && /* @__PURE__ */ React__namespace.createElement(React__namespace.Fragment, null, /* @__PURE__ */ React__namespace.createElement("h4", { className: "flex space-x-1 justify-items-start uppercase font-sans font-bold text-sm mb-3 mt-8 text-gray-700" }, /* @__PURE__ */ React__namespace.createElement("span", null, "Collections"), isLocalMode && /* @__PURE__ */ React__namespace.createElement("span", { className: "flex items-center" }, /* @__PURE__ */ React__namespace.createElement(
|
|
9807
|
+
/* @__PURE__ */ React__namespace.createElement("div", { className: "flex flex-col px-6 flex-1 overflow-auto" }, showCollections && /* @__PURE__ */ React__namespace.createElement(React__namespace.Fragment, null, /* @__PURE__ */ React__namespace.createElement("h4", { className: "flex space-x-1 justify-items-start uppercase font-sans font-bold text-sm mb-3 mt-8 text-gray-700" }, /* @__PURE__ */ React__namespace.createElement("span", null, "Collections"), isLocalMode && /* @__PURE__ */ React__namespace.createElement("span", { className: "flex items-center" }, /* @__PURE__ */ React__namespace.createElement(
|
|
9778
9808
|
"a",
|
|
9779
9809
|
{
|
|
9780
9810
|
href: "https://tina.io/docs/schema/#defining-collections",
|
|
@@ -9805,7 +9835,7 @@ var __publicField = (obj, key, value) => {
|
|
|
9805
9835
|
}
|
|
9806
9836
|
}), !!(cloudConfigs == null ? void 0 : cloudConfigs.length) && /* @__PURE__ */ React__namespace.createElement(React__namespace.Fragment, null, /* @__PURE__ */ React__namespace.createElement("h4", { className: "uppercase font-sans font-bold text-sm mb-3 mt-8 text-gray-700" }, "Cloud"), /* @__PURE__ */ React__namespace.createElement("ul", { className: "flex flex-col gap-4" }, cloudConfigs.map((config) => {
|
|
9807
9837
|
return /* @__PURE__ */ React__namespace.createElement("li", { key: `nav-site-${config.name}` }, /* @__PURE__ */ React__namespace.createElement(RenderNavCloud, { config }));
|
|
9808
|
-
}))))
|
|
9838
|
+
}))), /* @__PURE__ */ React__namespace.createElement("div", { className: "grow" }), /* @__PURE__ */ React__namespace.createElement("span", { className: "font-sans font-light text-xs mb-3 mt-8 text-gray-500" }, "v", version))
|
|
9809
9839
|
);
|
|
9810
9840
|
};
|
|
9811
9841
|
const CollectionsList = ({
|
|
@@ -10110,10 +10140,9 @@ var __publicField = (obj, key, value) => {
|
|
|
10110
10140
|
screen: activeScreen,
|
|
10111
10141
|
close: () => setActiveView(null)
|
|
10112
10142
|
}
|
|
10113
|
-
)), /* @__PURE__ */ React__namespace.createElement(ResizeHandle, null)), renderMobileNav && /* @__PURE__ */ React__namespace.createElement(react$1.Transition, { show: menuIsOpen }, /* @__PURE__ */ React__namespace.createElement(
|
|
10143
|
+
)), /* @__PURE__ */ React__namespace.createElement(ResizeHandle, null)), renderMobileNav && /* @__PURE__ */ React__namespace.createElement(react$1.Transition, { show: menuIsOpen, as: "div" }, /* @__PURE__ */ React__namespace.createElement(
|
|
10114
10144
|
react$1.TransitionChild,
|
|
10115
10145
|
{
|
|
10116
|
-
as: React__namespace.Fragment,
|
|
10117
10146
|
enter: "transform transition-all ease-out duration-300",
|
|
10118
10147
|
enterFrom: "opacity-0 -translate-x-full",
|
|
10119
10148
|
enterTo: "opacity-100 translate-x-0",
|
|
@@ -10179,7 +10208,6 @@ var __publicField = (obj, key, value) => {
|
|
|
10179
10208
|
), /* @__PURE__ */ React__namespace.createElement(
|
|
10180
10209
|
react$1.TransitionChild,
|
|
10181
10210
|
{
|
|
10182
|
-
as: React__namespace.Fragment,
|
|
10183
10211
|
enter: "ease-out duration-300",
|
|
10184
10212
|
enterFrom: "opacity-0",
|
|
10185
10213
|
enterTo: "opacity-80",
|
|
@@ -12723,7 +12751,6 @@ var __publicField = (obj, key, value) => {
|
|
|
12723
12751
|
), /* @__PURE__ */ React.createElement(
|
|
12724
12752
|
react$1.Transition,
|
|
12725
12753
|
{
|
|
12726
|
-
as: React.Fragment,
|
|
12727
12754
|
enter: "transition ease-out duration-100",
|
|
12728
12755
|
enterFrom: "transform opacity-0 scale-95",
|
|
12729
12756
|
enterTo: "transform opacity-100 scale-100",
|
|
@@ -13872,12 +13899,29 @@ var __publicField = (obj, key, value) => {
|
|
|
13872
13899
|
}
|
|
13873
13900
|
const EmbedButton = ({ editor, templates }) => {
|
|
13874
13901
|
const [open2, setOpen] = React.useState(false);
|
|
13902
|
+
const [filteredTemplates, setFilteredTemplates] = React.useState(templates);
|
|
13903
|
+
const filterChange = (e) => {
|
|
13904
|
+
const filterText = e.target.value.toLowerCase();
|
|
13905
|
+
setFilteredTemplates(
|
|
13906
|
+
templates.filter(
|
|
13907
|
+
(template) => template.name.toLowerCase().includes(filterText)
|
|
13908
|
+
)
|
|
13909
|
+
);
|
|
13910
|
+
};
|
|
13875
13911
|
return /* @__PURE__ */ React.createElement(DropdownMenu, { open: open2, onOpenChange: setOpen }, /* @__PURE__ */ React.createElement(DropdownMenuTrigger, { className: "inline-flex items-center rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg:not([data-icon])]:size-5 h-9 px-2 bg-transparent hover:bg-muted hover:text-muted-foreground aria-checked:bg-accent aria-checked:text-accent-foreground my-1 justify-between pr-1" }, /* @__PURE__ */ React.createElement("span", { className: "flex" }, "Embed"), /* @__PURE__ */ React.createElement(
|
|
13876
13912
|
PlusIcon,
|
|
13877
13913
|
{
|
|
13878
13914
|
className: `origin-center transition-all ease-out duration-150 ${open2 ? "rotate-45" : ""}`
|
|
13879
13915
|
}
|
|
13880
|
-
)), /* @__PURE__ */ React.createElement(DropdownMenuContent,
|
|
13916
|
+
)), /* @__PURE__ */ React.createElement(DropdownMenuContent, { className: "max-h-48 overflow-y-auto" }, templates.length > 10 && /* @__PURE__ */ React.createElement(
|
|
13917
|
+
"input",
|
|
13918
|
+
{
|
|
13919
|
+
type: "text",
|
|
13920
|
+
placeholder: "Filter templates...",
|
|
13921
|
+
className: "w-full p-2 border border-gray-300 rounded-md",
|
|
13922
|
+
onChange: filterChange
|
|
13923
|
+
}
|
|
13924
|
+
), /* @__PURE__ */ React.createElement(DropdownMenuSeparator, null), filteredTemplates.map((template) => /* @__PURE__ */ React.createElement(
|
|
13881
13925
|
DropdownMenuItem,
|
|
13882
13926
|
{
|
|
13883
13927
|
key: template.name,
|
|
@@ -30501,7 +30545,6 @@ This will work when developing locally but NOT when deployed to production.
|
|
|
30501
30545
|
), !renderDesktopNav && /* @__PURE__ */ React.createElement(react$1.Transition, { show: menuIsOpen }, /* @__PURE__ */ React.createElement(
|
|
30502
30546
|
react$1.TransitionChild,
|
|
30503
30547
|
{
|
|
30504
|
-
as: React.Fragment,
|
|
30505
30548
|
enter: "transform transition-all ease-out duration-300",
|
|
30506
30549
|
enterFrom: "opacity-0 -translate-x-full",
|
|
30507
30550
|
enterTo: "opacity-100 translate-x-0",
|
|
@@ -30571,7 +30614,6 @@ This will work when developing locally but NOT when deployed to production.
|
|
|
30571
30614
|
), /* @__PURE__ */ React.createElement(
|
|
30572
30615
|
react$1.TransitionChild,
|
|
30573
30616
|
{
|
|
30574
|
-
as: React.Fragment,
|
|
30575
30617
|
enter: "ease-out duration-300",
|
|
30576
30618
|
enterFrom: "opacity-0",
|
|
30577
30619
|
enterTo: "opacity-80",
|
|
@@ -31027,7 +31069,6 @@ This will work when developing locally but NOT when deployed to production.
|
|
|
31027
31069
|
return /* @__PURE__ */ React.createElement(react$1.Menu, { as: "div", className: "relative inline-block text-left" }, () => /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement(react$1.MenuButton, { className: "icon-parent inline-flex items-center font-medium focus:outline-none focus:ring-2 focus:shadow-outline text-center rounded-full justify-center transition-all duration-150 ease-out shadow text-white bg-blue-500 hover:bg-blue-600 focus:ring-blue-500 text-sm h-10 px-6" }, "Create New ", /* @__PURE__ */ React.createElement(BiPlus, { className: "w-5 h-full ml-1 opacity-70" }))), /* @__PURE__ */ React.createElement(
|
|
31028
31070
|
react$1.Transition,
|
|
31029
31071
|
{
|
|
31030
|
-
as: React.Fragment,
|
|
31031
31072
|
enter: "transition ease-out duration-100",
|
|
31032
31073
|
enterFrom: "transform opacity-0 scale-95",
|
|
31033
31074
|
enterTo: "transform opacity-100 scale-100",
|
|
@@ -31035,7 +31076,7 @@ This will work when developing locally but NOT when deployed to production.
|
|
|
31035
31076
|
leaveFrom: "transform opacity-100 scale-100",
|
|
31036
31077
|
leaveTo: "transform opacity-0 scale-95"
|
|
31037
31078
|
},
|
|
31038
|
-
/* @__PURE__ */ React.createElement(react$1.MenuItems, { className: "origin-top-right absolute right-0 mt-2 z-menu w-56 rounded-md shadow-lg bg-white ring-1 ring-black ring-opacity-5 focus:outline-none" }, /* @__PURE__ */ React.createElement("div", { className: "py-1" }, templates.map((template) => /* @__PURE__ */ React.createElement(react$1.MenuItem, { key: `${template.label}-${template.name}` }, ({
|
|
31079
|
+
/* @__PURE__ */ React.createElement(react$1.MenuItems, { className: "origin-top-right absolute right-0 mt-2 z-menu w-56 rounded-md shadow-lg bg-white ring-1 ring-black ring-opacity-5 focus:outline-none" }, /* @__PURE__ */ React.createElement("div", { className: "py-1" }, templates.map((template) => /* @__PURE__ */ React.createElement(react$1.MenuItem, { key: `${template.label}-${template.name}` }, ({ focus }) => /* @__PURE__ */ React.createElement(
|
|
31039
31080
|
reactRouterDom.Link,
|
|
31040
31081
|
{
|
|
31041
31082
|
to: `/${folder.fullyQualifiedName ? [
|
|
@@ -31051,7 +31092,7 @@ This will work when developing locally but NOT when deployed to production.
|
|
|
31051
31092
|
collectionName,
|
|
31052
31093
|
template.name
|
|
31053
31094
|
].join("/")}`,
|
|
31054
|
-
className: `w-full text-md px-4 py-2 tracking-wide flex items-center transition ease-out duration-100 ${
|
|
31095
|
+
className: `w-full text-md px-4 py-2 tracking-wide flex items-center transition ease-out duration-100 ${focus ? "text-blue-600 opacity-100 bg-gray-50" : "opacity-80 text-gray-600"}`
|
|
31055
31096
|
},
|
|
31056
31097
|
template.label
|
|
31057
31098
|
)))))
|
|
@@ -31942,7 +31983,7 @@ This will work when developing locally but NOT when deployed to production.
|
|
|
31942
31983
|
mutationInfo,
|
|
31943
31984
|
customDefaults
|
|
31944
31985
|
}) => {
|
|
31945
|
-
var _a, _b, _c, _d, _e, _f;
|
|
31986
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
31946
31987
|
const navigate = reactRouterDom.useNavigate();
|
|
31947
31988
|
const [formIsPristine, setFormIsPristine] = React.useState(true);
|
|
31948
31989
|
const schema = cms.api.tina.schema;
|
|
@@ -31972,8 +32013,53 @@ This will work when developing locally but NOT when deployed to production.
|
|
|
31972
32013
|
const defaultItem2 = customDefaults || // @ts-ignore internal types aren't up to date
|
|
31973
32014
|
((_d = template.ui) == null ? void 0 : _d.defaultItem) || // @ts-ignore
|
|
31974
32015
|
(template == null ? void 0 : template.defaultItem) || {};
|
|
32016
|
+
const filenameField = {
|
|
32017
|
+
name: "filename",
|
|
32018
|
+
label: "Filename",
|
|
32019
|
+
component: slugFunction ? wrapFieldsWithMeta(({ field, input, meta }) => {
|
|
32020
|
+
var _a2, _b2;
|
|
32021
|
+
return /* @__PURE__ */ React.createElement(
|
|
32022
|
+
FilenameInput,
|
|
32023
|
+
{
|
|
32024
|
+
readOnly: (_b2 = (_a2 = schemaCollection == null ? void 0 : schemaCollection.ui) == null ? void 0 : _a2.filename) == null ? void 0 : _b2.readonly,
|
|
32025
|
+
...input
|
|
32026
|
+
}
|
|
32027
|
+
);
|
|
32028
|
+
}) : "text",
|
|
32029
|
+
disabled: (_f = (_e = schemaCollection == null ? void 0 : schemaCollection.ui) == null ? void 0 : _e.filename) == null ? void 0 : _f.readonly,
|
|
32030
|
+
description: ((_h = (_g = collection.ui) == null ? void 0 : _g.filename) == null ? void 0 : _h.description) ? /* @__PURE__ */ React.createElement(
|
|
32031
|
+
"span",
|
|
32032
|
+
{
|
|
32033
|
+
dangerouslySetInnerHTML: { __html: collection.ui.filename.description }
|
|
32034
|
+
}
|
|
32035
|
+
) : /* @__PURE__ */ React.createElement("span", null, "A unique filename for the content.", /* @__PURE__ */ React.createElement("br", null), "Examples: ", /* @__PURE__ */ React.createElement("code", null, "My_Document"), ", ", /* @__PURE__ */ React.createElement("code", null, "My_Document.en"), ",", " ", /* @__PURE__ */ React.createElement("code", null, "sub-folder/My_Document")),
|
|
32036
|
+
placeholder: "My_Document",
|
|
32037
|
+
validate: (value, allValues, meta) => {
|
|
32038
|
+
var _a2, _b2;
|
|
32039
|
+
if (!value) {
|
|
32040
|
+
if (meta.dirty) {
|
|
32041
|
+
return "Required";
|
|
32042
|
+
}
|
|
32043
|
+
return true;
|
|
32044
|
+
}
|
|
32045
|
+
const isValid = /[\.\-_\/a-zA-Z0-9]*$/.test(value);
|
|
32046
|
+
if (value && !isValid) {
|
|
32047
|
+
return "Must contain only a-z, A-Z, 0-9, -, _, ., or /.";
|
|
32048
|
+
}
|
|
32049
|
+
if (((_a2 = schemaCollection.match) == null ? void 0 : _a2.exclude) || ((_b2 = schemaCollection.match) == null ? void 0 : _b2.include)) {
|
|
32050
|
+
const filePath = `${schemaTools.normalizePath(schemaCollection.path)}/${value}.${schemaCollection.format || "md"}`;
|
|
32051
|
+
const match = schema == null ? void 0 : schema.matchFiles({
|
|
32052
|
+
files: [filePath],
|
|
32053
|
+
collection: schemaCollection
|
|
32054
|
+
});
|
|
32055
|
+
if ((match == null ? void 0 : match.length) === 0) {
|
|
32056
|
+
return `The filename "${value}" is not allowed for this collection.`;
|
|
32057
|
+
}
|
|
32058
|
+
}
|
|
32059
|
+
}
|
|
32060
|
+
};
|
|
31975
32061
|
const form = React.useMemo(() => {
|
|
31976
|
-
var _a2, _b2;
|
|
32062
|
+
var _a2, _b2, _c2, _d2;
|
|
31977
32063
|
const folderName = folder.fullyQualifiedName ? folder.name : "";
|
|
31978
32064
|
return new Form({
|
|
31979
32065
|
crudType: "create",
|
|
@@ -31997,50 +32083,10 @@ This will work when developing locally but NOT when deployed to production.
|
|
|
31997
32083
|
id: schemaCollection.path + folderName + `/new-post.${schemaCollection.format || "md"}`,
|
|
31998
32084
|
label: "form",
|
|
31999
32085
|
fields: [
|
|
32086
|
+
((_b2 = (_a2 = collection.ui) == null ? void 0 : _a2.filename) == null ? void 0 : _b2.showFirst) && filenameField,
|
|
32000
32087
|
...formInfo.fields,
|
|
32001
|
-
|
|
32002
|
-
|
|
32003
|
-
label: "Filename",
|
|
32004
|
-
component: slugFunction ? wrapFieldsWithMeta(({ field, input, meta }) => {
|
|
32005
|
-
var _a3, _b3;
|
|
32006
|
-
return /* @__PURE__ */ React.createElement(
|
|
32007
|
-
FilenameInput,
|
|
32008
|
-
{
|
|
32009
|
-
readOnly: (_b3 = (_a3 = schemaCollection == null ? void 0 : schemaCollection.ui) == null ? void 0 : _a3.filename) == null ? void 0 : _b3.readonly,
|
|
32010
|
-
...input
|
|
32011
|
-
}
|
|
32012
|
-
);
|
|
32013
|
-
}) : "text",
|
|
32014
|
-
disabled: (_b2 = (_a2 = schemaCollection == null ? void 0 : schemaCollection.ui) == null ? void 0 : _a2.filename) == null ? void 0 : _b2.readonly,
|
|
32015
|
-
description: /* @__PURE__ */ React.createElement("span", null, "A unique filename for the content.", /* @__PURE__ */ React.createElement("br", null), "Examples: ", /* @__PURE__ */ React.createElement("code", null, "My_Document"), ", ", /* @__PURE__ */ React.createElement("code", null, "My_Document.en"), ",", " ", /* @__PURE__ */ React.createElement("code", null, "sub-folder/My_Document")),
|
|
32016
|
-
placeholder: "My_Document",
|
|
32017
|
-
validate: (value, allValues, meta) => {
|
|
32018
|
-
var _a3, _b3;
|
|
32019
|
-
if (!value) {
|
|
32020
|
-
if (meta.dirty) {
|
|
32021
|
-
return "Required";
|
|
32022
|
-
}
|
|
32023
|
-
return true;
|
|
32024
|
-
}
|
|
32025
|
-
const isValid = /[\.\-_\/a-zA-Z0-9]*$/.test(value);
|
|
32026
|
-
if (value && !isValid) {
|
|
32027
|
-
return "Must contain only a-z, A-Z, 0-9, -, _, ., or /.";
|
|
32028
|
-
}
|
|
32029
|
-
if (((_a3 = schemaCollection.match) == null ? void 0 : _a3.exclude) || ((_b3 = schemaCollection.match) == null ? void 0 : _b3.include)) {
|
|
32030
|
-
const filePath = `${schemaTools.normalizePath(
|
|
32031
|
-
schemaCollection.path
|
|
32032
|
-
)}/${value}.${schemaCollection.format || "md"}`;
|
|
32033
|
-
const match = schema == null ? void 0 : schema.matchFiles({
|
|
32034
|
-
files: [filePath],
|
|
32035
|
-
collection: schemaCollection
|
|
32036
|
-
});
|
|
32037
|
-
if ((match == null ? void 0 : match.length) === 0) {
|
|
32038
|
-
return `The filename "${value}" is not allowed for this collection.`;
|
|
32039
|
-
}
|
|
32040
|
-
}
|
|
32041
|
-
}
|
|
32042
|
-
}
|
|
32043
|
-
],
|
|
32088
|
+
!((_d2 = (_c2 = collection.ui) == null ? void 0 : _c2.filename) == null ? void 0 : _d2.showFirst) && filenameField
|
|
32089
|
+
].filter((x) => !!x),
|
|
32044
32090
|
onSubmit: async (values) => {
|
|
32045
32091
|
try {
|
|
32046
32092
|
const folderName2 = folder.fullyQualifiedName ? folder.name : "";
|
|
@@ -32095,7 +32141,7 @@ This will work when developing locally but NOT when deployed to production.
|
|
|
32095
32141
|
const activeForm = cms.state.forms.find(
|
|
32096
32142
|
({ tinaForm }) => tinaForm.id === form.id
|
|
32097
32143
|
);
|
|
32098
|
-
return /* @__PURE__ */ React.createElement(PageWrapper, null, /* @__PURE__ */ React.createElement(React.Fragment, null, ((
|
|
32144
|
+
return /* @__PURE__ */ React.createElement(PageWrapper, null, /* @__PURE__ */ React.createElement(React.Fragment, null, ((_j = (_i = cms == null ? void 0 : cms.api) == null ? void 0 : _i.tina) == null ? void 0 : _j.isLocalMode) ? /* @__PURE__ */ React.createElement(LocalWarning, null) : /* @__PURE__ */ React.createElement(BillingWarning, null), /* @__PURE__ */ React.createElement(
|
|
32099
32145
|
"div",
|
|
32100
32146
|
{
|
|
32101
32147
|
className: `pt-10 xl:pt-3 pb-10 xl:pb-4 px-20 xl:px-12 border-b border-gray-200 bg-white w-full grow-0 shrink basis-0 flex justify-center`
|
package/dist/index.mjs
CHANGED
|
@@ -6,7 +6,7 @@ var __publicField = (obj, key, value) => {
|
|
|
6
6
|
};
|
|
7
7
|
import { z } from "zod";
|
|
8
8
|
import * as React from "react";
|
|
9
|
-
import React__default, { useState, useCallback, createContext, forwardRef, useContext, useEffect, useMemo, startTransition,
|
|
9
|
+
import React__default, { useState, useCallback, createContext, forwardRef, useContext, useEffect, useMemo, startTransition, useRef, createElement, Component } from "react";
|
|
10
10
|
import { createPortal, findDOMNode } from "react-dom";
|
|
11
11
|
import { toggleList, ELEMENT_UL, ELEMENT_OL, ELEMENT_H1 as ELEMENT_H1$1, ELEMENT_H2 as ELEMENT_H2$1, ELEMENT_H3 as ELEMENT_H3$1, ELEMENT_H4, ELEMENT_H5, ELEMENT_H6, ELEMENT_PARAGRAPH, ELEMENT_BLOCKQUOTE, ELEMENT_CODE_BLOCK, ELEMENT_CODE_LINE, ELEMENT_CODE_SYNTAX, ELEMENT_LI, ELEMENT_LINK, MARK_CODE, MARK_UNDERLINE, MARK_STRIKETHROUGH, MARK_ITALIC, MARK_BOLD, ELEMENT_HR, unwrapList, ELEMENT_TODO_LI, createTrailingBlockPlugin, createAutoformatPlugin, createExitBreakPlugin, KEYS_HEADING, createResetNodePlugin, createHeadingPlugin, createParagraphPlugin, createBlockquotePlugin, createBoldPlugin, createItalicPlugin, createUnderlinePlugin, createCodePlugin, createListPlugin, createIndentPlugin, createIndentListPlugin, createHorizontalRulePlugin, createNodeIdPlugin, getListItemEntry, useListToolbarButtonState, useListToolbarButton } from "@udecode/plate";
|
|
12
12
|
import { useSelected, ReactEditor } from "slate-react";
|
|
@@ -20,7 +20,7 @@ import { useComboboxContext, Combobox, useComboboxStore, ComboboxProvider, Porta
|
|
|
20
20
|
import { useHTMLInputCursorState, useComboboxInput, filterWords } from "@udecode/plate-combobox";
|
|
21
21
|
import { useCodeSyntaxLeaf, useCodeBlockElementState, ELEMENT_CODE_BLOCK as ELEMENT_CODE_BLOCK$1 } from "@udecode/plate-code-block";
|
|
22
22
|
import MonacoEditor, { loader, useMonaco } from "@monaco-editor/react";
|
|
23
|
-
import { Combobox as Combobox$1, ComboboxInput, ComboboxButton, Transition, ComboboxOptions, ComboboxOption, Popover as Popover$2, PopoverButton, PopoverPanel, TransitionChild, Disclosure, DisclosurePanel, Menu, MenuButton, MenuItems, MenuItem } from "@headlessui/react";
|
|
23
|
+
import { Combobox as Combobox$1, ComboboxInput, ComboboxButton, Transition, ComboboxOptions, ComboboxOption, Popover as Popover$2, PopoverButton, PopoverPanel, TransitionChild, Disclosure, DisclosureButton, DisclosurePanel, Menu, MenuButton, MenuItems, MenuItem } from "@headlessui/react";
|
|
24
24
|
import arrayMutators from "final-form-arrays";
|
|
25
25
|
import setFieldData from "final-form-set-field-data";
|
|
26
26
|
import { FORM_ERROR, createForm, getIn } from "final-form";
|
|
@@ -1882,7 +1882,6 @@ const Autocomplete = ({
|
|
|
1882
1882
|
/* @__PURE__ */ React__default.createElement(
|
|
1883
1883
|
Transition,
|
|
1884
1884
|
{
|
|
1885
|
-
as: Fragment,
|
|
1886
1885
|
enter: "transition ease-out duration-100",
|
|
1887
1886
|
enterFrom: "transform opacity-0 scale-95",
|
|
1888
1887
|
enterTo: "transform opacity-100 scale-100",
|
|
@@ -3371,6 +3370,9 @@ function BiCopyAlt(props) {
|
|
|
3371
3370
|
function BiCopy(props) {
|
|
3372
3371
|
return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "d": "M20 2H10c-1.103 0-2 .897-2 2v4H4c-1.103 0-2 .897-2 2v10c0 1.103.897 2 2 2h10c1.103 0 2-.897 2-2v-4h4c1.103 0 2-.897 2-2V4c0-1.103-.897-2-2-2zM4 20V10h10l.002 10H4zm16-6h-4v-4c0-1.103-.897-2-2-2h-4V4h10v10z" }, "child": [] }] })(props);
|
|
3373
3372
|
}
|
|
3373
|
+
function BiDotsVertical(props) {
|
|
3374
|
+
return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "d": "M10 10h4v4h-4zm0-6h4v4h-4zm0 12h4v4h-4z" }, "child": [] }] })(props);
|
|
3375
|
+
}
|
|
3374
3376
|
function BiEdit(props) {
|
|
3375
3377
|
return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "d": "m7 17.013 4.413-.015 9.632-9.54c.378-.378.586-.88.586-1.414s-.208-1.036-.586-1.414l-1.586-1.586c-.756-.756-2.075-.752-2.825-.003L7 12.583v4.43zM18.045 4.458l1.589 1.583-1.597 1.582-1.586-1.585 1.594-1.58zM9 13.417l6.03-5.973 1.586 1.586-6.029 5.971L9 15.006v-1.589z" }, "child": [] }, { "tag": "path", "attr": { "d": "M5 21h14c1.103 0 2-.897 2-2v-8.668l-2 2V19H8.158c-.026 0-.053.01-.079.01-.033 0-.066-.009-.1-.01H5V5h6.847l2-2H5c-1.103 0-2 .897-2 2v14c0 1.103.897 2 2 2z" }, "child": [] }] })(props);
|
|
3376
3378
|
}
|
|
@@ -5328,7 +5330,6 @@ const BlockSelectorBig = ({
|
|
|
5328
5330
|
), /* @__PURE__ */ React.createElement(FormPortal, null, ({ zIndexShift }) => /* @__PURE__ */ React.createElement(Transition, { show: pickerIsOpen }, /* @__PURE__ */ React.createElement(
|
|
5329
5331
|
TransitionChild,
|
|
5330
5332
|
{
|
|
5331
|
-
as: React.Fragment,
|
|
5332
5333
|
enter: "transform transition-all ease-out duration-200",
|
|
5333
5334
|
enterFrom: "opacity-0 -translate-x-1/2",
|
|
5334
5335
|
enterTo: "opacity-100 translate-x-0",
|
|
@@ -5421,7 +5422,7 @@ const BlockGroup = ({ category, templates, close: close2, isLast = false }) => {
|
|
|
5421
5422
|
className: `left-0 right-0 relative`
|
|
5422
5423
|
},
|
|
5423
5424
|
({ open: open2 }) => /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
|
|
5424
|
-
|
|
5425
|
+
DisclosureButton,
|
|
5425
5426
|
{
|
|
5426
5427
|
className: `relative block group text-left w-full text-base font-bold tracking-wide py-2 truncate ${templates.length === 0 ? `pointer-events-none` : ``} ${!isLast && (!open2 || templates.length === 0) && `border-b border-gray-100`}`
|
|
5427
5428
|
},
|
|
@@ -9266,11 +9267,12 @@ const FormListItem = ({
|
|
|
9266
9267
|
};
|
|
9267
9268
|
const FormLists = (props) => {
|
|
9268
9269
|
const cms = useCMS();
|
|
9269
|
-
return /* @__PURE__ */ React.createElement(
|
|
9270
|
+
return /* @__PURE__ */ React.createElement(
|
|
9270
9271
|
Transition,
|
|
9271
9272
|
{
|
|
9272
9273
|
appear: true,
|
|
9273
9274
|
show: true,
|
|
9275
|
+
as: "div",
|
|
9274
9276
|
enter: "transition-all ease-out duration-150",
|
|
9275
9277
|
enterFrom: "opacity-0 -translate-x-1/2",
|
|
9276
9278
|
enterTo: "opacity-100",
|
|
@@ -9288,7 +9290,7 @@ const FormLists = (props) => {
|
|
|
9288
9290
|
formList
|
|
9289
9291
|
}
|
|
9290
9292
|
)))
|
|
9291
|
-
)
|
|
9293
|
+
);
|
|
9292
9294
|
};
|
|
9293
9295
|
const FormList = (props) => {
|
|
9294
9296
|
const cms = useCMS();
|
|
@@ -9411,19 +9413,46 @@ const MultiformFormHeader = ({
|
|
|
9411
9413
|
}
|
|
9412
9414
|
}
|
|
9413
9415
|
},
|
|
9416
|
+
/* @__PURE__ */ React.createElement(BiDotsVertical, { className: "h-auto w-5 inline-block opacity-70" })
|
|
9417
|
+
), /* @__PURE__ */ React.createElement(
|
|
9418
|
+
"button",
|
|
9419
|
+
{
|
|
9420
|
+
type: "button",
|
|
9421
|
+
className: "pointer-events-auto text-xs text-blue-400 hover:text-blue-500 hover:underline transition-all ease-out duration-150",
|
|
9422
|
+
onClick: () => {
|
|
9423
|
+
const collectionName = cms.api.tina.schema.getCollectionByFullPath(
|
|
9424
|
+
cms.state.activeFormId
|
|
9425
|
+
).name;
|
|
9426
|
+
window.location.href = `${new URL(window.location.href).pathname}#/collections/${collectionName}/~`;
|
|
9427
|
+
}
|
|
9428
|
+
},
|
|
9414
9429
|
/* @__PURE__ */ React.createElement(BiHomeAlt, { className: "h-auto w-5 inline-block opacity-70" })
|
|
9415
9430
|
), /* @__PURE__ */ React.createElement("span", { className: "opacity-30 text-sm leading-tight whitespace-nowrap flex-0" }, "/"), /* @__PURE__ */ React.createElement("span", { className: "block w-full text-sm leading-tight whitespace-nowrap truncate" }, activeForm.tinaForm.label || activeForm.tinaForm.id), /* @__PURE__ */ React.createElement(FormStatus, { pristine: formIsPristine }))
|
|
9416
9431
|
);
|
|
9417
9432
|
};
|
|
9418
9433
|
const FormHeader = ({ activeForm }) => {
|
|
9419
9434
|
const { formIsPristine } = React.useContext(SidebarContext);
|
|
9435
|
+
const cms = useCMS$1();
|
|
9420
9436
|
const shortFormLabel = activeForm.tinaForm.label ? activeForm.tinaForm.label.replace(/^.*[\\\/]/, "") : false;
|
|
9421
9437
|
return /* @__PURE__ */ React.createElement(
|
|
9422
9438
|
"div",
|
|
9423
9439
|
{
|
|
9424
9440
|
className: "pt-18 pb-4 px-6 border-b border-gray-200 bg-gradient-to-t from-white to-gray-50"
|
|
9425
9441
|
},
|
|
9426
|
-
/* @__PURE__ */ React.createElement("div", { className: "max-w-form mx-auto flex gap-2 justify-between items-center" },
|
|
9442
|
+
/* @__PURE__ */ React.createElement("div", { className: "max-w-form mx-auto flex gap-2 justify-between items-center" }, /* @__PURE__ */ React.createElement(
|
|
9443
|
+
"button",
|
|
9444
|
+
{
|
|
9445
|
+
type: "button",
|
|
9446
|
+
className: "pointer-events-auto text-xs text-blue-400 hover:text-blue-500 hover:underline transition-all ease-out duration-150",
|
|
9447
|
+
onClick: () => {
|
|
9448
|
+
const collectionName = cms.api.tina.schema.getCollectionByFullPath(
|
|
9449
|
+
cms.state.activeFormId
|
|
9450
|
+
).name;
|
|
9451
|
+
window.location.href = `${new URL(window.location.href).pathname}#/collections/${collectionName}/~`;
|
|
9452
|
+
}
|
|
9453
|
+
},
|
|
9454
|
+
/* @__PURE__ */ React.createElement(BiHomeAlt, { className: "h-auto w-5 inline-block opacity-70" })
|
|
9455
|
+
), shortFormLabel && /* @__PURE__ */ React.createElement("span", { className: "block w-full text-sm leading-tight whitespace-nowrap truncate" }, shortFormLabel), /* @__PURE__ */ React.createElement(FormStatus, { pristine: formIsPristine }))
|
|
9427
9456
|
);
|
|
9428
9457
|
};
|
|
9429
9458
|
function ImFilesEmpty(props) {
|
|
@@ -9668,6 +9697,7 @@ const SyncStatus = ({ cms, setEventsOpen }) => {
|
|
|
9668
9697
|
"Event Log"
|
|
9669
9698
|
));
|
|
9670
9699
|
};
|
|
9700
|
+
const version = "2.2.6";
|
|
9671
9701
|
const Nav = ({
|
|
9672
9702
|
isLocalMode,
|
|
9673
9703
|
className = "",
|
|
@@ -9797,7 +9827,7 @@ const Nav = ({
|
|
|
9797
9827
|
))))),
|
|
9798
9828
|
eventsOpen && /* @__PURE__ */ React.createElement(SyncStatusModal, { cms, closeEventsModal }),
|
|
9799
9829
|
children,
|
|
9800
|
-
/* @__PURE__ */ React.createElement("div", { className: "px-6 flex-1 overflow-auto" }, showCollections && /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("h4", { className: "flex space-x-1 justify-items-start uppercase font-sans font-bold text-sm mb-3 mt-8 text-gray-700" }, /* @__PURE__ */ React.createElement("span", null, "Collections"), isLocalMode && /* @__PURE__ */ React.createElement("span", { className: "flex items-center" }, /* @__PURE__ */ React.createElement(
|
|
9830
|
+
/* @__PURE__ */ React.createElement("div", { className: "flex flex-col px-6 flex-1 overflow-auto" }, showCollections && /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("h4", { className: "flex space-x-1 justify-items-start uppercase font-sans font-bold text-sm mb-3 mt-8 text-gray-700" }, /* @__PURE__ */ React.createElement("span", null, "Collections"), isLocalMode && /* @__PURE__ */ React.createElement("span", { className: "flex items-center" }, /* @__PURE__ */ React.createElement(
|
|
9801
9831
|
"a",
|
|
9802
9832
|
{
|
|
9803
9833
|
href: "https://tina.io/docs/schema/#defining-collections",
|
|
@@ -9828,7 +9858,7 @@ const Nav = ({
|
|
|
9828
9858
|
}
|
|
9829
9859
|
}), !!(cloudConfigs == null ? void 0 : cloudConfigs.length) && /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("h4", { className: "uppercase font-sans font-bold text-sm mb-3 mt-8 text-gray-700" }, "Cloud"), /* @__PURE__ */ React.createElement("ul", { className: "flex flex-col gap-4" }, cloudConfigs.map((config) => {
|
|
9830
9860
|
return /* @__PURE__ */ React.createElement("li", { key: `nav-site-${config.name}` }, /* @__PURE__ */ React.createElement(RenderNavCloud, { config }));
|
|
9831
|
-
}))))
|
|
9861
|
+
}))), /* @__PURE__ */ React.createElement("div", { className: "grow" }), /* @__PURE__ */ React.createElement("span", { className: "font-sans font-light text-xs mb-3 mt-8 text-gray-500" }, "v", version))
|
|
9832
9862
|
);
|
|
9833
9863
|
};
|
|
9834
9864
|
const CollectionsList = ({
|
|
@@ -10133,10 +10163,9 @@ const Sidebar$1 = ({
|
|
|
10133
10163
|
screen: activeScreen,
|
|
10134
10164
|
close: () => setActiveView(null)
|
|
10135
10165
|
}
|
|
10136
|
-
)), /* @__PURE__ */ React.createElement(ResizeHandle, null)), renderMobileNav && /* @__PURE__ */ React.createElement(Transition, { show: menuIsOpen }, /* @__PURE__ */ React.createElement(
|
|
10166
|
+
)), /* @__PURE__ */ React.createElement(ResizeHandle, null)), renderMobileNav && /* @__PURE__ */ React.createElement(Transition, { show: menuIsOpen, as: "div" }, /* @__PURE__ */ React.createElement(
|
|
10137
10167
|
TransitionChild,
|
|
10138
10168
|
{
|
|
10139
|
-
as: React.Fragment,
|
|
10140
10169
|
enter: "transform transition-all ease-out duration-300",
|
|
10141
10170
|
enterFrom: "opacity-0 -translate-x-full",
|
|
10142
10171
|
enterTo: "opacity-100 translate-x-0",
|
|
@@ -10202,7 +10231,6 @@ const Sidebar$1 = ({
|
|
|
10202
10231
|
), /* @__PURE__ */ React.createElement(
|
|
10203
10232
|
TransitionChild,
|
|
10204
10233
|
{
|
|
10205
|
-
as: React.Fragment,
|
|
10206
10234
|
enter: "ease-out duration-300",
|
|
10207
10235
|
enterFrom: "opacity-0",
|
|
10208
10236
|
enterTo: "opacity-80",
|
|
@@ -12746,7 +12774,6 @@ const DotMenu = ({ onOpen, onRemove }) => {
|
|
|
12746
12774
|
), /* @__PURE__ */ React__default.createElement(
|
|
12747
12775
|
Transition,
|
|
12748
12776
|
{
|
|
12749
|
-
as: React__default.Fragment,
|
|
12750
12777
|
enter: "transition ease-out duration-100",
|
|
12751
12778
|
enterFrom: "transform opacity-0 scale-95",
|
|
12752
12779
|
enterTo: "transform opacity-100 scale-100",
|
|
@@ -13895,12 +13922,29 @@ function TemplatesToolbarButton() {
|
|
|
13895
13922
|
}
|
|
13896
13923
|
const EmbedButton = ({ editor, templates }) => {
|
|
13897
13924
|
const [open2, setOpen] = useState(false);
|
|
13925
|
+
const [filteredTemplates, setFilteredTemplates] = useState(templates);
|
|
13926
|
+
const filterChange = (e) => {
|
|
13927
|
+
const filterText = e.target.value.toLowerCase();
|
|
13928
|
+
setFilteredTemplates(
|
|
13929
|
+
templates.filter(
|
|
13930
|
+
(template) => template.name.toLowerCase().includes(filterText)
|
|
13931
|
+
)
|
|
13932
|
+
);
|
|
13933
|
+
};
|
|
13898
13934
|
return /* @__PURE__ */ React__default.createElement(DropdownMenu, { open: open2, onOpenChange: setOpen }, /* @__PURE__ */ React__default.createElement(DropdownMenuTrigger, { className: "inline-flex items-center rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg:not([data-icon])]:size-5 h-9 px-2 bg-transparent hover:bg-muted hover:text-muted-foreground aria-checked:bg-accent aria-checked:text-accent-foreground my-1 justify-between pr-1" }, /* @__PURE__ */ React__default.createElement("span", { className: "flex" }, "Embed"), /* @__PURE__ */ React__default.createElement(
|
|
13899
13935
|
PlusIcon,
|
|
13900
13936
|
{
|
|
13901
13937
|
className: `origin-center transition-all ease-out duration-150 ${open2 ? "rotate-45" : ""}`
|
|
13902
13938
|
}
|
|
13903
|
-
)), /* @__PURE__ */ React__default.createElement(DropdownMenuContent,
|
|
13939
|
+
)), /* @__PURE__ */ React__default.createElement(DropdownMenuContent, { className: "max-h-48 overflow-y-auto" }, templates.length > 10 && /* @__PURE__ */ React__default.createElement(
|
|
13940
|
+
"input",
|
|
13941
|
+
{
|
|
13942
|
+
type: "text",
|
|
13943
|
+
placeholder: "Filter templates...",
|
|
13944
|
+
className: "w-full p-2 border border-gray-300 rounded-md",
|
|
13945
|
+
onChange: filterChange
|
|
13946
|
+
}
|
|
13947
|
+
), /* @__PURE__ */ React__default.createElement(DropdownMenuSeparator, null), filteredTemplates.map((template) => /* @__PURE__ */ React__default.createElement(
|
|
13904
13948
|
DropdownMenuItem,
|
|
13905
13949
|
{
|
|
13906
13950
|
key: template.name,
|
|
@@ -30524,7 +30568,6 @@ const Sidebar = ({ cms }) => {
|
|
|
30524
30568
|
), !renderDesktopNav && /* @__PURE__ */ React__default.createElement(Transition, { show: menuIsOpen }, /* @__PURE__ */ React__default.createElement(
|
|
30525
30569
|
TransitionChild,
|
|
30526
30570
|
{
|
|
30527
|
-
as: React__default.Fragment,
|
|
30528
30571
|
enter: "transform transition-all ease-out duration-300",
|
|
30529
30572
|
enterFrom: "opacity-0 -translate-x-full",
|
|
30530
30573
|
enterTo: "opacity-100 translate-x-0",
|
|
@@ -30594,7 +30637,6 @@ const Sidebar = ({ cms }) => {
|
|
|
30594
30637
|
), /* @__PURE__ */ React__default.createElement(
|
|
30595
30638
|
TransitionChild,
|
|
30596
30639
|
{
|
|
30597
|
-
as: React__default.Fragment,
|
|
30598
30640
|
enter: "ease-out duration-300",
|
|
30599
30641
|
enterFrom: "opacity-0",
|
|
30600
30642
|
enterTo: "opacity-80",
|
|
@@ -31050,7 +31092,6 @@ const TemplateMenu = ({
|
|
|
31050
31092
|
return /* @__PURE__ */ React__default.createElement(Menu, { as: "div", className: "relative inline-block text-left" }, () => /* @__PURE__ */ React__default.createElement("div", null, /* @__PURE__ */ React__default.createElement("div", null, /* @__PURE__ */ React__default.createElement(MenuButton, { className: "icon-parent inline-flex items-center font-medium focus:outline-none focus:ring-2 focus:shadow-outline text-center rounded-full justify-center transition-all duration-150 ease-out shadow text-white bg-blue-500 hover:bg-blue-600 focus:ring-blue-500 text-sm h-10 px-6" }, "Create New ", /* @__PURE__ */ React__default.createElement(BiPlus, { className: "w-5 h-full ml-1 opacity-70" }))), /* @__PURE__ */ React__default.createElement(
|
|
31051
31093
|
Transition,
|
|
31052
31094
|
{
|
|
31053
|
-
as: Fragment,
|
|
31054
31095
|
enter: "transition ease-out duration-100",
|
|
31055
31096
|
enterFrom: "transform opacity-0 scale-95",
|
|
31056
31097
|
enterTo: "transform opacity-100 scale-100",
|
|
@@ -31058,7 +31099,7 @@ const TemplateMenu = ({
|
|
|
31058
31099
|
leaveFrom: "transform opacity-100 scale-100",
|
|
31059
31100
|
leaveTo: "transform opacity-0 scale-95"
|
|
31060
31101
|
},
|
|
31061
|
-
/* @__PURE__ */ React__default.createElement(MenuItems, { className: "origin-top-right absolute right-0 mt-2 z-menu w-56 rounded-md shadow-lg bg-white ring-1 ring-black ring-opacity-5 focus:outline-none" }, /* @__PURE__ */ React__default.createElement("div", { className: "py-1" }, templates.map((template) => /* @__PURE__ */ React__default.createElement(MenuItem, { key: `${template.label}-${template.name}` }, ({
|
|
31102
|
+
/* @__PURE__ */ React__default.createElement(MenuItems, { className: "origin-top-right absolute right-0 mt-2 z-menu w-56 rounded-md shadow-lg bg-white ring-1 ring-black ring-opacity-5 focus:outline-none" }, /* @__PURE__ */ React__default.createElement("div", { className: "py-1" }, templates.map((template) => /* @__PURE__ */ React__default.createElement(MenuItem, { key: `${template.label}-${template.name}` }, ({ focus }) => /* @__PURE__ */ React__default.createElement(
|
|
31062
31103
|
Link,
|
|
31063
31104
|
{
|
|
31064
31105
|
to: `/${folder.fullyQualifiedName ? [
|
|
@@ -31074,7 +31115,7 @@ const TemplateMenu = ({
|
|
|
31074
31115
|
collectionName,
|
|
31075
31116
|
template.name
|
|
31076
31117
|
].join("/")}`,
|
|
31077
|
-
className: `w-full text-md px-4 py-2 tracking-wide flex items-center transition ease-out duration-100 ${
|
|
31118
|
+
className: `w-full text-md px-4 py-2 tracking-wide flex items-center transition ease-out duration-100 ${focus ? "text-blue-600 opacity-100 bg-gray-50" : "opacity-80 text-gray-600"}`
|
|
31078
31119
|
},
|
|
31079
31120
|
template.label
|
|
31080
31121
|
)))))
|
|
@@ -31965,7 +32006,7 @@ const RenderForm$1 = ({
|
|
|
31965
32006
|
mutationInfo,
|
|
31966
32007
|
customDefaults
|
|
31967
32008
|
}) => {
|
|
31968
|
-
var _a, _b, _c, _d, _e, _f;
|
|
32009
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
31969
32010
|
const navigate = useNavigate();
|
|
31970
32011
|
const [formIsPristine, setFormIsPristine] = useState(true);
|
|
31971
32012
|
const schema = cms.api.tina.schema;
|
|
@@ -31995,8 +32036,53 @@ const RenderForm$1 = ({
|
|
|
31995
32036
|
const defaultItem2 = customDefaults || // @ts-ignore internal types aren't up to date
|
|
31996
32037
|
((_d = template.ui) == null ? void 0 : _d.defaultItem) || // @ts-ignore
|
|
31997
32038
|
(template == null ? void 0 : template.defaultItem) || {};
|
|
32039
|
+
const filenameField = {
|
|
32040
|
+
name: "filename",
|
|
32041
|
+
label: "Filename",
|
|
32042
|
+
component: slugFunction ? wrapFieldsWithMeta(({ field, input, meta }) => {
|
|
32043
|
+
var _a2, _b2;
|
|
32044
|
+
return /* @__PURE__ */ React__default.createElement(
|
|
32045
|
+
FilenameInput,
|
|
32046
|
+
{
|
|
32047
|
+
readOnly: (_b2 = (_a2 = schemaCollection == null ? void 0 : schemaCollection.ui) == null ? void 0 : _a2.filename) == null ? void 0 : _b2.readonly,
|
|
32048
|
+
...input
|
|
32049
|
+
}
|
|
32050
|
+
);
|
|
32051
|
+
}) : "text",
|
|
32052
|
+
disabled: (_f = (_e = schemaCollection == null ? void 0 : schemaCollection.ui) == null ? void 0 : _e.filename) == null ? void 0 : _f.readonly,
|
|
32053
|
+
description: ((_h = (_g = collection.ui) == null ? void 0 : _g.filename) == null ? void 0 : _h.description) ? /* @__PURE__ */ React__default.createElement(
|
|
32054
|
+
"span",
|
|
32055
|
+
{
|
|
32056
|
+
dangerouslySetInnerHTML: { __html: collection.ui.filename.description }
|
|
32057
|
+
}
|
|
32058
|
+
) : /* @__PURE__ */ React__default.createElement("span", null, "A unique filename for the content.", /* @__PURE__ */ React__default.createElement("br", null), "Examples: ", /* @__PURE__ */ React__default.createElement("code", null, "My_Document"), ", ", /* @__PURE__ */ React__default.createElement("code", null, "My_Document.en"), ",", " ", /* @__PURE__ */ React__default.createElement("code", null, "sub-folder/My_Document")),
|
|
32059
|
+
placeholder: "My_Document",
|
|
32060
|
+
validate: (value, allValues, meta) => {
|
|
32061
|
+
var _a2, _b2;
|
|
32062
|
+
if (!value) {
|
|
32063
|
+
if (meta.dirty) {
|
|
32064
|
+
return "Required";
|
|
32065
|
+
}
|
|
32066
|
+
return true;
|
|
32067
|
+
}
|
|
32068
|
+
const isValid = /[\.\-_\/a-zA-Z0-9]*$/.test(value);
|
|
32069
|
+
if (value && !isValid) {
|
|
32070
|
+
return "Must contain only a-z, A-Z, 0-9, -, _, ., or /.";
|
|
32071
|
+
}
|
|
32072
|
+
if (((_a2 = schemaCollection.match) == null ? void 0 : _a2.exclude) || ((_b2 = schemaCollection.match) == null ? void 0 : _b2.include)) {
|
|
32073
|
+
const filePath = `${normalizePath(schemaCollection.path)}/${value}.${schemaCollection.format || "md"}`;
|
|
32074
|
+
const match = schema == null ? void 0 : schema.matchFiles({
|
|
32075
|
+
files: [filePath],
|
|
32076
|
+
collection: schemaCollection
|
|
32077
|
+
});
|
|
32078
|
+
if ((match == null ? void 0 : match.length) === 0) {
|
|
32079
|
+
return `The filename "${value}" is not allowed for this collection.`;
|
|
32080
|
+
}
|
|
32081
|
+
}
|
|
32082
|
+
}
|
|
32083
|
+
};
|
|
31998
32084
|
const form = useMemo(() => {
|
|
31999
|
-
var _a2, _b2;
|
|
32085
|
+
var _a2, _b2, _c2, _d2;
|
|
32000
32086
|
const folderName = folder.fullyQualifiedName ? folder.name : "";
|
|
32001
32087
|
return new Form({
|
|
32002
32088
|
crudType: "create",
|
|
@@ -32020,50 +32106,10 @@ const RenderForm$1 = ({
|
|
|
32020
32106
|
id: schemaCollection.path + folderName + `/new-post.${schemaCollection.format || "md"}`,
|
|
32021
32107
|
label: "form",
|
|
32022
32108
|
fields: [
|
|
32109
|
+
((_b2 = (_a2 = collection.ui) == null ? void 0 : _a2.filename) == null ? void 0 : _b2.showFirst) && filenameField,
|
|
32023
32110
|
...formInfo.fields,
|
|
32024
|
-
|
|
32025
|
-
|
|
32026
|
-
label: "Filename",
|
|
32027
|
-
component: slugFunction ? wrapFieldsWithMeta(({ field, input, meta }) => {
|
|
32028
|
-
var _a3, _b3;
|
|
32029
|
-
return /* @__PURE__ */ React__default.createElement(
|
|
32030
|
-
FilenameInput,
|
|
32031
|
-
{
|
|
32032
|
-
readOnly: (_b3 = (_a3 = schemaCollection == null ? void 0 : schemaCollection.ui) == null ? void 0 : _a3.filename) == null ? void 0 : _b3.readonly,
|
|
32033
|
-
...input
|
|
32034
|
-
}
|
|
32035
|
-
);
|
|
32036
|
-
}) : "text",
|
|
32037
|
-
disabled: (_b2 = (_a2 = schemaCollection == null ? void 0 : schemaCollection.ui) == null ? void 0 : _a2.filename) == null ? void 0 : _b2.readonly,
|
|
32038
|
-
description: /* @__PURE__ */ React__default.createElement("span", null, "A unique filename for the content.", /* @__PURE__ */ React__default.createElement("br", null), "Examples: ", /* @__PURE__ */ React__default.createElement("code", null, "My_Document"), ", ", /* @__PURE__ */ React__default.createElement("code", null, "My_Document.en"), ",", " ", /* @__PURE__ */ React__default.createElement("code", null, "sub-folder/My_Document")),
|
|
32039
|
-
placeholder: "My_Document",
|
|
32040
|
-
validate: (value, allValues, meta) => {
|
|
32041
|
-
var _a3, _b3;
|
|
32042
|
-
if (!value) {
|
|
32043
|
-
if (meta.dirty) {
|
|
32044
|
-
return "Required";
|
|
32045
|
-
}
|
|
32046
|
-
return true;
|
|
32047
|
-
}
|
|
32048
|
-
const isValid = /[\.\-_\/a-zA-Z0-9]*$/.test(value);
|
|
32049
|
-
if (value && !isValid) {
|
|
32050
|
-
return "Must contain only a-z, A-Z, 0-9, -, _, ., or /.";
|
|
32051
|
-
}
|
|
32052
|
-
if (((_a3 = schemaCollection.match) == null ? void 0 : _a3.exclude) || ((_b3 = schemaCollection.match) == null ? void 0 : _b3.include)) {
|
|
32053
|
-
const filePath = `${normalizePath(
|
|
32054
|
-
schemaCollection.path
|
|
32055
|
-
)}/${value}.${schemaCollection.format || "md"}`;
|
|
32056
|
-
const match = schema == null ? void 0 : schema.matchFiles({
|
|
32057
|
-
files: [filePath],
|
|
32058
|
-
collection: schemaCollection
|
|
32059
|
-
});
|
|
32060
|
-
if ((match == null ? void 0 : match.length) === 0) {
|
|
32061
|
-
return `The filename "${value}" is not allowed for this collection.`;
|
|
32062
|
-
}
|
|
32063
|
-
}
|
|
32064
|
-
}
|
|
32065
|
-
}
|
|
32066
|
-
],
|
|
32111
|
+
!((_d2 = (_c2 = collection.ui) == null ? void 0 : _c2.filename) == null ? void 0 : _d2.showFirst) && filenameField
|
|
32112
|
+
].filter((x) => !!x),
|
|
32067
32113
|
onSubmit: async (values) => {
|
|
32068
32114
|
try {
|
|
32069
32115
|
const folderName2 = folder.fullyQualifiedName ? folder.name : "";
|
|
@@ -32118,7 +32164,7 @@ const RenderForm$1 = ({
|
|
|
32118
32164
|
const activeForm = cms.state.forms.find(
|
|
32119
32165
|
({ tinaForm }) => tinaForm.id === form.id
|
|
32120
32166
|
);
|
|
32121
|
-
return /* @__PURE__ */ React__default.createElement(PageWrapper, null, /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, ((
|
|
32167
|
+
return /* @__PURE__ */ React__default.createElement(PageWrapper, null, /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, ((_j = (_i = cms == null ? void 0 : cms.api) == null ? void 0 : _i.tina) == null ? void 0 : _j.isLocalMode) ? /* @__PURE__ */ React__default.createElement(LocalWarning, null) : /* @__PURE__ */ React__default.createElement(BillingWarning, null), /* @__PURE__ */ React__default.createElement(
|
|
32122
32168
|
"div",
|
|
32123
32169
|
{
|
|
32124
32170
|
className: `pt-10 xl:pt-3 pb-10 xl:pb-4 px-20 xl:px-12 border-b border-gray-200 bg-white w-full grow-0 shrink basis-0 flex justify-center`
|
|
@@ -0,0 +1,43 @@
|
|
|
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
|
+
};
|
|
@@ -24,8 +24,11 @@ export declare class TinaClient<GenQueries> {
|
|
|
24
24
|
readonlyToken?: string;
|
|
25
25
|
queries: GenQueries;
|
|
26
26
|
errorPolicy: Config['client']['errorPolicy'];
|
|
27
|
+
initialized: boolean;
|
|
28
|
+
cacheDir: string;
|
|
27
29
|
cache: Cache;
|
|
28
30
|
constructor({ token, url, queries, errorPolicy, cacheDir, }: TinaClientArgs<GenQueries>);
|
|
31
|
+
init(): Promise<void>;
|
|
29
32
|
request<DataType extends Record<string, any> = any>({ errorPolicy, ...args }: TinaClientRequestArgs, options: {
|
|
30
33
|
fetchOptions?: Parameters<typeof fetch>[1];
|
|
31
34
|
}): Promise<any>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tinacms",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.7",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"module": "./dist/index.mjs",
|
|
6
6
|
"exports": {
|
|
@@ -14,11 +14,6 @@
|
|
|
14
14
|
"import": "./dist/client.mjs",
|
|
15
15
|
"require": "./dist/client.js"
|
|
16
16
|
},
|
|
17
|
-
"./dist/cache": {
|
|
18
|
-
"types": "./dist/cache.d.ts",
|
|
19
|
-
"import": "./dist/cache.mjs",
|
|
20
|
-
"require": "./dist/cache.js"
|
|
21
|
-
},
|
|
22
17
|
"./dist/edit-state": {
|
|
23
18
|
"types": "./dist/edit-state.d.ts",
|
|
24
19
|
"import": "./dist/edit-state.mjs",
|
|
@@ -49,9 +44,18 @@
|
|
|
49
44
|
"src/rich-text/index.tsx",
|
|
50
45
|
"src/rich-text/prism.tsx",
|
|
51
46
|
"src/react.tsx",
|
|
52
|
-
"src/client.ts"
|
|
53
|
-
|
|
54
|
-
|
|
47
|
+
"src/client.ts"
|
|
48
|
+
],
|
|
49
|
+
"build": {
|
|
50
|
+
"rollupOptions": {
|
|
51
|
+
"external": [
|
|
52
|
+
"crypto",
|
|
53
|
+
"fs",
|
|
54
|
+
"path",
|
|
55
|
+
"os"
|
|
56
|
+
]
|
|
57
|
+
}
|
|
58
|
+
}
|
|
55
59
|
},
|
|
56
60
|
"typings": "dist/index.d.ts",
|
|
57
61
|
"license": "Apache-2.0",
|
|
@@ -60,7 +64,7 @@
|
|
|
60
64
|
"@floating-ui/dom": "^1.6.9",
|
|
61
65
|
"@floating-ui/react-dom": "^2.1.1",
|
|
62
66
|
"@graphql-inspector/core": "^6.1.0",
|
|
63
|
-
"@headlessui/react": "
|
|
67
|
+
"@headlessui/react": "2.1.8",
|
|
64
68
|
"@heroicons/react": "^1.0.4",
|
|
65
69
|
"@monaco-editor/react": "4.4.5",
|
|
66
70
|
"@radix-ui/react-checkbox": "^1.1.1",
|
|
@@ -123,9 +127,9 @@
|
|
|
123
127
|
"webfontloader": "1.6.28",
|
|
124
128
|
"yup": "^1.4.0",
|
|
125
129
|
"zod": "^3.23.8",
|
|
126
|
-
"@tinacms/mdx": "1.4.
|
|
127
|
-
"@tinacms/schema-tools": "1.6.
|
|
128
|
-
"@tinacms/search": "1.0.
|
|
130
|
+
"@tinacms/mdx": "1.4.3",
|
|
131
|
+
"@tinacms/schema-tools": "1.6.3",
|
|
132
|
+
"@tinacms/search": "1.0.30"
|
|
129
133
|
},
|
|
130
134
|
"devDependencies": {
|
|
131
135
|
"@graphql-tools/utils": "^10.3.3",
|
|
@@ -138,7 +142,7 @@
|
|
|
138
142
|
"@types/color-string": "^1.5.5",
|
|
139
143
|
"@types/lodash.debounce": "^4.0.9",
|
|
140
144
|
"@types/lodash.get": "^4.4.9",
|
|
141
|
-
"@types/node": "^22.
|
|
145
|
+
"@types/node": "^22.7.3",
|
|
142
146
|
"@types/prop-types": "^15.7.12",
|
|
143
147
|
"@types/react": "^18.3.3",
|
|
144
148
|
"@types/react-beautiful-dnd": "^13.1.8",
|
|
@@ -149,16 +153,16 @@
|
|
|
149
153
|
"identity-obj-proxy": "^3.0.0",
|
|
150
154
|
"isomorphic-fetch": "^3.0.0",
|
|
151
155
|
"jest-file-snapshot": "^0.7.0",
|
|
152
|
-
"next": "14.2.
|
|
156
|
+
"next": "14.2.10",
|
|
153
157
|
"react": "^18.3.1",
|
|
154
158
|
"react-dom": "^18.3.1",
|
|
155
159
|
"react-is": "^18.3.1",
|
|
156
160
|
"tsc-alias": "^1.8.10",
|
|
157
161
|
"tslib": "^2.6.3",
|
|
158
|
-
"typescript": "^5.
|
|
162
|
+
"typescript": "^5.6.2",
|
|
159
163
|
"vite": "^5.3.5",
|
|
160
164
|
"vitest": "^2.0.5",
|
|
161
|
-
"@tinacms/scripts": "1.2.
|
|
165
|
+
"@tinacms/scripts": "1.2.2"
|
|
162
166
|
},
|
|
163
167
|
"peerDependencies": {
|
|
164
168
|
"react": ">=16.14.0",
|
package/dist/cache.js
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
(function(global, factory) {
|
|
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
|
-
"use strict";
|
|
5
|
-
const { createHash } = require("crypto");
|
|
6
|
-
const makeKey = (key) => {
|
|
7
|
-
const input = key && key instanceof Object ? JSON.stringify(key) : key || "";
|
|
8
|
-
return createHash("sha256").update(input).digest("hex");
|
|
9
|
-
};
|
|
10
|
-
const NodeCache = (dir, fs) => {
|
|
11
|
-
return {
|
|
12
|
-
makeKey,
|
|
13
|
-
get: async (key) => {
|
|
14
|
-
try {
|
|
15
|
-
const data = await fs.promises.readFile(`${dir}/${key}`, "utf-8");
|
|
16
|
-
return JSON.parse(data);
|
|
17
|
-
} catch (e) {
|
|
18
|
-
if (e.code === "ENOENT") {
|
|
19
|
-
return void 0;
|
|
20
|
-
}
|
|
21
|
-
throw e;
|
|
22
|
-
}
|
|
23
|
-
},
|
|
24
|
-
set: async (key, value) => {
|
|
25
|
-
await fs.promises.mkdir(dir, { recursive: true });
|
|
26
|
-
await fs.promises.writeFile(
|
|
27
|
-
`${dir}/${key}`,
|
|
28
|
-
JSON.stringify(value),
|
|
29
|
-
"utf-8"
|
|
30
|
-
);
|
|
31
|
-
}
|
|
32
|
-
};
|
|
33
|
-
};
|
|
34
|
-
exports2.NodeCache = NodeCache;
|
|
35
|
-
Object.defineProperty(exports2, Symbol.toStringTag, { value: "Module" });
|
|
36
|
-
});
|
package/dist/cache.mjs
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
const { createHash } = require("crypto");
|
|
2
|
-
const makeKey = (key) => {
|
|
3
|
-
const input = key && key instanceof Object ? JSON.stringify(key) : key || "";
|
|
4
|
-
return createHash("sha256").update(input).digest("hex");
|
|
5
|
-
};
|
|
6
|
-
const NodeCache = (dir, fs) => {
|
|
7
|
-
return {
|
|
8
|
-
makeKey,
|
|
9
|
-
get: async (key) => {
|
|
10
|
-
try {
|
|
11
|
-
const data = await fs.promises.readFile(`${dir}/${key}`, "utf-8");
|
|
12
|
-
return JSON.parse(data);
|
|
13
|
-
} catch (e) {
|
|
14
|
-
if (e.code === "ENOENT") {
|
|
15
|
-
return void 0;
|
|
16
|
-
}
|
|
17
|
-
throw e;
|
|
18
|
-
}
|
|
19
|
-
},
|
|
20
|
-
set: async (key, value) => {
|
|
21
|
-
await fs.promises.mkdir(dir, { recursive: true });
|
|
22
|
-
await fs.promises.writeFile(
|
|
23
|
-
`${dir}/${key}`,
|
|
24
|
-
JSON.stringify(value),
|
|
25
|
-
"utf-8"
|
|
26
|
-
);
|
|
27
|
-
}
|
|
28
|
-
};
|
|
29
|
-
};
|
|
30
|
-
export {
|
|
31
|
-
NodeCache
|
|
32
|
-
};
|