1
0
mirror of https://github.com/yldio/copilot.git synced 2024-11-28 06:00:06 +02:00

chore: restore removed packages

This commit is contained in:
Sérgio Ramos 2017-06-16 21:46:36 +01:00
parent 18be101068
commit 871893598f
67 changed files with 23867 additions and 35 deletions

View File

@ -87,8 +87,5 @@
"portal-api",
"control-tower"
]
},
"dependencies": {
"styled-components": "^2.0.0"
}
}

View File

@ -0,0 +1,3 @@
{
"extends": "joyent-portal"
}

View File

@ -0,0 +1,9 @@
{
"libs": [
"ecmascript"
],
"plugins": {
"doc_comment": true,
"local-scope": true
}
}

View File

@ -0,0 +1,30 @@
# babel-preset-joyent-portal
[![License: MPL 2.0](https://img.shields.io/badge/License-MPL%202.0-brightgreen.svg)](https://opensource.org/licenses/MPL-2.0)
[![standard-readme compliant](https://img.shields.io/badge/standard--readme-OK-green.svg)](https://github.com/RichardLitt/standard-readme)
[`babel`](http://github.com/babel/babel) preset to be used across this repo. At the moment it only extends the one used by [`create-react-app`](https://github.com/facebookincubator/create-react-app/tree/master/packages/babel-preset-react-app) but it can be extended as needed.
## Table of Contents
- [Install](#install)
- [Usage](#usage)
- [License](#license)
## Install
```
yarn add --dev babel-preset-joyent-portal
```
## Usage
```json
{
"presets": "joyent-portal"
}
```
## License
MPL-2.0

View File

@ -0,0 +1,3 @@
module.exports = (ctx, opts) => ({
presets: [require('babel-preset-react-app')]
});

View File

@ -0,0 +1,20 @@
{
"name": "babel-preset-joyent-portal",
"version": "1.0.3",
"license": "MPL-2.0",
"repository": "github:yldio/joyent-portal",
"main": "index.js",
"scripts": {
"lint": "eslint . --fix",
"lint-ci": "eslint . --format junit --output-file $CIRCLE_TEST_REPORTS/lint/babel-preset-joyent-portal.xml",
"test": "echo 0",
"test-ci": "echo 0"
},
"dependencies": {
"babel-preset-react-app": "^3.0.0"
},
"devDependencies": {
"eslint": "^4.0.0",
"eslint-config-joyent-portal": "1.0.3"
}
}

File diff suppressed because it is too large Load Diff

View File

@ -24,6 +24,6 @@
},
"devDependencies": {
"eslint": "^4.0.0",
"eslint-config-joyent-portal": "1.0.0"
"eslint-config-joyent-portal": "1.0.3"
}
}

View File

@ -27,7 +27,7 @@
"joyent-manifest-editor": "^1.0.0",
"joyent-ui-toolkit": "^1.1.0",
"lodash.isstring": "^4.0.1",
"normalized-styled-components": "^1.0.5",
"normalized-styled-components": "^1.0.8",
"param-case": "^2.1.1",
"prop-types": "^15.5.10",
"react": "^15.6.1",
@ -43,13 +43,13 @@
"redux-actions": "^2.0.3",
"redux-batched-actions": "^0.2.0",
"redux-form": "^6.8.0",
"remcalc": "^1.0.5",
"remcalc": "^1.0.8",
"reselect": "^3.0.1",
"simple-statistics": "^4.1.0",
"styled-components": "^2.1.0",
"styled-is": "^1.0.7",
"styled-is": "^1.0.11",
"styled-text-spinners": "^1.0.1",
"unitcalc": "^1.0.5"
"unitcalc": "^1.0.8"
},
"devDependencies": {
"apr-find": "^1.0.5",
@ -57,10 +57,10 @@
"apr-main": "^1.0.7",
"babel-plugin-inline-react-svg": "^0.4.0",
"babel-plugin-styled-components": "^1.1.4",
"babel-preset-joyent-portal": "^1.0.0",
"babel-preset-joyent-portal": "^1.0.3",
"cross-env": "^5.0.1",
"eslint": "^4.0.0",
"eslint-config-joyent-portal": "1.0.0",
"eslint-config-joyent-portal": "1.0.3",
"jest": "^20.0.4",
"jest-alias-preprocessor": "^1.1.1",
"jest-cli": "^20.0.4",

View File

@ -28,7 +28,7 @@
},
"devDependencies": {
"eslint": "^4.0.0",
"eslint-config-joyent-portal": "1.0.0",
"eslint-config-joyent-portal": "1.0.3",
"nodemon": "^1.11.0"
}
}

View File

@ -14,6 +14,6 @@
"dependencies": {},
"devDependencies": {
"eslint": "^4.0.0",
"eslint-config-joyent-portal": "1.0.0"
"eslint-config-joyent-portal": "1.0.3"
}
}

View File

@ -12,6 +12,6 @@
},
"devDependencies": {
"eslint": "^4.0.0",
"eslint-config-joyent-portal": "1.0.0"
"eslint-config-joyent-portal": "1.0.3"
}
}

View File

@ -16,7 +16,7 @@
"devDependencies": {
"code": "^4.1.0",
"eslint": "^4.0.0",
"eslint-config-joyent-portal": "1.0.0",
"eslint-config-joyent-portal": "1.0.3",
"js-yaml": "^3.8.4",
"lab": "^14.0.1"
}

View File

@ -1,6 +1,6 @@
{
"name": "eslint-config-joyent-portal",
"version": "1.0.0",
"version": "1.0.3",
"license": "MPL-2.0",
"repository": "github:yldio/joyent-portal",
"main": "index.js",

View File

@ -30,7 +30,7 @@
"babel-preset-react-app": "^3.0.0",
"bup": "^1.0.9",
"eslint": "^4.0.0",
"eslint-config-joyent-portal": "1.0.0",
"eslint-config-joyent-portal": "1.0.3",
"jest": "^20.0.4",
"react": "^15.6.1",
"react-test-renderer": "^15.6.1",

View File

@ -0,0 +1,13 @@
{
"sourceMaps": "inline",
"plugins": [
"styled-components"
],
"env": {
"test": {
"presets": [
"react-app"
]
}
}
}

View File

@ -0,0 +1,3 @@
.nyc_output
coverage
dist

View File

@ -0,0 +1,3 @@
{
"extends": "joyent-portal"
}

View File

@ -0,0 +1,5 @@
{
"syntax": "scss",
"processors": ["stylelint-processor-styled-components"],
"extends": ["stylelint-config-standard", "stylelint-config-primer"]
}

View File

@ -0,0 +1,10 @@
{
"libs": [
"ecmascript"
],
"plugins": {
"doc_comment": true,
"local-scope": true,
"node": true
}
}

View File

@ -0,0 +1,13 @@
# Change Log
All notable changes to this project will be documented in this file.
See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
<a name="1.0.5"></a>
## 1.0.5 (2017-05-25)
<a name="1.0.4"></a>
## 1.0.4 (2017-05-25)

View File

@ -0,0 +1,64 @@
# normalized-styled-components
[![License: MPL 2.0](https://img.shields.io/badge/License-MPL%202.0-brightgreen.svg)](https://opensource.org/licenses/MPL-2.0)
[![npm](https://img.shields.io/npm/v/normalized-styled-components.svg)](https://npmjs.com/package/normalized-styled-components)
[![standard-readme compliant](https://img.shields.io/badge/standard--readme-OK-green.svg)](https://github.com/RichardLitt/standard-readme)
[`normalize.css`](https://github.com/necolas/normalize.css) with a [`styled-components`](https://github.com/styled-components/styled-components) mindset.
## Table of Contents
- [Install](#install)
- [Usage](#usage)
- [License](#license)
## Install
```
yarn add --dev normalized-styled-components
```
## Usage
```js
import { Button } from 'normalized-styled-components';
export default () => (
<Button>Click Here!</Button>
)
```
```css
.jdhBdT {
font-family: sans-serif;
font-size: 100%;
line-height: 1.15;
margin: 0;
overflow: visible;
text-transform: none;
appearance: button;
-moz-appearance: button;
-webkit-appearance: button;
}
.jdhBdT::-moz-focus-inner,
.jdhBdT[type="button"]::-moz-focus-inner,
.jdhBdT[type="reset"]::-moz-focus-inner,
.jdhBdT[type="submit"]::-moz-focus-inner {
border-style: none;
padding: 0;
}
.jdhBdT:-moz-focusring,
.jdhBdT[type="button"]:-moz-focusring,
.jdhBdT[type="reset"]:-moz-focusring,
.jdhBdT[type="submit"]:-moz-focusring {
outline: 0.0625rem dotted ButtonText;
}
```
```html
<button className="bgTKnx">Click Here!</button>
```
## License
MPL-2.0

View File

@ -0,0 +1,79 @@
{
"name": "normalized-styled-components",
"version": "1.0.8",
"license": "MPL-2.0",
"description": "normalize.css with a styled-components mindset",
"keywords": [
"normalizations",
"style",
"css",
"react",
"css",
"css-in-js",
"styled-components"
],
"repository": "github:yldio/joyent-portal",
"main": "dist/normalized-styled-components.umd.js",
"jsnext:main": "dist/normalized-styled-components.es.js",
"module": "dist/normalized-styled-components.es.js",
"entry": "src/index.js",
"scripts": {
"lint:css": "echo 0",
"lint-ci:css": "echo 0",
"lint:js": "eslint . --fix",
"lint-ci:js": "eslint . --format junit --output-file $CIRCLE_TEST_REPORTS/lint/normalized-styled-components.xml",
"lint": "redrun -s lint:*",
"lint-ci": "redrun -p lint-ci:*",
"test": "bup && NODE_ENV=test jest --coverage",
"test-ci": "NODE_ENV=test JEST_JUNIT_OUTPUT=$CIRCLE_TEST_REPORTS/test/normalized-styled-components.xml jest --coverage --coverageDirectory=$CIRCLE_ARTIFACTS/normalized-styled-components --testResultsProcessor=$(node -e \"console.log(require.resolve('jest-junit'))\")",
"build": "bup",
"prepublish": "redrun build"
},
"dependencies": {
"remcalc": "^1.0.8"
},
"devDependencies": {
"babel-plugin-styled-components": "^1.1.4",
"babel-preset-react-app": "^3.0.0",
"bup": "^1.0.9",
"chalk": "^1.1.3",
"eslint": "^4.0.0",
"eslint-config-joyent-portal": "1.0.3",
"jest": "^20.0.4",
"jest-diff": "^20.0.3",
"jest-junit": "^1.5.1",
"jest-matcher-utils": "^20.0.3",
"jest-snapshot": "^20.0.3",
"jest-styled-components": "^3.0.2",
"react": "^15.6.1",
"react-scripts": "^1.0.7",
"react-test-renderer": "^15.6.1",
"redrun": "^5.9.15",
"strip-ansi": "^3.0.1",
"styled-components": "^2.1.0",
"stylelint": "^7.11.1",
"stylelint-config-primer": "^1.4.0",
"stylelint-config-standard": "^16.0.0",
"stylelint-processor-styled-components": "styled-components/stylelint-processor-styled-components#68b4c4f"
},
"peerDependencies": {
"react": "*",
"styled-components": "*"
},
"jest": {
"testEnvironment": "jsdom",
"testRegex": "test/index.js",
"setupFiles": [
"<rootDir>/node_modules/react-scripts/config/polyfills.js"
],
"testEnvironment": "node",
"transform": {
"^.+\\.(js|jsx)$": "<rootDir>/node_modules/react-scripts/config/jest/babelTransform.js",
"^(?!.*\\.(js|jsx|css|json)$)": "<rootDir>/node_modules/react-scripts/config/jest/fileTransform.js"
},
"transformIgnorePatterns": [
"[/\\\\]node_modules[/\\\\].+\\.(js|jsx)$"
],
"rootDir": "."
}
}

View File

@ -0,0 +1,259 @@
import styled from 'styled-components';
import remcalc from 'remcalc';
export const Article = styled.article`
display: block;
`;
export const Aside = styled.aside`
display: block;
`;
export const Footer = styled.footer`
display: block;
`;
export const Header = styled.header`
display: block;
`;
export const Nav = styled.nav`
display: block;
`;
export const Section = styled.section`
display: block;
`;
export const FigCaption = styled.figcaption`
display: block;
`;
export const Figure = styled.figure`
display: block;
margin: ${remcalc(16)} ${remcalc(40)};
`;
export const Main = styled.main`
display: block;
`;
export const H1 = styled.h1`
font-size: ${remcalc(32)};
margin: ${remcalc(10)} 0;
`;
export const Hr = styled.hr`
box-sizing: content-box;
height: 0;
overflow: visible;
`;
export const Pre = styled.pre`
font-family: monospace, monospace;
font-size: ${remcalc(16)};
`;
export const A = styled.a`
background-color: transparent;
text-decoration-skip: objects;
`;
export const Abbr = styled.abbr`
&[title] {
border-bottom: none;
text-decoration: underline;
text-decoration: underline dotted;
}
`;
export const B = styled.b`
font-weight: bolder;
`;
export const Strong = styled.strong`
font-weight: bolder;
`;
export const Code = styled.code`
font-family: monospace, monospace;
font-size: ${remcalc(16)};
`;
export const Kbd = styled.kbd`
font-family: monospace, monospace;
font-size: ${remcalc(16)};
`;
export const Samp = styled.samp`
font-family: monospace, monospace;
font-size: ${remcalc(16)};
`;
export const Dfn = styled.dfn`
font-style: italic;
`;
export const Mark = styled.mark`
background-color: #ff0;
color: #000;
`;
export const Small = styled.small`
font-size: 80%;
`;
export const Sub = styled.sub`
font-size: 75%;
line-height: 0;
position: relative;
vertical-align: baseline;
bottom: -0.25em;
`;
export const Sup = styled.sup`
font-size: 75%;
line-height: 0;
position: relative;
vertical-align: baseline;
top: -0.5em;
`;
export const Audio = styled.audio`
display: inline-block;
&:not([controls]) {
display: none;
height: 0;
}
`;
export const Video = styled.video`
display: inline-block;
`;
export const Img = styled.img`
border-style: none;
`;
export const Svg = styled.svg`
&:not(:root) {
overflow: hidden;
}
`;
export const Button = styled.button`
font-family: sans-serif;
font-size: 100%;
line-height: 1.15;
margin: 0;
overflow: visible;
text-transform: none;
appearance: button;
&::-moz-focus-inner,
&[type="button"]::-moz-focus-inner,
&[type="reset"]::-moz-focus-inner,
&[type="submit"]::-moz-focus-inner {
border-style: none;
padding: 0;
}
&:-moz-focusring,
&[type="button"]:-moz-focusring,
&[type="reset"]:-moz-focusring,
&[type="submit"]:-moz-focusring {
outline: ${remcalc(1)} dotted ButtonText;
}
`;
export const Input = styled.input`
font-family: sans-serif;
font-size: 100%;
line-height: 1.15;
margin: 0;
overflow: visible;
&[type="checkbox"],
&[type="radio"] {
box-sizing: border-box;
padding: 0;
}
&[type="number"]::-webkit-inner-spin-button,
&[type="number"]::-webkit-outer-spin-button {
height: auto;
}
&[type="search"] {
appearance: textfield;
outline-offset: ${remcalc(-2)};
}
&[type="search"]::-webkit-search-cancel-button,
&[type="search"]::-webkit-search-decoration {
appearance: none;
}
&::-webkit-file-upload-button {
appearance: button;
font: inherit;
}
`;
export const Optgroup = styled.optgroup`
font-family: sans-serif;
font-size: 100%;
line-height: 1.15;
margin: 0;
`;
export const Select = styled.select`
font-family: sans-serif;
font-size: 100%;
line-height: 1.15;
margin: 0;
text-transform: none;
`;
export const Textarea = styled.textarea`
font-family: sans-serif;
font-size: 100%;
line-height: 1.15;
margin: 0;
overflow: auto;
`;
export const Fieldset = styled.fieldset`
padding: 0.35em 0.75em 0.625em;
`;
export const Legend = styled.legend`
box-sizing: border-box;
color: inherit;
display: table;
max-width: 100%;
padding: 0;
white-space: normal;
`;
export const Progress = styled.progress`
display: inline-block;
vertical-align: baseline;
`;
export const Details = styled.details`
display: block;
`;
export const Menu = styled.menu`
display: block;
`;
export const Summary = styled.summary`
display: list-item;
`;
export const Canvas = styled.canvas`
display: inline-block;
`;

View File

@ -0,0 +1,476 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`renders <A /> correctly 1`] = `
.jleQxG {
background-color: transparent;
-webkit-text-decoration-skip: objects;
text-decoration-skip: objects;
}
<a
className="sc-gqjmRU jleQxG"
/>
`;
exports[`renders <Abbr /> correctly 1`] = `
<abbr
className="sc-VigVT ijOVMO"
/>
`;
exports[`renders <Article /> correctly 1`] = `
.fpcbkF {
display: block;
}
<article
className="sc-bdVaJa fpcbkF"
/>
`;
exports[`renders <Aside /> correctly 1`] = `
.gbieAY {
display: block;
}
<aside
className="sc-bwzfXH gbieAY"
/>
`;
exports[`renders <Audio /> correctly 1`] = `
.SYMpT {
display: inline-block;
}
.SYMpT:not([controls]) {
display: none;
height: 0;
}
<audio
className="sc-ckVGcZ SYMpT"
/>
`;
exports[`renders <B /> correctly 1`] = `
.vhpOG {
font-weight: bolder;
}
<b
className="sc-jTzLTM vhpOG"
/>
`;
exports[`renders <Button /> correctly 1`] = `
.efaqoE {
font-family: sans-serif;
font-size: 100%;
line-height: 1.15;
margin: 0;
overflow: visible;
-webkit-text-transform: none;
text-transform: none;
-webkit-appearance: button;
-moz-appearance: button;
appearance: button;
}
.efaqoE::-moz-focus-inner,
.efaqoE[type="button"]::-moz-focus-inner,
.efaqoE[type="reset"]::-moz-focus-inner,
.efaqoE[type="submit"]::-moz-focus-inner {
border-style: none;
padding: 0;
}
.efaqoE:-moz-focusring,
.efaqoE[type="button"]:-moz-focusring,
.efaqoE[type="reset"]:-moz-focusring,
.efaqoE[type="submit"]:-moz-focusring {
outline: 0.0625rem dotted ButtonText;
}
<button
className="sc-kEYyzF efaqoE"
/>
`;
exports[`renders <Canvas /> correctly 1`] = `
.gIGqrW {
display: inline-block;
}
<canvas
className="sc-gPEVay gIGqrW"
/>
`;
exports[`renders <Code /> correctly 1`] = `
.NmzmU {
font-family: monospace, monospace;
font-size: 1rem;
}
<code
className="sc-jzJRlG NmzmU"
/>
`;
exports[`renders <Details /> correctly 1`] = `
.kSeyxS {
display: block;
}
<details
className="sc-cMljjf kSeyxS"
/>
`;
exports[`renders <Dfn /> correctly 1`] = `
.lcACZG {
font-style: italic;
}
<dfn
className="sc-chPdSV lcACZG"
/>
`;
exports[`renders <Fieldset /> correctly 1`] = `
.dLqrpE {
padding: 0.35em 0.75em 0.625em;
}
<fieldset
className="sc-cvbbAY dLqrpE"
/>
`;
exports[`renders <FigCaption /> correctly 1`] = `
.fGYiaS {
display: block;
}
<figcaption
className="sc-bZQynM fGYiaS"
/>
`;
exports[`renders <Figure /> correctly 1`] = `
.fpLcXm {
display: block;
margin: 1rem 2.5rem;
}
<figure
className="sc-gzVnrw fpLcXm"
/>
`;
exports[`renders <Footer /> correctly 1`] = `
.dMAkQL {
display: block;
}
<footer
className="sc-htpNat dMAkQL"
/>
`;
exports[`renders <H1 /> correctly 1`] = `
.itlxbG {
font-size: 2rem;
margin: 0.625rem 0;
}
<h1
className="sc-dnqmqq itlxbG"
/>
`;
exports[`renders <Header /> correctly 1`] = `
.imCjfa {
display: block;
}
<header
className="sc-bxivhb imCjfa"
/>
`;
exports[`renders <Hr /> correctly 1`] = `
.jvTISp {
box-sizing: content-box;
height: 0;
overflow: visible;
}
<hr
className="sc-iwsKbI jvTISp"
/>
`;
exports[`renders <Img /> correctly 1`] = `
.gLFqHa {
border-style: none;
}
<img
className="sc-eNQAEJ gLFqHa"
/>
`;
exports[`renders <Input /> correctly 1`] = `
.gtmtGl {
font-family: sans-serif;
font-size: 100%;
line-height: 1.15;
margin: 0;
overflow: visible;
}
.gtmtGl::-webkit-file-upload-button {
-webkit-appearance: button;
-moz-appearance: button;
appearance: button;
font: inherit;
}
<input
className="sc-kkGfuU gtmtGl"
/>
`;
exports[`renders <Kbd /> correctly 1`] = `
.cNQErp {
font-family: monospace, monospace;
font-size: 1rem;
}
<kbd
className="sc-cSHVUG cNQErp"
/>
`;
exports[`renders <Legend /> correctly 1`] = `
.iBvQlR {
box-sizing: border-box;
color: inherit;
display: table;
max-width: 100%;
padding: 0;
white-space: normal;
}
<legend
className="sc-jWBwVP iBvQlR"
/>
`;
exports[`renders <Main /> correctly 1`] = `
.kGbKV {
display: block;
}
<main
className="sc-htoDjs kGbKV"
/>
`;
exports[`renders <Mark /> correctly 1`] = `
.gUcHXP {
background-color: #ff0;
color: #000;
}
<mark
className="sc-kgoBCf gUcHXP"
/>
`;
exports[`renders <Menu /> correctly 1`] = `
.EtDOy {
display: block;
}
<menu
className="sc-jAaTju EtDOy"
/>
`;
exports[`renders <Nav /> correctly 1`] = `
.kXFzZl {
display: block;
}
<nav
className="sc-ifAKCX kXFzZl"
/>
`;
exports[`renders <Optgroup /> correctly 1`] = `
.bwvGAC {
font-family: sans-serif;
font-size: 100%;
line-height: 1.15;
margin: 0;
}
<optgroup
className="sc-iAyFgw bwvGAC"
/>
`;
exports[`renders <Pre /> correctly 1`] = `
.ePyiae {
font-family: monospace, monospace;
font-size: 1rem;
}
<pre
className="sc-gZMcBi ePyiae"
/>
`;
exports[`renders <Progress /> correctly 1`] = `
.irOoVX {
display: inline-block;
vertical-align: baseline;
}
<progress
className="sc-brqgnP irOoVX"
/>
`;
exports[`renders <Samp /> correctly 1`] = `
.brPjlW {
font-family: monospace, monospace;
font-size: 1rem;
}
<samp
className="sc-kAzzGY brPjlW"
/>
`;
exports[`renders <Section /> correctly 1`] = `
.kyfnqM {
display: block;
}
<section
className="sc-EHOje kyfnqM"
/>
`;
exports[`renders <Select /> correctly 1`] = `
.kskmSD {
font-family: sans-serif;
font-size: 100%;
line-height: 1.15;
margin: 0;
-webkit-text-transform: none;
text-transform: none;
}
<select
className="sc-hSdWYo kskmSD"
/>
`;
exports[`renders <Small /> correctly 1`] = `
.eNDzVi {
font-size: 80%;
}
<small
className="sc-kGXeez eNDzVi"
/>
`;
exports[`renders <Strong /> correctly 1`] = `
.liZvtt {
font-weight: bolder;
}
<strong
className="sc-fjdhpX liZvtt"
/>
`;
exports[`renders <Sub /> correctly 1`] = `
.bfYNTw {
font-size: 75%;
line-height: 0;
position: relative;
vertical-align: baseline;
bottom: -0.25em;
}
<sub
className="sc-kpOJdX bfYNTw"
/>
`;
exports[`renders <Summary /> correctly 1`] = `
.chrtFK {
display: list-item;
}
<summary
className="sc-jDwBTQ chrtFK"
/>
`;
exports[`renders <Sup /> correctly 1`] = `
.hZcmXd {
font-size: 75%;
line-height: 0;
position: relative;
vertical-align: baseline;
top: -0.5em;
}
<sup
className="sc-dxgOiQ hZcmXd"
/>
`;
exports[`renders <Svg /> correctly 1`] = `
.GnRoM:not(:root) {
overflow: hidden;
}
<svg
className="sc-hMqMXs GnRoM"
/>
`;
exports[`renders <Textarea /> correctly 1`] = `
.bDTEgL {
font-family: sans-serif;
font-size: 100%;
line-height: 1.15;
margin: 0;
overflow: auto;
}
<textarea
className="sc-eHgmQL bDTEgL"
/>
`;
exports[`renders <Video /> correctly 1`] = `
.bkGlpl {
display: inline-block;
}
<video
className="sc-jKJlTe bkGlpl"
/>
`;

View File

@ -0,0 +1,246 @@
import React from 'react';
import renderer from 'react-test-renderer';
import 'jest-styled-components';
import {
Article,
Aside,
Footer,
Header,
Nav,
Section,
FigCaption,
Figure,
Main,
H1,
Hr,
Pre,
A,
Abbr,
B,
Strong,
Code,
Kbd,
Samp,
Dfn,
Mark,
Small,
Sub,
Sup,
Audio,
Video,
Img,
Svg,
Button,
Input,
Optgroup,
Select,
Textarea,
Fieldset,
Legend,
Progress,
Details,
Menu,
Summary,
Canvas
} from '../src/';
it('renders <Article /> correctly', () => {
const tree = renderer.create(<Article />).toJSON();
expect(tree).toMatchStyledComponentsSnapshot();
});
it('renders <Aside /> correctly', () => {
const tree = renderer.create(<Aside />).toJSON();
expect(tree).toMatchStyledComponentsSnapshot();
});
it('renders <Footer /> correctly', () => {
const tree = renderer.create(<Footer />).toJSON();
expect(tree).toMatchStyledComponentsSnapshot();
});
it('renders <Header /> correctly', () => {
const tree = renderer.create(<Header />).toJSON();
expect(tree).toMatchStyledComponentsSnapshot();
});
it('renders <Nav /> correctly', () => {
const tree = renderer.create(<Nav />).toJSON();
expect(tree).toMatchStyledComponentsSnapshot();
});
it('renders <Section /> correctly', () => {
const tree = renderer.create(<Section />).toJSON();
expect(tree).toMatchStyledComponentsSnapshot();
});
it('renders <FigCaption /> correctly', () => {
const tree = renderer.create(<FigCaption />).toJSON();
expect(tree).toMatchStyledComponentsSnapshot();
});
it('renders <Figure /> correctly', () => {
const tree = renderer.create(<Figure />).toJSON();
expect(tree).toMatchStyledComponentsSnapshot();
});
it('renders <Main /> correctly', () => {
const tree = renderer.create(<Main />).toJSON();
expect(tree).toMatchStyledComponentsSnapshot();
});
it('renders <H1 /> correctly', () => {
const tree = renderer.create(<H1 />).toJSON();
expect(tree).toMatchStyledComponentsSnapshot();
});
it('renders <Hr /> correctly', () => {
const tree = renderer.create(<Hr />).toJSON();
expect(tree).toMatchStyledComponentsSnapshot();
});
it('renders <Pre /> correctly', () => {
const tree = renderer.create(<Pre />).toJSON();
expect(tree).toMatchStyledComponentsSnapshot();
});
it('renders <A /> correctly', () => {
const tree = renderer.create(<A />).toJSON();
expect(tree).toMatchStyledComponentsSnapshot();
});
it('renders <Abbr /> correctly', () => {
const tree = renderer.create(<Abbr />).toJSON();
expect(tree).toMatchStyledComponentsSnapshot();
});
it('renders <B /> correctly', () => {
const tree = renderer.create(<B />).toJSON();
expect(tree).toMatchStyledComponentsSnapshot();
});
it('renders <Strong /> correctly', () => {
const tree = renderer.create(<Strong />).toJSON();
expect(tree).toMatchStyledComponentsSnapshot();
});
it('renders <Code /> correctly', () => {
const tree = renderer.create(<Code />).toJSON();
expect(tree).toMatchStyledComponentsSnapshot();
});
it('renders <Kbd /> correctly', () => {
const tree = renderer.create(<Kbd />).toJSON();
expect(tree).toMatchStyledComponentsSnapshot();
});
it('renders <Samp /> correctly', () => {
const tree = renderer.create(<Samp />).toJSON();
expect(tree).toMatchStyledComponentsSnapshot();
});
it('renders <Dfn /> correctly', () => {
const tree = renderer.create(<Dfn />).toJSON();
expect(tree).toMatchStyledComponentsSnapshot();
});
it('renders <Mark /> correctly', () => {
const tree = renderer.create(<Mark />).toJSON();
expect(tree).toMatchStyledComponentsSnapshot();
});
it('renders <Small /> correctly', () => {
const tree = renderer.create(<Small />).toJSON();
expect(tree).toMatchStyledComponentsSnapshot();
});
it('renders <Sub /> correctly', () => {
const tree = renderer.create(<Sub />).toJSON();
expect(tree).toMatchStyledComponentsSnapshot();
});
it('renders <Sup /> correctly', () => {
const tree = renderer.create(<Sup />).toJSON();
expect(tree).toMatchStyledComponentsSnapshot();
});
it('renders <Audio /> correctly', () => {
const tree = renderer.create(<Audio />).toJSON();
expect(tree).toMatchStyledComponentsSnapshot();
});
it('renders <Video /> correctly', () => {
const tree = renderer.create(<Video />).toJSON();
expect(tree).toMatchStyledComponentsSnapshot();
});
it('renders <Img /> correctly', () => {
const tree = renderer.create(<Img />).toJSON();
expect(tree).toMatchStyledComponentsSnapshot();
});
it('renders <Svg /> correctly', () => {
const tree = renderer.create(<Svg />).toJSON();
expect(tree).toMatchStyledComponentsSnapshot();
});
it('renders <Button /> correctly', () => {
const tree = renderer.create(<Button />).toJSON();
expect(tree).toMatchStyledComponentsSnapshot();
});
it('renders <Input /> correctly', () => {
const tree = renderer.create(<Input />).toJSON();
expect(tree).toMatchStyledComponentsSnapshot();
});
it('renders <Optgroup /> correctly', () => {
const tree = renderer.create(<Optgroup />).toJSON();
expect(tree).toMatchStyledComponentsSnapshot();
});
it('renders <Select /> correctly', () => {
const tree = renderer.create(<Select />).toJSON();
expect(tree).toMatchStyledComponentsSnapshot();
});
it('renders <Textarea /> correctly', () => {
const tree = renderer.create(<Textarea />).toJSON();
expect(tree).toMatchStyledComponentsSnapshot();
});
it('renders <Fieldset /> correctly', () => {
const tree = renderer.create(<Fieldset />).toJSON();
expect(tree).toMatchStyledComponentsSnapshot();
});
it('renders <Legend /> correctly', () => {
const tree = renderer.create(<Legend />).toJSON();
expect(tree).toMatchStyledComponentsSnapshot();
});
it('renders <Progress /> correctly', () => {
const tree = renderer.create(<Progress />).toJSON();
expect(tree).toMatchStyledComponentsSnapshot();
});
it('renders <Details /> correctly', () => {
const tree = renderer.create(<Details />).toJSON();
expect(tree).toMatchStyledComponentsSnapshot();
});
it('renders <Menu /> correctly', () => {
const tree = renderer.create(<Menu />).toJSON();
expect(tree).toMatchStyledComponentsSnapshot();
});
it('renders <Summary /> correctly', () => {
const tree = renderer.create(<Summary />).toJSON();
expect(tree).toMatchStyledComponentsSnapshot();
});
it('renders <Canvas /> correctly', () => {
const tree = renderer.create(<Canvas />).toJSON();
expect(tree).toMatchStyledComponentsSnapshot();
});

File diff suppressed because it is too large Load Diff

View File

@ -45,7 +45,7 @@
"bup": "^1.0.9",
"cross-env": "^5.0.1",
"eslint": "^4.0.0",
"eslint-config-joyent-portal": "1.0.0",
"eslint-config-joyent-portal": "1.0.3",
"nyc": "^11.0.2",
"redrun": "^5.9.15",
"tap-xunit": "^1.7.0"

View File

@ -47,7 +47,7 @@
"bup": "^1.0.9",
"cross-env": "^5.0.1",
"eslint": "^4.0.0",
"eslint-config-joyent-portal": "1.0.0",
"eslint-config-joyent-portal": "1.0.3",
"nyc": "^11.0.2",
"redrun": "^5.9.15",
"tap-xunit": "^1.7.0"

View File

@ -0,0 +1,3 @@
.nyc_output
coverage
dist

View File

@ -0,0 +1,3 @@
{
"extends": "joyent-portal"
}

View File

@ -0,0 +1,10 @@
{
"libs": [
"ecmascript"
],
"plugins": {
"doc_comment": true,
"local-scope": true,
"node": true
}
}

View File

@ -0,0 +1,13 @@
# Change Log
All notable changes to this project will be documented in this file.
See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
<a name="1.0.5"></a>
## 1.0.5 (2017-05-25)
<a name="1.0.4"></a>
## 1.0.4 (2017-05-25)

View File

@ -0,0 +1,63 @@
# remcalc
[![License: MPL 2.0](https://img.shields.io/badge/License-MPL%202.0-brightgreen.svg)](https://opensource.org/licenses/MPL-2.0)
[![npm](https://img.shields.io/npm/v/remcalc.svg)](https://npmjs.com/package/remcalc)
[![standard-readme compliant](https://img.shields.io/badge/standard--readme-OK-green.svg)](https://github.com/RichardLitt/standard-readme)
Calculate the `rem`'s from `px` values.
## Table of Contents
- [Install](#install)
- [Usage](#usage)
- [License](#license)
## Install
```
yarn add --dev remcalc
```
## Usage
```js
import remcalc from 'remcalc';
import assert from 'assert';
assert.deepEqual(remcalc.withBase(10, 1, 2, 3, 4), '0.1rem 0.2rem 0.3rem 0.4rem');
assert.deepEqual(remcalc('1'), '0.0625rem');
assert.deepEqual(remcalc('1px'), '0.0625rem');
assert.deepEqual(remcalc.withBase(10, '1px'), '0.1rem');
assert.deepEqual(
remcalc('1', '2', '3', '4'),
'0.0625rem 0.125rem 0.1875rem 0.25rem'
);
assert.deepEqual(
remcalc('1px', '2px', '3px', '4px'),
'0.0625rem 0.125rem 0.1875rem 0.25rem'
);
assert.deepEqual(
remcalc.withBase(10, '1', '2', '3', '4'),
'0.1rem 0.2rem 0.3rem 0.4rem'
);
assert.deepEqual(
remcalc.withBase(10, '1px', '2px', '3px', '4px'),
'0.1rem 0.2rem 0.3rem 0.4rem'
);
assert.deepEqual(remcalc('1 2 3 4'), '0.0625rem 0.125rem 0.1875rem 0.25rem');
assert.deepEqual(remcalc.withBase(10, '1 2 3 4'), '0.1rem 0.2rem 0.3rem 0.4rem');
```
## License
MPL-2.0

View File

@ -0,0 +1,72 @@
{
"name": "remcalc",
"version": "1.0.8",
"license": "MPL-2.0",
"description": "Calculate the `rem`'s from `px` values",
"keywords": [
"calc",
"rem",
"em",
"px",
"pixels",
"pixel"
],
"repository": "github:yldio/joyent-portal",
"main": "dist/remcalc.umd.js",
"jsnext:main": "dist/remcalc.es.js",
"module": "dist/remcalc.es.js",
"entry": "src/index.js",
"scripts": {
"lint": "eslint . --fix",
"lint-ci": "eslint . --format junit --output-file $CIRCLE_TEST_REPORTS/lint/remcalc.xml",
"test": "bup && cross-env NODE_ENV=test nyc --reporter=lcov --reporter=text ava",
"test-ci": "cross-env NODE_ENV=test nyc --report-dir=$CIRCLE_ARTIFACTS/remcalc --reporter=lcov --reporter=text ava --tap | tap-xunit > $CIRCLE_TEST_REPORTS/test/remcalc.xml",
"build": "bup",
"prepublish": "bup"
},
"dependencies": {
"lodash.flatten": "^4.4.0"
},
"devDependencies": {
"ava": "0.19.1",
"babel-plugin-istanbul": "^4.1.4",
"babel-plugin-transform-es2015-arrow-functions": "^6.22.0",
"babel-plugin-transform-es2015-parameters": "^6.24.1",
"babel-plugin-transform-es2015-spread": "^6.22.0",
"babel-plugin-transform-es2015-template-literals": "^6.22.0",
"babel-register": "^6.24.1",
"bup": "^1.0.9",
"cross-env": "^5.0.1",
"eslint": "^4.0.0",
"eslint-config-joyent-portal": "1.0.3",
"nyc": "^11.0.2",
"tap-xunit": "^1.7.0"
},
"nyc": {
"sourceMap": false,
"instrument": false
},
"babel": {
"sourceMaps": "inline",
"plugins": [
"transform-es2015-parameters",
"transform-es2015-template-literals",
"transform-es2015-arrow-functions",
"transform-es2015-spread"
],
"env": {
"test": {
"plugins": [
"istanbul"
]
}
}
},
"ava": {
"tap": true,
"require": [
"babel-register"
],
"babel": "inherit"
}
}

View File

@ -0,0 +1,11 @@
const flatten = require('lodash.flatten');
const BASE = 16;
const calc = (base, ...values) =>
flatten(values.map(value => String(value).split(/\s/gim)))
.map(value => `${Number(value.replace('px', '')) / base}rem`)
.join(' ');
module.exports = (...values) => calc(BASE, ...values);
module.exports.withBase = calc;

View File

@ -0,0 +1,40 @@
const test = require('ava');
const remcalc = require('../');
test('with multiple num arguments', t => {
t.deepEqual(remcalc(1, 2, 3, 4), '0.0625rem 0.125rem 0.1875rem 0.25rem');
t.deepEqual(remcalc.withBase(10, 1, 2, 3, 4), '0.1rem 0.2rem 0.3rem 0.4rem');
});
test('with single str argument', t => {
t.deepEqual(remcalc('1'), '0.0625rem');
t.deepEqual(remcalc('1px'), '0.0625rem');
t.deepEqual(remcalc.withBase(10, '1px'), '0.1rem');
});
test('with multiple str arguments', t => {
t.deepEqual(
remcalc('1', '2', '3', '4'),
'0.0625rem 0.125rem 0.1875rem 0.25rem'
);
t.deepEqual(
remcalc('1px', '2px', '3px', '4px'),
'0.0625rem 0.125rem 0.1875rem 0.25rem'
);
t.deepEqual(
remcalc.withBase(10, '1', '2', '3', '4'),
'0.1rem 0.2rem 0.3rem 0.4rem'
);
t.deepEqual(
remcalc.withBase(10, '1px', '2px', '3px', '4px'),
'0.1rem 0.2rem 0.3rem 0.4rem'
);
});
test('with single str argument spaced', t => {
t.deepEqual(remcalc('1 2 3 4'), '0.0625rem 0.125rem 0.1875rem 0.25rem');
t.deepEqual(remcalc.withBase(10, '1 2 3 4'), '0.1rem 0.2rem 0.3rem 0.4rem');
});

3950
packages/remcalc/yarn.lock Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,3 @@
.nyc_output
coverage
dist

View File

@ -0,0 +1,3 @@
{
"extends": "joyent-portal"
}

View File

@ -0,0 +1,10 @@
{
"libs": [
"ecmascript"
],
"plugins": {
"doc_comment": true,
"local-scope": true,
"node": true
}
}

View File

@ -0,0 +1,13 @@
# Change Log
All notable changes to this project will be documented in this file.
See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
<a name="1.0.5"></a>
## 1.0.5 (2017-05-25)
<a name="1.0.4"></a>
## 1.0.4 (2017-05-25)

36
packages/rnd-id/README.md Normal file
View File

@ -0,0 +1,36 @@
# rnd-id
[![License: MPL 2.0](https://img.shields.io/badge/License-MPL%202.0-brightgreen.svg)](https://opensource.org/licenses/MPL-2.0)
[![npm](https://img.shields.io/npm/v/rnd-id.svg)](https://npmjs.com/package/rnd-id)
[![standard-readme compliant](https://img.shields.io/badge/standard--readme-OK-green.svg)](https://github.com/RichardLitt/standard-readme)
Generate a random alphabetical string.
## Table of Contents
- [Install](#install)
- [Usage](#usage)
- [License](#license)
## Install
```
yarn add --dev rnd-id
```
## Usage
```js
const rndId = require('rnd-id');
console.log(rndId()) // kbtpZ
console.log(rndId()) // cuBuLn
console.log(rndId()) // sPwzn
console.log(rndId()) // kKUko
console.log(rndId()) // czzpgR
console.log(rndId()) // cjtzdI
```
## License
MPL-2.0

View File

@ -0,0 +1,65 @@
{
"name": "rnd-id",
"version": "1.0.8",
"license": "MPL-2.0",
"description": "Generate a random alpha string",
"keywords": [
"random",
"alphabetical"
],
"repository": "github:yldio/joyent-portal",
"main": "dist/rnd-id.umd.js",
"jsnext:main": "dist/rnd-id.es.js",
"module": "dist/rnd-id.es.js",
"entry": "src/index.js",
"scripts": {
"lint": "eslint . --fix",
"lint-ci": "eslint . --format junit --output-file $CIRCLE_TEST_REPORTS/lint/rnd-id.xml",
"test": "bup && cross-env NODE_ENV=test nyc --reporter=lcov --reporter=text ava",
"test-ci": "cross-env NODE_ENV=test nyc --report-dir=$CIRCLE_ARTIFACTS/rnd-id --reporter=lcov --reporter=text ava --tap | tap-xunit > $CIRCLE_TEST_REPORTS/test/rnd-id.xml",
"build": "bup",
"prepublish": "bup"
},
"dependencies": {
"random-natural": "^1.0.3"
},
"devDependencies": {
"ava": "0.19.1",
"babel-plugin-istanbul": "^4.1.4",
"babel-plugin-transform-es2015-arrow-functions": "^6.22.0",
"babel-plugin-transform-es2015-template-literals": "^6.22.0",
"babel-register": "^6.24.1",
"bup": "^1.0.9",
"cross-env": "^5.0.1",
"eslint": "^4.0.0",
"eslint-config-joyent-portal": "1.0.3",
"lodash.uniq": "^4.5.0",
"nyc": "^11.0.2",
"tap-xunit": "^1.7.0"
},
"nyc": {
"sourceMap": false,
"instrument": false
},
"babel": {
"sourceMaps": "inline",
"plugins": [
"transform-es2015-arrow-functions",
"transform-es2015-template-literals"
],
"env": {
"test": {
"plugins": [
"istanbul"
]
}
}
},
"ava": {
"tap": true,
"require": [
"babel-register"
],
"babel": "inherit"
}
}

View File

@ -0,0 +1,15 @@
const randomNatural = require('random-natural');
// From https://github.com/styled-components/styled-components/blob/065001c725744629c7870240e4a955b924ef5337/src/utils/generateAlphabeticName.js
const chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'.split('');
const rndId = _code => {
const code = _code ? _code : randomNatural({ min: 1000000000 });
const lastDigit = chars[code % chars.length];
return code > chars.length
? `${rndId(Math.floor(code / chars.length))}${lastDigit}`
: lastDigit;
};
module.exports = rndId;

View File

@ -0,0 +1,17 @@
const test = require('ava');
const uniq = require('lodash.uniq');
const rndId = require('../');
test('should generate strings', t => {
t.truthy(
[rndId(), rndId(), rndId(), rndId()].every(
s => typeof s === 'string' && s.length
)
);
});
test('should generate unique strings', t => {
const arr = [rndId(), rndId(), rndId(), rndId()];
t.deepEqual(uniq(arr).length, arr.length);
});

3998
packages/rnd-id/yarn.lock Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,3 @@
.nyc_output
coverage
dist

View File

@ -0,0 +1,3 @@
{
"extends": "joyent-portal"
}

View File

@ -0,0 +1,10 @@
{
"libs": [
"ecmascript"
],
"plugins": {
"doc_comment": true,
"local-scope": true,
"node": true
}
}

View File

@ -0,0 +1,23 @@
# Change Log
All notable changes to this project will be documented in this file.
See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
<a name="1.0.7"></a>
## 1.0.7 (2017-05-25)
### Bug Fixes
* **styled-is:** correct package entrypoints ([44a2f2e](https://github.com/yldio/joyent-portal/commit/44a2f2e))
<a name="1.0.6"></a>
## 1.0.6 (2017-05-25)
### Bug Fixes
* **styled-is:** correct package entrypoints ([44a2f2e](https://github.com/yldio/joyent-portal/commit/44a2f2e))

View File

@ -0,0 +1,91 @@
# styled-is
[![License: MPL 2.0](https://img.shields.io/badge/License-MPL%202.0-brightgreen.svg)](https://opensource.org/licenses/MPL-2.0)
[![npm](https://img.shields.io/npm/v/styled-is.svg)](https://npmjs.com/package/styled-is)
[![standard-readme compliant](https://img.shields.io/badge/standard--readme-OK-green.svg)](https://github.com/RichardLitt/standard-readme)
Flag utility for [`styled-components`](https://github.com/styled-components/styled-components).
## Table of Contents
- [Install](#install)
- [Usage](#usage)
- [License](#license)
## Install
```
yarn add --dev styled-is
```
## Usage
```js
import is, { isNot, isOr, isSomeNot } from 'styled-is';
import styled from 'styled-components';
const Div = styled.div`
display: block;
opacity: 0;
${is('red')`
background-color: red;
`};
${is('blue')`
background-color: blue;
`};
${is('red', 'blue')`
opacity: 1;
`};
${is('left')`
float: left;
`};
${is('right')`
float: right;
`};
${isNot('left', 'right')`
float: center;
`};
${isOr('left', 'right')`
position: relative;
`};
${isSomeNot('red', 'left')`
wat: 1;
`};
`;
```
```js
// display: block;
// opacity: 0;
// float: center;
// wat: 1;
<Div>
// display: block;
// opacity: 0;
// background-color: red;
// opacity: 1;
// float: center;
// wat: 1;
<Div red>
// display: block;
// opacity: 0;
// background-color: red;
// opacity: 1;
// float: left;
// position: relative;
<Div red left>
```
## License
MPL-2.0

View File

@ -0,0 +1,78 @@
{
"name": "styled-is",
"version": "1.0.11",
"license": "MPL-2.0",
"description": "Flag utility for styled-components",
"keywords": [
"flag",
"flags",
"react",
"css",
"css-in-js",
"styled-components"
],
"repository": "github:yldio/joyent-portal",
"main": "dist/styled-is.umd.js",
"jsnext:main": "dist/styled-is.es.js",
"module": "dist/styled-is.es.js",
"entry": "src/index.js",
"scripts": {
"lint": "eslint . --fix",
"lint-ci": "eslint . --format junit --output-file $CIRCLE_TEST_REPORTS/lint/styled-is.xml",
"test:run": "cross-env NODE_ENV=test nyc --reporter=lcov --reporter=text ava",
"test-ci:run": "cross-env NODE_ENV=test nyc --report-dir=$CIRCLE_ARTIFACTS/styled-is --reporter=lcov --reporter=text ava --tap | tap-xunit > $CIRCLE_TEST_REPORTS/test/styled-is.xml",
"test": "redrun -s build test:run",
"test-ci": "redrun -s build test-ci:run",
"build": "bup",
"prepublish": "redrun build"
},
"devDependencies": {
"ava": "0.19.1",
"babel-plugin-istanbul": "^4.1.4",
"babel-plugin-transform-es2015-arrow-functions": "^6.22.0",
"babel-plugin-transform-es2015-parameters": "^6.24.1",
"babel-plugin-transform-es2015-spread": "^6.22.0",
"babel-plugin-transform-es2015-template-literals": "^6.22.0",
"babel-register": "^6.24.1",
"bup": "^1.0.9",
"cross-env": "^5.0.1",
"eslint": "^4.0.0",
"eslint-config-joyent-portal": "1.0.3",
"nyc": "^11.0.2",
"react": "^15.6.1",
"redrun": "^5.9.15",
"styled-components": "^2.1.0",
"tap-xunit": "^1.7.0"
},
"peerDependencies": {
"react": "*",
"styled-components": "*"
},
"nyc": {
"sourceMap": false,
"instrument": false
},
"babel": {
"sourceMaps": "inline",
"plugins": [
"transform-es2015-parameters",
"transform-es2015-template-literals",
"transform-es2015-arrow-functions",
"transform-es2015-spread"
],
"env": {
"test": {
"plugins": [
"istanbul"
]
}
}
},
"ava": {
"tap": true,
"require": [
"babel-register"
],
"babel": "inherit"
}
}

View File

@ -0,0 +1,13 @@
import { css } from 'styled-components';
export default (...names) => (...args) => props =>
names.every(name => props[name]) ? css(...args) : css``;
export const isNot = (...names) => (...args) => props =>
names.every(name => !props[name]) ? css(...args) : css``;
export const isOr = (...names) => (...args) => props =>
names.some(name => props[name]) ? css(...args) : css``;
export const isSomeNot = (...names) => (...args) => props =>
names.some(name => !props[name]) ? css(...args) : css``;

View File

@ -0,0 +1,52 @@
const { default: is, isNot, isOr, isSomeNot } = require('../');
const test = require('ava');
test('should render only if prop is truthy', t => {
const rule = is('test')`hello`;
t.deepEqual(rule({ test: false }), []);
t.deepEqual(rule({ test: true }), ['hello']);
});
test('should render only if prop is falsy', t => {
const rule = isNot('test')`hello`;
t.deepEqual(rule({ test: false }), ['hello']);
t.deepEqual(rule({ test: true }), []);
});
test('should render only if all props are truthy', t => {
const rule = is('t1', 't2')`hello`;
t.deepEqual(rule({ t1: true, t2: false }), []);
t.deepEqual(rule({ t1: false, t2: false }), []);
t.deepEqual(rule({ t1: false, t2: true }), []);
t.deepEqual(rule({ t1: true, t2: true }), ['hello']);
});
test('should render only if all props are falsy', t => {
const rule = isNot('t1', 't2')`hello`;
t.deepEqual(rule({ t1: true, t2: false }), []);
t.deepEqual(rule({ t1: false, t2: false }), ['hello']);
t.deepEqual(rule({ t1: false, t2: true }), []);
t.deepEqual(rule({ t1: true, t2: true }), []);
});
test('should render only if one prop is truthy', t => {
const rule = isOr('t1', 't2')`hello`;
t.deepEqual(rule({ t1: true, t2: false }), ['hello']);
t.deepEqual(rule({ t1: false, t2: false }), []);
t.deepEqual(rule({ t1: false, t2: true }), ['hello']);
t.deepEqual(rule({ t1: true, t2: true }), ['hello']);
});
test('should render only if one prop is falsy', t => {
const rule = isSomeNot('t1', 't2')`hello`;
t.deepEqual(rule({ t1: true, t2: false }), ['hello']);
t.deepEqual(rule({ t1: false, t2: false }), ['hello']);
t.deepEqual(rule({ t1: false, t2: true }), ['hello']);
t.deepEqual(rule({ t1: true, t2: true }), []);
});

4160
packages/styled-is/yarn.lock Normal file

File diff suppressed because it is too large Load Diff

View File

@ -32,25 +32,25 @@
"d3": "^4.9.1",
"disable-scroll": "^0.3.0",
"lodash.isstring": "^4.0.1",
"normalized-styled-components": "^1.0.5",
"normalized-styled-components": "^1.0.8",
"polished": "^1.1.3",
"prop-types": "^15.5.10",
"react-broadcast": "^0.1.2",
"react-styled-flexboxgrid": "^2.0.1",
"remcalc": "^1.0.5",
"rnd-id": "^1.0.5",
"remcalc": "^1.0.8",
"rnd-id": "^1.0.8",
"styled-components": "^2.1.0",
"styled-is": "^1.0.7",
"unitcalc": "^1.0.5"
"styled-is": "^1.0.11",
"unitcalc": "^1.0.8"
},
"devDependencies": {
"babel-cli": "^6.24.1",
"babel-plugin-inline-react-svg": "^0.4.0",
"babel-plugin-styled-components": "^1.1.4",
"babel-preset-joyent-portal": "^1.0.0",
"babel-preset-joyent-portal": "^1.0.3",
"cross-env": "^5.0.1",
"eslint": "^4.0.0",
"eslint-config-joyent-portal": "1.0.0",
"eslint-config-joyent-portal": "1.0.3",
"jest": "^20.0.4",
"jest-diff": "^20.0.3",
"jest-matcher-utils": "^20.0.3",

View File

@ -0,0 +1,3 @@
.nyc_output
coverage
dist

View File

@ -0,0 +1,3 @@
{
"extends": "joyent-portal"
}

View File

@ -0,0 +1,10 @@
{
"libs": [
"ecmascript"
],
"plugins": {
"doc_comment": true,
"local-scope": true,
"node": true
}
}

View File

@ -0,0 +1,13 @@
# Change Log
All notable changes to this project will be documented in this file.
See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
<a name="1.0.5"></a>
## 1.0.5 (2017-05-25)
<a name="1.0.4"></a>
## 1.0.4 (2017-05-25)

View File

@ -0,0 +1,54 @@
# unitcalc
[![License: MPL 2.0](https://img.shields.io/badge/License-MPL%202.0-brightgreen.svg)](https://opensource.org/licenses/MPL-2.0)
[![npm](https://img.shields.io/npm/v/unitcalc.svg)](https://npmjs.com/package/unitcalc)
[![standard-readme compliant](https://img.shields.io/badge/standard--readme-OK-green.svg)](https://github.com/RichardLitt/standard-readme)
Calculate the `rem`'s from unit values.
## Table of Contents
- [Install](#install)
- [Usage](#usage)
- [License](#license)
## Install
```
yarn add --dev unitcalc
```
## Usage
```js
import unitcalc from 'unitcalc';
import assert from 'assert';
assert.deepEqual(unitcalc(1, 2, 3, 4), '0.375rem 0.75rem 1.125rem 1.5rem');
assert.deepEqual(unitcalc('1'), '0.375rem');
assert.deepEqual(unitcalc.withBase(10, '1'), '0.625rem');
assert.deepEqual(
unitcalc('1', '2', '3', '4'),
'0.375rem 0.75rem 1.125rem 1.5rem'
);
assert.deepEqual(
unitcalc.withBase(10, '1', '2', '3', '4'),
'0.625rem 1.25rem 1.875rem 2.5rem'
);
assert.deepEqual(unitcalc('1 2 3 4'), '0.375rem 0.75rem 1.125rem 1.5rem');
assert.deepEqual(
unitcalc.withBase(10, '1 2 3 4'),
'0.625rem 1.25rem 1.875rem 2.5rem'
);
```
## License
MPL-2.0

View File

@ -0,0 +1,73 @@
{
"name": "unitcalc",
"version": "1.0.8",
"license": "MPL-2.0",
"description": "Calculate the `rem`'s from unit values",
"keywords": [
"calc",
"rem",
"em",
"px",
"pixels",
"pixel",
"baseline",
"unit"
],
"repository": "github:yldio/joyent-portal",
"main": "dist/unitcalc.umd.js",
"jsnext:main": "dist/unitcalc.es.js",
"module": "dist/unitcalc.es.js",
"entry": "src/index.js",
"scripts": {
"lint": "eslint . --fix",
"lint-ci": "eslint . --format junit --output-file $CIRCLE_TEST_REPORTS/lint/unitcalc.xml",
"test": "bup && cross-env NODE_ENV=test nyc --reporter=lcov --reporter=text ava",
"test-ci": "cross-env NODE_ENV=test nyc --report-dir=$CIRCLE_ARTIFACTS/unitcalc --reporter=lcov --reporter=text ava --tap | tap-xunit > $CIRCLE_TEST_REPORTS/test/unitcalc.xml",
"build": "bup",
"prepublish": "bup"
},
"dependencies": {
"lodash.flatten": "^4.4.0",
"remcalc": "^1.0.8"
},
"devDependencies": {
"ava": "0.19.1",
"babel-plugin-istanbul": "^4.1.4",
"babel-plugin-transform-es2015-arrow-functions": "^6.22.0",
"babel-plugin-transform-es2015-parameters": "^6.24.1",
"babel-plugin-transform-es2015-spread": "^6.22.0",
"babel-register": "^6.24.1",
"bup": "^1.0.9",
"cross-env": "^5.0.1",
"eslint": "^4.0.0",
"eslint-config-joyent-portal": "1.0.3",
"nyc": "^11.0.2",
"tap-xunit": "^1.7.0"
},
"nyc": {
"sourceMap": false,
"instrument": false
},
"babel": {
"sourceMaps": "inline",
"plugins": [
"transform-es2015-parameters",
"transform-es2015-arrow-functions",
"transform-es2015-spread"
],
"env": {
"test": {
"plugins": [
"istanbul"
]
}
}
},
"ava": {
"tap": true,
"require": [
"babel-register"
],
"babel": "inherit"
}
}

View File

@ -0,0 +1,12 @@
const flatten = require('lodash.flatten');
const remcalc = require('remcalc');
const BASE = 6;
const calc = (base, ...values) =>
flatten(values.map(value => String(value).split(/\s/gim)))
.map(value => remcalc(Number(value) * base))
.join(' ');
module.exports = (...values) => calc(BASE, ...values);
module.exports.withBase = calc;

View File

@ -0,0 +1,27 @@
const test = require('ava');
const unitcalc = require('../');
test('with multiple num arguments', t => {
t.deepEqual(unitcalc(1, 2, 3, 4), '0.375rem 0.75rem 1.125rem 1.5rem');
});
test('with single str argument', t => {
t.deepEqual(unitcalc('1'), '0.375rem');
t.deepEqual(unitcalc.withBase(10, '1'), '0.625rem');
});
test('with multiple str arguments', t => {
t.deepEqual(unitcalc('1', '2', '3', '4'), '0.375rem 0.75rem 1.125rem 1.5rem');
t.deepEqual(
unitcalc.withBase(10, '1', '2', '3', '4'),
'0.625rem 1.25rem 1.875rem 2.5rem'
);
});
test('with single str argument spaced', t => {
t.deepEqual(unitcalc('1 2 3 4'), '0.375rem 0.75rem 1.125rem 1.5rem');
t.deepEqual(
unitcalc.withBase(10, '1 2 3 4'),
'0.625rem 1.25rem 1.875rem 2.5rem'
);
});

3944
packages/unitcalc/yarn.lock Normal file

File diff suppressed because it is too large Load Diff

View File

@ -2977,6 +2977,10 @@ diffie-hellman@^5.0.0:
miller-rabin "^4.0.0"
randombytes "^2.0.0"
disable-scroll@^0.3.0:
version "0.3.0"
resolved "https://registry.yarnpkg.com/disable-scroll/-/disable-scroll-0.3.0.tgz#486d309ec9873edb18aec7891c5576bf8b506c59"
docker-modem@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/docker-modem/-/docker-modem-1.0.0.tgz#cd7f43e209d7a4cff28a2628bae6381414bd8b8b"
@ -3278,10 +3282,6 @@ eslint-config-hapi@10.x.x:
version "10.0.0"
resolved "https://registry.yarnpkg.com/eslint-config-hapi/-/eslint-config-hapi-10.0.0.tgz#9980affd76103ebc1fec92b45638345db19348f5"
eslint-config-joyent-portal@1.0.3:
version "1.0.3"
resolved "https://registry.yarnpkg.com/eslint-config-joyent-portal/-/eslint-config-joyent-portal-1.0.3.tgz#48fb02893bb513f99dba2a4aed1d7f0c14a30090"
eslint-config-prettier@^2.1.1:
version "2.1.1"
resolved "https://registry.yarnpkg.com/eslint-config-prettier/-/eslint-config-prettier-2.1.1.tgz#ab3923fb704eebecab6960906b7d0d6e801cde58"
@ -7704,12 +7704,6 @@ remark@^7.0.0:
remark-stringify "^3.0.0"
unified "^6.0.0"
remcalc@^1.0.8:
version "1.0.8"
resolved "https://registry.yarnpkg.com/remcalc/-/remcalc-1.0.8.tgz#937d30fdcca59f4fd0f83ea188c6e67550628c07"
dependencies:
lodash.flatten "^4.4.0"
remove-trailing-separator@^1.0.1:
version "1.0.2"
resolved "https://registry.yarnpkg.com/remove-trailing-separator/-/remove-trailing-separator-1.0.2.tgz#69b062d978727ad14dc6b56ba4ab772fd8d70511"