@reqvire-org/ads 0.5.4 → 0.5.5

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.
Files changed (95) hide show
  1. package/dist/ads-errors.mjs +105 -8
  2. package/dist/analysis/client-directive.mjs +26 -0
  3. package/dist/analysis/externals.mjs +47 -0
  4. package/dist/analysis/module-graph.mjs +6 -0
  5. package/dist/analysis/owner-analysis-key.mjs +1 -1
  6. package/dist/analysis/owner-choices.mjs +12 -2
  7. package/dist/analysis/owner-composition.mjs +19 -4
  8. package/dist/analysis/owner-source.mjs +112 -15
  9. package/dist/border-paint.mjs +34 -0
  10. package/dist/check.mjs +2 -0
  11. package/dist/composed-contrast.mjs +10 -7
  12. package/dist/construction-output.mjs +52 -27
  13. package/dist/construction-spec.d.mts +40 -10
  14. package/dist/construction-spec.mjs +41 -17
  15. package/dist/corner-overpaint.mjs +3 -1
  16. package/dist/design-foundation.mjs +14 -0
  17. package/dist/emit/owner-emission-cache.mjs +1 -1
  18. package/dist/end-alignment.mjs +69 -0
  19. package/dist/external-macro.d.mts +20 -0
  20. package/dist/external-macro.mjs +12 -0
  21. package/dist/finding-rules.mjs +3 -0
  22. package/dist/forced-colors.mjs +81 -0
  23. package/dist/frame-regions.mjs +2 -2
  24. package/dist/guard/externals.mjs +64 -0
  25. package/dist/guard/run.mjs +9 -5
  26. package/dist/inventories.mjs +1 -1
  27. package/dist/lowering-layer.mjs +38 -4
  28. package/dist/lowering-overlaps.mjs +7 -0
  29. package/dist/lowering-properties.mjs +1 -0
  30. package/dist/lowering-region-layout.mjs +22 -3
  31. package/dist/lowering-session.mjs +1 -1
  32. package/dist/mcp/preview-http.bundle.js +2 -2
  33. package/dist/mcp/preview-widget.bundle.js +12 -12
  34. package/dist/measured-geometry.mjs +8 -2
  35. package/dist/owner-analysis-check.mjs +190 -11
  36. package/dist/owner-errors.mjs +3 -0
  37. package/dist/owner-lowering.mjs +3 -2
  38. package/dist/ownership-model.mjs +6 -3
  39. package/dist/platform-features.mjs +1 -0
  40. package/dist/preview-bun.mjs +15 -2
  41. package/dist/profile-macro.d.mts +18 -0
  42. package/dist/recipe-macro.d.mts +49 -6
  43. package/dist/recipe-model.mjs +13 -5
  44. package/dist/region-lowering.mjs +115 -22
  45. package/dist/render-audit/axe-run.page.mjs +40 -1
  46. package/dist/render-audit/forced-states.page.mjs +37 -0
  47. package/dist/render-audit/layout-overflow.page.mjs +52 -2
  48. package/dist/render-audit/non-text-contrast.page.mjs +14 -10
  49. package/dist/render-audit/worker.mjs +38 -0
  50. package/dist/render-audit.mjs +42 -5
  51. package/dist/role-vocabulary.d.mts +2 -2
  52. package/dist/role-vocabulary.mjs +3 -3
  53. package/dist/scenario-kit.d.mts +2 -2
  54. package/dist/showcase/assets-view.mjs +12 -47
  55. package/dist/showcase/client.bundle.js +54 -54
  56. package/dist/showcase/http-client.bundle.js +18 -18
  57. package/dist/showcase/token-sample.mjs +2 -2
  58. package/dist/showcase/ui/ui.css +1 -1
  59. package/dist/showcase/ui/ui.js +13 -13
  60. package/dist/skills/ads-designer/references/accessibility.md +21 -1
  61. package/dist/skills/ads-designer/references/branding.md +4 -0
  62. package/dist/skills/ads-designer/references/design-data.md +6 -0
  63. package/dist/skills/ads-designer/references/layers.md +5 -0
  64. package/dist/skills/ads-designer/references/layout.md +8 -1
  65. package/dist/skills/ads-designer/references/recipes.md +36 -0
  66. package/dist/skills/ads-designer/references/runtimes.md +4 -0
  67. package/dist/skills/ads-designer/references/scenarios.md +2 -0
  68. package/dist/skills/ads-import/references/design-data.md +6 -0
  69. package/dist/skills/ads-import/references/layers.md +5 -0
  70. package/dist/skills/ads-import/references/layout.md +8 -1
  71. package/dist/skills/ads-import/references/recipes.md +36 -0
  72. package/dist/skills/ads-import/references/runtimes.md +4 -0
  73. package/dist/skills/ads-import/references/scenarios.md +2 -0
  74. package/dist/skills/ads-migrate/SKILL.md +1 -0
  75. package/dist/skills/ads-migrate/references/0.5.4-to-0.5.5.md +61 -0
  76. package/dist/skills/ads-port/references/design-data.md +6 -0
  77. package/dist/skills/ads-port/references/layers.md +5 -0
  78. package/dist/skills/ads-port/references/layout.md +8 -1
  79. package/dist/skills/ads-port/references/recipes.md +36 -0
  80. package/dist/skills/ads-port/references/runtimes.md +4 -0
  81. package/dist/skills/ads-port/references/scenarios.md +2 -0
  82. package/dist/spatial-model.mjs +37 -10
  83. package/dist/system-colors.d.mts +9 -0
  84. package/dist/system-colors.mjs +1 -0
  85. package/dist/target-size.mjs +14 -1
  86. package/dist/tsconfig.declarations.json +1 -0
  87. package/docs/ADS.md +23 -1
  88. package/docs/ASSETS.md +21 -0
  89. package/docs/CACHING.md +1 -1
  90. package/docs/CHANGELOG.md +167 -21
  91. package/docs/GUIDE.md +31 -20
  92. package/docs/LANGUAGE.md +118 -6
  93. package/docs/PROFILE-KINDS.md +50 -4
  94. package/docs/RULES.md +21 -8
  95. package/package.json +5 -1
@@ -21,7 +21,34 @@ const shiftLimit = 0.1;
21
21
  export const auditTags = Object.freeze(["wcag2a", "wcag2aa", "wcag21a", "wcag21aa", "wcag22aa"]);
22
22
  const viewport = { width: 1280, height: 800 };
23
23
  export const overflowWidths = Object.freeze([390, 768, 1280]), auditedKinds = Object.freeze(["components", "patterns"]), containerWidth = 240, containerKinds = Object.freeze(["components", "patterns"]), auditAttempts = 3;
24
- const limits = { scenarios: 500, nodes: 5, findings: 2000, reportBytes: 8388608, overlays: 3, controls: 6, contentQuietMs: 500, contentLimitMs: 5000 }, fileMap = (scenarios) => new Map(scenarios.map((scenario) => [scenario.id, scenario.file])), addOnce = (list, value) => {
24
+ const limits = { scenarios: 500, nodes: 5, findings: 2000, reportBytes: 8388608, overlays: 3, controls: 6, contentQuietMs: 500, contentLimitMs: 5000 };
25
+ export const AUDIT_ENVIRONMENTS = ["forced-colors", "coarse-pointer"];
26
+ const ENVIRONMENT_LABELS = { "forced-colors": "in forced colours", "coarse-pointer": "with a coarse pointer" };
27
+ export const FORCED_RENDER_RULE = "a11y-forced-colors-render";
28
+ export function environmentFindings(runs, scenarios) {
29
+ const files = fileMap(scenarios), findings = [];
30
+ for (const run of runs)
31
+ for (const pass of run.environments ?? []) {
32
+ const label = ENVIRONMENT_LABELS[pass.environment], known = new Set((run.violations ?? []).map((violation) => JSON.stringify([violation.id, violation.nodes.map((node) => node.selector).sort()]))), added = pass.violations.filter((violation) => !known.has(JSON.stringify([violation.id, violation.nodes.map((node) => node.selector).sort()])));
33
+ for (const finding of auditFindings([{ scenario: run.scenario, theme: run.theme, ...run.brand ? { brand: run.brand } : {}, violations: added }], scenarios))
34
+ findings.push({ ...finding, environment: pass.environment, message: `${finding.message.replace(` in ${run.scenario} `, ` in ${run.scenario} ${label} `)}` });
35
+ for (const issue of pass.forced ?? [])
36
+ findings.push({
37
+ rule: FORCED_RENDER_RULE,
38
+ severity: findingSeverity(FORCED_RENDER_RULE),
39
+ file: files.get(run.scenario) ?? run.scenario,
40
+ line: 1,
41
+ column: 1,
42
+ scenario: run.scenario,
43
+ themes: [run.theme],
44
+ environment: pass.environment,
45
+ guidanceUri: "ads://guides/accessibility",
46
+ message: `In forced colours, ${issue.selector} (${issue.attribute}) in ${run.scenario} looks like ${issue.sibling} without it: the state cannot be seen. Declare \`forcedColors\` on the state's surface, or show the state by a border, a mark or text.`
47
+ });
48
+ }
49
+ return findings.slice(0, limits.findings);
50
+ }
51
+ const fileMap = (scenarios) => new Map(scenarios.map((scenario) => [scenario.id, scenario.file])), addOnce = (list, value) => {
25
52
  if (value !== void 0 && !list.includes(value))
26
53
  list.push(value);
27
54
  }, where = (themes, brands) => `[${themes.join(", ")}${brands.length ? `; ${brands.join(", ")}` : ""}]`;
@@ -233,11 +260,19 @@ const skipReasons = {
233
260
  fix: "Make the element fluid (%, fr, min(100%, ...)), wrap it, or put it in an overflow-x: auto scroller."
234
261
  },
235
262
  clipped: {
236
- what: "text or a control is cut off by overflow hidden or clip (cropped images, artwork and decorative layers do not count)",
263
+ what: "text, a control, or a box's painted edge (a card's border and corners) is cut off by overflow hidden or clip (cropped images, artwork and decorative layers do not count)",
237
264
  fix: "Make the content fit, truncate it with text-overflow: ellipsis, or use overflow-x: auto if it should scroll."
238
265
  },
266
+ "collapsed-scroller": {
267
+ what: "a scroll area that holds content is collapsed to nothing: everything in it is out of sight",
268
+ fix: 'Give the scroll area a size: let it fill a parent that has a height (extent: "fill" in a stack given a height), or a minimum block size; check its parents for a height of 0.'
269
+ },
270
+ "broken-word": {
271
+ what: "a word is broken across lines: its box is narrower than the word (a field squeezed beside its tools)",
272
+ fix: "Give the box a minimum inline size that holds its longest word (min-inline-size in rem or ch), or let what sits beside it wrap to its own row below a width condition."
273
+ },
239
274
  "block-clipped": {
240
- what: "text or a control is cut off by overflow hidden or clip on the block axis",
275
+ what: "text, a control or a box's painted edge is cut off by overflow hidden or clip on the block axis",
241
276
  fix: "Let the box grow with its text: drop the fixed block size or use min-block-size, or scroll it with overflow-y: auto."
242
277
  },
243
278
  spilled: {
@@ -274,7 +309,7 @@ function groupLayout(entries) {
274
309
  }
275
310
  return [...groups.values()].slice(0, limits.findings);
276
311
  }
277
- const layoutElements = ({ nodes, nodeCount }) => [...nodes.values()].slice(0, 3).map((node) => `${node.selector} (${node.overflow}px at ${node.width}px${node.cut ? `, cutting ${node.cut.content === "text" ? "text" : "a control"} at ${node.cut.selector}` : ""})`).join(", ") + (nodeCount > 3 ? ` and ${nodeCount - 3} more` : "");
312
+ const layoutElements = ({ nodes, nodeCount }) => [...nodes.values()].slice(0, 3).map((node) => `${node.selector} (${node.overflow}px at ${node.width}px${node.cut ? `, cutting ${node.cut.content === "text" ? "text" : node.cut.content === "box" ? "a box's edge" : "a control"} at ${node.cut.selector}` : ""})`).join(", ") + (nodeCount > 3 ? ` and ${nodeCount - 3} more` : "");
278
313
  export function layoutOverflowFindings(runs, scenarios) {
279
314
  const files = fileMap(scenarios), entries = runs.flatMap((run) => (run.layout ?? []).map(({ width, container = !1, issues = [], counts = {} }) => ({
280
315
  run,
@@ -612,7 +647,8 @@ async function runAuditWorker({
612
647
  declared,
613
648
  derived,
614
649
  conditionWidths: boundWidths(derived.flatMap((construction) => construction.bounds ?? []), overflowWidths),
615
- evidence
650
+ evidence,
651
+ environments: AUDIT_ENVIRONMENTS
616
652
  }));
617
653
  const timeoutMs = Math.min(1800000, settings.timeoutMs + apps.length * Math.min(settings.timeoutMs, 15000));
618
654
  let cause;
@@ -809,6 +845,7 @@ export async function runRenderAudit(directory, { scenarios: selected, themes: s
809
845
  ...selected === void 0 || selected.length === 0 ? unrenderedConstructionFindings(runs, derived, path.relative(root, options.dsRoot) || ".") : [],
810
846
  ...derivedStateFindings(runs, scenarios, path.relative(root, options.dsRoot) || "."),
811
847
  ...findingsByState(runs, (some) => auditFindings(some, scenarios)),
848
+ ...findingsByState(runs, (some) => environmentFindings(some, scenarios)),
812
849
  ...findingsByState(runs, (some) => nonTextContrastFindings(some, scenarios)),
813
850
  ...findingsByState(runs, (some) => declaredBoundaryFindings(some, scenarios, root)),
814
851
  ...findingsByState(runs, (some) => layoutOverflowFindings(some, scenarios)),
@@ -230,11 +230,11 @@ export declare const TEXT_TRANSFORM = "text-transform";
230
230
  export declare const TEXT_TRANSFORMS: readonly ["uppercase", "lowercase", "capitalize"];
231
231
  /** A frame profile's policy field: the line its border is drawn with. `solid` without it. */
232
232
  export declare const BORDER_STYLE = "border-style";
233
- export declare const BORDER_STYLES: readonly ["solid", "dashed", "dotted"];
233
+ export declare const BORDER_STYLES: readonly ["solid", "dashed", "dotted", "forced-only"];
234
234
  export declare const profilePolicyFields: {
235
235
  readonly text: readonly ["text-transform"];
236
236
  readonly frame: readonly ["border-style"];
237
- readonly visual: readonly ["fit", "preserve-ratio", "anchor"];
237
+ readonly visual: readonly ["fit", "preserve-ratio", "anchor", "size-axis"];
238
238
  readonly motion: readonly ["reduced"];
239
239
  readonly sequence: readonly ["reduced", "repeat"];
240
240
  readonly spatial: readonly ["ratios"];
@@ -230,12 +230,12 @@ export const profileTokenRoles = tokenRolesByKind, spatialClauseTokenRoles = {
230
230
  "fixed-start": ["layout-size"],
231
231
  "fixed-end": ["layout-size"]
232
232
  },
233
- "ads-gutter": { start: ["spacing", "grid-gutter"], end: ["spacing", "grid-gutter"] },
233
+ "ads-gutter": { start: ["spacing", "grid-gutter"], end: ["spacing", "grid-gutter"], gap: ["spacing", "grid-gutter", "content-gap"] },
234
234
  "ads-condition": { below: ["layout-size"] }
235
- }, SURFACE_STATE = "state", INACTIVE_STATE = "inactive", TEXT_TRANSFORM = "text-transform", TEXT_TRANSFORMS = ["uppercase", "lowercase", "capitalize"], BORDER_STYLE = "border-style", BORDER_STYLES = ["solid", "dashed", "dotted"], profilePolicyFields = {
235
+ }, SURFACE_STATE = "state", INACTIVE_STATE = "inactive", TEXT_TRANSFORM = "text-transform", TEXT_TRANSFORMS = ["uppercase", "lowercase", "capitalize"], BORDER_STYLE = "border-style", BORDER_STYLES = ["solid", "dashed", "dotted", "forced-only"], profilePolicyFields = {
236
236
  text: [TEXT_TRANSFORM],
237
237
  frame: [BORDER_STYLE],
238
- visual: ["fit", "preserve-ratio", "anchor"],
238
+ visual: ["fit", "preserve-ratio", "anchor", "size-axis"],
239
239
  motion: ["reduced"],
240
240
  sequence: ["reduced", "repeat"],
241
241
  spatial: ["ratios"],
@@ -39,8 +39,8 @@ export interface Scenario<State extends object = object> {
39
39
  readonly captureTargets?: Readonly<Record<string, string>>;
40
40
  }
41
41
  export interface ContainerProps {
42
- /** The parent's width: the line (default), a 280px pane, a 360px column or a 720px page. */
43
- readonly inline?: "fill" | "pane" | "column" | "page";
42
+ /** The parent's width: the line (default), a 280px pane, a 360px column, a 390px phone or a 720px page. */
43
+ readonly inline?: "fill" | "pane" | "column" | "phone" | "page";
44
44
  /** The parent's height: its content's (default), 160px, 320px or 560px. */
45
45
  readonly block?: "content" | "short" | "medium" | "tall";
46
46
  /** What the parent stands for, in its caption. */
@@ -43,7 +43,7 @@ export function assetNote(asset, px) {
43
43
  opticalCentre(asset) === "Middle" ? "" : `centre ${opticalCentre(asset)}`
44
44
  ].filter(Boolean).join(" \xB7 ");
45
45
  }
46
- const VIEW = "View", SIZE = "Size", GUIDES = "Guides", PLACE = "Place", COMPACT = "compact", ALL_SIZES = "all sizes", NO_GUIDES = "none", GRID = "grid", GRID_CENTRE = "grid + centre", ALONE = "alone", BESIDE_TEXT = "beside text", TILE_INLINE = 150;
46
+ const TILE_INLINE = 150;
47
47
  export function assetSummary(facts) {
48
48
  const counted = (group) => ["foreground", "slots", "intrinsic"].map((paint) => [facts.assets.filter((asset) => asset.group === group && asset.paint === paint).length, paint]).filter(([count]) => count > 0).map(([count, paint]) => `${count} ${paint}`).join(", ");
49
49
  return [
@@ -121,9 +121,9 @@ export function mountAssets(container, facts) {
121
121
  ...(facts?.groups ?? []).map((group) => ({ id: groupChoice(group.group), label: `${groupTitle(group.group)} ${group.count}` })),
122
122
  ...facts?.sets.length ? [{ id: SETS, label: `Glyph sets ${facts.sets.length}` }] : []
123
123
  ], listed = html.dataset.adsChoices === "host";
124
- let choice = listed ? SUMMARY : choices[0]?.id ?? "", hosted = listed, mode = COMPACT, chosenSize = null, guides = NO_GUIDES, place = ALONE;
124
+ let choice = listed ? SUMMARY : choices[0]?.id ?? "", hosted = listed;
125
125
  const render = () => {
126
- const theme = html.dataset.theme, scheme = view?.getComputedStyle(html).colorScheme.includes("dark") ? "dark" : "light", members = choice === SETS || choice === SUMMARY ? [] : assets.filter((asset) => groupChoice(asset.group) === choice), folder = choice.startsWith("group:") ? groupTitle(choice.slice(6) || null) : null, sizes = [...new Map((facts?.sizes ?? []).map((token) => [Math.round(pixels(token) * 100) / 100, token]))].filter(([px]) => px > 0 && px <= 64).sort(([a], [b]) => a - b).map(([px, token]) => ({ token, px })), size = sizes.find((item) => String(item.px) === chosenSize) ?? sizes[Math.floor(sizes.length / 2)], everySize = folder !== null && mode === ALL_SIZES;
126
+ const theme = html.dataset.theme, scheme = view?.getComputedStyle(html).colorScheme.includes("dark") ? "dark" : "light", members = choice === SETS || choice === SUMMARY ? [] : assets.filter((asset) => groupChoice(asset.group) === choice), folder = choice.startsWith("group:") ? groupTitle(choice.slice(6) || null) : null, sizes = [...new Map((facts?.sizes ?? []).map((token) => [Math.round(pixels(token) * 100) / 100, token]))].filter(([px]) => px > 0 && px <= 64).sort(([a], [b]) => a - b).map(([px, token]) => ({ token, px })), everySize = folder !== null;
127
127
  renderCardPage(page, {
128
128
  title: folder !== null && hosted ? `${folder} artwork` : choice === SETS && hosted ? "Glyph sets" : "Artwork",
129
129
  description: folder !== null && hosted ? `${members.length} ${members.length === 1 ? "asset" : "assets"} declared under assets/${folder === "Top level" ? "" : `${folder}/`}, drawn in this frame's theme${theme ? ` (${theme})` : ""}.` : choice === SETS && hosted ? `${facts?.sets.length ?? 0} glyph ${facts?.sets.length === 1 ? "set" : "sets"}: the glyphs an owner may choose from data, by name.` : assets.length ? `${assets.length} assets in ${facts?.groups.length ?? 0} groups${facts?.sets.length ? `, ${facts.sets.length} glyph ${facts.sets.length === 1 ? "set" : "sets"}` : ""}. Every drawing is a declared asset of the design system.` : facts === null || facts === void 0 ? "This revision's preview tree has no artwork facts: emit it again." : "This revision declares no asset.",
@@ -138,27 +138,6 @@ export function mountAssets(container, facts) {
138
138
  }
139
139
  }
140
140
  } : {},
141
- ...folder !== null && members.length > 0 ? {
142
- settings: {
143
- controls: [
144
- { prop: VIEW, options: [COMPACT, ALL_SIZES], chosen: mode, as: "buttons" },
145
- ...everySize || size === void 0 ? [] : [{ prop: SIZE, options: sizes.map((item) => String(item.px)), chosen: String(size.px), as: "buttons" }],
146
- ...everySize ? [] : [{ prop: GUIDES, options: [NO_GUIDES, GRID, GRID_CENTRE], chosen: guides, as: "buttons" }],
147
- ...everySize ? [] : [{ prop: PLACE, options: [ALONE, BESIDE_TEXT], chosen: place, as: "buttons" }]
148
- ],
149
- onControl: (prop, option) => {
150
- if (prop === VIEW)
151
- mode = option;
152
- else if (prop === SIZE)
153
- chosenSize = option;
154
- else if (prop === GUIDES)
155
- guides = option;
156
- else if (prop === PLACE)
157
- place = option;
158
- render();
159
- }
160
- }
161
- } : {},
162
141
  sections: facts === null || facts === void 0 || everySize ? [] : assetSections(facts, choice, pixels)
163
142
  });
164
143
  const element = (asset, drawing, height) => {
@@ -182,7 +161,8 @@ export function mountAssets(container, facts) {
182
161
  aliases: [...asset.aliases],
183
162
  findings: [],
184
163
  grid: drawing === void 0 ? null : { x: drawing.box[0], y: drawing.box[1], width: drawing.box[2], height: drawing.box[3] },
185
- drawing: (height) => element(asset, drawing, height)
164
+ drawing: (height) => element(asset, asset.drawings.find((own) => own.size !== null && sizes.some((item) => item.token === own.size && item.px === height)) ?? drawing, height),
165
+ note: assetNote(asset, pixels)
186
166
  };
187
167
  }),
188
168
  sizes,
@@ -192,8 +172,8 @@ export function mountAssets(container, facts) {
192
172
  findings: []
193
173
  };
194
174
  renderArtworkCatalogue(catalogue, { data });
195
- for (const set of catalogue.querySelectorAll(".catalogue-set"))
196
- set.dataset.adsStageInset = "8";
175
+ for (const staged of catalogue.querySelectorAll(".catalogue-set, .catalogue-mag, .catalogue-sizes"))
176
+ staged.dataset.adsStageInset = "8";
197
177
  } else
198
178
  unmount(catalogue);
199
179
  for (const slot of page.querySelectorAll('[data-slot="stage"][data-key]')) {
@@ -202,37 +182,22 @@ export function mountAssets(container, facts) {
202
182
  unmount(slot);
203
183
  continue;
204
184
  }
205
- const sized = folder === null || size === void 0 ? void 0 : asset.drawings.find((drawing) => drawing.size === size.token), drawing = sized ?? drawingFor(asset, theme, scheme);
185
+ const drawing = drawingFor(asset, theme, scheme);
206
186
  if (drawing === void 0) {
207
187
  unmount(slot);
208
188
  continue;
209
189
  }
210
- const wanted = folder !== null && size !== void 0 ? size.px : drawing.box[3] <= 32 ? drawing.box[3] * 2 : 48, width = wanted * drawing.box[2] / drawing.box[3], scale = width > TILE_INLINE ? TILE_INLINE / width : 1, [inline, block] = [+(width * scale).toFixed(2), +(wanted * scale).toFixed(2)], drawn = element(asset, drawing, block);
190
+ const wanted = drawing.box[3] <= 32 ? drawing.box[3] * 2 : 48, width = wanted * drawing.box[2] / drawing.box[3], scale = width > TILE_INLINE ? TILE_INLINE / width : 1, [inline, block] = [+(width * scale).toFixed(2), +(wanted * scale).toFixed(2)], drawn = element(asset, drawing, block);
211
191
  if (drawn === null) {
212
192
  renderArtworkSample(slot, { failed: !0, problem: "Not drawn: its SVG is not safe to show" });
213
193
  continue;
214
194
  }
215
- const guided = folder !== null && guides !== NO_GUIDES;
216
195
  unmount(slot);
217
196
  slot.replaceChildren();
218
- const text = folder !== null && place === BESIDE_TEXT ? { text: asset.title || asset.name } : {};
219
- renderArtworkSample(slot, guided ? { grid: { x: drawing.box[0], y: drawing.box[1], width: drawing.box[2], height: drawing.box[3] }, ...guides === GRID_CENTRE ? { centre: asset.center ?? [0, 0] } : {}, ...text } : text);
220
- const frame = slot.querySelector('[data-slot="frame"]');
221
- frame?.style.setProperty("inline-size", `${inline}px`);
222
- frame?.style.setProperty("block-size", `${block}px`);
223
- drawn.setAttribute("width", frame === null ? String(inline) : "100%");
224
- drawn.setAttribute("height", frame === null ? String(block) : "100%");
197
+ renderArtworkSample(slot, {});
198
+ drawn.setAttribute("width", String(inline));
199
+ drawn.setAttribute("height", String(block));
225
200
  slot.querySelector('[data-slot="drawing"]')?.replaceChildren(drawn);
226
- if (sized !== void 0)
227
- slot.dataset.adsOwnDrawing = size?.token ?? "";
228
- else
229
- delete slot.dataset.adsOwnDrawing;
230
- const fitted = slot.closest(".ux-sample-card")?.querySelector(".ux-sample-card-note") ?? null;
231
- if (fitted !== null && folder !== null) {
232
- const said = " \xB7 shown at ", text = fitted.firstChild, plain = (text?.nodeValue ?? "").split(said)[0] ?? "";
233
- if (text !== null)
234
- text.nodeValue = scale < 1 ? `${plain}${said}${Math.round(block)}px to fit, not ${wanted}px` : plain;
235
- }
236
201
  }
237
202
  }, choose = (id) => {
238
203
  if (!choices.some((item) => item.id === id))