@kungal/ui-core 2.54.0 → 2.55.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
@@ -539,6 +539,9 @@ var zh_CN_default = {
539
539
  clear: "清除",
540
540
  removeOption: "移除 {label}"
541
541
  },
542
+ splitPane: {
543
+ handle: "调整分栏宽度"
544
+ },
542
545
  spoiler: {
543
546
  copyCode: "复制代码",
544
547
  reveal: "剧透内容,点击或按回车显示"
@@ -682,6 +685,25 @@ var normalizeKunMenuSeparators = (entries) => {
682
685
  return out;
683
686
  };
684
687
 
688
+ // src/splitPane.ts
689
+ var resolveKunSplitSize = (raw, { min, max, snapPoints = [], snapThreshold = 8, from }) => {
690
+ const lo = Math.min(min, max);
691
+ const hi = Math.max(min, max);
692
+ const clamped = Math.min(Math.max(raw, lo), hi);
693
+ let best = clamped;
694
+ let bestDistance = Infinity;
695
+ for (const point of snapPoints) {
696
+ if (point < lo || point > hi) continue;
697
+ const distance = Math.abs(point - clamped);
698
+ if (distance <= snapThreshold && distance < bestDistance) {
699
+ best = point;
700
+ bestDistance = distance;
701
+ }
702
+ }
703
+ if (from !== void 0 && Math.sign(best - from) !== Math.sign(clamped - from)) best = clamped;
704
+ return Math.round(best);
705
+ };
706
+
685
707
  // src/random.ts
686
708
  var randomNum = (lowerValue, upperValue) => Math.floor(Math.random() * (upperValue - lowerValue + 1) + lowerValue);
687
709
 
@@ -1697,6 +1719,6 @@ var registerKunIcons = (icons) => {
1697
1719
  var getKunIcon = (name) => registry.get(name);
1698
1720
  var hasKunIcon = (name) => registry.has(name);
1699
1721
 
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 };
1722
+ 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
1723
  //# sourceMappingURL=index.js.map
1702
1724
  //# sourceMappingURL=index.js.map