leaflet-theme-control 0.0.4 → 0.0.5
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
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "leaflet-theme-control",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.5",
|
|
4
4
|
"description": "A Leaflet control for switching between visual themes (light, dark, grayscale, custom, etc.) using CSS filters",
|
|
5
5
|
"main": "src/leaflet-theme-control.js",
|
|
6
6
|
"module": "src/leaflet-theme-control.js",
|
|
@@ -158,11 +158,29 @@ export class ThemeControl extends Control {
|
|
|
158
158
|
const theme = this.options.themes[themeKey]
|
|
159
159
|
const label = this._getThemeLabel(themeKey)
|
|
160
160
|
|
|
161
|
-
button
|
|
162
|
-
|
|
161
|
+
// Get translated button prefix or use default
|
|
162
|
+
let buttonPrefix = 'Theme'
|
|
163
|
+
if (this.options.getEditorLabels) {
|
|
164
|
+
const translated = this.options.getEditorLabels('themeButton')
|
|
165
|
+
if (translated && translated !== 'themeButton') {
|
|
166
|
+
buttonPrefix = translated
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
const fullLabel = `${buttonPrefix}: ${label}`
|
|
171
|
+
button.setAttribute('aria-label', fullLabel)
|
|
172
|
+
button.title = fullLabel
|
|
163
173
|
button.textContent = theme.icon || '🎨'
|
|
164
174
|
}
|
|
165
175
|
|
|
176
|
+
/**
|
|
177
|
+
* Update button label (useful for language changes)
|
|
178
|
+
* Call this method after changing language to update the button's aria-label and title
|
|
179
|
+
*/
|
|
180
|
+
updateButtonLabel() {
|
|
181
|
+
this._updateButton(this.button, this.currentTheme)
|
|
182
|
+
}
|
|
183
|
+
|
|
166
184
|
_getThemeLabel(themeKey) {
|
|
167
185
|
// Use custom label function if provided
|
|
168
186
|
if (this.options.getLabel) {
|