-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- added flex to popular list - fixed px detection in firefox for border props - added z.style to parsestyle without generating class - removed .style from style object, use z.style instead - simplified error handling and reduced duplication - append string helper args automatically (shorthand override essentially) - removed parser options - added changelog - added eslint config
- Loading branch information
Showing
6 changed files
with
135 additions
and
86 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ | ||
"env": { | ||
"browser": true, | ||
"es6": true | ||
}, | ||
"extends": "eslint:recommended", | ||
"parserOptions": { | ||
"ecmaVersion": 2018, | ||
"sourceType": "module" | ||
}, | ||
"rules": { | ||
"quotes": ["error", "single", { "avoidEscape": true }], | ||
"semi": ["error", "never"], | ||
"no-console": "off", | ||
"prefer-const": "error" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# Changelog | ||
|
||
## 0.7.0 | ||
*2019-08-23* | ||
|
||
**Breaking Changes** | ||
|
||
- removed parser options (BREAK, OPEN, CLOSE) | ||
- removed `.style` property on style objects returned by `z`, use `z.style` instead | ||
|
||
**Enhancements / Bug Fixes** | ||
|
||
- string based helpers will automatically have args appended | ||
- added `z.style` to parse style strings without generating classNames | ||
- added `flex` to popular list | ||
- fixed `px` detection for border properties in firefox |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
import { h, render, Component } from 'https://unpkg.com/[email protected]beta.3/dist/preact.module.js' | ||
import { h, render, Component } from 'https://unpkg.com/[email protected]rc.1/dist/preact.module.js' | ||
import microh from 'https://unpkg.com/microh?module' | ||
// import _z from '../src/index.js' | ||
import _z from '../src/index.js' | ||
// import _z from '../dist/zaftig.min.js' | ||
import _z from 'https://unpkg.com/zaftig@latest?module' | ||
// import _z from 'https://unpkg.com/zaftig@latest?module' | ||
// const _z = window.z | ||
|
||
const m = microh(h) | ||
|
@@ -33,13 +33,12 @@ const fakeZ = _z.new({ | |
id: 'sunboy', | ||
style, | ||
unit: 'rem', | ||
helpers: { sun: 'c orange & fs 100' }, | ||
parser: { OPEN: '[', CLOSE: ']', BREAK: '&' } | ||
helpers: { sun: 'c orange; fs 100' } | ||
}) | ||
fakeZ`sun` | ||
fakeZ` | ||
margin 10 & h 10 | ||
h1, h2 [ m 10 ] | ||
margin 10; h 10 | ||
h1, h2 { m 10 } | ||
` | ||
p(style.sheet.cssRules) | ||
|
||
|
@@ -55,7 +54,8 @@ z.helper({ | |
pad: (num, side = '') => `p${side} ${num * 0.25}rem`, | ||
shadow: num => `box-shadow 0 0 ${num} 0 rgba(0,0,0,0.5)`, | ||
'@med': (x, type) => `@media (${type || 'min'}-width: ${breakpoints[x]})`, | ||
'@lg': '@media (min-width: 1024px)' | ||
'@lg': '@media (min-width: 1024px)', | ||
bo: 'border' | ||
}) | ||
|
||
z.global` | ||
|
@@ -76,6 +76,10 @@ z.global` | |
@lg { | ||
h1 { c yellow } | ||
} | ||
.random { | ||
bo 1 solid white | ||
} | ||
` | ||
|
||
window.z = z | ||
|
@@ -142,7 +146,6 @@ const spin = z.anim` | |
|
||
class App extends Component { | ||
render(_, { count = 0, exp = '', color = '' }) { | ||
const style = z`${exp}` | ||
return m( | ||
'main' + | ||
z` | ||
|
@@ -152,8 +155,10 @@ class App extends Component { | |
pad 6 b | ||
> * { mar 3 b } | ||
> input { ta center } | ||
bc ${color} | ||
`, | ||
{ | ||
style: z.style`bc ${color}` | ||
}, | ||
m( | ||
'h1' + | ||
z` | ||
|
@@ -179,7 +184,7 @@ class App extends Component { | |
}), | ||
m( | ||
'div' + z`pad 2;fs 1.5em;ff monospace;ta center`, | ||
m('p', style.valueOf(), ' = ', style.style || m('em', 'type something')), | ||
m('p', z.style(exp) || m('em', 'type something')), | ||
m( | ||
'p', | ||
'zaftig runtime ', | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters