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.
Files changed (49) hide show
  1. package/README.md +3 -1
  2. package/dist/assets/asset-url.d.ts +6 -0
  3. package/dist/assets/asset-url.js +9 -0
  4. package/dist/cli/cli.js +689 -654
  5. package/dist/cli/generate-ai-content.js +403 -96
  6. package/dist/cli/init.js +0 -80
  7. package/dist/content-store.js +1 -1
  8. package/dist/editor/Editor.js +3 -1
  9. package/dist/editor/FormRenderer.js +78 -9
  10. package/dist/editor/components/EditorCrashScreen.d.ts +17 -0
  11. package/dist/editor/components/EditorCrashScreen.js +22 -0
  12. package/dist/editor/components/EditorErrorBoundary.d.ts +38 -0
  13. package/dist/editor/components/EditorErrorBoundary.js +40 -0
  14. package/dist/editor/context/AssetContext.d.ts +2 -7
  15. package/dist/editor/context/AssetContext.js +2 -12
  16. package/dist/editor/fields/FieldCrashFallback.d.ts +17 -0
  17. package/dist/editor/fields/FieldCrashFallback.js +30 -0
  18. package/dist/editor/fields/ImageField.js +8 -5
  19. package/dist/editor/fields/MarkdownField.d.ts +21 -0
  20. package/dist/editor/fields/MarkdownField.js +45 -17
  21. package/dist/editor/fields/markdown-export-options.d.ts +2 -0
  22. package/dist/editor/fields/markdown-export-options.js +8 -0
  23. package/dist/editor/fields/rich-text-failures.d.ts +5 -0
  24. package/dist/editor/fields/rich-text-failures.js +26 -0
  25. package/dist/editor/hooks/useEntryManager.js +19 -5
  26. package/dist/editor/media/AssetCard.d.ts +2 -5
  27. package/dist/editor/media/AssetCard.js +4 -7
  28. package/dist/editor/media/editor-image-src.d.ts +6 -5
  29. package/dist/editor/media/editor-image-src.js +7 -9
  30. package/dist/editor/preview-asset-base.d.ts +5 -4
  31. package/dist/editor/preview-asset-base.js +9 -5
  32. package/dist/editor/preview-bridge.d.ts +8 -0
  33. package/dist/editor/preview-bridge.js +22 -6
  34. package/dist/editor/raw-asset-base.d.ts +5 -0
  35. package/dist/editor/raw-asset-base.js +14 -0
  36. package/dist/editor/utils/editor-errors.d.ts +19 -0
  37. package/dist/editor/utils/editor-errors.js +32 -0
  38. package/dist/preview.d.ts +1 -1
  39. package/dist/preview.js +1 -1
  40. package/dist/server.d.ts +9 -0
  41. package/dist/server.js +9 -0
  42. package/dist/utils/content-serialize.d.ts +7 -5
  43. package/dist/utils/content-serialize.js +58 -9
  44. package/dist/utils/error.js +6 -2
  45. package/dist/utils/markdown-body-splice.d.ts +39 -0
  46. package/dist/utils/markdown-body-splice.js +421 -0
  47. package/dist/version.d.ts +1 -1
  48. package/dist/version.js +1 -1
  49. 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
@@ -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