@cssdoc/core 0.1.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Danny Wahl
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,100 @@
1
+ # @cssdoc/core
2
+
3
+ TSDoc, for CSS. A small, framework-agnostic documentation extractor: parse a doc-comment grammar plus
4
+ the CSS AST into a serializable model, then build whatever emitter you like on top (markdown, JSON, a
5
+ component gallery) — the way `typedoc-plugin-markdown` builds on TypeDoc's reflections.
6
+
7
+ There's no modern, maintained "TypeDoc for plain CSS" (CSSdoc is abandoned, KSS-node is dated, SassDoc
8
+ is Sass-only). This is the missing core: it reads structured comments and derives the machine facts from
9
+ the actual selectors, so the docs can't drift from the shipping CSS.
10
+
11
+ ## Install
12
+
13
+ ```sh
14
+ npm i -D @cssdoc/core
15
+ ```
16
+
17
+ ## Usage
18
+
19
+ ```ts
20
+ import { parseCssDocs, toJson } from "@cssdoc/core";
21
+ import { readFileSync } from "node:fs";
22
+
23
+ const model = parseCssDocs(readFileSync("dist/components.css", "utf8"));
24
+ writeFileSync("css-docs.json", toJson(model));
25
+ ```
26
+
27
+ `parseCssDocs(css)` returns one `CssDocEntry` per record. It is **AST-first** — modifiers, sub-element
28
+ parts, consumed and declared custom properties, and deprecated-alias links are extracted from the
29
+ selectors, so they never drift. Authored doc comments supply only prose (summaries, descriptions) and
30
+ delimit one component from the next.
31
+
32
+ ## The doc-comment grammar
33
+
34
+ A `/** … */` block above a component's rules. Records are delimited by `@component`/`@name`. The tag
35
+ vocabulary adopts the Custom Elements Manifest names (`@cssproperty`, `@csspart`, `@cssstate`) where
36
+ they exist, so it's standards-aligned:
37
+
38
+ ```css
39
+ /**
40
+ * @component button
41
+ * @summary An accessible action control.
42
+ * @modifier -color-secondary — A lower-emphasis action.
43
+ * @part .icon — A leading glyph.
44
+ * @cssproperty --ring <color> — The focus-ring colour.
45
+ * @deprecated Use the button utility instead.
46
+ * @demo self:button
47
+ */
48
+ .button {
49
+ /* … */
50
+ }
51
+ .button.-color-secondary {
52
+ /* … */
53
+ }
54
+ ```
55
+
56
+ | Tag | Meaning |
57
+ | ------------------------------------------ | --------------------------------------------------------------------------- |
58
+ | `@component` / `@name <id>` | Names the record (required; marks a boundary). |
59
+ | `@class <selector>` | An explicit base class (otherwise inferred from the first bare-class rule). |
60
+ | `@summary <text>` | One-line intro. |
61
+ | `@modifier -<x> — <desc>` | Prose for a modifier (the list itself is AST-derived). |
62
+ | `@part` / `@csspart .<x> — <desc>` | Prose for a sub-element part. |
63
+ | `@cssproperty --<x> [<syntax>] — <desc>` | A declared custom property. |
64
+ | `@cssstate <x> — <desc>` | A component state. |
65
+ | `@example`, `@deprecated`, `@demo`, `@see` | As in TSDoc. |
66
+
67
+ Unknown tags are ignored, so the grammar degrades gracefully.
68
+
69
+ ## Model
70
+
71
+ `parseCssDocs` returns `CssDocEntry[]`:
72
+
73
+ ```ts
74
+ interface CssDocEntry {
75
+ name: string;
76
+ className: string;
77
+ summary?: string;
78
+ modifiers: {
79
+ name: string;
80
+ prop: string;
81
+ value?: string;
82
+ description?: string;
83
+ deprecated?: { canonical: string };
84
+ }[];
85
+ parts: { name: string; description?: string }[];
86
+ cssPropertiesConsumed: string[];
87
+ cssPropertiesDeclared: { name: string; syntax?: string; description?: string }[];
88
+ examples: string[];
89
+ demo?: string;
90
+ deprecated?: string;
91
+ see: string[];
92
+ }
93
+ ```
94
+
95
+ Records default to splitting on `@component`/`@name`; pass `parseCssDocs(css, { isRecordBoundary })` to
96
+ delimit on something else (e.g. a per-component header comment).
97
+
98
+ ## License
99
+
100
+ MIT
@@ -0,0 +1,457 @@
1
+ //#region src/configuration.d.ts
2
+ /**
3
+ * The syntactic kind of a tag, mirroring TSDoc's Block/Modifier/Inline split, plus cssdoc's own
4
+ * `record` kind for the tags that open a documentation record (`@component`, `@utility`, …).
5
+ */
6
+ type CssDocSyntaxKind = "record" | "block" | "modifier" | "inline";
7
+ /** Options for constructing a {@link CssDocTagDefinition}. */
8
+ interface CssDocTagDefinitionOptions {
9
+ /** The tag name, with or without a leading `@` (e.g. `@modifier` or `modifier`). */
10
+ tagName: string;
11
+ /** The tag's syntactic kind. */
12
+ syntaxKind: CssDocSyntaxKind;
13
+ /** Whether the tag may appear more than once in a comment (defaults to `false`). */
14
+ allowMultiple?: boolean;
15
+ /** For `record` tags, the {@link CssRecordKind} the tag selects. */
16
+ recordKind?: CssRecordKind;
17
+ /** The canonical tag (without `@`) this tag is an alias of, e.g. `@csspart` aliases `part`. */
18
+ aliasFor?: string;
19
+ }
20
+ /** One tag in the vocabulary: its name, kind, and how it may be used. */
21
+ declare class CssDocTagDefinition {
22
+ /** The normalized tag name, always with a leading `@` (e.g. `@modifier`). */
23
+ readonly tagName: string;
24
+ /** The tag name without its leading `@` (e.g. `modifier`). */
25
+ readonly tagNameWithoutAt: string;
26
+ readonly syntaxKind: CssDocSyntaxKind;
27
+ readonly allowMultiple: boolean;
28
+ readonly recordKind?: CssRecordKind;
29
+ /** The canonical tag name (without `@`) this aliases, if any; otherwise its own name. */
30
+ readonly aliasFor?: string;
31
+ constructor(options: CssDocTagDefinitionOptions);
32
+ /** The tag this definition resolves to when handled — its alias target, or itself. */
33
+ get canonicalName(): string;
34
+ }
35
+ /**
36
+ * A parse configuration: the set of tag definitions plus which are supported. Construct one to get the
37
+ * full standard vocabulary, then add custom tags or disable standard ones.
38
+ *
39
+ * @example
40
+ * ```ts
41
+ * import { CssDocConfiguration, CssDocTagDefinition, parseCssDocs } from "@cssdoc/core";
42
+ *
43
+ * const config = new CssDocConfiguration();
44
+ * config.addTagDefinition(new CssDocTagDefinition({ tagName: "@token", syntaxKind: "block" }), true);
45
+ * const model = parseCssDocs(css, { configuration: config });
46
+ * ```
47
+ */
48
+ declare class CssDocConfiguration {
49
+ private readonly _tagDefinitions;
50
+ private readonly _byName;
51
+ private readonly _supported;
52
+ constructor();
53
+ /** Every registered tag definition, in registration order. */
54
+ get tagDefinitions(): readonly CssDocTagDefinition[];
55
+ /** Only the tag definitions that are currently supported. */
56
+ get supportedTagDefinitions(): readonly CssDocTagDefinition[];
57
+ /**
58
+ * Register a tag definition. Re-registering a tag name replaces the earlier definition.
59
+ *
60
+ * @param definition - The tag to add.
61
+ * @param supported - Whether it is supported (defaults to `true`).
62
+ */
63
+ addTagDefinition(definition: CssDocTagDefinition, supported?: boolean): void;
64
+ /** Register several tag definitions. */
65
+ addTagDefinitions(definitions: readonly CssDocTagDefinition[], supported?: boolean): void;
66
+ /** Look up a tag definition by name (with or without a leading `@`). */
67
+ tryGetTagDefinition(tagName: string): CssDocTagDefinition | undefined;
68
+ /** Whether a tag definition is supported. */
69
+ isTagSupported(definition: CssDocTagDefinition): boolean;
70
+ /** Enable or disable support for a tag. */
71
+ setSupportForTag(definition: CssDocTagDefinition, supported: boolean): void;
72
+ /** Enable or disable support for several tags. */
73
+ setSupportForTags(definitions: readonly CssDocTagDefinition[], supported: boolean): void;
74
+ /** Disable support for every standard tag (custom tags added later remain supported). */
75
+ setNoStandardTags(): void;
76
+ /** The names (without `@`) of every standard tag. */
77
+ static readonly standardTagNames: readonly string[];
78
+ /** A fresh set of the standard tag definitions (new instances on each call). */
79
+ static standardTags(): CssDocTagDefinition[];
80
+ }
81
+ //#endregion
82
+ //#region src/model.d.ts
83
+ /**
84
+ * The serializable CSS-documentation model — the output-agnostic IR produced by {@link parseCssDocs}.
85
+ * Emitters (markdown, JSON, …) consume this; it carries no assumptions about any particular project,
86
+ * class prefix, or output format.
87
+ *
88
+ * The model documents the modern CSSOM surface a stylesheet exposes: modifiers and parts, registered
89
+ * custom properties (`@property`), custom functions (`@function`), animations (`@keyframes`), cascade
90
+ * layers (`@layer`), conditional-support blocks (`@container`/`@supports`/`@media`), states, and slots.
91
+ * Facts that can be derived from the CSS AST are derived (so they can't drift); doc-comment tags supply
92
+ * the prose.
93
+ *
94
+ * @module
95
+ */
96
+ /** A `-<prop>-<value>` (or boolean `-<flag>`) modifier on a component's base class. */
97
+ interface CssModifier {
98
+ /** The modifier class without the leading dot, e.g. `-color-secondary` or `-condensed`. */
99
+ name: string;
100
+ /** The property segment, e.g. `color` (the text after the first `-`, up to the next `-`). */
101
+ prop: string;
102
+ /** The value segment, e.g. `secondary`; absent for boolean modifiers. */
103
+ value?: string;
104
+ /** Prose from a `@modifier` doc tag, when authored. */
105
+ description?: string;
106
+ /**
107
+ * Set when the modifier is deprecated. `canonical` (from an AST alias marker) is the modifier class
108
+ * to use instead; `note` (from an authored inline deprecation tag on the `@modifier` line) is
109
+ * free-text replacement guidance for cases where the replacement isn't itself a modifier.
110
+ */
111
+ deprecated?: {
112
+ canonical?: string;
113
+ note?: string;
114
+ };
115
+ }
116
+ /** A sub-element ("part") of a component — a scoped child class like `.item` or `.tip`. */
117
+ interface CssPart {
118
+ /** The part class without the leading dot, e.g. `item`. */
119
+ name: string;
120
+ /** Prose from a `@part` / `@csspart` doc tag, when authored. */
121
+ description?: string;
122
+ }
123
+ /** A component state — a `:state()` / state-class the component reacts to (`@cssstate`). */
124
+ interface CssState {
125
+ /** The state name, e.g. `open` or `selected`. */
126
+ name: string;
127
+ /** Prose from a `@cssstate` doc tag, when authored. */
128
+ description?: string;
129
+ }
130
+ /** A named slot a component shell exposes (`@slot`, Custom Elements Manifest). */
131
+ interface CssSlot {
132
+ /** The slot name (empty string for the default slot). */
133
+ name: string;
134
+ /** Prose from a `@slot` doc tag, when authored. */
135
+ description?: string;
136
+ }
137
+ /** A custom property the component declares (`@property`) or documents (`@cssproperty`). */
138
+ interface CssPropertyDeclared {
139
+ /** The custom-property name, e.g. `--value`. */
140
+ name: string;
141
+ /** The `@property` `syntax` descriptor, e.g. `<number>`, when known. */
142
+ syntax?: string;
143
+ /** The `@property` `inherits` flag, when declared. */
144
+ inherits?: boolean;
145
+ /** The default value (`@property` `initial-value`, or an authored `@defaultValue`), when known. */
146
+ defaultValue?: string;
147
+ /** Prose from a `@cssproperty` doc tag, when authored. */
148
+ description?: string;
149
+ }
150
+ /** A CSS custom function (`@function --name`) the stylesheet defines. */
151
+ interface CssFunction {
152
+ /** The function name, e.g. `--negate`. */
153
+ name: string;
154
+ /** The declared parameters, e.g. `["--value"]`, when derivable from the `@function` at-rule. */
155
+ parameters: string[];
156
+ /** The `result` descriptor/type, when declared. */
157
+ result?: string;
158
+ /** Prose from a `@function` doc tag, when authored. */
159
+ description?: string;
160
+ }
161
+ /** An animation the component exposes (`@keyframes` at-rule / `@animation` doc tag). */
162
+ interface CssAnimation {
163
+ /** The animation (keyframes) name. */
164
+ name: string;
165
+ /** Prose from an `@animation`/`@keyframes` doc tag, when authored. */
166
+ description?: string;
167
+ }
168
+ /** A cascade layer the stylesheet participates in (`@layer`). */
169
+ interface CssLayer {
170
+ /** The layer name, possibly dotted (e.g. `theme.dark`). */
171
+ name: string;
172
+ /** Prose from a `@layer` doc tag, when authored. */
173
+ description?: string;
174
+ }
175
+ /** A conditional-support block the component's rules sit under. */
176
+ interface CssCondition {
177
+ /** Which at-rule expressed the condition. */
178
+ type: "container" | "supports" | "media";
179
+ /** The condition text, e.g. `(min-width: 40rem)` or `(display: grid)`. */
180
+ query: string;
181
+ /** A container name, for `@container` blocks that target a named container. */
182
+ containerName?: string;
183
+ /** Prose from a `@container`/`@supports`/`@media`/`@responsive` doc tag, when authored. */
184
+ description?: string;
185
+ }
186
+ /**
187
+ * What kind of CSS surface a record documents. `component` is a namespaced component class with
188
+ * `-modifier`s and parts; `utility` a single-purpose class family; `rule` bare-element/reset styling;
189
+ * `declaration` a custom-property / `@property` registration layer. The record-opening tag chooses it
190
+ * (`@component`/`@utility`/`@rule`/`@declaration`); `@name` is an alias for `component`.
191
+ */
192
+ type CssRecordKind = "component" | "utility" | "rule" | "declaration";
193
+ /**
194
+ * A release stage from a modifier (flag) tag — `@alpha`, `@beta`, `@experimental`, `@internal`, or
195
+ * `@public` — mirroring TSDoc's release-tag semantics.
196
+ */
197
+ type CssReleaseStage = "alpha" | "beta" | "experimental" | "internal" | "public";
198
+ /**
199
+ * A node in an authored HTML-structure tree (`@structure`): a selector for the element and its
200
+ * children. Emitters render it as an indented tree and, via {@link toMermaid}, as a diagram.
201
+ */
202
+ interface StructureNode {
203
+ /** The node's selector/label, e.g. `.tabs` or `.tab.-selected` or `button`. */
204
+ selector: string;
205
+ /** Child nodes (one indentation level deeper). */
206
+ children: StructureNode[];
207
+ }
208
+ /** One documented CSS record: its base class plus everything derived from the CSS + doc comments. */
209
+ interface CssDocEntry {
210
+ /** The record name from `@component`/`@utility`/`@rule`/`@declaration`/`@name`, e.g. `button`. */
211
+ name: string;
212
+ /** Which kind of CSS surface this documents (defaults to `component`). */
213
+ kind: CssRecordKind;
214
+ /** The base class selector, e.g. `.button` (inferred from the first bare-class rule). */
215
+ className: string;
216
+ /** One-line summary from `@summary`. */
217
+ summary?: string;
218
+ /** Extended prose from `@remarks`. */
219
+ remarks?: string;
220
+ /** Internal-only prose from `@privateRemarks` (emitters may choose to omit it from public output). */
221
+ privateRemarks?: string;
222
+ /** The release stage from a modifier flag tag (`@alpha`/`@beta`/`@experimental`/`@internal`/`@public`). */
223
+ releaseStage?: CssReleaseStage;
224
+ /** Version introduced, from `@since`. */
225
+ since?: string;
226
+ /** A documentation group/category, from `@group`/`@category`. */
227
+ group?: string;
228
+ /** Accessibility guidance, from `@a11y`/`@accessibility`. */
229
+ accessibility?: string;
230
+ /** AST-extracted modifiers, annotated with `@modifier` prose where authored. */
231
+ modifiers: CssModifier[];
232
+ /** AST-extracted sub-element parts, annotated with `@part`/`@csspart` prose where authored. */
233
+ parts: CssPart[];
234
+ /** States the component reacts to, from `@cssstate`. */
235
+ states: CssState[];
236
+ /** Named slots the component shell exposes, from `@slot`. */
237
+ slots: CssSlot[];
238
+ /** Every `--*` custom property referenced via `var(...)` inside this component's rules. */
239
+ cssPropertiesConsumed: string[];
240
+ /** Custom properties this component declares (`@property`) or documents (`@cssproperty`). */
241
+ cssPropertiesDeclared: CssPropertyDeclared[];
242
+ /** CSS custom functions (`@function`) this component defines. */
243
+ functions: CssFunction[];
244
+ /** Animations (`@keyframes`) this component exposes. */
245
+ animations: CssAnimation[];
246
+ /** Cascade layers (`@layer`) this component participates in. */
247
+ layers: CssLayer[];
248
+ /** Conditional-support blocks (`@container`/`@supports`/`@media`) the rules sit under. */
249
+ conditions: CssCondition[];
250
+ /** `@example` blocks, verbatim. */
251
+ examples: string[];
252
+ /** The authored `@structure` HTML tree (top-level nodes), when present. */
253
+ structure?: StructureNode[];
254
+ /** `@demo <spec>` (e.g. `self:button`), when authored. */
255
+ demo?: string;
256
+ /** Component-level deprecation replacement text, when authored (the argument to a `@deprecated` tag). */
257
+ deprecated?: string;
258
+ /** `@see <ref>` cross-references. */
259
+ see: string[];
260
+ /**
261
+ * Content of registered custom (block) tags, keyed by tag name without its `@`. Populated only for
262
+ * tags added via configuration; unregistered unknown tags are ignored. Absent when none were found.
263
+ */
264
+ customBlocks?: Record<string, string[]>;
265
+ }
266
+ /** Options for {@link parseCssDocs}. */
267
+ interface ParseOptions {
268
+ /**
269
+ * How records are delimited. By default a new record begins at any doc comment (`/** … *\/`) that
270
+ * carries an `@component` or `@name` tag, which is the recommended, framework-agnostic convention.
271
+ * Supply a custom test to split on something else (e.g. a per-component header comment).
272
+ */
273
+ isRecordBoundary?: (commentText: string) => string | undefined;
274
+ /**
275
+ * The tag configuration (standard + custom tags, and which are supported). Defaults to a fresh
276
+ * {@link CssDocConfiguration} with every standard tag enabled — i.e. the full built-in vocabulary.
277
+ * Supply one (e.g. from `@cssdoc/config`) to register custom tags or disable standard ones.
278
+ */
279
+ configuration?: CssDocConfiguration;
280
+ }
281
+ //#endregion
282
+ //#region src/parse.d.ts
283
+ /**
284
+ * Parse a CSS string into a documentation model. Records are delimited by doc comments carrying a
285
+ * record tag (`@component`/`@name` by default; override via {@link ParseOptions.isRecordBoundary});
286
+ * everything from one boundary comment to the next belongs to that record.
287
+ *
288
+ * @param css - The CSS source (a generated stylesheet, with authored doc comments).
289
+ * @param options - {@link ParseOptions}.
290
+ * @returns One {@link CssDocEntry} per record, in document order.
291
+ *
292
+ * @example
293
+ * ```ts
294
+ * import { parseCssDocs } from "@cssdoc/core";
295
+ *
296
+ * const [badge] = parseCssDocs(badgeCssWithDocComments);
297
+ * badge.modifiers.map((m) => m.name); // ["-color-danger", "-color-success", …]
298
+ * ```
299
+ */
300
+ declare function parseCssDocs(css: string, options?: ParseOptions): CssDocEntry[];
301
+ //#endregion
302
+ //#region src/grammar.d.ts
303
+ /**
304
+ * The record-opening tags and the {@link CssRecordKind} each selects, as the default boundary map.
305
+ * A doc comment carrying one of these opens a new record; `@name` is an alias for `@component`. A
306
+ * {@link CssDocConfiguration} may add more record tags.
307
+ */
308
+ declare const RECORD_TAGS: Record<string, CssRecordKind>;
309
+ /** A custom property documented by a `@cssproperty` tag. */
310
+ interface DocCssProperty {
311
+ name: string;
312
+ syntax?: string;
313
+ defaultValue?: string;
314
+ description?: string;
315
+ }
316
+ /** The prose a `@modifier` tag contributes: a description and/or an inline deprecation replacement note. */
317
+ interface DocModifier {
318
+ description?: string;
319
+ /** Set when the modifier carries a bare `@deprecated` (no note and no canonical link). */
320
+ deprecatedFlag?: boolean;
321
+ /** Free-text replacement guidance from an inline `deprecated` tag on the modifier line. */
322
+ deprecated?: string;
323
+ /**
324
+ * The canonical modifier this one deprecates, from a `{@link -canonical}` in the deprecation note
325
+ * (e.g. `@deprecated {@link -color-danger}`). Stored without its leading dot, matching the AST-derived
326
+ * `deprecated.canonical`, so an authored alias and a generated one resolve to the same reference.
327
+ */
328
+ deprecatedCanonical?: string;
329
+ }
330
+ /** An authored conditional-support tag (`@container`/`@supports`/`@media`/`@responsive`). */
331
+ interface DocCondition {
332
+ type: "container" | "supports" | "media";
333
+ query: string;
334
+ description?: string;
335
+ }
336
+ /** The structured content extracted from one doc-comment block. */
337
+ interface ParsedDoc {
338
+ /** `@component`/`@utility`/`@rule`/`@declaration`/`@name` — the record name. Marks a record boundary. */
339
+ component?: string;
340
+ /** The record kind chosen by the opening tag (`component` unless `@utility`/`@rule`/`@declaration`). */
341
+ kind?: CssRecordKind;
342
+ /** `@class` — an explicit base class selector (otherwise inferred from the CSS). */
343
+ className?: string;
344
+ /** `@summary` — one-line intro. */
345
+ summary?: string;
346
+ /** `@remarks` — extended prose. */
347
+ remarks?: string;
348
+ /** `@privateRemarks` — internal-only prose. */
349
+ privateRemarks?: string;
350
+ /** `@since` — version introduced. */
351
+ since?: string;
352
+ /** `@group`/`@category` — a documentation group. */
353
+ group?: string;
354
+ /** `@a11y`/`@accessibility` — accessibility guidance. */
355
+ accessibility?: string;
356
+ /** The release stage from a modifier flag tag (`@alpha`/`@beta`/…). */
357
+ releaseStage?: CssReleaseStage;
358
+ /** `@modifier` prose, keyed by the modifier class without its dot (e.g. `-color-secondary`). */
359
+ modifiers: Map<string, DocModifier>;
360
+ /** `@part`/`@csspart` descriptions, keyed by the part name without its dot (e.g. `item`). */
361
+ parts: Map<string, string>;
362
+ /** `@cssproperty` declarations. */
363
+ cssProperties: DocCssProperty[];
364
+ /** `@cssstate` descriptions, keyed by state name. */
365
+ cssStates: Map<string, string>;
366
+ /** `@slot` descriptions, keyed by slot name (empty string for the default slot). */
367
+ slots: Map<string, string>;
368
+ /** `@function` descriptions, keyed by function name (e.g. `--negate`). */
369
+ functions: Map<string, string>;
370
+ /** `@keyframes`/`@animation` descriptions, keyed by animation name. */
371
+ animations: Map<string, string>;
372
+ /** `@layer` descriptions, keyed by layer name. */
373
+ layers: Map<string, string>;
374
+ /** `@container`/`@supports`/`@media`/`@responsive` authored conditions. */
375
+ conditions: DocCondition[];
376
+ /** `@example` blocks. */
377
+ examples: string[];
378
+ /** `@structure` — the raw (indented) HTML-tree body, parsed into nodes by {@link parseStructure}. */
379
+ structure?: StructureNode[];
380
+ /** The `<replacement>` argument from a `@deprecated` tag. */
381
+ deprecated?: string;
382
+ /** `@demo <spec>`. */
383
+ demo?: string;
384
+ /** `@see <ref>` entries. */
385
+ see: string[];
386
+ /** Content of registered custom (block) tags, keyed by tag name without its `@`. */
387
+ customBlocks: Map<string, string[]>;
388
+ }
389
+ /** Strip the comment framing (`/**`, `*\/`, and leading ` * `) from a raw block-comment body. */
390
+ declare function stripCommentFraming(raw: string): string;
391
+ /**
392
+ * Parse a doc-comment's INNER text (already stripped of `/* *\/` framing, or a raw block — both are
393
+ * handled) into a {@link ParsedDoc}. The `configuration` decides which tags are active and which custom
394
+ * tags to capture; unknown or unsupported tags are ignored, so the grammar degrades gracefully.
395
+ *
396
+ * @param raw - The comment text (with or without `/** … *\/` framing).
397
+ * @param configuration - The active tag configuration (defaults to the full standard vocabulary).
398
+ * @returns The structured tags.
399
+ */
400
+ declare function parseDocComment(raw: string, configuration?: CssDocConfiguration): ParsedDoc;
401
+ /**
402
+ * Whether a comment's text opens a record — i.e. carries a record tag. Uses the `configuration`'s
403
+ * record tags when given, else the default {@link RECORD_TAGS}.
404
+ *
405
+ * @param commentText - The comment body.
406
+ * @param configuration - The active configuration (optional).
407
+ * @returns The record name, or `undefined`.
408
+ */
409
+ declare function recordNameOf(commentText: string, configuration?: CssDocConfiguration): string | undefined;
410
+ /**
411
+ * Parse a `@structure` body — an indentation-nested list of element selectors — into a
412
+ * {@link StructureNode} tree. Indentation depth (any consistent width) sets nesting; blank lines are
413
+ * ignored.
414
+ *
415
+ * @example
416
+ * ```
417
+ * .tabs
418
+ * .list
419
+ * .tab
420
+ * .panel
421
+ * ```
422
+ */
423
+ declare function parseStructure(raw: string): StructureNode[];
424
+ //#endregion
425
+ //#region src/mermaid.d.ts
426
+ /**
427
+ * Convert a structure tree to a Mermaid `flowchart` definition. Each node gets a stable id (`n0`, `n1`,
428
+ * …) in depth-first order; edges connect a parent to each child.
429
+ *
430
+ * @param roots - Top-level {@link StructureNode}s (an authored `@structure`).
431
+ * @param options - `direction` sets the flowchart orientation (default `TD`, top-down).
432
+ * @returns Mermaid source, or an empty string when there are no nodes.
433
+ *
434
+ * @example
435
+ * ```ts
436
+ * toMermaid([{ selector: ".tabs", children: [{ selector: ".panel", children: [] }] }]);
437
+ * // flowchart TD
438
+ * // n0[".tabs"]
439
+ * // n1[".panel"]
440
+ * // n0 --> n1
441
+ * ```
442
+ */
443
+ declare function toMermaid(roots: StructureNode[], options?: {
444
+ direction?: "TD" | "LR";
445
+ }): string;
446
+ //#endregion
447
+ //#region src/index.d.ts
448
+ /**
449
+ * Serialize a documentation model to pretty JSON (the raw, emitter-agnostic artifact — like TypeDoc's
450
+ * `--json`).
451
+ *
452
+ * @param model - The entries from {@link parseCssDocs}.
453
+ * @returns A JSON string.
454
+ */
455
+ declare function toJson(model: CssDocEntry[]): string;
456
+ //#endregion
457
+ export { type CssAnimation, type CssCondition, CssDocConfiguration, type CssDocEntry, type CssDocSyntaxKind, CssDocTagDefinition, type CssDocTagDefinitionOptions, type CssFunction, type CssLayer, type CssModifier, type CssPart, type CssPropertyDeclared, type CssRecordKind, type CssReleaseStage, type CssSlot, type CssState, type DocCondition, type DocCssProperty, type DocModifier, type ParseOptions, type ParsedDoc, RECORD_TAGS, type StructureNode, parseCssDocs, parseDocComment, parseStructure, recordNameOf, stripCommentFraming, toJson, toMermaid };