git0 0.2.10 → 0.2.11

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 (239) hide show
  1. package/TypeScript-React-Starter/LICENSE +21 -0
  2. package/TypeScript-React-Starter/README-CRA.md +1281 -0
  3. package/TypeScript-React-Starter/README.md +810 -0
  4. package/TypeScript-React-Starter/package.json +28 -0
  5. package/TypeScript-React-Starter/public/favicon.ico +0 -0
  6. package/TypeScript-React-Starter/public/index.html +31 -0
  7. package/TypeScript-React-Starter/src/App.css +24 -0
  8. package/TypeScript-React-Starter/src/App.test.tsx +8 -0
  9. package/TypeScript-React-Starter/src/App.tsx +23 -0
  10. package/TypeScript-React-Starter/src/actions/index.tsx +24 -0
  11. package/TypeScript-React-Starter/src/components/Hello.css +13 -0
  12. package/TypeScript-React-Starter/src/components/Hello.test.tsx +30 -0
  13. package/TypeScript-React-Starter/src/components/Hello.tsx +35 -0
  14. package/TypeScript-React-Starter/src/constants/index.tsx +6 -0
  15. package/TypeScript-React-Starter/src/containers/Hello.tsx +20 -0
  16. package/TypeScript-React-Starter/src/index.css +5 -0
  17. package/TypeScript-React-Starter/src/index.tsx +22 -0
  18. package/TypeScript-React-Starter/src/logo.svg +7 -0
  19. package/TypeScript-React-Starter/src/reducers/index.tsx +15 -0
  20. package/TypeScript-React-Starter/src/types/index.tsx +5 -0
  21. package/TypeScript-React-Starter/tsconfig.json +29 -0
  22. package/TypeScript-React-Starter/tslint.json +11 -0
  23. package/TypeScript-React-Starter/yarn.lock +4785 -0
  24. package/package.json +2 -2
  25. package/src/github-api.js +1 -0
  26. package/svelte-nodegui/.all-contributorsrc +60 -0
  27. package/svelte-nodegui/.vscode/launch.json +29 -0
  28. package/svelte-nodegui/CHANGELOG.md +153 -0
  29. package/svelte-nodegui/LICENSE +22 -0
  30. package/svelte-nodegui/README.md +151 -0
  31. package/svelte-nodegui/demo/.editorconfig +15 -0
  32. package/svelte-nodegui/demo/.vscode/extensions.json +3 -0
  33. package/svelte-nodegui/demo/livereload.js +29 -0
  34. package/svelte-nodegui/demo/package-lock.json +3514 -0
  35. package/svelte-nodegui/demo/package.json +35 -0
  36. package/svelte-nodegui/demo/src/App.svelte +29 -0
  37. package/svelte-nodegui/demo/src/app.ts +31 -0
  38. package/svelte-nodegui/demo/tsconfig.json +40 -0
  39. package/svelte-nodegui/demo/webpack.config.js +110 -0
  40. package/svelte-nodegui/extras/assets/kitchen.png +0 -0
  41. package/svelte-nodegui/extras/assets/nodegui.png +0 -0
  42. package/svelte-nodegui/extras/assets/nodegui_white.png +0 -0
  43. package/svelte-nodegui/extras/assets/start_icon.png +0 -0
  44. package/svelte-nodegui/extras/legal/logo/thanks.md +13 -0
  45. package/svelte-nodegui/extras/legal/yode/LICENSE +21 -0
  46. package/svelte-nodegui/extras/legal/yoga/LICENSE +0 -0
  47. package/svelte-nodegui/extras/logo/nodegui-circle.png +0 -0
  48. package/svelte-nodegui/extras/logo/nodegui.png +0 -0
  49. package/svelte-nodegui/extras/logo/nodegui.svg +4 -0
  50. package/svelte-nodegui/nativescript-svelte-todo.gif +0 -0
  51. package/svelte-nodegui/package-lock.json +1749 -0
  52. package/svelte-nodegui/package.json +44 -0
  53. package/svelte-nodegui/repl-workers/bundler/commonjs.js +58 -0
  54. package/svelte-nodegui/repl-workers/bundler/index.js +353 -0
  55. package/svelte-nodegui/repl-workers/package-lock.json +484 -0
  56. package/svelte-nodegui/repl-workers/package.json +21 -0
  57. package/svelte-nodegui/repl-workers/rollup.config.js +21 -0
  58. package/svelte-nodegui/rollup.config.js +81 -0
  59. package/svelte-nodegui/scripts/create-pkg.js +42 -0
  60. package/svelte-nodegui/src/components/AsComponent.svelte +16 -0
  61. package/svelte-nodegui/src/components/SlotComponent.svelte +4 -0
  62. package/svelte-nodegui/src/components/Template.svelte +10 -0
  63. package/svelte-nodegui/src/components/Template.svelte.d.ts +6 -0
  64. package/svelte-nodegui/src/components/index.ts +2 -0
  65. package/svelte-nodegui/src/dom/index.ts +132 -0
  66. package/svelte-nodegui/src/dom/nativescript-vue-next/LICENCE +21 -0
  67. package/svelte-nodegui/src/dom/nativescript-vue-next/index.ts +19 -0
  68. package/svelte-nodegui/src/dom/nativescript-vue-next/runtime/index.ts +21 -0
  69. package/svelte-nodegui/src/dom/nativescript-vue-next/runtime/nodes.ts +890 -0
  70. package/svelte-nodegui/src/dom/nativescript-vue-next/runtime/registry.ts +262 -0
  71. package/svelte-nodegui/src/dom/nativescript-vue-next/runtime/runtimeHelpers.ts +20 -0
  72. package/svelte-nodegui/src/dom/react-nodegui/LICENSE +21 -0
  73. package/svelte-nodegui/src/dom/react-nodegui/src/components/AbstractComponents/RNAbstractButton.ts +67 -0
  74. package/svelte-nodegui/src/dom/react-nodegui/src/components/Action/RNAction.ts +146 -0
  75. package/svelte-nodegui/src/dom/react-nodegui/src/components/Action/index.ts +37 -0
  76. package/svelte-nodegui/src/dom/react-nodegui/src/components/AnimatedImage/RNAnimatedImage.ts +76 -0
  77. package/svelte-nodegui/src/dom/react-nodegui/src/components/AnimatedImage/index.ts +45 -0
  78. package/svelte-nodegui/src/dom/react-nodegui/src/components/BoxView/RNBoxView.ts +99 -0
  79. package/svelte-nodegui/src/dom/react-nodegui/src/components/BoxView/index.ts +49 -0
  80. package/svelte-nodegui/src/dom/react-nodegui/src/components/Button/RNButton.ts +71 -0
  81. package/svelte-nodegui/src/dom/react-nodegui/src/components/Button/index.ts +49 -0
  82. package/svelte-nodegui/src/dom/react-nodegui/src/components/CheckBox/RNCheckBox.ts +71 -0
  83. package/svelte-nodegui/src/dom/react-nodegui/src/components/CheckBox/index.ts +50 -0
  84. package/svelte-nodegui/src/dom/react-nodegui/src/components/ComboBox/RNComboBox.ts +118 -0
  85. package/svelte-nodegui/src/dom/react-nodegui/src/components/ComboBox/index.ts +50 -0
  86. package/svelte-nodegui/src/dom/react-nodegui/src/components/Dial/RNDial.ts +69 -0
  87. package/svelte-nodegui/src/dom/react-nodegui/src/components/Dial/index.ts +41 -0
  88. package/svelte-nodegui/src/dom/react-nodegui/src/components/GridView/GridColumn/RNGridColumn.ts +95 -0
  89. package/svelte-nodegui/src/dom/react-nodegui/src/components/GridView/GridColumn/index.ts +49 -0
  90. package/svelte-nodegui/src/dom/react-nodegui/src/components/GridView/GridRow/RNGridRow.ts +141 -0
  91. package/svelte-nodegui/src/dom/react-nodegui/src/components/GridView/GridRow/index.ts +47 -0
  92. package/svelte-nodegui/src/dom/react-nodegui/src/components/GridView/RNGridView.ts +185 -0
  93. package/svelte-nodegui/src/dom/react-nodegui/src/components/GridView/index.ts +51 -0
  94. package/svelte-nodegui/src/dom/react-nodegui/src/components/GridView/utils.ts +59 -0
  95. package/svelte-nodegui/src/dom/react-nodegui/src/components/Image/RNImage.ts +135 -0
  96. package/svelte-nodegui/src/dom/react-nodegui/src/components/Image/index.ts +46 -0
  97. package/svelte-nodegui/src/dom/react-nodegui/src/components/LineEdit/RNLineEdit.ts +82 -0
  98. package/svelte-nodegui/src/dom/react-nodegui/src/components/LineEdit/index.ts +41 -0
  99. package/svelte-nodegui/src/dom/react-nodegui/src/components/Menu/RNMenu.ts +49 -0
  100. package/svelte-nodegui/src/dom/react-nodegui/src/components/Menu/index.ts +44 -0
  101. package/svelte-nodegui/src/dom/react-nodegui/src/components/MenuBar/RNMenuBar.ts +51 -0
  102. package/svelte-nodegui/src/dom/react-nodegui/src/components/MenuBar/index.ts +42 -0
  103. package/svelte-nodegui/src/dom/react-nodegui/src/components/PlainTextEdit/RNPlainTextEdit.ts +82 -0
  104. package/svelte-nodegui/src/dom/react-nodegui/src/components/PlainTextEdit/index.ts +44 -0
  105. package/svelte-nodegui/src/dom/react-nodegui/src/components/ProgressBar/RNProgressBar.ts +78 -0
  106. package/svelte-nodegui/src/dom/react-nodegui/src/components/ProgressBar/index.ts +43 -0
  107. package/svelte-nodegui/src/dom/react-nodegui/src/components/RadioButton/RNRadioButton.ts +50 -0
  108. package/svelte-nodegui/src/dom/react-nodegui/src/components/RadioButton/index.ts +43 -0
  109. package/svelte-nodegui/src/dom/react-nodegui/src/components/ScrollArea/RNScrollArea.ts +51 -0
  110. package/svelte-nodegui/src/dom/react-nodegui/src/components/ScrollArea/index.ts +44 -0
  111. package/svelte-nodegui/src/dom/react-nodegui/src/components/Slider/RNSlider.ts +97 -0
  112. package/svelte-nodegui/src/dom/react-nodegui/src/components/Slider/index.ts +46 -0
  113. package/svelte-nodegui/src/dom/react-nodegui/src/components/SpinBox/RNSpinBox.ts +88 -0
  114. package/svelte-nodegui/src/dom/react-nodegui/src/components/SpinBox/index.ts +49 -0
  115. package/svelte-nodegui/src/dom/react-nodegui/src/components/Svg/RNSvg.ts +67 -0
  116. package/svelte-nodegui/src/dom/react-nodegui/src/components/Svg/index.ts +43 -0
  117. package/svelte-nodegui/src/dom/react-nodegui/src/components/SystemTrayIcon/RNSystemTrayIcon.ts +141 -0
  118. package/svelte-nodegui/src/dom/react-nodegui/src/components/SystemTrayIcon/index.ts +43 -0
  119. package/svelte-nodegui/src/dom/react-nodegui/src/components/Tab/RNTab.ts +69 -0
  120. package/svelte-nodegui/src/dom/react-nodegui/src/components/Tab/index.ts +48 -0
  121. package/svelte-nodegui/src/dom/react-nodegui/src/components/TabItem/RNTabItem.ts +72 -0
  122. package/svelte-nodegui/src/dom/react-nodegui/src/components/TabItem/index.ts +40 -0
  123. package/svelte-nodegui/src/dom/react-nodegui/src/components/Text/RNText.ts +65 -0
  124. package/svelte-nodegui/src/dom/react-nodegui/src/components/Text/index.ts +49 -0
  125. package/svelte-nodegui/src/dom/react-nodegui/src/components/View/RNView.ts +306 -0
  126. package/svelte-nodegui/src/dom/react-nodegui/src/components/View/index.ts +44 -0
  127. package/svelte-nodegui/src/dom/react-nodegui/src/components/Window/RNWindow.ts +66 -0
  128. package/svelte-nodegui/src/dom/react-nodegui/src/components/Window/index.ts +50 -0
  129. package/svelte-nodegui/src/dom/react-nodegui/src/components/config.ts +95 -0
  130. package/svelte-nodegui/src/dom/react-nodegui/src/index.ts +52 -0
  131. package/svelte-nodegui/src/dom/react-nodegui/src/reconciler/index.ts +226 -0
  132. package/svelte-nodegui/src/dom/react-nodegui/src/utils/decoupleFromReact.ts +2 -0
  133. package/svelte-nodegui/src/dom/react-nodegui/src/utils/helpers.ts +14 -0
  134. package/svelte-nodegui/src/dom/shared/Logger.ts +16 -0
  135. package/svelte-nodegui/src/dom/shared/index.ts +1 -0
  136. package/svelte-nodegui/src/dom/svelte/HeadElement.ts +41 -0
  137. package/svelte-nodegui/src/dom/svelte/RNObject.ts +95 -0
  138. package/svelte-nodegui/src/dom/svelte/StyleElement.ts +92 -0
  139. package/svelte-nodegui/src/dom/svelte/SvelteNodeGUIDocument.ts +124 -0
  140. package/svelte-nodegui/src/dom/svelte/TemplateElement.ts +16 -0
  141. package/svelte-nodegui/src/dom/svelte-elements.ts +111 -0
  142. package/svelte-nodegui/src/index.ts +62 -0
  143. package/svelte-nodegui/src/svelte-nodegui.ts +159 -0
  144. package/svelte-nodegui/src/transitions/bezier.ts +112 -0
  145. package/svelte-nodegui/src/transitions/index.ts +227 -0
  146. package/svelte-nodegui/tsconfig.json +19 -0
  147. package/svelte-nodegui/website/README.md +33 -0
  148. package/svelte-nodegui/website/blog/2019-05-30-welcome.md +12 -0
  149. package/svelte-nodegui/website/docs/api/classes/renderer.md +49 -0
  150. package/svelte-nodegui/website/docs/api/classes/rnaction.md +608 -0
  151. package/svelte-nodegui/website/docs/api/classes/rngridcolumn.md +232 -0
  152. package/svelte-nodegui/website/docs/api/classes/rngridrow.md +247 -0
  153. package/svelte-nodegui/website/docs/api/classes/rnmenu.md +1337 -0
  154. package/svelte-nodegui/website/docs/api/classes/rnmenubar.md +1341 -0
  155. package/svelte-nodegui/website/docs/api/globals.md +832 -0
  156. package/svelte-nodegui/website/docs/api/index.md +0 -0
  157. package/svelte-nodegui/website/docs/api/interfaces/_react_proxy_.reactproxycomponent.md +38 -0
  158. package/svelte-nodegui/website/docs/api/interfaces/abstractbuttonprops.md +306 -0
  159. package/svelte-nodegui/website/docs/api/interfaces/actionprops.md +115 -0
  160. package/svelte-nodegui/website/docs/api/interfaces/animatedimageprops.md +297 -0
  161. package/svelte-nodegui/website/docs/api/interfaces/boxviewprops.md +245 -0
  162. package/svelte-nodegui/website/docs/api/interfaces/buttonprops.md +313 -0
  163. package/svelte-nodegui/website/docs/api/interfaces/checkboxprops.md +313 -0
  164. package/svelte-nodegui/website/docs/api/interfaces/comboboxprops.md +343 -0
  165. package/svelte-nodegui/website/docs/api/interfaces/datawithoffset.md +32 -0
  166. package/svelte-nodegui/website/docs/api/interfaces/dialprops.md +259 -0
  167. package/svelte-nodegui/website/docs/api/interfaces/gridviewprops.md +273 -0
  168. package/svelte-nodegui/website/docs/api/interfaces/imageprops.md +311 -0
  169. package/svelte-nodegui/website/docs/api/interfaces/lineeditprops.md +266 -0
  170. package/svelte-nodegui/website/docs/api/interfaces/menubarprops.md +245 -0
  171. package/svelte-nodegui/website/docs/api/interfaces/menuprops.md +245 -0
  172. package/svelte-nodegui/website/docs/api/interfaces/plaintexteditprops.md +259 -0
  173. package/svelte-nodegui/website/docs/api/interfaces/progressbarprops.md +266 -0
  174. package/svelte-nodegui/website/docs/api/interfaces/radiobuttonprops.md +282 -0
  175. package/svelte-nodegui/website/docs/api/interfaces/scrollareaprops.md +245 -0
  176. package/svelte-nodegui/website/docs/api/interfaces/sliderprops.md +329 -0
  177. package/svelte-nodegui/website/docs/api/interfaces/spinboxprops.md +273 -0
  178. package/svelte-nodegui/website/docs/api/interfaces/systemtrayiconprops.md +97 -0
  179. package/svelte-nodegui/website/docs/api/interfaces/tabitemprops.md +28 -0
  180. package/svelte-nodegui/website/docs/api/interfaces/tabprops.md +245 -0
  181. package/svelte-nodegui/website/docs/api/interfaces/textprops.md +277 -0
  182. package/svelte-nodegui/website/docs/api/interfaces/viewprops.md +261 -0
  183. package/svelte-nodegui/website/docs/api/interfaces/windowprops.md +245 -0
  184. package/svelte-nodegui/website/docs/api/modules/_react_proxy_.md +29 -0
  185. package/svelte-nodegui/website/docs/doc1.md +162 -0
  186. package/svelte-nodegui/website/docs/guides/custom-nodegui-native-plugin.md +6 -0
  187. package/svelte-nodegui/website/docs/guides/debugging-in-vscode.md +39 -0
  188. package/svelte-nodegui/website/docs/guides/debugging.md +59 -0
  189. package/svelte-nodegui/website/docs/guides/getting-started.md +141 -0
  190. package/svelte-nodegui/website/docs/guides/handle-events.md +188 -0
  191. package/svelte-nodegui/website/docs/guides/images.md +62 -0
  192. package/svelte-nodegui/website/docs/guides/layout.md +281 -0
  193. package/svelte-nodegui/website/docs/guides/networking.md +31 -0
  194. package/svelte-nodegui/website/docs/guides/packaging.md +32 -0
  195. package/svelte-nodegui/website/docs/guides/scroll-view.md +69 -0
  196. package/svelte-nodegui/website/docs/guides/styling.md +208 -0
  197. package/svelte-nodegui/website/docs/guides/tutorial.md +82 -0
  198. package/svelte-nodegui/website/docs/guides/using-native-node-modules.md +55 -0
  199. package/svelte-nodegui/website/docs/mdx.md +22 -0
  200. package/svelte-nodegui/website/docs/scripts/fixdocs.js +21 -0
  201. package/svelte-nodegui/website/docusaurus.config.js +131 -0
  202. package/svelte-nodegui/website/package.json +33 -0
  203. package/svelte-nodegui/website/sidebars.js +77 -0
  204. package/svelte-nodegui/website/src/components/CodeExample.js +42 -0
  205. package/svelte-nodegui/website/src/components/CreateNativeApps.js +46 -0
  206. package/svelte-nodegui/website/src/components/Features.js +62 -0
  207. package/svelte-nodegui/website/src/components/Hero.js +85 -0
  208. package/svelte-nodegui/website/src/components/SplitView.js +18 -0
  209. package/svelte-nodegui/website/src/components/Talks.js +68 -0
  210. package/svelte-nodegui/website/src/components/Try.js +83 -0
  211. package/svelte-nodegui/website/src/components/common.js +41 -0
  212. package/svelte-nodegui/website/src/components/styles.css +61 -0
  213. package/svelte-nodegui/website/src/css/custom.css +34 -0
  214. package/svelte-nodegui/website/src/pages/index.js +32 -0
  215. package/svelte-nodegui/website/src/pages/styles.module.css +35 -0
  216. package/svelte-nodegui/website/static/CNAME +1 -0
  217. package/svelte-nodegui/website/static/img/box-layout-1.png +0 -0
  218. package/svelte-nodegui/website/static/img/box-layout-2.png +0 -0
  219. package/svelte-nodegui/website/static/img/code-sample.png +0 -0
  220. package/svelte-nodegui/website/static/img/demo.png +0 -0
  221. package/svelte-nodegui/website/static/img/favicon.ico +0 -0
  222. package/svelte-nodegui/website/static/img/flex-layout-1.png +0 -0
  223. package/svelte-nodegui/website/static/img/grid-layout-1.png +0 -0
  224. package/svelte-nodegui/website/static/img/logo-circle.png +0 -0
  225. package/svelte-nodegui/website/static/img/logo.png +0 -0
  226. package/svelte-nodegui/website/static/img/logo.svg +5 -0
  227. package/svelte-nodegui/website/static/img/logox200.png +0 -0
  228. package/svelte-nodegui/website/static/img/undraw_building_websites.svg +1 -0
  229. package/svelte-nodegui/website/static/img/undraw_code_review.svg +1 -0
  230. package/svelte-nodegui/website/static/img/undraw_docusaurus_mountain.svg +170 -0
  231. package/svelte-nodegui/website/static/img/undraw_docusaurus_react.svg +169 -0
  232. package/svelte-nodegui/website/static/img/undraw_docusaurus_tree.svg +1 -0
  233. package/svelte-nodegui/website/static/img/undraw_react.svg +1 -0
  234. package/svelte-nodegui/website/static/img/undraw_website_setup.svg +1 -0
  235. package/svelte-nodegui/website/static/img/undraw_windows.svg +11 -0
  236. package/svelte-nodegui/website/website/sidebars.js +32 -0
  237. package/svelte-nodegui/website/yarn.lock +10533 -0
  238. package/bun.lock +0 -159
  239. package/docs-config/bun.lock +0 -6139
@@ -0,0 +1,208 @@
1
+ ---
2
+ sidebar_label: Styling
3
+ title: Styling
4
+ ---
5
+
6
+ With Svelte NodeGui, you can style a component to your needs. If you are familiar with CSS in the web world you would feel right at home. All components accept the `style` prop for setting inline styles. The style names and values usually match how CSS works on the web.
7
+
8
+ Here's an example:
9
+
10
+ ```html
11
+ <script lang="ts">
12
+ import { onMount } from "svelte";
13
+
14
+ onMount(() => {
15
+ (window as any).win = win; // Prevent garbage collection.
16
+ win.nativeView.show();
17
+ return () => {
18
+ delete (window as any).win;
19
+ };
20
+ });
21
+ </script>
22
+
23
+ <window bind:this={win}>
24
+ <text style="color: green; background-color: white;">
25
+ Hello World
26
+ </text>
27
+ </window>
28
+ ```
29
+
30
+ ## Overview
31
+
32
+ Svelte NodeGui makes use of [Qt's stylesheet](https://doc.qt.io/qt-5/stylesheet-syntax.html) for styling. Qt Style Sheet terminology and syntactic rules are almost identical to those of HTML CSS. Additionally, Svelte NodeGui adds support for layout using flex properties like align-items, justify-content, etc. Flexbox layout support is added using [facebook's yoga library](https://github.com/facebook/yoga).
33
+
34
+ You would write your style properties in a string and pass it to the Svelte NodeGui components either via global styles or inline styles (similar to how it works in the web).
35
+
36
+ ## Global styles
37
+
38
+ Lets take a look at an example:
39
+
40
+ ```html
41
+ <script lang="ts">
42
+ import { onMount } from "svelte";
43
+
44
+ onMount(() => {
45
+ (window as any).win = win; // Prevent garbage collection.
46
+ win.nativeView.show();
47
+ return () => {
48
+ delete (window as any).win;
49
+ };
50
+ });
51
+ </script>
52
+
53
+ <window bind:this={win}>
54
+ <view id="rootView">
55
+ <text id="helloLabel">Hello</text>
56
+ <text id="worldLabel">World</text>
57
+ </view>
58
+ </window>
59
+
60
+ <style>
61
+ #helloLabel {
62
+ color: red;
63
+ padding: 10px;
64
+ }
65
+ #worldLabel {
66
+ color: green;
67
+ padding: 10px;
68
+ }
69
+ #rootView {
70
+ background-color: black;
71
+ height: '100%';
72
+ }
73
+ </style>
74
+ ```
75
+
76
+
77
+ In the case of global stylesheet you can define all your style properties in a stylesheet string and the tell the root view or window to set it as a stylsheet for it and its child components. The only difference here from web is that you can set a stylesheet on a component at any level in the whole tree of components, the stylesheet will affect the component and its children.
78
+
79
+ In the above example, in order to reference a component in a stylesheet we will assign it a `id` using id prop. Think of it as similar to an `id` in the case of web (but in reality it calls setObjectName method in nodegui). Now using the id you could reference the component in the stylesheet and set style properties on them. Do not worry about the layout stuff that is going on here, that will be covered in the next section.
80
+
81
+ Global stylesheet really becomes powerful when you use things like pseudo-selectors (hover, checked, etc). It also has helps in implementing cascaded styles which allow you to style a group of components at once. We will see more about these features below.
82
+
83
+ > More details on all the features and the syntax can be found here: https://doc.qt.io/qt-5/stylesheet-syntax.html
84
+
85
+ ## Inline styles
86
+
87
+ Lets look at this example again:
88
+
89
+ ```html
90
+ <script lang="ts">
91
+ import { onMount } from "svelte";
92
+
93
+ onMount(() => {
94
+ (window as any).win = win; // Prevent garbage collection.
95
+ win.nativeView.show();
96
+ return () => {
97
+ delete (window as any).win;
98
+ };
99
+ });
100
+ </script>
101
+
102
+ <window bind:this={win}>
103
+ <text style="color: green; background-color: white; height: '100%';">Hello World</text>
104
+ </window>
105
+ ```
106
+
107
+ In most cases it would be easier to style the components inline. Svelte NodeGui supports inline styling using `style` prop. Inline styles will only affect the component to which the style is applied to and is often easier to understand and manage. All properties you use in the global stylesheet are available in inline styles as well.
108
+
109
+ ## Selectors
110
+
111
+ NodeGui style sheets support all the selectors defined in CSS2.
112
+ Some examples include:
113
+
114
+ ```css
115
+ * {
116
+ color: blue;
117
+ }
118
+
119
+ QPushButton {
120
+ padding: 10px;
121
+ }
122
+
123
+ #okButton {
124
+ margin: 10px;
125
+ }
126
+
127
+ #mainView > QPushButton {
128
+ margin: 10px;
129
+ }
130
+ ```
131
+
132
+ Note we are using QPushButton here instead of PushButton. This is because `<PushButton />` component internally renders a QPushButton. See PushButton docs for more details.
133
+
134
+ To see a complete list of selectors see here: https://doc.qt.io/qt-5/stylesheet-syntax.html#selector-types
135
+
136
+ ## Pseudo states
137
+
138
+ Like in the web, you can style your component based on its state. An example would be, you might want the color of the button text to be red when its hovered upon. These are possible with pseudo states. Pseudo-states appear at the end of the selector, with a colon (:) in between.
139
+
140
+ ```css
141
+ #okButton:hover {
142
+ color: red;
143
+ }
144
+ ```
145
+
146
+ > More details here : https://doc.qt.io/qt-5/stylesheet-syntax.html#pseudo-states
147
+
148
+ ## Cascading
149
+
150
+ Style sheets can be set on the parent components and on child components. An arbitrary component's effective style sheet is obtained by merging the style sheets set on the component's ancestors (parent, grandparent, etc.).
151
+
152
+ When conflicts arise, the component's own inline style sheet is always preferred to any inherited style sheet, irrespective of the specificity of the conflicting rules. Likewise, the parent component's style sheet is preferred to the grandparent's, etc.
153
+
154
+ The behaviour is similar to what we see on the web.
155
+
156
+ > For more in depth examples see here: https://doc.qt.io/qt-5/stylesheet-syntax.html#cascading
157
+
158
+ ## Properties
159
+
160
+ NodeGui style sheet is a css string.
161
+
162
+ For example:
163
+
164
+ ```typescript
165
+ const textStyle: string = `
166
+ color: 'green';
167
+ padding: 12;
168
+ height: '100%';
169
+ `;
170
+ ```
171
+
172
+ Here if you look carefully, you would notice that there are some differences in the way we write style properties as compared to web.
173
+ The quotes you see around `'green'` and `'100%'` are necessary so that Qt doesnt interpret them as numbers.
174
+ So the rule of thumb is that any integer based property like margin, border, etc can be written without quotes while any string property, it is better to surround them with quotes. PS: Qt does recognise some string based properties without quotes also.
175
+
176
+ ## Supported properties
177
+
178
+ Since we are not running inside a web browser, there are few differences in the properties you could use in NodeGui vs in web.
179
+
180
+ The complete list is detailed here: https://doc.qt.io/qt-5/stylesheet-reference.html#list-of-properties
181
+
182
+ Apart from the properties listed in the link, NodeGui also supports layout properties related to Flex. You can use all flex properties such as align-items, justify-content, flex, etc on all components. [The layout styling will be converted in more detail in the section: Layout.](layout.md)
183
+
184
+ ## Advanced usage (Setting QObject Properties)
185
+
186
+ In Qt, every component has certain properties set on them using something called as [Q_PROPERTY](https://doc.qt.io/qt-5/qobject.html#Q_PROPERTY). There are many q-properties that are defined on each component already. You can also define custom qproperties in the native C++ code yourself too. What does it have to do with styling ? The thing is some of these properties can be altered using qt stylesheet. In Qt's terminology, these properties are called designable properties.
187
+
188
+ For example:
189
+
190
+ ```css
191
+ MyLabel {
192
+ qproperty-alignment: AlignCenter;
193
+ }
194
+ MyGroupBox {
195
+ qproperty-titlecolor: rgb(100, 200, 100);
196
+ }
197
+ QPushButton {
198
+ qproperty-iconsize: 20px 20px;
199
+ }
200
+ ```
201
+
202
+ You can discover these properties by following Qt's documentation or by running a simple google search like "center text in QLabel using stylesheet in Qt". These are advanced properties and in practice will come in use rarely but its good to know.
203
+
204
+ > More details : https://doc.qt.io/qt-5/stylesheet-syntax.html#setting-qobject-properties
205
+
206
+ ---
207
+
208
+ In this section, we mostly covered the paint properties in the Svelte NodeGui stylesheet. The next section would cover on how you can use flex to layout your components with stylesheet.
@@ -0,0 +1,82 @@
1
+ ---
2
+ sidebar_label: Learn the Basics
3
+ title: Learn the Basics
4
+ ---
5
+
6
+ Svelte NodeGui uses native components instead of web based components as building blocks. So to understand the basic structure of a Svelte NodeGui app, you need to be familiar with Javascript or Typescript and Svelte. This tutorial is aimed at everyone who has some web experience with web development.
7
+
8
+ ## Svelte NodeGui development in a nutshell
9
+
10
+ As far as development is concerned, an Svelte NodeGui application is essentially a Node.js application. The starting point is a `package.json` that is identical to that of a Node.js module. A most basic Svelte NodeGui app would have the following
11
+ folder structure:
12
+
13
+ ```text
14
+ your-app/
15
+ ├── package.json
16
+ ├── index.js
17
+ ```
18
+
19
+ <!--
20
+ All APIs and features found in NodeGui are accessible through the `@nodegui/svelte-nodegui` and `@nodegui/nodegui` modules, which can be required like any other Node.js module. Additionally you have access to all Node.js apis and node modules.
21
+
22
+ ```javascript
23
+ require("@nodegui/svelte-nodegui");
24
+ ```
25
+
26
+ The `@nodegui/svelte-nodegui` module exports widgets and features in namespaces. As an example, a window can be created using the `Window` component. A simple `main.js` file might open a window:
27
+
28
+ ```html
29
+ <script lang="ts">
30
+ import { onMount } from "svelte";
31
+
32
+ onMount(() => {
33
+ (window as any).win = win; // Prevent garbage collection.
34
+ win.nativeView.show();
35
+ return () => {
36
+ delete (window as any).win;
37
+ };
38
+ });
39
+ </script>
40
+
41
+ <window bind:this={win}/>
42
+ ```
43
+
44
+ The `index.js` should create windows and handle all the system events your
45
+ application might encounter.
46
+ -->
47
+
48
+ ## What's going on here?
49
+
50
+ Firstly, we are running a Node.js app and not a browser based app. This means we do not have access to any browser APIs. The window you see is actually a native widget created by Qt. Window component is essentially a lightweight javascript wrapper over NodeGui's QMainWindow, which internally is Qt's QMainWindow. Hence every prop you set on Window instance is actually affecting a native window widget. This is very light weight as compared to browser based solutions and hence is more closer to the Operating system.
51
+
52
+ ## Trying out the starter project
53
+
54
+ Clone and run the code by using the
55
+ [`nodegui/svelte-nodegui-starter`][quick-start] repository.
56
+
57
+ **Note**: Running this requires [Git](https://git-scm.com) and [npm](https://www.npmjs.com/).
58
+
59
+ ```sh
60
+ # Clone the repository
61
+ $ git clone https://github.com/nodegui/svelte-nodegui-starter
62
+ # Go into the repository
63
+ $ cd svelte-nodegui-starter
64
+ # Install dependencies
65
+ $ npm install
66
+ # Run the dev server
67
+ $ npm run dev
68
+ # Run the app on a separate terminal tab or window
69
+ $ npm start
70
+ ```
71
+
72
+ [quick-start]: https://github.com/nodegui/svelte-nodegui-starter
73
+
74
+ ## What else other than a basic window?
75
+
76
+ Svelte NodeGui has support for basic components like View (similar to div), CheckBox, PushButton and many more.
77
+ You can take a look at the list of native widgets that Svelte NodeGui currently supports here : [Native widgets in Svelte NodeGui](/docs/api/interfaces/viewprops).
78
+ With time more native components and APIs will be added to Svelte NodeGui. Apart from modules in Svelte NodeGui, you also have access to the entire node modules ecosystem. Thus, any node module that you can use with Node.js, can be used with Svelte NodeGui. This makes it extremely powerful.
79
+
80
+ Fine, I want something more custom and beautiful than just native looking widgets. What do I do?
81
+
82
+ To make things more beautiful, you will have to [learn about styling](styling). Lets take a look at that next.
@@ -0,0 +1,55 @@
1
+ ---
2
+ sidebar_label: Native Node Modules
3
+ title: Using native Node Modules
4
+ ---
5
+
6
+ Native Node modules are supported by Svelte NodeGui, but since Svelte NodeGui is very
7
+ likely to use a different V8 version from the Node binary installed on your
8
+ system, the modules you use will need to be recompiled for Svelte NodeGui's node/v8 version. Otherwise,
9
+ you will get the following class of error when you try to run your app:
10
+
11
+ ```sh
12
+ Error: The module '/path/to/native/module.node'
13
+ was compiled against a different Node.js version using
14
+ NODE_MODULE_VERSION $XYZ. This version of Node.js requires
15
+ NODE_MODULE_VERSION $ABC. Please try re-compiling or re-installing
16
+ the module (for instance, using `npm rebuild` or `npm install`).
17
+ ```
18
+
19
+ ## How to install native modules
20
+
21
+ To compile native Node modules against a build of NodeGui that doesn't
22
+ match a public release, instruct `npm` to use the version of Qode (NodeJs) you have bundled
23
+ with your custom build.
24
+
25
+ ```sh
26
+ npm rebuild --nodedir=/path/to/qode
27
+ ```
28
+
29
+ or
30
+
31
+ ```sh
32
+ qode /path/to/npm rebuild
33
+ ```
34
+
35
+ ## Troubleshooting
36
+
37
+ If you installed a native module and found it was not working, you need to check
38
+ the following things:
39
+
40
+ - When in doubt, rebuild native modules with qode first.
41
+ - Make sure the native module is compatible with the target platform and
42
+ architecture for your NodeGui app.
43
+ - After you upgrade NodeGui, you usually need to rebuild the modules.
44
+
45
+ ## Modules that rely on `node-pre-gyp`
46
+
47
+ The [`node-pre-gyp` tool][node-pre-gyp] provides a way to deploy native Node
48
+ modules with prebuilt binaries, and many popular modules are using it.
49
+
50
+ Usually those modules work fine under NodeGui, but sometimes when NodeGui uses
51
+ a newer version of V8 than Node and/or there are ABI changes, bad things may
52
+ happen. So in general, it is recommended to always build native modules from
53
+ source code.
54
+
55
+ [node-pre-gyp]: https://github.com/mapbox/node-pre-gyp
@@ -0,0 +1,22 @@
1
+ ---
2
+ id: mdx
3
+ title: Powered by MDX
4
+ ---
5
+
6
+ You can write JSX and use React components within your Markdown thanks to [MDX](https://mdxjs.com/).
7
+
8
+ export const Highlight = ({children, color}) => (
9
+ <span
10
+ style={{
11
+ backgroundColor: color,
12
+ borderRadius: '2px',
13
+ color: '#fff',
14
+ padding: '0.2rem',
15
+ }}>
16
+ {children}
17
+ </span>
18
+ );
19
+
20
+ <Highlight color="#25c2a0">Docusaurus green</Highlight> and <Highlight color="#1877F2">Facebook blue</Highlight> are my favorite colors.
21
+
22
+ I can write **Markdown** alongside my _JSX_!
@@ -0,0 +1,21 @@
1
+ const fs = require('fs');
2
+ const path = require('path');
3
+
4
+ async function writeFile(filePath, fileContent) {
5
+ return new Promise((resolve, reject) => {
6
+ fs.writeFile(filePath, fileContent, (err) => (err ? reject(err) : resolve()));
7
+ });
8
+ }
9
+
10
+ async function emptyIndexMd() {
11
+ const src = path.resolve(__dirname, `../../../website/docs/api/index.md`);
12
+ await writeFile(src, '');
13
+ }
14
+
15
+ async function fixDocs() {
16
+ console.log('Fixing Docs...');
17
+ await emptyIndexMd();
18
+ console.log('Docs fixed successfully.');
19
+ }
20
+
21
+ fixDocs().catch(console.error);
@@ -0,0 +1,131 @@
1
+ module.exports = {
2
+ title: "Svelte NodeGUI",
3
+ tagline: "Build performant, native, cross-platform desktop apps with Svelte",
4
+ url: "https://svelte.nodegui.org",
5
+ baseUrl: "/",
6
+ favicon: "img/favicon.ico",
7
+ organizationName: "nodegui", // Usually your GitHub org/user name.
8
+ projectName: "svelte-nodegui", // Usually your repo name.
9
+ onBrokenLinks: "warn",
10
+ onDuplicateRoutes: "warn",
11
+ themeConfig: {
12
+ navbar: {
13
+ title: "Svelte NodeGUI",
14
+ logo: {
15
+ alt: "NodeGui Logo",
16
+ src: "img/logo-circle.png",
17
+ },
18
+ items: [
19
+ { to: "docs/guides/getting-started", label: "Docs", position: "right" },
20
+ {
21
+ to: "docs/api/interfaces/buttonprops",
22
+ label: "API",
23
+ position: "right",
24
+ },
25
+ { to: "blog", label: "Blog", position: "right" },
26
+ {
27
+ href: "https://github.com/nodegui/svelte-nodegui",
28
+ label: "GitHub",
29
+ position: "right",
30
+ },
31
+ ],
32
+ /**
33
+ * Prism doesn't yet support Svelte, so Docusaurus can't highlight it.
34
+ * @see https://github.com/PrismJS/prism/issues/2090
35
+ * There is a community-made support layer, but I don't see how I'd integrate it with Docusaurus.
36
+ * The may technically be a convoluted way by importing "prism-svelte" in .docusaurus/client-modules.js,
37
+ * but life is too short.
38
+ * @see https://github.com/pngwn/prism-svelte
39
+ */
40
+ // prism: {
41
+ // additionalLanguages: ['svelte'],
42
+ // },
43
+ },
44
+ footer: {
45
+ style: "dark",
46
+ links: [
47
+ {
48
+ title: "Docs",
49
+ items: [
50
+ { to: "docs/guides/getting-started", label: "Getting Started" },
51
+ { to: "docs/api/interfaces/buttonprops", label: "API" },
52
+ ],
53
+ },
54
+ {
55
+ title: "Community",
56
+ items: [
57
+ {
58
+ label: "Spectrum",
59
+ href: "https://spectrum.chat/nodegui",
60
+ },
61
+ {
62
+ label: "Twitter",
63
+ to: "https://twitter.com/node_gui",
64
+ },
65
+ {
66
+ label: "Medium",
67
+ to: "https://medium.com/nodegui",
68
+ },
69
+ ],
70
+ },
71
+ {
72
+ title: "More",
73
+ items: [
74
+ {
75
+ label: "Blog",
76
+ to: "blog",
77
+ },
78
+ {
79
+ label: "NodeGui",
80
+ to: "https://nodegui.org",
81
+ },
82
+ // {
83
+ // label: "FAQ",
84
+ // to: "https://nodegui.org/faq",
85
+ // },
86
+ ],
87
+ },
88
+ ],
89
+ copyright: `Copyright © ${new Date().getFullYear()} NodeGui`,
90
+ },
91
+ // googleAnalytics: {
92
+ // trackingID: "TODO",
93
+ // },
94
+ algolia: {
95
+ apiKey: "2d5f0b46c971ffb4947697ce645520b0",
96
+ indexName: "svelte-nodegui",
97
+ /**
98
+ * Optional. I've filled in some values in a comment for future reference.
99
+ */
100
+ algoliaOptions: {
101
+ // facetFilters: [
102
+ // /**
103
+ // * I'm not really sure what these do.
104
+ // * There is also: lvl1, lvl2, lvl3, lvl4, lvl5
105
+ // */
106
+ // "type:content",
107
+ //
108
+ // /**
109
+ // * To my understanding, this is irrelevant for now, because we're not supporting multiple versions
110
+ // * of the docs simultanteously.
111
+ // * There is also: version:current
112
+ // */
113
+ // "version:latest",
114
+ // ],
115
+ },
116
+ },
117
+ },
118
+ presets: [
119
+ [
120
+ "@docusaurus/preset-classic",
121
+ {
122
+ docs: {
123
+ sidebarPath: require.resolve("./sidebars.js"),
124
+ },
125
+ theme: {
126
+ customCss: require.resolve("./src/css/custom.css"),
127
+ },
128
+ },
129
+ ],
130
+ ],
131
+ };
@@ -0,0 +1,33 @@
1
+ {
2
+ "name": "svelte-nodegui",
3
+ "version": "0.0.0",
4
+ "private": true,
5
+ "scripts": {
6
+ "docusaurus": "docusaurus",
7
+ "start": "docusaurus start",
8
+ "build": "docusaurus build",
9
+ "swizzle": "docusaurus swizzle",
10
+ "deploy": "docusaurus deploy"
11
+ },
12
+ "dependencies": {
13
+ "@docusaurus/core": "^2.0.0-alpha.64",
14
+ "@docusaurus/plugin-google-analytics": "^2.0.0-alpha.64",
15
+ "@docusaurus/preset-classic": "^2.0.0-alpha.64",
16
+ "classnames": "^2.2.6",
17
+ "react": "^16.8.4",
18
+ "react-dom": "^16.8.4",
19
+ "styled-components": "^4.4.0"
20
+ },
21
+ "browserslist": {
22
+ "production": [
23
+ ">0.2%",
24
+ "not dead",
25
+ "not op_mini all"
26
+ ],
27
+ "development": [
28
+ "last 1 chrome version",
29
+ "last 1 firefox version",
30
+ "last 1 safari version"
31
+ ]
32
+ }
33
+ }
@@ -0,0 +1,77 @@
1
+ module.exports = {
2
+ api: {
3
+ Components: [
4
+ "api/interfaces/buttonprops",
5
+ "api/interfaces/checkboxprops",
6
+ "api/interfaces/dialprops",
7
+ "api/interfaces/imageprops",
8
+ "api/interfaces/lineeditprops",
9
+ "api/interfaces/plaintexteditprops",
10
+ "api/interfaces/progressbarprops",
11
+ "api/interfaces/radiobuttonprops",
12
+ "api/interfaces/scrollareaprops",
13
+ "api/interfaces/spinboxprops",
14
+ "api/interfaces/textprops",
15
+ "api/interfaces/viewprops",
16
+ "api/interfaces/windowprops",
17
+ ],
18
+ Others: ["api/globals"],
19
+ // Modules: ["api/modules/_react_proxy_"],
20
+ Interfaces: [
21
+ // "api/interfaces/_react_proxy_.reactproxycomponent",
22
+ "api/interfaces/abstractbuttonprops",
23
+ "api/interfaces/actionprops",
24
+ "api/interfaces/animatedimageprops",
25
+ "api/interfaces/boxviewprops",
26
+ "api/interfaces/buttonprops",
27
+ "api/interfaces/checkboxprops",
28
+ "api/interfaces/comboboxprops",
29
+ "api/interfaces/datawithoffset",
30
+ "api/interfaces/dialprops",
31
+ "api/interfaces/gridviewprops",
32
+ "api/interfaces/imageprops",
33
+ "api/interfaces/lineeditprops",
34
+ "api/interfaces/menubarprops",
35
+ "api/interfaces/menuprops",
36
+ "api/interfaces/plaintexteditprops",
37
+ "api/interfaces/progressbarprops",
38
+ "api/interfaces/radiobuttonprops",
39
+ "api/interfaces/scrollareaprops",
40
+ "api/interfaces/sliderprops",
41
+ "api/interfaces/spinboxprops",
42
+ "api/interfaces/systemtrayiconprops",
43
+ "api/interfaces/tabitemprops",
44
+ "api/interfaces/tabprops",
45
+ "api/interfaces/textprops",
46
+ "api/interfaces/viewprops",
47
+ "api/interfaces/windowprops",
48
+ ],
49
+ Classes: [
50
+ "api/classes/rnaction",
51
+ "api/classes/rngridcolumn",
52
+ "api/classes/rngridrow",
53
+ "api/classes/rnmenu",
54
+ "api/classes/rnmenubar",
55
+ "api/classes/renderer",
56
+ ],
57
+ },
58
+ guides: {
59
+ "The Basics": [
60
+ "guides/getting-started",
61
+ "guides/tutorial",
62
+ "guides/styling",
63
+ "guides/layout",
64
+ "guides/handle-events",
65
+ "guides/scroll-view",
66
+ "guides/images",
67
+ "guides/networking",
68
+ "guides/packaging",
69
+ ],
70
+ Guides: [
71
+ "guides/debugging",
72
+ "guides/debugging-in-vscode",
73
+ "guides/using-native-node-modules",
74
+ "guides/custom-nodegui-native-plugin",
75
+ ],
76
+ },
77
+ };
@@ -0,0 +1,42 @@
1
+ import React from "react";
2
+ import { SplitView } from "../components/SplitView";
3
+ import styled from "styled-components";
4
+
5
+ const Image = styled.img`
6
+ max-height: 300px;
7
+ padding-bottom: 40px;
8
+ `;
9
+
10
+ export const CodeExample = () => {
11
+ const ColumnOne = () => {
12
+ return (
13
+ <div>
14
+ <Image src="img/code-sample.png" />
15
+ </div>
16
+ );
17
+ };
18
+ const ColumnTwo = () => {
19
+ return (
20
+ <div>
21
+ <h3>Written in Svelte—rendered with native code by Qt</h3>
22
+ <p>
23
+ Apps can be built completely in JavaScript. This enables native app
24
+ development for whole new teams of developers, and can let existing
25
+ native teams work much faster.
26
+ </p>
27
+
28
+ <p>
29
+ With NodeGui you get flexibility of web and performance of Native
30
+ desktop apps.
31
+ </p>
32
+ </div>
33
+ );
34
+ };
35
+ return (
36
+ <SplitView
37
+ columnOneClass={"text"}
38
+ columnOne={<ColumnTwo />}
39
+ columnTwo={<ColumnOne />}
40
+ />
41
+ );
42
+ };