@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/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-Clc3aiGG.mjs").then((e) => e.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
- }, p = Object.keys(i), a = 3, m = 2e3, l = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map();
28
- function s(e) {
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 h = (e) => !e.loading && e.failures > 0 && e.failures < a && Date.now() >= e.retryAt;
39
+ const s = (e) => !e.loading && e.failures > 0 && e.failures < m && Date.now() >= e.retryAt;
39
40
  function f(e) {
40
- if (!s(e)) return Promise.resolve(void 0);
41
+ if (!p(e)) return Promise.resolve(void 0);
41
42
  const t = o.get(e);
42
- if (t && !h(t)) return t.request;
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() + m * 2 ** (r.failures - 1), n;
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
- p as componentElementIds,
60
+ h as componentElementIds,
60
61
  u as getComponentElement,
61
- s as hasComponentElement,
62
+ p as hasComponentElement,
62
63
  c as hasComponentElementFailed,
63
64
  f as loadComponentElement
64
65
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./components-CU9RB7sz.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;
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;
@@ -1,4 +1,4 @@
1
- import { c as t } from "./components-Dn_5L1zL.mjs";
1
+ import { c as t } from "./components-DbxkGNoB.mjs";
2
2
  const n = new Map(t.map((e) => [e.id, e.element])), m = [...n.keys()];
3
3
  function r(e) {
4
4
  return n.has(e);
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 a=require("./components-CU9RB7sz.js"),s=require("./panelAvailability-DnOe0rQ4.js");function c(e){return e.type==="object"&&e.version===1}function i(e){return{assetId:e,name:"",type:"image",objectFit:"cover"}}function d(e,{text:n,images:t}){switch(e){case"media-pair-list-input":return t.map(o=>({media:[i(o),i("")]}));case"media-list-input":return t.map(i);case"media-input":return t.length>0?i(t[0]):{assetId:"",name:""};case"rich-text":return[{type:"paragraph",children:[{text:n}]}];case"link-input":return{type:"url",value:"",target:"self"};default:return n}}function m(e,{pageId:n,slug:t}){return e==="link-input"?{type:"page",value:n,target:"self"}:`/${t}`}function g(e){var t;const n=((t=e==null?void 0:e.items)==null?void 0:t.properties)??{};return Object.entries(n).map(([o,r])=>{var u;const p=(u=r.display)==null?void 0:u.type;return{fieldKey:o,...r.contentKey!==void 0?{contentKey:r.contentKey}:{},fromEntry:l=>d(p,l),toPage:l=>m(p,l)}})}const b=[a.ControlSliderComponent.id,a.ControlImageRevealSliderComponent.id,a.LightboxComponent.id];exports.components=a.components;exports.getAvailableStatePanels=s.getAvailableStatePanels;exports.getUnavailableStates=s.getUnavailableStates;exports.isPanelAvailable=s.isPanelAvailable;exports.getPostFieldBindings=g;exports.isSchemaV1=c;exports.nonForkableComponentIds=b;
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 u, L as c } from "./components-Dn_5L1zL.mjs";
2
- import { c as P } from "./components-Dn_5L1zL.mjs";
3
- import { g as x, a as j, i as k } from "./panelAvailability-D179wwJx.mjs";
4
- function g(e) {
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 r(e) {
8
+ function a(e) {
8
9
  return { assetId: e, name: "", type: "image", objectFit: "cover" };
9
10
  }
10
- function d(e, { text: n, images: t }) {
11
+ function c(e, { text: n, images: t }) {
11
12
  switch (e) {
12
13
  case "media-pair-list-input":
13
- return t.map((a) => ({ media: [r(a), r("")] }));
14
+ return t.map((o) => ({ media: [a(o), a("")] }));
14
15
  case "media-list-input":
15
- return t.map(r);
16
+ return t.map(a);
16
17
  case "media-input":
17
- return t.length > 0 ? r(t[0]) : { assetId: "", name: "" };
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 y(e) {
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(([a, i]) => {
33
- var p;
34
- const l = (p = i.display) == null ? void 0 : p.type;
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: a,
37
- ...i.contentKey !== void 0 ? { contentKey: i.contentKey } : {},
38
- fromEntry: (o) => d(l, o),
39
- toPage: (o) => m(l, o)
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 v = [
44
+ const y = [
44
45
  s.id,
45
- u.id,
46
- c.id
46
+ l.id,
47
+ d.id,
48
+ P.id
47
49
  ];
48
50
  export {
49
- P as components,
50
- x as getAvailableStatePanels,
51
- y as getPostFieldBindings,
52
- j as getUnavailableStates,
53
- k as isPanelAvailable,
54
- g as isSchemaV1,
55
- v as nonForkableComponentIds
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-4QMq3nfr.js"),e=`import { Fragment, useEffect, useLayoutEffect, useMemo, useRef, useState, type CSSProperties, type MouseEvent, type PointerEvent, type ReactNode } from 'react';
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
- for (let el = element; el; el = el.parentElement) {
2890
- if (getComputedStyle(el).getPropertyValue('--cntrl-article-width').trim()) return el;
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 element;
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) observer.observe(layoutContainer);
3360
- return () => observer.disconnect();
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, stateClass)}
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, stateClass)}
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-CwSeQzn1.mjs";
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
- for (let el = element; el; el = el.parentElement) {
2891
- if (getComputedStyle(el).getPropertyValue('--cntrl-article-width').trim()) return el;
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 element;
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) observer.observe(layoutContainer);
3361
- return () => observer.disconnect();
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, stateClass)}
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, stateClass)}
3675
+ className={cn(isEditorCanvas && \`\${P}-editor\`, interactiveClass)}
3668
3676
  style={colorVars}
3669
3677
  >
3670
3678
  {isInline ? renderPanel(false) : (
@@ -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';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cntrl-site/components",
3
- "version": "1.0.109",
3
+ "version": "1.0.111-alpha.0",
4
4
  "description": "Custom components for control editor and public websites.",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",