@orangelogic/design-system 3.1.0 → 3.2.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.
- package/library/chunks/{asset-link-format.Ds5nq4mo.js → asset-link-format.BnIUG_vO.js} +19 -18
- package/library/chunks/{button.BnkkUqiI.js → button.CpY4FCwE.js} +1 -1
- package/library/chunks/{color-swatch-group.d5e1sYos.js → color-swatch-group.CTcv62MK.js} +11 -10
- package/library/chunks/{color-swatch.D6Gg5bpz.js → color-swatch.Caved2kL.js} +1 -1
- package/library/chunks/{confirm-popover.tftDINBg.js → confirm-popover.BSS1VhB2.js} +3 -3
- package/library/chunks/content-builder.BX4pHujE.js +60 -0
- package/library/chunks/{dialog.CzSaiGBF.js → dialog.ICoCAj6Z.js} +4 -4
- package/library/chunks/{document-viewer.B1EEIvUY.js → document-viewer.D6PxGcEL.js} +8 -7
- package/library/chunks/{dot-pagination.BqGFeFXK.js → dot-pagination.CzVpiv00.js} +1 -1
- package/library/chunks/{folder-select.CIqVGGFl.js → folder-select.DN-JomDt.js} +4 -4
- package/library/chunks/{header.CWlWNree.js → header.BQg_JjHw.js} +1 -1
- package/library/chunks/{i18n.DbXTTLXx.js → i18n.BA19xtyU.js} +6 -3
- package/library/chunks/{icon-button.BHC52xvk.js → icon-button.BWJ1Vqn5.js} +1 -1
- package/library/chunks/{iframe.-GCTFas1.js → iframe.Dm-nXSBv.js} +1 -1
- package/library/chunks/{image.CTMzUqCC.js → image.B-4cVbol.js} +187 -188
- package/library/chunks/{input.33UmFGqR.js → input.xgeLCG8I.js} +1 -1
- package/library/chunks/{markdown.Dga4_SbU.js → markdown.bkEjjjS9.js} +2 -2
- package/library/chunks/menu-item.DgUMVYe5.js +493 -0
- package/library/chunks/{option.B6odSlS2.js → option.jeaj7_Lr.js} +1 -1
- package/library/chunks/{pagination.D50ned8_.js → pagination.CSPKsj4y.js} +5 -5
- package/library/chunks/{tab-group.DE0RsMX4.js → tab-group.BSl6GdIO.js} +4 -4
- package/library/chunks/{toast.CXEAfCvN.js → toast.C5Ir5yKA.js} +1 -1
- package/library/chunks/transformation.CWKaoGaY.js +254 -0
- package/library/chunks/{tree.CmEdKtzK.js → tree.DYFFjW1-.js} +1 -1
- package/library/components/alert.js +2 -2
- package/library/components/asset-link-format.js +4 -4
- package/library/components/atoms.js +31 -31
- package/library/components/audio.js +2 -2
- package/library/components/border-input-group.js +2 -2
- package/library/components/breadcrumb.js +1 -1
- package/library/components/button.js +2 -2
- package/library/components/color-picker.js +3 -3
- package/library/components/color-swatch-group.js +5 -5
- package/library/components/color-swatch.js +2 -2
- package/library/components/confirm-popover.js +4 -4
- package/library/components/copy-button.js +1 -1
- package/library/components/corner-position-input-group.js +3 -3
- package/library/components/date-calendar.js +1 -1
- package/library/components/details.js +1 -1
- package/library/components/dialog.js +3 -3
- package/library/components/document-viewer.js +3 -3
- package/library/components/dot-pagination.js +2 -2
- package/library/components/drawer.js +4 -4
- package/library/components/dropdown.js +2 -2
- package/library/components/dynamic-select.js +4 -4
- package/library/components/e-chart.js +1 -1
- package/library/components/element-clamp.js +2 -2
- package/library/components/file-on-demand.js +9 -9
- package/library/components/folder-select.js +4 -4
- package/library/components/format-bytes.js +1 -1
- package/library/components/format-date.js +1 -1
- package/library/components/format-number.js +1 -1
- package/library/components/format-time.js +1 -1
- package/library/components/header.js +2 -2
- package/library/components/icon-button.js +2 -2
- package/library/components/iframe.js +2 -2
- package/library/components/image-comparer.js +1 -1
- package/library/components/image.js +3 -4
- package/library/components/input.js +2 -2
- package/library/components/line-clamp.js +1 -1
- package/library/components/markdown.js +3 -3
- package/library/components/masonry.js +113 -100
- package/library/components/menu-item.js +15 -486
- package/library/components/menu.js +20 -20
- package/library/components/molecules.js +3 -3
- package/library/components/option.js +2 -2
- package/library/components/organisms.js +2 -2
- package/library/components/padding-input-group.js +1 -1
- package/library/components/pagination.js +6 -6
- package/library/components/popup.js +101 -98
- package/library/components/position-picker.js +1 -1
- package/library/components/progress-bar.js +1 -1
- package/library/components/progress-ring.js +1 -1
- package/library/components/range.js +1 -1
- package/library/components/rating.js +1 -1
- package/library/components/relative-time.js +1 -1
- package/library/components/select.js +18 -13
- package/library/components/shadow-input-group.js +1 -1
- package/library/components/share-option-list.js +1 -1
- package/library/components/sidebar.js +1 -1
- package/library/components/size-input-group.js +3 -3
- package/library/components/spinner.js +1 -1
- package/library/components/split-panel.js +1 -1
- package/library/components/tab-group.js +5 -5
- package/library/components/tab.js +2 -2
- package/library/components/tag.js +2 -2
- package/library/components/tooltip.js +1 -1
- package/library/components/tree-item.js +2 -2
- package/library/components/tree.js +2 -2
- package/library/components/typeface.js +2 -2
- package/library/components/types.js +15020 -14844
- package/library/components/video.js +2 -2
- package/library/package.json +1 -1
- package/library/packages/atoms/src/components/image/image.d.ts +30 -4
- package/library/packages/atoms/src/components/menu-item/menu-item.d.ts +5 -2
- package/library/packages/atoms/src/components/popup/popup.d.ts +11 -0
- package/library/packages/atoms/src/components/select/select.d.ts +8 -0
- package/library/packages/molecules/src/gallery-item/gallery-item.d.ts +10 -0
- package/library/packages/molecules/src/icon-picker/icon-picker.d.ts +1 -0
- package/library/packages/molecules/src/masonry/masonry.d.ts +9 -0
- package/library/packages/molecules/src/view-and-sort/view-and-sort.d.ts +8 -0
- package/library/packages/organisms/src/bento-grid/bento-grid.d.ts +88 -0
- package/library/packages/organisms/src/content-builder/blocks/image/image.d.ts +11 -1
- package/library/packages/organisms/src/content-builder/content-builder.d.ts +31 -6
- package/library/packages/types/src/menu-item.d.ts +12 -1
- package/library/packages/utils/src/custom-element/i18n.d.ts +3 -0
- package/library/packages/utils/src/transformation/transformation.d.ts +52 -0
- package/library/react-web-component.d.ts +17 -1
- package/library/utils.js +173 -167
- package/package.json +1 -1
- package/library/chunks/transformation.8uLv6uwG.js +0 -264
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { _ as kd, a as Sa, b as Be, c as Je } from "../chunks/inheritsLoose.BuSn_CvZ.js";
|
|
2
2
|
import { c as ps, a as Bn } from "../chunks/_commonjsHelpers.DQNKXVTB.js";
|
|
3
3
|
import { r as Sb } from "../chunks/___vite-browser-external_commonjs-proxy.C2tf3HsQ.js";
|
|
4
|
-
import { C as Cb } from "../chunks/image.
|
|
4
|
+
import { C as Cb } from "../chunks/image.B-4cVbol.js";
|
|
5
5
|
import Mb from "./resize-observer.js";
|
|
6
6
|
import { r as Db, R as Pb, a as Rp, b as Lb } from "../chunks/resizable-component.styles.CAfXABBc.js";
|
|
7
7
|
import { c as Rb } from "../chunks/component.styles.CRO4Odto.js";
|
|
8
8
|
import { b as Ib } from "../chunks/browser.BHOCIF_A.js";
|
|
9
9
|
import { c as Ob } from "../chunks/custom-element.L4WJXn1j.js";
|
|
10
|
-
import { L as kb } from "../chunks/i18n.
|
|
10
|
+
import { L as kb } from "../chunks/i18n.BA19xtyU.js";
|
|
11
11
|
import { w as Ki } from "../chunks/watch.DJF5K-8U.js";
|
|
12
12
|
import { i as Bb, x as Qc } from "../chunks/lit-element.jLBm65_O.js";
|
|
13
13
|
import { n as Ri } from "../chunks/lib-cortex-element.CVMmyPMC.js";
|
package/library/package.json
CHANGED
|
@@ -9,15 +9,18 @@ import { default as CxPopup } from '../popup/popup';
|
|
|
9
9
|
import { default as CxResizeObserver } from '../resize-observer/resize-observer';
|
|
10
10
|
import { default as CxSkeleton } from '../skeleton/skeleton';
|
|
11
11
|
import { default as CxSpace } from '../space/space';
|
|
12
|
-
import { default as CxSpinner } from '../spinner/spinner';
|
|
13
12
|
|
|
14
13
|
/**
|
|
15
14
|
* @summary Images are wrappers for img elements with built-in lazy loading, skeleton, and fallback support.
|
|
16
15
|
* The cx-image component is a simple way to display images in your application.
|
|
17
16
|
*
|
|
17
|
+
* @description Set `srcset` and `sizes` to let the browser download and decode only the
|
|
18
|
+
* pixels the layout needs. This is what bounds memory on image-heavy pages: a large
|
|
19
|
+
* original decodes to `naturalWidth × naturalHeight × 4` bytes no matter how small it
|
|
20
|
+
* is displayed, so many full-resolution images on one page can exhaust the renderer.
|
|
21
|
+
*
|
|
18
22
|
* @csspart image - The `img` element.
|
|
19
|
-
* @csspart skeleton - The skeleton element,
|
|
20
|
-
* @csspart retry-spinner - The spinner overlay shown while a failed load is being retried (when `retry-on-error` is enabled).
|
|
23
|
+
* @csspart skeleton - The skeleton element, shown while the image is loading (including while a failed load is being retried) and the `skeleton` property is set.
|
|
21
24
|
* @csspart fallback - The fallback element, always shown when the image fails to load (after retries, when applicable).
|
|
22
25
|
* @csspart base - The component’s outer wrapper.
|
|
23
26
|
* @csspart fallback-icon - The icon rendered inside the fallback slot.
|
|
@@ -48,7 +51,6 @@ export default class CxImage extends ResizableElement {
|
|
|
48
51
|
'cx-resize-observer': typeof CxResizeObserver;
|
|
49
52
|
'cx-skeleton': typeof CxSkeleton;
|
|
50
53
|
'cx-space': typeof CxSpace;
|
|
51
|
-
'cx-spinner': typeof CxSpinner;
|
|
52
54
|
};
|
|
53
55
|
readonly localize: LocalizeController;
|
|
54
56
|
imageElement?: HTMLImageElement;
|
|
@@ -66,6 +68,21 @@ export default class CxImage extends ResizableElement {
|
|
|
66
68
|
* The path to the image to load.
|
|
67
69
|
*/
|
|
68
70
|
src: string;
|
|
71
|
+
/**
|
|
72
|
+
* Candidate sources for the underlying `<img>`, as a standard `srcset` value
|
|
73
|
+
* (e.g. `"…/re_w_400/img.jpg 400w, …/re_w_800/img.jpg 800w"`).
|
|
74
|
+
*
|
|
75
|
+
* Lets the browser fetch and decode only the pixels the layout needs, which is what
|
|
76
|
+
* bounds memory on image-heavy pages — a large original decodes to
|
|
77
|
+
* `naturalWidth × naturalHeight × 4` bytes regardless of its display size.
|
|
78
|
+
* Pair with `sizes`; without it the browser assumes the image is `100vw` wide.
|
|
79
|
+
*/
|
|
80
|
+
srcset: string;
|
|
81
|
+
/**
|
|
82
|
+
* The `sizes` attribute for the underlying `<img>`, describing the rendered width
|
|
83
|
+
* (e.g. `"400px"`). Only meaningful together with `srcset`.
|
|
84
|
+
*/
|
|
85
|
+
sizes: string;
|
|
69
86
|
/**
|
|
70
87
|
* The path to the placeholder image to be shown if src is not available.
|
|
71
88
|
*/
|
|
@@ -151,6 +168,15 @@ export default class CxImage extends ResizableElement {
|
|
|
151
168
|
};
|
|
152
169
|
/** The crossorigin value for the `<img>`; `undefined` (attribute omitted) when `noCrossorigin` is set. */
|
|
153
170
|
get crossorigin(): string | undefined;
|
|
171
|
+
/**
|
|
172
|
+
* Whether to hold the box with a skeleton rather than the loaded image.
|
|
173
|
+
*
|
|
174
|
+
* Retries are included: a retry is still "not loaded yet", so it keeps the same
|
|
175
|
+
* skeleton instead of swapping in a spinner. A spinner would restate what the
|
|
176
|
+
* skeleton already shows while changing the visual weight of the cell mid-load,
|
|
177
|
+
* which reads as a layout change on an image-heavy page.
|
|
178
|
+
*/
|
|
179
|
+
protected get showPlaceholderSkeleton(): boolean;
|
|
154
180
|
/**
|
|
155
181
|
* Whether the image have zoom action.
|
|
156
182
|
*/
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { default as CortexElement } from '../../../../base/src/cortex-element.ts';
|
|
2
|
-
import { AriaCurrentValue, MenuItemCheckPlacement } from '../../../../types/src/menu-item';
|
|
2
|
+
import { AriaCurrentValue, MenuItemCheckPlacement, MenuItemRole, MenuItemType } from '../../../../types/src/menu-item';
|
|
3
3
|
import { CSSResultGroup, TemplateResult } from 'lit';
|
|
4
4
|
import { default as CxIcon } from '../icon/icon';
|
|
5
5
|
import { default as CxPopup } from '../popup/popup';
|
|
@@ -33,6 +33,7 @@ import { default as CxSpinner } from '../spinner/spinner';
|
|
|
33
33
|
* @cssproperty [--submenu-offset=-2px] - The distance submenus shift to overlap the parent menu.
|
|
34
34
|
* @cssproperty [--checked-icon-size=1.5em] - The size of the checked icon.
|
|
35
35
|
* @cssproperty [--checked-icon-color=var(--cx-color-primary)] - The color of the checked icon when the item is checked.
|
|
36
|
+
* @cssproperty [--checked-label-color=var(--cx-color-primary)] - The color of the label when the item is checked.
|
|
36
37
|
*/
|
|
37
38
|
export default class CxMenuItem extends CortexElement {
|
|
38
39
|
static readonly styles: CSSResultGroup;
|
|
@@ -47,7 +48,9 @@ export default class CxMenuItem extends CortexElement {
|
|
|
47
48
|
menuItem: HTMLElement;
|
|
48
49
|
submenuIcon: HTMLElement;
|
|
49
50
|
/** The type of menu item to render. To use `checked`, this value must be set to `checkbox`. */
|
|
50
|
-
type:
|
|
51
|
+
type: MenuItemType;
|
|
52
|
+
/** Overrides the ARIA role derived from `type`. Use `menuitemradio` for a checkbox item that is one choice out of a set. */
|
|
53
|
+
itemRole?: MenuItemRole;
|
|
51
54
|
/** The trigger type for the submenu. */
|
|
52
55
|
submenuTrigger: 'hover' | 'click' | 'both';
|
|
53
56
|
/** Draws the item in a checked state. */
|
|
@@ -42,6 +42,16 @@ export default class CxPopup extends CortexElement {
|
|
|
42
42
|
static styles: CSSResultGroup;
|
|
43
43
|
private anchorEl;
|
|
44
44
|
private cleanup;
|
|
45
|
+
/**
|
|
46
|
+
* Set when the element disconnects, cleared when it reconnects.
|
|
47
|
+
*
|
|
48
|
+
* `start()` is debounced, so a pending invocation can still run after
|
|
49
|
+
* `disconnectedCallback()` has already executed `stopImmediate()` — at which
|
|
50
|
+
* point nothing is left to release the `autoUpdate()` listeners it registers
|
|
51
|
+
* on `window`. Checked alongside `isConnected`, which a popup inside a shadow
|
|
52
|
+
* tree that is discarded as a whole can still report as `true`.
|
|
53
|
+
*/
|
|
54
|
+
private isTornDown;
|
|
45
55
|
private readonly localize;
|
|
46
56
|
/** A reference to the internal popup container. Useful for animating and styling the popup with JavaScript. */
|
|
47
57
|
popup: HTMLElement;
|
|
@@ -172,6 +182,7 @@ export default class CxPopup extends CortexElement {
|
|
|
172
182
|
*/
|
|
173
183
|
autoWidthFactor: number;
|
|
174
184
|
private get isSizeMiddleWareUsed();
|
|
185
|
+
connectedCallback(): void;
|
|
175
186
|
disconnectedCallback(): void;
|
|
176
187
|
connectedUpdatedCallback(): void;
|
|
177
188
|
updated(changedProps: Map<string, unknown>): Promise<void>;
|
|
@@ -68,6 +68,13 @@ export default class CxSelect extends CortexElement implements CortexFormControl
|
|
|
68
68
|
private readonly localize;
|
|
69
69
|
private typeToSelectString;
|
|
70
70
|
private closeWatcher;
|
|
71
|
+
/**
|
|
72
|
+
* The root node the `focusin` listener was attached to, captured at attach
|
|
73
|
+
* time. `getRootNode()` returns a different node once the element is
|
|
74
|
+
* detached, so re-calling it during cleanup would fail to remove the
|
|
75
|
+
* listener that was actually added.
|
|
76
|
+
*/
|
|
77
|
+
private openListenersRoot;
|
|
71
78
|
popup: CxPopup;
|
|
72
79
|
combobox: HTMLSlotElement;
|
|
73
80
|
displayInput: HTMLInputElement;
|
|
@@ -310,6 +317,7 @@ export default class CxSelect extends CortexElement implements CortexFormControl
|
|
|
310
317
|
*/
|
|
311
318
|
filterCallback(option: HTMLElement, value: string): boolean;
|
|
312
319
|
connectedCallback(): void;
|
|
320
|
+
disconnectedCallback(): void;
|
|
313
321
|
runFirstUpdated(): void;
|
|
314
322
|
private addOpenListeners;
|
|
315
323
|
private removeOpenListeners;
|
|
@@ -85,6 +85,16 @@ export default class CxGalleryItem extends HighlightableElement {
|
|
|
85
85
|
* The source of the image.
|
|
86
86
|
*/
|
|
87
87
|
src: string | undefined;
|
|
88
|
+
/**
|
|
89
|
+
* Candidate sources forwarded to the inner `<cx-image>` as a standard `srcset` value,
|
|
90
|
+
* so the browser downloads and decodes only the pixels the grid cell needs.
|
|
91
|
+
*/
|
|
92
|
+
srcset: string;
|
|
93
|
+
/**
|
|
94
|
+
* The rendered width forwarded to the inner `<cx-image>` as `sizes` (e.g. `"400px"`).
|
|
95
|
+
* Only meaningful together with `srcset`.
|
|
96
|
+
*/
|
|
97
|
+
sizes: string;
|
|
88
98
|
/**
|
|
89
99
|
* The alt text for the image.
|
|
90
100
|
*/
|
|
@@ -129,6 +129,7 @@ export default class CxIconPicker extends CortexElement {
|
|
|
129
129
|
private handleSearchInput;
|
|
130
130
|
private handleMenuSelect;
|
|
131
131
|
private handleBicolorChange;
|
|
132
|
+
private setValueMenuSelect;
|
|
132
133
|
setSelectOptionCurrent(option: HTMLElement, current?: boolean): void;
|
|
133
134
|
selectGetOptionLabel(option: HTMLElement): string;
|
|
134
135
|
selectFilterCallback(option: HTMLElement, value: string): boolean;
|
|
@@ -81,6 +81,15 @@ export default class CxMasonry extends CortexElement {
|
|
|
81
81
|
handleSortableChange(): void;
|
|
82
82
|
connectedUpdatedCallback(): void;
|
|
83
83
|
disconnectedCallback(): void;
|
|
84
|
+
/**
|
|
85
|
+
* The `sizes` hint for item images, expressed as a viewport fraction.
|
|
86
|
+
*
|
|
87
|
+
* The layout is CSS-column based, so no exact pixel width is available the way a
|
|
88
|
+
* measured grid provides one. Each item spans exactly one of `cols` columns, which
|
|
89
|
+
* makes the fraction an accurate upper bound and keeps the browser from assuming
|
|
90
|
+
* the default `100vw`.
|
|
91
|
+
*/
|
|
92
|
+
private get itemSizes();
|
|
84
93
|
handleItemClick(event: MouseEvent, item: MasonryItem): void;
|
|
85
94
|
handleSortableUpdate(event: Sortable.SortableEvent): void;
|
|
86
95
|
renderActions(item: MasonryItem): import('lit').TemplateResult<1>;
|
|
@@ -20,6 +20,8 @@ import { CSSResultGroup, TemplateResult } from 'lit';
|
|
|
20
20
|
* @summary A dropdown menu that accepts a JSON string to render menu items for the template switcher dropdown.
|
|
21
21
|
*
|
|
22
22
|
* @event {{ item: MenuItem }} cx-select - Emitted when a menu item is selected.
|
|
23
|
+
*
|
|
24
|
+
* @cssproperty [--view-and-sort-switch-label-color=var(--cx-color-neutral)] - Label color for switch rows. Switch rows stay neutral because the switch conveys the state; set this to re-enable a checked highlight.
|
|
23
25
|
*/
|
|
24
26
|
export default class CxViewAndSort extends CortexElement {
|
|
25
27
|
static readonly styles: CSSResultGroup;
|
|
@@ -55,6 +57,12 @@ export default class CxViewAndSort extends CortexElement {
|
|
|
55
57
|
hide(): void;
|
|
56
58
|
private handleButtonClick;
|
|
57
59
|
private handleSwitchClick;
|
|
60
|
+
/**
|
|
61
|
+
* Whether an item is one option out of a set the user picks from, such as items per page, and
|
|
62
|
+
* so needs `aria-checked`. Options share a `group`; switches, buttons, submenu openers and
|
|
63
|
+
* settings actions are excluded.
|
|
64
|
+
*/
|
|
65
|
+
private isSelectableOption;
|
|
58
66
|
render(): TemplateResult<1>;
|
|
59
67
|
renderMenuSection(section: MenuSection): TemplateResult;
|
|
60
68
|
renderMenuItem(item: MenuItem, isHorizontal?: boolean, tooltip?: string): TemplateResult;
|
|
@@ -23,6 +23,13 @@ export default class CxBentoGrid extends CortexElement {
|
|
|
23
23
|
static readonly styles: CSSResultGroup;
|
|
24
24
|
/** Minimum scroll delta (px) required to trigger a virtual range update. */
|
|
25
25
|
private static readonly SCROLL_THRESHOLD;
|
|
26
|
+
/**
|
|
27
|
+
* Longest a row may block the next release while waiting for its images.
|
|
28
|
+
*
|
|
29
|
+
* Bounds the adaptive wait so a hanging request or an image that never fires
|
|
30
|
+
* `load`/`error` cannot stall the remaining rows indefinitely.
|
|
31
|
+
*/
|
|
32
|
+
private static readonly ROW_RELEASE_TIMEOUT;
|
|
26
33
|
static readonly dependencies: {
|
|
27
34
|
'cx-gallery-item': typeof CxGalleryItem;
|
|
28
35
|
'cx-tooltip': typeof CxTooltip;
|
|
@@ -109,6 +116,18 @@ export default class CxBentoGrid extends CortexElement {
|
|
|
109
116
|
* Unloaded slots are approximated as 1×1 items.
|
|
110
117
|
*/
|
|
111
118
|
totalItems: number;
|
|
119
|
+
/**
|
|
120
|
+
* Delay in milliseconds between releasing one row of images and the next.
|
|
121
|
+
*
|
|
122
|
+
* Images are held back until their row is released, so the browser opens roughly one
|
|
123
|
+
* row's worth of requests at a time instead of one per rendered item. Each transform
|
|
124
|
+
* URL is an uncached backend render, and enough of them in parallel returns 503.
|
|
125
|
+
*
|
|
126
|
+
* A row also waits for the previous row's images to finish (capped by
|
|
127
|
+
* `ROW_RELEASE_TIMEOUT`), so this is the floor between releases rather than the exact
|
|
128
|
+
* cadence. Set to `0` to disable gating and let every rendered row load immediately.
|
|
129
|
+
*/
|
|
130
|
+
rowReleaseDelay: number;
|
|
112
131
|
/**
|
|
113
132
|
* The show content type.
|
|
114
133
|
*/
|
|
@@ -198,6 +217,29 @@ export default class CxBentoGrid extends CortexElement {
|
|
|
198
217
|
private virtualFirst;
|
|
199
218
|
/** Inclusive index of the last item in the rendered virtual window. */
|
|
200
219
|
private virtualLast;
|
|
220
|
+
/**
|
|
221
|
+
* Exclusive upper bound of the grid rows whose images are allowed to load.
|
|
222
|
+
*
|
|
223
|
+
* A row's worth of items entering the DOM together makes the browser open that many
|
|
224
|
+
* image requests at once, and each distinct transform URL is an uncached backend
|
|
225
|
+
* render — enough parallelism there returns 503. Releasing one row at a time keeps
|
|
226
|
+
* the request count bounded by the row width instead of the rendered range.
|
|
227
|
+
*
|
|
228
|
+
* `Infinity` disables gating entirely (see `rowReleaseDelay`).
|
|
229
|
+
*/
|
|
230
|
+
private releasedRowCount;
|
|
231
|
+
/** Pending timer for the next row release; null when no release is scheduled. */
|
|
232
|
+
private rowReleaseTimer;
|
|
233
|
+
/**
|
|
234
|
+
* Images still loading in the most recently released row, by item index.
|
|
235
|
+
*
|
|
236
|
+
* The next row waits for this to drain so releases track real network progress
|
|
237
|
+
* rather than a fixed cadence, with `ROW_RELEASE_TIMEOUT` as the upper bound so a
|
|
238
|
+
* hanging or broken image cannot stall the rest of the grid.
|
|
239
|
+
*/
|
|
240
|
+
private readonly pendingRowImages;
|
|
241
|
+
/** Guards against scheduling a release while one is already in flight. */
|
|
242
|
+
private isRowReleaseScheduled;
|
|
201
243
|
private isTooltipShown;
|
|
202
244
|
protected galleryItemTag: string;
|
|
203
245
|
/**
|
|
@@ -249,6 +291,43 @@ export default class CxBentoGrid extends CortexElement {
|
|
|
249
291
|
private computeLayout;
|
|
250
292
|
/** Recalculates which items fall within the current scroll viewport. */
|
|
251
293
|
private updateActiveRange;
|
|
294
|
+
/**
|
|
295
|
+
* Highest row index currently rendered, or -1 when nothing is rendered.
|
|
296
|
+
*
|
|
297
|
+
* Releases stop here rather than at the dataset's last row so scrolled-away rows are
|
|
298
|
+
* not fetched ahead of the ones the viewer is actually looking at.
|
|
299
|
+
*/
|
|
300
|
+
private get lastRenderedRow();
|
|
301
|
+
/**
|
|
302
|
+
* Whether the item at `index` may load its image yet.
|
|
303
|
+
*
|
|
304
|
+
* Items in unreleased rows render their cell and skeleton but receive no `src`, which
|
|
305
|
+
* is what keeps the grid's shape stable while images fill in progressively.
|
|
306
|
+
*/
|
|
307
|
+
protected isRowReleased(index: number): boolean;
|
|
308
|
+
/**
|
|
309
|
+
* Marks every rendered item in `row` as awaiting its image, synchronously.
|
|
310
|
+
*
|
|
311
|
+
* Runs in the same tick as the release so `scheduleRowRelease()` sees a non-empty
|
|
312
|
+
* set on its next call. Items without a `src` are skipped: they never fire
|
|
313
|
+
* `cx-load` / `cx-error`, so they would hold the queue open until the timeout.
|
|
314
|
+
*/
|
|
315
|
+
private markRowImagesPending;
|
|
316
|
+
/**
|
|
317
|
+
* Clears an item from the in-flight set once its image settles (loaded or failed) and
|
|
318
|
+
* lets the next row through as soon as the row drains.
|
|
319
|
+
*/
|
|
320
|
+
private handleItemImageSettled;
|
|
321
|
+
/**
|
|
322
|
+
* Queues the next row release, if one is warranted and not already pending.
|
|
323
|
+
*
|
|
324
|
+
* Waits `rowReleaseDelay` when the previous row has drained, or up to
|
|
325
|
+
* `ROW_RELEASE_TIMEOUT` when it has not, so a stuck image only delays the grid
|
|
326
|
+
* instead of stopping it.
|
|
327
|
+
*/
|
|
328
|
+
private scheduleRowRelease;
|
|
329
|
+
/** Clears any pending release and resets the gate back to its initial state. */
|
|
330
|
+
private resetRowRelease;
|
|
252
331
|
/**
|
|
253
332
|
* Returns the index of the last item whose rowStart is within maxRows.
|
|
254
333
|
*/
|
|
@@ -291,6 +370,15 @@ export default class CxBentoGrid extends CortexElement {
|
|
|
291
370
|
* changes on every computeLayout() call, including resize-driven reflows) or
|
|
292
371
|
* the sync-row-content-height flag itself is toggled.
|
|
293
372
|
*/
|
|
373
|
+
/**
|
|
374
|
+
* Restarts row gating when the dataset shrinks or is replaced wholesale.
|
|
375
|
+
*
|
|
376
|
+
* Row indices refer to a specific layout, so keeping a release count across a new
|
|
377
|
+
* dataset would let its rows load all at once — the burst this gate exists to prevent.
|
|
378
|
+
* A dataset that only grew is treated as an appended page: the already-released rows
|
|
379
|
+
* still hold the same items, so their progress is kept and the new rows queue behind.
|
|
380
|
+
*/
|
|
381
|
+
handleDataChangeForRowRelease(oldData?: unknown, newData?: unknown): void;
|
|
294
382
|
handleRowContentHeightSync(): Promise<void>;
|
|
295
383
|
/**
|
|
296
384
|
* Get content position based on the size of the item.
|
|
@@ -41,12 +41,13 @@ export default class CxSbImage extends CxImage {
|
|
|
41
41
|
'cx-resize-observer': typeof import('../../../../../atoms/src/index.ts').CxResizeObserver;
|
|
42
42
|
'cx-skeleton': typeof import('../../../../../atoms/src/index.ts').CxSkeleton;
|
|
43
43
|
'cx-space': typeof import('../../../../../atoms/src/index.ts').CxSpace;
|
|
44
|
-
'cx-spinner': typeof import('../../../../../atoms/src/index.ts').CxSpinner;
|
|
45
44
|
};
|
|
46
45
|
/**
|
|
47
46
|
* Override the default behavior of retrying to load the image when it fails to load.
|
|
48
47
|
*/
|
|
49
48
|
retryOnError: boolean;
|
|
49
|
+
/** Content-builder images keep their measured box visible while the asset loads. */
|
|
50
|
+
skeleton: boolean;
|
|
50
51
|
/**
|
|
51
52
|
* The path to the image to load in dark mode.
|
|
52
53
|
*/
|
|
@@ -214,6 +215,15 @@ export default class CxSbImage extends CxImage {
|
|
|
214
215
|
* Whether the image has an click action.
|
|
215
216
|
*/
|
|
216
217
|
private get hasClickAction();
|
|
218
|
+
/**
|
|
219
|
+
* The rendered width in CSS pixels, used as the `sizes` hint so the browser can pick
|
|
220
|
+
* the smallest `srcset` candidate that still covers the box.
|
|
221
|
+
*
|
|
222
|
+
* A `%` width carries no pixel value, so the measured `clientWidth` is used instead.
|
|
223
|
+
* Returns 0 when neither is known yet (before first layout), which makes the caller
|
|
224
|
+
* omit `sizes` and fall back to the browser's default `100vw` assumption.
|
|
225
|
+
*/
|
|
226
|
+
private get displayWidth();
|
|
217
227
|
handleClickActionChange(): Promise<void>;
|
|
218
228
|
handleClickSpaceChange(): void;
|
|
219
229
|
handleObjectFitChange(): Promise<void>;
|
|
@@ -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
|
|
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
|
|
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;
|
|
@@ -3,6 +3,12 @@ export declare enum MenuItemCheckPlacement {
|
|
|
3
3
|
Prefix = "prefix",
|
|
4
4
|
Suffix = "suffix"
|
|
5
5
|
}
|
|
6
|
+
/** The ARIA roles a menu item can expose, i.e. the roles allowed as children of `role="menu"`. */
|
|
7
|
+
export declare enum MenuItemRole {
|
|
8
|
+
Checkbox = "menuitemcheckbox",
|
|
9
|
+
Item = "menuitem",
|
|
10
|
+
Radio = "menuitemradio"
|
|
11
|
+
}
|
|
6
12
|
/** Values accepted by the `aria-current` attribute, indicating what kind of "current" item this represents within a set. */
|
|
7
13
|
export declare enum AriaCurrentValue {
|
|
8
14
|
Date = "date",
|
|
@@ -11,6 +17,11 @@ export declare enum AriaCurrentValue {
|
|
|
11
17
|
Step = "step",
|
|
12
18
|
Time = "time"
|
|
13
19
|
}
|
|
20
|
+
/** The kind of menu item to render. `Checkbox` is required before `checked` has any effect. */
|
|
21
|
+
export declare enum MenuItemType {
|
|
22
|
+
Checkbox = "checkbox",
|
|
23
|
+
Normal = "normal"
|
|
24
|
+
}
|
|
14
25
|
/**
|
|
15
26
|
* Interface for menu item data that can be shared between events and components
|
|
16
27
|
* This breaks the circular dependency between events and atoms packages
|
|
@@ -37,7 +48,7 @@ export interface MenuItemData {
|
|
|
37
48
|
/** The text content/label of the menu item */
|
|
38
49
|
textContent?: string;
|
|
39
50
|
/** The type of menu item */
|
|
40
|
-
type?:
|
|
51
|
+
type?: MenuItemType;
|
|
41
52
|
/** The value associated with the menu item */
|
|
42
53
|
value?: string;
|
|
43
54
|
}
|
|
@@ -315,9 +315,12 @@ export interface Translation extends DefaultTranslation {
|
|
|
315
315
|
defaultWidth: string;
|
|
316
316
|
definition: string;
|
|
317
317
|
delete: string;
|
|
318
|
+
deleteAllTransitions: string;
|
|
318
319
|
deleteColumn: string;
|
|
320
|
+
deleteOptions: string;
|
|
319
321
|
deleteRow: string;
|
|
320
322
|
deleteTable: string;
|
|
323
|
+
deleteTransition: string;
|
|
321
324
|
deployStacks: string;
|
|
322
325
|
descending: string;
|
|
323
326
|
description: string;
|
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
import { Asset, Parameter, Transformation } from '../../../types/src/asset-link-format';
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* Width ladder used for `srcset` candidates, in CSS pixels.
|
|
5
|
+
*
|
|
6
|
+
* Kept as a small fixed ladder rather than a per-item computed width so that many
|
|
7
|
+
* items sharing a display size resolve to the same URLs and stay CDN-cache friendly.
|
|
8
|
+
*/
|
|
9
|
+
export declare const SRCSET_WIDTH_LADDER: readonly [400, 800, 1200, 1600, 2400];
|
|
3
10
|
export declare function buildTransformationString({ asset, baseUrl, extension, options, parameters, transformations, useSession, }: {
|
|
4
11
|
asset?: Asset;
|
|
5
12
|
baseUrl?: string;
|
|
@@ -19,3 +26,48 @@ export declare function buildTransformationString({ asset, baseUrl, extension, o
|
|
|
19
26
|
* and merged into an existing `/t/`. Other URLs keep the plain append behavior.
|
|
20
27
|
*/
|
|
21
28
|
export declare function applyTransformationsToUrl(url: string, transformations: Transformation[]): string;
|
|
29
|
+
/**
|
|
30
|
+
* Inserts a width-only resize into an asset-link URL, preserving any transformations
|
|
31
|
+
* already present.
|
|
32
|
+
*
|
|
33
|
+
* `applyTransformationsToUrl` is deliberately not reused here: it *replaces* an existing
|
|
34
|
+
* `/t/` segment (dropping a configured crop/rotate/quality) and drops the prettyName tail
|
|
35
|
+
* when doing so. This function prepends the resize to an existing segment instead, so a
|
|
36
|
+
* user's configured transformations survive.
|
|
37
|
+
*
|
|
38
|
+
* Returns the URL unchanged when it is not an asset-link URL, so arbitrary external
|
|
39
|
+
* sources are never rewritten.
|
|
40
|
+
*/
|
|
41
|
+
export declare function applyWidthToAssetUrl(url: string, width: number): string;
|
|
42
|
+
/**
|
|
43
|
+
* Whether the URL already carries a transformation segment.
|
|
44
|
+
*
|
|
45
|
+
* An existing `/t/` means a width was already chosen deliberately (a configured resize,
|
|
46
|
+
* crop or proxy format), so a ladder must not add a competing one.
|
|
47
|
+
*/
|
|
48
|
+
export declare function hasTransformSegment(url: string): boolean;
|
|
49
|
+
/**
|
|
50
|
+
* Builds a `srcset` value for an asset-link URL by emitting one width-only resize
|
|
51
|
+
* candidate per ladder entry, letting the browser fetch and decode only the pixels
|
|
52
|
+
* the layout actually needs.
|
|
53
|
+
*
|
|
54
|
+
* Candidates wider than `maxWidth` are dropped so the backend is never asked to
|
|
55
|
+
* upscale past the asset's real dimensions. When `maxWidth` falls below the whole
|
|
56
|
+
* ladder, the smallest candidate is still emitted so a `srcset` is always produced
|
|
57
|
+
* for an eligible URL.
|
|
58
|
+
*
|
|
59
|
+
* Returns an empty string when the URL is not an asset link, or when it already carries
|
|
60
|
+
* a transformation — signalling the caller to omit the attribute and honour the width
|
|
61
|
+
* that was configured upstream.
|
|
62
|
+
*/
|
|
63
|
+
export declare function buildAssetSrcset(url: string, options?: {
|
|
64
|
+
maxWidth?: number;
|
|
65
|
+
widths?: readonly number[];
|
|
66
|
+
}): string;
|
|
67
|
+
/**
|
|
68
|
+
* Builds a `sizes` value from a known display width in CSS pixels.
|
|
69
|
+
*
|
|
70
|
+
* Rounded up to `step` so small layout changes (a resize that shifts a grid cell by a
|
|
71
|
+
* few pixels) do not produce a new value on every frame.
|
|
72
|
+
*/
|
|
73
|
+
export declare function buildSizesFromDisplayWidth(displayWidth: number, step?: number): string;
|
|
@@ -544,7 +544,11 @@
|
|
|
544
544
|
/**
|
|
545
545
|
* The type of menu item to render. To use `checked`, this value must be set to `checkbox`.
|
|
546
546
|
*/
|
|
547
|
-
type?: '
|
|
547
|
+
type?: 'checkbox' | 'normal';
|
|
548
|
+
/**
|
|
549
|
+
* Overrides the ARIA role derived from `type`. Use `menuitemradio` for a checkbox item that is one choice out of a set.
|
|
550
|
+
*/
|
|
551
|
+
itemRole?: 'menuitemcheckbox' | 'menuitem' | 'menuitemradio';
|
|
548
552
|
/**
|
|
549
553
|
* The trigger type for the submenu.
|
|
550
554
|
*/
|
|
@@ -2511,6 +2515,14 @@
|
|
|
2511
2515
|
* The path to the image to load.
|
|
2512
2516
|
*/
|
|
2513
2517
|
src?: string;
|
|
2518
|
+
/**
|
|
2519
|
+
* Candidate sources for the underlying `img`, as a standard `srcset` value (e.g. `"…/re_w_400/img.jpg 400w, …/re_w_800/img.jpg 800w"`). <br/> Lets the browser fetch and decode only the pixels the layout needs, which is what bounds memory on image-heavy pages — a large original decodes to `naturalWidth × naturalHeight × 4` bytes regardless of its display size. Pair with `sizes`; without it the browser assumes the image is `100vw` wide.
|
|
2520
|
+
*/
|
|
2521
|
+
srcset?: string;
|
|
2522
|
+
/**
|
|
2523
|
+
* The `sizes` attribute for the underlying `img`, describing the rendered width (e.g. `"400px"`). Only meaningful together with `srcset`.
|
|
2524
|
+
*/
|
|
2525
|
+
sizes?: string;
|
|
2514
2526
|
/**
|
|
2515
2527
|
* The path to the placeholder image to be shown if src is not available.
|
|
2516
2528
|
*/
|
|
@@ -8035,6 +8047,10 @@
|
|
|
8035
8047
|
* Total number of items in the dataset, including those not yet loaded. When set, the scroll container height is extended to reflect the full dataset size so the scrollbar is accurate from the first render. Unloaded slots are approximated as 1×1 items.
|
|
8036
8048
|
*/
|
|
8037
8049
|
totalItems?: number;
|
|
8050
|
+
/**
|
|
8051
|
+
* Delay in milliseconds between releasing one row of images and the next. <br/> Images are held back until their row is released, so the browser opens roughly one row's worth of requests at a time instead of one per rendered item. Each transform URL is an uncached backend render, and enough of them in parallel returns 503. <br/> A row also waits for the previous row's images to finish (capped by `ROW_RELEASE_TIMEOUT`), so this is the floor between releases rather than the exact cadence. Set to `0` to disable gating and let every rendered row load immediately.
|
|
8052
|
+
*/
|
|
8053
|
+
rowReleaseDelay?: number;
|
|
8038
8054
|
/**
|
|
8039
8055
|
* The show content type.
|
|
8040
8056
|
*/
|