@wp-typia/block-types 0.1.3 → 0.2.0
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 +46 -1
- package/dist/block-editor/index.d.ts +1 -0
- package/dist/block-editor/index.js +1 -0
- package/dist/block-editor/style-attributes.d.ts +147 -0
- package/dist/block-editor/style-attributes.js +1 -0
- package/dist/blocks/supports.d.ts +164 -6
- package/dist/blocks/supports.js +41 -32
- package/package.json +6 -1
package/README.md
CHANGED
|
@@ -15,6 +15,7 @@ Shared WordPress block semantic types derived from Gutenberg source and unoffici
|
|
|
15
15
|
- `@wp-typia/block-types/block-editor/alignment`
|
|
16
16
|
- `@wp-typia/block-types/block-editor/layout`
|
|
17
17
|
- `@wp-typia/block-types/block-editor/spacing`
|
|
18
|
+
- `@wp-typia/block-types/block-editor/style-attributes`
|
|
18
19
|
- `@wp-typia/block-types/block-editor/typography`
|
|
19
20
|
- `@wp-typia/block-types/blocks`
|
|
20
21
|
- `@wp-typia/block-types/blocks/supports`
|
|
@@ -32,12 +33,56 @@ Shared WordPress block semantic types derived from Gutenberg source and unoffici
|
|
|
32
33
|
- color and dimensions helper types
|
|
33
34
|
- layout and flex vocabulary
|
|
34
35
|
- spacing sides and axes
|
|
36
|
+
- support-generated block style attribute helpers
|
|
35
37
|
- typography enums used by core block supports
|
|
36
|
-
- block support
|
|
38
|
+
- structural block support types for `block.json`
|
|
39
|
+
- additive stable Core coverage for drop caps, spacing sizes, layout gaps,
|
|
40
|
+
duotone, per-side border widths, and `js` / `locking`
|
|
41
|
+
|
|
42
|
+
## WordPress style support helpers
|
|
43
|
+
|
|
44
|
+
The package now exposes two complementary surfaces:
|
|
45
|
+
|
|
46
|
+
- `@wp-typia/block-types/blocks/supports` for typed `block.json` `supports`
|
|
47
|
+
- `@wp-typia/block-types/block-editor/style-attributes` for the attribute and `style` shapes WordPress injects when those supports are enabled
|
|
48
|
+
|
|
49
|
+
Example:
|
|
50
|
+
|
|
51
|
+
```ts
|
|
52
|
+
import type { BlockStyleSupportAttributes } from '@wp-typia/block-types/block-editor/style-attributes';
|
|
53
|
+
import type { BlockSupports } from '@wp-typia/block-types/blocks/supports';
|
|
54
|
+
|
|
55
|
+
const supports: BlockSupports = {
|
|
56
|
+
color: { text: true, background: true, gradients: true, enableAlpha: true },
|
|
57
|
+
spacing: {
|
|
58
|
+
padding: true,
|
|
59
|
+
units: ['px', 'rem'],
|
|
60
|
+
spacingSizes: [{ name: 'Large', slug: 'large', size: '2rem' }],
|
|
61
|
+
},
|
|
62
|
+
typography: { fontSize: true, dropCap: true },
|
|
63
|
+
js: true,
|
|
64
|
+
locking: true,
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
type MyBlockStyleAttrs = Pick<
|
|
68
|
+
BlockStyleSupportAttributes,
|
|
69
|
+
'backgroundColor' | 'fontSize' | 'style' | 'textColor'
|
|
70
|
+
>;
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
Stable Core coverage now also includes support/style helpers for layout
|
|
74
|
+
`rowGap` / `columnGap`, color `duotone`, per-side border widths, and other
|
|
75
|
+
recently stabilized support keys.
|
|
76
|
+
|
|
77
|
+
`__experimentalSkipSerialization` is also typed on selected support sections
|
|
78
|
+
for blocks that compute style output on the server. This follows Gutenberg's
|
|
79
|
+
current experimental surface and should not be treated as a long-term
|
|
80
|
+
stability guarantee.
|
|
37
81
|
|
|
38
82
|
## Typia pipeline notes
|
|
39
83
|
|
|
40
84
|
- `CssColorValue` and `MinHeightValue` are richer DX aliases that currently rely on template literal types.
|
|
85
|
+
- `BlockStyleAttributes` also contains template-literal-style preset references such as `var:preset|color|...` for editor/runtime DX.
|
|
41
86
|
- imported template literal aliases are not yet consumed by the `sync-types` metadata pipeline
|
|
42
87
|
- when a type must round-trip through `types.ts` -> `typia.manifest.json` -> `typia-validator.php`, prefer pipeline-compatible aliases such as `CssNamedColor` and `MinHeightKeyword`
|
|
43
88
|
- for broader CSS-like string shapes in `types.ts`, prefer native Typia constraints on `string`, for example `string & tags.Pattern<"..."> & tags.MaxLength<...>`
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import type { TextAlignment } from './alignment';
|
|
2
|
+
import type { CssColorValue } from './color';
|
|
3
|
+
import type { AspectRatio, MinHeightKeyword, MinHeightValue } from './dimensions';
|
|
4
|
+
import type { SpacingDimension } from './spacing';
|
|
5
|
+
import type { FontStyle, TextDecoration, TextTransform, WritingMode } from './typography';
|
|
6
|
+
export type PresetColorReference = `var:preset|color|${string}`;
|
|
7
|
+
export type PresetDuotoneReference = `var:preset|duotone|${string}`;
|
|
8
|
+
export type PresetGradientReference = `var:preset|gradient|${string}`;
|
|
9
|
+
export type PresetFontFamilyReference = `var:preset|font-family|${string}`;
|
|
10
|
+
export type PresetFontSizeReference = `var:preset|font-size|${string}`;
|
|
11
|
+
/**
|
|
12
|
+
* Slug-like attributes that WordPress stores outside the `style` object when a
|
|
13
|
+
* support value maps to a named preset instead of a literal CSS value.
|
|
14
|
+
*
|
|
15
|
+
* These stay intentionally broad and pipeline-compatible so generated metadata
|
|
16
|
+
* can still flow through Typia's current source analysis. They currently carry
|
|
17
|
+
* semantic intent without narrowing beyond `string`.
|
|
18
|
+
*/
|
|
19
|
+
export type BlockColorSlug = string;
|
|
20
|
+
export type BlockGradientSlug = string;
|
|
21
|
+
export type BlockFontFamilySlug = string;
|
|
22
|
+
export type BlockFontSizeSlug = string;
|
|
23
|
+
/**
|
|
24
|
+
* Rich style-level color values that mirror the strings Gutenberg stores inside
|
|
25
|
+
* the `style` attribute when a block uses color support.
|
|
26
|
+
*/
|
|
27
|
+
export type BlockStyleColorValue = CssColorValue | PresetColorReference;
|
|
28
|
+
/**
|
|
29
|
+
* Practical gradient vocabulary for block support `style.color.gradient`.
|
|
30
|
+
*/
|
|
31
|
+
export type BlockStyleGradientValue = `linear-gradient(${string})` | `radial-gradient(${string})` | `conic-gradient(${string})` | PresetGradientReference;
|
|
32
|
+
/**
|
|
33
|
+
* Typography values stored under `style.typography.*`.
|
|
34
|
+
*
|
|
35
|
+
* These are DX-oriented string surfaces. When the values must round-trip
|
|
36
|
+
* through Typia metadata generation, prefer explicit `string` constraints in
|
|
37
|
+
* project-authored `types.ts`.
|
|
38
|
+
*/
|
|
39
|
+
export type BlockStyleFontSizeValue = string | PresetFontSizeReference;
|
|
40
|
+
export type BlockStyleFontFamilyValue = string | PresetFontFamilyReference;
|
|
41
|
+
export type BlockStyleSpacingValue = string | number;
|
|
42
|
+
export type BlockStyleBorderWidthValue = string | number;
|
|
43
|
+
export type BlockStyleBorderRadiusValue = string | number;
|
|
44
|
+
export type BlockShadowStyleAttributes = string;
|
|
45
|
+
export interface BlockLinkColorAttributes {
|
|
46
|
+
readonly background?: BlockStyleColorValue;
|
|
47
|
+
readonly text?: BlockStyleColorValue;
|
|
48
|
+
}
|
|
49
|
+
export interface BlockElementsStyleAttributes {
|
|
50
|
+
readonly link?: {
|
|
51
|
+
readonly color?: BlockLinkColorAttributes;
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
export interface BlockColorStyleAttributes {
|
|
55
|
+
readonly background?: BlockStyleColorValue;
|
|
56
|
+
readonly duotone?: string | PresetDuotoneReference | readonly [CssColorValue, CssColorValue];
|
|
57
|
+
readonly gradient?: BlockStyleGradientValue;
|
|
58
|
+
readonly text?: BlockStyleColorValue;
|
|
59
|
+
}
|
|
60
|
+
export interface BlockBorderStyleAttributes {
|
|
61
|
+
readonly color?: BlockStyleColorValue;
|
|
62
|
+
readonly radius?: BlockStyleBorderRadiusValue;
|
|
63
|
+
readonly style?: string;
|
|
64
|
+
readonly topLeftRadius?: BlockStyleBorderRadiusValue;
|
|
65
|
+
readonly topRightRadius?: BlockStyleBorderRadiusValue;
|
|
66
|
+
readonly bottomLeftRadius?: BlockStyleBorderRadiusValue;
|
|
67
|
+
readonly bottomRightRadius?: BlockStyleBorderRadiusValue;
|
|
68
|
+
readonly bottomWidth?: BlockStyleBorderWidthValue;
|
|
69
|
+
readonly leftWidth?: BlockStyleBorderWidthValue;
|
|
70
|
+
readonly rightWidth?: BlockStyleBorderWidthValue;
|
|
71
|
+
readonly topWidth?: BlockStyleBorderWidthValue;
|
|
72
|
+
readonly width?: BlockStyleBorderWidthValue;
|
|
73
|
+
}
|
|
74
|
+
export interface BlockDimensionsStyleAttributes {
|
|
75
|
+
readonly aspectRatio?: AspectRatio;
|
|
76
|
+
readonly minHeight?: MinHeightKeyword | MinHeightValue;
|
|
77
|
+
}
|
|
78
|
+
export interface BlockSpacingStyleAttributes {
|
|
79
|
+
readonly blockGap?: BlockStyleSpacingValue;
|
|
80
|
+
readonly margin?: BlockStyleSpacingValue | Partial<Record<SpacingDimension, BlockStyleSpacingValue>>;
|
|
81
|
+
readonly padding?: BlockStyleSpacingValue | Partial<Record<SpacingDimension, BlockStyleSpacingValue>>;
|
|
82
|
+
}
|
|
83
|
+
export interface BlockTypographyStyleAttributes {
|
|
84
|
+
readonly fontFamily?: BlockStyleFontFamilyValue;
|
|
85
|
+
readonly fontSize?: BlockStyleFontSizeValue;
|
|
86
|
+
readonly fontStyle?: FontStyle;
|
|
87
|
+
readonly fontWeight?: string | number;
|
|
88
|
+
readonly letterSpacing?: string;
|
|
89
|
+
readonly lineHeight?: string | number;
|
|
90
|
+
readonly textAlign?: TextAlignment;
|
|
91
|
+
readonly textColumns?: number;
|
|
92
|
+
readonly textDecoration?: TextDecoration;
|
|
93
|
+
readonly textTransform?: TextTransform;
|
|
94
|
+
readonly writingMode?: WritingMode;
|
|
95
|
+
}
|
|
96
|
+
export interface BlockPositionStyleAttributes {
|
|
97
|
+
readonly bottom?: string;
|
|
98
|
+
readonly left?: string;
|
|
99
|
+
readonly right?: string;
|
|
100
|
+
readonly top?: string;
|
|
101
|
+
readonly type?: 'fixed' | 'sticky';
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* WordPress-global-style-compatible `style` attribute shape for blocks that opt
|
|
105
|
+
* into supports such as color, spacing, typography, border, or dimensions.
|
|
106
|
+
*/
|
|
107
|
+
export interface BlockStyleAttributes {
|
|
108
|
+
readonly border?: BlockBorderStyleAttributes;
|
|
109
|
+
readonly color?: BlockColorStyleAttributes;
|
|
110
|
+
readonly dimensions?: BlockDimensionsStyleAttributes;
|
|
111
|
+
readonly elements?: BlockElementsStyleAttributes;
|
|
112
|
+
readonly position?: BlockPositionStyleAttributes;
|
|
113
|
+
readonly shadow?: BlockShadowStyleAttributes;
|
|
114
|
+
readonly spacing?: BlockSpacingStyleAttributes;
|
|
115
|
+
readonly typography?: BlockTypographyStyleAttributes;
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Slug-based attributes plus the shared `style` object that WordPress injects
|
|
119
|
+
* for color support.
|
|
120
|
+
*/
|
|
121
|
+
export interface BlockColorSupportAttributes {
|
|
122
|
+
readonly backgroundColor?: BlockColorSlug;
|
|
123
|
+
readonly gradient?: BlockGradientSlug;
|
|
124
|
+
readonly style?: BlockStyleAttributes;
|
|
125
|
+
readonly textColor?: BlockColorSlug;
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Slug-based typography attributes plus the shared `style` object used for
|
|
129
|
+
* literal values.
|
|
130
|
+
*/
|
|
131
|
+
export interface BlockTypographySupportAttributes {
|
|
132
|
+
readonly fontFamily?: BlockFontFamilySlug;
|
|
133
|
+
readonly fontSize?: BlockFontSizeSlug;
|
|
134
|
+
readonly style?: BlockStyleAttributes;
|
|
135
|
+
}
|
|
136
|
+
export interface BlockSpacingSupportAttributes {
|
|
137
|
+
readonly style?: BlockStyleAttributes;
|
|
138
|
+
}
|
|
139
|
+
export interface BlockDimensionsSupportAttributes {
|
|
140
|
+
readonly style?: BlockStyleAttributes;
|
|
141
|
+
}
|
|
142
|
+
export interface BlockBorderSupportAttributes {
|
|
143
|
+
readonly borderColor?: string;
|
|
144
|
+
readonly style?: BlockStyleAttributes;
|
|
145
|
+
}
|
|
146
|
+
export interface BlockStyleSupportAttributes extends BlockBorderSupportAttributes, BlockColorSupportAttributes, BlockDimensionsSupportAttributes, BlockSpacingSupportAttributes, BlockTypographySupportAttributes {
|
|
147
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,9 +1,167 @@
|
|
|
1
|
+
import type { BlockAlignment, BlockVerticalAlignment, JustifyContent, TextAlignment } from '../block-editor/alignment';
|
|
2
|
+
import type { FlexWrap, LayoutType, Orientation } from '../block-editor/layout';
|
|
3
|
+
import type { SpacingAxis, SpacingDimension } from '../block-editor/spacing';
|
|
1
4
|
/**
|
|
2
|
-
* Derived from
|
|
5
|
+
* Derived from Gutenberg block support keys and commonly used block.json
|
|
6
|
+
* support sections.
|
|
3
7
|
*/
|
|
4
|
-
export type BlockSupportFeature =
|
|
5
|
-
export declare const BLOCK_SUPPORT_FEATURES: readonly ["align", "anchor", "ariaLabel", "border", "className", "color", "dimensions", "filter", "html", "interactivity", "layout", "lightbox", "lock", "position", "renaming", "shadow", "spacing", "typography"];
|
|
6
|
-
export type TypographySupportKey =
|
|
7
|
-
export declare const TYPOGRAPHY_SUPPORT_KEYS: readonly ["fontFamily", "fontSize", "fontStyle", "fontWeight", "letterSpacing", "lineHeight", "textAlign", "textColumns", "textDecoration", "textTransform", "writingMode"];
|
|
8
|
-
export type SpacingSupportKey =
|
|
8
|
+
export type BlockSupportFeature = 'align' | 'alignWide' | 'anchor' | 'ariaLabel' | 'background' | 'border' | 'className' | 'color' | 'customClassName' | 'dimensions' | 'filter' | 'html' | 'inserter' | 'interactivity' | 'js' | 'layout' | 'lightbox' | 'lock' | 'locking' | 'multiple' | 'position' | 'renaming' | 'reusable' | 'shadow' | 'spacing' | 'typography';
|
|
9
|
+
export declare const BLOCK_SUPPORT_FEATURES: readonly ["align", "alignWide", "anchor", "ariaLabel", "background", "border", "className", "color", "customClassName", "dimensions", "filter", "html", "inserter", "interactivity", "js", "layout", "lightbox", "lock", "locking", "multiple", "position", "renaming", "reusable", "shadow", "spacing", "typography"];
|
|
10
|
+
export type TypographySupportKey = 'fontFamily' | 'fontSize' | 'fontStyle' | 'fontWeight' | 'letterSpacing' | 'lineHeight' | 'dropCap' | 'textAlign' | 'textColumns' | 'textDecoration' | 'textTransform' | 'writingMode';
|
|
11
|
+
export declare const TYPOGRAPHY_SUPPORT_KEYS: readonly ["fontFamily", "fontSize", "fontStyle", "fontWeight", "letterSpacing", "lineHeight", "dropCap", "textAlign", "textColumns", "textDecoration", "textTransform", "writingMode"];
|
|
12
|
+
export type SpacingSupportKey = 'blockGap' | 'margin' | 'padding';
|
|
9
13
|
export declare const SPACING_SUPPORT_KEYS: readonly ["blockGap", "margin", "padding"];
|
|
14
|
+
type BlockSupportDefaultControls<TFeature extends string> = Readonly<Partial<Record<TFeature, boolean>> & Record<string, boolean | undefined>>;
|
|
15
|
+
export type SkipSerialization<TFeature extends string> = boolean | readonly TFeature[];
|
|
16
|
+
export interface BlockBorderSupport {
|
|
17
|
+
readonly color?: boolean;
|
|
18
|
+
readonly radius?: boolean;
|
|
19
|
+
readonly style?: boolean;
|
|
20
|
+
readonly width?: boolean;
|
|
21
|
+
readonly __experimentalSkipSerialization?: SkipSerialization<'color' | 'radius' | 'style' | 'width'>;
|
|
22
|
+
readonly __experimentalDefaultControls?: BlockSupportDefaultControls<'color' | 'radius' | 'style' | 'width'>;
|
|
23
|
+
}
|
|
24
|
+
export interface BlockBackgroundSupport {
|
|
25
|
+
readonly backgroundImage?: boolean;
|
|
26
|
+
readonly backgroundSize?: boolean;
|
|
27
|
+
}
|
|
28
|
+
export interface BlockColorSupport {
|
|
29
|
+
readonly background?: boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Dedicated button color support documented in the Block Supports reference
|
|
32
|
+
* as stable since WordPress 6.5.
|
|
33
|
+
*/
|
|
34
|
+
readonly button?: boolean;
|
|
35
|
+
readonly enableAlpha?: boolean;
|
|
36
|
+
readonly enableContrastChecker?: boolean;
|
|
37
|
+
readonly gradients?: boolean;
|
|
38
|
+
/**
|
|
39
|
+
* Dedicated heading color support documented in the Block Supports reference
|
|
40
|
+
* as stable since WordPress 6.5.
|
|
41
|
+
*/
|
|
42
|
+
readonly heading?: boolean;
|
|
43
|
+
readonly link?: boolean;
|
|
44
|
+
readonly text?: boolean;
|
|
45
|
+
readonly __experimentalSkipSerialization?: SkipSerialization<'background' | 'button' | 'gradients' | 'heading' | 'link' | 'text'>;
|
|
46
|
+
readonly __experimentalDefaultControls?: BlockSupportDefaultControls<'background' | 'gradients' | 'link' | 'text'>;
|
|
47
|
+
}
|
|
48
|
+
export interface BlockDimensionsSupport {
|
|
49
|
+
readonly aspectRatio?: boolean;
|
|
50
|
+
readonly height?: boolean;
|
|
51
|
+
readonly minHeight?: boolean;
|
|
52
|
+
readonly width?: boolean;
|
|
53
|
+
readonly __experimentalSkipSerialization?: SkipSerialization<'aspectRatio' | 'height' | 'minHeight' | 'width'>;
|
|
54
|
+
readonly __experimentalDefaultControls?: BlockSupportDefaultControls<'aspectRatio' | 'height' | 'minHeight' | 'width'>;
|
|
55
|
+
}
|
|
56
|
+
export interface BlockFilterSupport {
|
|
57
|
+
readonly duotone?: boolean;
|
|
58
|
+
}
|
|
59
|
+
export interface BlockInteractivitySupport {
|
|
60
|
+
readonly clientNavigation?: boolean;
|
|
61
|
+
readonly interactive?: boolean;
|
|
62
|
+
}
|
|
63
|
+
export interface BlockLayoutDefault {
|
|
64
|
+
readonly columnCount?: number;
|
|
65
|
+
readonly columnGap?: string;
|
|
66
|
+
readonly contentSize?: string;
|
|
67
|
+
readonly allowInheriting?: boolean;
|
|
68
|
+
readonly allowSizingOnChildren?: boolean;
|
|
69
|
+
readonly flexWrap?: FlexWrap;
|
|
70
|
+
readonly justifyContent?: JustifyContent;
|
|
71
|
+
readonly minimumColumnWidth?: string;
|
|
72
|
+
readonly orientation?: Orientation;
|
|
73
|
+
readonly rowGap?: string;
|
|
74
|
+
readonly type?: LayoutType;
|
|
75
|
+
readonly verticalAlignment?: BlockVerticalAlignment;
|
|
76
|
+
readonly wideSize?: string;
|
|
77
|
+
}
|
|
78
|
+
export interface BlockLayoutSupport {
|
|
79
|
+
readonly allowCustomContentAndWideSize?: boolean;
|
|
80
|
+
readonly allowEditing?: boolean;
|
|
81
|
+
readonly allowInheriting?: boolean;
|
|
82
|
+
readonly allowJustification?: boolean;
|
|
83
|
+
readonly allowOrientation?: boolean;
|
|
84
|
+
readonly allowSizingOnChildren?: boolean;
|
|
85
|
+
readonly allowSwitching?: boolean;
|
|
86
|
+
readonly allowVerticalAlignment?: boolean;
|
|
87
|
+
readonly allowWrap?: boolean;
|
|
88
|
+
readonly default?: BlockLayoutDefault;
|
|
89
|
+
}
|
|
90
|
+
export interface BlockLightboxSupport {
|
|
91
|
+
readonly allowEditing?: boolean;
|
|
92
|
+
readonly enabled?: boolean;
|
|
93
|
+
}
|
|
94
|
+
export interface BlockPositionSupport {
|
|
95
|
+
readonly fixed?: boolean;
|
|
96
|
+
readonly sticky?: boolean;
|
|
97
|
+
readonly __experimentalDefaultControls?: BlockSupportDefaultControls<'fixed' | 'sticky'>;
|
|
98
|
+
}
|
|
99
|
+
export interface BlockShadowSupport {
|
|
100
|
+
readonly __experimentalDefaultControls?: BlockSupportDefaultControls<'shadow'>;
|
|
101
|
+
}
|
|
102
|
+
export interface SpacingSize {
|
|
103
|
+
readonly name: string;
|
|
104
|
+
readonly size: string;
|
|
105
|
+
readonly slug: string;
|
|
106
|
+
}
|
|
107
|
+
export interface BlockSpacingSupport {
|
|
108
|
+
readonly blockGap?: boolean | readonly SpacingAxis[];
|
|
109
|
+
readonly margin?: boolean | readonly SpacingDimension[];
|
|
110
|
+
readonly padding?: boolean | readonly SpacingDimension[];
|
|
111
|
+
readonly spacingSizes?: readonly SpacingSize[];
|
|
112
|
+
readonly units?: readonly string[];
|
|
113
|
+
readonly __experimentalSkipSerialization?: SkipSerialization<SpacingSupportKey>;
|
|
114
|
+
readonly __experimentalDefaultControls?: BlockSupportDefaultControls<SpacingSupportKey>;
|
|
115
|
+
}
|
|
116
|
+
export interface BlockTypographySupport {
|
|
117
|
+
readonly dropCap?: boolean;
|
|
118
|
+
readonly fontFamily?: boolean;
|
|
119
|
+
readonly fontSize?: boolean;
|
|
120
|
+
readonly fontStyle?: boolean;
|
|
121
|
+
readonly fontWeight?: boolean;
|
|
122
|
+
readonly letterSpacing?: boolean;
|
|
123
|
+
readonly lineHeight?: boolean;
|
|
124
|
+
readonly textAlign?: boolean | readonly TextAlignment[];
|
|
125
|
+
readonly textColumns?: boolean;
|
|
126
|
+
readonly textDecoration?: boolean;
|
|
127
|
+
readonly textTransform?: boolean;
|
|
128
|
+
readonly writingMode?: boolean;
|
|
129
|
+
readonly __experimentalSkipSerialization?: SkipSerialization<TypographySupportKey>;
|
|
130
|
+
readonly __experimentalDefaultControls?: BlockSupportDefaultControls<TypographySupportKey>;
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Practical WP 6.9+ block support surface for block.json metadata and
|
|
134
|
+
* registration helpers.
|
|
135
|
+
*
|
|
136
|
+
* This intentionally models the common public subtrees instead of mirroring
|
|
137
|
+
* every Gutenberg-internal experimental flag.
|
|
138
|
+
*/
|
|
139
|
+
export interface BlockSupports {
|
|
140
|
+
readonly align?: boolean | readonly BlockAlignment[];
|
|
141
|
+
readonly alignWide?: boolean;
|
|
142
|
+
readonly anchor?: boolean;
|
|
143
|
+
readonly ariaLabel?: boolean;
|
|
144
|
+
readonly background?: boolean | BlockBackgroundSupport;
|
|
145
|
+
readonly border?: boolean | BlockBorderSupport;
|
|
146
|
+
readonly className?: boolean;
|
|
147
|
+
readonly color?: boolean | BlockColorSupport;
|
|
148
|
+
readonly customClassName?: boolean;
|
|
149
|
+
readonly dimensions?: boolean | BlockDimensionsSupport;
|
|
150
|
+
readonly filter?: boolean | BlockFilterSupport;
|
|
151
|
+
readonly html?: boolean;
|
|
152
|
+
readonly inserter?: boolean;
|
|
153
|
+
readonly interactivity?: boolean | BlockInteractivitySupport;
|
|
154
|
+
readonly js?: boolean;
|
|
155
|
+
readonly layout?: boolean | BlockLayoutSupport;
|
|
156
|
+
readonly lightbox?: boolean | BlockLightboxSupport;
|
|
157
|
+
readonly lock?: boolean;
|
|
158
|
+
readonly locking?: boolean;
|
|
159
|
+
readonly multiple?: boolean;
|
|
160
|
+
readonly position?: boolean | BlockPositionSupport;
|
|
161
|
+
readonly renaming?: boolean;
|
|
162
|
+
readonly reusable?: boolean;
|
|
163
|
+
readonly shadow?: boolean | BlockShadowSupport;
|
|
164
|
+
readonly spacing?: boolean | BlockSpacingSupport;
|
|
165
|
+
readonly typography?: boolean | BlockTypographySupport;
|
|
166
|
+
}
|
|
167
|
+
export {};
|
package/dist/blocks/supports.js
CHANGED
|
@@ -1,38 +1,47 @@
|
|
|
1
1
|
export const BLOCK_SUPPORT_FEATURES = [
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
2
|
+
'align',
|
|
3
|
+
'alignWide',
|
|
4
|
+
'anchor',
|
|
5
|
+
'ariaLabel',
|
|
6
|
+
'background',
|
|
7
|
+
'border',
|
|
8
|
+
'className',
|
|
9
|
+
'color',
|
|
10
|
+
'customClassName',
|
|
11
|
+
'dimensions',
|
|
12
|
+
'filter',
|
|
13
|
+
'html',
|
|
14
|
+
'inserter',
|
|
15
|
+
'interactivity',
|
|
16
|
+
'js',
|
|
17
|
+
'layout',
|
|
18
|
+
'lightbox',
|
|
19
|
+
'lock',
|
|
20
|
+
'locking',
|
|
21
|
+
'multiple',
|
|
22
|
+
'position',
|
|
23
|
+
'renaming',
|
|
24
|
+
'reusable',
|
|
25
|
+
'shadow',
|
|
26
|
+
'spacing',
|
|
27
|
+
'typography',
|
|
20
28
|
];
|
|
21
29
|
export const TYPOGRAPHY_SUPPORT_KEYS = [
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
30
|
+
'fontFamily',
|
|
31
|
+
'fontSize',
|
|
32
|
+
'fontStyle',
|
|
33
|
+
'fontWeight',
|
|
34
|
+
'letterSpacing',
|
|
35
|
+
'lineHeight',
|
|
36
|
+
'dropCap',
|
|
37
|
+
'textAlign',
|
|
38
|
+
'textColumns',
|
|
39
|
+
'textDecoration',
|
|
40
|
+
'textTransform',
|
|
41
|
+
'writingMode',
|
|
33
42
|
];
|
|
34
43
|
export const SPACING_SUPPORT_KEYS = [
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
44
|
+
'blockGap',
|
|
45
|
+
'margin',
|
|
46
|
+
'padding',
|
|
38
47
|
];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wp-typia/block-types",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Shared WordPress block semantic types derived from Gutenberg and unofficial declarations",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -41,6 +41,11 @@
|
|
|
41
41
|
"import": "./dist/block-editor/spacing.js",
|
|
42
42
|
"default": "./dist/block-editor/spacing.js"
|
|
43
43
|
},
|
|
44
|
+
"./block-editor/style-attributes": {
|
|
45
|
+
"types": "./dist/block-editor/style-attributes.d.ts",
|
|
46
|
+
"import": "./dist/block-editor/style-attributes.js",
|
|
47
|
+
"default": "./dist/block-editor/style-attributes.js"
|
|
48
|
+
},
|
|
44
49
|
"./block-editor/typography": {
|
|
45
50
|
"types": "./dist/block-editor/typography.d.ts",
|
|
46
51
|
"import": "./dist/block-editor/typography.js",
|