@octane-xplat/date-picker 0.19.0 → 0.20.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 +2 -181
- package/package.json +8 -8
- package/src/AppKitDatePicker.macos.tsrx +39 -36
- package/src/AppKitDatePicker.tsrx +2 -0
- package/src/MaterialDatePicker.android.tsrx +43 -42
- package/src/MaterialDatePicker.tsrx +2 -0
- package/src/SwiftUIDatePicker.ios.tsrx +47 -45
- package/src/SwiftUIDatePicker.tsrx +2 -0
- package/src/android/index.ts +4 -4
- package/src/android/types.ts +111 -111
- package/src/date-picker-owner.macos.ts +240 -210
- package/src/ios/index.ts +3 -3
- package/src/ios/types.ts +26 -26
- package/src/macos/index.ts +3 -3
- package/src/macos/types.ts +24 -24
- package/src/style-merge.ts +40 -37
package/src/style-merge.ts
CHANGED
|
@@ -7,50 +7,53 @@ export type StyleInput = string | Record<string, any> | null | undefined | reado
|
|
|
7
7
|
* Authored keys win; array styles fold in order; a string style is appended
|
|
8
8
|
* after the serialized defaults so its declarations override them too. */
|
|
9
9
|
export function mergeStyle(
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
base: Record<string, any>,
|
|
11
|
+
style?: Record<string, any> | readonly (Record<string, any> | null | undefined)[] | null,
|
|
12
12
|
): Record<string, any>
|
|
13
13
|
|
|
14
14
|
export function mergeStyle(
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
base: Record<string, any>,
|
|
16
|
+
style?: StyleInput,
|
|
17
17
|
): string | Record<string, any>
|
|
18
18
|
|
|
19
19
|
export function mergeStyle(
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
base: Record<string, any>,
|
|
21
|
+
style?: StyleInput,
|
|
22
22
|
): string | Record<string, any> {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
23
|
+
if (style == null) {
|
|
24
|
+
return base
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
let obj: Record<string, any> = { ...base }
|
|
28
|
+
const strings: string[] = []
|
|
29
|
+
const add = (s: StyleInput) => {
|
|
30
|
+
if (s == null) {
|
|
31
|
+
return
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
if (typeof s === 'string') {
|
|
35
|
+
strings.push(s)
|
|
36
|
+
} else if (Array.isArray(s)) {
|
|
37
|
+
for (const part of s) {
|
|
38
|
+
add(part)
|
|
39
|
+
}
|
|
40
|
+
} else {
|
|
41
|
+
obj = { ...obj, ...s }
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
add(style)
|
|
46
|
+
|
|
47
|
+
if (strings.length === 0) {
|
|
48
|
+
return obj
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
const prefix = Object.entries(obj)
|
|
52
|
+
.filter(([, v]) => v != null)
|
|
53
|
+
.map(([k, v]) => `${kebab(k)}:${v}`)
|
|
54
|
+
.join(';')
|
|
55
|
+
|
|
56
|
+
return [prefix, ...strings].filter(Boolean).join(';')
|
|
54
57
|
}
|
|
55
58
|
|
|
56
59
|
export type StyleProp = string | Record<string, any> | readonly StyleProp[] | null | undefined
|