straplight 1.2.0 → 1.2.1
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/_chunks/{Settings-BLDXIWWB.js → Settings-CTQDyLBP.js} +1 -1
- package/dist/_chunks/{Settings-CncfOILf.mjs → Settings-Chz6UwDr.mjs} +1 -1
- package/dist/_chunks/index-C5h4P4yg.mjs +569 -0
- package/dist/_chunks/index-Cii-JcUl.js +590 -0
- package/dist/admin/index.js +1 -1
- package/dist/admin/index.mjs +1 -1
- package/dist/admin/src/components/StraplightProvider.d.ts +1 -0
- package/package.json +1 -1
- package/dist/_chunks/StraplightOverlay-DLEpUqQM.mjs +0 -506
- package/dist/_chunks/StraplightOverlay-dGd1yRZj.js +0 -506
- package/dist/_chunks/index-B2B6CFFk.mjs +0 -82
- package/dist/_chunks/index-CuzgWWKQ.js +0 -103
|
@@ -1,506 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const jsxRuntime = require("react/jsx-runtime");
|
|
4
|
-
const react = require("react");
|
|
5
|
-
const admin = require("@strapi/strapi/admin");
|
|
6
|
-
const index = require("./index-CuzgWWKQ.js");
|
|
7
|
-
const DEFAULTS = {
|
|
8
|
-
debounceMs: 200,
|
|
9
|
-
minQueryLength: 1
|
|
10
|
-
};
|
|
11
|
-
function useStraplightSettings() {
|
|
12
|
-
const [settings, setSettings] = react.useState(DEFAULTS);
|
|
13
|
-
react.useEffect(() => {
|
|
14
|
-
const { get } = admin.getFetchClient();
|
|
15
|
-
get(`/${index.PLUGIN_ID}/settings`).then(({ data }) => {
|
|
16
|
-
setSettings({
|
|
17
|
-
debounceMs: data.settings?.debounceMs ?? DEFAULTS.debounceMs,
|
|
18
|
-
minQueryLength: data.settings?.minQueryLength ?? DEFAULTS.minQueryLength
|
|
19
|
-
});
|
|
20
|
-
}).catch(() => {
|
|
21
|
-
});
|
|
22
|
-
}, []);
|
|
23
|
-
return settings;
|
|
24
|
-
}
|
|
25
|
-
function useStraplight() {
|
|
26
|
-
const settings = useStraplightSettings();
|
|
27
|
-
const [isOpen, setIsOpen] = react.useState(false);
|
|
28
|
-
const [query, setQuery] = react.useState("");
|
|
29
|
-
const [results, setResults] = react.useState([]);
|
|
30
|
-
const [loading, setLoading] = react.useState(false);
|
|
31
|
-
const [selectedIndex, setSelectedIndex] = react.useState(0);
|
|
32
|
-
const debounceRef = react.useRef(null);
|
|
33
|
-
const requestIdRef = react.useRef(0);
|
|
34
|
-
react.useEffect(() => {
|
|
35
|
-
const handler = (e) => {
|
|
36
|
-
if ((e.metaKey || e.ctrlKey) && e.key === "k") {
|
|
37
|
-
e.preventDefault();
|
|
38
|
-
setIsOpen((prev) => !prev);
|
|
39
|
-
}
|
|
40
|
-
};
|
|
41
|
-
document.addEventListener("keydown", handler);
|
|
42
|
-
return () => document.removeEventListener("keydown", handler);
|
|
43
|
-
}, []);
|
|
44
|
-
const close = react.useCallback(() => {
|
|
45
|
-
setIsOpen(false);
|
|
46
|
-
setQuery("");
|
|
47
|
-
setResults([]);
|
|
48
|
-
setSelectedIndex(0);
|
|
49
|
-
setLoading(false);
|
|
50
|
-
requestIdRef.current++;
|
|
51
|
-
}, []);
|
|
52
|
-
react.useEffect(() => {
|
|
53
|
-
if (!isOpen) return;
|
|
54
|
-
if (debounceRef.current) {
|
|
55
|
-
clearTimeout(debounceRef.current);
|
|
56
|
-
}
|
|
57
|
-
const trimmed = query.trim();
|
|
58
|
-
if (trimmed.length < settings.minQueryLength) {
|
|
59
|
-
setResults([]);
|
|
60
|
-
setSelectedIndex(0);
|
|
61
|
-
setLoading(false);
|
|
62
|
-
return;
|
|
63
|
-
}
|
|
64
|
-
debounceRef.current = setTimeout(async () => {
|
|
65
|
-
const id = ++requestIdRef.current;
|
|
66
|
-
setLoading(true);
|
|
67
|
-
try {
|
|
68
|
-
const { get } = admin.getFetchClient();
|
|
69
|
-
const { data } = await get(`/${index.PLUGIN_ID}/search`, {
|
|
70
|
-
params: { q: trimmed }
|
|
71
|
-
});
|
|
72
|
-
if (id !== requestIdRef.current) return;
|
|
73
|
-
setResults(data.results || []);
|
|
74
|
-
setSelectedIndex(0);
|
|
75
|
-
} catch {
|
|
76
|
-
if (id !== requestIdRef.current) return;
|
|
77
|
-
setResults([]);
|
|
78
|
-
} finally {
|
|
79
|
-
if (id === requestIdRef.current) {
|
|
80
|
-
setLoading(false);
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
}, settings.debounceMs);
|
|
84
|
-
return () => {
|
|
85
|
-
if (debounceRef.current) clearTimeout(debounceRef.current);
|
|
86
|
-
};
|
|
87
|
-
}, [query, isOpen, settings.debounceMs, settings.minQueryLength]);
|
|
88
|
-
const navigateToResult = react.useCallback(
|
|
89
|
-
(result) => {
|
|
90
|
-
const path = `/content-manager/collection-types/${result.uid}/${result.documentId}`;
|
|
91
|
-
const nav = window.__straplight?.navigate;
|
|
92
|
-
if (nav) {
|
|
93
|
-
nav(path);
|
|
94
|
-
} else {
|
|
95
|
-
window.location.href = `/admin${path}`;
|
|
96
|
-
}
|
|
97
|
-
close();
|
|
98
|
-
},
|
|
99
|
-
[close]
|
|
100
|
-
);
|
|
101
|
-
const onKeyDown = react.useCallback(
|
|
102
|
-
(e) => {
|
|
103
|
-
if (e.key === "Escape") {
|
|
104
|
-
e.preventDefault();
|
|
105
|
-
close();
|
|
106
|
-
} else if (e.key === "ArrowDown") {
|
|
107
|
-
e.preventDefault();
|
|
108
|
-
setSelectedIndex((i) => i < results.length - 1 ? i + 1 : 0);
|
|
109
|
-
} else if (e.key === "ArrowUp") {
|
|
110
|
-
e.preventDefault();
|
|
111
|
-
setSelectedIndex((i) => i > 0 ? i - 1 : results.length - 1);
|
|
112
|
-
} else if (e.key === "Enter" && results.length > 0) {
|
|
113
|
-
e.preventDefault();
|
|
114
|
-
navigateToResult(results[selectedIndex]);
|
|
115
|
-
}
|
|
116
|
-
},
|
|
117
|
-
[results, selectedIndex, navigateToResult, close]
|
|
118
|
-
);
|
|
119
|
-
return {
|
|
120
|
-
isOpen,
|
|
121
|
-
query,
|
|
122
|
-
setQuery,
|
|
123
|
-
results,
|
|
124
|
-
loading,
|
|
125
|
-
selectedIndex,
|
|
126
|
-
close,
|
|
127
|
-
onKeyDown,
|
|
128
|
-
navigateToResult
|
|
129
|
-
};
|
|
130
|
-
}
|
|
131
|
-
const OVERLAY_STYLES = `
|
|
132
|
-
@keyframes straplight-fade-in {
|
|
133
|
-
from { opacity: 0; }
|
|
134
|
-
to { opacity: 1; }
|
|
135
|
-
}
|
|
136
|
-
@keyframes straplight-slide-in {
|
|
137
|
-
from { opacity: 0; transform: translateX(-50%) translateY(16px); }
|
|
138
|
-
to { opacity: 1; transform: translateX(-50%); }
|
|
139
|
-
}
|
|
140
|
-
@keyframes straplight-spin {
|
|
141
|
-
to { transform: rotate(360deg); }
|
|
142
|
-
}
|
|
143
|
-
`;
|
|
144
|
-
function resolveIsDark() {
|
|
145
|
-
const stored = localStorage.getItem("STRAPI_THEME") || "system";
|
|
146
|
-
if (stored === "dark") return true;
|
|
147
|
-
if (stored === "light") return false;
|
|
148
|
-
return window.matchMedia("(prefers-color-scheme: dark)").matches;
|
|
149
|
-
}
|
|
150
|
-
function useIsDarkMode() {
|
|
151
|
-
return resolveIsDark();
|
|
152
|
-
}
|
|
153
|
-
const themes = {
|
|
154
|
-
light: {
|
|
155
|
-
bg: "#ffffff",
|
|
156
|
-
bgHover: "#f6f6f9",
|
|
157
|
-
bgSelected: "#f0f0ff",
|
|
158
|
-
text: "#32324d",
|
|
159
|
-
textMuted: "#8e8ea9",
|
|
160
|
-
border: "#eaeaef",
|
|
161
|
-
inputText: "#32324d",
|
|
162
|
-
badge: "#f6f6f9",
|
|
163
|
-
kbd: "#f6f6f9",
|
|
164
|
-
kbdBorder: "#dcdce4",
|
|
165
|
-
kbdText: "#666687",
|
|
166
|
-
backdrop: "rgba(0, 0, 0, 0.4)",
|
|
167
|
-
shadow: "0 16px 70px rgba(0, 0, 0, 0.2)",
|
|
168
|
-
spinnerTrack: "#eaeaef",
|
|
169
|
-
spinnerAccent: "#4945ff"
|
|
170
|
-
},
|
|
171
|
-
dark: {
|
|
172
|
-
bg: "#212134",
|
|
173
|
-
bgHover: "#2a2a3e",
|
|
174
|
-
bgSelected: "#2e2e48",
|
|
175
|
-
text: "#eaeaef",
|
|
176
|
-
textMuted: "#a5a5ba",
|
|
177
|
-
border: "#3d3d57",
|
|
178
|
-
inputText: "#eaeaef",
|
|
179
|
-
badge: "#2e2e48",
|
|
180
|
-
kbd: "#2e2e48",
|
|
181
|
-
kbdBorder: "#3d3d57",
|
|
182
|
-
kbdText: "#a5a5ba",
|
|
183
|
-
backdrop: "rgba(0, 0, 0, 0.6)",
|
|
184
|
-
shadow: "0 16px 70px rgba(0, 0, 0, 0.5)",
|
|
185
|
-
spinnerTrack: "#3d3d57",
|
|
186
|
-
spinnerAccent: "#7b79ff"
|
|
187
|
-
}
|
|
188
|
-
};
|
|
189
|
-
function StraplightOverlay() {
|
|
190
|
-
const {
|
|
191
|
-
isOpen,
|
|
192
|
-
query,
|
|
193
|
-
setQuery,
|
|
194
|
-
results,
|
|
195
|
-
loading,
|
|
196
|
-
selectedIndex,
|
|
197
|
-
close,
|
|
198
|
-
onKeyDown,
|
|
199
|
-
navigateToResult
|
|
200
|
-
} = useStraplight();
|
|
201
|
-
const dark = useIsDarkMode();
|
|
202
|
-
const t = dark ? themes.dark : themes.light;
|
|
203
|
-
const inputRef = react.useRef(null);
|
|
204
|
-
const listRef = react.useRef(null);
|
|
205
|
-
react.useEffect(() => {
|
|
206
|
-
if (isOpen && inputRef.current) {
|
|
207
|
-
inputRef.current.focus();
|
|
208
|
-
}
|
|
209
|
-
}, [isOpen]);
|
|
210
|
-
react.useEffect(() => {
|
|
211
|
-
if (!listRef.current) return;
|
|
212
|
-
const selected = listRef.current.children[selectedIndex];
|
|
213
|
-
if (selected) {
|
|
214
|
-
selected.scrollIntoView({ block: "nearest" });
|
|
215
|
-
}
|
|
216
|
-
}, [selectedIndex]);
|
|
217
|
-
if (!isOpen) return null;
|
|
218
|
-
const isMac = typeof navigator !== "undefined" && /mac/i.test(navigator.platform || navigator.userAgent);
|
|
219
|
-
const modKey = isMac ? "⌘" : "Ctrl";
|
|
220
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
221
|
-
/* @__PURE__ */ jsxRuntime.jsx("style", { children: OVERLAY_STYLES }),
|
|
222
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
223
|
-
"div",
|
|
224
|
-
{
|
|
225
|
-
onClick: close,
|
|
226
|
-
style: {
|
|
227
|
-
position: "fixed",
|
|
228
|
-
inset: 0,
|
|
229
|
-
backgroundColor: t.backdrop,
|
|
230
|
-
backdropFilter: "blur(4px)",
|
|
231
|
-
zIndex: 99999,
|
|
232
|
-
animation: "straplight-fade-in 0.15s ease-out"
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
|
-
),
|
|
236
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
237
|
-
"div",
|
|
238
|
-
{
|
|
239
|
-
onKeyDown,
|
|
240
|
-
style: {
|
|
241
|
-
position: "fixed",
|
|
242
|
-
top: "calc(50% - 50px)",
|
|
243
|
-
left: "50%",
|
|
244
|
-
width: "580px",
|
|
245
|
-
maxWidth: "calc(100vw - 32px)",
|
|
246
|
-
maxHeight: "440px",
|
|
247
|
-
backgroundColor: t.bg,
|
|
248
|
-
borderRadius: "12px",
|
|
249
|
-
boxShadow: t.shadow,
|
|
250
|
-
zIndex: 1e5,
|
|
251
|
-
display: "flex",
|
|
252
|
-
flexDirection: "column",
|
|
253
|
-
overflow: "hidden",
|
|
254
|
-
animation: "straplight-slide-in 0.2s ease-out 0.05s both"
|
|
255
|
-
},
|
|
256
|
-
children: [
|
|
257
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
258
|
-
"div",
|
|
259
|
-
{
|
|
260
|
-
style: {
|
|
261
|
-
display: "flex",
|
|
262
|
-
alignItems: "center",
|
|
263
|
-
padding: "14px 16px",
|
|
264
|
-
borderBottom: `1px solid ${t.border}`,
|
|
265
|
-
gap: "10px"
|
|
266
|
-
},
|
|
267
|
-
children: [
|
|
268
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
269
|
-
"svg",
|
|
270
|
-
{
|
|
271
|
-
width: "20",
|
|
272
|
-
height: "20",
|
|
273
|
-
viewBox: "0 0 24 24",
|
|
274
|
-
fill: "none",
|
|
275
|
-
stroke: t.textMuted,
|
|
276
|
-
strokeWidth: "2",
|
|
277
|
-
strokeLinecap: "round",
|
|
278
|
-
strokeLinejoin: "round",
|
|
279
|
-
children: [
|
|
280
|
-
/* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "11", cy: "11", r: "8" }),
|
|
281
|
-
/* @__PURE__ */ jsxRuntime.jsx("line", { x1: "21", y1: "21", x2: "16.65", y2: "16.65" })
|
|
282
|
-
]
|
|
283
|
-
}
|
|
284
|
-
),
|
|
285
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
286
|
-
"input",
|
|
287
|
-
{
|
|
288
|
-
ref: inputRef,
|
|
289
|
-
type: "text",
|
|
290
|
-
value: query,
|
|
291
|
-
onChange: (e) => setQuery(e.target.value),
|
|
292
|
-
placeholder: "Search content...",
|
|
293
|
-
style: {
|
|
294
|
-
flex: 1,
|
|
295
|
-
border: "none",
|
|
296
|
-
outline: "none",
|
|
297
|
-
fontSize: "16px",
|
|
298
|
-
fontFamily: "inherit",
|
|
299
|
-
color: t.inputText,
|
|
300
|
-
backgroundColor: "transparent"
|
|
301
|
-
}
|
|
302
|
-
}
|
|
303
|
-
),
|
|
304
|
-
loading && /* @__PURE__ */ jsxRuntime.jsx(
|
|
305
|
-
"div",
|
|
306
|
-
{
|
|
307
|
-
style: {
|
|
308
|
-
width: "18px",
|
|
309
|
-
height: "18px",
|
|
310
|
-
border: `2px solid ${t.spinnerTrack}`,
|
|
311
|
-
borderTopColor: t.spinnerAccent,
|
|
312
|
-
borderRadius: "50%",
|
|
313
|
-
animation: "straplight-spin 0.6s linear infinite"
|
|
314
|
-
}
|
|
315
|
-
}
|
|
316
|
-
)
|
|
317
|
-
]
|
|
318
|
-
}
|
|
319
|
-
),
|
|
320
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
321
|
-
"div",
|
|
322
|
-
{
|
|
323
|
-
ref: listRef,
|
|
324
|
-
style: {
|
|
325
|
-
flex: 1,
|
|
326
|
-
overflowY: "auto",
|
|
327
|
-
padding: results.length > 0 ? "8px" : "0"
|
|
328
|
-
},
|
|
329
|
-
children: [
|
|
330
|
-
query.trim() && !loading && results.length === 0 && /* @__PURE__ */ jsxRuntime.jsx(
|
|
331
|
-
"div",
|
|
332
|
-
{
|
|
333
|
-
style: {
|
|
334
|
-
padding: "32px 16px",
|
|
335
|
-
textAlign: "center",
|
|
336
|
-
color: t.textMuted,
|
|
337
|
-
fontSize: "14px"
|
|
338
|
-
},
|
|
339
|
-
children: "No results found"
|
|
340
|
-
}
|
|
341
|
-
),
|
|
342
|
-
results.map((result, index2) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
343
|
-
ResultItem,
|
|
344
|
-
{
|
|
345
|
-
result,
|
|
346
|
-
isSelected: index2 === selectedIndex,
|
|
347
|
-
onClick: () => navigateToResult(result),
|
|
348
|
-
t
|
|
349
|
-
},
|
|
350
|
-
`${result.uid}-${result.documentId}`
|
|
351
|
-
))
|
|
352
|
-
]
|
|
353
|
-
}
|
|
354
|
-
),
|
|
355
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
356
|
-
"div",
|
|
357
|
-
{
|
|
358
|
-
style: {
|
|
359
|
-
display: "flex",
|
|
360
|
-
alignItems: "center",
|
|
361
|
-
gap: "16px",
|
|
362
|
-
padding: "10px 16px",
|
|
363
|
-
borderTop: `1px solid ${t.border}`,
|
|
364
|
-
fontSize: "12px",
|
|
365
|
-
color: t.textMuted
|
|
366
|
-
},
|
|
367
|
-
children: [
|
|
368
|
-
/* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
|
|
369
|
-
/* @__PURE__ */ jsxRuntime.jsx(Kbd, { t, children: "↑↓" }),
|
|
370
|
-
" navigate"
|
|
371
|
-
] }),
|
|
372
|
-
/* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
|
|
373
|
-
/* @__PURE__ */ jsxRuntime.jsx(Kbd, { t, children: "⏎" }),
|
|
374
|
-
" open"
|
|
375
|
-
] }),
|
|
376
|
-
/* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
|
|
377
|
-
/* @__PURE__ */ jsxRuntime.jsx(Kbd, { t, children: "esc" }),
|
|
378
|
-
" close"
|
|
379
|
-
] }),
|
|
380
|
-
/* @__PURE__ */ jsxRuntime.jsxs("span", { style: { marginLeft: "auto" }, children: [
|
|
381
|
-
/* @__PURE__ */ jsxRuntime.jsxs(Kbd, { t, children: [
|
|
382
|
-
modKey,
|
|
383
|
-
"+K"
|
|
384
|
-
] }),
|
|
385
|
-
" toggle"
|
|
386
|
-
] })
|
|
387
|
-
]
|
|
388
|
-
}
|
|
389
|
-
)
|
|
390
|
-
]
|
|
391
|
-
}
|
|
392
|
-
)
|
|
393
|
-
] });
|
|
394
|
-
}
|
|
395
|
-
function ResultItem({
|
|
396
|
-
result,
|
|
397
|
-
isSelected,
|
|
398
|
-
onClick,
|
|
399
|
-
t
|
|
400
|
-
}) {
|
|
401
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
402
|
-
"div",
|
|
403
|
-
{
|
|
404
|
-
onClick,
|
|
405
|
-
style: {
|
|
406
|
-
display: "flex",
|
|
407
|
-
alignItems: "center",
|
|
408
|
-
justifyContent: "space-between",
|
|
409
|
-
padding: "10px 12px",
|
|
410
|
-
borderRadius: "8px",
|
|
411
|
-
cursor: "pointer",
|
|
412
|
-
backgroundColor: isSelected ? t.bgSelected : "transparent",
|
|
413
|
-
transition: "background-color 0.1s"
|
|
414
|
-
},
|
|
415
|
-
onMouseEnter: (e) => {
|
|
416
|
-
if (!isSelected)
|
|
417
|
-
e.currentTarget.style.backgroundColor = t.bgHover;
|
|
418
|
-
},
|
|
419
|
-
onMouseLeave: (e) => {
|
|
420
|
-
e.currentTarget.style.backgroundColor = isSelected ? t.bgSelected : "transparent";
|
|
421
|
-
},
|
|
422
|
-
children: [
|
|
423
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
424
|
-
"div",
|
|
425
|
-
{
|
|
426
|
-
style: {
|
|
427
|
-
flex: 1,
|
|
428
|
-
overflow: "hidden",
|
|
429
|
-
marginRight: "12px",
|
|
430
|
-
display: "flex",
|
|
431
|
-
alignItems: "baseline",
|
|
432
|
-
gap: "8px"
|
|
433
|
-
},
|
|
434
|
-
children: [
|
|
435
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
436
|
-
"span",
|
|
437
|
-
{
|
|
438
|
-
style: {
|
|
439
|
-
fontSize: "14px",
|
|
440
|
-
color: t.text,
|
|
441
|
-
fontWeight: isSelected ? 600 : 400,
|
|
442
|
-
overflow: "hidden",
|
|
443
|
-
textOverflow: "ellipsis",
|
|
444
|
-
whiteSpace: "nowrap",
|
|
445
|
-
flexShrink: 1,
|
|
446
|
-
minWidth: 0
|
|
447
|
-
},
|
|
448
|
-
children: result.label
|
|
449
|
-
}
|
|
450
|
-
),
|
|
451
|
-
result.fields && result.fields.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(
|
|
452
|
-
"span",
|
|
453
|
-
{
|
|
454
|
-
style: {
|
|
455
|
-
fontSize: "12px",
|
|
456
|
-
color: t.textMuted,
|
|
457
|
-
overflow: "hidden",
|
|
458
|
-
textOverflow: "ellipsis",
|
|
459
|
-
whiteSpace: "nowrap",
|
|
460
|
-
flexShrink: 2,
|
|
461
|
-
minWidth: 0
|
|
462
|
-
},
|
|
463
|
-
children: result.fields.map((f) => f.value).join(" · ")
|
|
464
|
-
}
|
|
465
|
-
)
|
|
466
|
-
]
|
|
467
|
-
}
|
|
468
|
-
),
|
|
469
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
470
|
-
"span",
|
|
471
|
-
{
|
|
472
|
-
style: {
|
|
473
|
-
fontSize: "11px",
|
|
474
|
-
color: t.textMuted,
|
|
475
|
-
backgroundColor: t.badge,
|
|
476
|
-
padding: "2px 8px",
|
|
477
|
-
borderRadius: "4px",
|
|
478
|
-
whiteSpace: "nowrap",
|
|
479
|
-
flexShrink: 0
|
|
480
|
-
},
|
|
481
|
-
children: result.contentType
|
|
482
|
-
}
|
|
483
|
-
)
|
|
484
|
-
]
|
|
485
|
-
}
|
|
486
|
-
);
|
|
487
|
-
}
|
|
488
|
-
function Kbd({ children, t }) {
|
|
489
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
490
|
-
"kbd",
|
|
491
|
-
{
|
|
492
|
-
style: {
|
|
493
|
-
display: "inline-block",
|
|
494
|
-
padding: "1px 5px",
|
|
495
|
-
fontSize: "11px",
|
|
496
|
-
fontFamily: "inherit",
|
|
497
|
-
color: t.kbdText,
|
|
498
|
-
backgroundColor: t.kbd,
|
|
499
|
-
border: `1px solid ${t.kbdBorder}`,
|
|
500
|
-
borderRadius: "4px"
|
|
501
|
-
},
|
|
502
|
-
children
|
|
503
|
-
}
|
|
504
|
-
);
|
|
505
|
-
}
|
|
506
|
-
exports.StraplightOverlay = StraplightOverlay;
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
import { useEffect } from "react";
|
|
2
|
-
import { useNavigate } from "react-router-dom";
|
|
3
|
-
const __variableDynamicImportRuntimeHelper = (glob, path, segs) => {
|
|
4
|
-
const v = glob[path];
|
|
5
|
-
if (v) {
|
|
6
|
-
return typeof v === "function" ? v() : Promise.resolve(v);
|
|
7
|
-
}
|
|
8
|
-
return new Promise((_, reject) => {
|
|
9
|
-
(typeof queueMicrotask === "function" ? queueMicrotask : setTimeout)(
|
|
10
|
-
reject.bind(
|
|
11
|
-
null,
|
|
12
|
-
new Error(
|
|
13
|
-
"Unknown variable dynamic import: " + path + (path.split("/").length !== segs ? ". Note that variables only represent file names one level deep." : "")
|
|
14
|
-
)
|
|
15
|
-
)
|
|
16
|
-
);
|
|
17
|
-
});
|
|
18
|
-
};
|
|
19
|
-
const PLUGIN_ID = "straplight";
|
|
20
|
-
function NavigateCapture() {
|
|
21
|
-
const navigate = useNavigate();
|
|
22
|
-
useEffect(() => {
|
|
23
|
-
window.__straplight = window.__straplight || {};
|
|
24
|
-
window.__straplight.navigate = navigate;
|
|
25
|
-
}, [navigate]);
|
|
26
|
-
return null;
|
|
27
|
-
}
|
|
28
|
-
const index = {
|
|
29
|
-
register(app) {
|
|
30
|
-
app.registerPlugin({
|
|
31
|
-
id: PLUGIN_ID,
|
|
32
|
-
name: PLUGIN_ID
|
|
33
|
-
});
|
|
34
|
-
},
|
|
35
|
-
bootstrap(app) {
|
|
36
|
-
app.addSettingsLink("global", {
|
|
37
|
-
id: `${PLUGIN_ID}-settings`,
|
|
38
|
-
to: PLUGIN_ID,
|
|
39
|
-
intlLabel: {
|
|
40
|
-
id: `${PLUGIN_ID}.settings.link`,
|
|
41
|
-
defaultMessage: "Straplight"
|
|
42
|
-
},
|
|
43
|
-
permissions: [],
|
|
44
|
-
async Component() {
|
|
45
|
-
const { SettingsPage } = await import("./Settings-CncfOILf.mjs");
|
|
46
|
-
return { default: SettingsPage };
|
|
47
|
-
}
|
|
48
|
-
});
|
|
49
|
-
const contentManager = app.getPlugin("content-manager");
|
|
50
|
-
contentManager.injectComponent("listView", "actions", {
|
|
51
|
-
name: "straplight-nav-capture",
|
|
52
|
-
Component: NavigateCapture
|
|
53
|
-
});
|
|
54
|
-
import("react-dom/client").then(({ createRoot }) => {
|
|
55
|
-
import("./StraplightOverlay-DLEpUqQM.mjs").then(({ StraplightOverlay }) => {
|
|
56
|
-
import("react/jsx-runtime").then(({ jsx }) => {
|
|
57
|
-
const el = document.createElement("div");
|
|
58
|
-
el.id = "straplight-portal";
|
|
59
|
-
document.body.appendChild(el);
|
|
60
|
-
const root = createRoot(el);
|
|
61
|
-
root.render(jsx(StraplightOverlay, {}));
|
|
62
|
-
});
|
|
63
|
-
});
|
|
64
|
-
});
|
|
65
|
-
},
|
|
66
|
-
async registerTrads({ locales }) {
|
|
67
|
-
return Promise.all(
|
|
68
|
-
locales.map(async (locale) => {
|
|
69
|
-
try {
|
|
70
|
-
const { default: data } = await __variableDynamicImportRuntimeHelper(/* @__PURE__ */ Object.assign({ "./translations/en.json": () => import("./en-Byx4XI2L.mjs") }), `./translations/${locale}.json`, 3);
|
|
71
|
-
return { data, locale };
|
|
72
|
-
} catch {
|
|
73
|
-
return { data: {}, locale };
|
|
74
|
-
}
|
|
75
|
-
})
|
|
76
|
-
);
|
|
77
|
-
}
|
|
78
|
-
};
|
|
79
|
-
export {
|
|
80
|
-
PLUGIN_ID as P,
|
|
81
|
-
index as i
|
|
82
|
-
};
|
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __copyProps = (to, from, except, desc) => {
|
|
9
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
10
|
-
for (let key of __getOwnPropNames(from))
|
|
11
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
12
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
13
|
-
}
|
|
14
|
-
return to;
|
|
15
|
-
};
|
|
16
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
17
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
18
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
19
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
20
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
21
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
|
-
mod
|
|
23
|
-
));
|
|
24
|
-
const react = require("react");
|
|
25
|
-
const reactRouterDom = require("react-router-dom");
|
|
26
|
-
const __variableDynamicImportRuntimeHelper = (glob, path, segs) => {
|
|
27
|
-
const v = glob[path];
|
|
28
|
-
if (v) {
|
|
29
|
-
return typeof v === "function" ? v() : Promise.resolve(v);
|
|
30
|
-
}
|
|
31
|
-
return new Promise((_, reject) => {
|
|
32
|
-
(typeof queueMicrotask === "function" ? queueMicrotask : setTimeout)(
|
|
33
|
-
reject.bind(
|
|
34
|
-
null,
|
|
35
|
-
new Error(
|
|
36
|
-
"Unknown variable dynamic import: " + path + (path.split("/").length !== segs ? ". Note that variables only represent file names one level deep." : "")
|
|
37
|
-
)
|
|
38
|
-
)
|
|
39
|
-
);
|
|
40
|
-
});
|
|
41
|
-
};
|
|
42
|
-
const PLUGIN_ID = "straplight";
|
|
43
|
-
function NavigateCapture() {
|
|
44
|
-
const navigate = reactRouterDom.useNavigate();
|
|
45
|
-
react.useEffect(() => {
|
|
46
|
-
window.__straplight = window.__straplight || {};
|
|
47
|
-
window.__straplight.navigate = navigate;
|
|
48
|
-
}, [navigate]);
|
|
49
|
-
return null;
|
|
50
|
-
}
|
|
51
|
-
const index = {
|
|
52
|
-
register(app) {
|
|
53
|
-
app.registerPlugin({
|
|
54
|
-
id: PLUGIN_ID,
|
|
55
|
-
name: PLUGIN_ID
|
|
56
|
-
});
|
|
57
|
-
},
|
|
58
|
-
bootstrap(app) {
|
|
59
|
-
app.addSettingsLink("global", {
|
|
60
|
-
id: `${PLUGIN_ID}-settings`,
|
|
61
|
-
to: PLUGIN_ID,
|
|
62
|
-
intlLabel: {
|
|
63
|
-
id: `${PLUGIN_ID}.settings.link`,
|
|
64
|
-
defaultMessage: "Straplight"
|
|
65
|
-
},
|
|
66
|
-
permissions: [],
|
|
67
|
-
async Component() {
|
|
68
|
-
const { SettingsPage } = await Promise.resolve().then(() => require("./Settings-BLDXIWWB.js"));
|
|
69
|
-
return { default: SettingsPage };
|
|
70
|
-
}
|
|
71
|
-
});
|
|
72
|
-
const contentManager = app.getPlugin("content-manager");
|
|
73
|
-
contentManager.injectComponent("listView", "actions", {
|
|
74
|
-
name: "straplight-nav-capture",
|
|
75
|
-
Component: NavigateCapture
|
|
76
|
-
});
|
|
77
|
-
import("react-dom/client").then(({ createRoot }) => {
|
|
78
|
-
Promise.resolve().then(() => require("./StraplightOverlay-dGd1yRZj.js")).then(({ StraplightOverlay }) => {
|
|
79
|
-
import("react/jsx-runtime").then(({ jsx }) => {
|
|
80
|
-
const el = document.createElement("div");
|
|
81
|
-
el.id = "straplight-portal";
|
|
82
|
-
document.body.appendChild(el);
|
|
83
|
-
const root = createRoot(el);
|
|
84
|
-
root.render(jsx(StraplightOverlay, {}));
|
|
85
|
-
});
|
|
86
|
-
});
|
|
87
|
-
});
|
|
88
|
-
},
|
|
89
|
-
async registerTrads({ locales }) {
|
|
90
|
-
return Promise.all(
|
|
91
|
-
locales.map(async (locale) => {
|
|
92
|
-
try {
|
|
93
|
-
const { default: data } = await __variableDynamicImportRuntimeHelper(/* @__PURE__ */ Object.assign({ "./translations/en.json": () => Promise.resolve().then(() => require("./en-B4KWt_jN.js")) }), `./translations/${locale}.json`, 3);
|
|
94
|
-
return { data, locale };
|
|
95
|
-
} catch {
|
|
96
|
-
return { data: {}, locale };
|
|
97
|
-
}
|
|
98
|
-
})
|
|
99
|
-
);
|
|
100
|
-
}
|
|
101
|
-
};
|
|
102
|
-
exports.PLUGIN_ID = PLUGIN_ID;
|
|
103
|
-
exports.index = index;
|