From 453c13d75e4eb6341ffef0b84d6a388b0523a399 Mon Sep 17 00:00:00 2001 From: Luigi Teschio Date: Wed, 11 Sep 2024 09:54:30 +0200 Subject: [PATCH] Add @wordpress/fields package --- package-lock.json | 52 ++++++++++++++++++++ package.json | 1 + packages/fields/.npmrc | 1 + packages/fields/CHANGELOG.md | 5 ++ packages/fields/README.md | 23 +++++++++ packages/fields/package.json | 53 +++++++++++++++++++++ packages/fields/src/index.ts | 8 ++++ packages/fields/src/lock-unlock.ts | 10 ++++ packages/fields/tsconfig.json | 24 ++++++++++ packages/private-apis/src/implementation.js | 1 + tsconfig.json | 1 + 11 files changed, 179 insertions(+) create mode 100644 packages/fields/.npmrc create mode 100644 packages/fields/CHANGELOG.md create mode 100644 packages/fields/README.md create mode 100644 packages/fields/package.json create mode 100644 packages/fields/src/index.ts create mode 100644 packages/fields/src/lock-unlock.ts create mode 100644 packages/fields/tsconfig.json diff --git a/package-lock.json b/package-lock.json index b9e116f15388be..31fb3d8d66434c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -40,6 +40,7 @@ "@wordpress/editor": "file:packages/editor", "@wordpress/element": "file:packages/element", "@wordpress/escape-html": "file:packages/escape-html", + "@wordpress/fields": "file:packages/fields", "@wordpress/format-library": "file:packages/format-library", "@wordpress/hooks": "file:packages/hooks", "@wordpress/html-entities": "file:packages/html-entities", @@ -17028,6 +17029,10 @@ "resolved": "packages/eslint-plugin", "link": true }, + "node_modules/@wordpress/fields": { + "resolved": "packages/fields", + "link": true + }, "node_modules/@wordpress/format-library": { "resolved": "packages/format-library", "link": true @@ -53534,6 +53539,7 @@ "@wordpress/editor": "file:../editor", "@wordpress/element": "file:../element", "@wordpress/escape-html": "file:../escape-html", + "@wordpress/fields": "file:../fields", "@wordpress/hooks": "file:../hooks", "@wordpress/html-entities": "file:../html-entities", "@wordpress/i18n": "file:../i18n", @@ -53890,6 +53896,33 @@ } } }, + "packages/fields": { + "name": "@wordpress/fields", + "version": "0.0.1", + "license": "GPL-2.0-or-later", + "dependencies": { + "@babel/runtime": "^7.16.0", + "@wordpress/components": "file:../components", + "@wordpress/compose": "file:../compose", + "@wordpress/data": "file:../data", + "@wordpress/dataviews": "file:../dataviews", + "@wordpress/element": "file:../element", + "@wordpress/i18n": "file:../i18n", + "@wordpress/icons": "file:../icons", + "@wordpress/notices": "file:../notices", + "@wordpress/primitives": "file:../primitives", + "@wordpress/private-apis": "file:../private-apis", + "@wordpress/url": "file:../url", + "@wordpress/warning": "file:../warning" + }, + "engines": { + "node": ">=18.12.0", + "npm": ">=8.19.2" + }, + "peerDependencies": { + "react": "^18.0.0" + } + }, "packages/format-library": { "name": "@wordpress/format-library", "version": "5.7.0", @@ -68189,6 +68222,7 @@ "@wordpress/editor": "file:../editor", "@wordpress/element": "file:../element", "@wordpress/escape-html": "file:../escape-html", + "@wordpress/fields": "file:../fields", "@wordpress/hooks": "file:../hooks", "@wordpress/html-entities": "file:../html-entities", "@wordpress/i18n": "file:../i18n", @@ -68447,6 +68481,24 @@ "requireindex": "^1.2.0" } }, + "@wordpress/fields": { + "version": "file:packages/fields", + "requires": { + "@babel/runtime": "^7.16.0", + "@wordpress/components": "file:../components", + "@wordpress/compose": "file:../compose", + "@wordpress/data": "file:../data", + "@wordpress/dataviews": "file:../dataviews", + "@wordpress/element": "file:../element", + "@wordpress/i18n": "file:../i18n", + "@wordpress/icons": "file:../icons", + "@wordpress/notices": "file:../notices", + "@wordpress/primitives": "file:../primitives", + "@wordpress/private-apis": "file:../private-apis", + "@wordpress/url": "file:../url", + "@wordpress/warning": "file:../warning" + } + }, "@wordpress/format-library": { "version": "file:packages/format-library", "requires": { diff --git a/package.json b/package.json index 22cdf2ce7acc88..63d42613c31978 100644 --- a/package.json +++ b/package.json @@ -52,6 +52,7 @@ "@wordpress/editor": "file:packages/editor", "@wordpress/element": "file:packages/element", "@wordpress/escape-html": "file:packages/escape-html", + "@wordpress/fields": "file:packages/fields", "@wordpress/format-library": "file:packages/format-library", "@wordpress/hooks": "file:packages/hooks", "@wordpress/html-entities": "file:packages/html-entities", diff --git a/packages/fields/.npmrc b/packages/fields/.npmrc new file mode 100644 index 00000000000000..43c97e719a5a82 --- /dev/null +++ b/packages/fields/.npmrc @@ -0,0 +1 @@ +package-lock=false diff --git a/packages/fields/CHANGELOG.md b/packages/fields/CHANGELOG.md new file mode 100644 index 00000000000000..e04ce921cdfdc4 --- /dev/null +++ b/packages/fields/CHANGELOG.md @@ -0,0 +1,5 @@ + + +## Unreleased + +Initial release. diff --git a/packages/fields/README.md b/packages/fields/README.md new file mode 100644 index 00000000000000..c69c11e566c757 --- /dev/null +++ b/packages/fields/README.md @@ -0,0 +1,23 @@ +# Fields + +This package includes a set of field controls for the DataView library, designed for creating and managing data display elements within WordPress. + +## Installation + +Install the module + +```bash +npm install @wordpress/fields --save +``` + +## Usage + + + +## Contributing to this package + +This is an individual package that's part of the Gutenberg project. The project is organized as a monorepo. It's made up of multiple self-contained software packages, each with a specific purpose. The packages in this monorepo are published to [npm](https://www.npmjs.com/) and used by [WordPress](https://make.wordpress.org/core/) as well as other software projects. + +To find out more about contributing to this package or Gutenberg as a whole, please read the project's main [contributor guide](https://github.com/WordPress/gutenberg/tree/HEAD/CONTRIBUTING.md). + +

Code is Poetry.

diff --git a/packages/fields/package.json b/packages/fields/package.json new file mode 100644 index 00000000000000..af2dafac9c3a35 --- /dev/null +++ b/packages/fields/package.json @@ -0,0 +1,53 @@ +{ + "name": "@wordpress/fields", + "version": "0.0.1", + "description": "DataViews is a component that provides an API to render datasets using different types of layouts (table, grid, list, etc.).", + "author": "The WordPress Contributors", + "license": "GPL-2.0-or-later", + "keywords": [ + "wordpress", + "gutenberg", + "dataviews" + ], + "homepage": "https://github.com/WordPress/gutenberg/tree/HEAD/packages/fields/README.md", + "repository": { + "type": "git", + "url": "https://github.com/WordPress/gutenberg.git", + "directory": "packages/fields" + }, + "bugs": { + "url": "https://github.com/WordPress/gutenberg/issues" + }, + "engines": { + "node": ">=18.12.0", + "npm": ">=8.19.2" + }, + "main": "build/index.js", + "module": "build-module/index.js", + "types": "build-types", + "sideEffects": [ + "build-style/**", + "src/**/*.scss" + ], + "dependencies": { + "@babel/runtime": "^7.16.0", + "@wordpress/components": "file:../components", + "@wordpress/compose": "file:../compose", + "@wordpress/data": "file:../data", + "@wordpress/dataviews": "file:../dataviews", + "@wordpress/element": "file:../element", + "@wordpress/i18n": "file:../i18n", + "@wordpress/icons": "file:../icons", + "@wordpress/notices": "file:../notices", + "@wordpress/primitives": "file:../primitives", + "@wordpress/private-apis": "file:../private-apis", + "@wordpress/url": "file:../url", + "@wordpress/warning": "file:../warning" + }, + "peerDependencies": { + "react": "^18.0.0" + }, + "publishConfig": { + "access": "public" + } +} diff --git a/packages/fields/src/index.ts b/packages/fields/src/index.ts new file mode 100644 index 00000000000000..82c30d5290c28a --- /dev/null +++ b/packages/fields/src/index.ts @@ -0,0 +1,8 @@ +/** + * Internal dependencies + */ +import { lock } from './lock-unlock'; + +export const privateApis = {}; + +lock( privateApis, {} ); diff --git a/packages/fields/src/lock-unlock.ts b/packages/fields/src/lock-unlock.ts new file mode 100644 index 00000000000000..c87e7bbcd1ebf2 --- /dev/null +++ b/packages/fields/src/lock-unlock.ts @@ -0,0 +1,10 @@ +/** + * WordPress dependencies + */ +import { __dangerousOptInToUnstableAPIsOnlyForCoreModules } from '@wordpress/private-apis'; + +export const { lock, unlock } = + __dangerousOptInToUnstableAPIsOnlyForCoreModules( + 'I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.', + '@wordpress/fields' + ); diff --git a/packages/fields/tsconfig.json b/packages/fields/tsconfig.json new file mode 100644 index 00000000000000..10faef0372ae24 --- /dev/null +++ b/packages/fields/tsconfig.json @@ -0,0 +1,24 @@ +{ + "$schema": "https://json.schemastore.org/tsconfig.json", + "extends": "../../tsconfig.base.json", + "compilerOptions": { + "rootDir": "src", + "declarationDir": "build-types", + "checkJs": false + }, + "references": [ + { "path": "../components" }, + { "path": "../compose" }, + { "path": "../data" }, + { "path": "../element" }, + { "path": "../i18n" }, + { "path": "../icons" }, + { "path": "../primitives" }, + { "path": "../private-apis" }, + { "path": "../warning" }, + { "path": "../url" }, + { "path": "../notices" }, + { "path": "../dataviews" } + ], + "include": [ "src" ] +} diff --git a/packages/private-apis/src/implementation.js b/packages/private-apis/src/implementation.js index c268e46f669cbf..13ee9873e899de 100644 --- a/packages/private-apis/src/implementation.js +++ b/packages/private-apis/src/implementation.js @@ -31,6 +31,7 @@ const CORE_MODULES_USING_PRIVATE_APIS = [ '@wordpress/reusable-blocks', '@wordpress/router', '@wordpress/dataviews', + '@wordpress/fields', ]; /** diff --git a/tsconfig.json b/tsconfig.json index 6be31e9b61bef8..3ab54f66019bca 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -25,6 +25,7 @@ { "path": "packages/element" }, { "path": "packages/escape-html" }, { "path": "packages/eslint-plugin" }, + { "path": "packages/fields" }, { "path": "packages/hooks" }, { "path": "packages/html-entities" }, { "path": "packages/html-entities" },