hextimator 0.12.0 → 0.12.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/CHANGELOG.md CHANGED
@@ -1,3 +1,11 @@
1
+ ## 0.12.1
2
+
3
+ ### Patch Changes
4
+
5
+ - [#152](https://github.com/fgrgic/hextimator/pull/152) [`5de9e29`](https://github.com/fgrgic/hextimator/commit/5de9e2933cf57f2f323aa283c6eea15678665edc) Thanks [@fgrgic](https://github.com/fgrgic)! - trims the keywords of the package
6
+
7
+ - [#157](https://github.com/fgrgic/hextimator/pull/157) [`0fe89fa`](https://github.com/fgrgic/hextimator/commit/0fe89fa52a472f271b649360abeac6f2cbd80ffd) Thanks [@fgrgic](https://github.com/fgrgic)! - Fix `-f json` double-encoding in the CLI. With the default `--theme both`, the `light` and `dark` values were emitted as escaped JSON strings nested inside JSON, breaking `jq` pipelines. The CLI now emits a single, correctly-encoded JSON document with `light`/`dark` as real objects.
8
+
1
9
  ## 0.12.0
2
10
 
3
11
  ### Minor Changes
package/README.md CHANGED
@@ -10,6 +10,8 @@ Per-tenant themes from a single brand color: Runtime theming for B2B2C and white
10
10
 
11
11
  Your customers pick a brand color. Your app looks good. Every time. No per-customer design reviews, no manual tuning, no edge cases where "that shade of yellow" breaks your UI.
12
12
 
13
+ Each call adds well under a millisecond (~0.4ms [^perf]) and is fully deterministic: the same color and options always produce identical tokens. Therefore, it is safe to run on the request path and trivial to cache.
14
+
13
15
  Try it in the playground: **[hextimator.com](https://hextimator.com)**
14
16
 
15
17
  ## Why `hextimator` exists
@@ -92,3 +94,5 @@ Plus **`brand-exact`** (your input color, unmodified) and **`brand-exact-foregro
92
94
  ## Contributing
93
95
 
94
96
  Issues and PRs are welcome at [github.com/fgrgic/hextimator](https://github.com/fgrgic/hextimator/issues).
97
+
98
+ [^perf]: Measured on a MacBook with Apple Silicon (M2 Max) under Bun. Treat it as a ballpark; your hardware and runtime will vary.
package/dist/cli.js CHANGED
@@ -2858,7 +2858,9 @@ function run() {
2858
2858
  const preset = AVAILABLE_PRESETS[name];
2859
2859
  if (!preset) {
2860
2860
  console.error(
2861
- `Error: unknown preset "${name}". Available: ${Object.keys(AVAILABLE_PRESETS).join(", ")}`
2861
+ `Error: unknown preset "${name}". Available: ${Object.keys(
2862
+ AVAILABLE_PRESETS
2863
+ ).join(", ")}`
2862
2864
  );
2863
2865
  process.exit(1);
2864
2866
  }
@@ -2961,18 +2963,7 @@ function run() {
2961
2963
  if (values.selector) {
2962
2964
  formatOptions.selector = values.selector;
2963
2965
  }
2964
- const result = builder.format(formatOptions);
2965
- const themeFilter = values.theme;
2966
- let output;
2967
- if (typeof result === "string") {
2968
- output = result;
2969
- } else if (themeFilter === "light") {
2970
- output = serialize(result.light);
2971
- } else if (themeFilter === "dark") {
2972
- output = serialize(result.dark);
2973
- } else {
2974
- output = serialize({ light: result.light, dark: result.dark });
2975
- }
2966
+ const output = renderOutput(builder, formatOptions, values.theme);
2976
2967
  if (values.output) {
2977
2968
  writeFileSync(values.output, `${output}
2978
2969
  `);
@@ -2980,13 +2971,26 @@ function run() {
2980
2971
  console.log(output);
2981
2972
  }
2982
2973
  }
2974
+ function renderOutput(builder, formatOptions, themeFilter) {
2975
+ if (formatOptions.as === "json") formatOptions.as = "object";
2976
+ const result = builder.format(formatOptions);
2977
+ if (typeof result === "string") return result;
2978
+ if (themeFilter === "light") return serialize(result.light);
2979
+ if (themeFilter === "dark") return serialize(result.dark);
2980
+ return serialize({ light: result.light, dark: result.dark });
2981
+ }
2983
2982
  function serialize(value) {
2984
2983
  if (typeof value === "string") return value;
2985
2984
  return JSON.stringify(value, null, 2);
2986
2985
  }
2987
- try {
2988
- run();
2989
- } catch (err) {
2990
- console.error(`Error: ${err instanceof Error ? err.message : String(err)}`);
2991
- process.exit(1);
2986
+ if (process.argv[1] === fileURLToPath(import.meta.url)) {
2987
+ try {
2988
+ run();
2989
+ } catch (err) {
2990
+ console.error(`Error: ${err instanceof Error ? err.message : String(err)}`);
2991
+ process.exit(1);
2992
+ }
2992
2993
  }
2994
+ export {
2995
+ renderOutput
2996
+ };
package/package.json CHANGED
@@ -1,32 +1,18 @@
1
1
  {
2
2
  "name": "hextimator",
3
- "version": "0.12.0",
3
+ "version": "0.12.1",
4
4
  "description": "Runtime theming for multi-tenant apps: per-tenant branded themes from a single brand color, with WCAG contrast guarantees.",
5
5
  "keywords": [
6
- "runtime-theming",
7
- "multi-tenant",
8
- "per-tenant",
9
- "wcag",
10
- "b2b2c",
11
- "b2b",
12
- "saas-theming",
13
- "white-label",
14
- "no-code",
15
- "cms",
16
- "design-system",
17
- "multi-brand",
18
- "color",
19
- "palette",
20
- "generator",
21
- "creator",
22
- "oklch",
23
- "theme",
6
+ "color-palette",
7
+ "palette-generator",
24
8
  "design-tokens",
25
- "dark-mode",
26
- "accessibility",
9
+ "theme",
10
+ "oklch",
11
+ "wcag",
27
12
  "contrast",
28
- "brand-color",
29
- "tailwind-theme"
13
+ "multi-tenant",
14
+ "runtime-theming",
15
+ "tailwind"
30
16
  ],
31
17
  "homepage": "https://hextimator.com",
32
18
  "bugs": {