Skip to content

Size-reporter migrated to base vnext without sample changes - #4014

Merged
ChronosSF merged 3 commits into
vnextfrom
sstoychev/migrate-size-reporter
Aug 18, 2026
Merged

Size-reporter migrated to base vnext without sample changes#4014
ChronosSF merged 3 commits into
vnextfrom
sstoychev/migrate-size-reporter

Conversation

@ChronosSF

Copy link
Copy Markdown
Member

No description provided.

  Demos on the docs site render inside cross-origin iframes. By default
  styles.scss pins html/body to height:100% + overflow:hidden, so an
  iframe can only ever echo its own height back — it can't grow to fit its
  content. This adds the demo-side half of a small postMessage handshake
  with the docs host (astro-components' sample-widget) so samples that opt
  into fitContent size themselves to their actual content.

  How it works:
  - the host posts { type: 'igd-sample-fit', width? } into the iframe on
    load; until that arrives the reporter stays completely dormant, so
    fixed-height demos and their percentage layouts are untouched
  - on enable, it injects a one-time stylesheet that releases the viewport
    pin (height:auto, overflow:visible) and reports content size back with
    { type: 'igd-sample-height', height, width? } immediately and on every
    resize (via ResizeObserver)
  - width is measured from the right-most element edge rather than the body
    box, mirroring the host's same-origin measurement, and is only computed
    when the host asks for it

  Notes:
  - no-ops outside an iframe (window.parent === window) and when there is
    no window (SSR/prerender)
  - replies target the host's captured origin instead of broadcasting to
    '*', and only ever emit layout dimensions
  - shared across all three Angular apps (src, app-crm, app-lob) via the
    "@shared/sample-size-reporter" tsconfig path alias so there is a single
    source of truth

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR introduces a shared “sample size reporter” utility intended for iframe-embedded demos (to report content height/width to a docs host) and wires it into the various app entrypoints, along with some accompanying stylesheet cleanups.

Changes:

  • Added initSampleSizeReporter() utility and initialized it in src/main.ts and project entrypoints.
  • Added a TypeScript path alias for importing the shared reporter.
  • Adjusted/removed several sample and docs-layout SCSS rules.

Reviewed changes

Copilot reviewed 8 out of 9 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
tsconfig.json Adds paths alias for @shared/sample-size-reporter (but currently missing baseUrl).
src/sample-size-reporter.ts New shared utility to listen for a host message and post back size updates.
src/main.ts Initializes the reporter before bootstrapping the Angular app.
src/app/layouts/avatar/avatar-styling/layout.scss Updates avatar sample layout styles.
src/app/interactions/toggle/toggle-samples.scss Formatting cleanup and removal of nested theme-specific rules for toggle section.
src/app/index/docs-layout.component.scss Removes the previous ::ng-deep .custom-body styling (file becomes empty).
projects/app-lob/src/main.ts Initializes the reporter before bootstrapping the app-lob project.
projects/app-lob/src/app/index/docs-layout.component.scss Removes the previous ::ng-deep .custom-body styling (file becomes empty).
projects/app-crm/src/main.ts Initializes the reporter before bootstrapping the app-crm project.

💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/sample-size-reporter.ts
Comment thread src/app/layouts/avatar/avatar-styling/layout.scss

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 8 out of 9 changed files in this pull request and generated no new comments.

Suppressed comments (4)

src/app/layouts/avatar/avatar-styling/layout.scss:3

  • This replaces the avatar sample’s wrapping layout and sizing rules with a different host layout, which is a functional sample change despite the PR title stating that the migration has no sample changes. Either revert this hunk or update the stated scope and validate the intentional visual change.
:host {
  display: inline-flex;
  gap: 32px

src/app/interactions/toggle/toggle-samples.scss:20

  • Removing the dark-theme and custom-body rules changes the toggle samples’ themed foreground/background rendering, contrary to the PR’s stated “without sample changes” scope. Restore these rules unless this visual change is intentional and documented in the PR scope.
    box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);

src/app/index/docs-layout.component.scss:1

  • This removes the direct-sample layout’s .custom-body surface and contrast colors while AppComponent still applies that body class, so themed samples can render differently. That contradicts the PR title’s “without sample changes” scope; restore the rule or document and validate the intended visual change.
    projects/app-lob/src/app/index/docs-layout.component.scss:1
  • This removes the LOB direct-sample layout’s .custom-body surface and contrast colors while the LOB AppComponent still applies that class. The resulting theme-rendering change conflicts with the PR title’s “without sample changes” scope; restore the rule or document and validate the visual change.

@ChronosSF
ChronosSF merged commit b3f8cac into vnext Aug 18, 2026
8 checks passed
@ChronosSF
ChronosSF deleted the sstoychev/migrate-size-reporter branch August 18, 2026 13:30
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