@geophrase/core 1.3.9 → 1.3.10
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/package.json +1 -1
- package/src/index.js +0 -36
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -78,37 +78,6 @@ class Geophrase {
|
|
|
78
78
|
`;
|
|
79
79
|
}
|
|
80
80
|
|
|
81
|
-
_applyHostThemeColor() {
|
|
82
|
-
const light = '#ffffff';
|
|
83
|
-
const dark = '#121212';
|
|
84
|
-
|
|
85
|
-
const ensure = (id, media, color) => {
|
|
86
|
-
let el = document.getElementById(id);
|
|
87
|
-
if (!el) {
|
|
88
|
-
el = document.createElement('meta');
|
|
89
|
-
el.id = id;
|
|
90
|
-
el.name = 'theme-color';
|
|
91
|
-
if (media) el.media = media;
|
|
92
|
-
document.head.appendChild(el);
|
|
93
|
-
}
|
|
94
|
-
el.content = color;
|
|
95
|
-
};
|
|
96
|
-
|
|
97
|
-
if (this.theme === 'light') {
|
|
98
|
-
ensure(`${this.styleId}-tc`, '', light);
|
|
99
|
-
} else if (this.theme === 'dark') {
|
|
100
|
-
ensure(`${this.styleId}-tc`, '', dark);
|
|
101
|
-
} else {
|
|
102
|
-
ensure(`${this.styleId}-tc-light`, '(prefers-color-scheme: light)', light);
|
|
103
|
-
ensure(`${this.styleId}-tc-dark`, '(prefers-color-scheme: dark)', dark);
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
_removeHostThemeColor() {
|
|
108
|
-
[`${this.styleId}-tc`, `${this.styleId}-tc-light`, `${this.styleId}-tc-dark`]
|
|
109
|
-
.forEach(id => document.getElementById(id)?.remove());
|
|
110
|
-
}
|
|
111
|
-
|
|
112
81
|
_safeCall(fn, payload) {
|
|
113
82
|
if (typeof fn !== 'function') return;
|
|
114
83
|
try {
|
|
@@ -176,8 +145,6 @@ class Geophrase {
|
|
|
176
145
|
}
|
|
177
146
|
document.body.style.overflow = 'hidden';
|
|
178
147
|
|
|
179
|
-
this._applyHostThemeColor();
|
|
180
|
-
|
|
181
148
|
document.getElementById(this.overlayId)?.classList.add('geophrase-active');
|
|
182
149
|
}
|
|
183
150
|
|
|
@@ -187,8 +154,6 @@ class Geophrase {
|
|
|
187
154
|
document.body.style.overflow = this._prevBodyOverflow ?? '';
|
|
188
155
|
this._prevBodyOverflow = null;
|
|
189
156
|
|
|
190
|
-
this._removeHostThemeColor();
|
|
191
|
-
|
|
192
157
|
document.getElementById(this.overlayId)?.classList.remove('geophrase-active');
|
|
193
158
|
|
|
194
159
|
const iframe = document.getElementById(this.iframeId);
|
|
@@ -200,7 +165,6 @@ class Geophrase {
|
|
|
200
165
|
|
|
201
166
|
document.getElementById(this.overlayId)?.remove();
|
|
202
167
|
document.getElementById(this.styleId)?.remove();
|
|
203
|
-
this._removeHostThemeColor();
|
|
204
168
|
|
|
205
169
|
document.body.style.overflow = this._prevBodyOverflow ?? '';
|
|
206
170
|
this._prevBodyOverflow = null;
|