@tryghost/kg-unsplash-selector 0.3.26 → 0.4.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.es.js CHANGED
@@ -54,69 +54,66 @@ var s = class {
54
54
  ...n,
55
55
  children: [e && r && /* @__PURE__ */ a(r, { className: `size-4 ${e === "heart" ? "fill-red" : ""} stroke-[3px] ${t && "mr-1"}` }), t && /* @__PURE__ */ a("span", { children: t })]
56
56
  });
57
- }, u = ({ payload: e, srcUrl: t, links: n, likes: r, user: i, alt: s, urls: c, height: u, width: d, zoomed: f, insertImage: p, selectImg: m }) => {
58
- let h = (t) => {
57
+ }, u = ({ payload: e, srcUrl: t, links: n, likes: r, user: i, alt: s, urls: c, height: u, width: d, zoomed: f, insertImage: p, selectImg: m }) => /* @__PURE__ */ o("div", {
58
+ className: `relative mb-6 block ${f ? "h-full w-[max-content] cursor-zoom-out" : "w-full cursor-zoom-in"}`,
59
+ style: { backgroundColor: e.color || "transparent" },
60
+ "data-kg-unsplash-gallery-item": !0,
61
+ onClick: (t) => {
59
62
  t.stopPropagation(), m(f ? null : e);
60
- };
61
- return /* @__PURE__ */ o("div", {
62
- className: `relative mb-6 block ${f ? "h-full w-[max-content] cursor-zoom-out" : "w-full cursor-zoom-in"}`,
63
- style: { backgroundColor: e.color || "transparent" },
64
- "data-kg-unsplash-gallery-item": !0,
65
- onClick: h,
66
- children: [/* @__PURE__ */ a("img", {
67
- alt: s,
68
- className: `${f ? "h-full w-auto object-contain" : "block h-auto"}`,
69
- height: u,
70
- loading: "lazy",
71
- src: t,
72
- width: d,
73
- "data-kg-unsplash-gallery-img": !0
63
+ },
64
+ children: [/* @__PURE__ */ a("img", {
65
+ alt: s,
66
+ className: `${f ? "h-full w-auto object-contain" : "block h-auto"}`,
67
+ height: u,
68
+ loading: "lazy",
69
+ src: t,
70
+ width: d,
71
+ "data-kg-unsplash-gallery-img": !0
72
+ }), /* @__PURE__ */ o("div", {
73
+ className: "absolute inset-0 flex flex-col justify-between bg-gradient-to-b from-black/5 via-black/5 to-black/30 p-5 opacity-0 transition-all ease-in-out hover:opacity-100",
74
+ children: [/* @__PURE__ */ o("div", {
75
+ className: "flex items-center justify-end gap-3",
76
+ children: [/* @__PURE__ */ a(l, {
77
+ "data-kg-button": "unsplash-like",
78
+ href: `${n.html}/?utm_source=ghost&utm_medium=referral&utm_campaign=api-credit`,
79
+ icon: "heart",
80
+ label: r.toString(),
81
+ rel: "noopener noreferrer",
82
+ target: "_blank"
83
+ }), /* @__PURE__ */ a(l, {
84
+ "data-kg-button": "unsplash-download",
85
+ href: `${n.download}/?utm_source=ghost&utm_medium=referral&utm_campaign=api-credit&force=true`,
86
+ icon: "download"
87
+ })]
74
88
  }), /* @__PURE__ */ o("div", {
75
- className: "absolute inset-0 flex flex-col justify-between bg-gradient-to-b from-black/5 via-black/5 to-black/30 p-5 opacity-0 transition-all ease-in-out hover:opacity-100",
89
+ className: "flex items-center justify-between",
76
90
  children: [/* @__PURE__ */ o("div", {
77
- className: "flex items-center justify-end gap-3",
78
- children: [/* @__PURE__ */ a(l, {
79
- "data-kg-button": "unsplash-like",
80
- href: `${n.html}/?utm_source=ghost&utm_medium=referral&utm_campaign=api-credit`,
81
- icon: "heart",
82
- label: r.toString(),
83
- rel: "noopener noreferrer",
84
- target: "_blank"
85
- }), /* @__PURE__ */ a(l, {
86
- "data-kg-button": "unsplash-download",
87
- href: `${n.download}/?utm_source=ghost&utm_medium=referral&utm_campaign=api-credit&force=true`,
88
- icon: "download"
89
- })]
90
- }), /* @__PURE__ */ o("div", {
91
- className: "flex items-center justify-between",
92
- children: [/* @__PURE__ */ o("div", {
93
- className: "flex items-center",
94
- children: [/* @__PURE__ */ a("img", {
95
- alt: "author",
96
- className: "mr-2 size-8 rounded-full",
97
- src: i.profile_image.medium
98
- }), /* @__PURE__ */ a("div", {
99
- className: "mr-2 truncate font-sans text-sm font-medium text-white",
100
- children: i.name
101
- })]
102
- }), /* @__PURE__ */ a(l, {
103
- label: "Insert image",
104
- "data-kg-unsplash-insert-button": !0,
105
- onClick: (e) => {
106
- e.stopPropagation(), p({
107
- src: c.regular.replace(/&w=1080/, "&w=2000"),
108
- caption: `<span>Photo by <a href="${i.links.html}">${i.name}</a> / <a href="https://unsplash.com/?utm_source=ghost&utm_medium=referral&utm_campaign=api-credit">Unsplash</a></span>`,
109
- height: u,
110
- width: d,
111
- alt: s,
112
- links: n
113
- });
114
- }
91
+ className: "flex items-center",
92
+ children: [/* @__PURE__ */ a("img", {
93
+ alt: "author",
94
+ className: "mr-2 size-8 rounded-full",
95
+ src: i.profile_image.medium
96
+ }), /* @__PURE__ */ a("div", {
97
+ className: "mr-2 truncate font-sans text-sm font-medium text-white",
98
+ children: i.name
115
99
  })]
100
+ }), /* @__PURE__ */ a(l, {
101
+ label: "Insert image",
102
+ "data-kg-unsplash-insert-button": !0,
103
+ onClick: (e) => {
104
+ e.stopPropagation(), p({
105
+ src: c.regular.replace(/&w=1080/, "&w=2000"),
106
+ caption: `<span>Photo by <a href="${i.links.html}">${i.name}</a> / <a href="https://unsplash.com/?utm_source=ghost&utm_medium=referral&utm_campaign=api-credit">Unsplash</a></span>`,
107
+ height: u,
108
+ width: d,
109
+ alt: s,
110
+ links: n
111
+ });
112
+ }
116
113
  })]
117
114
  })]
118
- });
119
- }, d = ({ payload: e, insertImage: t, selectImg: n, zoomed: r }) => /* @__PURE__ */ a("div", {
115
+ })]
116
+ }), d = ({ payload: e, insertImage: t, selectImg: n, zoomed: r }) => /* @__PURE__ */ a("div", {
120
117
  className: "flex h-full grow basis-0 justify-center",
121
118
  "data-kg-unsplash-zoomed": !0,
122
119
  onClick: () => n(null),
@@ -391,7 +388,8 @@ var s = class {
391
388
  this.photoUseCases = e, this.masonryService = t;
392
389
  }
393
390
  async loadNew() {
394
- this.photos = await this.photoUseCases.fetchPhotos(), await this.layoutPhotos();
391
+ let e = await this.photoUseCases.fetchPhotos();
392
+ this.photos = e, await this.layoutPhotos();
395
393
  }
396
394
  async layoutPhotos() {
397
395
  this.masonryService.reset(), this.photos && this.photos.forEach((e) => {
@@ -402,7 +400,8 @@ var s = class {
402
400
  return this.masonryService.getColumns();
403
401
  }
404
402
  async updateSearch(e) {
405
- this.photos = await this.photoUseCases.searchPhotos(e), this.layoutPhotos();
403
+ let t = await this.photoUseCases.searchPhotos(e);
404
+ this.photos = t, this.layoutPhotos();
406
405
  }
407
406
  async loadNextPage() {
408
407
  let e = await this.photoUseCases.fetchNextPage() || [];