@flux-ui/application 3.0.0-next.75 → 3.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.
package/README.md CHANGED
@@ -33,4 +33,3 @@ Integrates with `vue-router` for navigation-aware behavior.
33
33
  - [`@flux-ui/types`](../types)
34
34
  - [`@flux-ui/internals`](../internals)
35
35
  - [`@flux-ui/statistics`](../statistics)
36
- - [`@flux-ui/dashboard`](../dashboard)
@@ -26,5 +26,6 @@ export type FluxApplicationInjection = {
26
26
  goToParent(): void;
27
27
  pushContext(info: FluxApplicationContextInfo): void;
28
28
  removeContext(id: symbol): void;
29
+ updateContext(id: symbol, info: Omit<FluxApplicationContextInfo, 'id'>): void;
29
30
  };
30
31
  export type FluxApplicationLayout = 'default' | 'dashboard' | 'full' | 'medium' | 'narrow';
package/dist/index.css CHANGED
@@ -41,7 +41,7 @@
41
41
  background: var(--overlay);
42
42
  backdrop-filter: blur(3px) saturate(180%);
43
43
  transition: var(--application-duration) var(--swift-out);
44
- transition-property: background, backdrop-filter, opacity;
44
+ transition-property: background, backdrop-filter, opacity, visibility;
45
45
  z-index: 1900;
46
46
  }
47
47
 
@@ -61,6 +61,7 @@
61
61
  display: block;
62
62
  }
63
63
  .application:has(> .application-menu[data-collapsed]) .application-menu-backdrop {
64
+ visibility: hidden;
64
65
  pointer-events: none;
65
66
  opacity: 0;
66
67
  }
@@ -401,66 +402,6 @@ html[data-application-resizing] .application-menu-backdrop {
401
402
  font-size: 14px;
402
403
  }
403
404
 
404
- .application-menu-context-pill {
405
- position: relative;
406
- display: flex;
407
- flex-flow: row nowrap;
408
- gap: 9px;
409
- align-items: center;
410
- margin: -3px -6px 6px;
411
- padding: 9px 12px;
412
- cursor: pointer;
413
- color: var(--foreground-secondary);
414
- background: transparent;
415
- border: 1px solid var(--application-menu-surface-stroke);
416
- border-radius: var(--radius);
417
- transition: background 200ms var(--swift-out);
418
- }
419
- @media (hover: hover) {
420
- .application-menu-context-pill:hover {
421
- background: var(--gray-200);
422
- }
423
- }
424
- .application-menu-context-pill:active {
425
- background: var(--gray-300);
426
- }
427
- .application-menu-context-pill {
428
- outline: 2px solid rgb(from var(--primary-600) r g b/0);
429
- outline-offset: 0;
430
- }
431
- .application-menu-context-pill:focus-visible {
432
- outline-color: var(--primary-600);
433
- outline-offset: 0;
434
- }
435
-
436
- .application-menu-context-pill-content {
437
- display: flex;
438
- flex: 1 1 auto;
439
- flex-flow: column;
440
- min-width: 0;
441
- }
442
- .application-menu-context-pill-content strong {
443
- font-weight: 500;
444
- font-size: 14px;
445
- line-height: 1.2;
446
- white-space: nowrap;
447
- overflow: hidden;
448
- color: var(--foreground-prominent);
449
- text-overflow: ellipsis;
450
- transition: var(--application-duration) var(--swift-out);
451
- transition-property: filter, opacity, translate;
452
- }
453
- .application-menu-context-pill-content span {
454
- font-size: 12px;
455
- line-height: 1.2;
456
- white-space: nowrap;
457
- overflow: hidden;
458
- color: var(--foreground-secondary);
459
- text-overflow: ellipsis;
460
- transition: var(--application-duration) var(--swift-out);
461
- transition-property: filter, opacity, translate;
462
- }
463
-
464
405
  .application-menu-promo {
465
406
  display: flex;
466
407
  padding: 12px;
package/dist/index.js CHANGED
@@ -15,12 +15,62 @@ function x(e) {
15
15
  } while (e = Object.getPrototypeOf(e));
16
16
  return t;
17
17
  }
18
+ function R(e) {
19
+ return globalThis.document ? e instanceof HTMLElement : !1;
20
+ }
18
21
  function G(e, t, n) {
19
22
  e.prototype[t] = n;
20
23
  }
21
24
  function K(e, t, n) {
22
25
  Object.defineProperty(e, t, { value: n });
23
26
  }
27
+ [
28
+ `a[href]:not([disabled])`,
29
+ `button:not([disabled])`,
30
+ `input:not([type=hidden]):not([disabled])`,
31
+ `select:not([disabled])`,
32
+ `textarea:not([disabled])`,
33
+ `[contenteditable]:not([contenteditable=false])`,
34
+ `[tabindex]:not([disabled]):not([tabindex="-1"])`
35
+ ].join(`,`);
36
+ function v(e) {
37
+ let r = unref(e);
38
+ return R(r) ? r : r?.$el;
39
+ }
40
+ new class {
41
+ get active() {
42
+ return this.current?.isEnabled ?? !1;
43
+ }
44
+ get current() {
45
+ return this.#t[this.#t.length - 1] ?? null;
46
+ }
47
+ #e = [];
48
+ #t = [];
49
+ add(e, t, n = !0) {
50
+ let r = {
51
+ id: e,
52
+ setEnabled: t,
53
+ isEnabled: !1
54
+ };
55
+ n ? (this.current && this.toggle(this.current, !1), this.#t.push(r), this.toggle(r, !0)) : this.#t.push(r), this.emit();
56
+ }
57
+ remove(e) {
58
+ let t = this.#t.find((t) => t.id === e);
59
+ t && this.toggle(t, !1);
60
+ let n = this.current?.id === e;
61
+ this.#t = this.#t.filter((t) => t.id !== e), n && this.current && this.toggle(this.current, !0), this.emit();
62
+ }
63
+ emit() {
64
+ this.#e.forEach((e) => e(this.active, this.#t));
65
+ }
66
+ subscribe(e) {
67
+ return this.#e.push(e), e(this.active, this.#t), () => this.#e = this.#e.filter((t) => t !== e);
68
+ }
69
+ toggle(e, t) {
70
+ e.setEnabled(t), e.isEnabled = t;
71
+ }
72
+ }();
73
+ var C = !globalThis.document;
24
74
  //#endregion
25
75
  //#region ../../node_modules/.bun/culori@4.0.2/node_modules/culori/src/rgb/parseNumber.js
26
76
  var parseNumber = (color, len) => {
@@ -783,7 +833,7 @@ var hue = (hues, fn) => {
783
833
  var fixupHueShorter = (arr) => hue(arr, (d) => Math.abs(d) <= 180 ? d : d - 360 * Math.sign(d));
784
834
  //#endregion
785
835
  //#region ../../node_modules/.bun/culori@4.0.2/node_modules/culori/src/cubehelix/constants.js
786
- var M = [
836
+ var M$1 = [
787
837
  -.14861,
788
838
  1.78277,
789
839
  -.29227,
@@ -795,20 +845,20 @@ var degToRad = Math.PI / 180;
795
845
  var radToDeg = 180 / Math.PI;
796
846
  //#endregion
797
847
  //#region ../../node_modules/.bun/culori@4.0.2/node_modules/culori/src/cubehelix/convertRgbToCubehelix.js
798
- var DE = M[3] * M[4];
799
- var BE = M[1] * M[4];
800
- var BCAD = M[1] * M[2] - M[0] * M[3];
848
+ var DE = M$1[3] * M$1[4];
849
+ var BE = M$1[1] * M$1[4];
850
+ var BCAD = M$1[1] * M$1[2] - M$1[0] * M$1[3];
801
851
  var convertRgbToCubehelix = ({ r, g, b, alpha }) => {
802
852
  if (r === void 0) r = 0;
803
853
  if (g === void 0) g = 0;
804
854
  if (b === void 0) b = 0;
805
855
  let l = (BCAD * b + r * DE - g * BE) / (BCAD + DE - BE);
806
856
  let x = b - l;
807
- let y = (M[4] * (g - l) - M[2] * x) / M[3];
857
+ let y = (M$1[4] * (g - l) - M$1[2] * x) / M$1[3];
808
858
  let res = {
809
859
  mode: "cubehelix",
810
860
  l,
811
- s: l === 0 || l === 1 ? void 0 : Math.sqrt(x * x + y * y) / (M[4] * l * (1 - l))
861
+ s: l === 0 || l === 1 ? void 0 : Math.sqrt(x * x + y * y) / (M$1[4] * l * (1 - l))
812
862
  };
813
863
  if (res.s) res.h = Math.atan2(y, x) * radToDeg - 120;
814
864
  if (alpha !== void 0) res.alpha = alpha;
@@ -823,9 +873,9 @@ var convertCubehelixToRgb = ({ h, s, l, alpha }) => {
823
873
  let amp = s === void 0 ? 0 : s * l * (1 - l);
824
874
  let cosh = Math.cos(h);
825
875
  let sinh = Math.sin(h);
826
- res.r = l + amp * (M[0] * cosh + M[1] * sinh);
827
- res.g = l + amp * (M[2] * cosh + M[3] * sinh);
828
- res.b = l + amp * (M[4] * cosh + M[5] * sinh);
876
+ res.r = l + amp * (M$1[0] * cosh + M$1[1] * sinh);
877
+ res.g = l + amp * (M$1[2] * cosh + M$1[3] * sinh);
878
+ res.b = l + amp * (M$1[4] * cosh + M$1[5] * sinh);
829
879
  if (alpha !== void 0) res.alpha = alpha;
830
880
  return res;
831
881
  };
@@ -933,7 +983,7 @@ var convertLchToLab = ({ l, c, h, alpha }, mode = "lab") => {
933
983
  };
934
984
  //#endregion
935
985
  //#region ../../node_modules/.bun/culori@4.0.2/node_modules/culori/src/xyz65/constants.js
936
- var k$4 = Math.pow(29, 3) / Math.pow(3, 3);
986
+ var k$3 = Math.pow(29, 3) / Math.pow(3, 3);
937
987
  var e$2 = Math.pow(6, 3) / Math.pow(29, 3);
938
988
  //#endregion
939
989
  //#region ../../node_modules/.bun/culori@4.0.2/node_modules/culori/src/constants.js
@@ -951,7 +1001,7 @@ Math.pow(29, 3) / Math.pow(3, 3);
951
1001
  Math.pow(6, 3) / Math.pow(29, 3);
952
1002
  //#endregion
953
1003
  //#region ../../node_modules/.bun/culori@4.0.2/node_modules/culori/src/lab65/convertLab65ToXyz65.js
954
- var fn$1 = (v) => Math.pow(v, 3) > e$2 ? Math.pow(v, 3) : (116 * v - 16) / k$4;
1004
+ var fn$1 = (v) => Math.pow(v, 3) > e$2 ? Math.pow(v, 3) : (116 * v - 16) / k$3;
955
1005
  var convertLab65ToXyz65 = ({ l, a, b, alpha }) => {
956
1006
  if (l === void 0) l = 0;
957
1007
  if (a === void 0) a = 0;
@@ -973,7 +1023,7 @@ var convertLab65ToXyz65 = ({ l, a, b, alpha }) => {
973
1023
  var convertLab65ToRgb = (lab) => convertXyz65ToRgb(convertLab65ToXyz65(lab));
974
1024
  //#endregion
975
1025
  //#region ../../node_modules/.bun/culori@4.0.2/node_modules/culori/src/lab65/convertXyz65ToLab65.js
976
- var f$1 = (value) => value > e$2 ? Math.cbrt(value) : (k$4 * value + 16) / 116;
1026
+ var f$1 = (value) => value > e$2 ? Math.cbrt(value) : (k$3 * value + 16) / 116;
977
1027
  var convertXyz65ToLab65 = ({ x, y, z, alpha }) => {
978
1028
  if (x === void 0) x = 0;
979
1029
  if (y === void 0) y = 0;
@@ -1835,11 +1885,11 @@ var definition$16 = {
1835
1885
  };
1836
1886
  //#endregion
1837
1887
  //#region ../../node_modules/.bun/culori@4.0.2/node_modules/culori/src/xyz50/constants.js
1838
- var k$2 = Math.pow(29, 3) / Math.pow(3, 3);
1888
+ var k$1 = Math.pow(29, 3) / Math.pow(3, 3);
1839
1889
  var e = Math.pow(6, 3) / Math.pow(29, 3);
1840
1890
  //#endregion
1841
1891
  //#region ../../node_modules/.bun/culori@4.0.2/node_modules/culori/src/lab/convertLabToXyz50.js
1842
- var fn = (v) => Math.pow(v, 3) > e ? Math.pow(v, 3) : (116 * v - 16) / k$2;
1892
+ var fn = (v) => Math.pow(v, 3) > e ? Math.pow(v, 3) : (116 * v - 16) / k$1;
1843
1893
  var convertLabToXyz50 = ({ l, a, b, alpha }) => {
1844
1894
  if (l === void 0) l = 0;
1845
1895
  if (a === void 0) a = 0;
@@ -1888,7 +1938,7 @@ var convertRgbToXyz50 = (rgb) => {
1888
1938
  };
1889
1939
  //#endregion
1890
1940
  //#region ../../node_modules/.bun/culori@4.0.2/node_modules/culori/src/lab/convertXyz50ToLab.js
1891
- var f = (value) => value > e ? Math.cbrt(value) : (k$2 * value + 16) / 116;
1941
+ var f = (value) => value > e ? Math.cbrt(value) : (k$1 * value + 16) / 116;
1892
1942
  var convertXyz50ToLab = ({ x, y, z, alpha }) => {
1893
1943
  if (x === void 0) x = 0;
1894
1944
  if (y === void 0) y = 0;
@@ -2094,7 +2144,7 @@ var u_fn$1 = (x, y, z) => 4 * x / (x + 15 * y + 3 * z);
2094
2144
  var v_fn$1 = (x, y, z) => 9 * y / (x + 15 * y + 3 * z);
2095
2145
  var un$1 = u_fn$1(D50.X, D50.Y, D50.Z);
2096
2146
  var vn$1 = v_fn$1(D50.X, D50.Y, D50.Z);
2097
- var l_fn = (value) => value <= e ? k$2 * value : 116 * Math.cbrt(value) - 16;
2147
+ var l_fn = (value) => value <= e ? k$1 * value : 116 * Math.cbrt(value) - 16;
2098
2148
  var convertXyz50ToLuv = ({ x, y, z, alpha }) => {
2099
2149
  if (x === void 0) x = 0;
2100
2150
  if (y === void 0) y = 0;
@@ -2134,7 +2184,7 @@ var convertLuvToXyz50 = ({ l, u, v, alpha }) => {
2134
2184
  if (v === void 0) v = 0;
2135
2185
  let up = u / (13 * l) + un;
2136
2186
  let vp = v / (13 * l) + vn;
2137
- let y = D50.Y * (l <= 8 ? l / k$2 : Math.pow((l + 16) / 116, 3));
2187
+ let y = D50.Y * (l <= 8 ? l / k$1 : Math.pow((l + 16) / 116, 3));
2138
2188
  let res = {
2139
2189
  mode: "xyz50",
2140
2190
  x: y * (9 * up) / (4 * vp),
@@ -3610,19 +3660,22 @@ var HttpAdapter = _HttpAdapter = class HttpAdapter {
3610
3660
  HttpAdapter = _HttpAdapter = __decorate([adapter_default], HttpAdapter);
3611
3661
  RegExp(`[a-z]`), RegExp(`[A-Z]`), RegExp(`[0-9]`), RegExp(`[!"#$%&'()*+,-./:;<=>?@[\\\\\\]^_\`{|}~]`);
3612
3662
  //#endregion
3613
- //#region ../internals/dist/composable-CbnFLx66.js
3614
- function D(e, t, n, r = { passive: !0 }) {
3615
- watch(e, (e, i, a) => {
3616
- e && (e.addEventListener(t, n, r), a(() => e.removeEventListener(t, n)));
3663
+ //#region ../internals/dist/composable-DPolUL3R.js
3664
+ function O(t, n, r, i = { passive: !0 }) {
3665
+ watch(t, (a, o, s) => {
3666
+ let c = v(t) ?? (a instanceof EventTarget ? a : null);
3667
+ c && (c.addEventListener(n, r, i), s(() => c.removeEventListener(n, r, i)));
3617
3668
  }, { immediate: !0 });
3618
3669
  }
3619
- function k(e, t) {
3670
+ function A(e, t) {
3671
+ if (C) return ref(t);
3620
3672
  let n = `flux/${e}`, r = ref(i() ?? t);
3621
3673
  function i() {
3622
- if (!(n in localStorage)) return null;
3674
+ let e = localStorage.getItem(n);
3675
+ if (e === null) return null;
3623
3676
  try {
3624
- let e = JSON.parse(localStorage.getItem(n));
3625
- return Array.isArray(e) && e[0] === `DateTime` && (e = DateTime.fromISO(e[1])), e;
3677
+ let t = JSON.parse(e);
3678
+ return Array.isArray(t) && t[0] === `DateTime` && (t = DateTime.fromISO(t[1])), t;
3626
3679
  } catch {
3627
3680
  return null;
3628
3681
  }
@@ -3632,21 +3685,29 @@ function k(e, t) {
3632
3685
  DateTime.isDateTime(e) && (t = [`DateTime`, e.toISO({
3633
3686
  includeOffset: !0,
3634
3687
  extendedZone: !0
3635
- })]), localStorage.setItem(n, JSON.stringify(t));
3688
+ })]);
3689
+ try {
3690
+ localStorage.setItem(n, JSON.stringify(t));
3691
+ } catch {}
3636
3692
  }), r;
3637
3693
  }
3638
- function j(e) {
3694
+ function M(e) {
3639
3695
  let t = ref(0), n = ref(0);
3640
- return e ||= ref(document), D(e, `scroll`, () => {
3641
- let r = unref(e);
3642
- r instanceof Document && (r = r.scrollingElement), t.value = r?.scrollLeft ?? 0, n.value = r?.scrollTop ?? 0;
3643
- }), {
3696
+ if (C) return {
3697
+ x: t,
3698
+ y: n
3699
+ };
3700
+ let r = e ?? ref(document), i = () => {
3701
+ let e = unref(r);
3702
+ e instanceof Document && (e = e.scrollingElement), t.value = e?.scrollLeft ?? 0, n.value = e?.scrollTop ?? 0;
3703
+ };
3704
+ return O(r, `scroll`, i), watch(r, () => i(), { immediate: !0 }), {
3644
3705
  x: t,
3645
3706
  y: n
3646
3707
  };
3647
3708
  }
3648
3709
  //#endregion
3649
- //#region ../internals/dist/directive-CoRl44Fx.js
3710
+ //#region ../internals/dist/directive-Bti3pKwZ.js
3650
3711
  var i = class {
3651
3712
  #e;
3652
3713
  #t;
@@ -3742,7 +3803,7 @@ var FluxApplication_default = /* @__PURE__ */ defineComponent({
3742
3803
  },
3743
3804
  setup(__props) {
3744
3805
  let resizeTimer;
3745
- const isMenuCollapsed = k("application-menu-collapsed", true);
3806
+ const isMenuCollapsed = A("application-menu-collapsed", true);
3746
3807
  const matchedMenuRoutes = useNamedRoutes_default(toRef(() => __props.contextMenuName));
3747
3808
  const route = useRoute_default();
3748
3809
  const { lg, xl } = useBreakpoints();
@@ -3803,6 +3864,16 @@ var FluxApplication_default = /* @__PURE__ */ defineComponent({
3803
3864
  function removeContext(id) {
3804
3865
  contextStack.value = contextStack.value.filter((entry) => entry.id !== id);
3805
3866
  }
3867
+ function updateContext(id, info) {
3868
+ const index = contextStack.value.findIndex((entry) => entry.id === id);
3869
+ if (index === -1) return;
3870
+ const stack = [...contextStack.value];
3871
+ stack[index] = {
3872
+ id,
3873
+ ...info
3874
+ };
3875
+ contextStack.value = stack;
3876
+ }
3806
3877
  watch(() => route.fullPath, () => {
3807
3878
  viewIndex.value = totalLevels.value - 1;
3808
3879
  if (!lg.value && !xl.value) isMenuCollapsed.value = true;
@@ -3830,7 +3901,8 @@ var FluxApplication_default = /* @__PURE__ */ defineComponent({
3830
3901
  goToMain,
3831
3902
  goToParent,
3832
3903
  pushContext,
3833
- removeContext
3904
+ removeContext,
3905
+ updateContext
3834
3906
  });
3835
3907
  return (_ctx, _cache) => {
3836
3908
  return openBlock(), createElementBlock("div", { class: normalizeClass(unref(Application_module_default).application) }, [
@@ -3885,11 +3957,7 @@ function useApplicationContextRegistration_default(info) {
3885
3957
  });
3886
3958
  });
3887
3959
  watch(info, (next) => {
3888
- injection.removeContext(id);
3889
- injection.pushContext({
3890
- id,
3891
- ...next
3892
- });
3960
+ injection.updateContext(id, next);
3893
3961
  });
3894
3962
  onBeforeUnmount(() => {
3895
3963
  injection.removeContext(id);
@@ -4018,13 +4086,12 @@ var ApplicationMenu_module_default = {
4018
4086
  avatar: `avatar`,
4019
4087
  applicationMenuContext: `application-menu-context`,
4020
4088
  applicationMenuContextContent: `application-menu-context-content`,
4021
- applicationMenuContextPill: `application-menu-context-pill`,
4022
- applicationMenuContextPillContent: `application-menu-context-pill-content`,
4023
4089
  applicationMenuPromo: `application-menu-promo`,
4024
4090
  icon: `icon`,
4025
4091
  applicationMenuPromoContent: `application-menu-promo-content`,
4026
4092
  applicationMenuToggle: `application-menu-toggle`,
4027
- applicationMenuToggleIcon: `application-menu-toggle-icon`
4093
+ applicationMenuToggleIcon: `application-menu-toggle-icon`,
4094
+ applicationMenuContextPillContent: `application-menu-context-pill-content`
4028
4095
  };
4029
4096
  //#endregion
4030
4097
  //#region src/component/FluxApplicationMenu.vue?vue&type=script&setup=true&lang.ts
@@ -4354,7 +4421,7 @@ var FluxApplicationTop_default = /* @__PURE__ */ defineComponent({
4354
4421
  setup(__props) {
4355
4422
  const slots = useSlots();
4356
4423
  const { layout, showDesktopMenuToggle } = useApplicationInjection_default();
4357
- const { y } = j();
4424
+ const { y } = M();
4358
4425
  return (_ctx, _cache) => {
4359
4426
  return openBlock(), createElementBlock("header", { class: normalizeClass(unref(y) > 1 ? unref(ApplicationTop_module_default).applicationTopScrolled : unref(ApplicationTop_module_default).applicationTop) }, [createElementVNode("div", { class: normalizeClass(unref(ApplicationTop_module_default).applicationTopBar) }, [
4360
4427
  createVNode(FluxApplicationMenuToggle_default, { class: normalizeClass(!unref(showDesktopMenuToggle) && unref(ApplicationTop_module_default).applicationTopMenuToggleHidden) }, null, 8, ["class"]),