amateras 0.7.3 → 0.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (257) hide show
  1. package/README.md +76 -85
  2. package/package.json +27 -21
  3. package/tsconfig.json +4 -3
  4. package/packages/core/package.json +0 -32
  5. package/packages/core/src/env.browser.ts +0 -21
  6. package/packages/core/src/env.node.ts +0 -21
  7. package/packages/core/src/global.ts +0 -18
  8. package/packages/core/src/index.ts +0 -96
  9. package/packages/core/src/lib/assignNodeProperties.ts +0 -11
  10. package/packages/core/src/lib/assignProperties.ts +0 -57
  11. package/packages/core/src/lib/chain.ts +0 -17
  12. package/packages/core/src/lib/dom.ts +0 -20
  13. package/packages/core/src/main.ts +0 -4
  14. package/packages/core/src/node/$Element.ts +0 -366
  15. package/packages/core/src/node/$EventTarget.ts +0 -48
  16. package/packages/core/src/node/$HTMLElement.ts +0 -99
  17. package/packages/core/src/node/$Node.ts +0 -201
  18. package/packages/core/src/node/$Virtual.ts +0 -65
  19. package/packages/css/README.md +0 -128
  20. package/packages/css/package.json +0 -17
  21. package/packages/css/src/ext/colors/amber.ts +0 -25
  22. package/packages/css/src/ext/colors/blackwhite.ts +0 -13
  23. package/packages/css/src/ext/colors/blue.ts +0 -25
  24. package/packages/css/src/ext/colors/cyan.ts +0 -25
  25. package/packages/css/src/ext/colors/emerald.ts +0 -25
  26. package/packages/css/src/ext/colors/fuchsia.ts +0 -25
  27. package/packages/css/src/ext/colors/gray.ts +0 -25
  28. package/packages/css/src/ext/colors/green.ts +0 -25
  29. package/packages/css/src/ext/colors/indigo.ts +0 -25
  30. package/packages/css/src/ext/colors/lime.ts +0 -25
  31. package/packages/css/src/ext/colors/neutral.ts +0 -25
  32. package/packages/css/src/ext/colors/orange.ts +0 -25
  33. package/packages/css/src/ext/colors/pink.ts +0 -25
  34. package/packages/css/src/ext/colors/purple.ts +0 -25
  35. package/packages/css/src/ext/colors/red.ts +0 -25
  36. package/packages/css/src/ext/colors/rose.ts +0 -25
  37. package/packages/css/src/ext/colors/sky.ts +0 -25
  38. package/packages/css/src/ext/colors/slate.ts +0 -25
  39. package/packages/css/src/ext/colors/stone.ts +0 -25
  40. package/packages/css/src/ext/colors/teal.ts +0 -25
  41. package/packages/css/src/ext/colors/violet.ts +0 -25
  42. package/packages/css/src/ext/colors/yellow.ts +0 -25
  43. package/packages/css/src/ext/colors/zinc.ts +0 -25
  44. package/packages/css/src/ext/colors.ts +0 -23
  45. package/packages/css/src/ext/container.ts +0 -32
  46. package/packages/css/src/ext/keyframes.ts +0 -54
  47. package/packages/css/src/ext/media.ts +0 -32
  48. package/packages/css/src/ext/property.ts +0 -48
  49. package/packages/css/src/ext/variable.ts +0 -51
  50. package/packages/css/src/index.ts +0 -436
  51. package/packages/css/src/lib/colorAssign.ts +0 -6
  52. package/packages/css/src/lib/utils.ts +0 -11
  53. package/packages/css/src/structure/$CSSContainerRule.ts +0 -13
  54. package/packages/css/src/structure/$CSSDeclaration.ts +0 -16
  55. package/packages/css/src/structure/$CSSKeyframesRule.ts +0 -13
  56. package/packages/css/src/structure/$CSSMediaRule.ts +0 -10
  57. package/packages/css/src/structure/$CSSProperty.ts +0 -19
  58. package/packages/css/src/structure/$CSSRule.ts +0 -13
  59. package/packages/css/src/structure/$CSSStyleRule.ts +0 -14
  60. package/packages/css/src/structure/$CSSVariable.ts +0 -30
  61. package/packages/dom/package.json +0 -20
  62. package/packages/dom/src/lib/HTMLElementMap.ts +0 -213
  63. package/packages/dom/src/lib/assignAttributes.ts +0 -16
  64. package/packages/dom/src/structure/CSS.ts +0 -7
  65. package/packages/dom/src/structure/CSSStyleSheet.ts +0 -10
  66. package/packages/dom/src/structure/DOMTokenList.ts +0 -19
  67. package/packages/dom/src/structure/Document.ts +0 -36
  68. package/packages/dom/src/structure/Element.ts +0 -106
  69. package/packages/dom/src/structure/HTMLElement.ts +0 -34
  70. package/packages/dom/src/structure/History.ts +0 -11
  71. package/packages/dom/src/structure/Location.ts +0 -9
  72. package/packages/dom/src/structure/Node.ts +0 -51
  73. package/packages/dom/src/structure/NodeList.ts +0 -10
  74. package/packages/dom/src/structure/Storage.ts +0 -8
  75. package/packages/dom/src/structure/Text.ts +0 -20
  76. package/packages/dom/src/structure/Window.ts +0 -14
  77. package/packages/dom/src/structure/html/HTMLAbbrElement.ts +0 -16
  78. package/packages/dom/src/structure/html/HTMLAddressElement.ts +0 -16
  79. package/packages/dom/src/structure/html/HTMLAnchorElement.ts +0 -25
  80. package/packages/dom/src/structure/html/HTMLAreaElement.ts +0 -26
  81. package/packages/dom/src/structure/html/HTMLArticleElement.ts +0 -16
  82. package/packages/dom/src/structure/html/HTMLAsideElement.ts +0 -16
  83. package/packages/dom/src/structure/html/HTMLAudioElement.ts +0 -16
  84. package/packages/dom/src/structure/html/HTMLBDIElement.ts +0 -16
  85. package/packages/dom/src/structure/html/HTMLBDOElement.ts +0 -16
  86. package/packages/dom/src/structure/html/HTMLBElement.ts +0 -16
  87. package/packages/dom/src/structure/html/HTMLBRElement.ts +0 -17
  88. package/packages/dom/src/structure/html/HTMLBaseElement.ts +0 -18
  89. package/packages/dom/src/structure/html/HTMLBodyElement.ts +0 -22
  90. package/packages/dom/src/structure/html/HTMLButtonElement.ts +0 -26
  91. package/packages/dom/src/structure/html/HTMLCanvasElement.ts +0 -18
  92. package/packages/dom/src/structure/html/HTMLCiteElement.ts +0 -16
  93. package/packages/dom/src/structure/html/HTMLCodeElement.ts +0 -16
  94. package/packages/dom/src/structure/html/HTMLDDElement.ts +0 -16
  95. package/packages/dom/src/structure/html/HTMLDFNElement.ts +0 -16
  96. package/packages/dom/src/structure/html/HTMLDListElement.ts +0 -17
  97. package/packages/dom/src/structure/html/HTMLDTElement.ts +0 -16
  98. package/packages/dom/src/structure/html/HTMLDataElement.ts +0 -17
  99. package/packages/dom/src/structure/html/HTMLDataListElement.ts +0 -16
  100. package/packages/dom/src/structure/html/HTMLDetailsElement.ts +0 -17
  101. package/packages/dom/src/structure/html/HTMLDialogElement.ts +0 -18
  102. package/packages/dom/src/structure/html/HTMLDivElement.ts +0 -17
  103. package/packages/dom/src/structure/html/HTMLEMElement.ts +0 -16
  104. package/packages/dom/src/structure/html/HTMLEmbedElement.ts +0 -20
  105. package/packages/dom/src/structure/html/HTMLFieldSetElement.ts +0 -19
  106. package/packages/dom/src/structure/html/HTMLFigCaptionElement.ts +0 -16
  107. package/packages/dom/src/structure/html/HTMLFigureElement.ts +0 -16
  108. package/packages/dom/src/structure/html/HTMLFooterElement.ts +0 -16
  109. package/packages/dom/src/structure/html/HTMLFormElement.ts +0 -24
  110. package/packages/dom/src/structure/html/HTMLHGroupElement.ts +0 -16
  111. package/packages/dom/src/structure/html/HTMLHRElement.ts +0 -21
  112. package/packages/dom/src/structure/html/HTMLHeadElement.ts +0 -16
  113. package/packages/dom/src/structure/html/HTMLHeaderElement.ts +0 -16
  114. package/packages/dom/src/structure/html/HTMLHeadingElement.ts +0 -17
  115. package/packages/dom/src/structure/html/HTMLHtmlElement.ts +0 -18
  116. package/packages/dom/src/structure/html/HTMLIElement.ts +0 -16
  117. package/packages/dom/src/structure/html/HTMLIFrameElement.ts +0 -31
  118. package/packages/dom/src/structure/html/HTMLImageElement.ts +0 -38
  119. package/packages/dom/src/structure/html/HTMLInputElement.ts +0 -55
  120. package/packages/dom/src/structure/html/HTMLKBDElement.ts +0 -16
  121. package/packages/dom/src/structure/html/HTMLLIElement.ts +0 -18
  122. package/packages/dom/src/structure/html/HTMLLabelElement.ts +0 -18
  123. package/packages/dom/src/structure/html/HTMLLegendElement.ts +0 -17
  124. package/packages/dom/src/structure/html/HTMLLinkElement.ts +0 -31
  125. package/packages/dom/src/structure/html/HTMLMainElement.ts +0 -16
  126. package/packages/dom/src/structure/html/HTMLMapElement.ts +0 -17
  127. package/packages/dom/src/structure/html/HTMLMarkElement.ts +0 -16
  128. package/packages/dom/src/structure/html/HTMLMediaElement.ts +0 -48
  129. package/packages/dom/src/structure/html/HTMLMenuElement.ts +0 -18
  130. package/packages/dom/src/structure/html/HTMLMetaElement.ts +0 -22
  131. package/packages/dom/src/structure/html/HTMLMeterElement.ts +0 -23
  132. package/packages/dom/src/structure/html/HTMLModElement.ts +0 -18
  133. package/packages/dom/src/structure/html/HTMLNavElement.ts +0 -16
  134. package/packages/dom/src/structure/html/HTMLNoscriptElement.ts +0 -16
  135. package/packages/dom/src/structure/html/HTMLOListElement.ts +0 -20
  136. package/packages/dom/src/structure/html/HTMLObjectElement.ts +0 -34
  137. package/packages/dom/src/structure/html/HTMLOptGroupElement.ts +0 -18
  138. package/packages/dom/src/structure/html/HTMLOptionElement.ts +0 -20
  139. package/packages/dom/src/structure/html/HTMLOutputElement.ts +0 -20
  140. package/packages/dom/src/structure/html/HTMLParagraphElement.ts +0 -17
  141. package/packages/dom/src/structure/html/HTMLPictureElement.ts +0 -16
  142. package/packages/dom/src/structure/html/HTMLPreElement.ts +0 -17
  143. package/packages/dom/src/structure/html/HTMLProgressElement.ts +0 -19
  144. package/packages/dom/src/structure/html/HTMLQuoteElement.ts +0 -17
  145. package/packages/dom/src/structure/html/HTMLRPElement.ts +0 -16
  146. package/packages/dom/src/structure/html/HTMLRTElement.ts +0 -16
  147. package/packages/dom/src/structure/html/HTMLRubyElement.ts +0 -16
  148. package/packages/dom/src/structure/html/HTMLSElement.ts +0 -16
  149. package/packages/dom/src/structure/html/HTMLSampElement.ts +0 -16
  150. package/packages/dom/src/structure/html/HTMLScriptElement.ts +0 -27
  151. package/packages/dom/src/structure/html/HTMLSectionElement.ts +0 -16
  152. package/packages/dom/src/structure/html/HTMLSelectElement.ts +0 -27
  153. package/packages/dom/src/structure/html/HTMLSlotElement.ts +0 -17
  154. package/packages/dom/src/structure/html/HTMLSmallElement.ts +0 -16
  155. package/packages/dom/src/structure/html/HTMLSourceElement.ts +0 -21
  156. package/packages/dom/src/structure/html/HTMLSpanElement.ts +0 -16
  157. package/packages/dom/src/structure/html/HTMLStrongElement.ts +0 -16
  158. package/packages/dom/src/structure/html/HTMLStyleElement.ts +0 -18
  159. package/packages/dom/src/structure/html/HTMLSubElement.ts +0 -16
  160. package/packages/dom/src/structure/html/HTMLSummaryElement.ts +0 -16
  161. package/packages/dom/src/structure/html/HTMLSupElement.ts +0 -16
  162. package/packages/dom/src/structure/html/HTMLTableCaptionElement.ts +0 -17
  163. package/packages/dom/src/structure/html/HTMLTableCellElement.ts +0 -31
  164. package/packages/dom/src/structure/html/HTMLTableColElement.ts +0 -23
  165. package/packages/dom/src/structure/html/HTMLTableElement.ts +0 -26
  166. package/packages/dom/src/structure/html/HTMLTableRowElement.ts +0 -23
  167. package/packages/dom/src/structure/html/HTMLTableSectionElement.ts +0 -20
  168. package/packages/dom/src/structure/html/HTMLTemplateElement.ts +0 -17
  169. package/packages/dom/src/structure/html/HTMLTextAreaElement.ts +0 -33
  170. package/packages/dom/src/structure/html/HTMLTimeElement.ts +0 -17
  171. package/packages/dom/src/structure/html/HTMLTitleElement.ts +0 -17
  172. package/packages/dom/src/structure/html/HTMLTrackElement.ts +0 -21
  173. package/packages/dom/src/structure/html/HTMLUElement.ts +0 -16
  174. package/packages/dom/src/structure/html/HTMLUListElement.ts +0 -18
  175. package/packages/dom/src/structure/html/HTMLVarElement.ts +0 -16
  176. package/packages/dom/src/structure/html/HTMLVideoElement.ts +0 -22
  177. package/packages/dom/src/structure/html/HTMLWBRElement.ts +0 -16
  178. package/packages/html/package.json +0 -18
  179. package/packages/html/src/index.ts +0 -13
  180. package/packages/html/src/node/$Anchor.ts +0 -49
  181. package/packages/html/src/node/$Canvas.ts +0 -38
  182. package/packages/html/src/node/$Dialog.ts +0 -16
  183. package/packages/html/src/node/$Form.ts +0 -16
  184. package/packages/html/src/node/$Image.ts +0 -72
  185. package/packages/html/src/node/$Input.ts +0 -193
  186. package/packages/html/src/node/$Label.ts +0 -25
  187. package/packages/html/src/node/$Media.ts +0 -16
  188. package/packages/html/src/node/$OptGroup.ts +0 -23
  189. package/packages/html/src/node/$Option.ts +0 -40
  190. package/packages/html/src/node/$Select.ts +0 -76
  191. package/packages/html/src/node/$TextArea.ts +0 -16
  192. package/packages/i18n/README.md +0 -73
  193. package/packages/i18n/package.json +0 -19
  194. package/packages/i18n/src/index.ts +0 -140
  195. package/packages/i18n/src/structure/I18n.ts +0 -44
  196. package/packages/i18n/src/structure/I18nDictionary.ts +0 -31
  197. package/packages/i18n/src/structure/I18nTranslation.ts +0 -41
  198. package/packages/idb/README.md +0 -127
  199. package/packages/idb/package.json +0 -19
  200. package/packages/idb/src/core.ts +0 -6
  201. package/packages/idb/src/index.ts +0 -17
  202. package/packages/idb/src/lib/$IDBRequest.ts +0 -8
  203. package/packages/idb/src/structure/$IDB.ts +0 -63
  204. package/packages/idb/src/structure/$IDBCursor.ts +0 -34
  205. package/packages/idb/src/structure/$IDBIndex.ts +0 -48
  206. package/packages/idb/src/structure/$IDBStore.ts +0 -103
  207. package/packages/idb/src/structure/$IDBStoreBase.ts +0 -30
  208. package/packages/idb/src/structure/$IDBTransaction.ts +0 -38
  209. package/packages/idb/src/structure/builder/$IDBBuilder.ts +0 -229
  210. package/packages/idb/src/structure/builder/$IDBStoreBuilder.ts +0 -100
  211. package/packages/markdown/README.md +0 -53
  212. package/packages/markdown/package.json +0 -19
  213. package/packages/markdown/src/index.ts +0 -3
  214. package/packages/markdown/src/lib/type.ts +0 -26
  215. package/packages/markdown/src/lib/util.ts +0 -21
  216. package/packages/markdown/src/structure/Markdown.ts +0 -54
  217. package/packages/markdown/src/structure/MarkdownLexer.ts +0 -111
  218. package/packages/markdown/src/structure/MarkdownParser.ts +0 -34
  219. package/packages/markdown/src/syntax/alert.ts +0 -46
  220. package/packages/markdown/src/syntax/blockquote.ts +0 -35
  221. package/packages/markdown/src/syntax/bold.ts +0 -11
  222. package/packages/markdown/src/syntax/code.ts +0 -11
  223. package/packages/markdown/src/syntax/codeblock.ts +0 -44
  224. package/packages/markdown/src/syntax/heading.ts +0 -14
  225. package/packages/markdown/src/syntax/horizontalRule.ts +0 -11
  226. package/packages/markdown/src/syntax/image.ts +0 -23
  227. package/packages/markdown/src/syntax/italic.ts +0 -11
  228. package/packages/markdown/src/syntax/link.ts +0 -46
  229. package/packages/markdown/src/syntax/list.ts +0 -121
  230. package/packages/markdown/src/syntax/table.ts +0 -67
  231. package/packages/markdown/src/syntax/text.ts +0 -19
  232. package/packages/router/README.md +0 -175
  233. package/packages/router/package.json +0 -19
  234. package/packages/router/src/index.ts +0 -68
  235. package/packages/router/src/node/Page.ts +0 -38
  236. package/packages/router/src/node/Router.ts +0 -212
  237. package/packages/router/src/node/RouterAnchor.ts +0 -24
  238. package/packages/router/src/structure/PageBuilder.ts +0 -24
  239. package/packages/router/src/structure/Route.ts +0 -105
  240. package/packages/signal/README.md +0 -93
  241. package/packages/signal/package.json +0 -18
  242. package/packages/signal/src/index.ts +0 -221
  243. package/packages/signal/src/structure/Signal.ts +0 -38
  244. package/packages/ui/lib/VirtualScroll.ts +0 -25
  245. package/packages/ui/node/Accordian.ts +0 -97
  246. package/packages/ui/node/Carousel.ts +0 -20
  247. package/packages/ui/node/Form.ts +0 -54
  248. package/packages/ui/node/Grid.ts +0 -0
  249. package/packages/ui/node/Modal.ts +0 -45
  250. package/packages/ui/node/Table.ts +0 -43
  251. package/packages/ui/node/Tabs.ts +0 -129
  252. package/packages/ui/node/Toast.ts +0 -16
  253. package/packages/ui/node/Waterfall.ts +0 -94
  254. package/packages/ui/package.json +0 -21
  255. package/packages/utils/package.json +0 -17
  256. package/packages/utils/src/global.ts +0 -25
  257. package/packages/utils/src/index.ts +0 -90
@@ -1,366 +0,0 @@
1
- import { _Array_from, _instanceof, _Object_assign, _Object_entries, _Object_fromEntries, forEach, isNull, isNumber, isString, isUndefined } from "@amateras/utils";
2
- import { _document } from "#env";
3
- import { $Node } from "./$Node";
4
-
5
- export class $Element<Ele extends Element = Element, EvMap = ElementEventMap> extends $Node<EvMap> {
6
- declare node: Ele
7
- constructor(resolver: Ele | string) {
8
- super(_instanceof(resolver, Element) ? resolver : createNode(resolver) as unknown as Ele)
9
- //@ts-expect-error
10
- this.node.$ = this;
11
- }
12
-
13
- attr(): {[key: string]: string};
14
- attr(key: string): string | null;
15
- attr(obj: {[key: string]: $Parameter<any| null>}): this;
16
- attr(resolver?: {[key: string]: $Parameter<any | null>} | string) {
17
- if (!arguments.length) return _Object_fromEntries(_Array_from(this.attributes).map(attr => [attr.name, attr.value]));
18
- if (isString(resolver)) return this.getAttribute(resolver);
19
- if (resolver)
20
- keyIterate: for (let [key, value] of _Object_entries(resolver)) {
21
- const set = (value: string | number | boolean | null | undefined) => {
22
- if (!isUndefined(value) && isNull(value)) this.removeAttribute(key);
23
- else this.setAttribute(key, `${value}`);
24
- }
25
- for (const setter of $Node.setters) {
26
- const result = setter(value, set);
27
- if (!isUndefined(result)) { set(result); continue keyIterate; }
28
- }
29
- set(value as any);
30
- }
31
- return this;
32
- }
33
-
34
- class(...token: (string | null | undefined)[]) {
35
- return this.classList(token.filter(isString).join(' '));
36
- }
37
-
38
- addClass(...token: (string | null | undefined)[]) {
39
- this.classList().add(...token.filter(isString));
40
- return this;
41
- }
42
-
43
- removeClass(...token: (string | null | undefined)[]) {
44
- this.classList().remove(...token.filter(isString));
45
- return this;
46
- }
47
-
48
- toString() {
49
- return this.outerHTML();
50
- }
51
-
52
- animate(keyframes: Keyframe[] | PropertyIndexedKeyframes | null, options?: number | KeyframeAnimationOptions & { callback?: (animation: Animation) => void }) {
53
- const animation = this.node.animate(keyframes, options);
54
- if (!isNumber(options)) options?.callback?.(animation);
55
- return this;
56
- }
57
- }
58
-
59
- function createNode(nodeName: string) {
60
- return !_document
61
- //@ts-expect-error
62
- ? new Node(nodeName) as unknown as Node & ChildNode
63
- : _document.createElement(nodeName);
64
- }
65
-
66
- export interface $Element<Ele extends Element, EvMap = ElementEventMap> {
67
- /** {@link Element.attributes} */
68
- readonly attributes: NamedNodeMap;
69
- /** {@link Element.clientHeight} */
70
- readonly clientHeight: number;
71
- /** {@link Element.clientLeft} */
72
- readonly clientLeft: number;
73
- /** {@link Element.clientTop} */
74
- readonly clientTop: number;
75
- /** {@link Element.clientWidth} */
76
- readonly clientWidth: number;
77
- /** {@link Element.currentCSSZoom} */
78
- readonly currentCSSZoom: number;
79
- /** {@link Element.localName} */
80
- readonly localName: string;
81
- /** {@link Element.namespaceURI} */
82
- readonly namespaceURI: string | null;
83
- /** {@link Element.prefix} */
84
- readonly prefix: string | null;
85
- /** {@link Element.ownerDocument} */
86
- readonly ownerDocument: Document;
87
- /** {@link Element.scrollHeight} */
88
- readonly scrollHeight: number;
89
- /** {@link Element.scrollWidth} */
90
- readonly scrollWidth: number;
91
- /** {@link Element.shadowRoot} */
92
- readonly shadowRoot: ShadowRoot | null;
93
- /** {@link Element.tagName} */
94
- readonly tagName: string;
95
- /** {@link Element.nextElementSibling} */
96
- readonly nextElementSibling: Element | null;
97
- /** {@link Element.previousElementSibling} */
98
- readonly previousElementSibling: Element | null;
99
- /** {@link Element.childElementCount} */
100
- readonly childElementCount: number;
101
- /** {@link Element.children} */
102
- readonly children: HTMLCollection;
103
- /** {@link Element.firstElementChild} */
104
- readonly firstElementChild: Element | null;
105
- /** {@link Element.lastElementChild} */
106
- readonly lastElementChild: Element | null;
107
- /** {@link Element.assignedSlot} */
108
- readonly assignedSlot: HTMLSlotElement | null;
109
-
110
- /** {@link Element.attachShadow} */
111
- attachShadow(init: ShadowRootInit): ShadowRoot;
112
- /** {@link Element.checkVisibility} */
113
- checkVisibility(options?: CheckVisibilityOptions): boolean;
114
- /** {@link Element.closest} */
115
- closest<K extends keyof HTMLElementTagNameMap>(selector: K): HTMLElementTagNameMap[K] | null;
116
- closest<K extends keyof SVGElementTagNameMap>(selector: K): SVGElementTagNameMap[K] | null;
117
- closest<K extends keyof MathMLElementTagNameMap>(selector: K): MathMLElementTagNameMap[K] | null;
118
- closest<E extends Element = Element>(selectors: string): E | null;
119
- /** {@link Element.computedStyleMap} */
120
- computedStyleMap(): StylePropertyMapReadOnly;
121
- /** {@link Element.getAttribute} */
122
- getAttribute(qualifiedName: string): string | null;
123
- /** {@link Element.getAttributeNS} */
124
- getAttributeNS(namespace: string | null, localName: string): string | null;
125
- /** {@link Element.getAttributeNames} */
126
- getAttributeNames(): string[];
127
- /** {@link Element.getAttributeNode} */
128
- getAttributeNode(qualifiedName: string): Attr | null;
129
- /** {@link Element.getAttributeNodeNS} */
130
- getAttributeNodeNS(namespace: string | null, localName: string): Attr | null;
131
- /** {@link Element.getBoundingClientRect} */
132
- getBoundingClientRect(): DOMRect;
133
- /** {@link Element.getClientRects} */
134
- getClientRects(): DOMRectList;
135
- /** {@link Element.getElementsByClassName} */
136
- getElementsByClassName(classNames: string): HTMLCollectionOf<Element>;
137
- /** {@link Element.getElementsByTagName} */
138
- getElementsByTagName<K extends keyof HTMLElementTagNameMap>(qualifiedName: K): HTMLCollectionOf<HTMLElementTagNameMap[K]>;
139
- getElementsByTagName<K extends keyof SVGElementTagNameMap>(qualifiedName: K): HTMLCollectionOf<SVGElementTagNameMap[K]>;
140
- getElementsByTagName<K extends keyof MathMLElementTagNameMap>(qualifiedName: K): HTMLCollectionOf<MathMLElementTagNameMap[K]>;
141
- getElementsByTagName(qualifiedName: string): HTMLCollectionOf<Element>;
142
- /** {@link Element.getElementsByTagNameNS} */
143
- getElementsByTagNameNS(namespaceURI: "http://www.w3.org/1999/xhtml", localName: string): HTMLCollectionOf<HTMLElement>;
144
- getElementsByTagNameNS(namespaceURI: "http://www.w3.org/2000/svg", localName: string): HTMLCollectionOf<SVGElement>;
145
- getElementsByTagNameNS(namespaceURI: "http://www.w3.org/1998/Math/MathML", localName: string): HTMLCollectionOf<MathMLElement>;
146
- getElementsByTagNameNS(namespace: string | null, localName: string): HTMLCollectionOf<Element>;
147
- /** {@link Element.getHTML} */
148
- getHTML(options?: GetHTMLOptions): string;
149
- /** {@link Element.hasAttribute} */
150
- hasAttribute(qualifiedName: string): boolean;
151
- /** {@link Element.hasAttributeNS} */
152
- hasAttributeNS(namespace: string | null, localName: string): boolean;
153
- /** {@link Element.hasAttributes} */
154
- hasAttributes(): boolean;
155
- /** {@link Element.hasPointerCapture} */
156
- hasPointerCapture(pointerId: number): boolean;
157
- /** {@link Element.insertAdjacentElement} */
158
- insertAdjacentElement(where: InsertPosition, element: Element): Element | null;
159
- /** {@link Element.insertAdjacentHTML} */
160
- insertAdjacentHTML(position: InsertPosition, string: string): this;
161
- /** {@link Element.insertAdjacentText} */
162
- insertAdjacentText(where: InsertPosition, data: string): this;
163
- /** {@link Element.matches} */
164
- matches(selectors: string): boolean;
165
- /** {@link Element.releasePointerCapture} */
166
- releasePointerCapture(pointerId: number): this;
167
- /** {@link Element.removeAttribute} */
168
- removeAttribute(qualifiedName: string): this;
169
- /** {@link Element.removeAttributeNS} */
170
- removeAttributeNS(namespace: string | null, localName: string): this;
171
- /** {@link Element.removeAttributeNode} */
172
- removeAttributeNode(attr: Attr): Attr;
173
- /** {@link Element.requestFullscreen} */
174
- requestFullscreen(options?: FullscreenOptions): Promise<this>;
175
- /** {@link Element.requestPointerLock} */
176
- requestPointerLock(options?: PointerLockOptions): Promise<this>;
177
- /** {@link Element.scroll} */
178
- scroll(options?: ScrollToOptions): this;
179
- scroll(x: number, y: number): this;
180
- /** {@link Element.scrollBy} */
181
- scrollBy(options?: ScrollToOptions): this;
182
- scrollBy(x: number, y: number): this;
183
- /** {@link Element.scrollIntoView} */
184
- scrollIntoView(arg?: boolean | ScrollIntoViewOptions): this;
185
- /** {@link Element.scrollTo} */
186
- scrollTo(options?: ScrollToOptions): this;
187
- scrollTo(x: number, y: number): this;
188
- /** {@link Element.setAttribute} */
189
- setAttribute(qualifiedName: string, value: string): this;
190
- /** {@link Element.setAttributeNS} */
191
- setAttributeNS(namespace: string | null, qualifiedName: string, value: string): this;
192
- /** {@link Element.setAttributeNode} */
193
- setAttributeNode(attr: Attr): Attr | null;
194
- /** {@link Element.setAttributeNodeNS} */
195
- setAttributeNodeNS(attr: Attr): Attr | null;
196
- /** {@link Element.setHTMLUnsafe} */
197
- setHTMLUnsafe(html: string): this;
198
- /** {@link Element.setPointerCapture} */
199
- setPointerCapture(pointerId: number): this;
200
- /** {@link Element.toggleAttribute} */
201
- toggleAttribute(qualifiedName: string, force?: boolean): boolean;
202
- /** {@link Element.getAnimations} */
203
- getAnimations(options?: GetAnimationsOptions): Animation[];
204
-
205
- /** {@link Element.classList} */
206
- classList(): DOMTokenList;
207
- classList(value: $Parameter<string>): this;
208
- /** {@link Element.className} */
209
- className(): string;
210
- className(value: $Parameter<string>): this;
211
- /** {@link Element.id} */
212
- id(): string;
213
- id(id: $Parameter<string>): this;
214
- /** {@link Element.innerHTML} */
215
- innerHTML(): string;
216
- innerHTML(innerHTML: $Parameter<string>): this;
217
- /** {@link Element.outerHTML} */
218
- outerHTML(): string;
219
- outerHTML(outerHTML: $Parameter<string>): this;
220
- /** {@link Element.part} */
221
- part(): DOMTokenList;
222
- part(part: $Parameter<string>): this;
223
- /** {@link Element.scrollLeft} */
224
- scrollLeft(): number;
225
- scrollLeft(scrollLeft: $Parameter<number>): this;
226
- /** {@link Element.scrollTop} */
227
- scrollTop(): number;
228
- scrollTop(scrollTop: $Parameter<number>): this;
229
- /** {@link Element.slot} */
230
- slot(): string;
231
- slot(slot: $Parameter<string>): this;
232
-
233
- // ARIAMixin
234
- /** {@link ARIAMixin.ariaAtomic} */
235
- ariaAtomic(): string | null;
236
- ariaAtomic(ariaAtomic: $Parameter<string | null>): this;
237
- /** {@link ARIAMixin.ariaAutoComplete} */
238
- ariaAutoComplete(): string | null;
239
- ariaAutoComplete(ariaAutoComplete: $Parameter<string | null>): this;
240
- /** {@link ARIAMixin.ariaBrailleLabel} */
241
- ariaBrailleLabel(): string | null;
242
- ariaBrailleLabel(ariaBrailleLabel: $Parameter<string | null>): this;
243
- /** {@link ARIAMixin.ariaBrailleRoleDescription} */
244
- ariaBrailleRoleDescription(): string | null;
245
- ariaBrailleRoleDescription(ariaBrailleRoleDescription: $Parameter<string | null>): this;
246
- /** {@link ARIAMixin.ariaBusy} */
247
- ariaBusy(): string | null;
248
- ariaBusy(ariaBusy: $Parameter<string | null>): this;
249
- /** {@link ARIAMixin.ariaChecked} */
250
- ariaChecked(): string | null;
251
- ariaChecked(ariaChecked: $Parameter<string | null>): this;
252
- /** {@link ARIAMixin.ariaColCount} */
253
- ariaColCount(): string | null;
254
- ariaColCount(ariaColCount: $Parameter<string | null>): this;
255
- /** {@link ARIAMixin.ariaColIndex} */
256
- ariaColIndex(): string | null;
257
- ariaColIndex(ariaColIndex: $Parameter<string | null>): this;
258
- /** {@link ARIAMixin.ariaColIndexText} */
259
- ariaColIndexText(): string | null;
260
- ariaColIndexText(ariaColIndexText: $Parameter<string | null>): this;
261
- /** {@link ARIAMixin.ariaColSpan} */
262
- ariaColSpan(): string | null;
263
- ariaColSpan(ariaColSpan: $Parameter<string | null>): this;
264
- /** {@link ARIAMixin.ariaCurrent} */
265
- ariaCurrent(): string | null;
266
- ariaCurrent(ariaCurrent: $Parameter<string | null>): this;
267
- /** {@link ARIAMixin.ariaDescription} */
268
- ariaDescription(): string | null;
269
- ariaDescription(ariaDescription: $Parameter<string | null>): this;
270
- /** {@link ARIAMixin.ariaDisabled} */
271
- ariaDisabled(): string | null;
272
- ariaDisabled(ariaDisabled: $Parameter<string | null>): this;
273
- /** {@link ARIAMixin.ariaExpanded} */
274
- ariaExpanded(): string | null;
275
- ariaExpanded(ariaExpanded: $Parameter<string | null>): this;
276
- /** {@link ARIAMixin.ariaHasPopup} */
277
- ariaHasPopup(): string | null;
278
- ariaHasPopup(ariaHasPopup: $Parameter<string | null>): this;
279
- /** {@link ARIAMixin.ariaHidden} */
280
- ariaHidden(): string | null;
281
- ariaHidden(ariaHidden: $Parameter<string | null>): this;
282
- /** {@link ARIAMixin.ariaInvalid} */
283
- ariaInvalid(): string | null;
284
- ariaInvalid(ariaInvalid: $Parameter<string | null>): this;
285
- /** {@link ARIAMixin.ariaKeyShortcuts} */
286
- ariaKeyShortcuts(): string | null;
287
- ariaKeyShortcuts(ariaKeyShortcuts: $Parameter<string | null>): this;
288
- /** {@link ARIAMixin.ariaLabel} */
289
- ariaLabel(): string | null;
290
- ariaLabel(ariaLabel: $Parameter<string | null>): this;
291
- /** {@link ARIAMixin.ariaLevel} */
292
- ariaLevel(): string | null;
293
- ariaLevel(ariaLevel: $Parameter<string | null>): this;
294
- /** {@link ARIAMixin.ariaLive} */
295
- ariaLive(): string | null;
296
- ariaLive(ariaLive: $Parameter<string | null>): this;
297
- /** {@link ARIAMixin.ariaModal} */
298
- ariaModal(): string | null;
299
- ariaModal(ariaModal: $Parameter<string | null>): this;
300
- /** {@link ARIAMixin.ariaMultiLine} */
301
- ariaMultiLine(): string | null;
302
- ariaMultiLine(ariaMultiLine: $Parameter<string | null>): this;
303
- /** {@link ARIAMixin.ariaMultiSelectable} */
304
- ariaMultiSelectable(): string | null;
305
- ariaMultiSelectable(ariaMultiSelectable: $Parameter<string | null>): this;
306
- /** {@link ARIAMixin.ariaOrientation} */
307
- ariaOrientation(): string | null;
308
- ariaOrientation(ariaOrientation: $Parameter<string | null>): this;
309
- /** {@link ARIAMixin.ariaPlaceholder} */
310
- ariaPlaceholder(): string | null;
311
- ariaPlaceholder(ariaPlaceholder: $Parameter<string | null>): this;
312
- /** {@link ARIAMixin.ariaPosInSet} */
313
- ariaPosInSet(): string | null;
314
- ariaPosInSet(ariaPosInSet: $Parameter<string | null>): this;
315
- /** {@link ARIAMixin.ariaPressed} */
316
- ariaPressed(): string | null;
317
- ariaPressed(ariaPressed: $Parameter<string | null>): this;
318
- /** {@link ARIAMixin.ariaReadOnly} */
319
- ariaReadOnly(): string | null;
320
- ariaReadOnly(ariaReadOnly: $Parameter<string | null>): this;
321
- /** {@link ARIAMixin.ariaRelevant} */
322
- ariaRelevant(): string | null;
323
- ariaRelevant(ariaRelevant: $Parameter<string | null>): this;
324
- /** {@link ARIAMixin.ariaRequired} */
325
- ariaRequired(): string | null;
326
- ariaRequired(ariaRequired: $Parameter<string | null>): this;
327
- /** {@link ARIAMixin.ariaRoleDescription} */
328
- ariaRoleDescription(): string | null;
329
- ariaRoleDescription(ariaRoleDescription: $Parameter<string | null>): this;
330
- /** {@link ARIAMixin.ariaRowCount} */
331
- ariaRowCount(): string | null;
332
- ariaRowCount(ariaRowCount: $Parameter<string | null>): this;
333
- /** {@link ARIAMixin.ariaRowIndex} */
334
- ariaRowIndex(): string | null;
335
- ariaRowIndex(ariaRowIndex: $Parameter<string | null>): this;
336
- /** {@link ARIAMixin.ariaRowIndexText} */
337
- ariaRowIndexText(): string | null;
338
- ariaRowIndexText(ariaRowIndexText: $Parameter<string | null>): this;
339
- /** {@link ARIAMixin.ariaRowSpan} */
340
- ariaRowSpan(): string | null;
341
- ariaRowSpan(ariaRowSpan: $Parameter<string | null>): this;
342
- /** {@link ARIAMixin.ariaSelected} */
343
- ariaSelected(): string | null;
344
- ariaSelected(ariaSelected: $Parameter<string | null>): this;
345
- /** {@link ARIAMixin.ariaSetSize} */
346
- ariaSetSize(): string | null;
347
- ariaSetSize(ariaSetSize: $Parameter<string | null>): this;
348
- /** {@link ARIAMixin.ariaSort} */
349
- ariaSort(): string | null;
350
- ariaSort(ariaSort: $Parameter<string | null>): this;
351
- /** {@link ARIAMixin.ariaValueMax} */
352
- ariaValueMax(): string | null;
353
- ariaValueMax(ariaValueMax: $Parameter<string | null>): this;
354
- /** {@link ARIAMixin.ariaValueMin} */
355
- ariaValueMin(): string | null;
356
- ariaValueMin(ariaValueMin: $Parameter<string | null>): this;
357
- /** {@link ARIAMixin.ariaValueNow} */
358
- ariaValueNow(): string | null;
359
- ariaValueNow(ariaValueNow: $Parameter<string | null>): this;
360
- /** {@link ARIAMixin.ariaValueText} */
361
- ariaValueText(): string | null;
362
- ariaValueText(ariaValueText: $Parameter<string | null>): this;
363
- /** {@link ARIAMixin.role} */
364
- role(): string | null;
365
- role(role: $Parameter<string | null>): this;
366
- }
@@ -1,48 +0,0 @@
1
- import { forEach, isBoolean, toArray } from "@amateras/utils";
2
-
3
- export class $EventTarget<EvMap = {}> {
4
- node: EventTarget;
5
- constructor(node: EventTarget) {
6
- this.node = node;
7
- if (node !== window) (node as Mutable<EventTarget>).$ = this;
8
- }
9
-
10
- on(type: string | string[], listener: $EventListener<this, Event> | $EventListenerObject<this, Event>, options?: boolean | AddEventListenerOptions): this {
11
- forEach(toArray(type), type => this.addEventListener(type, listener, options));
12
- return this;
13
- }
14
-
15
- off(type: string | string[], listener: $EventListener<this, Event> | $EventListenerObject<this, Event>, options?: boolean | EventListenerOptions): this {
16
- forEach(toArray(type), type => this.removeEventListener(type, listener, options));
17
- return this
18
- }
19
-
20
- once(type: string | string[], listener: $EventListener<this, Event> | $EventListenerObject<this, Event>, options?: boolean | AddEventListenerOptions): this {
21
- forEach(toArray(type), type => this.on(type, listener, { once: true, ...(isBoolean(options) ? { capture: options } : options ?? {}) }));
22
- return this
23
- }
24
- }
25
-
26
- export type $Event<E extends $EventTarget, Ev = any> = Ev & {currentTarget: {$: E}};
27
- export type $EventListener<E extends $EventTarget, Ev> = (event: $Event<E, Ev>) => void;
28
- export type $EventListenerObject<E extends $EventTarget, Ev> = { handleEvent(object: $Event<E, Ev>): void; }
29
-
30
- export interface $EventTarget<EvMap = {}> {
31
- /** {@link EventTarget.addEventListener} */
32
- addEventListener<K extends keyof EvMap, Ev extends EvMap[K]>(type: K, listener: $EventListener<this, Ev> | $EventListenerObject<this, Ev>, options?: boolean | AddEventListenerOptions): this;
33
- addEventListener(type: string, listener: $EventListener<this, Event> | $EventListenerObject<this, Event>, options?: boolean | AddEventListenerOptions): this;
34
- /** {@link EventTarget.removeEventListener} */
35
- removeEventListener<K extends keyof EvMap, Ev extends EvMap[K]>(type: K, listener: $EventListener<this, Ev> | $EventListenerObject<this, Ev>, options?: boolean | EventListenerOptions): this;
36
- removeEventListener(type: string, listener: $EventListener<this, Event> | $EventListenerObject<this, Event>, options?: boolean | EventListenerOptions): this;
37
- /** {@link EventTarget.dispatchEvent} */
38
- dispatchEvent(event: Event): boolean;
39
-
40
- on<K extends keyof EvMap, Ev extends EvMap[K]>(type: K | K[], listener: $EventListener<this, Ev> | $EventListenerObject<this, Ev>, options?: boolean | AddEventListenerOptions): this;
41
- on(type: string, listener: $EventListener<this, Event> | $EventListenerObject<this, Event>, options?: boolean | AddEventListenerOptions): this;
42
-
43
- off<K extends keyof EvMap, Ev extends EvMap[K]>(type: K | K[], listener: $EventListener<this, Ev> | $EventListenerObject<this, Ev>, options?: boolean | EventListenerOptions): this;
44
- off(type: string, listener: $EventListener<this, Event> | $EventListenerObject<this, Event>, options?: boolean | EventListenerOptions): this;
45
-
46
- once<K extends keyof EvMap, Ev extends EvMap[K]>(type: K | K[], listener: $EventListener<this, Ev> | $EventListenerObject<this, Ev>, options?: boolean | AddEventListenerOptions): this;
47
- once(type: string, listener: $EventListener<this, Event> | $EventListenerObject<this, Event>, options?: boolean | AddEventListenerOptions): this;
48
- }
@@ -1,99 +0,0 @@
1
- import { _Object_entries, forEach } from "@amateras/utils";
2
- import { $Element } from "#node/$Element";
3
-
4
- export class $HTMLElement<Ele extends HTMLElement = HTMLElement, EvMap = HTMLElementEventMap> extends $Element<Ele, EvMap> {
5
- constructor(resolver: string | Ele) {
6
- super(resolver);
7
- }
8
-
9
- style(): CSSStyleDeclaration;
10
- style(style: Partial<CSSStyleDeclarationOptions> | undefined): this
11
- style(style?: Partial<CSSStyleDeclarationOptions> | undefined) {
12
- let _style = this.node.style
13
- if (!arguments.length) return _style
14
- if (style) forEach(_Object_entries(style), ([key, value]) => _style[key as any] = value ?? '');
15
- return this;
16
- }
17
- }
18
-
19
- type CSSStyleDeclarationOptions = Omit<CSSStyleDeclaration, 'parentRule' | 'length' | 'getPropertyPriority' | 'getPropertyValue' | 'item' | 'removeProperty' | 'setProperty'>;
20
-
21
- export interface $HTMLElement<Ele extends HTMLElement = HTMLElement, EvMap = HTMLElementEventMap> extends $Element<Ele, EvMap> {
22
- /** {@link HTMLElement.accessKeyLabel} */
23
- readonly accessKeyLabel: string;
24
- /** {@link HTMLElement.offsetHeight} */
25
- readonly offsetHeight: number;
26
- /** {@link HTMLElement.offsetLeft} */
27
- readonly offsetLeft: number;
28
- /** {@link HTMLElement.offsetParent} */
29
- readonly offsetParent: Element | null;
30
- /** {@link HTMLElement.offsetTop} */
31
- readonly offsetTop: number;
32
- /** {@link HTMLElement.offsetWidth} */
33
- readonly offsetWidth: number;
34
- /** {@link HTMLElement.isContentEditable} */
35
- readonly isContentEditable: boolean;
36
-
37
- /** {@link HTMLElement.attachInternals} */
38
- attachInternals(): ElementInternals;
39
- /** {@link HTMLElement.click} */
40
- click(): this;
41
- /** {@link HTMLElement.hidePopover} */
42
- hidePopover(): this;
43
- /** {@link HTMLElement.showPopover} */
44
- showPopover(): this;
45
- /** {@link HTMLElement.togglePopover} */
46
- togglePopover(options?: boolean): boolean;
47
-
48
- /** {@link HTMLElement.accessKey} */
49
- accessKey(): string;
50
- accessKey(accessKey: $Parameter<string>): this;
51
- /** {@link HTMLElement.autocapitalize} */
52
- autocapitalize(): string;
53
- autocapitalize(autocapitalize: $Parameter<string>): this;
54
- /** {@link HTMLElement.dir} */
55
- dir(): string;
56
- dir(dir: $Parameter<string>): this;
57
- /** {@link HTMLElement.draggable} */
58
- draggable(): boolean;
59
- draggable(draggable: $Parameter<boolean>): this;
60
- /** {@link HTMLElement.hidden} */
61
- hidden(): boolean;
62
- hidden(hidden: $Parameter<boolean>): this;
63
- /** {@link HTMLElement.inert} */
64
- inert(): boolean;
65
- inert(inert: $Parameter<boolean>): this;
66
- /** {@link HTMLElement.innerText} */
67
- innerText(): string;
68
- innerText(innerText: $Parameter<string>): this;
69
- /** {@link HTMLElement.lang} */
70
- lang(): string;
71
- lang(lang: $Parameter<string>): this;
72
- /** {@link HTMLElement.outerText} */
73
- outerText(): string;
74
- outerText(outerText: $Parameter<string>): this;
75
- /** {@link HTMLElement.popover} */
76
- popover(): string | null;
77
- popover(popover: $Parameter<string | null>): this;
78
- /** {@link HTMLElement.spellcheck} */
79
- spellcheck(): boolean;
80
- spellcheck(spellcheck: $Parameter<boolean>): this;
81
- /** {@link HTMLElement.title} */
82
- title(): string;
83
- title(title: $Parameter<string>): this;
84
- /** {@link HTMLElement.translate} */
85
- translate(): string;
86
- translate(translate: $Parameter<boolean>): this;
87
- /** {@link HTMLElement.writingSuggestions} */
88
- writingSuggestions(): string;
89
- writingSuggestions(writingSuggestions: $Parameter<string>): this;
90
- /** {@link HTMLElement.contentEditable} */
91
- contentEditable(): string;
92
- contentEditable(contentEditable: $Parameter<string>): this;
93
- /** {@link HTMLElement.enterKeyHint} */
94
- enterKeyHint(): string;
95
- enterKeyHint(enterKeyHint: $Parameter<string>): this;
96
- /** {@link HTMLElement.inputMode} */
97
- inputMode(): string;
98
- inputMode(inputMode: $Parameter<string>): this;
99
- }