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