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.

583 lines
19 KiB

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