@graview/core 0.1.15 → 0.1.16
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 +16 -5
- package/dist/app.d.ts +8 -8
- package/dist/app.d.ts.map +1 -1
- package/dist/arrangement.d.ts +2 -2
- package/dist/arrangement.d.ts.map +1 -1
- package/dist/arrangement.js +5 -5
- package/dist/arranging.js +3 -3
- package/dist/capabilities.js +1 -1
- package/dist/capabilities.js.map +1 -1
- package/dist/city.d.ts +5 -5
- package/dist/city.js +3 -3
- package/dist/cli/check/beginnings.js +2 -2
- package/dist/cli/check/brand.d.ts.map +1 -1
- package/dist/cli/check/brand.js +15 -9
- package/dist/cli/check/brand.js.map +1 -1
- package/dist/cli/check/city.js +1 -1
- package/dist/cli/check/context.js +1 -1
- package/dist/cli/check/relations.js +2 -2
- package/dist/cli/check/relations.js.map +1 -1
- package/dist/cli/check/settings.js +8 -8
- package/dist/cli/check/settings.js.map +1 -1
- package/dist/cli/check/views.d.ts +1 -1
- package/dist/cli/check/views.js +1 -1
- package/dist/cli/create.d.ts +1 -1
- package/dist/cli/create.js +5 -5
- package/dist/cli/describe.d.ts +1 -1
- package/dist/cli/describe.js +2 -2
- package/dist/cli/describe.js.map +1 -1
- package/dist/cli/index.d.ts +1 -1
- package/dist/columns.d.ts +1 -1
- package/dist/columns.js +1 -1
- package/dist/describe.d.ts +1 -1
- package/dist/describe.d.ts.map +1 -1
- package/dist/document/brand-check.d.ts +10 -0
- package/dist/document/brand-check.d.ts.map +1 -0
- package/dist/document/brand-check.js +33 -0
- package/dist/document/brand-check.js.map +1 -0
- package/dist/document/brand.d.ts +10 -0
- package/dist/document/brand.d.ts.map +1 -0
- package/dist/document/brand.js +49 -0
- package/dist/document/brand.js.map +1 -0
- package/dist/document/compile-checked.d.ts.map +1 -1
- package/dist/document/compile-checked.js +6 -2
- package/dist/document/compile-checked.js.map +1 -1
- package/dist/document/compile.d.ts +6 -0
- package/dist/document/compile.d.ts.map +1 -1
- package/dist/document/compile.js +4 -13
- package/dist/document/compile.js.map +1 -1
- package/dist/document/compiled.d.ts.map +1 -1
- package/dist/document/compiled.js +3 -2
- package/dist/document/compiled.js.map +1 -1
- package/dist/document/describe-place.d.ts +16 -0
- package/dist/document/describe-place.d.ts.map +1 -1
- package/dist/document/describe-place.js +14 -1
- package/dist/document/describe-place.js.map +1 -1
- package/dist/document/diff.d.ts.map +1 -1
- package/dist/document/diff.js +45 -6
- package/dist/document/diff.js.map +1 -1
- package/dist/document/edit.d.ts +7 -2
- package/dist/document/edit.d.ts.map +1 -1
- package/dist/document/edit.js +173 -45
- package/dist/document/edit.js.map +1 -1
- package/dist/document/expr/analyze.d.ts +2 -2
- package/dist/document/expr/analyze.js +2 -2
- package/dist/document/expr/print.js +1 -1
- package/dist/document/index.d.ts +1 -1
- package/dist/document/index.d.ts.map +1 -1
- package/dist/document/quote.d.ts +5 -0
- package/dist/document/quote.d.ts.map +1 -0
- package/dist/document/quote.js +17 -0
- package/dist/document/quote.js.map +1 -0
- package/dist/document/rules.d.ts +2 -2
- package/dist/document/rules.d.ts.map +1 -1
- package/dist/document/rules.js +2 -2
- package/dist/document/rules.js.map +1 -1
- package/dist/document/schema.d.ts +45 -2
- package/dist/document/schema.d.ts.map +1 -1
- package/dist/document/schema.js +22 -3
- package/dist/document/schema.js.map +1 -1
- package/dist/document/thumbnail.d.ts +9 -0
- package/dist/document/thumbnail.d.ts.map +1 -1
- package/dist/document/thumbnail.js +74 -12
- package/dist/document/thumbnail.js.map +1 -1
- package/dist/document/to-document.js +5 -5
- package/dist/document/to-document.js.map +1 -1
- package/dist/graph/graph.js +3 -3
- package/dist/graph/primitives.d.ts +2 -2
- package/dist/graph/primitives.js +2 -2
- package/dist/index.d.ts +10 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -5
- package/dist/index.js.map +1 -1
- package/dist/invariants/engine.js +1 -1
- package/dist/invariants/types.d.ts +3 -3
- package/dist/invariants/types.d.ts.map +1 -1
- package/dist/labels.d.ts +1 -1
- package/dist/modules.d.ts +1 -1
- package/dist/modules.js +1 -1
- package/dist/mutations/define-mutation.js +4 -4
- package/dist/mutations/define-mutation.js.map +1 -1
- package/dist/mutations/derive-edits.js +3 -3
- package/dist/mutations/node-ref.js +1 -1
- package/dist/mutations/types.d.ts +1 -1
- package/dist/mutations/words.js +3 -3
- package/dist/ops/types.d.ts +1 -1
- package/dist/ops/withheld.d.ts +3 -3
- package/dist/permissions/policy.d.ts +1 -1
- package/dist/permissions/policy.js +3 -3
- package/dist/permissions/types.d.ts +2 -2
- package/dist/places.d.ts +14 -1
- package/dist/places.d.ts.map +1 -1
- package/dist/places.js +27 -4
- package/dist/places.js.map +1 -1
- package/dist/scaffold/domain.js +3 -3
- package/dist/scaffold/index.d.ts +1 -1
- package/dist/scaffold/index.d.ts.map +1 -1
- package/dist/scaffold/names.d.ts +1 -1
- package/dist/scaffold/names.js +1 -1
- package/dist/scaffold/names.js.map +1 -1
- package/dist/scaffold/project.js +1 -1
- package/dist/scene-districts.d.ts +1 -1
- package/dist/schema/define-node.d.ts +4 -4
- package/dist/schema/define-node.d.ts.map +1 -1
- package/dist/schema/define-node.js +8 -8
- package/dist/schema/define-node.js.map +1 -1
- package/dist/schema/figures.d.ts +1 -1
- package/dist/schema/figures.js +7 -7
- package/dist/schema/figures.js.map +1 -1
- package/dist/schema/types.d.ts +1 -1
- package/dist/search.d.ts +13 -1
- package/dist/search.d.ts.map +1 -1
- package/dist/search.js +33 -14
- package/dist/search.js.map +1 -1
- package/dist/seen.d.ts +2 -2
- package/dist/seen.js +12 -12
- package/dist/seen.js.map +1 -1
- package/dist/settings.d.ts +1 -1
- package/dist/settings.js +3 -3
- package/dist/settings.js.map +1 -1
- package/dist/store.d.ts +2 -2
- package/dist/store.d.ts.map +1 -1
- package/dist/store.js +8 -8
- package/dist/store.js.map +1 -1
- package/dist/sync/google-calendar.js +1 -1
- package/dist/sync/types.d.ts +2 -2
- package/dist/testing.d.ts +1 -1
- package/dist/testing.d.ts.map +1 -1
- package/dist/testing.js +2 -2
- package/dist/testing.js.map +1 -1
- package/dist/theme/accent.d.ts +37 -0
- package/dist/theme/accent.d.ts.map +1 -0
- package/dist/theme/accent.js +138 -0
- package/dist/theme/accent.js.map +1 -0
- package/dist/theme/contrast.d.ts +7 -7
- package/dist/theme/contrast.d.ts.map +1 -1
- package/dist/theme/contrast.js +14 -14
- package/dist/theme/contrast.js.map +1 -1
- package/dist/theme/derive.d.ts +4 -4
- package/dist/theme/derive.d.ts.map +1 -1
- package/dist/theme/derive.js +19 -19
- package/dist/theme/derive.js.map +1 -1
- package/dist/theme/fonts.d.ts +19 -0
- package/dist/theme/fonts.d.ts.map +1 -0
- package/dist/theme/fonts.js +73 -0
- package/dist/theme/fonts.js.map +1 -0
- package/dist/theme/kit.d.ts +9 -9
- package/dist/theme/kit.d.ts.map +1 -1
- package/dist/theme/kit.js +15 -15
- package/dist/theme/kit.js.map +1 -1
- package/dist/theme/layers.d.ts +2 -2
- package/dist/theme/layers.d.ts.map +1 -1
- package/dist/theme/layers.js +2 -2
- package/dist/theme/layers.js.map +1 -1
- package/dist/theme/look.d.ts +3 -3
- package/dist/theme/look.d.ts.map +1 -1
- package/dist/theme/look.js +1 -1
- package/dist/theme/marks.d.ts +28 -0
- package/dist/theme/marks.d.ts.map +1 -0
- package/dist/theme/marks.js +237 -0
- package/dist/theme/marks.js.map +1 -0
- package/dist/theme/palettes.d.ts +2 -2
- package/dist/theme/palettes.js +2 -2
- package/dist/theme/types.d.ts +28 -6
- package/dist/theme/types.d.ts.map +1 -1
- package/dist/theme/types.js.map +1 -1
- package/dist/validate-graph.js +2 -2
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/watched.js +8 -8
- package/package.json +1 -1
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { TYPOGRAPHY } from "./look.js";
|
|
2
|
+
/*
|
|
3
|
+
* THE FACES A DOCUMENT MAY NAME (FR-124).
|
|
4
|
+
*
|
|
5
|
+
* A document says how its words are set, and never where a font comes
|
|
6
|
+
* from: a stack that names an address — `url(…)`, `https://…`, `@import` —
|
|
7
|
+
* is refused, so nothing a chat writes makes a page fetch from a server of
|
|
8
|
+
* its choosing. What it may name is three stacks of the system's own faces
|
|
9
|
+
* (`system-serif`, `system-sans`, `system-mono`), a face every system has
|
|
10
|
+
* (Georgia, Helvetica, Menlo…), and the web fonts on `DOCUMENT_FONTS`.
|
|
11
|
+
* Loading those is the HOST's decision: the embed fetches them from Google
|
|
12
|
+
* Fonts as it fetches a TypeScript brand's, unless the host passes
|
|
13
|
+
* `fonts: false` and serves them itself; a host that serves others names
|
|
14
|
+
* them to `compileDocument(…, { fonts })`.
|
|
15
|
+
*/
|
|
16
|
+
/** The three stacks a document names by keyword, made of the faces the reader's system already has. */
|
|
17
|
+
export const SYSTEM_STACKS = {
|
|
18
|
+
"system-sans": TYPOGRAPHY.body,
|
|
19
|
+
"system-serif": 'ui-serif, "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, Cambria, "Times New Roman", serif',
|
|
20
|
+
"system-mono": TYPOGRAPHY.mono,
|
|
21
|
+
};
|
|
22
|
+
/** CSS's generic families and the system's own aliases: never fetched. */
|
|
23
|
+
const GENERIC = ["serif", "sans-serif", "monospace", "cursive", "fantasy", "system-ui", "math", "emoji", "-apple-system", "BlinkMacSystemFont"];
|
|
24
|
+
/** Faces an operating system installs: named in a stack, used where the reader has them, and never fetched. */
|
|
25
|
+
export const SYSTEM_FONTS = [
|
|
26
|
+
"Georgia", "Times New Roman", "Times", "Iowan Old Style", "Palatino", "Palatino Linotype", "Charter", "Cambria", "Baskerville", "Optima",
|
|
27
|
+
"Helvetica", "Helvetica Neue", "Arial", "Verdana", "Segoe UI", "Roboto", "Avenir", "Avenir Next", "Gill Sans",
|
|
28
|
+
"Menlo", "Monaco", "Consolas", "SF Mono", "SFMono-Regular", "Courier New",
|
|
29
|
+
];
|
|
30
|
+
/** The web fonts a document may name (FR-124). The host decides whether and from where they load. */
|
|
31
|
+
export const DOCUMENT_FONTS = [
|
|
32
|
+
"Inter", "Source Sans 3", "IBM Plex Sans", "DM Sans", "Work Sans", "Space Grotesk", "Manrope",
|
|
33
|
+
"Source Serif 4", "IBM Plex Serif", "Fraunces", "Lora", "Merriweather", "Playfair Display", "EB Garamond", "Libre Baskerville", "Literata", "Crimson Pro",
|
|
34
|
+
"IBM Plex Mono", "JetBrains Mono", "Source Code Pro", "Fira Code",
|
|
35
|
+
];
|
|
36
|
+
const lower = (names) => new Set(names.map((name) => name.toLowerCase()));
|
|
37
|
+
/** The families a stack names, in order, unquoted. */
|
|
38
|
+
export function familiesIn(stack) {
|
|
39
|
+
return stack
|
|
40
|
+
.split(",")
|
|
41
|
+
.map((family) => family.trim().replace(/^["']|["']$/g, "").trim())
|
|
42
|
+
.filter((family) => family.length > 0);
|
|
43
|
+
}
|
|
44
|
+
/** Whether a family is the reader's own — a generic family or a face the system installs — and so never fetched. */
|
|
45
|
+
export function isSystemFamily(family) {
|
|
46
|
+
return lower([...GENERIC, ...SYSTEM_FONTS]).has(family.toLowerCase()) || family.toLowerCase().startsWith("ui-");
|
|
47
|
+
}
|
|
48
|
+
/** A document's stack as CSS: a keyword's stack, or the stack as written. */
|
|
49
|
+
export function stackOf(value) {
|
|
50
|
+
return SYSTEM_STACKS[value] ?? value;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Why a document may not name this stack, or null (FR-124). `served` is the
|
|
54
|
+
* web fonts the host serves beyond `DOCUMENT_FONTS`.
|
|
55
|
+
*/
|
|
56
|
+
export function fontProblem(value, served = []) {
|
|
57
|
+
if (value in SYSTEM_STACKS)
|
|
58
|
+
return null;
|
|
59
|
+
const origin = /(?:https?:)?\/\/([^/\s'"),;]+)/i.exec(value)?.[1];
|
|
60
|
+
if (origin)
|
|
61
|
+
return `it loads a font from ${origin}, and a document names a face, never where one comes from`;
|
|
62
|
+
if (/url\(|@import|[;{}<>:\\]/i.test(value))
|
|
63
|
+
return "it is not a list of font names; a document names a face, never where one comes from";
|
|
64
|
+
const allowed = lower([...DOCUMENT_FONTS, ...served]);
|
|
65
|
+
const families = familiesIn(value);
|
|
66
|
+
if (families.length === 0)
|
|
67
|
+
return "it names no face";
|
|
68
|
+
const unknown = families.find((family) => !isSystemFamily(family) && !allowed.has(family.toLowerCase()));
|
|
69
|
+
if (unknown)
|
|
70
|
+
return `"${unknown}" is not a face a document may name: say system-serif, system-sans or system-mono, a face every system has (Georgia, Helvetica, Menlo), or a web font from the list (${[...DOCUMENT_FONTS, ...served].join(", ")})`;
|
|
71
|
+
return null;
|
|
72
|
+
}
|
|
73
|
+
//# sourceMappingURL=fonts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fonts.js","sourceRoot":"","sources":["../../src/theme/fonts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAEvC;;;;;;;;;;;;;GAaG;AAEH,uGAAuG;AACvG,MAAM,CAAC,MAAM,aAAa,GAA6E;IACrG,aAAa,EAAE,UAAU,CAAC,IAAI;IAC9B,cAAc,EAAE,wGAAwG;IACxH,aAAa,EAAE,UAAU,CAAC,IAAI;CAC/B,CAAC;AAGF,0EAA0E;AAC1E,MAAM,OAAO,GAAG,CAAC,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,SAAS,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,eAAe,EAAE,oBAAoB,CAAC,CAAC;AAEhJ,+GAA+G;AAC/G,MAAM,CAAC,MAAM,YAAY,GAAsB;IAC7C,SAAS,EAAE,iBAAiB,EAAE,OAAO,EAAE,iBAAiB,EAAE,UAAU,EAAE,mBAAmB,EAAE,SAAS,EAAE,SAAS,EAAE,aAAa,EAAE,QAAQ;IACxI,WAAW,EAAE,gBAAgB,EAAE,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,QAAQ,EAAE,QAAQ,EAA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AU,OAAO,CAAC,KAAa;IACnC,OAAQ,aAAwC,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC;AACnE,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,WAAW,CAAC,KAAa,EAAE,SAA4B,EAAE;IACvE,IAAI,KAAK,IAAI,aAAa;QAAE,OAAO,IAAI,CAAC;IACxC,MAAM,MAAM,GAAG,iCAAiC,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IAClE,IAAI,MAAM;QAAE,OAAO,wBAAwB,MAAM,2DAA2D,CAAC;IAC7G,IAAI,2BAA2B,CAAC,IAAI,CAAC,KAAK,CAAC;QAAE,OAAO,qFAAqF,CAAC;IAC1I,MAAM,OAAO,GAAG,KAAK,CAAC,CAAC,GAAG,cAAc,EAAE,GAAG,MAAM,CAAC,CAAC,CAAC;IACtD,MAAM,QAAQ,GAAG,UAAU,CAAC,KAAK,CAAC,CAAC;IACnC,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,kBAAkB,CAAC;IACrD,MAAM,OAAO,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,cAAc,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC;IACzG,IAAI,OAAO;QAAE,OAAO,IAAI,OAAO,wKAAwK,CAAC,GAAG,cAAc,EAAE,GAAG,MAAM,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC;IACpP,OAAO,IAAI,CAAC;AACd,CAAC"}
|
package/dist/theme/kit.d.ts
CHANGED
|
@@ -9,8 +9,8 @@ export interface ConnectorKit {
|
|
|
9
9
|
readonly route: ConnectorRoute;
|
|
10
10
|
/** Drawn at all. An edge kind a brand keeps quiet is still selectable from the inspector. */
|
|
11
11
|
readonly visible: boolean;
|
|
12
|
-
/** An explicit CSS
|
|
13
|
-
readonly
|
|
12
|
+
/** An explicit CSS color; absent, the kind's own hue. */
|
|
13
|
+
readonly color?: string;
|
|
14
14
|
readonly pattern?: KitStrokePattern;
|
|
15
15
|
readonly width?: number;
|
|
16
16
|
readonly cap?: KitEndCap;
|
|
@@ -20,10 +20,10 @@ export interface Kit {
|
|
|
20
20
|
readonly connectors: {
|
|
21
21
|
/** Every edge kind, unless `byEdge` says otherwise. */
|
|
22
22
|
readonly all: ConnectorKit;
|
|
23
|
-
/** Per edge kind:
|
|
23
|
+
/** Per edge kind: color, visibility, pattern — whatever this kind wants differently. */
|
|
24
24
|
readonly byEdge: Readonly<Record<string, Partial<ConnectorKit>>>;
|
|
25
25
|
};
|
|
26
|
-
/** The words over a
|
|
26
|
+
/** The words over a neighborhood: the edge's own reading. */
|
|
27
27
|
readonly captions: {
|
|
28
28
|
readonly visible: boolean;
|
|
29
29
|
};
|
|
@@ -87,7 +87,7 @@ export declare function connectorKitFor(kit: Kit, edgeKind: string): ConnectorKi
|
|
|
87
87
|
export declare function kitVariables(kit: Kit): string;
|
|
88
88
|
export interface KitContrastFinding {
|
|
89
89
|
readonly edgeKind: string | "*";
|
|
90
|
-
readonly
|
|
90
|
+
readonly color: string;
|
|
91
91
|
readonly ratio: number;
|
|
92
92
|
readonly requires: number;
|
|
93
93
|
readonly unreadable?: string;
|
|
@@ -95,12 +95,12 @@ export interface KitContrastFinding {
|
|
|
95
95
|
readonly ground?: "ground" | "deep ground";
|
|
96
96
|
}
|
|
97
97
|
/**
|
|
98
|
-
* A connector's
|
|
98
|
+
* A connector's color must be told from the ground it crosses: 3:1, the
|
|
99
99
|
* floor for graphics, on both the ground and the deeper ground the
|
|
100
|
-
* altitude view uses. Only explicit
|
|
100
|
+
* altitude view uses. Only explicit colors are judged — a kind's own hue
|
|
101
101
|
* is the theme's to keep readable.
|
|
102
102
|
*/
|
|
103
103
|
export declare function checkKitContrast(kit: Kit, tokens: ThemeTokens): readonly KitContrastFinding[];
|
|
104
|
-
/** The kind's own hue (degrees) as the theme paints a connector, for callers that want the same
|
|
105
|
-
export declare function
|
|
104
|
+
/** The kind's own hue (degrees) as the theme paints a connector, for callers that want the same color elsewhere. */
|
|
105
|
+
export declare function connectorHueColor(hue: number): Rgba;
|
|
106
106
|
//# sourceMappingURL=kit.d.ts.map
|
package/dist/theme/kit.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"kit.d.ts","sourceRoot":"","sources":["../../src/theme/kit.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"kit.d.ts","sourceRoot":"","sources":["../../src/theme/kit.ts"],"names":[],"mappings":"AAAA,OAAO,EAA2B,KAAK,IAAI,EAAE,MAAM,eAAe,CAAC;AACnE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAgB9C,oDAAoD;AACpD,MAAM,MAAM,cAAc,GAAG,OAAO,GAAG,UAAU,GAAG,YAAY,CAAC;AACjE,MAAM,MAAM,gBAAgB,GAAG,OAAO,GAAG,QAAQ,GAAG,QAAQ,GAAG,QAAQ,GAAG,SAAS,CAAC;AACpF,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG,OAAO,GAAG,KAAK,GAAG,KAAK,CAAC;AAEzD,MAAM,WAAW,YAAY;IAC3B,uEAAuE;IACvE,QAAQ,CAAC,KAAK,EAAE,cAAc,CAAC;IAC/B,6FAA6F;IAC7F,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,yDAAyD;IACzD,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,OAAO,CAAC,EAAE,gBAAgB,CAAC;IACpC,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,GAAG,CAAC,EAAE,SAAS,CAAC;IACzB,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED,MAAM,WAAW,GAAG;IAClB,QAAQ,CAAC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AG,EAAE,GAAG,EAAE,MAAM,EAAE,WAAW,GAAG,SAAS,kBAAkB,EAAE,CAoB7F;AAED,oHAAoH;AACpH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAEnD"}
|
package/dist/theme/kit.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { colorsIn, contrast, hsl } from "./contrast.js";
|
|
2
2
|
export const DEFAULT_KIT = {
|
|
3
3
|
connectors: { all: { route: "curve", visible: true }, byEdge: {} },
|
|
4
4
|
captions: { visible: true },
|
|
@@ -48,37 +48,37 @@ export function kitVariables(kit) {
|
|
|
48
48
|
].join("\n");
|
|
49
49
|
}
|
|
50
50
|
/**
|
|
51
|
-
* A connector's
|
|
51
|
+
* A connector's color must be told from the ground it crosses: 3:1, the
|
|
52
52
|
* floor for graphics, on both the ground and the deeper ground the
|
|
53
|
-
* altitude view uses. Only explicit
|
|
53
|
+
* altitude view uses. Only explicit colors are judged — a kind's own hue
|
|
54
54
|
* is the theme's to keep readable.
|
|
55
55
|
*/
|
|
56
56
|
export function checkKitContrast(kit, tokens) {
|
|
57
57
|
const findings = [];
|
|
58
58
|
const grounds = [["ground", tokens.ground], ["deep ground", tokens.groundDeep]]
|
|
59
|
-
.map(([name, value]) => ({ name,
|
|
60
|
-
.filter((one) => one.
|
|
61
|
-
const judge = (edgeKind,
|
|
62
|
-
if (!
|
|
59
|
+
.map(([name, value]) => ({ name, color: colorsIn(value)[0] }))
|
|
60
|
+
.filter((one) => one.color !== undefined);
|
|
61
|
+
const judge = (edgeKind, color) => {
|
|
62
|
+
if (!color)
|
|
63
63
|
return;
|
|
64
|
-
const ink =
|
|
64
|
+
const ink = colorsIn(color)[0];
|
|
65
65
|
if (!ink) {
|
|
66
|
-
findings.push({ edgeKind,
|
|
66
|
+
findings.push({ edgeKind, color, ratio: 0, requires: 3, unreadable: color });
|
|
67
67
|
return;
|
|
68
68
|
}
|
|
69
69
|
for (const ground of grounds) {
|
|
70
|
-
const ratio = Math.round(contrast(ink, ground.
|
|
70
|
+
const ratio = Math.round(contrast(ink, ground.color) * 100) / 100;
|
|
71
71
|
if (ratio < 3)
|
|
72
|
-
findings.push({ edgeKind,
|
|
72
|
+
findings.push({ edgeKind, color, ratio, requires: 3, ground: ground.name });
|
|
73
73
|
}
|
|
74
74
|
};
|
|
75
|
-
judge("*", kit.connectors.all.
|
|
75
|
+
judge("*", kit.connectors.all.color);
|
|
76
76
|
for (const [edgeKind, connector] of Object.entries(kit.connectors.byEdge))
|
|
77
|
-
judge(edgeKind, connector.
|
|
77
|
+
judge(edgeKind, connector.color);
|
|
78
78
|
return findings;
|
|
79
79
|
}
|
|
80
|
-
/** The kind's own hue (degrees) as the theme paints a connector, for callers that want the same
|
|
81
|
-
export function
|
|
80
|
+
/** The kind's own hue (degrees) as the theme paints a connector, for callers that want the same color elsewhere. */
|
|
81
|
+
export function connectorHueColor(hue) {
|
|
82
82
|
return hsl(hue, 55, 62);
|
|
83
83
|
}
|
|
84
84
|
//# sourceMappingURL=kit.js.map
|
package/dist/theme/kit.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"kit.js","sourceRoot":"","sources":["../../src/theme/kit.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"kit.js","sourceRoot":"","sources":["../../src/theme/kit.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,GAAG,EAAa,MAAM,eAAe,CAAC;AAgFnE,MAAM,CAAC,MAAM,WAAW,GAAQ;IAC9B,UAAU,EAAE,EAAE,GAAG,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE;IAClE,QAAQ,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE;IAC3B,IAAI,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,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C,UAAU,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IACrC,KAAK,MAAM,CAAC,QAAQ,EAAE,SAAS,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,MAAM,CAAC;QAAE,KAAK,CAAC,QAAQ,EAAE,SAAS,CAAC,KAAK,CAAC,CAAC;IAC5G,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED,oHAAoH;AACpH,MAAM,UAAU,iBAAiB,CAAC,GAAW;IAC3C,OAAO,GAAG,CAAC,GAAG,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC;AAC1B,CAAC"}
|
package/dist/theme/layers.d.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Every surface used to pick its own number in one stacking context: the
|
|
5
5
|
* profile and the problems at 20, the companion at 40, the altitude
|
|
6
6
|
* control at 5, the zoom at 8, a menu at 60, the studio at 100. Each was
|
|
7
|
-
* right the day it was written and wrong the day a
|
|
7
|
+
* right the day it was written and wrong the day a neighbor moved — on a
|
|
8
8
|
* hosted app the profile opened UNDER the seat's rail and could not be
|
|
9
9
|
* read. So there is one ladder, written once, here, and nothing else in
|
|
10
10
|
* the framework writes a number:
|
|
@@ -46,7 +46,7 @@ export type Layer = keyof typeof LAYERS;
|
|
|
46
46
|
export declare const SCENE_LAYERS: {
|
|
47
47
|
/** The ground's plots, under everything drawn on them. */
|
|
48
48
|
readonly plots: 0;
|
|
49
|
-
/** The cards' stage; a lit card over its unlit
|
|
49
|
+
/** The cards' stage; a lit card over its unlit neighbors. */
|
|
50
50
|
readonly stage: 1;
|
|
51
51
|
/** A district's tag and face, over its plate. */
|
|
52
52
|
readonly tag: 2;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"layers.d.ts","sourceRoot":"","sources":["../../src/theme/layers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,eAAO,MAAM,MAAM;;;;;;;CAOT,CAAC;AAEX,MAAM,MAAM,KAAK,GAAG,MAAM,OAAO,MAAM,CAAC;AAExC;;;;;;;GAOG;AACH,eAAO,MAAM,YAAY;IACvB,0DAA0D;;IAE1D,
|
|
1
|
+
{"version":3,"file":"layers.d.ts","sourceRoot":"","sources":["../../src/theme/layers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,eAAO,MAAM,MAAM;;;;;;;CAOT,CAAC;AAEX,MAAM,MAAM,KAAK,GAAG,MAAM,OAAO,MAAM,CAAC;AAExC;;;;;;;GAOG;AACH,eAAO,MAAM,YAAY;IACvB,0DAA0D;;IAE1D,6DAA6D;;IAE7D,iDAAiD;;IAEjD,8BAA8B;;IAE9B,uGAAuG;;IAEvG,wCAAwC;;IAExC,sCAAsC;;IAEtC,wCAAwC;;IAExC,+CAA+C;;IAE/C,iEAAiE;;IAEjE,+CAA+C;;CAEvC,CAAC;AAEX,6EAA6E;AAC7E,eAAO,MAAM,YAAY;;;;CAA4C,CAAC;AAEtE,gDAAgD;AAChD,eAAO,MAAM,aAAa,GAAI,MAAM,KAAK,KAAG,MAAmC,CAAC;AAEhF,8FAA8F;AAC9F,eAAO,MAAM,KAAK,GAAI,MAAM,KAAK,KAAG,MAAwD,CAAC;AAE7F,sEAAsE;AACtE,wBAAgB,cAAc,IAAI,MAAM,CAEvC"}
|
package/dist/theme/layers.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Every surface used to pick its own number in one stacking context: the
|
|
5
5
|
* profile and the problems at 20, the companion at 40, the altitude
|
|
6
6
|
* control at 5, the zoom at 8, a menu at 60, the studio at 100. Each was
|
|
7
|
-
* right the day it was written and wrong the day a
|
|
7
|
+
* right the day it was written and wrong the day a neighbor moved — on a
|
|
8
8
|
* hosted app the profile opened UNDER the seat's rail and could not be
|
|
9
9
|
* read. So there is one ladder, written once, here, and nothing else in
|
|
10
10
|
* the framework writes a number:
|
|
@@ -45,7 +45,7 @@ export const LAYERS = {
|
|
|
45
45
|
export const SCENE_LAYERS = {
|
|
46
46
|
/** The ground's plots, under everything drawn on them. */
|
|
47
47
|
plots: 0,
|
|
48
|
-
/** The cards' stage; a lit card over its unlit
|
|
48
|
+
/** The cards' stage; a lit card over its unlit neighbors. */
|
|
49
49
|
stage: 1,
|
|
50
50
|
/** A district's tag and face, over its plate. */
|
|
51
51
|
tag: 2,
|
package/dist/theme/layers.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"layers.js","sourceRoot":"","sources":["../../src/theme/layers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG;IACpB,KAAK,EAAE,CAAC;IACR,QAAQ,EAAE,EAAE;IACZ,IAAI,EAAE,EAAE;IACR,OAAO,EAAE,EAAE;IACX,MAAM,EAAE,EAAE;IACV,KAAK,EAAE,EAAE;CACD,CAAC;AAIX;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B,0DAA0D;IAC1D,KAAK,EAAE,CAAC;IACR,
|
|
1
|
+
{"version":3,"file":"layers.js","sourceRoot":"","sources":["../../src/theme/layers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG;IACpB,KAAK,EAAE,CAAC;IACR,QAAQ,EAAE,EAAE;IACZ,IAAI,EAAE,EAAE;IACR,OAAO,EAAE,EAAE;IACX,MAAM,EAAE,EAAE;IACV,KAAK,EAAE,EAAE;CACD,CAAC;AAIX;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B,0DAA0D;IAC1D,KAAK,EAAE,CAAC;IACR,6DAA6D;IAC7D,KAAK,EAAE,CAAC;IACR,iDAAiD;IACjD,GAAG,EAAE,CAAC;IACN,8BAA8B;IAC9B,IAAI,EAAE,CAAC;IACP,uGAAuG;IACvG,KAAK,EAAE,CAAC;IACR,wCAAwC;IACxC,SAAS,EAAE,CAAC;IACZ,sCAAsC;IACtC,SAAS,EAAE,CAAC;IACZ,wCAAwC;IACxC,SAAS,EAAE,CAAC;IACZ,+CAA+C;IAC/C,IAAI,EAAE,CAAC;IACP,iEAAiE;IACjE,IAAI,EAAE,EAAE;IACR,+CAA+C;IAC/C,MAAM,EAAE,EAAE;CACF,CAAC;AAEX,6EAA6E;AAC7E,MAAM,CAAC,MAAM,YAAY,GAAG,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAW,CAAC;AAEtE,gDAAgD;AAChD,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,IAAW,EAAU,EAAE,CAAC,mBAAmB,IAAI,EAAE,CAAC;AAEhF,8FAA8F;AAC9F,MAAM,CAAC,MAAM,KAAK,GAAG,CAAC,IAAW,EAAU,EAAE,CAAC,OAAO,aAAa,CAAC,IAAI,CAAC,KAAK,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC;AAE7F,sEAAsE;AACtE,MAAM,UAAU,cAAc;IAC5B,OAAQ,MAAM,CAAC,IAAI,CAAC,MAAM,CAAa,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,KAAK,aAAa,CAAC,IAAI,CAAC,KAAK,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACjH,CAAC"}
|
package/dist/theme/look.d.ts
CHANGED
|
@@ -73,11 +73,11 @@ export interface IsoShade {
|
|
|
73
73
|
readonly right: IsoFace;
|
|
74
74
|
/** The wall away from it: darkest. */
|
|
75
75
|
readonly left: IsoFace;
|
|
76
|
-
/** The roof's lit edge, as a CSS
|
|
76
|
+
/** The roof's lit edge, as a CSS color. */
|
|
77
77
|
readonly roofEdge: string;
|
|
78
78
|
/** The district's plot: the ground the blocks stand on. */
|
|
79
79
|
readonly plot: IsoWash;
|
|
80
|
-
/** The plot's
|
|
80
|
+
/** The plot's curb. */
|
|
81
81
|
readonly plotEdge: IsoWash;
|
|
82
82
|
}
|
|
83
83
|
/**
|
|
@@ -90,7 +90,7 @@ export interface IsoShade {
|
|
|
90
90
|
* scene's. The lighting is not a brand's to set, because it is what makes
|
|
91
91
|
* a block read as a block on the shipped grounds in both schemes.
|
|
92
92
|
*
|
|
93
|
-
* `hsl(${hue} ${face.saturation}% ${face.lightness}%)` is a face's
|
|
93
|
+
* `hsl(${hue} ${face.saturation}% ${face.lightness}%)` is a face's color.
|
|
94
94
|
*/
|
|
95
95
|
export declare function isoShade(scheme: Scheme): IsoShade;
|
|
96
96
|
//# sourceMappingURL=look.d.ts.map
|
package/dist/theme/look.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"look.d.ts","sourceRoot":"","sources":["../../src/theme/look.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAiBhD;;;;;;;;GAQG;AACH,eAAO,MAAM,KAAK;IAChB,mCAAmC;;IAEnC,4DAA4D;;IAE5D,kGAAkG;;;IAGlG,iDAAiD;;IAEjD,oDAAoD;;IAEpD,6CAA6C;;EAE7C,CAAC;AAEH;;;;GAIG;AACH,eAAO,MAAM,UAAU;;;EAGrB,CAAC;AAEH,yHAAyH;AACzH,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;CACtB;AAED;;;GAGG;AACH,wBAAgB,OAAO,CAAC,KAAK,CAAC,EAAE,IAAI,CAAC,KAAK,EAAE,OAAO,CAAC,GAAG,aAAa,CAUnE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EAAE,OAAO,CAAC;CAC5B;AA0BD;;;;;;;;;;;GAWG;AACH,wBAAgB,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,QAAQ,CAEjD"}
|
package/dist/theme/look.js
CHANGED
|
@@ -102,7 +102,7 @@ const SHADES = Object.freeze({
|
|
|
102
102
|
* scene's. The lighting is not a brand's to set, because it is what makes
|
|
103
103
|
* a block read as a block on the shipped grounds in both schemes.
|
|
104
104
|
*
|
|
105
|
-
* `hsl(${hue} ${face.saturation}% ${face.lightness}%)` is a face's
|
|
105
|
+
* `hsl(${hue} ${face.saturation}% ${face.lightness}%)` is a face's color.
|
|
106
106
|
*/
|
|
107
107
|
export function isoShade(scheme) {
|
|
108
108
|
return SHADES[scheme];
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/** The most an inline SVG mark may be, in characters. */
|
|
2
|
+
export declare const MAX_INLINE_SVG: number;
|
|
3
|
+
/** Whether a mark is an SVG written inline, rather than a path to one. */
|
|
4
|
+
export declare function isInlineSvg(mark: string): boolean;
|
|
5
|
+
/** Why an SVG may not be drawn as it is: anything that could run, or reach outside the image. Null when it may. */
|
|
6
|
+
export declare function svgProblem(text: string): string | null;
|
|
7
|
+
/**
|
|
8
|
+
* Why a mark may not be drawn, or null: an inline SVG under the rules
|
|
9
|
+
* above, or a path on the app's own host — under `/graview/assets/`, or
|
|
10
|
+
* relative to the page, never climbing out of either — and never another
|
|
11
|
+
* origin.
|
|
12
|
+
*/
|
|
13
|
+
export declare function markProblem(mark: string): string | null;
|
|
14
|
+
/**
|
|
15
|
+
* A mark as an address an `<img>` or a `<link rel="icon">` can take: an
|
|
16
|
+
* inline SVG as a `data:` URI, a path, a web address or a `data:` image as
|
|
17
|
+
* given. Undefined for an inline SVG that could act, and for an address of
|
|
18
|
+
* any other scheme (`javascript:` among them). Which origins a mark may
|
|
19
|
+
* name is the checker's to judge (a document's only its own host; a
|
|
20
|
+
* TypeScript brand's wherever its author serves it); a face draws what it
|
|
21
|
+
* is given.
|
|
22
|
+
*/
|
|
23
|
+
export declare function markHref(mark: string | undefined): string | undefined;
|
|
24
|
+
/** The page icon a brand asks for, as an address (FR-124), or undefined. */
|
|
25
|
+
export declare function faviconHref(brand: {
|
|
26
|
+
readonly favicon?: string;
|
|
27
|
+
} | undefined): string | undefined;
|
|
28
|
+
//# sourceMappingURL=marks.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"marks.d.ts","sourceRoot":"","sources":["../../src/theme/marks.ts"],"names":[],"mappings":"AAsBA,yDAAyD;AACzD,eAAO,MAAM,cAAc,QAAY,CAAC;AAExC,0EAA0E;AAC1E,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAEjD;AA2ED,mHAAmH;AACnH,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CA+DtD;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAWvD;AAED;;;;;;;;GAQG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CASrE;AAED,4EAA4E;AAC5E,wBAAgB,WAAW,CAAC,KAAK,EAAE;IAAE,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CAEhG"}
|
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* A BRAND'S MARKS — its logo and its page icon (FR-124) — as a document
|
|
3
|
+
* holds them: an SVG written inline, or a path on the app's own host
|
|
4
|
+
* (`/graview/assets/<sha256>.svg`, where Graview Cloud keeps what a chat
|
|
5
|
+
* hands it). Drawn as given and never redrawn, so an SVG that could act —
|
|
6
|
+
* run a script, answer an event, embed a page, load anything — is refused
|
|
7
|
+
* with the reason rather than quietly rewritten.
|
|
8
|
+
*
|
|
9
|
+
* READ AS THE BROWSER READS IT. An inline mark reaches the page through
|
|
10
|
+
* the HTML parser, which takes a handler after a slash, an unquoted link,
|
|
11
|
+
* markup after the closing tag and a style written in escapes; rules that
|
|
12
|
+
* search the string for what is forbidden miss each of those. So the SVG
|
|
13
|
+
* is read whole, element by element, as both the HTML and the XML parser
|
|
14
|
+
* will read it, and only what a picture needs is kept: the elements a
|
|
15
|
+
* drawing is made of (no `a`, `style`, `script`, `foreignObject`,
|
|
16
|
+
* animation or `feImage`), no prefixed element, every attribute quoted and
|
|
17
|
+
* apart from the last, no handler, a link only within the picture (`#id`,
|
|
18
|
+
* or a `data:image/` on an `<image>`), a paint or a style that reaches only
|
|
19
|
+
* within it, no CDATA, no entity, and nothing after the root. These are
|
|
20
|
+
* the rules Graview Cloud's `add_image` holds an image to.
|
|
21
|
+
*/
|
|
22
|
+
/** The most an inline SVG mark may be, in characters. */
|
|
23
|
+
export const MAX_INLINE_SVG = 64 * 1024;
|
|
24
|
+
/** Whether a mark is an SVG written inline, rather than a path to one. */
|
|
25
|
+
export function isInlineSvg(mark) {
|
|
26
|
+
return /^\s*(<\?xml[^>]*>\s*)?(<!--[\s\S]*?-->\s*)*(<!DOCTYPE svg[^>]*>\s*)?<svg[\s>/]/i.test(mark);
|
|
27
|
+
}
|
|
28
|
+
const SVG_NS = "http://www.w3.org/2000/svg";
|
|
29
|
+
const OTHER_MARKUP = ["http://www.w3.org/1999/xhtml", "http://www.w3.org/1998/Math/MathML", SVG_NS];
|
|
30
|
+
/** What a picture is made of, spelled as SVG spells it: the HTML parser maps its lower-case reading back to these. */
|
|
31
|
+
const ELEMENTS = new Set(("svg g defs symbol use title desc path rect circle ellipse line polyline polygon text tspan textPath " +
|
|
32
|
+
"linearGradient radialGradient stop pattern clipPath mask marker image filter feBlend feColorMatrix " +
|
|
33
|
+
"feComponentTransfer feComposite feDropShadow feFlood feFuncA feFuncB feFuncG feFuncR feGaussianBlur " +
|
|
34
|
+
"feMerge feMergeNode feMorphology feOffset feTile feTurbulence").split(" "));
|
|
35
|
+
/** Elements whose content the HTML parser reads as HTML: text alone inside them. */
|
|
36
|
+
const TEXT_ONLY = new Set(["title", "desc"]);
|
|
37
|
+
const MEDIA = "it embeds a page or media";
|
|
38
|
+
/** A refused element a reader would look for by name, said as the checker has always said it. */
|
|
39
|
+
const REFUSED_SAID = {
|
|
40
|
+
script: "it has a script in it",
|
|
41
|
+
foreignobject: "it embeds HTML (foreignObject)",
|
|
42
|
+
iframe: MEDIA,
|
|
43
|
+
embed: MEDIA,
|
|
44
|
+
object: MEDIA,
|
|
45
|
+
audio: MEDIA,
|
|
46
|
+
video: MEDIA,
|
|
47
|
+
style: "it has a style sheet in it; a mark is styled by its attributes",
|
|
48
|
+
a: "it links to something (an <a> element)",
|
|
49
|
+
};
|
|
50
|
+
const XML_ENTITIES = { amp: "&", lt: "<", gt: ">", quot: '"', apos: "'" };
|
|
51
|
+
/** An attribute's value as the parser hands it on: character references read; any other named entity is null. */
|
|
52
|
+
function decoded(value) {
|
|
53
|
+
let unknown = false;
|
|
54
|
+
const out = value.replace(/&(#x[0-9a-f]+|#[0-9]+|[a-z][a-z0-9]*);?/gi, (_, ref) => {
|
|
55
|
+
if (ref[0] === "#") {
|
|
56
|
+
const code = ref[1] === "x" || ref[1] === "X" ? parseInt(ref.slice(2), 16) : parseInt(ref.slice(1), 10);
|
|
57
|
+
return code > 0 && code <= 0x10ffff ? String.fromCodePoint(code) : "�";
|
|
58
|
+
}
|
|
59
|
+
const known = XML_ENTITIES[ref.toLowerCase()];
|
|
60
|
+
if (known === undefined)
|
|
61
|
+
unknown = true;
|
|
62
|
+
return known ?? "";
|
|
63
|
+
});
|
|
64
|
+
return unknown ? null : out;
|
|
65
|
+
}
|
|
66
|
+
/** Whether a value reaches only within the picture: no escape, no at-rule, no image function, and every `url(` a fragment of it. */
|
|
67
|
+
function staysWithin(value) {
|
|
68
|
+
if (/\\|@|expression\s*\(|(?:image-set|cross-fade|image|element|src)\s*\(/i.test(value))
|
|
69
|
+
return false;
|
|
70
|
+
for (const [, target] of value.matchAll(/url\s*\(\s*["']?\s*([^)]*)/gi))
|
|
71
|
+
if (!target.startsWith("#"))
|
|
72
|
+
return false;
|
|
73
|
+
return true;
|
|
74
|
+
}
|
|
75
|
+
/** Why one attribute may not stand on this element, or null. */
|
|
76
|
+
function attributeProblem(element, name, raw) {
|
|
77
|
+
const value = decoded(raw);
|
|
78
|
+
if (value === null)
|
|
79
|
+
return "it declares XML entities";
|
|
80
|
+
const local = (name.includes(":") ? name.slice(name.indexOf(":") + 1) : name).toLowerCase();
|
|
81
|
+
if (local.startsWith("on"))
|
|
82
|
+
return "it has an event handler (an on… attribute)";
|
|
83
|
+
if (name === "xml:base")
|
|
84
|
+
return "it loads or links to something outside itself";
|
|
85
|
+
if (name === "xmlns")
|
|
86
|
+
return value === SVG_NS ? null : "it changes what its elements are (another xmlns)";
|
|
87
|
+
if (name.startsWith("xmlns:"))
|
|
88
|
+
return OTHER_MARKUP.includes(value) ? "it changes what its elements are (another xmlns)" : null;
|
|
89
|
+
if (local === "href" || local === "src") {
|
|
90
|
+
const link = value.replace(/[\u0000- ]+/g, "");
|
|
91
|
+
if (link.startsWith("#"))
|
|
92
|
+
return null;
|
|
93
|
+
if (element === "image" && /^data:image\/(png|jpe?g|gif|webp|avif);/i.test(link))
|
|
94
|
+
return null;
|
|
95
|
+
return "it loads or links to something outside itself";
|
|
96
|
+
}
|
|
97
|
+
if (!staysWithin(value))
|
|
98
|
+
return local === "style" ? "its style loads something outside itself" : "it loads or links to something outside itself";
|
|
99
|
+
return null;
|
|
100
|
+
}
|
|
101
|
+
const ATTRIBUTE = /^\s+([A-Za-z_][A-Za-z0-9_.:-]*)\s*=\s*(?:"([^"<]*)"|'([^'<]*)')/;
|
|
102
|
+
/** Why an SVG may not be drawn as it is: anything that could run, or reach outside the image. Null when it may. */
|
|
103
|
+
export function svgProblem(text) {
|
|
104
|
+
if (/<!ENTITY/i.test(text))
|
|
105
|
+
return "it declares XML entities";
|
|
106
|
+
if (/<!\[CDATA\[/i.test(text))
|
|
107
|
+
return "it has a CDATA section, which the page and the picture read differently";
|
|
108
|
+
const open = [];
|
|
109
|
+
let ended = false;
|
|
110
|
+
let at = /^\s*(<\?xml\s[^?<>]*\?>)?/.exec(text)[0].length;
|
|
111
|
+
while (at < text.length) {
|
|
112
|
+
const rest = text.slice(at);
|
|
113
|
+
const words = /^[^<]+/.exec(rest);
|
|
114
|
+
if (words) {
|
|
115
|
+
if (open.length === 0 && words[0].trim() !== "")
|
|
116
|
+
return "it is not one SVG: there is text outside it";
|
|
117
|
+
at += words[0].length;
|
|
118
|
+
continue;
|
|
119
|
+
}
|
|
120
|
+
if (rest.startsWith("<!--")) {
|
|
121
|
+
const close = rest.indexOf("-->", 4);
|
|
122
|
+
if (close < 0)
|
|
123
|
+
return "it has a comment that never ends";
|
|
124
|
+
const body = rest.slice(4, close);
|
|
125
|
+
if (/^-?>/.test(body) || body.includes("--") || body.includes("<!") || body.endsWith("-"))
|
|
126
|
+
return "it has a comment the page and the picture read differently";
|
|
127
|
+
at += close + 3;
|
|
128
|
+
continue;
|
|
129
|
+
}
|
|
130
|
+
if (/^<!DOCTYPE/i.test(rest)) {
|
|
131
|
+
const doctype = /^<!DOCTYPE\s+svg\b[^<>[\]]*>/i.exec(rest);
|
|
132
|
+
if (!doctype || open.length > 0 || ended)
|
|
133
|
+
return "it declares XML entities";
|
|
134
|
+
at += doctype[0].length;
|
|
135
|
+
continue;
|
|
136
|
+
}
|
|
137
|
+
const close = /^<\/([A-Za-z][A-Za-z0-9_.:-]*)\s*>/.exec(rest);
|
|
138
|
+
if (close) {
|
|
139
|
+
if (open.pop() !== close[1])
|
|
140
|
+
return `it is not one SVG: </${close[1]}> closes what is not open`;
|
|
141
|
+
if (open.length === 0)
|
|
142
|
+
ended = true;
|
|
143
|
+
at += close[0].length;
|
|
144
|
+
continue;
|
|
145
|
+
}
|
|
146
|
+
const start = /^<([A-Za-z][A-Za-z0-9_.:-]*)/.exec(rest);
|
|
147
|
+
if (!start)
|
|
148
|
+
return "it is not one SVG: it has markup a picture cannot hold";
|
|
149
|
+
const name = start[1];
|
|
150
|
+
const refused = REFUSED_SAID[name.toLowerCase()];
|
|
151
|
+
if (refused)
|
|
152
|
+
return refused;
|
|
153
|
+
if (ended)
|
|
154
|
+
return `it is not one SVG: <${name}> comes after it ends`;
|
|
155
|
+
if (open.length === 0 && name !== "svg")
|
|
156
|
+
return "it is not one SVG";
|
|
157
|
+
if (name.includes(":"))
|
|
158
|
+
return `it has an element of another kind (<${name}>)`;
|
|
159
|
+
if (!ELEMENTS.has(name))
|
|
160
|
+
return `it has a <${name}> element, which a picture does not need`;
|
|
161
|
+
const parent = open[open.length - 1];
|
|
162
|
+
if (parent && TEXT_ONLY.has(parent))
|
|
163
|
+
return `it has an element inside a <${parent}>, which the page reads as HTML`;
|
|
164
|
+
let tag = start[0].length;
|
|
165
|
+
for (let attribute = ATTRIBUTE.exec(rest.slice(tag)); attribute; attribute = ATTRIBUTE.exec(rest.slice(tag))) {
|
|
166
|
+
const problem = attributeProblem(name, attribute[1], attribute[2] ?? attribute[3] ?? "");
|
|
167
|
+
if (problem)
|
|
168
|
+
return problem;
|
|
169
|
+
tag += attribute[0].length;
|
|
170
|
+
}
|
|
171
|
+
const end = /^\s*(\/?)>/.exec(rest.slice(tag));
|
|
172
|
+
if (!end) {
|
|
173
|
+
if (/(?:^|[\s/"'])on[a-z]+\s*=/i.test(rest.slice(tag, tag + 400)))
|
|
174
|
+
return "it has an event handler (an on… attribute)";
|
|
175
|
+
return `it is not one SVG: <${name}>'s attributes are not each quoted and apart`;
|
|
176
|
+
}
|
|
177
|
+
if (end[1] !== "/")
|
|
178
|
+
open.push(name);
|
|
179
|
+
else if (open.length === 0)
|
|
180
|
+
ended = true;
|
|
181
|
+
at += tag + end[0].length;
|
|
182
|
+
}
|
|
183
|
+
if (open.length > 0)
|
|
184
|
+
return `it is not one SVG: <${open[open.length - 1]}> is never closed`;
|
|
185
|
+
return ended ? null : "it is not one SVG";
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* Why a mark may not be drawn, or null: an inline SVG under the rules
|
|
189
|
+
* above, or a path on the app's own host — under `/graview/assets/`, or
|
|
190
|
+
* relative to the page, never climbing out of either — and never another
|
|
191
|
+
* origin.
|
|
192
|
+
*/
|
|
193
|
+
export function markProblem(mark) {
|
|
194
|
+
if (isInlineSvg(mark)) {
|
|
195
|
+
if (mark.length > MAX_INLINE_SVG)
|
|
196
|
+
return `it is over ${MAX_INLINE_SVG / 1024} KB, the most an inline SVG may be`;
|
|
197
|
+
return svgProblem(mark);
|
|
198
|
+
}
|
|
199
|
+
if (/^\s*</.test(mark))
|
|
200
|
+
return "it is markup, and not an SVG";
|
|
201
|
+
if (/^[a-z][a-z0-9+.-]*:/i.test(mark) || mark.startsWith("//"))
|
|
202
|
+
return "it names another origin; a mark is inline SVG or a path on the app's own host, like /graview/assets/<sha256>.svg";
|
|
203
|
+
if (!/^[A-Za-z0-9._~/-]+$/.test(mark))
|
|
204
|
+
return "a path is letters, digits and . _ ~ / - only";
|
|
205
|
+
if (mark.split("/").some((part) => part === "." || part === ".."))
|
|
206
|
+
return "the path climbs out of where it is (a . or .. in it); name the file itself, like /graview/assets/<sha256>.svg";
|
|
207
|
+
if (mark.startsWith("/") && !mark.startsWith("/graview/assets/"))
|
|
208
|
+
return "a path on the app's own host is under /graview/assets/, or relative to the page";
|
|
209
|
+
return null;
|
|
210
|
+
}
|
|
211
|
+
/**
|
|
212
|
+
* A mark as an address an `<img>` or a `<link rel="icon">` can take: an
|
|
213
|
+
* inline SVG as a `data:` URI, a path, a web address or a `data:` image as
|
|
214
|
+
* given. Undefined for an inline SVG that could act, and for an address of
|
|
215
|
+
* any other scheme (`javascript:` among them). Which origins a mark may
|
|
216
|
+
* name is the checker's to judge (a document's only its own host; a
|
|
217
|
+
* TypeScript brand's wherever its author serves it); a face draws what it
|
|
218
|
+
* is given.
|
|
219
|
+
*/
|
|
220
|
+
export function markHref(mark) {
|
|
221
|
+
if (!mark)
|
|
222
|
+
return undefined;
|
|
223
|
+
if (!isInlineSvg(mark)) {
|
|
224
|
+
if (/^\s*</.test(mark))
|
|
225
|
+
return undefined;
|
|
226
|
+
const scheme = /^\s*([a-z][a-z0-9+.-]*):/i.exec(mark)?.[1]?.toLowerCase();
|
|
227
|
+
if (scheme === undefined || scheme === "http" || scheme === "https")
|
|
228
|
+
return mark;
|
|
229
|
+
return scheme === "data" && /^\s*data:image\//i.test(mark) ? mark : undefined;
|
|
230
|
+
}
|
|
231
|
+
return svgProblem(mark) === null ? `data:image/svg+xml,${encodeURIComponent(mark.trim())}` : undefined;
|
|
232
|
+
}
|
|
233
|
+
/** The page icon a brand asks for, as an address (FR-124), or undefined. */
|
|
234
|
+
export function faviconHref(brand) {
|
|
235
|
+
return markHref(brand?.favicon);
|
|
236
|
+
}
|
|
237
|
+
//# sourceMappingURL=marks.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"marks.js","sourceRoot":"","sources":["../../src/theme/marks.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,yDAAyD;AACzD,MAAM,CAAC,MAAM,cAAc,GAAG,EAAE,GAAG,IAAI,CAAC;AAExC,0EAA0E;AAC1E,MAAM,UAAU,WAAW,CAAC,IAAY;IACtC,OAAO,iFAAiF,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACtG,CAAC;AAED,MAAM,MAAM,GAAG,4BAA4B,CAAC;AAC5C,MAAM,YAAY,GAAG,CAAC,8BAA8B,EAAE,oCAAoC,EAAE,MAAM,CAAC,CAAC;AAEpG,sHAAsH;AACtH,MAAM,QAAQ,GAAG,IAAI,GAAG,CACtB,CACE,sGAAsG;IACtG,qGAAqG;IACrG,sGAAsG;IACtG,+DAA+D,CAChE,CAAC,KAAK,CAAC,GAAG,CAAC,CACb,CAAC;AACF,oFAAoF;AACpF,MAAM,SAAS,GA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MAAM,KAAK,OAAO;YAAE,OAAO,IAAI,CAAC;QACjF,OAAO,MAAM,KAAK,MAAM,IAAI,mBAAmB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC;IAChF,CAAC;IACD,OAAO,UAAU,CAAC,IAAI,CAAC,KAAK,IAAI,CAAC,CAAC,CAAC,sBAAsB,kBAAkB,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;AACzG,CAAC;AAED,4EAA4E;AAC5E,MAAM,UAAU,WAAW,CAAC,KAAgD;IAC1E,OAAO,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;AAClC,CAAC"}
|
package/dist/theme/palettes.d.ts
CHANGED
|
@@ -17,9 +17,9 @@ import type { Scheme, ThemeTokens } from "./types.js";
|
|
|
17
17
|
* - **Light** is daylight and paper. Things at depth lose CONTRAST and gain
|
|
18
18
|
* haze — real atmospheric perspective — and separation comes from soft cast
|
|
19
19
|
* shadow, the way objects on a desk separate. Inverting the dark scheme
|
|
20
|
-
* would give
|
|
20
|
+
* would give gray-on-gray mush, because glow does not exist in daylight.
|
|
21
21
|
*
|
|
22
|
-
* One rule holds across both: **secondary text is a
|
|
22
|
+
* One rule holds across both: **secondary text is a color, never an
|
|
23
23
|
* opacity.** Opacity composites against whatever is behind and fails contrast
|
|
24
24
|
* silently. `checkContrast` measures every pair on both, and axe-core checks
|
|
25
25
|
* the rendered result on every run of the a11y harness.
|