@lovalingo/lovalingo 0.5.13 → 0.5.15
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.
|
@@ -108,7 +108,6 @@ export const LanguageSwitcher = ({ locales, currentLocale, onLocaleChange, posit
|
|
|
108
108
|
height: '50px',
|
|
109
109
|
borderRadius: isRight ? '12px 0 0 12px' : '0 12px 12px 0',
|
|
110
110
|
background: tokens.surfaceBg,
|
|
111
|
-
backdropFilter: 'blur(12px)',
|
|
112
111
|
boxShadow: isRight ? tokens.tabShadowRight : tokens.tabShadowLeft,
|
|
113
112
|
cursor: 'pointer',
|
|
114
113
|
fontSize: '20px',
|
|
@@ -128,7 +127,6 @@ export const LanguageSwitcher = ({ locales, currentLocale, onLocaleChange, posit
|
|
|
128
127
|
opacity: isOpen ? 1 : 0,
|
|
129
128
|
pointerEvents: isOpen ? 'auto' : 'none',
|
|
130
129
|
background: tokens.surfaceBg,
|
|
131
|
-
backdropFilter: 'blur(12px)',
|
|
132
130
|
borderRadius: '16px',
|
|
133
131
|
padding: '10px 12px',
|
|
134
132
|
display: 'flex',
|
|
@@ -8,9 +8,6 @@ export const NavigationOverlay = ({ isVisible }) => {
|
|
|
8
8
|
left: 0,
|
|
9
9
|
right: 0,
|
|
10
10
|
bottom: 0,
|
|
11
|
-
backdropFilter: 'blur(3px)',
|
|
12
|
-
WebkitBackdropFilter: 'blur(3px)',
|
|
13
|
-
// Keep a tiny alpha background to ensure the element paints (some browsers won't apply backdrop-filter otherwise).
|
|
14
11
|
backgroundColor: 'rgba(255, 255, 255, 0.01)',
|
|
15
12
|
zIndex: 9999,
|
|
16
13
|
animation: 'fadeIn 0.1s ease-in-out',
|
|
@@ -21,8 +21,6 @@ let customExcludeSelector = null;
|
|
|
21
21
|
let activeTranslationMap = null;
|
|
22
22
|
const originalTextByNode = new WeakMap();
|
|
23
23
|
const originalAttrByEl = new WeakMap();
|
|
24
|
-
const lastAppliedTextByNode = new WeakMap();
|
|
25
|
-
const lastAppliedAttrByEl = new WeakMap();
|
|
26
24
|
function buildEmptyStats() {
|
|
27
25
|
return {
|
|
28
26
|
totalTextNodes: 0,
|
|
@@ -152,30 +150,16 @@ function buildSelector(el) {
|
|
|
152
150
|
}
|
|
153
151
|
return null;
|
|
154
152
|
}
|
|
155
|
-
function
|
|
153
|
+
function getOrInitTextOriginal(node, parent) {
|
|
154
|
+
const existing = originalTextByNode.get(node);
|
|
155
|
+
if (existing)
|
|
156
|
+
return existing;
|
|
156
157
|
const raw = node.nodeValue || "";
|
|
157
158
|
const leading = raw.match(/^\s*/)?.[0] ?? "";
|
|
158
159
|
const trailing = raw.match(/\s*$/)?.[0] ?? "";
|
|
159
160
|
const trimmed = raw.trim();
|
|
160
161
|
const id = buildStableId(parent, trimmed, getTextNodeIndex(node));
|
|
161
|
-
|
|
162
|
-
}
|
|
163
|
-
function getOrInitTextOriginal(node, parent) {
|
|
164
|
-
const existing = originalTextByNode.get(node);
|
|
165
|
-
if (existing) {
|
|
166
|
-
const raw = node.nodeValue || "";
|
|
167
|
-
if (raw !== existing.raw) {
|
|
168
|
-
const lastApplied = lastAppliedTextByNode.get(node);
|
|
169
|
-
// Why: refresh originals when app code mutates text nodes, but keep them stable if we're showing our translation.
|
|
170
|
-
if (lastApplied !== raw) {
|
|
171
|
-
const updated = buildTextOriginal(node, parent);
|
|
172
|
-
originalTextByNode.set(node, updated);
|
|
173
|
-
return updated;
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
return existing;
|
|
177
|
-
}
|
|
178
|
-
const created = buildTextOriginal(node, parent);
|
|
162
|
+
const created = { raw, trimmed, leading, trailing, id };
|
|
179
163
|
originalTextByNode.set(node, created);
|
|
180
164
|
return created;
|
|
181
165
|
}
|
|
@@ -185,19 +169,10 @@ function getOrInitAttrOriginal(el, attr) {
|
|
|
185
169
|
map = new Map();
|
|
186
170
|
originalAttrByEl.set(el, map);
|
|
187
171
|
}
|
|
188
|
-
const value = (el.getAttribute(attr) || "").toString();
|
|
189
172
|
const existing = map.get(attr);
|
|
190
|
-
if (existing != null)
|
|
191
|
-
if (value !== existing) {
|
|
192
|
-
const lastApplied = lastAppliedAttrByEl.get(el)?.get(attr);
|
|
193
|
-
// Why: allow dynamic attribute updates without losing track of values we've translated.
|
|
194
|
-
if (lastApplied !== value) {
|
|
195
|
-
map.set(attr, value);
|
|
196
|
-
return value;
|
|
197
|
-
}
|
|
198
|
-
}
|
|
173
|
+
if (existing != null)
|
|
199
174
|
return existing;
|
|
200
|
-
|
|
175
|
+
const value = (el.getAttribute(attr) || "").toString();
|
|
201
176
|
map.set(attr, value);
|
|
202
177
|
return value;
|
|
203
178
|
}
|
|
@@ -660,7 +635,6 @@ export function applyActiveTranslations(root = document.body) {
|
|
|
660
635
|
continue;
|
|
661
636
|
try {
|
|
662
637
|
textNode.nodeValue = next;
|
|
663
|
-
lastAppliedTextByNode.set(textNode, next);
|
|
664
638
|
applied += 1;
|
|
665
639
|
}
|
|
666
640
|
catch {
|
|
@@ -689,12 +663,6 @@ export function applyActiveTranslations(root = document.body) {
|
|
|
689
663
|
continue;
|
|
690
664
|
try {
|
|
691
665
|
el.setAttribute(attr, translation);
|
|
692
|
-
let appliedAttrs = lastAppliedAttrByEl.get(el);
|
|
693
|
-
if (!appliedAttrs) {
|
|
694
|
-
appliedAttrs = new Map();
|
|
695
|
-
lastAppliedAttrByEl.set(el, appliedAttrs);
|
|
696
|
-
}
|
|
697
|
-
appliedAttrs.set(attr, translation);
|
|
698
666
|
applied += 1;
|
|
699
667
|
}
|
|
700
668
|
catch {
|
package/dist/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const VERSION = "0.5.
|
|
1
|
+
export declare const VERSION = "0.5.13";
|
package/dist/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = "0.5.
|
|
1
|
+
export const VERSION = "0.5.13";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lovalingo/lovalingo",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.15",
|
|
4
4
|
"description": "React translation runtime with i18n routing, deterministic bundles + DOM rules, and zero-flash rendering.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"peerDependencies": {
|
|
35
35
|
"react": "^18.0.0",
|
|
36
36
|
"react-dom": "^18.0.0",
|
|
37
|
-
"react-router-dom": "^6.
|
|
37
|
+
"react-router-dom": "^6.30.3"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"@types/node": "^24.9.1",
|