-
-
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.
Svelte and React templates, lazy pages fix, adminBar page prop and im…
…proved Vue template files #minor
- Loading branch information
1 parent
2fe1c80
commit 18bfd28
Showing
39 changed files
with
698 additions
and
96 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
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,7 @@ | ||
- **Feature**: Svelte template now available via `wp inertia:create-theme` command | ||
- **Feature**: React template now available via `wp inertia:create-theme` command | ||
- **Feature**: Edit and Comment nodes returned via `wp.adminBar` on Inertia requests | ||
|
||
- **Improvement**: Included more detailed templates/layouts for theme bootstrapper | ||
|
||
- **BugFix**: Duplicated inertia instances when using code-splitting on pages |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,21 +1,25 @@ | ||
export const resolveInertiaPage = (glob, layout = null) => { | ||
return async function (name) { | ||
let resolvedPage = glob[`./pages/${name}.vue`]; | ||
if (!resolvedPage) { | ||
console.error(`[Inertia] Couldn't find page matching "${name}"`); | ||
return null; | ||
} | ||
export const resolveInertiaPage = ( | ||
glob, | ||
layout = null, | ||
layoutCallback = null | ||
) => { | ||
return async function (name) { | ||
let resolvedPage = glob[`./pages/${name}.vue`]; | ||
if (!resolvedPage) { | ||
console.error(`[Inertia] Couldn't find page matching "${name}"`); | ||
return null; | ||
} | ||
|
||
if (typeof resolvedPage === "function") { | ||
resolvedPage = await resolvedPage(); | ||
} | ||
if (typeof resolvedPage === "function") { | ||
resolvedPage = await resolvedPage(); | ||
} | ||
|
||
if (typeof layout === "function") { | ||
resolvedPage.default.layout = layout(name, resolvedPage); | ||
} else if (layout) { | ||
resolvedPage.default.layout = layout; | ||
} | ||
if (layoutCallback) { | ||
resolvedPage.default.layout = layoutCallback(name, resolvedPage); | ||
} else if (layout) { | ||
resolvedPage.default.layout = resolvedPage.default.layout || layout; | ||
} | ||
|
||
return resolvedPage; | ||
}; | ||
return resolvedPage; | ||
}; | ||
}; |
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,26 @@ | ||
export const resolveInertiaPage = ( | ||
glob, | ||
Layout = null, | ||
layoutCallback = null | ||
) => { | ||
return async function (name) { | ||
let resolvedPage = glob[`./pages/${name}.jsx`]; | ||
if (!resolvedPage) { | ||
console.error(`[Inertia] Couldn't find page matching "${name}"`); | ||
return null; | ||
} | ||
|
||
if (typeof resolvedPage === "function") { | ||
resolvedPage = await resolvedPage(); | ||
} | ||
|
||
if (layoutCallback) { | ||
resolvedPage.default.layout = layoutCallback(name, resolvedPage); | ||
} else if (Layout) { | ||
resolvedPage.default.layout = | ||
resolvedPage.default.layout || ((page) => <Layout children={page} />); | ||
} | ||
|
||
return resolvedPage; | ||
}; | ||
}; |
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,29 @@ | ||
export const resolveInertiaPage = ( | ||
glob, | ||
layout = null, | ||
layoutCallback = null | ||
) => { | ||
return async function (name) { | ||
let resolvedPage = glob[`./pages/${name}.svelte`]; | ||
if (!resolvedPage) { | ||
console.error(`[Inertia] Couldn't find page matching "${name}"`); | ||
return null; | ||
} | ||
|
||
if (typeof resolvedPage === "function") { | ||
resolvedPage = await resolvedPage(); | ||
} | ||
|
||
if (layoutCallback) { | ||
return { | ||
default: resolvedPage.default, | ||
layout: layoutCallback(name, resolvedPage), | ||
}; | ||
} else { | ||
return { | ||
default: resolvedPage.default, | ||
layout: resolvedPage.layout || layout, | ||
}; | ||
} | ||
}; | ||
}; |
Oops, something went wrong.