@orangelogic/design-system 3.11.0 → 3.12.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.
@@ -1,392 +0,0 @@
1
- import { c as b } from "./capitalize.CIBKBL10.js";
2
- import { C as A, T as g, U as M } from "./asset-link-format.ClaYu_v8.js";
3
- import { P as C } from "./position-picker.DjnhxIKF.js";
4
- const p = window.location.origin.includes("localhost:") ? "https://local.orangelogic.com" : window.location.origin;
5
- function at(t, i, e, l = p) {
6
- const s = new URL(l + "/" + t);
7
- return Array.isArray(e) ? e.forEach((a) => {
8
- a[1] && s.searchParams.append(a[0], a[1]);
9
- }) : e && Object.keys(e).forEach((a) => {
10
- e[a] && s.searchParams.append(a, e[a]);
11
- }), fetch(s, i);
12
- }
13
- const ot = "space-default";
14
- var L = /* @__PURE__ */ ((t) => (t.Desktop = "desktop", t.Mobile = "mobile", t.Tablet = "tablet", t))(L || {});
15
- const w = {
16
- canvasWidth: "",
17
- height: "",
18
- id: "desktop",
19
- maxWidth: "",
20
- name: b(
21
- "desktop"
22
- /* Desktop */
23
- )
24
- }, F = {
25
- canvasWidth: "770px",
26
- height: "",
27
- id: "tablet",
28
- maxWidth: "1280px",
29
- name: b(
30
- "tablet"
31
- /* Tablet */
32
- )
33
- }, W = {
34
- canvasWidth: "320px",
35
- height: "",
36
- id: "mobile",
37
- maxWidth: "480px",
38
- name: b(
39
- "mobile"
40
- /* Mobile */
41
- )
42
- }, rt = [w, F, W];
43
- var B = /* @__PURE__ */ ((t) => (t.All = "ALL", t.CanDelete = "CanDelete", t.CanDownload = "CanDownload", t.CanFind = "CanFind", t.CanManageRights = "CanManageRights", t.CanMove = "CanMove", t.CanRead = "CanRead", t.CanReadAll = "CanReadAll", t.CanReadAndWrite = "CanReadAndWrite", t.CanReadLarge = "CanReadLarge", t.CanReadMedium = "CanReadMedium", t.CanReadOriginal = "CanReadOriginal", t.CanShare = "CanShare", t.CanUpload = "CanUpload", t.CanWrite = "CanWrite", t.None = "NONE", t))(B || {}), U = /* @__PURE__ */ ((t) => (t.All = "all", t.Audio = "audio", t.Image = "image", t.Other = "other", t.Video = "video", t))(U || {}), D = /* @__PURE__ */ ((t) => (t.Content = "content", t.Template = "template", t))(D || {}), G = /* @__PURE__ */ ((t) => (t.Administrator = "Administrator", t.Designer = "Designer", t.Editor = "Editor", t))(G || {}), I = /* @__PURE__ */ ((t) => (t.Accordion = "BlockAccordion", t.Analytics = "BlockAnalytics", t.Audio = "BlockAudio", t.Button = "BlockButton", t.Carousel = "BlockCarousel", t.ColorSwatches = "BlockColorSwatches", t.Column = "BlockCell", t.ColumnGroup = "BlockColumns", t.DamView = "BlockDamView", t.Divider = "BlockDivider", t.DocumentViewer = "BlockDocumentViewer", t.FontKit = "BlockFontKit", t.Gallery = "BlockGallery", t.Header = "BlockHeader", t.Image = "BlockImage", t.RichText = "BlockRichText", t.SearchBox = "BlockSearchBox", t.TabGroup = "BlockTabs", t.Text = "BlockText", t.Timeline = "BlockTimeline", t.Video = "BlockVideo", t))(I || {});
44
- const st = Object.values(I).filter(
45
- (t) => t !== "BlockCell"
46
- /* Column */
47
- );
48
- var K = /* @__PURE__ */ ((t) => (t.Carousel = "carousel", t.Gallery = "gallery", t))(K || {}), V = /* @__PURE__ */ ((t) => (t.Templates = "TEMPLATES", t.TranslatableAttributes = "TRANSLATABLE_ATTRIBUTES", t.TranslatableTexts = "TRANSLATABLE_TEXTS", t))(V || {});
49
- const m = "/AssetLink/", X = {
50
- [C.BottomCenter]: A.South,
51
- [C.BottomLeft]: A.Southwest,
52
- [C.BottomRight]: A.Southeast,
53
- [C.CenterCenter]: A.Center,
54
- [C.CenterLeft]: A.West,
55
- [C.CenterRight]: A.East,
56
- [C.TopCenter]: A.North,
57
- [C.TopLeft]: A.Northwest,
58
- [C.TopRight]: A.Northeast
59
- }, v = "/t/", j = [400, 800, 1200, 1600, 2400], z = 0.15;
60
- function H({
61
- asset: t,
62
- baseUrl: i,
63
- extension: e,
64
- options: l,
65
- parameters: s,
66
- transformations: a,
67
- useSession: h = ""
68
- }) {
69
- if (i == null)
70
- return "";
71
- let r = i;
72
- const f = a?.findLast(
73
- (d) => d.key === g.Quality
74
- );
75
- if (f && (a = [
76
- ...a?.filter(
77
- (d) => d.key !== g.Quality
78
- ) || [],
79
- f
80
- ]), a) {
81
- const d = [];
82
- for (let n = 0; n < a.length; n++) {
83
- const u = a[n];
84
- if (u.key === g.Rotate) {
85
- let o = u.value.rotation ?? 0;
86
- for (; a[n + 1]?.key === g.Rotate; )
87
- n++, o += a[n].value.rotation ?? 0;
88
- o !== 0 && d.push({ key: g.Rotate, value: { rotation: o } });
89
- } else
90
- d.push(u);
91
- }
92
- a = d;
93
- }
94
- a && a.length > 0 && (r += "/t/"), a?.forEach(({ key: d, value: n }) => {
95
- if (d === g.Resize) {
96
- if (n.unit === M.AspectRatio && n.ratioWidth && n.ratioHeight) {
97
- r += `re_ar_${n.ratioWidth}:${n.ratioHeight}/`;
98
- return;
99
- }
100
- const u = [
101
- ...[
102
- {
103
- key: "re_w_",
104
- value: Math.round(n.width ?? 0)
105
- },
106
- {
107
- key: "re_h_",
108
- value: Math.round(n.height ?? 0)
109
- }
110
- ].filter((o) => o.value !== void 0).map((o) => ({
111
- key: o.key,
112
- value: Math.round(Number(o.value))
113
- })),
114
- {
115
- key: "re_rm_",
116
- value: "stretch"
117
- }
118
- ];
119
- u.forEach(({ key: o, value: _ }, $) => {
120
- r += `${o}${_}${$ < u.length - 1 ? "," : ""}`;
121
- }), r += "/";
122
- }
123
- if (d === g.Crop) {
124
- const u = n.unit === M.AspectRatio && !!n.ratioWidth && !!n.ratioHeight, o = !n.disabledSize && !u, _ = o && (n.x !== void 0 || n.y !== void 0), $ = [
125
- ...[
126
- {
127
- key: "c_",
128
- value: n.mode
129
- },
130
- ...u ? [
131
- {
132
- key: "ar_",
133
- value: `${n.ratioWidth}:${n.ratioHeight}`
134
- }
135
- ] : [],
136
- ...o ? [
137
- {
138
- key: "c_w_",
139
- value: Math.round(n.width ?? 0)
140
- },
141
- {
142
- key: "c_h_",
143
- value: Math.round(n.height ?? 0)
144
- },
145
- {
146
- key: "c_x_",
147
- value: Math.round(n.x ?? 0) === 0 && l?.omitZeroXY ? void 0 : Math.round(n.x ?? 0)
148
- },
149
- {
150
- key: "c_y_",
151
- value: Math.round(n.y ?? 0) === 0 && l?.omitZeroXY ? void 0 : Math.round(n.y ?? 0)
152
- }
153
- ] : [],
154
- ...!_ && n.focusMode && n.focusMode !== "manual" ? [
155
- {
156
- key: n.isFocusModeAuto ? "acm_" : "c_g_",
157
- value: n.focusMode
158
- }
159
- ] : [],
160
- ...!_ && n.focusMode === "manual" && n.position ? [
161
- {
162
- key: "c_g_",
163
- value: X[n.position]
164
- }
165
- ] : []
166
- ].filter((R) => R.value !== void 0 && R.value !== null).map((R) => ({
167
- key: R.key,
168
- value: R.value
169
- })),
170
- ...u ? [] : [
171
- {
172
- key: "c_whu_",
173
- value: "pixel"
174
- }
175
- ]
176
- ];
177
- $.forEach(({ key: R, value: k }, S) => {
178
- const y = ["c_w_", "c_h_", "c_x_", "c_y_"].includes(R);
179
- r += `${R}${y ? Math.round(Number(k)) : k}${S < $.length - 1 ? "," : ""}`;
180
- }), r += "/";
181
- }
182
- if (d === g.Rotate && ([
183
- {
184
- key: "r_a_",
185
- value: n.rotation
186
- }
187
- ].filter((o) => o.value !== void 0).map((o) => ({
188
- key: o.key,
189
- value: Math.round(Number(o.value))
190
- })).forEach(({ key: o, value: _ }) => {
191
- r += `${o}${_}`;
192
- }), r += "/"), d === g.Quality) {
193
- const u = [
194
- {
195
- key: "q_level_",
196
- value: n.quality
197
- }
198
- ].filter((o) => o.value !== void 0).map((o) => ({
199
- key: o.key,
200
- value: Math.round(Number(o.value))
201
- }));
202
- u.forEach(({ key: o, value: _ }, $) => {
203
- r += `${o}${_}${$ < u.length - 1 ? "," : ""}`;
204
- }), r += "/";
205
- }
206
- if (d === g.Metadata) {
207
- const u = [
208
- {
209
- key: "fl_keep_metadata",
210
- value: n.keepMetadata
211
- }
212
- ].filter((o) => o.value !== void 0).map((o) => ({ key: o.key, value: o.value }));
213
- u.forEach(({ key: o }, _) => {
214
- r += `${o}${_ < u.length - 1 ? "," : ""}`;
215
- }), r += "/";
216
- }
217
- }), e && (r += `${t?.identifier ?? crypto.randomUUID()}${e}`);
218
- const c = [];
219
- return s && s.length > 0 && s.forEach(({ key: d, value: n }) => {
220
- c.push(
221
- `${encodeURIComponent(d.trim())}=${encodeURIComponent(n.trim())}`
222
- );
223
- }), i && h && c.push(`UseSession=${encodeURIComponent(h)}`), c.length > 0 && (r += `?${c.join("&")}`), r.endsWith("/") && (r = r.slice(0, -1)), r;
224
- }
225
- function ct(t, i) {
226
- if (!t || !i?.length)
227
- return t;
228
- const e = H({ baseUrl: "", transformations: i }).replace(
229
- /\/t\//g,
230
- ""
231
- );
232
- if (!e)
233
- return t;
234
- const l = t.indexOf(m);
235
- if (l < 0)
236
- return `${t}/t/${e}`;
237
- const s = t.slice(0, l + m.length), a = t.slice(l + m.length), h = a.indexOf("/t/");
238
- if (h >= 0) {
239
- const f = a.slice(0, h);
240
- return `${s}${f}/t/${e}`;
241
- }
242
- const r = a.indexOf("/");
243
- if (r >= 0) {
244
- const f = a.slice(0, r), c = a.slice(r);
245
- return `${s}${f}/t/${e}${c}`;
246
- }
247
- return `${t}/t/${e}`;
248
- }
249
- function Y(t) {
250
- return `re_w_${Math.round(t)}`;
251
- }
252
- function q(t, i) {
253
- if (!t || !Number.isFinite(i) || i <= 0)
254
- return t;
255
- const e = t.indexOf(m);
256
- if (e < 0)
257
- return t;
258
- const l = Y(i), s = t.slice(0, e + m.length), a = t.slice(e + m.length), h = a.indexOf(v);
259
- if (h >= 0) {
260
- const f = a.slice(0, h), c = a.slice(
261
- h + v.length
262
- );
263
- return `${s}${f}${v}${l}/${c}`;
264
- }
265
- const r = a.indexOf("/");
266
- if (r >= 0) {
267
- const f = a.slice(0, r), c = a.slice(r);
268
- return `${s}${f}${v}${l}${c}`;
269
- }
270
- return `${s}${a}${v}${l}`;
271
- }
272
- function Q(t) {
273
- const i = t.indexOf(m);
274
- return i < 0 ? !1 : t.slice(i + m.length).includes(v);
275
- }
276
- const x = "TRX", T = "TR1", Z = /* @__PURE__ */ new Set([
277
- "avif",
278
- "bmp",
279
- "gif",
280
- "ico",
281
- "jpeg",
282
- "jpg",
283
- "png",
284
- "svg",
285
- "tif",
286
- "tiff",
287
- "webp"
288
- ]);
289
- function N(t) {
290
- if (!t)
291
- return "";
292
- const i = t.trim().toLowerCase();
293
- return i.startsWith(".") ? i.slice(1) : i;
294
- }
295
- function O(t) {
296
- return N(t) === "gif";
297
- }
298
- const J = 1e3 * 1024 * 1024, P = {
299
- b: 1,
300
- byte: 1,
301
- bytes: 1,
302
- gb: 1024 ** 3,
303
- kb: 1024,
304
- mb: 1024 ** 2,
305
- tb: 1024 ** 4
306
- };
307
- function tt(t) {
308
- if (typeof t == "number")
309
- return Number.isFinite(t) && t >= 0 ? t : void 0;
310
- if (!t)
311
- return;
312
- const i = /^\s*([\d.,]+)\s*([a-z]*)\s*$/i.exec(t);
313
- if (!i)
314
- return;
315
- const e = Number(i[1].replace(/,/g, ""));
316
- if (!Number.isFinite(e) || e < 0)
317
- return;
318
- const l = i[2].toLowerCase();
319
- if (!l)
320
- return e;
321
- const s = P[l];
322
- return s === void 0 ? void 0 : e * s;
323
- }
324
- function lt(t, i) {
325
- if (t)
326
- return;
327
- const e = typeof i == "number" ? i : Number(i ?? "");
328
- return Number.isFinite(e) && e > 0 ? e : void 0;
329
- }
330
- function dt(t, i) {
331
- if (!Z.has(N(t)))
332
- return T;
333
- const e = tt(i);
334
- return e !== void 0 && e > J ? T : x;
335
- }
336
- const E = ".auto";
337
- function ut(t, i = {}) {
338
- const e = t ? t.indexOf(m) : -1;
339
- if (e < 0 || i.format === x && O(i.extension))
340
- return t;
341
- const l = t.slice(e + m.length), s = l.slice(l.lastIndexOf("/") + 1);
342
- return s === "" || s.endsWith(E) ? t : `${t}${E}`;
343
- }
344
- function ft(t, i = {}) {
345
- if (!t.includes(m) || Q(t) || i.format === x && O(i.extension))
346
- return "";
347
- const { maxWidth: e, widths: l = j } = i, s = [...l].filter((c) => Number.isFinite(c) && c > 0).sort((c, d) => c - d);
348
- if (s.length === 0)
349
- return "";
350
- let a = s;
351
- if (e !== void 0 && Number.isFinite(e) && e > 0) {
352
- const c = s.filter((d) => d <= e);
353
- a = c.length > 0 ? c : [s[0]];
354
- }
355
- const h = e !== void 0 && Number.isFinite(e) && e > 0, f = (h ? a.filter(
356
- (c) => e > c * (1 + z)
357
- ) : a).map(
358
- (c) => `${q(t, c)} ${c}w`
359
- );
360
- return h && f.push(`${t} ${e}w`), f.join(", ");
361
- }
362
- function ht(t, i = 100) {
363
- return !Number.isFinite(t) || t <= 0 ? "" : `${Math.ceil(t / i) * i}px`;
364
- }
365
- export {
366
- U as A,
367
- I as B,
368
- L as D,
369
- D as E,
370
- B as P,
371
- ot as S,
372
- G as T,
373
- ct as a,
374
- ut as b,
375
- ft as c,
376
- lt as d,
377
- H as e,
378
- K as f,
379
- at as g,
380
- ht as h,
381
- V as i,
382
- st as j,
383
- rt as k,
384
- j as l,
385
- q as m,
386
- Q as n,
387
- T as o,
388
- J as p,
389
- tt as q,
390
- dt as r,
391
- E as s
392
- };