@lijian-ui/dsh-term 0.1.1 → 0.1.2
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/lib/client.js +21 -13
- package/lib/client.js.map +1 -1
- package/lib/tsconfig.client.tsbuildinfo +1 -1
- package/lib/types/client/term/AnimatedDock.d.ts +4 -2
- package/lib/types/client/term/AnimatedDock.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/client/term/AnimatedDock.tsx +18 -9
- package/src/client/term/animated-dock.module.css +16 -12
package/lib/client.js
CHANGED
|
@@ -51207,7 +51207,7 @@ get: (_target, key) => {
|
|
|
51207
51207
|
exports.FolderOpen = FolderOpen;
|
|
51208
51208
|
exports.Terminal = Terminal;
|
|
51209
51209
|
})))();
|
|
51210
|
-
const css = "._8AhSIa_dock{-webkit-backdrop-filter:blur(12px);background:#
|
|
51210
|
+
const css = "._8AhSIa_dock{-webkit-backdrop-filter:blur(12px);background:#000000d9;border:1px solid #ffffff1f;border-radius:16px;align-items:flex-end;gap:8px;height:40px;padding:0 10px 4px;display:inline-flex;overflow:visible}._8AhSIa_item{color:#fff;cursor:pointer;transform-origin:bottom;will-change:transform;background:#000;border:none;border-radius:9999px;justify-content:center;align-items:center;width:40px;height:40px;transition:background .18s,color .18s,box-shadow .18s;display:inline-flex;position:relative;overflow:visible}._8AhSIa_item:hover{color:#fff;background:#1a1a1a}._8AhSIa_item._8AhSIa_active{background:var(--aion-primary,#6ea0ff);color:#fff;box-shadow:0 0 0 1.5px var(--aion-primary,#6ea0ff)}._8AhSIa_tooltip{white-space:nowrap;color:var(--aion-fg-1,#fff);opacity:0;pointer-events:none;background:#14141ee6;border:1px solid #ffffff1f;border-radius:6px;padding:2px 8px;font-size:12px;line-height:1.4;transition:opacity .15s;position:absolute;top:-30px;left:50%;transform:translate(-50%)}._8AhSIa_item:hover ._8AhSIa_tooltip{opacity:1}";
|
|
51211
51211
|
const tagId = "@lijian-ui/dsh-term/animated-dock.module.css";
|
|
51212
51212
|
if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId) + "]") === null) {
|
|
51213
51213
|
const tag = document.createElement("style");
|
|
@@ -51231,8 +51231,10 @@ get: (_target, key) => {
|
|
|
51231
51231
|
*
|
|
51232
51232
|
* This is a faithful port of the 21st.dev "Animated Dock" component: it uses
|
|
51233
51233
|
* framer-motion's `useMotionValue` + `useSpring` + `useTransform` so each
|
|
51234
|
-
* circular icon
|
|
51235
|
-
*
|
|
51234
|
+
* circular icon scales toward the cursor with real spring physics — the
|
|
51235
|
+
* buttery feel you can't get from a CSS transition. Magnification is driven by
|
|
51236
|
+
* `transform: scale()` (NOT `width`), so it never reflows the layout and the
|
|
51237
|
+
* dock stays perfectly stable under the cursor.
|
|
51236
51238
|
* Icons come from lucide-react. The dock itself is a frosted-glass pill.
|
|
51237
51239
|
*
|
|
51238
51240
|
* Two entries wire to the two right-side panels through window CustomEvents
|
|
@@ -51254,13 +51256,17 @@ get: (_target, key) => {
|
|
|
51254
51256
|
terminalState: "dsh-dock:terminal-state",
|
|
51255
51257
|
fileState: "dsh-dock:filepanel-state"
|
|
51256
51258
|
};
|
|
51257
|
-
/** Resting / peak icon size (px).
|
|
51259
|
+
/** Resting / peak icon size (px). */
|
|
51258
51260
|
const BASE = 40;
|
|
51259
|
-
|
|
51261
|
+
/** Magnification factor at the cursor (MAX / BASE). Driven via CSS `scale()`
|
|
51262
|
+
* so it never reflows the layout — this is what removed the old "jitter". */
|
|
51263
|
+
const MAX_SCALE = 58 / BASE;
|
|
51260
51264
|
/** Cursor distance (px) over which magnification falls to zero. */
|
|
51261
51265
|
const DIST = 120;
|
|
51262
|
-
/** Spring tuning
|
|
51263
|
-
|
|
51266
|
+
/** Spring tuning. Near-critically damped (ratio ≈ 0.94) so the icon settles
|
|
51267
|
+
* smoothly with essentially no overshoot. The old `damping: 0.35` was
|
|
51268
|
+
* effectively zero damping and caused the wild oscillation. */
|
|
51269
|
+
const DAMPING = 28;
|
|
51264
51270
|
const STIFFNESS = 220;
|
|
51265
51271
|
function AnimatedDock() {
|
|
51266
51272
|
const mouseX = useMotionValue(Infinity);
|
|
@@ -51302,10 +51308,12 @@ get: (_target, key) => {
|
|
|
51302
51308
|
})]
|
|
51303
51309
|
});
|
|
51304
51310
|
}
|
|
51305
|
-
/** A single magnifying icon. Its
|
|
51311
|
+
/** A single magnifying icon. Its `scale` is a spring driven by cursor distance.
|
|
51312
|
+
* Because we animate `transform` (not `width`), the layout never reflows, so
|
|
51313
|
+
* there is no neighbour-push feedback loop and the dock stays rock-steady. */
|
|
51306
51314
|
function DockItem(props) {
|
|
51307
51315
|
const ref = (0, react.useRef)(null);
|
|
51308
|
-
const
|
|
51316
|
+
const scale = useSpring(useTransform(useTransform(props.mouseX, (val) => {
|
|
51309
51317
|
const bounds = ref.current?.getBoundingClientRect() ?? {
|
|
51310
51318
|
x: 0,
|
|
51311
51319
|
width: BASE
|
|
@@ -51316,9 +51324,9 @@ get: (_target, key) => {
|
|
|
51316
51324
|
0,
|
|
51317
51325
|
DIST
|
|
51318
51326
|
], [
|
|
51319
|
-
|
|
51320
|
-
|
|
51321
|
-
|
|
51327
|
+
1,
|
|
51328
|
+
MAX_SCALE,
|
|
51329
|
+
1
|
|
51322
51330
|
]), {
|
|
51323
51331
|
damping: DAMPING,
|
|
51324
51332
|
stiffness: STIFFNESS
|
|
@@ -51326,7 +51334,7 @@ get: (_target, key) => {
|
|
|
51326
51334
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(motion.button, {
|
|
51327
51335
|
ref,
|
|
51328
51336
|
type: "button",
|
|
51329
|
-
style: {
|
|
51337
|
+
style: { scale },
|
|
51330
51338
|
className: `${animated_dock_module_css_default.item}${props.active ? ` ${animated_dock_module_css_default.active}` : ""}`,
|
|
51331
51339
|
onClick: props.onClick,
|
|
51332
51340
|
"aria-label": props.label,
|