@rslsp1/fa-app-tools 4.0.0 → 5.1.0

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/szenen.mjs CHANGED
@@ -102,13 +102,16 @@ import {
102
102
  freezeDraftChain,
103
103
  freezeSceneWorkingState,
104
104
  getSzenenSchemas,
105
+ gruppiereZuItems,
105
106
  hasPlacementCapability,
106
107
  isKnownElementType,
107
108
  isOk,
108
109
  isProjectionCurrent,
109
110
  isSzenenItemId,
110
111
  itemIdForRun,
112
+ ladeVorschauen,
111
113
  linkFor,
114
+ locatorTeile,
112
115
  logRevisionOf,
113
116
  mergeSzenenBatchOrigin,
114
117
  noticeFor,
@@ -145,7 +148,7 @@ import {
145
148
  validateElementVersion,
146
149
  validatePayload,
147
150
  withReference
148
- } from "./chunk-566GHYAT.mjs";
151
+ } from "./chunk-3MUI4ZV7.mjs";
149
152
  import {
150
153
  ContractViolation,
151
154
  STYLE_PAYLOAD,
@@ -749,15 +752,26 @@ function createMemoryViewPort(options = {}) {
749
752
  }
750
753
  };
751
754
  const bilder = /* @__PURE__ */ new Map();
755
+ const werke = [];
752
756
  for (const bild of options.images ?? []) {
753
757
  bilder.set(bild.mediaRef, { bild, data: "AAAA" });
758
+ werke.push({ itemRef: bild.mediaRef, title: bild.title, images: [bild] });
754
759
  }
760
+ for (const werk of options.imageItems ?? []) {
761
+ for (const bild of werk.images) bilder.set(bild.mediaRef, { bild, data: "AAAA" });
762
+ werke.push(werk);
763
+ }
764
+ const vorschauLazy = options.imagePreviewLazy === true;
755
765
  const imageLibraryPort = {
756
- async listImages(query) {
757
- const alle = [...bilder.values()].map((e) => e.bild);
766
+ async listItems(query) {
758
767
  const gesucht = query?.search?.trim().toLowerCase();
759
- const gefiltert = gesucht ? alle.filter((b) => b.title.toLowerCase().includes(gesucht)) : alle;
760
- return ok(query?.limit ? gefiltert.slice(0, query.limit) : gefiltert);
768
+ const gefiltert = gesucht ? werke.filter((w) => w.title.toLowerCase().includes(gesucht)) : werke;
769
+ const sichtbar = query?.limit ? gefiltert.slice(0, query.limit) : gefiltert;
770
+ if (!vorschauLazy) return ok(sichtbar);
771
+ return ok(sichtbar.map((w) => ({
772
+ ...w,
773
+ images: w.images.map((b) => ({ ...b, thumbUrl: null }))
774
+ })));
761
775
  },
762
776
  async resolveImage(mediaRef) {
763
777
  const eintrag = bilder.get(mediaRef);
@@ -775,9 +789,19 @@ function createMemoryViewPort(options = {}) {
775
789
  thumbUrl: null
776
790
  };
777
791
  bilder.set(mediaRef, { bild, data: input.data });
792
+ werke.unshift({ itemRef: mediaRef, title: bild.title, images: [bild] });
778
793
  return done(bild);
779
794
  }
780
795
  };
796
+ if (vorschauLazy) {
797
+ imageLibraryPort.loadPreview = async (mediaRef) => {
798
+ const eintrag = bilder.get(mediaRef);
799
+ if (!eintrag) {
800
+ return { kind: "error", message: `Bild ${mediaRef} ist unbekannt.`, retryable: false };
801
+ }
802
+ return ok(`data:${eintrag.bild.mimeType};base64,${eintrag.data}`);
803
+ };
804
+ }
781
805
  const batches = [...options.batches ?? []];
782
806
  const imageGenerationEvents = createInMemoryEventChannel();
783
807
  const imageBatchHistoryPort = {
@@ -1684,13 +1708,16 @@ export {
1684
1708
  freezeDraftChain,
1685
1709
  freezeSceneWorkingState,
1686
1710
  getSzenenSchemas,
1711
+ gruppiereZuItems,
1687
1712
  hasPlacementCapability,
1688
1713
  isKnownElementType,
1689
1714
  isOk,
1690
1715
  isProjectionCurrent,
1691
1716
  isSzenenItemId,
1692
1717
  itemIdForRun,
1718
+ ladeVorschauen,
1693
1719
  linkFor,
1720
+ locatorTeile,
1694
1721
  logRevisionOf,
1695
1722
  mergeSzenenBatchOrigin,
1696
1723
  noticeFor,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rslsp1/fa-app-tools",
3
- "version": "4.0.0",
3
+ "version": "5.1.0",
4
4
  "description": "Shared tools and hooks for Fine Art flow apps",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",