@wp-typia/project-tools 0.16.4 → 0.16.6

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wp-typia/project-tools",
3
- "version": "0.16.4",
3
+ "version": "0.16.6",
4
4
  "description": "Project orchestration and programmatic tooling for wp-typia",
5
5
  "packageManager": "bun@1.3.11",
6
6
  "type": "module",
@@ -114,9 +114,9 @@
114
114
  "bun": ">=1.3.11"
115
115
  },
116
116
  "dependencies": {
117
- "@wp-typia/api-client": "^0.4.2",
118
- "@wp-typia/block-runtime": "^0.4.5",
119
- "@wp-typia/rest": "^0.3.5",
117
+ "@wp-typia/api-client": "^0.4.3",
118
+ "@wp-typia/block-runtime": "^0.4.6",
119
+ "@wp-typia/rest": "^0.3.6",
120
120
  "@wp-typia/block-types": "^0.2.1",
121
121
  "mustache": "^4.2.0",
122
122
  "npm-package-arg": "^13.0.0",
@@ -1,152 +0,0 @@
1
- <?php
2
- /**
3
- * Dynamic render entry for the {{title}} compound parent block.
4
- *
5
- * @package {{pascalCase}}
6
- */
7
-
8
- if ( ! defined( 'ABSPATH' ) ) {
9
- exit;
10
- }
11
-
12
- $validator_path = __DIR__ . '/typia-validator.php';
13
- if ( ! file_exists( $validator_path ) ) {
14
- return '';
15
- }
16
-
17
- $validator = require $validator_path;
18
- if ( ! is_object( $validator ) || ! method_exists( $validator, 'apply_defaults' ) || ! method_exists( $validator, 'validate' ) ) {
19
- return '';
20
- }
21
-
22
- $normalized = $validator->apply_defaults( is_array( $attributes ) ? $attributes : array() );
23
- $validation = $validator->validate( $normalized );
24
- $resource_key = isset( $normalized['resourceKey'] ) ? (string) $normalized['resourceKey'] : '';
25
- $heading = isset( $normalized['heading'] ) ? (string) $normalized['heading'] : '{{title}}';
26
- $intro = isset( $normalized['intro'] ) ? (string) $normalized['intro'] : '';
27
- $button_label = isset( $normalized['buttonLabel'] ) ? (string) $normalized['buttonLabel'] : 'Persist Count';
28
- $show_count = ! empty( $normalized['showCount'] );
29
- $show_dividers = ! empty( $normalized['showDividers'] );
30
- $post_id = is_object( $block ) && isset( $block->context['postId'] )
31
- ? (int) $block->context['postId']
32
- : (int) get_queried_object_id();
33
- $storage_mode = '{{dataStorageMode}}';
34
- $persistence_policy = '{{persistencePolicy}}';
35
-
36
- {{phpPrefix}}_record_rendered_block_instance(
37
- (int) $post_id,
38
- '{{namespace}}/{{slugKebabCase}}',
39
- $resource_key
40
- );
41
-
42
- $notice_message = 'authenticated' === $persistence_policy
43
- ? __( 'Sign in to persist this counter.', '{{textDomain}}' )
44
- : __( 'Public writes are temporarily unavailable.', '{{textDomain}}' );
45
-
46
- if ( empty( $validation['valid'] ) || '' === $resource_key ) {
47
- return '';
48
- }
49
-
50
- $context = array(
51
- 'bootstrapReady' => false,
52
- 'buttonLabel' => $button_label,
53
- 'canWrite' => false,
54
- 'client' => array(
55
- 'writeExpiry' => 0,
56
- 'writeNonce' => '',
57
- 'writeToken' => '',
58
- ),
59
- 'count' => 0,
60
- 'error' => '',
61
- 'isBootstrapping' => false,
62
- 'isLoading' => false,
63
- 'isSaving' => false,
64
- 'persistencePolicy' => $persistence_policy,
65
- 'postId' => (int) $post_id,
66
- 'resourceKey' => $resource_key,
67
- 'showCount' => $show_count,
68
- 'storage' => $storage_mode,
69
- );
70
-
71
- $allowed_inner_html = wp_kses_allowed_html( 'post' );
72
-
73
- foreach ( $allowed_inner_html as &$allowed_attributes ) {
74
- if ( ! is_array( $allowed_attributes ) ) {
75
- continue;
76
- }
77
-
78
- $allowed_attributes['data-wp-bind--disabled'] = true;
79
- $allowed_attributes['data-wp-bind--hidden'] = true;
80
- $allowed_attributes['data-wp-bind--value'] = true;
81
- $allowed_attributes['data-wp-class'] = true;
82
- $allowed_attributes['data-wp-class--active'] = true;
83
- $allowed_attributes['data-wp-context'] = true;
84
- $allowed_attributes['data-wp-init'] = true;
85
- $allowed_attributes['data-wp-interactive'] = true;
86
- $allowed_attributes['data-wp-on--click'] = true;
87
- $allowed_attributes['data-wp-on--mouseenter'] = true;
88
- $allowed_attributes['data-wp-on--mouseleave'] = true;
89
- $allowed_attributes['data-wp-run--mounted'] = true;
90
- $allowed_attributes['data-wp-style--width'] = true;
91
- $allowed_attributes['data-wp-text'] = true;
92
- }
93
- unset( $allowed_attributes );
94
-
95
- $sanitized_content = wp_kses( $content, $allowed_inner_html );
96
-
97
- $wrapper_attributes = get_block_wrapper_attributes(
98
- array(
99
- 'class' => '{{cssClassName}}',
100
- 'data-show-dividers' => $show_dividers ? 'true' : 'false',
101
- 'data-wp-context' => wp_json_encode( $context ),
102
- 'data-wp-init' => 'callbacks.init',
103
- 'data-wp-interactive' => '{{slugKebabCase}}',
104
- 'data-wp-run--mounted' => 'callbacks.mounted',
105
- )
106
- );
107
- ?>
108
-
109
- <div <?php echo $wrapper_attributes; ?>>
110
- <h3 class="{{cssClassName}}__heading"><?php echo esc_html( $heading ); ?></h3>
111
- <?php if ( '' !== $intro ) : ?>
112
- <p class="{{cssClassName}}__intro"><?php echo esc_html( $intro ); ?></p>
113
- <?php endif; ?>
114
- <p
115
- class="{{cssClassName}}__notice"
116
- data-wp-bind--hidden="!context.bootstrapReady || context.canWrite"
117
- hidden
118
- >
119
- <?php echo esc_html( $notice_message ); ?>
120
- </p>
121
- <p
122
- class="{{cssClassName}}__error"
123
- role="status"
124
- aria-live="polite"
125
- aria-atomic="true"
126
- data-wp-bind--hidden="!context.error"
127
- data-wp-text="context.error"
128
- hidden
129
- ></p>
130
- <?php if ( $show_count ) : ?>
131
- <div class="{{cssClassName}}__counter">
132
- <span
133
- class="{{cssClassName}}__count"
134
- role="status"
135
- aria-live="polite"
136
- aria-atomic="true"
137
- data-wp-text="context.count"
138
- >0</span>
139
- <button
140
- type="button"
141
- disabled
142
- data-wp-bind--disabled="!context.canWrite"
143
- data-wp-on--click="actions.increment"
144
- >
145
- <?php echo esc_html( $button_label ); ?>
146
- </button>
147
- </div>
148
- <?php endif; ?>
149
- <div class="{{cssClassName}}__items">
150
- <?php echo $sanitized_content; ?>
151
- </div>
152
- </div>
@@ -1,8 +0,0 @@
1
- /**
2
- * {{title}} Block Editor Styles
3
- */
4
-
5
- .{{cssClassName}} {
6
- outline: 1px dashed #ddd;
7
- outline-offset: -1px;
8
- }
@@ -1,18 +0,0 @@
1
- import { useMemo } from '@wordpress/element';
2
- import {
3
- createUseTypiaValidationHook,
4
- formatValidationError,
5
- formatValidationErrors,
6
- } from '@wp-typia/block-runtime/validation';
7
-
8
- export {
9
- formatValidationError,
10
- formatValidationErrors,
11
- type TypiaValidationError,
12
- type ValidationResult,
13
- type ValidationState,
14
- } from '@wp-typia/block-runtime/validation';
15
-
16
- export const useTypiaValidation = createUseTypiaValidationHook( {
17
- useMemo,
18
- } );
@@ -1,19 +0,0 @@
1
- <?php
2
- /**
3
- * Optional server render placeholder for {{title}}.
4
- *
5
- * The basic scaffold stays static by default. Keep `src/save.tsx` as the
6
- * canonical frontend output unless you intentionally convert this block into a
7
- * dynamic render path and add `render` to `block.json`.
8
- *
9
- * @package {{slug}}
10
- */
11
-
12
- if ( ! defined( 'ABSPATH' ) ) {
13
- exit;
14
- }
15
-
16
- ?>
17
- <div class="{{cssClassName}}__server-placeholder" hidden>
18
- <?php esc_html_e( 'Server render placeholder.', '{{textDomain}}' ); ?>
19
- </div>
@@ -1,40 +0,0 @@
1
- /**
2
- * {{title}} Block Styles
3
- */
4
-
5
- .{{cssClassName}} {
6
- padding: 20px;
7
- border: 1px solid #ddd;
8
- border-radius: 4px;
9
- background-color: #fff;
10
- box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
11
-
12
- &.is-hidden {
13
- display: none;
14
- }
15
-
16
- &__content {
17
- font-size: 16px;
18
- line-height: 1.6;
19
- color: #333;
20
-
21
- // Alignment styles
22
- &[data-align="center"] {
23
- text-align: center;
24
- }
25
-
26
- &[data-align="right"] {
27
- text-align: right;
28
- }
29
-
30
- &[data-align="justify"] {
31
- text-align: justify;
32
- }
33
- }
34
-
35
- // Hover state
36
- &:hover {
37
- box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
38
- transition: box-shadow 0.2s ease;
39
- }
40
- }
@@ -1,31 +0,0 @@
1
- .{{cssClassName}} {
2
- border: 1px solid #dcdcde;
3
- border-radius: 12px;
4
- padding: 1.25rem;
5
- background: #fff;
6
- }
7
-
8
- .{{cssClassName}}__heading {
9
- margin: 0 0 0.5rem;
10
- font-size: 1.2rem;
11
- }
12
-
13
- .{{cssClassName}}__intro {
14
- margin: 0 0 1rem;
15
- color: #50575e;
16
- }
17
-
18
- .{{cssClassName}}__items {
19
- display: grid;
20
- gap: 0.75rem;
21
- }
22
-
23
- .{{cssClassName}}[data-show-dividers='true'] .{{compoundChildCssClassName}} {
24
- border-top: 1px solid #dcdcde;
25
- padding-top: 0.75rem;
26
- }
27
-
28
- .{{cssClassName}}[data-show-dividers='true'] .{{compoundChildCssClassName}}:first-child {
29
- border-top: 0;
30
- padding-top: 0;
31
- }
@@ -1,8 +0,0 @@
1
- /**
2
- * {{title}} Block Editor Styles
3
- */
4
-
5
- .{{cssClassName}} {
6
- outline: 1px dashed #ddd;
7
- outline-offset: -1px;
8
- }
@@ -1,60 +0,0 @@
1
- .{{cssClassName}} {
2
- position: relative;
3
- padding: 1rem;
4
- border: 1px solid #dcdcde;
5
- border-radius: 0.75rem;
6
- background: #fff;
7
-
8
- &__content {
9
- display: grid;
10
- gap: 0.75rem;
11
- }
12
-
13
- &__counter {
14
- display: inline-flex;
15
- gap: 0.35rem;
16
- align-items: center;
17
- font-size: 0.9rem;
18
- font-weight: 600;
19
- }
20
-
21
- &__progress {
22
- width: 100%;
23
- height: 0.5rem;
24
- overflow: hidden;
25
- background: #f0f0f1;
26
- border-radius: 999px;
27
- }
28
-
29
- &__progress-bar {
30
- height: 100%;
31
- background: #3858e9;
32
- transition: width 0.2s ease;
33
- }
34
-
35
- &__animation {
36
- min-height: 1.5rem;
37
- font-size: 0.85rem;
38
- color: #3858e9;
39
- opacity: 0;
40
- transition: opacity 0.2s ease;
41
-
42
- &.is-active {
43
- opacity: 1;
44
- }
45
- }
46
-
47
- &__completion {
48
- font-weight: 700;
49
- color: #06752d;
50
- }
51
-
52
- &__reset {
53
- align-self: start;
54
- padding: 0.4rem 0.7rem;
55
- border: 1px solid #dcdcde;
56
- border-radius: 999px;
57
- background: transparent;
58
- cursor: pointer;
59
- }
60
- }
@@ -1,120 +0,0 @@
1
- <?php
2
- /**
3
- * Dynamic render entry for the {{title}} block.
4
- *
5
- * @package {{pascalCase}}
6
- */
7
-
8
- if ( ! defined( 'ABSPATH' ) ) {
9
- exit;
10
- }
11
-
12
- $validator_path = __DIR__ . '/typia-validator.php';
13
- if ( ! file_exists( $validator_path ) ) {
14
- return '';
15
- }
16
-
17
- $validator = require $validator_path;
18
- if ( ! is_object( $validator ) || ! method_exists( $validator, 'apply_defaults' ) || ! method_exists( $validator, 'validate' ) ) {
19
- return '';
20
- }
21
-
22
- $normalized = $validator->apply_defaults( is_array( $attributes ) ? $attributes : array() );
23
- $validation = $validator->validate( $normalized );
24
- $resource_key = isset( $normalized['resourceKey'] ) ? (string) $normalized['resourceKey'] : '';
25
-
26
- if ( empty( $validation['valid'] ) || '' === $resource_key ) {
27
- return '';
28
- }
29
-
30
- $alignment = isset( $normalized['alignment'] ) ? (string) $normalized['alignment'] : 'left';
31
- $button_label = isset( $normalized['buttonLabel'] ) ? (string) $normalized['buttonLabel'] : 'Persist Count';
32
- $content = isset( $normalized['content'] ) ? (string) $normalized['content'] : '';
33
- $post_id = is_object( $block ) && isset( $block->context['postId'] )
34
- ? (int) $block->context['postId']
35
- : (int) get_queried_object_id();
36
- $storage_mode = '{{dataStorageMode}}';
37
- $persistence_policy = '{{persistencePolicy}}';
38
-
39
- {{phpPrefix}}_record_rendered_block_instance(
40
- (int) $post_id,
41
- '{{namespace}}/{{slugKebabCase}}',
42
- $resource_key
43
- );
44
-
45
- $notice_message = 'authenticated' === $persistence_policy
46
- ? __( 'Sign in to persist this counter.', '{{textDomain}}' )
47
- : __( 'Public writes are temporarily unavailable.', '{{textDomain}}' );
48
- $context = array(
49
- 'bootstrapReady' => false,
50
- 'buttonLabel' => $button_label,
51
- 'canWrite' => false,
52
- 'client' => array(
53
- 'writeExpiry' => 0,
54
- 'writeNonce' => '',
55
- 'writeToken' => '',
56
- ),
57
- 'count' => 0,
58
- 'error' => '',
59
- 'isBootstrapping' => false,
60
- 'isLoading' => false,
61
- 'isSaving' => false,
62
- 'isVisible' => ! empty( $normalized['isVisible'] ),
63
- 'persistencePolicy' => $persistence_policy,
64
- 'postId' => (int) $post_id,
65
- 'resourceKey' => $resource_key,
66
- 'storage' => $storage_mode,
67
- );
68
-
69
- $wrapper_attributes = get_block_wrapper_attributes(
70
- array(
71
- 'data-wp-context' => wp_json_encode( $context ),
72
- 'data-wp-interactive' => '{{slugKebabCase}}',
73
- 'data-wp-init' => 'callbacks.init',
74
- 'data-wp-run--mounted' => 'callbacks.mounted',
75
- )
76
- );
77
- ?>
78
-
79
- <div <?php echo $wrapper_attributes; ?>>
80
- <div class="{{frontendCssClassName}}">
81
- <p class="{{frontendCssClassName}}__content" style="<?php echo esc_attr( 'text-align:' . $alignment ); ?>">
82
- <?php echo esc_html( $content ); ?>
83
- </p>
84
- <p
85
- class="{{frontendCssClassName}}__notice"
86
- data-wp-bind--hidden="!context.bootstrapReady || context.canWrite"
87
- hidden
88
- >
89
- <?php echo esc_html( $notice_message ); ?>
90
- </p>
91
- <p
92
- class="{{frontendCssClassName}}__error"
93
- role="status"
94
- aria-live="polite"
95
- aria-atomic="true"
96
- data-wp-bind--hidden="!context.error"
97
- data-wp-text="context.error"
98
- hidden
99
- ></p>
100
- <?php if ( ! empty( $normalized['showCount'] ) ) : ?>
101
- <span
102
- class="{{frontendCssClassName}}__count"
103
- role="status"
104
- aria-live="polite"
105
- aria-atomic="true"
106
- data-wp-text="context.count"
107
- >
108
- 0
109
- </span>
110
- <?php endif; ?>
111
- <button
112
- type="button"
113
- disabled
114
- data-wp-bind--disabled="!context.canWrite"
115
- data-wp-on--click="actions.increment"
116
- >
117
- <?php echo esc_html( $button_label ); ?>
118
- </button>
119
- </div>
120
- </div>
@@ -1,46 +0,0 @@
1
- .{{cssClassName}} {
2
- border: 1px solid #dcdcde;
3
- border-radius: 12px;
4
- padding: 16px;
5
- background: #fff;
6
-
7
- &__meta {
8
- color: #50575e;
9
- font-size: 13px;
10
- margin: 8px 0 0;
11
- }
12
- }
13
-
14
- .{{frontendCssClassName}} {
15
- display: grid;
16
- gap: 12px;
17
- border: 1px solid #dcdcde;
18
- border-radius: 12px;
19
- padding: 16px;
20
- background: #f6f7f7;
21
-
22
- &__count {
23
- display: inline-flex;
24
- min-width: 3rem;
25
- justify-content: center;
26
- font-weight: 700;
27
- }
28
-
29
- &__notice,
30
- &__error {
31
- margin: 0;
32
- font-size: 13px;
33
- }
34
-
35
- &__notice {
36
- color: #50575e;
37
- }
38
-
39
- &__error {
40
- color: #b32d2e;
41
- }
42
-
43
- button {
44
- width: fit-content;
45
- }
46
- }