From 464b4c3d6a605389fbf526c315af990aa7d33763 Mon Sep 17 00:00:00 2001
From: Joe Fusco
Date: Fri, 18 Aug 2023 16:08:13 -0400
Subject: [PATCH 01/13] Add new block-support example project
Signed-off-by: Joe Fusco
---
examples/next/block-support/.env.local.sample | 5 +
examples/next/block-support/.eslintignore | 2 +
examples/next/block-support/.gitignore | 2 +
examples/next/block-support/README.md | 3 +
.../block-support/components/Container.js | 12 +
.../components/ContentWrapper.js | 13 +
.../block-support/components/EntryHeader.js | 34 +
.../block-support/components/FeaturedImage.js | 51 ++
.../next/block-support/components/Footer.js | 18 +
.../block-support/components/FormatDate.js | 16 +
.../next/block-support/components/Head.js | 58 ++
.../next/block-support/components/Header.js | 45 ++
.../next/block-support/components/Heading.js | 7 +
.../next/block-support/components/Hero.js | 17 +
.../next/block-support/components/Main.js | 18 +
.../components/NavigationMenu.js | 67 ++
.../next/block-support/components/Post.js | 40 +
.../next/block-support/components/PostInfo.js | 19 +
.../components/SkipNavigationLink.js | 16 +
.../next/block-support/components/index.js | 15 +
.../next/block-support/constants/menus.js | 2 +
.../next/block-support/constants/selectors.js | 1 +
examples/next/block-support/faust.config.js | 12 +
.../fragments/GeneralSettings.js | 8 +
examples/next/block-support/next.config.js | 18 +
examples/next/block-support/package.json | 30 +
.../block-support/pages/[...wordpressNode].js | 16 +
examples/next/block-support/pages/_app.js | 25 +
.../pages/api/faust/[[...route]].js | 4 +
examples/next/block-support/pages/example.js | 79 ++
examples/next/block-support/pages/index.js | 9 +
examples/next/block-support/pages/preview.js | 5 +
.../next/block-support/styles/_blocks.scss | 14 +
.../block-support/styles/_breakpoints.scss | 5 +
.../next/block-support/styles/_utilities.scss | 25 +
.../styles/components/Container.module.scss | 7 +
.../components/ContentWrapper.module.scss | 134 ++++
.../styles/components/EntryHeader.module.scss | 65 ++
.../styles/components/Footer.module.scss | 11 +
.../styles/components/Header.module.scss | 72 ++
.../styles/components/Hero.module.scss | 26 +
.../styles/components/Main.module.scss | 4 +
.../components/NavigationMenu.module.scss | 101 +++
.../NavigationMenuClassesFromWP.module.scss | 25 +
.../styles/components/Post.module.scss | 16 +
.../styles/components/PostInfo.module.scss | 3 +
.../components/SkipNavigationLink.module.scss | 9 +
.../next/block-support/styles/global.scss | 7 +
examples/next/block-support/theme.json | 741 ++++++++++++++++++
.../next/block-support/wp-blocks/index.js | 15 +
.../block-support/wp-templates/category.js | 106 +++
.../block-support/wp-templates/front-page.js | 74 ++
.../next/block-support/wp-templates/index.js | 13 +
.../next/block-support/wp-templates/page.js | 126 +++
.../next/block-support/wp-templates/single.js | 137 ++++
.../next/block-support/wp-templates/tag.js | 106 +++
package-lock.json | 252 ++++++
package.json | 1 +
58 files changed, 2762 insertions(+)
create mode 100644 examples/next/block-support/.env.local.sample
create mode 100644 examples/next/block-support/.eslintignore
create mode 100644 examples/next/block-support/.gitignore
create mode 100644 examples/next/block-support/README.md
create mode 100644 examples/next/block-support/components/Container.js
create mode 100644 examples/next/block-support/components/ContentWrapper.js
create mode 100644 examples/next/block-support/components/EntryHeader.js
create mode 100644 examples/next/block-support/components/FeaturedImage.js
create mode 100644 examples/next/block-support/components/Footer.js
create mode 100644 examples/next/block-support/components/FormatDate.js
create mode 100644 examples/next/block-support/components/Head.js
create mode 100644 examples/next/block-support/components/Header.js
create mode 100644 examples/next/block-support/components/Heading.js
create mode 100644 examples/next/block-support/components/Hero.js
create mode 100644 examples/next/block-support/components/Main.js
create mode 100644 examples/next/block-support/components/NavigationMenu.js
create mode 100644 examples/next/block-support/components/Post.js
create mode 100644 examples/next/block-support/components/PostInfo.js
create mode 100644 examples/next/block-support/components/SkipNavigationLink.js
create mode 100644 examples/next/block-support/components/index.js
create mode 100644 examples/next/block-support/constants/menus.js
create mode 100644 examples/next/block-support/constants/selectors.js
create mode 100644 examples/next/block-support/faust.config.js
create mode 100644 examples/next/block-support/fragments/GeneralSettings.js
create mode 100644 examples/next/block-support/next.config.js
create mode 100644 examples/next/block-support/package.json
create mode 100644 examples/next/block-support/pages/[...wordpressNode].js
create mode 100644 examples/next/block-support/pages/_app.js
create mode 100644 examples/next/block-support/pages/api/faust/[[...route]].js
create mode 100644 examples/next/block-support/pages/example.js
create mode 100644 examples/next/block-support/pages/index.js
create mode 100644 examples/next/block-support/pages/preview.js
create mode 100644 examples/next/block-support/styles/_blocks.scss
create mode 100644 examples/next/block-support/styles/_breakpoints.scss
create mode 100644 examples/next/block-support/styles/_utilities.scss
create mode 100644 examples/next/block-support/styles/components/Container.module.scss
create mode 100644 examples/next/block-support/styles/components/ContentWrapper.module.scss
create mode 100644 examples/next/block-support/styles/components/EntryHeader.module.scss
create mode 100644 examples/next/block-support/styles/components/Footer.module.scss
create mode 100644 examples/next/block-support/styles/components/Header.module.scss
create mode 100644 examples/next/block-support/styles/components/Hero.module.scss
create mode 100644 examples/next/block-support/styles/components/Main.module.scss
create mode 100644 examples/next/block-support/styles/components/NavigationMenu.module.scss
create mode 100644 examples/next/block-support/styles/components/NavigationMenuClassesFromWP.module.scss
create mode 100644 examples/next/block-support/styles/components/Post.module.scss
create mode 100644 examples/next/block-support/styles/components/PostInfo.module.scss
create mode 100644 examples/next/block-support/styles/components/SkipNavigationLink.module.scss
create mode 100644 examples/next/block-support/styles/global.scss
create mode 100644 examples/next/block-support/theme.json
create mode 100644 examples/next/block-support/wp-blocks/index.js
create mode 100644 examples/next/block-support/wp-templates/category.js
create mode 100644 examples/next/block-support/wp-templates/front-page.js
create mode 100644 examples/next/block-support/wp-templates/index.js
create mode 100644 examples/next/block-support/wp-templates/page.js
create mode 100644 examples/next/block-support/wp-templates/single.js
create mode 100644 examples/next/block-support/wp-templates/tag.js
diff --git a/examples/next/block-support/.env.local.sample b/examples/next/block-support/.env.local.sample
new file mode 100644
index 000000000..dc631ae73
--- /dev/null
+++ b/examples/next/block-support/.env.local.sample
@@ -0,0 +1,5 @@
+# Your WordPress site URL
+NEXT_PUBLIC_WORDPRESS_URL=https://faustexample.wpengine.com
+
+# Plugin secret found in WordPress Settings->Faust
+# FAUST_SECRET_KEY=YOUR_PLUGIN_SECRET
diff --git a/examples/next/block-support/.eslintignore b/examples/next/block-support/.eslintignore
new file mode 100644
index 000000000..d89107ecc
--- /dev/null
+++ b/examples/next/block-support/.eslintignore
@@ -0,0 +1,2 @@
+components
+pages
diff --git a/examples/next/block-support/.gitignore b/examples/next/block-support/.gitignore
new file mode 100644
index 000000000..0729a3526
--- /dev/null
+++ b/examples/next/block-support/.gitignore
@@ -0,0 +1,2 @@
+globalStylesheet.css
+possibleTypes.json
diff --git a/examples/next/block-support/README.md b/examples/next/block-support/README.md
new file mode 100644
index 000000000..02038a0ef
--- /dev/null
+++ b/examples/next/block-support/README.md
@@ -0,0 +1,3 @@
+# @faustwp/block-support-example
+
+Example showcasing Faust.js block editor support.
diff --git a/examples/next/block-support/components/Container.js b/examples/next/block-support/components/Container.js
new file mode 100644
index 000000000..b6634f65b
--- /dev/null
+++ b/examples/next/block-support/components/Container.js
@@ -0,0 +1,12 @@
+import styles from '../styles/components/Container.module.scss';
+import className from 'classnames/bind';
+
+let cx = className.bind(styles);
+
+export function Container({ children, className }) {
+ return (
+
+ {children}
+
+ );
+}
diff --git a/examples/next/block-support/components/ContentWrapper.js b/examples/next/block-support/components/ContentWrapper.js
new file mode 100644
index 000000000..75e728af6
--- /dev/null
+++ b/examples/next/block-support/components/ContentWrapper.js
@@ -0,0 +1,13 @@
+import className from 'classnames/bind';
+import styles from '../styles/components/ContentWrapper.module.scss';
+
+let cx = className.bind(styles);
+
+export function ContentWrapper({ content, children, className }) {
+ return (
+
+
+ {children}
+
+ );
+}
diff --git a/examples/next/block-support/components/EntryHeader.js b/examples/next/block-support/components/EntryHeader.js
new file mode 100644
index 000000000..edfaa2b35
--- /dev/null
+++ b/examples/next/block-support/components/EntryHeader.js
@@ -0,0 +1,34 @@
+import className from 'classnames/bind';
+import { Heading, PostInfo, Container, FeaturedImage } from '.';
+import styles from '../styles/components/EntryHeader.module.scss';
+
+let cx = className.bind(styles);
+
+export function EntryHeader({ title, image, date, author, className }) {
+ const hasText = title || date || author;
+
+ return (
+
+ {image && (
+
+ )}
+
+ {hasText && (
+
+
+ {!!title && {title}}
+
+
+
+ )}
+
+ );
+}
diff --git a/examples/next/block-support/components/FeaturedImage.js b/examples/next/block-support/components/FeaturedImage.js
new file mode 100644
index 000000000..a25a027e5
--- /dev/null
+++ b/examples/next/block-support/components/FeaturedImage.js
@@ -0,0 +1,51 @@
+import { gql } from '@apollo/client';
+import Image from 'next/image';
+
+export function FeaturedImage({
+ image,
+ width,
+ height,
+ className,
+ priority,
+ layout,
+ ...props
+}) {
+ const src = image?.sourceUrl;
+ const { altText } = image || '';
+
+ width = width ? width : image?.mediaDetails?.width;
+ height = height ? height : image?.mediaDetails?.height;
+ layout = layout ?? 'fill';
+
+ return src && width && height ? (
+
+ ) : null;
+}
+
+FeaturedImage.fragments = {
+ entry: gql`
+ fragment FeaturedImageFragment on NodeWithFeaturedImage {
+ featuredImage {
+ node {
+ id
+ sourceUrl
+ altText
+ mediaDetails {
+ width
+ height
+ }
+ }
+ }
+ }
+ `,
+};
diff --git a/examples/next/block-support/components/Footer.js b/examples/next/block-support/components/Footer.js
new file mode 100644
index 000000000..905cfe5d6
--- /dev/null
+++ b/examples/next/block-support/components/Footer.js
@@ -0,0 +1,18 @@
+import classNames from 'classnames/bind';
+import { Container, NavigationMenu } from '.';
+import styles from '../styles/components/Footer.module.scss';
+
+let cx = classNames.bind(styles);
+
+export function Footer({ title, menuItems }) {
+ const year = new Date().getFullYear();
+
+ return (
+
+ );
+}
diff --git a/examples/next/block-support/components/FormatDate.js b/examples/next/block-support/components/FormatDate.js
new file mode 100644
index 000000000..cb6a762fd
--- /dev/null
+++ b/examples/next/block-support/components/FormatDate.js
@@ -0,0 +1,16 @@
+export function FormatDate({ date }) {
+ let formattedDate = new Date(date);
+
+ if (isNaN(formattedDate.valueOf())) {
+ return null;
+ }
+
+ const timeformat = {
+ year: 'numeric',
+ month: 'long',
+ day: 'numeric',
+ hour12: false
+ };
+
+ return <>{formattedDate.toLocaleDateString('en-US', timeformat)}>;
+}
diff --git a/examples/next/block-support/components/Head.js b/examples/next/block-support/components/Head.js
new file mode 100644
index 000000000..39a2b16d7
--- /dev/null
+++ b/examples/next/block-support/components/Head.js
@@ -0,0 +1,58 @@
+import NextHead from 'next/head';
+
+/**
+ * Adds meta tags to a page.
+ *
+ * @param {Props} props The props object.
+ * @param {string} props.title Used for the page title, og:title, twitter:title, etc.
+ * @param {string} props.description Used for the meta description, og:description, twitter:description, etc.
+ * @param {string} props.imageUrl Used for the og:image and twitter:image. NOTE: Must be an absolute url.
+ * @param {string} props.url Used for the og:url and twitter:url.
+ *
+ * @returns {React.ReactElement} The Head component
+ */
+export function Head({ title, description, imageUrl, url }) {
+ if (!title && !description && !imageUrl && !url) {
+ return null;
+ }
+
+ return (
+ <>
+
+
+
+
+ {title && (
+ <>
+ {title}
+
+
+
+ >
+ )}
+
+ {description && (
+ <>
+
+
+
+ >
+ )}
+
+ {imageUrl && (
+ <>
+
+
+ >
+ )}
+
+ {url && (
+ <>
+
+
+ >
+ )}
+
+ >
+ );
+}
diff --git a/examples/next/block-support/components/Header.js b/examples/next/block-support/components/Header.js
new file mode 100644
index 000000000..d9170467c
--- /dev/null
+++ b/examples/next/block-support/components/Header.js
@@ -0,0 +1,45 @@
+import { useState } from 'react';
+import classNames from 'classnames/bind';
+import Link from 'next/link';
+import { Container, NavigationMenu, SkipNavigationLink } from '.';
+import styles from '../styles/components/Header.module.scss';
+
+let cx = classNames.bind(styles);
+
+export function Header({
+ title = 'Headless by WP Engine',
+ description,
+ menuItems
+}) {
+ const [isNavShown, setIsNavShown] = useState(false);
+
+ return (
+
+
+
+
+
+
+
{title}
+
+ {description &&
{description}
}
+
+
+
+
+
+
+ );
+}
diff --git a/examples/next/block-support/components/Heading.js b/examples/next/block-support/components/Heading.js
new file mode 100644
index 000000000..c1a6baabe
--- /dev/null
+++ b/examples/next/block-support/components/Heading.js
@@ -0,0 +1,7 @@
+import React from 'react';
+
+export function Heading({ level = 'h1', children, className }) {
+ const Tag = ({ ...props }) => React.createElement(level, props, children);
+
+ return {children};
+}
diff --git a/examples/next/block-support/components/Hero.js b/examples/next/block-support/components/Hero.js
new file mode 100644
index 000000000..9a0b2c036
--- /dev/null
+++ b/examples/next/block-support/components/Hero.js
@@ -0,0 +1,17 @@
+import React from 'react';
+import className from 'classnames/bind';
+import { Heading } from '.';
+import styles from '../styles/components/Hero.module.scss';
+
+let cx = className.bind(styles);
+
+export function Hero({ title, level = 'h2', children, className }) {
+ return (
+
+
+ {title}
+
+ {children}
+
+ );
+}
diff --git a/examples/next/block-support/components/Main.js b/examples/next/block-support/components/Main.js
new file mode 100644
index 000000000..049c4eb0f
--- /dev/null
+++ b/examples/next/block-support/components/Main.js
@@ -0,0 +1,18 @@
+import classNames from 'classnames/bind';
+import * as SELECTORS from '../constants/selectors';
+import styles from '../styles/components/Main.module.scss';
+
+let cx = classNames.bind(styles);
+
+export function Main({ children, className, ...props }) {
+ return (
+
+ {children}
+
+ );
+}
diff --git a/examples/next/block-support/components/NavigationMenu.js b/examples/next/block-support/components/NavigationMenu.js
new file mode 100644
index 000000000..755c69dca
--- /dev/null
+++ b/examples/next/block-support/components/NavigationMenu.js
@@ -0,0 +1,67 @@
+import classNames from 'classnames/bind';
+import { gql } from '@apollo/client';
+import Link from 'next/link';
+import styles from '../styles/components/NavigationMenu.module.scss';
+import stylesFromWP from '../styles/components/NavigationMenuClassesFromWP.module.scss';
+
+import { flatListToHierarchical } from '@faustwp/core';
+
+let cx = classNames.bind(styles);
+let cxFromWp = classNames.bind(stylesFromWP);
+
+export function NavigationMenu({ menuItems, className }) {
+ if (!menuItems) {
+ return null;
+ }
+
+ // Based on https://www.wpgraphql.com/docs/menus/#hierarchical-data
+ const hierarchicalMenuItems = flatListToHierarchical(menuItems);
+
+ function renderMenu(items) {
+ return (
+
+ {items.map((item) => {
+ const { id, path, label, children, cssClasses } = item;
+
+ // @TODO - Remove guard clause after ghost menu items are no longer appended to array.
+ if (!item.hasOwnProperty('__typename')) {
+ return null;
+ }
+
+ return (
+ -
+ {label ?? ''}
+ {children.length ? renderMenu(children) : null}
+
+ );
+ })}
+
+ );
+ }
+
+ return (
+
+ );
+}
+
+NavigationMenu.fragments = {
+ entry: gql`
+ fragment NavigationMenuItemFragment on MenuItem {
+ id
+ path
+ label
+ parentId
+ cssClasses
+ menu {
+ node {
+ name
+ }
+ }
+ }
+ `,
+};
diff --git a/examples/next/block-support/components/Post.js b/examples/next/block-support/components/Post.js
new file mode 100644
index 000000000..7da5ab1bc
--- /dev/null
+++ b/examples/next/block-support/components/Post.js
@@ -0,0 +1,40 @@
+import Link from 'next/link';
+import { FeaturedImage } from './FeaturedImage';
+import { PostInfo } from './PostInfo';
+import styles from '../styles/components/Post.module.scss';
+
+export function Post({
+ title,
+ content,
+ date,
+ author,
+ uri,
+ featuredImage,
+}) {
+ return (
+
+ {featuredImage && (
+
+
+
+
+
+ )}
+
+
+
+ {title}
+
+
+
+
+
+ );
+}
diff --git a/examples/next/block-support/components/PostInfo.js b/examples/next/block-support/components/PostInfo.js
new file mode 100644
index 000000000..ec731d850
--- /dev/null
+++ b/examples/next/block-support/components/PostInfo.js
@@ -0,0 +1,19 @@
+import { FormatDate } from '.';
+
+export function PostInfo({ date, author, className }) {
+ if (!date && !author) {
+ return null;
+ }
+
+ return (
+
+ {date && (
+
+ )}
+ {date && author && <> >}
+ {author && by {author}}
+
+ );
+}
diff --git a/examples/next/block-support/components/SkipNavigationLink.js b/examples/next/block-support/components/SkipNavigationLink.js
new file mode 100644
index 000000000..cbb8add11
--- /dev/null
+++ b/examples/next/block-support/components/SkipNavigationLink.js
@@ -0,0 +1,16 @@
+import classNames from 'classnames/bind';
+import * as SELECTORS from '../constants/selectors';
+import styles from '../styles/components/SkipNavigationLink.module.scss';
+
+let cx = classNames.bind(styles);
+
+export function SkipNavigationLink() {
+ return (
+
+ Skip To Main Content
+
+ );
+}
diff --git a/examples/next/block-support/components/index.js b/examples/next/block-support/components/index.js
new file mode 100644
index 000000000..835b3a4d3
--- /dev/null
+++ b/examples/next/block-support/components/index.js
@@ -0,0 +1,15 @@
+export { Container } from './Container';
+export { ContentWrapper } from './ContentWrapper';
+export { EntryHeader } from './EntryHeader';
+export { FeaturedImage } from './FeaturedImage';
+export { Footer } from './Footer';
+export { FormatDate } from './FormatDate';
+export { Header } from './Header';
+export { Heading } from './Heading';
+export { Main } from './Main';
+export { NavigationMenu } from './NavigationMenu';
+export { PostInfo } from './PostInfo';
+export { SkipNavigationLink } from './SkipNavigationLink';
+export { Hero } from './Hero';
+export { Post } from './Post';
+export { Head } from './Head';
diff --git a/examples/next/block-support/constants/menus.js b/examples/next/block-support/constants/menus.js
new file mode 100644
index 000000000..c60ded9df
--- /dev/null
+++ b/examples/next/block-support/constants/menus.js
@@ -0,0 +1,2 @@
+ export const PRIMARY_LOCATION = 'PRIMARY';
+ export const FOOTER_LOCATION = 'FOOTER';
diff --git a/examples/next/block-support/constants/selectors.js b/examples/next/block-support/constants/selectors.js
new file mode 100644
index 000000000..0fef48aaa
--- /dev/null
+++ b/examples/next/block-support/constants/selectors.js
@@ -0,0 +1 @@
+export const MAIN_CONTENT_ID = 'main-content';
diff --git a/examples/next/block-support/faust.config.js b/examples/next/block-support/faust.config.js
new file mode 100644
index 000000000..c6478a6d6
--- /dev/null
+++ b/examples/next/block-support/faust.config.js
@@ -0,0 +1,12 @@
+import { setConfig } from '@faustwp/core';
+import templates from './wp-templates';
+import possibleTypes from './possibleTypes.json';
+
+/**
+ * @type {import('@faustwp/core').FaustConfig}
+ **/
+export default setConfig({
+ templates,
+ experimentalPlugins: [],
+ possibleTypes,
+});
diff --git a/examples/next/block-support/fragments/GeneralSettings.js b/examples/next/block-support/fragments/GeneralSettings.js
new file mode 100644
index 000000000..f478789d3
--- /dev/null
+++ b/examples/next/block-support/fragments/GeneralSettings.js
@@ -0,0 +1,8 @@
+import { gql } from '@apollo/client';
+
+export const BlogInfoFragment = gql`
+ fragment BlogInfoFragment on GeneralSettings {
+ title
+ description
+ }
+`;
diff --git a/examples/next/block-support/next.config.js b/examples/next/block-support/next.config.js
new file mode 100644
index 000000000..671f1eca0
--- /dev/null
+++ b/examples/next/block-support/next.config.js
@@ -0,0 +1,18 @@
+const { withFaust, getWpHostname } = require('@faustwp/core');
+
+/**
+ * @type {import('next').NextConfig}
+ **/
+module.exports = withFaust({
+ reactStrictMode: true,
+ sassOptions: {
+ includePaths: ['node_modules'],
+ },
+ images: {
+ domains: [getWpHostname()],
+ },
+ i18n: {
+ locales: ['en'],
+ defaultLocale: 'en',
+ },
+});
diff --git a/examples/next/block-support/package.json b/examples/next/block-support/package.json
new file mode 100644
index 000000000..fa70a9fc0
--- /dev/null
+++ b/examples/next/block-support/package.json
@@ -0,0 +1,30 @@
+{
+ "name": "@faustwp/block-support-example",
+ "private": true,
+ "version": "0.1.0",
+ "scripts": {
+ "predev": "faust generatePossibleTypes && faust generateGlobalStylesheet",
+ "prebuild": "faust generatePossibleTypes && faust generateGlobalStylesheet",
+ "dev": "faust dev",
+ "build": "faust build",
+ "start": "faust start"
+ },
+ "dependencies": {
+ "@apollo/client": "^3.6.6",
+ "@faustwp/blocks": "1.2.0",
+ "@faustwp/cli": "1.0.1",
+ "@faustwp/core": "1.0.3",
+ "@wordpress/base-styles": "^4.26.0",
+ "@wordpress/block-library": "^7.19.0",
+ "classnames": "^2.3.1",
+ "graphql": "^16.6.0",
+ "next": "^12.1.6",
+ "react": "^17.0.2",
+ "react-dom": "^17.0.2",
+ "sass": "^1.54.9"
+ },
+ "engines": {
+ "node": ">=16",
+ "npm": ">=8"
+ }
+}
diff --git a/examples/next/block-support/pages/[...wordpressNode].js b/examples/next/block-support/pages/[...wordpressNode].js
new file mode 100644
index 000000000..fe51bbcc9
--- /dev/null
+++ b/examples/next/block-support/pages/[...wordpressNode].js
@@ -0,0 +1,16 @@
+import { getWordPressProps, WordPressTemplate } from '@faustwp/core';
+
+export default function Page(props) {
+ return ;
+}
+
+export function getStaticProps(ctx) {
+ return getWordPressProps({ ctx });
+}
+
+export async function getStaticPaths() {
+ return {
+ paths: [],
+ fallback: 'blocking',
+ };
+}
diff --git a/examples/next/block-support/pages/_app.js b/examples/next/block-support/pages/_app.js
new file mode 100644
index 000000000..9fb2e166c
--- /dev/null
+++ b/examples/next/block-support/pages/_app.js
@@ -0,0 +1,25 @@
+import '../faust.config';
+import React from 'react';
+import { useRouter } from 'next/router';
+import { WordPressBlocksProvider, fromThemeJson } from '@faustwp/blocks';
+import { FaustProvider } from '@faustwp/core';
+import blocks from '../wp-blocks';
+import themeJson from '../theme.json';
+import '../globalStylesheet.css'; // <-- Generated by @faustwp/cli
+import '../styles/global.scss';
+
+export default function MyApp({ Component, pageProps }) {
+ const router = useRouter();
+
+ return (
+
+
+
+
+
+ );
+}
diff --git a/examples/next/block-support/pages/api/faust/[[...route]].js b/examples/next/block-support/pages/api/faust/[[...route]].js
new file mode 100644
index 000000000..e73fd7919
--- /dev/null
+++ b/examples/next/block-support/pages/api/faust/[[...route]].js
@@ -0,0 +1,4 @@
+import '../../../faust.config';
+import { apiRouter } from '@faustwp/core';
+
+export default apiRouter;
diff --git a/examples/next/block-support/pages/example.js b/examples/next/block-support/pages/example.js
new file mode 100644
index 000000000..aa524a8f0
--- /dev/null
+++ b/examples/next/block-support/pages/example.js
@@ -0,0 +1,79 @@
+import { gql, useQuery } from '@apollo/client';
+import * as MENUS from '../constants/menus';
+import { BlogInfoFragment } from '../fragments/GeneralSettings';
+import {
+ Header,
+ Hero,
+ Footer,
+ Main,
+ Container,
+ NavigationMenu,
+ Head,
+} from '../components';
+import { getNextStaticProps } from '@faustwp/core';
+
+export default function Page(props) {
+ const { data } = useQuery(Page.query, {
+ variables: Page.variables(),
+ });
+ const title = props.title;
+
+ const { title: siteTitle, description: siteDescription } = data?.generalSettings;
+ const primaryMenu = data?.headerMenuItems?.nodes ?? [];
+ const footerMenu = data?.footerMenuItems?.nodes ?? [];
+
+ return (
+ <>
+
+
+
+
+
+
+
This page is utilizing the Next.js File based routes.
+
pages/example.js
+
+
+
+
+ >
+ );
+}
+
+Page.query = gql`
+ ${BlogInfoFragment}
+ ${NavigationMenu.fragments.entry}
+ query GetPageData(
+ $headerLocation: MenuLocationEnum
+ $footerLocation: MenuLocationEnum
+ ) {
+ generalSettings {
+ ...BlogInfoFragment
+ }
+ headerMenuItems: menuItems(where: { location: $headerLocation }) {
+ nodes {
+ ...NavigationMenuItemFragment
+ }
+ }
+ footerMenuItems: menuItems(where: { location: $footerLocation }) {
+ nodes {
+ ...NavigationMenuItemFragment
+ }
+ }
+ }
+`;
+
+Page.variables = () => {
+ return {
+ headerLocation: MENUS.PRIMARY_LOCATION,
+ footerLocation: MENUS.FOOTER_LOCATION
+ };
+};
+
+export function getStaticProps(ctx) {
+ return getNextStaticProps(ctx, {Page, props: {title: 'File Page Example'}});
+}
diff --git a/examples/next/block-support/pages/index.js b/examples/next/block-support/pages/index.js
new file mode 100644
index 000000000..37681a6cd
--- /dev/null
+++ b/examples/next/block-support/pages/index.js
@@ -0,0 +1,9 @@
+import { getWordPressProps, WordPressTemplate } from '@faustwp/core';
+
+export default function Page(props) {
+ return ;
+}
+
+export function getStaticProps(ctx) {
+ return getWordPressProps({ ctx });
+}
diff --git a/examples/next/block-support/pages/preview.js b/examples/next/block-support/pages/preview.js
new file mode 100644
index 000000000..a4b886e8e
--- /dev/null
+++ b/examples/next/block-support/pages/preview.js
@@ -0,0 +1,5 @@
+import { WordPressTemplate } from '@faustwp/core';
+
+export default function Preview(props) {
+ return ;
+}
diff --git a/examples/next/block-support/styles/_blocks.scss b/examples/next/block-support/styles/_blocks.scss
new file mode 100644
index 000000000..ac5db0b90
--- /dev/null
+++ b/examples/next/block-support/styles/_blocks.scss
@@ -0,0 +1,14 @@
+// WordPress block styles.
+// Used in `components/ContentWrapper`
+
+@use 'sass:math';
+
+@import '@wordpress/base-styles/mixins';
+@import '@wordpress/base-styles/colors.native';
+@import '@wordpress/base-styles/z-index';
+@import '@wordpress/base-styles/default-custom-properties';
+@import '@wordpress/base-styles/colors';
+@import '@wordpress/base-styles/variables';
+@import '@wordpress/base-styles/breakpoints';
+@import '@wordpress/block-library/src/style';
+@import '@wordpress/block-library/src/theme';
diff --git a/examples/next/block-support/styles/_breakpoints.scss b/examples/next/block-support/styles/_breakpoints.scss
new file mode 100644
index 000000000..6ffd8fa21
--- /dev/null
+++ b/examples/next/block-support/styles/_breakpoints.scss
@@ -0,0 +1,5 @@
+// Media query breakpoints
+
+$breakpoint-extra-small: 640px;
+$breakpoint-small: 768px;
+$breakpoint-medium: 1024px;
diff --git a/examples/next/block-support/styles/_utilities.scss b/examples/next/block-support/styles/_utilities.scss
new file mode 100644
index 000000000..4937136a0
--- /dev/null
+++ b/examples/next/block-support/styles/_utilities.scss
@@ -0,0 +1,25 @@
+// Utility classes
+
+.text-center {
+ text-align: center;
+}
+
+.sr-only {
+ position: absolute;
+ width: 1px;
+ height: 1px;
+ padding: 0;
+ margin: -1px;
+ overflow: hidden;
+ clip: rect(0, 0, 0, 0);
+ white-space: nowrap;
+ border-width: 0;
+
+ &:focus {
+ width: auto;
+ height: auto;
+ margin: 0;
+ overflow: auto;
+ clip: auto;
+ }
+}
diff --git a/examples/next/block-support/styles/components/Container.module.scss b/examples/next/block-support/styles/components/Container.module.scss
new file mode 100644
index 000000000..5303f46e9
--- /dev/null
+++ b/examples/next/block-support/styles/components/Container.module.scss
@@ -0,0 +1,7 @@
+.component {
+ padding-right: var(--wp--style--root--padding-right);
+ padding-left: var(--wp--style--root--padding-left);
+ margin-right: auto;
+ margin-left: auto;
+ max-width: var(--wp--style--global--wide-size);
+}
diff --git a/examples/next/block-support/styles/components/ContentWrapper.module.scss b/examples/next/block-support/styles/components/ContentWrapper.module.scss
new file mode 100644
index 000000000..6b6e949b9
--- /dev/null
+++ b/examples/next/block-support/styles/components/ContentWrapper.module.scss
@@ -0,0 +1,134 @@
+.component {
+ max-width: var(--wp--style--global--content-size);
+ margin: 0 auto;
+ line-height: 1.6875;
+
+ :global {
+ // Scope WordPress block styles within ContentWrapper.
+ @import 'styles/blocks';
+
+ * {
+ max-width: 100%;
+ }
+
+ figure {
+ margin-left: 0;
+ margin-right: 0;
+ }
+
+ h1,
+ h2,
+ h3,
+ h4,
+ h5,
+ h6 {
+ margin: 4.8rem 0;
+ }
+
+ strong {
+ font-weight: 700;
+ }
+
+ a {
+ color: var(--wp--preset--color--primary);
+ text-decoration: underline;
+
+ &:hover,
+ &:focus {
+ color: var(--wp--preset--color--primary);
+ text-decoration: none;
+ }
+ }
+
+ li {
+ font-size: 1.6rem;
+ }
+
+ img {
+ display: block;
+ height: auto;
+ max-width: 100%;
+ }
+
+ .alignleft {
+ display: inline;
+ float: left;
+ margin-right: 1.5em;
+ }
+
+ .alignright {
+ display: inline;
+ float: right;
+ margin-left: 1.5em;
+ }
+
+ .aligncenter {
+ clear: both;
+ display: block;
+ margin-left: auto;
+ margin-right: auto;
+ }
+
+ code,
+ pre {
+ color: var(--color-white);
+ background: var(--color-black);
+ }
+
+ code {
+ padding: 0.25rem 0.5rem;
+ }
+
+ pre {
+ max-width: 100%;
+ overflow: auto;
+ padding: 1rem;
+ }
+
+ blockquote {
+ border-top: 1px solid var(--color-black);
+ border-bottom: 1px solid var(--color-black);
+ font-style: italic;
+ margin-top: 0;
+ margin-left: 0;
+ margin-right: 0;
+ padding: 4rem 1rem 4rem;
+ text-align: center;
+
+ &::before {
+ content: '”';
+ display: block;
+ font-size: 6rem;
+ line-height: 0;
+ margin: 2rem 0;
+ }
+
+ > *:last-child {
+ margin-bottom: 0;
+ }
+ }
+
+ table {
+ border-collapse: collapse;
+ width: 100%;
+ }
+
+ thead th {
+ border-bottom: 1px solid var(--wpe--color--border);
+ padding-bottom: 0.5em;
+ }
+
+ th {
+ padding: 0.4rem 0;
+ text-align: left;
+ }
+
+ tr {
+ border-bottom: 1px solid var(--wpe--color--border);
+ }
+
+ td {
+ padding: 0.4em;
+ }
+ }
+}
diff --git a/examples/next/block-support/styles/components/EntryHeader.module.scss b/examples/next/block-support/styles/components/EntryHeader.module.scss
new file mode 100644
index 000000000..fa8e22401
--- /dev/null
+++ b/examples/next/block-support/styles/components/EntryHeader.module.scss
@@ -0,0 +1,65 @@
+@import 'styles/breakpoints';
+
+.component {
+ color: var(--wp--preset--color--base);
+ position: relative;
+ overflow: hidden;
+ margin-bottom: 2rem;
+
+ @media (min-width: $breakpoint-small) {
+ margin-bottom: 5rem;
+ }
+}
+
+.has-image .title {
+ color: var(--wp--preset--color--base);
+}
+
+.text,
+.image {
+ margin: auto;
+ text-align: center;
+}
+
+.text {
+ width: 100%;
+ max-width: 72rem;
+ padding: 8.25rem 0;
+ position: relative;
+ z-index: 1; // Pull text to the foreground to sit above .
+}
+
+.title {
+ line-height: 1.25;
+ font-size: 5rem;
+ color: var(--wp--preset--color--contrast);
+
+ @media (max-width: $breakpoint-small) {
+ font-size: 3rem;
+ }
+}
+
+.byline {
+ font-size: 1.2rem;
+ color: var(--wp--preset--color--contrast);
+}
+
+.image {
+ margin: 0;
+ position: absolute;
+ top: 0;
+ left: 0;
+ width: 100vw;
+ height: 100vh;
+ z-index: 0;
+
+ &::after {
+ content: '';
+ top: 0;
+ left: 0;
+ height: 100%;
+ width: 100%;
+ background-color: rgba(0, 0, 0, 0.6);
+ position: absolute;
+ }
+}
diff --git a/examples/next/block-support/styles/components/Footer.module.scss b/examples/next/block-support/styles/components/Footer.module.scss
new file mode 100644
index 000000000..d99eeaffa
--- /dev/null
+++ b/examples/next/block-support/styles/components/Footer.module.scss
@@ -0,0 +1,11 @@
+.component {
+ color: var(--wp--preset--color--contrast);
+ background: var(--wp--preset--color--base);
+ padding-top: var(--wp--style--root--padding-top);
+ padding-bottom: var(--wp--style--root--padding-bottom);
+}
+
+.copyright {
+ margin: 2rem 0;
+ text-align: center;
+}
diff --git a/examples/next/block-support/styles/components/Header.module.scss b/examples/next/block-support/styles/components/Header.module.scss
new file mode 100644
index 000000000..6073f4ce1
--- /dev/null
+++ b/examples/next/block-support/styles/components/Header.module.scss
@@ -0,0 +1,72 @@
+@import 'styles/breakpoints';
+
+.component {
+ color: var(--wp--preset--color--contrast);
+ background-color: var(--wp--preset--color--base);
+ position: relative;
+ z-index: 2; // Pull dropdown menus to the foreground to sit above .
+}
+
+.navbar {
+ display: flex;
+ justify-content: space-between;
+ flex-wrap: wrap;
+ padding: 3rem 0;
+ gap: 1rem;
+}
+
+.brand {
+ font-weight: var(--wpe--font-weight--bold);
+ font-size: 1.6rem;
+ display: flex;
+ flex-direction: column;
+ justify-content: center;
+}
+
+.title {
+ text-decoration: none;
+}
+
+.description {
+ margin: .3rem 0 0 0;
+ font-size: 0.8rem;
+ opacity: 0.9;
+}
+
+.nav-toggle {
+ align-items: center;
+ background-color: transparent;
+ border: 0.1rem solid var(--wp--preset--color--base);
+ color: var(--wp--preset--color--contrast);
+ cursor: pointer;
+ display: flex;
+ margin: 0;
+ padding: 0.5rem 1rem;
+ transition: all 0.2s ease-in;
+ user-select: none;
+ font-size: 2rem;
+
+ &:hover,
+ &:focus {
+ background-color: var(--wp--preset--color--base);
+ color: var(--wp--preset--color--contrast);
+ }
+
+ @media (min-width: $breakpoint-small) {
+ display: none !important;
+ }
+}
+
+.primary-navigation {
+ display: none;
+ width: 100%;
+
+ &.show {
+ display: block;
+ }
+
+ @media (min-width: $breakpoint-small) {
+ display: block;
+ width: auto;
+ }
+}
diff --git a/examples/next/block-support/styles/components/Hero.module.scss b/examples/next/block-support/styles/components/Hero.module.scss
new file mode 100644
index 000000000..e314018b7
--- /dev/null
+++ b/examples/next/block-support/styles/components/Hero.module.scss
@@ -0,0 +1,26 @@
+@import "styles/breakpoints";
+
+.component {
+ text-align: center;
+ padding: 6rem 1rem;
+ line-height: 1.3;
+ margin: 0 auto;
+ max-width: var(--wp--style--global--wide-size);
+ position: relative;
+}
+
+.title {
+ display: block;
+ font-size: 5rem;
+ z-index: 1;
+ position: relative;
+
+ @media (max-width: $breakpoint-small) {
+ font-size: 3rem;
+ }
+}
+
+.subtitle {
+ display: block;
+ font-size: 3rem;
+}
diff --git a/examples/next/block-support/styles/components/Main.module.scss b/examples/next/block-support/styles/components/Main.module.scss
new file mode 100644
index 000000000..3e9fd3cd9
--- /dev/null
+++ b/examples/next/block-support/styles/components/Main.module.scss
@@ -0,0 +1,4 @@
+.component {
+ color: var(--wp--preset--color--contrast);
+ background-color: var(--wp--preset--color--base);
+}
diff --git a/examples/next/block-support/styles/components/NavigationMenu.module.scss b/examples/next/block-support/styles/components/NavigationMenu.module.scss
new file mode 100644
index 000000000..ae21c3803
--- /dev/null
+++ b/examples/next/block-support/styles/components/NavigationMenu.module.scss
@@ -0,0 +1,101 @@
+@import 'styles/breakpoints';
+
+%visible {
+ visibility: visible;
+ opacity: 1;
+}
+
+%hidden {
+ // Always visible for smaller viewports.
+ @media (min-width: $breakpoint-small) {
+ visibility: hidden;
+ opacity: 0;
+ }
+}
+
+.component {
+ background-color: transparent;
+}
+
+.menu {
+ list-style-type: none;
+ display: flex;
+ flex-wrap: wrap;
+ justify-content: center;
+ padding: 0;
+ margin: 0;
+ position: relative;
+ gap: 0.5rem;
+
+ li {
+ display: flex;
+ align-items: center;
+ position: relative;
+ width: 100%;
+ flex-direction: column;
+
+ @media (min-width: $breakpoint-small) {
+ width: auto;
+ flex-direction: row;
+ }
+
+ &:focus-within ul,
+ a:hover + ul,
+ a:focus + ul {
+ @extend %visible;
+ }
+ }
+
+ a {
+ color: var(--wp--preset--color--contrast);
+ padding: 0.5rem;
+ display: block;
+ transition: all 0.2s ease-out;
+ width: 100%;
+ white-space: nowrap;
+ text-align: center;
+
+ &:hover,
+ &:focus {
+ color: var(--wp--preset--color--primary);
+ }
+
+ // Remove link underline when component is inside header.
+ header & {
+ text-decoration: none;
+ }
+ }
+
+ li ul {
+ @extend %hidden;
+ background-color: var(--wp--preset--color--base);
+ display: flex;
+ flex-direction: column;
+ gap: 0;
+ width: 100%;
+
+ @media (min-width: $breakpoint-small) {
+ position: absolute;
+ left: -10px;
+ top: 100%;
+ text-align: left;
+ box-shadow: var(--wp--preset--shadow--natural);
+ padding: 1rem;
+ border-radius: 8px;
+ transition: all 0.2s ease-out;
+ width: inherit;
+ border: var(--wp--preset--color--tertiary);
+ }
+
+ &:hover {
+ @extend %visible;
+ }
+
+ li + li {
+ @media (min-width: $breakpoint-small) {
+ border-top: var(--wp--preset--color--tertiary);
+ margin-top: 3px; // Make room for default browser focus styles.
+ }
+ }
+ }
+}
diff --git a/examples/next/block-support/styles/components/NavigationMenuClassesFromWP.module.scss b/examples/next/block-support/styles/components/NavigationMenuClassesFromWP.module.scss
new file mode 100644
index 000000000..e24d400ad
--- /dev/null
+++ b/examples/next/block-support/styles/components/NavigationMenuClassesFromWP.module.scss
@@ -0,0 +1,25 @@
+// Classes in this file can be optionally added to menu items from within WordPress.
+// Appearance --> Menus --> Screen Options --> CSS Classes
+
+@import 'styles/breakpoints';
+
+.button {
+ a {
+ @media (min-width: $breakpoint-small) {
+ background-color: var(--wp--preset--color--primary);
+ border-radius: 100px;
+ border: var(--wp--preset--color--tertiary);
+ color: var(--wp--preset--color--base);
+ font-size: 92%;
+ padding: 0.5rem 1rem;
+ text-decoration: none;
+ white-space: nowrap;
+
+ &:hover,
+ &:focus {
+ background-color: var(--wp--preset--color--secondary);
+ color: var(--wp--preset--color--base);
+ }
+ }
+ }
+}
diff --git a/examples/next/block-support/styles/components/Post.module.scss b/examples/next/block-support/styles/components/Post.module.scss
new file mode 100644
index 000000000..c3ef4f13f
--- /dev/null
+++ b/examples/next/block-support/styles/components/Post.module.scss
@@ -0,0 +1,16 @@
+.component {
+ padding-bottom: 4rem;
+}
+
+.title {
+ margin-bottom: 0.5rem;
+}
+
+.postInfo {
+ margin-bottom: 1.5rem;
+}
+
+.featuredImage {
+ margin: 0;
+ margin-bottom: 1rem;
+}
diff --git a/examples/next/block-support/styles/components/PostInfo.module.scss b/examples/next/block-support/styles/components/PostInfo.module.scss
new file mode 100644
index 000000000..f0a5bf15b
--- /dev/null
+++ b/examples/next/block-support/styles/components/PostInfo.module.scss
@@ -0,0 +1,3 @@
+.component {
+ color: red;
+}
diff --git a/examples/next/block-support/styles/components/SkipNavigationLink.module.scss b/examples/next/block-support/styles/components/SkipNavigationLink.module.scss
new file mode 100644
index 000000000..c19a0f6ef
--- /dev/null
+++ b/examples/next/block-support/styles/components/SkipNavigationLink.module.scss
@@ -0,0 +1,9 @@
+// Skip link specific styles. Intentionally separate from this theme's sr-only class.
+.component {
+ color: var(--wp--preset--color--base);
+ background-color: var(--wp--preset--color--contrast);
+ padding: 0.5rem 0.8rem !important;
+ position: relative;
+ margin: 0.5rem !important;
+ z-index: 1;
+}
diff --git a/examples/next/block-support/styles/global.scss b/examples/next/block-support/styles/global.scss
new file mode 100644
index 000000000..e4186cfab
--- /dev/null
+++ b/examples/next/block-support/styles/global.scss
@@ -0,0 +1,7 @@
+// Global styles
+// These styles are available on all pages.
+// If a component has it's own styles, they can be found in ./components.
+
+@import 'breakpoints';
+@import 'blocks';
+@import 'utilities';
diff --git a/examples/next/block-support/theme.json b/examples/next/block-support/theme.json
new file mode 100644
index 000000000..68e17a87e
--- /dev/null
+++ b/examples/next/block-support/theme.json
@@ -0,0 +1,741 @@
+{
+ "$schema": "https://schemas.wp.org/trunk/theme.json",
+ "version": 2,
+ "customTemplates": [
+ {
+ "name": "blank",
+ "postTypes": [
+ "page",
+ "post"
+ ],
+ "title": "Blank"
+ },
+ {
+ "name": "blog-alternative",
+ "postTypes": [
+ "page"
+ ],
+ "title": "Blog (Alternative)"
+ },
+ {
+ "name": "404",
+ "postTypes": [
+ "page"
+ ],
+ "title": "404"
+ }
+ ],
+ "settings": {
+ "appearanceTools": true,
+ "color": {
+ "palette": [
+ {
+ "color": "#ffffff",
+ "name": "Base",
+ "slug": "base"
+ },
+ {
+ "color": "#000000",
+ "name": "Contrast",
+ "slug": "contrast"
+ },
+ {
+ "color": "#9DFF20",
+ "name": "Primary",
+ "slug": "primary"
+ },
+ {
+ "color": "#345C00",
+ "name": "Secondary",
+ "slug": "secondary"
+ },
+ {
+ "color": "#F6F6F6",
+ "name": "Tertiary",
+ "slug": "tertiary"
+ }
+ ]
+ },
+ "layout": {
+ "contentSize": "650px",
+ "wideSize": "1200px"
+ },
+ "spacing": {
+ "spacingScale": {
+ "steps": 0
+ },
+ "spacingSizes": [
+ {
+ "size": "clamp(1.5rem, 5vw, 2rem)",
+ "slug": "30",
+ "name": "1"
+ },
+ {
+ "size": "clamp(1.8rem, 1.8rem + ((1vw - 0.48rem) * 2.885), 3rem)",
+ "slug": "40",
+ "name": "2"
+ },
+ {
+ "size": "clamp(2.5rem, 8vw, 4.5rem)",
+ "slug": "50",
+ "name": "3"
+ },
+ {
+ "size": "clamp(3.75rem, 10vw, 7rem)",
+ "slug": "60",
+ "name": "4"
+ },
+ {
+ "size": "clamp(5rem, 5.25rem + ((1vw - 0.48rem) * 9.096), 8rem)",
+ "slug": "70",
+ "name": "5"
+ },
+ {
+ "size": "clamp(7rem, 14vw, 11rem)",
+ "slug": "80",
+ "name": "6"
+ }
+ ],
+ "units": [
+ "%",
+ "px",
+ "em",
+ "rem",
+ "vh",
+ "vw"
+ ]
+ },
+ "typography": {
+ "dropCap": false,
+ "fluid": true,
+ "fontFamilies": [
+ {
+ "fontFace": [
+ {
+ "fontFamily": "DM Sans",
+ "fontStretch": "normal",
+ "fontStyle": "normal",
+ "fontWeight": "400",
+ "src": [
+ "file:./assets/fonts/dm-sans/DMSans-Regular.woff2"
+ ]
+ },
+ {
+ "fontFamily": "DM Sans",
+ "fontStretch": "normal",
+ "fontStyle": "italic",
+ "fontWeight": "400",
+ "src": [
+ "file:./assets/fonts/dm-sans/DMSans-Regular-Italic.woff2"
+ ]
+ },
+ {
+ "fontFamily": "DM Sans",
+ "fontStretch": "normal",
+ "fontStyle": "normal",
+ "fontWeight": "700",
+ "src": [
+ "file:./assets/fonts/dm-sans/DMSans-Bold.woff2"
+ ]
+ },
+ {
+ "fontFamily": "DM Sans",
+ "fontStretch": "normal",
+ "fontStyle": "italic",
+ "fontWeight": "700",
+ "src": [
+ "file:./assets/fonts/dm-sans/DMSans-Bold-Italic.woff2"
+ ]
+ }
+ ],
+ "fontFamily": "\"DM Sans\", sans-serif",
+ "name": "DM Sans",
+ "slug": "dm-sans"
+ },
+ {
+ "fontFace": [
+ {
+ "fontDisplay": "block",
+ "fontFamily": "IBM Plex Mono",
+ "fontStretch": "normal",
+ "fontStyle": "normal",
+ "fontWeight": "300",
+ "src": [
+ "file:./assets/fonts/ibm-plex-mono/IBMPlexMono-Light.woff2"
+ ]
+ },
+ {
+ "fontDisplay": "block",
+ "fontFamily": "IBM Plex Mono",
+ "fontStretch": "normal",
+ "fontStyle": "normal",
+ "fontWeight": "400",
+ "src": [
+ "file:./assets/fonts/ibm-plex-mono/IBMPlexMono-Regular.woff2"
+ ]
+ },
+ {
+ "fontDisplay": "block",
+ "fontFamily": "IBM Plex Mono",
+ "fontStretch": "normal",
+ "fontStyle": "italic",
+ "fontWeight": "400",
+ "src": [
+ "file:./assets/fonts/ibm-plex-mono/IBMPlexMono-Italic.woff2"
+ ]
+ },
+ {
+ "fontDisplay": "block",
+ "fontFamily": "IBM Plex Mono",
+ "fontStretch": "normal",
+ "fontStyle": "normal",
+ "fontWeight": "700",
+ "src": [
+ "file:./assets/fonts/ibm-plex-mono/IBMPlexMono-Bold.woff2"
+ ]
+ }
+ ],
+ "fontFamily": "'IBM Plex Mono', monospace",
+ "name": "IBM Plex Mono",
+ "slug": "ibm-plex-mono"
+ },
+ {
+ "fontFace": [
+ {
+ "fontFamily": "Inter",
+ "fontStretch": "normal",
+ "fontStyle": "normal",
+ "fontWeight": "200 900",
+ "src": [
+ "file:./assets/fonts/inter/Inter-VariableFont_slnt,wght.ttf"
+ ]
+ }
+ ],
+ "fontFamily": "\"Inter\", sans-serif",
+ "name": "Inter",
+ "slug": "inter"
+ },
+ {
+ "fontFamily": "-apple-system,BlinkMacSystemFont,\"Segoe UI\",Roboto,Oxygen-Sans,Ubuntu,Cantarell,\"Helvetica Neue\",sans-serif",
+ "name": "System Font",
+ "slug": "system-font"
+ },
+ {
+ "fontFace": [
+ {
+ "fontFamily": "Source Serif Pro",
+ "fontStretch": "normal",
+ "fontStyle": "normal",
+ "fontWeight": "200 900",
+ "src": [
+ "file:./assets/fonts/source-serif-pro/SourceSerif4Variable-Roman.ttf.woff2"
+ ]
+ },
+ {
+ "fontFamily": "Source Serif Pro",
+ "fontStretch": "normal",
+ "fontStyle": "italic",
+ "fontWeight": "200 900",
+ "src": [
+ "file:./assets/fonts/source-serif-pro/SourceSerif4Variable-Italic.ttf.woff2"
+ ]
+ }
+ ],
+ "fontFamily": "\"Source Serif Pro\", serif",
+ "name": "Source Serif Pro",
+ "slug": "source-serif-pro"
+ }
+ ],
+ "fontSizes": [
+ {
+ "fluid": {
+ "min": "0.875rem",
+ "max": "1rem"
+ },
+ "size": "1rem",
+ "slug": "small"
+ },
+ {
+ "fluid": {
+ "min": "1rem",
+ "max": "1.125rem"
+ },
+ "size": "1.125rem",
+ "slug": "medium"
+ },
+ {
+ "fluid": {
+ "min": "1.75rem",
+ "max": "1.875rem"
+ },
+ "size": "1.75rem",
+ "slug": "large"
+ },
+ {
+ "fluid": false,
+ "size": "2.25rem",
+ "slug": "x-large"
+ },
+ {
+ "fluid": {
+ "min": "4rem",
+ "max": "10rem"
+ },
+ "size": "10rem",
+ "slug": "xx-large"
+ }
+ ]
+ },
+ "useRootPaddingAwareAlignments": true
+ },
+ "styles": {
+ "blocks": {
+ "core/navigation": {
+ "elements": {
+ "link": {
+ ":hover": {
+ "typography": {
+ "textDecoration": "underline"
+ }
+ },
+ ":focus": {
+ "typography": {
+ "textDecoration": "underline dashed"
+ }
+ },
+ ":active": {
+ "typography": {
+ "textDecoration": "none"
+ }
+ },
+ "typography": {
+ "textDecoration": "none"
+ }
+ }
+ },
+ "typography": {
+ "fontSize": "var(--wp--preset--font-size--small)"
+ }
+ },
+ "core/post-author": {
+ "typography": {
+ "fontSize": "var(--wp--preset--font-size--small)"
+ }
+ },
+ "core/post-content": {
+ "elements": {
+ "link": {
+ "color": {
+ "text": "var(--wp--preset--color--secondary)"
+ }
+ }
+ }
+ },
+ "core/post-excerpt": {
+ "typography": {
+ "fontSize": "var(--wp--preset--font-size--medium)"
+ }
+ },
+ "core/post-date": {
+ "typography": {
+ "fontSize": "var(--wp--preset--font-size--small)",
+ "fontWeight": "400"
+ },
+ "elements": {
+ "link": {
+ "typography": {
+ "textDecoration": "none"
+ },
+ ":hover": {
+ "typography": {
+ "textDecoration": "underline"
+ }
+ }
+ }
+ }
+ },
+ "core/post-terms": {
+ "typography": {
+ "fontSize": "var(--wp--preset--font-size--small)"
+ }
+ },
+ "core/post-title": {
+ "spacing": {
+ "margin": {
+ "bottom": "1.25rem",
+ "top": "1.25rem"
+ }
+ },
+ "typography": {
+ "fontWeight": "400"
+ },
+ "elements": {
+ "link": {
+ ":hover": {
+ "typography": {
+ "textDecoration": "underline"
+ }
+ },
+ ":focus": {
+ "typography": {
+ "textDecoration": "underline dashed"
+ }
+ },
+ ":active": {
+ "color": {
+ "text": "var(--wp--preset--color--secondary)"
+ },
+ "typography": {
+ "textDecoration": "none"
+ }
+ },
+ "typography": {
+ "textDecoration": "none"
+ }
+ }
+ }
+ },
+ "core/comments-title":{
+ "typography": {
+ "fontSize": "var(--wp--preset--font-size--large)"
+ },
+ "spacing": {
+ "margin": {
+ "bottom": "var(--wp--preset--spacing--40)"
+ }
+ }
+ },
+ "core/comment-author-name": {
+ "elements": {
+ "link": {
+ ":hover": {
+ "typography": {
+ "textDecoration": "underline"
+ }
+ },
+ ":focus": {
+ "typography": {
+ "textDecoration": "underline dashed"
+ }
+ },
+ ":active": {
+ "color": {
+ "text": "var(--wp--preset--color--secondary)"
+ },
+ "typography": {
+ "textDecoration": "none"
+ }
+ },
+ "typography": {
+ "textDecoration": "none"
+ }
+ }
+ }
+ },
+ "core/comment-date": {
+ "typography": {
+ "fontSize": "var(--wp--preset--font-size--small)"
+ },
+ "elements": {
+ "link": {
+ ":hover": {
+ "typography": {
+ "textDecoration": "underline"
+ }
+ },
+ ":focus": {
+ "typography": {
+ "textDecoration": "underline dashed"
+ }
+ },
+ ":active": {
+ "color": {
+ "text": "var(--wp--preset--color--secondary)"
+ },
+ "typography": {
+ "textDecoration": "none"
+ }
+ },
+ "typography": {
+ "textDecoration": "none"
+ }
+ }
+ }
+ },
+ "core/comment-edit-link": {
+ "typography": {
+ "fontSize": "var(--wp--preset--font-size--small)"
+ }
+ },
+ "core/comment-reply-link": {
+ "typography": {
+ "fontSize": "var(--wp--preset--font-size--small)"
+ }
+ },
+ "core/comments-pagination": {
+ "spacing": {
+ "margin": {
+ "top": "var(--wp--preset--spacing--40)"
+ }
+ },
+ "elements": {
+ "link": {
+ "typography": {
+ "textDecoration": "none"
+ }
+ }
+ }
+ },
+ "core/pullquote": {
+ "border": {
+ "style": "solid",
+ "width": "1px 0"
+ },
+ "elements": {
+ "cite": {
+ "typography": {
+ "fontSize": "var(--wp--preset--font-size--small)",
+ "fontStyle": "normal",
+ "textTransform": "none"
+ }
+ }
+ },
+ "typography": {
+ "lineHeight": "1.3"
+ },
+ "spacing": {
+ "margin": {
+ "bottom": "var(--wp--preset--spacing--40) !important",
+ "top": "var(--wp--preset--spacing--40) !important"
+ }
+ }
+ },
+ "core/query": {
+ "elements": {
+ "h2": {
+ "typography": {
+ "fontSize": "var(--wp--preset--font-size--x-large)"
+ }
+ }
+ }
+ },
+ "core/query-pagination": {
+ "typography": {
+ "fontSize": "var(--wp--preset--font-size--small)",
+ "fontWeight": "400"
+ },
+ "elements": {
+ "link": {
+ "typography": {
+ "textDecoration": "none"
+ },
+ ":hover": {
+ "typography": {
+ "textDecoration": "underline"
+ }
+ }
+ }
+ }
+ },
+ "core/quote": {
+ "border": {
+ "left": {
+ "color": "inherit",
+ "style": "solid",
+ "width": "1px"
+ }
+ },
+ "elements": {
+ "cite": {
+ "typography": {
+ "fontSize": "var(--wp--preset--font-size--small)",
+ "fontStyle": "normal"
+ }
+ }
+ },
+ "spacing": {
+ "padding": {
+ "left": "var(--wp--preset--spacing--30)",
+ "right": "var(--wp--preset--spacing--30)"
+ }
+ }
+ },
+ "core/site-title": {
+ "elements": {
+ "link": {
+ ":hover": {
+ "typography": {
+ "textDecoration": "underline"
+ }
+ },
+ ":focus": {
+ "typography": {
+ "textDecoration": "underline dashed"
+ }
+ },
+ ":active": {
+ "color": {
+ "text": "var(--wp--preset--color--secondary)"
+ },
+ "typography": {
+ "textDecoration": "none"
+ }
+ },
+ "typography": {
+ "textDecoration": "none"
+ }
+ }
+ },
+ "typography": {
+ "fontSize": "var(--wp--preset--font-size--medium)",
+ "fontWeight": "normal",
+ "lineHeight": "1.4"
+ }
+ },
+ "core/separator": {
+ "css": " &:not(.is-style-wide):not(.is-style-dots):not(.alignwide):not(.alignfull){width: 100px}"
+ }
+ },
+ "color": {
+ "background": "var(--wp--preset--color--base)",
+ "text": "var(--wp--preset--color--contrast)"
+ },
+ "elements": {
+ "button": {
+ "border": {
+ "radius": "0"
+ },
+ "color": {
+ "background": "var(--wp--preset--color--primary)",
+ "text": "var(--wp--preset--color--contrast)"
+ },
+ ":hover": {
+ "color": {
+ "background": "var(--wp--preset--color--contrast)",
+ "text": "var(--wp--preset--color--base)"
+ }
+ },
+ ":focus": {
+ "color": {
+ "background": "var(--wp--preset--color--contrast)",
+ "text": "var(--wp--preset--color--base)"
+ }
+ },
+ ":active": {
+ "color": {
+ "background": "var(--wp--preset--color--secondary)",
+ "text": "var(--wp--preset--color--base)"
+ }
+ },
+ ":visited": {
+ "color": {
+ "text": "var(--wp--preset--color--contrast)"
+ }
+ }
+ },
+ "h1": {
+ "typography": {
+ "fontSize": "3.625rem",
+ "lineHeight": "1.2"
+ }
+ },
+ "h2": {
+ "typography": {
+ "fontSize": "clamp(2.625rem, calc(2.625rem + ((1vw - 0.48rem) * 8.4135)), 3.25rem)",
+ "lineHeight": "1.2"
+ }
+ },
+ "h3": {
+ "typography": {
+ "fontSize": "var(--wp--preset--font-size--x-large)"
+ }
+ },
+ "h4": {
+ "typography": {
+ "fontSize": "var(--wp--preset--font-size--large)"
+ }
+ },
+ "h5": {
+ "typography": {
+ "fontSize": "var(--wp--preset--font-size--medium)",
+ "fontWeight": "700",
+ "textTransform": "uppercase"
+ }
+ },
+ "h6": {
+ "typography": {
+ "fontSize": "var(--wp--preset--font-size--medium)",
+ "textTransform": "uppercase"
+ }
+ },
+ "heading": {
+ "typography": {
+ "fontWeight": "400",
+ "lineHeight": "1.4"
+ }
+ },
+ "link": {
+ "color": {
+ "text": "var(--wp--preset--color--contrast)"
+ },
+ ":hover": {
+ "typography": {
+ "textDecoration": "none"
+ }
+ },
+ ":focus": {
+ "typography": {
+ "textDecoration": "underline dashed"
+ }
+ },
+ ":active": {
+ "color": {
+ "text": "var(--wp--preset--color--secondary)"
+ },
+ "typography": {
+ "textDecoration": "none"
+ }
+ },
+ "typography": {
+ "textDecoration": "underline"
+ }
+ }
+ },
+ "spacing": {
+ "blockGap": "1.5rem",
+ "padding": {
+ "top": "var(--wp--preset--spacing--40)",
+ "right": "var(--wp--preset--spacing--30)",
+ "bottom": "var(--wp--preset--spacing--40)",
+ "left": "var(--wp--preset--spacing--30)"
+ }
+ },
+ "typography": {
+ "fontFamily": "var(--wp--preset--font-family--system-font)",
+ "fontSize": "var(--wp--preset--font-size--medium)",
+ "lineHeight": "1.6"
+ }
+ },
+ "templateParts": [
+ {
+ "area": "header",
+ "name": "header",
+ "title": "Header"
+ },
+ {
+ "area": "footer",
+ "name": "footer",
+ "title": "Footer"
+ },
+ {
+ "area": "uncategorized",
+ "name": "comments",
+ "title": "Comments"
+ },
+ {
+ "area": "uncategorized",
+ "name": "post-meta",
+ "title": "Post Meta"
+ }
+ ]
+}
diff --git a/examples/next/block-support/wp-blocks/index.js b/examples/next/block-support/wp-blocks/index.js
new file mode 100644
index 000000000..729ab1795
--- /dev/null
+++ b/examples/next/block-support/wp-blocks/index.js
@@ -0,0 +1,15 @@
+import { CoreBlocks } from '@faustwp/blocks';
+
+export default {
+ CoreParagraph: CoreBlocks.CoreParagraph,
+ CoreColumns: CoreBlocks.CoreColumns,
+ CoreColumn: CoreBlocks.CoreColumn,
+ CoreCode: CoreBlocks.CoreCode,
+ CoreQuote: CoreBlocks.CoreQuote,
+ CoreImage: CoreBlocks.CoreImage,
+ CoreSeparator: CoreBlocks.CoreSeparator,
+ CoreList: CoreBlocks.CoreList,
+ CoreButton: CoreBlocks.CoreButton,
+ CoreButtons: CoreBlocks.CoreButtons,
+ CoreHeading: CoreBlocks.CoreHeading,
+};
\ No newline at end of file
diff --git a/examples/next/block-support/wp-templates/category.js b/examples/next/block-support/wp-templates/category.js
new file mode 100644
index 000000000..ccab765d2
--- /dev/null
+++ b/examples/next/block-support/wp-templates/category.js
@@ -0,0 +1,106 @@
+import { gql } from '@apollo/client';
+import * as MENUS from '../constants/menus';
+import { BlogInfoFragment } from '../fragments/GeneralSettings';
+import {
+ Header,
+ Footer,
+ Main,
+ Container,
+ EntryHeader,
+ NavigationMenu,
+ Post,
+ FeaturedImage,
+ Head,
+} from '../components';
+
+export default function Component(props) {
+ const { title: siteTitle, description: siteDescription } =
+ props?.data?.generalSettings;
+ const primaryMenu = props?.data?.headerMenuItems?.nodes ?? [];
+ const footerMenu = props?.data?.footerMenuItems?.nodes ?? [];
+ const { name, posts } = props.data.nodeByUri;
+
+ return (
+ <>
+
+
+
+ <>
+
+
+ {posts.edges.map((post) => (
+
+ ))}
+
+ >
+
+
+ >
+ );
+}
+
+Component.query = gql`
+ ${BlogInfoFragment}
+ ${NavigationMenu.fragments.entry}
+ ${FeaturedImage.fragments.entry}
+ query GetCategoryPage(
+ $uri: String!
+ $headerLocation: MenuLocationEnum
+ $footerLocation: MenuLocationEnum
+ ) {
+ nodeByUri(uri: $uri) {
+ ... on Category {
+ name
+ posts {
+ edges {
+ node {
+ id
+ title
+ content
+ date
+ uri
+ ...FeaturedImageFragment
+ author {
+ node {
+ name
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ generalSettings {
+ ...BlogInfoFragment
+ }
+ headerMenuItems: menuItems(where: { location: $headerLocation }) {
+ nodes {
+ ...NavigationMenuItemFragment
+ }
+ }
+ footerMenuItems: menuItems(where: { location: $footerLocation }) {
+ nodes {
+ ...NavigationMenuItemFragment
+ }
+ }
+ }
+`;
+
+Component.variables = ({ uri }) => {
+ return {
+ uri,
+ headerLocation: MENUS.PRIMARY_LOCATION,
+ footerLocation: MENUS.FOOTER_LOCATION,
+ };
+};
diff --git a/examples/next/block-support/wp-templates/front-page.js b/examples/next/block-support/wp-templates/front-page.js
new file mode 100644
index 000000000..9acd70140
--- /dev/null
+++ b/examples/next/block-support/wp-templates/front-page.js
@@ -0,0 +1,74 @@
+import { useQuery, gql } from '@apollo/client';
+import * as MENUS from '../constants/menus';
+import { BlogInfoFragment } from '../fragments/GeneralSettings';
+import {
+ Header,
+ Footer,
+ Main,
+ Container,
+ NavigationMenu,
+ Hero,
+ Head,
+} from '../components';
+
+export default function Component() {
+ const { data } = useQuery(Component.query, {
+ variables: Component.variables(),
+ });
+
+ const { title: siteTitle, description: siteDescription } =
+ data?.generalSettings;
+ const primaryMenu = data?.headerMenuItems?.nodes ?? [];
+ const footerMenu = data?.footerMenuItems?.nodes ?? [];
+
+ return (
+ <>
+
+
+
+
+
+
+
This page is utilizing the "front-page" WordPress template.
+
wp-templates/front-page.js
+
+
+
+
+ >
+ );
+}
+
+Component.query = gql`
+ ${BlogInfoFragment}
+ ${NavigationMenu.fragments.entry}
+ query GetPageData(
+ $headerLocation: MenuLocationEnum
+ $footerLocation: MenuLocationEnum
+ ) {
+ generalSettings {
+ ...BlogInfoFragment
+ }
+ headerMenuItems: menuItems(where: { location: $headerLocation }) {
+ nodes {
+ ...NavigationMenuItemFragment
+ }
+ }
+ footerMenuItems: menuItems(where: { location: $footerLocation }) {
+ nodes {
+ ...NavigationMenuItemFragment
+ }
+ }
+ }
+`;
+
+Component.variables = () => {
+ return {
+ headerLocation: MENUS.PRIMARY_LOCATION,
+ footerLocation: MENUS.FOOTER_LOCATION,
+ };
+};
diff --git a/examples/next/block-support/wp-templates/index.js b/examples/next/block-support/wp-templates/index.js
new file mode 100644
index 000000000..3cabd3e14
--- /dev/null
+++ b/examples/next/block-support/wp-templates/index.js
@@ -0,0 +1,13 @@
+import category from './category';
+import tag from './tag';
+import frontPage from './front-page';
+import page from './page';
+import single from './single';
+
+export default {
+ category,
+ tag,
+ 'front-page': frontPage,
+ page,
+ single,
+};
diff --git a/examples/next/block-support/wp-templates/page.js b/examples/next/block-support/wp-templates/page.js
new file mode 100644
index 000000000..539eadc99
--- /dev/null
+++ b/examples/next/block-support/wp-templates/page.js
@@ -0,0 +1,126 @@
+import { gql } from '@apollo/client';
+import { flatListToHierarchical } from '@faustwp/core';
+import { WordPressBlocksViewer } from '@faustwp/blocks';
+import * as MENUS from '../constants/menus';
+import { BlogInfoFragment } from '../fragments/GeneralSettings';
+import blocks from '../wp-blocks';
+import {
+ Container,
+ ContentWrapper,
+ EntryHeader,
+ FeaturedImage,
+ Footer,
+ Header,
+ Main,
+ NavigationMenu,
+ Head,
+} from '../components';
+
+export default function Component(props) {
+ // Loading state for previews
+ if (props.loading) {
+ return <>Loading...>;
+ }
+
+ const { title: siteTitle, description: siteDescription } =
+ props?.data?.generalSettings;
+ const primaryMenu = props?.data?.headerMenuItems?.nodes ?? [];
+ const footerMenu = props?.data?.footerMenuItems?.nodes ?? [];
+ const { title, editorBlocks, featuredImage } = props?.data?.page ?? { title: '' };
+ const blocks = flatListToHierarchical(editorBlocks, {childrenKey: 'innerBlocks'});
+
+ return (
+ <>
+
+
+
+ <>
+
+
+
+
+
+
+ >
+
+
+ >
+ );
+}
+
+Component.variables = ({ databaseId }, ctx) => {
+ return {
+ databaseId,
+ headerLocation: MENUS.PRIMARY_LOCATION,
+ footerLocation: MENUS.FOOTER_LOCATION,
+ asPreview: ctx?.asPreview,
+ };
+};
+
+Component.query = gql`
+ ${BlogInfoFragment}
+ ${NavigationMenu.fragments.entry}
+ ${FeaturedImage.fragments.entry}
+ ${blocks.CoreParagraph.fragments.entry}
+ ${blocks.CoreColumns.fragments.entry}
+ ${blocks.CoreColumn.fragments.entry}
+ ${blocks.CoreCode.fragments.entry}
+ ${blocks.CoreButtons.fragments.entry}
+ ${blocks.CoreButton.fragments.entry}
+ ${blocks.CoreQuote.fragments.entry}
+ ${blocks.CoreImage.fragments.entry}
+ ${blocks.CoreSeparator.fragments.entry}
+ ${blocks.CoreList.fragments.entry}
+ ${blocks.CoreHeading.fragments.entry}
+ query GetPageData(
+ $databaseId: ID!
+ $headerLocation: MenuLocationEnum
+ $footerLocation: MenuLocationEnum
+ $asPreview: Boolean = false
+ ) {
+ page(id: $databaseId, idType: DATABASE_ID, asPreview: $asPreview) {
+ title
+ content
+ editorBlocks(flat: false) {
+ name
+ __typename
+ renderedHtml
+ id: clientId
+ parentId: parentClientId
+ ...${blocks.CoreParagraph.fragments.key}
+ ...${blocks.CoreColumns.fragments.key}
+ ...${blocks.CoreColumn.fragments.key}
+ ...${blocks.CoreCode.fragments.key}
+ ...${blocks.CoreButtons.fragments.key}
+ ...${blocks.CoreButton.fragments.key}
+ ...${blocks.CoreQuote.fragments.key}
+ ...${blocks.CoreImage.fragments.key}
+ ...${blocks.CoreSeparator.fragments.key}
+ ...${blocks.CoreList.fragments.key}
+ ...${blocks.CoreHeading.fragments.key}
+ }
+ ...FeaturedImageFragment
+ }
+ generalSettings {
+ ...BlogInfoFragment
+ }
+ footerMenuItems: menuItems(where: { location: $footerLocation }) {
+ nodes {
+ ...NavigationMenuItemFragment
+ }
+ }
+ headerMenuItems: menuItems(where: { location: $headerLocation }) {
+ nodes {
+ ...NavigationMenuItemFragment
+ }
+ }
+ }
+`;
diff --git a/examples/next/block-support/wp-templates/single.js b/examples/next/block-support/wp-templates/single.js
new file mode 100644
index 000000000..6bf921e71
--- /dev/null
+++ b/examples/next/block-support/wp-templates/single.js
@@ -0,0 +1,137 @@
+import { gql } from '@apollo/client';
+import { flatListToHierarchical } from '@faustwp/core';
+import { WordPressBlocksViewer } from '@faustwp/blocks';
+import * as MENUS from '../constants/menus';
+import { BlogInfoFragment } from '../fragments/GeneralSettings';
+import blocks from '../wp-blocks';
+import {
+ Container,
+ ContentWrapper,
+ EntryHeader,
+ FeaturedImage,
+ Footer,
+ Header,
+ Main,
+ NavigationMenu,
+ Head,
+} from '../components';
+
+export default function Component(props) {
+ // Loading state for previews
+ if (props.loading) {
+ return <>Loading...>;
+ }
+
+ const { title: siteTitle, description: siteDescription } =
+ props?.data?.generalSettings;
+ const primaryMenu = props?.data?.headerMenuItems?.nodes ?? [];
+ const footerMenu = props?.data?.footerMenuItems?.nodes ?? [];
+ const { title, featuredImage, date, author, editorBlocks } = props?.data?.post ?? { title: '' };
+ const blockList = flatListToHierarchical(editorBlocks, {childrenKey: 'innerBlocks'});
+
+ return (
+ <>
+
+
+
+ <>
+
+
+
+
+
+
+ >
+
+
+ >
+ );
+}
+
+Component.query = gql`
+ ${BlogInfoFragment}
+ ${NavigationMenu.fragments.entry}
+ ${FeaturedImage.fragments.entry}
+ ${blocks.CoreParagraph.fragments.entry}
+ ${blocks.CoreColumns.fragments.entry}
+ ${blocks.CoreColumn.fragments.entry}
+ ${blocks.CoreCode.fragments.entry}
+ ${blocks.CoreButtons.fragments.entry}
+ ${blocks.CoreButton.fragments.entry}
+ ${blocks.CoreQuote.fragments.entry}
+ ${blocks.CoreImage.fragments.entry}
+ ${blocks.CoreSeparator.fragments.entry}
+ ${blocks.CoreList.fragments.entry}
+ ${blocks.CoreHeading.fragments.entry}
+ query GetPost(
+ $databaseId: ID!
+ $headerLocation: MenuLocationEnum
+ $footerLocation: MenuLocationEnum
+ $asPreview: Boolean = false
+ ) {
+ post(id: $databaseId, idType: DATABASE_ID, asPreview: $asPreview) {
+ title
+ content
+ date
+ author {
+ node {
+ name
+ }
+ }
+ editorBlocks(flat: false) {
+ name
+ __typename
+ renderedHtml
+ id: clientId
+ parentId: parentClientId
+ ...${blocks.CoreParagraph.fragments.key}
+ ...${blocks.CoreColumns.fragments.key}
+ ...${blocks.CoreColumn.fragments.key}
+ ...${blocks.CoreCode.fragments.key}
+ ...${blocks.CoreButtons.fragments.key}
+ ...${blocks.CoreButton.fragments.key}
+ ...${blocks.CoreQuote.fragments.key}
+ ...${blocks.CoreImage.fragments.key}
+ ...${blocks.CoreSeparator.fragments.key}
+ ...${blocks.CoreList.fragments.key}
+ ...${blocks.CoreHeading.fragments.key}
+ }
+ ...FeaturedImageFragment
+ }
+ generalSettings {
+ ...BlogInfoFragment
+ }
+ headerMenuItems: menuItems(where: { location: $headerLocation }) {
+ nodes {
+ ...NavigationMenuItemFragment
+ }
+ }
+ footerMenuItems: menuItems(where: { location: $footerLocation }) {
+ nodes {
+ ...NavigationMenuItemFragment
+ }
+ }
+ }
+`;
+
+Component.variables = ({ databaseId }, ctx) => {
+ return {
+ databaseId,
+ headerLocation: MENUS.PRIMARY_LOCATION,
+ footerLocation: MENUS.FOOTER_LOCATION,
+ asPreview: ctx?.asPreview,
+ };
+};
diff --git a/examples/next/block-support/wp-templates/tag.js b/examples/next/block-support/wp-templates/tag.js
new file mode 100644
index 000000000..adc37933c
--- /dev/null
+++ b/examples/next/block-support/wp-templates/tag.js
@@ -0,0 +1,106 @@
+import { gql } from '@apollo/client';
+import * as MENUS from '../constants/menus';
+import { BlogInfoFragment } from '../fragments/GeneralSettings';
+import {
+ Header,
+ Footer,
+ Main,
+ Container,
+ EntryHeader,
+ NavigationMenu,
+ FeaturedImage,
+ Post,
+ Head,
+} from '../components';
+
+export default function Component(props) {
+ const { title: siteTitle, description: siteDescription } =
+ props?.data?.generalSettings;
+ const primaryMenu = props?.data?.headerMenuItems?.nodes ?? [];
+ const footerMenu = props?.data?.footerMenuItems?.nodes ?? [];
+ const { name, posts } = props.data.nodeByUri;
+
+ return (
+ <>
+
+
+
+ <>
+
+
+ {posts.edges.map((post) => (
+
+ ))}
+
+ >
+
+
+ >
+ );
+}
+
+Component.query = gql`
+ ${BlogInfoFragment}
+ ${NavigationMenu.fragments.entry}
+ ${FeaturedImage.fragments.entry}
+ query GetTagPage(
+ $uri: String!
+ $headerLocation: MenuLocationEnum
+ $footerLocation: MenuLocationEnum
+ ) {
+ nodeByUri(uri: $uri) {
+ ... on Tag {
+ name
+ posts {
+ edges {
+ node {
+ id
+ title
+ content
+ date
+ uri
+ ...FeaturedImageFragment
+ author {
+ node {
+ name
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ generalSettings {
+ ...BlogInfoFragment
+ }
+ headerMenuItems: menuItems(where: { location: $headerLocation }) {
+ nodes {
+ ...NavigationMenuItemFragment
+ }
+ }
+ footerMenuItems: menuItems(where: { location: $footerLocation }) {
+ nodes {
+ ...NavigationMenuItemFragment
+ }
+ }
+ }
+`;
+
+Component.variables = ({ uri }) => {
+ return {
+ uri,
+ headerLocation: MENUS.PRIMARY_LOCATION,
+ footerLocation: MENUS.FOOTER_LOCATION,
+ };
+};
diff --git a/package-lock.json b/package-lock.json
index bf1607657..6d80ee603 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -20020,6 +20020,186 @@
"plugins/faustwp": {
"name": "@faustwp/wordpress-plugin",
"version": "1.0.3"
+ },
+ "packages/experimental-app-router/node_modules/@next/swc-android-arm-eabi": {
+ "version": "12.3.0",
+ "resolved": "https://registry.npmjs.org/@next/swc-android-arm-eabi/-/swc-android-arm-eabi-12.3.0.tgz",
+ "integrity": "sha512-/PuirPnAKsYBw93w/7Q9hqy+KGOU9mjYprZ/faxMUJh/dc6v3rYLxkZKNG9nFPIW4QKNTCnhP40xF9hLnxO+xg==",
+ "cpu": [
+ "arm"
+ ],
+ "optional": true,
+ "os": [
+ "android"
+ ],
+ "engines": {
+ "node": ">= 10"
+ }
+ },
+ "packages/experimental-app-router/node_modules/@next/swc-android-arm64": {
+ "version": "12.3.0",
+ "resolved": "https://registry.npmjs.org/@next/swc-android-arm64/-/swc-android-arm64-12.3.0.tgz",
+ "integrity": "sha512-OaI+FhAM6P9B6Ybwbn0Zl8YwWido0lLwhDBi9WiYCh4RQmIXAyVIoIJPHo4fP05+mXaJ/k1trvDvuURvHOq2qw==",
+ "cpu": [
+ "arm64"
+ ],
+ "optional": true,
+ "os": [
+ "android"
+ ],
+ "engines": {
+ "node": ">= 10"
+ }
+ },
+ "packages/experimental-app-router/node_modules/@next/swc-darwin-arm64": {
+ "version": "12.3.0",
+ "resolved": "https://registry.npmjs.org/@next/swc-darwin-arm64/-/swc-darwin-arm64-12.3.0.tgz",
+ "integrity": "sha512-9s4d3Mhii+WFce8o8Jok7WC3Bawkr9wEUU++SJRptjU1L5tsfYJMrSYCACHLhZujziNDLyExe4Hwwsccps1sfg==",
+ "cpu": [
+ "arm64"
+ ],
+ "optional": true,
+ "os": [
+ "darwin"
+ ],
+ "engines": {
+ "node": ">= 10"
+ }
+ },
+ "packages/experimental-app-router/node_modules/@next/swc-freebsd-x64": {
+ "version": "12.3.0",
+ "resolved": "https://registry.npmjs.org/@next/swc-freebsd-x64/-/swc-freebsd-x64-12.3.0.tgz",
+ "integrity": "sha512-xAlruUREij/bFa+qsE1tmsP28t7vz02N4ZDHt2lh3uJUniE0Ne9idyIDLc1Ed0IF2RjfgOp4ZVunuS3OM0sngw==",
+ "cpu": [
+ "x64"
+ ],
+ "optional": true,
+ "os": [
+ "freebsd"
+ ],
+ "engines": {
+ "node": ">= 10"
+ }
+ },
+ "packages/experimental-app-router/node_modules/@next/swc-linux-arm-gnueabihf": {
+ "version": "12.3.0",
+ "resolved": "https://registry.npmjs.org/@next/swc-linux-arm-gnueabihf/-/swc-linux-arm-gnueabihf-12.3.0.tgz",
+ "integrity": "sha512-jin2S4VT/cugc2dSZEUIabhYDJNgrUh7fufbdsaAezgcQzqfdfJqfxl4E9GuafzB4cbRPTaqA0V5uqbp0IyGkQ==",
+ "cpu": [
+ "arm"
+ ],
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">= 10"
+ }
+ },
+ "packages/experimental-app-router/node_modules/@next/swc-linux-arm64-gnu": {
+ "version": "12.3.0",
+ "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-gnu/-/swc-linux-arm64-gnu-12.3.0.tgz",
+ "integrity": "sha512-RqJHDKe0WImeUrdR0kayTkRWgp4vD/MS7g0r6Xuf8+ellOFH7JAAJffDW3ayuVZeMYOa7RvgNFcOoWnrTUl9Nw==",
+ "cpu": [
+ "arm64"
+ ],
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">= 10"
+ }
+ },
+ "packages/experimental-app-router/node_modules/@next/swc-linux-arm64-musl": {
+ "version": "12.3.0",
+ "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-musl/-/swc-linux-arm64-musl-12.3.0.tgz",
+ "integrity": "sha512-nvNWoUieMjvDjpYJ/4SQe9lQs2xMj6ZRs8N+bmTrVu9leY2Fg3WD6W9p/1uU9hGO8u+OdF13wc4iRShu/WYIHg==",
+ "cpu": [
+ "arm64"
+ ],
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">= 10"
+ }
+ },
+ "packages/experimental-app-router/node_modules/@next/swc-linux-x64-gnu": {
+ "version": "12.3.0",
+ "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-12.3.0.tgz",
+ "integrity": "sha512-4ajhIuVU9PeQCMMhdDgZTLrHmjbOUFuIyg6J19hZqwEwDTSqQyrSLkbJs2Nd7IRiM6Ul/XyrtEFCpk4k+xD2+w==",
+ "cpu": [
+ "x64"
+ ],
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">= 10"
+ }
+ },
+ "packages/experimental-app-router/node_modules/@next/swc-linux-x64-musl": {
+ "version": "12.3.0",
+ "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-musl/-/swc-linux-x64-musl-12.3.0.tgz",
+ "integrity": "sha512-U092RBYbaGxoMAwpauePJEu2PuZSEoUCGJBvsptQr2/2XIMwAJDYM4c/M5NfYEsBr+yjvsYNsOpYfeQ88D82Yg==",
+ "cpu": [
+ "x64"
+ ],
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">= 10"
+ }
+ },
+ "packages/experimental-app-router/node_modules/@next/swc-win32-arm64-msvc": {
+ "version": "12.3.0",
+ "resolved": "https://registry.npmjs.org/@next/swc-win32-arm64-msvc/-/swc-win32-arm64-msvc-12.3.0.tgz",
+ "integrity": "sha512-pzSzaxjDEJe67bUok9Nxf9rykbJfHXW0owICFsPBsqHyc+cr8vpF7g9e2APTCddtVhvjkga9ILoZJ9NxWS7Yiw==",
+ "cpu": [
+ "arm64"
+ ],
+ "optional": true,
+ "os": [
+ "win32"
+ ],
+ "engines": {
+ "node": ">= 10"
+ }
+ },
+ "packages/experimental-app-router/node_modules/@next/swc-win32-ia32-msvc": {
+ "version": "12.3.0",
+ "resolved": "https://registry.npmjs.org/@next/swc-win32-ia32-msvc/-/swc-win32-ia32-msvc-12.3.0.tgz",
+ "integrity": "sha512-MQGUpMbYhQmTZ06a9e0hPQJnxFMwETo2WtyAotY3GEzbNCQVbCGhsvqEKcl+ZEHgShlHXUWvSffq1ZscY6gK7A==",
+ "cpu": [
+ "ia32"
+ ],
+ "optional": true,
+ "os": [
+ "win32"
+ ],
+ "engines": {
+ "node": ">= 10"
+ }
+ },
+ "packages/experimental-app-router/node_modules/@next/swc-win32-x64-msvc": {
+ "version": "12.3.0",
+ "resolved": "https://registry.npmjs.org/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-12.3.0.tgz",
+ "integrity": "sha512-C/nw6OgQpEULWqs+wgMHXGvlJLguPRFFGqR2TAqWBerQ8J+Sg3z1ZTqwelkSi4FoqStGuZ2UdFHIDN1ySmR1xA==",
+ "cpu": [
+ "x64"
+ ],
+ "optional": true,
+ "os": [
+ "win32"
+ ],
+ "engines": {
+ "node": ">= 10"
+ }
}
},
"dependencies": {
@@ -33008,6 +33188,78 @@
},
"zod": {
"version": "3.21.4"
+ },
+ "@next/swc-android-arm-eabi": {
+ "version": "12.3.0",
+ "resolved": "https://registry.npmjs.org/@next/swc-android-arm-eabi/-/swc-android-arm-eabi-12.3.0.tgz",
+ "integrity": "sha512-/PuirPnAKsYBw93w/7Q9hqy+KGOU9mjYprZ/faxMUJh/dc6v3rYLxkZKNG9nFPIW4QKNTCnhP40xF9hLnxO+xg==",
+ "optional": true
+ },
+ "@next/swc-android-arm64": {
+ "version": "12.3.0",
+ "resolved": "https://registry.npmjs.org/@next/swc-android-arm64/-/swc-android-arm64-12.3.0.tgz",
+ "integrity": "sha512-OaI+FhAM6P9B6Ybwbn0Zl8YwWido0lLwhDBi9WiYCh4RQmIXAyVIoIJPHo4fP05+mXaJ/k1trvDvuURvHOq2qw==",
+ "optional": true
+ },
+ "@next/swc-darwin-arm64": {
+ "version": "12.3.0",
+ "resolved": "https://registry.npmjs.org/@next/swc-darwin-arm64/-/swc-darwin-arm64-12.3.0.tgz",
+ "integrity": "sha512-9s4d3Mhii+WFce8o8Jok7WC3Bawkr9wEUU++SJRptjU1L5tsfYJMrSYCACHLhZujziNDLyExe4Hwwsccps1sfg==",
+ "optional": true
+ },
+ "@next/swc-freebsd-x64": {
+ "version": "12.3.0",
+ "resolved": "https://registry.npmjs.org/@next/swc-freebsd-x64/-/swc-freebsd-x64-12.3.0.tgz",
+ "integrity": "sha512-xAlruUREij/bFa+qsE1tmsP28t7vz02N4ZDHt2lh3uJUniE0Ne9idyIDLc1Ed0IF2RjfgOp4ZVunuS3OM0sngw==",
+ "optional": true
+ },
+ "@next/swc-linux-arm-gnueabihf": {
+ "version": "12.3.0",
+ "resolved": "https://registry.npmjs.org/@next/swc-linux-arm-gnueabihf/-/swc-linux-arm-gnueabihf-12.3.0.tgz",
+ "integrity": "sha512-jin2S4VT/cugc2dSZEUIabhYDJNgrUh7fufbdsaAezgcQzqfdfJqfxl4E9GuafzB4cbRPTaqA0V5uqbp0IyGkQ==",
+ "optional": true
+ },
+ "@next/swc-linux-arm64-gnu": {
+ "version": "12.3.0",
+ "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-gnu/-/swc-linux-arm64-gnu-12.3.0.tgz",
+ "integrity": "sha512-RqJHDKe0WImeUrdR0kayTkRWgp4vD/MS7g0r6Xuf8+ellOFH7JAAJffDW3ayuVZeMYOa7RvgNFcOoWnrTUl9Nw==",
+ "optional": true
+ },
+ "@next/swc-linux-arm64-musl": {
+ "version": "12.3.0",
+ "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-musl/-/swc-linux-arm64-musl-12.3.0.tgz",
+ "integrity": "sha512-nvNWoUieMjvDjpYJ/4SQe9lQs2xMj6ZRs8N+bmTrVu9leY2Fg3WD6W9p/1uU9hGO8u+OdF13wc4iRShu/WYIHg==",
+ "optional": true
+ },
+ "@next/swc-linux-x64-gnu": {
+ "version": "12.3.0",
+ "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-12.3.0.tgz",
+ "integrity": "sha512-4ajhIuVU9PeQCMMhdDgZTLrHmjbOUFuIyg6J19hZqwEwDTSqQyrSLkbJs2Nd7IRiM6Ul/XyrtEFCpk4k+xD2+w==",
+ "optional": true
+ },
+ "@next/swc-linux-x64-musl": {
+ "version": "12.3.0",
+ "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-musl/-/swc-linux-x64-musl-12.3.0.tgz",
+ "integrity": "sha512-U092RBYbaGxoMAwpauePJEu2PuZSEoUCGJBvsptQr2/2XIMwAJDYM4c/M5NfYEsBr+yjvsYNsOpYfeQ88D82Yg==",
+ "optional": true
+ },
+ "@next/swc-win32-arm64-msvc": {
+ "version": "12.3.0",
+ "resolved": "https://registry.npmjs.org/@next/swc-win32-arm64-msvc/-/swc-win32-arm64-msvc-12.3.0.tgz",
+ "integrity": "sha512-pzSzaxjDEJe67bUok9Nxf9rykbJfHXW0owICFsPBsqHyc+cr8vpF7g9e2APTCddtVhvjkga9ILoZJ9NxWS7Yiw==",
+ "optional": true
+ },
+ "@next/swc-win32-ia32-msvc": {
+ "version": "12.3.0",
+ "resolved": "https://registry.npmjs.org/@next/swc-win32-ia32-msvc/-/swc-win32-ia32-msvc-12.3.0.tgz",
+ "integrity": "sha512-MQGUpMbYhQmTZ06a9e0hPQJnxFMwETo2WtyAotY3GEzbNCQVbCGhsvqEKcl+ZEHgShlHXUWvSffq1ZscY6gK7A==",
+ "optional": true
+ },
+ "@next/swc-win32-x64-msvc": {
+ "version": "12.3.0",
+ "resolved": "https://registry.npmjs.org/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-12.3.0.tgz",
+ "integrity": "sha512-C/nw6OgQpEULWqs+wgMHXGvlJLguPRFFGqR2TAqWBerQ8J+Sg3z1ZTqwelkSi4FoqStGuZ2UdFHIDN1ySmR1xA==",
+ "optional": true
}
}
}
diff --git a/package.json b/package.json
index 3ae0eb2f5..3db3e55db 100644
--- a/package.json
+++ b/package.json
@@ -18,6 +18,7 @@
"examples/next/getting-started",
"examples/next/faustwp-getting-started",
"examples/next/app-router",
+ "examples/next/block-support",
"plugins/faustwp"
]
},
From 1be9609f4068b591737c1161ae97623aac59c894 Mon Sep 17 00:00:00 2001
From: Joe Fusco
Date: Fri, 18 Aug 2023 16:09:06 -0400
Subject: [PATCH 02/13] Auto analyze new project
Signed-off-by: Joe Fusco
---
.github/workflows/nextjs-bundle-analysis.yml | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/.github/workflows/nextjs-bundle-analysis.yml b/.github/workflows/nextjs-bundle-analysis.yml
index dd46bd502..3bf05b303 100644
--- a/.github/workflows/nextjs-bundle-analysis.yml
+++ b/.github/workflows/nextjs-bundle-analysis.yml
@@ -21,7 +21,10 @@ jobs:
analyze:
strategy:
matrix:
- next-dir: ['examples/next/faustwp-getting-started']
+ next-dir: [
+ 'examples/next/faustwp-getting-started',
+ 'examples/next/block-support'
+ ]
runs-on: ubuntu-latest
steps:
From 377942f5a6861597201257b85f378432b6521c3f Mon Sep 17 00:00:00 2001
From: Joe Fusco
Date: Fri, 18 Aug 2023 16:27:25 -0400
Subject: [PATCH 03/13] Update dependencies
Signed-off-by: Joe Fusco
---
examples/next/block-support/package.json | 4 +-
package-lock.json | 334 +++++++++++++++--------
2 files changed, 215 insertions(+), 123 deletions(-)
diff --git a/examples/next/block-support/package.json b/examples/next/block-support/package.json
index fa70a9fc0..1104ac5df 100644
--- a/examples/next/block-support/package.json
+++ b/examples/next/block-support/package.json
@@ -11,9 +11,9 @@
},
"dependencies": {
"@apollo/client": "^3.6.6",
- "@faustwp/blocks": "1.2.0",
+ "@faustwp/blocks": "2.0.0",
"@faustwp/cli": "1.0.1",
- "@faustwp/core": "1.0.3",
+ "@faustwp/core": "1.1.0",
"@wordpress/base-styles": "^4.26.0",
"@wordpress/block-library": "^7.19.0",
"classnames": "^2.3.1",
diff --git a/package-lock.json b/package-lock.json
index 6d80ee603..9f29447ae 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -41,6 +41,7 @@
"examples/next/getting-started",
"examples/next/faustwp-getting-started",
"examples/next/app-router",
+ "examples/next/block-support",
"plugins/faustwp"
]
}
@@ -281,6 +282,28 @@
}
}
},
+ "examples/next/block-support": {
+ "name": "@faustwp/block-support-example",
+ "version": "0.1.0",
+ "dependencies": {
+ "@apollo/client": "^3.6.6",
+ "@faustwp/blocks": "2.0.0",
+ "@faustwp/cli": "1.0.1",
+ "@faustwp/core": "1.1.0",
+ "@wordpress/base-styles": "^4.26.0",
+ "@wordpress/block-library": "^7.19.0",
+ "classnames": "^2.3.1",
+ "graphql": "^16.6.0",
+ "next": "^12.1.6",
+ "react": "^17.0.2",
+ "react-dom": "^17.0.2",
+ "sass": "^1.54.9"
+ },
+ "engines": {
+ "node": ">=16",
+ "npm": ">=8"
+ }
+ },
"examples/next/faustwp-getting-started": {
"name": "@faustwp/getting-started-example",
"version": "0.1.0",
@@ -1345,6 +1368,10 @@
"resolved": "packages/block-editor-utils",
"link": true
},
+ "node_modules/@faustwp/block-support-example": {
+ "resolved": "examples/next/block-support",
+ "link": true
+ },
"node_modules/@faustwp/blocks": {
"resolved": "packages/blocks",
"link": true
@@ -18150,6 +18177,21 @@
"dev": true,
"license": "MIT"
},
+ "packages/experimental-app-router/node_modules/@next/swc-darwin-arm64": {
+ "version": "12.3.0",
+ "resolved": "https://registry.npmjs.org/@next/swc-darwin-arm64/-/swc-darwin-arm64-12.3.0.tgz",
+ "integrity": "sha512-9s4d3Mhii+WFce8o8Jok7WC3Bawkr9wEUU++SJRptjU1L5tsfYJMrSYCACHLhZujziNDLyExe4Hwwsccps1sfg==",
+ "cpu": [
+ "arm64"
+ ],
+ "optional": true,
+ "os": [
+ "darwin"
+ ],
+ "engines": {
+ "node": ">= 10"
+ }
+ },
"packages/experimental-app-router/node_modules/@next/swc-darwin-x64": {
"version": "13.4.13",
"cpu": [
@@ -18165,6 +18207,111 @@
"node": ">= 10"
}
},
+ "packages/experimental-app-router/node_modules/@next/swc-linux-arm64-gnu": {
+ "version": "12.3.0",
+ "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-gnu/-/swc-linux-arm64-gnu-12.3.0.tgz",
+ "integrity": "sha512-RqJHDKe0WImeUrdR0kayTkRWgp4vD/MS7g0r6Xuf8+ellOFH7JAAJffDW3ayuVZeMYOa7RvgNFcOoWnrTUl9Nw==",
+ "cpu": [
+ "arm64"
+ ],
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">= 10"
+ }
+ },
+ "packages/experimental-app-router/node_modules/@next/swc-linux-arm64-musl": {
+ "version": "12.3.0",
+ "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-musl/-/swc-linux-arm64-musl-12.3.0.tgz",
+ "integrity": "sha512-nvNWoUieMjvDjpYJ/4SQe9lQs2xMj6ZRs8N+bmTrVu9leY2Fg3WD6W9p/1uU9hGO8u+OdF13wc4iRShu/WYIHg==",
+ "cpu": [
+ "arm64"
+ ],
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">= 10"
+ }
+ },
+ "packages/experimental-app-router/node_modules/@next/swc-linux-x64-gnu": {
+ "version": "12.3.0",
+ "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-12.3.0.tgz",
+ "integrity": "sha512-4ajhIuVU9PeQCMMhdDgZTLrHmjbOUFuIyg6J19hZqwEwDTSqQyrSLkbJs2Nd7IRiM6Ul/XyrtEFCpk4k+xD2+w==",
+ "cpu": [
+ "x64"
+ ],
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">= 10"
+ }
+ },
+ "packages/experimental-app-router/node_modules/@next/swc-linux-x64-musl": {
+ "version": "12.3.0",
+ "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-musl/-/swc-linux-x64-musl-12.3.0.tgz",
+ "integrity": "sha512-U092RBYbaGxoMAwpauePJEu2PuZSEoUCGJBvsptQr2/2XIMwAJDYM4c/M5NfYEsBr+yjvsYNsOpYfeQ88D82Yg==",
+ "cpu": [
+ "x64"
+ ],
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">= 10"
+ }
+ },
+ "packages/experimental-app-router/node_modules/@next/swc-win32-arm64-msvc": {
+ "version": "12.3.0",
+ "resolved": "https://registry.npmjs.org/@next/swc-win32-arm64-msvc/-/swc-win32-arm64-msvc-12.3.0.tgz",
+ "integrity": "sha512-pzSzaxjDEJe67bUok9Nxf9rykbJfHXW0owICFsPBsqHyc+cr8vpF7g9e2APTCddtVhvjkga9ILoZJ9NxWS7Yiw==",
+ "cpu": [
+ "arm64"
+ ],
+ "optional": true,
+ "os": [
+ "win32"
+ ],
+ "engines": {
+ "node": ">= 10"
+ }
+ },
+ "packages/experimental-app-router/node_modules/@next/swc-win32-ia32-msvc": {
+ "version": "12.3.0",
+ "resolved": "https://registry.npmjs.org/@next/swc-win32-ia32-msvc/-/swc-win32-ia32-msvc-12.3.0.tgz",
+ "integrity": "sha512-MQGUpMbYhQmTZ06a9e0hPQJnxFMwETo2WtyAotY3GEzbNCQVbCGhsvqEKcl+ZEHgShlHXUWvSffq1ZscY6gK7A==",
+ "cpu": [
+ "ia32"
+ ],
+ "optional": true,
+ "os": [
+ "win32"
+ ],
+ "engines": {
+ "node": ">= 10"
+ }
+ },
+ "packages/experimental-app-router/node_modules/@next/swc-win32-x64-msvc": {
+ "version": "12.3.0",
+ "resolved": "https://registry.npmjs.org/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-12.3.0.tgz",
+ "integrity": "sha512-C/nw6OgQpEULWqs+wgMHXGvlJLguPRFFGqR2TAqWBerQ8J+Sg3z1ZTqwelkSi4FoqStGuZ2UdFHIDN1ySmR1xA==",
+ "cpu": [
+ "x64"
+ ],
+ "optional": true,
+ "os": [
+ "win32"
+ ],
+ "engines": {
+ "node": ">= 10"
+ }
+ },
"packages/experimental-app-router/node_modules/@sinonjs/commons": {
"version": "3.0.0",
"dev": true,
@@ -20051,21 +20198,6 @@
"node": ">= 10"
}
},
- "packages/experimental-app-router/node_modules/@next/swc-darwin-arm64": {
- "version": "12.3.0",
- "resolved": "https://registry.npmjs.org/@next/swc-darwin-arm64/-/swc-darwin-arm64-12.3.0.tgz",
- "integrity": "sha512-9s4d3Mhii+WFce8o8Jok7WC3Bawkr9wEUU++SJRptjU1L5tsfYJMrSYCACHLhZujziNDLyExe4Hwwsccps1sfg==",
- "cpu": [
- "arm64"
- ],
- "optional": true,
- "os": [
- "darwin"
- ],
- "engines": {
- "node": ">= 10"
- }
- },
"packages/experimental-app-router/node_modules/@next/swc-freebsd-x64": {
"version": "12.3.0",
"resolved": "https://registry.npmjs.org/@next/swc-freebsd-x64/-/swc-freebsd-x64-12.3.0.tgz",
@@ -20095,111 +20227,6 @@
"engines": {
"node": ">= 10"
}
- },
- "packages/experimental-app-router/node_modules/@next/swc-linux-arm64-gnu": {
- "version": "12.3.0",
- "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-gnu/-/swc-linux-arm64-gnu-12.3.0.tgz",
- "integrity": "sha512-RqJHDKe0WImeUrdR0kayTkRWgp4vD/MS7g0r6Xuf8+ellOFH7JAAJffDW3ayuVZeMYOa7RvgNFcOoWnrTUl9Nw==",
- "cpu": [
- "arm64"
- ],
- "optional": true,
- "os": [
- "linux"
- ],
- "engines": {
- "node": ">= 10"
- }
- },
- "packages/experimental-app-router/node_modules/@next/swc-linux-arm64-musl": {
- "version": "12.3.0",
- "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-musl/-/swc-linux-arm64-musl-12.3.0.tgz",
- "integrity": "sha512-nvNWoUieMjvDjpYJ/4SQe9lQs2xMj6ZRs8N+bmTrVu9leY2Fg3WD6W9p/1uU9hGO8u+OdF13wc4iRShu/WYIHg==",
- "cpu": [
- "arm64"
- ],
- "optional": true,
- "os": [
- "linux"
- ],
- "engines": {
- "node": ">= 10"
- }
- },
- "packages/experimental-app-router/node_modules/@next/swc-linux-x64-gnu": {
- "version": "12.3.0",
- "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-12.3.0.tgz",
- "integrity": "sha512-4ajhIuVU9PeQCMMhdDgZTLrHmjbOUFuIyg6J19hZqwEwDTSqQyrSLkbJs2Nd7IRiM6Ul/XyrtEFCpk4k+xD2+w==",
- "cpu": [
- "x64"
- ],
- "optional": true,
- "os": [
- "linux"
- ],
- "engines": {
- "node": ">= 10"
- }
- },
- "packages/experimental-app-router/node_modules/@next/swc-linux-x64-musl": {
- "version": "12.3.0",
- "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-musl/-/swc-linux-x64-musl-12.3.0.tgz",
- "integrity": "sha512-U092RBYbaGxoMAwpauePJEu2PuZSEoUCGJBvsptQr2/2XIMwAJDYM4c/M5NfYEsBr+yjvsYNsOpYfeQ88D82Yg==",
- "cpu": [
- "x64"
- ],
- "optional": true,
- "os": [
- "linux"
- ],
- "engines": {
- "node": ">= 10"
- }
- },
- "packages/experimental-app-router/node_modules/@next/swc-win32-arm64-msvc": {
- "version": "12.3.0",
- "resolved": "https://registry.npmjs.org/@next/swc-win32-arm64-msvc/-/swc-win32-arm64-msvc-12.3.0.tgz",
- "integrity": "sha512-pzSzaxjDEJe67bUok9Nxf9rykbJfHXW0owICFsPBsqHyc+cr8vpF7g9e2APTCddtVhvjkga9ILoZJ9NxWS7Yiw==",
- "cpu": [
- "arm64"
- ],
- "optional": true,
- "os": [
- "win32"
- ],
- "engines": {
- "node": ">= 10"
- }
- },
- "packages/experimental-app-router/node_modules/@next/swc-win32-ia32-msvc": {
- "version": "12.3.0",
- "resolved": "https://registry.npmjs.org/@next/swc-win32-ia32-msvc/-/swc-win32-ia32-msvc-12.3.0.tgz",
- "integrity": "sha512-MQGUpMbYhQmTZ06a9e0hPQJnxFMwETo2WtyAotY3GEzbNCQVbCGhsvqEKcl+ZEHgShlHXUWvSffq1ZscY6gK7A==",
- "cpu": [
- "ia32"
- ],
- "optional": true,
- "os": [
- "win32"
- ],
- "engines": {
- "node": ">= 10"
- }
- },
- "packages/experimental-app-router/node_modules/@next/swc-win32-x64-msvc": {
- "version": "12.3.0",
- "resolved": "https://registry.npmjs.org/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-12.3.0.tgz",
- "integrity": "sha512-C/nw6OgQpEULWqs+wgMHXGvlJLguPRFFGqR2TAqWBerQ8J+Sg3z1ZTqwelkSi4FoqStGuZ2UdFHIDN1ySmR1xA==",
- "cpu": [
- "x64"
- ],
- "optional": true,
- "os": [
- "win32"
- ],
- "engines": {
- "node": ">= 10"
- }
}
},
"dependencies": {
@@ -22820,6 +22847,23 @@
}
}
},
+ "@faustwp/block-support-example": {
+ "version": "file:examples/next/block-support",
+ "requires": {
+ "@apollo/client": "^3.6.6",
+ "@faustwp/blocks": "2.0.0",
+ "@faustwp/cli": "1.0.1",
+ "@faustwp/core": "1.1.0",
+ "@wordpress/base-styles": "^4.26.0",
+ "@wordpress/block-library": "^7.19.0",
+ "classnames": "^2.3.1",
+ "graphql": "^16.6.0",
+ "next": "^12.1.6",
+ "react": "^17.0.2",
+ "react-dom": "^17.0.2",
+ "sass": "^1.54.9"
+ }
+ },
"@faustwp/blocks": {
"version": "file:packages/blocks",
"requires": {
@@ -23005,7 +23049,7 @@
"@types/node": "^20.4.6",
"concurrently": "^8.2.0",
"jest": "^29.6.2",
- "jest-environment-jsdom": "*",
+ "jest-environment-jsdom": "^29.6.2",
"next": "^13.4.13",
"react": "^18.2.0",
"react-dom": "^18.2.0",
@@ -23216,11 +23260,59 @@
"version": "13.4.13",
"dev": true
},
+ "@next/swc-darwin-arm64": {
+ "version": "https://registry.npmjs.org/@next/swc-darwin-arm64/-/swc-darwin-arm64-12.3.0.tgz",
+ "integrity": "sha512-9s4d3Mhii+WFce8o8Jok7WC3Bawkr9wEUU++SJRptjU1L5tsfYJMrSYCACHLhZujziNDLyExe4Hwwsccps1sfg==",
+ "dev": true,
+ "optional": true
+ },
"@next/swc-darwin-x64": {
"version": "13.4.13",
"dev": true,
"optional": true
},
+ "@next/swc-linux-arm64-gnu": {
+ "version": "https://registry.npmjs.org/@next/swc-linux-arm64-gnu/-/swc-linux-arm64-gnu-12.3.0.tgz",
+ "integrity": "sha512-RqJHDKe0WImeUrdR0kayTkRWgp4vD/MS7g0r6Xuf8+ellOFH7JAAJffDW3ayuVZeMYOa7RvgNFcOoWnrTUl9Nw==",
+ "dev": true,
+ "optional": true
+ },
+ "@next/swc-linux-arm64-musl": {
+ "version": "https://registry.npmjs.org/@next/swc-linux-arm64-musl/-/swc-linux-arm64-musl-12.3.0.tgz",
+ "integrity": "sha512-nvNWoUieMjvDjpYJ/4SQe9lQs2xMj6ZRs8N+bmTrVu9leY2Fg3WD6W9p/1uU9hGO8u+OdF13wc4iRShu/WYIHg==",
+ "dev": true,
+ "optional": true
+ },
+ "@next/swc-linux-x64-gnu": {
+ "version": "https://registry.npmjs.org/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-12.3.0.tgz",
+ "integrity": "sha512-4ajhIuVU9PeQCMMhdDgZTLrHmjbOUFuIyg6J19hZqwEwDTSqQyrSLkbJs2Nd7IRiM6Ul/XyrtEFCpk4k+xD2+w==",
+ "dev": true,
+ "optional": true
+ },
+ "@next/swc-linux-x64-musl": {
+ "version": "https://registry.npmjs.org/@next/swc-linux-x64-musl/-/swc-linux-x64-musl-12.3.0.tgz",
+ "integrity": "sha512-U092RBYbaGxoMAwpauePJEu2PuZSEoUCGJBvsptQr2/2XIMwAJDYM4c/M5NfYEsBr+yjvsYNsOpYfeQ88D82Yg==",
+ "dev": true,
+ "optional": true
+ },
+ "@next/swc-win32-arm64-msvc": {
+ "version": "https://registry.npmjs.org/@next/swc-win32-arm64-msvc/-/swc-win32-arm64-msvc-12.3.0.tgz",
+ "integrity": "sha512-pzSzaxjDEJe67bUok9Nxf9rykbJfHXW0owICFsPBsqHyc+cr8vpF7g9e2APTCddtVhvjkga9ILoZJ9NxWS7Yiw==",
+ "dev": true,
+ "optional": true
+ },
+ "@next/swc-win32-ia32-msvc": {
+ "version": "https://registry.npmjs.org/@next/swc-win32-ia32-msvc/-/swc-win32-ia32-msvc-12.3.0.tgz",
+ "integrity": "sha512-MQGUpMbYhQmTZ06a9e0hPQJnxFMwETo2WtyAotY3GEzbNCQVbCGhsvqEKcl+ZEHgShlHXUWvSffq1ZscY6gK7A==",
+ "dev": true,
+ "optional": true
+ },
+ "@next/swc-win32-x64-msvc": {
+ "version": "https://registry.npmjs.org/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-12.3.0.tgz",
+ "integrity": "sha512-C/nw6OgQpEULWqs+wgMHXGvlJLguPRFFGqR2TAqWBerQ8J+Sg3z1ZTqwelkSi4FoqStGuZ2UdFHIDN1ySmR1xA==",
+ "dev": true,
+ "optional": true
+ },
"@sinonjs/commons": {
"version": "3.0.0",
"dev": true,
From dfea166b3224f69bfa8bda27b6a3a5b67edbc4c4 Mon Sep 17 00:00:00 2001
From: Joe Fusco
Date: Fri, 18 Aug 2023 16:32:15 -0400
Subject: [PATCH 04/13] Remove hardcoded theme.json
Signed-off-by: Joe Fusco
---
examples/next/block-support/pages/_app.js | 3 +-
examples/next/block-support/theme.json | 741 ----------------------
2 files changed, 1 insertion(+), 743 deletions(-)
delete mode 100644 examples/next/block-support/theme.json
diff --git a/examples/next/block-support/pages/_app.js b/examples/next/block-support/pages/_app.js
index 9fb2e166c..f74716706 100644
--- a/examples/next/block-support/pages/_app.js
+++ b/examples/next/block-support/pages/_app.js
@@ -4,7 +4,6 @@ import { useRouter } from 'next/router';
import { WordPressBlocksProvider, fromThemeJson } from '@faustwp/blocks';
import { FaustProvider } from '@faustwp/core';
import blocks from '../wp-blocks';
-import themeJson from '../theme.json';
import '../globalStylesheet.css'; // <-- Generated by @faustwp/cli
import '../styles/global.scss';
@@ -16,7 +15,7 @@ export default function MyApp({ Component, pageProps }) {
diff --git a/examples/next/block-support/theme.json b/examples/next/block-support/theme.json
deleted file mode 100644
index 68e17a87e..000000000
--- a/examples/next/block-support/theme.json
+++ /dev/null
@@ -1,741 +0,0 @@
-{
- "$schema": "https://schemas.wp.org/trunk/theme.json",
- "version": 2,
- "customTemplates": [
- {
- "name": "blank",
- "postTypes": [
- "page",
- "post"
- ],
- "title": "Blank"
- },
- {
- "name": "blog-alternative",
- "postTypes": [
- "page"
- ],
- "title": "Blog (Alternative)"
- },
- {
- "name": "404",
- "postTypes": [
- "page"
- ],
- "title": "404"
- }
- ],
- "settings": {
- "appearanceTools": true,
- "color": {
- "palette": [
- {
- "color": "#ffffff",
- "name": "Base",
- "slug": "base"
- },
- {
- "color": "#000000",
- "name": "Contrast",
- "slug": "contrast"
- },
- {
- "color": "#9DFF20",
- "name": "Primary",
- "slug": "primary"
- },
- {
- "color": "#345C00",
- "name": "Secondary",
- "slug": "secondary"
- },
- {
- "color": "#F6F6F6",
- "name": "Tertiary",
- "slug": "tertiary"
- }
- ]
- },
- "layout": {
- "contentSize": "650px",
- "wideSize": "1200px"
- },
- "spacing": {
- "spacingScale": {
- "steps": 0
- },
- "spacingSizes": [
- {
- "size": "clamp(1.5rem, 5vw, 2rem)",
- "slug": "30",
- "name": "1"
- },
- {
- "size": "clamp(1.8rem, 1.8rem + ((1vw - 0.48rem) * 2.885), 3rem)",
- "slug": "40",
- "name": "2"
- },
- {
- "size": "clamp(2.5rem, 8vw, 4.5rem)",
- "slug": "50",
- "name": "3"
- },
- {
- "size": "clamp(3.75rem, 10vw, 7rem)",
- "slug": "60",
- "name": "4"
- },
- {
- "size": "clamp(5rem, 5.25rem + ((1vw - 0.48rem) * 9.096), 8rem)",
- "slug": "70",
- "name": "5"
- },
- {
- "size": "clamp(7rem, 14vw, 11rem)",
- "slug": "80",
- "name": "6"
- }
- ],
- "units": [
- "%",
- "px",
- "em",
- "rem",
- "vh",
- "vw"
- ]
- },
- "typography": {
- "dropCap": false,
- "fluid": true,
- "fontFamilies": [
- {
- "fontFace": [
- {
- "fontFamily": "DM Sans",
- "fontStretch": "normal",
- "fontStyle": "normal",
- "fontWeight": "400",
- "src": [
- "file:./assets/fonts/dm-sans/DMSans-Regular.woff2"
- ]
- },
- {
- "fontFamily": "DM Sans",
- "fontStretch": "normal",
- "fontStyle": "italic",
- "fontWeight": "400",
- "src": [
- "file:./assets/fonts/dm-sans/DMSans-Regular-Italic.woff2"
- ]
- },
- {
- "fontFamily": "DM Sans",
- "fontStretch": "normal",
- "fontStyle": "normal",
- "fontWeight": "700",
- "src": [
- "file:./assets/fonts/dm-sans/DMSans-Bold.woff2"
- ]
- },
- {
- "fontFamily": "DM Sans",
- "fontStretch": "normal",
- "fontStyle": "italic",
- "fontWeight": "700",
- "src": [
- "file:./assets/fonts/dm-sans/DMSans-Bold-Italic.woff2"
- ]
- }
- ],
- "fontFamily": "\"DM Sans\", sans-serif",
- "name": "DM Sans",
- "slug": "dm-sans"
- },
- {
- "fontFace": [
- {
- "fontDisplay": "block",
- "fontFamily": "IBM Plex Mono",
- "fontStretch": "normal",
- "fontStyle": "normal",
- "fontWeight": "300",
- "src": [
- "file:./assets/fonts/ibm-plex-mono/IBMPlexMono-Light.woff2"
- ]
- },
- {
- "fontDisplay": "block",
- "fontFamily": "IBM Plex Mono",
- "fontStretch": "normal",
- "fontStyle": "normal",
- "fontWeight": "400",
- "src": [
- "file:./assets/fonts/ibm-plex-mono/IBMPlexMono-Regular.woff2"
- ]
- },
- {
- "fontDisplay": "block",
- "fontFamily": "IBM Plex Mono",
- "fontStretch": "normal",
- "fontStyle": "italic",
- "fontWeight": "400",
- "src": [
- "file:./assets/fonts/ibm-plex-mono/IBMPlexMono-Italic.woff2"
- ]
- },
- {
- "fontDisplay": "block",
- "fontFamily": "IBM Plex Mono",
- "fontStretch": "normal",
- "fontStyle": "normal",
- "fontWeight": "700",
- "src": [
- "file:./assets/fonts/ibm-plex-mono/IBMPlexMono-Bold.woff2"
- ]
- }
- ],
- "fontFamily": "'IBM Plex Mono', monospace",
- "name": "IBM Plex Mono",
- "slug": "ibm-plex-mono"
- },
- {
- "fontFace": [
- {
- "fontFamily": "Inter",
- "fontStretch": "normal",
- "fontStyle": "normal",
- "fontWeight": "200 900",
- "src": [
- "file:./assets/fonts/inter/Inter-VariableFont_slnt,wght.ttf"
- ]
- }
- ],
- "fontFamily": "\"Inter\", sans-serif",
- "name": "Inter",
- "slug": "inter"
- },
- {
- "fontFamily": "-apple-system,BlinkMacSystemFont,\"Segoe UI\",Roboto,Oxygen-Sans,Ubuntu,Cantarell,\"Helvetica Neue\",sans-serif",
- "name": "System Font",
- "slug": "system-font"
- },
- {
- "fontFace": [
- {
- "fontFamily": "Source Serif Pro",
- "fontStretch": "normal",
- "fontStyle": "normal",
- "fontWeight": "200 900",
- "src": [
- "file:./assets/fonts/source-serif-pro/SourceSerif4Variable-Roman.ttf.woff2"
- ]
- },
- {
- "fontFamily": "Source Serif Pro",
- "fontStretch": "normal",
- "fontStyle": "italic",
- "fontWeight": "200 900",
- "src": [
- "file:./assets/fonts/source-serif-pro/SourceSerif4Variable-Italic.ttf.woff2"
- ]
- }
- ],
- "fontFamily": "\"Source Serif Pro\", serif",
- "name": "Source Serif Pro",
- "slug": "source-serif-pro"
- }
- ],
- "fontSizes": [
- {
- "fluid": {
- "min": "0.875rem",
- "max": "1rem"
- },
- "size": "1rem",
- "slug": "small"
- },
- {
- "fluid": {
- "min": "1rem",
- "max": "1.125rem"
- },
- "size": "1.125rem",
- "slug": "medium"
- },
- {
- "fluid": {
- "min": "1.75rem",
- "max": "1.875rem"
- },
- "size": "1.75rem",
- "slug": "large"
- },
- {
- "fluid": false,
- "size": "2.25rem",
- "slug": "x-large"
- },
- {
- "fluid": {
- "min": "4rem",
- "max": "10rem"
- },
- "size": "10rem",
- "slug": "xx-large"
- }
- ]
- },
- "useRootPaddingAwareAlignments": true
- },
- "styles": {
- "blocks": {
- "core/navigation": {
- "elements": {
- "link": {
- ":hover": {
- "typography": {
- "textDecoration": "underline"
- }
- },
- ":focus": {
- "typography": {
- "textDecoration": "underline dashed"
- }
- },
- ":active": {
- "typography": {
- "textDecoration": "none"
- }
- },
- "typography": {
- "textDecoration": "none"
- }
- }
- },
- "typography": {
- "fontSize": "var(--wp--preset--font-size--small)"
- }
- },
- "core/post-author": {
- "typography": {
- "fontSize": "var(--wp--preset--font-size--small)"
- }
- },
- "core/post-content": {
- "elements": {
- "link": {
- "color": {
- "text": "var(--wp--preset--color--secondary)"
- }
- }
- }
- },
- "core/post-excerpt": {
- "typography": {
- "fontSize": "var(--wp--preset--font-size--medium)"
- }
- },
- "core/post-date": {
- "typography": {
- "fontSize": "var(--wp--preset--font-size--small)",
- "fontWeight": "400"
- },
- "elements": {
- "link": {
- "typography": {
- "textDecoration": "none"
- },
- ":hover": {
- "typography": {
- "textDecoration": "underline"
- }
- }
- }
- }
- },
- "core/post-terms": {
- "typography": {
- "fontSize": "var(--wp--preset--font-size--small)"
- }
- },
- "core/post-title": {
- "spacing": {
- "margin": {
- "bottom": "1.25rem",
- "top": "1.25rem"
- }
- },
- "typography": {
- "fontWeight": "400"
- },
- "elements": {
- "link": {
- ":hover": {
- "typography": {
- "textDecoration": "underline"
- }
- },
- ":focus": {
- "typography": {
- "textDecoration": "underline dashed"
- }
- },
- ":active": {
- "color": {
- "text": "var(--wp--preset--color--secondary)"
- },
- "typography": {
- "textDecoration": "none"
- }
- },
- "typography": {
- "textDecoration": "none"
- }
- }
- }
- },
- "core/comments-title":{
- "typography": {
- "fontSize": "var(--wp--preset--font-size--large)"
- },
- "spacing": {
- "margin": {
- "bottom": "var(--wp--preset--spacing--40)"
- }
- }
- },
- "core/comment-author-name": {
- "elements": {
- "link": {
- ":hover": {
- "typography": {
- "textDecoration": "underline"
- }
- },
- ":focus": {
- "typography": {
- "textDecoration": "underline dashed"
- }
- },
- ":active": {
- "color": {
- "text": "var(--wp--preset--color--secondary)"
- },
- "typography": {
- "textDecoration": "none"
- }
- },
- "typography": {
- "textDecoration": "none"
- }
- }
- }
- },
- "core/comment-date": {
- "typography": {
- "fontSize": "var(--wp--preset--font-size--small)"
- },
- "elements": {
- "link": {
- ":hover": {
- "typography": {
- "textDecoration": "underline"
- }
- },
- ":focus": {
- "typography": {
- "textDecoration": "underline dashed"
- }
- },
- ":active": {
- "color": {
- "text": "var(--wp--preset--color--secondary)"
- },
- "typography": {
- "textDecoration": "none"
- }
- },
- "typography": {
- "textDecoration": "none"
- }
- }
- }
- },
- "core/comment-edit-link": {
- "typography": {
- "fontSize": "var(--wp--preset--font-size--small)"
- }
- },
- "core/comment-reply-link": {
- "typography": {
- "fontSize": "var(--wp--preset--font-size--small)"
- }
- },
- "core/comments-pagination": {
- "spacing": {
- "margin": {
- "top": "var(--wp--preset--spacing--40)"
- }
- },
- "elements": {
- "link": {
- "typography": {
- "textDecoration": "none"
- }
- }
- }
- },
- "core/pullquote": {
- "border": {
- "style": "solid",
- "width": "1px 0"
- },
- "elements": {
- "cite": {
- "typography": {
- "fontSize": "var(--wp--preset--font-size--small)",
- "fontStyle": "normal",
- "textTransform": "none"
- }
- }
- },
- "typography": {
- "lineHeight": "1.3"
- },
- "spacing": {
- "margin": {
- "bottom": "var(--wp--preset--spacing--40) !important",
- "top": "var(--wp--preset--spacing--40) !important"
- }
- }
- },
- "core/query": {
- "elements": {
- "h2": {
- "typography": {
- "fontSize": "var(--wp--preset--font-size--x-large)"
- }
- }
- }
- },
- "core/query-pagination": {
- "typography": {
- "fontSize": "var(--wp--preset--font-size--small)",
- "fontWeight": "400"
- },
- "elements": {
- "link": {
- "typography": {
- "textDecoration": "none"
- },
- ":hover": {
- "typography": {
- "textDecoration": "underline"
- }
- }
- }
- }
- },
- "core/quote": {
- "border": {
- "left": {
- "color": "inherit",
- "style": "solid",
- "width": "1px"
- }
- },
- "elements": {
- "cite": {
- "typography": {
- "fontSize": "var(--wp--preset--font-size--small)",
- "fontStyle": "normal"
- }
- }
- },
- "spacing": {
- "padding": {
- "left": "var(--wp--preset--spacing--30)",
- "right": "var(--wp--preset--spacing--30)"
- }
- }
- },
- "core/site-title": {
- "elements": {
- "link": {
- ":hover": {
- "typography": {
- "textDecoration": "underline"
- }
- },
- ":focus": {
- "typography": {
- "textDecoration": "underline dashed"
- }
- },
- ":active": {
- "color": {
- "text": "var(--wp--preset--color--secondary)"
- },
- "typography": {
- "textDecoration": "none"
- }
- },
- "typography": {
- "textDecoration": "none"
- }
- }
- },
- "typography": {
- "fontSize": "var(--wp--preset--font-size--medium)",
- "fontWeight": "normal",
- "lineHeight": "1.4"
- }
- },
- "core/separator": {
- "css": " &:not(.is-style-wide):not(.is-style-dots):not(.alignwide):not(.alignfull){width: 100px}"
- }
- },
- "color": {
- "background": "var(--wp--preset--color--base)",
- "text": "var(--wp--preset--color--contrast)"
- },
- "elements": {
- "button": {
- "border": {
- "radius": "0"
- },
- "color": {
- "background": "var(--wp--preset--color--primary)",
- "text": "var(--wp--preset--color--contrast)"
- },
- ":hover": {
- "color": {
- "background": "var(--wp--preset--color--contrast)",
- "text": "var(--wp--preset--color--base)"
- }
- },
- ":focus": {
- "color": {
- "background": "var(--wp--preset--color--contrast)",
- "text": "var(--wp--preset--color--base)"
- }
- },
- ":active": {
- "color": {
- "background": "var(--wp--preset--color--secondary)",
- "text": "var(--wp--preset--color--base)"
- }
- },
- ":visited": {
- "color": {
- "text": "var(--wp--preset--color--contrast)"
- }
- }
- },
- "h1": {
- "typography": {
- "fontSize": "3.625rem",
- "lineHeight": "1.2"
- }
- },
- "h2": {
- "typography": {
- "fontSize": "clamp(2.625rem, calc(2.625rem + ((1vw - 0.48rem) * 8.4135)), 3.25rem)",
- "lineHeight": "1.2"
- }
- },
- "h3": {
- "typography": {
- "fontSize": "var(--wp--preset--font-size--x-large)"
- }
- },
- "h4": {
- "typography": {
- "fontSize": "var(--wp--preset--font-size--large)"
- }
- },
- "h5": {
- "typography": {
- "fontSize": "var(--wp--preset--font-size--medium)",
- "fontWeight": "700",
- "textTransform": "uppercase"
- }
- },
- "h6": {
- "typography": {
- "fontSize": "var(--wp--preset--font-size--medium)",
- "textTransform": "uppercase"
- }
- },
- "heading": {
- "typography": {
- "fontWeight": "400",
- "lineHeight": "1.4"
- }
- },
- "link": {
- "color": {
- "text": "var(--wp--preset--color--contrast)"
- },
- ":hover": {
- "typography": {
- "textDecoration": "none"
- }
- },
- ":focus": {
- "typography": {
- "textDecoration": "underline dashed"
- }
- },
- ":active": {
- "color": {
- "text": "var(--wp--preset--color--secondary)"
- },
- "typography": {
- "textDecoration": "none"
- }
- },
- "typography": {
- "textDecoration": "underline"
- }
- }
- },
- "spacing": {
- "blockGap": "1.5rem",
- "padding": {
- "top": "var(--wp--preset--spacing--40)",
- "right": "var(--wp--preset--spacing--30)",
- "bottom": "var(--wp--preset--spacing--40)",
- "left": "var(--wp--preset--spacing--30)"
- }
- },
- "typography": {
- "fontFamily": "var(--wp--preset--font-family--system-font)",
- "fontSize": "var(--wp--preset--font-size--medium)",
- "lineHeight": "1.6"
- }
- },
- "templateParts": [
- {
- "area": "header",
- "name": "header",
- "title": "Header"
- },
- {
- "area": "footer",
- "name": "footer",
- "title": "Footer"
- },
- {
- "area": "uncategorized",
- "name": "comments",
- "title": "Comments"
- },
- {
- "area": "uncategorized",
- "name": "post-meta",
- "title": "Post Meta"
- }
- ]
-}
From d1e2db5a0c69276839825340dd762a7effbc0812 Mon Sep 17 00:00:00 2001
From: Joe Fusco
Date: Tue, 5 Sep 2023 18:03:04 -0400
Subject: [PATCH 05/13] Ignore globalStylesheet.css
Signed-off-by: Joe Fusco
---
examples/next/block-support/.gitignore | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/examples/next/block-support/.gitignore b/examples/next/block-support/.gitignore
index 0729a3526..c8750c068 100644
--- a/examples/next/block-support/.gitignore
+++ b/examples/next/block-support/.gitignore
@@ -1,2 +1,2 @@
-globalStylesheet.css
possibleTypes.json
+globalStylesheet.css
\ No newline at end of file
From e7c9075f2f11ccd70fd096281bd7a755d68bfbdb Mon Sep 17 00:00:00 2001
From: Joe Fusco
Date: Wed, 6 Sep 2023 10:22:14 -0400
Subject: [PATCH 06/13] Reduce example to just block things
Signed-off-by: Joe Fusco
---
.../block-support/components/Container.js | 12 --
.../components/ContentWrapper.js | 13 --
.../block-support/components/EntryHeader.js | 34 -----
.../block-support/components/FeaturedImage.js | 51 -------
.../next/block-support/components/Footer.js | 18 ---
.../block-support/components/FormatDate.js | 16 ---
.../next/block-support/components/Head.js | 58 --------
.../next/block-support/components/Header.js | 45 ------
.../next/block-support/components/Heading.js | 7 -
.../next/block-support/components/Hero.js | 17 ---
.../next/block-support/components/Main.js | 18 ---
.../components/NavigationMenu.js | 67 ---------
.../next/block-support/components/Post.js | 40 ------
.../next/block-support/components/PostInfo.js | 19 ---
.../components/SkipNavigationLink.js | 16 ---
.../next/block-support/components/index.js | 15 --
.../next/block-support/constants/menus.js | 2 -
.../next/block-support/constants/selectors.js | 1 -
.../fragments/GeneralSettings.js | 8 --
examples/next/block-support/pages/_app.js | 2 +-
examples/next/block-support/pages/example.js | 79 -----------
.../block-support/styles/_breakpoints.scss | 5 -
.../next/block-support/styles/_utilities.scss | 25 ----
.../styles/{_blocks.scss => blocks.scss} | 0
.../styles/components/Container.module.scss | 7 -
.../components/ContentWrapper.module.scss | 134 ------------------
.../styles/components/EntryHeader.module.scss | 65 ---------
.../styles/components/Footer.module.scss | 11 --
.../styles/components/Header.module.scss | 72 ----------
.../styles/components/Hero.module.scss | 26 ----
.../styles/components/Main.module.scss | 4 -
.../components/NavigationMenu.module.scss | 101 -------------
.../NavigationMenuClassesFromWP.module.scss | 25 ----
.../styles/components/Post.module.scss | 16 ---
.../styles/components/PostInfo.module.scss | 3 -
.../components/SkipNavigationLink.module.scss | 9 --
.../next/block-support/styles/global.scss | 7 -
.../block-support/wp-templates/category.js | 106 --------------
.../block-support/wp-templates/front-page.js | 105 +++++++-------
.../next/block-support/wp-templates/index.js | 4 -
.../next/block-support/wp-templates/page.js | 87 ++----------
.../next/block-support/wp-templates/single.js | 78 ++--------
.../next/block-support/wp-templates/tag.js | 106 --------------
43 files changed, 75 insertions(+), 1459 deletions(-)
delete mode 100644 examples/next/block-support/components/Container.js
delete mode 100644 examples/next/block-support/components/ContentWrapper.js
delete mode 100644 examples/next/block-support/components/EntryHeader.js
delete mode 100644 examples/next/block-support/components/FeaturedImage.js
delete mode 100644 examples/next/block-support/components/Footer.js
delete mode 100644 examples/next/block-support/components/FormatDate.js
delete mode 100644 examples/next/block-support/components/Head.js
delete mode 100644 examples/next/block-support/components/Header.js
delete mode 100644 examples/next/block-support/components/Heading.js
delete mode 100644 examples/next/block-support/components/Hero.js
delete mode 100644 examples/next/block-support/components/Main.js
delete mode 100644 examples/next/block-support/components/NavigationMenu.js
delete mode 100644 examples/next/block-support/components/Post.js
delete mode 100644 examples/next/block-support/components/PostInfo.js
delete mode 100644 examples/next/block-support/components/SkipNavigationLink.js
delete mode 100644 examples/next/block-support/components/index.js
delete mode 100644 examples/next/block-support/constants/menus.js
delete mode 100644 examples/next/block-support/constants/selectors.js
delete mode 100644 examples/next/block-support/fragments/GeneralSettings.js
delete mode 100644 examples/next/block-support/pages/example.js
delete mode 100644 examples/next/block-support/styles/_breakpoints.scss
delete mode 100644 examples/next/block-support/styles/_utilities.scss
rename examples/next/block-support/styles/{_blocks.scss => blocks.scss} (100%)
delete mode 100644 examples/next/block-support/styles/components/Container.module.scss
delete mode 100644 examples/next/block-support/styles/components/ContentWrapper.module.scss
delete mode 100644 examples/next/block-support/styles/components/EntryHeader.module.scss
delete mode 100644 examples/next/block-support/styles/components/Footer.module.scss
delete mode 100644 examples/next/block-support/styles/components/Header.module.scss
delete mode 100644 examples/next/block-support/styles/components/Hero.module.scss
delete mode 100644 examples/next/block-support/styles/components/Main.module.scss
delete mode 100644 examples/next/block-support/styles/components/NavigationMenu.module.scss
delete mode 100644 examples/next/block-support/styles/components/NavigationMenuClassesFromWP.module.scss
delete mode 100644 examples/next/block-support/styles/components/Post.module.scss
delete mode 100644 examples/next/block-support/styles/components/PostInfo.module.scss
delete mode 100644 examples/next/block-support/styles/components/SkipNavigationLink.module.scss
delete mode 100644 examples/next/block-support/styles/global.scss
delete mode 100644 examples/next/block-support/wp-templates/category.js
delete mode 100644 examples/next/block-support/wp-templates/tag.js
diff --git a/examples/next/block-support/components/Container.js b/examples/next/block-support/components/Container.js
deleted file mode 100644
index b6634f65b..000000000
--- a/examples/next/block-support/components/Container.js
+++ /dev/null
@@ -1,12 +0,0 @@
-import styles from '../styles/components/Container.module.scss';
-import className from 'classnames/bind';
-
-let cx = className.bind(styles);
-
-export function Container({ children, className }) {
- return (
-
- {children}
-
- );
-}
diff --git a/examples/next/block-support/components/ContentWrapper.js b/examples/next/block-support/components/ContentWrapper.js
deleted file mode 100644
index 75e728af6..000000000
--- a/examples/next/block-support/components/ContentWrapper.js
+++ /dev/null
@@ -1,13 +0,0 @@
-import className from 'classnames/bind';
-import styles from '../styles/components/ContentWrapper.module.scss';
-
-let cx = className.bind(styles);
-
-export function ContentWrapper({ content, children, className }) {
- return (
-
-
- {children}
-
- );
-}
diff --git a/examples/next/block-support/components/EntryHeader.js b/examples/next/block-support/components/EntryHeader.js
deleted file mode 100644
index edfaa2b35..000000000
--- a/examples/next/block-support/components/EntryHeader.js
+++ /dev/null
@@ -1,34 +0,0 @@
-import className from 'classnames/bind';
-import { Heading, PostInfo, Container, FeaturedImage } from '.';
-import styles from '../styles/components/EntryHeader.module.scss';
-
-let cx = className.bind(styles);
-
-export function EntryHeader({ title, image, date, author, className }) {
- const hasText = title || date || author;
-
- return (
-
- {image && (
-
- )}
-
- {hasText && (
-
-
- {!!title && {title}}
-
-
-
- )}
-
- );
-}
diff --git a/examples/next/block-support/components/FeaturedImage.js b/examples/next/block-support/components/FeaturedImage.js
deleted file mode 100644
index a25a027e5..000000000
--- a/examples/next/block-support/components/FeaturedImage.js
+++ /dev/null
@@ -1,51 +0,0 @@
-import { gql } from '@apollo/client';
-import Image from 'next/image';
-
-export function FeaturedImage({
- image,
- width,
- height,
- className,
- priority,
- layout,
- ...props
-}) {
- const src = image?.sourceUrl;
- const { altText } = image || '';
-
- width = width ? width : image?.mediaDetails?.width;
- height = height ? height : image?.mediaDetails?.height;
- layout = layout ?? 'fill';
-
- return src && width && height ? (
-
- ) : null;
-}
-
-FeaturedImage.fragments = {
- entry: gql`
- fragment FeaturedImageFragment on NodeWithFeaturedImage {
- featuredImage {
- node {
- id
- sourceUrl
- altText
- mediaDetails {
- width
- height
- }
- }
- }
- }
- `,
-};
diff --git a/examples/next/block-support/components/Footer.js b/examples/next/block-support/components/Footer.js
deleted file mode 100644
index 905cfe5d6..000000000
--- a/examples/next/block-support/components/Footer.js
+++ /dev/null
@@ -1,18 +0,0 @@
-import classNames from 'classnames/bind';
-import { Container, NavigationMenu } from '.';
-import styles from '../styles/components/Footer.module.scss';
-
-let cx = classNames.bind(styles);
-
-export function Footer({ title, menuItems }) {
- const year = new Date().getFullYear();
-
- return (
-
- );
-}
diff --git a/examples/next/block-support/components/FormatDate.js b/examples/next/block-support/components/FormatDate.js
deleted file mode 100644
index cb6a762fd..000000000
--- a/examples/next/block-support/components/FormatDate.js
+++ /dev/null
@@ -1,16 +0,0 @@
-export function FormatDate({ date }) {
- let formattedDate = new Date(date);
-
- if (isNaN(formattedDate.valueOf())) {
- return null;
- }
-
- const timeformat = {
- year: 'numeric',
- month: 'long',
- day: 'numeric',
- hour12: false
- };
-
- return <>{formattedDate.toLocaleDateString('en-US', timeformat)}>;
-}
diff --git a/examples/next/block-support/components/Head.js b/examples/next/block-support/components/Head.js
deleted file mode 100644
index 39a2b16d7..000000000
--- a/examples/next/block-support/components/Head.js
+++ /dev/null
@@ -1,58 +0,0 @@
-import NextHead from 'next/head';
-
-/**
- * Adds meta tags to a page.
- *
- * @param {Props} props The props object.
- * @param {string} props.title Used for the page title, og:title, twitter:title, etc.
- * @param {string} props.description Used for the meta description, og:description, twitter:description, etc.
- * @param {string} props.imageUrl Used for the og:image and twitter:image. NOTE: Must be an absolute url.
- * @param {string} props.url Used for the og:url and twitter:url.
- *
- * @returns {React.ReactElement} The Head component
- */
-export function Head({ title, description, imageUrl, url }) {
- if (!title && !description && !imageUrl && !url) {
- return null;
- }
-
- return (
- <>
-
-
-
-
- {title && (
- <>
- {title}
-
-
-
- >
- )}
-
- {description && (
- <>
-
-
-
- >
- )}
-
- {imageUrl && (
- <>
-
-
- >
- )}
-
- {url && (
- <>
-
-
- >
- )}
-
- >
- );
-}
diff --git a/examples/next/block-support/components/Header.js b/examples/next/block-support/components/Header.js
deleted file mode 100644
index d9170467c..000000000
--- a/examples/next/block-support/components/Header.js
+++ /dev/null
@@ -1,45 +0,0 @@
-import { useState } from 'react';
-import classNames from 'classnames/bind';
-import Link from 'next/link';
-import { Container, NavigationMenu, SkipNavigationLink } from '.';
-import styles from '../styles/components/Header.module.scss';
-
-let cx = classNames.bind(styles);
-
-export function Header({
- title = 'Headless by WP Engine',
- description,
- menuItems
-}) {
- const [isNavShown, setIsNavShown] = useState(false);
-
- return (
-
-
-
-
-
-
-
{title}
-
- {description &&
{description}
}
-
-
-
-
-
-
- );
-}
diff --git a/examples/next/block-support/components/Heading.js b/examples/next/block-support/components/Heading.js
deleted file mode 100644
index c1a6baabe..000000000
--- a/examples/next/block-support/components/Heading.js
+++ /dev/null
@@ -1,7 +0,0 @@
-import React from 'react';
-
-export function Heading({ level = 'h1', children, className }) {
- const Tag = ({ ...props }) => React.createElement(level, props, children);
-
- return {children};
-}
diff --git a/examples/next/block-support/components/Hero.js b/examples/next/block-support/components/Hero.js
deleted file mode 100644
index 9a0b2c036..000000000
--- a/examples/next/block-support/components/Hero.js
+++ /dev/null
@@ -1,17 +0,0 @@
-import React from 'react';
-import className from 'classnames/bind';
-import { Heading } from '.';
-import styles from '../styles/components/Hero.module.scss';
-
-let cx = className.bind(styles);
-
-export function Hero({ title, level = 'h2', children, className }) {
- return (
-
-
- {title}
-
- {children}
-
- );
-}
diff --git a/examples/next/block-support/components/Main.js b/examples/next/block-support/components/Main.js
deleted file mode 100644
index 049c4eb0f..000000000
--- a/examples/next/block-support/components/Main.js
+++ /dev/null
@@ -1,18 +0,0 @@
-import classNames from 'classnames/bind';
-import * as SELECTORS from '../constants/selectors';
-import styles from '../styles/components/Main.module.scss';
-
-let cx = classNames.bind(styles);
-
-export function Main({ children, className, ...props }) {
- return (
-
- {children}
-
- );
-}
diff --git a/examples/next/block-support/components/NavigationMenu.js b/examples/next/block-support/components/NavigationMenu.js
deleted file mode 100644
index 755c69dca..000000000
--- a/examples/next/block-support/components/NavigationMenu.js
+++ /dev/null
@@ -1,67 +0,0 @@
-import classNames from 'classnames/bind';
-import { gql } from '@apollo/client';
-import Link from 'next/link';
-import styles from '../styles/components/NavigationMenu.module.scss';
-import stylesFromWP from '../styles/components/NavigationMenuClassesFromWP.module.scss';
-
-import { flatListToHierarchical } from '@faustwp/core';
-
-let cx = classNames.bind(styles);
-let cxFromWp = classNames.bind(stylesFromWP);
-
-export function NavigationMenu({ menuItems, className }) {
- if (!menuItems) {
- return null;
- }
-
- // Based on https://www.wpgraphql.com/docs/menus/#hierarchical-data
- const hierarchicalMenuItems = flatListToHierarchical(menuItems);
-
- function renderMenu(items) {
- return (
-
- {items.map((item) => {
- const { id, path, label, children, cssClasses } = item;
-
- // @TODO - Remove guard clause after ghost menu items are no longer appended to array.
- if (!item.hasOwnProperty('__typename')) {
- return null;
- }
-
- return (
- -
- {label ?? ''}
- {children.length ? renderMenu(children) : null}
-
- );
- })}
-
- );
- }
-
- return (
-
- );
-}
-
-NavigationMenu.fragments = {
- entry: gql`
- fragment NavigationMenuItemFragment on MenuItem {
- id
- path
- label
- parentId
- cssClasses
- menu {
- node {
- name
- }
- }
- }
- `,
-};
diff --git a/examples/next/block-support/components/Post.js b/examples/next/block-support/components/Post.js
deleted file mode 100644
index 7da5ab1bc..000000000
--- a/examples/next/block-support/components/Post.js
+++ /dev/null
@@ -1,40 +0,0 @@
-import Link from 'next/link';
-import { FeaturedImage } from './FeaturedImage';
-import { PostInfo } from './PostInfo';
-import styles from '../styles/components/Post.module.scss';
-
-export function Post({
- title,
- content,
- date,
- author,
- uri,
- featuredImage,
-}) {
- return (
-
- {featuredImage && (
-
-
-
-
-
- )}
-
-
-
- {title}
-
-
-
-
-
- );
-}
diff --git a/examples/next/block-support/components/PostInfo.js b/examples/next/block-support/components/PostInfo.js
deleted file mode 100644
index ec731d850..000000000
--- a/examples/next/block-support/components/PostInfo.js
+++ /dev/null
@@ -1,19 +0,0 @@
-import { FormatDate } from '.';
-
-export function PostInfo({ date, author, className }) {
- if (!date && !author) {
- return null;
- }
-
- return (
-
- {date && (
-
- )}
- {date && author && <> >}
- {author && by {author}}
-
- );
-}
diff --git a/examples/next/block-support/components/SkipNavigationLink.js b/examples/next/block-support/components/SkipNavigationLink.js
deleted file mode 100644
index cbb8add11..000000000
--- a/examples/next/block-support/components/SkipNavigationLink.js
+++ /dev/null
@@ -1,16 +0,0 @@
-import classNames from 'classnames/bind';
-import * as SELECTORS from '../constants/selectors';
-import styles from '../styles/components/SkipNavigationLink.module.scss';
-
-let cx = classNames.bind(styles);
-
-export function SkipNavigationLink() {
- return (
-
- Skip To Main Content
-
- );
-}
diff --git a/examples/next/block-support/components/index.js b/examples/next/block-support/components/index.js
deleted file mode 100644
index 835b3a4d3..000000000
--- a/examples/next/block-support/components/index.js
+++ /dev/null
@@ -1,15 +0,0 @@
-export { Container } from './Container';
-export { ContentWrapper } from './ContentWrapper';
-export { EntryHeader } from './EntryHeader';
-export { FeaturedImage } from './FeaturedImage';
-export { Footer } from './Footer';
-export { FormatDate } from './FormatDate';
-export { Header } from './Header';
-export { Heading } from './Heading';
-export { Main } from './Main';
-export { NavigationMenu } from './NavigationMenu';
-export { PostInfo } from './PostInfo';
-export { SkipNavigationLink } from './SkipNavigationLink';
-export { Hero } from './Hero';
-export { Post } from './Post';
-export { Head } from './Head';
diff --git a/examples/next/block-support/constants/menus.js b/examples/next/block-support/constants/menus.js
deleted file mode 100644
index c60ded9df..000000000
--- a/examples/next/block-support/constants/menus.js
+++ /dev/null
@@ -1,2 +0,0 @@
- export const PRIMARY_LOCATION = 'PRIMARY';
- export const FOOTER_LOCATION = 'FOOTER';
diff --git a/examples/next/block-support/constants/selectors.js b/examples/next/block-support/constants/selectors.js
deleted file mode 100644
index 0fef48aaa..000000000
--- a/examples/next/block-support/constants/selectors.js
+++ /dev/null
@@ -1 +0,0 @@
-export const MAIN_CONTENT_ID = 'main-content';
diff --git a/examples/next/block-support/fragments/GeneralSettings.js b/examples/next/block-support/fragments/GeneralSettings.js
deleted file mode 100644
index f478789d3..000000000
--- a/examples/next/block-support/fragments/GeneralSettings.js
+++ /dev/null
@@ -1,8 +0,0 @@
-import { gql } from '@apollo/client';
-
-export const BlogInfoFragment = gql`
- fragment BlogInfoFragment on GeneralSettings {
- title
- description
- }
-`;
diff --git a/examples/next/block-support/pages/_app.js b/examples/next/block-support/pages/_app.js
index f74716706..e427cb2df 100644
--- a/examples/next/block-support/pages/_app.js
+++ b/examples/next/block-support/pages/_app.js
@@ -4,8 +4,8 @@ import { useRouter } from 'next/router';
import { WordPressBlocksProvider, fromThemeJson } from '@faustwp/blocks';
import { FaustProvider } from '@faustwp/core';
import blocks from '../wp-blocks';
+// import '../styles/blocks.scss'; // <-- Import block styles from WordPress.
import '../globalStylesheet.css'; // <-- Generated by @faustwp/cli
-import '../styles/global.scss';
export default function MyApp({ Component, pageProps }) {
const router = useRouter();
diff --git a/examples/next/block-support/pages/example.js b/examples/next/block-support/pages/example.js
deleted file mode 100644
index aa524a8f0..000000000
--- a/examples/next/block-support/pages/example.js
+++ /dev/null
@@ -1,79 +0,0 @@
-import { gql, useQuery } from '@apollo/client';
-import * as MENUS from '../constants/menus';
-import { BlogInfoFragment } from '../fragments/GeneralSettings';
-import {
- Header,
- Hero,
- Footer,
- Main,
- Container,
- NavigationMenu,
- Head,
-} from '../components';
-import { getNextStaticProps } from '@faustwp/core';
-
-export default function Page(props) {
- const { data } = useQuery(Page.query, {
- variables: Page.variables(),
- });
- const title = props.title;
-
- const { title: siteTitle, description: siteDescription } = data?.generalSettings;
- const primaryMenu = data?.headerMenuItems?.nodes ?? [];
- const footerMenu = data?.footerMenuItems?.nodes ?? [];
-
- return (
- <>
-
-
-
-
-
-
-
This page is utilizing the Next.js File based routes.
-
pages/example.js
-
-
-
-
- >
- );
-}
-
-Page.query = gql`
- ${BlogInfoFragment}
- ${NavigationMenu.fragments.entry}
- query GetPageData(
- $headerLocation: MenuLocationEnum
- $footerLocation: MenuLocationEnum
- ) {
- generalSettings {
- ...BlogInfoFragment
- }
- headerMenuItems: menuItems(where: { location: $headerLocation }) {
- nodes {
- ...NavigationMenuItemFragment
- }
- }
- footerMenuItems: menuItems(where: { location: $footerLocation }) {
- nodes {
- ...NavigationMenuItemFragment
- }
- }
- }
-`;
-
-Page.variables = () => {
- return {
- headerLocation: MENUS.PRIMARY_LOCATION,
- footerLocation: MENUS.FOOTER_LOCATION
- };
-};
-
-export function getStaticProps(ctx) {
- return getNextStaticProps(ctx, {Page, props: {title: 'File Page Example'}});
-}
diff --git a/examples/next/block-support/styles/_breakpoints.scss b/examples/next/block-support/styles/_breakpoints.scss
deleted file mode 100644
index 6ffd8fa21..000000000
--- a/examples/next/block-support/styles/_breakpoints.scss
+++ /dev/null
@@ -1,5 +0,0 @@
-// Media query breakpoints
-
-$breakpoint-extra-small: 640px;
-$breakpoint-small: 768px;
-$breakpoint-medium: 1024px;
diff --git a/examples/next/block-support/styles/_utilities.scss b/examples/next/block-support/styles/_utilities.scss
deleted file mode 100644
index 4937136a0..000000000
--- a/examples/next/block-support/styles/_utilities.scss
+++ /dev/null
@@ -1,25 +0,0 @@
-// Utility classes
-
-.text-center {
- text-align: center;
-}
-
-.sr-only {
- position: absolute;
- width: 1px;
- height: 1px;
- padding: 0;
- margin: -1px;
- overflow: hidden;
- clip: rect(0, 0, 0, 0);
- white-space: nowrap;
- border-width: 0;
-
- &:focus {
- width: auto;
- height: auto;
- margin: 0;
- overflow: auto;
- clip: auto;
- }
-}
diff --git a/examples/next/block-support/styles/_blocks.scss b/examples/next/block-support/styles/blocks.scss
similarity index 100%
rename from examples/next/block-support/styles/_blocks.scss
rename to examples/next/block-support/styles/blocks.scss
diff --git a/examples/next/block-support/styles/components/Container.module.scss b/examples/next/block-support/styles/components/Container.module.scss
deleted file mode 100644
index 5303f46e9..000000000
--- a/examples/next/block-support/styles/components/Container.module.scss
+++ /dev/null
@@ -1,7 +0,0 @@
-.component {
- padding-right: var(--wp--style--root--padding-right);
- padding-left: var(--wp--style--root--padding-left);
- margin-right: auto;
- margin-left: auto;
- max-width: var(--wp--style--global--wide-size);
-}
diff --git a/examples/next/block-support/styles/components/ContentWrapper.module.scss b/examples/next/block-support/styles/components/ContentWrapper.module.scss
deleted file mode 100644
index 6b6e949b9..000000000
--- a/examples/next/block-support/styles/components/ContentWrapper.module.scss
+++ /dev/null
@@ -1,134 +0,0 @@
-.component {
- max-width: var(--wp--style--global--content-size);
- margin: 0 auto;
- line-height: 1.6875;
-
- :global {
- // Scope WordPress block styles within ContentWrapper.
- @import 'styles/blocks';
-
- * {
- max-width: 100%;
- }
-
- figure {
- margin-left: 0;
- margin-right: 0;
- }
-
- h1,
- h2,
- h3,
- h4,
- h5,
- h6 {
- margin: 4.8rem 0;
- }
-
- strong {
- font-weight: 700;
- }
-
- a {
- color: var(--wp--preset--color--primary);
- text-decoration: underline;
-
- &:hover,
- &:focus {
- color: var(--wp--preset--color--primary);
- text-decoration: none;
- }
- }
-
- li {
- font-size: 1.6rem;
- }
-
- img {
- display: block;
- height: auto;
- max-width: 100%;
- }
-
- .alignleft {
- display: inline;
- float: left;
- margin-right: 1.5em;
- }
-
- .alignright {
- display: inline;
- float: right;
- margin-left: 1.5em;
- }
-
- .aligncenter {
- clear: both;
- display: block;
- margin-left: auto;
- margin-right: auto;
- }
-
- code,
- pre {
- color: var(--color-white);
- background: var(--color-black);
- }
-
- code {
- padding: 0.25rem 0.5rem;
- }
-
- pre {
- max-width: 100%;
- overflow: auto;
- padding: 1rem;
- }
-
- blockquote {
- border-top: 1px solid var(--color-black);
- border-bottom: 1px solid var(--color-black);
- font-style: italic;
- margin-top: 0;
- margin-left: 0;
- margin-right: 0;
- padding: 4rem 1rem 4rem;
- text-align: center;
-
- &::before {
- content: '”';
- display: block;
- font-size: 6rem;
- line-height: 0;
- margin: 2rem 0;
- }
-
- > *:last-child {
- margin-bottom: 0;
- }
- }
-
- table {
- border-collapse: collapse;
- width: 100%;
- }
-
- thead th {
- border-bottom: 1px solid var(--wpe--color--border);
- padding-bottom: 0.5em;
- }
-
- th {
- padding: 0.4rem 0;
- text-align: left;
- }
-
- tr {
- border-bottom: 1px solid var(--wpe--color--border);
- }
-
- td {
- padding: 0.4em;
- }
- }
-}
diff --git a/examples/next/block-support/styles/components/EntryHeader.module.scss b/examples/next/block-support/styles/components/EntryHeader.module.scss
deleted file mode 100644
index fa8e22401..000000000
--- a/examples/next/block-support/styles/components/EntryHeader.module.scss
+++ /dev/null
@@ -1,65 +0,0 @@
-@import 'styles/breakpoints';
-
-.component {
- color: var(--wp--preset--color--base);
- position: relative;
- overflow: hidden;
- margin-bottom: 2rem;
-
- @media (min-width: $breakpoint-small) {
- margin-bottom: 5rem;
- }
-}
-
-.has-image .title {
- color: var(--wp--preset--color--base);
-}
-
-.text,
-.image {
- margin: auto;
- text-align: center;
-}
-
-.text {
- width: 100%;
- max-width: 72rem;
- padding: 8.25rem 0;
- position: relative;
- z-index: 1; // Pull text to the foreground to sit above .
-}
-
-.title {
- line-height: 1.25;
- font-size: 5rem;
- color: var(--wp--preset--color--contrast);
-
- @media (max-width: $breakpoint-small) {
- font-size: 3rem;
- }
-}
-
-.byline {
- font-size: 1.2rem;
- color: var(--wp--preset--color--contrast);
-}
-
-.image {
- margin: 0;
- position: absolute;
- top: 0;
- left: 0;
- width: 100vw;
- height: 100vh;
- z-index: 0;
-
- &::after {
- content: '';
- top: 0;
- left: 0;
- height: 100%;
- width: 100%;
- background-color: rgba(0, 0, 0, 0.6);
- position: absolute;
- }
-}
diff --git a/examples/next/block-support/styles/components/Footer.module.scss b/examples/next/block-support/styles/components/Footer.module.scss
deleted file mode 100644
index d99eeaffa..000000000
--- a/examples/next/block-support/styles/components/Footer.module.scss
+++ /dev/null
@@ -1,11 +0,0 @@
-.component {
- color: var(--wp--preset--color--contrast);
- background: var(--wp--preset--color--base);
- padding-top: var(--wp--style--root--padding-top);
- padding-bottom: var(--wp--style--root--padding-bottom);
-}
-
-.copyright {
- margin: 2rem 0;
- text-align: center;
-}
diff --git a/examples/next/block-support/styles/components/Header.module.scss b/examples/next/block-support/styles/components/Header.module.scss
deleted file mode 100644
index 6073f4ce1..000000000
--- a/examples/next/block-support/styles/components/Header.module.scss
+++ /dev/null
@@ -1,72 +0,0 @@
-@import 'styles/breakpoints';
-
-.component {
- color: var(--wp--preset--color--contrast);
- background-color: var(--wp--preset--color--base);
- position: relative;
- z-index: 2; // Pull dropdown menus to the foreground to sit above .
-}
-
-.navbar {
- display: flex;
- justify-content: space-between;
- flex-wrap: wrap;
- padding: 3rem 0;
- gap: 1rem;
-}
-
-.brand {
- font-weight: var(--wpe--font-weight--bold);
- font-size: 1.6rem;
- display: flex;
- flex-direction: column;
- justify-content: center;
-}
-
-.title {
- text-decoration: none;
-}
-
-.description {
- margin: .3rem 0 0 0;
- font-size: 0.8rem;
- opacity: 0.9;
-}
-
-.nav-toggle {
- align-items: center;
- background-color: transparent;
- border: 0.1rem solid var(--wp--preset--color--base);
- color: var(--wp--preset--color--contrast);
- cursor: pointer;
- display: flex;
- margin: 0;
- padding: 0.5rem 1rem;
- transition: all 0.2s ease-in;
- user-select: none;
- font-size: 2rem;
-
- &:hover,
- &:focus {
- background-color: var(--wp--preset--color--base);
- color: var(--wp--preset--color--contrast);
- }
-
- @media (min-width: $breakpoint-small) {
- display: none !important;
- }
-}
-
-.primary-navigation {
- display: none;
- width: 100%;
-
- &.show {
- display: block;
- }
-
- @media (min-width: $breakpoint-small) {
- display: block;
- width: auto;
- }
-}
diff --git a/examples/next/block-support/styles/components/Hero.module.scss b/examples/next/block-support/styles/components/Hero.module.scss
deleted file mode 100644
index e314018b7..000000000
--- a/examples/next/block-support/styles/components/Hero.module.scss
+++ /dev/null
@@ -1,26 +0,0 @@
-@import "styles/breakpoints";
-
-.component {
- text-align: center;
- padding: 6rem 1rem;
- line-height: 1.3;
- margin: 0 auto;
- max-width: var(--wp--style--global--wide-size);
- position: relative;
-}
-
-.title {
- display: block;
- font-size: 5rem;
- z-index: 1;
- position: relative;
-
- @media (max-width: $breakpoint-small) {
- font-size: 3rem;
- }
-}
-
-.subtitle {
- display: block;
- font-size: 3rem;
-}
diff --git a/examples/next/block-support/styles/components/Main.module.scss b/examples/next/block-support/styles/components/Main.module.scss
deleted file mode 100644
index 3e9fd3cd9..000000000
--- a/examples/next/block-support/styles/components/Main.module.scss
+++ /dev/null
@@ -1,4 +0,0 @@
-.component {
- color: var(--wp--preset--color--contrast);
- background-color: var(--wp--preset--color--base);
-}
diff --git a/examples/next/block-support/styles/components/NavigationMenu.module.scss b/examples/next/block-support/styles/components/NavigationMenu.module.scss
deleted file mode 100644
index ae21c3803..000000000
--- a/examples/next/block-support/styles/components/NavigationMenu.module.scss
+++ /dev/null
@@ -1,101 +0,0 @@
-@import 'styles/breakpoints';
-
-%visible {
- visibility: visible;
- opacity: 1;
-}
-
-%hidden {
- // Always visible for smaller viewports.
- @media (min-width: $breakpoint-small) {
- visibility: hidden;
- opacity: 0;
- }
-}
-
-.component {
- background-color: transparent;
-}
-
-.menu {
- list-style-type: none;
- display: flex;
- flex-wrap: wrap;
- justify-content: center;
- padding: 0;
- margin: 0;
- position: relative;
- gap: 0.5rem;
-
- li {
- display: flex;
- align-items: center;
- position: relative;
- width: 100%;
- flex-direction: column;
-
- @media (min-width: $breakpoint-small) {
- width: auto;
- flex-direction: row;
- }
-
- &:focus-within ul,
- a:hover + ul,
- a:focus + ul {
- @extend %visible;
- }
- }
-
- a {
- color: var(--wp--preset--color--contrast);
- padding: 0.5rem;
- display: block;
- transition: all 0.2s ease-out;
- width: 100%;
- white-space: nowrap;
- text-align: center;
-
- &:hover,
- &:focus {
- color: var(--wp--preset--color--primary);
- }
-
- // Remove link underline when component is inside header.
- header & {
- text-decoration: none;
- }
- }
-
- li ul {
- @extend %hidden;
- background-color: var(--wp--preset--color--base);
- display: flex;
- flex-direction: column;
- gap: 0;
- width: 100%;
-
- @media (min-width: $breakpoint-small) {
- position: absolute;
- left: -10px;
- top: 100%;
- text-align: left;
- box-shadow: var(--wp--preset--shadow--natural);
- padding: 1rem;
- border-radius: 8px;
- transition: all 0.2s ease-out;
- width: inherit;
- border: var(--wp--preset--color--tertiary);
- }
-
- &:hover {
- @extend %visible;
- }
-
- li + li {
- @media (min-width: $breakpoint-small) {
- border-top: var(--wp--preset--color--tertiary);
- margin-top: 3px; // Make room for default browser focus styles.
- }
- }
- }
-}
diff --git a/examples/next/block-support/styles/components/NavigationMenuClassesFromWP.module.scss b/examples/next/block-support/styles/components/NavigationMenuClassesFromWP.module.scss
deleted file mode 100644
index e24d400ad..000000000
--- a/examples/next/block-support/styles/components/NavigationMenuClassesFromWP.module.scss
+++ /dev/null
@@ -1,25 +0,0 @@
-// Classes in this file can be optionally added to menu items from within WordPress.
-// Appearance --> Menus --> Screen Options --> CSS Classes
-
-@import 'styles/breakpoints';
-
-.button {
- a {
- @media (min-width: $breakpoint-small) {
- background-color: var(--wp--preset--color--primary);
- border-radius: 100px;
- border: var(--wp--preset--color--tertiary);
- color: var(--wp--preset--color--base);
- font-size: 92%;
- padding: 0.5rem 1rem;
- text-decoration: none;
- white-space: nowrap;
-
- &:hover,
- &:focus {
- background-color: var(--wp--preset--color--secondary);
- color: var(--wp--preset--color--base);
- }
- }
- }
-}
diff --git a/examples/next/block-support/styles/components/Post.module.scss b/examples/next/block-support/styles/components/Post.module.scss
deleted file mode 100644
index c3ef4f13f..000000000
--- a/examples/next/block-support/styles/components/Post.module.scss
+++ /dev/null
@@ -1,16 +0,0 @@
-.component {
- padding-bottom: 4rem;
-}
-
-.title {
- margin-bottom: 0.5rem;
-}
-
-.postInfo {
- margin-bottom: 1.5rem;
-}
-
-.featuredImage {
- margin: 0;
- margin-bottom: 1rem;
-}
diff --git a/examples/next/block-support/styles/components/PostInfo.module.scss b/examples/next/block-support/styles/components/PostInfo.module.scss
deleted file mode 100644
index f0a5bf15b..000000000
--- a/examples/next/block-support/styles/components/PostInfo.module.scss
+++ /dev/null
@@ -1,3 +0,0 @@
-.component {
- color: red;
-}
diff --git a/examples/next/block-support/styles/components/SkipNavigationLink.module.scss b/examples/next/block-support/styles/components/SkipNavigationLink.module.scss
deleted file mode 100644
index c19a0f6ef..000000000
--- a/examples/next/block-support/styles/components/SkipNavigationLink.module.scss
+++ /dev/null
@@ -1,9 +0,0 @@
-// Skip link specific styles. Intentionally separate from this theme's sr-only class.
-.component {
- color: var(--wp--preset--color--base);
- background-color: var(--wp--preset--color--contrast);
- padding: 0.5rem 0.8rem !important;
- position: relative;
- margin: 0.5rem !important;
- z-index: 1;
-}
diff --git a/examples/next/block-support/styles/global.scss b/examples/next/block-support/styles/global.scss
deleted file mode 100644
index e4186cfab..000000000
--- a/examples/next/block-support/styles/global.scss
+++ /dev/null
@@ -1,7 +0,0 @@
-// Global styles
-// These styles are available on all pages.
-// If a component has it's own styles, they can be found in ./components.
-
-@import 'breakpoints';
-@import 'blocks';
-@import 'utilities';
diff --git a/examples/next/block-support/wp-templates/category.js b/examples/next/block-support/wp-templates/category.js
deleted file mode 100644
index ccab765d2..000000000
--- a/examples/next/block-support/wp-templates/category.js
+++ /dev/null
@@ -1,106 +0,0 @@
-import { gql } from '@apollo/client';
-import * as MENUS from '../constants/menus';
-import { BlogInfoFragment } from '../fragments/GeneralSettings';
-import {
- Header,
- Footer,
- Main,
- Container,
- EntryHeader,
- NavigationMenu,
- Post,
- FeaturedImage,
- Head,
-} from '../components';
-
-export default function Component(props) {
- const { title: siteTitle, description: siteDescription } =
- props?.data?.generalSettings;
- const primaryMenu = props?.data?.headerMenuItems?.nodes ?? [];
- const footerMenu = props?.data?.footerMenuItems?.nodes ?? [];
- const { name, posts } = props.data.nodeByUri;
-
- return (
- <>
-
-
-
- <>
-
-
- {posts.edges.map((post) => (
-
- ))}
-
- >
-
-
- >
- );
-}
-
-Component.query = gql`
- ${BlogInfoFragment}
- ${NavigationMenu.fragments.entry}
- ${FeaturedImage.fragments.entry}
- query GetCategoryPage(
- $uri: String!
- $headerLocation: MenuLocationEnum
- $footerLocation: MenuLocationEnum
- ) {
- nodeByUri(uri: $uri) {
- ... on Category {
- name
- posts {
- edges {
- node {
- id
- title
- content
- date
- uri
- ...FeaturedImageFragment
- author {
- node {
- name
- }
- }
- }
- }
- }
- }
- }
- generalSettings {
- ...BlogInfoFragment
- }
- headerMenuItems: menuItems(where: { location: $headerLocation }) {
- nodes {
- ...NavigationMenuItemFragment
- }
- }
- footerMenuItems: menuItems(where: { location: $footerLocation }) {
- nodes {
- ...NavigationMenuItemFragment
- }
- }
- }
-`;
-
-Component.variables = ({ uri }) => {
- return {
- uri,
- headerLocation: MENUS.PRIMARY_LOCATION,
- footerLocation: MENUS.FOOTER_LOCATION,
- };
-};
diff --git a/examples/next/block-support/wp-templates/front-page.js b/examples/next/block-support/wp-templates/front-page.js
index 9acd70140..4d036ae2f 100644
--- a/examples/next/block-support/wp-templates/front-page.js
+++ b/examples/next/block-support/wp-templates/front-page.js
@@ -1,74 +1,69 @@
-import { useQuery, gql } from '@apollo/client';
-import * as MENUS from '../constants/menus';
-import { BlogInfoFragment } from '../fragments/GeneralSettings';
-import {
- Header,
- Footer,
- Main,
- Container,
- NavigationMenu,
- Hero,
- Head,
-} from '../components';
+import { gql } from '@apollo/client';
+import { flatListToHierarchical } from '@faustwp/core';
+import { WordPressBlocksViewer } from '@faustwp/blocks';
+import blocks from '../wp-blocks';
-export default function Component() {
- const { data } = useQuery(Component.query, {
- variables: Component.variables(),
- });
+export default function Component({ loading, data }) {
+ // Loading state for previews.
+ if (loading) {
+ return <>Loading...>;
+ }
- const { title: siteTitle, description: siteDescription } =
- data?.generalSettings;
- const primaryMenu = data?.headerMenuItems?.nodes ?? [];
- const footerMenu = data?.footerMenuItems?.nodes ?? [];
+ const { title, editorBlocks } = data?.post ?? { title: '' };
+ const blockList = flatListToHierarchical(editorBlocks, { childrenKey: 'innerBlocks' });
return (
<>
-
-
-
-
-
-
-
This page is utilizing the "front-page" WordPress template.
-
wp-templates/front-page.js
-
-
-
-
+ {title}
+
>
);
}
Component.query = gql`
- ${BlogInfoFragment}
- ${NavigationMenu.fragments.entry}
- query GetPageData(
- $headerLocation: MenuLocationEnum
- $footerLocation: MenuLocationEnum
+ ${blocks.CoreParagraph.fragments.entry}
+ ${blocks.CoreColumns.fragments.entry}
+ ${blocks.CoreColumn.fragments.entry}
+ ${blocks.CoreCode.fragments.entry}
+ ${blocks.CoreButtons.fragments.entry}
+ ${blocks.CoreButton.fragments.entry}
+ ${blocks.CoreQuote.fragments.entry}
+ ${blocks.CoreImage.fragments.entry}
+ ${blocks.CoreSeparator.fragments.entry}
+ ${blocks.CoreList.fragments.entry}
+ ${blocks.CoreHeading.fragments.entry}
+ query GetPage(
+ $databaseId: ID!
+ $asPreview: Boolean = false
) {
- generalSettings {
- ...BlogInfoFragment
- }
- headerMenuItems: menuItems(where: { location: $headerLocation }) {
- nodes {
- ...NavigationMenuItemFragment
- }
- }
- footerMenuItems: menuItems(where: { location: $footerLocation }) {
- nodes {
- ...NavigationMenuItemFragment
+ page(id: $databaseId, idType: DATABASE_ID, asPreview: $asPreview) {
+ title
+ content
+ editorBlocks(flat: false) {
+ name
+ __typename
+ renderedHtml
+ id: clientId
+ parentId: parentClientId
+ ...${blocks.CoreParagraph.fragments.key}
+ ...${blocks.CoreColumns.fragments.key}
+ ...${blocks.CoreColumn.fragments.key}
+ ...${blocks.CoreCode.fragments.key}
+ ...${blocks.CoreButtons.fragments.key}
+ ...${blocks.CoreButton.fragments.key}
+ ...${blocks.CoreQuote.fragments.key}
+ ...${blocks.CoreImage.fragments.key}
+ ...${blocks.CoreSeparator.fragments.key}
+ ...${blocks.CoreList.fragments.key}
+ ...${blocks.CoreHeading.fragments.key}
}
}
}
`;
-Component.variables = () => {
+Component.variables = ({ databaseId }, ctx) => {
return {
- headerLocation: MENUS.PRIMARY_LOCATION,
- footerLocation: MENUS.FOOTER_LOCATION,
+ databaseId,
+ asPreview: ctx?.asPreview,
};
};
diff --git a/examples/next/block-support/wp-templates/index.js b/examples/next/block-support/wp-templates/index.js
index 3cabd3e14..e2ffcbbf0 100644
--- a/examples/next/block-support/wp-templates/index.js
+++ b/examples/next/block-support/wp-templates/index.js
@@ -1,12 +1,8 @@
-import category from './category';
-import tag from './tag';
import frontPage from './front-page';
import page from './page';
import single from './single';
export default {
- category,
- tag,
'front-page': frontPage,
page,
single,
diff --git a/examples/next/block-support/wp-templates/page.js b/examples/next/block-support/wp-templates/page.js
index 539eadc99..4d036ae2f 100644
--- a/examples/next/block-support/wp-templates/page.js
+++ b/examples/next/block-support/wp-templates/page.js
@@ -1,74 +1,26 @@
import { gql } from '@apollo/client';
import { flatListToHierarchical } from '@faustwp/core';
import { WordPressBlocksViewer } from '@faustwp/blocks';
-import * as MENUS from '../constants/menus';
-import { BlogInfoFragment } from '../fragments/GeneralSettings';
import blocks from '../wp-blocks';
-import {
- Container,
- ContentWrapper,
- EntryHeader,
- FeaturedImage,
- Footer,
- Header,
- Main,
- NavigationMenu,
- Head,
-} from '../components';
-export default function Component(props) {
- // Loading state for previews
- if (props.loading) {
+export default function Component({ loading, data }) {
+ // Loading state for previews.
+ if (loading) {
return <>Loading...>;
}
- const { title: siteTitle, description: siteDescription } =
- props?.data?.generalSettings;
- const primaryMenu = props?.data?.headerMenuItems?.nodes ?? [];
- const footerMenu = props?.data?.footerMenuItems?.nodes ?? [];
- const { title, editorBlocks, featuredImage } = props?.data?.page ?? { title: '' };
- const blocks = flatListToHierarchical(editorBlocks, {childrenKey: 'innerBlocks'});
+ const { title, editorBlocks } = data?.post ?? { title: '' };
+ const blockList = flatListToHierarchical(editorBlocks, { childrenKey: 'innerBlocks' });
return (
<>
-
-
-
- <>
-
-
-
-
-
-
- >
-
-
+ {title}
+
>
);
}
-Component.variables = ({ databaseId }, ctx) => {
- return {
- databaseId,
- headerLocation: MENUS.PRIMARY_LOCATION,
- footerLocation: MENUS.FOOTER_LOCATION,
- asPreview: ctx?.asPreview,
- };
-};
-
Component.query = gql`
- ${BlogInfoFragment}
- ${NavigationMenu.fragments.entry}
- ${FeaturedImage.fragments.entry}
${blocks.CoreParagraph.fragments.entry}
${blocks.CoreColumns.fragments.entry}
${blocks.CoreColumn.fragments.entry}
@@ -80,10 +32,8 @@ Component.query = gql`
${blocks.CoreSeparator.fragments.entry}
${blocks.CoreList.fragments.entry}
${blocks.CoreHeading.fragments.entry}
- query GetPageData(
+ query GetPage(
$databaseId: ID!
- $headerLocation: MenuLocationEnum
- $footerLocation: MenuLocationEnum
$asPreview: Boolean = false
) {
page(id: $databaseId, idType: DATABASE_ID, asPreview: $asPreview) {
@@ -107,20 +57,13 @@ Component.query = gql`
...${blocks.CoreList.fragments.key}
...${blocks.CoreHeading.fragments.key}
}
- ...FeaturedImageFragment
- }
- generalSettings {
- ...BlogInfoFragment
- }
- footerMenuItems: menuItems(where: { location: $footerLocation }) {
- nodes {
- ...NavigationMenuItemFragment
- }
- }
- headerMenuItems: menuItems(where: { location: $headerLocation }) {
- nodes {
- ...NavigationMenuItemFragment
- }
}
}
`;
+
+Component.variables = ({ databaseId }, ctx) => {
+ return {
+ databaseId,
+ asPreview: ctx?.asPreview,
+ };
+};
diff --git a/examples/next/block-support/wp-templates/single.js b/examples/next/block-support/wp-templates/single.js
index 6bf921e71..66268a285 100644
--- a/examples/next/block-support/wp-templates/single.js
+++ b/examples/next/block-support/wp-templates/single.js
@@ -1,70 +1,28 @@
import { gql } from '@apollo/client';
import { flatListToHierarchical } from '@faustwp/core';
import { WordPressBlocksViewer } from '@faustwp/blocks';
-import * as MENUS from '../constants/menus';
-import { BlogInfoFragment } from '../fragments/GeneralSettings';
import blocks from '../wp-blocks';
-import {
- Container,
- ContentWrapper,
- EntryHeader,
- FeaturedImage,
- Footer,
- Header,
- Main,
- NavigationMenu,
- Head,
-} from '../components';
-export default function Component(props) {
- // Loading state for previews
- if (props.loading) {
+export default function Component({ loading, data }) {
+ // Loading state for previews.
+ if (loading) {
return <>Loading...>;
}
- const { title: siteTitle, description: siteDescription } =
- props?.data?.generalSettings;
- const primaryMenu = props?.data?.headerMenuItems?.nodes ?? [];
- const footerMenu = props?.data?.footerMenuItems?.nodes ?? [];
- const { title, featuredImage, date, author, editorBlocks } = props?.data?.post ?? { title: '' };
- const blockList = flatListToHierarchical(editorBlocks, {childrenKey: 'innerBlocks'});
+ const { title, date, author, editorBlocks } = data?.post ?? { title: '' };
+ const blockList = flatListToHierarchical(editorBlocks, { childrenKey: 'innerBlocks' });
return (
<>
-
-
-
- <>
-
-
-
-
-
-
- >
-
-
+ {title}
+ Author: {author?.node?.name}
+
+
>
);
}
Component.query = gql`
- ${BlogInfoFragment}
- ${NavigationMenu.fragments.entry}
- ${FeaturedImage.fragments.entry}
${blocks.CoreParagraph.fragments.entry}
${blocks.CoreColumns.fragments.entry}
${blocks.CoreColumn.fragments.entry}
@@ -78,8 +36,6 @@ Component.query = gql`
${blocks.CoreHeading.fragments.entry}
query GetPost(
$databaseId: ID!
- $headerLocation: MenuLocationEnum
- $footerLocation: MenuLocationEnum
$asPreview: Boolean = false
) {
post(id: $databaseId, idType: DATABASE_ID, asPreview: $asPreview) {
@@ -109,20 +65,6 @@ Component.query = gql`
...${blocks.CoreList.fragments.key}
...${blocks.CoreHeading.fragments.key}
}
- ...FeaturedImageFragment
- }
- generalSettings {
- ...BlogInfoFragment
- }
- headerMenuItems: menuItems(where: { location: $headerLocation }) {
- nodes {
- ...NavigationMenuItemFragment
- }
- }
- footerMenuItems: menuItems(where: { location: $footerLocation }) {
- nodes {
- ...NavigationMenuItemFragment
- }
}
}
`;
@@ -130,8 +72,6 @@ Component.query = gql`
Component.variables = ({ databaseId }, ctx) => {
return {
databaseId,
- headerLocation: MENUS.PRIMARY_LOCATION,
- footerLocation: MENUS.FOOTER_LOCATION,
asPreview: ctx?.asPreview,
};
};
diff --git a/examples/next/block-support/wp-templates/tag.js b/examples/next/block-support/wp-templates/tag.js
deleted file mode 100644
index adc37933c..000000000
--- a/examples/next/block-support/wp-templates/tag.js
+++ /dev/null
@@ -1,106 +0,0 @@
-import { gql } from '@apollo/client';
-import * as MENUS from '../constants/menus';
-import { BlogInfoFragment } from '../fragments/GeneralSettings';
-import {
- Header,
- Footer,
- Main,
- Container,
- EntryHeader,
- NavigationMenu,
- FeaturedImage,
- Post,
- Head,
-} from '../components';
-
-export default function Component(props) {
- const { title: siteTitle, description: siteDescription } =
- props?.data?.generalSettings;
- const primaryMenu = props?.data?.headerMenuItems?.nodes ?? [];
- const footerMenu = props?.data?.footerMenuItems?.nodes ?? [];
- const { name, posts } = props.data.nodeByUri;
-
- return (
- <>
-
-
-
- <>
-
-
- {posts.edges.map((post) => (
-
- ))}
-
- >
-
-
- >
- );
-}
-
-Component.query = gql`
- ${BlogInfoFragment}
- ${NavigationMenu.fragments.entry}
- ${FeaturedImage.fragments.entry}
- query GetTagPage(
- $uri: String!
- $headerLocation: MenuLocationEnum
- $footerLocation: MenuLocationEnum
- ) {
- nodeByUri(uri: $uri) {
- ... on Tag {
- name
- posts {
- edges {
- node {
- id
- title
- content
- date
- uri
- ...FeaturedImageFragment
- author {
- node {
- name
- }
- }
- }
- }
- }
- }
- }
- generalSettings {
- ...BlogInfoFragment
- }
- headerMenuItems: menuItems(where: { location: $headerLocation }) {
- nodes {
- ...NavigationMenuItemFragment
- }
- }
- footerMenuItems: menuItems(where: { location: $footerLocation }) {
- nodes {
- ...NavigationMenuItemFragment
- }
- }
- }
-`;
-
-Component.variables = ({ uri }) => {
- return {
- uri,
- headerLocation: MENUS.PRIMARY_LOCATION,
- footerLocation: MENUS.FOOTER_LOCATION,
- };
-};
From 929f37a87e9a26c1ef013e4ce5a68d57a15b8274 Mon Sep 17 00:00:00 2001
From: Joe Fusco
Date: Wed, 6 Sep 2023 11:42:09 -0400
Subject: [PATCH 07/13] Add newline to EOF
Signed-off-by: Joe Fusco
---
examples/next/block-support/.gitignore | 2 +-
examples/next/block-support/wp-blocks/index.js | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/examples/next/block-support/.gitignore b/examples/next/block-support/.gitignore
index c8750c068..52236bdd5 100644
--- a/examples/next/block-support/.gitignore
+++ b/examples/next/block-support/.gitignore
@@ -1,2 +1,2 @@
possibleTypes.json
-globalStylesheet.css
\ No newline at end of file
+globalStylesheet.css
diff --git a/examples/next/block-support/wp-blocks/index.js b/examples/next/block-support/wp-blocks/index.js
index 729ab1795..7219764ea 100644
--- a/examples/next/block-support/wp-blocks/index.js
+++ b/examples/next/block-support/wp-blocks/index.js
@@ -12,4 +12,4 @@ export default {
CoreButton: CoreBlocks.CoreButton,
CoreButtons: CoreBlocks.CoreButtons,
CoreHeading: CoreBlocks.CoreHeading,
-};
\ No newline at end of file
+};
From 1bc1645b8852983cf33b3a8217a66869a3a36ecc Mon Sep 17 00:00:00 2001
From: Joe Fusco
Date: Wed, 6 Sep 2023 14:04:47 -0400
Subject: [PATCH 08/13] Reduce example
Signed-off-by: Joe Fusco
---
.../block-support/wp-templates/front-page.js | 4 +-
.../next/block-support/wp-templates/index.js | 4 -
.../next/block-support/wp-templates/page.js | 69 -----------------
.../next/block-support/wp-templates/single.js | 77 -------------------
4 files changed, 2 insertions(+), 152 deletions(-)
delete mode 100644 examples/next/block-support/wp-templates/page.js
delete mode 100644 examples/next/block-support/wp-templates/single.js
diff --git a/examples/next/block-support/wp-templates/front-page.js b/examples/next/block-support/wp-templates/front-page.js
index 4d036ae2f..8f388bf65 100644
--- a/examples/next/block-support/wp-templates/front-page.js
+++ b/examples/next/block-support/wp-templates/front-page.js
@@ -9,13 +9,13 @@ export default function Component({ loading, data }) {
return <>Loading...>;
}
- const { title, editorBlocks } = data?.post ?? { title: '' };
+ const { title, editorBlocks } = data?.page ?? { title: '' };
const blockList = flatListToHierarchical(editorBlocks, { childrenKey: 'innerBlocks' });
return (
<>
{title}
-
+
>
);
}
diff --git a/examples/next/block-support/wp-templates/index.js b/examples/next/block-support/wp-templates/index.js
index e2ffcbbf0..091c6443d 100644
--- a/examples/next/block-support/wp-templates/index.js
+++ b/examples/next/block-support/wp-templates/index.js
@@ -1,9 +1,5 @@
import frontPage from './front-page';
-import page from './page';
-import single from './single';
export default {
'front-page': frontPage,
- page,
- single,
};
diff --git a/examples/next/block-support/wp-templates/page.js b/examples/next/block-support/wp-templates/page.js
deleted file mode 100644
index 4d036ae2f..000000000
--- a/examples/next/block-support/wp-templates/page.js
+++ /dev/null
@@ -1,69 +0,0 @@
-import { gql } from '@apollo/client';
-import { flatListToHierarchical } from '@faustwp/core';
-import { WordPressBlocksViewer } from '@faustwp/blocks';
-import blocks from '../wp-blocks';
-
-export default function Component({ loading, data }) {
- // Loading state for previews.
- if (loading) {
- return <>Loading...>;
- }
-
- const { title, editorBlocks } = data?.post ?? { title: '' };
- const blockList = flatListToHierarchical(editorBlocks, { childrenKey: 'innerBlocks' });
-
- return (
- <>
- {title}
-
- >
- );
-}
-
-Component.query = gql`
- ${blocks.CoreParagraph.fragments.entry}
- ${blocks.CoreColumns.fragments.entry}
- ${blocks.CoreColumn.fragments.entry}
- ${blocks.CoreCode.fragments.entry}
- ${blocks.CoreButtons.fragments.entry}
- ${blocks.CoreButton.fragments.entry}
- ${blocks.CoreQuote.fragments.entry}
- ${blocks.CoreImage.fragments.entry}
- ${blocks.CoreSeparator.fragments.entry}
- ${blocks.CoreList.fragments.entry}
- ${blocks.CoreHeading.fragments.entry}
- query GetPage(
- $databaseId: ID!
- $asPreview: Boolean = false
- ) {
- page(id: $databaseId, idType: DATABASE_ID, asPreview: $asPreview) {
- title
- content
- editorBlocks(flat: false) {
- name
- __typename
- renderedHtml
- id: clientId
- parentId: parentClientId
- ...${blocks.CoreParagraph.fragments.key}
- ...${blocks.CoreColumns.fragments.key}
- ...${blocks.CoreColumn.fragments.key}
- ...${blocks.CoreCode.fragments.key}
- ...${blocks.CoreButtons.fragments.key}
- ...${blocks.CoreButton.fragments.key}
- ...${blocks.CoreQuote.fragments.key}
- ...${blocks.CoreImage.fragments.key}
- ...${blocks.CoreSeparator.fragments.key}
- ...${blocks.CoreList.fragments.key}
- ...${blocks.CoreHeading.fragments.key}
- }
- }
- }
-`;
-
-Component.variables = ({ databaseId }, ctx) => {
- return {
- databaseId,
- asPreview: ctx?.asPreview,
- };
-};
diff --git a/examples/next/block-support/wp-templates/single.js b/examples/next/block-support/wp-templates/single.js
deleted file mode 100644
index 66268a285..000000000
--- a/examples/next/block-support/wp-templates/single.js
+++ /dev/null
@@ -1,77 +0,0 @@
-import { gql } from '@apollo/client';
-import { flatListToHierarchical } from '@faustwp/core';
-import { WordPressBlocksViewer } from '@faustwp/blocks';
-import blocks from '../wp-blocks';
-
-export default function Component({ loading, data }) {
- // Loading state for previews.
- if (loading) {
- return <>Loading...>;
- }
-
- const { title, date, author, editorBlocks } = data?.post ?? { title: '' };
- const blockList = flatListToHierarchical(editorBlocks, { childrenKey: 'innerBlocks' });
-
- return (
- <>
- {title}
- Author: {author?.node?.name}
-
-
- >
- );
-}
-
-Component.query = gql`
- ${blocks.CoreParagraph.fragments.entry}
- ${blocks.CoreColumns.fragments.entry}
- ${blocks.CoreColumn.fragments.entry}
- ${blocks.CoreCode.fragments.entry}
- ${blocks.CoreButtons.fragments.entry}
- ${blocks.CoreButton.fragments.entry}
- ${blocks.CoreQuote.fragments.entry}
- ${blocks.CoreImage.fragments.entry}
- ${blocks.CoreSeparator.fragments.entry}
- ${blocks.CoreList.fragments.entry}
- ${blocks.CoreHeading.fragments.entry}
- query GetPost(
- $databaseId: ID!
- $asPreview: Boolean = false
- ) {
- post(id: $databaseId, idType: DATABASE_ID, asPreview: $asPreview) {
- title
- content
- date
- author {
- node {
- name
- }
- }
- editorBlocks(flat: false) {
- name
- __typename
- renderedHtml
- id: clientId
- parentId: parentClientId
- ...${blocks.CoreParagraph.fragments.key}
- ...${blocks.CoreColumns.fragments.key}
- ...${blocks.CoreColumn.fragments.key}
- ...${blocks.CoreCode.fragments.key}
- ...${blocks.CoreButtons.fragments.key}
- ...${blocks.CoreButton.fragments.key}
- ...${blocks.CoreQuote.fragments.key}
- ...${blocks.CoreImage.fragments.key}
- ...${blocks.CoreSeparator.fragments.key}
- ...${blocks.CoreList.fragments.key}
- ...${blocks.CoreHeading.fragments.key}
- }
- }
- }
-`;
-
-Component.variables = ({ databaseId }, ctx) => {
- return {
- databaseId,
- asPreview: ctx?.asPreview,
- };
-};
From 29d10dab1cbfb0459cf06f86dc9c630ddb7ed4eb Mon Sep 17 00:00:00 2001
From: Joe Fusco
Date: Wed, 6 Sep 2023 14:08:47 -0400
Subject: [PATCH 09/13] Update lockfile after merge
Signed-off-by: Joe Fusco
---
package-lock.json | 150 +++++++++++++++++++++++++++++++++++++++++++---
1 file changed, 143 insertions(+), 7 deletions(-)
diff --git a/package-lock.json b/package-lock.json
index 2f382582d..dbafd723c 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -41,6 +41,7 @@
"examples/next/getting-started",
"examples/next/faustwp-getting-started",
"examples/next/app-router",
+ "examples/next/block-support",
"plugins/faustwp"
]
}
@@ -51,8 +52,8 @@
"@apollo/client": "^3.8.0",
"@apollo/experimental-nextjs-app-support": "^0.4.1",
"@faustwp/cli": "1.1.1",
- "@faustwp/core": "1.1.1",
- "@faustwp/experimental-app-router": "^0.0.2",
+ "@faustwp/core": "1.1.2",
+ "@faustwp/experimental-app-router": "^0.0.3",
"graphql": "^16.7.1",
"next": "^13.4.13",
"react": "^18.2.0",
@@ -281,13 +282,144 @@
}
}
},
+ "examples/next/block-support": {
+ "version": "0.1.0",
+ "dependencies": {
+ "@apollo/client": "^3.6.6",
+ "@faustwp/blocks": "2.0.0",
+ "@faustwp/cli": "1.0.1",
+ "@faustwp/core": "1.1.0",
+ "@wordpress/base-styles": "^4.26.0",
+ "@wordpress/block-library": "^7.19.0",
+ "classnames": "^2.3.1",
+ "graphql": "^16.6.0",
+ "next": "^12.1.6",
+ "react": "^17.0.2",
+ "react-dom": "^17.0.2",
+ "sass": "^1.54.9"
+ },
+ "engines": {
+ "node": ">=16",
+ "npm": ">=8"
+ }
+ },
+ "examples/next/block-support/node_modules/@faustwp/cli": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/@faustwp/cli/-/cli-1.0.1.tgz",
+ "integrity": "sha512-dAbl0ru11OYMrDSjViz2wrw8fZEVoO+OW0uRqHGGrhNoyMHoGClGdSw8gz3hnbAKDk/2GZDp6aauaG7igcsQjw==",
+ "dependencies": {
+ "chalk": "^4.1.2",
+ "configstore": "^6.0.0",
+ "dotenv-flow": "^3.2.0",
+ "isomorphic-fetch": "^3.0.0",
+ "lodash": "^4.17.21",
+ "uuid": "8.3.2"
+ },
+ "bin": {
+ "faust": "dist/index.js"
+ },
+ "engines": {
+ "node": ">=16",
+ "npm": ">=8"
+ }
+ },
+ "examples/next/block-support/node_modules/@faustwp/core": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/@faustwp/core/-/core-1.1.0.tgz",
+ "integrity": "sha512-cC9/TCT5rMf1HRibbXyg6DixscDS9khn852Humk37f4PW3V+XX4G3q51lc8uJnMnTpW8tWhyuqe7onkhYB/tgw==",
+ "dependencies": {
+ "@wordpress/hooks": "^3.14.0",
+ "chalk": "^4.1.2",
+ "classnames": "^2.3.2",
+ "cookie": "^0.5.0",
+ "deepmerge": "^4.2.2",
+ "fast-xml-parser": "^4.2.5",
+ "isomorphic-fetch": "^3.0.0",
+ "js-sha256": "^0.9.0",
+ "lodash": "^4.17.21"
+ },
+ "engines": {
+ "node": ">=16",
+ "npm": ">=8"
+ },
+ "peerDependencies": {
+ "@apollo/client": ">=3.6.6",
+ "next": ">=12.1.6",
+ "react": ">=17.0.2",
+ "react-dom": ">=17.0.2"
+ }
+ },
+ "examples/next/block-support/node_modules/ansi-styles": {
+ "version": "4.3.0",
+ "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz",
+ "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==",
+ "dependencies": {
+ "color-convert": "^2.0.1"
+ },
+ "engines": {
+ "node": ">=8"
+ },
+ "funding": {
+ "url": "https://github.com/chalk/ansi-styles?sponsor=1"
+ }
+ },
+ "examples/next/block-support/node_modules/chalk": {
+ "version": "4.1.2",
+ "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz",
+ "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==",
+ "dependencies": {
+ "ansi-styles": "^4.1.0",
+ "supports-color": "^7.1.0"
+ },
+ "engines": {
+ "node": ">=10"
+ },
+ "funding": {
+ "url": "https://github.com/chalk/chalk?sponsor=1"
+ }
+ },
+ "examples/next/block-support/node_modules/color-convert": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
+ "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
+ "dependencies": {
+ "color-name": "~1.1.4"
+ },
+ "engines": {
+ "node": ">=7.0.0"
+ }
+ },
+ "examples/next/block-support/node_modules/color-name": {
+ "version": "1.1.4",
+ "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
+ "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA=="
+ },
+ "examples/next/block-support/node_modules/has-flag": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
+ "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==",
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "examples/next/block-support/node_modules/supports-color": {
+ "version": "7.2.0",
+ "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz",
+ "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==",
+ "dependencies": {
+ "has-flag": "^4.0.0"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
"examples/next/faustwp-getting-started": {
"name": "@faustwp/getting-started-example",
"version": "0.1.0",
"dependencies": {
"@apollo/client": "^3.6.6",
"@faustwp/cli": "1.1.1",
- "@faustwp/core": "1.1.1",
+ "@faustwp/core": "1.1.2",
"@wordpress/base-styles": "^4.26.0",
"@wordpress/block-library": "^7.19.0",
"classnames": "^2.3.1",
@@ -1345,6 +1477,10 @@
"resolved": "packages/block-editor-utils",
"link": true
},
+ "node_modules/@faustwp/block-support-example": {
+ "resolved": "examples/next/block-support",
+ "link": true
+ },
"node_modules/@faustwp/blocks": {
"resolved": "packages/blocks",
"link": true
@@ -18146,13 +18282,13 @@
},
"packages/experimental-app-router": {
"name": "@faustwp/experimental-app-router",
- "version": "0.0.2",
+ "version": "0.0.3",
"license": "MIT",
"devDependencies": {
"@apollo/client": "^3.8.0",
"@apollo/experimental-nextjs-app-support": "^0.4.1",
"@faustwp/cli": "^1.1.1",
- "@faustwp/core": "^1.1.1",
+ "@faustwp/core": "^1.1.2",
"@testing-library/jest-dom": "^5.17.0",
"@types/node": "^20.4.6",
"concurrently": "^8.2.0",
@@ -18174,7 +18310,7 @@
"@apollo/client": ">=3.8.0",
"@apollo/experimental-nextjs-app-support": ">=0.3.2",
"@faustwp/cli": ">=1.1.1",
- "@faustwp/core": ">=1.1.1",
+ "@faustwp/core": ">=1.1.2",
"next": ">=12.1.6",
"react": ">=17.0.2",
"react-dom": ">=17.0.2"
@@ -20138,7 +20274,7 @@
},
"packages/faustwp-core": {
"name": "@faustwp/core",
- "version": "1.1.1",
+ "version": "1.1.2",
"license": "MIT",
"dependencies": {
"@wordpress/hooks": "^3.14.0",
From 4257d0e6b375a495ff6f3a47a58e22aafa0fd6b1 Mon Sep 17 00:00:00 2001
From: Joe Fusco
Date: Wed, 6 Sep 2023 14:21:13 -0400
Subject: [PATCH 10/13] Constrain layout using existing core class
Signed-off-by: Joe Fusco
---
examples/next/block-support/wp-templates/front-page.js | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/examples/next/block-support/wp-templates/front-page.js b/examples/next/block-support/wp-templates/front-page.js
index 8f388bf65..21ae05bc8 100644
--- a/examples/next/block-support/wp-templates/front-page.js
+++ b/examples/next/block-support/wp-templates/front-page.js
@@ -13,10 +13,10 @@ export default function Component({ loading, data }) {
const blockList = flatListToHierarchical(editorBlocks, { childrenKey: 'innerBlocks' });
return (
- <>
+
{title}
- >
+
);
}
From da3c5bfef445a9cd45eee45f349dbefcdcf757c0 Mon Sep 17 00:00:00 2001
From: Joe Fusco
Date: Wed, 6 Sep 2023 14:52:31 -0400
Subject: [PATCH 11/13] Not being used
Signed-off-by: Joe Fusco
---
examples/next/block-support/.eslintignore | 2 --
1 file changed, 2 deletions(-)
delete mode 100644 examples/next/block-support/.eslintignore
diff --git a/examples/next/block-support/.eslintignore b/examples/next/block-support/.eslintignore
deleted file mode 100644
index d89107ecc..000000000
--- a/examples/next/block-support/.eslintignore
+++ /dev/null
@@ -1,2 +0,0 @@
-components
-pages
From b9a235c930a41699412df6bb978aceb415ed61c8 Mon Sep 17 00:00:00 2001
From: Joe Fusco
Date: Wed, 6 Sep 2023 15:05:28 -0400
Subject: [PATCH 12/13] Irrelevant comment
Signed-off-by: Joe Fusco
---
examples/next/block-support/styles/blocks.scss | 1 -
1 file changed, 1 deletion(-)
diff --git a/examples/next/block-support/styles/blocks.scss b/examples/next/block-support/styles/blocks.scss
index ac5db0b90..2625e002c 100644
--- a/examples/next/block-support/styles/blocks.scss
+++ b/examples/next/block-support/styles/blocks.scss
@@ -1,5 +1,4 @@
// WordPress block styles.
-// Used in `components/ContentWrapper`
@use 'sass:math';
From c9dd1f8f919c131ea998c6c2b9bfd14e24d070dc Mon Sep 17 00:00:00 2001
From: Joe Fusco
Date: Mon, 25 Sep 2023 10:31:08 -0400
Subject: [PATCH 13/13] Resolve merge conflicts
Signed-off-by: Joe Fusco
---
package-lock.json | 196 ++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 196 insertions(+)
diff --git a/package-lock.json b/package-lock.json
index b33286cc7..7e9215525 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -41,6 +41,7 @@
"examples/next/getting-started",
"examples/next/faustwp-getting-started",
"examples/next/app-router",
+ "examples/next/block-support",
"plugins/faustwp"
]
}
@@ -309,6 +310,137 @@
"node": ">=14.17"
}
},
+ "examples/next/block-support": {
+ "version": "0.1.0",
+ "dependencies": {
+ "@apollo/client": "^3.6.6",
+ "@faustwp/blocks": "2.0.0",
+ "@faustwp/cli": "1.0.1",
+ "@faustwp/core": "1.1.0",
+ "@wordpress/base-styles": "^4.26.0",
+ "@wordpress/block-library": "^7.19.0",
+ "classnames": "^2.3.1",
+ "graphql": "^16.6.0",
+ "next": "^12.1.6",
+ "react": "^17.0.2",
+ "react-dom": "^17.0.2",
+ "sass": "^1.54.9"
+ },
+ "engines": {
+ "node": ">=16",
+ "npm": ">=8"
+ }
+ },
+ "examples/next/block-support/node_modules/@faustwp/cli": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/@faustwp/cli/-/cli-1.0.1.tgz",
+ "integrity": "sha512-dAbl0ru11OYMrDSjViz2wrw8fZEVoO+OW0uRqHGGrhNoyMHoGClGdSw8gz3hnbAKDk/2GZDp6aauaG7igcsQjw==",
+ "dependencies": {
+ "chalk": "^4.1.2",
+ "configstore": "^6.0.0",
+ "dotenv-flow": "^3.2.0",
+ "isomorphic-fetch": "^3.0.0",
+ "lodash": "^4.17.21",
+ "uuid": "8.3.2"
+ },
+ "bin": {
+ "faust": "dist/index.js"
+ },
+ "engines": {
+ "node": ">=16",
+ "npm": ">=8"
+ }
+ },
+ "examples/next/block-support/node_modules/@faustwp/core": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/@faustwp/core/-/core-1.1.0.tgz",
+ "integrity": "sha512-cC9/TCT5rMf1HRibbXyg6DixscDS9khn852Humk37f4PW3V+XX4G3q51lc8uJnMnTpW8tWhyuqe7onkhYB/tgw==",
+ "dependencies": {
+ "@wordpress/hooks": "^3.14.0",
+ "chalk": "^4.1.2",
+ "classnames": "^2.3.2",
+ "cookie": "^0.5.0",
+ "deepmerge": "^4.2.2",
+ "fast-xml-parser": "^4.2.5",
+ "isomorphic-fetch": "^3.0.0",
+ "js-sha256": "^0.9.0",
+ "lodash": "^4.17.21"
+ },
+ "engines": {
+ "node": ">=16",
+ "npm": ">=8"
+ },
+ "peerDependencies": {
+ "@apollo/client": ">=3.6.6",
+ "next": ">=12.1.6",
+ "react": ">=17.0.2",
+ "react-dom": ">=17.0.2"
+ }
+ },
+ "examples/next/block-support/node_modules/ansi-styles": {
+ "version": "4.3.0",
+ "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz",
+ "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==",
+ "dependencies": {
+ "color-convert": "^2.0.1"
+ },
+ "engines": {
+ "node": ">=8"
+ },
+ "funding": {
+ "url": "https://github.com/chalk/ansi-styles?sponsor=1"
+ }
+ },
+ "examples/next/block-support/node_modules/chalk": {
+ "version": "4.1.2",
+ "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz",
+ "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==",
+ "dependencies": {
+ "ansi-styles": "^4.1.0",
+ "supports-color": "^7.1.0"
+ },
+ "engines": {
+ "node": ">=10"
+ },
+ "funding": {
+ "url": "https://github.com/chalk/chalk?sponsor=1"
+ }
+ },
+ "examples/next/block-support/node_modules/color-convert": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
+ "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
+ "dependencies": {
+ "color-name": "~1.1.4"
+ },
+ "engines": {
+ "node": ">=7.0.0"
+ }
+ },
+ "examples/next/block-support/node_modules/color-name": {
+ "version": "1.1.4",
+ "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
+ "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA=="
+ },
+ "examples/next/block-support/node_modules/has-flag": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
+ "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==",
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "examples/next/block-support/node_modules/supports-color": {
+ "version": "7.2.0",
+ "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz",
+ "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==",
+ "dependencies": {
+ "has-flag": "^4.0.0"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
"examples/next/faustwp-getting-started": {
"name": "@faustwp/getting-started-example",
"version": "0.1.0",
@@ -1373,6 +1505,10 @@
"resolved": "packages/block-editor-utils",
"link": true
},
+ "node_modules/@faustwp/block-support-example": {
+ "resolved": "examples/next/block-support",
+ "link": true
+ },
"node_modules/@faustwp/blocks": {
"resolved": "packages/blocks",
"link": true
@@ -21617,6 +21753,66 @@
"plugins/faustwp": {
"name": "@faustwp/wordpress-plugin",
"version": "1.0.4"
+ },
+ "packages/experimental-app-router/node_modules/@next/swc-android-arm-eabi": {
+ "version": "12.3.0",
+ "resolved": "https://registry.npmjs.org/@next/swc-android-arm-eabi/-/swc-android-arm-eabi-12.3.0.tgz",
+ "integrity": "sha512-/PuirPnAKsYBw93w/7Q9hqy+KGOU9mjYprZ/faxMUJh/dc6v3rYLxkZKNG9nFPIW4QKNTCnhP40xF9hLnxO+xg==",
+ "cpu": [
+ "arm"
+ ],
+ "optional": true,
+ "os": [
+ "android"
+ ],
+ "engines": {
+ "node": ">= 10"
+ }
+ },
+ "packages/experimental-app-router/node_modules/@next/swc-android-arm64": {
+ "version": "12.3.0",
+ "resolved": "https://registry.npmjs.org/@next/swc-android-arm64/-/swc-android-arm64-12.3.0.tgz",
+ "integrity": "sha512-OaI+FhAM6P9B6Ybwbn0Zl8YwWido0lLwhDBi9WiYCh4RQmIXAyVIoIJPHo4fP05+mXaJ/k1trvDvuURvHOq2qw==",
+ "cpu": [
+ "arm64"
+ ],
+ "optional": true,
+ "os": [
+ "android"
+ ],
+ "engines": {
+ "node": ">= 10"
+ }
+ },
+ "packages/experimental-app-router/node_modules/@next/swc-freebsd-x64": {
+ "version": "12.3.0",
+ "resolved": "https://registry.npmjs.org/@next/swc-freebsd-x64/-/swc-freebsd-x64-12.3.0.tgz",
+ "integrity": "sha512-xAlruUREij/bFa+qsE1tmsP28t7vz02N4ZDHt2lh3uJUniE0Ne9idyIDLc1Ed0IF2RjfgOp4ZVunuS3OM0sngw==",
+ "cpu": [
+ "x64"
+ ],
+ "optional": true,
+ "os": [
+ "freebsd"
+ ],
+ "engines": {
+ "node": ">= 10"
+ }
+ },
+ "packages/experimental-app-router/node_modules/@next/swc-linux-arm-gnueabihf": {
+ "version": "12.3.0",
+ "resolved": "https://registry.npmjs.org/@next/swc-linux-arm-gnueabihf/-/swc-linux-arm-gnueabihf-12.3.0.tgz",
+ "integrity": "sha512-jin2S4VT/cugc2dSZEUIabhYDJNgrUh7fufbdsaAezgcQzqfdfJqfxl4E9GuafzB4cbRPTaqA0V5uqbp0IyGkQ==",
+ "cpu": [
+ "arm"
+ ],
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">= 10"
+ }
}
}
}