@kyro-cms/admin 0.8.0 → 0.9.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.
Files changed (100) hide show
  1. package/dist/index.cjs +11960 -11006
  2. package/dist/index.cjs.map +1 -1
  3. package/dist/index.css +67 -65
  4. package/dist/index.css.map +1 -1
  5. package/dist/index.d.cts +563 -0
  6. package/dist/index.d.ts +7 -7
  7. package/dist/index.js +12183 -11238
  8. package/dist/index.js.map +1 -1
  9. package/package.json +15 -11
  10. package/src/components/ActionBar.tsx +27 -14
  11. package/src/components/Admin.tsx +1 -1
  12. package/src/components/ApiKeysManager.tsx +5 -5
  13. package/src/components/AutoForm.tsx +585 -369
  14. package/src/components/BrandingHub.tsx +7 -4
  15. package/src/components/CreateView.tsx +2 -0
  16. package/src/components/DetailView.tsx +71 -56
  17. package/src/components/DeveloperCenter.tsx +8 -6
  18. package/src/components/FieldRenderer.tsx +94 -19
  19. package/src/components/ListView.tsx +33 -20
  20. package/src/components/MediaGallery.tsx +219 -194
  21. package/src/components/PluginsManager.tsx +197 -70
  22. package/src/components/RestPlayground.tsx +7 -7
  23. package/src/components/SessionsManager.tsx +1 -1
  24. package/src/components/SettingsPage.tsx +22 -0
  25. package/src/components/Sidebar.astro +13 -41
  26. package/src/components/UserManagement.tsx +153 -15
  27. package/src/components/UserMenu.tsx +30 -4
  28. package/src/components/VersionHistoryPanel.tsx +112 -119
  29. package/src/components/WebhookManager.tsx +6 -4
  30. package/src/components/blocks/ArrayBlock.tsx +6 -23
  31. package/src/components/blocks/BlockEditModal.tsx +82 -309
  32. package/src/components/blocks/CardBlock.tsx +35 -0
  33. package/src/components/blocks/ChildBlocksTree.tsx +57 -31
  34. package/src/components/blocks/GenericBlock.tsx +44 -0
  35. package/src/components/blocks/HeadingSubheadingBlock.tsx +32 -0
  36. package/src/components/blocks/HeroBlock.tsx +5 -14
  37. package/src/components/blocks/RichTextBlock.tsx +5 -5
  38. package/src/components/blocks/index.ts +5 -3
  39. package/src/components/fields/AccordionField.tsx +2 -2
  40. package/src/components/fields/ArrayField.tsx +1 -1
  41. package/src/components/fields/ArrayLayout.tsx +120 -29
  42. package/src/components/fields/BlocksField.tsx +430 -50
  43. package/src/components/fields/CardField.tsx +73 -0
  44. package/src/components/fields/CheckboxField.tsx +7 -3
  45. package/src/components/fields/DateField.tsx +4 -1
  46. package/src/components/fields/GroupLayout.tsx +2 -2
  47. package/src/components/fields/HeadingSubheadingField.tsx +43 -0
  48. package/src/components/fields/ListField.tsx +2 -2
  49. package/src/components/fields/NumberField.tsx +4 -1
  50. package/src/components/fields/RelationshipField.tsx +153 -87
  51. package/src/components/fields/RichTextField.tsx +781 -0
  52. package/src/components/fields/SecretField.tsx +102 -0
  53. package/src/components/fields/SelectField.tsx +19 -6
  54. package/src/components/fields/TabsLayout.tsx +19 -9
  55. package/src/components/fields/TextField.tsx +4 -1
  56. package/src/components/fields/UploadField.tsx +122 -56
  57. package/src/components/fields/extensions/blockComponents.tsx +103 -174
  58. package/src/components/fields/extensions/blocksStore.ts +8 -1
  59. package/src/components/fields/index.ts +4 -2
  60. package/src/components/ui/PageHeader.tsx +5 -5
  61. package/src/components/ui/SlidePanel.tsx +8 -3
  62. package/src/components/ui/icons.tsx +109 -109
  63. package/src/components/users/UserDetail.tsx +79 -16
  64. package/src/hooks/useAutoFormState.ts +125 -62
  65. package/src/integration.ts +148 -46
  66. package/src/kyro-cms.d.ts +7 -2
  67. package/src/layouts/AuthLayout.astro +14 -2
  68. package/src/lib/autoform-store.ts +85 -52
  69. package/src/lib/change-source.ts +9 -0
  70. package/src/lib/config.ts +104 -8
  71. package/src/lib/globals.ts +44 -9
  72. package/src/lib/normalize-upload-fields.ts +41 -0
  73. package/src/lib/paths.ts +2 -2
  74. package/src/lib/resolve-field-value.ts +110 -0
  75. package/src/lib/shim/use-sync-external-store-with-selector.js +30 -0
  76. package/src/lib/shim/use-sync-external-store.js +1 -0
  77. package/src/lib/stores/index.ts +1 -0
  78. package/src/lib/useResourceManager.ts +4 -4
  79. package/src/lib/vite-shim-plugin.ts +100 -0
  80. package/src/pages/[collection]/[id].astro +1 -1
  81. package/src/pages/preview/[collection]/[id].astro +4 -4
  82. package/src/pages/settings/[slug].astro +2 -2
  83. package/src/styles/main.css +60 -54
  84. package/README.md +0 -46
  85. package/dist/EditorClient-Q23UXR37.cjs +0 -468
  86. package/dist/EditorClient-Q23UXR37.cjs.map +0 -1
  87. package/dist/EditorClient-T5PASFNR.js +0 -466
  88. package/dist/EditorClient-T5PASFNR.js.map +0 -1
  89. package/dist/chunk-3BGDYKTD.cjs +0 -348
  90. package/dist/chunk-3BGDYKTD.cjs.map +0 -1
  91. package/dist/chunk-EEFXLQVT.js +0 -3
  92. package/dist/chunk-EEFXLQVT.js.map +0 -1
  93. package/src/components/blocks/ButtonBlock.tsx +0 -64
  94. package/src/components/blocks/ColumnsBlock.tsx +0 -55
  95. package/src/components/blocks/DividerBlock.tsx +0 -43
  96. package/src/components/blocks/LinkBlock.tsx +0 -65
  97. package/src/components/blocks/VStackBlock.tsx +0 -29
  98. package/src/components/fields/EditorClient.tsx +0 -535
  99. package/src/components/fields/PortableTextField.tsx +0 -155
  100. package/src/components/fields/PortableTextRenderer.tsx +0 -68
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kyro-cms/admin",
3
- "version": "0.8.0",
3
+ "version": "0.9.1",
4
4
  "engines": {
5
5
  "node": ">=22"
6
6
  },
@@ -77,12 +77,19 @@
77
77
  "@dnd-kit/utilities": "^3.2.2",
78
78
  "@graphiql/react": "^0.37.3",
79
79
  "@kyro-cms/core": "file:..",
80
- "@portabletext/editor": "^6.6.3",
81
- "@portabletext/react": "^6.0.3",
82
- "@portabletext/schema": "^2.1.1",
83
- "@portabletext/toolbar": "^7.0.26",
84
- "@portabletext/types": "^4.0.2",
85
80
  "@tailwindcss/vite": "^4.0.0",
81
+ "@tiptap/extension-color": "^3.23.6",
82
+ "@tiptap/extension-highlight": "^3.23.6",
83
+ "@tiptap/extension-image": "^3.23.6",
84
+ "@tiptap/extension-link": "^3.23.6",
85
+ "@tiptap/extension-task-item": "^3.23.6",
86
+ "@tiptap/extension-task-list": "^3.23.6",
87
+ "@tiptap/extension-text-align": "^3.23.6",
88
+ "@tiptap/extension-text-style": "^3.23.6",
89
+ "@tiptap/extension-underline": "^3.23.6",
90
+ "@tiptap/pm": "^3.23.6",
91
+ "@tiptap/react": "^3.23.6",
92
+ "@tiptap/starter-kit": "^3.23.6",
86
93
  "@types/pg": "^8.20.0",
87
94
  "@uiw/codemirror-theme-aura": "^4.25.9",
88
95
  "@uiw/codemirror-theme-dracula": "^4.25.9",
@@ -96,14 +103,11 @@
96
103
  "lucide-react": "^0.475.0",
97
104
  "react": "^19.0.0",
98
105
  "react-dom": "^19.0.0",
99
- "react-icons": "^5.0.0",
100
106
  "react-image-crop": "^11.0.10",
101
- "slate": "^0.124.1",
102
- "slate-history": "^0.113.1",
103
- "slate-react": "^0.124.0",
104
107
  "swup": "^4.9.0",
105
108
  "tailwindcss": "^4.0.0",
106
109
  "unstorage": "^1.17.5",
110
+ "use-sync-external-store": "1.5.0",
107
111
  "zustand": "^5.0.3"
108
112
  },
109
113
  "devDependencies": {
@@ -111,7 +115,7 @@
111
115
  "@types/react": "^19.0.0",
112
116
  "@types/react-dom": "^19.0.0",
113
117
  "dotenv-cli": "^11.0.0",
114
- "tsup": "^6.0.0",
118
+ "tsup": "^8.5.1",
115
119
  "typescript": "^5.7.3",
116
120
  "vitest": "^4.1.4"
117
121
  },
@@ -170,7 +170,7 @@ export function ActionBar({
170
170
  <button type="button"
171
171
  onClick={onPublish}
172
172
  disabled={saveStatus === "saving"}
173
- className="bg-[var(--kyro-primary)] hover:opacity-90 text-white kyro-btn-md flex items-center gap-2"
173
+ className="kyro-btn-success hover:opacity-90 kyro-btn-md flex items-center gap-2"
174
174
  >
175
175
  <svg
176
176
  width="16"
@@ -204,19 +204,32 @@ export function ActionBar({
204
204
  Unpublish
205
205
  </button>
206
206
  )}
207
- <button type="button"
208
- onClick={onSave}
209
- disabled={
210
- saveStatus === "saving" || (!hasChanges && saveStatus !== "error")
211
- }
212
- className={getSaveButtonClass()}
213
- >
214
- {saveStatus === "saving"
215
- ? "Saving..."
216
- : saveStatus === "saved"
217
- ? "Saved"
218
- : "Save"}
219
- </button>
207
+ {status === "published" && !hasChanges && saveStatus !== "saving" && saveStatus !== "error" ? (
208
+ <span className="inline-flex items-center gap-1.5 px-4 py-2 rounded-lg text-[11px] font-bold tracking-widest bg-green-100 text-green-700 border border-green-200 cursor-not-allowed shadow-sm">
209
+ <svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2.5">
210
+ <path d="M22 2L11 13M22 2l-7 20-4-9-9-4 20-7z" />
211
+ </svg>
212
+ Published
213
+ </span>
214
+ ) : (
215
+ <button type="button"
216
+ onClick={onSave}
217
+ disabled={
218
+ saveStatus === "saving" || (!hasChanges && saveStatus !== "error")
219
+ }
220
+ className={getSaveButtonClass()}
221
+ >
222
+ {saveStatus === "saving"
223
+ ? "Saving..."
224
+ : saveStatus === "saved"
225
+ ? "Saved"
226
+ : hasChanges && status === "published"
227
+ ? "Save Draft"
228
+ : status === "draft" && hasChanges
229
+ ? "Save Draft"
230
+ : "Save"}
231
+ </button>
232
+ )}
220
233
 
221
234
  <Dropdown
222
235
  trigger={
@@ -158,7 +158,7 @@ const toasts = useToastStore((state) => state.toasts);
158
158
  collection={collection}
159
159
  documentId={activeDocumentId}
160
160
  onBack={() => setCurrentView("list")}
161
- onSave={() => toast.success("Changes saved")}
161
+ onSave={() => {}}
162
162
  onError={(msg) => toast.error(msg)}
163
163
  />
164
164
  ) : null;
@@ -1,7 +1,7 @@
1
1
  import React, { useState } from "react";
2
2
  import { apiPost } from "../lib/api";
3
3
  import { useResourceManager } from "../lib/useResourceManager";
4
- import { useUIStore } from "../lib/stores";
4
+ import { useUIStore, toast } from "../lib/stores";
5
5
  import {
6
6
  Key, Plus, Trash2, Copy, CheckCircle2, Clock,
7
7
  Shield, Zap, AlertTriangle, Info, Terminal,
@@ -65,7 +65,7 @@ export function ApiKeysManager() {
65
65
  const [copiedId, setCopiedId] = useState<string | null>(null);
66
66
  const [createError, setCreateError] = useState("");
67
67
  const [rotatingId, setRotatingId] = useState<string | null>(null);
68
- const { alert, confirm: kyroConfirm } = useUIStore();
68
+ const { confirm: kyroConfirm } = useUIStore();
69
69
 
70
70
  const handleCreateKey = async () => {
71
71
  if (!newKeyName.trim()) { setCreateError("Name is required"); return; }
@@ -92,7 +92,7 @@ export function ApiKeysManager() {
92
92
  const rotated = await apiPost<ApiKeyItem>(`/api/keys/${key.id}/rotate`);
93
93
  setNewKey(rotated);
94
94
  } catch {
95
- alert({ title: "Error", message: "Failed to rotate key. Please try again." });
95
+ toast.error("Failed to rotate key. Please try again.");
96
96
  } finally {
97
97
  setRotatingId(null);
98
98
  }
@@ -287,7 +287,7 @@ export function ApiKeysManager() {
287
287
  <button
288
288
  type="button"
289
289
  onClick={() => copyToClipboard(newKey.key!, newKey.id)}
290
- className="flex items-center justify-center gap-2 px-8 py-4 bg-[var(--kyro-primary)] text-white rounded-2xl font-bold hover:scale-[1.02] active:scale-[0.98] transition-all shadow-lg shadow-[var(--kyro-primary)]/20"
290
+ className="kyro-btn kyro-btn-primary flex items-center justify-center gap-2 px-8 py-4 rounded-2xl font-bold hover:scale-[1.02] active:scale-[0.98] transition-all shadow-lg shadow-[var(--kyro-primary)]/20"
291
291
  >
292
292
  {copiedId === newKey.id ? <CheckCircle2 className="w-5 h-5" /> : <Copy className="w-5 h-5" />}
293
293
  <span>{copiedId === newKey.id ? "Copied" : "Copy Key"}</span>
@@ -333,7 +333,7 @@ export function ApiKeysManager() {
333
333
  <button
334
334
  type="button"
335
335
  onClick={() => setIsCreateModalOpen(true)}
336
- className="inline-flex items-center gap-3 px-8 py-4 bg-[var(--kyro-primary)] text-white rounded-2xl font-bold hover:scale-[1.05] transition-all shadow-xl shadow-[var(--kyro-primary)]/10"
336
+ className="kyro-btn kyro-btn-primary inline-flex items-center gap-3 px-8 py-4 rounded-2xl font-bold hover:scale-[1.05] transition-all shadow-xl shadow-[var(--kyro-primary)]/10"
337
337
  >
338
338
  <Plus className="w-5 h-5" />
339
339
  Generate API Key