Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
dotgreg
tiro-notes
Commits
534203b4
Commit
534203b4
authored
May 22, 2022
by
greg@1m
Browse files
wip on doc generation based on typedoc json
parent
9d5f882b
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
client/docs.json
0 → 100644
View file @
534203b4
This diff is collapsed.
Click to expand it.
client/src/hooks/api/api.hook.tsx
View file @
534203b4
...
...
@@ -16,43 +16,6 @@ import { iSearchApi, useSearchApi } from './search.hook.api';
import
{
iStatusApi
}
from
'
./status.api.hook
'
;
import
{
iUploadApi
,
useUploadApi
}
from
'
./upload.api.hook
'
;
import
{
getFunctionParamNames
}
from
'
../../managers/functions.manager
'
;
import
{
z
}
from
"
zod
"
;
const
User
=
z
.
object
({
username
:
z
.
string
()
});
export
type
iUser
=
z
.
infer
<
typeof
User
>
const
myFunction
=
z
.
function
()
.
args
(
z
.
string
(),
z
.
number
())
// accepts an arbitrary number of arguments
.
returns
(
z
.
boolean
());
//@ts-ignore
window
.
myfun
=
myFunction
type
myFunction
=
z
.
infer
<
typeof
myFunction
>
;
// console.log(122222333, User, myFunction, JSON.stringify(myFunction.returnType()), myFunction.returnType()._def.typeName);
// en gros je peux creer des types et objets
// en deduire des types
// et je peux generer une docuentation
const
nestedObj
=
z
.
object
({
prop1
:
z
.
number
(),
prop2
:
z
.
string
(),
})
const
myBiggerObject
=
z
.
object
({
user
:
z
.
string
(),
age
:
z
.
number
().
optional
(),
fun
:
myFunction
,
nested
:
nestedObj
})
//@ts-ignore
window
.
test2
=
myBiggerObject
// console.log(122222333, z.(myBiggerObject));
// console.log(122222333, typeof myBiggerObject, JSON.stringify(myBiggerObject));
...
...
client/src/hooks/app/usePromptPopup.hook.tsx
View file @
534203b4
import
React
,
{
useEffect
,
useRef
,
useState
}
from
'
react
'
;
import
{
Popup
}
from
'
../../components/Popup.component
'
;
import
z
,
{
Function
,
obj
,
fn
,
string
,
number
,
boolean
}
from
"
../../managers/types.manager
"
;
import
{
strings
}
from
'
../../managers/strings.manager
'
;
const
liveVars
:
{
onAccept
:
Function
,
...
...
@@ -10,42 +11,15 @@ const liveVars: {
onRefuse
:
()
=>
{
},
}
// INTERFACES
const
zPrompt
=
z
.
function
()
.
args
(
z
.
object
({
text
:
string
,
title
:
string
.
optional
(),
onAccept
:
fn
.
optional
(),
onRefuse
:
fn
.
optional
()
}))
.
returns
(
z
.
void
())
const
zConfirmPopup
=
z
.
function
().
args
(
z
.
string
({
description
:
"
woop
"
}),
z
.
number
({
description
:
"
wooop2
"
})).
returns
(
z
.
void
())
// const test = z.function().args(z.string().describe("woo"))
const
test
=
z
.
function
().
args
(
z
.
string
({}))
type
iTest
=
z
.
infer
<
typeof
test
>
type
iPrompt
=
z
.
infer
<
typeof
zPrompt
>
type
iConfirm
=
z
.
infer
<
typeof
zConfirmPopup
>
export
type
iPrompt
=
(
p
:
{
text
:
string
,
title
?:
string
,
onAccept
?:
Function
,
onRefuse
?:
Function
})
=>
void
export
type
iConfirmPopup
=
(
text
:
string
,
cb
:
Function
)
=>
void
export
type
iPopupApi
=
{
confirm
:
iConfirmPopup
,
prompt
:
iPrompt
}
// old
// export type iPrompt = (p: {
// text: string,
// title?: string,
// onAccept?: Function,
// onRefuse?: Function
// }) => void
export
const
PopupContext
=
React
.
createContext
<
iPopupApi
|
null
>
(
null
);
export
const
usePromptPopup
=
(
p
:
{
})
=>
{
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment