melta-app 0.4.0 → 0.4.1
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 +1 -1
- package/src/theme/define-theme.ts +10 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "melta-app",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.1",
|
|
4
4
|
"description": "melta for APP — melta デザインシステムの React Native UI kit。melta-contracts(デザイン契約)を single source of truth に RN 実装でその契約を満たす。アプリ本体ではなくライブラリ。",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://app.melta.tsubotax.com",
|
|
@@ -207,9 +207,17 @@ const FONT_WEIGHT_KEYS = keysOf<Record<FontWeightKey, true>>({
|
|
|
207
207
|
// capability の導出
|
|
208
208
|
// ---------------------------------------------------------------------------
|
|
209
209
|
|
|
210
|
-
/**
|
|
210
|
+
/**
|
|
211
|
+
* theme が実際に値を持っている mode。
|
|
212
|
+
*
|
|
213
|
+
* **enumerable な own key だけを見る**こと。`hasOwnProperty` は non-enumerable な own
|
|
214
|
+
* プロパティにも true を返すので、それで判定すると「持っていない mode に置いた番人の getter」を
|
|
215
|
+
* 値として数えてしまい、解決後の theme に対して常に light / dark 両方を返す(0.4.0 の不具合)。
|
|
216
|
+
* 入力(素のデータプロパティ)と解決後(番人つき)のどちらに対しても正しく答える必要がある。
|
|
217
|
+
*/
|
|
211
218
|
export function declaredModes(semantic: Partial<Record<ThemeMode, SemanticColors>>): ThemeMode[] {
|
|
212
|
-
|
|
219
|
+
const withValue = new Set(Object.keys(semantic));
|
|
220
|
+
return MODES.filter((mode) => withValue.has(mode));
|
|
213
221
|
}
|
|
214
222
|
|
|
215
223
|
/** colorScheme capability を `color.semantic` のキー集合から導出する。 */
|