@conloca/cms-spa 0.2.2 → 0.2.4
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/README.md +26 -0
- package/dist/spa/main.css +229 -1
- package/dist/ts/.build-inputs.json +187 -0
- package/dist/ts/App.d.ts +5 -1
- package/dist/ts/App.d.ts.map +1 -1
- package/dist/ts/App.js +13 -6
- package/dist/ts/App.js.map +1 -1
- package/dist/ts/CmsSpaApp.d.ts.map +1 -1
- package/dist/ts/CmsSpaApp.js +4 -1
- package/dist/ts/CmsSpaApp.js.map +1 -1
- package/dist/ts/components/CMSDashboard.d.ts.map +1 -1
- package/dist/ts/components/CMSDashboard.js +2 -1
- package/dist/ts/components/CMSDashboard.js.map +1 -1
- package/dist/ts/components/cards/DataEntryCard.d.ts +1 -1
- package/dist/ts/components/cards/DataEntryCard.d.ts.map +1 -1
- package/dist/ts/components/cards/SectionCard.d.ts +1 -1
- package/dist/ts/components/cards/SectionCard.d.ts.map +1 -1
- package/dist/ts/components/dialogs/DeleteConfirmDialog.d.ts +6 -1
- package/dist/ts/components/dialogs/DeleteConfirmDialog.d.ts.map +1 -1
- package/dist/ts/components/dialogs/DeleteConfirmDialog.js +2 -2
- package/dist/ts/components/dialogs/DeleteConfirmDialog.js.map +1 -1
- package/dist/ts/components/dialogs/FragmentPropertiesDialog.d.ts +1 -1
- package/dist/ts/components/dialogs/FragmentPropertiesDialog.d.ts.map +1 -1
- package/dist/ts/components/dialogs/MakePagesEditableDialog.d.ts +10 -0
- package/dist/ts/components/dialogs/MakePagesEditableDialog.d.ts.map +1 -0
- package/dist/ts/components/dialogs/MakePagesEditableDialog.js +35 -0
- package/dist/ts/components/dialogs/MakePagesEditableDialog.js.map +1 -0
- package/dist/ts/components/dialogs/MoveFolderDialog.d.ts +6 -1
- package/dist/ts/components/dialogs/MoveFolderDialog.d.ts.map +1 -1
- package/dist/ts/components/dialogs/MoveFolderDialog.js +3 -3
- package/dist/ts/components/dialogs/MoveFolderDialog.js.map +1 -1
- package/dist/ts/components/editor/CMSMDXEditor.d.ts.map +1 -1
- package/dist/ts/components/editor/CMSMDXEditor.js +53 -62
- package/dist/ts/components/editor/CMSMDXEditor.js.map +1 -1
- package/dist/ts/components/editor/DocsPreviewButton.d.ts +6 -0
- package/dist/ts/components/editor/DocsPreviewButton.d.ts.map +1 -0
- package/dist/ts/components/editor/DocsPreviewButton.js +15 -0
- package/dist/ts/components/editor/DocsPreviewButton.js.map +1 -0
- package/dist/ts/components/editor/ImagePickerDialog.js +2 -2
- package/dist/ts/components/editor/ImagePickerDialog.js.map +1 -1
- package/dist/ts/components/editor/LocaleSelector.d.ts +1 -1
- package/dist/ts/components/editor/LocaleSelector.d.ts.map +1 -1
- package/dist/ts/components/editor/MdxPageEditor.d.ts.map +1 -1
- package/dist/ts/components/editor/MdxPageEditor.js +2 -1
- package/dist/ts/components/editor/MdxPageEditor.js.map +1 -1
- package/dist/ts/components/editor/PageEditor.d.ts +1 -1
- package/dist/ts/components/editor/PageEditor.d.ts.map +1 -1
- package/dist/ts/components/editor/PageEditor.js +47 -19
- package/dist/ts/components/editor/PageEditor.js.map +1 -1
- package/dist/ts/components/editor/PageEditorHeaderActions.d.ts +1 -1
- package/dist/ts/components/editor/PageEditorHeaderActions.d.ts.map +1 -1
- package/dist/ts/components/editor/PageEditorWrapper.js +31 -5
- package/dist/ts/components/editor/PageEditorWrapper.js.map +1 -1
- package/dist/ts/components/editor/draft-media-config.d.ts +32 -2
- package/dist/ts/components/editor/draft-media-config.d.ts.map +1 -1
- package/dist/ts/components/editor/draft-media-config.js +194 -39
- package/dist/ts/components/editor/draft-media-config.js.map +1 -1
- package/dist/ts/components/editor/page-setting-targets.d.ts +1 -1
- package/dist/ts/components/editor/page-setting-targets.d.ts.map +1 -1
- package/dist/ts/components/editor/preview-availability.d.ts +8 -5
- package/dist/ts/components/editor/preview-availability.d.ts.map +1 -1
- package/dist/ts/components/editor/preview-availability.js +8 -5
- package/dist/ts/components/editor/preview-availability.js.map +1 -1
- package/dist/ts/components/editors/DataEditor.d.ts +6 -2
- package/dist/ts/components/editors/DataEditor.d.ts.map +1 -1
- package/dist/ts/components/editors/DataEditor.js +46 -19
- package/dist/ts/components/editors/DataEditor.js.map +1 -1
- package/dist/ts/components/fields/ImageField.js +2 -2
- package/dist/ts/components/fields/ImageField.js.map +1 -1
- package/dist/ts/components/media/AssetCard.d.ts +1 -1
- package/dist/ts/components/media/AssetCard.d.ts.map +1 -1
- package/dist/ts/components/media/AssetCard.js +3 -2
- package/dist/ts/components/media/AssetCard.js.map +1 -1
- package/dist/ts/components/media/AssetDetailSidebar.d.ts +1 -1
- package/dist/ts/components/media/AssetDetailSidebar.d.ts.map +1 -1
- package/dist/ts/components/media/AssetDetailSidebar.js +7 -2
- package/dist/ts/components/media/AssetDetailSidebar.js.map +1 -1
- package/dist/ts/components/media/AssetUsageList.d.ts +13 -0
- package/dist/ts/components/media/AssetUsageList.d.ts.map +1 -0
- package/dist/ts/components/media/AssetUsageList.js +35 -0
- package/dist/ts/components/media/AssetUsageList.js.map +1 -0
- package/dist/ts/components/media/MediaLibrary.d.ts +1 -1
- package/dist/ts/components/media/MediaLibrary.d.ts.map +1 -1
- package/dist/ts/components/media/MediaLibrary.js +6 -4
- package/dist/ts/components/media/MediaLibrary.js.map +1 -1
- package/dist/ts/components/media/MediaToolbar.d.ts +1 -1
- package/dist/ts/components/media/MediaToolbar.d.ts.map +1 -1
- package/dist/ts/components/media/index.d.ts +1 -0
- package/dist/ts/components/media/index.d.ts.map +1 -1
- package/dist/ts/components/media/index.js +1 -0
- package/dist/ts/components/media/index.js.map +1 -1
- package/dist/ts/components/pages/DataList.d.ts.map +1 -1
- package/dist/ts/components/pages/DataList.js +48 -31
- package/dist/ts/components/pages/DataList.js.map +1 -1
- package/dist/ts/components/pages/MediaPage.d.ts.map +1 -1
- package/dist/ts/components/pages/MediaPage.js +7 -5
- package/dist/ts/components/pages/MediaPage.js.map +1 -1
- package/dist/ts/components/pages/NoPagesYet.d.ts +5 -0
- package/dist/ts/components/pages/NoPagesYet.d.ts.map +1 -0
- package/dist/ts/components/pages/NoPagesYet.js +16 -0
- package/dist/ts/components/pages/NoPagesYet.js.map +1 -0
- package/dist/ts/components/pages/PageList.d.ts.map +1 -1
- package/dist/ts/components/pages/PageList.js +19 -8
- package/dist/ts/components/pages/PageList.js.map +1 -1
- package/dist/ts/components/sandbox/ContentSandbox.d.ts +1 -1
- package/dist/ts/components/sandbox/ContentSandbox.d.ts.map +1 -1
- package/dist/ts/components/sandbox/ContentSandbox.js +36 -5
- package/dist/ts/components/sandbox/ContentSandbox.js.map +1 -1
- package/dist/ts/components/ui/IconButton.d.ts +1 -1
- package/dist/ts/components/ui/IconButton.d.ts.map +1 -1
- package/dist/ts/content-wrapper.d.ts +65 -0
- package/dist/ts/content-wrapper.d.ts.map +1 -0
- package/dist/ts/content-wrapper.js +190 -0
- package/dist/ts/content-wrapper.js.map +1 -0
- package/dist/ts/convert-pages.d.ts +30 -0
- package/dist/ts/convert-pages.d.ts.map +1 -0
- package/dist/ts/convert-pages.js +85 -0
- package/dist/ts/convert-pages.js.map +1 -0
- package/dist/ts/data-schemas.d.ts.map +1 -1
- package/dist/ts/frame/channel.d.ts +40 -0
- package/dist/ts/frame/channel.d.ts.map +1 -0
- package/dist/ts/frame/channel.js +233 -0
- package/dist/ts/frame/channel.js.map +1 -0
- package/dist/ts/frame/editor-frame.d.ts +23 -0
- package/dist/ts/frame/editor-frame.d.ts.map +1 -0
- package/dist/ts/frame/editor-frame.js +159 -0
- package/dist/ts/frame/editor-frame.js.map +1 -0
- package/dist/ts/frame/media-cache.d.ts +37 -0
- package/dist/ts/frame/media-cache.d.ts.map +1 -0
- package/dist/ts/frame/media-cache.js +138 -0
- package/dist/ts/frame/media-cache.js.map +1 -0
- package/dist/ts/frame/memory-router.d.ts +10 -0
- package/dist/ts/frame/memory-router.d.ts.map +1 -0
- package/dist/ts/frame/memory-router.js +39 -0
- package/dist/ts/frame/memory-router.js.map +1 -0
- package/dist/ts/frame/parent-hello.d.ts +11 -0
- package/dist/ts/frame/parent-hello.d.ts.map +1 -0
- package/dist/ts/frame/parent-hello.js +53 -0
- package/dist/ts/frame/parent-hello.js.map +1 -0
- package/dist/ts/frame/protocol.d.ts +209 -0
- package/dist/ts/frame/protocol.d.ts.map +1 -0
- package/dist/ts/frame/protocol.js +200 -0
- package/dist/ts/frame/protocol.js.map +1 -0
- package/dist/ts/frame/rpc-content-client.d.ts +10 -0
- package/dist/ts/frame/rpc-content-client.d.ts.map +1 -0
- package/dist/ts/frame/rpc-content-client.js +51 -0
- package/dist/ts/frame/rpc-content-client.js.map +1 -0
- package/dist/ts/frame/save-shortcut.d.ts +8 -0
- package/dist/ts/frame/save-shortcut.d.ts.map +1 -0
- package/dist/ts/frame/save-shortcut.js +26 -0
- package/dist/ts/frame/save-shortcut.js.map +1 -0
- package/dist/ts/hooks/index.d.ts +2 -0
- package/dist/ts/hooks/index.d.ts.map +1 -1
- package/dist/ts/hooks/index.js +1 -0
- package/dist/ts/hooks/index.js.map +1 -1
- package/dist/ts/hooks/usePageConversion.d.ts +11 -0
- package/dist/ts/hooks/usePageConversion.d.ts.map +1 -0
- package/dist/ts/hooks/usePageConversion.js +47 -0
- package/dist/ts/hooks/usePageConversion.js.map +1 -0
- package/dist/ts/hooks/useUploadFlow.d.ts.map +1 -1
- package/dist/ts/hooks/useUploadFlow.js +41 -7
- package/dist/ts/hooks/useUploadFlow.js.map +1 -1
- package/dist/ts/host-style-probe.d.ts +32 -37
- package/dist/ts/host-style-probe.d.ts.map +1 -1
- package/dist/ts/host-style-probe.js +86 -68
- package/dist/ts/host-style-probe.js.map +1 -1
- package/dist/ts/index.d.ts +6 -2
- package/dist/ts/index.d.ts.map +1 -1
- package/dist/ts/index.js +9 -2
- package/dist/ts/index.js.map +1 -1
- package/dist/ts/main-spa.d.ts.map +1 -1
- package/dist/ts/main-spa.js +2 -1
- package/dist/ts/main-spa.js.map +1 -1
- package/dist/ts/media/prepare-image-upload.d.ts +19 -0
- package/dist/ts/media/prepare-image-upload.d.ts.map +1 -0
- package/dist/ts/media/prepare-image-upload.js +93 -0
- package/dist/ts/media/prepare-image-upload.js.map +1 -0
- package/dist/ts/media/use-asset-serve-src.d.ts +7 -0
- package/dist/ts/media/use-asset-serve-src.d.ts.map +1 -0
- package/dist/ts/media/use-asset-serve-src.js +17 -0
- package/dist/ts/media/use-asset-serve-src.js.map +1 -0
- package/dist/ts/page-schemas.d.ts.map +1 -1
- package/dist/ts/prose-surface-css.d.ts +3 -5
- package/dist/ts/prose-surface-css.d.ts.map +1 -1
- package/dist/ts/prose-surface-css.js +3 -5
- package/dist/ts/prose-surface-css.js.map +1 -1
- package/dist/ts/puck-config.d.ts.map +1 -1
- package/dist/ts/selected-block.d.ts.map +1 -1
- package/dist/ts/site-styles.d.ts +4 -21
- package/dist/ts/site-styles.d.ts.map +1 -1
- package/dist/ts/site-styles.js.map +1 -1
- package/dist/ts/ui-config.d.ts +62 -3
- package/dist/ts/ui-config.d.ts.map +1 -1
- package/dist/ts/ui-config.js +18 -0
- package/dist/ts/ui-config.js.map +1 -1
- package/dist/ts/utils/asset-url.d.ts +3 -0
- package/dist/ts/utils/asset-url.d.ts.map +1 -1
- package/dist/ts/utils/asset-url.js +4 -0
- package/dist/ts/utils/asset-url.js.map +1 -1
- package/dist/ts/utils/data-entry-validation.d.ts +11 -0
- package/dist/ts/utils/data-entry-validation.d.ts.map +1 -0
- package/dist/ts/utils/data-entry-validation.js +15 -0
- package/dist/ts/utils/data-entry-validation.js.map +1 -0
- package/package.json +20 -11
- package/src/App.tsx +22 -10
- package/src/CmsSpaApp.tsx +5 -1
- package/src/components/CMSDashboard.tsx +16 -8
- package/src/components/dialogs/DeleteConfirmDialog.tsx +14 -1
- package/src/components/dialogs/MakePagesEditableDialog.tsx +112 -0
- package/src/components/dialogs/MoveFolderDialog.tsx +9 -2
- package/src/components/editor/CMSMDXEditor.tsx +56 -76
- package/src/components/editor/DocsPreviewButton.tsx +25 -0
- package/src/components/editor/ImagePickerDialog.tsx +2 -2
- package/src/components/editor/MdxPageEditor.tsx +2 -0
- package/src/components/editor/PageEditor.tsx +46 -22
- package/src/components/editor/PageEditorWrapper.tsx +34 -5
- package/src/components/editor/draft-media-config.ts +199 -41
- package/src/components/editor/preview-availability.ts +9 -5
- package/src/components/editors/DataEditor.tsx +65 -32
- package/src/components/fields/ImageField.tsx +2 -2
- package/src/components/media/AssetCard.tsx +12 -9
- package/src/components/media/AssetDetailSidebar.tsx +38 -25
- package/src/components/media/AssetUsageList.tsx +84 -0
- package/src/components/media/MediaLibrary.tsx +6 -4
- package/src/components/media/index.ts +1 -0
- package/src/components/pages/DataList.tsx +53 -29
- package/src/components/pages/MediaPage.tsx +14 -5
- package/src/components/pages/NoPagesYet.tsx +41 -0
- package/src/components/pages/PageList.tsx +40 -27
- package/src/components/sandbox/ContentSandbox.tsx +34 -5
- package/src/content-wrapper.ts +284 -0
- package/src/convert-pages.ts +110 -0
- package/src/frame/channel.ts +258 -0
- package/src/frame/editor-frame.ts +184 -0
- package/src/frame/media-cache.ts +157 -0
- package/src/frame/memory-router.ts +39 -0
- package/src/frame/parent-hello.ts +62 -0
- package/src/frame/protocol.ts +332 -0
- package/src/frame/rpc-content-client.ts +58 -0
- package/src/frame/save-shortcut.ts +25 -0
- package/src/hooks/index.ts +2 -0
- package/src/hooks/usePageConversion.ts +55 -0
- package/src/hooks/useUploadFlow.ts +44 -7
- package/src/host-style-probe.ts +104 -90
- package/src/index.ts +10 -2
- package/src/main-spa.tsx +2 -0
- package/src/main.css +2 -1
- package/src/media/prepare-image-upload.ts +118 -0
- package/src/media/use-asset-serve-src.ts +22 -0
- package/src/prose-surface-css.ts +3 -5
- package/src/site-styles.ts +4 -22
- package/src/ui-config.ts +74 -3
- package/src/utils/asset-url.ts +6 -0
- package/src/utils/data-entry-validation.ts +16 -0
- package/dist/ts/host-discovery.d.ts +0 -40
- package/dist/ts/host-discovery.d.ts.map +0 -1
- package/dist/ts/host-discovery.js +0 -39
- package/dist/ts/host-discovery.js.map +0 -1
- package/src/host-discovery.ts +0 -77
|
@@ -1,33 +1,122 @@
|
|
|
1
1
|
/** Resolve unpublished draft images for site renderers without changing Puck's persisted data. */
|
|
2
|
-
|
|
3
|
-
import
|
|
2
|
+
/* oxlint-disable anti-slop/no-unsafe-dictionary-type, anti-slop/no-unknown-returns -- block props are whatever the site's components take; this walk only swaps image strings and passes every other value through as it came. */
|
|
3
|
+
import { draftMediaRefPath, mediaRefPath } from '@conloca/content-api-client';
|
|
4
|
+
import type { Config, Field, Fields, PuckContext } from '@puckeditor/core';
|
|
4
5
|
import { type ComponentType, createElement, isValidElement } from 'react';
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
6
|
+
import { loadedMedia, mediaLoadState, useMediaCacheVersion } from '../../frame/media-cache.js';
|
|
7
|
+
import type { MediaLoadInput } from '../../frame/protocol.js';
|
|
8
|
+
import { getUIConfig } from '../../ui-config.js';
|
|
9
|
+
|
|
10
|
+
/** A 1×1 transparent GIF: what an image shows until its bytes arrive, and a draft address after a failed load. */
|
|
11
|
+
export const DRAFT_IMAGE_PLACEHOLDER = 'data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7';
|
|
12
|
+
|
|
13
|
+
/** What a stored image link renders as; `undefined` keeps the stored value. */
|
|
14
|
+
type DraftImageResolver = (source: MediaLoadInput) => string | undefined;
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* The one decision of where an image value's bytes come from: a draft address, or a link under the image folder
|
|
18
|
+
* URL (`UIConfig.assetRefBase`, `/assets` by default). A link is URL text, so each segment is decoded once, as
|
|
19
|
+
* the site's static host does; an escape that would change the path (a bad one, or a decoded `/`, `\`, control
|
|
20
|
+
* character, `.` or `..`) makes it no image of ours.
|
|
21
|
+
*/
|
|
22
|
+
export function mediaSourceOf(value: string): MediaLoadInput | undefined {
|
|
23
|
+
const draftPath = draftMediaRefPath(value);
|
|
24
|
+
if (draftPath !== undefined) return { route: 'serve', path: draftPath };
|
|
25
|
+
const linked = mediaRefPath(value, getUIConfig().assetRefBase ?? '/assets');
|
|
26
|
+
if (linked === undefined) return undefined;
|
|
27
|
+
const segments: string[] = [];
|
|
28
|
+
for (const segment of linked.split('/')) {
|
|
29
|
+
let part: string;
|
|
30
|
+
try {
|
|
31
|
+
part = decodeURIComponent(segment);
|
|
32
|
+
} catch {
|
|
33
|
+
return undefined;
|
|
20
34
|
}
|
|
35
|
+
const control = Array.from(part, (char) => char.charCodeAt(0)).some((code) => code < 32 || code === 127);
|
|
36
|
+
if (part === '.' || part === '..' || /[/\\]/.test(part) || control) return undefined;
|
|
37
|
+
segments.push(part);
|
|
21
38
|
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
const
|
|
28
|
-
|
|
39
|
+
return { route: 'repo', path: segments.join('/') };
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/** What an image value shows in the canvas once a loader is set: its bytes when loaded, else the placeholder. */
|
|
43
|
+
function shownImage({ route, path }: MediaLoadInput): string {
|
|
44
|
+
const state = mediaLoadState(route, path);
|
|
45
|
+
return state?.status === 'loaded' ? state.url : DRAFT_IMAGE_PLACEHOLDER;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* What the MDX editor canvas shows for an image `src`: the loaded bytes of a draft or repository image, else the
|
|
50
|
+
* placeholder; any other `src` itself, as is a repository link when no loader is set (the site serves it).
|
|
51
|
+
* The URL is the media cache's own, which a media write or eviction revokes; mdxeditor resolves an image again only
|
|
52
|
+
* when its `src` changes or it remounts, so a mounted image keeps painting its decoded bytes from a revoked URL.
|
|
53
|
+
*/
|
|
54
|
+
export async function draftImagePreview(src: string): Promise<string> {
|
|
55
|
+
const source = mediaSourceOf(src);
|
|
56
|
+
if (source === undefined) return src;
|
|
57
|
+
const url = (await loadedMedia(source.route, source.path))?.url;
|
|
58
|
+
if (url !== undefined) return url;
|
|
59
|
+
return source.route === 'repo' && !getUIConfig().loadMedia ? src : DRAFT_IMAGE_PLACEHOLDER;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
function dataUrl(blob: Blob): Promise<string> {
|
|
63
|
+
// The package's lib target predates Promise.withResolvers.
|
|
64
|
+
return new Promise((resolve, reject) => {
|
|
65
|
+
const reader = new FileReader();
|
|
66
|
+
reader.addEventListener('load', () => {
|
|
67
|
+
if (typeof reader.result === 'string') resolve(reader.result);
|
|
68
|
+
else reject(new Error('The image could not be read as a data URL.'));
|
|
69
|
+
});
|
|
70
|
+
reader.addEventListener('error', () => {
|
|
71
|
+
reject(reader.error ?? new Error('The image could not be read.'));
|
|
72
|
+
});
|
|
73
|
+
reader.readAsDataURL(blob);
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
// Keyed by the cached Blob, so a cleared or evicted cache entry frees its string too.
|
|
78
|
+
const dataUrls = new WeakMap<Blob, Promise<string>>();
|
|
79
|
+
|
|
80
|
+
async function draftImageDataUrl({ route, path }: MediaLoadInput): Promise<string | undefined> {
|
|
81
|
+
const media = await loadedMedia(route, path);
|
|
82
|
+
if (!media) return undefined;
|
|
83
|
+
let url = dataUrls.get(media.blob);
|
|
84
|
+
if (!url) {
|
|
85
|
+
url = dataUrl(media.blob);
|
|
86
|
+
dataUrls.set(media.blob, url);
|
|
87
|
+
}
|
|
88
|
+
return url;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/** How long a preview update waits for its draft images before it goes without the ones still loading. */
|
|
92
|
+
export const DRAFT_IMAGE_WAIT_MS = 5000;
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Data URLs of the images compiled MDX or sanitized HTML names, keyed by their stored value, for the opaque-origin
|
|
96
|
+
* preview frame, which cannot read this page's blob URLs: an `src`, an HTML `src="…"` attribute or an MDX
|
|
97
|
+
* component's prop. Images that fail to load, or are still loading after `DRAFT_IMAGE_WAIT_MS`, show the placeholder;
|
|
98
|
+
* without a loader a repository link is left out, so the frame loads it from the site.
|
|
99
|
+
*/
|
|
100
|
+
export async function draftImageData(code: string): Promise<Record<string, string>> {
|
|
101
|
+
// shortcut: finds values only as plain double-quoted literals, the form the MDX compiler and the HTML sanitizer emit; widen if an escaped path must preview.
|
|
102
|
+
const literals = code.match(/"[^"\\]*"/g);
|
|
103
|
+
const srcs = new Set(literals?.map((literal) => literal.slice(1, -1)));
|
|
104
|
+
const images: Record<string, string> = {};
|
|
105
|
+
let timer: number | undefined;
|
|
106
|
+
const expired = new Promise<undefined>((resolve) => {
|
|
107
|
+
timer = window.setTimeout(resolve, DRAFT_IMAGE_WAIT_MS, undefined);
|
|
108
|
+
});
|
|
109
|
+
const loader = getUIConfig().loadMedia !== undefined;
|
|
110
|
+
await Promise.all(
|
|
111
|
+
[...srcs].map(async (src) => {
|
|
112
|
+
const source = mediaSourceOf(src);
|
|
113
|
+
if (source === undefined || (source.route === 'repo' && !loader)) return;
|
|
114
|
+
const url = await Promise.race([draftImageDataUrl(source).catch(() => undefined), expired]);
|
|
115
|
+
images[src] = url ?? DRAFT_IMAGE_PLACEHOLDER;
|
|
116
|
+
}),
|
|
29
117
|
);
|
|
30
|
-
|
|
118
|
+
window.clearTimeout(timer);
|
|
119
|
+
return images;
|
|
31
120
|
}
|
|
32
121
|
|
|
33
122
|
function isRecord(value: unknown): value is Record<string, unknown> {
|
|
@@ -36,23 +125,39 @@ function isRecord(value: unknown): value is Record<string, unknown> {
|
|
|
36
125
|
return prototype === Object.prototype || prototype === null;
|
|
37
126
|
}
|
|
38
127
|
|
|
39
|
-
|
|
128
|
+
/** What the canvas shows for a string: what `resolve` decides when `mediaSourceOf` reads it as an image, else itself. */
|
|
129
|
+
function imageValue(value: string, resolve: DraftImageResolver): string {
|
|
130
|
+
const source = mediaSourceOf(value);
|
|
131
|
+
return source === undefined ? value : (resolve(source) ?? value);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/** `items` mapped by `map`, or `items` itself when no item changed. */
|
|
135
|
+
function mapped(items: unknown[], map: (item: unknown) => unknown): unknown[] {
|
|
136
|
+
const next = items.map(map);
|
|
137
|
+
return next.some((item, index) => item !== items[index]) ? next : items;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
function fieldValue(value: unknown, field: Field, resolve: DraftImageResolver): unknown {
|
|
40
141
|
if (field.type === 'slot') return value;
|
|
41
|
-
if (typeof value === 'string') return
|
|
42
|
-
if (field.type === 'object' && isRecord(value)) return fieldProps(value, field.objectFields,
|
|
142
|
+
if (typeof value === 'string') return imageValue(value, resolve);
|
|
143
|
+
if (field.type === 'object' && isRecord(value)) return fieldProps(value, field.objectFields, resolve);
|
|
43
144
|
if (field.type === 'array' && Array.isArray(value)) {
|
|
44
|
-
|
|
45
|
-
return next.some((item, index) => item !== value[index]) ? next : value;
|
|
145
|
+
return mapped(value, (item) => (isRecord(item) ? fieldProps(item, field.arrayFields, resolve) : item));
|
|
46
146
|
}
|
|
47
147
|
return value;
|
|
48
148
|
}
|
|
49
149
|
|
|
50
|
-
function fieldProps(
|
|
150
|
+
function fieldProps(
|
|
151
|
+
props: Record<string, unknown>,
|
|
152
|
+
fields: Fields | undefined,
|
|
153
|
+
resolve: DraftImageResolver,
|
|
154
|
+
): Record<string, unknown> {
|
|
51
155
|
let next = props;
|
|
52
156
|
for (const [name, field] of Object.entries(fields ?? {})) {
|
|
53
157
|
if (name === 'puck' || name === 'children' || name === 'editMode') continue;
|
|
158
|
+
// biome-ignore lint/suspicious/noPrototypeBuiltins: Object.hasOwn is past this package's ES2020 lib.
|
|
54
159
|
if (field === undefined || !Object.prototype.hasOwnProperty.call(props, name)) continue;
|
|
55
|
-
const value = fieldValue(props[name], field,
|
|
160
|
+
const value = fieldValue(props[name], field, resolve);
|
|
56
161
|
if (value === props[name]) continue;
|
|
57
162
|
if (next === props) next = { ...props };
|
|
58
163
|
next[name] = value;
|
|
@@ -60,9 +165,50 @@ function fieldProps(props: Record<string, unknown>, fields: Fields | undefined,
|
|
|
60
165
|
return next;
|
|
61
166
|
}
|
|
62
167
|
|
|
63
|
-
/**
|
|
64
|
-
|
|
65
|
-
if (
|
|
168
|
+
/** Page settings with every string in them read as a possible image, as the branch save scans them for uploads. */
|
|
169
|
+
function settingsValue(value: unknown, resolve: DraftImageResolver): unknown {
|
|
170
|
+
if (typeof value === 'string') return imageValue(value, resolve);
|
|
171
|
+
if (Array.isArray(value)) return mapped(value, (item) => settingsValue(item, resolve));
|
|
172
|
+
if (!isRecord(value)) return value;
|
|
173
|
+
let next = value;
|
|
174
|
+
for (const [name, item] of Object.entries(value)) {
|
|
175
|
+
const shown = settingsValue(item, resolve);
|
|
176
|
+
if (shown === item) continue;
|
|
177
|
+
if (next === value) next = { ...value };
|
|
178
|
+
next[name] = shown;
|
|
179
|
+
}
|
|
180
|
+
return next;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
/** The page with its settings' images shown; everything else on it, its Dates included, as given. */
|
|
184
|
+
function pageWithImages(page: unknown, resolve: DraftImageResolver): unknown {
|
|
185
|
+
if (!isRecord(page)) return page;
|
|
186
|
+
const meta = settingsValue(page.meta, resolve);
|
|
187
|
+
return meta === page.meta ? page : { ...page, meta };
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
/**
|
|
191
|
+
* `puck` with the images in the page settings its metadata carries, the page's own and each page its route binds,
|
|
192
|
+
* shown as `resolve` decides: a block such as an article header shows a page setting without a field of its own.
|
|
193
|
+
*/
|
|
194
|
+
function puckWithImages(puck: PuckContext, resolve: DraftImageResolver): PuckContext {
|
|
195
|
+
const { metadata } = puck;
|
|
196
|
+
if (!isRecord(metadata)) return puck;
|
|
197
|
+
const page = pageWithImages(metadata.page, resolve);
|
|
198
|
+
const pages = Array.isArray(metadata.pages)
|
|
199
|
+
? mapped(metadata.pages, (item) => pageWithImages(item, resolve))
|
|
200
|
+
: metadata.pages;
|
|
201
|
+
if (page === metadata.page && pages === metadata.pages) return puck;
|
|
202
|
+
return { ...puck, metadata: { ...metadata, page, pages } };
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
/**
|
|
206
|
+
* Static declared fields bound traversal, plus the page settings in `puck.metadata`; dynamic field resolvers and
|
|
207
|
+
* other runtime contexts remain untouched. Every image value `mediaSourceOf` accepts shows what `shownImage`
|
|
208
|
+
* decides; `config` itself without `UIConfig.loadMedia`, so every value renders as stored.
|
|
209
|
+
*/
|
|
210
|
+
export function withDraftMediaRendering(config: Config): Config {
|
|
211
|
+
if (getUIConfig().loadMedia === undefined) return config;
|
|
66
212
|
const root = config.root;
|
|
67
213
|
const rootRender = root?.render;
|
|
68
214
|
return {
|
|
@@ -73,11 +219,17 @@ export function withDraftMediaRendering(config: Config, base: string | undefined
|
|
|
73
219
|
...root,
|
|
74
220
|
// Rendered as an element so memo/forwardRef roots keep working. Root props are a
|
|
75
221
|
// children/no-children union, so name the component's own prop type for createElement.
|
|
76
|
-
render: (props: Parameters<typeof rootRender>[0]) =>
|
|
77
|
-
|
|
222
|
+
render: (props: Parameters<typeof rootRender>[0]) => {
|
|
223
|
+
// Re-render when a loaded image arrives.
|
|
224
|
+
useMediaCacheVersion();
|
|
225
|
+
// SAFETY: `props` is typed from `rootRender` itself; the cast only picks one member of Puck's root union.
|
|
226
|
+
// oxlint-disable-next-line typescript/no-unsafe-type-assertion -- see the SAFETY note.
|
|
227
|
+
return createElement(rootRender as ComponentType<typeof props>, {
|
|
78
228
|
...props,
|
|
79
|
-
...fieldProps(props, root.fields,
|
|
80
|
-
|
|
229
|
+
...fieldProps(props, root.fields, shownImage),
|
|
230
|
+
puck: puckWithImages(props.puck, shownImage),
|
|
231
|
+
});
|
|
232
|
+
},
|
|
81
233
|
},
|
|
82
234
|
}
|
|
83
235
|
: {}),
|
|
@@ -86,8 +238,14 @@ export function withDraftMediaRendering(config: Config, base: string | undefined
|
|
|
86
238
|
name,
|
|
87
239
|
{
|
|
88
240
|
...component,
|
|
89
|
-
render: (props: Parameters<typeof component.render>[0]) =>
|
|
90
|
-
|
|
241
|
+
render: (props: Parameters<typeof component.render>[0]) => {
|
|
242
|
+
useMediaCacheVersion();
|
|
243
|
+
return createElement(component.render, {
|
|
244
|
+
...props,
|
|
245
|
+
...fieldProps(props, component.fields, shownImage),
|
|
246
|
+
puck: puckWithImages(props.puck, shownImage),
|
|
247
|
+
});
|
|
248
|
+
},
|
|
91
249
|
},
|
|
92
250
|
]),
|
|
93
251
|
),
|
|
@@ -8,13 +8,17 @@
|
|
|
8
8
|
* `@lexical`.
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
-
/** Toast heading when the
|
|
12
|
-
export const PREVIEW_UNAVAILABLE_TITLE = 'Preview is not available for this
|
|
11
|
+
/** Toast heading when the branch cannot show a preview. */
|
|
12
|
+
export const PREVIEW_UNAVAILABLE_TITLE = 'Preview is not available for this branch';
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
15
|
* The explanation, used both as the toast body and as the disabled control's
|
|
16
|
-
* reason.
|
|
17
|
-
*
|
|
16
|
+
* reason. Preview support is checked per branch (one origin can serve one
|
|
17
|
+
* branch's drafts and not another's), so it names the branch, never the whole
|
|
18
|
+
* site; it reassures that nothing they did is broken.
|
|
18
19
|
*/
|
|
19
20
|
export const PREVIEW_UNAVAILABLE_DETAIL =
|
|
20
|
-
'This
|
|
21
|
+
'This branch has no preview server, so there is no preview page to open. Your draft is still saved, and publishing and the live site are unaffected.';
|
|
22
|
+
|
|
23
|
+
/** What the Preview control on a docs (MDX) page says until docs pages render drafts. */
|
|
24
|
+
export const DOCS_PREVIEW_UNAVAILABLE = "Full-page preview isn't available for docs pages yet";
|
|
@@ -1,18 +1,27 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
type DataCollectionEntry,
|
|
3
|
+
getContentAPIClient,
|
|
4
|
+
useLocalizedContent,
|
|
5
|
+
useUpdateLocalized,
|
|
6
|
+
} from '@conloca/content-api-client';
|
|
2
7
|
import { AlertCircle, Code2, Loader2, Save } from 'lucide-react';
|
|
3
8
|
import { useEffect, useRef, useState } from 'react';
|
|
4
|
-
import type
|
|
9
|
+
import { type HostSchema, isHostSchema } from '../../host-schema.js';
|
|
5
10
|
import { contentFailureMessage } from '../../utils/content-failure.js';
|
|
11
|
+
import { validateEntryData } from '../../utils/data-entry-validation.js';
|
|
6
12
|
import { UnsavedChangesDialog } from '../dialogs/UnsavedChangesDialog.js';
|
|
7
13
|
import { LocaleSelector } from '../editor/LocaleSelector.js';
|
|
8
14
|
import { SchemaForm } from '../forms/SchemaForm.js';
|
|
9
15
|
|
|
10
16
|
interface DataEditorProps {
|
|
17
|
+
/** The entry's id, or '' for a new entry, which `create` writes on the first Save. */
|
|
11
18
|
id: string;
|
|
12
19
|
collection: string;
|
|
13
20
|
initialLocale: string;
|
|
14
21
|
existingLocales: string[];
|
|
15
22
|
schema: HostSchema | null;
|
|
23
|
+
/** Writes a new entry holding `data`; resolves true once it is created. */
|
|
24
|
+
create?: (data: DataCollectionEntry['data']) => Promise<boolean>;
|
|
16
25
|
onSave?: () => void;
|
|
17
26
|
onCancel?: () => void;
|
|
18
27
|
}
|
|
@@ -28,6 +37,7 @@ export function DataEditor({
|
|
|
28
37
|
initialLocale,
|
|
29
38
|
existingLocales,
|
|
30
39
|
schema,
|
|
40
|
+
create,
|
|
31
41
|
onSave,
|
|
32
42
|
onCancel,
|
|
33
43
|
}: DataEditorProps) {
|
|
@@ -47,6 +57,8 @@ export function DataEditor({
|
|
|
47
57
|
const [values, setValues] = useState<Record<string, unknown>>({});
|
|
48
58
|
const [hasChanges, setHasChanges] = useState(false);
|
|
49
59
|
const [saveError, setSaveError] = useState<string | null>(null);
|
|
60
|
+
const [saving, setSaving] = useState(false);
|
|
61
|
+
const isNew = id === '';
|
|
50
62
|
|
|
51
63
|
// Initialize form values and etag when entry loads
|
|
52
64
|
useEffect(() => {
|
|
@@ -67,28 +79,46 @@ export function DataEditor({
|
|
|
67
79
|
setHasChanges(true);
|
|
68
80
|
};
|
|
69
81
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
82
|
+
/**
|
|
83
|
+
* Writes the form once it passes the schema, as the build validates the entry; resolves whether it
|
|
84
|
+
* was written.
|
|
85
|
+
*/
|
|
86
|
+
const handleSave = async (): Promise<boolean> => {
|
|
87
|
+
if (saving || !isHostSchema(schema)) return false;
|
|
88
|
+
const invalid = validateEntryData(schema, values);
|
|
89
|
+
setSaveError(invalid);
|
|
90
|
+
if (invalid) return false;
|
|
73
91
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
});
|
|
92
|
+
setSaving(true);
|
|
93
|
+
try {
|
|
94
|
+
if (isNew) {
|
|
95
|
+
const created = (await create?.(values)) ?? false;
|
|
96
|
+
if (created) onSave?.();
|
|
97
|
+
return created;
|
|
98
|
+
}
|
|
82
99
|
|
|
83
|
-
|
|
100
|
+
const result = await updateLocalized.mutateAsync({
|
|
101
|
+
id,
|
|
102
|
+
locale: currentLocale,
|
|
103
|
+
data: {
|
|
104
|
+
content: { data: values },
|
|
105
|
+
},
|
|
106
|
+
etag: currentEtag,
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
if (!result.success) {
|
|
110
|
+
setSaveError(contentFailureMessage(result, 'Failed to save data'));
|
|
111
|
+
return false;
|
|
112
|
+
}
|
|
84
113
|
setHasChanges(false);
|
|
85
114
|
savedValuesRef.current = values;
|
|
86
115
|
if (result.etag) {
|
|
87
116
|
setCurrentEtag(result.etag);
|
|
88
117
|
}
|
|
89
118
|
onSave?.();
|
|
90
|
-
|
|
91
|
-
|
|
119
|
+
return true;
|
|
120
|
+
} finally {
|
|
121
|
+
setSaving(false);
|
|
92
122
|
}
|
|
93
123
|
};
|
|
94
124
|
|
|
@@ -131,11 +161,12 @@ export function DataEditor({
|
|
|
131
161
|
const handleUnsavedDialogSave = async () => {
|
|
132
162
|
if (!pendingLocaleSwitch) return;
|
|
133
163
|
|
|
134
|
-
// Save current content first
|
|
164
|
+
// Save current content first; a refused save keeps the locale and the edits, with the reason shown.
|
|
135
165
|
try {
|
|
136
|
-
await handleSave();
|
|
166
|
+
const saved = await handleSave();
|
|
137
167
|
setShowUnsavedDialog(false);
|
|
138
|
-
await switchLocale(pendingLocaleSwitch);
|
|
168
|
+
if (saved) await switchLocale(pendingLocaleSwitch);
|
|
169
|
+
else setPendingLocaleSwitch(null);
|
|
139
170
|
} catch (error) {
|
|
140
171
|
// Don't switch if save failed
|
|
141
172
|
console.error('Failed to save before locale switch:', error);
|
|
@@ -196,15 +227,17 @@ export function DataEditor({
|
|
|
196
227
|
return (
|
|
197
228
|
<>
|
|
198
229
|
<div className="space-y-6">
|
|
199
|
-
{/* Locale selector header - only show existing locales */}
|
|
200
|
-
|
|
201
|
-
<
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
230
|
+
{/* Locale selector header - only show existing locales; a new entry has one, the one it is created in */}
|
|
231
|
+
{!isNew && (
|
|
232
|
+
<div className="flex items-center gap-3 pb-4 border-b border-grey-09 dark:border-grey-03">
|
|
233
|
+
<span className="text-sm text-grey-04 dark:text-grey-07">Locale:</span>
|
|
234
|
+
<LocaleSelector
|
|
235
|
+
currentLocale={currentLocale}
|
|
236
|
+
availableLocales={existingLocales}
|
|
237
|
+
onChange={handleLocaleChange}
|
|
238
|
+
/>
|
|
239
|
+
</div>
|
|
240
|
+
)}
|
|
208
241
|
|
|
209
242
|
<SchemaForm schema={schema} values={values} onChange={handleChange} />
|
|
210
243
|
|
|
@@ -220,7 +253,7 @@ export function DataEditor({
|
|
|
220
253
|
{hasChanges ? (
|
|
221
254
|
<span className="text-yellow-05 dark:text-yellow-07">Unsaved changes</span>
|
|
222
255
|
) : (
|
|
223
|
-
<span>No changes</span>
|
|
256
|
+
<span>{isNew ? 'Not saved yet' : 'No changes'}</span>
|
|
224
257
|
)}
|
|
225
258
|
</div>
|
|
226
259
|
|
|
@@ -229,7 +262,7 @@ export function DataEditor({
|
|
|
229
262
|
<button
|
|
230
263
|
type="button"
|
|
231
264
|
onClick={onCancel}
|
|
232
|
-
disabled={
|
|
265
|
+
disabled={saving}
|
|
233
266
|
className="px-4 py-2 border border-grey-09 dark:border-grey-03 rounded-md hover:bg-grey-11 dark:hover:bg-grey-03 transition-colors disabled:opacity-50"
|
|
234
267
|
>
|
|
235
268
|
Cancel
|
|
@@ -238,10 +271,10 @@ export function DataEditor({
|
|
|
238
271
|
<button
|
|
239
272
|
type="button"
|
|
240
273
|
onClick={handleSave}
|
|
241
|
-
disabled={!hasChanges ||
|
|
274
|
+
disabled={(!hasChanges && !isNew) || saving || !isHostSchema(schema)}
|
|
242
275
|
className="px-4 py-2 bg-azure-04 text-white rounded-md hover:bg-azure-03 transition-colors disabled:opacity-50 disabled:cursor-not-allowed inline-flex items-center gap-2"
|
|
243
276
|
>
|
|
244
|
-
{
|
|
277
|
+
{saving ? (
|
|
245
278
|
<>
|
|
246
279
|
<Loader2 className="h-4 w-4 animate-spin" />
|
|
247
280
|
Saving...
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { FolderOpen } from 'lucide-react';
|
|
2
2
|
import { useEffect, useState } from 'react';
|
|
3
3
|
import type { AssetEntry } from '../../hooks/index.js';
|
|
4
|
-
import {
|
|
4
|
+
import { assetRefOf } from '../../utils/asset-url.js';
|
|
5
5
|
import { ImagePicker } from '../media/ImagePicker.js';
|
|
6
6
|
import { Input } from '../ui/index.js';
|
|
7
7
|
|
|
@@ -33,7 +33,7 @@ export function ImageFieldRender({ value, onChange, inputId }: ImageFieldRenderP
|
|
|
33
33
|
}, [value]);
|
|
34
34
|
|
|
35
35
|
const handleSelect = (asset: AssetEntry) => {
|
|
36
|
-
const assetPath =
|
|
36
|
+
const assetPath = assetRefOf(asset);
|
|
37
37
|
onChange(assetPath);
|
|
38
38
|
setLocalValue(assetPath);
|
|
39
39
|
setModalOpen(false);
|
|
@@ -2,8 +2,8 @@ import type { AssetEntry } from '../../hooks/index.js';
|
|
|
2
2
|
import { AssetScopePill } from '../../media/AssetScopePill.js';
|
|
3
3
|
import { MediaIssueBadge } from '../../media/MediaIssueBadge.js';
|
|
4
4
|
import { useAssetScope } from '../../media/use-asset-scope.js';
|
|
5
|
+
import { useAssetServeSrc } from '../../media/use-asset-serve-src.js';
|
|
5
6
|
import { useMediaIssue } from '../../media/use-media-issue.js';
|
|
6
|
-
import { buildAssetServeUrl } from '../../utils/asset-url.js';
|
|
7
7
|
import { cn } from '../../utils/cn.js';
|
|
8
8
|
|
|
9
9
|
interface AssetCardProps {
|
|
@@ -33,6 +33,7 @@ export function AssetCard({
|
|
|
33
33
|
// reports. Returns null when the host has no opinion — surfaces
|
|
34
34
|
// degrade exactly like the scope pill in standalone mounts.
|
|
35
35
|
const issue = useMediaIssue(asset.filename, asset.folder);
|
|
36
|
+
const src = useAssetServeSrc(assetsBasePath, asset);
|
|
36
37
|
|
|
37
38
|
const handleClick = () => {
|
|
38
39
|
onClick?.();
|
|
@@ -55,12 +56,14 @@ export function AssetCard({
|
|
|
55
56
|
>
|
|
56
57
|
{/* Thumbnail */}
|
|
57
58
|
<div className="relative aspect-square bg-grey-11 dark:bg-grey-03 flex items-center justify-center overflow-hidden">
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
59
|
+
{src ? (
|
|
60
|
+
<img
|
|
61
|
+
src={src}
|
|
62
|
+
alt={asset.alt || asset.originalName}
|
|
63
|
+
className="w-full h-full object-contain"
|
|
64
|
+
loading="lazy"
|
|
65
|
+
/>
|
|
66
|
+
) : null}
|
|
64
67
|
{/* Scope pill — renders only when a host bridge supplied a
|
|
65
68
|
non-null scope. Top-left corner so it sits above the
|
|
66
69
|
asset's own visual focus point without clipping the
|
|
@@ -75,8 +78,8 @@ export function AssetCard({
|
|
|
75
78
|
|
|
76
79
|
{/* Info - filename only */}
|
|
77
80
|
<div className="px-2 py-1.5">
|
|
78
|
-
<p className="text-xs text-grey-01 dark:text-grey-12 truncate" title={asset.
|
|
79
|
-
{asset.
|
|
81
|
+
<p className="text-xs text-grey-01 dark:text-grey-12 truncate" title={asset.filename}>
|
|
82
|
+
{asset.filename}
|
|
80
83
|
</p>
|
|
81
84
|
</div>
|
|
82
85
|
</button>
|