@orangelogic/design-system 2.190.0 → 2.191.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.
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@orangelogic/design-system",
3
3
  "type": "module",
4
- "version": "2.190.0",
4
+ "version": "2.191.0",
5
5
  "license": "UNLICENSED",
6
6
  "types": "library/types.d.ts",
7
7
  "scripts": {
@@ -57,6 +57,13 @@ export default class CxAssetPicker extends CortexElement {
57
57
  * other type are rejected on confirmation. When false, `type` only pre-fills the filter.
58
58
  */
59
59
  restrict: boolean;
60
+ /**
61
+ * Asset types whose original `src` is used as-is, bypassing the API's
62
+ * representative (thumbnail/preview) URL. Only images are renderable
63
+ * directly, so every other type — video, audio, documents — falls back to its
64
+ * representative when the API returns one.
65
+ */
66
+ noRepresentativeFor: AssetType[];
60
67
  /**
61
68
  * A callback function that is called when the user requests to select an asset.
62
69
  * It should return a promise that resolves to an Asset object.
@@ -78,8 +85,20 @@ export default class CxAssetPicker extends CortexElement {
78
85
  handleValueChange(): Promise<void>;
79
86
  handleRecordIdChange(): Promise<void>;
80
87
  private handleDeleteClick;
81
- /** True when the picker accepts this asset type. */
88
+ /** True when the picker accepts this asset type. `all` accepts every type. */
82
89
  private acceptsType;
90
+ /**
91
+ * Resolves the URL a consumer should render as the selected asset's preview.
92
+ * Types listed in `noRepresentativeFor` keep their original `src`; all other
93
+ * types prefer the representative and fall back to `src` when the API did not
94
+ * return one. `src` itself is always emitted unchanged so consumers that need
95
+ * the original file keep access to it.
96
+ *
97
+ * `type` is optional because it originates from the host app's
98
+ * `onRequestAsset` callback and can be absent at runtime; an asset with no
99
+ * type prefers its representative.
100
+ */
101
+ resolvePreviewSrc(asset: Pick<Asset, 'representative' | 'src'> & Partial<Pick<Asset, 'type'>>): string;
83
102
  private renderAssetPreview;
84
103
  render(): import('lit').TemplateResult<1>;
85
104
  }
@@ -5,7 +5,7 @@ import { default as CxSpinner } from '../../../atoms/src/components/spinner/spin
5
5
  import { default as CortexElement } from '../../../base/src/cortex-element.ts';
6
6
  import { AssetFormatValue } from '../../../types/src/asset-format-picker';
7
7
  import { Asset, AssetTypeString, Device, EditorMode, TeamSpaceRole } from '../../../types/src/content-builder';
8
- import { Component, Editor, StyleProps } from 'grapesjs';
8
+ import { Component, Editor } from 'grapesjs';
9
9
  import { TemplateResult } from 'lit';
10
10
  import { CxBlockPicker } from './components/block-picker';
11
11
  import { CxConfigManager } from './components/config-manager';
@@ -326,6 +326,35 @@ export default class CxContentBuilder extends CortexElement {
326
326
  private handleCanvasScroll;
327
327
  private handleHorizontalScroll;
328
328
  private handleRootToolbarRightClick;
329
+ /**
330
+ * Re-applies the toolbar position GrapesJS computed, clamped to the visible
331
+ * canvas so the toolbar never gets clipped.
332
+ *
333
+ * `getTargetToElementFixed` derives `left` from `elRect.width - toolbarWidth`
334
+ * (right-aligned to the selected element) and clamps it with
335
+ * `canvasLiftLimit`, which is measured against the frame rather than the
336
+ * visible canvas viewport. On an element near the left edge of the visible
337
+ * area that limit still allows a negative offset, so the toolbar overflows
338
+ * past the canvas and gets clipped. Clamping against the real canvas box
339
+ * turns that case into left-alignment.
340
+ *
341
+ * Both `left` and `top` are relative to the tools wrapper, which GrapesJS
342
+ * sizes to the selected element's box — hence the wrapper-to-canvas delta.
343
+ *
344
+ * Values are written with `important` so stylesheet rules on `.gjs-toolbar`
345
+ * cannot override the computed placement.
346
+ */
347
+ private clampToolbarPosition;
348
+ /**
349
+ * Wraps `updateToolbarPos` so the toolbar position is re-applied after
350
+ * GrapesJS writes its own inline position.
351
+ *
352
+ * `updateToolbarPos` lives on the `select-comp` command (GrapesJS'
353
+ * `SelectComponent`), which owns the component toolbar / badge / highlight
354
+ * boxes — not on `CanvasView`. It is absent from the published `grapesjs`
355
+ * typings, so the command is narrowed through a local structural type.
356
+ */
357
+ private patchToolbarPositioning;
329
358
  private handleCanvasClick;
330
359
  private handleCanvasKeydown;
331
360
  private handleTemplateManagerUpdated;
@@ -388,11 +417,7 @@ export default class CxContentBuilder extends CortexElement {
388
417
  * @param components - The components to be updated in the component.
389
418
  * @param styleProps - The style properties to be set for the component.
390
419
  */
391
- updateComponent(component: Component, { attributes, properties, styleProps, }: {
392
- attributes?: Record<string, string>;
393
- properties?: Record<string, unknown>;
394
- styleProps?: StyleProps;
395
- }): void;
420
+ private updateComponent;
396
421
  private handleOtherChange;
397
422
  private handleMouseMove;
398
423
  private getScrollableElements;
@@ -5377,6 +5377,10 @@
5377
5377
  * When true, restricts selection to the picker's declared `type`(s): assets of any other type are rejected on confirmation. When false, `type` only pre-fills the filter.
5378
5378
  */
5379
5379
  restrict?: boolean;
5380
+ /**
5381
+ * Asset types whose original `src` is used as-is, bypassing the API's representative (thumbnail/preview) URL. Only images are renderable directly, so every other type — video, audio, documents — falls back to its representative when the API returns one.
5382
+ */
5383
+ noRepresentativeFor?: 'all' | 'audio' | 'image' | 'other' | 'video'[];
5380
5384
  /**
5381
5385
  * An optional record ID (or space-separated list of record IDs, for `multiple` pickers) used to fetch a clean preview image and title, bypassing any stored URL/name that may be stale or have transformations applied.
5382
5386
  */
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@orangelogic/design-system",
3
3
  "type": "module",
4
- "version": "2.190.0",
4
+ "version": "2.191.0",
5
5
  "license": "UNLICENSED",
6
6
  "types": "library/types.d.ts",
7
7
  "scripts": {
@@ -1,7 +0,0 @@
1
- export declare enum DownloadDocType {
2
- Audio = "Audio",
3
- Graphic = "Graphic",
4
- Image = "Image",
5
- Multimedia = "Multimedia",
6
- Video = "Video"
7
- }