forked from chakra-ui/zag
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d711d3c
commit c32502f
Showing
6 changed files
with
40 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,3 +3,4 @@ node_modules | |
coverage | ||
.next | ||
build | ||
*.hbs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,9 @@ | ||
export * from "./{{machine}}.connect" | ||
export * from "./{{machine}}.machine" | ||
import { {{machine}}Connect } from "./{{machine}}.connect" | ||
import { {{machine}}Machine } from "./{{machine}}.machine" | ||
|
||
export const {{machine}} = { | ||
machine: {{machine}}Machine, | ||
connect: {{machine}}Connect, | ||
} | ||
|
||
export type { {{capitalize machine}}MachineContext, {{capitalize machine}}MachineState } from "./{{machine}}.types" |
17 changes: 5 additions & 12 deletions
17
plop-templates/machine-template/{{machine}}.connect.ts.hbs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
import { | ||
{{capitalize machine}}MachineContext } from "./{{machine}}.machine" export function getIds(uid: string) { return { } } | ||
export function getElements(ctx: | ||
{{capitalize machine}}MachineContext) { const doc = ctx.doc ?? document const ids = getIds(ctx.uid) return { } } | ||
import type { {{capitalize machine}}MachineContext as Ctx } from "./{{machine}}.types" | ||
|
||
export const dom = { | ||
getDoc: (ctx: Ctx) => ctx.doc ?? document, | ||
getRootId: (ctx: Ctx) => `{{machine}}-${ctx.uid}`, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import type { StateMachine as S } from "@ui-machines/core" | ||
import type { Context } from "../utils" | ||
|
||
export type {{capitalize machine}}MachineContext = Context<{ | ||
}> | ||
|
||
export type {{capitalize machine}}MachineState = { | ||
value: "unknown" | "idle" | "focused" | ||
} | ||
|
||
export type {{capitalize machine}}State = S.State<{{capitalize machine}}MachineContext, {{capitalize machine}}MachineState> | ||
|
||
export type {{capitalize machine}}Send = S.Send<S.AnyEventObject> | ||
|
||
export type {{capitalize machine}}ItemProps = { | ||
value: string | ||
disabled?: boolean | ||
} |