@kensio/colophon 2.11.0 → 2.12.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 (186) hide show
  1. package/README.md +1 -1
  2. package/dist/astro/index.d.ts.map +1 -1
  3. package/dist/astro/index.js +0 -1
  4. package/dist/astro/index.js.map +1 -1
  5. package/dist/cli/index.js +0 -0
  6. package/dist/config/defaults.d.ts.map +1 -1
  7. package/dist/config/defaults.js +5 -0
  8. package/dist/config/defaults.js.map +1 -1
  9. package/dist/config/index.js +1 -1
  10. package/dist/image/media.d.ts.map +1 -1
  11. package/dist/image/media.js.map +1 -1
  12. package/dist/image/svg.js +1 -1
  13. package/dist/measure/faces.d.ts.map +1 -1
  14. package/dist/measure/faces.js.map +1 -1
  15. package/dist/platform/base64.d.ts.map +1 -1
  16. package/dist/platform/base64.js +0 -2
  17. package/dist/platform/base64.js.map +1 -1
  18. package/dist/pool.js +1 -1
  19. package/dist/templates/banner/index.js +2 -2
  20. package/dist/templates/banner/index.js.map +1 -1
  21. package/dist/templates/card/index.js +2 -2
  22. package/dist/templates/card/index.js.map +1 -1
  23. package/dist/templates/code/bar.d.ts +24 -0
  24. package/dist/templates/code/bar.d.ts.map +1 -0
  25. package/dist/templates/code/bar.js +31 -0
  26. package/dist/templates/code/bar.js.map +1 -0
  27. package/dist/templates/code/gutter.d.ts +30 -0
  28. package/dist/templates/code/gutter.d.ts.map +1 -0
  29. package/dist/templates/code/gutter.js +64 -0
  30. package/dist/templates/code/gutter.js.map +1 -0
  31. package/dist/templates/code/index.d.ts.map +1 -1
  32. package/dist/templates/code/index.js +34 -15
  33. package/dist/templates/code/index.js.map +1 -1
  34. package/dist/templates/code/layout.d.ts +6 -1
  35. package/dist/templates/code/layout.d.ts.map +1 -1
  36. package/dist/templates/code/layout.js +8 -3
  37. package/dist/templates/code/layout.js.map +1 -1
  38. package/dist/templates/code/mark/draw.d.ts +26 -0
  39. package/dist/templates/code/mark/draw.d.ts.map +1 -0
  40. package/dist/templates/code/mark/draw.js +41 -0
  41. package/dist/templates/code/mark/draw.js.map +1 -0
  42. package/dist/templates/code/mark/index.d.ts +16 -0
  43. package/dist/templates/code/mark/index.d.ts.map +1 -0
  44. package/dist/templates/code/mark/index.js +34 -0
  45. package/dist/templates/code/mark/index.js.map +1 -0
  46. package/dist/templates/code/mark/locate.d.ts +20 -0
  47. package/dist/templates/code/mark/locate.d.ts.map +1 -0
  48. package/dist/templates/code/mark/locate.js +56 -0
  49. package/dist/templates/code/mark/locate.js.map +1 -0
  50. package/dist/templates/code/mark/read.d.ts +30 -0
  51. package/dist/templates/code/mark/read.d.ts.map +1 -0
  52. package/dist/templates/code/mark/read.js +61 -0
  53. package/dist/templates/code/mark/read.js.map +1 -0
  54. package/dist/templates/code/plate.d.ts +7 -1
  55. package/dist/templates/code/plate.d.ts.map +1 -1
  56. package/dist/templates/code/plate.js +14 -4
  57. package/dist/templates/code/plate.js.map +1 -1
  58. package/dist/templates/footer.d.ts +9 -1
  59. package/dist/templates/footer.d.ts.map +1 -1
  60. package/dist/templates/footer.js +24 -0
  61. package/dist/templates/footer.js.map +1 -1
  62. package/dist/templates/frame.d.ts.map +1 -1
  63. package/dist/templates/frame.js +5 -7
  64. package/dist/templates/frame.js.map +1 -1
  65. package/dist/templates/terminal/index.js +4 -4
  66. package/dist/templates/terminal/index.js.map +1 -1
  67. package/dist/templates/window/dots.d.ts +11 -0
  68. package/dist/templates/window/dots.d.ts.map +1 -0
  69. package/dist/templates/window/dots.js +32 -0
  70. package/dist/templates/window/dots.js.map +1 -0
  71. package/dist/templates/{terminal/window.d.ts → window/index.d.ts} +4 -2
  72. package/dist/templates/window/index.d.ts.map +1 -0
  73. package/dist/templates/window/index.js +48 -0
  74. package/dist/templates/window/index.js.map +1 -0
  75. package/dist/templates/window/title.d.ts +9 -0
  76. package/dist/templates/window/title.d.ts.map +1 -0
  77. package/dist/templates/window/title.js +24 -0
  78. package/dist/templates/window/title.js.map +1 -0
  79. package/dist/texture/chevrons.d.ts +13 -0
  80. package/dist/texture/chevrons.d.ts.map +1 -0
  81. package/dist/texture/chevrons.js +22 -0
  82. package/dist/texture/chevrons.js.map +1 -0
  83. package/dist/texture/color.d.ts +10 -0
  84. package/dist/texture/color.d.ts.map +1 -0
  85. package/dist/texture/color.js +10 -0
  86. package/dist/texture/color.js.map +1 -0
  87. package/dist/texture/grid.d.ts +14 -0
  88. package/dist/texture/grid.d.ts.map +1 -0
  89. package/dist/texture/grid.js +38 -0
  90. package/dist/texture/grid.js.map +1 -0
  91. package/dist/texture/halftone.d.ts +14 -0
  92. package/dist/texture/halftone.d.ts.map +1 -0
  93. package/dist/texture/halftone.js +55 -0
  94. package/dist/texture/halftone.js.map +1 -0
  95. package/dist/texture/honeycomb.d.ts +14 -0
  96. package/dist/texture/honeycomb.d.ts.map +1 -0
  97. package/dist/texture/honeycomb.js +43 -0
  98. package/dist/texture/honeycomb.js.map +1 -0
  99. package/dist/texture/index.d.ts.map +1 -1
  100. package/dist/texture/index.js +44 -8
  101. package/dist/texture/index.js.map +1 -1
  102. package/dist/texture/moire.d.ts +18 -0
  103. package/dist/texture/moire.d.ts.map +1 -0
  104. package/dist/texture/moire.js +44 -0
  105. package/dist/texture/moire.js.map +1 -0
  106. package/dist/texture/pattern.d.ts +10 -0
  107. package/dist/texture/pattern.d.ts.map +1 -1
  108. package/dist/texture/pattern.js +37 -15
  109. package/dist/texture/pattern.js.map +1 -1
  110. package/dist/texture/rays.d.ts +13 -0
  111. package/dist/texture/rays.d.ts.map +1 -0
  112. package/dist/texture/rays.js +36 -0
  113. package/dist/texture/rays.js.map +1 -0
  114. package/dist/texture/resolve.d.ts +5 -4
  115. package/dist/texture/resolve.d.ts.map +1 -1
  116. package/dist/texture/resolve.js +5 -4
  117. package/dist/texture/resolve.js.map +1 -1
  118. package/dist/texture/scallops.d.ts +14 -0
  119. package/dist/texture/scallops.d.ts.map +1 -0
  120. package/dist/texture/scallops.js +29 -0
  121. package/dist/texture/scallops.js.map +1 -0
  122. package/dist/texture/tile.d.ts +14 -0
  123. package/dist/texture/tile.d.ts.map +1 -0
  124. package/dist/texture/tile.js +23 -0
  125. package/dist/texture/tile.js.map +1 -0
  126. package/dist/texture/topographic/contours.d.ts +13 -0
  127. package/dist/texture/topographic/contours.d.ts.map +1 -0
  128. package/dist/texture/topographic/contours.js +72 -0
  129. package/dist/texture/topographic/contours.js.map +1 -0
  130. package/dist/texture/topographic/field.d.ts +8 -0
  131. package/dist/texture/topographic/field.d.ts.map +1 -0
  132. package/dist/texture/topographic/field.js +29 -0
  133. package/dist/texture/topographic/field.js.map +1 -0
  134. package/dist/texture/topographic/index.d.ts +17 -0
  135. package/dist/texture/topographic/index.d.ts.map +1 -0
  136. package/dist/texture/topographic/index.js +48 -0
  137. package/dist/texture/topographic/index.js.map +1 -0
  138. package/dist/texture/waves.d.ts +18 -0
  139. package/dist/texture/waves.d.ts.map +1 -0
  140. package/dist/texture/waves.js +55 -0
  141. package/dist/texture/waves.js.map +1 -0
  142. package/dist/theme/presets.d.ts +13 -5
  143. package/dist/theme/presets.d.ts.map +1 -1
  144. package/dist/theme/presets.js +16 -5
  145. package/dist/theme/presets.js.map +1 -1
  146. package/dist/types.d.ts +256 -7
  147. package/dist/types.d.ts.map +1 -1
  148. package/dist/validate/collect.d.ts.map +1 -1
  149. package/dist/validate/collect.js +2 -1
  150. package/dist/validate/collect.js.map +1 -1
  151. package/dist/validate/keys.d.ts +41 -2
  152. package/dist/validate/keys.d.ts.map +1 -1
  153. package/dist/validate/keys.js +141 -4
  154. package/dist/validate/keys.js.map +1 -1
  155. package/dist/validate/texture.d.ts +4 -5
  156. package/dist/validate/texture.d.ts.map +1 -1
  157. package/dist/validate/texture.js +11 -16
  158. package/dist/validate/texture.js.map +1 -1
  159. package/dist/validate/values.d.ts +6 -0
  160. package/dist/validate/values.d.ts.map +1 -1
  161. package/dist/validate/values.js +16 -1
  162. package/dist/validate/values.js.map +1 -1
  163. package/package.json +23 -31
  164. package/dist/highlight/probe.d.ts +0 -4
  165. package/dist/highlight/probe.d.ts.map +0 -1
  166. package/dist/highlight/probe.js +0 -4
  167. package/dist/highlight/probe.js.map +0 -1
  168. package/dist/jpeg/index.d.ts +0 -10
  169. package/dist/jpeg/index.d.ts.map +0 -1
  170. package/dist/jpeg/index.js +0 -2
  171. package/dist/jpeg/index.js.map +0 -1
  172. package/dist/render/png.d.ts +0 -20
  173. package/dist/render/png.d.ts.map +0 -1
  174. package/dist/render/png.js +0 -29
  175. package/dist/render/png.js.map +0 -1
  176. package/dist/stamp/chunk.d.ts +0 -14
  177. package/dist/stamp/chunk.d.ts.map +0 -1
  178. package/dist/stamp/chunk.js +0 -38
  179. package/dist/stamp/chunk.js.map +0 -1
  180. package/dist/templates/code/ellipsis.d.ts +0 -3
  181. package/dist/templates/code/ellipsis.d.ts.map +0 -1
  182. package/dist/templates/code/ellipsis.js +0 -3
  183. package/dist/templates/code/ellipsis.js.map +0 -1
  184. package/dist/templates/terminal/window.d.ts.map +0 -1
  185. package/dist/templates/terminal/window.js +0 -84
  186. package/dist/templates/terminal/window.js.map +0 -1
@@ -1,21 +1,16 @@
1
- /** Used where the palette did not supply one, so a texture always draws. */
2
- const fallbackColor = "#ffffff";
1
+ import { fallbackColor } from "./color.js";
2
+ import { tile } from "./tile.js";
3
3
  const dotDefaults = { opacity: 0.08, size: 5, gap: 44 };
4
4
  const ruleDefaults = { opacity: 0.06, width: 2, gap: 28, angle: 45 };
5
+ const crossDefaults = { opacity: 0.09, size: 9, width: 1.5, gap: 48 };
5
6
  /**
6
- * A tiled pattern over the whole image: the `<pattern>` under the given `id`,
7
- * and the rect that fills with it.
7
+ * How much fainter the crossing set of rules is than the first.
8
+ *
9
+ * The same figure the two sets of rings in `waves` use, and for the same
10
+ * reason: two sets at one opacity read as two sets, and dropping one of them
11
+ * is what turns the crossings into a surface with a weave to it.
8
12
  */
9
- function tile(id, gap, contents, transform, dimensions, opacity) {
10
- const { width, height } = dimensions;
11
- const size = String(gap);
12
- return (`<defs>` +
13
- `<pattern id="${id}" width="${size}" height="${size}"` +
14
- ` patternUnits="userSpaceOnUse"${transform}>${contents}</pattern>` +
15
- `</defs>` +
16
- `<rect width="${String(width)}" height="${String(height)}"` +
17
- ` fill="url(#${id})" opacity="${String(opacity)}"/>`);
18
- }
13
+ const crossScale = 0.65;
19
14
  /** A grid of dots, one to a tile. */
20
15
  export function dotsSvg(texture, dimensions, id) {
21
16
  const gap = texture.gap ?? dotDefaults.gap;
@@ -25,6 +20,25 @@ export function dotsSvg(texture, dimensions, id) {
25
20
  ` fill="${texture.color ?? fallbackColor}"/>`;
26
21
  return tile(id, gap, dot, "", dimensions, texture.opacity ?? dotDefaults.opacity);
27
22
  }
23
+ /**
24
+ * A small cross where each line of a grid would meet, one to a tile.
25
+ *
26
+ * It is the dot grid with a little more to look at, and it costs the same: the
27
+ * mark is two strokes rather than a fill, and the tile is square to the image
28
+ * either way.
29
+ */
30
+ export function crossesSvg(texture, dimensions, id) {
31
+ const gap = texture.gap ?? crossDefaults.gap;
32
+ const centre = gap / 2;
33
+ const arm = (texture.size ?? crossDefaults.size) / 2;
34
+ const from = String(centre - arm);
35
+ const to = String(centre + arm);
36
+ const cross = `<path d="M${from} ${String(centre)}H${to}M${String(centre)} ${from}V${to}"` +
37
+ ` stroke="${texture.color ?? fallbackColor}"` +
38
+ ` stroke-width="${String(texture.width ?? crossDefaults.width)}"` +
39
+ ` fill="none"/>`;
40
+ return tile(id, gap, cross, "", dimensions, texture.opacity ?? crossDefaults.opacity);
41
+ }
28
42
  /**
29
43
  * Ruled lines, one to a tile, rotated as a set.
30
44
  *
@@ -40,6 +54,14 @@ export function rulesSvg(texture, dimensions, id) {
40
54
  ` stroke="${texture.color ?? fallbackColor}"` +
41
55
  ` stroke-width="${String(texture.width ?? ruleDefaults.width)}"/>`;
42
56
  const angle = texture.angle ?? ruleDefaults.angle;
43
- return tile(id, gap, line, ` patternTransform="rotate(${String(angle)})"`, dimensions, texture.opacity ?? ruleDefaults.opacity);
57
+ const opacity = texture.opacity ?? ruleDefaults.opacity;
58
+ const set = (name, at, alpha) => tile(name, gap, line, ` patternTransform="rotate(${String(at)})"`, dimensions, alpha);
59
+ if (texture.cross !== true) {
60
+ // One set keeps the id it always had, so that the common case draws what
61
+ // it drew before, down to the byte.
62
+ return set(id, angle, opacity);
63
+ }
64
+ return (set(`${id}a`, angle, opacity) +
65
+ set(`${id}b`, -angle, Math.round(opacity * crossScale * 1000) / 1000));
44
66
  }
45
67
  //# sourceMappingURL=pattern.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"pattern.js","sourceRoot":"","sources":["../../src/texture/pattern.ts"],"names":[],"mappings":"AAEA,4EAA4E;AAC5E,MAAM,aAAa,GAAG,SAAS,CAAC;AAEhC,MAAM,WAAW,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC;AACxD,MAAM,YAAY,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC;AAErE;;;GAGG;AACH,SAAS,IAAI,CACX,EAAU,EACV,GAAW,EACX,QAAgB,EAChB,SAAiB,EACjB,UAAsB,EACtB,OAAe;IAEf,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,UAAU,CAAC;IACrC,MAAM,IAAI,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;IAEzB,OAAO,CACL,QAAQ;QACR,gBAAgB,EAAE,YAAY,IAAI,aAAa,IAAI,GAAG;QACtD,iCAAiC,SAAS,IAAI,QAAQ,YAAY;QAClE,SAAS;QACT,gBAAgB,MAAM,CAAC,KAAK,CAAC,aAAa,MAAM,CAAC,MAAM,CAAC,GAAG;QAC3D,eAAe,EAAE,eAAe,MAAM,CAAC,OAAO,CAAC,KAAK,CACrD,CAAC;AACJ,CAAC;AAED,qCAAqC;AACrC,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AAK,CAAC,KAAK,CAAC;IACrE,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,IAAI,YAAY,CAAC,KAAK,CAAC;IAClD,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,IAAI,YAAY,CAAC,OAAO,CAAC;IAExD,MAAM,GAAG,GAAG,CAAC,IAAY,EAAE,EAAU,EAAE,KAAa,EAAU,EAAE,CAC9D,IAAI,CACF,IAAI,EACJ,GAAG,EACH,IAAI,EACJ,6BAA6B,MAAM,CAAC,EAAE,CAAC,IAAI,EAC3C,UAAU,EACV,KAAK,CACN,CAAC;IAEJ,IAAI,OAAO,CAAC,KAAK,KAAK,IAAI,EAAE,CAAC;QAC3B,yEAAyE;QACzE,oCAAoC;QACpC,OAAO,GAAG,CAAC,EAAE,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;IACjC,CAAC;IAED,OAAO,CACL,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,OAAO,CAAC;QAC7B,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,CAAC,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,OAAO,GAAG,UAAU,GAAG,IAAI,CAAC,GAAG,IAAI,CAAC,CACtE,CAAC;AACJ,CAAC"}
@@ -0,0 +1,13 @@
1
+ import type { Dimensions, Texture } from "../types.js";
2
+ /**
3
+ * Straight lines fanning out from one point.
4
+ *
5
+ * The rays are spread around the whole circle rather than over the angle that
6
+ * happens to face the image, so moving the origin changes what is seen without
7
+ * changing how close together the lines are. Nothing clips the ones that point
8
+ * away: they are outside the SVG's viewport and are simply not painted.
9
+ */
10
+ export declare function raysSvg(texture: Extract<Texture, {
11
+ readonly type: "rays";
12
+ }>, dimensions: Dimensions): string;
13
+ //# sourceMappingURL=rays.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rays.d.ts","sourceRoot":"","sources":["../../src/texture/rays.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAkBvD;;;;;;;GAOG;AACH,wBAAgB,OAAO,CACrB,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC,EACpD,UAAU,EAAE,UAAU,GACrB,MAAM,CA0BR"}
@@ -0,0 +1,36 @@
1
+ import { fallbackColor } from "./color.js";
2
+ const rayDefaults = { opacity: 0.07, width: 2, count: 36, x: 0.5, y: 1.15 };
3
+ /** How far a ray has to run to leave the image from where it starts. */
4
+ function reach(origin, dimensions) {
5
+ return Math.hypot(Math.max(origin.x, dimensions.width - origin.x), Math.max(origin.y, dimensions.height - origin.y));
6
+ }
7
+ /**
8
+ * Straight lines fanning out from one point.
9
+ *
10
+ * The rays are spread around the whole circle rather than over the angle that
11
+ * happens to face the image, so moving the origin changes what is seen without
12
+ * changing how close together the lines are. Nothing clips the ones that point
13
+ * away: they are outside the SVG's viewport and are simply not painted.
14
+ */
15
+ export function raysSvg(texture, dimensions) {
16
+ const count = Math.max(1, Math.round(texture.count ?? rayDefaults.count));
17
+ const origin = {
18
+ x: dimensions.width * (texture.x ?? rayDefaults.x),
19
+ y: dimensions.height * (texture.y ?? rayDefaults.y),
20
+ };
21
+ const length = reach(origin, dimensions);
22
+ let rays = "";
23
+ for (let ray = 0; ray < count; ray += 1) {
24
+ const angle = (ray / count) * Math.PI * 2;
25
+ rays +=
26
+ `<line x1="${String(Math.round(origin.x))}"` +
27
+ ` y1="${String(Math.round(origin.y))}"` +
28
+ ` x2="${String(Math.round(origin.x + Math.cos(angle) * length))}"` +
29
+ ` y2="${String(Math.round(origin.y + Math.sin(angle) * length))}"/>`;
30
+ }
31
+ return (`<g stroke="${texture.color ?? fallbackColor}"` +
32
+ ` stroke-width="${String(texture.width ?? rayDefaults.width)}"` +
33
+ ` opacity="${String(texture.opacity ?? rayDefaults.opacity)}">` +
34
+ `${rays}</g>`);
35
+ }
36
+ //# sourceMappingURL=rays.js.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CAAC,EAAE,CAAC;QACxC,MAAM,KAAK,GAAG,CAAC,GAAG,GAAG,KAAK,CAAC,GAAG,IAAI,CAAC,EAAE,GAAG,CAAC,CAAC;QAE1C,IAAI;YACF,aAAa,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,GAAG;gBAC5C,QAAQ,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,GAAG;gBACvC,QAAQ,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,MAAM,CAAC,CAAC,GAAG;gBAClE,QAAQ,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,MAAM,CAAC,CAAC,KAAK,CAAC;IACzE,CAAC;IAED,OAAO,CACL,cAAc,OAAO,CAAC,KAAK,IAAI,aAAa,GAAG;QAC/C,kBAAkB,MAAM,CAAC,OAAO,CAAC,KAAK,IAAI,WAAW,CAAC,KAAK,CAAC,GAAG;QAC/D,aAAa,MAAM,CAAC,OAAO,CAAC,OAAO,IAAI,WAAW,CAAC,OAAO,CAAC,IAAI;QAC/D,GAAG,IAAI,MAAM,CACd,CAAC;AACJ,CAAC"}
@@ -3,10 +3,11 @@ import type { BrandColors, Texture } from "../types.js";
3
3
  * Fill in the colour a texture left open, from the palette it will be drawn
4
4
  * over.
5
5
  *
6
- * A dot grid or a set of rules has to be the foreground colour by default,
7
- * because that is the one colour known to contrast with the background: a
8
- * fixed white would disappear on a light theme, which is a texture that
9
- * silently does nothing. Grain has no colour to fill in, being noise.
6
+ * A dot grid, a set of rules or a set of rings has to be the foreground colour
7
+ * by default, because that is the one colour known to contrast with the
8
+ * background: a fixed white would disappear on a light theme, which is a
9
+ * texture that silently does nothing. Grain has no colour to fill in, being
10
+ * noise.
10
11
  *
11
12
  * It happens here rather than while drawing so that the resolved config says
12
13
  * what will actually be drawn, which is also what the rebuild stamp hashes: a
@@ -1 +1 @@
1
- {"version":3,"file":"resolve.d.ts","sourceRoot":"","sources":["../../src/texture/resolve.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAExD;;;;;;;;;;;;GAYG;AACH,wBAAgB,cAAc,CAC5B,OAAO,EAAE,OAAO,GAAG,SAAS,EAC5B,MAAM,EAAE,QAAQ,CAAC,WAAW,CAAC,GAC5B,OAAO,GAAG,SAAS,CAMrB"}
1
+ {"version":3,"file":"resolve.d.ts","sourceRoot":"","sources":["../../src/texture/resolve.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAExD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,cAAc,CAC5B,OAAO,EAAE,OAAO,GAAG,SAAS,EAC5B,MAAM,EAAE,QAAQ,CAAC,WAAW,CAAC,GAC5B,OAAO,GAAG,SAAS,CAMrB"}
@@ -2,10 +2,11 @@
2
2
  * Fill in the colour a texture left open, from the palette it will be drawn
3
3
  * over.
4
4
  *
5
- * A dot grid or a set of rules has to be the foreground colour by default,
6
- * because that is the one colour known to contrast with the background: a
7
- * fixed white would disappear on a light theme, which is a texture that
8
- * silently does nothing. Grain has no colour to fill in, being noise.
5
+ * A dot grid, a set of rules or a set of rings has to be the foreground colour
6
+ * by default, because that is the one colour known to contrast with the
7
+ * background: a fixed white would disappear on a light theme, which is a
8
+ * texture that silently does nothing. Grain has no colour to fill in, being
9
+ * noise.
9
10
  *
10
11
  * It happens here rather than while drawing so that the resolved config says
11
12
  * what will actually be drawn, which is also what the rebuild stamp hashes: a
@@ -1 +1 @@
1
- {"version":3,"file":"resolve.js","sourceRoot":"","sources":["../../src/texture/resolve.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,cAAc,CAC5B,OAA4B,EAC5B,MAA6B;IAE7B,IAAI,OAAO,KAAK,SAAS,IAAI,OAAO,CAAC,IAAI,KAAK,OAAO,EAAE,CAAC;QACtD,OAAO,OAAO,CAAC;IACjB,CAAC;IAED,OAAO,EAAE,KAAK,EAAE,MAAM,CAAC,UAAU,EAAE,GAAG,OAAO,EAAE,CAAC;AAClD,CAAC"}
1
+ {"version":3,"file":"resolve.js","sourceRoot":"","sources":["../../src/texture/resolve.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,cAAc,CAC5B,OAA4B,EAC5B,MAA6B;IAE7B,IAAI,OAAO,KAAK,SAAS,IAAI,OAAO,CAAC,IAAI,KAAK,OAAO,EAAE,CAAC;QACtD,OAAO,OAAO,CAAC;IACjB,CAAC;IAED,OAAO,EAAE,KAAK,EAAE,MAAM,CAAC,UAAU,EAAE,GAAG,OAAO,EAAE,CAAC;AAClD,CAAC"}
@@ -0,0 +1,14 @@
1
+ import type { Dimensions, Texture } from "../types.js";
2
+ /**
3
+ * Fish scales: rows of arcs, each row offset by half a scale from the one
4
+ * above, which is what makes them read as overlapping rather than as stacked
5
+ * semicircles.
6
+ *
7
+ * The tile holds two rows for that reason: one repeat has to contain both the
8
+ * offset row and the row it is offset from, since a `<pattern>` cannot stagger
9
+ * its own rows.
10
+ */
11
+ export declare function scallopsSvg(texture: Extract<Texture, {
12
+ readonly type: "scallops";
13
+ }>, dimensions: Dimensions, id: string): string;
14
+ //# sourceMappingURL=scallops.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scallops.d.ts","sourceRoot":"","sources":["../../src/texture/scallops.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAcvD;;;;;;;;GAQG;AACH,wBAAgB,WAAW,CACzB,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE;IAAE,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAA;CAAE,CAAC,EACxD,UAAU,EAAE,UAAU,EACtB,EAAE,EAAE,MAAM,GACT,MAAM,CAqBR"}
@@ -0,0 +1,29 @@
1
+ import { fallbackColor } from "./color.js";
2
+ import { tile } from "./tile.js";
3
+ const scallopDefaults = { opacity: 0.07, width: 2, size: 40 };
4
+ /** One arc of a row, bulging downwards from the two points it spans. */
5
+ function scallop(cx, y, radius) {
6
+ return (`M${String(cx - radius)} ${String(y)}` +
7
+ `A${String(radius)} ${String(radius)} 0 0 0 ${String(cx + radius)} ${String(y)}`);
8
+ }
9
+ /**
10
+ * Fish scales: rows of arcs, each row offset by half a scale from the one
11
+ * above, which is what makes them read as overlapping rather than as stacked
12
+ * semicircles.
13
+ *
14
+ * The tile holds two rows for that reason: one repeat has to contain both the
15
+ * offset row and the row it is offset from, since a `<pattern>` cannot stagger
16
+ * its own rows.
17
+ */
18
+ export function scallopsSvg(texture, dimensions, id) {
19
+ const size = texture.size ?? scallopDefaults.size;
20
+ const radius = size / 2;
21
+ const rows = scallop(radius, 0, radius) +
22
+ scallop(0, radius, radius) +
23
+ scallop(size, radius, radius);
24
+ const arcs = `<path d="${rows}" stroke="${texture.color ?? fallbackColor}"` +
25
+ ` stroke-width="${String(texture.width ?? scallopDefaults.width)}"` +
26
+ ` fill="none"/>`;
27
+ return tile(id, size, arcs, "", dimensions, texture.opacity ?? scallopDefaults.opacity);
28
+ }
29
+ //# sourceMappingURL=scallops.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scallops.js","sourceRoot":"","sources":["../../src/texture/scallops.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,MAAM,eAAe,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC;AAE9D,wEAAwE;AACxE,SAAS,OAAO,CAAC,EAAU,EAAE,CAAS,EAAE,MAAc;IACpD,OAAO,CACL,IAAI,MAAM,CAAC,EAAE,GAAG,MAAM,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,EAAE;QACtC,IAAI,MAAM,CAAC,MAAM,CAAC,IAAI,MAAM,CAAC,MAAM,CAAC,UAAU,MAAM,CAAC,EAAE,GAAG,MAAM,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,EAAE,CACjF,CAAC;AACJ,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,WAAW,CACzB,OAAwD,EACxD,UAAsB,EACtB,EAAU;IAEV,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,IAAI,eAAe,CAAC,IAAI,CAAC;IAClD,MAAM,MAAM,GAAG,IAAI,GAAG,CAAC,CAAC;IACxB,MAAM,IAAI,GACR,OAAO,CAAC,MAAM,EAAE,CAAC,EAAE,MAAM,CAAC;QAC1B,OAAO,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC;QAC1B,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;IAEhC,MAAM,IAAI,GACR,YAAY,IAAI,aAAa,OAAO,CAAC,KAAK,IAAI,aAAa,GAAG;QAC9D,kBAAkB,MAAM,CAAC,OAAO,CAAC,KAAK,IAAI,eAAe,CAAC,KAAK,CAAC,GAAG;QACnE,gBAAgB,CAAC;IAEnB,OAAO,IAAI,CACT,EAAE,EACF,IAAI,EACJ,IAAI,EACJ,EAAE,EACF,UAAU,EACV,OAAO,CAAC,OAAO,IAAI,eAAe,CAAC,OAAO,CAC3C,CAAC;AACJ,CAAC"}
@@ -0,0 +1,14 @@
1
+ import type { Dimensions } from "../types.js";
2
+ /**
3
+ * A tiled pattern over the whole image: the `<pattern>` under the given `id`,
4
+ * and the rect that fills with it.
5
+ *
6
+ * A tile is what makes a treatment cheap to store as well as to draw. PNG
7
+ * compresses along a row, and a repeating tile means a row that repeats, which
8
+ * is the difference between the dot grid's 20KB and the half a megabyte a
9
+ * pattern that never repeats costs.
10
+ */
11
+ export declare function tile(id: string,
12
+ /** The repeat: one number for a square tile, or both sides where it is not. */
13
+ gap: number | Dimensions, contents: string, transform: string, dimensions: Dimensions, opacity: number): string;
14
+ //# sourceMappingURL=tile.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tile.d.ts","sourceRoot":"","sources":["../../src/texture/tile.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAE9C;;;;;;;;GAQG;AACH,wBAAgB,IAAI,CAClB,EAAE,EAAE,MAAM;AACV,+EAA+E;AAC/E,GAAG,EAAE,MAAM,GAAG,UAAU,EACxB,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,UAAU,EACtB,OAAO,EAAE,MAAM,GACd,MAAM,CAcR"}
@@ -0,0 +1,23 @@
1
+ /**
2
+ * A tiled pattern over the whole image: the `<pattern>` under the given `id`,
3
+ * and the rect that fills with it.
4
+ *
5
+ * A tile is what makes a treatment cheap to store as well as to draw. PNG
6
+ * compresses along a row, and a repeating tile means a row that repeats, which
7
+ * is the difference between the dot grid's 20KB and the half a megabyte a
8
+ * pattern that never repeats costs.
9
+ */
10
+ export function tile(id,
11
+ /** The repeat: one number for a square tile, or both sides where it is not. */
12
+ gap, contents, transform, dimensions, opacity) {
13
+ const { width, height } = dimensions;
14
+ const repeat = typeof gap === "number" ? { width: gap, height: gap } : { ...gap };
15
+ return (`<defs>` +
16
+ `<pattern id="${id}" width="${String(repeat.width)}"` +
17
+ ` height="${String(repeat.height)}"` +
18
+ ` patternUnits="userSpaceOnUse"${transform}>${contents}</pattern>` +
19
+ `</defs>` +
20
+ `<rect width="${String(width)}" height="${String(height)}"` +
21
+ ` fill="url(#${id})" opacity="${String(opacity)}"/>`);
22
+ }
23
+ //# sourceMappingURL=tile.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tile.js","sourceRoot":"","sources":["../../src/texture/tile.ts"],"names":[],"mappings":"AAEA;;;;;;;;GAQG;AACH,MAAM,UAAU,IAAI,CAClB,EAAU;AACV,+EAA+E;AAC/E,GAAwB,EACxB,QAAgB,EAChB,SAAiB,EACjB,UAAsB,EACtB,OAAe;IAEf,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,UAAU,CAAC;IACrC,MAAM,MAAM,GACV,OAAO,GAAG,KAAK,QAAQ,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC,EAAE,GAAG,GAAG,EAAE,CAAC;IAErE,OAAO,CACL,QAAQ;QACR,gBAAgB,EAAE,YAAY,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG;QACrD,YAAY,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,GAAG;QACpC,iCAAiC,SAAS,IAAI,QAAQ,YAAY;QAClE,SAAS;QACT,gBAAgB,MAAM,CAAC,KAAK,CAAC,aAAa,MAAM,CAAC,MAAM,CAAC,GAAG;QAC3D,eAAe,EAAE,eAAe,MAAM,CAAC,OAAO,CAAC,KAAK,CACrD,CAAC;AACJ,CAAC"}
@@ -0,0 +1,13 @@
1
+ import type { Dimensions } from "../../types.js";
2
+ /**
3
+ * One contour of the landscape, as the segments where the ground passes
4
+ * through a given height.
5
+ *
6
+ * This is marching squares: the field is sampled on a grid, and each cell
7
+ * contributes the piece of the line that crosses it. Drawing the segments
8
+ * separately rather than joining them into loops costs a little more markup
9
+ * and saves the bookkeeping of walking a contour from cell to cell, which
10
+ * would not change the picture.
11
+ */
12
+ export declare function contourAt(level: number, step: number, dimensions: Dimensions, seed: number, relief: number): string;
13
+ //# sourceMappingURL=contours.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contours.d.ts","sourceRoot":"","sources":["../../../src/texture/topographic/contours.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAyEjD;;;;;;;;;GASG;AACH,wBAAgB,SAAS,CACvB,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,MAAM,EACZ,UAAU,EAAE,UAAU,EACtB,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,MAAM,GACb,MAAM,CAmBR"}
@@ -0,0 +1,72 @@
1
+ import { height } from "./field.js";
2
+ /**
3
+ * Where between two corners the contour crosses, by how far each of them is
4
+ * above or below the level. Interpolating rather than taking the midpoint is
5
+ * what makes the line smooth instead of stepped.
6
+ */
7
+ function between(a, b, above, below) {
8
+ const along = above / (above - below);
9
+ return { x: a.x + (b.x - a.x) * along, y: a.y + (b.y - a.y) * along };
10
+ }
11
+ /** The corners of one cell, clockwise from the top left. */
12
+ function corners(x, y, step) {
13
+ return [
14
+ { x, y },
15
+ { x: x + step, y },
16
+ { x: x + step, y: y + step },
17
+ { x, y: y + step },
18
+ ];
19
+ }
20
+ /**
21
+ * The segments of one contour crossing one cell.
22
+ *
23
+ * Which edges it crosses is decided by which corners are above the level, read
24
+ * as four bits. The two ambiguous cases, where opposite corners are above and
25
+ * the other two below, are drawn as two separate segments: a saddle can be
26
+ * joined either way and this is the reading that never crosses itself.
27
+ */
28
+ function cell(values, points, level) {
29
+ const above = values.map((value) => value > level);
30
+ const edges = [];
31
+ for (const [index, isAbove] of above.entries()) {
32
+ const next = (index + 1) % 4;
33
+ if (isAbove !== above[next]) {
34
+ edges.push(between(points[index], points[next], values[index] - level, values[next] - level));
35
+ }
36
+ }
37
+ if (edges.length === 2) {
38
+ return [[edges[0], edges[1]]];
39
+ }
40
+ return edges.length === 4
41
+ ? [
42
+ [edges[0], edges[1]],
43
+ [edges[2], edges[3]],
44
+ ]
45
+ : [];
46
+ }
47
+ /**
48
+ * One contour of the landscape, as the segments where the ground passes
49
+ * through a given height.
50
+ *
51
+ * This is marching squares: the field is sampled on a grid, and each cell
52
+ * contributes the piece of the line that crosses it. Drawing the segments
53
+ * separately rather than joining them into loops costs a little more markup
54
+ * and saves the bookkeeping of walking a contour from cell to cell, which
55
+ * would not change the picture.
56
+ */
57
+ export function contourAt(level, step, dimensions, seed, relief) {
58
+ let path = "";
59
+ for (let y = -step; y < dimensions.height + step; y += step) {
60
+ for (let x = -step; x < dimensions.width + step; x += step) {
61
+ const points = corners(x, y, step);
62
+ const values = points.map((point) => height(point.x, point.y, seed) * relief);
63
+ for (const [from, to] of cell(values, points, level)) {
64
+ path +=
65
+ `M${String(Math.round(from.x))} ${String(Math.round(from.y))}` +
66
+ `L${String(Math.round(to.x))} ${String(Math.round(to.y))}`;
67
+ }
68
+ }
69
+ }
70
+ return path;
71
+ }
72
+ //# sourceMappingURL=contours.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contours.js","sourceRoot":"","sources":["../../../src/texture/topographic/contours.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAQpC;;;;GAIG;AACH,SAAS,OAAO,CAAC,CAAQ,EAAE,CAAQ,EAAE,KAAa,EAAE,KAAa;IAC/D,MAAM,KAAK,GAAG,KAAK,GAAG,CAAC,KAAK,GAAG,KAAK,CAAC,CAAC;IAEtC,OAAO,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,KAAK,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,KAAK,EAAE,CAAC;AACxE,CAAC;AAED,4DAA4D;AAC5D,SAAS,OAAO,CAAC,CAAS,EAAE,CAAS,EAAE,IAAY;IACjD,OAAO;QACL,EAAE,CAAC,EAAE,CAAC,EAAE;QACR,EAAE,CAAC,EAAE,CAAC,GAAG,IAAI,EAAE,CAAC,EAAE;QAClB,EAAE,CAAC,EAAE,CAAC,GAAG,IAAI,EAAE,CAAC,EAAE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Aa,EACb,IAAY,EACZ,UAAsB,EACtB,IAAY,EACZ,MAAc;IAEd,IAAI,IAAI,GAAG,EAAE,CAAC;IAEd,KAAK,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,GAAG,UAAU,CAAC,MAAM,GAAG,IAAI,EAAE,CAAC,IAAI,IAAI,EAAE,CAAC;QAC5D,KAAK,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,GAAG,UAAU,CAAC,KAAK,GAAG,IAAI,EAAE,CAAC,IAAI,IAAI,EAAE,CAAC;YAC3D,MAAM,MAAM,GAAG,OAAO,CAAC,CAAC,EAAE,CAAC,EAAE,IAAI,CAAC,CAAC;YACnC,MAAM,MAAM,GAAG,MAAM,CAAC,GAAG,CACvB,CAAC,KAAK,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,MAAM,CACnD,CAAC;YAEF,KAAK,MAAM,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,CAAC;gBACrD,IAAI;oBACF,IAAI,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE;wBAC9D,IAAI,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;YAC/D,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * The height of the ground at a point, from -1 to 1.
3
+ *
4
+ * `seed` shifts each wave's phase by a different amount, so one number picks a
5
+ * whole landscape and the same number always picks the same one.
6
+ */
7
+ export declare function height(x: number, y: number, seed: number): number;
8
+ //# sourceMappingURL=field.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"field.d.ts","sourceRoot":"","sources":["../../../src/texture/topographic/field.ts"],"names":[],"mappings":"AAeA;;;;;GAKG;AACH,wBAAgB,MAAM,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CASjE"}
@@ -0,0 +1,29 @@
1
+ /**
2
+ * The waves the ground is made of: how far one runs before it repeats, which
3
+ * way it runs, and how much of the height it accounts for.
4
+ *
5
+ * Three at unrelated wavelengths and angles is enough to read as terrain
6
+ * rather than as a pattern. Deliberately not random: the rebuild stamp assumes
7
+ * one config draws one picture, so a texture that rolled dice would come out
8
+ * different every time nothing had changed.
9
+ */
10
+ const waves = [
11
+ { length: 260, dx: 1, dy: 0.35, weight: 0.5 },
12
+ { length: 170, dx: -0.4, dy: 1, weight: 0.32 },
13
+ { length: 95, dx: 0.7, dy: -0.8, weight: 0.18 },
14
+ ];
15
+ /**
16
+ * The height of the ground at a point, from -1 to 1.
17
+ *
18
+ * `seed` shifts each wave's phase by a different amount, so one number picks a
19
+ * whole landscape and the same number always picks the same one.
20
+ */
21
+ export function height(x, y, seed) {
22
+ let sum = 0;
23
+ for (const [index, wave] of waves.entries()) {
24
+ const along = (x * wave.dx + y * wave.dy) / wave.length;
25
+ sum += wave.weight * Math.sin(along + seed * (index + 1) * 1.7);
26
+ }
27
+ return sum;
28
+ }
29
+ //# sourceMappingURL=field.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"field.js","sourceRoot":"","sources":["../../../src/texture/topographic/field.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,MAAM,KAAK,GAAG;IACZ,EAAE,MAAM,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE;IAC7C,EAAE,MAAM,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC,GAAG,EAAE,EAAE,EAAE,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE;IAC9C,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE;CAChD,CAAC;AAEF;;;;;GAKG;AACH,MAAM,UAAU,MAAM,CAAC,CAAS,EAAE,CAAS,EAAE,IAAY;IACvD,IAAI,GAAG,GAAG,CAAC,CAAC;IAEZ,KAAK,MAAM,CAAC,KAAK,EAAE,IAAI,CAAC,IAAI,KAAK,CAAC,OAAO,EAAE,EAAE,CAAC;QAC5C,MAAM,KAAK,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,EAAE,GAAG,CAAC,GAAG,IAAI,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC;QACxD,GAAG,IAAI,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,GAAG,IAAI,GAAG,CAAC,KAAK,GAAG,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC;IAClE,CAAC;IAED,OAAO,GAAG,CAAC;AACb,CAAC"}
@@ -0,0 +1,17 @@
1
+ import type { Dimensions, Texture } from "../../types.js";
2
+ /**
3
+ * Contour lines, the look of a map: the height of a made-up landscape, drawn
4
+ * every `gap` pixels of it.
5
+ *
6
+ * These are the real thing rather than rings pretending: the field is sampled
7
+ * on a grid and each contour is the line where the ground passes through one
8
+ * height, so the shapes close where the ground has a summit, run off the edge
9
+ * where it keeps rising, and never cross each other. An earlier attempt drew
10
+ * circles pushed in and out by the same field, and no amount of pushing made
11
+ * it read as anything but a wobbly bullseye: what makes a map is that the
12
+ * shapes owe nothing to a centre.
13
+ */
14
+ export declare function topographicSvg(texture: Extract<Texture, {
15
+ readonly type: "topographic";
16
+ }>, dimensions: Dimensions): string;
17
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/texture/topographic/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAqB1D;;;;;;;;;;;GAWG;AACH,wBAAgB,cAAc,CAC5B,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE;IAAE,QAAQ,CAAC,IAAI,EAAE,aAAa,CAAA;CAAE,CAAC,EAC3D,UAAU,EAAE,UAAU,GACrB,MAAM,CAsBR"}
@@ -0,0 +1,48 @@
1
+ import { fallbackColor } from "../color.js";
2
+ import { contourAt } from "./contours.js";
3
+ const contourDefaults = {
4
+ opacity: 0.1,
5
+ width: 1.5,
6
+ gap: 34,
7
+ relief: 5,
8
+ seed: 1,
9
+ };
10
+ /**
11
+ * How finely the ground is sampled, as a fraction of the gap between contours.
12
+ *
13
+ * The cells have to be smaller than the features the field has, or the lines
14
+ * come out as polygons. Below about a third of the gap the picture stops
15
+ * changing and only the markup grows.
16
+ */
17
+ const sampleScale = 0.5;
18
+ /**
19
+ * Contour lines, the look of a map: the height of a made-up landscape, drawn
20
+ * every `gap` pixels of it.
21
+ *
22
+ * These are the real thing rather than rings pretending: the field is sampled
23
+ * on a grid and each contour is the line where the ground passes through one
24
+ * height, so the shapes close where the ground has a summit, run off the edge
25
+ * where it keeps rising, and never cross each other. An earlier attempt drew
26
+ * circles pushed in and out by the same field, and no amount of pushing made
27
+ * it read as anything but a wobbly bullseye: what makes a map is that the
28
+ * shapes owe nothing to a centre.
29
+ */
30
+ export function topographicSvg(texture, dimensions) {
31
+ const gap = texture.gap ?? contourDefaults.gap;
32
+ const relief = gap * (texture.relief ?? contourDefaults.relief);
33
+ const seed = texture.seed ?? contourDefaults.seed;
34
+ const step = Math.max(2, Math.round(gap * sampleScale));
35
+ let lines = "";
36
+ // The field runs from -relief to relief, so the levels either side of nought
37
+ // are what fits in it. One at nought as well would draw the coastline twice
38
+ // over, since the sum of the waves sits there more often than anywhere else.
39
+ for (let level = gap / 2; level < relief; level += gap) {
40
+ lines += contourAt(level, step, dimensions, seed, relief);
41
+ lines += contourAt(-level, step, dimensions, seed, relief);
42
+ }
43
+ return (`<path d="${lines}" fill="none"` +
44
+ ` stroke="${texture.color ?? fallbackColor}"` +
45
+ ` stroke-width="${String(texture.width ?? contourDefaults.width)}"` +
46
+ ` opacity="${String(texture.opacity ?? contourDefaults.opacity)}"/>`);
47
+ }
48
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/texture/topographic/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAE1C,MAAM,eAAe,GAAG;IACtB,OAAO,EAAE,GAAG;IACZ,KAAK,EAAE,GAAG;IACV,GAAG,EAAE,EAAE;IACP,MAAM,EAAE,CAAC;IACT,IAAI,EAAE,CAAC;CACR,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,WAAW,GAAG,GAAG,CAAC;AAExB;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,cAAc,CAC5B,OAA2D,EAC3D,UAAsB;IAEtB,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,IAAI,eAAe,CAAC,GAAG,CAAC;IAC/C,MAAM,MAAM,GAAG,GAAG,GAAG,CAAC,OAAO,CAAC,MAAM,IAAI,eAAe,CAAC,MAAM,CAAC,CAAC;IAChE,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,IAAI,eAAe,CAAC,IAAI,CAAC;IAClD,MAAM,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,GAAG,GAAG,WAAW,CAAC,CAAC,CAAC;IAExD,IAAI,KAAK,GAAG,EAAE,CAAC;IAEf,6EAA6E;IAC7E,4EAA4E;IAC5E,6EAA6E;IAC7E,KAAK,IAAI,KAAK,GAAG,GAAG,GAAG,CAAC,EAAE,KAAK,GAAG,MAAM,EAAE,KAAK,IAAI,GAAG,EAAE,CAAC;QACvD,KAAK,IAAI,SAAS,CAAC,KAAK,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;QAC1D,KAAK,IAAI,SAAS,CAAC,CAAC,KAAK,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;IAC7D,CAAC;IAED,OAAO,CACL,YAAY,KAAK,eAAe;QAChC,YAAY,OAAO,CAAC,KAAK,IAAI,aAAa,GAAG;QAC7C,kBAAkB,MAAM,CAAC,OAAO,CAAC,KAAK,IAAI,eAAe,CAAC,KAAK,CAAC,GAAG;QACnE,aAAa,MAAM,CAAC,OAAO,CAAC,OAAO,IAAI,eAAe,CAAC,OAAO,CAAC,KAAK,CACrE,CAAC;AACJ,CAAC"}
@@ -0,0 +1,18 @@
1
+ import type { Dimensions, Texture } from "../types.js";
2
+ /**
3
+ * Two sets of concentric rings, one from the middle of each side edge.
4
+ *
5
+ * Unlike the dot grid and the ruled lines this is not a tile, and it cannot be
6
+ * one: what makes it worth looking at is the interference between the two
7
+ * sets, which is different everywhere on the image.
8
+ *
9
+ * It is a few dozen circles to draw and expensive to store, which are not the
10
+ * same thing. Antialiased curves put a different set of colours in every row,
11
+ * so a 1200x1200 PNG goes from around 80KB to around 620KB at the default gap,
12
+ * against 100KB for the dot grid. `gap` is the only real lever on that, and
13
+ * the docs say so.
14
+ */
15
+ export declare function wavesSvg(texture: Extract<Texture, {
16
+ readonly type: "waves";
17
+ }>, dimensions: Dimensions): string;
18
+ //# sourceMappingURL=waves.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"waves.d.ts","sourceRoot":"","sources":["../../src/texture/waves.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AA4DvD;;;;;;;;;;;;GAYG;AACH,wBAAgB,QAAQ,CACtB,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE;IAAE,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAA;CAAE,CAAC,EACrD,UAAU,EAAE,UAAU,GACrB,MAAM,CAaR"}
@@ -0,0 +1,55 @@
1
+ import { fallbackColor } from "./color.js";
2
+ const wavesDefaults = { opacity: 0.14, width: 2, gap: 24 };
3
+ /**
4
+ * How much fainter the set drawn from the right is than the set from the left.
5
+ *
6
+ * Two sets at one opacity read as two sets of rings, because the eye follows
7
+ * whichever arc it is on. Dropping one of them is what turns the crossings
8
+ * into a single surface with a grain to it, and it is the same trick that
9
+ * keeps a flat tile from reading as graph paper.
10
+ */
11
+ const secondaryScale = 0.65;
12
+ /**
13
+ * Rings around one centre at `gap` apart, out to the furthest corner of the
14
+ * image, which is where the pattern stops being able to cover anything.
15
+ *
16
+ * Nothing clips them: a circle drawn past the edge of the image is outside the
17
+ * SVG's viewport and simply is not painted.
18
+ */
19
+ function rings(centre, dimensions, gap) {
20
+ const furthest = Math.hypot(Math.max(centre.x, dimensions.width - centre.x), Math.max(centre.y, dimensions.height - centre.y));
21
+ let out = "";
22
+ for (let ring = 1; ring * gap <= furthest; ring += 1) {
23
+ out +=
24
+ `<circle cx="${String(centre.x)}" cy="${String(centre.y)}"` +
25
+ ` r="${String(Math.round(ring * gap))}"/>`;
26
+ }
27
+ return out;
28
+ }
29
+ /** One set of rings, with the stroke named once on the group. */
30
+ function family(centre, dimensions, texture, opacity) {
31
+ const gap = texture.gap ?? wavesDefaults.gap;
32
+ return (`<g fill="none" stroke="${texture.color ?? fallbackColor}"` +
33
+ ` stroke-width="${String(texture.width ?? wavesDefaults.width)}"` +
34
+ ` opacity="${String(opacity)}">${rings(centre, dimensions, gap)}</g>`);
35
+ }
36
+ /**
37
+ * Two sets of concentric rings, one from the middle of each side edge.
38
+ *
39
+ * Unlike the dot grid and the ruled lines this is not a tile, and it cannot be
40
+ * one: what makes it worth looking at is the interference between the two
41
+ * sets, which is different everywhere on the image.
42
+ *
43
+ * It is a few dozen circles to draw and expensive to store, which are not the
44
+ * same thing. Antialiased curves put a different set of colours in every row,
45
+ * so a 1200x1200 PNG goes from around 80KB to around 620KB at the default gap,
46
+ * against 100KB for the dot grid. `gap` is the only real lever on that, and
47
+ * the docs say so.
48
+ */
49
+ export function wavesSvg(texture, dimensions) {
50
+ const opacity = texture.opacity ?? wavesDefaults.opacity;
51
+ const middle = Math.round(dimensions.height / 2);
52
+ return (family({ x: 0, y: middle }, dimensions, texture, opacity) +
53
+ family({ x: dimensions.width, y: middle }, dimensions, texture, Math.round(opacity * secondaryScale * 1000) / 1000));
54
+ }
55
+ //# sourceMappingURL=waves.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"waves.js","sourceRoot":"","sources":["../../src/texture/waves.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAE3C,MAAM,aAAa,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC;AAE3D;;;;;;;GAOG;AACH,MAAM,cAAc,GAAG,IAAI,CAAC;AAO5B;;;;;;GAMG;AACH,SAAS,KAAK,CAAC,MAAc,EAAE,UAAsB,EAAE,GAAW;IAChE,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CACzB,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,EAAE,UAAU,CAAC,KAAK,GAAG,MAAM,CAAC,CAAC,CAAC,EAC/C,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,EAAE,UAAU,CAAC,MAAM,GAAG,MAAM,CAAC,CAAC,CAAC,CACjD,CAAC;IAEF,IAAI,GAAG,GAAG,EAAE,CAAC;IAEb,KAAK,IAAI,IAAI,GAAG,CAAC,EAAE,IAAI,GAAG,GAAG,IAAI,QAAQ,EAAE,IAAI,IAAI,C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