@kabmo-labs/kabmo 0.19.0 → 0.21.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.
Files changed (49) hide show
  1. package/README.md +32 -5
  2. package/dist/client/index.html +3 -3
  3. package/dist/client/index.js +362 -362
  4. package/dist/client/static/js/{index-sxdw908m.css → index-0721wrkf.css} +1 -1
  5. package/dist/client/static/js/{index-fcee4c13.js → index-zg32n2sk.js} +685 -685
  6. package/dist/client/static/{manifest-42r8wcmg.webmanifest → manifest-q6h8k9e0.webmanifest} +1 -1
  7. package/index.html +1 -1
  8. package/package.json +1 -1
  9. package/public/manifest.webmanifest +1 -1
  10. package/src/client/components/common/checkbox/style.test.ts +11 -8
  11. package/src/client/components/common/panel-mark/index.test.tsx +124 -0
  12. package/src/client/components/common/panel-mark/index.tsx +9 -1
  13. package/src/client/components/settings/categories/panel-plugins/GitFreshness.test.tsx +46 -0
  14. package/src/client/components/settings/categories/panel-plugins/GitFreshness.tsx +1 -1
  15. package/src/client/components/settings/categories/panel-plugins/InstalledList.tsx +7 -9
  16. package/src/client/components/settings/categories/panel-plugins/PluginCard.test.tsx +149 -0
  17. package/src/client/components/settings/categories/panel-plugins/PluginCard.tsx +33 -6
  18. package/src/client/components/settings/categories/panel-plugins/PluginMark.test.ts +15 -0
  19. package/src/client/components/settings/categories/panel-plugins/PluginMark.tsx +6 -2
  20. package/src/client/components/settings/categories/panel-plugins/Section.tsx +7 -1
  21. package/src/client/components/settings/categories/panel-plugins/Toolbar.tsx +35 -2
  22. package/src/client/glass-sticky.test.ts +46 -0
  23. package/src/client/glass.css +27 -17
  24. package/src/client/glass.test.ts +21 -61
  25. package/src/client/hooks/ui/stuck-header.test.ts +28 -3
  26. package/src/client/hooks/ui/stuck-header.ts +36 -5
  27. package/src/client/hooks/workspace/panel-registry.ts +8 -4
  28. package/src/server/lib/lifecycle/tls.test.ts +6 -1
  29. package/src/server/lib/panels/git-update.server.test.ts +20 -0
  30. package/src/server/lib/panels/git-update.server.ts +20 -4
  31. package/src/server/lib/panels/sync.server.ts +9 -1
  32. package/src/server/lib/panels/update.server.test.ts +193 -0
  33. package/src/server/lib/panels/update.server.ts +210 -0
  34. package/src/server/lib/plugins/server-half.server.ts +42 -0
  35. package/src/server/lib/terminal/attach-replay.test.ts +26 -8
  36. package/src/server/routes/panels/install-route.test.ts +238 -0
  37. package/src/server/routes/panels/install.ts +36 -64
  38. package/src/server/routes/panels/panel-routes.test-util.ts +6 -1
  39. package/src/server/routes/panels/routes.test.ts +1 -118
  40. package/src/shared/lib/icons/icon-paint-css.test.ts +8 -7
  41. package/src/shared/lib/icons/icon-paint-css.ts +2 -1
  42. package/src/shared/lib/icons/icon-paint-panel.ts +16 -7
  43. package/src/shared/lib/icons/icon-tone.ts +166 -0
  44. package/src/shared/lib/icons/tint-hues.generated.ts +50 -3
  45. package/src/shared/lib/icons/tint.test.ts +75 -15
  46. package/src/shared/lib/icons/tint.ts +40 -11
  47. package/src/shared/lib/panels/update.test.ts +107 -0
  48. package/src/shared/lib/panels/update.ts +73 -0
  49. package/src/shared/lib/theme/color.ts +50 -0
@@ -76,6 +76,56 @@ export function mixHex(base: string, blend: string, ratio: number): string {
76
76
  });
77
77
  }
78
78
 
79
+ /**
80
+ * OKLCH, for the one place sRGB arithmetic is measurably wrong: shading a hue
81
+ * toward another tone.
82
+ *
83
+ * The icon tones are the reason. Mixing `#FFD21E` toward black in sRGB keeps
84
+ * 63% of its chroma where the same move in OKLCH keeps it whole, because sRGB
85
+ * channels are not perceptually spaced — a dark yellow drifts to olive. So the
86
+ * light icon tone is *solved* here: hold the hue, take the most chroma sRGB can
87
+ * actually show at that lightness, and then check the result with WCAG contrast.
88
+ *
89
+ * Values are the standard Björn Ottosson transform: OKLab is the linear part,
90
+ * OKLCH is that in polar form.
91
+ */
92
+ export function oklchToRgb(lightness: number, chroma: number, hue: number): Rgba & { inGamut: boolean } {
93
+ const radians = (hue * Math.PI) / 180;
94
+ const a = chroma * Math.cos(radians);
95
+ const b = chroma * Math.sin(radians);
96
+
97
+ const l = (lightness + 0.3963377774 * a + 0.2158037573 * b) ** 3;
98
+ const m = (lightness - 0.1055613458 * a - 0.0638541728 * b) ** 3;
99
+ const s = (lightness - 0.0894841775 * a - 1.291485548 * b) ** 3;
100
+
101
+ // Linear-light sRGB, then the transfer function.
102
+ const linear = [
103
+ 4.0767416621 * l - 3.3077115913 * m + 0.2309699292 * s,
104
+ -1.2684380046 * l + 2.6097574011 * m - 0.3413193965 * s,
105
+ -0.0041960863 * l - 0.7034186147 * m + 1.707614701 * s,
106
+ ] as const;
107
+ const channel = (value: number) => {
108
+ const encoded = value <= 0.0031308 ? 12.92 * value : 1.055 * value ** (1 / 2.4) - 0.055;
109
+ return encoded * 255;
110
+ };
111
+ // A hair of slack: at the gamut surface the transform lands on `-1e-8`, and
112
+ // an exact test would reject colours that round to a perfectly valid byte.
113
+ const inGamut = linear.every((value) => value >= -0.0005 && value <= 1.0005);
114
+ return { r: channel(linear[0]), g: channel(linear[1]), b: channel(linear[2]), a: 1, inGamut };
115
+ }
116
+
117
+ /** The most chroma sRGB can show at this lightness and hue. */
118
+ export function maxChromaInGamut(lightness: number, hue: number): number {
119
+ let low = 0;
120
+ let high = 0.4;
121
+ for (let step = 0; step < 16; step += 1) {
122
+ const mid = (low + high) / 2;
123
+ if (oklchToRgb(lightness, mid, hue).inGamut) low = mid;
124
+ else high = mid;
125
+ }
126
+ return low;
127
+ }
128
+
79
129
  /** WCAG relative luminance, used to order two palette colors light-to-dark. */
80
130
  export function relativeLuminance(value: string): number {
81
131
  const color = parseHexColor(value);