/** * Resolve the unicode for the requested skin tone. * * Variations are matched by their tone segment rather than by array position — * relying on the index silently dropped the first tone (`0 || -1` is `-1`). */ export declare function applySkinTone(emoji: Emoji, skinTone: string): string; /** * Build a unicode -> emoji lookup across the bundled dataset and any custom * groups. Custom groups are merged first so bundled emoji win on conflicts, * matching the order used by {@link mergeEmojis}. */ export declare function buildLookup(extra?: EmojiRecord): Map; /** Built-in category keys in dataset order, without `recent`. */ export declare const BUILTIN_CATEGORIES: string[]; export declare interface CategoryInfo { key: string; title: string; /** Built-in icon unicode; empty for custom categories. */ u: string; } export declare const COLOR_THEMES: Array; export declare type ColorTheme = 'dark' | 'light' | 'auto'; export declare function createDefaultOptions(): EmojiOptions; export declare function createLocalStorageAdapter(): StorageAdapter | null; export declare function createMemoryStorage(): StorageAdapter; /** * Create a framework-agnostic picker instance. * * The returned object owns all state and exposes a `subscribe` callback; it has * no dependency on Vue or any other view layer. */ export declare function createPicker(initial?: Partial): EmojiPicker; export declare function createRecents(options: RecentsOptions): Recents; export declare interface CustomCategory { /** Unique key, also usable in `categories` and `i18n.categories`. */ key: string; name?: string; /** Icon URL for the category bar. */ icon?: string; emojis: Array; } /** Icon URL per custom category, from `customCategories[].icon`. */ export declare function customCategoryIcons(options: Pick): Record; /** * A custom emoji. Readable keys are preferred; the short keys used by the * bundled dataset (`n`, `u`, `v`) are also accepted. */ export declare interface CustomEmoji { /** Descriptive name, e.g. "party parrot". */ name?: string; /** Shortcodes without colons, e.g. ['party_parrot']. */ shortcodes?: string[]; /** Unique id; a unicode sequence for real emoji. */ unicode?: string; /** Skin tone variations (unicode sequences). */ skins?: string[]; /** Image URL. Rendered instead of the native glyph or image set. */ src?: string; n?: string[]; u?: string; v?: string[]; } /** Custom categories as an emoji record keyed by category key. */ export declare function customRecord(options: { customCategories?: CustomCategory[]; }): EmojiRecord; export declare const DEFAULT_EMOJI: { n: string[]; u: string; r: string; }; export declare const defaultEmojis: EmojiRecord; export declare const defaultGroups: Group[]; /** * An emoji in the dataset's compact shape: `n` names (descriptive name, * then shortcodes), `u` unicode, `v` skin tone variations. * * `r` (the resolved unicode for the active skin tone) is optional on input — * the picker adds it while filtering. */ export declare interface Emoji { [EMOJI_NAME_KEY]: string[]; [EMOJI_UNICODE_KEY]: string; [EMOJI_VARIATIONS_KEY]?: string[]; [EMOJI_RESULT_KEY]?: string; src?: string; } /** emoji-datasource version used for the image sets. */ export declare const EMOJI_DATASOURCE_VERSION = "16.0.0"; export declare const EMOJI_EMOJI_KEY = "i"; export declare const EMOJI_NAME_KEY = "n"; export declare const EMOJI_REMOTE_SRC = "https://cdn.jsdelivr.net/npm/emoji-datasource-apple@6.0.1/img/apple/64"; export declare const EMOJI_RESULT_KEY = "r"; export declare const EMOJI_SETS: EmojiSet[]; export declare const EMOJI_SKIN_TONE_KEY = "t"; export declare const EMOJI_UNICODE_KEY = "u"; export declare const EMOJI_VARIATIONS_KEY = "v"; /** * The `select` payload. * * Readable fields (`native`, `unicode`, `name`, …) are the 2.x API. The * single-letter keys are kept for 1.x compatibility and will be removed in * 3.0: `i` = native, `r` = unicode, `n` = [name, ...shortcodes], `t` = * skinTone, `u` = unicode without skin tone. */ export declare interface EmojiExt extends Emoji { /** The emoji character, e.g. "👍🏽". */ native: string; /** Unicode sequence including the skin tone, e.g. "1f44d-1f3fd". */ unicode: string; /** Unicode sequence without skin tone, e.g. "1f44d". */ baseUnicode: string; /** Descriptive name, e.g. "thumbs up". */ name: string; /** Shortcodes without colons, e.g. ["+1", "thumbsup"]. */ shortcodes: string[]; /** Active skin tone: "neutral" or a modifier such as "1f3fd". */ skinTone: string; /** Image URL for custom emoji. */ src?: string; /** @deprecated use `unicode` */ [EMOJI_RESULT_KEY]: string; /** @deprecated use `skinTone` */ [EMOJI_SKIN_TONE_KEY]: string; /** @deprecated use `native` */ [EMOJI_EMOJI_KEY]: string; } export declare interface EmojiOptions { theme: ColorTheme; /** Artwork; `native` uses the system font. */ set: EmojiSet; /** Custom image URL resolver; overrides `set`. */ imageUrl: ((unicode: string) => string) | null; /** Emoji per row. */ perLine: number; /** Emoji font/image size in px. */ emojiSize: number; searchPosition: 'top' | 'none'; navPosition: 'top' | 'none'; previewPosition: 'bottom' | 'none'; skinTonePosition: 'preview' | 'none'; categoryHeaders: 'sticky' | 'static' | 'none'; /** * Categories to show, in order, e.g. `['recent', 'smileys_people']`. * Empty shows everything: recent, custom categories, then built-ins. */ categories: string[]; customCategories: CustomCategory[]; /** Icon URL per category key. */ categoryIcons: Record; /** Unicode ids (e.g. `1f595`) to leave out everywhere. */ excludeEmojis: string[]; recent: 'none' | RecentMode; /** Maximum number of recent emoji shown. */ maxRecent: number; i18n: I18nInput; type: PickerType; insertMode: InsertMode; /** Popup placement for input/textarea types (Popper placement). */ placement: string; /** Popup offset in px for input/textarea types. */ offset: number; /** Attributes bound to the input/textarea. */ inputAttrs: Record; /** Focus search on mount (inline) or when the popup opens. */ autoFocus: boolean; /** * Skin tone to use: `neutral` or a modifier such as `1f3fd`. When left * out, the last tone picked is restored from `storage`. Changing it later * moves the picker to that tone; picks made in the UI are always saved. */ skinTone?: string; /** Defaults to localStorage, falling back to in-memory. */ storage?: StorageAdapter; } export declare interface EmojiPicker { /** Live state. Treat as read-only. */ getState(): PickerState; subscribe(listener: (state: PickerState) => void): () => void; setOptions(options: Partial): void; setSearch(value: string): void; setSkinTone(tone: string): void; setActiveGroup(key: string): void; hover(emoji: Emoji): void; /** * Resolve the selection payload and record it as recent. Pass * `{ reorderRecent: false }` when the pick comes from the recent category * so the list does not shuffle under the pointer; the new order is * persisted and shown on the next `setOptions` or `refreshRecent`. */ select(emoji: Emoji, options?: { reorderRecent?: boolean; }): EmojiExt; /** Re-read the recent list from storage into state. */ refreshRecent(): void; /** Emoji filtered by search, skin tone, categories and exclusions. */ results(): EmojiRecord; /** Visible categories in display order, with resolved names. */ categories(): CategoryInfo[]; /** Resolved strings. */ i18n(): I18n; destroy(): void; } export declare type EmojiRecord = Record; /** Artwork used to render emoji. `native` uses the system font. */ export declare type EmojiSet = 'native' | 'apple' | 'google' | 'twitter' | 'facebook'; /** English strings; the default and the shape every locale follows. */ export declare const EN_I18N: I18n; /** * Filter emoji by search keyword. * * Matches against *every* alias, not just the canonical name, so shortcodes * such as `thumbsup`, `+1` and `joy_cat` are searchable. */ export declare function filterEmojis(emojis: EmojiRecord, keyword: string, skinTone: string, disabledGroups?: string[], disabledEmojis?: string[]): EmojiRecord; /** * Resolved lazily (not at module scope) so a consumer that installs a * localStorage shim after import still gets persistence. */ export declare function getDefaultStorage(): StorageAdapter; /** * CDN URL for an emoji image from one of the emoji-datasource sets. * * Licensing differs per set: Twitter (Twemoji, CC-BY 4.0) and Google * (Noto, Apache 2.0) can be used commercially; check Apple and Facebook * artwork terms before shipping them in a product. */ export declare function getEmojiImageUrl(unicode: string, set?: Exclude): string; export declare interface Group { key: GroupKeys; title: string; u: string; } export declare type GroupKeys = 'smileys_people' | 'animals_nature' | 'food_drink' | 'activities' | 'travel_places' | 'objects' | 'symbols' | 'flags' | 'recent'; export declare type GroupNames = Record; /** True when the IndexedDB API is reachable. */ export declare function hasIndexedDB(): boolean; /** Every user-facing string. Pass a partial object to override some. */ export declare interface I18n { /** Search input placeholder. */ search: string; /** Accessible label of the search input. */ searchLabel: string; /** Accessible label of the category bar. */ categoriesLabel: string; noResults: string; /** Skin tone button text. */ skinTone: string; /** Names of the six skin tones, from default to dark. */ skinTones: string[]; /** Category names by key, including custom categories. */ categories: Record; } export declare type I18nInput = Partial> & { categories?: Record; }; export declare interface ImageResolverOptions { set?: EmojiSet; /** Overrides `set`, e.g. to self-host: `(u) => '/emoji/' + u + '.png'`. */ imageUrl?: ((unicode: string) => string) | null; } export declare type InsertMode = 'caret' | 'append' | 'prepend'; /** * Check if the current platform is macOS. * * `navigator` is not defined in Node or in some workers, and optional chaining * does not guard an undeclared global, so the reference itself is guarded. */ export declare function isMac(): boolean; /** IndexedDB names used by 1.1.x to store recent emoji. */ export declare const LEGACY_DB_NAME = "EMJ"; export declare const LEGACY_MIGRATED_KEY = "vue3-emoji-picker.migrated"; export declare const LEGACY_STORE_NAME = "emojis"; export declare const MAX_RECENT = 24; /** Entries kept in storage, so `maxRecent` and `frequent` have history. */ export declare const MAX_STORED_RECENT = 100; /** Record shape consumed by search: recent first, then custom, then bundled. */ export declare function mergeEmojis(custom: EmojiRecord | undefined, recent: Emoji[]): EmojiRecord; /** * Move recent emoji saved by 1.1.x (IndexedDB) into the 1.2 storage format, * then delete the old database. Runs at most once per storage; never throws. * * @returns true when entries were added to `storage`. */ export declare function migrateLegacyRecents(storage: StorageAdapter): Promise; /** * Accept a custom emoji in the readable shape (`name`, `shortcodes`, * `unicode`, `skins`) or the compact dataset shape (`n`, `u`, `v`). */ export declare function normalizeEmoji(input: CustomEmoji | Emoji): Emoji | null; export declare function normalizeKeyword(value: string): string; export declare interface PickerState { search: string; skinTone: string; activeGroup: string; hovered: Emoji; recent: Emoji[]; options: EmojiOptions; } export declare type PickerType = 'inline' | 'input' | 'textarea'; export declare const RECENT_CATEGORY = "recent"; export declare const RECENT_STORAGE_KEY = "vue3-emoji-picker.recent"; /** * A persisted recent selection. * * Only the unicode id is stored, so the emoji is resolved against the current * dataset at render time. That keeps the active skin tone correct and lets * removed emoji disappear instead of rendering as stale copies. */ export declare interface RecentEntry { /** Emoji unicode, the dataset key. */ u: string; /** Selection count, kept for frequency ordering later. */ count: number; /** Last selection timestamp, used for most-recently-used ordering. */ at: number; } /** `recent`: most recently used first. `frequent`: most used first. */ export declare type RecentMode = 'recent' | 'frequent'; export declare interface Recents { entries(): RecentEntry[]; list(view?: RecentView): Emoji[]; add(emoji: Emoji, view?: RecentView): Emoji[]; /** Re-read entries from storage (e.g. after a migration wrote to it). */ reload(): void; clear(): void; } export declare interface RecentsOptions { resolve: (unicode: string) => Emoji | undefined; storage?: StorageAdapter; max?: number; } export declare interface RecentView { mode?: RecentMode; max?: number; } /** * Replace every known `:shortcode:` in a string with its native emoji. * Unknown codes are left untouched. */ export declare function replaceShortcodes(text: string, options?: ShortcodeOptions): string; export declare function resolveCategories(options: EmojiOptions): CategoryInfo[]; /** Visible category keys in display order. */ export declare function resolveCategoryKeys(options: Pick): string[]; /** Category names: i18n first, then a custom category's `name`. */ export declare function resolveCategoryNames(options: Pick): Record; /** * Resolve the image for an emoji, or `null` to render the native glyph. * A custom emoji's own `src` always wins. */ export declare function resolveEmojiImage(emoji: Emoji, unicode: string, { set, imageUrl }?: ImageResolverOptions): string | null; /** Merge partial strings over English. Empty values fall back too. */ export declare function resolveI18n(input?: I18nInput): I18n; /** Alias with a clearer name for non-Vue consumers. */ export declare const searchEmojis: typeof filterEmojis; export declare interface ShortcodeOptions { /** Skin tone unicode (e.g. `1f3fb`) applied when the code has none. */ skinTone?: string; /** Custom categories whose shortcodes should also resolve. */ customCategories?: CustomCategory[]; } /** * Convert a single shortcode (`wave`, `:wave:`, `:+1::skin-tone-2:`) to its * native emoji. Returns an empty string for unknown codes. */ export declare function shortcodeToEmoji(shortcode: string, options?: ShortcodeOptions): string; export declare const SKIN_TONE_DARK = "1f3ff"; export declare const SKIN_TONE_LIGHT = "1f3fb"; export declare const SKIN_TONE_MEDIUM = "1f3fd"; export declare const SKIN_TONE_MEDIUM_DARK = "1f3fe"; export declare const SKIN_TONE_MEDIUM_LIGHT = "1f3fc"; export declare const SKIN_TONE_NEUTRAL = "neutral"; export declare const SKIN_TONE_STORAGE_KEY = "vue3-emoji-picker.skin-tone"; export declare const SKIN_TONES: string[]; /** * Change snake case to capitalised words, e.g. my_custom_group to My Custom Group. */ export declare function snakeToCapitalizedCase(string: string): string; export declare interface State { emojis: EmojiRecord; search: string; emoji: Emoji; activeGroup: string; skinTone: string; options: EmojiOptions; recent: Emoji[]; /** Visible category keys in display order. */ categoryKeys: string[]; /** Visible categories with resolved names. */ categories: CategoryInfo[]; /** Resolved category names by key. */ categoryNames: Record; /** Resolved strings. */ i18n: I18n; } export declare interface StorageAdapter { getItem(key: string): string | null; setItem(key: string, value: string): void; removeItem(key: string): void; } export declare interface Store { state: State; updateSearch: (v: string) => void; updateEmoji: (v: Emoji) => void; updateSelect: (v: Emoji, fromRecent?: boolean) => void; refreshRecent: () => void; updateActiveGroup: (v: string) => void; updateSkinTone: (v: string) => void; updateOptions: (v: Partial) => void; } /** Build the `select` payload: readable fields plus the 1.x short keys. */ export declare function toSelection(emoji: Emoji, skinTone: string): EmojiExt; /** * Convert a hyphen-separated unicode sequence to the native character. * * Invalid input returns an empty string instead of throwing — the value can * come from user-supplied `additionalGroups`. */ export declare function unicodeToEmoji(unicode: string): string; export { }