@diagrammo/dgmo 0.20.0 → 0.20.1
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/advanced.cjs +33 -27
- package/dist/advanced.js +31 -25
- package/dist/auto.cjs +31 -25
- package/dist/auto.js +101 -101
- package/dist/auto.mjs +30 -24
- package/dist/cli.cjs +129 -129
- package/dist/index.cjs +30 -24
- package/dist/index.js +29 -23
- package/dist/internal.cjs +33 -27
- package/dist/internal.js +31 -25
- package/package.json +1 -1
- package/src/advanced.ts +1 -4
- package/src/map/load-data.ts +48 -19
package/dist/auto.mjs
CHANGED
|
@@ -45957,17 +45957,22 @@ var load_data_exports = {};
|
|
|
45957
45957
|
__export(load_data_exports, {
|
|
45958
45958
|
loadMapData: () => loadMapData
|
|
45959
45959
|
});
|
|
45960
|
-
|
|
45961
|
-
|
|
45962
|
-
import
|
|
45963
|
-
|
|
45964
|
-
|
|
45960
|
+
async function loadNodeBuiltins() {
|
|
45961
|
+
const [{ readFile }, { fileURLToPath }, { dirname, resolve }] = await Promise.all([
|
|
45962
|
+
import("fs/promises"),
|
|
45963
|
+
import("url"),
|
|
45964
|
+
import("path")
|
|
45965
|
+
]);
|
|
45966
|
+
return { readFile, fileURLToPath, dirname, resolve };
|
|
45967
|
+
}
|
|
45968
|
+
async function readJson(nb, dir, name) {
|
|
45969
|
+
return JSON.parse(await nb.readFile(nb.resolve(dir, name), "utf8"));
|
|
45965
45970
|
}
|
|
45966
|
-
async function firstExistingDir(baseDir) {
|
|
45971
|
+
async function firstExistingDir(nb, baseDir) {
|
|
45967
45972
|
for (const rel of CANDIDATE_DIRS) {
|
|
45968
|
-
const dir = resolve(baseDir, rel);
|
|
45973
|
+
const dir = nb.resolve(baseDir, rel);
|
|
45969
45974
|
try {
|
|
45970
|
-
await readFile(resolve(dir, FILES.gazetteer), "utf8");
|
|
45975
|
+
await nb.readFile(nb.resolve(dir, FILES.gazetteer), "utf8");
|
|
45971
45976
|
return dir;
|
|
45972
45977
|
} catch {
|
|
45973
45978
|
}
|
|
@@ -45983,10 +45988,10 @@ function validate(data) {
|
|
|
45983
45988
|
}
|
|
45984
45989
|
return data;
|
|
45985
45990
|
}
|
|
45986
|
-
function moduleBaseDir() {
|
|
45991
|
+
function moduleBaseDir(nb) {
|
|
45987
45992
|
try {
|
|
45988
45993
|
const url = import.meta.url;
|
|
45989
|
-
if (url) return dirname(fileURLToPath(url));
|
|
45994
|
+
if (url) return nb.dirname(nb.fileURLToPath(url));
|
|
45990
45995
|
} catch {
|
|
45991
45996
|
}
|
|
45992
45997
|
if (typeof __dirname !== "undefined") return __dirname;
|
|
@@ -45994,7 +45999,8 @@ function moduleBaseDir() {
|
|
|
45994
45999
|
}
|
|
45995
46000
|
function loadMapData() {
|
|
45996
46001
|
cache ??= (async () => {
|
|
45997
|
-
const
|
|
46002
|
+
const nb = await loadNodeBuiltins();
|
|
46003
|
+
const dir = await firstExistingDir(nb, moduleBaseDir(nb));
|
|
45998
46004
|
const [
|
|
45999
46005
|
worldCoarse,
|
|
46000
46006
|
worldDetail,
|
|
@@ -46005,15 +46011,15 @@ function loadMapData() {
|
|
|
46005
46011
|
naLakes,
|
|
46006
46012
|
gazetteer
|
|
46007
46013
|
] = await Promise.all([
|
|
46008
|
-
readJson(dir, FILES.worldCoarse),
|
|
46009
|
-
readJson(dir, FILES.worldDetail),
|
|
46010
|
-
readJson(dir, FILES.usStates),
|
|
46014
|
+
readJson(nb, dir, FILES.worldCoarse),
|
|
46015
|
+
readJson(nb, dir, FILES.worldDetail),
|
|
46016
|
+
readJson(nb, dir, FILES.usStates),
|
|
46011
46017
|
// Lakes/rivers/NA assets are optional — older bundles may predate them.
|
|
46012
|
-
readJson(dir, FILES.lakes).catch(() => void 0),
|
|
46013
|
-
readJson(dir, FILES.rivers).catch(() => void 0),
|
|
46014
|
-
readJson(dir, FILES.naLand).catch(() => void 0),
|
|
46015
|
-
readJson(dir, FILES.naLakes).catch(() => void 0),
|
|
46016
|
-
readJson(dir, FILES.gazetteer)
|
|
46018
|
+
readJson(nb, dir, FILES.lakes).catch(() => void 0),
|
|
46019
|
+
readJson(nb, dir, FILES.rivers).catch(() => void 0),
|
|
46020
|
+
readJson(nb, dir, FILES.naLand).catch(() => void 0),
|
|
46021
|
+
readJson(nb, dir, FILES.naLakes).catch(() => void 0),
|
|
46022
|
+
readJson(nb, dir, FILES.gazetteer)
|
|
46017
46023
|
]);
|
|
46018
46024
|
return validate({
|
|
46019
46025
|
worldCoarse,
|
|
@@ -53658,18 +53664,18 @@ function getRotateFn(mode) {
|
|
|
53658
53664
|
return () => 0;
|
|
53659
53665
|
}
|
|
53660
53666
|
function renderWordCloudAsync(container, parsed, palette, _isDark, exportDims) {
|
|
53661
|
-
return new Promise((
|
|
53667
|
+
return new Promise((resolve) => {
|
|
53662
53668
|
d3Selection23.select(container).selectAll(":not([data-d3-tooltip])").remove();
|
|
53663
53669
|
const { words, cloudOptions } = parsed;
|
|
53664
53670
|
const title = parsed.noTitle ? null : parsed.title;
|
|
53665
53671
|
if (words.length === 0) {
|
|
53666
|
-
|
|
53672
|
+
resolve();
|
|
53667
53673
|
return;
|
|
53668
53674
|
}
|
|
53669
53675
|
const width = exportDims?.width ?? container.clientWidth;
|
|
53670
53676
|
const height = exportDims?.height ?? container.clientHeight;
|
|
53671
53677
|
if (width <= 0 || height <= 0) {
|
|
53672
|
-
|
|
53678
|
+
resolve();
|
|
53673
53679
|
return;
|
|
53674
53680
|
}
|
|
53675
53681
|
const titleHeight = title ? 40 : 0;
|
|
@@ -53698,7 +53704,7 @@ function renderWordCloudAsync(container, parsed, palette, _isDark, exportDims) {
|
|
|
53698
53704
|
"transform",
|
|
53699
53705
|
(d) => `translate(${d.x},${d.y}) rotate(${d.rotate})`
|
|
53700
53706
|
).text((d) => d.text);
|
|
53701
|
-
|
|
53707
|
+
resolve();
|
|
53702
53708
|
}).start();
|
|
53703
53709
|
});
|
|
53704
53710
|
}
|
|
@@ -57045,7 +57051,7 @@ pre.dgmo, code.language-dgmo, pre > code.language-dgmo,
|
|
|
57045
57051
|
|
|
57046
57052
|
// src/auto/index.ts
|
|
57047
57053
|
init_safe_href();
|
|
57048
|
-
var VERSION = "0.20.
|
|
57054
|
+
var VERSION = "0.20.1";
|
|
57049
57055
|
var DEFAULTS = {
|
|
57050
57056
|
theme: "auto",
|
|
57051
57057
|
palette: "nord",
|