@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.
- package/README.md +1 -1
- package/dist/astro/index.d.ts.map +1 -1
- package/dist/astro/index.js +0 -1
- package/dist/astro/index.js.map +1 -1
- package/dist/cli/index.js +0 -0
- package/dist/config/defaults.d.ts.map +1 -1
- package/dist/config/defaults.js +5 -0
- package/dist/config/defaults.js.map +1 -1
- package/dist/config/index.js +1 -1
- package/dist/image/media.d.ts.map +1 -1
- package/dist/image/media.js.map +1 -1
- package/dist/image/svg.js +1 -1
- package/dist/measure/faces.d.ts.map +1 -1
- package/dist/measure/faces.js.map +1 -1
- package/dist/platform/base64.d.ts.map +1 -1
- package/dist/platform/base64.js +0 -2
- package/dist/platform/base64.js.map +1 -1
- package/dist/pool.js +1 -1
- package/dist/templates/banner/index.js +2 -2
- package/dist/templates/banner/index.js.map +1 -1
- package/dist/templates/card/index.js +2 -2
- package/dist/templates/card/index.js.map +1 -1
- package/dist/templates/code/bar.d.ts +24 -0
- package/dist/templates/code/bar.d.ts.map +1 -0
- package/dist/templates/code/bar.js +31 -0
- package/dist/templates/code/bar.js.map +1 -0
- package/dist/templates/code/gutter.d.ts +30 -0
- package/dist/templates/code/gutter.d.ts.map +1 -0
- package/dist/templates/code/gutter.js +64 -0
- package/dist/templates/code/gutter.js.map +1 -0
- package/dist/templates/code/index.d.ts.map +1 -1
- package/dist/templates/code/index.js +34 -15
- package/dist/templates/code/index.js.map +1 -1
- package/dist/templates/code/layout.d.ts +6 -1
- package/dist/templates/code/layout.d.ts.map +1 -1
- package/dist/templates/code/layout.js +8 -3
- package/dist/templates/code/layout.js.map +1 -1
- package/dist/templates/code/mark/draw.d.ts +26 -0
- package/dist/templates/code/mark/draw.d.ts.map +1 -0
- package/dist/templates/code/mark/draw.js +41 -0
- package/dist/templates/code/mark/draw.js.map +1 -0
- package/dist/templates/code/mark/index.d.ts +16 -0
- package/dist/templates/code/mark/index.d.ts.map +1 -0
- package/dist/templates/code/mark/index.js +34 -0
- package/dist/templates/code/mark/index.js.map +1 -0
- package/dist/templates/code/mark/locate.d.ts +20 -0
- package/dist/templates/code/mark/locate.d.ts.map +1 -0
- package/dist/templates/code/mark/locate.js +56 -0
- package/dist/templates/code/mark/locate.js.map +1 -0
- package/dist/templates/code/mark/read.d.ts +30 -0
- package/dist/templates/code/mark/read.d.ts.map +1 -0
- package/dist/templates/code/mark/read.js +61 -0
- package/dist/templates/code/mark/read.js.map +1 -0
- package/dist/templates/code/plate.d.ts +7 -1
- package/dist/templates/code/plate.d.ts.map +1 -1
- package/dist/templates/code/plate.js +14 -4
- package/dist/templates/code/plate.js.map +1 -1
- package/dist/templates/footer.d.ts +9 -1
- package/dist/templates/footer.d.ts.map +1 -1
- package/dist/templates/footer.js +24 -0
- package/dist/templates/footer.js.map +1 -1
- package/dist/templates/frame.d.ts.map +1 -1
- package/dist/templates/frame.js +5 -7
- package/dist/templates/frame.js.map +1 -1
- package/dist/templates/terminal/index.js +4 -4
- package/dist/templates/terminal/index.js.map +1 -1
- package/dist/templates/window/dots.d.ts +11 -0
- package/dist/templates/window/dots.d.ts.map +1 -0
- package/dist/templates/window/dots.js +32 -0
- package/dist/templates/window/dots.js.map +1 -0
- package/dist/templates/{terminal/window.d.ts → window/index.d.ts} +4 -2
- package/dist/templates/window/index.d.ts.map +1 -0
- package/dist/templates/window/index.js +48 -0
- package/dist/templates/window/index.js.map +1 -0
- package/dist/templates/window/title.d.ts +9 -0
- package/dist/templates/window/title.d.ts.map +1 -0
- package/dist/templates/window/title.js +24 -0
- package/dist/templates/window/title.js.map +1 -0
- package/dist/texture/chevrons.d.ts +13 -0
- package/dist/texture/chevrons.d.ts.map +1 -0
- package/dist/texture/chevrons.js +22 -0
- package/dist/texture/chevrons.js.map +1 -0
- package/dist/texture/color.d.ts +10 -0
- package/dist/texture/color.d.ts.map +1 -0
- package/dist/texture/color.js +10 -0
- package/dist/texture/color.js.map +1 -0
- package/dist/texture/grid.d.ts +14 -0
- package/dist/texture/grid.d.ts.map +1 -0
- package/dist/texture/grid.js +38 -0
- package/dist/texture/grid.js.map +1 -0
- package/dist/texture/halftone.d.ts +14 -0
- package/dist/texture/halftone.d.ts.map +1 -0
- package/dist/texture/halftone.js +55 -0
- package/dist/texture/halftone.js.map +1 -0
- package/dist/texture/honeycomb.d.ts +14 -0
- package/dist/texture/honeycomb.d.ts.map +1 -0
- package/dist/texture/honeycomb.js +43 -0
- package/dist/texture/honeycomb.js.map +1 -0
- package/dist/texture/index.d.ts.map +1 -1
- package/dist/texture/index.js +44 -8
- package/dist/texture/index.js.map +1 -1
- package/dist/texture/moire.d.ts +18 -0
- package/dist/texture/moire.d.ts.map +1 -0
- package/dist/texture/moire.js +44 -0
- package/dist/texture/moire.js.map +1 -0
- package/dist/texture/pattern.d.ts +10 -0
- package/dist/texture/pattern.d.ts.map +1 -1
- package/dist/texture/pattern.js +37 -15
- package/dist/texture/pattern.js.map +1 -1
- package/dist/texture/rays.d.ts +13 -0
- package/dist/texture/rays.d.ts.map +1 -0
- package/dist/texture/rays.js +36 -0
- package/dist/texture/rays.js.map +1 -0
- package/dist/texture/resolve.d.ts +5 -4
- package/dist/texture/resolve.d.ts.map +1 -1
- package/dist/texture/resolve.js +5 -4
- package/dist/texture/resolve.js.map +1 -1
- package/dist/texture/scallops.d.ts +14 -0
- package/dist/texture/scallops.d.ts.map +1 -0
- package/dist/texture/scallops.js +29 -0
- package/dist/texture/scallops.js.map +1 -0
- package/dist/texture/tile.d.ts +14 -0
- package/dist/texture/tile.d.ts.map +1 -0
- package/dist/texture/tile.js +23 -0
- package/dist/texture/tile.js.map +1 -0
- package/dist/texture/topographic/contours.d.ts +13 -0
- package/dist/texture/topographic/contours.d.ts.map +1 -0
- package/dist/texture/topographic/contours.js +72 -0
- package/dist/texture/topographic/contours.js.map +1 -0
- package/dist/texture/topographic/field.d.ts +8 -0
- package/dist/texture/topographic/field.d.ts.map +1 -0
- package/dist/texture/topographic/field.js +29 -0
- package/dist/texture/topographic/field.js.map +1 -0
- package/dist/texture/topographic/index.d.ts +17 -0
- package/dist/texture/topographic/index.d.ts.map +1 -0
- package/dist/texture/topographic/index.js +48 -0
- package/dist/texture/topographic/index.js.map +1 -0
- package/dist/texture/waves.d.ts +18 -0
- package/dist/texture/waves.d.ts.map +1 -0
- package/dist/texture/waves.js +55 -0
- package/dist/texture/waves.js.map +1 -0
- package/dist/theme/presets.d.ts +13 -5
- package/dist/theme/presets.d.ts.map +1 -1
- package/dist/theme/presets.js +16 -5
- package/dist/theme/presets.js.map +1 -1
- package/dist/types.d.ts +256 -7
- package/dist/types.d.ts.map +1 -1
- package/dist/validate/collect.d.ts.map +1 -1
- package/dist/validate/collect.js +2 -1
- package/dist/validate/collect.js.map +1 -1
- package/dist/validate/keys.d.ts +41 -2
- package/dist/validate/keys.d.ts.map +1 -1
- package/dist/validate/keys.js +141 -4
- package/dist/validate/keys.js.map +1 -1
- package/dist/validate/texture.d.ts +4 -5
- package/dist/validate/texture.d.ts.map +1 -1
- package/dist/validate/texture.js +11 -16
- package/dist/validate/texture.js.map +1 -1
- package/dist/validate/values.d.ts +6 -0
- package/dist/validate/values.d.ts.map +1 -1
- package/dist/validate/values.js +16 -1
- package/dist/validate/values.js.map +1 -1
- package/package.json +23 -31
- package/dist/highlight/probe.d.ts +0 -4
- package/dist/highlight/probe.d.ts.map +0 -1
- package/dist/highlight/probe.js +0 -4
- package/dist/highlight/probe.js.map +0 -1
- package/dist/jpeg/index.d.ts +0 -10
- package/dist/jpeg/index.d.ts.map +0 -1
- package/dist/jpeg/index.js +0 -2
- package/dist/jpeg/index.js.map +0 -1
- package/dist/render/png.d.ts +0 -20
- package/dist/render/png.d.ts.map +0 -1
- package/dist/render/png.js +0 -29
- package/dist/render/png.js.map +0 -1
- package/dist/stamp/chunk.d.ts +0 -14
- package/dist/stamp/chunk.d.ts.map +0 -1
- package/dist/stamp/chunk.js +0 -38
- package/dist/stamp/chunk.js.map +0 -1
- package/dist/templates/code/ellipsis.d.ts +0 -3
- package/dist/templates/code/ellipsis.d.ts.map +0 -1
- package/dist/templates/code/ellipsis.js +0 -3
- package/dist/templates/code/ellipsis.js.map +0 -1
- package/dist/templates/terminal/window.d.ts.map +0 -1
- package/dist/templates/terminal/window.js +0 -84
- package/dist/templates/terminal/window.js.map +0 -1
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { box } from "../../layout/index.js";
|
|
2
|
+
import { windowDots } from "./dots.js";
|
|
3
|
+
import { windowTitle } from "./title.js";
|
|
4
|
+
/** The title bar's height, as a fraction of the window's width. */
|
|
5
|
+
const barScale = 0.055;
|
|
6
|
+
/** The buttons' diameter, as a fraction of the bar's height. */
|
|
7
|
+
const buttonScale = 0.26;
|
|
8
|
+
/** How tall the title bar is on a window of this width. */
|
|
9
|
+
export function barHeight(windowWidth) {
|
|
10
|
+
return Math.round(windowWidth * barScale);
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* A rectangle with its top corners rounded and its bottom ones square, which
|
|
14
|
+
* is the shape of a title bar sitting in the top of a rounded window.
|
|
15
|
+
*
|
|
16
|
+
* It has to be one shape rather than a rounded rectangle with a square one
|
|
17
|
+
* over its bottom half, which is the obvious way to do it and the wrong one:
|
|
18
|
+
* the band is drawn at low opacity, so anywhere the two overlapped would be
|
|
19
|
+
* painted twice and come out as a lighter block with a curve through it.
|
|
20
|
+
*/
|
|
21
|
+
function roundedTop(rect, radius) {
|
|
22
|
+
const { x, y, width, height } = rect;
|
|
23
|
+
const r = Math.min(radius, Math.round(width / 2), height);
|
|
24
|
+
return (`M${String(x)} ${String(y + r)}` +
|
|
25
|
+
`a${String(r)} ${String(r)} 0 0 1 ${String(r)} ${String(-r)}` +
|
|
26
|
+
`h${String(width - r * 2)}` +
|
|
27
|
+
`a${String(r)} ${String(r)} 0 0 1 ${String(r)} ${String(r)}` +
|
|
28
|
+
`v${String(height - r)}h${String(-width)}z`);
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* The bar across the top of the window: a lighter band, the buttons, and the
|
|
32
|
+
* title in the middle of what is left.
|
|
33
|
+
*
|
|
34
|
+
* The band is white at low opacity rather than a colour of its own, so it
|
|
35
|
+
* lifts whatever the code theme's background happens to be instead of having
|
|
36
|
+
* to be chosen against it.
|
|
37
|
+
*/
|
|
38
|
+
export function titleBar(window, height, title, config, measure, dots = "macos") {
|
|
39
|
+
const band = `<path d="${roundedTop({ x: window.x, y: window.y, width: window.width, height }, window.radius)}"` +
|
|
40
|
+
` fill="#ffffff" fill-opacity="0.07"/>${box({ x: window.x, y: window.y + height, width: window.width, height: 1 }, { fill: "#ffffff", fillOpacity: 0.1 })}`;
|
|
41
|
+
const lights = windowDots(dots, {
|
|
42
|
+
left: window.x + Math.round(height * 0.6),
|
|
43
|
+
middle: window.y + Math.round(height / 2),
|
|
44
|
+
diameter: Math.round(height * buttonScale),
|
|
45
|
+
});
|
|
46
|
+
return band + lights + windowTitle(title, window, height, config, measure);
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/templates/window/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAC;AAI5C,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAEvC,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAIzC,mEAAmE;AACnE,MAAM,QAAQ,GAAG,KAAK,CAAC;AAEvB,gEAAgE;AAChE,MAAM,WAAW,GAAG,IAAI,CAAC;AAEzB,2DAA2D;AAC3D,MAAM,UAAU,SAAS,CAAC,WAAmB;IAC3C,OAAO,IAAI,CAAC,KAAK,CAAC,WAAW,GAAG,QAAQ,CAAC,CAAC;AAC5C,CAAC;AAED;;;;;;;;GAQG;AACH,SAAS,UAAU,CAAC,IAAU,EAAE,MAAc;IAC5C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C,KAAK,EAAE,MAAM,EAAE,CAAC,EAAE,EACrE,EAAE,IAAI,EAAE,SAAS,EAAE,WAAW,EAAE,GAAG,EAAE,CACtC,EAAE,CAAC;IAEN,MAAM,MAAM,GAAG,UAAU,CAAC,IAAI,EAAE;QAC9B,IAAI,EAAE,MAAM,CAAC,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,GAAG,CAAC;QACzC,MAAM,EAAE,MAAM,CAAC,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC;QACzC,QAAQ,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,WAAW,CAAC;KAC3C,CAAC,CAAC;IAEH,OAAO,IAAI,GAAG,MAAM,GAAG,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;AAC7E,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { MeasureText, ResolvedConfig } from "../../types.js";
|
|
2
|
+
import type { Panel } from "../code/panel.js";
|
|
3
|
+
/**
|
|
4
|
+
* The window's title, centred in the bar. It is cut to the room between the
|
|
5
|
+
* buttons and the far edge, taking the buttons' width off both sides so that
|
|
6
|
+
* it stays centred in the bar rather than in what the buttons left.
|
|
7
|
+
*/
|
|
8
|
+
export declare function windowTitle(title: string, window: Panel, height: number, config: ResolvedConfig, measure: MeasureText): string;
|
|
9
|
+
//# sourceMappingURL=title.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"title.d.ts","sourceRoot":"","sources":["../../../src/templates/window/title.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAClE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAE9C;;;;GAIG;AACH,wBAAgB,WAAW,CACzB,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,KAAK,EACb,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,cAAc,EACtB,OAAO,EAAE,WAAW,GACnB,MAAM,CA0BR"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { baselineFor, clampLine, measureIn, textElement, } from "../../layout/index.js";
|
|
2
|
+
/**
|
|
3
|
+
* The window's title, centred in the bar. It is cut to the room between the
|
|
4
|
+
* buttons and the far edge, taking the buttons' width off both sides so that
|
|
5
|
+
* it stays centred in the bar rather than in what the buttons left.
|
|
6
|
+
*/
|
|
7
|
+
export function windowTitle(title, window, height, config, measure) {
|
|
8
|
+
if (title === "") {
|
|
9
|
+
return "";
|
|
10
|
+
}
|
|
11
|
+
const fontSize = Math.round(height * 0.42);
|
|
12
|
+
const reserved = Math.round(height * 2.4);
|
|
13
|
+
return textElement(clampLine(title, window.width - reserved * 2, measureIn(measure, config.fontFamily, 600), fontSize), {
|
|
14
|
+
x: Math.round(window.x + window.width / 2),
|
|
15
|
+
y: baselineFor(window.y + (height - fontSize) / 2, fontSize),
|
|
16
|
+
fontFamily: config.fontFamily,
|
|
17
|
+
fontSize,
|
|
18
|
+
fontWeight: 600,
|
|
19
|
+
fill: "#ffffff",
|
|
20
|
+
fillOpacity: 0.6,
|
|
21
|
+
anchor: "middle",
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=title.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"title.js","sourceRoot":"","sources":["../../../src/templates/window/title.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EACX,SAAS,EACT,SAAS,EACT,WAAW,GACZ,MAAM,uBAAuB,CAAC;AAI/B;;;;GAIG;AACH,MAAM,UAAU,WAAW,CACzB,KAAa,EACb,MAAa,EACb,MAAc,EACd,MAAsB,EACtB,OAAoB;IAEpB,IAAI,KAAK,KAAK,EAAE,EAAE,CAAC;QACjB,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IAC3C,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,GAAG,CAAC,CAAC;IAE1C,OAAO,WAAW,CAChB,SAAS,CACP,KAAK,EACL,MAAM,CAAC,KAAK,GAAG,QAAQ,GAAG,CAAC,EAC3B,SAAS,CAAC,OAAO,EAAE,MAAM,CAAC,UAAU,EAAE,GAAG,CAAC,EAC1C,QAAQ,CACT,EACD;QACE,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,GAAG,MAAM,CAAC,KAAK,GAAG,CAAC,CAAC;QAC1C,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,MAAM,GAAG,QAAQ,CAAC,GAAG,CAAC,EAAE,QAAQ,CAAC;QAC5D,UAAU,EAAE,MAAM,CAAC,UAAU;QAC7B,QAAQ;QACR,UAAU,EAAE,GAAG;QACf,IAAI,EAAE,SAAS;QACf,WAAW,EAAE,GAAG;QAChB,MAAM,EAAE,QAAQ;KACjB,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Dimensions, Texture } from "../types.js";
|
|
2
|
+
/**
|
|
3
|
+
* Rows of chevrons: one V to a tile, meeting its neighbours at the tile edge.
|
|
4
|
+
*
|
|
5
|
+
* The V spans the whole width and stops short of the top and bottom, so the
|
|
6
|
+
* rows have air between them. Its ends sit at the same height on both edges,
|
|
7
|
+
* which is what makes one tile's chevron continue into the next rather than
|
|
8
|
+
* ending in a corner.
|
|
9
|
+
*/
|
|
10
|
+
export declare function chevronsSvg(texture: Extract<Texture, {
|
|
11
|
+
readonly type: "chevrons";
|
|
12
|
+
}>, dimensions: Dimensions, id: string): string;
|
|
13
|
+
//# sourceMappingURL=chevrons.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chevrons.d.ts","sourceRoot":"","sources":["../../src/texture/chevrons.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAMvD;;;;;;;GAOG;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,CAkBR"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { fallbackColor } from "./color.js";
|
|
2
|
+
import { tile } from "./tile.js";
|
|
3
|
+
const chevronDefaults = { opacity: 0.07, width: 2, gap: 36 };
|
|
4
|
+
/**
|
|
5
|
+
* Rows of chevrons: one V to a tile, meeting its neighbours at the tile edge.
|
|
6
|
+
*
|
|
7
|
+
* The V spans the whole width and stops short of the top and bottom, so the
|
|
8
|
+
* rows have air between them. Its ends sit at the same height on both edges,
|
|
9
|
+
* which is what makes one tile's chevron continue into the next rather than
|
|
10
|
+
* ending in a corner.
|
|
11
|
+
*/
|
|
12
|
+
export function chevronsSvg(texture, dimensions, id) {
|
|
13
|
+
const gap = texture.gap ?? chevronDefaults.gap;
|
|
14
|
+
const low = String(gap * 0.7);
|
|
15
|
+
const high = String(gap * 0.3);
|
|
16
|
+
const chevron = `<path d="M0 ${low}L${String(gap / 2)} ${high}L${String(gap)} ${low}"` +
|
|
17
|
+
` stroke="${texture.color ?? fallbackColor}"` +
|
|
18
|
+
` stroke-width="${String(texture.width ?? chevronDefaults.width)}"` +
|
|
19
|
+
` fill="none"/>`;
|
|
20
|
+
return tile(id, gap, chevron, "", dimensions, texture.opacity ?? chevronDefaults.opacity);
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=chevrons.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chevrons.js","sourceRoot":"","sources":["../../src/texture/chevrons.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,GAAG,EAAE,EAAE,EAAE,CAAC;AAE7D;;;;;;;GAOG;AACH,MAAM,UAAU,WAAW,CACzB,OAAwD,EACxD,UAAsB,EACtB,EAAU;IAEV,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,IAAI,eAAe,CAAC,GAAG,CAAC;IAC/C,MAAM,GAAG,GAAG,MAAM,CAAC,GAAG,GAAG,GAAG,CAAC,CAAC;IAC9B,MAAM,IAAI,GAAG,MAAM,CAAC,GAAG,GAAG,GAAG,CAAC,CAAC;IAC/B,MAAM,OAAO,GACX,eAAe,GAAG,IAAI,MAAM,CAAC,GAAG,GAAG,CAAC,CAAC,IAAI,IAAI,IAAI,MAAM,CAAC,GAAG,CAAC,IAAI,GAAG,GAAG;QACtE,YAAY,OAAO,CAAC,KAAK,IAAI,aAAa,GAAG;QAC7C,kBAAkB,MAAM,CAAC,OAAO,CAAC,KAAK,IAAI,eAAe,CAAC,KAAK,CAAC,GAAG;QACnE,gBAAgB,CAAC;IAEnB,OAAO,IAAI,CACT,EAAE,EACF,GAAG,EACH,OAAO,EACP,EAAE,EACF,UAAU,EACV,OAAO,CAAC,OAAO,IAAI,eAAe,CAAC,OAAO,CAC3C,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The colour a texture draws in where the palette did not supply one.
|
|
3
|
+
*
|
|
4
|
+
* `resolveTexture` fills the foreground colour in for anything that came
|
|
5
|
+
* through config, so this is only reached by a texture built by hand, such as
|
|
6
|
+
* one a test or a custom template passes to `textureSvg` directly. It is here
|
|
7
|
+
* rather than in either drawing module because both of them need it.
|
|
8
|
+
*/
|
|
9
|
+
export declare const fallbackColor = "#ffffff";
|
|
10
|
+
//# sourceMappingURL=color.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"color.d.ts","sourceRoot":"","sources":["../../src/texture/color.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,eAAO,MAAM,aAAa,YAAY,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The colour a texture draws in where the palette did not supply one.
|
|
3
|
+
*
|
|
4
|
+
* `resolveTexture` fills the foreground colour in for anything that came
|
|
5
|
+
* through config, so this is only reached by a texture built by hand, such as
|
|
6
|
+
* one a test or a custom template passes to `textureSvg` directly. It is here
|
|
7
|
+
* rather than in either drawing module because both of them need it.
|
|
8
|
+
*/
|
|
9
|
+
export const fallbackColor = "#ffffff";
|
|
10
|
+
//# sourceMappingURL=color.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"color.js","sourceRoot":"","sources":["../../src/texture/color.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,SAAS,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Dimensions, Texture } from "../types.js";
|
|
2
|
+
/**
|
|
3
|
+
* Squared paper: lines both ways, and a heavier one every so often.
|
|
4
|
+
*
|
|
5
|
+
* The heavy lines are a second tile rather than part of the first, since what
|
|
6
|
+
* makes them heavy is that they repeat at a multiple of the spacing. Drawing
|
|
7
|
+
* both from `<pattern>`s keeps this among the cheap treatments: the tiles are
|
|
8
|
+
* square to the image, so a row of the rendered picture repeats, which is what
|
|
9
|
+
* the compression works on.
|
|
10
|
+
*/
|
|
11
|
+
export declare function gridSvg(texture: Extract<Texture, {
|
|
12
|
+
readonly type: "grid";
|
|
13
|
+
}>, dimensions: Dimensions, id: string): string;
|
|
14
|
+
//# sourceMappingURL=grid.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"grid.d.ts","sourceRoot":"","sources":["../../src/texture/grid.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AA4BvD;;;;;;;;GAQG;AACH,wBAAgB,OAAO,CACrB,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC,EACpD,UAAU,EAAE,UAAU,EACtB,EAAE,EAAE,MAAM,GACT,MAAM,CA8BR"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { fallbackColor } from "./color.js";
|
|
2
|
+
import { tile } from "./tile.js";
|
|
3
|
+
const gridDefaults = { opacity: 0.07, width: 1, gap: 32, major: 5 };
|
|
4
|
+
/** How much heavier the every-so-often line is than the rest. */
|
|
5
|
+
const majorScale = 2;
|
|
6
|
+
/** One square's worth of grid: a line along two of its edges. */
|
|
7
|
+
function square(texture, gap, width) {
|
|
8
|
+
const middle = String(gap / 2);
|
|
9
|
+
const size = String(gap);
|
|
10
|
+
// Down the middle of the tile on both axes rather than along its edges, for
|
|
11
|
+
// the reason `rulesSvg` gives: a stroke centred on the edge would have half
|
|
12
|
+
// of itself outside the tile, where the pattern does not repeat it.
|
|
13
|
+
return (`<path d="M0 ${middle}H${size}M${middle} 0V${size}"` +
|
|
14
|
+
` stroke="${texture.color ?? fallbackColor}"` +
|
|
15
|
+
` stroke-width="${String(width)}" fill="none"/>`);
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Squared paper: lines both ways, and a heavier one every so often.
|
|
19
|
+
*
|
|
20
|
+
* The heavy lines are a second tile rather than part of the first, since what
|
|
21
|
+
* makes them heavy is that they repeat at a multiple of the spacing. Drawing
|
|
22
|
+
* both from `<pattern>`s keeps this among the cheap treatments: the tiles are
|
|
23
|
+
* square to the image, so a row of the rendered picture repeats, which is what
|
|
24
|
+
* the compression works on.
|
|
25
|
+
*/
|
|
26
|
+
export function gridSvg(texture, dimensions, id) {
|
|
27
|
+
const gap = texture.gap ?? gridDefaults.gap;
|
|
28
|
+
const width = texture.width ?? gridDefaults.width;
|
|
29
|
+
const opacity = texture.opacity ?? gridDefaults.opacity;
|
|
30
|
+
const major = texture.major ?? gridDefaults.major;
|
|
31
|
+
const fine = tile(`${id}a`, gap, square(texture, gap, width), "", dimensions, opacity);
|
|
32
|
+
if (major < 2) {
|
|
33
|
+
return fine;
|
|
34
|
+
}
|
|
35
|
+
return (fine +
|
|
36
|
+
tile(`${id}b`, gap * major, square(texture, gap * major, width * majorScale), "", dimensions, opacity));
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=grid.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"grid.js","sourceRoot":"","sources":["../../src/texture/grid.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,MAAM,YAAY,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC;AAEpE,iEAAiE;AACjE,MAAM,UAAU,GAAG,CAAC,CAAC;AAErB,iEAAiE;AACjE,SAAS,MAAM,CACb,OAAoD,EACpD,GAAW,EACX,KAAa;IAEb,MAAM,MAAM,GAAG,MAAM,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC;IAC/B,MAAM,IAAI,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;IAEzB,4EAA4E;IAC5E,4EAA4E;IAC5E,oEAAoE;IACpE,OAAO,CACL,eAAe,MAAM,IAAI,IAAI,IAAI,MAAM,MAAM,IAAI,GAAG;QACpD,YAAY,OAAO,CAAC,KAAK,IAAI,aAAa,GAAG;QAC7C,kBAAkB,MAAM,CAAC,KAAK,CAAC,iBAAiB,CACjD,CAAC;AACJ,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,OAAO,CACrB,OAAoD,EACpD,UAAsB,EACtB,EAAU;IAEV,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,IAAI,YAAY,CAAC,GAAG,CAAC;IAC5C,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,IAAI,YAAY,CAAC,KAAK,CAAC;IAClD,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,IAAI,YAAY,CAAC,OAAO,CAAC;IACxD,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,IAAI,YAAY,CAAC,KAAK,CAAC;IAElD,MAAM,IAAI,GAAG,IAAI,CACf,GAAG,EAAE,GAAG,EACR,GAAG,EACH,MAAM,CAAC,OAAO,EAAE,GAAG,EAAE,KAAK,CAAC,EAC3B,EAAE,EACF,UAAU,EACV,OAAO,CACR,CAAC;IAEF,IAAI,KAAK,GAAG,CAAC,EAAE,CAAC;QACd,OAAO,IAAI,CAAC;IACd,CAAC;IAED,OAAO,CACL,IAAI;QACJ,IAAI,CACF,GAAG,EAAE,GAAG,EACR,GAAG,GAAG,KAAK,EACX,MAAM,CAAC,OAAO,EAAE,GAAG,GAAG,KAAK,EAAE,KAAK,GAAG,UAAU,CAAC,EAChD,EAAE,EACF,UAAU,EACV,OAAO,CACR,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Dimensions, Texture } from "../types.js";
|
|
2
|
+
/**
|
|
3
|
+
* A grid of dots that grow across the image, which is a gradient made out of
|
|
4
|
+
* print.
|
|
5
|
+
*
|
|
6
|
+
* It cannot be a tile: every dot is a different size, which is the whole
|
|
7
|
+
* effect. What keeps it affordable is that the size depends on the position
|
|
8
|
+
* rather than on chance, so a run of dots across the image is a smooth ramp
|
|
9
|
+
* and there is nothing noisy for the compression to choke on.
|
|
10
|
+
*/
|
|
11
|
+
export declare function halftoneSvg(texture: Extract<Texture, {
|
|
12
|
+
readonly type: "halftone";
|
|
13
|
+
}>, dimensions: Dimensions): string;
|
|
14
|
+
//# sourceMappingURL=halftone.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"halftone.d.ts","sourceRoot":"","sources":["../../src/texture/halftone.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAsCvD;;;;;;;;GAQG;AACH,wBAAgB,WAAW,CACzB,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE;IAAE,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAA;CAAE,CAAC,EACxD,UAAU,EAAE,UAAU,GACrB,MAAM,CAuBR"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { fallbackColor } from "./color.js";
|
|
2
|
+
const halftoneDefaults = {
|
|
3
|
+
opacity: 0.12,
|
|
4
|
+
size: 12,
|
|
5
|
+
gap: 30,
|
|
6
|
+
angle: 90,
|
|
7
|
+
from: 0.1,
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* How far along the growth a point is, from 0 at one edge to 1 at the other.
|
|
11
|
+
*
|
|
12
|
+
* It is the point's distance along the direction the dots grow in, measured
|
|
13
|
+
* from whichever corner is furthest back along it, so the ramp covers the
|
|
14
|
+
* whole image whatever angle it runs at.
|
|
15
|
+
*/
|
|
16
|
+
function ramp(dimensions, angle) {
|
|
17
|
+
const radians = (angle * Math.PI) / 180;
|
|
18
|
+
const dx = Math.cos(radians);
|
|
19
|
+
const dy = Math.sin(radians);
|
|
20
|
+
const { width, height } = dimensions;
|
|
21
|
+
// The four corners projected onto the direction give its full span, so the
|
|
22
|
+
// ends of the ramp land on the image rather than somewhere outside it.
|
|
23
|
+
const corners = [0, width].flatMap((cx) => [0, height].map((cy) => cx * dx + cy * dy));
|
|
24
|
+
const low = Math.min(...corners);
|
|
25
|
+
const span = Math.max(...corners) - low || 1;
|
|
26
|
+
return (px, py) => (px * dx + py * dy - low) / span;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* A grid of dots that grow across the image, which is a gradient made out of
|
|
30
|
+
* print.
|
|
31
|
+
*
|
|
32
|
+
* It cannot be a tile: every dot is a different size, which is the whole
|
|
33
|
+
* effect. What keeps it affordable is that the size depends on the position
|
|
34
|
+
* rather than on chance, so a run of dots across the image is a smooth ramp
|
|
35
|
+
* and there is nothing noisy for the compression to choke on.
|
|
36
|
+
*/
|
|
37
|
+
export function halftoneSvg(texture, dimensions) {
|
|
38
|
+
const gap = texture.gap ?? halftoneDefaults.gap;
|
|
39
|
+
const size = texture.size ?? halftoneDefaults.size;
|
|
40
|
+
const from = texture.from ?? halftoneDefaults.from;
|
|
41
|
+
const at = ramp(dimensions, texture.angle ?? halftoneDefaults.angle);
|
|
42
|
+
let dots = "";
|
|
43
|
+
for (let y = gap / 2; y < dimensions.height + gap; y += gap) {
|
|
44
|
+
for (let x = gap / 2; x < dimensions.width + gap; x += gap) {
|
|
45
|
+
const radius = (size / 2) * (from + (1 - from) * at(x, y));
|
|
46
|
+
dots +=
|
|
47
|
+
`<circle cx="${String(Math.round(x))}" cy="${String(Math.round(y))}"` +
|
|
48
|
+
` r="${String(Math.round(radius * 100) / 100)}"/>`;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
return (`<g fill="${texture.color ?? fallbackColor}"` +
|
|
52
|
+
` opacity="${String(texture.opacity ?? halftoneDefaults.opacity)}">` +
|
|
53
|
+
`${dots}</g>`);
|
|
54
|
+
}
|
|
55
|
+
//# sourceMappingURL=halftone.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"halftone.js","sourceRoot":"","sources":["../../src/texture/halftone.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAE3C,MAAM,gBAAgB,GAAG;IACvB,OAAO,EAAE,IAAI;IACb,IAAI,EAAE,EAAE;IACR,GAAG,EAAE,EAAE;IACP,KAAK,EAAE,EAAE;IACT,IAAI,EAAE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I,CAAC;IACnD,MAAM,EAAE,GAAG,IAAI,CAAC,UAAU,EAAE,OAAO,CAAC,KAAK,IAAI,gBAAgB,CAAC,KAAK,CAAC,CAAC;IAErE,IAAI,IAAI,GAAG,EAAE,CAAC;IAEd,KAAK,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC,EAAE,CAAC,GAAG,UAAU,CAAC,MAAM,GAAG,GAAG,EAAE,CAAC,IAAI,GAAG,EAAE,CAAC;QAC5D,KAAK,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC,EAAE,CAAC,GAAG,UAAU,CAAC,KAAK,GAAG,GAAG,EAAE,CAAC,IAAI,GAAG,EAAE,CAAC;YAC3D,MAAM,MAAM,GAAG,CAAC,IAAI,GAAG,CAAC,CAAC,GAAG,CAAC,IAAI,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;YAE3D,IAAI;gBACF,eAAe,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG;oBACrE,OAAO,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,GAAG,CAAC,GAAG,GAAG,CAAC,KAAK,CAAC;QACvD,CAAC;IACH,CAAC;IAED,OAAO,CACL,YAAY,OAAO,CAAC,KAAK,IAAI,aAAa,GAAG;QAC7C,aAAa,MAAM,CAAC,OAAO,CAAC,OAAO,IAAI,gBAAgB,CAAC,OAAO,CAAC,IAAI;QACpE,GAAG,IAAI,MAAM,CACd,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Dimensions, Texture } from "../types.js";
|
|
2
|
+
/**
|
|
3
|
+
* A honeycomb of hexagon outlines.
|
|
4
|
+
*
|
|
5
|
+
* The grid repeats every three sides across and every `side * sqrt(3)` down,
|
|
6
|
+
* which is the smallest rectangle a honeycomb fits in. Two hexagons go in it,
|
|
7
|
+
* the second offset by half of each, and the ones that fall outside are drawn
|
|
8
|
+
* anyway so that the tile joins its neighbours: the pattern clips them, and a
|
|
9
|
+
* hexagon cut in half by the tile edge meets its other half in the next tile.
|
|
10
|
+
*/
|
|
11
|
+
export declare function honeycombSvg(texture: Extract<Texture, {
|
|
12
|
+
readonly type: "honeycomb";
|
|
13
|
+
}>, dimensions: Dimensions, id: string): string;
|
|
14
|
+
//# sourceMappingURL=honeycomb.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"honeycomb.d.ts","sourceRoot":"","sources":["../../src/texture/honeycomb.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AA8BvD;;;;;;;;GAQG;AACH,wBAAgB,YAAY,CAC1B,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE;IAAE,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAA;CAAE,CAAC,EACzD,UAAU,EAAE,UAAU,EACtB,EAAE,EAAE,MAAM,GACT,MAAM,CAwBR"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { fallbackColor } from "./color.js";
|
|
2
|
+
import { tile } from "./tile.js";
|
|
3
|
+
const combDefaults = { opacity: 0.07, width: 1.5, size: 26 };
|
|
4
|
+
/** Rounded to keep the path short, since it is written out twice a tile. */
|
|
5
|
+
function at(value) {
|
|
6
|
+
return String(Math.round(value * 100) / 100);
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* One flat-topped hexagon, from its centre and the length of a side.
|
|
10
|
+
*
|
|
11
|
+
* A hexagon of side `s` is `2s` across the points and `s * sqrt(3)` across the
|
|
12
|
+
* flats, which is where every number below comes from.
|
|
13
|
+
*/
|
|
14
|
+
function hexagon(cx, cy, side) {
|
|
15
|
+
const half = (side * Math.sqrt(3)) / 2;
|
|
16
|
+
return (`M${at(cx - side)} ${at(cy)}` +
|
|
17
|
+
`L${at(cx - side / 2)} ${at(cy - half)}` +
|
|
18
|
+
`L${at(cx + side / 2)} ${at(cy - half)}` +
|
|
19
|
+
`L${at(cx + side)} ${at(cy)}` +
|
|
20
|
+
`L${at(cx + side / 2)} ${at(cy + half)}` +
|
|
21
|
+
`L${at(cx - side / 2)} ${at(cy + half)}Z`);
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* A honeycomb of hexagon outlines.
|
|
25
|
+
*
|
|
26
|
+
* The grid repeats every three sides across and every `side * sqrt(3)` down,
|
|
27
|
+
* which is the smallest rectangle a honeycomb fits in. Two hexagons go in it,
|
|
28
|
+
* the second offset by half of each, and the ones that fall outside are drawn
|
|
29
|
+
* anyway so that the tile joins its neighbours: the pattern clips them, and a
|
|
30
|
+
* hexagon cut in half by the tile edge meets its other half in the next tile.
|
|
31
|
+
*/
|
|
32
|
+
export function honeycombSvg(texture, dimensions, id) {
|
|
33
|
+
const side = texture.size ?? combDefaults.size;
|
|
34
|
+
const height = side * Math.sqrt(3);
|
|
35
|
+
const width = side * 3;
|
|
36
|
+
const comb = `<path d="${hexagon(side, height / 2, side)}${hexagon(side * 2.5, 0, side)}${hexagon(side * 2.5, height, side)}" stroke="${texture.color ?? fallbackColor}"` +
|
|
37
|
+
` stroke-width="${String(texture.width ?? combDefaults.width)}"` +
|
|
38
|
+
` fill="none"/>`;
|
|
39
|
+
// Not the square tile the others use: a honeycomb's repeat is wider than it
|
|
40
|
+
// is tall, so `tile` takes the two separately here.
|
|
41
|
+
return tile(id, { width, height }, comb, "", dimensions, texture.opacity ?? combDefaults.opacity);
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=honeycomb.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"honeycomb.js","sourceRoot":"","sources":["../../src/texture/honeycomb.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,EAAE,I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AAI,YAAY,CAAC,IAAI,CAAC;IAC/C,MAAM,MAAM,GAAG,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACnC,MAAM,KAAK,GAAG,IAAI,GAAG,CAAC,CAAC;IAEvB,MAAM,IAAI,GACR,YAAY,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,CAAC,EAAE,IAAI,CAAC,GAAG,OAAO,CACnD,IAAI,GAAG,GAAG,EACV,CAAC,EACD,IAAI,CACL,GAAG,OAAO,CAAC,IAAI,GAAG,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,aAAa,OAAO,CAAC,KAAK,IAAI,aAAa,GAAG;QACnF,kBAAkB,MAAM,CAAC,OAAO,CAAC,KAAK,IAAI,YAAY,CAAC,KAAK,CAAC,GAAG;QAChE,gBAAgB,CAAC;IAEnB,4EAA4E;IAC5E,oDAAoD;IACpD,OAAO,IAAI,CACT,EAAE,EACF,EAAE,KAAK,EAAE,MAAM,EAAE,EACjB,IAAI,EACJ,EAAE,EACF,UAAU,EACV,OAAO,CAAC,OAAO,IAAI,YAAY,CAAC,OAAO,CACxC,CAAC;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/texture/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/texture/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAavD,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAuC9C;;;;;;GAMG;AACH,wBAAgB,UAAU,CACxB,OAAO,EAAE,OAAO,EAChB,UAAU,EAAE,UAAU,EACtB,EAAE,EAAE,MAAM,GACT,MAAM,CAOR"}
|
package/dist/texture/index.js
CHANGED
|
@@ -1,6 +1,44 @@
|
|
|
1
|
+
import { chevronsSvg } from "./chevrons.js";
|
|
1
2
|
import { grainSvg } from "./grain.js";
|
|
2
|
-
import {
|
|
3
|
+
import { halftoneSvg } from "./halftone.js";
|
|
4
|
+
import { gridSvg } from "./grid.js";
|
|
5
|
+
import { honeycombSvg } from "./honeycomb.js";
|
|
6
|
+
import { moireSvg } from "./moire.js";
|
|
7
|
+
import { crossesSvg, dotsSvg, rulesSvg } from "./pattern.js";
|
|
8
|
+
import { raysSvg } from "./rays.js";
|
|
9
|
+
import { scallopsSvg } from "./scallops.js";
|
|
10
|
+
import { topographicSvg } from "./topographic/index.js";
|
|
11
|
+
import { wavesSvg } from "./waves.js";
|
|
3
12
|
export { resolveTexture } from "./resolve.js";
|
|
13
|
+
/**
|
|
14
|
+
* Which function draws which treatment.
|
|
15
|
+
*
|
|
16
|
+
* A table rather than a chain of `if`s, because the chain had a branch per
|
|
17
|
+
* texture and there are ten of them: the file was close to the complexity
|
|
18
|
+
* threshold and every new treatment made it worse. The type is what keeps this
|
|
19
|
+
* honest, and it does the job the chain's final `return` used to do badly: a
|
|
20
|
+
* variant added to `Texture` with no entry here fails to compile, where before
|
|
21
|
+
* it silently came out as ruled lines.
|
|
22
|
+
*
|
|
23
|
+
* `waves` and `rays` name nothing in `<defs>` and take no id. They are wrapped
|
|
24
|
+
* rather than given a parameter to ignore, so each one's own signature still
|
|
25
|
+
* says what it uses.
|
|
26
|
+
*/
|
|
27
|
+
const drawers = {
|
|
28
|
+
grain: grainSvg,
|
|
29
|
+
dots: dotsSvg,
|
|
30
|
+
rules: rulesSvg,
|
|
31
|
+
grid: gridSvg,
|
|
32
|
+
crosses: crossesSvg,
|
|
33
|
+
chevrons: chevronsSvg,
|
|
34
|
+
honeycomb: honeycombSvg,
|
|
35
|
+
moire: moireSvg,
|
|
36
|
+
scallops: scallopsSvg,
|
|
37
|
+
waves: (texture, dimensions) => wavesSvg(texture, dimensions),
|
|
38
|
+
rays: (texture, dimensions) => raysSvg(texture, dimensions),
|
|
39
|
+
halftone: (texture, dimensions) => halftoneSvg(texture, dimensions),
|
|
40
|
+
topographic: (texture, dimensions) => topographicSvg(texture, dimensions),
|
|
41
|
+
};
|
|
4
42
|
/**
|
|
5
43
|
* Render the treatment laid over a background as SVG, naming whatever it needs
|
|
6
44
|
* in `<defs>` after the given `id`.
|
|
@@ -9,12 +47,10 @@ export { resolveTexture } from "./resolve.js";
|
|
|
9
47
|
* texture never comes between a headline and the reader.
|
|
10
48
|
*/
|
|
11
49
|
export function textureSvg(texture, dimensions, id) {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}
|
|
18
|
-
return rulesSvg(texture, dimensions, id);
|
|
50
|
+
// The value and the lookup narrow separately, so the compiler cannot see
|
|
51
|
+
// that they are the same variant, though the table's type is what makes them
|
|
52
|
+
// so. This is the one line that knows better than the checker.
|
|
53
|
+
const draw = drawers[texture.type];
|
|
54
|
+
return draw(texture, dimensions, id);
|
|
19
55
|
}
|
|
20
56
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/texture/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/texture/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,QAAQ,EAAE,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O,EAAE,UAAU,EAAE,EAAE,CAAC,CAAC;AACvC,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { Dimensions, Texture } from "../types.js";
|
|
2
|
+
/**
|
|
3
|
+
* Two square grids, one turned a few degrees against the other.
|
|
4
|
+
*
|
|
5
|
+
* What is seen is the interference between them rather than either grid: the
|
|
6
|
+
* lines cross at a different offset in every part of the image, which the eye
|
|
7
|
+
* reads as broad bands sweeping across it. It is the same idea as `waves` with
|
|
8
|
+
* straight edges instead of arcs, and that is what makes it much cheaper to
|
|
9
|
+
* store, since a row of the image is closer to repeating.
|
|
10
|
+
*
|
|
11
|
+
* The angle is the whole texture. Below about a degree the bands are wider
|
|
12
|
+
* than the image and it looks like one grid slightly out of true; above about
|
|
13
|
+
* ten they are tight enough to read as a weave.
|
|
14
|
+
*/
|
|
15
|
+
export declare function moireSvg(texture: Extract<Texture, {
|
|
16
|
+
readonly type: "moire";
|
|
17
|
+
}>, dimensions: Dimensions, id: string): string;
|
|
18
|
+
//# sourceMappingURL=moire.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"moire.d.ts","sourceRoot":"","sources":["../../src/texture/moire.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AA8CvD;;;;;;;;;;;;GAYG;AACH,wBAAgB,QAAQ,CACtB,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE;IAAE,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAA;CAAE,CAAC,EACrD,UAAU,EAAE,UAAU,EACtB,EAAE,EAAE,MAAM,GACT,MAAM,CAaR"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { fallbackColor } from "./color.js";
|
|
2
|
+
import { tile } from "./tile.js";
|
|
3
|
+
const moireDefaults = { opacity: 0.1, width: 1, gap: 16, angle: 4 };
|
|
4
|
+
/**
|
|
5
|
+
* How much fainter the turned grid is than the square one.
|
|
6
|
+
*
|
|
7
|
+
* The same reasoning as the second set of rings in `waves`: two grids at one
|
|
8
|
+
* opacity read as two grids, and dropping one of them is what turns the
|
|
9
|
+
* crossings into a surface.
|
|
10
|
+
*/
|
|
11
|
+
const secondaryScale = 0.65;
|
|
12
|
+
/** One square grid: a line through the middle of the tile on each axis. */
|
|
13
|
+
function grid(texture, dimensions, id, angle, opacity) {
|
|
14
|
+
const gap = texture.gap ?? moireDefaults.gap;
|
|
15
|
+
const middle = String(gap / 2);
|
|
16
|
+
const size = String(gap);
|
|
17
|
+
// Down the middle of the tile on both axes rather than along its edges, for
|
|
18
|
+
// the reason `rulesSvg` gives: a stroke centred on the edge would have half
|
|
19
|
+
// of itself outside the tile, where the pattern does not repeat it.
|
|
20
|
+
const lines = `<path d="M0 ${middle}H${size}M${middle} 0V${size}"` +
|
|
21
|
+
` stroke="${texture.color ?? fallbackColor}"` +
|
|
22
|
+
` stroke-width="${String(texture.width ?? moireDefaults.width)}"` +
|
|
23
|
+
` fill="none"/>`;
|
|
24
|
+
return tile(id, gap, lines, angle === 0 ? "" : ` patternTransform="rotate(${String(angle)})"`, dimensions, opacity);
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Two square grids, one turned a few degrees against the other.
|
|
28
|
+
*
|
|
29
|
+
* What is seen is the interference between them rather than either grid: the
|
|
30
|
+
* lines cross at a different offset in every part of the image, which the eye
|
|
31
|
+
* reads as broad bands sweeping across it. It is the same idea as `waves` with
|
|
32
|
+
* straight edges instead of arcs, and that is what makes it much cheaper to
|
|
33
|
+
* store, since a row of the image is closer to repeating.
|
|
34
|
+
*
|
|
35
|
+
* The angle is the whole texture. Below about a degree the bands are wider
|
|
36
|
+
* than the image and it looks like one grid slightly out of true; above about
|
|
37
|
+
* ten they are tight enough to read as a weave.
|
|
38
|
+
*/
|
|
39
|
+
export function moireSvg(texture, dimensions, id) {
|
|
40
|
+
const opacity = texture.opacity ?? moireDefaults.opacity;
|
|
41
|
+
return (grid(texture, dimensions, `${id}a`, 0, opacity) +
|
|
42
|
+
grid(texture, dimensions, `${id}b`, texture.angle ?? moireDefaults.angle, Math.round(opacity * secondaryScale * 1000) / 1000));
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=moire.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"moire.js","sourceRoot":"","sources":["../../src/texture/moire.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,MAAM,aAAa,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC;AAEpE;;;;;;GAMG;AACH,MAAM,cAAc,GAAG,IAAI,CAAC;AAE5B,2EAA2E;AAC3E,SAAS,IAAI,CACX,OAAqD,EACrD,UAAsB,EACtB,EAAU,EACV,KAAa,EACb,OAAe;IAEf,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,IAAI,aAAa,CAAC,GAAG,CAAC;IAC7C,MAAM,MAAM,GAAG,MAAM,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC;IAC/B,MAAM,IAAI,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;IAEzB,4EAA4E;IAC5E,4EAA4E;IAC5E,oEAAoE;IACpE,MAAM,KAAK,GACT,eAAe,MAAM,IAAI,IAAI,IAAI,MAAM,MAAM,IAAI,GAAG;QACpD,YAAY,OAAO,CAAC,KAAK,IAAI,aAAa,GAAG;QAC7C,kBAAkB,MAAM,CAAC,OAAO,CAAC,KAAK,IAAI,aAAa,CAAC,KAAK,CAAC,GAAG;QACjE,gBAAgB,CAAC;IAEnB,OAAO,IAAI,CACT,EAAE,EACF,GAAG,EACH,KAAK,EACL,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,6BAA6B,MAAM,CAAC,KAAK,CAAC,IAAI,EACjE,UAAU,EACV,OAAO,CACR,CAAC;AACJ,CAAC;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,QAAQ,CACtB,OAAqD,EACrD,UAAsB,EACtB,EAAU;IAEV,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,IAAI,aAAa,CAAC,OAAO,CAAC;IAEzD,OAAO,CACL,IAAI,CAAC,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,EAAE,OAAO,CAAC;QAC/C,IAAI,CACF,OAAO,EACP,UAAU,EACV,GAAG,EAAE,GAAG,EACR,OAAO,CAAC,KAAK,IAAI,aAAa,CAAC,KAAK,EACpC,IAAI,CAAC,KAAK,CAAC,OAAO,GAAG,cAAc,GAAG,IAAI,CAAC,GAAG,IAAI,CACnD,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -3,6 +3,16 @@ import type { Dimensions, Texture } from "../types.js";
|
|
|
3
3
|
export declare function dotsSvg(texture: Extract<Texture, {
|
|
4
4
|
readonly type: "dots";
|
|
5
5
|
}>, dimensions: Dimensions, id: string): string;
|
|
6
|
+
/**
|
|
7
|
+
* A small cross where each line of a grid would meet, one to a tile.
|
|
8
|
+
*
|
|
9
|
+
* It is the dot grid with a little more to look at, and it costs the same: the
|
|
10
|
+
* mark is two strokes rather than a fill, and the tile is square to the image
|
|
11
|
+
* either way.
|
|
12
|
+
*/
|
|
13
|
+
export declare function crossesSvg(texture: Extract<Texture, {
|
|
14
|
+
readonly type: "crosses";
|
|
15
|
+
}>, dimensions: Dimensions, id: string): string;
|
|
6
16
|
/**
|
|
7
17
|
* Ruled lines, one to a tile, rotated as a set.
|
|
8
18
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pattern.d.ts","sourceRoot":"","sources":["../../src/texture/pattern.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"pattern.d.ts","sourceRoot":"","sources":["../../src/texture/pattern.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAiBvD,qCAAqC;AACrC,wBAAgB,OAAO,CACrB,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC,EACpD,UAAU,EAAE,UAAU,EACtB,EAAE,EAAE,MAAM,GACT,MAAM,CAgBR;AAED;;;;;;GAMG;AACH,wBAAgB,UAAU,CACxB,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE;IAAE,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAA;CAAE,CAAC,EACvD,UAAU,EAAE,UAAU,EACtB,EAAE,EAAE,MAAM,GACT,MAAM,CAoBR;AAED;;;;;;;GAOG;AACH,wBAAgB,QAAQ,CACtB,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE;IAAE,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAA;CAAE,CAAC,EACrD,UAAU,EAAE,UAAU,EACtB,EAAE,EAAE,MAAM,GACT,MAAM,CA8BR"}
|