Skip to content
This repository was archived by the owner on Mar 18, 2025. It is now read-only.

Commit 7c15395

Browse files
committed
Provisional intrinsic typings filled in!
1 parent 51c2f81 commit 7c15395

File tree

1 file changed

+111
-1
lines changed

1 file changed

+111
-1
lines changed

src/svelte-desktop.ts

Lines changed: 111 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
declare namespace svelteDesktop.JSX {
2-
32
/* svelte specific */
43
interface ElementClass {
54
$$prop_def: any;
@@ -9,12 +8,123 @@ declare namespace svelteDesktop.JSX {
98
$$prop_def: any; // specify the property name to use
109
}
1110

11+
/* I'm not sure of the type for Svelte Element, but extending ElementClass just makes the `$$prop_def` attribute become mandatory. */
12+
// type SvelteElement = ElementClass;
13+
type SvelteElement = {};
14+
type SvelteText = string | number;
15+
type SvelteChild = SvelteElement | SvelteText;
16+
17+
interface SvelteNodeArray extends Array<SvelteNode> {}
18+
type SvelteFragment = {} | SvelteNodeArray;
19+
20+
type SvelteNode = SvelteChild | SvelteFragment | boolean | null | undefined;
21+
22+
interface SvelteNodeGUIAttributes<
23+
T extends import("@nodegui/nodegui").Component = import("@nodegui/nodegui").Component
24+
> extends SvelteElement {
25+
nodeRole?: string;
26+
children?: SvelteNode;
27+
}
28+
29+
type SvelteNodeGUIProps<
30+
Props extends {} = {},
31+
T extends import("@nodegui/nodegui").Component = import("@nodegui/nodegui").Component
32+
> = SvelteNodeGUIAttributes<T> & Props;
33+
1234
// Add empty IntrinsicAttributes to prevent fallback to the one in the JSX namespace
1335
// eslint-disable-next-line @typescript-eslint/no-empty-interface
1436
interface IntrinsicAttributes {
1537
}
1638

1739
interface IntrinsicElements {
1840
[name: string]: { [name: string]: any };
41+
image: SvelteNodeGUIProps<
42+
import("./dom/react-nodegui/src/components/Image/RNImage").ImageProps,
43+
import("./dom/react-nodegui/src/components/Image/RNImage").RNImage
44+
>;
45+
animatedImage: SvelteNodeGUIProps<
46+
import("./dom/react-nodegui/src/components/AnimatedImage/RNAnimatedImage").AnimatedImageProps,
47+
import("./dom/react-nodegui/src/components/AnimatedImage/RNAnimatedImage").RNAnimatedImage
48+
>;
49+
view: SvelteNodeGUIProps<
50+
import("./dom/react-nodegui/src/components/View/RNView").ViewProps<any>,
51+
import("./dom/react-nodegui/src/components/View/RNView").RNView
52+
>;
53+
checkBox: SvelteNodeGUIProps<
54+
import("./dom/react-nodegui/src/components/CheckBox/RNCheckBox").CheckBoxProps,
55+
import("./dom/react-nodegui/src/components/CheckBox/RNCheckBox").RNCheckBox
56+
>;
57+
text: SvelteNodeGUIProps<
58+
import("./dom/react-nodegui/src/components/Text/RNText").TextProps,
59+
import("./dom/react-nodegui/src/components/Text/RNText").RNText
60+
>;
61+
dial: SvelteNodeGUIProps<
62+
import("./dom/react-nodegui/src/components/Dial/RNDial").DialProps,
63+
import("./dom/react-nodegui/src/components/Dial/RNDial").RNDial
64+
>;
65+
lineEdit: SvelteNodeGUIProps<
66+
import("./dom/react-nodegui/src/components/LineEdit/RNLineEdit").LineEditProps,
67+
import("./dom/react-nodegui/src/components/LineEdit/RNLineEdit").RNLineEdit
68+
>;
69+
window: SvelteNodeGUIProps<
70+
import("./dom/react-nodegui/src/components/Window/RNWindow").WindowProps,
71+
import("./dom/react-nodegui/src/components/Window/RNWindow").RNWindow
72+
>;
73+
progressBar: SvelteNodeGUIProps<
74+
import("./dom/react-nodegui/src/components/ProgressBar/RNProgressBar").ProgressBarProps,
75+
import("./dom/react-nodegui/src/components/ProgressBar/RNProgressBar").RNProgressBar
76+
>;
77+
comboBox: SvelteNodeGUIProps<
78+
import("./dom/react-nodegui/src/components/ComboBox/RNComboBox").ComboBoxProps,
79+
import("./dom/react-nodegui/src/components/ComboBox/RNComboBox").RNComboBox
80+
>;
81+
button: SvelteNodeGUIProps<
82+
import("./dom/react-nodegui/src/components/Button/RNButton").ButtonProps,
83+
import("./dom/react-nodegui/src/components/Button/RNButton").RNButton
84+
>;
85+
spinBox: SvelteNodeGUIProps<
86+
import("./dom/react-nodegui/src/components/SpinBox/RNSpinBox").SpinBoxProps,
87+
import("./dom/react-nodegui/src/components/SpinBox/RNSpinBox").RNSpinBox
88+
>;
89+
radioButton: SvelteNodeGUIProps<
90+
import("./dom/react-nodegui/src/components/RadioButton/RNRadioButton").RadioButtonProps,
91+
import("./dom/react-nodegui/src/components/RadioButton/RNRadioButton").RNRadioButton
92+
>;
93+
tab: SvelteNodeGUIProps<
94+
import("./dom/react-nodegui/src/components/Tab/RNTab").TabProps,
95+
import("./dom/react-nodegui/src/components/Tab/RNTab").RNTab
96+
>;
97+
menu: SvelteNodeGUIProps<
98+
import("./dom/react-nodegui/src/components/Menu/RNMenu").MenuProps,
99+
import("./dom/react-nodegui/src/components/Menu/RNMenu").RNMenu
100+
>;
101+
menuBar: SvelteNodeGUIProps<
102+
import("./dom/react-nodegui/src/components/MenuBar/RNMenuBar").MenuBarProps,
103+
import("./dom/react-nodegui/src/components/MenuBar/RNMenuBar").RNMenuBar
104+
>;
105+
plainTextEdit: SvelteNodeGUIProps<
106+
import("./dom/react-nodegui/src/components/PlainTextEdit/RNPlainTextEdit").PlainTextEditProps,
107+
import("./dom/react-nodegui/src/components/PlainTextEdit/RNPlainTextEdit").RNPlainTextEdit
108+
>;
109+
slider: SvelteNodeGUIProps<
110+
import("./dom/react-nodegui/src/components/Slider/RNSlider").SliderProps,
111+
import("./dom/react-nodegui/src/components/Slider/RNSlider").RNSlider
112+
>;
113+
systemTrayIcon: SvelteNodeGUIProps<
114+
import("./dom/react-nodegui/src/components/SystemTrayIcon/RNSystemTrayIcon").SystemTrayIconProps,
115+
import("./dom/react-nodegui/src/components/SystemTrayIcon/RNSystemTrayIcon").RNSystemTrayIcon
116+
>;
117+
action: SvelteNodeGUIProps<
118+
import("./dom/react-nodegui/src/components/Action/RNAction").ActionProps,
119+
import("./dom/react-nodegui/src/components/Action/RNAction").RNAction
120+
>;
121+
boxView: SvelteNodeGUIProps<
122+
import("./dom/react-nodegui/src/components/BoxView/RNBoxView").BoxViewProps,
123+
import("./dom/react-nodegui/src/components/BoxView/RNBoxView").RNBoxView
124+
>;
125+
gridView: SvelteNodeGUIProps<
126+
import("./dom/react-nodegui/src/components/GridView/RNGridView").GridViewProps,
127+
import("./dom/react-nodegui/src/components/GridView/RNGridView").RNGridView
128+
>;
19129
}
20130
}

0 commit comments

Comments
 (0)