ochre-sdk 1.0.31 → 1.0.32

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.
@@ -331,11 +331,15 @@ function parseWebElementProperties(componentProperty, elementResource, options,
331
331
  case "button": {
332
332
  const variant = componentReader.valueOr("variant", "default");
333
333
  let isExternal = false;
334
+ let isRelative = false;
334
335
  let href = parseWebsiteLinkTarget(componentReader.valueNode("navigate-to"), context);
335
336
  if (href === null) {
336
337
  href = parseWebsiteLinkTarget(componentReader.valueNode("link-to"), context);
337
338
  if (href === null) throw new Error(formatComponentError("Properties “navigate-to” or “link-to” not found", componentName, elementResource), { cause: componentProperty });
338
- else isExternal = true;
339
+ else {
340
+ isExternal = true;
341
+ isRelative = !href.startsWith("/");
342
+ }
339
343
  }
340
344
  const startIcon = componentReader.value("start-icon");
341
345
  const endIcon = componentReader.value("end-icon");
@@ -354,6 +358,7 @@ function parseWebElementProperties(componentProperty, elementResource, options,
354
358
  variant,
355
359
  href,
356
360
  isExternal,
361
+ isRelative,
357
362
  label: elementResource.document && "content" in elementResource.document ? parseXMLContent(elementResource.document, options) : null,
358
363
  startIcon,
359
364
  endIcon,
@@ -280,6 +280,7 @@ type WebElementComponent<T extends LanguageCodes = LanguageCodes> = {
280
280
  variant: "default" | "transparent" | "link";
281
281
  href: string;
282
282
  isExternal: boolean;
283
+ isRelative: boolean;
283
284
  label: MultilingualString<T> | null;
284
285
  startIcon: string | null;
285
286
  endIcon: string | null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ochre-sdk",
3
- "version": "1.0.31",
3
+ "version": "1.0.32",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "description": "Node.js library for working with OCHRE (Online Cultural and Historical Research Environment) data",