@reqvire-org/ads-guard 0.5.0 → 0.5.2

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 CHANGED
@@ -75,6 +75,7 @@ files are never checked. The report counts them.
75
75
  | Code | Meaning | What to do |
76
76
  | --- | --- | --- |
77
77
  | `design-usage/local-markup` | An element or a local component that is not imported from the design system. | Render a design-system owner. An arrangement the screen needs is a pattern of the design system. |
78
+ | `design-usage/prose-element-undeclared` | A plain element inside a prose owner (long-form content) that the owner's recipe does not declare. | Declare the element in the design system's prose recipe, or write the content with the elements it declares. |
78
79
  | `design-usage/component-outside-pattern` | A component of the design system rendered outside every pattern. | A pattern arranges the screen; a component fills a pattern, as its child or in a slot prop. |
79
80
  | `design-usage/design-prop` | `style`, `className`, `css` or `dangerouslySetInnerHTML`. | Choose the treatment through the owner's own props. |
80
81
  | `design-usage/spread-props` | A JSX spread. | Pass each prop explicitly. |
@@ -131,3 +132,16 @@ await closeDesignUsage(); // releases the parser
131
132
 
132
133
  `checkDesignUsage(sources, entry, allowance)` checks texts you supply;
133
134
  `designSystemEntry(specifier, entryFile)` reads which exports are patterns.
135
+
136
+ ## Long-form content
137
+
138
+ A design system can export prose owners: components whose content is plain flow
139
+ markup (`<p>`, `<h2>`, `<a>`, lists, quotes, tables). Inside one, that markup is
140
+ content, not markup of your own, and the guard accepts it. The guard learns the
141
+ prose owners from `ads-prose.json`, which `ads emit` writes beside the design
142
+ system's entry; with an entry that has no such file, plain markup is reported
143
+ as `local-markup` everywhere.
144
+
145
+ Content that arrives as an HTML string is passed to a component of the design
146
+ system that takes it as a prop (such as the starter's `ProseHtml`); injecting it
147
+ in application source is `design-usage/design-prop`. Sanitise the string first.
@@ -1,5 +1,5 @@
1
1
  // src/design-usage.mts
2
- import { readFileSync as readFileSync2 } from "node:fs";
2
+ import { existsSync as existsSync2, readFileSync as readFileSync2 } from "node:fs";
3
3
  import path2 from "node:path";
4
4
  import { isExportDeclaration, isNamedExports, isStringLiteral as isStringLiteral2 } from "typescript/ast";
5
5
 
@@ -26,6 +26,68 @@ import {
26
26
  isStringLiteral,
27
27
  isVariableDeclaration
28
28
  } from "typescript/ast";
29
+
30
+ // src/prose-model.mts
31
+ var PROSE_ELEMENTS = {
32
+ paragraph: ["p"],
33
+ heading1: ["h1"],
34
+ heading2: ["h2"],
35
+ heading3: ["h3"],
36
+ heading4: ["h4"],
37
+ heading5: ["h5"],
38
+ heading6: ["h6"],
39
+ list: ["ul", "ol"],
40
+ item: ["li"],
41
+ quote: ["blockquote"],
42
+ rule: ["hr"],
43
+ pre: ["pre"],
44
+ table: ["table"],
45
+ headerCell: ["th"],
46
+ cell: ["td"],
47
+ figure: ["figure"],
48
+ caption: ["figcaption"],
49
+ media: ["img", "video", "iframe"],
50
+ descriptions: ["dl"],
51
+ term: ["dt"],
52
+ definition: ["dd"],
53
+ link: ["a"],
54
+ strong: ["strong", "b"],
55
+ emphasis: ["em", "i"],
56
+ deleted: ["del", "s"],
57
+ code: ["code"],
58
+ sub: ["sub"],
59
+ sup: ["sup"],
60
+ kbd: ["kbd"],
61
+ mark: ["mark"]
62
+ };
63
+ var PROSE_ELEMENT_NAMES = Object.keys(PROSE_ELEMENTS);
64
+ var PROSE_TAGS = new Map(PROSE_ELEMENT_NAMES.flatMap((name) => PROSE_ELEMENTS[name].map((tag) => [tag, name])));
65
+ var PROSE_STRUCTURE = new Map([
66
+ ["thead", "table"],
67
+ ["tbody", "table"],
68
+ ["tfoot", "table"],
69
+ ["tr", "table"],
70
+ ["br", null]
71
+ ]);
72
+ var isProseTag = (tag) => PROSE_TAGS.has(tag) || PROSE_STRUCTURE.has(tag);
73
+ var PROSE_MANIFEST = "ads-prose.json";
74
+ function parseProseManifest(text) {
75
+ const owners = new Map;
76
+ let value;
77
+ try {
78
+ value = JSON.parse(text);
79
+ } catch {
80
+ return owners;
81
+ }
82
+ if (typeof value !== "object" || value === null || Array.isArray(value))
83
+ return owners;
84
+ for (const [name, tags] of Object.entries(value))
85
+ if (Array.isArray(tags))
86
+ owners.set(name, new Set(tags.filter((tag) => typeof tag === "string" && isProseTag(tag))));
87
+ return owners;
88
+ }
89
+
90
+ // src/analysis/design-usage.mts
29
91
  function walk(node, visit) {
30
92
  visit(node);
31
93
  node.forEachChild((child) => walk(child, visit));
@@ -99,7 +161,7 @@ function isMetadata(node) {
99
161
  return true;
100
162
  return !node.attributes.properties.some((attribute) => isJsxAttribute(attribute) && attribute.name.getText() === "rel" && attribute.initializer !== undefined && /stylesheet/.test(attribute.initializer.getText()));
101
163
  }
102
- function designUsageProblems(source, { publicEntry, patterns }, allowance = {}) {
164
+ function designUsageProblems(source, { publicEntry, patterns, prose = new Map }, allowance = {}) {
103
165
  const problems = [];
104
166
  const { names, namespaces } = designSystemImports(source, publicEntry);
105
167
  const allowed = allowedImports(source, allowance.components ?? new Map);
@@ -116,14 +178,32 @@ function designUsageProblems(source, { publicEntry, patterns }, allowance = {})
116
178
  }
117
179
  return false;
118
180
  };
181
+ const proseOwner = (node) => {
182
+ for (let current = node.parent;current !== undefined; current = current.parent) {
183
+ if (!isJsxElement(current) || current.openingElement === node)
184
+ continue;
185
+ const tag = current.openingElement.tagName;
186
+ if (isIdentifier(tag) && isProseTag(tag.text))
187
+ continue;
188
+ const name = exportedName(tag);
189
+ const tags = name === undefined ? undefined : prose.get(name);
190
+ return name === undefined || tags === undefined ? undefined : { name, tags };
191
+ }
192
+ return;
193
+ };
119
194
  for (const statement of source.statements)
120
195
  if (isImportDeclaration(statement) && isStringLiteral(statement.moduleSpecifier) && statement.importClause?.phaseModifier !== SyntaxKind.TypeKeyword && authorsDesign(statement.moduleSpecifier.text))
121
196
  problems.push({ node: statement.moduleSpecifier, problem: { kind: "design-import", specifier: statement.moduleSpecifier.text } });
122
197
  walk(source, (node) => {
123
198
  if (isJsxOpeningElement(node) || isJsxSelfClosingElement(node)) {
124
- if (isAllowed(node.tagName)) {} else if (!fromDesignSystem(node.tagName))
125
- problems.push({ node, problem: { kind: "local-markup", tag: node.tagName.getText() } });
126
- else if (!isPattern(node.tagName) && !insidePattern(node) && inScreenFunction(node))
199
+ if (isAllowed(node.tagName)) {} else if (!fromDesignSystem(node.tagName)) {
200
+ const tag = node.tagName.getText();
201
+ const owner = isIdentifier(node.tagName) && isProseTag(tag) ? proseOwner(node) : undefined;
202
+ if (owner === undefined)
203
+ problems.push({ node, problem: { kind: "local-markup", tag } });
204
+ else if (!owner.tags.has(tag))
205
+ problems.push({ node, problem: { kind: "prose-element-undeclared", tag, owner: owner.name } });
206
+ } else if (!isPattern(node.tagName) && !insidePattern(node) && inScreenFunction(node))
127
207
  problems.push({ node, problem: { kind: "component-outside-pattern", name: exportedName(node.tagName) ?? node.tagName.getText() } });
128
208
  for (const attribute of node.attributes.properties) {
129
209
  if (isJsxSpreadAttribute(attribute))
@@ -328,6 +408,10 @@ var wording = {
328
408
  "Render it inside the pattern that arranges this screen (as its child or in a slot prop); if no pattern does, add one to the design system."
329
409
  ],
330
410
  "local-markup": (problem) => [`<${problem.tag}> is not imported from the design system.`, "Render a design-system owner; an arrangement or element the screen needs belongs in a pattern of the design system."],
411
+ "prose-element-undeclared": (problem) => [
412
+ `<${problem.tag}> is content of ${problem.owner}, whose recipe declares no such element: it is drawn without a design.`,
413
+ `Declare the element in the prose recipe of ${problem.owner} (\`elements\`), or write the content with the elements it declares.`
414
+ ],
331
415
  "spread-props": () => ["A spread passes props nothing can see.", "Pass each prop explicitly."],
332
416
  "design-prop": (problem) => [`${problem.attribute} supplies design from outside the design system.`, "Remove it; choose the treatment through the owner's own props."],
333
417
  "imperative-design": (problem) => [`${problem.member} writes styles or creates DOM by hand.`, "Remove the write; render design-system owners with props."],
@@ -364,12 +448,14 @@ async function designSystemEntry2(publicEntry, entryFile) {
364
448
  patterns.add(element.name.text);
365
449
  }
366
450
  }
367
- return { publicEntry, patterns };
451
+ const manifest = path2.join(path2.dirname(path2.resolve(entryFile)), PROSE_MANIFEST);
452
+ const prose = existsSync2(manifest) ? parseProseManifest(readFileSync2(manifest, "utf8")) : new Map;
453
+ return { publicEntry, patterns, prose };
368
454
  }
369
455
  var closeDesignUsage2 = () => closeSyntax();
370
456
 
371
457
  // src/guard/config.mts
372
- import { existsSync as existsSync2, readFileSync as readFileSync3, statSync } from "node:fs";
458
+ import { existsSync as existsSync3, readFileSync as readFileSync3, statSync } from "node:fs";
373
459
  import path3 from "node:path";
374
460
 
375
461
  // src/result.mts
@@ -389,7 +475,7 @@ var insideRoot = (root, relative) => {
389
475
  };
390
476
  function readGuardConfig2(root) {
391
477
  const file = path3.join(root, GUARD_CONFIG_FILE2);
392
- if (!existsSync2(file))
478
+ if (!existsSync3(file))
393
479
  return err([`${GUARD_CONFIG_FILE2} is missing in ${root}. Create it with "designSystem" and "include".`]);
394
480
  let value;
395
481
  try {
@@ -406,13 +492,13 @@ function readGuardConfig2(root) {
406
492
  const { designSystem, entry, include, exclude = [], allow = {} } = value;
407
493
  if (typeof designSystem !== "string" || designSystem.trim() === "")
408
494
  problems.push('"designSystem" is the specifier the application imports the design system by, such as "@acme/design".');
409
- if (entry !== undefined && (typeof entry !== "string" || !insideRoot(root, entry) || !existsSync2(path3.resolve(root, entry))))
495
+ if (entry !== undefined && (typeof entry !== "string" || !insideRoot(root, entry) || !existsSync3(path3.resolve(root, entry))))
410
496
  problems.push(`"entry" is the path of the design system's public entry file, relative to this file. It does not exist.`);
411
497
  if (!isStrings(include) || include.length === 0)
412
498
  problems.push(`"include" lists the folders with the application's sources, such as ["src"].`);
413
499
  else
414
500
  for (const folder of include)
415
- if (!insideRoot(root, folder) || !existsSync2(path3.resolve(root, folder)) || !statSync(path3.resolve(root, folder)).isDirectory())
501
+ if (!insideRoot(root, folder) || !existsSync3(path3.resolve(root, folder)) || !statSync(path3.resolve(root, folder)).isDirectory())
416
502
  problems.push(`"include" names ${folder}, which is not a folder under this file. Wildcards are not supported.`);
417
503
  if (!isStrings(exclude))
418
504
  problems.push('"exclude" lists folders and files, such as ["src/generated"].');
@@ -420,7 +506,7 @@ function readGuardConfig2(root) {
420
506
  for (const item of exclude) {
421
507
  const resolved = path3.resolve(root, item);
422
508
  const within = include.some((folder) => resolved.startsWith(path3.resolve(root, folder) + path3.sep));
423
- if (!insideRoot(root, item) || !existsSync2(resolved))
509
+ if (!insideRoot(root, item) || !existsSync3(resolved))
424
510
  problems.push(`"exclude" names ${item}, which does not exist. Remove it. Wildcards are not supported.`);
425
511
  else if (!within)
426
512
  problems.push(`"exclude" names ${item}, which is not under any "include" folder. Remove it.`);
@@ -449,7 +535,7 @@ function readGuardConfig2(root) {
449
535
  }
450
536
 
451
537
  // src/guard/run.mts
452
- import { existsSync as existsSync3, readFileSync as readFileSync4 } from "node:fs";
538
+ import { existsSync as existsSync4, readFileSync as readFileSync4 } from "node:fs";
453
539
  import { createRequire } from "node:module";
454
540
  import path5 from "node:path";
455
541
 
@@ -502,7 +588,7 @@ function entryFile(root, config) {
502
588
  const specifier = config.designSystem;
503
589
  if (specifier.startsWith(".")) {
504
590
  const target = path5.resolve(root, specifier);
505
- const found = [target, ...ENTRY_NAMES.map((name) => path5.join(target, name))].find((candidate) => existsSync3(candidate) && /\.[cm]?[jt]sx?$/.test(candidate));
591
+ const found = [target, ...ENTRY_NAMES.map((name) => path5.join(target, name))].find((candidate) => existsSync4(candidate) && /\.[cm]?[jt]sx?$/.test(candidate));
506
592
  return found === undefined ? err(`"designSystem" is ${specifier}, and no entry file is at ${target}.`) : ok(found);
507
593
  }
508
594
  try {
package/dist/cli.mjs CHANGED
@@ -4,7 +4,7 @@ import {
4
4
  GUARD_CONFIG_FILE2,
5
5
  runGuard2,
6
6
  guardText2
7
- } from "./chunk-mfayhtn4.mjs";
7
+ } from "./chunk-8g49j1kb.mjs";
8
8
 
9
9
  // src/guard/cli.mts
10
10
  var HELP = `ads-guard [directory] [--json]
package/dist/index.mjs CHANGED
@@ -6,7 +6,7 @@ import {
6
6
  readGuardConfig2,
7
7
  runGuard2,
8
8
  guardText2
9
- } from "./chunk-mfayhtn4.mjs";
9
+ } from "./chunk-8g49j1kb.mjs";
10
10
  export {
11
11
  GUARD_CONFIG_FILE2 as GUARD_CONFIG_FILE,
12
12
  checkDesignUsage2 as checkDesignUsage,
@@ -22,6 +22,8 @@ export interface AnalysisProviders {
22
22
  readonly resolveModuleDetails?: (specifier: string, file: string, options: ProgramOptions) => Promise<ResolvedModule | null>;
23
23
  /** The captured revision: owner of revision-lifetime facts. */
24
24
  readonly revision?: object;
25
+ /** Aborted when the request is canceled: long analyses stop at their next `throwIfCancelled`. */
26
+ readonly signal?: AbortSignal;
25
27
  /** Identity of the revision's inputs outside its captured files (installed dependencies); absent when unknown. */
26
28
  readonly environment?: () => string;
27
29
  /**
@@ -41,6 +43,29 @@ export interface AnalysisContext extends AnalysisProviders {
41
43
  export declare function runAnalysis<T>(root: string, run: (context: AnalysisContext) => T, providers?: AnalysisProviders): T;
42
44
  export declare function currentAnalysis(): AnalysisContext | undefined;
43
45
  /** Share pure project discovery during one fenced analysis operation. */
46
+ /** The error a canceled analysis stops with (the code callers recognise as cancellation). */
47
+ export declare class AnalysisCancelled extends Error {
48
+ readonly code = "ADS_CANCELLED";
49
+ readonly diagnostic: {
50
+ readonly rule: "mutation-cancelled";
51
+ readonly message: "Analysis cancelled.";
52
+ };
53
+ constructor();
54
+ }
55
+ /**
56
+ * Stops a canceled analysis: throws when `signal` (by default the current analysis's) is aborted. Called between
57
+ * units of work (an owner, a choice, a scenario, a file, a construction), so cancellation does not wait for the
58
+ * request to finish. Caches never store the exception (they keep settled outcomes only).
59
+ */
60
+ export declare function throwIfCancelled(signal?: AbortSignal | undefined): void;
61
+ /**
62
+ * A file's text in the captured revision: `{ text }` (`null` when the revision has no such file) inside a
63
+ * revision-scoped analysis whose root holds the file, else `undefined` (the caller reads its own live files).
64
+ * Dependencies below `node_modules` are not captured text.
65
+ */
66
+ export declare function revisionText(file: string): {
67
+ readonly text: string | null;
68
+ } | undefined;
44
69
  export declare function memoFact<T>(owner: object, key: string, compute: () => T): T;
45
70
  /** Pure facts may live as long as their immutable program/tree or captured view, never by path alone. */
46
71
  export declare function memoProgram<T>(program: object, key: string, compute: () => T): T;
@@ -15,6 +15,12 @@ export type DesignUsageProblem =
15
15
  readonly kind: "local-markup";
16
16
  readonly tag: string;
17
17
  }
18
+ /** A plain element inside a prose owner that the owner's recipe does not declare: it would be drawn undesigned. */
19
+ | {
20
+ readonly kind: "prose-element-undeclared";
21
+ readonly tag: string;
22
+ readonly owner: string;
23
+ }
18
24
  /** A JSX spread: props nothing can see. */
19
25
  | {
20
26
  readonly kind: "spread-props";
@@ -44,6 +50,11 @@ export interface DesignSystemEntry {
44
50
  readonly publicEntry: string;
45
51
  /** The exported names that are patterns: what arranges a screen. Every other export is a component, which fills a pattern. */
46
52
  readonly patterns: ReadonlySet<string>;
53
+ /**
54
+ * The exported names that are prose owners (long-form content), each with the plain tags its recipe
55
+ * declares. Plain flow markup inside one is its content, not markup of the file's own.
56
+ */
57
+ readonly prose?: ReadonlyMap<string, ReadonlySet<string>>;
47
58
  }
48
59
  /** What a source package may use beside the design system. A design system's mocks use none of it. */
49
60
  export interface DesignUsageAllowance {
@@ -58,4 +69,4 @@ export interface DesignUsageAllowance {
58
69
  readonly metadata?: boolean;
59
70
  }
60
71
  /** Every design-use problem of `source`, in source order. */
61
- export declare function designUsageProblems(source: SourceFile, { publicEntry, patterns }: DesignSystemEntry, allowance?: DesignUsageAllowance): readonly DesignUsage[];
72
+ export declare function designUsageProblems(source: SourceFile, { publicEntry, patterns, prose }: DesignSystemEntry, allowance?: DesignUsageAllowance): readonly DesignUsage[];
@@ -9,6 +9,26 @@ export declare function closeSyntax(): Promise<void>;
9
9
  export declare function parseSource(file: string, text: string, scriptKind?: ScriptKind): Promise<SourceFile>;
10
10
  /** Reads configuration `text` as if it were a file beside `file`, without writing it. */
11
11
  export declare function parseConfigText(file: string, text: string): Promise<ReadConfigFileResponse>;
12
+ /** A TypeScript configuration's compiler options, and what kept it (or a configuration it extends) from parsing. */
13
+ export interface ConfigurationRead {
14
+ readonly options: ParsedCommandLine["options"];
15
+ /** Each problem with the configuration file it concerns (`file` itself or an `extends` target). */
16
+ readonly problems: readonly {
17
+ readonly file: string;
18
+ readonly message: string;
19
+ }[];
20
+ }
21
+ /**
22
+ * The compiler options of the configuration `file` as `read` gives it (a captured revision's bytes; `null`: the
23
+ * file is absent), with what kept any configuration from parsing. Every `extends` target named by a path (relative
24
+ * or absolute) is read through `read` too, never by the native parser from disk: a readable one is served under a
25
+ * virtual name beside it (so its own relative paths resolve as they do on disk), an absent one under a virtual
26
+ * name that does not exist, and an unparsable one as an empty configuration; each is reported here, by its
27
+ * authored name, as is a circular chain or one longer than `MAX_EXTENDS_DEPTH`. Nothing of the chain is left for
28
+ * TypeScript to read from disk. A package configuration is an installed dependency and is read from it. Nothing
29
+ * is written.
30
+ */
31
+ export declare function parseCompilerOptionsFrom(file: string, read: (file: string) => string | null): Promise<ConfigurationRead>;
12
32
  export declare const readConfig: (file: string) => Promise<ReadConfigFileResponse>;
13
33
  export declare const parseConfig: (config: unknown, directory: string) => Promise<ParsedCommandLine>;
14
34
  export declare const parseCompilerOptions: (config: Readonly<Record<string, unknown>>, directory: string) => Promise<ParsedCommandLine>;
@@ -0,0 +1,81 @@
1
+ /** A prose element's name in a recipe, with the tags it selects. */
2
+ export declare const PROSE_ELEMENTS: {
3
+ readonly paragraph: readonly ["p"];
4
+ readonly heading1: readonly ["h1"];
5
+ readonly heading2: readonly ["h2"];
6
+ readonly heading3: readonly ["h3"];
7
+ readonly heading4: readonly ["h4"];
8
+ readonly heading5: readonly ["h5"];
9
+ readonly heading6: readonly ["h6"];
10
+ readonly list: readonly ["ul", "ol"];
11
+ readonly item: readonly ["li"];
12
+ readonly quote: readonly ["blockquote"];
13
+ readonly rule: readonly ["hr"];
14
+ readonly pre: readonly ["pre"];
15
+ readonly table: readonly ["table"];
16
+ readonly headerCell: readonly ["th"];
17
+ readonly cell: readonly ["td"];
18
+ readonly figure: readonly ["figure"];
19
+ readonly caption: readonly ["figcaption"];
20
+ readonly media: readonly ["img", "video", "iframe"];
21
+ readonly descriptions: readonly ["dl"];
22
+ readonly term: readonly ["dt"];
23
+ readonly definition: readonly ["dd"];
24
+ readonly link: readonly ["a"];
25
+ readonly strong: readonly ["strong", "b"];
26
+ readonly emphasis: readonly ["em", "i"];
27
+ readonly deleted: readonly ["del", "s"];
28
+ readonly code: readonly ["code"];
29
+ readonly sub: readonly ["sub"];
30
+ readonly sup: readonly ["sup"];
31
+ readonly kbd: readonly ["kbd"];
32
+ readonly mark: readonly ["mark"];
33
+ };
34
+ export type ProseElementName = keyof typeof PROSE_ELEMENTS;
35
+ export declare const PROSE_ELEMENT_NAMES: readonly ProseElementName[];
36
+ /** Every tag prose styles, with the element it belongs to. */
37
+ export declare const PROSE_TAGS: ReadonlyMap<string, ProseElementName>;
38
+ /**
39
+ * Tags that carry no design of their own but are part of content: a table's row groups and rows belong
40
+ * to its `table` element, and a line break belongs to any prose. The markup checks accept them as
41
+ * content; no rule is written for them.
42
+ */
43
+ export declare const PROSE_STRUCTURE: ReadonlyMap<string, ProseElementName | null>;
44
+ /** Whether a tag can be content of a prose owner: a styled tag or a structural one. */
45
+ export declare const isProseTag: (tag: string) => boolean;
46
+ /** The content tags a recipe that declares `names` accepts: their own tags, and the structure that comes with them. */
47
+ export declare function proseContentTags(names: Iterable<ProseElementName>): ReadonlySet<string>;
48
+ /** Elements that stand as blocks in the flow: they take the rhythm before them. */
49
+ export declare const PROSE_BLOCKS: readonly ProseElementName[];
50
+ /** The elements whose text can sit directly inside `container`: what its background must carry. */
51
+ export declare function proseContents(container: ProseElementName): readonly ProseElementName[];
52
+ /** The selector of one tag inside the prose root: plain markup only. */
53
+ export declare const proseSelector: (tag: string) => string;
54
+ /** `&:hover` on an element's selector: the state is the element's own. */
55
+ export declare const proseState: (selector: string, condition: string) => string;
56
+ /** The first plain element of the root and of a plain container: its start margin is cancelled. */
57
+ export declare const PROSE_FIRST: readonly string[];
58
+ /**
59
+ * A component placed directly in the prose root (it has a class) is a block of the flow like any
60
+ * other: it takes the rhythm before it, unless it comes first. Space between siblings is the
61
+ * container's to give; the component's own design is untouched. A component inside a paragraph or
62
+ * another plain element is inline content and is left alone.
63
+ */
64
+ export declare const PROSE_COMPONENT = "& > :not(:first-child)[class]";
65
+ type Values = Readonly<Record<string, string>>;
66
+ /**
67
+ * The browser defaults ADS replaces on an element, whatever the recipe declares for it: margins
68
+ * (the rhythm owns the space between blocks), a quote's and a figure's indent, a rule's inset border,
69
+ * media wider than its column, a table's doubled borders.
70
+ */
71
+ export declare function proseDefaults(name: ProseElementName): Values;
72
+ /**
73
+ * The emitted record of a design system's prose owners, beside its public entry: exported name → the
74
+ * plain tags its recipe declares. The design-use check of application source reads it, because an
75
+ * emitted owner no longer carries its recipe.
76
+ */
77
+ export declare const PROSE_MANIFEST = "ads-prose.json";
78
+ export declare const proseManifestText: (owners: ReadonlyMap<string, ReadonlySet<string>>) => string;
79
+ /** The owners a manifest text records; entries that are not a list of prose tags are dropped. */
80
+ export declare function parseProseManifest(text: string): ReadonlyMap<string, ReadonlySet<string>>;
81
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reqvire-org/ads-guard",
3
- "version": "0.5.0",
3
+ "version": "0.5.2",
4
4
  "description": "Confirms that an application's source does no design of its own and uses its ADS design system only.",
5
5
  "repository": {
6
6
  "type": "git",