maidr 2.29.1 → 2.30.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/dist/maidr.js +47 -18
- package/dist/maidr.min.js +1 -1
- package/dist/maidr_style.css +1 -1
- package/dist/maidr_style.min.css +1 -1
- package/package.json +1 -1
package/dist/maidr.js
CHANGED
|
@@ -928,7 +928,7 @@ class Menu {
|
|
|
928
928
|
|
|
929
929
|
// initial html for the menu
|
|
930
930
|
menuHtml = `
|
|
931
|
-
<div id="menu" class="modal hidden" role="dialog" tabindex="-1">
|
|
931
|
+
<div id="menu" class="maidr-modal hidden" role="dialog" tabindex="-1">
|
|
932
932
|
<div class="modal-dialog" role="document" tabindex="0">
|
|
933
933
|
<div class="modal-content">
|
|
934
934
|
<div class="modal-header">
|
|
@@ -1846,7 +1846,7 @@ class ChatLLM {
|
|
|
1846
1846
|
*/
|
|
1847
1847
|
CreateComponent() {
|
|
1848
1848
|
let html = `
|
|
1849
|
-
<div id="chatLLM" class="modal hidden" role="dialog" tabindex="-1">
|
|
1849
|
+
<div id="chatLLM" class="maidr-modal hidden" role="dialog" tabindex="-1">
|
|
1850
1850
|
<div class="modal-dialog" role="document" tabindex="0">
|
|
1851
1851
|
<div class="modal-content">
|
|
1852
1852
|
<div class="modal-header">
|
|
@@ -2985,7 +2985,7 @@ class Description {
|
|
|
2985
2985
|
CreateComponent() {
|
|
2986
2986
|
// modal containing description summary stuff
|
|
2987
2987
|
let html = `
|
|
2988
|
-
<div id="description" class="modal hidden" role="dialog" tabindex="-1">
|
|
2988
|
+
<div id="description" class="maidr-modal hidden" role="dialog" tabindex="-1">
|
|
2989
2989
|
<div class="modal-dialog" role="document" tabindex="0">
|
|
2990
2990
|
<div class="modal-content">
|
|
2991
2991
|
<div class="modal-header">
|
|
@@ -12145,7 +12145,7 @@ class Goto {
|
|
|
12145
12145
|
|
|
12146
12146
|
// events and init functions
|
|
12147
12147
|
// we do some setup, but most of the work is done when user focuses on an element matching an id from maidr user data
|
|
12148
|
-
|
|
12148
|
+
function init(id) {
|
|
12149
12149
|
// we wrap in DOMContentLoaded to make sure everything has loaded before we run anything
|
|
12150
12150
|
|
|
12151
12151
|
// create global vars
|
|
@@ -12164,30 +12164,56 @@ document.addEventListener('DOMContentLoaded', function (e) {
|
|
|
12164
12164
|
maidrObjects = maidrObjects.concat(window.maidr);
|
|
12165
12165
|
}
|
|
12166
12166
|
}
|
|
12167
|
-
|
|
12168
|
-
|
|
12169
|
-
|
|
12170
|
-
|
|
12171
|
-
|
|
12172
|
-
|
|
12167
|
+
if (id !== undefined) {
|
|
12168
|
+
const elementWithId = document.getElementById(id);
|
|
12169
|
+
if (elementWithId) {
|
|
12170
|
+
let maidrData;
|
|
12171
|
+
try {
|
|
12172
|
+
maidrData = JSON.parse(elementWithId.getAttribute('maidr-data'));
|
|
12173
|
+
} catch (e) {
|
|
12174
|
+
console.error('Failed to parse maidr attribute:', e);
|
|
12175
|
+
return;
|
|
12176
|
+
}
|
|
12173
12177
|
// If id is not provided in the JSON, use the element's id
|
|
12174
12178
|
if (!maidrData.id) {
|
|
12175
|
-
if (
|
|
12176
|
-
maidrData.id =
|
|
12179
|
+
if (elementWithId.id) {
|
|
12180
|
+
maidrData.id = elementWithId.id;
|
|
12177
12181
|
} else {
|
|
12178
12182
|
// Generate a random id if none exists
|
|
12179
|
-
|
|
12180
|
-
maidrData.id =
|
|
12183
|
+
elementWithId.id = 'maidr-' + Math.random().toString(36).substr(2, 9);
|
|
12184
|
+
maidrData.id = elementWithId.id;
|
|
12181
12185
|
}
|
|
12182
12186
|
}
|
|
12183
12187
|
// Check if this id already exists in maidrObjects to avoid duplicates
|
|
12184
12188
|
if (!maidrObjects.some((obj) => obj.id === maidrData.id)) {
|
|
12185
12189
|
maidrObjects.push(maidrData);
|
|
12186
12190
|
}
|
|
12187
|
-
} catch (e) {
|
|
12188
|
-
console.error('Failed to parse maidr attribute:', e);
|
|
12189
12191
|
}
|
|
12190
|
-
}
|
|
12192
|
+
} else {
|
|
12193
|
+
// Then look for elements with maidr attribute
|
|
12194
|
+
const elementsWithMaidrAttr = document.querySelectorAll('[maidr-data]');
|
|
12195
|
+
elementsWithMaidrAttr.forEach((element) => {
|
|
12196
|
+
try {
|
|
12197
|
+
const maidrData = JSON.parse(element.getAttribute('maidr-data'));
|
|
12198
|
+
// If id is not provided in the JSON, use the element's id
|
|
12199
|
+
if (!maidrData.id) {
|
|
12200
|
+
if (element.id) {
|
|
12201
|
+
maidrData.id = element.id;
|
|
12202
|
+
} else {
|
|
12203
|
+
// Generate a random id if none exists
|
|
12204
|
+
element.id = 'maidr-' + Math.random().toString(36).substr(2, 9);
|
|
12205
|
+
maidrData.id = element.id;
|
|
12206
|
+
}
|
|
12207
|
+
}
|
|
12208
|
+
// Check if this id already exists in maidrObjects to avoid duplicates
|
|
12209
|
+
if (!maidrObjects.some((obj) => obj.id === maidrData.id)) {
|
|
12210
|
+
maidrObjects.push(maidrData);
|
|
12211
|
+
}
|
|
12212
|
+
} catch (e) {
|
|
12213
|
+
console.error('Failed to parse maidr attribute:', e);
|
|
12214
|
+
}
|
|
12215
|
+
});
|
|
12216
|
+
}
|
|
12191
12217
|
|
|
12192
12218
|
// set focus events for all maidr ids
|
|
12193
12219
|
DestroyMaidr(); // just in case
|
|
@@ -12208,9 +12234,12 @@ document.addEventListener('DOMContentLoaded', function (e) {
|
|
|
12208
12234
|
// blur done elsewhere
|
|
12209
12235
|
}
|
|
12210
12236
|
}
|
|
12211
|
-
|
|
12212
12237
|
// init components like alt text on just the first chart
|
|
12213
12238
|
CreateChartComponents(firstMaidr, true);
|
|
12239
|
+
}
|
|
12240
|
+
|
|
12241
|
+
document.addEventListener('DOMContentLoaded', function (e) {
|
|
12242
|
+
init();
|
|
12214
12243
|
});
|
|
12215
12244
|
|
|
12216
12245
|
/**
|