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,99 @@
|
|
|
1
|
+
import {
|
|
2
|
+
QWidget,
|
|
3
|
+
QBoxLayoutSignals,
|
|
4
|
+
QBoxLayout,
|
|
5
|
+
NodeWidget,
|
|
6
|
+
Direction,
|
|
7
|
+
} from "@nodegui/nodegui";
|
|
8
|
+
import { ViewProps, setViewProps } from "../View/RNView";
|
|
9
|
+
import { RNComponent } from "../config";
|
|
10
|
+
|
|
11
|
+
export interface BoxViewProps extends ViewProps<QBoxLayoutSignals> {
|
|
12
|
+
direction?: Direction;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const setBoxViewProps = (
|
|
16
|
+
widget: RNBoxView,
|
|
17
|
+
newProps: BoxViewProps,
|
|
18
|
+
oldProps: BoxViewProps
|
|
19
|
+
) => {
|
|
20
|
+
const setter: BoxViewProps = {
|
|
21
|
+
set direction(direction: Direction) {
|
|
22
|
+
widget.layout?.setDirection(direction);
|
|
23
|
+
},
|
|
24
|
+
};
|
|
25
|
+
Object.assign(setter, newProps);
|
|
26
|
+
setViewProps(widget, newProps, oldProps);
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* @ignore
|
|
31
|
+
*/
|
|
32
|
+
export class RNBoxView extends QWidget implements RNComponent {
|
|
33
|
+
native: any;
|
|
34
|
+
initialProps?: BoxViewProps;
|
|
35
|
+
children: Array<NodeWidget<any>> = [];
|
|
36
|
+
|
|
37
|
+
get layout() {
|
|
38
|
+
return super.layout as QBoxLayout | undefined;
|
|
39
|
+
}
|
|
40
|
+
set layout(l: QBoxLayout | undefined) {
|
|
41
|
+
super.layout = l;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
setProps(newProps: BoxViewProps, oldProps: BoxViewProps): void {
|
|
45
|
+
if (this.layout) {
|
|
46
|
+
setBoxViewProps(this, newProps, oldProps);
|
|
47
|
+
} else {
|
|
48
|
+
this.initialProps = newProps;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
appendInitialChild(child: NodeWidget<any>): void {
|
|
52
|
+
this.appendChild(child);
|
|
53
|
+
}
|
|
54
|
+
appendChild(child: NodeWidget<any>): void {
|
|
55
|
+
const updateChild = () => {
|
|
56
|
+
this.layout?.addWidget(child);
|
|
57
|
+
this.children.push(child);
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
if (this.layout) {
|
|
61
|
+
updateChild();
|
|
62
|
+
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
const layout = new QBoxLayout(Direction.LeftToRight);
|
|
67
|
+
this.setLayout(layout);
|
|
68
|
+
this.layout = layout;
|
|
69
|
+
|
|
70
|
+
// Newly created layout, so set initial props
|
|
71
|
+
if (this.initialProps) {
|
|
72
|
+
setBoxViewProps(this, this.initialProps, {});
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
updateChild();
|
|
76
|
+
}
|
|
77
|
+
insertBefore(child: NodeWidget<any>, beforeChild: NodeWidget<any>): void {
|
|
78
|
+
const prevIndex = this.children.indexOf(beforeChild);
|
|
79
|
+
|
|
80
|
+
if (prevIndex === -1) {
|
|
81
|
+
throw new Error(
|
|
82
|
+
"Attempted to insert child Node before nonexistent child"
|
|
83
|
+
);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
this.children.splice(prevIndex, 0, child);
|
|
87
|
+
this.layout?.insertWidget(prevIndex, child);
|
|
88
|
+
}
|
|
89
|
+
removeChild(child: NodeWidget<any>): void {
|
|
90
|
+
const prevIndex = this.children.indexOf(child);
|
|
91
|
+
|
|
92
|
+
if (prevIndex !== -1) {
|
|
93
|
+
this.children.splice(prevIndex, 1);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
child.close();
|
|
97
|
+
}
|
|
98
|
+
static tagName: string = "boxview";
|
|
99
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { ComponentConfig, registerComponent } from "../config";
|
|
2
|
+
import { RNBoxView, BoxViewProps } from "./RNBoxView";
|
|
3
|
+
import { AppContainer } from "../../reconciler";
|
|
4
|
+
import type { Fiber } from "../../utils/decoupleFromReact";
|
|
5
|
+
|
|
6
|
+
class BoxViewConfig extends ComponentConfig {
|
|
7
|
+
tagName = RNBoxView.tagName;
|
|
8
|
+
shouldSetTextContent(nextProps: BoxViewProps): boolean {
|
|
9
|
+
return false;
|
|
10
|
+
}
|
|
11
|
+
createInstance(
|
|
12
|
+
newProps: BoxViewProps,
|
|
13
|
+
rootInstance: AppContainer,
|
|
14
|
+
context: any,
|
|
15
|
+
workInProgress: Fiber
|
|
16
|
+
): RNBoxView {
|
|
17
|
+
const widget = new RNBoxView();
|
|
18
|
+
widget.setProps(newProps, {});
|
|
19
|
+
return widget;
|
|
20
|
+
}
|
|
21
|
+
finalizeInitialChildren(
|
|
22
|
+
instance: RNBoxView,
|
|
23
|
+
newProps: BoxViewProps,
|
|
24
|
+
rootContainerInstance: AppContainer,
|
|
25
|
+
context: any
|
|
26
|
+
): boolean {
|
|
27
|
+
return true;
|
|
28
|
+
}
|
|
29
|
+
commitMount(
|
|
30
|
+
instance: RNBoxView,
|
|
31
|
+
newProps: BoxViewProps,
|
|
32
|
+
internalInstanceHandle: any
|
|
33
|
+
): void {
|
|
34
|
+
if (newProps.visible !== false) {
|
|
35
|
+
instance.show();
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
commitUpdate(
|
|
39
|
+
instance: RNBoxView,
|
|
40
|
+
updatePayload: any,
|
|
41
|
+
oldProps: BoxViewProps,
|
|
42
|
+
newProps: BoxViewProps,
|
|
43
|
+
finishedWork: Fiber
|
|
44
|
+
): void {
|
|
45
|
+
instance.setProps(newProps, oldProps);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export const BoxView = registerComponent<BoxViewProps>(new BoxViewConfig());
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { QPushButton, NodeWidget, QPushButtonSignals } from "@nodegui/nodegui";
|
|
2
|
+
import {
|
|
3
|
+
AbstractButtonProps,
|
|
4
|
+
setAbstractButtonProps
|
|
5
|
+
} from "../AbstractComponents/RNAbstractButton";
|
|
6
|
+
import { RNWidget } from "../config";
|
|
7
|
+
import { throwUnsupported } from "../../utils/helpers";
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* The Button component provides ability to add and manipulate native button widgets. It is based on
|
|
11
|
+
* [NodeGui's QPushButton](https://docs.nodegui.org/docs/api/QPushButton).
|
|
12
|
+
* ## Example
|
|
13
|
+
* ```javascript
|
|
14
|
+
* import React from "react";
|
|
15
|
+
* import { Renderer, Button, Window } from "@nodegui/react-nodegui";
|
|
16
|
+
* const App = () => {
|
|
17
|
+
* return (
|
|
18
|
+
* <Window>
|
|
19
|
+
* <Button style={buttonStyle} text={"Hello World"} />
|
|
20
|
+
* </Window>
|
|
21
|
+
* );
|
|
22
|
+
* };
|
|
23
|
+
* const buttonStyle = `
|
|
24
|
+
* color: white;
|
|
25
|
+
* `;
|
|
26
|
+
* Renderer.render(<App />);
|
|
27
|
+
*
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
export interface ButtonProps extends AbstractButtonProps<QPushButtonSignals> {
|
|
31
|
+
/**
|
|
32
|
+
* Sets whether the button border is raised. [QPushButton: setFlat](https://docs.nodegui.org/docs/api/QPushButton#buttonsetflatisflat)
|
|
33
|
+
*/
|
|
34
|
+
flat?: boolean;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const setButtonProps = (
|
|
38
|
+
widget: RNButton,
|
|
39
|
+
newProps: ButtonProps,
|
|
40
|
+
oldProps: ButtonProps
|
|
41
|
+
) => {
|
|
42
|
+
const setter: ButtonProps = {
|
|
43
|
+
set flat(isFlat: boolean) {
|
|
44
|
+
widget.setFlat(isFlat);
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
Object.assign(setter, newProps);
|
|
48
|
+
setAbstractButtonProps(widget, newProps, oldProps);
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* @ignore
|
|
53
|
+
*/
|
|
54
|
+
export class RNButton extends QPushButton implements RNWidget {
|
|
55
|
+
appendInitialChild(child: NodeWidget<any>): void {
|
|
56
|
+
throwUnsupported(this);
|
|
57
|
+
}
|
|
58
|
+
appendChild(child: NodeWidget<any>): void {
|
|
59
|
+
throwUnsupported(this);
|
|
60
|
+
}
|
|
61
|
+
insertBefore(child: NodeWidget<any>, beforeChild: NodeWidget<any>): void {
|
|
62
|
+
throwUnsupported(this);
|
|
63
|
+
}
|
|
64
|
+
removeChild(child: NodeWidget<any>): void {
|
|
65
|
+
throwUnsupported(this);
|
|
66
|
+
}
|
|
67
|
+
setProps(newProps: ButtonProps, oldProps: ButtonProps) {
|
|
68
|
+
setButtonProps(this, newProps, oldProps);
|
|
69
|
+
}
|
|
70
|
+
static tagName = "button";
|
|
71
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { ComponentConfig, registerComponent } from "../config";
|
|
2
|
+
import type { Fiber } from "../../utils/decoupleFromReact";
|
|
3
|
+
import { RNButton, ButtonProps } from "./RNButton";
|
|
4
|
+
import { AppContainer } from "../../reconciler";
|
|
5
|
+
class ButtonConfig extends ComponentConfig {
|
|
6
|
+
tagName = RNButton.tagName;
|
|
7
|
+
shouldSetTextContent(nextProps: ButtonProps): boolean {
|
|
8
|
+
return true;
|
|
9
|
+
}
|
|
10
|
+
createInstance(
|
|
11
|
+
newProps: ButtonProps,
|
|
12
|
+
rootInstance: AppContainer,
|
|
13
|
+
context: any,
|
|
14
|
+
workInProgress: Fiber
|
|
15
|
+
): RNButton {
|
|
16
|
+
const widget = new RNButton();
|
|
17
|
+
widget.setProps(newProps, {});
|
|
18
|
+
return widget;
|
|
19
|
+
}
|
|
20
|
+
commitMount(
|
|
21
|
+
instance: RNButton,
|
|
22
|
+
newProps: ButtonProps,
|
|
23
|
+
internalInstanceHandle: any
|
|
24
|
+
): void {
|
|
25
|
+
if (newProps.visible !== false) {
|
|
26
|
+
instance.show();
|
|
27
|
+
}
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
finalizeInitialChildren(
|
|
31
|
+
instance: RNButton,
|
|
32
|
+
newProps: ButtonProps,
|
|
33
|
+
rootContainerInstance: AppContainer,
|
|
34
|
+
context: any
|
|
35
|
+
): boolean {
|
|
36
|
+
return true;
|
|
37
|
+
}
|
|
38
|
+
commitUpdate(
|
|
39
|
+
instance: RNButton,
|
|
40
|
+
updatePayload: any,
|
|
41
|
+
oldProps: ButtonProps,
|
|
42
|
+
newProps: ButtonProps,
|
|
43
|
+
finishedWork: Fiber
|
|
44
|
+
): void {
|
|
45
|
+
instance.setProps(newProps, oldProps);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export const Button = registerComponent<ButtonProps>(new ButtonConfig());
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { QCheckBox, NodeWidget, QCheckBoxSignals } from "@nodegui/nodegui";
|
|
2
|
+
import { RNWidget } from "../config";
|
|
3
|
+
import { throwUnsupported } from "../../utils/helpers";
|
|
4
|
+
import {
|
|
5
|
+
AbstractButtonProps,
|
|
6
|
+
setAbstractButtonProps
|
|
7
|
+
} from "../AbstractComponents/RNAbstractButton";
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* The CheckBox component provides ability to add and manipulate native button widgets. It is based on
|
|
11
|
+
* [NodeGui's QCheckBox](https://docs.nodegui.org/docs/api/QCheckBox).
|
|
12
|
+
* ## Example
|
|
13
|
+
* ```javascript
|
|
14
|
+
* import React from "react";
|
|
15
|
+
* import { Renderer, CheckBox, Window } from "@nodegui/react-nodegui";
|
|
16
|
+
* const App = () => {
|
|
17
|
+
* return (
|
|
18
|
+
* <Window>
|
|
19
|
+
* <CheckBox style={checkboxStyle} text={"Hello World"} checked={true} />
|
|
20
|
+
* </Window>
|
|
21
|
+
* );
|
|
22
|
+
* };
|
|
23
|
+
* const checkboxStyle = `
|
|
24
|
+
* color: white;
|
|
25
|
+
* `;
|
|
26
|
+
* Renderer.render(<App />);
|
|
27
|
+
*
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
export interface CheckBoxProps extends AbstractButtonProps<QCheckBoxSignals> {
|
|
31
|
+
/**
|
|
32
|
+
* This property holds whether the button is checked. [QCheckBox: setChecked](https://docs.nodegui.org/docs/api/QCheckBox/#checkboxsetcheckedcheck)
|
|
33
|
+
*/
|
|
34
|
+
checked?: boolean;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const setCheckBoxProps = (
|
|
38
|
+
widget: RNCheckBox,
|
|
39
|
+
newProps: CheckBoxProps,
|
|
40
|
+
oldProps: CheckBoxProps
|
|
41
|
+
) => {
|
|
42
|
+
const setter: CheckBoxProps = {
|
|
43
|
+
set checked(isChecked: boolean) {
|
|
44
|
+
widget.setChecked(isChecked);
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
Object.assign(setter, newProps);
|
|
48
|
+
setAbstractButtonProps(widget, newProps, oldProps);
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* @ignore
|
|
53
|
+
*/
|
|
54
|
+
export class RNCheckBox extends QCheckBox implements RNWidget {
|
|
55
|
+
setProps(newProps: CheckBoxProps, oldProps: CheckBoxProps): void {
|
|
56
|
+
setCheckBoxProps(this, newProps, oldProps);
|
|
57
|
+
}
|
|
58
|
+
appendInitialChild(child: NodeWidget<any>): void {
|
|
59
|
+
throwUnsupported(this);
|
|
60
|
+
}
|
|
61
|
+
appendChild(child: NodeWidget<any>): void {
|
|
62
|
+
throwUnsupported(this);
|
|
63
|
+
}
|
|
64
|
+
insertBefore(child: NodeWidget<any>, beforeChild: NodeWidget<any>): void {
|
|
65
|
+
throwUnsupported(this);
|
|
66
|
+
}
|
|
67
|
+
removeChild(child: NodeWidget<any>): void {
|
|
68
|
+
throwUnsupported(this);
|
|
69
|
+
}
|
|
70
|
+
static tagName = "checkbox";
|
|
71
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import type { Fiber } from "../../utils/decoupleFromReact";
|
|
2
|
+
import { registerComponent, ComponentConfig } from "../config";
|
|
3
|
+
import { RNCheckBox, CheckBoxProps } from "./RNCheckBox";
|
|
4
|
+
import { AppContainer } from "../../reconciler";
|
|
5
|
+
|
|
6
|
+
class CheckBoxConfig extends ComponentConfig {
|
|
7
|
+
tagName = RNCheckBox.tagName;
|
|
8
|
+
shouldSetTextContent(nextProps: CheckBoxProps): boolean {
|
|
9
|
+
return true;
|
|
10
|
+
}
|
|
11
|
+
createInstance(
|
|
12
|
+
newProps: CheckBoxProps,
|
|
13
|
+
rootInstance: AppContainer,
|
|
14
|
+
context: any,
|
|
15
|
+
workInProgress: Fiber
|
|
16
|
+
): RNCheckBox {
|
|
17
|
+
const widget = new RNCheckBox();
|
|
18
|
+
widget.setProps(newProps, {});
|
|
19
|
+
return widget;
|
|
20
|
+
}
|
|
21
|
+
finalizeInitialChildren(
|
|
22
|
+
instance: RNCheckBox,
|
|
23
|
+
newProps: CheckBoxProps,
|
|
24
|
+
rootContainerInstance: AppContainer,
|
|
25
|
+
context: any
|
|
26
|
+
): boolean {
|
|
27
|
+
return true;
|
|
28
|
+
}
|
|
29
|
+
commitMount(
|
|
30
|
+
instance: RNCheckBox,
|
|
31
|
+
newProps: CheckBoxProps,
|
|
32
|
+
internalInstanceHandle: any
|
|
33
|
+
): void {
|
|
34
|
+
if (newProps.visible !== false) {
|
|
35
|
+
instance.show();
|
|
36
|
+
}
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
commitUpdate(
|
|
40
|
+
instance: RNCheckBox,
|
|
41
|
+
updatePayload: any,
|
|
42
|
+
oldProps: CheckBoxProps,
|
|
43
|
+
newProps: CheckBoxProps,
|
|
44
|
+
finishedWork: Fiber
|
|
45
|
+
): void {
|
|
46
|
+
instance.setProps(newProps, oldProps);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export const CheckBox = registerComponent<CheckBoxProps>(new CheckBoxConfig());
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import {
|
|
2
|
+
QComboBox,
|
|
3
|
+
NodeWidget,
|
|
4
|
+
QSize,
|
|
5
|
+
QVariant,
|
|
6
|
+
SizeAdjustPolicy,
|
|
7
|
+
InsertPolicy,
|
|
8
|
+
QIcon,
|
|
9
|
+
QComboBoxSignals
|
|
10
|
+
} from "@nodegui/nodegui";
|
|
11
|
+
import { ViewProps, setViewProps } from "../View/RNView";
|
|
12
|
+
import { RNWidget } from "../config";
|
|
13
|
+
import { throwUnsupported } from "../../utils/helpers";
|
|
14
|
+
|
|
15
|
+
export interface ComboBoxProps extends ViewProps<QComboBoxSignals> {
|
|
16
|
+
items?: ComboBoxItem[];
|
|
17
|
+
count?: number;
|
|
18
|
+
iconSize?: QSize;
|
|
19
|
+
frame?: boolean;
|
|
20
|
+
currentIndex?: number;
|
|
21
|
+
currentData?: QVariant;
|
|
22
|
+
currentText?: string;
|
|
23
|
+
duplicatesEnabled?: boolean;
|
|
24
|
+
editable?: boolean;
|
|
25
|
+
insertPolicy?: InsertPolicy;
|
|
26
|
+
maxCount?: number;
|
|
27
|
+
maxVisibleItems?: number;
|
|
28
|
+
minimumContentsLength?: number;
|
|
29
|
+
modelColumn?: number;
|
|
30
|
+
sizeAdjustPolicy?: SizeAdjustPolicy;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
type ComboBoxItem = {
|
|
34
|
+
text: string;
|
|
35
|
+
icon?: QIcon;
|
|
36
|
+
userData?: QVariant;
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
const setComboBoxProps = (
|
|
40
|
+
widget: RNComboBox,
|
|
41
|
+
newProps: ComboBoxProps,
|
|
42
|
+
oldProps: ComboBoxProps
|
|
43
|
+
) => {
|
|
44
|
+
const setter: ComboBoxProps = {
|
|
45
|
+
set items(items: ComboBoxItem[]) {
|
|
46
|
+
widget.clear();
|
|
47
|
+
items.forEach(item => {
|
|
48
|
+
widget.addItem(item.icon, item.text, item.userData);
|
|
49
|
+
});
|
|
50
|
+
},
|
|
51
|
+
set count(count: number) {
|
|
52
|
+
widget.setProperty("count", count);
|
|
53
|
+
},
|
|
54
|
+
set iconSize(iconSize: QSize) {
|
|
55
|
+
widget.setProperty("iconSize", iconSize.native);
|
|
56
|
+
},
|
|
57
|
+
set frame(frame: boolean) {
|
|
58
|
+
widget.setProperty("frame", frame);
|
|
59
|
+
},
|
|
60
|
+
set currentIndex(currentIndex: number) {
|
|
61
|
+
widget.setProperty("currentIndex", currentIndex);
|
|
62
|
+
},
|
|
63
|
+
set currentData(value: QVariant) {
|
|
64
|
+
widget.setProperty("currentData", value.native);
|
|
65
|
+
},
|
|
66
|
+
set currentText(text: string) {
|
|
67
|
+
widget.setProperty("currentText", text);
|
|
68
|
+
},
|
|
69
|
+
set duplicatesEnabled(enabled: boolean) {
|
|
70
|
+
widget.setProperty("duplicatesEnabled", enabled);
|
|
71
|
+
},
|
|
72
|
+
set editable(enabled: boolean) {
|
|
73
|
+
widget.setProperty("editable", enabled);
|
|
74
|
+
},
|
|
75
|
+
set insertPolicy(policy: InsertPolicy) {
|
|
76
|
+
widget.setProperty("insertPolicy", policy);
|
|
77
|
+
},
|
|
78
|
+
set maxCount(count: number) {
|
|
79
|
+
widget.setProperty("maxCount", count);
|
|
80
|
+
},
|
|
81
|
+
set maxVisibleItems(count: number) {
|
|
82
|
+
widget.setProperty("maxVisibleItems", count);
|
|
83
|
+
},
|
|
84
|
+
set minimumContentsLength(count: number) {
|
|
85
|
+
widget.setProperty("minimumContentsLength", count);
|
|
86
|
+
},
|
|
87
|
+
set modelColumn(column: number) {
|
|
88
|
+
widget.setProperty("modelColumn", column);
|
|
89
|
+
},
|
|
90
|
+
set sizeAdjustPolicy(policy: SizeAdjustPolicy) {
|
|
91
|
+
widget.setProperty("sizeAdjustPolicy", policy);
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
Object.assign(setter, newProps);
|
|
95
|
+
setViewProps(widget, newProps, oldProps);
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* @ignore
|
|
100
|
+
*/
|
|
101
|
+
export class RNComboBox extends QComboBox implements RNWidget {
|
|
102
|
+
setProps(newProps: ComboBoxProps, oldProps: ComboBoxProps): void {
|
|
103
|
+
setComboBoxProps(this, newProps, oldProps);
|
|
104
|
+
}
|
|
105
|
+
appendInitialChild(child: NodeWidget<any>): void {
|
|
106
|
+
throwUnsupported(this);
|
|
107
|
+
}
|
|
108
|
+
appendChild(child: NodeWidget<any>): void {
|
|
109
|
+
throwUnsupported(this);
|
|
110
|
+
}
|
|
111
|
+
insertBefore(child: NodeWidget<any>, beforeChild: NodeWidget<any>): void {
|
|
112
|
+
throwUnsupported(this);
|
|
113
|
+
}
|
|
114
|
+
removeChild(child: NodeWidget<any>): void {
|
|
115
|
+
throwUnsupported(this);
|
|
116
|
+
}
|
|
117
|
+
static tagName = "combobox";
|
|
118
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { registerComponent, ComponentConfig } from "../config";
|
|
2
|
+
import type { Fiber } from "../../utils/decoupleFromReact";
|
|
3
|
+
import { RNComboBox, ComboBoxProps } from "./RNComboBox";
|
|
4
|
+
import { AppContainer } from "../../reconciler";
|
|
5
|
+
|
|
6
|
+
class ComboBoxConfig extends ComponentConfig {
|
|
7
|
+
tagName = RNComboBox.tagName;
|
|
8
|
+
shouldSetTextContent(nextProps: ComboBoxProps): boolean {
|
|
9
|
+
return true;
|
|
10
|
+
}
|
|
11
|
+
createInstance(
|
|
12
|
+
newProps: ComboBoxProps,
|
|
13
|
+
rootInstance: AppContainer,
|
|
14
|
+
context: any,
|
|
15
|
+
workInProgress: Fiber
|
|
16
|
+
): RNComboBox {
|
|
17
|
+
const widget = new RNComboBox();
|
|
18
|
+
widget.setProps(newProps, {});
|
|
19
|
+
return widget;
|
|
20
|
+
}
|
|
21
|
+
finalizeInitialChildren(
|
|
22
|
+
instance: RNComboBox,
|
|
23
|
+
newProps: ComboBoxProps,
|
|
24
|
+
rootContainerInstance: AppContainer,
|
|
25
|
+
context: any
|
|
26
|
+
): boolean {
|
|
27
|
+
return true;
|
|
28
|
+
}
|
|
29
|
+
commitMount(
|
|
30
|
+
instance: RNComboBox,
|
|
31
|
+
newProps: ComboBoxProps,
|
|
32
|
+
internalInstanceHandle: any
|
|
33
|
+
): void {
|
|
34
|
+
if (newProps.visible !== false) {
|
|
35
|
+
instance.show();
|
|
36
|
+
}
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
commitUpdate(
|
|
40
|
+
instance: RNComboBox,
|
|
41
|
+
updatePayload: any,
|
|
42
|
+
oldProps: ComboBoxProps,
|
|
43
|
+
newProps: ComboBoxProps,
|
|
44
|
+
finishedWork: Fiber
|
|
45
|
+
): void {
|
|
46
|
+
instance.setProps(newProps, oldProps);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export const ComboBox = registerComponent<ComboBoxProps>(new ComboBoxConfig());
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { QDial, NodeWidget, QDialSignals } from "@nodegui/nodegui";
|
|
2
|
+
import { ViewProps, setViewProps } from "../View/RNView";
|
|
3
|
+
import { RNWidget } from "../config";
|
|
4
|
+
import { throwUnsupported } from "../../utils/helpers";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The Dial provides ability to add and manipulate native dial slider widgets. It is based on
|
|
8
|
+
* [NodeGui's QDial](https://docs.nodegui.org/docs/api/generated/classes/qdial/).
|
|
9
|
+
* ## Example
|
|
10
|
+
* ```javascript
|
|
11
|
+
* import React from "react";
|
|
12
|
+
* import { Renderer, Dial, Window } from "@nodegui/react-nodegui";
|
|
13
|
+
* const App = () => {
|
|
14
|
+
* return (
|
|
15
|
+
* <Window>
|
|
16
|
+
* <Dial />
|
|
17
|
+
* </Window>
|
|
18
|
+
* );
|
|
19
|
+
* };
|
|
20
|
+
* Renderer.render(<App />);
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
export interface DialProps extends ViewProps<QDialSignals> {
|
|
24
|
+
notchesVisible?: boolean;
|
|
25
|
+
wrapping?: boolean;
|
|
26
|
+
notchTarget?: number;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const setDialProps = (
|
|
30
|
+
widget: RNDial,
|
|
31
|
+
newProps: DialProps,
|
|
32
|
+
oldProps: DialProps
|
|
33
|
+
) => {
|
|
34
|
+
const setter: DialProps = {
|
|
35
|
+
set notchesVisible(notchesVisible: boolean) {
|
|
36
|
+
widget.setNotchesVisible(notchesVisible);
|
|
37
|
+
},
|
|
38
|
+
set wrapping(wrapping: boolean) {
|
|
39
|
+
widget.setWrapping(wrapping);
|
|
40
|
+
},
|
|
41
|
+
set notchTarget(notchTarget: number) {
|
|
42
|
+
widget.setNotchTarget(notchTarget);
|
|
43
|
+
},
|
|
44
|
+
};
|
|
45
|
+
Object.assign(setter, newProps);
|
|
46
|
+
setViewProps(widget, newProps, oldProps);
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* @ignore
|
|
51
|
+
*/
|
|
52
|
+
export class RNDial extends QDial implements RNWidget {
|
|
53
|
+
setProps(newProps: DialProps, oldProps: DialProps): void {
|
|
54
|
+
setDialProps(this, newProps, oldProps);
|
|
55
|
+
}
|
|
56
|
+
appendInitialChild(child: NodeWidget<any>): void {
|
|
57
|
+
throwUnsupported(this);
|
|
58
|
+
}
|
|
59
|
+
appendChild(child: NodeWidget<any>): void {
|
|
60
|
+
throwUnsupported(this);
|
|
61
|
+
}
|
|
62
|
+
insertBefore(child: NodeWidget<any>, beforeChild: NodeWidget<any>): void {
|
|
63
|
+
throwUnsupported(this);
|
|
64
|
+
}
|
|
65
|
+
removeChild(child: NodeWidget<any>): void {
|
|
66
|
+
throwUnsupported(this);
|
|
67
|
+
}
|
|
68
|
+
static tagName = "dial";
|
|
69
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { Fiber } from "../../utils/decoupleFromReact";
|
|
2
|
+
import { registerComponent, ComponentConfig } from "../config";
|
|
3
|
+
import { RNDial, DialProps } from "./RNDial";
|
|
4
|
+
import { AppContainer } from "../../reconciler";
|
|
5
|
+
class DialConfig extends ComponentConfig {
|
|
6
|
+
tagName = RNDial.tagName;
|
|
7
|
+
shouldSetTextContent(nextProps: DialProps): boolean {
|
|
8
|
+
return true;
|
|
9
|
+
}
|
|
10
|
+
createInstance(
|
|
11
|
+
newProps: DialProps,
|
|
12
|
+
rootInstance: AppContainer,
|
|
13
|
+
context: any,
|
|
14
|
+
workInProgress: Fiber
|
|
15
|
+
): RNDial {
|
|
16
|
+
const widget = new RNDial();
|
|
17
|
+
widget.setProps(newProps, {});
|
|
18
|
+
return widget;
|
|
19
|
+
}
|
|
20
|
+
commitMount(
|
|
21
|
+
instance: RNDial,
|
|
22
|
+
newProps: DialProps,
|
|
23
|
+
internalInstanceHandle: any
|
|
24
|
+
): void {
|
|
25
|
+
if (newProps.visible !== false) {
|
|
26
|
+
instance.show();
|
|
27
|
+
}
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
commitUpdate(
|
|
31
|
+
instance: RNDial,
|
|
32
|
+
updatePayload: any,
|
|
33
|
+
oldProps: DialProps,
|
|
34
|
+
newProps: DialProps,
|
|
35
|
+
finishedWork: Fiber
|
|
36
|
+
): void {
|
|
37
|
+
instance.setProps(newProps, oldProps);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export const Dial = registerComponent<DialProps>(new DialConfig());
|