@kyro-cms/admin 0.9.4 → 0.9.6
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/index.cjs +966 -585
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +29 -9
- package/dist/index.css.map +1 -1
- package/dist/index.d.cts +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +649 -268
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/src/components/ActionBar.tsx +254 -70
- package/src/components/Admin.tsx +10 -17
- package/src/components/ApiKeysManager.tsx +1 -0
- package/src/components/AuditLogsPage.tsx +3 -3
- package/src/components/AutoForm.tsx +51 -34
- package/src/components/DetailView.tsx +37 -13
- package/src/components/GraphQLPlayground.tsx +460 -224
- package/src/components/ListView.tsx +3 -3
- package/src/components/LoginPage.tsx +5 -30
- package/src/components/MediaGallery.tsx +122 -15
- package/src/components/RestPlayground.tsx +443 -519
- package/src/components/Sidebar.astro +6 -2
- package/src/components/UserManagement.tsx +4 -4
- package/src/components/WebhookManager.tsx +4 -4
- package/src/components/blocks/AccordionBlock.tsx +1 -1
- package/src/components/blocks/ArrayBlock.tsx +1 -1
- package/src/components/blocks/ChildBlocksTree.tsx +6 -6
- package/src/components/blocks/CodeBlock.tsx +1 -1
- package/src/components/blocks/FileBlock.tsx +1 -1
- package/src/components/blocks/HeroBlock.tsx +1 -1
- package/src/components/blocks/ListBlock.tsx +1 -1
- package/src/components/blocks/RelationshipBlock.tsx +1 -1
- package/src/components/blocks/RichTextBlock.tsx +1 -1
- package/src/components/blocks/VideoBlock.tsx +1 -1
- package/src/components/fields/BlocksField.tsx +17 -19
- package/src/components/ui/PageHeader.tsx +205 -83
- package/src/components/ui/Pagination.tsx +2 -2
- package/src/components/ui/SlidePanel.tsx +4 -4
- package/src/layouts/AdminLayout.astro +64 -4
- package/src/lib/useResourceManager.ts +1 -0
- package/src/pages/graphql-explorer.astro +7 -51
- package/src/pages/graphql.astro +7 -119
- package/src/pages/index.astro +4 -63
- package/src/pages/rest-playground.astro +3 -29
- package/src/styles/main.css +32 -9
package/src/pages/graphql.astro
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
import AdminLayout from "../layouts/AdminLayout.astro";
|
|
3
3
|
import { GraphQLPlayground } from "../components/GraphQLPlayground";
|
|
4
|
-
|
|
5
|
-
import { adminPath, apiPath } from "../lib/paths";
|
|
4
|
+
import { apiPath } from "../lib/paths";
|
|
6
5
|
|
|
7
6
|
const url = Astro.request.url;
|
|
8
7
|
const params = new URL(url).searchParams;
|
|
@@ -10,122 +9,11 @@ const initialQuery = params.get("query") || "";
|
|
|
10
9
|
---
|
|
11
10
|
|
|
12
11
|
<AdminLayout title="GraphQL Playground">
|
|
13
|
-
<div class="flex-1 overflow-hidden">
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
class="text-xl font-bold tracking-tighter text-[var(--kyro-text-primary)]"
|
|
20
|
-
>
|
|
21
|
-
GraphQL Playground
|
|
22
|
-
</h1>
|
|
23
|
-
<p
|
|
24
|
-
class="text-[var(--kyro-text-secondary)] font-bold mt-2 text-sm tracking-wider"
|
|
25
|
-
>
|
|
26
|
-
Interactive GraphQL query editor and explorer
|
|
27
|
-
</p>
|
|
28
|
-
</div>
|
|
29
|
-
<div class="flex items-center gap-4">
|
|
30
|
-
<a
|
|
31
|
-
href={`${adminPath}/graphql-explorer`}
|
|
32
|
-
class="flex items-center gap-2 px-4 py-2 bg-[var(--kyro-surface-accent)] text-[var(--kyro-text-primary)] rounded-lg font-bold text-sm hover:bg-[var(--kyro-surface)] transition-all border border-[var(--kyro-border)]"
|
|
33
|
-
>
|
|
34
|
-
<svg
|
|
35
|
-
class="w-4 h-4"
|
|
36
|
-
fill="none"
|
|
37
|
-
stroke="currentColor"
|
|
38
|
-
viewBox="0 0 24 24"
|
|
39
|
-
>
|
|
40
|
-
<path
|
|
41
|
-
stroke-linecap="round"
|
|
42
|
-
stroke-linejoin="round"
|
|
43
|
-
stroke-width="2"
|
|
44
|
-
d="M12 6.253v13m0-13C10.832 5.477 9.246 5 7.5 5S4.168 5.477 3 6.253v13C4.168 18.477 5.754 18 7.5 18s3.332.477 4.5 1.253m0-13C13.168 5.477 14.754 5 16.5 5c1.747 0 3.332.477 4.5 1.253v13C19.832 18.477 18.247 18 16.5 18c-1.746 0-3.332.477-4.5 1.253"
|
|
45
|
-
></path>
|
|
46
|
-
</svg>
|
|
47
|
-
Explorer
|
|
48
|
-
</a>
|
|
49
|
-
<div
|
|
50
|
-
class="flex items-center gap-2 px-4 py-2 bg-[var(--kyro-surface-accent)] rounded-lg border border-[var(--kyro-border)]"
|
|
51
|
-
>
|
|
52
|
-
<div class="w-2 h-2 rounded-full bg-green-500"></div>
|
|
53
|
-
<span class="text-sm font-medium text-[var(--kyro-text-primary)]"
|
|
54
|
-
>API Active</span
|
|
55
|
-
>
|
|
56
|
-
</div>
|
|
57
|
-
<a
|
|
58
|
-
href={`${apiPath}/graphql`}
|
|
59
|
-
target="_blank"
|
|
60
|
-
class="flex items-center gap-2 px-4 py-2 bg-[var(--kyro-surface-accent)] text-[var(--kyro-text-primary)] rounded-lg font-bold text-sm hover:bg-[var(--kyro-surface)] transition-all border border-[var(--kyro-border)]"
|
|
61
|
-
>
|
|
62
|
-
<svg
|
|
63
|
-
class="w-4 h-4"
|
|
64
|
-
fill="none"
|
|
65
|
-
stroke="currentColor"
|
|
66
|
-
viewBox="0 0 24 24"
|
|
67
|
-
>
|
|
68
|
-
<path
|
|
69
|
-
stroke-linecap="round"
|
|
70
|
-
stroke-linejoin="round"
|
|
71
|
-
stroke-width="2"
|
|
72
|
-
d="M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"
|
|
73
|
-
></path>
|
|
74
|
-
</svg>
|
|
75
|
-
Open Endpoint
|
|
76
|
-
</a>
|
|
77
|
-
</div>
|
|
78
|
-
</div>
|
|
79
|
-
|
|
80
|
-
<!-- Quick Examples -->
|
|
81
|
-
<div class="flex flex-wrap gap-2">
|
|
82
|
-
<button
|
|
83
|
-
onclick="copyToClipboard('{ __schema { types { name } } }')"
|
|
84
|
-
class="px-3 py-1.5 text-xs font-bold text-[var(--kyro-text-secondary)] bg-[var(--kyro-surface-accent)] rounded-lg hover:bg-[var(--kyro-surface)] transition-all border border-[var(--kyro-border)]"
|
|
85
|
-
>
|
|
86
|
-
Introspection
|
|
87
|
-
</button>
|
|
88
|
-
<button
|
|
89
|
-
onclick="copyToClipboard('{ collections { slug name } }')"
|
|
90
|
-
class="px-3 py-1.5 text-xs font-bold text-[var(--kyro-text-secondary)] bg-[var(--kyro-surface-accent)] rounded-lg hover:bg-[var(--kyro-surface)] transition-all border border-[var(--kyro-border)]"
|
|
91
|
-
>
|
|
92
|
-
Collections
|
|
93
|
-
</button>
|
|
94
|
-
<button
|
|
95
|
-
onclick="copyToClipboard('{ ping }')"
|
|
96
|
-
class="px-3 py-1.5 text-xs font-bold text-[var(--kyro-text-secondary)] bg-[var(--kyro-surface-accent)] rounded-lg hover:bg-[var(--kyro-surface)] transition-all border border-[var(--kyro-border)]"
|
|
97
|
-
>
|
|
98
|
-
Ping
|
|
99
|
-
</button>
|
|
100
|
-
<button
|
|
101
|
-
onclick="copyToClipboard('{ posts(page: 1, limit: 10) { docs { id title slug } totalDocs } }')"
|
|
102
|
-
class="px-3 py-1.5 text-xs font-bold text-[var(--kyro-text-secondary)] bg-[var(--kyro-surface-accent)] rounded-lg hover:bg-[var(--kyro-surface)] transition-all border border-[var(--kyro-border)]"
|
|
103
|
-
>
|
|
104
|
-
Posts Query
|
|
105
|
-
</button>
|
|
106
|
-
</div>
|
|
107
|
-
</div>
|
|
108
|
-
|
|
109
|
-
<!-- GraphQL Playground Container -->
|
|
110
|
-
<div class="h-[calc(100vh-280px)] overflow-hidden surface-tile">
|
|
111
|
-
<GraphQLPlayground
|
|
112
|
-
client:load
|
|
113
|
-
endpoint={`${apiPath}/graphql`}
|
|
114
|
-
initialQuery={initialQuery}
|
|
115
|
-
/>
|
|
116
|
-
</div>
|
|
12
|
+
<div class="flex-1 overflow-hidden h-[calc(100vh-64px)] md:h-[calc(100vh-80px)]">
|
|
13
|
+
<GraphQLPlayground
|
|
14
|
+
client:load
|
|
15
|
+
endpoint={`${apiPath}/graphql`}
|
|
16
|
+
initialQuery={initialQuery}
|
|
17
|
+
/>
|
|
117
18
|
</div>
|
|
118
|
-
|
|
119
|
-
<script is:inline>
|
|
120
|
-
function copyToClipboard(text) {
|
|
121
|
-
navigator.clipboard.writeText(text);
|
|
122
|
-
}
|
|
123
|
-
</script>
|
|
124
|
-
|
|
125
|
-
<style is:global>
|
|
126
|
-
/* Ensure proper styling for textarea editors */
|
|
127
|
-
.graphiql-container textarea {
|
|
128
|
-
font-family: var(--font-mono) !important;
|
|
129
|
-
}
|
|
130
|
-
</style>
|
|
131
19
|
</AdminLayout>
|
package/src/pages/index.astro
CHANGED
|
@@ -13,7 +13,7 @@ const authItems = authCollections.map((slug) => ({
|
|
|
13
13
|
---
|
|
14
14
|
|
|
15
15
|
<AdminLayout title="Dashboard">
|
|
16
|
-
<div class="flex-1 overflow-y-auto
|
|
16
|
+
<div class="flex-1 overflow-y-auto space-y-8">
|
|
17
17
|
<!-- Header -->
|
|
18
18
|
<div class="surface-tile p-6 flex items-center justify-between gap-8">
|
|
19
19
|
<div class="relative flex-1 max-w-2xl">
|
|
@@ -281,36 +281,7 @@ const authItems = authCollections.map((slug) => ({
|
|
|
281
281
|
</p>
|
|
282
282
|
</div>
|
|
283
283
|
</div>
|
|
284
|
-
<div class="grid grid-cols-1
|
|
285
|
-
<a
|
|
286
|
-
href={`${adminPath}/api-explorer`}
|
|
287
|
-
class="group p-4 bg-[var(--kyro-surface)] rounded-lg hover:bg-[var(--kyro-surface-accent)] transition-all border border-transparent hover:border-[var(--kyro-border)]"
|
|
288
|
-
>
|
|
289
|
-
<div class="flex items-center gap-3 mb-2">
|
|
290
|
-
<div
|
|
291
|
-
class="w-8 h-8 rounded-lg bg-green-500/10 flex items-center justify-center text-green-500 group-hover:scale-110 transition-transform"
|
|
292
|
-
>
|
|
293
|
-
<svg
|
|
294
|
-
class="w-4 h-4"
|
|
295
|
-
fill="none"
|
|
296
|
-
stroke="currentColor"
|
|
297
|
-
viewBox="0 0 24 24"
|
|
298
|
-
>
|
|
299
|
-
<path
|
|
300
|
-
stroke-linecap="round"
|
|
301
|
-
stroke-linejoin="round"
|
|
302
|
-
stroke-width="2"
|
|
303
|
-
d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"></path>
|
|
304
|
-
</svg>
|
|
305
|
-
</div>
|
|
306
|
-
<h4 class="font-medium text-[var(--kyro-text-primary)]">
|
|
307
|
-
Explorer
|
|
308
|
-
</h4>
|
|
309
|
-
</div>
|
|
310
|
-
<p class="text-xs text-[var(--kyro-text-secondary)]">
|
|
311
|
-
Test endpoints interactively
|
|
312
|
-
</p>
|
|
313
|
-
</a>
|
|
284
|
+
<div class="grid grid-cols-1 gap-4">
|
|
314
285
|
<a
|
|
315
286
|
href={`${adminPath}/rest-playground`}
|
|
316
287
|
class="group p-4 bg-[var(--kyro-surface)] rounded-lg hover:bg-[var(--kyro-surface-accent)] transition-all border border-transparent hover:border-[var(--kyro-border)]"
|
|
@@ -394,7 +365,7 @@ const authItems = authCollections.map((slug) => ({
|
|
|
394
365
|
</p>
|
|
395
366
|
</div>
|
|
396
367
|
</div>
|
|
397
|
-
<div class="grid grid-cols-1
|
|
368
|
+
<div class="grid grid-cols-1 gap-4">
|
|
398
369
|
<a
|
|
399
370
|
href={`${adminPath}/graphql`}
|
|
400
371
|
class="group p-4 bg-[var(--kyro-surface)] rounded-lg hover:bg-[var(--kyro-surface-accent)] transition-all border border-transparent hover:border-[var(--kyro-border)]"
|
|
@@ -422,42 +393,12 @@ const authItems = authCollections.map((slug) => ({
|
|
|
422
393
|
d="M21 12a9 9 0 11-18 0 9 9 0 0118 0z"></path>
|
|
423
394
|
</svg>
|
|
424
395
|
</div>
|
|
425
|
-
<h4 class="font-medium text-[var(--kyro-text-primary)]">
|
|
426
|
-
Playground
|
|
427
|
-
</h4>
|
|
428
|
-
</div>
|
|
429
|
-
<p class="text-xs text-[var(--kyro-text-secondary)]">
|
|
430
|
-
Write & test queries
|
|
431
|
-
</p>
|
|
432
|
-
</a>
|
|
433
|
-
<a
|
|
434
|
-
href={`${adminPath}/graphql-explorer`}
|
|
435
|
-
class="group p-4 bg-[var(--kyro-surface)] rounded-lg hover:bg-[var(--kyro-surface-accent)] transition-all border border-transparent hover:border-[var(--kyro-border)]"
|
|
436
|
-
>
|
|
437
|
-
<div class="flex items-center gap-3 mb-2">
|
|
438
|
-
<div
|
|
439
|
-
class="w-8 h-8 rounded-lg bg-orange-500/10 flex items-center justify-center text-orange-500 group-hover:scale-110 transition-transform"
|
|
440
|
-
>
|
|
441
|
-
<svg
|
|
442
|
-
class="w-4 h-4"
|
|
443
|
-
fill="none"
|
|
444
|
-
stroke="currentColor"
|
|
445
|
-
viewBox="0 0 24 24"
|
|
446
|
-
>
|
|
447
|
-
<path
|
|
448
|
-
stroke-linecap="round"
|
|
449
|
-
stroke-linejoin="round"
|
|
450
|
-
stroke-width="2"
|
|
451
|
-
d="M12 6.253v13m0-13C10.832 5.477 9.246 5 7.5 5S4.168 5.477 3 6.253v13C4.168 18.477 5.754 18 7.5 18s3.332.477 4.5 1.253m0-13C13.168 5.477 14.754 5 16.5 5c1.747 0 3.332.477 4.5 1.253v13C19.832 18.477 18.247 18 16.5 18c-1.746 0-3.332.477-4.5 1.253"
|
|
452
|
-
></path>
|
|
453
|
-
</svg>
|
|
454
|
-
</div>
|
|
455
396
|
<h4 class="font-medium text-[var(--kyro-text-primary)]">
|
|
456
397
|
Explorer
|
|
457
398
|
</h4>
|
|
458
399
|
</div>
|
|
459
400
|
<p class="text-xs text-[var(--kyro-text-secondary)]">
|
|
460
|
-
|
|
401
|
+
Write & test queries
|
|
461
402
|
</p>
|
|
462
403
|
</a>
|
|
463
404
|
</div>
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
import AdminLayout from "../layouts/AdminLayout.astro";
|
|
3
3
|
import { RestPlayground } from "../components/RestPlayground";
|
|
4
|
-
|
|
5
|
-
import { adminPath, apiPath } from "../lib/paths";
|
|
4
|
+
import { apiPath } from "../lib/paths";
|
|
6
5
|
|
|
7
6
|
const collectionsResponse = await fetch(
|
|
8
7
|
`${Astro.url.origin}${apiPath}/collections`,
|
|
@@ -12,32 +11,7 @@ const collections = collectionsData.collections || [];
|
|
|
12
11
|
---
|
|
13
12
|
|
|
14
13
|
<AdminLayout title="REST Playground">
|
|
15
|
-
<div class="flex-1 overflow-hidden">
|
|
16
|
-
|
|
17
|
-
<div class="mb-6 surface-tile">
|
|
18
|
-
<div class="flex items-center justify-between mb-4">
|
|
19
|
-
<div>
|
|
20
|
-
<h1
|
|
21
|
-
class="text-xl font-bold tracking-tighter text-[var(--kyro-text-primary)]"
|
|
22
|
-
>
|
|
23
|
-
REST Playground
|
|
24
|
-
</h1>
|
|
25
|
-
<p
|
|
26
|
-
class="text-[var(--kyro-text-secondary)] font-bold mt-2 text-sm tracking-wider"
|
|
27
|
-
>
|
|
28
|
-
Saved collections, history, and environment variables
|
|
29
|
-
</p>
|
|
30
|
-
</div>
|
|
31
|
-
<div class="flex items-center gap-4">
|
|
32
|
-
</div>
|
|
33
|
-
</div>
|
|
34
|
-
</div>
|
|
35
|
-
|
|
36
|
-
<!-- Playground Container -->
|
|
37
|
-
<div class="h-[calc(100vh-200px)] surface-tile overflow-hidden">
|
|
38
|
-
<div class="surface-tile h-full overflow-hidden">
|
|
39
|
-
<RestPlayground client:load collections={collections} />
|
|
40
|
-
</div>
|
|
41
|
-
</div>
|
|
14
|
+
<div class="flex-1 overflow-hidden h-[calc(100vh-64px)] md:h-[calc(100vh-80px)]">
|
|
15
|
+
<RestPlayground client:load collections={collections} />
|
|
42
16
|
</div>
|
|
43
17
|
</AdminLayout>
|
package/src/styles/main.css
CHANGED
|
@@ -417,7 +417,7 @@
|
|
|
417
417
|
|
|
418
418
|
.kyro-btn-danger:hover:not(:disabled) {
|
|
419
419
|
background: var(--kyro-gray-900);
|
|
420
|
-
color:
|
|
420
|
+
color: var(--kyro-sidebar-text-active);
|
|
421
421
|
}
|
|
422
422
|
|
|
423
423
|
.kyro-btn-ghost {
|
|
@@ -431,14 +431,13 @@
|
|
|
431
431
|
}
|
|
432
432
|
|
|
433
433
|
.kyro-btn-success {
|
|
434
|
-
background:
|
|
434
|
+
background: var(--kyro-success);
|
|
435
435
|
color: white;
|
|
436
|
-
border-color:
|
|
436
|
+
border-color: var(--kyro-success);
|
|
437
437
|
}
|
|
438
438
|
|
|
439
439
|
.kyro-btn-success:hover:not(:disabled) {
|
|
440
|
-
|
|
441
|
-
border-color: #059669;
|
|
440
|
+
filter: brightness(0.85);
|
|
442
441
|
}
|
|
443
442
|
|
|
444
443
|
.kyro-btn-success:disabled {
|
|
@@ -448,14 +447,13 @@
|
|
|
448
447
|
}
|
|
449
448
|
|
|
450
449
|
.kyro-btn-warning {
|
|
451
|
-
background:
|
|
450
|
+
background: var(--kyro-warning);
|
|
452
451
|
color: white;
|
|
453
|
-
border-color:
|
|
452
|
+
border-color: var(--kyro-warning);
|
|
454
453
|
}
|
|
455
454
|
|
|
456
455
|
.kyro-btn-warning:hover:not(:disabled) {
|
|
457
|
-
|
|
458
|
-
border-color: #d97706;
|
|
456
|
+
filter: brightness(0.85);
|
|
459
457
|
}
|
|
460
458
|
|
|
461
459
|
/* Cards & Tiles */
|
|
@@ -1464,6 +1462,8 @@
|
|
|
1464
1462
|
color: white;
|
|
1465
1463
|
}
|
|
1466
1464
|
|
|
1465
|
+
.kyro-toast-accent { display: none; }
|
|
1466
|
+
|
|
1467
1467
|
/* Spinner — Monochrome */
|
|
1468
1468
|
.kyro-spinner {
|
|
1469
1469
|
animation: spin 0.8s linear infinite;
|
|
@@ -2053,4 +2053,27 @@
|
|
|
2053
2053
|
/* Ensure NodeViews render correctly within ProseMirror */
|
|
2054
2054
|
.tiptap-editor-wrapper .ProseMirror .node--component {
|
|
2055
2055
|
display: block;
|
|
2056
|
+
}
|
|
2057
|
+
|
|
2058
|
+
/* Floating action button */
|
|
2059
|
+
#kyro-fab {
|
|
2060
|
+
animation: fab-enter 0.3s ease-out;
|
|
2061
|
+
}
|
|
2062
|
+
|
|
2063
|
+
#kyro-fab.fab-hidden {
|
|
2064
|
+
opacity: 0;
|
|
2065
|
+
transform: scale(0.8);
|
|
2066
|
+
pointer-events: none;
|
|
2067
|
+
transition: opacity 200ms ease, transform 200ms ease;
|
|
2068
|
+
}
|
|
2069
|
+
|
|
2070
|
+
@keyframes fab-enter {
|
|
2071
|
+
from {
|
|
2072
|
+
opacity: 0;
|
|
2073
|
+
transform: scale(0.5) translateY(16px);
|
|
2074
|
+
}
|
|
2075
|
+
to {
|
|
2076
|
+
opacity: 1;
|
|
2077
|
+
transform: scale(1) translateY(0);
|
|
2078
|
+
}
|
|
2056
2079
|
}
|