@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 CHANGED
@@ -46303,14 +46303,22 @@ var load_data_exports = {};
46303
46303
  __export(load_data_exports, {
46304
46304
  loadMapData: () => loadMapData
46305
46305
  });
46306
- async function readJson(dir, name) {
46307
- return JSON.parse(await (0, import_promises.readFile)((0, import_node_path.resolve)(dir, name), "utf8"));
46306
+ async function loadNodeBuiltins() {
46307
+ const [{ readFile }, { fileURLToPath }, { dirname: dirname2, resolve }] = await Promise.all([
46308
+ import("fs/promises"),
46309
+ import("url"),
46310
+ import("path")
46311
+ ]);
46312
+ return { readFile, fileURLToPath, dirname: dirname2, resolve };
46313
+ }
46314
+ async function readJson(nb, dir, name) {
46315
+ return JSON.parse(await nb.readFile(nb.resolve(dir, name), "utf8"));
46308
46316
  }
46309
- async function firstExistingDir(baseDir) {
46317
+ async function firstExistingDir(nb, baseDir) {
46310
46318
  for (const rel of CANDIDATE_DIRS) {
46311
- const dir = (0, import_node_path.resolve)(baseDir, rel);
46319
+ const dir = nb.resolve(baseDir, rel);
46312
46320
  try {
46313
- await (0, import_promises.readFile)((0, import_node_path.resolve)(dir, FILES.gazetteer), "utf8");
46321
+ await nb.readFile(nb.resolve(dir, FILES.gazetteer), "utf8");
46314
46322
  return dir;
46315
46323
  } catch {
46316
46324
  }
@@ -46326,10 +46334,10 @@ function validate(data) {
46326
46334
  }
46327
46335
  return data;
46328
46336
  }
46329
- function moduleBaseDir() {
46337
+ function moduleBaseDir(nb) {
46330
46338
  try {
46331
46339
  const url = import_meta.url;
46332
- if (url) return (0, import_node_path.dirname)((0, import_node_url.fileURLToPath)(url));
46340
+ if (url) return nb.dirname(nb.fileURLToPath(url));
46333
46341
  } catch {
46334
46342
  }
46335
46343
  if (typeof __dirname !== "undefined") return __dirname;
@@ -46337,7 +46345,8 @@ function moduleBaseDir() {
46337
46345
  }
46338
46346
  function loadMapData() {
46339
46347
  cache ??= (async () => {
46340
- const dir = await firstExistingDir(moduleBaseDir());
46348
+ const nb = await loadNodeBuiltins();
46349
+ const dir = await firstExistingDir(nb, moduleBaseDir(nb));
46341
46350
  const [
46342
46351
  worldCoarse,
46343
46352
  worldDetail,
@@ -46348,15 +46357,15 @@ function loadMapData() {
46348
46357
  naLakes,
46349
46358
  gazetteer
46350
46359
  ] = await Promise.all([
46351
- readJson(dir, FILES.worldCoarse),
46352
- readJson(dir, FILES.worldDetail),
46353
- readJson(dir, FILES.usStates),
46360
+ readJson(nb, dir, FILES.worldCoarse),
46361
+ readJson(nb, dir, FILES.worldDetail),
46362
+ readJson(nb, dir, FILES.usStates),
46354
46363
  // Lakes/rivers/NA assets are optional — older bundles may predate them.
46355
- readJson(dir, FILES.lakes).catch(() => void 0),
46356
- readJson(dir, FILES.rivers).catch(() => void 0),
46357
- readJson(dir, FILES.naLand).catch(() => void 0),
46358
- readJson(dir, FILES.naLakes).catch(() => void 0),
46359
- readJson(dir, FILES.gazetteer)
46364
+ readJson(nb, dir, FILES.lakes).catch(() => void 0),
46365
+ readJson(nb, dir, FILES.rivers).catch(() => void 0),
46366
+ readJson(nb, dir, FILES.naLand).catch(() => void 0),
46367
+ readJson(nb, dir, FILES.naLakes).catch(() => void 0),
46368
+ readJson(nb, dir, FILES.gazetteer)
46360
46369
  ]);
46361
46370
  return validate({
46362
46371
  worldCoarse,
@@ -46374,13 +46383,10 @@ function loadMapData() {
46374
46383
  });
46375
46384
  return cache;
46376
46385
  }
46377
- var import_promises, import_node_url, import_node_path, import_meta, FILES, CANDIDATE_DIRS, cache;
46386
+ var import_meta, FILES, CANDIDATE_DIRS, cache;
46378
46387
  var init_load_data = __esm({
46379
46388
  "src/map/load-data.ts"() {
46380
46389
  "use strict";
46381
- import_promises = require("fs/promises");
46382
- import_node_url = require("url");
46383
- import_node_path = require("path");
46384
46390
  import_meta = {};
46385
46391
  FILES = {
46386
46392
  worldCoarse: "world-coarse.json",
@@ -54055,18 +54061,18 @@ function renderWordCloud(container, parsed, palette, _isDark, onClickItem, expor
54055
54061
  }).start();
54056
54062
  }
54057
54063
  function renderWordCloudAsync(container, parsed, palette, _isDark, exportDims) {
54058
- return new Promise((resolve2) => {
54064
+ return new Promise((resolve) => {
54059
54065
  d3Selection23.select(container).selectAll(":not([data-d3-tooltip])").remove();
54060
54066
  const { words, cloudOptions } = parsed;
54061
54067
  const title = parsed.noTitle ? null : parsed.title;
54062
54068
  if (words.length === 0) {
54063
- resolve2();
54069
+ resolve();
54064
54070
  return;
54065
54071
  }
54066
54072
  const width = exportDims?.width ?? container.clientWidth;
54067
54073
  const height = exportDims?.height ?? container.clientHeight;
54068
54074
  if (width <= 0 || height <= 0) {
54069
- resolve2();
54075
+ resolve();
54070
54076
  return;
54071
54077
  }
54072
54078
  const titleHeight = title ? 40 : 0;
@@ -54095,7 +54101,7 @@ function renderWordCloudAsync(container, parsed, palette, _isDark, exportDims) {
54095
54101
  "transform",
54096
54102
  (d) => `translate(${d.x},${d.y}) rotate(${d.rotate})`
54097
54103
  ).text((d) => d.text);
54098
- resolve2();
54104
+ resolve();
54099
54105
  }).start();
54100
54106
  });
54101
54107
  }
@@ -57528,12 +57534,12 @@ var KNOWN_HEADER_OPTIONS = /* @__PURE__ */ new Set([
57528
57534
  "solid-fill",
57529
57535
  "active-tag"
57530
57536
  ]);
57531
- function dirname2(filePath) {
57537
+ function dirname(filePath) {
57532
57538
  const last = filePath.lastIndexOf("/");
57533
57539
  return last > 0 ? filePath.substring(0, last) : "/";
57534
57540
  }
57535
57541
  function resolvePath(base, relative) {
57536
- const parts = dirname2(base).split("/");
57542
+ const parts = dirname(base).split("/");
57537
57543
  for (const seg of relative.split("/")) {
57538
57544
  if (seg === "..") {
57539
57545
  if (parts.length > 1) parts.pop();
@@ -59660,7 +59666,7 @@ init_dgmo_router();
59660
59666
 
59661
59667
  // src/migrate/index.ts
59662
59668
  var import_node_fs = require("fs");
59663
- var import_node_path2 = require("path");
59669
+ var import_node_path = require("path");
59664
59670
  init_dgmo_router();
59665
59671
 
59666
59672
  // src/migrate/line-classifier.ts
package/dist/advanced.js CHANGED
@@ -46319,17 +46319,22 @@ var load_data_exports = {};
46319
46319
  __export(load_data_exports, {
46320
46320
  loadMapData: () => loadMapData
46321
46321
  });
46322
- import { readFile } from "fs/promises";
46323
- import { fileURLToPath } from "url";
46324
- import { dirname, resolve } from "path";
46325
- async function readJson(dir, name) {
46326
- return JSON.parse(await readFile(resolve(dir, name), "utf8"));
46322
+ async function loadNodeBuiltins() {
46323
+ const [{ readFile }, { fileURLToPath }, { dirname: dirname2, resolve }] = await Promise.all([
46324
+ import("fs/promises"),
46325
+ import("url"),
46326
+ import("path")
46327
+ ]);
46328
+ return { readFile, fileURLToPath, dirname: dirname2, resolve };
46329
+ }
46330
+ async function readJson(nb, dir, name) {
46331
+ return JSON.parse(await nb.readFile(nb.resolve(dir, name), "utf8"));
46327
46332
  }
46328
- async function firstExistingDir(baseDir) {
46333
+ async function firstExistingDir(nb, baseDir) {
46329
46334
  for (const rel of CANDIDATE_DIRS) {
46330
- const dir = resolve(baseDir, rel);
46335
+ const dir = nb.resolve(baseDir, rel);
46331
46336
  try {
46332
- await readFile(resolve(dir, FILES.gazetteer), "utf8");
46337
+ await nb.readFile(nb.resolve(dir, FILES.gazetteer), "utf8");
46333
46338
  return dir;
46334
46339
  } catch {
46335
46340
  }
@@ -46345,10 +46350,10 @@ function validate(data) {
46345
46350
  }
46346
46351
  return data;
46347
46352
  }
46348
- function moduleBaseDir() {
46353
+ function moduleBaseDir(nb) {
46349
46354
  try {
46350
46355
  const url = import.meta.url;
46351
- if (url) return dirname(fileURLToPath(url));
46356
+ if (url) return nb.dirname(nb.fileURLToPath(url));
46352
46357
  } catch {
46353
46358
  }
46354
46359
  if (typeof __dirname !== "undefined") return __dirname;
@@ -46356,7 +46361,8 @@ function moduleBaseDir() {
46356
46361
  }
46357
46362
  function loadMapData() {
46358
46363
  cache ??= (async () => {
46359
- const dir = await firstExistingDir(moduleBaseDir());
46364
+ const nb = await loadNodeBuiltins();
46365
+ const dir = await firstExistingDir(nb, moduleBaseDir(nb));
46360
46366
  const [
46361
46367
  worldCoarse,
46362
46368
  worldDetail,
@@ -46367,15 +46373,15 @@ function loadMapData() {
46367
46373
  naLakes,
46368
46374
  gazetteer
46369
46375
  ] = await Promise.all([
46370
- readJson(dir, FILES.worldCoarse),
46371
- readJson(dir, FILES.worldDetail),
46372
- readJson(dir, FILES.usStates),
46376
+ readJson(nb, dir, FILES.worldCoarse),
46377
+ readJson(nb, dir, FILES.worldDetail),
46378
+ readJson(nb, dir, FILES.usStates),
46373
46379
  // Lakes/rivers/NA assets are optional — older bundles may predate them.
46374
- readJson(dir, FILES.lakes).catch(() => void 0),
46375
- readJson(dir, FILES.rivers).catch(() => void 0),
46376
- readJson(dir, FILES.naLand).catch(() => void 0),
46377
- readJson(dir, FILES.naLakes).catch(() => void 0),
46378
- readJson(dir, FILES.gazetteer)
46380
+ readJson(nb, dir, FILES.lakes).catch(() => void 0),
46381
+ readJson(nb, dir, FILES.rivers).catch(() => void 0),
46382
+ readJson(nb, dir, FILES.naLand).catch(() => void 0),
46383
+ readJson(nb, dir, FILES.naLakes).catch(() => void 0),
46384
+ readJson(nb, dir, FILES.gazetteer)
46379
46385
  ]);
46380
46386
  return validate({
46381
46387
  worldCoarse,
@@ -54083,18 +54089,18 @@ function renderWordCloud(container, parsed, palette, _isDark, onClickItem, expor
54083
54089
  }).start();
54084
54090
  }
54085
54091
  function renderWordCloudAsync(container, parsed, palette, _isDark, exportDims) {
54086
- return new Promise((resolve2) => {
54092
+ return new Promise((resolve) => {
54087
54093
  d3Selection23.select(container).selectAll(":not([data-d3-tooltip])").remove();
54088
54094
  const { words, cloudOptions } = parsed;
54089
54095
  const title = parsed.noTitle ? null : parsed.title;
54090
54096
  if (words.length === 0) {
54091
- resolve2();
54097
+ resolve();
54092
54098
  return;
54093
54099
  }
54094
54100
  const width = exportDims?.width ?? container.clientWidth;
54095
54101
  const height = exportDims?.height ?? container.clientHeight;
54096
54102
  if (width <= 0 || height <= 0) {
54097
- resolve2();
54103
+ resolve();
54098
54104
  return;
54099
54105
  }
54100
54106
  const titleHeight = title ? 40 : 0;
@@ -54123,7 +54129,7 @@ function renderWordCloudAsync(container, parsed, palette, _isDark, exportDims) {
54123
54129
  "transform",
54124
54130
  (d) => `translate(${d.x},${d.y}) rotate(${d.rotate})`
54125
54131
  ).text((d) => d.text);
54126
- resolve2();
54132
+ resolve();
54127
54133
  }).start();
54128
54134
  });
54129
54135
  }
@@ -57273,12 +57279,12 @@ var KNOWN_HEADER_OPTIONS = /* @__PURE__ */ new Set([
57273
57279
  "solid-fill",
57274
57280
  "active-tag"
57275
57281
  ]);
57276
- function dirname2(filePath) {
57282
+ function dirname(filePath) {
57277
57283
  const last = filePath.lastIndexOf("/");
57278
57284
  return last > 0 ? filePath.substring(0, last) : "/";
57279
57285
  }
57280
57286
  function resolvePath(base, relative) {
57281
- const parts = dirname2(base).split("/");
57287
+ const parts = dirname(base).split("/");
57282
57288
  for (const seg of relative.split("/")) {
57283
57289
  if (seg === "..") {
57284
57290
  if (parts.length > 1) parts.pop();
package/dist/auto.cjs CHANGED
@@ -45941,14 +45941,22 @@ var load_data_exports = {};
45941
45941
  __export(load_data_exports, {
45942
45942
  loadMapData: () => loadMapData
45943
45943
  });
45944
- async function readJson(dir, name) {
45945
- return JSON.parse(await (0, import_promises.readFile)((0, import_node_path.resolve)(dir, name), "utf8"));
45944
+ async function loadNodeBuiltins() {
45945
+ const [{ readFile }, { fileURLToPath }, { dirname, resolve }] = await Promise.all([
45946
+ import("fs/promises"),
45947
+ import("url"),
45948
+ import("path")
45949
+ ]);
45950
+ return { readFile, fileURLToPath, dirname, resolve };
45951
+ }
45952
+ async function readJson(nb, dir, name) {
45953
+ return JSON.parse(await nb.readFile(nb.resolve(dir, name), "utf8"));
45946
45954
  }
45947
- async function firstExistingDir(baseDir) {
45955
+ async function firstExistingDir(nb, baseDir) {
45948
45956
  for (const rel of CANDIDATE_DIRS) {
45949
- const dir = (0, import_node_path.resolve)(baseDir, rel);
45957
+ const dir = nb.resolve(baseDir, rel);
45950
45958
  try {
45951
- await (0, import_promises.readFile)((0, import_node_path.resolve)(dir, FILES.gazetteer), "utf8");
45959
+ await nb.readFile(nb.resolve(dir, FILES.gazetteer), "utf8");
45952
45960
  return dir;
45953
45961
  } catch {
45954
45962
  }
@@ -45964,10 +45972,10 @@ function validate(data) {
45964
45972
  }
45965
45973
  return data;
45966
45974
  }
45967
- function moduleBaseDir() {
45975
+ function moduleBaseDir(nb) {
45968
45976
  try {
45969
45977
  const url = import_meta.url;
45970
- if (url) return (0, import_node_path.dirname)((0, import_node_url.fileURLToPath)(url));
45978
+ if (url) return nb.dirname(nb.fileURLToPath(url));
45971
45979
  } catch {
45972
45980
  }
45973
45981
  if (typeof __dirname !== "undefined") return __dirname;
@@ -45975,7 +45983,8 @@ function moduleBaseDir() {
45975
45983
  }
45976
45984
  function loadMapData() {
45977
45985
  cache ??= (async () => {
45978
- const dir = await firstExistingDir(moduleBaseDir());
45986
+ const nb = await loadNodeBuiltins();
45987
+ const dir = await firstExistingDir(nb, moduleBaseDir(nb));
45979
45988
  const [
45980
45989
  worldCoarse,
45981
45990
  worldDetail,
@@ -45986,15 +45995,15 @@ function loadMapData() {
45986
45995
  naLakes,
45987
45996
  gazetteer
45988
45997
  ] = await Promise.all([
45989
- readJson(dir, FILES.worldCoarse),
45990
- readJson(dir, FILES.worldDetail),
45991
- readJson(dir, FILES.usStates),
45998
+ readJson(nb, dir, FILES.worldCoarse),
45999
+ readJson(nb, dir, FILES.worldDetail),
46000
+ readJson(nb, dir, FILES.usStates),
45992
46001
  // Lakes/rivers/NA assets are optional — older bundles may predate them.
45993
- readJson(dir, FILES.lakes).catch(() => void 0),
45994
- readJson(dir, FILES.rivers).catch(() => void 0),
45995
- readJson(dir, FILES.naLand).catch(() => void 0),
45996
- readJson(dir, FILES.naLakes).catch(() => void 0),
45997
- readJson(dir, FILES.gazetteer)
46002
+ readJson(nb, dir, FILES.lakes).catch(() => void 0),
46003
+ readJson(nb, dir, FILES.rivers).catch(() => void 0),
46004
+ readJson(nb, dir, FILES.naLand).catch(() => void 0),
46005
+ readJson(nb, dir, FILES.naLakes).catch(() => void 0),
46006
+ readJson(nb, dir, FILES.gazetteer)
45998
46007
  ]);
45999
46008
  return validate({
46000
46009
  worldCoarse,
@@ -46012,13 +46021,10 @@ function loadMapData() {
46012
46021
  });
46013
46022
  return cache;
46014
46023
  }
46015
- var import_promises, import_node_url, import_node_path, import_meta, FILES, CANDIDATE_DIRS, cache;
46024
+ var import_meta, FILES, CANDIDATE_DIRS, cache;
46016
46025
  var init_load_data = __esm({
46017
46026
  "src/map/load-data.ts"() {
46018
46027
  "use strict";
46019
- import_promises = require("fs/promises");
46020
- import_node_url = require("url");
46021
- import_node_path = require("path");
46022
46028
  import_meta = {};
46023
46029
  FILES = {
46024
46030
  worldCoarse: "world-coarse.json",
@@ -53630,18 +53636,18 @@ function getRotateFn(mode) {
53630
53636
  return () => 0;
53631
53637
  }
53632
53638
  function renderWordCloudAsync(container, parsed, palette, _isDark, exportDims) {
53633
- return new Promise((resolve2) => {
53639
+ return new Promise((resolve) => {
53634
53640
  d3Selection23.select(container).selectAll(":not([data-d3-tooltip])").remove();
53635
53641
  const { words, cloudOptions } = parsed;
53636
53642
  const title = parsed.noTitle ? null : parsed.title;
53637
53643
  if (words.length === 0) {
53638
- resolve2();
53644
+ resolve();
53639
53645
  return;
53640
53646
  }
53641
53647
  const width = exportDims?.width ?? container.clientWidth;
53642
53648
  const height = exportDims?.height ?? container.clientHeight;
53643
53649
  if (width <= 0 || height <= 0) {
53644
- resolve2();
53650
+ resolve();
53645
53651
  return;
53646
53652
  }
53647
53653
  const titleHeight = title ? 40 : 0;
@@ -53670,7 +53676,7 @@ function renderWordCloudAsync(container, parsed, palette, _isDark, exportDims) {
53670
53676
  "transform",
53671
53677
  (d) => `translate(${d.x},${d.y}) rotate(${d.rotate})`
53672
53678
  ).text((d) => d.text);
53673
- resolve2();
53679
+ resolve();
53674
53680
  }).start();
53675
53681
  });
53676
53682
  }
@@ -57036,7 +57042,7 @@ pre.dgmo, code.language-dgmo, pre > code.language-dgmo,
57036
57042
 
57037
57043
  // src/auto/index.ts
57038
57044
  init_safe_href();
57039
- var VERSION = "0.20.0";
57045
+ var VERSION = "0.20.1";
57040
57046
  var DEFAULTS = {
57041
57047
  theme: "auto",
57042
57048
  palette: "nord",