one-design-next 0.0.97 → 0.0.99
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 +5 -18
- package/dist/_genui-types.d.ts +3 -1
- package/dist/_genui-types.js +2 -0
- package/dist/button/style/index.css +3 -0
- package/dist/chat-group/index.d.ts +48 -0
- package/dist/chat-group/index.js +250 -0
- package/dist/chat-group/presence-list.d.ts +29 -0
- package/dist/chat-group/presence-list.js +194 -0
- package/dist/chat-group/style/index.css +387 -0
- package/dist/chat-group/style/index.d.ts +2 -0
- package/dist/chat-group/style/index.js +2 -0
- package/dist/chat-item/index.d.ts +17 -2
- package/dist/chat-item/index.js +78 -10
- package/dist/chat-item/style/index.css +42 -27
- package/dist/chat-list/index.d.ts +61 -2
- package/dist/chat-list/index.js +604 -71
- package/dist/chat-list/style/index.css +266 -25
- package/dist/dropdown/index.d.ts +3 -2
- package/dist/dropdown/index.js +267 -236
- package/dist/dropdown/style/index.css +84 -6
- package/dist/hover-fill/index.d.ts +2 -2
- package/dist/hover-fill/index.js +179 -27
- package/dist/index.d.ts +3 -2
- package/dist/index.js +2 -1
- package/package.json +2 -2
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
@charset "UTF-8";
|
|
1
2
|
[data-odn-dropdown-content] {
|
|
2
3
|
min-width: 8rem;
|
|
3
4
|
overflow: hidden;
|
|
@@ -64,7 +65,11 @@
|
|
|
64
65
|
}
|
|
65
66
|
|
|
66
67
|
[data-odn-dropdown-item][data-highlighted] {
|
|
67
|
-
background-color:
|
|
68
|
+
background-color: transparent;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
[data-odn-dropdown-item][data-variant=destructive][data-highlighted] {
|
|
72
|
+
background-color: transparent;
|
|
68
73
|
}
|
|
69
74
|
|
|
70
75
|
[data-odn-dropdown-label] {
|
|
@@ -118,7 +123,7 @@
|
|
|
118
123
|
}
|
|
119
124
|
|
|
120
125
|
[data-odn-dropdown-sub-trigger][data-highlighted] {
|
|
121
|
-
background-color:
|
|
126
|
+
background-color: transparent;
|
|
122
127
|
}
|
|
123
128
|
|
|
124
129
|
[data-odn-dropdown-sub-trigger][data-inset] {
|
|
@@ -146,18 +151,91 @@
|
|
|
146
151
|
will-change: transform, opacity;
|
|
147
152
|
}
|
|
148
153
|
|
|
149
|
-
|
|
150
|
-
|
|
154
|
+
/*
|
|
155
|
+
* 宿主可能把整个 portal 挂载层设为 pointer-events: none(如 Drawer viewport
|
|
156
|
+
* 只让浮层吃事件、背景不抢点击)。pointer-events 会继承,浮层需自行恢复,
|
|
157
|
+
* 否则「看得见但点不中」。限定 [data-open],关闭动画期间仍交给 Base UI。
|
|
158
|
+
*/
|
|
159
|
+
[data-odn-dropdown-content][data-open],
|
|
160
|
+
[data-odn-dropdown-sub-content][data-open] {
|
|
161
|
+
pointer-events: auto;
|
|
151
162
|
}
|
|
152
163
|
|
|
153
|
-
|
|
154
|
-
|
|
164
|
+
/*
|
|
165
|
+
* 紧凑尺寸:字号对齐 popup token、行高 28px,hover 不通栏(左右各缩 4px + 圆角)。
|
|
166
|
+
* 经 popupClassName opt-in,子菜单跟随主浮层。
|
|
167
|
+
*/
|
|
168
|
+
[data-odn-dropdown-content].odn-dropdown-compact,
|
|
169
|
+
[data-odn-dropdown-sub-content].odn-dropdown-compact {
|
|
170
|
+
--odn-font-size: var(--odn-popup-font-size);
|
|
171
|
+
--odn-line-height: var(--odn-popup-line-height);
|
|
172
|
+
--odn-popup-control-height: 28px;
|
|
173
|
+
}
|
|
174
|
+
[data-odn-dropdown-content].odn-dropdown-compact [data-odn-dropdown-label],
|
|
175
|
+
[data-odn-dropdown-sub-content].odn-dropdown-compact [data-odn-dropdown-label] {
|
|
176
|
+
height: auto;
|
|
177
|
+
padding: 0 12px 2px;
|
|
178
|
+
}
|
|
179
|
+
[data-odn-dropdown-content].odn-dropdown-compact,
|
|
180
|
+
[data-odn-dropdown-sub-content].odn-dropdown-compact {
|
|
181
|
+
/* padding 8px + HoverFill margin 4px,使文案仍落在 12px */
|
|
182
|
+
}
|
|
183
|
+
[data-odn-dropdown-content].odn-dropdown-compact [data-odn-hover-fill]:has([data-odn-dropdown-item]),
|
|
184
|
+
[data-odn-dropdown-content].odn-dropdown-compact [data-odn-hover-fill]:has([data-odn-dropdown-sub-trigger]),
|
|
185
|
+
[data-odn-dropdown-sub-content].odn-dropdown-compact [data-odn-hover-fill]:has([data-odn-dropdown-item]),
|
|
186
|
+
[data-odn-dropdown-sub-content].odn-dropdown-compact [data-odn-hover-fill]:has([data-odn-dropdown-sub-trigger]) {
|
|
187
|
+
margin: 0 4px;
|
|
188
|
+
}
|
|
189
|
+
[data-odn-dropdown-content].odn-dropdown-compact [data-odn-dropdown-item],
|
|
190
|
+
[data-odn-dropdown-content].odn-dropdown-compact [data-odn-dropdown-sub-trigger],
|
|
191
|
+
[data-odn-dropdown-sub-content].odn-dropdown-compact [data-odn-dropdown-item],
|
|
192
|
+
[data-odn-dropdown-sub-content].odn-dropdown-compact [data-odn-dropdown-sub-trigger] {
|
|
193
|
+
padding-inline: 8px;
|
|
194
|
+
}
|
|
195
|
+
[data-odn-dropdown-content].odn-dropdown-compact .odn-dropdown-item-bg,
|
|
196
|
+
[data-odn-dropdown-sub-content].odn-dropdown-compact .odn-dropdown-item-bg {
|
|
197
|
+
border-radius: 4px;
|
|
198
|
+
}
|
|
199
|
+
[data-odn-dropdown-content].odn-dropdown-compact,
|
|
200
|
+
[data-odn-dropdown-sub-content].odn-dropdown-compact {
|
|
201
|
+
/* 组间线:上下各 8px padding,线画在 content-box,左右内缩 */
|
|
202
|
+
}
|
|
203
|
+
[data-odn-dropdown-content].odn-dropdown-compact [data-odn-dropdown-separator],
|
|
204
|
+
[data-odn-dropdown-sub-content].odn-dropdown-compact [data-odn-dropdown-separator] {
|
|
205
|
+
box-sizing: content-box;
|
|
206
|
+
height: 1px;
|
|
207
|
+
margin: 0 12px;
|
|
208
|
+
padding: 8px 0;
|
|
209
|
+
background-color: var(--odn-color-black-5);
|
|
210
|
+
background-clip: content-box;
|
|
211
|
+
}
|
|
212
|
+
[data-odn-dropdown-content].odn-dropdown-compact,
|
|
213
|
+
[data-odn-dropdown-sub-content].odn-dropdown-compact {
|
|
214
|
+
/* 默认 Icon 16px,对 13px/28px 行偏大;对齐 ChatList 工具栏 / ChatItem 触发器 */
|
|
215
|
+
}
|
|
216
|
+
[data-odn-dropdown-content].odn-dropdown-compact [data-odn-dropdown-item-icon],
|
|
217
|
+
[data-odn-dropdown-content].odn-dropdown-compact [data-odn-dropdown-chevron],
|
|
218
|
+
[data-odn-dropdown-sub-content].odn-dropdown-compact [data-odn-dropdown-item-icon],
|
|
219
|
+
[data-odn-dropdown-sub-content].odn-dropdown-compact [data-odn-dropdown-chevron] {
|
|
220
|
+
width: 14px;
|
|
221
|
+
height: 14px;
|
|
222
|
+
flex-shrink: 0;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
[data-odn-dropdown-item][data-variant=destructive] {
|
|
226
|
+
color: #dc2626;
|
|
155
227
|
}
|
|
156
228
|
|
|
157
229
|
[data-odn-dropdown-item][data-inset] {
|
|
158
230
|
padding-left: 32px;
|
|
159
231
|
}
|
|
160
232
|
|
|
233
|
+
[data-odn-hover-fill]:has([data-odn-dropdown-item][data-highlighted]) [data-odn-hover-fill-bg],
|
|
234
|
+
[data-odn-hover-fill]:has([data-odn-dropdown-sub-trigger][data-highlighted]) [data-odn-hover-fill-bg] {
|
|
235
|
+
background-color: var(--odn-color-black-1);
|
|
236
|
+
transform: scale(1);
|
|
237
|
+
}
|
|
238
|
+
|
|
161
239
|
[data-odn-dropdown-scroll-area] {
|
|
162
240
|
flex: 1;
|
|
163
241
|
max-height: calc(var(--available-height, 100vh) - 8px);
|
|
@@ -3,12 +3,12 @@ import './style';
|
|
|
3
3
|
export interface HoverFillProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
4
4
|
/**
|
|
5
5
|
* @description hover 颜色
|
|
6
|
-
* @default '
|
|
6
|
+
* @default 'var(--odn-color-black-2)'
|
|
7
7
|
*/
|
|
8
8
|
hoverColor?: string;
|
|
9
9
|
/**
|
|
10
10
|
* @description active 颜色
|
|
11
|
-
* @default '
|
|
11
|
+
* @default 'var(--odn-color-black-6)'
|
|
12
12
|
*/
|
|
13
13
|
activeColor?: string;
|
|
14
14
|
/**
|
package/dist/hover-fill/index.js
CHANGED
|
@@ -5,12 +5,120 @@ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
|
5
5
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
6
6
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
7
7
|
var _excluded = ["bgClassName", "bgStyle", "children", "onMouseEnter", "onMouseLeave", "onMouseDown", "hoverColor", "activeColor", "disabled", "hoverCursor"];
|
|
8
|
-
import React, { forwardRef, useCallback, useContext, useEffect, useRef } from 'react';
|
|
8
|
+
import React, { forwardRef, useCallback, useContext, useEffect, useLayoutEffect, useRef } from 'react';
|
|
9
9
|
import { observeResize } from "../_util/sharedResizeObserver";
|
|
10
10
|
import { ConfigContext } from "../config-provider";
|
|
11
11
|
import "./style";
|
|
12
|
-
var DEFAULT_HOVER_COLOR = '
|
|
13
|
-
var DEFAULT_ACTIVE_COLOR = '
|
|
12
|
+
var DEFAULT_HOVER_COLOR = 'var(--odn-color-black-2)';
|
|
13
|
+
var DEFAULT_ACTIVE_COLOR = 'var(--odn-color-black-6)';
|
|
14
|
+
function emptyHoverFillState() {
|
|
15
|
+
return {
|
|
16
|
+
timer: 0,
|
|
17
|
+
bgVisible: false,
|
|
18
|
+
bgX: 0,
|
|
19
|
+
bgY: 0,
|
|
20
|
+
bgScale: 0,
|
|
21
|
+
baseNode: null,
|
|
22
|
+
bgNode: null
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
function resetBgInline(node) {
|
|
26
|
+
if (!node) {
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
node.style.transition = 'none';
|
|
30
|
+
node.style.background = '';
|
|
31
|
+
node.style.width = '';
|
|
32
|
+
node.style.height = '';
|
|
33
|
+
node.style.transform = '';
|
|
34
|
+
node.style.transformOrigin = '';
|
|
35
|
+
void node.offsetWidth;
|
|
36
|
+
node.style.transition = '';
|
|
37
|
+
}
|
|
38
|
+
function shareRoot(el) {
|
|
39
|
+
var _el$closest;
|
|
40
|
+
return (_el$closest = el === null || el === void 0 ? void 0 : el.closest('[data-odn-hover-fill-share]')) !== null && _el$closest !== void 0 ? _el$closest : null;
|
|
41
|
+
}
|
|
42
|
+
function isNestedHoverFill(el) {
|
|
43
|
+
var _el$parentElement;
|
|
44
|
+
return Boolean((_el$parentElement = el.parentElement) === null || _el$parentElement === void 0 ? void 0 : _el$parentElement.closest('[data-odn-hover-fill]'));
|
|
45
|
+
}
|
|
46
|
+
function canShareHoverFill(from, to) {
|
|
47
|
+
if (!from || !to || from === to) {
|
|
48
|
+
return false;
|
|
49
|
+
}
|
|
50
|
+
if (isNestedHoverFill(from) || isNestedHoverFill(to)) {
|
|
51
|
+
return false;
|
|
52
|
+
}
|
|
53
|
+
if (from.parentNode && from.parentNode === to.parentNode) {
|
|
54
|
+
return true;
|
|
55
|
+
}
|
|
56
|
+
var root = shareRoot(from);
|
|
57
|
+
return Boolean(root && root === shareRoot(to));
|
|
58
|
+
}
|
|
59
|
+
var pendingHandoff = null;
|
|
60
|
+
function cancelPendingHandoff() {
|
|
61
|
+
if (!pendingHandoff) {
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
pendingHandoff.fromBg.removeEventListener('transitionend', pendingHandoff.onEnd);
|
|
65
|
+
pendingHandoff = null;
|
|
66
|
+
}
|
|
67
|
+
function commitHandoff(toRoot, toBg, hoverColor) {
|
|
68
|
+
var state = window.odnHoverFillState;
|
|
69
|
+
if (!(state !== null && state !== void 0 && state.bgVisible) || !state.bgNode || state.baseNode === toRoot) {
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
var fromBg = state.bgNode;
|
|
73
|
+
toBg.style.transition = 'none';
|
|
74
|
+
toBg.style.width = '';
|
|
75
|
+
toBg.style.height = '';
|
|
76
|
+
toBg.style.transform = 'scale(1)';
|
|
77
|
+
toBg.style.transformOrigin = '';
|
|
78
|
+
toBg.style.background = hoverColor;
|
|
79
|
+
void toBg.offsetWidth;
|
|
80
|
+
toBg.style.transition = '';
|
|
81
|
+
resetBgInline(fromBg);
|
|
82
|
+
state.baseNode = toRoot;
|
|
83
|
+
state.bgNode = toBg;
|
|
84
|
+
state.bgScale = 1;
|
|
85
|
+
}
|
|
86
|
+
function scheduleHandoff(fromBg, toRoot, toBg, hoverColor) {
|
|
87
|
+
cancelPendingHandoff();
|
|
88
|
+
var finish = function finish() {
|
|
89
|
+
var _window$odnHoverFillS;
|
|
90
|
+
cancelPendingHandoff();
|
|
91
|
+
if ((_window$odnHoverFillS = window.odnHoverFillState) !== null && _window$odnHoverFillS !== void 0 && _window$odnHoverFillS.bgVisible && window.odnHoverFillState.bgNode === fromBg) {
|
|
92
|
+
commitHandoff(toRoot, toBg, hoverColor);
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
var onEnd = function onEnd(event) {
|
|
96
|
+
if (event instanceof TransitionEvent && event.propertyName && event.propertyName !== 'transform') {
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
finish();
|
|
100
|
+
};
|
|
101
|
+
pendingHandoff = {
|
|
102
|
+
fromBg: fromBg,
|
|
103
|
+
onEnd: onEnd
|
|
104
|
+
};
|
|
105
|
+
fromBg.addEventListener('transitionend', onEnd);
|
|
106
|
+
if (getComputedStyle(fromBg).transitionDuration === '0s') {
|
|
107
|
+
finish();
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
function clearHoverFillState() {
|
|
111
|
+
var _window$odnHoverFillS2;
|
|
112
|
+
var resetBg = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
113
|
+
if ((_window$odnHoverFillS2 = window.odnHoverFillState) !== null && _window$odnHoverFillS2 !== void 0 && _window$odnHoverFillS2.timer) {
|
|
114
|
+
clearTimeout(window.odnHoverFillState.timer);
|
|
115
|
+
}
|
|
116
|
+
if (resetBg) {
|
|
117
|
+
var _window$odnHoverFillS3;
|
|
118
|
+
resetBgInline((_window$odnHoverFillS3 = window.odnHoverFillState) === null || _window$odnHoverFillS3 === void 0 ? void 0 : _window$odnHoverFillS3.bgNode);
|
|
119
|
+
}
|
|
120
|
+
window.odnHoverFillState = emptyHoverFillState();
|
|
121
|
+
}
|
|
14
122
|
var HoverFill = /*#__PURE__*/forwardRef(function (_ref, outerRef) {
|
|
15
123
|
var _ref$bgClassName = _ref.bgClassName,
|
|
16
124
|
bgClassName = _ref$bgClassName === void 0 ? '' : _ref$bgClassName,
|
|
@@ -35,24 +143,28 @@ var HoverFill = /*#__PURE__*/forwardRef(function (_ref, outerRef) {
|
|
|
35
143
|
var innerRef = useRef(null);
|
|
36
144
|
var ref = outerRef || innerRef;
|
|
37
145
|
var bgRef = useRef(null);
|
|
146
|
+
var disabledRef = useRef(disabled);
|
|
147
|
+
var hoverColorRef = useRef(hoverColor);
|
|
148
|
+
disabledRef.current = disabled;
|
|
149
|
+
hoverColorRef.current = hoverColor;
|
|
38
150
|
var syncBgSize = useCallback(function () {
|
|
39
|
-
var _window$
|
|
151
|
+
var _window$odnHoverFillS4;
|
|
40
152
|
var root = ref.current;
|
|
41
153
|
if (!root || !bgRef.current) {
|
|
42
154
|
return;
|
|
43
155
|
}
|
|
44
|
-
if ((_window$
|
|
45
|
-
bgRef.current.style.width = root.offsetWidth
|
|
46
|
-
bgRef.current.style.height = root.offsetHeight
|
|
156
|
+
if ((_window$odnHoverFillS4 = window.odnHoverFillState) !== null && _window$odnHoverFillS4 !== void 0 && _window$odnHoverFillS4.bgVisible && window.odnHoverFillState.baseNode === root && window.odnHoverFillState.bgNode === bgRef.current) {
|
|
157
|
+
bgRef.current.style.width = "".concat(root.offsetWidth, "px");
|
|
158
|
+
bgRef.current.style.height = "".concat(root.offsetHeight, "px");
|
|
47
159
|
}
|
|
48
160
|
}, [ref]);
|
|
49
161
|
var handleMouseEnter = function handleMouseEnter(e) {
|
|
50
|
-
var _window$
|
|
162
|
+
var _window$odnHoverFillS5;
|
|
51
163
|
e.persist();
|
|
52
164
|
if (disabled) {
|
|
53
165
|
return;
|
|
54
166
|
}
|
|
55
|
-
if ((_window$
|
|
167
|
+
if ((_window$odnHoverFillS5 = window.odnHoverFillState) !== null && _window$odnHoverFillS5 !== void 0 && _window$odnHoverFillS5.timer) {
|
|
56
168
|
clearTimeout(window.odnHoverFillState.timer);
|
|
57
169
|
}
|
|
58
170
|
var root = ref.current || e.currentTarget;
|
|
@@ -65,21 +177,25 @@ var HoverFill = /*#__PURE__*/forwardRef(function (_ref, outerRef) {
|
|
|
65
177
|
var _root$getBoundingClie = root.getBoundingClientRect(),
|
|
66
178
|
x = _root$getBoundingClie.x,
|
|
67
179
|
y = _root$getBoundingClie.y;
|
|
68
|
-
if (window.odnHoverFillState && window.odnHoverFillState.bgVisible && window.odnHoverFillState.bgNode && window.odnHoverFillState.baseNode && window.odnHoverFillState.baseNode !== root && (
|
|
69
|
-
var _window$
|
|
70
|
-
bgScale = _window$
|
|
71
|
-
baseNode = _window$
|
|
180
|
+
if (window.odnHoverFillState && window.odnHoverFillState.bgVisible && window.odnHoverFillState.bgNode && window.odnHoverFillState.baseNode && window.odnHoverFillState.baseNode !== root && canShareHoverFill(window.odnHoverFillState.baseNode, root) && hoverFillConfig.sharable) {
|
|
181
|
+
var _window$odnHoverFillS6 = window.odnHoverFillState,
|
|
182
|
+
bgScale = _window$odnHoverFillS6.bgScale,
|
|
183
|
+
baseNode = _window$odnHoverFillS6.baseNode;
|
|
72
184
|
var _baseNode$getBounding = baseNode.getBoundingClientRect(),
|
|
73
185
|
originX = _baseNode$getBounding.x,
|
|
74
186
|
originY = _baseNode$getBounding.y;
|
|
75
187
|
window.odnHoverFillState.bgNode.style.transformOrigin = '0 0';
|
|
76
|
-
window.odnHoverFillState.bgNode.style.width = root.offsetWidth
|
|
77
|
-
window.odnHoverFillState.bgNode.style.height = root.offsetHeight
|
|
188
|
+
window.odnHoverFillState.bgNode.style.width = "".concat(root.offsetWidth, "px");
|
|
189
|
+
window.odnHoverFillState.bgNode.style.height = "".concat(root.offsetHeight, "px");
|
|
78
190
|
window.odnHoverFillState.bgNode.style.transform = "translate3d(".concat(x - originX, "px, ").concat(y - originY, "px, 0) scale(").concat(bgScale, ")");
|
|
79
191
|
window.odnHoverFillState.bgNode.style.background = hoverColor;
|
|
192
|
+
if (bgRef.current) {
|
|
193
|
+
scheduleHandoff(window.odnHoverFillState.bgNode, root, bgRef.current, hoverColor);
|
|
194
|
+
}
|
|
80
195
|
} else {
|
|
81
|
-
var _window$
|
|
82
|
-
|
|
196
|
+
var _window$odnHoverFillS7, _window$odnHoverFillS8, _root$parentElement;
|
|
197
|
+
cancelPendingHandoff();
|
|
198
|
+
var isNested = ((_window$odnHoverFillS7 = window.odnHoverFillState) === null || _window$odnHoverFillS7 === void 0 ? void 0 : _window$odnHoverFillS7.bgVisible) && ((_window$odnHoverFillS8 = window.odnHoverFillState) === null || _window$odnHoverFillS8 === void 0 ? void 0 : _window$odnHoverFillS8.bgNode) && ((_root$parentElement = root.parentElement) === null || _root$parentElement === void 0 ? void 0 : _root$parentElement.closest('[data-odn-hover-fill]'));
|
|
83
199
|
if (window.odnHoverFillState && window.odnHoverFillState.bgVisible && window.odnHoverFillState.bgNode) {
|
|
84
200
|
if (isNested) {
|
|
85
201
|
if (!window.odnHoverFillStateStack) {
|
|
@@ -88,7 +204,6 @@ var HoverFill = /*#__PURE__*/forwardRef(function (_ref, outerRef) {
|
|
|
88
204
|
window.odnHoverFillStateStack.push(_objectSpread({}, window.odnHoverFillState));
|
|
89
205
|
} else {
|
|
90
206
|
window.odnHoverFillState.bgNode.style.background = 'transparent';
|
|
91
|
-
// window.odnHoverFillState.bgNode.style.transform = 'scale(var(--odn-hoverfill-scale-start))';
|
|
92
207
|
window.odnHoverFillState.bgNode.style.transition = '';
|
|
93
208
|
if (window.odnHoverFillStateStack) {
|
|
94
209
|
while (window.odnHoverFillStateStack.length > 0) {
|
|
@@ -111,8 +226,8 @@ var HoverFill = /*#__PURE__*/forwardRef(function (_ref, outerRef) {
|
|
|
111
226
|
if (!bgRef.current) {
|
|
112
227
|
return;
|
|
113
228
|
}
|
|
114
|
-
bgRef.current.style.width = root.offsetWidth
|
|
115
|
-
bgRef.current.style.height = root.offsetHeight
|
|
229
|
+
bgRef.current.style.width = "".concat(root.offsetWidth, "px");
|
|
230
|
+
bgRef.current.style.height = "".concat(root.offsetHeight, "px");
|
|
116
231
|
bgRef.current.style.transformOrigin = "".concat(clientX - x, "px ").concat(clientY - y, "px");
|
|
117
232
|
bgRef.current.style.background = hoverColor;
|
|
118
233
|
bgRef.current.style.transform = 'scale(1)';
|
|
@@ -130,7 +245,7 @@ var HoverFill = /*#__PURE__*/forwardRef(function (_ref, outerRef) {
|
|
|
130
245
|
}
|
|
131
246
|
};
|
|
132
247
|
var handleMouseLeave = function handleMouseLeave(e) {
|
|
133
|
-
var _window$
|
|
248
|
+
var _window$odnHoverFillS9;
|
|
134
249
|
e.persist();
|
|
135
250
|
if (disabled) {
|
|
136
251
|
return;
|
|
@@ -139,9 +254,10 @@ var HoverFill = /*#__PURE__*/forwardRef(function (_ref, outerRef) {
|
|
|
139
254
|
if (root && e.relatedTarget instanceof Node && root.contains(e.relatedTarget)) {
|
|
140
255
|
return;
|
|
141
256
|
}
|
|
142
|
-
if ((_window$
|
|
257
|
+
if ((_window$odnHoverFillS9 = window.odnHoverFillState) !== null && _window$odnHoverFillS9 !== void 0 && _window$odnHoverFillS9.timer) {
|
|
143
258
|
clearTimeout(window.odnHoverFillState.timer);
|
|
144
259
|
}
|
|
260
|
+
cancelPendingHandoff();
|
|
145
261
|
if (onMouseLeave) {
|
|
146
262
|
onMouseLeave(e);
|
|
147
263
|
}
|
|
@@ -163,7 +279,7 @@ var HoverFill = /*#__PURE__*/forwardRef(function (_ref, outerRef) {
|
|
|
163
279
|
bgRef.current.style.transition = '0s';
|
|
164
280
|
}
|
|
165
281
|
setTimeout(function () {
|
|
166
|
-
var _window$
|
|
282
|
+
var _window$odnHoverFillS10;
|
|
167
283
|
var clientX = e.clientX,
|
|
168
284
|
clientY = e.clientY;
|
|
169
285
|
var _root$getBoundingClie2 = root.getBoundingClientRect(),
|
|
@@ -187,7 +303,7 @@ var HoverFill = /*#__PURE__*/forwardRef(function (_ref, outerRef) {
|
|
|
187
303
|
bgRef.current.style.transform = 'scale(var(--odn-hoverfill-scale-start))';
|
|
188
304
|
bgRef.current.style.transition = '';
|
|
189
305
|
}
|
|
190
|
-
if (((_window$
|
|
306
|
+
if (((_window$odnHoverFillS10 = window.odnHoverFillStateStack) === null || _window$odnHoverFillS10 === void 0 ? void 0 : _window$odnHoverFillS10.length) > 0) {
|
|
191
307
|
window.odnHoverFillState = window.odnHoverFillStateStack.pop();
|
|
192
308
|
window.odnHoverFillState.timer = 0;
|
|
193
309
|
} else {
|
|
@@ -206,9 +322,29 @@ var HoverFill = /*#__PURE__*/forwardRef(function (_ref, outerRef) {
|
|
|
206
322
|
};
|
|
207
323
|
var handleMouseUp = function handleMouseUp() {
|
|
208
324
|
window.removeEventListener('mouseup', handleMouseUp, false);
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
325
|
+
// 等 click 把选中态设上再决定回色,避免 6→2→4 闪一下
|
|
326
|
+
requestAnimationFrame(function () {
|
|
327
|
+
var _state$bgNode;
|
|
328
|
+
var state = window.odnHoverFillState;
|
|
329
|
+
var bg = (_state$bgNode = state === null || state === void 0 ? void 0 : state.bgNode) !== null && _state$bgNode !== void 0 ? _state$bgNode : bgRef.current;
|
|
330
|
+
if (disabledRef.current) {
|
|
331
|
+
resetBgInline(bg);
|
|
332
|
+
resetBgInline(bgRef.current);
|
|
333
|
+
if ((state === null || state === void 0 ? void 0 : state.bgNode) === bg || (state === null || state === void 0 ? void 0 : state.bgNode) === bgRef.current) {
|
|
334
|
+
clearHoverFillState();
|
|
335
|
+
}
|
|
336
|
+
return;
|
|
337
|
+
}
|
|
338
|
+
if (!bg) {
|
|
339
|
+
return;
|
|
340
|
+
}
|
|
341
|
+
var root = ref.current;
|
|
342
|
+
var hovering = Boolean(root === null || root === void 0 ? void 0 : root.matches(':hover'));
|
|
343
|
+
bg.style.background = hovering ? hoverColorRef.current : 'transparent';
|
|
344
|
+
if (!hovering && (state === null || state === void 0 ? void 0 : state.bgNode) === bg) {
|
|
345
|
+
state.bgVisible = false;
|
|
346
|
+
}
|
|
347
|
+
});
|
|
212
348
|
};
|
|
213
349
|
var handleMouseDown = function handleMouseDown(e) {
|
|
214
350
|
e.persist();
|
|
@@ -249,6 +385,22 @@ var HoverFill = /*#__PURE__*/forwardRef(function (_ref, outerRef) {
|
|
|
249
385
|
}
|
|
250
386
|
return observeResize(root, syncBgSize);
|
|
251
387
|
}, [ref, syncBgSize]);
|
|
388
|
+
useLayoutEffect(function () {
|
|
389
|
+
if (!disabled) {
|
|
390
|
+
return;
|
|
391
|
+
}
|
|
392
|
+
cancelPendingHandoff();
|
|
393
|
+
resetBgInline(bgRef.current);
|
|
394
|
+
var state = window.odnHoverFillState;
|
|
395
|
+
var root = ref.current;
|
|
396
|
+
if (state !== null && state !== void 0 && state.bgVisible && root !== null && root !== void 0 && root.matches(':hover')) {
|
|
397
|
+
clearHoverFillState(true);
|
|
398
|
+
return;
|
|
399
|
+
}
|
|
400
|
+
if ((state === null || state === void 0 ? void 0 : state.bgNode) === bgRef.current || (state === null || state === void 0 ? void 0 : state.baseNode) === root) {
|
|
401
|
+
clearHoverFillState(true);
|
|
402
|
+
}
|
|
403
|
+
}, [disabled, ref]);
|
|
252
404
|
return /*#__PURE__*/React.createElement("div", _extends({
|
|
253
405
|
ref: ref,
|
|
254
406
|
"data-odn-hover-fill": true,
|
package/dist/index.d.ts
CHANGED
|
@@ -57,8 +57,9 @@ export { default as AgentThink, type AgentThinkProps } from './agent-think';
|
|
|
57
57
|
export { APPROVAL_DEFAULT_ACTIONS_HINT, default as Approval, type ApprovalDecision, type ApprovalProps, type ApprovalResolvePayload, type ApprovalSpec, type ApprovalSummaryItem, } from './approval';
|
|
58
58
|
export { ARTIFACT_DEDICATED_FILE_ICON_TYPES, ARTIFACT_FILE_GLOW_COLORS, ARTIFACT_FILE_ICON_TYPES, default as Artifact, ArtifactFileIcon, getArtifactAction, getArtifactActionFromKind, getArtifactGlowColor, type ArtifactAction, type ArtifactActionKind, type ArtifactFileIconProps, type ArtifactFileIconSize, type ArtifactFileIconType, type ArtifactProps, type ArtifactSize, } from './artifact';
|
|
59
59
|
export { default as Attachments, type AttachmentsProps } from './attachments';
|
|
60
|
-
export { default as
|
|
61
|
-
export { default as
|
|
60
|
+
export { CHAT_GROUP_PREVIEW_LIMIT, default as ChatGroup, type ChatGroupProps, } from './chat-group';
|
|
61
|
+
export { default as ChatItem, formatRelativeTime, type ChatItemGroupOption, type ChatItemProps, } from './chat-item';
|
|
62
|
+
export { CHAT_LIST_UNGROUPED_ID, default as ChatList, matchChatListFilterStatus, matchChatListFilterTime, matchChatListFilterType, type ChatListFilterStatus, type ChatListFilterTime, type ChatListFilterType, type ChatListGroup, type ChatListItem, type ChatListProps, } from './chat-list';
|
|
62
63
|
export { CLARIFY_DOCK_MAX_OPTIONS, CLARIFY_DOCK_SKIPPED_LABEL, CLARIFY_DOCK_SKIPPED_VALUE, ClarifyDockPanel, ClarifyDockTrigger, clarifyDockLayoutId, parseClarifyBoundDate, toISODate, useClarifyDockState, type ClarifyDockAnswerItem, type ClarifyDockHostMessage, type ClarifyDockMessageState, type ClarifyDockPanelProps, type ClarifyDockQuestion, type ClarifyDockResolvePayload, type ClarifyDockSpec, type ClarifyDockState, type ClarifyDockTriggerProps, type ClarifyInput, type ClarifyOption, } from './clarify-dock';
|
|
63
64
|
export { default as CodeBlock, type CodeBlockProps } from './code-block';
|
|
64
65
|
export { default as Composer, type ComposerProps, type ComposerRef, type ComposerSkillSlotProps, type ComposerTool, type ComposerToolConfig, } from './composer';
|
package/dist/index.js
CHANGED
|
@@ -63,8 +63,9 @@ export { default as AgentThink } from "./agent-think";
|
|
|
63
63
|
export { APPROVAL_DEFAULT_ACTIONS_HINT, default as Approval } from "./approval";
|
|
64
64
|
export { ARTIFACT_DEDICATED_FILE_ICON_TYPES, ARTIFACT_FILE_GLOW_COLORS, ARTIFACT_FILE_ICON_TYPES, default as Artifact, ArtifactFileIcon, getArtifactAction, getArtifactActionFromKind, getArtifactGlowColor } from "./artifact";
|
|
65
65
|
export { default as Attachments } from "./attachments";
|
|
66
|
+
export { CHAT_GROUP_PREVIEW_LIMIT, default as ChatGroup } from "./chat-group";
|
|
66
67
|
export { default as ChatItem, formatRelativeTime } from "./chat-item";
|
|
67
|
-
export { default as ChatList, matchChatListFilterStatus, matchChatListFilterTime, matchChatListFilterType } from "./chat-list";
|
|
68
|
+
export { CHAT_LIST_UNGROUPED_ID, default as ChatList, matchChatListFilterStatus, matchChatListFilterTime, matchChatListFilterType } from "./chat-list";
|
|
68
69
|
export { CLARIFY_DOCK_MAX_OPTIONS, CLARIFY_DOCK_SKIPPED_LABEL, CLARIFY_DOCK_SKIPPED_VALUE, ClarifyDockPanel, ClarifyDockTrigger, clarifyDockLayoutId, parseClarifyBoundDate, toISODate, useClarifyDockState } from "./clarify-dock";
|
|
69
70
|
export { default as CodeBlock } from "./code-block";
|
|
70
71
|
export { default as Composer } from "./composer";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "one-design-next",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.99",
|
|
4
4
|
"description": "One Design Next from TAD@tencent.com",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"build": "father build && npm run build:styles",
|
|
17
17
|
"build:benchmark": "node scripts/build-benchmark.mjs",
|
|
18
18
|
"build:feedback": "node scripts/build-feedback.mjs",
|
|
19
|
-
"build:skills": "
|
|
19
|
+
"build:skills": "test -f skills/odn-design-ruyi/SKILL.md",
|
|
20
20
|
"build:styles": "node scripts/build-styles.js",
|
|
21
21
|
"build:variables": "node scripts/build-variables.js",
|
|
22
22
|
"build:watch": "father dev",
|