Browse Source

Adds semantic standard explanation page, adds first spec page for button. Continues to modify button class for new ui buttons

Former-commit-id: 8976975829711011988a4c7d2c8f4d1ab4803ba9
Former-commit-id: aae3091297b66ef939685e8b4d80a40abb279c14
beta
Jack Lukic 12 years ago
parent
commit
55abf36b66
  1. 185
      examples/button.html
  2. 119
      examples/example.css
  3. 125
      examples/index.html
  4. 90
      examples/module.html
  5. 59
      examples/reset.css
  6. 57
      examples/ui/button.css
  7. 209
      examples/ui/table.css
  8. 119
      examples/why.html
  9. 72
      src/shape.js

185
examples/button.html

@ -0,0 +1,185 @@
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Semantic Modules</title>
<link rel="stylesheet" href="ui/state.js" type="text/css" media="screen" />
<link rel="stylesheet" href="ui/panel.css" type="text/css" media="screen" />
<link rel="stylesheet" href="ui/button.css" type="text/css" media="screen" />
<link rel="stylesheet" href="ui/table.css" type="text/css" media="screen" />
<link rel="stylesheet" href="../src/shape.css" type="text/css" media="screen" />
<link rel="stylesheet" href="example.css" type="text/css" media="screen" />
<script src="../dependencies/jquery.js" type="text/javascript"></script>
<script src="ui/state.js" type="text/javascript"></script>
<script src="../dependencies/transform2d.js" type="text/javascript"></script>
<script src="../dependencies/transform3d.js" type="text/javascript"></script>
<script src="../src/shape.js" type="text/javascript"></script>
<script src="example.js" type="text/javascript"></script>
</head>
<body id="example">
<div class="container">
<h1>Semantic UI Spec</h1>
<p>Semantic is a set of standards designed to make front end development less arbitrary. This is the definition of a button.</p>
<h2>Button</h2>
<h4>The standard button:</h4>
<div class="ui button">Button</div>
<h2>States</h2>
<h4>Can be hovered:</h4>
<div class="ui hover button">Hovered Button</div>
<h4>Can be pressed in:</h4>
<div class="ui down button">Pressed Button</div>
<h4>Can be active:</p>
<div class="ui active button">Active Button</div>
<h4>Can be disabled:</h4>
<div class="ui disabled button">Disabled Button</div>
<h4>Can show a loading indicator:</h4>
<div class="ui loading button">Loading Button</div>
<h4>Can show a toggled state:</h4>
<div class="ui toggle button">Toggled Button</div>
<h4>Can alert to a succesful action:</h4>
<div class="ui success button">Succesful Button</div>
<h4>Can alert user of an error:</h4>
<div class="ui error button">Succesful Button</div>
<h2>Standard Variations</h2>
<h4>Can have different sizes:</h4>
<div class="mini ui button">
Mini
</div>
<div class="tiny ui button">
Tiny
</div>
<div class="small ui button">
Small
</div>
<div class="medium ui button">
Medium
</div>
<div class="big ui button">
Big
</div>
<div class="huge ui button">
Huge
</div>
<div class="massive ui button">
<i class="icon pin"></i>
Massive
</div>
<div class="gigantic ui button">
<i class="icon pin"></i>
Gigantic
</div>
<h4>Can have different colors:</h4>
<div class="ui blue button">Blue Button</div>
<div class="purple ui button">Purple Button</div>
<div class="green ui button">Green Button</div>
<h4>Can fit parent container:</h4>
<div class="fluid ui button">Fits container</div>
<h2>Buttons (Button Groups)</h2>
<h4>Can exist together as groups</h4>
<div class="ui buttons">
<div class="ui button">One</div>
<div class="ui button">Two</div>
<div class="ui button">Three</div>
</div>
<h4>Variations can modify groups</h4>
<p><b>Blue</b></p>
<div class="blue ui buttons">
<div class="ui button">One</div>
<div class="ui button">Two</div>
<div class="ui button">Three</div>
</div>
<br><br>
<p><b>Large</b></p>
<div class="huge ui buttons">
<div class="ui button">One</div>
<div class="ui button">Two</div>
<div class="ui button">Three</div>
</div>
<h2>Additional Variations</h2>
<h4>Can be formatted to fit just an icon or image:</h4>
<div class="mini icon ui button">
<i class="icon pin"></i>
</div>
<div class="tiny icon ui button">
<i class="icon pin"></i>
</div>
<div class="small icon ui button">
<i class="icon pin"></i>
</div>
<div class="medium icon ui button">
<i class="icon pin"></i>
</div>
<div class="big icon ui button">
<i class="icon pin"></i>
</div>
<div class="huge icon ui button">
<i class="icon pin"></i>
</div>
<div class="massive icon ui button">
<i class="icon pin"></i>
</div>
<div class="gigantic icon ui button">
<i class="icon pin"></i>
</div>
<h4>Can be attached to the top or bottom of other content</h4>
<div class="ui top attached button">Top</div>
<div style="border-left: 1px solid #DDDDDD;border-right: 1px solid #DDDDDD;height:200px;"></div>
<div class="ui bottom attached button">Bottom</div>
<h4>Can be attached to an input field</h4>
<input type="text">
<div class="ui attached button">Search</div>
<h2>States</h2>
<div class="state segment">
<h4>Button States</h4>
<div class="ui button">Normal</div>
<div class="ui button hover">Hover</div>
<div class="ui button down">Down</div>
<div class="ui button loading">Loading</div>
<br><br>
<div class="ui button disabled">Disabled</div>
<div class="ui button active">Active</div>
<div class="ui button active toggle">Toggled</div>
<div class="ui button error">Error</div>
<div class="ui button success">Success</div>
</div>
</div>
</body>
</html>

119
examples/example.css

@ -1,66 +1,8 @@
/*******************************
CSS Reset
Standard Example
*******************************/
html, body, div, form, fieldset, legend, label, ul, li, menu, button {
margin: 0px;
padding: 0px;
background: none;
}
article,
aside,
details,
figcaption,
figure,
footer,
header,
hgroup,
nav,
section {
display: block
}
table {
border-collapse: collapse;
border-spacing: 0px;
}
th, td {
text-align: left;
vertical-align: top;
}
th, td, caption {
font-weight:normal;
margin: 0px;
padding: 0px;
}
img,
iframe {
border: 0px;
}
:focus, input:focus, button:focus, button:active, button:hover {
outline: 0px;
}
button {
display: block;
outline: 0px;
border: 0px;
}
ul, li {
list-style-type: none;
}
p {
margin: 0px;
}
html {
font-size: 100%;
-webkit-text-size-adjust: 100%;
-ms-text-size-adjust: 100%;
}
/*******************************
Example
*******************************/
/* font */
@font-face {
font-family: 'Neutraface';
src:
@ -78,39 +20,81 @@ html {
font-style: normal;
}
#example {
body#example {
font-family: "Neutraface", "Helvetica Neue", "Arial", sans-serif;
background-color: #FCFCFC;
padding-bottom: 150px;
}
/* links */
a {
color: #009FDA;
text-decoration: none;
}
a:hover {
color: #00BAFF;
}
#example h1,
#example h2,
#example h3,
#example h4,
#example h5,
#example a,
#example .ui {
font-family: "Neutraface Bold", "Helvetica Neue", "Arial", sans-serif;
}
/* text and headers */
#example h1 {
margin: 20px 0px 20px;
}
#example h2 {
margin: 60px 0px 20px;
margin: 40px 0px 20px;
}
#example h3 {
font-size: 20px;
margin: 40px 0px 15px;
}
#example h4 {
font-size: 16px;
color: #555555;
}
#example pre {
background-color: #F0F0F0;
}
#example p {
margin: 10px 0px;
}
#example .shortcuts {
float: right;
clear: both;
/* lists */
#example ol {
list-style-position: inside;
margin: 10px 0px 40px;
padding: 0px;
}
#example ol li {
list-style-type: decimal;
margin: 0px 0px 10px;
}
/* content */
#example .container {
width: 1000px;
width: 700px;
margin: 0px auto;
}
#example .shortcuts {
float: right;
clear: both;
}
/*******************************
Shapes Example
*******************************/
#example .demo.shape {
}
@ -159,7 +143,8 @@ html {
height: 100px;
}
#example .demo.rectangle.shape .left.side,
#example .demo.rectangle.shape .right.side {
#example .demo.rectangle.shape .right.side,
#example .demo.rectangle.shape .over.side {
width: 300px;
}

125
examples/index.html

@ -7,6 +7,7 @@
<link rel="stylesheet" href="ui/state.js" type="text/css" media="screen" />
<link rel="stylesheet" href="ui/panel.css" type="text/css" media="screen" />
<link rel="stylesheet" href="ui/button.css" type="text/css" media="screen" />
<link rel="stylesheet" href="ui/table.css" type="text/css" media="screen" />
<link rel="stylesheet" href="../src/shape.css" type="text/css" media="screen" />
@ -29,6 +30,12 @@
<h1>Shape</h1>
<p>Shape is a plugin for 3D transitioning elements. </p>
<p>Shapes makes creating 3D tweens easier by taking care of the dirty business of calculating translations based on content sizing, which can be a confusing, frustrating task.</p>
<p>The module uses 3D transformations which are currently only supported in modern versions of Chrome, Safari, and Firefox.</p>
<p>Shapes is written using the semantic module specification. Semantic is a standard pattern for writing Javascript modules which intends to make understanding new code less confusing, and debugging errors less frustrating, by making coding decisions less arbitrary and more semantic. <a href="#">
<p>Click here to read more</a> about Semantic spec, and the upcoming library.</p>
<h2>Examples</h2>
<h3>Regular Shape</h3>
@ -62,47 +69,147 @@
<div class="ui button" data-animation="flip" data-direction="right">Right</div>
<div class="ui button" data-animation="flip" data-direction="up">Up</div>
<div class="ui button" data-animation="flip" data-direction="down">Down</div>
<div class="ui button" data-animation="flip" data-direction="over">Over</div>
</div>
<h2>Usage</h2>
Usage:
// the plugin must be initialized once before methods can be accessed
The plugin must be initialized once before methods can be accessed
<pre>
<code>
$('.shape')
.shape()
;
<code>
</code>
</pre>
// transion automatically assumed next side is the next sibling (or first if last element)
Transitions automatically assume next side is the next sibling (or first if last element)
<pre>
<code>
$('.shape')
.shape('flip.up')
;
<code>
</code>
</pre>
// to manually set the next side to appear use a selector or jQuery object
To manually set the next side to appear use a selector or jQuery object
<pre>
<code>
$('.shape')
.shape('set.nextSide', '.second')
.shape('flip.up')
;
<code>
</code>
</pre>
// any internal method can be invoked programmatically
Any internal method can be invoked programmatically
<pre>
<code>
$('.shape')
.shape('repaint')
;
<code>
</code>
</pre>
<h2>Settings</h2>
<p>Settings can be modified in three different ways.
<ol>
<li>A settings object can be passed in when initializing the plugin <code>$('.foo').shape({ moduleName: 'Godzilla'});</code>.</li>
<li>Default settings for the module can be overridden by modifying $.fn.shape.settings.</li>
<li>Settings can be changed after a module is initialized by calling the 'settings' method on the module with either a settings object or a name, value pair. <code>$('.foo').shape('setting', 'moduleName', 'Godzilla');</code></li>
</ol>
<p>Settings can also be read programmatically: <code>$('.foo').shape('setting', 'moduleName');</code>
<table class="ui large grid table">
<thead>
<th>Setting Name</th>
<th>Default Value</th>
<td>Usage</th>
</thead>
<tr>
<td>moduleName</td>
<td>Shape</td>
<td>Name used in debug logs</td>
</tr>
<tr>
<td>debug</td>
<td>True</td>
<td>Provides standard debug output to console</td>
</tr>
<tr>
<td>verbose</td>
<td>False</td>
<td>Provides ancillary debug output to console</td>
</tr>
<tr>
<td>namespace</td>
<td>shape</td>
<td>Event namespace. Makes sure module teardown does not effect other events attached to an element.</td>
</tr>
<tr>
<td>beforeChange</td>
<td>None</td>
<td>Callback before side is changed. This context is the new side.</td>
</tr>
<tr>
<td>onChange</td>
<td>None</td>
<td>Callback after side is changed. This context is new side.</td>
</tr>
<tr>
<td>useCSS</td>
<td>True</td>
<td>Not currently supported. Will allow for use of javascript requestAnimationFrame transitions instead of css3 transitions.</td>
</tr>
<tr>
<td>duration</td>
<td>1000ms</td>
<td>Duration of animation (javascript only). To modify animation duration for css simply modify the css property transition-duration.</td>
</tr>
<tr>
<td>easing</td>
<td>easeInOutQuad</td>
<td>Easing equation for animation (javascript only). To modify the easing for css simply modify the css property transition-easing</td>
</tr>
<tr>
<td>errors</td>
<td>
<pre><code>
{
side : 'You tried to switch to a side that does not exist.',
method : 'The method you called is not defined'
}
</code></pre>
</td>
<td>Object containing localized error messages.</td>
</tr>
<tr>
<td>selector</td>
<td>
<pre><code>
{
shape : '.shape',
side : '.side'
}
</code></pre>
</td>
<td>Object containing selectors used by module.</td>
</tr>
<tr>
<td>className</td>
<td>
<pre><code>
{
css : 'css',
animating : 'animating',
hidden : 'hidden',
active : 'active'
}
</code></pre>
</td>
<td>Object containing class names used by module.</td>
</tr>
</table>
</div>
</body>

90
examples/module.html

@ -0,0 +1,90 @@
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Semantic Modules</title>
<link rel="stylesheet" href="ui/state.js" type="text/css" media="screen" />
<link rel="stylesheet" href="ui/panel.css" type="text/css" media="screen" />
<link rel="stylesheet" href="ui/button.css" type="text/css" media="screen" />
<link rel="stylesheet" href="ui/table.css" type="text/css" media="screen" />
<link rel="stylesheet" href="../src/shape.css" type="text/css" media="screen" />
<link rel="stylesheet" href="example.css" type="text/css" media="screen" />
<script src="../dependencies/jquery.js" type="text/javascript"></script>
<script src="ui/state.js" type="text/javascript"></script>
<script src="../dependencies/transform2d.js" type="text/javascript"></script>
<script src="../dependencies/transform3d.js" type="text/javascript"></script>
<script src="../src/shape.js" type="text/javascript"></script>
<script src="example.js" type="text/javascript"></script>
</head>
<body id="example">
<div class="container">
<h1>Semantic</h1>
<p>Semantic is a set of standards designed to make front end development less arbitrary.</p>
<h2>What is Semantic?</h2>
<p>Semantic has two parts. <b>The semantic standard, and the semantic library.</b></p>
<h2>The standard</h2>
<p>The semantic standard attempts to create a standard design pattern for describing static UI components (UI elements), and dynamic UI components (modules).</p>
<p>Static components are things like: menus, columns, grids, tables, buttons, forms. Dynamic components are things like: popups, modals, chat rooms.</p>
<h3>Defining UI</h3>
<p>The DNA of the web is UI. Semantic's goal is to create an exchange format for UI, by architecting a consistent HTML structure and classname usage for defining UI elements.</p>
<p>If as a community we can agree on consistent UI definitions to, for example, describe what a button is, then we can freely share variations of element designs without having to modify our site's structure to match the expectations of the library.</p>
<h4>What's in an element</h4>
<p><b>UI elements definitions are made of 4 parts</b>:
<ol>
<li>A prototype format of an element (A bunny has two long ears and is furry)</li>
<li>A list of states which the element can exist. (A bunny can either be hopping, eating or sitting still)</li>
<li>A definition of the relationship between a plural and singular instance of an element (Three white bunnies are each white)</li>
<li>A definition of possible variations of the element (A bunny can be tall or short and can be friendly or mean)</li>
</ol>
<p>UI elements can be thought of as nouns, and variations as adjectives. Variations should be written in a way which only describe the innate features of that variation, so that variations can be used together without affecting each other.</p>
<h3>I don't know what you're talking about just show me the code</h3>
<p>If you'd like to shortcut any more explanation, check out the standard definition for a UI button for a live example.</p>
<a class="big blue ui button" href="button.html">UI Button Spec</a>
<h2>The library</h2>
<p>The semantic library is a UI library and set of javascript modules which have been written to adhere to the semantic standard.</p>
<p>The aim is to release pieces of the library on a schedule over the course of the next few months. <a href="#">Check out the Semantic library release calendar</a></p>
<h2>Why use Semantic Modules?</h2>
<ol>
<li><b>Puts accessibility first</b>. Although Coffeescript is beautiful, and Angular is smart, Semantic has a different agenda: to be easy to use, and opinionless. Semantic can be thought of more as the <a href="http://en.wikipedia.org/wiki/Aaron_Copland">Aaron Copland</a> of programming libraries. To code in Semantic only requires an understanding of jQuery and Javascript to begin writing code. If you're stuck there are also plenty of examples to help you get started.</li>
<li><b>Is self documenting.</b> Instead of reading through inline comments to determine what a developer is intending, semantic allows developers to pass meaningful debug data where its most useful: the javascript console. This allows you to see the sequence of events that occur in a module , along with useful debug information, like the value of significant variables. If you're in the source code, debug statements also read similarly to code comments which provide context. <a href="#">Show me</a>
<li><b>Designed to separate the arbitrary bits from the core logic of your module.</b> Ever scroll through an unfimiliar library looking for the line of code where they define the ID tag for an expected html structure? Semantic keeps you from ever having to do that again. Developer decisions like metadata, classnames, selectors, and messages are separated from the less arbitrary parts of code. <a href="#">Show me</a> </li>
<li><b>Lets you access anything, and change everything.</b> Methods defined as part of module definitions are all invokable. Semantic also maps from dot notation to their appropriate locations inside the module, allowing developers not to only make flat modules. Settings can be changed at initialization, or after. Module defaults can be changed whenever. <a href="#">Show me</a></li>
<li><b>Plays nice with other libraries</b>. Modules have teardown methods which will remove any bound events or initialized code. Modules also use namespaced events so you can have more flexibility over defining and clearing them</li>
<li><b>Patterns for every need</b>. Semantic has patterns that work well both as a widget factory, and as a single entity.</li>
</ol>
<h2>How to write a module</h2>
<div class="big ui button">View Annotated Source</div>
<ol>
<li>Select the most appropriate design pattern.</li>
<li>Define a settings object.</li>
<li>Define a selector cache.</li>
<li>Add an object literal defining invokable methods for your plugin</li>
<li>You're done!</li>
</ol>
</div>
</body>
</html>

59
examples/reset.css

@ -0,0 +1,59 @@
/*******************************
CSS Reset
*******************************/
html, body, div, form, fieldset, legend, label, ul, li, menu, button {
margin: 0px;
padding: 0px;
background: none;
}
article,
aside,
details,
figcaption,
figure,
footer,
header,
hgroup,
nav,
section {
display: block
}
table {
border-collapse: collapse;
border-spacing: 0px;
}
th, td {
text-align: left;
vertical-align: top;
}
th, td, caption {
font-weight:normal;
margin: 0px;
padding: 0px;
}
img,
iframe {
border: 0px;
}
:focus, input:focus, button:focus, button:active, button:hover {
outline: 0px;
}
button {
display: block;
outline: 0px;
border: 0px;
}
ul, li {
list-style-type: none;
}
p {
margin: 0px;
}
html {
font-size: 100%;
-webkit-text-size-adjust: 100%;
-ms-text-size-adjust: 100%;
}

57
examples/ui/button.css

@ -73,17 +73,38 @@
;
}
/*---------------
Blue Button
----------------*/
.ui.blue.buttons .button,
.ui.blue.button {
background-color: #00B4AC;
color: #FFFFFF;
}
.ui.blue.buttons .button.hover,
.ui.blue.button.hover {
background-color: #F15B40;
}
.ui.blue.buttons .button.down,
.ui.blue.button.down {
background-color: #F15B40;
}
/*---------------
Purple Button
----------------*/
.ui.purple.buttons .button,
.ui.purple.button {
color: #FFFFFF;
background-color: #6E4889;
}
.ui.purple.buttons .button.hover,
.ui.purple.button.hover {
background-color: #62397F;
}
.ui.purple.buttons .button.down,
.ui.purple.button.down {
background-color: #9254BD;
}
@ -176,17 +197,17 @@
.ui.medium.buttons .button,
.ui.medium.button {
font-size: 14px;
padding: 7px 15px;
padding: 7px 20px;
}
.ui.big.buttons .button,
.ui.big.button {
font-size: 16px;
padding: 10px 20px;
padding: 13px 30px;
}
.ui.huge.buttons .button,
.ui.huge.button {
font-size: 18px;
padding: 11px 30px;
padding: 15px 30px;
}
.ui.massive.buttons .button,
.ui.massive.button {
@ -194,14 +215,6 @@
font-size: 24px;
font-weight: bold;
-webkit-border-radius: 30px;
-moz-border-radius: 30px;
border-radius: 30px;
-webkit-box-shadow: 0px 1px 4px 0px rgba(0, 0, 0, 0.1);
-moz-box-shadow: 0px 1px 4px 0px rgba(0, 0, 0, 0.1);
box-shadow: 0px 1px 4px 0px rgba(0, 0, 0, 0.1);
}
.ui.gigantic.buttons .button,
.ui.gigantic.button {
@ -209,14 +222,6 @@
font-size: 30px;
font-weight: bold;
-webkit-border-radius: 30px;
-moz-border-radius: 30px;
border-radius: 30px;
-webkit-box-shadow: 0px 1px 4px 0px rgba(0, 0, 0, 0.1);
-moz-box-shadow: 0px 1px 4px 0px rgba(0, 0, 0, 0.1);
box-shadow: 0px 1px 4px 0px rgba(0, 0, 0, 0.1);
}
@ -355,8 +360,8 @@
/* Button attached to a form element */
input + .ui.attached.button {
display: inline-block;
min-width: 40px;
float: left;
margin: 0px 0px 0px -15px;
height: 14px;
padding: 8px 15px;
@ -375,20 +380,20 @@ input + .ui.attached.button {
}
/*-------------------
Wrapping Style
Attached Style
--------------------*/
.ui.button.wrapping {
.ui.button.attached {
display: block;
}
.ui.button.wrapping.top {
.ui.button.attached.top {
margin-left: -1px;
margin-right: -1px;
-webkit-border-radius: 5px 5px 0px 0px;
-moz-border-radius: 5px 5px 0px 0px;
border-radius: 5px 5px 0px 0px;
}
.ui.button.wrapping.bottom {
.ui.button.attached.bottom {
margin-left: -1px;
margin-right: -1px;
-webkit-border-radius: 0px 0px 5px 5px;
@ -636,8 +641,8 @@ input + .ui.attached.button {
.ui.button.disabled.hover,
.ui.button.disabled.down {
cursor: default;
color: #AAAAAA;
background-color: #F0F0F0 !important;
color: #BBBBBB;
background-color: #F8F8F8 !important;
background-image: none !important;
text-shadow: none !important;

209
examples/ui/table.css

@ -0,0 +1,209 @@
.ui.table {
width: 100%;
border: 1px solid #F0F0F0;
border: 1px solid rgba(0, 0, 0, 0.1);
font-size: 12px;
color: #555555;
text-shadow: 0px 1px 0px rgba(255, 255, 255, 0.9);
}
/* Standard Table Icons */
.ui.table i.icon {
vertical-align: middle;
margin: 0px;
}
.ui.table .star-empty,
.ui.table .star-half,
.ui.table .star {
color: #D9B347;
}
.ui.table tr,
.ui.table td {
border-collapse: collapse;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
-ms-box-sizing: border-box;
box-sizing: border-box;
}
.ui.table thead {
border-bottom: 1px solid #DADADA;
}
.ui.table thead tr {
/*
-webkit-box-shadow: 0 1px 2px -1px rgba(0, 0, 0, 0.53);
-moz-box-shadow: 0 1px 2px -1px rgba(0, 0, 0, 0.53);
box-shadow: 0 1px 2px -1px rgba(0, 0, 0, 0.53);
*/
}
.ui.table td,
.ui.table th {
padding: 6px 10px;
vertical-align: middle;
}
.ui.table th,
.ui.sortable.table th.disabled:hover {
cursor: auto;
background-color: #FAFAFA;
font-weight: bold;
color: #333333;
background: -webkit-linear-gradient(top, #FAFAFA 0px, #F2F2F2 100%);
background: -moz-linear-gradient(top, #FAFAFA 0px, #F2F2F2 100%);
background: -o-linear-gradient(top, #FAFAFA 0px, #F2F2F2 100%);
background: -ms-linear-gradient(top, #FAFAFA 0px, #F2F2F2 100%);
background: linear-gradient(top, #FAFAFA 0px, #F2F2F2 100%);
}
/* Header & Footer Formatting */
.ui.table thead,
.ui.table tfoot {
border: 1px solid rgba(0, 0, 0, 0.1);
font-size: 13px;
}
/* Table Striping */
.ui.table tbody tr:nth-child(2n) {
background-color: rgba(0, 0, 0, 0.02);
}
/*--------------
Variations
---------------*/
/* Grid */
.ui.grid.table tbody tr,
.ui.grid.table tfoot tr {
border: none;
}
.ui.grid.table th {
border: 1px solid #DADADA;
border: 1px solid rgba(0, 0, 0, 0.1);
border-bottom-color: #CCCCCC;
border-bottom-color: rgba(0, 0, 0, 0.2);
-moz-box-shadow: 0px 0px 0px 1px rgba(255, 255, 255, 0.6) inset;
-webkit-box-shadow: 0px 0px 0px 1px rgba(255, 255, 255, 0.6) inset;
box-shadow: 0px 0px 0px 1px rgba(255, 255, 255, 0.6) inset;
}
.ui.grid.table tbody td {
border: 1px solid #E0E0E0;
border-color: rgba(0, 0, 0, 0.1);
}
/* Special Row Types */
.ui.table tr.button td {
padding: 0px;
}
.ui.table tr.button .button {
border: none !important;
-webkit-border-radius: 0px;
-moz-border-radius: 0px;
border-radius: 0px;
}
.ui.table tfoot tr td,
.ui.table tr.emphasis td,
.ui.table tr td.emphasis {
background-color: #F0F0F0;
border: 1px solid #DADADA;
border: 1px solid rgba(0, 0, 0, 0.1);
-moz-box-shadow: 0px 0px 0px 1px rgba(255, 255, 255, 0.6) inset;
-webkit-box-shadow: 0px 0px 0px 1px rgba(255, 255, 255, 0.6) inset;
box-shadow: 0px 0px 0px 1px rgba(255, 255, 255, 0.6) inset;
font-weight: bold;
color: #333333;
}
/* Sortable Table */
.ui.sortable.table th {
cursor: pointer;
color: #555555;
vertical-align: top;
}
.ui.sortable.table th:hover {
background-image: none;
background-color: #F4F4F4;
}
.ui.sortable.table th.sorted {
background-image: none;
background-color: #EEEEEE;
border-color: #CACACA;
border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.4);
border-bottom-width: 2px;
color: #333333;
text-shadow: 0px 1px 0px rgba(255, 255, 255, 0.2);
background: -webkit-linear-gradient(top, #EEEEEE 0px, #E2E2E2 100%);
background: -moz-linear-gradient(top, #EEEEEE 0px, #E2E2E2 100%);
background: -o-linear-gradient(top, #EEEEEE 0px, #E2E2E2 100%);
background: -ms-linear-gradient(top, #EEEEEE 0px, #E2E2E2 100%);
background: linear-gradient(top, #EEEEEE 0px, #E2E2E2 100%);
}
.ui.sortable.table th:after {
display: inline-block;
content: '';
width: 1em;
opacity: 0.5;
margin: 0px 0px 0px 8px;
font-size: 18px;
line-height: 12px;
font-family: 'Icons';
font-style: normal;
font-weight: normal;
text-decoration: inherit;
vertical-align: middle;
vertical-align: calc();
}
.ui.sortable.table th.ascending:after {
content: '\25b4';
}
.ui.sortable.table th.descending:after {
content: '\25be';
}
/* Icons */
.ui.sortable.table th .icon.info-circle {
float: right;
}
/* Red Icons */
.ui.sortable.table td .icon.cancel-circle {
color: #CC3333;
}
/* Green Icons */
.ui.sortable.table td .icon.check,
.ui.sortable.table td .icon.dollar,
.ui.sortable.table td .icon.money {
color: #40D100;
}
/*--------------
Resizes
---------------*/
.ui.large.table {
font-size: 13px;
}
.ui.large.table td,
.ui.large.table th {
padding: 10px 12px;
}

119
examples/why.html

@ -0,0 +1,119 @@
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Semantic Modules</title>
<link rel="stylesheet" href="ui/state.js" type="text/css" media="screen" />
<link rel="stylesheet" href="ui/panel.css" type="text/css" media="screen" />
<link rel="stylesheet" href="ui/button.css" type="text/css" media="screen" />
<link rel="stylesheet" href="ui/table.css" type="text/css" media="screen" />
<link rel="stylesheet" href="../src/shape.css" type="text/css" media="screen" />
<link rel="stylesheet" href="example.css" type="text/css" media="screen" />
<script src="../dependencies/jquery.js" type="text/javascript"></script>
<script src="ui/state.js" type="text/javascript"></script>
<script src="../dependencies/transform2d.js" type="text/javascript"></script>
<script src="../dependencies/transform3d.js" type="text/javascript"></script>
<script src="../src/shape.js" type="text/javascript"></script>
<script src="example.js" type="text/javascript"></script>
</head>
<body id="example">
<div class="container">
<h1 id="the-problem">The problem</h1>
<p>The DNA of the web is user interface but the DNA of websites is HTML</p>
<h2 id="issues-with-html-as-a-building-block-of-websites">Issues with HTML as a building block of websites</h2>
<ul>
<li>Browsers had to write interpreters for web coding languages before the web became universal popular, so the majority of the lasting decisions on the html standard weere made without the foreknowledge of what the web could be, href= 'hypertext reference', 'a' anchor for a web link. Based on naming conventions and suppositions of a small group of decision makers at a particular moment in history.</li>
<li>Additions to HTML standards were done in a legitimately conservate way to preserve compatability and momentum, consistency etc. </li>
<li>Falls into the Prescriptivist/descriptivist trap in linguistics. </li>
<li>Example: Académie française, french institute that acts as a watchguard on the usage of french language, voices opinion to government about the 'corruption' of the language based on common usage, foreign influences, etc. http://en.wikipedia.org/wiki/Acad%C3%A9mie_fran%C3%A7aise#Role_as_authority_on_the_French_language </li>
<li>Another <DFW Article on the subject> http://instruct.westvalley.edu/lafave/DFW_present_tense.html</li>
</ul>
<h3 id="not-completely-semantic">Not completely semantic</h3>
<ul>
<li>Examples: hgroup, ul, li, href, </li>
<li>What would the logical children elements for these elements be?</li>
<li>TR &gt; TD (What is a td anyone know?)</li>
<li>Hgroup &gt; h1 h2 (How does this make sense?)</li>
<li>UL &gt; LI (Why? Who thought of this?)</li>
<li>There's nothing semantic about an hgroup. It' as idiomatic as me referring to a group of people a a pgroup. Maybe over time my friends could get used to me saying this, but why should they?</li>
<li>Who here refers to links as "hypertext references", yet now HREF is codified. And links are 'a' as in short for anchor? </li>
<li>Ok this may be taking things overboard but its to prove a point, that coding language is unconventional</li>
</ul>
<h3 id="incompleteness-compels-developers-to-add-their-own-conventions">Incompleteness compels developers to add their own conventions</h3>
<ul>
<li>Everyone who codes front end knows the possible minefield you encounter when collaborating on a large project.</li>
<li>Every developer is king of their own naming domain, and has idiomatically created their own schemas for naming everything. Everything on the site had at some point to be subjected to their own naming decisions. These decisions could be influenced by personality, culture, what mood their in, etc.</li>
<li>How many ways can we say the same thing? </li>
<li>
<p>Example: A modal has just poped on the screen. What should it be called? </p>
<p>&lt;div id=&quot;modal_visible&quot;&gt; &lt;div id=&quot;login&quot;&gt; &lt;div class=&quot;pop_up_login&quot;&gt;&lt;/div&gt;</p>
</li>
<li>
<p>All of these are correct by nature, but why are we redefining everything? </p>
</li>
</ul>
<h2 id="how-to-fix-the-problem">How to fix the problem</h2>
<h3 id="a-semantic-approach">A semantic approach</h3>
<p>Well if progressing html isnt the future of a re-useable, semantic web than what could be?</p>
<h3 id="whats-good-from-html">What's good from HTML</h3>
<ul>
<li>A good way to approach what's useful is to look at whats used.</li>
<li>People really liked 'ul' and 'li' for explaining grouping. All sorts of things people dont usually think of as lists seem to find representation in html usage as Unordered list is a slightly obtuse concept, but perhaps there's something in the nature of defining a plural and singular relationship.</li>
<li>Classnames appear to be the most useful aspect of code because they allow for everything. A catch-all for all the things html hasnt defined. </li>
</ul>
<h3 id="some-presumptiveness">Some presumptiveness</h3>
<ul>
<li>HTML and CSS are languages used to describe structural relations and appearances, which is a much easier task to accomplish than giving a more abstract explanations of behavior or instructions. </li>
<li>Physical, declarative langauge was one of the first aspects of language to evolve. Think caveman running into a cave and saying "two big tiger". this is enough to convey to the other caveman to run further into the cave. </li>
<li>Language have been selected for and evolved since prehistoric times. Its terse, universal, and selected for by convention and usage not top-down.</li>
<li>How many words do you need in a vocabulary? To read a chinese newspaper you need around 4,000 characters. That's good enough for describing most anything you will encounter or experience. And thats damn near everything in the world! We only need to account for a language and (definition) for a website, which needs a much much smaller subset of language. Maybe even a hundred or so discrete element definitions.</li>
<li>For proof that this concept is viable, and that not all the web is idiosyncratic, and unable to be defined in common ui, look at the success of Twitter's Bootstap library, which paved the way for reusable UI components. </li>
<li>These UI elements can be defined in language anyone can understand. Dropdowns, Modal, Button Groups. These are all parts of the english vernacular that did not exist two decades ago, but miraculously has evolved as language has adapted to fill in the gaps. This is what should inform our naming decisions in code. Usage.</li>
</ul>
<h3 id="how-we-actually-do-the-dirty-business-of-making-a-semantic-standard-for-ui">How we actually do the dirty business of making a semantic standard for ui</h3>
<ul>
<li>Define a set of elements as nouns. "ui button", "ui field" "ui form"</li>
<li>Define a set of modifiers that are universal and carry the same meaning (when appropriate). i.e. if "large" means 20px tall. Then anything that is large should be 20 pixels tall, ex1. "large button", "large header". ex2. red. "grey field", "grey button".</li>
<li>Assume prototypical qualities if no modifiers present. I.e. If i ask you to imagine a bunny, you probably imagine a white furry animal with 2 long ears." without having to imply all those characteristics. In the same way the definition of "button" should account for all the prototypical qualities while the modifiers only the modifying qualities.</li>
<li>Reduce language complexity (KISS) by defining relationships using plural/singular relations. We dont go around saying "there is a large man and a large man and a large man", you just say "There are three large men". in the same way "<div class'two ui buttons">" can define the size and proportions of its children elements more succinctly then classing them all.</li>
<li>Avoid jargon and idiomatic expressions, stick to common usage. (Keep the ego out)</li>
</ul>
<h3 id="once-you-create-a-visual-vocubulary">Once you create a visual vocubulary</h3>
<ul>
<li>If you can define a standard for a button, say that it can be either tiny, small, medium, big, large, huge or gigantic. Or it can be red, yellow, green, or blue. Then the task for a front end developer becomes explaining how this website's definition of a button strays from standard, not redefining what a button is from scratch over and over.<br />
</li>
<li>This task now only requires them redefining the modifiers, not the button element, or any of the causal relationships.</li>
<li>Once a consensus spec is built for user interface. Then modules have predefined ui components to work with. No arbitrary selectors, or redefining ui elements on a module level. If a modal needs a button then it would use</li>
</ul>
<h3 id="as-it-would-exist">As it would exist</h3>
<ul>
<li>Nouns are classnames, modifiers are also classnames</li>
<li>All ui elements are subclass "ui" to avoid collissions. <div class="ui button"></div></li>
</ul>
<h3 id="as-it-might-exist">As it might exist</h3>
<ul>
<li>Nouns are tags and always end in a noun, modifiers precede them.
&lt;two large button&gt;
&lt;button&gt;one&lt;/&gt;
&lt;button&gt;two&lt;/&gt;
&lt;/&gt;</li>
</ul>
<h2 id="why-try-to-fix-this-problem">Why try to fix this problem</h2>
<p>Its important to acknowledge there has been lots of work which has attempted to solve this already. Or to take these techniques at heart when creating a language. The higher order-ness of SQL for example "SELECT FROM TABLE WHERE CONDITION"</p>
<h2 id="make-coding-more-accessible">Make coding more accessible</h2>
<p>There have been numerous make programming accessible, KhanAcademy, Code Academy, meetup groups. Gamification. All these problems are great, but solve the issue of making learning programming more difficult
Tackling the issue of making programming less difficult is a separate issue entirely. This has been tackled in the past from the perspective of gurus helping making programming less difficult for gurus, i.e dart/cofeescript, or less/sass, but has not been tackled much for making languages easier for complete beginners.</p>
<p>stopped writing for time constraints.</p>
</div>
</body>
</html>

72
src/shape.js

@ -42,7 +42,7 @@ $.fn.shape = function(parameters) {
// internal aliases
namespace = settings.namespace,
metadata = settings.metadata,
error = settings.error,
className = settings.className,
module
@ -79,15 +79,13 @@ $.fn.shape = function(parameters) {
;
},
animate: function(propertyObject) {
animate: function(propertyObject, callback) {
module.verbose('Animating box with properties', propertyObject);
var
callback = function() {
callback = callback || function() {
module.reset();
module.set.active();
$.proxy(settings.onChange, $nextSide)();
}
;
};
if(settings.useCSS || 1) {
module.verbose('Using CSS transitions to animate');
$module
@ -187,6 +185,9 @@ $.fn.shape = function(parameters) {
nextSide: function(selector) {
$nextSide = $module.find(selector);
if($nextSide.size() === 0) {
module.error(error.side);
}
module.verbose('Next side manually set to', $nextSide);
},
@ -247,6 +248,16 @@ $.fn.shape = function(parameters) {
return {
transform: 'translateX(' + translate.x + 'px) translateZ(' + translate.z + 'px) rotateY(-90deg)'
};
},
behind: function() {
var
translate = {
x : -(($activeSide.outerWidth() - $nextSide.outerWidth()) / 2)
}
;
return {
transform: 'translateX(' + translate.x + 'px) rotateY(180deg)'
};
}
},
@ -350,6 +361,31 @@ $.fn.shape = function(parameters) {
'transform' : 'rotateY(90deg) translateZ(' + box.depth.next + 'px)'
})
;
},
behind: function() {
var
box = {
origin : ( ( $activeSide.outerWidth() - $nextSide.outerWidth() ) / 2),
depth : {
active : ($nextSide.outerWidth() / 2),
next : ($activeSide.outerWidth() / 2)
}
}
;
module.verbose('Setting the initial animation position as behind', $nextSide, box);
$activeSide
.css({
'transform' : 'rotateY(0deg)'
})
;
$nextSide
.addClass(className.animating)
.css({
'display' : 'block',
'left' : box.origin + 'px',
'transform' : 'rotateY(-180deg)'
})
;
}
},
@ -357,32 +393,44 @@ $.fn.shape = function(parameters) {
up: function() {
module.debug('Flipping up', $nextSide);
module.stage.above();
module.animate( module.getTransform.up(), element);
module.animate( module.getTransform.up() );
},
down: function() {
module.debug('Flipping down', $nextSide);
module.stage.below();
module.animate( module.getTransform.down(), element);
module.animate( module.getTransform.down() );
},
left: function() {
module.debug('Flipping left', $nextSide);
module.stage.left();
module.animate(module.getTransform.left(), element);
module.animate(module.getTransform.left() );
},
right: function() {
module.debug('Flipping right', $nextSide);
module.stage.right();
module.animate(module.getTransform.right(), element);
module.animate(module.getTransform.right() );
},
over: function() {
module.debug('Flipping over', $nextSide);
module.stage.behind();
module.animate(module.getTransform.behind() );
}
},
/* standard module */
setting: function(name, value) {
if(value === undefined) {
if( $.isPlainObject(name) ) {
$.extend(true, settings, name);
}
else if(value === undefined) {
return settings[name];
}
else {
settings[name] = value;
}
},
verbose: function() {
if(settings.verbose) {
@ -492,7 +540,7 @@ $.fn.shape.settings = {
easing : 'easeInOutQuad',
// possible errors
errors: {
error: {
side : 'You tried to switch to a side that does not exist.',
method : 'The method you called is not defined'
},

Loading…
Cancel
Save