@wp-typia/block-types 0.2.1 → 0.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -18,12 +18,14 @@ Shared WordPress block semantic types derived from Gutenberg source and unoffici
18
18
  - `@wp-typia/block-types/block-editor/style-attributes`
19
19
  - `@wp-typia/block-types/block-editor/typography`
20
20
  - `@wp-typia/block-types/blocks`
21
+ - `@wp-typia/block-types/blocks/registration`
21
22
  - `@wp-typia/block-types/blocks/supports`
22
23
 
23
24
  ## Current policy
24
25
 
25
26
  - alignment types reuse `@types/wordpress__block-editor` where a narrow union already exists
26
27
  - layout, spacing, typography, and supports types are curated from Gutenberg source when no stable unofficial narrow export exists
28
+ - registration-facing block types are exposed through a local facade that currently adapts the upstream `@wordpress/blocks` declarations behind a stable `@wp-typia/block-types/blocks/registration` boundary
27
29
  - every exported tuple has a matching exported type alias so templates can share both values and semantics
28
30
  - this package is publish-ready, but scaffolded projects will switch to semver usage in the same round
29
31
 
@@ -36,9 +38,39 @@ Shared WordPress block semantic types derived from Gutenberg source and unoffici
36
38
  - support-generated block style attribute helpers
37
39
  - typography enums used by core block supports
38
40
  - structural block support types for `block.json`
41
+ - registration-facing block types for `registerBlockType(...)`,
42
+ `BlockEditProps`, `BlockSaveProps`, `BlockVariation`, deprecations, and
43
+ migration-facing `BlockInstance`
39
44
  - additive stable Core coverage for drop caps, spacing sizes, layout gaps,
40
45
  duotone, per-side border widths, and `js` / `locking`
41
46
 
47
+ ## Registration facade
48
+
49
+ Generated scaffolds and reference apps should prefer the local registration
50
+ facade over direct type imports from `@wordpress/blocks`:
51
+
52
+ ```ts
53
+ import type {
54
+ BlockConfiguration,
55
+ BlockEditProps,
56
+ BlockInstance,
57
+ BlockVariation,
58
+ RegisterBlockTypeResult,
59
+ } from '@wp-typia/block-types/blocks/registration';
60
+ ```
61
+
62
+ The facade is locally owned but targets the current generated-project minimum
63
+ WordPress blocks baseline:
64
+
65
+ - `@wordpress/blocks@^15.2.0`
66
+ - `@types/wordpress__blocks@^12.5.18`
67
+
68
+ The package manifest declares the same pair as peer dependencies so downstream
69
+ TypeScript installs surface the requirement explicitly.
70
+
71
+ Compatibility should track that floor unless the generated project dependency
72
+ matrix changes in the same release.
73
+
42
74
  ## WordPress style support helpers
43
75
 
44
76
  The package now exposes two complementary surfaces:
@@ -1 +1,2 @@
1
- export * from "./supports";
1
+ export * from './registration';
2
+ export * from './supports';
@@ -1 +1,2 @@
1
- export * from "./supports";
1
+ export * from './registration';
2
+ export * from './supports';
@@ -0,0 +1,31 @@
1
+ import type { Block as WordPressRegisteredBlockType, BlockAttribute as WordPressBlockAttribute, BlockConfiguration as WordPressBlockConfiguration, BlockDeprecation as WordPressBlockDeprecation, BlockEditProps as WordPressBlockEditProps, BlockInstance as WordPressBlockInstance, BlockSaveProps as WordPressBlockSaveProps, BlockVariation as WordPressBlockVariation, BlockVariationScope as WordPressBlockVariationScope, InnerBlockTemplate as WordPressInnerBlockTemplate } from '@wordpress/blocks';
2
+ /**
3
+ * Local compatibility facade for the Gutenberg block registration surface.
4
+ *
5
+ * The public contract is owned by `@wp-typia/block-types`, while the current
6
+ * v1 implementation intentionally adapts the upstream `@wordpress/blocks`
7
+ * declarations behind this stable import path.
8
+ */
9
+ export type BlockAttributes = Record<string, any>;
10
+ export type BlockAttribute<TValue = unknown> = WordPressBlockAttribute<TValue>;
11
+ export type BlockSaveProps<TAttributes extends BlockAttributes = BlockAttributes> = WordPressBlockSaveProps<TAttributes>;
12
+ export type BlockEditProps<TAttributes extends BlockAttributes = BlockAttributes> = WordPressBlockEditProps<TAttributes>;
13
+ export type BlockConfiguration<TAttributes extends BlockAttributes = BlockAttributes> = WordPressBlockConfiguration<TAttributes>;
14
+ export type BlockDeprecation<TNewAttributes extends BlockAttributes = BlockAttributes, TOldAttributes extends BlockAttributes = BlockAttributes> = WordPressBlockDeprecation<TNewAttributes, TOldAttributes>;
15
+ export type BlockDeprecationList<TNewAttributes extends BlockAttributes = BlockAttributes, TOldAttributes extends BlockAttributes = BlockAttributes> = ReadonlyArray<BlockDeprecation<TNewAttributes, TOldAttributes>>;
16
+ export type BlockInstance<TAttributes extends BlockAttributes = BlockAttributes> = WordPressBlockInstance<TAttributes>;
17
+ export type BlockInnerTemplate = WordPressInnerBlockTemplate;
18
+ export type BlockTemplate = BlockInnerTemplate[];
19
+ export type BlockVariationScope = WordPressBlockVariationScope;
20
+ export declare const BLOCK_VARIATION_SCOPES: readonly ["block", "inserter", "transform"];
21
+ export type BlockVariation<TAttributes extends BlockAttributes = BlockAttributes> = WordPressBlockVariation<TAttributes>;
22
+ export type RegisteredBlockType<TAttributes extends BlockAttributes = BlockAttributes> = WordPressRegisteredBlockType<TAttributes>;
23
+ export type RegisterBlockTypeResult<TAttributes extends BlockAttributes = BlockAttributes> = RegisteredBlockType<TAttributes> | undefined;
24
+ /**
25
+ * Runtime shim for scaffolded registrations.
26
+ *
27
+ * Generated projects keep strong typing around scaffold metadata while
28
+ * centralizing the compatibility cast required by the currently published
29
+ * `@wordpress/blocks` registration surface.
30
+ */
31
+ export declare function registerScaffoldBlockType<TAttributes extends BlockAttributes = BlockAttributes, TSettings extends object = object>(blockName: string, settings: TSettings): RegisterBlockTypeResult<TAttributes>;
@@ -0,0 +1,9 @@
1
+ import { registerBlockType } from '@wordpress/blocks';
2
+ export const BLOCK_VARIATION_SCOPES = [
3
+ 'block',
4
+ 'inserter',
5
+ 'transform',
6
+ ];
7
+ export function registerScaffoldBlockType(blockName, settings) {
8
+ return registerBlockType(blockName, settings);
9
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wp-typia/block-types",
3
- "version": "0.2.1",
3
+ "version": "0.2.3",
4
4
  "description": "Shared WordPress block semantic types derived from Gutenberg and unofficial declarations",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -56,6 +56,11 @@
56
56
  "import": "./dist/blocks/index.js",
57
57
  "default": "./dist/blocks/index.js"
58
58
  },
59
+ "./blocks/registration": {
60
+ "types": "./dist/blocks/registration.d.ts",
61
+ "import": "./dist/blocks/registration.js",
62
+ "default": "./dist/blocks/registration.js"
63
+ },
59
64
  "./blocks/supports": {
60
65
  "types": "./dist/blocks/supports.d.ts",
61
66
  "import": "./dist/blocks/supports.js",
@@ -92,9 +97,14 @@
92
97
  "npm": ">=10.0.0",
93
98
  "bun": ">=1.3.11"
94
99
  },
100
+ "peerDependencies": {
101
+ "@types/wordpress__blocks": "^12.5.18",
102
+ "@wordpress/blocks": "^15.2.0"
103
+ },
95
104
  "devDependencies": {
96
105
  "@types/react": "^18.3.12",
97
106
  "@types/wordpress__block-editor": "^11.5.17",
107
+ "@types/wordpress__blocks": "^12.5.18",
98
108
  "typescript": "^5.9.2"
99
109
  }
100
110
  }