@scaleflex/dam-core 0.3.0 → 0.3.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/index.js CHANGED
@@ -504,8 +504,10 @@ const Fe = ["cdn_permalink"], q = {
504
504
  size: "size",
505
505
  type: "type"
506
506
  };
507
- function Pe(s) {
508
- const e = s.fields ?? Fe, t = {
507
+ function Ee(s) {
508
+ let e = s.fields ?? Fe;
509
+ s.permalinksEnabled || (e = e.filter((l) => l !== "cdn_permalink"));
510
+ const t = {
509
511
  offset: s.offset ?? 0,
510
512
  limit: s.limit ?? 100,
511
513
  format: "json,regvar:api,select:internal",
@@ -519,7 +521,7 @@ function Pe(s) {
519
521
  return s.search && !s.with_ai && o.push(s.search), s.q && o.push(s.q), o.length > 0 && (t.q = o.join(" ")), s.with_ai && (t.with_ai = !0, s.ai_query && (t.ai_query = s.ai_query), s.ai_lang && (t.ai_lang = s.ai_lang)), s.collection_uuid && (t.collection_uuid = s.collection_uuid), s.f64 && (t.f64 = s.f64), t;
520
522
  }
521
523
  function Ue(s, e) {
522
- return s.get("/files", Pe(e));
524
+ return s.get("/files", Ee(e));
523
525
  }
524
526
  function De(s, e) {
525
527
  const t = { recursive: e.recursive ?? 1 };
@@ -544,7 +546,7 @@ async function Me(s, e) {
544
546
  })).folders || {};
545
547
  }
546
548
  const C = 100, U = 1e3, D = { types: [], size: null, created: null, updated: null };
547
- class P {
549
+ class E {
548
550
  constructor(e, t = {}) {
549
551
  this.client = e, this.listeners = /* @__PURE__ */ new Set(), this.loadSeq = 0, this.treeSeq = 0, this.fetchedCount = 0, this.selectionAnchor = null, this.favAdapter = t.favourites, this.onScopeChange = t.onScopeChange, this.state = {
550
552
  scope: { type: "folder", value: t.rootFolder ?? "/" },
@@ -753,7 +755,7 @@ class P {
753
755
  const { scope: i } = this.state;
754
756
  if (i.type !== "folder" || !i.value) return !1;
755
757
  const r = i.value;
756
- return r !== e && !r.startsWith(e + "/") ? !1 : (t === null ? this.openFolder(P.parentOf(e)) : this.openFolder(r === e ? t : t + r.slice(e.length)), !0);
758
+ return r !== e && !r.startsWith(e + "/") ? !1 : (t === null ? this.openFolder(E.parentOf(e)) : this.openFolder(r === e ? t : t + r.slice(e.length)), !0);
757
759
  }
758
760
  async createFolder(e) {
759
761
  await K(this.client, e, this.currentFolderPath), await this.refreshTree(), await this.load();
@@ -761,7 +763,7 @@ class P {
761
763
  async renameFolderById(e, t) {
762
764
  const i = this.folderPath(e);
763
765
  await Y(this.client, e, t), await this.refreshTree();
764
- const r = i ? `${P.parentOf(i).replace(/\/$/, "")}/${t}` : null;
766
+ const r = i ? `${E.parentOf(i).replace(/\/$/, "")}/${t}` : null;
765
767
  i && r && this.redirectScope(i, r) || await this.load();
766
768
  }
767
769
  async deleteFolderById(e) {
@@ -926,12 +928,12 @@ function Re(s, e) {
926
928
  const t = new URL(s);
927
929
  return e.width && t.searchParams.set("w", String(e.width)), e.height && t.searchParams.set("h", String(e.height)), e.quality !== void 0 && t.searchParams.set("q", String(e.quality)), t.toString();
928
930
  }
929
- const Le = { excellent: 90, good: 75, fair: 60 }, ze = { fullhd: 1920, large: 1200, medium: 600, small: 300 }, Ee = {
931
+ const Le = { excellent: 90, good: 75, fair: 60 }, ze = { fullhd: 1920, large: 1200, medium: 600, small: 300 }, Pe = {
930
932
  webp: "awebp,webp",
931
933
  gif: "agif,gif"
932
934
  };
933
935
  function j(s, e) {
934
- s.searchParams.delete("download"), e.width && s.searchParams.set("w", String(e.width)), e.height && s.searchParams.set("h", String(e.height)), e.quality != null && s.searchParams.set("q", String(e.quality)), e.format && s.searchParams.set("force_format", Ee[e.format] ?? e.format), e.strictSizes !== void 0 && (e.width || e.height) && s.searchParams.set("func", e.strictSizes ? "bound" : "cover");
936
+ s.searchParams.delete("download"), e.width && s.searchParams.set("w", String(e.width)), e.height && s.searchParams.set("h", String(e.height)), e.quality != null && s.searchParams.set("q", String(e.quality)), e.format && s.searchParams.set("force_format", Pe[e.format] ?? e.format), e.strictSizes !== void 0 && (e.width || e.height) && s.searchParams.set("func", e.strictSizes ? "bound" : "cover");
935
937
  }
936
938
  function Te(s, e) {
937
939
  if (!e) return s;
@@ -984,7 +986,7 @@ function Ne(s, e = 240) {
984
986
  }
985
987
  return "";
986
988
  }
987
- const n = "https://scaleflex.cloudimg.io/v7/assets/file-types/v3/", Ie = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 48 48" fill="none"><path d="M24 4 42 14v20L24 44 6 34V14z" fill="#eef2ff" stroke="#6366f1" stroke-width="2" stroke-linejoin="round"/><path d="M24 4 42 14 24 24 6 14z" fill="#c7d2fe" stroke="#6366f1" stroke-width="2" stroke-linejoin="round"/><path d="M24 24v20M24 24 6 14M24 24 42 14" stroke="#6366f1" stroke-width="2" stroke-linejoin="round"/></svg>', v = `data:image/svg+xml,${encodeURIComponent(Ie)}`, E = {
989
+ const n = "https://scaleflex.cloudimg.io/v7/assets/file-types/v3/", Ie = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 48 48" fill="none"><path d="M24 4 42 14v20L24 44 6 34V14z" fill="#eef2ff" stroke="#6366f1" stroke-width="2" stroke-linejoin="round"/><path d="M24 4 42 14 24 24 6 14z" fill="#c7d2fe" stroke="#6366f1" stroke-width="2" stroke-linejoin="round"/><path d="M24 24v20M24 24 6 14M24 24 42 14" stroke="#6366f1" stroke-width="2" stroke-linejoin="round"/></svg>', v = `data:image/svg+xml,${encodeURIComponent(Ie)}`, P = {
988
990
  _default: n + "GENERIC.svg?vh=9a518a",
989
991
  // Images
990
992
  png: n + "PNG.svg?vh=96cd9a",
@@ -1094,11 +1096,11 @@ const n = "https://scaleflex.cloudimg.io/v7/assets/file-types/v3/", Ie = '<svg x
1094
1096
  dae: v
1095
1097
  };
1096
1098
  function Be() {
1097
- return E._default;
1099
+ return P._default;
1098
1100
  }
1099
1101
  function Ge(s) {
1100
1102
  const e = (s.split(".").pop() || "").toLowerCase();
1101
- return E[e] || E._default;
1103
+ return P[e] || P._default;
1102
1104
  }
1103
1105
  function We(s) {
1104
1106
  if (s == null || !Number.isFinite(s) || s < 0) return "—";
@@ -1129,7 +1131,7 @@ function He(s, e) {
1129
1131
  return i.cancel = () => clearTimeout(t), i;
1130
1132
  }
1131
1133
  export {
1132
- P as BrowseStore,
1134
+ E as BrowseStore,
1133
1135
  O as DamClient,
1134
1136
  Oe as LocalFavouritesAdapter,
1135
1137
  U as MAX_FAVOURITES,