frameboard 0.16.0 → 0.17.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.
Files changed (81) hide show
  1. package/dist/cli.js +76 -22
  2. package/dist/client/assets/index-LnvyTC8J.js +110 -0
  3. package/dist/client/index.html +1 -1
  4. package/package.json +4 -4
  5. package/dist/client/assets/index-Dg25rx_8.js +0 -110
  6. package/dist/faces/geist/files/geist-cyrillic-ext-wght-italic.woff2 +0 -0
  7. package/dist/faces/geist/files/geist-cyrillic-wght-italic.woff2 +0 -0
  8. package/dist/faces/geist/files/geist-latin-ext-wght-italic.woff2 +0 -0
  9. package/dist/faces/geist/files/geist-latin-wght-italic.woff2 +0 -0
  10. package/dist/faces/geist/files/geist-vietnamese-wght-italic.woff2 +0 -0
  11. package/dist/faces/geist-mono/files/geist-mono-cyrillic-ext-wght-italic.woff2 +0 -0
  12. package/dist/faces/geist-mono/files/geist-mono-cyrillic-wght-italic.woff2 +0 -0
  13. package/dist/faces/geist-mono/files/geist-mono-latin-ext-wght-italic.woff2 +0 -0
  14. package/dist/faces/geist-mono/files/geist-mono-latin-wght-italic.woff2 +0 -0
  15. package/dist/faces/geist-mono/files/geist-mono-symbols2-wght-italic.woff2 +0 -0
  16. package/dist/faces/geist-mono/files/geist-mono-vietnamese-wght-italic.woff2 +0 -0
  17. package/dist/faces/inter/files/inter-cyrillic-ext-opsz-italic.woff2 +0 -0
  18. package/dist/faces/inter/files/inter-cyrillic-ext-opsz-normal.woff2 +0 -0
  19. package/dist/faces/inter/files/inter-cyrillic-ext-standard-italic.woff2 +0 -0
  20. package/dist/faces/inter/files/inter-cyrillic-ext-standard-normal.woff2 +0 -0
  21. package/dist/faces/inter/files/inter-cyrillic-ext-wght-italic.woff2 +0 -0
  22. package/dist/faces/inter/files/inter-cyrillic-opsz-italic.woff2 +0 -0
  23. package/dist/faces/inter/files/inter-cyrillic-opsz-normal.woff2 +0 -0
  24. package/dist/faces/inter/files/inter-cyrillic-standard-italic.woff2 +0 -0
  25. package/dist/faces/inter/files/inter-cyrillic-standard-normal.woff2 +0 -0
  26. package/dist/faces/inter/files/inter-cyrillic-wght-italic.woff2 +0 -0
  27. package/dist/faces/inter/files/inter-greek-ext-opsz-italic.woff2 +0 -0
  28. package/dist/faces/inter/files/inter-greek-ext-opsz-normal.woff2 +0 -0
  29. package/dist/faces/inter/files/inter-greek-ext-standard-italic.woff2 +0 -0
  30. package/dist/faces/inter/files/inter-greek-ext-standard-normal.woff2 +0 -0
  31. package/dist/faces/inter/files/inter-greek-ext-wght-italic.woff2 +0 -0
  32. package/dist/faces/inter/files/inter-greek-opsz-italic.woff2 +0 -0
  33. package/dist/faces/inter/files/inter-greek-opsz-normal.woff2 +0 -0
  34. package/dist/faces/inter/files/inter-greek-standard-italic.woff2 +0 -0
  35. package/dist/faces/inter/files/inter-greek-standard-normal.woff2 +0 -0
  36. package/dist/faces/inter/files/inter-greek-wght-italic.woff2 +0 -0
  37. package/dist/faces/inter/files/inter-latin-ext-opsz-italic.woff2 +0 -0
  38. package/dist/faces/inter/files/inter-latin-ext-opsz-normal.woff2 +0 -0
  39. package/dist/faces/inter/files/inter-latin-ext-standard-italic.woff2 +0 -0
  40. package/dist/faces/inter/files/inter-latin-ext-standard-normal.woff2 +0 -0
  41. package/dist/faces/inter/files/inter-latin-ext-wght-italic.woff2 +0 -0
  42. package/dist/faces/inter/files/inter-latin-opsz-italic.woff2 +0 -0
  43. package/dist/faces/inter/files/inter-latin-opsz-normal.woff2 +0 -0
  44. package/dist/faces/inter/files/inter-latin-standard-italic.woff2 +0 -0
  45. package/dist/faces/inter/files/inter-latin-standard-normal.woff2 +0 -0
  46. package/dist/faces/inter/files/inter-latin-wght-italic.woff2 +0 -0
  47. package/dist/faces/inter/files/inter-vietnamese-opsz-italic.woff2 +0 -0
  48. package/dist/faces/inter/files/inter-vietnamese-opsz-normal.woff2 +0 -0
  49. package/dist/faces/inter/files/inter-vietnamese-standard-italic.woff2 +0 -0
  50. package/dist/faces/inter/files/inter-vietnamese-standard-normal.woff2 +0 -0
  51. package/dist/faces/inter/files/inter-vietnamese-wght-italic.woff2 +0 -0
  52. package/dist/faces/source-serif-4/files/source-serif-4-cyrillic-ext-opsz-italic.woff2 +0 -0
  53. package/dist/faces/source-serif-4/files/source-serif-4-cyrillic-ext-opsz-normal.woff2 +0 -0
  54. package/dist/faces/source-serif-4/files/source-serif-4-cyrillic-ext-standard-italic.woff2 +0 -0
  55. package/dist/faces/source-serif-4/files/source-serif-4-cyrillic-ext-standard-normal.woff2 +0 -0
  56. package/dist/faces/source-serif-4/files/source-serif-4-cyrillic-ext-wght-italic.woff2 +0 -0
  57. package/dist/faces/source-serif-4/files/source-serif-4-cyrillic-opsz-italic.woff2 +0 -0
  58. package/dist/faces/source-serif-4/files/source-serif-4-cyrillic-opsz-normal.woff2 +0 -0
  59. package/dist/faces/source-serif-4/files/source-serif-4-cyrillic-standard-italic.woff2 +0 -0
  60. package/dist/faces/source-serif-4/files/source-serif-4-cyrillic-standard-normal.woff2 +0 -0
  61. package/dist/faces/source-serif-4/files/source-serif-4-cyrillic-wght-italic.woff2 +0 -0
  62. package/dist/faces/source-serif-4/files/source-serif-4-greek-opsz-italic.woff2 +0 -0
  63. package/dist/faces/source-serif-4/files/source-serif-4-greek-opsz-normal.woff2 +0 -0
  64. package/dist/faces/source-serif-4/files/source-serif-4-greek-standard-italic.woff2 +0 -0
  65. package/dist/faces/source-serif-4/files/source-serif-4-greek-standard-normal.woff2 +0 -0
  66. package/dist/faces/source-serif-4/files/source-serif-4-greek-wght-italic.woff2 +0 -0
  67. package/dist/faces/source-serif-4/files/source-serif-4-latin-ext-opsz-italic.woff2 +0 -0
  68. package/dist/faces/source-serif-4/files/source-serif-4-latin-ext-opsz-normal.woff2 +0 -0
  69. package/dist/faces/source-serif-4/files/source-serif-4-latin-ext-standard-italic.woff2 +0 -0
  70. package/dist/faces/source-serif-4/files/source-serif-4-latin-ext-standard-normal.woff2 +0 -0
  71. package/dist/faces/source-serif-4/files/source-serif-4-latin-ext-wght-italic.woff2 +0 -0
  72. package/dist/faces/source-serif-4/files/source-serif-4-latin-opsz-italic.woff2 +0 -0
  73. package/dist/faces/source-serif-4/files/source-serif-4-latin-opsz-normal.woff2 +0 -0
  74. package/dist/faces/source-serif-4/files/source-serif-4-latin-standard-italic.woff2 +0 -0
  75. package/dist/faces/source-serif-4/files/source-serif-4-latin-standard-normal.woff2 +0 -0
  76. package/dist/faces/source-serif-4/files/source-serif-4-latin-wght-italic.woff2 +0 -0
  77. package/dist/faces/source-serif-4/files/source-serif-4-vietnamese-opsz-italic.woff2 +0 -0
  78. package/dist/faces/source-serif-4/files/source-serif-4-vietnamese-opsz-normal.woff2 +0 -0
  79. package/dist/faces/source-serif-4/files/source-serif-4-vietnamese-standard-italic.woff2 +0 -0
  80. package/dist/faces/source-serif-4/files/source-serif-4-vietnamese-standard-normal.woff2 +0 -0
  81. package/dist/faces/source-serif-4/files/source-serif-4-vietnamese-wght-italic.woff2 +0 -0
package/dist/cli.js CHANGED
@@ -4,7 +4,7 @@ import childProcess, { execFile, spawn } from "node:child_process";
4
4
  import { EventEmitter, once } from "node:events";
5
5
  import * as sp from "node:path";
6
6
  import path, { basename, dirname, extname, isAbsolute, join, relative, resolve, sep } from "node:path";
7
- import fs, { copyFileSync, createReadStream, existsSync, mkdirSync, readFileSync, readdirSync, realpathSync, renameSync, rmSync, statSync, watch, writeFileSync } from "node:fs";
7
+ import fs, { copyFileSync, createReadStream, existsSync, mkdirSync, readFileSync, realpathSync, renameSync, rmSync, statSync, watch, writeFileSync } from "node:fs";
8
8
  import process$1, { versions } from "node:process";
9
9
  import { isDeepStrictEqual, promisify, stripVTControlCharacters } from "node:util";
10
10
  import { constants, copyFile, cp, link, lstat, mkdir, open, readFile, readdir, readlink, realpath, rename, rm, stat, writeFile } from "node:fs/promises";
@@ -9415,7 +9415,7 @@ async function isDirectory(path) {
9415
9415
  }
9416
9416
  }
9417
9417
  // package.json
9418
- var version$1 = "0.16.0";
9418
+ var version$1 = "0.17.0";
9419
9419
  var dependencies = { "playwright-core": "1.64.1" };
9420
9420
  // src/shared/version.ts
9421
9421
  const version = version$1;
@@ -28911,12 +28911,29 @@ function refuse$1(reason, detail) {
28911
28911
  detail
28912
28912
  };
28913
28913
  }
28914
+ function checkValue(value) {
28915
+ return value.length > MAX_VALUE_LENGTH ? refuse$1("invalid-edit", `the value runs past ${MAX_VALUE_LENGTH} characters`) : void 0;
28916
+ }
28917
+ function checkDeclaration({ property, value }) {
28918
+ const invalid = checkValue(value);
28919
+ if (invalid) return invalid;
28920
+ if (!PROPERTY_NAME.test(property)) return refuse$1("invalid-edit", `${property} is not a CSS property name`);
28921
+ if (DECLARATION_BREAK.test(value)) return refuse$1("invalid-edit", `${property} takes one value, with no ; { } < > or line break`);
28922
+ }
28914
28923
  function checkChange(change) {
28915
- if (change.value.length > MAX_VALUE_LENGTH) return refuse$1("invalid-edit", `the value runs past ${MAX_VALUE_LENGTH} characters`);
28916
- if (change.kind === "style") {
28917
- if (!PROPERTY_NAME.test(change.property)) return refuse$1("invalid-edit", `${change.property} is not a CSS property name`);
28918
- if (DECLARATION_BREAK.test(change.value)) return refuse$1("invalid-edit", `${change.property} takes one value, with no ; { } < > or line break`);
28924
+ if (change.kind === "style") return checkDeclaration(change);
28925
+ if (change.kind === "styles") {
28926
+ const { declarations } = change;
28927
+ if (declarations.length === 0) return refuse$1("invalid-edit", "a styles edit names no declaration");
28928
+ if (new Set(declarations.map(({ property }) => property)).size !== declarations.length) return refuse$1("invalid-edit", "a styles edit names one property twice, so one value would be lost");
28929
+ for (const declaration of declarations) {
28930
+ const invalid = checkDeclaration(declaration);
28931
+ if (invalid) return invalid;
28932
+ }
28933
+ return;
28919
28934
  }
28935
+ const invalid = checkValue(change.value);
28936
+ if (invalid) return invalid;
28920
28937
  if (change.kind === "attribute") {
28921
28938
  if (!ATTRIBUTE_NAME.test(change.name)) return refuse$1("invalid-edit", `${change.name} is not an attribute name`);
28922
28939
  if (change.name.toLowerCase() === "style") return refuse$1("invalid-edit", "style is edited one declaration at a time, as a style edit");
@@ -28935,7 +28952,7 @@ function scopeOf(change) {
28935
28952
  }
28936
28953
  /** The attribute name an edit writes, or undefined for a text edit. */
28937
28954
  function editedAttribute(change) {
28938
- if (change.kind === "style") return "style";
28955
+ if (change.kind === "style" || change.kind === "styles") return "style";
28939
28956
  if (change.kind === "attribute") return change.name;
28940
28957
  }
28941
28958
  function write(source, element, change) {
@@ -28947,11 +28964,16 @@ function write(source, element, change) {
28947
28964
  ok: true,
28948
28965
  html: setRawAttribute(source, element, change.name, escapeAttribute(change.value))
28949
28966
  };
28950
- const next = setDeclaration(rawAttribute(source, element, "style") ?? "", change.property, escapeAttribute(change.value));
28951
- if (!next.ok) return refuse$1("open-quote", `the style on <${element.tagName}> ends inside an open quote or comment`);
28967
+ const declarations = change.kind === "styles" ? change.declarations : [change];
28968
+ let style = rawAttribute(source, element, "style") ?? "";
28969
+ for (const { property, value } of declarations) {
28970
+ const next = setDeclaration(style, property, escapeAttribute(value));
28971
+ if (!next.ok) return refuse$1("open-quote", `the style on <${element.tagName}> ends inside an open quote or comment`);
28972
+ style = next.style;
28973
+ }
28952
28974
  return {
28953
28975
  ok: true,
28954
- html: next.style === "" ? removeAttribute(source, element, "style") : setRawAttribute(source, element, "style", next.style)
28976
+ html: style === "" ? removeAttribute(source, element, "style") : setRawAttribute(source, element, "style", style)
28955
28977
  };
28956
28978
  }
28957
28979
  /**
@@ -28990,13 +29012,17 @@ function textOf(element) {
28990
29012
  function holdsValue(element, change) {
28991
29013
  if (change.kind === "text") return textOf(element) === change.value;
28992
29014
  if (change.kind === "attribute") return element.attrs.find((attribute) => isNamed(attribute, change.name))?.value === change.value;
28993
- const declared = declaredValues(element.attrs.find((attribute) => attribute.name === "style")?.value ?? "", change.property);
28994
- const value = change.value.trim();
28995
- return value === "" ? declared.length === 0 : declared.length === 1 && declared[0] === value;
29015
+ const style = element.attrs.find((attribute) => attribute.name === "style")?.value ?? "";
29016
+ return (change.kind === "styles" ? change.declarations : [change]).every(({ property, value }) => {
29017
+ const declared = declaredValues(style, property);
29018
+ const wanted = value.trim();
29019
+ return wanted === "" ? declared.length === 0 : declared.length === 1 && declared[0] === wanted;
29020
+ });
28996
29021
  }
28997
29022
  /**
28998
29023
  * Applies one change to the element the address names and leaves every other
28999
- * byte of the source as it was. The output is parsed again and refused as
29024
+ * byte of the source as it was, a `styles` change writing each declaration in
29025
+ * turn into the one style attribute. The output is parsed again and refused as
29000
29026
  * `verify-failed` unless its tree is the input's with that one change, so an
29001
29027
  * input the guards never met is refused rather than written corrupted.
29002
29028
  */
@@ -29004,6 +29030,12 @@ function applyEdit(source, address, change) {
29004
29030
  const normalized = change.kind === "style" ? {
29005
29031
  ...change,
29006
29032
  property: change.property.toLowerCase()
29033
+ } : change.kind === "styles" ? {
29034
+ ...change,
29035
+ declarations: change.declarations.map((declaration) => ({
29036
+ ...declaration,
29037
+ property: declaration.property.toLowerCase()
29038
+ }))
29007
29039
  } : change.kind === "attribute" ? {
29008
29040
  ...change,
29009
29041
  name: change.name.toLowerCase()
@@ -29714,6 +29746,13 @@ const editSchema = object$1({
29714
29746
  object$1({
29715
29747
  kind: literal("text"),
29716
29748
  value
29749
+ }),
29750
+ object$1({
29751
+ kind: literal("styles"),
29752
+ declarations: array$1(object$1({
29753
+ property: name$1,
29754
+ value
29755
+ })).max(16)
29717
29756
  })
29718
29757
  ])
29719
29758
  });
@@ -29758,7 +29797,8 @@ const moveSchema$1 = object$1({
29758
29797
  *
29759
29798
  * The edit's body mirrors
29760
29799
  * `edit`'s flags with the hash required, since the board always holds the
29761
- * one it rendered. It writes through `editFrameFile`, which finds the element
29800
+ * one it rendered, plus a `styles` change the CLI never sends, which writes
29801
+ * several declarations as one step. It writes through `editFrameFile`, which finds the element
29762
29802
  * again in a frame an agent wrote since from the source `version` kept, and
29763
29803
  * records the edited element's span as one step. It answers the `edit`
29764
29804
  * record with the index written and the hash written over. Each refusal the
@@ -37204,11 +37244,18 @@ function structureRoutes(root, access, history, measure, tokens = null) {
37204
37244
  });
37205
37245
  app.post("/api/frame/rename", async (c) => {
37206
37246
  const body = await parseBody$1(c.req.raw, renameSchema);
37207
- await refuseHeldFrames([body.ref]);
37247
+ const source = await readFrame$1(root, body.ref, { cwd });
37248
+ await refuseHeld([source.ref]);
37208
37249
  const frame = await recorded((journal) => renameFrame(root, body.ref, body.name, {
37209
37250
  cwd,
37210
37251
  journal
37211
- }), (renamed) => onFrames([renamed.ref]));
37252
+ }), async (renamed) => ({
37253
+ ...await onFrames([renamed.ref]),
37254
+ ...renamed.ref === source.ref ? {} : { renamed: {
37255
+ before: source.ref,
37256
+ after: renamed.ref
37257
+ } }
37258
+ }));
37212
37259
  return c.json({
37213
37260
  ok: true,
37214
37261
  data: frame
@@ -49559,30 +49606,37 @@ const require$1 = createRequire(import.meta.url);
49559
49606
  function hasFaces(dir) {
49560
49607
  return FACES.every((face) => existsSync(join(dir, face.folder, "index.css")));
49561
49608
  }
49609
+ const FILE_REFERENCE = /url\(\s*(['"]?)\.\/files\/([^'")\s]+)\1\s*\)/g;
49610
+ /** The distinct file names a package sheet loads from its `files` folder. */
49611
+ function referencedFiles(sheet) {
49612
+ const names = [...sheet.matchAll(FILE_REFERENCE)].flatMap((m) => m[2] ? [m[2]] : []);
49613
+ return [...new Set(names)];
49614
+ }
49562
49615
  /**
49563
49616
  * Copies each face every frame imports from its package into `outDir`,
49564
- * replacing what was there. The faces fill a sibling folder first and rename
49565
- * into place, so `outDir` holds every file or does not exist, and an
49617
+ * replacing what was there. Only the files a package sheet references are
49618
+ * copied, and a reference to a file the package lacks throws. The faces fill
49619
+ * a sibling folder first and rename into place, so `outDir` holds every file or does not exist, and an
49566
49620
  * interrupted write leaves no half-filled face behind. Each sheet is
49567
49621
  * rewritten to declare the plain family a frame names, such as Geist, rather
49568
49622
  * than the package's own, such as Geist Variable. With `keepComplete`, a
49569
49623
  * folder that filled in meanwhile, as from a parallel run, stays as it is.
49570
49624
  */
49571
- function writeFaces(outDir, { keepComplete = false } = {}) {
49625
+ function writeFaces(outDir, { keepComplete = false, faces = FACES } = {}) {
49572
49626
  const staging = `${outDir}.${process.pid}.tmp`;
49573
49627
  rmSync(staging, {
49574
49628
  recursive: true,
49575
49629
  force: true
49576
49630
  });
49577
49631
  try {
49578
- for (const face of FACES) {
49632
+ for (const face of faces) {
49579
49633
  const from = dirname(require$1.resolve(`${face.package}/package.json`));
49580
49634
  const to = join(staging, face.folder);
49581
49635
  mkdirSync(join(to, "files"), { recursive: true });
49582
49636
  const sheet = readFileSync(join(from, "index.css"), "utf8");
49583
49637
  writeFileSync(join(to, "index.css"), sheet.replaceAll(`'${face.packageFamily}'`, `'${face.family}'`));
49584
49638
  copyFileSync(join(from, "LICENSE"), join(to, "LICENSE"));
49585
- for (const file of readdirSync(join(from, "files"))) if (file.endsWith(".woff2")) copyFileSync(join(from, "files", file), join(to, "files", file));
49639
+ for (const file of referencedFiles(sheet)) copyFileSync(join(from, "files", file), join(to, "files", file));
49586
49640
  }
49587
49641
  if (keepComplete && hasFaces(outDir)) return;
49588
49642
  rmSync(outDir, {