@kungal/ui-vue 1.6.3 → 1.7.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,36 @@
1
1
  # @kungal/ui-vue
2
2
 
3
+ ## 1.7.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 82de3b5: feat(tokens): regenerate the semantic palette in OKLCH with contrast-guaranteed on-colors
8
+
9
+ The whole semantic color system is now **generated** (scripts/gen-tokens.mjs,
10
+ OKLCH via culori) instead of hand-authored HSL. Each hue is defined once by its
11
+ OKLCH hue + a vivid `solidL`; every shade is laid on a perceptual lightness ramp
12
+ (so `-500` means the same perceived lightness for every color), and each color
13
+ ships a paired **`--color-{c}-foreground`** on-color DERIVED by measured WCAG
14
+ contrast. The generator asserts AA on every solid (fill, text) pair in BOTH light
15
+ and dark and fails the build on any regression — illegible solids can't ship
16
+ again. Adds the previously-missing `-950` shade.
17
+
18
+ What changes visually: solids keep HeroUI-style vivid fills (bright amber warning,
19
+ bright green success — no more muddy darkened `-600` fills), with white text on
20
+ the medium hues (primary/danger/default) and a refined dark tint on the bright
21
+ ones (secondary/success/warning/info). Solids are now mode-independent, so the
22
+ per-variant `dark:bg-{c}-{n}` pins are gone. **This is a visual change** to every
23
+ colored surface; the component API (color/variant names) is unchanged.
24
+
25
+ `@kungal/ui-core`: `kunSolidClasses` / `kunSolidFgClasses` / `kunSolidBgClasses`
26
+ and the Button solid/shadow rows now use `bg-{c} text-{c}-foreground`. CheckBox,
27
+ DatePicker, Switch, Carousel drop their hardcoded white/black + dark pins.
28
+
29
+ ### Patch Changes
30
+
31
+ - Updated dependencies [82de3b5]
32
+ - @kungal/ui-core@1.7.0
33
+
3
34
  ## 1.6.3
4
35
 
5
36
  ### Patch Changes
@@ -1 +1 @@
1
- {"version":3,"file":"CheckBox.vue.d.ts","sourceRoot":"","sources":["../../src/components/CheckBox.vue"],"names":[],"mappings":"AAwLA,OAAO,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,KAAK,EAAE,OAAO,OAAO,KAAK,GAAG,CAAA;CAAE,CAAC;AAO/C,QAAA,MAAM,UAAU;;;;;;;;;;;;;;;;;;;6EAId,CAAC;AACH,QAAA,MAAM,YAAY,EAAS,eAAe,CAAC,OAAO,UAAU,EAAE,WAAW,CAAC,CAAC;wBACtD,OAAO,YAAY;AAAxC,wBAAyC;AAWzC,KAAK,eAAe,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IAChC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KACV,CAAA;CACD,CAAC"}
package/dist/index.js CHANGED
@@ -1261,7 +1261,7 @@ var tt = Symbol("kun-accordion"), nt = /* @__PURE__ */ p({
1261
1261
  type: "button",
1262
1262
  "aria-label": `跳到第 ${e} 张`,
1263
1263
  "aria-current": a.value === e - 1 ? "true" : void 0,
1264
- class: y(P(q)("h-2 rounded-full transition-all", a.value === e - 1 ? "bg-primary dark:bg-primary-400 w-5" : "bg-default-300 hover:bg-default-400 w-2")),
1264
+ class: y(P(q)("h-2 rounded-full transition-all", a.value === e - 1 ? "bg-primary w-5" : "bg-default-300 hover:bg-default-400 w-2")),
1265
1265
  onClick: (t) => _(e - 1)
1266
1266
  }, null, 10, Rn))), 128))])) : c("", !0)
1267
1267
  ], 42, Pn));
@@ -1340,22 +1340,22 @@ var tt = Symbol("kun-accordion"), nt = /* @__PURE__ */ p({
1340
1340
  let t = e.target.checked;
1341
1341
  a.value = t, s("change", t);
1342
1342
  }, h = {
1343
- default: "border-default-300 checked:bg-default dark:checked:bg-default-400 checked:border-default hover:border-default",
1344
- primary: "border-primary-300 checked:bg-primary dark:checked:bg-primary-400 checked:border-primary hover:border-primary",
1345
- secondary: "border-secondary-300 checked:bg-secondary dark:checked:bg-secondary-300 checked:border-secondary hover:border-secondary",
1346
- success: "border-success-300 checked:bg-success-600 dark:checked:bg-success-400 checked:border-success hover:border-success",
1347
- warning: "border-warning-300 checked:bg-warning dark:checked:bg-warning-400 checked:border-warning hover:border-warning",
1348
- danger: "border-danger-300 checked:bg-danger dark:checked:bg-danger-400 checked:border-danger hover:border-danger",
1349
- info: "border-info-300 checked:bg-info-600 dark:checked:bg-info-300 checked:border-info hover:border-info"
1343
+ default: "border-default-300 checked:bg-default checked:border-default hover:border-default",
1344
+ primary: "border-primary-300 checked:bg-primary checked:border-primary hover:border-primary",
1345
+ secondary: "border-secondary-300 checked:bg-secondary checked:border-secondary hover:border-secondary",
1346
+ success: "border-success-300 checked:bg-success checked:border-success hover:border-success",
1347
+ warning: "border-warning-300 checked:bg-warning checked:border-warning hover:border-warning",
1348
+ danger: "border-danger-300 checked:bg-danger checked:border-danger hover:border-danger",
1349
+ info: "border-info-300 checked:bg-info checked:border-info hover:border-info"
1350
1350
  }, g = {
1351
- default: "bg-default dark:bg-default-400 border-default",
1352
- primary: "bg-primary dark:bg-primary-400 border-primary",
1353
- secondary: "bg-secondary dark:bg-secondary-300 border-secondary",
1354
- success: "bg-success-600 dark:bg-success-400 border-success",
1355
- warning: "bg-warning dark:bg-warning-400 border-warning",
1356
- danger: "bg-danger dark:bg-danger-400 border-danger",
1357
- info: "bg-info-600 dark:bg-info-300 border-info"
1358
- }, _ = o(() => he[n.color]), v = o(() => _.value === "text-black" ? "bg-black" : "bg-white");
1351
+ default: "bg-default border-default",
1352
+ primary: "bg-primary border-primary",
1353
+ secondary: "bg-secondary border-secondary",
1354
+ success: "bg-success border-success",
1355
+ warning: "bg-warning border-warning",
1356
+ danger: "bg-danger border-danger",
1357
+ info: "bg-info border-info"
1358
+ }, _ = o(() => he[n.color]);
1359
1359
  return (t, o) => (w(), l("div", null, [u("div", { class: y(P(q)("flex cursor-pointer items-center", r.value.gap, e.className)) }, [
1360
1360
  u("div", Vn, [
1361
1361
  u("input", {
@@ -1375,7 +1375,7 @@ var tt = Symbol("kun-accordion"), nt = /* @__PURE__ */ p({
1375
1375
  name: "lucide:check",
1376
1376
  class: y(r.value.check)
1377
1377
  }, null, 8, ["class"])], 2), [[B, !e.indeterminate]]),
1378
- W(u("div", Un, [u("span", { class: y(["h-0.5 rounded-full", [i[n.size], v.value]]) }, null, 2)], 512), [[B, e.indeterminate]])
1378
+ W(u("div", Un, [u("span", { class: y(["h-0.5 rounded-full bg-current", [i[n.size], _.value]]) }, null, 2)], 512), [[B, e.indeterminate]])
1379
1379
  ]),
1380
1380
  k(t.$slots, "default"),
1381
1381
  e.label ? (w(), l("label", {
@@ -1546,9 +1546,9 @@ var tt = Symbol("kun-accordion"), nt = /* @__PURE__ */ p({
1546
1546
  height: "1.85rem",
1547
1547
  padding: "0",
1548
1548
  cursor: "pointer",
1549
- color: "hsl(var(--foreground))",
1550
- background: "hsl(var(--content1))",
1551
- border: "1px solid var(--color-kun-border, hsla(var(--foreground), 0.14))",
1549
+ color: "oklch(var(--foreground))",
1550
+ background: "oklch(var(--content1))",
1551
+ border: "1px solid var(--color-kun-border, oklch(var(--foreground) / 0.14))",
1552
1552
  borderRadius: "0.5rem",
1553
1553
  opacity: "0.75",
1554
1554
  transition: "opacity 0.15s, color 0.15s"
@@ -1567,8 +1567,8 @@ var tt = Symbol("kun-accordion"), nt = /* @__PURE__ */ p({
1567
1567
  if (!t) return;
1568
1568
  let n = (t.querySelector("code") ?? t).textContent ?? "";
1569
1569
  navigator.clipboard.writeText(n).then(() => {
1570
- e.classList.add("copied"), e.classList.contains("kun-prose-copy") ? (e.replaceChildren(Er(Tr)), e.style.color = "hsl(var(--success-500))", setTimeout(() => {
1571
- e.replaceChildren(Er(wr)), e.style.color = "hsl(var(--foreground))", e.classList.remove("copied");
1570
+ e.classList.add("copied"), e.classList.contains("kun-prose-copy") ? (e.replaceChildren(Er(Tr)), e.style.color = "oklch(var(--success-500))", setTimeout(() => {
1571
+ e.replaceChildren(Er(wr)), e.style.color = "oklch(var(--foreground))", e.classList.remove("copied");
1572
1572
  }, 2e3)) : setTimeout(() => e.classList.remove("copied"), 3e3);
1573
1573
  }).catch((e) => {
1574
1574
  console.error("复制失败:", e);
@@ -2500,7 +2500,7 @@ var tt = Symbol("kun-accordion"), nt = /* @__PURE__ */ p({
2500
2500
  role: "gridcell"
2501
2501
  }, [u("button", {
2502
2502
  disabled: t.isDisabled,
2503
- class: y(P(q)(P(q)("flex h-8 w-8 items-center justify-center rounded-full text-sm transition-colors", P(Y)[e.color]), !t.isCurrentMonth && "text-default-400", t.isToday && "border-primary bg-primary/20 border", !t.isSelected && !t.isDisabled && "hover:bg-default/20", t.isDisabled && "cursor-not-allowed opacity-50", t.isSelected && "bg-primary dark:bg-primary-400 hover:bg-primary/90 text-white", (t.isInRange || fe(t.date)) && !t.isSelected && "bg-primary/10 rounded-none", t.isRangeStart && "rounded-r-none", t.isRangeEnd && "rounded-l-none")),
2503
+ class: y(P(q)(P(q)("flex h-8 w-8 items-center justify-center rounded-full text-sm transition-colors", P(Y)[e.color]), !t.isCurrentMonth && "text-default-400", t.isToday && "border-primary bg-primary/20 border", !t.isSelected && !t.isDisabled && "hover:bg-default/20", t.isDisabled && "cursor-not-allowed opacity-50", t.isSelected && "bg-primary text-primary-foreground hover:bg-primary/90", (t.isInRange || fe(t.date)) && !t.isSelected && "bg-primary/10 rounded-none", t.isRangeStart && "rounded-r-none", t.isRangeEnd && "rounded-l-none")),
2504
2504
  "aria-label": t.date.toDateString(),
2505
2505
  "aria-selected": t.isSelected,
2506
2506
  tabindex: t.date.toDateString() === ie.value.toDateString() ? 0 : -1,
@@ -5570,7 +5570,7 @@ var tt = Symbol("kun-accordion"), nt = /* @__PURE__ */ p({
5570
5570
  }, null, 40, Ms),
5571
5571
  u("div", Ns, [u("div", { class: y(["rounded-full transition-colors duration-kun-fast ease-kun-standard peer-focus-visible:ring-2 peer-focus-visible:ring-primary/50", [
5572
5572
  a.value.track,
5573
- n.value ? "bg-primary-500 dark:bg-primary-400" : "bg-default-500",
5573
+ n.value ? "bg-primary" : "bg-default-500",
5574
5574
  e.disabled ? "opacity-50" : "",
5575
5575
  n.value && e.disabled ? "bg-primary-300" : ""
5576
5576
  ]]) }, null, 2), u("div", { class: y(P(q)("absolute top-0.5 left-0.5 transform rounded-full bg-white transition-transform duration-kun-fast ease-kun-emphasized", a.value.thumb, n.value ? a.value.translate : "translate-x-0")) }, null, 2)]),
package/dist/prose.css CHANGED
@@ -11,9 +11,9 @@
11
11
  * want beautiful defaults opt in here.
12
12
  *
13
13
  * Token-driven, so it adapts to light/dark automatically. The theme stores
14
- * colours as comma HSL *channels* (`--foreground: 202, 24%, 9%`), so alpha uses
15
- * legacy `hsla(var(--x), a)` NOT `hsl(var(--x) / a)`. `--color-kun-border` is
16
- * already a full neutral `hsl()` colour. Neutral foreground/content tokens drive
14
+ * colours as OKLCH *channels* (`--foreground: 0.2057 0.0132 233.66`), so wrap in
15
+ * `oklch(var(--x))` and alpha uses `oklch(var(--x) / a)`. `--color-kun-border`
16
+ * is already a full neutral colour. Neutral foreground/content tokens drive
17
17
  * body + chrome; `--primary-*` only links and the blockquote rule.
18
18
  *
19
19
  * Pass `compact` to KunContent (or add `.kun-prose-compact`) for a tighter
@@ -25,7 +25,7 @@
25
25
  margin-inline: auto;
26
26
  font-size: 1.0625rem; /* 17px — editorial body */
27
27
  line-height: 1.8; /* generous leading, kind to CJK */
28
- color: hsl(var(--foreground));
28
+ color: oklch(var(--foreground));
29
29
  text-wrap: pretty;
30
30
  overflow-wrap: break-word;
31
31
  }
@@ -48,7 +48,7 @@
48
48
  .kun-prose h4,
49
49
  .kun-prose h5,
50
50
  .kun-prose h6 {
51
- color: hsl(var(--foreground));
51
+ color: oklch(var(--foreground));
52
52
  line-height: 1.3;
53
53
  text-wrap: balance;
54
54
  scroll-margin-top: 5rem;
@@ -85,7 +85,7 @@
85
85
  .kun-prose h6 {
86
86
  font-size: 0.9em;
87
87
  font-weight: 600;
88
- color: hsla(var(--foreground), 0.65);
88
+ color: oklch(var(--foreground) / 0.65);
89
89
  margin: 1.5em 0 0.4em;
90
90
  }
91
91
 
@@ -93,14 +93,14 @@
93
93
  .kun-prose strong,
94
94
  .kun-prose b {
95
95
  font-weight: 650;
96
- color: hsl(var(--foreground));
96
+ color: oklch(var(--foreground));
97
97
  }
98
98
  .kun-prose em,
99
99
  .kun-prose i {
100
100
  font-style: italic;
101
101
  }
102
102
  .kun-prose a {
103
- color: hsl(var(--primary-600));
103
+ color: oklch(var(--primary-600));
104
104
  font-weight: 500;
105
105
  text-decoration: underline;
106
106
  text-decoration-thickness: 1px;
@@ -108,11 +108,11 @@
108
108
  transition: color 0.15s var(--ease-kun-standard, ease);
109
109
  }
110
110
  .kun-prose a:hover {
111
- color: hsl(var(--primary-500));
111
+ color: oklch(var(--primary-500));
112
112
  }
113
113
  .kun-prose mark {
114
- background: hsla(var(--warning-300, 45, 93%, 64%), 0.55);
115
- color: hsl(var(--foreground));
114
+ background: oklch(var(--warning-300) / 0.55);
115
+ color: oklch(var(--foreground));
116
116
  padding: 0.05em 0.25em;
117
117
  border-radius: 0.25em;
118
118
  }
@@ -134,7 +134,7 @@
134
134
  padding-left: 0.25em;
135
135
  }
136
136
  .kun-prose li::marker {
137
- color: hsla(var(--foreground), 0.45);
137
+ color: oklch(var(--foreground) / 0.45);
138
138
  }
139
139
  .kun-prose ul ul,
140
140
  .kun-prose ul ol,
@@ -150,8 +150,8 @@
150
150
  .kun-prose blockquote {
151
151
  margin: 1.6em 0;
152
152
  padding: 0.2em 0 0.2em 1.1em;
153
- border-left: 3px solid hsl(var(--primary-400));
154
- color: hsla(var(--foreground), 0.72);
153
+ border-left: 3px solid oklch(var(--primary-400));
154
+ color: oklch(var(--foreground) / 0.72);
155
155
  font-style: normal;
156
156
  }
157
157
  .kun-prose blockquote p {
@@ -163,8 +163,8 @@
163
163
  font-family:
164
164
  ui-monospace, SFMono-Regular, Menlo, Consolas, 'Liberation Mono', monospace;
165
165
  font-size: 0.875em;
166
- background: hsl(var(--content2));
167
- border: 1px solid var(--color-kun-border, hsla(var(--foreground), 0.12));
166
+ background: oklch(var(--content2));
167
+ border: 1px solid var(--color-kun-border, oklch(var(--foreground) / 0.12));
168
168
  border-radius: 0.375em;
169
169
  padding: 0.12em 0.4em;
170
170
  }
@@ -172,8 +172,8 @@
172
172
  position: relative; /* anchors the injected copy button */
173
173
  margin: 1.5em 0;
174
174
  padding: 1em 1.15em;
175
- background: hsl(var(--content2));
176
- border: 1px solid var(--color-kun-border, hsla(var(--foreground), 0.12));
175
+ background: oklch(var(--content2));
176
+ border: 1px solid var(--color-kun-border, oklch(var(--foreground) / 0.12));
177
177
  border-radius: 0.75rem;
178
178
  overflow-x: auto;
179
179
  font-size: 0.9em;
@@ -199,11 +199,11 @@
199
199
  text-align: left;
200
200
  font-weight: 650;
201
201
  padding: 0.6em 0.85em;
202
- border-bottom: 2px solid var(--color-kun-border, hsla(var(--foreground), 0.16));
202
+ border-bottom: 2px solid var(--color-kun-border, oklch(var(--foreground) / 0.16));
203
203
  }
204
204
  .kun-prose tbody td {
205
205
  padding: 0.6em 0.85em;
206
- border-bottom: 1px solid var(--color-kun-border, hsla(var(--foreground), 0.1));
206
+ border-bottom: 1px solid var(--color-kun-border, oklch(var(--foreground) / 0.1));
207
207
  }
208
208
  .kun-prose tbody tr:last-child td {
209
209
  border-bottom: 0;
@@ -212,7 +212,7 @@
212
212
  /* Rule + media */
213
213
  .kun-prose hr {
214
214
  border: 0;
215
- border-top: 1px solid var(--color-kun-border, hsla(var(--foreground), 0.12));
215
+ border-top: 1px solid var(--color-kun-border, oklch(var(--foreground) / 0.12));
216
216
  margin: 3em 0;
217
217
  }
218
218
  .kun-prose img,
@@ -229,9 +229,9 @@
229
229
  font-size: 0.8em;
230
230
  padding: 0.15em 0.45em;
231
231
  border-radius: 0.375em;
232
- background: hsl(var(--content2));
233
- border: 1px solid var(--color-kun-border, hsla(var(--foreground), 0.14));
234
- box-shadow: 0 1px 0 hsla(var(--foreground), 0.12);
232
+ background: oklch(var(--content2));
233
+ border: 1px solid var(--color-kun-border, oklch(var(--foreground) / 0.14));
234
+ box-shadow: 0 1px 0 oklch(var(--foreground) / 0.12);
235
235
  }
236
236
 
237
237
  /* ── Compact density (comment / reply streams) ───────────────────────────────
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kungal/ui-vue",
3
- "version": "1.6.3",
3
+ "version": "1.7.0",
4
4
  "description": "KunUI Vue 3 component layer — Nuxt-decoupled. Works in any Vue app; pairs with @kungal/ui-nuxt for Nuxt sugar.",
5
5
  "type": "module",
6
6
  "keywords": [
@@ -50,7 +50,7 @@
50
50
  "date-fns": "^4.1.0",
51
51
  "focus-trap": "^8.2.1",
52
52
  "vue-advanced-cropper": "^2.8.9",
53
- "@kungal/ui-core": "1.6.3"
53
+ "@kungal/ui-core": "1.7.0"
54
54
  },
55
55
  "peerDependencies": {
56
56
  "vue": "^3.5.0"
@@ -62,7 +62,7 @@
62
62
  "vite": "^8.0.16",
63
63
  "vue": "^3.5.35",
64
64
  "vue-tsc": "^3.3.3",
65
- "@kungal/ui-tokens": "1.6.3"
65
+ "@kungal/ui-tokens": "1.7.0"
66
66
  },
67
67
  "scripts": {
68
68
  "build": "vite build && cp src/prose.css dist/prose.css && vue-tsc -p tsconfig.build.json",