react-native-tinyui 1.1.1 → 3.0.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 +140 -32
- package/ios/Core/Tinyui.mm +18 -0
- package/ios/Core/TinyuiComponentClasses.mm +7 -0
- package/ios/LiquidGlassText/TinyuiLiquidGlassTextProvider.swift +0 -1
- package/ios/SFSymbol/TinyuiSFSymbolEffects.swift +184 -0
- package/ios/SFSymbol/TinyuiSFSymbolImage.swift +103 -0
- package/ios/SFSymbol/TinyuiSFSymbolProvider.swift +135 -0
- package/ios/SFSymbol/TinyuiSFSymbolShadowNode.mm +4 -2
- package/ios/SFSymbol/TinyuiSFSymbolView.mm +14 -122
- package/ios/TipKit/TinyuiTip.swift +16 -0
- package/ios/TipKit/TinyuiTipPopoverProvider.swift +66 -135
- package/ios/TipKit/TinyuiTipPopoverView.mm +0 -18
- package/ios/TipKit/TinyuiTipView.h +8 -0
- package/ios/TipKit/TinyuiTipView.mm +93 -0
- package/ios/TipKit/TinyuiTipViewProvider.swift +140 -0
- package/ios/TipKit/TinyuiTipViewShadowNode.h +48 -0
- package/ios/TipKit/TinyuiTipsRuntime.swift +16 -74
- package/lib/module/NativeTinyui.js.map +1 -1
- package/lib/module/SFSymbol/index.js +0 -4
- package/lib/module/SFSymbol/index.js.map +1 -1
- package/lib/module/SFSymbol/options.js +0 -2
- package/lib/module/SFSymbol/options.js.map +1 -1
- package/lib/module/TipKit/Popover.js +0 -22
- package/lib/module/TipKit/Popover.js.map +1 -1
- package/lib/module/TipKit/TipPopoverNativeComponent.ts +0 -6
- package/lib/module/TipKit/TipViewNativeComponent.ts +28 -0
- package/lib/module/TipKit/View.js +62 -0
- package/lib/module/TipKit/View.js.map +1 -0
- package/lib/module/TipKit/index.js +11 -0
- package/lib/module/TipKit/index.js.map +1 -1
- package/lib/module/TipKit/validation.js +4 -4
- package/lib/module/TipKit/validation.js.map +1 -1
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/src/LiquidGlassText/types.d.ts +1 -1
- package/lib/typescript/src/LiquidGlassText/types.d.ts.map +1 -1
- package/lib/typescript/src/NativeTinyui.d.ts +1 -0
- package/lib/typescript/src/NativeTinyui.d.ts.map +1 -1
- package/lib/typescript/src/SFSymbol/index.d.ts +1 -1
- package/lib/typescript/src/SFSymbol/index.d.ts.map +1 -1
- package/lib/typescript/src/SFSymbol/options.d.ts +0 -2
- package/lib/typescript/src/SFSymbol/options.d.ts.map +1 -1
- package/lib/typescript/src/SFSymbol/types.d.ts +1 -5
- package/lib/typescript/src/SFSymbol/types.d.ts.map +1 -1
- package/lib/typescript/src/TipKit/Popover.d.ts.map +1 -1
- package/lib/typescript/src/TipKit/TipPopoverNativeComponent.d.ts +0 -9
- package/lib/typescript/src/TipKit/TipPopoverNativeComponent.d.ts.map +1 -1
- package/lib/typescript/src/TipKit/TipViewNativeComponent.d.ts +29 -0
- package/lib/typescript/src/TipKit/TipViewNativeComponent.d.ts.map +1 -0
- package/lib/typescript/src/TipKit/View.d.ts +3 -0
- package/lib/typescript/src/TipKit/View.d.ts.map +1 -0
- package/lib/typescript/src/TipKit/index.d.ts +8 -1
- package/lib/typescript/src/TipKit/index.d.ts.map +1 -1
- package/lib/typescript/src/TipKit/types.d.ts +17 -15
- package/lib/typescript/src/TipKit/types.d.ts.map +1 -1
- package/lib/typescript/src/TipKit/validation.d.ts +2 -2
- package/lib/typescript/src/TipKit/validation.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +2 -2
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/package.json +4 -1
- package/src/LiquidGlassText/types.ts +1 -1
- package/src/NativeTinyui.ts +1 -0
- package/src/SFSymbol/index.tsx +0 -5
- package/src/SFSymbol/options.ts +0 -2
- package/src/SFSymbol/types.ts +1 -18
- package/src/TipKit/Popover.tsx +1 -21
- package/src/TipKit/TipPopoverNativeComponent.ts +0 -6
- package/src/TipKit/TipViewNativeComponent.ts +28 -0
- package/src/TipKit/View.tsx +64 -0
- package/src/TipKit/index.ts +13 -1
- package/src/TipKit/types.ts +19 -20
- package/src/TipKit/validation.ts +8 -5
- package/src/index.tsx +1 -2
- package/ios/SFSymbol/TinyuiSFSymbolEffects.h +0 -9
- package/ios/SFSymbol/TinyuiSFSymbolEffects.mm +0 -180
- package/ios/SFSymbol/TinyuiSFSymbolImage.h +0 -8
- package/ios/SFSymbol/TinyuiSFSymbolImage.mm +0 -141
|
@@ -69,24 +69,6 @@ using namespace facebook::react;
|
|
|
69
69
|
[super updateProps:props oldProps:oldProps];
|
|
70
70
|
}
|
|
71
71
|
|
|
72
|
-
- (void)onTipStatusWithTipId:(NSString *)tipId status:(NSString *)status reason:(NSString *)reason
|
|
73
|
-
{
|
|
74
|
-
if (_eventEmitter == nullptr) return;
|
|
75
|
-
std::static_pointer_cast<const TinyuiTipPopoverViewEventEmitter>(_eventEmitter)->onTipStatusChange({
|
|
76
|
-
.tipId = std::string(tipId.UTF8String ?: ""),
|
|
77
|
-
.status = std::string(status.UTF8String ?: ""),
|
|
78
|
-
.reason = std::string(reason.UTF8String ?: ""),
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
- (void)onTipVisibleWithTipId:(NSString *)tipId visible:(BOOL)visible
|
|
83
|
-
{
|
|
84
|
-
if (_eventEmitter == nullptr) return;
|
|
85
|
-
std::static_pointer_cast<const TinyuiTipPopoverViewEventEmitter>(_eventEmitter)->onTipVisibleChange({
|
|
86
|
-
.tipId = std::string(tipId.UTF8String ?: ""), .visible = static_cast<bool>(visible),
|
|
87
|
-
});
|
|
88
|
-
}
|
|
89
|
-
|
|
90
72
|
- (void)onTipActionWithTipId:(NSString *)tipId id:(NSString *)identifier title:(NSString *)title
|
|
91
73
|
{
|
|
92
74
|
if (_eventEmitter == nullptr) return;
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
#if TINYUI_FEATURE_TIP_KIT
|
|
2
|
+
#import "TinyuiTipView.h"
|
|
3
|
+
#import "TinyuiTipViewShadowNode.h"
|
|
4
|
+
#import "Tinyui-Swift.h"
|
|
5
|
+
#import <React/RCTConversions.h>
|
|
6
|
+
#import <react/renderer/components/TinyuiSpec/RCTComponentViewHelpers.h>
|
|
7
|
+
|
|
8
|
+
using namespace facebook::react;
|
|
9
|
+
|
|
10
|
+
@interface TinyuiTipView () <RCTTinyuiTipViewViewProtocol, TinyuiTipViewDelegate>
|
|
11
|
+
@end
|
|
12
|
+
|
|
13
|
+
@implementation TinyuiTipView {
|
|
14
|
+
TinyuiTipViewProvider *_provider;
|
|
15
|
+
TinyuiInlineTipShadowNode::ConcreteState::Shared _state;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
+ (ComponentDescriptorProvider)componentDescriptorProvider
|
|
19
|
+
{
|
|
20
|
+
return concreteComponentDescriptorProvider<TinyuiInlineTipComponentDescriptor>();
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
- (instancetype)initWithFrame:(CGRect)frame
|
|
24
|
+
{
|
|
25
|
+
if (self = [super initWithFrame:frame]) {
|
|
26
|
+
_props = TinyuiInlineTipShadowNode::defaultSharedProps();
|
|
27
|
+
_provider = [[TinyuiTipViewProvider alloc] initWithDelegate:self];
|
|
28
|
+
self.contentView = _provider;
|
|
29
|
+
}
|
|
30
|
+
return self;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
- (void)updateProps:(Props::Shared const &)props oldProps:(Props::Shared const &)oldProps
|
|
34
|
+
{
|
|
35
|
+
const auto &next = *std::static_pointer_cast<const TinyuiTipViewProps>(props);
|
|
36
|
+
NSMutableArray *actions = [NSMutableArray new];
|
|
37
|
+
for (const auto &action : next.actions) {
|
|
38
|
+
[actions addObject:@{@"id": RCTNSStringFromString(action.id), @"title": RCTNSStringFromString(action.title)}];
|
|
39
|
+
}
|
|
40
|
+
[_provider configure:@{
|
|
41
|
+
@"tipId": RCTNSStringFromString(next.tipId),
|
|
42
|
+
@"title": RCTNSStringFromString(next.title),
|
|
43
|
+
@"message": RCTNSStringFromString(next.message),
|
|
44
|
+
@"systemImage": RCTNSStringFromString(next.systemImage),
|
|
45
|
+
@"actions": actions,
|
|
46
|
+
@"maxDisplayCount": @(next.maxDisplayCount),
|
|
47
|
+
@"ignoresDisplayFrequency": @(next.ignoresDisplayFrequency),
|
|
48
|
+
} enabled:next.enabled arrowEdge:RCTNSStringFromString(next.arrowEdge)];
|
|
49
|
+
[super updateProps:props oldProps:oldProps];
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
- (void)updateState:(const State::Shared &)state oldState:(const State::Shared &)oldState
|
|
53
|
+
{
|
|
54
|
+
_state = std::static_pointer_cast<const TinyuiInlineTipShadowNode::ConcreteState>(state);
|
|
55
|
+
[_provider setNeedsLayout];
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
- (void)onTipSizeChangeWithTipId:(NSString *)tipId width:(CGFloat)width height:(CGFloat)height
|
|
59
|
+
{
|
|
60
|
+
if (_state == nullptr) return;
|
|
61
|
+
const auto &previous = _state->getData();
|
|
62
|
+
std::string identifier(tipId.UTF8String ?: "");
|
|
63
|
+
facebook::react::Size size{static_cast<Float>(width), static_cast<Float>(height)};
|
|
64
|
+
if (previous.tipId == identifier && previous.contentSize == size) return;
|
|
65
|
+
_state->updateState(TinyuiInlineTipState{identifier, size});
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
- (void)onTipActionWithTipId:(NSString *)tipId id:(NSString *)identifier title:(NSString *)title
|
|
69
|
+
{
|
|
70
|
+
if (_eventEmitter == nullptr) return;
|
|
71
|
+
std::static_pointer_cast<const TinyuiTipViewEventEmitter>(_eventEmitter)->onTipAction({
|
|
72
|
+
.tipId = std::string(tipId.UTF8String ?: ""),
|
|
73
|
+
.id = std::string(identifier.UTF8String ?: ""), .title = std::string(title.UTF8String ?: ""),
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
- (void)onTipErrorWithTipId:(NSString *)tipId code:(NSString *)code message:(NSString *)message
|
|
78
|
+
{
|
|
79
|
+
if (_eventEmitter == nullptr) return;
|
|
80
|
+
std::static_pointer_cast<const TinyuiTipViewEventEmitter>(_eventEmitter)->onTipError({
|
|
81
|
+
.tipId = std::string(tipId.UTF8String ?: ""),
|
|
82
|
+
.code = std::string(code.UTF8String ?: ""), .message = std::string(message.UTF8String ?: ""),
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
- (void)prepareForRecycle
|
|
87
|
+
{
|
|
88
|
+
_state.reset();
|
|
89
|
+
[_provider reset];
|
|
90
|
+
[super prepareForRecycle];
|
|
91
|
+
}
|
|
92
|
+
@end
|
|
93
|
+
#endif
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import SwiftUI
|
|
2
|
+
import TipKit
|
|
3
|
+
import UIKit
|
|
4
|
+
|
|
5
|
+
@objc public protocol TinyuiTipViewDelegate: AnyObject {
|
|
6
|
+
func onTipAction(tipId: String, id: String, title: String)
|
|
7
|
+
func onTipError(tipId: String, code: String, message: String)
|
|
8
|
+
// Fabric consumes this size directly; it is not a JavaScript event.
|
|
9
|
+
func onTipSizeChange(tipId: String, width: CGFloat, height: CGFloat)
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
@MainActor
|
|
13
|
+
@objc public final class TinyuiTipViewProvider: UIView {
|
|
14
|
+
private weak var delegate: TinyuiTipViewDelegate?
|
|
15
|
+
private var tip: TinyuiTip?
|
|
16
|
+
private var enabled = false
|
|
17
|
+
private var arrowEdge: Edge?
|
|
18
|
+
private var observation: Task<Void, Never>?
|
|
19
|
+
private var tipView: TipUIView?
|
|
20
|
+
private var lastError: String?
|
|
21
|
+
|
|
22
|
+
@objc public convenience init(delegate: TinyuiTipViewDelegate) {
|
|
23
|
+
self.init(frame: .zero)
|
|
24
|
+
self.delegate = delegate
|
|
25
|
+
clipsToBounds = true
|
|
26
|
+
registerForTraitChanges([UITraitPreferredContentSizeCategory.self]) { (view: TinyuiTipViewProvider, _: UITraitCollection) in
|
|
27
|
+
view.setNeedsLayout()
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
@objc public func configure(_ configuration: [String: Any], enabled: Bool, arrowEdge: String) {
|
|
32
|
+
let nextTip = TinyuiTip(configuration: configuration)
|
|
33
|
+
if tip?.id != nextTip.id || self.enabled != enabled {
|
|
34
|
+
stop()
|
|
35
|
+
lastError = nil
|
|
36
|
+
}
|
|
37
|
+
tip = nextTip
|
|
38
|
+
self.enabled = enabled
|
|
39
|
+
switch arrowEdge {
|
|
40
|
+
case "top": self.arrowEdge = .top
|
|
41
|
+
case "bottom": self.arrowEdge = .bottom
|
|
42
|
+
case "leading": self.arrowEdge = .leading
|
|
43
|
+
case "trailing": self.arrowEdge = .trailing
|
|
44
|
+
default: self.arrowEdge = nil
|
|
45
|
+
}
|
|
46
|
+
do {
|
|
47
|
+
try TinyuiTipsRuntime.shared.remember(nextTip)
|
|
48
|
+
} catch {
|
|
49
|
+
stop()
|
|
50
|
+
let error = error as NSError
|
|
51
|
+
reportError(error.userInfo["code"] as? String ?? "E_TIP", error.localizedDescription)
|
|
52
|
+
return
|
|
53
|
+
}
|
|
54
|
+
lastError = nil
|
|
55
|
+
start()
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
override public func didMoveToWindow() {
|
|
59
|
+
super.didMoveToWindow()
|
|
60
|
+
if window == nil { stop() } else { start() }
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
private func start() {
|
|
64
|
+
// A zero initial height is expected: the native view supplies its measured
|
|
65
|
+
// height to Fabric after the eligibility stream yields its first value.
|
|
66
|
+
guard observation == nil, enabled, let tip, window != nil else { return }
|
|
67
|
+
guard TinyuiTipsRuntime.shared.isConfigured else {
|
|
68
|
+
reportError("E_TIPS_NOT_CONFIGURED", "Call and await TipKit.configure() before displaying tips.")
|
|
69
|
+
return
|
|
70
|
+
}
|
|
71
|
+
observation = Task { @MainActor [weak self] in
|
|
72
|
+
for await shouldDisplay in tip.shouldDisplayUpdates {
|
|
73
|
+
guard !Task.isCancelled, let self else { break }
|
|
74
|
+
if shouldDisplay { self.showTip() } else { self.removeTip() }
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
private func showTip() {
|
|
80
|
+
guard tipView == nil, enabled, window != nil, let tip else { return }
|
|
81
|
+
let view = TipUIView(tip, arrowEdge: arrowEdge) { [weak self] action in
|
|
82
|
+
guard let self, self.tip?.id == tip.id,
|
|
83
|
+
let content = tip.actionContents.first(where: { $0.id == action.id }) else { return }
|
|
84
|
+
self.delegate?.onTipAction(tipId: tip.id, id: content.id, title: content.title)
|
|
85
|
+
}
|
|
86
|
+
tipView = view
|
|
87
|
+
addSubview(view)
|
|
88
|
+
setNeedsLayout()
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
private func removeTip() {
|
|
92
|
+
tipView?.removeFromSuperview()
|
|
93
|
+
tipView = nil
|
|
94
|
+
reportSize(height: 0)
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
private func stop() {
|
|
98
|
+
observation?.cancel()
|
|
99
|
+
observation = nil
|
|
100
|
+
removeTip()
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
override public func layoutSubviews() {
|
|
104
|
+
super.layoutSubviews()
|
|
105
|
+
guard let tipView else { reportSize(height: 0); return }
|
|
106
|
+
guard bounds.width > 0 else { return }
|
|
107
|
+
// TipUIView may cap its card width on iPad. Measure and lay it out at the
|
|
108
|
+
// same width so a wider proposal cannot underestimate wrapped text height.
|
|
109
|
+
let intrinsicSize = tipView.intrinsicContentSize
|
|
110
|
+
let width = intrinsicSize.width.isFinite && intrinsicSize.width > 0
|
|
111
|
+
? min(bounds.width, intrinsicSize.width) : bounds.width
|
|
112
|
+
let fittingSize = tipView.sizeThatFits(CGSize(width: width, height: .greatestFiniteMagnitude))
|
|
113
|
+
guard fittingSize.height.isFinite else { return }
|
|
114
|
+
let scale = traitCollection.displayScale > 0 ? traitCollection.displayScale : 1
|
|
115
|
+
let height = ceil(max(0, fittingSize.height) * scale) / scale
|
|
116
|
+
let x = effectiveUserInterfaceLayoutDirection == .rightToLeft ? bounds.width - width : 0
|
|
117
|
+
tipView.frame = CGRect(x: x, y: 0, width: width, height: height)
|
|
118
|
+
reportSize(height: height)
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
private func reportSize(height: CGFloat) {
|
|
122
|
+
delegate?.onTipSizeChange(tipId: tip?.id ?? "", width: bounds.width, height: height)
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
private func reportError(_ code: String, _ message: String) {
|
|
126
|
+
guard lastError != code else { return }
|
|
127
|
+
lastError = code
|
|
128
|
+
delegate?.onTipError(tipId: tip?.id ?? "", code: code, message: message)
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
@objc public func reset() {
|
|
132
|
+
stop()
|
|
133
|
+
tip = nil
|
|
134
|
+
enabled = false
|
|
135
|
+
arrowEdge = nil
|
|
136
|
+
lastError = nil
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
deinit { observation?.cancel() }
|
|
140
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
#pragma once
|
|
2
|
+
|
|
3
|
+
#include <react/renderer/components/TinyuiSpec/ShadowNodes.h>
|
|
4
|
+
#include <react/renderer/core/ConcreteComponentDescriptor.h>
|
|
5
|
+
#include <react/renderer/core/LayoutConstraints.h>
|
|
6
|
+
#include <cmath>
|
|
7
|
+
#include <string>
|
|
8
|
+
|
|
9
|
+
namespace facebook::react {
|
|
10
|
+
|
|
11
|
+
struct TinyuiInlineTipState final {
|
|
12
|
+
std::string tipId{};
|
|
13
|
+
Size contentSize{};
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
class TinyuiInlineTipShadowNode final
|
|
17
|
+
: public ConcreteViewShadowNode<
|
|
18
|
+
TinyuiTipViewComponentName,
|
|
19
|
+
TinyuiTipViewProps,
|
|
20
|
+
TinyuiTipViewEventEmitter,
|
|
21
|
+
TinyuiInlineTipState> {
|
|
22
|
+
public:
|
|
23
|
+
using ConcreteViewShadowNode::ConcreteViewShadowNode;
|
|
24
|
+
|
|
25
|
+
static ShadowNodeTraits BaseTraits()
|
|
26
|
+
{
|
|
27
|
+
auto traits = ConcreteViewShadowNode::BaseTraits();
|
|
28
|
+
traits.set(ShadowNodeTraits::Trait::LeafYogaNode);
|
|
29
|
+
traits.set(ShadowNodeTraits::Trait::MeasurableYogaNode);
|
|
30
|
+
return traits;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
Size measureContent(const LayoutContext &, const LayoutConstraints &constraints) const override
|
|
34
|
+
{
|
|
35
|
+
const auto &props = getConcreteProps();
|
|
36
|
+
const auto &state = getStateData();
|
|
37
|
+
// Fill the available width, then let TipUIView measure wrapping on the main
|
|
38
|
+
// thread. Fabric state brings its height back without a JS layout roundtrip.
|
|
39
|
+
auto width = std::isfinite(constraints.maximumSize.width)
|
|
40
|
+
? constraints.maximumSize.width : state.contentSize.width;
|
|
41
|
+
auto height = props.enabled && props.tipId == state.tipId ? state.contentSize.height : 0;
|
|
42
|
+
return constraints.clamp({width, height});
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
using TinyuiInlineTipComponentDescriptor = ConcreteComponentDescriptor<TinyuiInlineTipShadowNode>;
|
|
47
|
+
|
|
48
|
+
} // namespace facebook::react
|
|
@@ -1,35 +1,32 @@
|
|
|
1
1
|
import TipKit
|
|
2
|
-
import
|
|
2
|
+
import Foundation
|
|
3
3
|
|
|
4
4
|
/// Shared across RN surfaces and Fast Refresh. TipKit's datastore owns history.
|
|
5
5
|
@MainActor
|
|
6
6
|
@objc public final class TinyuiTipsRuntime: NSObject {
|
|
7
7
|
static let shared = TinyuiTipsRuntime()
|
|
8
8
|
|
|
9
|
-
private final class WeakProvider {
|
|
10
|
-
weak var value: TinyuiTipPopoverProvider?
|
|
11
|
-
init(_ value: TinyuiTipPopoverProvider) { self.value = value }
|
|
12
|
-
}
|
|
13
|
-
|
|
14
9
|
private var frequency: String?
|
|
15
|
-
private var providers: [WeakProvider] = []
|
|
16
|
-
private var timer: Timer?
|
|
17
|
-
private var updateScheduled = false
|
|
18
10
|
private var knownTips: [String: TinyuiTip] = [:]
|
|
19
|
-
// Keep an in-flight presentation alive long enough to dismiss it even if
|
|
20
|
-
// Fabric unmounts/recycles its owning component during the animation.
|
|
21
|
-
var activeProvider: TinyuiTipPopoverProvider?
|
|
22
|
-
|
|
23
|
-
private override init() {
|
|
24
|
-
super.init()
|
|
25
|
-
NotificationCenter.default.addObserver(self, selector: #selector(applicationStateChanged), name: UIApplication.didBecomeActiveNotification, object: nil)
|
|
26
|
-
NotificationCenter.default.addObserver(self, selector: #selector(applicationStateChanged), name: UIApplication.willResignActiveNotification, object: nil)
|
|
27
|
-
}
|
|
28
11
|
|
|
29
|
-
|
|
12
|
+
private override init() { super.init() }
|
|
30
13
|
|
|
31
14
|
var isConfigured: Bool { frequency != nil }
|
|
32
15
|
|
|
16
|
+
@objc public static func resetDatastore(_ completion: (NSError?) -> Void) {
|
|
17
|
+
guard !shared.isConfigured else {
|
|
18
|
+
completion(error("E_TIPS_ALREADY_CONFIGURED", "Call and await TipKit.resetDatastore() before TipKit.configure(). Restart the app process to reset after configuration; Fast Refresh is not sufficient."))
|
|
19
|
+
return
|
|
20
|
+
}
|
|
21
|
+
do {
|
|
22
|
+
try Tips.resetDatastore()
|
|
23
|
+
shared.knownTips.removeAll()
|
|
24
|
+
completion(nil)
|
|
25
|
+
} catch {
|
|
26
|
+
completion(error as NSError)
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
33
30
|
@objc public static func configure(_ frequency: String, completion: (NSError?) -> Void) {
|
|
34
31
|
do {
|
|
35
32
|
try shared.configure(frequency)
|
|
@@ -53,7 +50,6 @@ import UIKit
|
|
|
53
50
|
// before the tip mounts, when the feature is discovered without a tip.
|
|
54
51
|
let tip = shared.knownTips[tipId] ?? TinyuiTip(id: tipId)
|
|
55
52
|
tip.invalidate(reason: reason == "tipClosed" ? .tipClosed : .actionPerformed)
|
|
56
|
-
shared.requestUpdate()
|
|
57
53
|
completion(nil)
|
|
58
54
|
}
|
|
59
55
|
|
|
@@ -75,7 +71,6 @@ import UIKit
|
|
|
75
71
|
}
|
|
76
72
|
try Tips.configure([.displayFrequency(nativeFrequency)])
|
|
77
73
|
self.frequency = frequency
|
|
78
|
-
requestUpdate()
|
|
79
74
|
}
|
|
80
75
|
|
|
81
76
|
static func error(_ code: String, _ message: String) -> NSError {
|
|
@@ -85,19 +80,6 @@ import UIKit
|
|
|
85
80
|
])
|
|
86
81
|
}
|
|
87
82
|
|
|
88
|
-
func register(_ provider: TinyuiTipPopoverProvider) {
|
|
89
|
-
providers.removeAll { $0.value == nil }
|
|
90
|
-
if !providers.contains(where: { $0.value === provider }) {
|
|
91
|
-
providers.append(WeakProvider(provider))
|
|
92
|
-
}
|
|
93
|
-
requestUpdate()
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
func unregister(_ provider: TinyuiTipPopoverProvider) {
|
|
97
|
-
providers.removeAll { $0.value == nil || $0.value === provider }
|
|
98
|
-
requestUpdate()
|
|
99
|
-
}
|
|
100
|
-
|
|
101
83
|
func remember(_ tip: TinyuiTip) throws {
|
|
102
84
|
if let previous = knownTips[tip.id],
|
|
103
85
|
previous.maximumDisplayCount != tip.maximumDisplayCount || previous.ignoresFrequency != tip.ignoresFrequency {
|
|
@@ -105,44 +87,4 @@ import UIKit
|
|
|
105
87
|
}
|
|
106
88
|
knownTips[tip.id] = tip
|
|
107
89
|
}
|
|
108
|
-
|
|
109
|
-
func release(_ provider: TinyuiTipPopoverProvider) {
|
|
110
|
-
if activeProvider === provider { activeProvider = nil }
|
|
111
|
-
requestUpdate()
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
func requestUpdate() {
|
|
115
|
-
guard !updateScheduled else { return }
|
|
116
|
-
updateScheduled = true
|
|
117
|
-
DispatchQueue.main.async { [weak self] in
|
|
118
|
-
guard let self else { return }
|
|
119
|
-
self.updateScheduled = false
|
|
120
|
-
self.update()
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
private func update() {
|
|
125
|
-
providers.removeAll { $0.value == nil }
|
|
126
|
-
// Finish dismissing an old presentation before offering its slot to another.
|
|
127
|
-
activeProvider?.updatePresentation()
|
|
128
|
-
for provider in providers.compactMap(\.value) where provider !== activeProvider {
|
|
129
|
-
provider.updatePresentation()
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
// UIKit has no single notification for an anchor being scrolled offscreen,
|
|
133
|
-
// a navigation transition ending, or another modal being dismissed. Poll
|
|
134
|
-
// only while a tip is eligible/on screen; idle or disabled tips do no work.
|
|
135
|
-
let needsMonitoring = activeProvider != nil || providers.contains { $0.value?.needsMonitoring == true }
|
|
136
|
-
if needsMonitoring && timer == nil {
|
|
137
|
-
let timer = Timer(timeInterval: 0.25, repeats: true) { [weak self] _ in
|
|
138
|
-
Task { @MainActor [weak self] in self?.update() }
|
|
139
|
-
}
|
|
140
|
-
timer.tolerance = 0.05
|
|
141
|
-
RunLoop.main.add(timer, forMode: .common)
|
|
142
|
-
self.timer = timer
|
|
143
|
-
} else if !needsMonitoring {
|
|
144
|
-
timer?.invalidate()
|
|
145
|
-
timer = nil
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
90
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["TurboModuleRegistry","get"],"sourceRoot":"../../src","sources":["NativeTinyui.ts"],"mappings":";;AACA,SAASA,mBAAmB,QAAQ,cAAc;
|
|
1
|
+
{"version":3,"names":["TurboModuleRegistry","get"],"sourceRoot":"../../src","sources":["NativeTinyui.ts"],"mappings":";;AACA,SAASA,mBAAmB,QAAQ,cAAc;AAalD,eAAeA,mBAAmB,CAACC,GAAG,CAAO,QAAQ,CAAC","ignoreList":[]}
|
|
@@ -12,8 +12,6 @@ export const SFSymbol = /*#__PURE__*/forwardRef(function SFSymbolRoot({
|
|
|
12
12
|
size,
|
|
13
13
|
weight,
|
|
14
14
|
scale,
|
|
15
|
-
textStyle,
|
|
16
|
-
fontFamily,
|
|
17
15
|
allowFontScaling,
|
|
18
16
|
maxFontSizeMultiplier,
|
|
19
17
|
renderingMode,
|
|
@@ -41,8 +39,6 @@ export const SFSymbol = /*#__PURE__*/forwardRef(function SFSymbolRoot({
|
|
|
41
39
|
size,
|
|
42
40
|
weight,
|
|
43
41
|
scale,
|
|
44
|
-
textStyle,
|
|
45
|
-
fontFamily,
|
|
46
42
|
allowFontScaling,
|
|
47
43
|
maxFontSizeMultiplier,
|
|
48
44
|
renderingMode,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["forwardRef","StyleSheet","useWindowDimensions","assertComponentEnabled","NativeSFSymbolView","serializeSFSymbol","jsx","_jsx","SFSymbol","SFSymbolRoot","name","source","size","weight","scale","
|
|
1
|
+
{"version":3,"names":["forwardRef","StyleSheet","useWindowDimensions","assertComponentEnabled","NativeSFSymbolView","serializeSFSymbol","jsx","_jsx","SFSymbol","SFSymbolRoot","name","source","size","weight","scale","allowFontScaling","maxFontSizeMultiplier","renderingMode","color","paletteColors","variableValue","variableValueMode","colorRenderingMode","effect","contentTransition","respectReduceMotion","resizeMode","style","accessible","accessibilityRole","viewProps","ref","fontScale","serialized","styles","symbol","create","alignSelf"],"sourceRoot":"../../../src","sources":["SFSymbol/index.tsx"],"mappings":";;AAAA,SAASA,UAAU,QAA2B,OAAO;AACrD,SAASC,UAAU,EAAEC,mBAAmB,QAAmB,cAAc;AAEzE,SAASC,sBAAsB,QAAQ,mBAAU;AACjD,OAAOC,kBAAkB,MAAM,2BAA2B;AAC1D,SAASC,iBAAiB,QAAQ,cAAW;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAG9C,OAAO,MAAMC,QAAQ,gBAAGR,UAAU,CAChC,SAASS,YAAYA,CACnB;EACEC,IAAI;EACJC,MAAM;EACNC,IAAI;EACJC,MAAM;EACNC,KAAK;EACLC,gBAAgB;EAChBC,qBAAqB;EACrBC,aAAa;EACbC,KAAK;EACLC,aAAa;EACbC,aAAa;EACbC,iBAAiB;EACjBC,kBAAkB;EAClBC,MAAM;EACNC,iBAAiB;EACjBC,mBAAmB,GAAG,IAAI;EAC1BC,UAAU,GAAG,QAAQ;EACrBC,KAAK;EACLC,UAAU,GAAG,KAAK;EAClBC,iBAAiB,GAAG,OAAO;EAC3B,GAAGC;AACL,CAAC,EACDC,GAAG,EACH;EACA5B,sBAAsB,CAAC,UAAU,CAAC;EAClC,MAAM;IAAE6B;EAAU,CAAC,GAAG9B,mBAAmB,CAAC,CAAC;EAC3C,MAAM+B,UAAU,GAAG5B,iBAAiB,CAClC;IACEK,IAAI;IACJC,MAAM;IACNC,IAAI;IACJC,MAAM;IACNC,KAAK;IACLC,gBAAgB;IAChBC,qBAAqB;IACrBC,aAAa;IACbC,KAAK;IACLC,aAAa;IACbC,aAAa;IACbC,iBAAiB;IACjBC,kBAAkB;IAClBC,MAAM;IACNC;EACF,CAAC,EACDQ,SACF,CAAC;EAED,oBACEzB,IAAA,CAACH,kBAAkB;IAAA,GACb0B,SAAS;IAAA,GACTG,UAAU;IACdF,GAAG,EAAEA,GAAI;IACTH,UAAU,EAAEA,UAAW;IACvBC,iBAAiB,EAAEA,iBAAkB;IACrCJ,mBAAmB,EAAEA,mBAAoB;IACzCC,UAAU,EAAEA,UAAW;IACvBC,KAAK,EAAE,CAACO,MAAM,CAACC,MAAM,EAAER,KAAK;EAAE,CAC/B,CAAC;AAEN,CACF,CAAC;AAED,MAAMO,MAAM,GAAGjC,UAAU,CAACmC,MAAM,CAAC;EAAED,MAAM,EAAE;IAAEE,SAAS,EAAE;EAAa;AAAE,CAAC,CAAC","ignoreList":[]}
|
|
@@ -58,8 +58,6 @@ export function serializeSFSymbol(props, fontScale) {
|
|
|
58
58
|
size: props.size ?? 17,
|
|
59
59
|
weight: props.weight ?? 'unspecified',
|
|
60
60
|
scale: props.scale ?? 'default',
|
|
61
|
-
textStyle: props.textStyle,
|
|
62
|
-
fontFamily: props.fontFamily,
|
|
63
61
|
fontScale: props.allowFontScaling === false ? 1 : Math.min(fontScale, props.maxFontSizeMultiplier || Infinity),
|
|
64
62
|
renderingMode: props.renderingMode ?? 'automatic',
|
|
65
63
|
color: props.color === undefined ? undefined : processColor(props.color),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["processColor","finite","name","value","minimum","undefined","Number","isFinite","RangeError","positive","serializeSFSymbol","props","fontScale","size","variableValue","maxFontSizeMultiplier","paletteColors","length","some","color","effects","effect","Array","isArray","types","Set","has","type","Error","add","options","speed","repeatDelay","repeat","isSafeInteger","repeatBehavior","angle","trigger","contentTransition","configuration","source","weight","scale","
|
|
1
|
+
{"version":3,"names":["processColor","finite","name","value","minimum","undefined","Number","isFinite","RangeError","positive","serializeSFSymbol","props","fontScale","size","variableValue","maxFontSizeMultiplier","paletteColors","length","some","color","effects","effect","Array","isArray","types","Set","has","type","Error","add","options","speed","repeatDelay","repeat","isSafeInteger","repeatBehavior","angle","trigger","contentTransition","configuration","source","weight","scale","allowFontScaling","Math","min","Infinity","renderingMode","map","variableValueMode","colorRenderingMode","active","animated"],"sourceRoot":"../../../src","sources":["SFSymbol/options.ts"],"mappings":"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","ignoreList":[]}
|
|
@@ -20,8 +20,6 @@ export const Popover = /*#__PURE__*/forwardRef(function TipPopoverRoot(props, re
|
|
|
20
20
|
maxDisplayCount,
|
|
21
21
|
ignoresDisplayFrequency = false,
|
|
22
22
|
arrowEdge = 'auto',
|
|
23
|
-
onStatusChange,
|
|
24
|
-
onVisibleChange,
|
|
25
23
|
onActionPress,
|
|
26
24
|
onError,
|
|
27
25
|
...viewProps
|
|
@@ -39,26 +37,6 @@ export const Popover = /*#__PURE__*/forwardRef(function TipPopoverRoot(props, re
|
|
|
39
37
|
maxDisplayCount: maxDisplayCount ?? 0,
|
|
40
38
|
ignoresDisplayFrequency: ignoresDisplayFrequency,
|
|
41
39
|
arrowEdge: arrowEdge,
|
|
42
|
-
onTipStatusChange: ({
|
|
43
|
-
nativeEvent
|
|
44
|
-
}) => {
|
|
45
|
-
if (nativeEvent.tipId !== tipId) return;
|
|
46
|
-
if (nativeEvent.status === 'invalidated') {
|
|
47
|
-
onStatusChange?.({
|
|
48
|
-
status: 'invalidated',
|
|
49
|
-
reason: nativeEvent.reason
|
|
50
|
-
});
|
|
51
|
-
} else if (nativeEvent.status === 'pending' || nativeEvent.status === 'available') {
|
|
52
|
-
onStatusChange?.({
|
|
53
|
-
status: nativeEvent.status
|
|
54
|
-
});
|
|
55
|
-
}
|
|
56
|
-
},
|
|
57
|
-
onTipVisibleChange: ({
|
|
58
|
-
nativeEvent
|
|
59
|
-
}) => {
|
|
60
|
-
if (nativeEvent.tipId === tipId) onVisibleChange?.(nativeEvent.visible);
|
|
61
|
-
},
|
|
62
40
|
onTipAction: ({
|
|
63
41
|
nativeEvent
|
|
64
42
|
}) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["forwardRef","View","assertComponentEnabled","NativeTipPopoverView","validateTip","jsx","_jsx","Popover","TipPopoverRoot","props","ref","children","tipId","title","message","systemImage","actions","enabled","maxDisplayCount","ignoresDisplayFrequency","arrowEdge","
|
|
1
|
+
{"version":3,"names":["forwardRef","View","assertComponentEnabled","NativeTipPopoverView","validateTip","jsx","_jsx","Popover","TipPopoverRoot","props","ref","children","tipId","title","message","systemImage","actions","enabled","maxDisplayCount","ignoresDisplayFrequency","arrowEdge","onActionPress","onError","viewProps","collapsable","onTipAction","nativeEvent","id","onTipError","error","code","console","warn","displayName"],"sourceRoot":"../../../src","sources":["TipKit/Popover.tsx"],"mappings":";;AAAA,SAASA,UAAU,QAA2B,OAAO;AACrD,SAASC,IAAI,QAAQ,cAAc;AAEnC,SAASC,sBAAsB,QAAQ,mBAAU;AACjD,OAAOC,oBAAoB,MAAM,6BAA6B;AAE9D,SAASC,WAAW,QAAQ,iBAAc;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAE3C,OAAO,MAAMC,OAAO,gBAAGP,UAAU,CAC/B,SAASQ,cAAcA,CAACC,KAAK,EAAEC,GAAG,EAAE;EAClCR,sBAAsB,CAAC,QAAQ,CAAC;EAChCE,WAAW,CAACK,KAAK,CAAC;EAClB,MAAM;IACJE,QAAQ;IACRC,KAAK;IACLC,KAAK;IACLC,OAAO;IACPC,WAAW;IACXC,OAAO;IACPC,OAAO,GAAG,IAAI;IACdC,eAAe;IACfC,uBAAuB,GAAG,KAAK;IAC/BC,SAAS,GAAG,MAAM;IAClBC,aAAa;IACbC,OAAO;IACP,GAAGC;EACL,CAAC,GAAGd,KAAK;EAET,oBACEH,IAAA,CAACH,oBAAoB;IAAA,GACfoB,SAAS;IACbb,GAAG,EAAEA,GAAI;IACTc,WAAW,EAAE,KAAM;IACnBZ,KAAK,EAAEA,KAAM;IACbC,KAAK,EAAEA,KAAM;IACbC,OAAO,EAAEA,OAAQ;IACjBC,WAAW,EAAEA,WAAY;IACzBC,OAAO,EAAEA,OAAQ;IACjBC,OAAO,EAAEA,OAAQ;IACjBC,eAAe,EAAEA,eAAe,IAAI,CAAE;IACtCC,uBAAuB,EAAEA,uBAAwB;IACjDC,SAAS,EAAEA,SAAU;IACrBK,WAAW,EAAEA,CAAC;MAAEC;IAAY,CAAC,KAAK;MAChC,IAAIA,WAAW,CAACd,KAAK,KAAKA,KAAK,EAAE;QAC/BS,aAAa,GAAG;UAAEM,EAAE,EAAED,WAAW,CAACC,EAAE;UAAEd,KAAK,EAAEa,WAAW,CAACb;QAAM,CAAC,CAAC;MACnE;IACF,CAAE;IACFe,UAAU,EAAEA,CAAC;MAAEF;IAAY,CAAC,KAAK;MAC/B,IAAIA,WAAW,CAACd,KAAK,KAAKA,KAAK,EAAE;MACjC,MAAMiB,KAAK,GAAG;QACZC,IAAI,EAAEJ,WAAW,CAACI,IAAI;QACtBhB,OAAO,EAAEY,WAAW,CAACZ;MACvB,CAAC;MACD,IAAIQ,OAAO,EAAEA,OAAO,CAACO,KAAK,CAAC,CAAC,KAE1BE,OAAO,CAACC,IAAI,CACV,2BAA2BH,KAAK,CAACC,IAAI,KAAKD,KAAK,CAACf,OAAO,EACzD,CAAC;IACL,CAAE;IAAAH,QAAA,eAEFL,IAAA,CAACL,IAAI;MAACuB,WAAW,EAAE,KAAM;MAAAb,QAAA,EAAEA;IAAQ,CAAO;EAAC,CACvB,CAAC;AAE3B,CACF,CAAC;AAEDJ,OAAO,CAAC0B,WAAW,GAAG,gBAAgB","ignoreList":[]}
|
|
@@ -15,12 +15,6 @@ export interface NativeTipPopoverProps extends ViewProps {
|
|
|
15
15
|
maxDisplayCount?: CodegenTypes.Int32;
|
|
16
16
|
ignoresDisplayFrequency?: boolean;
|
|
17
17
|
arrowEdge?: string;
|
|
18
|
-
onTipStatusChange?: DirectEventHandler<
|
|
19
|
-
Readonly<{ tipId: string; status: string; reason: string }>
|
|
20
|
-
>;
|
|
21
|
-
onTipVisibleChange?: DirectEventHandler<
|
|
22
|
-
Readonly<{ tipId: string; visible: boolean }>
|
|
23
|
-
>;
|
|
24
18
|
onTipAction?: DirectEventHandler<
|
|
25
19
|
Readonly<{ tipId: string; id: string; title: string }>
|
|
26
20
|
>;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import {
|
|
2
|
+
codegenNativeComponent,
|
|
3
|
+
type CodegenTypes,
|
|
4
|
+
type ViewProps,
|
|
5
|
+
} from 'react-native';
|
|
6
|
+
import type { DirectEventHandler } from 'react-native/Libraries/Types/CodegenTypes';
|
|
7
|
+
|
|
8
|
+
export interface NativeTipViewProps extends ViewProps {
|
|
9
|
+
tipId: string;
|
|
10
|
+
title: string;
|
|
11
|
+
message?: string;
|
|
12
|
+
systemImage?: string;
|
|
13
|
+
actions?: ReadonlyArray<Readonly<{ id: string; title: string }>>;
|
|
14
|
+
enabled?: boolean;
|
|
15
|
+
maxDisplayCount?: CodegenTypes.Int32;
|
|
16
|
+
ignoresDisplayFrequency?: boolean;
|
|
17
|
+
arrowEdge?: string;
|
|
18
|
+
onTipAction?: DirectEventHandler<
|
|
19
|
+
Readonly<{ tipId: string; id: string; title: string }>
|
|
20
|
+
>;
|
|
21
|
+
onTipError?: DirectEventHandler<
|
|
22
|
+
Readonly<{ tipId: string; code: string; message: string }>
|
|
23
|
+
>;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export default codegenNativeComponent<NativeTipViewProps>('TinyuiTipView', {
|
|
27
|
+
excludedPlatforms: ['android'],
|
|
28
|
+
});
|