Initial Commit

This commit is contained in:
2025-10-25 17:31:31 +05:30
commit caceb7a49d
28 changed files with 7839 additions and 0 deletions

24
.gitignore vendored Normal file
View File

@@ -0,0 +1,24 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*
node_modules
dist
dist-ssr
*.local
# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?

73
README.md Normal file
View File

@@ -0,0 +1,73 @@
# React + TypeScript + Vite
This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
Currently, two official plugins are available:
- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react) uses [Babel](https://babeljs.io/) (or [oxc](https://oxc.rs) when used in [rolldown-vite](https://vite.dev/guide/rolldown)) for Fast Refresh
- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh
## React Compiler
The React Compiler is not enabled on this template because of its impact on dev & build performances. To add it, see [this documentation](https://react.dev/learn/react-compiler/installation).
## Expanding the ESLint configuration
If you are developing a production application, we recommend updating the configuration to enable type-aware lint rules:
```js
export default defineConfig([
globalIgnores(['dist']),
{
files: ['**/*.{ts,tsx}'],
extends: [
// Other configs...
// Remove tseslint.configs.recommended and replace with this
tseslint.configs.recommendedTypeChecked,
// Alternatively, use this for stricter rules
tseslint.configs.strictTypeChecked,
// Optionally, add this for stylistic rules
tseslint.configs.stylisticTypeChecked,
// Other configs...
],
languageOptions: {
parserOptions: {
project: ['./tsconfig.node.json', './tsconfig.app.json'],
tsconfigRootDir: import.meta.dirname,
},
// other options...
},
},
])
```
You can also install [eslint-plugin-react-x](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-x) and [eslint-plugin-react-dom](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-dom) for React-specific lint rules:
```js
// eslint.config.js
import reactX from 'eslint-plugin-react-x'
import reactDom from 'eslint-plugin-react-dom'
export default defineConfig([
globalIgnores(['dist']),
{
files: ['**/*.{ts,tsx}'],
extends: [
// Other configs...
// Enable lint rules for React
reactX.configs['recommended-typescript'],
// Enable lint rules for React DOM
reactDom.configs.recommended,
],
languageOptions: {
parserOptions: {
project: ['./tsconfig.node.json', './tsconfig.app.json'],
tsconfigRootDir: import.meta.dirname,
},
// other options...
},
},
])
```

23
eslint.config.js Normal file
View File

@@ -0,0 +1,23 @@
import js from '@eslint/js'
import globals from 'globals'
import reactHooks from 'eslint-plugin-react-hooks'
import reactRefresh from 'eslint-plugin-react-refresh'
import tseslint from 'typescript-eslint'
import { defineConfig, globalIgnores } from 'eslint/config'
export default defineConfig([
globalIgnores(['dist']),
{
files: ['**/*.{ts,tsx}'],
extends: [
js.configs.recommended,
tseslint.configs.recommended,
reactHooks.configs['recommended-latest'],
reactRefresh.configs.vite,
],
languageOptions: {
ecmaVersion: 2020,
globals: globals.browser,
},
},
])

13
index.html Normal file
View File

@@ -0,0 +1,13 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>test-project</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>

4262
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

32
package.json Normal file
View File

@@ -0,0 +1,32 @@
{
"name": "test-project",
"private": true,
"version": "0.0.0",
"type": "module",
"scripts": {
"dev": "vite",
"build": "tsc -b && vite build",
"lint": "eslint .",
"preview": "vite preview"
},
"dependencies": {
"clsx": "^2.1.1",
"react": "^19.1.1",
"react-dom": "^19.1.1"
},
"devDependencies": {
"@eslint/js": "^9.36.0",
"@types/node": "^24.6.0",
"@types/react": "^19.1.16",
"@types/react-dom": "^19.1.9",
"@vitejs/plugin-react": "^5.0.4",
"eslint": "^9.36.0",
"eslint-plugin-react-hooks": "^5.2.0",
"eslint-plugin-react-refresh": "^0.4.22",
"globals": "^16.4.0",
"sass-embedded": "^1.93.2",
"typescript": "~5.9.3",
"typescript-eslint": "^8.45.0",
"vite": "^7.1.7"
}
}

1
public/vite.svg Normal file
View File

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="31.88" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 257"><defs><linearGradient id="IconifyId1813088fe1fbc01fb466" x1="-.828%" x2="57.636%" y1="7.652%" y2="78.411%"><stop offset="0%" stop-color="#41D1FF"></stop><stop offset="100%" stop-color="#BD34FE"></stop></linearGradient><linearGradient id="IconifyId1813088fe1fbc01fb467" x1="43.376%" x2="50.316%" y1="2.242%" y2="89.03%"><stop offset="0%" stop-color="#FFEA83"></stop><stop offset="8.333%" stop-color="#FFDD35"></stop><stop offset="100%" stop-color="#FFA800"></stop></linearGradient></defs><path fill="url(#IconifyId1813088fe1fbc01fb466)" d="M255.153 37.938L134.897 252.976c-2.483 4.44-8.862 4.466-11.382.048L.875 37.958c-2.746-4.814 1.371-10.646 6.827-9.67l120.385 21.517a6.537 6.537 0 0 0 2.322-.004l117.867-21.483c5.438-.991 9.574 4.796 6.877 9.62Z"></path><path fill="url(#IconifyId1813088fe1fbc01fb467)" d="M185.432.063L96.44 17.501a3.268 3.268 0 0 0-2.634 3.014l-5.474 92.456a3.268 3.268 0 0 0 3.997 3.378l24.777-5.718c2.318-.535 4.413 1.507 3.936 3.838l-7.361 36.047c-.495 2.426 1.782 4.5 4.151 3.78l15.304-4.649c2.372-.72 4.652 1.36 4.15 3.788l-11.698 56.621c-.732 3.542 3.979 5.473 5.943 2.437l1.313-2.028l72.516-144.72c1.215-2.423-.88-5.186-3.54-4.672l-25.505 4.922c-2.396.462-4.435-1.77-3.759-4.114l16.646-57.705c.677-2.35-1.37-4.583-3.769-4.113Z"></path></svg>

After

Width:  |  Height:  |  Size: 1.5 KiB

42
src/App.css Normal file
View File

@@ -0,0 +1,42 @@
#root {
max-width: 1280px;
margin: 0 auto;
padding: 2rem;
text-align: center;
}
.logo {
height: 6em;
padding: 1.5em;
will-change: filter;
transition: filter 300ms;
}
.logo:hover {
filter: drop-shadow(0 0 2em #646cffaa);
}
.logo.react:hover {
filter: drop-shadow(0 0 2em #61dafbaa);
}
@keyframes logo-spin {
from {
transform: rotate(0deg);
}
to {
transform: rotate(360deg);
}
}
@media (prefers-reduced-motion: no-preference) {
a:nth-of-type(2) .logo {
animation: logo-spin infinite 20s linear;
}
}
.card {
padding: 2em;
}
.read-the-docs {
color: #888;
}

8
src/App.tsx Normal file
View File

@@ -0,0 +1,8 @@
import SceneView from "./pages/SceneView";
import "./styles/main.scss";
function App() {
return <SceneView />;
}
export default App;

1
src/assets/react.svg Normal file
View File

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="35.93" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 228"><path fill="#00D8FF" d="M210.483 73.824a171.49 171.49 0 0 0-8.24-2.597c.465-1.9.893-3.777 1.273-5.621c6.238-30.281 2.16-54.676-11.769-62.708c-13.355-7.7-35.196.329-57.254 19.526a171.23 171.23 0 0 0-6.375 5.848a155.866 155.866 0 0 0-4.241-3.917C100.759 3.829 77.587-4.822 63.673 3.233C50.33 10.957 46.379 33.89 51.995 62.588a170.974 170.974 0 0 0 1.892 8.48c-3.28.932-6.445 1.924-9.474 2.98C17.309 83.498 0 98.307 0 113.668c0 15.865 18.582 31.778 46.812 41.427a145.52 145.52 0 0 0 6.921 2.165a167.467 167.467 0 0 0-2.01 9.138c-5.354 28.2-1.173 50.591 12.134 58.266c13.744 7.926 36.812-.22 59.273-19.855a145.567 145.567 0 0 0 5.342-4.923a168.064 168.064 0 0 0 6.92 6.314c21.758 18.722 43.246 26.282 56.54 18.586c13.731-7.949 18.194-32.003 12.4-61.268a145.016 145.016 0 0 0-1.535-6.842c1.62-.48 3.21-.974 4.76-1.488c29.348-9.723 48.443-25.443 48.443-41.52c0-15.417-17.868-30.326-45.517-39.844Zm-6.365 70.984c-1.4.463-2.836.91-4.3 1.345c-3.24-10.257-7.612-21.163-12.963-32.432c5.106-11 9.31-21.767 12.459-31.957c2.619.758 5.16 1.557 7.61 2.4c23.69 8.156 38.14 20.213 38.14 29.504c0 9.896-15.606 22.743-40.946 31.14Zm-10.514 20.834c2.562 12.94 2.927 24.64 1.23 33.787c-1.524 8.219-4.59 13.698-8.382 15.893c-8.067 4.67-25.32-1.4-43.927-17.412a156.726 156.726 0 0 1-6.437-5.87c7.214-7.889 14.423-17.06 21.459-27.246c12.376-1.098 24.068-2.894 34.671-5.345a134.17 134.17 0 0 1 1.386 6.193ZM87.276 214.515c-7.882 2.783-14.16 2.863-17.955.675c-8.075-4.657-11.432-22.636-6.853-46.752a156.923 156.923 0 0 1 1.869-8.499c10.486 2.32 22.093 3.988 34.498 4.994c7.084 9.967 14.501 19.128 21.976 27.15a134.668 134.668 0 0 1-4.877 4.492c-9.933 8.682-19.886 14.842-28.658 17.94ZM50.35 144.747c-12.483-4.267-22.792-9.812-29.858-15.863c-6.35-5.437-9.555-10.836-9.555-15.216c0-9.322 13.897-21.212 37.076-29.293c2.813-.98 5.757-1.905 8.812-2.773c3.204 10.42 7.406 21.315 12.477 32.332c-5.137 11.18-9.399 22.249-12.634 32.792a134.718 134.718 0 0 1-6.318-1.979Zm12.378-84.26c-4.811-24.587-1.616-43.134 6.425-47.789c8.564-4.958 27.502 2.111 47.463 19.835a144.318 144.318 0 0 1 3.841 3.545c-7.438 7.987-14.787 17.08-21.808 26.988c-12.04 1.116-23.565 2.908-34.161 5.309a160.342 160.342 0 0 1-1.76-7.887Zm110.427 27.268a347.8 347.8 0 0 0-7.785-12.803c8.168 1.033 15.994 2.404 23.343 4.08c-2.206 7.072-4.956 14.465-8.193 22.045a381.151 381.151 0 0 0-7.365-13.322Zm-45.032-43.861c5.044 5.465 10.096 11.566 15.065 18.186a322.04 322.04 0 0 0-30.257-.006c4.974-6.559 10.069-12.652 15.192-18.18ZM82.802 87.83a323.167 323.167 0 0 0-7.227 13.238c-3.184-7.553-5.909-14.98-8.134-22.152c7.304-1.634 15.093-2.97 23.209-3.984a321.524 321.524 0 0 0-7.848 12.897Zm8.081 65.352c-8.385-.936-16.291-2.203-23.593-3.793c2.26-7.3 5.045-14.885 8.298-22.6a321.187 321.187 0 0 0 7.257 13.246c2.594 4.48 5.28 8.868 8.038 13.147Zm37.542 31.03c-5.184-5.592-10.354-11.779-15.403-18.433c4.902.192 9.899.29 14.978.29c5.218 0 10.376-.117 15.453-.343c-4.985 6.774-10.018 12.97-15.028 18.486Zm52.198-57.817c3.422 7.8 6.306 15.345 8.596 22.52c-7.422 1.694-15.436 3.058-23.88 4.071a382.417 382.417 0 0 0 7.859-13.026a347.403 347.403 0 0 0 7.425-13.565Zm-16.898 8.101a358.557 358.557 0 0 1-12.281 19.815a329.4 329.4 0 0 1-23.444.823c-7.967 0-15.716-.248-23.178-.732a310.202 310.202 0 0 1-12.513-19.846h.001a307.41 307.41 0 0 1-10.923-20.627a310.278 310.278 0 0 1 10.89-20.637l-.001.001a307.318 307.318 0 0 1 12.413-19.761c7.613-.576 15.42-.876 23.31-.876H128c7.926 0 15.743.303 23.354.883a329.357 329.357 0 0 1 12.335 19.695a358.489 358.489 0 0 1 11.036 20.54a329.472 329.472 0 0 1-11 20.722Zm22.56-122.124c8.572 4.944 11.906 24.881 6.52 51.026c-.344 1.668-.73 3.367-1.15 5.09c-10.622-2.452-22.155-4.275-34.23-5.408c-7.034-10.017-14.323-19.124-21.64-27.008a160.789 160.789 0 0 1 5.888-5.4c18.9-16.447 36.564-22.941 44.612-18.3ZM128 90.808c12.625 0 22.86 10.235 22.86 22.86s-10.235 22.86-22.86 22.86s-22.86-10.235-22.86-22.86s10.235-22.86 22.86-22.86Z"></path></svg>

After

Width:  |  Height:  |  Size: 4.0 KiB

View File

@@ -0,0 +1,383 @@
import React, { useCallback, useEffect, useState } from "react";
import { AddIcon, ChevronIcon, CollapseAllIcon } from "../../icons/ExportIcons";
import TreeNode from "./TreeNode";
import Search from "./Search";
import type { OutlinePanelProps } from "./OutlinePanel";
import { DEFAULT_PRAMS, type AssetGroupChild } from "../../data/OutlineListData";
type DropAction = "above" | "child" | "below" | "none";
export const OutlineList: React.FC<OutlinePanelProps> = ({
backgroundColor = "linear-gradient(to bottom, #1e1e2f, #12121a)",
panelSide = "left",
textColor = "linear-gradient(to bottom, rgba(231, 231, 255, 1), #cacad6ff)",
addIconColor,
lockIconColor,
eyeIconColor,
height,
width,
search,
data,
}) => {
const [isPanelOpen, setIsPanelOpen] = useState(true);
const [draggedNode, setDraggedNode] = useState<AssetGroupChild | null>(null);
const [searchValue, setSearchValue] = useState("");
const [hierarchy, setHierarchy] = useState<AssetGroupChild[]>(data);
const [selectedObject, setSelectedObject] = useState<AssetGroupChild | null>(null);
const [selectedObjects, setSelectedObjects] = useState<AssetGroupChild[]>([]);
const [draggedItems, setDraggedItems] = useState<AssetGroupChild[]>([]);
const [undoStack, setUndoStack] = useState<AssetGroupChild[][]>([]);
const [redoStack, setRedoStack] = useState<AssetGroupChild[][]>([]);
const pushHistory = (newHierarchy: AssetGroupChild[]) => {
setUndoStack((prev) => [...prev, structuredClone(hierarchy)]);
setRedoStack([]);
setHierarchy(newHierarchy);
};
const handleUndo = useCallback(() => {
if (undoStack.length === 0) return;
const lastState = undoStack.at(-1);
if (!lastState) return;
setRedoStack((prev) => [...prev, structuredClone(hierarchy)]);
setHierarchy(lastState);
setUndoStack((prev) => prev.slice(0, -1));
}, [undoStack, hierarchy]);
const handleRedo = useCallback(() => {
if (redoStack.length === 0) return;
const nextState = redoStack.at(-1);
if (!nextState) return;
setUndoStack((prev) => [...prev, structuredClone(hierarchy)]);
setHierarchy(nextState);
setRedoStack((prev) => prev.slice(0, -1));
}, [redoStack, hierarchy]);
const handleDragStart = (item: AssetGroupChild) => {
setDraggedNode(item);
const itemsToDrag = selectedObjects.some(
(obj) => obj.modelUuid === item.modelUuid || obj.groupUuid === item.groupUuid
)
? selectedObjects
: [item];
setDraggedItems(itemsToDrag);
};
const handleDragOver = (
targetItem: AssetGroupChild,
draggedItem: AssetGroupChild | null,
event: React.DragEvent
) => {
event.preventDefault();
const targetId = targetItem.modelUuid || targetItem.groupUuid;
if (!targetId) return;
const hoveredDiv = document.getElementById(targetId);
if (!hoveredDiv) return;
hoveredDiv.style.outline = "none";
hoveredDiv.style.borderTop = "none";
hoveredDiv.style.borderBottom = "none";
const rect = hoveredDiv.getBoundingClientRect();
const y = event.clientY - rect.top;
const dropZone = getDropZone(y);
switch (dropZone || selectedObject === null) {
case "above":
hoveredDiv.style.borderTop = "2px solid purple";
break;
case "below":
hoveredDiv.style.borderBottom = "2px solid purple";
break;
case "child":
hoveredDiv.style.outline = "2px solid #b188ff";
break;
default:
break;
}
return dropZone;
};
const handleDrop = (
targetItem: AssetGroupChild,
draggedItem: AssetGroupChild | null,
event: React.DragEvent
) => {
if (!draggedItem) return;
const targetId = targetItem.modelUuid;
if (!targetId) return;
const hoveredDiv = document.getElementById(targetId);
if (!hoveredDiv) return;
const rect = hoveredDiv.getBoundingClientRect();
const parentScrollTop = hoveredDiv.parentElement?.scrollTop || 0;
const y = event.clientY - (rect.top + parentScrollTop);
const dropAction = getDropZone(y);
if (dropAction === "none") {
clearAllHighlights();
setDraggedNode(null);
return;
}
const updatedHierarchy = structuredClone(hierarchy);
// ✅ Determine which items to move
const itemsToMove =
selectedObjects && selectedObjects.length > 1 ? selectedObjects : [draggedItem];
// ✅ Remove and insert each dragged item
itemsToMove.forEach((item) => {
if (!removeFromHierarchy(item, updatedHierarchy)) return;
if (!insertByDropAction(item, targetId, dropAction, updatedHierarchy)) {
updatedHierarchy.push(item);
}
});
// 🧠 Record new state for undo/redo
pushHistory(updatedHierarchy);
// ♻️ Cleanup
setDraggedNode(null);
clearAllHighlights();
setSelectedObject(null);
setSelectedObjects([]);
};
const getDropZone = (y: number): DropAction => {
if (y < 7) return "above";
if (y >= 7 && y < 19) return "child";
if (y >= 19 && y < 32) return "below";
return "none";
};
const clearAllHighlights = () => {
const allNodes = document.querySelectorAll<HTMLElement>(
".tree-node, .tree-node-content, .group-node, .dragging"
);
allNodes.forEach((node) => {
node.style.borderTop = "none";
node.style.borderBottom = "none";
node.style.outline = "none";
node.style.border = "none";
});
};
const removeFromHierarchy = (item: AssetGroupChild, tree: AssetGroupChild[]): boolean => {
for (let i = 0; i < tree.length; i++) {
const node = tree[i];
if (node.modelUuid === item.modelUuid) {
tree.splice(i, 1);
return true;
}
if (node.children?.length && removeFromHierarchy(item, node.children)) {
return true;
}
}
return false;
};
const insertByDropAction = (
item: AssetGroupChild,
targetId: string,
action: DropAction,
tree: AssetGroupChild[]
): boolean => {
switch (action) {
case "above":
return insertAsSibling(item, targetId, tree, 0);
case "below":
return insertAsSibling(item, targetId, tree, 1);
case "child":
return insertAsChild(targetId, item, tree);
default:
return false;
}
};
const insertAsSibling = (
item: AssetGroupChild,
targetId: string,
tree: AssetGroupChild[],
offset: number
): boolean => {
for (let i = 0; i < tree.length; i++) {
const node = tree[i];
if (node.modelUuid === targetId) {
tree.splice(i + offset, 0, item);
return true;
}
if (node.children?.length && insertAsSibling(item, targetId, node.children, offset)) {
return true;
}
}
return false;
};
const insertAsChild = (
parentId: string,
child: AssetGroupChild,
tree: AssetGroupChild[]
): boolean => {
for (const node of tree) {
if (node.modelUuid === parentId) {
node.children = node.children || [];
node.children.push(child);
return true;
}
if (node.children?.length && insertAsChild(parentId, child, node.children)) {
return true;
}
}
return false;
};
const filterHierarchy = (items: AssetGroupChild[], query: string): AssetGroupChild[] => {
if (!query.trim()) return items;
return items
.map((item) => {
const matches =
item.modelName?.toLowerCase().includes(query.toLowerCase()) ||
item.groupName?.toLowerCase().includes(query.toLowerCase());
const filteredChildren = item.children ? filterHierarchy(item.children, query) : [];
if (matches || filteredChildren.length > 0) {
return { ...item, children: filteredChildren };
}
return null;
})
.filter(Boolean) as AssetGroupChild[];
};
const filteredHierarchy = filterHierarchy(hierarchy, searchValue);
const handleRename = (id: string, newName: string) => {
const updateNodeName = (nodes: AssetGroupChild[]): AssetGroupChild[] =>
nodes.map((node) => {
if (node.modelUuid === id || node.groupUuid === id) {
return {
...node,
modelName: node.modelName ? newName : node.modelName,
groupName: node.groupName ? newName : node.groupName,
};
}
if (node.children?.length) {
return { ...node, children: updateNodeName(node.children) };
}
return node;
});
const newHierarchy = updateNodeName(structuredClone(hierarchy));
pushHistory(newHierarchy); // record rename
};
useEffect(() => {
const handleKeyDown = (e: KeyboardEvent) => {
if (e.ctrlKey && e.key.toLowerCase() === "z") {
e.preventDefault();
handleUndo();
} else if (e.ctrlKey && e.key.toLowerCase() === "y") {
e.preventDefault();
handleRedo();
}
};
document.addEventListener("keydown", handleKeyDown);
return () => document.removeEventListener("keydown", handleKeyDown);
}, [hierarchy, undoStack, redoStack, handleUndo, handleRedo]);
return (
<div
className="outline-overlay"
style={{
justifyContent: panelSide || DEFAULT_PRAMS.panelSide,
}}
>
<div
className="outline-card"
style={{
background: backgroundColor,
height: height || DEFAULT_PRAMS.height,
width: width || DEFAULT_PRAMS.width,
}}
>
<div className="outline-header">
<div className="header-title">
<p>Outline</p>
</div>
<div className="outline-toolbar">
<button className="toolbar-button">
<AddIcon color={addIconColor} />
</button>
<button className="toolbar-button">
<CollapseAllIcon />
</button>
<button onClick={handleUndo} disabled={undoStack.length === 0} title="Undo">
</button>
<button onClick={handleRedo} disabled={redoStack.length === 0} title="Redo">
🔁
</button>
<button
className="close-button"
onClick={() => setIsPanelOpen(!isPanelOpen)}
>
<ChevronIcon isOpen={isPanelOpen} />
</button>
</div>
</div>
{search && (
<div className="search-overlay">
<Search onChange={(val) => setSearchValue(val)} />
</div>
)}
{isPanelOpen && (
<div className="outline-content">
{filteredHierarchy.map((node) => (
<TreeNode
key={node.groupUuid || node.modelUuid}
item={node}
textColor={textColor}
eyeIconColor={eyeIconColor}
lockIconColor={lockIconColor}
onDragStart={handleDragStart}
onDrop={handleDrop}
onDragOver={handleDragOver}
draggingItem={draggedNode}
draggedItems={draggedItems}
setDraggedItems={setDraggedItems}
setSelectedObject={setSelectedObject}
selectedObject={selectedObject}
setSelectedObjects={setSelectedObjects}
selectedObjects={selectedObjects}
onRename={handleRename}
pushHistory={pushHistory}
hierarchy={hierarchy}
setHierarchy={setHierarchy}
/>
))}
</div>
)}
</div>
</div>
);
};

View File

@@ -0,0 +1,22 @@
import React from "react";
import { OutlineList } from "./OutlineList ";
import type { AssetGroupChild } from "../../data/OutlineListData";
export interface OutlinePanelProps {
textColor?: string;
panelSide?: "left" | "right";
backgroundColor?: string;
addIconColor?: string;
eyeIconColor?: string;
lockIconColor?: string;
height?: string;
width?: string;
search?: boolean;
data: AssetGroupChild[];
}
const OutlinePanel: React.FC<OutlinePanelProps> = (props) => {
return <OutlineList {...props} />;
};
export default OutlinePanel;

View File

@@ -0,0 +1,84 @@
import React, { ChangeEvent, useEffect, useState } from "react";
import { CloseIcon, SearchIcon } from "../../icons/ExportIcons";
interface SearchProps {
value?: string | null;
placeholder?: string;
onChange?: (value: string) => void;
debounced?: boolean;
}
const Search: React.FC<SearchProps> = ({
value = "",
placeholder = "Search",
onChange,
debounced = false,
}) => {
const [inputValue, setInputValue] = useState(value);
const [isFocused, setIsFocused] = useState(false);
const handleInputChange = (event: ChangeEvent<HTMLInputElement>) => {
const newValue = event.target.value;
setInputValue(newValue);
if (!debounced) {
onChange?.(newValue);
}
};
useEffect(() => {
if (value === null) {
setInputValue("");
handleBlur();
}
}, [value]);
useEffect(() => {
if (!debounced) return;
const timer = setTimeout(() => {
onChange?.(inputValue ?? "");
}, 500);
return () => clearTimeout(timer);
}, [inputValue, debounced, onChange]);
const handleClear = () => {
setInputValue("");
onChange?.("");
};
const handleFocus = () => {
setIsFocused(true);
};
const handleBlur = () => {
setIsFocused(false);
};
return (
<div className="search-wrapper">
<div className={`search-container ${isFocused || inputValue ? "active" : ""}`}>
<div className="icon-container">
<SearchIcon />
</div>
<input
type="text"
className="search-input"
value={inputValue ?? ""}
placeholder={placeholder}
onChange={handleInputChange}
onFocus={handleFocus}
onBlur={handleBlur}
/>
{inputValue && (
<button id="clear-button" className="clear-button" onClick={handleClear}>
<CloseIcon />
</button>
)}
</div>
</div>
);
};
export default Search;

View File

@@ -0,0 +1,359 @@
import { useEffect, useState } from "react";
import clsx from "clsx";
import {
ChevronIcon,
CubeIcon,
EyeIcon,
FocusIcon,
FolderIcon,
KebebIcon,
LockIcon,
} from "../../icons/ExportIcons";
import { DEFAULT_PRAMS, type AssetGroupChild } from "../../data/OutlineListData";
interface TreeNodeProps {
item: AssetGroupChild;
level?: number;
textColor?: string;
eyeIconColor?: string;
lockIconColor?: string;
onDragStart: (item: AssetGroupChild) => void;
onRename: (id: string, item: string) => void;
onDrop: (item: AssetGroupChild, parent: AssetGroupChild | null, e: React.DragEvent) => void;
draggingItem: AssetGroupChild | null;
draggedItems: AssetGroupChild[] | [];
hierarchy: AssetGroupChild[] | [];
selectedObject: AssetGroupChild | null;
selectedObjects: AssetGroupChild[] | [];
onDragOver: (item: AssetGroupChild, parent: AssetGroupChild | null, e: React.DragEvent) => void;
setSelectedObject: React.Dispatch<React.SetStateAction<AssetGroupChild | null>>;
setSelectedObjects: React.Dispatch<React.SetStateAction<AssetGroupChild[] | []>>;
setHierarchy: React.Dispatch<React.SetStateAction<AssetGroupChild[] | []>>;
setDraggedItems: React.Dispatch<React.SetStateAction<AssetGroupChild[] | []>>;
pushHistory: (newHierarchy: AssetGroupChild[]) => void;
}
const TreeNode: React.FC<TreeNodeProps> = ({
item,
level = 0,
textColor,
eyeIconColor,
lockIconColor,
onDragStart,
onDrop,
draggingItem,
setSelectedObject,
selectedObject,
onDragOver,
onRename,
setSelectedObjects,
selectedObjects,
setDraggedItems,
draggedItems,
pushHistory,
setHierarchy,
hierarchy,
}) => {
const isGroupNode =
Array.isArray(item.children) && item.children.length > 0 ? item.children : false;
const [isExpanded, setIsExpanded] = useState(item.isExpanded || false);
const [isEditing, setIsEditing] = useState(false);
const [name, setName] = useState(item.groupName || item.modelName);
const handleDragStart = (e: React.DragEvent) => {
e.stopPropagation();
onDragStart(item);
};
const handleDragOver = (e: React.DragEvent) => {
e.preventDefault();
onDragOver(item, draggingItem, e);
};
const handleDrop = (e: React.DragEvent) => {
e.preventDefault();
onDrop(item, draggingItem, e);
};
const isBeingDragged =
draggingItem?.groupUuid === item.groupUuid || draggingItem?.modelUuid === item.modelUuid;
const handleDoubleClick = () => {
setIsEditing(true);
};
const handleBlur = () => {
setIsEditing(false);
onRename?.(item.modelUuid || item.groupUuid || "", name || "");
};
const handleKeyDown = (e: React.KeyboardEvent<HTMLInputElement>) => {
if (e.key === "Enter") {
setIsEditing(false);
onRename?.(item.modelUuid || item.groupUuid || "", name || "");
}
};
const toggleSelect = (event?: React.MouseEvent | React.KeyboardEvent) => {
event?.stopPropagation?.();
const currentId = item.modelUuid || item.groupUuid;
const isMultiSelect =
!!event &&
("ctrlKey" in event || "metaKey" in event) &&
(event.ctrlKey || event.metaKey);
if (isMultiSelect) {
const isAlreadySelected = selectedObjects.some(
(obj) => obj.modelUuid === currentId || obj.groupUuid === currentId
);
if (isAlreadySelected) {
// Deselect the item
setSelectedObjects((prev) =>
prev.filter((obj) => obj.modelUuid !== currentId && obj.groupUuid !== currentId)
);
} else {
// Add the new item to the selection
setSelectedObjects((prev) => [...prev, item]);
}
} else {
// Single select: clear others and set the current one
setSelectedObject(item);
setSelectedObjects([item]);
}
};
const handleDivKeyDown = (e: React.KeyboardEvent<HTMLDivElement>) => {
if (e.key === "Enter") {
e.preventDefault();
toggleSelect();
} else if (e.key === "Escape") {
setIsEditing(false);
}
};
const handleTouchStart = (e: React.TouchEvent<HTMLDivElement>) => {
e.stopPropagation();
e.preventDefault();
toggleSelect();
};
const handleToggleVisibility = (e: React.MouseEvent) => {
e.stopPropagation();
const updatedHierarchy = structuredClone(hierarchy);
const targetIds = selectedObjects.length
? selectedObjects.map((obj) => obj.modelUuid || obj.groupUuid)
: [item.modelUuid || item.groupUuid];
const toggleVisibilityRecursive = (nodes: AssetGroupChild[]) => {
for (const node of nodes) {
const nodeId = node.modelUuid || node.groupUuid;
if (targetIds.includes(nodeId)) {
node.isVisible = !node.isVisible;
}
if (node.children?.length) toggleVisibilityRecursive(node.children);
}
};
toggleVisibilityRecursive(updatedHierarchy);
pushHistory(updatedHierarchy);
setHierarchy(updatedHierarchy);
};
const handleToggleLock = (e: React.MouseEvent) => {
e.stopPropagation();
const updatedHierarchy = structuredClone(hierarchy);
const targetIds = selectedObjects.length
? selectedObjects.map((obj) => obj.modelUuid || obj.groupUuid)
: [item.modelUuid || item.groupUuid];
const toggleLockRecursive = (nodes: AssetGroupChild[]) => {
for (const node of nodes) {
const nodeId = node.modelUuid || node.groupUuid;
if (targetIds.includes(nodeId)) {
node.isLocked = !node.isLocked;
}
if (node.children?.length) toggleLockRecursive(node.children);
}
};
toggleLockRecursive(updatedHierarchy);
pushHistory(updatedHierarchy);
setHierarchy(updatedHierarchy);
};
useEffect(() => {
const handleClickOutside = (event: MouseEvent): void => {
const target = event.target as HTMLElement;
if (!target.closest(".outline-card")) {
setSelectedObjects([]);
setSelectedObject(null);
}
};
document.addEventListener("mousedown", handleClickOutside);
return () => {
document.removeEventListener("mousedown", handleClickOutside);
};
}, [setSelectedObject, setSelectedObjects]);
return (
<div className="tree-node">
<div
onKeyDown={handleDivKeyDown}
onTouchStart={handleTouchStart}
className={clsx("tree-node-content", {
"group-node": isGroupNode,
"asset-node": !isGroupNode,
"multi-selected": selectedObjects.find(
(obj) => obj.modelUuid === item.modelUuid
),
selected: selectedObject?.modelUuid === item.modelUuid,
locked: item.isLocked,
hidden: !item.isVisible,
dragging: isBeingDragged,
})}
draggable
onDragStart={handleDragStart}
onDragOver={handleDragOver}
onDrop={handleDrop}
id={item.modelUuid || item.groupUuid}
onClick={toggleSelect}
>
<div
className="node-wrapper"
style={{ display: "flex", alignItems: "center", width: "100%" }}
>
<div style={{ width: `${level * 20}px`, flexShrink: 0 }} />
{isGroupNode ? (
<button
className="expand-button"
onClick={(e) => {
e.stopPropagation();
setIsExpanded(!isExpanded);
}}
>
<ChevronIcon isOpen={isExpanded} />
</button>
) : (
<div style={{ width: "20px", flexShrink: 0 }} />
)}
<div className="node-icon" style={{ flexShrink: 0 }}>
{isGroupNode ? <FolderIcon isOpen={isExpanded} /> : <CubeIcon />}
</div>
<div
className="rename-input"
onDoubleClick={handleDoubleClick}
style={{ flex: 1, minWidth: 0, overflow: "hidden" }}
>
{isEditing ? (
<input
autoFocus
value={name}
className="renaming"
style={{
color: textColor,
width: "100%",
border: "none",
background: "transparent",
}}
onChange={(e) => setName(e.target.value)}
onBlur={handleBlur}
onKeyDown={handleKeyDown}
/>
) : (
<span
className="rename-input"
title={name}
style={{
color: textColor || DEFAULT_PRAMS.textColor,
overflow: "hidden",
textOverflow: "ellipsis",
whiteSpace: "nowrap",
display: "block",
width: "100%",
}}
>
{name}
</span>
)}
</div>
<div
className="node-controls"
style={{ display: "flex", gap: "4px", flexShrink: 0 }}
>
{isGroupNode && item.children?.length ? (
<button className="control-button">
<FocusIcon />
</button>
) : null}
<button
className="control-button"
onClick={(e) => {
e.stopPropagation();
handleToggleVisibility(e);
}}
>
<EyeIcon
isClosed={!item.isVisible}
color={eyeIconColor || DEFAULT_PRAMS.eyeIconColor}
/>
</button>
<button
className="control-button"
onClick={(e) => {
e.stopPropagation();
handleToggleLock(e);
}}
>
<LockIcon
isLocked={item.isLocked}
color={lockIconColor || DEFAULT_PRAMS.lockIconColor}
/>
</button>
{isGroupNode ? (
<button className="control-button">
<KebebIcon />
</button>
) : null}
</div>
</div>
</div>
{/* Children */}
{isExpanded && item.children?.length ? (
<div className="tree-children">
{item.children.map((child) => (
<TreeNode
key={child.groupUuid || child.modelUuid}
item={child}
level={level + 1}
onDragStart={onDragStart}
onDrop={onDrop}
draggingItem={draggingItem}
selectedObject={selectedObject}
setSelectedObject={setSelectedObject}
selectedObjects={selectedObjects}
setSelectedObjects={setSelectedObjects}
onDragOver={onDragOver}
onRename={onRename}
draggedItems={draggedItems}
setDraggedItems={setDraggedItems}
pushHistory={pushHistory}
setHierarchy={setHierarchy}
hierarchy={hierarchy}
/>
))}
</div>
) : null}
</div>
);
};
export default TreeNode;

View File

@@ -0,0 +1,30 @@
export const OutlineListData = [
{ modelUuid: "a1", modelName: "Asset 1", isVisible: true, isLocked: false, children: [] },
{ modelUuid: "a2", modelName: "Asset 2", isVisible: true, isLocked: false, children: [] },
{ modelUuid: "a3", modelName: "Asset 3", isVisible: true, isLocked: false, children: [] },
{ modelUuid: "a4", modelName: "Asset 4", isVisible: true, isLocked: false, children: [] },
{ modelUuid: "a5", modelName: "Asset 5", isVisible: true, isLocked: false, children: [] },
{ modelUuid: "a6", modelName: "Asset 6", isVisible: true, isLocked: false, children: [] },
];
export interface AssetGroupChild {
groupUuid?: string;
groupName?: string;
isExpanded?: boolean;
children?: AssetGroupChild[];
modelUuid?: string;
modelName?: string;
isVisible?: boolean;
isLocked?: boolean;
}
export const DEFAULT_PRAMS = {
backgroundColor: "linear-gradient(to bottom, #1e1e2f, #12121a)",
panelSide: "left",
textColor: "linear-gradient(to bottom, rgba(231, 231, 255, 1), #cacad6ff)",
addIconColor: "white",
lockIconColor: "white",
eyeIconColor: "white",
height: "800px",
width: "280px",
search: false,
};

1742
src/icons/ExportIcons.tsx Normal file

File diff suppressed because it is too large Load Diff

68
src/index.css Normal file
View File

@@ -0,0 +1,68 @@
:root {
font-family: system-ui, Avenir, Helvetica, Arial, sans-serif;
line-height: 1.5;
font-weight: 400;
color-scheme: light dark;
color: rgba(255, 255, 255, 0.87);
background-color: #242424;
font-synthesis: none;
text-rendering: optimizeLegibility;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
a {
font-weight: 500;
color: #646cff;
text-decoration: inherit;
}
a:hover {
color: #535bf2;
}
body {
margin: 0;
display: flex;
place-items: center;
min-width: 320px;
min-height: 100vh;
}
h1 {
font-size: 3.2em;
line-height: 1.1;
}
button {
border-radius: 8px;
border: 1px solid transparent;
padding: 0.6em 1.2em;
font-size: 1em;
font-weight: 500;
font-family: inherit;
background-color: #1a1a1a;
cursor: pointer;
transition: border-color 0.25s;
}
button:hover {
border-color: #646cff;
}
button:focus,
button:focus-visible {
outline: 4px auto -webkit-focus-ring-color;
}
@media (prefers-color-scheme: light) {
:root {
color: #213547;
background-color: #ffffff;
}
a:hover {
color: #747bff;
}
button {
background-color: #f9f9f9;
}
}

10
src/main.tsx Normal file
View File

@@ -0,0 +1,10 @@
import { StrictMode } from 'react'
import { createRoot } from 'react-dom/client'
import './index.css'
import App from './App.tsx'
createRoot(document.getElementById('root')!).render(
<StrictMode>
<App />
</StrictMode>,
)

20
src/pages/SceneView.tsx Normal file
View File

@@ -0,0 +1,20 @@
import OutlinePanel from "../components/ui/OutlinePanel";
import { OutlineListData } from "../data/OutlineListData";
const SceneView = () => {
return (
<OutlinePanel
// height="500px"
// width="420px"
panelSide="right"
// textColor=""
// addIconColor=""
// eyeIconColor=""
// backgroundColor=""
// search={true}
data={OutlineListData}
/>
);
};
export default SceneView;

View File

@@ -0,0 +1,5 @@
// get rem from pixels
@function get_rem($px) {
@return calc($px / 16 * 1rem);
}

View File

@@ -0,0 +1,33 @@
@mixin flex-center {
display: flex;
justify-content: center;
align-items: center;
}
@mixin flex-space-between {
display: flex;
justify-content: space-between;
align-items: center;
}
// Array of base colors
$colors: (
#f5550b,
#1bac1b,
#0099ff,
#d4c927,
#8400ff,
#13e9b3,
#df1dcf
);
@mixin gradient-by-child($index) {
// Get the color based on the index passed
$base-color: nth($colors, $index);
// Apply gradient using the same color with different alpha values
background: linear-gradient(
144.19deg,
rgba($base-color, 0.2) 16.62%, // 20% opacity
rgba($base-color, 0.08) 85.81% // 80% opacity
);
}

View File

@@ -0,0 +1,171 @@
@use "functions";
@import url("https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&family=Josefin+Sans:ital,wght@0,100..700;1,100..700&family=Poppins:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&family=Roboto:ital,wght@0,100..900;1,100..900&display=swap");
// new variables
// text colors
// ---------- light mode ----------
$text-color: #2b3344;
$text-disabled: #b7b7c6;
$input-text-color: #595965;
$highlight-text-color: #6f42c1;
$text-button-color: #f3f3fd;
// ---------- dark mode ----------
$text-color-dark: #f3f3fd;
$text-disabled-dark: #6f6f7a;
$input-text-color-dark: #b5b5c8;
$highlight-text-color-dark: #d2baff;
$text-button-color-dark: #f3f3fd;
// background colors
// ---------- light mode ----------
$background-color: linear-gradient(-45deg, #fcfdfd71 0%, #fcfdfd79 100%);
$background-color-solid-gradient: linear-gradient(-45deg, #fcfdfd 0%, #fcfdfd 100%);
$background-color-solid: #fcfdfd;
$background-color-secondary: #fcfdfd4d;
$background-color-accent: #6f42c1;
$background-color-button: #6f42c1;
$background-color-drop-down: #6f42c14d;
$background-color-input: #ffffff4d;
$background-color-input-focus: #f2f2f7;
$background-color-drop-down-gradient: linear-gradient(-45deg, #75649366 0%, #40257266 100%);
$background-color-selected: #e0dfff;
$background-radial-gray-gradient: radial-gradient(circle, #bfe0f8 0%, #e9ebff 46%, #e2acff 100%);
$background-model: #ffffff80;
// ---------- dark mode ----------
$background-color-dark: linear-gradient(-45deg, #333333b3 0%, #2d2437b3 100%);
$background-color-solid-gradient-dark: linear-gradient(-45deg, #333333 0%, #2d2437 100%);
$background-color-solid-dark: #19191d;
$background-color-secondary-dark: #19191d99;
$background-color-accent-dark: #6f42c1;
$background-color-button-dark: #6f42c1;
$background-color-drop-down-dark: #50505080;
$background-color-input-dark: #ffffff33;
$background-color-input-focus-dark: #333333;
$background-color-drop-down-gradient-dark: linear-gradient(-45deg, #8973b166 0%, #53427366 100%);
$background-color-selected-dark: #403e66;
$background-radial-gray-gradient-dark: radial-gradient(
circle,
#31373b 0%,
#48494b 46%,
#52415c 100%
);
$background-model-dark: #00000080;
// border colors
// ---------- light mode ----------
$border-color: #e0dfff;
$input-border-color: #d5dddd80;
$border-color-accent: #6f42c1;
// ---------- dark mode ----------
$border-color-dark: #564b69;
$input-border-color-dark: #d5dddd80;
$border-color-accent-dark: #6f42c1;
// highlight colors
// ---------- light mode ----------
$highlight-accent-color: #e0dfff;
$highlight-secondary-color: #6f42c1;
// ---------- dark mode ----------
$highlight-accent-color-dark: #403e6a;
$highlight-secondary-color-dark: #c4abf1;
// icon colors
// ---------- light mode ----------
$icon-default-color: #6f42c1;
$icon-default-color-hover: #7f4ddb;
$icon-default-color-active: #f2f2f7;
// ---------- dark mode ----------
$icon-default-color-dark: #6f42c1;
$icon-default-color-hover-dark: #7f4ddb;
$icon-default-color-active-dark: #f2f2f7;
// colors
$color1: #a392cd;
$color2: #7b4cd3;
$color3: #b186ff;
$color4: #8752e8;
$color5: #c7a8ff;
// log indication colors
// ------------ text -------------
$log-default-text-color: #6f42c1;
$log-info-text-color: #1773fd;
$log-warn-text-color: #f3a50c;
$log-error-text-color: #fc230f;
$log-success-text-color: #23a84f;
// ----------- dark ---------------
$log-default-text-color-dark: #b18ef1;
$log-info-text-color-dark: #7eb0fa;
$log-warn-text-color-dark: #ffaa00;
$log-error-text-color-dark: #ff887d;
$log-success-text-color-dark: #43ff81;
// ------------ background -------------
$log-default-backgroung-color: #6e42c133;
$log-info-background-color: #1773fd5d;
$log-warn-background-color: #f3a50c33;
$log-error-background-color: #fc230f33;
$log-success-background-color: #0ef75b33;
// old variables
$accent-color: #6f42c1;
$accent-color-dark: #c4abf1;
$background-color-gray: #f3f3f3;
$background-color-gray-dark: #232323;
$shadow-color: #3c3c431a;
$shadow-color-dark: #8f8f8f1a;
$acent-gradient-dark: linear-gradient(90deg, #b392f0 0%, #a676ff 100%);
$acent-gradient: linear-gradient(90deg, #6f42c1 0%, #925df3 100%);
$faint-gradient: radial-gradient(circle, #bfe0f8 0%, #e9ebff 46%, #e2acff 100%);
$faint-gradient-dark: radial-gradient(circle, #31373b 0%, #48494b 46%, #52415c 100%);
$font-inter: "Inter", sans-serif;
$font-josefin-sans: "Josefin Sans", sans-serif;
$font-poppins: "Poppins", sans-serif;
$font-roboto: "Roboto", sans-serif;
$tiny: 0.625rem;
$small: 0.75rem;
$regular: 0.8rem;
$large: 1rem;
$xlarge: 1.125rem;
$xxlarge: 1.5rem;
$xxxlarge: 2rem;
$thin-weight: 300;
$regular-weight: 400;
$medium-weight: 500;
$bold-weight: 600;
$z-index-drei-html: 1;
$z-index-default: 1;
$z-index-marketplace: 2;
$z-index-tools: 3;
$z-index-negative: -1;
$z-index-ui-base: 10;
$z-index-ui-overlay: 20;
$z-index-ui-popup: 30;
$z-index-ui-highest: 50;
$box-shadow-light: 0px 2px 4px $shadow-color;
$box-shadow-medium: 0px 4px 8px $shadow-color;
$box-shadow-heavy: 0px 8px 16px $shadow-color;
$border-radius-small: 4px;
$border-radius-medium: 6px;
$border-radius-large: 12px;
$border-radius-circle: 50%;
$border-radius-xlarge: 16px;
$border-radius-extra-large: 20px;
$border-radius-xxx: 30px;

View File

@@ -0,0 +1,360 @@
$default-bg: #1e1e1e;
$default-text: #cccccc;
$border-color: #3e3e3e;
$hover-bg: #2a2a2a;
$selected-bg: #094771;
$active-bg: #0e639c;
$dragging-opacity: 0.5;
$transition-speed: 0.2s;
$icon-size: 16px;
$node-height: 28px;
$spacing-unit: 8px;
html,
body,
#root {
width: 100%;
height: 100%;
}
// Mixins
@mixin flex-center {
display: flex;
align-items: center;
}
@mixin button-reset {
background: none;
border: none;
padding: 0;
margin: 0;
cursor: pointer;
outline: none;
color: inherit;
}
@mixin smooth-transition($properties...) {
transition: $properties $transition-speed ease;
}
.outline-overlay {
width: 100%;
padding: 0 4px;
font-family: "Segoe UI", sans-serif;
display: flex;
position: absolute;
top: 0;
bottom: 0;
pointer-events: none;
z-index: 1000;
}
.outline-card {
pointer-events: all;
border-radius: 10px;
border: 1px solid #2e2e3e;
background: linear-gradient(to bottom, #1e1e2f, #12121a);
box-shadow: 0 0 8px rgba(150, 83, 212, 0.2);
display: flex;
flex-direction: column;
overflow: hidden;
.search-overlay {
// Search Wrapper
.search-wrapper {
width: 100%;
position: sticky;
top: 0;
width: 100%;
z-index: 1;
.search-container {
@include flex-center;
background: $hover-bg;
border: 1px solid $border-color;
border-radius: 20px;
padding: 6px;
gap: $spacing-unit;
@include smooth-transition(border-color, background-color);
&.active,
&:focus-within {
border-color: #b566ff;
background: #262626;
}
.icon-container {
@include flex-center;
flex-shrink: 0;
width: $icon-size;
height: $icon-size;
opacity: 0.6;
svg {
width: 100%;
height: 100%;
}
}
.search-input {
flex: 1;
background: transparent;
border: none;
outline: none;
color: $default-text;
font-size: 13px;
font-family: inherit;
&::placeholder {
color: #888;
}
}
.clear-button {
@include button-reset;
@include flex-center;
width: $icon-size;
height: $icon-size;
opacity: 0.6;
@include smooth-transition(opacity);
&:hover {
opacity: 1;
}
svg {
width: 100%;
height: 100%;
}
}
}
}
}
}
.outline-header {
display: flex;
align-items: center;
justify-content: space-between;
padding: 10px 16px;
border-bottom: 1px solid #2e2e3e;
}
.header-title {
p {
margin: 0;
font-weight: 600;
font-size: 14px;
color: #ffffff;
}
}
.outline-toolbar {
display: flex;
gap: 8px;
.toolbar-button {
background: none;
border: none;
color: #aaa;
cursor: pointer;
width: 24px;
height: 24px;
border-radius: 4px;
transition: background 0.3s;
&:hover {
background-color: rgba(255, 255, 255, 0.1);
color: #a855f7;
}
svg {
width: 100%;
height: 100%;
}
}
.close-button {
background: none;
border: none;
color: #aaa;
cursor: pointer;
width: 24px;
height: 24px;
border-radius: 4px;
transition: transform 0.3s ease;
&:hover {
background-color: rgba(255, 255, 255, 0.1);
transform: rotate(-90deg);
color: #a855f7;
}
svg {
width: 100%;
height: 100%;
}
}
}
.outline-content {
max-height: 52vh;
overflow-y: auto;
padding: 8px 0;
}
.tree-node {
display: flex;
flex-direction: column;
transition: background 0.3s;
&.dragging {
opacity: 0.5;
}
}
.tree-node-content {
display: flex;
align-items: center;
padding: 3px 8px;
margin: 2px 2px;
gap: 8px;
transition: background 0.2s ease;
position: relative;
cursor: pointer;
border-radius: 6px;
&.selected {
background: #6f42c1;
border-radius: 50px;
}
&:hover {
outline: 2px solid #b188ff;
border-radius: 50px;
}
> div {
display: flex;
align-items: center;
flex: 1;
}
&.multi-selected {
background: #6f42c1;
border-radius: 50px;
}
&.locked {
opacity: 0.6;
cursor: not-allowed;
transform: scale(0.98);
background-color: transparent;
outline: none;
border: none;
}
&.hidden {
opacity: 0.4;
}
}
.expand-button {
background: none;
border: none;
cursor: pointer;
width: 20px;
height: 20px;
padding: 0;
color: #aaa;
&:hover {
color: #a855f7;
}
}
.node-icon {
color: #fff;
width: 18px;
flex-shrink: 0;
display: flex;
align-items: center;
justify-content: center;
svg {
width: 18px;
height: 18px;
}
}
.rename-input {
background: transparent;
border: none;
color: #fff;
font-size: 14px;
flex: 1;
outline: none;
padding: 2px 4px;
&:focus {
border-bottom: 1px solid #a855f7;
}
input {
background: white;
border: none;
color: black;
font-size: 14px;
width: 100%;
outline: none;
&:focus {
border-bottom: 1px solid white;
border-radius: 30px;
height: 20px;
}
}
span {
display: block;
}
}
.node-controls {
display: flex;
gap: 6px;
margin-left: auto;
.control-button {
background: none;
border: none;
color: #888;
cursor: pointer;
padding: 4px;
border-radius: 4px;
transition: all 0.2s;
&:hover {
background-color: rgba(255, 255, 255, 0.1);
color: #a855f7;
}
svg {
width: 16px;
height: 16px;
}
}
}
.tree-children {
border-left: 1px dashed rgba(255, 255, 255, 0.05);
}
// Responsive adjustments
@media (max-width: 768px) {
.outline-card {
width: 240px;
}
.outline-overlay {
padding: 0 2px;
}
.rename-input {
font-size: 13px;
}
}

1
src/styles/main.scss Normal file
View File

@@ -0,0 +1 @@
@use "components/outlinePanel.scss";

28
tsconfig.app.json Normal file
View File

@@ -0,0 +1,28 @@
{
"compilerOptions": {
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
"target": "ES2022",
"useDefineForClassFields": true,
"lib": ["ES2022", "DOM", "DOM.Iterable"],
"module": "ESNext",
"types": ["vite/client"],
"skipLibCheck": true,
/* Bundler mode */
"moduleResolution": "bundler",
"allowImportingTsExtensions": true,
"verbatimModuleSyntax": true,
"moduleDetection": "force",
"noEmit": true,
"jsx": "react-jsx",
/* Linting */
"strict": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"erasableSyntaxOnly": true,
"noFallthroughCasesInSwitch": true,
"noUncheckedSideEffectImports": true
},
"include": ["src"]
}

7
tsconfig.json Normal file
View File

@@ -0,0 +1,7 @@
{
"files": [],
"references": [
{ "path": "./tsconfig.app.json" },
{ "path": "./tsconfig.node.json" }
]
}

26
tsconfig.node.json Normal file
View File

@@ -0,0 +1,26 @@
{
"compilerOptions": {
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo",
"target": "ES2023",
"lib": ["ES2023"],
"module": "ESNext",
"types": ["node"],
"skipLibCheck": true,
/* Bundler mode */
"moduleResolution": "bundler",
"allowImportingTsExtensions": true,
"verbatimModuleSyntax": true,
"moduleDetection": "force",
"noEmit": true,
/* Linting */
"strict": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"erasableSyntaxOnly": true,
"noFallthroughCasesInSwitch": true,
"noUncheckedSideEffectImports": true
},
"include": ["vite.config.ts"]
}

11
vite.config.ts Normal file
View File

@@ -0,0 +1,11 @@
import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";
// https://vite.dev/config/
export default defineConfig({
plugins: [react()],
server: {
host: true,
port: 5173,
},
});