@kensio/colophon 2.11.1 → 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/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/config/defaults.d.ts.map +1 -1
- package/dist/config/defaults.js +5 -0
- package/dist/config/defaults.js.map +1 -1
- package/dist/measure/faces.d.ts.map +1 -1
- package/dist/measure/faces.js.map +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/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 +1 -2
- package/dist/texture/index.d.ts.map +1 -1
- package/dist/texture/index.js +44 -13
- 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 +36 -13
- 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/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/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 +231 -3
- 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 +37 -0
- package/dist/validate/keys.d.ts.map +1 -1
- package/dist/validate/keys.js +130 -2
- 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 -20
- 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 +3 -10
- 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
package/dist/validate/texture.js
CHANGED
|
@@ -1,34 +1,25 @@
|
|
|
1
1
|
import { checkKeys, isRecord } from "./check.js";
|
|
2
|
-
import {
|
|
2
|
+
import { textureKeysByType, textureTypes } from "./keys.js";
|
|
3
3
|
import { describeUnknownValue } from "./values.js";
|
|
4
|
+
/** Whether a declared type is one of the treatments there are. */
|
|
5
|
+
function isTextureType(type) {
|
|
6
|
+
return typeof type === "string" && type in textureKeysByType;
|
|
7
|
+
}
|
|
4
8
|
/**
|
|
5
9
|
* Check a texture against the keys of whichever treatment it declares.
|
|
6
10
|
*
|
|
7
|
-
* The same reasoning as a background's: `
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
* keys were meant.
|
|
11
|
+
* The same reasoning as a background's: a mistyped `type` has to be reported
|
|
12
|
+
* as itself rather than as a list of keys that do not apply. A texture with no
|
|
13
|
+
* `type` is left to the type checker, since without one there is no telling
|
|
14
|
+
* which keys were meant.
|
|
12
15
|
*/
|
|
13
16
|
export function checkTexture(texture, path, problems) {
|
|
14
17
|
if (!isRecord(texture)) {
|
|
15
18
|
return;
|
|
16
19
|
}
|
|
17
20
|
const { type } = texture;
|
|
18
|
-
if (type
|
|
19
|
-
checkKeys(texture, path,
|
|
20
|
-
return;
|
|
21
|
-
}
|
|
22
|
-
if (type === "dots") {
|
|
23
|
-
checkKeys(texture, path, dotsTextureKeys, problems);
|
|
24
|
-
return;
|
|
25
|
-
}
|
|
26
|
-
if (type === "rules") {
|
|
27
|
-
checkKeys(texture, path, rulesTextureKeys, problems);
|
|
28
|
-
return;
|
|
29
|
-
}
|
|
30
|
-
if (type === "waves") {
|
|
31
|
-
checkKeys(texture, path, wavesTextureKeys, problems);
|
|
21
|
+
if (isTextureType(type)) {
|
|
22
|
+
checkKeys(texture, path, textureKeysByType[type], problems);
|
|
32
23
|
return;
|
|
33
24
|
}
|
|
34
25
|
if (typeof type === "string") {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"texture.js","sourceRoot":"","sources":["../../src/validate/texture.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"texture.js","sourceRoot":"","sources":["../../src/validate/texture.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAC5D,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAEnD,kEAAkE;AAClE,SAAS,aAAa,CAAC,IAAa;IAClC,OAAO,OAAO,IAAI,KAAK,QAAQ,IAAI,IAAI,IAAI,iBAAiB,CAAC;AAC/D,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,YAAY,CAC1B,OAAgB,EAChB,IAAY,EACZ,QAAkB;IAElB,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC;QACvB,OAAO;IACT,CAAC;IAED,MAAM,EAAE,IAAI,EAAE,GAAG,OAAO,CAAC;IAEzB,IAAI,aAAa,CAAC,IAAI,CAAC,EAAE,CAAC;QACxB,SAAS,CAAC,OAAO,EAAE,IAAI,EAAE,iBAAiB,CAAC,IAAI,CAAC,EAAE,QAAQ,CAAC,CAAC;QAC5D,OAAO;IACT,CAAC;IAED,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE,CAAC;QAC7B,QAAQ,CAAC,IAAI,CACX,oBAAoB,CAAC,cAAc,EAAE,OAAO,EAAE,IAAI,EAAE,YAAY,CAAC,CAClE,CAAC;IACJ,CAAC;AACH,CAAC"}
|
|
@@ -8,6 +8,12 @@ export declare function describeUnknownValue(noun: string, plural: string, value
|
|
|
8
8
|
* anything else is a shape the type checker already covers, as elsewhere here.
|
|
9
9
|
*/
|
|
10
10
|
export declare function checkSlugStrategy(content: unknown, problems: string[]): void;
|
|
11
|
+
/**
|
|
12
|
+
* Check the window chrome names one of the three there are. A name the
|
|
13
|
+
* template does not know draws the neutral bar, so `macOS` would silently be
|
|
14
|
+
* the wrong window rather than a build that says so.
|
|
15
|
+
*/
|
|
16
|
+
export declare function checkCodeChrome(code: unknown, problems: string[]): void;
|
|
11
17
|
/**
|
|
12
18
|
* Check the output format names one the encoder has. `jpg` is the spelling
|
|
13
19
|
* people reach for, and the suggestion is what turns it into `jpeg` rather than
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"values.d.ts","sourceRoot":"","sources":["../../src/validate/values.ts"],"names":[],"mappings":"AAKA;;;GAGG;AACH,wBAAgB,oBAAoB,CAClC,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,SAAS,MAAM,EAAE,GACvB,MAAM,CAMR;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,IAAI,CAmB5E;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,IAAI,CAQrE;AAED;;;;;;;;GAQG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,IAAI,CAUnE"}
|
|
1
|
+
{"version":3,"file":"values.d.ts","sourceRoot":"","sources":["../../src/validate/values.ts"],"names":[],"mappings":"AAKA;;;GAGG;AACH,wBAAgB,oBAAoB,CAClC,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,SAAS,MAAM,EAAE,GACvB,MAAM,CAMR;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,IAAI,CAmB5E;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,IAAI,CAcvE;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,IAAI,CAQrE;AAED;;;;;;;;GAQG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,IAAI,CAUnE"}
|
package/dist/validate/values.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { themeNames } from "../theme/index.js";
|
|
2
2
|
import { isRecord } from "./check.js";
|
|
3
|
-
import { outputFormats, slugStrategies } from "./keys.js";
|
|
3
|
+
import { codeChromeStyles, outputFormats, slugStrategies } from "./keys.js";
|
|
4
4
|
import { nearestName } from "./suggest.js";
|
|
5
5
|
/**
|
|
6
6
|
* Report a value that is not one of the names a field accepts. `noun` names
|
|
@@ -26,6 +26,21 @@ export function checkSlugStrategy(content, problems) {
|
|
|
26
26
|
}
|
|
27
27
|
problems.push(describeUnknownValue("slug strategy", "strategies", strategy, slugStrategies));
|
|
28
28
|
}
|
|
29
|
+
/**
|
|
30
|
+
* Check the window chrome names one of the three there are. A name the
|
|
31
|
+
* template does not know draws the neutral bar, so `macOS` would silently be
|
|
32
|
+
* the wrong window rather than a build that says so.
|
|
33
|
+
*/
|
|
34
|
+
export function checkCodeChrome(code, problems) {
|
|
35
|
+
if (!isRecord(code)) {
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
const chrome = code["chrome"];
|
|
39
|
+
if (typeof chrome !== "string" || codeChromeStyles.includes(chrome)) {
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
problems.push(describeUnknownValue("window chrome", "styles", chrome, codeChromeStyles));
|
|
43
|
+
}
|
|
29
44
|
/**
|
|
30
45
|
* Check the output format names one the encoder has. `jpg` is the spelling
|
|
31
46
|
* people reach for, and the suggestion is what turns it into `jpeg` rather than
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"values.js","sourceRoot":"","sources":["../../src/validate/values.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"values.js","sourceRoot":"","sources":["../../src/validate/values.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,gBAAgB,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAC5E,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAE3C;;;GAGG;AACH,MAAM,UAAU,oBAAoB,CAClC,IAAY,EACZ,MAAc,EACd,KAAa,EACb,KAAwB;IAExB,MAAM,UAAU,GAAG,WAAW,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;IAE7C,OAAO,UAAU,KAAK,SAAS;QAC7B,CAAC,CAAC,WAAW,IAAI,KAAK,KAAK,YAAY,MAAM,KAAK,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG;QACrE,CAAC,CAAC,WAAW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QG;AACH,MAAM,UAAU,UAAU,CAAC,KAAc,EAAE,QAAkB;IAC3D,2EAA2E;IAC3E,uEAAuE;IACvE,MAAM,KAAK,GAAsB,UAAU,CAAC;IAE5C,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;QACvD,OAAO;IACT,CAAC;IAED,QAAQ,CAAC,IAAI,CAAC,oBAAoB,CAAC,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC;AACvE,CAAC"}
|
package/package.json
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"repository": "https://github.com/KensioSoftware/colophon",
|
|
6
6
|
"homepage": "https://github.com/KensioSoftware/colophon#readme",
|
|
7
7
|
"license": "Apache-2.0",
|
|
8
|
-
"version": "2.
|
|
8
|
+
"version": "2.12.0",
|
|
9
9
|
"type": "module",
|
|
10
10
|
"main": "./dist/index.js",
|
|
11
11
|
"types": "./dist/index.d.ts",
|
|
@@ -60,8 +60,8 @@
|
|
|
60
60
|
"build": "tsc -p tsconfig.build.json",
|
|
61
61
|
"prepack": "pnpm build",
|
|
62
62
|
"build:check": "tsc -p tsconfig.json --noEmit",
|
|
63
|
-
"fmt": "oxlint --fix &&
|
|
64
|
-
"lint": "
|
|
63
|
+
"fmt": "oxlint --fix && oxfmt",
|
|
64
|
+
"lint": "oxlint && oxfmt --check",
|
|
65
65
|
"test": "vitest run",
|
|
66
66
|
"test:coverage": "vitest run --coverage",
|
|
67
67
|
"samples": "pnpm build && node scripts/gen-samples.ts",
|
|
@@ -86,25 +86,18 @@
|
|
|
86
86
|
"devDependencies": {
|
|
87
87
|
"@kensio/smartass": "^1.33.0",
|
|
88
88
|
"@semantic-release/exec": "7.1.0",
|
|
89
|
-
"@types/eslint-plugin-security": "^3.0.1",
|
|
90
89
|
"@types/fontkit": "^2.0.9",
|
|
91
90
|
"@types/node": "^26.0.0",
|
|
92
91
|
"@typescript/native": "npm:typescript@^7.0.2",
|
|
93
92
|
"@vitest/coverage-v8": "^4.1.10",
|
|
94
93
|
"conventional-changelog-conventionalcommits": "9.3.1",
|
|
95
94
|
"dejavu-fonts-ttf": "^2.37.3",
|
|
96
|
-
"eslint": "^10.6.0",
|
|
97
|
-
"eslint-plugin-jsdoc": "^63.0.13",
|
|
98
|
-
"eslint-plugin-no-secrets": "^2.3.3",
|
|
99
|
-
"eslint-plugin-security": "^4.0.1",
|
|
100
95
|
"fta-cli": "^3.0.0",
|
|
101
|
-
"jiti": "^2.7.0",
|
|
102
96
|
"oxfmt": "^0.62.0",
|
|
103
97
|
"oxlint": "^1.77.0",
|
|
104
98
|
"oxlint-tsgolint": "^7.0.2001",
|
|
105
99
|
"semantic-release": "25.0.9",
|
|
106
100
|
"typescript": "npm:@typescript/typescript6@^6.0.2",
|
|
107
|
-
"typescript-eslint": "^8.63.0",
|
|
108
101
|
"vitest": "^4.1.10"
|
|
109
102
|
},
|
|
110
103
|
"dependencies": {
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"window.d.ts","sourceRoot":"","sources":["../../../src/templates/terminal/window.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAClE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAiB9C,2DAA2D;AAC3D,wBAAgB,SAAS,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAErD;AAwBD;;;;;;;GAOG;AACH,wBAAgB,QAAQ,CACtB,MAAM,EAAE,KAAK,EACb,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,cAAc,EACtB,OAAO,EAAE,WAAW,GACnB,MAAM,CA6BR"}
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
import { baselineFor, box, clampLine, measureIn, textElement, } from "../../layout/index.js";
|
|
2
|
-
/** The title bar's height, as a fraction of the window's width. */
|
|
3
|
-
const barScale = 0.055;
|
|
4
|
-
/** The buttons' diameter, as a fraction of the bar's height. */
|
|
5
|
-
const buttonScale = 0.26;
|
|
6
|
-
/**
|
|
7
|
-
* The three buttons, in the colours every reader has seen on a window.
|
|
8
|
-
*
|
|
9
|
-
* They are not the site's colours and are not meant to be. The point of the
|
|
10
|
-
* chrome is that the image is recognised as a terminal before a word of it is
|
|
11
|
-
* read, and these are what does the recognising.
|
|
12
|
-
*/
|
|
13
|
-
const buttons = ["#ff5f57", "#febc2e", "#28c840"];
|
|
14
|
-
/** How tall the title bar is on a window of this width. */
|
|
15
|
-
export function barHeight(windowWidth) {
|
|
16
|
-
return Math.round(windowWidth * barScale);
|
|
17
|
-
}
|
|
18
|
-
/**
|
|
19
|
-
* A rectangle with its top corners rounded and its bottom ones square, which
|
|
20
|
-
* is the shape of a title bar sitting in the top of a rounded window.
|
|
21
|
-
*
|
|
22
|
-
* It has to be one shape rather than a rounded rectangle with a square one
|
|
23
|
-
* over its bottom half, which is the obvious way to do it and the wrong one:
|
|
24
|
-
* the band is drawn at low opacity, so anywhere the two overlapped would be
|
|
25
|
-
* painted twice and come out as a lighter block with a curve through it.
|
|
26
|
-
*/
|
|
27
|
-
function roundedTop(rect, radius) {
|
|
28
|
-
const { x, y, width, height } = rect;
|
|
29
|
-
const r = Math.min(radius, Math.round(width / 2), height);
|
|
30
|
-
return (`M${String(x)} ${String(y + r)}` +
|
|
31
|
-
`a${String(r)} ${String(r)} 0 0 1 ${String(r)} ${String(-r)}` +
|
|
32
|
-
`h${String(width - r * 2)}` +
|
|
33
|
-
`a${String(r)} ${String(r)} 0 0 1 ${String(r)} ${String(r)}` +
|
|
34
|
-
`v${String(height - r)}h${String(-width)}z`);
|
|
35
|
-
}
|
|
36
|
-
/**
|
|
37
|
-
* The bar across the top of the window: a lighter band, the buttons, and the
|
|
38
|
-
* title in the middle of what is left.
|
|
39
|
-
*
|
|
40
|
-
* The band is white at low opacity rather than a colour of its own, so it
|
|
41
|
-
* lifts whatever the code theme's background happens to be instead of having
|
|
42
|
-
* to be chosen against it.
|
|
43
|
-
*/
|
|
44
|
-
export function titleBar(window, height, title, config, measure) {
|
|
45
|
-
const { radius } = window;
|
|
46
|
-
const diameter = Math.round(height * buttonScale);
|
|
47
|
-
const gap = Math.round(diameter * 1.7);
|
|
48
|
-
const left = window.x + Math.round(height * 0.6);
|
|
49
|
-
const middle = window.y + Math.round(height / 2);
|
|
50
|
-
const band = `<path d="${roundedTop({ x: window.x, y: window.y, width: window.width, height }, radius)}"` +
|
|
51
|
-
` fill="#ffffff" fill-opacity="0.07"/>${box({ x: window.x, y: window.y + height, width: window.width, height: 1 }, { fill: "#ffffff", fillOpacity: 0.1 })}`;
|
|
52
|
-
const lights = buttons
|
|
53
|
-
.map((fill, index) => box({
|
|
54
|
-
x: left + index * gap,
|
|
55
|
-
y: middle - Math.round(diameter / 2),
|
|
56
|
-
width: diameter,
|
|
57
|
-
height: diameter,
|
|
58
|
-
}, { radius: Math.round(diameter / 2), fill }))
|
|
59
|
-
.join("");
|
|
60
|
-
return band + lights + windowTitle(title, window, height, config, measure);
|
|
61
|
-
}
|
|
62
|
-
/**
|
|
63
|
-
* The window's title, centred in the bar. It is cut to the room between the
|
|
64
|
-
* buttons and the far edge, taking the buttons' width off both sides so that
|
|
65
|
-
* it stays centred in the bar rather than in what the buttons left.
|
|
66
|
-
*/
|
|
67
|
-
function windowTitle(title, window, height, config, measure) {
|
|
68
|
-
if (title === "") {
|
|
69
|
-
return "";
|
|
70
|
-
}
|
|
71
|
-
const fontSize = Math.round(height * 0.42);
|
|
72
|
-
const reserved = Math.round(height * 2.4);
|
|
73
|
-
return textElement(clampLine(title, window.width - reserved * 2, measureIn(measure, config.fontFamily, 600), fontSize), {
|
|
74
|
-
x: Math.round(window.x + window.width / 2),
|
|
75
|
-
y: baselineFor(window.y + (height - fontSize) / 2, fontSize),
|
|
76
|
-
fontFamily: config.fontFamily,
|
|
77
|
-
fontSize,
|
|
78
|
-
fontWeight: 600,
|
|
79
|
-
fill: "#ffffff",
|
|
80
|
-
fillOpacity: 0.6,
|
|
81
|
-
anchor: "middle",
|
|
82
|
-
});
|
|
83
|
-
}
|
|
84
|
-
//# sourceMappingURL=window.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"window.js","sourceRoot":"","sources":["../../../src/templates/terminal/window.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EACX,GAAG,EACH,SAAS,EACT,SAAS,EACT,WAAW,GACZ,MAAM,uBAAuB,CAAC;AAK/B,mEAAmE;AACnE,MAAM,QAAQ,GAAG,KAAK,CAAC;AAEvB,gEAAgE;AAChE,MAAM,WAAW,GAAG,IAAI,CAAC;AAEzB;;;;;;GAMG;AACH,MAAM,OAAO,GAAsB,CAAC,SAAS,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC;AAErE,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,MAAM,EAAE,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;IACrC,MAAM,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC;IAE1D,OAAO,CACL,IAAI,MAAM,CAAC,CAAC,CAAC,IAAI,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE;QAChC,IAAI,MAAM,CAAC,CAAC,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,UAAU,MAAM,CAAC,CAAC,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE;QAC7D,IAAI,MAAM,CAAC,KAAK,GAAG,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