@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
@@ -1,3 +1,4 @@
1
+ import { ShapeUtil } from "../../Utils/ShapeUtil.js";
1
2
  import { ColorUtil } from "../../Utils/ColorUtil.js";
2
3
  import { BaseAsset } from "./BaseAsset.js";
3
4
  class CloudAsset extends BaseAsset {
@@ -7,7 +8,8 @@ class CloudAsset extends BaseAsset {
7
8
  height = 50;
8
9
  tags = ["nuvem"];
9
10
  draw(params, theme) {
10
- return `<g fill="${theme.paper}" opacity="0.94"><circle cx="-28" cy="-15" r="15"/><circle cx="0" cy="-26" r="22"/><circle cx="28" cy="-15" r="15"/><rect x="-43" y="-15" width="86" height="15" rx="7"/></g><path d="M-43 -8 Q-43 0 -36 0 L36 0 Q43 0 43 -8 Z" fill="${ColorUtil.sh(theme.paper, -0.08)}" opacity="0.9"/>`;
11
+ const puffs = ShapeUtil.blob(-28, -15, 15, { seed: 31, lobes: 4, fill: theme.paper }) + ShapeUtil.blob(0, -26, 22, { seed: 32, lobes: 5, fill: theme.paper }) + ShapeUtil.blob(28, -15, 15, { seed: 33, lobes: 4, fill: theme.paper }) + ShapeUtil.rect(-43, -15, 86, 15, theme.paper, { rx: 7 });
12
+ return `<g opacity="0.94">${puffs}</g><path d="M-43 -8 Q-43 0 -36 0 L36 0 Q43 0 43 -8 Z" fill="${ColorUtil.sh(theme.paper, -0.08)}" opacity="0.9"/>`;
11
13
  }
12
14
  }
13
15
  export {
@@ -0,0 +1,10 @@
1
+ import type { AssetParams, Theme } from "../../Protocols/AssetProtocol.js";
2
+ import { BaseAsset } from "./BaseAsset.js";
3
+ export declare class ConfettiAsset extends BaseAsset {
4
+ readonly id = "confetti";
5
+ readonly kind = "sky";
6
+ readonly width = 80;
7
+ readonly height = 80;
8
+ readonly tags: string[];
9
+ draw(params: AssetParams, theme: Theme): string;
10
+ }
@@ -0,0 +1,18 @@
1
+ import { BaseAsset } from "./BaseAsset.js";
2
+ import { ShapeUtil } from "../../Utils/ShapeUtil.js";
3
+ class ConfettiAsset extends BaseAsset {
4
+ id = "confetti";
5
+ kind = "sky";
6
+ width = 80;
7
+ height = 80;
8
+ tags = ["confete", "confetes", "confetti", "party", "celebration", "streamers"];
9
+ draw(params, theme) {
10
+ const primary = theme.primary;
11
+ const accent = theme.accent;
12
+ const secondary = theme.secondary;
13
+ return ShapeUtil.rect(-30, -70, 8, 4, primary, { extra: 'transform="rotate(25 -30 -70)"' }) + ShapeUtil.rect(20, -65, 7, 4, accent, { extra: 'transform="rotate(-35 20 -65)"' }) + ShapeUtil.rect(-15, -45, 6, 3, secondary, { extra: 'transform="rotate(40 -15 -45)"' }) + ShapeUtil.rect(25, -35, 8, 4, primary, { extra: 'transform="rotate(15 25 -35)"' }) + ShapeUtil.rect(-35, -20, 7, 4, accent, { extra: 'transform="rotate(-20 -35 -20)"' }) + ShapeUtil.rect(5, -15, 6, 3, secondary, { extra: 'transform="rotate(30 5 -15)"' }) + ShapeUtil.circle(-5, -60, 2.5, accent) + ShapeUtil.circle(35, -50, 2, primary) + ShapeUtil.circle(-25, -35, 2, secondary) + ShapeUtil.circle(10, -40, 2.5, accent) + `<path d="M-20 -75 Q-10 -70 -12 -55" stroke="${accent}" stroke-width="1.8" fill="none"/><path d="M15 -70 Q25 -60 18 -45" stroke="${primary}" stroke-width="1.8" fill="none"/>`;
14
+ }
15
+ }
16
+ export {
17
+ ConfettiAsset
18
+ };
@@ -0,0 +1,11 @@
1
+ import type { AssetParams, Theme } from "../../Protocols/AssetProtocol.js";
2
+ import { BaseAsset } from "./BaseAsset.js";
3
+ export declare class CursorAsset extends BaseAsset {
4
+ readonly id = "cursor";
5
+ readonly kind = "wall";
6
+ readonly width = 32;
7
+ readonly height = 38;
8
+ readonly elevation = 90;
9
+ readonly tags: string[];
10
+ draw(params: AssetParams, theme: Theme): string;
11
+ }
@@ -0,0 +1,17 @@
1
+ import { BaseAsset } from "./BaseAsset.js";
2
+ class CursorAsset extends BaseAsset {
3
+ id = "cursor";
4
+ kind = "wall";
5
+ width = 32;
6
+ height = 38;
7
+ elevation = 90;
8
+ tags = ["cursor", "mouse_pointer", "pointer", "arrow", "mouse"];
9
+ draw(params, theme) {
10
+ const fill = theme.paper;
11
+ const stroke = theme.ink;
12
+ return `<path d="M-10 -36 L6 -24 L-1 -21 L3 -12 L-1 -10 L-5 -19 L-10 -15 Z" fill="${fill}" stroke="${stroke}" stroke-width="2.5" stroke-linejoin="round"/>`;
13
+ }
14
+ }
15
+ export {
16
+ CursorAsset
17
+ };
@@ -1,5 +1,6 @@
1
1
  import { ColorUtil } from "../../Utils/ColorUtil.js";
2
2
  import { BaseAsset } from "./BaseAsset.js";
3
+ import { DetailUtil } from "../../Utils/DetailUtil.js";
3
4
  import { ShapeUtil } from "../../Utils/ShapeUtil.js";
4
5
  class DeskAsset extends BaseAsset {
5
6
  id = "desk";
@@ -9,6 +10,10 @@ class DeskAsset extends BaseAsset {
9
10
  top = 46;
10
11
  tags = ["mesa de trabalho", "escrivaninha", "table_desk"];
11
12
  draw(params, theme) {
13
+ const rank = DetailUtil.rankOf(params.detail);
14
+ const hasParts = rank >= 1;
15
+ const hasTexture = rank >= 2;
16
+ const grain = hasTexture ? `<path d="M-50 -43.6 L-34 -43.6 M-20 -42.4 L-2 -42.4 M14 -43.6 L36 -43.6 M42 -42.4 L58 -42.4" stroke="${ColorUtil.sh(theme.wood, -0.14)}" stroke-width="0.6" stroke-linecap="round" fill="none"/><path d="M21.5 -35 L46.5 -35 L46.5 -22 L21.5 -22 Z" stroke="${ColorUtil.sh(theme.woodDark, -0.22)}" stroke-width="0.8" fill="none"/>` + ShapeUtil.rect(-57.5, -38, 1.5, 36, ColorUtil.sh(theme.woodDark, 0.15)) + ShapeUtil.rect(52.5, -38, 1.5, 36, ColorUtil.sh(theme.woodDark, 0.15)) : "";
12
17
  return ShapeUtil.shadow(theme, 68, 3.5) + ShapeUtil.rect(-58, -40, 6, 40, theme.woodDark) + ShapeUtil.rect(
13
18
  52,
14
19
  -40,
@@ -21,13 +26,13 @@ class DeskAsset extends BaseAsset {
21
26
  32,
22
27
  4,
23
28
  ColorUtil.sh(theme.woodDark, -0.2)
24
- ) + ShapeUtil.rect(30, -32, 8, 2.5, theme.accent, { rx: 1 }) + ShapeUtil.rect(-65, -46, 130, 7, theme.wood, { rx: 2 }) + ShapeUtil.rect(
29
+ ) + (hasParts ? ShapeUtil.rect(30, -32, 8, 2.5, theme.accent, { rx: 1 }) : "") + ShapeUtil.rect(-65, -46, 130, 7, theme.wood, { rx: 2 }) + ShapeUtil.rect(
25
30
  -65,
26
31
  -41,
27
32
  130,
28
33
  2,
29
34
  ColorUtil.sh(theme.wood, -0.22)
30
- ) + ShapeUtil.rect(-63, -46, 126, 1.5, ColorUtil.sh(theme.wood, 0.2));
35
+ ) + (hasParts ? ShapeUtil.rect(-63, -46, 126, 1.5, ColorUtil.sh(theme.wood, 0.2)) : "") + grain;
31
36
  }
32
37
  }
33
38
  export {
@@ -0,0 +1,10 @@
1
+ import type { AssetParams, Theme } from "../../Protocols/AssetProtocol.js";
2
+ import { BaseAsset } from "./BaseAsset.js";
3
+ export declare class FirstAidKitAsset extends BaseAsset {
4
+ readonly id = "first_aid_kit";
5
+ readonly kind = "surface";
6
+ readonly width = 38;
7
+ readonly height = 30;
8
+ readonly tags: string[];
9
+ draw(params: AssetParams, theme: Theme): string;
10
+ }
@@ -0,0 +1,19 @@
1
+ import { ColorUtil } from "../../Utils/ColorUtil.js";
2
+ import { BaseAsset } from "./BaseAsset.js";
3
+ import { ShapeUtil } from "../../Utils/ShapeUtil.js";
4
+ class FirstAidKitAsset extends BaseAsset {
5
+ id = "first_aid_kit";
6
+ kind = "surface";
7
+ width = 38;
8
+ height = 30;
9
+ tags = ["primeiros_socorros", "maleta_medica", "first_aid_kit", "medical_kit", "medicine_box"];
10
+ draw(params, theme) {
11
+ const boxColor = ShapeUtil.color(theme, params.color, theme.paper);
12
+ const red = "#E54D42";
13
+ const shade = ColorUtil.sh(boxColor, -0.12);
14
+ return ShapeUtil.rect(-19, -26, 38, 26, boxColor, { rx: 4 }) + ShapeUtil.rect(6, -26, 13, 26, shade, { rx: 4 }) + ShapeUtil.rect(-8, -30, 16, 4, theme.metal, { rx: 2 }) + ShapeUtil.rect(-19, -15, 38, 2, ColorUtil.sh(boxColor, -0.2)) + ShapeUtil.rect(-2, -19, 4, 10, red, { rx: 1 }) + ShapeUtil.rect(-5, -16, 10, 4, red, { rx: 1 });
15
+ }
16
+ }
17
+ export {
18
+ FirstAidKitAsset
19
+ };
@@ -0,0 +1,10 @@
1
+ import type { AssetParams, Theme } from "../../Protocols/AssetProtocol.js";
2
+ import { BaseAsset } from "./BaseAsset.js";
3
+ export declare class GlobeAsset extends BaseAsset {
4
+ readonly id = "globe";
5
+ readonly kind = "surface";
6
+ readonly width = 36;
7
+ readonly height = 50;
8
+ readonly tags: string[];
9
+ draw(params: AssetParams, theme: Theme): string;
10
+ }
@@ -0,0 +1,18 @@
1
+ import { BaseAsset } from "./BaseAsset.js";
2
+ import { ShapeUtil } from "../../Utils/ShapeUtil.js";
3
+ class GlobeAsset extends BaseAsset {
4
+ id = "globe";
5
+ kind = "surface";
6
+ width = 36;
7
+ height = 50;
8
+ tags = ["globo", "globo_terrestre", "globe", "earth", "world_map"];
9
+ draw(params, theme) {
10
+ const metal = theme.metal;
11
+ const ocean = ShapeUtil.color(theme, params.color, "#3B82F6");
12
+ const land = theme.accent;
13
+ return ShapeUtil.rect(-10, -4, 20, 4, metal, { rx: 2 }) + ShapeUtil.rect(-2, -14, 4, 10, metal) + `<path d="M0 -14 A16 16 0 0 1 -14 -32" stroke="${metal}" stroke-width="2.5" fill="none"/>` + ShapeUtil.circle(0, -32, 14, ocean) + `<path d="M-8 -36 Q-2 -42 4 -38 Q8 -34 2 -30 Q-6 -26 -8 -36 Z" fill="${land}"/><path d="M-4 -26 Q2 -22 6 -24 Q8 -20 2 -18 Z" fill="${land}"/>` + ShapeUtil.circle(0, -32, 14, "none", 'stroke="rgba(255,255,255,0.3)" stroke-width="1"');
14
+ }
15
+ }
16
+ export {
17
+ GlobeAsset
18
+ };
@@ -1,5 +1,6 @@
1
1
  import { ColorUtil } from "../../Utils/ColorUtil.js";
2
2
  import { BaseAsset } from "./BaseAsset.js";
3
+ import { DetailUtil } from "../../Utils/DetailUtil.js";
3
4
  import { ShapeUtil } from "../../Utils/ShapeUtil.js";
4
5
  class HouseAsset extends BaseAsset {
5
6
  id = "house";
@@ -10,8 +11,26 @@ class HouseAsset extends BaseAsset {
10
11
  draw(params, theme) {
11
12
  const body = ShapeUtil.color(theme, params.color, theme.primary);
12
13
  const roof = theme.secondary;
14
+ const rank = DetailUtil.rankOf(params.detail);
15
+ const hasParts = rank >= 1;
16
+ const isHigh = rank >= 2;
13
17
  const windows = [[-52, -80], [26, -80]];
14
- return ShapeUtil.shadow(theme, 88, 5) + ShapeUtil.rect(40, -150, 16, 32, theme.woodDark) + ShapeUtil.rect(
18
+ const shingles = isHigh ? `<path d="${[-105, -115, -125, -135, -145, -155].map((row) => {
19
+ const half = (170 + row) * 80 / 75 - 4;
20
+ return `M${-half} ${row} L${half} ${row}`;
21
+ }).join(" ")}" stroke="${ColorUtil.sh(roof, -0.22)}" stroke-width="0.8" fill="none" stroke-linecap="round"/>` : "";
22
+ const siding = isHigh ? `<path d="M-63 -88 L63 -88 M-63 -76 L-54 -76 M-24 -76 L24 -76 M-63 -52 L-17 -52 M17 -52 L63 -52 M-63 -40 L-17 -40 M17 -40 L63 -40 M-63 -28 L-17 -28 M17 -28 L63 -28 M-63 -16 L-17 -16 M17 -16 L63 -16" stroke="${ColorUtil.sh(body, -0.12)}" stroke-width="0.6" fill="none"/>` : "";
23
+ const door = isHigh ? `<path d="M-10 -48 L-2 -48 L-2 -30 L-10 -30 Z M-10 -26 L-2 -26 L-2 -8 L-10 -8 Z" stroke="${ColorUtil.sh(theme.woodDark, -0.25)}" stroke-width="0.8" fill="none"/>` : "";
24
+ const glass = (posX, posY) => {
25
+ const sheen = hasParts ? `<path d="M${posX + 4} ${posY + 18} L${posX + 14} ${posY + 4}" stroke="${theme.paper}" stroke-width="2.5" opacity="0.6"/>` : "";
26
+ const mullion = isHigh ? `<path d="M${posX + 13} ${posY} L${posX + 13} ${posY + 24} M${posX} ${posY + 12} L${posX + 26} ${posY + 12}" stroke="${theme.paper}" stroke-width="1.5"/>` : "";
27
+ const sill = hasParts ? ShapeUtil.rect(posX - 3, posY + 24, 32, 3, theme.paper, { rx: 1 }) : "";
28
+ return ShapeUtil.rect(posX, posY, 26, 24, theme.glass, {
29
+ rx: 2,
30
+ extra: `stroke="${theme.paper}" stroke-width="3"`
31
+ }) + sheen + mullion + sill;
32
+ };
33
+ return ShapeUtil.shadow(theme, 88, 5) + (hasParts ? ShapeUtil.rect(40, -150, 16, 32, theme.woodDark) + ShapeUtil.rect(
15
34
  48,
16
35
  -150,
17
36
  8,
@@ -24,17 +43,14 @@ class HouseAsset extends BaseAsset {
24
43
  6,
25
44
  ColorUtil.sh(theme.woodDark, -0.1),
26
45
  { rx: 1 }
27
- ) + ShapeUtil.rect(-65, -100, 130, 100, body) + ShapeUtil.rect(25, -100, 40, 100, ColorUtil.sh(body, -0.12)) + `<path d="M-65 -100 L65 -100 L65 -92 L-65 -92 Z" fill="${ColorUtil.sh(body, -0.28)}" opacity="0.6"/><path d="M-80 -95 L0 -170 L80 -95 Z" fill="${roof}"/><path d="M0 -170 L80 -95 L40 -95 Z" fill="${ColorUtil.sh(roof, -0.18)}"/><path d="M-84 -92 L0 -172 L84 -92" stroke="${ColorUtil.sh(roof, -0.3)}" stroke-width="5" fill="none" stroke-linejoin="round" stroke-linecap="round"/>` + ShapeUtil.rect(-15, -56, 30, 56, theme.woodDark, { rx: 3 }) + ShapeUtil.rect(
46
+ ) : ShapeUtil.rect(40, -150, 16, 32, theme.woodDark)) + ShapeUtil.rect(-65, -100, 130, 100, body) + ShapeUtil.rect(25, -100, 40, 100, ColorUtil.sh(body, -0.12)) + siding + `<path d="M-65 -100 L65 -100 L65 -92 L-65 -92 Z" fill="${ColorUtil.sh(body, -0.28)}" opacity="0.6"/><path d="M-80 -95 L0 -170 L80 -95 Z" fill="${roof}"/><path d="M0 -170 L80 -95 L40 -95 Z" fill="${ColorUtil.sh(roof, -0.18)}"/>` + shingles + (hasParts ? `<path d="M-84 -92 L0 -172 L84 -92" stroke="${ColorUtil.sh(roof, -0.3)}" stroke-width="5" fill="none" stroke-linejoin="round" stroke-linecap="round"/>` : "") + ShapeUtil.rect(-15, -56, 30, 56, theme.woodDark, { rx: 3 }) + ShapeUtil.rect(
28
47
  2,
29
48
  -56,
30
49
  13,
31
50
  56,
32
51
  ColorUtil.sh(theme.woodDark, -0.15),
33
52
  { rx: 0 }
34
- ) + ShapeUtil.circle(9, -28, 2, theme.accent) + ShapeUtil.rect(-19, -2, 38, 3, ColorUtil.sh(body, -0.35)) + windows.map(([posX, posY]) => ShapeUtil.rect(posX, posY, 26, 24, theme.glass, {
35
- rx: 2,
36
- extra: `stroke="${theme.paper}" stroke-width="3"`
37
- }) + `<path d="M${posX + 4} ${posY + 18} L${posX + 14} ${posY + 4}" stroke="${theme.paper}" stroke-width="2.5" opacity="0.6"/>` + ShapeUtil.rect(posX - 3, posY + 24, 32, 3, theme.paper, { rx: 1 })).join("") + ShapeUtil.circle(0, -122, 9, theme.glass, `stroke="${theme.paper}" stroke-width="3"`);
53
+ ) + (hasParts ? ShapeUtil.circle(9, -28, 2, theme.accent) : "") + door + (hasParts ? ShapeUtil.rect(-19, -2, 38, 3, ColorUtil.sh(body, -0.35)) : "") + windows.map(([posX, posY]) => glass(posX, posY)).join("") + ShapeUtil.circle(0, -122, 9, theme.glass, `stroke="${theme.paper}" stroke-width="3"`);
38
54
  }
39
55
  }
40
56
  export {
@@ -1,5 +1,6 @@
1
1
  import { ColorUtil } from "../../Utils/ColorUtil.js";
2
2
  import { BaseAsset } from "./BaseAsset.js";
3
+ import { DetailUtil } from "../../Utils/DetailUtil.js";
3
4
  import { ShapeUtil } from "../../Utils/ShapeUtil.js";
4
5
  class LaptopAsset extends BaseAsset {
5
6
  id = "laptop";
@@ -9,13 +10,16 @@ class LaptopAsset extends BaseAsset {
9
10
  tags = ["notebook", "computador", "computer"];
10
11
  draw(params, theme) {
11
12
  const flip = ShapeUtil.directionOf(params.facing);
13
+ const rank = DetailUtil.rankOf(params.detail);
14
+ const sheen = rank >= 1 ? `<path d="M${-flip * 13} -5 L${-flip * 16.5} -23" stroke="${theme.glass}" stroke-width="1.6" stroke-linecap="round" opacity="0.9"/>` : "";
15
+ const keys = rank >= 2 ? `<path d="M-13 -1.9 L13 -1.9" stroke="${ColorUtil.sh(theme.metal, 0.35)}" stroke-width="0.7" stroke-dasharray="1.2 0.8" fill="none"/><path d="M${-flip * 11} -9 L${-flip * 13} -16" stroke="${theme.paper}" stroke-width="0.8" stroke-linecap="round" opacity="0.5"/>` : "";
12
16
  return ShapeUtil.rect(-17, -3, 34, 3, theme.metal, { rx: 1.5 }) + ShapeUtil.rect(
13
17
  -17,
14
18
  -1.5,
15
19
  34,
16
20
  1.5,
17
21
  ColorUtil.sh(theme.metal, -0.25)
18
- ) + `<path d="M${-flip * 15} -3 L${-flip * 19} -25" stroke="${theme.ink}" stroke-width="3.5" stroke-linecap="round"/><path d="M${-flip * 13} -5 L${-flip * 16.5} -23" stroke="${theme.glass}" stroke-width="1.6" stroke-linecap="round" opacity="0.9"/>`;
22
+ ) + `<path d="M${-flip * 15} -3 L${-flip * 19} -25" stroke="${theme.ink}" stroke-width="3.5" stroke-linecap="round"/>` + sheen + keys;
19
23
  }
20
24
  }
21
25
  export {
@@ -9,7 +9,7 @@ class PlantAsset extends BaseAsset {
9
9
  tags = ["planta", "vaso", "plant_pot"];
10
10
  draw(params, theme) {
11
11
  const [first, second] = theme.foliage;
12
- return `<path d="M0 -16 Q-18 -30 -14 -46 Q-4 -32 0 -16 Z" fill="${first}"/><path d="M0 -16 Q16 -28 15 -42 Q3 -32 0 -16 Z" fill="${second}"/><path d="M0 -16 Q-2 -36 3 -48 Q6 -34 0 -16 Z" fill="${ColorUtil.sh(first, -0.12)}"/><path d="M-11 -16 L11 -16 L8 0 L-8 0 Z" fill="${theme.primary}"/><path d="M2 -16 L11 -16 L8 0 L2 0 Z" fill="${ColorUtil.sh(theme.primary, -0.15)}"/>` + ShapeUtil.rect(-12, -18, 24, 4, ColorUtil.sh(theme.primary, -0.08), { rx: 1 });
12
+ return ShapeUtil.blob(0, -31, 11, { seed: 41, lobes: 4, squash: 1.1, fill: ColorUtil.sh(first, -0.2), extra: 'opacity="0.55"' }) + `<path d="M0 -16 Q-18 -30 -14 -46 Q-4 -32 0 -16 Z" fill="${first}"/><path d="M0 -16 Q16 -28 15 -42 Q3 -32 0 -16 Z" fill="${second}"/><path d="M0 -16 Q-2 -36 3 -48 Q6 -34 0 -16 Z" fill="${ColorUtil.sh(first, -0.12)}"/><path d="M-11 -16 L11 -16 L8 0 L-8 0 Z" fill="${theme.primary}"/><path d="M2 -16 L11 -16 L8 0 L2 0 Z" fill="${ColorUtil.sh(theme.primary, -0.15)}"/>` + ShapeUtil.rect(-12, -18, 24, 4, ColorUtil.sh(theme.primary, -0.08), { rx: 1 });
13
13
  }
14
14
  }
15
15
  export {
@@ -0,0 +1,11 @@
1
+ import type { AssetParams, Theme } from "../../Protocols/AssetProtocol.js";
2
+ import { BaseAsset } from "./BaseAsset.js";
3
+ export declare class PodiumAsset extends BaseAsset {
4
+ readonly id = "podium";
5
+ readonly kind = "ground";
6
+ readonly width = 50;
7
+ readonly height = 95;
8
+ readonly top = 95;
9
+ readonly tags: string[];
10
+ draw(params: AssetParams, theme: Theme): string;
11
+ }
@@ -0,0 +1,20 @@
1
+ import { ColorUtil } from "../../Utils/ColorUtil.js";
2
+ import { BaseAsset } from "./BaseAsset.js";
3
+ import { ShapeUtil } from "../../Utils/ShapeUtil.js";
4
+ class PodiumAsset extends BaseAsset {
5
+ id = "podium";
6
+ kind = "ground";
7
+ width = 50;
8
+ height = 95;
9
+ top = 95;
10
+ tags = ["pulpito", "podio", "podium", "lectern", "speech", "stage_stand"];
11
+ draw(params, theme) {
12
+ const wood = ShapeUtil.color(theme, params.color, theme.woodDark);
13
+ const shade = ColorUtil.sh(wood, -0.2);
14
+ const mic = theme.metal;
15
+ return ShapeUtil.shadow(theme, 26, 4) + ShapeUtil.rect(-22, -10, 44, 10, wood, { rx: 2 }) + `<path d="M-16 -10 L-12 -80 L12 -80 L16 -10 Z" fill="${wood}"/><path d="M0 -10 L2 -80 L12 -80 L16 -10 Z" fill="${shade}"/>` + ShapeUtil.rect(-25, -88, 50, 10, wood, { rx: 3 }) + ShapeUtil.rect(-15, -92, 30, 4, theme.paper, { rx: 1 }) + `<path d="M12 -88 Q18 -100 14 -106" stroke="${mic}" stroke-width="2" fill="none"/>` + ShapeUtil.circle(14, -107, 3, mic);
16
+ }
17
+ }
18
+ export {
19
+ PodiumAsset
20
+ };
@@ -0,0 +1,11 @@
1
+ import type { AssetParams, Theme } from "../../Protocols/AssetProtocol.js";
2
+ import { BaseAsset } from "./BaseAsset.js";
3
+ export declare class RefrigeratorAsset extends BaseAsset {
4
+ readonly id = "refrigerator";
5
+ readonly kind = "ground";
6
+ readonly width = 64;
7
+ readonly height = 150;
8
+ readonly top = 150;
9
+ readonly tags: string[];
10
+ draw(params: AssetParams, theme: Theme): string;
11
+ }
@@ -0,0 +1,21 @@
1
+ import { ColorUtil } from "../../Utils/ColorUtil.js";
2
+ import { BaseAsset } from "./BaseAsset.js";
3
+ import { ShapeUtil } from "../../Utils/ShapeUtil.js";
4
+ class RefrigeratorAsset extends BaseAsset {
5
+ id = "refrigerator";
6
+ kind = "ground";
7
+ width = 64;
8
+ height = 150;
9
+ top = 150;
10
+ tags = ["geladeira", "fridge", "freezer", "refrigerator", "refrigerador"];
11
+ draw(params, theme) {
12
+ const mainColor = ShapeUtil.color(theme, params.color, theme.metal);
13
+ const shade = ColorUtil.sh(mainColor, -0.15);
14
+ const dark = ColorUtil.sh(mainColor, -0.3);
15
+ const handleColor = ColorUtil.sh(theme.metal, 0.2);
16
+ return ShapeUtil.shadow(theme, 32, 4) + ShapeUtil.rect(-32, -150, 64, 150, mainColor, { rx: 6 }) + ShapeUtil.rect(14, -150, 18, 150, shade, { rx: 6 }) + ShapeUtil.rect(-32, -100, 64, 2, dark) + ShapeUtil.rect(-26, -135, 4, 24, handleColor, { rx: 2 }) + ShapeUtil.rect(-26, -90, 4, 40, handleColor, { rx: 2 }) + ShapeUtil.rect(-10, -140, 16, 6, dark, { rx: 2 });
17
+ }
18
+ }
19
+ export {
20
+ RefrigeratorAsset
21
+ };
@@ -0,0 +1,11 @@
1
+ import type { AssetParams, Theme } from "../../Protocols/AssetProtocol.js";
2
+ import { BaseAsset } from "./BaseAsset.js";
3
+ export declare class SinkAsset extends BaseAsset {
4
+ readonly id = "sink";
5
+ readonly kind = "ground";
6
+ readonly width = 70;
7
+ readonly height = 90;
8
+ readonly top = 90;
9
+ readonly tags: string[];
10
+ draw(params: AssetParams, theme: Theme): string;
11
+ }
@@ -0,0 +1,21 @@
1
+ import { ColorUtil } from "../../Utils/ColorUtil.js";
2
+ import { BaseAsset } from "./BaseAsset.js";
3
+ import { ShapeUtil } from "../../Utils/ShapeUtil.js";
4
+ class SinkAsset extends BaseAsset {
5
+ id = "sink";
6
+ kind = "ground";
7
+ width = 70;
8
+ height = 90;
9
+ top = 90;
10
+ tags = ["pia", "sink", "faucet", "torneira", "kitchen_sink"];
11
+ draw(params, theme) {
12
+ const baseColor = ShapeUtil.color(theme, params.color, theme.woodDark);
13
+ const counterColor = ColorUtil.sh(theme.metal, 0.1);
14
+ const basinColor = ColorUtil.sh(theme.metal, -0.2);
15
+ const faucetColor = ColorUtil.sh(theme.metal, 0.25);
16
+ return ShapeUtil.shadow(theme, 35, 4) + ShapeUtil.rect(-35, -84, 70, 84, baseColor, { rx: 3 }) + ShapeUtil.rect(-33, -80, 31, 76, ColorUtil.sh(baseColor, -0.1), { rx: 2 }) + ShapeUtil.rect(2, -80, 31, 76, ColorUtil.sh(baseColor, -0.1), { rx: 2 }) + ShapeUtil.rect(-5, -45, 2, 12, theme.metal, { rx: 1 }) + ShapeUtil.rect(3, -45, 2, 12, theme.metal, { rx: 1 }) + ShapeUtil.rect(-36, -90, 72, 6, counterColor, { rx: 2 }) + ShapeUtil.rect(-18, -89, 36, 4, basinColor, { rx: 1 }) + `<path d="M0 -90 L0 -106 Q0 -114 8 -114 Q16 -114 16 -106 L16 -102" stroke="${faucetColor}" stroke-width="3" fill="none" stroke-linecap="round"/>` + ShapeUtil.rect(-3, -93, 6, 3, faucetColor, { rx: 1 });
17
+ }
18
+ }
19
+ export {
20
+ SinkAsset
21
+ };
@@ -7,5 +7,10 @@ export declare class SofaAsset extends BaseAsset {
7
7
  readonly height = 72;
8
8
  readonly seat = 36;
9
9
  readonly tags: string[];
10
+ readonly variants: string[];
11
+ private static readonly VARIANT_TO_DRAWER;
10
12
  draw(params: AssetParams, theme: Theme): string;
13
+ private drawDefault;
14
+ private drawCurved;
15
+ private drawMinimal;
11
16
  }
@@ -1,5 +1,7 @@
1
1
  import { ColorUtil } from "../../Utils/ColorUtil.js";
2
2
  import { BaseAsset } from "./BaseAsset.js";
3
+ import { DetailUtil } from "../../Utils/DetailUtil.js";
4
+ import { IdUtil } from "../../Utils/IdUtil.js";
3
5
  import { ShapeUtil } from "../../Utils/ShapeUtil.js";
4
6
  class SofaAsset extends BaseAsset {
5
7
  id = "sofa";
@@ -8,8 +10,24 @@ class SofaAsset extends BaseAsset {
8
10
  height = 72;
9
11
  seat = 36;
10
12
  tags = ["sof\xE1", "sofa", "couch"];
13
+ variants = ["2", "curved", "3", "minimal"];
14
+ static VARIANT_TO_DRAWER = {
15
+ 2: (asset, params, theme) => asset.drawCurved(params, theme),
16
+ curved: (asset, params, theme) => asset.drawCurved(params, theme),
17
+ 3: (asset, params, theme) => asset.drawMinimal(params, theme),
18
+ minimal: (asset, params, theme) => asset.drawMinimal(params, theme)
19
+ };
11
20
  draw(params, theme) {
21
+ const variantKey = String(params.variant ?? "");
22
+ const drawer = IdUtil.lookup(SofaAsset.VARIANT_TO_DRAWER, variantKey);
23
+ return drawer ? drawer(this, params, theme) : this.drawDefault(params, theme);
24
+ }
25
+ drawDefault(params, theme) {
12
26
  const mainColor = ShapeUtil.color(theme, params.color, theme.secondary), darker = ColorUtil.sh(mainColor, -0.15);
27
+ const rank = DetailUtil.rankOf(params.detail);
28
+ const hasParts = rank >= 1;
29
+ const light = ColorUtil.sh(mainColor, 0.12);
30
+ const texture = rank >= 2 ? ShapeUtil.rect(-66, -66, 62, 3, light, { rx: 1.5 }) + ShapeUtil.rect(4, -66, 62, 3, light, { rx: 1.5 }) + `<path d="M-70 -30 L-56 -30 M-40 -29 L-26 -29 M-10 -30 L4 -30 M26 -29 L40 -29 M56 -30 L70 -30" stroke="${ColorUtil.sh(mainColor, -0.12)}" stroke-width="0.7" stroke-linecap="round" fill="none"/><path d="M-56 -58 L-36 -46 M-52 -62 L-32 -50" stroke="${ColorUtil.sh(theme.accent, 0.2)}" stroke-width="1.2" stroke-linecap="round" transform="rotate(-8 -46 -50)"/>` + ShapeUtil.rect(-84, -36, 16, 1.2, ColorUtil.sh(darker, -0.15)) + ShapeUtil.rect(68, -36, 16, 1.2, ColorUtil.sh(darker, -0.15)) : "";
13
31
  return ShapeUtil.shadow(theme, 86, 4.5) + ShapeUtil.rect(-70, -8, 6, 8, theme.woodDark) + ShapeUtil.rect(
14
32
  64,
15
33
  -8,
@@ -23,14 +41,24 @@ class SofaAsset extends BaseAsset {
23
41
  34,
24
42
  mainColor,
25
43
  { rx: 10 }
26
- ) + ShapeUtil.rect(2, -68, 66, 34, mainColor, { rx: 10 }) + ShapeUtil.rect(-80, -40, 160, 32, mainColor, { rx: 8 }) + ShapeUtil.rect(-80, -18, 160, 10, darker, { rx: 6 }) + ShapeUtil.rect(-86, -56, 20, 50, darker, { rx: 9 }) + ShapeUtil.rect(66, -56, 20, 50, darker, { rx: 9 }) + ShapeUtil.rect(-86, -56, 20, 8, ColorUtil.sh(mainColor, 0.1), { rx: 6 }) + ShapeUtil.rect(
44
+ ) + ShapeUtil.rect(2, -68, 66, 34, mainColor, { rx: 10 }) + ShapeUtil.rect(-80, -40, 160, 32, mainColor, { rx: 8 }) + ShapeUtil.rect(-80, -18, 160, 10, darker, { rx: 6 }) + ShapeUtil.rect(-86, -56, 20, 50, darker, { rx: 9 }) + ShapeUtil.rect(66, -56, 20, 50, darker, { rx: 9 }) + (hasParts ? ShapeUtil.rect(-86, -56, 20, 8, ColorUtil.sh(mainColor, 0.1), { rx: 6 }) + ShapeUtil.rect(
27
45
  66,
28
46
  -56,
29
47
  20,
30
48
  8,
31
49
  ColorUtil.sh(mainColor, 0.1),
32
50
  { rx: 6 }
33
- ) + ShapeUtil.rect(-60, -62, 28, 24, theme.accent, { rx: 6, extra: 'transform="rotate(-8 -46 -50)"' }) + ShapeUtil.rect(-50, -40, 100, 2, ColorUtil.sh(mainColor, -0.3));
51
+ ) + ShapeUtil.rect(-60, -62, 28, 24, theme.accent, { rx: 6, extra: 'transform="rotate(-8 -46 -50)"' }) + ShapeUtil.rect(-50, -40, 100, 2, ColorUtil.sh(mainColor, -0.3)) : "") + texture;
52
+ }
53
+ drawCurved(params, theme) {
54
+ const mainColor = ShapeUtil.color(theme, params.color, theme.secondary);
55
+ const darker = ColorUtil.sh(mainColor, -0.18);
56
+ return ShapeUtil.shadow(theme, 84, 4.5) + ShapeUtil.rect(-65, -8, 8, 8, theme.metal, { rx: 2 }) + ShapeUtil.rect(57, -8, 8, 8, theme.metal, { rx: 2 }) + ShapeUtil.rect(-75, -70, 150, 45, darker, { rx: 22 }) + ShapeUtil.rect(-68, -64, 136, 36, mainColor, { rx: 18 }) + ShapeUtil.rect(-80, -38, 160, 32, mainColor, { rx: 16 }) + ShapeUtil.rect(-85, -48, 18, 42, darker, { rx: 9 }) + ShapeUtil.rect(67, -48, 18, 42, darker, { rx: 9 });
57
+ }
58
+ drawMinimal(params, theme) {
59
+ const mainColor = ShapeUtil.color(theme, params.color, theme.secondary);
60
+ const darker = ColorUtil.sh(mainColor, -0.15);
61
+ return ShapeUtil.shadow(theme, 80, 4) + ShapeUtil.rect(-60, -14, 4, 14, theme.metal) + ShapeUtil.rect(56, -14, 4, 14, theme.metal) + ShapeUtil.rect(-75, -60, 150, 35, darker, { rx: 4 }) + ShapeUtil.rect(-70, -56, 140, 28, mainColor, { rx: 3 }) + ShapeUtil.rect(-75, -28, 150, 16, mainColor, { rx: 4 });
34
62
  }
35
63
  }
36
64
  export {
@@ -7,5 +7,11 @@ export declare class StarsAsset extends BaseAsset {
7
7
  readonly width = 600;
8
8
  readonly height = 200;
9
9
  readonly tags: string[];
10
+ private static readonly POINTS;
11
+ private static readonly LARGE_RADIUS;
12
+ private static readonly SMALL_RADIUS;
13
+ private static readonly MAX_ALTITUDE;
14
+ private static readonly BASE_OPACITY;
15
+ private static readonly CYCLE;
10
16
  draw(params: AssetParams, theme: Theme): string;
11
17
  }
@@ -7,32 +7,45 @@ class StarsAsset extends BaseAsset {
7
7
  width = 600;
8
8
  height = 200;
9
9
  tags = ["c\xE9u estrelado", "starfield"];
10
+ static POINTS = [
11
+ [-280, -180],
12
+ [-230, -165],
13
+ [-170, -190],
14
+ [-120, -175],
15
+ [-60, -185],
16
+ [0, -170],
17
+ [60, -190],
18
+ [120, -165],
19
+ [180, -185],
20
+ [240, -175],
21
+ [285, -190],
22
+ [-250, -140],
23
+ [-180, -125],
24
+ [-100, -135],
25
+ [-30, -145],
26
+ [40, -130],
27
+ [130, -140],
28
+ [210, -125],
29
+ [270, -145],
30
+ [-210, -90],
31
+ [-80, -85],
32
+ [80, -95],
33
+ [200, -80],
34
+ [-150, -50],
35
+ [140, -45]
36
+ ];
37
+ static LARGE_RADIUS = 2.2;
38
+ static SMALL_RADIUS = 1.3;
39
+ static MAX_ALTITUDE = 200;
40
+ static BASE_OPACITY = 0.5;
41
+ static CYCLE = 3;
10
42
  draw(params, theme) {
11
43
  let svg = "";
12
- const pts = [
13
- [-280, -170],
14
- [-210, -60],
15
- [-150, -140],
16
- [-90, -30],
17
- [-30, -180],
18
- [40, -90],
19
- [110, -160],
20
- [170, -40],
21
- [230, -130],
22
- [290, -190],
23
- [-250, -110],
24
- [70, -20],
25
- [-120, -190],
26
- [200, -100]
27
- ];
28
- pts.forEach(([posX, posY], index) => {
29
- svg += ShapeUtil.circle(
30
- posX,
31
- posY,
32
- index % 3 === 0 ? 2.2 : 1.3,
33
- theme.paper,
34
- `opacity="${0.5 + index % 4 * 0.12}"`
35
- );
44
+ StarsAsset.POINTS.forEach(([posX, posY], index) => {
45
+ const altitude = Math.abs(posY) / StarsAsset.MAX_ALTITUDE;
46
+ const opacity = Math.min(1, altitude ** 1.2 * (StarsAsset.BASE_OPACITY + index % StarsAsset.CYCLE * 0.2));
47
+ const radius = index % StarsAsset.CYCLE === 0 ? StarsAsset.LARGE_RADIUS : StarsAsset.SMALL_RADIUS;
48
+ svg += ShapeUtil.circle(posX, posY, radius, theme.paper, `opacity="${opacity.toFixed(2)}"`);
36
49
  });
37
50
  return svg;
38
51
  }
@@ -0,0 +1,10 @@
1
+ import type { AssetParams, Theme } from "../../Protocols/AssetProtocol.js";
2
+ import { BaseAsset } from "./BaseAsset.js";
3
+ export declare class StethoscopeAsset extends BaseAsset {
4
+ readonly id = "stethoscope";
5
+ readonly kind = "surface";
6
+ readonly width = 36;
7
+ readonly height = 38;
8
+ readonly tags: string[];
9
+ draw(params: AssetParams, theme: Theme): string;
10
+ }
@@ -0,0 +1,18 @@
1
+ import { ColorUtil } from "../../Utils/ColorUtil.js";
2
+ import { BaseAsset } from "./BaseAsset.js";
3
+ import { ShapeUtil } from "../../Utils/ShapeUtil.js";
4
+ class StethoscopeAsset extends BaseAsset {
5
+ id = "stethoscope";
6
+ kind = "surface";
7
+ width = 36;
8
+ height = 38;
9
+ tags = ["estetoscopio", "stethoscope", "doctor", "health", "medical"];
10
+ draw(params, theme) {
11
+ const tubeColor = ShapeUtil.color(theme, params.color, theme.secondary);
12
+ const metalColor = theme.metal;
13
+ return `<path d="M-12 -36 L-12 -28 Q-12 -18 0 -18 Q12 -18 12 -28 L12 -36" stroke="${metalColor}" stroke-width="2.5" fill="none" stroke-linecap="round"/>` + ShapeUtil.circle(-12, -37, 2, theme.ink) + ShapeUtil.circle(12, -37, 2, theme.ink) + `<path d="M0 -18 Q0 -6 10 -4 Q18 -2 14 0" stroke="${tubeColor}" stroke-width="3" fill="none" stroke-linecap="round"/>` + ShapeUtil.circle(14, 0, 5, metalColor) + ShapeUtil.circle(14, 0, 3, ColorUtil.sh(metalColor, -0.25));
14
+ }
15
+ }
16
+ export {
17
+ StethoscopeAsset
18
+ };
@@ -0,0 +1,11 @@
1
+ import type { AssetParams, Theme } from "../../Protocols/AssetProtocol.js";
2
+ import { BaseAsset } from "./BaseAsset.js";
3
+ export declare class StoveAsset extends BaseAsset {
4
+ readonly id = "stove";
5
+ readonly kind = "ground";
6
+ readonly width = 60;
7
+ readonly height = 90;
8
+ readonly top = 90;
9
+ readonly tags: string[];
10
+ draw(params: AssetParams, theme: Theme): string;
11
+ }
@@ -0,0 +1,20 @@
1
+ import { ColorUtil } from "../../Utils/ColorUtil.js";
2
+ import { BaseAsset } from "./BaseAsset.js";
3
+ import { ShapeUtil } from "../../Utils/ShapeUtil.js";
4
+ class StoveAsset extends BaseAsset {
5
+ id = "stove";
6
+ kind = "ground";
7
+ width = 60;
8
+ height = 90;
9
+ top = 90;
10
+ tags = ["fog\xE3o", "fogao", "stove", "oven", "cooker", "cooktop"];
11
+ draw(params, theme) {
12
+ const mainColor = ShapeUtil.color(theme, params.color, theme.metal);
13
+ const dark = ColorUtil.sh(mainColor, -0.25);
14
+ const burner = ColorUtil.sh(theme.metal, -0.4);
15
+ return ShapeUtil.shadow(theme, 30, 4) + ShapeUtil.rect(-30, -90, 60, 90, mainColor, { rx: 4 }) + ShapeUtil.rect(-26, -86, 52, 6, dark, { rx: 2 }) + ShapeUtil.circle(-18, -83, 2, theme.accent) + ShapeUtil.circle(-6, -83, 2, theme.metal) + ShapeUtil.circle(6, -83, 2, theme.metal) + ShapeUtil.circle(18, -83, 2, theme.accent) + ShapeUtil.rect(-24, -72, 48, 48, dark, { rx: 3 }) + ShapeUtil.rect(-20, -68, 40, 40, ColorUtil.sh(dark, -0.3), { rx: 2 }) + ShapeUtil.rect(-16, -74, 32, 3, theme.metal, { rx: 1 }) + ShapeUtil.circle(-14, -90, 6, burner) + ShapeUtil.circle(14, -90, 6, burner);
16
+ }
17
+ }
18
+ export {
19
+ StoveAsset
20
+ };
@@ -0,0 +1,11 @@
1
+ import type { AssetParams, Theme } from "../../Protocols/AssetProtocol.js";
2
+ import { BaseAsset } from "./BaseAsset.js";
3
+ export declare class ToggleAsset extends BaseAsset {
4
+ readonly id = "toggle";
5
+ readonly kind = "wall";
6
+ readonly width = 52;
7
+ readonly height = 28;
8
+ readonly elevation = 100;
9
+ readonly tags: string[];
10
+ draw(params: AssetParams, theme: Theme): string;
11
+ }
@@ -0,0 +1,21 @@
1
+ import { ColorUtil } from "../../Utils/ColorUtil.js";
2
+ import { BaseAsset } from "./BaseAsset.js";
3
+ import { ShapeUtil } from "../../Utils/ShapeUtil.js";
4
+ class ToggleAsset extends BaseAsset {
5
+ id = "toggle";
6
+ kind = "wall";
7
+ width = 52;
8
+ height = 28;
9
+ elevation = 100;
10
+ tags = ["toggle", "switch", "interruptor_ui", "ui_switch", "button_toggle"];
11
+ draw(params, theme) {
12
+ const isOff = params.off ?? false;
13
+ const bg = isOff ? theme.metal : ShapeUtil.color(theme, params.color, theme.accent);
14
+ const knobX = isOff ? -13 : 13;
15
+ const knobColor = theme.paper;
16
+ return ShapeUtil.rect(-26, -28, 52, 28, bg, { rx: 14 }) + ShapeUtil.circle(knobX, -14, 11, knobColor) + ShapeUtil.circle(knobX, -14, 11, "none", `stroke="${ColorUtil.sh(knobColor, -0.1)}" stroke-width="1"`);
17
+ }
18
+ }
19
+ export {
20
+ ToggleAsset
21
+ };