@kungal/ui-core 2.53.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/CHANGELOG.md +61 -0
- package/dist/index.cjs +160 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +27 -3
- package/dist/index.d.ts +27 -3
- package/dist/index.js +155 -1
- package/dist/index.js.map +1 -1
- package/dist/locale/en.cjs +27 -0
- package/dist/locale/en.cjs.map +1 -1
- package/dist/locale/en.d.cts +1 -1
- package/dist/locale/en.d.ts +1 -1
- package/dist/locale/en.js +27 -0
- package/dist/locale/en.js.map +1 -1
- package/dist/{types-Dc-w7UpA.d.cts → types-BRxje_HR.d.cts} +37 -1
- package/dist/{types-Dc-w7UpA.d.ts → types-BRxje_HR.d.ts} +37 -1
- package/package.json +1 -1
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-
|
|
4
|
-
export { c as KunTranslate } from './types-
|
|
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';
|
|
@@ -115,6 +115,30 @@ declare const translateKunMessage: (messages: KunMessages, path: KunMessagePath,
|
|
|
115
115
|
|
|
116
116
|
declare const KUN_CATALOG_ZH_CN: KunMessageCatalog;
|
|
117
117
|
|
|
118
|
+
/** Drop separators that would render as stray lines: leading, trailing, and
|
|
119
|
+
* all but the first of a run. An app filters one command table per context
|
|
120
|
+
* (no "Delete" for a post you do not own) and its separators have to follow;
|
|
121
|
+
* React Spectrum S2 hides the same three cases. */
|
|
122
|
+
declare const normalizeKunMenuSeparators: <T extends {
|
|
123
|
+
type?: string;
|
|
124
|
+
}>(entries: readonly T[]) => T[];
|
|
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
|
+
|
|
118
142
|
declare const randomNum: (lowerValue: number, upperValue: number) => number;
|
|
119
143
|
|
|
120
144
|
declare const decodeIfEncoded: (text: string) => string;
|
|
@@ -508,4 +532,4 @@ declare const registerKunIcons: (icons: Record<string, KunIconData>) => void;
|
|
|
508
532
|
declare const getKunIcon: (name: string) => KunIconData | undefined;
|
|
509
533
|
declare const hasKunIcon: (name: string) => boolean;
|
|
510
534
|
|
|
511
|
-
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, 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-
|
|
4
|
-
export { c as KunTranslate } from './types-
|
|
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';
|
|
@@ -115,6 +115,30 @@ declare const translateKunMessage: (messages: KunMessages, path: KunMessagePath,
|
|
|
115
115
|
|
|
116
116
|
declare const KUN_CATALOG_ZH_CN: KunMessageCatalog;
|
|
117
117
|
|
|
118
|
+
/** Drop separators that would render as stray lines: leading, trailing, and
|
|
119
|
+
* all but the first of a run. An app filters one command table per context
|
|
120
|
+
* (no "Delete" for a post you do not own) and its separators have to follow;
|
|
121
|
+
* React Spectrum S2 hides the same three cases. */
|
|
122
|
+
declare const normalizeKunMenuSeparators: <T extends {
|
|
123
|
+
type?: string;
|
|
124
|
+
}>(entries: readonly T[]) => T[];
|
|
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
|
+
|
|
118
142
|
declare const randomNum: (lowerValue: number, upperValue: number) => number;
|
|
119
143
|
|
|
120
144
|
declare const decodeIfEncoded: (text: string) => string;
|
|
@@ -508,4 +532,4 @@ declare const registerKunIcons: (icons: Record<string, KunIconData>) => void;
|
|
|
508
532
|
declare const getKunIcon: (name: string) => KunIconData | undefined;
|
|
509
533
|
declare const hasKunIcon: (name: string) => boolean;
|
|
510
534
|
|
|
511
|
-
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, 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
|
@@ -456,6 +456,30 @@ var zh_CN_default = {
|
|
|
456
456
|
reveal: "显示密码",
|
|
457
457
|
hide: "隐藏密码"
|
|
458
458
|
},
|
|
459
|
+
kbd: {
|
|
460
|
+
control: "Ctrl",
|
|
461
|
+
alt: "Alt",
|
|
462
|
+
option: "Option",
|
|
463
|
+
shift: "Shift",
|
|
464
|
+
command: "Command",
|
|
465
|
+
meta: "Windows 键",
|
|
466
|
+
enter: "回车",
|
|
467
|
+
escape: "Esc",
|
|
468
|
+
backspace: "退格",
|
|
469
|
+
delete: "删除",
|
|
470
|
+
tab: "Tab",
|
|
471
|
+
space: "空格",
|
|
472
|
+
up: "上箭头",
|
|
473
|
+
down: "下箭头",
|
|
474
|
+
left: "左箭头",
|
|
475
|
+
right: "右箭头",
|
|
476
|
+
pageUp: "向上翻页",
|
|
477
|
+
pageDown: "向下翻页",
|
|
478
|
+
home: "Home",
|
|
479
|
+
end: "End",
|
|
480
|
+
plus: "加号",
|
|
481
|
+
then: "然后"
|
|
482
|
+
},
|
|
459
483
|
lightbox: {
|
|
460
484
|
label: "图片查看器",
|
|
461
485
|
close: "关闭",
|
|
@@ -515,6 +539,9 @@ var zh_CN_default = {
|
|
|
515
539
|
clear: "清除",
|
|
516
540
|
removeOption: "移除 {label}"
|
|
517
541
|
},
|
|
542
|
+
splitPane: {
|
|
543
|
+
handle: "调整分栏宽度"
|
|
544
|
+
},
|
|
518
545
|
spoiler: {
|
|
519
546
|
copyCode: "复制代码",
|
|
520
547
|
reveal: "剧透内容,点击或按回车显示"
|
|
@@ -550,6 +577,133 @@ var zh_CN_default = {
|
|
|
550
577
|
// src/locale/zh-CN.ts
|
|
551
578
|
var KUN_CATALOG_ZH_CN = zh_CN_default;
|
|
552
579
|
|
|
580
|
+
// src/shortcut.ts
|
|
581
|
+
var ALIASES = {
|
|
582
|
+
mod: "Mod",
|
|
583
|
+
ctrl: "Control",
|
|
584
|
+
control: "Control",
|
|
585
|
+
alt: "Alt",
|
|
586
|
+
option: "Alt",
|
|
587
|
+
opt: "Alt",
|
|
588
|
+
shift: "Shift",
|
|
589
|
+
meta: "Meta",
|
|
590
|
+
cmd: "Meta",
|
|
591
|
+
command: "Meta",
|
|
592
|
+
super: "Meta",
|
|
593
|
+
win: "Meta",
|
|
594
|
+
enter: "Enter",
|
|
595
|
+
return: "Enter",
|
|
596
|
+
esc: "Escape",
|
|
597
|
+
escape: "Escape",
|
|
598
|
+
backspace: "Backspace",
|
|
599
|
+
del: "Delete",
|
|
600
|
+
delete: "Delete",
|
|
601
|
+
tab: "Tab",
|
|
602
|
+
space: "Space",
|
|
603
|
+
spacebar: "Space",
|
|
604
|
+
up: "ArrowUp",
|
|
605
|
+
arrowup: "ArrowUp",
|
|
606
|
+
down: "ArrowDown",
|
|
607
|
+
arrowdown: "ArrowDown",
|
|
608
|
+
left: "ArrowLeft",
|
|
609
|
+
arrowleft: "ArrowLeft",
|
|
610
|
+
right: "ArrowRight",
|
|
611
|
+
arrowright: "ArrowRight",
|
|
612
|
+
pageup: "PageUp",
|
|
613
|
+
pgup: "PageUp",
|
|
614
|
+
pagedown: "PageDown",
|
|
615
|
+
pgdn: "PageDown",
|
|
616
|
+
home: "Home",
|
|
617
|
+
end: "End",
|
|
618
|
+
plus: "+"
|
|
619
|
+
};
|
|
620
|
+
var MODIFIER_ORDER = {
|
|
621
|
+
apple: ["Control", "Alt", "Shift", "Meta"],
|
|
622
|
+
other: ["Control", "Meta", "Alt", "Shift"]
|
|
623
|
+
};
|
|
624
|
+
var NAMED = {
|
|
625
|
+
Control: { apple: "⌃", other: "Ctrl", spoken: () => "control" },
|
|
626
|
+
Alt: { apple: "⌥", other: "Alt", spoken: (p) => p === "apple" ? "option" : "alt" },
|
|
627
|
+
Shift: { apple: "⇧", other: "Shift", spoken: () => "shift" },
|
|
628
|
+
Meta: { apple: "⌘", other: "Win", spoken: (p) => p === "apple" ? "command" : "meta" },
|
|
629
|
+
Enter: { apple: "↩", other: "Enter", spoken: () => "enter" },
|
|
630
|
+
Escape: { apple: "Esc", other: "Esc", spoken: () => "escape" },
|
|
631
|
+
Backspace: { apple: "⌫", other: "Backspace", spoken: () => "backspace" },
|
|
632
|
+
Delete: { apple: "⌦", other: "Del", spoken: () => "delete" },
|
|
633
|
+
Tab: { apple: "⇥", other: "Tab", spoken: () => "tab" },
|
|
634
|
+
Space: { apple: "Space", other: "Space", spoken: () => "space" },
|
|
635
|
+
ArrowUp: { apple: "↑", other: "↑", spoken: () => "up" },
|
|
636
|
+
ArrowDown: { apple: "↓", other: "↓", spoken: () => "down" },
|
|
637
|
+
ArrowLeft: { apple: "←", other: "←", spoken: () => "left" },
|
|
638
|
+
ArrowRight: { apple: "→", other: "→", spoken: () => "right" },
|
|
639
|
+
PageUp: { apple: "PgUp", other: "PgUp", spoken: () => "pageUp" },
|
|
640
|
+
PageDown: { apple: "PgDn", other: "PgDn", spoken: () => "pageDown" },
|
|
641
|
+
Home: { apple: "Home", other: "Home", spoken: () => "home" },
|
|
642
|
+
End: { apple: "End", other: "End", spoken: () => "end" },
|
|
643
|
+
"+": { apple: "+", other: "+", spoken: () => "plus" }
|
|
644
|
+
};
|
|
645
|
+
var canonicalKey = (token) => {
|
|
646
|
+
const alias = ALIASES[token.toLowerCase()];
|
|
647
|
+
if (alias) return alias;
|
|
648
|
+
if (/^f\d{1,2}$/i.test(token)) return token.toUpperCase();
|
|
649
|
+
return token.length === 1 ? token.toUpperCase() : token;
|
|
650
|
+
};
|
|
651
|
+
var splitChord = (chord) => {
|
|
652
|
+
if (chord === "+") return ["+"];
|
|
653
|
+
const plusKey = chord.endsWith("++");
|
|
654
|
+
const body = plusKey ? chord.slice(0, -2) : chord;
|
|
655
|
+
const keys = body.split("+").filter(Boolean);
|
|
656
|
+
return plusKey ? [...keys, "+"] : keys;
|
|
657
|
+
};
|
|
658
|
+
var parseKunShortcut = (keys) => keys.trim().split(/\s+/).filter(Boolean).map((chord) => splitChord(chord).map(canonicalKey)).filter((chord) => chord.length > 0);
|
|
659
|
+
var resolveKunShortcut = (keys, platform) => {
|
|
660
|
+
const order = MODIFIER_ORDER[platform];
|
|
661
|
+
return parseKunShortcut(keys).map((chord) => {
|
|
662
|
+
const resolved = chord.map(
|
|
663
|
+
(key) => key === "Mod" ? platform === "apple" ? "Meta" : "Control" : key
|
|
664
|
+
);
|
|
665
|
+
const modifiers = order.filter((m) => resolved.includes(m));
|
|
666
|
+
const rest = resolved.filter((k, i) => !order.includes(k) && resolved.indexOf(k) === i);
|
|
667
|
+
return [...modifiers, ...rest].map((key) => {
|
|
668
|
+
const named = NAMED[key];
|
|
669
|
+
return named ? { key, label: named[platform], spoken: named.spoken(platform) } : { key, label: key, spoken: null };
|
|
670
|
+
});
|
|
671
|
+
});
|
|
672
|
+
};
|
|
673
|
+
var formatKunShortcut = (keys, platform) => resolveKunShortcut(keys, platform).map((chord) => chord.map((k) => k.label).join(platform === "apple" ? "" : "+")).join(" ");
|
|
674
|
+
var speakKunShortcut = (sequence, name, then) => sequence.map((chord) => chord.map((k) => k.spoken ? name(k.spoken) : k.label).join(" ")).join(` ${then} `);
|
|
675
|
+
|
|
676
|
+
// src/menu.ts
|
|
677
|
+
var normalizeKunMenuSeparators = (entries) => {
|
|
678
|
+
const out = [];
|
|
679
|
+
for (const entry of entries) {
|
|
680
|
+
const last = out[out.length - 1];
|
|
681
|
+
if (entry.type === "separator" && (!last || last.type === "separator")) continue;
|
|
682
|
+
out.push(entry);
|
|
683
|
+
}
|
|
684
|
+
while (out.length && out[out.length - 1].type === "separator") out.pop();
|
|
685
|
+
return out;
|
|
686
|
+
};
|
|
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
|
+
|
|
553
707
|
// src/random.ts
|
|
554
708
|
var randomNum = (lowerValue, upperValue) => Math.floor(Math.random() * (upperValue - lowerValue + 1) + lowerValue);
|
|
555
709
|
|
|
@@ -1565,6 +1719,6 @@ var registerKunIcons = (icons) => {
|
|
|
1565
1719
|
var getKunIcon = (name) => registry.get(name);
|
|
1566
1720
|
var hasKunIcon = (name) => registry.has(name);
|
|
1567
1721
|
|
|
1568
|
-
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, 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, parseKunChatMarkdown, pickAvatarFallback, randomNum, registerKunIcon, registerKunIcons, resolveRounded, sliceKunChatEntities, 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 };
|
|
1569
1723
|
//# sourceMappingURL=index.js.map
|
|
1570
1724
|
//# sourceMappingURL=index.js.map
|