diff --git a/tools/cldr-apps/js/package-lock.json b/tools/cldr-apps/js/package-lock.json index effb41a5d85..56f3f2b8aca 100644 --- a/tools/cldr-apps/js/package-lock.json +++ b/tools/cldr-apps/js/package-lock.json @@ -1292,12 +1292,12 @@ } }, "node_modules/braces": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", - "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz", + "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==", "dev": true, "dependencies": { - "fill-range": "^7.0.1" + "fill-range": "^7.1.1" }, "engines": { "node": ">=8" @@ -2048,9 +2048,9 @@ } }, "node_modules/fill-range": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", - "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz", + "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==", "dev": true, "dependencies": { "to-regex-range": "^5.0.1" diff --git a/tools/cldr-apps/js/src/esm/cldrLoad.mjs b/tools/cldr-apps/js/src/esm/cldrLoad.mjs index 25fcaf2df04..1cdde412622 100644 --- a/tools/cldr-apps/js/src/esm/cldrLoad.mjs +++ b/tools/cldr-apps/js/src/esm/cldrLoad.mjs @@ -1049,10 +1049,30 @@ function getLocaleDir(locale) { return localeDir; } +/** @returns true if locmap has been loaded from data */ +function localeMapReady() { + return !!locmap.locmap; +} + +/** event ID for localeMap changes */ +const LOCALEMAP_EVENT = "localeMapReady"; + +/** + * Calls the callback when the localeMap is ready (with real data). + * Calls right away if the localeMap was already loaded. + */ +function onLocaleMapReady(callback) { + if (localeMapReady()) { + callback(); + } else { + cldrStatus.on(LOCALEMAP_EVENT, callback); + } +} + function setTheLocaleMap(lm) { locmap = lm; + cldrStatus.dispatchEvent(new Event(LOCALEMAP_EVENT)); } - /** * Convenience for calling getTheLocaleMap().getLocaleName(loc) * @param {String} loc @@ -1062,6 +1082,10 @@ function getLocaleName(loc) { return locmap.getLocaleName(loc); } +function getLocaleInfo(loc) { + return locmap.getLocaleInfo(loc); +} + /** * Get the window location hash * @@ -1145,6 +1169,7 @@ export { flipToOtherDiv, getHash, getLocaleDir, + getLocaleInfo, getLocaleName, getTheLocaleMap, handleCoverageChanged, @@ -1152,6 +1177,7 @@ export { linkToLocale, localeSpecialNote, myLoad, + onLocaleMapReady, parseHashAndUpdate, reloadV, replaceHash, diff --git a/tools/cldr-apps/js/src/esm/cldrStatus.mjs b/tools/cldr-apps/js/src/esm/cldrStatus.mjs index da6b0d94d29..862b875c6ec 100644 --- a/tools/cldr-apps/js/src/esm/cldrStatus.mjs +++ b/tools/cldr-apps/js/src/esm/cldrStatus.mjs @@ -49,6 +49,10 @@ function on(type, callback) { getStatusTarget().addEventListener(type, callback); } +/** + * Fire off an event manually + * @param type the type to dispatch + */ function dispatchEvent(type) { return getStatusTarget().dispatchEvent(type); } @@ -75,6 +79,9 @@ function updateAll(status) { if (status.phase) { setPhase(status.phase); } + if (status.extendedPhase) { + setExtendedPhase(status.extendedPhase); + } if (status.specialHeader) { setSpecialHeader(status.specialHeader); } @@ -300,6 +307,16 @@ function setPhase(p) { phase = p; } +let extendedPhase = ""; + +function getExtendedPhase() { + return extendedPhase; +} + +function setExtendedPhase(p) { + extendedPhase = p; +} + /** * Is this a "beta" phase of Survey Tool? (Boolean) */ @@ -466,6 +483,7 @@ function setAutoImportBusy(busy) { } export { + dispatchEvent, getAutoImportBusy, getContextPath, getCurrentId, @@ -474,6 +492,7 @@ export { getCurrentPage, getCurrentSection, getCurrentSpecial, + getExtendedPhase, getIsPhaseBeta, getIsUnofficial, getNewVersion, @@ -500,6 +519,7 @@ export { setCurrentPage, setCurrentSection, setCurrentSpecial, + setExtendedPhase, setIsDisconnected, setIsPhaseBeta, setIsUnofficial, diff --git a/tools/cldr-apps/js/src/views/MainHeader.vue b/tools/cldr-apps/js/src/views/MainHeader.vue index 3a8d4a7532c..46b77c9e032 100644 --- a/tools/cldr-apps/js/src/views/MainHeader.vue +++ b/tools/cldr-apps/js/src/views/MainHeader.vue @@ -1,7 +1,17 @@