sdtk-design-kit 0.3.1 → 0.4.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.
@@ -7,6 +7,7 @@ const DEFAULT_STYLE = "minimal-saas";
7
7
  const STYLE_PRESETS = {
8
8
  "minimal-saas": {
9
9
  label: "Minimal SaaS",
10
+ category: "SaaS & Productivity",
10
11
  summary: "Clean solo-founder SaaS default with practical hierarchy, quiet surfaces, and low-decoration components.",
11
12
  typography: [
12
13
  "Use system UI, Segoe UI, Roboto, Helvetica, Arial, sans-serif.",
@@ -36,6 +37,7 @@ const STYLE_PRESETS = {
36
37
  },
37
38
  "premium-dashboard": {
38
39
  label: "Premium Dashboard",
40
+ category: "Dashboard & Data",
39
41
  summary: "Dashboard-first MVP style with stronger density, metrics, cards, tables, and command surfaces.",
40
42
  typography: [
41
43
  "Use Inter-like system sans with tabular numerals for metrics.",
@@ -65,6 +67,7 @@ const STYLE_PRESETS = {
65
67
  },
66
68
  "bold-founder": {
67
69
  label: "Bold Founder",
70
+ category: "Marketing & Launch",
68
71
  summary: "High-contrast launch style for marketing-heavy MVPs with decisive type and CTA hierarchy.",
69
72
  typography: [
70
73
  "Use a heavy display face fallback stack: Impact, Arial Black, Inter, system-ui.",
@@ -94,6 +97,7 @@ const STYLE_PRESETS = {
94
97
  },
95
98
  "warm-editorial": {
96
99
  label: "Warm Editorial",
100
+ category: "Editorial & Content",
97
101
  summary: "Softer consultant/service-product style with restrained serif-led hierarchy and warm surfaces.",
98
102
  typography: [
99
103
  "Use Georgia, Charter, or Times New Roman for display; use system sans for UI labels and forms.",
@@ -121,6 +125,122 @@ const STYLE_PRESETS = {
121
125
  "Tag row: forest-accent labels with readable text.",
122
126
  ],
123
127
  },
128
+ "ecommerce-retail": {
129
+ label: "E-Commerce Retail",
130
+ category: "E-Commerce & Retail",
131
+ summary: "Product-forward storefront style with photography-led cards, a single confident accent for CTA and price, and a sticky cart/checkout rail.",
132
+ typography: [
133
+ "Use a clean geometric/grotesque system sans: system-ui, Segoe UI, Roboto, Helvetica, Arial, sans-serif.",
134
+ "Use a 36/26/20/15/13px hierarchy; keep product names at 15-16px medium weight and prices at 18-20px bold.",
135
+ "Use tabular numerals for prices and quantities; keep letter spacing at 0 except optional 0.06em uppercase micro-labels for badges (SALE, NEW).",
136
+ ],
137
+ colors: [
138
+ "`color-bg`: #FFFFFF for the product canvas; let photography carry the visual weight.",
139
+ "`color-surface`: #FFFFFF for product cards on a #F6F7F9 alternating page tint.",
140
+ "`color-text`: #1A1D21 for product names, prices, and primary copy.",
141
+ "`color-muted`: #6B7280 for secondary metadata, shipping notes, and review counts.",
142
+ "`color-primary`: #4338CA indigo for the add-to-cart / checkout CTA and active filters.",
143
+ "`color-accent`: #E8590C pumpkin for price emphasis, sale tags, and the wishlist heart.",
144
+ "`color-success`: #1B873F in-stock, `color-warning`: #B7791F low-stock, `color-danger`: #C2330E out-of-stock or error.",
145
+ "`color-border`: #E6E8EB for quiet card edges, dividers, and input outlines.",
146
+ ],
147
+ surface: "Use white product cards with 14-20px corner radius on a soft page tint; let product imagery sit edge-to-edge with gentle rounding. Prefer hairline borders over heavy shadows; reserve a soft lift only for the sticky cart panel.",
148
+ density: "Use a responsive product grid (2-4 columns) with 16-20px gutters and generous whitespace around hero and category bands; keep cart/line-item rows compact at 12-14px.",
149
+ cta: "One dominant filled primary CTA per surface (Add to cart / Checkout); secondary actions (wishlist, compare) stay outlined or icon-only. Keep price and CTA visually paired.",
150
+ dashboard: "For seller/order views, use order-status pills with text, a compact line-item table, and clear fulfillment states; do not borrow heavy analytics chrome onto the storefront.",
151
+ mobile: "Collapse the grid to two then one column under 760px; pin the add-to-cart / total bar to the bottom on product and cart screens; keep tap targets at least 44px.",
152
+ accessibility: "Never signal stock or price state by color alone — pair with text and icons; maintain 4.5:1 contrast on price and CTA text; keep focus rings visible on cards, filters, and quantity steppers.",
153
+ elevation: "Keep most surfaces flat with hairline borders; use a single soft shadow (0 8px 24px rgba(16,24,40,0.10)) only for the sticky cart/checkout rail and modal overlays; product cards lift only on hover, not at rest.",
154
+ dosAndDonts: [
155
+ "Do let product photography be the hero; keep chrome quiet around it.",
156
+ "Do pair price and the add-to-cart CTA so the buying decision is one glance.",
157
+ "Don't use more than one accent color; reserve the accent for price and sale signals.",
158
+ "Don't stack nested cards or decorative gradients that compete with product imagery.",
159
+ ],
160
+ components: [
161
+ "Product card: image, name, price, rating/review count, add-to-cart.",
162
+ "Cart line item: thumbnail, name, variant, quantity stepper, line total, remove.",
163
+ "Sticky order summary: subtotal, shipping, total, primary checkout CTA.",
164
+ "Filter rail: category, price range, in-stock toggle with applied-filter chips.",
165
+ ],
166
+ },
167
+ "fintech-trust": {
168
+ label: "Fintech Trust",
169
+ category: "Fintech & Data",
170
+ summary: "Trust-forward financial style with dense data surfaces, tabular numerals, a restrained palette, and strong status semantics.",
171
+ typography: [
172
+ "Use a precise system sans with tabular numerals enabled everywhere numbers appear: system-ui, Inter, Segoe UI, Roboto, sans-serif.",
173
+ "Use a 30/22/18/14/12px hierarchy with heavier labels and compact metadata; align figures on the decimal.",
174
+ "Reserve monospace for account IDs, reference numbers, and timestamps only.",
175
+ ],
176
+ colors: [
177
+ "`color-bg`: #F4F6FB for the application background.",
178
+ "`color-surface`: #FFFFFF for balance cards, statements, and tables.",
179
+ "`color-text`: #0F172A for balances, labels, and primary copy.",
180
+ "`color-muted`: #5A6678 for secondary metadata and helper text.",
181
+ "`color-primary`: #1E3A8A deep navy for primary actions and active states.",
182
+ "`color-accent`: #0E7C66 teal for positive balance highlights and one chart series.",
183
+ "`color-success`: #1B873F credit/up, `color-warning`: #B7791F pending/review, `color-danger`: #C2330E debit/down or error.",
184
+ "`color-border`: #DCE2EC for table rules, card edges, and input outlines.",
185
+ ],
186
+ surface: "Use structured white cards and tables with crisp 8-10px radius on a cool page tint; keep rules and dividers hairline. Money and status must read instantly; avoid decorative surfaces that obscure figures.",
187
+ density: "Use high density: 10-12px table row gaps, aligned numeric columns with right-aligned figures, and scannable statement rows; keep summary cards calm with one headline figure each.",
188
+ cta: "Primary CTA should be compact, explicit, and reassuring (Transfer, Confirm payment); destructive or irreversible actions require a clear confirm step.",
189
+ dashboard: "Lead with 3-4 balance/KPI cards (tabular figures + trend), then a transactions table with status pills; keep gains/losses signed and color-paired with text.",
190
+ mobile: "Stack balance cards to one column; keep transaction rows readable without horizontal scroll; pin the primary action for the active account.",
191
+ accessibility: "Never signal up/down or credit/debit by color alone — pair with sign, arrow, and text; maintain 4.5:1 contrast on figures; keep focus rings visible on dense controls and table actions.",
192
+ elevation: "Keep surfaces flat and trustworthy with hairline borders; use a single restrained shadow (0 1px 2px rgba(15,23,42,0.08)) for cards and a slightly stronger lift only for modals/confirm dialogs; avoid playful depth.",
193
+ dosAndDonts: [
194
+ "Do use tabular numerals and align figures so balances are scannable.",
195
+ "Do pair every up/down or credit/debit signal with a sign, arrow, and text.",
196
+ "Don't decorate money surfaces with gradients or imagery that reduce legibility.",
197
+ "Don't hide the active account's primary action below the fold on mobile.",
198
+ ],
199
+ components: [
200
+ "Balance card: account label, balance (tabular), signed trend, last-updated.",
201
+ "Transaction row: date, payee, category, signed amount, status pill.",
202
+ "Confirm dialog: amount, recipient, fee, irreversible-action confirm.",
203
+ "Status pill: text label plus color (cleared, pending, failed).",
204
+ ],
205
+ },
206
+ "editorial-content": {
207
+ label: "Editorial Content",
208
+ category: "Editorial & Content",
209
+ summary: "Reading-first content style with a narrow measure, serif-led hierarchy, warm surfaces, and minimal chrome for articles, blogs, and marketplace listings.",
210
+ typography: [
211
+ "Use a readable serif for headings and long-form body (Georgia, Charter, 'Iowan Old Style', Times New Roman, serif); use system sans for UI labels, nav, and forms.",
212
+ "Use a 44/30/22/18/14px hierarchy with generous line-height (1.6-1.7) for body and a comfortable 66-72ch reading measure.",
213
+ "Use serif for narrative and pull quotes; keep captions, bylines, and metadata in small sans at 13-14px.",
214
+ ],
215
+ colors: [
216
+ "`color-bg`: #FBF9F5 warm paper background.",
217
+ "`color-surface`: #FFFFFF for elevated cards and media frames.",
218
+ "`color-text`: #201C17 near-black ink for body and headings.",
219
+ "`color-muted`: #857D72 for bylines, dates, and secondary metadata.",
220
+ "`color-primary`: #9A3412 burnt-sienna for primary links, CTAs, and active nav.",
221
+ "`color-accent`: #2F5B4F forest for tags, section markers, and dividers.",
222
+ "`color-border`: rgba(32,28,23,0.12) for restrained rules and card edges.",
223
+ ],
224
+ surface: "Use warm paper backgrounds with a single centered reading column; frame media edge-to-edge with gentle rounding. Prefer rules and whitespace over cards; reserve cards for related-content and listing grids.",
225
+ density: "Use generous vertical rhythm for article body (paragraph spacing ~1em, section spacing ~2.5em); use a calm 2-3 column grid with 24px gutters for listing/related content.",
226
+ cta: "Primary CTA (Subscribe, Read more, Contact seller) uses the sienna link/fill; keep it understated and inline with the reading flow rather than dominant.",
227
+ dashboard: "For author/listing management, use readable rows and notes-first cards rather than heavy analytics chrome; surface publish status and last-edit clearly.",
228
+ mobile: "Keep the reading measure narrow and centered; stack listing cards to one column; reduce section spacing by about one third while preserving body line-height.",
229
+ accessibility: "Warm palettes still need contrast checks — keep body text at 4.5:1 on paper; never rely on sienna/forest color alone for links or tags, underline or label them; keep focus visible.",
230
+ elevation: "Stay almost flat: use hairline rules and whitespace for structure; reserve a soft shadow (0 6px 20px rgba(32,28,23,0.08)) only for related-content cards and image lightboxes.",
231
+ dosAndDonts: [
232
+ "Do hold a 66-72ch measure and generous line-height for long-form readability.",
233
+ "Do use serif for narrative and sans for UI labels and forms.",
234
+ "Don't widen body text to full-bleed or crowd paragraphs together.",
235
+ "Don't signal links by color alone on warm surfaces — underline or label them.",
236
+ ],
237
+ components: [
238
+ "Article hero: serif headline, byline, date, lead image with caption.",
239
+ "Reading body: 66-72ch measure, pull quotes, inline media with captions.",
240
+ "Listing card: media, title, short excerpt, tag row, price or read-time.",
241
+ "Tag row: forest-accent labels with readable text and clear focus.",
242
+ ],
243
+ },
124
244
  };
125
245
 
126
246
  function availableStyleNames() {
@@ -141,10 +261,50 @@ function getStylePreset(style) {
141
261
  return STYLE_PRESETS[resolveStyleName(style)];
142
262
  }
143
263
 
264
+ // Extract the 6-digit hex swatches a preset declares, in author order, so a
265
+ // visual gallery can render a color row without re-parsing the prose. Captures
266
+ // every hex token across all `colors[]` lines (a single line may declare more
267
+ // than one role, e.g. success/warning/danger), skips rgba()/named values, and
268
+ // de-duplicates while preserving first-seen order.
269
+ function paletteSwatches(preset) {
270
+ const swatches = [];
271
+ const seen = new Set();
272
+ for (const line of preset.colors || []) {
273
+ const matches = line.match(/#[0-9a-fA-F]{6}\b/g) || [];
274
+ for (const hex of matches) {
275
+ const value = hex.toUpperCase();
276
+ if (!seen.has(value)) {
277
+ seen.add(value);
278
+ swatches.push(value);
279
+ }
280
+ }
281
+ }
282
+ return swatches;
283
+ }
284
+
285
+ // Read-only serialization of the preset catalog for the (future) Style Gallery
286
+ // endpoint. Carries only display-safe fields — no file paths, no secrets.
287
+ function styleCatalog() {
288
+ return availableStyleNames().map((name) => {
289
+ const preset = STYLE_PRESETS[name];
290
+ return {
291
+ name,
292
+ label: preset.label,
293
+ category: preset.category || "General",
294
+ summary: preset.summary,
295
+ swatches: paletteSwatches(preset),
296
+ typographySample: (preset.typography && preset.typography[0]) || "",
297
+ component: (preset.components && preset.components[0]) || "",
298
+ };
299
+ });
300
+ }
301
+
144
302
  module.exports = {
145
303
  DEFAULT_STYLE,
146
304
  STYLE_PRESETS,
147
305
  availableStyleNames,
148
306
  getStylePreset,
149
307
  resolveStyleName,
308
+ paletteSwatches,
309
+ styleCatalog,
150
310
  };