fix: use consistent partial attribute naming (#1847)
This commit is contained in:
+3
-2
@@ -1,6 +1,7 @@
|
|||||||
export const PARTIAL_SEARCH_PARAM = "fresh-partial";
|
export const PARTIAL_SEARCH_PARAM = "fresh-partial";
|
||||||
export const PARTIAL_ATTR = "fh-partial";
|
export const PARTIAL_ATTR = "f-partial";
|
||||||
export const LOADING_ATTR = "fh-loading";
|
export const LOADING_ATTR = "f-loading";
|
||||||
|
export const CLIENT_NAV_ATTR = "f-client-nav";
|
||||||
export const DATA_KEY_ATTR = "data-fresh-key";
|
export const DATA_KEY_ATTR = "data-fresh-key";
|
||||||
|
|
||||||
export const enum PartialMode {
|
export const enum PartialMode {
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ import { assetHashingHook } from "../utils.ts";
|
|||||||
import { type SerializedState } from "../../server/rendering/fresh_tags.tsx";
|
import { type SerializedState } from "../../server/rendering/fresh_tags.tsx";
|
||||||
import type { Signal } from "@preact/signals";
|
import type { Signal } from "@preact/signals";
|
||||||
import {
|
import {
|
||||||
|
CLIENT_NAV_ATTR,
|
||||||
DATA_KEY_ATTR,
|
DATA_KEY_ATTR,
|
||||||
LOADING_ATTR,
|
LOADING_ATTR,
|
||||||
PARTIAL_ATTR,
|
PARTIAL_ATTR,
|
||||||
@@ -748,11 +749,11 @@ document.addEventListener("click", async (e) => {
|
|||||||
// There are two cases to account for:
|
// There are two cases to account for:
|
||||||
// 1. Partial request
|
// 1. Partial request
|
||||||
// 2. Normal request (turbolink-style)
|
// 2. Normal request (turbolink-style)
|
||||||
const settingEl = el.closest("[fresh-client-nav]");
|
const settingEl = el.closest(`[${CLIENT_NAV_ATTR}]`);
|
||||||
if (
|
if (
|
||||||
partial === null && (
|
partial === null && (
|
||||||
settingEl === null ||
|
settingEl === null ||
|
||||||
settingEl.getAttribute("fresh-client-nav") !== "true"
|
settingEl.getAttribute(CLIENT_NAV_ATTR) !== "true"
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -14,8 +14,8 @@ export default function PartialTrigger(
|
|||||||
<a
|
<a
|
||||||
class={props.class}
|
class={props.class}
|
||||||
href={props.href}
|
href={props.href}
|
||||||
fh-partial={props.partial}
|
f-partial={props.partial}
|
||||||
fh-loading={props.loading}
|
f-loading={props.loading}
|
||||||
>
|
>
|
||||||
{props.children}
|
{props.children}
|
||||||
</a>
|
</a>
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ export default function AppLayout({ Component }: AppProps) {
|
|||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
<title>fresh title</title>
|
<title>fresh title</title>
|
||||||
</head>
|
</head>
|
||||||
<body fresh-client-nav="true">
|
<body f-client-nav="true">
|
||||||
<Partial name="body">
|
<Partial name="body">
|
||||||
<Fader>
|
<Fader>
|
||||||
<Component />
|
<Component />
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ export default function AppLayout({ Component }: AppProps) {
|
|||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
<title>fresh title</title>
|
<title>fresh title</title>
|
||||||
</head>
|
</head>
|
||||||
<body fresh-client-nav="false">
|
<body f-client-nav="false">
|
||||||
<Partial name="body">
|
<Partial name="body">
|
||||||
<Fader>
|
<Fader>
|
||||||
<Component />
|
<Component />
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import { Partial } from "$fresh/runtime.ts";
|
|||||||
export default function SlotDemo() {
|
export default function SlotDemo() {
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<form fh-partial="/form/update">
|
<form f-partial="/form/update">
|
||||||
<Partial name="slot-1">
|
<Partial name="slot-1">
|
||||||
<p class="status">Default content</p>
|
<p class="status">Default content</p>
|
||||||
<p>
|
<p>
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ export default function SlotDemo() {
|
|||||||
<a
|
<a
|
||||||
class="update-link"
|
class="update-link"
|
||||||
href="/island_instance/injected"
|
href="/island_instance/injected"
|
||||||
fh-partial="/island_instance/partial"
|
f-partial="/island_instance/partial"
|
||||||
>
|
>
|
||||||
Update
|
Update
|
||||||
</a>
|
</a>
|
||||||
@@ -24,7 +24,7 @@ export default function SlotDemo() {
|
|||||||
<a
|
<a
|
||||||
class="remove-link"
|
class="remove-link"
|
||||||
href="/island_instance/injected"
|
href="/island_instance/injected"
|
||||||
fh-partial="/island_instance/partial_remove"
|
f-partial="/island_instance/partial_remove"
|
||||||
>
|
>
|
||||||
Remove
|
Remove
|
||||||
</a>
|
</a>
|
||||||
@@ -33,7 +33,7 @@ export default function SlotDemo() {
|
|||||||
<a
|
<a
|
||||||
class="replace-link"
|
class="replace-link"
|
||||||
href="/island_instance/injected"
|
href="/island_instance/injected"
|
||||||
fh-partial="/island_instance/partial_replace"
|
f-partial="/island_instance/partial_replace"
|
||||||
>
|
>
|
||||||
Replace
|
Replace
|
||||||
</a>
|
</a>
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ export default function SlotDemo() {
|
|||||||
<a
|
<a
|
||||||
class="update-second-link"
|
class="update-second-link"
|
||||||
href="/island_instance_multiple/injected"
|
href="/island_instance_multiple/injected"
|
||||||
fh-partial="/island_instance_multiple/partial"
|
f-partial="/island_instance_multiple/partial"
|
||||||
>
|
>
|
||||||
update second
|
update second
|
||||||
</a>
|
</a>
|
||||||
@@ -35,7 +35,7 @@ export default function SlotDemo() {
|
|||||||
<a
|
<a
|
||||||
class="update-both-link"
|
class="update-both-link"
|
||||||
href="/island_instance_multiple/injected"
|
href="/island_instance_multiple/injected"
|
||||||
fh-partial="/island_instance_multiple/partial_both"
|
f-partial="/island_instance_multiple/partial_both"
|
||||||
>
|
>
|
||||||
update both
|
update both
|
||||||
</a>
|
</a>
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ export default function SlotDemo() {
|
|||||||
<a
|
<a
|
||||||
class="update-link"
|
class="update-link"
|
||||||
href="/island_instance_nested/injected"
|
href="/island_instance_nested/injected"
|
||||||
fh-partial="/island_instance_nested/partial"
|
f-partial="/island_instance_nested/partial"
|
||||||
>
|
>
|
||||||
update
|
update
|
||||||
</a>
|
</a>
|
||||||
@@ -33,7 +33,7 @@ export default function SlotDemo() {
|
|||||||
<a
|
<a
|
||||||
class="replace-link"
|
class="replace-link"
|
||||||
href="/island_instance_nested/injected"
|
href="/island_instance_nested/injected"
|
||||||
fh-partial="/island_instance_nested/replace"
|
f-partial="/island_instance_nested/replace"
|
||||||
>
|
>
|
||||||
replace
|
replace
|
||||||
</a>
|
</a>
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ export default function PropsDemo() {
|
|||||||
<a
|
<a
|
||||||
class="update-link"
|
class="update-link"
|
||||||
href="/island_props/injected"
|
href="/island_props/injected"
|
||||||
fh-partial="/island_props/partial"
|
f-partial="/island_props/partial"
|
||||||
>
|
>
|
||||||
Update
|
Update
|
||||||
</a>
|
</a>
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ export default function PropsDemo() {
|
|||||||
<a
|
<a
|
||||||
class="update-link"
|
class="update-link"
|
||||||
href="/island_props_signals/injected"
|
href="/island_props_signals/injected"
|
||||||
fh-partial="/island_props_signals/partial"
|
f-partial="/island_props_signals/partial"
|
||||||
>
|
>
|
||||||
Update
|
Update
|
||||||
</a>
|
</a>
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ export default function SlotDemo() {
|
|||||||
<a
|
<a
|
||||||
class="swap-link"
|
class="swap-link"
|
||||||
href="/keys/injected"
|
href="/keys/injected"
|
||||||
fh-partial="/keys/swap"
|
f-partial="/keys/swap"
|
||||||
>
|
>
|
||||||
swap
|
swap
|
||||||
</a>
|
</a>
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ export default function SlotDemo() {
|
|||||||
<a
|
<a
|
||||||
class="swap-link"
|
class="swap-link"
|
||||||
href="/keys_components/injected"
|
href="/keys_components/injected"
|
||||||
fh-partial="/keys_components/swap"
|
f-partial="/keys_components/swap"
|
||||||
>
|
>
|
||||||
swap
|
swap
|
||||||
</a>
|
</a>
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ export default function SlotDemo() {
|
|||||||
<a
|
<a
|
||||||
class="swap-link"
|
class="swap-link"
|
||||||
href="/keys_dom/injected"
|
href="/keys_dom/injected"
|
||||||
fh-partial="/keys_dom/swap"
|
f-partial="/keys_dom/swap"
|
||||||
>
|
>
|
||||||
swap
|
swap
|
||||||
</a>
|
</a>
|
||||||
|
|||||||
@@ -17,8 +17,8 @@ export default function SlotDemo() {
|
|||||||
<a
|
<a
|
||||||
class="update-link"
|
class="update-link"
|
||||||
href="/loading/injected"
|
href="/loading/injected"
|
||||||
fh-partial="/loading/update"
|
f-partial="/loading/update"
|
||||||
fh-loading={sig}
|
f-loading={sig}
|
||||||
>
|
>
|
||||||
update
|
update
|
||||||
</a>
|
</a>
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ export default function WarnDemo() {
|
|||||||
<a
|
<a
|
||||||
class="update-link"
|
class="update-link"
|
||||||
href="/missing_partial/injected"
|
href="/missing_partial/injected"
|
||||||
fh-partial="/missing_partial/update"
|
f-partial="/missing_partial/update"
|
||||||
>
|
>
|
||||||
update
|
update
|
||||||
</a>
|
</a>
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ export default function ModeDemo() {
|
|||||||
<a
|
<a
|
||||||
class="replace-link"
|
class="replace-link"
|
||||||
href="/mode/injected"
|
href="/mode/injected"
|
||||||
fh-partial="/mode/replace"
|
f-partial="/mode/replace"
|
||||||
>
|
>
|
||||||
replace
|
replace
|
||||||
</a>
|
</a>
|
||||||
@@ -24,7 +24,7 @@ export default function ModeDemo() {
|
|||||||
<a
|
<a
|
||||||
class="append-link"
|
class="append-link"
|
||||||
href="/mode/injected"
|
href="/mode/injected"
|
||||||
fh-partial="/mode/append"
|
f-partial="/mode/append"
|
||||||
>
|
>
|
||||||
append
|
append
|
||||||
</a>
|
</a>
|
||||||
@@ -33,7 +33,7 @@ export default function ModeDemo() {
|
|||||||
<a
|
<a
|
||||||
class="prepend-link"
|
class="prepend-link"
|
||||||
href="/mode/injected"
|
href="/mode/injected"
|
||||||
fh-partial="/mode/prepend"
|
f-partial="/mode/prepend"
|
||||||
>
|
>
|
||||||
prepend
|
prepend
|
||||||
</a>
|
</a>
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ export default function SlotDemo() {
|
|||||||
<a
|
<a
|
||||||
class="update-link"
|
class="update-link"
|
||||||
href="/no_islands/injected"
|
href="/no_islands/injected"
|
||||||
fh-partial="/no_islands/update"
|
f-partial="/no_islands/update"
|
||||||
>
|
>
|
||||||
update
|
update
|
||||||
</a>
|
</a>
|
||||||
|
|||||||
Reference in New Issue
Block a user