git0 0.2.11 → 0.2.13
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/docs/assets/js/c3a618e1.965a31da.js +1 -1
- package/docs/functions/index.html +2 -2
- package/docs-config/src/functions/index.md +1 -1
- package/package.json +2 -1
- package/readme.md +18 -30
- package/src/fm.js +1130 -0
- package/src/git0.js +3 -4
- package/src/github-api.js +14 -15
- package/TypeScript-React-Starter/LICENSE +0 -21
- package/TypeScript-React-Starter/README-CRA.md +0 -1281
- package/TypeScript-React-Starter/README.md +0 -810
- package/TypeScript-React-Starter/package.json +0 -28
- package/TypeScript-React-Starter/public/favicon.ico +0 -0
- package/TypeScript-React-Starter/public/index.html +0 -31
- package/TypeScript-React-Starter/src/App.css +0 -24
- package/TypeScript-React-Starter/src/App.test.tsx +0 -8
- package/TypeScript-React-Starter/src/App.tsx +0 -23
- package/TypeScript-React-Starter/src/actions/index.tsx +0 -24
- package/TypeScript-React-Starter/src/components/Hello.css +0 -13
- package/TypeScript-React-Starter/src/components/Hello.test.tsx +0 -30
- package/TypeScript-React-Starter/src/components/Hello.tsx +0 -35
- package/TypeScript-React-Starter/src/constants/index.tsx +0 -6
- package/TypeScript-React-Starter/src/containers/Hello.tsx +0 -20
- package/TypeScript-React-Starter/src/index.css +0 -5
- package/TypeScript-React-Starter/src/index.tsx +0 -22
- package/TypeScript-React-Starter/src/logo.svg +0 -7
- package/TypeScript-React-Starter/src/reducers/index.tsx +0 -15
- package/TypeScript-React-Starter/src/types/index.tsx +0 -5
- package/TypeScript-React-Starter/tsconfig.json +0 -29
- package/TypeScript-React-Starter/tslint.json +0 -11
- package/TypeScript-React-Starter/yarn.lock +0 -4785
- package/svelte-nodegui/.all-contributorsrc +0 -60
- package/svelte-nodegui/.vscode/launch.json +0 -29
- package/svelte-nodegui/CHANGELOG.md +0 -153
- package/svelte-nodegui/LICENSE +0 -22
- package/svelte-nodegui/README.md +0 -151
- package/svelte-nodegui/demo/.editorconfig +0 -15
- package/svelte-nodegui/demo/.vscode/extensions.json +0 -3
- package/svelte-nodegui/demo/livereload.js +0 -29
- package/svelte-nodegui/demo/package-lock.json +0 -3514
- package/svelte-nodegui/demo/package.json +0 -35
- package/svelte-nodegui/demo/src/App.svelte +0 -29
- package/svelte-nodegui/demo/src/app.ts +0 -31
- package/svelte-nodegui/demo/tsconfig.json +0 -40
- package/svelte-nodegui/demo/webpack.config.js +0 -110
- 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 +0 -13
- package/svelte-nodegui/extras/legal/yode/LICENSE +0 -21
- 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 +0 -4
- package/svelte-nodegui/nativescript-svelte-todo.gif +0 -0
- package/svelte-nodegui/package-lock.json +0 -1749
- package/svelte-nodegui/package.json +0 -44
- package/svelte-nodegui/repl-workers/bundler/commonjs.js +0 -58
- package/svelte-nodegui/repl-workers/bundler/index.js +0 -353
- package/svelte-nodegui/repl-workers/package-lock.json +0 -484
- package/svelte-nodegui/repl-workers/package.json +0 -21
- package/svelte-nodegui/repl-workers/rollup.config.js +0 -21
- package/svelte-nodegui/rollup.config.js +0 -81
- package/svelte-nodegui/scripts/create-pkg.js +0 -42
- package/svelte-nodegui/src/components/AsComponent.svelte +0 -16
- package/svelte-nodegui/src/components/SlotComponent.svelte +0 -4
- package/svelte-nodegui/src/components/Template.svelte +0 -10
- package/svelte-nodegui/src/components/Template.svelte.d.ts +0 -6
- package/svelte-nodegui/src/components/index.ts +0 -2
- package/svelte-nodegui/src/dom/index.ts +0 -132
- package/svelte-nodegui/src/dom/nativescript-vue-next/LICENCE +0 -21
- package/svelte-nodegui/src/dom/nativescript-vue-next/index.ts +0 -19
- package/svelte-nodegui/src/dom/nativescript-vue-next/runtime/index.ts +0 -21
- package/svelte-nodegui/src/dom/nativescript-vue-next/runtime/nodes.ts +0 -890
- package/svelte-nodegui/src/dom/nativescript-vue-next/runtime/registry.ts +0 -262
- package/svelte-nodegui/src/dom/nativescript-vue-next/runtime/runtimeHelpers.ts +0 -20
- package/svelte-nodegui/src/dom/react-nodegui/LICENSE +0 -21
- package/svelte-nodegui/src/dom/react-nodegui/src/components/AbstractComponents/RNAbstractButton.ts +0 -67
- package/svelte-nodegui/src/dom/react-nodegui/src/components/Action/RNAction.ts +0 -146
- package/svelte-nodegui/src/dom/react-nodegui/src/components/Action/index.ts +0 -37
- package/svelte-nodegui/src/dom/react-nodegui/src/components/AnimatedImage/RNAnimatedImage.ts +0 -76
- package/svelte-nodegui/src/dom/react-nodegui/src/components/AnimatedImage/index.ts +0 -45
- package/svelte-nodegui/src/dom/react-nodegui/src/components/BoxView/RNBoxView.ts +0 -99
- package/svelte-nodegui/src/dom/react-nodegui/src/components/BoxView/index.ts +0 -49
- package/svelte-nodegui/src/dom/react-nodegui/src/components/Button/RNButton.ts +0 -71
- package/svelte-nodegui/src/dom/react-nodegui/src/components/Button/index.ts +0 -49
- package/svelte-nodegui/src/dom/react-nodegui/src/components/CheckBox/RNCheckBox.ts +0 -71
- package/svelte-nodegui/src/dom/react-nodegui/src/components/CheckBox/index.ts +0 -50
- package/svelte-nodegui/src/dom/react-nodegui/src/components/ComboBox/RNComboBox.ts +0 -118
- package/svelte-nodegui/src/dom/react-nodegui/src/components/ComboBox/index.ts +0 -50
- package/svelte-nodegui/src/dom/react-nodegui/src/components/Dial/RNDial.ts +0 -69
- package/svelte-nodegui/src/dom/react-nodegui/src/components/Dial/index.ts +0 -41
- package/svelte-nodegui/src/dom/react-nodegui/src/components/GridView/GridColumn/RNGridColumn.ts +0 -95
- package/svelte-nodegui/src/dom/react-nodegui/src/components/GridView/GridColumn/index.ts +0 -49
- package/svelte-nodegui/src/dom/react-nodegui/src/components/GridView/GridRow/RNGridRow.ts +0 -141
- package/svelte-nodegui/src/dom/react-nodegui/src/components/GridView/GridRow/index.ts +0 -47
- package/svelte-nodegui/src/dom/react-nodegui/src/components/GridView/RNGridView.ts +0 -185
- package/svelte-nodegui/src/dom/react-nodegui/src/components/GridView/index.ts +0 -51
- package/svelte-nodegui/src/dom/react-nodegui/src/components/GridView/utils.ts +0 -59
- package/svelte-nodegui/src/dom/react-nodegui/src/components/Image/RNImage.ts +0 -135
- package/svelte-nodegui/src/dom/react-nodegui/src/components/Image/index.ts +0 -46
- package/svelte-nodegui/src/dom/react-nodegui/src/components/LineEdit/RNLineEdit.ts +0 -82
- package/svelte-nodegui/src/dom/react-nodegui/src/components/LineEdit/index.ts +0 -41
- package/svelte-nodegui/src/dom/react-nodegui/src/components/Menu/RNMenu.ts +0 -49
- package/svelte-nodegui/src/dom/react-nodegui/src/components/Menu/index.ts +0 -44
- package/svelte-nodegui/src/dom/react-nodegui/src/components/MenuBar/RNMenuBar.ts +0 -51
- package/svelte-nodegui/src/dom/react-nodegui/src/components/MenuBar/index.ts +0 -42
- package/svelte-nodegui/src/dom/react-nodegui/src/components/PlainTextEdit/RNPlainTextEdit.ts +0 -82
- package/svelte-nodegui/src/dom/react-nodegui/src/components/PlainTextEdit/index.ts +0 -44
- package/svelte-nodegui/src/dom/react-nodegui/src/components/ProgressBar/RNProgressBar.ts +0 -78
- package/svelte-nodegui/src/dom/react-nodegui/src/components/ProgressBar/index.ts +0 -43
- package/svelte-nodegui/src/dom/react-nodegui/src/components/RadioButton/RNRadioButton.ts +0 -50
- package/svelte-nodegui/src/dom/react-nodegui/src/components/RadioButton/index.ts +0 -43
- package/svelte-nodegui/src/dom/react-nodegui/src/components/ScrollArea/RNScrollArea.ts +0 -51
- package/svelte-nodegui/src/dom/react-nodegui/src/components/ScrollArea/index.ts +0 -44
- package/svelte-nodegui/src/dom/react-nodegui/src/components/Slider/RNSlider.ts +0 -97
- package/svelte-nodegui/src/dom/react-nodegui/src/components/Slider/index.ts +0 -46
- package/svelte-nodegui/src/dom/react-nodegui/src/components/SpinBox/RNSpinBox.ts +0 -88
- package/svelte-nodegui/src/dom/react-nodegui/src/components/SpinBox/index.ts +0 -49
- package/svelte-nodegui/src/dom/react-nodegui/src/components/Svg/RNSvg.ts +0 -67
- package/svelte-nodegui/src/dom/react-nodegui/src/components/Svg/index.ts +0 -43
- package/svelte-nodegui/src/dom/react-nodegui/src/components/SystemTrayIcon/RNSystemTrayIcon.ts +0 -141
- package/svelte-nodegui/src/dom/react-nodegui/src/components/SystemTrayIcon/index.ts +0 -43
- package/svelte-nodegui/src/dom/react-nodegui/src/components/Tab/RNTab.ts +0 -69
- package/svelte-nodegui/src/dom/react-nodegui/src/components/Tab/index.ts +0 -48
- package/svelte-nodegui/src/dom/react-nodegui/src/components/TabItem/RNTabItem.ts +0 -72
- package/svelte-nodegui/src/dom/react-nodegui/src/components/TabItem/index.ts +0 -40
- package/svelte-nodegui/src/dom/react-nodegui/src/components/Text/RNText.ts +0 -65
- package/svelte-nodegui/src/dom/react-nodegui/src/components/Text/index.ts +0 -49
- package/svelte-nodegui/src/dom/react-nodegui/src/components/View/RNView.ts +0 -306
- package/svelte-nodegui/src/dom/react-nodegui/src/components/View/index.ts +0 -44
- package/svelte-nodegui/src/dom/react-nodegui/src/components/Window/RNWindow.ts +0 -66
- package/svelte-nodegui/src/dom/react-nodegui/src/components/Window/index.ts +0 -50
- package/svelte-nodegui/src/dom/react-nodegui/src/components/config.ts +0 -95
- package/svelte-nodegui/src/dom/react-nodegui/src/index.ts +0 -52
- package/svelte-nodegui/src/dom/react-nodegui/src/reconciler/index.ts +0 -226
- package/svelte-nodegui/src/dom/react-nodegui/src/utils/decoupleFromReact.ts +0 -2
- package/svelte-nodegui/src/dom/react-nodegui/src/utils/helpers.ts +0 -14
- package/svelte-nodegui/src/dom/shared/Logger.ts +0 -16
- package/svelte-nodegui/src/dom/shared/index.ts +0 -1
- package/svelte-nodegui/src/dom/svelte/HeadElement.ts +0 -41
- package/svelte-nodegui/src/dom/svelte/RNObject.ts +0 -95
- package/svelte-nodegui/src/dom/svelte/StyleElement.ts +0 -92
- package/svelte-nodegui/src/dom/svelte/SvelteNodeGUIDocument.ts +0 -124
- package/svelte-nodegui/src/dom/svelte/TemplateElement.ts +0 -16
- package/svelte-nodegui/src/dom/svelte-elements.ts +0 -111
- package/svelte-nodegui/src/index.ts +0 -62
- package/svelte-nodegui/src/svelte-nodegui.ts +0 -159
- package/svelte-nodegui/src/transitions/bezier.ts +0 -112
- package/svelte-nodegui/src/transitions/index.ts +0 -227
- package/svelte-nodegui/tsconfig.json +0 -19
- package/svelte-nodegui/website/README.md +0 -33
- package/svelte-nodegui/website/blog/2019-05-30-welcome.md +0 -12
- package/svelte-nodegui/website/docs/api/classes/renderer.md +0 -49
- package/svelte-nodegui/website/docs/api/classes/rnaction.md +0 -608
- package/svelte-nodegui/website/docs/api/classes/rngridcolumn.md +0 -232
- package/svelte-nodegui/website/docs/api/classes/rngridrow.md +0 -247
- package/svelte-nodegui/website/docs/api/classes/rnmenu.md +0 -1337
- package/svelte-nodegui/website/docs/api/classes/rnmenubar.md +0 -1341
- package/svelte-nodegui/website/docs/api/globals.md +0 -832
- package/svelte-nodegui/website/docs/api/index.md +0 -0
- package/svelte-nodegui/website/docs/api/interfaces/_react_proxy_.reactproxycomponent.md +0 -38
- package/svelte-nodegui/website/docs/api/interfaces/abstractbuttonprops.md +0 -306
- package/svelte-nodegui/website/docs/api/interfaces/actionprops.md +0 -115
- package/svelte-nodegui/website/docs/api/interfaces/animatedimageprops.md +0 -297
- package/svelte-nodegui/website/docs/api/interfaces/boxviewprops.md +0 -245
- package/svelte-nodegui/website/docs/api/interfaces/buttonprops.md +0 -313
- package/svelte-nodegui/website/docs/api/interfaces/checkboxprops.md +0 -313
- package/svelte-nodegui/website/docs/api/interfaces/comboboxprops.md +0 -343
- package/svelte-nodegui/website/docs/api/interfaces/datawithoffset.md +0 -32
- package/svelte-nodegui/website/docs/api/interfaces/dialprops.md +0 -259
- package/svelte-nodegui/website/docs/api/interfaces/gridviewprops.md +0 -273
- package/svelte-nodegui/website/docs/api/interfaces/imageprops.md +0 -311
- package/svelte-nodegui/website/docs/api/interfaces/lineeditprops.md +0 -266
- package/svelte-nodegui/website/docs/api/interfaces/menubarprops.md +0 -245
- package/svelte-nodegui/website/docs/api/interfaces/menuprops.md +0 -245
- package/svelte-nodegui/website/docs/api/interfaces/plaintexteditprops.md +0 -259
- package/svelte-nodegui/website/docs/api/interfaces/progressbarprops.md +0 -266
- package/svelte-nodegui/website/docs/api/interfaces/radiobuttonprops.md +0 -282
- package/svelte-nodegui/website/docs/api/interfaces/scrollareaprops.md +0 -245
- package/svelte-nodegui/website/docs/api/interfaces/sliderprops.md +0 -329
- package/svelte-nodegui/website/docs/api/interfaces/spinboxprops.md +0 -273
- package/svelte-nodegui/website/docs/api/interfaces/systemtrayiconprops.md +0 -97
- package/svelte-nodegui/website/docs/api/interfaces/tabitemprops.md +0 -28
- package/svelte-nodegui/website/docs/api/interfaces/tabprops.md +0 -245
- package/svelte-nodegui/website/docs/api/interfaces/textprops.md +0 -277
- package/svelte-nodegui/website/docs/api/interfaces/viewprops.md +0 -261
- package/svelte-nodegui/website/docs/api/interfaces/windowprops.md +0 -245
- package/svelte-nodegui/website/docs/api/modules/_react_proxy_.md +0 -29
- package/svelte-nodegui/website/docs/doc1.md +0 -162
- package/svelte-nodegui/website/docs/guides/custom-nodegui-native-plugin.md +0 -6
- package/svelte-nodegui/website/docs/guides/debugging-in-vscode.md +0 -39
- package/svelte-nodegui/website/docs/guides/debugging.md +0 -59
- package/svelte-nodegui/website/docs/guides/getting-started.md +0 -141
- package/svelte-nodegui/website/docs/guides/handle-events.md +0 -188
- package/svelte-nodegui/website/docs/guides/images.md +0 -62
- package/svelte-nodegui/website/docs/guides/layout.md +0 -281
- package/svelte-nodegui/website/docs/guides/networking.md +0 -31
- package/svelte-nodegui/website/docs/guides/packaging.md +0 -32
- package/svelte-nodegui/website/docs/guides/scroll-view.md +0 -69
- package/svelte-nodegui/website/docs/guides/styling.md +0 -208
- package/svelte-nodegui/website/docs/guides/tutorial.md +0 -82
- package/svelte-nodegui/website/docs/guides/using-native-node-modules.md +0 -55
- package/svelte-nodegui/website/docs/mdx.md +0 -22
- package/svelte-nodegui/website/docs/scripts/fixdocs.js +0 -21
- package/svelte-nodegui/website/docusaurus.config.js +0 -131
- package/svelte-nodegui/website/package.json +0 -33
- package/svelte-nodegui/website/sidebars.js +0 -77
- package/svelte-nodegui/website/src/components/CodeExample.js +0 -42
- package/svelte-nodegui/website/src/components/CreateNativeApps.js +0 -46
- package/svelte-nodegui/website/src/components/Features.js +0 -62
- package/svelte-nodegui/website/src/components/Hero.js +0 -85
- package/svelte-nodegui/website/src/components/SplitView.js +0 -18
- package/svelte-nodegui/website/src/components/Talks.js +0 -68
- package/svelte-nodegui/website/src/components/Try.js +0 -83
- package/svelte-nodegui/website/src/components/common.js +0 -41
- package/svelte-nodegui/website/src/components/styles.css +0 -61
- package/svelte-nodegui/website/src/css/custom.css +0 -34
- package/svelte-nodegui/website/src/pages/index.js +0 -32
- package/svelte-nodegui/website/src/pages/styles.module.css +0 -35
- package/svelte-nodegui/website/static/CNAME +0 -1
- 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 +0 -5
- package/svelte-nodegui/website/static/img/logox200.png +0 -0
- package/svelte-nodegui/website/static/img/undraw_building_websites.svg +0 -1
- package/svelte-nodegui/website/static/img/undraw_code_review.svg +0 -1
- package/svelte-nodegui/website/static/img/undraw_docusaurus_mountain.svg +0 -170
- package/svelte-nodegui/website/static/img/undraw_docusaurus_react.svg +0 -169
- package/svelte-nodegui/website/static/img/undraw_docusaurus_tree.svg +0 -1
- package/svelte-nodegui/website/static/img/undraw_react.svg +0 -1
- package/svelte-nodegui/website/static/img/undraw_website_setup.svg +0 -1
- package/svelte-nodegui/website/static/img/undraw_windows.svg +0 -11
- package/svelte-nodegui/website/website/sidebars.js +0 -32
- package/svelte-nodegui/website/yarn.lock +0 -10533
|
@@ -1,99 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,49 +0,0 @@
|
|
|
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());
|
|
@@ -1,71 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,49 +0,0 @@
|
|
|
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());
|
|
@@ -1,71 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,50 +0,0 @@
|
|
|
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());
|
|
@@ -1,118 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,50 +0,0 @@
|
|
|
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());
|
|
@@ -1,69 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,41 +0,0 @@
|
|
|
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());
|