@aphexcms/cms-core 8.1.0 → 9.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api/api-keys.d.ts +8 -3
- package/dist/api/api-keys.d.ts.map +1 -1
- package/dist/api/schemas/assets.js +1 -1
- package/dist/api/schemas/documents.d.ts +0 -2
- package/dist/api/schemas/documents.d.ts.map +1 -1
- package/dist/api/schemas/documents.js +2 -8
- package/dist/api/schemas/instance.d.ts +6 -0
- package/dist/api/schemas/instance.d.ts.map +1 -0
- package/dist/api/schemas/instance.js +7 -0
- package/dist/api/schemas/user.js +1 -1
- package/dist/auth/auth-hooks.d.ts.map +1 -1
- package/dist/auth/auth-hooks.js +9 -3
- package/dist/cli/generate-types.d.ts.map +1 -1
- package/dist/cli/generate-types.js +198 -11
- package/dist/cli/generate-types.js.map +1 -1
- package/dist/components/AdminApp.svelte +55 -149
- package/dist/components/AdminApp.svelte.d.ts.map +1 -1
- package/dist/components/admin/DocumentEditor.svelte +282 -253
- package/dist/components/admin/DocumentEditor.svelte.d.ts.map +1 -1
- package/dist/components/admin/DocumentVersionPanel.svelte +3 -2
- package/dist/components/admin/DocumentVersionPanel.svelte.d.ts.map +1 -1
- package/dist/components/admin/MediaBrowser.svelte +29 -11
- package/dist/components/admin/MediaBrowser.svelte.d.ts.map +1 -1
- package/dist/components/admin/ObjectModal.svelte +62 -75
- package/dist/components/admin/ObjectModal.svelte.d.ts.map +1 -1
- package/dist/components/admin/SchemaField.svelte +2 -2
- package/dist/components/admin/fields/ArrayField.svelte +13 -3
- package/dist/components/admin/fields/ArrayField.svelte.d.ts.map +1 -1
- package/dist/components/admin/fields/FileField.svelte +1 -1
- package/dist/components/admin/fields/ImageField.svelte +1 -1
- package/dist/components/admin/fields/ReferenceField.svelte +42 -11
- package/dist/components/admin/fields/ReferenceField.svelte.d.ts.map +1 -1
- package/dist/components/admin/fields/richtext/PortableTextImageView.svelte +116 -0
- package/dist/components/admin/fields/richtext/PortableTextImageView.svelte.d.ts +12 -0
- package/dist/components/admin/fields/richtext/PortableTextImageView.svelte.d.ts.map +1 -0
- package/dist/components/admin/fields/richtext/PortableTextInlineView.svelte +111 -0
- package/dist/components/admin/fields/richtext/PortableTextInlineView.svelte.d.ts +12 -0
- package/dist/components/admin/fields/richtext/PortableTextInlineView.svelte.d.ts.map +1 -0
- package/dist/components/admin/fields/richtext/PortableTextObjectView.svelte +67 -0
- package/dist/components/admin/fields/richtext/PortableTextObjectView.svelte.d.ts +12 -0
- package/dist/components/admin/fields/richtext/PortableTextObjectView.svelte.d.ts.map +1 -0
- package/dist/components/admin/fields/richtext/RichtextField.svelte +1296 -0
- package/dist/components/admin/fields/richtext/RichtextField.svelte.d.ts +15 -0
- package/dist/components/admin/fields/richtext/RichtextField.svelte.d.ts.map +1 -0
- package/dist/components/admin/fields/richtext/custom-annotation-mark.d.ts +7 -0
- package/dist/components/admin/fields/richtext/custom-annotation-mark.d.ts.map +1 -0
- package/dist/components/admin/fields/richtext/custom-annotation-mark.js +33 -0
- package/dist/components/admin/fields/richtext/portable-text-inline-object.d.ts +11 -0
- package/dist/components/admin/fields/richtext/portable-text-inline-object.d.ts.map +1 -0
- package/dist/components/admin/fields/richtext/portable-text-inline-object.js +31 -0
- package/dist/components/admin/fields/richtext/portable-text-object-node.d.ts +11 -0
- package/dist/components/admin/fields/richtext/portable-text-object-node.d.ts.map +1 -0
- package/dist/components/admin/fields/richtext/portable-text-object-node.js +31 -0
- package/dist/components/admin/fields/richtext/portable-text-serializer.d.ts +38 -0
- package/dist/components/admin/fields/richtext/portable-text-serializer.d.ts.map +1 -0
- package/dist/components/admin/fields/richtext/portable-text-serializer.js +297 -0
- package/dist/components/admin/fields/richtext/svelte-inline-node-view.d.ts +8 -0
- package/dist/components/admin/fields/richtext/svelte-inline-node-view.d.ts.map +1 -0
- package/dist/components/admin/fields/richtext/svelte-inline-node-view.js +67 -0
- package/dist/components/admin/fields/richtext/svelte-node-view.d.ts +8 -0
- package/dist/components/admin/fields/richtext/svelte-node-view.d.ts.map +1 -0
- package/dist/components/admin/fields/richtext/svelte-node-view.js +63 -0
- package/dist/components/layout/OrganizationSwitcher.svelte +1 -1
- package/dist/components/layout/sidebar/NavMain.svelte +9 -1
- package/dist/components/layout/sidebar/NavMain.svelte.d.ts.map +1 -1
- package/dist/db/interfaces/asset.d.ts +2 -4
- package/dist/db/interfaces/asset.d.ts.map +1 -1
- package/dist/db/interfaces/document.d.ts +8 -2
- package/dist/db/interfaces/document.d.ts.map +1 -1
- package/dist/db/interfaces/organization.d.ts +1 -1
- package/dist/db/interfaces/organization.d.ts.map +1 -1
- package/dist/field-access.d.ts.map +1 -1
- package/dist/field-access.js +5 -1
- package/dist/graphql/depth-limit.d.ts +8 -0
- package/dist/graphql/depth-limit.d.ts.map +1 -0
- package/dist/graphql/depth-limit.js +79 -0
- package/dist/graphql/index.d.ts.map +1 -1
- package/dist/graphql/index.js +12 -1
- package/dist/graphql/resolvers.d.ts.map +1 -1
- package/dist/graphql/resolvers.js +22 -22
- package/dist/graphql/schema.d.ts.map +1 -1
- package/dist/graphql/schema.js +7 -3
- package/dist/hooks.d.ts +2 -0
- package/dist/hooks.d.ts.map +1 -1
- package/dist/hooks.js +5 -2
- package/dist/lib/api/api-keys.d.ts +8 -3
- package/dist/lib/api/api-keys.d.ts.map +1 -1
- package/dist/lib/api/api-keys.js.map +1 -1
- package/dist/lib/api/schemas/assets.js +1 -1
- package/dist/lib/api/schemas/assets.js.map +1 -1
- package/dist/lib/api/schemas/documents.d.ts +0 -2
- package/dist/lib/api/schemas/documents.d.ts.map +1 -1
- package/dist/lib/api/schemas/documents.js +2 -8
- package/dist/lib/api/schemas/documents.js.map +1 -1
- package/dist/lib/api/schemas/instance.d.ts +6 -0
- package/dist/lib/api/schemas/instance.d.ts.map +1 -0
- package/dist/lib/api/schemas/instance.js +8 -0
- package/dist/lib/api/schemas/instance.js.map +1 -0
- package/dist/lib/api/schemas/user.js +1 -1
- package/dist/lib/auth/auth-hooks.d.ts.map +1 -1
- package/dist/lib/auth/auth-hooks.js +9 -3
- package/dist/lib/auth/auth-hooks.js.map +1 -1
- package/dist/lib/components/admin/fields/richtext/custom-annotation-mark.d.ts +7 -0
- package/dist/lib/components/admin/fields/richtext/custom-annotation-mark.d.ts.map +1 -0
- package/dist/lib/components/admin/fields/richtext/custom-annotation-mark.js +34 -0
- package/dist/lib/components/admin/fields/richtext/custom-annotation-mark.js.map +1 -0
- package/dist/lib/components/admin/fields/richtext/portable-text-inline-object.d.ts +11 -0
- package/dist/lib/components/admin/fields/richtext/portable-text-inline-object.d.ts.map +1 -0
- package/dist/lib/components/admin/fields/richtext/portable-text-inline-object.js +32 -0
- package/dist/lib/components/admin/fields/richtext/portable-text-inline-object.js.map +1 -0
- package/dist/lib/components/admin/fields/richtext/portable-text-object-node.d.ts +11 -0
- package/dist/lib/components/admin/fields/richtext/portable-text-object-node.d.ts.map +1 -0
- package/dist/lib/components/admin/fields/richtext/portable-text-object-node.js +32 -0
- package/dist/lib/components/admin/fields/richtext/portable-text-object-node.js.map +1 -0
- package/dist/lib/components/admin/fields/richtext/portable-text-serializer.d.ts +38 -0
- package/dist/lib/components/admin/fields/richtext/portable-text-serializer.d.ts.map +1 -0
- package/dist/lib/components/admin/fields/richtext/portable-text-serializer.js +298 -0
- package/dist/lib/components/admin/fields/richtext/portable-text-serializer.js.map +1 -0
- package/dist/lib/components/admin/fields/richtext/svelte-inline-node-view.d.ts +8 -0
- package/dist/lib/components/admin/fields/richtext/svelte-inline-node-view.d.ts.map +1 -0
- package/dist/lib/components/admin/fields/richtext/svelte-inline-node-view.js +68 -0
- package/dist/lib/components/admin/fields/richtext/svelte-inline-node-view.js.map +1 -0
- package/dist/lib/components/admin/fields/richtext/svelte-node-view.d.ts +8 -0
- package/dist/lib/components/admin/fields/richtext/svelte-node-view.d.ts.map +1 -0
- package/dist/lib/components/admin/fields/richtext/svelte-node-view.js +64 -0
- package/dist/lib/components/admin/fields/richtext/svelte-node-view.js.map +1 -0
- package/dist/lib/db/interfaces/asset.d.ts +2 -4
- package/dist/lib/db/interfaces/asset.d.ts.map +1 -1
- package/dist/lib/db/interfaces/document.d.ts +8 -2
- package/dist/lib/db/interfaces/document.d.ts.map +1 -1
- package/dist/lib/db/interfaces/organization.d.ts +1 -1
- package/dist/lib/db/interfaces/organization.d.ts.map +1 -1
- package/dist/lib/field-access.d.ts.map +1 -1
- package/dist/lib/field-access.js +5 -1
- package/dist/lib/field-access.js.map +1 -1
- package/dist/lib/graphql/depth-limit.d.ts +8 -0
- package/dist/lib/graphql/depth-limit.d.ts.map +1 -0
- package/dist/lib/graphql/depth-limit.js +80 -0
- package/dist/lib/graphql/depth-limit.js.map +1 -0
- package/dist/lib/graphql/index.d.ts.map +1 -1
- package/dist/lib/graphql/index.js +12 -1
- package/dist/lib/graphql/index.js.map +1 -1
- package/dist/lib/graphql/resolvers.d.ts.map +1 -1
- package/dist/lib/graphql/resolvers.js +22 -22
- package/dist/lib/graphql/resolvers.js.map +1 -1
- package/dist/lib/graphql/schema.d.ts.map +1 -1
- package/dist/lib/graphql/schema.js +7 -3
- package/dist/lib/graphql/schema.js.map +1 -1
- package/dist/lib/hooks.d.ts +2 -0
- package/dist/lib/hooks.d.ts.map +1 -1
- package/dist/lib/hooks.js +5 -2
- package/dist/lib/hooks.js.map +1 -1
- package/dist/lib/local-api/collection-api.d.ts.map +1 -1
- package/dist/lib/local-api/collection-api.js +14 -9
- package/dist/lib/local-api/collection-api.js.map +1 -1
- package/dist/lib/local-api/index.d.ts +5 -1
- package/dist/lib/local-api/index.d.ts.map +1 -1
- package/dist/lib/local-api/index.js +12 -4
- package/dist/lib/local-api/index.js.map +1 -1
- package/dist/lib/routes/assets-cdn.d.ts.map +1 -1
- package/dist/lib/routes/assets-cdn.js +8 -3
- package/dist/lib/routes/assets-cdn.js.map +1 -1
- package/dist/lib/schema-utils/validator.d.ts.map +1 -1
- package/dist/lib/schema-utils/validator.js +5 -1
- package/dist/lib/schema-utils/validator.js.map +1 -1
- package/dist/lib/server/api/index.d.ts.map +1 -1
- package/dist/lib/server/api/index.js +18 -0
- package/dist/lib/server/api/index.js.map +1 -1
- package/dist/lib/server/api/routes/assets-bulk.d.ts.map +1 -1
- package/dist/lib/server/api/routes/assets-bulk.js +4 -0
- package/dist/lib/server/api/routes/assets-bulk.js.map +1 -1
- package/dist/lib/server/api/routes/assets-by-id.d.ts.map +1 -1
- package/dist/lib/server/api/routes/assets-by-id.js +17 -2
- package/dist/lib/server/api/routes/assets-by-id.js.map +1 -1
- package/dist/lib/server/api/routes/assets-references.d.ts.map +1 -1
- package/dist/lib/server/api/routes/assets-references.js +6 -4
- package/dist/lib/server/api/routes/assets-references.js.map +1 -1
- package/dist/lib/server/api/routes/assets.d.ts.map +1 -1
- package/dist/lib/server/api/routes/assets.js +18 -9
- package/dist/lib/server/api/routes/assets.js.map +1 -1
- package/dist/lib/server/api/routes/document-versions.d.ts.map +1 -1
- package/dist/lib/server/api/routes/document-versions.js +8 -0
- package/dist/lib/server/api/routes/document-versions.js.map +1 -1
- package/dist/lib/server/api/routes/documents-by-id.d.ts.map +1 -1
- package/dist/lib/server/api/routes/documents-by-id.js +3 -3
- package/dist/lib/server/api/routes/documents-by-id.js.map +1 -1
- package/dist/lib/server/api/routes/documents-publish.d.ts.map +1 -1
- package/dist/lib/server/api/routes/documents-publish.js +2 -2
- package/dist/lib/server/api/routes/documents-publish.js.map +1 -1
- package/dist/lib/server/api/routes/documents-query.d.ts.map +1 -1
- package/dist/lib/server/api/routes/documents-query.js +2 -3
- package/dist/lib/server/api/routes/documents-query.js.map +1 -1
- package/dist/lib/server/api/routes/documents.d.ts.map +1 -1
- package/dist/lib/server/api/routes/documents.js +3 -5
- package/dist/lib/server/api/routes/documents.js.map +1 -1
- package/dist/lib/server/api/routes/organizations-invitations.d.ts.map +1 -1
- package/dist/lib/server/api/routes/organizations-invitations.js +1 -1
- package/dist/lib/server/api/routes/organizations-invitations.js.map +1 -1
- package/dist/lib/server/api/routes/organizations-members.d.ts.map +1 -1
- package/dist/lib/server/api/routes/organizations-members.js.map +1 -1
- package/dist/lib/server/index.d.ts +1 -0
- package/dist/lib/server/index.d.ts.map +1 -1
- package/dist/lib/server/index.js +2 -0
- package/dist/lib/server/index.js.map +1 -1
- package/dist/lib/services/asset-service.d.ts.map +1 -1
- package/dist/lib/services/asset-service.js +4 -2
- package/dist/lib/services/asset-service.js.map +1 -1
- package/dist/lib/services/references-service.d.ts.map +1 -1
- package/dist/lib/services/references-service.js.map +1 -1
- package/dist/lib/storage/adapters/local-storage-adapter.d.ts +4 -0
- package/dist/lib/storage/adapters/local-storage-adapter.d.ts.map +1 -1
- package/dist/lib/storage/adapters/local-storage-adapter.js +28 -6
- package/dist/lib/storage/adapters/local-storage-adapter.js.map +1 -1
- package/dist/lib/types/capabilities.d.ts +1 -0
- package/dist/lib/types/capabilities.d.ts.map +1 -1
- package/dist/lib/types/capabilities.js +3 -0
- package/dist/lib/types/capabilities.js.map +1 -1
- package/dist/lib/types/config.d.ts +16 -1
- package/dist/lib/types/config.d.ts.map +1 -1
- package/dist/lib/types/schemas.d.ts +27 -0
- package/dist/lib/types/schemas.d.ts.map +1 -1
- package/dist/lib/types/schemas.js +3 -1
- package/dist/lib/types/schemas.js.map +1 -1
- package/dist/lib/utils/logger.d.ts +8 -6
- package/dist/lib/utils/logger.d.ts.map +1 -1
- package/dist/lib/utils/logger.js +11 -2
- package/dist/lib/utils/logger.js.map +1 -1
- package/dist/lib/utils/mime-detect.d.ts.map +1 -1
- package/dist/lib/utils/mime-detect.js +21 -6
- package/dist/lib/utils/mime-detect.js.map +1 -1
- package/dist/lib/vite/index.d.ts.map +1 -1
- package/dist/lib/vite/index.js +4 -5
- package/dist/lib/vite/index.js.map +1 -1
- package/dist/local-api/collection-api.d.ts.map +1 -1
- package/dist/local-api/collection-api.js +14 -9
- package/dist/local-api/index.d.ts +5 -1
- package/dist/local-api/index.d.ts.map +1 -1
- package/dist/local-api/index.js +12 -4
- package/dist/routes/assets-cdn.d.ts.map +1 -1
- package/dist/routes/assets-cdn.js +8 -3
- package/dist/schema-utils/validator.d.ts.map +1 -1
- package/dist/schema-utils/validator.js +5 -1
- package/dist/server/api/index.d.ts.map +1 -1
- package/dist/server/api/index.js +18 -0
- package/dist/server/api/routes/assets-bulk.d.ts.map +1 -1
- package/dist/server/api/routes/assets-bulk.js +4 -0
- package/dist/server/api/routes/assets-by-id.d.ts.map +1 -1
- package/dist/server/api/routes/assets-by-id.js +17 -2
- package/dist/server/api/routes/assets-references.d.ts.map +1 -1
- package/dist/server/api/routes/assets-references.js +6 -4
- package/dist/server/api/routes/assets.d.ts.map +1 -1
- package/dist/server/api/routes/assets.js +18 -9
- package/dist/server/api/routes/document-versions.d.ts.map +1 -1
- package/dist/server/api/routes/document-versions.js +8 -0
- package/dist/server/api/routes/documents-by-id.d.ts.map +1 -1
- package/dist/server/api/routes/documents-by-id.js +3 -3
- package/dist/server/api/routes/documents-publish.d.ts.map +1 -1
- package/dist/server/api/routes/documents-publish.js +2 -2
- package/dist/server/api/routes/documents-query.d.ts.map +1 -1
- package/dist/server/api/routes/documents-query.js +2 -3
- package/dist/server/api/routes/documents.d.ts.map +1 -1
- package/dist/server/api/routes/documents.js +3 -5
- package/dist/server/api/routes/organizations-invitations.d.ts.map +1 -1
- package/dist/server/api/routes/organizations-invitations.js +1 -1
- package/dist/server/api/routes/organizations-members.d.ts.map +1 -1
- package/dist/server/index.d.ts +1 -0
- package/dist/server/index.d.ts.map +1 -1
- package/dist/server/index.js +2 -0
- package/dist/services/asset-service.d.ts.map +1 -1
- package/dist/services/asset-service.js +4 -2
- package/dist/services/references-service.d.ts.map +1 -1
- package/dist/storage/adapters/local-storage-adapter.d.ts +4 -0
- package/dist/storage/adapters/local-storage-adapter.d.ts.map +1 -1
- package/dist/storage/adapters/local-storage-adapter.js +28 -6
- package/dist/types/capabilities.d.ts +1 -0
- package/dist/types/capabilities.d.ts.map +1 -1
- package/dist/types/capabilities.js +3 -0
- package/dist/types/config.d.ts +16 -1
- package/dist/types/config.d.ts.map +1 -1
- package/dist/types/schemas.d.ts +27 -0
- package/dist/types/schemas.d.ts.map +1 -1
- package/dist/types/schemas.js +3 -1
- package/dist/utils/logger.d.ts +8 -6
- package/dist/utils/logger.d.ts.map +1 -1
- package/dist/utils/logger.js +11 -2
- package/dist/utils/mime-detect.d.ts.map +1 -1
- package/dist/utils/mime-detect.js +21 -6
- package/dist/vite/index.d.ts.map +1 -1
- package/dist/vite/index.js +4 -5
- package/package.json +9 -5
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
import * as Popover from '@aphexcms/ui/shadcn/popover';
|
|
10
10
|
import * as Select from '@aphexcms/ui/shadcn/select';
|
|
11
11
|
import { page } from '$app/state';
|
|
12
|
-
import { goto
|
|
12
|
+
import { goto } from '$app/navigation';
|
|
13
13
|
import { SvelteURLSearchParams } from 'svelte/reactivity';
|
|
14
14
|
import type { SchemaType } from '../types/index';
|
|
15
15
|
import type { UserSessionPreferences } from '../types/organization';
|
|
@@ -36,7 +36,6 @@
|
|
|
36
36
|
import { cmsLogger } from '../utils/logger';
|
|
37
37
|
import { pluralize } from '../utils/pluralize';
|
|
38
38
|
import { toast } from 'svelte-sonner';
|
|
39
|
-
import { resolve } from '$app/paths';
|
|
40
39
|
import { setPermissionsContext } from '../permissions-context.svelte';
|
|
41
40
|
|
|
42
41
|
interface Props {
|
|
@@ -151,8 +150,9 @@
|
|
|
151
150
|
// Mobile navigation state (Sanity-style)
|
|
152
151
|
let mobileView = $state<'types' | 'documents' | 'editor'>('types');
|
|
153
152
|
|
|
154
|
-
// Window size reactivity
|
|
155
|
-
|
|
153
|
+
// Window size reactivity — default to mobile-safe width for SSR,
|
|
154
|
+
// immediately overwritten on mount.
|
|
155
|
+
let windowWidth = $state(typeof window !== 'undefined' ? window.innerWidth : 375);
|
|
156
156
|
|
|
157
157
|
// Document editor state (moved before layoutConfig)
|
|
158
158
|
let editingDocumentId = $state<string | null>(null);
|
|
@@ -271,18 +271,15 @@
|
|
|
271
271
|
// Track which editor is currently active/focused (0 = primary, 1+ = stacked)
|
|
272
272
|
let activeEditorIndex = $state<number>(0);
|
|
273
273
|
|
|
274
|
-
//
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
const
|
|
278
|
-
const
|
|
274
|
+
// Layout: editors take precedence. When space is tight, panels collapse
|
|
275
|
+
// to 60px strips. Types panel always stays visible; docs list collapses
|
|
276
|
+
// first, then types.
|
|
277
|
+
const MIN_EDITOR_WIDTH = 650;
|
|
278
|
+
const COLLAPSED_WIDTH = 60;
|
|
279
|
+
const TYPES_WIDTH = 350;
|
|
280
|
+
const DOCS_WIDTH = 350;
|
|
279
281
|
let layoutConfig = $derived.by(() => {
|
|
280
|
-
const
|
|
281
|
-
// Version panel is fixed-width (280px), not a full editor — deduct it
|
|
282
|
-
// from available space instead of counting it as an editor slot.
|
|
283
|
-
const totalEditors =
|
|
284
|
-
(currentView === 'editor' ? 1 : 0) +
|
|
285
|
-
(editorStack.length > 0 ? 1 : 0);
|
|
282
|
+
const totalEditors = (currentView === 'editor' ? 1 : 0) + (editorStack.length > 0 ? 1 : 0);
|
|
286
283
|
|
|
287
284
|
if (totalEditors === 0) {
|
|
288
285
|
return {
|
|
@@ -298,149 +295,58 @@
|
|
|
298
295
|
};
|
|
299
296
|
}
|
|
300
297
|
|
|
301
|
-
// Ensure activeEditorIndex is valid (can be -1 for types, -2 for docs)
|
|
302
298
|
const validActiveIndex =
|
|
303
299
|
activeEditorIndex < 0
|
|
304
300
|
? activeEditorIndex
|
|
305
301
|
: Math.max(0, Math.min(activeEditorIndex, totalEditors - 1));
|
|
306
302
|
|
|
307
|
-
|
|
303
|
+
const hasDocs = !!selectedDocumentType && !currentTypeIsSingleton;
|
|
308
304
|
const typesActive = activeEditorIndex === -1;
|
|
309
305
|
const docsActive = activeEditorIndex === -2;
|
|
310
306
|
|
|
311
|
-
//
|
|
312
|
-
//
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
let
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
let maxExpandedEditors = Math.floor(remainingWidth / MIN_EDITOR_WIDTH);
|
|
331
|
-
|
|
332
|
-
// Expand as many editors as possible around the last active editor
|
|
333
|
-
if (maxExpandedEditors < 1) maxExpandedEditors = 0;
|
|
334
|
-
|
|
335
|
-
// Build expanded indices for editors
|
|
336
|
-
let expandedIndices: number[] = [];
|
|
337
|
-
if (maxExpandedEditors > 0 && totalEditors > 0) {
|
|
338
|
-
// Start from rightmost editor (most recently opened)
|
|
339
|
-
const lastEditorIndex = totalEditors - 1;
|
|
340
|
-
expandedIndices.push(lastEditorIndex);
|
|
341
|
-
|
|
342
|
-
// Expand editors to the left if space allows
|
|
343
|
-
for (
|
|
344
|
-
let i = lastEditorIndex - 1;
|
|
345
|
-
i >= 0 && expandedIndices.length < maxExpandedEditors;
|
|
346
|
-
i--
|
|
347
|
-
) {
|
|
348
|
-
expandedIndices.push(i);
|
|
349
|
-
}
|
|
307
|
+
// Two editors open → always collapse both panels to maximize editing space
|
|
308
|
+
// Unless user explicitly clicked a collapsed strip to expand it
|
|
309
|
+
let typesExpanded = typesActive || totalEditors < 2;
|
|
310
|
+
let docsExpanded = docsActive || totalEditors < 2;
|
|
311
|
+
|
|
312
|
+
let panelsWidth =
|
|
313
|
+
(typesExpanded ? TYPES_WIDTH : COLLAPSED_WIDTH) +
|
|
314
|
+
(hasDocs ? (docsExpanded ? DOCS_WIDTH : COLLAPSED_WIDTH) : 0);
|
|
315
|
+
let editorSpace = windowWidth - panelsWidth;
|
|
316
|
+
let maxEditors = Math.floor(editorSpace / MIN_EDITOR_WIDTH);
|
|
317
|
+
|
|
318
|
+
// Single editor: collapse panels only if editor doesn't fit.
|
|
319
|
+
// Skip if user explicitly clicked a collapsed strip to expand it.
|
|
320
|
+
if (totalEditors === 1 && !typesActive && !docsActive) {
|
|
321
|
+
if (maxEditors < 1 && hasDocs) {
|
|
322
|
+
docsExpanded = false;
|
|
323
|
+
panelsWidth = TYPES_WIDTH + COLLAPSED_WIDTH;
|
|
324
|
+
editorSpace = windowWidth - panelsWidth;
|
|
325
|
+
maxEditors = Math.floor(editorSpace / MIN_EDITOR_WIDTH);
|
|
350
326
|
}
|
|
351
327
|
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
typesCollapsed: !typesExpanded,
|
|
359
|
-
docsCollapsed: !docsExpanded,
|
|
360
|
-
expandedIndices,
|
|
361
|
-
activeIndex: validActiveIndex,
|
|
362
|
-
typesExpanded,
|
|
363
|
-
docsExpanded
|
|
364
|
-
};
|
|
365
|
-
}
|
|
366
|
-
|
|
367
|
-
// Normal mode: prioritize editors over panels
|
|
368
|
-
// Calculate how many editors we can fit with current panel widths
|
|
369
|
-
let remainingWidth = windowWidth - typesWidth - docsWidth;
|
|
370
|
-
let maxExpandedEditors = Math.floor(remainingWidth / MIN_EDITOR_WIDTH);
|
|
371
|
-
|
|
372
|
-
// If we can't fit all editors, start collapsing panels.
|
|
373
|
-
// Types sidebar collapses first — the docs list is more useful when
|
|
374
|
-
// actively editing (shows siblings in the same collection).
|
|
375
|
-
if (maxExpandedEditors < totalEditors) {
|
|
376
|
-
typesWidth = COLLAPSED_WIDTH;
|
|
377
|
-
typesExpanded = false;
|
|
378
|
-
remainingWidth = windowWidth - typesWidth - docsWidth;
|
|
379
|
-
maxExpandedEditors = Math.floor(remainingWidth / MIN_EDITOR_WIDTH);
|
|
380
|
-
}
|
|
381
|
-
|
|
382
|
-
// If still not enough space, collapse docs list too
|
|
383
|
-
if (maxExpandedEditors < totalEditors) {
|
|
384
|
-
docsWidth = selectedDocumentType ? COLLAPSED_WIDTH : 0;
|
|
385
|
-
docsExpanded = false;
|
|
386
|
-
remainingWidth = windowWidth - typesWidth - docsWidth;
|
|
387
|
-
maxExpandedEditors = Math.floor(remainingWidth / MIN_EDITOR_WIDTH);
|
|
328
|
+
if (maxEditors < 1) {
|
|
329
|
+
typesExpanded = false;
|
|
330
|
+
panelsWidth = COLLAPSED_WIDTH + (hasDocs ? COLLAPSED_WIDTH : 0);
|
|
331
|
+
editorSpace = windowWidth - panelsWidth;
|
|
332
|
+
maxEditors = Math.floor(editorSpace / MIN_EDITOR_WIDTH);
|
|
333
|
+
}
|
|
388
334
|
}
|
|
389
335
|
|
|
390
|
-
|
|
391
|
-
if (maxExpandedEditors < 1) {
|
|
392
|
-
maxExpandedEditors = 1;
|
|
393
|
-
}
|
|
336
|
+
if (maxEditors < 1) maxEditors = 1;
|
|
394
337
|
|
|
395
|
-
//
|
|
338
|
+
// Build expanded editor indices, prioritizing active + most recent
|
|
396
339
|
let expandedIndices: number[] = [validActiveIndex];
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
const slotsToFill = Math.min(maxExpandedEditors - 1, totalEditors - 1);
|
|
401
|
-
|
|
402
|
-
// Expand symmetrically around active editor
|
|
403
|
-
for (let offset = 1; offset <= slotsToFill; offset++) {
|
|
404
|
-
const leftIndex = validActiveIndex - offset;
|
|
405
|
-
const rightIndex = validActiveIndex + offset;
|
|
406
|
-
|
|
407
|
-
// Alternate left and right to maintain symmetry
|
|
408
|
-
if (offset % 2 === 1) {
|
|
409
|
-
// Odd offset: try right first, then left
|
|
410
|
-
if (rightIndex < totalEditors && !expandedIndices.includes(rightIndex)) {
|
|
411
|
-
expandedIndices.push(rightIndex);
|
|
412
|
-
if (expandedIndices.length >= maxExpandedEditors) break;
|
|
413
|
-
}
|
|
414
|
-
if (leftIndex >= 0 && !expandedIndices.includes(leftIndex)) {
|
|
415
|
-
expandedIndices.push(leftIndex);
|
|
416
|
-
if (expandedIndices.length >= maxExpandedEditors) break;
|
|
417
|
-
}
|
|
418
|
-
} else {
|
|
419
|
-
// Even offset: try left first, then right
|
|
420
|
-
if (leftIndex >= 0 && !expandedIndices.includes(leftIndex)) {
|
|
421
|
-
expandedIndices.push(leftIndex);
|
|
422
|
-
if (expandedIndices.length >= maxExpandedEditors) break;
|
|
423
|
-
}
|
|
424
|
-
if (rightIndex < totalEditors && !expandedIndices.includes(rightIndex)) {
|
|
425
|
-
expandedIndices.push(rightIndex);
|
|
426
|
-
if (expandedIndices.length >= maxExpandedEditors) break;
|
|
427
|
-
}
|
|
428
|
-
}
|
|
340
|
+
if (maxEditors > 1) {
|
|
341
|
+
for (let i = totalEditors - 1; i >= 0 && expandedIndices.length < maxEditors; i--) {
|
|
342
|
+
if (i !== validActiveIndex) expandedIndices.push(i);
|
|
429
343
|
}
|
|
430
344
|
}
|
|
431
345
|
|
|
432
|
-
const expandedCount = expandedIndices.length;
|
|
433
|
-
|
|
434
|
-
const end = performance.now();
|
|
435
|
-
cmsLogger.debug(
|
|
436
|
-
'Layout Calc',
|
|
437
|
-
`${(end - start).toFixed(3)}ms | Editors: ${totalEditors} | Expanded: ${expandedCount} | Window: ${windowWidth}px | Active: ${validActiveIndex} | ExpandedIndices: [${expandedIndices.join(', ')}]`
|
|
438
|
-
);
|
|
439
|
-
|
|
440
346
|
return {
|
|
441
347
|
totalEditors,
|
|
442
|
-
expandedCount,
|
|
443
|
-
collapsedCount: totalEditors -
|
|
348
|
+
expandedCount: expandedIndices.length,
|
|
349
|
+
collapsedCount: totalEditors - expandedIndices.length,
|
|
444
350
|
typesCollapsed: !typesExpanded,
|
|
445
351
|
docsCollapsed: !docsExpanded,
|
|
446
352
|
expandedIndices,
|
|
@@ -530,7 +436,7 @@
|
|
|
530
436
|
});
|
|
531
437
|
organizationsMap = map;
|
|
532
438
|
}
|
|
533
|
-
} catch
|
|
439
|
+
} catch {
|
|
534
440
|
toast.error('Failed to fetch organizations');
|
|
535
441
|
}
|
|
536
442
|
}
|
|
@@ -616,7 +522,7 @@
|
|
|
616
522
|
if (historyParam === '1' && !showVersionPanel) {
|
|
617
523
|
showVersionPanel = true;
|
|
618
524
|
versionPanelDocId = stackParam
|
|
619
|
-
? editorStack[editorStack.length - 1]?.documentId ?? docId
|
|
525
|
+
? (editorStack[editorStack.length - 1]?.documentId ?? docId)
|
|
620
526
|
: docId;
|
|
621
527
|
} else if (!historyParam && showVersionPanel) {
|
|
622
528
|
showVersionPanel = false;
|
|
@@ -784,8 +690,8 @@
|
|
|
784
690
|
}
|
|
785
691
|
|
|
786
692
|
// Close version panel when navigating away
|
|
787
|
-
let prevDocType = $state(
|
|
788
|
-
let prevDocId = $state(
|
|
693
|
+
let prevDocType = $state<string | null>(null);
|
|
694
|
+
let prevDocId = $state<string | null>(null);
|
|
789
695
|
let initialNavDone = $state(false);
|
|
790
696
|
$effect(() => {
|
|
791
697
|
if (selectedDocumentType !== prevDocType || editingDocumentId !== prevDocId) {
|
|
@@ -835,9 +741,7 @@
|
|
|
835
741
|
// the same array — replace the whole stack with the new pick.
|
|
836
742
|
// If clicking from within the stacked panel, push deeper.
|
|
837
743
|
const newStack =
|
|
838
|
-
activeEditorIndex === 0 && editorStack.length > 0
|
|
839
|
-
? [newEntry]
|
|
840
|
-
: [...editorStack, newEntry];
|
|
744
|
+
activeEditorIndex === 0 && editorStack.length > 0 ? [newEntry] : [...editorStack, newEntry];
|
|
841
745
|
|
|
842
746
|
// URL tracks the full chain for refresh support
|
|
843
747
|
const stackParam = newStack.map((item) => `${item.documentType}:${item.documentId}`).join(',');
|
|
@@ -1158,7 +1062,9 @@
|
|
|
1158
1062
|
{/if}
|
|
1159
1063
|
</div>
|
|
1160
1064
|
<span class="text-sm"
|
|
1161
|
-
>{docType.singleton
|
|
1065
|
+
>{docType.singleton
|
|
1066
|
+
? docType.title
|
|
1067
|
+
: pluralize(docType.title)}</span
|
|
1162
1068
|
>
|
|
1163
1069
|
</div>
|
|
1164
1070
|
<svg
|
|
@@ -1671,7 +1577,7 @@
|
|
|
1671
1577
|
{#if isExpanded}
|
|
1672
1578
|
<div
|
|
1673
1579
|
class="border-rule h-full flex-1 overflow-x-hidden overflow-y-auto border-l transition-all duration-200"
|
|
1674
|
-
style="min-width: 0;
|
|
1580
|
+
style="min-width: 0;"
|
|
1675
1581
|
>
|
|
1676
1582
|
<DocumentEditor
|
|
1677
1583
|
{schemas}
|
|
@@ -1787,7 +1693,7 @@
|
|
|
1787
1693
|
<p class="text-muted-foreground mb-4">Query your CMS data with the GraphQL API</p>
|
|
1788
1694
|
|
|
1789
1695
|
<a
|
|
1790
|
-
href={
|
|
1696
|
+
href={graphqlSettings.endpoint}
|
|
1791
1697
|
target="_blank"
|
|
1792
1698
|
class="bg-primary text-primary-foreground hover:bg-primary/90 inline-flex items-center gap-2 rounded-md px-4 py-2 transition-colors"
|
|
1793
1699
|
>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AdminApp.svelte.d.ts","sourceRoot":"","sources":["../../src/lib/components/AdminApp.svelte.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"AdminApp.svelte.d.ts","sourceRoot":"","sources":["../../src/lib/components/AdminApp.svelte.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AA2BnE,UAAU,KAAK;IACd,OAAO,EAAE,UAAU,EAAE,CAAC;IACtB,aAAa,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,WAAW,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC5E,WAAW,CAAC,EAAE;QAAE,OAAO,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;IACzC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,eAAe,CAAC,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,cAAc,EAAE,OAAO,CAAA;KAAE,GAAG,IAAI,CAAC;IACvE,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;;OAIG;IACH,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB,oEAAoE;IACpE,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,SAAS,CAAC,EAAE;QAAE,KAAK,EAAE,WAAW,GAAG,QAAQ,GAAG,OAAO,CAAA;KAAE,CAAC;IACxD,eAAe,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACzC,eAAe,CAAC,EAAE,sBAAsB,GAAG,IAAI,CAAC;CAChD;AA+8CF,QAAA,MAAM,QAAQ,2CAAwC,CAAC;AACvD,KAAK,QAAQ,GAAG,UAAU,CAAC,OAAO,QAAQ,CAAC,CAAC;AAC5C,eAAe,QAAQ,CAAC"}
|