Compare commits
2 Commits
65904850ac
...
9301aed3e3
| Author | SHA1 | Date | |
|---|---|---|---|
| 9301aed3e3 | |||
| dcf4f1062b |
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@because/forge",
|
"name": "@because/forge",
|
||||||
"version": "0.0.8",
|
"version": "0.0.9",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"main": "src/index.tsx",
|
"main": "src/index.tsx",
|
||||||
"module": "src/index.tsx",
|
"module": "src/index.tsx",
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,9 @@
|
||||||
import { type TagDef, type HTMLTag, UnitlessProps, NonStyleKeys } from './types'
|
import { type TagDef, type HTMLTag, UnitlessProps, NonStyleKeys } from './types'
|
||||||
|
|
||||||
|
type ForgeComponent<Parts = {}> =
|
||||||
|
((props: Record<string, any>) => any) &
|
||||||
|
{ [K in keyof Parts]: (props: Record<string, any>) => any }
|
||||||
|
|
||||||
export const styles: Record<string, Record<string, string>> = {}
|
export const styles: Record<string, Record<string, string>> = {}
|
||||||
const themes: Record<string, Record<string, any>> = {}
|
const themes: Record<string, Record<string, any>> = {}
|
||||||
|
|
||||||
|
|
@ -288,6 +292,8 @@ export function createScope(scope: string) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// the main event
|
// the main event
|
||||||
|
export function define<const T extends TagDef>(name: string, def: T): ForgeComponent<T['parts']>
|
||||||
|
export function define<const T extends TagDef>(def: T): ForgeComponent<T['parts']>
|
||||||
export function define(nameOrDef: string | TagDef, defIfNamed?: TagDef) {
|
export function define(nameOrDef: string | TagDef, defIfNamed?: TagDef) {
|
||||||
const def = defIfNamed ?? nameOrDef as TagDef
|
const def = defIfNamed ?? nameOrDef as TagDef
|
||||||
const name = defIfNamed ? (nameOrDef as string) : anonName(def)
|
const name = defIfNamed ? (nameOrDef as string) : anonName(def)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user