@orangelogic/design-system 2.192.0 → 2.194.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.
Files changed (27) hide show
  1. package/library/chunks/{asset-link-format.CDd4iPA2.js → asset-link-format.CODyaNDa.js} +937 -916
  2. package/library/chunks/{color-swatch-group.NOcRP-23.js → color-swatch-group.D1p1ayBo.js} +1 -1
  3. package/library/chunks/{document-viewer.CRluR-_W.js → document-viewer.DnowPH70.js} +2 -2
  4. package/library/chunks/{image.CiQwSDfe.js → image.BSvc6eti.js} +10 -6
  5. package/library/chunks/transformation.JkkMVin_.js +334 -0
  6. package/library/components/asset-link-format.js +2 -2
  7. package/library/components/atoms.js +2 -2
  8. package/library/components/color-swatch-group.js +1 -1
  9. package/library/components/document-viewer.js +2 -2
  10. package/library/components/image.js +1 -1
  11. package/library/components/masonry.js +119 -111
  12. package/library/components/organisms.js +2 -2
  13. package/library/components/types.js +15193 -15150
  14. package/library/components/video.js +1 -1
  15. package/library/package.json +1 -1
  16. package/library/packages/atoms/src/components/image/image.d.ts +2 -0
  17. package/library/packages/molecules/src/masonry/masonry.d.ts +1 -1
  18. package/library/packages/organisms/src/content-builder/blocks/image/image.d.ts +8 -0
  19. package/library/packages/organisms/src/content-builder-viewer/content-builder-viewer.d.ts +5 -5
  20. package/library/packages/services/src/api/asset/asset.d.ts +11 -3
  21. package/library/packages/types/src/gallery-item.d.ts +1 -0
  22. package/library/packages/types/src/masonry.d.ts +2 -0
  23. package/library/packages/utils/src/transformation/transformation.d.ts +55 -11
  24. package/library/react-web-component.d.ts +4 -4
  25. package/library/utils.js +89 -86
  26. package/package.json +1 -1
  27. package/library/chunks/transformation.BfIEi4p4.js +0 -300
@@ -1,300 +0,0 @@
1
- import { C as y, T as m, U as v } from "./asset-link-format.ClaYu_v8.js";
2
- import { P as $ } from "./position-picker.DjnhxIKF.js";
3
- const g = "/AssetLink/", N = {
4
- [$.BottomCenter]: y.South,
5
- [$.BottomLeft]: y.Southwest,
6
- [$.BottomRight]: y.Southeast,
7
- [$.CenterCenter]: y.Center,
8
- [$.CenterLeft]: y.West,
9
- [$.CenterRight]: y.East,
10
- [$.TopCenter]: y.North,
11
- [$.TopLeft]: y.Northwest,
12
- [$.TopRight]: y.Northeast
13
- }, p = "/t/", S = [400, 800, 1200, 1600, 2400];
14
- function O({
15
- asset: t,
16
- baseUrl: n,
17
- extension: s,
18
- options: f,
19
- parameters: c,
20
- transformations: r,
21
- useSession: a = ""
22
- }) {
23
- if (n == null)
24
- return "";
25
- let o = n;
26
- const h = r?.findLast(
27
- (d) => d.key === m.Quality
28
- );
29
- if (h && (r = [
30
- ...r?.filter(
31
- (d) => d.key !== m.Quality
32
- ) || [],
33
- h
34
- ]), r) {
35
- const d = [];
36
- for (let e = 0; e < r.length; e++) {
37
- const u = r[e];
38
- if (u.key === m.Rotate) {
39
- let i = u.value.rotation ?? 0;
40
- for (; r[e + 1]?.key === m.Rotate; )
41
- e++, i += r[e].value.rotation ?? 0;
42
- i !== 0 && d.push({ key: m.Rotate, value: { rotation: i } });
43
- } else
44
- d.push(u);
45
- }
46
- r = d;
47
- }
48
- r && r.length > 0 && (o += "/t/"), r?.forEach(({ key: d, value: e }) => {
49
- if (d === m.Resize) {
50
- if (e.unit === v.AspectRatio && e.ratioWidth && e.ratioHeight) {
51
- o += `re_ar_${e.ratioWidth}:${e.ratioHeight}/`;
52
- return;
53
- }
54
- const u = [
55
- ...[
56
- {
57
- key: "re_w_",
58
- value: Math.round(e.width ?? 0)
59
- },
60
- {
61
- key: "re_h_",
62
- value: Math.round(e.height ?? 0)
63
- }
64
- ].filter((i) => i.value !== void 0).map((i) => ({
65
- key: i.key,
66
- value: Math.round(Number(i.value))
67
- })),
68
- {
69
- key: "re_rm_",
70
- value: "stretch"
71
- }
72
- ];
73
- u.forEach(({ key: i, value: _ }, T) => {
74
- o += `${i}${_}${T < u.length - 1 ? "," : ""}`;
75
- }), o += "/";
76
- }
77
- if (d === m.Crop) {
78
- const u = e.unit === v.AspectRatio && !!e.ratioWidth && !!e.ratioHeight, i = !e.disabledSize && !u, _ = i && (e.x !== void 0 || e.y !== void 0), T = [
79
- ...[
80
- {
81
- key: "c_",
82
- value: e.mode
83
- },
84
- ...u ? [
85
- {
86
- key: "ar_",
87
- value: `${e.ratioWidth}:${e.ratioHeight}`
88
- }
89
- ] : [],
90
- ...i ? [
91
- {
92
- key: "c_w_",
93
- value: Math.round(e.width ?? 0)
94
- },
95
- {
96
- key: "c_h_",
97
- value: Math.round(e.height ?? 0)
98
- },
99
- {
100
- key: "c_x_",
101
- value: Math.round(e.x ?? 0) === 0 && f?.omitZeroXY ? void 0 : Math.round(e.x ?? 0)
102
- },
103
- {
104
- key: "c_y_",
105
- value: Math.round(e.y ?? 0) === 0 && f?.omitZeroXY ? void 0 : Math.round(e.y ?? 0)
106
- }
107
- ] : [],
108
- ...!_ && e.focusMode && e.focusMode !== "manual" ? [
109
- {
110
- key: e.isFocusModeAuto ? "acm_" : "c_g_",
111
- value: e.focusMode
112
- }
113
- ] : [],
114
- ...!_ && e.focusMode === "manual" && e.position ? [
115
- {
116
- key: "c_g_",
117
- value: N[e.position]
118
- }
119
- ] : []
120
- ].filter((k) => k.value !== void 0 && k.value !== null).map((k) => ({
121
- key: k.key,
122
- value: k.value
123
- })),
124
- ...u ? [] : [
125
- {
126
- key: "c_whu_",
127
- value: "pixel"
128
- }
129
- ]
130
- ];
131
- T.forEach(({ key: k, value: R }, b) => {
132
- const I = ["c_w_", "c_h_", "c_x_", "c_y_"].includes(k);
133
- o += `${k}${I ? Math.round(Number(R)) : R}${b < T.length - 1 ? "," : ""}`;
134
- }), o += "/";
135
- }
136
- if (d === m.Rotate && ([
137
- {
138
- key: "r_a_",
139
- value: e.rotation
140
- }
141
- ].filter((i) => i.value !== void 0).map((i) => ({
142
- key: i.key,
143
- value: Math.round(Number(i.value))
144
- })).forEach(({ key: i, value: _ }) => {
145
- o += `${i}${_}`;
146
- }), o += "/"), d === m.Quality) {
147
- const u = [
148
- {
149
- key: "q_level_",
150
- value: e.quality
151
- }
152
- ].filter((i) => i.value !== void 0).map((i) => ({
153
- key: i.key,
154
- value: Math.round(Number(i.value))
155
- }));
156
- u.forEach(({ key: i, value: _ }, T) => {
157
- o += `${i}${_}${T < u.length - 1 ? "," : ""}`;
158
- }), o += "/";
159
- }
160
- if (d === m.Metadata) {
161
- const u = [
162
- {
163
- key: "fl_keep_metadata",
164
- value: e.keepMetadata
165
- }
166
- ].filter((i) => i.value !== void 0).map((i) => ({ key: i.key, value: i.value }));
167
- u.forEach(({ key: i }, _) => {
168
- o += `${i}${_ < u.length - 1 ? "," : ""}`;
169
- }), o += "/";
170
- }
171
- }), s && (o += `${t?.identifier ?? crypto.randomUUID()}${s}`);
172
- const l = [];
173
- return c && c.length > 0 && c.forEach(({ key: d, value: e }) => {
174
- l.push(
175
- `${encodeURIComponent(d.trim())}=${encodeURIComponent(e.trim())}`
176
- );
177
- }), n && a && l.push(`UseSession=${encodeURIComponent(a)}`), l.length > 0 && (o += `?${l.join("&")}`), o.endsWith("/") && (o = o.slice(0, -1)), o;
178
- }
179
- function G(t, n) {
180
- if (!t || !n?.length)
181
- return t;
182
- const s = O({ baseUrl: "", transformations: n }).replace(
183
- /\/t\//g,
184
- ""
185
- );
186
- if (!s)
187
- return t;
188
- const f = t.indexOf(g);
189
- if (f < 0)
190
- return `${t}/t/${s}`;
191
- const c = t.slice(0, f + g.length), r = t.slice(f + g.length), a = r.indexOf("/t/");
192
- if (a >= 0) {
193
- const h = r.slice(0, a);
194
- return `${c}${h}/t/${s}`;
195
- }
196
- const o = r.indexOf("/");
197
- if (o >= 0) {
198
- const h = r.slice(0, o), l = r.slice(o);
199
- return `${c}${h}/t/${s}${l}`;
200
- }
201
- return `${t}/t/${s}`;
202
- }
203
- function E(t) {
204
- return `re_w_${Math.round(t)}`;
205
- }
206
- function C(t, n) {
207
- if (!t || !Number.isFinite(n) || n <= 0)
208
- return t;
209
- const s = t.indexOf(g);
210
- if (s < 0)
211
- return t;
212
- const f = E(n), c = t.slice(0, s + g.length), r = t.slice(s + g.length), a = r.indexOf(p);
213
- if (a >= 0) {
214
- const h = r.slice(0, a), l = r.slice(
215
- a + p.length
216
- );
217
- return `${c}${h}${p}${f}/${l}`;
218
- }
219
- const o = r.indexOf("/");
220
- if (o >= 0) {
221
- const h = r.slice(0, o), l = r.slice(o);
222
- return `${c}${h}${p}${f}${l}`;
223
- }
224
- return `${c}${r}${p}${f}`;
225
- }
226
- function F(t) {
227
- const n = t.indexOf(g);
228
- return n < 0 ? !1 : t.slice(n + g.length).includes(p);
229
- }
230
- const x = "TRX", M = "TR1", L = /* @__PURE__ */ new Set(["gif", "png", "tif", "tiff"]);
231
- function A(t) {
232
- if (!t)
233
- return "";
234
- const n = t.trim().toLowerCase();
235
- return n.startsWith(".") ? n.slice(1) : n;
236
- }
237
- function W(t) {
238
- return A(t) === "gif";
239
- }
240
- const U = 10 * 1024 * 1024, w = {
241
- b: 1,
242
- byte: 1,
243
- bytes: 1,
244
- gb: 1024 ** 3,
245
- kb: 1024,
246
- mb: 1024 ** 2,
247
- tb: 1024 ** 4
248
- };
249
- function B(t) {
250
- if (typeof t == "number")
251
- return Number.isFinite(t) && t >= 0 ? t : void 0;
252
- if (!t)
253
- return;
254
- const n = /^\s*([\d.,]+)\s*([a-z]*)\s*$/i.exec(t);
255
- if (!n)
256
- return;
257
- const s = Number(n[1].replace(/,/g, ""));
258
- if (!Number.isFinite(s) || s < 0)
259
- return;
260
- const f = n[2].toLowerCase();
261
- if (!f)
262
- return s;
263
- const c = w[f];
264
- return c === void 0 ? void 0 : s * c;
265
- }
266
- function X(t, n) {
267
- if (!L.has(A(t)))
268
- return M;
269
- const s = B(n);
270
- return s !== void 0 && s > U ? M : x;
271
- }
272
- function Y(t, n = {}) {
273
- if (!t.includes(g) || F(t) || n.format === x && W(n.extension))
274
- return "";
275
- const { maxWidth: s, widths: f = S } = n, c = [...f].filter((a) => Number.isFinite(a) && a > 0).sort((a, o) => a - o);
276
- if (c.length === 0)
277
- return "";
278
- let r = c;
279
- if (s !== void 0 && Number.isFinite(s) && s > 0) {
280
- const a = c.filter((o) => o <= s);
281
- r = a.length > 0 ? a : [c[0]];
282
- }
283
- return r.map((a) => `${C(t, a)} ${a}w`).join(", ");
284
- }
285
- function D(t, n = 100) {
286
- return !Number.isFinite(t) || t <= 0 ? "" : `${Math.ceil(t / n) * n}px`;
287
- }
288
- export {
289
- M as A,
290
- S,
291
- G as a,
292
- Y as b,
293
- O as c,
294
- D as d,
295
- C as e,
296
- U as f,
297
- F as h,
298
- B as p,
299
- X as r
300
- };