Add more JS stuff to dom.nim (#13483)
* Add more JS stuff to dom.nim * Make all links to docs doc comments. * Fix minor textContent * space. * Remove Selection object. * More work on docs. * Fixing links. * Made the links be "see <docs>".
This commit is contained in:
parent
6b3098c378
commit
f2c7152770
1 changed files with 45 additions and 26 deletions
|
|
@ -40,8 +40,8 @@ type
|
||||||
onsubmit*: proc (event: Event) {.nimcall.}
|
onsubmit*: proc (event: Event) {.nimcall.}
|
||||||
onunload*: proc (event: Event) {.nimcall.}
|
onunload*: proc (event: Event) {.nimcall.}
|
||||||
|
|
||||||
# https://developer.mozilla.org/en-US/docs/Web/Events
|
|
||||||
DomEvent* {.pure.} = enum
|
DomEvent* {.pure.} = enum
|
||||||
|
## see `docs<https://developer.mozilla.org/en-US/docs/Web/Events>`_
|
||||||
Abort = "abort",
|
Abort = "abort",
|
||||||
BeforeInput = "beforeinput",
|
BeforeInput = "beforeinput",
|
||||||
Blur = "blur",
|
Blur = "blur",
|
||||||
|
|
@ -103,6 +103,8 @@ type
|
||||||
memory*: PerformanceMemory
|
memory*: PerformanceMemory
|
||||||
timing*: PerformanceTiming
|
timing*: PerformanceTiming
|
||||||
|
|
||||||
|
LocalStorage* {.importc.} = ref object
|
||||||
|
|
||||||
Window* = ref WindowObj
|
Window* = ref WindowObj
|
||||||
WindowObj {.importc.} = object of EventTargetObj
|
WindowObj {.importc.} = object of EventTargetObj
|
||||||
document*: Document
|
document*: Document
|
||||||
|
|
@ -129,6 +131,7 @@ type
|
||||||
screen*: Screen
|
screen*: Screen
|
||||||
performance*: Performance
|
performance*: Performance
|
||||||
onpopstate*: proc (event: Event)
|
onpopstate*: proc (event: Event)
|
||||||
|
localStorage*: LocalStorage
|
||||||
|
|
||||||
Frame* = ref FrameObj
|
Frame* = ref FrameObj
|
||||||
FrameObj {.importc.} = object of WindowObj
|
FrameObj {.importc.} = object of WindowObj
|
||||||
|
|
@ -165,10 +168,13 @@ type
|
||||||
parentNode*: Node
|
parentNode*: Node
|
||||||
previousSibling*: Node
|
previousSibling*: Node
|
||||||
innerHTML*: cstring
|
innerHTML*: cstring
|
||||||
|
innerText*: cstring
|
||||||
|
textContent*: cstring
|
||||||
style*: Style
|
style*: Style
|
||||||
|
|
||||||
Document* = ref DocumentObj
|
Document* = ref DocumentObj
|
||||||
DocumentObj {.importc.} = object of NodeObj
|
DocumentObj {.importc.} = object of NodeObj
|
||||||
|
activeElement*: Element
|
||||||
alinkColor*: cstring
|
alinkColor*: cstring
|
||||||
bgColor*: cstring
|
bgColor*: cstring
|
||||||
body*: Element
|
body*: Element
|
||||||
|
|
@ -211,8 +217,7 @@ type
|
||||||
offsetLeft*: int
|
offsetLeft*: int
|
||||||
offsetTop*: int
|
offsetTop*: int
|
||||||
|
|
||||||
# https://developer.mozilla.org/en-US/docs/Web/API/ValidityState
|
ValidityState* = ref ValidityStateObj ## see `docs<https://developer.mozilla.org/en-US/docs/Web/API/ValidityState>`_
|
||||||
ValidityState* = ref ValidityStateObj
|
|
||||||
ValidityStateObj {.importc.} = object
|
ValidityStateObj {.importc.} = object
|
||||||
badInput*: bool
|
badInput*: bool
|
||||||
customError*: bool
|
customError*: bool
|
||||||
|
|
@ -226,20 +231,24 @@ type
|
||||||
valid*: bool
|
valid*: bool
|
||||||
valueMissing*: bool
|
valueMissing*: bool
|
||||||
|
|
||||||
# https://developer.mozilla.org/en-US/docs/Web/API/Blob
|
Blob* = ref BlobObj ## see `docs<https://developer.mozilla.org/en-US/docs/Web/API/Blob>`_
|
||||||
Blob* = ref BlobObj
|
|
||||||
BlobObj {.importc.} = object of RootObj
|
BlobObj {.importc.} = object of RootObj
|
||||||
size*: int
|
size*: int
|
||||||
`type`*: cstring
|
`type`*: cstring
|
||||||
|
|
||||||
# https://developer.mozilla.org/en-US/docs/Web/API/File
|
File* = ref FileObj ## see `docs<https://developer.mozilla.org/en-US/docs/Web/API/File>`_
|
||||||
File* = ref FileObj
|
|
||||||
FileObj {.importc.} = object of Blob
|
FileObj {.importc.} = object of Blob
|
||||||
lastModified*: int
|
lastModified*: int
|
||||||
name*: cstring
|
name*: cstring
|
||||||
|
|
||||||
# https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement
|
TextAreaElement* = ref TextAreaElementObj ## see `docs<https://developer.mozilla.org/en-US/docs/Web/API/HTMLTextAreaElement>`_
|
||||||
InputElement* = ref InputElementObj
|
TextAreaElementObj {.importc.} = object of Element
|
||||||
|
value*: cstring
|
||||||
|
selectionStart*, selectionEnd*: int
|
||||||
|
selectionDirection*: cstring
|
||||||
|
rows*, cols*: int
|
||||||
|
|
||||||
|
InputElement* = ref InputElementObj ## see `docs<https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement>`_
|
||||||
InputElementObj {.importc.} = object of Element
|
InputElementObj {.importc.} = object of Element
|
||||||
# Properties related to the parent form
|
# Properties related to the parent form
|
||||||
formAction*: cstring
|
formAction*: cstring
|
||||||
|
|
@ -321,8 +330,7 @@ type
|
||||||
text*: cstring
|
text*: cstring
|
||||||
value*: cstring
|
value*: cstring
|
||||||
|
|
||||||
# https://developer.mozilla.org/en-US/docs/Web/API/HTMLFormElement
|
FormElement* = ref FormObj ## see `docs<https://developer.mozilla.org/en-US/docs/Web/API/HTMLFormElement>`_
|
||||||
FormElement* = ref FormObj
|
|
||||||
FormObj {.importc.} = object of ElementObj
|
FormObj {.importc.} = object of ElementObj
|
||||||
acceptCharset*: cstring
|
acceptCharset*: cstring
|
||||||
action*: cstring
|
action*: cstring
|
||||||
|
|
@ -354,6 +362,7 @@ type
|
||||||
backgroundImage*: cstring
|
backgroundImage*: cstring
|
||||||
backgroundPosition*: cstring
|
backgroundPosition*: cstring
|
||||||
backgroundRepeat*: cstring
|
backgroundRepeat*: cstring
|
||||||
|
backgroundSize*: cstring
|
||||||
border*: cstring
|
border*: cstring
|
||||||
borderBottom*: cstring
|
borderBottom*: cstring
|
||||||
borderBottomColor*: cstring
|
borderBottomColor*: cstring
|
||||||
|
|
@ -364,6 +373,7 @@ type
|
||||||
borderLeftColor*: cstring
|
borderLeftColor*: cstring
|
||||||
borderLeftStyle*: cstring
|
borderLeftStyle*: cstring
|
||||||
borderLeftWidth*: cstring
|
borderLeftWidth*: cstring
|
||||||
|
borderRadius*: cstring
|
||||||
borderRight*: cstring
|
borderRight*: cstring
|
||||||
borderRightColor*: cstring
|
borderRightColor*: cstring
|
||||||
borderRightStyle*: cstring
|
borderRightStyle*: cstring
|
||||||
|
|
@ -375,6 +385,8 @@ type
|
||||||
borderTopWidth*: cstring
|
borderTopWidth*: cstring
|
||||||
borderWidth*: cstring
|
borderWidth*: cstring
|
||||||
bottom*: cstring
|
bottom*: cstring
|
||||||
|
boxSizing*: cstring
|
||||||
|
boxShadow*: cstring
|
||||||
captionSide*: cstring
|
captionSide*: cstring
|
||||||
clear*: cstring
|
clear*: cstring
|
||||||
clip*: cstring
|
clip*: cstring
|
||||||
|
|
@ -409,7 +421,10 @@ type
|
||||||
minHeight*: cstring
|
minHeight*: cstring
|
||||||
minWidth*: cstring
|
minWidth*: cstring
|
||||||
opacity*: cstring
|
opacity*: cstring
|
||||||
|
outline*: cstring
|
||||||
overflow*: cstring
|
overflow*: cstring
|
||||||
|
overflowX*: cstring
|
||||||
|
overflowY*: cstring
|
||||||
padding*: cstring
|
padding*: cstring
|
||||||
paddingBottom*: cstring
|
paddingBottom*: cstring
|
||||||
paddingLeft*: cstring
|
paddingLeft*: cstring
|
||||||
|
|
@ -419,6 +434,7 @@ type
|
||||||
pageBreakBefore*: cstring
|
pageBreakBefore*: cstring
|
||||||
pointerEvents*: cstring
|
pointerEvents*: cstring
|
||||||
position*: cstring
|
position*: cstring
|
||||||
|
resize*: cstring
|
||||||
right*: cstring
|
right*: cstring
|
||||||
scrollbar3dLightColor*: cstring
|
scrollbar3dLightColor*: cstring
|
||||||
scrollbarArrowColor*: cstring
|
scrollbarArrowColor*: cstring
|
||||||
|
|
@ -447,8 +463,7 @@ type
|
||||||
AtTarget,
|
AtTarget,
|
||||||
BubblingPhase
|
BubblingPhase
|
||||||
|
|
||||||
# https://developer.mozilla.org/en-US/docs/Web/API/Event
|
Event* = ref EventObj ## see `docs<https://developer.mozilla.org/en-US/docs/Web/API/Event>`_
|
||||||
Event* = ref EventObj
|
|
||||||
EventObj {.importc.} = object of RootObj
|
EventObj {.importc.} = object of RootObj
|
||||||
bubbles*: bool
|
bubbles*: bool
|
||||||
cancelBubble*: bool
|
cancelBubble*: bool
|
||||||
|
|
@ -461,14 +476,12 @@ type
|
||||||
`type`*: cstring
|
`type`*: cstring
|
||||||
isTrusted*: bool
|
isTrusted*: bool
|
||||||
|
|
||||||
# https://developer.mozilla.org/en-US/docs/Web/API/UIEvent
|
UIEvent* = ref UIEventObj ## see `docs<https://developer.mozilla.org/en-US/docs/Web/API/UIEvent>`_
|
||||||
UIEvent* = ref UIEventObj
|
|
||||||
UIEventObj {.importc.} = object of Event
|
UIEventObj {.importc.} = object of Event
|
||||||
detail*: int64
|
detail*: int64
|
||||||
view*: Window
|
view*: Window
|
||||||
|
|
||||||
# https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent
|
KeyboardEvent* = ref KeyboardEventObj ## see `docs<https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent>`_
|
||||||
KeyboardEvent* = ref KeyboardEventObj
|
|
||||||
KeyboardEventObj {.importc.} = object of UIEvent
|
KeyboardEventObj {.importc.} = object of UIEvent
|
||||||
altKey*, ctrlKey*, metaKey*, shiftKey*: bool
|
altKey*, ctrlKey*, metaKey*, shiftKey*: bool
|
||||||
code*: cstring
|
code*: cstring
|
||||||
|
|
@ -477,8 +490,7 @@ type
|
||||||
keyCode*: int
|
keyCode*: int
|
||||||
location*: int
|
location*: int
|
||||||
|
|
||||||
# https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key/Key_Values
|
KeyboardEventKey* {.pure.} = enum ## see `docs<https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key/Key_Values>`_
|
||||||
KeyboardEventKey* {.pure.} = enum
|
|
||||||
# Modifier keys
|
# Modifier keys
|
||||||
Alt,
|
Alt,
|
||||||
AltGraph,
|
AltGraph,
|
||||||
|
|
@ -832,8 +844,7 @@ type
|
||||||
FourthButton = 8,
|
FourthButton = 8,
|
||||||
FifthButton = 16
|
FifthButton = 16
|
||||||
|
|
||||||
# https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent
|
MouseEvent* = ref MouseEventObj ## see `docs<https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent>`_
|
||||||
MouseEvent* = ref MouseEventObj
|
|
||||||
MouseEventObj {.importc.} = object of UIEvent
|
MouseEventObj {.importc.} = object of UIEvent
|
||||||
altKey*, ctrlKey*, metaKey*, shiftKey*: bool
|
altKey*, ctrlKey*, metaKey*, shiftKey*: bool
|
||||||
button*: int
|
button*: int
|
||||||
|
|
@ -851,14 +862,12 @@ type
|
||||||
File = "file",
|
File = "file",
|
||||||
String = "string"
|
String = "string"
|
||||||
|
|
||||||
# https://developer.mozilla.org/en-US/docs/Web/API/DataTransferItem
|
DataTransferItem* = ref DataTransferItemObj ## see `docs<https://developer.mozilla.org/en-US/docs/Web/API/DataTransferItem>`_
|
||||||
DataTransferItem* = ref DataTransferItemObj
|
|
||||||
DataTransferItemObj {.importc.} = object of RootObj
|
DataTransferItemObj {.importc.} = object of RootObj
|
||||||
kind*: cstring
|
kind*: cstring
|
||||||
`type`*: cstring
|
`type`*: cstring
|
||||||
|
|
||||||
# https://developer.mozilla.org/en-US/docs/Web/API/DataTransfer
|
DataTransfer* = ref DataTransferObj ## see `docs<https://developer.mozilla.org/en-US/docs/Web/API/DataTransfer>`_
|
||||||
DataTransfer* = ref DataTransferObj
|
|
||||||
DataTransferObj {.importc.} = object of RootObj
|
DataTransferObj {.importc.} = object of RootObj
|
||||||
dropEffect*: cstring
|
dropEffect*: cstring
|
||||||
effectAllowed*: cstring
|
effectAllowed*: cstring
|
||||||
|
|
@ -893,8 +902,8 @@ type
|
||||||
DragStart = "dragstart",
|
DragStart = "dragstart",
|
||||||
Drop = "drop"
|
Drop = "drop"
|
||||||
|
|
||||||
# https://developer.mozilla.org/en-US/docs/Web/API/DragEvent
|
|
||||||
DragEvent* {.importc.} = object of MouseEvent
|
DragEvent* {.importc.} = object of MouseEvent
|
||||||
|
## see `docs<https://developer.mozilla.org/en-US/docs/Web/API/DragEvent>`_
|
||||||
dataTransfer*: DataTransfer
|
dataTransfer*: DataTransfer
|
||||||
|
|
||||||
TouchList* {.importc.} = ref object of RootObj
|
TouchList* {.importc.} = ref object of RootObj
|
||||||
|
|
@ -1223,6 +1232,16 @@ proc checkValidity*(e: InputElement): bool
|
||||||
# Blob "methods"
|
# Blob "methods"
|
||||||
proc slice*(e: Blob, startindex: int = 0, endindex: int = e.size, contentType: cstring = "")
|
proc slice*(e: Blob, startindex: int = 0, endindex: int = e.size, contentType: cstring = "")
|
||||||
|
|
||||||
|
# Performance "methods"
|
||||||
|
proc now*(p: Performance): float
|
||||||
|
|
||||||
|
# LocalStorage "methods"
|
||||||
|
proc getItem*(ls: LocalStorage, key: cstring): cstring
|
||||||
|
proc setItem*(ls: LocalStorage, key, value: cstring)
|
||||||
|
proc hasItem*(ls: LocalStorage, key: cstring): bool
|
||||||
|
proc clear*(ls: LocalStorage)
|
||||||
|
proc removeItem*(ls: LocalStorage, key: cstring)
|
||||||
|
|
||||||
{.pop.}
|
{.pop.}
|
||||||
|
|
||||||
proc setAttr*(n: Node; key, val: cstring) {.importcpp: "#.setAttribute(@)".}
|
proc setAttr*(n: Node; key, val: cstring) {.importcpp: "#.setAttribute(@)".}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue