@legendapp/spark 0.0.3 → 0.0.5
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/init-template.cjs +7 -1
- package/package.json +11 -6
- package/patches/dependencies.json +4 -4
- package/patches/react-native-mmkv@4.3.2.patch +2 -2
- package/patches/react-native-nitro-zxing@0.3.1.patch +22 -0
- package/patches/registry.json +615 -0
- package/patches/workspace/expo-audio@55.0.18.patch +159 -0
- package/patches/workspace/op-engineering-op-sqlite@18.2.1.patch +796 -0
- package/patches/workspace/react-native-nitro-modules@0.37.0.patch +1348 -0
- package/patches/workspace/react-native-runtimes-core@0.1.0-alpha.2.patch +276 -0
- package/patches/workspace/react-native-webview@16.0.0.patch +208 -0
- package/postinstall.cjs +10 -1
- package/skills/spark/SKILL.md +37 -4
- package/skills/spark/UPGRADING.md +174 -1
- package/skills/spark/ai-customize.md +39 -0
- package/skills/spark/app-and-documents.md +56 -0
- package/skills/spark/external-libraries.md +87 -0
- package/skills/spark/files.md +64 -0
- package/skills/spark/integrations.md +69 -0
- package/skills/spark/keyboard.md +54 -0
- package/skills/spark/library-compat.md +76 -0
- package/skills/spark/menus-tray-dock.md +83 -0
- package/skills/spark/storage-settings.md +59 -0
- package/skills/spark/ui.md +83 -0
- package/skills/spark/windows.md +91 -0
- package/ui-popover.ts +1 -0
- package/ui-progress.ts +1 -0
- package/ui-sheet.ts +1 -0
- package/ui-split-view.ts +1 -0
- package/ui-table.ts +1 -0
- package/vendor/node_modules/@legendapp/spark-ai/package.json +3 -3
- package/vendor/node_modules/@legendapp/spark-audio/package.json +3 -13
- package/vendor/node_modules/@legendapp/spark-auth-session/package.json +3 -10
- package/vendor/node_modules/@legendapp/spark-cli/dist/add-desktop.js +5 -0
- package/vendor/node_modules/@legendapp/spark-cli/dist/build.js +157 -106
- package/vendor/node_modules/@legendapp/spark-cli/dist/cli-arguments.js +4 -1
- package/vendor/node_modules/@legendapp/spark-cli/dist/commands.js +16 -7
- package/vendor/node_modules/@legendapp/spark-cli/dist/dependency-pins.js +19 -3
- package/vendor/node_modules/@legendapp/spark-cli/dist/dev-command.js +2 -0
- package/vendor/node_modules/@legendapp/spark-cli/dist/dev.js +3 -0
- package/vendor/node_modules/@legendapp/spark-cli/dist/enriched-html-pins.js +2 -0
- package/vendor/node_modules/@legendapp/spark-cli/dist/errors.js +1 -1
- package/vendor/node_modules/@legendapp/spark-cli/dist/index.js +57 -9
- package/vendor/node_modules/@legendapp/spark-cli/dist/init-template.cjs +12 -2
- package/vendor/node_modules/@legendapp/spark-cli/dist/init-template.d.cts +1 -1
- package/vendor/node_modules/@legendapp/spark-cli/dist/metro.cjs +1 -0
- package/vendor/node_modules/@legendapp/spark-cli/dist/migrate.js +65 -0
- package/vendor/node_modules/@legendapp/spark-cli/dist/migration-helpers.cjs +4 -4
- package/vendor/node_modules/@legendapp/spark-cli/dist/migration-helpers.d.cts +2 -2
- package/vendor/node_modules/@legendapp/spark-cli/dist/migrations.cjs +15 -8
- package/vendor/node_modules/@legendapp/spark-cli/dist/native-patch-preflight.js +35 -7
- package/vendor/node_modules/@legendapp/spark-cli/dist/package.js +4 -8
- package/vendor/node_modules/@legendapp/spark-cli/dist/patch.js +92 -0
- package/vendor/node_modules/@legendapp/spark-cli/dist/project-version.js +12 -4
- package/vendor/node_modules/@legendapp/spark-cli/dist/project.js +8 -1
- package/vendor/node_modules/@legendapp/spark-cli/dist/publish-directory.js +32 -0
- package/vendor/node_modules/@legendapp/spark-cli/dist/release-app.js +139 -0
- package/vendor/node_modules/@legendapp/spark-cli/dist/release.json +17 -17
- package/vendor/node_modules/@legendapp/spark-cli/dist/signing.js +61 -41
- package/vendor/node_modules/@legendapp/spark-cli/dist/upgrade.js +1 -1
- package/vendor/node_modules/@legendapp/spark-cli/dist/windows.js +3 -0
- package/vendor/node_modules/@legendapp/spark-cli/package.json +5 -4
- package/vendor/node_modules/@legendapp/spark-cli/templates/blank-typescript/package.json +2 -2
- package/vendor/node_modules/@legendapp/spark-cli/templates/universal/package.json +2 -2
- package/vendor/node_modules/@legendapp/spark-cli/templates/windows/package.json +2 -2
- package/vendor/node_modules/@legendapp/spark-clipboard/macos/RNDesktopClipboard.mm +1 -1
- package/vendor/node_modules/@legendapp/spark-clipboard/package.json +3 -10
- package/vendor/node_modules/@legendapp/spark-clipboard/src/desktop.ts +1 -0
- package/vendor/node_modules/@legendapp/spark-codex/package.json +3 -7
- package/vendor/node_modules/@legendapp/spark-commands/package.json +5 -5
- package/vendor/node_modules/@legendapp/spark-context-menu/package.json +3 -10
- package/vendor/node_modules/@legendapp/spark-desktop-app/macos/SparkDesktop.h +3 -1
- package/vendor/node_modules/@legendapp/spark-desktop-app/macos/SparkDesktop.mm +51 -10
- package/vendor/node_modules/@legendapp/spark-desktop-app/macos/SparkStorage.h +4 -0
- package/vendor/node_modules/@legendapp/spark-desktop-app/macos/SparkStorage.mm +82 -0
- package/vendor/node_modules/@legendapp/spark-desktop-app/macos/SparkTestDriver.h +2 -0
- package/vendor/node_modules/@legendapp/spark-desktop-app/macos/SparkTestDriver.mm +1 -0
- package/vendor/node_modules/@legendapp/spark-desktop-app/package.json +2 -8
- package/vendor/node_modules/@legendapp/spark-desktop-config/app.plugin.cjs +1 -0
- package/vendor/node_modules/@legendapp/spark-desktop-config/config.cjs +6 -8
- package/vendor/node_modules/@legendapp/spark-desktop-config/identity.cjs +2 -0
- package/vendor/node_modules/@legendapp/spark-desktop-config/native-patches.cjs +300 -71
- package/vendor/node_modules/@legendapp/spark-desktop-config/native-patches.d.cts +7 -0
- package/vendor/node_modules/@legendapp/spark-desktop-config/package.json +3 -3
- package/vendor/node_modules/@legendapp/spark-desktop-config/patch-registry.cjs +318 -0
- package/vendor/node_modules/@legendapp/spark-desktop-config/patch-registry.d.cts +20 -0
- package/vendor/node_modules/@legendapp/spark-desktop-config/rpaths.cjs +20 -0
- package/vendor/node_modules/@legendapp/spark-desktop-config/rpaths.d.cts +1 -0
- package/vendor/node_modules/@legendapp/spark-desktop-config/validation.cjs +66 -9
- package/vendor/node_modules/@legendapp/spark-desktop-config/windows.plugin.cjs +1 -0
- package/vendor/node_modules/@legendapp/spark-desktop-host/AppDelegate.mm +17 -5
- package/vendor/node_modules/@legendapp/spark-desktop-host/package.json +2 -2
- package/vendor/node_modules/@legendapp/spark-desktop-links/package.json +3 -10
- package/vendor/node_modules/@legendapp/spark-desktop-shortcuts/package.json +3 -10
- package/vendor/node_modules/@legendapp/spark-desktop-windows/macos/RNDesktopWindows.mm +7 -2
- package/vendor/node_modules/@legendapp/spark-desktop-windows/macos/window-manager/RNWindowManager.mm +235 -240
- package/vendor/node_modules/@legendapp/spark-desktop-windows/package.json +4 -11
- package/vendor/node_modules/@legendapp/spark-desktop-windows/src/api.ts +9 -3
- package/vendor/node_modules/@legendapp/spark-desktop-windows/src/macos-adapter.ts +7 -0
- package/vendor/node_modules/@legendapp/spark-desktop-windows/src/types.ts +32 -3
- package/vendor/node_modules/@legendapp/spark-desktop-windows/src/validation.ts +28 -11
- package/vendor/node_modules/@legendapp/spark-desktop-windows/src/windows/createWindowsNavigator.tsx +15 -3
- package/vendor/node_modules/@legendapp/spark-desktop-windows/src/windows/primaryWindowLifecycle.ts +12 -3
- package/vendor/node_modules/@legendapp/spark-desktop-windows/src/windows/usePrimaryWindowLifecycle.ts +2 -1
- package/vendor/node_modules/@legendapp/spark-desktop-windows/src/windows/useWindowFocusEffect.ts +4 -1
- package/vendor/node_modules/@legendapp/spark-documents/package.json +7 -7
- package/vendor/node_modules/@legendapp/spark-drag-drop/macos/RNDesktopDragView.mm +77 -17
- package/vendor/node_modules/@legendapp/spark-drag-drop/package.json +3 -8
- package/vendor/node_modules/@legendapp/spark-drag-drop/src/DesktopDragViewNativeComponent.ts +1 -0
- package/vendor/node_modules/@legendapp/spark-drag-drop/src/contracts.ts +13 -4
- package/vendor/node_modules/@legendapp/spark-drag-drop/src/index.tsx +5 -3
- package/vendor/node_modules/@legendapp/spark-drag-drop/windows/SparkDragDrop/SparkDragDrop.h +6 -1
- package/vendor/node_modules/@legendapp/spark-expo-compat/metro.cjs +44 -0
- package/vendor/node_modules/@legendapp/spark-expo-compat/package.json +20 -0
- package/vendor/node_modules/@legendapp/spark-expo-compat/src/clipboard.ts +40 -0
- package/vendor/node_modules/@legendapp/spark-expo-compat/src/document-picker.ts +52 -0
- package/vendor/node_modules/@legendapp/spark-file-dialog/package.json +3 -10
- package/vendor/node_modules/@legendapp/spark-file-dialog/src/options.ts +5 -2
- package/vendor/node_modules/@legendapp/spark-file-dialog/src/types.ts +3 -3
- package/vendor/node_modules/@legendapp/spark-file-system/macos/RNDesktopFileSystem.mm +1 -1
- package/vendor/node_modules/@legendapp/spark-file-system/package.json +3 -11
- package/vendor/node_modules/@legendapp/spark-global-shortcuts/package.json +3 -10
- package/vendor/node_modules/@legendapp/spark-html/package.json +2 -2
- package/vendor/node_modules/@legendapp/spark-markdown/package.json +2 -2
- package/vendor/node_modules/@legendapp/spark-message-dialog/package.json +3 -10
- package/vendor/node_modules/@legendapp/spark-message-dialog/src/index.ts +1 -0
- package/vendor/node_modules/@legendapp/spark-native-menu/package.json +3 -9
- package/vendor/node_modules/@legendapp/spark-native-menu/src/hooks.ts +4 -0
- package/vendor/node_modules/@legendapp/spark-notifications/package.json +3 -10
- package/vendor/node_modules/@legendapp/spark-processes/package.json +3 -10
- package/vendor/node_modules/@legendapp/spark-rich-text/package.json +2 -2
- package/vendor/node_modules/@legendapp/spark-secure-storage/package.json +3 -10
- package/vendor/node_modules/@legendapp/spark-settings/package.json +3 -3
- package/vendor/node_modules/@legendapp/spark-settings-ui/package.json +4 -4
- package/vendor/node_modules/@legendapp/spark-settings-ui/src/index.tsx +122 -334
- package/vendor/node_modules/@legendapp/spark-settings-ui/src/rows.tsx +183 -0
- package/vendor/node_modules/@legendapp/spark-sqlite/package.json +3 -3
- package/vendor/node_modules/@legendapp/spark-system/package.json +3 -10
- package/vendor/node_modules/@legendapp/spark-tray/package.json +3 -10
- package/vendor/node_modules/@legendapp/spark-tray/src/index.ts +2 -1
- package/vendor/node_modules/@legendapp/spark-ui/macos/RNSparkButton.mm +82 -14
- package/vendor/node_modules/@legendapp/spark-ui/macos/RNSparkTextInput.h +1 -1
- package/vendor/node_modules/@legendapp/spark-ui/macos/RNSparkTextInput.mm +94 -11
- package/vendor/node_modules/@legendapp/spark-ui/macos/appkit-split-view/RNSidebarSplitViewComponent.mm +235 -18
- package/vendor/node_modules/@legendapp/spark-ui/macos/appkit-split-view/RNSparkPaneSplitView.h +17 -0
- package/vendor/node_modules/@legendapp/spark-ui/macos/appkit-split-view/RNSparkPaneSplitView.mm +216 -0
- package/vendor/node_modules/@legendapp/spark-ui/macos/appkit-split-view/RNSparkSplitViewComponent.h +4 -0
- package/vendor/node_modules/@legendapp/spark-ui/macos/appkit-split-view/RNSparkSplitViewComponent.mm +212 -0
- package/vendor/node_modules/@legendapp/spark-ui/macos/appkit-split-view/RNSparkSplitViewUpdates.h +6 -0
- package/vendor/node_modules/@legendapp/spark-ui/macos/native-select/RNNativeSegmentedControl.mm +28 -13
- package/vendor/node_modules/@legendapp/spark-ui/macos/native-select/RNNativeSelect.mm +17 -1
- package/vendor/node_modules/@legendapp/spark-ui/macos/popover/RNSparkPopover.h +9 -0
- package/vendor/node_modules/@legendapp/spark-ui/macos/popover/RNSparkPopover.mm +126 -0
- package/vendor/node_modules/@legendapp/spark-ui/macos/progress/RNSparkProgressIndicator.h +9 -0
- package/vendor/node_modules/@legendapp/spark-ui/macos/progress/RNSparkProgressIndicator.mm +66 -0
- package/vendor/node_modules/@legendapp/spark-ui/macos/radio-group/RNSparkRadioGroup.h +9 -0
- package/vendor/node_modules/@legendapp/spark-ui/macos/radio-group/RNSparkRadioGroup.mm +118 -0
- package/vendor/node_modules/@legendapp/spark-ui/macos/sf-symbol/RNSFSymbol.mm +4 -12
- package/vendor/node_modules/@legendapp/spark-ui/macos/sheet/RNSparkSheet.h +9 -0
- package/vendor/node_modules/@legendapp/spark-ui/macos/sheet/RNSparkSheet.mm +109 -0
- package/vendor/node_modules/@legendapp/spark-ui/macos/sidebar/RNSidebar.mm +438 -102
- package/vendor/node_modules/@legendapp/spark-ui/macos/table/RNSparkTable.h +9 -0
- package/vendor/node_modules/@legendapp/spark-ui/macos/table/RNSparkTable.mm +179 -0
- package/vendor/node_modules/@legendapp/spark-ui/package.json +9 -8
- package/vendor/node_modules/@legendapp/spark-ui/src/SparkButtonNativeComponent.ts +10 -2
- package/vendor/node_modules/@legendapp/spark-ui/src/SparkTextInputNativeComponent.ts +2 -0
- package/vendor/node_modules/@legendapp/spark-ui/src/appkit-split-view/SidebarSplitViewNativeComponent.ts +9 -0
- package/vendor/node_modules/@legendapp/spark-ui/src/appkit-split-view/SplitView.tsx +99 -0
- package/vendor/node_modules/@legendapp/spark-ui/src/appkit-split-view/SplitViewNativeComponent.ts +29 -0
- package/vendor/node_modules/@legendapp/spark-ui/src/appkit-split-view/index.tsx +34 -17
- package/vendor/node_modules/@legendapp/spark-ui/src/availability.ts +6 -4
- package/vendor/node_modules/@legendapp/spark-ui/src/checkbox-unavailable.tsx +20 -0
- package/vendor/node_modules/@legendapp/spark-ui/src/control.ts +24 -3
- package/vendor/node_modules/@legendapp/spark-ui/src/desktop.tsx +72 -20
- package/vendor/node_modules/@legendapp/spark-ui/src/index.android.tsx +18 -12
- package/vendor/node_modules/@legendapp/spark-ui/src/index.ios.tsx +21 -15
- package/vendor/node_modules/@legendapp/spark-ui/src/index.web.tsx +40 -16
- package/vendor/node_modules/@legendapp/spark-ui/src/mobile-input.tsx +2 -2
- package/vendor/node_modules/@legendapp/spark-ui/src/native-select/NativeSegmentedControlNativeComponent.ts +3 -1
- package/vendor/node_modules/@legendapp/spark-ui/src/native-select/NativeSelectNativeComponent.ts +1 -0
- package/vendor/node_modules/@legendapp/spark-ui/src/popover/PopoverNativeComponent.ts +20 -0
- package/vendor/node_modules/@legendapp/spark-ui/src/popover/index.tsx +45 -0
- package/vendor/node_modules/@legendapp/spark-ui/src/progress/ProgressIndicatorNativeComponent.ts +13 -0
- package/vendor/node_modules/@legendapp/spark-ui/src/progress/index.tsx +32 -0
- package/vendor/node_modules/@legendapp/spark-ui/src/radio-group/RadioGroupNativeComponent.ts +17 -0
- package/vendor/node_modules/@legendapp/spark-ui/src/select.ts +4 -0
- package/vendor/node_modules/@legendapp/spark-ui/src/sheet/SheetNativeComponent.ts +15 -0
- package/vendor/node_modules/@legendapp/spark-ui/src/sheet/index.tsx +38 -0
- package/vendor/node_modules/@legendapp/spark-ui/src/sidebar/SidebarItemNativeComponent.ts +9 -1
- package/vendor/node_modules/@legendapp/spark-ui/src/sidebar/SidebarNativeComponent.ts +17 -2
- package/vendor/node_modules/@legendapp/spark-ui/src/sidebar/index.tsx +106 -22
- package/vendor/node_modules/@legendapp/spark-ui/src/switch.tsx +13 -0
- package/vendor/node_modules/@legendapp/spark-ui/src/table/TableNativeComponent.ts +22 -0
- package/vendor/node_modules/@legendapp/spark-ui/src/table/index.tsx +118 -0
- package/vendor/node_modules/@legendapp/spark-ui/src/types.ts +52 -7
- package/vendor/node_modules/@legendapp/spark-ui/uniwind.ts +3 -1
- package/vendor/node_modules/@legendapp/spark-ui/uniwind.web.ts +2 -1
- package/vendor/node_modules/@legendapp/spark-ui/windows/SparkUI/SparkUI.h +46 -15
- package/vendor/node_modules/@legendapp/spark-updates/package.json +3 -9
- package/vendor/node_modules/@legendapp/spark-webview/package.json +2 -2
- package/vendor/node_modules/@legendapp/spark-window-options/package.json +1 -1
- /package/{settings-window.ts → ui-settings.ts} +0 -0
|
@@ -16,21 +16,34 @@ namespace React = Microsoft::ReactNative;
|
|
|
16
16
|
namespace Composition = Microsoft::ReactNative::Composition;
|
|
17
17
|
namespace Xaml = Microsoft::UI::Xaml;
|
|
18
18
|
namespace Json = Windows::Data::Json;
|
|
19
|
+
// WinUI TextBox breaks lines with \r; Spark text uses \n.
|
|
20
|
+
inline std::string NewlineText(std::string const &text) {
|
|
21
|
+
std::string lines; lines.reserve(text.size());
|
|
22
|
+
for (size_t i = 0; i < text.size(); ++i) {
|
|
23
|
+
if (text[i] != '\r') { lines += text[i]; continue; }
|
|
24
|
+
lines += '\n';
|
|
25
|
+
if (i + 1 < text.size() && text[i + 1] == '\n') ++i;
|
|
26
|
+
}
|
|
27
|
+
return lines;
|
|
28
|
+
}
|
|
19
29
|
struct Props : implements<Props, React::IComponentProps> {
|
|
20
30
|
React::ViewProps view{nullptr};
|
|
21
|
-
std::string title, defaultText, text, itemsJson = "[]", value, variant = "default";
|
|
22
|
-
bool disabled = false, controlled = false;
|
|
31
|
+
std::string title, defaultText, text, placeholder, itemsJson = "[]", value, variant = "default";
|
|
32
|
+
bool disabled = false, controlled = false, multiline = false, checked = false;
|
|
23
33
|
int32_t eventCount = 0;
|
|
24
34
|
void SetProp(uint32_t, hstring const &name, React::IJSValueReader const &reader) noexcept {
|
|
25
35
|
if (name == L"title") React::ReadValue(reader, title);
|
|
26
36
|
else if (name == L"defaultText") React::ReadValue(reader, defaultText);
|
|
27
37
|
else if (name == L"text") React::ReadValue(reader, text);
|
|
38
|
+
else if (name == L"placeholder") React::ReadValue(reader, placeholder);
|
|
39
|
+
else if (name == L"multiline") React::ReadValue(reader, multiline);
|
|
28
40
|
else if (name == L"controlled") React::ReadValue(reader, controlled);
|
|
29
41
|
else if (name == L"eventCount") React::ReadValue(reader, eventCount);
|
|
30
42
|
else if (name == L"itemsJson") React::ReadValue(reader, itemsJson);
|
|
31
43
|
else if (name == L"value") React::ReadValue(reader, value);
|
|
32
44
|
else if (name == L"variant") React::ReadValue(reader, variant);
|
|
33
45
|
else if (name == L"disabled") React::ReadValue(reader, disabled);
|
|
46
|
+
else if (name == L"checked") React::ReadValue(reader, checked);
|
|
34
47
|
}
|
|
35
48
|
};
|
|
36
49
|
struct Control : implements<Control, Windows::Foundation::IInspectable> {
|
|
@@ -56,6 +69,7 @@ struct Control : implements<Control, Windows::Foundation::IInspectable> {
|
|
|
56
69
|
std::vector<std::string> values;
|
|
57
70
|
bool initialized = false, updating = false;
|
|
58
71
|
int32_t eventCount = 0;
|
|
72
|
+
float width = 0, height = 0;
|
|
59
73
|
void Emit(hstring const &name, std::string const &key = "", std::string const &value = "") {
|
|
60
74
|
const auto count = eventCount;
|
|
61
75
|
if (emitter) emitter.DispatchEvent(name, [key, value, name, count](React::IJSValueWriter const &writer) {
|
|
@@ -65,6 +79,18 @@ struct Control : implements<Control, Windows::Foundation::IInspectable> {
|
|
|
65
79
|
writer.WriteObjectEnd();
|
|
66
80
|
});
|
|
67
81
|
}
|
|
82
|
+
// A Checkbox is SparkButton's checkbox variant; the variant arrives with the first props, so the button is replaced then.
|
|
83
|
+
Xaml::Controls::Control MakeButton(bool checkbox) {
|
|
84
|
+
Xaml::Controls::Primitives::ButtonBase button{nullptr};
|
|
85
|
+
if (checkbox) button = Xaml::Controls::CheckBox(); else button = Xaml::Controls::Button();
|
|
86
|
+
button.Click([weak = get_weak()](auto const &, auto const &) { if (auto self = weak.get()) self->Emit(L"buttonPress"); });
|
|
87
|
+
return button;
|
|
88
|
+
}
|
|
89
|
+
void Place() {
|
|
90
|
+
control.HorizontalAlignment(Xaml::HorizontalAlignment::Stretch);
|
|
91
|
+
control.VerticalAlignment(Xaml::VerticalAlignment::Stretch);
|
|
92
|
+
if (width > 0 || height > 0) { control.Width(width); control.Height(height); }
|
|
93
|
+
}
|
|
68
94
|
void Create(Composition::ContentIslandComponentView const &view, std::string type) {
|
|
69
95
|
kind = std::move(type); component = make_weak(view);
|
|
70
96
|
try {
|
|
@@ -74,13 +100,11 @@ struct Control : implements<Control, Windows::Foundation::IInspectable> {
|
|
|
74
100
|
const auto weak = get_weak();
|
|
75
101
|
windowThemeChanged = view.ThemeChanged(auto_revoke, [weak](auto const &, auto const &) { if (auto self = weak.get()) self->ApplyTheme(); });
|
|
76
102
|
if (kind == "Button") {
|
|
77
|
-
|
|
78
|
-
button.Click([weak](auto const &, auto const &) { if (auto self = weak.get()) self->Emit(L"buttonPress"); });
|
|
79
|
-
control = button;
|
|
103
|
+
control = MakeButton(false);
|
|
80
104
|
} else if (kind == "TextInput") {
|
|
81
105
|
Xaml::Controls::TextBox input;
|
|
82
106
|
input.TextChanged([weak](auto const &sender, auto const &) {
|
|
83
|
-
if (auto self = weak.get(); self && !self->updating && self->control.IsEnabled()) { ++self->eventCount; self->Emit(L"textChange", "text", to_string(sender.template as<Xaml::Controls::TextBox>().Text())); }
|
|
107
|
+
if (auto self = weak.get(); self && !self->updating && self->control.IsEnabled()) { ++self->eventCount; self->Emit(L"textChange", "text", NewlineText(to_string(sender.template as<Xaml::Controls::TextBox>().Text()))); }
|
|
84
108
|
});
|
|
85
109
|
control = input;
|
|
86
110
|
} else {
|
|
@@ -93,8 +117,7 @@ struct Control : implements<Control, Windows::Foundation::IInspectable> {
|
|
|
93
117
|
});
|
|
94
118
|
control = select;
|
|
95
119
|
}
|
|
96
|
-
|
|
97
|
-
control.VerticalAlignment(Xaml::VerticalAlignment::Stretch);
|
|
120
|
+
Place();
|
|
98
121
|
context = React::ReactContext(view.ReactContext());
|
|
99
122
|
ApplyTheme();
|
|
100
123
|
themeSubscription = context.Notifications().Subscribe(ThemeChanged(), context.UIDispatcher(), [weak](auto const &, auto const &) {
|
|
@@ -113,18 +136,25 @@ struct Control : implements<Control, Windows::Foundation::IInspectable> {
|
|
|
113
136
|
if (!control || !failure.empty()) return;
|
|
114
137
|
try {
|
|
115
138
|
updating = true;
|
|
139
|
+
if (kind == "Button" && (props.variant == "checkbox") != static_cast<bool>(control.try_as<Xaml::Controls::CheckBox>())) {
|
|
140
|
+
control = MakeButton(props.variant == "checkbox"); Place(); island.Content(control); ApplyTheme();
|
|
141
|
+
}
|
|
116
142
|
control.IsEnabled(!props.disabled);
|
|
117
143
|
Xaml::Automation::AutomationProperties::SetAutomationId(control, props.view.TestId());
|
|
118
144
|
Xaml::Automation::AutomationProperties::SetName(control, props.view.AccessibilityLabel().empty() && kind == "Button" ? to_hstring(props.title) : props.view.AccessibilityLabel());
|
|
119
145
|
if (kind == "Button") {
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
//
|
|
123
|
-
|
|
146
|
+
control.as<Xaml::Controls::ContentControl>().Content(box_value(to_hstring(props.title)));
|
|
147
|
+
// WinUI owns hover, pressed, keyboard, disabled, and accessibility states. The checkbox state is controlled:
|
|
148
|
+
// a click toggles it, and every update (including the press acknowledgment) restores the value.
|
|
149
|
+
if (auto box = control.try_as<Xaml::Controls::CheckBox>()) box.IsChecked(props.checked);
|
|
150
|
+
else control.BorderThickness(props.variant == "borderless" ? Xaml::Thickness{0, 0, 0, 0} : Xaml::Thickness{1, 1, 1, 1});
|
|
124
151
|
} else if (kind == "TextInput") {
|
|
125
152
|
auto input = control.as<Xaml::Controls::TextBox>();
|
|
126
153
|
if (!initialized) input.Text(to_hstring(props.defaultText));
|
|
127
|
-
if (props.controlled && props.eventCount >= eventCount && input.Text() !=
|
|
154
|
+
if (props.controlled && props.eventCount >= eventCount && NewlineText(to_string(input.Text())) != props.text) input.Text(to_hstring(props.text));
|
|
155
|
+
input.PlaceholderText(to_hstring(props.placeholder));
|
|
156
|
+
input.AcceptsReturn(props.multiline);
|
|
157
|
+
input.TextWrapping(props.multiline ? Xaml::TextWrapping::Wrap : Xaml::TextWrapping::NoWrap);
|
|
128
158
|
} else {
|
|
129
159
|
auto select = control.as<Xaml::Controls::ComboBox>();
|
|
130
160
|
if (items != props.itemsJson) {
|
|
@@ -157,8 +187,8 @@ inline void RegisterControls(React::IReactPackageBuilder const &package) {
|
|
|
157
187
|
if (previous) {
|
|
158
188
|
auto old = get_self<Props>(previous);
|
|
159
189
|
props->title = old->title; props->defaultText = old->defaultText; props->itemsJson = old->itemsJson;
|
|
160
|
-
props->text = old->text; props->controlled = old->controlled; props->eventCount = old->eventCount;
|
|
161
|
-
props->value = old->value; props->variant = old->variant; props->disabled = old->disabled;
|
|
190
|
+
props->text = old->text; props->placeholder = old->placeholder; props->multiline = old->multiline; props->controlled = old->controlled; props->eventCount = old->eventCount;
|
|
191
|
+
props->value = old->value; props->variant = old->variant; props->disabled = old->disabled; props->checked = old->checked;
|
|
162
192
|
}
|
|
163
193
|
props->view = view; return props.as<React::IComponentProps>();
|
|
164
194
|
});
|
|
@@ -169,6 +199,7 @@ inline void RegisterControls(React::IReactPackageBuilder const &package) {
|
|
|
169
199
|
view.LayoutMetricsChanged([weak](auto const &, React::LayoutMetricsChangedArgs const &args) {
|
|
170
200
|
if (auto self = weak.get(); self && self->control) {
|
|
171
201
|
auto frame = args.NewLayoutMetrics().Frame;
|
|
202
|
+
self->width = frame.Width; self->height = frame.Height;
|
|
172
203
|
self->control.Width(frame.Width); self->control.Height(frame.Height);
|
|
173
204
|
}
|
|
174
205
|
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@legendapp/spark-updates",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.5",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "src/index.ts",
|
|
6
6
|
"react-native": "src/index.ts",
|
|
@@ -26,19 +26,13 @@
|
|
|
26
26
|
},
|
|
27
27
|
"spark": {
|
|
28
28
|
"sdk": true,
|
|
29
|
-
"nativeModules":
|
|
30
|
-
"NativeDesktopUpdates"
|
|
31
|
-
],
|
|
32
|
-
"pod": "RNDesktopUpdates",
|
|
33
|
-
"platforms": [
|
|
34
|
-
"macos"
|
|
35
|
-
],
|
|
29
|
+
"nativeModules": true,
|
|
36
30
|
"requires": [
|
|
37
31
|
"@legendapp/spark-desktop-app"
|
|
38
32
|
]
|
|
39
33
|
},
|
|
40
34
|
"dependencies": {
|
|
41
|
-
"@legendapp/spark-desktop-app": "0.0.
|
|
35
|
+
"@legendapp/spark-desktop-app": "0.0.5"
|
|
42
36
|
},
|
|
43
37
|
"private": true
|
|
44
38
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@legendapp/spark-webview",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.5",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "src/index.ts",
|
|
6
6
|
"react-native": "src/index.ts",
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"src"
|
|
9
9
|
],
|
|
10
10
|
"dependencies": {
|
|
11
|
-
"@legendapp/spark-desktop-app": "0.0.
|
|
11
|
+
"@legendapp/spark-desktop-app": "0.0.5"
|
|
12
12
|
},
|
|
13
13
|
"private": true,
|
|
14
14
|
"peerDependencies": {
|
|
File without changes
|