@dataverse-to-code/test 0.21.0 → 0.22.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @dataverse-to-code/test
2
2
 
3
- Run a [DataverseToCode](https://github.com/SimonAllport/DataverseToCode) project's tests with Playwright. Your forms run offline in Chromium with their real scripts and business rules (no Dataverse connection); `.test.yaml` files and your own `.spec.ts` files run side by side.
3
+ Run a [DataverseToCode](https://marketplace.visualstudio.com/items?itemName=CloudFish.dataverse-to-code) project's tests with Playwright. Your forms run offline in Chromium with their real scripts and business rules (no Dataverse connection); `.test.yaml` files and your own `.spec.ts` files run side by side.
4
4
 
5
5
  Works with Microsoft Dataverse; not a Microsoft product.
6
6
 
@@ -46,3 +46,5 @@ Running tests runs your project's JavaScript on this computer, as any test suite
46
46
  ## Online runs
47
47
 
48
48
  To run the same `.test.yaml` files against the real app in a development environment, use `dvschema test --online --env <name>` (or **Run online** in VS Code). It uses the Playwright you install here.
49
+
50
+ New to testing? The DataverseToCode extension's **Testing Guide** (in VS Code, **Dataverse: Open Testing Guide**) explains it from the start, including a section on Playwright.
package/dist/.built CHANGED
@@ -1 +1 @@
1
- 2026-10-11T07:34:53.718Z
1
+ 2026-10-13T07:46:17.020Z
package/dist/cli.js CHANGED
@@ -11822,6 +11822,20 @@ var import_node_child_process2 = require("node:child_process");
11822
11822
  var import_node_fs9 = require("node:fs");
11823
11823
  var import_node_path9 = require("node:path");
11824
11824
 
11825
+ // ../../extension/src/export/render.ts
11826
+ var EXPORT_NEEDS_PLAYWRIGHT = "Exporting an image or PDF needs Playwright in the project: npm install -D @dataverse-to-code/test, then npx playwright install chromium";
11827
+ async function renderPage(playwright, html, o) {
11828
+ const browser = await playwright.chromium.launch();
11829
+ try {
11830
+ const page = await browser.newPage({ viewport: { width: o.width, height: 800 }, deviceScaleFactor: 2 });
11831
+ await page.setContent(html, { waitUntil: "load" });
11832
+ if (o.format === "png") await page.screenshot({ path: o.out, fullPage: true });
11833
+ else await page.pdf({ path: o.out, printBackground: true, width: `${o.width}px`, preferCSSPageSize: false, margin: { top: "12px", bottom: "12px", left: "12px", right: "12px" } });
11834
+ } finally {
11835
+ await browser.close();
11836
+ }
11837
+ }
11838
+
11825
11839
  // ../../extension/src/sim/formState.ts
11826
11840
  var FormState = class {
11827
11841
  columns = /* @__PURE__ */ new Map();
@@ -13240,6 +13254,7 @@ function buildFormPackage(inputs) {
13240
13254
  const formName = String(doc.head.name ?? "");
13241
13255
  if (!inputs.tables[table]) return { problem: `The form's table ${table} isn't in the project (schema/tables/${table}.table.yaml).` };
13242
13256
  const { columns } = columnsOf(inputs.tables[table], inputs.choices);
13257
+ const tableLabel = str(obj(safeParse(inputs.tables[table])).displayName);
13243
13258
  for (const c of SYSTEM_COLUMNS) if (!columns.some((x3) => x3.name === c.name)) columns.push(c);
13244
13259
  for (const c of inputs.snapshotColumns ?? []) {
13245
13260
  if (!c.type.startsWith("unsupported:") && !columns.some((x3) => x3.name === c.name)) columns.push({ name: c.name, label: c.label, type: c.type, requiredLevel: "none", options: c.options ?? [] });
@@ -13284,6 +13299,7 @@ function buildFormPackage(inputs) {
13284
13299
  return {
13285
13300
  pkg: {
13286
13301
  table,
13302
+ ...tableLabel ? { tableLabel } : {},
13287
13303
  formName,
13288
13304
  formType: String(doc.head.type ?? "main"),
13289
13305
  form: doc,
@@ -14206,12 +14222,106 @@ var import_node_fs4 = require("node:fs");
14206
14222
  var import_node_module = require("node:module");
14207
14223
  var import_node_path4 = require("node:path");
14208
14224
 
14225
+ // ../../extension/src/core/appLook/css.ts
14226
+ var widths = Array.from({ length: 20 }, (_, i) => (i + 1) * 5).map((w2) => `.al-w-${w2} { flex: 0 1 ${w2}%; max-width: ${w2}%; }`).join("\n");
14227
+ var APP_LOOK_CSS = `
14228
+ .al-app { --al-page: #FAFAFA; --al-card: #FFFFFF; --al-text: #242424; --al-muted: #616161; --al-stroke: #D1D1D1; --al-subtle: #E0E0E0;
14229
+ font-family: "Segoe UI", "Segoe UI Web (West European)", -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", sans-serif;
14230
+ font-size: 14px; color: var(--al-text); background: var(--al-page); border: 1px solid var(--al-stroke); border-radius: 4px; overflow: hidden;
14231
+ box-sizing: border-box; max-width: 100%; margin: 0 auto; }
14232
+ .al-app *, .al-app *::before, .al-app *::after { box-sizing: border-box; }
14233
+ .al-size-tablet .al-app { width: 768px; }
14234
+ .al-size-phone .al-app { width: 390px; font-size: 14px; }
14235
+ .al-appbar { display: flex; align-items: center; gap: 12px; height: 48px; padding: 0 16px; background: var(--al-header, #F0F0F0); color: var(--al-header-text, #242424); }
14236
+ .al-waffle { width: 16px; height: 16px; background-image: radial-gradient(currentColor 1.5px, transparent 1.6px); background-size: 6px 6px; }
14237
+ .al-appname { font-weight: 600; font-size: 16px; }
14238
+ .al-commandbar { display: flex; gap: 4px; margin: 8px; padding: 6px 12px; background: var(--al-card); border-radius: 8px; box-shadow: 0 0 2px rgba(0,0,0,.12), 0 1px 2px rgba(0,0,0,.14); overflow: hidden; white-space: nowrap; }
14239
+ .al-cmd { padding: 4px 8px; border-radius: 4px; color: var(--al-text); }
14240
+ .al-back { color: var(--al-muted); border-right: 1px solid var(--al-subtle); border-radius: 0; padding-right: 12px; }
14241
+ .al-record { margin: 0 8px 8px; background: var(--al-card); padding: 16px 20px 0; border-radius: 8px; box-shadow: 0 0 2px rgba(0,0,0,.12), 0 1px 2px rgba(0,0,0,.14); }
14242
+ .al-recordhead { display: flex; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
14243
+ .al-entityicon { flex: 0 0 40px; height: 40px; border-radius: 50%; background: var(--al-subtle); }
14244
+ .al-titleblock { flex: 1 1 0; min-width: 0; }
14245
+ .al-unsaved { font-size: 14px; font-weight: 400; color: var(--al-muted); }
14246
+ .al-title { font-size: 20px; font-weight: 600; overflow-wrap: anywhere; }
14247
+ .al-subtitle { color: var(--al-text); font-size: 14px; margin-top: 4px; }
14248
+ .al-headerfields { display: flex; gap: 0; align-items: stretch; flex-wrap: wrap; }
14249
+ .al-headerfield { padding: 0 16px; border-left: 1px solid var(--al-subtle); min-width: 96px; }
14250
+ .al-headervalue { font-weight: 600; }
14251
+ .al-headerlabel { color: var(--al-muted); font-size: 12px; }
14252
+ .al-headerflyout { flex-basis: 100%; display: flex; flex-wrap: wrap; gap: 8px 0; padding-top: 8px; }
14253
+ .al-headerflyout[hidden] { display: none; }
14254
+ .al-headermore { background: none; border: none; color: var(--al-muted); cursor: pointer; font: inherit; padding: 0 8px; }
14255
+ .al-tabs { display: flex; gap: 8px; margin-top: 8px; overflow-x: auto; }
14256
+ .al-tab { background: none; border: none; border-bottom: 2px solid transparent; padding: 10px 8px; font: inherit; color: var(--al-text); cursor: pointer; white-space: nowrap; }
14257
+ .al-tab.selected { border-bottom-color: var(--al-accent, #0F6CBD); font-weight: 600; }
14258
+ .al-body { padding: 0 8px 8px; }
14259
+ .al-tabpanel { display: none; }
14260
+ .al-tabpanel.selected { display: block; }
14261
+ .al-tabcols { display: flex; gap: 16px; align-items: flex-start; }
14262
+ .al-tabcol { min-width: 0; flex-shrink: 1; }
14263
+ ${widths}
14264
+ .al-section { background: var(--al-card); border-radius: 4px; box-shadow: 0 0 2px rgba(0,0,0,.12), 0 1px 2px rgba(0,0,0,.14); padding: 12px; margin-bottom: 8px; }
14265
+ .al-sectiontitle { overflow-wrap: anywhere; font-size: 14px; font-weight: 600; margin: 0 0 8px; }
14266
+ .al-row { display: grid; gap: 4px 24px; margin-bottom: 4px; }
14267
+ .al-cols-1 { grid-template-columns: minmax(0, 1fr); }
14268
+ .al-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
14269
+ .al-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
14270
+ .al-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
14271
+ .al-span-2 { grid-column: span 2; } .al-span-3 { grid-column: span 3; } .al-span-4 { grid-column: span 4; }
14272
+ .al-field { display: grid; grid-template-columns: minmax(0, 185px) minmax(0, 1fr); align-items: center; gap: 0; min-height: 48px; }
14273
+ .al-field.al-block, .al-field.al-nolabel { grid-template-columns: minmax(0, 1fr); }
14274
+ .al-nolabel .al-label { display: none; }
14275
+ .al-label { color: var(--al-text); overflow-wrap: anywhere; padding-right: 8px; }
14276
+ .al-req { color: #C50F1F; margin-left: 2px; }
14277
+ .al-input { display: flex; align-items: center; justify-content: space-between; min-height: 32px; padding: 0 10px; background: #F5F5F5; border: none; border-radius: 4px; color: var(--al-muted); }
14278
+ .al-textarea { min-height: 64px; align-items: flex-start; padding-top: 6px; }
14279
+ .al-prefix { color: var(--al-text); margin-right: 6px; }
14280
+ .al-icon { color: var(--al-muted); margin-left: 8px; }
14281
+ .al-readonly .al-input { background: transparent; }
14282
+ .al-toggle { display: inline-block; vertical-align: middle; width: 40px; height: 20px; border-radius: 10px; border: 1px solid #616161; position: relative; }
14283
+ .al-knob { position: absolute; top: 3px; left: 3px; width: 12px; height: 12px; border-radius: 50%; background: #616161; }
14284
+ .al-toggletext { margin-left: 8px; }
14285
+ .al-image { display: inline-flex; align-items: center; justify-content: center; width: 64px; height: 64px; background: var(--al-page); border-radius: 4px; }
14286
+ .al-grid, .al-timeline, .al-quickview { border: 1px solid var(--al-subtle); border-radius: 4px; padding: 8px 12px; }
14287
+ .al-gridbar, .al-timelinebar { display: flex; justify-content: space-between; margin-bottom: 8px; }
14288
+ .al-gridtitle { overflow-wrap: anywhere; font-weight: 600; }
14289
+ .al-gridcmd { color: var(--al-accent, #0F6CBD); }
14290
+ .al-gridhead { display: grid; grid-template-columns: 1fr 1fr; padding: 6px 0; border-bottom: 1px solid var(--al-subtle); color: var(--al-muted); font-size: 12px; }
14291
+ .al-gridempty, .al-timelineempty { color: var(--al-muted); text-align: center; padding: 16px 0; }
14292
+ .al-qvrow { display: grid; grid-template-columns: 35% 1fr; gap: 8px; margin: 8px 0; }
14293
+ .al-qvrow span { height: 10px; border-radius: 3px; background: var(--al-subtle); }
14294
+ .al-placeholder { overflow-wrap: anywhere; color: var(--al-muted); text-align: center; padding: 16px 0; border: 1px dashed var(--al-stroke); border-radius: 4px; }
14295
+ .al-footer { display: flex; gap: 24px; flex-wrap: wrap; padding: 8px 20px; background: var(--al-card); border-top: 1px solid var(--al-subtle); }
14296
+ .al-libraries { color: var(--al-muted); font-size: 12px; padding: 8px 20px; }
14297
+ .al-problem { color: var(--al-muted); padding: 24px 0; text-align: center; }
14298
+ .al-edit .al-spacer { min-height: 32px; border: 1px dashed var(--al-stroke); border-radius: 4px; color: var(--al-muted); display: flex; align-items: center; justify-content: center; }
14299
+ .al-edit .al-drop { height: 6px; margin: 1px 0; border-radius: 3px; }
14300
+ .al-edit .al-hdrop { width: 6px; align-self: stretch; border-radius: 3px; }
14301
+ .al-edit .al-hdrop.al-hempty { width: auto; padding: 8px 12px; border: 1px dashed var(--al-stroke); color: var(--al-muted); font-size: 12px; }
14302
+ .al-edit .al-flyout { opacity: .6; border-left-style: dashed; }
14303
+ .al-edit .al-sdrop { border: 1px dashed var(--al-stroke); color: var(--al-muted); padding: 8px; text-align: center; border-radius: 4px; font-size: 12px; }
14304
+ /* Hidden elements stay visible while designing, dimmed and dashed, so you can see what is hidden. */
14305
+ .al-hidden { opacity: .5; outline: 1px dashed var(--al-stroke); }
14306
+ .al-size-tablet .al-tabcols,
14307
+ .al-size-phone .al-tabcols { flex-direction: column; align-items: stretch; }
14308
+ .al-size-tablet .al-tabcol, .al-size-phone .al-tabcol { max-width: 100%; flex-basis: auto; }
14309
+ .al-size-phone .al-row { grid-template-columns: 1fr; }
14310
+ .al-size-phone .al-span-2, .al-size-phone .al-span-3, .al-size-phone .al-span-4 { grid-column: auto; }
14311
+ .al-size-phone .al-record { padding-left: 12px; padding-right: 12px; }
14312
+ .al-size-phone .al-headerfields { flex-basis: 100%; }
14313
+ .al-strip { display: flex; align-items: center; gap: 12px; margin: 8px 0; flex-wrap: wrap; }
14314
+ .al-sizes button { font: inherit; padding: 2px 10px; border: 1px solid #D1D1D1; background: transparent; color: inherit; cursor: pointer; }
14315
+ .al-sizes button[aria-pressed="true"] { background: #0F6CBD; border-color: #0F6CBD; color: #FFFFFF; }
14316
+ .al-themesource { opacity: .75; font-size: 12px; }
14317
+ `.trim();
14318
+
14209
14319
  // ../../extension/src/sim/html.ts
14210
14320
  var escape = (s) => s.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
14321
+ var SIM_BOOT = `window.__simLoaded = {}; window.Xrm = new Proxy({}, { get: function (_, k) { return window.__simXrm ? window.__simXrm[k] : undefined; } }); document.addEventListener('load', function (e) { var s = e.target; if (s && s.dataset && s.dataset.lib) window.__simLoaded[s.dataset.lib] = true; }, true); function __simNo(what) { if (window.__simBlocked) window.__simBlocked(what); return new Error(what + " isn't simulated offline; run this test online"); } window.fetch = function (u) { return Promise.reject(__simNo('fetch ' + String(u && u.url || u))); }; XMLHttpRequest.prototype.open = function (m, u) { throw __simNo('XMLHttpRequest ' + m + ' ' + u); };`;
14211
14322
  function simHtml(o) {
14212
14323
  const self2 = o.cspSource ?? "'self'";
14213
- const csp = ["default-src 'none'", `style-src ${self2}`, `script-src 'nonce-${o.nonce}'`, `img-src ${self2} data:`].join("; ");
14214
- const boot = `window.__simLoaded = {}; window.Xrm = new Proxy({}, { get: function (_, k) { return window.__simXrm ? window.__simXrm[k] : undefined; } }); document.addEventListener('load', function (e) { var s = e.target; if (s && s.dataset && s.dataset.lib) window.__simLoaded[s.dataset.lib] = true; }, true); function __simNo(what) { if (window.__simBlocked) window.__simBlocked(what); return new Error(what + " isn't simulated offline; run this test online"); } window.fetch = function (u) { return Promise.reject(__simNo('fetch ' + String(u && u.url || u))); }; XMLHttpRequest.prototype.open = function (m, u) { throw __simNo('XMLHttpRequest ' + m + ' ' + u); };`;
14324
+ const csp = ["default-src 'none'", `style-src ${self2}${o.style ? ` 'nonce-${o.nonce}'` : ""}`, `script-src 'nonce-${o.nonce}'`, `img-src ${self2} data:`].join("; ");
14215
14325
  const libs = o.libraries.map((l) => `<script nonce="${o.nonce}" src="${escape(l.src)}" data-lib="${escape(l.name)}"></script>`).join("\n");
14216
14326
  return `<!DOCTYPE html>
14217
14327
  <html lang="en">
@@ -14220,11 +14330,12 @@ function simHtml(o) {
14220
14330
  <meta http-equiv="Content-Security-Policy" content="${csp}">
14221
14331
  <meta name="viewport" content="width=device-width, initial-scale=1">
14222
14332
  <link rel="stylesheet" href="${escape(o.css)}">
14223
- <title>${escape(o.title)}</title>
14333
+ ${o.style ? `<style nonce="${o.nonce}">${o.style.replace(/<\/style/gi, "<\\/style")}</style>
14334
+ ` : ""}<title>${escape(o.title)}</title>
14224
14335
  </head>
14225
- <body>
14336
+ <body${o.themeLabel ? ` data-theme-source="${escape(o.themeLabel)}"` : ""}>
14226
14337
  <div id="sim">Loading\u2026</div>
14227
- <script nonce="${o.nonce}">${boot}</script>
14338
+ <script nonce="${o.nonce}">${SIM_BOOT}</script>
14228
14339
  ${libs}
14229
14340
  <script nonce="${o.nonce}">window.__simPackage = ${o.pkgJson.replace(/</g, "\\u003c")};</script>
14230
14341
  <script nonce="${o.nonce}" src="${escape(o.script)}"></script>
@@ -14303,7 +14414,8 @@ function browserDriverOnPage(page, pkg, scripts, assets) {
14303
14414
  css: "/sim.css",
14304
14415
  script: "/sim.js",
14305
14416
  libraries: libraries.map((l) => ({ name: l.name, src: `/webresources/${l.name}` })),
14306
- pkgJson: JSON.stringify(pkg)
14417
+ pkgJson: JSON.stringify(pkg),
14418
+ style: APP_LOOK_CSS
14307
14419
  }) : path === "/sim.js" ? assets.simJs : path === "/sim.css" ? assets.simCss : path.startsWith("/webresources/") ? scripts[path.slice("/webresources/".length)] : void 0;
14308
14420
  if (body2 === void 0) return route.abort();
14309
14421
  const type2 = path === "/" ? "text/html" : path.endsWith(".css") ? "text/css" : "text/javascript";
@@ -77652,8 +77764,8 @@ function statusByFile(project, run, committed) {
77652
77764
  }
77653
77765
 
77654
77766
  // ../../extension/src/test/cli.ts
77655
- var COMMANDS = ["run", "generate", "check-generated", "record", "clean-online", "calibrate", "status"];
77656
- var VALUE_OPTIONS = ["--dir", "--junit", "--report", "--seed-command", "--env", "--url", "--app"];
77767
+ var COMMANDS = ["run", "generate", "check-generated", "record", "clean-online", "calibrate", "status", "render"];
77768
+ var VALUE_OPTIONS = ["--dir", "--junit", "--report", "--seed-command", "--env", "--url", "--app", "--page", "--out", "--format", "--width"];
77657
77769
  var FLAGS = ["--json", "--browser", "--online"];
77658
77770
  var NEED_ENV = "Online runs need --env and --url (dvschema test --online --env <name> passes them).";
77659
77771
  var BAD = /* @__PURE__ */ new Set(["failed", "notSupported", "incomplete"]);
@@ -77673,10 +77785,10 @@ var commitOf = (root) => {
77673
77785
  return void 0;
77674
77786
  }
77675
77787
  };
77676
- async function main(argv, io) {
77788
+ async function main(argv, io, deps = {}) {
77677
77789
  const [command, ...rest] = argv;
77678
77790
  if (!command || !COMMANDS.includes(command)) {
77679
- io.err(`Unknown command '${command ?? ""}'. Use run, generate, check-generated, record, clean-online, calibrate or status.`);
77791
+ io.err(`Unknown command '${command ?? ""}'. Use run, generate, check-generated, record, clean-online, calibrate, status or render.`);
77680
77792
  return 2;
77681
77793
  }
77682
77794
  const options3 = {};
@@ -77692,6 +77804,24 @@ async function main(argv, io) {
77692
77804
  } else paths.push(a);
77693
77805
  }
77694
77806
  const root = (0, import_node_path9.resolve)(options3["--dir"] ?? ".");
77807
+ if (command === "render") {
77808
+ const format = options3["--format"] === "pdf" ? "pdf" : "png";
77809
+ let playwright;
77810
+ try {
77811
+ playwright = (deps.loadPlaywright ?? loadPlaywright)(root);
77812
+ } catch {
77813
+ io.err(EXPORT_NEEDS_PLAYWRIGHT);
77814
+ return 1;
77815
+ }
77816
+ try {
77817
+ await renderPage(playwright, (0, import_node_fs9.readFileSync)(options3["--page"], "utf8"), { out: options3["--out"], format, width: Number(options3["--width"]) || 1366 });
77818
+ } catch (e) {
77819
+ io.err(/Executable doesn't exist|browserType\.launch/.test(messageOf(e)) ? EXPORT_NEEDS_PLAYWRIGHT : messageOf(e));
77820
+ return 1;
77821
+ }
77822
+ io.out(`Wrote ${options3["--out"]}`);
77823
+ return 0;
77824
+ }
77695
77825
  const online = flags.has("--online") || command === "clean-online" || command === "calibrate";
77696
77826
  if (online && (!options3["--env"] || !options3["--url"])) {
77697
77827
  io.err(NEED_ENV);
package/dist/index.js CHANGED
@@ -7380,12 +7380,106 @@ var import_test = require("@playwright/test");
7380
7380
  var import_node_fs = require("node:fs");
7381
7381
  var import_node_path = require("node:path");
7382
7382
 
7383
+ // ../../extension/src/core/appLook/css.ts
7384
+ var widths = Array.from({ length: 20 }, (_, i) => (i + 1) * 5).map((w) => `.al-w-${w} { flex: 0 1 ${w}%; max-width: ${w}%; }`).join("\n");
7385
+ var APP_LOOK_CSS = `
7386
+ .al-app { --al-page: #FAFAFA; --al-card: #FFFFFF; --al-text: #242424; --al-muted: #616161; --al-stroke: #D1D1D1; --al-subtle: #E0E0E0;
7387
+ font-family: "Segoe UI", "Segoe UI Web (West European)", -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", sans-serif;
7388
+ font-size: 14px; color: var(--al-text); background: var(--al-page); border: 1px solid var(--al-stroke); border-radius: 4px; overflow: hidden;
7389
+ box-sizing: border-box; max-width: 100%; margin: 0 auto; }
7390
+ .al-app *, .al-app *::before, .al-app *::after { box-sizing: border-box; }
7391
+ .al-size-tablet .al-app { width: 768px; }
7392
+ .al-size-phone .al-app { width: 390px; font-size: 14px; }
7393
+ .al-appbar { display: flex; align-items: center; gap: 12px; height: 48px; padding: 0 16px; background: var(--al-header, #F0F0F0); color: var(--al-header-text, #242424); }
7394
+ .al-waffle { width: 16px; height: 16px; background-image: radial-gradient(currentColor 1.5px, transparent 1.6px); background-size: 6px 6px; }
7395
+ .al-appname { font-weight: 600; font-size: 16px; }
7396
+ .al-commandbar { display: flex; gap: 4px; margin: 8px; padding: 6px 12px; background: var(--al-card); border-radius: 8px; box-shadow: 0 0 2px rgba(0,0,0,.12), 0 1px 2px rgba(0,0,0,.14); overflow: hidden; white-space: nowrap; }
7397
+ .al-cmd { padding: 4px 8px; border-radius: 4px; color: var(--al-text); }
7398
+ .al-back { color: var(--al-muted); border-right: 1px solid var(--al-subtle); border-radius: 0; padding-right: 12px; }
7399
+ .al-record { margin: 0 8px 8px; background: var(--al-card); padding: 16px 20px 0; border-radius: 8px; box-shadow: 0 0 2px rgba(0,0,0,.12), 0 1px 2px rgba(0,0,0,.14); }
7400
+ .al-recordhead { display: flex; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
7401
+ .al-entityicon { flex: 0 0 40px; height: 40px; border-radius: 50%; background: var(--al-subtle); }
7402
+ .al-titleblock { flex: 1 1 0; min-width: 0; }
7403
+ .al-unsaved { font-size: 14px; font-weight: 400; color: var(--al-muted); }
7404
+ .al-title { font-size: 20px; font-weight: 600; overflow-wrap: anywhere; }
7405
+ .al-subtitle { color: var(--al-text); font-size: 14px; margin-top: 4px; }
7406
+ .al-headerfields { display: flex; gap: 0; align-items: stretch; flex-wrap: wrap; }
7407
+ .al-headerfield { padding: 0 16px; border-left: 1px solid var(--al-subtle); min-width: 96px; }
7408
+ .al-headervalue { font-weight: 600; }
7409
+ .al-headerlabel { color: var(--al-muted); font-size: 12px; }
7410
+ .al-headerflyout { flex-basis: 100%; display: flex; flex-wrap: wrap; gap: 8px 0; padding-top: 8px; }
7411
+ .al-headerflyout[hidden] { display: none; }
7412
+ .al-headermore { background: none; border: none; color: var(--al-muted); cursor: pointer; font: inherit; padding: 0 8px; }
7413
+ .al-tabs { display: flex; gap: 8px; margin-top: 8px; overflow-x: auto; }
7414
+ .al-tab { background: none; border: none; border-bottom: 2px solid transparent; padding: 10px 8px; font: inherit; color: var(--al-text); cursor: pointer; white-space: nowrap; }
7415
+ .al-tab.selected { border-bottom-color: var(--al-accent, #0F6CBD); font-weight: 600; }
7416
+ .al-body { padding: 0 8px 8px; }
7417
+ .al-tabpanel { display: none; }
7418
+ .al-tabpanel.selected { display: block; }
7419
+ .al-tabcols { display: flex; gap: 16px; align-items: flex-start; }
7420
+ .al-tabcol { min-width: 0; flex-shrink: 1; }
7421
+ ${widths}
7422
+ .al-section { background: var(--al-card); border-radius: 4px; box-shadow: 0 0 2px rgba(0,0,0,.12), 0 1px 2px rgba(0,0,0,.14); padding: 12px; margin-bottom: 8px; }
7423
+ .al-sectiontitle { overflow-wrap: anywhere; font-size: 14px; font-weight: 600; margin: 0 0 8px; }
7424
+ .al-row { display: grid; gap: 4px 24px; margin-bottom: 4px; }
7425
+ .al-cols-1 { grid-template-columns: minmax(0, 1fr); }
7426
+ .al-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
7427
+ .al-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
7428
+ .al-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
7429
+ .al-span-2 { grid-column: span 2; } .al-span-3 { grid-column: span 3; } .al-span-4 { grid-column: span 4; }
7430
+ .al-field { display: grid; grid-template-columns: minmax(0, 185px) minmax(0, 1fr); align-items: center; gap: 0; min-height: 48px; }
7431
+ .al-field.al-block, .al-field.al-nolabel { grid-template-columns: minmax(0, 1fr); }
7432
+ .al-nolabel .al-label { display: none; }
7433
+ .al-label { color: var(--al-text); overflow-wrap: anywhere; padding-right: 8px; }
7434
+ .al-req { color: #C50F1F; margin-left: 2px; }
7435
+ .al-input { display: flex; align-items: center; justify-content: space-between; min-height: 32px; padding: 0 10px; background: #F5F5F5; border: none; border-radius: 4px; color: var(--al-muted); }
7436
+ .al-textarea { min-height: 64px; align-items: flex-start; padding-top: 6px; }
7437
+ .al-prefix { color: var(--al-text); margin-right: 6px; }
7438
+ .al-icon { color: var(--al-muted); margin-left: 8px; }
7439
+ .al-readonly .al-input { background: transparent; }
7440
+ .al-toggle { display: inline-block; vertical-align: middle; width: 40px; height: 20px; border-radius: 10px; border: 1px solid #616161; position: relative; }
7441
+ .al-knob { position: absolute; top: 3px; left: 3px; width: 12px; height: 12px; border-radius: 50%; background: #616161; }
7442
+ .al-toggletext { margin-left: 8px; }
7443
+ .al-image { display: inline-flex; align-items: center; justify-content: center; width: 64px; height: 64px; background: var(--al-page); border-radius: 4px; }
7444
+ .al-grid, .al-timeline, .al-quickview { border: 1px solid var(--al-subtle); border-radius: 4px; padding: 8px 12px; }
7445
+ .al-gridbar, .al-timelinebar { display: flex; justify-content: space-between; margin-bottom: 8px; }
7446
+ .al-gridtitle { overflow-wrap: anywhere; font-weight: 600; }
7447
+ .al-gridcmd { color: var(--al-accent, #0F6CBD); }
7448
+ .al-gridhead { display: grid; grid-template-columns: 1fr 1fr; padding: 6px 0; border-bottom: 1px solid var(--al-subtle); color: var(--al-muted); font-size: 12px; }
7449
+ .al-gridempty, .al-timelineempty { color: var(--al-muted); text-align: center; padding: 16px 0; }
7450
+ .al-qvrow { display: grid; grid-template-columns: 35% 1fr; gap: 8px; margin: 8px 0; }
7451
+ .al-qvrow span { height: 10px; border-radius: 3px; background: var(--al-subtle); }
7452
+ .al-placeholder { overflow-wrap: anywhere; color: var(--al-muted); text-align: center; padding: 16px 0; border: 1px dashed var(--al-stroke); border-radius: 4px; }
7453
+ .al-footer { display: flex; gap: 24px; flex-wrap: wrap; padding: 8px 20px; background: var(--al-card); border-top: 1px solid var(--al-subtle); }
7454
+ .al-libraries { color: var(--al-muted); font-size: 12px; padding: 8px 20px; }
7455
+ .al-problem { color: var(--al-muted); padding: 24px 0; text-align: center; }
7456
+ .al-edit .al-spacer { min-height: 32px; border: 1px dashed var(--al-stroke); border-radius: 4px; color: var(--al-muted); display: flex; align-items: center; justify-content: center; }
7457
+ .al-edit .al-drop { height: 6px; margin: 1px 0; border-radius: 3px; }
7458
+ .al-edit .al-hdrop { width: 6px; align-self: stretch; border-radius: 3px; }
7459
+ .al-edit .al-hdrop.al-hempty { width: auto; padding: 8px 12px; border: 1px dashed var(--al-stroke); color: var(--al-muted); font-size: 12px; }
7460
+ .al-edit .al-flyout { opacity: .6; border-left-style: dashed; }
7461
+ .al-edit .al-sdrop { border: 1px dashed var(--al-stroke); color: var(--al-muted); padding: 8px; text-align: center; border-radius: 4px; font-size: 12px; }
7462
+ /* Hidden elements stay visible while designing, dimmed and dashed, so you can see what is hidden. */
7463
+ .al-hidden { opacity: .5; outline: 1px dashed var(--al-stroke); }
7464
+ .al-size-tablet .al-tabcols,
7465
+ .al-size-phone .al-tabcols { flex-direction: column; align-items: stretch; }
7466
+ .al-size-tablet .al-tabcol, .al-size-phone .al-tabcol { max-width: 100%; flex-basis: auto; }
7467
+ .al-size-phone .al-row { grid-template-columns: 1fr; }
7468
+ .al-size-phone .al-span-2, .al-size-phone .al-span-3, .al-size-phone .al-span-4 { grid-column: auto; }
7469
+ .al-size-phone .al-record { padding-left: 12px; padding-right: 12px; }
7470
+ .al-size-phone .al-headerfields { flex-basis: 100%; }
7471
+ .al-strip { display: flex; align-items: center; gap: 12px; margin: 8px 0; flex-wrap: wrap; }
7472
+ .al-sizes button { font: inherit; padding: 2px 10px; border: 1px solid #D1D1D1; background: transparent; color: inherit; cursor: pointer; }
7473
+ .al-sizes button[aria-pressed="true"] { background: #0F6CBD; border-color: #0F6CBD; color: #FFFFFF; }
7474
+ .al-themesource { opacity: .75; font-size: 12px; }
7475
+ `.trim();
7476
+
7383
7477
  // ../../extension/src/sim/html.ts
7384
7478
  var escape = (s) => s.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
7479
+ var SIM_BOOT = `window.__simLoaded = {}; window.Xrm = new Proxy({}, { get: function (_, k) { return window.__simXrm ? window.__simXrm[k] : undefined; } }); document.addEventListener('load', function (e) { var s = e.target; if (s && s.dataset && s.dataset.lib) window.__simLoaded[s.dataset.lib] = true; }, true); function __simNo(what) { if (window.__simBlocked) window.__simBlocked(what); return new Error(what + " isn't simulated offline; run this test online"); } window.fetch = function (u) { return Promise.reject(__simNo('fetch ' + String(u && u.url || u))); }; XMLHttpRequest.prototype.open = function (m, u) { throw __simNo('XMLHttpRequest ' + m + ' ' + u); };`;
7385
7480
  function simHtml(o) {
7386
7481
  const self = o.cspSource ?? "'self'";
7387
- const csp = ["default-src 'none'", `style-src ${self}`, `script-src 'nonce-${o.nonce}'`, `img-src ${self} data:`].join("; ");
7388
- const boot = `window.__simLoaded = {}; window.Xrm = new Proxy({}, { get: function (_, k) { return window.__simXrm ? window.__simXrm[k] : undefined; } }); document.addEventListener('load', function (e) { var s = e.target; if (s && s.dataset && s.dataset.lib) window.__simLoaded[s.dataset.lib] = true; }, true); function __simNo(what) { if (window.__simBlocked) window.__simBlocked(what); return new Error(what + " isn't simulated offline; run this test online"); } window.fetch = function (u) { return Promise.reject(__simNo('fetch ' + String(u && u.url || u))); }; XMLHttpRequest.prototype.open = function (m, u) { throw __simNo('XMLHttpRequest ' + m + ' ' + u); };`;
7482
+ const csp = ["default-src 'none'", `style-src ${self}${o.style ? ` 'nonce-${o.nonce}'` : ""}`, `script-src 'nonce-${o.nonce}'`, `img-src ${self} data:`].join("; ");
7389
7483
  const libs = o.libraries.map((l) => `<script nonce="${o.nonce}" src="${escape(l.src)}" data-lib="${escape(l.name)}"></script>`).join("\n");
7390
7484
  return `<!DOCTYPE html>
7391
7485
  <html lang="en">
@@ -7394,11 +7488,12 @@ function simHtml(o) {
7394
7488
  <meta http-equiv="Content-Security-Policy" content="${csp}">
7395
7489
  <meta name="viewport" content="width=device-width, initial-scale=1">
7396
7490
  <link rel="stylesheet" href="${escape(o.css)}">
7397
- <title>${escape(o.title)}</title>
7491
+ ${o.style ? `<style nonce="${o.nonce}">${o.style.replace(/<\/style/gi, "<\\/style")}</style>
7492
+ ` : ""}<title>${escape(o.title)}</title>
7398
7493
  </head>
7399
- <body>
7494
+ <body${o.themeLabel ? ` data-theme-source="${escape(o.themeLabel)}"` : ""}>
7400
7495
  <div id="sim">Loading\u2026</div>
7401
- <script nonce="${o.nonce}">${boot}</script>
7496
+ <script nonce="${o.nonce}">${SIM_BOOT}</script>
7402
7497
  ${libs}
7403
7498
  <script nonce="${o.nonce}">window.__simPackage = ${o.pkgJson.replace(/</g, "\\u003c")};</script>
7404
7499
  <script nonce="${o.nonce}" src="${escape(o.script)}"></script>
@@ -7516,7 +7611,8 @@ function browserDriverOnPage(page, pkg, scripts, assets) {
7516
7611
  css: "/sim.css",
7517
7612
  script: "/sim.js",
7518
7613
  libraries: libraries.map((l) => ({ name: l.name, src: `/webresources/${l.name}` })),
7519
- pkgJson: JSON.stringify(pkg)
7614
+ pkgJson: JSON.stringify(pkg),
7615
+ style: APP_LOOK_CSS
7520
7616
  }) : path === "/sim.js" ? assets.simJs : path === "/sim.css" ? assets.simCss : path.startsWith("/webresources/") ? scripts[path.slice("/webresources/".length)] : void 0;
7521
7617
  if (body === void 0) return route.abort();
7522
7618
  const type = path === "/" ? "text/html" : path.endsWith(".css") ? "text/css" : "text/javascript";
@@ -7845,6 +7941,7 @@ function buildFormPackage(inputs) {
7845
7941
  const formName = String(doc.head.name ?? "");
7846
7942
  if (!inputs.tables[table]) return { problem: `The form's table ${table} isn't in the project (schema/tables/${table}.table.yaml).` };
7847
7943
  const { columns } = columnsOf(inputs.tables[table], inputs.choices);
7944
+ const tableLabel = str(obj(safeParse(inputs.tables[table])).displayName);
7848
7945
  for (const c of SYSTEM_COLUMNS) if (!columns.some((x) => x.name === c.name)) columns.push(c);
7849
7946
  for (const c of inputs.snapshotColumns ?? []) {
7850
7947
  if (!c.type.startsWith("unsupported:") && !columns.some((x) => x.name === c.name)) columns.push({ name: c.name, label: c.label, type: c.type, requiredLevel: "none", options: c.options ?? [] });
@@ -7889,6 +7986,7 @@ function buildFormPackage(inputs) {
7889
7986
  return {
7890
7987
  pkg: {
7891
7988
  table,
7989
+ ...tableLabel ? { tableLabel } : {},
7892
7990
  formName,
7893
7991
  formType: String(doc.head.type ?? "main"),
7894
7992
  form: doc,
package/dist/sim.css CHANGED
@@ -19,23 +19,7 @@ input:disabled, select:disabled, textarea:disabled { opacity: 0.6; }
19
19
  .sim-note { color: var(--sim-muted); margin-left: auto; }
20
20
  .sim-panes { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 12px; align-items: start; }
21
21
  @media (max-width: 760px) { .sim-panes { grid-template-columns: 1fr; } }
22
- .sim-form { border: 1px solid var(--sim-border); padding: 10px; min-height: 240px; }
23
- .sim-header { display: flex; gap: 10px; padding-bottom: 8px; margin-bottom: 8px; border-bottom: 1px solid var(--sim-border); }
24
- .sim-tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--sim-border); margin-bottom: 10px; }
25
- .sim-tabs button { background: none; color: var(--sim-muted); border-bottom: 2px solid transparent; }
26
- .sim-tabs button.on { color: var(--sim-fg); border-bottom-color: var(--sim-accent); }
27
- .sim-columns { display: grid; gap: 10px; }
28
- .sim-columns.cols-2 { grid-template-columns: 1fr 1fr; }
29
- .sim-columns.cols-3 { grid-template-columns: 1fr 1fr 1fr; }
30
- .sim-columns.cols-4 { grid-template-columns: repeat(4, 1fr); }
31
- .sim-section { border: 1px solid var(--sim-border); background: var(--sim-widget); margin: 0 0 10px; padding: 8px; }
32
- .sim-section legend { font-weight: 600; padding: 0 4px; }
33
- .sim-row { display: grid; gap: 8px; margin-bottom: 6px; }
34
- .sim-row.cols-2 { grid-template-columns: 1fr 1fr; }
35
- .sim-row.cols-3 { grid-template-columns: 1fr 1fr 1fr; }
36
- .sim-row.cols-4 { grid-template-columns: repeat(4, 1fr); }
37
- .sim-cell { display: flex; flex-direction: column; gap: 3px; }
38
- .sim-cell label { color: var(--sim-muted); }
22
+ .sim-form { padding: 4px 0; min-height: 240px; overflow-x: auto; }
39
23
  .sim-placeholder { color: var(--sim-muted); border: 1px dashed var(--sim-border); padding: 6px; }
40
24
  /* Hidden fields stay on the page offline, dimmed and dashed, so you can see what a rule or script hid. */
41
25
  .sim-hidden { opacity: 0.45; outline: 1px dashed var(--sim-border); }
@@ -55,3 +39,7 @@ input:disabled, select:disabled, textarea:disabled { opacity: 0.6; }
55
39
  .sim-add { display: flex; gap: 4px; margin: 4px 0 8px; }
56
40
  .sim-add input { flex: 1; }
57
41
  select[multiple] { min-height: 4.5em; }
42
+ .al-app input, .al-app select, .al-app textarea { background: #F5F5F5; color: #242424; border: none; border-radius: 4px; min-height: 32px; }
43
+ .al-app input:focus, .al-app select:focus, .al-app textarea:focus { outline: none; border-bottom: 2px solid var(--al-accent, #0F6CBD); }
44
+ .sim-bar .al-sizes button { padding: 2px 8px; }
45
+ .al-app .sim-placeholder { color: var(--al-muted, #616161); border-color: var(--al-stroke, #D1D1D1); }