@startinblox/boilerplate 6.0.5 → 6.0.7

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/index.js CHANGED
@@ -675,12 +675,12 @@ class _ extends lt {
675
675
  document.readyState === "complete" ? r() : document.addEventListener("readystatechange", r);
676
676
  }
677
677
  async _attach(t, e, i) {
678
- if (!this.orbit && window.orbit && (this.orbit = window.orbit, e)) {
679
- if (Ae({
678
+ if (!this.orbit && window.orbit) {
679
+ if (this.orbit = window.orbit, e && (Ae({
680
680
  component: this,
681
681
  defaultRoute: t,
682
682
  ignoreRouter: i
683
- }), this.route && (this.component = this.orbit.getComponentFromRoute(this.route), this.component))
683
+ }), this.route && (this.component = this.orbit.getComponentFromRoute(this.route), this.component)))
684
684
  for (const r of this.orbit.components)
685
685
  r.uniq === this.component.uniq && (r.instance = this);
686
686
  return await this._afterAttach(), this.ready = !0, this.dispatchEvent(
@@ -745,10 +745,10 @@ class _ extends lt {
745
745
  l !== void 0 && (o[a.value] = l);
746
746
  return await this._responseAdaptator(o);
747
747
  }
748
- async _hasCherryPickedProperties(t) {
749
- const e = await t.properties;
750
- for (const i of this.cherryPickedProperties)
751
- if (e?.includes(i.key))
748
+ async _hasCherryPickedProperties(t, e = this.cherryPickedProperties) {
749
+ const i = await t.properties;
750
+ for (const r of e)
751
+ if (i?.includes(r.key))
752
752
  return !0;
753
753
  return !1;
754
754
  }
@@ -759,7 +759,7 @@ class _ extends lt {
759
759
  if (typeof t == "string" ? r = await window.sibStore.getData(t, wt) : t.isFullResource && !t.isFullResource?.() && (r = await window.sibStore.getData(t["@id"], wt)), !r) return { _originalResource: r };
760
760
  if (typeof r != "object" || r === null) return;
761
761
  if (r.isContainer?.() && r["ldp:contains"]) {
762
- if (await this._hasCherryPickedProperties(r))
762
+ if (await this._hasCherryPickedProperties(r, i))
763
763
  return await this._getProperties(r, e, i);
764
764
  const o = this._normalizeLdpContains(await r["ldp:contains"]);
765
765
  return await this._expandContainer(o, e, i);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@startinblox/boilerplate",
3
- "version": "6.0.5",
3
+ "version": "6.0.7",
4
4
  "description": "Startin'blox Boilerplate",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",
@@ -98,20 +98,19 @@ export default class extends ComponentObjectsHandler {
98
98
  }
99
99
  }
100
100
  }
101
-
102
- await this._afterAttach();
103
-
104
- this.ready = true;
105
- this.dispatchEvent(
106
- new CustomEvent("component-ready", {
107
- detail: {
108
- component: this.component,
109
- },
110
- }),
111
- );
112
-
113
- return Promise.resolve(true);
114
101
  }
102
+ await this._afterAttach();
103
+
104
+ this.ready = true;
105
+ this.dispatchEvent(
106
+ new CustomEvent("component-ready", {
107
+ detail: {
108
+ component: this.component,
109
+ },
110
+ }),
111
+ );
112
+
113
+ return Promise.resolve(true);
115
114
  }
116
115
  }
117
116
  return Promise.resolve(false);
@@ -216,10 +215,13 @@ export default class extends ComponentObjectsHandler {
216
215
  return await this._responseAdaptator(response);
217
216
  }
218
217
 
219
- async _hasCherryPickedProperties(resource: Resource) {
218
+ async _hasCherryPickedProperties(
219
+ resource: Resource,
220
+ targetProperties = this.cherryPickedProperties,
221
+ ) {
220
222
  const properties = await resource.properties;
221
223
 
222
- for (const prop of this.cherryPickedProperties) {
224
+ for (const prop of targetProperties) {
223
225
  if (properties?.includes(prop.key)) {
224
226
  return true;
225
227
  }
@@ -252,7 +254,7 @@ export default class extends ComponentObjectsHandler {
252
254
  if (typeof target !== "object" || target === null) return;
253
255
 
254
256
  if (target.isContainer?.() && target["ldp:contains"]) {
255
- if (await this._hasCherryPickedProperties(target)) {
257
+ if (await this._hasCherryPickedProperties(target, targetProperties)) {
256
258
  return await this._getProperties(target, recursive, targetProperties);
257
259
  }
258
260