@ckeditor/ckeditor5-emoji 0.0.0-nightly-next-20250217.0 → 0.0.1

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 (43) hide show
  1. package/LICENSE.md +5 -15
  2. package/README.md +3 -30
  3. package/package.json +5 -59
  4. package/CHANGELOG.md +0 -4
  5. package/build/emoji.js +0 -4
  6. package/ckeditor5-metadata.json +0 -32
  7. package/dist/index-content.css +0 -4
  8. package/dist/index-editor.css +0 -111
  9. package/dist/index.css +0 -143
  10. package/dist/index.css.map +0 -1
  11. package/dist/index.js +0 -1478
  12. package/dist/index.js.map +0 -1
  13. package/lang/contexts.json +0 -24
  14. package/src/augmentation.d.ts +0 -24
  15. package/src/augmentation.js +0 -5
  16. package/src/emoji.d.ts +0 -32
  17. package/src/emoji.js +0 -38
  18. package/src/emojicommand.d.ts +0 -24
  19. package/src/emojicommand.js +0 -33
  20. package/src/emojiconfig.d.ts +0 -80
  21. package/src/emojiconfig.js +0 -5
  22. package/src/emojimention.d.ts +0 -68
  23. package/src/emojimention.js +0 -203
  24. package/src/emojipicker.d.ts +0 -97
  25. package/src/emojipicker.js +0 -256
  26. package/src/emojirepository.d.ts +0 -139
  27. package/src/emojirepository.js +0 -280
  28. package/src/index.d.ts +0 -14
  29. package/src/index.js +0 -13
  30. package/src/ui/emojicategoriesview.d.ts +0 -68
  31. package/src/ui/emojicategoriesview.js +0 -147
  32. package/src/ui/emojigridview.d.ts +0 -140
  33. package/src/ui/emojigridview.js +0 -209
  34. package/src/ui/emojipickerview.d.ts +0 -91
  35. package/src/ui/emojipickerview.js +0 -208
  36. package/src/ui/emojisearchview.d.ts +0 -51
  37. package/src/ui/emojisearchview.js +0 -97
  38. package/src/ui/emojitoneview.d.ts +0 -46
  39. package/src/ui/emojitoneview.js +0 -97
  40. package/theme/emojicategories.css +0 -29
  41. package/theme/emojigrid.css +0 -55
  42. package/theme/emojipicker.css +0 -32
  43. package/theme/emojitone.css +0 -21
@@ -1,208 +0,0 @@
1
- /**
2
- * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
3
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
- */
5
- /**
6
- * @module emoji/ui/emojipickerview
7
- */
8
- import { FocusCycler, SearchInfoView, View } from 'ckeditor5/src/ui.js';
9
- import { FocusTracker, KeystrokeHandler } from 'ckeditor5/src/utils.js';
10
- import EmojiGridView from './emojigridview.js';
11
- import EmojiCategoriesView from './emojicategoriesview.js';
12
- import EmojiSearchView from './emojisearchview.js';
13
- import EmojiToneView from './emojitoneview.js';
14
- /**
15
- * A view that glues pieces of the emoji panel together.
16
- */
17
- export default class EmojiPickerView extends View {
18
- /**
19
- * A collection of the focusable children of the view.
20
- */
21
- items;
22
- /**
23
- * Tracks information about the DOM focus in the view.
24
- */
25
- focusTracker;
26
- /**
27
- * An instance of the {@link module:utils/keystrokehandler~KeystrokeHandler}.
28
- */
29
- keystrokes;
30
- /**
31
- * Helps cycling over focusable {@link #items} in the view.
32
- */
33
- focusCycler;
34
- /**
35
- * An instance of the `EmojiSearchView`.
36
- */
37
- searchView;
38
- /**
39
- * An instance of the `EmojiToneView`.
40
- */
41
- toneView;
42
- /**
43
- * An instance of the `EmojiCategoriesView`.
44
- */
45
- categoriesView;
46
- /**
47
- * An instance of the `EmojiGridView`.
48
- */
49
- gridView;
50
- /**
51
- * An instance of the `EmojiGridView`.
52
- */
53
- infoView;
54
- /**
55
- * @inheritDoc
56
- */
57
- constructor(locale, { emojiCategories, getEmojiByQuery, skinTone, skinTones }) {
58
- super(locale);
59
- const categoryName = emojiCategories[0].title;
60
- this.gridView = new EmojiGridView(locale, {
61
- categoryName,
62
- emojiCategories,
63
- getEmojiByQuery,
64
- skinTone
65
- });
66
- this.infoView = new SearchInfoView();
67
- this.searchView = new EmojiSearchView(locale, {
68
- gridView: this.gridView,
69
- resultsView: this.infoView
70
- });
71
- this.categoriesView = new EmojiCategoriesView(locale, {
72
- emojiCategories,
73
- categoryName
74
- });
75
- this.toneView = new EmojiToneView(locale, {
76
- skinTone,
77
- skinTones
78
- });
79
- this.items = this.createCollection([
80
- this.searchView,
81
- this.toneView,
82
- this.categoriesView,
83
- this.gridView,
84
- this.infoView
85
- ]);
86
- this.focusTracker = new FocusTracker();
87
- this.keystrokes = new KeystrokeHandler();
88
- this.focusCycler = new FocusCycler({
89
- focusables: this.items,
90
- focusTracker: this.focusTracker,
91
- keystrokeHandler: this.keystrokes,
92
- actions: {
93
- focusPrevious: 'shift + tab',
94
- focusNext: 'tab'
95
- }
96
- });
97
- this.setTemplate({
98
- tag: 'div',
99
- children: [
100
- {
101
- tag: 'div',
102
- children: [
103
- this.searchView,
104
- this.toneView
105
- ],
106
- attributes: {
107
- class: ['ck', 'ck-emoji__search']
108
- }
109
- },
110
- this.categoriesView,
111
- this.gridView,
112
- {
113
- tag: 'div',
114
- children: [
115
- this.infoView
116
- ],
117
- attributes: {
118
- class: ['ck', 'ck-search__results']
119
- }
120
- }
121
- ],
122
- attributes: {
123
- tabindex: '-1',
124
- class: ['ck', 'ck-emoji', 'ck-search']
125
- }
126
- });
127
- this._setupEventListeners();
128
- }
129
- /**
130
- * @inheritDoc
131
- */
132
- render() {
133
- super.render();
134
- this.focusTracker.add(this.searchView.element);
135
- this.focusTracker.add(this.toneView.element);
136
- this.focusTracker.add(this.categoriesView.element);
137
- this.focusTracker.add(this.gridView.element);
138
- this.focusTracker.add(this.infoView.element);
139
- // Start listening for the keystrokes coming from #element.
140
- this.keystrokes.listenTo(this.element);
141
- }
142
- /**
143
- * @inheritDoc
144
- */
145
- destroy() {
146
- super.destroy();
147
- this.focusTracker.destroy();
148
- this.keystrokes.destroy();
149
- }
150
- /**
151
- * Focuses the search input.
152
- */
153
- focus() {
154
- this.searchView.focus();
155
- }
156
- /**
157
- * Initializes interactions between sub-views.
158
- */
159
- _setupEventListeners() {
160
- const t = this.locale.t;
161
- // Disable the category switcher when filtering by a query.
162
- this.searchView.on('search', (evt, data) => {
163
- if (data.query) {
164
- this.categoriesView.disableCategories();
165
- }
166
- else {
167
- this.categoriesView.enableCategories();
168
- }
169
- });
170
- // Show a user-friendly message depending on the search query.
171
- this.searchView.on('search', (evt, data) => {
172
- if (data.query.length === 1) {
173
- this.infoView.set({
174
- primaryText: t('Keep on typing to see the emoji.'),
175
- secondaryText: t('The query must contain at least two characters.'),
176
- isVisible: true
177
- });
178
- }
179
- else if (!data.resultsCount) {
180
- this.infoView.set({
181
- primaryText: t('No emojis were found matching "%0".', data.query),
182
- secondaryText: t('Please try a different phrase or check the spelling.'),
183
- isVisible: true
184
- });
185
- }
186
- else {
187
- this.infoView.set({
188
- isVisible: false
189
- });
190
- }
191
- });
192
- // Emit an update event to react to balloon dimensions changes.
193
- this.searchView.on('search', () => {
194
- this.fire('update');
195
- });
196
- // Update the grid of emojis when the selected category is changed.
197
- this.categoriesView.on('change:categoryName', (ev, args, categoryName) => {
198
- this.gridView.categoryName = categoryName;
199
- this.searchView.search('');
200
- });
201
- // Update the grid of emojis when the selected skin tone is changed.
202
- // In such a case, the displayed emoji should use an updated skin tone value.
203
- this.toneView.on('change:skinTone', (evt, propertyName, newValue) => {
204
- this.gridView.skinTone = newValue;
205
- this.searchView.search(this.searchView.getInputValue());
206
- });
207
- }
208
- }
@@ -1,51 +0,0 @@
1
- /**
2
- * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
3
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
- */
5
- import { SearchTextView, View, type SearchInfoView } from 'ckeditor5/src/ui.js';
6
- import type { Locale } from 'ckeditor5/src/utils.js';
7
- import type EmojiGridView from './emojigridview.js';
8
- /**
9
- * A view responsible for providing an input element that allows filtering emoji by the provided query.
10
- */
11
- export default class EmojiSearchView extends View {
12
- /**
13
- * The find in text input view that stores the searched string.
14
- */
15
- readonly inputView: SearchTextView;
16
- /**
17
- * An instance of the `EmojiGridView`.
18
- */
19
- readonly gridView: EmojiGridView;
20
- /**
21
- * @inheritDoc
22
- */
23
- constructor(locale: Locale, { gridView, resultsView }: {
24
- gridView: EmojiGridView;
25
- resultsView: SearchInfoView;
26
- });
27
- /**
28
- * @inheritDoc
29
- */
30
- destroy(): void;
31
- /**
32
- * Searches the {@link #gridView} for the given query.
33
- *
34
- * @param query The search query string.
35
- */
36
- search(query: string): void;
37
- /**
38
- * Allows defining the default value in the search text field.
39
- *
40
- * @param value The new value.
41
- */
42
- setInputValue(value: string): void;
43
- /**
44
- * Returns an input provided by a user in the search text field.
45
- */
46
- getInputValue(): string;
47
- /**
48
- * @inheritDoc
49
- */
50
- focus(): void;
51
- }
@@ -1,97 +0,0 @@
1
- /**
2
- * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
3
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
- */
5
- /**
6
- * @module emoji/ui/emojisearchview
7
- */
8
- import { escapeRegExp } from 'es-toolkit/compat';
9
- import { createLabeledInputText, SearchTextView, View } from 'ckeditor5/src/ui.js';
10
- /**
11
- * A view responsible for providing an input element that allows filtering emoji by the provided query.
12
- */
13
- export default class EmojiSearchView extends View {
14
- /**
15
- * The find in text input view that stores the searched string.
16
- */
17
- inputView;
18
- /**
19
- * An instance of the `EmojiGridView`.
20
- */
21
- gridView;
22
- /**
23
- * @inheritDoc
24
- */
25
- constructor(locale, { gridView, resultsView }) {
26
- super(locale);
27
- this.gridView = gridView;
28
- const t = locale.t;
29
- this.inputView = new SearchTextView(this.locale, {
30
- queryView: {
31
- label: t('Find an emoji (min. 2 characters)'),
32
- creator: createLabeledInputText
33
- },
34
- filteredView: this.gridView,
35
- infoView: {
36
- instance: resultsView
37
- }
38
- });
39
- this.setTemplate({
40
- tag: 'div',
41
- attributes: {
42
- class: [
43
- 'ck',
44
- 'ck-search'
45
- ],
46
- tabindex: '-1'
47
- },
48
- children: [
49
- this.inputView.queryView
50
- ]
51
- });
52
- // Pass through the `search` event to handle it by a parent view.
53
- this.inputView.delegate('search').to(this);
54
- }
55
- /**
56
- * @inheritDoc
57
- */
58
- destroy() {
59
- super.destroy();
60
- this.inputView.destroy();
61
- }
62
- /**
63
- * Searches the {@link #gridView} for the given query.
64
- *
65
- * @param query The search query string.
66
- */
67
- search(query) {
68
- const regExp = query ? new RegExp(escapeRegExp(query), 'ig') : null;
69
- const filteringResults = this.gridView.filter(regExp);
70
- this.inputView.fire('search', { query, ...filteringResults });
71
- }
72
- /**
73
- * Allows defining the default value in the search text field.
74
- *
75
- * @param value The new value.
76
- */
77
- setInputValue(value) {
78
- if (!value) {
79
- this.inputView.queryView.fieldView.reset();
80
- }
81
- else {
82
- this.inputView.queryView.fieldView.value = value;
83
- }
84
- }
85
- /**
86
- * Returns an input provided by a user in the search text field.
87
- */
88
- getInputValue() {
89
- return this.inputView.queryView.fieldView.element.value;
90
- }
91
- /**
92
- * @inheritDoc
93
- */
94
- focus() {
95
- this.inputView.focus();
96
- }
97
- }
@@ -1,46 +0,0 @@
1
- /**
2
- * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
3
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
- */
5
- /**
6
- * @module emoji/ui/emojitoneview
7
- */
8
- import { View, type DropdownView } from 'ckeditor5/src/ui.js';
9
- import { type Locale } from 'ckeditor5/src/utils.js';
10
- import type { SkinToneId } from '../emojiconfig.js';
11
- import type { SkinTone } from '../emojirepository.js';
12
- import '../../theme/emojitone.css';
13
- /**
14
- * A view responsible for selecting a skin tone for an emoji.
15
- */
16
- export default class EmojiToneView extends View {
17
- /**
18
- * Active skin tone.
19
- *
20
- * @observable
21
- */
22
- skinTone: SkinToneId;
23
- /**
24
- * A dropdown element for selecting an active skin tone.
25
- */
26
- readonly dropdownView: DropdownView;
27
- /**
28
- * An array of available skin tones.
29
- */
30
- private readonly _skinTones;
31
- /**
32
- * @inheritDoc
33
- */
34
- constructor(locale: Locale, { skinTone, skinTones }: {
35
- skinTone: SkinToneId;
36
- skinTones: Array<SkinTone>;
37
- });
38
- /**
39
- * @inheritDoc
40
- */
41
- focus(): void;
42
- /**
43
- * Helper method for receiving an object describing the active skin tone.
44
- */
45
- private _getSkinTone;
46
- }
@@ -1,97 +0,0 @@
1
- /**
2
- * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
3
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
- */
5
- /**
6
- * @module emoji/ui/emojitoneview
7
- */
8
- import { createDropdown, addListToDropdown, View, ViewModel } from 'ckeditor5/src/ui.js';
9
- import { Collection } from 'ckeditor5/src/utils.js';
10
- import '../../theme/emojitone.css';
11
- /**
12
- * A view responsible for selecting a skin tone for an emoji.
13
- */
14
- export default class EmojiToneView extends View {
15
- /**
16
- * A dropdown element for selecting an active skin tone.
17
- */
18
- dropdownView;
19
- /**
20
- * An array of available skin tones.
21
- */
22
- _skinTones;
23
- /**
24
- * @inheritDoc
25
- */
26
- constructor(locale, { skinTone, skinTones }) {
27
- super(locale);
28
- this.set('skinTone', skinTone);
29
- this._skinTones = skinTones;
30
- const t = locale.t;
31
- const accessibleLabel = t('Select skin tone');
32
- const dropdownView = createDropdown(locale);
33
- const itemDefinitions = new Collection();
34
- for (const { id, icon, tooltip } of this._skinTones) {
35
- const def = {
36
- type: 'button',
37
- model: new ViewModel({
38
- value: id,
39
- label: icon,
40
- ariaLabel: tooltip,
41
- tooltip,
42
- tooltipPosition: 'e',
43
- role: 'menuitemradio',
44
- withText: true,
45
- // To improve accessibility, disconnect a button and its label connection so that screen
46
- // readers can read the `[aria-label]` attribute directly from the more descriptive button.
47
- ariaLabelledBy: undefined
48
- })
49
- };
50
- def.model.bind('isOn').to(this, 'skinTone', value => value === id);
51
- itemDefinitions.add(def);
52
- }
53
- addListToDropdown(dropdownView, itemDefinitions, {
54
- ariaLabel: accessibleLabel,
55
- role: 'menu'
56
- });
57
- dropdownView.buttonView.set({
58
- label: this._getSkinTone().icon,
59
- ariaLabel: accessibleLabel,
60
- ariaLabelledBy: undefined,
61
- isOn: false,
62
- withText: true,
63
- tooltip: accessibleLabel
64
- });
65
- this.dropdownView = dropdownView;
66
- // Execute command when an item from the dropdown is selected.
67
- this.listenTo(dropdownView, 'execute', evt => {
68
- this.skinTone = evt.source.value;
69
- });
70
- dropdownView.buttonView.bind('label').to(this, 'skinTone', () => {
71
- return this._getSkinTone().icon;
72
- });
73
- dropdownView.buttonView.bind('ariaLabel').to(this, 'skinTone', () => {
74
- // Render a current state, but also what the dropdown does.
75
- return `${this._getSkinTone().tooltip}, ${accessibleLabel}`;
76
- });
77
- this.setTemplate({
78
- tag: 'div',
79
- attributes: {
80
- class: ['ck', 'ck-emoji__skin-tone']
81
- },
82
- children: [dropdownView]
83
- });
84
- }
85
- /**
86
- * @inheritDoc
87
- */
88
- focus() {
89
- this.dropdownView.buttonView.focus();
90
- }
91
- /**
92
- * Helper method for receiving an object describing the active skin tone.
93
- */
94
- _getSkinTone() {
95
- return this._skinTones.find(tone => tone.id === this.skinTone);
96
- }
97
- }
@@ -1,29 +0,0 @@
1
- /*
2
- * Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
3
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
- */
5
-
6
- .ck.ck-emoji__categories-list {
7
- display: flex;
8
- justify-content: space-between;
9
- margin: 0 var(--ck-spacing-large);
10
-
11
- > .ck.ck-button.ck-button_with-text {
12
- border-width: 0;
13
- border-bottom-width: 2px;
14
- border-bottom-style: solid;
15
- border-bottom-color: transparent;
16
- padding: 0;
17
- font-size: var(--ck-font-size-big);
18
- min-width: var(--ck-font-size-big);
19
- min-height: var(--ck-font-size-big);
20
-
21
- &.ck-emoji__category-item.ck-on {
22
- border-bottom-color: var(--ck-color-base-active);
23
- }
24
-
25
- > span {
26
- margin: auto;
27
- }
28
- }
29
- }
@@ -1,55 +0,0 @@
1
- /*
2
- * Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
3
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
- */
5
-
6
- :root {
7
- --ck-emoji-grid-tile-size: 27px;
8
- }
9
-
10
- .ck.ck-emoji {
11
- & .ck.ck-emoji__tiles {
12
- max-width: 100%;
13
- max-height: 265px;
14
-
15
- overflow-y: auto;
16
- overflow-x: hidden;
17
- border-top: 1px solid var(--ck-color-base-border);
18
-
19
- & .ck-emoji__grid {
20
- display: grid;
21
- grid-template-columns: repeat(auto-fill, minmax(var(--ck-emoji-grid-tile-size), 1fr));
22
- margin: var(--ck-spacing-standard) var(--ck-spacing-large);
23
- grid-gap: var(--ck-spacing-small);
24
- }
25
-
26
- & .ck-emoji__tile {
27
- width: var(--ck-emoji-grid-tile-size);
28
- height: var(--ck-emoji-grid-tile-size);
29
- min-width: var(--ck-emoji-grid-tile-size);
30
- min-height: var(--ck-emoji-grid-tile-size);
31
- font-size: 1.5em;
32
- padding: 0;
33
- transition: .2s ease box-shadow;
34
- border: 0;
35
-
36
- @media (prefers-reduced-motion: reduce) {
37
- transition: none;
38
- }
39
-
40
- &:focus:not(.ck-disabled),
41
- &:hover:not(.ck-disabled) {
42
- /* Disable the default .ck-button's border ring. */
43
- border: 0;
44
- box-shadow: inset 0 0 0 1px var(--ck-color-base-background), 0 0 0 2px var(--ck-color-focus-border);
45
- }
46
-
47
- /* Make sure the glyph is rendered in the center of the button */
48
- & .ck-button__label {
49
- line-height: var(--ck-emoji-grid-tile-size);
50
- width: 100%;
51
- text-align: center;
52
- }
53
- }
54
- }
55
- }
@@ -1,32 +0,0 @@
1
- /*
2
- * Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
3
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
- */
5
-
6
- .ck.ck-emoji {
7
- width: 320px;
8
- }
9
-
10
- .ck .ck.ck-emoji__search {
11
- display: flex;
12
- padding: var(--ck-spacing-large);
13
- padding-bottom: var(--ck-spacing-medium);
14
- justify-content: space-between;
15
- align-items: center;
16
- }
17
-
18
- /*
19
- * Classes used by the "fake visual selection" displayed in the content when an input
20
- * in the emoji picker UI has focus (the browser does not render the native selection in this state).
21
- */
22
- .ck .ck-fake-emoji-selection {
23
- background: var(--ck-color-link-fake-selection);
24
- }
25
-
26
- /* A collapsed fake visual selection. */
27
- .ck .ck-fake-emoji-selection_collapsed {
28
- height: 100%;
29
- border-right: 1px solid var(--ck-color-base-text);
30
- margin-right: -1px;
31
- outline: solid 1px hsla(0, 0%, 100%, .5);
32
- }
@@ -1,21 +0,0 @@
1
- /*
2
- * Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
3
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
- */
5
-
6
- .ck.ck-emoji__skin-tone {
7
- margin-left: var(--ck-spacing-standard);
8
-
9
- > .ck.ck-dropdown {
10
-
11
- .ck.ck-list__item {
12
- min-width: 1em;
13
- }
14
-
15
- .ck-button.ck-dropdown__button {
16
- .ck-button__label {
17
- width: initial;
18
- }
19
- }
20
- }
21
- }