@canopy-iiif/app 1.8.9 → 1.8.10
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/lib/build/mdx.js +20 -2
- package/package.json +3 -2
- package/ui/dist/index.mjs +43230 -177
- package/ui/dist/index.mjs.map +4 -4
- package/ui/dist/server.mjs +29 -2
- package/ui/dist/server.mjs.map +2 -2
- package/ui/styles/components/_map.scss +55 -4
- package/ui/styles/index.css +51 -4
package/ui/dist/server.mjs
CHANGED
|
@@ -4539,6 +4539,14 @@ function normalizeNumber(value) {
|
|
|
4539
4539
|
const num = Number(value);
|
|
4540
4540
|
return Number.isFinite(num) ? num : null;
|
|
4541
4541
|
}
|
|
4542
|
+
function normalizeReactKey(value) {
|
|
4543
|
+
if (value == null) return "";
|
|
4544
|
+
const str = String(value);
|
|
4545
|
+
if (/^\.[0-9]+$/.test(str)) return "";
|
|
4546
|
+
if (str.startsWith(".$")) return str.slice(2);
|
|
4547
|
+
if (str.startsWith(".")) return str.slice(1);
|
|
4548
|
+
return str;
|
|
4549
|
+
}
|
|
4542
4550
|
function normalizeCoordinates(props = {}) {
|
|
4543
4551
|
var _a, _b, _c, _d, _e, _f;
|
|
4544
4552
|
const lat = (_b = (_a = normalizeNumber(props.lat)) != null ? _a : normalizeNumber(props.latitude)) != null ? _b : normalizeNumber(props.y);
|
|
@@ -4556,6 +4564,15 @@ function renderDetailsHtml(children) {
|
|
|
4556
4564
|
return "";
|
|
4557
4565
|
}
|
|
4558
4566
|
}
|
|
4567
|
+
function normalizeKeyLabel(value) {
|
|
4568
|
+
if (value == null) return "";
|
|
4569
|
+
try {
|
|
4570
|
+
const label = String(value).trim();
|
|
4571
|
+
return label;
|
|
4572
|
+
} catch (_) {
|
|
4573
|
+
return "";
|
|
4574
|
+
}
|
|
4575
|
+
}
|
|
4559
4576
|
function normalizeCustomPoint(child, index, manifestMap) {
|
|
4560
4577
|
var _a;
|
|
4561
4578
|
if (!React35.isValidElement(child)) return null;
|
|
@@ -4570,6 +4587,10 @@ function normalizeCustomPoint(child, index, manifestMap) {
|
|
|
4570
4587
|
let thumbnail = props.thumbnail || props.image || "";
|
|
4571
4588
|
let thumbnailWidth = normalizeNumber(props.thumbnailWidth);
|
|
4572
4589
|
let thumbnailHeight = normalizeNumber(props.thumbnailHeight);
|
|
4590
|
+
const rawNodeKey = child && child.key != null ? child.key : null;
|
|
4591
|
+
const normalizedNodeKey = normalizeReactKey(rawNodeKey);
|
|
4592
|
+
const keyValue = props.mapKey || props.group || props.key || normalizedNodeKey;
|
|
4593
|
+
const keyLabelFromProps = normalizeKeyLabel(props.keyLabel || props.legend || props.groupLabel);
|
|
4573
4594
|
const detailsHtml = renderDetailsHtml(props.children);
|
|
4574
4595
|
const manifestValues = Array.isArray(props.referencedManifests) ? props.referencedManifests : props.manifest ? [props.manifest] : Array.isArray(props.manifests) ? props.manifests : [];
|
|
4575
4596
|
const manifests = resolveReferencedManifests(manifestValues, manifestMap);
|
|
@@ -4599,7 +4620,9 @@ function normalizeCustomPoint(child, index, manifestMap) {
|
|
|
4599
4620
|
lng: coords.lng,
|
|
4600
4621
|
detailsHtml,
|
|
4601
4622
|
manifests,
|
|
4602
|
-
type: "custom"
|
|
4623
|
+
type: "custom",
|
|
4624
|
+
keyValue: keyValue ? String(keyValue).trim() : "",
|
|
4625
|
+
keyLabel: keyLabelFromProps
|
|
4603
4626
|
};
|
|
4604
4627
|
}
|
|
4605
4628
|
function normalizeCustomPoints(children, manifestMap) {
|
|
@@ -4709,6 +4732,7 @@ function getDatasetInfo() {
|
|
|
4709
4732
|
}
|
|
4710
4733
|
}
|
|
4711
4734
|
function MdxMap({ children, ...rest }) {
|
|
4735
|
+
var _a, _b, _c, _d, _e;
|
|
4712
4736
|
const manifestMap = useReferencedManifestMap();
|
|
4713
4737
|
const customPoints = normalizeCustomPoints(children, manifestMap);
|
|
4714
4738
|
const datasetInfo = getDatasetInfo();
|
|
@@ -4723,6 +4747,8 @@ function MdxMap({ children, ...rest }) {
|
|
|
4723
4747
|
const cluster = parseBoolean(rest.cluster, true);
|
|
4724
4748
|
const defaultCenter = normalizeCenter(rest.defaultCenter || rest.center);
|
|
4725
4749
|
const defaultZoom = normalizeNumber(rest.defaultZoom || rest.zoom);
|
|
4750
|
+
const rawKeyConfig = (_e = (_d = (_c = (_b = (_a = rest.key) != null ? _a : rest.mapKey) != null ? _b : rest.keys) != null ? _c : rest.legend) != null ? _d : rest.keyConfig) != null ? _e : null;
|
|
4751
|
+
const mapKeyConfig = Array.isArray(rawKeyConfig) ? rawKeyConfig : rawKeyConfig && typeof rawKeyConfig === "object" ? [rawKeyConfig] : [];
|
|
4726
4752
|
const payload = serializeProps2(rest, {
|
|
4727
4753
|
className: rest.className || "",
|
|
4728
4754
|
id: rest.id || null,
|
|
@@ -4733,7 +4759,8 @@ function MdxMap({ children, ...rest }) {
|
|
|
4733
4759
|
customPoints,
|
|
4734
4760
|
navDataset,
|
|
4735
4761
|
defaultCenter,
|
|
4736
|
-
defaultZoom: Number.isFinite(defaultZoom) ? defaultZoom : null
|
|
4762
|
+
defaultZoom: Number.isFinite(defaultZoom) ? defaultZoom : null,
|
|
4763
|
+
keyConfig: mapKeyConfig
|
|
4737
4764
|
});
|
|
4738
4765
|
const json = serializeForScript2(payload);
|
|
4739
4766
|
const placeholderClass = ["canopy-map", rest.className].filter(Boolean).join(" ");
|