Skip to content

release: v4.4.3#604

Merged
hitesh-shetty-cstk merged 26 commits into
mainfrom
stage_v4
May 29, 2026
Merged

release: v4.4.3#604
hitesh-shetty-cstk merged 26 commits into
mainfrom
stage_v4

Conversation

@hitesh-shetty-cstk
Copy link
Copy Markdown
Contributor

@hitesh-shetty-cstk hitesh-shetty-cstk commented May 29, 2026

Live Preview SDK v4.4.3

Summary

Release v4.4.3 of @contentstack/live-preview-utils. Adds the overlayPropagation init flag, hardens behavior around custom-field multiple instances, fixes new-tab init carryover, and lands sizeable unit-test coverage.

What's changed

Features

  • Overlay propagation: New overlayPropagation init flag controls cslp hover/click propagation; extended to the standalone Live Preview Edit button.
  • Custom-field multiple instances: Suppress hover & click interactions for multiple custom-field instances. Toolbar actions on instance-level cslp elements now redirect to the whole-field parent via closest(), and restricted toolbar actions are scoped correctly.

Fixes

  • Carry over the remaining new-tab init parameters so live-preview state survives the redirect.
  • Increase throttle delay for the overlay mouse-move handler to reduce churn during rapid pointer movement.
  • Use optional chaining for fieldPathWithIndex in isCustomFieldMultipleInstance to avoid runtime errors on partial instances.

Tests

  • Added unit tests for useCollab / preview share, post-message hooks, and visual builder mode handling.
  • New tests for mouseClick, mouseHover, editButtonAction, fieldToolbar, getCsDataOfElement, getWholeFieldElement, handleIndividualFields, isCustomFieldMultipleInstance, contentstack-live-preview HOC, and the visual-builder index.

Docs

  • Documented overlayPropagation in the config list (main.mustache) and clarified its hover/click detection behavior.

Chores

  • Version bump to 4.4.3; CHANGELOG regenerated via auto-changelog.
  • README CDN snippet pinned to @contentstack/live-preview-utils@4.4.3.

Post-merge checklist

  • Merge this PR (stage_v4main)
  • Create GitHub Release v4.4.3 from main (tag created via Release UI) — triggers npm-publish workflow
  • Verify @contentstack/live-preview-utils@4.4.3 is published to npm
  • Verify CDN https://esm.sh/@contentstack/live-preview-utils@4.4.3 resolves

contentstackMridul and others added 26 commits May 19, 2026 15:00
test: added test cases for post message hook
…tances

For multiple custom fields, show the edit modal button only on
whole-field selection and suppress all toolbar actions (move,
delete, form, add-instance) for individual instances.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…/click

When event.target.closest("[data-cslp]") returns null, fall back to
document.elementsFromPoint(clientX, clientY) so Visual Builder hover and
click detection can find a data-cslp element beneath an unrelated sibling
overlay (e.g. an empty CSS-grid spacer cell visually overlapping a text
column). Opt-in via overlayPropagation: { enable: true } in the LP init
config; default off so existing apps see no behavior change.

- src/types/types.ts: IConfigOverlayPropagation interface, added to
  IInitData and IConfig.
- src/configManager/config.default.ts: default { enable: false } in both
  getUserInitData and getDefaultConfig.
- src/configManager/handleUserConfig.ts: merge initData.overlayPropagation
  onto Config, following the existing editButton fallback pattern.
- src/visualBuilder/utils/getCsDataOfElement.ts: elementsFromPoint
  fallback when closest() misses, gated on the flag.
- Tests: 3 new cases in getCsDataOfElement.test.ts (fallback off, on,
  on-with-no-match) and 3 cases in handleUserConfig.test.ts. vitest.setup
  extends the existing elementFromPoint stub with elementsFromPoint.
- docs/live-preview-configs.md + README.md: new section describing the
  flag and when to enable it; note that standalone LP Edit button support
  is tracked separately (VB-1623).

Refs VB-1583. Related: VB-1616 (multi-instance focus), VB-1623 (standalone
LP edit button overlayPropagation follow-up).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Port the overlayPropagation bullet added to README.md in commit 44e6d4c
so the template stays in sync and the entry survives README regeneration.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…dit button

Add elementsFromPoint fallback inside addCslpOutline() gated on
Config.get().overlayPropagation.enable so the floating Edit button can
pierce blocking sibling overlays, matching the existing Visual Builder
fix in getCsDataOfElement.ts.

Add a throttled mousemove listener (100ms) in LivePreviewEditButton
constructor (also gated on the flag) so the Edit button tracks the
cursor while it moves within the interior of a blocking overlay element —
mouseover alone does not re-fire in that case. Listener is cleaned up in
destroy().

Extract a highlightCslpElement helper in cslpdata.ts to avoid
duplicating the highlight logic between the composedPath loop and the
elementsFromPoint fallback.

Update docs/live-preview-configs.md to document both pipelines covered
by the flag and remove the "Visual Builder only" note.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…dit button

Add elementsFromPoint fallback inside addCslpOutline() gated on
Config.get().overlayPropagation.enable so the floating Edit button can
pierce blocking sibling overlays, matching the existing Visual Builder
fix in getCsDataOfElement.ts.

Add a throttled mousemove listener (100ms) in LivePreviewEditButton
constructor (also gated on the flag) so the Edit button tracks the
cursor while it moves within the interior of a blocking overlay element —
mouseover alone does not re-fire in that case. Listener is cleaned up in
destroy().

Fix a timing issue: the module-load effect creates LivePreviewEditButton
before init() runs (config defaults apply). LivePreview constructor now
calls destroy() on the effect-created instance before creating a new one
with the correct init config, ensuring overlayPropagation and other
user-provided config are honoured.

Extract a highlightCslpElement helper in cslpdata.ts to avoid
duplicating the highlight logic between the composedPath loop and the
elementsFromPoint fallback.

Update docs/live-preview-configs.md to document both pipelines covered
by the flag and remove the "Visual Builder only" note.

Tests: 3 new cases in cslpdata.test.ts (fallback off, on-finds-element,
on-no-match) and 3 cases in editButtonAction.test.ts (no listener when
disabled, listener added when enabled, listener removed on destroy).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
test: added unit test cases fo visual builder specific to mode
…tom field instances

Treat multiple custom field instances as non-interactive elements — no hover
outline, no custom cursor, no focus overlay or toolbar on click. Uses cached
schema check (hasFieldSchema guard) to avoid blocking UI on cold cache.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ntentstack/live-preview-sdk into VB-1583/custom-field-multiple-toolbar
…ent via closest()

- Extract getParentCslp and getWholeFieldElement utils to derive parent
  CSLP and locate DOM ancestor without global querySelector
- Handles V1 and V2 CSLP formats by stripping the trailing index segment
  from fieldMetadata.cslpValue instead of constructing CSLP from parts
- Use closest() to find nearest matching ancestor, preventing wrong
  element dispatch when same CSLP appears multiple times in the page
- Log debug message when whole-field parent is not found in DOM
- Add unit tests for getWholeFieldElement utility

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…le-toolbar

feat(VB-1583): restrict toolbar actions for multiple custom field instances
test: added test cases of useCollab / preview share
fix: added changes of new tab init related remaining code
@hitesh-shetty-cstk hitesh-shetty-cstk requested review from a team as code owners May 29, 2026 06:55
@github-actions
Copy link
Copy Markdown

🔒 Security Scan Results

ℹ️ Note: Only vulnerabilities with available fixes (upgrades or patches) are counted toward thresholds.

Check Type Count (with fixes) Without fixes Threshold Result
🔴 Critical Severity 0 0 10 ✅ Passed
🟠 High Severity 0 0 25 ✅ Passed
🟡 Medium Severity 0 0 500 ✅ Passed
🔵 Low Severity 0 0 1000 ✅ Passed

⏱️ SLA Breach Summary

✅ No SLA breaches detected. All vulnerabilities are within acceptable time thresholds.

Severity Breaches (with fixes) Breaches (no fixes) SLA Threshold (with/no fixes) Status
🔴 Critical 0 0 15 / 30 days ✅ Passed
🟠 High 0 0 30 / 120 days ✅ Passed
🟡 Medium 0 0 90 / 365 days ✅ Passed
🔵 Low 0 0 180 / 365 days ✅ Passed

✅ BUILD PASSED - All security checks passed

@github-actions
Copy link
Copy Markdown

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 66.52% 2472 / 3716
🔵 Statements 65.39% 2511 / 3840
🔵 Functions 64.06% 444 / 693
🔵 Branches 60.65% 1480 / 2440
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
src/configManager/config.default.ts 66.66% 100% 66.66% 66.66% 99
src/configManager/handleUserConfig.ts 100% 90.42% 100% 100%
src/cslp/cslpdata.ts 95.06% 91.66% 100% 98.63% 249, 257, 267, 268
src/livePreview/live-preview.ts 96.42% 76.47% 100% 96.42% 50
src/livePreview/editButton/editButton.ts 96.62% 89.47% 100% 97.71% 108-109, 180, 267, 412, 450, 563, 591, 638
src/livePreview/eventManager/postMessageEvent.hooks.ts 100% 98.24% 90% 100%
src/types/types.ts 100% 100% 100% 100%
src/visualBuilder/visualBuilder.style.ts 100% 100% 100% 100%
src/visualBuilder/components/FieldToolbar.tsx 66.12% 67.77% 47.61% 66.12% 67-112, 178-179, 222-238, 260-262, 286-293, 324-330, 340, 344, 397-401, 420
src/visualBuilder/eventManager/useCollab.ts 100% 92.5% 100% 100%
src/visualBuilder/listeners/mouseClick.ts 62.96% 59.49% 68.75% 65.38% 59, 72, 103-106, 115, 119-123, 137-164, 177, 199-202, 218, 264, 323-328, 370-375, 394-402
src/visualBuilder/listeners/mouseHover.ts 62.06% 47.36% 54.54% 64.7% 52-57, 75, 85, 92, 112, 128-136, 143, 151-158, 167, 179, 189-206, 214-215, 218-260, 282-285, 301-302, 311-317, 322-325, 327-328, 411, 418, 447
src/visualBuilder/utils/getCsDataOfElement.ts 100% 100% 100% 100%
src/visualBuilder/utils/getWholeFieldElement.ts 100% 100% 100% 100%
src/visualBuilder/utils/handleIndividualFields.ts 97.05% 77.77% 100% 97.05% 99
src/visualBuilder/utils/isCustomFieldMultipleInstance.ts 66.66% 80% 100% 100% 10
Generated in workflow #833 for commit 7121495 by the Vitest Coverage Report Action

Copy link
Copy Markdown
Contributor

@kirtesh-cstk kirtesh-cstk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Copy Markdown
Contributor

@contentstackMridul contentstackMridul left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@hitesh-shetty-cstk hitesh-shetty-cstk merged commit 1026d9b into main May 29, 2026
9 checks passed
@hitesh-shetty-cstk hitesh-shetty-cstk deleted the stage_v4 branch May 29, 2026 07:37
@hitesh-shetty-cstk hitesh-shetty-cstk restored the stage_v4 branch May 29, 2026 09:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants