@times-design-system/components-wordpress 1.10.0 → 1.12.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/dist/STYLE_HANDLES.md +80 -0
- package/dist/blocks/ad-container/block.json +5 -1
- package/dist/blocks/button/block.json +52 -10
- package/dist/blocks/chip/block.json +29 -6
- package/dist/blocks/dialog-box/block.json +1 -0
- package/dist/blocks/divider/block.json +5 -1
- package/dist/blocks/icon/block.json +21 -5
- package/dist/blocks/icon-button/block.json +39 -16
- package/dist/blocks/icon-button/render.php +2 -2
- package/dist/blocks/input/block.json +9 -1
- package/dist/blocks/input-helper-message/block.json +1 -0
- package/dist/blocks/link/block.json +37 -7
- package/dist/blocks/tab/block.json +1 -0
- package/dist/blocks/tab-group/block.json +1 -0
- package/dist/blocks/tag/block.json +26 -5
- package/dist/blocks/text/block.json +10 -1
- package/dist/blocks/toast/block.json +7 -1
- package/dist/icon-data.json +1 -1
- package/dist/index.cjs +41 -14
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +41 -14
- package/dist/index.js.map +1 -1
- package/dist/plugin.php +55 -16
- package/dist/style-handles.json +77 -0
- package/package.json +4 -3
- package/plugin.php +55 -16
package/dist/plugin.php
CHANGED
|
@@ -21,6 +21,61 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
|
21
21
|
exit;
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
+
/**
|
|
25
|
+
* Register block styles for conditional loading.
|
|
26
|
+
* Must be called before register_block_type() to enable WordPress conditional style loading.
|
|
27
|
+
*
|
|
28
|
+
* @since 1.1.0
|
|
29
|
+
* @return void
|
|
30
|
+
*/
|
|
31
|
+
function tds_register_block_styles() {
|
|
32
|
+
$plugin_dir = plugin_dir_url( __FILE__ );
|
|
33
|
+
$blocks = array(
|
|
34
|
+
'ad-container' => 'tds-ad-container-style',
|
|
35
|
+
'button' => 'tds-button-style',
|
|
36
|
+
'chip' => 'tds-chip-style',
|
|
37
|
+
'dialog-box' => 'tds-dialog-box-style',
|
|
38
|
+
'divider' => 'tds-divider-style',
|
|
39
|
+
'icon' => 'tds-icon-style',
|
|
40
|
+
'icon-button' => 'tds-icon-button-style',
|
|
41
|
+
'input' => 'tds-input-style',
|
|
42
|
+
'input-helper-message' => 'tds-input-helper-message-style',
|
|
43
|
+
'link' => 'tds-link-style',
|
|
44
|
+
'tab' => 'tds-tab-style',
|
|
45
|
+
'tab-group' => 'tds-tab-group-style',
|
|
46
|
+
'tag' => 'tds-tag-style',
|
|
47
|
+
'text' => 'tds-text-style',
|
|
48
|
+
'toast' => 'tds-toast-style',
|
|
49
|
+
);
|
|
50
|
+
|
|
51
|
+
foreach ( $blocks as $block_name => $handle ) {
|
|
52
|
+
wp_register_style(
|
|
53
|
+
$handle,
|
|
54
|
+
$plugin_dir . 'blocks/' . $block_name . '/style.css',
|
|
55
|
+
array(),
|
|
56
|
+
tds_get_asset_version( 'blocks/' . $block_name . '/style.css' )
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
add_action( 'init', 'tds_register_block_styles', 9 );
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Get cache-busting version for assets.
|
|
65
|
+
* Uses file modification time to automatically invalidate cache when files change.
|
|
66
|
+
*
|
|
67
|
+
* @since 1.1.0
|
|
68
|
+
* @param string $file_path Path to the file in plugin directory.
|
|
69
|
+
* @return string Version string (either mtime hash or fallback)
|
|
70
|
+
*/
|
|
71
|
+
function tds_get_asset_version( $file_path ) {
|
|
72
|
+
$full_path = plugin_dir_path( __FILE__ ) . $file_path;
|
|
73
|
+
if ( file_exists( $full_path ) ) {
|
|
74
|
+
return 'v' . filemtime( $full_path );
|
|
75
|
+
}
|
|
76
|
+
return '1.1.0'; // Fallback version
|
|
77
|
+
}
|
|
78
|
+
|
|
24
79
|
/**
|
|
25
80
|
* Register all Times Design System blocks.
|
|
26
81
|
* Uses PHP-side registration with render callbacks pointing to render.php files.
|
|
@@ -103,22 +158,6 @@ function tds_register_blocks() {
|
|
|
103
158
|
|
|
104
159
|
add_action( 'init', 'tds_register_blocks' );
|
|
105
160
|
|
|
106
|
-
/**
|
|
107
|
-
* Get cache-busting version for assets.
|
|
108
|
-
* Uses file modification time to automatically invalidate cache when files change.
|
|
109
|
-
*
|
|
110
|
-
* @since 1.1.0
|
|
111
|
-
* @param string $file_path Path to the file in plugin directory.
|
|
112
|
-
* @return string Version string (either mtime hash or fallback)
|
|
113
|
-
*/
|
|
114
|
-
function tds_get_asset_version( $file_path ) {
|
|
115
|
-
$full_path = plugin_dir_path( __FILE__ ) . $file_path;
|
|
116
|
-
if ( file_exists( $full_path ) ) {
|
|
117
|
-
return 'v' . filemtime( $full_path );
|
|
118
|
-
}
|
|
119
|
-
return '1.1.0'; // Fallback version
|
|
120
|
-
}
|
|
121
|
-
|
|
122
161
|
/**
|
|
123
162
|
* Enqueue plugin styles.
|
|
124
163
|
*
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
{
|
|
2
|
+
"ad-container": {
|
|
3
|
+
"handle": "tds-ad-container-style",
|
|
4
|
+
"cssFile": "blocks/ad-container/style.css",
|
|
5
|
+
"phpPath": "blocks/ad-container/style.css"
|
|
6
|
+
},
|
|
7
|
+
"button": {
|
|
8
|
+
"handle": "tds-button-style",
|
|
9
|
+
"cssFile": "blocks/button/style.css",
|
|
10
|
+
"phpPath": "blocks/button/style.css"
|
|
11
|
+
},
|
|
12
|
+
"chip": {
|
|
13
|
+
"handle": "tds-chip-style",
|
|
14
|
+
"cssFile": "blocks/chip/style.css",
|
|
15
|
+
"phpPath": "blocks/chip/style.css"
|
|
16
|
+
},
|
|
17
|
+
"dialog-box": {
|
|
18
|
+
"handle": "tds-dialog-box-style",
|
|
19
|
+
"cssFile": "blocks/dialog-box/style.css",
|
|
20
|
+
"phpPath": "blocks/dialog-box/style.css"
|
|
21
|
+
},
|
|
22
|
+
"divider": {
|
|
23
|
+
"handle": "tds-divider-style",
|
|
24
|
+
"cssFile": "blocks/divider/style.css",
|
|
25
|
+
"phpPath": "blocks/divider/style.css"
|
|
26
|
+
},
|
|
27
|
+
"icon": {
|
|
28
|
+
"handle": "tds-icon-style",
|
|
29
|
+
"cssFile": "blocks/icon/style.css",
|
|
30
|
+
"phpPath": "blocks/icon/style.css"
|
|
31
|
+
},
|
|
32
|
+
"icon-button": {
|
|
33
|
+
"handle": "tds-icon-button-style",
|
|
34
|
+
"cssFile": "blocks/icon-button/style.css",
|
|
35
|
+
"phpPath": "blocks/icon-button/style.css"
|
|
36
|
+
},
|
|
37
|
+
"input": {
|
|
38
|
+
"handle": "tds-input-style",
|
|
39
|
+
"cssFile": "blocks/input/style.css",
|
|
40
|
+
"phpPath": "blocks/input/style.css"
|
|
41
|
+
},
|
|
42
|
+
"input-helper-message": {
|
|
43
|
+
"handle": "tds-input-helper-message-style",
|
|
44
|
+
"cssFile": "blocks/input-helper-message/style.css",
|
|
45
|
+
"phpPath": "blocks/input-helper-message/style.css"
|
|
46
|
+
},
|
|
47
|
+
"link": {
|
|
48
|
+
"handle": "tds-link-style",
|
|
49
|
+
"cssFile": "blocks/link/style.css",
|
|
50
|
+
"phpPath": "blocks/link/style.css"
|
|
51
|
+
},
|
|
52
|
+
"tab": {
|
|
53
|
+
"handle": "tds-tab-style",
|
|
54
|
+
"cssFile": "blocks/tab/style.css",
|
|
55
|
+
"phpPath": "blocks/tab/style.css"
|
|
56
|
+
},
|
|
57
|
+
"tab-group": {
|
|
58
|
+
"handle": "tds-tab-group-style",
|
|
59
|
+
"cssFile": "blocks/tab-group/style.css",
|
|
60
|
+
"phpPath": "blocks/tab-group/style.css"
|
|
61
|
+
},
|
|
62
|
+
"tag": {
|
|
63
|
+
"handle": "tds-tag-style",
|
|
64
|
+
"cssFile": "blocks/tag/style.css",
|
|
65
|
+
"phpPath": "blocks/tag/style.css"
|
|
66
|
+
},
|
|
67
|
+
"text": {
|
|
68
|
+
"handle": "tds-text-style",
|
|
69
|
+
"cssFile": "blocks/text/style.css",
|
|
70
|
+
"phpPath": "blocks/text/style.css"
|
|
71
|
+
},
|
|
72
|
+
"toast": {
|
|
73
|
+
"handle": "tds-toast-style",
|
|
74
|
+
"cssFile": "blocks/toast/style.css",
|
|
75
|
+
"phpPath": "blocks/toast/style.css"
|
|
76
|
+
}
|
|
77
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@times-design-system/components-wordpress",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.12.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Times Design System Gutenberg blocks for WordPress Full Site Editing",
|
|
6
6
|
"keywords": [
|
|
@@ -32,11 +32,12 @@
|
|
|
32
32
|
"requiresPhp": "7.4"
|
|
33
33
|
},
|
|
34
34
|
"scripts": {
|
|
35
|
-
"build": "npm run check:css-imports && npm run clean && npm run extract:icons && npm run build:rollup && npm run compile:scss && npm run build:plugin",
|
|
35
|
+
"build": "npm run check:css-imports && npm run clean && npm run extract:icons && npm run build:rollup && npm run compile:scss && npm run build:plugin && npm run generate:handles",
|
|
36
36
|
"check:css-imports": "bash scripts/check-css-imports.sh",
|
|
37
37
|
"build:rollup": "rollup -c",
|
|
38
38
|
"compile:scss": "node scripts/compile-scss.cjs",
|
|
39
39
|
"build:plugin": "node scripts/build-plugin.cjs",
|
|
40
|
+
"generate:handles": "node scripts/generate-style-handles.cjs",
|
|
40
41
|
"clean": "rimraf dist",
|
|
41
42
|
"extract:icons": "node scripts/extract-icons.cjs",
|
|
42
43
|
"dev": "rollup -c --watch",
|
|
@@ -100,5 +101,5 @@
|
|
|
100
101
|
"typescript": "^5.0.0",
|
|
101
102
|
"vitest": "^1.0.4"
|
|
102
103
|
},
|
|
103
|
-
"gitHead": "
|
|
104
|
+
"gitHead": "41431d57eadc0dc6af20de1f9c5cf95395e54a4f"
|
|
104
105
|
}
|
package/plugin.php
CHANGED
|
@@ -21,6 +21,61 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
|
21
21
|
exit;
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
+
/**
|
|
25
|
+
* Register block styles for conditional loading.
|
|
26
|
+
* Must be called before register_block_type() to enable WordPress conditional style loading.
|
|
27
|
+
*
|
|
28
|
+
* @since 1.1.0
|
|
29
|
+
* @return void
|
|
30
|
+
*/
|
|
31
|
+
function tds_register_block_styles() {
|
|
32
|
+
$plugin_dir = plugin_dir_url( __FILE__ );
|
|
33
|
+
$blocks = array(
|
|
34
|
+
'ad-container' => 'tds-ad-container-style',
|
|
35
|
+
'button' => 'tds-button-style',
|
|
36
|
+
'chip' => 'tds-chip-style',
|
|
37
|
+
'dialog-box' => 'tds-dialog-box-style',
|
|
38
|
+
'divider' => 'tds-divider-style',
|
|
39
|
+
'icon' => 'tds-icon-style',
|
|
40
|
+
'icon-button' => 'tds-icon-button-style',
|
|
41
|
+
'input' => 'tds-input-style',
|
|
42
|
+
'input-helper-message' => 'tds-input-helper-message-style',
|
|
43
|
+
'link' => 'tds-link-style',
|
|
44
|
+
'tab' => 'tds-tab-style',
|
|
45
|
+
'tab-group' => 'tds-tab-group-style',
|
|
46
|
+
'tag' => 'tds-tag-style',
|
|
47
|
+
'text' => 'tds-text-style',
|
|
48
|
+
'toast' => 'tds-toast-style',
|
|
49
|
+
);
|
|
50
|
+
|
|
51
|
+
foreach ( $blocks as $block_name => $handle ) {
|
|
52
|
+
wp_register_style(
|
|
53
|
+
$handle,
|
|
54
|
+
$plugin_dir . 'blocks/' . $block_name . '/style.css',
|
|
55
|
+
array(),
|
|
56
|
+
tds_get_asset_version( 'blocks/' . $block_name . '/style.css' )
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
add_action( 'init', 'tds_register_block_styles', 9 );
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Get cache-busting version for assets.
|
|
65
|
+
* Uses file modification time to automatically invalidate cache when files change.
|
|
66
|
+
*
|
|
67
|
+
* @since 1.1.0
|
|
68
|
+
* @param string $file_path Path to the file in plugin directory.
|
|
69
|
+
* @return string Version string (either mtime hash or fallback)
|
|
70
|
+
*/
|
|
71
|
+
function tds_get_asset_version( $file_path ) {
|
|
72
|
+
$full_path = plugin_dir_path( __FILE__ ) . $file_path;
|
|
73
|
+
if ( file_exists( $full_path ) ) {
|
|
74
|
+
return 'v' . filemtime( $full_path );
|
|
75
|
+
}
|
|
76
|
+
return '1.1.0'; // Fallback version
|
|
77
|
+
}
|
|
78
|
+
|
|
24
79
|
/**
|
|
25
80
|
* Register all Times Design System blocks.
|
|
26
81
|
* Uses PHP-side registration with render callbacks pointing to render.php files.
|
|
@@ -103,22 +158,6 @@ function tds_register_blocks() {
|
|
|
103
158
|
|
|
104
159
|
add_action( 'init', 'tds_register_blocks' );
|
|
105
160
|
|
|
106
|
-
/**
|
|
107
|
-
* Get cache-busting version for assets.
|
|
108
|
-
* Uses file modification time to automatically invalidate cache when files change.
|
|
109
|
-
*
|
|
110
|
-
* @since 1.1.0
|
|
111
|
-
* @param string $file_path Path to the file in plugin directory.
|
|
112
|
-
* @return string Version string (either mtime hash or fallback)
|
|
113
|
-
*/
|
|
114
|
-
function tds_get_asset_version( $file_path ) {
|
|
115
|
-
$full_path = plugin_dir_path( __FILE__ ) . $file_path;
|
|
116
|
-
if ( file_exists( $full_path ) ) {
|
|
117
|
-
return 'v' . filemtime( $full_path );
|
|
118
|
-
}
|
|
119
|
-
return '1.1.0'; // Fallback version
|
|
120
|
-
}
|
|
121
|
-
|
|
122
161
|
/**
|
|
123
162
|
* Enqueue plugin styles.
|
|
124
163
|
*
|