@wp-typia/project-tools 0.16.1 → 0.16.4

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.
Files changed (67) hide show
  1. package/README.md +17 -0
  2. package/dist/runtime/block-generator-service.d.ts +102 -0
  3. package/dist/runtime/block-generator-service.js +268 -0
  4. package/dist/runtime/built-in-block-artifacts.d.ts +37 -0
  5. package/dist/runtime/built-in-block-artifacts.js +1203 -0
  6. package/dist/runtime/built-in-block-code-artifacts.d.ts +30 -0
  7. package/dist/runtime/built-in-block-code-artifacts.js +122 -0
  8. package/dist/runtime/index.d.ts +2 -0
  9. package/dist/runtime/index.js +1 -0
  10. package/dist/runtime/package-versions.js +7 -2
  11. package/dist/runtime/scaffold-apply-utils.d.ts +47 -0
  12. package/dist/runtime/scaffold-apply-utils.js +405 -0
  13. package/dist/runtime/scaffold-identifiers.d.ts +34 -0
  14. package/dist/runtime/scaffold-identifiers.js +82 -0
  15. package/dist/runtime/scaffold.js +33 -0
  16. package/dist/runtime/schema-core.d.ts +5 -266
  17. package/dist/runtime/schema-core.js +5 -775
  18. package/dist/runtime/starter-manifests.d.ts +3 -2
  19. package/dist/runtime/starter-manifests.js +15 -365
  20. package/dist/runtime/template-render.d.ts +5 -0
  21. package/dist/runtime/template-render.js +13 -3
  22. package/package.json +56 -3
  23. package/templates/_shared/compound/persistence/scripts/block-config.ts.mustache +4 -4
  24. package/templates/_shared/persistence/core/scripts/sync-rest-contracts.ts.mustache +4 -4
  25. package/templates/_shared/base/src/hooks.ts.mustache +0 -19
  26. package/templates/_shared/compound/persistence/src/blocks/{{slugKebabCase}}/block.json.mustache +0 -52
  27. package/templates/_shared/compound/persistence/src/blocks/{{slugKebabCase}}/edit.tsx.mustache +0 -123
  28. package/templates/_shared/compound/persistence/src/blocks/{{slugKebabCase}}/hooks.ts.mustache +0 -11
  29. package/templates/_shared/compound/persistence/src/blocks/{{slugKebabCase}}/interactivity.ts.mustache +0 -305
  30. package/templates/_shared/compound/persistence/src/blocks/{{slugKebabCase}}/save.tsx.mustache +0 -3
  31. package/templates/_shared/compound/persistence/src/blocks/{{slugKebabCase}}/types.ts.mustache +0 -61
  32. package/templates/_shared/compound/persistence/src/blocks/{{slugKebabCase}}/validators.ts.mustache +0 -43
  33. package/templates/_shared/persistence/core/src/index.tsx.mustache +0 -25
  34. package/templates/_shared/persistence/core/src/interactivity.ts.mustache +0 -308
  35. package/templates/_shared/persistence/core/src/save.tsx.mustache +0 -5
  36. package/templates/_shared/persistence/core/src/validators.ts.mustache +0 -43
  37. package/templates/basic/src/block.json.mustache +0 -51
  38. package/templates/basic/src/edit.tsx.mustache +0 -128
  39. package/templates/basic/src/index.tsx.mustache +0 -45
  40. package/templates/basic/src/save.tsx.mustache +0 -30
  41. package/templates/basic/src/types.ts.mustache +0 -56
  42. package/templates/basic/src/validators.ts.mustache +0 -37
  43. package/templates/compound/src/blocks/{{slugKebabCase}}/block.json.mustache +0 -37
  44. package/templates/compound/src/blocks/{{slugKebabCase}}/children.ts.mustache +0 -25
  45. package/templates/compound/src/blocks/{{slugKebabCase}}/edit.tsx.mustache +0 -93
  46. package/templates/compound/src/blocks/{{slugKebabCase}}/hooks.ts.mustache +0 -11
  47. package/templates/compound/src/blocks/{{slugKebabCase}}/index.tsx.mustache +0 -25
  48. package/templates/compound/src/blocks/{{slugKebabCase}}/save.tsx.mustache +0 -32
  49. package/templates/compound/src/blocks/{{slugKebabCase}}/types.ts.mustache +0 -18
  50. package/templates/compound/src/blocks/{{slugKebabCase}}/validators.ts.mustache +0 -35
  51. package/templates/compound/src/blocks/{{slugKebabCase}}-item/block.json.mustache +0 -35
  52. package/templates/compound/src/blocks/{{slugKebabCase}}-item/edit.tsx.mustache +0 -50
  53. package/templates/compound/src/blocks/{{slugKebabCase}}-item/hooks.ts.mustache +0 -11
  54. package/templates/compound/src/blocks/{{slugKebabCase}}-item/index.tsx.mustache +0 -25
  55. package/templates/compound/src/blocks/{{slugKebabCase}}-item/save.tsx.mustache +0 -24
  56. package/templates/compound/src/blocks/{{slugKebabCase}}-item/types.ts.mustache +0 -17
  57. package/templates/compound/src/blocks/{{slugKebabCase}}-item/validators.ts.mustache +0 -35
  58. package/templates/interactivity/src/block.json.mustache +0 -74
  59. package/templates/interactivity/src/edit.tsx.mustache +0 -270
  60. package/templates/interactivity/src/index.tsx.mustache +0 -33
  61. package/templates/interactivity/src/interactivity.ts.mustache +0 -152
  62. package/templates/interactivity/src/save.tsx.mustache +0 -101
  63. package/templates/interactivity/src/types.ts.mustache +0 -32
  64. package/templates/interactivity/src/validators.ts.mustache +0 -47
  65. package/templates/persistence/src/block.json.mustache +0 -52
  66. package/templates/persistence/src/edit.tsx.mustache +0 -165
  67. package/templates/persistence/src/types.ts.mustache +0 -59
@@ -1,37 +0,0 @@
1
- import typia from 'typia';
2
- import currentManifest from "./typia.manifest.json";
3
- import { {{pascalCase}}Attributes, {{pascalCase}}ValidationResult } from "./types";
4
- import { generateBlockId } from "@wp-typia/block-runtime/identifiers";
5
- import { createTemplateValidatorToolkit } from "./validator-toolkit";
6
-
7
- const scaffoldValidators = createTemplateValidatorToolkit<{{pascalCase}}Attributes>({
8
- assert: typia.createAssert<{{pascalCase}}Attributes>(),
9
- clone: typia.misc.createClone<{{pascalCase}}Attributes>() as (
10
- value: {{pascalCase}}Attributes,
11
- ) => {{pascalCase}}Attributes,
12
- is: typia.createIs<{{pascalCase}}Attributes>(),
13
- manifest: currentManifest,
14
- prune: typia.misc.createPrune<{{pascalCase}}Attributes>(),
15
- random: typia.createRandom<{{pascalCase}}Attributes>() as (
16
- ...args: unknown[]
17
- ) => {{pascalCase}}Attributes,
18
- finalize: (normalized) => ({
19
- ...normalized,
20
- id: normalized.id && normalized.id.length > 0 ? normalized.id : generateBlockId(),
21
- }),
22
- validate: typia.createValidate<{{pascalCase}}Attributes>(),
23
- });
24
-
25
- export const validate{{pascalCase}}Attributes =
26
- scaffoldValidators.validateAttributes as (
27
- attributes: unknown,
28
- ) => {{pascalCase}}ValidationResult;
29
-
30
- export const validators = scaffoldValidators.validators;
31
-
32
- export const sanitize{{pascalCase}}Attributes =
33
- scaffoldValidators.sanitizeAttributes as (
34
- attributes: Partial<{{pascalCase}}Attributes>,
35
- ) => {{pascalCase}}Attributes;
36
-
37
- export const createAttributeUpdater = scaffoldValidators.createAttributeUpdater;
@@ -1,37 +0,0 @@
1
- {
2
- "$schema": "https://schemas.wp.org/trunk/block.json",
3
- "apiVersion": 3,
4
- "name": "{{namespace}}/{{slugKebabCase}}",
5
- "version": "{{blockMetadataVersion}}",
6
- "title": {{titleJson}},
7
- "category": "{{category}}",
8
- "icon": "{{icon}}",
9
- "description": "{{description}}",
10
- "example": {},
11
- "supports": {
12
- "html": false,
13
- "anchor": true,
14
- "className": true
15
- },
16
- "attributes": {
17
- "heading": {
18
- "type": "string",
19
- "source": "html",
20
- "selector": ".{{cssClassName}}__heading",
21
- "default": {{titleJson}}
22
- },
23
- "intro": {
24
- "type": "string",
25
- "source": "html",
26
- "selector": ".{{cssClassName}}__intro",
27
- "default": "Add and reorder internal items inside this compound block."
28
- },
29
- "showDividers": {
30
- "type": "boolean",
31
- "default": true
32
- }
33
- },
34
- "textdomain": "{{textDomain}}",
35
- "editorScript": "file:./index.js",
36
- "style": "file:./style-index.css"
37
- }
@@ -1,25 +0,0 @@
1
- import type { Template } from '@wordpress/blocks';
2
-
3
- export const DEFAULT_CHILD_BLOCK_NAME = '{{namespace}}/{{slugKebabCase}}-item';
4
-
5
- export const ALLOWED_CHILD_BLOCKS = [
6
- DEFAULT_CHILD_BLOCK_NAME,
7
- // add-child: insert new allowed child block names here
8
- ];
9
-
10
- export const DEFAULT_CHILD_TEMPLATE: Template[] = [
11
- [
12
- DEFAULT_CHILD_BLOCK_NAME,
13
- {
14
- body: 'Add supporting details for the first internal item.',
15
- title: 'First Item',
16
- },
17
- ],
18
- [
19
- DEFAULT_CHILD_BLOCK_NAME,
20
- {
21
- body: 'Add supporting details for the second internal item.',
22
- title: 'Second Item',
23
- },
24
- ],
25
- ];
@@ -1,93 +0,0 @@
1
- import { __ } from '@wordpress/i18n';
2
- import {
3
- InspectorControls,
4
- InnerBlocks,
5
- RichText,
6
- useBlockProps,
7
- } from '@wordpress/block-editor';
8
- import { Notice, PanelBody, ToggleControl } from '@wordpress/components';
9
-
10
- import {
11
- ALLOWED_CHILD_BLOCKS,
12
- DEFAULT_CHILD_TEMPLATE,
13
- } from './children';
14
- import { useTypiaValidation } from './hooks';
15
- import type { {{pascalCase}}Attributes } from './types';
16
- import {
17
- createAttributeUpdater,
18
- validate{{pascalCase}}Attributes,
19
- } from './validators';
20
-
21
- export default function Edit( {
22
- attributes,
23
- setAttributes,
24
- }: {
25
- attributes: {{pascalCase}}Attributes;
26
- setAttributes: ( attrs: Partial< {{pascalCase}}Attributes > ) => void;
27
- } ) {
28
- const { errorMessages, isValid } = useTypiaValidation(
29
- attributes,
30
- validate{{pascalCase}}Attributes
31
- );
32
- const updateAttribute = createAttributeUpdater( attributes, setAttributes );
33
- const blockProps = useBlockProps( {
34
- className: '{{cssClassName}}',
35
- } );
36
-
37
- return (
38
- <>
39
- <InspectorControls>
40
- <PanelBody title={ __( 'Compound Settings', '{{textDomain}}' ) }>
41
- <ToggleControl
42
- label={ __( 'Show dividers between items', '{{textDomain}}' ) }
43
- checked={ attributes.showDividers ?? true }
44
- onChange={ ( value ) => updateAttribute( 'showDividers', value ) }
45
- />
46
- </PanelBody>
47
- { ! isValid && (
48
- <PanelBody title={ __( 'Validation Errors', '{{textDomain}}' ) } initialOpen>
49
- { errorMessages.map( ( error, index ) => (
50
- <Notice key={ index } status="error" isDismissible={ false }>
51
- { error }
52
- </Notice>
53
- ) ) }
54
- </PanelBody>
55
- ) }
56
- </InspectorControls>
57
- <div { ...blockProps }>
58
- <RichText
59
- tagName="h3"
60
- className="{{cssClassName}}__heading"
61
- value={ attributes.heading }
62
- onChange={ ( heading ) => updateAttribute( 'heading', heading ) }
63
- placeholder={ __( {{titleJson}}, '{{textDomain}}' ) }
64
- />
65
- <RichText
66
- tagName="p"
67
- className="{{cssClassName}}__intro"
68
- value={ attributes.intro ?? '' }
69
- onChange={ ( intro ) => updateAttribute( 'intro', intro ) }
70
- placeholder={ __(
71
- 'Add and reorder internal items inside this compound block.',
72
- '{{textDomain}}'
73
- ) }
74
- />
75
- { ! isValid && (
76
- <Notice status="error" isDismissible={ false }>
77
- <ul>
78
- { errorMessages.map( ( error, index ) => <li key={ index }>{ error }</li> ) }
79
- </ul>
80
- </Notice>
81
- ) }
82
- <div className="{{cssClassName}}__items">
83
- <InnerBlocks
84
- allowedBlocks={ ALLOWED_CHILD_BLOCKS }
85
- renderAppender={ InnerBlocks.ButtonBlockAppender }
86
- template={ DEFAULT_CHILD_TEMPLATE }
87
- templateLock={ false }
88
- />
89
- </div>
90
- </div>
91
- </>
92
- );
93
- }
@@ -1,11 +0,0 @@
1
- export {
2
- formatValidationError,
3
- formatValidationErrors,
4
- useTypiaValidation,
5
- } from '../../hooks';
6
-
7
- export type {
8
- TypiaValidationError,
9
- ValidationResult,
10
- ValidationState,
11
- } from '../../hooks';
@@ -1,25 +0,0 @@
1
- import { registerBlockType } from '@wordpress/blocks';
2
- import type { BlockConfiguration } from '@wordpress/blocks';
3
- import {
4
- buildScaffoldBlockRegistration,
5
- type ScaffoldBlockMetadata,
6
- } from '@wp-typia/block-runtime/blocks';
7
-
8
- import Edit from './edit';
9
- import Save from './save';
10
- import metadata from './block.json';
11
- import './style.scss';
12
-
13
- import type { {{pascalCase}}Attributes } from './types';
14
-
15
- const registration = buildScaffoldBlockRegistration<
16
- BlockConfiguration< {{pascalCase}}Attributes >
17
- >( metadata as ScaffoldBlockMetadata, {
18
- edit: Edit,
19
- save: Save,
20
- } );
21
-
22
- registerBlockType< {{pascalCase}}Attributes >(
23
- registration.name,
24
- registration.settings
25
- );
@@ -1,32 +0,0 @@
1
- import { InnerBlocks, RichText, useBlockProps } from '@wordpress/block-editor';
2
-
3
- import type { {{pascalCase}}Attributes } from './types';
4
-
5
- export default function Save( {
6
- attributes,
7
- }: {
8
- attributes: {{pascalCase}}Attributes;
9
- } ) {
10
- return (
11
- <div
12
- { ...useBlockProps.save( {
13
- className: '{{cssClassName}}',
14
- 'data-show-dividers': ( attributes.showDividers ?? true ) ? 'true' : 'false',
15
- } ) }
16
- >
17
- <RichText.Content
18
- tagName="h3"
19
- className="{{cssClassName}}__heading"
20
- value={ attributes.heading }
21
- />
22
- <RichText.Content
23
- tagName="p"
24
- className="{{cssClassName}}__intro"
25
- value={ attributes.intro ?? '' }
26
- />
27
- <div className="{{cssClassName}}__items">
28
- <InnerBlocks.Content />
29
- </div>
30
- </div>
31
- );
32
- }
@@ -1,18 +0,0 @@
1
- import type { ValidationResult } from '@wp-typia/block-runtime/validation';
2
- import { tags } from 'typia';
3
-
4
- export type { ValidationResult } from '@wp-typia/block-runtime/validation';
5
-
6
- export interface {{pascalCase}}Attributes {
7
- heading: string &
8
- tags.MinLength< 1 > &
9
- tags.MaxLength< 80 > &
10
- tags.Default< {{titleJson}} >;
11
- intro?: string &
12
- tags.MinLength< 1 > &
13
- tags.MaxLength< 180 > &
14
- tags.Default< 'Add and reorder internal items inside this compound block.' >;
15
- showDividers?: boolean & tags.Default< true >;
16
- }
17
-
18
- export type {{pascalCase}}ValidationResult = ValidationResult< {{pascalCase}}Attributes >;
@@ -1,35 +0,0 @@
1
- import typia from 'typia';
2
- import currentManifest from './typia.manifest.json';
3
- import type {
4
- {{pascalCase}}Attributes,
5
- {{pascalCase}}ValidationResult,
6
- } from './types';
7
- import { createTemplateValidatorToolkit } from '../../validator-toolkit';
8
-
9
- const scaffoldValidators = createTemplateValidatorToolkit< {{pascalCase}}Attributes >( {
10
- assert: typia.createAssert< {{pascalCase}}Attributes >(),
11
- clone: typia.misc.createClone< {{pascalCase}}Attributes >() as (
12
- value: {{pascalCase}}Attributes,
13
- ) => {{pascalCase}}Attributes,
14
- is: typia.createIs< {{pascalCase}}Attributes >(),
15
- manifest: currentManifest,
16
- prune: typia.misc.createPrune< {{pascalCase}}Attributes >(),
17
- random: typia.createRandom< {{pascalCase}}Attributes >() as (
18
- ...args: unknown[]
19
- ) => {{pascalCase}}Attributes,
20
- validate: typia.createValidate< {{pascalCase}}Attributes >(),
21
- } );
22
-
23
- export const validate{{pascalCase}}Attributes =
24
- scaffoldValidators.validateAttributes as (
25
- attributes: unknown
26
- ) => {{pascalCase}}ValidationResult;
27
-
28
- export const validators = scaffoldValidators.validators;
29
-
30
- export const sanitize{{pascalCase}}Attributes =
31
- scaffoldValidators.sanitizeAttributes as (
32
- attributes: Partial< {{pascalCase}}Attributes >
33
- ) => {{pascalCase}}Attributes;
34
-
35
- export const createAttributeUpdater = scaffoldValidators.createAttributeUpdater;
@@ -1,35 +0,0 @@
1
- {
2
- "$schema": "https://schemas.wp.org/trunk/block.json",
3
- "apiVersion": 3,
4
- "name": "{{namespace}}/{{slugKebabCase}}-item",
5
- "version": "{{blockMetadataVersion}}",
6
- "title": {{compoundChildTitleJson}},
7
- "category": "{{compoundChildCategory}}",
8
- "icon": "{{compoundChildIcon}}",
9
- "description": "Internal item block used by {{title}}.",
10
- "parent": [
11
- "{{namespace}}/{{slugKebabCase}}"
12
- ],
13
- "example": {},
14
- "supports": {
15
- "html": false,
16
- "inserter": false,
17
- "reusable": false
18
- },
19
- "attributes": {
20
- "title": {
21
- "type": "string",
22
- "source": "html",
23
- "selector": ".{{compoundChildCssClassName}}__title",
24
- "default": {{compoundChildTitleJson}}
25
- },
26
- "body": {
27
- "type": "string",
28
- "source": "html",
29
- "selector": ".{{compoundChildCssClassName}}__body",
30
- "default": "Add supporting details for this internal item."
31
- }
32
- },
33
- "textdomain": "{{textDomain}}",
34
- "editorScript": "file:./index.js"
35
- }
@@ -1,50 +0,0 @@
1
- import { RichText, useBlockProps } from '@wordpress/block-editor';
2
- import { Notice } from '@wordpress/components';
3
- import { __ } from '@wordpress/i18n';
4
-
5
- import { useTypiaValidation } from './hooks';
6
- import type { {{pascalCase}}ItemAttributes } from './types';
7
- import {
8
- createAttributeUpdater,
9
- validate{{pascalCase}}ItemAttributes,
10
- } from './validators';
11
-
12
- export default function Edit( {
13
- attributes,
14
- setAttributes,
15
- }: {
16
- attributes: {{pascalCase}}ItemAttributes;
17
- setAttributes: ( attrs: Partial< {{pascalCase}}ItemAttributes > ) => void;
18
- } ) {
19
- const updateAttribute = createAttributeUpdater( attributes, setAttributes );
20
- const { errorMessages, isValid } = useTypiaValidation(
21
- attributes,
22
- validate{{pascalCase}}ItemAttributes
23
- );
24
-
25
- return (
26
- <div { ...useBlockProps( { className: '{{compoundChildCssClassName}}' } ) }>
27
- <RichText
28
- tagName="h4"
29
- className="{{compoundChildCssClassName}}__title"
30
- value={ attributes.title ?? '' }
31
- onChange={ ( title ) => updateAttribute( 'title', title ) }
32
- placeholder={ __( {{compoundChildTitleJson}}, '{{textDomain}}' ) }
33
- />
34
- <RichText
35
- tagName="p"
36
- className="{{compoundChildCssClassName}}__body"
37
- value={ attributes.body ?? '' }
38
- onChange={ ( body ) => updateAttribute( 'body', body ) }
39
- placeholder={ __( 'Add supporting details for this internal item.', '{{textDomain}}' ) }
40
- />
41
- { ! isValid && (
42
- <Notice status="error" isDismissible={ false }>
43
- <ul>
44
- { errorMessages.map( ( error, index ) => <li key={ index }>{ error }</li> ) }
45
- </ul>
46
- </Notice>
47
- ) }
48
- </div>
49
- );
50
- }
@@ -1,11 +0,0 @@
1
- export {
2
- formatValidationError,
3
- formatValidationErrors,
4
- useTypiaValidation,
5
- } from '../../hooks';
6
-
7
- export type {
8
- TypiaValidationError,
9
- ValidationResult,
10
- ValidationState,
11
- } from '../../hooks';
@@ -1,25 +0,0 @@
1
- import { registerBlockType } from '@wordpress/blocks';
2
- import type { BlockConfiguration } from '@wordpress/blocks';
3
- import {
4
- buildScaffoldBlockRegistration,
5
- type ScaffoldBlockMetadata,
6
- } from '@wp-typia/block-runtime/blocks';
7
-
8
- import Edit from './edit';
9
- import Save from './save';
10
- import metadata from './block.json';
11
- import '../{{slugKebabCase}}/style.scss';
12
-
13
- import type { {{pascalCase}}ItemAttributes } from './types';
14
-
15
- const registration = buildScaffoldBlockRegistration<
16
- BlockConfiguration< {{pascalCase}}ItemAttributes >
17
- >( metadata as ScaffoldBlockMetadata, {
18
- edit: Edit,
19
- save: Save,
20
- } );
21
-
22
- registerBlockType< {{pascalCase}}ItemAttributes >(
23
- registration.name,
24
- registration.settings
25
- );
@@ -1,24 +0,0 @@
1
- import { RichText, useBlockProps } from '@wordpress/block-editor';
2
-
3
- import type { {{pascalCase}}ItemAttributes } from './types';
4
-
5
- export default function Save( {
6
- attributes,
7
- }: {
8
- attributes: {{pascalCase}}ItemAttributes;
9
- } ) {
10
- return (
11
- <div { ...useBlockProps.save( { className: '{{compoundChildCssClassName}}' } ) }>
12
- <RichText.Content
13
- tagName="h4"
14
- className="{{compoundChildCssClassName}}__title"
15
- value={ attributes.title }
16
- />
17
- <RichText.Content
18
- tagName="p"
19
- className="{{compoundChildCssClassName}}__body"
20
- value={ attributes.body }
21
- />
22
- </div>
23
- );
24
- }
@@ -1,17 +0,0 @@
1
- import type { ValidationResult } from '@wp-typia/block-runtime/validation';
2
- import { tags } from 'typia';
3
-
4
- export type { ValidationResult } from '@wp-typia/block-runtime/validation';
5
-
6
- export interface {{pascalCase}}ItemAttributes {
7
- title: string &
8
- tags.MinLength< 1 > &
9
- tags.MaxLength< 80 > &
10
- tags.Default< {{compoundChildTitleJson}} >;
11
- body: string &
12
- tags.MinLength< 1 > &
13
- tags.MaxLength< 280 > &
14
- tags.Default< 'Add supporting details for this internal item.' >;
15
- }
16
-
17
- export type {{pascalCase}}ItemValidationResult = ValidationResult< {{pascalCase}}ItemAttributes >;
@@ -1,35 +0,0 @@
1
- import typia from 'typia';
2
- import currentManifest from './typia.manifest.json';
3
- import type {
4
- {{pascalCase}}ItemAttributes,
5
- {{pascalCase}}ItemValidationResult,
6
- } from './types';
7
- import { createTemplateValidatorToolkit } from '../../validator-toolkit';
8
-
9
- const scaffoldValidators = createTemplateValidatorToolkit< {{pascalCase}}ItemAttributes >( {
10
- assert: typia.createAssert< {{pascalCase}}ItemAttributes >(),
11
- clone: typia.misc.createClone< {{pascalCase}}ItemAttributes >() as (
12
- value: {{pascalCase}}ItemAttributes,
13
- ) => {{pascalCase}}ItemAttributes,
14
- is: typia.createIs< {{pascalCase}}ItemAttributes >(),
15
- manifest: currentManifest,
16
- prune: typia.misc.createPrune< {{pascalCase}}ItemAttributes >(),
17
- random: typia.createRandom< {{pascalCase}}ItemAttributes >() as (
18
- ...args: unknown[]
19
- ) => {{pascalCase}}ItemAttributes,
20
- validate: typia.createValidate< {{pascalCase}}ItemAttributes >(),
21
- } );
22
-
23
- export const validate{{pascalCase}}ItemAttributes =
24
- scaffoldValidators.validateAttributes as (
25
- attributes: unknown
26
- ) => {{pascalCase}}ItemValidationResult;
27
-
28
- export const validators = scaffoldValidators.validators;
29
-
30
- export const sanitize{{pascalCase}}ItemAttributes =
31
- scaffoldValidators.sanitizeAttributes as (
32
- attributes: Partial< {{pascalCase}}ItemAttributes >
33
- ) => {{pascalCase}}ItemAttributes;
34
-
35
- export const createAttributeUpdater = scaffoldValidators.createAttributeUpdater;
@@ -1,74 +0,0 @@
1
- {
2
- "$schema": "https://schemas.wp.org/trunk/block.json",
3
- "apiVersion": 3,
4
- "name": "{{namespace}}/{{slugKebabCase}}",
5
- "version": "{{blockMetadataVersion}}",
6
- "title": "{{title}}",
7
- "category": "{{category}}",
8
- "icon": "{{icon}}",
9
- "description": "{{description}}",
10
- "example": {},
11
- "supports": {
12
- "html": false,
13
- "align": true,
14
- "anchor": true,
15
- "className": true,
16
- "interactivity": true
17
- },
18
- "attributes": {
19
- "content": {
20
- "type": "string",
21
- "source": "html",
22
- "selector": ".{{cssClassName}}__content",
23
- "default": ""
24
- },
25
- "alignment": {
26
- "type": "string",
27
- "enum": ["left", "center", "right"],
28
- "default": "left"
29
- },
30
- "isVisible": {
31
- "type": "boolean",
32
- "default": true
33
- },
34
- "interactiveMode": {
35
- "type": "string",
36
- "enum": ["click", "hover", "auto"],
37
- "default": "click"
38
- },
39
- "animation": {
40
- "type": "string",
41
- "enum": ["none", "bounce", "pulse", "shake", "flip"],
42
- "default": "none"
43
- },
44
- "clickCount": {
45
- "type": "number",
46
- "default": 0
47
- },
48
- "isAnimating": {
49
- "type": "boolean",
50
- "default": false
51
- },
52
- "showCounter": {
53
- "type": "boolean",
54
- "default": true
55
- },
56
- "maxClicks": {
57
- "type": "number",
58
- "default": 10
59
- },
60
- "autoPlayInterval": {
61
- "type": "number",
62
- "default": 0
63
- },
64
- "uniqueId": {
65
- "type": "string",
66
- "default": ""
67
- }
68
- },
69
- "textdomain": "{{textDomain}}",
70
- "editorScript": "file:./index.js",
71
- "editorStyle": "file:./index.css",
72
- "style": "file:./style-index.css",
73
- "viewScriptModule": "file:./interactivity.js"
74
- }