@pgcorp/ui-kit 0.14.0 → 0.15.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 (117) hide show
  1. package/README.md +330 -12
  2. package/dist/assets/src/components/layout/{SResizeHandle.vue_vue_type_style_index_0_scoped_13b9b27a_lang.css → SResizeHandle.vue_vue_type_style_index_0_scoped_dc65aba1_lang.css} +1 -1
  3. package/dist/assets/src/components/shared/_internal/SDialogSurface.css_vue_type_style_index_0_src_a108e8f1_scoped_a108e8f1_lang.css +2 -0
  4. package/dist/assets/src/components/shared/containers/{SCollapsiblePanel.css_vue_type_style_index_0_src_71824088_scoped_71824088_lang.css → SCollapsiblePanel.css_vue_type_style_index_0_src_db85261d_scoped_db85261d_lang.css} +1 -1
  5. package/dist/assets/src/components/shared/containers/{SOverlayHost.css_vue_type_style_index_0_src_8f9be94e_scoped_8f9be94e_lang.css → SOverlayHost.css_vue_type_style_index_0_src_09215628_scoped_09215628_lang.css} +1 -1
  6. package/dist/assets/src/components/shared/containers/{SPopover.css_vue_type_style_index_0_src_4091d007_scoped_4091d007_lang.css → SPopover.css_vue_type_style_index_0_src_a4f1f64a_scoped_a4f1f64a_lang.css} +1 -1
  7. package/dist/assets/src/components/shared/containers/SSidebarSection.css_vue_type_style_index_0_src_52396e42_scoped_52396e42_lang.css +2 -0
  8. package/dist/assets/src/components/shared/controls/SButton.css_vue_type_style_index_0_src_7a5acda9_scoped_7a5acda9_lang.css +1 -1
  9. package/dist/assets/src/components/shared/controls/SCheckbox.css_vue_type_style_index_0_src_2562f916_scoped_2562f916_lang.css +2 -0
  10. package/dist/assets/src/components/shared/controls/SCombobox.css_vue_type_style_index_0_src_d630c922_scoped_d630c922_lang.css +2 -0
  11. package/dist/assets/src/components/shared/controls/SContextMenu.css_vue_type_style_index_0_src_43b6e378_scoped_43b6e378_lang.css +1 -0
  12. package/dist/assets/src/components/shared/controls/{SDropdownMenu.css_vue_type_style_index_0_src_857e2649_scoped_857e2649_lang.css → SDropdownMenu.css_vue_type_style_index_0_src_40040ae5_scoped_40040ae5_lang.css} +1 -1
  13. package/dist/assets/src/components/shared/controls/{SMenuSurface.css_vue_type_style_index_0_src_84109ad9_scoped_84109ad9_lang.css → SMenuSurface.css_vue_type_style_index_0_src_d2b7d71b_scoped_d2b7d71b_lang.css} +1 -1
  14. package/dist/assets/src/components/shared/controls/SSelect.css_vue_type_style_index_0_src_d1ead6c0_scoped_d1ead6c0_lang.css +2 -0
  15. package/dist/assets/src/components/shared/data-display/SControlledToastViewport.css_vue_type_style_index_0_src_a69aa84b_scoped_a69aa84b_lang.css +2 -0
  16. package/dist/assets/src/components/shared/data-display/SScrollViewport.css_vue_type_style_index_0_src_d94fcf8c_scoped_d94fcf8c_lang.css +2 -0
  17. package/dist/assets/src/components/shared/data-display/STooltip.css_vue_type_style_index_0_src_true_lang.css +1 -1
  18. package/dist/assets/src/components/shared/data-display/_internal/STableFrame.css_vue_type_style_index_0_src_914bad28_scoped_914bad28_lang.css +2 -0
  19. package/dist/assets/src/components/shared/navigation/{SBottomNav.vue_vue_type_style_index_0_scoped_24be0f2b_lang.css → SBottomNav.vue_vue_type_style_index_0_scoped_68cf84b3_lang.css} +1 -1
  20. package/dist/src/components/layout/SResizeHandle.vue.js +2 -2
  21. package/dist/src/components/layout/SResizeHandle.vue_vue_type_script_setup_true_lang.js +4 -2
  22. package/dist/src/components/shared/_internal/SDialogSurface.vue.d.ts +9 -1
  23. package/dist/src/components/shared/_internal/SDialogSurface.vue.js +2 -2
  24. package/dist/src/components/shared/_internal/SDialogSurface.vue_vue_type_script_setup_true_lang.js +174 -82
  25. package/dist/src/components/shared/_internal/dialogSurface.d.ts +2 -0
  26. package/dist/src/components/shared/_internal/dialogSurface.js +30 -27
  27. package/dist/src/components/shared/_internal/dialogSurfaceMotion.d.ts +14 -0
  28. package/dist/src/components/shared/_internal/dialogSurfaceMotion.js +84 -0
  29. package/dist/src/components/shared/_internal/focusTrap.js +15 -13
  30. package/dist/src/components/shared/containers/SCollapsiblePanel.vue.d.ts +5 -0
  31. package/dist/src/components/shared/containers/SCollapsiblePanel.vue.js +2 -2
  32. package/dist/src/components/shared/containers/SCollapsiblePanel.vue_vue_type_script_setup_true_lang.js +123 -121
  33. package/dist/src/components/shared/containers/SDrawer.vue.d.ts +4 -4
  34. package/dist/src/components/shared/containers/SDrawer.vue.js +3 -6
  35. package/dist/src/components/shared/containers/SDrawer.vue_vue_type_script_setup_true_lang.js +104 -128
  36. package/dist/src/components/shared/containers/SModal.vue.d.ts +8 -8
  37. package/dist/src/components/shared/containers/SModal.vue.js +3 -6
  38. package/dist/src/components/shared/containers/SModal.vue_vue_type_script_setup_true_lang.js +87 -103
  39. package/dist/src/components/shared/containers/SOverlayHost.vue.js +2 -2
  40. package/dist/src/components/shared/containers/SOverlayHost.vue_vue_type_script_setup_true_lang.js +32 -31
  41. package/dist/src/components/shared/containers/SPanel.vue.d.ts +1 -1
  42. package/dist/src/components/shared/containers/SPopover.vue.js +2 -2
  43. package/dist/src/components/shared/containers/SPopover.vue_vue_type_script_setup_true_lang.js +225 -200
  44. package/dist/src/components/shared/containers/SSidebarSection.vue.js +2 -2
  45. package/dist/src/components/shared/containers/SSidebarSection.vue_vue_type_script_setup_true_lang.js +4 -3
  46. package/dist/src/components/shared/controls/SCheckbox.vue.js +2 -2
  47. package/dist/src/components/shared/controls/SCheckbox.vue_vue_type_script_setup_true_lang.js +13 -7
  48. package/dist/src/components/shared/controls/SCombobox.vue.js +2 -2
  49. package/dist/src/components/shared/controls/SCombobox.vue_vue_type_script_setup_true_lang.js +104 -94
  50. package/dist/src/components/shared/controls/SContextMenu.vue.js +2 -2
  51. package/dist/src/components/shared/controls/SContextMenu.vue_vue_type_script_setup_true_lang.js +86 -81
  52. package/dist/src/components/shared/controls/SDropdownMenu.vue.js +2 -2
  53. package/dist/src/components/shared/controls/SDropdownMenu.vue_vue_type_script_setup_true_lang.js +77 -72
  54. package/dist/src/components/shared/controls/SMenuSurface.vue.js +2 -2
  55. package/dist/src/components/shared/controls/SMenuSurface.vue_vue_type_script_setup_true_lang.js +81 -77
  56. package/dist/src/components/shared/controls/SSelect.vue.js +2 -2
  57. package/dist/src/components/shared/controls/SSelect.vue_vue_type_script_setup_true_lang.js +85 -77
  58. package/dist/src/components/shared/data-display/SControlledToastViewport.vue.js +2 -2
  59. package/dist/src/components/shared/data-display/SControlledToastViewport.vue_vue_type_script_setup_true_lang.js +58 -49
  60. package/dist/src/components/shared/data-display/SScrollViewport.vue.d.ts +10 -5
  61. package/dist/src/components/shared/data-display/SScrollViewport.vue.js +2 -2
  62. package/dist/src/components/shared/data-display/SScrollViewport.vue_vue_type_script_setup_true_lang.js +162 -111
  63. package/dist/src/components/shared/data-display/STooltip.vue_vue_type_script_setup_true_lang.js +276 -224
  64. package/dist/src/components/shared/data-display/_internal/STableFrame.vue.d.ts +3 -3
  65. package/dist/src/components/shared/data-display/_internal/STableFrame.vue.js +2 -2
  66. package/dist/src/components/shared/data-display/_internal/STableFrame.vue_vue_type_script_setup_true_lang.js +62 -46
  67. package/dist/src/components/shared/data-display/scrollViewport.d.ts +2 -0
  68. package/dist/src/components/shared/navigation/SBottomNav.vue.js +2 -2
  69. package/dist/src/components/shared/navigation/SBottomNav.vue_vue_type_script_setup_true_lang.js +3 -1
  70. package/dist/src/components/shared/navigation/STabList.vue.d.ts +1 -1
  71. package/dist/src/composables/useDialogOverlay.d.ts +12 -2
  72. package/dist/src/composables/useDialogOverlay.js +192 -119
  73. package/dist/src/internal/flatTree.d.ts +8 -0
  74. package/dist/src/internal/flatTree.js +23 -0
  75. package/dist/src/internal/focusNavigation.d.ts +3 -0
  76. package/dist/src/internal/focusNavigation.js +28 -15
  77. package/dist/src/internal/inertLease.d.ts +8 -0
  78. package/dist/src/internal/inertLease.js +33 -0
  79. package/dist/src/internal/layerStack.d.ts +40 -0
  80. package/dist/src/internal/layerStack.js +301 -94
  81. package/dist/src/internal/nativeFocus.d.ts +4 -0
  82. package/dist/src/internal/nativeFocus.js +12 -0
  83. package/dist/src/internal/overlayPortal.d.ts +17 -0
  84. package/dist/src/internal/overlayPortal.js +23 -0
  85. package/dist/src/internal/semanticSizing.d.ts +2 -2
  86. package/dist/src/internal/semanticSizing.js +2 -1
  87. package/dist/src/internal/useMenuLayer.d.ts +1 -0
  88. package/dist/src/internal/useMenuLayer.js +63 -57
  89. package/dist/src/internal/viewportModality.d.ts +27 -0
  90. package/dist/src/internal/viewportModality.js +132 -0
  91. package/dist/typography.js +17 -62
  92. package/docs/overlay-lifecycle.md +195 -0
  93. package/docs/public-api.md +141 -4
  94. package/docs/resize.md +34 -5
  95. package/docs/scroll-viewport.md +30 -10
  96. package/docs/theming.md +42 -8
  97. package/package.json +1 -1
  98. package/src/components/shared/_internal/SDialogSurface.css +185 -40
  99. package/src/components/shared/controls/SButton.css +0 -3
  100. package/src/components/shared/controls/SCheckbox.css +19 -7
  101. package/src/components/shared/data-display/SControlledToastViewport.css +2 -10
  102. package/src/components/shared/data-display/SScrollViewport.css +17 -1
  103. package/src/components/shared/data-display/STooltip.css +1 -1
  104. package/src/components/shared/data-display/_internal/STableFrame.css +1 -5
  105. package/dist/assets/src/components/shared/_internal/SDialogSurface.css_vue_type_style_index_0_src_0e58afdc_scoped_0e58afdc_lang.css +0 -2
  106. package/dist/assets/src/components/shared/containers/SDrawer.css_vue_type_style_index_0_src_61cf20dd_scoped_61cf20dd_lang.css +0 -2
  107. package/dist/assets/src/components/shared/containers/SModal.css_vue_type_style_index_0_src_42e1bd5f_scoped_42e1bd5f_lang.css +0 -2
  108. package/dist/assets/src/components/shared/containers/SSidebarSection.css_vue_type_style_index_0_src_21f71ae8_scoped_21f71ae8_lang.css +0 -2
  109. package/dist/assets/src/components/shared/controls/SCheckbox.css_vue_type_style_index_0_src_55d4826e_scoped_55d4826e_lang.css +0 -2
  110. package/dist/assets/src/components/shared/controls/SCombobox.css_vue_type_style_index_0_src_537f5744_scoped_537f5744_lang.css +0 -2
  111. package/dist/assets/src/components/shared/controls/SContextMenu.css_vue_type_style_index_0_src_03921269_scoped_03921269_lang.css +0 -1
  112. package/dist/assets/src/components/shared/controls/SSelect.css_vue_type_style_index_0_src_df3d6688_scoped_df3d6688_lang.css +0 -2
  113. package/dist/assets/src/components/shared/data-display/SControlledToastViewport.css_vue_type_style_index_0_src_5864b6c6_scoped_5864b6c6_lang.css +0 -2
  114. package/dist/assets/src/components/shared/data-display/SScrollViewport.css_vue_type_style_index_0_src_e5d11342_scoped_e5d11342_lang.css +0 -2
  115. package/dist/assets/src/components/shared/data-display/_internal/STableFrame.css_vue_type_style_index_0_src_52b5825e_scoped_52b5825e_lang.css +0 -2
  116. package/src/components/shared/containers/SDrawer.css +0 -87
  117. package/src/components/shared/containers/SModal.css +0 -27
@@ -1,10 +1,12 @@
1
- import { validateBoundedInteger as e, validateNonEmptyString as t } from "../../../internal/runtimeContract.js";
2
- import { useOwnedAttrs as n } from "../../../internal/ownedAttrs.js";
3
- import r from "../_internal/SToastItem.vue.js";
4
- import { validateToastLifetimeOwner as i, validateToastPosition as a, validateToastPresentations as o } from "./toast.js";
5
- import { Fragment as s, TransitionGroup as c, computed as l, createBlock as u, createElementBlock as d, createVNode as f, defineComponent as p, mergeProps as m, onBeforeUnmount as h, openBlock as g, renderList as _, unref as v, watch as y, withCtx as b } from "vue";
1
+ import { useOverlayAdmission as e } from "../../../internal/overlayHost.js";
2
+ import { validateBoundedInteger as t, validateNonEmptyString as n } from "../../../internal/runtimeContract.js";
3
+ import { useOverlayPortal as r, useOverlayPortalTarget as i } from "../../../internal/overlayPortal.js";
4
+ import { useOwnedAttrs as a } from "../../../internal/ownedAttrs.js";
5
+ import o from "../_internal/SToastItem.vue.js";
6
+ import { validateToastLifetimeOwner as s, validateToastPosition as c, validateToastPresentations as l } from "./toast.js";
7
+ import { Fragment as u, Teleport as d, TransitionGroup as f, computed as p, createBlock as m, createCommentVNode as h, createElementBlock as g, createElementVNode as _, createVNode as v, defineComponent as y, mergeProps as b, onBeforeUnmount as x, openBlock as S, renderList as C, unref as w, watch as T, withCtx as E } from "vue";
6
8
  //#region src/components/shared/data-display/SControlledToastViewport.vue?vue&type=script&setup=true&lang.ts
7
- var x = ["data-position", "aria-label"], S = /*@__PURE__*/ p({
9
+ var D = ["data-position", "aria-label"], O = /*@__PURE__*/ y({
8
10
  inheritAttrs: !1,
9
11
  __name: "SControlledToastViewport",
10
12
  props: {
@@ -19,31 +21,31 @@ var x = ["data-position", "aria-label"], S = /*@__PURE__*/ p({
19
21
  "action",
20
22
  "lifetime-expired"
21
23
  ],
22
- setup(p, { emit: S }) {
23
- let C = p, w = S, T = n({
24
+ setup(y, { emit: O }) {
25
+ let k = y, A = O, j = a({
24
26
  component: "SControlledToastViewport",
25
27
  owner: "controlled toast viewport root"
26
- }), E = /* @__PURE__ */ new Map(), D = l(() => o("SControlledToastViewport", C.notifications)), O = l(() => t("SControlledToastViewport", "accessibleLabel", C.accessibleLabel)), k = l(() => a(C.position)), A = l(() => i(C.lifetimeOwner)), j = l(() => e("SControlledToastViewport", "maxVisible", C.maxVisible, {
28
+ }), M = r(), N = i(), P = e(), F = p(() => M?.scope.value === "native"), I = p(() => M && !P.value ? null : N.value), L = /* @__PURE__ */ new Map(), R = p(() => l("SControlledToastViewport", k.notifications)), z = p(() => n("SControlledToastViewport", "accessibleLabel", k.accessibleLabel)), B = p(() => c(k.position)), V = p(() => s(k.lifetimeOwner)), H = p(() => t("SControlledToastViewport", "maxVisible", k.maxVisible, {
27
29
  minimum: 1,
28
30
  maximum: 2 ** 53 - 1
29
- })), M = l(() => D.value.slice(0, j.value));
30
- function N(e) {
31
+ })), U = p(() => R.value.slice(0, H.value));
32
+ function W(e) {
31
33
  e.timer !== null && (clearTimeout(e.timer), e.timer = null);
32
34
  }
33
- function P(e) {
34
- let t = E.get(e);
35
- t && (N(t), E.delete(e));
35
+ function G(e) {
36
+ let t = L.get(e);
37
+ t && (W(t), L.delete(e));
36
38
  }
37
- function F() {
38
- for (let e of E.values()) N(e);
39
- E.clear();
39
+ function K() {
40
+ for (let e of L.values()) W(e);
41
+ L.clear();
40
42
  }
41
- function I(e, t) {
43
+ function q(e, t) {
42
44
  typeof window > "u" || t.expired || t.remainingMs <= 0 || t.pausedBy.size > 0 || (t.startedAt = Date.now(), t.timer = setTimeout(() => {
43
- t.timer = null, t.remainingMs = 0, t.expired = !0, w("lifetime-expired", { id: e });
45
+ t.timer = null, t.remainingMs = 0, t.expired = !0, A("lifetime-expired", { id: e });
44
46
  }, t.remainingMs));
45
47
  }
46
- function L(e, t) {
48
+ function J(e, t) {
47
49
  let n = {
48
50
  configuredDurationMs: t,
49
51
  remainingMs: t,
@@ -52,66 +54,73 @@ var x = ["data-position", "aria-label"], S = /*@__PURE__*/ p({
52
54
  pausedBy: /* @__PURE__ */ new Set(),
53
55
  expired: !1
54
56
  };
55
- return E.set(e, n), I(e, n), n;
57
+ return L.set(e, n), q(e, n), n;
56
58
  }
57
- function R() {
58
- if (A.value !== "viewport" || typeof window > "u") {
59
- F();
59
+ function Y() {
60
+ if (V.value !== "viewport" || typeof window > "u") {
61
+ K();
60
62
  return;
61
63
  }
62
64
  let e = /* @__PURE__ */ new Set();
63
- for (let t of M.value) {
65
+ for (let t of U.value) {
64
66
  e.add(t.id);
65
- let n = t.durationMs ?? 0, r = E.get(t.id);
67
+ let n = t.durationMs ?? 0, r = L.get(t.id);
66
68
  if (n === 0) {
67
- P(t.id);
69
+ G(t.id);
68
70
  continue;
69
71
  }
70
72
  if (!r) {
71
- L(t.id, n);
73
+ J(t.id, n);
72
74
  continue;
73
75
  }
74
- r.configuredDurationMs !== n && (P(t.id), L(t.id, n));
76
+ r.configuredDurationMs !== n && (G(t.id), J(t.id, n));
75
77
  }
76
- for (let t of E.keys()) e.has(t) || P(t);
78
+ for (let t of L.keys()) e.has(t) || G(t);
77
79
  }
78
- function z(e, t) {
79
- let n = E.get(e);
80
+ function X(e, t) {
81
+ let n = L.get(e);
80
82
  if (!n || n.expired || n.pausedBy.has(t) || (n.pausedBy.add(t), n.timer === null)) return;
81
83
  let r = Math.max(0, Date.now() - n.startedAt);
82
- n.remainingMs = Math.max(0, n.remainingMs - r), N(n);
84
+ n.remainingMs = Math.max(0, n.remainingMs - r), W(n);
83
85
  }
84
- function B(e, t) {
85
- let n = E.get(e);
86
- !n || !n.pausedBy.delete(t) || n.pausedBy.size > 0 || I(e, n);
86
+ function Z(e, t) {
87
+ let n = L.get(e);
88
+ !n || !n.pausedBy.delete(t) || n.pausedBy.size > 0 || q(e, n);
87
89
  }
88
- function V(e) {
89
- w("dismiss", {
90
+ T(I, (e, t) => {
91
+ if (e === null && t !== null) for (let e of L.keys()) Z(e, "pointer"), Z(e, "focus");
92
+ }, { flush: "sync" });
93
+ function Q(e) {
94
+ A("dismiss", {
90
95
  id: e,
91
96
  reason: "close"
92
97
  });
93
98
  }
94
- return y([M, A], R, { immediate: !0 }), h(F), (e, t) => (g(), d("div", m(v(T).bindings(), {
99
+ return T([U, V], Y, { immediate: !0 }), x(K), (e, t) => I.value ? (S(), m(d, {
100
+ key: 0,
101
+ to: I.value,
102
+ disabled: !F.value
103
+ }, [_("div", b(w(j).bindings(), {
95
104
  class: "s-toast-container s-controlled-toast-viewport",
96
- "data-position": k.value,
105
+ "data-position": B.value,
97
106
  role: "region",
98
- "aria-label": O.value
99
- }), [f(c, {
107
+ "aria-label": z.value
108
+ }), [v(f, {
100
109
  name: "notification-transition",
101
110
  tag: "div",
102
111
  class: "s-toast-transition-wrapper"
103
112
  }, {
104
- default: b(() => [(g(!0), d(s, null, _(M.value, (e) => (g(), u(r, {
113
+ default: E(() => [(S(!0), g(u, null, C(U.value, (e) => (S(), m(o, {
105
114
  key: e.id,
106
115
  notification: e,
107
- onDismiss: V,
108
- onAction: t[0] ||= (e) => w("action", e),
109
- onLifetimePause: z,
110
- onLifetimeResume: B
116
+ onDismiss: Q,
117
+ onAction: t[0] ||= (e) => A("action", e),
118
+ onLifetimePause: X,
119
+ onLifetimeResume: Z
111
120
  }, null, 8, ["notification"]))), 128))]),
112
121
  _: 1
113
- })], 16, x));
122
+ })], 16, D)], 8, ["to", "disabled"])) : h("", !0);
114
123
  }
115
124
  });
116
125
  //#endregion
117
- export { S as default };
126
+ export { O as default };
@@ -1,9 +1,12 @@
1
- import { SScrollViewportApi, SScrollViewportState, SScrollViewportAxis as PublicSScrollViewportAxis, SScrollViewportOverscrollBehavior as PublicSScrollViewportOverscrollBehavior } from './scrollViewport';
2
- import { ScrollViewportBlockSize as PublicScrollViewportBlockSize } from '../../../internal/semanticSizing';
1
+ import { SScrollViewportApi, SScrollViewportState, SScrollViewportAxis as PublicSScrollViewportAxis, SScrollViewportFocusPolicy as PublicSScrollViewportFocusPolicy, SScrollViewportOverscrollBehavior as PublicSScrollViewportOverscrollBehavior } from './scrollViewport';
2
+ import { ScrollViewportBlockSize as PublicScrollViewportBlockSize, ScrollableViewportMaxBlockSize as PublicScrollableViewportMaxBlockSize } from '../../../internal/semanticSizing';
3
3
  export interface Props {
4
- accessibleLabel: string;
4
+ accessibleLabel?: string;
5
+ accessibleLabelledby?: string;
5
6
  axis?: PublicSScrollViewportAxis;
6
7
  blockSize?: PublicScrollViewportBlockSize;
8
+ maxBlockSize?: PublicScrollableViewportMaxBlockSize;
9
+ focusPolicy?: PublicSScrollViewportFocusPolicy;
7
10
  focusable?: boolean;
8
11
  keyboardNavigation?: boolean;
9
12
  overscrollBehavior?: PublicSScrollViewportOverscrollBehavior;
@@ -16,10 +19,12 @@ declare const __VLS_export: __VLS_WithSlots<import('vue').DefineComponent<Props,
16
19
  "onScroll-state"?: ((state: SScrollViewportState) => any) | undefined;
17
20
  }>, {
18
21
  focusable: boolean;
19
- blockSize: PublicScrollViewportBlockSize;
20
- overscrollBehavior: PublicSScrollViewportOverscrollBehavior;
21
22
  axis: PublicSScrollViewportAxis;
23
+ blockSize: PublicScrollViewportBlockSize;
24
+ maxBlockSize: PublicScrollableViewportMaxBlockSize;
25
+ focusPolicy: PublicSScrollViewportFocusPolicy;
22
26
  keyboardNavigation: boolean;
27
+ overscrollBehavior: PublicSScrollViewportOverscrollBehavior;
23
28
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>, {
24
29
  default?: (props: {}) => any;
25
30
  }>;
@@ -1,8 +1,8 @@
1
- import "../../../../assets/src/components/shared/data-display/SScrollViewport.css_vue_type_style_index_0_src_e5d11342_scoped_e5d11342_lang.css";
1
+ import "../../../../assets/src/components/shared/data-display/SScrollViewport.css_vue_type_style_index_0_src_d94fcf8c_scoped_d94fcf8c_lang.css";
2
2
  import e from "../../../../_virtual/_plugin-vue_export-helper.js";
3
3
  import t from "./SScrollViewport.vue_vue_type_script_setup_true_lang.js";
4
4
  /* empty css */
5
5
  //#region src/components/shared/data-display/SScrollViewport.vue
6
- var n = /*#__PURE__*/ e(t, [["__scopeId", "data-v-e5d11342"]]);
6
+ var n = /*#__PURE__*/ e(t, [["__scopeId", "data-v-d94fcf8c"]]);
7
7
  //#endregion
8
8
  export { n as default };
@@ -1,14 +1,18 @@
1
- import { validateBoolean as e, validateBoundedNumber as t, validateExactString as n, validateNonEmptyString as r } from "../../../internal/runtimeContract.js";
2
- import { useOwnedAttrs as i } from "../../../internal/ownedAttrs.js";
3
- import { useInteractiveLeafRegistration as a } from "../../../internal/passiveContentContract.js";
4
- import { validateScrollViewportBlockSize as o } from "../../../internal/semanticSizing.js";
5
- import { computed as s, createElementBlock as c, createElementVNode as l, defineComponent as u, mergeProps as d, nextTick as f, onBeforeUnmount as p, onMounted as m, openBlock as h, renderSlot as g, shallowRef as _, unref as v, watch as y } from "vue";
1
+ import { validateBoolean as e, validateBoundedNumber as t, validateDomIdReferences as n, validateExactString as r, validateNonEmptyString as i } from "../../../internal/runtimeContract.js";
2
+ import { useOwnedAttrs as a } from "../../../internal/ownedAttrs.js";
3
+ import { useInteractiveLeafRegistration as o } from "../../../internal/passiveContentContract.js";
4
+ import { validateScrollViewportBlockSize as s, validateScrollableViewportMaxBlockSize as c } from "../../../internal/semanticSizing.js";
5
+ import { computed as l, createElementBlock as ee, createElementVNode as u, defineComponent as d, mergeProps as f, nextTick as p, onBeforeUnmount as m, onMounted as h, openBlock as g, renderSlot as _, shallowRef as v, unref as y, watch as b } from "vue";
6
6
  //#region src/components/shared/data-display/SScrollViewport.vue?vue&type=script&setup=true&lang.ts
7
- var b = [
7
+ var x = [
8
+ "role",
8
9
  "aria-label",
10
+ "aria-labelledby",
9
11
  "tabindex",
10
12
  "data-axis",
11
13
  "data-block-size",
14
+ "data-max-block-size",
15
+ "data-focus-policy",
12
16
  "data-focusable",
13
17
  "data-keyboard-navigation",
14
18
  "data-overscroll-behavior",
@@ -16,13 +20,16 @@ var b = [
16
20
  "data-at-inline-end",
17
21
  "data-at-block-start",
18
22
  "data-at-block-end"
19
- ], x = /*@__PURE__*/ u({
23
+ ], S = /*@__PURE__*/ d({
20
24
  inheritAttrs: !1,
21
25
  __name: "SScrollViewport",
22
26
  props: {
23
27
  accessibleLabel: {},
28
+ accessibleLabelledby: {},
24
29
  axis: { default: "y" },
25
30
  blockSize: { default: "md" },
31
+ maxBlockSize: { default: "none" },
32
+ focusPolicy: { default: "always" },
26
33
  focusable: {
27
34
  type: Boolean,
28
35
  default: !0
@@ -34,61 +41,71 @@ var b = [
34
41
  overscrollBehavior: { default: "contain" }
35
42
  },
36
43
  emits: ["scroll-state"],
37
- setup(u, { expose: x, emit: S }) {
38
- let C = u, w = S, T = _(null), E = _(null), D = _(null), O = i({
44
+ setup(d, { expose: S, emit: C }) {
45
+ let w = d, T = C, E = v(null), D = v(null), O = v(null), k = v(!1), te = a({
39
46
  component: "SScrollViewport",
40
47
  owner: "scroll viewport region"
41
- }), k = null, A = "", j = null, M = s(() => {
42
- let t = e("SScrollViewport", "focusable", C.focusable), i = e("SScrollViewport", "keyboardNavigation", C.keyboardNavigation);
43
- if (i && !t) throw Error("SScrollViewport: keyboardNavigation=true требует focusable=true. / SScrollViewport: keyboardNavigation=true requires focusable=true.");
48
+ }), A = null, j = null, M = /* @__PURE__ */ new Set(), N = !1, P = "", F = null, I = l(() => {
49
+ if (w.accessibleLabel === void 0 == (w.accessibleLabelledby === void 0)) throw Error("SScrollViewport: требуется ровно один accessibleLabel или accessibleLabelledby. / SScrollViewport: exactly one accessibleLabel or accessibleLabelledby is required.");
50
+ let t = e("SScrollViewport", "focusable", w.focusable), a = e("SScrollViewport", "keyboardNavigation", w.keyboardNavigation);
51
+ if (a && !t) throw Error("SScrollViewport: keyboardNavigation=true требует focusable=true. / SScrollViewport: keyboardNavigation=true requires focusable=true.");
44
52
  return {
45
- accessibleLabel: r("SScrollViewport", "accessibleLabel", C.accessibleLabel),
46
- axis: n("SScrollViewport", "axis", C.axis, [
53
+ accessibleLabel: w.accessibleLabel === void 0 ? void 0 : i("SScrollViewport", "accessibleLabel", w.accessibleLabel),
54
+ accessibleLabelledby: w.accessibleLabelledby === void 0 ? void 0 : n("SScrollViewport", "accessibleLabelledby", w.accessibleLabelledby),
55
+ axis: r("SScrollViewport", "axis", w.axis, [
47
56
  "x",
48
57
  "y",
49
58
  "both"
50
59
  ]),
51
- blockSize: o("SScrollViewport", "blockSize", C.blockSize),
60
+ blockSize: s("SScrollViewport", "blockSize", w.blockSize),
61
+ maxBlockSize: c("SScrollViewport", "maxBlockSize", w.maxBlockSize),
62
+ focusPolicy: r("SScrollViewport", "focusPolicy", w.focusPolicy, ["always", "overflow"]),
52
63
  focusable: t,
53
- keyboardNavigation: i,
54
- overscrollBehavior: n("SScrollViewport", "overscrollBehavior", C.overscrollBehavior, [
64
+ keyboardNavigation: a,
65
+ overscrollBehavior: r("SScrollViewport", "overscrollBehavior", w.overscrollBehavior, [
55
66
  "auto",
56
67
  "contain",
57
68
  "none"
58
69
  ])
59
70
  };
71
+ }), L = l(() => {
72
+ let e = O.value?.physical;
73
+ return e ? Y("x") && e.maxX > 0 || Y("y") && e.maxY > 0 : !1;
74
+ }), R = l(() => I.value.focusPolicy === "always" || L.value), z = l(() => I.value.focusable && R.value), B = l(() => {
75
+ if (z.value) return 0;
76
+ if (I.value.focusPolicy === "overflow" && I.value.focusable && k.value) return -1;
60
77
  });
61
- a({
78
+ o({
62
79
  owner: "SScrollViewport",
63
- active: () => M.value.focusable
80
+ active: () => z.value
64
81
  });
65
- function N(e, t) {
82
+ function V(e, t) {
66
83
  return Math.min(t, Math.max(0, e));
67
84
  }
68
- function P(e) {
69
- if (j) return j;
85
+ function H(e) {
86
+ if (F) return F;
70
87
  let t = e.ownerDocument, n = t.createElement("div"), r = t.createElement("div");
71
- return n.dir = "rtl", n.style.cssText = "position:absolute;inset:-9999px;width:4px;height:1px;overflow:scroll;", r.style.cssText = "width:8px;height:1px;", n.append(r), t.body.append(n), n.scrollLeft > 0 ? j = "default" : (n.scrollLeft = 1, j = n.scrollLeft === 0 ? "negative" : "reverse"), n.remove(), j;
88
+ return n.dir = "rtl", n.style.cssText = "position:absolute;inset:-9999px;width:4px;height:1px;overflow:scroll;", r.style.cssText = "width:8px;height:1px;", n.append(r), t.body.append(n), n.scrollLeft > 0 ? F = "default" : (n.scrollLeft = 1, F = n.scrollLeft === 0 ? "negative" : "reverse"), n.remove(), F;
72
89
  }
73
- function F(e, t) {
90
+ function U(e, t) {
74
91
  let n = e.scrollLeft;
75
- if (getComputedStyle(e).direction !== "rtl") return N(n, t);
76
- switch (P(e)) {
77
- case "negative": return N(t + n, t);
78
- case "reverse": return N(t - n, t);
79
- case "default": return N(n, t);
92
+ if (getComputedStyle(e).direction !== "rtl") return V(n, t);
93
+ switch (H(e)) {
94
+ case "negative": return V(t + n, t);
95
+ case "reverse": return V(t - n, t);
96
+ case "default": return V(n, t);
80
97
  }
81
98
  }
82
- function I(e, t, n) {
83
- let r = N(t, n);
99
+ function W(e, t, n) {
100
+ let r = V(t, n);
84
101
  if (getComputedStyle(e).direction !== "rtl") return r;
85
- switch (P(e)) {
102
+ switch (H(e)) {
86
103
  case "negative": return r - n;
87
104
  case "reverse": return n - r;
88
105
  case "default": return r;
89
106
  }
90
107
  }
91
- function L(e, t) {
108
+ function G(e, t) {
92
109
  let n = getComputedStyle(e);
93
110
  return n.writingMode.startsWith("vertical") || n.writingMode.startsWith("sideways") ? Object.freeze({
94
111
  inline: n.direction === "rtl" ? t.maxY - t.y : t.y,
@@ -102,13 +119,13 @@ var b = [
102
119
  maxBlock: t.maxY
103
120
  });
104
121
  }
105
- function R(e) {
122
+ function K(e) {
106
123
  let t = Math.max(0, e.scrollWidth - e.clientWidth), n = Math.max(0, e.scrollHeight - e.clientHeight), r = Object.freeze({
107
- x: F(e, t),
108
- y: N(e.scrollTop, n),
124
+ x: U(e, t),
125
+ y: V(e.scrollTop, n),
109
126
  maxX: t,
110
127
  maxY: n
111
- }), i = L(e, r);
128
+ }), i = G(e, r);
112
129
  return Object.freeze({
113
130
  physical: r,
114
131
  semantic: i,
@@ -118,56 +135,58 @@ var b = [
118
135
  atBlockEnd: i.maxBlock - i.block <= 1
119
136
  });
120
137
  }
121
- function z() {
122
- let e = T.value;
138
+ function q() {
139
+ if (!N) return;
140
+ let e = E.value;
123
141
  if (!e) return;
124
- let t = R(e), n = JSON.stringify(t);
125
- n !== A && (A = n, D.value = t, w("scroll-state", t));
142
+ let t = K(e), n = JSON.stringify(t);
143
+ n !== P && (P = n, O.value = t, T("scroll-state", t));
126
144
  }
127
- function B(e) {
128
- let t = T.value;
145
+ function J(e) {
146
+ let t = E.value;
129
147
  if (t) return t;
130
148
  throw Error(`SScrollViewport: ${e} недоступен до mount. / SScrollViewport: ${e} is unavailable before mount.`);
131
149
  }
132
- function V(e) {
133
- return M.value.axis === e || M.value.axis === "both";
150
+ function Y(e) {
151
+ return I.value.axis === e || I.value.axis === "both";
134
152
  }
135
- function H(e, t) {
136
- if (!V(e)) throw Error(`SScrollViewport: ${t} не может управлять осью ${e} при axis=${M.value.axis}. / SScrollViewport: ${t} cannot control axis ${e} when axis=${M.value.axis}.`);
153
+ function X(e, t) {
154
+ if (!Y(e)) throw Error(`SScrollViewport: ${t} не может управлять осью ${e} при axis=${I.value.axis}. / SScrollViewport: ${t} cannot control axis ${e} when axis=${I.value.axis}.`);
137
155
  }
138
- function U() {
139
- if (!M.value.focusable) throw Error("SScrollViewport: focus() требует focusable=true. / SScrollViewport: focus() requires focusable=true.");
140
- B("focus()").focus();
156
+ function Z() {
157
+ if (!I.value.focusable) throw Error("SScrollViewport: focus() требует focusable=true. / SScrollViewport: focus() requires focusable=true.");
158
+ if (!z.value) throw Error("SScrollViewport: focus() при focusPolicy=overflow требует переполнения разрешённой оси. / SScrollViewport: focus() with focusPolicy=overflow requires enabled-axis overflow.");
159
+ J("focus()").focus();
141
160
  }
142
- function W(e, t) {
143
- let r = n("SScrollViewport", "scrollToBoundary.axis", e, ["x", "y"]), i = n("SScrollViewport", "scrollToBoundary.boundary", t, ["start", "end"]);
144
- H(r, "scrollToBoundary()");
145
- let a = B("scrollToBoundary()"), o = R(a).physical, s = r === "x" ? i === "start" ? 0 : o.maxX : o.x, c = r === "y" ? i === "start" ? 0 : o.maxY : o.y;
161
+ function ne(e, t) {
162
+ let n = r("SScrollViewport", "scrollToBoundary.axis", e, ["x", "y"]), i = r("SScrollViewport", "scrollToBoundary.boundary", t, ["start", "end"]);
163
+ X(n, "scrollToBoundary()");
164
+ let a = J("scrollToBoundary()"), o = K(a).physical, s = n === "x" ? i === "start" ? 0 : o.maxX : o.x, c = n === "y" ? i === "start" ? 0 : o.maxY : o.y;
146
165
  a.scrollTo({
147
- left: I(a, s, o.maxX),
166
+ left: W(a, s, o.maxX),
148
167
  top: c,
149
168
  behavior: "auto"
150
- }), z();
169
+ }), q();
151
170
  }
152
- function G(e) {
171
+ function re(e) {
153
172
  if (typeof e != "object" || !e || Array.isArray(e)) throw TypeError("SScrollViewport: reveal.options должен быть объектом. / SScrollViewport: reveal.options must be an object.");
154
173
  if (e.x === void 0 && e.y === void 0) throw Error("SScrollViewport: reveal() требует x и/или y. / SScrollViewport: reveal() requires x and/or y.");
155
- e.x !== void 0 && H("x", "reveal()"), e.y !== void 0 && H("y", "reveal()");
156
- let r = B("reveal()"), i = R(r).physical, a = e.x === void 0 ? i.x : t("SScrollViewport", "reveal.x", e.x, {
174
+ e.x !== void 0 && X("x", "reveal()"), e.y !== void 0 && X("y", "reveal()");
175
+ let n = J("reveal()"), i = K(n).physical, a = e.x === void 0 ? i.x : t("SScrollViewport", "reveal.x", e.x, {
157
176
  minimum: 0,
158
177
  maximum: 2 ** 53 - 1
159
178
  }), o = e.y === void 0 ? i.y : t("SScrollViewport", "reveal.y", e.y, {
160
179
  minimum: 0,
161
180
  maximum: 2 ** 53 - 1
162
- }), s = n("SScrollViewport", "reveal.behavior", e.behavior ?? "auto", ["auto", "smooth"]);
163
- r.scrollTo({
164
- left: I(r, a, i.maxX),
165
- top: N(o, i.maxY),
181
+ }), s = r("SScrollViewport", "reveal.behavior", e.behavior ?? "auto", ["auto", "smooth"]);
182
+ n.scrollTo({
183
+ left: W(n, a, i.maxX),
184
+ top: V(o, i.maxY),
166
185
  behavior: s
167
- }), z();
186
+ }), q();
168
187
  }
169
- function K(e, t) {
170
- let n = V("x"), r = V("y"), i = Math.max(1, e.clientWidth / 8), a = Math.max(1, e.clientHeight / 8), o = Math.max(1, e.clientWidth * .9), s = Math.max(1, e.clientHeight * .9), c = R(e).physical;
188
+ function ie(e, t) {
189
+ let n = Y("x"), r = Y("y"), i = Math.max(1, e.clientWidth / 8), a = Math.max(1, e.clientHeight / 8), o = Math.max(1, e.clientWidth * .9), s = Math.max(1, e.clientHeight * .9), c = K(e).physical;
171
190
  switch (t.key) {
172
191
  case "ArrowLeft": return n ? {
173
192
  left: c.x - i,
@@ -210,64 +229,96 @@ var b = [
210
229
  default: return null;
211
230
  }
212
231
  }
213
- function q(e) {
214
- let t = T.value;
215
- if (!t || !M.value.keyboardNavigation || e.target !== t || e.defaultPrevented || e.altKey || e.ctrlKey || e.metaKey || e.shiftKey) return;
216
- let n = K(t, e);
232
+ function ae(e) {
233
+ let t = E.value;
234
+ t && e.target === t && (k.value = t.matches(":focus"));
235
+ }
236
+ function oe(e) {
237
+ e.target === E.value && (k.value = !1);
238
+ }
239
+ function se(e) {
240
+ let t = E.value;
241
+ if (!t || !z.value || !I.value.keyboardNavigation || e.target !== t || e.defaultPrevented || e.altKey || e.ctrlKey || e.metaKey || e.shiftKey) return;
242
+ let n = ie(t, e);
217
243
  if (!n) return;
218
244
  e.preventDefault();
219
- let r = R(t).physical;
245
+ let r = K(t).physical;
220
246
  t.scrollTo({
221
- left: I(t, n.left, r.maxX),
222
- top: N(n.top, r.maxY),
247
+ left: W(t, n.left, r.maxX),
248
+ top: V(n.top, r.maxY),
223
249
  behavior: "auto"
224
- }), z();
250
+ }), q();
225
251
  }
226
- function J() {
227
- z();
252
+ function Q() {
253
+ q();
254
+ }
255
+ function $() {
256
+ let e = D.value;
257
+ if (N && e && A) {
258
+ for (let t of M) t.parentElement !== e && (A.unobserve(t), M.delete(t));
259
+ for (let t of e.children) M.has(t) || (A.observe(t), M.add(t));
260
+ }
228
261
  }
229
- return m(() => {
230
- let e = B("observer setup"), t = E.value;
262
+ function ce() {
263
+ $(), q();
264
+ }
265
+ return h(() => {
266
+ let e = J("observer setup"), t = D.value;
231
267
  if (!t) throw Error("SScrollViewport: content owner отсутствует после mount. / SScrollViewport: content owner is missing after mount.");
232
268
  if (typeof ResizeObserver > "u") throw Error("SScrollViewport: runtime требует ResizeObserver. / SScrollViewport: runtime requires ResizeObserver.");
233
- e.addEventListener("scroll", J, { passive: !0 }), k = new ResizeObserver(z), k.observe(e), k.observe(t), z();
234
- }), y(() => [
235
- M.value.axis,
236
- M.value.blockSize,
237
- M.value.focusable,
238
- M.value.keyboardNavigation,
239
- M.value.overscrollBehavior
269
+ if (typeof MutationObserver > "u") throw Error("SScrollViewport: runtime требует MutationObserver. / SScrollViewport: runtime requires MutationObserver.");
270
+ N = !0, e.addEventListener("scroll", Q, { passive: !0 }), t.addEventListener("load", q, !0), A = new ResizeObserver(q), A.observe(e), A.observe(t), $(), j = new MutationObserver(ce), j.observe(t, {
271
+ subtree: !0,
272
+ childList: !0,
273
+ characterData: !0,
274
+ attributes: !0
275
+ }), q();
276
+ }), b(() => [
277
+ I.value.axis,
278
+ I.value.blockSize,
279
+ I.value.maxBlockSize,
280
+ I.value.focusPolicy,
281
+ I.value.accessibleLabel,
282
+ I.value.accessibleLabelledby,
283
+ I.value.focusable,
284
+ I.value.keyboardNavigation,
285
+ I.value.overscrollBehavior
240
286
  ], async () => {
241
- await f(), z();
242
- }), p(() => {
243
- T.value?.removeEventListener("scroll", J), k?.disconnect(), k = null, A = "";
244
- }), x({
245
- focus: U,
246
- scrollToBoundary: W,
247
- reveal: G
248
- }), (e, t) => (h(), c("div", d(v(O).bindings(), {
287
+ await p(), q();
288
+ }), m(() => {
289
+ N = !1, E.value?.removeEventListener("scroll", Q), D.value?.removeEventListener("load", q, !0), j?.disconnect(), j = null, A?.disconnect(), A = null, M.clear(), P = "";
290
+ }), S({
291
+ focus: Z,
292
+ scrollToBoundary: ne,
293
+ reveal: re
294
+ }), (e, t) => (g(), ee("div", f(y(te).bindings(), {
249
295
  ref_key: "viewportRef",
250
- ref: T,
296
+ ref: E,
251
297
  class: "s-scroll-viewport",
252
- role: "region",
253
- "aria-label": M.value.accessibleLabel,
254
- tabindex: M.value.focusable ? 0 : void 0,
255
- "data-axis": M.value.axis,
256
- "data-block-size": M.value.blockSize,
257
- "data-focusable": M.value.focusable,
258
- "data-keyboard-navigation": M.value.keyboardNavigation,
259
- "data-overscroll-behavior": M.value.overscrollBehavior,
260
- "data-at-inline-start": D.value?.atInlineStart,
261
- "data-at-inline-end": D.value?.atInlineEnd,
262
- "data-at-block-start": D.value?.atBlockStart,
263
- "data-at-block-end": D.value?.atBlockEnd,
264
- onKeydown: q
265
- }), [l("div", {
298
+ role: R.value ? "region" : void 0,
299
+ "aria-label": R.value ? I.value.accessibleLabel : void 0,
300
+ "aria-labelledby": R.value ? I.value.accessibleLabelledby : void 0,
301
+ tabindex: B.value,
302
+ "data-axis": I.value.axis,
303
+ "data-block-size": I.value.blockSize,
304
+ "data-max-block-size": I.value.maxBlockSize,
305
+ "data-focus-policy": I.value.focusPolicy,
306
+ "data-focusable": z.value,
307
+ "data-keyboard-navigation": I.value.keyboardNavigation,
308
+ "data-overscroll-behavior": I.value.overscrollBehavior,
309
+ "data-at-inline-start": O.value?.atInlineStart,
310
+ "data-at-inline-end": O.value?.atInlineEnd,
311
+ "data-at-block-start": O.value?.atBlockStart,
312
+ "data-at-block-end": O.value?.atBlockEnd,
313
+ onFocus: ae,
314
+ onBlur: oe,
315
+ onKeydown: se
316
+ }), [u("div", {
266
317
  ref_key: "contentRef",
267
- ref: E,
318
+ ref: D,
268
319
  class: "s-scroll-viewport__content"
269
- }, [g(e.$slots, "default", {}, void 0, !0)], 512)], 16, b));
320
+ }, [_(e.$slots, "default", {}, void 0, !0)], 512)], 16, x));
270
321
  }
271
322
  });
272
323
  //#endregion
273
- export { x as default };
324
+ export { S as default };