@aglyn/plugins-mui 1.0.0-beta.222 → 1.0.0-beta.224
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aglyn/plugins-mui",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.224",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"homepage": "https://aglyn.com",
|
|
6
6
|
"repository": {
|
|
@@ -25,12 +25,12 @@
|
|
|
25
25
|
"./package.json": "./package.json"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@aglyn/aglyn": "1.0.0-beta.
|
|
29
|
-
"@aglyn/shared-data-enums": "1.0.0-beta.
|
|
30
|
-
"@aglyn/shared-data-mdi": "1.0.0-beta.
|
|
31
|
-
"@aglyn/shared-ui-jsx": "1.0.0-beta.
|
|
32
|
-
"@aglyn/shared-ui-theme": "1.0.0-beta.
|
|
33
|
-
"@aglyn/shared-util-vendor": "1.0.0-beta.
|
|
28
|
+
"@aglyn/aglyn": "1.0.0-beta.224",
|
|
29
|
+
"@aglyn/shared-data-enums": "1.0.0-beta.224",
|
|
30
|
+
"@aglyn/shared-data-mdi": "1.0.0-beta.224",
|
|
31
|
+
"@aglyn/shared-ui-jsx": "1.0.0-beta.224",
|
|
32
|
+
"@aglyn/shared-ui-theme": "1.0.0-beta.224",
|
|
33
|
+
"@aglyn/shared-util-vendor": "1.0.0-beta.224",
|
|
34
34
|
"@swc/helpers": "0.5.23",
|
|
35
35
|
"mobx": "^7.0.5",
|
|
36
36
|
"mobx-react-lite": "^5.1.0"
|
|
@@ -196,6 +196,7 @@ const usable = (value)=>typeof value === 'number' && Number.isFinite(value) && v
|
|
|
196
196
|
small: values.length > 0 && values.every(isSmall)
|
|
197
197
|
};
|
|
198
198
|
}
|
|
199
|
+
/** No published page nests deeper; a walk past this is following a cycle. */ const MAX_LAYOUT_DEPTH = 256;
|
|
199
200
|
/** The Grid element's persisted component id (`grid.tsx`). */ const GRID_COMPONENT_ID = 'muiGrid';
|
|
200
201
|
/** The Container element's persisted component id (`container.ts`). */ const CONTAINER_COMPONENT_ID = 'muiContainer';
|
|
201
202
|
/**
|
|
@@ -350,8 +351,16 @@ const REPEAT_TRACKS = /^repeat\(\s*(\d+)\s*,\s*(1fr|minmax\(\s*0(?:px)?\s*,\s*1f
|
|
|
350
351
|
// stated length, not as layout.
|
|
351
352
|
if (node) applySizing(node, false);
|
|
352
353
|
let child = node;
|
|
353
|
-
|
|
354
|
+
// Stored pages name the root as its own parent (`parentId: "_@_"`), so a
|
|
355
|
+
// walk that only stops at a missing parent never ends (AGL-3565). Stop at
|
|
356
|
+
// any node already visited, and never climb further than a page can nest.
|
|
357
|
+
const visited = new Set(node ? [
|
|
358
|
+
node
|
|
359
|
+
] : []);
|
|
360
|
+
let depth = 0;
|
|
361
|
+
for(let current = node == null ? void 0 : node.parent; current && !visited.has(current) && depth < MAX_LAYOUT_DEPTH; current = current.parent, depth += 1){
|
|
354
362
|
var _sx_columnGap;
|
|
363
|
+
visited.add(current);
|
|
355
364
|
const props = propsOf(current);
|
|
356
365
|
if (current.componentId === GRID_COMPONENT_ID) {
|
|
357
366
|
const spans = gridSpanPerBand(props['size']);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../../libs/plugins/mui/src/lib/utils/image-sizes.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2026 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport * as Aglyn from '@aglyn/aglyn'\nimport { parseBreakpointSpan } from '@aglyn/shared-data-enums'\n\n/**\n * The Image element's `sizes` attribute (AGL-3485): how wide the browser\n * should assume the picture will be, which decides the `srcset` candidate it\n * downloads.\n *\n * Every image used to say `100vw`, so a 68px navbar logo and a 302px card\n * picture both fetched a 1280px or 1920px variant. The answer is now decided\n * in this order, first answer wins:\n *\n * 1. **The author's own Sizes attribute**, verbatim. An escape hatch for\n * someone who knows the attribute; nobody needs to touch it.\n * 2. **Per breakpoint band, a pixel width the element itself states**: a\n * pixel `width` (`'320px'`, or a plain number in `sx`, which MUI reads as\n * pixels), or a pixel `height` under `width: auto` at the asset's known\n * shape. Responsive values are read per band, so the header logo's\n * `height: { xs: 44, md: 56 }` is a 54px slot on a phone and a 68px one\n * from `md` up.\n * 3. **Per band, the width the Besigner MEASURED** when the page was saved.\n * 4. **Per band, the slot the layout around the image states**\n * ({@link layoutBandWidths}): Grid spans, `repeat(n, 1fr)` grids, widths\n * and max widths, and the Container that caps the page.\n * 5. For a band nothing describes, the next narrower band's answer, and\n * `100vw` only for the narrowest band when nothing at all is known.\n *\n * Steps 2 and 4 are computed from the node tree the page renders, so they hold\n * for every page already published — on the server, with no re-save. The\n * measurement only refines what the layout cannot state.\n *\n * ## Why this does not bring back the AGL-2486 layout break\n *\n * `sizes` is not only a delivery hint: with `w` descriptors it is the image's\n * intrinsic width, which is what `width: 100%` resolves against inside a\n * shrink-to-fit parent. `sizes=\"auto\"` broke fluid images because it is\n * circular there (300px default object size). Every answer above is a real\n * width of the slot the image fills: a definite length, a share of a parent of\n * definite width, or a measurement of the very layout being described —\n * which is a fixed point, since an image whose intrinsic width is its\n * measured width lays out at its measured width.\n */\nexport interface ImageSizesInput {\n /** The author's Sizes attribute. */\n sizes?: unknown\n /** The element's `width` attribute, as the author set it. */\n width?: unknown\n /** The element's `height` attribute, as the author set it. */\n height?: unknown\n /**\n * The node's own styles. Their `width` and `height` win over the\n * attributes, as they do in the render (`sx` is composed after the\n * defaults the attributes set).\n */\n sx?: unknown\n intrinsicWidth?: unknown\n intrinsicHeight?: unknown\n /** What the Besigner measured, as the save stored it. */\n renderedWidths?: unknown\n /** What the layout around the image states, per band. */\n layoutWidths?: LayoutWidths\n}\n\nexport interface ImageSizes {\n sizes: string\n /**\n * The evidence says the image renders small everywhere it is known: a\n * pixel width of {@link SMALL_IMAGE_MAX_PX} or less, or under\n * {@link SMALL_IMAGE_MAX_PERCENT} of the page, in every band that was\n * stated, measured or derived. A lead image that is small is a logo or an\n * icon, not the page's largest paint, and gets no `fetchpriority=\"high\"`.\n */\n small: boolean\n}\n\n/** At or under this many pixels wide an image is not a hero. */\nexport const SMALL_IMAGE_MAX_PX = 240\n\n/** Under this share of the page in every known band, an image is not a hero. */\nexport const SMALL_IMAGE_MAX_PERCENT = 40\n\ntype Band = Aglyn.RenderedWidthBand\ntype BandValues<T> = Partial<Record<Band, T>>\n\nconst BANDS = Aglyn.RENDERED_WIDTH_BANDS\n\n/**\n * One slot the layout states for a band: a share of the viewport less the\n * gutters and gaps taken out of it, and the pixel width it can never exceed\n * when something above it caps the page — `min(vw% - offset, cap)`.\n */\nexport interface LayoutSlot {\n vw: number\n offsetPx?: number\n capPx?: number\n}\n\nexport type LayoutWidths = BandValues<LayoutSlot>\n\n/**\n * A responsive value's reading at every band, cascading upwards the way MUI\n * applies one: a band with no value of its own takes the nearest narrower\n * band's. A scalar applies everywhere, an array is MUI's breakpoint array,\n * and keys that are not bands — a dark-scheme slice, a raw media query — are\n * not read.\n */\nfunction bandValues(value: unknown): BandValues<unknown> {\n if (value === undefined || value === null || value === '') return {}\n let stated: BandValues<unknown>\n if (Array.isArray(value)) {\n stated = {}\n value.forEach((entry, index) => {\n if (index < BANDS.length && entry !== null && entry !== undefined) {\n stated[BANDS[index]] = entry\n }\n })\n } else if (typeof value === 'object') {\n stated = {}\n for (const band of BANDS) {\n const entry = (value as Record<string, unknown>)[band]\n if (entry !== undefined && entry !== null) stated[band] = entry\n }\n } else {\n return Object.fromEntries(BANDS.map((band) => [band, value]))\n }\n const out: BandValues<unknown> = {}\n let current: unknown\n for (const band of BANDS) {\n if (stated[band] !== undefined) current = stated[band]\n if (current !== undefined) out[band] = current\n }\n return out\n}\n\n/**\n * A CSS sizing value as MUI's `sx` reads it: a number in (0, 1] is a share of\n * the parent, any other number is pixels, and a string may be either unit.\n */\ntype Length =\n | { kind: 'px'; value: number }\n | { kind: 'fraction'; value: number }\n | { kind: 'vw'; value: number }\n | { kind: 'auto' }\n\nfunction length(value: unknown): Length | undefined {\n if (typeof value === 'number' && Number.isFinite(value)) {\n if (value > 0 && value <= 1) return { kind: 'fraction', value }\n return value > 1 ? { kind: 'px', value } : undefined\n }\n if (typeof value !== 'string') return undefined\n const text = value.trim()\n if (text === 'auto') return { kind: 'auto' }\n const match = /^(\\d+(?:\\.\\d+)?)(px|%|vw)$/.exec(text)\n if (!match) return undefined\n const amount = Number(match[1])\n if (!(amount > 0)) return undefined\n if (match[2] === 'px') return { kind: 'px', value: amount }\n if (match[2] === 'vw') return { kind: 'vw', value: amount }\n return { kind: 'fraction', value: amount / 100 }\n}\n\n/** A node's `sx` as one plain object: an array of objects merged in order. */\nfunction plainSx(sx: unknown): Record<string, unknown> {\n if (Array.isArray(sx)) {\n return Object.assign(\n {},\n ...sx.filter(\n (entry) => entry && typeof entry === 'object' && !Array.isArray(entry),\n ),\n )\n }\n return sx && typeof sx === 'object' ? (sx as Record<string, unknown>) : {}\n}\n\nconst usable = (value: unknown): value is number =>\n typeof value === 'number' && Number.isFinite(value) && value > 0\n\n/**\n * The length the element itself states per band, as a `sizes` length: a\n * pixel or viewport width, or a pixel height under `width: auto` at the\n * asset's shape. Per band, so a responsive value is read the way MUI applies\n * it; a band where the element states nothing usable is left to the layout.\n */\nfunction ownLengths(input: ImageSizesInput): BandValues<string> {\n const sx = plainSx(input.sx)\n const widths = bandValues(input.width)\n const heights = bandValues(input.height)\n const sxWidths = bandValues(sx['width'])\n const sxHeights = bandValues(sx['height'])\n const ratio =\n usable(input.intrinsicWidth) && usable(input.intrinsicHeight)\n ? input.intrinsicWidth / input.intrinsicHeight\n : undefined\n const out: BandValues<string> = {}\n for (const band of BANDS) {\n const width = length(sxWidths[band] ?? widths[band])\n if (width?.kind === 'px') {\n out[band] = `${Math.round(width.value)}px`\n continue\n }\n if (width?.kind === 'vw') {\n out[band] = `${Math.round(width.value * 10) / 10}vw`\n continue\n }\n const height = length(sxHeights[band] ?? heights[band])\n if (width?.kind === 'auto' && height?.kind === 'px' && ratio) {\n out[band] = `${Math.round(height.value * ratio)}px`\n }\n }\n return out\n}\n\n/** A layout slot as a `sizes` length for a band. */\nfunction slotLength(band: Band, slot: LayoutSlot): string {\n // A cap that binds across the whole band — the page is at least the band's\n // minimum wide, so the slot is the cap from its first pixel — is the\n // definite length. Below that, the share of the viewport is the answer, and\n // it can only overstate the slot by the gutters.\n const offset = slot.offsetPx ?? 0\n // A pixel of slack absorbs the rounding of the share and the cap.\n if (\n slot.capPx !== undefined &&\n slot.capPx <=\n (slot.vw / 100) * Aglyn.RENDERED_WIDTH_BAND_MIN[band] - offset + 1\n ) {\n return `${slot.capPx}px`\n }\n return offset >= 1 ? `calc(${slot.vw}vw - ${offset}px)` : `${slot.vw}vw`\n}\n\n/**\n * What was measured, with the layout's statement filling the bands the\n * Besigner never saw.\n *\n * A measured band wins. Above it, the layout's value is used only where it\n * says something NEW — a value that differs from the one the layout gave the\n * measured band. A value it merely carried up from the measured band's span\n * is the same slot measured more precisely, so the measurement carries\n * instead: a cell measured at 28% on a large screen is not 33% on a wider\n * one just because its span did not change.\n */\nfunction combineBandLengths(\n measured: Aglyn.RenderedWidths,\n layout: BandValues<string>,\n): BandValues<string> {\n const known: BandValues<string> = {}\n let lastMeasured: string | undefined\n let layoutWhenMeasured: string | undefined\n for (const band of BANDS) {\n const value = measured[band]\n if (value !== undefined) {\n known[band] = `${value}vw`\n lastMeasured = known[band]\n layoutWhenMeasured = layout[band]\n continue\n }\n const stated = layout[band]\n if (stated !== undefined && stated !== layoutWhenMeasured) {\n known[band] = stated\n } else if (lastMeasured !== undefined) {\n known[band] = lastMeasured\n }\n }\n return known\n}\n\n/** Whether a known length is a small slot. */\nfunction isSmall(css: string): boolean {\n if (css.endsWith('px') && !css.startsWith('calc(')) {\n return Number.parseFloat(css) <= SMALL_IMAGE_MAX_PX\n }\n const vw = /(\\d+(?:\\.\\d+)?)vw/.exec(css)\n return vw ? Number(vw[1]) < SMALL_IMAGE_MAX_PERCENT : false\n}\n\n/** The `sizes` an Image element should carry. See the module note. */\nexport function imageSizes(input: ImageSizesInput): ImageSizes {\n const authored = typeof input.sizes === 'string' ? input.sizes.trim() : ''\n if (authored) return { sizes: authored, small: false }\n const layout: BandValues<string> = {}\n for (const band of BANDS) {\n const slot = input.layoutWidths?.[band]\n if (slot) layout[band] = slotLength(band, slot)\n }\n const known = {\n ...combineBandLengths(\n Aglyn.parseRenderedWidths(input.renderedWidths),\n layout,\n ),\n ...ownLengths(input),\n }\n const values = Object.values(known) as string[]\n return {\n sizes: Aglyn.sizesFromBandLengths(known),\n small: values.length > 0 && values.every(isSmall),\n }\n}\n\n/** The Grid element's persisted component id (`grid.tsx`). */\nconst GRID_COMPONENT_ID = 'muiGrid'\n\n/** The Container element's persisted component id (`container.ts`). */\nconst CONTAINER_COMPONENT_ID = 'muiContainer'\n\n/**\n * A Container's `maxWidth` keys in pixels: MUI's, `xs` floored at 444px. An\n * absent or cleared value is MUI's own `lg` (the element drops a cleared one\n * so MUI's default applies, AGL-1435); `false` caps nothing.\n */\nconst CONTAINER_MAX_WIDTHS: Readonly<Record<string, number>> = {\n xs: 444,\n sm: 600,\n md: 900,\n lg: 1200,\n xl: 1536,\n}\n\n/**\n * A Container's side gutters: MUI's `theme.spacing(2)` a side on a phone and\n * `theme.spacing(3)` from `sm` up.\n */\nconst CONTAINER_GUTTER_PX: Readonly<Record<Band, number>> = {\n xs: 16,\n sm: 24,\n md: 24,\n lg: 24,\n xl: 24,\n}\n\n/** One theme spacing unit; MUI's default, which `sx` gaps are counted in. */\nconst SPACING_PX = 8\n\n/** A gap in pixels: a number is theme spacing units, a string must be px. */\nfunction gapPixels(value: unknown): number {\n if (typeof value === 'number' && Number.isFinite(value) && value > 0) {\n return value * SPACING_PX\n }\n const text = String(value ?? '').trim()\n if (/^\\d+(?:\\.\\d+)?$/.test(text)) return Number(text) * SPACING_PX\n const match = /^(\\d+(?:\\.\\d+)?)px$/.exec(text)\n return match ? Number(match[1]) : 0\n}\n\n/** A node as the canvas holds it, as far as this walk reads it. */\nexport interface LayoutNode {\n componentId?: string\n props?: Record<string, unknown>\n resolvedProps?: Record<string, unknown>\n sx?: unknown\n parent?: LayoutNode | undefined\n}\n\nconst propsOf = (node: LayoutNode | undefined) =>\n node?.resolvedProps ?? node?.props ?? {}\n\n/** A Grid cell's span at each band: a column count, or `null` for auto/grow. */\nfunction gridSpanPerBand(size: unknown): BandValues<number | null> {\n if (size === undefined || size === null || size === '') return {}\n const span = parseBreakpointSpan(size as string | number)\n if (span.raw !== undefined) return {}\n const read = (value: unknown) => (typeof value === 'number' ? value : null)\n if (span.base !== undefined) {\n const value = read(span.base)\n return Object.fromEntries(BANDS.map((band) => [band, value]))\n }\n const values: Record<string, unknown> = {}\n for (const [band, value] of Object.entries(span.values ?? {})) {\n values[band] = read(value)\n }\n return bandValues(values) as BandValues<number | null>\n}\n\nconst FR_TRACK = /^(?:1fr|minmax\\(\\s*0(?:px)?\\s*,\\s*1fr\\s*\\))$/\nconst REPEAT_TRACKS =\n /^repeat\\(\\s*(\\d+)\\s*,\\s*(1fr|minmax\\(\\s*0(?:px)?\\s*,\\s*1fr\\s*\\))\\s*\\)$/\n\n/**\n * The equal tracks a `gridTemplateColumns` value lays out: `repeat(3, 1fr)`,\n * or the same written out, `1fr 1fr 1fr` — and a single `1fr`, which is one\n * column the full width. Anything else (fixed tracks, `auto-fill`) is not an\n * equal split this can state.\n */\nfunction equalTracks(value: unknown): number | undefined {\n const text = String(value ?? '').trim()\n const repeat = REPEAT_TRACKS.exec(text)\n if (repeat) return Number(repeat[1]) > 0 ? Number(repeat[1]) : undefined\n const tracks = text.split(/\\s+(?![^(]*\\))/).filter(Boolean)\n return tracks.length && tracks.every((track) => FR_TRACK.test(track))\n ? tracks.length\n : undefined\n}\n\n/** How many tracks a grid child spans, from its own `gridColumn`. */\nfunction spannedTracks(value: unknown, tracks: number): number {\n const text = String(value ?? '').trim()\n const span = /^span\\s+(\\d+)$/.exec(text)\n if (span) return Math.min(Number(span[1]), tracks)\n if (/^1\\s*\\/\\s*-1$/.test(text)) return tracks\n return 1\n}\n\n/**\n * The slot the layout around an image gives it, per band, from what the\n * layout STATES rather than what anyone measured — computed from the node\n * tree a page renders, so a published page has it on the server with nothing\n * re-saved. Walking up from the image:\n *\n * - every **Grid cell** it sits in takes its responsive span of its row's\n * columns (`xs:12 md:4` is a third from `md` up), less its share of the\n * row's spacing;\n * - every **CSS grid** of equal tracks (`repeat(3, 1fr)`, per breakpoint)\n * gives each child one track, or the tracks its `gridColumn` spans, less\n * its share of the gap;\n * - every **width or max width** given as a share of the parent shrinks the\n * slot by it, and one given in pixels caps it;\n * - every **Container** takes its gutters off and caps it at its max width.\n *\n * Each step maps the parent's width to the child's as `share × parent −\n * offset`, so they compose: a third of a half is a sixth, and a gap inside a\n * capped Container is still a gap. The answer per band is `min(vw% − offset,\n * cap)`. A band is answered only when something stated it and nothing between\n * the image and the page made it unknowable — an `auto` or `grow` Grid cell is\n * sized by its content, so a band where any cell is one has no answer here.\n * Theme spacing is taken at MUI's 8px, and anything this does not model\n * (padding on an ordinary Box, a flex row) is left in, so a guess errs wide:\n * a slightly larger candidate, never a blurry one.\n *\n * The same function serves the Besigner canvas and the published render; the\n * tree differs only in that the canvas has not grafted reusable components or\n * expanded repeats, which the measurement covers there.\n */\nexport function layoutBandWidths(\n node: LayoutNode | undefined,\n): LayoutWidths {\n /** Per band, the image's width as `share × W − offset` of the ancestor W. */\n const share: BandValues<number | null> = {}\n const offset: BandValues<number> = {}\n const cap: BandValues<number> = {}\n let stated = false\n const known = (band: Band) => share[band] !== null\n /** The child takes `factor × parent − minus`. */\n const step = (band: Band, factor: number | null, minus = 0) => {\n if (!known(band)) return\n if (factor === null) {\n share[band] = null\n return\n }\n const k = share[band] ?? 1\n offset[band] = (offset[band] ?? 0) + k * minus\n share[band] = k * factor\n }\n /** The child is never wider than `pixels`. */\n const capAt = (band: Band, pixels: number) => {\n if (!known(band)) return\n const scaled = (share[band] ?? 1) * pixels - (offset[band] ?? 0)\n cap[band] = Math.min(cap[band] ?? Infinity, scaled)\n }\n /** Width and max width as a share or a cap, from a node's own styles. */\n const applySizing = (target: LayoutNode, includeWidth: boolean) => {\n const sx = plainSx(target.sx)\n for (const key of includeWidth ? ['width', 'maxWidth'] : ['maxWidth']) {\n const values = bandValues(sx[key])\n for (const band of BANDS) {\n const value = length(values[band])\n if (value?.kind === 'fraction') {\n step(band, Math.min(value.value, 1))\n stated = true\n } else if (value?.kind === 'px') {\n capAt(band, value.value)\n stated = true\n }\n }\n }\n }\n // The image's own max width caps it; its own width is read as its own\n // stated length, not as layout.\n if (node) applySizing(node, false)\n let child = node\n for (let current = node?.parent; current; current = current.parent) {\n const props = propsOf(current)\n if (current.componentId === GRID_COMPONENT_ID) {\n const spans = gridSpanPerBand(props['size'])\n if (Object.keys(spans).length) {\n const row = current.parent\n const rowProps = row?.componentId === GRID_COMPONENT_ID ? propsOf(row) : {}\n const columns = Number(rowProps['columns'])\n const total = columns > 0 ? columns : 12\n const spacing = bandValues(\n rowProps['columnSpacing'] ?? rowProps['spacing'],\n )\n stated = true\n for (const band of BANDS) {\n const span = spans[band]\n if (span === undefined || span === null) {\n step(band, null)\n continue\n }\n const portion = Math.min(span / total, 1)\n step(band, portion, gapPixels(spacing[band]) * (1 - portion))\n }\n }\n }\n const sx = plainSx(current.sx)\n const templates = bandValues(sx['gridTemplateColumns'])\n const gaps = bandValues(sx['columnGap'] ?? sx['gap'])\n for (const band of BANDS) {\n const tracks = equalTracks(templates[band])\n if (tracks === undefined) continue\n const spanned = spannedTracks(\n bandValues(plainSx(child?.sx)['gridColumn'])[band],\n tracks,\n )\n const portion = spanned / tracks\n step(band, portion, gapPixels(gaps[band]) * (1 - portion))\n stated = true\n }\n applySizing(current, true)\n if (current.componentId === CONTAINER_COMPONENT_ID) {\n const maxWidth = props['maxWidth']\n const key =\n maxWidth === undefined || maxWidth === null || maxWidth === ''\n ? 'lg'\n : maxWidth\n const pixels =\n typeof key === 'string' ? CONTAINER_MAX_WIDTHS[key] : undefined\n for (const band of BANDS) {\n const gutters = props['disableGutters']\n ? 0\n : 2 * CONTAINER_GUTTER_PX[band]\n // The gutters come off whatever the page is; the cap is the max width\n // less the same gutters, since MUI pads inside the max width.\n if (pixels) capAt(band, pixels - gutters)\n step(band, 1, gutters)\n }\n stated = true\n }\n child = current\n }\n if (!stated) return {}\n const widths: LayoutWidths = {}\n for (const band of BANDS) {\n const fraction = share[band] === undefined ? 1 : share[band]\n if (typeof fraction !== 'number' || !(fraction > 0)) continue\n const minus = Math.round(offset[band] ?? 0)\n const capPx = cap[band]\n widths[band] = {\n vw: Math.round(fraction * 1000) / 10,\n ...(minus >= 1 ? { offsetPx: minus } : {}),\n ...(capPx !== undefined && Number.isFinite(capPx)\n ? { capPx: Math.round(capPx) }\n : {}),\n }\n }\n return widths\n}\n"],"names":["Aglyn","parseBreakpointSpan","SMALL_IMAGE_MAX_PX","SMALL_IMAGE_MAX_PERCENT","BANDS","RENDERED_WIDTH_BANDS","bandValues","value","undefined","stated","Array","isArray","forEach","entry","index","length","band","Object","fromEntries","map","out","current","Number","isFinite","kind","text","trim","match","exec","amount","plainSx","sx","assign","filter","usable","ownLengths","input","widths","width","heights","height","sxWidths","sxHeights","ratio","intrinsicWidth","intrinsicHeight","Math","round","slotLength","slot","offset","offsetPx","capPx","vw","RENDERED_WIDTH_BAND_MIN","combineBandLengths","measured","layout","known","lastMeasured","layoutWhenMeasured","isSmall","css","endsWith","startsWith","parseFloat","imageSizes","authored","sizes","small","layoutWidths","parseRenderedWidths","renderedWidths","values","sizesFromBandLengths","every","GRID_COMPONENT_ID","CONTAINER_COMPONENT_ID","CONTAINER_MAX_WIDTHS","xs","sm","md","lg","xl","CONTAINER_GUTTER_PX","SPACING_PX","gapPixels","String","test","propsOf","node","resolvedProps","props","gridSpanPerBand","size","span","raw","read","base","entries","FR_TRACK","REPEAT_TRACKS","equalTracks","repeat","tracks","split","Boolean","track","spannedTracks","min","layoutBandWidths","share","cap","step","factor","minus","k","capAt","pixels","scaled","Infinity","applySizing","target","includeWidth","key","child","parent","componentId","spans","keys","rowProps","row","columns","total","spacing","portion","templates","gaps","spanned","maxWidth","gutters","fraction"],"mappings":";AAAA;;;;;;;;;;;;;;;CAeC,GAED,YAAYA,WAAW,eAAc;AACrC,SAASC,mBAAmB,QAAQ,2BAA0B;AA0E9D,8DAA8D,GAC9D,OAAO,MAAMC,qBAAqB,IAAG;AAErC,8EAA8E,GAC9E,OAAO,MAAMC,0BAA0B,GAAE;AAKzC,MAAMC,QAAQJ,MAAMK,oBAAoB;AAexC;;;;;;CAMC,GACD,SAASC,WAAWC,KAAc;IAChC,IAAIA,UAAUC,aAAaD,UAAU,QAAQA,UAAU,IAAI,OAAO,CAAC;IACnE,IAAIE;IACJ,IAAIC,MAAMC,OAAO,CAACJ,QAAQ;QACxBE,SAAS,CAAC;QACVF,MAAMK,OAAO,CAAC,CAACC,OAAOC;YACpB,IAAIA,QAAQV,MAAMW,MAAM,IAAIF,UAAU,QAAQA,UAAUL,WAAW;gBACjEC,MAAM,CAACL,KAAK,CAACU,MAAM,CAAC,GAAGD;YACzB;QACF;IACF,OAAO,IAAI,OAAON,UAAU,UAAU;QACpCE,SAAS,CAAC;QACV,KAAK,MAAMO,QAAQZ,MAAO;YACxB,MAAMS,QAAQ,AAACN,KAAiC,CAACS,KAAK;YACtD,IAAIH,UAAUL,aAAaK,UAAU,MAAMJ,MAAM,CAACO,KAAK,GAAGH;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,eAAAA,MAAM,CAAClC,KAAK,YAAZkC,eAAgB;QACzC,MAAME,QAAQ4D,GAAG,CAAChG,KAAK;QACvBqB,MAAM,CAACrB,KAAK,GAAG;YACbqC,IAAIP,KAAKC,KAAK,CAAC8F,WAAW,QAAQ;WAC9B1B,SAAS,IAAI;YAAEhE,UAAUgE;QAAM,IAAI,CAAC,GACpC/D,UAAU5C,aAAac,OAAOC,QAAQ,CAAC6B,SACvC;YAAEA,OAAON,KAAKC,KAAK,CAACK;QAAO,IAC3B,CAAC;IAET;IACA,OAAOf;AACT"}
|
|
1
|
+
{"version":3,"sources":["../../../../../../../libs/plugins/mui/src/lib/utils/image-sizes.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2026 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport * as Aglyn from '@aglyn/aglyn'\nimport { parseBreakpointSpan } from '@aglyn/shared-data-enums'\n\n/**\n * The Image element's `sizes` attribute (AGL-3485): how wide the browser\n * should assume the picture will be, which decides the `srcset` candidate it\n * downloads.\n *\n * Every image used to say `100vw`, so a 68px navbar logo and a 302px card\n * picture both fetched a 1280px or 1920px variant. The answer is now decided\n * in this order, first answer wins:\n *\n * 1. **The author's own Sizes attribute**, verbatim. An escape hatch for\n * someone who knows the attribute; nobody needs to touch it.\n * 2. **Per breakpoint band, a pixel width the element itself states**: a\n * pixel `width` (`'320px'`, or a plain number in `sx`, which MUI reads as\n * pixels), or a pixel `height` under `width: auto` at the asset's known\n * shape. Responsive values are read per band, so the header logo's\n * `height: { xs: 44, md: 56 }` is a 54px slot on a phone and a 68px one\n * from `md` up.\n * 3. **Per band, the width the Besigner MEASURED** when the page was saved.\n * 4. **Per band, the slot the layout around the image states**\n * ({@link layoutBandWidths}): Grid spans, `repeat(n, 1fr)` grids, widths\n * and max widths, and the Container that caps the page.\n * 5. For a band nothing describes, the next narrower band's answer, and\n * `100vw` only for the narrowest band when nothing at all is known.\n *\n * Steps 2 and 4 are computed from the node tree the page renders, so they hold\n * for every page already published — on the server, with no re-save. The\n * measurement only refines what the layout cannot state.\n *\n * ## Why this does not bring back the AGL-2486 layout break\n *\n * `sizes` is not only a delivery hint: with `w` descriptors it is the image's\n * intrinsic width, which is what `width: 100%` resolves against inside a\n * shrink-to-fit parent. `sizes=\"auto\"` broke fluid images because it is\n * circular there (300px default object size). Every answer above is a real\n * width of the slot the image fills: a definite length, a share of a parent of\n * definite width, or a measurement of the very layout being described —\n * which is a fixed point, since an image whose intrinsic width is its\n * measured width lays out at its measured width.\n */\nexport interface ImageSizesInput {\n /** The author's Sizes attribute. */\n sizes?: unknown\n /** The element's `width` attribute, as the author set it. */\n width?: unknown\n /** The element's `height` attribute, as the author set it. */\n height?: unknown\n /**\n * The node's own styles. Their `width` and `height` win over the\n * attributes, as they do in the render (`sx` is composed after the\n * defaults the attributes set).\n */\n sx?: unknown\n intrinsicWidth?: unknown\n intrinsicHeight?: unknown\n /** What the Besigner measured, as the save stored it. */\n renderedWidths?: unknown\n /** What the layout around the image states, per band. */\n layoutWidths?: LayoutWidths\n}\n\nexport interface ImageSizes {\n sizes: string\n /**\n * The evidence says the image renders small everywhere it is known: a\n * pixel width of {@link SMALL_IMAGE_MAX_PX} or less, or under\n * {@link SMALL_IMAGE_MAX_PERCENT} of the page, in every band that was\n * stated, measured or derived. A lead image that is small is a logo or an\n * icon, not the page's largest paint, and gets no `fetchpriority=\"high\"`.\n */\n small: boolean\n}\n\n/** At or under this many pixels wide an image is not a hero. */\nexport const SMALL_IMAGE_MAX_PX = 240\n\n/** Under this share of the page in every known band, an image is not a hero. */\nexport const SMALL_IMAGE_MAX_PERCENT = 40\n\ntype Band = Aglyn.RenderedWidthBand\ntype BandValues<T> = Partial<Record<Band, T>>\n\nconst BANDS = Aglyn.RENDERED_WIDTH_BANDS\n\n/**\n * One slot the layout states for a band: a share of the viewport less the\n * gutters and gaps taken out of it, and the pixel width it can never exceed\n * when something above it caps the page — `min(vw% - offset, cap)`.\n */\nexport interface LayoutSlot {\n vw: number\n offsetPx?: number\n capPx?: number\n}\n\nexport type LayoutWidths = BandValues<LayoutSlot>\n\n/**\n * A responsive value's reading at every band, cascading upwards the way MUI\n * applies one: a band with no value of its own takes the nearest narrower\n * band's. A scalar applies everywhere, an array is MUI's breakpoint array,\n * and keys that are not bands — a dark-scheme slice, a raw media query — are\n * not read.\n */\nfunction bandValues(value: unknown): BandValues<unknown> {\n if (value === undefined || value === null || value === '') return {}\n let stated: BandValues<unknown>\n if (Array.isArray(value)) {\n stated = {}\n value.forEach((entry, index) => {\n if (index < BANDS.length && entry !== null && entry !== undefined) {\n stated[BANDS[index]] = entry\n }\n })\n } else if (typeof value === 'object') {\n stated = {}\n for (const band of BANDS) {\n const entry = (value as Record<string, unknown>)[band]\n if (entry !== undefined && entry !== null) stated[band] = entry\n }\n } else {\n return Object.fromEntries(BANDS.map((band) => [band, value]))\n }\n const out: BandValues<unknown> = {}\n let current: unknown\n for (const band of BANDS) {\n if (stated[band] !== undefined) current = stated[band]\n if (current !== undefined) out[band] = current\n }\n return out\n}\n\n/**\n * A CSS sizing value as MUI's `sx` reads it: a number in (0, 1] is a share of\n * the parent, any other number is pixels, and a string may be either unit.\n */\ntype Length =\n | { kind: 'px'; value: number }\n | { kind: 'fraction'; value: number }\n | { kind: 'vw'; value: number }\n | { kind: 'auto' }\n\nfunction length(value: unknown): Length | undefined {\n if (typeof value === 'number' && Number.isFinite(value)) {\n if (value > 0 && value <= 1) return { kind: 'fraction', value }\n return value > 1 ? { kind: 'px', value } : undefined\n }\n if (typeof value !== 'string') return undefined\n const text = value.trim()\n if (text === 'auto') return { kind: 'auto' }\n const match = /^(\\d+(?:\\.\\d+)?)(px|%|vw)$/.exec(text)\n if (!match) return undefined\n const amount = Number(match[1])\n if (!(amount > 0)) return undefined\n if (match[2] === 'px') return { kind: 'px', value: amount }\n if (match[2] === 'vw') return { kind: 'vw', value: amount }\n return { kind: 'fraction', value: amount / 100 }\n}\n\n/** A node's `sx` as one plain object: an array of objects merged in order. */\nfunction plainSx(sx: unknown): Record<string, unknown> {\n if (Array.isArray(sx)) {\n return Object.assign(\n {},\n ...sx.filter(\n (entry) => entry && typeof entry === 'object' && !Array.isArray(entry),\n ),\n )\n }\n return sx && typeof sx === 'object' ? (sx as Record<string, unknown>) : {}\n}\n\nconst usable = (value: unknown): value is number =>\n typeof value === 'number' && Number.isFinite(value) && value > 0\n\n/**\n * The length the element itself states per band, as a `sizes` length: a\n * pixel or viewport width, or a pixel height under `width: auto` at the\n * asset's shape. Per band, so a responsive value is read the way MUI applies\n * it; a band where the element states nothing usable is left to the layout.\n */\nfunction ownLengths(input: ImageSizesInput): BandValues<string> {\n const sx = plainSx(input.sx)\n const widths = bandValues(input.width)\n const heights = bandValues(input.height)\n const sxWidths = bandValues(sx['width'])\n const sxHeights = bandValues(sx['height'])\n const ratio =\n usable(input.intrinsicWidth) && usable(input.intrinsicHeight)\n ? input.intrinsicWidth / input.intrinsicHeight\n : undefined\n const out: BandValues<string> = {}\n for (const band of BANDS) {\n const width = length(sxWidths[band] ?? widths[band])\n if (width?.kind === 'px') {\n out[band] = `${Math.round(width.value)}px`\n continue\n }\n if (width?.kind === 'vw') {\n out[band] = `${Math.round(width.value * 10) / 10}vw`\n continue\n }\n const height = length(sxHeights[band] ?? heights[band])\n if (width?.kind === 'auto' && height?.kind === 'px' && ratio) {\n out[band] = `${Math.round(height.value * ratio)}px`\n }\n }\n return out\n}\n\n/** A layout slot as a `sizes` length for a band. */\nfunction slotLength(band: Band, slot: LayoutSlot): string {\n // A cap that binds across the whole band — the page is at least the band's\n // minimum wide, so the slot is the cap from its first pixel — is the\n // definite length. Below that, the share of the viewport is the answer, and\n // it can only overstate the slot by the gutters.\n const offset = slot.offsetPx ?? 0\n // A pixel of slack absorbs the rounding of the share and the cap.\n if (\n slot.capPx !== undefined &&\n slot.capPx <=\n (slot.vw / 100) * Aglyn.RENDERED_WIDTH_BAND_MIN[band] - offset + 1\n ) {\n return `${slot.capPx}px`\n }\n return offset >= 1 ? `calc(${slot.vw}vw - ${offset}px)` : `${slot.vw}vw`\n}\n\n/**\n * What was measured, with the layout's statement filling the bands the\n * Besigner never saw.\n *\n * A measured band wins. Above it, the layout's value is used only where it\n * says something NEW — a value that differs from the one the layout gave the\n * measured band. A value it merely carried up from the measured band's span\n * is the same slot measured more precisely, so the measurement carries\n * instead: a cell measured at 28% on a large screen is not 33% on a wider\n * one just because its span did not change.\n */\nfunction combineBandLengths(\n measured: Aglyn.RenderedWidths,\n layout: BandValues<string>,\n): BandValues<string> {\n const known: BandValues<string> = {}\n let lastMeasured: string | undefined\n let layoutWhenMeasured: string | undefined\n for (const band of BANDS) {\n const value = measured[band]\n if (value !== undefined) {\n known[band] = `${value}vw`\n lastMeasured = known[band]\n layoutWhenMeasured = layout[band]\n continue\n }\n const stated = layout[band]\n if (stated !== undefined && stated !== layoutWhenMeasured) {\n known[band] = stated\n } else if (lastMeasured !== undefined) {\n known[band] = lastMeasured\n }\n }\n return known\n}\n\n/** Whether a known length is a small slot. */\nfunction isSmall(css: string): boolean {\n if (css.endsWith('px') && !css.startsWith('calc(')) {\n return Number.parseFloat(css) <= SMALL_IMAGE_MAX_PX\n }\n const vw = /(\\d+(?:\\.\\d+)?)vw/.exec(css)\n return vw ? Number(vw[1]) < SMALL_IMAGE_MAX_PERCENT : false\n}\n\n/** The `sizes` an Image element should carry. See the module note. */\nexport function imageSizes(input: ImageSizesInput): ImageSizes {\n const authored = typeof input.sizes === 'string' ? input.sizes.trim() : ''\n if (authored) return { sizes: authored, small: false }\n const layout: BandValues<string> = {}\n for (const band of BANDS) {\n const slot = input.layoutWidths?.[band]\n if (slot) layout[band] = slotLength(band, slot)\n }\n const known = {\n ...combineBandLengths(\n Aglyn.parseRenderedWidths(input.renderedWidths),\n layout,\n ),\n ...ownLengths(input),\n }\n const values = Object.values(known) as string[]\n return {\n sizes: Aglyn.sizesFromBandLengths(known),\n small: values.length > 0 && values.every(isSmall),\n }\n}\n\n/** No published page nests deeper; a walk past this is following a cycle. */\nconst MAX_LAYOUT_DEPTH = 256\n\n/** The Grid element's persisted component id (`grid.tsx`). */\nconst GRID_COMPONENT_ID = 'muiGrid'\n\n/** The Container element's persisted component id (`container.ts`). */\nconst CONTAINER_COMPONENT_ID = 'muiContainer'\n\n/**\n * A Container's `maxWidth` keys in pixels: MUI's, `xs` floored at 444px. An\n * absent or cleared value is MUI's own `lg` (the element drops a cleared one\n * so MUI's default applies, AGL-1435); `false` caps nothing.\n */\nconst CONTAINER_MAX_WIDTHS: Readonly<Record<string, number>> = {\n xs: 444,\n sm: 600,\n md: 900,\n lg: 1200,\n xl: 1536,\n}\n\n/**\n * A Container's side gutters: MUI's `theme.spacing(2)` a side on a phone and\n * `theme.spacing(3)` from `sm` up.\n */\nconst CONTAINER_GUTTER_PX: Readonly<Record<Band, number>> = {\n xs: 16,\n sm: 24,\n md: 24,\n lg: 24,\n xl: 24,\n}\n\n/** One theme spacing unit; MUI's default, which `sx` gaps are counted in. */\nconst SPACING_PX = 8\n\n/** A gap in pixels: a number is theme spacing units, a string must be px. */\nfunction gapPixels(value: unknown): number {\n if (typeof value === 'number' && Number.isFinite(value) && value > 0) {\n return value * SPACING_PX\n }\n const text = String(value ?? '').trim()\n if (/^\\d+(?:\\.\\d+)?$/.test(text)) return Number(text) * SPACING_PX\n const match = /^(\\d+(?:\\.\\d+)?)px$/.exec(text)\n return match ? Number(match[1]) : 0\n}\n\n/** A node as the canvas holds it, as far as this walk reads it. */\nexport interface LayoutNode {\n componentId?: string\n props?: Record<string, unknown>\n resolvedProps?: Record<string, unknown>\n sx?: unknown\n parent?: LayoutNode | undefined\n}\n\nconst propsOf = (node: LayoutNode | undefined) =>\n node?.resolvedProps ?? node?.props ?? {}\n\n/** A Grid cell's span at each band: a column count, or `null` for auto/grow. */\nfunction gridSpanPerBand(size: unknown): BandValues<number | null> {\n if (size === undefined || size === null || size === '') return {}\n const span = parseBreakpointSpan(size as string | number)\n if (span.raw !== undefined) return {}\n const read = (value: unknown) => (typeof value === 'number' ? value : null)\n if (span.base !== undefined) {\n const value = read(span.base)\n return Object.fromEntries(BANDS.map((band) => [band, value]))\n }\n const values: Record<string, unknown> = {}\n for (const [band, value] of Object.entries(span.values ?? {})) {\n values[band] = read(value)\n }\n return bandValues(values) as BandValues<number | null>\n}\n\nconst FR_TRACK = /^(?:1fr|minmax\\(\\s*0(?:px)?\\s*,\\s*1fr\\s*\\))$/\nconst REPEAT_TRACKS =\n /^repeat\\(\\s*(\\d+)\\s*,\\s*(1fr|minmax\\(\\s*0(?:px)?\\s*,\\s*1fr\\s*\\))\\s*\\)$/\n\n/**\n * The equal tracks a `gridTemplateColumns` value lays out: `repeat(3, 1fr)`,\n * or the same written out, `1fr 1fr 1fr` — and a single `1fr`, which is one\n * column the full width. Anything else (fixed tracks, `auto-fill`) is not an\n * equal split this can state.\n */\nfunction equalTracks(value: unknown): number | undefined {\n const text = String(value ?? '').trim()\n const repeat = REPEAT_TRACKS.exec(text)\n if (repeat) return Number(repeat[1]) > 0 ? Number(repeat[1]) : undefined\n const tracks = text.split(/\\s+(?![^(]*\\))/).filter(Boolean)\n return tracks.length && tracks.every((track) => FR_TRACK.test(track))\n ? tracks.length\n : undefined\n}\n\n/** How many tracks a grid child spans, from its own `gridColumn`. */\nfunction spannedTracks(value: unknown, tracks: number): number {\n const text = String(value ?? '').trim()\n const span = /^span\\s+(\\d+)$/.exec(text)\n if (span) return Math.min(Number(span[1]), tracks)\n if (/^1\\s*\\/\\s*-1$/.test(text)) return tracks\n return 1\n}\n\n/**\n * The slot the layout around an image gives it, per band, from what the\n * layout STATES rather than what anyone measured — computed from the node\n * tree a page renders, so a published page has it on the server with nothing\n * re-saved. Walking up from the image:\n *\n * - every **Grid cell** it sits in takes its responsive span of its row's\n * columns (`xs:12 md:4` is a third from `md` up), less its share of the\n * row's spacing;\n * - every **CSS grid** of equal tracks (`repeat(3, 1fr)`, per breakpoint)\n * gives each child one track, or the tracks its `gridColumn` spans, less\n * its share of the gap;\n * - every **width or max width** given as a share of the parent shrinks the\n * slot by it, and one given in pixels caps it;\n * - every **Container** takes its gutters off and caps it at its max width.\n *\n * Each step maps the parent's width to the child's as `share × parent −\n * offset`, so they compose: a third of a half is a sixth, and a gap inside a\n * capped Container is still a gap. The answer per band is `min(vw% − offset,\n * cap)`. A band is answered only when something stated it and nothing between\n * the image and the page made it unknowable — an `auto` or `grow` Grid cell is\n * sized by its content, so a band where any cell is one has no answer here.\n * Theme spacing is taken at MUI's 8px, and anything this does not model\n * (padding on an ordinary Box, a flex row) is left in, so a guess errs wide:\n * a slightly larger candidate, never a blurry one.\n *\n * The same function serves the Besigner canvas and the published render; the\n * tree differs only in that the canvas has not grafted reusable components or\n * expanded repeats, which the measurement covers there.\n */\nexport function layoutBandWidths(\n node: LayoutNode | undefined,\n): LayoutWidths {\n /** Per band, the image's width as `share × W − offset` of the ancestor W. */\n const share: BandValues<number | null> = {}\n const offset: BandValues<number> = {}\n const cap: BandValues<number> = {}\n let stated = false\n const known = (band: Band) => share[band] !== null\n /** The child takes `factor × parent − minus`. */\n const step = (band: Band, factor: number | null, minus = 0) => {\n if (!known(band)) return\n if (factor === null) {\n share[band] = null\n return\n }\n const k = share[band] ?? 1\n offset[band] = (offset[band] ?? 0) + k * minus\n share[band] = k * factor\n }\n /** The child is never wider than `pixels`. */\n const capAt = (band: Band, pixels: number) => {\n if (!known(band)) return\n const scaled = (share[band] ?? 1) * pixels - (offset[band] ?? 0)\n cap[band] = Math.min(cap[band] ?? Infinity, scaled)\n }\n /** Width and max width as a share or a cap, from a node's own styles. */\n const applySizing = (target: LayoutNode, includeWidth: boolean) => {\n const sx = plainSx(target.sx)\n for (const key of includeWidth ? ['width', 'maxWidth'] : ['maxWidth']) {\n const values = bandValues(sx[key])\n for (const band of BANDS) {\n const value = length(values[band])\n if (value?.kind === 'fraction') {\n step(band, Math.min(value.value, 1))\n stated = true\n } else if (value?.kind === 'px') {\n capAt(band, value.value)\n stated = true\n }\n }\n }\n }\n // The image's own max width caps it; its own width is read as its own\n // stated length, not as layout.\n if (node) applySizing(node, false)\n let child = node\n // Stored pages name the root as its own parent (`parentId: \"_@_\"`), so a\n // walk that only stops at a missing parent never ends (AGL-3565). Stop at\n // any node already visited, and never climb further than a page can nest.\n const visited = new Set<LayoutNode>(node ? [node] : [])\n let depth = 0\n for (\n let current = node?.parent;\n current && !visited.has(current) && depth < MAX_LAYOUT_DEPTH;\n current = current.parent, depth += 1\n ) {\n visited.add(current)\n const props = propsOf(current)\n if (current.componentId === GRID_COMPONENT_ID) {\n const spans = gridSpanPerBand(props['size'])\n if (Object.keys(spans).length) {\n const row = current.parent\n const rowProps = row?.componentId === GRID_COMPONENT_ID ? propsOf(row) : {}\n const columns = Number(rowProps['columns'])\n const total = columns > 0 ? columns : 12\n const spacing = bandValues(\n rowProps['columnSpacing'] ?? rowProps['spacing'],\n )\n stated = true\n for (const band of BANDS) {\n const span = spans[band]\n if (span === undefined || span === null) {\n step(band, null)\n continue\n }\n const portion = Math.min(span / total, 1)\n step(band, portion, gapPixels(spacing[band]) * (1 - portion))\n }\n }\n }\n const sx = plainSx(current.sx)\n const templates = bandValues(sx['gridTemplateColumns'])\n const gaps = bandValues(sx['columnGap'] ?? sx['gap'])\n for (const band of BANDS) {\n const tracks = equalTracks(templates[band])\n if (tracks === undefined) continue\n const spanned = spannedTracks(\n bandValues(plainSx(child?.sx)['gridColumn'])[band],\n tracks,\n )\n const portion = spanned / tracks\n step(band, portion, gapPixels(gaps[band]) * (1 - portion))\n stated = true\n }\n applySizing(current, true)\n if (current.componentId === CONTAINER_COMPONENT_ID) {\n const maxWidth = props['maxWidth']\n const key =\n maxWidth === undefined || maxWidth === null || maxWidth === ''\n ? 'lg'\n : maxWidth\n const pixels =\n typeof key === 'string' ? CONTAINER_MAX_WIDTHS[key] : undefined\n for (const band of BANDS) {\n const gutters = props['disableGutters']\n ? 0\n : 2 * CONTAINER_GUTTER_PX[band]\n // The gutters come off whatever the page is; the cap is the max width\n // less the same gutters, since MUI pads inside the max width.\n if (pixels) capAt(band, pixels - gutters)\n step(band, 1, gutters)\n }\n stated = true\n }\n child = current\n }\n if (!stated) return {}\n const widths: LayoutWidths = {}\n for (const band of BANDS) {\n const fraction = share[band] === undefined ? 1 : share[band]\n if (typeof fraction !== 'number' || !(fraction > 0)) continue\n const minus = Math.round(offset[band] ?? 0)\n const capPx = cap[band]\n widths[band] = {\n vw: Math.round(fraction * 1000) / 10,\n ...(minus >= 1 ? { offsetPx: minus } : {}),\n ...(capPx !== undefined && Number.isFinite(capPx)\n ? { capPx: Math.round(capPx) }\n : {}),\n }\n }\n return widths\n}\n"],"names":["Aglyn","parseBreakpointSpan","SMALL_IMAGE_MAX_PX","SMALL_IMAGE_MAX_PERCENT","BANDS","RENDERED_WIDTH_BANDS","bandValues","value","undefined","stated","Array","isArray","forEach","entry","index","length","band","Object","fromEntries","map","out","current","Number","isFinite","kind","text","trim","match","exec","amount","plainSx","sx","assign","filter","usable","ownLengths","input","widths","width","heights","height","sxWidths","sxHeights","ratio","intrinsicWidth","intrinsicHeight","Math","round","slotLength","slot","offset","offsetPx","capPx","vw","RENDERED_WIDTH_BAND_MIN","combineBandLengths","measured","layout","known","lastMeasured","layoutWhenMeasured","isSmall","css","endsWith","startsWith","parseFloat","imageSizes","authored","sizes","small","layoutWidths","parseRenderedWidths","renderedWidths","values","sizesFromBandLengths","every","MAX_LAYOUT_DEPTH","GRID_COMPONENT_ID","CONTAINER_COMPONENT_ID","CONTAINER_MAX_WIDTHS","xs","sm","md","lg","xl","CONTAINER_GUTTER_PX","SPACING_PX","gapPixels","String","test","propsOf","node","resolvedProps","props","gridSpanPerBand","size","span","raw","read","base","entries","FR_TRACK","REPEAT_TRACKS","equalTracks","repeat","tracks","split","Boolean","track","spannedTracks","min","layoutBandWidths","share","cap","step","factor","minus","k","capAt","pixels","scaled","Infinity","applySizing","target","includeWidth","key","child","visited","Set","depth","parent","has","add","componentId","spans","keys","rowProps","row","columns","total","spacing","portion","templates","gaps","spanned","maxWidth","gutters","fraction"],"mappings":";AAAA;;;;;;;;;;;;;;;CAeC,GAED,YAAYA,WAAW,eAAc;AACrC,SAASC,mBAAmB,QAAQ,2BAA0B;AA0E9D,8DAA8D,GAC9D,OAAO,MAAMC,qBAAqB,IAAG;AAErC,8EAA8E,GAC9E,OAAO,MAAMC,0BAA0B,GAAE;AAKzC,MAAMC,QAAQJ,MAAMK,oBAAoB;AAexC;;;;;;CAMC,GACD,SAASC,WAAWC,KAAc;IAChC,IAAIA,UAAUC,aAAaD,UAAU,QAAQA,UAAU,IAAI,OAAO,CAAC;IACnE,IAAIE;IACJ,IAAIC,MAAMC,OAAO,CAACJ,QAAQ;QACxBE,SAAS,CAAC;QACVF,MAAMK,OAAO,CAAC,CAACC,OAAOC;YACpB,IAAIA,QAAQV,MAAMW,MAAM,IAAIF,UAAU,QAAQA,UAAUL,WAAW;gBACjEC,MAAM,CAACL,KAAK,CAACU,MAAM,CAAC,GAAGD;YACzB;QACF;IACF,OAAO,IAAI,OAAON,UAAU,UAAU;QACpCE,SAAS,CAAC;QACV,KAAK,MAAMO,QAAQZ,MAAO;YACxB,MAAMS,QAAQ,AAACN,KAAiC,CAACS,KAAK;YACtD,IAAIH,UAAUL,aAAaK,UAAU,MAAMJ,MAAM,CAACO,KAAK,GAAGH;QAC5D;IACF,OAAO;QACL,OAAOI,OAAOC,WAAW,CAACd,MAAMe,GAAG,CAAC,CAACH,OAAS;gBAACA;gBAAMT;aAAM;IAC7D;IACA,MAAMa,MAA2B,CAAC;IAClC,IAAIC;IACJ,KAAK,MAAML,QAAQZ,MAAO;QACxB,IAAIK,MAAM,CAACO,KAAK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