@guilhermebkel/scenec 0.2.0 → 0.2.2

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 (165) hide show
  1. package/README.md +23 -12
  2. package/dist/Adapters/FontAdapter.js +5 -1
  3. package/dist/Commands/BestCommand.d.ts +11 -0
  4. package/dist/Commands/BestCommand.js +73 -0
  5. package/dist/Commands/RenderCommand.d.ts +2 -0
  6. package/dist/Commands/RenderCommand.js +7 -0
  7. package/dist/Modules/BestModule.d.ts +41 -0
  8. package/dist/Modules/BestModule.js +159 -0
  9. package/dist/Modules/CompilationModule.d.ts +5 -0
  10. package/dist/Modules/CompilationModule.js +92 -19
  11. package/dist/Modules/CritiqueModule.d.ts +3 -0
  12. package/dist/Modules/CritiqueModule.js +60 -5
  13. package/dist/Protocols/AssetProtocol.d.ts +6 -1
  14. package/dist/Protocols/AssetProtocol.js +17 -1
  15. package/dist/Protocols/CommandProtocol.d.ts +2 -0
  16. package/dist/Protocols/CompilationProtocol.d.ts +27 -1
  17. package/dist/Protocols/CritiqueProtocol.d.ts +17 -1
  18. package/dist/Protocols/CritiqueProtocol.js +11 -1
  19. package/dist/Protocols/KitProtocol.d.ts +8 -2
  20. package/dist/Protocols/KitProtocol.js +8 -2
  21. package/dist/Protocols/PersonProtocol.d.ts +4 -0
  22. package/dist/Protocols/PersonProtocol.js +2 -0
  23. package/dist/Protocols/SceneProtocol.d.ts +204 -5
  24. package/dist/Protocols/SceneProtocol.js +60 -7
  25. package/dist/Resources/Assets/BaseAsset.d.ts +1 -0
  26. package/dist/Resources/Assets/BaseAsset.js +1 -0
  27. package/dist/Resources/Assets/BigPlantAsset.js +8 -1
  28. package/dist/Resources/Assets/BlackboardAsset.d.ts +11 -0
  29. package/dist/Resources/Assets/BlackboardAsset.js +20 -0
  30. package/dist/Resources/Assets/BushAsset.js +1 -1
  31. package/dist/Resources/Assets/ChairAsset.d.ts +5 -0
  32. package/dist/Resources/Assets/ChairAsset.js +23 -0
  33. package/dist/Resources/Assets/ChatBubbleAsset.d.ts +11 -0
  34. package/dist/Resources/Assets/ChatBubbleAsset.js +18 -0
  35. package/dist/Resources/Assets/CloudAsset.js +3 -1
  36. package/dist/Resources/Assets/ConfettiAsset.d.ts +10 -0
  37. package/dist/Resources/Assets/ConfettiAsset.js +18 -0
  38. package/dist/Resources/Assets/CursorAsset.d.ts +11 -0
  39. package/dist/Resources/Assets/CursorAsset.js +17 -0
  40. package/dist/Resources/Assets/DeskAsset.js +7 -2
  41. package/dist/Resources/Assets/FirstAidKitAsset.d.ts +10 -0
  42. package/dist/Resources/Assets/FirstAidKitAsset.js +19 -0
  43. package/dist/Resources/Assets/GlobeAsset.d.ts +10 -0
  44. package/dist/Resources/Assets/GlobeAsset.js +18 -0
  45. package/dist/Resources/Assets/HouseAsset.js +22 -6
  46. package/dist/Resources/Assets/LaptopAsset.js +5 -1
  47. package/dist/Resources/Assets/PlantAsset.js +1 -1
  48. package/dist/Resources/Assets/PodiumAsset.d.ts +11 -0
  49. package/dist/Resources/Assets/PodiumAsset.js +20 -0
  50. package/dist/Resources/Assets/RefrigeratorAsset.d.ts +11 -0
  51. package/dist/Resources/Assets/RefrigeratorAsset.js +21 -0
  52. package/dist/Resources/Assets/SinkAsset.d.ts +11 -0
  53. package/dist/Resources/Assets/SinkAsset.js +21 -0
  54. package/dist/Resources/Assets/SofaAsset.d.ts +5 -0
  55. package/dist/Resources/Assets/SofaAsset.js +30 -2
  56. package/dist/Resources/Assets/StarsAsset.d.ts +6 -0
  57. package/dist/Resources/Assets/StarsAsset.js +37 -24
  58. package/dist/Resources/Assets/StethoscopeAsset.d.ts +10 -0
  59. package/dist/Resources/Assets/StethoscopeAsset.js +18 -0
  60. package/dist/Resources/Assets/StoveAsset.d.ts +11 -0
  61. package/dist/Resources/Assets/StoveAsset.js +20 -0
  62. package/dist/Resources/Assets/ToggleAsset.d.ts +11 -0
  63. package/dist/Resources/Assets/ToggleAsset.js +21 -0
  64. package/dist/Resources/Assets/TreeAsset.d.ts +5 -0
  65. package/dist/Resources/Assets/TreeAsset.js +32 -7
  66. package/dist/Resources/Assets/WaterCoolerAsset.d.ts +11 -0
  67. package/dist/Resources/Assets/WaterCoolerAsset.js +20 -0
  68. package/dist/Resources/Assets/WhiteboardAsset.d.ts +10 -0
  69. package/dist/Resources/Assets/WhiteboardAsset.js +18 -0
  70. package/dist/Resources/Kits/BaseKit.d.ts +2 -1
  71. package/dist/Resources/Kits/BaseKit.js +1 -0
  72. package/dist/Resources/Kits/ClayKit.d.ts +9 -0
  73. package/dist/Resources/Kits/ClayKit.js +11 -0
  74. package/dist/Resources/Kits/DuotoneKit.d.ts +16 -0
  75. package/dist/Resources/Kits/DuotoneKit.js +18 -0
  76. package/dist/Resources/Kits/IsometricKit.d.ts +8 -0
  77. package/dist/Resources/Kits/IsometricKit.js +10 -0
  78. package/dist/Resources/Kits/OutlineKit.d.ts +3 -0
  79. package/dist/Resources/Kits/OutlineKit.js +1 -1
  80. package/dist/Resources/Kits/PaperKit.d.ts +2 -0
  81. package/dist/Resources/Kits/PaperKit.js +1 -0
  82. package/dist/Resources/Kits/PosterKit.d.ts +14 -0
  83. package/dist/Resources/Kits/PosterKit.js +16 -0
  84. package/dist/Resources/Kits/SketchKit.d.ts +2 -1
  85. package/dist/Resources/Kits/SketchKit.js +1 -0
  86. package/dist/Services/AssetService.js +29 -1
  87. package/dist/Services/BackgroundService.d.ts +10 -2
  88. package/dist/Services/BackgroundService.js +52 -11
  89. package/dist/Services/CatalogService.d.ts +1 -0
  90. package/dist/Services/CatalogService.js +8 -3
  91. package/dist/Services/ColorCritiqueService.d.ts +42 -0
  92. package/dist/Services/ColorCritiqueService.js +232 -0
  93. package/dist/Services/ContextService.js +9 -5
  94. package/dist/Services/DescriptionService.d.ts +2 -1
  95. package/dist/Services/DescriptionService.js +8 -2
  96. package/dist/Services/DetailService.d.ts +7 -0
  97. package/dist/Services/DetailService.js +18 -0
  98. package/dist/Services/FocusCritiqueService.d.ts +23 -0
  99. package/dist/Services/FocusCritiqueService.js +166 -0
  100. package/dist/Services/FramingService.d.ts +31 -0
  101. package/dist/Services/FramingService.js +108 -0
  102. package/dist/Services/GazeService.js +3 -1
  103. package/dist/Services/GroundDetailService.d.ts +50 -0
  104. package/dist/Services/GroundDetailService.js +115 -0
  105. package/dist/Services/KitService.d.ts +11 -2
  106. package/dist/Services/KitService.js +45 -10
  107. package/dist/Services/LightingService.d.ts +15 -0
  108. package/dist/Services/LightingService.js +124 -6
  109. package/dist/Services/PaletteService.d.ts +108 -0
  110. package/dist/Services/PaletteService.js +282 -0
  111. package/dist/Services/PieceService.d.ts +4 -0
  112. package/dist/Services/PieceService.js +28 -7
  113. package/dist/Services/PlacementService.js +7 -1
  114. package/dist/Services/PlaneBackgroundService.d.ts +4 -0
  115. package/dist/Services/PlaneBackgroundService.js +42 -3
  116. package/dist/Services/PlaneProjectionService.d.ts +4 -0
  117. package/dist/Services/PlaneProjectionService.js +33 -4
  118. package/dist/Services/RasterService.js +20 -3
  119. package/dist/Services/RidgeService.d.ts +31 -0
  120. package/dist/Services/RidgeService.js +85 -0
  121. package/dist/Services/ScaleCritiqueService.d.ts +11 -0
  122. package/dist/Services/ScaleCritiqueService.js +57 -0
  123. package/dist/Services/SkyDetailService.d.ts +39 -0
  124. package/dist/Services/SkyDetailService.js +95 -0
  125. package/dist/Services/{ContactCritiqueService.d.ts → TangentCritiqueService.d.ts} +10 -6
  126. package/dist/Services/TangentCritiqueService.js +136 -0
  127. package/dist/Services/TextService.d.ts +43 -3
  128. package/dist/Services/TextService.js +288 -32
  129. package/dist/Services/ThumbnailCritiqueService.d.ts +30 -0
  130. package/dist/Services/ThumbnailCritiqueService.js +130 -0
  131. package/dist/Utils/ColorUtil.d.ts +14 -0
  132. package/dist/Utils/ColorUtil.js +68 -5
  133. package/dist/Utils/DetailUtil.d.ts +7 -0
  134. package/dist/Utils/DetailUtil.js +15 -0
  135. package/dist/Utils/FontMetricsUtil.d.ts +7 -0
  136. package/dist/Utils/FontMetricsUtil.js +694 -0
  137. package/dist/Utils/OklabUtil.d.ts +18 -0
  138. package/dist/Utils/OklabUtil.js +89 -0
  139. package/dist/Utils/PersonArmUtil.d.ts +13 -1
  140. package/dist/Utils/PersonArmUtil.js +53 -5
  141. package/dist/Utils/PersonHeadUtil.js +3 -1
  142. package/dist/Utils/PersonOutfitUtil.d.ts +16 -0
  143. package/dist/Utils/PersonOutfitUtil.js +89 -13
  144. package/dist/Utils/PersonUtil.d.ts +2 -0
  145. package/dist/Utils/PersonUtil.js +14 -4
  146. package/dist/Utils/SanitizeUtil.js +1 -0
  147. package/dist/Utils/ShapeUtil.d.ts +9 -0
  148. package/dist/Utils/ShapeUtil.js +26 -0
  149. package/dist/Utils/TypesettingUtil.d.ts +17 -0
  150. package/dist/Utils/TypesettingUtil.js +92 -0
  151. package/dist/cli.js +32 -3
  152. package/dist/render.d.ts +3 -1
  153. package/dist/render.js +5 -0
  154. package/fonts/DMSerifDisplay-Regular.ttf +0 -0
  155. package/fonts/OFL.txt +2 -0
  156. package/fonts/PatrickHand-Regular.ttf +0 -0
  157. package/package.json +1 -1
  158. package/skills/draw-scene/SKILL.md +2 -1
  159. package/skills/draw-scene/recipes/carousel.yaml +1 -1
  160. package/skills/draw-scene/recipes/conference-keynote.yaml +43 -0
  161. package/skills/draw-scene/recipes/product-feature.yaml +41 -0
  162. package/skills/draw-scene/recipes/product-illustration.yaml +2 -1
  163. package/skills/draw-scene/references/catalog.md +19 -1
  164. package/skills/draw-scene/references/dsl.md +24 -6
  165. package/dist/Services/ContactCritiqueService.js +0 -101
@@ -0,0 +1,92 @@
1
+ class TypesettingUtil {
2
+ static DEFAULT_LINE_COUNT = 2;
3
+ static REGEX_SPECIAL_CHARS = /[.*+?^${}()|[\]\\]/g;
4
+ static splitLines(content, options = {}) {
5
+ const rawLines = content.split("\n");
6
+ const { wrap, hasBalance } = options;
7
+ if (wrap == null && hasBalance !== true) {
8
+ return rawLines;
9
+ }
10
+ const allWords = content.trim().split(/\s+/).filter((word) => word.length > 0);
11
+ if (allWords.length <= 1) {
12
+ return [content.trim()];
13
+ }
14
+ const totalChars = allWords.reduce((sum, word) => sum + word.length, 0) + (allWords.length - 1);
15
+ const targetLineCount = TypesettingUtil.resolveLineCount(rawLines.length, totalChars, wrap, hasBalance);
16
+ if (targetLineCount <= 1 || targetLineCount >= allWords.length) {
17
+ return rawLines;
18
+ }
19
+ return TypesettingUtil.balancePartition(allWords, targetLineCount);
20
+ }
21
+ static resolveLineCount(rawCount, totalChars, wrap, hasBalance) {
22
+ if (wrap != null) {
23
+ return Math.max(TypesettingUtil.DEFAULT_LINE_COUNT, Math.ceil(totalChars / wrap));
24
+ }
25
+ if (hasBalance === true && rawCount > 1) {
26
+ return rawCount;
27
+ }
28
+ return TypesettingUtil.DEFAULT_LINE_COUNT;
29
+ }
30
+ static balancePartition(words, targetLineCount) {
31
+ if (words.length <= targetLineCount || targetLineCount <= 1) {
32
+ return [words.join(" ")];
33
+ }
34
+ const totalChars = words.reduce((sum, word) => sum + word.length, 0) + (words.length - 1);
35
+ const averageLineLength = totalChars / targetLineCount;
36
+ return TypesettingUtil.findBestPartition(words, 0, 0, targetLineCount, averageLineLength).lines;
37
+ }
38
+ static findBestPartition(words, wordIndex, lineIndex, targetLineCount, averageLineLength) {
39
+ const isLastLine = lineIndex === targetLineCount - 1;
40
+ if (isLastLine) {
41
+ const line = words.slice(wordIndex).join(" ");
42
+ const deviation = line.length - averageLineLength;
43
+ return { score: deviation * deviation, lines: [line] };
44
+ }
45
+ let bestScore = Number.POSITIVE_INFINITY;
46
+ let bestLines = [];
47
+ const maxWordIndex = words.length - (targetLineCount - lineIndex - 1);
48
+ for (let nextIndex = wordIndex + 1; nextIndex <= maxWordIndex; nextIndex++) {
49
+ const line = words.slice(wordIndex, nextIndex).join(" ");
50
+ const deviation = line.length - averageLineLength;
51
+ const penalty = deviation * deviation;
52
+ const nextPartition = TypesettingUtil.findBestPartition(
53
+ words,
54
+ nextIndex,
55
+ lineIndex + 1,
56
+ targetLineCount,
57
+ averageLineLength
58
+ );
59
+ const totalScore = penalty + nextPartition.score;
60
+ if (totalScore < bestScore) {
61
+ bestScore = totalScore;
62
+ bestLines = [line, ...nextPartition.lines];
63
+ }
64
+ }
65
+ return { score: bestScore, lines: bestLines };
66
+ }
67
+ static emphasisRanges(line, words) {
68
+ if (!words || words.length === 0) {
69
+ return [{ start: 0, length: line.length }];
70
+ }
71
+ const ranges = [];
72
+ for (const word of words) {
73
+ if (word.length === 0) {
74
+ continue;
75
+ }
76
+ const pattern = word.replace(TypesettingUtil.REGEX_SPECIAL_CHARS, "\\$&");
77
+ const regex = new RegExp(`\\b${pattern}\\b`, "gi");
78
+ let match = regex.exec(line);
79
+ while (match !== null) {
80
+ ranges.push({ start: match.index, length: match[0].length });
81
+ match = regex.exec(line);
82
+ }
83
+ }
84
+ if (ranges.length === 0) {
85
+ return [{ start: 0, length: line.length }];
86
+ }
87
+ return ranges.toSorted((first, second) => first.start - second.start);
88
+ }
89
+ }
90
+ export {
91
+ TypesettingUtil
92
+ };
package/dist/cli.js CHANGED
@@ -1,11 +1,14 @@
1
1
  #!/usr/bin/env node
2
+ import fs from "node:fs";
2
3
  import { parseArgs } from "node:util";
3
4
  import { CATALOG_KINDS } from "./schema.js";
5
+ import { BestCommand } from "./Commands/BestCommand.js";
4
6
  import { CatalogCommand } from "./Commands/CatalogCommand.js";
5
7
  import { CheckCommand } from "./Commands/CheckCommand.js";
6
8
  import { RenderCommand } from "./Commands/RenderCommand.js";
7
9
  import { SchemaCommand } from "./Commands/SchemaCommand.js";
8
10
  const DEFAULT_WIDTH = 1200;
11
+ const DEFAULT_COUNT = 8;
9
12
  const EXIT_INVALID = 2;
10
13
  const HELP = `scenec: turns a YAML scene into an illustrated SVG.
11
14
 
@@ -13,12 +16,21 @@ const HELP = `scenec: turns a YAML scene into an illustrated SVG.
13
16
  Compiles and writes the SVG (and a PNG with --png). Prints the JSON report.
14
17
  scenec check <scene.yaml>
15
18
  Compiles and critiques without writing files. Exit code 1 when there is a warning or a critique.
19
+ scenec best <scene.yaml> [-n 8] [-o <output without extension>] [--png] [--width 1200]
20
+ Renders N variants with varied free parameters and picks the best critique score.
16
21
  scenec catalog [${CATALOG_KINDS.join("|")}]
17
22
  Lists the vocabulary a scene can use.
18
23
  scenec schema
19
24
  Prints the JSON Schema of the scene.
20
25
  `;
21
- const COMMANDS = [new RenderCommand(), new CheckCommand(), new CatalogCommand(), new SchemaCommand()];
26
+ const COMMANDS = [
27
+ new RenderCommand(),
28
+ new CheckCommand(),
29
+ new BestCommand(),
30
+ new CatalogCommand(),
31
+ new SchemaCommand()
32
+ ];
33
+ const HELP_COMMANDS = /* @__PURE__ */ new Set(["help", "--help", "-h"]);
22
34
  function main(argv) {
23
35
  const [name, ...rest] = argv;
24
36
  const { values, positionals } = parseArgs({
@@ -28,10 +40,12 @@ function main(argv) {
28
40
  output: { type: "string", short: "o" },
29
41
  png: { type: "boolean", default: false },
30
42
  width: { type: "string", default: String(DEFAULT_WIDTH) },
43
+ count: { type: "string", short: "n", default: String(DEFAULT_COUNT) },
44
+ best: { type: "string" },
31
45
  help: { type: "boolean", short: "h", default: false }
32
46
  }
33
47
  });
34
- if (!name || name === "help" || values.help) {
48
+ if (!name || HELP_COMMANDS.has(name) || values.help) {
35
49
  process.stdout.write(HELP);
36
50
  return 0;
37
51
  }
@@ -40,6 +54,21 @@ function main(argv) {
40
54
  process.stderr.write(HELP);
41
55
  return EXIT_INVALID;
42
56
  }
43
- return command.run({ positionals, output: values.output, shouldWritePng: values.png, width: Number(values.width) });
57
+ const file = positionals[0];
58
+ if (command.isFileRequired && file !== void 0 && !fs.existsSync(file)) {
59
+ process.stderr.write(`scenec: cannot read "${file}": no such file
60
+ `);
61
+ return EXIT_INVALID;
62
+ }
63
+ const rawCount = values.best !== void 0 ? Number(values.best) : Number(values.count);
64
+ const count = Number.isFinite(rawCount) && rawCount > 0 ? rawCount : DEFAULT_COUNT;
65
+ return command.run({
66
+ positionals,
67
+ output: values.output,
68
+ shouldWritePng: values.png,
69
+ width: Number(values.width),
70
+ count,
71
+ isBest: values.best !== void 0
72
+ });
44
73
  }
45
74
  process.exitCode = main(process.argv.slice(2));
package/dist/render.d.ts CHANGED
@@ -1,8 +1,10 @@
1
+ import type { BestOptions, BestResult } from "./Modules/BestModule.js";
1
2
  import type { CheckResult } from "./Modules/CheckModule.js";
2
3
  import type { Raster } from "./Adapters/ResvgAdapter.js";
3
4
  import type { BBox, CompileOptions, FileReader } from "./Protocols/OptionsProtocol.js";
4
- export type { CheckResult, Raster };
5
+ export type { BestOptions, BestResult, CheckResult, Raster };
5
6
  export declare function check(input: unknown, options?: CompileOptions): CheckResult;
7
+ export declare function best(input: unknown, options?: BestOptions): BestResult;
6
8
  export declare function createFileReader(folder: string): FileReader;
7
9
  export declare function measureSvg(svg: string): BBox | null;
8
10
  export declare function renderPng(svg: string, width?: number): Raster;
package/dist/render.js CHANGED
@@ -1,9 +1,13 @@
1
+ import { BestModule } from "./Modules/BestModule.js";
1
2
  import { CheckModule } from "./Modules/CheckModule.js";
2
3
  import { FileReaderAdapter } from "./Adapters/FileReaderAdapter.js";
3
4
  import { ResvgAdapter } from "./Adapters/ResvgAdapter.js";
4
5
  function check(input, options = {}) {
5
6
  return CheckModule.check(input, options);
6
7
  }
8
+ function best(input, options = {}) {
9
+ return BestModule.best(input, options);
10
+ }
7
11
  function createFileReader(folder) {
8
12
  return FileReaderAdapter.createFileReader(folder);
9
13
  }
@@ -14,6 +18,7 @@ function renderPng(svg, width = 1200) {
14
18
  return ResvgAdapter.renderPng(svg, width);
15
19
  }
16
20
  export {
21
+ best,
17
22
  check,
18
23
  createFileReader,
19
24
  measureSvg,
Binary file
package/fonts/OFL.txt CHANGED
@@ -1,4 +1,6 @@
1
1
  Copyright 2020 The Poppins Project Authors (https://github.com/itfoundry/Poppins)
2
+ Copyright 2014-2018 Adobe (http://www.adobe.com/), with Reserved Font Name 'Source'. Copyright 2019 Google LLC (DM Serif Display)
3
+ Copyright (c) 2010-2012 Patrick Wagesreiter (mail@patrickwagesreiter.at) (Patrick Hand)
2
4
 
3
5
  This Font Software is licensed under the SIL Open Font License, Version 1.1.
4
6
  This license is copied below, and is also available with a FAQ at:
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@guilhermebkel/scenec",
3
- "version": "0.2.0",
3
+ "version": "0.2.2",
4
4
  "description": "Scene compiler: turns a short YAML scene into an illustrated SVG, with warnings and a text description so AI agents that cannot see images can draw.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -25,6 +25,7 @@ You write a YAML scene. `scenec` compiles it to SVG and tells you, in text, what
25
25
  3. Check: `npx @guilhermebkel/scenec check scene.yaml`. Read `warnings` and `art`. Exit code 1 means there is something to fix.
26
26
  4. Fix and check again. Stop after 5 cycles; if something still fails, say what is left instead of looping.
27
27
  5. Render: `npx @guilhermebkel/scenec render scene.yaml -o out --png`. Deliver `out.svg` and `out.png`.
28
+ Optionally polish with Best-of-N: once the report is clean, run `npx @guilhermebkel/scenec best scene.yaml -n 8 -o out --png` (or `render scene.yaml --best 8 -o out --png`). It builds variations of free parameters (seed, lighting side, camera frame, palette harmonies) and keeps the one with the best critique score, writing the winning scene to `out.yaml` next to the SVG, so the result stays reproducible and `scene.yaml` is left unchanged.
28
29
 
29
30
  ## Rules
30
31
 
@@ -37,6 +38,6 @@ You write a YAML scene. `scenec` compiles it to SVG and tells you, in text, what
37
38
 
38
39
  ## Files
39
40
 
40
- - `recipes/*.yaml`: 8 scenes that compile with zero warnings and zero critiques.
41
+ - `recipes/*.yaml`: 10 scenes that compile with zero warnings and zero critiques.
41
42
  - `references/dsl.md`: the scene language (generated).
42
43
  - `references/catalog.md`: assets, groups, kits, themes, poses (generated).
@@ -15,7 +15,7 @@ objects:
15
15
  sol:
16
16
  asset: sun
17
17
  at: top-right
18
- altitude: 0.36
18
+ altitude: 0.26
19
19
  size: small
20
20
  arv:
21
21
  asset: tree
@@ -0,0 +1,43 @@
1
+ canvas:
2
+ width: 1000
3
+ height: 1000
4
+ theme: flat-cool
5
+ setting: indoor
6
+ horizon: 0.6
7
+ base: 0.85
8
+ objects:
9
+ festa:
10
+ asset: confetti
11
+ at: 0.85
12
+ depth: far
13
+ altitude: 0.45
14
+ pulpito:
15
+ asset: podium
16
+ at: 0.65
17
+ palestrante:
18
+ asset: person
19
+ pose: presenting
20
+ left_of: pulpito
21
+ gap: 0.04
22
+ hair: short
23
+ hair_color: black
24
+ shirt: primary
25
+ pants: secondary
26
+ text:
27
+ - content: "KEYNOTE 2026"
28
+ at: top-center
29
+ role: label
30
+ size: 0.024
31
+ color: secondary
32
+ 'y': 0.15
33
+ - content: "O Futuro da Criacao"
34
+ at: top-center
35
+ role: title
36
+ size: 0.06
37
+ 'y': 0.22
38
+ - content: "Conheca as novidades e lancamentos para agentes autonomos."
39
+ at: top-center
40
+ role: body
41
+ size: 0.026
42
+ 'y': 0.31
43
+ color: secondary
@@ -0,0 +1,41 @@
1
+ canvas:
2
+ width: 864
3
+ height: 1080
4
+ theme: flat-cool
5
+ setting: indoor
6
+ horizon: 0.55
7
+ base: 0.78
8
+ objects:
9
+ quadro:
10
+ asset: whiteboard
11
+ at: 0.25
12
+ depth: far
13
+ mesa:
14
+ asset: desk
15
+ at: 0.65
16
+ computador:
17
+ asset: laptop_open
18
+ on: mesa
19
+ at: 0.6
20
+ mensagem:
21
+ asset: chat_bubble
22
+ at: 0.78
23
+ elevation: 80
24
+ text:
25
+ - content: "NOVO RECURSO"
26
+ at: bottom-left
27
+ role: label
28
+ size: 0.022
29
+ color: secondary
30
+ 'y': 0.82
31
+ - content: "Automacao Inteligente"
32
+ at: bottom-left
33
+ role: title
34
+ size: 0.048
35
+ 'y': 0.88
36
+ - content: "Ative fluxos inteligentes diretamente no painel de controle."
37
+ at: bottom-left
38
+ role: body
39
+ size: 0.026
40
+ 'y': 0.94
41
+ color: secondary
@@ -33,7 +33,8 @@ objects:
33
33
  text:
34
34
  - content: Sem conexão
35
35
  at: bottom-center
36
- role: title
36
+ role: subtitle
37
+ weight: 700
37
38
  size: 0.05
38
39
  'y': 0.86
39
40
  - content: Verifique sua internet e tente de novo.
@@ -2,7 +2,7 @@
2
2
 
3
3
  Generated by `pnpm skill:refs`. Query live with `npx @guilhermebkel/scenec catalog <assets|groups|kits|themes|poses|layout>`.
4
4
 
5
- ## Assets (86)
5
+ ## Assets (100)
6
6
 
7
7
  | Id | Kind | Size | Synonyms |
8
8
  | --- | --- | --- | --- |
@@ -92,6 +92,20 @@ Generated by `pnpm skill:refs`. Query live with `npx @guilhermebkel/scenec catal
92
92
  | `cables` | surface | 14x4 | cabos, fios, carregador |
93
93
  | `light_switch` | wall | 5x7 | interruptor, tomada, switch |
94
94
  | `glass_shelf` | ground | 14x46 | prateleira de vidro, vidro, glass shelf |
95
+ | `refrigerator` | ground | 64x150 | geladeira, fridge, freezer, refrigerator, refrigerador |
96
+ | `stove` | ground | 60x90 | fogão, fogao, stove, oven, cooker, cooktop |
97
+ | `sink` | ground | 70x90 | pia, sink, faucet, torneira, kitchen_sink |
98
+ | `whiteboard` | ground | 120x150 | quadro_branco, lousa_branca, whiteboard, flipchart, board_stand |
99
+ | `water_cooler` | ground | 36x115 | bebedouro, water_cooler, water_dispenser, water_bottle |
100
+ | `first_aid_kit` | surface | 38x30 | primeiros_socorros, maleta_medica, first_aid_kit, medical_kit, medicine_box |
101
+ | `stethoscope` | surface | 36x38 | estetoscopio, stethoscope, doctor, health, medical |
102
+ | `blackboard` | wall | 140x95 | lousa, quadro_negro, blackboard, chalkboard, chalk |
103
+ | `globe` | surface | 36x50 | globo, globo_terrestre, globe, earth, world_map |
104
+ | `podium` | ground | 50x95 | pulpito, podio, podium, lectern, speech, stage_stand |
105
+ | `confetti` | sky | 80x80 | confete, confetes, confetti, party, celebration, streamers |
106
+ | `cursor` | wall | 32x38 | cursor, mouse_pointer, pointer, arrow, mouse |
107
+ | `toggle` | wall | 52x28 | toggle, switch, interruptor_ui, ui_switch, button_toggle |
108
+ | `chat_bubble` | wall | 52x44 | balao_de_fala, conversa, chat_bubble, message, speech_bubble, comment |
95
109
 
96
110
  ## Groups (7)
97
111
 
@@ -113,6 +127,10 @@ Generated by `pnpm skill:refs`. Query live with `npx @guilhermebkel/scenec catal
113
127
  - `riso`: risograph: few vivid inks, print grain and slightly misaligned registration
114
128
  - `paper`: paper cut-out: each piece with its own shadow and fiber texture
115
129
  - `sketch`: sketch: watercolor-washed colors and pencil lines on the edges
130
+ - `clay`: clay: soft 3D rounded shapes, rim light and ambient occlusion
131
+ - `duotone`: duotone: two inks mapped across luminance with halftone
132
+ - `poster`: vintage poster: limited 4–5 colors, coarse halftone shadows, sun-faded grade
133
+ - `isometric`: isometric: 30° axonometric projection with flat faces, hatched shadow planes and a drop shadow
116
134
 
117
135
  ## Themes
118
136
 
@@ -27,8 +27,10 @@ Generated by `pnpm skill:refs` from the Zod schema. Unknown fields are not error
27
27
  | `width` | integer | Frame width in px. Default 1200. |
28
28
  | `height` | integer | Frame height in px. Default 630 (classic) or 900 (2.5d, map). |
29
29
  | `mode` | classic \| 2.5d \| board \| map | classic (default), 2.5d, board or map. |
30
- | `theme` | string | Palette name. See `scenec catalog themes`. |
30
+ | `theme` | string or object | Palette name or { from, harmony, mood }. See `scenec catalog themes`. |
31
+ | `time` | golden \| noon \| overcast \| dusk \| night | Time of day: golden, noon, overcast, dusk or night. |
31
32
  | `kit` | string | Style kit name. See `scenec catalog kits`. |
33
+ | `font` | sans \| serif \| hand | Default font: sans, serif or hand. |
32
34
  | `colors` | object | Overrides theme colors, for example wall or floor. |
33
35
  | `setting` | outdoor \| indoor \| beach \| city | Where the scene happens. Default outdoor. |
34
36
  | `scale` | number | Camera zoom. Default 1. |
@@ -37,14 +39,20 @@ Generated by `pnpm skill:refs` from the Zod schema. Unknown fields are not error
37
39
  | `floor` | string | Indoor floor style, for example planks. |
38
40
  | `vanish` | number | Vanishing point x for planks. |
39
41
  | `haze` | boolean | false turns atmospheric perspective off. |
40
- | `grain` | boolean | |
41
- | `light` | false or object | false, or { from: left\|right\|front\|0..1, strength: 0..1 }. |
42
+ | `grain` | boolean or number | true (0.10), false, or a strength between 0 and 1. |
43
+ | `light` | false or object | false, or { from: left\|right\|front\|0..1, strength: 0..1, shafts: boolean }. |
44
+ | `seed` | number | Seed for procedural background details. |
45
+ | `ridges` | integer | Number of procedural ridge layers (0..4). Default 2 for outdoor, 0 for city/beach. |
46
+ | `clouds` | none \| few \| many | Ambient sky clouds: none, few or many. |
47
+ | `ground_detail` | none \| low \| high | Ground texture and tufts: none, low or high. |
48
+ | `framing` | foliage \| curtain \| plants \| none | Foreground framing elements: foliage, curtain, plants or none. |
49
+ | `frame_elements` | foliage \| curtain \| plants \| none | Alias for canvas.framing. |
42
50
  | `critique` | boolean | false turns the art director off. |
43
51
  | `shot` | wide \| full \| medium \| close | Framing: wide (default), full, medium or close. |
44
52
  | `focus` | string or string[] | Object or group ids the shot frames. |
45
53
  | `frame` | number or left \| center \| right | Where the focus sits horizontally. |
46
54
  | `headroom` | number | Space above the focus as a fraction of the height. |
47
- | `camera` | board \| room or object | 2.5d camera: board (high and far, default) or room (real perspective, for interiors), with optional overrides. |
55
+ | `camera` | board \| room \| isometric or object | 2.5d camera: board (high and far, default) or room (real perspective, for interiors), with optional overrides. |
48
56
  | `depth` | number | |
49
57
  | `far_y` | number | |
50
58
  | `near_y` | number | |
@@ -64,7 +72,7 @@ Generated by `pnpm skill:refs` from the Zod schema. Unknown fields are not error
64
72
  | `right_of` | string | |
65
73
  | `behind` | string | |
66
74
  | `in_front_of` | string | |
67
- | `on` | string | Sits on another object's surface or seat. |
75
+ | `on` | string | Sits on another object's surface or seat. Only assets with a surface or seat accept it; others are placed on the ground. |
68
76
  | `under` | string | |
69
77
  | `above` | string | |
70
78
  | `holds` | string | |
@@ -72,7 +80,7 @@ Generated by `pnpm skill:refs` from the Zod schema. Unknown fields are not error
72
80
  | `offset` | number or [number, number] | |
73
81
  | `align` | number,string | |
74
82
  | `layer` | back \| front | |
75
- | `altitude` | number | |
83
+ | `altitude` | number | Height in the sky as a fraction of the height, for sky objects such as a sun or moon. Ground objects ignore it. |
76
84
  | `along` | number | 2.5d: position along the path, 0..1. |
77
85
  | `side` | left \| right | 2.5d: which side of the path an `along` object stands on. |
78
86
  | `dist` | number | 2.5d: distance from the path for an `along` object. |
@@ -83,9 +91,12 @@ Generated by `pnpm skill:refs` from the Zod schema. Unknown fields are not error
83
91
  | `lift` | number | |
84
92
  | `hang` | number | |
85
93
  | `facing` | left \| right | |
94
+ | `variant` | number,string | Asset variant: number or name for an alternate visual style. |
86
95
  | `pose` | string | Person pose. See `scenec catalog poses`. |
87
96
  | `expr` | string | Person expression. |
88
97
  | `look` | string | Where a person looks: another object id, or left, right, up, down, camera. |
98
+ | `body` | chibi \| standard \| long | Person proportions: chibi, standard or long. |
99
+ | `detail` | low \| mid \| high | How much is drawn: low drops small parts, high adds highlights and texture. Defaults: focus high, far low, else mid. |
89
100
  | `haze` | boolean | |
90
101
  | `light` | boolean | |
91
102
  | `kit` | boolean | |
@@ -103,7 +114,14 @@ Generated by `pnpm skill:refs` from the Zod schema. Unknown fields are not error
103
114
  | `y` | number | |
104
115
  | `x` | number | |
105
116
  | `color` | string | |
117
+ | `font` | sans \| serif \| hand | Font family: sans, serif or hand. |
106
118
  | `box` | string | Background color behind the text. |
119
+ | `box_style` | rect \| highlight \| pill \| sticker \| underline | Caption container style: rect, highlight, pill, sticker or underline. |
120
+ | `emphasis` | string[] | Key words to underline in the underline style. |
121
+ | `tracking` | number | Letter spacing in em. |
122
+ | `wrap` | integer | Max line width in characters to wrap text. |
123
+ | `balance` | boolean | Balance line lengths for multi-line titles. |
124
+ | `rotation` | number | Rotation angle in degrees (for sticker style). |
107
125
  | `pad` | number | |
108
126
  | `radius` | number | |
109
127
  | `weight` | number | |
@@ -1,101 +0,0 @@
1
- import { PixelUtil } from "../Utils/PixelUtil.js";
2
- class ContactCritiqueService {
3
- static MIN_AREA = 30;
4
- static NEAR_DISTANCE = 3;
5
- static DILATION = 2;
6
- static OPAQUE_ALPHA = 128;
7
- static MIN_NEAR_PIXELS = 4;
8
- static MAX_OVERLAP_PIXELS = 2;
9
- static MAX_OVERLAP_SHARE = 0.01;
10
- static MAX_EDGE_GAP = 2;
11
- static critique(raster) {
12
- const candidates = raster.objects.filter(
13
- (object) => object.area >= ContactCritiqueService.MIN_AREA && object.kind !== "floor"
14
- );
15
- return [
16
- ...ContactCritiqueService.tangencies(raster, candidates),
17
- ...candidates.flatMap((object) => ContactCritiqueService.edgeTouches(raster, object))
18
- ];
19
- }
20
- static tangencies(raster, candidates) {
21
- const dilated = candidates.map((object) => ContactCritiqueService.dilate(raster, object));
22
- const messages = [];
23
- candidates.forEach((first, firstIndex) => {
24
- const firstDilated = dilated[firstIndex] ?? new Uint8Array(0);
25
- for (const second of candidates.slice(firstIndex + 1)) {
26
- if (ContactCritiqueService.isTangent(raster, { first, second, firstDilated })) {
27
- messages.push(
28
- `'${first.id}' and '${second.id}' almost touch (tangency); move them apart a little or overlap them on purpose`
29
- );
30
- }
31
- }
32
- });
33
- return messages;
34
- }
35
- static isTangent(raster, pair) {
36
- const { first, second } = pair;
37
- const isRelated = first.related.includes(second.id) || second.related.includes(first.id);
38
- if (isRelated || !ContactCritiqueService.boxesAreClose(first, second)) {
39
- return false;
40
- }
41
- const { near, overlap } = ContactCritiqueService.countContacts(raster, pair);
42
- const allowedOverlap = Math.max(
43
- ContactCritiqueService.MAX_OVERLAP_PIXELS,
44
- ContactCritiqueService.MAX_OVERLAP_SHARE * Math.min(first.area, second.area)
45
- );
46
- return near >= ContactCritiqueService.MIN_NEAR_PIXELS && overlap <= allowedOverlap;
47
- }
48
- static boxesAreClose(first, second) {
49
- const distance = ContactCritiqueService.NEAR_DISTANCE;
50
- const isApartHorizontally = first.box.right + distance < second.box.left || second.box.right + distance < first.box.left;
51
- const isApartVertically = first.box.bottom + distance < second.box.top || second.box.bottom + distance < first.box.top;
52
- return !isApartHorizontally && !isApartVertically;
53
- }
54
- static countContacts(raster, pair) {
55
- const { first, second, firstDilated } = pair;
56
- let near = 0;
57
- let overlap = 0;
58
- for (let index = 0; index < raster.pixelCount; index++) {
59
- if (PixelUtil.read(second.alpha, index) <= ContactCritiqueService.OPAQUE_ALPHA) {
60
- continue;
61
- }
62
- if (PixelUtil.read(first.alpha, index) > ContactCritiqueService.OPAQUE_ALPHA) {
63
- overlap++;
64
- } else if (PixelUtil.read(firstDilated, index) > 0) {
65
- near++;
66
- }
67
- }
68
- return { near, overlap };
69
- }
70
- static dilate(raster, object) {
71
- const dilated = new Uint8Array(raster.pixelCount);
72
- for (let index = 0; index < raster.pixelCount; index++) {
73
- if (PixelUtil.read(object.alpha, index) > ContactCritiqueService.OPAQUE_ALPHA) {
74
- const center = { row: Math.trunc(index / raster.width), column: index % raster.width };
75
- ContactCritiqueService.stamp(dilated, raster, center);
76
- }
77
- }
78
- return dilated;
79
- }
80
- static stamp(dilated, raster, center) {
81
- const reach = ContactCritiqueService.DILATION;
82
- const firstRow = Math.max(0, center.row - reach);
83
- const lastRow = Math.min(raster.height - 1, center.row + reach);
84
- const firstColumn = Math.max(0, center.column - reach);
85
- const lastColumn = Math.min(raster.width - 1, center.column + reach);
86
- for (let row = firstRow; row <= lastRow; row++) {
87
- dilated.fill(1, row * raster.width + firstColumn, row * raster.width + lastColumn + 1);
88
- }
89
- }
90
- static edgeTouches(raster, object) {
91
- const gaps = [
92
- ["left", object.box.left],
93
- ["right", raster.width - 1 - object.box.right],
94
- ["top", object.box.top]
95
- ];
96
- return gaps.filter(([, gap]) => gap > 0 && gap <= ContactCritiqueService.MAX_EDGE_GAP).map(([side]) => `'${object.id}' touches the edge (${side}); move it away from the edge or let it crop on purpose`);
97
- }
98
- }
99
- export {
100
- ContactCritiqueService
101
- };