@orangelogic/design-system 2.193.0 → 2.195.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.
Files changed (26) hide show
  1. package/library/chunks/{asset-link-format.BX1hdLgZ.js → asset-link-format.BFxmPgwt.js} +898 -868
  2. package/library/chunks/{color-swatch-group.BpEQJM1b.js → color-swatch-group.C0BXFL4I.js} +2 -3
  3. package/library/chunks/{document-viewer.DZsbpf0x.js → document-viewer.C5IT7M61.js} +1 -2
  4. package/library/chunks/{toast.C5Ir5yKA.js → toast.COzwhRI6.js} +1 -1
  5. package/library/chunks/transformation.CkEA7Ymz.js +392 -0
  6. package/library/components/asset-link-format.js +2 -2
  7. package/library/components/atoms.js +1 -1
  8. package/library/components/color-swatch-group.js +3 -3
  9. package/library/components/document-viewer.js +1 -1
  10. package/library/components/masonry.js +93 -106
  11. package/library/components/organisms.js +2 -2
  12. package/library/components/types.js +14599 -14597
  13. package/library/package.json +1 -1
  14. package/library/packages/molecules/src/masonry/masonry.d.ts +0 -2
  15. package/library/packages/organisms/src/content-builder/blocks/image/image.d.ts +6 -0
  16. package/library/packages/organisms/src/content-builder-viewer/content-builder-viewer.d.ts +5 -5
  17. package/library/packages/services/src/api/asset/asset.d.ts +0 -1
  18. package/library/packages/tools/src/fetch-image/fetch-image.d.ts +10 -0
  19. package/library/packages/types/src/gallery-item.d.ts +1 -0
  20. package/library/packages/types/src/masonry.d.ts +2 -0
  21. package/library/packages/utils/src/transformation/transformation.d.ts +42 -7
  22. package/library/react-web-component.d.ts +4 -4
  23. package/library/utils.js +121 -120
  24. package/package.json +1 -1
  25. package/library/chunks/content-builder.BX4pHujE.js +0 -60
  26. package/library/chunks/transformation.CkwgrwKQ.js +0 -312
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@orangelogic/design-system",
3
3
  "type": "module",
4
- "version": "2.193.0",
4
+ "version": "2.195.0",
5
5
  "license": "UNLICENSED",
6
6
  "types": "library/types.d.ts",
7
7
  "scripts": {
@@ -103,8 +103,6 @@ export default class CxMasonry extends CortexElement {
103
103
  * the default `100vw`.
104
104
  */
105
105
  private get itemSizes();
106
- /** The format one item is served under: the configured one, or derived from its extension. */
107
- private resolveItemFormat;
108
106
  handleItemClick(event: MouseEvent, item: MasonryItem): void;
109
107
  handleSortableUpdate(event: Sortable.SortableEvent): void;
110
108
  renderActions(item: MasonryItem): import('lit').TemplateResult<1>;
@@ -178,6 +178,12 @@ export default class CxSbImage extends CxImage {
178
178
  private assetExtension;
179
179
  /** Width of the proxy currently displayed; caps `srcset` so it never asks to upscale. */
180
180
  private assetProxyWidth;
181
+ /**
182
+ * The asset's file size, which is what `Auto` uses to choose between the original-file
183
+ * proxy and the transcoded one. Empty until the asset fetch reports back, which
184
+ * `resolveAutoFormat` reads as "within the limit".
185
+ */
186
+ private assetFileSize;
181
187
  /**
182
188
  * Whether an asset fetch has reported back for the current record.
183
189
  *
@@ -6,11 +6,11 @@ import { default as CortexLightElement } from '../../../base/src/cortex-light-el
6
6
  *
7
7
  * @description Scans its light-DOM children for record-id blocks (`cx-sb-image`,
8
8
  * `cx-sb-video`, `cx-sb-audio`) and batch-fetches their asset metadata in one Search
9
- * call, and for blocks linking to a team space (`cx-sb-button`, `cx-sb-image`,
10
- * `cx-sb-video`), fetching the space list once and assigning it as `spaces`. It also
11
- * distributes its `securityBypassToken` to every record-id child (including
12
- * `cx-timeline`, for expired-URL recovery only) so their own runtime Search calls are
13
- * authorised. Renders no UI. Blocks skip their own fetch whenever an ancestor supplies
9
+ * call, and for blocks needing the team-space list (`cx-sb-button`, `cx-sb-image`,
10
+ * `cx-sb-video` linking to a space, and `cx-gallery` showing space cards), fetching
11
+ * the space list once and assigning it as `spaces`. It also distributes its
12
+ * `securityBypassToken` to every record-id child (including `cx-timeline`, for
13
+ * expired-URL recovery only) so their own runtime Search calls are authorised. Renders no UI. Blocks skip their own fetch whenever an ancestor supplies
14
14
  * it, so they must sit inside this element for that to apply — in the editor that means
15
15
  * inside the canvas document.
16
16
  *
@@ -8,7 +8,6 @@ export declare const FIELD_DOC_CAPTION_LONG = "Document.CaptionLong";
8
8
  export declare const FIELD_EXTENSION = "Document.FileExtension";
9
9
  export declare const FIELD_FILE_SIZE = "CoreField.FileSize";
10
10
  export declare const FIELD_IDENTIFIER = "CoreField.Identifier";
11
- export declare const FIELD_KEYWORDS = "CoreField.Keywords";
12
11
  export declare const FIELD_MAX_HEIGHT = "CoreField.MaxHeight";
13
12
  export declare const FIELD_MAX_WIDTH = "CoreField.MaxWidth";
14
13
  export declare const FIELD_RECORD_ID = "Document.RecordID";
@@ -6,6 +6,14 @@ export type ExtendedGalleryItem = GalleryItem & {
6
6
  [key: string]: string | undefined;
7
7
  };
8
8
  type FetchImageControllerOptions = {
9
+ /**
10
+ * Whether delivery URLs carry the `.auto` marker, letting the backend serve a rendition
11
+ * suited to the asset instead of the file the URL names.
12
+ *
13
+ * Defaults to `false`: a consumer opts in deliberately, so a surface that needs the
14
+ * asset exactly as stored (an editor preview, say) never picks this up by accident.
15
+ */
16
+ autoFormat?: boolean;
9
17
  isSiteBuilder?: boolean;
10
18
  maxEnd?: number;
11
19
  pageSize?: number;
@@ -24,6 +32,8 @@ export declare class FetchImageController implements ReactiveController {
24
32
  private readonly authToken;
25
33
  private securityByPassToken;
26
34
  private readonly isSiteBuilder;
35
+ /** Whether delivery URLs carry the `.auto` marker. See `FetchImageControllerOptions`. */
36
+ private readonly autoFormat;
27
37
  private requestEpoch;
28
38
  constructor(host: ReactiveElement, options?: FetchImageControllerOptions);
29
39
  get totalDataCount(): number;
@@ -38,5 +38,6 @@ export type GalleryItem = {
38
38
  rawId?: string;
39
39
  size?: GalleryItemSize;
40
40
  src?: string;
41
+ srcset?: string;
41
42
  url?: string;
42
43
  };
@@ -12,7 +12,9 @@ export type MasonryItem = {
12
12
  loading?: boolean;
13
13
  maxWidth?: string;
14
14
  objectFit?: ObjectFit;
15
+ size?: string;
15
16
  src: string;
17
+ srcset?: string;
16
18
  };
17
19
  export type MasonryItemAction = {
18
20
  color?: string;
@@ -79,17 +79,52 @@ export declare function resolveAutoMaxWidth(manualFormat: boolean, proxyWidth: s
79
79
  * Picks the proxy format an asset should be served under when the author chose `Auto`
80
80
  * instead of naming a format.
81
81
  *
82
- * Extensions that would lose something to a transcode (animation, alpha, bit depth) take
83
- * the original-file proxy, but only up to `AUTO_ORIGINAL_FORMAT_MAX_BYTES`; everything
84
- * else takes the transcoded raster proxy, which is the one `buildAssetSrcset` may resize.
82
+ * Two things have to hold before the original file is served untouched:
85
83
  *
86
- * An unknown or missing extension resolves to the raster proxy — the safe default for the
87
- * majority of assets, and the same value the format ladders already fall back to.
84
+ * 1. The source is itself a displayable image (`IMAGE_ORIGINAL_EXTENSIONS`). For a
85
+ * document source the original-file proxy is a PDF, which cannot be transformed or
86
+ * displayed as an image, so those always take the transcoded raster proxy.
87
+ * 2. It is no larger than `AUTO_ORIGINAL_FORMAT_MAX_BYTES` — past that, delivering the
88
+ * original costs the viewer more than the fidelity it preserves.
88
89
  *
89
- * An unknown *size* does not: a size the API did not report is treated as within the
90
- * limit, so a missing field never silently strips a GIF of its animation.
90
+ * The delivery URL still carries the `AUTO_FORMAT_EXTENSION` marker (see
91
+ * `applyAutoFormatToAssetUrl`) so the backend picks the exact rendition; this only decides
92
+ * which proxy to ask for in the first place.
93
+ *
94
+ * An unknown or missing extension resolves to the raster proxy — the safe default, since
95
+ * it is a real image whatever the source turns out to be. An unknown *size* does not: a
96
+ * size the API did not report is treated as within the limit, so a missing field never
97
+ * silently downgrades an image away from its original.
91
98
  */
92
99
  export declare function resolveAutoFormat(extension: string | null | undefined, size?: string | number | null): string;
100
+ /**
101
+ * Extension marker that asks the backend to serve whichever rendition suits the asset,
102
+ * rather than the exact file the delivery URL names.
103
+ */
104
+ export declare const AUTO_FORMAT_EXTENSION = ".auto";
105
+ /**
106
+ * Appends the `.auto` marker to an asset-link URL, letting the backend pick a rendition
107
+ * suited to the source instead of returning the file exactly as named.
108
+ *
109
+ * The existing extension is kept (`photo.jpg` becomes `photo.jpg.auto`): the URL names a
110
+ * real proxy file, and rewriting that name is the backend's business, not ours. Only the
111
+ * final path segment is touched, so the access key and any `/t/` transform segment are
112
+ * preserved and a configured crop or resize still applies.
113
+ *
114
+ * An animated GIF served as the original file is left alone: whatever rendition the
115
+ * backend picked instead would be a still frame, so the marker would cost the animation.
116
+ * A GIF under any other format is already a rendered still, so it has nothing left to
117
+ * lose and takes the marker like anything else — the same distinction `buildAssetSrcset`
118
+ * draws before it resizes.
119
+ *
120
+ * Returns the URL unchanged when it is not an asset link (arbitrary external sources are
121
+ * never rewritten), when there is no final segment to append to, or when the marker is
122
+ * already present, so the call is safe to repeat.
123
+ */
124
+ export declare function applyAutoFormatToAssetUrl(url: string, options?: {
125
+ extension?: string | null;
126
+ format?: string;
127
+ }): string;
93
128
  /**
94
129
  * Builds a `srcset` value for an asset-link URL by emitting one width-only resize
95
130
  * candidate per ladder entry, letting the browser fetch and decode only the pixels
@@ -22,7 +22,7 @@
22
22
  export type CxGraphViewNodeAction = { controlType: 'default' | 'switch'; icon: string; id: string; name: string; showDivider: boolean; style: { color: string; }; };
23
23
  export type CxGraphViewRecord = any;
24
24
  export type CxGraphViewSummary = { icon: string; texts: string[]; };
25
- export type CxMasonryMasonryItem = { alt: string; extension: string; hasError: boolean; id: string; loading: boolean; maxWidth: string; objectFit: 'contain' | 'cover' | 'fill' | 'none' | 'scale-down'; src: string; };
25
+ export type CxMasonryMasonryItem = { alt: string; extension: string; hasError: boolean; id: string; loading: boolean; maxWidth: string; objectFit: 'contain' | 'cover' | 'fill' | 'none' | 'scale-down'; size: string; src: string; srcset: string; };
26
26
  export type CxMasonryMasonryItemAction = { color: string; event: string; icon: string; src: string; tooltip: string; };
27
27
  export type CxMentionsAutocompleteItem = { id: string; label: string; name: string; suffixContent: string; suffixIcon: string; suffixTooltip: string; suffixType: 'badge'; title: string; type: string; };
28
28
  export type CxMultiSelectColumnData = { id: string; items: { disabled: boolean; group: string; id: string; index: string; text: string; tooltip: string; type: string; }[]; sort: boolean; title: string; };
@@ -33,8 +33,8 @@
33
33
  export type CxAssetLinkFormatFocusMode = { auto: boolean; label: string; value: string; };
34
34
  export type CxAssetLinkFormatProxy = { cdnName: string; extension: string; formatHeight: number; formatWidth: number; height: number; id: string; permanentLink: string; proxyLabel: string; proxyName: string; width: number; };
35
35
  export type CxAssetLinkFormatTransformation = { key: 'Crop' | 'Metadata' | 'Proxy' | 'Quality' | 'Resize' | 'Rotate'; value: { disabledSize: boolean; focusMode: string; height: number; isFocusModeAuto: boolean; keepMetadata: boolean; mode: string; position: 'bottom-center' | 'bottom-left' | 'bottom-right' | 'center-center' | 'center-left' | 'center-right' | 'top-center' | 'top-left' | 'top-right'; quality: number; ratioHeight: number; ratioWidth: number; rotation: number; unit: '%' | 'px'; width: number; x: number; y: number; }; };
36
- export type CxBentoGridGalleryItem = { additions: string[]; alt: string; cardType: 'asset' | 'folder' | 'link' | 'page' | 'space'; className: string; details: string; docType: '' | 'Album' | 'Audio' | 'Audio segment' | 'Image' | 'Multimedia' | 'ProjectDocument' | 'Story' | 'Video' | 'Widget'; extension: string; filler: boolean; header: string; id: string; isClone: boolean; maxWidth: string; name: string; objectFit: 'contain' | 'cover' | 'fill' | 'none' | 'scale-down'; openInNewTab: boolean; pageId: string; rawId: string; size: string; src: string; url: string; };
37
- export type CxCarouselGalleryItem = { additions: string[]; alt: string; cardType: 'asset' | 'folder' | 'link' | 'page' | 'space'; className: string; details: string; docType: '' | 'Album' | 'Audio' | 'Audio segment' | 'Image' | 'Multimedia' | 'ProjectDocument' | 'Story' | 'Video' | 'Widget'; extension: string; filler: boolean; header: string; id: string; isClone: boolean; maxWidth: string; name: string; objectFit: 'contain' | 'cover' | 'fill' | 'none' | 'scale-down'; openInNewTab: boolean; pageId: string; rawId: string; size: string; src: string; url: string; };
36
+ export type CxBentoGridGalleryItem = { additions: string[]; alt: string; cardType: 'asset' | 'folder' | 'link' | 'page' | 'space'; className: string; details: string; docType: '' | 'Album' | 'Audio' | 'Audio segment' | 'Image' | 'Multimedia' | 'ProjectDocument' | 'Story' | 'Video' | 'Widget'; extension: string; filler: boolean; header: string; id: string; isClone: boolean; maxWidth: string; name: string; objectFit: 'contain' | 'cover' | 'fill' | 'none' | 'scale-down'; openInNewTab: boolean; pageId: string; rawId: string; size: string; src: string; srcset: string; url: string; };
37
+ export type CxCarouselGalleryItem = { additions: string[]; alt: string; cardType: 'asset' | 'folder' | 'link' | 'page' | 'space'; className: string; details: string; docType: '' | 'Album' | 'Audio' | 'Audio segment' | 'Image' | 'Multimedia' | 'ProjectDocument' | 'Story' | 'Video' | 'Widget'; extension: string; filler: boolean; header: string; id: string; isClone: boolean; maxWidth: string; name: string; objectFit: 'contain' | 'cover' | 'fill' | 'none' | 'scale-down'; openInNewTab: boolean; pageId: string; rawId: string; size: string; src: string; srcset: string; url: string; };
38
38
  export type CxChatbotChatbotEvent = { event: string; excludedFromPurposes: string[]; label: string; };
39
39
  export type CxTableTimeFormatterParams = { color: string; fontSize: string; fontWeight: string; inputUnit: string; locale: string; placeholder: string; style: dictionary; unitsFormat: string; displayStyle: string; paramsMapField: string; paramsMap: dictionary; };
40
40
  export type CxTableTextFormatParams = { colorMap: dictionary; color: string; };
@@ -6762,7 +6762,7 @@
6762
6762
  /**
6763
6763
  * The key to use for the id of the items in the masonry layout.
6764
6764
  */
6765
- idKey?: 'src' | 'extension' | 'loading' | 'maxWidth' | 'alt' | 'hasError' | 'id' | 'objectFit';
6765
+ idKey?: 'src' | 'extension' | 'loading' | 'maxWidth' | 'size' | 'alt' | 'hasError' | 'id' | 'objectFit' | 'srcset';
6766
6766
  /**
6767
6767
  * The proxy format the item images were resolved with. <br/> Only used to decide whether a `srcset` may be generated: an original-file format paired with an animated source must be delivered untouched.
6768
6768
  */