@openviking/react 0.1.5 → 0.1.7

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 (145) hide show
  1. package/README.md +15 -11
  2. package/dist/2~0.js +6 -5
  3. package/dist/37~0.js +27 -0
  4. package/dist/3c~0.js +24 -12
  5. package/dist/3~0.js +19 -9
  6. package/dist/ae~0.js +8 -1
  7. package/dist/ark-message-list-view~0.js +9 -4
  8. package/dist/a~0.js +13 -7
  9. package/dist/c7r~0.js +50 -0
  10. package/dist/ck~0.js +7 -0
  11. package/dist/client/paths.d.ts +10 -0
  12. package/dist/client/provider.d.ts +6 -1
  13. package/dist/components/agent-connect/style.css +268 -37
  14. package/dist/components/directory-tour/style.css +265 -21
  15. package/dist/components/directory-tour.js +1 -1
  16. package/dist/components/experience-dashboard/dashboard-tabs.d.ts +11 -0
  17. package/dist/components/experience-dashboard/experience-dashboard.d.ts +2 -0
  18. package/dist/components/experience-dashboard/experience-impact.d.ts +11 -0
  19. package/dist/components/experience-dashboard/experience-list.d.ts +9 -0
  20. package/dist/components/experience-dashboard/experience-pagination.d.ts +8 -0
  21. package/dist/components/experience-dashboard/experience-tests.d.ts +6 -0
  22. package/dist/components/experience-dashboard/experience-trajectories.d.ts +6 -0
  23. package/dist/components/experience-dashboard/index.d.ts +2 -0
  24. package/dist/components/experience-dashboard/labels.d.ts +2 -0
  25. package/dist/components/experience-dashboard/style.css +914 -0
  26. package/dist/components/experience-dashboard/style.js +0 -0
  27. package/dist/components/experience-dashboard/types.d.ts +106 -0
  28. package/dist/components/experience-dashboard.js +1 -0
  29. package/dist/components/file-browser-entries/style.css +463 -86
  30. package/dist/components/file-preview/style.css +267 -78
  31. package/dist/components/file-tree/file-tree-toolbar.d.ts +3 -3
  32. package/dist/components/file-tree/locales/en-US.d.ts +3 -0
  33. package/dist/components/file-tree/locales/zh-CN.d.ts +3 -0
  34. package/dist/components/file-tree/style.css +372 -88
  35. package/dist/components/file-tree/types.d.ts +13 -4
  36. package/dist/components/scope-switcher/style.css +412 -39
  37. package/dist/components/style.css +9326 -4553
  38. package/dist/components/tui/style.css +385 -67
  39. package/dist/components/viking-bot/interaction/style.css +143 -22
  40. package/dist/components/viking-bot/style.css +1075 -278
  41. package/dist/components/wiki-dashboard/index.d.ts +2 -0
  42. package/dist/components/wiki-dashboard/labels.d.ts +2 -0
  43. package/dist/components/wiki-dashboard/style.css +956 -0
  44. package/dist/components/wiki-dashboard/style.js +0 -0
  45. package/dist/components/wiki-dashboard/types.d.ts +92 -0
  46. package/dist/components/wiki-dashboard/wiki-action-button.d.ts +9 -0
  47. package/dist/components/wiki-dashboard/wiki-conflict-card.d.ts +15 -0
  48. package/dist/components/wiki-dashboard/wiki-dashboard.d.ts +2 -0
  49. package/dist/components/wiki-dashboard/wiki-file-icon.d.ts +3 -0
  50. package/dist/components/wiki-dashboard/wiki-severity-filter.d.ts +8 -0
  51. package/dist/components/wiki-dashboard.js +1 -0
  52. package/dist/c~0.js +16 -8
  53. package/dist/ep~0.js +345 -0
  54. package/dist/e~0.js +33 -328
  55. package/dist/fj~0.js +507 -0
  56. package/dist/fl~0.js +709 -0
  57. package/dist/f~0.js +12 -27
  58. package/dist/icons/index.d.ts +28 -0
  59. package/dist/icons.js +1 -1
  60. package/dist/index.d.ts +4 -0
  61. package/dist/index.js +3 -1
  62. package/dist/k~0.js +277 -1
  63. package/dist/lk~0.js +56 -14
  64. package/dist/l~0.js +2786 -446
  65. package/dist/modules/console/index.d.ts +1 -2
  66. package/dist/modules/console/style.css +1787 -346
  67. package/dist/modules/console.js +1 -1
  68. package/dist/modules/file-browser/acl/acl-add-principal.d.ts +12 -0
  69. package/dist/modules/file-browser/acl/acl-candidate.d.ts +8 -0
  70. package/dist/modules/file-browser/acl/acl-client.d.ts +13 -0
  71. package/dist/modules/file-browser/acl/acl-confirmation.d.ts +6 -0
  72. package/dist/modules/file-browser/acl/acl-entry.d.ts +13 -0
  73. package/dist/modules/file-browser/acl/acl-labels.d.ts +47 -0
  74. package/dist/modules/file-browser/acl/acl-menu.d.ts +10 -0
  75. package/dist/modules/file-browser/acl/acl-modal.d.ts +17 -0
  76. package/dist/modules/file-browser/acl/acl-model.d.ts +17 -0
  77. package/dist/modules/file-browser/acl/acl-principal-tabs.d.ts +6 -0
  78. package/dist/modules/file-browser/acl/acl-tag.d.ts +7 -0
  79. package/dist/modules/file-browser/acl/locales/en-US.d.ts +44 -0
  80. package/dist/modules/file-browser/acl/locales/zh-CN.d.ts +44 -0
  81. package/dist/modules/file-browser/acl/use-acl-principals.d.ts +17 -0
  82. package/dist/modules/file-browser/acl/use-acl-report.d.ts +27 -0
  83. package/dist/modules/file-browser/acl-types.d.ts +86 -0
  84. package/dist/modules/file-browser/dashboard-data.d.ts +9 -0
  85. package/dist/modules/file-browser/dashboard-indicator.d.ts +8 -0
  86. package/dist/modules/file-browser/dashboard-labels.d.ts +9 -0
  87. package/dist/modules/file-browser/dashboard-model.d.ts +17 -0
  88. package/dist/modules/file-browser/dashboard-resource.d.ts +12 -0
  89. package/dist/modules/file-browser/experience-dashboard-pane.d.ts +8 -0
  90. package/dist/modules/file-browser/experience-data.d.ts +31 -0
  91. package/dist/modules/file-browser/file-browser-detail.d.ts +4 -1
  92. package/dist/modules/file-browser/file-browser-labels.d.ts +1 -1
  93. package/dist/modules/file-browser/file-browser-search.d.ts +20 -0
  94. package/dist/modules/file-browser/file-browser-toolbar.d.ts +3 -10
  95. package/dist/modules/file-browser/file-browser-tree-pane.d.ts +4 -7
  96. package/dist/modules/file-browser/file-browser.d.ts +1 -1
  97. package/dist/modules/file-browser/fs-directories.d.ts +9 -0
  98. package/dist/modules/file-browser/fs-lines.d.ts +36 -0
  99. package/dist/modules/file-browser/fs-memory-fields.d.ts +65 -0
  100. package/dist/modules/file-browser/fs-model.d.ts +15 -3
  101. package/dist/modules/file-browser/fs-read-file.d.ts +14 -0
  102. package/dist/modules/file-browser/index.d.ts +3 -2
  103. package/dist/modules/file-browser/locales/en-US.d.ts +5 -0
  104. package/dist/modules/file-browser/locales/zh-CN.d.ts +5 -0
  105. package/dist/modules/file-browser/style.css +4033 -483
  106. package/dist/modules/file-browser/types.d.ts +82 -20
  107. package/dist/modules/file-browser/use-browser-dashboards.d.ts +31 -0
  108. package/dist/modules/file-browser/use-dashboard-query.d.ts +9 -0
  109. package/dist/modules/file-browser/use-experience-dashboard.d.ts +27 -0
  110. package/dist/modules/file-browser/use-file-browser-acl.d.ts +15 -0
  111. package/dist/modules/file-browser/use-file-browser.d.ts +6 -51
  112. package/dist/modules/file-browser/use-fs-tree.d.ts +3 -0
  113. package/dist/modules/file-browser/use-wiki-dashboard.d.ts +17 -0
  114. package/dist/modules/file-browser/wiki-conflicts.d.ts +12 -0
  115. package/dist/modules/file-browser/wiki-dashboard-pane.d.ts +14 -0
  116. package/dist/modules/file-browser.js +1 -1
  117. package/dist/modules/scope-cascade/controller.d.ts +2 -2
  118. package/dist/modules/scope-cascade/index.d.ts +1 -2
  119. package/dist/modules/scope-cascade/scope-cascade.d.ts +1 -1
  120. package/dist/modules/scope-cascade/style.css +581 -39
  121. package/dist/modules/scope-cascade/types.d.ts +8 -3
  122. package/dist/modules/scope-cascade/use-scope-cascade.d.ts +2 -2
  123. package/dist/modules/scope-cascade.js +1 -1
  124. package/dist/modules/style.css +13589 -7966
  125. package/dist/n~0.js +73 -165
  126. package/dist/rt~0.js +255 -0
  127. package/dist/r~0.js +18 -39
  128. package/dist/shared/components/button/button.d.ts +20 -0
  129. package/dist/shared/components/input/input.d.ts +17 -0
  130. package/dist/shared/components/modal/locales/en-US.d.ts +4 -0
  131. package/dist/shared/components/modal/locales/zh-CN.d.ts +4 -0
  132. package/dist/shared/components/modal/modal.d.ts +2 -0
  133. package/dist/shared/components/modal/types.d.ts +18 -0
  134. package/dist/shared/components/overlay/lock-body-scroll.d.ts +1 -0
  135. package/dist/shared/components/popover/popover.d.ts +1 -1
  136. package/dist/shared/components/popover/types.d.ts +7 -1
  137. package/dist/shared/dashboard/dashboard-state.d.ts +12 -0
  138. package/dist/static/image/dashboard-background.png +0 -0
  139. package/dist/style.css +16088 -5602
  140. package/dist/s~0.js +16 -0
  141. package/dist/u~0.js +15 -6
  142. package/dist/viking-bot-composer~0.js +30 -12
  143. package/dist/viking-bot-interaction~0.js +2 -1
  144. package/package.json +14 -3
  145. package/dist/o~0.js +0 -106
package/dist/s~0.js ADDED
@@ -0,0 +1,16 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import "react";
3
+ const SvgChevronDown = (props)=>/*#__PURE__*/ jsx("svg", {
4
+ xmlns: "http://www.w3.org/2000/svg",
5
+ width: 14,
6
+ height: 14,
7
+ fill: "none",
8
+ viewBox: "0 0 14 14",
9
+ ...props,
10
+ children: /*#__PURE__*/ jsx("path", {
11
+ fill: "currentColor",
12
+ d: "M9.607 5.232a.437.437 0 1 1 .619.619L7.309 8.768a.437.437 0 0 1-.618 0L3.774 5.85a.437.437 0 1 1 .619-.619L7 7.84z"
13
+ })
14
+ });
15
+ const chevron_downreact = SvgChevronDown;
16
+ export { chevron_downreact };
package/dist/u~0.js CHANGED
@@ -6,6 +6,7 @@ import rehype_sanitize from "rehype-sanitize";
6
6
  import remark_gfm from "remark-gfm";
7
7
  import { resolveLocale } from "./nx~0.js";
8
8
  import { checkreact } from "./0~0.js";
9
+ import { button_Button } from "./e~0.js";
9
10
  import { useLocale } from "./28~0.js";
10
11
  const SvgCodexDetail = (props)=>/*#__PURE__*/ jsxs("svg", {
11
12
  xmlns: "http://www.w3.org/2000/svg",
@@ -693,8 +694,11 @@ function AgentConnectCodeBlock({ display, copyText, language, locale, visibleBlo
693
694
  /*#__PURE__*/ jsxs("div", {
694
695
  className: "ov-agent-connect__code-actions",
695
696
  children: [
696
- hasKey ? /*#__PURE__*/ jsx("button", {
697
- type: "button",
697
+ hasKey ? /*#__PURE__*/ jsx(button_Button, {
698
+ size: "mini",
699
+ type: "text",
700
+ iconOnly: true,
701
+ htmlType: "button",
698
702
  "aria-pressed": revealed,
699
703
  "aria-label": revealLabel,
700
704
  title: revealLabel,
@@ -703,8 +707,11 @@ function AgentConnectCodeBlock({ display, copyText, language, locale, visibleBlo
703
707
  "aria-hidden": "true"
704
708
  })
705
709
  }) : null,
706
- /*#__PURE__*/ jsx("button", {
707
- type: "button",
710
+ /*#__PURE__*/ jsx(button_Button, {
711
+ size: "mini",
712
+ type: "text",
713
+ iconOnly: true,
714
+ htmlType: "button",
708
715
  disabled: 'pending' === status,
709
716
  "aria-label": copyLabel,
710
717
  title: copyLabel,
@@ -907,9 +914,11 @@ function AgentConnectInstructionsView({ instructions, apiKey, locale, agreementU
907
914
  className: "ov-agent-connect__instructions-title",
908
915
  children: labels.instructions
909
916
  }),
910
- /*#__PURE__*/ jsxs("button", {
917
+ /*#__PURE__*/ jsxs(button_Button, {
918
+ size: "mini",
919
+ type: "text",
911
920
  className: "ov-agent-connect__copy",
912
- type: "button",
921
+ htmlType: "button",
913
922
  disabled: 'pending' === status,
914
923
  onClick: ()=>void copy(),
915
924
  children: [
@@ -1,10 +1,12 @@
1
1
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
2
  import { Sender } from "@ark-design/ui/sender";
3
3
  import { forwardRef, useCallback, useEffect, useId, useImperativeHandle, useMemo, useRef, useState } from "react";
4
- import { Tooltip } from "./r~0.js";
4
+ import { Tooltip } from "./rt~0.js";
5
+ import { button_Button } from "./e~0.js";
5
6
  import { VikingBotIcon } from "./lg~0.js";
6
7
  import { resolveVikingBotLabels, BotPopover, useQuickInput, QuickInputs } from "./c~0.js";
7
8
  import { usePortalTheme } from "./9~0.js";
9
+ import { input_Input } from "./c7r~0.js";
8
10
  import { FileTree as file_tree_FileTree } from "./n~0.js";
9
11
  import { useLocale } from "./28~0.js";
10
12
  const SvgSend = (props)=>/*#__PURE__*/ jsx("svg", {
@@ -34,9 +36,13 @@ const attachreact = SvgAttach;
34
36
  function VikingBotSubmit({ onSend, onStop, sending, tip, className, label, ...props }) {
35
37
  return /*#__PURE__*/ jsx(Tooltip, {
36
38
  content: tip ?? label,
37
- children: /*#__PURE__*/ jsx("button", {
39
+ children: /*#__PURE__*/ jsx(button_Button, {
38
40
  ...props,
39
- type: "button",
41
+ size: "default",
42
+ type: "primary",
43
+ shape: "circle",
44
+ iconOnly: true,
45
+ htmlType: "button",
40
46
  className: [
41
47
  'ov-viking-bot__submit',
42
48
  className
@@ -56,9 +62,12 @@ function VikingBotSubmit({ onSend, onStop, sending, tip, className, label, ...pr
56
62
  function VikingBotAttach({ label, ...props }) {
57
63
  return /*#__PURE__*/ jsx(Tooltip, {
58
64
  content: label,
59
- children: /*#__PURE__*/ jsx("button", {
65
+ children: /*#__PURE__*/ jsx(button_Button, {
60
66
  ...props,
61
- type: "button",
67
+ size: "mini",
68
+ type: "text",
69
+ iconOnly: true,
70
+ htmlType: "button",
62
71
  className: "ov-viking-bot__attach",
63
72
  "aria-label": label,
64
73
  children: /*#__PURE__*/ jsx(attachreact, {
@@ -106,8 +115,11 @@ function ComposerAttachments({ items, onRemove, disabled, labels }) {
106
115
  className: "ov-viking-bot__attachment-status",
107
116
  children: item.errorMessage ?? labels.toolError
108
117
  }) : null,
109
- onRemove ? /*#__PURE__*/ jsx("button", {
110
- type: "button",
118
+ onRemove ? /*#__PURE__*/ jsx(button_Button, {
119
+ size: "mini",
120
+ type: "text",
121
+ iconOnly: true,
122
+ htmlType: "button",
111
123
  "aria-label": `${labels.removeAttachment}: ${item.name}`,
112
124
  disabled: disabled,
113
125
  onClick: ()=>onRemove(item),
@@ -182,7 +194,7 @@ function ReferencePicker({ config, locale, query: externalQuery, editor, onSelec
182
194
  htmlFor: id,
183
195
  children: [
184
196
  labels.searchReferences,
185
- /*#__PURE__*/ jsx("input", {
197
+ /*#__PURE__*/ jsx(input_Input, {
186
198
  id: id,
187
199
  type: "search",
188
200
  value: search,
@@ -270,10 +282,13 @@ function ReferenceButton({ locale, config, disabled, labels, senderRef }) {
270
282
  trigger: (props)=>/*#__PURE__*/ jsx(Tooltip, {
271
283
  content: labels.reference,
272
284
  disabled: true === props['aria-expanded'],
273
- children: /*#__PURE__*/ jsx("button", {
285
+ children: /*#__PURE__*/ jsx(button_Button, {
274
286
  ...props,
287
+ size: "mini",
288
+ type: "text",
289
+ iconOnly: true,
275
290
  className: "ov-viking-bot__attach",
276
- type: "button",
291
+ htmlType: "button",
277
292
  "aria-label": labels.reference,
278
293
  disabled: disabled,
279
294
  children: "@"
@@ -304,8 +319,11 @@ function ReferenceTags({ config, labels, disabled }) {
304
319
  children: item.name
305
320
  })
306
321
  }),
307
- /*#__PURE__*/ jsx("button", {
308
- type: "button",
322
+ /*#__PURE__*/ jsx(button_Button, {
323
+ size: "mini",
324
+ type: "text",
325
+ iconOnly: true,
326
+ htmlType: "button",
309
327
  disabled: disabled,
310
328
  "aria-label": `${labels.removeReference}: ${item.name}`,
311
329
  onClick: ()=>config.onChange(config.selected.filter((entry)=>entry.uri !== item.uri)),
@@ -1,6 +1,7 @@
1
1
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
2
  import { AskHuman } from "@ark-design/ui/ask-human";
3
3
  import { useState } from "react";
4
+ import { input_TextArea } from "./c7r~0.js";
4
5
  import { useLocale } from "./28~0.js";
5
6
  import { resolveInteractionLabels } from "./c7~0.js";
6
7
  const toFields = (request, other)=>{
@@ -185,7 +186,7 @@ const TextInput = ({ request, label, disabled, onChange })=>/*#__PURE__*/ jsxs(F
185
186
  request.description ? /*#__PURE__*/ jsx("p", {
186
187
  children: request.description
187
188
  }) : null,
188
- /*#__PURE__*/ jsx("textarea", {
189
+ /*#__PURE__*/ jsx(input_TextArea, {
189
190
  className: "ov-viking-bot__interaction-input",
190
191
  defaultValue: request.initialValue,
191
192
  disabled: disabled,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openviking/react",
3
- "version": "0.1.5",
3
+ "version": "0.1.7",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -15,7 +15,8 @@
15
15
  "files": [
16
16
  "dist",
17
17
  "README.md",
18
- "LICENSE.arco-design"
18
+ "LICENSE.arco-design",
19
+ "!dist/docs/**"
19
20
  ],
20
21
  "sideEffects": [
21
22
  "**/*.css"
@@ -96,7 +97,17 @@
96
97
  "types": "./dist/components/directory-tour/index.d.ts",
97
98
  "import": "./dist/components/directory-tour.js"
98
99
  },
99
- "./components/directory-tour/style.css": "./dist/components/directory-tour/style.css"
100
+ "./components/directory-tour/style.css": "./dist/components/directory-tour/style.css",
101
+ "./components/wiki-dashboard": {
102
+ "types": "./dist/components/wiki-dashboard/index.d.ts",
103
+ "import": "./dist/components/wiki-dashboard.js"
104
+ },
105
+ "./components/wiki-dashboard/style.css": "./dist/components/wiki-dashboard/style.css",
106
+ "./components/experience-dashboard": {
107
+ "types": "./dist/components/experience-dashboard/index.d.ts",
108
+ "import": "./dist/components/experience-dashboard.js"
109
+ },
110
+ "./components/experience-dashboard/style.css": "./dist/components/experience-dashboard/style.css"
100
111
  },
101
112
  "scripts": {
102
113
  "dev": "rslib build --watch",
package/dist/o~0.js DELETED
@@ -1,106 +0,0 @@
1
- import { useEffect, useLayoutEffect, useState } from "react";
2
- const usePositionEffect = "u" < typeof window ? useEffect : useLayoutEffect;
3
- const OVERLAY_OFFSET = 6;
4
- const VIEWPORT_MARGIN = 8;
5
- const OPPOSITE = {
6
- top: 'bottom',
7
- bottom: 'top',
8
- left: 'right',
9
- right: 'left'
10
- };
11
- function resolvePosition(trigger, surface, placement, alignment = 'center') {
12
- const viewportWidth = window.innerWidth;
13
- const viewportHeight = window.innerHeight;
14
- const fits = (side)=>{
15
- if ('top' === side) return trigger.top - surface.height - OVERLAY_OFFSET >= VIEWPORT_MARGIN;
16
- if ('bottom' === side) return trigger.bottom + surface.height + OVERLAY_OFFSET <= viewportHeight - VIEWPORT_MARGIN;
17
- if ('left' === side) return trigger.left - surface.width - OVERLAY_OFFSET >= VIEWPORT_MARGIN;
18
- return trigger.right + surface.width + OVERLAY_OFFSET <= viewportWidth - VIEWPORT_MARGIN;
19
- };
20
- const side = fits(placement) || !fits(OPPOSITE[placement]) ? placement : OPPOSITE[placement];
21
- const clamp = (value, size, limit)=>Math.min(Math.max(value, VIEWPORT_MARGIN), limit - size - VIEWPORT_MARGIN);
22
- if ('top' === side || 'bottom' === side) {
23
- const top = 'top' === side ? trigger.top - surface.height - OVERLAY_OFFSET : trigger.bottom + OVERLAY_OFFSET;
24
- const left = 'end' === alignment ? trigger.right - surface.width : trigger.left + trigger.width / 2 - surface.width / 2;
25
- return {
26
- top: clamp(top, surface.height, viewportHeight),
27
- left: clamp(left, surface.width, viewportWidth),
28
- placement: side
29
- };
30
- }
31
- const left = 'left' === side ? trigger.left - surface.width - OVERLAY_OFFSET : trigger.right + OVERLAY_OFFSET;
32
- const top = trigger.top + trigger.height / 2 - surface.height / 2;
33
- return {
34
- top: clamp(top, surface.height, viewportHeight),
35
- left: clamp(left, surface.width, viewportWidth),
36
- placement: side
37
- };
38
- }
39
- function useOverlayPosition(open, triggerRef, surface, placement, alignment = 'center') {
40
- const [position, setPosition] = useState({
41
- top: 0,
42
- left: 0,
43
- placement
44
- });
45
- usePositionEffect(()=>{
46
- if (!open) return;
47
- const trigger = triggerRef.current;
48
- if (!trigger || !surface) return;
49
- const written = new Set();
50
- const syncTheme = ()=>{
51
- const triggerStyle = window.getComputedStyle(trigger);
52
- const seen = new Set();
53
- for (const name of Array.from(triggerStyle)){
54
- if (!name.startsWith('--ov-ui-color-')) continue;
55
- const value = triggerStyle.getPropertyValue(name).trim();
56
- if (value) {
57
- seen.add(name);
58
- surface.style.setProperty(name, value);
59
- }
60
- }
61
- for (const name of written)if (!seen.has(name)) surface.style.removeProperty(name);
62
- written.clear();
63
- seen.forEach((name)=>written.add(name));
64
- };
65
- syncTheme();
66
- const themeObserver = new MutationObserver(syncTheme);
67
- const observerOptions = {
68
- attributes: true,
69
- attributeFilter: [
70
- 'class',
71
- 'style',
72
- 'data-theme'
73
- ]
74
- };
75
- for(let node = trigger; node; node = node.parentElement)themeObserver.observe(node, observerOptions);
76
- const update = ()=>{
77
- const triggerRect = trigger.getBoundingClientRect();
78
- const surfaceRect = surface.getBoundingClientRect();
79
- const next = resolvePosition(triggerRect, {
80
- width: surfaceRect.width,
81
- height: surfaceRect.height
82
- }, placement, alignment);
83
- setPosition((previous)=>previous.top === next.top && previous.left === next.left && previous.placement === next.placement ? previous : next);
84
- };
85
- update();
86
- const observer = new ResizeObserver(update);
87
- observer.observe(surface);
88
- window.addEventListener('scroll', update, true);
89
- window.addEventListener('resize', update);
90
- return ()=>{
91
- observer.disconnect();
92
- themeObserver.disconnect();
93
- written.forEach((name)=>surface.style.removeProperty(name));
94
- window.removeEventListener('scroll', update, true);
95
- window.removeEventListener('resize', update);
96
- };
97
- }, [
98
- open,
99
- placement,
100
- surface,
101
- triggerRef,
102
- alignment
103
- ]);
104
- return position;
105
- }
106
- export { useOverlayPosition };