react-native-nitro-input 0.3.0 → 0.3.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/CHANGELOG.md +49 -0
- package/README.md +90 -2
- package/android/src/main/cpp/JReflowEngine.cpp +32 -0
- package/android/src/main/cpp/JReflowEngine.hpp +13 -0
- package/android/src/main/cpp/JRollingEngine.cpp +42 -2
- package/android/src/main/cpp/JRollingEngine.hpp +9 -1
- package/android/src/main/java/com/margelo/nitro/nitroinput/HybridNitroNumberFormatPlatform.kt +76 -1
- package/android/src/main/java/com/margelo/nitro/nitroinput/HybridNitroNumberView.kt +88 -0
- package/android/src/main/java/com/margelo/nitro/nitroinput/HybridNitroTextMeasure.kt +25 -0
- package/android/src/main/java/com/margelo/nitro/nitroinput/HybridNitroTextView.kt +140 -0
- package/android/src/main/java/com/margelo/nitro/nitroinput/NitroInputPackage.kt +2 -1
- package/android/src/main/java/com/margelo/nitro/nitroinput/NitroNumberView.kt +388 -136
- package/android/src/main/java/com/margelo/nitro/nitroinput/NitroTextView.kt +868 -0
- package/android/src/main/java/com/margelo/nitro/nitroinput/ReflowEngine.kt +21 -0
- package/android/src/main/java/com/margelo/nitro/nitroinput/RollingEngine.kt +13 -2
- package/cpp/RollingEngine.cpp +92 -8
- package/cpp/RollingEngine.hpp +36 -2
- package/ios/HybridNitroNumberFormatPlatform.swift +87 -9
- package/ios/HybridNitroNumberView.swift +82 -1
- package/ios/HybridNitroTextView.swift +134 -0
- package/ios/NitroNumberView.swift +368 -135
- package/ios/NitroTextView.swift +583 -0
- package/lib/commonjs/nitrogen/generated/shared/json/NitroNumberViewConfig.json +20 -0
- package/lib/commonjs/nitrogen/generated/shared/json/NitroTextViewConfig.json +30 -0
- package/lib/commonjs/src/NitroNumber.js +52 -3
- package/lib/commonjs/src/NitroText.js +138 -0
- package/lib/commonjs/src/NitroTime.js +65 -0
- package/lib/commonjs/src/formatProps.js +76 -16
- package/lib/commonjs/src/index.js +6 -1
- package/lib/commonjs/src/specs/NitroText.nitro.js +2 -0
- package/lib/module/nitrogen/generated/shared/json/NitroNumberViewConfig.json +20 -0
- package/lib/module/nitrogen/generated/shared/json/NitroTextViewConfig.json +30 -0
- package/lib/module/src/NitroNumber.js +53 -4
- package/lib/module/src/NitroText.js +98 -0
- package/lib/module/src/NitroTime.js +29 -0
- package/lib/module/src/formatProps.js +76 -17
- package/lib/module/src/index.js +2 -0
- package/lib/module/src/specs/NitroText.nitro.js +1 -0
- package/lib/typescript/src/NitroNumber.d.ts +79 -1
- package/lib/typescript/src/NitroText.d.ts +67 -0
- package/lib/typescript/src/NitroTime.d.ts +19 -0
- package/lib/typescript/src/formatProps.d.ts +30 -4
- package/lib/typescript/src/index.d.ts +4 -1
- package/lib/typescript/src/specs/NitroNumber.nitro.d.ts +67 -0
- package/lib/typescript/src/specs/NitroText.nitro.d.ts +60 -0
- package/nitro.json +20 -0
- package/nitrogen/generated/android/NitroInput+autolinking.cmake +6 -0
- package/nitrogen/generated/android/NitroInputOnLoad.cpp +34 -0
- package/nitrogen/generated/android/c++/JHybridNitroNumberViewSpec.cpp +243 -0
- package/nitrogen/generated/android/c++/JHybridNitroNumberViewSpec.hpp +40 -0
- package/nitrogen/generated/android/c++/JHybridNitroTextMeasureSpec.cpp +58 -0
- package/nitrogen/generated/android/c++/JHybridNitroTextMeasureSpec.hpp +64 -0
- package/nitrogen/generated/android/c++/JHybridNitroTextViewSpec.cpp +253 -0
- package/nitrogen/generated/android/c++/JHybridNitroTextViewSpec.hpp +104 -0
- package/nitrogen/generated/android/c++/JNitroNumberShimmerDirection.hpp +61 -0
- package/nitrogen/generated/android/c++/JNitroNumberSignDisplay.hpp +67 -0
- package/nitrogen/generated/android/c++/views/JHybridNitroNumberViewStateUpdater.cpp +100 -0
- package/nitrogen/generated/android/c++/views/JHybridNitroTextViewStateUpdater.cpp +174 -0
- package/nitrogen/generated/android/c++/views/JHybridNitroTextViewStateUpdater.hpp +54 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/HybridNitroNumberViewSpec.kt +136 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/HybridNitroTextMeasureSpec.kt +60 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/HybridNitroTextViewSpec.kt +179 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/NitroNumberShimmerDirection.kt +24 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/NitroNumberSignDisplay.kt +26 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/views/HybridNitroTextViewManager.kt +96 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/views/HybridNitroTextViewStateUpdater.kt +23 -0
- package/nitrogen/generated/ios/NitroInput-Swift-Cxx-Bridge.cpp +34 -0
- package/nitrogen/generated/ios/NitroInput-Swift-Cxx-Bridge.hpp +132 -11
- package/nitrogen/generated/ios/NitroInput-Swift-Cxx-Umbrella.hpp +16 -0
- package/nitrogen/generated/ios/NitroInputAutolinking.mm +16 -0
- package/nitrogen/generated/ios/NitroInputAutolinking.swift +24 -0
- package/nitrogen/generated/ios/c++/HybridNitroNumberViewSpecSwift.hpp +146 -0
- package/nitrogen/generated/ios/c++/HybridNitroTextMeasureSpecSwift.cpp +11 -0
- package/nitrogen/generated/ios/c++/HybridNitroTextMeasureSpecSwift.hpp +90 -0
- package/nitrogen/generated/ios/c++/HybridNitroTextViewSpecSwift.cpp +11 -0
- package/nitrogen/generated/ios/c++/HybridNitroTextViewSpecSwift.hpp +233 -0
- package/nitrogen/generated/ios/c++/views/HybridNitroNumberViewComponent.mm +120 -0
- package/nitrogen/generated/ios/c++/views/HybridNitroTextViewComponent.mm +264 -0
- package/nitrogen/generated/ios/swift/HybridNitroNumberViewSpec.swift +20 -0
- package/nitrogen/generated/ios/swift/HybridNitroNumberViewSpec_cxx.swift +493 -0
- package/nitrogen/generated/ios/swift/HybridNitroTextMeasureSpec.swift +56 -0
- package/nitrogen/generated/ios/swift/HybridNitroTextMeasureSpec_cxx.swift +150 -0
- package/nitrogen/generated/ios/swift/HybridNitroTextViewSpec.swift +75 -0
- package/nitrogen/generated/ios/swift/HybridNitroTextViewSpec_cxx.swift +608 -0
- package/nitrogen/generated/ios/swift/NitroNumberShimmerDirection.swift +44 -0
- package/nitrogen/generated/ios/swift/NitroNumberSignDisplay.swift +52 -0
- package/nitrogen/generated/shared/c++/HybridNitroNumberViewSpec.cpp +40 -0
- package/nitrogen/generated/shared/c++/HybridNitroNumberViewSpec.hpp +46 -0
- package/nitrogen/generated/shared/c++/HybridNitroTextMeasureSpec.cpp +22 -0
- package/nitrogen/generated/shared/c++/HybridNitroTextMeasureSpec.hpp +63 -0
- package/nitrogen/generated/shared/c++/HybridNitroTextViewSpec.cpp +62 -0
- package/nitrogen/generated/shared/c++/HybridNitroTextViewSpec.hpp +115 -0
- package/nitrogen/generated/shared/c++/NitroNumberShimmerDirection.hpp +80 -0
- package/nitrogen/generated/shared/c++/NitroNumberSignDisplay.hpp +88 -0
- package/nitrogen/generated/shared/c++/views/HybridNitroNumberViewComponent.cpp +40 -0
- package/nitrogen/generated/shared/c++/views/HybridNitroNumberViewComponent.hpp +62 -0
- package/nitrogen/generated/shared/c++/views/HybridNitroTextViewComponent.cpp +74 -0
- package/nitrogen/generated/shared/c++/views/HybridNitroTextViewComponent.hpp +149 -0
- package/nitrogen/generated/shared/json/NitroNumberViewConfig.json +20 -0
- package/nitrogen/generated/shared/json/NitroTextViewConfig.json +30 -0
- package/package.json +1 -1
- package/src/NitroNumber.tsx +183 -9
- package/src/NitroText.tsx +166 -0
- package/src/NitroTime.tsx +68 -0
- package/src/formatProps.ts +108 -18
- package/src/index.ts +5 -0
- package/src/specs/NitroNumber.nitro.ts +69 -0
- package/src/specs/NitroText.nitro.ts +65 -0
|
@@ -0,0 +1,583 @@
|
|
|
1
|
+
//
|
|
2
|
+
// NitroTextView.swift
|
|
3
|
+
// NitroInput
|
|
4
|
+
//
|
|
5
|
+
// A single line of text that morphs to the next (NitroText). The C++
|
|
6
|
+
// `ReflowEngine` decides where every character is while a morph runs, and
|
|
7
|
+
// this view draws every character at its own position, opacity and scale,
|
|
8
|
+
// frame by frame. At rest the line is one draw of cached glyphs, and the
|
|
9
|
+
// engine is not involved: a label that never changes never pays for it. There is no text field and no layer per character,
|
|
10
|
+
// so mounting a thousand of them costs about what a thousand labels do.
|
|
11
|
+
// `NitroTextMeasure` measures a line the same way (`NitroTextFonts`), so the
|
|
12
|
+
// JS side gives the view its size in the commit that mounts it.
|
|
13
|
+
//
|
|
14
|
+
|
|
15
|
+
import UIKit
|
|
16
|
+
|
|
17
|
+
/// The fonts NitroText draws with, shared by every view and the measurer:
|
|
18
|
+
/// a font per size, weight and family, and each character's advance in it.
|
|
19
|
+
/// Measured on the JS thread and drawn on the main thread, so it locks.
|
|
20
|
+
final class NitroTextFonts {
|
|
21
|
+
final class Entry {
|
|
22
|
+
let font: UIFont
|
|
23
|
+
let lineHeight: CGFloat
|
|
24
|
+
fileprivate var advances: [UInt32: CGFloat] = [:]
|
|
25
|
+
/// Each character's glyph in this font, shaped alone so the font's
|
|
26
|
+
/// features (tabular digits) apply; 0 when it is not one glyph of this
|
|
27
|
+
/// font (a fallback font, a cluster), and the line is drawn as a string.
|
|
28
|
+
fileprivate var glyphs: [UInt32: CGGlyph] = [:]
|
|
29
|
+
/**
|
|
30
|
+
* The same for the first `direct` scalars, read without the lock: every
|
|
31
|
+
* commit and every frame looks characters up, and on the main thread the
|
|
32
|
+
* lock cost more than the lookup. Fixed buffers written under the lock;
|
|
33
|
+
* an aligned 8- or 4-byte store is atomic on arm64, so a reader sees the
|
|
34
|
+
* sentinel (and takes the locked path) or the whole value.
|
|
35
|
+
*/
|
|
36
|
+
fileprivate let directAdvances: UnsafeMutablePointer<CGFloat>
|
|
37
|
+
fileprivate let directGlyphs: UnsafeMutablePointer<UInt32>
|
|
38
|
+
|
|
39
|
+
init(font: UIFont) {
|
|
40
|
+
self.font = font
|
|
41
|
+
lineHeight = ceil(font.lineHeight)
|
|
42
|
+
directAdvances = .allocate(capacity: NitroTextFonts.direct)
|
|
43
|
+
directAdvances.initialize(repeating: .nan, count: NitroTextFonts.direct)
|
|
44
|
+
directGlyphs = .allocate(capacity: NitroTextFonts.direct)
|
|
45
|
+
directGlyphs.initialize(repeating: NitroTextFonts.unknownGlyph, count: NitroTextFonts.direct)
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
deinit {
|
|
49
|
+
directAdvances.deallocate()
|
|
50
|
+
directGlyphs.deallocate()
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/// Scalars below this (Latin, Greek, Cyrillic) have lock-free slots.
|
|
55
|
+
fileprivate static let direct = 0x530
|
|
56
|
+
fileprivate static let unknownGlyph = UInt32.max
|
|
57
|
+
|
|
58
|
+
static let shared = NitroTextFonts()
|
|
59
|
+
private var entries: [String: Entry] = [:]
|
|
60
|
+
private let lock = NSLock()
|
|
61
|
+
|
|
62
|
+
func entry(size: CGFloat, weight: CGFloat, family: String) -> Entry {
|
|
63
|
+
let key = "\(size)|\(weight)|\(family)"
|
|
64
|
+
lock.lock()
|
|
65
|
+
defer { lock.unlock() }
|
|
66
|
+
if let entry = entries[key] { return entry }
|
|
67
|
+
let entry = Entry(font: Self.makeFont(size: size, weight: weight, family: family))
|
|
68
|
+
if entries.count > 64 { entries.removeAll(keepingCapacity: true) }
|
|
69
|
+
entries[key] = entry
|
|
70
|
+
return entry
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/// One character's advance, as the view lays it out (no kerning with its neighbours).
|
|
74
|
+
func advance(of scalar: Unicode.Scalar, in entry: Entry) -> CGFloat {
|
|
75
|
+
let v = Int(scalar.value)
|
|
76
|
+
if v < Self.direct {
|
|
77
|
+
let width = entry.directAdvances[v]
|
|
78
|
+
if !width.isNaN { return width }
|
|
79
|
+
}
|
|
80
|
+
lock.lock()
|
|
81
|
+
if let width = entry.advances[scalar.value] {
|
|
82
|
+
lock.unlock()
|
|
83
|
+
return width
|
|
84
|
+
}
|
|
85
|
+
lock.unlock()
|
|
86
|
+
let width = NSAttributedString(string: String(Character(scalar)), attributes: [.font: entry.font]).size().width
|
|
87
|
+
lock.lock()
|
|
88
|
+
entry.advances[scalar.value] = width
|
|
89
|
+
if v < Self.direct { entry.directAdvances[v] = width }
|
|
90
|
+
lock.unlock()
|
|
91
|
+
return width
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/// One character's glyph, or 0 when it has to be drawn as a string: a
|
|
95
|
+
/// script that shapes by context (joining, combining marks, clusters) or a
|
|
96
|
+
/// character this font lacks.
|
|
97
|
+
func glyph(of scalar: Unicode.Scalar, in entry: Entry) -> CGGlyph {
|
|
98
|
+
guard Self.drawsAlone(scalar) else { return 0 }
|
|
99
|
+
let v = Int(scalar.value)
|
|
100
|
+
if v < Self.direct {
|
|
101
|
+
let glyph = entry.directGlyphs[v]
|
|
102
|
+
if glyph != Self.unknownGlyph { return CGGlyph(glyph) }
|
|
103
|
+
}
|
|
104
|
+
lock.lock()
|
|
105
|
+
if let glyph = entry.glyphs[scalar.value] {
|
|
106
|
+
lock.unlock()
|
|
107
|
+
return glyph
|
|
108
|
+
}
|
|
109
|
+
lock.unlock()
|
|
110
|
+
var glyph: CGGlyph = 0
|
|
111
|
+
let line = CTLineCreateWithAttributedString(NSAttributedString(string: String(Character(scalar)), attributes: [.font: entry.font]))
|
|
112
|
+
if let runs = CTLineGetGlyphRuns(line) as? [CTRun], runs.count == 1, CTRunGetGlyphCount(runs[0]) == 1 {
|
|
113
|
+
let attributes = CTRunGetAttributes(runs[0]) as NSDictionary
|
|
114
|
+
let runFont = attributes[kCTFontAttributeName as String].map { $0 as! CTFont }
|
|
115
|
+
if let runFont, CTFontCopyPostScriptName(runFont) as String == CTFontCopyPostScriptName(entry.font as CTFont) as String {
|
|
116
|
+
CTRunGetGlyphs(runs[0], CFRange(location: 0, length: 1), &glyph)
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
lock.lock()
|
|
120
|
+
entry.glyphs[scalar.value] = glyph
|
|
121
|
+
if v < Self.direct { entry.directGlyphs[v] = UInt32(glyph) }
|
|
122
|
+
lock.unlock()
|
|
123
|
+
return glyph
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
/// Scripts whose characters look the same alone as in a word.
|
|
127
|
+
private static func drawsAlone(_ scalar: Unicode.Scalar) -> Bool {
|
|
128
|
+
switch scalar.value {
|
|
129
|
+
case 0x20..<0x300, 0x370..<0x590, 0x1E00..<0x2000, 0x2010..<0x2028, 0x202F, 0x2030..<0x205F, 0x20A0..<0x20D0, 0x2100..<0x2300:
|
|
130
|
+
return true
|
|
131
|
+
default:
|
|
132
|
+
return false
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/// The line's width: every character's advance and the letter spacing after it.
|
|
137
|
+
func width(of text: String, in entry: Entry, letterSpacing: CGFloat) -> CGFloat {
|
|
138
|
+
var total: CGFloat = 0
|
|
139
|
+
for scalar in text.unicodeScalars {
|
|
140
|
+
total += advance(of: scalar, in: entry) + letterSpacing
|
|
141
|
+
}
|
|
142
|
+
return total
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
static func makeFont(size: CGFloat, weight: CGFloat, family: String) -> UIFont {
|
|
146
|
+
let uiWeight: UIFont.Weight
|
|
147
|
+
switch weight {
|
|
148
|
+
case ..<150: uiWeight = .ultraLight
|
|
149
|
+
case ..<250: uiWeight = .thin
|
|
150
|
+
case ..<350: uiWeight = .light
|
|
151
|
+
case ..<450: uiWeight = .regular
|
|
152
|
+
case ..<550: uiWeight = .medium
|
|
153
|
+
case ..<650: uiWeight = .semibold
|
|
154
|
+
case ..<750: uiWeight = .bold
|
|
155
|
+
case ..<850: uiWeight = .heavy
|
|
156
|
+
default: uiWeight = .black
|
|
157
|
+
}
|
|
158
|
+
let traits: [UIFontDescriptor.TraitKey: Any] = [.weight: uiWeight]
|
|
159
|
+
let base: UIFont
|
|
160
|
+
if !family.isEmpty, let named = UIFont(name: family, size: size) {
|
|
161
|
+
base = UIFont(descriptor: named.fontDescriptor.addingAttributes([.traits: traits]), size: size)
|
|
162
|
+
} else if !family.isEmpty, !UIFont.fontNames(forFamilyName: family).isEmpty {
|
|
163
|
+
base = UIFont(descriptor: UIFontDescriptor(fontAttributes: [.family: family, .traits: traits]), size: size)
|
|
164
|
+
} else {
|
|
165
|
+
base = UIFont.systemFont(ofSize: size, weight: uiWeight)
|
|
166
|
+
}
|
|
167
|
+
// Tabular digits: a column keeps its width while its digit morphs.
|
|
168
|
+
let feature: [UIFontDescriptor.FeatureKey: Int] = [.type: kNumberSpacingType, .selector: kMonospacedNumbersSelector]
|
|
169
|
+
return UIFont(descriptor: base.fontDescriptor.addingAttributes([.featureSettings: [feature]]), size: size)
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
final class NitroTextView: UIView {
|
|
174
|
+
private typealias Engine = margelo.nitro.nitroinput.ReflowEngine
|
|
175
|
+
private enum Kind { static let text: Int32 = 0, digit: Int32 = 1, separator: Int32 = 2, decimal: Int32 = 3 }
|
|
176
|
+
private static let body: Int32 = 1
|
|
177
|
+
|
|
178
|
+
struct Style: Equatable {
|
|
179
|
+
var fontSize: CGFloat = 17
|
|
180
|
+
var fontWeight: CGFloat = 400
|
|
181
|
+
var fontFamily = ""
|
|
182
|
+
var color: UIColor = .label
|
|
183
|
+
var letterSpacing: CGFloat = 0
|
|
184
|
+
var textAlign: NitroNumberView.Alignment = .auto
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
struct Timing: Equatable {
|
|
188
|
+
var duration: TimeInterval = 0.4
|
|
189
|
+
var easing: Int32 = 0
|
|
190
|
+
var bounce: Double = 0.15
|
|
191
|
+
var effect: Int32 = 0
|
|
192
|
+
var respectReduceMotion = true
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
var style = Style() {
|
|
196
|
+
didSet {
|
|
197
|
+
guard style != oldValue else { return }
|
|
198
|
+
fonts = NitroTextFonts.shared.entry(size: style.fontSize, weight: style.fontWeight, family: style.fontFamily)
|
|
199
|
+
restString = nil
|
|
200
|
+
restLayout = nil
|
|
201
|
+
// New advances: the engine lays the line out again when it next morphs.
|
|
202
|
+
engineText = nil
|
|
203
|
+
updateDisplayLink()
|
|
204
|
+
setNeedsDisplay()
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
var timing = Timing() {
|
|
209
|
+
didSet {
|
|
210
|
+
engine.setTiming(timing.duration, timing.easing, timing.bounce)
|
|
211
|
+
engine.setEffect(timing.effect)
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
var shimmer = NitroNumberView.Shimmer() {
|
|
216
|
+
didSet { if loading { setNeedsDisplay() } }
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
var text = "" {
|
|
220
|
+
didSet {
|
|
221
|
+
// Shown even when unchanged: a recycled view handed its own text again.
|
|
222
|
+
defer { shown = true }
|
|
223
|
+
guard text != oldValue else { return }
|
|
224
|
+
restString = nil
|
|
225
|
+
restLayout = nil
|
|
226
|
+
if shown && morphs {
|
|
227
|
+
// Hand the engine what is on screen first if it doesn't hold it: it
|
|
228
|
+
// only learns a line when that line has to morph.
|
|
229
|
+
if engineText != oldValue { commit(oldValue, animated: false) }
|
|
230
|
+
commit(text, animated: true)
|
|
231
|
+
} else {
|
|
232
|
+
engineText = nil
|
|
233
|
+
}
|
|
234
|
+
updateDisplayLink()
|
|
235
|
+
setNeedsDisplay()
|
|
236
|
+
updateAccessibility()
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
var loading = false {
|
|
241
|
+
didSet {
|
|
242
|
+
guard loading != oldValue else { return }
|
|
243
|
+
loadingFrom = loadingProgress
|
|
244
|
+
loadingStart = CACurrentMediaTime()
|
|
245
|
+
updateDisplayLink()
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
var rightToLeft = false {
|
|
250
|
+
didSet {
|
|
251
|
+
guard rightToLeft != oldValue else { return }
|
|
252
|
+
engine.setRightToLeft(rightToLeft)
|
|
253
|
+
setNeedsDisplay()
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
private var engine = Engine()
|
|
258
|
+
/// The line the engine holds (its target, while it morphs); nil when it is
|
|
259
|
+
/// out of date and the view draws `text` on its own.
|
|
260
|
+
private var engineText: String?
|
|
261
|
+
/// A line has been shown: the next one morphs from it.
|
|
262
|
+
private var shown = false
|
|
263
|
+
/// The line at rest: each glyph and where it starts; nil glyphs when a
|
|
264
|
+
/// character has to be drawn as a string.
|
|
265
|
+
private var restLayout: (glyphs: [CGGlyph]?, xs: [CGFloat], width: CGFloat)?
|
|
266
|
+
private var fonts = NitroTextFonts.shared.entry(size: 17, weight: 400, family: "")
|
|
267
|
+
/// The line at rest, as one attributed string (kerning off, so it lands where the engine put each character).
|
|
268
|
+
private var restString: NSAttributedString?
|
|
269
|
+
private var displayLink: CADisplayLink?
|
|
270
|
+
/// Frames went undrawn while the view was out of sight.
|
|
271
|
+
private var framesSkipped = false
|
|
272
|
+
private var loadingProgress: CGFloat = 0
|
|
273
|
+
private var loadingFrom: CGFloat = 0
|
|
274
|
+
private var loadingStart: CFTimeInterval = 0
|
|
275
|
+
private static let loadingFade: CFTimeInterval = 0.25
|
|
276
|
+
private var explicitAccessibilityLabel: String?
|
|
277
|
+
|
|
278
|
+
override init(frame: CGRect) {
|
|
279
|
+
super.init(frame: frame)
|
|
280
|
+
isOpaque = false
|
|
281
|
+
backgroundColor = .clear
|
|
282
|
+
contentMode = .redraw
|
|
283
|
+
clipsToBounds = false
|
|
284
|
+
isAccessibilityElement = true
|
|
285
|
+
accessibilityTraits = .staticText
|
|
286
|
+
engine.setTiming(timing.duration, timing.easing, timing.bounce)
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
@available(*, unavailable)
|
|
290
|
+
required init?(coder: NSCoder) {
|
|
291
|
+
fatalError("init(coder:) is not supported")
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
deinit {
|
|
295
|
+
displayLink?.invalidate()
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
override var accessibilityLabel: String? {
|
|
299
|
+
get { explicitAccessibilityLabel.flatMap { $0.isEmpty ? nil : $0 } ?? text }
|
|
300
|
+
set { explicitAccessibilityLabel = newValue }
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
override var accessibilityValue: String? {
|
|
304
|
+
get { loading ? "Loading" : nil }
|
|
305
|
+
set {}
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
private func updateAccessibility() {
|
|
309
|
+
if isAccessibilityElement, UIAccessibility.isVoiceOverRunning {
|
|
310
|
+
UIAccessibility.post(notification: .layoutChanged, argument: nil)
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
/// Fabric is about to reuse this view: forget every animation, and that a
|
|
315
|
+
/// line was shown, so the next element's text appears instead of morphing.
|
|
316
|
+
/// The text and what is drawn stay, as a label's do: an element with the
|
|
317
|
+
/// same text and style (a list scrolled back, a screen mounted again) draws
|
|
318
|
+
/// nothing.
|
|
319
|
+
func resetForRecycle() {
|
|
320
|
+
let settled = !moving && loadingProgress == 0
|
|
321
|
+
loadingProgress = 0
|
|
322
|
+
loading = false
|
|
323
|
+
displayLink?.invalidate()
|
|
324
|
+
displayLink = nil
|
|
325
|
+
framesSkipped = false
|
|
326
|
+
engine.reset()
|
|
327
|
+
engine.setTiming(timing.duration, timing.easing, timing.bounce)
|
|
328
|
+
engine.setEffect(timing.effect)
|
|
329
|
+
engine.setRightToLeft(rightToLeft)
|
|
330
|
+
engineText = nil
|
|
331
|
+
shown = false
|
|
332
|
+
explicitAccessibilityLabel = nil
|
|
333
|
+
// Caught mid-morph or loading: the next draw is the line at rest.
|
|
334
|
+
if !settled { setNeedsDisplay() }
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
// MARK: - Text
|
|
338
|
+
|
|
339
|
+
/// Hands the engine the text, one glyph per character with its advance;
|
|
340
|
+
/// digits match by place and separators travel with their digits, the rest
|
|
341
|
+
/// by the longest common run.
|
|
342
|
+
private func commit(_ line: String, animated: Bool) {
|
|
343
|
+
engine.setReduceMotion(!animated)
|
|
344
|
+
engine.beginText()
|
|
345
|
+
let scalars = Array(line.unicodeScalars)
|
|
346
|
+
for (i, scalar) in scalars.enumerated() {
|
|
347
|
+
let width = NitroTextFonts.shared.advance(of: scalar, in: fonts) + style.letterSpacing
|
|
348
|
+
engine.addGlyph(scalar.value, Self.body, Self.kind(scalars, i), Double(width), false)
|
|
349
|
+
}
|
|
350
|
+
engine.commitText(-1, CACurrentMediaTime())
|
|
351
|
+
engineText = line
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
/// A change morphs unless it can't be seen to: no duration, or Reduce Motion.
|
|
355
|
+
private var morphs: Bool {
|
|
356
|
+
timing.duration > 0 && !(timing.respectReduceMotion && UIAccessibility.isReduceMotionEnabled)
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
private var moving: Bool { engineText != nil && engine.needsFrames() }
|
|
360
|
+
|
|
361
|
+
private static func isDigit(_ s: Unicode.Scalar) -> Bool { s.value >= 48 && s.value <= 57 }
|
|
362
|
+
|
|
363
|
+
private static func kind(_ scalars: [Unicode.Scalar], _ i: Int) -> Int32 {
|
|
364
|
+
let s = scalars[i]
|
|
365
|
+
if isDigit(s) { return Kind.digit }
|
|
366
|
+
// A comma or a point between two digits belongs to the number.
|
|
367
|
+
guard i > 0, i + 1 < scalars.count, isDigit(scalars[i - 1]), isDigit(scalars[i + 1]) else { return Kind.text }
|
|
368
|
+
if s == "," || s == "\u{202F}" || s == "\u{00A0}" || s == "'" { return Kind.separator }
|
|
369
|
+
if s == "." { return Kind.decimal }
|
|
370
|
+
return Kind.text
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
// MARK: - Frames
|
|
374
|
+
|
|
375
|
+
private var needsFrames: Bool { moving || loading || loadingProgress > 0 }
|
|
376
|
+
|
|
377
|
+
private func updateDisplayLink() {
|
|
378
|
+
if needsFrames {
|
|
379
|
+
guard displayLink == nil else { return }
|
|
380
|
+
let link = CADisplayLink(target: DisplayLinkProxy(self), selector: #selector(DisplayLinkProxy.tick(_:)))
|
|
381
|
+
link.add(to: .main, forMode: .common)
|
|
382
|
+
displayLink = link
|
|
383
|
+
} else {
|
|
384
|
+
displayLink?.invalidate()
|
|
385
|
+
displayLink = nil
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
private final class DisplayLinkProxy: NSObject {
|
|
390
|
+
weak var view: NitroTextView?
|
|
391
|
+
init(_ view: NitroTextView) { self.view = view }
|
|
392
|
+
@objc func tick(_ link: CADisplayLink) {
|
|
393
|
+
guard let view, !view.frameTick() else { return }
|
|
394
|
+
view.updateDisplayLink()
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
/// One frame: the morph and the loading fade advance; `false` once nothing moves.
|
|
399
|
+
private func frameTick() -> Bool {
|
|
400
|
+
let now = CACurrentMediaTime()
|
|
401
|
+
if engineText != nil { _ = engine.tick(now) }
|
|
402
|
+
let target: CGFloat = loading ? 1 : 0
|
|
403
|
+
if loadingProgress != target {
|
|
404
|
+
let t = CGFloat(min(1, (now - loadingStart) / Self.loadingFade))
|
|
405
|
+
loadingProgress = loadingFrom + (target - loadingFrom) * t
|
|
406
|
+
}
|
|
407
|
+
let more = needsFrames
|
|
408
|
+
// A view scrolled out of sight is not drawn every frame (Core Animation
|
|
409
|
+
// redraws every layer marked, on screen or not): once when it settles,
|
|
410
|
+
// and every frame again as soon as it is in sight.
|
|
411
|
+
if onScreen {
|
|
412
|
+
setNeedsDisplay()
|
|
413
|
+
framesSkipped = false
|
|
414
|
+
} else {
|
|
415
|
+
framesSkipped = true
|
|
416
|
+
}
|
|
417
|
+
if !more, framesSkipped {
|
|
418
|
+
framesSkipped = false
|
|
419
|
+
setNeedsDisplay()
|
|
420
|
+
}
|
|
421
|
+
return more
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
private var onScreen: Bool {
|
|
425
|
+
guard let window, !isHidden else { return false }
|
|
426
|
+
return convert(bounds, to: window).intersects(window.bounds)
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
// MARK: - Drawing
|
|
430
|
+
|
|
431
|
+
override func draw(_ rect: CGRect) {
|
|
432
|
+
guard let ctx = UIGraphicsGetCurrentContext() else { return }
|
|
433
|
+
let moving = self.moving
|
|
434
|
+
guard moving || !text.isEmpty else { return }
|
|
435
|
+
let lineHeight = fonts.lineHeight
|
|
436
|
+
let rest = moving ? nil : self.rest()
|
|
437
|
+
let content = rest?.width ?? CGFloat(engine.contentWidth())
|
|
438
|
+
let rtl = rightToLeft
|
|
439
|
+
let originX: CGFloat
|
|
440
|
+
switch style.textAlign {
|
|
441
|
+
case .left: originX = 0
|
|
442
|
+
case .right: originX = bounds.width - content
|
|
443
|
+
case .center: originX = (bounds.width - content) / 2
|
|
444
|
+
case .auto: originX = rtl ? bounds.width - content : 0
|
|
445
|
+
}
|
|
446
|
+
let originY = (bounds.height - lineHeight) / 2
|
|
447
|
+
let dim = loadingProgress
|
|
448
|
+
if dim > 0 { ctx.beginTransparencyLayer(auxiliaryInfo: nil) }
|
|
449
|
+
if moving {
|
|
450
|
+
drawMoving(ctx, origin: CGPoint(x: originX, y: originY), lineHeight: lineHeight)
|
|
451
|
+
} else if let rest, let glyphs = rest.glyphs {
|
|
452
|
+
// At rest: the whole line in one draw of its glyphs, each at its advance.
|
|
453
|
+
drawGlyphs(ctx, glyphs, rest.xs.map { originX + $0 }, top: originY)
|
|
454
|
+
} else {
|
|
455
|
+
restLine().draw(at: CGPoint(x: originX, y: originY))
|
|
456
|
+
}
|
|
457
|
+
if dim > 0 {
|
|
458
|
+
drawShimmer(ctx, left: originX, width: content, lineHeight: lineHeight, top: originY, dim: dim)
|
|
459
|
+
ctx.endTransparencyLayer()
|
|
460
|
+
}
|
|
461
|
+
}
|
|
462
|
+
|
|
463
|
+
private func rest() -> (glyphs: [CGGlyph]?, xs: [CGFloat], width: CGFloat) {
|
|
464
|
+
if let restLayout { return restLayout }
|
|
465
|
+
let fontSet = NitroTextFonts.shared
|
|
466
|
+
var glyphs: [CGGlyph]? = []
|
|
467
|
+
var xs: [CGFloat] = []
|
|
468
|
+
var x: CGFloat = 0
|
|
469
|
+
for scalar in text.unicodeScalars {
|
|
470
|
+
if glyphs != nil {
|
|
471
|
+
let glyph = fontSet.glyph(of: scalar, in: fonts)
|
|
472
|
+
if glyph == 0 { glyphs = nil } else { glyphs!.append(glyph) }
|
|
473
|
+
}
|
|
474
|
+
xs.append(x)
|
|
475
|
+
x += fontSet.advance(of: scalar, in: fonts) + style.letterSpacing
|
|
476
|
+
}
|
|
477
|
+
let layout = (glyphs: glyphs, xs: xs, width: x)
|
|
478
|
+
restLayout = layout
|
|
479
|
+
return layout
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
/// Glyphs of the view's font with the top of their line box at `top`, as a
|
|
483
|
+
/// string drawn at that point would sit.
|
|
484
|
+
private func drawGlyphs(_ ctx: CGContext, _ glyphs: [CGGlyph], _ xs: [CGFloat], top: CGFloat) {
|
|
485
|
+
ctx.saveGState()
|
|
486
|
+
ctx.textMatrix = .identity
|
|
487
|
+
ctx.translateBy(x: 0, y: top + fonts.font.ascender)
|
|
488
|
+
ctx.scaleBy(x: 1, y: -1)
|
|
489
|
+
ctx.setFillColor(style.color.resolvedColor(with: traitCollection).cgColor)
|
|
490
|
+
let positions = xs.map { CGPoint(x: $0, y: 0) }
|
|
491
|
+
CTFontDrawGlyphs(fonts.font as CTFont, glyphs, positions, glyphs.count, ctx)
|
|
492
|
+
ctx.restoreGState()
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
private func restLine() -> NSAttributedString {
|
|
496
|
+
if let restString { return restString }
|
|
497
|
+
let string = NSAttributedString(string: text, attributes: attributes)
|
|
498
|
+
restString = string
|
|
499
|
+
return string
|
|
500
|
+
}
|
|
501
|
+
|
|
502
|
+
/// Kerning off (a kern of the letter spacing replaces the font's pairs) and
|
|
503
|
+
/// no ligatures, so the line's characters sit where their advances put them.
|
|
504
|
+
private var attributes: [NSAttributedString.Key: Any] {
|
|
505
|
+
[.font: fonts.font, .foregroundColor: style.color.resolvedColor(with: traitCollection), .kern: style.letterSpacing, .ligature: 0]
|
|
506
|
+
}
|
|
507
|
+
|
|
508
|
+
private func drawMoving(_ ctx: CGContext, origin: CGPoint, lineHeight: CGFloat) {
|
|
509
|
+
let count = Int(engine.glyphCount())
|
|
510
|
+
for i in 0..<count {
|
|
511
|
+
let g = engine.glyphAt(Int32(i))
|
|
512
|
+
let opacity = CGFloat(min(1, max(0, g.opacity)))
|
|
513
|
+
guard opacity > 0.002, let scalar = Unicode.Scalar(g.character) else { continue }
|
|
514
|
+
let x = origin.x + CGFloat(g.x)
|
|
515
|
+
let y = origin.y + CGFloat(g.y) * lineHeight
|
|
516
|
+
ctx.saveGState()
|
|
517
|
+
ctx.setAlpha(opacity)
|
|
518
|
+
let scale = CGFloat(g.scale)
|
|
519
|
+
var at = CGPoint(x: x, y: y)
|
|
520
|
+
if abs(scale - 1) > 0.0001 {
|
|
521
|
+
let width = CGFloat(g.width)
|
|
522
|
+
ctx.translateBy(x: x + width / 2, y: y + lineHeight / 2)
|
|
523
|
+
ctx.scaleBy(x: scale, y: scale)
|
|
524
|
+
at = CGPoint(x: -width / 2, y: -lineHeight / 2)
|
|
525
|
+
}
|
|
526
|
+
// The same glyph the line at rest draws, so a morph lands without a shift.
|
|
527
|
+
let glyph = NitroTextFonts.shared.glyph(of: scalar, in: fonts)
|
|
528
|
+
if glyph != 0 {
|
|
529
|
+
drawGlyphs(ctx, [glyph], [at.x], top: at.y)
|
|
530
|
+
} else {
|
|
531
|
+
NSAttributedString(string: String(Character(scalar)), attributes: self.attributes).draw(at: at)
|
|
532
|
+
}
|
|
533
|
+
ctx.restoreGState()
|
|
534
|
+
}
|
|
535
|
+
}
|
|
536
|
+
|
|
537
|
+
/// The loading glint, as NitroNumber draws it: a slanted band recolouring
|
|
538
|
+
/// the ink, composited source-atop so only the glyphs light up.
|
|
539
|
+
private func drawShimmer(_ ctx: CGContext, left: CGFloat, width: CGFloat, lineHeight: CGFloat, top: CGFloat, dim: CGFloat) {
|
|
540
|
+
guard width > 0 else { return }
|
|
541
|
+
var br: CGFloat = 0, bg: CGFloat = 0, bb: CGFloat = 0, ba: CGFloat = 1
|
|
542
|
+
(shimmer.baseColor ?? style.color).resolvedColor(with: traitCollection).getRed(&br, green: &bg, blue: &bb, alpha: &ba)
|
|
543
|
+
var hr: CGFloat = 0, hg: CGFloat = 0, hb: CGFloat = 0, ha: CGFloat = 1
|
|
544
|
+
(shimmer.color ?? Self.defaultShimmerColor).resolvedColor(with: traitCollection).getRed(&hr, green: &hg, blue: &hb, alpha: &ha)
|
|
545
|
+
let base = CGColor(red: br, green: bg, blue: bb, alpha: ba)
|
|
546
|
+
let colors = [base, CGColor(red: hr, green: hg, blue: hb, alpha: ha), base] as CFArray
|
|
547
|
+
guard let gradient = CGGradient(colorsSpace: CGColorSpaceCreateDeviceRGB(), colors: colors, locations: [0.1, 0.5, 0.9]) else { return }
|
|
548
|
+
let cycle = shimmer.duration + shimmer.delay
|
|
549
|
+
let reduceMotion = timing.respectReduceMotion && UIAccessibility.isReduceMotionEnabled
|
|
550
|
+
let elapsed = reduceMotion ? 0 : CACurrentMediaTime().truncatingRemainder(dividingBy: cycle)
|
|
551
|
+
let phase = min(1, CGFloat(elapsed / shimmer.duration))
|
|
552
|
+
let seeded = 0.25 + 0.75 * phase
|
|
553
|
+
let ltr = shimmer.leftToRight ?? !rightToLeft
|
|
554
|
+
let progress = ltr ? seeded : 1 - seeded
|
|
555
|
+
let length = width * max(0.05, shimmer.width)
|
|
556
|
+
let startX = left + (width + length) * progress - length
|
|
557
|
+
let slant = tan(max(-75, min(75, shimmer.angle)) * .pi / 180) * (ltr ? 1 : -1)
|
|
558
|
+
ctx.saveGState()
|
|
559
|
+
ctx.setBlendMode(.sourceAtop)
|
|
560
|
+
ctx.setAlpha(dim)
|
|
561
|
+
ctx.drawLinearGradient(
|
|
562
|
+
gradient,
|
|
563
|
+
start: CGPoint(x: startX, y: top),
|
|
564
|
+
end: CGPoint(x: startX + length, y: top + slant * length),
|
|
565
|
+
options: [.drawsBeforeStartLocation, .drawsAfterEndLocation]
|
|
566
|
+
)
|
|
567
|
+
ctx.restoreGState()
|
|
568
|
+
}
|
|
569
|
+
|
|
570
|
+
private static let defaultShimmerColor = UIColor { traits in
|
|
571
|
+
traits.userInterfaceStyle == .dark
|
|
572
|
+
? UIColor(red: 0x2B / 255, green: 0x2E / 255, blue: 0x37 / 255, alpha: 1)
|
|
573
|
+
: UIColor(red: 0xD6 / 255, green: 0xD9 / 255, blue: 0xE1 / 255, alpha: 1)
|
|
574
|
+
}
|
|
575
|
+
|
|
576
|
+
override func traitCollectionDidChange(_ previousTraitCollection: UITraitCollection?) {
|
|
577
|
+
super.traitCollectionDidChange(previousTraitCollection)
|
|
578
|
+
if traitCollection.hasDifferentColorAppearance(comparedTo: previousTraitCollection) {
|
|
579
|
+
restString = nil
|
|
580
|
+
setNeedsDisplay()
|
|
581
|
+
}
|
|
582
|
+
}
|
|
583
|
+
}
|
|
@@ -32,6 +32,11 @@
|
|
|
32
32
|
"loading": true,
|
|
33
33
|
"shimmerColor": true,
|
|
34
34
|
"shimmerDuration": true,
|
|
35
|
+
"shimmerAngle": true,
|
|
36
|
+
"shimmerWidth": true,
|
|
37
|
+
"shimmerBaseColor": true,
|
|
38
|
+
"shimmerDirection": true,
|
|
39
|
+
"shimmerDelay": true,
|
|
35
40
|
"fontSize": true,
|
|
36
41
|
"prefixFontSize": true,
|
|
37
42
|
"suffixFontSize": true,
|
|
@@ -44,6 +49,19 @@
|
|
|
44
49
|
"prefixOffset": true,
|
|
45
50
|
"suffixOffset": true,
|
|
46
51
|
"tabularNums": true,
|
|
52
|
+
"signDisplay": true,
|
|
53
|
+
"plusSign": true,
|
|
54
|
+
"minusSign": true,
|
|
55
|
+
"digitGlyphs": true,
|
|
56
|
+
"groupingSizes": true,
|
|
57
|
+
"digitMax": true,
|
|
58
|
+
"continuous": true,
|
|
59
|
+
"prefixColor": true,
|
|
60
|
+
"suffixColor": true,
|
|
61
|
+
"fractionColor": true,
|
|
62
|
+
"fractionFontSize": true,
|
|
63
|
+
"fractionAlign": true,
|
|
64
|
+
"respectReduceMotion": true,
|
|
47
65
|
"adjustsFontSizeToFit": true,
|
|
48
66
|
"minimumFontScale": true,
|
|
49
67
|
"allowFontScaling": true,
|
|
@@ -56,6 +74,8 @@
|
|
|
56
74
|
"onSizeChange": true,
|
|
57
75
|
"onRevealEnd": true,
|
|
58
76
|
"onRevealMilestone": true,
|
|
77
|
+
"onAnimationStart": true,
|
|
78
|
+
"onAnimationEnd": true,
|
|
59
79
|
"hybridRef": true
|
|
60
80
|
}
|
|
61
81
|
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
{
|
|
2
|
+
"uiViewClassName": "NitroTextView",
|
|
3
|
+
"supportsRawText": false,
|
|
4
|
+
"bubblingEventTypes": {},
|
|
5
|
+
"directEventTypes": {},
|
|
6
|
+
"validAttributes": {
|
|
7
|
+
"text": true,
|
|
8
|
+
"fontSize": true,
|
|
9
|
+
"fontWeight": true,
|
|
10
|
+
"fontFamily": true,
|
|
11
|
+
"color": true,
|
|
12
|
+
"letterSpacing": true,
|
|
13
|
+
"textAlign": true,
|
|
14
|
+
"rightToLeft": true,
|
|
15
|
+
"duration": true,
|
|
16
|
+
"easing": true,
|
|
17
|
+
"bounce": true,
|
|
18
|
+
"effect": true,
|
|
19
|
+
"respectReduceMotion": true,
|
|
20
|
+
"loading": true,
|
|
21
|
+
"shimmerColor": true,
|
|
22
|
+
"shimmerDuration": true,
|
|
23
|
+
"shimmerAngle": true,
|
|
24
|
+
"shimmerWidth": true,
|
|
25
|
+
"shimmerBaseColor": true,
|
|
26
|
+
"shimmerDirection": true,
|
|
27
|
+
"shimmerDelay": true,
|
|
28
|
+
"hybridRef": true
|
|
29
|
+
}
|
|
30
|
+
}
|