@lgtm-hq/turbo-themes 0.27.0 → 0.28.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.
Files changed (38) hide show
  1. package/dist/adapters/tailwind/{colors-BI7jSURT.js → colors-ChP8kNTH.js} +93 -17
  2. package/dist/adapters/tailwind/colors.js +1 -1
  3. package/dist/adapters/tailwind/preset.js +1 -1
  4. package/dist/tokens/style-dictionary/themes.json +2 -2
  5. package/dist/tokens/style-dictionary/tokens.json +2 -2
  6. package/package.json +2 -2
  7. package/packages/adapters/tailwind/dist/{colors-BI7jSURT.js → colors-ChP8kNTH.js} +93 -17
  8. package/packages/adapters/tailwind/dist/colors-ChP8kNTH.js.map +1 -0
  9. package/packages/adapters/tailwind/dist/colors.js +1 -1
  10. package/packages/adapters/tailwind/dist/preset.js +1 -1
  11. package/packages/core/dist/catalog/index.d.ts +51 -0
  12. package/packages/core/dist/catalog/index.d.ts.map +1 -0
  13. package/packages/core/dist/catalog/index.js +79 -0
  14. package/packages/core/dist/catalog/index.js.map +1 -0
  15. package/packages/core/dist/catalog/sets.d.ts +22 -0
  16. package/packages/core/dist/catalog/sets.d.ts.map +1 -0
  17. package/packages/core/dist/catalog/sets.js +29 -0
  18. package/packages/core/dist/catalog/sets.js.map +1 -0
  19. package/packages/core/dist/index.d.ts +4 -0
  20. package/packages/core/dist/index.d.ts.map +1 -1
  21. package/packages/core/dist/index.js +3 -0
  22. package/packages/core/dist/index.js.map +1 -1
  23. package/packages/core/dist/themes/generated-types.d.ts +208 -0
  24. package/packages/core/dist/themes/generated-types.d.ts.map +1 -0
  25. package/packages/core/dist/themes/generated-types.js +7 -0
  26. package/packages/core/dist/themes/generated-types.js.map +1 -0
  27. package/packages/core/dist/themes/theme-ids.d.ts +8 -0
  28. package/packages/core/dist/themes/theme-ids.d.ts.map +1 -0
  29. package/packages/core/dist/themes/theme-ids.js +39 -0
  30. package/packages/core/dist/themes/theme-ids.js.map +1 -0
  31. package/packages/core/dist/themes/tokens.json +2 -2
  32. package/packages/core/dist/tokens/index.d.ts +2 -0
  33. package/packages/core/dist/tokens/index.d.ts.map +1 -1
  34. package/packages/core/dist/tokens/index.js +1 -0
  35. package/packages/core/dist/tokens/index.js.map +1 -1
  36. package/packages/theme-selector/dist/index.js +56 -2
  37. package/packages/theme-selector/dist/index.js.map +1 -1
  38. package/packages/adapters/tailwind/dist/colors-BI7jSURT.js.map +0 -1
@@ -1,24 +1,10 @@
1
1
  //#endregion
2
2
  //#region ../../core/dist/tokens/index.js
3
- /**
4
- * Platform-agnostic design tokens export
5
- *
6
- * This module exports pure theme data (colors, typography, etc.) without
7
- * any DOM, CSS, or platform-specific code. Use this for:
8
- *
9
- * - React Native apps
10
- * - Flutter apps (via JSON export)
11
- * - iOS/Android native apps
12
- * - Any platform that needs theme colors
13
- *
14
- * For web apps, you can also import the CSS files directly:
15
- * import '@lgtm-hq/turbo-themes/css/catppuccin-mocha.css'
16
- */
17
3
  var tokens = {
18
4
  $schema: "https://design-tokens.org/schema.json",
19
5
  $description: "Turbo Themes - Flat tokens for 27 themes",
20
- $version: "0.27.0",
21
- $generated: "97d2eb2a06c98ae3fe744ed4e8a81843f9973a7673916438b57f0ac72d478295",
6
+ $version: "0.28.1",
7
+ $generated: "2c421293b2067bc5372e4942e9bfb2ac40d4de7b61ee3ec20b0349bd2a13bec4",
22
8
  meta: {
23
9
  "themeIds": [
24
10
  "bulma-dark",
@@ -216,6 +202,14 @@ var VENDOR_ORDER = [
216
202
  ];
217
203
  var _missingFromOrder = Object.keys(packages).filter((id) => !VENDOR_ORDER.includes(id));
218
204
  if (_missingFromOrder.length > 0) console.warn(`[metadata] VENDOR_ORDER is missing vendor IDs present in packages: ${_missingFromOrder.join(", ")}. Append them to VENDOR_ORDER so their themes are included in VENDOR_GROUPS.`);
205
+ var VENDOR_GROUPS = /* @__PURE__ */ VENDOR_ORDER.filter((id) => id in packages).map((id) => {
206
+ const pkg = packages[id];
207
+ return {
208
+ id,
209
+ displayName: pkg.name.replace(/\s*\(synced\)\s*/i, ""),
210
+ themeIds: pkg.flavors.flatMap((f) => f ? [f.id] : [])
211
+ };
212
+ });
219
213
  /** O(1) flavor lookup by ID, built once at module evaluation time. */
220
214
  var flavorById = /* @__PURE__ */ new Map(flavors.map((f) => [f.id, f]));
221
215
  /** Cache for computed short labels. */
@@ -255,6 +249,88 @@ function getShortLabel(themeId) {
255
249
  }
256
250
  flavors.map((f) => [f.id, getShortLabel(f.id)]);
257
251
  //#endregion
252
+ //#region ../../core/dist/catalog/index.js
253
+ /**
254
+ * Consumer theme curation API.
255
+ *
256
+ * `createThemeCatalog()` provides a single, composable surface for selecting a
257
+ * subset of themes. It composes with the existing `flavors` (tokens) and
258
+ * `VENDOR_GROUPS` (metadata) so consumers no longer need to hand-slice arrays.
259
+ *
260
+ * Filter precedence:
261
+ * all themes -> vendors/appearances -> include -> exclude
262
+ *
263
+ * Invalid IDs supplied to `include`/`exclude` warn in development (never
264
+ * throw), so a typo cannot silently drop or duplicate a theme.
265
+ */
266
+ var KNOWN_THEME_IDS = new Set(themeIds);
267
+ /**
268
+ * Emit a dev-time warning for unknown IDs. Bundlers replace
269
+ * `process.env.NODE_ENV` with the literal `"production"` and eliminate this
270
+ * branch via dead-code removal, so production builds never log.
271
+ */
272
+ function warnInvalidIds(source, ids) {
273
+ if (ids.length === 0) return;
274
+ if (process.env.NODE_ENV === "production") return;
275
+ console.warn(`[catalog] createThemeCatalog: ignoring unknown ${source} theme ID(s): ${ids.join(", ")}. Valid IDs come from the exported \`themeIds\`.`);
276
+ }
277
+ /**
278
+ * Build a curated {@link ThemeCatalog} from the full theme set.
279
+ *
280
+ * @param options - Vendor/appearance filters plus explicit include/exclude IDs.
281
+ * @returns A catalog exposing `themeIds`, `flavors`, and `vendorGroups`.
282
+ */
283
+ function createThemeCatalog(options = {}) {
284
+ const { vendors, appearances, include = [], exclude = [] } = options;
285
+ const selected = /* @__PURE__ */ new Set();
286
+ for (const flavor of flavors) {
287
+ if (vendors !== void 0 && !vendors.includes(flavor.vendor)) continue;
288
+ if (appearances !== void 0 && !appearances.includes(flavor.appearance)) continue;
289
+ selected.add(flavor.id);
290
+ }
291
+ const invalidInclude = [];
292
+ for (const id of include) if (KNOWN_THEME_IDS.has(id)) selected.add(id);
293
+ else invalidInclude.push(id);
294
+ warnInvalidIds("include", invalidInclude);
295
+ const invalidExclude = [];
296
+ for (const id of exclude) if (KNOWN_THEME_IDS.has(id)) selected.delete(id);
297
+ else invalidExclude.push(id);
298
+ warnInvalidIds("exclude", invalidExclude);
299
+ const selectedFlavors = flavors.filter((flavor) => selected.has(flavor.id));
300
+ return {
301
+ themeIds: selectedFlavors.map((flavor) => flavor.id),
302
+ flavors: selectedFlavors,
303
+ vendorGroups: VENDOR_GROUPS.map((group) => ({
304
+ ...group,
305
+ themeIds: group.themeIds.filter((id) => selected.has(id))
306
+ })).filter((group) => group.themeIds.length > 0)
307
+ };
308
+ }
309
+ //#endregion
310
+ //#region ../../core/dist/catalog/sets.js
311
+ /**
312
+ * Named theme presets built on top of {@link createThemeCatalog}.
313
+ *
314
+ * These provide opinionated defaults so consumers don't rebuild the same
315
+ * "minimal" or "dark-only" lists in every app. Per-vendor sets are derived
316
+ * from the `packages` keys, so new vendor variants appear automatically on
317
+ * upgrade for opted-in vendors.
318
+ */
319
+ /**
320
+ * The curated "minimal" starter set: one light + one dark theme from the two
321
+ * most common vendors.
322
+ */
323
+ var MINIMAL_THEME_IDS = [
324
+ "catppuccin-mocha",
325
+ "catppuccin-latte",
326
+ "github-light",
327
+ "github-dark"
328
+ ];
329
+ ({ ...Object.fromEntries(Object.keys(packages).map((vendor) => [vendor, createThemeCatalog({ vendors: [vendor] })])) }), createThemeCatalog({
330
+ vendors: [],
331
+ include: MINIMAL_THEME_IDS
332
+ }), createThemeCatalog({ appearances: ["dark"] }), createThemeCatalog({ appearances: ["light"] });
333
+ //#endregion
258
334
  //#region colors.ts
259
335
  /**
260
336
  * Color mappings for Tailwind preset
@@ -372,4 +448,4 @@ function createThemeCssVariables(themeId) {
372
448
  //#endregion
373
449
  export { themeIds as a, getTheme as i, createThemeCssVariables as n, themesById as o, getAllThemeColors as r, createColorMappings as t };
374
450
 
375
- //# sourceMappingURL=colors-BI7jSURT.js.map
451
+ //# sourceMappingURL=colors-ChP8kNTH.js.map
@@ -1,2 +1,2 @@
1
- import { n as createThemeCssVariables, r as getAllThemeColors, t as createColorMappings } from "./colors-BI7jSURT.js";
1
+ import { n as createThemeCssVariables, r as getAllThemeColors, t as createColorMappings } from "./colors-ChP8kNTH.js";
2
2
  export { createColorMappings, createThemeCssVariables, getAllThemeColors };
@@ -1,4 +1,4 @@
1
- import { a as themeIds, i as getTheme, o as themesById, t as createColorMappings } from "./colors-BI7jSURT.js";
1
+ import { a as themeIds, i as getTheme, o as themesById, t as createColorMappings } from "./colors-ChP8kNTH.js";
2
2
  //#region preset.ts
3
3
  /**
4
4
  * Tailwind CSS preset for Turbo Themes
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "$schema": "https://design-tokens.org/schema.json",
3
3
  "$description": "Turbo Themes - Design tokens for 27 themes",
4
- "$version": "0.27.0",
5
- "$generated": "956991011f323f365ba1cba0836b8fe9d8ba2f3d4d1196e630a2258df2cfbd84",
4
+ "$version": "0.28.1",
5
+ "$generated": "64fa6c532233e415185858228bf6cc0ca21d65da22d47ab0182f5ee0ee11bca7",
6
6
  "meta": {
7
7
  "themeIds": [
8
8
  "bulma-dark",
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "$schema": "https://design-tokens.org/schema.json",
3
3
  "$description": "Turbo Themes - Flat tokens for 27 themes",
4
- "$version": "0.27.0",
5
- "$generated": "97d2eb2a06c98ae3fe744ed4e8a81843f9973a7673916438b57f0ac72d478295",
4
+ "$version": "0.28.1",
5
+ "$generated": "2c421293b2067bc5372e4942e9bfb2ac40d4de7b61ee3ec20b0349bd2a13bec4",
6
6
  "meta": {
7
7
  "themeIds": [
8
8
  "bulma-dark",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lgtm-hq/turbo-themes",
3
- "version": "0.27.0",
3
+ "version": "0.28.1",
4
4
  "description": "Universal theme packs and an accessible theme selector.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -118,7 +118,7 @@
118
118
  "generate:css": "cd packages/css && bun run build:css && cd ../.. && bun run generate:css-dts",
119
119
  "generate:css-dts": "node scripts/generate-css-dts.mjs",
120
120
  "generate:types": "node scripts/codegen/generate-types.mjs --all",
121
- "generate:types:ts": "node scripts/codegen/generate-ts-types.mjs",
121
+ "generate:types:ts": "node scripts/codegen/generate-ts-types.mjs && node scripts/codegen/generate-theme-ids.mjs",
122
122
  "generate:types:python": "node scripts/codegen/generate-python-types.mjs",
123
123
  "generate:types:swift": "node scripts/codegen/generate-swift-types.mjs",
124
124
  "generate:python": "bun run build:tokens && bun run generate:types:python",
@@ -1,24 +1,10 @@
1
1
  //#endregion
2
2
  //#region ../../core/dist/tokens/index.js
3
- /**
4
- * Platform-agnostic design tokens export
5
- *
6
- * This module exports pure theme data (colors, typography, etc.) without
7
- * any DOM, CSS, or platform-specific code. Use this for:
8
- *
9
- * - React Native apps
10
- * - Flutter apps (via JSON export)
11
- * - iOS/Android native apps
12
- * - Any platform that needs theme colors
13
- *
14
- * For web apps, you can also import the CSS files directly:
15
- * import '@lgtm-hq/turbo-themes/css/catppuccin-mocha.css'
16
- */
17
3
  var tokens = {
18
4
  $schema: "https://design-tokens.org/schema.json",
19
5
  $description: "Turbo Themes - Flat tokens for 27 themes",
20
- $version: "0.27.0",
21
- $generated: "97d2eb2a06c98ae3fe744ed4e8a81843f9973a7673916438b57f0ac72d478295",
6
+ $version: "0.28.1",
7
+ $generated: "2c421293b2067bc5372e4942e9bfb2ac40d4de7b61ee3ec20b0349bd2a13bec4",
22
8
  meta: {
23
9
  "themeIds": [
24
10
  "bulma-dark",
@@ -216,6 +202,14 @@ var VENDOR_ORDER = [
216
202
  ];
217
203
  var _missingFromOrder = Object.keys(packages).filter((id) => !VENDOR_ORDER.includes(id));
218
204
  if (_missingFromOrder.length > 0) console.warn(`[metadata] VENDOR_ORDER is missing vendor IDs present in packages: ${_missingFromOrder.join(", ")}. Append them to VENDOR_ORDER so their themes are included in VENDOR_GROUPS.`);
205
+ var VENDOR_GROUPS = /* @__PURE__ */ VENDOR_ORDER.filter((id) => id in packages).map((id) => {
206
+ const pkg = packages[id];
207
+ return {
208
+ id,
209
+ displayName: pkg.name.replace(/\s*\(synced\)\s*/i, ""),
210
+ themeIds: pkg.flavors.flatMap((f) => f ? [f.id] : [])
211
+ };
212
+ });
219
213
  /** O(1) flavor lookup by ID, built once at module evaluation time. */
220
214
  var flavorById = /* @__PURE__ */ new Map(flavors.map((f) => [f.id, f]));
221
215
  /** Cache for computed short labels. */
@@ -255,6 +249,88 @@ function getShortLabel(themeId) {
255
249
  }
256
250
  flavors.map((f) => [f.id, getShortLabel(f.id)]);
257
251
  //#endregion
252
+ //#region ../../core/dist/catalog/index.js
253
+ /**
254
+ * Consumer theme curation API.
255
+ *
256
+ * `createThemeCatalog()` provides a single, composable surface for selecting a
257
+ * subset of themes. It composes with the existing `flavors` (tokens) and
258
+ * `VENDOR_GROUPS` (metadata) so consumers no longer need to hand-slice arrays.
259
+ *
260
+ * Filter precedence:
261
+ * all themes -> vendors/appearances -> include -> exclude
262
+ *
263
+ * Invalid IDs supplied to `include`/`exclude` warn in development (never
264
+ * throw), so a typo cannot silently drop or duplicate a theme.
265
+ */
266
+ var KNOWN_THEME_IDS = new Set(themeIds);
267
+ /**
268
+ * Emit a dev-time warning for unknown IDs. Bundlers replace
269
+ * `process.env.NODE_ENV` with the literal `"production"` and eliminate this
270
+ * branch via dead-code removal, so production builds never log.
271
+ */
272
+ function warnInvalidIds(source, ids) {
273
+ if (ids.length === 0) return;
274
+ if (process.env.NODE_ENV === "production") return;
275
+ console.warn(`[catalog] createThemeCatalog: ignoring unknown ${source} theme ID(s): ${ids.join(", ")}. Valid IDs come from the exported \`themeIds\`.`);
276
+ }
277
+ /**
278
+ * Build a curated {@link ThemeCatalog} from the full theme set.
279
+ *
280
+ * @param options - Vendor/appearance filters plus explicit include/exclude IDs.
281
+ * @returns A catalog exposing `themeIds`, `flavors`, and `vendorGroups`.
282
+ */
283
+ function createThemeCatalog(options = {}) {
284
+ const { vendors, appearances, include = [], exclude = [] } = options;
285
+ const selected = /* @__PURE__ */ new Set();
286
+ for (const flavor of flavors) {
287
+ if (vendors !== void 0 && !vendors.includes(flavor.vendor)) continue;
288
+ if (appearances !== void 0 && !appearances.includes(flavor.appearance)) continue;
289
+ selected.add(flavor.id);
290
+ }
291
+ const invalidInclude = [];
292
+ for (const id of include) if (KNOWN_THEME_IDS.has(id)) selected.add(id);
293
+ else invalidInclude.push(id);
294
+ warnInvalidIds("include", invalidInclude);
295
+ const invalidExclude = [];
296
+ for (const id of exclude) if (KNOWN_THEME_IDS.has(id)) selected.delete(id);
297
+ else invalidExclude.push(id);
298
+ warnInvalidIds("exclude", invalidExclude);
299
+ const selectedFlavors = flavors.filter((flavor) => selected.has(flavor.id));
300
+ return {
301
+ themeIds: selectedFlavors.map((flavor) => flavor.id),
302
+ flavors: selectedFlavors,
303
+ vendorGroups: VENDOR_GROUPS.map((group) => ({
304
+ ...group,
305
+ themeIds: group.themeIds.filter((id) => selected.has(id))
306
+ })).filter((group) => group.themeIds.length > 0)
307
+ };
308
+ }
309
+ //#endregion
310
+ //#region ../../core/dist/catalog/sets.js
311
+ /**
312
+ * Named theme presets built on top of {@link createThemeCatalog}.
313
+ *
314
+ * These provide opinionated defaults so consumers don't rebuild the same
315
+ * "minimal" or "dark-only" lists in every app. Per-vendor sets are derived
316
+ * from the `packages` keys, so new vendor variants appear automatically on
317
+ * upgrade for opted-in vendors.
318
+ */
319
+ /**
320
+ * The curated "minimal" starter set: one light + one dark theme from the two
321
+ * most common vendors.
322
+ */
323
+ var MINIMAL_THEME_IDS = [
324
+ "catppuccin-mocha",
325
+ "catppuccin-latte",
326
+ "github-light",
327
+ "github-dark"
328
+ ];
329
+ ({ ...Object.fromEntries(Object.keys(packages).map((vendor) => [vendor, createThemeCatalog({ vendors: [vendor] })])) }), createThemeCatalog({
330
+ vendors: [],
331
+ include: MINIMAL_THEME_IDS
332
+ }), createThemeCatalog({ appearances: ["dark"] }), createThemeCatalog({ appearances: ["light"] });
333
+ //#endregion
258
334
  //#region colors.ts
259
335
  /**
260
336
  * Color mappings for Tailwind preset
@@ -372,4 +448,4 @@ function createThemeCssVariables(themeId) {
372
448
  //#endregion
373
449
  export { themeIds as a, getTheme as i, createThemeCssVariables as n, themesById as o, getAllThemeColors as r, createColorMappings as t };
374
450
 
375
- //# sourceMappingURL=colors-BI7jSURT.js.map
451
+ //# sourceMappingURL=colors-ChP8kNTH.js.map