tinacms 0.0.0-f717193-20251205011605 → 0.0.0-f894432-20251221235528
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/dist/cache/node-cache.d.ts +6 -2
- package/dist/client.js +141 -28
- package/dist/index.js +639 -346
- package/dist/internalClient/index.d.ts +29 -1
- package/dist/toolkit/components/ui/date-time-picker.d.ts +1 -1
- package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/components/plate-ui/button.d.ts +2 -2
- package/dist/toolkit/fields/plugins/mdx-field-plugin/plate/plugins/ui/components.d.ts +2 -1
- package/dist/toolkit/react-sidebar/components/sidebar-body.d.ts +26 -1
- package/dist/unifiedClient/index.d.ts +1 -1
- package/package.json +10 -18
- package/dist/__vite-browser-external-d06ac358.js +0 -4
- package/dist/node-cache-c9558e1e.js +0 -63
package/dist/index.js
CHANGED
|
@@ -7,7 +7,7 @@ var __publicField = (obj, key, value) => {
|
|
|
7
7
|
var _a;
|
|
8
8
|
import { z } from "zod";
|
|
9
9
|
import * as React from "react";
|
|
10
|
-
import React__default, { useState, useCallback, useContext, createContext, forwardRef, useRef, useReducer, useMemo, useEffect, useLayoutEffect, Component, memo
|
|
10
|
+
import React__default, { useState, useCallback, useContext, createContext, forwardRef, useRef, useReducer, useMemo, useEffect, useLayoutEffect, Component, memo, useDebugValue, useId, startTransition, useImperativeHandle } from "react";
|
|
11
11
|
import ReactDOM, { createPortal } from "react-dom";
|
|
12
12
|
import { withRef as withRef$1, cn as cn$2, withCn, createPrimitiveElement, withVariants, withProps, useComposedRef as useComposedRef$1, PortalBody } from "@udecode/cn";
|
|
13
13
|
import { HEADING_KEYS as HEADING_KEYS$1, HEADING_LEVELS as HEADING_LEVELS$1 } from "@udecode/plate-heading";
|
|
@@ -15,7 +15,7 @@ import { isHotkey } from "is-hotkey";
|
|
|
15
15
|
import clsx$1, { clsx } from "clsx";
|
|
16
16
|
import { Slot } from "@radix-ui/react-slot";
|
|
17
17
|
import { isLangSupported, formatCodeBlock, insertEmptyCodeBlock, unwrapCodeBlock, isCodeBlockEmpty, isSelectionAtCodeBlockStart } from "@udecode/plate-code-block";
|
|
18
|
-
import { X, Search, ChevronDown, Check, AlertTriangle, BracesIcon, Plus, AlignCenter as AlignCenter$1, AlignJustify, AlignLeft as AlignLeft$1, AlignRight as AlignRight$1, PaintBucket, Quote, ChevronRight, ChevronsUpDown, FileCode, Baseline, RectangleVertical, Combine, Ungroup, MessageSquare, MessageSquarePlus, Trash, GripVertical, Edit2, Smile, ExternalLink, Heading1, Heading2, Heading3, Heading4, Heading5, Heading6, Indent, Keyboard, WrapText, Minus, MoreHorizontal, Outdent, Pilcrow, RotateCcw, RectangleHorizontal, Settings, Strikethrough, Subscript, Superscript, Table, Text as Text$2, Underline, Link2Off, Eye, SeparatorHorizontal, Moon, SunMedium, Twitter, PaintBucketIcon, CombineIcon, SquareSplitHorizontalIcon, Grid2X2Icon, Trash2Icon, ArrowUp, ArrowDown, XIcon, ArrowLeft, ArrowRight, EraserIcon, ChevronDownIcon as ChevronDownIcon$1, ChevronUp, Clock, CalendarCheck, Calendar as Calendar$1, CalendarDays, RotateCw, ChevronLeft, LoaderCircle, TriangleAlert, EllipsisVertical, GitBranchIcon, List as List$1, ListOrdered, Grid3x3Icon, Link, Unlink } from "lucide-react";
|
|
18
|
+
import { X, Search, ChevronDown, Check, AlertTriangle, BracesIcon, Plus, AlignCenter as AlignCenter$1, AlignJustify, AlignLeft as AlignLeft$1, AlignRight as AlignRight$1, PaintBucket, Quote, ChevronRight, ChevronsUpDown, FileCode, Baseline, RectangleVertical, Combine, Ungroup, MessageSquare, MessageSquarePlus, Trash, GripVertical, Edit2, Smile, ExternalLink, Heading1, Heading2, Heading3, Heading4, Heading5, Heading6, Indent, Keyboard, WrapText, Minus, MoreHorizontal, Outdent, Pilcrow, RotateCcw, RectangleHorizontal, Settings, Strikethrough, Subscript, Superscript, Table, Text as Text$2, Underline, Link2Off, Eye, SeparatorHorizontal, Moon, SunMedium, Twitter, PaintBucketIcon, CombineIcon, SquareSplitHorizontalIcon, Grid2X2Icon, Trash2Icon, ArrowUp, ArrowDown, XIcon, ArrowLeft, ArrowRight, EraserIcon, ChevronDownIcon as ChevronDownIcon$1, ChevronUp, Clock, CalendarCheck, Calendar as Calendar$1, CalendarDays, RotateCw, ChevronLeft, LoaderCircle, TriangleAlert, History, EllipsisVertical, GitBranchIcon, List as List$1, ListOrdered, Grid3x3Icon, CircleX, Link, Unlink } from "lucide-react";
|
|
19
19
|
import mermaid from "mermaid";
|
|
20
20
|
import { cva } from "class-variance-authority";
|
|
21
21
|
import { Command as Command$2 } from "cmdk";
|
|
@@ -1414,21 +1414,29 @@ function isDraftable$1(value) {
|
|
|
1414
1414
|
return isPlainObject$4(value) || Array.isArray(value) || !!value[DRAFTABLE] || !!((_a2 = value.constructor) == null ? void 0 : _a2[DRAFTABLE]) || isMap$2(value) || isSet$2(value);
|
|
1415
1415
|
}
|
|
1416
1416
|
var objectCtorString$1 = Object.prototype.constructor.toString();
|
|
1417
|
+
var cachedCtorStrings = /* @__PURE__ */ new WeakMap();
|
|
1417
1418
|
function isPlainObject$4(value) {
|
|
1418
1419
|
if (!value || typeof value !== "object")
|
|
1419
1420
|
return false;
|
|
1420
|
-
const proto = getPrototypeOf(value);
|
|
1421
|
-
if (proto === null)
|
|
1421
|
+
const proto = Object.getPrototypeOf(value);
|
|
1422
|
+
if (proto === null || proto === Object.prototype)
|
|
1422
1423
|
return true;
|
|
1423
|
-
}
|
|
1424
1424
|
const Ctor = Object.hasOwnProperty.call(proto, "constructor") && proto.constructor;
|
|
1425
1425
|
if (Ctor === Object)
|
|
1426
1426
|
return true;
|
|
1427
|
-
|
|
1427
|
+
if (typeof Ctor !== "function")
|
|
1428
|
+
return false;
|
|
1429
|
+
let ctorString = cachedCtorStrings.get(Ctor);
|
|
1430
|
+
if (ctorString === void 0) {
|
|
1431
|
+
ctorString = Function.toString.call(Ctor);
|
|
1432
|
+
cachedCtorStrings.set(Ctor, ctorString);
|
|
1433
|
+
}
|
|
1434
|
+
return ctorString === objectCtorString$1;
|
|
1428
1435
|
}
|
|
1429
|
-
function each(obj, iter) {
|
|
1436
|
+
function each(obj, iter, strict = true) {
|
|
1430
1437
|
if (getArchtype(obj) === 0) {
|
|
1431
|
-
Reflect.ownKeys(obj).
|
|
1438
|
+
const keys2 = strict ? Reflect.ownKeys(obj) : Object.keys(obj);
|
|
1439
|
+
keys2.forEach((key) => {
|
|
1432
1440
|
iter(key, obj[key], obj);
|
|
1433
1441
|
});
|
|
1434
1442
|
} else {
|
|
@@ -1511,17 +1519,27 @@ function freeze$1(obj, deep = false) {
|
|
|
1511
1519
|
if (isFrozen(obj) || isDraft$1(obj) || !isDraftable$1(obj))
|
|
1512
1520
|
return obj;
|
|
1513
1521
|
if (getArchtype(obj) > 1) {
|
|
1514
|
-
|
|
1522
|
+
Object.defineProperties(obj, {
|
|
1523
|
+
set: dontMutateMethodOverride,
|
|
1524
|
+
add: dontMutateMethodOverride,
|
|
1525
|
+
clear: dontMutateMethodOverride,
|
|
1526
|
+
delete: dontMutateMethodOverride
|
|
1527
|
+
});
|
|
1515
1528
|
}
|
|
1516
1529
|
Object.freeze(obj);
|
|
1517
1530
|
if (deep)
|
|
1518
|
-
Object.
|
|
1531
|
+
Object.values(obj).forEach((value) => freeze$1(value, true));
|
|
1519
1532
|
return obj;
|
|
1520
1533
|
}
|
|
1521
1534
|
function dontMutateFrozenCollections() {
|
|
1522
1535
|
die(2);
|
|
1523
1536
|
}
|
|
1537
|
+
var dontMutateMethodOverride = {
|
|
1538
|
+
value: dontMutateFrozenCollections
|
|
1539
|
+
};
|
|
1524
1540
|
function isFrozen(obj) {
|
|
1541
|
+
if (obj === null || typeof obj !== "object")
|
|
1542
|
+
return true;
|
|
1525
1543
|
return Object.isFrozen(obj);
|
|
1526
1544
|
}
|
|
1527
1545
|
var plugins = {};
|
|
@@ -1609,11 +1627,13 @@ function processResult(result, scope) {
|
|
|
1609
1627
|
function finalize(rootScope, value, path3) {
|
|
1610
1628
|
if (isFrozen(value))
|
|
1611
1629
|
return value;
|
|
1630
|
+
const useStrictIteration = rootScope.immer_.shouldUseStrictIteration();
|
|
1612
1631
|
const state = value[DRAFT_STATE];
|
|
1613
1632
|
if (!state) {
|
|
1614
1633
|
each(
|
|
1615
1634
|
value,
|
|
1616
|
-
(key, childValue) => finalizeProperty(rootScope, state, value, key, childValue, path3)
|
|
1635
|
+
(key, childValue) => finalizeProperty(rootScope, state, value, key, childValue, path3),
|
|
1636
|
+
useStrictIteration
|
|
1617
1637
|
);
|
|
1618
1638
|
return value;
|
|
1619
1639
|
}
|
|
@@ -1636,7 +1656,16 @@ function finalize(rootScope, value, path3) {
|
|
|
1636
1656
|
}
|
|
1637
1657
|
each(
|
|
1638
1658
|
resultEach,
|
|
1639
|
-
(key, childValue) => finalizeProperty(
|
|
1659
|
+
(key, childValue) => finalizeProperty(
|
|
1660
|
+
rootScope,
|
|
1661
|
+
state,
|
|
1662
|
+
result,
|
|
1663
|
+
key,
|
|
1664
|
+
childValue,
|
|
1665
|
+
path3,
|
|
1666
|
+
isSet2
|
|
1667
|
+
),
|
|
1668
|
+
useStrictIteration
|
|
1640
1669
|
);
|
|
1641
1670
|
maybeFreeze(rootScope, result, false);
|
|
1642
1671
|
if (path3 && rootScope.patches_) {
|
|
@@ -1651,6 +1680,16 @@ function finalize(rootScope, value, path3) {
|
|
|
1651
1680
|
return state.copy_;
|
|
1652
1681
|
}
|
|
1653
1682
|
function finalizeProperty(rootScope, parentState, targetObject, prop2, childValue, rootPath, targetIsSet) {
|
|
1683
|
+
if (childValue == null) {
|
|
1684
|
+
return;
|
|
1685
|
+
}
|
|
1686
|
+
if (typeof childValue !== "object" && !targetIsSet) {
|
|
1687
|
+
return;
|
|
1688
|
+
}
|
|
1689
|
+
const childIsFrozen = isFrozen(childValue);
|
|
1690
|
+
if (childIsFrozen && !targetIsSet) {
|
|
1691
|
+
return;
|
|
1692
|
+
}
|
|
1654
1693
|
if (process.env.NODE_ENV !== "production" && childValue === targetObject)
|
|
1655
1694
|
die(5);
|
|
1656
1695
|
if (isDraft$1(childValue)) {
|
|
@@ -1665,12 +1704,15 @@ function finalizeProperty(rootScope, parentState, targetObject, prop2, childValu
|
|
|
1665
1704
|
} else if (targetIsSet) {
|
|
1666
1705
|
targetObject.add(childValue);
|
|
1667
1706
|
}
|
|
1668
|
-
if (isDraftable$1(childValue) && !
|
|
1707
|
+
if (isDraftable$1(childValue) && !childIsFrozen) {
|
|
1669
1708
|
if (!rootScope.immer_.autoFreeze_ && rootScope.unfinalizedDrafts_ < 1) {
|
|
1670
1709
|
return;
|
|
1671
1710
|
}
|
|
1711
|
+
if (parentState && parentState.base_ && parentState.base_[prop2] === childValue && childIsFrozen) {
|
|
1712
|
+
return;
|
|
1713
|
+
}
|
|
1672
1714
|
finalize(rootScope, childValue);
|
|
1673
|
-
if ((!parentState || !parentState.scope_.parent_) && typeof prop2 !== "symbol" && Object.prototype.propertyIsEnumerable.call(targetObject, prop2))
|
|
1715
|
+
if ((!parentState || !parentState.scope_.parent_) && typeof prop2 !== "symbol" && (isMap$2(targetObject) ? targetObject.has(prop2) : Object.prototype.propertyIsEnumerable.call(targetObject, prop2)))
|
|
1674
1716
|
maybeFreeze(rootScope, childValue);
|
|
1675
1717
|
}
|
|
1676
1718
|
}
|
|
@@ -1866,6 +1908,7 @@ var Immer2 = class {
|
|
|
1866
1908
|
constructor(config) {
|
|
1867
1909
|
this.autoFreeze_ = true;
|
|
1868
1910
|
this.useStrictShallowCopy_ = false;
|
|
1911
|
+
this.useStrictIteration_ = true;
|
|
1869
1912
|
this.produce = (base, recipe, patchListener) => {
|
|
1870
1913
|
if (typeof base === "function" && typeof recipe !== "function") {
|
|
1871
1914
|
const defaultBase = recipe;
|
|
@@ -1928,6 +1971,8 @@ var Immer2 = class {
|
|
|
1928
1971
|
this.setAutoFreeze(config.autoFreeze);
|
|
1929
1972
|
if (typeof (config == null ? void 0 : config.useStrictShallowCopy) === "boolean")
|
|
1930
1973
|
this.setUseStrictShallowCopy(config.useStrictShallowCopy);
|
|
1974
|
+
if (typeof (config == null ? void 0 : config.useStrictIteration) === "boolean")
|
|
1975
|
+
this.setUseStrictIteration(config.useStrictIteration);
|
|
1931
1976
|
}
|
|
1932
1977
|
createDraft(base) {
|
|
1933
1978
|
if (!isDraftable$1(base))
|
|
@@ -1964,6 +2009,18 @@ var Immer2 = class {
|
|
|
1964
2009
|
setUseStrictShallowCopy(value) {
|
|
1965
2010
|
this.useStrictShallowCopy_ = value;
|
|
1966
2011
|
}
|
|
2012
|
+
/**
|
|
2013
|
+
* Pass false to use faster iteration that skips non-enumerable properties
|
|
2014
|
+
* but still handles symbols for compatibility.
|
|
2015
|
+
*
|
|
2016
|
+
* By default, strict iteration is enabled (includes all own properties).
|
|
2017
|
+
*/
|
|
2018
|
+
setUseStrictIteration(value) {
|
|
2019
|
+
this.useStrictIteration_ = value;
|
|
2020
|
+
}
|
|
2021
|
+
shouldUseStrictIteration() {
|
|
2022
|
+
return this.useStrictIteration_;
|
|
2023
|
+
}
|
|
1967
2024
|
applyPatches(base, patches) {
|
|
1968
2025
|
let i2;
|
|
1969
2026
|
for (i2 = patches.length - 1; i2 >= 0; i2--) {
|
|
@@ -2002,17 +2059,23 @@ function currentImpl(value) {
|
|
|
2002
2059
|
return value;
|
|
2003
2060
|
const state = value[DRAFT_STATE];
|
|
2004
2061
|
let copy2;
|
|
2062
|
+
let strict = true;
|
|
2005
2063
|
if (state) {
|
|
2006
2064
|
if (!state.modified_)
|
|
2007
2065
|
return state.base_;
|
|
2008
2066
|
state.finalized_ = true;
|
|
2009
2067
|
copy2 = shallowCopy$1(value, state.scope_.immer_.useStrictShallowCopy_);
|
|
2068
|
+
strict = state.scope_.immer_.shouldUseStrictIteration();
|
|
2010
2069
|
} else {
|
|
2011
2070
|
copy2 = shallowCopy$1(value, true);
|
|
2012
2071
|
}
|
|
2013
|
-
each(
|
|
2014
|
-
|
|
2015
|
-
|
|
2072
|
+
each(
|
|
2073
|
+
copy2,
|
|
2074
|
+
(key, childValue) => {
|
|
2075
|
+
set$3(copy2, key, currentImpl(childValue));
|
|
2076
|
+
},
|
|
2077
|
+
strict
|
|
2078
|
+
);
|
|
2016
2079
|
if (state) {
|
|
2017
2080
|
state.finalized_ = false;
|
|
2018
2081
|
}
|
|
@@ -2020,14 +2083,8 @@ function currentImpl(value) {
|
|
|
2020
2083
|
}
|
|
2021
2084
|
var immer = new Immer2();
|
|
2022
2085
|
var produce = immer.produce;
|
|
2023
|
-
immer.
|
|
2024
|
-
|
|
2025
|
-
);
|
|
2026
|
-
immer.setAutoFreeze.bind(immer);
|
|
2027
|
-
immer.setUseStrictShallowCopy.bind(immer);
|
|
2028
|
-
immer.applyPatches.bind(immer);
|
|
2029
|
-
var createDraft$1 = immer.createDraft.bind(immer);
|
|
2030
|
-
var finishDraft = immer.finishDraft.bind(immer);
|
|
2086
|
+
var createDraft$1 = /* @__PURE__ */ immer.createDraft.bind(immer);
|
|
2087
|
+
var finishDraft = /* @__PURE__ */ immer.finishDraft.bind(immer);
|
|
2031
2088
|
var PathRef = {
|
|
2032
2089
|
transform(ref, op) {
|
|
2033
2090
|
var {
|
|
@@ -10411,7 +10468,7 @@ var TextString = (props) => {
|
|
|
10411
10468
|
ref
|
|
10412
10469
|
}, initialText);
|
|
10413
10470
|
};
|
|
10414
|
-
var MemoizedText$1 = /* @__PURE__ */ memo
|
|
10471
|
+
var MemoizedText$1 = /* @__PURE__ */ memo(/* @__PURE__ */ forwardRef((props, ref) => {
|
|
10415
10472
|
return /* @__PURE__ */ React__default.createElement("span", {
|
|
10416
10473
|
"data-slate-string": true,
|
|
10417
10474
|
ref
|
|
@@ -15023,8 +15080,9 @@ const devtoolsImpl = (fn, devtoolsOptions = {}) => (set2, get2, api) => {
|
|
|
15023
15080
|
const r2 = set2(state, replace);
|
|
15024
15081
|
if (!isRecording)
|
|
15025
15082
|
return r2;
|
|
15026
|
-
const
|
|
15027
|
-
|
|
15083
|
+
const action = nameOrAction === void 0 ? {
|
|
15084
|
+
type: anonymousActionType || findCallerName(new Error().stack) || "anonymous"
|
|
15085
|
+
} : typeof nameOrAction === "string" ? { type: nameOrAction } : nameOrAction;
|
|
15028
15086
|
if (store === void 0) {
|
|
15029
15087
|
connection == null ? void 0 : connection.send(action, get2());
|
|
15030
15088
|
return r2;
|
|
@@ -15312,12 +15370,12 @@ const persistImpl = (config, baseOptions) => (set2, get2, api) => {
|
|
|
15312
15370
|
const savedSetState = api.setState;
|
|
15313
15371
|
api.setState = (state, replace) => {
|
|
15314
15372
|
savedSetState(state, replace);
|
|
15315
|
-
|
|
15373
|
+
return setItem();
|
|
15316
15374
|
};
|
|
15317
15375
|
const configResult = config(
|
|
15318
15376
|
(...args) => {
|
|
15319
15377
|
set2(...args);
|
|
15320
|
-
|
|
15378
|
+
return setItem();
|
|
15321
15379
|
},
|
|
15322
15380
|
get2,
|
|
15323
15381
|
api
|
|
@@ -33524,7 +33582,8 @@ const buttonVariants$2 = cva(
|
|
|
33524
33582
|
inlineLink: "text-base text-primary underline underline-offset-4",
|
|
33525
33583
|
link: "text-primary underline-offset-4 hover:underline",
|
|
33526
33584
|
outline: "border border-input bg-background hover:bg-accent hover:text-accent-foreground",
|
|
33527
|
-
secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80"
|
|
33585
|
+
secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80",
|
|
33586
|
+
tinaPrimary: "bg-tina-orange-dark text-white hover:bg-tina-orange-dark/90 disabled:bg-tina-orange-dark/50"
|
|
33528
33587
|
}
|
|
33529
33588
|
}
|
|
33530
33589
|
}
|
|
@@ -38720,9 +38779,6 @@ function BiListUl(props) {
|
|
|
38720
38779
|
function BiLockAlt(props) {
|
|
38721
38780
|
return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "d": "M12 2C9.243 2 7 4.243 7 7v3H6c-1.103 0-2 .897-2 2v8c0 1.103.897 2 2 2h12c1.103 0 2-.897 2-2v-8c0-1.103-.897-2-2-2h-1V7c0-2.757-2.243-5-5-5zm6 10 .002 8H6v-8h12zm-9-2V7c0-1.654 1.346-3 3-3s3 1.346 3 3v3H9z" }, "child": [] }] })(props);
|
|
38722
38781
|
}
|
|
38723
|
-
function BiLock(props) {
|
|
38724
|
-
return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "d": "M12 2C9.243 2 7 4.243 7 7v2H6c-1.103 0-2 .897-2 2v9c0 1.103.897 2 2 2h12c1.103 0 2-.897 2-2v-9c0-1.103-.897-2-2-2h-1V7c0-2.757-2.243-5-5-5zM9 7c0-1.654 1.346-3 3-3s3 1.346 3 3v2H9V7zm9.002 13H13v-2.278c.595-.347 1-.985 1-1.722 0-1.103-.897-2-2-2s-2 .897-2 2c0 .736.405 1.375 1 1.722V20H6v-9h12l.002 9z" }, "child": [] }] })(props);
|
|
38725
|
-
}
|
|
38726
38782
|
function BiMenu(props) {
|
|
38727
38783
|
return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "d": "M4 6h16v2H4zm0 5h16v2H4zm0 5h16v2H4z" }, "child": [] }] })(props);
|
|
38728
38784
|
}
|
|
@@ -43027,7 +43083,10 @@ const formatCurrentDate = ({
|
|
|
43027
43083
|
if (!dateFormat) {
|
|
43028
43084
|
return format$1(displayDate, timeFormat);
|
|
43029
43085
|
}
|
|
43030
|
-
return `${format$1(displayDate, dateFormat)} ${format$1(
|
|
43086
|
+
return `${format$1(displayDate, dateFormat)} ${format$1(
|
|
43087
|
+
displayDate,
|
|
43088
|
+
timeFormat
|
|
43089
|
+
)}`;
|
|
43031
43090
|
};
|
|
43032
43091
|
function Calendar({
|
|
43033
43092
|
className,
|
|
@@ -43429,7 +43488,8 @@ const DateTimePicker = React.forwardRef(
|
|
|
43429
43488
|
}),
|
|
43430
43489
|
[displayDate]
|
|
43431
43490
|
);
|
|
43432
|
-
const
|
|
43491
|
+
const localeAny = locale2;
|
|
43492
|
+
const { options, localize: localize2, formatLong: formatLong2 } = localeAny || {};
|
|
43433
43493
|
if (options && localize2 && formatLong2) {
|
|
43434
43494
|
({
|
|
43435
43495
|
...enUS,
|
|
@@ -43499,7 +43559,7 @@ const format$1 = (date, format2) => {
|
|
|
43499
43559
|
return m.format(format2);
|
|
43500
43560
|
};
|
|
43501
43561
|
const DateField = wrapFieldsWithMeta(
|
|
43502
|
-
({ input, field: { dateFormat, timeFormat, onChange, ...rest } }) => {
|
|
43562
|
+
({ input, field: { dateFormat, timeFormat, onChange, locale: locale2, ...rest } }) => {
|
|
43503
43563
|
const granularity = timeFormat ? "minute" : "day";
|
|
43504
43564
|
const inputRef = React__default.useRef(null);
|
|
43505
43565
|
React__default.useEffect(() => {
|
|
@@ -43970,7 +44030,7 @@ const Badge = ({
|
|
|
43970
44030
|
children
|
|
43971
44031
|
);
|
|
43972
44032
|
};
|
|
43973
|
-
const tableHeadingStyle = "px-3 py-3 text-left text-xs font-bold text-gray-700 tracking-wider";
|
|
44033
|
+
const tableHeadingStyle = "px-3 py-3 text-left text-xs font-bold text-gray-700 tracking-wider sticky top-0 bg-gray-100 z-20 border-b-2 border-gray-200 ";
|
|
43974
44034
|
function formatBranchName(str) {
|
|
43975
44035
|
const pattern = /[^/\w-]+/g;
|
|
43976
44036
|
const formattedStr = str.replace(pattern, "-");
|
|
@@ -44206,6 +44266,9 @@ const BranchSelector = ({
|
|
|
44206
44266
|
const [search, setSearch] = React.useState("");
|
|
44207
44267
|
const [filter2, setFilter] = React.useState("content");
|
|
44208
44268
|
const [sortValue, setSortValue] = React.useState("default");
|
|
44269
|
+
const [selectedBranch, setSelectedBranch] = React.useState(
|
|
44270
|
+
null
|
|
44271
|
+
);
|
|
44209
44272
|
const cms = useCMS$1();
|
|
44210
44273
|
const filteredBranchList = getFilteredBranchList(
|
|
44211
44274
|
branchList,
|
|
@@ -44265,7 +44328,19 @@ const BranchSelector = ({
|
|
|
44265
44328
|
}
|
|
44266
44329
|
]
|
|
44267
44330
|
}
|
|
44268
|
-
))), filteredBranchList.length === 0 && /* @__PURE__ */ React.createElement("div", { className: "block relative text-gray-300 italic py-1" }, "No branches to display"), filteredBranchList.length > 0 && /* @__PURE__ */ React.createElement("div", { className: "min-w-[192px] max-h-[24rem] overflow-y-auto w-full h-full
|
|
44331
|
+
))), filteredBranchList.length === 0 && /* @__PURE__ */ React.createElement("div", { className: "block relative text-gray-300 italic py-1" }, "No branches to display"), filteredBranchList.length > 0 && /* @__PURE__ */ React.createElement(TooltipProvider$1, null, /* @__PURE__ */ React.createElement("div", { className: "rounded-lg border border-gray-200 overflow-hidden" }, /* @__PURE__ */ React.createElement("div", { className: "min-w-[192px] max-h-[24rem] overflow-y-auto w-full h-full shadow-inner bg-white" }, /* @__PURE__ */ React.createElement("table", { className: "w-full table-auto max-h-[24rem]" }, /* @__PURE__ */ React.createElement("thead", { className: "sticky top-0 z-20 bg-gray-100 border-b-2 border-gray-200" }, /* @__PURE__ */ React.createElement("tr", null, /* @__PURE__ */ React.createElement("th", { className: `${tableHeadingStyle} w-auto` }, "Branch Name"), /* @__PURE__ */ React.createElement(
|
|
44332
|
+
"th",
|
|
44333
|
+
{
|
|
44334
|
+
className: `${tableHeadingStyle} w-0 whitespace-nowrap text-left`
|
|
44335
|
+
},
|
|
44336
|
+
"Last Updated"
|
|
44337
|
+
), /* @__PURE__ */ React.createElement(
|
|
44338
|
+
"th",
|
|
44339
|
+
{
|
|
44340
|
+
className: `${tableHeadingStyle} w-0 whitespace-nowrap text-left`
|
|
44341
|
+
},
|
|
44342
|
+
"Pull Request"
|
|
44343
|
+
))), /* @__PURE__ */ React.createElement("tbody", null, filteredBranchList.map((branch) => /* @__PURE__ */ React.createElement(
|
|
44269
44344
|
BranchItem,
|
|
44270
44345
|
{
|
|
44271
44346
|
key: branch.name,
|
|
@@ -44274,9 +44349,24 @@ const BranchSelector = ({
|
|
|
44274
44349
|
onChange,
|
|
44275
44350
|
refreshBranchList,
|
|
44276
44351
|
previewFunction,
|
|
44277
|
-
cms
|
|
44352
|
+
cms,
|
|
44353
|
+
selectedBranch,
|
|
44354
|
+
onSelectBranch: setSelectedBranch
|
|
44278
44355
|
}
|
|
44279
|
-
))))))
|
|
44356
|
+
))))))), /* @__PURE__ */ React.createElement("div", { className: "flex justify-end" }, /* @__PURE__ */ React.createElement(
|
|
44357
|
+
Button$2,
|
|
44358
|
+
{
|
|
44359
|
+
variant: "primary",
|
|
44360
|
+
onClick: () => {
|
|
44361
|
+
onChange(selectedBranch);
|
|
44362
|
+
},
|
|
44363
|
+
disabled: !selectedBranch || selectedBranch === currentBranch
|
|
44364
|
+
},
|
|
44365
|
+
"Open branch in editor"
|
|
44366
|
+
)));
|
|
44367
|
+
};
|
|
44368
|
+
const extractPullRequestId = (url) => {
|
|
44369
|
+
return url.split("/").pop() || "";
|
|
44280
44370
|
};
|
|
44281
44371
|
const BranchItem = ({
|
|
44282
44372
|
branch,
|
|
@@ -44284,9 +44374,11 @@ const BranchItem = ({
|
|
|
44284
44374
|
onChange,
|
|
44285
44375
|
refreshBranchList,
|
|
44286
44376
|
previewFunction,
|
|
44287
|
-
cms
|
|
44377
|
+
cms,
|
|
44378
|
+
selectedBranch,
|
|
44379
|
+
onSelectBranch
|
|
44288
44380
|
}) => {
|
|
44289
|
-
var _a2
|
|
44381
|
+
var _a2;
|
|
44290
44382
|
const [creatingPR, setCreatingPR] = React.useState(false);
|
|
44291
44383
|
const handleCreatePullRequest = async () => {
|
|
44292
44384
|
if (creatingPR)
|
|
@@ -44310,62 +44402,63 @@ const BranchItem = ({
|
|
|
44310
44402
|
}
|
|
44311
44403
|
};
|
|
44312
44404
|
const isCurrentBranch = branch.name === currentBranch;
|
|
44405
|
+
const isSelected2 = selectedBranch === branch.name;
|
|
44313
44406
|
const indexingStatus = (_a2 = branch == null ? void 0 : branch.indexStatus) == null ? void 0 : _a2.status;
|
|
44407
|
+
const handleRowClick = () => {
|
|
44408
|
+
if (indexingStatus === "complete" && !isCurrentBranch) {
|
|
44409
|
+
onSelectBranch(isSelected2 ? null : branch.name);
|
|
44410
|
+
}
|
|
44411
|
+
};
|
|
44314
44412
|
return /* @__PURE__ */ React.createElement(
|
|
44315
44413
|
"tr",
|
|
44316
44414
|
{
|
|
44317
|
-
|
|
44415
|
+
onClick: handleRowClick,
|
|
44416
|
+
className: `text-base border-l-0 transition-colors border-t-0 border-r-0 outline-none transition-all ease-out duration-150 ${indexingStatus !== "complete" ? "bg-gray-50 text-gray-400" : isCurrentBranch ? "border-b-2 border-gray-50" : isSelected2 ? "bg-blue-100 text-blue-900 border-b-2 border-blue-50 cursor-pointer" : "border-b-2 border-gray-50 hover:bg-gray-50/50 cursor-pointer"}`
|
|
44318
44417
|
},
|
|
44319
|
-
/* @__PURE__ */ React.createElement(
|
|
44418
|
+
/* @__PURE__ */ React.createElement(
|
|
44419
|
+
"td",
|
|
44420
|
+
{
|
|
44421
|
+
className: `pl-3 pr-3 max-w-xs ${isCurrentBranch ? "py-2.5" : "py-1.5"}`
|
|
44422
|
+
},
|
|
44423
|
+
/* @__PURE__ */ React.createElement("div", { className: "flex flex-col" }, /* @__PURE__ */ React.createElement("div", { className: "flex items-center gap-1 min-w-0" }, branch.protected ? /* @__PURE__ */ React.createElement(BiLockAlt, { className: "w-4 h-auto opacity-70 text-blue-500 flex-shrink-0" }) : /* @__PURE__ */ React.createElement(BiGitBranch, { className: "w-4 h-auto opacity-70 text-gray-600 flex-shrink-0" }), /* @__PURE__ */ React.createElement(Tooltip$1, { delayDuration: 300 }, /* @__PURE__ */ React.createElement(TooltipTrigger$1, { asChild: true }, /* @__PURE__ */ React.createElement("span", { className: "text-sm leading-tight truncate block min-w-0 cursor-default" }, branch.name)), /* @__PURE__ */ React.createElement(TooltipPortal, null, /* @__PURE__ */ React.createElement(TooltipContent$1, { side: "top" }, branch.name)))), isCurrentBranch && /* @__PURE__ */ React.createElement("div", { className: "w-fit mt-1" }, /* @__PURE__ */ React.createElement(
|
|
44424
|
+
Badge,
|
|
44425
|
+
{
|
|
44426
|
+
calloutStyle: "info",
|
|
44427
|
+
className: "w-fit flex-shrink-0",
|
|
44428
|
+
displayIcon: false
|
|
44429
|
+
},
|
|
44430
|
+
/* @__PURE__ */ React.createElement(BiPencil, { className: "w-3 h-auto inline-block mr-1" }),
|
|
44431
|
+
"Currently editing"
|
|
44432
|
+
)), indexingStatus !== "complete" && /* @__PURE__ */ React.createElement("div", { className: "w-fit mt-1" }, /* @__PURE__ */ React.createElement(IndexStatus, { indexingStatus: branch.indexStatus.status })))
|
|
44433
|
+
),
|
|
44320
44434
|
/* @__PURE__ */ React.createElement("td", { className: "px-3 py-1.5 min-w-0" }, creatingPR ? /* @__PURE__ */ React.createElement("div", { className: "flex items-center gap-2" }, /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement("div", { className: "text-xs font-bold text-blue-600" }, "Creating PR"), /* @__PURE__ */ React.createElement("span", { className: "text-sm leading-tight text-blue-500" }, "Please wait...")), /* @__PURE__ */ React.createElement(FaSpinner, { className: "w-3 h-auto animate-spin text-blue-500" })) : /* @__PURE__ */ React.createElement("span", { className: "text-sm leading-tight whitespace-nowrap" }, formatDistanceToNow$1(new Date(branch.indexStatus.timestamp), {
|
|
44321
44435
|
addSuffix: true
|
|
44322
44436
|
}))),
|
|
44323
|
-
/* @__PURE__ */ React.createElement("td", { className: "px-3 py-1.5
|
|
44437
|
+
/* @__PURE__ */ React.createElement("td", { className: "px-3 py-1.5 flex", onClick: (e3) => e3.stopPropagation() }, branch.githubPullRequestUrl ? /* @__PURE__ */ React.createElement(
|
|
44324
44438
|
Button$2,
|
|
44325
44439
|
{
|
|
44326
44440
|
variant: "white",
|
|
44327
44441
|
size: "custom",
|
|
44328
44442
|
onClick: () => {
|
|
44329
|
-
|
|
44443
|
+
window.open(branch.githubPullRequestUrl, "_blank");
|
|
44330
44444
|
},
|
|
44331
|
-
className: "cursor-pointer
|
|
44445
|
+
className: "cursor-pointer h-9 px-2 flex items-center gap-1",
|
|
44446
|
+
title: "Open Git Pull Request"
|
|
44332
44447
|
},
|
|
44333
|
-
/* @__PURE__ */ React.createElement(
|
|
44334
|
-
" ",
|
|
44335
|
-
|
|
44336
|
-
|
|
44337
|
-
|
|
44338
|
-
|
|
44339
|
-
|
|
44340
|
-
|
|
44341
|
-
|
|
44342
|
-
|
|
44343
|
-
|
|
44344
|
-
|
|
44345
|
-
|
|
44346
|
-
|
|
44347
|
-
}
|
|
44348
|
-
},
|
|
44349
|
-
!branch.githubPullRequestUrl && !branch.protected && !creatingPR && cms.api.tina.usingProtectedBranch() && {
|
|
44350
|
-
name: "create-pr",
|
|
44351
|
-
label: "Create Pull Request",
|
|
44352
|
-
Icon: /* @__PURE__ */ React.createElement(BiGitBranch, { className: "w-5 h-auto text-blue-500 opacity-70" }),
|
|
44353
|
-
onMouseDown: () => handleCreatePullRequest()
|
|
44354
|
-
},
|
|
44355
|
-
typeof previewFunction === "function" && ((_b = previewFunction({ branch: branch.name })) == null ? void 0 : _b.url) && {
|
|
44356
|
-
name: "preview",
|
|
44357
|
-
label: "Preview",
|
|
44358
|
-
onMouseDown: () => {
|
|
44359
|
-
var _a3;
|
|
44360
|
-
const previewUrl = (_a3 = previewFunction({
|
|
44361
|
-
branch: branch.name
|
|
44362
|
-
})) == null ? void 0 : _a3.url;
|
|
44363
|
-
window.open(previewUrl, "_blank");
|
|
44364
|
-
}
|
|
44365
|
-
}
|
|
44366
|
-
].filter(Boolean)
|
|
44367
|
-
}
|
|
44368
|
-
))
|
|
44448
|
+
/* @__PURE__ */ React.createElement(BiLinkExternal, { className: "h-3.5 w-auto text-gray-700 flex-shrink-0" }),
|
|
44449
|
+
/* @__PURE__ */ React.createElement("span", { className: "text-sm truncate max-w-[120px]" }, "PR: ", extractPullRequestId(branch.githubPullRequestUrl))
|
|
44450
|
+
) : !branch.protected && !creatingPR && cms.api.tina.usingProtectedBranch() ? /* @__PURE__ */ React.createElement(
|
|
44451
|
+
Button$2,
|
|
44452
|
+
{
|
|
44453
|
+
variant: "white",
|
|
44454
|
+
size: "custom",
|
|
44455
|
+
onClick: handleCreatePullRequest,
|
|
44456
|
+
className: "cursor-pointer h-9 px-2 flex items-center gap-1",
|
|
44457
|
+
title: "Create Pull Request"
|
|
44458
|
+
},
|
|
44459
|
+
/* @__PURE__ */ React.createElement(BiGitBranch, { className: "h-3.5 w-auto text-gray-700 flex-shrink-0" }),
|
|
44460
|
+
/* @__PURE__ */ React.createElement("span", { className: "text-sm whitespace-nowrap" }, "Create PR")
|
|
44461
|
+
) : null)
|
|
44369
44462
|
);
|
|
44370
44463
|
};
|
|
44371
44464
|
const IndexStatus = ({ indexingStatus }) => {
|
|
@@ -44469,7 +44562,7 @@ let Alerts$1 = class Alerts {
|
|
|
44469
44562
|
...eventsToAlerts
|
|
44470
44563
|
};
|
|
44471
44564
|
}
|
|
44472
|
-
add(level, message, timeout =
|
|
44565
|
+
add(level, message, timeout = 4e3) {
|
|
44473
44566
|
const alert = {
|
|
44474
44567
|
level,
|
|
44475
44568
|
message,
|
|
@@ -44483,7 +44576,7 @@ let Alerts$1 = class Alerts {
|
|
|
44483
44576
|
clearTimeout(timeoutId);
|
|
44484
44577
|
this.dismiss(alert);
|
|
44485
44578
|
};
|
|
44486
|
-
timeoutId = level !== "error" ? setTimeout(dismiss, alert.timeout) : null;
|
|
44579
|
+
timeoutId = level !== "error" && alert.timeout > 0 ? setTimeout(dismiss, alert.timeout) : null;
|
|
44487
44580
|
return dismiss;
|
|
44488
44581
|
}
|
|
44489
44582
|
dismiss(alert) {
|
|
@@ -46603,7 +46696,7 @@ const NavProvider = ({
|
|
|
46603
46696
|
};
|
|
46604
46697
|
return /* @__PURE__ */ React__default.createElement(NavContext.Provider, { value }, children);
|
|
46605
46698
|
};
|
|
46606
|
-
const version$1 = "3.
|
|
46699
|
+
const version$1 = "3.1.2";
|
|
46607
46700
|
const VersionInfo = () => {
|
|
46608
46701
|
var _a2, _b, _c, _d, _e, _f;
|
|
46609
46702
|
const cms = useCMS();
|
|
@@ -47289,8 +47382,25 @@ const Emoji$1 = ({ className = "", ...props }) => /* @__PURE__ */ React.createEl
|
|
|
47289
47382
|
...props
|
|
47290
47383
|
}
|
|
47291
47384
|
);
|
|
47385
|
+
const TooltipProvider = TooltipPrimitive.Provider;
|
|
47386
|
+
const Tooltip = TooltipPrimitive.Root;
|
|
47387
|
+
const TooltipTrigger = TooltipPrimitive.Trigger;
|
|
47388
|
+
const TooltipContent = React.forwardRef(({ className, sideOffset = 4, ...props }, ref) => /* @__PURE__ */ React.createElement(TooltipPrimitive.Portal, null, /* @__PURE__ */ React.createElement(
|
|
47389
|
+
TooltipPrimitive.Content,
|
|
47390
|
+
{
|
|
47391
|
+
ref,
|
|
47392
|
+
sideOffset,
|
|
47393
|
+
className: cn$1(
|
|
47394
|
+
"z-[10000] overflow-hidden rounded bg-[#FFF] px-3 py-1.5 text-xs text-[#504E5E] shadow-sm animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-tooltip-content-transform-origin]",
|
|
47395
|
+
className
|
|
47396
|
+
),
|
|
47397
|
+
...props
|
|
47398
|
+
}
|
|
47399
|
+
)));
|
|
47400
|
+
TooltipContent.displayName = TooltipPrimitive.Content.displayName;
|
|
47292
47401
|
const minimumTimeToShowLoadingIndicator = 1e3;
|
|
47293
47402
|
const FormsView = ({ loadingPlaceholder } = {}) => {
|
|
47403
|
+
var _a2, _b;
|
|
47294
47404
|
const cms = useCMS$1();
|
|
47295
47405
|
const { setFormIsPristine } = React.useContext(SidebarContext);
|
|
47296
47406
|
const [isShowingLoading, setIsShowingLoading] = React.useState(true);
|
|
@@ -47329,7 +47439,15 @@ const FormsView = ({ loadingPlaceholder } = {}) => {
|
|
|
47329
47439
|
return /* @__PURE__ */ React.createElement(FormLists, { isEditing });
|
|
47330
47440
|
}
|
|
47331
47441
|
const formMetas = cms.plugins.all("form:meta");
|
|
47332
|
-
return /* @__PURE__ */ React.createElement(React.Fragment, null, activeForm && /* @__PURE__ */ React.createElement(FormWrapper$1, { isEditing, isMultiform }, /* @__PURE__ */ React.createElement(
|
|
47442
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, activeForm && /* @__PURE__ */ React.createElement(FormWrapper$1, { isEditing, isMultiform }, /* @__PURE__ */ React.createElement(
|
|
47443
|
+
FormHeader,
|
|
47444
|
+
{
|
|
47445
|
+
activeForm,
|
|
47446
|
+
branch: cms.api.admin.api.branch,
|
|
47447
|
+
repoProvider: cms.api.admin.api.schema.config.config.repoProvider,
|
|
47448
|
+
isLocalMode: (_b = (_a2 = cms.api) == null ? void 0 : _a2.tina) == null ? void 0 : _b.isLocalMode
|
|
47449
|
+
}
|
|
47450
|
+
), formMetas == null ? void 0 : formMetas.map((meta) => /* @__PURE__ */ React.createElement(React.Fragment, { key: meta.name }, /* @__PURE__ */ React.createElement(meta.Component, null))), /* @__PURE__ */ React.createElement(FormBuilder, { form: activeForm, onPristineChange: setFormIsPristine })));
|
|
47333
47451
|
};
|
|
47334
47452
|
const FormWrapper$1 = ({ isEditing, children }) => {
|
|
47335
47453
|
return /* @__PURE__ */ React.createElement(
|
|
@@ -47350,9 +47468,54 @@ const FormWrapper$1 = ({ isEditing, children }) => {
|
|
|
47350
47468
|
children
|
|
47351
47469
|
);
|
|
47352
47470
|
};
|
|
47353
|
-
const FormHeader = ({
|
|
47471
|
+
const FormHeader = ({
|
|
47472
|
+
activeForm,
|
|
47473
|
+
repoProvider,
|
|
47474
|
+
branch,
|
|
47475
|
+
isLocalMode
|
|
47476
|
+
}) => {
|
|
47354
47477
|
const { formIsPristine } = React.useContext(SidebarContext);
|
|
47355
|
-
return /* @__PURE__ */ React.createElement("div", { className: "px-4 pt-2 pb-4 flex flex-row flex-nowrap justify-between items-center gap-2 bg-gradient-to-t from-white to-gray-50" }, /* @__PURE__ */ React.createElement(MultiformSelector, { activeForm }), /* @__PURE__ */ React.createElement(FormBreadcrumbs, { className: "w-[calc(100%-3rem)]" }), /* @__PURE__ */ React.createElement(
|
|
47478
|
+
return /* @__PURE__ */ React.createElement("div", { className: "px-4 pt-2 pb-4 flex flex-row flex-nowrap justify-between items-center gap-2 bg-gradient-to-t from-white to-gray-50" }, /* @__PURE__ */ React.createElement(MultiformSelector, { activeForm }), /* @__PURE__ */ React.createElement(FormBreadcrumbs, { className: "w-[calc(100%-3rem)]" }), /* @__PURE__ */ React.createElement(
|
|
47479
|
+
FileHistoryProvider,
|
|
47480
|
+
{
|
|
47481
|
+
defaultBranchName: repoProvider == null ? void 0 : repoProvider.defaultBranchName,
|
|
47482
|
+
historyUrl: repoProvider == null ? void 0 : repoProvider.historyUrl,
|
|
47483
|
+
contentRelativePath: activeForm.tinaForm.path,
|
|
47484
|
+
tinaBranch: branch,
|
|
47485
|
+
isLocalMode
|
|
47486
|
+
}
|
|
47487
|
+
), /* @__PURE__ */ React.createElement(FormStatus, { pristine: formIsPristine }));
|
|
47488
|
+
};
|
|
47489
|
+
const FileHistoryProvider = ({
|
|
47490
|
+
contentRelativePath,
|
|
47491
|
+
tinaBranch,
|
|
47492
|
+
defaultBranchName,
|
|
47493
|
+
historyUrl,
|
|
47494
|
+
isLocalMode
|
|
47495
|
+
}) => {
|
|
47496
|
+
if (!historyUrl) {
|
|
47497
|
+
return null;
|
|
47498
|
+
}
|
|
47499
|
+
const branch = isLocalMode ? defaultBranchName || tinaBranch : tinaBranch;
|
|
47500
|
+
if (!branch) {
|
|
47501
|
+
return null;
|
|
47502
|
+
}
|
|
47503
|
+
const { url } = historyUrl({
|
|
47504
|
+
relativePath: contentRelativePath,
|
|
47505
|
+
branch
|
|
47506
|
+
});
|
|
47507
|
+
if (!url) {
|
|
47508
|
+
return null;
|
|
47509
|
+
}
|
|
47510
|
+
return /* @__PURE__ */ React.createElement(TooltipProvider, null, /* @__PURE__ */ React.createElement(Tooltip, null, /* @__PURE__ */ React.createElement(TooltipTrigger, { asChild: true }, /* @__PURE__ */ React.createElement("button", { type: "button" }, /* @__PURE__ */ React.createElement(
|
|
47511
|
+
"a",
|
|
47512
|
+
{
|
|
47513
|
+
href: url,
|
|
47514
|
+
target: "_blank",
|
|
47515
|
+
className: "flex items-center gap-1 border-[0.5px] hover:bg-gray-300/10 transition-all duration-300 border-gray-300 rounded-md p-2"
|
|
47516
|
+
},
|
|
47517
|
+
/* @__PURE__ */ React.createElement(History, { className: "size-4 text-gray-700" })
|
|
47518
|
+
))), /* @__PURE__ */ React.createElement(TooltipContent, { side: "top", className: "shadow-md" }, "View file history")));
|
|
47356
47519
|
};
|
|
47357
47520
|
const FormBreadcrumbs = ({
|
|
47358
47521
|
rootBreadcrumbName,
|
|
@@ -48271,10 +48434,10 @@ function Alerts2({ alerts }) {
|
|
|
48271
48434
|
if (!alerts.all.length) {
|
|
48272
48435
|
return null;
|
|
48273
48436
|
}
|
|
48274
|
-
return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement("div", { className: "fixed
|
|
48437
|
+
return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement("div", { className: "fixed bottom-6 left-1/2 flex flex-col items-center z-[999999] -translate-x-1/2" }, alerts.all.filter((alert) => {
|
|
48275
48438
|
return alert.level !== "error";
|
|
48276
48439
|
}).map((alert) => {
|
|
48277
|
-
return /* @__PURE__ */ React__default.createElement(Alert, { key: alert.id, level: alert.level }, alert.level === "info" && /* @__PURE__ */ React__default.createElement(MdInfo, { className: "w-5 h-auto text-blue-500" }), alert.level === "success" && /* @__PURE__ */ React__default.createElement(MdCheckCircle, { className: "w-5 h-auto text-green-500" }), alert.level === "warn" && /* @__PURE__ */ React__default.createElement(MdWarning, { className: "w-5 h-auto text-yellow-500" }), /* @__PURE__ */ React__default.createElement("p", { className: "m-0 flex-1 max-w-[680px] text-left" }, parseUrlsInText(alert.message.toString())), /* @__PURE__ */ React__default.createElement(
|
|
48440
|
+
return /* @__PURE__ */ React__default.createElement(Alert, { key: alert.id, level: alert.level }, alert.level === "info" && /* @__PURE__ */ React__default.createElement(MdInfo, { className: "w-5 h-auto text-blue-500" }), alert.level === "success" && /* @__PURE__ */ React__default.createElement(MdCheckCircle, { className: "w-5 h-auto text-green-500" }), alert.level === "warn" && /* @__PURE__ */ React__default.createElement(MdWarning, { className: "w-5 h-auto text-yellow-500" }), /* @__PURE__ */ React__default.createElement("p", { className: "m-0 flex-1 max-w-[680px] text-left break-all" }, parseUrlsInText(alert.message.toString())), /* @__PURE__ */ React__default.createElement(
|
|
48278
48441
|
CloseAlert,
|
|
48279
48442
|
{
|
|
48280
48443
|
onClick: () => {
|
|
@@ -48341,7 +48504,7 @@ const Alert = ({
|
|
|
48341
48504
|
/* @__PURE__ */ React__default.createElement(
|
|
48342
48505
|
"div",
|
|
48343
48506
|
{
|
|
48344
|
-
className: `flex items-center gap-2 w-[350px] rounded-md border px-4 py-3 ${borderClasses[level]}`,
|
|
48507
|
+
className: `flex items-center gap-2 min-w-[350px] rounded-md border px-4 py-3 ${borderClasses[level]}`,
|
|
48345
48508
|
...props
|
|
48346
48509
|
}
|
|
48347
48510
|
)
|
|
@@ -48605,7 +48768,7 @@ const BranchButton = ({ className = "" }) => {
|
|
|
48605
48768
|
variant: "secondary",
|
|
48606
48769
|
size: "custom",
|
|
48607
48770
|
className: cn(
|
|
48608
|
-
"pointer-events-auto px-3 py-3 flex shrink gap-1 items-center justify-between",
|
|
48771
|
+
"pointer-events-auto px-3 py-3 flex shrink gap-1 items-center justify-between max-w-sm",
|
|
48609
48772
|
className
|
|
48610
48773
|
),
|
|
48611
48774
|
onClick: () => setOpen(true),
|
|
@@ -52261,7 +52424,7 @@ const nld = [
|
|
|
52261
52424
|
"in",
|
|
52262
52425
|
"is",
|
|
52263
52426
|
"ja",
|
|
52264
|
-
"je
|
|
52427
|
+
"je",
|
|
52265
52428
|
"kan",
|
|
52266
52429
|
"kon",
|
|
52267
52430
|
"kunnen",
|
|
@@ -63551,195 +63714,203 @@ var __publicField2 = (obj, key, value) => {
|
|
|
63551
63714
|
__defNormalProp2(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
63552
63715
|
return value;
|
|
63553
63716
|
};
|
|
63717
|
+
const INDEXABLE_NODE_TYPES = ["text", "code_block", "html"];
|
|
63554
63718
|
class StringBuilder {
|
|
63555
63719
|
constructor(limit) {
|
|
63556
|
-
__publicField2(this, "buffer");
|
|
63557
|
-
__publicField2(this, "length", 0);
|
|
63720
|
+
__publicField2(this, "buffer", []);
|
|
63558
63721
|
__publicField2(this, "limit");
|
|
63559
|
-
this
|
|
63722
|
+
__publicField2(this, "length", 0);
|
|
63560
63723
|
this.limit = limit;
|
|
63561
63724
|
}
|
|
63562
63725
|
append(str) {
|
|
63563
|
-
if (this.length + str.length > this.limit)
|
|
63726
|
+
if (this.length + str.length > this.limit)
|
|
63564
63727
|
return true;
|
|
63565
|
-
|
|
63566
|
-
|
|
63567
|
-
|
|
63568
|
-
if (this.length > this.limit) {
|
|
63569
|
-
return true;
|
|
63570
|
-
}
|
|
63571
|
-
return false;
|
|
63572
|
-
}
|
|
63728
|
+
this.buffer.push(str);
|
|
63729
|
+
this.length += str.length;
|
|
63730
|
+
return this.length > this.limit;
|
|
63573
63731
|
}
|
|
63574
63732
|
toString() {
|
|
63575
63733
|
return this.buffer.join(" ");
|
|
63576
63734
|
}
|
|
63577
63735
|
}
|
|
63578
|
-
const
|
|
63579
|
-
|
|
63580
|
-
|
|
63581
|
-
|
|
63582
|
-
|
|
63583
|
-
|
|
63584
|
-
|
|
63585
|
-
|
|
63586
|
-
|
|
63587
|
-
|
|
63736
|
+
const tokenizeString = (str) => {
|
|
63737
|
+
return str.split(/[\s\.,]+/).map((s2) => s2.toLowerCase()).filter((s2) => s2);
|
|
63738
|
+
};
|
|
63739
|
+
const extractText = (data, builder, nodeTypes) => {
|
|
63740
|
+
var _a2;
|
|
63741
|
+
if (!data)
|
|
63742
|
+
return;
|
|
63743
|
+
if (nodeTypes.includes(data.type ?? "") && (data.text || data.value)) {
|
|
63744
|
+
const tokens = tokenizeString(data.text || data.value || "");
|
|
63745
|
+
for (const token of tokens) {
|
|
63746
|
+
if (builder.append(token))
|
|
63747
|
+
return;
|
|
63588
63748
|
}
|
|
63589
|
-
(_b = (_a2 = data.children) == null ? void 0 : _a2.forEach) == null ? void 0 : _b.call(
|
|
63590
|
-
_a2,
|
|
63591
|
-
(child) => extractText(child, acc, indexableNodeTypes)
|
|
63592
|
-
);
|
|
63593
63749
|
}
|
|
63750
|
+
(_a2 = data.children) == null ? void 0 : _a2.forEach((child) => extractText(child, builder, nodeTypes));
|
|
63594
63751
|
};
|
|
63595
|
-
const
|
|
63752
|
+
const getRelativePath = (path3, collection) => {
|
|
63596
63753
|
return path3.replace(/\\/g, "/").replace(collection.path, "").replace(/^\/|\/$/g, "");
|
|
63597
63754
|
};
|
|
63598
|
-
const
|
|
63599
|
-
return str.split(/[\s\.,]+/).map((s2) => s2.toLowerCase()).filter((s2) => s2);
|
|
63600
|
-
};
|
|
63601
|
-
const processTextFieldValue = (value, maxLen) => {
|
|
63755
|
+
const processTextField = (value, maxLength) => {
|
|
63602
63756
|
const tokens = tokenizeString(value);
|
|
63603
|
-
const builder = new StringBuilder(
|
|
63757
|
+
const builder = new StringBuilder(maxLength);
|
|
63604
63758
|
for (const part of tokens) {
|
|
63605
|
-
if (builder.append(part))
|
|
63759
|
+
if (builder.append(part))
|
|
63606
63760
|
break;
|
|
63607
|
-
}
|
|
63608
63761
|
}
|
|
63609
63762
|
return builder.toString();
|
|
63610
63763
|
};
|
|
63764
|
+
const processRichTextField = (value, maxLength) => {
|
|
63765
|
+
const builder = new StringBuilder(maxLength);
|
|
63766
|
+
extractText(value, builder, INDEXABLE_NODE_TYPES);
|
|
63767
|
+
return builder.toString();
|
|
63768
|
+
};
|
|
63769
|
+
const processObjectField = (data, path3, collection, textIndexLength, field) => {
|
|
63770
|
+
if (field.list) {
|
|
63771
|
+
return data.map(
|
|
63772
|
+
(obj) => processDocumentForIndexing(obj, path3, collection, textIndexLength, field)
|
|
63773
|
+
);
|
|
63774
|
+
}
|
|
63775
|
+
return processDocumentForIndexing(
|
|
63776
|
+
data,
|
|
63777
|
+
path3,
|
|
63778
|
+
collection,
|
|
63779
|
+
textIndexLength,
|
|
63780
|
+
field
|
|
63781
|
+
);
|
|
63782
|
+
};
|
|
63783
|
+
const processStringField = (data, maxLength, isList) => {
|
|
63784
|
+
if (isList) {
|
|
63785
|
+
return data.map(
|
|
63786
|
+
(value) => processTextField(value, maxLength)
|
|
63787
|
+
);
|
|
63788
|
+
}
|
|
63789
|
+
return processTextField(data, maxLength);
|
|
63790
|
+
};
|
|
63791
|
+
const processRichTextFieldData = (data, maxLength, isList) => {
|
|
63792
|
+
if (isList) {
|
|
63793
|
+
return data.map(
|
|
63794
|
+
(value) => processRichTextField(value, maxLength)
|
|
63795
|
+
);
|
|
63796
|
+
}
|
|
63797
|
+
return processRichTextField(data, maxLength);
|
|
63798
|
+
};
|
|
63611
63799
|
const processDocumentForIndexing = (data, path3, collection, textIndexLength, field) => {
|
|
63612
63800
|
if (!field) {
|
|
63613
|
-
const
|
|
63614
|
-
data["_id"] = `${collection.name}:${
|
|
63615
|
-
data["_relativePath"] =
|
|
63801
|
+
const relativePath = getRelativePath(path3, collection);
|
|
63802
|
+
data["_id"] = `${collection.name}:${relativePath}`;
|
|
63803
|
+
data["_relativePath"] = relativePath;
|
|
63616
63804
|
}
|
|
63617
|
-
|
|
63805
|
+
const fields = (field == null ? void 0 : field.fields) || collection.fields || [];
|
|
63806
|
+
for (const f2 of fields) {
|
|
63618
63807
|
if (!f2.searchable) {
|
|
63619
63808
|
delete data[f2.name];
|
|
63620
63809
|
continue;
|
|
63621
63810
|
}
|
|
63622
|
-
|
|
63623
|
-
|
|
63624
|
-
|
|
63625
|
-
|
|
63626
|
-
|
|
63627
|
-
|
|
63628
|
-
|
|
63629
|
-
|
|
63630
|
-
|
|
63631
|
-
|
|
63632
|
-
|
|
63633
|
-
|
|
63634
|
-
|
|
63635
|
-
|
|
63636
|
-
|
|
63637
|
-
|
|
63638
|
-
|
|
63639
|
-
|
|
63640
|
-
|
|
63641
|
-
|
|
63642
|
-
|
|
63643
|
-
|
|
63644
|
-
|
|
63645
|
-
|
|
63646
|
-
|
|
63647
|
-
|
|
63648
|
-
|
|
63649
|
-
|
|
63650
|
-
} else {
|
|
63651
|
-
data[f2.name] = processTextFieldValue(
|
|
63652
|
-
data[f2.name],
|
|
63653
|
-
fieldTextIndexLength
|
|
63654
|
-
);
|
|
63655
|
-
}
|
|
63656
|
-
} else if (f2.type === "rich-text") {
|
|
63657
|
-
const fieldTextIndexLength = f2.maxSearchIndexFieldLength || textIndexLength;
|
|
63658
|
-
if (isList) {
|
|
63659
|
-
data[f2.name] = data[f2.name].map((value) => {
|
|
63660
|
-
const acc = new StringBuilder(fieldTextIndexLength);
|
|
63661
|
-
extractText(value, acc, ["text", "code_block", "html"]);
|
|
63662
|
-
return acc.toString();
|
|
63663
|
-
});
|
|
63664
|
-
} else {
|
|
63665
|
-
const acc = new StringBuilder(fieldTextIndexLength);
|
|
63666
|
-
extractText(data[f2.name], acc, ["text", "code_block", "html"]);
|
|
63667
|
-
data[f2.name] = acc.toString();
|
|
63668
|
-
}
|
|
63669
|
-
}
|
|
63811
|
+
if (!data[f2.name])
|
|
63812
|
+
continue;
|
|
63813
|
+
const fieldMaxLength = f2.maxSearchIndexFieldLength || textIndexLength;
|
|
63814
|
+
const isList = Boolean(f2.list);
|
|
63815
|
+
switch (f2.type) {
|
|
63816
|
+
case "object":
|
|
63817
|
+
data[f2.name] = processObjectField(
|
|
63818
|
+
data[f2.name],
|
|
63819
|
+
path3,
|
|
63820
|
+
collection,
|
|
63821
|
+
textIndexLength,
|
|
63822
|
+
f2
|
|
63823
|
+
);
|
|
63824
|
+
break;
|
|
63825
|
+
case "string":
|
|
63826
|
+
data[f2.name] = processStringField(
|
|
63827
|
+
data[f2.name],
|
|
63828
|
+
fieldMaxLength,
|
|
63829
|
+
isList
|
|
63830
|
+
);
|
|
63831
|
+
break;
|
|
63832
|
+
case "rich-text":
|
|
63833
|
+
data[f2.name] = processRichTextFieldData(
|
|
63834
|
+
data[f2.name],
|
|
63835
|
+
fieldMaxLength,
|
|
63836
|
+
isList
|
|
63837
|
+
);
|
|
63838
|
+
break;
|
|
63670
63839
|
}
|
|
63671
63840
|
}
|
|
63672
63841
|
return data;
|
|
63673
63842
|
};
|
|
63674
|
-
const
|
|
63843
|
+
const stopwordCache = {};
|
|
63844
|
+
const PRESERVED_WORDS = ["about"];
|
|
63675
63845
|
const lookupStopwords = (keys2, defaultStopWords = eng) => {
|
|
63676
63846
|
let stopwords = defaultStopWords;
|
|
63677
63847
|
if (keys2) {
|
|
63678
|
-
|
|
63679
|
-
|
|
63680
|
-
|
|
63681
|
-
stopwords = [];
|
|
63682
|
-
for (const key of keys2) {
|
|
63683
|
-
stopwords.push(...sw[key]);
|
|
63848
|
+
const cacheKey = keys2.join(",");
|
|
63849
|
+
if (stopwordCache[cacheKey]) {
|
|
63850
|
+
return stopwordCache[cacheKey];
|
|
63684
63851
|
}
|
|
63685
|
-
|
|
63852
|
+
stopwords = keys2.flatMap((key) => sw[key] || []);
|
|
63853
|
+
stopwordCache[cacheKey] = stopwords;
|
|
63686
63854
|
}
|
|
63687
|
-
return stopwords;
|
|
63855
|
+
return stopwords.filter((word) => !PRESERVED_WORDS.includes(word));
|
|
63688
63856
|
};
|
|
63689
63857
|
const queryToSearchIndexQuery = (query, stopwordLanguages) => {
|
|
63690
|
-
let q2;
|
|
63691
63858
|
const parts = query.split(" ");
|
|
63692
63859
|
const stopwords = lookupStopwords(stopwordLanguages);
|
|
63693
63860
|
if (parts.length === 1) {
|
|
63694
|
-
|
|
63695
|
-
} else {
|
|
63696
|
-
q2 = {
|
|
63697
|
-
AND: parts.filter(
|
|
63698
|
-
(part) => part.toLowerCase() !== "and" && stopwords.indexOf(part.toLowerCase()) === -1
|
|
63699
|
-
)
|
|
63700
|
-
};
|
|
63861
|
+
return { AND: [parts[0]] };
|
|
63701
63862
|
}
|
|
63702
|
-
|
|
63863
|
+
const filteredParts = parts.filter(
|
|
63864
|
+
(part) => part.toLowerCase() !== "and" && !stopwords.includes(part.toLowerCase())
|
|
63865
|
+
);
|
|
63866
|
+
return { AND: filteredParts };
|
|
63703
63867
|
};
|
|
63704
63868
|
const optionsToSearchIndexOptions = (options) => {
|
|
63705
|
-
|
|
63706
|
-
|
|
63707
|
-
|
|
63869
|
+
if (!(options == null ? void 0 : options.limit))
|
|
63870
|
+
return {};
|
|
63871
|
+
return {
|
|
63872
|
+
PAGE: {
|
|
63708
63873
|
SIZE: options.limit,
|
|
63709
|
-
NUMBER:
|
|
63710
|
-
}
|
|
63711
|
-
}
|
|
63712
|
-
return opt;
|
|
63874
|
+
NUMBER: options.cursor ? parseInt(options.cursor) : 0
|
|
63875
|
+
}
|
|
63876
|
+
};
|
|
63713
63877
|
};
|
|
63714
63878
|
const parseSearchIndexResponse = (data, options) => {
|
|
63715
|
-
const
|
|
63716
|
-
|
|
63717
|
-
if ((options == null ? void 0 : options.cursor) && (options == null ? void 0 : options.limit)) {
|
|
63718
|
-
const prevCursor = options.cursor === "0" ? null : (parseInt(options.cursor) - 1).toString();
|
|
63719
|
-
const nextCursor = total <= (parseInt(options.cursor) + 1) * options.limit ? null : (parseInt(options.cursor) + 1).toString();
|
|
63879
|
+
const resultArray = (data == null ? void 0 : data.RESULT) ?? (data == null ? void 0 : data.results);
|
|
63880
|
+
if (!data || !Array.isArray(resultArray)) {
|
|
63720
63881
|
return {
|
|
63721
|
-
results,
|
|
63722
|
-
total,
|
|
63723
|
-
prevCursor,
|
|
63724
|
-
nextCursor
|
|
63725
|
-
|
|
63726
|
-
} else if (!(options == null ? void 0 : options.cursor) && (options == null ? void 0 : options.limit)) {
|
|
63727
|
-
const prevCursor = null;
|
|
63728
|
-
const nextCursor = total <= options.limit ? null : "1";
|
|
63729
|
-
return {
|
|
63730
|
-
results,
|
|
63731
|
-
total,
|
|
63732
|
-
prevCursor,
|
|
63733
|
-
nextCursor
|
|
63882
|
+
results: [],
|
|
63883
|
+
total: 0,
|
|
63884
|
+
prevCursor: null,
|
|
63885
|
+
nextCursor: null,
|
|
63886
|
+
fuzzyMatches: void 0
|
|
63734
63887
|
};
|
|
63735
|
-
}
|
|
63888
|
+
}
|
|
63889
|
+
const results = data.RESULT ?? data.results;
|
|
63890
|
+
const total = data.RESULT_LENGTH ?? data.total ?? 0;
|
|
63891
|
+
const fuzzyMatches = data.FUZZY_MATCHES ?? data.fuzzyMatches;
|
|
63892
|
+
const nextCursor = data.NEXT_CURSOR ?? data.nextCursor;
|
|
63893
|
+
const prevCursor = data.PREV_CURSOR ?? data.prevCursor;
|
|
63894
|
+
if (nextCursor !== void 0 || prevCursor !== void 0) {
|
|
63736
63895
|
return {
|
|
63737
63896
|
results,
|
|
63738
63897
|
total,
|
|
63739
|
-
prevCursor: null,
|
|
63740
|
-
nextCursor: null
|
|
63898
|
+
prevCursor: prevCursor ?? null,
|
|
63899
|
+
nextCursor: nextCursor ?? null,
|
|
63900
|
+
fuzzyMatches
|
|
63741
63901
|
};
|
|
63742
63902
|
}
|
|
63903
|
+
const currentPage = (options == null ? void 0 : options.cursor) ? parseInt(options.cursor) : 0;
|
|
63904
|
+
const pageSize = options == null ? void 0 : options.limit;
|
|
63905
|
+
const hasPreviousPage = currentPage > 0;
|
|
63906
|
+
const hasNextPage = pageSize ? total > (currentPage + 1) * pageSize : false;
|
|
63907
|
+
return {
|
|
63908
|
+
results,
|
|
63909
|
+
total,
|
|
63910
|
+
prevCursor: hasPreviousPage ? (currentPage - 1).toString() : null,
|
|
63911
|
+
nextCursor: hasNextPage ? (currentPage + 1).toString() : null,
|
|
63912
|
+
fuzzyMatches
|
|
63913
|
+
};
|
|
63743
63914
|
};
|
|
63744
63915
|
const CREATE_DOCUMENT_GQL = `#graphql
|
|
63745
63916
|
mutation($collection: String!, $relativePath: String!, $params: DocumentMutation!) {
|
|
@@ -63795,7 +63966,7 @@ class TinaAdminApi {
|
|
|
63795
63966
|
fetchCollections() {
|
|
63796
63967
|
return this.schema.getCollections();
|
|
63797
63968
|
}
|
|
63798
|
-
async renameDocument({ collection, relativePath
|
|
63969
|
+
async renameDocument({ collection, relativePath, newRelativePath }) {
|
|
63799
63970
|
await this.api.request(
|
|
63800
63971
|
`#graphql
|
|
63801
63972
|
mutation RenameDocument($collection: String!, $relativePath: String! $newRelativePath: String!) {
|
|
@@ -63804,7 +63975,7 @@ class TinaAdminApi {
|
|
|
63804
63975
|
}
|
|
63805
63976
|
}
|
|
63806
63977
|
`,
|
|
63807
|
-
{ variables: { collection, relativePath
|
|
63978
|
+
{ variables: { collection, relativePath, newRelativePath } }
|
|
63808
63979
|
);
|
|
63809
63980
|
if (this.searchClient) {
|
|
63810
63981
|
const { document: doc } = await this.fetchDocument(
|
|
@@ -63818,18 +63989,18 @@ class TinaAdminApi {
|
|
|
63818
63989
|
this.maxSearchIndexFieldLength
|
|
63819
63990
|
);
|
|
63820
63991
|
await this.searchClient.put([processed]);
|
|
63821
|
-
await this.searchClient.del([`${collection.name}:${
|
|
63992
|
+
await this.searchClient.del([`${collection.name}:${relativePath}`]);
|
|
63822
63993
|
}
|
|
63823
63994
|
}
|
|
63824
63995
|
async deleteDocument({
|
|
63825
63996
|
collection,
|
|
63826
|
-
relativePath
|
|
63997
|
+
relativePath
|
|
63827
63998
|
}) {
|
|
63828
63999
|
var _a2;
|
|
63829
64000
|
await this.api.request(DELETE_DOCUMENT_GQL, {
|
|
63830
|
-
variables: { collection, relativePath
|
|
64001
|
+
variables: { collection, relativePath }
|
|
63831
64002
|
});
|
|
63832
|
-
await ((_a2 = this.searchClient) == null ? void 0 : _a2.del([`${collection}:${
|
|
64003
|
+
await ((_a2 = this.searchClient) == null ? void 0 : _a2.del([`${collection}:${relativePath}`]));
|
|
63833
64004
|
}
|
|
63834
64005
|
async fetchCollection(collectionName, includeDocuments, folder = "", after3, sortKey, order, filterArgs) {
|
|
63835
64006
|
let filter2 = null;
|
|
@@ -63984,7 +64155,7 @@ class TinaAdminApi {
|
|
|
63984
64155
|
}
|
|
63985
64156
|
}
|
|
63986
64157
|
}
|
|
63987
|
-
async fetchDocument(collectionName,
|
|
64158
|
+
async fetchDocument(collectionName, relativePath, values = true) {
|
|
63988
64159
|
let query;
|
|
63989
64160
|
if (values) {
|
|
63990
64161
|
query = `#graphql
|
|
@@ -64019,26 +64190,26 @@ class TinaAdminApi {
|
|
|
64019
64190
|
}`;
|
|
64020
64191
|
}
|
|
64021
64192
|
const response = await this.api.request(query, {
|
|
64022
|
-
variables: { collection: collectionName, relativePath
|
|
64193
|
+
variables: { collection: collectionName, relativePath }
|
|
64023
64194
|
});
|
|
64024
64195
|
return response;
|
|
64025
64196
|
}
|
|
64026
|
-
async createDocument(collection,
|
|
64197
|
+
async createDocument(collection, relativePath, params) {
|
|
64027
64198
|
const response = await this.api.request(CREATE_DOCUMENT_GQL, {
|
|
64028
64199
|
variables: {
|
|
64029
64200
|
collection: collection.name,
|
|
64030
|
-
relativePath
|
|
64201
|
+
relativePath,
|
|
64031
64202
|
params
|
|
64032
64203
|
}
|
|
64033
64204
|
});
|
|
64034
64205
|
if (this.searchClient) {
|
|
64035
64206
|
const { document: doc } = await this.fetchDocument(
|
|
64036
64207
|
collection.name,
|
|
64037
|
-
|
|
64208
|
+
relativePath
|
|
64038
64209
|
);
|
|
64039
64210
|
const processed = processDocumentForIndexing(
|
|
64040
64211
|
doc["_values"],
|
|
64041
|
-
`${collection.path}/${
|
|
64212
|
+
`${collection.path}/${relativePath}`,
|
|
64042
64213
|
collection,
|
|
64043
64214
|
this.maxSearchIndexFieldLength
|
|
64044
64215
|
);
|
|
@@ -64046,22 +64217,22 @@ class TinaAdminApi {
|
|
|
64046
64217
|
}
|
|
64047
64218
|
return response;
|
|
64048
64219
|
}
|
|
64049
|
-
async updateDocument(collection,
|
|
64220
|
+
async updateDocument(collection, relativePath, params) {
|
|
64050
64221
|
const response = await this.api.request(UPDATE_DOCUMENT_GQL, {
|
|
64051
64222
|
variables: {
|
|
64052
64223
|
collection: collection.name,
|
|
64053
|
-
relativePath
|
|
64224
|
+
relativePath,
|
|
64054
64225
|
params
|
|
64055
64226
|
}
|
|
64056
64227
|
});
|
|
64057
64228
|
if (this.searchClient) {
|
|
64058
64229
|
const { document: doc } = await this.fetchDocument(
|
|
64059
64230
|
collection.name,
|
|
64060
|
-
|
|
64231
|
+
relativePath
|
|
64061
64232
|
);
|
|
64062
64233
|
const processed = processDocumentForIndexing(
|
|
64063
64234
|
doc["_values"],
|
|
64064
|
-
`${collection.path}/${
|
|
64235
|
+
`${collection.path}/${relativePath}`,
|
|
64065
64236
|
collection,
|
|
64066
64237
|
this.maxSearchIndexFieldLength
|
|
64067
64238
|
);
|
|
@@ -64184,7 +64355,7 @@ const CreateBranchModal = ({
|
|
|
64184
64355
|
}
|
|
64185
64356
|
const collection = tinaApi.schema.getCollectionByFullPath(path3);
|
|
64186
64357
|
const params = tinaApi.schema.transformPayload(collection.name, values);
|
|
64187
|
-
const
|
|
64358
|
+
const relativePath = pathRelativeToCollection(collection.path, path3);
|
|
64188
64359
|
const result = await tinaApi.executeEditorialWorkflow({
|
|
64189
64360
|
branchName,
|
|
64190
64361
|
baseBranch: tinaApi.branch,
|
|
@@ -64193,7 +64364,7 @@ const CreateBranchModal = ({
|
|
|
64193
64364
|
query: graphql2,
|
|
64194
64365
|
variables: {
|
|
64195
64366
|
collection: collection.name,
|
|
64196
|
-
relativePath
|
|
64367
|
+
relativePath,
|
|
64197
64368
|
params
|
|
64198
64369
|
}
|
|
64199
64370
|
},
|
|
@@ -64221,10 +64392,11 @@ const CreateBranchModal = ({
|
|
|
64221
64392
|
}
|
|
64222
64393
|
setCurrentBranch(result.branchName);
|
|
64223
64394
|
cms.alerts.success(
|
|
64224
|
-
`Branch created successfully - Pull Request at ${result.pullRequestUrl}
|
|
64395
|
+
`Branch created successfully - Pull Request at ${result.pullRequestUrl}`,
|
|
64396
|
+
0
|
|
64225
64397
|
);
|
|
64226
64398
|
if (crudType === "create") {
|
|
64227
|
-
const folderPath =
|
|
64399
|
+
const folderPath = relativePath.includes("/") ? relativePath.substring(0, relativePath.lastIndexOf("/")) : "";
|
|
64228
64400
|
window.location.hash = `#/collections/${collection.name}${folderPath ? `/${folderPath}` : ""}`;
|
|
64229
64401
|
}
|
|
64230
64402
|
close2();
|
|
@@ -64590,7 +64762,7 @@ const Emoji = ({ className = "", ...props }) => /* @__PURE__ */ React.createElem
|
|
|
64590
64762
|
const CreateBranchModel = ({
|
|
64591
64763
|
close: close2,
|
|
64592
64764
|
safeSubmit,
|
|
64593
|
-
relativePath
|
|
64765
|
+
relativePath,
|
|
64594
64766
|
values,
|
|
64595
64767
|
crudType
|
|
64596
64768
|
}) => /* @__PURE__ */ React.createElement(
|
|
@@ -64598,7 +64770,7 @@ const CreateBranchModel = ({
|
|
|
64598
64770
|
{
|
|
64599
64771
|
close: close2,
|
|
64600
64772
|
safeSubmit,
|
|
64601
|
-
path:
|
|
64773
|
+
path: relativePath,
|
|
64602
64774
|
values,
|
|
64603
64775
|
crudType
|
|
64604
64776
|
}
|
|
@@ -65937,7 +66109,7 @@ const editorVariants = cva(
|
|
|
65937
66109
|
ai: "w-full px-0 text-base md:text-sm",
|
|
65938
66110
|
aiChat: "max-h-[min(70vh,320px)] w-full max-w-[700px] overflow-y-auto px-3 py-2 text-base md:text-sm",
|
|
65939
66111
|
comment: cn$2("rounded-none border-none bg-transparent text-sm"),
|
|
65940
|
-
default: "size-full px-2 sm:px-4 pt-2 text-base",
|
|
66112
|
+
default: "size-full px-2 sm:px-4 pt-2 text-base min-h-[100px]",
|
|
65941
66113
|
demo: "size-full px-2 sm:px-4 pt-2 text-base h-[650px]",
|
|
65942
66114
|
fullWidth: "size-full px-2 sm:px-4 pt-4 pb-72 text-base",
|
|
65943
66115
|
none: "",
|
|
@@ -67380,6 +67552,23 @@ function LinkFloatingToolbar({
|
|
|
67380
67552
|
}) {
|
|
67381
67553
|
const activeCommentId = usePluginOption({ key: "comment" }, "activeId");
|
|
67382
67554
|
const activeSuggestionId = usePluginOption({ key: "suggestion" }, "activeId");
|
|
67555
|
+
const { api, editor } = useEditorPlugin(LinkPlugin);
|
|
67556
|
+
const isUrlValidator = usePluginOption(LinkPlugin, "isUrl");
|
|
67557
|
+
const [currentUrl, setCurrentUrl] = React.useState("");
|
|
67558
|
+
const [isValidUrl, setIsValidUrl] = React.useState(true);
|
|
67559
|
+
const handleUrlInput = React.useCallback(
|
|
67560
|
+
(e3) => {
|
|
67561
|
+
const value = e3.currentTarget.value;
|
|
67562
|
+
setCurrentUrl(value);
|
|
67563
|
+
if (value && isUrlValidator) {
|
|
67564
|
+
const valid = isUrlValidator(value);
|
|
67565
|
+
setIsValidUrl(valid);
|
|
67566
|
+
} else {
|
|
67567
|
+
setIsValidUrl(true);
|
|
67568
|
+
}
|
|
67569
|
+
},
|
|
67570
|
+
[isUrlValidator]
|
|
67571
|
+
);
|
|
67383
67572
|
const floatingOptions = React.useMemo(() => {
|
|
67384
67573
|
return {
|
|
67385
67574
|
middleware: [
|
|
@@ -67423,22 +67612,70 @@ function LinkFloatingToolbar({
|
|
|
67423
67612
|
});
|
|
67424
67613
|
if (hidden)
|
|
67425
67614
|
return null;
|
|
67426
|
-
const input = /* @__PURE__ */ React.createElement(
|
|
67427
|
-
|
|
67428
|
-
{
|
|
67429
|
-
className: inputVariants(),
|
|
67430
|
-
placeholder: "Paste link",
|
|
67431
|
-
"data-plate-focus": true
|
|
67432
|
-
}
|
|
67433
|
-
)), /* @__PURE__ */ React.createElement(Separator, { className: "my-1" }), /* @__PURE__ */ React.createElement("div", { className: "flex items-center" }, /* @__PURE__ */ React.createElement("div", { className: "flex items-center pr-1 pl-2 text-muted-foreground" }, /* @__PURE__ */ React.createElement(Text$2, { className: "size-4" })), /* @__PURE__ */ React.createElement(
|
|
67434
|
-
"input",
|
|
67615
|
+
const input = /* @__PURE__ */ React.createElement(
|
|
67616
|
+
"div",
|
|
67435
67617
|
{
|
|
67436
|
-
className:
|
|
67437
|
-
|
|
67438
|
-
|
|
67439
|
-
|
|
67440
|
-
|
|
67441
|
-
|
|
67618
|
+
className: "z-[999999] flex w-[330px] flex-col relative",
|
|
67619
|
+
...inputProps
|
|
67620
|
+
},
|
|
67621
|
+
!isValidUrl && currentUrl && /* @__PURE__ */ React.createElement("div", { className: "absolute -top-16 left-0 right-0 z-[1000000] mb-2" }, /* @__PURE__ */ React.createElement(
|
|
67622
|
+
"div",
|
|
67623
|
+
{
|
|
67624
|
+
className: "bg-red-50 border border-red-200 rounded-md p-2 shadow-lg",
|
|
67625
|
+
role: "alert",
|
|
67626
|
+
"aria-live": "polite"
|
|
67627
|
+
},
|
|
67628
|
+
/* @__PURE__ */ React.createElement("div", { className: "flex items-center" }, /* @__PURE__ */ React.createElement(CircleX, { className: "size-4 text-red-500 mr-2 flex-shrink-0" }), /* @__PURE__ */ React.createElement("span", { className: "text-sm text-red-700 text-wrap" }, "Invalid URL. Please prefix link with https:// or use a relative path like /about")),
|
|
67629
|
+
/* @__PURE__ */ React.createElement("div", { className: "absolute -bottom-1 left-4 w-2 h-2 bg-red-50 border-r border-b border-red-200 transform rotate-45" })
|
|
67630
|
+
)),
|
|
67631
|
+
/* @__PURE__ */ React.createElement("div", { className: "flex items-center" }, /* @__PURE__ */ React.createElement("div", { className: "flex items-center pr-1 pl-2 text-muted-foreground" }, /* @__PURE__ */ React.createElement(Link, { className: "size-4" })), /* @__PURE__ */ React.createElement(
|
|
67632
|
+
FloatingLinkUrlInput,
|
|
67633
|
+
{
|
|
67634
|
+
className: inputVariants(),
|
|
67635
|
+
placeholder: "Paste link",
|
|
67636
|
+
"data-plate-focus": true,
|
|
67637
|
+
onInput: handleUrlInput
|
|
67638
|
+
}
|
|
67639
|
+
)),
|
|
67640
|
+
/* @__PURE__ */ React.createElement(Separator, { className: "my-1" }),
|
|
67641
|
+
/* @__PURE__ */ React.createElement("div", { className: "flex items-center" }, /* @__PURE__ */ React.createElement("div", { className: "flex items-center pr-1 pl-2 text-muted-foreground" }, /* @__PURE__ */ React.createElement(Text$2, { className: "size-4" })), /* @__PURE__ */ React.createElement(
|
|
67642
|
+
"input",
|
|
67643
|
+
{
|
|
67644
|
+
className: inputVariants(),
|
|
67645
|
+
placeholder: "Text to display",
|
|
67646
|
+
"data-plate-focus": true,
|
|
67647
|
+
...textInputProps
|
|
67648
|
+
}
|
|
67649
|
+
)),
|
|
67650
|
+
/* @__PURE__ */ React.createElement(Separator, { className: "my-1" }),
|
|
67651
|
+
/* @__PURE__ */ React.createElement("div", { className: "flex items-center justify-end gap-2 px-2 py-1" }, /* @__PURE__ */ React.createElement(
|
|
67652
|
+
"button",
|
|
67653
|
+
{
|
|
67654
|
+
type: "button",
|
|
67655
|
+
className: buttonVariants$2({ size: "sm", variant: "ghost" }),
|
|
67656
|
+
onClick: () => {
|
|
67657
|
+
api.floatingLink.hide();
|
|
67658
|
+
}
|
|
67659
|
+
},
|
|
67660
|
+
"Cancel"
|
|
67661
|
+
), /* @__PURE__ */ React.createElement(
|
|
67662
|
+
"button",
|
|
67663
|
+
{
|
|
67664
|
+
type: "button",
|
|
67665
|
+
className: buttonVariants$2({
|
|
67666
|
+
size: "sm",
|
|
67667
|
+
variant: "tinaPrimary"
|
|
67668
|
+
}),
|
|
67669
|
+
onClick: () => {
|
|
67670
|
+
if (isValidUrl && currentUrl) {
|
|
67671
|
+
submitFloatingLink(editor);
|
|
67672
|
+
}
|
|
67673
|
+
},
|
|
67674
|
+
disabled: !isValidUrl && !!currentUrl
|
|
67675
|
+
},
|
|
67676
|
+
"OK"
|
|
67677
|
+
))
|
|
67678
|
+
);
|
|
67442
67679
|
const editContent = editState.isEditing ? input : /* @__PURE__ */ React.createElement("div", { className: "box-content flex items-center" }, /* @__PURE__ */ React.createElement(
|
|
67443
67680
|
"button",
|
|
67444
67681
|
{
|
|
@@ -67459,7 +67696,25 @@ function LinkFloatingToolbar({
|
|
|
67459
67696
|
},
|
|
67460
67697
|
/* @__PURE__ */ React.createElement(Unlink, { width: 18 })
|
|
67461
67698
|
));
|
|
67462
|
-
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
|
|
67699
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
|
|
67700
|
+
"div",
|
|
67701
|
+
{
|
|
67702
|
+
ref: insertRef,
|
|
67703
|
+
className: popoverVariants(),
|
|
67704
|
+
...insertProps,
|
|
67705
|
+
style: insertProps.style
|
|
67706
|
+
},
|
|
67707
|
+
input
|
|
67708
|
+
), /* @__PURE__ */ React.createElement(
|
|
67709
|
+
"div",
|
|
67710
|
+
{
|
|
67711
|
+
ref: editRef,
|
|
67712
|
+
className: popoverVariants(),
|
|
67713
|
+
...editProps,
|
|
67714
|
+
style: editProps.style
|
|
67715
|
+
},
|
|
67716
|
+
editContent
|
|
67717
|
+
));
|
|
67463
67718
|
}
|
|
67464
67719
|
function LinkOpenButton() {
|
|
67465
67720
|
const editor = useEditorRef();
|
|
@@ -119735,19 +119990,36 @@ class LocalClient extends Client {
|
|
|
119735
119990
|
}
|
|
119736
119991
|
class TinaCMSSearchClient {
|
|
119737
119992
|
constructor(client, tinaSearchConfig) {
|
|
119993
|
+
__publicField(this, "fuzzyEnabled");
|
|
119994
|
+
__publicField(this, "defaultFuzzyOptions");
|
|
119738
119995
|
this.client = client;
|
|
119739
119996
|
this.tinaSearchConfig = tinaSearchConfig;
|
|
119997
|
+
this.fuzzyEnabled = (tinaSearchConfig == null ? void 0 : tinaSearchConfig.fuzzyEnabled) !== false;
|
|
119998
|
+
this.defaultFuzzyOptions = tinaSearchConfig == null ? void 0 : tinaSearchConfig.fuzzyOptions;
|
|
119740
119999
|
}
|
|
119741
120000
|
async query(query, options) {
|
|
119742
120001
|
var _a2;
|
|
120002
|
+
const opt = optionsToSearchIndexOptions(options);
|
|
120003
|
+
const optionsParam = opt["PAGE"] ? `&options=${JSON.stringify(opt)}` : "";
|
|
119743
120004
|
const q2 = queryToSearchIndexQuery(
|
|
119744
120005
|
query,
|
|
119745
120006
|
(_a2 = this.tinaSearchConfig) == null ? void 0 : _a2.stopwordLanguages
|
|
119746
120007
|
);
|
|
119747
|
-
const
|
|
119748
|
-
|
|
120008
|
+
const useFuzzy = (options == null ? void 0 : options.fuzzy) !== void 0 ? options.fuzzy : this.fuzzyEnabled;
|
|
120009
|
+
let fuzzyParam = "";
|
|
120010
|
+
if (useFuzzy) {
|
|
120011
|
+
const mergedFuzzyOptions = {
|
|
120012
|
+
...this.defaultFuzzyOptions,
|
|
120013
|
+
...options == null ? void 0 : options.fuzzyOptions
|
|
120014
|
+
};
|
|
120015
|
+
fuzzyParam = `&fuzzy=${useFuzzy}&fuzzyOptions=${JSON.stringify(
|
|
120016
|
+
mergedFuzzyOptions
|
|
120017
|
+
)}`;
|
|
120018
|
+
}
|
|
119749
120019
|
const res = await this.client.authProvider.fetchWithToken(
|
|
119750
|
-
`${this.client.contentApiBase}/searchIndex/${this.client.clientId}/${this.client.getBranch()}?q=${JSON.stringify(
|
|
120020
|
+
`${this.client.contentApiBase}/searchIndex/${this.client.clientId}/${this.client.getBranch()}?q=${JSON.stringify(
|
|
120021
|
+
q2
|
|
120022
|
+
)}${optionsParam}${fuzzyParam}`
|
|
119751
120023
|
);
|
|
119752
120024
|
return parseSearchIndexResponse(await res.json(), options);
|
|
119753
120025
|
}
|
|
@@ -119782,15 +120054,33 @@ class TinaCMSSearchClient {
|
|
|
119782
120054
|
}
|
|
119783
120055
|
}
|
|
119784
120056
|
class LocalSearchClient {
|
|
119785
|
-
constructor(client) {
|
|
120057
|
+
constructor(client, tinaSearchConfig) {
|
|
120058
|
+
__publicField(this, "fuzzyEnabled");
|
|
120059
|
+
__publicField(this, "defaultFuzzyOptions");
|
|
119786
120060
|
this.client = client;
|
|
120061
|
+
this.tinaSearchConfig = tinaSearchConfig;
|
|
120062
|
+
this.fuzzyEnabled = (tinaSearchConfig == null ? void 0 : tinaSearchConfig.fuzzyEnabled) !== false;
|
|
120063
|
+
this.defaultFuzzyOptions = tinaSearchConfig == null ? void 0 : tinaSearchConfig.fuzzyOptions;
|
|
119787
120064
|
}
|
|
119788
120065
|
async query(query, options) {
|
|
119789
120066
|
const q2 = queryToSearchIndexQuery(query);
|
|
119790
120067
|
const opt = optionsToSearchIndexOptions(options);
|
|
119791
120068
|
const optionsParam = opt["PAGE"] ? `&options=${JSON.stringify(opt)}` : "";
|
|
120069
|
+
const useFuzzy = (options == null ? void 0 : options.fuzzy) !== void 0 ? options.fuzzy : this.fuzzyEnabled;
|
|
120070
|
+
let fuzzyParam = "";
|
|
120071
|
+
if (useFuzzy) {
|
|
120072
|
+
const mergedFuzzyOptions = {
|
|
120073
|
+
...this.defaultFuzzyOptions,
|
|
120074
|
+
...options == null ? void 0 : options.fuzzyOptions
|
|
120075
|
+
};
|
|
120076
|
+
fuzzyParam = `&fuzzy=${useFuzzy}&fuzzyOptions=${JSON.stringify(
|
|
120077
|
+
mergedFuzzyOptions
|
|
120078
|
+
)}`;
|
|
120079
|
+
}
|
|
119792
120080
|
const res = await this.client.authProvider.fetchWithToken(
|
|
119793
|
-
`http://localhost:4001/searchIndex?q=${JSON.stringify(
|
|
120081
|
+
`http://localhost:4001/searchIndex?q=${JSON.stringify(
|
|
120082
|
+
q2
|
|
120083
|
+
)}${optionsParam}${fuzzyParam}`
|
|
119794
120084
|
);
|
|
119795
120085
|
return parseSearchIndexResponse(await res.json(), options);
|
|
119796
120086
|
}
|
|
@@ -120097,19 +120387,22 @@ const TinaCloudProvider = (props) => {
|
|
|
120097
120387
|
cms.api.tina.setBranch(currentBranch);
|
|
120098
120388
|
}
|
|
120099
120389
|
useEffect(() => {
|
|
120100
|
-
var _a3, _b2, _c2, _d, _e, _f;
|
|
120390
|
+
var _a3, _b2, _c2, _d, _e, _f, _g, _h;
|
|
120101
120391
|
let searchClient;
|
|
120102
120392
|
if (props.isLocalClient) {
|
|
120103
|
-
searchClient = new LocalSearchClient(
|
|
120393
|
+
searchClient = new LocalSearchClient(
|
|
120394
|
+
cms.api.tina,
|
|
120395
|
+
(_b2 = (_a3 = props.schema.config) == null ? void 0 : _a3.search) == null ? void 0 : _b2.tina
|
|
120396
|
+
);
|
|
120104
120397
|
} else {
|
|
120105
|
-
const hasTinaSearch = Boolean((
|
|
120398
|
+
const hasTinaSearch = Boolean((_d = (_c2 = props.schema.config) == null ? void 0 : _c2.search) == null ? void 0 : _d.tina);
|
|
120106
120399
|
if (hasTinaSearch) {
|
|
120107
120400
|
searchClient = new TinaCMSSearchClient(
|
|
120108
120401
|
cms.api.tina,
|
|
120109
|
-
(
|
|
120402
|
+
(_f = (_e = props.schema.config) == null ? void 0 : _e.search) == null ? void 0 : _f.tina
|
|
120110
120403
|
);
|
|
120111
120404
|
} else {
|
|
120112
|
-
searchClient = (
|
|
120405
|
+
searchClient = (_h = (_g = props.schema.config) == null ? void 0 : _g.search) == null ? void 0 : _h.searchClient;
|
|
120113
120406
|
}
|
|
120114
120407
|
}
|
|
120115
120408
|
if (searchClient) {
|
|
@@ -120243,18 +120536,18 @@ class ContentCreatorPlugin {
|
|
|
120243
120536
|
this.onChange = options.onChange;
|
|
120244
120537
|
this.initialValues = options.initialValues;
|
|
120245
120538
|
}
|
|
120246
|
-
async onSubmit({ collection, template, relativePath
|
|
120539
|
+
async onSubmit({ collection, template, relativePath }, cms) {
|
|
120247
120540
|
try {
|
|
120248
120541
|
const selectedCollection = this.collections.find(
|
|
120249
120542
|
(collectionItem) => collectionItem.slug === collection
|
|
120250
120543
|
);
|
|
120251
120544
|
const collectionFormat = selectedCollection.format;
|
|
120252
120545
|
const extensionLength = -1 * (collectionFormat.length + 1);
|
|
120253
|
-
let relativePathWithExt =
|
|
120254
|
-
if (
|
|
120255
|
-
relativePathWithExt = `${
|
|
120546
|
+
let relativePathWithExt = relativePath;
|
|
120547
|
+
if (relativePath.slice(extensionLength).toLocaleLowerCase() === `.${collectionFormat}`) {
|
|
120548
|
+
relativePathWithExt = `${relativePath.slice(0, -3)}.${collectionFormat}`;
|
|
120256
120549
|
} else {
|
|
120257
|
-
relativePathWithExt = `${
|
|
120550
|
+
relativePathWithExt = `${relativePath}.${collectionFormat}`;
|
|
120258
120551
|
}
|
|
120259
120552
|
const payload = {
|
|
120260
120553
|
relativePath: relativePathWithExt,
|
|
@@ -120983,22 +121276,6 @@ const PageHeader = ({
|
|
|
120983
121276
|
return /* @__PURE__ */ React__default.createElement("div", { className: "pt-4 pb-2 px-6" }, /* @__PURE__ */ React__default.createElement("div", { className: "w-full flex justify-between items-end" }, children));
|
|
120984
121277
|
};
|
|
120985
121278
|
const PageBody = ({ children }) => /* @__PURE__ */ React__default.createElement("div", { className: "py-4 px-6" }, children);
|
|
120986
|
-
const TooltipProvider = TooltipPrimitive.Provider;
|
|
120987
|
-
const Tooltip = TooltipPrimitive.Root;
|
|
120988
|
-
const TooltipTrigger = TooltipPrimitive.Trigger;
|
|
120989
|
-
const TooltipContent = React.forwardRef(({ className, sideOffset = 4, ...props }, ref) => /* @__PURE__ */ React.createElement(TooltipPrimitive.Portal, null, /* @__PURE__ */ React.createElement(
|
|
120990
|
-
TooltipPrimitive.Content,
|
|
120991
|
-
{
|
|
120992
|
-
ref,
|
|
120993
|
-
sideOffset,
|
|
120994
|
-
className: cn$1(
|
|
120995
|
-
"z-[10000] overflow-hidden rounded bg-[#FFF] px-3 py-1.5 text-xs text-[#504E5E] shadow-sm animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-tooltip-content-transform-origin]",
|
|
120996
|
-
className
|
|
120997
|
-
),
|
|
120998
|
-
...props
|
|
120999
|
-
}
|
|
121000
|
-
)));
|
|
121001
|
-
TooltipContent.displayName = TooltipPrimitive.Content.displayName;
|
|
121002
121279
|
const folderRegex = /^.*\/~\/*(.*)$/;
|
|
121003
121280
|
const parentFolder = (folder) => {
|
|
121004
121281
|
return {
|
|
@@ -121171,6 +121448,10 @@ const CollectionListPage = () => {
|
|
|
121171
121448
|
booleanEquals: null
|
|
121172
121449
|
}));
|
|
121173
121450
|
}, [collectionName]);
|
|
121451
|
+
useEffect(() => {
|
|
121452
|
+
setEndCursor("");
|
|
121453
|
+
setPrevCursors([]);
|
|
121454
|
+
}, [search]);
|
|
121174
121455
|
const tableRowStyle = "hover:bg-gray-50/50 border-b-2 border-gray-50 transition-colors duration-300";
|
|
121175
121456
|
const tableHeadingCellStyle = "px-3 py-3 text-left text-xs font-bold text-gray-700 tracking-wider";
|
|
121176
121457
|
const tableHeadingStyle2 = "bg-gray-100 border-b-2 border-gray-200";
|
|
@@ -121430,6 +121711,8 @@ const CollectionListPage = () => {
|
|
|
121430
121711
|
))), /* @__PURE__ */ React__default.createElement("div", { className: "flex flex-1 flex-row gap-2 items-end w-full" }, searchEnabled ? /* @__PURE__ */ React__default.createElement(
|
|
121431
121712
|
SearchInput,
|
|
121432
121713
|
{
|
|
121714
|
+
cms,
|
|
121715
|
+
collectionName,
|
|
121433
121716
|
loading: _loading,
|
|
121434
121717
|
search,
|
|
121435
121718
|
setSearch,
|
|
@@ -121762,33 +122045,31 @@ const SearchInput = ({
|
|
|
121762
122045
|
setSearchInput
|
|
121763
122046
|
}) => {
|
|
121764
122047
|
const [searchLoaded, setSearchLoaded] = useState(false);
|
|
122048
|
+
const inputRef = React__default.useRef(null);
|
|
121765
122049
|
useEffect(() => {
|
|
121766
|
-
|
|
121767
|
-
setSearchLoaded(false);
|
|
121768
|
-
} else {
|
|
121769
|
-
setSearchLoaded(true);
|
|
121770
|
-
}
|
|
122050
|
+
setSearchLoaded(!loading);
|
|
121771
122051
|
}, [loading]);
|
|
121772
|
-
|
|
122052
|
+
const handleKeyDown = (e3) => {
|
|
122053
|
+
if (e3.key === "Enter") {
|
|
122054
|
+
e3.preventDefault();
|
|
122055
|
+
if (searchInput.trim()) {
|
|
122056
|
+
setSearch(searchInput);
|
|
122057
|
+
setSearchLoaded(false);
|
|
122058
|
+
}
|
|
122059
|
+
}
|
|
122060
|
+
};
|
|
122061
|
+
return /* @__PURE__ */ React__default.createElement("form", { className: "flex flex-1 flex-col gap-2 items-start w-full" }, /* @__PURE__ */ React__default.createElement("div", { className: "h-4" }), /* @__PURE__ */ React__default.createElement("div", { className: "flex flex-col md:flex-row items-start md:items-center w-full md:w-auto gap-3" }, /* @__PURE__ */ React__default.createElement("div", { className: "flex-1 min-w-[200px] w-full md:w-auto relative" }, /* @__PURE__ */ React__default.createElement(BiSearch, { className: "absolute left-3 top-1/2 -translate-y-1/2 w-5 h-5 text-gray-400 pointer-events-none z-10" }), /* @__PURE__ */ React__default.createElement(
|
|
121773
122062
|
"input",
|
|
121774
122063
|
{
|
|
122064
|
+
ref: inputRef,
|
|
121775
122065
|
type: "text",
|
|
121776
122066
|
name: "search",
|
|
121777
122067
|
placeholder: "Search...",
|
|
121778
122068
|
value: searchInput,
|
|
121779
|
-
onChange: (e3) =>
|
|
121780
|
-
|
|
121781
|
-
|
|
121782
|
-
|
|
121783
|
-
if (e3.key === "Enter") {
|
|
121784
|
-
e3.preventDefault();
|
|
121785
|
-
if (searchInput.trim()) {
|
|
121786
|
-
setSearch(searchInput);
|
|
121787
|
-
setSearchLoaded(false);
|
|
121788
|
-
}
|
|
121789
|
-
}
|
|
121790
|
-
},
|
|
121791
|
-
className: "shadow appearance-none bg-white block pl-10 pr-10 py-2 truncate w-full text-base border border-gray-200 focus:outline-none focus:shadow-outline focus:ring-blue-500 focus:border-blue-500 sm:text-sm rounded placeholder:text-gray-300 text-gray-600 focus:text-gray-900"
|
|
122069
|
+
onChange: (e3) => setSearchInput(e3.target.value),
|
|
122070
|
+
onKeyDown: handleKeyDown,
|
|
122071
|
+
className: "shadow appearance-none bg-white block pl-10 pr-10 py-2 truncate w-full text-base border border-gray-200 focus:outline-none focus:shadow-outline focus:ring-blue-500 focus:border-blue-500 sm:text-sm rounded placeholder:text-gray-300 text-gray-600 focus:text-gray-900",
|
|
122072
|
+
autoComplete: "off"
|
|
121792
122073
|
}
|
|
121793
122074
|
), search && searchLoaded && /* @__PURE__ */ React__default.createElement(
|
|
121794
122075
|
"button",
|
|
@@ -121798,7 +122079,7 @@ const SearchInput = ({
|
|
|
121798
122079
|
setSearch("");
|
|
121799
122080
|
setSearchInput("");
|
|
121800
122081
|
},
|
|
121801
|
-
className: "absolute right-3 top-1/2 -translate-y-1/2 text-gray-400 hover:text-gray-600 transition-colors"
|
|
122082
|
+
className: "absolute right-3 top-1/2 -translate-y-1/2 text-gray-400 hover:text-gray-600 transition-colors z-10"
|
|
121802
122083
|
},
|
|
121803
122084
|
/* @__PURE__ */ React__default.createElement(BiX, { className: "w-5 h-5" })
|
|
121804
122085
|
))));
|
|
@@ -122076,10 +122357,11 @@ const useSearchCollection = (cms, collectionName, includeDocuments = true, folde
|
|
|
122076
122357
|
cursor: after3
|
|
122077
122358
|
}
|
|
122078
122359
|
);
|
|
122360
|
+
const results = (response == null ? void 0 : response.results) ?? [];
|
|
122079
122361
|
const docs = await Promise.allSettled(
|
|
122080
|
-
|
|
122081
|
-
const [collection2,
|
|
122082
|
-
return api.fetchDocument(collection2,
|
|
122362
|
+
results.map((result) => {
|
|
122363
|
+
const [collection2, relativePath] = result._id.split(":");
|
|
122364
|
+
return api.fetchDocument(collection2, relativePath, false);
|
|
122083
122365
|
})
|
|
122084
122366
|
);
|
|
122085
122367
|
const edges2 = docs.filter((p2) => {
|
|
@@ -122087,21 +122369,22 @@ const useSearchCollection = (cms, collectionName, includeDocuments = true, folde
|
|
|
122087
122369
|
return p2.status === "fulfilled" && !!((_a2 = p2.value) == null ? void 0 : _a2.document);
|
|
122088
122370
|
}).map((result) => ({ node: result.value.document }));
|
|
122089
122371
|
const c2 = await api.fetchCollection(collectionName, false, "");
|
|
122090
|
-
|
|
122091
|
-
format:
|
|
122092
|
-
label:
|
|
122372
|
+
const collectionData = {
|
|
122373
|
+
format: c2.format,
|
|
122374
|
+
label: c2.label,
|
|
122093
122375
|
name: collectionName,
|
|
122094
|
-
templates:
|
|
122376
|
+
templates: c2.templates,
|
|
122095
122377
|
documents: {
|
|
122096
122378
|
pageInfo: {
|
|
122097
|
-
hasNextPage: !!response.nextCursor,
|
|
122098
|
-
hasPreviousPage: !!response.prevCursor,
|
|
122379
|
+
hasNextPage: !!(response == null ? void 0 : response.nextCursor),
|
|
122380
|
+
hasPreviousPage: !!(response == null ? void 0 : response.prevCursor),
|
|
122099
122381
|
startCursor: "",
|
|
122100
|
-
endCursor: response.nextCursor || ""
|
|
122382
|
+
endCursor: (response == null ? void 0 : response.nextCursor) || ""
|
|
122101
122383
|
},
|
|
122102
122384
|
edges: edges2
|
|
122103
122385
|
}
|
|
122104
|
-
}
|
|
122386
|
+
};
|
|
122387
|
+
setCollection(collectionData);
|
|
122105
122388
|
} catch (error22) {
|
|
122106
122389
|
cms.alerts.error(
|
|
122107
122390
|
`[${error22.name}] GetCollection failed: ${error22.message}`
|
|
@@ -122204,14 +122487,14 @@ const createDocument = async (cms, collection, template, mutationInfo, folder, v
|
|
|
122204
122487
|
throw new Error("Filename must be a string");
|
|
122205
122488
|
}
|
|
122206
122489
|
const appendFolder = folder && !filename.startsWith("/") ? `/${folder}/` : "/";
|
|
122207
|
-
const
|
|
122490
|
+
const relativePath = `${appendFolder}${filename}.${collection.format}`;
|
|
122208
122491
|
const params = api.schema.transformPayload(collection.name, {
|
|
122209
122492
|
_collection: collection.name,
|
|
122210
122493
|
...template && { _template: template.name },
|
|
122211
122494
|
...leftover
|
|
122212
122495
|
});
|
|
122213
122496
|
if (await api.isAuthenticated()) {
|
|
122214
|
-
await api.createDocument(collection,
|
|
122497
|
+
await api.createDocument(collection, relativePath, params);
|
|
122215
122498
|
} else {
|
|
122216
122499
|
const authMessage = `CreateDocument failed: User is no longer authenticated; please login and try again.`;
|
|
122217
122500
|
cms.alerts.error(authMessage);
|
|
@@ -122461,7 +122744,7 @@ const RenderForm$1 = ({
|
|
|
122461
122744
|
), /* @__PURE__ */ React__default.createElement(FormStatus, { pristine: formIsPristine }))
|
|
122462
122745
|
), activeForm && /* @__PURE__ */ React__default.createElement(FormBuilder, { form: activeForm, onPristineChange: setFormIsPristine })));
|
|
122463
122746
|
};
|
|
122464
|
-
const useGetDocument = (cms, collectionName,
|
|
122747
|
+
const useGetDocument = (cms, collectionName, relativePath) => {
|
|
122465
122748
|
const api = new TinaAdminApi(cms);
|
|
122466
122749
|
const [document2, setDocument] = useState(void 0);
|
|
122467
122750
|
const [loading, setLoading] = useState(true);
|
|
@@ -122473,7 +122756,7 @@ const useGetDocument = (cms, collectionName, relativePath2) => {
|
|
|
122473
122756
|
try {
|
|
122474
122757
|
const response = await api.fetchDocument(
|
|
122475
122758
|
collectionName,
|
|
122476
|
-
|
|
122759
|
+
relativePath
|
|
122477
122760
|
);
|
|
122478
122761
|
if (!isCancelled) {
|
|
122479
122762
|
setDocument(response.document);
|
|
@@ -122498,19 +122781,19 @@ const useGetDocument = (cms, collectionName, relativePath2) => {
|
|
|
122498
122781
|
return () => {
|
|
122499
122782
|
isCancelled = true;
|
|
122500
122783
|
};
|
|
122501
|
-
}, [cms, collectionName,
|
|
122784
|
+
}, [cms, collectionName, relativePath]);
|
|
122502
122785
|
return { document: document2, loading, error: error2 };
|
|
122503
122786
|
};
|
|
122504
122787
|
const GetDocument = ({
|
|
122505
122788
|
cms,
|
|
122506
122789
|
collectionName,
|
|
122507
|
-
relativePath
|
|
122790
|
+
relativePath,
|
|
122508
122791
|
children
|
|
122509
122792
|
}) => {
|
|
122510
122793
|
const { document: document2, loading, error: error2 } = useGetDocument(
|
|
122511
122794
|
cms,
|
|
122512
122795
|
collectionName,
|
|
122513
|
-
|
|
122796
|
+
relativePath
|
|
122514
122797
|
);
|
|
122515
122798
|
if (error2) {
|
|
122516
122799
|
return /* @__PURE__ */ React__default.createElement(FullscreenError, null);
|
|
@@ -122533,7 +122816,7 @@ const CollectionDuplicatePage = () => {
|
|
|
122533
122816
|
includeDocuments: false
|
|
122534
122817
|
},
|
|
122535
122818
|
(collection) => {
|
|
122536
|
-
const
|
|
122819
|
+
const relativePath = `${filename.startsWith("~/") ? filename.substring(2) : filename}.${collection.format}`;
|
|
122537
122820
|
const mutationInfo = {
|
|
122538
122821
|
includeCollection: true,
|
|
122539
122822
|
includeTemplate: !!collection.templates
|
|
@@ -122543,7 +122826,7 @@ const CollectionDuplicatePage = () => {
|
|
|
122543
122826
|
{
|
|
122544
122827
|
cms,
|
|
122545
122828
|
collectionName: collection.name,
|
|
122546
|
-
relativePath
|
|
122829
|
+
relativePath
|
|
122547
122830
|
},
|
|
122548
122831
|
(document2) => {
|
|
122549
122832
|
var _a2;
|
|
@@ -122563,11 +122846,11 @@ const CollectionDuplicatePage = () => {
|
|
|
122563
122846
|
}
|
|
122564
122847
|
));
|
|
122565
122848
|
};
|
|
122566
|
-
const updateDocument = async (cms,
|
|
122849
|
+
const updateDocument = async (cms, relativePath, collection, mutationInfo, values) => {
|
|
122567
122850
|
const api = new TinaAdminApi(cms);
|
|
122568
122851
|
const params = api.schema.transformPayload(collection.name, values);
|
|
122569
122852
|
if (await api.isAuthenticated()) {
|
|
122570
|
-
await api.updateDocument(collection,
|
|
122853
|
+
await api.updateDocument(collection, relativePath, params);
|
|
122571
122854
|
} else {
|
|
122572
122855
|
const authMessage = `UpdateDocument failed: User is no longer authenticated; please login and try again.`;
|
|
122573
122856
|
cms.alerts.error(authMessage);
|
|
@@ -122589,7 +122872,7 @@ const CollectionUpdatePage = () => {
|
|
|
122589
122872
|
includeDocuments: false
|
|
122590
122873
|
},
|
|
122591
122874
|
(collection) => {
|
|
122592
|
-
const
|
|
122875
|
+
const relativePath = `${resolvedFile}.${collection.format}`;
|
|
122593
122876
|
const mutationInfo = {
|
|
122594
122877
|
includeCollection: true,
|
|
122595
122878
|
includeTemplate: !!collection.templates
|
|
@@ -122599,7 +122882,7 @@ const CollectionUpdatePage = () => {
|
|
|
122599
122882
|
{
|
|
122600
122883
|
cms,
|
|
122601
122884
|
collectionName: collection.name,
|
|
122602
|
-
relativePath
|
|
122885
|
+
relativePath
|
|
122603
122886
|
},
|
|
122604
122887
|
(document2) => /* @__PURE__ */ React__default.createElement(
|
|
122605
122888
|
RenderForm,
|
|
@@ -122607,7 +122890,7 @@ const CollectionUpdatePage = () => {
|
|
|
122607
122890
|
cms,
|
|
122608
122891
|
document: document2,
|
|
122609
122892
|
filename: resolvedFile,
|
|
122610
|
-
relativePath
|
|
122893
|
+
relativePath,
|
|
122611
122894
|
collection,
|
|
122612
122895
|
mutationInfo
|
|
122613
122896
|
}
|
|
@@ -122620,10 +122903,11 @@ const RenderForm = ({
|
|
|
122620
122903
|
cms,
|
|
122621
122904
|
document: document2,
|
|
122622
122905
|
filename,
|
|
122623
|
-
relativePath
|
|
122906
|
+
relativePath,
|
|
122624
122907
|
collection,
|
|
122625
122908
|
mutationInfo
|
|
122626
122909
|
}) => {
|
|
122910
|
+
var _a2, _b, _c, _d;
|
|
122627
122911
|
const [formIsPristine, setFormIsPristine] = useState(true);
|
|
122628
122912
|
const schema = cms.api.tina.schema;
|
|
122629
122913
|
const schemaCollection = schema.getCollection(collection.name);
|
|
@@ -122640,7 +122924,7 @@ const RenderForm = ({
|
|
|
122640
122924
|
const form = useMemo(() => {
|
|
122641
122925
|
return new Form({
|
|
122642
122926
|
// id is the full document path
|
|
122643
|
-
id: canonicalPath(`${schemaCollection.path}/${
|
|
122927
|
+
id: canonicalPath(`${schemaCollection.path}/${relativePath}`),
|
|
122644
122928
|
label: "form",
|
|
122645
122929
|
fields: formInfo.fields,
|
|
122646
122930
|
initialValues: document2._values,
|
|
@@ -122648,7 +122932,7 @@ const RenderForm = ({
|
|
|
122648
122932
|
try {
|
|
122649
122933
|
await updateDocument(
|
|
122650
122934
|
cms,
|
|
122651
|
-
|
|
122935
|
+
relativePath,
|
|
122652
122936
|
collection,
|
|
122653
122937
|
mutationInfo,
|
|
122654
122938
|
values
|
|
@@ -122669,7 +122953,7 @@ const RenderForm = ({
|
|
|
122669
122953
|
}
|
|
122670
122954
|
}
|
|
122671
122955
|
});
|
|
122672
|
-
}, [cms, document2,
|
|
122956
|
+
}, [cms, document2, relativePath, collection, mutationInfo]);
|
|
122673
122957
|
React__default.useEffect(() => {
|
|
122674
122958
|
cms.dispatch({ type: "forms:add", value: form });
|
|
122675
122959
|
cms.dispatch({ type: "forms:set-active-form-id", value: form.id });
|
|
@@ -122695,6 +122979,15 @@ const RenderForm = ({
|
|
|
122695
122979
|
className: "w-[calc(100%-3rem)]",
|
|
122696
122980
|
rootBreadcrumbName: `${filename}.${collection.format}`
|
|
122697
122981
|
}
|
|
122982
|
+
), /* @__PURE__ */ React__default.createElement(
|
|
122983
|
+
FileHistoryProvider,
|
|
122984
|
+
{
|
|
122985
|
+
defaultBranchName: (_a2 = cms.api.admin.api.schema.config.config.repoProvider) == null ? void 0 : _a2.defaultBranchName,
|
|
122986
|
+
historyUrl: (_b = cms.api.admin.api.schema.config.config.repoProvider) == null ? void 0 : _b.historyUrl,
|
|
122987
|
+
contentRelativePath: relativePath,
|
|
122988
|
+
tinaBranch: cms.api.admin.api.branch,
|
|
122989
|
+
isLocalMode: (_d = (_c = cms.api) == null ? void 0 : _c.tina) == null ? void 0 : _d.isLocalMode
|
|
122990
|
+
}
|
|
122698
122991
|
), /* @__PURE__ */ React__default.createElement(FormStatus, { pristine: formIsPristine }))
|
|
122699
122992
|
), activeForm && /* @__PURE__ */ React__default.createElement(FormBuilder, { form: activeForm, onPristineChange: setFormIsPristine }));
|
|
122700
122993
|
};
|