Skip to content

Commit

Permalink
Curls 3
Browse files Browse the repository at this point in the history
  • Loading branch information
jaredLunde committed Mar 1, 2019
1 parent f7666a9 commit a9f1cb3
Show file tree
Hide file tree
Showing 23 changed files with 73 additions and 85 deletions.
5 changes: 3 additions & 2 deletions packages/buttons/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@stellar-apps/buttons",
"version": "2.0.4",
"version": "2.0.6",
"main": "dist/cjs/index.js",
"author": "Jared Lunde <[email protected]> (https://BeStellar.co)",
"license": "MIT",
Expand All @@ -25,7 +25,8 @@
"@babel/runtime": "^7.3.1",
"@babel/runtime-corejs2": "^7.3.1",
"empty": "^0.10.1",
"memoize-two-args": "^1.0.7"
"memoize-two-args": "^1.0.7",
"trie-memoize": "^1.0.3"
},
"peerDependencies": {
"@jaredlunde/curls-addons": "^4.0.0",
Expand Down
4 changes: 2 additions & 2 deletions packages/buttons/src/Button.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react'
import {Button, ThemeConsumer, createComponent} from 'curls'
import {Button, ThemeConsumer} from 'curls'
import * as buttonDefaults from 'curls/dist/es/Button/defaultTheme'


Expand All @@ -13,7 +13,7 @@ export const defaultTheme = {
export default React.forwardRef(
function Button ({outline = false, ...props}, ref) {
return (
<ThemeConsumer path='button' defaultTheme={defaultTheme}>
<ThemeConsumer name='button' defaultTheme={defaultTheme}>
{({theme}) => {
props = {...theme.defaultProps, ...props}

Expand Down
4 changes: 2 additions & 2 deletions packages/buttons/src/LinkButton.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import React from 'react'
import {withRouter} from 'react-router-dom'
import memoize from 'memoize-two-args'
import memoize from 'trie-memoize'
import TypeButton from './TypeButton'


// necessary for keeping TypeButton purity
const getOnClick = memoize((to, push) => () => push(to), Map)
const getOnClick = memoize([Map, WeakMap], (to, push) => () => push(to))

export default React.forwardRef(
function LinkButton (props, ref) {
Expand Down
2 changes: 1 addition & 1 deletion packages/buttons/src/SpinnerButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export default React.forwardRef(
ref
) {
return (
<ThemeConsumer path='button' defaultTheme={defaultTheme}>
<ThemeConsumer name='button' defaultTheme={defaultTheme}>
{({theme}) => {
const spinnerProps = {...theme.spinner}

Expand Down
2 changes: 1 addition & 1 deletion packages/buttons/src/TypeButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export const defaultTheme = {
export default React.forwardRef(
function TypeButton ({typeSize, typeWeight, typeFace, typeColor, ...props}, ref) {
return (
<ThemeConsumer path='button' defaultTheme={defaultTheme}>
<ThemeConsumer name='button' defaultTheme={defaultTheme}>
{({theme}) => {
if (props.outline === true) {
typeColor = typeColor || props.bg || theme.defaultProps.bg
Expand Down
7 changes: 7 additions & 0 deletions packages/buttons/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2751,6 +2751,13 @@ to-regex@^3.0.1, to-regex@^3.0.2:
regex-not "^1.0.2"
safe-regex "^1.1.0"

trie-memoize@^1.0.3:
version "1.0.3"
resolved "https://registry.yarnpkg.com/trie-memoize/-/trie-memoize-1.0.3.tgz#0aefd975f39ee53ef56309466f4a666b48d00870"
integrity sha512-R3pm9Cuz6Uf7FK+wJQBQho6aYaBxzDYDL45VcVbC4PE+z3S84xPCay1g9Zxi59cndAKJUIJK+6QPRq9Sc59AIg==
dependencies:
is-plain-object "^2.0.4"

trim-right@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/trim-right/-/trim-right-1.0.1.tgz#cb2e1203067e0c8de1f614094b9fe45704ea6003"
Expand Down
2 changes: 1 addition & 1 deletion packages/content/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@stellar-apps/content",
"version": "3.0.0",
"version": "3.0.2",
"main": "dist/cjs/index.js",
"author": "Jared Lunde <[email protected]> (https://BeStellar.co)",
"license": "MIT",
Expand Down
24 changes: 11 additions & 13 deletions packages/content/src/Content.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react'
import PropTypes from 'prop-types'
import {createComponent, renderNode, FlexBox} from 'curls'
import {createComponent, renderNode, FlexBox, memoThemeValue} from 'curls'
import {css} from '@emotion/core'


Expand All @@ -17,22 +17,17 @@ const defaultTheme = {
}

const SFC = createComponent({
name: 'Content',
propTypes: {
slim: PropTypes.bool
},
CSS: {
__base: (val, theme) => css`max-width: ${theme.width}px;`,
slim: (val, theme) => val === true && (
name: 'content',
styles: {
__base: memoThemeValue((val, theme) => css`max-width: ${theme.width}px;`),
slim: memoThemeValue((val, theme) => val === true && (
css`max-width: ${theme.slimWidth || theme.width * 0.61803398875}px;`
)
))
},
defaultTheme,
themePath: 'content'
defaultTheme
})


export default React.forwardRef(
const Content = React.forwardRef(
function Content (props, innerRef) {
return SFC({
__base: true,
Expand All @@ -52,3 +47,6 @@ export default React.forwardRef(
})
}
)

export default Content
Content.propTypes /* remove-proptypes */ = {slim: PropTypes.bool}
2 changes: 1 addition & 1 deletion packages/hamburger-menu/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@stellar-apps/hamburger-menu",
"version": "3.0.1",
"version": "3.0.3",
"main": "dist/cjs/index.js",
"author": "Jared Lunde <[email protected]> (https://BeStellar.co)",
"license": "MIT",
Expand Down
6 changes: 4 additions & 2 deletions packages/hamburger-menu/src/HamburgerMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const containerPropNames = [
'verySlow'
]

export default React.memo(
const HamburgerMenu = React.memo(
React.forwardRef(
function HamburgerMenu (
{
Expand Down Expand Up @@ -57,4 +57,6 @@ export default React.memo(
)
}
)
)
)

export default HamburgerMenu
22 changes: 12 additions & 10 deletions packages/hamburger-menu/src/createHamburger.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,14 @@ const defaultTheme = {
contain: strict;
`
}
const themePath = 'hamburger'

const SFC = createComponent({
name: 'Hamburger',
propTypes: {
color: PropTypes.string,
lineNo: PropTypes.number
},
CSS: {
name: 'hamburger',
styles: {
lineNo: (n, theme) => theme.getLine(n, theme),
color: (val, theme) => val && colorize('background-color', val, theme)
},
defaultTheme,
themePath: 'hamburger'
defaultTheme
})

export default function createHamburger (
Expand All @@ -55,7 +50,7 @@ export default function createHamburger (
lines.push(<SFC {...sfcProps}/>)
}

return function Hamburger ({show, hide, toggle, isVisible}) {
const Hamburger = ({show, hide, toggle, isVisible}) => {
return closeButton !== void 0 && isVisible === true
? closeButton({show, hide, toggle, isVisible, lines, ref})
: <Button
Expand All @@ -74,4 +69,11 @@ export default function createHamburger (
children={lines}
/>
}

Hamburger.propTypes /* remove-proptypes */ = {
color: PropTypes.string,
lineNo: PropTypes.number
}

return Hamburger
}
28 changes: 10 additions & 18 deletions packages/inst-templates/create-react-apollo-app/lib/src/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,25 +26,17 @@ const requestHeadersLink = createRequestHeadersLink({
)
})
const apolloClient = createApolloClient(requestHeadersLink, httpLink)

async function render (App) {
const app = (
<ApolloProvider client={apolloClient}>
<Router history={history}>
<App/>
</Router>
</ApolloProvider>
)

if (process.env.NODE_ENV === 'production') {
await Broker.loadInitial()
}

return ReactDOM.hydrate(app, root)
}
const hydrate = App => ReactDOM.hydrate(
<ApolloProvider client={apolloClient}>
<Router history={history}>
<App/>
</Router>
</ApolloProvider>,
root
)

if (__DEV__) {
module.hot && module.hot.accept('./index', () => render(require('./index').default))
module.hot && module.hot.accept('./index', () => hydrate(require('./index').default))
}

render(App)
Broker.loadInitial().then(() => hydrate(App))
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@stellar-apps/create-react-apollo-app",
"version": "1.0.16",
"version": "1.0.17",
"main": "index.js",
"author": "Jared Lunde <[email protected]> (https://BeStellar.co)",
"license": "MIT",
Expand Down
2 changes: 1 addition & 1 deletion packages/inst-templates/create-react-app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ module.exports.dependencies = {
"prop-types": "^15.6.2",
"react": "^16.8.1",
"react-dom": "^16.8.1",
"react-broker": "^1.1.2",
"react-broker": "^1.2.0",
"react-helmet-async": "^0.2.0",
"serverless-http": "^1.9.0",
}
Expand Down
13 changes: 3 additions & 10 deletions packages/inst-templates/create-react-app/lib/src/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,10 @@ import App from './index'


const root = document.getElementById('⚛️')

async function render (App) {
if (process.env.NODE_ENV === 'production') {
await Broker.loadInitial()
}

return ReactDOM.hydrate(<App/>, root)
}
const hydrate = App => ReactDOM.hydrate(<App/>, root)

if (__DEV__) {
module.hot && module.hot.accept('./index', () => render(require('./index').default))
module.hot && module.hot.accept('./index', () => hydrate(require('./index').default))
}

render(App)
Broker.loadInitial().then(() => hydrate(App))
2 changes: 1 addition & 1 deletion packages/inst-templates/create-react-app/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@stellar-apps/create-react-app",
"version": "1.0.45",
"version": "1.0.46",
"main": "index.js",
"author": "Jared Lunde <[email protected]> (https://BeStellar.co)",
"license": "MIT",
Expand Down
4 changes: 2 additions & 2 deletions packages/inst-templates/create-react-router-app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ module.exports.dependencies = {
...reactApp.dependencies,
"resolve-url": "^0.2.1",
"react-router-dom": "^4.3.1",
"@jaredlunde/curls-addons": "^3.0.3",
"@stellar-apps/min-height-hero": "^2.0.0"
"@jaredlunde/curls-addons": "^4.0.3",
"@stellar-apps/min-height-hero": "^2.0.2"
}

// package.json dev dependencies
Expand Down
15 changes: 3 additions & 12 deletions packages/inst-templates/create-react-router-app/lib/src/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,10 @@ import App from './index'

const history = createHistory()
const root = document.getElementById('⚛️')

async function render (App) {
const app = <Router history={history} children={<App/>}/>

if (process.env.NODE_ENV === 'production') {
await Broker.loadInitial()
}

return ReactDOM.hydrate(app, root)
}
const hydrate = App => ReactDOM.hydrate(<Router history={history} children={<App/>}/>, root)

if (__DEV__) {
module.hot && module.hot.accept('./index', () => render(require('./index').default))
module.hot && module.hot.accept('./index', () => hydrate(require('./index').default))
}

render(App)
Broker.loadInitial().then(() => hydrate(App))
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@stellar-apps/create-react-router-app",
"version": "1.0.23",
"version": "1.0.25",
"main": "index.js",
"author": "Jared Lunde <[email protected]> (https://BeStellar.co)",
"license": "MIT",
Expand Down
2 changes: 1 addition & 1 deletion packages/min-height-hero/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@stellar-apps/min-height-hero",
"version": "2.0.1",
"version": "2.0.2",
"main": "dist/cjs/index.js",
"author": "Jared Lunde <[email protected]> (https://BeStellar.co)",
"license": "MIT",
Expand Down
3 changes: 2 additions & 1 deletion packages/min-height-hero/src/Hero.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export default class Hero extends React.Component {
}

render () {
let {headerID, footerID, maxHeight, ...props} = this.props
let {headerID, footerID, maxHeight, innerRef, ...props} = this.props

if (typeof document !== 'undefined') {
this.headerEl = document.getElementById(headerID)
Expand All @@ -53,6 +53,7 @@ export default class Hero extends React.Component {
wrap
w='100%'
minH={this.getHeight(height)}
ref={innerRef}
{...props}
/>
)}
Expand Down
2 changes: 1 addition & 1 deletion packages/viewport-hero/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@stellar-apps/viewport-hero",
"version": "2.0.0",
"version": "2.0.1",
"main": "dist/cjs/index.js",
"author": "Jared Lunde <[email protected]> (https://BeStellar.co)",
"license": "MIT",
Expand Down
3 changes: 2 additions & 1 deletion packages/viewport-hero/src/Hero.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export default class Hero extends React.Component {
}

render () {
let {children, headerID, footerID, trimFrom, ...props} = this.props
let {children, headerID, footerID, trimFrom, innerRef, ...props} = this.props

if (typeof document !== 'undefined') {
this.headerEl = document.getElementById(this.props.headerID)
Expand All @@ -32,6 +32,7 @@ export default class Hero extends React.Component {
CurlsHero, {
key: `hero-${this.didMount}`,
trimHeight,
ref: innerRef,
...props,
children
}
Expand Down

0 comments on commit a9f1cb3

Please sign in to comment.