@flamingo-stack/openframe-frontend-core 0.0.582-1967.5390.1 → 0.0.582
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/chunk-2EIGO6ZS.js +1055 -0
- package/dist/chunk-2EIGO6ZS.js.map +1 -0
- package/dist/{chunk-PDK6KVU6.js → chunk-53ZVUW2M.js} +4 -4
- package/dist/{chunk-BTXJQPGE.js → chunk-5U2FU5LM.js} +2 -2
- package/dist/{chunk-VG2SRECA.cjs → chunk-7WE6FGGK.cjs} +49 -49
- package/dist/{chunk-VG2SRECA.cjs.map → chunk-7WE6FGGK.cjs.map} +1 -1
- package/dist/{chunk-EXBNO6FB.js → chunk-CJW6KZD3.js} +2 -2
- package/dist/{chunk-UQXQCM3F.cjs → chunk-E4TK2BBD.cjs} +3 -3
- package/dist/{chunk-UQXQCM3F.cjs.map → chunk-E4TK2BBD.cjs.map} +1 -1
- package/dist/{chunk-NOO3QOJI.js → chunk-EULY3BXB.js} +2 -2
- package/dist/{chunk-ML22BIKH.js → chunk-GAL6EXUY.js} +3 -3
- package/dist/{chunk-YTZK2ORN.js → chunk-H7K76TPX.js} +4 -4
- package/dist/{chunk-RH7EY7YN.cjs → chunk-HMEEW73F.cjs} +1978 -237
- package/dist/chunk-HMEEW73F.cjs.map +1 -0
- package/dist/{chunk-KNQZZJYJ.js → chunk-IB23CRL2.js} +2 -2
- package/dist/{chunk-GHYWIVSU.cjs → chunk-IVJ6TBVW.cjs} +34 -34
- package/dist/{chunk-GHYWIVSU.cjs.map → chunk-IVJ6TBVW.cjs.map} +1 -1
- package/dist/{chunk-XJ3Y4OOF.js → chunk-IZGXIZWF.js} +2 -2
- package/dist/chunk-JMWLF2GL.cjs +1055 -0
- package/dist/chunk-JMWLF2GL.cjs.map +1 -0
- package/dist/{chunk-MCFETAH7.js → chunk-JUXCEHK2.js} +2 -2
- package/dist/{chunk-KX4F4O26.cjs → chunk-KS7NKONC.cjs} +3 -3
- package/dist/{chunk-KX4F4O26.cjs.map → chunk-KS7NKONC.cjs.map} +1 -1
- package/dist/{chunk-VYNYJVSE.cjs → chunk-LHQ6RVFE.cjs} +17 -17
- package/dist/{chunk-VYNYJVSE.cjs.map → chunk-LHQ6RVFE.cjs.map} +1 -1
- package/dist/{chunk-LGHMGCUG.cjs → chunk-M3ERSHPM.cjs} +4 -4
- package/dist/{chunk-LGHMGCUG.cjs.map → chunk-M3ERSHPM.cjs.map} +1 -1
- package/dist/{chunk-Q7X74UZF.cjs → chunk-RBMVTCRM.cjs} +3 -3
- package/dist/{chunk-Q7X74UZF.cjs.map → chunk-RBMVTCRM.cjs.map} +1 -1
- package/dist/{chunk-LYU3IZOA.cjs → chunk-RILGQ2OY.cjs} +10 -10
- package/dist/{chunk-LYU3IZOA.cjs.map → chunk-RILGQ2OY.cjs.map} +1 -1
- package/dist/{chunk-T6DRWYLM.cjs → chunk-RQMS2CF5.cjs} +17 -17
- package/dist/{chunk-T6DRWYLM.cjs.map → chunk-RQMS2CF5.cjs.map} +1 -1
- package/dist/{chunk-TC47NAJ3.cjs → chunk-S2ZXUQLR.cjs} +16 -16
- package/dist/{chunk-TC47NAJ3.cjs.map → chunk-S2ZXUQLR.cjs.map} +1 -1
- package/dist/{chunk-G3ZMLSKJ.js → chunk-SM6JAZ4C.js} +2 -2
- package/dist/{chunk-LENIASJW.js → chunk-T4DIAKIK.js} +2 -2
- package/dist/{chunk-ODOFQLSP.cjs → chunk-TMNFC24G.cjs} +13 -13
- package/dist/{chunk-ODOFQLSP.cjs.map → chunk-TMNFC24G.cjs.map} +1 -1
- package/dist/{chunk-FVF2MVIT.js → chunk-U6GFESVF.js} +2 -2
- package/dist/{chunk-2T7GXHRQ.js → chunk-XA5UPYWE.js} +2745 -1004
- package/dist/chunk-XA5UPYWE.js.map +1 -0
- package/dist/{chunk-TVLQVTZ6.cjs → chunk-XNSEZVV4.cjs} +4 -4
- package/dist/{chunk-TVLQVTZ6.cjs.map → chunk-XNSEZVV4.cjs.map} +1 -1
- package/dist/{chunk-XJJ2D64Q.cjs → chunk-YU4QZ6I6.cjs} +3 -3
- package/dist/{chunk-XJJ2D64Q.cjs.map → chunk-YU4QZ6I6.cjs.map} +1 -1
- package/dist/{chunk-LFG5JG2D.js → chunk-ZSENCE55.js} +5 -5
- package/dist/components/case-studies/index.cjs +8 -8
- package/dist/components/case-studies/index.js +2 -2
- package/dist/components/contact/index.cjs +3 -3
- package/dist/components/contact/index.js +2 -2
- package/dist/components/docs/index.cjs +6 -6
- package/dist/components/docs/index.js +5 -5
- package/dist/components/embeds/index.cjs +3 -3
- package/dist/components/embeds/index.js +2 -2
- package/dist/components/faq/index.cjs +3 -3
- package/dist/components/faq/index.js +2 -2
- package/dist/components/features/index.cjs +2 -2
- package/dist/components/features/index.js +1 -1
- package/dist/components/features/push-button-selector.d.ts +29 -1
- package/dist/components/features/push-button-selector.d.ts.map +1 -1
- package/dist/components/help-center-pages/index.cjs +22 -22
- package/dist/components/help-center-pages/index.js +13 -13
- package/dist/components/index.cjs +61 -892
- package/dist/components/index.cjs.map +1 -1
- package/dist/components/index.js +244 -1075
- package/dist/components/index.js.map +1 -1
- package/dist/components/meeting-scheduler/index.cjs +18 -18
- package/dist/components/meeting-scheduler/index.js +1 -1
- package/dist/components/navigation/index.cjs +5 -5
- package/dist/components/navigation/index.js +4 -4
- package/dist/components/onboarding-guides/index.cjs +5 -5
- package/dist/components/onboarding-guides/index.js +4 -4
- package/dist/components/tickets/index.cjs +6 -6
- package/dist/components/tickets/index.js +5 -5
- package/dist/components/ui/index.cjs +2 -2
- package/dist/components/ui/index.js +1 -1
- package/dist/index.cjs +6 -6
- package/dist/index.js +5 -5
- package/dist/utils/announcement-storage.d.ts +16 -25
- package/dist/utils/announcement-storage.d.ts.map +1 -1
- package/dist/utils/dismiss-cookie.d.ts +8 -27
- package/dist/utils/dismiss-cookie.d.ts.map +1 -1
- package/dist/utils/dismissal-storage.d.ts +2 -2
- package/dist/utils/dismissal-storage.d.ts.map +1 -1
- package/dist/utils/index.cjs +53 -70
- package/dist/utils/index.cjs.map +1 -1
- package/dist/utils/index.js +53 -70
- package/dist/utils/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/features/.push-button-selector.md +1 -1
- package/src/components/features/push-button-selector.tsx +142 -17
- package/src/utils/announcement-storage.ts +16 -25
- package/src/utils/dismiss-cookie.ts +9 -86
- package/src/utils/dismissal-storage.ts +2 -2
- package/dist/chunk-2T7GXHRQ.js.map +0 -1
- package/dist/chunk-FWNIZC6A.js +0 -1867
- package/dist/chunk-FWNIZC6A.js.map +0 -1
- package/dist/chunk-IHFTLVDF.cjs +0 -1867
- package/dist/chunk-IHFTLVDF.cjs.map +0 -1
- package/dist/chunk-RH7EY7YN.cjs.map +0 -1
- package/src/utils/__tests__/dismiss-cookie.test.ts +0 -133
- /package/dist/{chunk-PDK6KVU6.js.map → chunk-53ZVUW2M.js.map} +0 -0
- /package/dist/{chunk-BTXJQPGE.js.map → chunk-5U2FU5LM.js.map} +0 -0
- /package/dist/{chunk-EXBNO6FB.js.map → chunk-CJW6KZD3.js.map} +0 -0
- /package/dist/{chunk-NOO3QOJI.js.map → chunk-EULY3BXB.js.map} +0 -0
- /package/dist/{chunk-ML22BIKH.js.map → chunk-GAL6EXUY.js.map} +0 -0
- /package/dist/{chunk-YTZK2ORN.js.map → chunk-H7K76TPX.js.map} +0 -0
- /package/dist/{chunk-KNQZZJYJ.js.map → chunk-IB23CRL2.js.map} +0 -0
- /package/dist/{chunk-XJ3Y4OOF.js.map → chunk-IZGXIZWF.js.map} +0 -0
- /package/dist/{chunk-MCFETAH7.js.map → chunk-JUXCEHK2.js.map} +0 -0
- /package/dist/{chunk-G3ZMLSKJ.js.map → chunk-SM6JAZ4C.js.map} +0 -0
- /package/dist/{chunk-LENIASJW.js.map → chunk-T4DIAKIK.js.map} +0 -0
- /package/dist/{chunk-FVF2MVIT.js.map → chunk-U6GFESVF.js.map} +0 -0
- /package/dist/{chunk-LFG5JG2D.js.map → chunk-ZSENCE55.js.map} +0 -0
|
@@ -0,0 +1,1055 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }"use client";
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
var _chunkM3ERSHPMcjs = require('./chunk-M3ERSHPM.cjs');
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
var _chunkYU4QZ6I6cjs = require('./chunk-YU4QZ6I6.cjs');
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
var _chunkKS7NKONCcjs = require('./chunk-KS7NKONC.cjs');
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
var _chunkHMEEW73Fcjs = require('./chunk-HMEEW73F.cjs');
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
var _chunkLEISUAHFcjs = require('./chunk-LEISUAHF.cjs');
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
var _chunkTRC37VRCcjs = require('./chunk-TRC37VRC.cjs');
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
var _chunkZI27ALYXcjs = require('./chunk-ZI27ALYX.cjs');
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
var _chunkSADRZ4YIcjs = require('./chunk-SADRZ4YI.cjs');
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
var _chunkRDTOMWDNcjs = require('./chunk-RDTOMWDN.cjs');
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
var _chunkPRPZBXWZcjs = require('./chunk-PRPZBXWZ.cjs');
|
|
46
|
+
|
|
47
|
+
// src/components/docs/doc-viewer.tsx
|
|
48
|
+
var _react = require('react'); var _react2 = _interopRequireDefault(_react);
|
|
49
|
+
|
|
50
|
+
// src/components/persistent-filter-controls.tsx
|
|
51
|
+
var _jsxruntime = require('react/jsx-runtime');
|
|
52
|
+
function PersistentFilterControls({
|
|
53
|
+
isLoading,
|
|
54
|
+
children,
|
|
55
|
+
className,
|
|
56
|
+
disabledOpacity = 0.6,
|
|
57
|
+
transitionDuration = 300,
|
|
58
|
+
preventInteraction = true
|
|
59
|
+
}) {
|
|
60
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
61
|
+
"div",
|
|
62
|
+
{
|
|
63
|
+
className: _chunkPRPZBXWZcjs.cn.call(void 0,
|
|
64
|
+
"relative transition-all ease-in-out",
|
|
65
|
+
isLoading && preventInteraction && "pointer-events-none",
|
|
66
|
+
className
|
|
67
|
+
),
|
|
68
|
+
style: {
|
|
69
|
+
opacity: isLoading ? disabledOpacity : 1,
|
|
70
|
+
transitionDuration: `${transitionDuration}ms`
|
|
71
|
+
},
|
|
72
|
+
role: "region",
|
|
73
|
+
"aria-label": "Filter controls",
|
|
74
|
+
"aria-busy": isLoading,
|
|
75
|
+
"data-loading": isLoading,
|
|
76
|
+
children: [
|
|
77
|
+
isLoading && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "sr-only", role: "status", "aria-live": "polite", children: "Filters temporarily disabled while loading content" }),
|
|
78
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
79
|
+
"div",
|
|
80
|
+
{
|
|
81
|
+
className: _chunkPRPZBXWZcjs.cn.call(void 0, "transition-all ease-in-out", isLoading && "cursor-not-allowed"),
|
|
82
|
+
style: {
|
|
83
|
+
transitionDuration: `${transitionDuration}ms`
|
|
84
|
+
},
|
|
85
|
+
children
|
|
86
|
+
}
|
|
87
|
+
),
|
|
88
|
+
isLoading && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "absolute right-2 top-2 z-10", role: "status", "aria-label": "Loading filters", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "h-4 w-4 animate-spin rounded-full border-2 border-ods-border border-t-ods-accent" }) })
|
|
89
|
+
]
|
|
90
|
+
}
|
|
91
|
+
);
|
|
92
|
+
}
|
|
93
|
+
function PersistentSearchContainer({ isLoading, children, className }) {
|
|
94
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
95
|
+
PersistentFilterControls,
|
|
96
|
+
{
|
|
97
|
+
isLoading,
|
|
98
|
+
preventInteraction: false,
|
|
99
|
+
className,
|
|
100
|
+
children
|
|
101
|
+
}
|
|
102
|
+
);
|
|
103
|
+
}
|
|
104
|
+
function PersistentSidebar({ isLoading, children, className }) {
|
|
105
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
106
|
+
PersistentFilterControls,
|
|
107
|
+
{
|
|
108
|
+
isLoading,
|
|
109
|
+
disabledOpacity: 0.5,
|
|
110
|
+
className: _chunkPRPZBXWZcjs.cn.call(void 0, "lg:sticky lg:top-20", className),
|
|
111
|
+
children
|
|
112
|
+
}
|
|
113
|
+
);
|
|
114
|
+
}
|
|
115
|
+
function PersistentMobileDropdown({ isLoading, children, className }) {
|
|
116
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, PersistentFilterControls, { isLoading, disabledOpacity: 0.7, className: _chunkPRPZBXWZcjs.cn.call(void 0, "lg:hidden", className), children });
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
// src/components/docs/doc-navigation-context.tsx
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
var DocNavigationContext = _react.createContext.call(void 0, null);
|
|
123
|
+
function DocNavigationProvider({ children }) {
|
|
124
|
+
const navMap = _react.useRef.call(void 0, /* @__PURE__ */ new Map());
|
|
125
|
+
const register = _react.useCallback.call(void 0, (nav) => {
|
|
126
|
+
const existing = navMap.current.get(nav.baseRoute);
|
|
127
|
+
if (existing && existing !== nav) {
|
|
128
|
+
console.warn(`[DocNavigationContext] duplicate registration for ${nav.baseRoute}; replacing`);
|
|
129
|
+
}
|
|
130
|
+
navMap.current.set(nav.baseRoute, nav);
|
|
131
|
+
return () => {
|
|
132
|
+
if (navMap.current.get(nav.baseRoute) === nav) {
|
|
133
|
+
navMap.current.delete(nav.baseRoute);
|
|
134
|
+
}
|
|
135
|
+
};
|
|
136
|
+
}, []);
|
|
137
|
+
const findOwningNavigator = _react.useCallback.call(void 0, (path) => {
|
|
138
|
+
const baseRoutes = Array.from(navMap.current.keys()).sort((a, b) => b.length - a.length);
|
|
139
|
+
for (const baseRoute of baseRoutes) {
|
|
140
|
+
if (path === baseRoute || path.startsWith(`${baseRoute}/`)) {
|
|
141
|
+
return _nullishCoalesce(navMap.current.get(baseRoute), () => ( null));
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
if (navMap.current.size === 1) {
|
|
145
|
+
return _nullishCoalesce(navMap.current.values().next().value, () => ( null));
|
|
146
|
+
}
|
|
147
|
+
return null;
|
|
148
|
+
}, []);
|
|
149
|
+
const navigate = _react.useCallback.call(void 0,
|
|
150
|
+
(path) => {
|
|
151
|
+
const nav = findOwningNavigator(path);
|
|
152
|
+
if (!nav) return false;
|
|
153
|
+
const node = nav.findNodeByPath(path);
|
|
154
|
+
if (!node) return false;
|
|
155
|
+
nav.selectNode(node);
|
|
156
|
+
return true;
|
|
157
|
+
},
|
|
158
|
+
[findOwningNavigator]
|
|
159
|
+
);
|
|
160
|
+
const isAvailable = _react.useCallback.call(void 0, () => navMap.current.size > 0, []);
|
|
161
|
+
const value = _react2.default.useMemo(() => ({ register, navigate, isAvailable }), [register, navigate, isAvailable]);
|
|
162
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, DocNavigationContext.Provider, { value, children });
|
|
163
|
+
}
|
|
164
|
+
function useDocNavigation() {
|
|
165
|
+
const ctx = _react.useContext.call(void 0, DocNavigationContext);
|
|
166
|
+
if (!ctx) {
|
|
167
|
+
return {
|
|
168
|
+
register: () => () => {
|
|
169
|
+
},
|
|
170
|
+
navigate: () => false,
|
|
171
|
+
isAvailable: () => false
|
|
172
|
+
};
|
|
173
|
+
}
|
|
174
|
+
return ctx;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
// src/components/docs/use-docs-resolve-link.ts
|
|
178
|
+
|
|
179
|
+
function toResolveLinkResult(body) {
|
|
180
|
+
if (typeof body !== "object" || body === null) {
|
|
181
|
+
return { success: false };
|
|
182
|
+
}
|
|
183
|
+
const envelope = { ...body };
|
|
184
|
+
const inner = envelope.data;
|
|
185
|
+
const fields = typeof inner === "object" && inner !== null ? { ...inner } : envelope;
|
|
186
|
+
const readString2 = (key) => typeof fields[key] === "string" ? fields[key] : void 0;
|
|
187
|
+
return {
|
|
188
|
+
success: fields.success === true,
|
|
189
|
+
resolvedPath: readString2("resolvedPath"),
|
|
190
|
+
type: readString2("type"),
|
|
191
|
+
action: readString2("action"),
|
|
192
|
+
error: readString2("error"),
|
|
193
|
+
message: readString2("message")
|
|
194
|
+
};
|
|
195
|
+
}
|
|
196
|
+
function useDocsResolveLink(sourceId, resolveLinkEndpoint) {
|
|
197
|
+
const chatRuntime = _chunkRDTOMWDNcjs.useChatRuntime.call(void 0, );
|
|
198
|
+
const resolvedResolveLinkEndpoint = _nullishCoalesce(_nullishCoalesce(resolveLinkEndpoint, () => ( _optionalChain([chatRuntime, 'optionalAccess', _2 => _2.endpoints, 'access', _3 => _3.docsResolveLinkUrl]))), () => ( "/api/docs/resolve-link"));
|
|
199
|
+
return _react.useCallback.call(void 0,
|
|
200
|
+
async (href, currentPath) => {
|
|
201
|
+
try {
|
|
202
|
+
const response = await _chunkTRC37VRCcjs.contentFetch.call(void 0, resolvedResolveLinkEndpoint, {
|
|
203
|
+
method: "POST",
|
|
204
|
+
headers: { "Content-Type": "application/json" },
|
|
205
|
+
body: JSON.stringify({ link: href, currentPath, source: sourceId })
|
|
206
|
+
});
|
|
207
|
+
if (!response.ok) {
|
|
208
|
+
return { success: false, error: `Resolve failed: ${response.status}` };
|
|
209
|
+
}
|
|
210
|
+
const json = await response.json();
|
|
211
|
+
return toResolveLinkResult(json);
|
|
212
|
+
} catch (error) {
|
|
213
|
+
return {
|
|
214
|
+
success: false,
|
|
215
|
+
error: error instanceof Error ? error.message : "Resolve failed"
|
|
216
|
+
};
|
|
217
|
+
}
|
|
218
|
+
},
|
|
219
|
+
[resolvedResolveLinkEndpoint, sourceId]
|
|
220
|
+
);
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
// src/components/docs/use-document-tree.ts
|
|
224
|
+
|
|
225
|
+
function scrollToContent() {
|
|
226
|
+
const article = document.querySelector("article");
|
|
227
|
+
if (article) {
|
|
228
|
+
_chunkZI27ALYXcjs.scrollElementIntoView.call(void 0, article, { headerOffset: _chunkZI27ALYXcjs.HUB_HEADER_OFFSET_PX });
|
|
229
|
+
} else {
|
|
230
|
+
_chunkZI27ALYXcjs.scrollElementIntoView.call(void 0, document.documentElement);
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
function findFirstDocPath(folder) {
|
|
234
|
+
const children = _nullishCoalesce(folder.children, () => ( []));
|
|
235
|
+
for (const child of children) {
|
|
236
|
+
if (child.type === "file" && !child.path.toLowerCase().endsWith(".mmd")) {
|
|
237
|
+
return child.path;
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
for (const child of children) {
|
|
241
|
+
if (child.type === "folder") {
|
|
242
|
+
const nested = findFirstDocPath(child);
|
|
243
|
+
if (nested) return nested;
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
return null;
|
|
247
|
+
}
|
|
248
|
+
function isRecord(value) {
|
|
249
|
+
return typeof value === "object" && value !== null;
|
|
250
|
+
}
|
|
251
|
+
function isUnknownArray(value) {
|
|
252
|
+
return Array.isArray(value);
|
|
253
|
+
}
|
|
254
|
+
function readString(source, key) {
|
|
255
|
+
const value = source[key];
|
|
256
|
+
return typeof value === "string" ? value : void 0;
|
|
257
|
+
}
|
|
258
|
+
function isDocumentType(value) {
|
|
259
|
+
return value === "markdown" || value === "pdf" || value === "google_sheet" || value === "figma" || value === "file";
|
|
260
|
+
}
|
|
261
|
+
function toDocNode(value) {
|
|
262
|
+
if (!isRecord(value)) return null;
|
|
263
|
+
const id = readString(value, "id");
|
|
264
|
+
const name = readString(value, "name");
|
|
265
|
+
const path = readString(value, "path");
|
|
266
|
+
const type = value.type;
|
|
267
|
+
if (id === void 0 || name === void 0 || path === void 0) return null;
|
|
268
|
+
if (type !== "file" && type !== "folder") return null;
|
|
269
|
+
const sortOrder = value.sortOrder;
|
|
270
|
+
const hasReadme = value.hasReadme;
|
|
271
|
+
return {
|
|
272
|
+
id,
|
|
273
|
+
name,
|
|
274
|
+
slug: _nullishCoalesce(_nullishCoalesce(readString(value, "slug"), () => ( path.split("/").pop())), () => ( "")),
|
|
275
|
+
path,
|
|
276
|
+
type,
|
|
277
|
+
hasReadme: typeof hasReadme === "boolean" ? hasReadme : void 0,
|
|
278
|
+
sortOrder: typeof sortOrder === "number" ? sortOrder : void 0,
|
|
279
|
+
documentType: isDocumentType(value.documentType) ? value.documentType : void 0,
|
|
280
|
+
children: _nullishCoalesce(toDocNodes(value.children), () => ( void 0))
|
|
281
|
+
};
|
|
282
|
+
}
|
|
283
|
+
function toDocNodes(value) {
|
|
284
|
+
if (!isUnknownArray(value)) return null;
|
|
285
|
+
const nodes = [];
|
|
286
|
+
for (const entry of value) {
|
|
287
|
+
const node = toDocNode(entry);
|
|
288
|
+
if (node) nodes.push(node);
|
|
289
|
+
}
|
|
290
|
+
return nodes;
|
|
291
|
+
}
|
|
292
|
+
function toDocSections(value) {
|
|
293
|
+
if (!isUnknownArray(value)) return [];
|
|
294
|
+
const sections = [];
|
|
295
|
+
for (const entry of value) {
|
|
296
|
+
if (!isRecord(entry)) continue;
|
|
297
|
+
const id = readString(entry, "id");
|
|
298
|
+
const title = readString(entry, "title");
|
|
299
|
+
const level = entry.level;
|
|
300
|
+
if (id === void 0 || title === void 0 || typeof level !== "number") continue;
|
|
301
|
+
sections.push({ id, title, level });
|
|
302
|
+
}
|
|
303
|
+
return sections;
|
|
304
|
+
}
|
|
305
|
+
function toStringArray(value) {
|
|
306
|
+
if (!isUnknownArray(value)) return void 0;
|
|
307
|
+
return value.filter((entry) => typeof entry === "string");
|
|
308
|
+
}
|
|
309
|
+
function toDocContent(value, requestedPath) {
|
|
310
|
+
if (!isRecord(value)) return null;
|
|
311
|
+
const fileSize = value.fileSize;
|
|
312
|
+
return {
|
|
313
|
+
content: _nullishCoalesce(readString(value, "content"), () => ( "")),
|
|
314
|
+
sections: toDocSections(value.sections),
|
|
315
|
+
path: _nullishCoalesce(readString(value, "path"), () => ( requestedPath)),
|
|
316
|
+
documentType: isDocumentType(value.documentType) ? value.documentType : void 0,
|
|
317
|
+
brokenLinks: toStringArray(value.brokenLinks),
|
|
318
|
+
fileUrl: readString(value, "fileUrl"),
|
|
319
|
+
externalUrl: readString(value, "externalUrl"),
|
|
320
|
+
mimeType: readString(value, "mimeType"),
|
|
321
|
+
fileName: readString(value, "fileName"),
|
|
322
|
+
fileSize: typeof fileSize === "number" ? fileSize : void 0,
|
|
323
|
+
publishedAt: readString(value, "publishedAt"),
|
|
324
|
+
updatedAt: readString(value, "updatedAt")
|
|
325
|
+
};
|
|
326
|
+
}
|
|
327
|
+
function useDocumentTree(config, initialPath) {
|
|
328
|
+
const { structureEndpoint, contentEndpoint, baseRoute } = config;
|
|
329
|
+
const folderIndexFile = _nullishCoalesce(config.folderIndexFile, () => ( _chunkHMEEW73Fcjs.DEFAULT_FOLDER_INDEX_FILE));
|
|
330
|
+
const cleanInitialPath = _chunkHMEEW73Fcjs.stripFolderIndexFromPath.call(void 0, _optionalChain([initialPath, 'optionalAccess', _4 => _4.replace, 'call', _5 => _5(/\/$/, "")]) || "", folderIndexFile);
|
|
331
|
+
const [structure, setStructure] = _react.useState.call(void 0, []);
|
|
332
|
+
const [selectedPath, setSelectedPath] = _react.useState.call(void 0, cleanInitialPath);
|
|
333
|
+
const [content, setContent] = _react.useState.call(void 0, null);
|
|
334
|
+
const [isLoadingStructure, setIsLoadingStructure] = _react.useState.call(void 0, true);
|
|
335
|
+
const [isLoadingContent, setIsLoadingContent] = _react.useState.call(void 0, false);
|
|
336
|
+
const [error, setError] = _react.useState.call(void 0, null);
|
|
337
|
+
const [expandedNodes, setExpandedNodes] = _react.useState.call(void 0, /* @__PURE__ */ new Set());
|
|
338
|
+
const lastFetchedPath = _react.useRef.call(void 0, null);
|
|
339
|
+
const normalizedBaseRoute = baseRoute.replace(/\/$/, "");
|
|
340
|
+
const selectedPathRef = _react.useRef.call(void 0, selectedPath);
|
|
341
|
+
_react.useEffect.call(void 0, () => {
|
|
342
|
+
selectedPathRef.current = selectedPath;
|
|
343
|
+
});
|
|
344
|
+
const docNavigation = useDocNavigation();
|
|
345
|
+
_react.useEffect.call(void 0, () => {
|
|
346
|
+
const handlePopState = () => {
|
|
347
|
+
const pathname = window.location.pathname;
|
|
348
|
+
let pathFromUrl = "";
|
|
349
|
+
if (pathname === normalizedBaseRoute || pathname === `${normalizedBaseRoute}/`) {
|
|
350
|
+
pathFromUrl = "";
|
|
351
|
+
} else if (pathname.startsWith(`${normalizedBaseRoute}/`)) {
|
|
352
|
+
pathFromUrl = pathname.substring(`${normalizedBaseRoute}/`.length);
|
|
353
|
+
}
|
|
354
|
+
pathFromUrl = _chunkHMEEW73Fcjs.stripFolderIndexFromPath.call(void 0, pathFromUrl, folderIndexFile);
|
|
355
|
+
if (pathFromUrl !== selectedPathRef.current) {
|
|
356
|
+
setSelectedPath(pathFromUrl);
|
|
357
|
+
if (pathFromUrl) {
|
|
358
|
+
const parentPath = pathFromUrl.includes("/") ? pathFromUrl.substring(0, pathFromUrl.lastIndexOf("/")) : pathFromUrl;
|
|
359
|
+
setExpandedNodes(new Set(_chunkHMEEW73Fcjs.getDocAncestorNodeIds.call(void 0, parentPath)));
|
|
360
|
+
}
|
|
361
|
+
setTimeout(() => {
|
|
362
|
+
scrollToContent();
|
|
363
|
+
}, 150);
|
|
364
|
+
}
|
|
365
|
+
};
|
|
366
|
+
window.addEventListener("popstate", handlePopState);
|
|
367
|
+
return () => window.removeEventListener("popstate", handlePopState);
|
|
368
|
+
}, [normalizedBaseRoute, folderIndexFile]);
|
|
369
|
+
const [syncedInitialPath, setSyncedInitialPath] = _react.useState.call(void 0, cleanInitialPath);
|
|
370
|
+
const [externalNavCount, setExternalNavCount] = _react.useState.call(void 0, 0);
|
|
371
|
+
if (syncedInitialPath !== cleanInitialPath) {
|
|
372
|
+
setSyncedInitialPath(cleanInitialPath);
|
|
373
|
+
if (cleanInitialPath !== selectedPath) {
|
|
374
|
+
setSelectedPath(cleanInitialPath);
|
|
375
|
+
if (cleanInitialPath) {
|
|
376
|
+
const parentPath = cleanInitialPath.includes("/") ? cleanInitialPath.substring(0, cleanInitialPath.lastIndexOf("/")) : cleanInitialPath;
|
|
377
|
+
setExpandedNodes(new Set(_chunkHMEEW73Fcjs.getDocAncestorNodeIds.call(void 0, parentPath)));
|
|
378
|
+
}
|
|
379
|
+
setExternalNavCount((n) => n + 1);
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
_react.useEffect.call(void 0, () => {
|
|
383
|
+
if (externalNavCount === 0) return void 0;
|
|
384
|
+
const timer = setTimeout(scrollToContent, 150);
|
|
385
|
+
return () => clearTimeout(timer);
|
|
386
|
+
}, [externalNavCount]);
|
|
387
|
+
const fetchStructure = async () => {
|
|
388
|
+
try {
|
|
389
|
+
setIsLoadingStructure(true);
|
|
390
|
+
setError(null);
|
|
391
|
+
const response = await _chunkTRC37VRCcjs.contentFetch.call(void 0, structureEndpoint);
|
|
392
|
+
if (!response.ok) {
|
|
393
|
+
throw new Error("Failed to load documentation structure");
|
|
394
|
+
}
|
|
395
|
+
const payload = await response.json();
|
|
396
|
+
const nodes = isRecord(payload) && payload.success ? toDocNodes(payload.data) : null;
|
|
397
|
+
if (nodes) {
|
|
398
|
+
setStructure(nodes);
|
|
399
|
+
if (cleanInitialPath) {
|
|
400
|
+
const pathForExpansion = cleanInitialPath.includes(".") ? cleanInitialPath.substring(0, cleanInitialPath.lastIndexOf("/")) : cleanInitialPath;
|
|
401
|
+
if (pathForExpansion) {
|
|
402
|
+
setExpandedNodes(new Set(_chunkHMEEW73Fcjs.getDocAncestorNodeIds.call(void 0, pathForExpansion)));
|
|
403
|
+
}
|
|
404
|
+
} else if (nodes.length > 0) {
|
|
405
|
+
const hasRootReadme = nodes.some((node) => node.type === "file" && node.path === folderIndexFile);
|
|
406
|
+
if (!hasRootReadme) {
|
|
407
|
+
const firstNode = nodes[0];
|
|
408
|
+
if (firstNode.type === "folder") {
|
|
409
|
+
setExpandedNodes(/* @__PURE__ */ new Set([firstNode.id]));
|
|
410
|
+
if (firstNode.hasReadme) {
|
|
411
|
+
setSelectedPath(firstNode.path);
|
|
412
|
+
window.history.replaceState({}, "", `${normalizedBaseRoute}/${firstNode.path}`);
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
} else {
|
|
418
|
+
setError(_chunkLEISUAHFcjs.apiErrorMessage.call(void 0, payload, "Failed to load documentation structure"));
|
|
419
|
+
}
|
|
420
|
+
} catch (err) {
|
|
421
|
+
console.error("Error fetching documentation structure:", err);
|
|
422
|
+
setError(err instanceof Error ? err.message : "Failed to load documentation");
|
|
423
|
+
} finally {
|
|
424
|
+
setIsLoadingStructure(false);
|
|
425
|
+
}
|
|
426
|
+
};
|
|
427
|
+
const fetchContent = async (path) => {
|
|
428
|
+
try {
|
|
429
|
+
setIsLoadingContent(true);
|
|
430
|
+
const response = await _chunkTRC37VRCcjs.contentFetch.call(void 0, `${contentEndpoint}?path=${encodeURIComponent(path)}`);
|
|
431
|
+
if (path !== lastFetchedPath.current) return;
|
|
432
|
+
if (!response.ok) {
|
|
433
|
+
if (response.status === 404) {
|
|
434
|
+
const errorPayload = await response.json().catch(() => null);
|
|
435
|
+
if (path !== lastFetchedPath.current) return;
|
|
436
|
+
if (path === folderIndexFile && selectedPath === "") {
|
|
437
|
+
lastFetchedPath.current = null;
|
|
438
|
+
setError(null);
|
|
439
|
+
setContent(null);
|
|
440
|
+
return;
|
|
441
|
+
}
|
|
442
|
+
const probe = _chunkHMEEW73Fcjs.findDocNodeByPath.call(void 0, _chunkHMEEW73Fcjs.stripFolderIndexFromPath.call(void 0, path, folderIndexFile), structure);
|
|
443
|
+
const probeIsNoReadmeFolder = !!probe && probe.type === "folder" && !probe.hasReadme;
|
|
444
|
+
const preStructureFolderLike = structure.length === 0 && !path.endsWith(".md");
|
|
445
|
+
if (probeIsNoReadmeFolder || preStructureFolderLike) {
|
|
446
|
+
lastFetchedPath.current = null;
|
|
447
|
+
setError(null);
|
|
448
|
+
setContent(null);
|
|
449
|
+
return;
|
|
450
|
+
}
|
|
451
|
+
setError(_chunkLEISUAHFcjs.apiErrorMessage.call(void 0, errorPayload, "Documentation file not found"));
|
|
452
|
+
setContent(null);
|
|
453
|
+
return;
|
|
454
|
+
}
|
|
455
|
+
throw new Error("Failed to load documentation content");
|
|
456
|
+
}
|
|
457
|
+
const payload = await response.json();
|
|
458
|
+
if (path !== lastFetchedPath.current) return;
|
|
459
|
+
setError(null);
|
|
460
|
+
const doc = isRecord(payload) && payload.success ? toDocContent(payload.data, path) : null;
|
|
461
|
+
if (doc) {
|
|
462
|
+
const correctPath = isRecord(payload) && payload.redirect ? readString(payload, "correctPath") : void 0;
|
|
463
|
+
if (correctPath !== void 0) {
|
|
464
|
+
setSelectedPath(correctPath);
|
|
465
|
+
window.history.replaceState({}, "", `${normalizedBaseRoute}/${correctPath}`);
|
|
466
|
+
}
|
|
467
|
+
setContent(doc);
|
|
468
|
+
} else {
|
|
469
|
+
setError(_chunkLEISUAHFcjs.apiErrorMessage.call(void 0, payload, "Failed to load content"));
|
|
470
|
+
setContent(null);
|
|
471
|
+
}
|
|
472
|
+
} catch (err) {
|
|
473
|
+
if (path !== lastFetchedPath.current) return;
|
|
474
|
+
console.error("Error fetching documentation content:", err);
|
|
475
|
+
setError(err instanceof Error ? err.message : "Failed to load content");
|
|
476
|
+
setContent(null);
|
|
477
|
+
} finally {
|
|
478
|
+
if (path === lastFetchedPath.current) setIsLoadingContent(false);
|
|
479
|
+
}
|
|
480
|
+
};
|
|
481
|
+
const latestRef = _react.useRef.call(void 0, { fetchContent, fetchStructure, cleanInitialPath, folderIndexFile });
|
|
482
|
+
_react.useEffect.call(void 0, () => {
|
|
483
|
+
latestRef.current = { fetchContent, fetchStructure, cleanInitialPath, folderIndexFile };
|
|
484
|
+
});
|
|
485
|
+
_react.useEffect.call(void 0, () => {
|
|
486
|
+
const latest = latestRef.current;
|
|
487
|
+
const speculativeContentPath = latest.cleanInitialPath || latest.folderIndexFile;
|
|
488
|
+
lastFetchedPath.current = speculativeContentPath;
|
|
489
|
+
void latest.fetchContent(speculativeContentPath);
|
|
490
|
+
void latest.fetchStructure();
|
|
491
|
+
}, []);
|
|
492
|
+
_react.useEffect.call(void 0, () => {
|
|
493
|
+
if (selectedPath === null || selectedPath === void 0) return;
|
|
494
|
+
if (!structure || structure.length === 0) return;
|
|
495
|
+
let pathToFetch = null;
|
|
496
|
+
if (selectedPath === "") {
|
|
497
|
+
pathToFetch = folderIndexFile;
|
|
498
|
+
} else {
|
|
499
|
+
const node = _chunkHMEEW73Fcjs.findDocNodeByPath.call(void 0, selectedPath, structure);
|
|
500
|
+
if (node && node.type === "folder" && !node.hasReadme) {
|
|
501
|
+
const firstDocPath = findFirstDocPath(node);
|
|
502
|
+
if (!firstDocPath) {
|
|
503
|
+
lastFetchedPath.current = null;
|
|
504
|
+
return;
|
|
505
|
+
}
|
|
506
|
+
pathToFetch = firstDocPath;
|
|
507
|
+
} else if (node && node.type === "folder" && node.hasReadme) {
|
|
508
|
+
if (lastFetchedPath.current === selectedPath) {
|
|
509
|
+
return;
|
|
510
|
+
}
|
|
511
|
+
pathToFetch = `${selectedPath}/${folderIndexFile}`;
|
|
512
|
+
} else {
|
|
513
|
+
pathToFetch = selectedPath;
|
|
514
|
+
}
|
|
515
|
+
}
|
|
516
|
+
if (pathToFetch === lastFetchedPath.current) {
|
|
517
|
+
return;
|
|
518
|
+
}
|
|
519
|
+
if (pathToFetch) {
|
|
520
|
+
lastFetchedPath.current = pathToFetch;
|
|
521
|
+
void latestRef.current.fetchContent(pathToFetch);
|
|
522
|
+
}
|
|
523
|
+
}, [selectedPath, structure, folderIndexFile]);
|
|
524
|
+
const toggleNode = _react.useCallback.call(void 0, (nodeId) => {
|
|
525
|
+
setExpandedNodes((prev) => {
|
|
526
|
+
const next = new Set(prev);
|
|
527
|
+
if (next.has(nodeId)) {
|
|
528
|
+
next.delete(nodeId);
|
|
529
|
+
} else {
|
|
530
|
+
next.add(nodeId);
|
|
531
|
+
}
|
|
532
|
+
return next;
|
|
533
|
+
});
|
|
534
|
+
}, []);
|
|
535
|
+
const selectNode = _react.useCallback.call(void 0,
|
|
536
|
+
(node) => {
|
|
537
|
+
if (node.type === "folder") {
|
|
538
|
+
setExpandedNodes((prev) => {
|
|
539
|
+
if (prev.has(node.id)) {
|
|
540
|
+
const ancestorIds = _chunkHMEEW73Fcjs.getDocAncestorNodeIds.call(void 0, node.path);
|
|
541
|
+
ancestorIds.pop();
|
|
542
|
+
return new Set(ancestorIds);
|
|
543
|
+
}
|
|
544
|
+
return new Set(_chunkHMEEW73Fcjs.getDocAncestorNodeIds.call(void 0, node.path));
|
|
545
|
+
});
|
|
546
|
+
} else {
|
|
547
|
+
const lastSlash = node.path.lastIndexOf("/");
|
|
548
|
+
if (lastSlash > 0) {
|
|
549
|
+
setExpandedNodes(new Set(_chunkHMEEW73Fcjs.getDocAncestorNodeIds.call(void 0, node.path.substring(0, lastSlash))));
|
|
550
|
+
}
|
|
551
|
+
}
|
|
552
|
+
lastFetchedPath.current = null;
|
|
553
|
+
setSelectedPath(node.path);
|
|
554
|
+
window.history.pushState({}, "", `${normalizedBaseRoute}/${node.path}`);
|
|
555
|
+
setTimeout(scrollToContent, 150);
|
|
556
|
+
},
|
|
557
|
+
[normalizedBaseRoute]
|
|
558
|
+
);
|
|
559
|
+
const navigateToDoc = _react.useCallback.call(void 0,
|
|
560
|
+
(path, options) => {
|
|
561
|
+
const hashIndex = path.indexOf("#");
|
|
562
|
+
const anchor = hashIndex !== -1 ? path.substring(hashIndex) : "";
|
|
563
|
+
const cleanPath = path.replace(/\/$/, "").split("#")[0];
|
|
564
|
+
const pathForSelection = anchor && _optionalChain([options, 'optionalAccess', _6 => _6.fromInternalLink]) && cleanPath === "" ? selectedPathRef.current : _chunkHMEEW73Fcjs.stripFolderIndexFromPath.call(void 0, cleanPath, folderIndexFile);
|
|
565
|
+
if (anchor && _optionalChain([options, 'optionalAccess', _7 => _7.fromInternalLink]) && pathForSelection === selectedPathRef.current) {
|
|
566
|
+
_chunkZI27ALYXcjs.navigateSamePageHash.call(void 0, anchor, { headerOffset: _chunkZI27ALYXcjs.HUB_HEADER_OFFSET_PX });
|
|
567
|
+
return;
|
|
568
|
+
}
|
|
569
|
+
const scrollAfterNav = () => {
|
|
570
|
+
if (anchor) {
|
|
571
|
+
setTimeout(() => {
|
|
572
|
+
const el = document.getElementById(anchor.substring(1));
|
|
573
|
+
if (el) {
|
|
574
|
+
_chunkZI27ALYXcjs.scrollElementIntoView.call(void 0, el, { headerOffset: _chunkZI27ALYXcjs.HUB_HEADER_OFFSET_PX });
|
|
575
|
+
} else {
|
|
576
|
+
scrollToContent();
|
|
577
|
+
}
|
|
578
|
+
}, 300);
|
|
579
|
+
} else {
|
|
580
|
+
setTimeout(() => {
|
|
581
|
+
scrollToContent();
|
|
582
|
+
}, 150);
|
|
583
|
+
}
|
|
584
|
+
};
|
|
585
|
+
if (_optionalChain([options, 'optionalAccess', _8 => _8.expandFolder])) {
|
|
586
|
+
lastFetchedPath.current = null;
|
|
587
|
+
setSelectedPath(cleanPath);
|
|
588
|
+
window.history.pushState({}, "", `${normalizedBaseRoute}/${cleanPath}${anchor}`);
|
|
589
|
+
const pathParts2 = cleanPath.split("/");
|
|
590
|
+
const nodeIdsToExpand = [];
|
|
591
|
+
let currentPath2 = "";
|
|
592
|
+
for (const part of pathParts2) {
|
|
593
|
+
currentPath2 = currentPath2 ? `${currentPath2}-${part}` : part;
|
|
594
|
+
nodeIdsToExpand.push(currentPath2.toLowerCase());
|
|
595
|
+
}
|
|
596
|
+
setExpandedNodes(new Set(nodeIdsToExpand));
|
|
597
|
+
if (_optionalChain([options, 'optionalAccess', _9 => _9.fromInternalLink])) {
|
|
598
|
+
scrollAfterNav();
|
|
599
|
+
}
|
|
600
|
+
setError(null);
|
|
601
|
+
return;
|
|
602
|
+
}
|
|
603
|
+
const urlPath = pathForSelection;
|
|
604
|
+
lastFetchedPath.current = null;
|
|
605
|
+
setSelectedPath(pathForSelection);
|
|
606
|
+
window.history.pushState({}, "", `${normalizedBaseRoute}/${urlPath}${anchor}`);
|
|
607
|
+
if (_optionalChain([options, 'optionalAccess', _10 => _10.fromInternalLink])) {
|
|
608
|
+
scrollAfterNav();
|
|
609
|
+
}
|
|
610
|
+
const pathParts = cleanPath.split("/");
|
|
611
|
+
const parentIds = [];
|
|
612
|
+
let currentPath = "";
|
|
613
|
+
const partsToProcess = cleanPath.includes(".") ? pathParts.slice(0, -1) : pathParts;
|
|
614
|
+
for (const part of partsToProcess) {
|
|
615
|
+
currentPath = currentPath ? `${currentPath}-${part}` : part;
|
|
616
|
+
parentIds.push(currentPath.toLowerCase());
|
|
617
|
+
}
|
|
618
|
+
if (parentIds.length > 0) {
|
|
619
|
+
setExpandedNodes(new Set(parentIds));
|
|
620
|
+
}
|
|
621
|
+
},
|
|
622
|
+
[normalizedBaseRoute, folderIndexFile]
|
|
623
|
+
);
|
|
624
|
+
_react.useEffect.call(void 0, () => {
|
|
625
|
+
return docNavigation.register({
|
|
626
|
+
baseRoute: normalizedBaseRoute,
|
|
627
|
+
findNodeByPath: (path) => {
|
|
628
|
+
const clean = _chunkHMEEW73Fcjs.stripFolderIndexFromPath.call(void 0, path.replace(/\/$/, "").split("#")[0], folderIndexFile);
|
|
629
|
+
return _nullishCoalesce(_chunkHMEEW73Fcjs.findDocNodeByPath.call(void 0, clean, structure), () => ( null));
|
|
630
|
+
},
|
|
631
|
+
selectNode
|
|
632
|
+
});
|
|
633
|
+
}, [docNavigation, normalizedBaseRoute, structure, selectNode, folderIndexFile]);
|
|
634
|
+
const isEmptyFolder = _react.useMemo.call(void 0, () => {
|
|
635
|
+
if (!selectedPath || structure.length === 0) return false;
|
|
636
|
+
const node = _chunkHMEEW73Fcjs.findDocNodeByPath.call(void 0, selectedPath, structure);
|
|
637
|
+
return !!node && node.type === "folder" && !node.hasReadme && !findFirstDocPath(node);
|
|
638
|
+
}, [selectedPath, structure]);
|
|
639
|
+
return {
|
|
640
|
+
structure,
|
|
641
|
+
selectedPath,
|
|
642
|
+
setSelectedPath,
|
|
643
|
+
content: isEmptyFolder ? null : content,
|
|
644
|
+
isLoadingStructure,
|
|
645
|
+
isLoadingContent: isEmptyFolder ? false : isLoadingContent,
|
|
646
|
+
error: isEmptyFolder ? null : error,
|
|
647
|
+
expandedNodes,
|
|
648
|
+
toggleNode,
|
|
649
|
+
selectNode,
|
|
650
|
+
navigateToDoc,
|
|
651
|
+
refetch: fetchStructure,
|
|
652
|
+
setExpandedNodes
|
|
653
|
+
};
|
|
654
|
+
}
|
|
655
|
+
|
|
656
|
+
// src/components/docs/use-scroll-spy.ts
|
|
657
|
+
|
|
658
|
+
var SCROLL_OFFSET = 100;
|
|
659
|
+
var ID_SEPARATOR = "\n";
|
|
660
|
+
function useScrollSpy(sections) {
|
|
661
|
+
const [activeSection, setActiveSection] = _react.useState.call(void 0, "");
|
|
662
|
+
const isScrollingFromClick = _react.useRef.call(void 0, false);
|
|
663
|
+
const sectionIdsKey = _react.useMemo.call(void 0, () => _nullishCoalesce(_optionalChain([sections, 'optionalAccess', _11 => _11.map, 'call', _12 => _12((s) => s.id), 'access', _13 => _13.join, 'call', _14 => _14(ID_SEPARATOR)]), () => ( "")), [sections]);
|
|
664
|
+
const handleSectionClick = _react.useCallback.call(void 0, (sectionId) => {
|
|
665
|
+
const targetElement = document.getElementById(sectionId);
|
|
666
|
+
if (!targetElement) return;
|
|
667
|
+
isScrollingFromClick.current = true;
|
|
668
|
+
setActiveSection(sectionId);
|
|
669
|
+
_chunkZI27ALYXcjs.scrollElementIntoView.call(void 0, targetElement, { headerOffset: SCROLL_OFFSET });
|
|
670
|
+
setTimeout(() => {
|
|
671
|
+
isScrollingFromClick.current = false;
|
|
672
|
+
}, 800);
|
|
673
|
+
}, []);
|
|
674
|
+
_react.useEffect.call(void 0, () => {
|
|
675
|
+
const sectionIds = sectionIdsKey === "" ? [] : sectionIdsKey.split(ID_SEPARATOR);
|
|
676
|
+
if (sectionIds.length === 0) return void 0;
|
|
677
|
+
const handleScroll = () => {
|
|
678
|
+
if (isScrollingFromClick.current) return;
|
|
679
|
+
const scrollPosition = window.scrollY + SCROLL_OFFSET;
|
|
680
|
+
let currentSection = _nullishCoalesce(sectionIds[0], () => ( ""));
|
|
681
|
+
for (let i = sectionIds.length - 1; i >= 0; i--) {
|
|
682
|
+
const element = document.getElementById(sectionIds[i]);
|
|
683
|
+
if (element && scrollPosition >= element.offsetTop) {
|
|
684
|
+
currentSection = sectionIds[i];
|
|
685
|
+
break;
|
|
686
|
+
}
|
|
687
|
+
}
|
|
688
|
+
setActiveSection((prev) => prev !== currentSection ? currentSection : prev);
|
|
689
|
+
};
|
|
690
|
+
let scrollTimer;
|
|
691
|
+
const throttledScroll = () => {
|
|
692
|
+
clearTimeout(scrollTimer);
|
|
693
|
+
scrollTimer = setTimeout(handleScroll, 100);
|
|
694
|
+
};
|
|
695
|
+
window.addEventListener("scroll", throttledScroll);
|
|
696
|
+
handleScroll();
|
|
697
|
+
return () => {
|
|
698
|
+
window.removeEventListener("scroll", throttledScroll);
|
|
699
|
+
clearTimeout(scrollTimer);
|
|
700
|
+
};
|
|
701
|
+
}, [sectionIdsKey]);
|
|
702
|
+
return { activeSection, handleSectionClick };
|
|
703
|
+
}
|
|
704
|
+
|
|
705
|
+
// src/components/docs/doc-viewer.tsx
|
|
706
|
+
|
|
707
|
+
var DEFAULT_DOC_VIEWER_PALETTE = {
|
|
708
|
+
background: "bg-ods-bg",
|
|
709
|
+
containerBackground: "transparent",
|
|
710
|
+
headerText: "text-ods-text-primary",
|
|
711
|
+
primaryText: "text-ods-text-primary",
|
|
712
|
+
secondaryText: "text-ods-text-secondary",
|
|
713
|
+
accent: "var(--ods-accent)",
|
|
714
|
+
border: "border-ods-border",
|
|
715
|
+
cardBackground: "bg-ods-card"
|
|
716
|
+
};
|
|
717
|
+
function DocViewer(props) {
|
|
718
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, DocViewerContent, { ...props });
|
|
719
|
+
}
|
|
720
|
+
function DocViewerContent({
|
|
721
|
+
sourceId,
|
|
722
|
+
renderContent,
|
|
723
|
+
renderSkeleton,
|
|
724
|
+
chatSource,
|
|
725
|
+
title,
|
|
726
|
+
subtitle,
|
|
727
|
+
colorPalette = DEFAULT_DOC_VIEWER_PALETTE,
|
|
728
|
+
className = "",
|
|
729
|
+
shell = true,
|
|
730
|
+
docPath,
|
|
731
|
+
sidebarLabel = "DOCUMENTATION",
|
|
732
|
+
structureEndpoint,
|
|
733
|
+
contentEndpoint,
|
|
734
|
+
searchEndpoint,
|
|
735
|
+
resolveLinkEndpoint,
|
|
736
|
+
baseRoute,
|
|
737
|
+
emptyStateText,
|
|
738
|
+
showAIChat = false,
|
|
739
|
+
folderIndexFile,
|
|
740
|
+
backButton
|
|
741
|
+
}) {
|
|
742
|
+
const resolvedStructureEndpoint = _nullishCoalesce(structureEndpoint, () => ( `/api/docs/sources/${sourceId}/structure`));
|
|
743
|
+
const resolvedContentEndpoint = _nullishCoalesce(contentEndpoint, () => ( `/api/docs/sources/${sourceId}/content`));
|
|
744
|
+
const resolveLink = useDocsResolveLink(sourceId, resolveLinkEndpoint);
|
|
745
|
+
const {
|
|
746
|
+
structure,
|
|
747
|
+
selectedPath,
|
|
748
|
+
content,
|
|
749
|
+
isLoadingStructure,
|
|
750
|
+
isLoadingContent,
|
|
751
|
+
error,
|
|
752
|
+
expandedNodes,
|
|
753
|
+
selectNode,
|
|
754
|
+
toggleNode,
|
|
755
|
+
navigateToDoc
|
|
756
|
+
} = useDocumentTree(
|
|
757
|
+
{
|
|
758
|
+
structureEndpoint: resolvedStructureEndpoint,
|
|
759
|
+
contentEndpoint: resolvedContentEndpoint,
|
|
760
|
+
baseRoute,
|
|
761
|
+
folderIndexFile
|
|
762
|
+
},
|
|
763
|
+
docPath
|
|
764
|
+
);
|
|
765
|
+
const { activeSection, handleSectionClick } = useScrollSpy(_optionalChain([content, 'optionalAccess', _15 => _15.sections]));
|
|
766
|
+
const docNav = useDocNavigation();
|
|
767
|
+
const router = _chunkSADRZ4YIcjs.useRouter.call(void 0, );
|
|
768
|
+
const backCfg = backButton === false ? null : {
|
|
769
|
+
label: _nullishCoalesce(_optionalChain([backButton, 'optionalAccess', _16 => _16.label]), () => ( "Back to home")),
|
|
770
|
+
onClick: () => router.push(_nullishCoalesce(_optionalChain([backButton, 'optionalAccess', _17 => _17.href]), () => ( "/")))
|
|
771
|
+
};
|
|
772
|
+
const docSearch = _chunkKS7NKONCcjs.useDocSearch.call(void 0, {
|
|
773
|
+
source: chatSource,
|
|
774
|
+
baseRoute,
|
|
775
|
+
searchEndpoint,
|
|
776
|
+
onNavigate: (path) => navigateToDoc(path, { fromInternalLink: true }),
|
|
777
|
+
onInPageSwap: (path) => docNav.navigate(path)
|
|
778
|
+
});
|
|
779
|
+
const renderedContent = _react.useMemo.call(void 0, () => {
|
|
780
|
+
if (!content) return null;
|
|
781
|
+
return renderContent(content, {
|
|
782
|
+
onInternalLinkClick: navigateToDoc,
|
|
783
|
+
// Relative-link base = the RENDERED document's path, NOT `selectedPath`.
|
|
784
|
+
// They diverge for a no-README folder: selection stays on the folder
|
|
785
|
+
// (e.g. `repo/diagrams`) while the body is its first descendant doc
|
|
786
|
+
// (e.g. `repo/diagrams/architecture/README.md`, via `findFirstDocPath`).
|
|
787
|
+
// Resolving `./sibling.mmd` against the folder would 404; resolving it
|
|
788
|
+
// against `content.path` lands in the descendant's directory. The DAL
|
|
789
|
+
// sets `content.path` to the served doc in all cases (file / README
|
|
790
|
+
// folder / first-child fallback), so this is correct everywhere.
|
|
791
|
+
currentPath: content.path,
|
|
792
|
+
sourceId,
|
|
793
|
+
onResolveLink: resolveLink
|
|
794
|
+
});
|
|
795
|
+
}, [content, renderContent, navigateToDoc, sourceId, resolveLink]);
|
|
796
|
+
const selectedNodeDocType = selectedPath && structure.length > 0 ? _optionalChain([_chunkHMEEW73Fcjs.findDocNodeByPath.call(void 0, selectedPath, structure), 'optionalAccess', _18 => _18.documentType]) : void 0;
|
|
797
|
+
const activeDocType = _nullishCoalesce(_optionalChain([content, 'optionalAccess', _19 => _19.documentType]), () => ( selectedNodeDocType));
|
|
798
|
+
const isMarkdownContent = !activeDocType || activeDocType === "markdown";
|
|
799
|
+
const showStickyNav = isMarkdownContent;
|
|
800
|
+
const stickyNavSections = _nullishCoalesce(_optionalChain([content, 'optionalAccess', _20 => _20.sections, 'optionalAccess', _21 => _21.map, 'call', _22 => _22((s) => ({ id: s.id, label: s.title }))]), () => ( []));
|
|
801
|
+
const isColorValue = colorPalette.background.startsWith("#") || colorPalette.background.startsWith("rgb") || colorPalette.background.startsWith("var(");
|
|
802
|
+
const bgStyle = isColorValue ? { backgroundColor: colorPalette.background } : {};
|
|
803
|
+
const bgClass = !isColorValue ? colorPalette.background : "";
|
|
804
|
+
const containerBgStyle = colorPalette.containerBackground !== "transparent" ? { backgroundColor: colorPalette.containerBackground } : {};
|
|
805
|
+
const defaultEmptyText = structure.length > 0 ? "Select a document from the sidebar to view" : "No documents yet. Add content from the admin panel.";
|
|
806
|
+
const resolvedEmptyText = emptyStateText || defaultEmptyText;
|
|
807
|
+
const inner = /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { style: { ...bgStyle, ...containerBgStyle }, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkHMEEW73Fcjs.PageLayout, { title, subtitle, titleSize: "h1", titleWrap: true, backButton: _nullishCoalesce(backCfg, () => ( void 0)), children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full flex-col gap-10", children: [
|
|
808
|
+
showAIChat && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
809
|
+
_chunkKS7NKONCcjs.DocSearchBar,
|
|
810
|
+
{
|
|
811
|
+
placeholder: `Search ${_optionalChain([sidebarLabel, 'optionalAccess', _23 => _23.toLowerCase, 'call', _24 => _24()]) || "documents"}...`,
|
|
812
|
+
query: docSearch.query,
|
|
813
|
+
onQueryChange: docSearch.setQuery,
|
|
814
|
+
results: docSearch.results,
|
|
815
|
+
isLoading: docSearch.isLoading,
|
|
816
|
+
onResultSelect: docSearch.handleResultSelect,
|
|
817
|
+
showDropdown: docSearch.keepDropdownOpen
|
|
818
|
+
}
|
|
819
|
+
),
|
|
820
|
+
error && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex justify-center", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "max-w-md rounded-lg border border-ods-border bg-ods-card p-8 text-center", children: [
|
|
821
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h2", { className: "text-ods-text-primary text-h3", children: "Error Loading Documents" }),
|
|
822
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "p", { className: "mt-2 text-ods-text-secondary", children: [
|
|
823
|
+
error,
|
|
824
|
+
". Please try again later."
|
|
825
|
+
] })
|
|
826
|
+
] }) }),
|
|
827
|
+
!error && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-1 flex-col items-start gap-6 lg:flex-row lg:gap-10", children: [
|
|
828
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "w-full lg:w-[320px] lg:shrink-0", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "lg:sticky lg:top-20", children: isLoadingStructure ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkHMEEW73Fcjs.CategorySidebarSkeleton, {}) : /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
829
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, PersistentMobileDropdown, { isLoading: false, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
830
|
+
_chunkYU4QZ6I6cjs.MobileNavigationDropdown,
|
|
831
|
+
{
|
|
832
|
+
nodes: structure,
|
|
833
|
+
selectedPath,
|
|
834
|
+
expandedNodes,
|
|
835
|
+
onNodeClick: selectNode,
|
|
836
|
+
onToggleExpand: toggleNode,
|
|
837
|
+
isLoading: false,
|
|
838
|
+
folderIndexFile
|
|
839
|
+
}
|
|
840
|
+
) }),
|
|
841
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, PersistentSidebar, { isLoading: false, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "hidden lg:block", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-4", children: [
|
|
842
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "font-semibold text-ods-text-secondary text-h5", children: sidebarLabel }),
|
|
843
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
844
|
+
_chunkYU4QZ6I6cjs.MultiLevelNavigation,
|
|
845
|
+
{
|
|
846
|
+
nodes: structure,
|
|
847
|
+
selectedPath,
|
|
848
|
+
expandedNodes,
|
|
849
|
+
onNodeClick: selectNode,
|
|
850
|
+
onToggleExpand: toggleNode,
|
|
851
|
+
isLoading: false,
|
|
852
|
+
folderIndexFile
|
|
853
|
+
}
|
|
854
|
+
)
|
|
855
|
+
] }) }) })
|
|
856
|
+
] }) }) }),
|
|
857
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "w-full min-w-0 flex-1", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
858
|
+
"div",
|
|
859
|
+
{
|
|
860
|
+
className: `grid grid-cols-1 ${// "On this page" right column only makes sense for
|
|
861
|
+
// MARKDOWN content (PDFs / Sheets / Figma / file have no
|
|
862
|
+
// sections to navigate to). Gating the grid template on
|
|
863
|
+
// `isMarkdownContent` also suppresses the section-skeleton
|
|
864
|
+
// bars during embed loads — the user-reported "skeleton
|
|
865
|
+
// shouldn't be on file pages" bug.
|
|
866
|
+
isMarkdownContent && (showStickyNav && stickyNavSections.length > 0 || isLoadingContent || isLoadingStructure) ? "lg:grid-cols-[1fr_280px]" : ""} gap-8`,
|
|
867
|
+
children: [
|
|
868
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: `w-full min-w-0 ${isMarkdownContent ? "mx-auto max-w-4xl" : ""}`, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "article", { className: "space-y-2", children: isLoadingContent || isLoadingStructure ? renderSkeleton(selectedNodeDocType) : !content ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "py-16 text-center", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-ods-text-secondary text-h4", children: resolvedEmptyText }) }) : renderedContent }) }),
|
|
869
|
+
isMarkdownContent && (isLoadingContent || isLoadingStructure) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "hidden lg:block", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "sticky top-24", children: [
|
|
870
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "mb-5 h-[14px] w-28 animate-pulse rounded bg-ods-border" }),
|
|
871
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "space-y-0", children: [130, 170, 190, 220, 110, 200, 80, 100, 120, 140, 90].map((w, i) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
872
|
+
"div",
|
|
873
|
+
{
|
|
874
|
+
className: `border-l-2 py-[13px] pl-3 ${i === 0 ? "border-ods-accent" : "border-transparent"}`,
|
|
875
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "h-[13px] animate-pulse rounded bg-ods-border", style: { width: w } })
|
|
876
|
+
},
|
|
877
|
+
i
|
|
878
|
+
)) })
|
|
879
|
+
] }) }),
|
|
880
|
+
showStickyNav && content && stickyNavSections.length > 0 && !isLoadingContent && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "hidden lg:block", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "sticky top-24", children: [
|
|
881
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "mb-4 font-semibold text-ods-text-secondary text-h5", children: "ON THIS PAGE" }),
|
|
882
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
883
|
+
_chunkYU4QZ6I6cjs.StickySectionNav,
|
|
884
|
+
{
|
|
885
|
+
sections: stickyNavSections,
|
|
886
|
+
activeSection,
|
|
887
|
+
onSectionClick: handleSectionClick,
|
|
888
|
+
ribbonPosition: "left",
|
|
889
|
+
ribbonColor: "var(--ods-accent)"
|
|
890
|
+
}
|
|
891
|
+
)
|
|
892
|
+
] }) })
|
|
893
|
+
]
|
|
894
|
+
}
|
|
895
|
+
) })
|
|
896
|
+
] })
|
|
897
|
+
] }) }) });
|
|
898
|
+
return shell ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkHMEEW73Fcjs.PageShell, { contentClassName: `${bgClass} ${className}`, children: inner }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: `page-shell-content ${bgClass} ${className}`.trim(), children: inner });
|
|
899
|
+
}
|
|
900
|
+
|
|
901
|
+
// src/components/docs/skeletons.tsx
|
|
902
|
+
|
|
903
|
+
function MarkdownSkeleton() {
|
|
904
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "mt-6 space-y-7", children: [
|
|
905
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-[14px]", children: [
|
|
906
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "h-[16px] w-full animate-pulse rounded bg-ods-border" }),
|
|
907
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "h-[16px] w-full animate-pulse rounded bg-ods-border" }),
|
|
908
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "h-[16px] w-full animate-pulse rounded bg-ods-border" }),
|
|
909
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "h-[16px] w-3/4 animate-pulse rounded bg-ods-border" })
|
|
910
|
+
] }),
|
|
911
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-[14px]", children: [
|
|
912
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "h-[16px] w-full animate-pulse rounded bg-ods-border" }),
|
|
913
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "h-[16px] w-full animate-pulse rounded bg-ods-border" }),
|
|
914
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "h-[16px] w-full animate-pulse rounded bg-ods-border" }),
|
|
915
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "h-[16px] w-5/6 animate-pulse rounded bg-ods-border" })
|
|
916
|
+
] }),
|
|
917
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-[14px]", children: [
|
|
918
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "h-[16px] w-full animate-pulse rounded bg-ods-border" }),
|
|
919
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "h-[16px] w-full animate-pulse rounded bg-ods-border" }),
|
|
920
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "h-[16px] w-full animate-pulse rounded bg-ods-border" }),
|
|
921
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "h-[16px] w-full animate-pulse rounded bg-ods-border" }),
|
|
922
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "h-[16px] w-2/3 animate-pulse rounded bg-ods-border" })
|
|
923
|
+
] }),
|
|
924
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "h-[88px] animate-pulse rounded-lg border border-ods-border bg-ods-card" }),
|
|
925
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "h-7 w-1/3 animate-pulse rounded bg-ods-border" }),
|
|
926
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-[14px]", children: [
|
|
927
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "h-[16px] w-full animate-pulse rounded bg-ods-border" }),
|
|
928
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "h-[16px] w-full animate-pulse rounded bg-ods-border" }),
|
|
929
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "h-[16px] w-full animate-pulse rounded bg-ods-border" }),
|
|
930
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "h-[16px] w-[72%] animate-pulse rounded bg-ods-border" })
|
|
931
|
+
] }),
|
|
932
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-[14px]", children: [
|
|
933
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "h-[16px] w-full animate-pulse rounded bg-ods-border" }),
|
|
934
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "h-[16px] w-full animate-pulse rounded bg-ods-border" }),
|
|
935
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "h-[16px] w-full animate-pulse rounded bg-ods-border" }),
|
|
936
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "h-[16px] w-full animate-pulse rounded bg-ods-border" }),
|
|
937
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "h-[16px] w-[58%] animate-pulse rounded bg-ods-border" })
|
|
938
|
+
] }),
|
|
939
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "h-7 w-2/5 animate-pulse rounded bg-ods-border" }),
|
|
940
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-[14px]", children: [
|
|
941
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "h-[16px] w-full animate-pulse rounded bg-ods-border" }),
|
|
942
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "h-[16px] w-full animate-pulse rounded bg-ods-border" }),
|
|
943
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "h-[16px] w-[90%] animate-pulse rounded bg-ods-border" })
|
|
944
|
+
] }),
|
|
945
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-[14px]", children: [
|
|
946
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "h-[16px] w-full animate-pulse rounded bg-ods-border" }),
|
|
947
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "h-[16px] w-full animate-pulse rounded bg-ods-border" }),
|
|
948
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "h-[16px] w-full animate-pulse rounded bg-ods-border" }),
|
|
949
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "h-[16px] w-[70%] animate-pulse rounded bg-ods-border" })
|
|
950
|
+
] }),
|
|
951
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "h-[88px] animate-pulse rounded-lg border border-ods-border bg-ods-card" })
|
|
952
|
+
] });
|
|
953
|
+
}
|
|
954
|
+
function EmbedSkeleton({ documentType } = {}) {
|
|
955
|
+
if (documentType === "file") {
|
|
956
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex flex-col items-center justify-center py-16", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "w-full max-w-md space-y-4 rounded-xl border border-ods-border bg-ods-card p-8 text-center", children: [
|
|
957
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "mx-auto h-16 w-16 animate-pulse rounded bg-ods-border" }),
|
|
958
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
959
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "mx-auto h-5 w-2/3 animate-pulse rounded bg-ods-border" }),
|
|
960
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "mx-auto h-4 w-1/2 animate-pulse rounded bg-ods-border" })
|
|
961
|
+
] }),
|
|
962
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "h-10 w-full animate-pulse rounded bg-ods-border" })
|
|
963
|
+
] }) });
|
|
964
|
+
}
|
|
965
|
+
const buttonCount = documentType === "pdf" ? 2 : 1;
|
|
966
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-4", children: [
|
|
967
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between", children: [
|
|
968
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex min-w-0 flex-1 items-center gap-2", children: [
|
|
969
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "h-5 w-5 shrink-0 animate-pulse rounded bg-ods-border" }),
|
|
970
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "h-6 w-2/3 animate-pulse rounded bg-ods-border" })
|
|
971
|
+
] }),
|
|
972
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex w-full items-center gap-2 sm:w-auto", children: Array.from({ length: buttonCount }).map((_, i) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "h-10 w-full flex-1 animate-pulse rounded bg-ods-border sm:w-32 sm:flex-initial" }, i)) })
|
|
973
|
+
] }),
|
|
974
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
975
|
+
"div",
|
|
976
|
+
{
|
|
977
|
+
className: "w-full animate-pulse rounded-lg border border-ods-border bg-ods-card",
|
|
978
|
+
style: { height: "calc(100vh - 250px)" }
|
|
979
|
+
}
|
|
980
|
+
)
|
|
981
|
+
] });
|
|
982
|
+
}
|
|
983
|
+
|
|
984
|
+
// src/components/docs/docs-hub-page.tsx
|
|
985
|
+
|
|
986
|
+
var DEFAULT_TITLE = "Documents";
|
|
987
|
+
var defaultFallbackRenderer = () => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "py-16 text-center", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-ods-text-secondary", children: "Unsupported document type" }) });
|
|
988
|
+
var defaultPdfRenderer = (content, handlers) => content.fileUrl ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkM3ERSHPMcjs.PdfViewer, { src: content.fileUrl, fileName: content.fileName }) : defaultFallbackRenderer(content, handlers);
|
|
989
|
+
var defaultGoogleSheetRenderer = (content, handlers) => content.externalUrl ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkM3ERSHPMcjs.GoogleSheetsViewer, { externalUrl: content.externalUrl, fileName: content.fileName }) : defaultFallbackRenderer(content, handlers);
|
|
990
|
+
var defaultFigmaRenderer = (content, handlers) => content.externalUrl ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkHMEEW73Fcjs.FigmaEmbed, { url: content.externalUrl, title: content.fileName, loading: "eager" }) : defaultFallbackRenderer(content, handlers);
|
|
991
|
+
var defaultFileRenderer = (content) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
992
|
+
_chunkM3ERSHPMcjs.FileDownloadCard,
|
|
993
|
+
{
|
|
994
|
+
fileName: content.fileName,
|
|
995
|
+
mimeType: content.mimeType,
|
|
996
|
+
fileSize: content.fileSize,
|
|
997
|
+
fileUrl: content.fileUrl
|
|
998
|
+
}
|
|
999
|
+
);
|
|
1000
|
+
var defaultRenderSkeleton = (documentType) => !documentType || documentType === "markdown" ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, MarkdownSkeleton, {}) : (
|
|
1001
|
+
// Forward the documentType so the embed skeleton renders the right
|
|
1002
|
+
// shape (PDF=2 buttons, sheets/figma=1 button, file=centered card).
|
|
1003
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, EmbedSkeleton, { documentType })
|
|
1004
|
+
);
|
|
1005
|
+
function DocsHubPage({
|
|
1006
|
+
title = DEFAULT_TITLE,
|
|
1007
|
+
documentTypeRenderers,
|
|
1008
|
+
fallbackRenderer = defaultFallbackRenderer,
|
|
1009
|
+
renderSkeleton = defaultRenderSkeleton,
|
|
1010
|
+
showAIChat = true,
|
|
1011
|
+
className = "min-h-screen",
|
|
1012
|
+
sidebarLabel = "DOCUMENTATION",
|
|
1013
|
+
...docViewerProps
|
|
1014
|
+
}) {
|
|
1015
|
+
const resolvedRenderers = {
|
|
1016
|
+
markdown: documentTypeRenderers.markdown,
|
|
1017
|
+
pdf: _nullishCoalesce(documentTypeRenderers.pdf, () => ( defaultPdfRenderer)),
|
|
1018
|
+
google_sheet: _nullishCoalesce(documentTypeRenderers.google_sheet, () => ( defaultGoogleSheetRenderer)),
|
|
1019
|
+
figma: _nullishCoalesce(documentTypeRenderers.figma, () => ( defaultFigmaRenderer)),
|
|
1020
|
+
file: _nullishCoalesce(documentTypeRenderers.file, () => ( defaultFileRenderer))
|
|
1021
|
+
};
|
|
1022
|
+
const renderContent = (content, handlers) => {
|
|
1023
|
+
const type = _nullishCoalesce(content.documentType, () => ( "markdown"));
|
|
1024
|
+
const renderer = _nullishCoalesce(resolvedRenderers[type], () => ( fallbackRenderer));
|
|
1025
|
+
return renderer(content, handlers);
|
|
1026
|
+
};
|
|
1027
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1028
|
+
DocViewer,
|
|
1029
|
+
{
|
|
1030
|
+
...docViewerProps,
|
|
1031
|
+
title,
|
|
1032
|
+
showAIChat,
|
|
1033
|
+
className,
|
|
1034
|
+
sidebarLabel,
|
|
1035
|
+
renderContent,
|
|
1036
|
+
renderSkeleton
|
|
1037
|
+
}
|
|
1038
|
+
);
|
|
1039
|
+
}
|
|
1040
|
+
|
|
1041
|
+
|
|
1042
|
+
|
|
1043
|
+
|
|
1044
|
+
|
|
1045
|
+
|
|
1046
|
+
|
|
1047
|
+
|
|
1048
|
+
|
|
1049
|
+
|
|
1050
|
+
|
|
1051
|
+
|
|
1052
|
+
|
|
1053
|
+
|
|
1054
|
+
exports.PersistentFilterControls = PersistentFilterControls; exports.PersistentSearchContainer = PersistentSearchContainer; exports.PersistentSidebar = PersistentSidebar; exports.PersistentMobileDropdown = PersistentMobileDropdown; exports.DocNavigationProvider = DocNavigationProvider; exports.useDocNavigation = useDocNavigation; exports.useDocumentTree = useDocumentTree; exports.useScrollSpy = useScrollSpy; exports.DocViewer = DocViewer; exports.MarkdownSkeleton = MarkdownSkeleton; exports.EmbedSkeleton = EmbedSkeleton; exports.DocsHubPage = DocsHubPage;
|
|
1055
|
+
//# sourceMappingURL=chunk-JMWLF2GL.cjs.map
|