frets-styles-generator
Advanced tools
Comparing version 3.1.3 to 4.0.0
@@ -31,3 +31,24 @@ var __create = Object.create; | ||
var import_camel_case = __toModule(require("camel-case")); | ||
const protectedGetters = Object.getOwnPropertyNames(Object.getPrototypeOf("")).concat(["input", "button", "div", "select", "textarea", "label", "div", "$"]); | ||
const protectedGetters = Object.getOwnPropertyNames(Object.getPrototypeOf("")).concat([ | ||
"$", | ||
"a", | ||
"article", | ||
"aside", | ||
"button", | ||
"div", | ||
"div", | ||
"header", | ||
"img", | ||
"input", | ||
"label", | ||
"li", | ||
"nav", | ||
"ol", | ||
"p", | ||
"section", | ||
"select", | ||
"span", | ||
"textarea", | ||
"ul" | ||
]); | ||
async function readFile(opts) { | ||
@@ -34,0 +55,0 @@ const {customPlugins, inputPath, input} = opts; |
@@ -16,3 +16,3 @@ var __defProp = Object.defineProperty; | ||
MouseEventHandler, | ||
Props, | ||
PropsWithRef, | ||
PropsWithChildren, | ||
@@ -28,3 +28,3 @@ ReactElement, | ||
export type BaseStyleArgs<T> = Array< | ||
ReactNode | string | AllHTMLAttributes<T> | Props<T> | boolean | ||
ReactNode | string | AllHTMLAttributes<T> | PropsWithRef<T> | boolean | ||
> | ||
@@ -35,9 +35,9 @@ export const e = React.createElement; | ||
public chain: string[]; | ||
public overrideDisplayNone: boolean = false; | ||
public overrideDisplayInherit: boolean = false; | ||
public overrideDisplayNone = false; | ||
public overrideDisplayInherit = false; | ||
public conditions: boolean[] = []; | ||
public classProps: any = {}; | ||
private writeConditionIndex = 0 | ||
private readConditionIndex: number = 0; | ||
private classObjectMode: boolean = false; | ||
private readConditionIndex = 0; | ||
private classObjectMode = false; | ||
@@ -189,3 +189,3 @@ constructor(selector: string) { | ||
public toString = (): string => { | ||
public toString = (clear = false): string => { | ||
if (this.classObjectMode && this.classProps) { | ||
@@ -201,5 +201,12 @@ for (const [key, value] of Object.entries(this.classProps)) { | ||
} | ||
return this.chain.slice(1).join(" "); | ||
const output = this.chain.slice(1).join(" "); | ||
this.chain = clear ? [this.chain[0]] : this.chain; | ||
return output; | ||
}; | ||
public clear = (): BaseStyles => { | ||
this.chain = []; | ||
return this; | ||
} | ||
public $ = (className: string): BaseStyles => { | ||
@@ -206,0 +213,0 @@ return this.add(className); |
{ | ||
"name": "frets-styles-generator", | ||
"version": "3.1.3", | ||
"version": "4.0.0", | ||
"description": "Tool that generates a Typescript class for hyperscript functions based on a CSS file", | ||
@@ -73,21 +73,8 @@ "main": "build/main/index.js", | ||
"keywords": [ | ||
"async", | ||
"ava", | ||
"await", | ||
"boilerplate", | ||
"conventional-changelog", | ||
"ES6", | ||
"ES7", | ||
"library", | ||
"javascript-modules", | ||
"node", | ||
"nyc", | ||
"rollup", | ||
"starter", | ||
"template", | ||
"tree-shaking", | ||
"tslint", | ||
"typedoc", | ||
"styles", | ||
"classnames", | ||
"typescript", | ||
"typings" | ||
"tailwind", | ||
"generator", | ||
"dev-tool" | ||
], | ||
@@ -100,9 +87,2 @@ "nyc": { | ||
}, | ||
"ava": { | ||
"sources": [ | ||
"test/**/*.js", | ||
"build/**/*.js", | ||
"!build/**/*.spec.js" | ||
] | ||
}, | ||
"release": { | ||
@@ -109,0 +89,0 @@ "branch": "master", |
@@ -24,3 +24,3 @@ <a href="https://www.npmjs.com/package/frets-styles-generator"><img alt="npm" src="https://img.shields.io/npm/v/frets-styles-generator"></a> | ||
`npx frets-styles-generator [input.css] [output.css] -r` (-r flag uses the react template) | ||
`npx frets-styles-generator [input-dir] --react` (--react flag uses the react template for output) | ||
@@ -107,5 +107,3 @@ The first argument you pass to the program will be the directory to scan for CSS files. It defaults to "./src" if you leave the argument out. Each CSS file that is found will be run through postcss (utilizing the [postcss-import](https://github.com/postcss/postcss-import) plugin by default) and then turned into a .ts file like [orginialFilename-styles.ts] based on the template specified. The default template is for [maquette](https://github.com/AFASSoftware/maquette) hyperscript functions. | ||
```ts | ||
$.div.h( | ||
$onClick( () => setMyValue('') )( $LinkBtn.secondary, 'Clear' ), | ||
) | ||
$.div.h($onClick(() => setMyValue(""))($LinkBtn.secondary, "Clear")); | ||
``` | ||
@@ -118,7 +116,7 @@ | ||
```ts | ||
$formOnSubmit( () => setShowList(true) ).flex.flexCol.itemsStretch.h( | ||
TextInput(registerField('Username')), | ||
TextInput(registerField('Password')), | ||
$Btn.primary.mt_2.h('Log In') | ||
) | ||
$formOnSubmit(() => setShowList(true)).flex.flexCol.itemsStretch.h( | ||
TextInput(registerField("Username")), | ||
TextInput(registerField("Password")), | ||
$Btn.primary.mt_2.h("Log In") | ||
); | ||
``` | ||
@@ -125,0 +123,0 @@ |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
8268902
293998
176