@kungal/ui-core 2.54.0 → 2.56.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/dist/index.d.cts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { ClassValue } from 'clsx';
2
2
  export { ClassValue } from 'clsx';
3
- import { K as KunMessages, a as KunMessagePath, b as KunMessageCatalog } from './types-KUpDlvb1.cjs';
4
- export { c as KunKbdKeyName, d as KunShortcutKey, e as KunShortcutPlatform, f as KunTranslate, g as formatKunShortcut, p as parseKunShortcut, r as resolveKunShortcut, s as speakKunShortcut } from './types-KUpDlvb1.cjs';
3
+ import { K as KunMessages, a as KunMessagePath, b as KunMessageCatalog } from './types-BRxje_HR.cjs';
4
+ export { c as KunKbdKeyName, d as KunShortcutKey, e as KunShortcutPlatform, f as KunTranslate, g as formatKunShortcut, p as parseKunShortcut, r as resolveKunShortcut, s as speakKunShortcut } from './types-BRxje_HR.cjs';
5
5
 
6
6
  type KunUIVariant = 'solid' | 'bordered' | 'light' | 'flat' | 'shadow';
7
7
  type KunUIColor = 'default' | 'primary' | 'secondary' | 'success' | 'warning' | 'danger' | 'info';
@@ -123,6 +123,22 @@ declare const normalizeKunMenuSeparators: <T extends {
123
123
  type?: string;
124
124
  }>(entries: readonly T[]) => T[];
125
125
 
126
+ interface KunSplitSizeOptions {
127
+ min: number;
128
+ max: number;
129
+ /** Widths the divider is pulled to when it comes within `snapThreshold`. */
130
+ snapPoints?: readonly number[];
131
+ snapThreshold?: number;
132
+ /** The width a keyboard step starts from. A snap may not cancel or reverse
133
+ * that step: with a 5 px step inside an 8 px threshold, the divider would
134
+ * otherwise never leave a snap point. A drag leaves it unset, so the
135
+ * divider sticks to a snap point until the pointer pulls clear. */
136
+ from?: number;
137
+ }
138
+ /** Clamp a requested width into [min, max], pull it to the nearest snap point
139
+ * within the threshold, and round it to a whole pixel. */
140
+ declare const resolveKunSplitSize: (raw: number, { min, max, snapPoints, snapThreshold, from }: KunSplitSizeOptions) => number;
141
+
126
142
  declare const randomNum: (lowerValue: number, upperValue: number) => number;
127
143
 
128
144
  declare const decodeIfEncoded: (text: string) => string;
@@ -516,4 +532,4 @@ declare const registerKunIcons: (icons: Record<string, KunIconData>) => void;
516
532
  declare const getKunIcon: (name: string) => KunIconData | undefined;
517
533
  declare const hasKunIcon: (name: string) => boolean;
518
534
 
519
- export { KUN_AVATAR_FALLBACK, KUN_CATALOG_ZH_CN, KUN_CHAT_ALBUM_LIMIT, KUN_CHAT_ALBUM_SIDE, KUN_CHAT_BLOCK_ENTITY_TYPES, KUN_CHAT_TEXT_LIMIT, KUN_CHAT_TYPING_INTERVAL, KUN_CHAT_TYPING_TIMEOUT, KUN_DEFAULT_ROUNDED, KUN_SHATTER_PHYSICS, KUN_SWIPE_DISMISS_PHYSICS, type KunAvatarDecoration, type KunChatAlbumLayout, type KunChatAlbumOptions, type KunChatAlbumSize, type KunChatAlbumTile, type KunChatContext, type KunChatDaySection, type KunChatEntity, type KunChatEntityNode, type KunChatEntityType, type KunChatFormattedText, type KunChatGroupOptions, type KunChatListRow, type KunChatMedia, type KunChatMessage, type KunChatPhoto, type KunChatReaction, type KunChatReactionOption, type KunChatReplyQuote, type KunChatReplyTo, type KunChatSendStatus, type KunChatServiceAction, type KunChatServiceActionType, type KunChatTextLeaf, type KunChatTextNode, type KunChatTypingEvent, type KunChatUser, type KunIconData, KunMessageCatalog, KunMessagePath, KunMessages, type KunSelectionSize, type KunUIColor, type KunUIRounded, type KunUISize, type KunUIVariant, type KunUser, buildKunChatEntityTree, cn, decodeIfEncoded, formatKunChatMarkdown, getKunIcon, getRandomSticker, groupKunChatMessages, hasKunIcon, kunBgClasses, kunBorderClasses, kunChatDayKey, kunChatMessageKey, kunChatTreeText, kunChipSizeClasses, kunControlSizeClasses, kunControlSquareClasses, kunFocusRingClasses, kunFocusRingWithinClasses, kunPanelRoundedClass, kunRingClasses, kunRoundedClasses, kunSelectionSizeClasses, kunSoftBgClasses, kunSolidBgClasses, kunSolidClasses, kunSolidFgClasses, kunTextClasses, kunVariantClasses, layoutKunChatAlbum, normalizeKunChatEntities, normalizeKunMenuSeparators, parseKunChatMarkdown, pickAvatarFallback, randomNum, registerKunIcon, registerKunIcons, resolveRounded, sliceKunChatEntities, translateKunMessage };
535
+ export { KUN_AVATAR_FALLBACK, KUN_CATALOG_ZH_CN, KUN_CHAT_ALBUM_LIMIT, KUN_CHAT_ALBUM_SIDE, KUN_CHAT_BLOCK_ENTITY_TYPES, KUN_CHAT_TEXT_LIMIT, KUN_CHAT_TYPING_INTERVAL, KUN_CHAT_TYPING_TIMEOUT, KUN_DEFAULT_ROUNDED, KUN_SHATTER_PHYSICS, KUN_SWIPE_DISMISS_PHYSICS, type KunAvatarDecoration, type KunChatAlbumLayout, type KunChatAlbumOptions, type KunChatAlbumSize, type KunChatAlbumTile, type KunChatContext, type KunChatDaySection, type KunChatEntity, type KunChatEntityNode, type KunChatEntityType, type KunChatFormattedText, type KunChatGroupOptions, type KunChatListRow, type KunChatMedia, type KunChatMessage, type KunChatPhoto, type KunChatReaction, type KunChatReactionOption, type KunChatReplyQuote, type KunChatReplyTo, type KunChatSendStatus, type KunChatServiceAction, type KunChatServiceActionType, type KunChatTextLeaf, type KunChatTextNode, type KunChatTypingEvent, type KunChatUser, type KunIconData, KunMessageCatalog, KunMessagePath, KunMessages, type KunSelectionSize, type KunSplitSizeOptions, type KunUIColor, type KunUIRounded, type KunUISize, type KunUIVariant, type KunUser, buildKunChatEntityTree, cn, decodeIfEncoded, formatKunChatMarkdown, getKunIcon, getRandomSticker, groupKunChatMessages, hasKunIcon, kunBgClasses, kunBorderClasses, kunChatDayKey, kunChatMessageKey, kunChatTreeText, kunChipSizeClasses, kunControlSizeClasses, kunControlSquareClasses, kunFocusRingClasses, kunFocusRingWithinClasses, kunPanelRoundedClass, kunRingClasses, kunRoundedClasses, kunSelectionSizeClasses, kunSoftBgClasses, kunSolidBgClasses, kunSolidClasses, kunSolidFgClasses, kunTextClasses, kunVariantClasses, layoutKunChatAlbum, normalizeKunChatEntities, normalizeKunMenuSeparators, parseKunChatMarkdown, pickAvatarFallback, randomNum, registerKunIcon, registerKunIcons, resolveKunSplitSize, resolveRounded, sliceKunChatEntities, translateKunMessage };
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { ClassValue } from 'clsx';
2
2
  export { ClassValue } from 'clsx';
3
- import { K as KunMessages, a as KunMessagePath, b as KunMessageCatalog } from './types-KUpDlvb1.js';
4
- export { c as KunKbdKeyName, d as KunShortcutKey, e as KunShortcutPlatform, f as KunTranslate, g as formatKunShortcut, p as parseKunShortcut, r as resolveKunShortcut, s as speakKunShortcut } from './types-KUpDlvb1.js';
3
+ import { K as KunMessages, a as KunMessagePath, b as KunMessageCatalog } from './types-BRxje_HR.js';
4
+ export { c as KunKbdKeyName, d as KunShortcutKey, e as KunShortcutPlatform, f as KunTranslate, g as formatKunShortcut, p as parseKunShortcut, r as resolveKunShortcut, s as speakKunShortcut } from './types-BRxje_HR.js';
5
5
 
6
6
  type KunUIVariant = 'solid' | 'bordered' | 'light' | 'flat' | 'shadow';
7
7
  type KunUIColor = 'default' | 'primary' | 'secondary' | 'success' | 'warning' | 'danger' | 'info';
@@ -123,6 +123,22 @@ declare const normalizeKunMenuSeparators: <T extends {
123
123
  type?: string;
124
124
  }>(entries: readonly T[]) => T[];
125
125
 
126
+ interface KunSplitSizeOptions {
127
+ min: number;
128
+ max: number;
129
+ /** Widths the divider is pulled to when it comes within `snapThreshold`. */
130
+ snapPoints?: readonly number[];
131
+ snapThreshold?: number;
132
+ /** The width a keyboard step starts from. A snap may not cancel or reverse
133
+ * that step: with a 5 px step inside an 8 px threshold, the divider would
134
+ * otherwise never leave a snap point. A drag leaves it unset, so the
135
+ * divider sticks to a snap point until the pointer pulls clear. */
136
+ from?: number;
137
+ }
138
+ /** Clamp a requested width into [min, max], pull it to the nearest snap point
139
+ * within the threshold, and round it to a whole pixel. */
140
+ declare const resolveKunSplitSize: (raw: number, { min, max, snapPoints, snapThreshold, from }: KunSplitSizeOptions) => number;
141
+
126
142
  declare const randomNum: (lowerValue: number, upperValue: number) => number;
127
143
 
128
144
  declare const decodeIfEncoded: (text: string) => string;
@@ -516,4 +532,4 @@ declare const registerKunIcons: (icons: Record<string, KunIconData>) => void;
516
532
  declare const getKunIcon: (name: string) => KunIconData | undefined;
517
533
  declare const hasKunIcon: (name: string) => boolean;
518
534
 
519
- export { KUN_AVATAR_FALLBACK, KUN_CATALOG_ZH_CN, KUN_CHAT_ALBUM_LIMIT, KUN_CHAT_ALBUM_SIDE, KUN_CHAT_BLOCK_ENTITY_TYPES, KUN_CHAT_TEXT_LIMIT, KUN_CHAT_TYPING_INTERVAL, KUN_CHAT_TYPING_TIMEOUT, KUN_DEFAULT_ROUNDED, KUN_SHATTER_PHYSICS, KUN_SWIPE_DISMISS_PHYSICS, type KunAvatarDecoration, type KunChatAlbumLayout, type KunChatAlbumOptions, type KunChatAlbumSize, type KunChatAlbumTile, type KunChatContext, type KunChatDaySection, type KunChatEntity, type KunChatEntityNode, type KunChatEntityType, type KunChatFormattedText, type KunChatGroupOptions, type KunChatListRow, type KunChatMedia, type KunChatMessage, type KunChatPhoto, type KunChatReaction, type KunChatReactionOption, type KunChatReplyQuote, type KunChatReplyTo, type KunChatSendStatus, type KunChatServiceAction, type KunChatServiceActionType, type KunChatTextLeaf, type KunChatTextNode, type KunChatTypingEvent, type KunChatUser, type KunIconData, KunMessageCatalog, KunMessagePath, KunMessages, type KunSelectionSize, type KunUIColor, type KunUIRounded, type KunUISize, type KunUIVariant, type KunUser, buildKunChatEntityTree, cn, decodeIfEncoded, formatKunChatMarkdown, getKunIcon, getRandomSticker, groupKunChatMessages, hasKunIcon, kunBgClasses, kunBorderClasses, kunChatDayKey, kunChatMessageKey, kunChatTreeText, kunChipSizeClasses, kunControlSizeClasses, kunControlSquareClasses, kunFocusRingClasses, kunFocusRingWithinClasses, kunPanelRoundedClass, kunRingClasses, kunRoundedClasses, kunSelectionSizeClasses, kunSoftBgClasses, kunSolidBgClasses, kunSolidClasses, kunSolidFgClasses, kunTextClasses, kunVariantClasses, layoutKunChatAlbum, normalizeKunChatEntities, normalizeKunMenuSeparators, parseKunChatMarkdown, pickAvatarFallback, randomNum, registerKunIcon, registerKunIcons, resolveRounded, sliceKunChatEntities, translateKunMessage };
535
+ export { KUN_AVATAR_FALLBACK, KUN_CATALOG_ZH_CN, KUN_CHAT_ALBUM_LIMIT, KUN_CHAT_ALBUM_SIDE, KUN_CHAT_BLOCK_ENTITY_TYPES, KUN_CHAT_TEXT_LIMIT, KUN_CHAT_TYPING_INTERVAL, KUN_CHAT_TYPING_TIMEOUT, KUN_DEFAULT_ROUNDED, KUN_SHATTER_PHYSICS, KUN_SWIPE_DISMISS_PHYSICS, type KunAvatarDecoration, type KunChatAlbumLayout, type KunChatAlbumOptions, type KunChatAlbumSize, type KunChatAlbumTile, type KunChatContext, type KunChatDaySection, type KunChatEntity, type KunChatEntityNode, type KunChatEntityType, type KunChatFormattedText, type KunChatGroupOptions, type KunChatListRow, type KunChatMedia, type KunChatMessage, type KunChatPhoto, type KunChatReaction, type KunChatReactionOption, type KunChatReplyQuote, type KunChatReplyTo, type KunChatSendStatus, type KunChatServiceAction, type KunChatServiceActionType, type KunChatTextLeaf, type KunChatTextNode, type KunChatTypingEvent, type KunChatUser, type KunIconData, KunMessageCatalog, KunMessagePath, KunMessages, type KunSelectionSize, type KunSplitSizeOptions, type KunUIColor, type KunUIRounded, type KunUISize, type KunUIVariant, type KunUser, buildKunChatEntityTree, cn, decodeIfEncoded, formatKunChatMarkdown, getKunIcon, getRandomSticker, groupKunChatMessages, hasKunIcon, kunBgClasses, kunBorderClasses, kunChatDayKey, kunChatMessageKey, kunChatTreeText, kunChipSizeClasses, kunControlSizeClasses, kunControlSquareClasses, kunFocusRingClasses, kunFocusRingWithinClasses, kunPanelRoundedClass, kunRingClasses, kunRoundedClasses, kunSelectionSizeClasses, kunSoftBgClasses, kunSolidBgClasses, kunSolidClasses, kunSolidFgClasses, kunTextClasses, kunVariantClasses, layoutKunChatAlbum, normalizeKunChatEntities, normalizeKunMenuSeparators, parseKunChatMarkdown, pickAvatarFallback, randomNum, registerKunIcon, registerKunIcons, resolveKunSplitSize, resolveRounded, sliceKunChatEntities, translateKunMessage };
package/dist/index.js CHANGED
@@ -52,32 +52,35 @@ var TABLE = {
52
52
  danger: "border border-transparent bg-danger text-danger-foreground",
53
53
  info: "border border-transparent bg-info text-info-foreground"
54
54
  },
55
+ // `{c}-text`, not the fill: a fill used as text measured 1.75–4.42:1 on the
56
+ // light page. The generator holds `{c}-text` at 4.5:1 on the page, on cards
57
+ // and on the hue's 20% tint, so the hover fill and a flat chip stay readable.
55
58
  bordered: {
56
59
  default: "border border-default bg-transparent",
57
- primary: "border border-primary bg-transparent text-primary",
58
- secondary: "border border-secondary bg-transparent text-secondary",
59
- success: "border border-success bg-transparent text-success",
60
- warning: "border border-warning bg-transparent text-warning",
61
- danger: "border border-danger bg-transparent text-danger",
62
- info: "border border-info bg-transparent text-info"
60
+ primary: "border border-primary bg-transparent text-primary-text",
61
+ secondary: "border border-secondary bg-transparent text-secondary-text",
62
+ success: "border border-success bg-transparent text-success-text",
63
+ warning: "border border-warning bg-transparent text-warning-text",
64
+ danger: "border border-danger bg-transparent text-danger-text",
65
+ info: "border border-info bg-transparent text-info-text"
63
66
  },
64
67
  light: {
65
68
  default: "border border-transparent bg-transparent hover:bg-default/20",
66
- primary: "border border-transparent bg-transparent text-primary hover:bg-primary/20",
67
- secondary: "border border-transparent bg-transparent text-secondary hover:bg-secondary/20",
68
- success: "border border-transparent bg-transparent text-success hover:bg-success/20",
69
- warning: "border border-transparent bg-transparent text-warning hover:bg-warning/20",
70
- danger: "border border-transparent bg-transparent text-danger hover:bg-danger/20",
71
- info: "border border-transparent bg-transparent text-info hover:bg-info/20"
69
+ primary: "border border-transparent bg-transparent text-primary-text hover:bg-primary/20",
70
+ secondary: "border border-transparent bg-transparent text-secondary-text hover:bg-secondary/20",
71
+ success: "border border-transparent bg-transparent text-success-text hover:bg-success/20",
72
+ warning: "border border-transparent bg-transparent text-warning-text hover:bg-warning/20",
73
+ danger: "border border-transparent bg-transparent text-danger-text hover:bg-danger/20",
74
+ info: "border border-transparent bg-transparent text-info-text hover:bg-info/20"
72
75
  },
73
76
  flat: {
74
- default: "border border-transparent bg-default/20 text-default-700",
75
- primary: "border border-transparent bg-primary/20 text-primary-600",
76
- secondary: "border border-transparent bg-secondary/20 text-secondary-600",
77
- success: "border border-transparent bg-success/20 text-success-700 dark:text-success",
78
- warning: "border border-transparent bg-warning/20 text-warning-700 dark:text-warning",
79
- danger: "border border-transparent bg-danger/20 text-danger-600 dark:text-danger-500",
80
- info: "border border-transparent bg-info/20 text-info-700 dark:text-info-500"
77
+ default: "border border-transparent bg-default/20 text-default-text",
78
+ primary: "border border-transparent bg-primary/20 text-primary-text",
79
+ secondary: "border border-transparent bg-secondary/20 text-secondary-text",
80
+ success: "border border-transparent bg-success/20 text-success-text",
81
+ warning: "border border-transparent bg-warning/20 text-warning-text",
82
+ danger: "border border-transparent bg-danger/20 text-danger-text",
83
+ info: "border border-transparent bg-info/20 text-info-text"
81
84
  },
82
85
  // Same fill logic as `solid` (see note above) plus a COLORED glow. The glow
83
86
  // needs both a size (`shadow-lg` — the geometry) AND a tint (`shadow-{color}/40`
@@ -133,12 +136,12 @@ var kunSolidClasses = {
133
136
  };
134
137
  var kunTextClasses = {
135
138
  default: "text-foreground",
136
- primary: "text-primary",
137
- secondary: "text-secondary",
138
- success: "text-success",
139
- warning: "text-warning",
140
- danger: "text-danger",
141
- info: "text-info"
139
+ primary: "text-primary-text",
140
+ secondary: "text-secondary-text",
141
+ success: "text-success-text",
142
+ warning: "text-warning-text",
143
+ danger: "text-danger-text",
144
+ info: "text-info-text"
142
145
  };
143
146
  var kunBorderClasses = {
144
147
  default: "border-default",
@@ -539,6 +542,9 @@ var zh_CN_default = {
539
542
  clear: "清除",
540
543
  removeOption: "移除 {label}"
541
544
  },
545
+ splitPane: {
546
+ handle: "调整分栏宽度"
547
+ },
542
548
  spoiler: {
543
549
  copyCode: "复制代码",
544
550
  reveal: "剧透内容,点击或按回车显示"
@@ -682,6 +688,25 @@ var normalizeKunMenuSeparators = (entries) => {
682
688
  return out;
683
689
  };
684
690
 
691
+ // src/splitPane.ts
692
+ var resolveKunSplitSize = (raw, { min, max, snapPoints = [], snapThreshold = 8, from }) => {
693
+ const lo = Math.min(min, max);
694
+ const hi = Math.max(min, max);
695
+ const clamped = Math.min(Math.max(raw, lo), hi);
696
+ let best = clamped;
697
+ let bestDistance = Infinity;
698
+ for (const point of snapPoints) {
699
+ if (point < lo || point > hi) continue;
700
+ const distance = Math.abs(point - clamped);
701
+ if (distance <= snapThreshold && distance < bestDistance) {
702
+ best = point;
703
+ bestDistance = distance;
704
+ }
705
+ }
706
+ if (from !== void 0 && Math.sign(best - from) !== Math.sign(clamped - from)) best = clamped;
707
+ return Math.round(best);
708
+ };
709
+
685
710
  // src/random.ts
686
711
  var randomNum = (lowerValue, upperValue) => Math.floor(Math.random() * (upperValue - lowerValue + 1) + lowerValue);
687
712
 
@@ -1697,6 +1722,6 @@ var registerKunIcons = (icons) => {
1697
1722
  var getKunIcon = (name) => registry.get(name);
1698
1723
  var hasKunIcon = (name) => registry.has(name);
1699
1724
 
1700
- export { KUN_AVATAR_FALLBACK, KUN_CATALOG_ZH_CN, KUN_CHAT_ALBUM_LIMIT, KUN_CHAT_ALBUM_SIDE, KUN_CHAT_BLOCK_ENTITY_TYPES, KUN_CHAT_TEXT_LIMIT, KUN_CHAT_TYPING_INTERVAL, KUN_CHAT_TYPING_TIMEOUT, KUN_DEFAULT_ROUNDED, KUN_SHATTER_PHYSICS, KUN_SWIPE_DISMISS_PHYSICS, buildKunChatEntityTree, cn, decodeIfEncoded, formatKunChatMarkdown, formatKunShortcut, getKunIcon, getRandomSticker, groupKunChatMessages, hasKunIcon, kunBgClasses, kunBorderClasses, kunChatDayKey, kunChatMessageKey, kunChatTreeText, kunChipSizeClasses, kunControlSizeClasses, kunControlSquareClasses, kunFocusRingClasses, kunFocusRingWithinClasses, kunPanelRoundedClass, kunRingClasses, kunRoundedClasses, kunSelectionSizeClasses, kunSoftBgClasses, kunSolidBgClasses, kunSolidClasses, kunSolidFgClasses, kunTextClasses, kunVariantClasses, layoutKunChatAlbum, normalizeKunChatEntities, normalizeKunMenuSeparators, parseKunChatMarkdown, parseKunShortcut, pickAvatarFallback, randomNum, registerKunIcon, registerKunIcons, resolveKunShortcut, resolveRounded, sliceKunChatEntities, speakKunShortcut, translateKunMessage };
1725
+ export { KUN_AVATAR_FALLBACK, KUN_CATALOG_ZH_CN, KUN_CHAT_ALBUM_LIMIT, KUN_CHAT_ALBUM_SIDE, KUN_CHAT_BLOCK_ENTITY_TYPES, KUN_CHAT_TEXT_LIMIT, KUN_CHAT_TYPING_INTERVAL, KUN_CHAT_TYPING_TIMEOUT, KUN_DEFAULT_ROUNDED, KUN_SHATTER_PHYSICS, KUN_SWIPE_DISMISS_PHYSICS, buildKunChatEntityTree, cn, decodeIfEncoded, formatKunChatMarkdown, formatKunShortcut, getKunIcon, getRandomSticker, groupKunChatMessages, hasKunIcon, kunBgClasses, kunBorderClasses, kunChatDayKey, kunChatMessageKey, kunChatTreeText, kunChipSizeClasses, kunControlSizeClasses, kunControlSquareClasses, kunFocusRingClasses, kunFocusRingWithinClasses, kunPanelRoundedClass, kunRingClasses, kunRoundedClasses, kunSelectionSizeClasses, kunSoftBgClasses, kunSolidBgClasses, kunSolidClasses, kunSolidFgClasses, kunTextClasses, kunVariantClasses, layoutKunChatAlbum, normalizeKunChatEntities, normalizeKunMenuSeparators, parseKunChatMarkdown, parseKunShortcut, pickAvatarFallback, randomNum, registerKunIcon, registerKunIcons, resolveKunShortcut, resolveKunSplitSize, resolveRounded, sliceKunChatEntities, speakKunShortcut, translateKunMessage };
1701
1726
  //# sourceMappingURL=index.js.map
1702
1727
  //# sourceMappingURL=index.js.map