Skip to content

Commit 7344e0f

Browse files
authored
Merge pull request #423 from Automattic/trunk
Alpha release Mar 05
2 parents d074b11 + cece9cd commit 7344e0f

File tree

77 files changed

+3563
-4294
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

77 files changed

+3563
-4294
lines changed

.github/UTILITY_CLASSES.md

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,3 @@
1-
# Newspack Grid
2-
3-
Adding `newspack-grid` or `newspack-grid-small` to a Columns block ensures the columns fit on the grid on large screens.
4-
5-
`newspack-grid` is designed for use with a wide Columns block. It supports the following layouts:
6-
7-
- 25% / 50% / 25%
8-
- 33.33% / 33.33% / 33.33%
9-
- 15% / 70% / 15%
10-
- 66.66% / 33.33% or 33.33% / 66.66%
11-
12-
_Note: These layouts are also available as patterns._
13-
14-
`newspack-grid-small` is for narrow columns (e.g., at 632px) and currently supports only one layout type: 66.66% / 33.33% or 33.33% / 66.66%.
15-
16-
For a single sidebar layout, you need to apply both the `newspack-grid` and `newspack-grid--sidebar` classes. The `newspack-grid` class sets up the primary grid structure, while the `newspack-grid--sidebar` class ensures that the single sidebar layout is correctly formatted and displayed. Without these two classes, the layout may not appear as intended. It requires a Columns block with a 2-column layout: 66.66% / 33.33% or 33.33% / 66.66%.
17-
18-
| CLASS NAME | DESCRIPTION |
19-
| ---------------------- | -------------------------------------------- |
20-
| newspack-grid | The Columns block will use a 12-column grid. |
21-
| newspack-grid--sidebar | For single sidebar layouts only. |
22-
| newspack-grid-small | The Columns block will use a 6-column grid. |
23-
241
# Buttons
252

263
Adding `has-small-size` or `has-x-small-size` to a Buttons block will reduce its padding and border-radius.

.github/VARIABLES.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ _Viewport range for clamp: 782px > 1280px_
8585
| --wp--preset--color--contrast-3 | #6C6C6C |
8686
| --wp--preset--color--accent | #003DA5 |
8787
| --wp--preset--color--accent-2 | #2055B0 |
88-
| --wp--preset--color--accent-3 | #26D07C |
88+
| --wp--preset--color--accent-3 | #9FB6DD |
8989

9090
## Newspack UI-like
9191

.github/workflows/auto-merge.yml

Lines changed: 28 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,38 @@
11
on:
22
pull_request_target:
3-
types: [labeled]
43

54
name: Dependabot auto-merge
65
jobs:
76
auto-merge:
87
name: Auto-merge dependabot PRs for minor and patch updates
98
runs-on: ubuntu-latest
10-
if: |
11-
contains( github.event.pull_request.labels.*.name, 'dependencies' )
12-
&& ! contains( github.event.pull_request.labels.*.name, '[Status] Approved' )
9+
if: github.actor == 'dependabot[bot]'
10+
permissions:
11+
contents: write
12+
pull-requests: write
1313
steps:
14-
- uses: actions/checkout@v2
15-
- uses: ahmadnassri/action-dependabot-auto-merge@v2
14+
- name: Fetch Dependabot metadata
15+
id: metadata
16+
uses: dependabot/fetch-metadata@v2
1617
with:
17-
target: minor # includes patch updates.
18-
github-token: ${{ secrets.DEPENDABOT_TOKEN }}
18+
github-token: "${{ secrets.GITHUB_TOKEN }}"
19+
20+
- name: Approve PR
21+
if: >-
22+
(contains(steps.metadata.outputs.update-type, 'version-update:semver-minor') ||
23+
contains(steps.metadata.outputs.update-type, 'version-update:semver-patch')) &&
24+
!contains(steps.metadata.outputs.update-type, 'version-update:semver-major')
25+
run: gh pr review --approve "$PR_URL"
26+
env:
27+
PR_URL: ${{ github.event.pull_request.html_url }}
28+
GH_TOKEN: ${{ secrets.DEPENDABOT_TOKEN }}
29+
30+
- name: Enable auto-merge for minor and patch updates
31+
if: >-
32+
(contains(steps.metadata.outputs.update-type, 'version-update:semver-minor') ||
33+
contains(steps.metadata.outputs.update-type, 'version-update:semver-patch')) &&
34+
!contains(steps.metadata.outputs.update-type, 'version-update:semver-major')
35+
run: gh pr merge --auto --squash "$PR_URL"
36+
env:
37+
PR_URL: ${{ github.event.pull_request.html_url }}
38+
GH_TOKEN: ${{ secrets.DEPENDABOT_TOKEN }}

AGENTS.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Newspack Block Theme: Agent Instructions
2+
3+
This file covers what is specific to `newspack-block-theme`. Shared conventions (Docker commands, `n` script, coding standards, git rules, etc.) are in the root `newspack-workspace/AGENTS.md`.
4+
5+
## Overview
6+
7+
`newspack-block-theme` is a WordPress block theme. Templates, template parts, and patterns are HTML files in `templates/`, `parts/`, and `patterns/` respectively. Global styles, layout, typography, and color are controlled via `theme.json`. Two style variations exist in `styles/`: `harold.json` and `paul.json`.
8+
9+
## Blocks
10+
11+
Do not add new blocks to this repo. New blocks should be added to `newspack-plugin` (most cases) or `newspack-blocks`. The existing `includes/blocks/subtitle-block/` is the only block that belongs here as it is tightly coupled to theme-level post metadata.
12+
13+
## Gotchas
14+
15+
- **`npm run lint` skips PHP.** Run `npm run lint:php` separately for PHP linting.
16+
- **`style.css` and `style-rtl.css` are generated.** They are copied from `dist/` after the webpack build. Edit the SCSS source in `src/scss/`, not the root CSS files.
17+
- **Nested patterns are not auto-registered by WordPress.** WordPress only auto-registers pattern files at the top level of `/patterns/`. Subdirectory patterns are handled by the recursive `register_nested_patterns()` in `includes/class-patterns.php`, which traverses all depths automatically — no manual registration is needed when adding a new file to a subdirectory. Note that `patterns/plugins/jetpack/` is a two-level-deep subdirectory containing Jetpack sharing button patterns; plugin-specific patterns live there.
18+
- **Webpack entry points for blocks are auto-discovered.** Any `.js`, `.jsx`, `.ts`, or `.tsx` file in `includes/blocks/*/` becomes an entry point automatically. No changes to `webpack.config.js` are needed.
19+
- **External patterns are intentionally blocked.** The theme prevents Jetpack, WooCommerce, and Automattic remote patterns from loading. This is by design — do not remove these filters.
20+
- **After adding a new PHP class file, run `composer dump-autoload`.** The `includes/` directory uses classmap autoloading, not PSR-4.
21+
- **The Article Subtitle block has two completely different implementations.** In the post editor it is not a block at all — it injects a `contenteditable` div directly into the DOM and updates post meta via `editPost()`. In the site editor it registers normally via `registerBlockType()`. Modifying it requires understanding which context you are in.
22+
- **There are two separate menu systems with different selectors.** Mobile headers use `.header-mobile` (container), `.mobile-menu__toggle` / `.mobile-menu__contents` (handled by `menus/mobile.js`). Drawer menus used in some desktop header patterns use `.drawer-menu` (container), `.drawer-menu__toggle` / `.drawer-menu__contents` (handled by `menus/drawer.js`). Mixing up the selectors or JS handlers will silently break menu initialization.
23+
- **Style variations require a unique `className` in their JSON.** The theme reads `wp_get_global_settings()['custom']['className']` and adds it as a `theme-variation-{className}` body class used for CSS scoping. A new style variation in `styles/` must define this value or scoped styles will not apply.

CLAUDE.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
@AGENTS.md

README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,22 @@ If you have a patch or have stumbled upon an issue with the Newspack plugin/them
2424
- Run `npm start` to compile the SCSS and JS files, and start file watcher.
2525
- Run `npm run build` to perform a single compilation run.
2626

27+
### Theme structure
28+
29+
This is a WordPress block theme. Global styles, layout, typography, and color are defined in `theme.json`. Templates and template parts are HTML block markup files:
30+
31+
- `templates/` — Page templates (front page, single, archive, search, 404, etc.). Some templates have layout variants in subdirectories (e.g. `templates/single/`, `templates/page/`).
32+
- `parts/` — Reusable template parts (header, footer, menus). Headers and footers have separate mobile and desktop variants (e.g. `parts/header-mobile.html`, `parts/header-desktop.html`).
33+
- `patterns/` — Block patterns organized into subdirectories by category (header, footer, post-header, post-meta, etc.). Note that patterns in subdirectories are not auto-registered by WordPress and are handled manually in `includes/class-patterns.php`.
34+
35+
### Blocks
36+
37+
This theme contains one custom block (`includes/blocks/subtitle-block/`) which is tightly coupled to theme-level post metadata. New blocks should not be added here — they belong in `newspack-plugin` (most cases) or `newspack-blocks`.
38+
39+
### Style variations
40+
41+
Two style variations are available in `styles/`: `harold.json` and `paul.json`. Each is a partial `theme.json` that overrides colors and typography from the base theme. Style variations can be selected from Appearance > Design in wp-admin.
42+
2743
### Variables
2844

2945
A cheat sheet of the most important CSS variables is available [here](https://github.com/Automattic/newspack-block-theme/blob/trunk/.github/VARIABLES.md).
277 KB
Binary file not shown.
233 KB
Binary file not shown.

assets/fonts/dm-sans/LICENSE.md

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
Copyright 2014 The DM Sans Project Authors (https://github.com/googlefonts/dm-fonts)
2+
3+
This Font Software is licensed under the SIL Open Font License, Version 1.1.
4+
This license is copied below, and is also available with a FAQ at:
5+
https://openfontlicense.org
6+
7+
8+
-----------------------------------------------------------
9+
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
10+
-----------------------------------------------------------
11+
12+
PREAMBLE
13+
The goals of the Open Font License (OFL) are to stimulate worldwide
14+
development of collaborative font projects, to support the font creation
15+
efforts of academic and linguistic communities, and to provide a free and
16+
open framework in which fonts may be shared and improved in partnership
17+
with others.
18+
19+
The OFL allows the licensed fonts to be used, studied, modified and
20+
redistributed freely as long as they are not sold by themselves. The
21+
fonts, including any derivative works, can be bundled, embedded,
22+
redistributed and/or sold with any software provided that any reserved
23+
names are not used by derivative works. The fonts and derivatives,
24+
however, cannot be released under any other type of license. The
25+
requirement for fonts to remain under this license does not apply
26+
to any document created using the fonts or their derivatives.
27+
28+
DEFINITIONS
29+
"Font Software" refers to the set of files released by the Copyright
30+
Holder(s) under this license and clearly marked as such. This may
31+
include source files, build scripts and documentation.
32+
33+
"Reserved Font Name" refers to any names specified as such after the
34+
copyright statement(s).
35+
36+
"Original Version" refers to the collection of Font Software components as
37+
distributed by the Copyright Holder(s).
38+
39+
"Modified Version" refers to any derivative made by adding to, deleting,
40+
or substituting -- in part or in whole -- any of the components of the
41+
Original Version, by changing formats or by porting the Font Software to a
42+
new environment.
43+
44+
"Author" refers to any designer, engineer, programmer, technical
45+
writer or other person who contributed to the Font Software.
46+
47+
PERMISSION & CONDITIONS
48+
Permission is hereby granted, free of charge, to any person obtaining
49+
a copy of the Font Software, to use, study, copy, merge, embed, modify,
50+
redistribute, and sell modified and unmodified copies of the Font
51+
Software, subject to the following conditions:
52+
53+
1) Neither the Font Software nor any of its individual components,
54+
in Original or Modified Versions, may be sold by itself.
55+
56+
2) Original or Modified Versions of the Font Software may be bundled,
57+
redistributed and/or sold with any software, provided that each copy
58+
contains the above copyright notice and this license. These can be
59+
included either as stand-alone text files, human-readable headers or
60+
in the appropriate machine-readable metadata fields within text or
61+
binary files as long as those fields can be easily viewed by the user.
62+
63+
3) No Modified Version of the Font Software may use the Reserved Font
64+
Name(s) unless explicit written permission is granted by the corresponding
65+
Copyright Holder. This restriction only applies to the primary font name as
66+
presented to the users.
67+
68+
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
69+
Software shall not be used to promote, endorse or advertise any
70+
Modified Version, except to acknowledge the contribution(s) of the
71+
Copyright Holder(s) and the Author(s) or with their explicit written
72+
permission.
73+
74+
5) The Font Software, modified or unmodified, in part or in whole,
75+
must be distributed entirely under this license, and must not be
76+
distributed under any other license. The requirement for fonts to
77+
remain under this license does not apply to any document created
78+
using the Font Software.
79+
80+
TERMINATION
81+
This license becomes null and void if any of the above conditions are
82+
not met.
83+
84+
DISCLAIMER
85+
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
86+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
87+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
88+
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
89+
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
90+
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
91+
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
92+
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
93+
OTHER DEALINGS IN THE FONT SOFTWARE.
Binary file not shown.

0 commit comments

Comments
 (0)