kss-modern 1.1.0 → 1.2.0-beta.1
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 +1 -1
- package/dist/node/lib/index.d.mts +112 -4
- package/dist/node/lib/index.d.ts +112 -4
- package/dist/node/lib/index.mjs +604 -329
- package/dist/node/lib/{vite-pug → pug}/worker.d.mts +8 -7
- package/dist/node/lib/{vite-pug → pug}/worker.d.ts +8 -7
- package/dist/node/lib/pug/worker.mjs +22 -0
- package/dist/node/shared/kss-modern.C3thzyxO.mjs +196 -0
- package/dist/styleguide-assets/.vite/manifest.json +4 -4
- package/dist/styleguide-assets/{axe-Cd_oCzvh.js → axe-BUK9a7nX.js} +4896 -4511
- package/dist/styleguide-assets/{browser-DfbHtzxK.js → browser-bCxY1z1G.js} +2047 -2040
- package/dist/styleguide-assets/{fullpage-Bu4DpBQh.js → fullpage-CVmYa-FG.js} +2 -2
- package/dist/styleguide-assets/kss-modern-CjPjhHw0.css +3 -0
- package/package.json +12 -11
- package/dist/node/lib/vite-pug/worker.mjs +0 -132
- package/dist/styleguide-assets/kss-modern-BWQ6E3TR.css +0 -3
package/README.md
CHANGED
|
@@ -89,7 +89,7 @@ Markup: templates/components/card.pug
|
|
|
89
89
|
```bash
|
|
90
90
|
bun install
|
|
91
91
|
bun run build # Build: Vite (client assets) then Unbuild (Node.js library)
|
|
92
|
-
bun run dev # Build + run dev server with Deno (watches test/ content)
|
|
92
|
+
bun run dev # Build + run dev server with Deno (watches test-styleguide/ content)
|
|
93
93
|
bun run lint # ESLint
|
|
94
94
|
bun run test # Vitest unit + integration tests
|
|
95
95
|
bun run release # Lint + version bump via bumpp
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
interface SectionMeta {
|
|
2
|
+
modifiers: {
|
|
3
|
+
name: string;
|
|
4
|
+
}[];
|
|
5
|
+
}
|
|
6
|
+
|
|
1
7
|
interface ColorObject {
|
|
2
8
|
name?: string;
|
|
3
9
|
color: string;
|
|
@@ -44,6 +50,45 @@ interface in2SecondLevelSection extends in2Section {
|
|
|
44
50
|
sections: in2Section[];
|
|
45
51
|
}
|
|
46
52
|
|
|
53
|
+
/** Title + message for a boxed log entry. */
|
|
54
|
+
interface LogBox {
|
|
55
|
+
title: string;
|
|
56
|
+
message: string;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Styleguide logger. Intentionally a small, fixed surface so the underlying
|
|
60
|
+
* logging library (currently consola) stays an implementation detail and can
|
|
61
|
+
* be swapped without touching call sites.
|
|
62
|
+
*
|
|
63
|
+
* The message methods are variadic pass-throughs, so a leading message can be
|
|
64
|
+
* paired with an Error/unknown value — `logger.error('Build failed', err)` —
|
|
65
|
+
* and consola renders the error (and its stack) below the message.
|
|
66
|
+
*/
|
|
67
|
+
interface Logger {
|
|
68
|
+
/** Informational message. */
|
|
69
|
+
info: (message: unknown, ...args: unknown[]) => void;
|
|
70
|
+
/** Successful operation. */
|
|
71
|
+
success: (message: unknown, ...args: unknown[]) => void;
|
|
72
|
+
/** Non-fatal warning. */
|
|
73
|
+
warn: (message: unknown, ...args: unknown[]) => void;
|
|
74
|
+
/** Error — a message, an Error/unknown value, or a message followed by one. */
|
|
75
|
+
error: (message: unknown, ...args: unknown[]) => void;
|
|
76
|
+
/** Boxed, highlighted message used for grouped summaries. */
|
|
77
|
+
box: (box: LogBox) => void;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Create a {@link Logger} backed by consola. consola is wrapped rather than
|
|
81
|
+
* exposed directly so consumers depend only on the {@link Logger} contract.
|
|
82
|
+
*
|
|
83
|
+
* Every entry leads with a blue `tag` badge — styled like consola's own
|
|
84
|
+
* WARN/ERROR badges — passed as part of the message so it always sits at the
|
|
85
|
+
* start of the line. (consola's built-in `tag` option is right-aligned by the
|
|
86
|
+
* fancy reporter and scrolls off a wide terminal.)
|
|
87
|
+
*/
|
|
88
|
+
declare function createLogger(tag?: string): Logger;
|
|
89
|
+
/** Shared styleguide logger instance. */
|
|
90
|
+
declare const logger: Logger;
|
|
91
|
+
|
|
47
92
|
interface StyleguideConfiguration {
|
|
48
93
|
mode: 'development' | 'production';
|
|
49
94
|
outDir: string;
|
|
@@ -85,6 +130,43 @@ interface StyleguideBuildOutput {
|
|
|
85
130
|
overwrittenSectionsIds?: string[];
|
|
86
131
|
};
|
|
87
132
|
}
|
|
133
|
+
interface MenuSectionMapping {
|
|
134
|
+
title: string;
|
|
135
|
+
items: {
|
|
136
|
+
label: string;
|
|
137
|
+
href: string;
|
|
138
|
+
status?: string;
|
|
139
|
+
}[];
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Expensive, parse-derived state computed once and reused across incremental rebuilds.
|
|
143
|
+
* A markup-only edit never changes section structure, so the parsed tree, navigation mappings,
|
|
144
|
+
* and lookups stay valid; only affected sections are recompiled and rewritten.
|
|
145
|
+
*/
|
|
146
|
+
interface StyleguideContext {
|
|
147
|
+
baseDirectory: string;
|
|
148
|
+
parsedContent: in2FirstLevelSection[];
|
|
149
|
+
overwrittenSectionsIds: string[];
|
|
150
|
+
sectionsById: Map<string, SectionMeta>;
|
|
151
|
+
/** section id -> original (pre-compile) markup, i.e. the compile input */
|
|
152
|
+
rawMarkupBySection: Map<string, string>;
|
|
153
|
+
/** section id -> compiled markup that is NOT yet <insert-markup>-resolved (persistent) */
|
|
154
|
+
compiledRepository: Map<string, {
|
|
155
|
+
markup: string;
|
|
156
|
+
}>;
|
|
157
|
+
/** refId -> ids whose compiled markup embeds <insert-markup>refId</insert-markup> */
|
|
158
|
+
insertMarkupConsumers: Map<string, Set<string>>;
|
|
159
|
+
headerHtml: string;
|
|
160
|
+
searchHtml: string;
|
|
161
|
+
menuSectionMapping: MenuSectionMapping[];
|
|
162
|
+
/** section id (second & third level) -> its parsed node */
|
|
163
|
+
nodeById: Map<string, in2Section>;
|
|
164
|
+
/** any section id -> the location of its owning second-level section (for preview regen) */
|
|
165
|
+
ownerLocationById: Map<string, {
|
|
166
|
+
firstLevelIndex: number;
|
|
167
|
+
secondLevelIndex: number;
|
|
168
|
+
}>;
|
|
169
|
+
}
|
|
88
170
|
/**
|
|
89
171
|
* Parse given contentDir and get structured data for further processing
|
|
90
172
|
*/
|
|
@@ -92,18 +174,44 @@ declare function parseStyleguide(contentDir: StyleguideConfiguration['contentDir
|
|
|
92
174
|
content: in2FirstLevelSection[];
|
|
93
175
|
overwrittenSectionsIds: string[];
|
|
94
176
|
}>;
|
|
177
|
+
/**
|
|
178
|
+
* Full build: parse, compile every section, and write all fullpage + preview files. Returns the
|
|
179
|
+
* reusable context so the watcher can perform targeted incremental rebuilds afterwards.
|
|
180
|
+
*/
|
|
181
|
+
declare function buildAll(config: StyleguideConfiguration): Promise<{
|
|
182
|
+
errors: StyleguideBuildOutput['errors'];
|
|
183
|
+
context: StyleguideContext;
|
|
184
|
+
}>;
|
|
95
185
|
/**
|
|
96
186
|
* Builds the styleguide
|
|
97
187
|
* @param config - The configuration for the styleguide
|
|
98
188
|
*/
|
|
99
189
|
declare function buildStyleguide(config: StyleguideConfiguration): Promise<StyleguideBuildOutput>;
|
|
190
|
+
/**
|
|
191
|
+
* Incrementally rebuild only the sections affected by a markup change: recompile their pug
|
|
192
|
+
* (cache-aware), re-resolve <insert-markup>, and rewrite just their fullpage + owning preview files.
|
|
193
|
+
* `changedSectionIds` are the sections whose pug (or a dependency) changed.
|
|
194
|
+
*/
|
|
195
|
+
declare function rebuildSections(config: StyleguideConfiguration, context: StyleguideContext, changedSectionIds: Iterable<string>): Promise<void>;
|
|
196
|
+
/**
|
|
197
|
+
* What triggered a {@link watchStyleguide} rebuild:
|
|
198
|
+
* - `structural` — a CSS/SCSS/Markdown edit that can change section structure; the whole styleguide is rebuilt.
|
|
199
|
+
* - `markup` — a Pug/HTML edit; only `sections` (those depending on `file`) are rebuilt.
|
|
200
|
+
*/
|
|
201
|
+
type StyleguideChange = {
|
|
202
|
+
type: 'structural';
|
|
203
|
+
} | {
|
|
204
|
+
type: 'markup';
|
|
205
|
+
file: string;
|
|
206
|
+
sections: string[];
|
|
207
|
+
};
|
|
100
208
|
/**
|
|
101
209
|
* Builds the styleguide and watches for changes
|
|
102
210
|
* @param config - The configuration for the styleguide
|
|
103
|
-
* @param onChange - Optional callback
|
|
211
|
+
* @param onChange - Optional callback invoked after each rebuild, with the change that triggered it
|
|
104
212
|
* @param onError - Optional callback function to call when an error occurs while building the styleguide
|
|
105
213
|
*/
|
|
106
|
-
declare function watchStyleguide(config: StyleguideConfiguration, onChange?: () => void, onError?: (errorData: StyleguideBuildOutput['errors']) => void): Promise<void>;
|
|
214
|
+
declare function watchStyleguide(config: StyleguideConfiguration, onChange?: (change: StyleguideChange) => void, onError?: (errorData: StyleguideBuildOutput['errors']) => void): Promise<void>;
|
|
107
215
|
|
|
108
|
-
export { buildStyleguide, parseStyleguide, watchStyleguide };
|
|
109
|
-
export type { StyleguideConfiguration };
|
|
216
|
+
export { buildAll, buildStyleguide, createLogger, logger, parseStyleguide, rebuildSections, watchStyleguide };
|
|
217
|
+
export type { LogBox, Logger, StyleguideChange, StyleguideConfiguration, StyleguideContext };
|
package/dist/node/lib/index.d.ts
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
interface SectionMeta {
|
|
2
|
+
modifiers: {
|
|
3
|
+
name: string;
|
|
4
|
+
}[];
|
|
5
|
+
}
|
|
6
|
+
|
|
1
7
|
interface ColorObject {
|
|
2
8
|
name?: string;
|
|
3
9
|
color: string;
|
|
@@ -44,6 +50,45 @@ interface in2SecondLevelSection extends in2Section {
|
|
|
44
50
|
sections: in2Section[];
|
|
45
51
|
}
|
|
46
52
|
|
|
53
|
+
/** Title + message for a boxed log entry. */
|
|
54
|
+
interface LogBox {
|
|
55
|
+
title: string;
|
|
56
|
+
message: string;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Styleguide logger. Intentionally a small, fixed surface so the underlying
|
|
60
|
+
* logging library (currently consola) stays an implementation detail and can
|
|
61
|
+
* be swapped without touching call sites.
|
|
62
|
+
*
|
|
63
|
+
* The message methods are variadic pass-throughs, so a leading message can be
|
|
64
|
+
* paired with an Error/unknown value — `logger.error('Build failed', err)` —
|
|
65
|
+
* and consola renders the error (and its stack) below the message.
|
|
66
|
+
*/
|
|
67
|
+
interface Logger {
|
|
68
|
+
/** Informational message. */
|
|
69
|
+
info: (message: unknown, ...args: unknown[]) => void;
|
|
70
|
+
/** Successful operation. */
|
|
71
|
+
success: (message: unknown, ...args: unknown[]) => void;
|
|
72
|
+
/** Non-fatal warning. */
|
|
73
|
+
warn: (message: unknown, ...args: unknown[]) => void;
|
|
74
|
+
/** Error — a message, an Error/unknown value, or a message followed by one. */
|
|
75
|
+
error: (message: unknown, ...args: unknown[]) => void;
|
|
76
|
+
/** Boxed, highlighted message used for grouped summaries. */
|
|
77
|
+
box: (box: LogBox) => void;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Create a {@link Logger} backed by consola. consola is wrapped rather than
|
|
81
|
+
* exposed directly so consumers depend only on the {@link Logger} contract.
|
|
82
|
+
*
|
|
83
|
+
* Every entry leads with a blue `tag` badge — styled like consola's own
|
|
84
|
+
* WARN/ERROR badges — passed as part of the message so it always sits at the
|
|
85
|
+
* start of the line. (consola's built-in `tag` option is right-aligned by the
|
|
86
|
+
* fancy reporter and scrolls off a wide terminal.)
|
|
87
|
+
*/
|
|
88
|
+
declare function createLogger(tag?: string): Logger;
|
|
89
|
+
/** Shared styleguide logger instance. */
|
|
90
|
+
declare const logger: Logger;
|
|
91
|
+
|
|
47
92
|
interface StyleguideConfiguration {
|
|
48
93
|
mode: 'development' | 'production';
|
|
49
94
|
outDir: string;
|
|
@@ -85,6 +130,43 @@ interface StyleguideBuildOutput {
|
|
|
85
130
|
overwrittenSectionsIds?: string[];
|
|
86
131
|
};
|
|
87
132
|
}
|
|
133
|
+
interface MenuSectionMapping {
|
|
134
|
+
title: string;
|
|
135
|
+
items: {
|
|
136
|
+
label: string;
|
|
137
|
+
href: string;
|
|
138
|
+
status?: string;
|
|
139
|
+
}[];
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Expensive, parse-derived state computed once and reused across incremental rebuilds.
|
|
143
|
+
* A markup-only edit never changes section structure, so the parsed tree, navigation mappings,
|
|
144
|
+
* and lookups stay valid; only affected sections are recompiled and rewritten.
|
|
145
|
+
*/
|
|
146
|
+
interface StyleguideContext {
|
|
147
|
+
baseDirectory: string;
|
|
148
|
+
parsedContent: in2FirstLevelSection[];
|
|
149
|
+
overwrittenSectionsIds: string[];
|
|
150
|
+
sectionsById: Map<string, SectionMeta>;
|
|
151
|
+
/** section id -> original (pre-compile) markup, i.e. the compile input */
|
|
152
|
+
rawMarkupBySection: Map<string, string>;
|
|
153
|
+
/** section id -> compiled markup that is NOT yet <insert-markup>-resolved (persistent) */
|
|
154
|
+
compiledRepository: Map<string, {
|
|
155
|
+
markup: string;
|
|
156
|
+
}>;
|
|
157
|
+
/** refId -> ids whose compiled markup embeds <insert-markup>refId</insert-markup> */
|
|
158
|
+
insertMarkupConsumers: Map<string, Set<string>>;
|
|
159
|
+
headerHtml: string;
|
|
160
|
+
searchHtml: string;
|
|
161
|
+
menuSectionMapping: MenuSectionMapping[];
|
|
162
|
+
/** section id (second & third level) -> its parsed node */
|
|
163
|
+
nodeById: Map<string, in2Section>;
|
|
164
|
+
/** any section id -> the location of its owning second-level section (for preview regen) */
|
|
165
|
+
ownerLocationById: Map<string, {
|
|
166
|
+
firstLevelIndex: number;
|
|
167
|
+
secondLevelIndex: number;
|
|
168
|
+
}>;
|
|
169
|
+
}
|
|
88
170
|
/**
|
|
89
171
|
* Parse given contentDir and get structured data for further processing
|
|
90
172
|
*/
|
|
@@ -92,18 +174,44 @@ declare function parseStyleguide(contentDir: StyleguideConfiguration['contentDir
|
|
|
92
174
|
content: in2FirstLevelSection[];
|
|
93
175
|
overwrittenSectionsIds: string[];
|
|
94
176
|
}>;
|
|
177
|
+
/**
|
|
178
|
+
* Full build: parse, compile every section, and write all fullpage + preview files. Returns the
|
|
179
|
+
* reusable context so the watcher can perform targeted incremental rebuilds afterwards.
|
|
180
|
+
*/
|
|
181
|
+
declare function buildAll(config: StyleguideConfiguration): Promise<{
|
|
182
|
+
errors: StyleguideBuildOutput['errors'];
|
|
183
|
+
context: StyleguideContext;
|
|
184
|
+
}>;
|
|
95
185
|
/**
|
|
96
186
|
* Builds the styleguide
|
|
97
187
|
* @param config - The configuration for the styleguide
|
|
98
188
|
*/
|
|
99
189
|
declare function buildStyleguide(config: StyleguideConfiguration): Promise<StyleguideBuildOutput>;
|
|
190
|
+
/**
|
|
191
|
+
* Incrementally rebuild only the sections affected by a markup change: recompile their pug
|
|
192
|
+
* (cache-aware), re-resolve <insert-markup>, and rewrite just their fullpage + owning preview files.
|
|
193
|
+
* `changedSectionIds` are the sections whose pug (or a dependency) changed.
|
|
194
|
+
*/
|
|
195
|
+
declare function rebuildSections(config: StyleguideConfiguration, context: StyleguideContext, changedSectionIds: Iterable<string>): Promise<void>;
|
|
196
|
+
/**
|
|
197
|
+
* What triggered a {@link watchStyleguide} rebuild:
|
|
198
|
+
* - `structural` — a CSS/SCSS/Markdown edit that can change section structure; the whole styleguide is rebuilt.
|
|
199
|
+
* - `markup` — a Pug/HTML edit; only `sections` (those depending on `file`) are rebuilt.
|
|
200
|
+
*/
|
|
201
|
+
type StyleguideChange = {
|
|
202
|
+
type: 'structural';
|
|
203
|
+
} | {
|
|
204
|
+
type: 'markup';
|
|
205
|
+
file: string;
|
|
206
|
+
sections: string[];
|
|
207
|
+
};
|
|
100
208
|
/**
|
|
101
209
|
* Builds the styleguide and watches for changes
|
|
102
210
|
* @param config - The configuration for the styleguide
|
|
103
|
-
* @param onChange - Optional callback
|
|
211
|
+
* @param onChange - Optional callback invoked after each rebuild, with the change that triggered it
|
|
104
212
|
* @param onError - Optional callback function to call when an error occurs while building the styleguide
|
|
105
213
|
*/
|
|
106
|
-
declare function watchStyleguide(config: StyleguideConfiguration, onChange?: () => void, onError?: (errorData: StyleguideBuildOutput['errors']) => void): Promise<void>;
|
|
214
|
+
declare function watchStyleguide(config: StyleguideConfiguration, onChange?: (change: StyleguideChange) => void, onError?: (errorData: StyleguideBuildOutput['errors']) => void): Promise<void>;
|
|
107
215
|
|
|
108
|
-
export { buildStyleguide, parseStyleguide, watchStyleguide };
|
|
109
|
-
export type { StyleguideConfiguration };
|
|
216
|
+
export { buildAll, buildStyleguide, createLogger, logger, parseStyleguide, rebuildSections, watchStyleguide };
|
|
217
|
+
export type { LogBox, Logger, StyleguideChange, StyleguideConfiguration, StyleguideContext };
|