@format.dev/cli 0.2.0 → 0.4.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/AGENTS.md ADDED
@@ -0,0 +1,47 @@
1
+ # Working with Format
2
+
3
+ This file ships inside `@format.dev/cli` and matches the Format version this project is pinned to. Projects point to it from their own `AGENTS.md` or `CLAUDE.md`. Do not copy it into the project; `format update` keeps this one current.
4
+
5
+ Format (https://format.dev) builds PDFs from documents written in React, Vue, or HTML and CSS, and paginates them. Read this file before changing anything under `documents/`.
6
+
7
+ ## Read the docs first
8
+
9
+ Fetch https://format.dev/llms-full.txt before writing or editing a document. It is the full documentation as Markdown. For one page, fetch `https://format.dev/llms.mdx/<docs path>`, for example https://format.dev/llms.mdx/docs/document-model/overview. The index of pages is at https://format.dev/llms.txt.
10
+
11
+ Do not guess component names or props. Everything exported by `@format.dev/react` and `@format.dev/vue` is documented, and the type declarations in `node_modules/@format.dev/*/dist/index.d.ts` carry the same descriptions.
12
+
13
+ ## The document model in five lines
14
+
15
+ - `Document` is the root. It holds the title, language, fonts, and one or more Layouts.
16
+ - `Layout` is a page design with a width and height. Its markup is the page: header, footer, and anything fixed.
17
+ - `Flow` is the region whose content paginates across pages. Markup inside a Flow repeats on every page. The Flow's children are the stream of content that flows.
18
+ - `Stream` marks where the flowing items land inside repeating markup, for example rows inside a `<table>` whose `<thead>` repeats.
19
+ - `PageBreak` forces a page boundary. `PageNumber` and `PageCount` print page numbers. `TableOfContents`, `RunningHead`, `Numbering`, `Counter`, `Ref`, `Footnote`, and `Bookmarks` cover the rest.
20
+
21
+ Pagination is automatic. Do not use `@media print`, `page-break-*`, or `break-inside` to control pages. Use the model.
22
+
23
+ ## The workflow
24
+
25
+ 1. Preview is Format Studio. Find the script in `package.json` whose command is `format dev`. Scaffolds call it `dev`, but it may be `format:dev`, `pdfs`, or anything else, and a project may have none, in which case run `npx format dev`. Start it as a long-running background process and read its output. Studio runs at http://localhost:1234 and hot-reloads on save.
26
+ 2. The first Studio start on a machine needs the human to sign in. Credentials are saved, so this happens once per machine. A fresh sandbox needs a fresh sign-in.
27
+ - On the human's own computer, Studio prints a sign-in link and opens it in their browser. Approving it is the human's step. If the browser did not open, give the human the link from the terminal. Wait until the terminal says Studio is running, then continue.
28
+ - In a cloud sandbox, over SSH, or in a container, the human's browser cannot reach Studio. Sign in with the remote commands before starting Studio. `format dev` stops with `AUTH_REQUIRED` and exit code `3` when it detects these, but detection can miss a sandbox, so do not wait for it.
29
+ 1. Run `npx format auth start --json`. Give the human the `url` from the output. Ask them to open it, approve the sign-in, and send you the code the page shows.
30
+ 2. Run the `next` command from the same output, `npx format auth complete --request <attemptId> --code-stdin --json`, with the code on stdin. Keep `--code-stdin`: without it the command only reads a terminal, and stops with `MISSING_CODE` when stdin is a pipe. Never print the code, log it, or write it to a file.
31
+ 3. Start Studio.
32
+ - If a local link cannot finish because the human's browser cannot reach this machine, stop Studio and use the remote commands. Each `format auth` command can run in its own process.
33
+ 3. Look at your work in Studio if you have a browser tool: a built-in browser, a Chrome extension, or a Playwright MCP server. Open `http://localhost:1234/<document>` with a tall viewport, around 1400 by 6000, because Studio stacks every page vertically in one scroll, then take a screenshot. Re-navigate for each check rather than scrolling or clicking; a hidden browser pane may return black screenshots after interaction. If you have no browser tool, tell the human what changed and which document and variant to look at.
34
+ 4. Startup, version, port, config, compile, and render errors all print in the terminal running Studio as well as in its UI. Read the terminal output after each change.
35
+ 5. To check the real PDF, fetch `http://localhost:1234/api/download/<document>/<variant>` and save the response as a `.pdf`, or use the Generate PDF button in Studio. Both need `FORMAT_API_KEY` in `.env`. If it is missing, ask the human to create a key under API keys at https://dash.format.dev and add it to `.env`; Studio picks it up without a restart. Read the PDF yourself before asking the human to.
36
+
37
+ ## Keys and accounts
38
+
39
+ - Format accounts and API keys are created by the human in the dashboard at https://dash.format.dev.
40
+ - Production rendering and PDF previews read `FORMAT_API_KEY` from `.env`. Ask the human to create a key in the dashboard and add it to `.env`. Never ask for the key in chat, print it, or commit it.
41
+
42
+ ## Project layout and commands
43
+
44
+ - Each document lives in its own folder under `documents/`, with its entry file, styles, assets, and a `data/` folder of JSON variants.
45
+ - `format.config.json` pins the Format version. Every `@format.dev/*` package shares it. Change versions with `format update`, never by hand.
46
+ - `npx format new document <name>` scaffolds a document. `npx format compile` builds renderers for production. `npx format dev` runs Studio. Match `package.json` scripts by their command, not their name: the script running `format compile` may not be called `compile`. Every command has flags for non-interactive use, documented at https://format.dev/llms.mdx/docs/cli/overview.
47
+ - Production renders go through `@format.dev/client`. See https://format.dev/llms.mdx/docs/api-reference/api-client.
package/dist/index.mjs CHANGED
@@ -1,8 +1,8 @@
1
1
  #!/usr/bin/env node
2
2
  import { a as readConfigFile, i as findConfigPath, o as writeConfigVersion, r as detectIndent, s as CliError } from "./config-Dq7O4e8N.mjs";
3
- import { C as joinNames, D as commandForPlatform, E as truncateForSpinner, O as detectPackageManager, S as installManifest, T as runInstall$2, c as getDocumentsDir, g as validateDocumentName, i as generateRandomName, k as installCommand, l as readExistingDocumentNames, n as maybeSetupProject, r as writeDocumentDependencies, s as createDocument, w as writeDependenciesToManifest } from "./install-nInHtWQW.mjs";
3
+ import { C as joinNames, D as commandForPlatform, E as truncateForSpinner, O as detectPackageManager, S as installManifest, T as runInstall$2, c as getDocumentsDir, g as validateDocumentName, i as generateRandomName, k as installCommand, l as readExistingDocumentNames, n as maybeSetupProject, r as writeDocumentDependencies, s as createDocument, w as writeDependenciesToManifest } from "./install-DkRYx34A.mjs";
4
4
  import { a as rewriteFormatDependencies, i as mayHaveBreakingChanges, n as isExactVersion, r as isNewer, t as loadProjectState } from "./project-pX62Di_9.mjs";
5
- import { a as DEFAULT_STYLING, f as STYLING_LABELS, h as SUPPORTED_FRAMEWORKS, l as SCHEMA_KINDS, n as DEFAULT_PAGE_SIZE_ID, s as PAGE_SIZES, u as SCHEMA_LABELS, v as isValidDimension, y as methodsForFramework } from "./shared-CM3vyUlL.mjs";
5
+ import { a as DEFAULT_STYLING, c as PAGE_SIZES, d as SCHEMA_LABELS, g as SUPPORTED_FRAMEWORKS, n as DEFAULT_PAGE_SIZE_ID, p as STYLING_LABELS, r as DEFAULT_PAGE_WIDTH, s as PAGE_LENGTH_HINT, t as DEFAULT_PAGE_HEIGHT, u as SCHEMA_KINDS, x as parsePageLength, y as methodsForFramework } from "./shared-CIKs-hm2.mjs";
6
6
  import "./draw-random-name-Dpt6YmUk.mjs";
7
7
  import { Command, Option } from "commander";
8
8
  import { spawn } from "node:child_process";
@@ -119,14 +119,14 @@ var cli_spec_default = { commands: [
119
119
  },
120
120
  {
121
121
  "field": "width",
122
- "flags": "--width <px>",
123
- "description": "Custom page width in CSS pixels. Requires --height; ignored unless --size is \"custom\" or omitted.",
122
+ "flags": "--width <length>",
123
+ "description": "Custom page width: a length such as 210mm or 8.5in, or a number of CSS pixels. Requires --height; ignored unless --size is \"custom\" or omitted.",
124
124
  "type": "string"
125
125
  },
126
126
  {
127
127
  "field": "height",
128
- "flags": "--height <px>",
129
- "description": "Custom page height in CSS pixels. Requires --width; ignored unless --size is \"custom\" or omitted.",
128
+ "flags": "--height <length>",
129
+ "description": "Custom page height, written the same way as --width. Requires --width; ignored unless --size is \"custom\" or omitted.",
130
130
  "type": "string"
131
131
  },
132
132
  {
@@ -155,7 +155,7 @@ var cli_spec_default = { commands: [
155
155
  },
156
156
  {
157
157
  "name": "init",
158
- "description": "Set up Format in an existing codebase. This script writes a Format config file, adds npm scripts, gitignore entries, the Format packages, and optionally a first document. Each step will confirm before editing anything.",
158
+ "description": "Set up Format in an existing codebase. This script writes a Format config file, adds npm scripts, gitignore entries, the Format packages, an AGENTS.md block for AI agents, and optionally a first document. Each step will confirm before editing anything.",
159
159
  "options": [
160
160
  {
161
161
  "field": "framework",
@@ -195,6 +195,13 @@ var cli_spec_default = { commands: [
195
195
  "type": "boolean",
196
196
  "defaultValue": true
197
197
  },
198
+ {
199
+ "field": "agents",
200
+ "flags": "--no-agents",
201
+ "description": "Don't add the `<format.dev>` block to AGENTS.md (or CLAUDE.md when that is what the project has). The block points agents at the instructions shipped in @format.dev/cli. A block already in the file is replaced in place, and nothing else is touched.",
202
+ "type": "boolean",
203
+ "defaultValue": true
204
+ },
198
205
  {
199
206
  "field": "document",
200
207
  "flags": "--no-document",
@@ -250,7 +257,7 @@ var cli_spec_default = { commands: [
250
257
 
251
258
  //#endregion
252
259
  //#region src/versioning/js-version.ts
253
- const jsVersion = "0.2.0";
260
+ const jsVersion = "0.4.0";
254
261
 
255
262
  //#endregion
256
263
  //#region src/versioning/registry.ts
@@ -371,6 +378,30 @@ function startUpdateCheck(pinnedVersion) {
371
378
  } };
372
379
  }
373
380
 
381
+ //#endregion
382
+ //#region src/windows-command-line.ts
383
+ /** Characters cmd.exe still acts on inside double quotes: the quote itself, and `%` for variable expansion. */
384
+ const UNSAFE_IN_QUOTES = /["%]/;
385
+ /**
386
+ * One argument as cmd.exe will pass it on unchanged. Inside double quotes,
387
+ * `&`, `|`, `<`, `>`, `^`, parentheses and spaces are plain text. A trailing
388
+ * backslash is doubled, or the program reading the line would take the closing
389
+ * quote as part of the value.
390
+ */
391
+ function quoteForCmd(argument) {
392
+ if (UNSAFE_IN_QUOTES.test(argument)) throw new CliError(`The argument ${JSON.stringify(argument)} holds a " or % character, which cannot be passed on safely through the Windows command shell. Remove the character, or install @format.dev/studio in the project so Format runs it without the shell.`);
393
+ return `"${argument.replace(/\\+$/, (trailing) => trailing + trailing)}"`;
394
+ }
395
+ /**
396
+ * A command line for the Windows command shell, which is the only way to run a
397
+ * `.cmd` shim such as npm. Node joins shell arguments with spaces and escapes
398
+ * nothing, so every argument is quoted here first: a value like `A & B` then
399
+ * arrives as that text instead of running `B` as a second command.
400
+ */
401
+ function toWindowsCommandLine(command, args) {
402
+ return [command, ...args.map(quoteForCmd)].join(" ");
403
+ }
404
+
374
405
  //#endregion
375
406
  //#region src/studio.ts
376
407
  const STUDIO_PACKAGE = "@format.dev/studio";
@@ -421,25 +452,50 @@ async function spawnStudioForProject(state, argv) {
421
452
  const keepAliveOnSignal = argv[0] === "dev";
422
453
  if (localStudio) {
423
454
  if (state.pinnedVersion !== null && localStudio.version !== state.pinnedVersion) throw new CliError(`Installed ${target.packageName} is ${localStudio.version} but format.config.json pins ${state.pinnedVersion}. Run \`format update\` to bring them in line.`);
424
- return spawnStudio(process.execPath, [localStudio.binPath, ...argv], state.projectDir, keepAliveOnSignal);
455
+ return spawnStudio({
456
+ launch: {
457
+ command: process.execPath,
458
+ args: [localStudio.binPath, ...argv],
459
+ shell: false
460
+ },
461
+ cwd: state.projectDir,
462
+ keepAliveOnSignal
463
+ });
425
464
  }
426
465
  if (!state.pinnedVersion) throw new CliError(`No "version" field in ${state.configFile.filepath} and no local ${target.packageName} install. Run \`format update\` to pin the latest Format release.`);
427
- return spawnStudio("npm", [
428
- "exec",
429
- "-y",
430
- "--fetch-retries=1",
431
- "--fetch-retry-mintimeout=1000",
432
- "--",
433
- `${target.packageName}@${state.pinnedVersion}`,
434
- ...argv
435
- ], state.projectDir, keepAliveOnSignal);
466
+ return spawnStudio({
467
+ launch: npmLaunch([
468
+ "exec",
469
+ "-y",
470
+ "--fetch-retries=1",
471
+ "--fetch-retry-mintimeout=1000",
472
+ "--",
473
+ `${target.packageName}@${state.pinnedVersion}`,
474
+ ...argv
475
+ ]),
476
+ cwd: state.projectDir,
477
+ keepAliveOnSignal
478
+ });
479
+ }
480
+ function npmLaunch(args) {
481
+ if (process.platform !== "win32") return {
482
+ command: "npm",
483
+ args,
484
+ shell: false
485
+ };
486
+ return {
487
+ command: toWindowsCommandLine("npm", args),
488
+ args: [],
489
+ shell: true
490
+ };
436
491
  }
437
- async function spawnStudio(command, args, cwd, keepAliveOnSignal = false) {
492
+ async function spawnStudio(args) {
493
+ const { launch, cwd, keepAliveOnSignal } = args;
438
494
  return new Promise((resolvePromise, rejectPromise) => {
439
- const child = spawn(command, args, {
495
+ const child = spawn(launch.command, launch.args, {
440
496
  cwd,
441
497
  stdio: "inherit",
442
- shell: process.platform === "win32"
498
+ shell: launch.shell
443
499
  });
444
500
  let interrupts = 0;
445
501
  const onSignal = () => {
@@ -764,6 +820,45 @@ async function decideInstall(args) {
764
820
  }));
765
821
  }
766
822
 
823
+ //#endregion
824
+ //#region src/scaffold/agent-instructions.ts
825
+ const AGENT_INSTRUCTIONS_FILE = "AGENTS.md";
826
+ const BLOCK_PATTERN = /^<format\.dev>$[\s\S]*?^<\/format\.dev>$/m;
827
+ async function readAgentInstructionsBlock() {
828
+ const templateFile = join(resolveTemplatePath("shared"), AGENT_INSTRUCTIONS_FILE);
829
+ return (await fs.readFile(templateFile, "utf8")).trim();
830
+ }
831
+ function blankLineBefore(existing) {
832
+ if (existing === "" || existing.endsWith("\n\n")) return "";
833
+ if (existing.endsWith("\n")) return "\n";
834
+ return "\n\n";
835
+ }
836
+ async function addAgentInstructions(projectDir) {
837
+ const block = await readAgentInstructionsBlock();
838
+ const targetName = [AGENT_INSTRUCTIONS_FILE, "CLAUDE.md"].find((name) => existsSync(join(projectDir, name)));
839
+ if (!targetName) {
840
+ await fs.writeFile(join(projectDir, AGENT_INSTRUCTIONS_FILE), `${block}\n`, "utf8");
841
+ return {
842
+ file: AGENT_INSTRUCTIONS_FILE,
843
+ action: "created"
844
+ };
845
+ }
846
+ const targetPath = join(projectDir, targetName);
847
+ const existing = await fs.readFile(targetPath, "utf8");
848
+ if (BLOCK_PATTERN.test(existing)) {
849
+ await fs.writeFile(targetPath, existing.replace(BLOCK_PATTERN, block), "utf8");
850
+ return {
851
+ file: targetName,
852
+ action: "replaced"
853
+ };
854
+ }
855
+ await fs.writeFile(targetPath, `${existing}${blankLineBefore(existing)}${block}\n`, "utf8");
856
+ return {
857
+ file: targetName,
858
+ action: "appended"
859
+ };
860
+ }
861
+
767
862
  //#endregion
768
863
  //#region src/cli/commands/new-document.ts
769
864
  const STUDIO_URL = "http://localhost:1234";
@@ -823,30 +918,32 @@ async function resolveSchema(args) {
823
918
  }
824
919
  function parseDimension(args) {
825
920
  const { flag, value } = args;
826
- const parsed = Number(value);
827
- if (!isValidDimension(parsed)) throw new CliError(`Invalid ${flag}: "${value}". Enter a number of CSS pixels from 1 to 20000.`);
921
+ const parsed = parsePageLength(value);
922
+ if (parsed === void 0) throw new CliError(`Invalid ${flag}: "${value}". ${PAGE_LENGTH_HINT}`);
828
923
  return parsed;
829
924
  }
830
925
  async function promptCustomDimensions() {
831
926
  const dimensionValidator = (value) => {
832
927
  if (!value) return;
833
- return isValidDimension(Number(value)) ? void 0 : "Enter a number of CSS pixels from 1 to 20000.";
928
+ return parsePageLength(value) === void 0 ? PAGE_LENGTH_HINT : void 0;
834
929
  };
930
+ const defaultWidth = String(DEFAULT_PAGE_WIDTH);
931
+ const defaultHeight = String(DEFAULT_PAGE_HEIGHT);
835
932
  const width = requirePrompt(await text({
836
- message: "Width (px)",
837
- defaultValue: "794",
838
- placeholder: "794",
933
+ message: "Width",
934
+ defaultValue: defaultWidth,
935
+ placeholder: defaultWidth,
839
936
  validate: dimensionValidator
840
937
  }));
841
938
  const height = requirePrompt(await text({
842
- message: "Height (px)",
843
- defaultValue: "1123",
844
- placeholder: "1123",
939
+ message: "Height",
940
+ defaultValue: defaultHeight,
941
+ placeholder: defaultHeight,
845
942
  validate: dimensionValidator
846
943
  }));
847
944
  return {
848
- width: Number(width || "794"),
849
- height: Number(height || "1123")
945
+ width: parsePageLength(width || defaultWidth) ?? DEFAULT_PAGE_WIDTH,
946
+ height: parsePageLength(height || defaultHeight) ?? DEFAULT_PAGE_HEIGHT
850
947
  };
851
948
  }
852
949
  async function resolveDimensions(args) {
@@ -1162,7 +1259,7 @@ function packagesForFramework(framework) {
1162
1259
  }
1163
1260
  function formatDependencySpecs(framework, version) {
1164
1261
  const dependencyVersion = formatDependencyVersion(version);
1165
- const packages = packagesForFramework(framework).map((name) => ({
1262
+ const packages = ["@format.dev/cli", ...packagesForFramework(framework)].map((name) => ({
1166
1263
  name,
1167
1264
  version: dependencyVersion,
1168
1265
  dev: !RUNTIME_PACKAGES.includes(name)
@@ -1221,6 +1318,11 @@ async function initCommand(cwd, options) {
1221
1318
  const appended = await updateGitignore(cwd);
1222
1319
  if (appended.length > 0) log.success(`Added to .gitignore: ${pc.dim(appended.join(", "))}`);
1223
1320
  }
1321
+ if (options.agents && await shouldRun("Add Format instructions for AI agents to AGENTS.md?", skipPrompts)) {
1322
+ const { file, action } = await addAgentInstructions(cwd);
1323
+ const verb = action === "created" ? "Created" : action === "appended" ? "Appended to" : "Updated";
1324
+ log.success(`${verb} ${pc.cyan(file)} ${pc.dim("(points agents at node_modules/@format.dev/cli/AGENTS.md)")}`);
1325
+ }
1224
1326
  const addedFormatPackages = await writeDependenciesToManifest({
1225
1327
  projectDir: cwd,
1226
1328
  dependencies: formatDependencySpecs(framework, version)
@@ -1618,6 +1720,10 @@ const STUDIO_COMMANDS = [
1618
1720
  name: "dev",
1619
1721
  description: "Open Studio for this project."
1620
1722
  },
1723
+ {
1724
+ name: "auth",
1725
+ description: "Sign in to Format where your browser cannot reach Studio, such as over SSH or in a cloud agent."
1726
+ },
1621
1727
  {
1622
1728
  name: "compile",
1623
1729
  description: "Compile this project's documents into a renderer."
@@ -1,5 +1,5 @@
1
1
  import { r as detectIndent$1, s as CliError } from "./config-Dq7O4e8N.mjs";
2
- import { a as DEFAULT_STYLING, c as SCHEMA_DEPENDENCIES, d as STYLING_DEPENDENCIES, i as DEFAULT_SCHEMA_KIND, m as STYLING_SUPPORT, r as DEFAULT_PAGE_WIDTH, t as DEFAULT_PAGE_HEIGHT, y as methodsForFramework } from "./shared-CM3vyUlL.mjs";
2
+ import { a as DEFAULT_STYLING, f as STYLING_DEPENDENCIES, h as STYLING_SUPPORT, i as DEFAULT_SCHEMA_KIND, l as SCHEMA_DEPENDENCIES, r as DEFAULT_PAGE_WIDTH, t as DEFAULT_PAGE_HEIGHT, y as methodsForFramework } from "./shared-CIKs-hm2.mjs";
3
3
  import { t as drawRandomName } from "./draw-random-name-Dpt6YmUk.mjs";
4
4
  import { createRequire } from "node:module";
5
5
  import { spawn } from "node:child_process";
@@ -977,6 +977,15 @@ function firstStringField(value) {
977
977
 
978
978
  //#endregion
979
979
  //#region src/scaffold/document/templates/utils.ts
980
+ function jsxDimension(name, value) {
981
+ return typeof value === "number" ? `${name}={${value}}` : `${name}="${value}"`;
982
+ }
983
+ function vueDimension(name, value) {
984
+ return typeof value === "number" ? `:${name}="${value}"` : `${name}="${value}"`;
985
+ }
986
+ function htmlDimension(name, value) {
987
+ return `data-${name}="${typeof value === "number" ? `${value}px` : value}"`;
988
+ }
980
989
  function starterHint(documentName, entryFile) {
981
990
  return `Edit documents/${documentName}/${entryFile} to get started`;
982
991
  }
@@ -1039,8 +1048,8 @@ function buildReactEntry(args) {
1039
1048
 
1040
1049
  export default function ${component}() {
1041
1050
  return (
1042
- <Document title="${titleize(documentName)}">
1043
- <Layout width={${width}} height={${height}}>
1051
+ <Document title="${titleize(documentName)}" lang="en">
1052
+ <Layout ${jsxDimension("width", width)} ${jsxDimension("height", height)}>
1044
1053
  {/* Your content goes here */}
1045
1054
  </Layout>
1046
1055
  </Document>
@@ -1054,21 +1063,25 @@ export default function ${component}() {
1054
1063
  ...application.imports
1055
1064
  ]);
1056
1065
  const field = firstStringField(data);
1066
+ const localType = emitSchema ? "" : `\ntype ${dataType} = ${jsonToTsType(data)}\n`;
1067
+ const declarations = application.declarations.length > 0 ? `\n${application.declarations.join("\n\n")}\n` : "";
1068
+ const titleAttr = field ? `{data.${field}}` : `'${titleize(documentName)}'`;
1069
+ const body = buildBody({
1070
+ application,
1071
+ title: field ? `{data.${field}}` : titleize(documentName),
1072
+ hint: starterHint(documentName, "index.tsx"),
1073
+ classAttr: (cls) => ` className="${cls}"`,
1074
+ classExprAttr: (expr) => ` className={${expr}}`
1075
+ });
1057
1076
  return {
1058
1077
  path: "index.tsx",
1059
1078
  contents: `${head}
1060
- ${emitSchema ? "" : `\ntype ${dataType} = ${jsonToTsType(data)}\n`}${application.declarations.length > 0 ? `\n${application.declarations.join("\n\n")}\n` : ""}
1079
+ ${localType}${declarations}
1061
1080
  export default function ${component}({ data }: RenderProps<${dataType}>) {
1062
1081
  return (
1063
- <Document title=${field ? `{data.${field}}` : `'${titleize(documentName)}'`}>
1064
- <Layout width={${width}} height={${height}}>
1065
- ${indent(buildBody({
1066
- application,
1067
- title: field ? `{data.${field}}` : titleize(documentName),
1068
- hint: starterHint(documentName, "index.tsx"),
1069
- classAttr: (cls) => ` className="${cls}"`,
1070
- classExprAttr: (expr) => ` className={${expr}}`
1071
- }), 4)}
1082
+ <Document title=${titleAttr} lang="en">
1083
+ <Layout ${jsxDimension("width", width)} ${jsxDimension("height", height)}>
1084
+ ${indent(body, 4)}
1072
1085
  </Layout>
1073
1086
  </Document>
1074
1087
  )
@@ -1090,8 +1103,8 @@ ${block(["import { Document, Layout } from '@format.dev/vue'", ...application.im
1090
1103
  <\/script>
1091
1104
 
1092
1105
  <template>
1093
- <Document title="${titleize(documentName)}">
1094
- <Layout :width="${width}" :height="${height}">
1106
+ <Document title="${titleize(documentName)}" lang="en">
1107
+ <Layout ${vueDimension("width", width)} ${vueDimension("height", height)}>
1095
1108
  <!-- Your content goes here -->
1096
1109
  </Layout>
1097
1110
  </Document>
@@ -1104,24 +1117,28 @@ ${trailingStyles}`
1104
1117
  ...application.imports
1105
1118
  ]);
1106
1119
  const field = firstStringField(data);
1120
+ const localType = emitSchema ? "" : `\ntype ${dataType} = ${jsonToTsType(data)}\n`;
1121
+ const declarations = application.declarations.length > 0 ? `\n${application.declarations.join("\n\n")}\n` : "";
1122
+ const titleAttr = field ? `:title="props.data.${field}"` : `title="${titleize(documentName)}"`;
1123
+ const body = buildBody({
1124
+ application,
1125
+ title: field ? `{{ props.data.${field} }}` : titleize(documentName),
1126
+ hint: starterHint(documentName, "index.vue"),
1127
+ classAttr: (cls) => ` class="${cls}"`,
1128
+ classExprAttr: (expr) => ` :class="${expr}"`
1129
+ });
1107
1130
  return {
1108
1131
  path: "index.vue",
1109
1132
  contents: `<script setup lang="ts">
1110
1133
  ${scriptImports}
1111
- ${emitSchema ? "" : `\ntype ${dataType} = ${jsonToTsType(data)}\n`}${application.declarations.length > 0 ? `\n${application.declarations.join("\n\n")}\n` : ""}
1134
+ ${localType}${declarations}
1112
1135
  const props = defineProps<RenderProps<${dataType}>>()
1113
1136
  <\/script>
1114
1137
 
1115
1138
  <template>
1116
- <Document ${field ? `:title="props.data.${field}"` : `title="${titleize(documentName)}"`}>
1117
- <Layout :width="${width}" :height="${height}">
1118
- ${indent(buildBody({
1119
- application,
1120
- title: field ? `{{ props.data.${field} }}` : titleize(documentName),
1121
- hint: starterHint(documentName, "index.vue"),
1122
- classAttr: (cls) => ` class="${cls}"`,
1123
- classExprAttr: (expr) => ` :class="${expr}"`
1124
- }), 3)}
1139
+ <Document ${titleAttr} lang="en">
1140
+ <Layout ${vueDimension("width", width)} ${vueDimension("height", height)}>
1141
+ ${indent(body, 3)}
1125
1142
  </Layout>
1126
1143
  </Document>
1127
1144
  </template>
@@ -1135,14 +1152,15 @@ function buildHtmlEntry(args) {
1135
1152
  const { documentName, application, width, height, data, empty } = args;
1136
1153
  const field = firstStringField(data);
1137
1154
  const title = empty || !field ? titleize(documentName) : `<%= data.${field} %>`;
1138
- const html = `<template data-type="document" data-title="${title}">
1139
- <template data-type="layout" data-width="${width}px" data-height="${height}px">
1140
- ${indent(empty ? "<!-- Your content goes here -->" : buildBody({
1155
+ const body = empty ? "<!-- Your content goes here -->" : buildBody({
1141
1156
  application,
1142
1157
  title,
1143
1158
  hint: starterHint(documentName, "index.html"),
1144
1159
  classAttr: (cls) => ` class="${cls}"`
1145
- }), 2)}
1160
+ });
1161
+ const html = `<template data-type="document" data-title="${title}" data-lang="en">
1162
+ <template data-type="layout" ${htmlDimension("width", width)} ${htmlDimension("height", height)}>
1163
+ ${indent(body, 2)}
1146
1164
  </template>
1147
1165
  </template>
1148
1166
  `;
@@ -1,2 +1,2 @@
1
- import { C as methodsForFramework, S as isValidDimension, _ as SUPPORTED_FRAMEWORKS, a as DEFAULT_STYLING, b as isSchemaKind, c as PAGE_SIZES, d as SCHEMA_KINDS, f as SCHEMA_LABELS, g as STYLING_SUPPORT, h as STYLING_METHODS, i as DEFAULT_SCHEMA_KIND, l as PageSize, m as STYLING_LABELS, n as DEFAULT_PAGE_SIZE_ID, o as Framework, p as STYLING_DEPENDENCIES, r as DEFAULT_PAGE_WIDTH, s as MAX_PAGE_DIMENSION, t as DEFAULT_PAGE_HEIGHT, u as SCHEMA_DEPENDENCIES, v as SchemaKind, x as isStylingMethod, y as StylingMethod } from "./shared-BD62UD5L.mjs";
2
- export { DEFAULT_PAGE_HEIGHT, DEFAULT_PAGE_SIZE_ID, DEFAULT_PAGE_WIDTH, DEFAULT_SCHEMA_KIND, DEFAULT_STYLING, Framework, MAX_PAGE_DIMENSION, PAGE_SIZES, PageSize, SCHEMA_DEPENDENCIES, SCHEMA_KINDS, SCHEMA_LABELS, STYLING_DEPENDENCIES, STYLING_LABELS, STYLING_METHODS, STYLING_SUPPORT, SUPPORTED_FRAMEWORKS, SchemaKind, StylingMethod, isSchemaKind, isStylingMethod, isValidDimension, methodsForFramework };
1
+ import { C as isStylingMethod, E as parsePageLength, S as isSchemaKind, T as pageLengthPx, _ as STYLING_METHODS, a as DEFAULT_STYLING, b as SchemaKind, c as PAGE_LENGTH_HINT, d as PageSize, f as SCHEMA_DEPENDENCIES, g as STYLING_LABELS, h as STYLING_DEPENDENCIES, i as DEFAULT_SCHEMA_KIND, l as PAGE_SIZES, m as SCHEMA_LABELS, n as DEFAULT_PAGE_SIZE_ID, o as Framework, p as SCHEMA_KINDS, r as DEFAULT_PAGE_WIDTH, s as MAX_PAGE_DIMENSION, t as DEFAULT_PAGE_HEIGHT, u as PageLength, v as STYLING_SUPPORT, w as methodsForFramework, x as StylingMethod, y as SUPPORTED_FRAMEWORKS } from "./shared-DcHDbItp.mjs";
2
+ export { DEFAULT_PAGE_HEIGHT, DEFAULT_PAGE_SIZE_ID, DEFAULT_PAGE_WIDTH, DEFAULT_SCHEMA_KIND, DEFAULT_STYLING, Framework, MAX_PAGE_DIMENSION, PAGE_LENGTH_HINT, PAGE_SIZES, PageLength, PageSize, SCHEMA_DEPENDENCIES, SCHEMA_KINDS, SCHEMA_LABELS, STYLING_DEPENDENCIES, STYLING_LABELS, STYLING_METHODS, STYLING_SUPPORT, SUPPORTED_FRAMEWORKS, SchemaKind, StylingMethod, isSchemaKind, isStylingMethod, methodsForFramework, pageLengthPx, parsePageLength };
@@ -1,3 +1,3 @@
1
- import { _ as isStylingMethod, a as DEFAULT_STYLING, c as SCHEMA_DEPENDENCIES, d as STYLING_DEPENDENCIES, f as STYLING_LABELS, g as isSchemaKind, h as SUPPORTED_FRAMEWORKS, i as DEFAULT_SCHEMA_KIND, l as SCHEMA_KINDS, m as STYLING_SUPPORT, n as DEFAULT_PAGE_SIZE_ID, o as MAX_PAGE_DIMENSION, p as STYLING_METHODS, r as DEFAULT_PAGE_WIDTH, s as PAGE_SIZES, t as DEFAULT_PAGE_HEIGHT, u as SCHEMA_LABELS, v as isValidDimension, y as methodsForFramework } from "./shared-CM3vyUlL.mjs";
1
+ import { _ as isSchemaKind, a as DEFAULT_STYLING, b as pageLengthPx, c as PAGE_SIZES, d as SCHEMA_LABELS, f as STYLING_DEPENDENCIES, g as SUPPORTED_FRAMEWORKS, h as STYLING_SUPPORT, i as DEFAULT_SCHEMA_KIND, l as SCHEMA_DEPENDENCIES, m as STYLING_METHODS, n as DEFAULT_PAGE_SIZE_ID, o as MAX_PAGE_DIMENSION, p as STYLING_LABELS, r as DEFAULT_PAGE_WIDTH, s as PAGE_LENGTH_HINT, t as DEFAULT_PAGE_HEIGHT, u as SCHEMA_KINDS, v as isStylingMethod, x as parsePageLength, y as methodsForFramework } from "./shared-CIKs-hm2.mjs";
2
2
 
3
- export { DEFAULT_PAGE_HEIGHT, DEFAULT_PAGE_SIZE_ID, DEFAULT_PAGE_WIDTH, DEFAULT_SCHEMA_KIND, DEFAULT_STYLING, MAX_PAGE_DIMENSION, PAGE_SIZES, SCHEMA_DEPENDENCIES, SCHEMA_KINDS, SCHEMA_LABELS, STYLING_DEPENDENCIES, STYLING_LABELS, STYLING_METHODS, STYLING_SUPPORT, SUPPORTED_FRAMEWORKS, isSchemaKind, isStylingMethod, isValidDimension, methodsForFramework };
3
+ export { DEFAULT_PAGE_HEIGHT, DEFAULT_PAGE_SIZE_ID, DEFAULT_PAGE_WIDTH, DEFAULT_SCHEMA_KIND, DEFAULT_STYLING, MAX_PAGE_DIMENSION, PAGE_LENGTH_HINT, PAGE_SIZES, SCHEMA_DEPENDENCIES, SCHEMA_KINDS, SCHEMA_LABELS, STYLING_DEPENDENCIES, STYLING_LABELS, STYLING_METHODS, STYLING_SUPPORT, SUPPORTED_FRAMEWORKS, isSchemaKind, isStylingMethod, methodsForFramework, pageLengthPx, parsePageLength };
@@ -1,5 +1,5 @@
1
1
  import { t as drawRandomName } from "./draw-random-name-BzvSSVqO.mjs";
2
- import { C as methodsForFramework, o as Framework, v as SchemaKind, y as StylingMethod } from "./shared-BD62UD5L.mjs";
2
+ import { b as SchemaKind, o as Framework, u as PageLength, w as methodsForFramework, x as StylingMethod } from "./shared-DcHDbItp.mjs";
3
3
 
4
4
  //#region src/scaffold/document/types.d.ts
5
5
  interface ScaffoldProjectConfig {
@@ -36,8 +36,8 @@ interface CreateDocumentArgs {
36
36
  template?: TemplateId;
37
37
  emitSchema?: boolean;
38
38
  schemaKind?: SchemaKind;
39
- width?: number;
40
- height?: number;
39
+ width?: PageLength;
40
+ height?: PageLength;
41
41
  data?: unknown;
42
42
  empty?: boolean;
43
43
  }
package/dist/scaffold.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import { s as CliError } from "./config-Dq7O4e8N.mjs";
2
- import { _ as RESERVED_WORDS, a as DOCUMENTS_DIR_NAME, b as DEFAULT_TEMPLATE, c as getDocumentsDir, d as resolveStyling, f as STYLING_STRATEGIES, g as validateDocumentName, h as suggestAvailableName, i as generateRandomName, l as readExistingDocumentNames, m as RESERVED_DOCUMENT_NAMES, n as maybeSetupProject, o as buildDocumentPlan, p as readProjectDependencies, s as createDocument, t as maybeInstallDependencies, u as writeDocument, v as buildDocumentExportMap, x as EMPTY_STYLESHEET_COMMENT, y as getDocumentExportName } from "./install-nInHtWQW.mjs";
3
- import { y as methodsForFramework } from "./shared-CM3vyUlL.mjs";
2
+ import { _ as RESERVED_WORDS, a as DOCUMENTS_DIR_NAME, b as DEFAULT_TEMPLATE, c as getDocumentsDir, d as resolveStyling, f as STYLING_STRATEGIES, g as validateDocumentName, h as suggestAvailableName, i as generateRandomName, l as readExistingDocumentNames, m as RESERVED_DOCUMENT_NAMES, n as maybeSetupProject, o as buildDocumentPlan, p as readProjectDependencies, s as createDocument, t as maybeInstallDependencies, u as writeDocument, v as buildDocumentExportMap, x as EMPTY_STYLESHEET_COMMENT, y as getDocumentExportName } from "./install-DkRYx34A.mjs";
3
+ import { y as methodsForFramework } from "./shared-CIKs-hm2.mjs";
4
4
  import { t as drawRandomName } from "./draw-random-name-Dpt6YmUk.mjs";
5
5
 
6
6
  export { CliError, DEFAULT_TEMPLATE, DOCUMENTS_DIR_NAME, EMPTY_STYLESHEET_COMMENT, RESERVED_DOCUMENT_NAMES, RESERVED_WORDS, STYLING_STRATEGIES, buildDocumentExportMap, buildDocumentPlan, createDocument, drawRandomName, generateRandomName, getDocumentExportName, getDocumentsDir, maybeInstallDependencies, maybeSetupProject, methodsForFramework, readExistingDocumentNames, readProjectDependencies, resolveStyling, suggestAvailableName, validateDocumentName, writeDocument };
@@ -90,29 +90,29 @@ const PAGE_SIZES = [
90
90
  id: "a3",
91
91
  name: "A3",
92
92
  label: "297 × 420 mm",
93
- width: 1122.52,
94
- height: 1587.4
93
+ width: "297mm",
94
+ height: "420mm"
95
95
  },
96
96
  {
97
97
  id: "a4",
98
98
  name: "A4",
99
99
  label: "210 × 297 mm",
100
- width: 793.71,
101
- height: 1122.52
100
+ width: "210mm",
101
+ height: "297mm"
102
102
  },
103
103
  {
104
104
  id: "a5",
105
105
  name: "A5",
106
106
  label: "148 × 210 mm",
107
- width: 559.37,
108
- height: 793.71
107
+ width: "148mm",
108
+ height: "210mm"
109
109
  },
110
110
  {
111
111
  id: "letter",
112
112
  name: "US Letter",
113
113
  label: "8.5 × 11 in",
114
- width: 816,
115
- height: 1056
114
+ width: "8.5in",
115
+ height: "11in"
116
116
  },
117
117
  {
118
118
  id: "slide-16-9",
@@ -135,9 +135,30 @@ if (!defaultPageSize) throw new Error(`DEFAULT_PAGE_SIZE_ID "${DEFAULT_PAGE_SIZE
135
135
  const DEFAULT_PAGE_WIDTH = defaultPageSize.width;
136
136
  const DEFAULT_PAGE_HEIGHT = defaultPageSize.height;
137
137
  const MAX_PAGE_DIMENSION = 2e4;
138
- function isValidDimension(value) {
139
- return Number.isFinite(value) && value > 0 && value <= MAX_PAGE_DIMENSION;
138
+ const PX_PER_UNIT = {
139
+ mm: 96 / 25.4,
140
+ cm: 96 / 2.54,
141
+ in: 96,
142
+ pt: 96 / 72,
143
+ pc: 16,
144
+ px: 1
145
+ };
146
+ const PAGE_LENGTH_HINT = `Enter a length such as 210mm or 8.5in, or a number of CSS pixels. A page can be up to ${MAX_PAGE_DIMENSION} pixels wide or tall.`;
147
+ function pageLengthPx(length) {
148
+ if (typeof length === "number") return length;
149
+ const unit = length.slice(-2);
150
+ return Number(length.slice(0, -2)) * PX_PER_UNIT[unit];
151
+ }
152
+ const PAGE_LENGTH = /^(\d+(?:\.\d*)?|\.\d+)(mm|cm|in|pt|pc|px)?$/i;
153
+ function parsePageLength(text) {
154
+ const match = PAGE_LENGTH.exec(text.trim());
155
+ if (!match) return;
156
+ const value = Number(match[1]);
157
+ const unit = match[2]?.toLowerCase();
158
+ const length = unit ? `${value}${unit}` : value;
159
+ const px = pageLengthPx(length);
160
+ return PAGE_LENGTH.test(String(length)) && px > 0 && px <= MAX_PAGE_DIMENSION ? length : void 0;
140
161
  }
141
162
 
142
163
  //#endregion
143
- export { isStylingMethod as _, DEFAULT_STYLING as a, SCHEMA_DEPENDENCIES as c, STYLING_DEPENDENCIES as d, STYLING_LABELS as f, isSchemaKind as g, SUPPORTED_FRAMEWORKS as h, DEFAULT_SCHEMA_KIND as i, SCHEMA_KINDS as l, STYLING_SUPPORT as m, DEFAULT_PAGE_SIZE_ID as n, MAX_PAGE_DIMENSION as o, STYLING_METHODS as p, DEFAULT_PAGE_WIDTH as r, PAGE_SIZES as s, DEFAULT_PAGE_HEIGHT as t, SCHEMA_LABELS as u, isValidDimension as v, methodsForFramework as y };
164
+ export { isSchemaKind as _, DEFAULT_STYLING as a, pageLengthPx as b, PAGE_SIZES as c, SCHEMA_LABELS as d, STYLING_DEPENDENCIES as f, SUPPORTED_FRAMEWORKS as g, STYLING_SUPPORT as h, DEFAULT_SCHEMA_KIND as i, SCHEMA_DEPENDENCIES as l, STYLING_METHODS as m, DEFAULT_PAGE_SIZE_ID as n, MAX_PAGE_DIMENSION as o, STYLING_LABELS as p, DEFAULT_PAGE_WIDTH as r, PAGE_LENGTH_HINT as s, DEFAULT_PAGE_HEIGHT as t, SCHEMA_KINDS as u, isStylingMethod as v, parsePageLength as x, methodsForFramework as y };
@@ -15,18 +15,21 @@ declare const SCHEMA_KINDS: SchemaKind[];
15
15
  declare const SCHEMA_LABELS: Record<SchemaKind, string>;
16
16
  declare const SCHEMA_DEPENDENCIES: Record<SchemaKind, string>;
17
17
  declare function isSchemaKind(value: string): value is SchemaKind;
18
+ type PageLength = number | `${number}${'mm' | 'cm' | 'in' | 'pt' | 'pc' | 'px'}`;
18
19
  interface PageSize {
19
20
  id: string;
20
21
  name: string;
21
22
  label: string;
22
- width: number;
23
- height: number;
23
+ width: PageLength;
24
+ height: PageLength;
24
25
  }
25
26
  declare const PAGE_SIZES: PageSize[];
26
27
  declare const DEFAULT_PAGE_SIZE_ID = "a4";
27
- declare const DEFAULT_PAGE_WIDTH: number;
28
- declare const DEFAULT_PAGE_HEIGHT: number;
28
+ declare const DEFAULT_PAGE_WIDTH: PageLength;
29
+ declare const DEFAULT_PAGE_HEIGHT: PageLength;
29
30
  declare const MAX_PAGE_DIMENSION = 20000;
30
- declare function isValidDimension(value: number): boolean;
31
+ declare const PAGE_LENGTH_HINT = "Enter a length such as 210mm or 8.5in, or a number of CSS pixels. A page can be up to 20000 pixels wide or tall.";
32
+ declare function pageLengthPx(length: PageLength): number;
33
+ declare function parsePageLength(text: string): PageLength | undefined;
31
34
  //#endregion
32
- export { methodsForFramework as C, isValidDimension as S, SUPPORTED_FRAMEWORKS as _, DEFAULT_STYLING as a, isSchemaKind as b, PAGE_SIZES as c, SCHEMA_KINDS as d, SCHEMA_LABELS as f, STYLING_SUPPORT as g, STYLING_METHODS as h, DEFAULT_SCHEMA_KIND as i, PageSize as l, STYLING_LABELS as m, DEFAULT_PAGE_SIZE_ID as n, Framework as o, STYLING_DEPENDENCIES as p, DEFAULT_PAGE_WIDTH as r, MAX_PAGE_DIMENSION as s, DEFAULT_PAGE_HEIGHT as t, SCHEMA_DEPENDENCIES as u, SchemaKind as v, isStylingMethod as x, StylingMethod as y };
35
+ export { isStylingMethod as C, parsePageLength as E, isSchemaKind as S, pageLengthPx as T, STYLING_METHODS as _, DEFAULT_STYLING as a, SchemaKind as b, PAGE_LENGTH_HINT as c, PageSize as d, SCHEMA_DEPENDENCIES as f, STYLING_LABELS as g, STYLING_DEPENDENCIES as h, DEFAULT_SCHEMA_KIND as i, PAGE_SIZES as l, SCHEMA_LABELS as m, DEFAULT_PAGE_SIZE_ID as n, Framework as o, SCHEMA_KINDS as p, DEFAULT_PAGE_WIDTH as r, MAX_PAGE_DIMENSION as s, DEFAULT_PAGE_HEIGHT as t, PageLength as u, STYLING_SUPPORT as v, methodsForFramework as w, StylingMethod as x, SUPPORTED_FRAMEWORKS as y };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@format.dev/cli",
3
- "version": "0.2.0",
3
+ "version": "0.4.0",
4
4
  "license": "MIT",
5
5
  "description": "The Format CLI: run Studio, compile documents, and keep Format packages in lockstep",
6
6
  "author": "the format.dev developers",
@@ -44,6 +44,7 @@
44
44
  "bin",
45
45
  "dist",
46
46
  "templates",
47
+ "AGENTS.md",
47
48
  "tsconfig.recommended.json",
48
49
  "env.d.ts",
49
50
  "LICENSE"
@@ -72,8 +73,8 @@
72
73
  "verdaccio": "^6.8.0",
73
74
  "vitest": "^4.0.18",
74
75
  "vue": "^3.5.25",
75
- "@format.dev/react": "0.2.0",
76
- "@format.dev/vue": "0.2.0"
76
+ "@format.dev/vue": "0.4.0",
77
+ "@format.dev/react": "0.4.0"
77
78
  },
78
79
  "engines": {
79
80
  "node": ">=22.12.0"
@@ -1,6 +1,6 @@
1
- <template data-type="document" data-title="Welcome to Format">
2
- <template data-type="layout" id="page" data-width="793.71px" data-height="1122.52px">
3
- <header class="header">
1
+ <template data-type="document" data-title="Welcome to Format" data-lang="en">
2
+ <template data-type="layout" id="page" data-width="210mm" data-height="297mm">
3
+ <header class="header" aria-hidden="true">
4
4
  <small class="header-title">Format Studio &ndash; Welcome document</small>
5
5
  </header>
6
6
  <main class="content">
@@ -15,7 +15,7 @@
15
15
  </template>
16
16
  </main>
17
17
  <template data-type="footnotes"></template>
18
- <footer class="footer">
18
+ <footer class="footer" aria-hidden="true">
19
19
  <div class="footer-stamp">
20
20
  Created with
21
21
  <a href="https://format.dev">
@@ -9,13 +9,13 @@ import { ClosePage } from './pages/Close/ClosePage'
9
9
  import './styles.css'
10
10
 
11
11
  const a4 = {
12
- width: 793.71,
13
- height: 1122.52
14
- }
12
+ width: '210mm',
13
+ height: '297mm'
14
+ } as const
15
15
 
16
16
  export default function Welcome({ data }: { data: Data }) {
17
17
  return (
18
- <Document title='Welcome to Format'>
18
+ <Document title='Welcome to Format' lang='en'>
19
19
  <Layout id='page' {...a4}>
20
20
  <Header />
21
21
  <main className='content'>
@@ -37,13 +37,13 @@ export default function Welcome({ data }: { data: Data }) {
37
37
  }
38
38
 
39
39
  const Header = () => (
40
- <header className='header'>
40
+ <header className='header' aria-hidden='true'>
41
41
  <small className='header-title'>Format Studio &ndash; Welcome document</small>
42
42
  </header>
43
43
  )
44
44
 
45
45
  const Footer = () => (
46
- <footer className='footer'>
46
+ <footer className='footer' aria-hidden='true'>
47
47
  <div className='footer-stamp'>
48
48
  Created with
49
49
  <a href='https://format.dev'>
@@ -75,7 +75,7 @@ export function FeatureShowcasePage() {
75
75
 
76
76
  <Flow splitGranularity='word'>
77
77
  <div className='feature-prose'>
78
- <Fleuron className='fleuron' width={10} height={10} />
78
+ <Fleuron className='fleuron' width={10} height={10} aria-hidden='true' />
79
79
  <p>
80
80
  In the early 1990s, digital documents were strangely unstable
81
81
  <Footnote>Format lifts this note to the foot of the page it lands on, and numbers it for you.</Footnote>.
@@ -115,7 +115,7 @@ export function FeatureShowcasePage() {
115
115
  signing, and completion. Even if the content could still change later, the format signaled intent: this is
116
116
  the document, not a draft.
117
117
  </p>
118
- <Fleuron className='fleuron' width={10} height={10} />
118
+ <Fleuron className='fleuron' width={10} height={10} aria-hidden='true' />
119
119
  </div>
120
120
  <div className='prose-learn-more'>
121
121
  <p>Learn more about how to split content across pages and how to work with footnotes.</p>
@@ -0,0 +1,9 @@
1
+ <format.dev>
2
+ This project builds PDFs with Format. Before working on anything under `documents/`, read the Format instructions that ship with the installed version:
3
+
4
+ `node_modules/@format.dev/cli/AGENTS.md`
5
+
6
+ They cover the document model, the Studio workflow, the sign-in and API key steps, and the CLI. Don't rely on training data, refer to the latest docs.
7
+
8
+ In a cloud sandbox, over SSH, or in a container, sign in with `npx format auth start` and `npx format auth complete` before starting Studio.
9
+ </format.dev>
@@ -13,9 +13,9 @@ const props = defineProps<RenderProps<Data>>()
13
13
  </script>
14
14
 
15
15
  <template>
16
- <Document title='Welcome to Format'>
17
- <Layout id='page' :width="793.71" :height="1122.52">
18
- <header class='header'>
16
+ <Document title='Welcome to Format' lang='en'>
17
+ <Layout id='page' width="210mm" height="297mm">
18
+ <header class='header' aria-hidden='true'>
19
19
  <small class='header-title'>Format Studio &ndash; Welcome document</small>
20
20
  </header>
21
21
  <main class='content'>
@@ -30,7 +30,7 @@ const props = defineProps<RenderProps<Data>>()
30
30
  </Flow>
31
31
  </main>
32
32
  <Footnotes />
33
- <footer class='footer'>
33
+ <footer class='footer' aria-hidden='true'>
34
34
  <div class='footer-stamp'>
35
35
  Created with
36
36
  <a href='https://format.dev'>