@ctrl/ngx-emoji-mart 8.0.0 → 8.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/category.component.d.ts +6 -3
- package/esm2020/category.component.mjs +57 -57
- package/esm2020/ngx-emoji/emoji.component.mjs +136 -84
- package/esm2020/picker.component.mjs +12 -9
- package/esm2020/preview.component.mjs +1 -1
- package/fesm2015/ctrl-ngx-emoji-mart-ngx-emoji.mjs +134 -81
- package/fesm2015/ctrl-ngx-emoji-mart-ngx-emoji.mjs.map +1 -1
- package/fesm2015/ctrl-ngx-emoji-mart.mjs +67 -66
- package/fesm2015/ctrl-ngx-emoji-mart.mjs.map +1 -1
- package/fesm2020/ctrl-ngx-emoji-mart-ngx-emoji.mjs +134 -81
- package/fesm2020/ctrl-ngx-emoji-mart-ngx-emoji.mjs.map +1 -1
- package/fesm2020/ctrl-ngx-emoji-mart.mjs +67 -64
- package/fesm2020/ctrl-ngx-emoji-mart.mjs.map +1 -1
- package/ngx-emoji/emoji.component.d.ts +25 -9
- package/package.json +1 -1
- package/picker.component.d.ts +1 -1
@@ -1,6 +1,7 @@
|
|
1
1
|
import * as i0 from '@angular/core';
|
2
|
-
import { Injectable, EventEmitter, Component, ChangeDetectionStrategy, Input, Output, NgModule } from '@angular/core';
|
3
|
-
import
|
2
|
+
import { Injectable, EventEmitter, inject, NgZone, Component, ChangeDetectionStrategy, Input, Output, ViewChild, NgModule } from '@angular/core';
|
3
|
+
import { Subject, switchMap, fromEvent, EMPTY, takeUntil } from 'rxjs';
|
4
|
+
import * as i1 from '@angular/common';
|
4
5
|
import { CommonModule } from '@angular/common';
|
5
6
|
|
6
7
|
const categories = [
|
@@ -34033,8 +34034,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImpor
|
|
34033
34034
|
}], ctorParameters: function () { return []; } });
|
34034
34035
|
|
34035
34036
|
class EmojiComponent {
|
34036
|
-
|
34037
|
-
|
34037
|
+
set button(button) {
|
34038
|
+
// Note: `runOutsideAngular` is used to trigger `addEventListener` outside of the Angular zone
|
34039
|
+
// too. See `setupMouseEnterListener`. The `switchMap` will subscribe to `fromEvent` considering
|
34040
|
+
// the context where the factory is called in.
|
34041
|
+
this.ngZone.runOutsideAngular(() => this.button$.next(button?.nativeElement));
|
34042
|
+
}
|
34043
|
+
constructor() {
|
34038
34044
|
this.skin = 1;
|
34039
34045
|
this.set = 'apple';
|
34040
34046
|
this.sheetSize = 64;
|
@@ -34045,15 +34051,33 @@ class EmojiComponent {
|
|
34045
34051
|
this.size = 24;
|
34046
34052
|
this.emoji = '';
|
34047
34053
|
this.hideObsolete = false;
|
34054
|
+
this.emojiClick = new EventEmitter();
|
34055
|
+
/**
|
34056
|
+
* Note: `emojiOver` and `emojiOverOutsideAngular` are dispatched on the same event (`mouseenter`), but
|
34057
|
+
* for different purposes. The `emojiOverOutsideAngular` event is listened only in `emoji-category`
|
34058
|
+
* component and the category component doesn't care about zone context the callback is being called in.
|
34059
|
+
* The `emojiOver` is for backwards compatibility if anyone is listening to this event explicitly in their code.
|
34060
|
+
*/
|
34048
34061
|
this.emojiOver = new EventEmitter();
|
34062
|
+
this.emojiOverOutsideAngular = new EventEmitter();
|
34063
|
+
/** See comments above, this serves the same purpose. */
|
34049
34064
|
this.emojiLeave = new EventEmitter();
|
34050
|
-
this.
|
34065
|
+
this.emojiLeaveOutsideAngular = new EventEmitter();
|
34051
34066
|
this.title = undefined;
|
34052
34067
|
this.label = '';
|
34053
34068
|
this.custom = false;
|
34054
34069
|
this.isVisible = true;
|
34055
34070
|
// TODO: replace 4.0.3 w/ dynamic get verison from emoji-datasource in package.json
|
34056
34071
|
this.backgroundImageFn = DEFAULT_BACKGROUNDFN;
|
34072
|
+
/**
|
34073
|
+
* The subject used to emit whenever view queries are run and `button` or `span` is set/removed.
|
34074
|
+
* We use subject to keep the reactive behavior so we don't have to add and remove event listeners manually.
|
34075
|
+
*/
|
34076
|
+
this.button$ = new Subject();
|
34077
|
+
this.destroy$ = new Subject();
|
34078
|
+
this.ngZone = inject(NgZone);
|
34079
|
+
this.emojiService = inject(EmojiService);
|
34080
|
+
this.setupMouseListeners();
|
34057
34081
|
}
|
34058
34082
|
ngOnChanges() {
|
34059
34083
|
if (!this.emoji) {
|
@@ -34126,6 +34150,9 @@ class EmojiComponent {
|
|
34126
34150
|
}
|
34127
34151
|
return (this.isVisible = true);
|
34128
34152
|
}
|
34153
|
+
ngOnDestroy() {
|
34154
|
+
this.destroy$.next();
|
34155
|
+
}
|
34129
34156
|
getData() {
|
34130
34157
|
return this.emojiService.getData(this.emoji, this.skin, this.set);
|
34131
34158
|
}
|
@@ -34136,96 +34163,115 @@ class EmojiComponent {
|
|
34136
34163
|
const emoji = this.getSanitizedData();
|
34137
34164
|
this.emojiClick.emit({ emoji, $event });
|
34138
34165
|
}
|
34139
|
-
|
34140
|
-
const
|
34141
|
-
|
34142
|
-
|
34143
|
-
|
34144
|
-
|
34145
|
-
|
34166
|
+
setupMouseListeners() {
|
34167
|
+
const eventListener$ = (eventName) => this.button$.pipe(
|
34168
|
+
// Note: `EMPTY` is used to remove event listener once the DOM node is removed.
|
34169
|
+
switchMap(button => (button ? fromEvent(button, eventName) : EMPTY)), takeUntil(this.destroy$));
|
34170
|
+
eventListener$('mouseenter').subscribe($event => {
|
34171
|
+
const emoji = this.getSanitizedData();
|
34172
|
+
this.emojiOverOutsideAngular.emit({ emoji, $event });
|
34173
|
+
// Note: this is done for backwards compatibility. We run change detection if developers
|
34174
|
+
// are listening to `emojiOver` in their code. For instance:
|
34175
|
+
// `<ngx-emoji (emojiOver)="..."></ngx-emoji>`.
|
34176
|
+
if (this.emojiOver.observed) {
|
34177
|
+
this.ngZone.run(() => this.emojiOver.emit({ emoji, $event }));
|
34178
|
+
}
|
34179
|
+
});
|
34180
|
+
eventListener$('mouseleave').subscribe($event => {
|
34181
|
+
const emoji = this.getSanitizedData();
|
34182
|
+
this.emojiLeaveOutsideAngular.emit({ emoji, $event });
|
34183
|
+
// Note: this is done for backwards compatibility. We run change detection if developers
|
34184
|
+
// are listening to `emojiLeave` in their code. For instance:
|
34185
|
+
// `<ngx-emoji (emojiLeave)="..."></ngx-emoji>`.
|
34186
|
+
if (this.emojiLeave.observed) {
|
34187
|
+
this.ngZone.run(() => this.emojiLeave.emit({ emoji, $event }));
|
34188
|
+
}
|
34189
|
+
});
|
34146
34190
|
}
|
34147
34191
|
}
|
34148
|
-
EmojiComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: EmojiComponent, deps: [
|
34149
|
-
EmojiComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.8", type: EmojiComponent, selector: "ngx-emoji", inputs: { skin: "skin", set: "set", sheetSize: "sheetSize", isNative: "isNative", forceSize: "forceSize", tooltip: "tooltip", size: "size", emoji: "emoji", fallback: "fallback", hideObsolete: "hideObsolete", sheetRows: "sheetRows", sheetColumns: "sheetColumns", useButton: "useButton", backgroundImageFn: "backgroundImageFn", imageUrlFn: "imageUrlFn" }, outputs: { emojiOver: "emojiOver", emojiLeave: "emojiLeave",
|
34150
|
-
<
|
34151
|
-
|
34152
|
-
|
34153
|
-
|
34154
|
-
|
34155
|
-
|
34156
|
-
|
34157
|
-
|
34158
|
-
|
34159
|
-
|
34160
|
-
|
34161
|
-
|
34162
|
-
|
34163
|
-
|
34164
|
-
|
34165
|
-
|
34166
|
-
|
34192
|
+
EmojiComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: EmojiComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
34193
|
+
EmojiComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.8", type: EmojiComponent, selector: "ngx-emoji", inputs: { skin: "skin", set: "set", sheetSize: "sheetSize", isNative: "isNative", forceSize: "forceSize", tooltip: "tooltip", size: "size", emoji: "emoji", fallback: "fallback", hideObsolete: "hideObsolete", sheetRows: "sheetRows", sheetColumns: "sheetColumns", useButton: "useButton", backgroundImageFn: "backgroundImageFn", imageUrlFn: "imageUrlFn" }, outputs: { emojiClick: "emojiClick", emojiOver: "emojiOver", emojiOverOutsideAngular: "emojiOverOutsideAngular", emojiLeave: "emojiLeave", emojiLeaveOutsideAngular: "emojiLeaveOutsideAngular" }, viewQueries: [{ propertyName: "button", first: true, predicate: ["button"], descendants: true }], usesOnChanges: true, ngImport: i0, template: `
|
34194
|
+
<ng-template [ngIf]="isVisible">
|
34195
|
+
<button
|
34196
|
+
*ngIf="useButton; else spanTpl"
|
34197
|
+
#button
|
34198
|
+
type="button"
|
34199
|
+
(click)="handleClick($event)"
|
34200
|
+
[attr.title]="title"
|
34201
|
+
[attr.aria-label]="label"
|
34202
|
+
class="emoji-mart-emoji"
|
34203
|
+
[class.emoji-mart-emoji-native]="isNative"
|
34204
|
+
[class.emoji-mart-emoji-custom]="custom"
|
34205
|
+
>
|
34206
|
+
<span [ngStyle]="style">
|
34207
|
+
<ng-template [ngIf]="isNative">{{ unified }}</ng-template>
|
34208
|
+
<ng-content></ng-content>
|
34209
|
+
</span>
|
34210
|
+
</button>
|
34211
|
+
</ng-template>
|
34167
34212
|
|
34168
|
-
<
|
34169
|
-
|
34170
|
-
|
34171
|
-
|
34172
|
-
|
34173
|
-
|
34174
|
-
|
34175
|
-
|
34176
|
-
|
34177
|
-
|
34178
|
-
|
34179
|
-
|
34180
|
-
|
34181
|
-
|
34213
|
+
<ng-template #spanTpl>
|
34214
|
+
<span
|
34215
|
+
#button
|
34216
|
+
(click)="handleClick($event)"
|
34217
|
+
[attr.title]="title"
|
34218
|
+
[attr.aria-label]="label"
|
34219
|
+
class="emoji-mart-emoji"
|
34220
|
+
[class.emoji-mart-emoji-native]="isNative"
|
34221
|
+
[class.emoji-mart-emoji-custom]="custom"
|
34222
|
+
>
|
34223
|
+
<span [ngStyle]="style">
|
34224
|
+
<ng-template [ngIf]="isNative">{{ unified }}</ng-template>
|
34225
|
+
<ng-content></ng-content>
|
34226
|
+
</span>
|
34182
34227
|
</span>
|
34183
|
-
</
|
34184
|
-
`, isInline: true, dependencies: [{ kind: "directive", type:
|
34228
|
+
</ng-template>
|
34229
|
+
`, isInline: true, dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
34185
34230
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: EmojiComponent, decorators: [{
|
34186
34231
|
type: Component,
|
34187
34232
|
args: [{
|
34188
34233
|
selector: 'ngx-emoji',
|
34189
34234
|
template: `
|
34190
|
-
<
|
34191
|
-
|
34192
|
-
|
34193
|
-
|
34194
|
-
|
34195
|
-
|
34196
|
-
|
34197
|
-
|
34198
|
-
|
34199
|
-
|
34200
|
-
|
34201
|
-
|
34202
|
-
|
34203
|
-
|
34204
|
-
|
34205
|
-
|
34206
|
-
|
34235
|
+
<ng-template [ngIf]="isVisible">
|
34236
|
+
<button
|
34237
|
+
*ngIf="useButton; else spanTpl"
|
34238
|
+
#button
|
34239
|
+
type="button"
|
34240
|
+
(click)="handleClick($event)"
|
34241
|
+
[attr.title]="title"
|
34242
|
+
[attr.aria-label]="label"
|
34243
|
+
class="emoji-mart-emoji"
|
34244
|
+
[class.emoji-mart-emoji-native]="isNative"
|
34245
|
+
[class.emoji-mart-emoji-custom]="custom"
|
34246
|
+
>
|
34247
|
+
<span [ngStyle]="style">
|
34248
|
+
<ng-template [ngIf]="isNative">{{ unified }}</ng-template>
|
34249
|
+
<ng-content></ng-content>
|
34250
|
+
</span>
|
34251
|
+
</button>
|
34252
|
+
</ng-template>
|
34207
34253
|
|
34208
|
-
<
|
34209
|
-
|
34210
|
-
|
34211
|
-
|
34212
|
-
|
34213
|
-
|
34214
|
-
|
34215
|
-
|
34216
|
-
|
34217
|
-
|
34218
|
-
|
34219
|
-
|
34220
|
-
|
34221
|
-
|
34254
|
+
<ng-template #spanTpl>
|
34255
|
+
<span
|
34256
|
+
#button
|
34257
|
+
(click)="handleClick($event)"
|
34258
|
+
[attr.title]="title"
|
34259
|
+
[attr.aria-label]="label"
|
34260
|
+
class="emoji-mart-emoji"
|
34261
|
+
[class.emoji-mart-emoji-native]="isNative"
|
34262
|
+
[class.emoji-mart-emoji-custom]="custom"
|
34263
|
+
>
|
34264
|
+
<span [ngStyle]="style">
|
34265
|
+
<ng-template [ngIf]="isNative">{{ unified }}</ng-template>
|
34266
|
+
<ng-content></ng-content>
|
34267
|
+
</span>
|
34222
34268
|
</span>
|
34223
|
-
</
|
34269
|
+
</ng-template>
|
34224
34270
|
`,
|
34225
34271
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
34226
34272
|
preserveWhitespaces: false,
|
34227
34273
|
}]
|
34228
|
-
}], ctorParameters: function () { return [
|
34274
|
+
}], ctorParameters: function () { return []; }, propDecorators: { skin: [{
|
34229
34275
|
type: Input
|
34230
34276
|
}], set: [{
|
34231
34277
|
type: Input
|
@@ -34251,16 +34297,23 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImpor
|
|
34251
34297
|
type: Input
|
34252
34298
|
}], useButton: [{
|
34253
34299
|
type: Input
|
34300
|
+
}], emojiClick: [{
|
34301
|
+
type: Output
|
34254
34302
|
}], emojiOver: [{
|
34255
34303
|
type: Output
|
34304
|
+
}], emojiOverOutsideAngular: [{
|
34305
|
+
type: Output
|
34256
34306
|
}], emojiLeave: [{
|
34257
34307
|
type: Output
|
34258
|
-
}],
|
34308
|
+
}], emojiLeaveOutsideAngular: [{
|
34259
34309
|
type: Output
|
34260
34310
|
}], backgroundImageFn: [{
|
34261
34311
|
type: Input
|
34262
34312
|
}], imageUrlFn: [{
|
34263
34313
|
type: Input
|
34314
|
+
}], button: [{
|
34315
|
+
type: ViewChild,
|
34316
|
+
args: ['button', { static: false }]
|
34264
34317
|
}] } });
|
34265
34318
|
|
34266
34319
|
class EmojiModule {
|