@polymorfa/ui 0.1.0-dev.20260922094209

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.
@@ -0,0 +1,36 @@
1
+ import { type EmojiCategory } from "./emoji-data.js";
2
+ export { EMOJI_CATEGORIES, type EmojiCategory } from "./emoji-data.js";
3
+ export interface EmojiEntry {
4
+ readonly emoji: string;
5
+ /** English CLDR-style name, such as `thumbs up`. */
6
+ readonly name: string;
7
+ readonly keywords: readonly string[];
8
+ readonly category: EmojiCategory;
9
+ }
10
+ /** Picker tabs: recently used first, then the built-in categories. */
11
+ export type EmojiPickerCategory = "recent" | EmojiCategory;
12
+ export declare const EMOJI_PICKER_CATEGORIES: readonly EmojiPickerCategory[];
13
+ /** A representative emoji for each picker tab. */
14
+ export declare const EMOJI_CATEGORY_ICONS: Readonly<Record<EmojiPickerCategory, string>>;
15
+ /** Every built-in emoji, grouped by category in picker order. */
16
+ export declare function emojiList(): readonly EmojiEntry[];
17
+ /** Built-in emoji of one category. */
18
+ export declare function emojiInCategory(category: EmojiCategory): readonly EmojiEntry[];
19
+ /**
20
+ * Emoji whose name or keywords match every word of `query`, best matches
21
+ * first: a name or keyword that starts with the word ranks above one that
22
+ * only contains it.
23
+ */
24
+ export declare function searchEmoji(query: string, limit?: number): readonly EmojiEntry[];
25
+ /** The built-in entry for an emoji, if it is in the set. */
26
+ export declare function findEmoji(emoji: string): EmojiEntry | undefined;
27
+ /**
28
+ * Recently picked emoji, newest first. Returns an empty list when storage is
29
+ * unavailable, blocked, or holds something unexpected.
30
+ */
31
+ export declare function readRecentEmoji(storage?: Pick<Storage, "getItem"> | undefined): readonly string[];
32
+ /** Move `emoji` to the front of the recent list. Storage errors are ignored. */
33
+ export declare function recordRecentEmoji(emoji: string, storage?: Pick<Storage, "getItem" | "setItem"> | undefined): readonly string[];
34
+ /** Entries for the recent tab; emoji outside the built-in set still show. */
35
+ export declare function recentEmojiEntries(recent: readonly string[]): readonly Emoji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AgF;AAChF,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,MAAM,EACb,OAAO,GAAE,IAAI,CAAC,OAAO,EAAE,SAAS,GAAG,SAAS,CAAC,GAAG,SAA4B,GAC3E,SAAS,MAAM,EAAE,CAWnB;AAED,6EAA6E;AAC7E,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,SAAS,MAAM,EAAE,GACxB,SAAS,UAAU,EAAE,CAUvB"}
package/dist/emoji.js ADDED
@@ -0,0 +1,134 @@
1
+ import { EMOJI_CATEGORIES, EMOJI_SOURCE, } from "./emoji-data.js";
2
+ export { EMOJI_CATEGORIES } from "./emoji-data.js";
3
+ export const EMOJI_PICKER_CATEGORIES = [
4
+ "recent",
5
+ ...EMOJI_CATEGORIES,
6
+ ];
7
+ /** A representative emoji for each picker tab. */
8
+ export const EMOJI_CATEGORY_ICONS = {
9
+ recent: "🕘",
10
+ smileys: "😀",
11
+ people: "👋",
12
+ nature: "🌿",
13
+ food: "🍔",
14
+ activities: "⚽",
15
+ travel: "✈️",
16
+ objects: "💡",
17
+ symbols: "❤️",
18
+ flags: "🏳️",
19
+ };
20
+ let parsed;
21
+ /** Every built-in emoji, grouped by category in picker order. */
22
+ export function emojiList() {
23
+ if (parsed !== undefined)
24
+ return parsed;
25
+ const entries = [];
26
+ for (const category of EMOJI_CATEGORIES)
27
+ for (const line of EMOJI_SOURCE[category].split("\n")) {
28
+ const space = line.indexOf(" ");
29
+ const colon = line.indexOf(":", space);
30
+ if (space <= 0 || colon < 0)
31
+ continue;
32
+ entries.push(Object.freeze({
33
+ emoji: line.slice(0, space),
34
+ name: line.slice(space + 1, colon).trim(),
35
+ keywords: Object.freeze(line
36
+ .slice(colon + 1)
37
+ .trim()
38
+ .split(/\s+/)
39
+ .filter(Boolean)),
40
+ category,
41
+ }));
42
+ }
43
+ parsed = Object.freeze(entries);
44
+ return parsed;
45
+ }
46
+ /** Built-in emoji of one category. */
47
+ export function emojiInCategory(category) {
48
+ return emojiList().filter((entry) => entry.category === category);
49
+ }
50
+ /**
51
+ * Emoji whose name or keywords match every word of `query`, best matches
52
+ * first: a name or keyword that starts with the word ranks above one that
53
+ * only contains it.
54
+ */
55
+ export function searchEmoji(query, limit = 120) {
56
+ const words = query.toLowerCase().trim().split(/\s+/).filter(Boolean);
57
+ if (words.length === 0)
58
+ return [];
59
+ const scored = [];
60
+ emojiList().forEach((entry, index) => {
61
+ const terms = [...entry.name.split(/[\s-]+/), ...entry.keywords];
62
+ let score = 0;
63
+ for (const word of words) {
64
+ if (terms.some((term) => term === word))
65
+ score += 3;
66
+ else if (terms.some((term) => term.startsWith(word)))
67
+ score += 2;
68
+ else if (entry.name.includes(word))
69
+ score += 1;
70
+ else
71
+ return;
72
+ }
73
+ scored.push({ entry, score, index });
74
+ });
75
+ return scored
76
+ .sort((a, b) => b.score - a.score || a.index - b.index)
77
+ .slice(0, limit)
78
+ .map(({ entry }) => entry);
79
+ }
80
+ /** The built-in entry for an emoji, if it is in the set. */
81
+ export function findEmoji(emoji) {
82
+ return emojiList().find((entry) => entry.emoji === emoji);
83
+ }
84
+ const RECENT_KEY = "polymorfa:recent-emoji";
85
+ const MAX_RECENT = 32;
86
+ function defaultStorage() {
87
+ try {
88
+ return globalThis.localStorage;
89
+ }
90
+ catch {
91
+ return undefined;
92
+ }
93
+ }
94
+ /**
95
+ * Recently picked emoji, newest first. Returns an empty list when storage is
96
+ * unavailable, blocked, or holds something unexpected.
97
+ */
98
+ export function readRecentEmoji(storage = defaultStorage()) {
99
+ try {
100
+ const value = JSON.parse(storage?.getItem(RECENT_KEY) ?? "[]");
101
+ return Array.isArray(value)
102
+ ? value
103
+ .filter((item) => typeof item === "string" && item.length <= 32)
104
+ .slice(0, MAX_RECENT)
105
+ : [];
106
+ }
107
+ catch {
108
+ return [];
109
+ }
110
+ }
111
+ /** Move `emoji` to the front of the recent list. Storage errors are ignored. */
112
+ export function recordRecentEmoji(emoji, storage = defaultStorage()) {
113
+ const next = [
114
+ emoji,
115
+ ...readRecentEmoji(storage).filter((item) => item !== emoji),
116
+ ].slice(0, MAX_RECENT);
117
+ try {
118
+ storage?.setItem(RECENT_KEY, JSON.stringify(next));
119
+ }
120
+ catch {
121
+ // Private mode or a full quota: keep the list for this session only.
122
+ }
123
+ return next;
124
+ }
125
+ /** Entries for the recent tab; emoji outside the built-in set still show. */
126
+ export function recentEmojiEntries(recent) {
127
+ return recent.map((emoji) => findEmoji(emoji) ?? {
128
+ emoji,
129
+ name: emoji,
130
+ keywords: [],
131
+ category: "symbols",
132
+ });
133
+ }
134
+ //# sourceMappingURL=emoji.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"emoji.js","sourceRoot":"","sources":["../src/emoji.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAChB,YAAY,GAEb,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAE,gBAAgB,EAAsB,MAAM,iBAAiB,CAAC;AAavE,MAAM,CAAC,MAAM,uBAAuB,GAAmC;IACrE,QAAQ;IACR,GAAG,gBAAgB;CACpB,CAAC;AAEF,kDAAkD;AAClD,MAAM,CAAC,MAAM,oBAAoB,GAE7B;IACF,MAAM,EAAE,IAAI;IACZ,OAAO,EAAE,IAAI;IACb,MAAM,EAAE,IAAI;IACZ,MAAM,EAAE,IAAI;IACZ,IAAI,EAAE,IAAI;IACV,UAAU,EAAE,GAAG;IACf,MAAM,EAAE,IAAI;IACZ,OAAO,EAAE,IAAI;IACb,OAAO,EAAE,IAAI;IACb,KAAK,EAAE,KAAK;CACb,CAAC;AAEF,IAAI,MAAyC,CAAC;AAE9C,iEAAiE;AACjE,MAAM,UAAU,SAAS;IACvB,IAAI,MAAM,KAAK,SAAS;QAAE,OAAO,MAAM,CAAC;IACxC,MAAM,OAAO,GAAiB,EAAE,CAAC;IACjC,KAAK,MAAM,QAAQ,IAAI,gBAAgB;QACrC,KAAK,MAAM,IAAI,IAAI,YAAY,CAAC,QAAQ,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,E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IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED,6EAA6E;AAC7E,MAAM,UAAU,kBAAkB,CAChC,MAAyB;IAEzB,OAAO,MAAM,CAAC,GAAG,CACf,CAAC,KAAK,EAAE,EAAE,CACR,SAAS,CAAC,KAAK,CAAC,IAAI;QAClB,KAAK;QACL,IAAI,EAAE,KAAK;QACX,QAAQ,EAAE,EAAE;QACZ,QAAQ,EAAE,SAAS;KACpB,CACJ,CAAC;AACJ,CAAC"}
@@ -0,0 +1,9 @@
1
+ export { DEFAULT_APPEARANCE, appearanceToCssVariables, defineAppearance, mergeAppearance, resolveMotionPreference, type Appearance, type AppearanceColorVariable, type AppearanceInput, type AppearanceLayout, type AppearanceVariables, type Density, type Direction, type ElementAppearance, type MotionPreference, type Theme, } from "./appearance.js";
2
+ export { ENGLISH_MESSAGES, createLocale, type Locale, type MessageKey, } from "./locale.js";
3
+ export { redactDiagnostic } from "./redaction.js";
4
+ export { COMPONENT_STYLES, injectComponentStyles, themeClassName, } from "./styles.js";
5
+ export { COMPONENT_SLOTS, slotClassName, slotPartName, slotStyleEntries, type ComponentSlot, type SlotClassNames, } from "./slots.js";
6
+ export { applyQuickReply, filterQuickReplies, findQuickReplyQuery, formatElapsed, insertText, placePopover, quickReplyLabel, type PopoverPlacement, type PopoverRect, type QuickReplyOption, type QuickReplyQuery, type TextEdit, } from "./composer.js";
7
+ export { EMOJI_CATEGORIES, EMOJI_CATEGORY_ICONS, EMOJI_PICKER_CATEGORIES, emojiInCategory, emojiList, findEmoji, readRecentEmoji, recentEmojiEntries, recordRecentEmoji, searchEmoji, type EmojiCategory, type EmojiEntry, type EmojiPickerCategory, } from "./emoji.js";
8
+ export { CHAT_ICONS, compareMessageTime, formatDayLabel, formatFileSize, formatMessageTime, isImageAttachment, layoutMessages, messageDayKey, safeAttachmentUrl, type ChatIconName, type ChatLayoutEntry, type ChatLayoutMessage, } from "./chat.js";
9
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAClB,wBAAwB,EACxB,gBAAgB,EAChB,eAAe,EACf,uBAAuB,EACvB,KAAK,UAAU,EACf,KAAK,uBAAuB,EAC5B,KAAK,eAAe,EACpB,KAAK,gBAAgB,EACrB,KAAK,mBAAmB,EACxB,KAAK,OAAO,EACZ,KAAK,SAAS,EACd,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,EACrB,KAAK,KAAK,GACX,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,gBAAgB,EAChB,YAAY,EACZ,KAAK,MAAM,EACX,KAAK,UAAU,GAChB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EACL,gBAAgB,EAChB,qBAAqB,EACrB,cAAc,GACf,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,eAAe,EACf,aAAa,EACb,YAAY,EACZ,gBAAgB,EAChB,KAAK,aAAa,EAClB,KAAK,cAAc,GACpB,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,eAAe,EACf,kBAAkB,EAClB,mBAAmB,EACnB,aAAa,EACb,UAAU,EACV,YAAY,EACZ,eAAe,EACf,KAAK,gBAAgB,EACrB,KAAK,WAAW,EAChB,KAAK,gBAAgB,EACrB,KAAK,eAAe,EACpB,KAAK,QAAQ,GACd,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,gBAAgB,EAChB,oBAAoB,EACpB,uBAAuB,EACvB,eAAe,EACf,SAAS,EACT,SAAS,EACT,eAAe,EACf,kBAAkB,EAClB,iBAAiB,EACjB,WAAW,EACX,KAAK,aAAa,EAClB,KAAK,UAAU,EACf,KAAK,mBAAmB,GACzB,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,UAAU,EACV,kBAAkB,EAClB,cAAc,EACd,cAAc,EACd,iBAAiB,EACjB,iBAAiB,EACjB,cAAc,EACd,aAAa,EACb,iBAAiB,EACjB,KAAK,YAAY,EACjB,KAAK,eAAe,EACpB,KAAK,iBAAiB,GACvB,MAAM,WAAW,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,9 @@
1
+ export { DEFAULT_APPEARANCE, appearanceToCssVariables, defineAppearance, mergeAppearance, resolveMotionPreference, } from "./appearance.js";
2
+ export { ENGLISH_MESSAGES, createLocale, } from "./locale.js";
3
+ export { redactDiagnostic } from "./redaction.js";
4
+ export { COMPONENT_STYLES, injectComponentStyles, themeClassName, } from "./styles.js";
5
+ export { COMPONENT_SLOTS, slotClassName, slotPartName, slotStyleEntries, } from "./slots.js";
6
+ export { applyQuickReply, filterQuickReplies, findQuickReplyQuery, formatElapsed, insertText, placePopover, quickReplyLabel, } from "./composer.js";
7
+ export { EMOJI_CATEGORIES, EMOJI_CATEGORY_ICONS, EMOJI_PICKER_CATEGORIES, emojiInCategory, emojiList, findEmoji, readRecentEmoji, recentEmojiEntries, recordRecentEmoji, searchEmoji, } from "./emoji.js";
8
+ export { CHAT_ICONS, compareMessageTime, formatDayLabel, formatFileSize, formatMessageTime, isImageAttachment, layoutMessages, messageDayKey, safeAttachmentUrl, } from "./chat.js";
9
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAClB,wBAAwB,EACxB,gBAAgB,EAChB,eAAe,EACf,uBAAuB,GAWxB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,gBAAgB,EAChB,YAAY,GAGb,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EACL,gBAAgB,EAChB,qBAAqB,EACrB,cAAc,GACf,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,eAAe,EACf,aAAa,EACb,YAAY,EACZ,gBAAgB,GAGjB,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,eAAe,EACf,kBAAkB,EAClB,mBAAmB,EACnB,aAAa,EACb,UAAU,EACV,YAAY,EACZ,eAAe,GAMhB,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,gBAAgB,EAChB,oBAAoB,EACpB,uBAAuB,EACvB,eAAe,EACf,SAAS,EACT,SAAS,EACT,eAAe,EACf,kBAAkB,EAClB,iBAAiB,EACjB,WAAW,GAIZ,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,UAAU,EACV,kBAAkB,EAClB,cAAc,EACd,cAAc,EACd,iBAAiB,EACjB,iBAAiB,EACjB,cAAc,EACd,aAAa,EACb,iBAAiB,GAIlB,MAAM,WAAW,CAAC"}
@@ -0,0 +1,183 @@
1
+ import type { Direction } from "./appearance.js";
2
+ export declare const ENGLISH_MESSAGES: {
3
+ readonly "common.cancel": "Cancel";
4
+ readonly "common.close": "Close";
5
+ readonly "common.retry": "Retry";
6
+ readonly "common.save": "Save";
7
+ readonly "chat.title": "Messages";
8
+ readonly "chat.empty": "No messages yet";
9
+ readonly "chat.loadMore": "Load earlier messages";
10
+ readonly "chat.sending": "Sending";
11
+ readonly "chat.sent": "Sent";
12
+ readonly "chat.failed": "Not delivered";
13
+ readonly "chat.loadError": "Unable to load messages";
14
+ readonly "chat.today": "Today";
15
+ readonly "chat.yesterday": "Yesterday";
16
+ readonly "chat.reply": "Reply";
17
+ readonly "chat.retry": "Retry sending";
18
+ readonly "chat.you": "You";
19
+ readonly "chat.contact": "Contact";
20
+ /** Read before the quoted snippet, which is a button. */
21
+ readonly "chat.jumpToReply": "Go to replied message:";
22
+ readonly "chat.attachment": "Attachment";
23
+ readonly "chat.openAttachment": "Open {name}";
24
+ readonly "chat.messageActions": "Message actions";
25
+ readonly "composer.label": "Message";
26
+ readonly "composer.placeholder": "Write a message";
27
+ readonly "composer.send": "Send";
28
+ readonly "composer.sending": "Sending…";
29
+ readonly "composer.attach": "Attach files";
30
+ readonly "composer.attachments": "Attachments";
31
+ readonly "composer.dropHint": "Drop files to attach";
32
+ readonly "composer.uploading": "Uploading {name}";
33
+ readonly "composer.uploadFailed": "Upload failed";
34
+ readonly "composer.replyingTo": "Replying to {name}";
35
+ readonly "composer.cancelReply": "Cancel reply";
36
+ readonly "composer.removeAttachment": "Remove attachment";
37
+ readonly "composer.removeNamedAttachment": "Remove {name}";
38
+ readonly "composer.emoji": "Emoji";
39
+ readonly "composer.emojiPicker": "Emoji picker";
40
+ readonly "composer.emojiSearch": "Search emoji";
41
+ readonly "composer.emojiNoResults": "No emoji found";
42
+ readonly "composer.emojiNoRecent": "Emoji you use will appear here";
43
+ readonly "composer.emojiCategories": "Emoji categories";
44
+ readonly "composer.emojiCategory.recent": "Recent";
45
+ readonly "composer.emojiCategory.smileys": "Smileys and emotion";
46
+ readonly "composer.emojiCategory.people": "People and body";
47
+ readonly "composer.emojiCategory.nature": "Animals and nature";
48
+ readonly "composer.emojiCategory.food": "Food and drink";
49
+ readonly "composer.emojiCategory.activities": "Activities";
50
+ readonly "composer.emojiCategory.travel": "Travel and places";
51
+ readonly "composer.emojiCategory.objects": "Objects";
52
+ readonly "composer.emojiCategory.symbols": "Symbols";
53
+ readonly "composer.emojiCategory.flags": "Flags";
54
+ readonly "composer.voiceNote": "Record voice note";
55
+ readonly "composer.recording": "Recording voice note";
56
+ readonly "composer.recordingStopped": "Voice note recorded";
57
+ readonly "composer.recordingCancelled": "Voice note deleted";
58
+ readonly "composer.recordingLevel": "Microphone level";
59
+ readonly "composer.cancelRecording": "Delete voice note";
60
+ readonly "composer.sendVoiceNote": "Send voice note";
61
+ readonly "composer.stopRecording": "Stop recording";
62
+ readonly "composer.microphoneDenied": "Microphone permission was denied. Allow it in your browser settings to record.";
63
+ readonly "composer.microphoneUnavailable": "No microphone is available.";
64
+ readonly "composer.recordingFailed": "Recording failed. Try again.";
65
+ readonly "composer.quickReplies": "Quick replies";
66
+ readonly "templates.title": "Template builder";
67
+ readonly "templates.name": "Template name";
68
+ readonly "templates.header": "Header";
69
+ readonly "templates.body": "Body";
70
+ readonly "templates.footer": "Footer";
71
+ readonly "templates.variables": "Variable examples";
72
+ readonly "templates.buttons": "Buttons";
73
+ readonly "templates.variableExample": "Variable {name} example";
74
+ readonly "templates.buttonText": "Button {index} text";
75
+ readonly "templates.cards": "Carousel cards";
76
+ readonly "templates.cardBody": "Carousel card {index} body";
77
+ readonly "templates.save": "Save draft";
78
+ readonly "templates.preview": "Preview";
79
+ readonly "templates.previewHint": "Save the draft, then preview it as a WhatsApp message.";
80
+ readonly "templates.submit": "Submit to Meta";
81
+ readonly "calls.incoming": "Incoming call";
82
+ readonly "calls.outgoing": "Calling";
83
+ readonly "calls.answer": "Answer";
84
+ readonly "calls.reject": "Reject";
85
+ readonly "calls.hangup": "Hang up";
86
+ readonly "calls.mute": "Mute";
87
+ readonly "calls.unmute": "Unmute";
88
+ readonly "calls.cameraOn": "Turn camera on";
89
+ readonly "calls.cameraOff": "Turn camera off";
90
+ readonly "calls.reconnecting": "Reconnecting";
91
+ readonly "calls.permissionDenied": "Camera or microphone permission was denied.";
92
+ readonly "calls.audioCall": "WhatsApp audio call";
93
+ readonly "calls.videoCall": "WhatsApp video call";
94
+ readonly "calls.ringing": "Ringing";
95
+ readonly "calls.connecting": "Connecting";
96
+ readonly "calls.connected": "Connected";
97
+ readonly "calls.ended": "Call ended";
98
+ readonly "calls.failed": "Call failed";
99
+ readonly "calls.controlFailed": "Could not end the call. Try again.";
100
+ readonly "calls.answerFailed": "Could not connect the call. Try again.";
101
+ readonly "calls.previousFailed": "The previous call could not be connected.";
102
+ readonly "calls.answerWithCamera": "Answer with camera";
103
+ readonly "calls.answerWithoutCamera": "Answer without camera";
104
+ readonly "calls.answerMuted": "Answer muted";
105
+ readonly "calls.answerUnmuted": "Answer unmuted";
106
+ readonly "calls.deviceSettings": "Audio and video settings";
107
+ readonly "calls.microphone": "Microphone";
108
+ readonly "calls.speaker": "Speaker";
109
+ readonly "calls.camera": "Camera";
110
+ readonly "calls.microphoneSettings": "Microphone and speaker settings";
111
+ readonly "calls.cameraSettings": "Camera settings";
112
+ readonly "calls.popOut": "Open in a separate window";
113
+ readonly "calls.popIn": "Return to the page";
114
+ readonly "calls.placeAudioCall": "Place audio call";
115
+ readonly "calls.placeVideoCall": "Place video call";
116
+ readonly "calls.dialPlaceholder": "Phone number";
117
+ readonly "calls.deleteDigit": "Delete last digit";
118
+ readonly "calls.defaultDevice": "Default";
119
+ readonly "calls.popoutTitle": "Call";
120
+ readonly "calls.dismiss": "Dismiss";
121
+ readonly "calls.join": "Join";
122
+ readonly "calls.leave": "Leave call";
123
+ readonly "calls.end": "End call for everyone";
124
+ readonly "calls.answeredElsewhere": "Answered by another participant";
125
+ readonly "calls.joinable": "Call in progress. You can join.";
126
+ readonly "calls.otherIncoming": "Other incoming calls";
127
+ readonly "calls.show": "Show";
128
+ readonly "calls.participants": "Participants";
129
+ readonly "calls.participantVideos": "Participant video";
130
+ readonly "calls.participant": "Participant";
131
+ readonly "calls.participantInvited": "Invited";
132
+ readonly "calls.participantRinging": "Ringing";
133
+ readonly "calls.participantConnected": "In call";
134
+ readonly "calls.participantMuted": "Muted";
135
+ readonly "calls.incomingFrom": "Incoming call from {peer}";
136
+ /** Outgoing call still ringing; the peer's position and the ellipsis belong to the locale. */
137
+ readonly "calls.ringingTo": "Ringing {peer}…";
138
+ readonly "calls.videoFrom": "Video from {name}";
139
+ readonly "inbox.title": "Inbox";
140
+ readonly "inbox.conversations": "Conversations";
141
+ readonly "inbox.search": "Search conversations";
142
+ readonly "inbox.empty": "No conversations yet";
143
+ readonly "inbox.noMatches": "No conversations match";
144
+ readonly "inbox.select": "Select a conversation to read it";
145
+ readonly "inbox.back": "Back to conversations";
146
+ readonly "inbox.unread": "{count} unread";
147
+ readonly "inbox.loadMore": "Load more conversations";
148
+ readonly "inbox.loadError": "Unable to load conversations";
149
+ readonly "inbox.readOnly": "You can read this conversation but not reply.";
150
+ readonly "inbox.you": "You: ";
151
+ readonly "inbox.contact": "Contact details";
152
+ readonly "inbox.showContact": "Show contact details";
153
+ readonly "inbox.hideContact": "Hide contact details";
154
+ readonly "inbox.phone": "Phone";
155
+ readonly "inbox.email": "Email";
156
+ readonly "inbox.about": "About";
157
+ readonly "inbox.noContact": "No contact details";
158
+ readonly "connect.button": "Connect WhatsApp";
159
+ readonly "connect.opening": "Opening…";
160
+ readonly "connect.failed": "Could not start the connection. Try again.";
161
+ readonly "status.idle": "Not connected";
162
+ readonly "status.loading": "Connecting";
163
+ readonly "status.ready": "Connected";
164
+ readonly "status.refreshing": "Connected";
165
+ readonly "status.retrying": "Reconnecting";
166
+ readonly "status.unauthenticated": "Signed out";
167
+ readonly "status.error": "Connection problem";
168
+ readonly "status.label": "Polymorfa connection: {status}";
169
+ readonly "calls.call": "Call";
170
+ readonly "templates.list": "Templates";
171
+ readonly "templates.new": "New template";
172
+ readonly "templates.empty": "No templates yet";
173
+ readonly "templates.loadError": "Unable to load templates";
174
+ readonly "templates.back": "Back to templates";
175
+ };
176
+ export type MessageKey = keyof typeof ENGLISH_MESSAGES;
177
+ export interface Locale {
178
+ readonly code: string;
179
+ readonly direction: Exclude<Direction, "auto">;
180
+ readonly messages: Readonly<Record<MessageKey, string>>;
181
+ }
182
+ export declare function createLocale(code: string, messages?: Partial<Record<MessageKey, string>>, direction?: Exclude<Direction, "auto">): Locale;
183
+ //# sourceMappingURL=locale.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"locale.d.ts","sourceRoot":"","sources":["../src/locale.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAEjD,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;IAkB3B,yDAAyD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAsHzD,8FAA8F;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAuCtF,CAAC;AAEX,MAAM,MAAM,UAAU,GAAG,MAAM,OAAO,gBAAgB,CAAC;AAEvD,MAAM,WAAW,MAAM;IACrB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;IAC/C,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC,MAAM,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC,CAAC;CACzD;AAID,wBAAgB,YAAY,CAC1B,IAAI,EAAE,MAAM,EACZ,QAAQ,GAAE,OAAO,CAAC,MAAM,CAAC,UAAU,EAAE,MAAM,CAAC,CAAM,EAClD,SAAS,CAAC,EAAE,OAAO,CAAC,SAAS,EAAE,MAAM,CAAC,GACrC,MAAM,CAOR"}
package/dist/locale.js ADDED
@@ -0,0 +1,184 @@
1
+ export const ENGLISH_MESSAGES = {
2
+ "common.cancel": "Cancel",
3
+ "common.close": "Close",
4
+ "common.retry": "Retry",
5
+ "common.save": "Save",
6
+ "chat.title": "Messages",
7
+ "chat.empty": "No messages yet",
8
+ "chat.loadMore": "Load earlier messages",
9
+ "chat.sending": "Sending",
10
+ "chat.sent": "Sent",
11
+ "chat.failed": "Not delivered",
12
+ "chat.loadError": "Unable to load messages",
13
+ "chat.today": "Today",
14
+ "chat.yesterday": "Yesterday",
15
+ "chat.reply": "Reply",
16
+ "chat.retry": "Retry sending",
17
+ "chat.you": "You",
18
+ "chat.contact": "Contact",
19
+ /** Read before the quoted snippet, which is a button. */
20
+ "chat.jumpToReply": "Go to replied message:",
21
+ "chat.attachment": "Attachment",
22
+ "chat.openAttachment": "Open {name}",
23
+ "chat.messageActions": "Message actions",
24
+ "composer.label": "Message",
25
+ "composer.placeholder": "Write a message",
26
+ "composer.send": "Send",
27
+ "composer.sending": "Sending…",
28
+ "composer.attach": "Attach files",
29
+ "composer.attachments": "Attachments",
30
+ "composer.dropHint": "Drop files to attach",
31
+ "composer.uploading": "Uploading {name}",
32
+ "composer.uploadFailed": "Upload failed",
33
+ "composer.replyingTo": "Replying to {name}",
34
+ "composer.cancelReply": "Cancel reply",
35
+ "composer.removeAttachment": "Remove attachment",
36
+ "composer.removeNamedAttachment": "Remove {name}",
37
+ "composer.emoji": "Emoji",
38
+ "composer.emojiPicker": "Emoji picker",
39
+ "composer.emojiSearch": "Search emoji",
40
+ "composer.emojiNoResults": "No emoji found",
41
+ "composer.emojiNoRecent": "Emoji you use will appear here",
42
+ "composer.emojiCategories": "Emoji categories",
43
+ "composer.emojiCategory.recent": "Recent",
44
+ "composer.emojiCategory.smileys": "Smileys and emotion",
45
+ "composer.emojiCategory.people": "People and body",
46
+ "composer.emojiCategory.nature": "Animals and nature",
47
+ "composer.emojiCategory.food": "Food and drink",
48
+ "composer.emojiCategory.activities": "Activities",
49
+ "composer.emojiCategory.travel": "Travel and places",
50
+ "composer.emojiCategory.objects": "Objects",
51
+ "composer.emojiCategory.symbols": "Symbols",
52
+ "composer.emojiCategory.flags": "Flags",
53
+ "composer.voiceNote": "Record voice note",
54
+ "composer.recording": "Recording voice note",
55
+ "composer.recordingStopped": "Voice note recorded",
56
+ "composer.recordingCancelled": "Voice note deleted",
57
+ "composer.recordingLevel": "Microphone level",
58
+ "composer.cancelRecording": "Delete voice note",
59
+ "composer.sendVoiceNote": "Send voice note",
60
+ "composer.stopRecording": "Stop recording",
61
+ "composer.microphoneDenied": "Microphone permission was denied. Allow it in your browser settings to record.",
62
+ "composer.microphoneUnavailable": "No microphone is available.",
63
+ "composer.recordingFailed": "Recording failed. Try again.",
64
+ "composer.quickReplies": "Quick replies",
65
+ "templates.title": "Template builder",
66
+ "templates.name": "Template name",
67
+ "templates.header": "Header",
68
+ "templates.body": "Body",
69
+ "templates.footer": "Footer",
70
+ "templates.variables": "Variable examples",
71
+ "templates.buttons": "Buttons",
72
+ "templates.variableExample": "Variable {name} example",
73
+ "templates.buttonText": "Button {index} text",
74
+ "templates.cards": "Carousel cards",
75
+ "templates.cardBody": "Carousel card {index} body",
76
+ "templates.save": "Save draft",
77
+ "templates.preview": "Preview",
78
+ "templates.previewHint": "Save the draft, then preview it as a WhatsApp message.",
79
+ "templates.submit": "Submit to Meta",
80
+ "calls.incoming": "Incoming call",
81
+ "calls.outgoing": "Calling",
82
+ "calls.answer": "Answer",
83
+ "calls.reject": "Reject",
84
+ "calls.hangup": "Hang up",
85
+ "calls.mute": "Mute",
86
+ "calls.unmute": "Unmute",
87
+ "calls.cameraOn": "Turn camera on",
88
+ "calls.cameraOff": "Turn camera off",
89
+ "calls.reconnecting": "Reconnecting",
90
+ "calls.permissionDenied": "Camera or microphone permission was denied.",
91
+ "calls.audioCall": "WhatsApp audio call",
92
+ "calls.videoCall": "WhatsApp video call",
93
+ "calls.ringing": "Ringing",
94
+ "calls.connecting": "Connecting",
95
+ "calls.connected": "Connected",
96
+ "calls.ended": "Call ended",
97
+ "calls.failed": "Call failed",
98
+ "calls.controlFailed": "Could not end the call. Try again.",
99
+ "calls.answerFailed": "Could not connect the call. Try again.",
100
+ "calls.previousFailed": "The previous call could not be connected.",
101
+ "calls.answerWithCamera": "Answer with camera",
102
+ "calls.answerWithoutCamera": "Answer without camera",
103
+ "calls.answerMuted": "Answer muted",
104
+ "calls.answerUnmuted": "Answer unmuted",
105
+ "calls.deviceSettings": "Audio and video settings",
106
+ "calls.microphone": "Microphone",
107
+ "calls.speaker": "Speaker",
108
+ "calls.camera": "Camera",
109
+ "calls.microphoneSettings": "Microphone and speaker settings",
110
+ "calls.cameraSettings": "Camera settings",
111
+ "calls.popOut": "Open in a separate window",
112
+ "calls.popIn": "Return to the page",
113
+ "calls.placeAudioCall": "Place audio call",
114
+ "calls.placeVideoCall": "Place video call",
115
+ "calls.dialPlaceholder": "Phone number",
116
+ "calls.deleteDigit": "Delete last digit",
117
+ "calls.defaultDevice": "Default",
118
+ "calls.popoutTitle": "Call",
119
+ "calls.dismiss": "Dismiss",
120
+ "calls.join": "Join",
121
+ "calls.leave": "Leave call",
122
+ "calls.end": "End call for everyone",
123
+ "calls.answeredElsewhere": "Answered by another participant",
124
+ "calls.joinable": "Call in progress. You can join.",
125
+ "calls.otherIncoming": "Other incoming calls",
126
+ "calls.show": "Show",
127
+ "calls.participants": "Participants",
128
+ "calls.participantVideos": "Participant video",
129
+ "calls.participant": "Participant",
130
+ "calls.participantInvited": "Invited",
131
+ "calls.participantRinging": "Ringing",
132
+ "calls.participantConnected": "In call",
133
+ "calls.participantMuted": "Muted",
134
+ "calls.incomingFrom": "Incoming call from {peer}",
135
+ /** Outgoing call still ringing; the peer's position and the ellipsis belong to the locale. */
136
+ "calls.ringingTo": "Ringing {peer}…",
137
+ "calls.videoFrom": "Video from {name}",
138
+ "inbox.title": "Inbox",
139
+ "inbox.conversations": "Conversations",
140
+ "inbox.search": "Search conversations",
141
+ "inbox.empty": "No conversations yet",
142
+ "inbox.noMatches": "No conversations match",
143
+ "inbox.select": "Select a conversation to read it",
144
+ "inbox.back": "Back to conversations",
145
+ "inbox.unread": "{count} unread",
146
+ "inbox.loadMore": "Load more conversations",
147
+ "inbox.loadError": "Unable to load conversations",
148
+ "inbox.readOnly": "You can read this conversation but not reply.",
149
+ "inbox.you": "You: ",
150
+ "inbox.contact": "Contact details",
151
+ "inbox.showContact": "Show contact details",
152
+ "inbox.hideContact": "Hide contact details",
153
+ "inbox.phone": "Phone",
154
+ "inbox.email": "Email",
155
+ "inbox.about": "About",
156
+ "inbox.noContact": "No contact details",
157
+ "connect.button": "Connect WhatsApp",
158
+ "connect.opening": "Opening…",
159
+ "connect.failed": "Could not start the connection. Try again.",
160
+ "status.idle": "Not connected",
161
+ "status.loading": "Connecting",
162
+ "status.ready": "Connected",
163
+ "status.refreshing": "Connected",
164
+ "status.retrying": "Reconnecting",
165
+ "status.unauthenticated": "Signed out",
166
+ "status.error": "Connection problem",
167
+ "status.label": "Polymorfa connection: {status}",
168
+ "calls.call": "Call",
169
+ "templates.list": "Templates",
170
+ "templates.new": "New template",
171
+ "templates.empty": "No templates yet",
172
+ "templates.loadError": "Unable to load templates",
173
+ "templates.back": "Back to templates",
174
+ };
175
+ const RTL_LANGUAGES = new Set(["ar", "fa", "he", "ps", "ur"]);
176
+ export function createLocale(code, messages = {}, direction) {
177
+ const language = code.toLowerCase().split(/[-_]/, 1)[0] ?? "en";
178
+ return Object.freeze({
179
+ code,
180
+ direction: direction ?? (RTL_LANGUAGES.has(language) ? "rtl" : "ltr"),
181
+ messages: Object.freeze({ ...ENGLISH_MESSAGES, ...messages }),
182
+ });
183
+ }
184
+ //# sourceMappingURL=locale.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"locale.js","sourceRoot":"","sources":["../src/locale.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B,eAAe,EAAE,QAAQ;IACzB,cAAc,EAAE,OAAO;IACvB,cAAc,EAAE,OAAO;IACvB,aAAa,EAAE,MAAM;IACrB,YAAY,EAAE,UAAU;IACxB,YAAY,EAAE,iBAAiB;IAC/B,eAAe,EAAE,uBAAuB;IACxC,cAAc,EAAE,SAAS;IACzB,WAAW,EAAE,MAAM;IACnB,aAAa,EAAE,eAAe;IAC9B,gBAAgB,EAAE,yBAAyB;IAC3C,YAAY,EAAE,OAAO;IACrB,gBAAgB,EAAE,WAAW;IAC7B,YAAY,EAAE,OAAO;IACrB,YAAY,EAAE,eAAe;IAC7B,UAAU,EAAE,KAAK;IACjB,cAAc,EAAE,SAAS;IACzB,yDAAyD;IACzD,kBAAkB,EAAE,wBAAwB;IAC5C,iBAAiB,EAAE,YAAY;IAC/B,qBAAqB,EAAE,aAAa;IACpC,qBAAqB,EAAE,iBAAiB;IACxC,gBAAgB,EAAE,SAAS;IAC3B,sBAAsB,EAAE,iBAAiB;IACzC,eAAe,EAAE,MAAM;IACvB,kBAAkB,EAAE,UAAU;IAC9B,iBAAiB,EAAE,cAAc;IACjC,sBAAsB,EAAE,aAAa;IACrC,mB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AAW;IAChC,iBAAiB,EAAE,cAAc;IACjC,wBAAwB,EAAE,YAAY;IACtC,cAAc,EAAE,oBAAoB;IACpC,cAAc,EAAE,gCAAgC;IAChD,YAAY,EAAE,MAAM;IACpB,gBAAgB,EAAE,WAAW;IAC7B,eAAe,EAAE,cAAc;IAC/B,iBAAiB,EAAE,kBAAkB;IACrC,qBAAqB,EAAE,0BAA0B;IACjD,gBAAgB,EAAE,mBAAmB;CAC7B,CAAC;AAUX,MAAM,aAAa,GAAG,IAAI,GAAG,CAAC,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC;AAE9D,MAAM,UAAU,YAAY,CAC1B,IAAY,EACZ,WAAgD,EAAE,EAClD,SAAsC;IAEtC,MAAM,QAAQ,GAAG,IAAI,CAAC,WAAW,EAAE,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC;IAChE,OAAO,MAAM,CAAC,MAAM,CAAC;QACnB,IAAI;QACJ,SAAS,EAAE,SAAS,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC;QACrE,QAAQ,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,GAAG,gBAAgB,EAAE,GAAG,QAAQ,EAAE,CAAC;KAC9D,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare function redactDiagnostic(value: unknown): unknown;
2
+ //# sourceMappingURL=redaction.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"redaction.d.ts","sourceRoot":"","sources":["../src/redaction.ts"],"names":[],"mappings":"AAeA,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAWxD"}
@@ -0,0 +1,30 @@
1
+ const REDACTED = "[REDACTED]";
2
+ const SENSITIVE_KEYS = new Set([
3
+ "authorization",
4
+ "accesstoken",
5
+ "clienttoken",
6
+ "refreshtoken",
7
+ "token",
8
+ "secret",
9
+ "webhooksecret",
10
+ "password",
11
+ "messagebody",
12
+ "rawbody",
13
+ "body",
14
+ ]);
15
+ export function redactDiagnostic(value) {
16
+ if (Array.isArray(value))
17
+ return value.map(redactDiagnostic);
18
+ if (typeof value !== "object" || value === null)
19
+ return value;
20
+ return Object.fromEntries(Object.entries(value).map(([key, child]) => [
21
+ key,
22
+ SENSITIVE_KEYS.has(normalizeKey(key))
23
+ ? REDACTED
24
+ : redactDiagnostic(child),
25
+ ]));
26
+ }
27
+ function normalizeKey(key) {
28
+ return key.toLowerCase().replace(/[^a-z0-9]/g, "");
29
+ }
30
+ //# sourceMappingURL=redaction.js.map