Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: contextual styled-jsx #721

Merged
merged 12 commits into from
Sep 3, 2021
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 17 additions & 3 deletions index.d.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,24 @@
// Definitions by: @types/styled-jsx <https://www.npmjs.com/package/@types/styled-jsx>

import 'react'
import React from 'react'

declare module 'react' {
interface StyleHTMLAttributes<T> extends HTMLAttributes<T> {
jsx?: boolean
global?: boolean
}
}

export type StyleRegistry = {
styles(options?: { nonce?: boolean }): JSX.Element
flush(): void
add(props: any): void
remove(props: any): void
}
export function useStyleRegistry(): StyleRegistry
export function StyleRegistry({
children,
registry
}: {
children: JSX.Element | React.ReactNode
registry?: StyleRegistry
}): JSX.Element
export function createStyleRegistry(): StyleRegistry
1 change: 1 addition & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = require('./dist')
5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@
"dist",
"lib",
"index.d.ts",
"server.js",
"server.d.ts",
"index.js",
"babel.js",
"babel-test.js",
"style.js",
Expand All @@ -25,7 +24,7 @@
"test": "ava",
"lint": "eslint ./src",
"format": "prettier --write \"./{src,test}/**/*.{js,css}\"",
"prepublishOnly": "yarn build && yarn test && yarn lint --quiet"
"prepublishOnly": "rm -rf dist && yarn build && yarn test && yarn lint --quiet"
},
"husky": {
"hooks": {
Expand Down
Loading