tinacms 0.0.0-ac59522-20251205041248 → 0.0.0-ad128cc-20251219023808
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 +562 -332
- 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/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, CircleX, 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
|
|
@@ -38721,9 +38779,6 @@ function BiListUl(props) {
|
|
|
38721
38779
|
function BiLockAlt(props) {
|
|
38722
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);
|
|
38723
38781
|
}
|
|
38724
|
-
function BiLock(props) {
|
|
38725
|
-
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);
|
|
38726
|
-
}
|
|
38727
38782
|
function BiMenu(props) {
|
|
38728
38783
|
return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "d": "M4 6h16v2H4zm0 5h16v2H4zm0 5h16v2H4z" }, "child": [] }] })(props);
|
|
38729
38784
|
}
|
|
@@ -43028,7 +43083,10 @@ const formatCurrentDate = ({
|
|
|
43028
43083
|
if (!dateFormat) {
|
|
43029
43084
|
return format$1(displayDate, timeFormat);
|
|
43030
43085
|
}
|
|
43031
|
-
return `${format$1(displayDate, dateFormat)} ${format$1(
|
|
43086
|
+
return `${format$1(displayDate, dateFormat)} ${format$1(
|
|
43087
|
+
displayDate,
|
|
43088
|
+
timeFormat
|
|
43089
|
+
)}`;
|
|
43032
43090
|
};
|
|
43033
43091
|
function Calendar({
|
|
43034
43092
|
className,
|
|
@@ -43430,7 +43488,8 @@ const DateTimePicker = React.forwardRef(
|
|
|
43430
43488
|
}),
|
|
43431
43489
|
[displayDate]
|
|
43432
43490
|
);
|
|
43433
|
-
const
|
|
43491
|
+
const localeAny = locale2;
|
|
43492
|
+
const { options, localize: localize2, formatLong: formatLong2 } = localeAny || {};
|
|
43434
43493
|
if (options && localize2 && formatLong2) {
|
|
43435
43494
|
({
|
|
43436
43495
|
...enUS,
|
|
@@ -43500,7 +43559,7 @@ const format$1 = (date, format2) => {
|
|
|
43500
43559
|
return m.format(format2);
|
|
43501
43560
|
};
|
|
43502
43561
|
const DateField = wrapFieldsWithMeta(
|
|
43503
|
-
({ input, field: { dateFormat, timeFormat, onChange, ...rest } }) => {
|
|
43562
|
+
({ input, field: { dateFormat, timeFormat, onChange, locale: locale2, ...rest } }) => {
|
|
43504
43563
|
const granularity = timeFormat ? "minute" : "day";
|
|
43505
43564
|
const inputRef = React__default.useRef(null);
|
|
43506
43565
|
React__default.useEffect(() => {
|
|
@@ -43971,7 +44030,7 @@ const Badge = ({
|
|
|
43971
44030
|
children
|
|
43972
44031
|
);
|
|
43973
44032
|
};
|
|
43974
|
-
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 ";
|
|
43975
44034
|
function formatBranchName(str) {
|
|
43976
44035
|
const pattern = /[^/\w-]+/g;
|
|
43977
44036
|
const formattedStr = str.replace(pattern, "-");
|
|
@@ -44207,6 +44266,9 @@ const BranchSelector = ({
|
|
|
44207
44266
|
const [search, setSearch] = React.useState("");
|
|
44208
44267
|
const [filter2, setFilter] = React.useState("content");
|
|
44209
44268
|
const [sortValue, setSortValue] = React.useState("default");
|
|
44269
|
+
const [selectedBranch, setSelectedBranch] = React.useState(
|
|
44270
|
+
null
|
|
44271
|
+
);
|
|
44210
44272
|
const cms = useCMS$1();
|
|
44211
44273
|
const filteredBranchList = getFilteredBranchList(
|
|
44212
44274
|
branchList,
|
|
@@ -44266,7 +44328,19 @@ const BranchSelector = ({
|
|
|
44266
44328
|
}
|
|
44267
44329
|
]
|
|
44268
44330
|
}
|
|
44269
|
-
))), 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(
|
|
44270
44344
|
BranchItem,
|
|
44271
44345
|
{
|
|
44272
44346
|
key: branch.name,
|
|
@@ -44275,9 +44349,24 @@ const BranchSelector = ({
|
|
|
44275
44349
|
onChange,
|
|
44276
44350
|
refreshBranchList,
|
|
44277
44351
|
previewFunction,
|
|
44278
|
-
cms
|
|
44352
|
+
cms,
|
|
44353
|
+
selectedBranch,
|
|
44354
|
+
onSelectBranch: setSelectedBranch
|
|
44279
44355
|
}
|
|
44280
|
-
))))))
|
|
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() || "";
|
|
44281
44370
|
};
|
|
44282
44371
|
const BranchItem = ({
|
|
44283
44372
|
branch,
|
|
@@ -44285,9 +44374,11 @@ const BranchItem = ({
|
|
|
44285
44374
|
onChange,
|
|
44286
44375
|
refreshBranchList,
|
|
44287
44376
|
previewFunction,
|
|
44288
|
-
cms
|
|
44377
|
+
cms,
|
|
44378
|
+
selectedBranch,
|
|
44379
|
+
onSelectBranch
|
|
44289
44380
|
}) => {
|
|
44290
|
-
var _a2
|
|
44381
|
+
var _a2;
|
|
44291
44382
|
const [creatingPR, setCreatingPR] = React.useState(false);
|
|
44292
44383
|
const handleCreatePullRequest = async () => {
|
|
44293
44384
|
if (creatingPR)
|
|
@@ -44311,62 +44402,63 @@ const BranchItem = ({
|
|
|
44311
44402
|
}
|
|
44312
44403
|
};
|
|
44313
44404
|
const isCurrentBranch = branch.name === currentBranch;
|
|
44405
|
+
const isSelected2 = selectedBranch === branch.name;
|
|
44314
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
|
+
};
|
|
44315
44412
|
return /* @__PURE__ */ React.createElement(
|
|
44316
44413
|
"tr",
|
|
44317
44414
|
{
|
|
44318
|
-
|
|
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"}`
|
|
44319
44417
|
},
|
|
44320
|
-
/* @__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
|
+
),
|
|
44321
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), {
|
|
44322
44435
|
addSuffix: true
|
|
44323
44436
|
}))),
|
|
44324
|
-
/* @__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(
|
|
44325
44438
|
Button$2,
|
|
44326
44439
|
{
|
|
44327
44440
|
variant: "white",
|
|
44328
44441
|
size: "custom",
|
|
44329
44442
|
onClick: () => {
|
|
44330
|
-
|
|
44443
|
+
window.open(branch.githubPullRequestUrl, "_blank");
|
|
44331
44444
|
},
|
|
44332
|
-
className: "cursor-pointer
|
|
44445
|
+
className: "cursor-pointer h-9 px-2 flex items-center gap-1",
|
|
44446
|
+
title: "Open Git Pull Request"
|
|
44333
44447
|
},
|
|
44334
|
-
/* @__PURE__ */ React.createElement(
|
|
44335
|
-
" ",
|
|
44336
|
-
|
|
44337
|
-
|
|
44338
|
-
|
|
44339
|
-
|
|
44340
|
-
|
|
44341
|
-
|
|
44342
|
-
|
|
44343
|
-
|
|
44344
|
-
|
|
44345
|
-
|
|
44346
|
-
|
|
44347
|
-
|
|
44348
|
-
}
|
|
44349
|
-
},
|
|
44350
|
-
!branch.githubPullRequestUrl && !branch.protected && !creatingPR && cms.api.tina.usingProtectedBranch() && {
|
|
44351
|
-
name: "create-pr",
|
|
44352
|
-
label: "Create Pull Request",
|
|
44353
|
-
Icon: /* @__PURE__ */ React.createElement(BiGitBranch, { className: "w-5 h-auto text-blue-500 opacity-70" }),
|
|
44354
|
-
onMouseDown: () => handleCreatePullRequest()
|
|
44355
|
-
},
|
|
44356
|
-
typeof previewFunction === "function" && ((_b = previewFunction({ branch: branch.name })) == null ? void 0 : _b.url) && {
|
|
44357
|
-
name: "preview",
|
|
44358
|
-
label: "Preview",
|
|
44359
|
-
onMouseDown: () => {
|
|
44360
|
-
var _a3;
|
|
44361
|
-
const previewUrl = (_a3 = previewFunction({
|
|
44362
|
-
branch: branch.name
|
|
44363
|
-
})) == null ? void 0 : _a3.url;
|
|
44364
|
-
window.open(previewUrl, "_blank");
|
|
44365
|
-
}
|
|
44366
|
-
}
|
|
44367
|
-
].filter(Boolean)
|
|
44368
|
-
}
|
|
44369
|
-
))
|
|
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)
|
|
44370
44462
|
);
|
|
44371
44463
|
};
|
|
44372
44464
|
const IndexStatus = ({ indexingStatus }) => {
|
|
@@ -44470,7 +44562,7 @@ let Alerts$1 = class Alerts {
|
|
|
44470
44562
|
...eventsToAlerts
|
|
44471
44563
|
};
|
|
44472
44564
|
}
|
|
44473
|
-
add(level, message, timeout =
|
|
44565
|
+
add(level, message, timeout = 4e3) {
|
|
44474
44566
|
const alert = {
|
|
44475
44567
|
level,
|
|
44476
44568
|
message,
|
|
@@ -44484,7 +44576,7 @@ let Alerts$1 = class Alerts {
|
|
|
44484
44576
|
clearTimeout(timeoutId);
|
|
44485
44577
|
this.dismiss(alert);
|
|
44486
44578
|
};
|
|
44487
|
-
timeoutId = level !== "error" ? setTimeout(dismiss, alert.timeout) : null;
|
|
44579
|
+
timeoutId = level !== "error" && alert.timeout > 0 ? setTimeout(dismiss, alert.timeout) : null;
|
|
44488
44580
|
return dismiss;
|
|
44489
44581
|
}
|
|
44490
44582
|
dismiss(alert) {
|
|
@@ -46604,7 +46696,7 @@ const NavProvider = ({
|
|
|
46604
46696
|
};
|
|
46605
46697
|
return /* @__PURE__ */ React__default.createElement(NavContext.Provider, { value }, children);
|
|
46606
46698
|
};
|
|
46607
|
-
const version$1 = "3.
|
|
46699
|
+
const version$1 = "3.1.2";
|
|
46608
46700
|
const VersionInfo = () => {
|
|
46609
46701
|
var _a2, _b, _c, _d, _e, _f;
|
|
46610
46702
|
const cms = useCMS();
|
|
@@ -47290,8 +47382,25 @@ const Emoji$1 = ({ className = "", ...props }) => /* @__PURE__ */ React.createEl
|
|
|
47290
47382
|
...props
|
|
47291
47383
|
}
|
|
47292
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;
|
|
47293
47401
|
const minimumTimeToShowLoadingIndicator = 1e3;
|
|
47294
47402
|
const FormsView = ({ loadingPlaceholder } = {}) => {
|
|
47403
|
+
var _a2, _b;
|
|
47295
47404
|
const cms = useCMS$1();
|
|
47296
47405
|
const { setFormIsPristine } = React.useContext(SidebarContext);
|
|
47297
47406
|
const [isShowingLoading, setIsShowingLoading] = React.useState(true);
|
|
@@ -47330,7 +47439,15 @@ const FormsView = ({ loadingPlaceholder } = {}) => {
|
|
|
47330
47439
|
return /* @__PURE__ */ React.createElement(FormLists, { isEditing });
|
|
47331
47440
|
}
|
|
47332
47441
|
const formMetas = cms.plugins.all("form:meta");
|
|
47333
|
-
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 })));
|
|
47334
47451
|
};
|
|
47335
47452
|
const FormWrapper$1 = ({ isEditing, children }) => {
|
|
47336
47453
|
return /* @__PURE__ */ React.createElement(
|
|
@@ -47351,9 +47468,54 @@ const FormWrapper$1 = ({ isEditing, children }) => {
|
|
|
47351
47468
|
children
|
|
47352
47469
|
);
|
|
47353
47470
|
};
|
|
47354
|
-
const FormHeader = ({
|
|
47471
|
+
const FormHeader = ({
|
|
47472
|
+
activeForm,
|
|
47473
|
+
repoProvider,
|
|
47474
|
+
branch,
|
|
47475
|
+
isLocalMode
|
|
47476
|
+
}) => {
|
|
47355
47477
|
const { formIsPristine } = React.useContext(SidebarContext);
|
|
47356
|
-
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")));
|
|
47357
47519
|
};
|
|
47358
47520
|
const FormBreadcrumbs = ({
|
|
47359
47521
|
rootBreadcrumbName,
|
|
@@ -48272,10 +48434,10 @@ function Alerts2({ alerts }) {
|
|
|
48272
48434
|
if (!alerts.all.length) {
|
|
48273
48435
|
return null;
|
|
48274
48436
|
}
|
|
48275
|
-
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) => {
|
|
48276
48438
|
return alert.level !== "error";
|
|
48277
48439
|
}).map((alert) => {
|
|
48278
|
-
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(
|
|
48279
48441
|
CloseAlert,
|
|
48280
48442
|
{
|
|
48281
48443
|
onClick: () => {
|
|
@@ -48342,7 +48504,7 @@ const Alert = ({
|
|
|
48342
48504
|
/* @__PURE__ */ React__default.createElement(
|
|
48343
48505
|
"div",
|
|
48344
48506
|
{
|
|
48345
|
-
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]}`,
|
|
48346
48508
|
...props
|
|
48347
48509
|
}
|
|
48348
48510
|
)
|
|
@@ -48606,7 +48768,7 @@ const BranchButton = ({ className = "" }) => {
|
|
|
48606
48768
|
variant: "secondary",
|
|
48607
48769
|
size: "custom",
|
|
48608
48770
|
className: cn(
|
|
48609
|
-
"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",
|
|
48610
48772
|
className
|
|
48611
48773
|
),
|
|
48612
48774
|
onClick: () => setOpen(true),
|
|
@@ -52262,7 +52424,7 @@ const nld = [
|
|
|
52262
52424
|
"in",
|
|
52263
52425
|
"is",
|
|
52264
52426
|
"ja",
|
|
52265
|
-
"je
|
|
52427
|
+
"je",
|
|
52266
52428
|
"kan",
|
|
52267
52429
|
"kon",
|
|
52268
52430
|
"kunnen",
|
|
@@ -63552,195 +63714,203 @@ var __publicField2 = (obj, key, value) => {
|
|
|
63552
63714
|
__defNormalProp2(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
63553
63715
|
return value;
|
|
63554
63716
|
};
|
|
63717
|
+
const INDEXABLE_NODE_TYPES = ["text", "code_block", "html"];
|
|
63555
63718
|
class StringBuilder {
|
|
63556
63719
|
constructor(limit) {
|
|
63557
|
-
__publicField2(this, "buffer");
|
|
63558
|
-
__publicField2(this, "length", 0);
|
|
63720
|
+
__publicField2(this, "buffer", []);
|
|
63559
63721
|
__publicField2(this, "limit");
|
|
63560
|
-
this
|
|
63722
|
+
__publicField2(this, "length", 0);
|
|
63561
63723
|
this.limit = limit;
|
|
63562
63724
|
}
|
|
63563
63725
|
append(str) {
|
|
63564
|
-
if (this.length + str.length > this.limit)
|
|
63726
|
+
if (this.length + str.length > this.limit)
|
|
63565
63727
|
return true;
|
|
63566
|
-
|
|
63567
|
-
|
|
63568
|
-
|
|
63569
|
-
if (this.length > this.limit) {
|
|
63570
|
-
return true;
|
|
63571
|
-
}
|
|
63572
|
-
return false;
|
|
63573
|
-
}
|
|
63728
|
+
this.buffer.push(str);
|
|
63729
|
+
this.length += str.length;
|
|
63730
|
+
return this.length > this.limit;
|
|
63574
63731
|
}
|
|
63575
63732
|
toString() {
|
|
63576
63733
|
return this.buffer.join(" ");
|
|
63577
63734
|
}
|
|
63578
63735
|
}
|
|
63579
|
-
const
|
|
63580
|
-
|
|
63581
|
-
|
|
63582
|
-
|
|
63583
|
-
|
|
63584
|
-
|
|
63585
|
-
|
|
63586
|
-
|
|
63587
|
-
|
|
63588
|
-
|
|
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;
|
|
63589
63748
|
}
|
|
63590
|
-
(_b = (_a2 = data.children) == null ? void 0 : _a2.forEach) == null ? void 0 : _b.call(
|
|
63591
|
-
_a2,
|
|
63592
|
-
(child) => extractText(child, acc, indexableNodeTypes)
|
|
63593
|
-
);
|
|
63594
63749
|
}
|
|
63750
|
+
(_a2 = data.children) == null ? void 0 : _a2.forEach((child) => extractText(child, builder, nodeTypes));
|
|
63595
63751
|
};
|
|
63596
|
-
const
|
|
63752
|
+
const getRelativePath = (path3, collection) => {
|
|
63597
63753
|
return path3.replace(/\\/g, "/").replace(collection.path, "").replace(/^\/|\/$/g, "");
|
|
63598
63754
|
};
|
|
63599
|
-
const
|
|
63600
|
-
return str.split(/[\s\.,]+/).map((s2) => s2.toLowerCase()).filter((s2) => s2);
|
|
63601
|
-
};
|
|
63602
|
-
const processTextFieldValue = (value, maxLen) => {
|
|
63755
|
+
const processTextField = (value, maxLength) => {
|
|
63603
63756
|
const tokens = tokenizeString(value);
|
|
63604
|
-
const builder = new StringBuilder(
|
|
63757
|
+
const builder = new StringBuilder(maxLength);
|
|
63605
63758
|
for (const part of tokens) {
|
|
63606
|
-
if (builder.append(part))
|
|
63759
|
+
if (builder.append(part))
|
|
63607
63760
|
break;
|
|
63608
|
-
}
|
|
63609
63761
|
}
|
|
63610
63762
|
return builder.toString();
|
|
63611
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
|
+
};
|
|
63612
63799
|
const processDocumentForIndexing = (data, path3, collection, textIndexLength, field) => {
|
|
63613
63800
|
if (!field) {
|
|
63614
|
-
const
|
|
63615
|
-
data["_id"] = `${collection.name}:${
|
|
63616
|
-
data["_relativePath"] =
|
|
63801
|
+
const relativePath = getRelativePath(path3, collection);
|
|
63802
|
+
data["_id"] = `${collection.name}:${relativePath}`;
|
|
63803
|
+
data["_relativePath"] = relativePath;
|
|
63617
63804
|
}
|
|
63618
|
-
|
|
63805
|
+
const fields = (field == null ? void 0 : field.fields) || collection.fields || [];
|
|
63806
|
+
for (const f2 of fields) {
|
|
63619
63807
|
if (!f2.searchable) {
|
|
63620
63808
|
delete data[f2.name];
|
|
63621
63809
|
continue;
|
|
63622
63810
|
}
|
|
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
|
-
|
|
63651
|
-
} else {
|
|
63652
|
-
data[f2.name] = processTextFieldValue(
|
|
63653
|
-
data[f2.name],
|
|
63654
|
-
fieldTextIndexLength
|
|
63655
|
-
);
|
|
63656
|
-
}
|
|
63657
|
-
} else if (f2.type === "rich-text") {
|
|
63658
|
-
const fieldTextIndexLength = f2.maxSearchIndexFieldLength || textIndexLength;
|
|
63659
|
-
if (isList) {
|
|
63660
|
-
data[f2.name] = data[f2.name].map((value) => {
|
|
63661
|
-
const acc = new StringBuilder(fieldTextIndexLength);
|
|
63662
|
-
extractText(value, acc, ["text", "code_block", "html"]);
|
|
63663
|
-
return acc.toString();
|
|
63664
|
-
});
|
|
63665
|
-
} else {
|
|
63666
|
-
const acc = new StringBuilder(fieldTextIndexLength);
|
|
63667
|
-
extractText(data[f2.name], acc, ["text", "code_block", "html"]);
|
|
63668
|
-
data[f2.name] = acc.toString();
|
|
63669
|
-
}
|
|
63670
|
-
}
|
|
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;
|
|
63671
63839
|
}
|
|
63672
63840
|
}
|
|
63673
63841
|
return data;
|
|
63674
63842
|
};
|
|
63675
|
-
const
|
|
63843
|
+
const stopwordCache = {};
|
|
63844
|
+
const PRESERVED_WORDS = ["about"];
|
|
63676
63845
|
const lookupStopwords = (keys2, defaultStopWords = eng) => {
|
|
63677
63846
|
let stopwords = defaultStopWords;
|
|
63678
63847
|
if (keys2) {
|
|
63679
|
-
|
|
63680
|
-
|
|
63848
|
+
const cacheKey = keys2.join(",");
|
|
63849
|
+
if (stopwordCache[cacheKey]) {
|
|
63850
|
+
return stopwordCache[cacheKey];
|
|
63681
63851
|
}
|
|
63682
|
-
stopwords = [];
|
|
63683
|
-
|
|
63684
|
-
stopwords.push(...sw[key]);
|
|
63685
|
-
}
|
|
63686
|
-
memo[keys2.join(",")] = stopwords;
|
|
63852
|
+
stopwords = keys2.flatMap((key) => sw[key] || []);
|
|
63853
|
+
stopwordCache[cacheKey] = stopwords;
|
|
63687
63854
|
}
|
|
63688
|
-
return stopwords;
|
|
63855
|
+
return stopwords.filter((word) => !PRESERVED_WORDS.includes(word));
|
|
63689
63856
|
};
|
|
63690
63857
|
const queryToSearchIndexQuery = (query, stopwordLanguages) => {
|
|
63691
|
-
let q2;
|
|
63692
63858
|
const parts = query.split(" ");
|
|
63693
63859
|
const stopwords = lookupStopwords(stopwordLanguages);
|
|
63694
63860
|
if (parts.length === 1) {
|
|
63695
|
-
|
|
63696
|
-
} else {
|
|
63697
|
-
q2 = {
|
|
63698
|
-
AND: parts.filter(
|
|
63699
|
-
(part) => part.toLowerCase() !== "and" && stopwords.indexOf(part.toLowerCase()) === -1
|
|
63700
|
-
)
|
|
63701
|
-
};
|
|
63861
|
+
return { AND: [parts[0]] };
|
|
63702
63862
|
}
|
|
63703
|
-
|
|
63863
|
+
const filteredParts = parts.filter(
|
|
63864
|
+
(part) => part.toLowerCase() !== "and" && !stopwords.includes(part.toLowerCase())
|
|
63865
|
+
);
|
|
63866
|
+
return { AND: filteredParts };
|
|
63704
63867
|
};
|
|
63705
63868
|
const optionsToSearchIndexOptions = (options) => {
|
|
63706
|
-
|
|
63707
|
-
|
|
63708
|
-
|
|
63869
|
+
if (!(options == null ? void 0 : options.limit))
|
|
63870
|
+
return {};
|
|
63871
|
+
return {
|
|
63872
|
+
PAGE: {
|
|
63709
63873
|
SIZE: options.limit,
|
|
63710
|
-
NUMBER:
|
|
63711
|
-
}
|
|
63712
|
-
}
|
|
63713
|
-
return opt;
|
|
63874
|
+
NUMBER: options.cursor ? parseInt(options.cursor) : 0
|
|
63875
|
+
}
|
|
63876
|
+
};
|
|
63714
63877
|
};
|
|
63715
63878
|
const parseSearchIndexResponse = (data, options) => {
|
|
63716
|
-
const
|
|
63717
|
-
|
|
63718
|
-
if ((options == null ? void 0 : options.cursor) && (options == null ? void 0 : options.limit)) {
|
|
63719
|
-
const prevCursor = options.cursor === "0" ? null : (parseInt(options.cursor) - 1).toString();
|
|
63720
|
-
const nextCursor = total <= (parseInt(options.cursor) + 1) * options.limit ? null : (parseInt(options.cursor) + 1).toString();
|
|
63721
|
-
return {
|
|
63722
|
-
results,
|
|
63723
|
-
total,
|
|
63724
|
-
prevCursor,
|
|
63725
|
-
nextCursor
|
|
63726
|
-
};
|
|
63727
|
-
} else if (!(options == null ? void 0 : options.cursor) && (options == null ? void 0 : options.limit)) {
|
|
63728
|
-
const prevCursor = null;
|
|
63729
|
-
const nextCursor = total <= options.limit ? null : "1";
|
|
63879
|
+
const resultArray = (data == null ? void 0 : data.RESULT) ?? (data == null ? void 0 : data.results);
|
|
63880
|
+
if (!data || !Array.isArray(resultArray)) {
|
|
63730
63881
|
return {
|
|
63731
|
-
results,
|
|
63732
|
-
total,
|
|
63733
|
-
prevCursor,
|
|
63734
|
-
nextCursor
|
|
63882
|
+
results: [],
|
|
63883
|
+
total: 0,
|
|
63884
|
+
prevCursor: null,
|
|
63885
|
+
nextCursor: null,
|
|
63886
|
+
fuzzyMatches: void 0
|
|
63735
63887
|
};
|
|
63736
|
-
}
|
|
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) {
|
|
63737
63895
|
return {
|
|
63738
63896
|
results,
|
|
63739
63897
|
total,
|
|
63740
|
-
prevCursor: null,
|
|
63741
|
-
nextCursor: null
|
|
63898
|
+
prevCursor: prevCursor ?? null,
|
|
63899
|
+
nextCursor: nextCursor ?? null,
|
|
63900
|
+
fuzzyMatches
|
|
63742
63901
|
};
|
|
63743
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
|
+
};
|
|
63744
63914
|
};
|
|
63745
63915
|
const CREATE_DOCUMENT_GQL = `#graphql
|
|
63746
63916
|
mutation($collection: String!, $relativePath: String!, $params: DocumentMutation!) {
|
|
@@ -63796,7 +63966,7 @@ class TinaAdminApi {
|
|
|
63796
63966
|
fetchCollections() {
|
|
63797
63967
|
return this.schema.getCollections();
|
|
63798
63968
|
}
|
|
63799
|
-
async renameDocument({ collection, relativePath
|
|
63969
|
+
async renameDocument({ collection, relativePath, newRelativePath }) {
|
|
63800
63970
|
await this.api.request(
|
|
63801
63971
|
`#graphql
|
|
63802
63972
|
mutation RenameDocument($collection: String!, $relativePath: String! $newRelativePath: String!) {
|
|
@@ -63805,7 +63975,7 @@ class TinaAdminApi {
|
|
|
63805
63975
|
}
|
|
63806
63976
|
}
|
|
63807
63977
|
`,
|
|
63808
|
-
{ variables: { collection, relativePath
|
|
63978
|
+
{ variables: { collection, relativePath, newRelativePath } }
|
|
63809
63979
|
);
|
|
63810
63980
|
if (this.searchClient) {
|
|
63811
63981
|
const { document: doc } = await this.fetchDocument(
|
|
@@ -63819,18 +63989,18 @@ class TinaAdminApi {
|
|
|
63819
63989
|
this.maxSearchIndexFieldLength
|
|
63820
63990
|
);
|
|
63821
63991
|
await this.searchClient.put([processed]);
|
|
63822
|
-
await this.searchClient.del([`${collection.name}:${
|
|
63992
|
+
await this.searchClient.del([`${collection.name}:${relativePath}`]);
|
|
63823
63993
|
}
|
|
63824
63994
|
}
|
|
63825
63995
|
async deleteDocument({
|
|
63826
63996
|
collection,
|
|
63827
|
-
relativePath
|
|
63997
|
+
relativePath
|
|
63828
63998
|
}) {
|
|
63829
63999
|
var _a2;
|
|
63830
64000
|
await this.api.request(DELETE_DOCUMENT_GQL, {
|
|
63831
|
-
variables: { collection, relativePath
|
|
64001
|
+
variables: { collection, relativePath }
|
|
63832
64002
|
});
|
|
63833
|
-
await ((_a2 = this.searchClient) == null ? void 0 : _a2.del([`${collection}:${
|
|
64003
|
+
await ((_a2 = this.searchClient) == null ? void 0 : _a2.del([`${collection}:${relativePath}`]));
|
|
63834
64004
|
}
|
|
63835
64005
|
async fetchCollection(collectionName, includeDocuments, folder = "", after3, sortKey, order, filterArgs) {
|
|
63836
64006
|
let filter2 = null;
|
|
@@ -63985,7 +64155,7 @@ class TinaAdminApi {
|
|
|
63985
64155
|
}
|
|
63986
64156
|
}
|
|
63987
64157
|
}
|
|
63988
|
-
async fetchDocument(collectionName,
|
|
64158
|
+
async fetchDocument(collectionName, relativePath, values = true) {
|
|
63989
64159
|
let query;
|
|
63990
64160
|
if (values) {
|
|
63991
64161
|
query = `#graphql
|
|
@@ -64020,26 +64190,26 @@ class TinaAdminApi {
|
|
|
64020
64190
|
}`;
|
|
64021
64191
|
}
|
|
64022
64192
|
const response = await this.api.request(query, {
|
|
64023
|
-
variables: { collection: collectionName, relativePath
|
|
64193
|
+
variables: { collection: collectionName, relativePath }
|
|
64024
64194
|
});
|
|
64025
64195
|
return response;
|
|
64026
64196
|
}
|
|
64027
|
-
async createDocument(collection,
|
|
64197
|
+
async createDocument(collection, relativePath, params) {
|
|
64028
64198
|
const response = await this.api.request(CREATE_DOCUMENT_GQL, {
|
|
64029
64199
|
variables: {
|
|
64030
64200
|
collection: collection.name,
|
|
64031
|
-
relativePath
|
|
64201
|
+
relativePath,
|
|
64032
64202
|
params
|
|
64033
64203
|
}
|
|
64034
64204
|
});
|
|
64035
64205
|
if (this.searchClient) {
|
|
64036
64206
|
const { document: doc } = await this.fetchDocument(
|
|
64037
64207
|
collection.name,
|
|
64038
|
-
|
|
64208
|
+
relativePath
|
|
64039
64209
|
);
|
|
64040
64210
|
const processed = processDocumentForIndexing(
|
|
64041
64211
|
doc["_values"],
|
|
64042
|
-
`${collection.path}/${
|
|
64212
|
+
`${collection.path}/${relativePath}`,
|
|
64043
64213
|
collection,
|
|
64044
64214
|
this.maxSearchIndexFieldLength
|
|
64045
64215
|
);
|
|
@@ -64047,22 +64217,22 @@ class TinaAdminApi {
|
|
|
64047
64217
|
}
|
|
64048
64218
|
return response;
|
|
64049
64219
|
}
|
|
64050
|
-
async updateDocument(collection,
|
|
64220
|
+
async updateDocument(collection, relativePath, params) {
|
|
64051
64221
|
const response = await this.api.request(UPDATE_DOCUMENT_GQL, {
|
|
64052
64222
|
variables: {
|
|
64053
64223
|
collection: collection.name,
|
|
64054
|
-
relativePath
|
|
64224
|
+
relativePath,
|
|
64055
64225
|
params
|
|
64056
64226
|
}
|
|
64057
64227
|
});
|
|
64058
64228
|
if (this.searchClient) {
|
|
64059
64229
|
const { document: doc } = await this.fetchDocument(
|
|
64060
64230
|
collection.name,
|
|
64061
|
-
|
|
64231
|
+
relativePath
|
|
64062
64232
|
);
|
|
64063
64233
|
const processed = processDocumentForIndexing(
|
|
64064
64234
|
doc["_values"],
|
|
64065
|
-
`${collection.path}/${
|
|
64235
|
+
`${collection.path}/${relativePath}`,
|
|
64066
64236
|
collection,
|
|
64067
64237
|
this.maxSearchIndexFieldLength
|
|
64068
64238
|
);
|
|
@@ -64185,7 +64355,7 @@ const CreateBranchModal = ({
|
|
|
64185
64355
|
}
|
|
64186
64356
|
const collection = tinaApi.schema.getCollectionByFullPath(path3);
|
|
64187
64357
|
const params = tinaApi.schema.transformPayload(collection.name, values);
|
|
64188
|
-
const
|
|
64358
|
+
const relativePath = pathRelativeToCollection(collection.path, path3);
|
|
64189
64359
|
const result = await tinaApi.executeEditorialWorkflow({
|
|
64190
64360
|
branchName,
|
|
64191
64361
|
baseBranch: tinaApi.branch,
|
|
@@ -64194,7 +64364,7 @@ const CreateBranchModal = ({
|
|
|
64194
64364
|
query: graphql2,
|
|
64195
64365
|
variables: {
|
|
64196
64366
|
collection: collection.name,
|
|
64197
|
-
relativePath
|
|
64367
|
+
relativePath,
|
|
64198
64368
|
params
|
|
64199
64369
|
}
|
|
64200
64370
|
},
|
|
@@ -64222,10 +64392,11 @@ const CreateBranchModal = ({
|
|
|
64222
64392
|
}
|
|
64223
64393
|
setCurrentBranch(result.branchName);
|
|
64224
64394
|
cms.alerts.success(
|
|
64225
|
-
`Branch created successfully - Pull Request at ${result.pullRequestUrl}
|
|
64395
|
+
`Branch created successfully - Pull Request at ${result.pullRequestUrl}`,
|
|
64396
|
+
0
|
|
64226
64397
|
);
|
|
64227
64398
|
if (crudType === "create") {
|
|
64228
|
-
const folderPath =
|
|
64399
|
+
const folderPath = relativePath.includes("/") ? relativePath.substring(0, relativePath.lastIndexOf("/")) : "";
|
|
64229
64400
|
window.location.hash = `#/collections/${collection.name}${folderPath ? `/${folderPath}` : ""}`;
|
|
64230
64401
|
}
|
|
64231
64402
|
close2();
|
|
@@ -64591,7 +64762,7 @@ const Emoji = ({ className = "", ...props }) => /* @__PURE__ */ React.createElem
|
|
|
64591
64762
|
const CreateBranchModel = ({
|
|
64592
64763
|
close: close2,
|
|
64593
64764
|
safeSubmit,
|
|
64594
|
-
relativePath
|
|
64765
|
+
relativePath,
|
|
64595
64766
|
values,
|
|
64596
64767
|
crudType
|
|
64597
64768
|
}) => /* @__PURE__ */ React.createElement(
|
|
@@ -64599,7 +64770,7 @@ const CreateBranchModel = ({
|
|
|
64599
64770
|
{
|
|
64600
64771
|
close: close2,
|
|
64601
64772
|
safeSubmit,
|
|
64602
|
-
path:
|
|
64773
|
+
path: relativePath,
|
|
64603
64774
|
values,
|
|
64604
64775
|
crudType
|
|
64605
64776
|
}
|
|
@@ -67525,7 +67696,25 @@ function LinkFloatingToolbar({
|
|
|
67525
67696
|
},
|
|
67526
67697
|
/* @__PURE__ */ React.createElement(Unlink, { width: 18 })
|
|
67527
67698
|
));
|
|
67528
|
-
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
|
+
));
|
|
67529
67718
|
}
|
|
67530
67719
|
function LinkOpenButton() {
|
|
67531
67720
|
const editor = useEditorRef();
|
|
@@ -119801,19 +119990,36 @@ class LocalClient extends Client {
|
|
|
119801
119990
|
}
|
|
119802
119991
|
class TinaCMSSearchClient {
|
|
119803
119992
|
constructor(client, tinaSearchConfig) {
|
|
119993
|
+
__publicField(this, "fuzzyEnabled");
|
|
119994
|
+
__publicField(this, "defaultFuzzyOptions");
|
|
119804
119995
|
this.client = client;
|
|
119805
119996
|
this.tinaSearchConfig = tinaSearchConfig;
|
|
119997
|
+
this.fuzzyEnabled = (tinaSearchConfig == null ? void 0 : tinaSearchConfig.fuzzyEnabled) !== false;
|
|
119998
|
+
this.defaultFuzzyOptions = tinaSearchConfig == null ? void 0 : tinaSearchConfig.fuzzyOptions;
|
|
119806
119999
|
}
|
|
119807
120000
|
async query(query, options) {
|
|
119808
120001
|
var _a2;
|
|
120002
|
+
const opt = optionsToSearchIndexOptions(options);
|
|
120003
|
+
const optionsParam = opt["PAGE"] ? `&options=${JSON.stringify(opt)}` : "";
|
|
119809
120004
|
const q2 = queryToSearchIndexQuery(
|
|
119810
120005
|
query,
|
|
119811
120006
|
(_a2 = this.tinaSearchConfig) == null ? void 0 : _a2.stopwordLanguages
|
|
119812
120007
|
);
|
|
119813
|
-
const
|
|
119814
|
-
|
|
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
|
+
}
|
|
119815
120019
|
const res = await this.client.authProvider.fetchWithToken(
|
|
119816
|
-
`${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}`
|
|
119817
120023
|
);
|
|
119818
120024
|
return parseSearchIndexResponse(await res.json(), options);
|
|
119819
120025
|
}
|
|
@@ -119848,15 +120054,33 @@ class TinaCMSSearchClient {
|
|
|
119848
120054
|
}
|
|
119849
120055
|
}
|
|
119850
120056
|
class LocalSearchClient {
|
|
119851
|
-
constructor(client) {
|
|
120057
|
+
constructor(client, tinaSearchConfig) {
|
|
120058
|
+
__publicField(this, "fuzzyEnabled");
|
|
120059
|
+
__publicField(this, "defaultFuzzyOptions");
|
|
119852
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;
|
|
119853
120064
|
}
|
|
119854
120065
|
async query(query, options) {
|
|
119855
120066
|
const q2 = queryToSearchIndexQuery(query);
|
|
119856
120067
|
const opt = optionsToSearchIndexOptions(options);
|
|
119857
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
|
+
}
|
|
119858
120080
|
const res = await this.client.authProvider.fetchWithToken(
|
|
119859
|
-
`http://localhost:4001/searchIndex?q=${JSON.stringify(
|
|
120081
|
+
`http://localhost:4001/searchIndex?q=${JSON.stringify(
|
|
120082
|
+
q2
|
|
120083
|
+
)}${optionsParam}${fuzzyParam}`
|
|
119860
120084
|
);
|
|
119861
120085
|
return parseSearchIndexResponse(await res.json(), options);
|
|
119862
120086
|
}
|
|
@@ -120163,19 +120387,22 @@ const TinaCloudProvider = (props) => {
|
|
|
120163
120387
|
cms.api.tina.setBranch(currentBranch);
|
|
120164
120388
|
}
|
|
120165
120389
|
useEffect(() => {
|
|
120166
|
-
var _a3, _b2, _c2, _d, _e, _f;
|
|
120390
|
+
var _a3, _b2, _c2, _d, _e, _f, _g, _h;
|
|
120167
120391
|
let searchClient;
|
|
120168
120392
|
if (props.isLocalClient) {
|
|
120169
|
-
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
|
+
);
|
|
120170
120397
|
} else {
|
|
120171
|
-
const hasTinaSearch = Boolean((
|
|
120398
|
+
const hasTinaSearch = Boolean((_d = (_c2 = props.schema.config) == null ? void 0 : _c2.search) == null ? void 0 : _d.tina);
|
|
120172
120399
|
if (hasTinaSearch) {
|
|
120173
120400
|
searchClient = new TinaCMSSearchClient(
|
|
120174
120401
|
cms.api.tina,
|
|
120175
|
-
(
|
|
120402
|
+
(_f = (_e = props.schema.config) == null ? void 0 : _e.search) == null ? void 0 : _f.tina
|
|
120176
120403
|
);
|
|
120177
120404
|
} else {
|
|
120178
|
-
searchClient = (
|
|
120405
|
+
searchClient = (_h = (_g = props.schema.config) == null ? void 0 : _g.search) == null ? void 0 : _h.searchClient;
|
|
120179
120406
|
}
|
|
120180
120407
|
}
|
|
120181
120408
|
if (searchClient) {
|
|
@@ -120309,18 +120536,18 @@ class ContentCreatorPlugin {
|
|
|
120309
120536
|
this.onChange = options.onChange;
|
|
120310
120537
|
this.initialValues = options.initialValues;
|
|
120311
120538
|
}
|
|
120312
|
-
async onSubmit({ collection, template, relativePath
|
|
120539
|
+
async onSubmit({ collection, template, relativePath }, cms) {
|
|
120313
120540
|
try {
|
|
120314
120541
|
const selectedCollection = this.collections.find(
|
|
120315
120542
|
(collectionItem) => collectionItem.slug === collection
|
|
120316
120543
|
);
|
|
120317
120544
|
const collectionFormat = selectedCollection.format;
|
|
120318
120545
|
const extensionLength = -1 * (collectionFormat.length + 1);
|
|
120319
|
-
let relativePathWithExt =
|
|
120320
|
-
if (
|
|
120321
|
-
relativePathWithExt = `${
|
|
120546
|
+
let relativePathWithExt = relativePath;
|
|
120547
|
+
if (relativePath.slice(extensionLength).toLocaleLowerCase() === `.${collectionFormat}`) {
|
|
120548
|
+
relativePathWithExt = `${relativePath.slice(0, -3)}.${collectionFormat}`;
|
|
120322
120549
|
} else {
|
|
120323
|
-
relativePathWithExt = `${
|
|
120550
|
+
relativePathWithExt = `${relativePath}.${collectionFormat}`;
|
|
120324
120551
|
}
|
|
120325
120552
|
const payload = {
|
|
120326
120553
|
relativePath: relativePathWithExt,
|
|
@@ -121049,22 +121276,6 @@ const PageHeader = ({
|
|
|
121049
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));
|
|
121050
121277
|
};
|
|
121051
121278
|
const PageBody = ({ children }) => /* @__PURE__ */ React__default.createElement("div", { className: "py-4 px-6" }, children);
|
|
121052
|
-
const TooltipProvider = TooltipPrimitive.Provider;
|
|
121053
|
-
const Tooltip = TooltipPrimitive.Root;
|
|
121054
|
-
const TooltipTrigger = TooltipPrimitive.Trigger;
|
|
121055
|
-
const TooltipContent = React.forwardRef(({ className, sideOffset = 4, ...props }, ref) => /* @__PURE__ */ React.createElement(TooltipPrimitive.Portal, null, /* @__PURE__ */ React.createElement(
|
|
121056
|
-
TooltipPrimitive.Content,
|
|
121057
|
-
{
|
|
121058
|
-
ref,
|
|
121059
|
-
sideOffset,
|
|
121060
|
-
className: cn$1(
|
|
121061
|
-
"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]",
|
|
121062
|
-
className
|
|
121063
|
-
),
|
|
121064
|
-
...props
|
|
121065
|
-
}
|
|
121066
|
-
)));
|
|
121067
|
-
TooltipContent.displayName = TooltipPrimitive.Content.displayName;
|
|
121068
121279
|
const folderRegex = /^.*\/~\/*(.*)$/;
|
|
121069
121280
|
const parentFolder = (folder) => {
|
|
121070
121281
|
return {
|
|
@@ -121237,6 +121448,10 @@ const CollectionListPage = () => {
|
|
|
121237
121448
|
booleanEquals: null
|
|
121238
121449
|
}));
|
|
121239
121450
|
}, [collectionName]);
|
|
121451
|
+
useEffect(() => {
|
|
121452
|
+
setEndCursor("");
|
|
121453
|
+
setPrevCursors([]);
|
|
121454
|
+
}, [search]);
|
|
121240
121455
|
const tableRowStyle = "hover:bg-gray-50/50 border-b-2 border-gray-50 transition-colors duration-300";
|
|
121241
121456
|
const tableHeadingCellStyle = "px-3 py-3 text-left text-xs font-bold text-gray-700 tracking-wider";
|
|
121242
121457
|
const tableHeadingStyle2 = "bg-gray-100 border-b-2 border-gray-200";
|
|
@@ -121496,6 +121711,8 @@ const CollectionListPage = () => {
|
|
|
121496
121711
|
))), /* @__PURE__ */ React__default.createElement("div", { className: "flex flex-1 flex-row gap-2 items-end w-full" }, searchEnabled ? /* @__PURE__ */ React__default.createElement(
|
|
121497
121712
|
SearchInput,
|
|
121498
121713
|
{
|
|
121714
|
+
cms,
|
|
121715
|
+
collectionName,
|
|
121499
121716
|
loading: _loading,
|
|
121500
121717
|
search,
|
|
121501
121718
|
setSearch,
|
|
@@ -121828,33 +122045,31 @@ const SearchInput = ({
|
|
|
121828
122045
|
setSearchInput
|
|
121829
122046
|
}) => {
|
|
121830
122047
|
const [searchLoaded, setSearchLoaded] = useState(false);
|
|
122048
|
+
const inputRef = React__default.useRef(null);
|
|
121831
122049
|
useEffect(() => {
|
|
121832
|
-
|
|
121833
|
-
setSearchLoaded(false);
|
|
121834
|
-
} else {
|
|
121835
|
-
setSearchLoaded(true);
|
|
121836
|
-
}
|
|
122050
|
+
setSearchLoaded(!loading);
|
|
121837
122051
|
}, [loading]);
|
|
121838
|
-
|
|
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(
|
|
121839
122062
|
"input",
|
|
121840
122063
|
{
|
|
122064
|
+
ref: inputRef,
|
|
121841
122065
|
type: "text",
|
|
121842
122066
|
name: "search",
|
|
121843
122067
|
placeholder: "Search...",
|
|
121844
122068
|
value: searchInput,
|
|
121845
|
-
onChange: (e3) =>
|
|
121846
|
-
|
|
121847
|
-
|
|
121848
|
-
|
|
121849
|
-
if (e3.key === "Enter") {
|
|
121850
|
-
e3.preventDefault();
|
|
121851
|
-
if (searchInput.trim()) {
|
|
121852
|
-
setSearch(searchInput);
|
|
121853
|
-
setSearchLoaded(false);
|
|
121854
|
-
}
|
|
121855
|
-
}
|
|
121856
|
-
},
|
|
121857
|
-
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"
|
|
121858
122073
|
}
|
|
121859
122074
|
), search && searchLoaded && /* @__PURE__ */ React__default.createElement(
|
|
121860
122075
|
"button",
|
|
@@ -121864,7 +122079,7 @@ const SearchInput = ({
|
|
|
121864
122079
|
setSearch("");
|
|
121865
122080
|
setSearchInput("");
|
|
121866
122081
|
},
|
|
121867
|
-
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"
|
|
121868
122083
|
},
|
|
121869
122084
|
/* @__PURE__ */ React__default.createElement(BiX, { className: "w-5 h-5" })
|
|
121870
122085
|
))));
|
|
@@ -122133,41 +122348,46 @@ const useSearchCollection = (cms, collectionName, includeDocuments = true, folde
|
|
|
122133
122348
|
useEffect(() => {
|
|
122134
122349
|
let cancelled = false;
|
|
122135
122350
|
const searchCollection = async () => {
|
|
122351
|
+
var _a2, _b, _c, _d;
|
|
122136
122352
|
if (await api.isAuthenticated() && !folder.loading && !cancelled) {
|
|
122137
122353
|
try {
|
|
122354
|
+
const fuzzyEnabled = ((_d = (_c = (_b = (_a2 = schema.config) == null ? void 0 : _a2.config) == null ? void 0 : _b.search) == null ? void 0 : _c.tina) == null ? void 0 : _d.fuzzyEnabled) !== false;
|
|
122138
122355
|
const response = await cms.api.search.query(
|
|
122139
122356
|
`${search} AND _collection:${collectionName}`,
|
|
122140
122357
|
{
|
|
122141
122358
|
limit: 15,
|
|
122142
|
-
cursor: after3
|
|
122359
|
+
cursor: after3,
|
|
122360
|
+
fuzzy: fuzzyEnabled
|
|
122143
122361
|
}
|
|
122144
122362
|
);
|
|
122363
|
+
const results = (response == null ? void 0 : response.results) ?? [];
|
|
122145
122364
|
const docs = await Promise.allSettled(
|
|
122146
|
-
|
|
122147
|
-
const [collection2,
|
|
122148
|
-
return api.fetchDocument(collection2,
|
|
122365
|
+
results.map((result) => {
|
|
122366
|
+
const [collection2, relativePath] = result._id.split(":");
|
|
122367
|
+
return api.fetchDocument(collection2, relativePath, false);
|
|
122149
122368
|
})
|
|
122150
122369
|
);
|
|
122151
122370
|
const edges2 = docs.filter((p2) => {
|
|
122152
|
-
var
|
|
122153
|
-
return p2.status === "fulfilled" && !!((
|
|
122371
|
+
var _a3;
|
|
122372
|
+
return p2.status === "fulfilled" && !!((_a3 = p2.value) == null ? void 0 : _a3.document);
|
|
122154
122373
|
}).map((result) => ({ node: result.value.document }));
|
|
122155
122374
|
const c2 = await api.fetchCollection(collectionName, false, "");
|
|
122156
|
-
|
|
122157
|
-
format:
|
|
122158
|
-
label:
|
|
122375
|
+
const collectionData = {
|
|
122376
|
+
format: c2.format,
|
|
122377
|
+
label: c2.label,
|
|
122159
122378
|
name: collectionName,
|
|
122160
|
-
templates:
|
|
122379
|
+
templates: c2.templates,
|
|
122161
122380
|
documents: {
|
|
122162
122381
|
pageInfo: {
|
|
122163
|
-
hasNextPage: !!response.nextCursor,
|
|
122164
|
-
hasPreviousPage: !!response.prevCursor,
|
|
122382
|
+
hasNextPage: !!(response == null ? void 0 : response.nextCursor),
|
|
122383
|
+
hasPreviousPage: !!(response == null ? void 0 : response.prevCursor),
|
|
122165
122384
|
startCursor: "",
|
|
122166
|
-
endCursor: response.nextCursor || ""
|
|
122385
|
+
endCursor: (response == null ? void 0 : response.nextCursor) || ""
|
|
122167
122386
|
},
|
|
122168
122387
|
edges: edges2
|
|
122169
122388
|
}
|
|
122170
|
-
}
|
|
122389
|
+
};
|
|
122390
|
+
setCollection(collectionData);
|
|
122171
122391
|
} catch (error22) {
|
|
122172
122392
|
cms.alerts.error(
|
|
122173
122393
|
`[${error22.name}] GetCollection failed: ${error22.message}`
|
|
@@ -122270,14 +122490,14 @@ const createDocument = async (cms, collection, template, mutationInfo, folder, v
|
|
|
122270
122490
|
throw new Error("Filename must be a string");
|
|
122271
122491
|
}
|
|
122272
122492
|
const appendFolder = folder && !filename.startsWith("/") ? `/${folder}/` : "/";
|
|
122273
|
-
const
|
|
122493
|
+
const relativePath = `${appendFolder}${filename}.${collection.format}`;
|
|
122274
122494
|
const params = api.schema.transformPayload(collection.name, {
|
|
122275
122495
|
_collection: collection.name,
|
|
122276
122496
|
...template && { _template: template.name },
|
|
122277
122497
|
...leftover
|
|
122278
122498
|
});
|
|
122279
122499
|
if (await api.isAuthenticated()) {
|
|
122280
|
-
await api.createDocument(collection,
|
|
122500
|
+
await api.createDocument(collection, relativePath, params);
|
|
122281
122501
|
} else {
|
|
122282
122502
|
const authMessage = `CreateDocument failed: User is no longer authenticated; please login and try again.`;
|
|
122283
122503
|
cms.alerts.error(authMessage);
|
|
@@ -122527,7 +122747,7 @@ const RenderForm$1 = ({
|
|
|
122527
122747
|
), /* @__PURE__ */ React__default.createElement(FormStatus, { pristine: formIsPristine }))
|
|
122528
122748
|
), activeForm && /* @__PURE__ */ React__default.createElement(FormBuilder, { form: activeForm, onPristineChange: setFormIsPristine })));
|
|
122529
122749
|
};
|
|
122530
|
-
const useGetDocument = (cms, collectionName,
|
|
122750
|
+
const useGetDocument = (cms, collectionName, relativePath) => {
|
|
122531
122751
|
const api = new TinaAdminApi(cms);
|
|
122532
122752
|
const [document2, setDocument] = useState(void 0);
|
|
122533
122753
|
const [loading, setLoading] = useState(true);
|
|
@@ -122539,7 +122759,7 @@ const useGetDocument = (cms, collectionName, relativePath2) => {
|
|
|
122539
122759
|
try {
|
|
122540
122760
|
const response = await api.fetchDocument(
|
|
122541
122761
|
collectionName,
|
|
122542
|
-
|
|
122762
|
+
relativePath
|
|
122543
122763
|
);
|
|
122544
122764
|
if (!isCancelled) {
|
|
122545
122765
|
setDocument(response.document);
|
|
@@ -122564,19 +122784,19 @@ const useGetDocument = (cms, collectionName, relativePath2) => {
|
|
|
122564
122784
|
return () => {
|
|
122565
122785
|
isCancelled = true;
|
|
122566
122786
|
};
|
|
122567
|
-
}, [cms, collectionName,
|
|
122787
|
+
}, [cms, collectionName, relativePath]);
|
|
122568
122788
|
return { document: document2, loading, error: error2 };
|
|
122569
122789
|
};
|
|
122570
122790
|
const GetDocument = ({
|
|
122571
122791
|
cms,
|
|
122572
122792
|
collectionName,
|
|
122573
|
-
relativePath
|
|
122793
|
+
relativePath,
|
|
122574
122794
|
children
|
|
122575
122795
|
}) => {
|
|
122576
122796
|
const { document: document2, loading, error: error2 } = useGetDocument(
|
|
122577
122797
|
cms,
|
|
122578
122798
|
collectionName,
|
|
122579
|
-
|
|
122799
|
+
relativePath
|
|
122580
122800
|
);
|
|
122581
122801
|
if (error2) {
|
|
122582
122802
|
return /* @__PURE__ */ React__default.createElement(FullscreenError, null);
|
|
@@ -122599,7 +122819,7 @@ const CollectionDuplicatePage = () => {
|
|
|
122599
122819
|
includeDocuments: false
|
|
122600
122820
|
},
|
|
122601
122821
|
(collection) => {
|
|
122602
|
-
const
|
|
122822
|
+
const relativePath = `${filename.startsWith("~/") ? filename.substring(2) : filename}.${collection.format}`;
|
|
122603
122823
|
const mutationInfo = {
|
|
122604
122824
|
includeCollection: true,
|
|
122605
122825
|
includeTemplate: !!collection.templates
|
|
@@ -122609,7 +122829,7 @@ const CollectionDuplicatePage = () => {
|
|
|
122609
122829
|
{
|
|
122610
122830
|
cms,
|
|
122611
122831
|
collectionName: collection.name,
|
|
122612
|
-
relativePath
|
|
122832
|
+
relativePath
|
|
122613
122833
|
},
|
|
122614
122834
|
(document2) => {
|
|
122615
122835
|
var _a2;
|
|
@@ -122629,11 +122849,11 @@ const CollectionDuplicatePage = () => {
|
|
|
122629
122849
|
}
|
|
122630
122850
|
));
|
|
122631
122851
|
};
|
|
122632
|
-
const updateDocument = async (cms,
|
|
122852
|
+
const updateDocument = async (cms, relativePath, collection, mutationInfo, values) => {
|
|
122633
122853
|
const api = new TinaAdminApi(cms);
|
|
122634
122854
|
const params = api.schema.transformPayload(collection.name, values);
|
|
122635
122855
|
if (await api.isAuthenticated()) {
|
|
122636
|
-
await api.updateDocument(collection,
|
|
122856
|
+
await api.updateDocument(collection, relativePath, params);
|
|
122637
122857
|
} else {
|
|
122638
122858
|
const authMessage = `UpdateDocument failed: User is no longer authenticated; please login and try again.`;
|
|
122639
122859
|
cms.alerts.error(authMessage);
|
|
@@ -122655,7 +122875,7 @@ const CollectionUpdatePage = () => {
|
|
|
122655
122875
|
includeDocuments: false
|
|
122656
122876
|
},
|
|
122657
122877
|
(collection) => {
|
|
122658
|
-
const
|
|
122878
|
+
const relativePath = `${resolvedFile}.${collection.format}`;
|
|
122659
122879
|
const mutationInfo = {
|
|
122660
122880
|
includeCollection: true,
|
|
122661
122881
|
includeTemplate: !!collection.templates
|
|
@@ -122665,7 +122885,7 @@ const CollectionUpdatePage = () => {
|
|
|
122665
122885
|
{
|
|
122666
122886
|
cms,
|
|
122667
122887
|
collectionName: collection.name,
|
|
122668
|
-
relativePath
|
|
122888
|
+
relativePath
|
|
122669
122889
|
},
|
|
122670
122890
|
(document2) => /* @__PURE__ */ React__default.createElement(
|
|
122671
122891
|
RenderForm,
|
|
@@ -122673,7 +122893,7 @@ const CollectionUpdatePage = () => {
|
|
|
122673
122893
|
cms,
|
|
122674
122894
|
document: document2,
|
|
122675
122895
|
filename: resolvedFile,
|
|
122676
|
-
relativePath
|
|
122896
|
+
relativePath,
|
|
122677
122897
|
collection,
|
|
122678
122898
|
mutationInfo
|
|
122679
122899
|
}
|
|
@@ -122686,10 +122906,11 @@ const RenderForm = ({
|
|
|
122686
122906
|
cms,
|
|
122687
122907
|
document: document2,
|
|
122688
122908
|
filename,
|
|
122689
|
-
relativePath
|
|
122909
|
+
relativePath,
|
|
122690
122910
|
collection,
|
|
122691
122911
|
mutationInfo
|
|
122692
122912
|
}) => {
|
|
122913
|
+
var _a2, _b, _c, _d;
|
|
122693
122914
|
const [formIsPristine, setFormIsPristine] = useState(true);
|
|
122694
122915
|
const schema = cms.api.tina.schema;
|
|
122695
122916
|
const schemaCollection = schema.getCollection(collection.name);
|
|
@@ -122706,7 +122927,7 @@ const RenderForm = ({
|
|
|
122706
122927
|
const form = useMemo(() => {
|
|
122707
122928
|
return new Form({
|
|
122708
122929
|
// id is the full document path
|
|
122709
|
-
id: canonicalPath(`${schemaCollection.path}/${
|
|
122930
|
+
id: canonicalPath(`${schemaCollection.path}/${relativePath}`),
|
|
122710
122931
|
label: "form",
|
|
122711
122932
|
fields: formInfo.fields,
|
|
122712
122933
|
initialValues: document2._values,
|
|
@@ -122714,7 +122935,7 @@ const RenderForm = ({
|
|
|
122714
122935
|
try {
|
|
122715
122936
|
await updateDocument(
|
|
122716
122937
|
cms,
|
|
122717
|
-
|
|
122938
|
+
relativePath,
|
|
122718
122939
|
collection,
|
|
122719
122940
|
mutationInfo,
|
|
122720
122941
|
values
|
|
@@ -122735,7 +122956,7 @@ const RenderForm = ({
|
|
|
122735
122956
|
}
|
|
122736
122957
|
}
|
|
122737
122958
|
});
|
|
122738
|
-
}, [cms, document2,
|
|
122959
|
+
}, [cms, document2, relativePath, collection, mutationInfo]);
|
|
122739
122960
|
React__default.useEffect(() => {
|
|
122740
122961
|
cms.dispatch({ type: "forms:add", value: form });
|
|
122741
122962
|
cms.dispatch({ type: "forms:set-active-form-id", value: form.id });
|
|
@@ -122761,6 +122982,15 @@ const RenderForm = ({
|
|
|
122761
122982
|
className: "w-[calc(100%-3rem)]",
|
|
122762
122983
|
rootBreadcrumbName: `${filename}.${collection.format}`
|
|
122763
122984
|
}
|
|
122985
|
+
), /* @__PURE__ */ React__default.createElement(
|
|
122986
|
+
FileHistoryProvider,
|
|
122987
|
+
{
|
|
122988
|
+
defaultBranchName: (_a2 = cms.api.admin.api.schema.config.config.repoProvider) == null ? void 0 : _a2.defaultBranchName,
|
|
122989
|
+
historyUrl: (_b = cms.api.admin.api.schema.config.config.repoProvider) == null ? void 0 : _b.historyUrl,
|
|
122990
|
+
contentRelativePath: relativePath,
|
|
122991
|
+
tinaBranch: cms.api.admin.api.branch,
|
|
122992
|
+
isLocalMode: (_d = (_c = cms.api) == null ? void 0 : _c.tina) == null ? void 0 : _d.isLocalMode
|
|
122993
|
+
}
|
|
122764
122994
|
), /* @__PURE__ */ React__default.createElement(FormStatus, { pristine: formIsPristine }))
|
|
122765
122995
|
), activeForm && /* @__PURE__ */ React__default.createElement(FormBuilder, { form: activeForm, onPristineChange: setFormIsPristine }));
|
|
122766
122996
|
};
|