git0 0.2.9 → 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 +3 -3
  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,111 @@
1
+ // import { registerElement, ElementNode } from "./basicdom";
2
+ // import { QWidget } from "@nodegui/nodegui";
3
+ import { registerElement } from "./nativescript-vue-next/runtime/registry";
4
+ import { RNObject, ObjectProps } from "./svelte/RNObject";
5
+ import StyleElement from "./svelte/StyleElement";
6
+ import HeadElement from "./svelte/HeadElement";
7
+ import type SvelteNodeGUIDocument from "./svelte/SvelteNodeGUIDocument";
8
+ import type { NSVElement } from "./nativescript-vue-next/runtime/nodes";
9
+ import { RNWindow } from "./react-nodegui/src/components/Window/RNWindow";
10
+
11
+ // Dom elements that svelte expects to be able to create or use.
12
+ // or custom additions to make life easier
13
+
14
+ export function registerSvelteElements(): void {
15
+ registerElement<RNObject, ObjectProps>(
16
+ 'document',
17
+ () => new RNObject(),
18
+ {
19
+ nodeOps: {
20
+ insert(child, parent: SvelteNodeGUIDocument, atIndex?: number) {
21
+ if(child instanceof HeadElement){
22
+ if(parent.head){
23
+ if(parent.head !== child){
24
+ console.warn(`document can only have one head!`);
25
+ }
26
+ } else {
27
+ parent.head = child;
28
+ child.updateStyles();
29
+ }
30
+ return "defer";
31
+ }
32
+
33
+ if(child.tagName === "body"){
34
+ if(parent.body){
35
+ if(parent.body !== child){
36
+ console.warn(`document can only have one head!`);
37
+ }
38
+ } else {
39
+ parent.body = child as NSVElement<RNObject>;
40
+ }
41
+ return "defer";
42
+ }
43
+
44
+ return "defer";
45
+ },
46
+ remove(child, parent: SvelteNodeGUIDocument) {
47
+ if(child instanceof HeadElement){
48
+ parent.setStyleSheets("");
49
+ parent.head = null;
50
+ return "defer";
51
+ }
52
+
53
+ if(child.tagName === "body"){
54
+ parent.body = null;
55
+ return "defer";
56
+ }
57
+
58
+ // child.ownerDocument = null;
59
+
60
+ return "defer";
61
+ }
62
+ }
63
+ }
64
+ );
65
+ registerElement<RNObject, ObjectProps>(
66
+ 'head',
67
+ () => new RNObject(),
68
+ {
69
+ nodeOps: {
70
+ insert(child, parent: HeadElement, atIndex?: number) {
71
+ if(child instanceof StyleElement){
72
+ let css: string = child.textContent;
73
+ let id = child.id;
74
+ const style_hash = id.replace('-style', '');
75
+ //style rules are one per line as long as each selector in the rule has the style hash we are all scoped styles and can pass true to addCss
76
+ const all_scoped: boolean = css.split("\n").every(r => r.split(",").every(i => i.indexOf(style_hash) >= 0));
77
+
78
+ // console.log(`[HeadElement] ${child} #${id}; style hash: ${style_hash}; all_scoped: ${all_scoped}; had text: ${css}`);
79
+
80
+ parent.addStyleElement(child);
81
+ }
82
+ return "defer";
83
+ },
84
+ remove(child, parent: HeadElement) {
85
+ // console.log(`[HeadElement] remove(${child}) removing child...`);
86
+
87
+ if(child instanceof StyleElement){
88
+ parent.removeStyleElement(child);
89
+ }
90
+ return "defer";
91
+ },
92
+ }
93
+ }
94
+ );
95
+ registerElement<RNObject, ObjectProps>(
96
+ 'style',
97
+ () => new RNObject()
98
+ );
99
+ registerElement<RNObject, ObjectProps>(
100
+ 'body',
101
+ () => new RNObject(),
102
+ );
103
+ registerElement<RNObject, ObjectProps>(
104
+ 'fragment',
105
+ () => new RNObject(),
106
+ );
107
+ registerElement<RNObject, ObjectProps>(
108
+ 'template',
109
+ () => new RNObject()
110
+ );
111
+ }
@@ -0,0 +1,62 @@
1
+ import { initializeDom, NSVElement } from './dom';
2
+
3
+
4
+ declare global {
5
+ export class SvelteComponent {
6
+ $destroy(): void;
7
+ constructor(options: { target?: NSVElement | Element, props?: any, anchor?: NSVElement | Element, intro?: boolean });
8
+ $set(props: any): void;
9
+ }
10
+ }
11
+
12
+ export function svelteNodeGUI(rootElement: typeof SvelteComponent, data: any): Promise<SvelteComponent> {
13
+ const doc = initializeDom();
14
+
15
+ return new Promise((resolve, reject) => {
16
+
17
+ let elementInstance: SvelteComponent;
18
+
19
+ const buildElement = () => {
20
+ elementInstance = new rootElement({
21
+ target: doc.body,
22
+ props: data || {}
23
+ })
24
+ return (doc.body.firstChild as NSVElement).nativeView;
25
+ }
26
+
27
+ buildElement();
28
+ resolve(elementInstance);
29
+ });
30
+ }
31
+
32
+ // Svelte looks to see if window is undefined in order to determine if it is running on the client or in SSR.
33
+ // window is undefined until initializeDom is called. We will set it to a temporary value here and overwrite it in intializedom.
34
+ (global as any).window = { env: "Svelte NodeGUI" }
35
+
36
+
37
+ export { initializeDom, DomTraceCategory, NSVElement } from "./dom";
38
+ export {
39
+ ImageProps, RNImage,
40
+ AnimatedImageProps, RNAnimatedImage,
41
+ ViewProps, RNView,
42
+ CheckBoxProps, RNCheckBox,
43
+ TextProps, RNText,
44
+ DialProps, RNDial,
45
+ LineEditProps, RNLineEdit,
46
+ WindowProps, RNWindow,
47
+ ProgressBarProps, RNProgressBar,
48
+ ComboBoxProps, RNComboBox,
49
+ ButtonProps, RNButton,
50
+ SpinBoxProps, RNSpinBox,
51
+ RadioButtonProps, RNRadioButton,
52
+ TabProps, RNTab,
53
+ MenuProps, RNMenu,
54
+ MenuBarProps, RNMenuBar,
55
+ PlainTextEditProps, RNPlainTextEdit,
56
+ SliderProps, RNSlider,
57
+ SystemTrayIconProps, RNSystemTrayIcon,
58
+ ActionProps, RNAction,
59
+ BoxViewProps, RNBoxView,
60
+ GridViewProps, RNGridView,
61
+ ScrollAreaProps, RNScrollArea,
62
+ } from "./dom/react-nodegui/src";
@@ -0,0 +1,159 @@
1
+ declare namespace svelteNodeGUI.JSX {
2
+ /* svelte specific */
3
+ interface ElementClass {
4
+ $$prop_def: any;
5
+ }
6
+
7
+ interface ElementAttributesProperty {
8
+ $$prop_def: any; // specify the property name to use
9
+ }
10
+
11
+ /* I'm not sure of the type for Svelte Element, but extending ElementClass just makes the `$$prop_def` attribute become mandatory. */
12
+ // type SvelteElement = ElementClass;
13
+ type SvelteElement = {};
14
+ type SvelteText = string | number;
15
+ type SvelteChild = SvelteElement | SvelteText;
16
+
17
+ interface SvelteNodeArray extends Array<SvelteNode> {}
18
+ type SvelteFragment = {} | SvelteNodeArray;
19
+
20
+ type SvelteNode = SvelteChild | SvelteFragment | boolean | null | undefined;
21
+
22
+ interface SvelteNodeGUIAttributes<
23
+ T extends import("@nodegui/nodegui").Component = import("@nodegui/nodegui").Component
24
+ > extends SvelteElement {
25
+ nodeRole?: string;
26
+ /* Unlike in React, Doesn't seem to be checked..? */
27
+ // children?: SvelteNode;
28
+ }
29
+
30
+ /**
31
+ * Known issues:
32
+ * 1) None of the event handlers are filled in. Consequently, all event handlers provoke edit-time errors.
33
+ * Of interest: `on:clicked` in HTMLX becomes `onclicked` in JSX.
34
+ * Most likely, it follows a rule of `on${Lowercase<T>}` for a given event name.
35
+ *
36
+ * 2) All attributes written in HTMLX are forced to lowercase (both at edit-time and runtime, by different
37
+ * tooling). Thus, `windowTitle="Hi"` becomes `windowtitle="Hi"`.
38
+ *
39
+ * In both cases, the latest stable TypeScript isn't expressive enough to express a remapping of types to lower case.
40
+ * However, once TypeScript 4.1 lands, it should be (provided they can sort out intrinsic types like Lowercase<T>).
41
+ * @see https://github.com/microsoft/TypeScript/pull/40336
42
+ * @see https://github.com/microsoft/TypeScript/pull/40580
43
+ *
44
+ * In any case, a change coming to core would hopefully solve this.
45
+ * @see https://github.com/sveltejs/svelte/pull/5652
46
+ *
47
+ * For now, particularly until Svelte tooling supports TypeScript 4.1, the best we can do to prevent frustration is
48
+ * fall back to any type (which we do with the final type intersection).
49
+ */
50
+ type SvelteNodeGUIProps<
51
+ Props extends {} = {},
52
+ T extends import("@nodegui/nodegui").Component = import("@nodegui/nodegui").Component
53
+ > = SvelteNodeGUIAttributes<T> & Props & { [name: string]: any; };
54
+
55
+ // Add empty IntrinsicAttributes to prevent fallback to the one in the JSX namespace
56
+ // eslint-disable-next-line @typescript-eslint/no-empty-interface
57
+ interface IntrinsicAttributes {
58
+ }
59
+
60
+ interface IntrinsicElements {
61
+ [name: string]: { [name: string]: any };
62
+ image: SvelteNodeGUIProps<
63
+ import("./dom/react-nodegui/src").ImageProps,
64
+ import("./dom/react-nodegui/src").RNImage
65
+ >;
66
+ animatedImage: SvelteNodeGUIProps<
67
+ import("./dom/react-nodegui/src").AnimatedImageProps,
68
+ import("./dom/react-nodegui/src").RNAnimatedImage
69
+ >;
70
+ view: SvelteNodeGUIProps<
71
+ import("./dom/react-nodegui/src").ViewProps<any>,
72
+ import("./dom/react-nodegui/src").RNView
73
+ >;
74
+ checkBox: SvelteNodeGUIProps<
75
+ import("./dom/react-nodegui/src").CheckBoxProps,
76
+ import("./dom/react-nodegui/src").RNCheckBox
77
+ >;
78
+ text: SvelteNodeGUIProps<
79
+ import("./dom/react-nodegui/src").TextProps,
80
+ import("./dom/react-nodegui/src").RNText
81
+ >;
82
+ dial: SvelteNodeGUIProps<
83
+ import("./dom/react-nodegui/src").DialProps,
84
+ import("./dom/react-nodegui/src").RNDial
85
+ >;
86
+ lineEdit: SvelteNodeGUIProps<
87
+ import("./dom/react-nodegui/src").LineEditProps,
88
+ import("./dom/react-nodegui/src").RNLineEdit
89
+ >;
90
+ window: SvelteNodeGUIProps<
91
+ import("./dom/react-nodegui/src").WindowProps,
92
+ import("./dom/react-nodegui/src").RNWindow
93
+ >;
94
+ progressBar: SvelteNodeGUIProps<
95
+ import("./dom/react-nodegui/src").ProgressBarProps,
96
+ import("./dom/react-nodegui/src").RNProgressBar
97
+ >;
98
+ comboBox: SvelteNodeGUIProps<
99
+ import("./dom/react-nodegui/src").ComboBoxProps,
100
+ import("./dom/react-nodegui/src").RNComboBox
101
+ >;
102
+ button: SvelteNodeGUIProps<
103
+ import("./dom/react-nodegui/src").ButtonProps,
104
+ import("./dom/react-nodegui/src").RNButton
105
+ >;
106
+ spinBox: SvelteNodeGUIProps<
107
+ import("./dom/react-nodegui/src").SpinBoxProps,
108
+ import("./dom/react-nodegui/src").RNSpinBox
109
+ >;
110
+ radioButton: SvelteNodeGUIProps<
111
+ import("./dom/react-nodegui/src").RadioButtonProps,
112
+ import("./dom/react-nodegui/src").RNRadioButton
113
+ >;
114
+ tab: SvelteNodeGUIProps<
115
+ import("./dom/react-nodegui/src").TabProps,
116
+ import("./dom/react-nodegui/src").RNTab
117
+ >;
118
+ menu: SvelteNodeGUIProps<
119
+ import("./dom/react-nodegui/src").MenuProps,
120
+ import("./dom/react-nodegui/src").RNMenu
121
+ >;
122
+ menuBar: SvelteNodeGUIProps<
123
+ import("./dom/react-nodegui/src").MenuBarProps,
124
+ import("./dom/react-nodegui/src").RNMenuBar
125
+ >;
126
+ plainTextEdit: SvelteNodeGUIProps<
127
+ import("./dom/react-nodegui/src").PlainTextEditProps,
128
+ import("./dom/react-nodegui/src").RNPlainTextEdit
129
+ >;
130
+ slider: SvelteNodeGUIProps<
131
+ import("./dom/react-nodegui/src").SliderProps,
132
+ import("./dom/react-nodegui/src").RNSlider
133
+ >;
134
+ systemTrayIcon: SvelteNodeGUIProps<
135
+ import("./dom/react-nodegui/src").SystemTrayIconProps,
136
+ import("./dom/react-nodegui/src").RNSystemTrayIcon
137
+ >;
138
+ svg: SvelteNodeGUIProps<
139
+ import("./dom/react-nodegui/src").SvgProps,
140
+ import("./dom/react-nodegui/src").RNSvg
141
+ >;
142
+ action: SvelteNodeGUIProps<
143
+ import("./dom/react-nodegui/src").ActionProps,
144
+ import("./dom/react-nodegui/src").RNAction
145
+ >;
146
+ boxView: SvelteNodeGUIProps<
147
+ import("./dom/react-nodegui/src").BoxViewProps,
148
+ import("./dom/react-nodegui/src").RNBoxView
149
+ >;
150
+ gridView: SvelteNodeGUIProps<
151
+ import("./dom/react-nodegui/src").GridViewProps,
152
+ import("./dom/react-nodegui/src").RNGridView
153
+ >;
154
+ scrollArea: SvelteNodeGUIProps<
155
+ import("./dom/react-nodegui/src").ScrollAreaProps,
156
+ import("./dom/react-nodegui/src").RNScrollArea
157
+ >;
158
+ }
159
+ }
@@ -0,0 +1,112 @@
1
+
2
+ export interface CubicBezier {
3
+ x0: number
4
+ y0: number
5
+ x1: number
6
+ y1: number
7
+ x2: number
8
+ y2: number
9
+ x3: number
10
+ y3: number
11
+ }
12
+
13
+ // turns an intro curve into an outro curve by mirroring and flipping
14
+ // that is a curve that starts slow from 0 then accelerates as it gets to 1
15
+ // will become a curve that starts fast and decelerates as it gets to 1
16
+ // eg an animation that takes 1 second to get to half opacity but only .5 to get to full opacity
17
+ // we could create a reverse animation from full opacity to zero which would only take 0.5 seconds to get to half opacity
18
+ // by reversing the curve used for the fade in.
19
+ export function reverseCurve(curve: CubicBezier): CubicBezier {
20
+ let {
21
+ x0, y0, x1, y1, x2, y2, x3, y3
22
+ } = curve;
23
+
24
+ return {
25
+ x3: x3 - x0, x2: x3 - x1, x1: x3 - x2, x0: x3 - x3,
26
+ y3: y3 - y0, y2: y3 - y1, y1: y3 - y2, y0: y3 - y3
27
+ }
28
+ }
29
+
30
+ //scales a curve so that the start point is at 0,0 and the end point is at 1,1
31
+ export function normalizeCurve(curve: CubicBezier): CubicBezier {
32
+ let {
33
+ x0, y0, x1, y1, x2, y2, x3, y3
34
+ } = curve;
35
+
36
+ //move x0,y0 to origin
37
+ let tx = x0;
38
+ let ty = Math.min(y0, y3);
39
+
40
+ let scale = Math.abs(x3 - x0);
41
+ let scaley = Math.abs(y3 - y0);
42
+ return {
43
+ x0: (x0 - tx) / scale, x1: (x1 - tx) / scale, x2: (x2 - tx) / scale, x3: (x3 - tx) / scale,
44
+ y0: (y0 - ty) / scaley, y1: (y1 - ty) / scaley, y2: (y2 - ty) / scaley, y3: (y3 - ty) / scaley
45
+ }
46
+ }
47
+ // this uses the bezier equation to return the value for x at t (not to be confused with time, in animations time is x, t is more like distance along the curve )
48
+ // x(t)= x0(1−t)^3 + 3*x1*t*(1−t)^2+ 3*x2*t^2*(1−t) + x3*t^3
49
+ function bezierXatT(curve: CubicBezier, t: number): number {
50
+ return curve.x0 * Math.pow(1 - t, 3) + 3 * curve.x1 * t * Math.pow(1 - t, 2) + 3 * curve.x2 * Math.pow(t, 2) * (1 - t) + curve.x3 * Math.pow(t, 3);
51
+ }
52
+
53
+ // Find with t applied to the bezier equation gives us the supplied X
54
+ // the same way chrome does it: iterative bisection!
55
+ function tValueForX(curve: CubicBezier, x: number): number {
56
+ let t0 = 0.0;
57
+ let t1 = 1.0;
58
+ let t2 = x;
59
+ const epsilon = 0.0001
60
+ while (t0 < t1) {
61
+ let x2 = bezierXatT(curve, t2);
62
+ if (Math.abs(x2 - x) < epsilon)
63
+ return t2;
64
+ if (x > x2)
65
+ t0 = t2;
66
+ else
67
+ t1 = t2;
68
+ t2 = (t1 - t0) * 0.5 + t0;
69
+ }
70
+ }
71
+
72
+ // Takes a segment of a the line made by a bezier curve between x values
73
+ // eg, if it represented an animation we could get the curve that represents half the animation (from x=0 to x=0.5)
74
+ export function partialCurveFrom(curve: CubicBezier, xstart: number, xend: number) {
75
+ //Using https://en.wikipedia.org/wiki/De_Casteljau%27s_algorithm
76
+ let t0 = xstart ? tValueForX(curve, xstart) : 0;
77
+ let t1 = xend != 1 ? tValueForX(curve, xend) : 1;
78
+
79
+ let u0 = 1 - t0;
80
+ let u1 = 1 - t1;
81
+
82
+ let r: CubicBezier = {} as CubicBezier;
83
+ let c = curve;
84
+ r.x0 = u0 * u0 * u0 * c.x0 + (t0 * u0 * u0 + u0 * t0 * u0 + u0 * u0 * t0) * c.x1 + (t0 * t0 * u0 + u0 * t0 * t0 + t0 * u0 * t0) * c.x2 + t0 * t0 * t0 * c.x3;
85
+ r.y0 = u0 * u0 * u0 * c.y0 + (t0 * u0 * u0 + u0 * t0 * u0 + u0 * u0 * t0) * c.y1 + (t0 * t0 * u0 + u0 * t0 * t0 + t0 * u0 * t0) * c.y2 + t0 * t0 * t0 * c.y3;
86
+
87
+ r.x1 = u0 * u0 * u1 * c.x0 + (t0 * u0 * u1 + u0 * t0 * u1 + u0 * u0 * t1) * c.x1 + (t0 * t0 * u1 + u0 * t0 * t1 + t0 * u0 * t1) * c.x2 + t0 * t0 * t1 * c.x3;
88
+ r.y1 = u0 * u0 * u1 * c.y0 + (t0 * u0 * u1 + u0 * t0 * u1 + u0 * u0 * t1) * c.y1 + (t0 * t0 * u1 + u0 * t0 * t1 + t0 * u0 * t1) * c.y2 + t0 * t0 * t1 * c.y3;
89
+
90
+ r.x2 = u0 * u1 * u1 * c.x0 + (t0 * u1 * u1 + u0 * t1 * u1 + u0 * u1 * t1) * c.x1 + (t0 * t1 * u1 + u0 * t1 * t1 + t0 * u1 * t1) * c.x2 + t0 * t1 * t1 * c.x3;
91
+ r.y2 = u0 * u1 * u1 * c.y0 + (t0 * u1 * u1 + u0 * t1 * u1 + u0 * u1 * t1) * c.y1 + (t0 * t1 * u1 + u0 * t1 * t1 + t0 * u1 * t1) * c.y2 + t0 * t1 * t1 * c.y3;
92
+
93
+ r.x3 = u1 * u1 * u1 * c.x0 + (t1 * u1 * u1 + u1 * t1 * u1 + u1 * u1 * t1) * c.x1 + (t1 * t1 * u1 + u1 * t1 * t1 + t1 * u1 * t1) * c.x2 + t1 * t1 * t1 * c.x3;
94
+ r.y3 = u1 * u1 * u1 * c.y0 + (t1 * u1 * u1 + u1 * t1 * u1 + u1 * u1 * t1) * c.y1 + (t1 * t1 * u1 + u1 * t1 * t1 + t1 * u1 * t1) * c.y2 + t1 * t1 * t1 * c.y3;
95
+
96
+ return r;
97
+ }
98
+
99
+ export function animation_curve(cpx1: number, cpy1: number, cpx2: number, cpy2: number): CubicBezier {
100
+ return {
101
+ x0: 0, y0: 0,
102
+ x1: cpx1, y1: cpy1,
103
+ x2: cpx2, y2: cpy2,
104
+ x3: 1, y3: 1
105
+ }
106
+ }
107
+
108
+ export let ease_in = animation_curve(0.42, 0, 1, 1);
109
+ export let ease_out = animation_curve(0, 0, 0.58, 1);
110
+ export let ease_in_out = animation_curve(0.42, 0, 0.58, 1);
111
+ export let ease = animation_curve(0.25, 0.1, 0.25, 1);
112
+ export let linear = animation_curve(0.5, 0.5, 0.5, 0.5);
@@ -0,0 +1,227 @@
1
+ // import { CubicBezierAnimationCurve, Pair } from "@nativescript/core/ui/animation";
2
+ // import { AnimationCurve } from "@nativescript/core/ui/enums";
3
+ // import { Animation, AnimationDefinition, Color, View } from "@nativescript/core";
4
+
5
+ import { ease_in, ease_out, ease, linear, ease_in_out, animation_curve, normalizeCurve, partialCurveFrom, reverseCurve, CubicBezier } from "./bezier"
6
+ // import * as easings from './easing'
7
+ import { NSVElement } from "../dom";
8
+ import { warn } from "../dom/shared/Logger";
9
+ import { NodeWidget, QWidgetSignals } from "@nodegui/nodegui";
10
+ import type { NativeView } from "../dom/nativescript-vue-next/runtime/nodes";
11
+
12
+
13
+ enum AnimationDirection { Unknown, In, Out }
14
+
15
+
16
+ export interface NativeAnimationDefinition {
17
+ // opacity?: number;
18
+ // backgroundColor?: Color;
19
+ // translate?: Pair;
20
+ // scale?: Pair;
21
+ // rotate?: number;
22
+ }
23
+
24
+
25
+ export function asSvelteTransition<T extends NativeView = NativeView>(node: NSVElement<T>, delay: number = 0, duration: number = 300, curve: string, nativeAnimationProps: (t: number) => NativeAnimationDefinition) {
26
+
27
+ let svelteAnim: any = {
28
+ delay: delay,
29
+ duration: duration,
30
+ }
31
+
32
+ let svelteCurve: CubicBezier;
33
+
34
+ // if (typeof curve == "string") {
35
+ // switch (curve) {
36
+ // case AnimationCurve.ease: svelteCurve = ease; break;
37
+ // case AnimationCurve.easeIn: svelteCurve = ease_in; break;
38
+ // case AnimationCurve.easeOut: svelteCurve = ease_out; break;
39
+ // case AnimationCurve.easeInOut: svelteCurve = ease_in_out; break;
40
+ // case AnimationCurve.linear: svelteCurve = linear; break;
41
+ // default:
42
+ // console.warn("Unsupported nativescript animation name, reverting to linear")
43
+ // svelteCurve = linear;
44
+ // }
45
+ // }
46
+
47
+ warn("Stubbing animation as linear")
48
+ svelteCurve = linear;
49
+
50
+ // if (curve instanceof CubicBezierAnimationCurve) {
51
+ // //convert to our bezier format
52
+ // svelteCurve = animation_curve(curve.x1, curve.y1, curve.x2, curve.y2);
53
+ // }
54
+
55
+ //default to linear
56
+ if (!curve) {
57
+ svelteCurve = linear
58
+ }
59
+
60
+ let direction = AnimationDirection.Unknown
61
+ let animation: Animation = null;
62
+ let last_t = -1;
63
+
64
+ const cancelNativeAnimation = () => {
65
+ // if (animation && animation.isPlaying) {
66
+ // // console.log("cancelling animation on ", node);
67
+ // let oldanimation = animation;
68
+ // animation = null;
69
+ // oldanimation.cancel();
70
+ // }
71
+ // animation = null;
72
+ }
73
+
74
+ //Tick is our hook into sveltes transition system. We want to detect a forward or backward animation,
75
+ //determine the end value, and do a single native animation for the entire duration.
76
+ //the spanner in the works is that there is a transistion type (in_out) that can stop mid animation and play in reverse
77
+ //we need to do some math to generate a curve that can apply to the shortened time that mirrors the intro that has already played.
78
+
79
+
80
+ // we note the following svelte behaviour:
81
+ // "in" animations always get an explicit tick(0, 1) even before any delay.
82
+ // "out" animations have no such quality, therefore we can expect that if we have not been initialized, and get a t=0 we are an Intro
83
+
84
+ svelteAnim.tick = (t: number) => {
85
+
86
+ // //when you cancel an animation, it appears to set the values back to the start. we use this to reapply them at the given time.
87
+ // function applyAnimAtTime(time: number) {
88
+ // let animDef = nativeAnimationProps(time);
89
+ // if (typeof animDef.opacity !== 'undefined') node.nativeView.opacity = animDef.opacity;
90
+ // if (typeof animDef.backgroundColor != 'undefined') node.nativeView.backgroundColor = animDef.backgroundColor;
91
+ // if (typeof animDef.rotate != 'undefined') node.nativeView.rotate = animDef.rotate;
92
+ // if (typeof animDef.scale != 'undefined') {
93
+ // node.nativeView.scaleX = animDef.scale.x;
94
+ // node.nativeView.scaleY = animDef.scale.y;
95
+ // }
96
+ // if (typeof animDef.translate != 'undefined') {
97
+ // node.nativeView.translateX = animDef.translate.x;
98
+ // node.nativeView.translateY = animDef.translate.y;
99
+ // }
100
+ // }
101
+
102
+ // //our first frame! are we an in or out
103
+ // if (direction == AnimationDirection.Unknown) {
104
+ // //intro: do an initialize
105
+ // if (t === 0) {
106
+ // applyAnimAtTime(0);
107
+ // direction = AnimationDirection.In
108
+ // last_t = 0;
109
+ // // console.log("forward animation detected!", node);
110
+ // //don't start our full animation yet since this is just the init frame, and there will be a delay. so wait for next frame
111
+ // return;
112
+ // } else {
113
+ // //we must be an outro since all intros get a t==0
114
+ // // console.log("reverse animation detected!", node);
115
+ // direction = AnimationDirection.Out
116
+ // last_t = t;
117
+ // }
118
+ // }
119
+
120
+ // //have we changed direction?
121
+ // if (direction == AnimationDirection.In && last_t > t) {
122
+ // // console.log("animation changed direction (In -> Out)", t, node);
123
+ // direction = AnimationDirection.Out
124
+ // cancelNativeAnimation();
125
+ // applyAnimAtTime(t);
126
+ // }
127
+ // if (direction == AnimationDirection.Out && last_t < t) {
128
+ // // console.log("animation changed direction (Out -> In)", t, node);
129
+ // direction = AnimationDirection.In
130
+ // cancelNativeAnimation();
131
+ // applyAnimAtTime(t);
132
+ // }
133
+ // last_t = t;
134
+
135
+ // if (!animation) {
136
+ // //create a new animation that will cover us from now to either t=duration or t=0
137
+ // let target_t = (direction == AnimationDirection.In) ? 1 : 0;
138
+ // let animProps = nativeAnimationProps(target_t)
139
+ // let nsAnimation: AnimationDefinition = { ...animProps }
140
+ // nsAnimation.delay = 0;
141
+ // if (direction == AnimationDirection.Out) {
142
+ // //we need to play in reverse, and we might not be playing the whole thing
143
+ // let forwardCurve = t == 1 ? svelteCurve : partialCurveFrom(svelteCurve, 0, t)
144
+ // let finalCurve = normalizeCurve(reverseCurve(forwardCurve));
145
+ // nsAnimation.curve = AnimationCurve.cubicBezier(finalCurve.x1, finalCurve.y1, finalCurve.x2, finalCurve.y2);
146
+ // nsAnimation.duration = t * duration;
147
+ // } else {
148
+ // //we might be starting from halfway (intro->outro-intro again)
149
+ // let forwardCurve = t == 0 ? svelteCurve : partialCurveFrom(svelteCurve, t, 1)
150
+ // let finalCurve = normalizeCurve(forwardCurve);
151
+ // nsAnimation.curve = AnimationCurve.cubicBezier(finalCurve.x1, finalCurve.y1, finalCurve.x2, finalCurve.y2);
152
+ // nsAnimation.duration = (1 - t) * duration;
153
+ // }
154
+ // //console.log("animation created", t, (direction == AnimationDirection.In) ? "Intro" : "Outro", nsAnimation, node);
155
+ // // kick it off
156
+ // animation = node.nativeView.createAnimation(nsAnimation);
157
+ // animation.play();
158
+ // }
159
+ }
160
+
161
+ return svelteAnim;
162
+ }
163
+
164
+ /* ported from svelte transitions */
165
+
166
+ export function fade<T extends NativeView = NativeView>(node: NSVElement<T>, {
167
+ delay = 0,
168
+ duration = 400
169
+ }) {
170
+ const o = (node.nativeView as any).opacity;
171
+ return asSvelteTransition(node, delay, duration, "linear",
172
+ (t) => ({
173
+ opacity: 1
174
+ })
175
+ );
176
+ }
177
+
178
+ export function fly<T extends NativeView = NativeView>(node: NSVElement<T>, {
179
+ delay = 0,
180
+ duration = 400,
181
+ easing = "linear",
182
+ x = 0,
183
+ y = 0
184
+ }) {
185
+ // const opacity = node.nativeView.opacity;
186
+ // const translateX = node.nativeView.translateX;
187
+ // const translateY = node.nativeView.translateY;
188
+
189
+ return asSvelteTransition(node, delay, duration, easing,
190
+ (t) => ({
191
+ opacity: 1,
192
+ translate: {
193
+ x: 0,
194
+ y: 0
195
+ }
196
+ })
197
+ );
198
+ }
199
+
200
+ export function slide<T extends NativeView = NativeView>(node: NSVElement<T>, {
201
+ delay = 0,
202
+ duration = 400,
203
+ easing = "linear"
204
+ }) {
205
+
206
+ // const height = node.nativeView.effectiveHeight;
207
+ // const scaleX = node.nativeView.scaleX;
208
+ // const scaleY = node.nativeView.scaleY;
209
+ // const translateX = node.nativeView.translateX;
210
+ // const translateY = node.nativeView.translateY;
211
+
212
+ return asSvelteTransition(node, delay, duration, easing,
213
+ t => ({
214
+ scale: {
215
+ x: 1,
216
+ y: 1
217
+ },
218
+ translate: {
219
+ x: 0,
220
+ y: 0
221
+ }
222
+ })
223
+ );
224
+ }
225
+
226
+
227
+ // export { easings }