@kyro-cms/admin 0.9.5 → 0.9.7

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 (35) hide show
  1. package/dist/index.cjs +659 -684
  2. package/dist/index.cjs.map +1 -1
  3. package/dist/index.css +54 -51
  4. package/dist/index.css.map +1 -1
  5. package/dist/index.js +660 -685
  6. package/dist/index.js.map +1 -1
  7. package/package.json +2 -2
  8. package/src/components/ActionBar.tsx +172 -292
  9. package/src/components/Admin.tsx +7 -1
  10. package/src/components/AutoForm.tsx +573 -367
  11. package/src/components/DetailView.tsx +22 -47
  12. package/src/components/GraphQLPlayground.tsx +473 -223
  13. package/src/components/ListView.tsx +1 -1
  14. package/src/components/MediaGallery.tsx +2 -2
  15. package/src/components/RestPlayground.tsx +482 -519
  16. package/src/components/blocks/AccordionBlock.tsx +1 -1
  17. package/src/components/blocks/ArrayBlock.tsx +1 -1
  18. package/src/components/blocks/ChildBlocksTree.tsx +6 -6
  19. package/src/components/blocks/CodeBlock.tsx +1 -1
  20. package/src/components/blocks/FileBlock.tsx +1 -1
  21. package/src/components/blocks/HeroBlock.tsx +1 -1
  22. package/src/components/blocks/ListBlock.tsx +1 -1
  23. package/src/components/blocks/RelationshipBlock.tsx +1 -1
  24. package/src/components/blocks/RichTextBlock.tsx +1 -1
  25. package/src/components/blocks/VideoBlock.tsx +1 -1
  26. package/src/components/fields/BlocksField.tsx +5 -5
  27. package/src/components/fields/RichTextField.tsx +3 -1
  28. package/src/components/ui/SplitButton.tsx +1 -1
  29. package/src/components/ui/Toast.tsx +2 -1
  30. package/src/layouts/AdminLayout.astro +16 -1
  31. package/src/pages/graphql-explorer.astro +7 -51
  32. package/src/pages/graphql.astro +7 -119
  33. package/src/pages/index.astro +4 -63
  34. package/src/pages/rest-playground.astro +3 -29
  35. package/src/styles/main.css +53 -43
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import React, { createContext, lazy, useState, useContext, useRef, useEffect, useCallback, useMemo, Suspense } from 'react';
2
2
  import { create, useStore } from 'zustand';
3
3
  import { persist, createJSONStorage } from 'zustand/middleware';
4
- import { GripVertical, Copy, X, Video, Mail, Clock, Database, Users, Tag, Image, Activity, CircleHelp, Sparkles, Blocks, Columns3, Link2, ListOrdered, Box, Heading1, Star, AlignLeft, ChevronDown, File, Code, List, Plus, ChevronRight, ChevronUp, Search, LoaderCircle, Check, RefreshCw, Undo, Redo, Bold, Italic, Underline, Strikethrough, Highlighter, Palette, CheckSquare, Quote, Terminal, Minus, AlignCenter, AlignRight, Link, Minimize2, Maximize2, Grid3X3, Filter, FolderPlus, FolderInput, Folder, Trash2, Film, Music, FileText, Archive, Download, Crop, Server, CodeXml, Pencil, Eye, Send, Info, TriangleAlert, ShieldAlert, CircleCheck, History, CheckCircle2, User, GitCompare, Undo2, ExternalLink, Settings, Shield, Hexagon, Network, Sun, Moon, LogOut, ArrowRight, LayoutDashboard, ArrowUpRight, Webhook, Zap, Pause, Play, Key, Lock, EyeOff, CirclePlay, RefreshCcw, Save, UserPlus, LockOpen } from 'lucide-react';
4
+ import { GripVertical, Copy, X, Video, Mail, Clock, Database, Users, Tag, Image, Activity, CircleHelp, Sparkles, Blocks, Columns3, Link2, ListOrdered, Box, Heading1, Star, AlignLeft, ChevronDown, File, Code, List, Plus, ChevronRight, ChevronUp, Search, LoaderCircle, Check, RefreshCw, Undo, Redo, Bold, Italic, Underline, Strikethrough, Highlighter, Palette, CheckSquare, Quote, Terminal, Minus, AlignCenter, AlignRight, Link, Minimize2, Maximize2, Grid3X3, Filter, FolderPlus, FolderInput, Folder, Trash2, Film, Music, FileText, Archive, Download, Crop, Server, CodeXml, Pencil, Eye, EllipsisVertical, Send, Info, TriangleAlert, ShieldAlert, CircleCheck, History, CheckCircle2, User, GitCompare, Undo2, ExternalLink, Settings, Shield, Hexagon, Network, Sun, Moon, LogOut, ArrowRight, LayoutDashboard, ArrowUpRight, Webhook, Zap, Pause, Play, Key, Lock, EyeOff, CirclePlay, RefreshCcw, Save, UserPlus, LockOpen } from 'lucide-react';
5
5
  import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
6
6
  import { createPortal } from 'react-dom';
7
7
  import { useEditor, EditorContent } from '@tiptap/react';
@@ -1025,7 +1025,7 @@ function ListView({
1025
1025
  ),
1026
1026
  /* @__PURE__ */ jsxs("div", { className: "surface-tile p-4 flex flex-col lg:flex-row gap-4 items-start lg:items-center", children: [
1027
1027
  /* @__PURE__ */ jsxs("div", { className: "relative flex-1 w-full lg:max-w-md", children: [
1028
- /* @__PURE__ */ jsx(Search, { className: "w-4 h-4" }),
1028
+ /* @__PURE__ */ jsx(Search, { className: "absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-[var(--kyro-text-muted)]" }),
1029
1029
  /* @__PURE__ */ jsx(
1030
1030
  "input",
1031
1031
  {
@@ -2735,7 +2735,7 @@ function MediaGallery({
2735
2735
  ] })
2736
2736
  ] }) }),
2737
2737
  /* @__PURE__ */ jsxs("div", { className: "flex-1 flex flex-col min-h-0 bg-[var(--kyro-bg)]", children: [
2738
- /* @__PURE__ */ jsx("div", { className: `flex-1 overflow-y-auto custom-scrollbar ${pickerMode ? "px-2 py-4" : "py-8 px-4"}`, children: loading ? /* @__PURE__ */ jsx("div", { className: "grid grid-cols-2 gap-4 sm:grid-cols-3 lg:grid-cols-4 xl:grid-cols-5", children: /* @__PURE__ */ jsx(Shimmer, { variant: "media-card", count: 12 }) }) : items.length === 0 ? /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center justify-center py-32 text-center", children: [
2738
+ /* @__PURE__ */ jsx("div", { className: `flex-1 overflow-y-auto custom-scrollbar ${pickerMode ? "px-2 py-4" : "py-4 px-2 md:py-8 md:px-4"}`, children: loading ? /* @__PURE__ */ jsx("div", { className: "grid grid-cols-2 gap-4 md:grid-cols-3 lg:grid-cols-4 xl:grid-cols-5", children: /* @__PURE__ */ jsx(Shimmer, { variant: "media-card", count: 12 }) }) : items.length === 0 ? /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center justify-center py-32 text-center", children: [
2739
2739
  /* @__PURE__ */ jsx("div", { className: "w-24 h-24 rounded-[2rem] bg-[var(--kyro-surface-accent)] flex items-center justify-center mb-8 rotate-12 group-hover:rotate-0 transition-transform duration-500", children: /* @__PURE__ */ jsx(Grid3X3, { className: "w-10 h-10 text-[var(--kyro-text-muted)] opacity-30" }) }),
2740
2740
  /* @__PURE__ */ jsx("h3", { className: "text-xl font-bold text-[var(--kyro-text-primary)] tracking-tight", children: "No assets found" }),
2741
2741
  /* @__PURE__ */ jsx("p", { className: "text-[var(--kyro-text-secondary)] mt-2 max-w-xs mx-auto text-sm font-medium leading-relaxed", children: "Upload your first file or create a folder to organize your media assets." }),
@@ -3882,7 +3882,9 @@ function RichTextField({
3882
3882
  const editor = useEditor({
3883
3883
  extensions: [
3884
3884
  StarterKit.configure({
3885
- codeBlock: true
3885
+ codeBlock: true,
3886
+ link: false,
3887
+ underline: false
3886
3888
  }),
3887
3889
  Link4.configure({
3888
3890
  openOnClick: false
@@ -3902,7 +3904,7 @@ function RichTextField({
3902
3904
  TextStyle,
3903
3905
  Color
3904
3906
  ],
3905
- content: value || {},
3907
+ content: value || { type: "doc", content: [] },
3906
3908
  editable: !disabled,
3907
3909
  onUpdate: ({ editor: editor2 }) => {
3908
3910
  onChange(editor2.getJSON());
@@ -6294,7 +6296,7 @@ var VideoBlock = ({
6294
6296
  {
6295
6297
  type: "button",
6296
6298
  onClick: () => removeBlock(block3.id),
6297
- className: "p-1 hover:bg-red-50 rounded text-red-500",
6299
+ className: "p-1 hover:bg-[var(--kyro-danger-bg)] rounded text-[var(--kyro-danger)]",
6298
6300
  title: "Remove",
6299
6301
  children: /* @__PURE__ */ jsx(X, { className: "w-3 h-3" })
6300
6302
  }
@@ -6404,7 +6406,7 @@ var ListBlock = ({
6404
6406
  {
6405
6407
  type: "button",
6406
6408
  onClick: () => removeBlock(block3.id),
6407
- className: "p-1 hover:bg-red-50 rounded text-red-500",
6409
+ className: "p-1 hover:bg-[var(--kyro-danger-bg)] rounded text-[var(--kyro-danger)]",
6408
6410
  title: "Remove",
6409
6411
  children: /* @__PURE__ */ jsx(X, { className: "w-3 h-3" })
6410
6412
  }
@@ -6453,7 +6455,7 @@ var CodeBlock = ({
6453
6455
  {
6454
6456
  type: "button",
6455
6457
  onClick: () => removeBlock(block3.id),
6456
- className: "p-1.5 hover:bg-red-500/10 rounded-lg transition-all text-[var(--kyro-text-muted)] hover:text-red-500",
6458
+ className: "p-1.5 hover:bg-[var(--kyro-danger-bg)] rounded-lg transition-all text-[var(--kyro-text-muted)] hover:text-[var(--kyro-danger)]",
6457
6459
  title: "Remove",
6458
6460
  children: /* @__PURE__ */ jsx(X, { className: "w-4 h-4" })
6459
6461
  }
@@ -6552,7 +6554,7 @@ var FileBlock = ({
6552
6554
  {
6553
6555
  type: "button",
6554
6556
  onClick: () => removeBlock(block3.id),
6555
- className: "p-1 hover:bg-red-50 rounded text-red-500",
6557
+ className: "p-1 hover:bg-[var(--kyro-danger-bg)] rounded text-[var(--kyro-danger)]",
6556
6558
  title: "Remove",
6557
6559
  children: /* @__PURE__ */ jsx(X, { className: "w-3 h-3" })
6558
6560
  }
@@ -6798,7 +6800,7 @@ var AccordionBlock = ({
6798
6800
  {
6799
6801
  type: "button",
6800
6802
  onClick: () => removeBlock(block3.id),
6801
- className: "p-1 hover:bg-red-50 rounded text-red-500",
6803
+ className: "p-1 hover:bg-[var(--kyro-danger-bg)] rounded text-[var(--kyro-danger)]",
6802
6804
  title: "Remove",
6803
6805
  children: /* @__PURE__ */ jsx(X, { className: "w-3 h-3" })
6804
6806
  }
@@ -6850,7 +6852,7 @@ var RichTextBlock = ({
6850
6852
  {
6851
6853
  type: "button",
6852
6854
  onClick: () => removeBlock(block3.id),
6853
- className: "p-1 hover:bg-red-50 rounded text-red-500",
6855
+ className: "p-1 hover:bg-[var(--kyro-danger-bg)] rounded text-[var(--kyro-danger)]",
6854
6856
  title: "Remove",
6855
6857
  children: /* @__PURE__ */ jsx(X, { className: "w-3 h-3" })
6856
6858
  }
@@ -7637,7 +7639,7 @@ var ChildBlocksTree = ({
7637
7639
  handleRemoveChild(child.id);
7638
7640
  setConfirmDeleteId(null);
7639
7641
  },
7640
- className: "px-2 py-1 text-xs bg-red-500 text-white rounded hover:bg-red-600",
7642
+ className: "px-2 py-1 text-xs bg-[var(--kyro-danger)] text-white rounded",
7641
7643
  children: "Remove"
7642
7644
  }
7643
7645
  ),
@@ -7660,8 +7662,8 @@ var ChildBlocksTree = ({
7660
7662
  e.stopPropagation();
7661
7663
  setConfirmDeleteId(child.id);
7662
7664
  },
7663
- className: "p-1.5 rounded-md transition-opacity cursor-pointer hover:bg-red-50",
7664
- children: /* @__PURE__ */ jsx(X, { className: "w-3.5 h-3.5 text-red-500 invisible group-hover/column:visible" })
7665
+ className: "p-1.5 rounded-md transition-opacity cursor-pointer hover:bg-[var(--kyro-danger-bg)]",
7666
+ children: /* @__PURE__ */ jsx(X, { className: "w-3.5 h-3.5 text-[var(--kyro-danger)] invisible group-hover/column:visible" })
7665
7667
  }
7666
7668
  )
7667
7669
  ]
@@ -7858,7 +7860,7 @@ var NestedChildBlocks = ({
7858
7860
  handleRemoveChild(child.id);
7859
7861
  setConfirmDeleteId(null);
7860
7862
  },
7861
- className: "px-2 py-1 text-xs bg-red-500 text-white rounded hover:bg-red-600",
7863
+ className: "px-2 py-1 text-xs bg-[var(--kyro-danger)] text-white rounded",
7862
7864
  children: "Remove"
7863
7865
  }
7864
7866
  ),
@@ -7881,8 +7883,8 @@ var NestedChildBlocks = ({
7881
7883
  e.stopPropagation();
7882
7884
  setConfirmDeleteId(child.id);
7883
7885
  },
7884
- className: "p-1.5 rounded-md invisible group-hover:visible transition-opacity cursor-pointer hover:bg-red-50",
7885
- children: /* @__PURE__ */ jsx(X, { className: "w-3.5 h-3.5 text-red-500" })
7886
+ className: "p-1.5 rounded-md invisible group-hover:visible transition-opacity cursor-pointer hover:bg-[var(--kyro-danger-bg)]",
7887
+ children: /* @__PURE__ */ jsx(X, { className: "w-3.5 h-3.5 text-[var(--kyro-danger)]" })
7886
7888
  }
7887
7889
  )
7888
7890
  ]
@@ -8015,7 +8017,7 @@ var HeroBlock = ({
8015
8017
  {
8016
8018
  type: "button",
8017
8019
  onClick: () => removeBlock(block3.id),
8018
- className: "p-1 hover:bg-red-50 rounded text-red-500",
8020
+ className: "p-1 hover:bg-[var(--kyro-danger-bg)] rounded text-[var(--kyro-danger)]",
8019
8021
  title: "Remove",
8020
8022
  children: /* @__PURE__ */ jsx(X, { className: "w-3 h-3" })
8021
8023
  }
@@ -8243,7 +8245,7 @@ var ArrayBlock = ({
8243
8245
  {
8244
8246
  type: "button",
8245
8247
  onClick: () => removeBlock(block3.id),
8246
- className: "p-1 hover:bg-red-50 rounded text-red-500",
8248
+ className: "p-1 hover:bg-[var(--kyro-danger-bg)] rounded text-[var(--kyro-danger)]",
8247
8249
  title: "Remove",
8248
8250
  children: /* @__PURE__ */ jsx(X, { className: "w-3 h-3" })
8249
8251
  }
@@ -8460,7 +8462,7 @@ var RelationshipBlock = ({
8460
8462
  {
8461
8463
  type: "button",
8462
8464
  onClick: () => removeBlock(block3.id),
8463
- className: "p-1 hover:bg-red-50 rounded text-red-500",
8465
+ className: "p-1 hover:bg-[var(--kyro-danger-bg)] rounded text-[var(--kyro-danger)]",
8464
8466
  title: "Remove",
8465
8467
  children: /* @__PURE__ */ jsx(X, { className: "w-3 h-3" })
8466
8468
  }
@@ -8660,7 +8662,7 @@ var SortableBlockComponent = ({
8660
8662
  removeBlock(block3.id);
8661
8663
  setShowDeleteConfirm(false);
8662
8664
  },
8663
- className: "px-1.5 py-0.5 text-[9px] bg-red-500 hover:bg-red-600 text-white rounded font-semibold transition-colors",
8665
+ className: "px-1.5 py-0.5 text-[9px] bg-[var(--kyro-danger)] text-white rounded font-semibold transition-colors hover:brightness-90",
8664
8666
  children: "Remove"
8665
8667
  }
8666
8668
  ),
@@ -8695,7 +8697,7 @@ var SortableBlockComponent = ({
8695
8697
  e.stopPropagation();
8696
8698
  setShowDeleteConfirm(true);
8697
8699
  },
8698
- className: "p-0.5 hover:bg-red-50 hover:text-red-500 rounded text-[var(--kyro-text-muted)] transition-colors",
8700
+ className: "p-0.5 hover:bg-[var(--kyro-danger-bg)] hover:text-[var(--kyro-danger)] rounded text-[var(--kyro-text-muted)] transition-colors",
8699
8701
  title: "Remove",
8700
8702
  children: /* @__PURE__ */ jsx(X, { className: "w-3 h-3" })
8701
8703
  }
@@ -8759,7 +8761,7 @@ var SortableBlockComponent = ({
8759
8761
  removeBlock(block3.id);
8760
8762
  setShowDeleteConfirm(false);
8761
8763
  },
8762
- className: "px-2.5 py-1 text-[10px] bg-red-500 hover:bg-red-600 text-white rounded font-semibold transition-colors",
8764
+ className: "px-2.5 py-1 text-[10px] bg-[var(--kyro-danger)] text-white rounded font-semibold transition-colors hover:brightness-90",
8763
8765
  children: "Remove"
8764
8766
  }
8765
8767
  ),
@@ -8796,7 +8798,7 @@ var SortableBlockComponent = ({
8796
8798
  e.stopPropagation();
8797
8799
  setShowDeleteConfirm(true);
8798
8800
  },
8799
- className: "p-1 hover:bg-red-50 hover:text-red-500 rounded text-[var(--kyro-text-muted)] transition-colors",
8801
+ className: "p-1 hover:bg-[var(--kyro-danger-bg)] hover:text-[var(--kyro-danger)] rounded text-[var(--kyro-text-muted)] transition-colors",
8800
8802
  title: "Remove Block",
8801
8803
  children: /* @__PURE__ */ jsx(X, { className: "w-3.5 h-3.5" })
8802
8804
  }
@@ -8986,7 +8988,7 @@ var BlocksField = ({
8986
8988
  }
8987
8989
  }
8988
8990
  };
8989
- const activeBlock = activeDrag ? blockCategories.flatMap((cat) => cat.blocks).find((b) => `drawer-${b.type}` === activeDrag.id) || blocks2.find((b) => b.id === activeDrag.id) : null;
8991
+ const activeBlock = activeDrag ? dynamicCategories.flatMap((cat) => cat.blocks).find((b) => `drawer-${b.type}` === activeDrag.id) || blocks2.find((b) => b.id === activeDrag.id) : null;
8990
8992
  activeBlock ? "label" in activeBlock ? activeBlock.label : activeBlock.type : "Block";
8991
8993
  useEffect(() => {
8992
8994
  if (!isDropdownOpen) return;
@@ -9663,7 +9665,7 @@ function SplitButton({
9663
9665
  if (saveStatus === "saved") return `${btnBase} bg-[var(--kyro-success)] border-[var(--kyro-success)] text-[var(--kyro-sidebar-text-active)]`;
9664
9666
  if (saveStatus === "error") return `${btnBase} bg-[var(--kyro-error)] border-[var(--kyro-error)] text-[var(--kyro-sidebar-text-active)]`;
9665
9667
  if (isPublishedIdle) return `${btnBase} bg-[var(--kyro-gray-200)] border-[var(--kyro-gray-200)] text-[var(--kyro-text-muted)] cursor-not-allowed`;
9666
- return `${btnBase} bg-[var(--kyro-primary)] border-[var(--kyro-primary)] hover:bg-[var(--kyro-primary-hover)]`;
9668
+ return `${btnBase} bg-[var(--kyro-primary)] border-[var(--kyro-primary)] text-[var(--kyro-sidebar-text-active)] hover:bg-[var(--kyro-primary-hover)]`;
9667
9669
  };
9668
9670
  const chevronBase = "kyro-btn kyro-btn-md px-2 rounded-l-none border-l-[1px] border-white/20 transition-all duration-300";
9669
9671
  const getChevronClass = () => {
@@ -10464,338 +10466,443 @@ function AutoForm({
10464
10466
  const createdAt = formData.createdAt ? new Date(formData.createdAt).toLocaleString() : "Just now";
10465
10467
  !formData.id || documentStatus === "draft";
10466
10468
  const statusLabel = hasUnpublishedChanges ? "Draft (unpublished changes)" : docStatus === "published" ? "Published" : "Draft";
10469
+ const statusLabelMobile = hasUnpublishedChanges ? "Unpublished" : docStatus === "published" ? "Published" : "Draft";
10467
10470
  const statusColor = docStatus === "published" && !hasUnsavedChanges ? "bg-[var(--kyro-success)]" : hasUnpublishedChanges ? "bg-[var(--kyro-warning)]" : "bg-[var(--kyro-text-muted)]";
10468
10471
  const statusBadgeBg = docStatus === "published" && !hasUnpublishedChanges ? "bg-[var(--kyro-success)]/10 text-[var(--kyro-success)] border-[var(--kyro-success)]/20" : hasUnpublishedChanges ? "bg-[var(--kyro-warning)]/10 text-[var(--kyro-warning)] border-[var(--kyro-warning)]/20" : "bg-[var(--kyro-text-muted)]/10 text-[var(--kyro-text-muted)] border-[var(--kyro-text-muted)]/20";
10469
- return /* @__PURE__ */ jsxs("header", { className: "surface-tile px-3 md:px-8 py-2 md:py-6 flex items-center justify-between max-md:static sticky top-0 z-50 border-b border-[var(--kyro-border)] mb-0 md:mb-8 bg-[var(--kyro-surface)] backdrop-blur-md", children: [
10470
- /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1 md:gap-2 min-w-0", children: [
10471
- /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 md:gap-3 flex-wrap min-w-0", children: [
10472
+ const renderAutoSaveStatus = (compact = false) => /* @__PURE__ */ jsxs(Fragment, { children: [
10473
+ autoSaveStatus === "saving" && /* @__PURE__ */ jsxs("span", { className: "flex items-center gap-1.5 text-[var(--kyro-text-muted)]", children: [
10474
+ /* @__PURE__ */ jsxs(
10475
+ "svg",
10476
+ {
10477
+ className: "animate-spin h-3 w-3 shrink-0",
10478
+ viewBox: "0 0 24 24",
10479
+ fill: "none",
10480
+ children: [
10481
+ /* @__PURE__ */ jsx(
10482
+ "circle",
10483
+ {
10484
+ className: "opacity-25",
10485
+ cx: "12",
10486
+ cy: "12",
10487
+ r: "10",
10488
+ stroke: "currentColor",
10489
+ strokeWidth: "4"
10490
+ }
10491
+ ),
10492
+ /* @__PURE__ */ jsx(
10493
+ "path",
10494
+ {
10495
+ className: "opacity-75",
10496
+ fill: "currentColor",
10497
+ d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"
10498
+ }
10499
+ )
10500
+ ]
10501
+ }
10502
+ ),
10503
+ compact ? "Saving\u2026" : "Saving draft..."
10504
+ ] }),
10505
+ autoSaveStatus === "success" && /* @__PURE__ */ jsxs("span", { className: "text-[var(--kyro-success)] flex items-center gap-1", children: [
10506
+ /* @__PURE__ */ jsx(Check, { className: "w-3.5 h-3.5 shrink-0" }),
10507
+ compact ? "Saved" : lastSavedAt ? `Saved ${Math.floor((Date.now() - lastSavedAt) / 6e4)}m ago` : "Draft saved"
10508
+ ] }),
10509
+ autoSaveStatus === "retrying" && /* @__PURE__ */ jsxs("span", { className: "text-[var(--kyro-warning)] flex items-center gap-1.5", children: [
10510
+ /* @__PURE__ */ jsxs("svg", { className: "animate-spin h-3 w-3 shrink-0", viewBox: "0 0 24 24", fill: "none", children: [
10511
+ /* @__PURE__ */ jsx("circle", { className: "opacity-25", cx: "12", cy: "12", r: "10", stroke: "currentColor", strokeWidth: "4" }),
10512
+ /* @__PURE__ */ jsx("path", { className: "opacity-75", fill: "currentColor", d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z" })
10513
+ ] }),
10514
+ compact ? `Retry ${retryCount}/5` : `Retrying save (${retryCount}/5)`
10515
+ ] }),
10516
+ autoSaveStatus === "offline" && /* @__PURE__ */ jsxs("span", { className: "text-[var(--kyro-text-muted)] flex items-center gap-1.5", children: [
10517
+ /* @__PURE__ */ jsxs("svg", { width: "12", height: "12", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", className: "shrink-0", children: [
10518
+ /* @__PURE__ */ jsx("path", { d: "M10.61 10.61a3 3 0 0 0 4.24 4.24" }),
10519
+ /* @__PURE__ */ jsx("path", { d: "M13.36 13.36a3 3 0 0 0-4.24-4.24" }),
10520
+ /* @__PURE__ */ jsx("path", { d: "m2 2 20 20" }),
10521
+ /* @__PURE__ */ jsx("path", { d: "M18.36 5.64a9 9 0 0 0-12.72 0" }),
10522
+ /* @__PURE__ */ jsx("path", { d: "M22.61 1.39a15 15 0 0 0-21.22 0" })
10523
+ ] }),
10524
+ compact ? "Offline" : "Offline \u2014 cached locally"
10525
+ ] }),
10526
+ autoSaveStatus === "error" && /* @__PURE__ */ jsx("span", { className: "text-[var(--kyro-danger)]", children: compact ? "Failed" : "Draft save failed" }),
10527
+ autoSaveStatus === "conflict" && (compact ? /* @__PURE__ */ jsx("span", { className: "text-[var(--kyro-danger)] font-semibold", children: "Conflict" }) : /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3", children: [
10528
+ /* @__PURE__ */ jsx("span", { className: "text-[var(--kyro-danger)] font-semibold", children: "Conflict detected" }),
10529
+ /* @__PURE__ */ jsx("span", { className: "opacity-30", children: "\u2014" }),
10530
+ /* @__PURE__ */ jsx(
10531
+ "button",
10532
+ {
10533
+ type: "button",
10534
+ onClick: async () => {
10535
+ await saveDocument(formData);
10536
+ setAutoSaveStatus("success");
10537
+ },
10538
+ className: "text-[var(--kyro-primary)] hover:underline",
10539
+ children: "Keep my changes"
10540
+ }
10541
+ ),
10542
+ /* @__PURE__ */ jsx("span", { className: "opacity-30", children: "|" }),
10543
+ /* @__PURE__ */ jsx(
10544
+ "button",
10545
+ {
10546
+ type: "button",
10547
+ onClick: () => {
10548
+ window.location.reload();
10549
+ },
10550
+ className: "text-[var(--kyro-danger)] hover:underline",
10551
+ children: "Reload server version"
10552
+ }
10553
+ )
10554
+ ] }))
10555
+ ] });
10556
+ const renderKebabMenu = () => !isNew && /* @__PURE__ */ jsxs(
10557
+ Dropdown,
10558
+ {
10559
+ trigger: /* @__PURE__ */ jsx(
10560
+ "button",
10561
+ {
10562
+ type: "button",
10563
+ className: "kyro-btn p-2 md:p-2.5 rounded-xl border border-[var(--kyro-border)] hover:bg-[var(--kyro-bg-secondary)] transition-all",
10564
+ title: "More actions",
10565
+ children: /* @__PURE__ */ jsxs("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "currentColor", children: [
10566
+ /* @__PURE__ */ jsx("circle", { cx: "12", cy: "5", r: "1.5" }),
10567
+ /* @__PURE__ */ jsx("circle", { cx: "12", cy: "12", r: "1.5" }),
10568
+ /* @__PURE__ */ jsx("circle", { cx: "12", cy: "19", r: "1.5" })
10569
+ ] })
10570
+ }
10571
+ ),
10572
+ direction: "down",
10573
+ children: [
10574
+ !globalSlug && /* @__PURE__ */ jsx(
10575
+ DropdownItem,
10576
+ {
10577
+ onClick: handleCreateNew,
10578
+ icon: /* @__PURE__ */ jsxs("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
10579
+ /* @__PURE__ */ jsx("line", { x1: "12", y1: "5", x2: "12", y2: "19" }),
10580
+ /* @__PURE__ */ jsx("line", { x1: "5", y1: "12", x2: "19", y2: "12" })
10581
+ ] }),
10582
+ children: "Create New"
10583
+ }
10584
+ ),
10585
+ !globalSlug && /* @__PURE__ */ jsx(
10586
+ DropdownItem,
10587
+ {
10588
+ onClick: handleDuplicate,
10589
+ icon: /* @__PURE__ */ jsxs("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
10590
+ /* @__PURE__ */ jsx("rect", { x: "9", y: "9", width: "13", height: "13", rx: "2", ry: "2" }),
10591
+ /* @__PURE__ */ jsx("path", { d: "M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1" })
10592
+ ] }),
10593
+ children: "Duplicate"
10594
+ }
10595
+ ),
10596
+ /* @__PURE__ */ jsx(
10597
+ DropdownItem,
10598
+ {
10599
+ onClick: () => setShowSchedulePicker(true),
10600
+ icon: /* @__PURE__ */ jsxs("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
10601
+ /* @__PURE__ */ jsx("rect", { x: "3", y: "4", width: "18", height: "18", rx: "2", ry: "2" }),
10602
+ /* @__PURE__ */ jsx("line", { x1: "16", y1: "2", x2: "16", y2: "6" }),
10603
+ /* @__PURE__ */ jsx("line", { x1: "8", y1: "2", x2: "8", y2: "6" }),
10604
+ /* @__PURE__ */ jsx("line", { x1: "3", y1: "10", x2: "21", y2: "10" })
10605
+ ] }),
10606
+ children: "Schedule Publish"
10607
+ }
10608
+ ),
10609
+ documentStatus === "published" && /* @__PURE__ */ jsx(
10610
+ DropdownItem,
10611
+ {
10612
+ onClick: handleUnpublish,
10613
+ icon: /* @__PURE__ */ jsxs("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
10614
+ /* @__PURE__ */ jsx("path", { d: "M17.94 17.94A10.07 10.07 0 0 1 12 20c-7 0-11-8-11-8a18.45 18.45 0 0 1 5.06-5.94M9.9 4.24A9.12 9.12 0 0 1 12 4c7 0 11 8 11 8a18.5 18.5 0 0 1-2.16 3.19m-6.72-1.07a3 3 0 1 1-4.24-4.24" }),
10615
+ /* @__PURE__ */ jsx("line", { x1: "1", y1: "1", x2: "23", y2: "23" })
10616
+ ] }),
10617
+ children: "Unpublish"
10618
+ }
10619
+ ),
10620
+ !globalSlug && /* @__PURE__ */ jsxs(Fragment, { children: [
10621
+ /* @__PURE__ */ jsx(DropdownSeparator, {}),
10622
+ /* @__PURE__ */ jsx(
10623
+ DropdownItem,
10624
+ {
10625
+ onClick: handleDelete,
10626
+ danger: true,
10627
+ icon: /* @__PURE__ */ jsxs("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
10628
+ /* @__PURE__ */ jsx("polyline", { points: "3 6 5 6 21 6" }),
10629
+ /* @__PURE__ */ jsx("path", { d: "M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2" })
10630
+ ] }),
10631
+ children: "Delete"
10632
+ }
10633
+ )
10634
+ ] })
10635
+ ]
10636
+ }
10637
+ );
10638
+ const renderSchedulePicker = () => showSchedulePicker && /* @__PURE__ */ jsx("div", { ref: scheduleRef, className: "relative", children: /* @__PURE__ */ jsxs("div", { className: "absolute right-0 top-2 p-4 rounded-lg border border-[var(--kyro-border)] bg-[var(--kyro-surface)] shadow-2xl z-50 min-w-[260px]", children: [
10639
+ /* @__PURE__ */ jsx("p", { className: "text-xs font-medium mb-2", children: "Schedule Publish" }),
10640
+ /* @__PURE__ */ jsx(
10641
+ "input",
10642
+ {
10643
+ type: "datetime-local",
10644
+ id: "schedule-datetime",
10645
+ className: "kyro-form-input text-xs mb-3 w-full",
10646
+ min: (/* @__PURE__ */ new Date()).toISOString().slice(0, 16)
10647
+ }
10648
+ ),
10649
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 justify-end", children: [
10650
+ /* @__PURE__ */ jsx(
10651
+ "button",
10652
+ {
10653
+ type: "button",
10654
+ onClick: () => setShowSchedulePicker(false),
10655
+ className: "px-3 py-1.5 text-xs kyro-btn rounded-lg",
10656
+ children: "Cancel"
10657
+ }
10658
+ ),
10659
+ /* @__PURE__ */ jsx(
10660
+ "button",
10661
+ {
10662
+ type: "button",
10663
+ onClick: () => {
10664
+ const val = document.getElementById("schedule-datetime")?.value;
10665
+ if (val) handleSchedulePublish(val);
10666
+ },
10667
+ className: "px-3 py-1.5 text-xs kyro-btn-success rounded-lg",
10668
+ children: "Schedule"
10669
+ }
10670
+ )
10671
+ ] })
10672
+ ] }) });
10673
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
10674
+ /* @__PURE__ */ jsxs("header", { className: "md:hidden border-b border-[var(--kyro-border)] bg-[var(--kyro-surface)] backdrop-blur-md rounded-lg", children: [
10675
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 px-3 py-2.5", children: [
10472
10676
  /* @__PURE__ */ jsx(
10473
10677
  "a",
10474
10678
  {
10475
10679
  href: `/${collectionSlug}`,
10476
- className: "p-1.5 md:p-2 border-0 md:border border-[var(--kyro-border)] rounded-xl hover:bg-[var(--kyro-bg-secondary)] transition-colors shrink-0",
10680
+ className: "p-1.5 rounded-lg hover:bg-[var(--kyro-bg-secondary)] transition-colors shrink-0",
10681
+ "aria-label": "Back to list",
10477
10682
  children: /* @__PURE__ */ jsx(ChevronRight, { className: "w-4 h-4" })
10478
10683
  }
10479
10684
  ),
10480
- /* @__PURE__ */ jsx("h1", { className: "text-lg md:text-xl font-bold tracking-tighter truncate min-w-0", children: docTitle }),
10481
- /* @__PURE__ */ jsxs("span", { className: `shrink-0 inline-flex items-center gap-1.5 px-2 rounded-full text-[10px] font-regular border ${statusBadgeBg}`, children: [
10482
- /* @__PURE__ */ jsx("span", { className: `h-1.5 w-1.5 rounded-full ${statusColor}` }),
10483
- statusLabel
10484
- ] })
10485
- ] }),
10486
- /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-4 text-[11px] font-medium tracking-wide opacity-60 md:ml-12", children: [
10487
- autoSaveStatus === "saving" && /* @__PURE__ */ jsxs("span", { className: "flex items-center gap-1.5 text-[var(--kyro-text-muted)]", children: [
10488
- /* @__PURE__ */ jsxs(
10489
- "svg",
10685
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 min-w-0 flex-1", children: [
10686
+ /* @__PURE__ */ jsx("h1", { className: "text-base font-bold tracking-tight truncate min-w-0", children: docTitle }),
10687
+ /* @__PURE__ */ jsxs("span", { className: `shrink-0 inline-flex items-center gap-1 px-1.5 py-0.5 rounded-full text-[9px] font-medium border ${statusBadgeBg}`, children: [
10688
+ /* @__PURE__ */ jsx("span", { className: `h-1.5 w-1.5 rounded-full ${statusColor}` }),
10689
+ statusLabelMobile
10690
+ ] })
10691
+ ] }),
10692
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1.5 shrink-0", children: [
10693
+ /* @__PURE__ */ jsx(
10694
+ SplitButton,
10490
10695
  {
10491
- className: "animate-spin h-3 w-3",
10492
- viewBox: "0 0 24 24",
10493
- fill: "none",
10494
- children: [
10495
- /* @__PURE__ */ jsx(
10496
- "circle",
10497
- {
10498
- className: "opacity-25",
10499
- cx: "12",
10500
- cy: "12",
10501
- r: "10",
10502
- stroke: "currentColor",
10503
- strokeWidth: "4"
10504
- }
10505
- ),
10506
- /* @__PURE__ */ jsx(
10507
- "path",
10508
- {
10509
- className: "opacity-75",
10510
- fill: "currentColor",
10511
- d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"
10512
- }
10513
- )
10514
- ]
10696
+ status: documentStatus,
10697
+ saveStatus: localSaveStatus,
10698
+ hasChanges: hasUnsavedChanges,
10699
+ onPublish: handlePublish,
10700
+ disabled: localSaveStatus === "saving"
10515
10701
  }
10516
10702
  ),
10517
- "Saving draft..."
10518
- ] }),
10519
- autoSaveStatus === "success" && /* @__PURE__ */ jsxs("span", { className: "text-[var(--kyro-success)] flex items-center gap-1", children: [
10520
- /* @__PURE__ */ jsx(Check, { className: "w-4 h-4" }),
10521
- lastSavedAt ? `Saved ${Math.floor((Date.now() - lastSavedAt) / 6e4)}m ago` : "Draft saved"
10522
- ] }),
10523
- autoSaveStatus === "retrying" && /* @__PURE__ */ jsxs("span", { className: "text-[var(--kyro-warning)] flex items-center gap-1.5", children: [
10524
- /* @__PURE__ */ jsxs("svg", { className: "animate-spin h-3 w-3", viewBox: "0 0 24 24", fill: "none", children: [
10525
- /* @__PURE__ */ jsx("circle", { className: "opacity-25", cx: "12", cy: "12", r: "10", stroke: "currentColor", strokeWidth: "4" }),
10526
- /* @__PURE__ */ jsx("path", { className: "opacity-75", fill: "currentColor", d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z" })
10527
- ] }),
10528
- "Retrying save (",
10529
- retryCount,
10530
- "/5)"
10531
- ] }),
10532
- autoSaveStatus === "offline" && /* @__PURE__ */ jsxs("span", { className: "text-[var(--kyro-text-muted)] flex items-center gap-1.5", children: [
10533
- /* @__PURE__ */ jsxs("svg", { width: "12", height: "12", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
10534
- /* @__PURE__ */ jsx("path", { d: "M10.61 10.61a3 3 0 0 0 4.24 4.24" }),
10535
- /* @__PURE__ */ jsx("path", { d: "M13.36 13.36a3 3 0 0 0-4.24-4.24" }),
10536
- /* @__PURE__ */ jsx("path", { d: "m2 2 20 20" }),
10537
- /* @__PURE__ */ jsx("path", { d: "M18.36 5.64a9 9 0 0 0-12.72 0" }),
10538
- /* @__PURE__ */ jsx("path", { d: "M22.61 1.39a15 15 0 0 0-21.22 0" })
10539
- ] }),
10540
- "Offline \u2014 cached locally"
10541
- ] }),
10542
- autoSaveStatus === "error" && /* @__PURE__ */ jsx("span", { className: "text-[var(--kyro-danger)]", children: "Draft save failed" }),
10543
- autoSaveStatus === "conflict" && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3", children: [
10544
- /* @__PURE__ */ jsx("span", { className: "text-[var(--kyro-danger)] font-semibold", children: "Conflict detected" }),
10545
- /* @__PURE__ */ jsx("span", { className: "opacity-30", children: "\u2014" }),
10546
- /* @__PURE__ */ jsx(
10703
+ renderKebabMenu(),
10704
+ renderSchedulePicker()
10705
+ ] })
10706
+ ] }),
10707
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between px-3 py-1.5 border-t border-[var(--kyro-border)]/50 bg-[var(--kyro-bg-secondary)]/30", children: [
10708
+ /* @__PURE__ */ jsx("div", { className: "flex items-center gap-0.5 bg-[var(--kyro-bg-secondary)] p-0.5 rounded-lg border border-[var(--kyro-border)]/50", children: ["edit", "version", "api"].map((v) => /* @__PURE__ */ jsx(
10709
+ "button",
10710
+ {
10711
+ type: "button",
10712
+ onClick: () => setView(v),
10713
+ className: `px-3 py-1 text-[10px] font-bold rounded-md transition-all ${view === v ? "bg-[var(--kyro-surface)] shadow-sm border border-[var(--kyro-border)] text-[var(--kyro-text-primary)]" : "text-[var(--kyro-text-secondary)] opacity-50 active:opacity-100"}`,
10714
+ children: v === "edit" ? "Edit" : v === "version" ? "History" : "API"
10715
+ },
10716
+ v
10717
+ )) }),
10718
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 text-[10px] font-medium", children: [
10719
+ renderAutoSaveStatus(true),
10720
+ hasUnsavedChanges && autoSaveStatus !== "saving" && autoSaveStatus !== "retrying" && autoSaveStatus !== "conflict" && /* @__PURE__ */ jsx(
10547
10721
  "button",
10548
10722
  {
10549
10723
  type: "button",
10550
10724
  onClick: async () => {
10551
- await saveDocument(formData);
10552
- setAutoSaveStatus("success");
10725
+ setFormData(lastSavedData);
10726
+ markSaved();
10553
10727
  },
10554
- className: "text-[var(--kyro-primary)] hover:underline",
10555
- children: "Keep my changes"
10728
+ className: "text-[var(--kyro-primary)] text-[10px] font-medium hover:underline",
10729
+ children: "Revert"
10556
10730
  }
10557
10731
  ),
10558
- /* @__PURE__ */ jsx("span", { className: "opacity-30", children: "|" }),
10732
+ /* @__PURE__ */ jsx("div", { className: "h-4 w-px bg-[var(--kyro-border)] mx-0.5" }),
10559
10733
  /* @__PURE__ */ jsx(
10560
10734
  "button",
10561
10735
  {
10562
10736
  type: "button",
10563
- onClick: () => {
10564
- window.location.reload();
10565
- },
10566
- className: "text-[var(--kyro-danger)] hover:underline",
10567
- children: "Reload server version"
10737
+ onClick: () => setShowPreview(!showPreview),
10738
+ className: `p-1.5 rounded-lg transition-all ${showPreview ? "bg-[var(--kyro-primary)]/10 text-[var(--kyro-primary)]" : "text-[var(--kyro-text-secondary)] hover:bg-[var(--kyro-bg-secondary)]"}`,
10739
+ title: "Live Preview",
10740
+ children: /* @__PURE__ */ jsx(ExternalLink, { className: "w-3.5 h-3.5" })
10568
10741
  }
10569
10742
  )
10570
- ] }),
10571
- hasUnsavedChanges && autoSaveStatus !== "saving" && autoSaveStatus !== "retrying" && autoSaveStatus !== "conflict" && /* @__PURE__ */ jsxs(Fragment, { children: [
10572
- /* @__PURE__ */ jsx("span", { className: "opacity-30", children: "\u2014" }),
10743
+ ] })
10744
+ ] }),
10745
+ autoSaveStatus === "conflict" && /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between gap-2 px-3 py-2 border-t border-[var(--kyro-danger)]/30 bg-[var(--kyro-danger)]/5", children: [
10746
+ /* @__PURE__ */ jsx("span", { className: "text-[11px] font-semibold text-[var(--kyro-danger)]", children: "Conflict detected" }),
10747
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
10573
10748
  /* @__PURE__ */ jsx(
10574
10749
  "button",
10575
10750
  {
10576
10751
  type: "button",
10577
10752
  onClick: async () => {
10578
- setFormData(lastSavedData);
10579
- markSaved();
10753
+ await saveDocument(formData);
10754
+ setAutoSaveStatus("success");
10580
10755
  },
10581
- className: "text-[var(--kyro-primary)] hover:underline",
10582
- children: "Revert changes"
10756
+ className: "text-[11px] font-medium text-[var(--kyro-primary)] hover:underline",
10757
+ children: "Keep mine"
10758
+ }
10759
+ ),
10760
+ /* @__PURE__ */ jsx("span", { className: "text-[var(--kyro-text-muted)] opacity-30", children: "|" }),
10761
+ /* @__PURE__ */ jsx(
10762
+ "button",
10763
+ {
10764
+ type: "button",
10765
+ onClick: () => window.location.reload(),
10766
+ className: "text-[11px] font-medium text-[var(--kyro-danger)] hover:underline",
10767
+ children: "Reload"
10583
10768
  }
10584
10769
  )
10585
- ] }),
10586
- lastSavedAt && autoSaveStatus !== "saving" && autoSaveStatus !== "retrying" && autoSaveStatus !== "success" && /* @__PURE__ */ jsxs("span", { className: "border-l border-[var(--kyro-border)] pl-4", children: [
10587
- "Draft saved ",
10588
- (() => {
10589
- const diffMs = now - lastSavedAt;
10590
- const diffMin = Math.floor(diffMs / 6e4);
10591
- const diffSec = Math.floor(diffMs / 1e3);
10592
- if (diffMin >= 1) return `${diffMin}m ago`;
10593
- if (diffSec >= 5) return `${diffSec}s ago`;
10594
- return "just now";
10595
- })()
10596
- ] }),
10597
- /* @__PURE__ */ jsxs("span", { className: "border-l border-[var(--kyro-border)] pl-4", children: [
10598
- "Modified ",
10599
- lastModified
10600
- ] }),
10601
- /* @__PURE__ */ jsxs("span", { className: "border-l border-[var(--kyro-border)] pl-4", children: [
10602
- "Created ",
10603
- createdAt
10604
10770
  ] })
10605
10771
  ] })
10606
10772
  ] }),
10607
- /* @__PURE__ */ jsxs("div", { className: "max-md:hidden flex items-center gap-6", children: [
10608
- /* @__PURE__ */ jsx("div", { className: "flex items-center gap-1 bg-[var(--kyro-bg-secondary)] p-1 rounded-xl border border-[var(--kyro-border)]", children: ["edit", "version", "api"].map((v) => /* @__PURE__ */ jsx(
10609
- "button",
10610
- {
10611
- type: "button",
10612
- onClick: () => setView(v),
10613
- className: `px-5 py-2 text-xs font-bold rounded-lg transition-all ${view === v ? "bg-[var(--kyro-surface)] shadow-sm border border-[var(--kyro-border)] text-[var(--kyro-text-primary)]" : "text-[var(--kyro-text-secondary)] opacity-50 hover:opacity-100"}`,
10614
- children: v.toUpperCase()
10615
- },
10616
- v
10617
- )) }),
10618
- /* @__PURE__ */ jsx("div", { className: "h-8 w-px bg-[var(--kyro-border)] mx-2" }),
10619
- /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3", children: [
10620
- /* @__PURE__ */ jsxs(
10621
- "button",
10622
- {
10623
- type: "button",
10624
- onClick: () => setShowPreview(!showPreview),
10625
- className: `kyro-btn p-2.5 rounded-xl transition-all flex items-center gap-2 ${showPreview ? "shadow-lg" : "text-[var(--kyro-text-secondary)] hover:bg-[var(--kyro-bg-secondary)]"}`,
10626
- title: "Live Preview",
10627
- children: [
10628
- /* @__PURE__ */ jsx(ExternalLink, { className: "w-4 h-4" }),
10629
- showPreview && /* @__PURE__ */ jsx("span", { className: "text-[10px] font-bold tracking-widest pr-1", children: "Active" })
10630
- ]
10631
- }
10632
- ),
10633
- /* @__PURE__ */ jsx(
10634
- "button",
10635
- {
10636
- type: "button",
10637
- onClick: () => {
10638
- window.dispatchEvent(new CustomEvent("toggle-sidebar"));
10639
- },
10640
- className: `kyro-btn p-2.5 rounded-xl transition-all ${sidebarCollapsed ? "" : "text-[var(--kyro-text-secondary)] hover:bg-[var(--kyro-bg-secondary)]"}`,
10641
- title: "Toggle Sidebar",
10642
- children: /* @__PURE__ */ jsxs(
10643
- "svg",
10644
- {
10645
- width: "20",
10646
- height: "20",
10647
- viewBox: "0 0 24 24",
10648
- fill: "none",
10649
- stroke: "currentColor",
10650
- strokeWidth: "2",
10651
- children: [
10652
- /* @__PURE__ */ jsx("rect", { x: "3", y: "3", width: "18", height: "18", rx: "2", ry: "2" }),
10653
- /* @__PURE__ */ jsx("line", { x1: "9", y1: "3", x2: "9", y2: "21" })
10654
- ]
10655
- }
10656
- )
10657
- }
10658
- ),
10659
- /* @__PURE__ */ jsx(
10660
- SplitButton,
10661
- {
10662
- status: documentStatus,
10663
- saveStatus: localSaveStatus,
10664
- hasChanges: hasUnsavedChanges,
10665
- onPublish: handlePublish,
10666
- disabled: localSaveStatus === "saving"
10667
- }
10668
- ),
10669
- !isNew && /* @__PURE__ */ jsxs(
10670
- Dropdown,
10671
- {
10672
- trigger: /* @__PURE__ */ jsx(
10673
- "button",
10674
- {
10675
- type: "button",
10676
- className: "kyro-btn p-2.5 rounded-xl border border-[var(--kyro-border)] hover:bg-[var(--kyro-bg-secondary)] transition-all",
10677
- title: "More actions",
10678
- children: /* @__PURE__ */ jsxs("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "currentColor", children: [
10679
- /* @__PURE__ */ jsx("circle", { cx: "12", cy: "5", r: "1.5" }),
10680
- /* @__PURE__ */ jsx("circle", { cx: "12", cy: "12", r: "1.5" }),
10681
- /* @__PURE__ */ jsx("circle", { cx: "12", cy: "19", r: "1.5" })
10682
- ] })
10683
- }
10684
- ),
10685
- direction: "down",
10686
- children: [
10687
- !globalSlug && /* @__PURE__ */ jsx(
10688
- DropdownItem,
10689
- {
10690
- onClick: handleCreateNew,
10691
- icon: /* @__PURE__ */ jsxs("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
10692
- /* @__PURE__ */ jsx("line", { x1: "12", y1: "5", x2: "12", y2: "19" }),
10693
- /* @__PURE__ */ jsx("line", { x1: "5", y1: "12", x2: "19", y2: "12" })
10694
- ] }),
10695
- children: "Create New"
10696
- }
10697
- ),
10698
- !globalSlug && /* @__PURE__ */ jsx(
10699
- DropdownItem,
10700
- {
10701
- onClick: handleDuplicate,
10702
- icon: /* @__PURE__ */ jsxs("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
10703
- /* @__PURE__ */ jsx("rect", { x: "9", y: "9", width: "13", height: "13", rx: "2", ry: "2" }),
10704
- /* @__PURE__ */ jsx("path", { d: "M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1" })
10705
- ] }),
10706
- children: "Duplicate"
10707
- }
10708
- ),
10709
- /* @__PURE__ */ jsx(
10710
- DropdownItem,
10711
- {
10712
- onClick: () => setShowSchedulePicker(true),
10713
- icon: /* @__PURE__ */ jsxs("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
10714
- /* @__PURE__ */ jsx("rect", { x: "3", y: "4", width: "18", height: "18", rx: "2", ry: "2" }),
10715
- /* @__PURE__ */ jsx("line", { x1: "16", y1: "2", x2: "16", y2: "6" }),
10716
- /* @__PURE__ */ jsx("line", { x1: "8", y1: "2", x2: "8", y2: "6" }),
10717
- /* @__PURE__ */ jsx("line", { x1: "3", y1: "10", x2: "21", y2: "10" })
10718
- ] }),
10719
- children: "Schedule Publish"
10720
- }
10721
- ),
10722
- documentStatus === "published" && /* @__PURE__ */ jsx(
10723
- DropdownItem,
10724
- {
10725
- onClick: handleUnpublish,
10726
- icon: /* @__PURE__ */ jsxs("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
10727
- /* @__PURE__ */ jsx("path", { d: "M17.94 17.94A10.07 10.07 0 0 1 12 20c-7 0-11-8-11-8a18.45 18.45 0 0 1 5.06-5.94M9.9 4.24A9.12 9.12 0 0 1 12 4c7 0 11 8 11 8a18.5 18.5 0 0 1-2.16 3.19m-6.72-1.07a3 3 0 1 1-4.24-4.24" }),
10728
- /* @__PURE__ */ jsx("line", { x1: "1", y1: "1", x2: "23", y2: "23" })
10729
- ] }),
10730
- children: "Unpublish"
10731
- }
10732
- ),
10733
- !globalSlug && /* @__PURE__ */ jsxs(Fragment, { children: [
10734
- /* @__PURE__ */ jsx(DropdownSeparator, {}),
10735
- /* @__PURE__ */ jsx(
10736
- DropdownItem,
10737
- {
10738
- onClick: handleDelete,
10739
- danger: true,
10740
- icon: /* @__PURE__ */ jsxs("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
10741
- /* @__PURE__ */ jsx("polyline", { points: "3 6 5 6 21 6" }),
10742
- /* @__PURE__ */ jsx("path", { d: "M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2" })
10743
- ] }),
10744
- children: "Delete"
10745
- }
10746
- )
10747
- ] })
10748
- ]
10749
- }
10750
- ),
10751
- showSchedulePicker && /* @__PURE__ */ jsx("div", { ref: scheduleRef, className: "relative", children: /* @__PURE__ */ jsxs("div", { className: "absolute right-0 top-2 p-4 rounded-lg border border-[var(--kyro-border)] bg-[var(--kyro-surface)] shadow-2xl z-50", children: [
10752
- /* @__PURE__ */ jsx("p", { className: "text-xs font-medium mb-2", children: "Schedule Publish" }),
10773
+ /* @__PURE__ */ jsxs("header", { className: "hidden md:flex surface-tile px-8 py-6 items-center justify-between sticky top-0 border-b border-[var(--kyro-border)] mb-8 bg-[var(--kyro-surface)] backdrop-blur-md", children: [
10774
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2 min-w-0", children: [
10775
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3 flex-wrap min-w-0", children: [
10753
10776
  /* @__PURE__ */ jsx(
10754
- "input",
10777
+ "a",
10755
10778
  {
10756
- type: "datetime-local",
10757
- id: "schedule-datetime",
10758
- className: "kyro-form-input text-xs mb-3 w-full",
10759
- min: (/* @__PURE__ */ new Date()).toISOString().slice(0, 16)
10779
+ href: `/${collectionSlug}`,
10780
+ className: "p-2 border border-[var(--kyro-border)] rounded-xl hover:bg-[var(--kyro-bg-secondary)] transition-colors shrink-0",
10781
+ children: /* @__PURE__ */ jsx(ChevronRight, { className: "w-4 h-4" })
10760
10782
  }
10761
10783
  ),
10762
- /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 justify-end", children: [
10763
- /* @__PURE__ */ jsx(
10764
- "button",
10765
- {
10766
- type: "button",
10767
- onClick: () => setShowSchedulePicker(false),
10768
- className: "px-3 py-1.5 text-xs kyro-btn rounded-lg",
10769
- children: "Cancel"
10770
- }
10771
- ),
10784
+ /* @__PURE__ */ jsx("h1", { className: "text-xl font-bold tracking-tighter truncate min-w-0", children: docTitle }),
10785
+ /* @__PURE__ */ jsxs("span", { className: `shrink-0 inline-flex items-center gap-1.5 px-2 rounded-full text-[10px] font-regular border ${statusBadgeBg}`, children: [
10786
+ /* @__PURE__ */ jsx("span", { className: `h-1.5 w-1.5 rounded-full ${statusColor}` }),
10787
+ statusLabel
10788
+ ] })
10789
+ ] }),
10790
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-4 text-[11px] font-medium tracking-wide opacity-60 ml-12", children: [
10791
+ renderAutoSaveStatus(false),
10792
+ hasUnsavedChanges && autoSaveStatus !== "saving" && autoSaveStatus !== "retrying" && autoSaveStatus !== "conflict" && /* @__PURE__ */ jsxs(Fragment, { children: [
10793
+ /* @__PURE__ */ jsx("span", { className: "opacity-30", children: "\u2014" }),
10772
10794
  /* @__PURE__ */ jsx(
10773
10795
  "button",
10774
10796
  {
10775
10797
  type: "button",
10776
- onClick: () => {
10777
- const val = document.getElementById("schedule-datetime")?.value;
10778
- if (val) handleSchedulePublish(val);
10798
+ onClick: async () => {
10799
+ setFormData(lastSavedData);
10800
+ markSaved();
10779
10801
  },
10780
- className: "px-3 py-1.5 text-xs kyro-btn-success rounded-lg",
10781
- children: "Schedule"
10802
+ className: "text-[var(--kyro-primary)] hover:underline",
10803
+ children: "Revert changes"
10782
10804
  }
10783
10805
  )
10806
+ ] }),
10807
+ lastSavedAt && autoSaveStatus !== "saving" && autoSaveStatus !== "retrying" && autoSaveStatus !== "success" && /* @__PURE__ */ jsxs("span", { className: "border-l border-[var(--kyro-border)] pl-4", children: [
10808
+ "Draft saved ",
10809
+ (() => {
10810
+ const diffMs = now - lastSavedAt;
10811
+ const diffMin = Math.floor(diffMs / 6e4);
10812
+ const diffSec = Math.floor(diffMs / 1e3);
10813
+ if (diffMin >= 1) return `${diffMin}m ago`;
10814
+ if (diffSec >= 5) return `${diffSec}s ago`;
10815
+ return "just now";
10816
+ })()
10817
+ ] }),
10818
+ /* @__PURE__ */ jsxs("span", { className: "border-l border-[var(--kyro-border)] pl-4", children: [
10819
+ "Modified ",
10820
+ lastModified
10821
+ ] }),
10822
+ /* @__PURE__ */ jsxs("span", { className: "border-l border-[var(--kyro-border)] pl-4", children: [
10823
+ "Created ",
10824
+ createdAt
10784
10825
  ] })
10785
- ] }) })
10786
- ] })
10787
- ] })
10788
- ] });
10789
- };
10790
- const renderEditView = () => {
10791
- if (layout === "single") {
10792
- return /* @__PURE__ */ jsx("div", { className: "w-full space-y-6 md:space-y-8", children: /* @__PURE__ */ jsx("div", { className: "surface-tile p-4 md:p-8 space-y-6 md:space-y-8", children: config.fields.map((f) => renderField(f)) }) });
10793
- }
10794
- const hasSidebarFields = config.fields.some((f) => f.admin?.position === "sidebar") && !showPreview;
10795
- return /* @__PURE__ */ jsxs(
10796
- "div",
10797
- {
10798
- className: `w-full mx-auto grid gap-4 md:gap-8 pb-32 transition-all duration-700 ${showPreview ? "grid-cols-1 lg:grid-cols-2" : sidebarCollapsed || !hasSidebarFields ? "grid-cols-1" : "grid-cols-1 lg:grid-cols-[1fr_380px]"}`,
10826
+ ] })
10827
+ ] }),
10828
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-6", children: [
10829
+ /* @__PURE__ */ jsx("div", { className: "flex items-center gap-1 bg-[var(--kyro-bg-secondary)] p-1 rounded-xl border border-[var(--kyro-border)]", children: ["edit", "version", "api"].map((v) => /* @__PURE__ */ jsx(
10830
+ "button",
10831
+ {
10832
+ type: "button",
10833
+ onClick: () => setView(v),
10834
+ className: `px-5 py-2 text-xs font-bold rounded-lg transition-all ${view === v ? "bg-[var(--kyro-surface)] shadow-sm border border-[var(--kyro-border)] text-[var(--kyro-text-primary)]" : "text-[var(--kyro-text-secondary)] opacity-50 hover:opacity-100"}`,
10835
+ children: v.toUpperCase()
10836
+ },
10837
+ v
10838
+ )) }),
10839
+ /* @__PURE__ */ jsx("div", { className: "h-8 w-px bg-[var(--kyro-border)] mx-2" }),
10840
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3", children: [
10841
+ /* @__PURE__ */ jsxs(
10842
+ "button",
10843
+ {
10844
+ type: "button",
10845
+ onClick: () => setShowPreview(!showPreview),
10846
+ className: `kyro-btn p-2.5 rounded-xl transition-all flex items-center gap-2 ${showPreview ? "shadow-lg" : "text-[var(--kyro-text-secondary)] hover:bg-[var(--kyro-bg-secondary)]"}`,
10847
+ title: "Live Preview",
10848
+ children: [
10849
+ /* @__PURE__ */ jsx(ExternalLink, { className: "w-4 h-4" }),
10850
+ showPreview && /* @__PURE__ */ jsx("span", { className: "text-[10px] font-bold tracking-widest pr-1", children: "Active" })
10851
+ ]
10852
+ }
10853
+ ),
10854
+ /* @__PURE__ */ jsx(
10855
+ "button",
10856
+ {
10857
+ type: "button",
10858
+ onClick: () => {
10859
+ window.dispatchEvent(new CustomEvent("toggle-sidebar"));
10860
+ },
10861
+ className: `kyro-btn p-2.5 rounded-xl transition-all ${sidebarCollapsed ? "" : "text-[var(--kyro-text-secondary)] hover:bg-[var(--kyro-bg-secondary)]"}`,
10862
+ title: "Toggle Sidebar",
10863
+ children: /* @__PURE__ */ jsxs(
10864
+ "svg",
10865
+ {
10866
+ width: "20",
10867
+ height: "20",
10868
+ viewBox: "0 0 24 24",
10869
+ fill: "none",
10870
+ stroke: "currentColor",
10871
+ strokeWidth: "2",
10872
+ children: [
10873
+ /* @__PURE__ */ jsx("rect", { x: "3", y: "3", width: "18", height: "18", rx: "2", ry: "2" }),
10874
+ /* @__PURE__ */ jsx("line", { x1: "9", y1: "3", x2: "9", y2: "21" })
10875
+ ]
10876
+ }
10877
+ )
10878
+ }
10879
+ ),
10880
+ /* @__PURE__ */ jsx(
10881
+ SplitButton,
10882
+ {
10883
+ status: documentStatus,
10884
+ saveStatus: localSaveStatus,
10885
+ hasChanges: hasUnsavedChanges,
10886
+ onPublish: handlePublish,
10887
+ disabled: localSaveStatus === "saving"
10888
+ }
10889
+ ),
10890
+ renderKebabMenu(),
10891
+ renderSchedulePicker()
10892
+ ] })
10893
+ ] })
10894
+ ] })
10895
+ ] });
10896
+ };
10897
+ const renderEditView = () => {
10898
+ if (layout === "single") {
10899
+ return /* @__PURE__ */ jsx("div", { className: "w-full space-y-6 md:space-y-8", children: /* @__PURE__ */ jsx("div", { className: "surface-tile p-4 md:p-8 space-y-6 md:space-y-8", children: config.fields.map((f) => renderField(f)) }) });
10900
+ }
10901
+ const hasSidebarFields = config.fields.some((f) => f.admin?.position === "sidebar") && !showPreview;
10902
+ return /* @__PURE__ */ jsxs(
10903
+ "div",
10904
+ {
10905
+ className: `w-full mx-auto grid gap-4 md:gap-8 pb-32 transition-all duration-700 ${showPreview ? "grid-cols-1 lg:grid-cols-2" : sidebarCollapsed || !hasSidebarFields ? "grid-cols-1" : "grid-cols-1 lg:grid-cols-[1fr_380px]"}`,
10799
10906
  children: [
10800
10907
  /* @__PURE__ */ jsx("div", { className: "space-y-6 md:space-y-8 animate-in fade-in slide-in-from-left-4 duration-500", children: config.tabs ? renderField({ type: "tabs", tabs: config.tabs }) : /* @__PURE__ */ jsx("div", { className: "surface-tile p-4 md:p-8 space-y-6 md:space-y-8", children: config.fields.filter(
10801
10908
  (f) => !f.admin?.position || f.admin.position === "main"
@@ -10814,27 +10921,18 @@ function AutoForm({
10814
10921
  }
10815
10922
  ),
10816
10923
  /* @__PURE__ */ jsx("div", { className: "absolute inset-0 bg-transparent pointer-events-none border-[12px] border-[var(--kyro-surface)] rounded-3xl" })
10817
- ] }) }) : sidebarCollapsed ? null : /* @__PURE__ */ jsx("div", { className: "space-y-4 md:space-y-6 animate-in fade-in slide-in-from-right-4 duration-500", children: config.fields.some((f) => f.admin?.position === "sidebar") && /* @__PURE__ */ jsxs(Fragment, { children: [
10818
- /* @__PURE__ */ jsxs("div", { className: "hidden lg:block surface-tile p-6 space-y-6", children: [
10819
- /* @__PURE__ */ jsx("h3", { className: "text-[10px] font-bold tracking-[0.2em] opacity-40", children: "Settings" }),
10820
- config.fields.filter((f) => f.admin?.position === "sidebar").map((f) => renderField(f))
10821
- ] }),
10822
- /* @__PURE__ */ jsxs("details", { className: "lg:hidden surface-tile p-4 space-y-4 group", children: [
10823
- /* @__PURE__ */ jsxs("summary", { className: "cursor-pointer font-semibold text-xs tracking-widest opacity-40 text-[var(--kyro-text-secondary)] select-none flex items-center gap-2", children: [
10824
- /* @__PURE__ */ jsx("svg", { className: "w-3 h-3 transition-transform group-open:rotate-90", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ jsx("path", { d: "M9 18l6-6-6-6" }) }),
10825
- "Settings"
10826
- ] }),
10827
- /* @__PURE__ */ jsx("div", { className: "space-y-4 pt-4 border-t border-[var(--kyro-border)]", children: config.fields.filter((f) => f.admin?.position === "sidebar").map((f) => renderField(f)) })
10828
- ] })
10924
+ ] }) }) : sidebarCollapsed ? null : /* @__PURE__ */ jsx("div", { className: "space-y-4 md:space-y-6 animate-in fade-in slide-in-from-right-4 duration-500", children: config.fields.some((f) => f.admin?.position === "sidebar") && /* @__PURE__ */ jsxs("div", { className: "surface-tile p-4 md:p-6 space-y-4 md:space-y-6", children: [
10925
+ /* @__PURE__ */ jsx("h3", { className: "text-[10px] font-bold tracking-[0.2em] opacity-40", children: "Settings" }),
10926
+ config.fields.filter((f) => f.admin?.position === "sidebar").map((f) => renderField(f))
10829
10927
  ] }) })
10830
10928
  ]
10831
10929
  }
10832
10930
  );
10833
10931
  };
10834
10932
  const renderVersionView = () => /* @__PURE__ */ jsx("div", { className: "w-full animate-in fade-in slide-in-from-bottom-4 pb-12", children: /* @__PURE__ */ jsxs("div", { className: "surface-tile p-0 overflow-hidden", children: [
10835
- /* @__PURE__ */ jsxs("div", { className: "px-6 py-4 border-b border-[var(--kyro-border)] flex items-center justify-between", children: [
10933
+ /* @__PURE__ */ jsxs("div", { className: "px-4 md:px-6 py-3 md:py-4 border-b border-[var(--kyro-border)] flex flex-col md:flex-row md:items-center justify-between gap-2", children: [
10836
10934
  /* @__PURE__ */ jsxs("div", { children: [
10837
- /* @__PURE__ */ jsx("h2", { className: "text-lg font-bold text-[var(--kyro-text-primary)]", children: "Version History" }),
10935
+ /* @__PURE__ */ jsx("h2", { className: "text-base md:text-lg font-bold text-[var(--kyro-text-primary)]", children: "Version History" }),
10838
10936
  /* @__PURE__ */ jsx("p", { className: "text-[11px] text-[var(--kyro-text-muted)] mt-0.5", children: compareMode ? `Select 2 versions \xB7 ${compareSelected.length}/2 chosen` : `${versions.length} snapshot${versions.length !== 1 ? "s" : ""} \xB7 Auto-saved` })
10839
10937
  ] }),
10840
10938
  /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
@@ -10883,11 +10981,14 @@ function AutoForm({
10883
10981
  /* @__PURE__ */ jsx("div", { className: "max-h-[400px] overflow-y-auto", children: compareDiffs.map((d, i) => /* @__PURE__ */ jsxs(
10884
10982
  "div",
10885
10983
  {
10886
- className: "grid grid-cols-4 gap-3 px-6 py-2.5 text-[11px] font-mono border-t border-[var(--kyro-border)] hover:bg-[var(--kyro-bg-secondary)]",
10984
+ className: "flex flex-col md:grid md:grid-cols-4 gap-1 md:gap-3 px-4 md:px-6 py-2.5 text-[11px] font-mono border-t border-[var(--kyro-border)] hover:bg-[var(--kyro-bg-secondary)]",
10887
10985
  children: [
10888
- /* @__PURE__ */ jsx("div", { className: "text-[var(--kyro-text-muted)] truncate", children: d.field }),
10889
- /* @__PURE__ */ jsx("div", { className: "text-[var(--kyro-text-muted)] truncate", children: typeof d.oldValue === "object" ? JSON.stringify(d.oldValue) : String(d.oldValue ?? "null") }),
10890
- /* @__PURE__ */ jsx("div", { className: "col-span-2 text-[var(--kyro-text-primary)] truncate", children: typeof d.newValue === "object" ? JSON.stringify(d.newValue) : String(d.newValue ?? "null") })
10986
+ /* @__PURE__ */ jsx("div", { className: "text-[var(--kyro-text-muted)] truncate font-semibold md:font-normal", children: d.field }),
10987
+ /* @__PURE__ */ jsx("div", { className: "text-[var(--kyro-text-muted)] truncate hidden md:block", children: typeof d.oldValue === "object" ? JSON.stringify(d.oldValue) : String(d.oldValue ?? "null") }),
10988
+ /* @__PURE__ */ jsxs("div", { className: "md:col-span-2 text-[var(--kyro-text-primary)] truncate", children: [
10989
+ /* @__PURE__ */ jsx("span", { className: "md:hidden text-[var(--kyro-text-muted)]", children: "\u2192 " }),
10990
+ typeof d.newValue === "object" ? JSON.stringify(d.newValue) : String(d.newValue ?? "null")
10991
+ ] })
10891
10992
  ]
10892
10993
  },
10893
10994
  i
@@ -10895,58 +10996,108 @@ function AutoForm({
10895
10996
  ] }),
10896
10997
  loadingVersions ? /* @__PURE__ */ jsx("div", { className: "flex justify-center py-16", children: /* @__PURE__ */ jsx("span", { className: "animate-spin text-[var(--kyro-primary)]", children: "\u231B" }) }) : versions.length === 0 ? /* @__PURE__ */ jsx("div", { className: "text-center py-16 text-[var(--kyro-text-muted)] text-sm italic", children: "No versions yet." }) : /* @__PURE__ */ jsx("div", { className: "divide-y divide-[var(--kyro-border)]", children: versions.map((v, i) => {
10897
10998
  const isSelected = compareSelected.includes(v.id);
10898
- const isDraftVersion = v.status === "draft";
10999
+ v.status === "draft";
10899
11000
  const isAutoSaved = (v.changeDescription || "").toLowerCase().includes("auto");
10900
11001
  return /* @__PURE__ */ jsxs(
10901
11002
  "div",
10902
11003
  {
10903
11004
  onClick: compareMode ? () => toggleCompareSelection(v.id) : void 0,
10904
- className: `grid grid-cols-12 gap-3 px-6 py-3 items-center transition-all ${compareMode ? isSelected ? "bg-[var(--kyro-primary)]/5 cursor-pointer" : "hover:bg-[var(--kyro-bg-secondary)] cursor-pointer" : "hover:bg-[var(--kyro-bg-secondary)]"} ${isDraftVersion ? "" : ""}`,
11005
+ className: `transition-all ${compareMode ? isSelected ? "bg-[var(--kyro-primary)]/5 cursor-pointer" : "hover:bg-[var(--kyro-bg-secondary)] cursor-pointer" : "hover:bg-[var(--kyro-bg-secondary)]"}`,
10905
11006
  children: [
10906
- /* @__PURE__ */ jsx("div", { className: "col-span-1 flex items-center gap-2", children: compareMode ? /* @__PURE__ */ jsx(
10907
- "div",
10908
- {
10909
- className: `w-4 h-4 rounded-full border ${isSelected ? "border-[var(--kyro-primary)] bg-[var(--kyro-primary)]" : "border-[var(--kyro-border)]"}`,
10910
- children: isSelected && /* @__PURE__ */ jsx(Check, { className: "w-4 h-4" })
10911
- }
10912
- ) : /* @__PURE__ */ jsx("span", { className: "text-[10px] font-bold text-[var(--kyro-text-muted)] w-5", children: versions.length - i }) }),
10913
- /* @__PURE__ */ jsxs("div", { className: "col-span-4 min-w-0", children: [
10914
- /* @__PURE__ */ jsxs("div", { className: "text-[13px] font-medium text-[var(--kyro-text-primary)] truncate flex items-center gap-2", children: [
10915
- v.changeDescription || "Snapshot",
10916
- isAutoSaved && /* @__PURE__ */ jsx("span", { className: "text-[9px] px-1.5 py-0.5 bg-[var(--kyro-bg-secondary)] text-[var(--kyro-text-secondary)] rounded font-bold tracking-wider", children: "Auto" })
11007
+ /* @__PURE__ */ jsxs("div", { className: "hidden md:grid grid-cols-12 gap-3 px-6 py-3 items-center", children: [
11008
+ /* @__PURE__ */ jsx("div", { className: "col-span-1 flex items-center gap-2", children: compareMode ? /* @__PURE__ */ jsx(
11009
+ "div",
11010
+ {
11011
+ className: `w-4 h-4 rounded-full border ${isSelected ? "border-[var(--kyro-primary)] bg-[var(--kyro-primary)]" : "border-[var(--kyro-border)]"}`,
11012
+ children: isSelected && /* @__PURE__ */ jsx(Check, { className: "w-4 h-4" })
11013
+ }
11014
+ ) : /* @__PURE__ */ jsx("span", { className: "text-[10px] font-bold text-[var(--kyro-text-muted)] w-5", children: versions.length - i }) }),
11015
+ /* @__PURE__ */ jsxs("div", { className: "col-span-4 min-w-0", children: [
11016
+ /* @__PURE__ */ jsxs("div", { className: "text-[13px] font-medium text-[var(--kyro-text-primary)] truncate flex items-center gap-2", children: [
11017
+ v.changeDescription || "Snapshot",
11018
+ isAutoSaved && /* @__PURE__ */ jsx("span", { className: "text-[9px] px-1.5 py-0.5 bg-[var(--kyro-bg-secondary)] text-[var(--kyro-text-secondary)] rounded font-bold tracking-wider", children: "Auto" })
11019
+ ] }),
11020
+ /* @__PURE__ */ jsx("div", { className: "text-[11px] text-[var(--kyro-text-muted)]", children: new Date(v.createdAt).toLocaleString("en-US", {
11021
+ month: "short",
11022
+ day: "numeric",
11023
+ hour: "2-digit",
11024
+ minute: "2-digit"
11025
+ }) })
10917
11026
  ] }),
10918
- /* @__PURE__ */ jsx("div", { className: "text-[11px] text-[var(--kyro-text-muted)]", children: new Date(v.createdAt).toLocaleString("en-US", {
10919
- month: "short",
10920
- day: "numeric",
10921
- hour: "2-digit",
10922
- minute: "2-digit"
10923
- }) })
11027
+ /* @__PURE__ */ jsx("div", { className: "col-span-3", children: v.status && /* @__PURE__ */ jsxs(
11028
+ "span",
11029
+ {
11030
+ className: `inline-flex items-center gap-1 px-2 py-0.5 rounded text-[10px] font-bold capitalize tracking-wider ${v.status === "published" ? " text-[var(--kyro-success)]" : " text-[var(--kyro-warning)]"}`,
11031
+ children: [
11032
+ /* @__PURE__ */ jsx(
11033
+ "span",
11034
+ {
11035
+ className: `w-1.5 h-1.5 rounded-full ${v.status === "published" ? "bg-[var(--kyro-success)]" : "bg-[var(--kyro-warning)]"}`
11036
+ }
11037
+ ),
11038
+ v.status
11039
+ ]
11040
+ }
11041
+ ) }),
11042
+ /* @__PURE__ */ jsx("div", { className: "col-span-2 text-[11px] text-[var(--kyro-text-muted)]", children: v.createdBy || "system" }),
11043
+ /* @__PURE__ */ jsx("div", { className: "col-span-2 flex justify-end", children: !compareMode && /* @__PURE__ */ jsx(
11044
+ "button",
11045
+ {
11046
+ type: "button",
11047
+ onClick: () => handleRestoreVersion(v.id),
11048
+ className: "px-3 py-1.5 rounded-lg border border-[var(--kyro-border)] text-[11px] font-bold tracking-wider text-[var(--kyro-text-secondary)] hover:text-[var(--kyro-text-primary)] hover:border-[var(--kyro-primary)] transition-all active:scale-95",
11049
+ children: "Restore"
11050
+ }
11051
+ ) })
10924
11052
  ] }),
10925
- /* @__PURE__ */ jsx("div", { className: "col-span-3", children: v.status && /* @__PURE__ */ jsxs(
10926
- "span",
10927
- {
10928
- className: `inline-flex items-center gap-1 px-2 py-0.5 rounded text-[10px] font-bold capitalize tracking-wider ${v.status === "published" ? " text-[var(--kyro-success)]" : " text-[var(--kyro-warning)]"}`,
10929
- children: [
10930
- /* @__PURE__ */ jsx(
11053
+ /* @__PURE__ */ jsxs("div", { className: "md:hidden flex items-start gap-3 px-4 py-3", children: [
11054
+ /* @__PURE__ */ jsx("div", { className: "pt-0.5 shrink-0", children: compareMode ? /* @__PURE__ */ jsx(
11055
+ "div",
11056
+ {
11057
+ className: `w-4 h-4 rounded-full border ${isSelected ? "border-[var(--kyro-primary)] bg-[var(--kyro-primary)]" : "border-[var(--kyro-border)]"}`,
11058
+ children: isSelected && /* @__PURE__ */ jsx(Check, { className: "w-4 h-4" })
11059
+ }
11060
+ ) : /* @__PURE__ */ jsx("span", { className: "text-[10px] font-bold text-[var(--kyro-text-muted)] w-5 inline-block text-center", children: versions.length - i }) }),
11061
+ /* @__PURE__ */ jsxs("div", { className: "flex-1 min-w-0", children: [
11062
+ /* @__PURE__ */ jsxs("div", { className: "text-[13px] font-medium text-[var(--kyro-text-primary)] truncate flex items-center gap-1.5", children: [
11063
+ v.changeDescription || "Snapshot",
11064
+ isAutoSaved && /* @__PURE__ */ jsx("span", { className: "text-[9px] px-1 py-0.5 bg-[var(--kyro-bg-secondary)] text-[var(--kyro-text-secondary)] rounded font-bold tracking-wider shrink-0", children: "Auto" })
11065
+ ] }),
11066
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 mt-1 flex-wrap", children: [
11067
+ /* @__PURE__ */ jsx("span", { className: "text-[11px] text-[var(--kyro-text-muted)]", children: new Date(v.createdAt).toLocaleString("en-US", {
11068
+ month: "short",
11069
+ day: "numeric",
11070
+ hour: "2-digit",
11071
+ minute: "2-digit"
11072
+ }) }),
11073
+ v.status && /* @__PURE__ */ jsxs(
10931
11074
  "span",
10932
11075
  {
10933
- className: `w-1.5 h-1.5 rounded-full ${v.status === "published" ? "bg-[var(--kyro-success)]" : "bg-[var(--kyro-warning)]"}`
11076
+ className: `inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-[9px] font-bold capitalize tracking-wider ${v.status === "published" ? "text-[var(--kyro-success)]" : "text-[var(--kyro-warning)]"}`,
11077
+ children: [
11078
+ /* @__PURE__ */ jsx(
11079
+ "span",
11080
+ {
11081
+ className: `w-1 h-1 rounded-full ${v.status === "published" ? "bg-[var(--kyro-success)]" : "bg-[var(--kyro-warning)]"}`
11082
+ }
11083
+ ),
11084
+ v.status
11085
+ ]
10934
11086
  }
10935
11087
  ),
10936
- v.status
10937
- ]
10938
- }
10939
- ) }),
10940
- /* @__PURE__ */ jsx("div", { className: "col-span-2 text-[11px] text-[var(--kyro-text-muted)]", children: v.createdBy || "system" }),
10941
- /* @__PURE__ */ jsx("div", { className: "col-span-2 flex justify-end", children: !compareMode && /* @__PURE__ */ jsx(
10942
- "button",
10943
- {
10944
- type: "button",
10945
- onClick: () => handleRestoreVersion(v.id),
10946
- className: "px-3 py-1.5 rounded-lg border border-[var(--kyro-border)] text-[11px] font-bold tracking-wider text-[var(--kyro-text-secondary)] kyro-btn-primary hover:border-[var(--kyro-primary)] transition-all active:scale-95",
10947
- children: "Restore"
10948
- }
10949
- ) })
11088
+ /* @__PURE__ */ jsx("span", { className: "text-[10px] text-[var(--kyro-text-muted)] opacity-60", children: v.createdBy || "system" })
11089
+ ] })
11090
+ ] }),
11091
+ !compareMode && /* @__PURE__ */ jsx(
11092
+ "button",
11093
+ {
11094
+ type: "button",
11095
+ onClick: () => handleRestoreVersion(v.id),
11096
+ className: "shrink-0 px-2.5 py-1 rounded-lg border border-[var(--kyro-border)] text-[10px] font-bold tracking-wider text-[var(--kyro-text-secondary)] hover:text-[var(--kyro-text-primary)] hover:border-[var(--kyro-primary)] transition-all active:scale-95",
11097
+ children: "Restore"
11098
+ }
11099
+ )
11100
+ ] })
10950
11101
  ]
10951
11102
  },
10952
11103
  v.id
@@ -11084,6 +11235,12 @@ function AutoForm({
11084
11235
  ] })
11085
11236
  ] });
11086
11237
  }
11238
+ var STATUS_DOT = {
11239
+ draft: "bg-[var(--kyro-warning)]",
11240
+ published: "bg-[var(--kyro-success)]",
11241
+ scheduled: "bg-[var(--kyro-primary)]",
11242
+ archived: "bg-[var(--kyro-text-muted)]"
11243
+ };
11087
11244
  function ActionBar({
11088
11245
  status,
11089
11246
  saveStatus,
@@ -11102,314 +11259,147 @@ function ActionBar({
11102
11259
  }) {
11103
11260
  const view = useAutoFormStore((s) => s.view) || "edit";
11104
11261
  const setView = useAutoFormStore((s) => s.setView);
11262
+ const [moreOpen, setMoreOpen] = useState(false);
11263
+ const moreRef = useRef(null);
11264
+ useEffect(() => {
11265
+ const handleClick = (e) => {
11266
+ if (moreRef.current && !moreRef.current.contains(e.target)) setMoreOpen(false);
11267
+ };
11268
+ document.addEventListener("mousedown", handleClick);
11269
+ return () => document.removeEventListener("mousedown", handleClick);
11270
+ }, []);
11105
11271
  const getSaveStatusText = () => {
11106
11272
  if (saveStatus === "saving") return "Saving...";
11107
11273
  if (saveStatus === "saved") return "Saved";
11108
11274
  if (saveStatus === "error") return "Error saving";
11109
- if (hasChanges) return "Unsaved changes";
11275
+ if (hasChanges) return "Unsaved";
11110
11276
  return null;
11111
11277
  };
11112
- const getStatusBadge = () => {
11113
- const statusConfig2 = {
11114
- draft: {
11115
- label: "Draft",
11116
- class: "bg-gray-100 text-gray-600 border-gray-200",
11117
- icon: /* @__PURE__ */ jsx(Plus, { className: "w-3 h-3" })
11118
- },
11119
- published: {
11120
- label: "Published",
11121
- class: "bg-green-100 text-green-700 border-green-200",
11122
- icon: /* @__PURE__ */ jsx(Send, { className: "w-3 h-3" })
11123
- },
11124
- scheduled: {
11125
- label: "Scheduled",
11126
- class: "bg-blue-100 text-blue-700 border-blue-200",
11127
- icon: /* @__PURE__ */ jsx(Clock, { className: "w-3 h-3" })
11128
- },
11129
- archived: {
11130
- label: "Archived",
11131
- class: "bg-yellow-100 text-yellow-700 border-yellow-200",
11132
- icon: /* @__PURE__ */ jsx(Archive, { className: "w-3 h-3" })
11133
- }
11134
- };
11135
- const config = statusConfig2[status];
11136
- return /* @__PURE__ */ jsxs(
11137
- "span",
11278
+ const tabs = ["edit", "version", "api"];
11279
+ const saveText = getSaveStatusText();
11280
+ const iconBtnClass = "p-1.5 rounded-lg hover:bg-[var(--kyro-surface-accent)] text-[var(--kyro-text-muted)] hover:text-[var(--kyro-text-primary)] transition-all shrink-0";
11281
+ return /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1 px-2 py-1.5 bg-[var(--kyro-surface)] border-b border-[var(--kyro-border)] w-full overflow-x-auto", children: [
11282
+ onBack && /* @__PURE__ */ jsx("button", { type: "button", onClick: onBack, className: "p-1 rounded-lg hover:bg-[var(--kyro-surface-accent)] text-[var(--kyro-text-secondary)] transition-all shrink-0", children: /* @__PURE__ */ jsx("svg", { className: "w-4 h-4", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.5", children: /* @__PURE__ */ jsx("path", { d: "M19 12H5M12 19l-7-7 7-7" }) }) }),
11283
+ /* @__PURE__ */ jsx("div", { className: `w-2 h-2 rounded-full shrink-0 ${STATUS_DOT[status] || "bg-[var(--kyro-text-muted)]"}` }),
11284
+ saveText && /* @__PURE__ */ jsxs("span", { className: `text-[10px] whitespace-nowrap max-md:hidden ${saveStatus === "error" ? "text-[var(--kyro-error)]" : "text-[var(--kyro-text-muted)]"}`, children: [
11285
+ saveStatus === "saving" && /* @__PURE__ */ jsx(Spinner, { size: "sm", className: "inline mr-0.5" }),
11286
+ saveText
11287
+ ] }),
11288
+ /* @__PURE__ */ jsx("div", { className: "flex items-center gap-0.5 bg-[var(--kyro-bg-secondary)] p-0.5 rounded-lg border border-[var(--kyro-border)] shrink-0 max-md:hidden", children: tabs.map((v) => /* @__PURE__ */ jsx(
11289
+ "button",
11138
11290
  {
11139
- className: `inline-flex items-center gap-1.5 px-2.5 py-1 rounded-full text-xs font-semibold border ${config.class}`,
11140
- children: [
11141
- config.icon,
11142
- config.label
11143
- ]
11144
- }
11145
- );
11146
- };
11147
- const formatDate2 = (dateStr) => {
11148
- if (!dateStr) return "Never";
11149
- return new Date(dateStr).toLocaleString();
11150
- };
11151
- return /* @__PURE__ */ jsxs(Fragment, { children: [
11152
- /* @__PURE__ */ jsxs("div", { className: "md:hidden flex flex-col gap-3 py-3 px-4 bg-[var(--kyro-bg)] border-t border-[var(--kyro-border)]", children: [
11153
- /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1", children: [
11154
- onBack && /* @__PURE__ */ jsx(
11155
- "button",
11156
- {
11157
- type: "button",
11158
- onClick: onBack,
11159
- className: "p-2 rounded-lg hover:bg-[var(--kyro-surface-accent)] text-[var(--kyro-text-secondary)] transition-all",
11160
- children: /* @__PURE__ */ jsx("svg", { className: "w-4 h-4", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.5", children: /* @__PURE__ */ jsx("path", { d: "M19 12H5M12 19l-7-7 7-7" }) })
11161
- }
11162
- ),
11163
- /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1 ml-auto", children: [
11164
- onPreview && /* @__PURE__ */ jsx(
11165
- "button",
11166
- {
11167
- type: "button",
11168
- onClick: onPreview,
11169
- className: "p-2 rounded-lg hover:bg-[var(--kyro-surface-accent)] text-[var(--kyro-text-secondary)] transition-all",
11170
- title: "Preview",
11171
- children: /* @__PURE__ */ jsx(Eye, { className: "w-4 h-4" })
11172
- }
11173
- ),
11174
- onViewHistory && /* @__PURE__ */ jsx(
11175
- "button",
11176
- {
11177
- type: "button",
11178
- onClick: onViewHistory,
11179
- className: "p-2 rounded-lg hover:bg-[var(--kyro-surface-accent)] text-[var(--kyro-text-secondary)] transition-all",
11180
- title: "View History",
11181
- children: /* @__PURE__ */ jsx(Clock, { className: "w-4 h-4" })
11182
- }
11183
- ),
11184
- onDuplicate && /* @__PURE__ */ jsx(
11185
- "button",
11186
- {
11187
- type: "button",
11188
- onClick: onDuplicate,
11189
- className: "p-2 rounded-lg hover:bg-[var(--kyro-surface-accent)] text-[var(--kyro-text-secondary)] transition-all",
11190
- title: "Duplicate",
11191
- children: /* @__PURE__ */ jsx(Copy, { className: "w-4 h-4" })
11192
- }
11193
- ),
11194
- onDelete && /* @__PURE__ */ jsx(
11195
- "button",
11196
- {
11197
- type: "button",
11198
- onClick: onDelete,
11199
- className: "p-2 rounded-lg hover:bg-[var(--kyro-danger-bg)] text-[var(--kyro-error)] transition-all",
11200
- title: "Delete",
11201
- children: /* @__PURE__ */ jsx(Trash2, { className: "w-4 h-4" })
11202
- }
11203
- ),
11204
- onToggleSidebar && /* @__PURE__ */ jsx(
11291
+ type: "button",
11292
+ onClick: () => setView(v),
11293
+ className: `px-2.5 py-1 text-[11px] font-semibold rounded-md transition-all ${view === v ? "bg-[var(--kyro-surface)] shadow-sm border border-[var(--kyro-border)] text-[var(--kyro-text-primary)]" : "text-[var(--kyro-text-secondary)] hover:text-[var(--kyro-text-primary)]"}`,
11294
+ children: v === "edit" ? "Edit" : v === "version" ? "Ver" : "API"
11295
+ },
11296
+ v
11297
+ )) }),
11298
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1 ml-auto shrink-0", children: [
11299
+ onPreview && /* @__PURE__ */ jsx("button", { type: "button", onClick: onPreview, className: `${iconBtnClass} max-md:hidden`, title: "Preview", children: /* @__PURE__ */ jsx(Eye, { className: "w-3.5 h-3.5" }) }),
11300
+ onViewHistory && /* @__PURE__ */ jsx("button", { type: "button", onClick: onViewHistory, className: `${iconBtnClass} max-md:hidden`, title: "View History", children: /* @__PURE__ */ jsx(Clock, { className: "w-3.5 h-3.5" }) }),
11301
+ onDuplicate && /* @__PURE__ */ jsx("button", { type: "button", onClick: onDuplicate, className: `${iconBtnClass} max-md:hidden`, title: "Duplicate", children: /* @__PURE__ */ jsx(Copy, { className: "w-3.5 h-3.5" }) }),
11302
+ onDelete && /* @__PURE__ */ jsx("button", { type: "button", onClick: onDelete, className: `${iconBtnClass} hover:bg-[var(--kyro-danger-bg)] hover:text-[var(--kyro-danger)] max-md:hidden`, title: "Delete", children: /* @__PURE__ */ jsx(Trash2, { className: "w-3.5 h-3.5" }) }),
11303
+ onToggleSidebar && /* @__PURE__ */ jsx("button", { type: "button", onClick: onToggleSidebar, className: `${iconBtnClass} max-md:hidden`, title: "Toggle Sidebar", children: /* @__PURE__ */ jsxs("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
11304
+ /* @__PURE__ */ jsx("rect", { x: "3", y: "3", width: "18", height: "18", rx: "2", ry: "2" }),
11305
+ /* @__PURE__ */ jsx("line", { x1: "9", y1: "3", x2: "9", y2: "21" })
11306
+ ] }) }),
11307
+ /* @__PURE__ */ jsxs("div", { ref: moreRef, className: "relative md:hidden", children: [
11308
+ /* @__PURE__ */ jsx("button", { type: "button", onClick: () => setMoreOpen(!moreOpen), className: iconBtnClass, title: "More", children: /* @__PURE__ */ jsx(EllipsisVertical, { className: "w-3.5 h-3.5" }) }),
11309
+ moreOpen && /* @__PURE__ */ jsxs("div", { className: "absolute right-0 top-full mt-1 w-48 bg-[var(--kyro-surface)] border border-[var(--kyro-border)] rounded-lg shadow-xl z-50 py-1 max-h-[70vh] overflow-y-auto", children: [
11310
+ saveText && /* @__PURE__ */ jsxs("div", { className: "px-3 py-2 text-[10px] text-[var(--kyro-text-muted)] border-b border-[var(--kyro-border)] flex items-center gap-1.5", children: [
11311
+ /* @__PURE__ */ jsx("div", { className: `w-1.5 h-1.5 rounded-full ${STATUS_DOT[status]}` }),
11312
+ /* @__PURE__ */ jsx("span", { className: "capitalize", children: status }),
11313
+ /* @__PURE__ */ jsx("span", { children: "\xB7" }),
11314
+ saveStatus === "saving" && /* @__PURE__ */ jsx(Spinner, { size: "sm", className: "inline" }),
11315
+ /* @__PURE__ */ jsx("span", { children: saveText })
11316
+ ] }),
11317
+ /* @__PURE__ */ jsx("div", { className: "flex gap-1 px-2 py-2 border-b border-[var(--kyro-border)]", children: tabs.map((v) => /* @__PURE__ */ jsx(
11205
11318
  "button",
11206
11319
  {
11207
11320
  type: "button",
11208
- onClick: onToggleSidebar,
11209
- className: "p-2 rounded-lg hover:bg-[var(--kyro-surface-accent)] text-[var(--kyro-text-secondary)] transition-all",
11210
- title: "Toggle Sidebar",
11211
- children: /* @__PURE__ */ jsxs("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
11212
- /* @__PURE__ */ jsx("rect", { x: "3", y: "3", width: "18", height: "18", rx: "2", ry: "2" }),
11213
- /* @__PURE__ */ jsx("line", { x1: "9", y1: "3", x2: "9", y2: "21" })
11214
- ] })
11215
- }
11216
- )
11321
+ onClick: () => {
11322
+ setView(v);
11323
+ setMoreOpen(false);
11324
+ },
11325
+ className: `px-2.5 py-1 text-[11px] font-semibold rounded-md transition-all flex-1 ${view === v ? "bg-[var(--kyro-primary)] text-white" : "text-[var(--kyro-text-muted)] hover:text-[var(--kyro-text-primary)]"}`,
11326
+ children: v === "edit" ? "Edit" : v === "version" ? "Ver" : "API"
11327
+ },
11328
+ v
11329
+ )) }),
11330
+ onViewHistory && /* @__PURE__ */ jsxs("button", { type: "button", onClick: () => {
11331
+ onViewHistory();
11332
+ setMoreOpen(false);
11333
+ }, className: "w-full flex items-center gap-2 px-3 py-2 text-xs text-[var(--kyro-text-primary)] hover:bg-[var(--kyro-surface-accent)] transition-colors", children: [
11334
+ /* @__PURE__ */ jsx(Clock, { className: "w-3.5 h-3.5" }),
11335
+ " View History"
11336
+ ] }),
11337
+ onDuplicate && /* @__PURE__ */ jsxs("button", { type: "button", onClick: () => {
11338
+ onDuplicate();
11339
+ setMoreOpen(false);
11340
+ }, className: "w-full flex items-center gap-2 px-3 py-2 text-xs text-[var(--kyro-text-primary)] hover:bg-[var(--kyro-surface-accent)] transition-colors", children: [
11341
+ /* @__PURE__ */ jsx(Copy, { className: "w-3.5 h-3.5" }),
11342
+ " Duplicate"
11343
+ ] }),
11344
+ onPreview && /* @__PURE__ */ jsxs("button", { type: "button", onClick: () => {
11345
+ onPreview();
11346
+ setMoreOpen(false);
11347
+ }, className: "w-full flex items-center gap-2 px-3 py-2 text-xs text-[var(--kyro-text-primary)] hover:bg-[var(--kyro-surface-accent)] transition-colors", children: [
11348
+ /* @__PURE__ */ jsx(Eye, { className: "w-3.5 h-3.5" }),
11349
+ " Preview"
11350
+ ] }),
11351
+ onDelete && /* @__PURE__ */ jsx("div", { className: "border-t border-[var(--kyro-border)] mt-1 pt-1", children: /* @__PURE__ */ jsxs("button", { type: "button", onClick: () => {
11352
+ onDelete();
11353
+ setMoreOpen(false);
11354
+ }, className: "w-full flex items-center gap-2 px-3 py-2 text-xs text-[var(--kyro-danger)] hover:bg-[var(--kyro-danger-bg)] transition-colors", children: [
11355
+ /* @__PURE__ */ jsx(Trash2, { className: "w-3.5 h-3.5" }),
11356
+ " Delete"
11357
+ ] }) })
11217
11358
  ] })
11218
11359
  ] }),
11219
- /* @__PURE__ */ jsx("div", { className: "flex items-center gap-1 bg-[var(--kyro-bg-secondary)] p-0.5 rounded-lg border border-[var(--kyro-border)] self-start", children: ["edit", "version", "api"].map((v) => /* @__PURE__ */ jsx(
11360
+ /* @__PURE__ */ jsx("div", { className: "h-4 w-px bg-[var(--kyro-border)] mx-0.5" }),
11361
+ status === "draft" && onPublish && /* @__PURE__ */ jsxs(
11220
11362
  "button",
11221
11363
  {
11222
11364
  type: "button",
11223
- onClick: () => setView(v),
11224
- className: `px-4 py-1.5 text-xs font-bold rounded-md transition-all ${view === v ? "bg-[var(--kyro-surface)] shadow-sm border border-[var(--kyro-border)] text-[var(--kyro-text-primary)]" : "text-[var(--kyro-text-secondary)] opacity-50 hover:opacity-100"}`,
11225
- children: v === "edit" ? "Edit" : v === "version" ? "Version" : "API"
11226
- },
11227
- v
11228
- )) }),
11229
- /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 flex-wrap", children: [
11230
- getStatusBadge(),
11231
- getSaveStatusText() && /* @__PURE__ */ jsxs(
11232
- "span",
11233
- {
11234
- className: `text-xs ${saveStatus === "error" ? "text-[var(--kyro-error)]" : "text-[var(--kyro-text-muted)]"}`,
11235
- children: [
11236
- saveStatus === "saving" ? /* @__PURE__ */ jsx(Spinner, { size: "sm", className: "inline mr-1" }) : null,
11237
- getSaveStatusText()
11238
- ]
11239
- }
11240
- ),
11241
- /* @__PURE__ */ jsxs("span", { className: "text-[10px] text-[var(--kyro-text-muted)] ml-auto", children: [
11242
- updatedAt && `Updated ${formatDate2(updatedAt)}`,
11243
- publishedAt && status === "published" && ` \xB7 Published ${formatDate2(publishedAt)}`
11244
- ] })
11245
- ] }),
11246
- /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
11247
- status === "draft" && onPublish && /* @__PURE__ */ jsxs(
11248
- "button",
11249
- {
11250
- type: "button",
11251
- onClick: onPublish,
11252
- disabled: saveStatus === "saving",
11253
- className: "kyro-btn kyro-btn-primary kyro-btn-md flex items-center gap-2 flex-1 justify-center",
11254
- children: [
11255
- /* @__PURE__ */ jsx(Send, { className: "w-4 h-4" }),
11256
- "Publish"
11257
- ]
11258
- }
11259
- ),
11260
- status === "published" && onUnpublish && /* @__PURE__ */ jsxs(
11261
- "button",
11262
- {
11263
- type: "button",
11264
- onClick: onUnpublish,
11265
- disabled: saveStatus === "saving",
11266
- className: "kyro-btn kyro-btn-secondary kyro-btn-md flex items-center gap-2 flex-1 justify-center",
11267
- children: [
11268
- /* @__PURE__ */ jsx(Undo, { className: "w-4 h-4" }),
11269
- "Unpublish"
11270
- ]
11271
- }
11272
- ),
11273
- /* @__PURE__ */ jsx("div", { className: "flex-1", children: /* @__PURE__ */ jsxs(
11274
- SplitButton,
11275
- {
11276
- status,
11277
- saveStatus,
11278
- hasChanges,
11279
- onPublish: onSave,
11280
- children: [
11281
- onDuplicate && /* @__PURE__ */ jsx(
11282
- DropdownItem,
11283
- {
11284
- icon: /* @__PURE__ */ jsx(Copy, { className: "w-4 h-4" }),
11285
- children: "Duplicate"
11286
- }
11287
- ),
11288
- onViewHistory && /* @__PURE__ */ jsx(
11289
- DropdownItem,
11290
- {
11291
- icon: /* @__PURE__ */ jsx(Clock, { className: "w-4 h-4" }),
11292
- children: "View History"
11293
- }
11294
- ),
11295
- onPreview && /* @__PURE__ */ jsx(
11296
- DropdownItem,
11297
- {
11298
- icon: /* @__PURE__ */ jsx(Eye, { className: "w-4 h-4" }),
11299
- children: "Preview"
11300
- }
11301
- ),
11302
- (onDuplicate || onViewHistory || onPreview) && /* @__PURE__ */ jsx(DropdownSeparator, {}),
11303
- onDelete && /* @__PURE__ */ jsx(
11304
- DropdownItem,
11305
- {
11306
- onClick: onDelete,
11307
- danger: true,
11308
- icon: /* @__PURE__ */ jsx(Trash2, { className: "w-4 h-4" }),
11309
- children: "Delete"
11310
- }
11311
- )
11312
- ]
11313
- }
11314
- ) })
11315
- ] })
11316
- ] }),
11317
- /* @__PURE__ */ jsxs("div", { className: "hidden md:flex flex-row items-center justify-between gap-4 py-3 px-6 bg-transparent border-0 static z-40", children: [
11318
- /* @__PURE__ */ jsxs("div", { className: "flex flex-row items-center gap-4", children: [
11319
- /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
11320
- getStatusBadge(),
11321
- getSaveStatusText() && /* @__PURE__ */ jsxs(
11322
- "span",
11323
- {
11324
- className: `text-sm ${saveStatus === "error" ? "text-[var(--kyro-error)]" : "text-[var(--kyro-text-muted)]"}`,
11325
- children: [
11326
- saveStatus === "saving" ? /* @__PURE__ */ jsx(Spinner, { size: "sm", className: "inline mr-1" }) : null,
11327
- getSaveStatusText()
11328
- ]
11329
- }
11330
- )
11331
- ] }),
11332
- /* @__PURE__ */ jsxs("div", { className: "text-xs space-y-0.5", children: [
11333
- updatedAt && /* @__PURE__ */ jsxs("div", { className: "text-[var(--kyro-text-muted)]", children: [
11334
- "Updated: ",
11335
- formatDate2(updatedAt)
11336
- ] }),
11337
- publishedAt && status === "published" && /* @__PURE__ */ jsxs("div", { className: "text-[var(--kyro-primary)] font-medium", children: [
11338
- "Published: ",
11339
- formatDate2(publishedAt)
11340
- ] })
11341
- ] })
11342
- ] }),
11343
- /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 flex-wrap", children: [
11344
- status === "draft" && onPublish && /* @__PURE__ */ jsxs(
11345
- "button",
11346
- {
11347
- type: "button",
11348
- onClick: onPublish,
11349
- disabled: saveStatus === "saving",
11350
- className: "kyro-btn kyro-btn-primary kyro-btn-md flex items-center gap-2",
11351
- children: [
11352
- /* @__PURE__ */ jsx(Send, { className: "w-4 h-4" }),
11353
- "Publish"
11354
- ]
11355
- }
11356
- ),
11357
- status === "published" && onUnpublish && /* @__PURE__ */ jsxs(
11358
- "button",
11359
- {
11360
- type: "button",
11361
- onClick: onUnpublish,
11362
- disabled: saveStatus === "saving",
11363
- className: "kyro-btn kyro-btn-secondary kyro-btn-md flex items-center gap-2",
11364
- children: [
11365
- /* @__PURE__ */ jsx(Undo, { className: "w-4 h-4" }),
11366
- "Unpublish"
11367
- ]
11368
- }
11369
- ),
11370
- /* @__PURE__ */ jsxs(
11371
- SplitButton,
11372
- {
11373
- status,
11374
- saveStatus,
11375
- hasChanges,
11376
- onPublish: onSave,
11377
- children: [
11378
- onDuplicate && /* @__PURE__ */ jsx(
11379
- DropdownItem,
11380
- {
11381
- icon: /* @__PURE__ */ jsx(Copy, { className: "w-4 h-4" }),
11382
- children: "Duplicate"
11383
- }
11384
- ),
11385
- onViewHistory && /* @__PURE__ */ jsx(
11386
- DropdownItem,
11387
- {
11388
- icon: /* @__PURE__ */ jsx(Clock, { className: "w-4 h-4" }),
11389
- children: "View History"
11390
- }
11391
- ),
11392
- onPreview && /* @__PURE__ */ jsx(
11393
- DropdownItem,
11394
- {
11395
- icon: /* @__PURE__ */ jsx(Eye, { className: "w-4 h-4" }),
11396
- children: "Preview"
11397
- }
11398
- ),
11399
- (onDuplicate || onViewHistory || onPreview) && /* @__PURE__ */ jsx(DropdownSeparator, {}),
11400
- onDelete && /* @__PURE__ */ jsx(
11401
- DropdownItem,
11402
- {
11403
- onClick: onDelete,
11404
- danger: true,
11405
- icon: /* @__PURE__ */ jsx(Trash2, { className: "w-4 h-4" }),
11406
- children: "Delete"
11407
- }
11408
- )
11409
- ]
11410
- }
11411
- )
11412
- ] })
11365
+ onClick: onPublish,
11366
+ disabled: saveStatus === "saving",
11367
+ className: "kyro-btn kyro-btn-primary kyro-btn-sm flex items-center gap-1 shrink-0",
11368
+ children: [
11369
+ /* @__PURE__ */ jsx(Send, { className: "w-3.5 h-3.5" }),
11370
+ /* @__PURE__ */ jsx("span", { className: "max-md:hidden", children: "Publish" })
11371
+ ]
11372
+ }
11373
+ ),
11374
+ status === "published" && onUnpublish && /* @__PURE__ */ jsxs(
11375
+ "button",
11376
+ {
11377
+ type: "button",
11378
+ onClick: onUnpublish,
11379
+ disabled: saveStatus === "saving",
11380
+ className: "kyro-btn kyro-btn-secondary kyro-btn-sm flex items-center gap-1 shrink-0",
11381
+ children: [
11382
+ /* @__PURE__ */ jsx(Undo, { className: "w-3.5 h-3.5" }),
11383
+ /* @__PURE__ */ jsx("span", { className: "max-md:hidden", children: "Unpublish" })
11384
+ ]
11385
+ }
11386
+ ),
11387
+ /* @__PURE__ */ jsxs(
11388
+ SplitButton,
11389
+ {
11390
+ status,
11391
+ saveStatus,
11392
+ hasChanges,
11393
+ onPublish: onSave,
11394
+ children: [
11395
+ onDuplicate && /* @__PURE__ */ jsx(DropdownItem, { icon: /* @__PURE__ */ jsx(Copy, { className: "w-4 h-4" }), children: "Duplicate" }),
11396
+ onViewHistory && /* @__PURE__ */ jsx(DropdownItem, { icon: /* @__PURE__ */ jsx(Clock, { className: "w-4 h-4" }), children: "View History" }),
11397
+ onPreview && /* @__PURE__ */ jsx(DropdownItem, { icon: /* @__PURE__ */ jsx(Eye, { className: "w-4 h-4" }), children: "Preview" }),
11398
+ (onDuplicate || onViewHistory || onPreview) && /* @__PURE__ */ jsx(DropdownSeparator, {}),
11399
+ onDelete && /* @__PURE__ */ jsx(DropdownItem, { onClick: onDelete, danger: true, icon: /* @__PURE__ */ jsx(Trash2, { className: "w-4 h-4" }), children: "Delete" })
11400
+ ]
11401
+ }
11402
+ )
11413
11403
  ] })
11414
11404
  ] });
11415
11405
  }
@@ -11633,27 +11623,7 @@ function DetailView({
11633
11623
  ]
11634
11624
  }
11635
11625
  ),
11636
- isSingleLayout ? /* @__PURE__ */ jsx("div", { className: "md:hidden", children: /* @__PURE__ */ jsx(
11637
- ActionBar,
11638
- {
11639
- status,
11640
- saveStatus,
11641
- hasChanges,
11642
- onSave: () => handleSave(false),
11643
- onPublish: handlePublish,
11644
- onUnpublish: status === "published" ? handleUnpublish : void 0,
11645
- onDuplicate: handleDuplicate,
11646
- onViewHistory: () => {
11647
- window.dispatchEvent(new CustomEvent("kyro:show-version-history"));
11648
- },
11649
- onPreview: () => window.open(`/preview/${slug}/${documentId}`, "_blank"),
11650
- onDelete: handleDeleteTrigger,
11651
- onBack,
11652
- onToggleSidebar: () => window.dispatchEvent(new CustomEvent("toggle-sidebar")),
11653
- publishedAt,
11654
- updatedAt
11655
- }
11656
- ) }) : /* @__PURE__ */ jsx(
11626
+ /* @__PURE__ */ jsx(
11657
11627
  ActionBar,
11658
11628
  {
11659
11629
  status,
@@ -11677,7 +11647,7 @@ function DetailView({
11677
11647
  /* @__PURE__ */ jsxs(
11678
11648
  "div",
11679
11649
  {
11680
- className: isSingleLayout ? "w-full pb-32 pt-4 md:pt-8" : "w-full mx-auto grid grid-cols-1 lg:grid-cols-[1fr_360px] gap-4 md:gap-8 pt-4 md:pt-0 pb-32",
11650
+ className: isSingleLayout ? "w-full pt-4 md:pt-8" : "w-full mx-auto grid grid-cols-1 lg:grid-cols-[1fr_360px] gap-4 md:gap-8 pt-4 md:pt-0",
11681
11651
  children: [
11682
11652
  /* @__PURE__ */ jsx("div", { className: "space-y-4 md:space-y-8 min-w-0", children: /* @__PURE__ */ jsxs("div", { className: "surface-tile p-4 md:p-8", children: [
11683
11653
  /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between mb-8 px-1", children: [
@@ -11877,13 +11847,14 @@ function Toast({ type, message, onClose }) {
11877
11847
  onMouseEnter: () => setIsPaused(true),
11878
11848
  onMouseLeave: () => setIsPaused(false),
11879
11849
  children: [
11850
+ /* @__PURE__ */ jsx("div", { className: "kyro-toast-accent" }),
11880
11851
  /* @__PURE__ */ jsx("div", { className: "kyro-toast-icon-container", children: /* @__PURE__ */ jsx(Icon, { className: "w-4 h-4" }) }),
11881
11852
  /* @__PURE__ */ jsx("div", { className: "kyro-toast-content", children: /* @__PURE__ */ jsx("p", { className: "kyro-toast-message", children: message }) }),
11882
11853
  /* @__PURE__ */ jsx(
11883
11854
  "button",
11884
11855
  {
11885
11856
  type: "button",
11886
- className: "kyro-toast-close",
11857
+ className: "kyro-toast-close group-hover:opacity-100 opacity-40 transition-opacity",
11887
11858
  onClick: onClose,
11888
11859
  children: /* @__PURE__ */ jsx(X, { className: "w-3.5 h-3.5" })
11889
11860
  }
@@ -14132,7 +14103,11 @@ function Admin({ config, theme = "light", onThemeChange }) {
14132
14103
  }
14133
14104
  };
14134
14105
  window.addEventListener("keydown", handleKeyDown);
14135
- return () => window.removeEventListener("keydown", handleKeyDown);
14106
+ window.openCommandPalette = () => setIsCommandPaletteOpen(true);
14107
+ return () => {
14108
+ window.removeEventListener("keydown", handleKeyDown);
14109
+ delete window.openCommandPalette;
14110
+ };
14136
14111
  }, []);
14137
14112
  if (!authenticated) {
14138
14113
  return /* @__PURE__ */ jsx(