autumnnote 1.0.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.
Files changed (50) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +874 -0
  3. package/dist/autumnnote.css +1 -0
  4. package/dist/autumnnote.es.js +5888 -0
  5. package/dist/autumnnote.es.js.map +1 -0
  6. package/dist/autumnnote.umd.js +74 -0
  7. package/dist/autumnnote.umd.js.map +1 -0
  8. package/package.json +55 -0
  9. package/src/js/Context.js +497 -0
  10. package/src/js/core/dom.js +315 -0
  11. package/src/js/core/env.js +25 -0
  12. package/src/js/core/func.js +153 -0
  13. package/src/js/core/key.js +66 -0
  14. package/src/js/core/lists.js +121 -0
  15. package/src/js/core/markdown.js +294 -0
  16. package/src/js/core/range.js +194 -0
  17. package/src/js/core/sanitise.js +78 -0
  18. package/src/js/editing/History.js +205 -0
  19. package/src/js/editing/Style.js +329 -0
  20. package/src/js/editing/Table.js +59 -0
  21. package/src/js/editing/Typing.js +142 -0
  22. package/src/js/index.js +126 -0
  23. package/src/js/module/Buttons.js +300 -0
  24. package/src/js/module/Clipboard.js +460 -0
  25. package/src/js/module/CodeTooltip.js +428 -0
  26. package/src/js/module/Codeview.js +122 -0
  27. package/src/js/module/ContextMenu.js +470 -0
  28. package/src/js/module/Editor.js +528 -0
  29. package/src/js/module/EmojiDialog.js +726 -0
  30. package/src/js/module/FindReplace.js +440 -0
  31. package/src/js/module/Fullscreen.js +80 -0
  32. package/src/js/module/IconDialog.js +620 -0
  33. package/src/js/module/ImageDialog.js +208 -0
  34. package/src/js/module/ImageResizer.js +216 -0
  35. package/src/js/module/ImageTooltip.js +286 -0
  36. package/src/js/module/LinkDialog.js +204 -0
  37. package/src/js/module/LinkTooltip.js +242 -0
  38. package/src/js/module/Placeholder.js +44 -0
  39. package/src/js/module/ShortcutsDialog.js +141 -0
  40. package/src/js/module/Statusbar.js +238 -0
  41. package/src/js/module/TableTooltip.js +568 -0
  42. package/src/js/module/Toolbar.js +562 -0
  43. package/src/js/module/VideoDialog.js +263 -0
  44. package/src/js/module/VideoResizer.js +227 -0
  45. package/src/js/module/VideoTooltip.js +252 -0
  46. package/src/js/renderer.js +107 -0
  47. package/src/js/settings.js +134 -0
  48. package/src/styles/_variables.scss +48 -0
  49. package/src/styles/autumnnote.scss +1740 -0
  50. package/types/index.d.ts +324 -0
@@ -0,0 +1,726 @@
1
+ /**
2
+ * EmojiDialog.js - Browse and insert Unicode emoji / symbols (UTF-8 / utf8mb4)
3
+ * Click an emoji to insert it directly at the caret — no extra "Insert" step.
4
+ */
5
+
6
+ import { createElement, on, trapFocus } from '../core/dom.js';
7
+ import { withSavedRange } from '../core/range.js';
8
+
9
+ // ---------------------------------------------------------------------------
10
+ // Emoji catalogue
11
+ // ---------------------------------------------------------------------------
12
+
13
+ const EMOJI_CATS = [
14
+ { id: 'smileys', label: 'Smileys' },
15
+ { id: 'people', label: 'People' },
16
+ { id: 'animals', label: 'Animals' },
17
+ { id: 'food', label: 'Food' },
18
+ { id: 'travel', label: 'Travel' },
19
+ { id: 'objects', label: 'Objects' },
20
+ { id: 'symbols', label: 'Symbols' },
21
+ ];
22
+
23
+ // [emoji_char, search_keywords, category]
24
+ const EMOJI_LIST = [
25
+ // Smileys & Emotions
26
+ ['😀', 'grin smile happy face', 'smileys'],
27
+ ['😃', 'happy smile big eyes', 'smileys'],
28
+ ['😄', 'grinning smile laugh', 'smileys'],
29
+ ['😁', 'beaming smile grin', 'smileys'],
30
+ ['😆', 'laughing lol', 'smileys'],
31
+ ['😅', 'sweat grin awkward', 'smileys'],
32
+ ['🤣', 'rolling laugh rofl', 'smileys'],
33
+ ['😂', 'tears laugh cry joy', 'smileys'],
34
+ ['🙂', 'slight smile', 'smileys'],
35
+ ['🙃', 'upside down smile', 'smileys'],
36
+ ['😉', 'wink', 'smileys'],
37
+ ['😊', 'blush smile happy', 'smileys'],
38
+ ['😇', 'innocent halo angel', 'smileys'],
39
+ ['🥰', 'hearts love adore', 'smileys'],
40
+ ['😍', 'heart eyes love', 'smileys'],
41
+ ['🤩', 'star eyes excited wow', 'smileys'],
42
+ ['😘', 'kiss blow love', 'smileys'],
43
+ ['😋', 'yum delicious tongue', 'smileys'],
44
+ ['😛', 'tongue stuck out', 'smileys'],
45
+ ['😜', 'wink tongue crazy', 'smileys'],
46
+ ['🤪', 'zany crazy wild', 'smileys'],
47
+ ['😝', 'squint tongue', 'smileys'],
48
+ ['🤑', 'money mouth', 'smileys'],
49
+ ['🤗', 'hugging hug', 'smileys'],
50
+ ['🤔', 'thinking hmm', 'smileys'],
51
+ ['🤨', 'raised eyebrow', 'smileys'],
52
+ ['😐', 'neutral face', 'smileys'],
53
+ ['😶', 'no mouth', 'smileys'],
54
+ ['😏', 'smirk', 'smileys'],
55
+ ['😒', 'unamused', 'smileys'],
56
+ ['🙄', 'roll eyes', 'smileys'],
57
+ ['😬', 'grimace', 'smileys'],
58
+ ['😔', 'pensive sad', 'smileys'],
59
+ ['😪', 'sleepy tired', 'smileys'],
60
+ ['😴', 'sleeping zzz', 'smileys'],
61
+ ['🤤', 'drool', 'smileys'],
62
+ ['😷', 'mask sick', 'smileys'],
63
+ ['🤒', 'sick thermometer', 'smileys'],
64
+ ['🤕', 'hurt bandage', 'smileys'],
65
+ ['🤢', 'nausea sick', 'smileys'],
66
+ ['🤮', 'vomit sick', 'smileys'],
67
+ ['🤧', 'sneeze cold', 'smileys'],
68
+ ['🥵', 'hot sweat', 'smileys'],
69
+ ['🥶', 'cold freeze', 'smileys'],
70
+ ['😵', 'dizzy dead', 'smileys'],
71
+ ['🤯', 'mind blown', 'smileys'],
72
+ ['🤠', 'cowboy hat', 'smileys'],
73
+ ['🥳', 'party celebrate', 'smileys'],
74
+ ['😎', 'cool sunglasses', 'smileys'],
75
+ ['🤓', 'nerd glasses', 'smileys'],
76
+ ['🧐', 'monocle curious', 'smileys'],
77
+ ['😕', 'confused', 'smileys'],
78
+ ['😟', 'worried', 'smileys'],
79
+ ['🙁', 'frown sad', 'smileys'],
80
+ ['☹️', 'sad frown', 'smileys'],
81
+ ['😮', 'surprised open mouth', 'smileys'],
82
+ ['😲', 'astonished', 'smileys'],
83
+ ['🥺', 'pleading begging puppy eyes', 'smileys'],
84
+ ['😢', 'cry sad tear', 'smileys'],
85
+ ['😭', 'sob cry loudly', 'smileys'],
86
+ ['😱', 'scream horror fear', 'smileys'],
87
+ ['😡', 'angry red pouting', 'smileys'],
88
+ ['😠', 'angry mad', 'smileys'],
89
+ ['🤬', 'cursing swear', 'smileys'],
90
+ ['😈', 'devil evil smile', 'smileys'],
91
+ ['👿', 'devil angry evil', 'smileys'],
92
+ ['💀', 'skull death', 'smileys'],
93
+ ['☠️', 'skull crossbones', 'smileys'],
94
+ ['💩', 'poop', 'smileys'],
95
+ ['🤡', 'clown', 'smileys'],
96
+ ['👻', 'ghost boo', 'smileys'],
97
+ ['👽', 'alien ufo', 'smileys'],
98
+ ['🤖', 'robot', 'smileys'],
99
+
100
+ // People & Body
101
+ ['👋', 'wave hello hi hand', 'people'],
102
+ ['🤚', 'raised back hand', 'people'],
103
+ ['✋', 'raised hand stop', 'people'],
104
+ ['🖖', 'vulcan salute spock', 'people'],
105
+ ['👌', 'ok perfect fine', 'people'],
106
+ ['✌️', 'peace victory fingers', 'people'],
107
+ ['🤞', 'fingers crossed luck', 'people'],
108
+ ['🤟', 'love you gesture', 'people'],
109
+ ['🤘', 'sign of horns rock', 'people'],
110
+ ['🤙', 'call me hand', 'people'],
111
+ ['👈', 'point left', 'people'],
112
+ ['👉', 'point right', 'people'],
113
+ ['👆', 'point up', 'people'],
114
+ ['👇', 'point down', 'people'],
115
+ ['☝️', 'index pointing up', 'people'],
116
+ ['👍', 'thumbs up like good', 'people'],
117
+ ['👎', 'thumbs down dislike bad', 'people'],
118
+ ['✊', 'raised fist punch', 'people'],
119
+ ['👊', 'oncoming fist punch', 'people'],
120
+ ['👏', 'clap applause', 'people'],
121
+ ['🙌', 'celebrate raise hands', 'people'],
122
+ ['🤝', 'handshake deal', 'people'],
123
+ ['🙏', 'pray hope please thanks', 'people'],
124
+ ['💅', 'nail polish', 'people'],
125
+ ['💪', 'flexed bicep strong muscle', 'people'],
126
+ ['👀', 'eyes look see', 'people'],
127
+ ['👁️', 'eye', 'people'],
128
+ ['👅', 'tongue', 'people'],
129
+ ['👶', 'baby', 'people'],
130
+ ['🧒', 'child', 'people'],
131
+ ['👦', 'boy', 'people'],
132
+ ['👧', 'girl', 'people'],
133
+ ['🧑', 'person adult', 'people'],
134
+ ['👨', 'man', 'people'],
135
+ ['👩', 'woman', 'people'],
136
+ ['🧔', 'beard man', 'people'],
137
+ ['🧓', 'older person', 'people'],
138
+ ['👴', 'old man', 'people'],
139
+ ['👵', 'old woman', 'people'],
140
+ ['❤️', 'heart love red', 'people'],
141
+ ['🧡', 'orange heart love', 'people'],
142
+ ['💛', 'yellow heart love', 'people'],
143
+ ['💚', 'green heart love', 'people'],
144
+ ['💙', 'blue heart love', 'people'],
145
+ ['💜', 'purple heart love', 'people'],
146
+ ['🖤', 'black heart', 'people'],
147
+ ['🤍', 'white heart', 'people'],
148
+ ['🤎', 'brown heart', 'people'],
149
+ ['💔', 'broken heart', 'people'],
150
+ ['❣️', 'exclamation heart', 'people'],
151
+ ['💕', 'two hearts love', 'people'],
152
+ ['💞', 'revolving hearts', 'people'],
153
+ ['💓', 'beating heart', 'people'],
154
+ ['💗', 'growing heart', 'people'],
155
+ ['💖', 'sparkling heart', 'people'],
156
+ ['💘', 'heart arrow', 'people'],
157
+ ['💝', 'heart ribbon', 'people'],
158
+ ['💬', 'speech bubble comment chat', 'people'],
159
+ ['💭', 'thought bubble', 'people'],
160
+ ['💯', '100 hundred percent perfect', 'people'],
161
+ ['💢', 'anger symbol mad', 'people'],
162
+ ['💤', 'zzz sleep', 'people'],
163
+
164
+ // Animals & Nature
165
+ ['🐶', 'dog puppy', 'animals'],
166
+ ['🐱', 'cat kitten', 'animals'],
167
+ ['🐭', 'mouse', 'animals'],
168
+ ['🐹', 'hamster', 'animals'],
169
+ ['🐰', 'rabbit bunny', 'animals'],
170
+ ['🦊', 'fox', 'animals'],
171
+ ['🐻', 'bear', 'animals'],
172
+ ['🐼', 'panda', 'animals'],
173
+ ['🐨', 'koala', 'animals'],
174
+ ['🐯', 'tiger', 'animals'],
175
+ ['🦁', 'lion', 'animals'],
176
+ ['🐮', 'cow', 'animals'],
177
+ ['🐷', 'pig', 'animals'],
178
+ ['🐸', 'frog', 'animals'],
179
+ ['🐵', 'monkey', 'animals'],
180
+ ['🙈', 'see no evil monkey', 'animals'],
181
+ ['🙉', 'hear no evil monkey', 'animals'],
182
+ ['🙊', 'speak no evil monkey', 'animals'],
183
+ ['🐔', 'chicken hen', 'animals'],
184
+ ['🐧', 'penguin', 'animals'],
185
+ ['🐦', 'bird', 'animals'],
186
+ ['🦆', 'duck', 'animals'],
187
+ ['🦅', 'eagle', 'animals'],
188
+ ['🦉', 'owl', 'animals'],
189
+ ['🦇', 'bat', 'animals'],
190
+ ['🐺', 'wolf', 'animals'],
191
+ ['🐴', 'horse', 'animals'],
192
+ ['🦄', 'unicorn', 'animals'],
193
+ ['🐝', 'bee', 'animals'],
194
+ ['🦋', 'butterfly', 'animals'],
195
+ ['🐌', 'snail', 'animals'],
196
+ ['🐞', 'ladybug', 'animals'],
197
+ ['🐢', 'turtle', 'animals'],
198
+ ['🐍', 'snake', 'animals'],
199
+ ['🦎', 'lizard', 'animals'],
200
+ ['🐊', 'crocodile', 'animals'],
201
+ ['🐟', 'fish', 'animals'],
202
+ ['🐠', 'tropical fish', 'animals'],
203
+ ['🦈', 'shark', 'animals'],
204
+ ['🐬', 'dolphin', 'animals'],
205
+ ['🐳', 'whale', 'animals'],
206
+ ['🐙', 'octopus', 'animals'],
207
+ ['🦑', 'squid', 'animals'],
208
+ ['🦀', 'crab', 'animals'],
209
+ ['🌸', 'cherry blossom flower', 'animals'],
210
+ ['🌺', 'hibiscus flower', 'animals'],
211
+ ['🌻', 'sunflower', 'animals'],
212
+ ['🌹', 'rose flower', 'animals'],
213
+ ['🌷', 'tulip flower', 'animals'],
214
+ ['🍀', 'four leaf clover luck', 'animals'],
215
+ ['🌿', 'herb leaf green', 'animals'],
216
+ ['🌱', 'seedling sprout', 'animals'],
217
+ ['🌲', 'evergreen tree pine', 'animals'],
218
+ ['🌳', 'deciduous tree', 'animals'],
219
+ ['🌴', 'palm tree', 'animals'],
220
+ ['🍄', 'mushroom', 'animals'],
221
+ ['🌾', 'sheaf wheat', 'animals'],
222
+ ['🐾', 'paw prints animal', 'animals'],
223
+
224
+ // Food & Drink
225
+ ['🍎', 'apple red', 'food'],
226
+ ['🍊', 'orange tangerine', 'food'],
227
+ ['🍋', 'lemon yellow', 'food'],
228
+ ['🍇', 'grapes', 'food'],
229
+ ['🍓', 'strawberry', 'food'],
230
+ ['🫐', 'blueberry', 'food'],
231
+ ['🍒', 'cherry', 'food'],
232
+ ['🍑', 'peach', 'food'],
233
+ ['🥭', 'mango', 'food'],
234
+ ['🍍', 'pineapple', 'food'],
235
+ ['🥥', 'coconut', 'food'],
236
+ ['🥝', 'kiwi', 'food'],
237
+ ['🍅', 'tomato', 'food'],
238
+ ['🥑', 'avocado', 'food'],
239
+ ['🍆', 'eggplant aubergine', 'food'],
240
+ ['🥕', 'carrot', 'food'],
241
+ ['🌽', 'corn', 'food'],
242
+ ['🥦', 'broccoli', 'food'],
243
+ ['🥬', 'leafy green', 'food'],
244
+ ['🧄', 'garlic', 'food'],
245
+ ['🥜', 'peanut nut', 'food'],
246
+ ['🍞', 'bread loaf', 'food'],
247
+ ['🥐', 'croissant', 'food'],
248
+ ['🧀', 'cheese', 'food'],
249
+ ['🍳', 'egg fry cooking', 'food'],
250
+ ['🥚', 'egg', 'food'],
251
+ ['🥞', 'pancake', 'food'],
252
+ ['🧇', 'waffle', 'food'],
253
+ ['🥓', 'bacon', 'food'],
254
+ ['🥩', 'meat steak', 'food'],
255
+ ['🍗', 'chicken leg', 'food'],
256
+ ['🌭', 'hotdog', 'food'],
257
+ ['🍔', 'burger hamburger', 'food'],
258
+ ['🍟', 'fries french', 'food'],
259
+ ['🍕', 'pizza', 'food'],
260
+ ['🌮', 'taco', 'food'],
261
+ ['🌯', 'burrito wrap', 'food'],
262
+ ['🍜', 'noodles ramen', 'food'],
263
+ ['🍝', 'spaghetti pasta', 'food'],
264
+ ['🍣', 'sushi', 'food'],
265
+ ['🍱', 'bento box', 'food'],
266
+ ['🍦', 'ice cream soft serve', 'food'],
267
+ ['🍩', 'donut', 'food'],
268
+ ['🍪', 'cookie', 'food'],
269
+ ['🎂', 'birthday cake', 'food'],
270
+ ['🍰', 'cake slice', 'food'],
271
+ ['🧁', 'cupcake', 'food'],
272
+ ['🍫', 'chocolate', 'food'],
273
+ ['🍬', 'candy', 'food'],
274
+ ['🍭', 'lollipop', 'food'],
275
+ ['☕', 'coffee hot', 'food'],
276
+ ['🍵', 'tea hot', 'food'],
277
+ ['🧋', 'bubble tea boba', 'food'],
278
+ ['🥤', 'cup straw drink', 'food'],
279
+ ['🍷', 'wine red', 'food'],
280
+ ['🍸', 'cocktail martini', 'food'],
281
+ ['🍺', 'beer mug', 'food'],
282
+ ['🍻', 'clinking beer mugs', 'food'],
283
+ ['🥂', 'champagne toast celebrate', 'food'],
284
+ ['🧃', 'juice box', 'food'],
285
+ ['🧊', 'ice cube', 'food'],
286
+
287
+ // Travel & Places
288
+ ['🚀', 'rocket space', 'travel'],
289
+ ['🛸', 'ufo flying saucer', 'travel'],
290
+ ['✈️', 'airplane plane fly', 'travel'],
291
+ ['🚁', 'helicopter', 'travel'],
292
+ ['🚂', 'train locomotive', 'travel'],
293
+ ['🚄', 'bullet train fast', 'travel'],
294
+ ['🚇', 'subway metro', 'travel'],
295
+ ['🚌', 'bus', 'travel'],
296
+ ['🚑', 'ambulance', 'travel'],
297
+ ['🚒', 'fire truck', 'travel'],
298
+ ['🚓', 'police car', 'travel'],
299
+ ['🚕', 'taxi cab', 'travel'],
300
+ ['🚗', 'car automobile red', 'travel'],
301
+ ['🚙', 'suv car', 'travel'],
302
+ ['🚚', 'truck delivery', 'travel'],
303
+ ['🚜', 'tractor farm', 'travel'],
304
+ ['🏎️', 'racing car fast', 'travel'],
305
+ ['🏍️', 'motorcycle', 'travel'],
306
+ ['🚲', 'bicycle bike', 'travel'],
307
+ ['🛴', 'scooter kick', 'travel'],
308
+ ['⛵', 'sailboat boat', 'travel'],
309
+ ['🚢', 'ship cruise', 'travel'],
310
+ ['🏠', 'house home', 'travel'],
311
+ ['🏢', 'office building', 'travel'],
312
+ ['🏥', 'hospital', 'travel'],
313
+ ['🏦', 'bank', 'travel'],
314
+ ['🏪', 'store shop convenience', 'travel'],
315
+ ['🏫', 'school', 'travel'],
316
+ ['🏰', 'castle european', 'travel'],
317
+ ['🏯', 'japanese castle', 'travel'],
318
+ ['🗼', 'tokyo tower', 'travel'],
319
+ ['🗽', 'statue liberty new york', 'travel'],
320
+ ['⛪', 'church', 'travel'],
321
+ ['🕌', 'mosque', 'travel'],
322
+ ['⛩️', 'shinto shrine', 'travel'],
323
+ ['⛲', 'fountain', 'travel'],
324
+ ['⛺', 'tent camping', 'travel'],
325
+ ['🌁', 'fog foggy bridge', 'travel'],
326
+ ['🌃', 'night city stars', 'travel'],
327
+ ['🏙️', 'cityscape city buildings', 'travel'],
328
+ ['🌅', 'sunrise morning', 'travel'],
329
+ ['🌈', 'rainbow colorful', 'travel'],
330
+ ['⛰️', 'mountain', 'travel'],
331
+ ['🏔️', 'snow mountain', 'travel'],
332
+ ['🗻', 'mount fuji', 'travel'],
333
+ ['🏕️', 'camping tent', 'travel'],
334
+ ['🗺️', 'world map', 'travel'],
335
+ ['🧭', 'compass navigation', 'travel'],
336
+ ['🌍', 'earth europe africa globe', 'travel'],
337
+ ['🌎', 'earth americas globe', 'travel'],
338
+ ['🌏', 'earth asia globe', 'travel'],
339
+ ['🌐', 'globe internet web', 'travel'],
340
+
341
+ // Objects
342
+ ['💎', 'diamond gem jewel', 'objects'],
343
+ ['💍', 'ring engagement', 'objects'],
344
+ ['👑', 'crown royal king queen', 'objects'],
345
+ ['🎩', 'top hat magic', 'objects'],
346
+ ['💼', 'briefcase work business', 'objects'],
347
+ ['👜', 'handbag purse', 'objects'],
348
+ ['🎒', 'backpack bag school', 'objects'],
349
+ ['👓', 'glasses eyewear', 'objects'],
350
+ ['🕶️', 'sunglasses cool', 'objects'],
351
+ ['💡', 'light bulb idea', 'objects'],
352
+ ['🔦', 'flashlight torch', 'objects'],
353
+ ['🕯️', 'candle light', 'objects'],
354
+ ['🔋', 'battery charge', 'objects'],
355
+ ['💻', 'laptop computer', 'objects'],
356
+ ['🖥️', 'desktop monitor computer', 'objects'],
357
+ ['📱', 'phone mobile cell', 'objects'],
358
+ ['⌨️', 'keyboard type', 'objects'],
359
+ ['🖱️', 'mouse computer click', 'objects'],
360
+ ['📺', 'television tv', 'objects'],
361
+ ['📷', 'camera photo', 'objects'],
362
+ ['📹', 'video camera', 'objects'],
363
+ ['🎥', 'movie camera film', 'objects'],
364
+ ['☎️', 'telephone phone', 'objects'],
365
+ ['⏰', 'alarm clock wake', 'objects'],
366
+ ['⌚', 'watch time', 'objects'],
367
+ ['🔑', 'key', 'objects'],
368
+ ['🗝️', 'old key', 'objects'],
369
+ ['🔒', 'lock closed', 'objects'],
370
+ ['🔓', 'unlock open', 'objects'],
371
+ ['🔨', 'hammer tool', 'objects'],
372
+ ['🔧', 'wrench tool', 'objects'],
373
+ ['🔩', 'bolt nut', 'objects'],
374
+ ['⚙️', 'gear setting', 'objects'],
375
+ ['🧲', 'magnet attract', 'objects'],
376
+ ['📚', 'books stack library', 'objects'],
377
+ ['📖', 'book open read', 'objects'],
378
+ ['📝', 'memo write note', 'objects'],
379
+ ['✏️', 'pencil write edit', 'objects'],
380
+ ['📌', 'pushpin tack', 'objects'],
381
+ ['📎', 'paperclip attach', 'objects'],
382
+ ['📊', 'bar chart graph', 'objects'],
383
+ ['📈', 'chart up growth trend', 'objects'],
384
+ ['📉', 'chart down loss decline', 'objects'],
385
+ ['📅', 'calendar date', 'objects'],
386
+ ['📦', 'package box', 'objects'],
387
+ ['📫', 'mailbox closed', 'objects'],
388
+ ['📧', 'email envelope', 'objects'],
389
+ ['🎁', 'gift present', 'objects'],
390
+ ['🎀', 'ribbon bow', 'objects'],
391
+ ['🎉', 'party celebrate confetti', 'objects'],
392
+ ['🎊', 'confetti celebrate', 'objects'],
393
+ ['🔮', 'crystal ball magic fortune', 'objects'],
394
+ ['🪄', 'magic wand', 'objects'],
395
+ ['🎯', 'target bullseye dart', 'objects'],
396
+ ['🎲', 'dice game board', 'objects'],
397
+ ['🎮', 'video game controller', 'objects'],
398
+ ['🎭', 'theater masks drama', 'objects'],
399
+ ['🎨', 'art palette paint', 'objects'],
400
+ ['🎬', 'clapper film movie', 'objects'],
401
+ ['🎤', 'microphone sing karaoke', 'objects'],
402
+ ['🎧', 'headphones music listen', 'objects'],
403
+ ['🎵', 'music note', 'objects'],
404
+ ['🎶', 'music notes', 'objects'],
405
+ ['🎸', 'guitar electric', 'objects'],
406
+ ['🎹', 'piano keyboard music', 'objects'],
407
+ ['🥁', 'drum percussion', 'objects'],
408
+ ['🎷', 'saxophone jazz', 'objects'],
409
+ ['🎺', 'trumpet', 'objects'],
410
+ ['🎻', 'violin', 'objects'],
411
+ ['⚽', 'soccer ball football', 'objects'],
412
+ ['🏀', 'basketball', 'objects'],
413
+ ['🏈', 'american football', 'objects'],
414
+ ['⚾', 'baseball', 'objects'],
415
+ ['🎾', 'tennis', 'objects'],
416
+ ['🏐', 'volleyball', 'objects'],
417
+ ['🏆', 'trophy winner award', 'objects'],
418
+ ['🥇', 'gold medal first', 'objects'],
419
+ ['🏅', 'sports medal', 'objects'],
420
+
421
+ // Symbols
422
+ ['✅', 'check green done success', 'symbols'],
423
+ ['❌', 'cross x no cancel', 'symbols'],
424
+ ['⭕', 'circle red', 'symbols'],
425
+ ['⛔', 'no entry stop', 'symbols'],
426
+ ['🚫', 'prohibited no banned', 'symbols'],
427
+ ['⚠️', 'warning caution danger', 'symbols'],
428
+ ['❗', 'exclamation red important', 'symbols'],
429
+ ['❓', 'question mark', 'symbols'],
430
+ ['‼️', 'double exclamation', 'symbols'],
431
+ ['💯', '100 hundred percent perfect', 'symbols'],
432
+ ['🔴', 'red circle dot', 'symbols'],
433
+ ['🟠', 'orange circle', 'symbols'],
434
+ ['🟡', 'yellow circle', 'symbols'],
435
+ ['🟢', 'green circle', 'symbols'],
436
+ ['🔵', 'blue circle', 'symbols'],
437
+ ['🟣', 'purple circle', 'symbols'],
438
+ ['⚫', 'black circle', 'symbols'],
439
+ ['⚪', 'white circle', 'symbols'],
440
+ ['🟤', 'brown circle', 'symbols'],
441
+ ['🔺', 'red triangle up', 'symbols'],
442
+ ['🔻', 'red triangle down', 'symbols'],
443
+ ['🔷', 'blue diamond large', 'symbols'],
444
+ ['🔶', 'orange diamond large', 'symbols'],
445
+ ['🔹', 'blue diamond small', 'symbols'],
446
+ ['🔸', 'orange diamond small', 'symbols'],
447
+ ['⭐', 'star yellow', 'symbols'],
448
+ ['🌟', 'glowing star shine', 'symbols'],
449
+ ['✨', 'sparkles shine', 'symbols'],
450
+ ['💫', 'dizzy star spin', 'symbols'],
451
+ ['⚡', 'lightning bolt energy power', 'symbols'],
452
+ ['🔥', 'fire hot flame', 'symbols'],
453
+ ['💥', 'explosion boom', 'symbols'],
454
+ ['❄️', 'snowflake cold ice winter', 'symbols'],
455
+ ['🌊', 'wave water ocean sea', 'symbols'],
456
+ ['💨', 'wind blow dash', 'symbols'],
457
+ ['🌀', 'cyclone tornado spiral', 'symbols'],
458
+ ['♻️', 'recycle loop green', 'symbols'],
459
+ ['✔️', 'check tick done', 'symbols'],
460
+ ['➕', 'plus add', 'symbols'],
461
+ ['➖', 'minus subtract', 'symbols'],
462
+ ['➗', 'divide division', 'symbols'],
463
+ ['✖️', 'multiply times cross', 'symbols'],
464
+ ['▶️', 'play button right', 'symbols'],
465
+ ['⏸️', 'pause', 'symbols'],
466
+ ['⏹️', 'stop square', 'symbols'],
467
+ ['⏩', 'fast forward', 'symbols'],
468
+ ['⏪', 'rewind fast backward', 'symbols'],
469
+ ['🔔', 'bell notification', 'symbols'],
470
+ ['🔕', 'bell slash mute', 'symbols'],
471
+ ['🔊', 'speaker volume high', 'symbols'],
472
+ ['🔇', 'mute silent no sound', 'symbols'],
473
+ ['📢', 'loudspeaker announcement', 'symbols'],
474
+ ['📣', 'megaphone cheer', 'symbols'],
475
+ ['🏳️', 'white flag', 'symbols'],
476
+ ['🏴', 'black flag', 'symbols'],
477
+ ['🚩', 'red flag', 'symbols'],
478
+ ['🏁', 'checkered flag finish race', 'symbols'],
479
+ ['🆕', 'new badge', 'symbols'],
480
+ ['🆓', 'free badge', 'symbols'],
481
+ ['🆒', 'cool badge', 'symbols'],
482
+ ['🔝', 'top arrow', 'symbols'],
483
+ ['🔙', 'back arrow', 'symbols'],
484
+ ['ℹ️', 'information info', 'symbols'],
485
+ ['📍', 'pin location map', 'symbols'],
486
+ ['🔗', 'link chain', 'symbols'],
487
+ ['©️', 'copyright', 'symbols'],
488
+ ['®️', 'registered trademark', 'symbols'],
489
+ ['™️', 'trademark', 'symbols'],
490
+ ['#️⃣', 'hash number', 'symbols'],
491
+ ['0️⃣', 'zero number', 'symbols'],
492
+ ['1️⃣', 'one number', 'symbols'],
493
+ ['2️⃣', 'two number', 'symbols'],
494
+ ['3️⃣', 'three number', 'symbols'],
495
+ ['4️⃣', 'four number', 'symbols'],
496
+ ['5️⃣', 'five number', 'symbols'],
497
+ ];
498
+
499
+ // ---------------------------------------------------------------------------
500
+ // Dialog class
501
+ // ---------------------------------------------------------------------------
502
+
503
+ export class EmojiDialog {
504
+ /**
505
+ * @param {import('../Context.js').Context} context
506
+ */
507
+ constructor(context) {
508
+ this.context = context;
509
+ /** @type {HTMLElement|null} */
510
+ this._dialog = null;
511
+ this._disposers = [];
512
+ this._savedRange = null;
513
+ this._activeCat = 'all';
514
+ }
515
+
516
+ // ---------------------------------------------------------------------------
517
+ // Lifecycle
518
+ // ---------------------------------------------------------------------------
519
+
520
+ initialize() {
521
+ // Dialog grid is built lazily on first show() to avoid rendering ~500 DOM nodes at load time.
522
+ return this;
523
+ }
524
+
525
+ destroy() {
526
+ this._disposers.forEach((d) => d());
527
+ this._disposers = [];
528
+ if (this._dialog && this._dialog.parentNode) {
529
+ this._dialog.parentNode.removeChild(this._dialog);
530
+ }
531
+ this._dialog = null;
532
+ }
533
+
534
+ // ---------------------------------------------------------------------------
535
+ // Public API
536
+ // ---------------------------------------------------------------------------
537
+
538
+ show() {
539
+ if (!this._dialog) {
540
+ this._dialog = this._buildDialog();
541
+ document.body.appendChild(this._dialog);
542
+ }
543
+ withSavedRange((range) => {
544
+ this._savedRange = range;
545
+ });
546
+ this._activeCat = 'all';
547
+ this._searchInput.value = '';
548
+ this._updateCatTabs();
549
+ this._filterEmojis('', 'all');
550
+ this._open();
551
+ }
552
+
553
+ // ---------------------------------------------------------------------------
554
+ // Build dialog
555
+ // ---------------------------------------------------------------------------
556
+
557
+ _buildDialog() {
558
+ const overlay = createElement('div', {
559
+ class: 'an-dialog-overlay',
560
+ role: 'dialog',
561
+ 'aria-modal': 'true',
562
+ 'aria-label': 'Insert emoji',
563
+ });
564
+ const box = createElement('div', { class: 'an-dialog-box an-emoji-box' });
565
+
566
+ // Title row
567
+ const titleRow = createElement('div', { class: 'an-icon-title-row' });
568
+ const title = createElement('h3', { class: 'an-dialog-title' });
569
+ title.textContent = 'Insert Emoji';
570
+ const closeBtn = createElement('button', { type: 'button', class: 'an-icon-close', 'aria-label': 'Close' });
571
+ closeBtn.innerHTML = '×';
572
+ titleRow.append(title, closeBtn);
573
+
574
+ // Search
575
+ const searchInput = createElement('input', {
576
+ type: 'search',
577
+ class: 'an-input an-icon-search',
578
+ placeholder: 'Search emojis…',
579
+ autocomplete: 'off',
580
+ });
581
+ this._searchInput = searchInput;
582
+
583
+ // Category tabs
584
+ const catBar = createElement('div', { class: 'an-icon-cats' });
585
+ const allTab = createElement('button', { type: 'button', class: 'an-icon-cat active', 'data-cat': 'all' });
586
+ allTab.textContent = 'All';
587
+ catBar.appendChild(allTab);
588
+ EMOJI_CATS.forEach(({ id, label }) => {
589
+ const tab = createElement('button', { type: 'button', class: 'an-icon-cat', 'data-cat': id });
590
+ tab.textContent = label;
591
+ catBar.appendChild(tab);
592
+ });
593
+ this._catBar = catBar;
594
+
595
+ // Emoji grid — one button per emoji, click = immediate insert
596
+ const grid = createElement('div', { class: 'an-emoji-grid' });
597
+ EMOJI_LIST.forEach(([char, keywords, cat]) => {
598
+ const cell = createElement('button', {
599
+ type: 'button',
600
+ class: 'an-emoji-cell',
601
+ 'data-char': char,
602
+ 'data-keywords': keywords,
603
+ 'data-cat': cat,
604
+ title: keywords.split(' ').slice(0, 2).join(' '),
605
+ });
606
+ cell.textContent = char;
607
+ grid.appendChild(cell);
608
+ });
609
+ this._grid = grid;
610
+
611
+ // Cancel only — clicking an emoji inserts immediately
612
+ const btnRow = createElement('div', { class: 'an-dialog-actions' });
613
+ const cancelBtn = createElement('button', { type: 'button', class: 'an-btn' });
614
+ cancelBtn.textContent = 'Cancel';
615
+ btnRow.appendChild(cancelBtn);
616
+
617
+ box.append(titleRow, searchInput, catBar, grid, btnRow);
618
+ overlay.appendChild(box);
619
+
620
+ // Events
621
+ const d1 = on(closeBtn, 'click', () => this._close());
622
+ const d2 = on(cancelBtn, 'click', () => this._close());
623
+ const d3 = on(overlay, 'click', (e) => { if (e.target === overlay) this._close(); });
624
+ const d4 = on(searchInput, 'input', () => this._filterEmojis(searchInput.value, this._activeCat));
625
+ const d5 = on(catBar, 'click', (e) => {
626
+ const tab = e.target.closest('[data-cat]');
627
+ if (tab) {
628
+ this._activeCat = tab.dataset.cat;
629
+ this._updateCatTabs();
630
+ this._filterEmojis(this._searchInput.value, this._activeCat);
631
+ }
632
+ });
633
+ const d6 = on(grid, 'click', (e) => {
634
+ const cell = e.target.closest('.an-emoji-cell');
635
+ if (cell) this._onEmojiClick(cell.dataset.char);
636
+ });
637
+ this._disposers.push(d1, d2, d3, d4, d5, d6);
638
+ return overlay;
639
+ }
640
+
641
+ // ---------------------------------------------------------------------------
642
+ // Filter
643
+ // ---------------------------------------------------------------------------
644
+
645
+ _updateCatTabs() {
646
+ this._catBar.querySelectorAll('.an-icon-cat').forEach((tab) => {
647
+ tab.classList.toggle('active', tab.dataset.cat === this._activeCat);
648
+ });
649
+ }
650
+
651
+ _filterEmojis(query, cat) {
652
+ const q = (query || '').trim().toLowerCase();
653
+ let count = 0;
654
+ this._grid.querySelectorAll('.an-emoji-cell').forEach((cell) => {
655
+ const matchCat = !cat || cat === 'all' || cell.dataset.cat === cat;
656
+ const matchQuery = !q || cell.dataset.keywords.includes(q) || cell.dataset.char === q;
657
+ const visible = matchCat && matchQuery;
658
+ cell.style.display = visible ? '' : 'none';
659
+ if (visible) count++;
660
+ });
661
+ let empty = this._grid.querySelector('.an-icon-empty');
662
+ if (!empty) {
663
+ empty = createElement('div', { class: 'an-icon-empty' });
664
+ empty.textContent = 'No emojis found';
665
+ this._grid.appendChild(empty);
666
+ }
667
+ empty.style.display = count > 0 ? 'none' : '';
668
+ }
669
+
670
+ // ---------------------------------------------------------------------------
671
+ // Insert
672
+ // ---------------------------------------------------------------------------
673
+
674
+ _onEmojiClick(char) {
675
+ const savedRange = this._savedRange;
676
+ const editable = this.context.layoutInfo.editable;
677
+
678
+ // 1. Restore selection while dialog is still mounted (same pattern as ImageDialog)
679
+ if (savedRange) savedRange.select();
680
+
681
+ const sel = window.getSelection();
682
+ let range = sel && sel.rangeCount > 0 ? sel.getRangeAt(0) : null;
683
+ if (!range) {
684
+ range = document.createRange();
685
+ range.selectNodeContents(editable);
686
+ range.collapse(false);
687
+ }
688
+
689
+ // 2. Insert emoji as a plain text node — no ZWS or execCommand needed.
690
+ // Text nodes are natively navigable so the caret lands cleanly after.
691
+ range.deleteContents();
692
+ const textNode = document.createTextNode(char);
693
+ range.insertNode(textNode);
694
+
695
+ // 3. Place caret immediately after the emoji character
696
+ range.setStartAfter(textNode);
697
+ range.collapse(true);
698
+ if (sel) {
699
+ sel.removeAllRanges();
700
+ sel.addRange(range);
701
+ }
702
+
703
+ // 4. Close and restore editor focus
704
+ this._close();
705
+ editable.focus();
706
+ this.context.invoke('editor.afterCommand');
707
+ }
708
+
709
+ // ---------------------------------------------------------------------------
710
+ // Open / Close
711
+ // ---------------------------------------------------------------------------
712
+
713
+ _open() {
714
+ if (this._dialog) {
715
+ this._dialog.style.display = 'flex';
716
+ this._removeTrap = trapFocus(this._dialog, () => this._close());
717
+ setTimeout(() => this._searchInput && this._searchInput.focus(), 50);
718
+ }
719
+ }
720
+
721
+ _close() {
722
+ if (this._dialog) this._dialog.style.display = 'none';
723
+ if (this._removeTrap) { this._removeTrap(); this._removeTrap = null; }
724
+ this._savedRange = null;
725
+ }
726
+ }