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.
- package/TypeScript-React-Starter/LICENSE +21 -0
- package/TypeScript-React-Starter/README-CRA.md +1281 -0
- package/TypeScript-React-Starter/README.md +810 -0
- package/TypeScript-React-Starter/package.json +28 -0
- package/TypeScript-React-Starter/public/favicon.ico +0 -0
- package/TypeScript-React-Starter/public/index.html +31 -0
- package/TypeScript-React-Starter/src/App.css +24 -0
- package/TypeScript-React-Starter/src/App.test.tsx +8 -0
- package/TypeScript-React-Starter/src/App.tsx +23 -0
- package/TypeScript-React-Starter/src/actions/index.tsx +24 -0
- package/TypeScript-React-Starter/src/components/Hello.css +13 -0
- package/TypeScript-React-Starter/src/components/Hello.test.tsx +30 -0
- package/TypeScript-React-Starter/src/components/Hello.tsx +35 -0
- package/TypeScript-React-Starter/src/constants/index.tsx +6 -0
- package/TypeScript-React-Starter/src/containers/Hello.tsx +20 -0
- package/TypeScript-React-Starter/src/index.css +5 -0
- package/TypeScript-React-Starter/src/index.tsx +22 -0
- package/TypeScript-React-Starter/src/logo.svg +7 -0
- package/TypeScript-React-Starter/src/reducers/index.tsx +15 -0
- package/TypeScript-React-Starter/src/types/index.tsx +5 -0
- package/TypeScript-React-Starter/tsconfig.json +29 -0
- package/TypeScript-React-Starter/tslint.json +11 -0
- package/TypeScript-React-Starter/yarn.lock +4785 -0
- package/package.json +2 -2
- package/src/github-api.js +1 -0
- package/svelte-nodegui/.all-contributorsrc +60 -0
- package/svelte-nodegui/.vscode/launch.json +29 -0
- package/svelte-nodegui/CHANGELOG.md +153 -0
- package/svelte-nodegui/LICENSE +22 -0
- package/svelte-nodegui/README.md +151 -0
- package/svelte-nodegui/demo/.editorconfig +15 -0
- package/svelte-nodegui/demo/.vscode/extensions.json +3 -0
- package/svelte-nodegui/demo/livereload.js +29 -0
- package/svelte-nodegui/demo/package-lock.json +3514 -0
- package/svelte-nodegui/demo/package.json +35 -0
- package/svelte-nodegui/demo/src/App.svelte +29 -0
- package/svelte-nodegui/demo/src/app.ts +31 -0
- package/svelte-nodegui/demo/tsconfig.json +40 -0
- package/svelte-nodegui/demo/webpack.config.js +110 -0
- package/svelte-nodegui/extras/assets/kitchen.png +0 -0
- package/svelte-nodegui/extras/assets/nodegui.png +0 -0
- package/svelte-nodegui/extras/assets/nodegui_white.png +0 -0
- package/svelte-nodegui/extras/assets/start_icon.png +0 -0
- package/svelte-nodegui/extras/legal/logo/thanks.md +13 -0
- package/svelte-nodegui/extras/legal/yode/LICENSE +21 -0
- package/svelte-nodegui/extras/legal/yoga/LICENSE +0 -0
- package/svelte-nodegui/extras/logo/nodegui-circle.png +0 -0
- package/svelte-nodegui/extras/logo/nodegui.png +0 -0
- package/svelte-nodegui/extras/logo/nodegui.svg +4 -0
- package/svelte-nodegui/nativescript-svelte-todo.gif +0 -0
- package/svelte-nodegui/package-lock.json +1749 -0
- package/svelte-nodegui/package.json +44 -0
- package/svelte-nodegui/repl-workers/bundler/commonjs.js +58 -0
- package/svelte-nodegui/repl-workers/bundler/index.js +353 -0
- package/svelte-nodegui/repl-workers/package-lock.json +484 -0
- package/svelte-nodegui/repl-workers/package.json +21 -0
- package/svelte-nodegui/repl-workers/rollup.config.js +21 -0
- package/svelte-nodegui/rollup.config.js +81 -0
- package/svelte-nodegui/scripts/create-pkg.js +42 -0
- package/svelte-nodegui/src/components/AsComponent.svelte +16 -0
- package/svelte-nodegui/src/components/SlotComponent.svelte +4 -0
- package/svelte-nodegui/src/components/Template.svelte +10 -0
- package/svelte-nodegui/src/components/Template.svelte.d.ts +6 -0
- package/svelte-nodegui/src/components/index.ts +2 -0
- package/svelte-nodegui/src/dom/index.ts +132 -0
- package/svelte-nodegui/src/dom/nativescript-vue-next/LICENCE +21 -0
- package/svelte-nodegui/src/dom/nativescript-vue-next/index.ts +19 -0
- package/svelte-nodegui/src/dom/nativescript-vue-next/runtime/index.ts +21 -0
- package/svelte-nodegui/src/dom/nativescript-vue-next/runtime/nodes.ts +890 -0
- package/svelte-nodegui/src/dom/nativescript-vue-next/runtime/registry.ts +262 -0
- package/svelte-nodegui/src/dom/nativescript-vue-next/runtime/runtimeHelpers.ts +20 -0
- package/svelte-nodegui/src/dom/react-nodegui/LICENSE +21 -0
- package/svelte-nodegui/src/dom/react-nodegui/src/components/AbstractComponents/RNAbstractButton.ts +67 -0
- package/svelte-nodegui/src/dom/react-nodegui/src/components/Action/RNAction.ts +146 -0
- package/svelte-nodegui/src/dom/react-nodegui/src/components/Action/index.ts +37 -0
- package/svelte-nodegui/src/dom/react-nodegui/src/components/AnimatedImage/RNAnimatedImage.ts +76 -0
- package/svelte-nodegui/src/dom/react-nodegui/src/components/AnimatedImage/index.ts +45 -0
- package/svelte-nodegui/src/dom/react-nodegui/src/components/BoxView/RNBoxView.ts +99 -0
- package/svelte-nodegui/src/dom/react-nodegui/src/components/BoxView/index.ts +49 -0
- package/svelte-nodegui/src/dom/react-nodegui/src/components/Button/RNButton.ts +71 -0
- package/svelte-nodegui/src/dom/react-nodegui/src/components/Button/index.ts +49 -0
- package/svelte-nodegui/src/dom/react-nodegui/src/components/CheckBox/RNCheckBox.ts +71 -0
- package/svelte-nodegui/src/dom/react-nodegui/src/components/CheckBox/index.ts +50 -0
- package/svelte-nodegui/src/dom/react-nodegui/src/components/ComboBox/RNComboBox.ts +118 -0
- package/svelte-nodegui/src/dom/react-nodegui/src/components/ComboBox/index.ts +50 -0
- package/svelte-nodegui/src/dom/react-nodegui/src/components/Dial/RNDial.ts +69 -0
- package/svelte-nodegui/src/dom/react-nodegui/src/components/Dial/index.ts +41 -0
- package/svelte-nodegui/src/dom/react-nodegui/src/components/GridView/GridColumn/RNGridColumn.ts +95 -0
- package/svelte-nodegui/src/dom/react-nodegui/src/components/GridView/GridColumn/index.ts +49 -0
- package/svelte-nodegui/src/dom/react-nodegui/src/components/GridView/GridRow/RNGridRow.ts +141 -0
- package/svelte-nodegui/src/dom/react-nodegui/src/components/GridView/GridRow/index.ts +47 -0
- package/svelte-nodegui/src/dom/react-nodegui/src/components/GridView/RNGridView.ts +185 -0
- package/svelte-nodegui/src/dom/react-nodegui/src/components/GridView/index.ts +51 -0
- package/svelte-nodegui/src/dom/react-nodegui/src/components/GridView/utils.ts +59 -0
- package/svelte-nodegui/src/dom/react-nodegui/src/components/Image/RNImage.ts +135 -0
- package/svelte-nodegui/src/dom/react-nodegui/src/components/Image/index.ts +46 -0
- package/svelte-nodegui/src/dom/react-nodegui/src/components/LineEdit/RNLineEdit.ts +82 -0
- package/svelte-nodegui/src/dom/react-nodegui/src/components/LineEdit/index.ts +41 -0
- package/svelte-nodegui/src/dom/react-nodegui/src/components/Menu/RNMenu.ts +49 -0
- package/svelte-nodegui/src/dom/react-nodegui/src/components/Menu/index.ts +44 -0
- package/svelte-nodegui/src/dom/react-nodegui/src/components/MenuBar/RNMenuBar.ts +51 -0
- package/svelte-nodegui/src/dom/react-nodegui/src/components/MenuBar/index.ts +42 -0
- package/svelte-nodegui/src/dom/react-nodegui/src/components/PlainTextEdit/RNPlainTextEdit.ts +82 -0
- package/svelte-nodegui/src/dom/react-nodegui/src/components/PlainTextEdit/index.ts +44 -0
- package/svelte-nodegui/src/dom/react-nodegui/src/components/ProgressBar/RNProgressBar.ts +78 -0
- package/svelte-nodegui/src/dom/react-nodegui/src/components/ProgressBar/index.ts +43 -0
- package/svelte-nodegui/src/dom/react-nodegui/src/components/RadioButton/RNRadioButton.ts +50 -0
- package/svelte-nodegui/src/dom/react-nodegui/src/components/RadioButton/index.ts +43 -0
- package/svelte-nodegui/src/dom/react-nodegui/src/components/ScrollArea/RNScrollArea.ts +51 -0
- package/svelte-nodegui/src/dom/react-nodegui/src/components/ScrollArea/index.ts +44 -0
- package/svelte-nodegui/src/dom/react-nodegui/src/components/Slider/RNSlider.ts +97 -0
- package/svelte-nodegui/src/dom/react-nodegui/src/components/Slider/index.ts +46 -0
- package/svelte-nodegui/src/dom/react-nodegui/src/components/SpinBox/RNSpinBox.ts +88 -0
- package/svelte-nodegui/src/dom/react-nodegui/src/components/SpinBox/index.ts +49 -0
- package/svelte-nodegui/src/dom/react-nodegui/src/components/Svg/RNSvg.ts +67 -0
- package/svelte-nodegui/src/dom/react-nodegui/src/components/Svg/index.ts +43 -0
- package/svelte-nodegui/src/dom/react-nodegui/src/components/SystemTrayIcon/RNSystemTrayIcon.ts +141 -0
- package/svelte-nodegui/src/dom/react-nodegui/src/components/SystemTrayIcon/index.ts +43 -0
- package/svelte-nodegui/src/dom/react-nodegui/src/components/Tab/RNTab.ts +69 -0
- package/svelte-nodegui/src/dom/react-nodegui/src/components/Tab/index.ts +48 -0
- package/svelte-nodegui/src/dom/react-nodegui/src/components/TabItem/RNTabItem.ts +72 -0
- package/svelte-nodegui/src/dom/react-nodegui/src/components/TabItem/index.ts +40 -0
- package/svelte-nodegui/src/dom/react-nodegui/src/components/Text/RNText.ts +65 -0
- package/svelte-nodegui/src/dom/react-nodegui/src/components/Text/index.ts +49 -0
- package/svelte-nodegui/src/dom/react-nodegui/src/components/View/RNView.ts +306 -0
- package/svelte-nodegui/src/dom/react-nodegui/src/components/View/index.ts +44 -0
- package/svelte-nodegui/src/dom/react-nodegui/src/components/Window/RNWindow.ts +66 -0
- package/svelte-nodegui/src/dom/react-nodegui/src/components/Window/index.ts +50 -0
- package/svelte-nodegui/src/dom/react-nodegui/src/components/config.ts +95 -0
- package/svelte-nodegui/src/dom/react-nodegui/src/index.ts +52 -0
- package/svelte-nodegui/src/dom/react-nodegui/src/reconciler/index.ts +226 -0
- package/svelte-nodegui/src/dom/react-nodegui/src/utils/decoupleFromReact.ts +2 -0
- package/svelte-nodegui/src/dom/react-nodegui/src/utils/helpers.ts +14 -0
- package/svelte-nodegui/src/dom/shared/Logger.ts +16 -0
- package/svelte-nodegui/src/dom/shared/index.ts +1 -0
- package/svelte-nodegui/src/dom/svelte/HeadElement.ts +41 -0
- package/svelte-nodegui/src/dom/svelte/RNObject.ts +95 -0
- package/svelte-nodegui/src/dom/svelte/StyleElement.ts +92 -0
- package/svelte-nodegui/src/dom/svelte/SvelteNodeGUIDocument.ts +124 -0
- package/svelte-nodegui/src/dom/svelte/TemplateElement.ts +16 -0
- package/svelte-nodegui/src/dom/svelte-elements.ts +111 -0
- package/svelte-nodegui/src/index.ts +62 -0
- package/svelte-nodegui/src/svelte-nodegui.ts +159 -0
- package/svelte-nodegui/src/transitions/bezier.ts +112 -0
- package/svelte-nodegui/src/transitions/index.ts +227 -0
- package/svelte-nodegui/tsconfig.json +19 -0
- package/svelte-nodegui/website/README.md +33 -0
- package/svelte-nodegui/website/blog/2019-05-30-welcome.md +12 -0
- package/svelte-nodegui/website/docs/api/classes/renderer.md +49 -0
- package/svelte-nodegui/website/docs/api/classes/rnaction.md +608 -0
- package/svelte-nodegui/website/docs/api/classes/rngridcolumn.md +232 -0
- package/svelte-nodegui/website/docs/api/classes/rngridrow.md +247 -0
- package/svelte-nodegui/website/docs/api/classes/rnmenu.md +1337 -0
- package/svelte-nodegui/website/docs/api/classes/rnmenubar.md +1341 -0
- package/svelte-nodegui/website/docs/api/globals.md +832 -0
- package/svelte-nodegui/website/docs/api/index.md +0 -0
- package/svelte-nodegui/website/docs/api/interfaces/_react_proxy_.reactproxycomponent.md +38 -0
- package/svelte-nodegui/website/docs/api/interfaces/abstractbuttonprops.md +306 -0
- package/svelte-nodegui/website/docs/api/interfaces/actionprops.md +115 -0
- package/svelte-nodegui/website/docs/api/interfaces/animatedimageprops.md +297 -0
- package/svelte-nodegui/website/docs/api/interfaces/boxviewprops.md +245 -0
- package/svelte-nodegui/website/docs/api/interfaces/buttonprops.md +313 -0
- package/svelte-nodegui/website/docs/api/interfaces/checkboxprops.md +313 -0
- package/svelte-nodegui/website/docs/api/interfaces/comboboxprops.md +343 -0
- package/svelte-nodegui/website/docs/api/interfaces/datawithoffset.md +32 -0
- package/svelte-nodegui/website/docs/api/interfaces/dialprops.md +259 -0
- package/svelte-nodegui/website/docs/api/interfaces/gridviewprops.md +273 -0
- package/svelte-nodegui/website/docs/api/interfaces/imageprops.md +311 -0
- package/svelte-nodegui/website/docs/api/interfaces/lineeditprops.md +266 -0
- package/svelte-nodegui/website/docs/api/interfaces/menubarprops.md +245 -0
- package/svelte-nodegui/website/docs/api/interfaces/menuprops.md +245 -0
- package/svelte-nodegui/website/docs/api/interfaces/plaintexteditprops.md +259 -0
- package/svelte-nodegui/website/docs/api/interfaces/progressbarprops.md +266 -0
- package/svelte-nodegui/website/docs/api/interfaces/radiobuttonprops.md +282 -0
- package/svelte-nodegui/website/docs/api/interfaces/scrollareaprops.md +245 -0
- package/svelte-nodegui/website/docs/api/interfaces/sliderprops.md +329 -0
- package/svelte-nodegui/website/docs/api/interfaces/spinboxprops.md +273 -0
- package/svelte-nodegui/website/docs/api/interfaces/systemtrayiconprops.md +97 -0
- package/svelte-nodegui/website/docs/api/interfaces/tabitemprops.md +28 -0
- package/svelte-nodegui/website/docs/api/interfaces/tabprops.md +245 -0
- package/svelte-nodegui/website/docs/api/interfaces/textprops.md +277 -0
- package/svelte-nodegui/website/docs/api/interfaces/viewprops.md +261 -0
- package/svelte-nodegui/website/docs/api/interfaces/windowprops.md +245 -0
- package/svelte-nodegui/website/docs/api/modules/_react_proxy_.md +29 -0
- package/svelte-nodegui/website/docs/doc1.md +162 -0
- package/svelte-nodegui/website/docs/guides/custom-nodegui-native-plugin.md +6 -0
- package/svelte-nodegui/website/docs/guides/debugging-in-vscode.md +39 -0
- package/svelte-nodegui/website/docs/guides/debugging.md +59 -0
- package/svelte-nodegui/website/docs/guides/getting-started.md +141 -0
- package/svelte-nodegui/website/docs/guides/handle-events.md +188 -0
- package/svelte-nodegui/website/docs/guides/images.md +62 -0
- package/svelte-nodegui/website/docs/guides/layout.md +281 -0
- package/svelte-nodegui/website/docs/guides/networking.md +31 -0
- package/svelte-nodegui/website/docs/guides/packaging.md +32 -0
- package/svelte-nodegui/website/docs/guides/scroll-view.md +69 -0
- package/svelte-nodegui/website/docs/guides/styling.md +208 -0
- package/svelte-nodegui/website/docs/guides/tutorial.md +82 -0
- package/svelte-nodegui/website/docs/guides/using-native-node-modules.md +55 -0
- package/svelte-nodegui/website/docs/mdx.md +22 -0
- package/svelte-nodegui/website/docs/scripts/fixdocs.js +21 -0
- package/svelte-nodegui/website/docusaurus.config.js +131 -0
- package/svelte-nodegui/website/package.json +33 -0
- package/svelte-nodegui/website/sidebars.js +77 -0
- package/svelte-nodegui/website/src/components/CodeExample.js +42 -0
- package/svelte-nodegui/website/src/components/CreateNativeApps.js +46 -0
- package/svelte-nodegui/website/src/components/Features.js +62 -0
- package/svelte-nodegui/website/src/components/Hero.js +85 -0
- package/svelte-nodegui/website/src/components/SplitView.js +18 -0
- package/svelte-nodegui/website/src/components/Talks.js +68 -0
- package/svelte-nodegui/website/src/components/Try.js +83 -0
- package/svelte-nodegui/website/src/components/common.js +41 -0
- package/svelte-nodegui/website/src/components/styles.css +61 -0
- package/svelte-nodegui/website/src/css/custom.css +34 -0
- package/svelte-nodegui/website/src/pages/index.js +32 -0
- package/svelte-nodegui/website/src/pages/styles.module.css +35 -0
- package/svelte-nodegui/website/static/CNAME +1 -0
- package/svelte-nodegui/website/static/img/box-layout-1.png +0 -0
- package/svelte-nodegui/website/static/img/box-layout-2.png +0 -0
- package/svelte-nodegui/website/static/img/code-sample.png +0 -0
- package/svelte-nodegui/website/static/img/demo.png +0 -0
- package/svelte-nodegui/website/static/img/favicon.ico +0 -0
- package/svelte-nodegui/website/static/img/flex-layout-1.png +0 -0
- package/svelte-nodegui/website/static/img/grid-layout-1.png +0 -0
- package/svelte-nodegui/website/static/img/logo-circle.png +0 -0
- package/svelte-nodegui/website/static/img/logo.png +0 -0
- package/svelte-nodegui/website/static/img/logo.svg +5 -0
- package/svelte-nodegui/website/static/img/logox200.png +0 -0
- package/svelte-nodegui/website/static/img/undraw_building_websites.svg +1 -0
- package/svelte-nodegui/website/static/img/undraw_code_review.svg +1 -0
- package/svelte-nodegui/website/static/img/undraw_docusaurus_mountain.svg +170 -0
- package/svelte-nodegui/website/static/img/undraw_docusaurus_react.svg +169 -0
- package/svelte-nodegui/website/static/img/undraw_docusaurus_tree.svg +1 -0
- package/svelte-nodegui/website/static/img/undraw_react.svg +1 -0
- package/svelte-nodegui/website/static/img/undraw_website_setup.svg +1 -0
- package/svelte-nodegui/website/static/img/undraw_windows.svg +11 -0
- package/svelte-nodegui/website/website/sidebars.js +32 -0
- package/svelte-nodegui/website/yarn.lock +10533 -0
- package/bun.lock +0 -159
- package/docs-config/bun.lock +0 -6139
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import {
|
|
2
|
+
QLabel,
|
|
3
|
+
QPixmap,
|
|
4
|
+
AspectRatioMode,
|
|
5
|
+
NodeWidget,
|
|
6
|
+
QSize,
|
|
7
|
+
TransformationMode,
|
|
8
|
+
} from "@nodegui/nodegui";
|
|
9
|
+
import { TextProps, setTextProps } from "../Text/RNText";
|
|
10
|
+
import { RNWidget } from "../config";
|
|
11
|
+
import { throwUnsupported, isValidUrl } from "../../utils/helpers";
|
|
12
|
+
import phin from "phin";
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* The Image component provides the ability to render images. It is based on
|
|
16
|
+
* [NodeGui's QPixmap](https://docs.nodegui.org/docs/api/generated/classes/qpixmap).
|
|
17
|
+
* ## Example
|
|
18
|
+
* ```javascript
|
|
19
|
+
* import React from "react";
|
|
20
|
+
* import { Renderer, Image, Window } from "@nodegui/react-nodegui";
|
|
21
|
+
* import { AspectRatioMode } from "@nodegui/nodegui";
|
|
22
|
+
* const App = () => {
|
|
23
|
+
* return (
|
|
24
|
+
* <Window>
|
|
25
|
+
* <Image
|
|
26
|
+
* aspectRatioMode={AspectRatioMode.KeepAspectRatio}
|
|
27
|
+
* size={{ height: 200, width: 150 }}
|
|
28
|
+
* src="https://place-hold.it/200x150"
|
|
29
|
+
* ></Image>
|
|
30
|
+
* </Window>
|
|
31
|
+
* );
|
|
32
|
+
* };
|
|
33
|
+
* Renderer.render(<App />);
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
36
|
+
export interface ImageProps extends TextProps {
|
|
37
|
+
src?: string;
|
|
38
|
+
aspectRatioMode?: AspectRatioMode;
|
|
39
|
+
transformationMode?: TransformationMode;
|
|
40
|
+
buffer?: Buffer;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const setImageProps = (
|
|
44
|
+
widget: RNImage,
|
|
45
|
+
newProps: ImageProps,
|
|
46
|
+
oldProps: ImageProps
|
|
47
|
+
) => {
|
|
48
|
+
const setter: ImageProps = {
|
|
49
|
+
set src(imageUrlOrPath: string) {
|
|
50
|
+
if (!imageUrlOrPath) {
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
getLoadedPixmap(imageUrlOrPath)
|
|
54
|
+
.then((pixmap) => widget.setPixmap(pixmap))
|
|
55
|
+
.catch(console.warn);
|
|
56
|
+
},
|
|
57
|
+
set buffer(imageBuffer: Buffer) {
|
|
58
|
+
const pixMap = new QPixmap();
|
|
59
|
+
pixMap.loadFromData(imageBuffer);
|
|
60
|
+
widget.setPixmap(pixMap);
|
|
61
|
+
},
|
|
62
|
+
set aspectRatioMode(mode: AspectRatioMode) {
|
|
63
|
+
widget.setAspectRatioMode(mode);
|
|
64
|
+
},
|
|
65
|
+
set transformationMode(mode: TransformationMode) {
|
|
66
|
+
widget.setTransformationMode(mode);
|
|
67
|
+
},
|
|
68
|
+
};
|
|
69
|
+
Object.assign(setter, newProps);
|
|
70
|
+
setTextProps(widget, newProps, oldProps);
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* @ignore
|
|
75
|
+
*/
|
|
76
|
+
export class RNImage extends QLabel implements RNWidget {
|
|
77
|
+
setProps(newProps: ImageProps, oldProps: ImageProps): void {
|
|
78
|
+
setImageProps(this, newProps, oldProps);
|
|
79
|
+
}
|
|
80
|
+
appendInitialChild(child: NodeWidget<any>): void {
|
|
81
|
+
throwUnsupported(this);
|
|
82
|
+
}
|
|
83
|
+
appendChild(child: NodeWidget<any>): void {
|
|
84
|
+
throwUnsupported(this);
|
|
85
|
+
}
|
|
86
|
+
insertBefore(child: NodeWidget<any>, beforeChild: NodeWidget<any>): void {
|
|
87
|
+
throwUnsupported(this);
|
|
88
|
+
}
|
|
89
|
+
removeChild(child: NodeWidget<any>): void {
|
|
90
|
+
throwUnsupported(this);
|
|
91
|
+
}
|
|
92
|
+
static tagName = "image";
|
|
93
|
+
originalPixmap?: QPixmap;
|
|
94
|
+
aspectRatioMode?: AspectRatioMode;
|
|
95
|
+
transformationMode?: TransformationMode;
|
|
96
|
+
setPixmap = (pixmap: QPixmap) => {
|
|
97
|
+
// react:✓
|
|
98
|
+
super.setPixmap(pixmap);
|
|
99
|
+
this.originalPixmap = pixmap;
|
|
100
|
+
};
|
|
101
|
+
setAspectRatioMode(mode: AspectRatioMode) {
|
|
102
|
+
// react:✓ TODO://getter
|
|
103
|
+
this.aspectRatioMode = mode;
|
|
104
|
+
this.scalePixmap(this.size());
|
|
105
|
+
}
|
|
106
|
+
setTransformationMode(mode: TransformationMode) {
|
|
107
|
+
// react:✓ TODO://getter
|
|
108
|
+
this.transformationMode = mode;
|
|
109
|
+
this.scalePixmap(this.size());
|
|
110
|
+
}
|
|
111
|
+
scalePixmap(size: QSize) {
|
|
112
|
+
if (this.originalPixmap) {
|
|
113
|
+
return super.setPixmap(
|
|
114
|
+
this.originalPixmap.scaled(
|
|
115
|
+
size.width(),
|
|
116
|
+
size.height(),
|
|
117
|
+
this.aspectRatioMode,
|
|
118
|
+
this.transformationMode
|
|
119
|
+
)
|
|
120
|
+
);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
async function getLoadedPixmap(imageUrlOrPath: string): Promise<QPixmap> {
|
|
126
|
+
const pixMap = new QPixmap();
|
|
127
|
+
if (isValidUrl(imageUrlOrPath)) {
|
|
128
|
+
const res = await phin(imageUrlOrPath);
|
|
129
|
+
const imageBuffer = Buffer.from(res.body);
|
|
130
|
+
pixMap.loadFromData(imageBuffer);
|
|
131
|
+
} else {
|
|
132
|
+
pixMap.load(imageUrlOrPath);
|
|
133
|
+
}
|
|
134
|
+
return pixMap;
|
|
135
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { Fiber } from "../../utils/decoupleFromReact";
|
|
2
|
+
import { registerComponent, ComponentConfig } from "../config";
|
|
3
|
+
import { RNImage, ImageProps } from "./RNImage";
|
|
4
|
+
import { AppContainer } from "../../reconciler";
|
|
5
|
+
import { WidgetEventTypes } from "@nodegui/nodegui";
|
|
6
|
+
class ImageConfig extends ComponentConfig {
|
|
7
|
+
tagName = RNImage.tagName;
|
|
8
|
+
shouldSetTextContent(nextProps: ImageProps): boolean {
|
|
9
|
+
return true;
|
|
10
|
+
}
|
|
11
|
+
createInstance(
|
|
12
|
+
newProps: ImageProps,
|
|
13
|
+
rootInstance: AppContainer,
|
|
14
|
+
context: any,
|
|
15
|
+
workInProgress: Fiber
|
|
16
|
+
): RNImage {
|
|
17
|
+
const widget = new RNImage();
|
|
18
|
+
widget.setProperty("scaledContents", true);
|
|
19
|
+
widget.setProps(newProps, {});
|
|
20
|
+
widget.addEventListener(WidgetEventTypes.Resize, () => {
|
|
21
|
+
widget.scalePixmap(widget.size());
|
|
22
|
+
});
|
|
23
|
+
return widget;
|
|
24
|
+
}
|
|
25
|
+
commitMount(
|
|
26
|
+
instance: RNImage,
|
|
27
|
+
newProps: ImageProps,
|
|
28
|
+
internalInstanceHandle: any
|
|
29
|
+
): void {
|
|
30
|
+
if (newProps.visible !== false) {
|
|
31
|
+
instance.show();
|
|
32
|
+
}
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
commitUpdate(
|
|
36
|
+
instance: RNImage,
|
|
37
|
+
updatePayload: any,
|
|
38
|
+
oldProps: ImageProps,
|
|
39
|
+
newProps: ImageProps,
|
|
40
|
+
finishedWork: Fiber
|
|
41
|
+
): void {
|
|
42
|
+
instance.setProps(newProps, oldProps);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export const Image = registerComponent<ImageProps>(new ImageConfig());
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import {
|
|
2
|
+
QLineEdit,
|
|
3
|
+
EchoMode,
|
|
4
|
+
NodeWidget,
|
|
5
|
+
QLineEditSignals
|
|
6
|
+
} from "@nodegui/nodegui";
|
|
7
|
+
import { ViewProps, setViewProps } from "../View/RNView";
|
|
8
|
+
import { RNWidget } from "../config";
|
|
9
|
+
import { throwUnsupported } from "../../utils/helpers";
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* The LineEdit component provides ability to add and manipulate native editable text field widgets. It is based on
|
|
13
|
+
* [NodeGui's QLineEdit](https://docs.nodegui.org/docs/api/generated/classes/qlineedit).
|
|
14
|
+
* ## Example
|
|
15
|
+
* ```javascript
|
|
16
|
+
* import React from "react";
|
|
17
|
+
* import { Renderer, LineEdit, Window } from "@nodegui/react-nodegui";
|
|
18
|
+
* const App = () => {
|
|
19
|
+
* const handleTextChanged = textValue => {
|
|
20
|
+
* console.log(textValue);
|
|
21
|
+
* };
|
|
22
|
+
* return (
|
|
23
|
+
* <Window>
|
|
24
|
+
* <LineEdit on={{ textChanged: handleTextChanged }} />
|
|
25
|
+
* </Window>
|
|
26
|
+
* );
|
|
27
|
+
* };
|
|
28
|
+
* Renderer.render(<App />);
|
|
29
|
+
*
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
export interface LineEditProps extends ViewProps<QLineEditSignals> {
|
|
33
|
+
text?: string;
|
|
34
|
+
placeholderText?: string;
|
|
35
|
+
readOnly?: boolean;
|
|
36
|
+
echoMode?: EchoMode;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
const setLineEditProps = (
|
|
40
|
+
widget: RNLineEdit,
|
|
41
|
+
newProps: LineEditProps,
|
|
42
|
+
oldProps: LineEditProps
|
|
43
|
+
) => {
|
|
44
|
+
const setter: LineEditProps = {
|
|
45
|
+
set text(text: string) {
|
|
46
|
+
text ? widget.setText(text) : widget.clear();
|
|
47
|
+
},
|
|
48
|
+
set placeholderText(text: string) {
|
|
49
|
+
widget.setPlaceholderText(text);
|
|
50
|
+
},
|
|
51
|
+
set readOnly(isReadOnly: boolean) {
|
|
52
|
+
widget.setReadOnly(isReadOnly);
|
|
53
|
+
},
|
|
54
|
+
set echoMode(mode: EchoMode) {
|
|
55
|
+
widget.setEchoMode(mode);
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
Object.assign(setter, newProps);
|
|
59
|
+
setViewProps(widget, newProps, oldProps);
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* @ignore
|
|
64
|
+
*/
|
|
65
|
+
export class RNLineEdit extends QLineEdit implements RNWidget {
|
|
66
|
+
setProps(newProps: LineEditProps, oldProps: LineEditProps): void {
|
|
67
|
+
setLineEditProps(this, newProps, oldProps);
|
|
68
|
+
}
|
|
69
|
+
appendInitialChild(child: NodeWidget<any>): void {
|
|
70
|
+
throwUnsupported(this);
|
|
71
|
+
}
|
|
72
|
+
appendChild(child: NodeWidget<any>): void {
|
|
73
|
+
throwUnsupported(this);
|
|
74
|
+
}
|
|
75
|
+
insertBefore(child: NodeWidget<any>, beforeChild: NodeWidget<any>): void {
|
|
76
|
+
throwUnsupported(this);
|
|
77
|
+
}
|
|
78
|
+
removeChild(child: NodeWidget<any>): void {
|
|
79
|
+
throwUnsupported(this);
|
|
80
|
+
}
|
|
81
|
+
static tagName = "linedit";
|
|
82
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { Fiber } from "../../utils/decoupleFromReact";
|
|
2
|
+
import { registerComponent, ComponentConfig } from "../config";
|
|
3
|
+
import { LineEditProps, RNLineEdit } from "./RNLineEdit";
|
|
4
|
+
import { AppContainer } from "../../reconciler";
|
|
5
|
+
class LineEditConfig extends ComponentConfig {
|
|
6
|
+
tagName = RNLineEdit.tagName;
|
|
7
|
+
shouldSetTextContent(nextProps: LineEditProps): boolean {
|
|
8
|
+
return true;
|
|
9
|
+
}
|
|
10
|
+
createInstance(
|
|
11
|
+
newProps: LineEditProps,
|
|
12
|
+
rootInstance: AppContainer,
|
|
13
|
+
context: any,
|
|
14
|
+
workInProgress: Fiber
|
|
15
|
+
): RNLineEdit {
|
|
16
|
+
const widget = new RNLineEdit();
|
|
17
|
+
widget.setProps(newProps, {});
|
|
18
|
+
return widget;
|
|
19
|
+
}
|
|
20
|
+
commitMount(
|
|
21
|
+
instance: RNLineEdit,
|
|
22
|
+
newProps: LineEditProps,
|
|
23
|
+
internalInstanceHandle: any
|
|
24
|
+
): void {
|
|
25
|
+
if (newProps.visible !== false) {
|
|
26
|
+
instance.show();
|
|
27
|
+
}
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
commitUpdate(
|
|
31
|
+
instance: RNLineEdit,
|
|
32
|
+
updatePayload: any,
|
|
33
|
+
oldProps: LineEditProps,
|
|
34
|
+
newProps: LineEditProps,
|
|
35
|
+
finishedWork: Fiber
|
|
36
|
+
): void {
|
|
37
|
+
instance.setProps(newProps, oldProps);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export const LineEdit = registerComponent<LineEditProps>(new LineEditConfig());
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { QMenu, QMenuSignals, Component, NodeWidget } from "@nodegui/nodegui";
|
|
2
|
+
import { RNWidget } from "../config";
|
|
3
|
+
import { throwUnsupported } from "../../utils/helpers";
|
|
4
|
+
import { RNAction } from "../Action/RNAction";
|
|
5
|
+
import { setViewProps, ViewProps } from "../View/RNView";
|
|
6
|
+
|
|
7
|
+
export interface MenuProps extends ViewProps<QMenuSignals> {
|
|
8
|
+
title?: string;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const setMenuProps = (
|
|
12
|
+
widget: RNMenu,
|
|
13
|
+
newProps: MenuProps,
|
|
14
|
+
oldProps: MenuProps
|
|
15
|
+
) => {
|
|
16
|
+
const setter: MenuProps = {
|
|
17
|
+
set title(title: string) {
|
|
18
|
+
widget.setTitle(title);
|
|
19
|
+
},
|
|
20
|
+
};
|
|
21
|
+
Object.assign(setter, newProps);
|
|
22
|
+
setViewProps(widget, newProps, oldProps);
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export class RNMenu extends QMenu implements RNWidget {
|
|
26
|
+
setProps(newProps: MenuProps, oldProps: MenuProps): void {
|
|
27
|
+
setMenuProps(this, newProps, oldProps);
|
|
28
|
+
}
|
|
29
|
+
appendInitialChild(child: Component): void {
|
|
30
|
+
this.appendChild(child);
|
|
31
|
+
}
|
|
32
|
+
appendChild(child: Component): void {
|
|
33
|
+
if (!(child instanceof RNAction)) {
|
|
34
|
+
console.warn("Menu only supports Action as its children");
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
this.addAction(child);
|
|
39
|
+
}
|
|
40
|
+
insertBefore(child: Component, beforeChild: Component): void {
|
|
41
|
+
throwUnsupported(this);
|
|
42
|
+
}
|
|
43
|
+
removeChild(child: Component): void {
|
|
44
|
+
if (child instanceof RNAction) {
|
|
45
|
+
this.removeAction(child);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
static tagName = "menu";
|
|
49
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { Fiber } from "../../utils/decoupleFromReact";
|
|
2
|
+
import { registerComponent, ComponentConfig } from "../config";
|
|
3
|
+
import { RNMenu, MenuProps } from "./RNMenu";
|
|
4
|
+
import { AppContainer } from "../../reconciler";
|
|
5
|
+
class MenuConfig extends ComponentConfig {
|
|
6
|
+
|
|
7
|
+
tagName = RNMenu.tagName;
|
|
8
|
+
shouldSetTextContent(nextProps: MenuProps): boolean {
|
|
9
|
+
return false;
|
|
10
|
+
}
|
|
11
|
+
createInstance(
|
|
12
|
+
newProps: MenuProps,
|
|
13
|
+
rootInstance: AppContainer,
|
|
14
|
+
context: any,
|
|
15
|
+
workInProgress: Fiber
|
|
16
|
+
): RNMenu {
|
|
17
|
+
const widget = new RNMenu();
|
|
18
|
+
widget.setProps(newProps, {});
|
|
19
|
+
return widget;
|
|
20
|
+
}
|
|
21
|
+
commitMount(
|
|
22
|
+
instance: RNMenu,
|
|
23
|
+
newProps: MenuProps,
|
|
24
|
+
internalInstanceHandle: any
|
|
25
|
+
): void {
|
|
26
|
+
if (newProps.visible !== false) {
|
|
27
|
+
instance.show();
|
|
28
|
+
}
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
commitUpdate(
|
|
32
|
+
instance: RNMenu,
|
|
33
|
+
updatePayload: any,
|
|
34
|
+
oldProps: MenuProps,
|
|
35
|
+
newProps: MenuProps,
|
|
36
|
+
finishedWork: Fiber
|
|
37
|
+
): void {
|
|
38
|
+
instance.setProps(newProps, oldProps);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export const Menu = registerComponent<MenuProps>(
|
|
43
|
+
new MenuConfig()
|
|
44
|
+
);
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { NodeWidget, QMenu, QMenuBar, QMenuBarSignals } from "@nodegui/nodegui";
|
|
2
|
+
import { ViewProps, setViewProps } from "../View/RNView";
|
|
3
|
+
import { RNWidget } from "../config";
|
|
4
|
+
import { throwUnsupported } from "../../utils/helpers";
|
|
5
|
+
|
|
6
|
+
export interface MenuBarProps extends ViewProps<QMenuBarSignals> {
|
|
7
|
+
nativeMenuBar?: boolean;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
const setMenuBarProps = (
|
|
11
|
+
widget: RNMenuBar,
|
|
12
|
+
newProps: MenuBarProps,
|
|
13
|
+
oldProps: MenuBarProps
|
|
14
|
+
) => {
|
|
15
|
+
const setter: MenuBarProps = {
|
|
16
|
+
set nativeMenuBar(shouldBeNative: boolean) {
|
|
17
|
+
widget.setNativeMenuBar(shouldBeNative);
|
|
18
|
+
},
|
|
19
|
+
};
|
|
20
|
+
Object.assign(setter, newProps);
|
|
21
|
+
setViewProps(widget, newProps, oldProps);
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export class RNMenuBar extends QMenuBar implements RNWidget {
|
|
25
|
+
setProps(newProps: MenuBarProps, oldProps: MenuBarProps): void {
|
|
26
|
+
setMenuBarProps(this, newProps, oldProps);
|
|
27
|
+
}
|
|
28
|
+
appendInitialChild(child: QMenu): void {
|
|
29
|
+
if (child instanceof QMenu) {
|
|
30
|
+
this.addMenu(child);
|
|
31
|
+
} else {
|
|
32
|
+
console.warn("MenuBar only supports Menu as its children");
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
appendChild(child: QMenu): void {
|
|
36
|
+
this.appendInitialChild(child);
|
|
37
|
+
}
|
|
38
|
+
insertBefore(child: NodeWidget<any>, beforeChild: NodeWidget<any>): void {
|
|
39
|
+
console.warn(
|
|
40
|
+
"Updating menubar is not yet supported. Please help by raising a PR"
|
|
41
|
+
);
|
|
42
|
+
throwUnsupported(this);
|
|
43
|
+
}
|
|
44
|
+
removeChild(child: NodeWidget<any>): void {
|
|
45
|
+
console.warn(
|
|
46
|
+
"Updating menubar is not yet supported. Please help by raising a PR"
|
|
47
|
+
);
|
|
48
|
+
throwUnsupported(this);
|
|
49
|
+
}
|
|
50
|
+
static tagName = "menubar";
|
|
51
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { Fiber } from "../../utils/decoupleFromReact";
|
|
2
|
+
import { registerComponent, ComponentConfig } from "../config";
|
|
3
|
+
import { RNMenuBar, MenuBarProps } from "./RNMenuBar";
|
|
4
|
+
import { AppContainer } from "../../reconciler";
|
|
5
|
+
|
|
6
|
+
class MenuBarConfig extends ComponentConfig {
|
|
7
|
+
tagName = RNMenuBar.tagName;
|
|
8
|
+
shouldSetTextContent(nextProps: MenuBarProps): boolean {
|
|
9
|
+
return false;
|
|
10
|
+
}
|
|
11
|
+
createInstance(
|
|
12
|
+
newProps: MenuBarProps,
|
|
13
|
+
rootInstance: AppContainer,
|
|
14
|
+
context: any,
|
|
15
|
+
workInProgress: Fiber
|
|
16
|
+
): RNMenuBar {
|
|
17
|
+
const widget = new RNMenuBar();
|
|
18
|
+
widget.setProps(newProps, {});
|
|
19
|
+
return widget;
|
|
20
|
+
}
|
|
21
|
+
commitMount(
|
|
22
|
+
instance: RNMenuBar,
|
|
23
|
+
newProps: MenuBarProps,
|
|
24
|
+
internalInstanceHandle: any
|
|
25
|
+
): void {
|
|
26
|
+
if (newProps.visible !== false) {
|
|
27
|
+
instance.show();
|
|
28
|
+
}
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
commitUpdate(
|
|
32
|
+
instance: RNMenuBar,
|
|
33
|
+
updatePayload: any,
|
|
34
|
+
oldProps: MenuBarProps,
|
|
35
|
+
newProps: MenuBarProps,
|
|
36
|
+
finishedWork: Fiber
|
|
37
|
+
): void {
|
|
38
|
+
instance.setProps(newProps, oldProps);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export const MenuBar = registerComponent<MenuBarProps>(new MenuBarConfig());
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import {
|
|
2
|
+
QPlainTextEdit,
|
|
3
|
+
NodeWidget,
|
|
4
|
+
QPlainTextEditSignals
|
|
5
|
+
} from "@nodegui/nodegui";
|
|
6
|
+
import { ViewProps, setViewProps } from "../View/RNView";
|
|
7
|
+
import { RNWidget } from "../config";
|
|
8
|
+
import { throwUnsupported } from "../../utils/helpers";
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* The PlainTextEdit component provides ability to add and manipulate native editable text field widgets. It is based on
|
|
12
|
+
* [NodeGui's QPlainTextEdit](https://docs.nodegui.org/docs/api/generated/classes/qplaintextedit/).
|
|
13
|
+
* ## Example
|
|
14
|
+
* ```javascript
|
|
15
|
+
* import React from "react";
|
|
16
|
+
* import { Renderer, PlainTextEdit, Window } from "@nodegui/react-nodegui";
|
|
17
|
+
*
|
|
18
|
+
* const plainTextRef = React.createRef();
|
|
19
|
+
* const App = () => {
|
|
20
|
+
* React.useEffect(() => {
|
|
21
|
+
* plainTextRef.current.addEventListener("textChanged", () =>
|
|
22
|
+
* console.log(plainTextRef.current.toPlainText())
|
|
23
|
+
* );
|
|
24
|
+
* });
|
|
25
|
+
* return (
|
|
26
|
+
* <Window>
|
|
27
|
+
* <PlainTextEdit ref={plainTextRef} />
|
|
28
|
+
* </Window>
|
|
29
|
+
* );
|
|
30
|
+
* };
|
|
31
|
+
* Renderer.render(<App />);
|
|
32
|
+
*
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
35
|
+
|
|
36
|
+
export interface PlainTextEditProps extends ViewProps<QPlainTextEditSignals> {
|
|
37
|
+
text?: string;
|
|
38
|
+
readOnly?: boolean;
|
|
39
|
+
placeholderText?: string;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const setPlainTextEditProps = (
|
|
43
|
+
widget: RNPlainTextEdit,
|
|
44
|
+
newProps: PlainTextEditProps,
|
|
45
|
+
oldProps: PlainTextEditProps
|
|
46
|
+
) => {
|
|
47
|
+
const setter: PlainTextEditProps = {
|
|
48
|
+
set text(text: string) {
|
|
49
|
+
text ? widget.setPlainText(text) : widget.clear();
|
|
50
|
+
},
|
|
51
|
+
set readOnly(isReadOnly: boolean) {
|
|
52
|
+
widget.setReadOnly(isReadOnly);
|
|
53
|
+
},
|
|
54
|
+
set placeholderText(text: string) {
|
|
55
|
+
widget.setPlaceholderText(text);
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
Object.assign(setter, newProps);
|
|
59
|
+
setViewProps(widget, newProps, oldProps);
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* @ignore
|
|
64
|
+
*/
|
|
65
|
+
export class RNPlainTextEdit extends QPlainTextEdit implements RNWidget {
|
|
66
|
+
setProps(newProps: PlainTextEditProps, oldProps: PlainTextEditProps): void {
|
|
67
|
+
setPlainTextEditProps(this, newProps, oldProps);
|
|
68
|
+
}
|
|
69
|
+
appendInitialChild(child: NodeWidget<any>): void {
|
|
70
|
+
throwUnsupported(this);
|
|
71
|
+
}
|
|
72
|
+
appendChild(child: NodeWidget<any>): void {
|
|
73
|
+
throwUnsupported(this);
|
|
74
|
+
}
|
|
75
|
+
insertBefore(child: NodeWidget<any>, beforeChild: NodeWidget<any>): void {
|
|
76
|
+
throwUnsupported(this);
|
|
77
|
+
}
|
|
78
|
+
removeChild(child: NodeWidget<any>): void {
|
|
79
|
+
throwUnsupported(this);
|
|
80
|
+
}
|
|
81
|
+
static tagName = "plaintextedit";
|
|
82
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { registerComponent, ComponentConfig } from "../config";
|
|
2
|
+
import type { Fiber } from "../../utils/decoupleFromReact";
|
|
3
|
+
import { RNPlainTextEdit, PlainTextEditProps } from "./RNPlainTextEdit";
|
|
4
|
+
import { AppContainer } from "../../reconciler";
|
|
5
|
+
|
|
6
|
+
class PlainTextEditConfig extends ComponentConfig {
|
|
7
|
+
tagName = RNPlainTextEdit.tagName;
|
|
8
|
+
shouldSetTextContent(nextProps: PlainTextEditProps): boolean {
|
|
9
|
+
return true;
|
|
10
|
+
}
|
|
11
|
+
createInstance(
|
|
12
|
+
newProps: PlainTextEditProps,
|
|
13
|
+
rootInstance: AppContainer,
|
|
14
|
+
context: any,
|
|
15
|
+
workInProgress: Fiber
|
|
16
|
+
): RNPlainTextEdit {
|
|
17
|
+
const widget = new RNPlainTextEdit();
|
|
18
|
+
widget.setProps(newProps, {});
|
|
19
|
+
return widget;
|
|
20
|
+
}
|
|
21
|
+
commitMount(
|
|
22
|
+
instance: RNPlainTextEdit,
|
|
23
|
+
newProps: PlainTextEditProps,
|
|
24
|
+
internalInstanceHandle: any
|
|
25
|
+
): void {
|
|
26
|
+
if (newProps.visible !== false) {
|
|
27
|
+
instance.show();
|
|
28
|
+
}
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
commitUpdate(
|
|
32
|
+
instance: RNPlainTextEdit,
|
|
33
|
+
updatePayload: any,
|
|
34
|
+
oldProps: PlainTextEditProps,
|
|
35
|
+
newProps: PlainTextEditProps,
|
|
36
|
+
finishedWork: Fiber
|
|
37
|
+
): void {
|
|
38
|
+
instance.setProps(newProps, oldProps);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export const PlainTextEdit = registerComponent<PlainTextEditProps>(
|
|
43
|
+
new PlainTextEditConfig()
|
|
44
|
+
);
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import {
|
|
2
|
+
QProgressBar,
|
|
3
|
+
Orientation,
|
|
4
|
+
NodeWidget,
|
|
5
|
+
QProgressBarSignals
|
|
6
|
+
} from "@nodegui/nodegui";
|
|
7
|
+
import { ViewProps, setViewProps } from "../View/RNView";
|
|
8
|
+
import { RNWidget } from "../config";
|
|
9
|
+
import { throwUnsupported } from "../../utils/helpers";
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* The ProgressBar component provides ability to add and manipulate native progress bar widgets. It is based on
|
|
13
|
+
* [NodeGui's QProgressBar](https://docs.nodegui.org/docs/api/generated/classes/qprogressbar/).
|
|
14
|
+
* ## Example
|
|
15
|
+
* ```javascript
|
|
16
|
+
* import React from "react";
|
|
17
|
+
* import { Renderer, ProgressBar, Window } from "@nodegui/react-nodegui";
|
|
18
|
+
* const App = () => {
|
|
19
|
+
* return (
|
|
20
|
+
* <Window>
|
|
21
|
+
* <ProgressBar value={45} />
|
|
22
|
+
* </Window>
|
|
23
|
+
* );
|
|
24
|
+
* };
|
|
25
|
+
* Renderer.render(<App />);
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
export interface ProgressBarProps extends ViewProps<QProgressBarSignals> {
|
|
29
|
+
value?: number;
|
|
30
|
+
minimum?: number;
|
|
31
|
+
maximum?: number;
|
|
32
|
+
orientation?: Orientation;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const setProgressBarProps = (
|
|
36
|
+
widget: RNProgressBar,
|
|
37
|
+
newProps: ProgressBarProps,
|
|
38
|
+
oldProps: ProgressBarProps
|
|
39
|
+
) => {
|
|
40
|
+
const setter: ProgressBarProps = {
|
|
41
|
+
set value(val: number) {
|
|
42
|
+
widget.setValue(val);
|
|
43
|
+
},
|
|
44
|
+
set minimum(min: number) {
|
|
45
|
+
widget.setMinimum(min);
|
|
46
|
+
},
|
|
47
|
+
set maximum(max: number) {
|
|
48
|
+
widget.setMaximum(max);
|
|
49
|
+
},
|
|
50
|
+
set orientation(orientation: Orientation) {
|
|
51
|
+
widget.setOrientation(orientation);
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
Object.assign(setter, newProps);
|
|
55
|
+
setViewProps(widget, newProps, oldProps);
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* @ignore
|
|
60
|
+
*/
|
|
61
|
+
export class RNProgressBar extends QProgressBar implements RNWidget {
|
|
62
|
+
setProps(newProps: ProgressBarProps, oldProps: ProgressBarProps): void {
|
|
63
|
+
setProgressBarProps(this, newProps, oldProps);
|
|
64
|
+
}
|
|
65
|
+
appendInitialChild(child: NodeWidget<any>): void {
|
|
66
|
+
throwUnsupported(this);
|
|
67
|
+
}
|
|
68
|
+
appendChild(child: NodeWidget<any>): void {
|
|
69
|
+
throwUnsupported(this);
|
|
70
|
+
}
|
|
71
|
+
insertBefore(child: NodeWidget<any>, beforeChild: NodeWidget<any>): void {
|
|
72
|
+
throwUnsupported(this);
|
|
73
|
+
}
|
|
74
|
+
removeChild(child: NodeWidget<any>): void {
|
|
75
|
+
throwUnsupported(this);
|
|
76
|
+
}
|
|
77
|
+
static tagName = "progressbar";
|
|
78
|
+
}
|