ochre-sdk 1.3.27 → 1.3.28

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.
@@ -18,7 +18,7 @@ export type WebElementContext<T extends ReadonlyArray<string>> = {
18
18
  /**
19
19
  Reads the "customize-special" "element" properties of a website, each
20
20
  holding "component" properties whose settings every element of that
21
- component starts from
21
+ component starts from, except the ones in {@link ELEMENT_TARGET_LABELS}
22
22
 
23
23
  @param websiteReader - Reader over the website's "presentation" properties
24
24
  @param parent - The defaults of the enclosing website, which these extend
@@ -1,4 +1,5 @@
1
1
  import { normalizeItemCategory } from "../../categories.mjs";
2
+ import { getProperty } from "../../getters.mjs";
2
3
  import { parseStringContent } from "../helpers.mjs";
3
4
  import { parseBibliographyList, parseIdentification, parseLinks, parseSimplifiedProperties } from "../index.mjs";
4
5
  import { parseXMLContent, transformPermanentIdentificationUrlToItemLink } from "../string.mjs";
@@ -116,10 +117,15 @@ function parseCollectionRelations(reader) {
116
117
  }
117
118
  return relations;
118
119
  }
120
+ const ELEMENT_TARGET_LABELS = [
121
+ "link-to",
122
+ "navigate-to",
123
+ "bound-element"
124
+ ];
119
125
  /**
120
126
  Reads the "customize-special" "element" properties of a website, each
121
127
  holding "component" properties whose settings every element of that
122
- component starts from
128
+ component starts from, except the ones in {@link ELEMENT_TARGET_LABELS}
123
129
 
124
130
  @param websiteReader - Reader over the website's "presentation" properties
125
131
  @param parent - The defaults of the enclosing website, which these extend
@@ -130,7 +136,7 @@ function parseComponentDefaults(websiteReader, parent) {
130
136
  if (elementReaders.length === 0) return parent;
131
137
  const defaults = { ...parent };
132
138
  for (const component of componentSchema.options) for (const elementReader of elementReaders) {
133
- const componentProperties = elementReader.propertyByValue("component", component)?.properties;
139
+ const componentProperties = elementReader.propertyByValue("component", component)?.properties.filter((property) => ELEMENT_TARGET_LABELS.every((label) => getProperty([property], { label }) == null));
134
140
  if (componentProperties != null && componentProperties.length > 0) {
135
141
  defaults[component] = [componentProperties, ...parent[component] ?? []];
136
142
  break;
@@ -201,7 +201,9 @@ export type Website<T extends LanguageCodes = LanguageCodes> = {
201
201
  /**
202
202
  The settings every element of a component starts from, keyed by
203
203
  component name: the "component" properties of this website, then of each
204
- enclosing one, which an element overrides by setting the property itself
204
+ enclosing one, which an element overrides by setting the property itself.
205
+ The settings naming what an element points at ("link-to", "navigate-to",
206
+ and "bound-element") are left out, since every element sets its own.
205
207
  */
206
208
  componentDefaults: Partial<Record<WebElementComponentName, Array<Array<SimplifiedProperty<T>>>>>;
207
209
  itemPage: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ochre-sdk",
3
- "version": "1.3.27",
3
+ "version": "1.3.28",
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",