@use-voltra/ios 2.3.2 → 2.4.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/build/commonjs/index.js +12 -0
- package/build/commonjs/index.js.map +1 -1
- package/build/commonjs/jsx/primitives.js +36 -0
- package/build/commonjs/jsx/primitives.js.map +1 -1
- package/build/commonjs/modifiers/createIosModifier.js +19 -0
- package/build/commonjs/modifiers/createIosModifier.js.map +1 -0
- package/build/commonjs/modifiers/index.js +334 -0
- package/build/commonjs/modifiers/index.js.map +1 -0
- package/build/module/index.js +1 -1
- package/build/module/index.js.map +1 -1
- package/build/module/jsx/primitives.js +1 -0
- package/build/module/jsx/primitives.js.map +1 -1
- package/build/module/modifiers/createIosModifier.js +14 -0
- package/build/module/modifiers/createIosModifier.js.map +1 -0
- package/build/module/modifiers/index.js +299 -0
- package/build/module/modifiers/index.js.map +1 -0
- package/build/typescript/commonjs/index.d.ts +2 -2
- package/build/typescript/commonjs/index.d.ts.map +1 -1
- package/build/typescript/commonjs/jsx/baseProps.d.ts +8 -0
- package/build/typescript/commonjs/jsx/baseProps.d.ts.map +1 -1
- package/build/typescript/commonjs/jsx/primitives.d.ts +1 -0
- package/build/typescript/commonjs/jsx/primitives.d.ts.map +1 -1
- package/build/typescript/commonjs/live-activity/types.d.ts +1 -1
- package/build/typescript/commonjs/live-activity/types.d.ts.map +1 -1
- package/build/typescript/commonjs/modifiers/createIosModifier.d.ts +12 -0
- package/build/typescript/commonjs/modifiers/createIosModifier.d.ts.map +1 -0
- package/build/typescript/commonjs/modifiers/index.d.ts +290 -0
- package/build/typescript/commonjs/modifiers/index.d.ts.map +1 -0
- package/build/typescript/module/index.d.ts +2 -2
- package/build/typescript/module/index.d.ts.map +1 -1
- package/build/typescript/module/jsx/baseProps.d.ts +8 -0
- package/build/typescript/module/jsx/baseProps.d.ts.map +1 -1
- package/build/typescript/module/jsx/primitives.d.ts +1 -0
- package/build/typescript/module/jsx/primitives.d.ts.map +1 -1
- package/build/typescript/module/live-activity/types.d.ts +1 -1
- package/build/typescript/module/live-activity/types.d.ts.map +1 -1
- package/build/typescript/module/modifiers/createIosModifier.d.ts +12 -0
- package/build/typescript/module/modifiers/createIosModifier.d.ts.map +1 -0
- package/build/typescript/module/modifiers/index.d.ts +290 -0
- package/build/typescript/module/modifiers/index.d.ts.map +1 -0
- package/package.json +2 -2
- package/src/index.ts +9 -2
- package/src/jsx/baseProps.tsx +8 -0
- package/src/jsx/primitives.ts +1 -0
- package/src/live-activity/types.ts +13 -1
- package/src/modifiers/createIosModifier.ts +20 -0
- package/src/modifiers/index.ts +306 -0
|
@@ -0,0 +1,306 @@
|
|
|
1
|
+
import { createIosModifier } from './createIosModifier.js'
|
|
2
|
+
|
|
3
|
+
export type { IosModifier } from './createIosModifier.js'
|
|
4
|
+
|
|
5
|
+
export type ClipShape = 'rectangle' | 'roundedRectangle' | 'circle' | 'capsule' | 'ellipse'
|
|
6
|
+
|
|
7
|
+
export type ClipShapeOptions = {
|
|
8
|
+
/** Corner radius for `roundedRectangle`. */
|
|
9
|
+
cornerRadius?: number
|
|
10
|
+
/** Corner style for `roundedRectangle` and `capsule`. Defaults to `circular`. */
|
|
11
|
+
cornerStyle?: 'circular' | 'continuous'
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export type RedactionReason = 'placeholder' | 'privacy' | 'invalidated'
|
|
15
|
+
|
|
16
|
+
export type ContentTransition = 'identity' | 'opacity' | 'interpolate' | 'numericText' | 'symbolEffect'
|
|
17
|
+
|
|
18
|
+
export type Transition = 'identity' | 'opacity' | 'scale' | 'slide' | 'push' | 'move'
|
|
19
|
+
|
|
20
|
+
export type Edge = 'top' | 'bottom' | 'leading' | 'trailing'
|
|
21
|
+
|
|
22
|
+
export type AnimationCurve =
|
|
23
|
+
| 'default'
|
|
24
|
+
| 'linear'
|
|
25
|
+
| 'easeIn'
|
|
26
|
+
| 'easeOut'
|
|
27
|
+
| 'easeInOut'
|
|
28
|
+
| 'spring'
|
|
29
|
+
| 'bouncy'
|
|
30
|
+
| 'smooth'
|
|
31
|
+
| 'snappy'
|
|
32
|
+
|
|
33
|
+
export type DynamicTypeSize =
|
|
34
|
+
| 'xSmall'
|
|
35
|
+
| 'small'
|
|
36
|
+
| 'medium'
|
|
37
|
+
| 'large'
|
|
38
|
+
| 'xLarge'
|
|
39
|
+
| 'xxLarge'
|
|
40
|
+
| 'xxxLarge'
|
|
41
|
+
| 'accessibility1'
|
|
42
|
+
| 'accessibility2'
|
|
43
|
+
| 'accessibility3'
|
|
44
|
+
| 'accessibility4'
|
|
45
|
+
| 'accessibility5'
|
|
46
|
+
|
|
47
|
+
export type BlendMode =
|
|
48
|
+
| 'normal'
|
|
49
|
+
| 'multiply'
|
|
50
|
+
| 'screen'
|
|
51
|
+
| 'overlay'
|
|
52
|
+
| 'darken'
|
|
53
|
+
| 'lighten'
|
|
54
|
+
| 'colorDodge'
|
|
55
|
+
| 'colorBurn'
|
|
56
|
+
| 'softLight'
|
|
57
|
+
| 'hardLight'
|
|
58
|
+
| 'difference'
|
|
59
|
+
| 'exclusion'
|
|
60
|
+
| 'hue'
|
|
61
|
+
| 'saturation'
|
|
62
|
+
| 'color'
|
|
63
|
+
| 'luminosity'
|
|
64
|
+
| 'sourceAtop'
|
|
65
|
+
| 'destinationOver'
|
|
66
|
+
| 'destinationOut'
|
|
67
|
+
| 'plusDarker'
|
|
68
|
+
| 'plusLighter'
|
|
69
|
+
|
|
70
|
+
export type SymbolEffect = 'pulse' | 'variableColor' | 'breathe' | 'rotate' | 'wiggle'
|
|
71
|
+
|
|
72
|
+
// MARK: - Widgets and Live Activities
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Opens the URL in the app when the widget or Live Activity is tapped. Takes an absolute URL or a
|
|
76
|
+
* path, which gets the app's URL scheme like `deepLinkUrl`. Use it once per widget, or once per
|
|
77
|
+
* Live Activity presentation. It replaces Voltra's default widget link, but a `deepLinkUrl`
|
|
78
|
+
* configured for the widget or Live Activity takes precedence. A tap on the compact or minimal
|
|
79
|
+
* Dynamic Island ignores it: pass `deepLinkUrl` when starting the Live Activity instead.
|
|
80
|
+
*
|
|
81
|
+
* @since iOS 14.0
|
|
82
|
+
*/
|
|
83
|
+
export const widgetURL = (url: string) => createIosModifier('widgetURL', { url })
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Sets the widget's container background, which the system removes in contexts such as StandBy
|
|
87
|
+
* and tinted Home Screens. Use it on the widget's outermost component.
|
|
88
|
+
*
|
|
89
|
+
* @since iOS 17.0
|
|
90
|
+
*/
|
|
91
|
+
export const containerBackground = (color: string) => createIosModifier('containerBackground', { color })
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Adds the component to the accent group when the widget renders in accented mode.
|
|
95
|
+
*
|
|
96
|
+
* @since iOS 16.0
|
|
97
|
+
*/
|
|
98
|
+
export const widgetAccentable = (accentable: boolean = true) => createIosModifier('widgetAccentable', { accentable })
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Redacts the view when the widget is shown on a locked device.
|
|
102
|
+
*
|
|
103
|
+
* @since iOS 15.0
|
|
104
|
+
*/
|
|
105
|
+
export const privacySensitive = (sensitive: boolean = true) => createIosModifier('privacySensitive', { sensitive })
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Renders the component redacted, for example as a placeholder.
|
|
109
|
+
*
|
|
110
|
+
* @since iOS 14.0
|
|
111
|
+
*/
|
|
112
|
+
export const redacted = (reason: RedactionReason) => createIosModifier('redacted', { reason })
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* Keeps the component visible inside a redacted container.
|
|
116
|
+
*
|
|
117
|
+
* @since iOS 14.0
|
|
118
|
+
*/
|
|
119
|
+
export const unredacted = () => createIosModifier('unredacted')
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* Marks content that goes stale while an interactive widget performs an update.
|
|
123
|
+
*
|
|
124
|
+
* @since iOS 17.0
|
|
125
|
+
*/
|
|
126
|
+
export const invalidatableContent = (invalidatable: boolean = true) =>
|
|
127
|
+
createIosModifier('invalidatableContent', { invalidatable })
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* Tints the Live Activity's Lock Screen background. `null` uses the system default. It has no
|
|
131
|
+
* effect in the Dynamic Island or in widgets, and an `activityBackgroundTint` passed when starting
|
|
132
|
+
* or updating the Live Activity takes precedence.
|
|
133
|
+
*
|
|
134
|
+
* @since iOS 16.1
|
|
135
|
+
*/
|
|
136
|
+
export const activityBackgroundTint = (color: string | null) => createIosModifier('activityBackgroundTint', { color })
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* Sets the color of the system action button shown next to the Live Activity. `null` uses the
|
|
140
|
+
* system default.
|
|
141
|
+
*
|
|
142
|
+
* @since iOS 16.1
|
|
143
|
+
*/
|
|
144
|
+
export const activitySystemActionForegroundColor = (color: string | null) =>
|
|
145
|
+
createIosModifier('activitySystemActionForegroundColor', { color })
|
|
146
|
+
|
|
147
|
+
// MARK: - Transitions and animation
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* Animates changes to the content between updates: timeline entries, activity states, or renders
|
|
151
|
+
* of an in-app preview. Pair it with `animation` on the same component.
|
|
152
|
+
*
|
|
153
|
+
* @since iOS 16.0. `symbolEffect` requires iOS 17.0.
|
|
154
|
+
*/
|
|
155
|
+
export const contentTransition = (transition: ContentTransition, options: { countsDown?: boolean } = {}) =>
|
|
156
|
+
createIosModifier('contentTransition', { transition, countsDown: options.countsDown })
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* Animates the component in or out when it appears or disappears between two updates. It has no
|
|
160
|
+
* effect on a component that is present in both. The insertion is animated by the parent, so put
|
|
161
|
+
* `animation` with the value that toggles the component on a parent that stays, and give the
|
|
162
|
+
* siblings an `id` so SwiftUI can tell which one appeared.
|
|
163
|
+
*
|
|
164
|
+
* @since iOS 16.0
|
|
165
|
+
*/
|
|
166
|
+
export const transition = (transition: Transition, options: { edge?: Edge } = {}) =>
|
|
167
|
+
createIosModifier('transition', { transition, edge: options.edge })
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
* Animates the component when `value` changes between updates. `duration` applies to `linear`,
|
|
171
|
+
* `easeIn`, `easeOut`, `easeInOut`, `bouncy`, `smooth` and `snappy`; `default` and `spring` use
|
|
172
|
+
* the system timing.
|
|
173
|
+
*
|
|
174
|
+
* @since iOS 13.0. `bouncy`, `smooth` and `snappy` require iOS 17.0.
|
|
175
|
+
*/
|
|
176
|
+
export const animation = (curve: AnimationCurve, options: { value: string | number | boolean; duration?: number }) =>
|
|
177
|
+
createIosModifier('animation', { curve, value: options.value, duration: options.duration })
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
* Applies an indefinite SF Symbol effect to `Symbol` components inside. The system decides whether
|
|
181
|
+
* it animates: in-app previews play it, while widgets and Live Activities may show a still frame.
|
|
182
|
+
*
|
|
183
|
+
* @since iOS 17.0. `breathe`, `rotate` and `wiggle` require iOS 18.0.
|
|
184
|
+
*/
|
|
185
|
+
export const symbolEffect = (effect: SymbolEffect) => createIosModifier('symbolEffect', { effect })
|
|
186
|
+
|
|
187
|
+
// MARK: - Visual effects
|
|
188
|
+
|
|
189
|
+
/**
|
|
190
|
+
* Clips the finished component, background included, to a shape.
|
|
191
|
+
*
|
|
192
|
+
* @since iOS 13.0
|
|
193
|
+
*/
|
|
194
|
+
export const clipShape = (shape: ClipShape, options: ClipShapeOptions = {}) =>
|
|
195
|
+
createIosModifier('clipShape', { shape, cornerRadius: options.cornerRadius, cornerStyle: options.cornerStyle })
|
|
196
|
+
|
|
197
|
+
/**
|
|
198
|
+
* Applies a Gaussian blur.
|
|
199
|
+
*
|
|
200
|
+
* @since iOS 13.0
|
|
201
|
+
*/
|
|
202
|
+
export const blur = (radius: number, options: { opaque?: boolean } = {}) =>
|
|
203
|
+
createIosModifier('blur', { radius, opaque: options.opaque })
|
|
204
|
+
|
|
205
|
+
/** @since iOS 13.0 */
|
|
206
|
+
export const grayscale = (amount: number) => createIosModifier('grayscale', { amount })
|
|
207
|
+
/** @since iOS 13.0 */
|
|
208
|
+
export const saturation = (amount: number) => createIosModifier('saturation', { amount })
|
|
209
|
+
/** @since iOS 13.0 */
|
|
210
|
+
export const brightness = (amount: number) => createIosModifier('brightness', { amount })
|
|
211
|
+
/** @since iOS 13.0 */
|
|
212
|
+
export const contrast = (amount: number) => createIosModifier('contrast', { amount })
|
|
213
|
+
|
|
214
|
+
/**
|
|
215
|
+
* Sets how the component composites with the content behind it.
|
|
216
|
+
*
|
|
217
|
+
* @since iOS 13.0
|
|
218
|
+
*/
|
|
219
|
+
export const blendMode = (mode: BlendMode) => createIosModifier('blendMode', { mode })
|
|
220
|
+
|
|
221
|
+
// MARK: - Geometry and layout
|
|
222
|
+
|
|
223
|
+
/**
|
|
224
|
+
* Rotates the rendered component around its center without changing its layout.
|
|
225
|
+
*
|
|
226
|
+
* @since iOS 13.0
|
|
227
|
+
*/
|
|
228
|
+
export const rotationEffect = (degrees: number) => createIosModifier('rotationEffect', { degrees })
|
|
229
|
+
|
|
230
|
+
/**
|
|
231
|
+
* Scales the rendered component around its center without changing its layout.
|
|
232
|
+
*
|
|
233
|
+
* @since iOS 13.0
|
|
234
|
+
*/
|
|
235
|
+
export const scaleEffect = (scale: number | { x?: number; y?: number }) =>
|
|
236
|
+
createIosModifier('scaleEffect', typeof scale === 'number' ? { x: scale, y: scale } : { x: scale.x, y: scale.y })
|
|
237
|
+
|
|
238
|
+
/**
|
|
239
|
+
* Moves the rendered component without changing its layout.
|
|
240
|
+
*
|
|
241
|
+
* @since iOS 13.0
|
|
242
|
+
*/
|
|
243
|
+
export const offset = (value: { x?: number; y?: number }) => createIosModifier('offset', { x: value.x, y: value.y })
|
|
244
|
+
|
|
245
|
+
/**
|
|
246
|
+
* Keeps the component at its ideal size on the given axes instead of letting the parent shrink it.
|
|
247
|
+
*
|
|
248
|
+
* @since iOS 13.0
|
|
249
|
+
*/
|
|
250
|
+
export const fixedSize = (axes: { horizontal?: boolean; vertical?: boolean } = {}) =>
|
|
251
|
+
createIosModifier('fixedSize', { horizontal: axes.horizontal, vertical: axes.vertical })
|
|
252
|
+
|
|
253
|
+
/**
|
|
254
|
+
* Gives the component a larger or smaller share of space in its stack.
|
|
255
|
+
*
|
|
256
|
+
* @since iOS 13.0
|
|
257
|
+
*/
|
|
258
|
+
export const layoutPriority = (priority: number) => createIosModifier('layoutPriority', { priority })
|
|
259
|
+
|
|
260
|
+
/**
|
|
261
|
+
* Sizes the component relative to its nearest container, such as the widget.
|
|
262
|
+
*
|
|
263
|
+
* @since iOS 17.0
|
|
264
|
+
*/
|
|
265
|
+
export const containerRelativeFrame = (axes: 'horizontal' | 'vertical' | 'both') =>
|
|
266
|
+
createIosModifier('containerRelativeFrame', { axes })
|
|
267
|
+
|
|
268
|
+
/**
|
|
269
|
+
* Uses a fixed Dynamic Type size for content inside the component, regardless of the system
|
|
270
|
+
* setting. Voltra `Text` uses fixed font sizes, so it does not change.
|
|
271
|
+
*
|
|
272
|
+
* @since iOS 15.0
|
|
273
|
+
*/
|
|
274
|
+
export const dynamicTypeSize = (size: DynamicTypeSize) => createIosModifier('dynamicTypeSize', { size })
|
|
275
|
+
|
|
276
|
+
// MARK: - Text
|
|
277
|
+
|
|
278
|
+
/**
|
|
279
|
+
* Lets text inside shrink down to this fraction of its font size to fit.
|
|
280
|
+
*
|
|
281
|
+
* @since iOS 13.0
|
|
282
|
+
*/
|
|
283
|
+
export const minimumScaleFactor = (factor: number) => createIosModifier('minimumScaleFactor', { factor })
|
|
284
|
+
|
|
285
|
+
/**
|
|
286
|
+
* Sets where text inside is truncated when it does not fit.
|
|
287
|
+
*
|
|
288
|
+
* @since iOS 13.0
|
|
289
|
+
*/
|
|
290
|
+
export const truncationMode = (mode: 'head' | 'middle' | 'tail') => createIosModifier('truncationMode', { mode })
|
|
291
|
+
|
|
292
|
+
/**
|
|
293
|
+
* Aligns the lines of multi-line text inside. A `Text` with `style.textAlign` or its own
|
|
294
|
+
* `multilineTextAlignment` prop keeps that value.
|
|
295
|
+
*
|
|
296
|
+
* @since iOS 13.0
|
|
297
|
+
*/
|
|
298
|
+
export const multilineTextAlignment = (alignment: 'leading' | 'center' | 'trailing') =>
|
|
299
|
+
createIosModifier('multilineTextAlignment', { alignment })
|
|
300
|
+
|
|
301
|
+
/**
|
|
302
|
+
* Uses fixed-width digits for text inside, so changing numbers do not shift.
|
|
303
|
+
*
|
|
304
|
+
* @since iOS 16.0
|
|
305
|
+
*/
|
|
306
|
+
export const monospacedDigit = () => createIosModifier('monospacedDigit')
|