Skip to content

Commit 74e6f69

Browse files
committed
Update module repos and generate docs; Improve organization of modules
1 parent 9aff2ac commit 74e6f69

30 files changed

Lines changed: 703 additions & 122 deletions

File tree

File renamed without changes.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ A command-line tool to quickly set up new projects based on templates.
1010

1111
## Usage
1212

13-
Prerequisites: Git and Node.js 18 or above
13+
Prerequisites: Linux, macOS, or [Windows Subsystem for Linux](https://learn.microsoft.com/en-us/windows/wsl/about); [Git](https://git-scm.com/), [Node](https://nodejs.org/en/) (version 20 and above)
1414

1515
Run the tool to create a new project.
1616

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,32 +4,36 @@ title: Design
44
<!--
55
Do not edit this file - Generated from https://github.com/tangibleinc/design
66
-->
7-
# Design
7+
# Design Library
88

9-
The Design library includes themeable user interface components, design tokens, and styling utilities. It is written in Sass and TypeScript with React.
9+
The Design Library includes unstyled and themeable user interface components, patterns, design tokens, and styling utilities for creating a design system. It is available as CSS/Sass, JSON/JavaScript/TypeScript, and React.
1010

11-
**Status: Draft**
11+
Website: https://design.tangible.one
12+
13+
Repository: https://github.com/tangibleinc/design
14+
15+
**Status: Draft** - Currently in research phase
1216

1317
## Getting started
1418

1519
Prerequisites: [Node](https://nodejs.org/) or [Bun](https://bun.sh/)
1620

17-
Install as dev dependency.
21+
Install as dependency.
1822

1923
```sh
20-
npm install -D @tangible/design
24+
npm install @tangible/ui
2125
```
2226

2327
### Sass
2428

2529
```scss
26-
@import "@tangible/design";
30+
@import "@tangible/ui";
2731
```
2832

2933
### TypeScript
3034

3135
```ts
32-
import * as design from '@tangible/design'
36+
import * as ui from '@tangible/ui'
3337
```
3438

3539

File renamed without changes.

docs/pages/modules/fields/index.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,15 +146,15 @@ https://docs.phpunit.de/en/9.6/ for more information.
146146

147147
#### Method 2: Using wp-env (Recommended)
148148

149-
Alternatively, you can use the [wp-env](https://developer.wordpress.org/block-editor/reference-guides/packages/packages-env/) tool to quickly spin up a local dev and test environment, optionally switching between multiple PHP versions.
149+
Alternatively, you can use the [wp-env](https://developer.wordpress.org/block-editor/reference-guides/packages/packages-env/) tool to serve local dev and test sites, optionally switching between multiple PHP versions.
150150

151151
The test environment is started by running:
152152

153153
```sh
154154
npm run env:start
155155
```
156156

157-
This uses [`wp-env`](https://developer.wordpress.org/block-editor/reference-guides/packages/packages-env/) to quickly spin up a local dev and test environment, optionally switching between multiple PHP versions. `wp-env` requires Docker to be installed. There are instructions available for installing Docker on [Windows](https://docs.docker.com/desktop/install/windows-install/), [macOS](https://docs.docker.com/desktop/install/mac-install/), and [Linux](https://docs.docker.com/desktop/install/linux-install/).
157+
This uses [`wp-env`](https://developer.wordpress.org/block-editor/reference-guides/packages/packages-env/), which requires Docker to be installed. There are instructions available for installing Docker on [Windows](https://docs.docker.com/desktop/install/windows-install/), [macOS](https://docs.docker.com/desktop/install/mac-install/), and [Linux](https://docs.docker.com/desktop/install/linux-install/).
158158

159159
Visit [http://localhost:8888](http://localhost:8888) to see the dev site, and [http://localhost:8889](http://localhost:8880) for the test site, whose database is cleared on every run.
160160

docs/pages/modules/framework/design/index.md

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,19 @@ title: Design
44
<!--
55
Do not edit this file - Generated from https://github.com/tangibleinc/framework
66
-->
7-
# Integrate Design library with WordPress
7+
# Design library
88

9-
In the Framework, it would be convenient to bundle the library `@tangible/design`, made of Sass and JavaScript, into independently loadable modules under a shared global namespace.
9+
This is a set of design styles, components, and assets and for use by Tangible plugins.
1010

11-
- `design-core.min.css`
12-
- `design-core.min.js`
13-
- `design-component.*.min.css`
14-
- `design-component.*.min.js`
11+
## Plan
12+
13+
Integrate the general-purpose design library with curated tokens and CSS variables.
14+
15+
- `core.min.css`
16+
- class `t-design`
17+
- `core.min.js`
18+
- `Tangible.Design`
19+
- `component.*.min.css`
20+
- class `t-Component`
21+
- `component.*.min.js`
22+
- class `Component` exported from `@tangible/design`

docs/pages/modules/framework/env/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@ title: Env
44
<!--
55
Do not edit this file - Generated from https://github.com/tangibleinc/framework
66
-->
7-
# @tangible/env
7+
# Env
88

99
Local dev and test environment setup with WordPress Playground and Playwright

docs/pages/modules/framework/index.md

Lines changed: 77 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,75 @@ Many of these were refactored from the deprecated [plugin framework v2](https://
1414

1515
Git repository: https://github.com/tangibleinc/framework
1616

17+
## Install
18+
19+
Add as a production dependency in `tangible.config.js`.
20+
21+
```js
22+
export default {
23+
install: [
24+
{
25+
git: 'git@github.com:tangibleinc/framework',
26+
dest: 'vendor/tangible/framework',
27+
branch: 'main',
28+
},
29+
]
30+
}
31+
```
32+
33+
Run `npm run install` or `npx roll install`.
34+
35+
Alternatively, add in `composer.json` and run `composer update`.
36+
37+
```json
38+
{
39+
"repositories": [
40+
{
41+
"type": "vcs",
42+
"url": "git@github.com:tangibleinc/framework"
43+
}
44+
],
45+
"require": {
46+
"tangible/framework": "dev-main"
47+
},
48+
"minimum-stability": "dev"
49+
}
50+
```
51+
52+
## Use
53+
54+
After loading the framework, its newest version instance is ready on `plugins_loaded` action.
55+
56+
```php
57+
use tangible\framework;
58+
59+
require_once __DIR__ . '/vendor/tangible/framework/index.php';
60+
61+
add_action('plugins_loaded', function() {
62+
63+
// Newest version of Framework is ready
64+
65+
});
66+
```
67+
68+
### Note on plugin activation
69+
70+
During plugin activation, such as after install or update, WordPress runs the `plugins_loaded` action *before* loading plugins and modules, short-circuiting the version comparison logic. This can cause an older version of a module to load with missing features.
71+
72+
It is recommended to check for the constant `WP_SANDBOX_SCRAPING`, and skip loading the rest of the plugin when it's defined.
73+
74+
```php
75+
if (defined('WP_SANDBOX_SCRAPING')) return;
76+
77+
// ..Register with Framework and load the rest of plugin..
78+
```
79+
80+
This guarantees the availability of the newest version of all modules. For more details, see:
81+
82+
- https://developer.wordpress.org/reference/functions/register_activation_hook/#more-information
83+
- https://github.com/WordPress/wordpress-develop/blob/8a52d746e9bb85604f6a309a87d22296ce1c4280/src/wp-admin/includes/plugin.php#L2381C10-L2381C31
84+
85+
1786
## Modules
1887

1988
- [Admin](admin)
@@ -91,7 +160,7 @@ npm run format [module1 module2..]
91160
Start a local dev site using [`wp-now`](https://github.com/WordPress/playground-tools/blob/trunk/packages/wp-now/README.md).
92161

93162
```sh
94-
npm run start
163+
npm run now
95164
```
96165

97166
Press CTRL + C to stop.
@@ -131,40 +200,40 @@ This plugin comes with a suite of unit and integration tests.
131200
The test environment is started by running:
132201

133202
```sh
134-
npm run env:start
203+
npm run start
135204
```
136205

137-
This uses [`wp-env`](https://developer.wordpress.org/block-editor/reference-guides/packages/packages-env/) to quickly spin up a local dev and test environment, optionally switching between multiple PHP versions. It requires **Docker** to be installed. There are instructions available for installing Docker on [Windows](https://docs.docker.com/desktop/install/windows-install/), [macOS](https://docs.docker.com/desktop/install/mac-install/), and [Linux](https://docs.docker.com/desktop/install/linux-install/).
206+
This uses [`wp-env`](https://developer.wordpress.org/block-editor/reference-guides/packages/packages-env/) to set up a local dev and test site, optionally switching between multiple PHP versions. It requires **Docker** to be installed. There are instructions available for installing Docker on [Windows](https://docs.docker.com/desktop/install/windows-install/), [macOS](https://docs.docker.com/desktop/install/mac-install/), and [Linux](https://docs.docker.com/desktop/install/linux-install/).
138207

139208
Visit [http://localhost:8888](http://localhost:8888) to see the dev site, and [http://localhost:8889](http://localhost:8880) for the test site, whose database is cleared on every run.
140209

141210
Before running tests, install PHPUnit as a dev dependency using Composer inside the container.
142211

143212
```sh
144-
npm run env:composer:install
213+
npm run composer:install
145214
```
146215

147216
Composer will add and remove folders in the `vendor` folder, based on `composer.json` and `composer.lock`. If you have any existing Git repositories, ensure they don't have any work in progress before running the above command.
148217

149218
Run the tests:
150219

151220
```sh
152-
npm run env:test
221+
npm run test
153222
```
154223

155224
For each PHP version:
156225

157226
```sh
158-
npm run env:test:7.4
159-
npm run env:test:8.2
227+
npm run test:7.4
228+
npm run test:8.2
160229
```
161230

162231
The version-specific commands take a while to start, but afterwards you can run `npm run env:test` to re-run tests in the same environment.
163232

164233
To stop the Docker process:
165234

166235
```sh
167-
npm run env:stop
236+
npm run stop
168237
```
169238

170239
To remove Docker containers, volumes, images associated with the test environment.
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ title: Now
44
<!--
55
Do not edit this file - Generated from https://github.com/tangibleinc/now
66
-->
7-
# @tangible/now
7+
# Now
88

9-
> Standalone command-line tool to manage local WordPress sites
9+
> Standalone command-line tool to run local sites on WordPress Playground
1010
1111
This is a fork of [`wp-now`](https://github.com/WordPress/playground-tools/tree/trunk/packages/wp-now), customized for local development and testing purpose.

0 commit comments

Comments
 (0)