@independo/capacitor-emoji-picker 1.0.2 → 1.1.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/README.md +13 -5
- package/android/src/main/java/app/independo/capacitoremojipicker/EmojiPicker.java +3 -0
- package/android/src/main/java/app/independo/capacitoremojipicker/presenter/DefaultEmojiPickerDialogFactory.java +26 -6
- package/android/src/main/java/app/independo/capacitoremojipicker/presenter/DispatchingEmojiPickerPresenter.java +8 -2
- package/android/src/main/java/app/independo/capacitoremojipicker/presenter/EmojiPickerDialogFactory.java +1 -1
- package/android/src/main/java/app/independo/capacitoremojipicker/presenter/EmojiPickerPresenter.java +7 -1
- package/android/src/main/java/app/independo/capacitoremojipicker/presenter/NativeEmojiPickerPresenter.java +12 -5
- package/android/src/main/java/app/independo/capacitoremojipicker/presenter/WebFallbackEmojiPickerPresenter.java +20 -7
- package/android/src/main/java/app/independo/capacitoremojipicker/service/EmojiPickerService.java +8 -1
- package/dist/docs.json +33 -0
- package/dist/esm/definitions.d.ts +15 -0
- package/dist/esm/definitions.js.map +1 -1
- package/dist/esm/platform/web/WebEmojiPickerPresenter.js +45 -7
- package/dist/esm/platform/web/WebEmojiPickerPresenter.js.map +1 -1
- package/dist/plugin.cjs.js +45 -7
- package/dist/plugin.cjs.js.map +1 -1
- package/dist/plugin.js +45 -7
- package/dist/plugin.js.map +1 -1
- package/ios/Sources/EmojiPicker/Bridge/EmojiPicker.swift +4 -1
- package/ios/Sources/EmojiPicker/Presenter/DefaultEmojiKeyboardPresentationFactory.swift +42 -3
- package/ios/Sources/EmojiPicker/Presenter/EmojiKeyboardPresentationFactory.swift +1 -0
- package/ios/Sources/EmojiPicker/Presenter/EmojiPickerPresenter.swift +2 -0
- package/ios/Sources/EmojiPicker/Presenter/NativeEmojiPickerPresenter.swift +5 -1
- package/ios/Sources/EmojiPicker/Presenter/WebFallbackEmojiPickerPresenter.swift +10 -6
- package/package.json +2 -2
package/dist/plugin.js
CHANGED
|
@@ -76,14 +76,31 @@ var capacitorEmojiPicker = (function (exports, core) {
|
|
|
76
76
|
max(0.5rem, env(safe-area-inset-left, 0px));
|
|
77
77
|
border: none;
|
|
78
78
|
border-radius: 1rem 1rem 0 0;
|
|
79
|
-
background-color: Canvas;
|
|
80
79
|
overflow: hidden;
|
|
81
80
|
transform: translateY(100%);
|
|
82
81
|
transition: transform ${ANIMATION_MS}ms ease-out;
|
|
83
82
|
}
|
|
83
|
+
/*
|
|
84
|
+
* Explicit colors rather than the \`Canvas\`/\`CanvasText\` system-color keywords: those rely
|
|
85
|
+
* on the UA knowing the page's color-scheme, which isn't reliably signaled inside a
|
|
86
|
+
* Capacitor WKWebView, so they were silently staying light-only regardless of the resolved
|
|
87
|
+
* theme. Values match emoji-picker-element's own light/dark defaults so the seam between
|
|
88
|
+
* the sheet chrome and the picker itself stays invisible.
|
|
89
|
+
*/
|
|
90
|
+
dialog.emoji-picker-sheet--light {
|
|
91
|
+
background-color: #fff;
|
|
92
|
+
color: #1f1f1f;
|
|
93
|
+
}
|
|
94
|
+
dialog.emoji-picker-sheet--dark {
|
|
95
|
+
background-color: #222;
|
|
96
|
+
color: #e8e8e8;
|
|
97
|
+
}
|
|
84
98
|
dialog.emoji-picker-sheet::backdrop {
|
|
85
99
|
background: rgba(0, 0, 0, 0.4);
|
|
86
100
|
}
|
|
101
|
+
dialog.emoji-picker-sheet--dark::backdrop {
|
|
102
|
+
background: rgba(0, 0, 0, 0.6);
|
|
103
|
+
}
|
|
87
104
|
dialog.emoji-picker-sheet[data-state='open'] {
|
|
88
105
|
transform: translateY(0);
|
|
89
106
|
}
|
|
@@ -103,6 +120,9 @@ var capacitorEmojiPicker = (function (exports, core) {
|
|
|
103
120
|
padding: 0;
|
|
104
121
|
cursor: pointer;
|
|
105
122
|
}
|
|
123
|
+
dialog.emoji-picker-sheet--dark .emoji-picker-sheet__close {
|
|
124
|
+
background: rgba(255, 255, 255, 0.12);
|
|
125
|
+
}
|
|
106
126
|
@media (prefers-reduced-motion: reduce) {
|
|
107
127
|
dialog.emoji-picker-sheet {
|
|
108
128
|
transition: none;
|
|
@@ -114,6 +134,23 @@ var capacitorEmojiPicker = (function (exports, core) {
|
|
|
114
134
|
function prefersReducedMotion() {
|
|
115
135
|
return typeof window.matchMedia === 'function' && window.matchMedia('(prefers-reduced-motion: reduce)').matches;
|
|
116
136
|
}
|
|
137
|
+
/** Resolves `system` to the OS's current light/dark preference; passes explicit themes through. */
|
|
138
|
+
function resolveTheme(theme) {
|
|
139
|
+
if (theme === 'light' || theme === 'dark') {
|
|
140
|
+
return theme;
|
|
141
|
+
}
|
|
142
|
+
const prefersDark = typeof window.matchMedia === 'function' && window.matchMedia('(prefers-color-scheme: dark)').matches;
|
|
143
|
+
return prefersDark ? 'dark' : 'light';
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Matches the sheet's own `--light`/`--dark` background colors (see `ensureSheetStylesInjected`).
|
|
147
|
+
* Set explicitly, rather than the `Canvas` system-color keyword, for the same WKWebView
|
|
148
|
+
* color-scheme-detection reason documented there.
|
|
149
|
+
*/
|
|
150
|
+
const SHEET_BACKGROUND_COLOR = {
|
|
151
|
+
light: '#fff',
|
|
152
|
+
dark: '#222',
|
|
153
|
+
};
|
|
117
154
|
const CLOSE_BUTTON_SIZE_PX = {
|
|
118
155
|
xSmall: 24,
|
|
119
156
|
small: 32,
|
|
@@ -186,14 +223,15 @@ var capacitorEmojiPicker = (function (exports, core) {
|
|
|
186
223
|
// so hiding it force-enables backdrop-tap-to-dismiss regardless of what was explicitly
|
|
187
224
|
// requested (mirrors the iOS presenter's `effectiveDismissOnBackdropTap`).
|
|
188
225
|
const dismissOnBackdropTap = ((_b = options.dismissOnBackdropTap) !== null && _b !== void 0 ? _b : true) || ((_c = closeButtonOptions.hidden) !== null && _c !== void 0 ? _c : false);
|
|
226
|
+
// Resolved once at open time (rather than left to each side's own live
|
|
227
|
+
// `prefers-color-scheme` tracking) so the picker and the sheet chrome around it always
|
|
228
|
+
// agree, fixing the mismatch from issue #19.
|
|
229
|
+
const resolvedTheme = resolveTheme(options.theme);
|
|
189
230
|
let picker;
|
|
190
231
|
try {
|
|
191
232
|
picker = await this.createPickerElement();
|
|
192
233
|
picker.dataSource = getBundledEmojiDataSourceUrl();
|
|
193
|
-
|
|
194
|
-
// force the picker to light mode too rather than let it auto-follow
|
|
195
|
-
// `prefers-color-scheme` on its own and visually mismatch the chrome.
|
|
196
|
-
picker.classList.add('light');
|
|
234
|
+
picker.classList.add(resolvedTheme);
|
|
197
235
|
}
|
|
198
236
|
catch (_d) {
|
|
199
237
|
throw new Error(ErrorCodes.NOT_IMPLEMENTED);
|
|
@@ -206,10 +244,10 @@ var capacitorEmojiPicker = (function (exports, core) {
|
|
|
206
244
|
// The picker's own card look (border + background) would otherwise float as a visibly
|
|
207
245
|
// smaller box inside the sheet; matching its background to the sheet's and dropping its
|
|
208
246
|
// border makes it read as full width, part of the sheet rather than nested inside it.
|
|
209
|
-
picker.style.setProperty('--background',
|
|
247
|
+
picker.style.setProperty('--background', SHEET_BACKGROUND_COLOR[resolvedTheme]);
|
|
210
248
|
picker.style.setProperty('--border-size', '0');
|
|
211
249
|
const dialog = document.createElement('dialog');
|
|
212
|
-
dialog.className =
|
|
250
|
+
dialog.className = `emoji-picker-sheet emoji-picker-sheet--${resolvedTheme}`;
|
|
213
251
|
dialog.setAttribute('role', 'dialog');
|
|
214
252
|
dialog.setAttribute('aria-modal', 'true');
|
|
215
253
|
dialog.setAttribute('aria-label', 'Emoji picker');
|