@kyro-cms/admin 0.10.18 → 0.10.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kyro-cms/admin",
3
- "version": "0.10.18",
3
+ "version": "0.10.20",
4
4
  "engines": {
5
5
  "node": ">=22"
6
6
  },
@@ -393,11 +393,19 @@ export function GraphQLPlayground({
393
393
  const [token, setToken] = useState<string>("");
394
394
  const [showToken, setShowToken] = useState(false);
395
395
  const [isConnected, setIsConnected] = useState(false);
396
- const [tab, setTab] = useState<QueryTab>({
397
- id: "default",
398
- query: initialQuery || DEFAULT_QUERY,
399
- variables: initialVariables || "{}",
400
- headers: "",
396
+ const [tab, setTab] = useState<QueryTab>(() => {
397
+ if (typeof window !== "undefined") {
398
+ try {
399
+ const saved = localStorage.getItem("kyro_graphql_tab");
400
+ if (saved) return JSON.parse(saved);
401
+ } catch {}
402
+ }
403
+ return {
404
+ id: "default",
405
+ query: initialQuery || DEFAULT_QUERY,
406
+ variables: initialVariables || "{}",
407
+ headers: "",
408
+ };
401
409
  });
402
410
  const [response, setResponse] = useState<string>("");
403
411
  const [isLoading, setIsLoading] = useState(false);
@@ -411,7 +419,15 @@ export function GraphQLPlayground({
411
419
  const [rightTab, setRightTab] = useState<"response" | "docs" | "history">(
412
420
  initialShowDocs ? "docs" : "response",
413
421
  );
414
- const [history, setHistory] = useState<HistoryEntry[]>([]);
422
+ const [history, setHistory] = useState<HistoryEntry[]>(() => {
423
+ if (typeof window !== "undefined") {
424
+ try {
425
+ const saved = localStorage.getItem("kyro_graphql_history");
426
+ if (saved) return JSON.parse(saved);
427
+ } catch {}
428
+ }
429
+ return [];
430
+ });
415
431
  const [lastDuration, setLastDuration] = useState<number>(0);
416
432
  const [lastStatus, setLastStatus] = useState<number>(0);
417
433
  const [copied, setCopied] = useState(false);
@@ -426,6 +442,18 @@ export function GraphQLPlayground({
426
442
  setIsMounted(true);
427
443
  }, []);
428
444
 
445
+ useEffect(() => {
446
+ if (isMounted) {
447
+ localStorage.setItem("kyro_graphql_tab", JSON.stringify(tab));
448
+ }
449
+ }, [tab, isMounted]);
450
+
451
+ useEffect(() => {
452
+ if (isMounted) {
453
+ localStorage.setItem("kyro_graphql_history", JSON.stringify(history));
454
+ }
455
+ }, [history, isMounted]);
456
+
429
457
  useEffect(() => {
430
458
  const check = () => setIsDesktop(window.innerWidth >= 768);
431
459
  check();
@@ -83,13 +83,21 @@ export function RestPlayground({ collections = [] }: RestPlaygroundProps) {
83
83
  const [history, setHistory] = useState<HistoryItem[]>([]);
84
84
  const [envVars, setEnvVars] = useState<EnvVariable[]>([]);
85
85
  const [selectedRequest, setSelectedRequest] = useState<SavedRequest | null>(null);
86
- const [currentRequest, setCurrentRequest] = useState<SavedRequest>({
87
- id: "new",
88
- name: "Untitled Request",
89
- method: "GET",
90
- url: "",
91
- headers: {},
92
- body: "",
86
+ const [currentRequest, setCurrentRequest] = useState<SavedRequest>(() => {
87
+ if (typeof window !== "undefined") {
88
+ try {
89
+ const saved = localStorage.getItem("kyro_rest_current");
90
+ if (saved) return JSON.parse(saved);
91
+ } catch {}
92
+ }
93
+ return {
94
+ id: "new",
95
+ name: "Untitled Request",
96
+ method: "GET",
97
+ url: "",
98
+ headers: {},
99
+ body: "",
100
+ };
93
101
  });
94
102
  const [response, setResponse] = useState<{ status: number; duration: number; size: number; data: any } | null>(null);
95
103
  const [loading, setLoading] = useState(false);
@@ -136,6 +144,10 @@ export function RestPlayground({ collections = [] }: RestPlaygroundProps) {
136
144
  if (isMounted) localStorage.setItem(STORAGE_KEYS.env, JSON.stringify(envVars));
137
145
  }, [envVars, isMounted]);
138
146
 
147
+ useEffect(() => {
148
+ if (isMounted) localStorage.setItem("kyro_rest_current", JSON.stringify(currentRequest));
149
+ }, [currentRequest, isMounted]);
150
+
139
151
  const resolveUrl = (url: string) => {
140
152
  let resolved = url;
141
153
  envVars.forEach((v) => {
@@ -225,18 +225,12 @@ const SortableBlockComponent = ({
225
225
  }
226
226
 
227
227
  return (
228
- <div ref={setNodeRef} style={style} className="relative group md:pl-8 mb-2">
228
+ <div ref={setNodeRef} style={style} className="relative group mb-2">
229
229
  <div
230
- className="hidden md:absolute left-0 top-1/2 -translate-y-1/2 p-1.5 cursor-grab active:cursor-grabbing text-[var(--kyro-text-muted)] opacity-0 group-hover:opacity-100 transition-opacity hover:bg-[var(--kyro-surface-accent)] rounded"
231
230
  {...attributes}
232
231
  {...listeners}
233
- >
234
- <GripVertical className="w-4 h-4" />
235
- </div>
236
-
237
- <div
238
232
  onClick={() => setEditingBlockId(block.id as string)}
239
- className={`flex items-center gap-3 p-3 bg-[var(--kyro-bg-secondary)] rounded-lg border transition-colors cursor-pointer ${isEditing
233
+ className={`flex items-center gap-3 p-3 bg-[var(--kyro-bg-secondary)] rounded-lg border transition-colors cursor-grab active:cursor-grabbing ${isEditing
240
234
  ? `${(blockTheme[block.type as string] || blockTheme.default).border} bg-[var(--kyro-primary)]/5`
241
235
  : "border-[var(--kyro-border)] hover:border-[var(--kyro-primary)]/50 hover:bg-[var(--kyro-primary)]/5"
242
236
  }`}
@@ -543,7 +537,8 @@ export const BlocksField: React.FC<BlocksFieldProps> = ({
543
537
  const sensors = useSensors(
544
538
  useSensor(PointerSensor, {
545
539
  activationConstraint: {
546
- distance: 8,
540
+ delay: 200,
541
+ tolerance: 5,
547
542
  },
548
543
  }),
549
544
  useSensor(KeyboardSensor),