@cssdoc/config 0.4.1 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,7 +2,7 @@
2
2
  "$schema": "http://json-schema.org/draft-07/schema#",
3
3
  "$id": "https://cssdoc.dev/cssdoc.schema.json",
4
4
  "title": "cssdoc.json",
5
- "description": "Configuration for @cssdoc/core: custom tags and inherited configs.",
5
+ "description": "Configuration for cssdoc: custom tags, lint rules, and markdown render options.",
6
6
  "type": "object",
7
7
  "additionalProperties": false,
8
8
  "properties": {
@@ -145,6 +145,48 @@
145
145
  "items": {
146
146
  "type": "string"
147
147
  }
148
+ },
149
+ "render": {
150
+ "description": "Markdown render options for the CSS API pages (used by @cssdoc/markdown and @cssdoc/typedoc). Explicit emitter options still override these.",
151
+ "type": "object",
152
+ "additionalProperties": false,
153
+ "properties": {
154
+ "sectionOrder": {
155
+ "description": "Order (and inclusion) of the reorderable ## sections on a record page; omitted keys are dropped.",
156
+ "type": "array",
157
+ "items": {
158
+ "enum": [
159
+ "demo",
160
+ "examples",
161
+ "usage",
162
+ "modifiers",
163
+ "parts",
164
+ "shadowParts",
165
+ "states",
166
+ "slots",
167
+ "structure",
168
+ "cssProperties",
169
+ "functions",
170
+ "animations",
171
+ "layers",
172
+ "conditions",
173
+ "tokensConsumed",
174
+ "compat",
175
+ "accessibility",
176
+ "related",
177
+ "see"
178
+ ]
179
+ }
180
+ },
181
+ "headingPrefix": {
182
+ "description": "Prefix for each record page title, e.g. \"CSS:\".",
183
+ "type": "string"
184
+ },
185
+ "baseHref": {
186
+ "description": "Base href for @related cross-links and the sidebar/index links.",
187
+ "type": "string"
188
+ }
189
+ }
148
190
  }
149
191
  }
150
192
  }
package/dist/index.d.mts CHANGED
@@ -8,6 +8,16 @@ interface NamingOverride {
8
8
  component?: string;
9
9
  part?: string;
10
10
  }
11
+ /**
12
+ * The `render` block: markdown render options for the CSS API pages, as spelled in `cssdoc.json`.
13
+ * `sectionOrder` items are the emitter's section keys (typed loosely here to keep `@cssdoc/config`
14
+ * independent of `@cssdoc/markdown`; the emitter validates/uses them).
15
+ */
16
+ interface RenderConfig {
17
+ sectionOrder?: readonly string[];
18
+ headingPrefix?: string;
19
+ baseHref?: string;
20
+ }
11
21
  /**
12
22
  * The conventional file names loaders look for, in preference order. Both are parsed the same way
13
23
  * (JSON with comments); `.jsonc` just makes the comments explicit.
@@ -48,6 +58,12 @@ declare class CssDocConfigFile {
48
58
  * chain. Pass to `lintModel` in `@cssdoc/providers`.
49
59
  */
50
60
  readonly structureIgnore: readonly string[];
61
+ /**
62
+ * Markdown render options (`sectionOrder`/`headingPrefix`/`baseHref`), merged across the `extends`
63
+ * chain (this file wins). The emitter (`@cssdoc/markdown`/`@cssdoc/typedoc`) reads these as defaults;
64
+ * explicit emitter options still override. Not part of the parser `CssDocConfiguration`.
65
+ */
66
+ readonly render: Readonly<RenderConfig>;
51
67
  private constructor();
52
68
  /** Whether this file — or any file it extends — reported an error. */
53
69
  get hasErrors(): boolean;
@@ -97,7 +113,7 @@ declare const cssDocSchema: {
97
113
  readonly $schema: "http://json-schema.org/draft-07/schema#";
98
114
  readonly $id: "https://cssdoc.dev/cssdoc.schema.json";
99
115
  readonly title: "cssdoc.json";
100
- readonly description: "Configuration for @cssdoc/core: custom tags and inherited configs.";
116
+ readonly description: "Configuration for cssdoc: custom tags, lint rules, and markdown render options.";
101
117
  readonly type: "object";
102
118
  readonly additionalProperties: false;
103
119
  readonly properties: {
@@ -232,6 +248,28 @@ declare const cssDocSchema: {
232
248
  readonly type: "string";
233
249
  };
234
250
  };
251
+ readonly render: {
252
+ readonly description: "Markdown render options for the CSS API pages (used by @cssdoc/markdown and @cssdoc/typedoc). Explicit emitter options still override these.";
253
+ readonly type: "object";
254
+ readonly additionalProperties: false;
255
+ readonly properties: {
256
+ readonly sectionOrder: {
257
+ readonly description: "Order (and inclusion) of the reorderable ## sections on a record page; omitted keys are dropped.";
258
+ readonly type: "array";
259
+ readonly items: {
260
+ readonly enum: readonly ["demo", "examples", "usage", "modifiers", "parts", "shadowParts", "states", "slots", "structure", "cssProperties", "functions", "animations", "layers", "conditions", "tokensConsumed", "compat", "accessibility", "related", "see"];
261
+ };
262
+ };
263
+ readonly headingPrefix: {
264
+ readonly description: "Prefix for each record page title, e.g. \"CSS:\".";
265
+ readonly type: "string";
266
+ };
267
+ readonly baseHref: {
268
+ readonly description: "Base href for @related cross-links and the sidebar/index links.";
269
+ readonly type: "string";
270
+ };
271
+ };
272
+ };
235
273
  };
236
274
  };
237
275
  //#endregion
package/dist/index.mjs CHANGED
@@ -17,7 +17,7 @@ const cssDocSchema = {
17
17
  $schema: "http://json-schema.org/draft-07/schema#",
18
18
  $id: "https://cssdoc.dev/cssdoc.schema.json",
19
19
  title: "cssdoc.json",
20
- description: "Configuration for @cssdoc/core: custom tags and inherited configs.",
20
+ description: "Configuration for cssdoc: custom tags, lint rules, and markdown render options.",
21
21
  type: "object",
22
22
  additionalProperties: false,
23
23
  properties: {
@@ -129,6 +129,46 @@ const cssDocSchema = {
129
129
  description: "Class names to exempt from the structure-unknown-selector rule — legitimately-external classes (utilities, cross-component refs) referenced in @structure. Literal names or simple globs where * matches any run of characters (e.g. util-*).",
130
130
  type: "array",
131
131
  items: { type: "string" }
132
+ },
133
+ render: {
134
+ description: "Markdown render options for the CSS API pages (used by @cssdoc/markdown and @cssdoc/typedoc). Explicit emitter options still override these.",
135
+ type: "object",
136
+ additionalProperties: false,
137
+ properties: {
138
+ sectionOrder: {
139
+ description: "Order (and inclusion) of the reorderable ## sections on a record page; omitted keys are dropped.",
140
+ type: "array",
141
+ items: { enum: [
142
+ "demo",
143
+ "examples",
144
+ "usage",
145
+ "modifiers",
146
+ "parts",
147
+ "shadowParts",
148
+ "states",
149
+ "slots",
150
+ "structure",
151
+ "cssProperties",
152
+ "functions",
153
+ "animations",
154
+ "layers",
155
+ "conditions",
156
+ "tokensConsumed",
157
+ "compat",
158
+ "accessibility",
159
+ "related",
160
+ "see"
161
+ ] }
162
+ },
163
+ headingPrefix: {
164
+ description: "Prefix for each record page title, e.g. \"CSS:\".",
165
+ type: "string"
166
+ },
167
+ baseHref: {
168
+ description: "Base href for @related cross-links and the sidebar/index links.",
169
+ type: "string"
170
+ }
171
+ }
132
172
  }
133
173
  }
134
174
  };
@@ -184,6 +224,12 @@ var CssDocConfigFile = class CssDocConfigFile {
184
224
  * chain. Pass to `lintModel` in `@cssdoc/providers`.
185
225
  */
186
226
  structureIgnore;
227
+ /**
228
+ * Markdown render options (`sectionOrder`/`headingPrefix`/`baseHref`), merged across the `extends`
229
+ * chain (this file wins). The emitter (`@cssdoc/markdown`/`@cssdoc/typedoc`) reads these as defaults;
230
+ * explicit emitter options still override. Not part of the parser `CssDocConfiguration`.
231
+ */
232
+ render;
187
233
  constructor(init) {
188
234
  this.filePath = init.filePath;
189
235
  this.fileNotFound = init.fileNotFound;
@@ -195,17 +241,21 @@ var CssDocConfigFile = class CssDocConfigFile {
195
241
  this.modifierConvention = init.modifierConvention;
196
242
  const severities = {};
197
243
  const naming = {};
244
+ const render = {};
198
245
  const structureIgnore = /* @__PURE__ */ new Set();
199
246
  for (const extended of init.extendsFiles) {
200
247
  Object.assign(severities, extended.ruleSeverities);
201
248
  Object.assign(naming, extended.naming);
249
+ Object.assign(render, extended.render);
202
250
  for (const g of extended.structureIgnore) structureIgnore.add(g);
203
251
  }
204
252
  Object.assign(severities, init.rules);
205
253
  Object.assign(naming, init.naming);
254
+ Object.assign(render, init.render);
206
255
  for (const g of init.structureIgnore) structureIgnore.add(g);
207
256
  this.ruleSeverities = severities;
208
257
  this.naming = naming;
258
+ this.render = render;
209
259
  this.structureIgnore = [...structureIgnore];
210
260
  }
211
261
  /** Whether this file — or any file it extends — reported an error. */
@@ -279,7 +329,8 @@ var CssDocConfigFile = class CssDocConfigFile {
279
329
  extendsFiles: [],
280
330
  rules: {},
281
331
  naming: {},
282
- structureIgnore: []
332
+ structureIgnore: [],
333
+ render: {}
283
334
  });
284
335
  }
285
336
  static _loadFile(filePath, visited) {
@@ -294,7 +345,8 @@ var CssDocConfigFile = class CssDocConfigFile {
294
345
  extendsFiles: [],
295
346
  rules: {},
296
347
  naming: {},
297
- structureIgnore: []
348
+ structureIgnore: [],
349
+ render: {}
298
350
  });
299
351
  if (visited.has(filePath)) {
300
352
  messages.push("Circular extends reference; skipped.");
@@ -342,7 +394,8 @@ var CssDocConfigFile = class CssDocConfigFile {
342
394
  modifierConvention: raw.modifierConvention,
343
395
  rules: raw.rules ?? {},
344
396
  naming: raw.naming ?? {},
345
- structureIgnore: raw.structureIgnore ?? []
397
+ structureIgnore: raw.structureIgnore ?? [],
398
+ render: raw.render ?? {}
346
399
  });
347
400
  }
348
401
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cssdoc/config",
3
- "version": "0.4.1",
3
+ "version": "0.5.0",
4
4
  "description": "Load a cssdoc.json configuration file (custom tags, extends) into an @cssdoc/core CssDocConfiguration — TSDoc-config, for CSS.",
5
5
  "keywords": [
6
6
  "config",
@@ -32,7 +32,7 @@
32
32
  "dependencies": {
33
33
  "ajv": "^8.20.0",
34
34
  "jsonc-parser": "^3.3.1",
35
- "@cssdoc/core": "0.4.1"
35
+ "@cssdoc/core": "0.5.0"
36
36
  },
37
37
  "devDependencies": {
38
38
  "@types/node": "^24.13.3",