@falcon-ui/falcon-ui 1.0.0 → 1.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.
Files changed (51) hide show
  1. package/README.md +1 -0
  2. package/THIRD_PARTY_NOTICES.md +51 -0
  3. package/cjs/components/index.cjs +1131 -4
  4. package/cjs/components/index.cjs.map +1 -1
  5. package/cjs/components/loading/index.cjs +1186 -0
  6. package/cjs/components/loading/index.cjs.map +1 -0
  7. package/cjs/components/loading/src/loading.cjs +72 -0
  8. package/cjs/components/loading/src/loading.cjs.map +1 -0
  9. package/cjs/index.cjs +1132 -4
  10. package/cjs/index.cjs.map +1 -1
  11. package/esm/components/index.mjs +1130 -6
  12. package/esm/components/index.mjs.map +1 -1
  13. package/esm/components/loading/index.mjs +1179 -0
  14. package/esm/components/loading/index.mjs.map +1 -0
  15. package/esm/components/loading/src/loading.mjs +66 -0
  16. package/esm/components/loading/src/loading.mjs.map +1 -0
  17. package/esm/index.mjs +1131 -6
  18. package/esm/index.mjs.map +1 -1
  19. package/global.d.ts +2 -0
  20. package/package.json +7 -1
  21. package/theme/index.css +1 -1
  22. package/theme/index.scss +1 -0
  23. package/theme/src/loading.scss +52 -0
  24. package/types/components/barcode/index.d.ts +1 -1
  25. package/types/components/barcode/src/barcode.vue.d.ts +1 -1
  26. package/types/components/index.d.ts +2 -0
  27. package/types/components/input/index.d.ts +1 -1
  28. package/types/components/input/src/input.vue.d.ts +1 -1
  29. package/types/components/input-number/index.d.ts +3 -3
  30. package/types/components/input-number/src/input-number.vue.d.ts +1 -1
  31. package/types/components/loading/index.d.ts +183 -0
  32. package/types/components/loading/src/FlLoading.vue.d.ts +109 -0
  33. package/types/components/loading/src/animations/composing.d.ts +2 -0
  34. package/types/components/loading/src/animations/earth.d.ts +12 -0
  35. package/types/components/loading/src/animations/listening.d.ts +2 -0
  36. package/types/components/loading/src/animations/searching.d.ts +2 -0
  37. package/types/components/loading/src/animations/shaping.d.ts +2 -0
  38. package/types/components/loading/src/animations/solving.d.ts +2 -0
  39. package/types/components/loading/src/animations/working.d.ts +2 -0
  40. package/types/components/loading/src/earth-points.d.ts +22 -0
  41. package/types/components/loading/src/loading-frame.d.ts +4 -0
  42. package/types/components/loading/src/loading-geometry.d.ts +66 -0
  43. package/types/components/loading/src/loading-presets.d.ts +6 -0
  44. package/types/components/loading/src/loading-profiles.d.ts +7 -0
  45. package/types/components/loading/src/loading-renderer.d.ts +4 -0
  46. package/types/components/loading/src/loading.d.ts +65 -0
  47. package/types/components/loading/src/use-fl-loading.d.ts +15 -0
  48. package/types/components/loading/src/use-loading-animation.d.ts +13 -0
  49. package/types/components/loading/src/use-loading-color.d.ts +6 -0
  50. package/umd/falcon-ui.umd.js +1137 -7
  51. package/umd/falcon-ui.umd.js.map +1 -1
package/esm/index.mjs CHANGED
@@ -1,8 +1,1132 @@
1
1
  import { n as __toDynamicImportESM, r as __toESM, t as __commonJSMin } from "./chunk-BuRq7rDw.js";
2
2
  import { a as useDialog, c as useMergedExpose, d as mergeComponentExpose, f as useNamespace, i as open, l as withInstall, n as FlButton, o as useClearableState, r as closeAll, s as useMergedAttrs, t as dialog_default, u as invokeListener } from "./dialog-Cm3Px-Bu.js";
3
- import { Comment, Fragment, Text, Transition, cloneVNode, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createSlots, createTextVNode, createVNode, defineComponent, getCurrentInstance, guardReactiveProps, h, isVNode, mergeProps, nextTick, normalizeClass, normalizeProps, normalizeStyle, onBeforeUnmount, onMounted, onUnmounted, openBlock, ref, renderList, renderSlot, resolveComponent, resolveDynamicComponent, shallowRef, toDisplayString, toRef, unref, useAttrs, useSlots, useTemplateRef, watch, withCtx, withKeys, withModifiers } from "vue";
3
+ import { Comment, Fragment, Text, Transition, cloneVNode, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createSlots, createTextVNode, createVNode, defineComponent, getCurrentInstance, guardReactiveProps, h, isVNode, mergeProps, nextTick, normalizeClass, normalizeProps, normalizeStyle, onActivated, onBeforeUnmount, onDeactivated, onMounted, onScopeDispose, onUnmounted, openBlock, ref, renderList, renderSlot, resolveComponent, resolveDynamicComponent, shallowRef, toDisplayString, toRef, toValue, unref, useAttrs, useSlots, useTemplateRef, vShow, watch, withCtx, withDirectives, withKeys, withModifiers } from "vue";
4
4
  import { ElCheckbox, ElDatePicker, ElIcon, ElInput, ElSelect, ElTable, ElTreeSelect, useGlobalSize } from "element-plus";
5
5
  import { CaretBottom, CaretRight, Folder, FolderOpened, Loading, Search } from "@element-plus/icons-vue";
6
+ const flLoadingAnimations = [
7
+ "working",
8
+ "searching",
9
+ "solving",
10
+ "listening",
11
+ "composing",
12
+ "shaping",
13
+ "earth"
14
+ ];
15
+ const flLoadingSizes = [
16
+ 20,
17
+ 32,
18
+ 48,
19
+ 64,
20
+ 96
21
+ ];
22
+ const flLoadingProps = {
23
+ active: {
24
+ type: Boolean,
25
+ default: true
26
+ },
27
+ animation: {
28
+ type: String,
29
+ default: "searching",
30
+ validator: (v) => flLoadingAnimations.includes(v)
31
+ },
32
+ size: {
33
+ type: Number,
34
+ default: 64,
35
+ validator: (v) => flLoadingSizes.includes(v)
36
+ },
37
+ color: {
38
+ type: String,
39
+ default: ""
40
+ },
41
+ theme: {
42
+ type: String,
43
+ default: "auto"
44
+ },
45
+ speed: {
46
+ type: Number,
47
+ default: 1
48
+ },
49
+ paused: {
50
+ type: Boolean,
51
+ default: false
52
+ },
53
+ text: {
54
+ type: String,
55
+ default: ""
56
+ },
57
+ layout: {
58
+ type: String,
59
+ default: "inline"
60
+ },
61
+ ariaLabel: {
62
+ type: String,
63
+ default: "加载中"
64
+ }
65
+ };
66
+ const normalizeAnimation = (v) => flLoadingAnimations.includes(v) ? v : "searching";
67
+ const normalizeSize = (v) => flLoadingSizes.includes(v) ? v : 64;
68
+ const normalizeSpeed = (v) => Number.isFinite(v) ? Math.max(.25, Math.min(3, v)) : 1;
69
+ function useLoadingColor(host, options) {
70
+ const color = ref("#20252b");
71
+ let mounted = false;
72
+ let observer;
73
+ let media;
74
+ let probe;
75
+ let observedHost;
76
+ const resolve = () => {
77
+ if (!mounted) return;
78
+ const target = host() || document.documentElement;
79
+ if (target !== observedHost) {
80
+ observer?.disconnect();
81
+ probe?.remove();
82
+ probe = document.createElement("span");
83
+ probe.setAttribute("aria-hidden", "true");
84
+ probe.style.cssText = "position:absolute;visibility:hidden;pointer-events:none;width:0;height:0;overflow:hidden";
85
+ target.appendChild(probe);
86
+ for (let el = target; el; el = el.parentElement) observer?.observe(el, {
87
+ attributes: true,
88
+ attributeFilter: [
89
+ "class",
90
+ "style",
91
+ "data-theme"
92
+ ]
93
+ });
94
+ observedHost = target;
95
+ }
96
+ const { color: explicit, theme = "auto" } = options();
97
+ let dark = theme === "dark";
98
+ if (theme === "auto") {
99
+ dark = media?.matches ?? false;
100
+ for (let el = target; el; el = el.parentElement) {
101
+ const marker = el.dataset.theme;
102
+ if (marker === "dark" || marker === "light") {
103
+ dark = marker === "dark";
104
+ break;
105
+ }
106
+ if (el.classList.contains("dark") || el.classList.contains("light")) {
107
+ dark = el.classList.contains("dark");
108
+ break;
109
+ }
110
+ }
111
+ }
112
+ const variable = getComputedStyle(target).getPropertyValue("--fl-loading-color").trim();
113
+ const fallback = dark ? "#f0f3f7" : "#20252b";
114
+ if (probe) {
115
+ probe.style.color = fallback;
116
+ if (explicit || variable) probe.style.color = explicit || variable;
117
+ color.value = getComputedStyle(probe).color || fallback;
118
+ }
119
+ };
120
+ watch([
121
+ host,
122
+ () => options().color,
123
+ () => options().theme
124
+ ], resolve, { flush: "post" });
125
+ onMounted(() => {
126
+ mounted = true;
127
+ media = window.matchMedia?.("(prefers-color-scheme: dark)");
128
+ observer = typeof MutationObserver === "undefined" ? void 0 : new MutationObserver(resolve);
129
+ media?.addEventListener("change", resolve);
130
+ resolve();
131
+ });
132
+ onScopeDispose(() => {
133
+ mounted = false;
134
+ observer?.disconnect();
135
+ media?.removeEventListener("change", resolve);
136
+ probe?.remove();
137
+ });
138
+ return color;
139
+ }
140
+ var COUNT_PAIRS = [
141
+ ["latRings", "lonDensity"],
142
+ ["rings", "lonDensity"],
143
+ ["lanes", "segs"]
144
+ ];
145
+ var COUNT_KEYS = [
146
+ "orbitN",
147
+ "ghostN",
148
+ "nodeN",
149
+ "strandN",
150
+ "signals"
151
+ ];
152
+ var ICON_DENSITY_KEYS = ["iconD"];
153
+ var RADIUS_KEYS = [
154
+ "rBase",
155
+ "rDepth",
156
+ "rActive",
157
+ "rDot",
158
+ "ghostR",
159
+ "partR",
160
+ "partRDepth",
161
+ "nodeR",
162
+ "nodeRDepth"
163
+ ];
164
+ function scaleCounts(opts, scale) {
165
+ const out = { ...opts };
166
+ const done = /* @__PURE__ */ new Set();
167
+ const rt = Math.sqrt(scale);
168
+ for (const [a, b] of COUNT_PAIRS) {
169
+ const va = out[a];
170
+ const vb = out[b];
171
+ if (va != null && vb != null && !done.has(a) && !done.has(b)) {
172
+ out[a] = Math.max(2, Math.round(va * rt));
173
+ out[b] = Math.max(2, Math.round(vb * rt));
174
+ done.add(a);
175
+ done.add(b);
176
+ }
177
+ }
178
+ for (const k of COUNT_KEYS) {
179
+ const v = out[k];
180
+ if (v != null && v !== 0 && !done.has(k)) out[k] = Math.max(1, Math.round(v * scale));
181
+ }
182
+ for (const k of ICON_DENSITY_KEYS) {
183
+ const v = out[k];
184
+ if (v != null) out[k] = Math.max(.02, v * scale);
185
+ }
186
+ return out;
187
+ }
188
+ function scaleRadii(opts, scale) {
189
+ const out = { ...opts };
190
+ for (const k of RADIUS_KEYS) {
191
+ const v = out[k];
192
+ if (v != null) out[k] = v * scale;
193
+ }
194
+ out.rSizeMul = (out.rSizeMul ?? 1) * scale;
195
+ return out;
196
+ }
197
+ const BASE_PROFILES = {
198
+ globe: {
199
+ latRings: 17,
200
+ lonDensity: 44,
201
+ rBase: .6,
202
+ rDepth: 1.7,
203
+ rBoost: 1,
204
+ inkFar: .62,
205
+ inkSpan: .54,
206
+ rsPow: .6,
207
+ rMin: .3
208
+ },
209
+ orbits: {
210
+ orbitN: 12,
211
+ ghostN: 40,
212
+ ghostR: .9,
213
+ ghostA: .5,
214
+ particles: 3,
215
+ partR: 1.2,
216
+ partRDepth: 1.6,
217
+ rsPow: .6,
218
+ rMin: .3
219
+ },
220
+ rubik: {
221
+ latRings: 15,
222
+ lonDensity: 40,
223
+ moveCount: 14,
224
+ rBase: .6,
225
+ rDepth: 1.7,
226
+ rActive: .3,
227
+ inkFar: .62,
228
+ inkSpan: .54,
229
+ rsPow: .6,
230
+ rMin: .3
231
+ },
232
+ wave: {
233
+ rings: 15,
234
+ lonDensity: 40,
235
+ rBase: .6,
236
+ rDepth: 1.7,
237
+ rsPow: .6,
238
+ rMin: .3
239
+ },
240
+ web: {
241
+ nodeN: 30,
242
+ thr: .72,
243
+ signals: 5,
244
+ nodeR: 1.4,
245
+ nodeRDepth: 1.8,
246
+ lineW: .8,
247
+ rsPow: .6,
248
+ rMin: .3
249
+ },
250
+ braid: {
251
+ strandN: 52,
252
+ turns: 3,
253
+ ghostN: 150,
254
+ rBase: 1.2,
255
+ rDepth: 1.8,
256
+ rsPow: .6,
257
+ rMin: .3
258
+ },
259
+ ribbon: {
260
+ lanes: 5,
261
+ segs: 88,
262
+ ghostN: 150,
263
+ rBase: 1.1,
264
+ rDepth: 1.7,
265
+ rsPow: .6,
266
+ rMin: .3
267
+ },
268
+ ring: {
269
+ lanes: 5,
270
+ segs: 88,
271
+ ghostN: 0,
272
+ faceOn: 1,
273
+ rBase: 1.1,
274
+ rDepth: 1.7,
275
+ rsPow: .6,
276
+ rMin: .3
277
+ },
278
+ morph: {
279
+ rDot: .021,
280
+ iconD: 1,
281
+ rMin: .25
282
+ }
283
+ };
284
+ var presets = {
285
+ working: [
286
+ "orbits",
287
+ 1.885,
288
+ 1,
289
+ 1,
290
+ 3.9,
291
+ .238,
292
+ 2.4
293
+ ],
294
+ searching: [
295
+ "globe",
296
+ 2.015,
297
+ .42,
298
+ 1.15,
299
+ 2.665,
300
+ .105,
301
+ 1.75
302
+ ],
303
+ solving: [
304
+ "rubik",
305
+ 1.82,
306
+ .35,
307
+ 1.05,
308
+ 1.95,
309
+ .088,
310
+ 1.9
311
+ ],
312
+ listening: [
313
+ "wave",
314
+ 4.388,
315
+ .341,
316
+ 1,
317
+ 3.998,
318
+ .105,
319
+ 1.6
320
+ ],
321
+ composing: [
322
+ "ribbon",
323
+ 2.34,
324
+ .25,
325
+ .85,
326
+ 3.12,
327
+ .051,
328
+ 1.073
329
+ ],
330
+ shaping: [
331
+ "morph",
332
+ 2.405,
333
+ .702,
334
+ .395,
335
+ 2.08,
336
+ .53,
337
+ 1.011
338
+ ]
339
+ };
340
+ var cache$1 = /* @__PURE__ */ new Map();
341
+ function resolvePreset(animation, size) {
342
+ const key = `${animation}-${size}`;
343
+ const hit = cache$1.get(key);
344
+ if (hit) return hit;
345
+ if (animation === "earth") return {
346
+ speed: 1,
347
+ opts: {}
348
+ };
349
+ const [mode, bigSpeed, bigCount, bigRadius, smallSpeed, smallCount, smallRadius] = presets[animation];
350
+ const blend = Math.max(0, Math.min(1, (size - 20) / 44));
351
+ const count = smallCount + (bigCount - smallCount) * blend;
352
+ const radius = smallRadius + (bigRadius - smallRadius) * blend;
353
+ let opts = scaleRadii(scaleCounts(BASE_PROFILES[mode], count), radius);
354
+ if (animation === "searching") opts = {
355
+ ...opts,
356
+ scanMul: 4.08,
357
+ dimBase: .45
358
+ };
359
+ if (animation === "composing") opts = {
360
+ ...opts,
361
+ spin: 0,
362
+ bandMul: 3.9,
363
+ wobMul: 1
364
+ };
365
+ if (animation === "shaping") opts = {
366
+ ...opts,
367
+ spread: 1.45
368
+ };
369
+ const resolved = {
370
+ speed: smallSpeed + (bigSpeed - smallSpeed) * blend,
371
+ opts
372
+ };
373
+ cache$1.set(key, resolved);
374
+ return resolved;
375
+ }
376
+ function hashD(a, b) {
377
+ const h$1 = Math.sin(a * 12.9898 + b * 78.233) * 43758.5453;
378
+ return h$1 - Math.floor(h$1);
379
+ }
380
+ function fibDir(i, n) {
381
+ const golden = Math.PI * (3 - Math.sqrt(5));
382
+ const y = 1 - 2 * (i + .5) / n;
383
+ const rad = Math.sqrt(1 - y * y);
384
+ const a = i * golden;
385
+ return [
386
+ rad * Math.cos(a),
387
+ y,
388
+ rad * Math.sin(a)
389
+ ];
390
+ }
391
+ function angleDelta(a, b) {
392
+ return Math.atan2(Math.sin(a - b), Math.cos(a - b));
393
+ }
394
+ function makeProj(yaw, tilt, cx, cy, scale) {
395
+ const st = Math.sin(tilt);
396
+ const ct = Math.cos(tilt);
397
+ const sy = Math.sin(yaw);
398
+ const cyw = Math.cos(yaw);
399
+ return (x, y, z) => {
400
+ const x1 = x * cyw + z * sy;
401
+ const z1 = -x * sy + z * cyw;
402
+ const y1 = y * ct - z1 * st;
403
+ const z2 = y * st + z1 * ct;
404
+ return [
405
+ cx + x1 * scale,
406
+ cy - y1 * scale,
407
+ z2
408
+ ];
409
+ };
410
+ }
411
+ function finalizeFrame(dots, lines, rMin = .3) {
412
+ const visible = [];
413
+ for (const d of dots) {
414
+ if ((d.a ?? 1) < .02) continue;
415
+ d.r = Math.max(rMin, d.r);
416
+ visible.push(d);
417
+ }
418
+ visible.sort((a, b) => a.z - b.z);
419
+ return {
420
+ dots: visible,
421
+ lines: lines.filter((l) => (l.a ?? 1) >= .02)
422
+ };
423
+ }
424
+ function radiusScale(size, pow) {
425
+ return (size / 300) ** pow;
426
+ }
427
+ const frameGlobe = (size, t, o) => {
428
+ const spin = .5;
429
+ const cx = size / 2;
430
+ const cy = size / 2;
431
+ const radius = size / 2 * .82;
432
+ const tilt = .4 + .06 * Math.sin(t * .35);
433
+ const pt = makeProj(t * spin, tilt, cx, cy, radius);
434
+ const scan = t * (spin + (1.7 - spin) * (o.scanMul ?? 1));
435
+ const rs = radiusScale(size, o.rsPow ?? .6);
436
+ const dimBase = o.dimBase ?? 1;
437
+ const dots = [];
438
+ const latRings = o.latRings ?? 17;
439
+ const lonDensity = o.lonDensity ?? 44;
440
+ for (let li = 0; li <= latRings; li++) {
441
+ const lat = -Math.PI / 2 + li / latRings * Math.PI;
442
+ const cosLat = Math.cos(lat);
443
+ const sinLat = Math.sin(lat);
444
+ const lonCount = Math.max(1, Math.round(Math.abs(cosLat) * lonDensity));
445
+ for (let lj = 0; lj < lonCount; lj++) {
446
+ const lon = lj / lonCount * 2 * Math.PI;
447
+ const [px, py, z] = pt(cosLat * Math.cos(lon), sinLat, cosLat * Math.sin(lon));
448
+ const depth = (z + 1) / 2;
449
+ const d = angleDelta(lon + t * spin, scan);
450
+ const boost = Math.exp(-(d * d) / .18) * Math.max(0, z);
451
+ dots.push({
452
+ x: px,
453
+ y: py,
454
+ z,
455
+ r: ((o.rBase ?? .6) + (o.rDepth ?? 1.7) * depth + (o.rBoost ?? 1) * boost) * rs,
456
+ white: (o.inkFar ?? .62) - (o.inkSpan ?? .54) * depth,
457
+ a: dimBase + (1 - dimBase) * Math.min(1, boost)
458
+ });
459
+ }
460
+ }
461
+ return finalizeFrame(dots, [], o.rMin);
462
+ };
463
+ function solveCycle(time, count, slotDur, rest) {
464
+ const tc = time % (2 * count * slotDur + rest);
465
+ const amount = new Array(count).fill(0);
466
+ let active = -1;
467
+ if (tc < 2 * count * slotDur) {
468
+ const slot = Math.floor(tc / slotDur);
469
+ const p = (tc - slot * slotDur) / slotDur;
470
+ const ep = 1 - (1 - Math.min(1, p / .7)) ** 3;
471
+ if (slot < count) {
472
+ for (let i = 0; i < slot; i++) amount[i] = 1;
473
+ amount[slot] = ep;
474
+ active = slot;
475
+ } else {
476
+ const u = 2 * count - 1 - slot;
477
+ for (let i = 0; i < u; i++) amount[i] = 1;
478
+ amount[u] = 1 - ep;
479
+ active = u;
480
+ }
481
+ }
482
+ return {
483
+ amount,
484
+ active
485
+ };
486
+ }
487
+ function applyMoves(pt3, moves, sc) {
488
+ let [x, y, z] = pt3;
489
+ let inActive = false;
490
+ for (let i = 0; i < moves.length; i++) {
491
+ if (sc.amount[i] <= 0) continue;
492
+ const mv = moves[i];
493
+ const coord = mv.axis === 0 ? x : mv.axis === 1 ? y : z;
494
+ if (coord < mv.lo || coord >= mv.hi) continue;
495
+ if (i === sc.active) inActive = true;
496
+ const a = mv.ang * sc.amount[i];
497
+ const ca = Math.cos(a);
498
+ const sa = Math.sin(a);
499
+ if (mv.axis === 0) {
500
+ const y2 = y * ca - z * sa;
501
+ z = y * sa + z * ca;
502
+ y = y2;
503
+ } else if (mv.axis === 1) {
504
+ const x2 = x * ca + z * sa;
505
+ z = -x * sa + z * ca;
506
+ x = x2;
507
+ } else {
508
+ const x2 = x * ca - y * sa;
509
+ y = x * sa + y * ca;
510
+ x = x2;
511
+ }
512
+ }
513
+ return [
514
+ x,
515
+ y,
516
+ z,
517
+ inActive
518
+ ];
519
+ }
520
+ function makeMoves(count) {
521
+ const moves = [];
522
+ for (let i = 0; i < count; i++) {
523
+ const axis = Math.min(2, Math.floor(hashD(i, 2.3) * 3));
524
+ const lo = -1 + .5 * Math.min(3, Math.floor(hashD(i, 5.9) * 4));
525
+ const dir = hashD(i, 7.7) < .5 ? 1 : -1;
526
+ moves.push({
527
+ axis,
528
+ lo,
529
+ hi: lo + .5,
530
+ ang: dir * Math.PI / 2
531
+ });
532
+ }
533
+ return moves;
534
+ }
535
+ const frameRubik = (size, t, o) => {
536
+ const cx = size / 2;
537
+ const cy = size / 2;
538
+ const R = size / 2 * .82;
539
+ const pt = makeProj(t * .55, .35 + .1 * Math.sin(t * .9), cx, cy, R);
540
+ const rs = radiusScale(size, o.rsPow ?? .6);
541
+ const moveCount = o.moveCount ?? 14;
542
+ const moves = makeMoves(moveCount);
543
+ const sc = solveCycle(t, moveCount, .42, 1.2);
544
+ const dots = [];
545
+ const latRings = o.latRings ?? 15;
546
+ const lonDensity = o.lonDensity ?? 40;
547
+ for (let li = 0; li <= latRings; li++) {
548
+ const lat = -Math.PI / 2 + li / latRings * Math.PI;
549
+ const cosLat = Math.cos(lat);
550
+ const sinLat = Math.sin(lat);
551
+ const lonCount = Math.max(1, Math.round(Math.abs(cosLat) * lonDensity));
552
+ for (let lj = 0; lj < lonCount; lj++) {
553
+ const lon = lj / lonCount * 2 * Math.PI;
554
+ const [x, y, z, inActive] = applyMoves([
555
+ cosLat * Math.cos(lon),
556
+ sinLat,
557
+ cosLat * Math.sin(lon)
558
+ ], moves, sc);
559
+ const [px, py, zr] = pt(x, y, z);
560
+ const depth = (zr + 1) / 2;
561
+ dots.push({
562
+ x: px,
563
+ y: py,
564
+ z: zr,
565
+ r: ((o.rBase ?? .6) + (o.rDepth ?? 1.7) * depth + (inActive ? o.rActive ?? .3 : 0)) * rs,
566
+ white: (o.inkFar ?? .62) - (o.inkSpan ?? .54) * depth - (inActive ? .14 : 0)
567
+ });
568
+ }
569
+ }
570
+ return finalizeFrame(dots, [], o.rMin);
571
+ };
572
+ const frameWave = (size, t, o) => {
573
+ const cx = size / 2;
574
+ const cy = size / 2;
575
+ const R = size / 2 * .874;
576
+ const pt = makeProj(t * .18, .38, cx, cy, 1);
577
+ const rs = radiusScale(size, o.rsPow ?? .6);
578
+ const dots = [];
579
+ const rings = o.rings ?? 15;
580
+ const lonDensity = o.lonDensity ?? 40;
581
+ for (let ri = 0; ri <= rings; ri++) {
582
+ const lat = -Math.PI / 2 + ri / rings * Math.PI;
583
+ const cosLat = Math.cos(lat);
584
+ const sinLat = Math.sin(lat);
585
+ const w = .62 * Math.sin(t * 2.1 - ri * .52) + .38 * Math.sin(t * 1.27 + ri * .83);
586
+ const rr = R * (.88 + .105 * w);
587
+ const lonCount = Math.max(1, Math.round(Math.abs(cosLat) * lonDensity));
588
+ for (let lj = 0; lj < lonCount; lj++) {
589
+ const lon = lj / lonCount * 2 * Math.PI;
590
+ const [px, py, z] = pt(cosLat * Math.cos(lon) * rr, sinLat * rr, cosLat * Math.sin(lon) * rr);
591
+ const depth = (z / R + 1) / 2;
592
+ const crest = Math.max(0, w);
593
+ dots.push({
594
+ x: px,
595
+ y: py,
596
+ z,
597
+ r: ((o.rBase ?? .6) + (o.rDepth ?? 1.7) * depth) * (1 + .4 * crest) * rs,
598
+ white: .66 - .56 * depth - .1 * crest
599
+ });
600
+ }
601
+ }
602
+ return finalizeFrame(dots, [], o.rMin);
603
+ };
604
+ const frameOrbits = (size, t, o) => {
605
+ const cx = size / 2;
606
+ const cy = size / 2;
607
+ const R = size / 2 * .82;
608
+ const pt = makeProj(t * .12, .3, cx, cy, 1);
609
+ const rs = radiusScale(size, o.rsPow ?? .6);
610
+ const dots = [];
611
+ const orbitN = o.orbitN ?? 12;
612
+ const ghostN = o.ghostN ?? 40;
613
+ const particles = o.particles ?? 3;
614
+ for (let orb = 0; orb < orbitN; orb++) {
615
+ const h1 = hashD(orb, 1.7);
616
+ const h2 = hashD(orb, 5.2);
617
+ const h3 = hashD(orb, 8.9);
618
+ const ro = R * (.45 + .52 * h1);
619
+ const th = h1 * 2 * Math.PI;
620
+ const phi = Math.acos(2 * h2 - 1);
621
+ const nx = Math.sin(phi) * Math.cos(th);
622
+ const ny = Math.cos(phi);
623
+ const nz = Math.sin(phi) * Math.sin(th);
624
+ let ux = -ny;
625
+ let uy = nx;
626
+ const uz = 0;
627
+ const ul = Math.max(1e-6, Math.sqrt(ux * ux + uy * uy));
628
+ ux /= ul;
629
+ uy /= ul;
630
+ const vx = ny * uz - nz * uy;
631
+ const vy = nz * ux - nx * uz;
632
+ const vz = nx * uy - ny * ux;
633
+ const speed = (.25 + .55 * h3) * (h3 > .5 ? 1 : -1);
634
+ for (let k = 0; k < ghostN; k++) {
635
+ const a = k / ghostN * 2 * Math.PI;
636
+ const [px, py, z] = pt((ux * Math.cos(a) + vx * Math.sin(a)) * ro, (uy * Math.cos(a) + vy * Math.sin(a)) * ro, (uz * Math.cos(a) + vz * Math.sin(a)) * ro);
637
+ const depth = (z / ro + 1) / 2;
638
+ dots.push({
639
+ x: px,
640
+ y: py,
641
+ z,
642
+ r: (o.ghostR ?? .9) * rs,
643
+ white: .72,
644
+ a: (o.ghostA ?? .5) * (.4 + .6 * depth)
645
+ });
646
+ }
647
+ for (let m = 0; m < particles; m++) {
648
+ const a = t * speed + m / particles * 2 * Math.PI + h2 * 6;
649
+ const [px, py, z] = pt((ux * Math.cos(a) + vx * Math.sin(a)) * ro, (uy * Math.cos(a) + vy * Math.sin(a)) * ro, (uz * Math.cos(a) + vz * Math.sin(a)) * ro);
650
+ const depth = (z / ro + 1) / 2;
651
+ dots.push({
652
+ x: px,
653
+ y: py,
654
+ z,
655
+ r: ((o.partR ?? 1.2) + (o.partRDepth ?? 1.6) * depth) * rs,
656
+ white: .3 - .22 * depth
657
+ });
658
+ }
659
+ }
660
+ return finalizeFrame(dots, [], o.rMin);
661
+ };
662
+ const frameRibbon = (size, t, o) => {
663
+ const cx = size / 2;
664
+ const cy = size / 2;
665
+ const R = size / 2 * .78;
666
+ const spin = o.spin ?? 1;
667
+ const camTilt = .3;
668
+ const pt = makeProj(t * .1 * spin, camTilt, cx, cy, 1);
669
+ const rs = radiusScale(size, o.rsPow ?? .6);
670
+ const dots = [];
671
+ const ghostN = o.ghostN ?? 150;
672
+ for (let i = 0; i < ghostN; i++) {
673
+ const d = fibDir(i, ghostN);
674
+ const [px, py, z] = pt(d[0] * R, d[1] * R, d[2] * R);
675
+ const depth = (z / R + 1) / 2;
676
+ dots.push({
677
+ x: px,
678
+ y: py,
679
+ z,
680
+ r: .8 * rs,
681
+ white: .78,
682
+ a: .1 + .22 * depth
683
+ });
684
+ }
685
+ const ya = t * .24 * spin;
686
+ const ta = o.faceOn ? -camTilt : .55 + .3 * Math.sin(t * .18) * spin;
687
+ const ux = Math.cos(ya);
688
+ const uy = 0;
689
+ const uz = Math.sin(ya);
690
+ const vx = -uz * Math.sin(ta);
691
+ const vy = Math.cos(ta);
692
+ const vz = ux * Math.sin(ta);
693
+ const nx = uy * vz - uz * vy;
694
+ const ny = uz * vx - ux * vz;
695
+ const nz = ux * vy - uy * vx;
696
+ const wobAmp = .23 * (o.wobMul ?? 1);
697
+ const baseR = o.faceOn ? R / (1 + .85 * wobAmp) : R;
698
+ const baseLanes = o.lanes ?? 5;
699
+ const segs = o.segs ?? 88;
700
+ const lanes = Math.max(1, Math.round(baseLanes * (o.bandMul ?? 1)));
701
+ for (let w = 0; w < lanes; w++) {
702
+ const laneOff = (w - (lanes - 1) / 2) * .075;
703
+ const edge = Math.abs(w - (lanes - 1) / 2) / Math.max(1, (lanes - 1) / 2);
704
+ for (let k = 0; k < segs; k++) {
705
+ const a = k / segs * 2 * Math.PI;
706
+ const wob = (.16 * Math.sin(a * 3 - t * 1.7 + w * .22) + .07 * Math.sin(a * 5 + t * 1.1)) * (o.wobMul ?? 1);
707
+ const radial = o.faceOn ? 1 + wob : 1;
708
+ const off$1 = o.faceOn ? laneOff : laneOff + wob;
709
+ const x = ux * Math.cos(a) + vx * Math.sin(a) + nx * off$1;
710
+ const y = uy * Math.cos(a) + vy * Math.sin(a) + ny * off$1;
711
+ const z = uz * Math.cos(a) + vz * Math.sin(a) + nz * off$1;
712
+ const l = Math.sqrt(x * x + y * y + z * z);
713
+ const rr = baseR * radial;
714
+ const [px, py, zr] = pt(x / l * rr, y / l * rr, z / l * rr);
715
+ const depth = (zr / R + 1) / 2;
716
+ dots.push({
717
+ x: px,
718
+ y: py,
719
+ z: zr,
720
+ r: ((o.rBase ?? 1.1) + (o.rDepth ?? 1.7) * depth) * (1 - .25 * edge) * rs,
721
+ white: .52 - .44 * depth + .18 * edge,
722
+ a: .4 + .6 * depth
723
+ });
724
+ }
725
+ }
726
+ return finalizeFrame(dots, [], o.rMin);
727
+ };
728
+ function smoothE(x) {
729
+ return x * x * (3 - 2 * x);
730
+ }
731
+ function polyPath(verts) {
732
+ const V = verts.length;
733
+ const L = [];
734
+ let total = 0;
735
+ for (let i = 0; i < V; i++) {
736
+ const a = verts[i];
737
+ const b = verts[(i + 1) % V];
738
+ const l = Math.hypot(b[0] - a[0], b[1] - a[1]);
739
+ L.push(l);
740
+ total += l;
741
+ }
742
+ return (f) => {
743
+ let target = f * total;
744
+ let i = 0;
745
+ while (target > L[i] && i < V - 1) {
746
+ target -= L[i];
747
+ i++;
748
+ }
749
+ const a = verts[i];
750
+ const b = verts[(i + 1) % V];
751
+ const ff = L[i] ? Math.min(1, target / L[i]) : 0;
752
+ return [a[0] + (b[0] - a[0]) * ff, a[1] + (b[1] - a[1]) * ff];
753
+ };
754
+ }
755
+ var CIRCLE = (f) => {
756
+ const a = -Math.PI / 2 + f * 2 * Math.PI;
757
+ return [Math.cos(a) * .24, Math.sin(a) * .24];
758
+ };
759
+ var CYCLE = [
760
+ CIRCLE,
761
+ polyPath([
762
+ [0, -.26],
763
+ [.24, .16],
764
+ [-.24, .16]
765
+ ]),
766
+ polyPath([
767
+ [0, -.2],
768
+ [.2, -.2],
769
+ [.2, .2],
770
+ [-.2, .2],
771
+ [-.2, -.2]
772
+ ])
773
+ ];
774
+ function morphN(d) {
775
+ return Math.max(6, Math.round(34 * d));
776
+ }
777
+ var HOLD = 1.4;
778
+ var MORPH = .9;
779
+ var SEG = HOLD + MORPH;
780
+ const frameMorph = (size, t, o) => {
781
+ const K = CYCLE.length;
782
+ const tc = t % (SEG * K);
783
+ const k = Math.floor(tc / SEG);
784
+ const local = tc - k * SEG;
785
+ const m = local > HOLD ? smoothE((local - HOLD) / MORPH) : 0;
786
+ const sprd = o.spread ?? 1;
787
+ const pA = CYCLE[k];
788
+ const pB = CYCLE[(k + 1) % K];
789
+ const M = 160;
790
+ const pts = [];
791
+ for (let i = 0; i < M; i++) {
792
+ const f = i / M;
793
+ const a = pA(f);
794
+ const b = pB(f);
795
+ pts.push([(a[0] + (b[0] - a[0]) * m) * sprd, (a[1] + (b[1] - a[1]) * m) * sprd]);
796
+ }
797
+ const L = [];
798
+ let total = 0;
799
+ for (let i = 0; i < M; i++) {
800
+ const a = pts[i];
801
+ const b = pts[(i + 1) % M];
802
+ const l = Math.hypot(b[0] - a[0], b[1] - a[1]);
803
+ L.push(l);
804
+ total += l;
805
+ }
806
+ const n = morphN(o.iconD ?? 1);
807
+ const re = (o.rDot ?? .021) * 1.35 * sprd;
808
+ const pulse = 1 + .02 * Math.sin(local * 3.1);
809
+ const dots = [];
810
+ const c2 = size / 2;
811
+ let seg = 0;
812
+ let acc = 0;
813
+ for (let k2 = 0; k2 < n; k2++) {
814
+ const target = k2 / n * total;
815
+ while (acc + L[seg] < target && seg < M - 1) {
816
+ acc += L[seg];
817
+ seg++;
818
+ }
819
+ const a = pts[seg];
820
+ const b = pts[(seg + 1) % M];
821
+ const f = L[seg] ? Math.min(1, (target - acc) / L[seg]) : 0;
822
+ const x = (a[0] + (b[0] - a[0]) * f) * pulse;
823
+ const y = (a[1] + (b[1] - a[1]) * f) * pulse;
824
+ dots.push({
825
+ x: c2 + x * size,
826
+ y: c2 + y * size,
827
+ z: 0,
828
+ r: Math.max(.35, re * size),
829
+ white: .1
830
+ });
831
+ }
832
+ return finalizeFrame(dots, [], o.rMin);
833
+ };
834
+ const earthPointData = {
835
+ "20": {
836
+ rings: 9,
837
+ flags: "01100000000000000000000000000000100010000100000011000110011000000000011111100000011001001100011000111010"
838
+ },
839
+ "32": {
840
+ rings: 17,
841
+ flags: "011001001111000000000000000000000100000000000000000000010000000000000000000000000110000010000000101000000000000111000001110000001110000000000001111000011100000000000000000000001110000011110000001000000000000000100000111111000000000000000000100000001111111010100000000000011000000110011111111000000011110000101001111100000011110001111111100011100001111111000000010000"
842
+ },
843
+ "48": {
844
+ rings: 29,
845
+ flags: "111011111111001011001111111100000000000000101111000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000001000000000000001100000000000000000000000001100000000000000000001100000000001100000000000011111000000000000000000001110000000001110100000000001111100000000000000000000011111000000001111010000000000011100000000000000000000001111110000000011110000000000000001100000000000000000000011111111000000011111000000000000000010100000000000000000000111100000000001111100000000000100000000000000000000000000011100000000111111111000001000000000000000000000000000000100000000001111111111000001000100000000000000000000000101001000000001111111111100110110000000000000000000001110010000000001111111111001111111100000000000000000111110000000000111110111111111111000000000000000011111100000000100001111111111110010000000000011111100000000101101111111111100000000000111111010000011111111111111100000000011110100000100111111111110100011111010100010111111111111111010010001011111110001001100001000000110000000"
846
+ },
847
+ "64": {
848
+ rings: 37,
849
+ flags: "111011111111011110011111111100000001000111111111110000000000000000001101111100000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000011100000000000010000000000000001000111000000000000000000000000111100000000000011100000000000000011111110000000000000000000000000111100000000000011110100000000000011111110000000000000000000000000001111110000000000111100100000000000000111110000000000000000000000000001111111100000000001111110100000000000000011000000000000000000000000000001111111110000000000111110000000000000000000000001000000000000000000000000111111111000000000011111100000000000000000000100000000000000000000000000001111110000000000001111111000000000000101100000000000000000000000000000000001111100000000000011111111000000000011001000000000000000000000000000000000001100000000011111111111110000010000010000000000000000000000000000000011000000000000011111111111110000011000110000000000000000000000000000011000010000000000111111111111111000110011000000000000000000000000000011000100000000000111111111111110011111111110000000000000000000000011100000000000000011111111111111111111111100000000000000000000011111110000000000001110000111111111111110000000000000000000011111110000000000010000011101111111111000000000000000000011111111000000000010110010111111111111000000000000001111111101000000111111111111111111110000000000001111101110000011111111111111111110000000001111100100000010101111111111110010011111111010100000111111111111111101111010011000011111111111100001110110000001110000001011101000000000000000000"
850
+ },
851
+ "96": {
852
+ rings: 53,
853
+ flags: "111111111111001111011111111100111110011111111111110000110111000111111111111110000000000001000000111111111111111100000000000000000000000000110111111110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000001100000000000000000000000000000000000000000000000001000000000000000000000000011100000000000000000000000000000000000000000000000000001000000000000000000000000011110000000000000000000000000000000000000000000000110000001000000000000000000000000000111100000000000000000011000000000000000000000010000111000000000000000000000000000000000001111100000000000000000111100000000000000000000011111111110000000000000000000000000000000000011111100000000000000001111100000000000000000000011111111110000000000000000000000000000000000000111111100000000000000001111110010000000000000000001111111111000000000000000000000000000000000000001111111100000000000000011111100100000000000000000000111111110000000000000000000000000000000000000001111111110000000000000011111111011000000000000000000001111101000000000000000000000000000000000000000111111111110000000000000001111111100000000000000000000000001101000000000000000000000000000000000000000011111111111100000000000000111111110000000000000000000000000000000100000000000000000000000000000000000000111111111111100000000000000111111100000000000000000000110000000111000000000000000000000000000000000000000111111111111000000000000000111111110000000000000000000101101000111000000000000000000000000000000000000000011111111100000000000000000111111111100000000000000000100110000000000000000000000000000000000000000000000000111111100000000000000000011111111111000000000000000110001000000000000000000000000000000000000000000000000111111000000000000001111111111111111100000000010000010000001000000000000000000000000000000000000000000000011100000000000000111111111111111111100000000000000000000000000000000000000000000000000000000000000011000000000000000000011111111111111111110000000110000011100000000000000000000000000000000000000000001110000000000000000000011111111111111110111000000110001111000000000000000000000000000000000000000001100100010000000000000001111111111111110111110000111101111000000000000000000000000000000000000000011100000000000000000000001111111111111111111100111111111111111000000000000000000000000000000000011100001000000000000000001111111111110111011111111111111111100000000000000000000000000000000111111110000000000000000000111111111111111111111111111111111000000000000000000000000000000111111111000000000000000000111100000011111111111111111111100100000000000000000000000001111111111100000000000000011000000011111011111111111111100100000000000000000000000011111111111000000000000000110100111111001111111111111101000000000000000000000001111111111110000000000000011101110010111111111111111111010000000000000000000111111111101010000000000111111111111111111111111111100000000000000000011111111111111000000000111111111111111111111111111100000000000000011111111011110000000000001111111111111111111110001000000000001111110001100000000000010111111111111111111000100000111111111100100010000000101111111111111111111010001111111111111001000100010111111111111111111110111111001010011000001111111111111111111000001111101110000000101111111100000000010011100000000110000000000011110010000000000000101100000000000000000000"
854
+ }
855
+ };
856
+ var cache = /* @__PURE__ */ new Map();
857
+ function getEarthPoints(size) {
858
+ const hit = cache.get(size);
859
+ if (hit) return hit;
860
+ const { rings, flags } = earthPointData[size];
861
+ const points = [];
862
+ let index$1 = 0;
863
+ for (let row = 0; row < rings; row++) {
864
+ const lat = -Math.PI / 2 + (row + .5) / rings * Math.PI;
865
+ const count = Math.max(1, Math.round(2 * rings * Math.cos(lat)));
866
+ for (let col = 0; col < count; col++, index$1++) {
867
+ const lon = -Math.PI + col / count * 2 * Math.PI;
868
+ const land = flags[index$1] === "1";
869
+ if (!land && index$1 % 3 !== 0) continue;
870
+ points.push({
871
+ x: Math.cos(lat) * Math.cos(lon),
872
+ y: Math.sin(lat),
873
+ z: Math.cos(lat) * Math.sin(lon),
874
+ lon,
875
+ land
876
+ });
877
+ }
878
+ }
879
+ cache.set(size, points);
880
+ return points;
881
+ }
882
+ function frameEarth(size, time) {
883
+ const project = makeProj(35 * Math.PI / 180 - Math.PI / 2 + time * .22, .18, size / 2, size / 2, size * .43);
884
+ const dots = [];
885
+ for (const p of getEarthPoints(size)) {
886
+ const [x, y, z] = project(p.x, p.y, p.z);
887
+ if (z <= 0) continue;
888
+ const scan = Math.exp(-Math.pow(angleDelta(p.lon, time * .9), 2) / .08);
889
+ const edge = Math.min(1, z / .14);
890
+ dots.push({
891
+ x,
892
+ y,
893
+ z,
894
+ r: (size <= 32 ? .48 : .52) * (size / 64) ** .25 * (1 + .2 * z + (p.land ? .22 * scan : 0)),
895
+ white: p.land ? .08 + .2 * (1 - z) : .65,
896
+ a: edge * (p.land ? .82 + scan * .18 : .2)
897
+ });
898
+ }
899
+ return finalizeFrame(dots, [], .3);
900
+ }
901
+ var frames = {
902
+ searching: frameGlobe,
903
+ solving: frameRubik,
904
+ listening: frameWave,
905
+ working: frameOrbits,
906
+ composing: frameRibbon,
907
+ shaping: frameMorph
908
+ };
909
+ function createLoadingFrame(animation, size, time) {
910
+ if (animation === "earth") return frameEarth(size, time);
911
+ const { speed, opts } = resolvePreset(animation, size);
912
+ const frame = frames[animation](size, time * speed, opts);
913
+ if (size === 20 && frame.dots.length > 120) {
914
+ const count = frame.dots.length;
915
+ frame.dots = Array.from({ length: 120 }, (_, i) => frame.dots[Math.floor(i * count / 120)]);
916
+ }
917
+ return frame;
918
+ }
919
+ function paintLoadingFrame(ctx, frame, color) {
920
+ ctx.fillStyle = color;
921
+ for (const dot of frame.dots) {
922
+ ctx.globalAlpha = Math.max(0, Math.min(1, (dot.a ?? 1) * (1 - dot.white)));
923
+ ctx.beginPath();
924
+ ctx.arc(dot.x, dot.y, dot.r, 0, Math.PI * 2);
925
+ ctx.fill();
926
+ }
927
+ ctx.globalAlpha = 1;
928
+ }
929
+ function useLoadingAnimation(canvas, options, color) {
930
+ const available = ref(true);
931
+ let ctx = null;
932
+ let raf;
933
+ let previous;
934
+ let elapsed = 0;
935
+ let enabled = true;
936
+ let inView = true;
937
+ let reduced = false;
938
+ let mounted = false;
939
+ let dpr = 1;
940
+ let observer;
941
+ let motion;
942
+ const stop = () => {
943
+ if (raf !== void 0) cancelAnimationFrame(raf);
944
+ raf = void 0;
945
+ previous = void 0;
946
+ };
947
+ const running = () => mounted && ctx && enabled && inView && options().active && !options().paused && !reduced && document.visibilityState !== "hidden";
948
+ const paint = () => {
949
+ if (!ctx || !canvas.value) return;
950
+ const size = normalizeSize(options().size);
951
+ const ratio = Math.min(2, Math.max(1, window.devicePixelRatio || 1));
952
+ if (canvas.value.width !== Math.round(size * ratio) || ratio !== dpr) {
953
+ canvas.value.width = Math.round(size * ratio);
954
+ canvas.value.height = Math.round(size * ratio);
955
+ }
956
+ dpr = ratio;
957
+ ctx.setTransform(dpr, 0, 0, dpr, 0, 0);
958
+ ctx.clearRect(0, 0, size, size);
959
+ try {
960
+ paintLoadingFrame(ctx, createLoadingFrame(normalizeAnimation(options().animation), size, reduced ? .6 : elapsed), color.value);
961
+ } catch {
962
+ available.value = false;
963
+ ctx = null;
964
+ stop();
965
+ }
966
+ };
967
+ const tick = (now) => {
968
+ raf = void 0;
969
+ if (!running()) {
970
+ previous = void 0;
971
+ return;
972
+ }
973
+ if (previous !== void 0) elapsed += Math.min(100, now - previous) / 1e3 * normalizeSpeed(options().speed);
974
+ previous = now;
975
+ paint();
976
+ if (running()) raf = requestAnimationFrame(tick);
977
+ };
978
+ const sync = () => {
979
+ if (!mounted) return;
980
+ if (!running()) stop();
981
+ if (options().active && inView && enabled && document.visibilityState !== "hidden") paint();
982
+ if (running() && raf === void 0) raf = requestAnimationFrame(tick);
983
+ };
984
+ const motionChange = () => {
985
+ reduced = motion?.matches ?? false;
986
+ sync();
987
+ };
988
+ watch(() => [
989
+ options().active,
990
+ options().paused,
991
+ options().animation,
992
+ options().size,
993
+ options().speed,
994
+ color.value
995
+ ], sync, { flush: "post" });
996
+ onMounted(() => {
997
+ mounted = true;
998
+ try {
999
+ ctx = canvas.value?.getContext("2d") ?? null;
1000
+ } catch {
1001
+ ctx = null;
1002
+ }
1003
+ available.value = !!ctx;
1004
+ motion = window.matchMedia?.("(prefers-reduced-motion: reduce)");
1005
+ reduced = motion?.matches ?? false;
1006
+ motion?.addEventListener("change", motionChange);
1007
+ if (typeof IntersectionObserver !== "undefined" && canvas.value) {
1008
+ observer = new IntersectionObserver(([entry]) => {
1009
+ inView = entry.isIntersecting;
1010
+ sync();
1011
+ });
1012
+ observer.observe(canvas.value);
1013
+ }
1014
+ document.addEventListener("visibilitychange", sync);
1015
+ window.addEventListener("resize", sync);
1016
+ sync();
1017
+ });
1018
+ onActivated(() => {
1019
+ enabled = true;
1020
+ sync();
1021
+ });
1022
+ onDeactivated(() => {
1023
+ enabled = false;
1024
+ stop();
1025
+ });
1026
+ onScopeDispose(() => {
1027
+ mounted = false;
1028
+ stop();
1029
+ observer?.disconnect();
1030
+ motion?.removeEventListener("change", motionChange);
1031
+ if (typeof document !== "undefined") document.removeEventListener("visibilitychange", sync);
1032
+ if (typeof window !== "undefined") window.removeEventListener("resize", sync);
1033
+ ctx = null;
1034
+ });
1035
+ return { available };
1036
+ }
1037
+ var _hoisted_1$7 = [
1038
+ "role",
1039
+ "aria-live",
1040
+ "aria-hidden",
1041
+ "aria-label"
1042
+ ];
1043
+ var FlLoading_default = /* @__PURE__ */ defineComponent({
1044
+ name: "FlLoading",
1045
+ __name: "FlLoading",
1046
+ props: flLoadingProps,
1047
+ setup(__props) {
1048
+ const props = __props;
1049
+ const ns = useNamespace("loading");
1050
+ const root = ref();
1051
+ const canvas = ref();
1052
+ const resolvedSize = computed(() => normalizeSize(props.size));
1053
+ const resolvedColor = useLoadingColor(() => root.value, () => props);
1054
+ const { available } = useLoadingAnimation(canvas, () => props, resolvedColor);
1055
+ return (_ctx, _cache) => {
1056
+ return openBlock(), createElementBlock("span", {
1057
+ ref_key: "root",
1058
+ ref: root,
1059
+ class: normalizeClass([
1060
+ unref(ns).b(),
1061
+ unref(ns).m(_ctx.layout),
1062
+ unref(ns).is("inactive", !_ctx.active)
1063
+ ]),
1064
+ style: normalizeStyle({ "--fl-loading-size": `${resolvedSize.value}px` }),
1065
+ role: _ctx.active ? "status" : void 0,
1066
+ "aria-live": _ctx.active ? "polite" : "off",
1067
+ "aria-hidden": !_ctx.active || void 0,
1068
+ "aria-label": !_ctx.text && !_ctx.$slots.text ? _ctx.ariaLabel : void 0
1069
+ }, [createElementVNode("span", {
1070
+ class: normalizeClass(unref(ns).e("visual")),
1071
+ "aria-hidden": "true"
1072
+ }, [withDirectives(createElementVNode("canvas", {
1073
+ ref_key: "canvas",
1074
+ ref: canvas,
1075
+ class: normalizeClass(unref(ns).e("canvas")),
1076
+ style: normalizeStyle({
1077
+ width: `${resolvedSize.value}px`,
1078
+ height: `${resolvedSize.value}px`
1079
+ })
1080
+ }, null, 6), [[vShow, unref(available)]]), !unref(available) ? (openBlock(), createElementBlock("span", {
1081
+ key: 0,
1082
+ class: normalizeClass(unref(ns).e("fallback")),
1083
+ style: normalizeStyle({ color: unref(resolvedColor) })
1084
+ }, "●", 6)) : createCommentVNode("v-if", true)], 2), _ctx.text || _ctx.$slots.text ? (openBlock(), createElementBlock("span", {
1085
+ key: 0,
1086
+ class: normalizeClass(unref(ns).e("text"))
1087
+ }, [renderSlot(_ctx.$slots, "text", {}, () => [createTextVNode(toDisplayString(_ctx.text), 1)])], 2)) : createCommentVNode("v-if", true)], 14, _hoisted_1$7);
1088
+ };
1089
+ }
1090
+ });
1091
+ function useFlLoading(active, options = {}) {
1092
+ const ns = useNamespace("loading");
1093
+ const alive = ref(true);
1094
+ const generation = ref(0);
1095
+ const resolved = computed(() => toValue(options));
1096
+ const color = useLoadingColor(() => toValue(resolved.value.themeTarget), () => resolved.value);
1097
+ watch(() => toValue(active), () => generation.value++, { flush: "sync" });
1098
+ onScopeDispose(() => {
1099
+ alive.value = false;
1100
+ });
1101
+ const Content = defineComponent({
1102
+ name: "FlLoadingContent",
1103
+ props: { generation: {
1104
+ type: Number,
1105
+ required: true
1106
+ } },
1107
+ setup(props) {
1108
+ const ownGeneration = props.generation;
1109
+ return () => {
1110
+ const { background: _background, customClass: _customClass, themeTarget: _target, ...visual } = resolved.value;
1111
+ return h(FlLoading_default, {
1112
+ layout: "vertical",
1113
+ ...visual,
1114
+ color: color.value,
1115
+ active: alive.value && toValue(active) && ownGeneration === generation.value
1116
+ });
1117
+ };
1118
+ }
1119
+ });
1120
+ return computed(() => {
1121
+ if (!alive.value || !toValue(active)) return false;
1122
+ return {
1123
+ text: h(Content, { generation: generation.value }),
1124
+ customClass: [ns.b("adapter"), resolved.value.customClass].filter(Boolean).join(" "),
1125
+ background: resolved.value.background
1126
+ };
1127
+ });
1128
+ }
1129
+ const FlLoading = withInstall(FlLoading_default);
6
1130
  const FlDialog = withInstall(dialog_default);
7
1131
  const FlInput = withInstall(/* @__PURE__ */ defineComponent({
8
1132
  name: "FlInput",
@@ -7599,17 +8723,17 @@ var resolveColumnKey = (path) => {
7599
8723
  return first || path;
7600
8724
  };
7601
8725
  const createTableProxyDataBuilder = () => {
7602
- const cache = /* @__PURE__ */ new WeakMap();
8726
+ const cache$2 = /* @__PURE__ */ new WeakMap();
7603
8727
  const runtime = {
7604
8728
  onCellChange: () => void 0,
7605
8729
  resolveRowIndex: () => -1,
7606
8730
  rowKeyField: "id",
7607
8731
  maxDepth: 4
7608
8732
  };
7609
- const getCachedProxy = (target, path) => cache.get(target)?.get(path);
8733
+ const getCachedProxy = (target, path) => cache$2.get(target)?.get(path);
7610
8734
  const setCachedProxy = (target, path, proxy) => {
7611
- if (!cache.has(target)) cache.set(target, /* @__PURE__ */ new Map());
7612
- cache.get(target)?.set(path, proxy);
8735
+ if (!cache$2.has(target)) cache$2.set(target, /* @__PURE__ */ new Map());
8736
+ cache$2.get(target)?.set(path, proxy);
7613
8737
  };
7614
8738
  const toNullableRow = (value) => {
7615
8739
  if (!isObjectLike(value)) return null;
@@ -9040,6 +10164,7 @@ var table_editor_default = /* @__PURE__ */ defineComponent({
9040
10164
  const FlTable = withInstall(table_default);
9041
10165
  const FlTableEditor = withInstall(table_editor_default);
9042
10166
  var components = [
10167
+ FlLoading,
9043
10168
  FlBarcode,
9044
10169
  FlButton,
9045
10170
  FlDialog,
@@ -9060,6 +10185,6 @@ const install = (app) => {
9060
10185
  for (const component of components) app.use(component);
9061
10186
  };
9062
10187
  var falcon_ui_default = { install };
9063
- export { FlBarcode, FlButton, FlDatePicker, FlDialog, FlInput, FlInputNumber, FlInputSearch, FlQrCode, FlRadialMenu, FlRadialMenuItem, FlSelect, FlTable, FlTableEditor, FlTree, FlTreeSelect, HolderOutlined, MinusSquareOutlined, PlusSquareOutlined, closeAll, falcon_ui_default as default, install, invokeListener, mergeComponentExpose, open, useClearableState, useDialog, useMergedAttrs, useMergedExpose, useNamespace, withInstall };
10188
+ export { FlBarcode, FlButton, FlDatePicker, FlDialog, FlInput, FlInputNumber, FlInputSearch, FlLoading, FlQrCode, FlRadialMenu, FlRadialMenuItem, FlSelect, FlTable, FlTableEditor, FlTree, FlTreeSelect, HolderOutlined, MinusSquareOutlined, PlusSquareOutlined, closeAll, falcon_ui_default as default, install, invokeListener, mergeComponentExpose, open, useClearableState, useDialog, useFlLoading, useMergedAttrs, useMergedExpose, useNamespace, withInstall };
9064
10189
 
9065
10190
  //# sourceMappingURL=index.mjs.map