@c-time/frelio-data-json-recipe 3.7.2 → 3.8.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 CHANGED
@@ -70,6 +70,14 @@ if (isListPageRecipeWithPagination(listRecipe)) {
70
70
 
71
71
  `string`, `date`, `number`, `escape`, `toc`, `truncate`, `stripHtml`, `slug`, `lowercase`, `uppercase`, `default`, `count`, `first`, `last`, `join`, `url`, `picture`, `img`, `srcset`, `fileLink`, `relationList`, `constant` など 25 種類以上。
72
72
 
73
+ `fallbackSource`(任意): `source` の解決結果が空(未定義 / null / 空文字 / 空白のみ)のときに代わりに使う式。
74
+ フォーマットはフォールバック後の値に適用される。先に定義した customField も参照できる。
75
+
76
+ ```json
77
+ { "field": "titleEscaped", "source": "{$this.title}", "type": "escape" },
78
+ { "field": "titleHtml", "source": "{$this.titleDisplay}", "type": "string", "fallbackSource": "{$this.titleEscaped}" }
79
+ ```
80
+
73
81
  ---
74
82
 
75
83
  ## 型ガード
package/dist/index.d.ts CHANGED
@@ -81,6 +81,13 @@ type CustomFieldTransform = {
81
81
  separator?: string;
82
82
  /** default用のデフォルト値 */
83
83
  defaultValue?: string;
84
+ /**
85
+ * source の解決結果が「空」(未定義 / null / 空文字・空白のみ)のときに代わりに使う式。
86
+ * source と同じ書式(例: "{$this.titleEscaped}")で、先に定義した customField も参照できる。
87
+ * フォーマット(type)はフォールバック後の値に適用する。
88
+ * 用途例: 見出し用の HTML フィールド(改行制御つき)が未入力なら、素のタイトルを使う。
89
+ */
90
+ fallbackSource?: string;
84
91
  };
85
92
  /**
86
93
  * カスタムフィールド(RelationList)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@c-time/frelio-data-json-recipe",
3
- "version": "3.7.2",
3
+ "version": "3.8.0",
4
4
  "description": "Type definitions for frelio data JSON recipe",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",