mirror of
https://github.com/aharabada/glitchy-engine-beef.git
synced 2026-09-05 13:01:52 +00:00
Added UI Project to this repository, small UI fixes
This commit is contained in:
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
FileVersion = 1
|
FileVersion = 1
|
||||||
Projects = {GlitchyEngine = {Path = "GlitchyEngine"}, GlitchLog = {Path = "GlitchLog"}, DirectX = {Path = "GlitchyEngine/vendor/directx/DirectX"}, LodePng = {Path = "vendor/lodepng-beef/lodepng-beef"}, FreeType = {Path = "GlitchyEngine/vendor/freetype"}, cgltf-beef = {Path = "GlitchyEngine/vendor/gltf/cgltf-beef"}, GlitchyEditor = {Path = "GlitchyEditor"}, msdfgen-beef = {Path = "GlitchyEngine/vendor/msdfgen/msdfgen-beef"}, ImGui = {Path = "GlitchyEngine/vendor/imgui/ImGui"}, ImGuiImplDX11 = {Path = "GlitchyEngine/vendor/imgui/ImGuiImplDX11"}, ImGuiImplWin32 = {Path = "GlitchyEngine/vendor/imgui/ImGuiImplWin32"}, ImGuizmo = {Path = "GlitchyEngine/vendor/imgui/ImGuizmo"}, GlitchyEngineHelper = {Path = "GlitchyEngineHelper"}, bon = {Path = "GlitchyEngine/vendor/bon"}, box2d-beef = {Path = "GlitchyEngine/vendor/box2D"}, "Beef.Linq" = {Path = "GlitchyEngine/vendor/Beef.Linq/src"}, ScriptCore = {Path = "ScriptCore"}, Ultralight = {Path = "GlitchyEngine/vendor/Ultralight-beef"}}
|
Projects = {GlitchyEngine = {Path = "GlitchyEngine"}, GlitchLog = {Path = "GlitchLog"}, DirectX = {Path = "GlitchyEngine/vendor/directx/DirectX"}, LodePng = {Path = "vendor/lodepng-beef/lodepng-beef"}, FreeType = {Path = "GlitchyEngine/vendor/freetype"}, cgltf-beef = {Path = "GlitchyEngine/vendor/gltf/cgltf-beef"}, GlitchyEditor = {Path = "GlitchyEditor"}, msdfgen-beef = {Path = "GlitchyEngine/vendor/msdfgen/msdfgen-beef"}, ImGui = {Path = "GlitchyEngine/vendor/imgui/ImGui"}, ImGuiImplDX11 = {Path = "GlitchyEngine/vendor/imgui/ImGuiImplDX11"}, ImGuiImplWin32 = {Path = "GlitchyEngine/vendor/imgui/ImGuiImplWin32"}, ImGuizmo = {Path = "GlitchyEngine/vendor/imgui/ImGuizmo"}, GlitchyEngineHelper = {Path = "GlitchyEngineHelper"}, bon = {Path = "GlitchyEngine/vendor/bon"}, box2d-beef = {Path = "GlitchyEngine/vendor/box2D"}, "Beef.Linq" = {Path = "GlitchyEngine/vendor/Beef.Linq/src"}, ScriptCore = {Path = "ScriptCore"}, Ultralight = {Path = "GlitchyEngine/vendor/Ultralight-beef"}, EditorUI = {Path = "GlitchyEditor/EditorUI"}}
|
||||||
WorkspaceFolders = {GlitchyEngine = ["GlitchyEngine", "GlitchLog", "GlitchyEngineHelper", "ScriptCore"], "GlitchyEngine/Dependencies" = ["cgltf-beef", "DirectX", "FreeType", "ImGui", "ImGuiImplDX11", "ImGuiImplWin32", "ImGuizmo", "LodePng", "msdfgen-beef", "bon", "box2d-beef", "Beef.Linq"]}
|
WorkspaceFolders = {GlitchyEngine = ["GlitchyEngine", "GlitchLog", "GlitchyEngineHelper", "ScriptCore"], "GlitchyEngine/Dependencies" = ["cgltf-beef", "DirectX", "FreeType", "ImGui", "ImGuiImplDX11", "ImGuiImplWin32", "ImGuizmo", "LodePng", "msdfgen-beef", "bon", "box2d-beef", "Beef.Linq"]}
|
||||||
|
|
||||||
[Workspace]
|
[Workspace]
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
FileVersion = 1
|
FileVersion = 1
|
||||||
Dependencies = {corlib = "*", GlitchLog = "*", GlitchyEngine = "*", Ultralight = "*"}
|
Dependencies = {corlib = "*", GlitchLog = "*", GlitchyEngine = "*", Ultralight = "*", EditorUI = "*"}
|
||||||
|
|
||||||
[Project]
|
[Project]
|
||||||
Name = "GlitchyEditor"
|
Name = "GlitchyEditor"
|
||||||
|
|||||||
@@ -22,3 +22,5 @@ dist-ssr
|
|||||||
*.njsproj
|
*.njsproj
|
||||||
*.sln
|
*.sln
|
||||||
*.sw?
|
*.sw?
|
||||||
|
|
||||||
|
*.tsbuildinfo
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
FileVersion = 1
|
||||||
|
|
||||||
|
[Project]
|
||||||
|
Name = "EditorUI"
|
||||||
|
TargetType = "CustomBuild"
|
||||||
|
StartupObject = "EditorUI.Program"
|
||||||
|
|
||||||
|
[Configs.Debug.Win64]
|
||||||
|
BuildCommandsOnCompile = "IfFilesChanged"
|
||||||
|
BuildCommandsOnRun = "IfFilesChanged"
|
||||||
|
PreBuildCmds = ["npm run build"]
|
||||||
|
PostBuildCmds = ["CopyToDependents(\"$(ProjectDir)/dist\")"]
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
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'
|
||||||
|
|
||||||
|
export default tseslint.config(
|
||||||
|
{ignores: ['dist']},
|
||||||
|
{
|
||||||
|
extends: [js.configs.recommended, ...tseslint.configs.recommended],
|
||||||
|
files: ['**/*.{ts,tsx}'],
|
||||||
|
languageOptions: {
|
||||||
|
ecmaVersion: 2020,
|
||||||
|
globals: globals.browser,
|
||||||
|
parserOptions: {
|
||||||
|
project: ['./tsconfig.node.json', './tsconfig.app.json'],
|
||||||
|
tsconfigRootDir: import.meta.dirname
|
||||||
|
}
|
||||||
|
},
|
||||||
|
plugins: {
|
||||||
|
'react-hooks': reactHooks,
|
||||||
|
'react-refresh': reactRefresh,
|
||||||
|
},
|
||||||
|
rules: {
|
||||||
|
...reactHooks.configs.recommended.rules,
|
||||||
|
'react-refresh/only-export-components': [
|
||||||
|
'warn',
|
||||||
|
{allowConstantExport: true},
|
||||||
|
],
|
||||||
|
"@typescript-eslint/no-unused-vars": ["warn", {
|
||||||
|
"vars": "all",
|
||||||
|
"args": "all",
|
||||||
|
"caughtErrors": "all",
|
||||||
|
"ignoreRestSiblings": false,
|
||||||
|
"reportUsedIgnorePattern": false
|
||||||
|
}],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
)
|
||||||
+2
-2
@@ -2,9 +2,9 @@
|
|||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8" />
|
<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" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
<title>Vite + React + TS</title>
|
<link rel="icon" type="image/x-icon" href="/src/assets/GlitchyEngineTransparent.png">
|
||||||
|
<title>Glitchy Engine</title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div id="root"></div>
|
<div id="root"></div>
|
||||||
GlitchyEditor/assets/react-ui-prototype/package-lock.json → GlitchyEditor/EditorUI/package-lock.json
Generated
+1659
-213
File diff suppressed because it is too large
Load Diff
+7
-3
@@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"name": "react-ui-prototype",
|
"name": "glitchy-editor-ui",
|
||||||
"private": true,
|
"private": true,
|
||||||
"version": "0.0.0",
|
"version": "0.0.0",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
@@ -10,8 +10,11 @@
|
|||||||
"preview": "vite preview"
|
"preview": "vite preview"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"dockview-react": "^1.17.2",
|
||||||
|
"eslint-plugin-react": "^7.37.2",
|
||||||
"react": "^18.3.1",
|
"react": "^18.3.1",
|
||||||
"react-dom": "^18.3.1"
|
"react-dom": "^18.3.1",
|
||||||
|
"use-immer": "^0.10.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@eslint/js": "^9.11.1",
|
"@eslint/js": "^9.11.1",
|
||||||
@@ -24,6 +27,7 @@
|
|||||||
"globals": "^15.9.0",
|
"globals": "^15.9.0",
|
||||||
"typescript": "^5.5.3",
|
"typescript": "^5.5.3",
|
||||||
"typescript-eslint": "^8.7.0",
|
"typescript-eslint": "^8.7.0",
|
||||||
"vite": "^5.4.8"
|
"vite": "^5.4.8",
|
||||||
|
"vite-plugin-eslint": "^1.8.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
import './App.css'
|
||||||
|
import MainWindow from "./Windows/MainWindow.tsx";
|
||||||
|
|
||||||
|
export default function App() {
|
||||||
|
return <MainWindow/>;
|
||||||
|
}
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
import {RefObject, useEffect} from "react";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Calls the specified callback when the user clicks somewhere outside the referenced HTML-Element.
|
||||||
|
* @param ref The element.
|
||||||
|
* @param callback The callback.
|
||||||
|
* @param addEventListener If true, the event listener will be registered.
|
||||||
|
*/
|
||||||
|
export const useClickOutside = (
|
||||||
|
ref: RefObject<HTMLElement | undefined>,
|
||||||
|
callback: () => void,
|
||||||
|
addEventListener = true,
|
||||||
|
) => {
|
||||||
|
useEffect(() => {
|
||||||
|
const handleClick = (event: MouseEvent) => {
|
||||||
|
if (ref.current && !ref.current.contains(event.target as HTMLElement))
|
||||||
|
{
|
||||||
|
callback();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (addEventListener)
|
||||||
|
{
|
||||||
|
document.addEventListener('click', handleClick);
|
||||||
|
}
|
||||||
|
|
||||||
|
return () => {
|
||||||
|
document.removeEventListener('click', handleClick);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
@@ -0,0 +1,94 @@
|
|||||||
|
import {
|
||||||
|
DockviewReact,
|
||||||
|
DockviewReadyEvent,
|
||||||
|
IDockviewPanelProps,
|
||||||
|
} from 'dockview';
|
||||||
|
import {ChangeEvent, ReactElement, useState} from "react";
|
||||||
|
import EntityHierarchyWindow from "../Windows/EntityHierarchyWindow.tsx";
|
||||||
|
import CursorTestWindow from "../Windows/CursorTestWindow.tsx";
|
||||||
|
|
||||||
|
|
||||||
|
const components = {
|
||||||
|
default: DefaultWindow,
|
||||||
|
entityHierarchy: EntityHierarchyWindow,
|
||||||
|
editPanel: CursorTestWindow
|
||||||
|
};
|
||||||
|
|
||||||
|
function DefaultWindow(props: IDockviewPanelProps<{ myValue: string }>): ReactElement
|
||||||
|
{
|
||||||
|
const [title, setTitle] = useState<string>(props.api.title ?? '');
|
||||||
|
|
||||||
|
const onChange = (event: ChangeEvent<HTMLInputElement>) => {
|
||||||
|
setTitle(event.target.value);
|
||||||
|
};
|
||||||
|
|
||||||
|
const onClick = () => {
|
||||||
|
props.api.setTitle(title);
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div style={{ padding: '20px', color: 'white' }}>
|
||||||
|
<div>
|
||||||
|
<span style={{ color: 'grey' }}>{'props.api.title='}</span>
|
||||||
|
<span>{`${props.api.title}`}</span>
|
||||||
|
</div>
|
||||||
|
<input value={title} onChange={onChange} />
|
||||||
|
<button onClick={onClick}>Change</button>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default function Dock({ theme } : { theme?: string})
|
||||||
|
{
|
||||||
|
const onReady = (event: DockviewReadyEvent) => {
|
||||||
|
const entityHierarchyPanel = event.api.addPanel({
|
||||||
|
id: 'entity_hierarchy_panel',
|
||||||
|
component: 'entityHierarchy',
|
||||||
|
title: 'Entity Hierarchy'
|
||||||
|
});
|
||||||
|
|
||||||
|
const editPanel = event.api.addPanel({
|
||||||
|
id: 'edit_scene',
|
||||||
|
component: 'editPanel',
|
||||||
|
title: 'Edit',
|
||||||
|
position: { referencePanel: entityHierarchyPanel, direction: "right" }
|
||||||
|
});
|
||||||
|
|
||||||
|
/*const playPanel =*/ event.api.addPanel({
|
||||||
|
id: 'play_scene',
|
||||||
|
component: 'default',
|
||||||
|
title: 'Play',
|
||||||
|
position: { referencePanel: editPanel }
|
||||||
|
});
|
||||||
|
|
||||||
|
/*const propertiesPanel =*/ event.api.addPanel({
|
||||||
|
id: 'properties_panel',
|
||||||
|
component: 'default',
|
||||||
|
title: 'Properties',
|
||||||
|
position: { referencePanel: editPanel, direction: "right" }
|
||||||
|
});
|
||||||
|
|
||||||
|
const logPanel = event.api.addPanel({
|
||||||
|
id: 'log_panel',
|
||||||
|
component: 'default',
|
||||||
|
title: 'Log',
|
||||||
|
position: { direction: "below" }
|
||||||
|
});
|
||||||
|
|
||||||
|
/*const assetBrowserPanel =*/ event.api.addPanel({
|
||||||
|
id: 'asset_browser_panel',
|
||||||
|
component: 'default',
|
||||||
|
title: 'Assets',
|
||||||
|
position: { referencePanel: logPanel }
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<DockviewReact
|
||||||
|
components={components}
|
||||||
|
onReady={onReady}
|
||||||
|
className={`dock ${theme || 'dockview-theme-vs'}`}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,126 @@
|
|||||||
|
.menu-bar
|
||||||
|
{
|
||||||
|
width: 100%;
|
||||||
|
|
||||||
|
background-color: var(--menu-bar-background-color);
|
||||||
|
grid-area: menubar;
|
||||||
|
|
||||||
|
display: flex;
|
||||||
|
justify-content: start;
|
||||||
|
|
||||||
|
list-style: none;
|
||||||
|
|
||||||
|
white-space: nowrap;
|
||||||
|
|
||||||
|
align-items: center;
|
||||||
|
|
||||||
|
--menu-item-height: 2em;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Remove indentation from lists for menu */
|
||||||
|
.menu-bar, .sub-menu {
|
||||||
|
padding-inline-start: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.menu-item
|
||||||
|
{
|
||||||
|
/* Doesn't change our position, but does something to it, so that
|
||||||
|
following absolutes are absolute to us? */
|
||||||
|
position: relative;
|
||||||
|
height: var(--menu-item-height);
|
||||||
|
}
|
||||||
|
|
||||||
|
.menu-item__content
|
||||||
|
{
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
}
|
||||||
|
|
||||||
|
.menu-item__hotkey
|
||||||
|
{
|
||||||
|
color: var(--menu-bar-hotkey-color);
|
||||||
|
justify-self: flex-end;
|
||||||
|
margin-left: 2em;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* If menu-item has a submenu, make space for the arrow */
|
||||||
|
.menu-item a:has(+.sub-menu)
|
||||||
|
{
|
||||||
|
padding-right: 1em;
|
||||||
|
margin-right: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Show arrow for submenus */
|
||||||
|
.menu-item a:has(+.sub-menu)::after
|
||||||
|
{
|
||||||
|
content: "⯆";
|
||||||
|
position: absolute;
|
||||||
|
right: 0;
|
||||||
|
top: 0;
|
||||||
|
transition-duration: var(--small-transition-duration);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* If it is a nested submenu, forget the char above and use this one instead! */
|
||||||
|
.sub-menu .menu-item a:has(+.sub-menu)::after
|
||||||
|
{
|
||||||
|
content: "⯈";
|
||||||
|
}
|
||||||
|
|
||||||
|
.menu-item a:has(+.sub-menu.open)::after
|
||||||
|
{
|
||||||
|
rotate: 180deg;
|
||||||
|
}
|
||||||
|
|
||||||
|
.menu-item a
|
||||||
|
{
|
||||||
|
/* Make the a fill the entire width of menu-item */
|
||||||
|
display: block;
|
||||||
|
|
||||||
|
text-decoration: none;
|
||||||
|
color: var(--font-color-primary);
|
||||||
|
|
||||||
|
height: 100%;
|
||||||
|
align-content: center;
|
||||||
|
/*padding: 5px 5px;*/
|
||||||
|
}
|
||||||
|
|
||||||
|
.menu-item a:hover
|
||||||
|
{
|
||||||
|
background-color: var(--menu-bar-background-color-hover);
|
||||||
|
}
|
||||||
|
|
||||||
|
.menu-item a:active
|
||||||
|
{
|
||||||
|
background-color: var(--menu-bar-background-color-click);
|
||||||
|
}
|
||||||
|
|
||||||
|
.sub-menu
|
||||||
|
{
|
||||||
|
min-width: 120px;
|
||||||
|
/* Hide submenu by default */
|
||||||
|
display: none;
|
||||||
|
overflow: visible;
|
||||||
|
overflow-anchor: none;
|
||||||
|
position: fixed;
|
||||||
|
background-color: var(--menu-bar-background-color-click);
|
||||||
|
list-style: none;
|
||||||
|
z-index: 10;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Show submenu */
|
||||||
|
.sub-menu.open
|
||||||
|
{
|
||||||
|
display: revert;
|
||||||
|
scale: 100% 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sub-menu .menu-item .sub-menu
|
||||||
|
{
|
||||||
|
translate: 0 calc(var(--menu-item-height) * -1);
|
||||||
|
left: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sub-menu li
|
||||||
|
{
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
@@ -0,0 +1,81 @@
|
|||||||
|
import {createContext, PropsWithChildren, useContext, useRef, useState} from "react";
|
||||||
|
|
||||||
|
import "./Menu.css"
|
||||||
|
import {useClickOutside} from "../Callbacks/UseClickOutside.tsx";
|
||||||
|
|
||||||
|
export const OpenMenuContext = createContext<{openMenu: string[], currentParentMenu: string[], onOpenMenu: (clickedMenu: string[]) => void}>({openMenu: [], currentParentMenu: [], onOpenMenu: () => {}});
|
||||||
|
|
||||||
|
export function MenuBar({children}: PropsWithChildren)
|
||||||
|
{
|
||||||
|
const ref = useRef(null);
|
||||||
|
|
||||||
|
const [openMenu, setOpenMenu] = useState<string[]>([]);
|
||||||
|
|
||||||
|
function handleClickOutside()
|
||||||
|
{
|
||||||
|
setOpenMenu([]);
|
||||||
|
}
|
||||||
|
|
||||||
|
useClickOutside(ref, handleClickOutside, openMenu.length > 0);
|
||||||
|
|
||||||
|
function handleOpenSubmenu(clickedMenu: string[])
|
||||||
|
{
|
||||||
|
setOpenMenu(clickedMenu);
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<ul ref={ref} className="menu-bar">
|
||||||
|
<OpenMenuContext.Provider value={{openMenu, currentParentMenu: [], onOpenMenu: handleOpenSubmenu}}>
|
||||||
|
{children}
|
||||||
|
</OpenMenuContext.Provider>
|
||||||
|
</ul>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function MenuItem({ text, hotkey, onClick, children } : { text: string, hotkey?: string, onClick?: () => void} & PropsWithChildren)
|
||||||
|
{
|
||||||
|
const {openMenu, currentParentMenu, onOpenMenu: setOpenMenu} = useContext(OpenMenuContext);
|
||||||
|
|
||||||
|
const isOpen = openMenu[currentParentMenu.length] == text;
|
||||||
|
|
||||||
|
const hasSubmenu = children !== undefined;
|
||||||
|
|
||||||
|
const currentMenu = [...currentParentMenu, text];
|
||||||
|
|
||||||
|
function handleClick()
|
||||||
|
{
|
||||||
|
if (hasSubmenu)
|
||||||
|
{
|
||||||
|
setOpenMenu(isOpen ? currentParentMenu : currentMenu);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (onClick)
|
||||||
|
{
|
||||||
|
onClick();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<li className="menu-item">
|
||||||
|
<a href="#" onClick={handleClick}>
|
||||||
|
<div className="menu-item__content">
|
||||||
|
<div>{text}</div>
|
||||||
|
{hotkey && <div className="menu-item__hotkey">{hotkey}</div>}
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
|
{children && (
|
||||||
|
<ul className={`sub-menu ${isOpen ? "open" : ""}`}>
|
||||||
|
<OpenMenuContext.Provider
|
||||||
|
value={{openMenu, currentParentMenu: currentMenu, onOpenMenu: setOpenMenu}}>
|
||||||
|
{children}
|
||||||
|
</OpenMenuContext.Provider>
|
||||||
|
</ul>
|
||||||
|
)}
|
||||||
|
</li>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function MenuDivider()
|
||||||
|
{
|
||||||
|
return <hr/>;
|
||||||
|
}
|
||||||
@@ -0,0 +1,95 @@
|
|||||||
|
.backdrop
|
||||||
|
{
|
||||||
|
position: absolute;
|
||||||
|
width: 100vw;
|
||||||
|
height: 100vh;
|
||||||
|
|
||||||
|
background-color: #00000050;
|
||||||
|
|
||||||
|
z-index: 10;
|
||||||
|
animation: blur-in 1s forwards;
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes blur-in {
|
||||||
|
from {
|
||||||
|
backdrop-filter: blur(0px);
|
||||||
|
}
|
||||||
|
to {
|
||||||
|
backdrop-filter: blur(3px);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@property --angle {
|
||||||
|
syntax: "<angle>";
|
||||||
|
initial-value: 0deg;
|
||||||
|
inherits: true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes spin {
|
||||||
|
from {
|
||||||
|
--angle: 0deg;
|
||||||
|
}
|
||||||
|
to {
|
||||||
|
--angle: 360deg;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.card
|
||||||
|
{
|
||||||
|
position: absolute;
|
||||||
|
|
||||||
|
padding: 1em;
|
||||||
|
|
||||||
|
left: 50%;
|
||||||
|
top: 50%;
|
||||||
|
|
||||||
|
translate: -50% -50%;
|
||||||
|
|
||||||
|
margin: auto auto;
|
||||||
|
|
||||||
|
width: 300px;
|
||||||
|
height: 300px;
|
||||||
|
|
||||||
|
background-color: gray;
|
||||||
|
|
||||||
|
border-radius: 30px;
|
||||||
|
|
||||||
|
z-index: 100;
|
||||||
|
transform-style: preserve-3d;
|
||||||
|
|
||||||
|
animation: 3s spin linear infinite;
|
||||||
|
}
|
||||||
|
|
||||||
|
.card::before, .card::after
|
||||||
|
{
|
||||||
|
content: '';
|
||||||
|
|
||||||
|
position: absolute;
|
||||||
|
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
|
||||||
|
left: 50%;
|
||||||
|
top: 50%;
|
||||||
|
|
||||||
|
translate: -50% -50%;
|
||||||
|
transform: translateZ(-1px);
|
||||||
|
|
||||||
|
padding: 3px;
|
||||||
|
border-radius: 30px;
|
||||||
|
|
||||||
|
z-index: -10;
|
||||||
|
|
||||||
|
background-image: conic-gradient(from var(--angle), #ff4545, #edd056, #00ff99, #006aff, #ff0095, #ff4545);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
.card::before
|
||||||
|
{
|
||||||
|
filter: blur(10px);
|
||||||
|
}
|
||||||
|
|
||||||
|
.content
|
||||||
|
{
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
import {ReactElement} from "react";
|
||||||
|
|
||||||
|
import "./StartupCard.css"
|
||||||
|
|
||||||
|
export function StartupCard(): ReactElement
|
||||||
|
{
|
||||||
|
return (
|
||||||
|
<div className="backdrop">
|
||||||
|
<div className="card">
|
||||||
|
<div className="content">
|
||||||
|
<h1>Glitchy Engine</h1>
|
||||||
|
<h2>Projects:</h2>
|
||||||
|
<button>Create New</button>
|
||||||
|
<h3>Recent projects:</h3>
|
||||||
|
<ul>
|
||||||
|
<li>Bli</li>
|
||||||
|
<li>Bla</li>
|
||||||
|
<li>Blub</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -0,0 +1,72 @@
|
|||||||
|
export interface IEngineGlue {
|
||||||
|
// Titlebar Events
|
||||||
|
handleClickCloseWindow(): void;
|
||||||
|
handleClickMaximizeWindow(): void;
|
||||||
|
handleClickMinimizeWindow(): void;
|
||||||
|
handleHoverCloseWindow(hover: boolean): void;
|
||||||
|
handleHoverMaximizeWindow(hover: boolean): void;
|
||||||
|
handleHoverMinimizeWindow(hover: boolean): void;
|
||||||
|
handleHoverNonClientArea(hover: boolean): void;
|
||||||
|
|
||||||
|
onClickCreateEmptyEntity(): void;
|
||||||
|
}
|
||||||
|
|
||||||
|
function logNotImplemented(functionName: string)
|
||||||
|
{
|
||||||
|
console.log(`${functionName} not implemented.`)
|
||||||
|
}
|
||||||
|
|
||||||
|
class DevEngineGlue implements IEngineGlue {
|
||||||
|
handleClickCloseWindow(): void
|
||||||
|
{
|
||||||
|
logNotImplemented("handleClickCloseWindow");
|
||||||
|
}
|
||||||
|
handleClickMaximizeWindow(): void
|
||||||
|
{
|
||||||
|
logNotImplemented("handleClickMaximizeWindow");
|
||||||
|
}
|
||||||
|
handleClickMinimizeWindow(): void
|
||||||
|
{
|
||||||
|
logNotImplemented("handleClickMinimizeWindow");
|
||||||
|
}
|
||||||
|
handleHoverCloseWindow(hover: boolean): void
|
||||||
|
{
|
||||||
|
logNotImplemented("handleHoverCloseWindow");
|
||||||
|
console.log(`Hover ${hover}`)
|
||||||
|
}
|
||||||
|
handleHoverMaximizeWindow(hover: boolean): void
|
||||||
|
{
|
||||||
|
logNotImplemented("handleHoverMaximizeWindow");
|
||||||
|
console.log(`Hover ${hover}`)
|
||||||
|
}
|
||||||
|
handleHoverMinimizeWindow(hover: boolean): void
|
||||||
|
{
|
||||||
|
logNotImplemented("handleHoverMinimizeWindow");
|
||||||
|
console.log(`Hover ${hover}`)
|
||||||
|
}
|
||||||
|
handleHoverNonClientArea(hover: boolean): void
|
||||||
|
{
|
||||||
|
logNotImplemented("handleHoverNonClientArea");
|
||||||
|
console.log(`Hover ${hover}`)
|
||||||
|
}
|
||||||
|
|
||||||
|
onClickCreateEmptyEntity(): void
|
||||||
|
{
|
||||||
|
logNotImplemented("onClickCreateEmptyEntity");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Globales Objekt deklarieren
|
||||||
|
declare global {
|
||||||
|
interface Window {
|
||||||
|
EngineGlue: IEngineGlue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Initialisierung: DevEngineGlue als Fallback setzen wenn noch kein EngineGlue existiert
|
||||||
|
if (typeof window.EngineGlue === 'undefined') {
|
||||||
|
window.EngineGlue = new DevEngineGlue();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Export für einfacheren Zugriff in der Anwendung
|
||||||
|
export const EngineGlue: IEngineGlue = window.EngineGlue;
|
||||||
@@ -0,0 +1,53 @@
|
|||||||
|
.auto { cursor: auto; }
|
||||||
|
.default { cursor: default; }
|
||||||
|
.none { cursor: none; }
|
||||||
|
.context-menu { cursor: context-menu; }
|
||||||
|
.help { cursor: help; }
|
||||||
|
.pointer { cursor: pointer; }
|
||||||
|
.progress { cursor: progress; }
|
||||||
|
.wait { cursor: wait; }
|
||||||
|
.cell { cursor: cell; }
|
||||||
|
.crosshair { cursor: crosshair; }
|
||||||
|
.text { cursor: text; }
|
||||||
|
.vertical-text { cursor: vertical-text; }
|
||||||
|
.alias { cursor: alias; }
|
||||||
|
.copy { cursor: copy; }
|
||||||
|
.move { cursor: move; }
|
||||||
|
.no-drop { cursor: no-drop; }
|
||||||
|
.not-allowed { cursor: not-allowed; }
|
||||||
|
.all-scroll { cursor: all-scroll; }
|
||||||
|
.col-resize { cursor: col-resize; }
|
||||||
|
.row-resize { cursor: row-resize; }
|
||||||
|
.n-resize { cursor: n-resize; }
|
||||||
|
.e-resize { cursor: e-resize; }
|
||||||
|
.s-resize { cursor: s-resize; }
|
||||||
|
.w-resize { cursor: w-resize; }
|
||||||
|
.ns-resize { cursor: ns-resize; }
|
||||||
|
.ew-resize { cursor: ew-resize; }
|
||||||
|
.ne-resize { cursor: ne-resize; }
|
||||||
|
.nw-resize { cursor: nw-resize; }
|
||||||
|
.se-resize { cursor: se-resize; }
|
||||||
|
.sw-resize { cursor: sw-resize; }
|
||||||
|
.nesw-resize { cursor: nesw-resize; }
|
||||||
|
.nwse-resize { cursor: nwse-resize; }
|
||||||
|
.zoom-in { cursor: zoom-in; }
|
||||||
|
.zoom-out { cursor: zoom-out; }
|
||||||
|
.custom { cursor: url('Normal Select.cur'), auto; }
|
||||||
|
|
||||||
|
|
||||||
|
h1 {
|
||||||
|
color: #f06d06;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cursors {
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cursors div
|
||||||
|
{
|
||||||
|
width: 100px;
|
||||||
|
height: 20px;
|
||||||
|
margin: 5px;
|
||||||
|
background-color: blue;
|
||||||
|
}
|
||||||
@@ -0,0 +1,50 @@
|
|||||||
|
import {IDockviewPanelProps} from "dockview";
|
||||||
|
|
||||||
|
import "./CursorTestWindow.css"
|
||||||
|
|
||||||
|
export default function CursorTestWindow(props: IDockviewPanelProps)
|
||||||
|
{
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<h1>CSS Cursors</h1>
|
||||||
|
|
||||||
|
<div className="cursors">
|
||||||
|
<div className="auto">auto</div>
|
||||||
|
<div className="default">default</div>
|
||||||
|
<div className="none">none</div>
|
||||||
|
<div className="context-menu">context-menu</div>
|
||||||
|
<div className="help">help</div>
|
||||||
|
<div className="pointer">pointer</div>
|
||||||
|
<div className="progress">progress</div>
|
||||||
|
<div className="wait">wait</div>
|
||||||
|
<div className="cell">cell</div>
|
||||||
|
<div className="crosshair">crosshair</div>
|
||||||
|
<div className="text">text</div>
|
||||||
|
<div className="vertical-text">vertical-text</div>
|
||||||
|
<div className="alias">alias</div>
|
||||||
|
<div className="copy">copy</div>
|
||||||
|
<div className="move">move</div>
|
||||||
|
<div className="no-drop">no-drop</div>
|
||||||
|
<div className="not-allowed">not-allowed</div>
|
||||||
|
<div className="all-scroll">all-scroll</div>
|
||||||
|
<div className="col-resize">col-resize</div>
|
||||||
|
<div className="row-resize">row-resize</div>
|
||||||
|
<div className="n-resize">n-resize</div>
|
||||||
|
<div className="s-resize">s-resize</div>
|
||||||
|
<div className="e-resize">e-resize</div>
|
||||||
|
<div className="w-resize">w-resize</div>
|
||||||
|
<div className="ns-resize">ns-resize</div>
|
||||||
|
<div className="ew-resize">ew-resize</div>
|
||||||
|
<div className="ne-resize">ne-resize</div>
|
||||||
|
<div className="nw-resize">nw-resize</div>
|
||||||
|
<div className="se-resize">se-resize</div>
|
||||||
|
<div className="sw-resize">sw-resize</div>
|
||||||
|
<div className="nesw-resize">nesw-resize</div>
|
||||||
|
<div className="nwse-resize">nwse-resize</div>
|
||||||
|
<div className="zoom-in">zoom-in</div>
|
||||||
|
<div className="zoom-out">zoom-out</div>
|
||||||
|
<div className="custom">custom</div>
|
||||||
|
</div>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -0,0 +1,50 @@
|
|||||||
|
.filterEntities
|
||||||
|
{
|
||||||
|
margin-left: auto;
|
||||||
|
margin-right: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tree-view__item
|
||||||
|
{
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tree-view__item__text
|
||||||
|
{
|
||||||
|
margin-right: 1em;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
overflow: hidden;
|
||||||
|
white-space: nowrap;
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*li > ul {*/
|
||||||
|
/* margin-left: 10px;*/
|
||||||
|
/*}*/
|
||||||
|
|
||||||
|
.tree-view__item.selected
|
||||||
|
{
|
||||||
|
background-color: var(--tree-view-item-background-color-selected);
|
||||||
|
}
|
||||||
|
|
||||||
|
.tree-view__item:hover
|
||||||
|
{
|
||||||
|
background-color: var(--menu-bar-background-color-hover);
|
||||||
|
}
|
||||||
|
|
||||||
|
.tree-view__item:active
|
||||||
|
{
|
||||||
|
background-color: var(--menu-bar-background-color-click);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.tree-view__item img
|
||||||
|
{
|
||||||
|
/*display: block;*/
|
||||||
|
position: absolute;
|
||||||
|
right: 0;
|
||||||
|
top: 0;
|
||||||
|
width: 1em;
|
||||||
|
height: 1em;
|
||||||
|
filter: invert();
|
||||||
|
}
|
||||||
@@ -0,0 +1,190 @@
|
|||||||
|
import {IDockviewPanelProps} from "dockview";
|
||||||
|
import {MenuBar, MenuItem} from "../Components/Menu.tsx";
|
||||||
|
|
||||||
|
import "./EntityHierarchyWindow.css";
|
||||||
|
import {MouseEventHandler, ReactElement, MouseEvent} from "react";
|
||||||
|
|
||||||
|
import IconVisible from "../assets/Icons/AntDesign/eye-visible.svg";
|
||||||
|
import IconInvisible from "../assets/Icons/AntDesign/eye-invisible.svg";
|
||||||
|
import {Updater, useImmer} from "use-immer";
|
||||||
|
|
||||||
|
import {EngineGlue} from "../EngineGlue";
|
||||||
|
|
||||||
|
type EntityId = number;
|
||||||
|
|
||||||
|
class Entity
|
||||||
|
{
|
||||||
|
name: string;
|
||||||
|
id: EntityId;
|
||||||
|
visible: boolean = true;
|
||||||
|
children: EntityId[];
|
||||||
|
|
||||||
|
constructor(name: string, key: number, children: EntityId[] = [])
|
||||||
|
{
|
||||||
|
this.name = name;
|
||||||
|
this.id = key;
|
||||||
|
this.children = children;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
type EntityMap = {
|
||||||
|
selectedIds: EntityId[];
|
||||||
|
[id: EntityId]: Entity;
|
||||||
|
};
|
||||||
|
|
||||||
|
const entityHierarchy: EntityMap = {
|
||||||
|
selectedIds: [],
|
||||||
|
|
||||||
|
0: new Entity("Entity Root", 0, [1, 4]),
|
||||||
|
1: new Entity("Entity Entity 1", 1, [2, 3]),
|
||||||
|
2: new Entity("Entity Entity 1.1", 2),
|
||||||
|
3: new Entity("Entity Entity 1.2", 3),
|
||||||
|
4: new Entity("Entity Entity 2", 4, [5, 6]),
|
||||||
|
5: new Entity("Entity Entity 2.1", 5),
|
||||||
|
6: new Entity("Entity Entity 2.2", 6, [7]),
|
||||||
|
7: new Entity("Entity Entity 2.2.1", 7, [8, 9]),
|
||||||
|
8: new Entity("Entity Entity 2.2.1.1", 8),
|
||||||
|
9: new Entity("Entity Entity 2.2.1.2", 9)
|
||||||
|
};
|
||||||
|
|
||||||
|
export default function EntityHierarchyWindow(props: IDockviewPanelProps)
|
||||||
|
{
|
||||||
|
const [entities, updateEntities] = useImmer(entityHierarchy);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<MenuBar>
|
||||||
|
<MenuItem text="Create">
|
||||||
|
<MenuItem text="Empty Entity" onClick={window.EngineGlue.onClickCreateEmptyEntity}/>
|
||||||
|
<MenuItem text="Parent Entity">
|
||||||
|
<MenuItem text="Test 1 (lang)">
|
||||||
|
<MenuItem text="Du">
|
||||||
|
<MenuItem text="Übertreibst">
|
||||||
|
<MenuItem text="Völlig"/>
|
||||||
|
<MenuItem text="Du Hund!"/>
|
||||||
|
</MenuItem>
|
||||||
|
</MenuItem>
|
||||||
|
</MenuItem>
|
||||||
|
<MenuItem text="Test 2">
|
||||||
|
<MenuItem text="Ach komm,"/>
|
||||||
|
</MenuItem>
|
||||||
|
<MenuItem text="Test 3">
|
||||||
|
<MenuItem text="Hör auf!"/>
|
||||||
|
</MenuItem>
|
||||||
|
</MenuItem>
|
||||||
|
<MenuItem text="Child Entity"/>
|
||||||
|
</MenuItem>
|
||||||
|
<MenuItem text="Delete">
|
||||||
|
<MenuItem text="Selected"/>
|
||||||
|
<MenuItem text="All"/>
|
||||||
|
</MenuItem>
|
||||||
|
<MenuItem text="Copy">
|
||||||
|
</MenuItem>
|
||||||
|
<input className="filterEntities" placeholder="Filter entities..."/>
|
||||||
|
</MenuBar>
|
||||||
|
<EntityTree items={entities} updateItems={updateEntities}/>
|
||||||
|
<button className="title-bar__button close" onClick={EngineGlue.handleClickCloseWindow}>🗙</button>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
function EntityTreeItem({item, allEntities, updateEntities}: {
|
||||||
|
item: Entity,
|
||||||
|
allEntities: EntityMap, updateEntities: Updater<EntityMap>}) : ReactElement
|
||||||
|
{
|
||||||
|
//const [isOpen, setOpen] = useState(false);
|
||||||
|
|
||||||
|
const isSelected = allEntities.selectedIds.includes(item.id);
|
||||||
|
//const isVisible = allEntities[item.id].visible;
|
||||||
|
|
||||||
|
function handleClick(event: MouseEvent)
|
||||||
|
{
|
||||||
|
console.log("Clicked" + item.name);
|
||||||
|
updateEntities(draft => {
|
||||||
|
if (isSelected)
|
||||||
|
{
|
||||||
|
draft.selectedIds = allEntities.selectedIds.filter((id) => {return id != item.id});
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
draft.selectedIds.push(item.id);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
event.stopPropagation();
|
||||||
|
}
|
||||||
|
|
||||||
|
function toggleVisibility(event: MouseEvent)
|
||||||
|
{
|
||||||
|
event.stopPropagation();
|
||||||
|
|
||||||
|
// updateEntities(draft => {
|
||||||
|
// draft[item.id].visible = !draft[item.id].visible;
|
||||||
|
// });
|
||||||
|
|
||||||
|
//event.stopPropagation();
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<li>
|
||||||
|
<div className={"tree-view__item " + (isSelected ? "selected" : "")} onClick={handleClick}>
|
||||||
|
<div className="tree-view__item__text">
|
||||||
|
{item.name}
|
||||||
|
</div>
|
||||||
|
<VisibilityToggle item={item} onClick={toggleVisibility} updateEntities={updateEntities} />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{
|
||||||
|
item.children.length > 0 &&
|
||||||
|
<ul>
|
||||||
|
{
|
||||||
|
item.children.map((childId) => {
|
||||||
|
const entity: Entity = allEntities[childId];
|
||||||
|
|
||||||
|
if (entity === undefined)
|
||||||
|
return;
|
||||||
|
|
||||||
|
return <EntityTreeItem key={entity.id} item={entity} allEntities={allEntities} updateEntities={updateEntities}/>;
|
||||||
|
})
|
||||||
|
}
|
||||||
|
</ul>
|
||||||
|
}
|
||||||
|
</li>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
function VisibilityToggle({item, onClick, updateEntities} : {item: Entity, onClick: MouseEventHandler, updateEntities: Updater<EntityMap>}) {
|
||||||
|
function clickHandler(event: MouseEvent)
|
||||||
|
{
|
||||||
|
updateEntities(draft => {
|
||||||
|
draft[item.id].visible = !item.visible;
|
||||||
|
});
|
||||||
|
|
||||||
|
console.log("Clickidy" + item.visible);
|
||||||
|
|
||||||
|
onClick(event);
|
||||||
|
|
||||||
|
event.stopPropagation();
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div onClick={clickHandler}>
|
||||||
|
<img src={item.visible ? IconVisible : IconInvisible} />
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
function EntityTree({items, updateItems}: { items: EntityMap, updateItems: Updater<EntityMap> })
|
||||||
|
{
|
||||||
|
return (
|
||||||
|
<ul className="tree-view">
|
||||||
|
{
|
||||||
|
items[0].children.map((childId) => {
|
||||||
|
const entity: Entity = items[childId];
|
||||||
|
|
||||||
|
return <EntityTreeItem key={entity.id} item={entity} allEntities={items} updateEntities={updateItems} />;
|
||||||
|
})
|
||||||
|
}
|
||||||
|
</ul>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -0,0 +1,87 @@
|
|||||||
|
.jep
|
||||||
|
{
|
||||||
|
display: grid;
|
||||||
|
grid-template-rows: min-content 1fr;
|
||||||
|
grid-template-areas:
|
||||||
|
"titlebar"
|
||||||
|
"dock";
|
||||||
|
|
||||||
|
width: 100vw;
|
||||||
|
height: 100vh;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dock
|
||||||
|
{
|
||||||
|
grid-area: dock;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.title-bar
|
||||||
|
{
|
||||||
|
grid-area: titlebar;
|
||||||
|
|
||||||
|
background-color: var(--menu-bar-background-color);
|
||||||
|
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: auto 1fr;
|
||||||
|
grid-template-rows: 1fr 1fr;
|
||||||
|
grid-template-areas:
|
||||||
|
"icon title"
|
||||||
|
"icon menubar";
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.title-bar__icon
|
||||||
|
{
|
||||||
|
grid-area: icon;
|
||||||
|
|
||||||
|
aspect-ratio : 1 / 1;
|
||||||
|
height: 100%;
|
||||||
|
|
||||||
|
/*height: 2em;*/
|
||||||
|
/*width: 2em;*/
|
||||||
|
|
||||||
|
background-image: url(/src/assets/GlitchyEngineTransparent.png);
|
||||||
|
background-size: contain;
|
||||||
|
mask: radial-gradient(white 65%, transparent 75%);
|
||||||
|
|
||||||
|
margin-right: 0.5em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.title-bar__title
|
||||||
|
{
|
||||||
|
display: flex;
|
||||||
|
grid-area: title;
|
||||||
|
height: 3em;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.engine-name
|
||||||
|
{
|
||||||
|
font-weight: bold;
|
||||||
|
margin-right: 1em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.title-bar__button
|
||||||
|
{
|
||||||
|
grid-area: title;
|
||||||
|
height: 100%;
|
||||||
|
width: 47px;
|
||||||
|
background-color: transparent;
|
||||||
|
border: none;
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
.title-bar__button:hover
|
||||||
|
{
|
||||||
|
background-color: gray;
|
||||||
|
}
|
||||||
|
|
||||||
|
.title-bar__button.minimize
|
||||||
|
{
|
||||||
|
margin-left: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.title-bar__button.close:hover
|
||||||
|
{
|
||||||
|
background-color: red;
|
||||||
|
}
|
||||||
@@ -0,0 +1,100 @@
|
|||||||
|
import "./MainWindow.css"
|
||||||
|
import Dock from "../Components/Dock.tsx";
|
||||||
|
import {MenuBar, MenuDivider, MenuItem} from "../Components/Menu.tsx";
|
||||||
|
import {ReactElement, useEffect, useRef} from "react";
|
||||||
|
import '../EngineGlue.ts'
|
||||||
|
import {EngineGlue} from "../EngineGlue.ts";
|
||||||
|
|
||||||
|
//something = 'testing';
|
||||||
|
|
||||||
|
export default function MainWindow() {
|
||||||
|
const projectName = "Mein Geiles Projekt";
|
||||||
|
const fileName = "DefaultScene.scene";
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="jep">
|
||||||
|
<TitleBar projectName={projectName} fileName={fileName}/>
|
||||||
|
<Dock/>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
function TitleBar({ projectName, fileName } : {projectName: string, fileName: string}): ReactElement
|
||||||
|
{
|
||||||
|
return (
|
||||||
|
<div className="title-bar">
|
||||||
|
<div className="title-bar__icon"/>
|
||||||
|
<div className="title-bar__title"
|
||||||
|
onMouseEnter={() => EngineGlue.handleHoverNonClientArea(true)}
|
||||||
|
onMouseLeave={() => EngineGlue.handleHoverNonClientArea(false)}>
|
||||||
|
<div>
|
||||||
|
<span className="engine-name">Glitchy Engine</span> {projectName} - {fileName}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<button className="title-bar__button minimize"
|
||||||
|
onClick={() => EngineGlue.handleClickMinimizeWindow()}
|
||||||
|
onMouseOver={() => EngineGlue.handleHoverMinimizeWindow(true)}
|
||||||
|
onMouseLeave={() => EngineGlue.handleHoverMinimizeWindow(false)}>🗕</button>
|
||||||
|
<button className="title-bar__button maximize"
|
||||||
|
onClick={() => EngineGlue.handleClickMaximizeWindow()}
|
||||||
|
onMouseOver={() => EngineGlue.handleHoverMaximizeWindow(true)}
|
||||||
|
onMouseLeave={() => EngineGlue.handleHoverMaximizeWindow(false)}>🗖</button>
|
||||||
|
<button className="title-bar__button close"
|
||||||
|
onClick={() => EngineGlue.handleClickCloseWindow()}
|
||||||
|
onMouseOver={() => EngineGlue.handleHoverCloseWindow(true)}
|
||||||
|
onMouseLeave={() => EngineGlue.handleHoverCloseWindow(false)}>🗙</button>
|
||||||
|
</div>
|
||||||
|
<MainMenuBar/>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
function MainMenuBar(): ReactElement
|
||||||
|
{
|
||||||
|
return (
|
||||||
|
<MenuBar>
|
||||||
|
<MenuItem text="File" onClick={() => {
|
||||||
|
console.log("Test")
|
||||||
|
}}>
|
||||||
|
<MenuItem text="New Scene..." hotkey="Ctrl + N"/>
|
||||||
|
<MenuItem text="Open Scene..." hotkey="Ctrl + O"/>
|
||||||
|
<MenuItem text="Open recent Scene">
|
||||||
|
<MenuItem text="1. Bli"/>
|
||||||
|
<MenuItem text="2. Bla"/>
|
||||||
|
<MenuItem text="3. Blub"/>
|
||||||
|
</MenuItem>
|
||||||
|
<MenuDivider/>
|
||||||
|
<MenuItem text="Save Scene" hotkey="Ctrl + S"/>
|
||||||
|
<MenuItem text="Save Scene as..." hotkey="Ctrl + Shift + S"/>
|
||||||
|
<MenuDivider/>
|
||||||
|
<MenuItem text="Create new Project..."/>
|
||||||
|
<MenuItem text="Open Project..."/>
|
||||||
|
<MenuItem text="Open recent Project">
|
||||||
|
<MenuItem text="1. Bli"/>
|
||||||
|
<MenuItem text="2. Bla"/>
|
||||||
|
<MenuItem text="3. Blub"/>
|
||||||
|
</MenuItem>
|
||||||
|
<MenuDivider/>
|
||||||
|
<MenuItem text="Settings..."/>
|
||||||
|
<MenuDivider/>
|
||||||
|
<MenuItem text="Exit" onClick={EngineGlue.handleClickCloseWindow} />
|
||||||
|
</MenuItem>
|
||||||
|
<MenuItem text="View">
|
||||||
|
<MenuItem text="Asset Browser"/>
|
||||||
|
<MenuItem text="Scene"/>
|
||||||
|
<MenuItem text="Entity Hierarchy"/>
|
||||||
|
<MenuItem text="Game"/>
|
||||||
|
<MenuItem text="Inspector"/>
|
||||||
|
<MenuItem text="Asset Viewer"/>
|
||||||
|
<MenuItem text="Log"/>
|
||||||
|
</MenuItem>
|
||||||
|
<MenuItem text="Tools">
|
||||||
|
<MenuItem text="Reload Script"/>
|
||||||
|
<label>
|
||||||
|
<input type="checkbox"/>
|
||||||
|
Show ImGui Demo
|
||||||
|
</label>
|
||||||
|
</MenuItem>
|
||||||
|
</MenuBar>
|
||||||
|
);
|
||||||
|
}
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 4.2 KiB |
@@ -0,0 +1,5 @@
|
|||||||
|
<?xml version="1.0" standalone="no"?>
|
||||||
|
<!-- Uploaded to: SVG Repo, www.svgrepo.com, Generator: SVG Repo Mixer Tools -->
|
||||||
|
<svg fill="#000000" width="800px" height="800px" viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" class="icon">
|
||||||
|
<path d="M942.2 486.2Q889.47 375.11 816.7 305l-50.88 50.88C807.31 395.53 843.45 447.4 874.7 512 791.5 684.2 673.4 766 512 766q-72.67 0-133.87-22.38L323 798.75Q408 838 512 838q288.3 0 430.2-300.3a60.29 60.29 0 0 0 0-51.5zm-63.57-320.64L836 122.88a8 8 0 0 0-11.32 0L715.31 232.2Q624.86 186 512 186q-288.3 0-430.2 300.3a60.3 60.3 0 0 0 0 51.5q56.69 119.4 136.5 191.41L112.48 835a8 8 0 0 0 0 11.31L155.17 889a8 8 0 0 0 11.31 0l712.15-712.12a8 8 0 0 0 0-11.32zM149.3 512C232.6 339.8 350.7 258 512 258c54.54 0 104.13 9.36 149.12 28.39l-70.3 70.3a176 176 0 0 0-238.13 238.13l-83.42 83.42C223.1 637.49 183.3 582.28 149.3 512zm246.7 0a112.11 112.11 0 0 1 146.2-106.69L401.31 546.2A112 112 0 0 1 396 512z"/><path d="M508 624c-3.46 0-6.87-.16-10.25-.47l-52.82 52.82a176.09 176.09 0 0 0 227.42-227.42l-52.82 52.82c.31 3.38.47 6.79.47 10.25a111.94 111.94 0 0 1-112 112z"/>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 1.1 KiB |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,92 @@
|
|||||||
|
Copyright (c) 2016 The Inter Project Authors (https://github.com/rsms/inter)
|
||||||
|
|
||||||
|
This Font Software is licensed under the SIL Open Font License, Version 1.1.
|
||||||
|
This license is copied below, and is also available with a FAQ at:
|
||||||
|
http://scripts.sil.org/OFL
|
||||||
|
|
||||||
|
-----------------------------------------------------------
|
||||||
|
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
|
||||||
|
-----------------------------------------------------------
|
||||||
|
|
||||||
|
PREAMBLE
|
||||||
|
The goals of the Open Font License (OFL) are to stimulate worldwide
|
||||||
|
development of collaborative font projects, to support the font creation
|
||||||
|
efforts of academic and linguistic communities, and to provide a free and
|
||||||
|
open framework in which fonts may be shared and improved in partnership
|
||||||
|
with others.
|
||||||
|
|
||||||
|
The OFL allows the licensed fonts to be used, studied, modified and
|
||||||
|
redistributed freely as long as they are not sold by themselves. The
|
||||||
|
fonts, including any derivative works, can be bundled, embedded,
|
||||||
|
redistributed and/or sold with any software provided that any reserved
|
||||||
|
names are not used by derivative works. The fonts and derivatives,
|
||||||
|
however, cannot be released under any other type of license. The
|
||||||
|
requirement for fonts to remain under this license does not apply
|
||||||
|
to any document created using the fonts or their derivatives.
|
||||||
|
|
||||||
|
DEFINITIONS
|
||||||
|
"Font Software" refers to the set of files released by the Copyright
|
||||||
|
Holder(s) under this license and clearly marked as such. This may
|
||||||
|
include source files, build scripts and documentation.
|
||||||
|
|
||||||
|
"Reserved Font Name" refers to any names specified as such after the
|
||||||
|
copyright statement(s).
|
||||||
|
|
||||||
|
"Original Version" refers to the collection of Font Software components as
|
||||||
|
distributed by the Copyright Holder(s).
|
||||||
|
|
||||||
|
"Modified Version" refers to any derivative made by adding to, deleting,
|
||||||
|
or substituting -- in part or in whole -- any of the components of the
|
||||||
|
Original Version, by changing formats or by porting the Font Software to a
|
||||||
|
new environment.
|
||||||
|
|
||||||
|
"Author" refers to any designer, engineer, programmer, technical
|
||||||
|
writer or other person who contributed to the Font Software.
|
||||||
|
|
||||||
|
PERMISSION AND CONDITIONS
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
a copy of the Font Software, to use, study, copy, merge, embed, modify,
|
||||||
|
redistribute, and sell modified and unmodified copies of the Font
|
||||||
|
Software, subject to the following conditions:
|
||||||
|
|
||||||
|
1) Neither the Font Software nor any of its individual components,
|
||||||
|
in Original or Modified Versions, may be sold by itself.
|
||||||
|
|
||||||
|
2) Original or Modified Versions of the Font Software may be bundled,
|
||||||
|
redistributed and/or sold with any software, provided that each copy
|
||||||
|
contains the above copyright notice and this license. These can be
|
||||||
|
included either as stand-alone text files, human-readable headers or
|
||||||
|
in the appropriate machine-readable metadata fields within text or
|
||||||
|
binary files as long as those fields can be easily viewed by the user.
|
||||||
|
|
||||||
|
3) No Modified Version of the Font Software may use the Reserved Font
|
||||||
|
Name(s) unless explicit written permission is granted by the corresponding
|
||||||
|
Copyright Holder. This restriction only applies to the primary font name as
|
||||||
|
presented to the users.
|
||||||
|
|
||||||
|
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
|
||||||
|
Software shall not be used to promote, endorse or advertise any
|
||||||
|
Modified Version, except to acknowledge the contribution(s) of the
|
||||||
|
Copyright Holder(s) and the Author(s) or with their explicit written
|
||||||
|
permission.
|
||||||
|
|
||||||
|
5) The Font Software, modified or unmodified, in part or in whole,
|
||||||
|
must be distributed entirely under this license, and must not be
|
||||||
|
distributed under any other license. The requirement for fonts to
|
||||||
|
remain under this license does not apply to any document created
|
||||||
|
using the Font Software.
|
||||||
|
|
||||||
|
TERMINATION
|
||||||
|
This license becomes null and void if any of the above conditions are
|
||||||
|
not met.
|
||||||
|
|
||||||
|
DISCLAIMER
|
||||||
|
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
|
||||||
|
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
|
||||||
|
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
|
||||||
|
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||||
|
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
|
||||||
|
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||||
|
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
|
||||||
|
OTHER DEALINGS IN THE FONT SOFTWARE.
|
||||||
@@ -0,0 +1,57 @@
|
|||||||
|
/* Variable fonts usage:
|
||||||
|
:root { font-family: "Inter", sans-serif; }
|
||||||
|
@supports (font-variation-settings: normal) {
|
||||||
|
:root { font-family: "InterVariable", sans-serif; font-optical-sizing: auto; }
|
||||||
|
} */
|
||||||
|
@font-face {
|
||||||
|
font-family: InterVariable;
|
||||||
|
font-style: normal;
|
||||||
|
font-weight: 100 900;
|
||||||
|
font-display: swap;
|
||||||
|
src: url("InterVariable.woff2") format("woff2");
|
||||||
|
}
|
||||||
|
@font-face {
|
||||||
|
font-family: InterVariable;
|
||||||
|
font-style: italic;
|
||||||
|
font-weight: 100 900;
|
||||||
|
font-display: swap;
|
||||||
|
src: url("InterVariable-Italic.woff2") format("woff2");
|
||||||
|
}
|
||||||
|
|
||||||
|
/* static fonts */
|
||||||
|
@font-face { font-family: "Inter"; font-style: normal; font-weight: 100; font-display: swap; src: url("Inter-Thin.woff2") format("woff2"); }
|
||||||
|
@font-face { font-family: "Inter"; font-style: italic; font-weight: 100; font-display: swap; src: url("Inter-ThinItalic.woff2") format("woff2"); }
|
||||||
|
@font-face { font-family: "Inter"; font-style: normal; font-weight: 200; font-display: swap; src: url("Inter-ExtraLight.woff2") format("woff2"); }
|
||||||
|
@font-face { font-family: "Inter"; font-style: italic; font-weight: 200; font-display: swap; src: url("Inter-ExtraLightItalic.woff2") format("woff2"); }
|
||||||
|
@font-face { font-family: "Inter"; font-style: normal; font-weight: 300; font-display: swap; src: url("Inter-Light.woff2") format("woff2"); }
|
||||||
|
@font-face { font-family: "Inter"; font-style: italic; font-weight: 300; font-display: swap; src: url("Inter-LightItalic.woff2") format("woff2"); }
|
||||||
|
@font-face { font-family: "Inter"; font-style: normal; font-weight: 400; font-display: swap; src: url("Inter-Regular.woff2") format("woff2"); }
|
||||||
|
@font-face { font-family: "Inter"; font-style: italic; font-weight: 400; font-display: swap; src: url("Inter-Italic.woff2") format("woff2"); }
|
||||||
|
@font-face { font-family: "Inter"; font-style: normal; font-weight: 500; font-display: swap; src: url("Inter-Medium.woff2") format("woff2"); }
|
||||||
|
@font-face { font-family: "Inter"; font-style: italic; font-weight: 500; font-display: swap; src: url("Inter-MediumItalic.woff2") format("woff2"); }
|
||||||
|
@font-face { font-family: "Inter"; font-style: normal; font-weight: 600; font-display: swap; src: url("Inter-SemiBold.woff2") format("woff2"); }
|
||||||
|
@font-face { font-family: "Inter"; font-style: italic; font-weight: 600; font-display: swap; src: url("Inter-SemiBoldItalic.woff2") format("woff2"); }
|
||||||
|
@font-face { font-family: "Inter"; font-style: normal; font-weight: 700; font-display: swap; src: url("Inter-Bold.woff2") format("woff2"); }
|
||||||
|
@font-face { font-family: "Inter"; font-style: italic; font-weight: 700; font-display: swap; src: url("Inter-BoldItalic.woff2") format("woff2"); }
|
||||||
|
@font-face { font-family: "Inter"; font-style: normal; font-weight: 800; font-display: swap; src: url("Inter-ExtraBold.woff2") format("woff2"); }
|
||||||
|
@font-face { font-family: "Inter"; font-style: italic; font-weight: 800; font-display: swap; src: url("Inter-ExtraBoldItalic.woff2") format("woff2"); }
|
||||||
|
@font-face { font-family: "Inter"; font-style: normal; font-weight: 900; font-display: swap; src: url("Inter-Black.woff2") format("woff2"); }
|
||||||
|
@font-face { font-family: "Inter"; font-style: italic; font-weight: 900; font-display: swap; src: url("Inter-BlackItalic.woff2") format("woff2"); }
|
||||||
|
@font-face { font-family: "InterDisplay"; font-style: normal; font-weight: 100; font-display: swap; src: url("InterDisplay-Thin.woff2") format("woff2"); }
|
||||||
|
@font-face { font-family: "InterDisplay"; font-style: italic; font-weight: 100; font-display: swap; src: url("InterDisplay-ThinItalic.woff2") format("woff2"); }
|
||||||
|
@font-face { font-family: "InterDisplay"; font-style: normal; font-weight: 200; font-display: swap; src: url("InterDisplay-ExtraLight.woff2") format("woff2"); }
|
||||||
|
@font-face { font-family: "InterDisplay"; font-style: italic; font-weight: 200; font-display: swap; src: url("InterDisplay-ExtraLightItalic.woff2") format("woff2"); }
|
||||||
|
@font-face { font-family: "InterDisplay"; font-style: normal; font-weight: 300; font-display: swap; src: url("InterDisplay-Light.woff2") format("woff2"); }
|
||||||
|
@font-face { font-family: "InterDisplay"; font-style: italic; font-weight: 300; font-display: swap; src: url("InterDisplay-LightItalic.woff2") format("woff2"); }
|
||||||
|
@font-face { font-family: "InterDisplay"; font-style: normal; font-weight: 400; font-display: swap; src: url("InterDisplay-Regular.woff2") format("woff2"); }
|
||||||
|
@font-face { font-family: "InterDisplay"; font-style: italic; font-weight: 400; font-display: swap; src: url("InterDisplay-Italic.woff2") format("woff2"); }
|
||||||
|
@font-face { font-family: "InterDisplay"; font-style: normal; font-weight: 500; font-display: swap; src: url("InterDisplay-Medium.woff2") format("woff2"); }
|
||||||
|
@font-face { font-family: "InterDisplay"; font-style: italic; font-weight: 500; font-display: swap; src: url("InterDisplay-MediumItalic.woff2") format("woff2"); }
|
||||||
|
@font-face { font-family: "InterDisplay"; font-style: normal; font-weight: 600; font-display: swap; src: url("InterDisplay-SemiBold.woff2") format("woff2"); }
|
||||||
|
@font-face { font-family: "InterDisplay"; font-style: italic; font-weight: 600; font-display: swap; src: url("InterDisplay-SemiBoldItalic.woff2") format("woff2"); }
|
||||||
|
@font-face { font-family: "InterDisplay"; font-style: normal; font-weight: 700; font-display: swap; src: url("InterDisplay-Bold.woff2") format("woff2"); }
|
||||||
|
@font-face { font-family: "InterDisplay"; font-style: italic; font-weight: 700; font-display: swap; src: url("InterDisplay-BoldItalic.woff2") format("woff2"); }
|
||||||
|
@font-face { font-family: "InterDisplay"; font-style: normal; font-weight: 800; font-display: swap; src: url("InterDisplay-ExtraBold.woff2") format("woff2"); }
|
||||||
|
@font-face { font-family: "InterDisplay"; font-style: italic; font-weight: 800; font-display: swap; src: url("InterDisplay-ExtraBoldItalic.woff2") format("woff2"); }
|
||||||
|
@font-face { font-family: "InterDisplay"; font-style: normal; font-weight: 900; font-display: swap; src: url("InterDisplay-Black.woff2") format("woff2"); }
|
||||||
|
@font-face { font-family: "InterDisplay"; font-style: italic; font-weight: 900; font-display: swap; src: url("InterDisplay-BlackItalic.woff2") format("woff2"); }
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 4.7 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 1.2 KiB |
@@ -0,0 +1,5 @@
|
|||||||
|
<?xml version="1.0" standalone="no"?>
|
||||||
|
<!-- Uploaded to: SVG Repo, www.svgrepo.com, Generator: SVG Repo Mixer Tools -->
|
||||||
|
<svg fill="#000000" width="800px" height="800px" viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" class="icon">
|
||||||
|
<path d="M942.2 486.2Q889.47 375.11 816.7 305l-50.88 50.88C807.31 395.53 843.45 447.4 874.7 512 791.5 684.2 673.4 766 512 766q-72.67 0-133.87-22.38L323 798.75Q408 838 512 838q288.3 0 430.2-300.3a60.29 60.29 0 0 0 0-51.5zm-63.57-320.64L836 122.88a8 8 0 0 0-11.32 0L715.31 232.2Q624.86 186 512 186q-288.3 0-430.2 300.3a60.3 60.3 0 0 0 0 51.5q56.69 119.4 136.5 191.41L112.48 835a8 8 0 0 0 0 11.31L155.17 889a8 8 0 0 0 11.31 0l712.15-712.12a8 8 0 0 0 0-11.32zM149.3 512C232.6 339.8 350.7 258 512 258c54.54 0 104.13 9.36 149.12 28.39l-70.3 70.3a176 176 0 0 0-238.13 238.13l-83.42 83.42C223.1 637.49 183.3 582.28 149.3 512zm246.7 0a112.11 112.11 0 0 1 146.2-106.69L401.31 546.2A112 112 0 0 1 396 512z"/><path d="M508 624c-3.46 0-6.87-.16-10.25-.47l-52.82 52.82a176.09 176.09 0 0 0 227.42-227.42l-52.82 52.82c.31 3.38.47 6.79.47 10.25a111.94 111.94 0 0 1-112 112z"/>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 1.1 KiB |
@@ -0,0 +1,5 @@
|
|||||||
|
<?xml version="1.0" standalone="no"?>
|
||||||
|
<!-- Uploaded to: SVG Repo, www.svgrepo.com, Generator: SVG Repo Mixer Tools -->
|
||||||
|
<svg fill="#000000" width="800px" height="800px" viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" class="icon">
|
||||||
|
<path d="M942.2 486.2C847.4 286.5 704.1 186 512 186c-192.2 0-335.4 100.5-430.2 300.3a60.3 60.3 0 0 0 0 51.5C176.6 737.5 319.9 838 512 838c192.2 0 335.4-100.5 430.2-300.3 7.7-16.2 7.7-35 0-51.5zM512 766c-161.3 0-279.4-81.8-362.7-254C232.6 339.8 350.7 258 512 258c161.3 0 279.4 81.8 362.7 254C791.5 684.2 673.4 766 512 766zm-4-430c-97.2 0-176 78.8-176 176s78.8 176 176 176 176-78.8 176-176-78.8-176-176-176zm0 288c-61.9 0-112-50.1-112-112s50.1-112 112-112 112 50.1 112 112-50.1 112-112 112z"/>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 741 B |
@@ -0,0 +1,51 @@
|
|||||||
|
@import "assets/Fonts/Inter/inter.css";
|
||||||
|
@import '../node_modules/dockview-react/dist/styles/dockview.css';
|
||||||
|
|
||||||
|
*
|
||||||
|
{
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
user-select: none;
|
||||||
|
-webkit-user-select: none;
|
||||||
|
/*cursor: default;*/
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Fix indentation of nested lists */
|
||||||
|
ul, ol {
|
||||||
|
padding-inline-start: 40px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Variable Declaration for themes */
|
||||||
|
:root
|
||||||
|
{
|
||||||
|
--font-color-primary: white;
|
||||||
|
/* Menu Bar */
|
||||||
|
--menu-bar-background-color: #404040;
|
||||||
|
--menu-bar-background-color-hover: #808080;
|
||||||
|
--menu-bar-background-color-click: #606060;
|
||||||
|
--menu-bar-hotkey-color: #A0A0A0;
|
||||||
|
|
||||||
|
--tree-view-item-background-color-selected: #323275;
|
||||||
|
|
||||||
|
--small-transition-duration: 0.1s;
|
||||||
|
}
|
||||||
|
|
||||||
|
:root
|
||||||
|
{
|
||||||
|
font-family: "Inter", sans-serif;
|
||||||
|
|
||||||
|
/* Disable selection by default. But for some reason webkit does it differently than chorme...*/
|
||||||
|
user-select: none;
|
||||||
|
-webkit-user-select: none;
|
||||||
|
cursor: default;
|
||||||
|
|
||||||
|
color: var(--font-color-primary);
|
||||||
|
}
|
||||||
|
|
||||||
|
@supports (font-variation-settings: normal)
|
||||||
|
{
|
||||||
|
:root
|
||||||
|
{
|
||||||
|
font-family: "InterVariable", sans-serif; font-optical-sizing: auto;
|
||||||
|
}
|
||||||
|
}
|
||||||
+4
@@ -1,7 +1,11 @@
|
|||||||
import { StrictMode } from 'react'
|
import { StrictMode } from 'react'
|
||||||
import { createRoot } from 'react-dom/client'
|
import { createRoot } from 'react-dom/client'
|
||||||
import App from './App.tsx'
|
import App from './App.tsx'
|
||||||
|
import './assets/Fonts/Inter/inter.css'
|
||||||
import './index.css'
|
import './index.css'
|
||||||
|
import 'dockview/dist/styles/dockview.css';
|
||||||
|
|
||||||
|
// Ultralight 1.4 = Safari 16.4.1 / WebKit 615.1.18.100.1 (March 2023)
|
||||||
|
|
||||||
createRoot(document.getElementById('root')!).render(
|
createRoot(document.getElementById('root')!).render(
|
||||||
<StrictMode>
|
<StrictMode>
|
||||||
+3
-3
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"target": "ES6",
|
"target": "ES2020",
|
||||||
"useDefineForClassFields": true,
|
"useDefineForClassFields": true,
|
||||||
"lib": ["ES2020", "DOM", "DOM.Iterable"],
|
"lib": ["ES2020", "DOM", "DOM.Iterable"],
|
||||||
"module": "ESNext",
|
"module": "ESNext",
|
||||||
@@ -16,8 +16,8 @@
|
|||||||
|
|
||||||
/* Linting */
|
/* Linting */
|
||||||
"strict": true,
|
"strict": true,
|
||||||
"noUnusedLocals": true,
|
"noUnusedLocals": false,
|
||||||
"noUnusedParameters": true,
|
"noUnusedParameters": false,
|
||||||
"noFallthroughCasesInSwitch": true
|
"noFallthroughCasesInSwitch": true
|
||||||
},
|
},
|
||||||
"include": ["src"]
|
"include": ["src"]
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"files": [],
|
||||||
|
"references": [
|
||||||
|
{ "path": "./tsconfig.app.json" },
|
||||||
|
{ "path": "./tsconfig.node.json" }
|
||||||
|
]
|
||||||
|
}
|
||||||
+3
-3
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"target": "ES6",
|
"target": "ES2022",
|
||||||
"lib": ["ES2023"],
|
"lib": ["ES2023"],
|
||||||
"module": "ESNext",
|
"module": "ESNext",
|
||||||
"skipLibCheck": true,
|
"skipLibCheck": true,
|
||||||
@@ -14,8 +14,8 @@
|
|||||||
|
|
||||||
/* Linting */
|
/* Linting */
|
||||||
"strict": true,
|
"strict": true,
|
||||||
"noUnusedLocals": true,
|
"noUnusedLocals": false,
|
||||||
"noUnusedParameters": true,
|
"noUnusedParameters": false,
|
||||||
"noFallthroughCasesInSwitch": true
|
"noFallthroughCasesInSwitch": true
|
||||||
},
|
},
|
||||||
"include": ["vite.config.ts"]
|
"include": ["vite.config.ts"]
|
||||||
+7
-6
@@ -4,12 +4,13 @@ import react from '@vitejs/plugin-react'
|
|||||||
// https://vitejs.dev/config/
|
// https://vitejs.dev/config/
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
plugins: [react()],
|
plugins: [react()],
|
||||||
base: './',
|
base: "./",
|
||||||
build: {
|
build:
|
||||||
target: 'es6', // Ändere dies bei Bedarf auf 'es5'
|
{
|
||||||
rollupOptions: {
|
target: "es2015",
|
||||||
output: {
|
terserOptions: {
|
||||||
format: 'es'
|
mangle: {
|
||||||
|
reserved: ['EngineGlue']
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,87 +0,0 @@
|
|||||||
<html>
|
|
||||||
<head>
|
|
||||||
<style type="text/css">
|
|
||||||
body {
|
|
||||||
background: linear-gradient(0deg, #6a11ea, #7270ed);
|
|
||||||
color: #e8e2fd;
|
|
||||||
font-family: -apple-system, 'Segoe UI Light', Ubuntu, Arial, sans-serif;
|
|
||||||
font-weight: 200;
|
|
||||||
padding: 0;
|
|
||||||
overflow: hidden;
|
|
||||||
}
|
|
||||||
#msg, #btn {
|
|
||||||
text-align: center;
|
|
||||||
margin: 0;
|
|
||||||
position: absolute;
|
|
||||||
top: 50%;
|
|
||||||
left: 50%;
|
|
||||||
transform: translate(-50%, -50%);
|
|
||||||
padding: 0;
|
|
||||||
}
|
|
||||||
#msg {
|
|
||||||
font-size: 54px;
|
|
||||||
width: 85%;
|
|
||||||
}
|
|
||||||
#btn {
|
|
||||||
width: 60%;
|
|
||||||
}
|
|
||||||
button {
|
|
||||||
background: linear-gradient(0deg, #6a11ea, #7270ed);
|
|
||||||
color: #e8e2fd;
|
|
||||||
border-radius: 60px;
|
|
||||||
border: none;
|
|
||||||
font-size: 36px;
|
|
||||||
padding: 0.3em;
|
|
||||||
height: 2em;
|
|
||||||
box-shadow: 6px 6px #4814b5;
|
|
||||||
border: 1px solid #4814b5;
|
|
||||||
font-family: -apple-system, 'Segoe UI Light', Ubuntu, Arial, sans-serif;
|
|
||||||
}
|
|
||||||
button:active {
|
|
||||||
box-shadow: none;
|
|
||||||
margin-left: 6px;
|
|
||||||
margin-top: 6px;
|
|
||||||
background: linear-gradient(0deg, #7270ed, #6a11ea);
|
|
||||||
}
|
|
||||||
button:hover {
|
|
||||||
box-shadow: none;
|
|
||||||
margin-left: 6px;
|
|
||||||
margin-top: 6px;
|
|
||||||
background: linear-gradient(0deg, #7d2eea, #908ee8);
|
|
||||||
}
|
|
||||||
#msg {
|
|
||||||
visibility: hidden;
|
|
||||||
opacity: 0;
|
|
||||||
top: 10%;
|
|
||||||
}
|
|
||||||
.transition #btn {
|
|
||||||
visibility: hidden;
|
|
||||||
opacity: 0;
|
|
||||||
top: 90%;
|
|
||||||
transition: visibility 0s 0.3s, opacity 0.3s linear, top 0.3s linear;
|
|
||||||
}
|
|
||||||
.transition #msg {
|
|
||||||
visibility: visible;
|
|
||||||
opacity: 1;
|
|
||||||
top: 50%;
|
|
||||||
transition: opacity 0.3s linear, top 0.3s linear;
|
|
||||||
transition-delay: 0.1s;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
<script type="text/javascript">
|
|
||||||
function $(id) {
|
|
||||||
return document.getElementById(id);
|
|
||||||
}
|
|
||||||
|
|
||||||
function HandleClick() {
|
|
||||||
document.body.classList.add('transition');
|
|
||||||
$('msg').innerHTML = GetMessage();
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<div id="msg"></div>
|
|
||||||
<button id="btn" onclick="HandleClick();">Click Me!</button>
|
|
||||||
<input type="text" id="testInput" value="Hello World!"></input>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
@@ -1,38 +0,0 @@
|
|||||||
<html>
|
|
||||||
<head>
|
|
||||||
<style type="text/css">
|
|
||||||
body {
|
|
||||||
margin: 0;
|
|
||||||
padding: 0;
|
|
||||||
overflow: hidden;
|
|
||||||
color: white;
|
|
||||||
font-family: -apple-system, 'Segoe UI', 'Roboto', 'Ubuntu', 'Arial', sans-serif;
|
|
||||||
background: linear-gradient(45deg, #4e95ff, #6032e4, #c478ff);
|
|
||||||
}
|
|
||||||
|
|
||||||
div {
|
|
||||||
width: 350px;
|
|
||||||
text-align: center;
|
|
||||||
border-radius: 5px;
|
|
||||||
background: linear-gradient(45deg, #61a0ff, #6737e9, #cb86ff);
|
|
||||||
}
|
|
||||||
|
|
||||||
body, div {
|
|
||||||
display: flex;
|
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
h1 {
|
|
||||||
padding: 1em;
|
|
||||||
font-size: 24px;
|
|
||||||
font-weight: normal;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<div>
|
|
||||||
<h1>Hello Ultralight!<br>Hello <b>Glitchy Engine!</b></h1>
|
|
||||||
</div>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
-5
@@ -1,5 +0,0 @@
|
|||||||
# Default ignored files
|
|
||||||
/shelf/
|
|
||||||
/workspace.xml
|
|
||||||
# Editor-based HTTP Client requests
|
|
||||||
/httpRequests/
|
|
||||||
-4
@@ -1,4 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="Encoding" addBOMForNewFiles="with BOM under Windows, with no BOM otherwise" />
|
|
||||||
</project>
|
|
||||||
-8
@@ -1,8 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="ProjectModuleManager">
|
|
||||||
<modules>
|
|
||||||
<module fileurl="file://$PROJECT_DIR$/.idea/pages.iml" filepath="$PROJECT_DIR$/.idea/pages.iml" />
|
|
||||||
</modules>
|
|
||||||
</component>
|
|
||||||
</project>
|
|
||||||
-12
@@ -1,12 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<module type="WEB_MODULE" version="4">
|
|
||||||
<component name="NewModuleRootManager">
|
|
||||||
<content url="file://$MODULE_DIR$">
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/.tmp" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/temp" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/tmp" />
|
|
||||||
</content>
|
|
||||||
<orderEntry type="inheritedJdk" />
|
|
||||||
<orderEntry type="sourceFolder" forTests="false" />
|
|
||||||
</component>
|
|
||||||
</module>
|
|
||||||
Generated
-6
@@ -1,6 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="VcsDirectoryMappings">
|
|
||||||
<mapping directory="$PROJECT_DIR$/../../.." vcs="Git" />
|
|
||||||
</component>
|
|
||||||
</project>
|
|
||||||
-16
@@ -1,16 +0,0 @@
|
|||||||
{
|
|
||||||
// Use IntelliSense to learn about possible attributes.
|
|
||||||
// Hover to view descriptions of existing attributes.
|
|
||||||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
|
||||||
"version": "0.2.0",
|
|
||||||
"configurations": [
|
|
||||||
{
|
|
||||||
"type": "chrome",
|
|
||||||
"request": "launch",
|
|
||||||
"name": "Open EntityHierarchy.html",
|
|
||||||
"file": "d:\\Development\\Projects\\Beef\\GlitchyEngine\\GlitchyEditor\\assets\\pages\\EntityHierarchy.html",
|
|
||||||
// Configure location of browser:
|
|
||||||
"runtimeExecutable": "C:\\Users\\Simon\\AppData\\Local\\Chromium\\Application\\chrome.exe",
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
{
|
|
||||||
// Mainly for static files
|
|
||||||
"liveServer.settings.useWebExt": true,
|
|
||||||
|
|
||||||
// This means that you change your real URL (current PHP url)
|
|
||||||
// to another URL (which Live Sever starts).
|
|
||||||
"liveServer.settings.proxy": {
|
|
||||||
"enable": true, // i. enabled
|
|
||||||
"baseUri": "/", // ii. workspace
|
|
||||||
"proxyUri": "http://localhost:80/workspace" // iii. actual address
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,83 +0,0 @@
|
|||||||
<!doctype html>
|
|
||||||
<html lang="en" data-bs-theme="dark">
|
|
||||||
<head>
|
|
||||||
<meta charset="utf8">
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
||||||
<title>Entity Hierarchy</title>
|
|
||||||
<link rel="stylesheet" href="bootstrap/css/bootstrap.min.css">
|
|
||||||
<script src='bootstrap/js/bootstrap.bundle.min.js'></script>
|
|
||||||
<link rel="stylesheet" href="bootstrap-treeview/dist/bootstrap-treeview.min.css">
|
|
||||||
<script src="jquery/jquery.min.js"></script>
|
|
||||||
<script src="bootstrap-treeview/dist/bootstrap-treeview.min.js"></script>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<nav class="navbar navbar-expand bg-body-tertiary">
|
|
||||||
<div class="container-fluid">
|
|
||||||
<ul class="navbar-nav me-auto mb-0 mb-lg-0">
|
|
||||||
<li class="nav-item dropdown">
|
|
||||||
<a class="nav-link dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown" aria-expanded="false" data-toggle="tooltip" title="Create a new Entity.">Create</a>
|
|
||||||
<ul class="dropdown-menu">
|
|
||||||
<li><a class="dropdown-item" href="#" data-toggle="tooltip" title="Create a new Entity.">Empty Entity</a></li>
|
|
||||||
<li><a class="dropdown-item" href="#" data-toggle="tooltip" title="Create a new Entity that is a child of the selected entity.">Create Child</a></li>
|
|
||||||
<li><a class="dropdown-item" href="#" data-toggle="tooltip" title="Create a new Entity that will be the parent of all selected entities.">Create Parent</a></li>
|
|
||||||
</ul>
|
|
||||||
</li>
|
|
||||||
<li class="nav-item">
|
|
||||||
<a id="btn_delete_entity" class="nav-link disabled" href="#">Delete</a>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
<form class="d-flex" role="search">
|
|
||||||
<input class="form-control me-2" type="search" placeholder="Search" aria-label="Search">
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
</nav>
|
|
||||||
|
|
||||||
<ul id="entityList">
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
<div id="tree"></div>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
function getTree() {
|
|
||||||
// Some logic to retrieve, or generate tree structure
|
|
||||||
var tree = [
|
|
||||||
{
|
|
||||||
text: "Parent 1",
|
|
||||||
nodes: [
|
|
||||||
{
|
|
||||||
text: "Child 1",
|
|
||||||
nodes: [
|
|
||||||
{
|
|
||||||
text: "Grandchild 1"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
text: "Grandchild 2"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
text: "Child 2"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
text: "Parent 2"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
text: "Parent 3"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
text: "Parent 4"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
text: "Parent 5"
|
|
||||||
}
|
|
||||||
];
|
|
||||||
|
|
||||||
return tree;
|
|
||||||
}
|
|
||||||
|
|
||||||
$('#tree').treeview({data: getTree()});
|
|
||||||
</script>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
{
|
|
||||||
"directory": "public/bower_components"
|
|
||||||
}
|
|
||||||
@@ -1,22 +0,0 @@
|
|||||||
# Auto detect text files and perform LF normalization
|
|
||||||
* text=auto
|
|
||||||
|
|
||||||
# Custom for Visual Studio
|
|
||||||
*.cs diff=csharp
|
|
||||||
*.sln merge=union
|
|
||||||
*.csproj merge=union
|
|
||||||
*.vbproj merge=union
|
|
||||||
*.fsproj merge=union
|
|
||||||
*.dbproj merge=union
|
|
||||||
|
|
||||||
# Standard to msysgit
|
|
||||||
*.doc diff=astextplain
|
|
||||||
*.DOC diff=astextplain
|
|
||||||
*.docx diff=astextplain
|
|
||||||
*.DOCX diff=astextplain
|
|
||||||
*.dot diff=astextplain
|
|
||||||
*.DOT diff=astextplain
|
|
||||||
*.pdf diff=astextplain
|
|
||||||
*.PDF diff=astextplain
|
|
||||||
*.rtf diff=astextplain
|
|
||||||
*.RTF diff=astextplain
|
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
node_modules/
|
|
||||||
public/bower_components/
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
{
|
|
||||||
// Details: https://github.com/victorporof/Sublime-JSHint#using-your-own-jshintrc-options
|
|
||||||
// Example: https://github.com/jshint/jshint/blob/master/examples/.jshintrc
|
|
||||||
// Documentation: http://www.jshint.com/docs/
|
|
||||||
"browser": true,
|
|
||||||
"esnext": true,
|
|
||||||
"globals": { $: false, jQuery: false, "console": false},
|
|
||||||
"globalstrict": true,
|
|
||||||
"quotmark": "single",
|
|
||||||
"smarttabs": true,
|
|
||||||
"trailing": true,
|
|
||||||
"undef": true,
|
|
||||||
"unused": true
|
|
||||||
}
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
language: node_js
|
|
||||||
|
|
||||||
node_js:
|
|
||||||
- "0.11"
|
|
||||||
- "0.10"
|
|
||||||
|
|
||||||
before_script:
|
|
||||||
- npm install -g grunt-cli
|
|
||||||
- npm install
|
|
||||||
- bower install
|
|
||||||
|
|
||||||
script: grunt test --verbose --force
|
|
||||||
@@ -1,91 +0,0 @@
|
|||||||
# Change Log
|
|
||||||
All notable changes to this project will be documented in this file.
|
|
||||||
This project adheres to [Semantic Versioning](http://semver.org/).
|
|
||||||
|
|
||||||
## v1.2.0 - 9th May, 2015
|
|
||||||
|
|
||||||
### New Features
|
|
||||||
|
|
||||||
- Disable nodes, allow a tree node to disabled (not selectable, expandable or checkable)
|
|
||||||
|
|
||||||
- Added node state property `disabled` to set a node initial state
|
|
||||||
|
|
||||||
- Methods `disableAll`, `disableNode`, `enableAll`, `enableNode` and `toggleNodeDisabled` added to control state programmatically
|
|
||||||
|
|
||||||
- Events `nodeDisabled` and `nodeEnabled`
|
|
||||||
|
|
||||||
- Checkable nodes, allows a tree node to be checked or unchecked.
|
|
||||||
|
|
||||||
- Added node state property `checked` to set a node initial state
|
|
||||||
|
|
||||||
- Pass option `{showCheckbox: true}` to initialize tree view with checkboxes
|
|
||||||
|
|
||||||
- Use options `checkedIcon` and `uncheckedIcon` to configure checkbox icons
|
|
||||||
|
|
||||||
- Methods `checkAll`, `checkNode`, `uncheckAll`, `uncheckNode` and `toggleNodeChecked` to control state programmatically
|
|
||||||
|
|
||||||
- Events `nodeChecked` and `nodeUnchecked`
|
|
||||||
|
|
||||||
- New option + node property `selectedIcon` to support displaying different icons when a node is selected.
|
|
||||||
|
|
||||||
- New search option `{ revealResults : true | false }` which when set to true will automatically expand the tree view to reveal matching nodes
|
|
||||||
|
|
||||||
- New method `revealNode` which expands the tree view to reveal a given node
|
|
||||||
|
|
||||||
- New methods to retrieve nodes by state : `getSelected`, `getUnselected`, `getExpanded`, `getCollapsed`, `getChecked`, `getUnchecked`, `getDisabled` and `getEnabled`
|
|
||||||
|
|
||||||
|
|
||||||
### Changes
|
|
||||||
- Removed nodeIcon by default, by popular demand. Use `{nodeIcon: 'glyphicon glyphicon-stop'}` in initial options to add a node icon.
|
|
||||||
|
|
||||||
- Search behaviour, by default search will the expand tree view and reveal results. Alternatively pass `{revealResults:false}`
|
|
||||||
|
|
||||||
- Method collapseNode accepts new option `{ ignoreChildren: true | false }`. The default is false, passing true will leave child nodes uncollapsed
|
|
||||||
|
|
||||||
|
|
||||||
### Bug Fixes
|
|
||||||
- Remove unnecessary render in clearSearch when called from search
|
|
||||||
|
|
||||||
- Child nodes should collapse by default on collapseNode
|
|
||||||
|
|
||||||
- Incorrect expand collapse icon displayed when nodes array is empty
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## v1.1.0 - 29th March, 2015
|
|
||||||
|
|
||||||
### New Features
|
|
||||||
|
|
||||||
- Added node state properties `expanded` and `selected` so a node's intial state can be set
|
|
||||||
|
|
||||||
- New get methods `getNode`, `getParent` and `getSiblings` for retrieving nodes and their immediate relations
|
|
||||||
|
|
||||||
- New select methods `selectNode`, `unselectNode` and `toggleNodeSelected`
|
|
||||||
|
|
||||||
- Adding `nodeUnselected` event
|
|
||||||
|
|
||||||
- New global option `multiSelect` which allows multiple nodes to hold the selected state, default is false
|
|
||||||
|
|
||||||
- New expand collapse methods `expandAll`, `collapseAll`, `expandNode`, `collapseNode` and `toggleNodeExpanded`
|
|
||||||
|
|
||||||
- Adding events `nodeExpanded` and `nodeCollapsed`
|
|
||||||
|
|
||||||
- New methods `search` and `clearSearch` which allow you to query the tree view for nodes based on a `text` value
|
|
||||||
|
|
||||||
- Adding events `searchComplete` and `searchCleared`
|
|
||||||
|
|
||||||
- New global options `highlightSearchResults`, `searchResultColor` and `searchResultBackColor` for configuring how search results are displayed
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## v1.0.2 - 6th February, 2015
|
|
||||||
|
|
||||||
### Changes
|
|
||||||
- jQuery dependency version updated in Bower
|
|
||||||
|
|
||||||
### Bug Fixes
|
|
||||||
- Events not unbound when re-initialised
|
|
||||||
|
|
||||||
- CSS selectors too general, affecting other page elements
|
|
||||||
@@ -1,62 +0,0 @@
|
|||||||
module.exports = function(grunt) {
|
|
||||||
grunt.initConfig({
|
|
||||||
pkg: grunt.file.readJSON('package.json'), // the package file to use
|
|
||||||
|
|
||||||
uglify: {
|
|
||||||
files: {
|
|
||||||
expand: true,
|
|
||||||
flatten: true,
|
|
||||||
src: 'src/js/*.js',
|
|
||||||
dest: 'dist',
|
|
||||||
ext: '.min.js'
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
cssmin: {
|
|
||||||
minify: {
|
|
||||||
expand: true,
|
|
||||||
cwd: 'src/css',
|
|
||||||
src: ['*.css', '!*.min.css'],
|
|
||||||
dest: 'dist',
|
|
||||||
ext: '.min.css'
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
qunit: {
|
|
||||||
all: ['tests/*.html']
|
|
||||||
},
|
|
||||||
|
|
||||||
watch: {
|
|
||||||
files: ['tests/*.js', 'tests/*.html', 'src/**'],
|
|
||||||
tasks: ['default']
|
|
||||||
},
|
|
||||||
|
|
||||||
copy: {
|
|
||||||
main: {
|
|
||||||
files: [
|
|
||||||
// copy dist to tests
|
|
||||||
// { expand: true, cwd: 'dist', src: '*', dest: 'tests/lib/' },
|
|
||||||
{ expand: true, cwd: 'src/css', src: '*', dest: 'tests/lib/' },
|
|
||||||
{ expand: true, cwd: 'src/js', src: '*', dest: 'tests/lib/' },
|
|
||||||
// copy latest libs to tests
|
|
||||||
{ expand: true, cwd: 'public/bower_components/jquery', src: 'jquery.js', dest: 'tests/lib/' },
|
|
||||||
{ expand: true, cwd: 'public/bower_components/bootstrap-datepicker/js', src: 'bootstrap-datepicker.js', dest: 'tests/lib/' },
|
|
||||||
// copy src to example
|
|
||||||
{ expand: true, cwd: 'src/css', src: '*', dest: 'public/css/' },
|
|
||||||
{ expand: true, cwd: 'src/js', src: '*', dest: 'public/js/' }
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// load up your plugins
|
|
||||||
grunt.loadNpmTasks('grunt-contrib-uglify');
|
|
||||||
grunt.loadNpmTasks('grunt-contrib-cssmin');
|
|
||||||
grunt.loadNpmTasks('grunt-contrib-qunit');
|
|
||||||
grunt.loadNpmTasks('grunt-contrib-watch');
|
|
||||||
grunt.loadNpmTasks('grunt-contrib-copy');
|
|
||||||
|
|
||||||
// register one or more task lists (you should ALWAYS have a "default" task list)
|
|
||||||
grunt.registerTask('default', ['uglify','cssmin', 'copy', 'qunit', 'watch']);
|
|
||||||
grunt.registerTask('test', 'qunit');
|
|
||||||
};
|
|
||||||
@@ -1,202 +0,0 @@
|
|||||||
Apache License
|
|
||||||
Version 2.0, January 2004
|
|
||||||
http://www.apache.org/licenses/
|
|
||||||
|
|
||||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
||||||
|
|
||||||
1. Definitions.
|
|
||||||
|
|
||||||
"License" shall mean the terms and conditions for use, reproduction,
|
|
||||||
and distribution as defined by Sections 1 through 9 of this document.
|
|
||||||
|
|
||||||
"Licensor" shall mean the copyright owner or entity authorized by
|
|
||||||
the copyright owner that is granting the License.
|
|
||||||
|
|
||||||
"Legal Entity" shall mean the union of the acting entity and all
|
|
||||||
other entities that control, are controlled by, or are under common
|
|
||||||
control with that entity. For the purposes of this definition,
|
|
||||||
"control" means (i) the power, direct or indirect, to cause the
|
|
||||||
direction or management of such entity, whether by contract or
|
|
||||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
||||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
||||||
|
|
||||||
"You" (or "Your") shall mean an individual or Legal Entity
|
|
||||||
exercising permissions granted by this License.
|
|
||||||
|
|
||||||
"Source" form shall mean the preferred form for making modifications,
|
|
||||||
including but not limited to software source code, documentation
|
|
||||||
source, and configuration files.
|
|
||||||
|
|
||||||
"Object" form shall mean any form resulting from mechanical
|
|
||||||
transformation or translation of a Source form, including but
|
|
||||||
not limited to compiled object code, generated documentation,
|
|
||||||
and conversions to other media types.
|
|
||||||
|
|
||||||
"Work" shall mean the work of authorship, whether in Source or
|
|
||||||
Object form, made available under the License, as indicated by a
|
|
||||||
copyright notice that is included in or attached to the work
|
|
||||||
(an example is provided in the Appendix below).
|
|
||||||
|
|
||||||
"Derivative Works" shall mean any work, whether in Source or Object
|
|
||||||
form, that is based on (or derived from) the Work and for which the
|
|
||||||
editorial revisions, annotations, elaborations, or other modifications
|
|
||||||
represent, as a whole, an original work of authorship. For the purposes
|
|
||||||
of this License, Derivative Works shall not include works that remain
|
|
||||||
separable from, or merely link (or bind by name) to the interfaces of,
|
|
||||||
the Work and Derivative Works thereof.
|
|
||||||
|
|
||||||
"Contribution" shall mean any work of authorship, including
|
|
||||||
the original version of the Work and any modifications or additions
|
|
||||||
to that Work or Derivative Works thereof, that is intentionally
|
|
||||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
||||||
or by an individual or Legal Entity authorized to submit on behalf of
|
|
||||||
the copyright owner. For the purposes of this definition, "submitted"
|
|
||||||
means any form of electronic, verbal, or written communication sent
|
|
||||||
to the Licensor or its representatives, including but not limited to
|
|
||||||
communication on electronic mailing lists, source code control systems,
|
|
||||||
and issue tracking systems that are managed by, or on behalf of, the
|
|
||||||
Licensor for the purpose of discussing and improving the Work, but
|
|
||||||
excluding communication that is conspicuously marked or otherwise
|
|
||||||
designated in writing by the copyright owner as "Not a Contribution."
|
|
||||||
|
|
||||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
||||||
on behalf of whom a Contribution has been received by Licensor and
|
|
||||||
subsequently incorporated within the Work.
|
|
||||||
|
|
||||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
||||||
this License, each Contributor hereby grants to You a perpetual,
|
|
||||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
||||||
copyright license to reproduce, prepare Derivative Works of,
|
|
||||||
publicly display, publicly perform, sublicense, and distribute the
|
|
||||||
Work and such Derivative Works in Source or Object form.
|
|
||||||
|
|
||||||
3. Grant of Patent License. Subject to the terms and conditions of
|
|
||||||
this License, each Contributor hereby grants to You a perpetual,
|
|
||||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
||||||
(except as stated in this section) patent license to make, have made,
|
|
||||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
||||||
where such license applies only to those patent claims licensable
|
|
||||||
by such Contributor that are necessarily infringed by their
|
|
||||||
Contribution(s) alone or by combination of their Contribution(s)
|
|
||||||
with the Work to which such Contribution(s) was submitted. If You
|
|
||||||
institute patent litigation against any entity (including a
|
|
||||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
||||||
or a Contribution incorporated within the Work constitutes direct
|
|
||||||
or contributory patent infringement, then any patent licenses
|
|
||||||
granted to You under this License for that Work shall terminate
|
|
||||||
as of the date such litigation is filed.
|
|
||||||
|
|
||||||
4. Redistribution. You may reproduce and distribute copies of the
|
|
||||||
Work or Derivative Works thereof in any medium, with or without
|
|
||||||
modifications, and in Source or Object form, provided that You
|
|
||||||
meet the following conditions:
|
|
||||||
|
|
||||||
(a) You must give any other recipients of the Work or
|
|
||||||
Derivative Works a copy of this License; and
|
|
||||||
|
|
||||||
(b) You must cause any modified files to carry prominent notices
|
|
||||||
stating that You changed the files; and
|
|
||||||
|
|
||||||
(c) You must retain, in the Source form of any Derivative Works
|
|
||||||
that You distribute, all copyright, patent, trademark, and
|
|
||||||
attribution notices from the Source form of the Work,
|
|
||||||
excluding those notices that do not pertain to any part of
|
|
||||||
the Derivative Works; and
|
|
||||||
|
|
||||||
(d) If the Work includes a "NOTICE" text file as part of its
|
|
||||||
distribution, then any Derivative Works that You distribute must
|
|
||||||
include a readable copy of the attribution notices contained
|
|
||||||
within such NOTICE file, excluding those notices that do not
|
|
||||||
pertain to any part of the Derivative Works, in at least one
|
|
||||||
of the following places: within a NOTICE text file distributed
|
|
||||||
as part of the Derivative Works; within the Source form or
|
|
||||||
documentation, if provided along with the Derivative Works; or,
|
|
||||||
within a display generated by the Derivative Works, if and
|
|
||||||
wherever such third-party notices normally appear. The contents
|
|
||||||
of the NOTICE file are for informational purposes only and
|
|
||||||
do not modify the License. You may add Your own attribution
|
|
||||||
notices within Derivative Works that You distribute, alongside
|
|
||||||
or as an addendum to the NOTICE text from the Work, provided
|
|
||||||
that such additional attribution notices cannot be construed
|
|
||||||
as modifying the License.
|
|
||||||
|
|
||||||
You may add Your own copyright statement to Your modifications and
|
|
||||||
may provide additional or different license terms and conditions
|
|
||||||
for use, reproduction, or distribution of Your modifications, or
|
|
||||||
for any such Derivative Works as a whole, provided Your use,
|
|
||||||
reproduction, and distribution of the Work otherwise complies with
|
|
||||||
the conditions stated in this License.
|
|
||||||
|
|
||||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
||||||
any Contribution intentionally submitted for inclusion in the Work
|
|
||||||
by You to the Licensor shall be under the terms and conditions of
|
|
||||||
this License, without any additional terms or conditions.
|
|
||||||
Notwithstanding the above, nothing herein shall supersede or modify
|
|
||||||
the terms of any separate license agreement you may have executed
|
|
||||||
with Licensor regarding such Contributions.
|
|
||||||
|
|
||||||
6. Trademarks. This License does not grant permission to use the trade
|
|
||||||
names, trademarks, service marks, or product names of the Licensor,
|
|
||||||
except as required for reasonable and customary use in describing the
|
|
||||||
origin of the Work and reproducing the content of the NOTICE file.
|
|
||||||
|
|
||||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
||||||
agreed to in writing, Licensor provides the Work (and each
|
|
||||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
||||||
implied, including, without limitation, any warranties or conditions
|
|
||||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
||||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
||||||
appropriateness of using or redistributing the Work and assume any
|
|
||||||
risks associated with Your exercise of permissions under this License.
|
|
||||||
|
|
||||||
8. Limitation of Liability. In no event and under no legal theory,
|
|
||||||
whether in tort (including negligence), contract, or otherwise,
|
|
||||||
unless required by applicable law (such as deliberate and grossly
|
|
||||||
negligent acts) or agreed to in writing, shall any Contributor be
|
|
||||||
liable to You for damages, including any direct, indirect, special,
|
|
||||||
incidental, or consequential damages of any character arising as a
|
|
||||||
result of this License or out of the use or inability to use the
|
|
||||||
Work (including but not limited to damages for loss of goodwill,
|
|
||||||
work stoppage, computer failure or malfunction, or any and all
|
|
||||||
other commercial damages or losses), even if such Contributor
|
|
||||||
has been advised of the possibility of such damages.
|
|
||||||
|
|
||||||
9. Accepting Warranty or Additional Liability. While redistributing
|
|
||||||
the Work or Derivative Works thereof, You may choose to offer,
|
|
||||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
||||||
or other liability obligations and/or rights consistent with this
|
|
||||||
License. However, in accepting such obligations, You may act only
|
|
||||||
on Your own behalf and on Your sole responsibility, not on behalf
|
|
||||||
of any other Contributor, and only if You agree to indemnify,
|
|
||||||
defend, and hold each Contributor harmless for any liability
|
|
||||||
incurred by, or claims asserted against, such Contributor by reason
|
|
||||||
of your accepting any such warranty or additional liability.
|
|
||||||
|
|
||||||
END OF TERMS AND CONDITIONS
|
|
||||||
|
|
||||||
APPENDIX: How to apply the Apache License to your work.
|
|
||||||
|
|
||||||
To apply the Apache License to your work, attach the following
|
|
||||||
boilerplate notice, with the fields enclosed by brackets "{}"
|
|
||||||
replaced with your own identifying information. (Don't include
|
|
||||||
the brackets!) The text should be enclosed in the appropriate
|
|
||||||
comment syntax for the file format. We also recommend that a
|
|
||||||
file or class name and description of purpose be included on the
|
|
||||||
same "printed page" as the copyright notice for easier
|
|
||||||
identification within third-party archives.
|
|
||||||
|
|
||||||
Copyright {yyyy} {name of copyright owner}
|
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
you may not use this file except in compliance with the License.
|
|
||||||
You may obtain a copy of the License at
|
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
|
||||||
|
|
||||||
@@ -1,763 +0,0 @@
|
|||||||
# Bootstrap Tree View
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||

|
|
||||||
[](https://www.npmjs.com/package/bootstrap-treeview)
|
|
||||||
[](https://travis-ci.org/jonmiles/bootstrap-treeview)
|
|
||||||
|
|
||||||
A simple and elegant solution to displaying hierarchical tree structures (i.e. a Tree View) while leveraging the best that Twitter Bootstrap has to offer.
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
## Dependencies
|
|
||||||
|
|
||||||
Where provided these are the actual versions bootstrap-treeview has been tested against.
|
|
||||||
|
|
||||||
- [Bootstrap v3.3.4 (>= 3.0.0)](http://getbootstrap.com/)
|
|
||||||
- [jQuery v2.1.3 (>= 1.9.0)](http://jquery.com/)
|
|
||||||
|
|
||||||
|
|
||||||
## Getting Started
|
|
||||||
|
|
||||||
### Install
|
|
||||||
|
|
||||||
You can install using bower (recommended):
|
|
||||||
|
|
||||||
```javascript
|
|
||||||
$ bower install bootstrap-treeview
|
|
||||||
```
|
|
||||||
|
|
||||||
or using npm:
|
|
||||||
|
|
||||||
```javascript
|
|
||||||
$ npm install bootstrap-treeview
|
|
||||||
```
|
|
||||||
|
|
||||||
or [download](https://github.com/jonmiles/bootstrap-treeview/releases/tag/v1.2.0) manually.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Usage
|
|
||||||
|
|
||||||
Add the following resources for the bootstrap-treeview to function correctly.
|
|
||||||
|
|
||||||
```html
|
|
||||||
<!-- Required Stylesheets -->
|
|
||||||
<link href="bootstrap.css" rel="stylesheet">
|
|
||||||
|
|
||||||
<!-- Required Javascript -->
|
|
||||||
<script src="jquery.js"></script>
|
|
||||||
<script src="bootstrap-treeview.js"></script>
|
|
||||||
```
|
|
||||||
|
|
||||||
The component will bind to any existing DOM element.
|
|
||||||
|
|
||||||
```html
|
|
||||||
<div id="tree"></div>
|
|
||||||
```
|
|
||||||
|
|
||||||
Basic usage may look something like this.
|
|
||||||
|
|
||||||
```javascript
|
|
||||||
function getTree() {
|
|
||||||
// Some logic to retrieve, or generate tree structure
|
|
||||||
return data;
|
|
||||||
}
|
|
||||||
|
|
||||||
$('#tree').treeview({data: getTree()});
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
## Data Structure
|
|
||||||
|
|
||||||
In order to define the hierarchical structure needed for the tree it's necessary to provide a nested array of JavaScript objects.
|
|
||||||
|
|
||||||
Example
|
|
||||||
|
|
||||||
```javascript
|
|
||||||
var tree = [
|
|
||||||
{
|
|
||||||
text: "Parent 1",
|
|
||||||
nodes: [
|
|
||||||
{
|
|
||||||
text: "Child 1",
|
|
||||||
nodes: [
|
|
||||||
{
|
|
||||||
text: "Grandchild 1"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
text: "Grandchild 2"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
text: "Child 2"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
text: "Parent 2"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
text: "Parent 3"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
text: "Parent 4"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
text: "Parent 5"
|
|
||||||
}
|
|
||||||
];
|
|
||||||
```
|
|
||||||
|
|
||||||
At the lowest level a tree node is a represented as a simple JavaScript object. This one required property `text` will build you a tree.
|
|
||||||
|
|
||||||
```javascript
|
|
||||||
{
|
|
||||||
text: "Node 1"
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
If you want to do more, here's the full node specification
|
|
||||||
|
|
||||||
```javascript
|
|
||||||
{
|
|
||||||
text: "Node 1",
|
|
||||||
icon: "glyphicon glyphicon-stop",
|
|
||||||
selectedIcon: "glyphicon glyphicon-stop",
|
|
||||||
color: "#000000",
|
|
||||||
backColor: "#FFFFFF",
|
|
||||||
href: "#node-1",
|
|
||||||
selectable: true,
|
|
||||||
state: {
|
|
||||||
checked: true,
|
|
||||||
disabled: true,
|
|
||||||
expanded: true,
|
|
||||||
selected: true
|
|
||||||
},
|
|
||||||
tags: ['available'],
|
|
||||||
nodes: [
|
|
||||||
{},
|
|
||||||
...
|
|
||||||
]
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
### Node Properties
|
|
||||||
|
|
||||||
The following properties are defined to allow node level overrides, such as node specific icons, colours and tags.
|
|
||||||
|
|
||||||
#### text
|
|
||||||
`String` `Mandatory`
|
|
||||||
|
|
||||||
The text value displayed for a given tree node, typically to the right of the nodes icon.
|
|
||||||
|
|
||||||
#### icon
|
|
||||||
`String` `Optional`
|
|
||||||
|
|
||||||
The icon displayed on a given node, typically to the left of the text.
|
|
||||||
|
|
||||||
For simplicity we directly leverage [Bootstraps Glyphicons support](http://getbootstrap.com/components/#glyphicons) and as such you should provide both the base class and individual icon class separated by a space.
|
|
||||||
|
|
||||||
By providing the base class you retain full control over the icons used. If you want to use your own then just add your class to this icon field.
|
|
||||||
|
|
||||||
#### selectedIcon
|
|
||||||
`String` `Optional`
|
|
||||||
|
|
||||||
The icon displayed on a given node when selected, typically to the left of the text.
|
|
||||||
|
|
||||||
#### color
|
|
||||||
`String` `Optional`
|
|
||||||
|
|
||||||
The foreground color used on a given node, overrides global color option.
|
|
||||||
|
|
||||||
#### backColor
|
|
||||||
`String` `Optional`
|
|
||||||
|
|
||||||
The background color used on a given node, overrides global color option.
|
|
||||||
|
|
||||||
#### href
|
|
||||||
`String` `Optional`
|
|
||||||
|
|
||||||
Used in conjunction with global enableLinks option to specify anchor tag URL on a given node.
|
|
||||||
|
|
||||||
#### selectable
|
|
||||||
`Boolean` `Default: true`
|
|
||||||
|
|
||||||
Whether or not a node is selectable in the tree. False indicates the node should act as an expansion heading and will not fire selection events.
|
|
||||||
|
|
||||||
#### state
|
|
||||||
`Object` `Optional`
|
|
||||||
Describes a node's initial state.
|
|
||||||
|
|
||||||
#### state.checked
|
|
||||||
`Boolean` `Default: false`
|
|
||||||
|
|
||||||
Whether or not a node is checked, represented by a checkbox style glyphicon.
|
|
||||||
|
|
||||||
#### state.disabled
|
|
||||||
`Boolean` `Default: false`
|
|
||||||
|
|
||||||
Whether or not a node is disabled (not selectable, expandable or checkable).
|
|
||||||
|
|
||||||
#### state.expanded
|
|
||||||
`Boolean` `Default: false`
|
|
||||||
|
|
||||||
Whether or not a node is expanded i.e. open. Takes precedence over global option levels.
|
|
||||||
|
|
||||||
#### state.selected
|
|
||||||
`Boolean` `Default: false`
|
|
||||||
|
|
||||||
Whether or not a node is selected.
|
|
||||||
|
|
||||||
#### tags
|
|
||||||
`Array of Strings` `Optional`
|
|
||||||
|
|
||||||
Used in conjunction with global showTags option to add additional information to the right of each node; using [Bootstrap Badges](http://getbootstrap.com/components/#badges)
|
|
||||||
|
|
||||||
### Extendible
|
|
||||||
|
|
||||||
You can extend the node object by adding any number of additional key value pairs that you require for your application. Remember this is the object which will be passed around during selection events.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## Options
|
|
||||||
|
|
||||||
Options allow you to customise the treeview's default appearance and behaviour. They are passed to the plugin on initialization, as an object.
|
|
||||||
|
|
||||||
```javascript
|
|
||||||
// Example: initializing the treeview
|
|
||||||
// expanded to 5 levels
|
|
||||||
// with a background color of green
|
|
||||||
$('#tree').treeview({
|
|
||||||
data: data, // data is not optional
|
|
||||||
levels: 5,
|
|
||||||
backColor: 'green'
|
|
||||||
});
|
|
||||||
```
|
|
||||||
You can pass a new options object to the treeview at any time but this will have the effect of re-initializing the treeview.
|
|
||||||
|
|
||||||
### List of Options
|
|
||||||
|
|
||||||
The following is a list of all available options.
|
|
||||||
|
|
||||||
#### data
|
|
||||||
Array of Objects. No default, expects data
|
|
||||||
|
|
||||||
This is the core data to be displayed by the tree view.
|
|
||||||
|
|
||||||
#### backColor
|
|
||||||
String, [any legal color value](http://www.w3schools.com/cssref/css_colors_legal.asp). Default: inherits from Bootstrap.css.
|
|
||||||
|
|
||||||
Sets the default background color used by all nodes, except when overridden on a per node basis in data.
|
|
||||||
|
|
||||||
#### borderColor
|
|
||||||
String, [any legal color value](http://www.w3schools.com/cssref/css_colors_legal.asp). Default: inherits from Bootstrap.css.
|
|
||||||
|
|
||||||
Sets the border color for the component; set showBorder to false if you don't want a visible border.
|
|
||||||
|
|
||||||
#### checkedIcon
|
|
||||||
String, class names(s). Default: "glyphicon glyphicon-check" as defined by [Bootstrap Glyphicons](http://getbootstrap.com/components/#glyphicons)
|
|
||||||
|
|
||||||
Sets the icon to be as a checked checkbox, used in conjunction with showCheckbox.
|
|
||||||
|
|
||||||
#### collapseIcon
|
|
||||||
String, class name(s). Default: "glyphicon glyphicon-minus" as defined by [Bootstrap Glyphicons](http://getbootstrap.com/components/#glyphicons)
|
|
||||||
|
|
||||||
Sets the icon to be used on a collapsible tree node.
|
|
||||||
|
|
||||||
#### color
|
|
||||||
String, [any legal color value](http://www.w3schools.com/cssref/css_colors_legal.asp). Default: inherits from Bootstrap.css.
|
|
||||||
|
|
||||||
Sets the default foreground color used by all nodes, except when overridden on a per node basis in data.
|
|
||||||
|
|
||||||
#### emptyIcon
|
|
||||||
String, class name(s). Default: "glyphicon" as defined by [Bootstrap Glyphicons](http://getbootstrap.com/components/#glyphicons)
|
|
||||||
|
|
||||||
Sets the icon to be used on a tree node with no child nodes.
|
|
||||||
|
|
||||||
#### enableLinks
|
|
||||||
Boolean. Default: false
|
|
||||||
|
|
||||||
Whether or not to present node text as a hyperlink. The href value of which must be provided in the data structure on a per node basis.
|
|
||||||
|
|
||||||
#### expandIcon
|
|
||||||
String, class name(s). Default: "glyphicon glyphicon-plus" as defined by [Bootstrap Glyphicons](http://getbootstrap.com/components/#glyphicons)
|
|
||||||
|
|
||||||
Sets the icon to be used on an expandable tree node.
|
|
||||||
|
|
||||||
#### highlightSearchResults
|
|
||||||
Boolean. Default: true
|
|
||||||
|
|
||||||
Whether or not to highlight search results.
|
|
||||||
|
|
||||||
#### highlightSelected
|
|
||||||
Boolean. Default: true
|
|
||||||
|
|
||||||
Whether or not to highlight the selected node.
|
|
||||||
|
|
||||||
#### levels
|
|
||||||
Integer. Default: 2
|
|
||||||
|
|
||||||
Sets the number of hierarchical levels deep the tree will be expanded to by default.
|
|
||||||
|
|
||||||
#### multiSelect
|
|
||||||
Boolean. Default: false
|
|
||||||
|
|
||||||
Whether or not multiple nodes can be selected at the same time.
|
|
||||||
|
|
||||||
#### nodeIcon
|
|
||||||
String, class name(s). Default: "glyphicon glyphicon-stop" as defined by [Bootstrap Glyphicons](http://getbootstrap.com/components/#glyphicons)
|
|
||||||
|
|
||||||
Sets the default icon to be used on all nodes, except when overridden on a per node basis in data.
|
|
||||||
|
|
||||||
#### onhoverColor
|
|
||||||
String, [any legal color value](http://www.w3schools.com/cssref/css_colors_legal.asp). Default: '#F5F5F5'.
|
|
||||||
|
|
||||||
Sets the default background color activated when the users cursor hovers over a node.
|
|
||||||
|
|
||||||
#### selectedIcon
|
|
||||||
String, class name(s). Default: "glyphicon glyphicon-stop" as defined by [Bootstrap Glyphicons](http://getbootstrap.com/components/#glyphicons)
|
|
||||||
|
|
||||||
Sets the default icon to be used on all selected nodes, except when overridden on a per node basis in data.
|
|
||||||
|
|
||||||
#### searchResultBackColor
|
|
||||||
String, [any legal color value](http://www.w3schools.com/cssref/css_colors_legal.asp). Default: undefined, inherits.
|
|
||||||
|
|
||||||
Sets the background color of the selected node.
|
|
||||||
|
|
||||||
#### searchResultColor
|
|
||||||
String, [any legal color value](http://www.w3schools.com/cssref/css_colors_legal.asp). Default: '#D9534F'.
|
|
||||||
|
|
||||||
Sets the foreground color of the selected node.
|
|
||||||
|
|
||||||
#### selectedBackColor
|
|
||||||
String, [any legal color value](http://www.w3schools.com/cssref/css_colors_legal.asp). Default: '#428bca'.
|
|
||||||
|
|
||||||
Sets the background color of the selected node.
|
|
||||||
|
|
||||||
#### selectedColor
|
|
||||||
String, [any legal color value](http://www.w3schools.com/cssref/css_colors_legal.asp). Default: '#FFFFFF'.
|
|
||||||
|
|
||||||
Sets the foreground color of the selected node.
|
|
||||||
|
|
||||||
#### showBorder
|
|
||||||
Boolean. Default: true
|
|
||||||
|
|
||||||
Whether or not to display a border around nodes.
|
|
||||||
|
|
||||||
#### showCheckbox
|
|
||||||
Boolean. Default: false
|
|
||||||
|
|
||||||
Whether or not to display checkboxes on nodes.
|
|
||||||
|
|
||||||
#### showIcon
|
|
||||||
Boolean. Default: true
|
|
||||||
|
|
||||||
Whether or not to display a nodes icon.
|
|
||||||
|
|
||||||
#### showTags
|
|
||||||
Boolean. Default: false
|
|
||||||
|
|
||||||
Whether or not to display tags to the right of each node. The values of which must be provided in the data structure on a per node basis.
|
|
||||||
|
|
||||||
#### uncheckedIcon
|
|
||||||
String, class names(s). Default: "glyphicon glyphicon-unchecked" as defined by [Bootstrap Glyphicons](http://getbootstrap.com/components/#glyphicons)
|
|
||||||
|
|
||||||
Sets the icon to be as an unchecked checkbox, used in conjunction with showCheckbox.
|
|
||||||
|
|
||||||
|
|
||||||
## Methods
|
|
||||||
|
|
||||||
Methods provide a way of interacting with the plugin programmatically. For example, expanding a node is possible via the expandNode method.
|
|
||||||
|
|
||||||
You can invoke methods in one of two ways, using either:
|
|
||||||
|
|
||||||
#### 1. The plugin's wrapper
|
|
||||||
|
|
||||||
The plugin's wrapper works as a proxy for accessing the underlying methods.
|
|
||||||
|
|
||||||
```javascript
|
|
||||||
$('#tree').treeview('methodName', args)
|
|
||||||
```
|
|
||||||
> Limitation, multiple arguments must be passed as an array of arguments.
|
|
||||||
|
|
||||||
#### 2. The treeview directly
|
|
||||||
|
|
||||||
You can get an instance of the treeview using one of the two following methods.
|
|
||||||
|
|
||||||
```javascript
|
|
||||||
// This special method returns an instance of the treeview.
|
|
||||||
$('#tree').treeview(true)
|
|
||||||
.methodName(args);
|
|
||||||
|
|
||||||
// The instance is also saved in the DOM elements data,
|
|
||||||
// and accessible using the plugin's id 'treeview'.
|
|
||||||
$('#tree').data('treeview')
|
|
||||||
.methodName(args);
|
|
||||||
```
|
|
||||||
> A better approach, if you plan a lot of interaction.
|
|
||||||
|
|
||||||
### List of Methods
|
|
||||||
|
|
||||||
The following is a list of all available methods.
|
|
||||||
|
|
||||||
#### checkAll(options)
|
|
||||||
|
|
||||||
Checks all tree nodes
|
|
||||||
|
|
||||||
```javascript
|
|
||||||
$('#tree').treeview('checkAll', { silent: true });
|
|
||||||
```
|
|
||||||
|
|
||||||
Triggers `nodeChecked` event; pass silent to suppress events.
|
|
||||||
|
|
||||||
#### checkNode(node | nodeId, options)
|
|
||||||
|
|
||||||
Checks a given tree node, accepts node or nodeId.
|
|
||||||
|
|
||||||
```javascript
|
|
||||||
$('#tree').treeview('checkNode', [ nodeId, { silent: true } ]);
|
|
||||||
```
|
|
||||||
|
|
||||||
Triggers `nodeChecked` event; pass silent to suppress events.
|
|
||||||
|
|
||||||
#### clearSearch()
|
|
||||||
|
|
||||||
Clear the tree view of any previous search results e.g. remove their highlighted state.
|
|
||||||
|
|
||||||
```javascript
|
|
||||||
$('#tree').treeview('clearSearch');
|
|
||||||
```
|
|
||||||
|
|
||||||
Triggers `searchCleared` event
|
|
||||||
|
|
||||||
#### collapseAll(options)
|
|
||||||
|
|
||||||
Collapse all tree nodes, collapsing the entire tree.
|
|
||||||
|
|
||||||
```javascript
|
|
||||||
$('#tree').treeview('collapseAll', { silent: true });
|
|
||||||
```
|
|
||||||
|
|
||||||
Triggers `nodeCollapsed` event; pass silent to suppress events.
|
|
||||||
|
|
||||||
#### collapseNode(node | nodeId, options)
|
|
||||||
|
|
||||||
Collapse a given tree node and it's child nodes. If you don't want to collapse the child nodes, pass option `{ ignoreChildren: true }`.
|
|
||||||
|
|
||||||
```javascript
|
|
||||||
$('#tree').treeview('collapseNode', [ nodeId, { silent: true, ignoreChildren: false } ]);
|
|
||||||
```
|
|
||||||
|
|
||||||
Triggers `nodeCollapsed` event; pass silent to suppress events.
|
|
||||||
|
|
||||||
#### disableAll(options)
|
|
||||||
|
|
||||||
Disable all tree nodes
|
|
||||||
|
|
||||||
```javascript
|
|
||||||
$('#tree').treeview('disableAll', { silent: true });
|
|
||||||
```
|
|
||||||
|
|
||||||
Triggers `nodeDisabled` event; pass silent to suppress events.
|
|
||||||
|
|
||||||
#### disableNode(node | nodeId, options)
|
|
||||||
|
|
||||||
Disable a given tree node, accepts node or nodeId.
|
|
||||||
|
|
||||||
```javascript
|
|
||||||
$('#tree').treeview('disableNode', [ nodeId, { silent: true } ]);
|
|
||||||
```
|
|
||||||
|
|
||||||
Triggers `nodeDisabled` event; pass silent to suppress events.
|
|
||||||
|
|
||||||
#### enableAll(options)
|
|
||||||
|
|
||||||
Enable all tree nodes
|
|
||||||
|
|
||||||
```javascript
|
|
||||||
$('#tree').treeview('enableAll', { silent: true });
|
|
||||||
```
|
|
||||||
|
|
||||||
Triggers `nodeEnabled` event; pass silent to suppress events.
|
|
||||||
|
|
||||||
#### enableNode(node | nodeId, options)
|
|
||||||
|
|
||||||
Enable a given tree node, accepts node or nodeId.
|
|
||||||
|
|
||||||
```javascript
|
|
||||||
$('#tree').treeview('enableNode', [ nodeId, { silent: true } ]);
|
|
||||||
```
|
|
||||||
|
|
||||||
Triggers `nodeEnabled` event; pass silent to suppress events.
|
|
||||||
|
|
||||||
#### expandAll(options)
|
|
||||||
|
|
||||||
Expand all tree nodes. Optionally can be expanded to any given number of levels.
|
|
||||||
|
|
||||||
```javascript
|
|
||||||
$('#tree').treeview('expandAll', { levels: 2, silent: true });
|
|
||||||
```
|
|
||||||
|
|
||||||
Triggers `nodeExpanded` event; pass silent to suppress events.
|
|
||||||
|
|
||||||
#### expandNode(node | nodeId, options)
|
|
||||||
|
|
||||||
Expand a given tree node, accepts node or nodeId. Optionally can be expanded to any given number of levels.
|
|
||||||
|
|
||||||
```javascript
|
|
||||||
$('#tree').treeview('expandNode', [ nodeId, { levels: 2, silent: true } ]);
|
|
||||||
```
|
|
||||||
|
|
||||||
Triggers `nodeExpanded` event; pass silent to suppress events.
|
|
||||||
|
|
||||||
#### getCollapsed()
|
|
||||||
|
|
||||||
Returns an array of collapsed nodes e.g. state.expanded = false.
|
|
||||||
|
|
||||||
```javascript
|
|
||||||
$('#tree').treeview('getCollapsed', nodeId);
|
|
||||||
```
|
|
||||||
|
|
||||||
#### getDisabled()
|
|
||||||
|
|
||||||
Returns an array of disabled nodes e.g. state.disabled = true.
|
|
||||||
|
|
||||||
```javascript
|
|
||||||
$('#tree').treeview('getDisabled', nodeId);
|
|
||||||
```
|
|
||||||
|
|
||||||
#### getEnabled()
|
|
||||||
|
|
||||||
Returns an array of enabled nodes e.g. state.disabled = false.
|
|
||||||
|
|
||||||
```javascript
|
|
||||||
$('#tree').treeview('getEnabled', nodeId);
|
|
||||||
```
|
|
||||||
|
|
||||||
#### getExpanded()
|
|
||||||
|
|
||||||
Returns an array of expanded nodes e.g. state.expanded = true.
|
|
||||||
|
|
||||||
```javascript
|
|
||||||
$('#tree').treeview('getExpanded', nodeId);
|
|
||||||
```
|
|
||||||
|
|
||||||
#### getNode(nodeId)
|
|
||||||
|
|
||||||
Returns a single node object that matches the given node id.
|
|
||||||
|
|
||||||
```javascript
|
|
||||||
$('#tree').treeview('getNode', nodeId);
|
|
||||||
```
|
|
||||||
|
|
||||||
#### getParent(node | nodeId)
|
|
||||||
|
|
||||||
Returns the parent node of a given node, if valid otherwise returns undefined.
|
|
||||||
|
|
||||||
```javascript
|
|
||||||
$('#tree').treeview('getParent', node);
|
|
||||||
```
|
|
||||||
|
|
||||||
#### getSelected()
|
|
||||||
|
|
||||||
Returns an array of selected nodes e.g. state.selected = true.
|
|
||||||
|
|
||||||
```javascript
|
|
||||||
$('#tree').treeview('getSelected', nodeId);
|
|
||||||
```
|
|
||||||
|
|
||||||
#### getSiblings(node | nodeId)
|
|
||||||
|
|
||||||
Returns an array of sibling nodes for a given node, if valid otherwise returns undefined.
|
|
||||||
|
|
||||||
```javascript
|
|
||||||
$('#tree').treeview('getSiblings', node);
|
|
||||||
```
|
|
||||||
|
|
||||||
#### getUnselected()
|
|
||||||
|
|
||||||
Returns an array of unselected nodes e.g. state.selected = false.
|
|
||||||
|
|
||||||
```javascript
|
|
||||||
$('#tree').treeview('getUnselected', nodeId);
|
|
||||||
```
|
|
||||||
|
|
||||||
#### remove()
|
|
||||||
|
|
||||||
Removes the tree view component. Removing attached events, internal attached objects, and added HTML elements.
|
|
||||||
|
|
||||||
```javascript
|
|
||||||
$('#tree').treeview('remove');
|
|
||||||
```
|
|
||||||
|
|
||||||
#### revealNode(node | nodeId, options)
|
|
||||||
|
|
||||||
Reveals a given tree node, expanding the tree from node to root.
|
|
||||||
|
|
||||||
```javascript
|
|
||||||
$('#tree').treeview('revealNode', [ nodeId, { silent: true } ]);
|
|
||||||
```
|
|
||||||
|
|
||||||
Triggers `nodeExpanded` event; pass silent to suppress events.
|
|
||||||
|
|
||||||
#### search(pattern, options)
|
|
||||||
|
|
||||||
Searches the tree view for nodes that match a given string, highlighting them in the tree.
|
|
||||||
|
|
||||||
Returns an array of matching nodes.
|
|
||||||
|
|
||||||
```javascript
|
|
||||||
$('#tree').treeview('search', [ 'Parent', {
|
|
||||||
ignoreCase: true, // case insensitive
|
|
||||||
exactMatch: false, // like or equals
|
|
||||||
revealResults: true, // reveal matching nodes
|
|
||||||
}]);
|
|
||||||
```
|
|
||||||
|
|
||||||
Triggers `searchComplete` event
|
|
||||||
|
|
||||||
#### selectNode(node | nodeId, options)
|
|
||||||
|
|
||||||
Selects a given tree node, accepts node or nodeId.
|
|
||||||
|
|
||||||
```javascript
|
|
||||||
$('#tree').treeview('selectNode', [ nodeId, { silent: true } ]);
|
|
||||||
```
|
|
||||||
|
|
||||||
Triggers `nodeSelected` event; pass silent to suppress events.
|
|
||||||
|
|
||||||
#### toggleNodeChecked(node | nodeId, options)
|
|
||||||
|
|
||||||
Toggles a nodes checked state; checking if unchecked, unchecking if checked.
|
|
||||||
|
|
||||||
```javascript
|
|
||||||
$('#tree').treeview('toggleNodeChecked', [ nodeId, { silent: true } ]);
|
|
||||||
```
|
|
||||||
|
|
||||||
Triggers either `nodeChecked` or `nodeUnchecked` event; pass silent to suppress events.
|
|
||||||
|
|
||||||
#### toggleNodeDisabled(node | nodeId, options)
|
|
||||||
|
|
||||||
Toggles a nodes disabled state; disabling if enabled, enabling if disabled.
|
|
||||||
|
|
||||||
```javascript
|
|
||||||
$('#tree').treeview('toggleNodeDisabled', [ nodeId, { silent: true } ]);
|
|
||||||
```
|
|
||||||
|
|
||||||
Triggers either `nodeDisabled` or `nodeEnabled` event; pass silent to suppress events.
|
|
||||||
|
|
||||||
#### toggleNodeExpanded(node | nodeId, options)
|
|
||||||
|
|
||||||
Toggles a nodes expanded state; collapsing if expanded, expanding if collapsed.
|
|
||||||
|
|
||||||
```javascript
|
|
||||||
$('#tree').treeview('toggleNodeExpanded', [ nodeId, { silent: true } ]);
|
|
||||||
```
|
|
||||||
|
|
||||||
Triggers either `nodeExpanded` or `nodeCollapsed` event; pass silent to suppress events.
|
|
||||||
|
|
||||||
#### toggleNodeSelected(node | nodeId, options)
|
|
||||||
|
|
||||||
Toggles a node selected state; selecting if unselected, unselecting if selected.
|
|
||||||
|
|
||||||
```javascript
|
|
||||||
$('#tree').treeview('toggleNodeSelected', [ nodeId, { silent: true } ]);
|
|
||||||
```
|
|
||||||
|
|
||||||
Triggers either `nodeSelected` or `nodeUnselected` event; pass silent to suppress events.
|
|
||||||
|
|
||||||
#### uncheckAll(options)
|
|
||||||
|
|
||||||
Uncheck all tree nodes.
|
|
||||||
|
|
||||||
```javascript
|
|
||||||
$('#tree').treeview('uncheckAll', { silent: true });
|
|
||||||
```
|
|
||||||
|
|
||||||
Triggers `nodeUnchecked` event; pass silent to suppress events.
|
|
||||||
|
|
||||||
#### uncheckNode(node | nodeId, options)
|
|
||||||
|
|
||||||
Uncheck a given tree node, accepts node or nodeId.
|
|
||||||
|
|
||||||
```javascript
|
|
||||||
$('#tree').treeview('uncheckNode', [ nodeId, { silent: true } ]);
|
|
||||||
```
|
|
||||||
|
|
||||||
Triggers `nodeUnchecked` event; pass silent to suppress events.
|
|
||||||
|
|
||||||
#### unselectNode(node | nodeId, options)
|
|
||||||
|
|
||||||
Unselects a given tree node, accepts node or nodeId.
|
|
||||||
|
|
||||||
```javascript
|
|
||||||
$('#tree').treeview('unselectNode', [ nodeId, { silent: true } ]);
|
|
||||||
```
|
|
||||||
|
|
||||||
Triggers `nodeUnselected` event; pass silent to suppress events.
|
|
||||||
|
|
||||||
## Events
|
|
||||||
|
|
||||||
Events are provided so that your application can respond to changes in the treeview's state. For example, if you want to update a display when a node is selected use the `nodeSelected` event.
|
|
||||||
|
|
||||||
You can bind to any event defined below by either using an options callback handler, or the standard jQuery .on method.
|
|
||||||
|
|
||||||
Example using options callback handler:
|
|
||||||
|
|
||||||
```javascript
|
|
||||||
$('#tree').treeview({
|
|
||||||
// The naming convention for callback's is to prepend with `on`
|
|
||||||
// and capitalize the first letter of the event name
|
|
||||||
// e.g. nodeSelected -> onNodeSelected
|
|
||||||
onNodeSelected: function(event, data) {
|
|
||||||
// Your logic goes here
|
|
||||||
});
|
|
||||||
```
|
|
||||||
|
|
||||||
and using jQuery .on method
|
|
||||||
|
|
||||||
```javascript
|
|
||||||
$('#tree').on('nodeSelected', function(event, data) {
|
|
||||||
// Your logic goes here
|
|
||||||
});
|
|
||||||
```
|
|
||||||
|
|
||||||
### List of Events
|
|
||||||
|
|
||||||
`nodeChecked (event, node)` - A node is checked.
|
|
||||||
|
|
||||||
`nodeCollapsed (event, node)` - A node is collapsed.
|
|
||||||
|
|
||||||
`nodeDisabled (event, node)` - A node is disabled.
|
|
||||||
|
|
||||||
`nodeEnabled (event, node)` - A node is enabled.
|
|
||||||
|
|
||||||
`nodeExpanded (event, node)` - A node is expanded.
|
|
||||||
|
|
||||||
`nodeSelected (event, node)` - A node is selected.
|
|
||||||
|
|
||||||
`nodeUnchecked (event, node)` - A node is unchecked.
|
|
||||||
|
|
||||||
`nodeUnselected (event, node)` - A node is unselected.
|
|
||||||
|
|
||||||
`searchComplete (event, results)` - After a search completes
|
|
||||||
|
|
||||||
`searchCleared (event, results)` - After search results are cleared
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## Copyright and Licensing
|
|
||||||
Copyright 2013 Jonathan Miles
|
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
you may not use this file except in compliance with the License.
|
|
||||||
You may obtain a copy of the License at <http://www.apache.org/licenses/LICENSE-2.0>
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
|
||||||
@@ -1,29 +0,0 @@
|
|||||||
|
|
||||||
/**
|
|
||||||
* Module dependencies.
|
|
||||||
*/
|
|
||||||
|
|
||||||
var express = require('express');
|
|
||||||
var http = require('http');
|
|
||||||
var path = require('path');
|
|
||||||
|
|
||||||
var app = express();
|
|
||||||
|
|
||||||
// all environments
|
|
||||||
app.set('port', process.env.PORT || 3000);
|
|
||||||
app.use(express.favicon());
|
|
||||||
app.use(express.logger('dev'));
|
|
||||||
app.use(express.json());
|
|
||||||
app.use(express.urlencoded());
|
|
||||||
app.use(express.methodOverride());
|
|
||||||
app.use(express.static(path.join(__dirname, '/public')));
|
|
||||||
app.use(express.static(path.join(__dirname, '/tests')));
|
|
||||||
|
|
||||||
// development only
|
|
||||||
if ('development' == app.get('env')) {
|
|
||||||
app.use(express.errorHandler());
|
|
||||||
}
|
|
||||||
|
|
||||||
http.createServer(app).listen(app.get('port'), function(){
|
|
||||||
console.log('Express server listening on port ' + app.get('port'));
|
|
||||||
});
|
|
||||||
@@ -1,33 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "bootstrap-treeview",
|
|
||||||
"description": "Tree View for Twitter Bootstrap",
|
|
||||||
"version": "1.2.0",
|
|
||||||
"homepage": "https://github.com/jonmiles/bootstrap-treeview",
|
|
||||||
"main": [
|
|
||||||
"dist/bootstrap-treeview.min.js",
|
|
||||||
"dist/bootstrap-treeview.min.css"
|
|
||||||
],
|
|
||||||
"keywords": [
|
|
||||||
"twitter",
|
|
||||||
"bootstrap",
|
|
||||||
"tree",
|
|
||||||
"treeview",
|
|
||||||
"tree-view",
|
|
||||||
"navigation",
|
|
||||||
"javascript",
|
|
||||||
"jquery",
|
|
||||||
"jquery-plugin"
|
|
||||||
],
|
|
||||||
"ignore": [
|
|
||||||
"**/.*",
|
|
||||||
"node_modules",
|
|
||||||
"bower_components",
|
|
||||||
"test",
|
|
||||||
"tests"
|
|
||||||
],
|
|
||||||
"dependencies": {
|
|
||||||
"jquery": ">= 1.9.0",
|
|
||||||
"bootstrap": ">= 3.0.0"
|
|
||||||
},
|
|
||||||
"devDependencies": {}
|
|
||||||
}
|
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user