This repository was archived by the owner on Mar 18, 2025. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 56
/
Copy pathindex.ts
54 lines (46 loc) · 1.71 KB
/
index.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
import { initializeDom, NSVElement } from './dom';
import { SvelteComponent } from 'svelte';
export function svelteNodeGUI(rootElement: typeof SvelteComponent, data: any): Promise<SvelteComponent> {
const doc = initializeDom();
return new Promise((resolve, reject) => {
let elementInstance: SvelteComponent;
const buildElement = () => {
elementInstance = new rootElement({
target: doc.body,
props: data || {}
})
return (doc.body.firstChild as NSVElement).nativeView;
}
buildElement();
resolve(elementInstance);
});
}
// Svelte looks to see if window is undefined in order to determine if it is running on the client or in SSR.
// window is undefined until initializeDom is called. We will set it to a temporary value here and overwrite it in intializedom.
(global as any).window = { env: "Svelte NodeGUI" }
export { initializeDom, DomTraceCategory, NSVElement } from "./dom";
export {
ImageProps, RNImage,
AnimatedImageProps, RNAnimatedImage,
ViewProps, RNView,
CheckBoxProps, RNCheckBox,
TextProps, RNText,
DialProps, RNDial,
LineEditProps, RNLineEdit,
WindowProps, RNWindow,
ProgressBarProps, RNProgressBar,
ComboBoxProps, RNComboBox,
ButtonProps, RNButton,
SpinBoxProps, RNSpinBox,
RadioButtonProps, RNRadioButton,
TabProps, RNTab,
MenuProps, RNMenu,
MenuBarProps, RNMenuBar,
PlainTextEditProps, RNPlainTextEdit,
SliderProps, RNSlider,
SystemTrayIconProps, RNSystemTrayIcon,
ActionProps, RNAction,
BoxViewProps, RNBoxView,
GridViewProps, RNGridView,
ScrollAreaProps, RNScrollArea,
} from "./dom/react-nodegui/src";