index.html 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  6. <title>Animal.js Documentation</title>
  7. <style>
  8. :root {
  9. --sidebar-bg: #111;
  10. --main-bg: #111;
  11. --border-color: #222;
  12. --text-color: #888;
  13. --text-hover: #ccc;
  14. --active-color: #ff4b4b; /* Red/Orange for active item */
  15. --header-color: #666;
  16. --middle-col-bg: #161616;
  17. --tree-line-color: #333;
  18. }
  19. body {
  20. margin: 0;
  21. padding: 0;
  22. height: 100vh;
  23. display: flex;
  24. background: var(--main-bg);
  25. color: var(--text-color);
  26. font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  27. overflow: hidden;
  28. font-size: 14px;
  29. }
  30. /* 1. LEFT SIDEBAR - MAIN NAVIGATION */
  31. .sidebar-left {
  32. width: 260px;
  33. background: var(--sidebar-bg);
  34. border-right: 1px solid var(--border-color);
  35. display: flex;
  36. flex-direction: column;
  37. overflow-y: auto;
  38. flex-shrink: 0;
  39. padding-bottom: 40px;
  40. }
  41. .logo-area {
  42. padding: 24px 20px;
  43. font-size: 18px;
  44. font-weight: bold;
  45. color: #fff;
  46. display: flex;
  47. align-items: center;
  48. gap: 10px;
  49. margin-bottom: 10px;
  50. }
  51. .logo-circle {
  52. width: 10px;
  53. height: 10px;
  54. background: #fff;
  55. border-radius: 50%;
  56. }
  57. /* Tree Structure */
  58. .nav-tree {
  59. padding: 0 20px;
  60. }
  61. .tree-group {
  62. margin-bottom: 5px;
  63. }
  64. .tree-header {
  65. padding: 8px 0;
  66. color: var(--header-color);
  67. font-weight: 600;
  68. cursor: pointer;
  69. transition: color 0.2s;
  70. display: flex;
  71. align-items: center;
  72. justify-content: space-between;
  73. }
  74. .tree-header:hover {
  75. color: var(--text-hover);
  76. }
  77. .tree-header.active-header {
  78. color: #e69f3c; /* Highlight parent if needed, usually just children */
  79. }
  80. .tree-children {
  81. padding-left: 14px; /* Indent */
  82. border-left: 1px solid var(--tree-line-color);
  83. margin-left: 2px;
  84. display: none; /* Collapsed by default */
  85. flex-direction: column;
  86. }
  87. .tree-children.expanded {
  88. display: flex;
  89. }
  90. .nav-item {
  91. display: block;
  92. padding: 6px 0 6px 15px;
  93. color: var(--text-color);
  94. text-decoration: none;
  95. cursor: pointer;
  96. transition: all 0.2s;
  97. position: relative;
  98. }
  99. .nav-item:hover {
  100. color: var(--text-hover);
  101. }
  102. /* Active Item Style (Reference: Red text, maybe red border left overlaying the gray line?) */
  103. .nav-item.active {
  104. color: var(--active-color);
  105. }
  106. /* Optional: Active marker on the left line */
  107. .nav-item.active::before {
  108. content: '';
  109. position: absolute;
  110. left: -1px; /* Overlap the border */
  111. top: 0;
  112. bottom: 0;
  113. width: 2px;
  114. background: var(--active-color);
  115. }
  116. /* Search Box in sidebar */
  117. .sidebar-search {
  118. margin: 0 20px 20px 20px;
  119. background: #1a1a1a;
  120. border: 1px solid #333;
  121. border-radius: 4px;
  122. padding: 8px 12px;
  123. color: #fff;
  124. font-size: 13px;
  125. cursor: pointer;
  126. }
  127. .sidebar-search:hover {
  128. border-color: #555;
  129. }
  130. /* 2. MIDDLE SIDEBAR */
  131. .sidebar-middle {
  132. width: 320px;
  133. background: var(--middle-col-bg);
  134. border-right: 1px solid var(--border-color);
  135. display: flex;
  136. flex-direction: column;
  137. overflow: hidden;
  138. flex-shrink: 0;
  139. }
  140. #middle-frame {
  141. width: 100%;
  142. height: 100%;
  143. border: none;
  144. background: transparent;
  145. }
  146. /* 3. RIGHT CONTENT */
  147. .content-right {
  148. flex: 1;
  149. display: flex;
  150. flex-direction: column;
  151. background: #000;
  152. overflow: hidden;
  153. }
  154. #content-frame {
  155. flex: 1;
  156. border: none;
  157. width: 100%;
  158. height: 100%;
  159. }
  160. </style>
  161. </head>
  162. <body>
  163. <!-- 1. Left Sidebar -->
  164. <div class="sidebar-left">
  165. <div class="logo-area">
  166. <div class="logo-circle"></div>
  167. Animal.js
  168. </div>
  169. <div class="sidebar-search" onclick="selectCategory('search.html', 'test_on_update.html', null)">
  170. Search
  171. </div>
  172. <div class="nav-tree">
  173. <!-- Group: Getting Started -->
  174. <div class="tree-group">
  175. <div class="tree-header" onclick="toggleTree(this)">Getting started</div>
  176. <div class="tree-children">
  177. <div class="nav-item" onclick="selectCategory('search.html', 'test_css_selector.html', this)">Installation</div>
  178. <div class="nav-item" onclick="selectCategory('search.html', 'test_css_selector.html', this)">Module imports</div>
  179. </div>
  180. </div>
  181. <!-- Group: Timer -->
  182. <div class="tree-group">
  183. <div class="tree-header" onclick="toggleTree(this)">Timer</div>
  184. <div class="tree-children">
  185. <div class="nav-item">Settings</div>
  186. </div>
  187. </div>
  188. <!-- Group: Animation -->
  189. <div class="tree-group">
  190. <div class="tree-header active-header" onclick="toggleTree(this)">Animation</div>
  191. <div class="tree-children expanded">
  192. <div class="nav-item active" onclick="selectCategory('targets/list.html', 'targets/overview.html', this)">Targets</div>
  193. <div class="nav-item" onclick="selectCategory('animatable_properties/list.html', 'animatable_properties/test_css_props.html', this)">Animatable properties</div>
  194. <div class="nav-item" onclick="selectCategory('tween_value_types/list.html', 'tween_value_types/test_numerical.html', this)">Tween value types</div>
  195. <div class="nav-item">Tween parameters</div>
  196. <div class="nav-item">Keyframes</div>
  197. <div class="nav-item">Playback settings</div>
  198. <!-- Callbacks Nested? Or separate? Reference shows Callbacks under Animation -->
  199. <div class="nav-item" onclick="selectCategory('list_callbacks.html', 'test_on_update.html', this)">Callbacks</div>
  200. <!-- Examples -->
  201. <div class="nav-item" onclick="selectCategory('examples/list.html', 'examples/controls.html', this)">Examples</div>
  202. <div class="nav-item">Methods</div>
  203. <div class="nav-item">Properties</div>
  204. </div>
  205. </div>
  206. <!-- Group: Timeline -->
  207. <div class="tree-group">
  208. <div class="tree-header" onclick="toggleTree(this)">Timeline</div>
  209. <div class="tree-children">
  210. <div class="nav-item">Basics</div>
  211. </div>
  212. </div>
  213. <!-- Group: Animatable -->
  214. <div class="tree-group">
  215. <div class="tree-header" onclick="toggleTree(this)">Animatable</div>
  216. <div class="tree-children">
  217. <div class="nav-item">Properties</div>
  218. </div>
  219. </div>
  220. </div>
  221. </div>
  222. <!-- 2. Middle Sidebar -->
  223. <div class="sidebar-middle">
  224. <iframe id="middle-frame" src="targets/list.html"></iframe>
  225. </div>
  226. <!-- 3. Right Content -->
  227. <div class="content-right">
  228. <iframe id="content-frame" src="targets/test_css_selector.html"></iframe>
  229. </div>
  230. <script>
  231. function toggleTree(header) {
  232. const children = header.nextElementSibling;
  233. if (children) {
  234. children.classList.toggle('expanded');
  235. // Optional: Highlight header when expanded?
  236. // header.classList.toggle('active-header');
  237. }
  238. }
  239. function selectCategory(listUrl, defaultContentUrl, el) {
  240. // 1. Highlight Nav Item
  241. document.querySelectorAll('.nav-item').forEach(item => item.classList.remove('active'));
  242. if (el) el.classList.add('active');
  243. // 2. Load Middle Column (List)
  244. const middleFrame = document.getElementById('middle-frame');
  245. if (middleFrame.getAttribute('src') !== listUrl) {
  246. middleFrame.src = listUrl;
  247. }
  248. // 3. Load Right Column (Default Content)
  249. loadContent(defaultContentUrl);
  250. }
  251. function loadContent(url) {
  252. const contentFrame = document.getElementById('content-frame');
  253. if (contentFrame.getAttribute('src') !== url) {
  254. contentFrame.src = url;
  255. }
  256. // Keep middle list selection in sync when possible
  257. try {
  258. setMiddleActive(url);
  259. } catch {}
  260. }
  261. // Called by content iframe pages (and also internally after navigation)
  262. function setMiddleActive(contentUrl) {
  263. const middleFrame = document.getElementById('middle-frame');
  264. if (!middleFrame) return;
  265. const win = middleFrame.contentWindow;
  266. if (win && typeof win.setActiveByContentUrl === 'function') {
  267. win.setActiveByContentUrl(contentUrl);
  268. }
  269. }
  270. // Make initial active state robust against iframe load ordering
  271. window.addEventListener('load', () => {
  272. const contentFrame = document.getElementById('content-frame');
  273. const src = contentFrame?.getAttribute('src');
  274. if (src) setMiddleActive(src);
  275. const middleFrame = document.getElementById('middle-frame');
  276. if (middleFrame) {
  277. middleFrame.addEventListener('load', () => {
  278. const current = document.getElementById('content-frame')?.getAttribute('src');
  279. if (current) setMiddleActive(current);
  280. });
  281. }
  282. if (contentFrame) {
  283. contentFrame.addEventListener('load', () => {
  284. const current = contentFrame.getAttribute('src');
  285. if (current) setMiddleActive(current);
  286. });
  287. }
  288. });
  289. </script>
  290. </body>
  291. </html>