You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

577 lines
19 KiB

  1. ---
  2. layout : 'default'
  3. css : 'shape'
  4. title : 'Shape'
  5. description : 'A shape is a three dimensional object displayed on a two dimensional plane'
  6. type : 'UI Module'
  7. ---
  8. <script src="/javascript/shape.js"></script>
  9. <%- @partial('header', { tabs: 'module' }) %>
  10. <div class="main container">
  11. <div class="ui tab" data-tab="definition">
  12. <div class="peek">
  13. <div class="ui vertical pointing secondary menu">
  14. <a class="active item">Types</a>
  15. <a class="item">States</a>
  16. </div>
  17. </div>
  18. <h2 class="ui dividing header">Types</h2>
  19. <div class="example">
  20. <h4 class="ui header">Shape</h4>
  21. <p>A standard shape</p>
  22. <div class="ui warning icon message">
  23. <i class="info letter icon"></i>
  24. <div class="content">
  25. <div class="header">Using Shapes</div>
  26. <ul class="list">
  27. <li>A shape must have defined width and heights for each side or else text flow may change during animation</li>
  28. <li>The module uses 3D transformations which are currently only supported in modern versions of Chrome, Safari, and Firefox.</li>
  29. </ul>
  30. </div>
  31. </div>
  32. <div class="code" data-type="html">
  33. <div class="ui shape">
  34. <div class="sides">
  35. <div class="active side">This side starts visible.</div>
  36. <div class="side">This is yet another side</div>
  37. <div class="side">This is the last side</div>
  38. </div>
  39. </div>
  40. </div>
  41. </div>
  42. <div class="example">
  43. <h4 class="ui header">Cube</h4>
  44. <p>A cube shape is formatted so that each side is the face of a cube</p>
  45. <div class="ui ignored info message">Content must be included inside <code>.content .center</code> to display centered on a cube's side</div>
  46. <div class="ui cube shape">
  47. <div class="sides">
  48. <div class="active side">
  49. <div class="content">
  50. <div class="center">
  51. 1
  52. </div>
  53. </div>
  54. </div>
  55. <div class="side">
  56. <div class="content">
  57. <div class="center">
  58. 2
  59. </div>
  60. </div>
  61. </div>
  62. <div class="side">
  63. <div class="content">
  64. <div class="center">
  65. 3
  66. </div>
  67. </div>
  68. </div>
  69. <div class="side">
  70. <div class="content">
  71. <div class="center">
  72. 4
  73. </div>
  74. </div>
  75. </div>
  76. <div class="side">
  77. <div class="content">
  78. <div class="center">
  79. 5
  80. </div>
  81. </div>
  82. </div>
  83. <div class="side">
  84. <div class="content">
  85. <div class="center">
  86. 6
  87. </div>
  88. </div>
  89. </div>
  90. </div>
  91. </div>
  92. <div class="ui divider"></div>
  93. <div class="ui icon direction buttons">
  94. <div class="ui button" data-animation="flip" title="Flip Left" data-direction="left"><i class="left long arrow icon"></i></div>
  95. <div class="ui button" data-animation="flip" title="Flip Up" data-direction="up"><i class="up long arrow icon"></i></div>
  96. <div class="ui icon button" data-animation="flip" title="Flip Down" data-direction="down"><i class="down long arrow icon"></i></div>
  97. <div class="ui icon button" data-animation="flip" title="Flip Right" data-direction="right"><i class="right long arrow icon"></i></div>
  98. </div>
  99. <div class="ui icon direction buttons">
  100. <div class="ui button" title="Flip Over" data-animation="flip" data-direction="over"><i class="retweet icon"></i></div>
  101. <div class="ui button" title="Flip Back" data-animation="flip" data-direction="back"><i class="flipped retweet icon"></i></div>
  102. </div>
  103. </div>
  104. <div class="example">
  105. <h4 class="ui header">Text</h4>
  106. <p>A text shape is formatted to allow for sides of text to be displayed</p>
  107. <div class="ui text shape">
  108. <div class="sides">
  109. <div class="active ui header side">Did you know? This side starts visible.</div>
  110. <div class="ui header side">Help, its another side!</div>
  111. <div class="ui header side">This is the last side</div>
  112. </div>
  113. </div>
  114. <div class="ui divider"></div>
  115. <div class="ui icon direction buttons">
  116. <div class="ui button" data-animation="flip" title="Flip Left" data-direction="left"><i class="left long arrow icon"></i></div>
  117. <div class="ui button" data-animation="flip" title="Flip Up" data-direction="up"><i class="up long arrow icon"></i></div>
  118. <div class="ui icon button" data-animation="flip" title="Flip Down" data-direction="down"><i class="down long arrow icon"></i></div>
  119. <div class="ui icon button" data-animation="flip" title="Flip Right" data-direction="right"><i class="right long arrow icon"></i></div>
  120. </div>
  121. <div class="ui icon direction buttons">
  122. <div class="ui button" title="Flip Over" data-animation="flip" data-direction="over"><i class="retweet icon"></i></div>
  123. <div class="ui button" title="Flip Back" data-animation="flip" data-direction="back"><i class="flipped retweet icon"></i></div>
  124. </div>
  125. </div>
  126. </div>
  127. <div class="ui tab" data-tab="examples">
  128. <div class="no example">
  129. <h3 class="ui header">Shape Types</h3>
  130. <p>Shapes do not have to be regular or have its sides match up in length and width to animate correctly.</p>
  131. <div class="demo rectangle ui shape">
  132. <div class="sides">
  133. <div class="active jira side">
  134. <img src="/images/shape/jira.png">
  135. </div>
  136. <div class="heroku side">
  137. <img src="/images/shape/heroku.png">
  138. </div>
  139. <div class="quirky side">
  140. <img src="/images/shape/quirky.png">
  141. </div>
  142. </div>
  143. </div>
  144. <h3 class="ui header">Shape</h3>
  145. <div class="ui type buttons">
  146. <div class="active ui button" data-shape="rectangle">Rectangle</div>
  147. <div class="ui button" data-shape="square">Square</div>
  148. <div class="ui button" data-shape="irregular">Irregular</div>
  149. </div>
  150. <div class="ui divider"></div>
  151. <div class="ui icon direction buttons">
  152. <div class="ui button" data-animation="flip" title="Flip Left" data-direction="left"><i class="left long arrow icon"></i></div>
  153. <div class="ui button" data-animation="flip" title="Flip Up" data-direction="up"><i class="up long arrow icon"></i></div>
  154. <div class="ui icon button" data-animation="flip" title="Flip Down" data-direction="down"><i class="down long arrow icon"></i></div>
  155. <div class="ui icon button" data-animation="flip" title="Flip Right" data-direction="right"><i class="right long arrow icon"></i></div>
  156. </div>
  157. <div class="ui icon direction buttons">
  158. <div class="ui button" title="Flip Over" data-animation="flip" data-direction="over"><i class="retweet icon"></i></div>
  159. <div class="ui button" title="Flip Back" data-animation="flip" data-direction="back"><i class="flipped retweet icon"></i></div>
  160. </div>
  161. </div>
  162. <div class="ui clearing section divider"></div>
  163. <h3 class="ui header">Shape with Content</h3>
  164. <p>Any type of element can be used as a side of a shape.</p>
  165. <div class="dog ui shape">
  166. <div class="sides">
  167. <div class="active side">
  168. <div class="ui items">
  169. <div class="item">
  170. <div class="image">
  171. <a class="ui like corner label">
  172. <i class="like icon"></i>
  173. </a>
  174. <img src="/images/demo/highres2.jpg">
  175. </div>
  176. <div class="content">
  177. <div class="name">Cute Dog</div>
  178. <p class="description">This dog has some things going for it. Its pretty cute and looks like it'd be fun to cuddle up with.</p>
  179. </div>
  180. </div>
  181. </div>
  182. </div>
  183. <div class="side">
  184. <div class="ui items">
  185. <div class="item">
  186. <div class="image">
  187. <a class="ui like corner label">
  188. <i class="like icon"></i>
  189. </a>
  190. <img src="/images/demo/highres5.jpg">
  191. </div>
  192. <div class="content">
  193. <div class="name">Silly Dog</div>
  194. <p class="description">Silly dogs can be quite fun to have as companions. You never know what kind of ridiculous thing they will do.</p>
  195. </div>
  196. </div>
  197. </div>
  198. </div>
  199. <div class="side">
  200. <div class="ui items">
  201. <div class="item">
  202. <div class="image">
  203. <a class="ui like corner label">
  204. <i class="like icon"></i>
  205. </a>
  206. <img src="/images/demo/highres4.jpg">
  207. </div>
  208. <div class="content">
  209. <div class="meta">5 days ago</div>
  210. <div class="name">Faithful Dog</div>
  211. <p class="description">Sometimes its more important to have a dog you know you can trust. But not every dog is trustworthy, you can tell by looking at its smile.</p>
  212. </div>
  213. </div>
  214. </div>
  215. </div>
  216. </div>
  217. </div>
  218. <div class="dog ui shape">
  219. <div class="sides">
  220. <div class="active side">
  221. <div class="ui items">
  222. <div class="item">
  223. <div class="image">
  224. <a class="ui like corner label">
  225. <i class="like icon"></i>
  226. </a>
  227. <img src="/images/demo/highres.jpg">
  228. </div>
  229. <div class="content">
  230. <div class="name">Cute Dog</div>
  231. <p class="description">This dog has some things going for it. Its pretty cute and looks like it'd be fun to cuddle up with.</p>
  232. </div>
  233. </div>
  234. </div>
  235. </div>
  236. <div class="side">
  237. <div class="ui items">
  238. <div class="item">
  239. <div class="image">
  240. <a class="ui like corner label">
  241. <i class="like icon"></i>
  242. </a>
  243. <img src="/images/demo/highres4.jpg">
  244. </div>
  245. <div class="content">
  246. <div class="name">Silly Dog</div>
  247. <p class="description">Silly dogs can be quite fun to have as companions. You never know what kind of ridiculous thing they will do.</p>
  248. </div>
  249. </div>
  250. </div>
  251. </div>
  252. <div class="side">
  253. <div class="ui items">
  254. <div class="item">
  255. <div class="image">
  256. <a class="ui like corner label">
  257. <i class="like icon"></i>
  258. </a>
  259. <img src="/images/demo/highres6.jpg">
  260. </div>
  261. <div class="content">
  262. <div class="meta">5 days ago</div>
  263. <div class="name">Faithful Dog</div>
  264. <p class="description">Sometimes its more important to have a dog you know you can trust. But not every dog is trustworthy, you can tell by looking at its smile.</p>
  265. </div>
  266. </div>
  267. </div>
  268. </div>
  269. </div>
  270. </div>
  271. <div class="ui clearing divider"></div>
  272. <div class="code" data-demo="true">
  273. $('.dog.shape')
  274. .eq(0)
  275. .shape('flip over')
  276. .end()
  277. .eq(1)
  278. .shape('flip back')
  279. ;
  280. </div>
  281. </div>
  282. <div class="ui tab" data-tab="usage">
  283. <h2 class="ui dividing header">Getting Started</h2>
  284. <p>Initializing a shape</p>
  285. <div class="code">
  286. $('.shape').shape();
  287. </div>
  288. <p>Transitions automatically assume next side is the next sibling (or first if last element)</p>
  289. <div class="code">
  290. $('.shape').shape('flip up');
  291. </div>
  292. <p>To manually set the next side to appear use a selector or jQuery object</p>
  293. <div class="code">
  294. $('.shape')
  295. .shape('set next side', '.second.side')
  296. .shape('flip up')
  297. ;
  298. </div>
  299. <p>Any internal method can be invoked programmatically</p>
  300. <div class="code">
  301. $('.shape').shape('repaint');
  302. </div>
  303. <h2 class="ui dividing header">Behavior</h2>
  304. <p>All the following <a href="/module.html#/behavior">behaviors</a> can be called using the syntax:</p>
  305. <div class="code">
  306. $('.your.element')
  307. .shape('behavior name', argumentOne, argumentTwo)
  308. ;
  309. </div>
  310. <table class="ui definition sortable celled table segment">
  311. <thead>
  312. <th>Behavior</th>
  313. <th>Description</th>
  314. </thead>
  315. <tbody>
  316. <tr>
  317. <td>flip up</td>
  318. <td>Flips the shape upward</td>
  319. </tr>
  320. <tr>
  321. <td>flip down</td>
  322. <td>Flips the shape downward</td>
  323. </tr>
  324. <tr>
  325. <td>flip right</td>
  326. <td>Flips the shape right</td>
  327. </tr>
  328. <tr>
  329. <td>flip left</td>
  330. <td>Flips the shape left</td>
  331. </tr>
  332. <tr>
  333. <td>flip over</td>
  334. <td>Flips the shape over clock-wise</td>
  335. </tr>
  336. <tr>
  337. <td>flip back</td>
  338. <td>Flips the shape over counter-clockwise</td>
  339. </tr>
  340. <tr>
  341. <td>set next side(selector)</td>
  342. <td>Set the next side to a specific selector</td>
  343. </tr>
  344. <tr>
  345. <td>is animating</td>
  346. <td>Returns whether shape is currently animating</td>
  347. </tr>
  348. <tr>
  349. <td>reset</td>
  350. <td>Removes all inline styles</td>
  351. </tr>
  352. <tr>
  353. <td>queue(animation)</td>
  354. <td>Queues an animationtill after current animation</td>
  355. </tr>
  356. <tr>
  357. <td>repaint</td>
  358. <td>Forces a reflow on element</td>
  359. </tr>
  360. <tr>
  361. <td>set default side</td>
  362. <td>Set the next side to next sibling to active element</td>
  363. </tr>
  364. <tr>
  365. <td>set stage size</td>
  366. <td>Sets shape to the content size of the next side</td>
  367. </tr>
  368. <tr>
  369. <td>refresh</td>
  370. <td>Refreshes the selector cache for element sides</td>
  371. </tr>
  372. <tr>
  373. <td>get transform down</td>
  374. <td>Returns translation for next side staged below</td>
  375. </tr>
  376. <tr>
  377. <td>get transform left</td>
  378. <td>Returns translation for next side staged left</td>
  379. </tr>
  380. <tr>
  381. <td>get transform right</td>
  382. <td>Returns translation for next side staged right</td>
  383. </tr>
  384. <tr>
  385. <td>get transform up</td>
  386. <td>Returns translation for next side staged up</td>
  387. </tr>
  388. <tr>
  389. <td>get transform down</td>
  390. <td>Returns translation for next side staged down</td>
  391. </tr>
  392. </tbody>
  393. </table>
  394. </div>
  395. <div class="ui tab" data-tab="settings">
  396. <h3 class="ui header">
  397. Shape Settings
  398. <div class="sub header">Shape settings modify the shape's behavior</div>
  399. </h3>
  400. <table class="ui celled sortable definition table segment">
  401. <thead>
  402. <th>Setting</th>
  403. <th class="four wide">Default</th>
  404. <th>Description</th>
  405. </thead>
  406. <tbody>
  407. <tr>
  408. <td>duration</td>
  409. <td>700ms</td>
  410. <td>Duration of side change animation</td>
  411. </tr>
  412. </tbody>
  413. </table>
  414. <div class="ui horizontal section divider"><i class="icon setting"></i></div>
  415. <h3 class="ui header">
  416. Callbacks
  417. <div class="sub header">Callbacks specify a function to occur after a specific behavior.</div>
  418. </h3>
  419. <table class="ui celled sortable definition table segment">
  420. <thead>
  421. <th class="four wide">Setting</th>
  422. <th>Context</th>
  423. <th>Description</th>
  424. </thead>
  425. <tbody>
  426. <tr>
  427. <td>beforeChange</td>
  428. <td>Next Side</td>
  429. <td>Is called before side change</td>
  430. </tr>
  431. <tr>
  432. <td>onChange</td>
  433. <td>Active Side</td>
  434. <td>Is called after visible side change</td>
  435. </tr>
  436. </tbody>
  437. </table>
  438. <div class="ui horizontal section divider"><i class="icon setting"></i></div>
  439. <h3 class="ui header">
  440. DOM Settings
  441. <div class="sub header">DOM settings specify how this module should interface with the DOM</div>
  442. </h3>
  443. <table class="ui celled sortable definition table segment">
  444. <thead>
  445. <th>Setting</th>
  446. <th class="four wide">Default</th>
  447. <th>Description</th>
  448. </thead>
  449. <tbody>
  450. <tr>
  451. <td>namespace</td>
  452. <td>shape</td>
  453. <td>Event namespace. Makes sure module teardown does not effect other events attached to an element.</td>
  454. </tr>
  455. <tr>
  456. <td>selector</td>
  457. <td colspan="2">
  458. <div class="code">
  459. selector : {
  460. sides : '.sides',
  461. side : '.side'
  462. }
  463. </div>
  464. </td>
  465. </tr>
  466. <tr>
  467. <td>className</td>
  468. <td colspan="2">
  469. <div class="code">
  470. className : {
  471. animating : 'animating',
  472. hidden : 'hidden',
  473. loading : 'loading',
  474. active : 'active'
  475. }
  476. </div>
  477. </td>
  478. </tr>
  479. </tbody>
  480. </table>
  481. <div class="ui horizontal section divider"><i class="icon setting"></i></div>
  482. <h3 class="ui header">
  483. Debug Settings
  484. <div class="sub header">Debug settings controls debug output to the console</div>
  485. </h3>
  486. <table class="ui celled sortable definition table segment">
  487. <thead>
  488. <th>Setting</th>
  489. <th class="four wide">Default</th>
  490. <th>Description</th>
  491. </thead>
  492. <tbody>
  493. <tr>
  494. <td>name</td>
  495. <td>Shape</td>
  496. <td>Name used in debug logs</td>
  497. </tr>
  498. <tr>
  499. <td>debug</td>
  500. <td>True</td>
  501. <td>Provides standard debug output to console</td>
  502. </tr>
  503. <tr>
  504. <td>performance</td>
  505. <td>True</td>
  506. <td>Provides standard debug output to console</td>
  507. </tr>
  508. <tr>
  509. <td>verbose</td>
  510. <td>True</td>
  511. <td>Provides ancillary debug output to console</td>
  512. </tr>
  513. <tr>
  514. <td>error</td>
  515. <td colspan="2">
  516. <div class="code">
  517. error: {
  518. side : 'You tried to switch to a side that does not exist.',
  519. method : 'The method you called is not defined'
  520. }
  521. </div>
  522. </td>
  523. </tr>
  524. </tbody>
  525. </table>
  526. </div>
  527. </div>
  528. </body>
  529. </html>