pattern-dump 0.1.0-alpha.0 → 0.1.0-alpha.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/CHANGELOG.md +60 -0
- package/README.md +14 -1
- package/dist/chunks/chunk-3WZHFYHZ.js +160 -0
- package/dist/dev-ui/main.css +38 -7
- package/dist/dev-ui/main.js +339 -80
- package/dist/index.js +3 -4
- package/dist/pd.js +588 -381
- package/dist/types/config/index.d.ts +19 -12
- package/dist/types/config/validate.d.ts +10 -0
- package/dist/types/contracts/dev-protocol.d.ts +26 -13
- package/package.json +3 -2
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import type { ShellBrandConfig, SwatchSlots, ThemeSwitch } from "../contracts/index.js";
|
|
2
2
|
export type { ShellBrandConfig, SwatchSlots, ThemeSwitch };
|
|
3
|
+
export { ConfigError, configProblems, validateConfig } from "./validate.js";
|
|
3
4
|
export interface AssetsConfig {
|
|
4
|
-
/** 'central' (default
|
|
5
|
+
/** Where assets live. Only 'central' (the default: one assets dir, served at /assets/) is supported
|
|
6
|
+
* so far; 'component-relative' is reserved, and the config check rejects it as not supported yet. */
|
|
5
7
|
strategy?: "central" | "component-relative";
|
|
6
8
|
/**
|
|
7
9
|
* Asset directory (relative to project root), served at /assets/. Accepts an ARRAY of roots —
|
|
@@ -11,12 +13,14 @@ export interface AssetsConfig {
|
|
|
11
13
|
* normalized to `/assets/…` by matching a root basename — depth-independent.
|
|
12
14
|
*/
|
|
13
15
|
dir?: string | string[];
|
|
14
|
-
/**
|
|
16
|
+
/** Stylesheets to link in every preview document, before component CSS: a path relative to the
|
|
17
|
+
* assets dir, or a full URL (e.g. a web-font stylesheet), which is linked as it is. */
|
|
15
18
|
css?: string[];
|
|
16
19
|
}
|
|
17
20
|
export interface StylesConfig {
|
|
18
|
-
/** 'parallel' (default
|
|
19
|
-
|
|
21
|
+
/** Where styles live. Only 'parallel' (the default: a separate tree mirroring the patterns) is
|
|
22
|
+
* supported so far; 'co-located' is reserved, and the config check rejects it as not supported yet. */
|
|
23
|
+
strategy?: "parallel" | "co-located";
|
|
20
24
|
/** Source tree root; also the home for global/base/theme styles. */
|
|
21
25
|
dir: string;
|
|
22
26
|
/**
|
|
@@ -102,15 +106,18 @@ export interface PatternDumpConfig {
|
|
|
102
106
|
helpers?: string;
|
|
103
107
|
/**
|
|
104
108
|
* The always-injected document-base layer (M5-CSS-EXTERNAL §2.2: a preview links
|
|
105
|
-
* closure + base + active theme). Names
|
|
106
|
-
* ['base/reset', 'base/root', 'base/font.base'] — relative to `styles.dir
|
|
109
|
+
* closure + base + active theme). Names file or folder paths — e.g.
|
|
110
|
+
* ['base/reset', 'base/root', 'base/font.base'] — relative to `styles.dir`; `"."` is the whole tree.
|
|
107
111
|
*
|
|
108
|
-
* When present and non-empty, PD links the compiled base layer (`/_pd/base.css
|
|
109
|
-
*
|
|
110
|
-
*
|
|
111
|
-
*
|
|
112
|
-
*
|
|
113
|
-
*
|
|
112
|
+
* When present and non-empty, PD links the compiled base layer (`/_pd/base.css`) into every
|
|
113
|
+
* preview, BENEATH the component closure so it never overrides it. The layer holds:
|
|
114
|
+
* - every rule from a LISTED path, even one whose file belongs to a component (a component's
|
|
115
|
+
* `body` rule needed on every page, or a whole PatternLab stylesheet with `"."`);
|
|
116
|
+
* - the origin-unattributed rules — `:root`, `@font-face`, family-level classes with no single
|
|
117
|
+
* owning component — listed or not, so shared partials stay available.
|
|
118
|
+
* Entries that match no file are reported at startup. Absent → not linked (a project whose classes
|
|
119
|
+
* all attribute to components needs no shared layer). Class ownership is unchanged by listing: a
|
|
120
|
+
* class still belongs to the component whose file authored it.
|
|
114
121
|
*/
|
|
115
122
|
documentBase?: string[];
|
|
116
123
|
/**
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { PatternDumpConfig } from "./index.js";
|
|
2
|
+
/** A config that cannot be used, with a message written for the person editing it. The CLI prints
|
|
3
|
+
* its message alone, without a stack trace. */
|
|
4
|
+
export declare class ConfigError extends Error {
|
|
5
|
+
name: string;
|
|
6
|
+
}
|
|
7
|
+
/** The problems with a loaded config, one line each; empty when it is valid. */
|
|
8
|
+
export declare function configProblems(raw: unknown): string[];
|
|
9
|
+
/** Check a loaded config and return it typed, or throw one error listing every problem. */
|
|
10
|
+
export declare function validateConfig(raw: unknown, source: string): PatternDumpConfig;
|
|
@@ -4,12 +4,13 @@ export type ComponentId = string;
|
|
|
4
4
|
export type Category = string;
|
|
5
5
|
export type ComponentStatus = "draft" | "stable" | "deprecated";
|
|
6
6
|
/**
|
|
7
|
-
* Preview layout mode (M4.2). How the component sits in the stage
|
|
8
|
-
*
|
|
9
|
-
* - "
|
|
7
|
+
* Preview layout mode (M4.2). How the component sits in the stage. The preview document is the same
|
|
8
|
+
* in both — the markup directly in <body>, no wrapper — only the frame around it differs:
|
|
9
|
+
* - "centered": the frame is sized to what the content needs (pd-width, measured at the full width
|
|
10
|
+
* available) and to its height (pd-height), and the stage centres it (atoms/molecules/organisms)
|
|
11
|
+
* - "full": the frame fills the stage width AND height, top-aligned (pages/templates)
|
|
10
12
|
* This is the RESOLVED mode (category default ← category index.md frontmatter ← component override),
|
|
11
|
-
* so the shell renders directly without re-deriving precedence.
|
|
12
|
-
* for centered mode only (full mode fills).
|
|
13
|
+
* so the shell renders directly without re-deriving precedence.
|
|
13
14
|
*/
|
|
14
15
|
export type LayoutMode = "centered" | "full";
|
|
15
16
|
/** A named data set applied over defaults — a state or a documentation example. */
|
|
@@ -164,10 +165,22 @@ export interface DiagnosticsGraph {
|
|
|
164
165
|
/** The subject's commit SHA when it has one (pinned in the report). */
|
|
165
166
|
subjectSha?: string;
|
|
166
167
|
}
|
|
167
|
-
/**
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
168
|
+
/** One line of the audit scope: a named area and what it means. */
|
|
169
|
+
export interface AuditScopeItem {
|
|
170
|
+
name: string;
|
|
171
|
+
detail: string;
|
|
172
|
+
}
|
|
173
|
+
/** What the corpus audit checks and what it deliberately leaves out. Carried with every audit result
|
|
174
|
+
* (every `pd audit` format and the workbench's Audit tab), because a defect count is only meaningful
|
|
175
|
+
* next to its limits. Data, not formatted text: each renderer (Markdown, plain text, JSON, the
|
|
176
|
+
* workbench's DOM) formats it for its own medium. */
|
|
177
|
+
export interface AuditScope {
|
|
178
|
+
covered: AuditScopeItem[];
|
|
179
|
+
notCovered: AuditScopeItem[];
|
|
180
|
+
/** The closing statement on what zero findings means. */
|
|
181
|
+
note: string;
|
|
182
|
+
}
|
|
183
|
+
export declare const AUDIT_SCOPE: AuditScope;
|
|
171
184
|
/** Per-rule roll-up: blast radius (distinct components) primary, occurrences secondary. */
|
|
172
185
|
export interface AuditRuleRollup {
|
|
173
186
|
engine: string;
|
|
@@ -190,8 +203,8 @@ export interface AuditComponentRollup {
|
|
|
190
203
|
/** The `pd audit` report as structured data — the single rollup every output format serializes.
|
|
191
204
|
* All roll-ups (headline numbers, rule blast-radius table, per-component list) are computed ONCE in
|
|
192
205
|
* `buildAuditRollup`; `md`/`text`/`json` (and the workbench facet) are renderers over this object,
|
|
193
|
-
* never independent string builders. A CI consumer reading the `json` gets `scope` (the
|
|
194
|
-
*
|
|
206
|
+
* never independent string builders. A CI consumer reading the `json` gets `scope` (what the audit covers)
|
|
207
|
+
* and `headline` alongside the count, never a bare number. */
|
|
195
208
|
export interface AuditRollup {
|
|
196
209
|
subjectSha?: string;
|
|
197
210
|
/** The headline sentence, plain (no markdown emphasis); renderers wrap/position it. */
|
|
@@ -209,8 +222,8 @@ export interface AuditRollup {
|
|
|
209
222
|
};
|
|
210
223
|
rulesByBlast: AuditRuleRollup[];
|
|
211
224
|
perComponent: AuditComponentRollup[];
|
|
212
|
-
/**
|
|
213
|
-
scope:
|
|
225
|
+
/** What the audit covers and leaves out (AUDIT_SCOPE). Carried in every format. */
|
|
226
|
+
scope: AuditScope;
|
|
214
227
|
}
|
|
215
228
|
/** Build the structured rollup from the graph — the numbers exist as data here, not only as strings.
|
|
216
229
|
* PURE: same graph → same rollup, no I/O or clock. The one builder both the CLI report renderers and
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pattern-dump",
|
|
3
|
-
"version": "0.1.0-alpha.
|
|
3
|
+
"version": "0.1.0-alpha.2",
|
|
4
4
|
"description": "A workbench for HTML and CSS design systems: live component previews, docs, checks and static publishing.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"design-system",
|
|
@@ -50,7 +50,8 @@
|
|
|
50
50
|
"dist",
|
|
51
51
|
"templates",
|
|
52
52
|
"README.md",
|
|
53
|
-
"LICENSE"
|
|
53
|
+
"LICENSE",
|
|
54
|
+
"CHANGELOG.md"
|
|
54
55
|
],
|
|
55
56
|
"engines": {
|
|
56
57
|
"node": ">=20.10"
|