@kensio/colophon 2.4.0 → 2.5.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 +48 -0
- package/dist/background/gradient.d.ts +12 -0
- package/dist/background/gradient.d.ts.map +1 -0
- package/dist/background/gradient.js +21 -0
- package/dist/background/gradient.js.map +1 -0
- package/dist/background/image.d.ts +14 -0
- package/dist/background/image.d.ts.map +1 -0
- package/dist/background/image.js +36 -0
- package/dist/background/image.js.map +1 -0
- package/dist/background/index.d.ts +13 -0
- package/dist/background/index.d.ts.map +1 -0
- package/dist/background/index.js +27 -0
- package/dist/background/index.js.map +1 -0
- package/dist/background/mesh.d.ts +12 -0
- package/dist/background/mesh.d.ts.map +1 -0
- package/dist/background/mesh.js +43 -0
- package/dist/background/mesh.js.map +1 -0
- package/dist/config/index.d.ts +1 -1
- package/dist/config/index.d.ts.map +1 -1
- package/dist/config/index.js +9 -2
- package/dist/config/index.js.map +1 -1
- package/dist/config/size.d.ts +6 -0
- package/dist/config/size.d.ts.map +1 -1
- package/dist/config/size.js +20 -8
- package/dist/config/size.js.map +1 -1
- package/dist/index.d.ts +3 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/render/svg.d.ts.map +1 -1
- package/dist/render/svg.js +9 -2
- package/dist/render/svg.js.map +1 -1
- package/dist/stamp/config-digest.d.ts.map +1 -1
- package/dist/stamp/config-digest.js +1 -0
- package/dist/stamp/config-digest.js.map +1 -1
- package/dist/templates/banner/badge-props.d.ts +16 -0
- package/dist/templates/banner/badge-props.d.ts.map +1 -0
- package/dist/templates/banner/badge-props.js +58 -0
- package/dist/templates/banner/badge-props.js.map +1 -0
- package/dist/templates/banner/index.d.ts.map +1 -1
- package/dist/templates/banner/index.js +6 -4
- package/dist/templates/banner/index.js.map +1 -1
- package/dist/texture/grain.d.ts +17 -0
- package/dist/texture/grain.d.ts.map +1 -0
- package/dist/texture/grain.js +29 -0
- package/dist/texture/grain.js.map +1 -0
- package/dist/texture/index.d.ts +11 -0
- package/dist/texture/index.d.ts.map +1 -0
- package/dist/texture/index.js +20 -0
- package/dist/texture/index.js.map +1 -0
- package/dist/texture/pattern.d.ts +17 -0
- package/dist/texture/pattern.d.ts.map +1 -0
- package/dist/texture/pattern.js +45 -0
- package/dist/texture/pattern.js.map +1 -0
- package/dist/texture/resolve.d.ts +16 -0
- package/dist/texture/resolve.d.ts.map +1 -0
- package/dist/texture/resolve.js +20 -0
- package/dist/texture/resolve.js.map +1 -0
- package/dist/theme/index.d.ts +27 -0
- package/dist/theme/index.d.ts.map +1 -0
- package/dist/theme/index.js +41 -0
- package/dist/theme/index.js.map +1 -0
- package/dist/theme/presets.d.ts +38 -0
- package/dist/theme/presets.d.ts.map +1 -0
- package/dist/theme/presets.js +150 -0
- package/dist/theme/presets.js.map +1 -0
- package/dist/types.d.ts +123 -4
- package/dist/types.d.ts.map +1 -1
- package/dist/validate/background.d.ts +12 -0
- package/dist/validate/background.d.ts.map +1 -0
- package/dist/validate/background.js +53 -0
- package/dist/validate/background.js.map +1 -0
- package/dist/validate/collect.d.ts +9 -0
- package/dist/validate/collect.d.ts.map +1 -0
- package/dist/validate/collect.js +34 -0
- package/dist/validate/collect.js.map +1 -0
- package/dist/validate/index.d.ts.map +1 -1
- package/dist/validate/index.js +2 -20
- package/dist/validate/index.js.map +1 -1
- package/dist/validate/keys.d.ts +16 -0
- package/dist/validate/keys.d.ts.map +1 -1
- package/dist/validate/keys.js +52 -0
- package/dist/validate/keys.js.map +1 -1
- package/dist/validate/overrides.d.ts.map +1 -1
- package/dist/validate/overrides.js +5 -1
- package/dist/validate/overrides.js.map +1 -1
- package/dist/validate/texture.d.ts +11 -0
- package/dist/validate/texture.d.ts.map +1 -0
- package/dist/validate/texture.js +34 -0
- package/dist/validate/texture.js.map +1 -0
- package/dist/validate/values.d.ts +10 -10
- package/dist/validate/values.d.ts.map +1 -1
- package/dist/validate/values.js +21 -45
- package/dist/validate/values.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { checkKeys, isRecord } from "./check.js";
|
|
2
|
+
import { dotsTextureKeys, grainTextureKeys, rulesTextureKeys, textureTypes, } from "./keys.js";
|
|
3
|
+
import { describeUnknownValue } from "./values.js";
|
|
4
|
+
/**
|
|
5
|
+
* Check a texture against the keys of whichever treatment it declares.
|
|
6
|
+
*
|
|
7
|
+
* The same reasoning as a background's: `textureSvg` draws anything it does
|
|
8
|
+
* not recognise as the last variant it checks for, so an unknown `type` would
|
|
9
|
+
* come out as a set of ruled lines nobody asked for. A texture with no `type`
|
|
10
|
+
* is left to the type checker, since without one there is no telling which
|
|
11
|
+
* keys were meant.
|
|
12
|
+
*/
|
|
13
|
+
export function checkTexture(texture, path, problems) {
|
|
14
|
+
if (!isRecord(texture)) {
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
const { type } = texture;
|
|
18
|
+
if (type === "grain") {
|
|
19
|
+
checkKeys(texture, path, grainTextureKeys, problems);
|
|
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 (typeof type === "string") {
|
|
31
|
+
problems.push(describeUnknownValue("texture type", "types", type, textureTypes));
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=texture.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"texture.js","sourceRoot":"","sources":["../../src/validate/texture.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,EACL,eAAe,EACf,gBAAgB,EAChB,gBAAgB,EAChB,YAAY,GACb,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAEnD;;;;;;;;GAQG;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,IAAI,KAAK,OAAO,EAAE,CAAC;QACrB,SAAS,CAAC,OAAO,EAAE,IAAI,EAAE,gBAAgB,EAAE,QAAQ,CAAC,CAAC;QACrD,OAAO;IACT,CAAC;IAED,IAAI,IAAI,KAAK,MAAM,EAAE,CAAC;QACpB,SAAS,CAAC,OAAO,EAAE,IAAI,EAAE,eAAe,EAAE,QAAQ,CAAC,CAAC;QACpD,OAAO;IACT,CAAC;IAED,IAAI,IAAI,KAAK,OAAO,EAAE,CAAC;QACrB,SAAS,CAAC,OAAO,EAAE,IAAI,EAAE,gBAAgB,EAAE,QAAQ,CAAC,CAAC;QACrD,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"}
|
|
@@ -3,19 +3,19 @@
|
|
|
3
3
|
* the field, `plural` heads the list of what it does accept.
|
|
4
4
|
*/
|
|
5
5
|
export declare function describeUnknownValue(noun: string, plural: string, value: string, known: readonly string[]): string;
|
|
6
|
-
/**
|
|
7
|
-
* Check a background against the keys of whichever variant it declares.
|
|
8
|
-
*
|
|
9
|
-
* A misspelt `type` is worth reporting on its own: `backgroundSvg` treats
|
|
10
|
-
* anything that is not `solid` as a gradient, so `gradiant` silently becomes
|
|
11
|
-
* one and then falls over on the stops it does not have. A background with no
|
|
12
|
-
* `type` at all is left alone, since the type is what says which keys apply,
|
|
13
|
-
* and guessing would report the keys rather than the omission.
|
|
14
|
-
*/
|
|
15
|
-
export declare function checkBackground(background: unknown, path: string, problems: string[]): void;
|
|
16
6
|
/**
|
|
17
7
|
* Check the slug strategy names a real one. Only a string can be a strategy;
|
|
18
8
|
* anything else is a shape the type checker already covers, as elsewhere here.
|
|
19
9
|
*/
|
|
20
10
|
export declare function checkSlugStrategy(content: unknown, problems: string[]): void;
|
|
11
|
+
/**
|
|
12
|
+
* Check a theme names one of the curated set.
|
|
13
|
+
*
|
|
14
|
+
* A theme that does not exist is nothing at all: the config resolves as though
|
|
15
|
+
* it had never been named and the images come out in the neutral default
|
|
16
|
+
* palette. Every unknown value here is worth reporting, but this one more than
|
|
17
|
+
* most, because a theme is the one field whose whole purpose is to be the
|
|
18
|
+
* look.
|
|
19
|
+
*/
|
|
20
|
+
export declare function checkTheme(theme: unknown, problems: string[]): void;
|
|
21
21
|
//# sourceMappingURL=values.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"values.d.ts","sourceRoot":"","sources":["../../src/validate/values.ts"],"names":[],"mappings":"
|
|
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;;;;;;;;GAQG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,IAAI,CAUnE"}
|
package/dist/validate/values.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { themeNames } from "../theme/index.js";
|
|
2
|
+
import { isRecord } from "./check.js";
|
|
3
|
+
import { slugStrategies } from "./keys.js";
|
|
3
4
|
import { nearestName } from "./suggest.js";
|
|
4
5
|
/**
|
|
5
6
|
* Report a value that is not one of the names a field accepts. `noun` names
|
|
@@ -11,49 +12,6 @@ export function describeUnknownValue(noun, plural, value, known) {
|
|
|
11
12
|
? `Unknown ${noun} "${value}". Valid ${plural}: ${known.join(", ")}.`
|
|
12
13
|
: `Unknown ${noun} "${value}". Did you mean "${suggestion}"?`;
|
|
13
14
|
}
|
|
14
|
-
/**
|
|
15
|
-
* Check a background against the keys of whichever variant it declares.
|
|
16
|
-
*
|
|
17
|
-
* A misspelt `type` is worth reporting on its own: `backgroundSvg` treats
|
|
18
|
-
* anything that is not `solid` as a gradient, so `gradiant` silently becomes
|
|
19
|
-
* one and then falls over on the stops it does not have. A background with no
|
|
20
|
-
* `type` at all is left alone, since the type is what says which keys apply,
|
|
21
|
-
* and guessing would report the keys rather than the omission.
|
|
22
|
-
*/
|
|
23
|
-
export function checkBackground(background, path, problems) {
|
|
24
|
-
if (!isRecord(background)) {
|
|
25
|
-
return;
|
|
26
|
-
}
|
|
27
|
-
const { type, stops, from, to } = background;
|
|
28
|
-
if (type === "solid") {
|
|
29
|
-
checkKeys(background, path, solidBackgroundKeys, problems);
|
|
30
|
-
return;
|
|
31
|
-
}
|
|
32
|
-
if (type === "image") {
|
|
33
|
-
checkKeys(background, path, imageBackgroundKeys, problems);
|
|
34
|
-
checkKeys(background["source"], `${path}.source`, imageSourceKeys, problems);
|
|
35
|
-
checkKeys(background["scrim"], `${path}.scrim`, scrimKeys, problems);
|
|
36
|
-
checkFit(background["fit"], problems);
|
|
37
|
-
return;
|
|
38
|
-
}
|
|
39
|
-
if (type === "gradient") {
|
|
40
|
-
checkKeys(background, path, gradientBackgroundKeys, problems);
|
|
41
|
-
checkEach(stops, `${path}.stops`, gradientStopKeys, problems);
|
|
42
|
-
checkKeys(from, `${path}.from`, gradientPointKeys, problems);
|
|
43
|
-
checkKeys(to, `${path}.to`, gradientPointKeys, problems);
|
|
44
|
-
return;
|
|
45
|
-
}
|
|
46
|
-
if (typeof type === "string") {
|
|
47
|
-
problems.push(describeUnknownValue("background type", "types", type, backgroundTypes));
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
/** Check a background image's fit names one of the two there are. */
|
|
51
|
-
function checkFit(fit, problems) {
|
|
52
|
-
if (typeof fit !== "string" || backgroundFits.includes(fit)) {
|
|
53
|
-
return;
|
|
54
|
-
}
|
|
55
|
-
problems.push(describeUnknownValue("background fit", "fits", fit, backgroundFits));
|
|
56
|
-
}
|
|
57
15
|
/**
|
|
58
16
|
* Check the slug strategy names a real one. Only a string can be a strategy;
|
|
59
17
|
* anything else is a shape the type checker already covers, as elsewhere here.
|
|
@@ -68,4 +26,22 @@ export function checkSlugStrategy(content, problems) {
|
|
|
68
26
|
}
|
|
69
27
|
problems.push(describeUnknownValue("slug strategy", "strategies", strategy, slugStrategies));
|
|
70
28
|
}
|
|
29
|
+
/**
|
|
30
|
+
* Check a theme names one of the curated set.
|
|
31
|
+
*
|
|
32
|
+
* A theme that does not exist is nothing at all: the config resolves as though
|
|
33
|
+
* it had never been named and the images come out in the neutral default
|
|
34
|
+
* palette. Every unknown value here is worth reporting, but this one more than
|
|
35
|
+
* most, because a theme is the one field whose whole purpose is to be the
|
|
36
|
+
* look.
|
|
37
|
+
*/
|
|
38
|
+
export function checkTheme(theme, problems) {
|
|
39
|
+
// Widened on the way in: the names are typed as the union everywhere else,
|
|
40
|
+
// and what is being checked here is a string that may well not be one.
|
|
41
|
+
const known = themeNames;
|
|
42
|
+
if (typeof theme !== "string" || known.includes(theme)) {
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
problems.push(describeUnknownValue("theme", "themes", theme, known));
|
|
46
|
+
}
|
|
71
47
|
//# sourceMappingURL=values.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"values.js","sourceRoot":"","sources":["../../src/validate/values.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
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,cAAc,EAAE,MAAM,WAAW,CAAC;AAC3C,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,IAAI,KAAK,KAAK,oBAAoB,UAAU,IAAI,CAAC;AAClE,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,iBAAiB,CAAC,OAAgB,EAAE,QAAkB;IACpE,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC;QACvB,OAAO;IACT,CAAC;IAED,MAAM,QAAQ,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;IAEzC,IAAI,OAAO,QAAQ,KAAK,QAAQ,IAAI,cAAc,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC;QACtE,OAAO;IACT,CAAC;IAED,QAAQ,CAAC,IAAI,CACX,oBAAoB,CAClB,eAAe,EACf,YAAY,EACZ,QAAQ,EACR,cAAc,CACf,CACF,CAAC;AACJ,CAAC;AAED;;;;;;;;GAQG;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"}
|