diff --git a/runtime.ts b/runtime.ts index 92500085..df42b5f9 100644 --- a/runtime.ts +++ b/runtime.ts @@ -1,3 +1,4 @@ +import "./src/types.ts"; export * from "./src/runtime/utils.ts"; export * from "./src/runtime/head.ts"; export * from "./src/runtime/csp.ts"; diff --git a/server.ts b/server.ts index f519fbba..e81fecdd 100644 --- a/server.ts +++ b/server.ts @@ -1 +1,2 @@ +import "./src/types.ts"; export * from "./src/server/mod.ts"; diff --git a/src/types.ts b/src/types.ts new file mode 100644 index 00000000..fc03cfc9 --- /dev/null +++ b/src/types.ts @@ -0,0 +1,21 @@ +export interface SignalLike { + value: T; + peek(): T; + subscribe(fn: (value: T) => void): () => void; +} + +declare global { + namespace preact.createElement.JSX { + interface HTMLAttributes { + /** + * Alternative url to fetch partials from on `` or `
` tags + */ + "f-partial"?: string | SignalLike; + /** + * Enable or disable client side navigation and partials for this + * particular node and its children. + */ + "f-client-nav"?: boolean | SignalLike; + } + } +} diff --git a/tests/fixture_partials/routes/client_nav/_layout.tsx b/tests/fixture_partials/routes/client_nav/_layout.tsx index 714741f4..810c8249 100644 --- a/tests/fixture_partials/routes/client_nav/_layout.tsx +++ b/tests/fixture_partials/routes/client_nav/_layout.tsx @@ -10,7 +10,7 @@ export default function AppLayout({ Component }: AppProps) { fresh title - + diff --git a/tests/fixture_partials/routes/client_nav_opt_out/_layout.tsx b/tests/fixture_partials/routes/client_nav_opt_out/_layout.tsx index c733ceb4..18a5e617 100644 --- a/tests/fixture_partials/routes/client_nav_opt_out/_layout.tsx +++ b/tests/fixture_partials/routes/client_nav_opt_out/_layout.tsx @@ -10,7 +10,7 @@ export default function AppLayout({ Component }: AppProps) { fresh title - +