@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.
Files changed (202) hide show
  1. package/init-template.cjs +7 -1
  2. package/package.json +11 -6
  3. package/patches/dependencies.json +4 -4
  4. package/patches/react-native-mmkv@4.3.2.patch +2 -2
  5. package/patches/react-native-nitro-zxing@0.3.1.patch +22 -0
  6. package/patches/registry.json +615 -0
  7. package/patches/workspace/expo-audio@55.0.18.patch +159 -0
  8. package/patches/workspace/op-engineering-op-sqlite@18.2.1.patch +796 -0
  9. package/patches/workspace/react-native-nitro-modules@0.37.0.patch +1348 -0
  10. package/patches/workspace/react-native-runtimes-core@0.1.0-alpha.2.patch +276 -0
  11. package/patches/workspace/react-native-webview@16.0.0.patch +208 -0
  12. package/postinstall.cjs +10 -1
  13. package/skills/spark/SKILL.md +37 -4
  14. package/skills/spark/UPGRADING.md +174 -1
  15. package/skills/spark/ai-customize.md +39 -0
  16. package/skills/spark/app-and-documents.md +56 -0
  17. package/skills/spark/external-libraries.md +87 -0
  18. package/skills/spark/files.md +64 -0
  19. package/skills/spark/integrations.md +69 -0
  20. package/skills/spark/keyboard.md +54 -0
  21. package/skills/spark/library-compat.md +76 -0
  22. package/skills/spark/menus-tray-dock.md +83 -0
  23. package/skills/spark/storage-settings.md +59 -0
  24. package/skills/spark/ui.md +83 -0
  25. package/skills/spark/windows.md +91 -0
  26. package/ui-popover.ts +1 -0
  27. package/ui-progress.ts +1 -0
  28. package/ui-sheet.ts +1 -0
  29. package/ui-split-view.ts +1 -0
  30. package/ui-table.ts +1 -0
  31. package/vendor/node_modules/@legendapp/spark-ai/package.json +3 -3
  32. package/vendor/node_modules/@legendapp/spark-audio/package.json +3 -13
  33. package/vendor/node_modules/@legendapp/spark-auth-session/package.json +3 -10
  34. package/vendor/node_modules/@legendapp/spark-cli/dist/add-desktop.js +5 -0
  35. package/vendor/node_modules/@legendapp/spark-cli/dist/build.js +157 -106
  36. package/vendor/node_modules/@legendapp/spark-cli/dist/cli-arguments.js +4 -1
  37. package/vendor/node_modules/@legendapp/spark-cli/dist/commands.js +16 -7
  38. package/vendor/node_modules/@legendapp/spark-cli/dist/dependency-pins.js +19 -3
  39. package/vendor/node_modules/@legendapp/spark-cli/dist/dev-command.js +2 -0
  40. package/vendor/node_modules/@legendapp/spark-cli/dist/dev.js +3 -0
  41. package/vendor/node_modules/@legendapp/spark-cli/dist/enriched-html-pins.js +2 -0
  42. package/vendor/node_modules/@legendapp/spark-cli/dist/errors.js +1 -1
  43. package/vendor/node_modules/@legendapp/spark-cli/dist/index.js +57 -9
  44. package/vendor/node_modules/@legendapp/spark-cli/dist/init-template.cjs +12 -2
  45. package/vendor/node_modules/@legendapp/spark-cli/dist/init-template.d.cts +1 -1
  46. package/vendor/node_modules/@legendapp/spark-cli/dist/metro.cjs +1 -0
  47. package/vendor/node_modules/@legendapp/spark-cli/dist/migrate.js +65 -0
  48. package/vendor/node_modules/@legendapp/spark-cli/dist/migration-helpers.cjs +4 -4
  49. package/vendor/node_modules/@legendapp/spark-cli/dist/migration-helpers.d.cts +2 -2
  50. package/vendor/node_modules/@legendapp/spark-cli/dist/migrations.cjs +15 -8
  51. package/vendor/node_modules/@legendapp/spark-cli/dist/native-patch-preflight.js +35 -7
  52. package/vendor/node_modules/@legendapp/spark-cli/dist/package.js +4 -8
  53. package/vendor/node_modules/@legendapp/spark-cli/dist/patch.js +92 -0
  54. package/vendor/node_modules/@legendapp/spark-cli/dist/project-version.js +12 -4
  55. package/vendor/node_modules/@legendapp/spark-cli/dist/project.js +8 -1
  56. package/vendor/node_modules/@legendapp/spark-cli/dist/publish-directory.js +32 -0
  57. package/vendor/node_modules/@legendapp/spark-cli/dist/release-app.js +139 -0
  58. package/vendor/node_modules/@legendapp/spark-cli/dist/release.json +17 -17
  59. package/vendor/node_modules/@legendapp/spark-cli/dist/signing.js +61 -41
  60. package/vendor/node_modules/@legendapp/spark-cli/dist/upgrade.js +1 -1
  61. package/vendor/node_modules/@legendapp/spark-cli/dist/windows.js +3 -0
  62. package/vendor/node_modules/@legendapp/spark-cli/package.json +5 -4
  63. package/vendor/node_modules/@legendapp/spark-cli/templates/blank-typescript/package.json +2 -2
  64. package/vendor/node_modules/@legendapp/spark-cli/templates/universal/package.json +2 -2
  65. package/vendor/node_modules/@legendapp/spark-cli/templates/windows/package.json +2 -2
  66. package/vendor/node_modules/@legendapp/spark-clipboard/macos/RNDesktopClipboard.mm +1 -1
  67. package/vendor/node_modules/@legendapp/spark-clipboard/package.json +3 -10
  68. package/vendor/node_modules/@legendapp/spark-clipboard/src/desktop.ts +1 -0
  69. package/vendor/node_modules/@legendapp/spark-codex/package.json +3 -7
  70. package/vendor/node_modules/@legendapp/spark-commands/package.json +5 -5
  71. package/vendor/node_modules/@legendapp/spark-context-menu/package.json +3 -10
  72. package/vendor/node_modules/@legendapp/spark-desktop-app/macos/SparkDesktop.h +3 -1
  73. package/vendor/node_modules/@legendapp/spark-desktop-app/macos/SparkDesktop.mm +51 -10
  74. package/vendor/node_modules/@legendapp/spark-desktop-app/macos/SparkStorage.h +4 -0
  75. package/vendor/node_modules/@legendapp/spark-desktop-app/macos/SparkStorage.mm +82 -0
  76. package/vendor/node_modules/@legendapp/spark-desktop-app/macos/SparkTestDriver.h +2 -0
  77. package/vendor/node_modules/@legendapp/spark-desktop-app/macos/SparkTestDriver.mm +1 -0
  78. package/vendor/node_modules/@legendapp/spark-desktop-app/package.json +2 -8
  79. package/vendor/node_modules/@legendapp/spark-desktop-config/app.plugin.cjs +1 -0
  80. package/vendor/node_modules/@legendapp/spark-desktop-config/config.cjs +6 -8
  81. package/vendor/node_modules/@legendapp/spark-desktop-config/identity.cjs +2 -0
  82. package/vendor/node_modules/@legendapp/spark-desktop-config/native-patches.cjs +300 -71
  83. package/vendor/node_modules/@legendapp/spark-desktop-config/native-patches.d.cts +7 -0
  84. package/vendor/node_modules/@legendapp/spark-desktop-config/package.json +3 -3
  85. package/vendor/node_modules/@legendapp/spark-desktop-config/patch-registry.cjs +318 -0
  86. package/vendor/node_modules/@legendapp/spark-desktop-config/patch-registry.d.cts +20 -0
  87. package/vendor/node_modules/@legendapp/spark-desktop-config/rpaths.cjs +20 -0
  88. package/vendor/node_modules/@legendapp/spark-desktop-config/rpaths.d.cts +1 -0
  89. package/vendor/node_modules/@legendapp/spark-desktop-config/validation.cjs +66 -9
  90. package/vendor/node_modules/@legendapp/spark-desktop-config/windows.plugin.cjs +1 -0
  91. package/vendor/node_modules/@legendapp/spark-desktop-host/AppDelegate.mm +17 -5
  92. package/vendor/node_modules/@legendapp/spark-desktop-host/package.json +2 -2
  93. package/vendor/node_modules/@legendapp/spark-desktop-links/package.json +3 -10
  94. package/vendor/node_modules/@legendapp/spark-desktop-shortcuts/package.json +3 -10
  95. package/vendor/node_modules/@legendapp/spark-desktop-windows/macos/RNDesktopWindows.mm +7 -2
  96. package/vendor/node_modules/@legendapp/spark-desktop-windows/macos/window-manager/RNWindowManager.mm +235 -240
  97. package/vendor/node_modules/@legendapp/spark-desktop-windows/package.json +4 -11
  98. package/vendor/node_modules/@legendapp/spark-desktop-windows/src/api.ts +9 -3
  99. package/vendor/node_modules/@legendapp/spark-desktop-windows/src/macos-adapter.ts +7 -0
  100. package/vendor/node_modules/@legendapp/spark-desktop-windows/src/types.ts +32 -3
  101. package/vendor/node_modules/@legendapp/spark-desktop-windows/src/validation.ts +28 -11
  102. package/vendor/node_modules/@legendapp/spark-desktop-windows/src/windows/createWindowsNavigator.tsx +15 -3
  103. package/vendor/node_modules/@legendapp/spark-desktop-windows/src/windows/primaryWindowLifecycle.ts +12 -3
  104. package/vendor/node_modules/@legendapp/spark-desktop-windows/src/windows/usePrimaryWindowLifecycle.ts +2 -1
  105. package/vendor/node_modules/@legendapp/spark-desktop-windows/src/windows/useWindowFocusEffect.ts +4 -1
  106. package/vendor/node_modules/@legendapp/spark-documents/package.json +7 -7
  107. package/vendor/node_modules/@legendapp/spark-drag-drop/macos/RNDesktopDragView.mm +77 -17
  108. package/vendor/node_modules/@legendapp/spark-drag-drop/package.json +3 -8
  109. package/vendor/node_modules/@legendapp/spark-drag-drop/src/DesktopDragViewNativeComponent.ts +1 -0
  110. package/vendor/node_modules/@legendapp/spark-drag-drop/src/contracts.ts +13 -4
  111. package/vendor/node_modules/@legendapp/spark-drag-drop/src/index.tsx +5 -3
  112. package/vendor/node_modules/@legendapp/spark-drag-drop/windows/SparkDragDrop/SparkDragDrop.h +6 -1
  113. package/vendor/node_modules/@legendapp/spark-expo-compat/metro.cjs +44 -0
  114. package/vendor/node_modules/@legendapp/spark-expo-compat/package.json +20 -0
  115. package/vendor/node_modules/@legendapp/spark-expo-compat/src/clipboard.ts +40 -0
  116. package/vendor/node_modules/@legendapp/spark-expo-compat/src/document-picker.ts +52 -0
  117. package/vendor/node_modules/@legendapp/spark-file-dialog/package.json +3 -10
  118. package/vendor/node_modules/@legendapp/spark-file-dialog/src/options.ts +5 -2
  119. package/vendor/node_modules/@legendapp/spark-file-dialog/src/types.ts +3 -3
  120. package/vendor/node_modules/@legendapp/spark-file-system/macos/RNDesktopFileSystem.mm +1 -1
  121. package/vendor/node_modules/@legendapp/spark-file-system/package.json +3 -11
  122. package/vendor/node_modules/@legendapp/spark-global-shortcuts/package.json +3 -10
  123. package/vendor/node_modules/@legendapp/spark-html/package.json +2 -2
  124. package/vendor/node_modules/@legendapp/spark-markdown/package.json +2 -2
  125. package/vendor/node_modules/@legendapp/spark-message-dialog/package.json +3 -10
  126. package/vendor/node_modules/@legendapp/spark-message-dialog/src/index.ts +1 -0
  127. package/vendor/node_modules/@legendapp/spark-native-menu/package.json +3 -9
  128. package/vendor/node_modules/@legendapp/spark-native-menu/src/hooks.ts +4 -0
  129. package/vendor/node_modules/@legendapp/spark-notifications/package.json +3 -10
  130. package/vendor/node_modules/@legendapp/spark-processes/package.json +3 -10
  131. package/vendor/node_modules/@legendapp/spark-rich-text/package.json +2 -2
  132. package/vendor/node_modules/@legendapp/spark-secure-storage/package.json +3 -10
  133. package/vendor/node_modules/@legendapp/spark-settings/package.json +3 -3
  134. package/vendor/node_modules/@legendapp/spark-settings-ui/package.json +4 -4
  135. package/vendor/node_modules/@legendapp/spark-settings-ui/src/index.tsx +122 -334
  136. package/vendor/node_modules/@legendapp/spark-settings-ui/src/rows.tsx +183 -0
  137. package/vendor/node_modules/@legendapp/spark-sqlite/package.json +3 -3
  138. package/vendor/node_modules/@legendapp/spark-system/package.json +3 -10
  139. package/vendor/node_modules/@legendapp/spark-tray/package.json +3 -10
  140. package/vendor/node_modules/@legendapp/spark-tray/src/index.ts +2 -1
  141. package/vendor/node_modules/@legendapp/spark-ui/macos/RNSparkButton.mm +82 -14
  142. package/vendor/node_modules/@legendapp/spark-ui/macos/RNSparkTextInput.h +1 -1
  143. package/vendor/node_modules/@legendapp/spark-ui/macos/RNSparkTextInput.mm +94 -11
  144. package/vendor/node_modules/@legendapp/spark-ui/macos/appkit-split-view/RNSidebarSplitViewComponent.mm +235 -18
  145. package/vendor/node_modules/@legendapp/spark-ui/macos/appkit-split-view/RNSparkPaneSplitView.h +17 -0
  146. package/vendor/node_modules/@legendapp/spark-ui/macos/appkit-split-view/RNSparkPaneSplitView.mm +216 -0
  147. package/vendor/node_modules/@legendapp/spark-ui/macos/appkit-split-view/RNSparkSplitViewComponent.h +4 -0
  148. package/vendor/node_modules/@legendapp/spark-ui/macos/appkit-split-view/RNSparkSplitViewComponent.mm +212 -0
  149. package/vendor/node_modules/@legendapp/spark-ui/macos/appkit-split-view/RNSparkSplitViewUpdates.h +6 -0
  150. package/vendor/node_modules/@legendapp/spark-ui/macos/native-select/RNNativeSegmentedControl.mm +28 -13
  151. package/vendor/node_modules/@legendapp/spark-ui/macos/native-select/RNNativeSelect.mm +17 -1
  152. package/vendor/node_modules/@legendapp/spark-ui/macos/popover/RNSparkPopover.h +9 -0
  153. package/vendor/node_modules/@legendapp/spark-ui/macos/popover/RNSparkPopover.mm +126 -0
  154. package/vendor/node_modules/@legendapp/spark-ui/macos/progress/RNSparkProgressIndicator.h +9 -0
  155. package/vendor/node_modules/@legendapp/spark-ui/macos/progress/RNSparkProgressIndicator.mm +66 -0
  156. package/vendor/node_modules/@legendapp/spark-ui/macos/radio-group/RNSparkRadioGroup.h +9 -0
  157. package/vendor/node_modules/@legendapp/spark-ui/macos/radio-group/RNSparkRadioGroup.mm +118 -0
  158. package/vendor/node_modules/@legendapp/spark-ui/macos/sf-symbol/RNSFSymbol.mm +4 -12
  159. package/vendor/node_modules/@legendapp/spark-ui/macos/sheet/RNSparkSheet.h +9 -0
  160. package/vendor/node_modules/@legendapp/spark-ui/macos/sheet/RNSparkSheet.mm +109 -0
  161. package/vendor/node_modules/@legendapp/spark-ui/macos/sidebar/RNSidebar.mm +438 -102
  162. package/vendor/node_modules/@legendapp/spark-ui/macos/table/RNSparkTable.h +9 -0
  163. package/vendor/node_modules/@legendapp/spark-ui/macos/table/RNSparkTable.mm +179 -0
  164. package/vendor/node_modules/@legendapp/spark-ui/package.json +9 -8
  165. package/vendor/node_modules/@legendapp/spark-ui/src/SparkButtonNativeComponent.ts +10 -2
  166. package/vendor/node_modules/@legendapp/spark-ui/src/SparkTextInputNativeComponent.ts +2 -0
  167. package/vendor/node_modules/@legendapp/spark-ui/src/appkit-split-view/SidebarSplitViewNativeComponent.ts +9 -0
  168. package/vendor/node_modules/@legendapp/spark-ui/src/appkit-split-view/SplitView.tsx +99 -0
  169. package/vendor/node_modules/@legendapp/spark-ui/src/appkit-split-view/SplitViewNativeComponent.ts +29 -0
  170. package/vendor/node_modules/@legendapp/spark-ui/src/appkit-split-view/index.tsx +34 -17
  171. package/vendor/node_modules/@legendapp/spark-ui/src/availability.ts +6 -4
  172. package/vendor/node_modules/@legendapp/spark-ui/src/checkbox-unavailable.tsx +20 -0
  173. package/vendor/node_modules/@legendapp/spark-ui/src/control.ts +24 -3
  174. package/vendor/node_modules/@legendapp/spark-ui/src/desktop.tsx +72 -20
  175. package/vendor/node_modules/@legendapp/spark-ui/src/index.android.tsx +18 -12
  176. package/vendor/node_modules/@legendapp/spark-ui/src/index.ios.tsx +21 -15
  177. package/vendor/node_modules/@legendapp/spark-ui/src/index.web.tsx +40 -16
  178. package/vendor/node_modules/@legendapp/spark-ui/src/mobile-input.tsx +2 -2
  179. package/vendor/node_modules/@legendapp/spark-ui/src/native-select/NativeSegmentedControlNativeComponent.ts +3 -1
  180. package/vendor/node_modules/@legendapp/spark-ui/src/native-select/NativeSelectNativeComponent.ts +1 -0
  181. package/vendor/node_modules/@legendapp/spark-ui/src/popover/PopoverNativeComponent.ts +20 -0
  182. package/vendor/node_modules/@legendapp/spark-ui/src/popover/index.tsx +45 -0
  183. package/vendor/node_modules/@legendapp/spark-ui/src/progress/ProgressIndicatorNativeComponent.ts +13 -0
  184. package/vendor/node_modules/@legendapp/spark-ui/src/progress/index.tsx +32 -0
  185. package/vendor/node_modules/@legendapp/spark-ui/src/radio-group/RadioGroupNativeComponent.ts +17 -0
  186. package/vendor/node_modules/@legendapp/spark-ui/src/select.ts +4 -0
  187. package/vendor/node_modules/@legendapp/spark-ui/src/sheet/SheetNativeComponent.ts +15 -0
  188. package/vendor/node_modules/@legendapp/spark-ui/src/sheet/index.tsx +38 -0
  189. package/vendor/node_modules/@legendapp/spark-ui/src/sidebar/SidebarItemNativeComponent.ts +9 -1
  190. package/vendor/node_modules/@legendapp/spark-ui/src/sidebar/SidebarNativeComponent.ts +17 -2
  191. package/vendor/node_modules/@legendapp/spark-ui/src/sidebar/index.tsx +106 -22
  192. package/vendor/node_modules/@legendapp/spark-ui/src/switch.tsx +13 -0
  193. package/vendor/node_modules/@legendapp/spark-ui/src/table/TableNativeComponent.ts +22 -0
  194. package/vendor/node_modules/@legendapp/spark-ui/src/table/index.tsx +118 -0
  195. package/vendor/node_modules/@legendapp/spark-ui/src/types.ts +52 -7
  196. package/vendor/node_modules/@legendapp/spark-ui/uniwind.ts +3 -1
  197. package/vendor/node_modules/@legendapp/spark-ui/uniwind.web.ts +2 -1
  198. package/vendor/node_modules/@legendapp/spark-ui/windows/SparkUI/SparkUI.h +46 -15
  199. package/vendor/node_modules/@legendapp/spark-updates/package.json +3 -9
  200. package/vendor/node_modules/@legendapp/spark-webview/package.json +2 -2
  201. package/vendor/node_modules/@legendapp/spark-window-options/package.json +1 -1
  202. /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
- Xaml::Controls::Button button;
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
- control.HorizontalAlignment(Xaml::HorizontalAlignment::Stretch);
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
- auto button = control.as<Xaml::Controls::Button>();
121
- button.Content(box_value(to_hstring(props.title)));
122
- // WinUI owns hover, pressed, keyboard, disabled, and accessibility states.
123
- button.BorderThickness(props.variant == "borderless" ? Xaml::Thickness{0, 0, 0, 0} : Xaml::Thickness{1, 1, 1, 1});
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() != to_hstring(props.text)) input.Text(to_hstring(props.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",
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.3"
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",
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.3"
11
+ "@legendapp/spark-desktop-app": "0.0.5"
12
12
  },
13
13
  "private": true,
14
14
  "peerDependencies": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@legendapp/spark-window-options",
3
- "version": "0.0.3",
3
+ "version": "0.0.5",
4
4
  "license": "MIT",
5
5
  "main": "index.cjs",
6
6
  "types": "index.d.ts",
File without changes