itmar-block-packages 1.3.9 → 1.3.11

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
@@ -14,6 +14,14 @@ import {関数名又はコンポーネント名} from "itmar-block-packages"
14
14
  npm i @wordpress/scripts@^27.6.0 --save-dev
15
15
 
16
16
  ## 更新履歴
17
+ = 1.3.11 =
18
+ - BlockPlace、BlockWidth、BlockHeightのfreeサイズにpx以外の単位を設定できるように修正
19
+ - freeサイズにpx以外の単位を設定できるようにしたことから、max_width_prm、width_prm、height_prmがそれに対応できるように修正
20
+
21
+ = 1.3.10 =
22
+ - useDuplicateBlockRemoveの不具合を修正。
23
+ - ブロックの幅、高さを設定するためのコンポーネントとしてBlockWidth、BlockHeightを追加
24
+
17
25
  = 1.3.9 =
18
26
  - カスタムフックとしてuseDuplicateBlockRemoveを追加。このフックはインナーブロックが挿入されたとき、指定されたブロック名が存在れば、挿入されたブロックを削除する。
19
27
 
@@ -158,12 +166,12 @@ top,right,bottom,leftをキーとしてもつオブジェクト
158
166
  #### 引数
159
167
  - `width` string
160
168
  wideSize,contentSize,free,fullの文字列
161
- - `free_val` number
169
+ - `free_val` string
162
170
  px値
163
171
  #### 戻り値
164
172
  - wideSizeのとき`width: 100%; max-width: var(--wp--style--global--wide-size);`
165
173
  - contentSizeのとき`width: 100%; max-width: var(--wp--style--global--content-size);`
166
- - freeのとき`width: 100%; max-width: ${free_val}px;`
174
+ - freeのとき`width: 100%; max-width: ${free_val};`
167
175
  - fullのとき`width: 100%; max-width: 100%;`
168
176
  - その他の文字列`width: fit-content;`
169
177
 
@@ -173,12 +181,12 @@ widthのCSSを返します。
173
181
  #### 引数
174
182
  - `width` string
175
183
  wideSize,contentSize,freeの文字列
176
- - `free_val` number
184
+ - `free_val` string
177
185
  px値
178
186
  #### 戻り値
179
187
  - wideSizeのとき`width: var(--wp--style--global--wide-size);`
180
188
  - contentSizeのとき`width: var(--wp--style--global--content-size);`
181
- - freeのとき`width: ${free_val}px;`
189
+ - freeのとき`width: ${free_val};`
182
190
  - その他の文字列`width: fit-content;`
183
191
 
184
192
 
@@ -187,11 +195,11 @@ heightのCSSを返します。
187
195
  #### 引数
188
196
  - `height` string
189
197
  fit, full, freeの文字列
190
- - `free_val` number
198
+ - `free_val` string
191
199
  px値
192
200
  #### 戻り値
193
201
  - fitのとき`height: fit-content;`
194
- - freeのとき`height: ${free_val}px;`
202
+ - freeのとき`height: ${free_val};`
195
203
  - その他の文字列`height: 100%;`
196
204
 
197
205
 
@@ -652,6 +660,75 @@ WordPressのブロックエディタのサイドバーにブロックの配置
652
660
 
653
661
  <img src="./img/blockplace.png" alt="BlockPlaceのスクリーンショット" width="100" height="300">
654
662
 
663
+ ### BlockWidth
664
+ ブロックコンポーネントの幅を設定する
665
+ #### 引数
666
+ - `attributes` object
667
+ ブロックの属性オブジェクト
668
+ - `isMobile` boolean
669
+ スクリーン幅が767px以下かどうかのフラグ
670
+ - `isSubmenu` boolean
671
+ trueの場合はmax-widthを合わせて設定する
672
+ - `onWidthChange` function
673
+ widthの種別を設定するためのコールバック関数。返ってくる引数はfit,full,wideSize,contentSize,free
674
+ - `onFreeWidthChange` function
675
+ widthの種別がfreeのとき幅を設定するためのコールバック関数。返ってくる引数は単位付きの文字列
676
+
677
+ ```
678
+ <BlockWidth
679
+ attributes={attributes}
680
+ isMobile={isMobile}
681
+ isSubmenu={isFront}
682
+ onWidthChange={(value) => {
683
+ setAttributes(
684
+ !isMobile
685
+ ? { default_val: { ...default_val, width_val: value } }
686
+ : { mobile_val: { ...mobile_val, width_val: value } },
687
+ );
688
+ }}
689
+ onFreeWidthChange={(value) => {
690
+ setAttributes(
691
+ !isMobile
692
+ ? { default_val: { ...default_val, free_width: value } }
693
+ : { mobile_val: { ...mobile_val, free_width: value } },
694
+ );
695
+ }}
696
+ />
697
+ ```
698
+
699
+ ### BlockHeight
700
+ ブロックコンポーネントの高さを設定する
701
+ #### 引数
702
+ - `attributes` object
703
+ ブロックの属性オブジェクト
704
+ - `isMobile` boolean
705
+ スクリーン幅が767px以下かどうかのフラグ
706
+ - `onHeightChange` function
707
+ heightの種別を設定するためのコールバック関数。返ってくる引数はfit,full,free
708
+ - `onFreeHeightChange` function
709
+ heightの種別がfreeのとき幅を設定するためのコールバック関数。返ってくる引数は単位付きの文字列
710
+
711
+ ```
712
+ <BlockHeight
713
+ attributes={attributes}
714
+ isMobile={isMobile}
715
+ onHeightChange={(value) => {
716
+ setAttributes(
717
+ !isMobile
718
+ ? { default_val: { ...default_val, height_val: value } }
719
+ : { mobile_val: { ...mobile_val, height_val: value } },
720
+ );
721
+ }}
722
+ onFreeHeightChange={(value) => {
723
+ setAttributes(
724
+ !isMobile
725
+ ? { default_val: { ...default_val, free_height: value } }
726
+ : { mobile_val: { ...mobile_val, free_height: value } },
727
+ );
728
+ }}
729
+ />
730
+ ```
731
+
655
732
  ## 色コードを変換する関数
656
733
  ### hslToRgb16
657
734
  Hslオブジェクトの値を与えると#000000型のRGB表記に変換するためのユーティリティ関数です。
@@ -1 +1 @@
1
- <?php return array('dependencies' => array('react', 'react-dom', 'wp-api-fetch', 'wp-block-editor', 'wp-components', 'wp-data', 'wp-element', 'wp-i18n', 'wp-primitives'), 'version' => '6e3f73ce618d3c7c0f86');
1
+ <?php return array('dependencies' => array('react', 'react-dom', 'wp-api-fetch', 'wp-block-editor', 'wp-components', 'wp-data', 'wp-element', 'wp-i18n', 'wp-primitives'), 'version' => '19f8215aa02dd432f1d5');