@cntrl-site/components 1.0.109 → 1.0.111-alpha.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/dist/{Chronicles-Clc3aiGG.mjs → Chronicles-Cy2h3jlZ.mjs} +250 -249
- package/dist/Chronicles-D0ojQzOP.js +196 -0
- package/dist/{ChroniclesComponent-4QMq3nfr.js → ChroniclesComponent-FFenN7yL.js} +1 -1
- package/dist/{ChroniclesComponent-CwSeQzn1.mjs → ChroniclesComponent-cZLqN307.mjs} +53 -57
- package/dist/Components/Chronicles/Chronicles.d.ts +1 -2
- package/dist/Components/Chronicles/ChroniclesComponent.d.ts +2 -8
- package/dist/Components/PopupMenu/PopupMenu.d.ts +57 -0
- package/dist/Components/PopupMenu/PopupMenuComponent.d.ts +587 -0
- package/dist/Components/PopupMenu/popupMenuLayout.d.ts +140 -0
- package/dist/PopupMenu-BVc8Y4Tt.mjs +929 -0
- package/dist/PopupMenu-Dty5qHl8.js +348 -0
- package/dist/components-ByRCe3b5.js +1 -0
- package/dist/{components-Dn_5L1zL.mjs → components-DbxkGNoB.mjs} +605 -29
- package/dist/elements.js +1 -1
- package/dist/elements.mjs +10 -9
- package/dist/elements.node.js +1 -1
- package/dist/elements.node.mjs +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1 -1
- package/dist/index.mjs +44 -27
- package/dist/sources.js +24 -16
- package/dist/sources.mjs +24 -16
- package/dist/types/SchemaV1.d.ts +2 -0
- package/package.json +1 -1
- package/dist/Chronicles-DBqZzhwf.js +0 -198
- package/dist/components-CU9RB7sz.js +0 -1
package/dist/elements.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const i = {
|
|
2
2
|
"basic-burger": () => import(/* webpackFetchPriority: "high" */ "./Burger-BkVgNMGU.mjs").then((e) => e.Burger),
|
|
3
|
-
chronicles: () => import(/* webpackFetchPriority: "high" */ "./Chronicles-
|
|
3
|
+
chronicles: () => import(/* webpackFetchPriority: "high" */ "./Chronicles-Cy2h3jlZ.mjs").then((e) => e.Chronicles),
|
|
4
4
|
"click-gallerie": () => import(/* webpackFetchPriority: "high" */ "./ClickGallerie-Cjc_1Gxy.mjs").then((e) => e.ClickGallerie),
|
|
5
5
|
"control-slider": () => import(/* webpackFetchPriority: "high" */ "./ControlSlider-DqKfaKMG.mjs").then((e) => e.ControlSlider),
|
|
6
6
|
faq: () => import(/* webpackFetchPriority: "high" */ "./FAQ-BS-vO0l-.mjs").then((e) => e.FAQ),
|
|
@@ -17,6 +17,7 @@ const i = {
|
|
|
17
17
|
"marquee-text": () => import(/* webpackFetchPriority: "high" */ "./MarqueeText-C2E6UDsb.mjs").then((e) => e.MarqueeText),
|
|
18
18
|
mercury: () => import(/* webpackFetchPriority: "high" */ "./Mercury-CCW0Es-s.mjs").then((e) => e.Mercury),
|
|
19
19
|
"oneliner-form": () => import(/* webpackFetchPriority: "high" */ "./OnelinerForm-BEu7_sho.mjs").then((e) => e.OnelinerForm),
|
|
20
|
+
"popup-menu": () => import(/* webpackFetchPriority: "high" */ "./PopupMenu-BVc8Y4Tt.mjs").then((e) => e.n).then((e) => e.PopupMenu),
|
|
20
21
|
pretext: () => import(/* webpackFetchPriority: "high" */ "./Pretext-10CcyP1E.mjs").then((e) => e.Pretext),
|
|
21
22
|
scale: () => import(/* webpackFetchPriority: "high" */ "./Scale-TnkWtRrs.mjs").then((e) => e.Scale),
|
|
22
23
|
"simple-button": () => import(/* webpackFetchPriority: "high" */ "./SimpleButton-C-o2W9bS.mjs").then((e) => e.SimpleButton),
|
|
@@ -24,8 +25,8 @@ const i = {
|
|
|
24
25
|
testimonials: () => import(/* webpackFetchPriority: "high" */ "./TestimonialGrid-C-8IDzWu.mjs").then((e) => e.TestimonialGrid),
|
|
25
26
|
"testimonial-single": () => import(/* webpackFetchPriority: "high" */ "./TestimonialSingle-DrnyReim.mjs").then((e) => e.TestimonialSingle),
|
|
26
27
|
waterfall: () => import(/* webpackFetchPriority: "high" */ "./Waterfall-3kKioKh2.mjs").then((e) => e.Waterfall)
|
|
27
|
-
},
|
|
28
|
-
function
|
|
28
|
+
}, h = Object.keys(i), m = 3, a = 2e3, l = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map();
|
|
29
|
+
function p(e) {
|
|
29
30
|
return Object.prototype.hasOwnProperty.call(i, e);
|
|
30
31
|
}
|
|
31
32
|
function u(e) {
|
|
@@ -35,11 +36,11 @@ function c(e) {
|
|
|
35
36
|
var t;
|
|
36
37
|
return (((t = o.get(e)) == null ? void 0 : t.failures) ?? 0) > 0;
|
|
37
38
|
}
|
|
38
|
-
const
|
|
39
|
+
const s = (e) => !e.loading && e.failures > 0 && e.failures < m && Date.now() >= e.retryAt;
|
|
39
40
|
function f(e) {
|
|
40
|
-
if (!
|
|
41
|
+
if (!p(e)) return Promise.resolve(void 0);
|
|
41
42
|
const t = o.get(e);
|
|
42
|
-
if (t && !
|
|
43
|
+
if (t && !s(t)) return t.request;
|
|
43
44
|
const r = {
|
|
44
45
|
loading: !0,
|
|
45
46
|
failures: (t == null ? void 0 : t.failures) ?? 0,
|
|
@@ -47,7 +48,7 @@ function f(e) {
|
|
|
47
48
|
request: i[e]().then(
|
|
48
49
|
(n) => (l.set(e, n), r.failures = 0, n),
|
|
49
50
|
(n) => {
|
|
50
|
-
throw r.failures += 1, r.retryAt = Date.now() +
|
|
51
|
+
throw r.failures += 1, r.retryAt = Date.now() + a * 2 ** (r.failures - 1), n;
|
|
51
52
|
}
|
|
52
53
|
).finally(() => {
|
|
53
54
|
r.loading = !1;
|
|
@@ -56,9 +57,9 @@ function f(e) {
|
|
|
56
57
|
return o.set(e, r), r.request;
|
|
57
58
|
}
|
|
58
59
|
export {
|
|
59
|
-
|
|
60
|
+
h as componentElementIds,
|
|
60
61
|
u as getComponentElement,
|
|
61
|
-
|
|
62
|
+
p as hasComponentElement,
|
|
62
63
|
c as hasComponentElementFailed,
|
|
63
64
|
f as loadComponentElement
|
|
64
65
|
};
|
package/dist/elements.node.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./components-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./components-ByRCe3b5.js"),n=new Map(t.components.map(e=>[e.id,e.element])),o=[...n.keys()];function m(e){return n.has(e)}function l(e){return n.get(e)}function s(e){return!1}function r(e){return Promise.resolve(n.get(e))}exports.componentElementIds=o;exports.getComponentElement=l;exports.hasComponentElement=m;exports.hasComponentElementFailed=s;exports.loadComponentElement=r;
|
package/dist/elements.node.mjs
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -6,3 +6,5 @@ export type { ContentValue, PostFieldBinding, PostFieldEntry, PostFieldPage } fr
|
|
|
6
6
|
export { getAvailableStatePanels, getUnavailableStates, isPanelAvailable, } from './Components/utils/panelAvailability';
|
|
7
7
|
export type { PanelAvailabilityContext } from './Components/utils/panelAvailability';
|
|
8
8
|
export { nonForkableComponentIds } from './forking';
|
|
9
|
+
export { generatePopupMenuLayout, movePopupMenuBlock, resizePopupMenuBlock, settlePopupMenuLayout, snapPopupMenuTop, snapPopupMenuHeight, fitPopupMenuLayoutToGrid, isSamePopupMenuGrid, getPopupMenuHeight, getPopupMenuSides, getPopupMenuGrid, DEFAULT_POPUP_MENU_GRID, randomPopupMenuSeed, defaultPopupMenuLayoutRules, DEFAULT_POPUP_MENU_HEIGHT, } from './Components/PopupMenu/popupMenuLayout';
|
|
10
|
+
export type { PopupMenuBlockType, PopupMenuGrid, PopupMenuGridSettings, PopupMenuSides, PopupMenuSidesSetting, PopupMenuLayout, PopupMenuLayoutRules, PopupMenuMeasure, PopupMenuPlacement } from './Components/PopupMenu/popupMenuLayout';
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("./components-ByRCe3b5.js"),l=require("./panelAvailability-DnOe0rQ4.js"),e=require("./PopupMenu-Dty5qHl8.js");function d(t){return t.type==="object"&&t.version===1}function p(t){return{assetId:t,name:"",type:"image",objectFit:"cover"}}function M(t,{text:o,images:n}){switch(t){case"media-pair-list-input":return n.map(i=>({media:[p(i),p("")]}));case"media-list-input":return n.map(p);case"media-input":return n.length>0?p(n[0]):{assetId:"",name:""};case"rich-text":return[{type:"paragraph",children:[{text:o}]}];case"link-input":return{type:"url",value:"",target:"self"};default:return o}}function c(t,{pageId:o,slug:n}){return t==="link-input"?{type:"page",value:o,target:"self"}:`/${n}`}function g(t){var n;const o=((n=t==null?void 0:t.items)==null?void 0:n.properties)??{};return Object.entries(o).map(([i,a])=>{var P;const s=(P=a.display)==null?void 0:P.type;return{fieldKey:i,...a.contentKey!==void 0?{contentKey:a.contentKey}:{},fromEntry:r=>M(s,r),toPage:r=>c(s,r)}})}const m=[u.ControlSliderComponent.id,u.ControlImageRevealSliderComponent.id,u.LightboxComponent.id,u.PopupMenuComponent.id];exports.components=u.components;exports.getAvailableStatePanels=l.getAvailableStatePanels;exports.getUnavailableStates=l.getUnavailableStates;exports.isPanelAvailable=l.isPanelAvailable;exports.DEFAULT_POPUP_MENU_GRID=e.DEFAULT_POPUP_MENU_GRID;exports.DEFAULT_POPUP_MENU_HEIGHT=e.DEFAULT_POPUP_MENU_HEIGHT;exports.defaultPopupMenuLayoutRules=e.defaultPopupMenuLayoutRules;exports.fitPopupMenuLayoutToGrid=e.fitPopupMenuLayoutToGrid;exports.generatePopupMenuLayout=e.generatePopupMenuLayout;exports.getPopupMenuGrid=e.getPopupMenuGrid;exports.getPopupMenuHeight=e.getPopupMenuHeight;exports.getPopupMenuSides=e.getPopupMenuSides;exports.isSamePopupMenuGrid=e.isSamePopupMenuGrid;exports.movePopupMenuBlock=e.movePopupMenuBlock;exports.randomPopupMenuSeed=e.randomPopupMenuSeed;exports.resizePopupMenuBlock=e.resizePopupMenuBlock;exports.settlePopupMenuLayout=e.settlePopupMenuLayout;exports.snapPopupMenuHeight=e.snapPopupMenuHeight;exports.snapPopupMenuTop=e.snapPopupMenuTop;exports.getPostFieldBindings=g;exports.isSchemaV1=d;exports.nonForkableComponentIds=m;
|
package/dist/index.mjs
CHANGED
|
@@ -1,20 +1,21 @@
|
|
|
1
|
-
import { C as s, a as
|
|
2
|
-
import { c as
|
|
3
|
-
import { g as
|
|
4
|
-
|
|
1
|
+
import { C as s, a as l, L as d, P } from "./components-DbxkGNoB.mjs";
|
|
2
|
+
import { c as C } from "./components-DbxkGNoB.mjs";
|
|
3
|
+
import { g as S, a as E, i as U } from "./panelAvailability-D179wwJx.mjs";
|
|
4
|
+
import { D as _, k as h, j as x, f as F, g as G, e as I, c as T, d as j, i as A, m as D, h as H, r as B, s as K, b as O, a as R } from "./PopupMenu-BVc8Y4Tt.mjs";
|
|
5
|
+
function f(e) {
|
|
5
6
|
return e.type === "object" && e.version === 1;
|
|
6
7
|
}
|
|
7
|
-
function
|
|
8
|
+
function a(e) {
|
|
8
9
|
return { assetId: e, name: "", type: "image", objectFit: "cover" };
|
|
9
10
|
}
|
|
10
|
-
function
|
|
11
|
+
function c(e, { text: n, images: t }) {
|
|
11
12
|
switch (e) {
|
|
12
13
|
case "media-pair-list-input":
|
|
13
|
-
return t.map((
|
|
14
|
+
return t.map((o) => ({ media: [a(o), a("")] }));
|
|
14
15
|
case "media-list-input":
|
|
15
|
-
return t.map(
|
|
16
|
+
return t.map(a);
|
|
16
17
|
case "media-input":
|
|
17
|
-
return t.length > 0 ?
|
|
18
|
+
return t.length > 0 ? a(t[0]) : { assetId: "", name: "" };
|
|
18
19
|
case "rich-text":
|
|
19
20
|
return [{ type: "paragraph", children: [{ text: n }] }];
|
|
20
21
|
case "link-input":
|
|
@@ -26,31 +27,47 @@ function d(e, { text: n, images: t }) {
|
|
|
26
27
|
function m(e, { pageId: n, slug: t }) {
|
|
27
28
|
return e === "link-input" ? { type: "page", value: n, target: "self" } : `/${t}`;
|
|
28
29
|
}
|
|
29
|
-
function
|
|
30
|
+
function M(e) {
|
|
30
31
|
var t;
|
|
31
32
|
const n = ((t = e == null ? void 0 : e.items) == null ? void 0 : t.properties) ?? {};
|
|
32
|
-
return Object.entries(n).map(([
|
|
33
|
-
var
|
|
34
|
-
const
|
|
33
|
+
return Object.entries(n).map(([o, p]) => {
|
|
34
|
+
var i;
|
|
35
|
+
const r = (i = p.display) == null ? void 0 : i.type;
|
|
35
36
|
return {
|
|
36
|
-
fieldKey:
|
|
37
|
-
...
|
|
38
|
-
fromEntry: (
|
|
39
|
-
toPage: (
|
|
37
|
+
fieldKey: o,
|
|
38
|
+
...p.contentKey !== void 0 ? { contentKey: p.contentKey } : {},
|
|
39
|
+
fromEntry: (u) => c(r, u),
|
|
40
|
+
toPage: (u) => m(r, u)
|
|
40
41
|
};
|
|
41
42
|
});
|
|
42
43
|
}
|
|
43
|
-
const
|
|
44
|
+
const y = [
|
|
44
45
|
s.id,
|
|
45
|
-
|
|
46
|
-
|
|
46
|
+
l.id,
|
|
47
|
+
d.id,
|
|
48
|
+
P.id
|
|
47
49
|
];
|
|
48
50
|
export {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
51
|
+
_ as DEFAULT_POPUP_MENU_GRID,
|
|
52
|
+
h as DEFAULT_POPUP_MENU_HEIGHT,
|
|
53
|
+
C as components,
|
|
54
|
+
x as defaultPopupMenuLayoutRules,
|
|
55
|
+
F as fitPopupMenuLayoutToGrid,
|
|
56
|
+
G as generatePopupMenuLayout,
|
|
57
|
+
S as getAvailableStatePanels,
|
|
58
|
+
I as getPopupMenuGrid,
|
|
59
|
+
T as getPopupMenuHeight,
|
|
60
|
+
j as getPopupMenuSides,
|
|
61
|
+
M as getPostFieldBindings,
|
|
62
|
+
E as getUnavailableStates,
|
|
63
|
+
U as isPanelAvailable,
|
|
64
|
+
A as isSamePopupMenuGrid,
|
|
65
|
+
f as isSchemaV1,
|
|
66
|
+
D as movePopupMenuBlock,
|
|
67
|
+
y as nonForkableComponentIds,
|
|
68
|
+
H as randomPopupMenuSeed,
|
|
69
|
+
B as resizePopupMenuBlock,
|
|
70
|
+
K as settlePopupMenuLayout,
|
|
71
|
+
O as snapPopupMenuHeight,
|
|
72
|
+
R as snapPopupMenuTop
|
|
56
73
|
};
|
package/dist/sources.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("./ChroniclesComponent-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("./ChroniclesComponent-FFenN7yL.js"),e=`import { Fragment, useEffect, useLayoutEffect, useMemo, useRef, useState, type CSSProperties, type MouseEvent, type PointerEvent, type ReactNode } from 'react';
|
|
2
2
|
import { CommonComponentProps } from '../props';
|
|
3
3
|
import { buildColorVars, scalingValue, useScopedStyles } from '../utils';
|
|
4
4
|
import { useLightboxScrollLock } from '../utils/useLightboxScrollLock';
|
|
@@ -2818,7 +2818,6 @@ type ChroniclesProps = {
|
|
|
2818
2818
|
isEditor?: boolean;
|
|
2819
2819
|
isEditMode?: boolean;
|
|
2820
2820
|
isPreviewMode?: boolean;
|
|
2821
|
-
activeEvent?: string;
|
|
2822
2821
|
portalId?: string;
|
|
2823
2822
|
} & CommonComponentProps;
|
|
2824
2823
|
|
|
@@ -2885,11 +2884,17 @@ function isVideoMedia({ type, name, assetId }: ChroniclesMedia): boolean {
|
|
|
2885
2884
|
return VIDEO_EXTENSION_RE.test(name ?? '') || VIDEO_EXTENSION_RE.test(assetId);
|
|
2886
2885
|
}
|
|
2887
2886
|
|
|
2887
|
+
// The element that sets the article variables rather than one that inherits them, so it can be watched for
|
|
2888
|
+
// their changes: the editor sets them on its page container when the layout changes.
|
|
2888
2889
|
function findLayoutContainer(element: HTMLElement | null): HTMLElement | null {
|
|
2889
|
-
|
|
2890
|
-
|
|
2890
|
+
const width = element ? getComputedStyle(element).getPropertyValue('--cntrl-article-width').trim() : '';
|
|
2891
|
+
if (!width) return element;
|
|
2892
|
+
let container = element!;
|
|
2893
|
+
for (let el = container.parentElement; el; el = el.parentElement) {
|
|
2894
|
+
if (getComputedStyle(el).getPropertyValue('--cntrl-article-width').trim() !== width) break;
|
|
2895
|
+
container = el;
|
|
2891
2896
|
}
|
|
2892
|
-
return
|
|
2897
|
+
return container;
|
|
2893
2898
|
}
|
|
2894
2899
|
|
|
2895
2900
|
function getLayoutStyle(container: HTMLElement | null): CSSProperties {
|
|
@@ -2956,8 +2961,7 @@ function getCSS(P: string): string {
|
|
|
2956
2961
|
outline: 1px solid currentColor;
|
|
2957
2962
|
outline-offset: 2px;
|
|
2958
2963
|
}
|
|
2959
|
-
.\${P}-interactive .\${P}-trigger:hover
|
|
2960
|
-
.\${P}-state-hover .\${P}-trigger {
|
|
2964
|
+
.\${P}-interactive .\${P}-trigger:hover {
|
|
2961
2965
|
color: var(--\${P}-trigger-hover-color, var(--\${P}-trigger-color));
|
|
2962
2966
|
}
|
|
2963
2967
|
.\${P}-close:hover {
|
|
@@ -3108,8 +3112,7 @@ a.\${P}-row {
|
|
|
3108
3112
|
}
|
|
3109
3113
|
.\${P}-interactive .\${P}-row:hover .\${P}-title,
|
|
3110
3114
|
.\${P}-row:focus-visible .\${P}-title,
|
|
3111
|
-
.\${P}-panel-copy .\${P}-row-active .\${P}-title
|
|
3112
|
-
.\${P}-state-hover .\${P}-row:first-of-type .\${P}-title {
|
|
3115
|
+
.\${P}-panel-copy .\${P}-row-active .\${P}-title {
|
|
3113
3116
|
color: var(--\${P}-text-hover-color, var(--\${P}-text-color));
|
|
3114
3117
|
}
|
|
3115
3118
|
.\${P}-control-anchor {
|
|
@@ -3230,7 +3233,6 @@ export function Chronicles({
|
|
|
3230
3233
|
isEditor,
|
|
3231
3234
|
isEditMode,
|
|
3232
3235
|
isPreviewMode,
|
|
3233
|
-
activeEvent,
|
|
3234
3236
|
portalId,
|
|
3235
3237
|
currentState,
|
|
3236
3238
|
unavailableStates,
|
|
@@ -3355,9 +3357,17 @@ export function Chronicles({
|
|
|
3355
3357
|
});
|
|
3356
3358
|
const observer = new ResizeObserver(update);
|
|
3357
3359
|
observer.observe(wrapper);
|
|
3360
|
+
// the editor changes the variables a frame after a layout switch, without resizing either element then
|
|
3361
|
+
const styleObserver = new MutationObserver(update);
|
|
3358
3362
|
const layoutContainer = findLayoutContainer(wrapper);
|
|
3359
|
-
if (layoutContainer && layoutContainer !== wrapper)
|
|
3360
|
-
|
|
3363
|
+
if (layoutContainer && layoutContainer !== wrapper) {
|
|
3364
|
+
observer.observe(layoutContainer);
|
|
3365
|
+
styleObserver.observe(layoutContainer, { attributes: true, attributeFilter: ['style'] });
|
|
3366
|
+
}
|
|
3367
|
+
return () => {
|
|
3368
|
+
observer.disconnect();
|
|
3369
|
+
styleObserver.disconnect();
|
|
3370
|
+
};
|
|
3361
3371
|
}, [isLayerMounted]);
|
|
3362
3372
|
|
|
3363
3373
|
useLayoutEffect(() => {
|
|
@@ -3488,7 +3498,6 @@ export function Chronicles({
|
|
|
3488
3498
|
textHoverColor,
|
|
3489
3499
|
overlayColor,
|
|
3490
3500
|
}, COLOR_VAR_MAP, []);
|
|
3491
|
-
const stateClass = activeEvent && activeEvent !== 'default' ? \`\${P}-state-\${activeEvent}\` : '';
|
|
3492
3501
|
const interactiveClass = isInteractive ? \`\${P}-interactive\` : '';
|
|
3493
3502
|
const showPanelControls = Boolean(isEditMode) && (isInline || isOverlaySettled);
|
|
3494
3503
|
|
|
@@ -3616,7 +3625,6 @@ export function Chronicles({
|
|
|
3616
3625
|
isEditMode && \`\${P}-overlay-edit-mode\`,
|
|
3617
3626
|
isOverlayActive && \`\${P}-overlay-active\`,
|
|
3618
3627
|
interactiveClass,
|
|
3619
|
-
stateClass,
|
|
3620
3628
|
)}
|
|
3621
3629
|
style={{ ...colorVars, ...layoutStyle }}
|
|
3622
3630
|
role="dialog"
|
|
@@ -3647,7 +3655,7 @@ export function Chronicles({
|
|
|
3647
3655
|
const inlineLayer = isInline && mountedRows.size > 0 ? (
|
|
3648
3656
|
<div
|
|
3649
3657
|
ref={inlineLayerRef}
|
|
3650
|
-
className={cn(\`\${P}-inline-layer\`, isEditor && \`\${P}-overlay-editor\`, interactiveClass
|
|
3658
|
+
className={cn(\`\${P}-inline-layer\`, isEditor && \`\${P}-overlay-editor\`, interactiveClass)}
|
|
3651
3659
|
style={{ ...colorVars, ...layoutStyle }}
|
|
3652
3660
|
aria-hidden="true"
|
|
3653
3661
|
data-selection="none"
|
|
@@ -3663,7 +3671,7 @@ export function Chronicles({
|
|
|
3663
3671
|
<style dangerouslySetInnerHTML={{ __html: scopedCss }} />
|
|
3664
3672
|
<div
|
|
3665
3673
|
ref={wrapperRef}
|
|
3666
|
-
className={cn(isEditorCanvas && \`\${P}-editor\`, interactiveClass
|
|
3674
|
+
className={cn(isEditorCanvas && \`\${P}-editor\`, interactiveClass)}
|
|
3667
3675
|
style={colorVars}
|
|
3668
3676
|
>
|
|
3669
3677
|
{isInline ? renderPanel(false) : (
|
package/dist/sources.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { W as n, b as e, T as t, g as i, f as o, S as r, P as a, O as s, h as l, a as c, M as d, L as u, d as g, e as m, H as p, i as h, G as f, F as v, c as P, C as x, j as b, B as y } from "./ChroniclesComponent-
|
|
1
|
+
import { W as n, b as e, T as t, g as i, f as o, S as r, P as a, O as s, h as l, a as c, M as d, L as u, d as g, e as m, H as p, i as h, G as f, F as v, c as P, C as x, j as b, B as y } from "./ChroniclesComponent-cZLqN307.mjs";
|
|
2
2
|
const S = `import { Fragment, useEffect, useLayoutEffect, useMemo, useRef, useState, type CSSProperties, type MouseEvent, type PointerEvent, type ReactNode } from 'react';
|
|
3
3
|
import { CommonComponentProps } from '../props';
|
|
4
4
|
import { buildColorVars, scalingValue, useScopedStyles } from '../utils';
|
|
@@ -2819,7 +2819,6 @@ type ChroniclesProps = {
|
|
|
2819
2819
|
isEditor?: boolean;
|
|
2820
2820
|
isEditMode?: boolean;
|
|
2821
2821
|
isPreviewMode?: boolean;
|
|
2822
|
-
activeEvent?: string;
|
|
2823
2822
|
portalId?: string;
|
|
2824
2823
|
} & CommonComponentProps;
|
|
2825
2824
|
|
|
@@ -2886,11 +2885,17 @@ function isVideoMedia({ type, name, assetId }: ChroniclesMedia): boolean {
|
|
|
2886
2885
|
return VIDEO_EXTENSION_RE.test(name ?? '') || VIDEO_EXTENSION_RE.test(assetId);
|
|
2887
2886
|
}
|
|
2888
2887
|
|
|
2888
|
+
// The element that sets the article variables rather than one that inherits them, so it can be watched for
|
|
2889
|
+
// their changes: the editor sets them on its page container when the layout changes.
|
|
2889
2890
|
function findLayoutContainer(element: HTMLElement | null): HTMLElement | null {
|
|
2890
|
-
|
|
2891
|
-
|
|
2891
|
+
const width = element ? getComputedStyle(element).getPropertyValue('--cntrl-article-width').trim() : '';
|
|
2892
|
+
if (!width) return element;
|
|
2893
|
+
let container = element!;
|
|
2894
|
+
for (let el = container.parentElement; el; el = el.parentElement) {
|
|
2895
|
+
if (getComputedStyle(el).getPropertyValue('--cntrl-article-width').trim() !== width) break;
|
|
2896
|
+
container = el;
|
|
2892
2897
|
}
|
|
2893
|
-
return
|
|
2898
|
+
return container;
|
|
2894
2899
|
}
|
|
2895
2900
|
|
|
2896
2901
|
function getLayoutStyle(container: HTMLElement | null): CSSProperties {
|
|
@@ -2957,8 +2962,7 @@ function getCSS(P: string): string {
|
|
|
2957
2962
|
outline: 1px solid currentColor;
|
|
2958
2963
|
outline-offset: 2px;
|
|
2959
2964
|
}
|
|
2960
|
-
.\${P}-interactive .\${P}-trigger:hover
|
|
2961
|
-
.\${P}-state-hover .\${P}-trigger {
|
|
2965
|
+
.\${P}-interactive .\${P}-trigger:hover {
|
|
2962
2966
|
color: var(--\${P}-trigger-hover-color, var(--\${P}-trigger-color));
|
|
2963
2967
|
}
|
|
2964
2968
|
.\${P}-close:hover {
|
|
@@ -3109,8 +3113,7 @@ a.\${P}-row {
|
|
|
3109
3113
|
}
|
|
3110
3114
|
.\${P}-interactive .\${P}-row:hover .\${P}-title,
|
|
3111
3115
|
.\${P}-row:focus-visible .\${P}-title,
|
|
3112
|
-
.\${P}-panel-copy .\${P}-row-active .\${P}-title
|
|
3113
|
-
.\${P}-state-hover .\${P}-row:first-of-type .\${P}-title {
|
|
3116
|
+
.\${P}-panel-copy .\${P}-row-active .\${P}-title {
|
|
3114
3117
|
color: var(--\${P}-text-hover-color, var(--\${P}-text-color));
|
|
3115
3118
|
}
|
|
3116
3119
|
.\${P}-control-anchor {
|
|
@@ -3231,7 +3234,6 @@ export function Chronicles({
|
|
|
3231
3234
|
isEditor,
|
|
3232
3235
|
isEditMode,
|
|
3233
3236
|
isPreviewMode,
|
|
3234
|
-
activeEvent,
|
|
3235
3237
|
portalId,
|
|
3236
3238
|
currentState,
|
|
3237
3239
|
unavailableStates,
|
|
@@ -3356,9 +3358,17 @@ export function Chronicles({
|
|
|
3356
3358
|
});
|
|
3357
3359
|
const observer = new ResizeObserver(update);
|
|
3358
3360
|
observer.observe(wrapper);
|
|
3361
|
+
// the editor changes the variables a frame after a layout switch, without resizing either element then
|
|
3362
|
+
const styleObserver = new MutationObserver(update);
|
|
3359
3363
|
const layoutContainer = findLayoutContainer(wrapper);
|
|
3360
|
-
if (layoutContainer && layoutContainer !== wrapper)
|
|
3361
|
-
|
|
3364
|
+
if (layoutContainer && layoutContainer !== wrapper) {
|
|
3365
|
+
observer.observe(layoutContainer);
|
|
3366
|
+
styleObserver.observe(layoutContainer, { attributes: true, attributeFilter: ['style'] });
|
|
3367
|
+
}
|
|
3368
|
+
return () => {
|
|
3369
|
+
observer.disconnect();
|
|
3370
|
+
styleObserver.disconnect();
|
|
3371
|
+
};
|
|
3362
3372
|
}, [isLayerMounted]);
|
|
3363
3373
|
|
|
3364
3374
|
useLayoutEffect(() => {
|
|
@@ -3489,7 +3499,6 @@ export function Chronicles({
|
|
|
3489
3499
|
textHoverColor,
|
|
3490
3500
|
overlayColor,
|
|
3491
3501
|
}, COLOR_VAR_MAP, []);
|
|
3492
|
-
const stateClass = activeEvent && activeEvent !== 'default' ? \`\${P}-state-\${activeEvent}\` : '';
|
|
3493
3502
|
const interactiveClass = isInteractive ? \`\${P}-interactive\` : '';
|
|
3494
3503
|
const showPanelControls = Boolean(isEditMode) && (isInline || isOverlaySettled);
|
|
3495
3504
|
|
|
@@ -3617,7 +3626,6 @@ export function Chronicles({
|
|
|
3617
3626
|
isEditMode && \`\${P}-overlay-edit-mode\`,
|
|
3618
3627
|
isOverlayActive && \`\${P}-overlay-active\`,
|
|
3619
3628
|
interactiveClass,
|
|
3620
|
-
stateClass,
|
|
3621
3629
|
)}
|
|
3622
3630
|
style={{ ...colorVars, ...layoutStyle }}
|
|
3623
3631
|
role="dialog"
|
|
@@ -3648,7 +3656,7 @@ export function Chronicles({
|
|
|
3648
3656
|
const inlineLayer = isInline && mountedRows.size > 0 ? (
|
|
3649
3657
|
<div
|
|
3650
3658
|
ref={inlineLayerRef}
|
|
3651
|
-
className={cn(\`\${P}-inline-layer\`, isEditor && \`\${P}-overlay-editor\`, interactiveClass
|
|
3659
|
+
className={cn(\`\${P}-inline-layer\`, isEditor && \`\${P}-overlay-editor\`, interactiveClass)}
|
|
3652
3660
|
style={{ ...colorVars, ...layoutStyle }}
|
|
3653
3661
|
aria-hidden="true"
|
|
3654
3662
|
data-selection="none"
|
|
@@ -3664,7 +3672,7 @@ export function Chronicles({
|
|
|
3664
3672
|
<style dangerouslySetInnerHTML={{ __html: scopedCss }} />
|
|
3665
3673
|
<div
|
|
3666
3674
|
ref={wrapperRef}
|
|
3667
|
-
className={cn(isEditorCanvas && \`\${P}-editor\`, interactiveClass
|
|
3675
|
+
className={cn(isEditorCanvas && \`\${P}-editor\`, interactiveClass)}
|
|
3668
3676
|
style={colorVars}
|
|
3669
3677
|
>
|
|
3670
3678
|
{isInline ? renderPanel(false) : (
|
package/dist/types/SchemaV1.d.ts
CHANGED
|
@@ -97,6 +97,8 @@ export type ComponentContentProperty = {
|
|
|
97
97
|
min?: number;
|
|
98
98
|
max?: number;
|
|
99
99
|
default?: unknown;
|
|
100
|
+
/** How the field is drawn instead in a row whose `type` is one of these keys, laid over the rest. */
|
|
101
|
+
byRowType?: Record<string, Pick<ComponentContentProperty, 'placeholder' | 'display'>>;
|
|
100
102
|
};
|
|
101
103
|
export type ComponentContentSchema = {
|
|
102
104
|
type: 'array';
|