Skip to content

Commit e15377d

Browse files
committed
wip
Signed-off-by: Mior Muhammad Zaki <[email protected]>
1 parent 15ebf52 commit e15377d

24 files changed

+721
-240
lines changed

composer.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
},
1414
"require-dev": {
1515
"larastan/larastan": "^2.4",
16-
"laravel/nova": "^5.0",
16+
"laravel/nova": "dev-5/ts as 5.0.0",
1717
"laravel/pint": "^1.17",
1818
"orchestra/pest-plugin-testbench": "^2.0",
1919
"orchestra/testbench": "^8.24|^9.2",
@@ -34,8 +34,8 @@
3434
},
3535
"repositories": [
3636
{
37-
"type": "artifact",
38-
"url": "artifacts"
37+
"type": "vcs",
38+
"url": "https://github.com/laravel/nova"
3939
}
4040
],
4141
"config": {

tsconfig.json

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
{
22
// Change this to match your project
3-
"include": ["types/**/*"],
3+
"include": [
4+
"vendor/laravel/nova/resources/js/app.js",
5+
"vendor/laravel/nova/resources/js/util/FormValidation.js",
6+
"vendor/laravel/nova/resources/js/nova.js",
7+
"vendor/laravel/nova/resources/js/types.d.ts"
8+
],
49
"compilerOptions": {
510
// Tells TypeScript to read JS files, as
611
// normally they are ignored as source files
@@ -13,7 +18,7 @@
1318
// Types should go into this directory.
1419
// Removing this would place the .d.ts files
1520
// next to the .js files
16-
"outDir": "dist",
21+
"outDir": "types/dist",
1722
// go to js file when using IDE functions like
1823
// "Go to Definition" in VSCode
1924
"declarationMap": true

types/dist/app.d.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
export {};
2+
//# sourceMappingURL=app.d.ts.map

types/dist/app.d.ts.map

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

types/dist/components.d.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/**
2+
* @typedef {import('vue').App} VueApp
3+
*/
4+
/**
5+
* @param {VueApp} app
6+
*/
7+
export function registerViews(app: VueApp): void;
8+
export type VueApp = import("vue").App;
9+
//# sourceMappingURL=components.d.ts.map

types/dist/components.d.ts.map

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

types/dist/fields.d.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
/**
2+
* @param {VueApp} app
3+
*/
4+
export function registerFields(app: VueApp): void;
5+
export type VueApp = import("vue").App;
6+
//# sourceMappingURL=fields.d.ts.map

types/dist/fields.d.ts.map

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

types/dist/nova.d.ts

Lines changed: 258 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,258 @@
1+
/**
2+
* @typedef {import('vue').Component} VueComponent
3+
* @typedef {import('vue').DefineComponent} DefineComponent
4+
* @typedef {import('axios').AxiosInstance} AxiosInstance
5+
* @typedef {Object<string, any>} AppConfig
6+
* @typedef {import('./util/FormValidation').Form} Form
7+
*/
8+
export default class Nova {
9+
/**
10+
* @param {AppConfig} config
11+
*/
12+
constructor(config: AppConfig);
13+
/**
14+
* @protected
15+
* @type {Function[]}
16+
*/
17+
protected bootingCallbacks: Function[];
18+
/** @readonly */
19+
readonly appConfig: {
20+
[x: string]: any;
21+
};
22+
/**
23+
* @private
24+
* @type {boolean}
25+
*/
26+
private useShortcuts;
27+
/**
28+
* @protected
29+
* @type {{[key: string]: VueComponent|DefineComponent}}
30+
*/
31+
protected pages: {
32+
[key: string]: VueComponent | DefineComponent;
33+
};
34+
/** @protected */
35+
protected $toasted: any;
36+
/** @public */
37+
public $progress: any;
38+
/** @public */
39+
public $router: import("@inertiajs/core").Router;
40+
$testing: {
41+
timezone: (timezone: any) => void;
42+
};
43+
/**
44+
* Register a callback to be called before Nova starts. This is used to bootstrap
45+
* addons, tools, custom fields, or anything else Nova needs
46+
*
47+
* @param {Function} callback
48+
*/
49+
booting(callback: Function): void;
50+
/**
51+
* Execute all of the booting callbacks.
52+
*/
53+
boot(): void;
54+
store: import("vuex").Store<any>;
55+
/**
56+
* @param {Function} callback
57+
*/
58+
booted(callback: Function): void;
59+
countdown(): Promise<void>;
60+
/** @protected */
61+
protected mountTo: Element;
62+
/** @protected */
63+
protected app: import("vue").App<Element>;
64+
/**
65+
* Start the Nova app by calling each of the tool's callbacks and then creating
66+
* the underlying Vue instance.
67+
*/
68+
liftOff(): void;
69+
/** @private */
70+
private notificationPollingInterval;
71+
/**
72+
* Return configuration value from a key.
73+
*
74+
* @param {string} key
75+
* @returns {any}
76+
*/
77+
config(key: string): any;
78+
/**
79+
* Return a form object configured with Nova's preconfigured axios instance.
80+
*
81+
* @param {{[key: string]: any}} data
82+
* @returns {Form}
83+
*/
84+
form(data: {
85+
[key: string]: any;
86+
}): Form;
87+
/**
88+
* Return an axios instance configured to make requests to Nova's API
89+
* and handle certain response codes.
90+
*
91+
* @param {any} options
92+
* @returns {AxiosInstance}
93+
*/
94+
request(options: any): AxiosInstance;
95+
/**
96+
* Get the URL from base Nova prefix.
97+
*
98+
* @param {string} path
99+
* @param {any} parameters
100+
* @returns {string}
101+
*/
102+
url(path: string, parameters: any): string;
103+
/**
104+
* @returns {boolean}
105+
*/
106+
hasSecurityFeatures(): boolean;
107+
/**
108+
* Register a listener on Nova's built-in event bus
109+
*
110+
* @param {string} name
111+
* @param {Function} callback
112+
* @param {any} ctx
113+
*/
114+
$on(...args: any[]): void;
115+
/**
116+
* Register a one-time listener on the event bus
117+
*
118+
* @param {string} name
119+
* @param {Function} callback
120+
* @param {any} ctx
121+
*/
122+
$once(...args: any[]): void;
123+
/**
124+
* Unregister an listener on the event bus
125+
*
126+
* @param {string} name
127+
* @param {Function} callback
128+
*/
129+
$off(...args: any[]): void;
130+
/**
131+
* Emit an event on the event bus
132+
*
133+
* @param {string} name
134+
*/
135+
$emit(...args: any[]): void;
136+
/**
137+
* Determine if Nova is missing the requested resource with the given uri key
138+
*
139+
* @param {string} uriKey
140+
* @returns {boolean}
141+
*/
142+
missingResource(uriKey: string): boolean;
143+
/**
144+
* Register a keyboard shortcut.
145+
*
146+
* @param {string} keys
147+
* @param {Function} callback
148+
*/
149+
addShortcut(keys: string, callback: Function): void;
150+
/**
151+
* Unbind a keyboard shortcut.
152+
*
153+
* @param {string} keys
154+
*/
155+
disableShortcut(keys: string): void;
156+
/**
157+
* Pause all keyboard shortcuts.
158+
*/
159+
pauseShortcuts(): void;
160+
/**
161+
* Resume all keyboard shortcuts.
162+
*/
163+
resumeShortcuts(): void;
164+
/**
165+
* Register the built-in Vuex modules for each resource
166+
*/
167+
registerStoreModules(): void;
168+
/**
169+
* Register Inertia component.
170+
*
171+
* @param {string} name
172+
* @param {VueComponent|DefineComponent} component
173+
*/
174+
inertia(name: string, component: VueComponent | DefineComponent): void;
175+
/**
176+
* Register a custom Vue component.
177+
*
178+
* @param {string} name
179+
* @param {VueComponent|DefineComponent} component
180+
*/
181+
component(name: string, component: VueComponent | DefineComponent): void;
182+
/**
183+
* Check if custom Vue component exists.
184+
*
185+
* @param {string} name
186+
* @returns {boolean}
187+
*/
188+
hasComponent(name: string): boolean;
189+
/**
190+
* Show an error message to the user.
191+
*
192+
* @param {string} message
193+
*/
194+
info(message: string): void;
195+
/**
196+
* Show an error message to the user.
197+
*
198+
* @param {string} message
199+
*/
200+
error(message: string): void;
201+
/**
202+
* Show a success message to the user.
203+
*
204+
* @param {string} message
205+
*/
206+
success(message: string): void;
207+
/**
208+
* Show a warning message to the user.
209+
*
210+
* @param {string} message
211+
*/
212+
warning(message: string): void;
213+
/**
214+
* Format a number using numbro.js for consistent number formatting.
215+
*
216+
* @param {number} number
217+
* @param {Object|string} format
218+
* @returns {string}
219+
*/
220+
formatNumber(number: number, format: any | string): string;
221+
/**
222+
* Log a message to the console with the NOVA prefix
223+
*
224+
* @param {string} message
225+
* @param {string} [type=log]
226+
*/
227+
log(message: string, type?: string): void;
228+
/**
229+
* Log a message to the console for debugging purpose
230+
*
231+
* @param {any} message
232+
* @param {string} [type=log]
233+
*/
234+
debug(message: any, type?: string): void;
235+
/**
236+
* Redirect to login path.
237+
*/
238+
redirectToLogin(): void;
239+
/**
240+
* Visit page using Inertia visit or window.location for remote.
241+
*
242+
* @param {{url: string, remote: boolean} | string} path
243+
* @param {any} [options={}]
244+
*/
245+
visit(path: {
246+
url: string;
247+
remote: boolean;
248+
} | string, options?: any): void;
249+
applyTheme(): void;
250+
}
251+
export type VueComponent = import("vue").Component;
252+
export type DefineComponent = import("vue").DefineComponent;
253+
export type AxiosInstance = import("axios").AxiosInstance;
254+
export type AppConfig = {
255+
[x: string]: any;
256+
};
257+
export type Form = import("./util/FormValidation").Form;
258+
//# sourceMappingURL=nova.d.ts.map

types/dist/nova.d.ts.map

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)