canopycms 0.0.68-int.102 → 0.0.68-int.103
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 +3 -1
- package/dist/assets/asset-url.d.ts +6 -0
- package/dist/assets/asset-url.js +9 -0
- package/dist/cli/cli.js +689 -654
- package/dist/cli/generate-ai-content.js +403 -96
- package/dist/cli/init.js +0 -80
- package/dist/content-store.js +1 -1
- package/dist/editor/Editor.js +3 -1
- package/dist/editor/FormRenderer.js +78 -9
- package/dist/editor/components/EditorCrashScreen.d.ts +17 -0
- package/dist/editor/components/EditorCrashScreen.js +22 -0
- package/dist/editor/components/EditorErrorBoundary.d.ts +38 -0
- package/dist/editor/components/EditorErrorBoundary.js +40 -0
- package/dist/editor/context/AssetContext.d.ts +2 -7
- package/dist/editor/context/AssetContext.js +2 -12
- package/dist/editor/fields/FieldCrashFallback.d.ts +17 -0
- package/dist/editor/fields/FieldCrashFallback.js +30 -0
- package/dist/editor/fields/ImageField.js +8 -5
- package/dist/editor/fields/MarkdownField.d.ts +21 -0
- package/dist/editor/fields/MarkdownField.js +45 -17
- package/dist/editor/fields/markdown-export-options.d.ts +2 -0
- package/dist/editor/fields/markdown-export-options.js +8 -0
- package/dist/editor/fields/rich-text-failures.d.ts +5 -0
- package/dist/editor/fields/rich-text-failures.js +26 -0
- package/dist/editor/hooks/useEntryManager.js +19 -5
- package/dist/editor/media/AssetCard.d.ts +2 -5
- package/dist/editor/media/AssetCard.js +4 -7
- package/dist/editor/media/editor-image-src.d.ts +6 -5
- package/dist/editor/media/editor-image-src.js +7 -9
- package/dist/editor/preview-asset-base.d.ts +5 -4
- package/dist/editor/preview-asset-base.js +9 -5
- package/dist/editor/preview-bridge.d.ts +8 -0
- package/dist/editor/preview-bridge.js +22 -6
- package/dist/editor/raw-asset-base.d.ts +5 -0
- package/dist/editor/raw-asset-base.js +14 -0
- package/dist/editor/utils/editor-errors.d.ts +19 -0
- package/dist/editor/utils/editor-errors.js +32 -0
- package/dist/preview.d.ts +1 -1
- package/dist/preview.js +1 -1
- package/dist/server.d.ts +9 -0
- package/dist/server.js +9 -0
- package/dist/utils/content-serialize.d.ts +7 -5
- package/dist/utils/content-serialize.js +58 -9
- package/dist/utils/error.js +6 -2
- package/dist/utils/markdown-body-splice.d.ts +39 -0
- package/dist/utils/markdown-body-splice.js +421 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +15 -1
package/README.md
CHANGED
|
@@ -637,7 +637,9 @@ media: { adapter: 's3', bucket: 'my-site-assets', region: 'us-east-1' }
|
|
|
637
637
|
|
|
638
638
|
Passing an `image` field value applies its stored crop (`opts.crop` overrides it). Its `width`
|
|
639
639
|
and `height` are the uncropped original's, so scale them by `crop.w` and `crop.h` for a cropped
|
|
640
|
-
value. SVGs and PDFs are served statically, with no transform.
|
|
640
|
+
value. SVGs and PDFs are served statically, with no transform. The package declares
|
|
641
|
+
`sideEffects`, so this import adds under 7 KB minified to a client bundle and none of the
|
|
642
|
+
config schemas.
|
|
641
643
|
|
|
642
644
|
- **Where `/assets` is mounted** — the URLs above are root-relative, because that is what gets
|
|
643
645
|
stored in content and content moves between branches and environments. If your renderer sees
|
|
@@ -41,6 +41,12 @@ export interface AssetUrlOptions {
|
|
|
41
41
|
*/
|
|
42
42
|
baseUrl?: string;
|
|
43
43
|
}
|
|
44
|
+
/**
|
|
45
|
+
* Whether `src` is in canopycms's own `/assets` URL space - a transform or static asset src the
|
|
46
|
+
* asset store serves. Every other src (a site's own static file, an off-site URL, a `data:` URI)
|
|
47
|
+
* is the host's, and the asset store never serves it.
|
|
48
|
+
*/
|
|
49
|
+
export declare function isAssetStoreSrc(src: string): boolean;
|
|
44
50
|
/**
|
|
45
51
|
* Build a transform URL, merging `opts` and `ref.crop` over the directives already present
|
|
46
52
|
* in `ref.src` (see `mergeDirectives` for precedence). For static srcs (svg/pdf under
|
package/dist/assets/asset-url.js
CHANGED
|
@@ -9,6 +9,15 @@ import { getPreviewAssetBase } from '../editor/preview-asset-base.js';
|
|
|
9
9
|
import { ASSET_PREFIXES } from './asset-prefixes.js';
|
|
10
10
|
import { formatDirectives, isAllowedTransformWidth, parseTransformPath, } from './transform-directives.js';
|
|
11
11
|
const TRANSFORM_URL_PREFIX = `/${ASSET_PREFIXES.transform}/`;
|
|
12
|
+
const ASSET_SPACE_PREFIX = `/${ASSET_PREFIXES.public}/`;
|
|
13
|
+
/**
|
|
14
|
+
* Whether `src` is in canopycms's own `/assets` URL space - a transform or static asset src the
|
|
15
|
+
* asset store serves. Every other src (a site's own static file, an off-site URL, a `data:` URI)
|
|
16
|
+
* is the host's, and the asset store never serves it.
|
|
17
|
+
*/
|
|
18
|
+
export function isAssetStoreSrc(src) {
|
|
19
|
+
return src.startsWith(ASSET_SPACE_PREFIX);
|
|
20
|
+
}
|
|
12
21
|
/**
|
|
13
22
|
* Test-only. A function stored on `globalThis` under this symbol is called with every URL
|
|
14
23
|
* `assetUrl` returns; the dual-build fixture installs one during a static export to prove
|