@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
@@ -144,6 +144,1131 @@ var button_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ (0, vue
144
144
  });
145
145
  var button_default = button_vue_vue_type_script_setup_true_lang_default;
146
146
  const FlButton = withInstall(button_default);
147
+ const flLoadingAnimations = [
148
+ "working",
149
+ "searching",
150
+ "solving",
151
+ "listening",
152
+ "composing",
153
+ "shaping",
154
+ "earth"
155
+ ];
156
+ const flLoadingSizes = [
157
+ 20,
158
+ 32,
159
+ 48,
160
+ 64,
161
+ 96
162
+ ];
163
+ const flLoadingProps = {
164
+ active: {
165
+ type: Boolean,
166
+ default: true
167
+ },
168
+ animation: {
169
+ type: String,
170
+ default: "searching",
171
+ validator: (v) => flLoadingAnimations.includes(v)
172
+ },
173
+ size: {
174
+ type: Number,
175
+ default: 64,
176
+ validator: (v) => flLoadingSizes.includes(v)
177
+ },
178
+ color: {
179
+ type: String,
180
+ default: ""
181
+ },
182
+ theme: {
183
+ type: String,
184
+ default: "auto"
185
+ },
186
+ speed: {
187
+ type: Number,
188
+ default: 1
189
+ },
190
+ paused: {
191
+ type: Boolean,
192
+ default: false
193
+ },
194
+ text: {
195
+ type: String,
196
+ default: ""
197
+ },
198
+ layout: {
199
+ type: String,
200
+ default: "inline"
201
+ },
202
+ ariaLabel: {
203
+ type: String,
204
+ default: "加载中"
205
+ }
206
+ };
207
+ const normalizeAnimation = (v) => flLoadingAnimations.includes(v) ? v : "searching";
208
+ const normalizeSize = (v) => flLoadingSizes.includes(v) ? v : 64;
209
+ const normalizeSpeed = (v) => Number.isFinite(v) ? Math.max(.25, Math.min(3, v)) : 1;
210
+ function useLoadingColor(host, options) {
211
+ const color = (0, vue.ref)("#20252b");
212
+ let mounted = false;
213
+ let observer;
214
+ let media;
215
+ let probe;
216
+ let observedHost;
217
+ const resolve = () => {
218
+ if (!mounted) return;
219
+ const target = host() || document.documentElement;
220
+ if (target !== observedHost) {
221
+ observer?.disconnect();
222
+ probe?.remove();
223
+ probe = document.createElement("span");
224
+ probe.setAttribute("aria-hidden", "true");
225
+ probe.style.cssText = "position:absolute;visibility:hidden;pointer-events:none;width:0;height:0;overflow:hidden";
226
+ target.appendChild(probe);
227
+ for (let el = target; el; el = el.parentElement) observer?.observe(el, {
228
+ attributes: true,
229
+ attributeFilter: [
230
+ "class",
231
+ "style",
232
+ "data-theme"
233
+ ]
234
+ });
235
+ observedHost = target;
236
+ }
237
+ const { color: explicit, theme = "auto" } = options();
238
+ let dark = theme === "dark";
239
+ if (theme === "auto") {
240
+ dark = media?.matches ?? false;
241
+ for (let el = target; el; el = el.parentElement) {
242
+ const marker = el.dataset.theme;
243
+ if (marker === "dark" || marker === "light") {
244
+ dark = marker === "dark";
245
+ break;
246
+ }
247
+ if (el.classList.contains("dark") || el.classList.contains("light")) {
248
+ dark = el.classList.contains("dark");
249
+ break;
250
+ }
251
+ }
252
+ }
253
+ const variable = getComputedStyle(target).getPropertyValue("--fl-loading-color").trim();
254
+ const fallback = dark ? "#f0f3f7" : "#20252b";
255
+ if (probe) {
256
+ probe.style.color = fallback;
257
+ if (explicit || variable) probe.style.color = explicit || variable;
258
+ color.value = getComputedStyle(probe).color || fallback;
259
+ }
260
+ };
261
+ (0, vue.watch)([
262
+ host,
263
+ () => options().color,
264
+ () => options().theme
265
+ ], resolve, { flush: "post" });
266
+ (0, vue.onMounted)(() => {
267
+ mounted = true;
268
+ media = window.matchMedia?.("(prefers-color-scheme: dark)");
269
+ observer = typeof MutationObserver === "undefined" ? void 0 : new MutationObserver(resolve);
270
+ media?.addEventListener("change", resolve);
271
+ resolve();
272
+ });
273
+ (0, vue.onScopeDispose)(() => {
274
+ mounted = false;
275
+ observer?.disconnect();
276
+ media?.removeEventListener("change", resolve);
277
+ probe?.remove();
278
+ });
279
+ return color;
280
+ }
281
+ var COUNT_PAIRS = [
282
+ ["latRings", "lonDensity"],
283
+ ["rings", "lonDensity"],
284
+ ["lanes", "segs"]
285
+ ];
286
+ var COUNT_KEYS = [
287
+ "orbitN",
288
+ "ghostN",
289
+ "nodeN",
290
+ "strandN",
291
+ "signals"
292
+ ];
293
+ var ICON_DENSITY_KEYS = ["iconD"];
294
+ var RADIUS_KEYS = [
295
+ "rBase",
296
+ "rDepth",
297
+ "rActive",
298
+ "rDot",
299
+ "ghostR",
300
+ "partR",
301
+ "partRDepth",
302
+ "nodeR",
303
+ "nodeRDepth"
304
+ ];
305
+ function scaleCounts(opts, scale) {
306
+ const out = { ...opts };
307
+ const done = /* @__PURE__ */ new Set();
308
+ const rt = Math.sqrt(scale);
309
+ for (const [a, b] of COUNT_PAIRS) {
310
+ const va = out[a];
311
+ const vb = out[b];
312
+ if (va != null && vb != null && !done.has(a) && !done.has(b)) {
313
+ out[a] = Math.max(2, Math.round(va * rt));
314
+ out[b] = Math.max(2, Math.round(vb * rt));
315
+ done.add(a);
316
+ done.add(b);
317
+ }
318
+ }
319
+ for (const k of COUNT_KEYS) {
320
+ const v = out[k];
321
+ if (v != null && v !== 0 && !done.has(k)) out[k] = Math.max(1, Math.round(v * scale));
322
+ }
323
+ for (const k of ICON_DENSITY_KEYS) {
324
+ const v = out[k];
325
+ if (v != null) out[k] = Math.max(.02, v * scale);
326
+ }
327
+ return out;
328
+ }
329
+ function scaleRadii(opts, scale) {
330
+ const out = { ...opts };
331
+ for (const k of RADIUS_KEYS) {
332
+ const v = out[k];
333
+ if (v != null) out[k] = v * scale;
334
+ }
335
+ out.rSizeMul = (out.rSizeMul ?? 1) * scale;
336
+ return out;
337
+ }
338
+ const BASE_PROFILES = {
339
+ globe: {
340
+ latRings: 17,
341
+ lonDensity: 44,
342
+ rBase: .6,
343
+ rDepth: 1.7,
344
+ rBoost: 1,
345
+ inkFar: .62,
346
+ inkSpan: .54,
347
+ rsPow: .6,
348
+ rMin: .3
349
+ },
350
+ orbits: {
351
+ orbitN: 12,
352
+ ghostN: 40,
353
+ ghostR: .9,
354
+ ghostA: .5,
355
+ particles: 3,
356
+ partR: 1.2,
357
+ partRDepth: 1.6,
358
+ rsPow: .6,
359
+ rMin: .3
360
+ },
361
+ rubik: {
362
+ latRings: 15,
363
+ lonDensity: 40,
364
+ moveCount: 14,
365
+ rBase: .6,
366
+ rDepth: 1.7,
367
+ rActive: .3,
368
+ inkFar: .62,
369
+ inkSpan: .54,
370
+ rsPow: .6,
371
+ rMin: .3
372
+ },
373
+ wave: {
374
+ rings: 15,
375
+ lonDensity: 40,
376
+ rBase: .6,
377
+ rDepth: 1.7,
378
+ rsPow: .6,
379
+ rMin: .3
380
+ },
381
+ web: {
382
+ nodeN: 30,
383
+ thr: .72,
384
+ signals: 5,
385
+ nodeR: 1.4,
386
+ nodeRDepth: 1.8,
387
+ lineW: .8,
388
+ rsPow: .6,
389
+ rMin: .3
390
+ },
391
+ braid: {
392
+ strandN: 52,
393
+ turns: 3,
394
+ ghostN: 150,
395
+ rBase: 1.2,
396
+ rDepth: 1.8,
397
+ rsPow: .6,
398
+ rMin: .3
399
+ },
400
+ ribbon: {
401
+ lanes: 5,
402
+ segs: 88,
403
+ ghostN: 150,
404
+ rBase: 1.1,
405
+ rDepth: 1.7,
406
+ rsPow: .6,
407
+ rMin: .3
408
+ },
409
+ ring: {
410
+ lanes: 5,
411
+ segs: 88,
412
+ ghostN: 0,
413
+ faceOn: 1,
414
+ rBase: 1.1,
415
+ rDepth: 1.7,
416
+ rsPow: .6,
417
+ rMin: .3
418
+ },
419
+ morph: {
420
+ rDot: .021,
421
+ iconD: 1,
422
+ rMin: .25
423
+ }
424
+ };
425
+ var presets = {
426
+ working: [
427
+ "orbits",
428
+ 1.885,
429
+ 1,
430
+ 1,
431
+ 3.9,
432
+ .238,
433
+ 2.4
434
+ ],
435
+ searching: [
436
+ "globe",
437
+ 2.015,
438
+ .42,
439
+ 1.15,
440
+ 2.665,
441
+ .105,
442
+ 1.75
443
+ ],
444
+ solving: [
445
+ "rubik",
446
+ 1.82,
447
+ .35,
448
+ 1.05,
449
+ 1.95,
450
+ .088,
451
+ 1.9
452
+ ],
453
+ listening: [
454
+ "wave",
455
+ 4.388,
456
+ .341,
457
+ 1,
458
+ 3.998,
459
+ .105,
460
+ 1.6
461
+ ],
462
+ composing: [
463
+ "ribbon",
464
+ 2.34,
465
+ .25,
466
+ .85,
467
+ 3.12,
468
+ .051,
469
+ 1.073
470
+ ],
471
+ shaping: [
472
+ "morph",
473
+ 2.405,
474
+ .702,
475
+ .395,
476
+ 2.08,
477
+ .53,
478
+ 1.011
479
+ ]
480
+ };
481
+ var cache$1 = /* @__PURE__ */ new Map();
482
+ function resolvePreset(animation, size) {
483
+ const key = `${animation}-${size}`;
484
+ const hit = cache$1.get(key);
485
+ if (hit) return hit;
486
+ if (animation === "earth") return {
487
+ speed: 1,
488
+ opts: {}
489
+ };
490
+ const [mode, bigSpeed, bigCount, bigRadius, smallSpeed, smallCount, smallRadius] = presets[animation];
491
+ const blend = Math.max(0, Math.min(1, (size - 20) / 44));
492
+ const count = smallCount + (bigCount - smallCount) * blend;
493
+ const radius = smallRadius + (bigRadius - smallRadius) * blend;
494
+ let opts = scaleRadii(scaleCounts(BASE_PROFILES[mode], count), radius);
495
+ if (animation === "searching") opts = {
496
+ ...opts,
497
+ scanMul: 4.08,
498
+ dimBase: .45
499
+ };
500
+ if (animation === "composing") opts = {
501
+ ...opts,
502
+ spin: 0,
503
+ bandMul: 3.9,
504
+ wobMul: 1
505
+ };
506
+ if (animation === "shaping") opts = {
507
+ ...opts,
508
+ spread: 1.45
509
+ };
510
+ const resolved = {
511
+ speed: smallSpeed + (bigSpeed - smallSpeed) * blend,
512
+ opts
513
+ };
514
+ cache$1.set(key, resolved);
515
+ return resolved;
516
+ }
517
+ function hashD(a, b) {
518
+ const h$8 = Math.sin(a * 12.9898 + b * 78.233) * 43758.5453;
519
+ return h$8 - Math.floor(h$8);
520
+ }
521
+ function fibDir(i, n) {
522
+ const golden = Math.PI * (3 - Math.sqrt(5));
523
+ const y = 1 - 2 * (i + .5) / n;
524
+ const rad = Math.sqrt(1 - y * y);
525
+ const a = i * golden;
526
+ return [
527
+ rad * Math.cos(a),
528
+ y,
529
+ rad * Math.sin(a)
530
+ ];
531
+ }
532
+ function angleDelta(a, b) {
533
+ return Math.atan2(Math.sin(a - b), Math.cos(a - b));
534
+ }
535
+ function makeProj(yaw, tilt, cx, cy, scale) {
536
+ const st = Math.sin(tilt);
537
+ const ct = Math.cos(tilt);
538
+ const sy = Math.sin(yaw);
539
+ const cyw = Math.cos(yaw);
540
+ return (x, y, z) => {
541
+ const x1 = x * cyw + z * sy;
542
+ const z1 = -x * sy + z * cyw;
543
+ const y1 = y * ct - z1 * st;
544
+ const z2 = y * st + z1 * ct;
545
+ return [
546
+ cx + x1 * scale,
547
+ cy - y1 * scale,
548
+ z2
549
+ ];
550
+ };
551
+ }
552
+ function finalizeFrame(dots, lines, rMin = .3) {
553
+ const visible = [];
554
+ for (const d of dots) {
555
+ if ((d.a ?? 1) < .02) continue;
556
+ d.r = Math.max(rMin, d.r);
557
+ visible.push(d);
558
+ }
559
+ visible.sort((a, b) => a.z - b.z);
560
+ return {
561
+ dots: visible,
562
+ lines: lines.filter((l) => (l.a ?? 1) >= .02)
563
+ };
564
+ }
565
+ function radiusScale(size, pow) {
566
+ return (size / 300) ** pow;
567
+ }
568
+ const frameGlobe = (size, t, o) => {
569
+ const spin = .5;
570
+ const cx = size / 2;
571
+ const cy = size / 2;
572
+ const radius = size / 2 * .82;
573
+ const tilt = .4 + .06 * Math.sin(t * .35);
574
+ const pt = makeProj(t * spin, tilt, cx, cy, radius);
575
+ const scan = t * (spin + (1.7 - spin) * (o.scanMul ?? 1));
576
+ const rs = radiusScale(size, o.rsPow ?? .6);
577
+ const dimBase = o.dimBase ?? 1;
578
+ const dots = [];
579
+ const latRings = o.latRings ?? 17;
580
+ const lonDensity = o.lonDensity ?? 44;
581
+ for (let li = 0; li <= latRings; li++) {
582
+ const lat = -Math.PI / 2 + li / latRings * Math.PI;
583
+ const cosLat = Math.cos(lat);
584
+ const sinLat = Math.sin(lat);
585
+ const lonCount = Math.max(1, Math.round(Math.abs(cosLat) * lonDensity));
586
+ for (let lj = 0; lj < lonCount; lj++) {
587
+ const lon = lj / lonCount * 2 * Math.PI;
588
+ const [px, py, z] = pt(cosLat * Math.cos(lon), sinLat, cosLat * Math.sin(lon));
589
+ const depth = (z + 1) / 2;
590
+ const d = angleDelta(lon + t * spin, scan);
591
+ const boost = Math.exp(-(d * d) / .18) * Math.max(0, z);
592
+ dots.push({
593
+ x: px,
594
+ y: py,
595
+ z,
596
+ r: ((o.rBase ?? .6) + (o.rDepth ?? 1.7) * depth + (o.rBoost ?? 1) * boost) * rs,
597
+ white: (o.inkFar ?? .62) - (o.inkSpan ?? .54) * depth,
598
+ a: dimBase + (1 - dimBase) * Math.min(1, boost)
599
+ });
600
+ }
601
+ }
602
+ return finalizeFrame(dots, [], o.rMin);
603
+ };
604
+ function solveCycle(time, count, slotDur, rest) {
605
+ const tc = time % (2 * count * slotDur + rest);
606
+ const amount = new Array(count).fill(0);
607
+ let active = -1;
608
+ if (tc < 2 * count * slotDur) {
609
+ const slot = Math.floor(tc / slotDur);
610
+ const p = (tc - slot * slotDur) / slotDur;
611
+ const ep = 1 - (1 - Math.min(1, p / .7)) ** 3;
612
+ if (slot < count) {
613
+ for (let i = 0; i < slot; i++) amount[i] = 1;
614
+ amount[slot] = ep;
615
+ active = slot;
616
+ } else {
617
+ const u = 2 * count - 1 - slot;
618
+ for (let i = 0; i < u; i++) amount[i] = 1;
619
+ amount[u] = 1 - ep;
620
+ active = u;
621
+ }
622
+ }
623
+ return {
624
+ amount,
625
+ active
626
+ };
627
+ }
628
+ function applyMoves(pt3, moves, sc) {
629
+ let [x, y, z] = pt3;
630
+ let inActive = false;
631
+ for (let i = 0; i < moves.length; i++) {
632
+ if (sc.amount[i] <= 0) continue;
633
+ const mv = moves[i];
634
+ const coord = mv.axis === 0 ? x : mv.axis === 1 ? y : z;
635
+ if (coord < mv.lo || coord >= mv.hi) continue;
636
+ if (i === sc.active) inActive = true;
637
+ const a = mv.ang * sc.amount[i];
638
+ const ca = Math.cos(a);
639
+ const sa = Math.sin(a);
640
+ if (mv.axis === 0) {
641
+ const y2 = y * ca - z * sa;
642
+ z = y * sa + z * ca;
643
+ y = y2;
644
+ } else if (mv.axis === 1) {
645
+ const x2 = x * ca + z * sa;
646
+ z = -x * sa + z * ca;
647
+ x = x2;
648
+ } else {
649
+ const x2 = x * ca - y * sa;
650
+ y = x * sa + y * ca;
651
+ x = x2;
652
+ }
653
+ }
654
+ return [
655
+ x,
656
+ y,
657
+ z,
658
+ inActive
659
+ ];
660
+ }
661
+ function makeMoves(count) {
662
+ const moves = [];
663
+ for (let i = 0; i < count; i++) {
664
+ const axis = Math.min(2, Math.floor(hashD(i, 2.3) * 3));
665
+ const lo = -1 + .5 * Math.min(3, Math.floor(hashD(i, 5.9) * 4));
666
+ const dir = hashD(i, 7.7) < .5 ? 1 : -1;
667
+ moves.push({
668
+ axis,
669
+ lo,
670
+ hi: lo + .5,
671
+ ang: dir * Math.PI / 2
672
+ });
673
+ }
674
+ return moves;
675
+ }
676
+ const frameRubik = (size, t, o) => {
677
+ const cx = size / 2;
678
+ const cy = size / 2;
679
+ const R = size / 2 * .82;
680
+ const pt = makeProj(t * .55, .35 + .1 * Math.sin(t * .9), cx, cy, R);
681
+ const rs = radiusScale(size, o.rsPow ?? .6);
682
+ const moveCount = o.moveCount ?? 14;
683
+ const moves = makeMoves(moveCount);
684
+ const sc = solveCycle(t, moveCount, .42, 1.2);
685
+ const dots = [];
686
+ const latRings = o.latRings ?? 15;
687
+ const lonDensity = o.lonDensity ?? 40;
688
+ for (let li = 0; li <= latRings; li++) {
689
+ const lat = -Math.PI / 2 + li / latRings * Math.PI;
690
+ const cosLat = Math.cos(lat);
691
+ const sinLat = Math.sin(lat);
692
+ const lonCount = Math.max(1, Math.round(Math.abs(cosLat) * lonDensity));
693
+ for (let lj = 0; lj < lonCount; lj++) {
694
+ const lon = lj / lonCount * 2 * Math.PI;
695
+ const [x, y, z, inActive] = applyMoves([
696
+ cosLat * Math.cos(lon),
697
+ sinLat,
698
+ cosLat * Math.sin(lon)
699
+ ], moves, sc);
700
+ const [px, py, zr] = pt(x, y, z);
701
+ const depth = (zr + 1) / 2;
702
+ dots.push({
703
+ x: px,
704
+ y: py,
705
+ z: zr,
706
+ r: ((o.rBase ?? .6) + (o.rDepth ?? 1.7) * depth + (inActive ? o.rActive ?? .3 : 0)) * rs,
707
+ white: (o.inkFar ?? .62) - (o.inkSpan ?? .54) * depth - (inActive ? .14 : 0)
708
+ });
709
+ }
710
+ }
711
+ return finalizeFrame(dots, [], o.rMin);
712
+ };
713
+ const frameWave = (size, t, o) => {
714
+ const cx = size / 2;
715
+ const cy = size / 2;
716
+ const R = size / 2 * .874;
717
+ const pt = makeProj(t * .18, .38, cx, cy, 1);
718
+ const rs = radiusScale(size, o.rsPow ?? .6);
719
+ const dots = [];
720
+ const rings = o.rings ?? 15;
721
+ const lonDensity = o.lonDensity ?? 40;
722
+ for (let ri = 0; ri <= rings; ri++) {
723
+ const lat = -Math.PI / 2 + ri / rings * Math.PI;
724
+ const cosLat = Math.cos(lat);
725
+ const sinLat = Math.sin(lat);
726
+ const w = .62 * Math.sin(t * 2.1 - ri * .52) + .38 * Math.sin(t * 1.27 + ri * .83);
727
+ const rr = R * (.88 + .105 * w);
728
+ const lonCount = Math.max(1, Math.round(Math.abs(cosLat) * lonDensity));
729
+ for (let lj = 0; lj < lonCount; lj++) {
730
+ const lon = lj / lonCount * 2 * Math.PI;
731
+ const [px, py, z] = pt(cosLat * Math.cos(lon) * rr, sinLat * rr, cosLat * Math.sin(lon) * rr);
732
+ const depth = (z / R + 1) / 2;
733
+ const crest = Math.max(0, w);
734
+ dots.push({
735
+ x: px,
736
+ y: py,
737
+ z,
738
+ r: ((o.rBase ?? .6) + (o.rDepth ?? 1.7) * depth) * (1 + .4 * crest) * rs,
739
+ white: .66 - .56 * depth - .1 * crest
740
+ });
741
+ }
742
+ }
743
+ return finalizeFrame(dots, [], o.rMin);
744
+ };
745
+ const frameOrbits = (size, t, o) => {
746
+ const cx = size / 2;
747
+ const cy = size / 2;
748
+ const R = size / 2 * .82;
749
+ const pt = makeProj(t * .12, .3, cx, cy, 1);
750
+ const rs = radiusScale(size, o.rsPow ?? .6);
751
+ const dots = [];
752
+ const orbitN = o.orbitN ?? 12;
753
+ const ghostN = o.ghostN ?? 40;
754
+ const particles = o.particles ?? 3;
755
+ for (let orb = 0; orb < orbitN; orb++) {
756
+ const h1 = hashD(orb, 1.7);
757
+ const h2 = hashD(orb, 5.2);
758
+ const h3 = hashD(orb, 8.9);
759
+ const ro = R * (.45 + .52 * h1);
760
+ const th = h1 * 2 * Math.PI;
761
+ const phi = Math.acos(2 * h2 - 1);
762
+ const nx = Math.sin(phi) * Math.cos(th);
763
+ const ny = Math.cos(phi);
764
+ const nz = Math.sin(phi) * Math.sin(th);
765
+ let ux = -ny;
766
+ let uy = nx;
767
+ const uz = 0;
768
+ const ul = Math.max(1e-6, Math.sqrt(ux * ux + uy * uy));
769
+ ux /= ul;
770
+ uy /= ul;
771
+ const vx = ny * uz - nz * uy;
772
+ const vy = nz * ux - nx * uz;
773
+ const vz = nx * uy - ny * ux;
774
+ const speed = (.25 + .55 * h3) * (h3 > .5 ? 1 : -1);
775
+ for (let k = 0; k < ghostN; k++) {
776
+ const a = k / ghostN * 2 * Math.PI;
777
+ 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);
778
+ const depth = (z / ro + 1) / 2;
779
+ dots.push({
780
+ x: px,
781
+ y: py,
782
+ z,
783
+ r: (o.ghostR ?? .9) * rs,
784
+ white: .72,
785
+ a: (o.ghostA ?? .5) * (.4 + .6 * depth)
786
+ });
787
+ }
788
+ for (let m = 0; m < particles; m++) {
789
+ const a = t * speed + m / particles * 2 * Math.PI + h2 * 6;
790
+ 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);
791
+ const depth = (z / ro + 1) / 2;
792
+ dots.push({
793
+ x: px,
794
+ y: py,
795
+ z,
796
+ r: ((o.partR ?? 1.2) + (o.partRDepth ?? 1.6) * depth) * rs,
797
+ white: .3 - .22 * depth
798
+ });
799
+ }
800
+ }
801
+ return finalizeFrame(dots, [], o.rMin);
802
+ };
803
+ const frameRibbon = (size, t, o) => {
804
+ const cx = size / 2;
805
+ const cy = size / 2;
806
+ const R = size / 2 * .78;
807
+ const spin = o.spin ?? 1;
808
+ const camTilt = .3;
809
+ const pt = makeProj(t * .1 * spin, camTilt, cx, cy, 1);
810
+ const rs = radiusScale(size, o.rsPow ?? .6);
811
+ const dots = [];
812
+ const ghostN = o.ghostN ?? 150;
813
+ for (let i = 0; i < ghostN; i++) {
814
+ const d = fibDir(i, ghostN);
815
+ const [px, py, z] = pt(d[0] * R, d[1] * R, d[2] * R);
816
+ const depth = (z / R + 1) / 2;
817
+ dots.push({
818
+ x: px,
819
+ y: py,
820
+ z,
821
+ r: .8 * rs,
822
+ white: .78,
823
+ a: .1 + .22 * depth
824
+ });
825
+ }
826
+ const ya = t * .24 * spin;
827
+ const ta = o.faceOn ? -camTilt : .55 + .3 * Math.sin(t * .18) * spin;
828
+ const ux = Math.cos(ya);
829
+ const uy = 0;
830
+ const uz = Math.sin(ya);
831
+ const vx = -uz * Math.sin(ta);
832
+ const vy = Math.cos(ta);
833
+ const vz = ux * Math.sin(ta);
834
+ const nx = uy * vz - uz * vy;
835
+ const ny = uz * vx - ux * vz;
836
+ const nz = ux * vy - uy * vx;
837
+ const wobAmp = .23 * (o.wobMul ?? 1);
838
+ const baseR = o.faceOn ? R / (1 + .85 * wobAmp) : R;
839
+ const baseLanes = o.lanes ?? 5;
840
+ const segs = o.segs ?? 88;
841
+ const lanes = Math.max(1, Math.round(baseLanes * (o.bandMul ?? 1)));
842
+ for (let w = 0; w < lanes; w++) {
843
+ const laneOff = (w - (lanes - 1) / 2) * .075;
844
+ const edge = Math.abs(w - (lanes - 1) / 2) / Math.max(1, (lanes - 1) / 2);
845
+ for (let k = 0; k < segs; k++) {
846
+ const a = k / segs * 2 * Math.PI;
847
+ const wob = (.16 * Math.sin(a * 3 - t * 1.7 + w * .22) + .07 * Math.sin(a * 5 + t * 1.1)) * (o.wobMul ?? 1);
848
+ const radial = o.faceOn ? 1 + wob : 1;
849
+ const off$1 = o.faceOn ? laneOff : laneOff + wob;
850
+ const x = ux * Math.cos(a) + vx * Math.sin(a) + nx * off$1;
851
+ const y = uy * Math.cos(a) + vy * Math.sin(a) + ny * off$1;
852
+ const z = uz * Math.cos(a) + vz * Math.sin(a) + nz * off$1;
853
+ const l = Math.sqrt(x * x + y * y + z * z);
854
+ const rr = baseR * radial;
855
+ const [px, py, zr] = pt(x / l * rr, y / l * rr, z / l * rr);
856
+ const depth = (zr / R + 1) / 2;
857
+ dots.push({
858
+ x: px,
859
+ y: py,
860
+ z: zr,
861
+ r: ((o.rBase ?? 1.1) + (o.rDepth ?? 1.7) * depth) * (1 - .25 * edge) * rs,
862
+ white: .52 - .44 * depth + .18 * edge,
863
+ a: .4 + .6 * depth
864
+ });
865
+ }
866
+ }
867
+ return finalizeFrame(dots, [], o.rMin);
868
+ };
869
+ function smoothE(x) {
870
+ return x * x * (3 - 2 * x);
871
+ }
872
+ function polyPath(verts) {
873
+ const V = verts.length;
874
+ const L = [];
875
+ let total = 0;
876
+ for (let i = 0; i < V; i++) {
877
+ const a = verts[i];
878
+ const b = verts[(i + 1) % V];
879
+ const l = Math.hypot(b[0] - a[0], b[1] - a[1]);
880
+ L.push(l);
881
+ total += l;
882
+ }
883
+ return (f) => {
884
+ let target = f * total;
885
+ let i = 0;
886
+ while (target > L[i] && i < V - 1) {
887
+ target -= L[i];
888
+ i++;
889
+ }
890
+ const a = verts[i];
891
+ const b = verts[(i + 1) % V];
892
+ const ff = L[i] ? Math.min(1, target / L[i]) : 0;
893
+ return [a[0] + (b[0] - a[0]) * ff, a[1] + (b[1] - a[1]) * ff];
894
+ };
895
+ }
896
+ var CIRCLE = (f) => {
897
+ const a = -Math.PI / 2 + f * 2 * Math.PI;
898
+ return [Math.cos(a) * .24, Math.sin(a) * .24];
899
+ };
900
+ var CYCLE = [
901
+ CIRCLE,
902
+ polyPath([
903
+ [0, -.26],
904
+ [.24, .16],
905
+ [-.24, .16]
906
+ ]),
907
+ polyPath([
908
+ [0, -.2],
909
+ [.2, -.2],
910
+ [.2, .2],
911
+ [-.2, .2],
912
+ [-.2, -.2]
913
+ ])
914
+ ];
915
+ function morphN(d) {
916
+ return Math.max(6, Math.round(34 * d));
917
+ }
918
+ var HOLD = 1.4;
919
+ var MORPH = .9;
920
+ var SEG = HOLD + MORPH;
921
+ const frameMorph = (size, t, o) => {
922
+ const K = CYCLE.length;
923
+ const tc = t % (SEG * K);
924
+ const k = Math.floor(tc / SEG);
925
+ const local = tc - k * SEG;
926
+ const m = local > HOLD ? smoothE((local - HOLD) / MORPH) : 0;
927
+ const sprd = o.spread ?? 1;
928
+ const pA = CYCLE[k];
929
+ const pB = CYCLE[(k + 1) % K];
930
+ const M = 160;
931
+ const pts = [];
932
+ for (let i = 0; i < M; i++) {
933
+ const f = i / M;
934
+ const a = pA(f);
935
+ const b = pB(f);
936
+ pts.push([(a[0] + (b[0] - a[0]) * m) * sprd, (a[1] + (b[1] - a[1]) * m) * sprd]);
937
+ }
938
+ const L = [];
939
+ let total = 0;
940
+ for (let i = 0; i < M; i++) {
941
+ const a = pts[i];
942
+ const b = pts[(i + 1) % M];
943
+ const l = Math.hypot(b[0] - a[0], b[1] - a[1]);
944
+ L.push(l);
945
+ total += l;
946
+ }
947
+ const n = morphN(o.iconD ?? 1);
948
+ const re = (o.rDot ?? .021) * 1.35 * sprd;
949
+ const pulse = 1 + .02 * Math.sin(local * 3.1);
950
+ const dots = [];
951
+ const c2 = size / 2;
952
+ let seg = 0;
953
+ let acc = 0;
954
+ for (let k2 = 0; k2 < n; k2++) {
955
+ const target = k2 / n * total;
956
+ while (acc + L[seg] < target && seg < M - 1) {
957
+ acc += L[seg];
958
+ seg++;
959
+ }
960
+ const a = pts[seg];
961
+ const b = pts[(seg + 1) % M];
962
+ const f = L[seg] ? Math.min(1, (target - acc) / L[seg]) : 0;
963
+ const x = (a[0] + (b[0] - a[0]) * f) * pulse;
964
+ const y = (a[1] + (b[1] - a[1]) * f) * pulse;
965
+ dots.push({
966
+ x: c2 + x * size,
967
+ y: c2 + y * size,
968
+ z: 0,
969
+ r: Math.max(.35, re * size),
970
+ white: .1
971
+ });
972
+ }
973
+ return finalizeFrame(dots, [], o.rMin);
974
+ };
975
+ const earthPointData = {
976
+ "20": {
977
+ rings: 9,
978
+ flags: "01100000000000000000000000000000100010000100000011000110011000000000011111100000011001001100011000111010"
979
+ },
980
+ "32": {
981
+ rings: 17,
982
+ flags: "011001001111000000000000000000000100000000000000000000010000000000000000000000000110000010000000101000000000000111000001110000001110000000000001111000011100000000000000000000001110000011110000001000000000000000100000111111000000000000000000100000001111111010100000000000011000000110011111111000000011110000101001111100000011110001111111100011100001111111000000010000"
983
+ },
984
+ "48": {
985
+ rings: 29,
986
+ flags: "111011111111001011001111111100000000000000101111000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000001000000000000001100000000000000000000000001100000000000000000001100000000001100000000000011111000000000000000000001110000000001110100000000001111100000000000000000000011111000000001111010000000000011100000000000000000000001111110000000011110000000000000001100000000000000000000011111111000000011111000000000000000010100000000000000000000111100000000001111100000000000100000000000000000000000000011100000000111111111000001000000000000000000000000000000100000000001111111111000001000100000000000000000000000101001000000001111111111100110110000000000000000000001110010000000001111111111001111111100000000000000000111110000000000111110111111111111000000000000000011111100000000100001111111111110010000000000011111100000000101101111111111100000000000111111010000011111111111111100000000011110100000100111111111110100011111010100010111111111111111010010001011111110001001100001000000110000000"
987
+ },
988
+ "64": {
989
+ rings: 37,
990
+ flags: "111011111111011110011111111100000001000111111111110000000000000000001101111100000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000011100000000000010000000000000001000111000000000000000000000000111100000000000011100000000000000011111110000000000000000000000000111100000000000011110100000000000011111110000000000000000000000000001111110000000000111100100000000000000111110000000000000000000000000001111111100000000001111110100000000000000011000000000000000000000000000001111111110000000000111110000000000000000000000001000000000000000000000000111111111000000000011111100000000000000000000100000000000000000000000000001111110000000000001111111000000000000101100000000000000000000000000000000001111100000000000011111111000000000011001000000000000000000000000000000000001100000000011111111111110000010000010000000000000000000000000000000011000000000000011111111111110000011000110000000000000000000000000000011000010000000000111111111111111000110011000000000000000000000000000011000100000000000111111111111110011111111110000000000000000000000011100000000000000011111111111111111111111100000000000000000000011111110000000000001110000111111111111110000000000000000000011111110000000000010000011101111111111000000000000000000011111111000000000010110010111111111111000000000000001111111101000000111111111111111111110000000000001111101110000011111111111111111110000000001111100100000010101111111111110010011111111010100000111111111111111101111010011000011111111111100001110110000001110000001011101000000000000000000"
991
+ },
992
+ "96": {
993
+ rings: 53,
994
+ flags: "111111111111001111011111111100111110011111111111110000110111000111111111111110000000000001000000111111111111111100000000000000000000000000110111111110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000001100000000000000000000000000000000000000000000000001000000000000000000000000011100000000000000000000000000000000000000000000000000001000000000000000000000000011110000000000000000000000000000000000000000000000110000001000000000000000000000000000111100000000000000000011000000000000000000000010000111000000000000000000000000000000000001111100000000000000000111100000000000000000000011111111110000000000000000000000000000000000011111100000000000000001111100000000000000000000011111111110000000000000000000000000000000000000111111100000000000000001111110010000000000000000001111111111000000000000000000000000000000000000001111111100000000000000011111100100000000000000000000111111110000000000000000000000000000000000000001111111110000000000000011111111011000000000000000000001111101000000000000000000000000000000000000000111111111110000000000000001111111100000000000000000000000001101000000000000000000000000000000000000000011111111111100000000000000111111110000000000000000000000000000000100000000000000000000000000000000000000111111111111100000000000000111111100000000000000000000110000000111000000000000000000000000000000000000000111111111111000000000000000111111110000000000000000000101101000111000000000000000000000000000000000000000011111111100000000000000000111111111100000000000000000100110000000000000000000000000000000000000000000000000111111100000000000000000011111111111000000000000000110001000000000000000000000000000000000000000000000000111111000000000000001111111111111111100000000010000010000001000000000000000000000000000000000000000000000011100000000000000111111111111111111100000000000000000000000000000000000000000000000000000000000000011000000000000000000011111111111111111110000000110000011100000000000000000000000000000000000000000001110000000000000000000011111111111111110111000000110001111000000000000000000000000000000000000000001100100010000000000000001111111111111110111110000111101111000000000000000000000000000000000000000011100000000000000000000001111111111111111111100111111111111111000000000000000000000000000000000011100001000000000000000001111111111110111011111111111111111100000000000000000000000000000000111111110000000000000000000111111111111111111111111111111111000000000000000000000000000000111111111000000000000000000111100000011111111111111111111100100000000000000000000000001111111111100000000000000011000000011111011111111111111100100000000000000000000000011111111111000000000000000110100111111001111111111111101000000000000000000000001111111111110000000000000011101110010111111111111111111010000000000000000000111111111101010000000000111111111111111111111111111100000000000000000011111111111111000000000111111111111111111111111111100000000000000011111111011110000000000001111111111111111111110001000000000001111110001100000000000010111111111111111111000100000111111111100100010000000101111111111111111111010001111111111111001000100010111111111111111111110111111001010011000001111111111111111111000001111101110000000101111111100000000010011100000000110000000000011110010000000000000101100000000000000000000"
995
+ }
996
+ };
997
+ var cache = /* @__PURE__ */ new Map();
998
+ function getEarthPoints(size) {
999
+ const hit = cache.get(size);
1000
+ if (hit) return hit;
1001
+ const { rings, flags } = earthPointData[size];
1002
+ const points = [];
1003
+ let index$1 = 0;
1004
+ for (let row = 0; row < rings; row++) {
1005
+ const lat = -Math.PI / 2 + (row + .5) / rings * Math.PI;
1006
+ const count = Math.max(1, Math.round(2 * rings * Math.cos(lat)));
1007
+ for (let col = 0; col < count; col++, index$1++) {
1008
+ const lon = -Math.PI + col / count * 2 * Math.PI;
1009
+ const land = flags[index$1] === "1";
1010
+ if (!land && index$1 % 3 !== 0) continue;
1011
+ points.push({
1012
+ x: Math.cos(lat) * Math.cos(lon),
1013
+ y: Math.sin(lat),
1014
+ z: Math.cos(lat) * Math.sin(lon),
1015
+ lon,
1016
+ land
1017
+ });
1018
+ }
1019
+ }
1020
+ cache.set(size, points);
1021
+ return points;
1022
+ }
1023
+ function frameEarth(size, time) {
1024
+ const project = makeProj(35 * Math.PI / 180 - Math.PI / 2 + time * .22, .18, size / 2, size / 2, size * .43);
1025
+ const dots = [];
1026
+ for (const p of getEarthPoints(size)) {
1027
+ const [x, y, z] = project(p.x, p.y, p.z);
1028
+ if (z <= 0) continue;
1029
+ const scan = Math.exp(-Math.pow(angleDelta(p.lon, time * .9), 2) / .08);
1030
+ const edge = Math.min(1, z / .14);
1031
+ dots.push({
1032
+ x,
1033
+ y,
1034
+ z,
1035
+ r: (size <= 32 ? .48 : .52) * (size / 64) ** .25 * (1 + .2 * z + (p.land ? .22 * scan : 0)),
1036
+ white: p.land ? .08 + .2 * (1 - z) : .65,
1037
+ a: edge * (p.land ? .82 + scan * .18 : .2)
1038
+ });
1039
+ }
1040
+ return finalizeFrame(dots, [], .3);
1041
+ }
1042
+ var frames = {
1043
+ searching: frameGlobe,
1044
+ solving: frameRubik,
1045
+ listening: frameWave,
1046
+ working: frameOrbits,
1047
+ composing: frameRibbon,
1048
+ shaping: frameMorph
1049
+ };
1050
+ function createLoadingFrame(animation, size, time) {
1051
+ if (animation === "earth") return frameEarth(size, time);
1052
+ const { speed, opts } = resolvePreset(animation, size);
1053
+ const frame = frames[animation](size, time * speed, opts);
1054
+ if (size === 20 && frame.dots.length > 120) {
1055
+ const count = frame.dots.length;
1056
+ frame.dots = Array.from({ length: 120 }, (_, i) => frame.dots[Math.floor(i * count / 120)]);
1057
+ }
1058
+ return frame;
1059
+ }
1060
+ function paintLoadingFrame(ctx, frame, color) {
1061
+ ctx.fillStyle = color;
1062
+ for (const dot of frame.dots) {
1063
+ ctx.globalAlpha = Math.max(0, Math.min(1, (dot.a ?? 1) * (1 - dot.white)));
1064
+ ctx.beginPath();
1065
+ ctx.arc(dot.x, dot.y, dot.r, 0, Math.PI * 2);
1066
+ ctx.fill();
1067
+ }
1068
+ ctx.globalAlpha = 1;
1069
+ }
1070
+ function useLoadingAnimation(canvas, options, color) {
1071
+ const available = (0, vue.ref)(true);
1072
+ let ctx = null;
1073
+ let raf;
1074
+ let previous;
1075
+ let elapsed = 0;
1076
+ let enabled = true;
1077
+ let inView = true;
1078
+ let reduced = false;
1079
+ let mounted = false;
1080
+ let dpr = 1;
1081
+ let observer;
1082
+ let motion;
1083
+ const stop = () => {
1084
+ if (raf !== void 0) cancelAnimationFrame(raf);
1085
+ raf = void 0;
1086
+ previous = void 0;
1087
+ };
1088
+ const running = () => mounted && ctx && enabled && inView && options().active && !options().paused && !reduced && document.visibilityState !== "hidden";
1089
+ const paint = () => {
1090
+ if (!ctx || !canvas.value) return;
1091
+ const size = normalizeSize(options().size);
1092
+ const ratio = Math.min(2, Math.max(1, window.devicePixelRatio || 1));
1093
+ if (canvas.value.width !== Math.round(size * ratio) || ratio !== dpr) {
1094
+ canvas.value.width = Math.round(size * ratio);
1095
+ canvas.value.height = Math.round(size * ratio);
1096
+ }
1097
+ dpr = ratio;
1098
+ ctx.setTransform(dpr, 0, 0, dpr, 0, 0);
1099
+ ctx.clearRect(0, 0, size, size);
1100
+ try {
1101
+ paintLoadingFrame(ctx, createLoadingFrame(normalizeAnimation(options().animation), size, reduced ? .6 : elapsed), color.value);
1102
+ } catch {
1103
+ available.value = false;
1104
+ ctx = null;
1105
+ stop();
1106
+ }
1107
+ };
1108
+ const tick = (now) => {
1109
+ raf = void 0;
1110
+ if (!running()) {
1111
+ previous = void 0;
1112
+ return;
1113
+ }
1114
+ if (previous !== void 0) elapsed += Math.min(100, now - previous) / 1e3 * normalizeSpeed(options().speed);
1115
+ previous = now;
1116
+ paint();
1117
+ if (running()) raf = requestAnimationFrame(tick);
1118
+ };
1119
+ const sync = () => {
1120
+ if (!mounted) return;
1121
+ if (!running()) stop();
1122
+ if (options().active && inView && enabled && document.visibilityState !== "hidden") paint();
1123
+ if (running() && raf === void 0) raf = requestAnimationFrame(tick);
1124
+ };
1125
+ const motionChange = () => {
1126
+ reduced = motion?.matches ?? false;
1127
+ sync();
1128
+ };
1129
+ (0, vue.watch)(() => [
1130
+ options().active,
1131
+ options().paused,
1132
+ options().animation,
1133
+ options().size,
1134
+ options().speed,
1135
+ color.value
1136
+ ], sync, { flush: "post" });
1137
+ (0, vue.onMounted)(() => {
1138
+ mounted = true;
1139
+ try {
1140
+ ctx = canvas.value?.getContext("2d") ?? null;
1141
+ } catch {
1142
+ ctx = null;
1143
+ }
1144
+ available.value = !!ctx;
1145
+ motion = window.matchMedia?.("(prefers-reduced-motion: reduce)");
1146
+ reduced = motion?.matches ?? false;
1147
+ motion?.addEventListener("change", motionChange);
1148
+ if (typeof IntersectionObserver !== "undefined" && canvas.value) {
1149
+ observer = new IntersectionObserver(([entry]) => {
1150
+ inView = entry.isIntersecting;
1151
+ sync();
1152
+ });
1153
+ observer.observe(canvas.value);
1154
+ }
1155
+ document.addEventListener("visibilitychange", sync);
1156
+ window.addEventListener("resize", sync);
1157
+ sync();
1158
+ });
1159
+ (0, vue.onActivated)(() => {
1160
+ enabled = true;
1161
+ sync();
1162
+ });
1163
+ (0, vue.onDeactivated)(() => {
1164
+ enabled = false;
1165
+ stop();
1166
+ });
1167
+ (0, vue.onScopeDispose)(() => {
1168
+ mounted = false;
1169
+ stop();
1170
+ observer?.disconnect();
1171
+ motion?.removeEventListener("change", motionChange);
1172
+ if (typeof document !== "undefined") document.removeEventListener("visibilitychange", sync);
1173
+ if (typeof window !== "undefined") window.removeEventListener("resize", sync);
1174
+ ctx = null;
1175
+ });
1176
+ return { available };
1177
+ }
1178
+ var _hoisted_1$8 = [
1179
+ "role",
1180
+ "aria-live",
1181
+ "aria-hidden",
1182
+ "aria-label"
1183
+ ];
1184
+ var FlLoading_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ (0, vue.defineComponent)({
1185
+ name: "FlLoading",
1186
+ __name: "FlLoading",
1187
+ props: flLoadingProps,
1188
+ setup(__props) {
1189
+ const props = __props;
1190
+ const ns = useNamespace("loading");
1191
+ const root = (0, vue.ref)();
1192
+ const canvas = (0, vue.ref)();
1193
+ const resolvedSize = (0, vue.computed)(() => normalizeSize(props.size));
1194
+ const resolvedColor = useLoadingColor(() => root.value, () => props);
1195
+ const { available } = useLoadingAnimation(canvas, () => props, resolvedColor);
1196
+ return (_ctx, _cache) => {
1197
+ return (0, vue.openBlock)(), (0, vue.createElementBlock)("span", {
1198
+ ref_key: "root",
1199
+ ref: root,
1200
+ class: (0, vue.normalizeClass)([
1201
+ (0, vue.unref)(ns).b(),
1202
+ (0, vue.unref)(ns).m(_ctx.layout),
1203
+ (0, vue.unref)(ns).is("inactive", !_ctx.active)
1204
+ ]),
1205
+ style: (0, vue.normalizeStyle)({ "--fl-loading-size": `${resolvedSize.value}px` }),
1206
+ role: _ctx.active ? "status" : void 0,
1207
+ "aria-live": _ctx.active ? "polite" : "off",
1208
+ "aria-hidden": !_ctx.active || void 0,
1209
+ "aria-label": !_ctx.text && !_ctx.$slots.text ? _ctx.ariaLabel : void 0
1210
+ }, [(0, vue.createElementVNode)("span", {
1211
+ class: (0, vue.normalizeClass)((0, vue.unref)(ns).e("visual")),
1212
+ "aria-hidden": "true"
1213
+ }, [(0, vue.withDirectives)((0, vue.createElementVNode)("canvas", {
1214
+ ref_key: "canvas",
1215
+ ref: canvas,
1216
+ class: (0, vue.normalizeClass)((0, vue.unref)(ns).e("canvas")),
1217
+ style: (0, vue.normalizeStyle)({
1218
+ width: `${resolvedSize.value}px`,
1219
+ height: `${resolvedSize.value}px`
1220
+ })
1221
+ }, null, 6), [[vue.vShow, (0, vue.unref)(available)]]), !(0, vue.unref)(available) ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("span", {
1222
+ key: 0,
1223
+ class: (0, vue.normalizeClass)((0, vue.unref)(ns).e("fallback")),
1224
+ style: (0, vue.normalizeStyle)({ color: (0, vue.unref)(resolvedColor) })
1225
+ }, "●", 6)) : (0, vue.createCommentVNode)("v-if", true)], 2), _ctx.text || _ctx.$slots.text ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("span", {
1226
+ key: 0,
1227
+ class: (0, vue.normalizeClass)((0, vue.unref)(ns).e("text"))
1228
+ }, [(0, vue.renderSlot)(_ctx.$slots, "text", {}, () => [(0, vue.createTextVNode)((0, vue.toDisplayString)(_ctx.text), 1)])], 2)) : (0, vue.createCommentVNode)("v-if", true)], 14, _hoisted_1$8);
1229
+ };
1230
+ }
1231
+ });
1232
+ var FlLoading_default = FlLoading_vue_vue_type_script_setup_true_lang_default;
1233
+ function useFlLoading(active, options = {}) {
1234
+ const ns = useNamespace("loading");
1235
+ const alive = (0, vue.ref)(true);
1236
+ const generation = (0, vue.ref)(0);
1237
+ const resolved = (0, vue.computed)(() => (0, vue.toValue)(options));
1238
+ const color = useLoadingColor(() => (0, vue.toValue)(resolved.value.themeTarget), () => resolved.value);
1239
+ (0, vue.watch)(() => (0, vue.toValue)(active), () => generation.value++, { flush: "sync" });
1240
+ (0, vue.onScopeDispose)(() => {
1241
+ alive.value = false;
1242
+ });
1243
+ const Content = (0, vue.defineComponent)({
1244
+ name: "FlLoadingContent",
1245
+ props: { generation: {
1246
+ type: Number,
1247
+ required: true
1248
+ } },
1249
+ setup(props) {
1250
+ const ownGeneration = props.generation;
1251
+ return () => {
1252
+ const { background: _background, customClass: _customClass, themeTarget: _target, ...visual } = resolved.value;
1253
+ return (0, vue.h)(FlLoading_default, {
1254
+ layout: "vertical",
1255
+ ...visual,
1256
+ color: color.value,
1257
+ active: alive.value && (0, vue.toValue)(active) && ownGeneration === generation.value
1258
+ });
1259
+ };
1260
+ }
1261
+ });
1262
+ return (0, vue.computed)(() => {
1263
+ if (!alive.value || !(0, vue.toValue)(active)) return false;
1264
+ return {
1265
+ text: (0, vue.h)(Content, { generation: generation.value }),
1266
+ customClass: [ns.b("adapter"), resolved.value.customClass].filter(Boolean).join(" "),
1267
+ background: resolved.value.background
1268
+ };
1269
+ });
1270
+ }
1271
+ const FlLoading = withInstall(FlLoading_default);
147
1272
  const flDialogProps = {
148
1273
  bodyHeight: {
149
1274
  type: [Number, String],
@@ -7988,17 +9113,17 @@ var resolveColumnKey = (path) => {
7988
9113
  return first || path;
7989
9114
  };
7990
9115
  const createTableProxyDataBuilder = () => {
7991
- const cache = /* @__PURE__ */ new WeakMap();
9116
+ const cache$2 = /* @__PURE__ */ new WeakMap();
7992
9117
  const runtime = {
7993
9118
  onCellChange: () => void 0,
7994
9119
  resolveRowIndex: () => -1,
7995
9120
  rowKeyField: "id",
7996
9121
  maxDepth: 4
7997
9122
  };
7998
- const getCachedProxy = (target, path) => cache.get(target)?.get(path);
9123
+ const getCachedProxy = (target, path) => cache$2.get(target)?.get(path);
7999
9124
  const setCachedProxy = (target, path, proxy) => {
8000
- if (!cache.has(target)) cache.set(target, /* @__PURE__ */ new Map());
8001
- cache.get(target)?.set(path, proxy);
9125
+ if (!cache$2.has(target)) cache$2.set(target, /* @__PURE__ */ new Map());
9126
+ cache$2.get(target)?.set(path, proxy);
8002
9127
  };
8003
9128
  const toNullableRow = (value) => {
8004
9129
  if (!isObjectLike(value)) return null;
@@ -9438,6 +10563,7 @@ exports.FlDialog = FlDialog;
9438
10563
  exports.FlInput = FlInput;
9439
10564
  exports.FlInputNumber = FlInputNumber;
9440
10565
  exports.FlInputSearch = FlInputSearch;
10566
+ exports.FlLoading = FlLoading;
9441
10567
  exports.FlQrCode = FlQrCode;
9442
10568
  exports.FlRadialMenu = FlRadialMenu;
9443
10569
  exports.FlRadialMenuItem = FlRadialMenuItem;
@@ -9446,5 +10572,6 @@ exports.FlTable = FlTable;
9446
10572
  exports.FlTableEditor = FlTableEditor;
9447
10573
  exports.FlTree = FlTree;
9448
10574
  exports.FlTreeSelect = FlTreeSelect;
10575
+ exports.useFlLoading = useFlLoading;
9449
10576
 
9450
10577
  //# sourceMappingURL=index.cjs.map