@bsuite/page-builder 2.7.1-next.0 → 2.7.1-next.2

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/README.md CHANGED
@@ -51,6 +51,13 @@ When adding `autoHeight` to an existing page's layout, bump that page's
51
51
 
52
52
  ## Edit-mode chrome (2.7.1-next.0+)
53
53
 
54
+ `PAGE_GRID_EDITING_EVENT` reports committed changes from `2.7.1-next.1`.
55
+ Its `{ pageKey, editing }` payload and event name are unchanged. The matching
56
+ canvas DOM is updated before listeners run, including when Save & Exit uses
57
+ a React transition. Initial mounting, unchanged state and abandoned transitions
58
+ do not emit notifications. Consumers must match the page key and preserve
59
+ focus on surviving inputs when synchronizing their header controls.
60
+
54
61
  While the canvas editor is open, each grid item renders an in-flow strip
55
62
  (`[data-slot="grid-item-editor-chrome"]`) above the card content: the widget
56
63
  name and a Hide control. The strip is **not** absolutely positioned over the
@@ -1 +1 @@
1
- {"version":3,"file":"PageGridLayout.d.ts","sourceRoot":"","sources":["../src/PageGridLayout.tsx"],"names":[],"mappings":"AAEA,OAAO,KAQN,MAAM,OAAO,CAAC;AAGf,OAAO,kCAAkC,CAAC;AAC1C,OAAO,gCAAgC,CAAC;AAsBxC,OAAO,KAAK,EAAe,mBAAmB,EAA4B,MAAM,YAAY,CAAC;AA2pB7F,wBAAgB,cAAc,CAAC,EAC7B,OAAO,EACP,cAAc,EACd,WAAW,EACX,aAAa,EACb,WAAW,EACX,gBAAgB,EAChB,iBAAiB,EACjB,OAAO,EACP,UAAU,EACV,SAAS,EAMT,WAAkB,EAClB,aAAsC,EACtC,QAAQ,EACR,iBAAiB,EACjB,gBAAgB,EAKhB,UAAkB,EAClB,yBAAiE,EACjE,kBAAkB,EAClB,sBAAsB,EACtB,mBAAmB,EACnB,+BAA6E,EAC7E,wBAAwB,EACxB,4BAA4B,EAC5B,4BAA4B,GAC7B,EAAE,mBAAmB,qBAu+BrB"}
1
+ {"version":3,"file":"PageGridLayout.d.ts","sourceRoot":"","sources":["../src/PageGridLayout.tsx"],"names":[],"mappings":"AAEA,OAAO,KAQN,MAAM,OAAO,CAAC;AAGf,OAAO,kCAAkC,CAAC;AAC1C,OAAO,gCAAgC,CAAC;AAsBxC,OAAO,KAAK,EAAe,mBAAmB,EAA4B,MAAM,YAAY,CAAC;AA4pB7F,wBAAgB,cAAc,CAAC,EAC7B,OAAO,EACP,cAAc,EACd,WAAW,EACX,aAAa,EACb,WAAW,EACX,gBAAgB,EAChB,iBAAiB,EACjB,OAAO,EACP,UAAU,EACV,SAAS,EAMT,WAAkB,EAClB,aAAsC,EACtC,QAAQ,EACR,iBAAiB,EACjB,gBAAgB,EAKhB,UAAkB,EAClB,yBAAiE,EACjE,kBAAkB,EAClB,sBAAsB,EACtB,mBAAmB,EACnB,+BAA6E,EAC7E,wBAAwB,EACxB,4BAA4B,EAC5B,4BAA4B,GAC7B,EAAE,mBAAmB,qBAu+BrB"}
@@ -358,13 +358,14 @@ const GridItem = React.memo(React.forwardRef(function GridItem({ id, content, is
358
358
  * `cardStyleVars` carries ONLY the properties the operator changed
359
359
  * (see cardStyle.ts). An untouched page spreads an empty object, so
360
360
  * this attribute is identical to what it was before the card editor
361
- * existed. `boxShadow` is set as a real declaration rather than a
362
- * custom property because it has to beat the `shadow-sm` class.
361
+ * existed. A chrome-owning surface applies `boxShadow` directly
362
+ * to beat its default class. Layout-only wrappers pass the token
363
+ * to the painted consumer without drawing a second shadow.
363
364
  */
364
365
  style: {
365
366
  contain: 'layout style',
366
367
  ...cardStyleVars,
367
- ...(cardStyleVars && '--card-shadow' in cardStyleVars
368
+ ...(chrome && cardStyleVars && '--card-shadow' in cardStyleVars
368
369
  ? { boxShadow: cardStyleVars['--card-shadow'] }
369
370
  : null),
370
371
  ...(cardStyleVars && '--card-padding' in cardStyleVars
@@ -1,13 +1,10 @@
1
1
  import type { GridLayouts, LayoutMigration, UsePageGridLayoutOptions, UsePageGridLayoutResult } from './types.js';
2
2
  export declare const DEFAULT_EDITOR_EVENT_NAMES: readonly ["bsuite-open-page-editor", "bsu-open-page-editor", "crm7-open-page-editor", "conduit-open-page-editor", "r80-open-page-editor"];
3
3
  /**
4
- * Event name broadcast on `window` whenever any PageGridLayout transitions
5
- * its `isEditing` state. Launcher widgets (e.g. floating "Edit Page" FABs)
6
- * subscribe to this so they can hide themselves while the canvas editor is
7
- * already active — prevents the redundant-affordance UX issue where a
8
- * "Edit Page" button sits in the corner while the editor banner is visible
9
- * at the top. `detail.editing` is the new state; `detail.pageKey` lets
10
- * launchers scope by page if they handle multiple grids on one screen.
4
+ * Broadcast after a PageGridLayout commits an editing-state change. Header
5
+ * launchers use this to synchronize their label and restore keyboard focus
6
+ * after canvas controls disappear. Initial state and abandoned transitions do
7
+ * not publish an event. `detail.pageKey` identifies the changed canvas.
11
8
  */
12
9
  export declare const PAGE_GRID_EDITING_EVENT = "bsuite-page-grid-editing";
13
10
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"usePageGridLayout.d.ts","sourceRoot":"","sources":["../src/usePageGridLayout.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAEV,WAAW,EACX,eAAe,EACf,wBAAwB,EACxB,uBAAuB,EACxB,MAAM,YAAY,CAAC;AAEpB,eAAO,MAAM,0BAA0B,2IAM7B,CAAC;AAEX;;;;;;;;GAQG;AACH,eAAO,MAAM,uBAAuB,6BAA6B,CAAC;AAElE;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,eAAO,MAAM,oBAAoB,OAAO,CAAC;AAiBzC;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,kBAAkB,CAAC,EACjC,KAAK,EACL,QAAQ,EACR,IAAI,EACJ,EAAE,EACF,UAAU,GACX,EAAE;IACD,KAAK,EAAE,WAAW,GAAG,SAAS,CAAC;IAC/B,QAAQ,EAAE,WAAW,CAAC;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;IACX,UAAU,EAAE,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EAChC,OAAO,EACP,cAAc,EACd,WAAgB,EAChB,aAAiB,EACjB,WAAkB,EAClB,gBAA6C,EAC7C,iBAA4C,EAC5C,iBAAiB,EACjB,gBAAgB,GACjB,EAAE,wBAAwB,GAAG,uBAAuB,CAuyBpD"}
@@ -11,13 +11,10 @@ export const DEFAULT_EDITOR_EVENT_NAMES = [
11
11
  'r80-open-page-editor',
12
12
  ];
13
13
  /**
14
- * Event name broadcast on `window` whenever any PageGridLayout transitions
15
- * its `isEditing` state. Launcher widgets (e.g. floating "Edit Page" FABs)
16
- * subscribe to this so they can hide themselves while the canvas editor is
17
- * already active — prevents the redundant-affordance UX issue where a
18
- * "Edit Page" button sits in the corner while the editor banner is visible
19
- * at the top. `detail.editing` is the new state; `detail.pageKey` lets
20
- * launchers scope by page if they handle multiple grids on one screen.
14
+ * Broadcast after a PageGridLayout commits an editing-state change. Header
15
+ * launchers use this to synchronize their label and restore keyboard focus
16
+ * after canvas controls disappear. Initial state and abandoned transitions do
17
+ * not publish an event. `detail.pageKey` identifies the changed canvas.
21
18
  */
22
19
  export const PAGE_GRID_EDITING_EVENT = 'bsuite-page-grid-editing';
23
20
  /**
@@ -124,19 +121,16 @@ export function usePageGridLayout({ pageKey, defaultLayouts, defaultCols = 12, l
124
121
  const effectiveLayoutVersion = layoutVersion + PACKAGE_LAYOUT_EPOCH;
125
122
  const containerRef = useRef(null);
126
123
  const [containerWidth, setContainerWidth] = useState(0);
127
- const [isEditing, setIsEditingState] = useState(false);
128
- const setIsEditing = useCallback((next) => {
129
- setIsEditingState((previous) => {
130
- const resolved = typeof next === 'function' ? next(previous) : next;
131
- if (resolved !== previous && typeof window !== 'undefined') {
132
- // Broadcast to FAB launchers so they can hide while the editor is open.
133
- window.dispatchEvent(new CustomEvent(PAGE_GRID_EDITING_EVENT, {
134
- detail: { pageKey, editing: resolved },
135
- }));
136
- }
137
- return resolved;
138
- });
139
- }, [pageKey]);
124
+ const [isEditing, setIsEditing] = useState(false);
125
+ const publishedEditing = useRef(false);
126
+ useEffect(() => {
127
+ if (publishedEditing.current === isEditing)
128
+ return;
129
+ publishedEditing.current = isEditing;
130
+ window.dispatchEvent(new CustomEvent(PAGE_GRID_EDITING_EVENT, {
131
+ detail: { pageKey, editing: isEditing },
132
+ }));
133
+ }, [isEditing, pageKey]);
140
134
  const [resetConfirmOpen, setResetConfirmOpen] = useState(false);
141
135
  useLayoutEffect(() => {
142
136
  const el = containerRef.current;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bsuite/page-builder",
3
- "version": "2.7.1-next.0",
3
+ "version": "2.7.1-next.2",
4
4
  "description": "Shared BSuite responsive page-builder grid and layout persistence primitives",
5
5
  "type": "module",
6
6
  "license": "UNLICENSED",