amateras 0.1.1 → 0.3.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 (68) hide show
  1. package/README.md +25 -8
  2. package/ext/css/src/index.ts +103 -49
  3. package/ext/css/src/lib/colorAssign.ts +6 -0
  4. package/ext/css/src/lib/colors/amber.ts +25 -0
  5. package/ext/css/src/lib/colors/blackwhite.ts +13 -0
  6. package/ext/css/src/lib/colors/blue.ts +25 -0
  7. package/ext/css/src/lib/colors/cyan.ts +25 -0
  8. package/ext/css/src/lib/colors/emerald.ts +25 -0
  9. package/ext/css/src/lib/colors/fuchsia.ts +25 -0
  10. package/ext/css/src/lib/colors/gray.ts +25 -0
  11. package/ext/css/src/lib/colors/green.ts +25 -0
  12. package/ext/css/src/lib/colors/indigo.ts +25 -0
  13. package/ext/css/src/lib/colors/lime.ts +25 -0
  14. package/ext/css/src/lib/colors/neutral.ts +25 -0
  15. package/ext/css/src/lib/colors/orange.ts +25 -0
  16. package/ext/css/src/lib/colors/pink.ts +25 -0
  17. package/ext/css/src/lib/colors/purple.ts +25 -0
  18. package/ext/css/src/lib/colors/red.ts +25 -0
  19. package/ext/css/src/lib/colors/rose.ts +25 -0
  20. package/ext/css/src/lib/colors/sky.ts +25 -0
  21. package/ext/css/src/lib/colors/slate.ts +25 -0
  22. package/ext/css/src/lib/colors/stone.ts +25 -0
  23. package/ext/css/src/lib/colors/teal.ts +25 -0
  24. package/ext/css/src/lib/colors/violet.ts +25 -0
  25. package/ext/css/src/lib/colors/yellow.ts +25 -0
  26. package/ext/css/src/lib/colors/zinc.ts +25 -0
  27. package/ext/css/src/lib/colors.ts +23 -0
  28. package/ext/css/src/structure/$CSSKeyframesRule.ts +2 -5
  29. package/ext/css/src/structure/$CSSMediaRule.ts +3 -23
  30. package/ext/css/src/structure/$CSSRule.ts +6 -18
  31. package/ext/css/src/structure/$CSSStyleRule.ts +10 -12
  32. package/ext/html/html.ts +24 -58
  33. package/ext/html/node/$Anchor.ts +49 -0
  34. package/ext/html/node/$Canvas.ts +16 -0
  35. package/ext/html/node/$Dialog.ts +16 -0
  36. package/ext/html/node/$Form.ts +16 -0
  37. package/ext/html/node/$Image.ts +72 -0
  38. package/ext/html/node/$Input.ts +169 -0
  39. package/ext/html/node/$Label.ts +16 -0
  40. package/ext/html/node/$Media.ts +16 -0
  41. package/ext/html/node/$OptGroup.ts +23 -0
  42. package/ext/html/node/$Option.ts +40 -0
  43. package/ext/html/node/$Select.ts +76 -0
  44. package/ext/html/node/$TextArea.ts +16 -0
  45. package/ext/router/README.md +81 -0
  46. package/ext/router/index.ts +66 -0
  47. package/ext/router/node/Page.ts +27 -0
  48. package/ext/router/node/Route.ts +53 -0
  49. package/ext/router/node/Router.ts +138 -0
  50. package/ext/router/node/RouterAnchor.ts +8 -0
  51. package/ext/ssr/env.ts +61 -0
  52. package/ext/ssr/index.ts +47 -0
  53. package/ext/ssr/package.json +10 -0
  54. package/package.json +8 -4
  55. package/src/core.ts +43 -30
  56. package/src/global.ts +6 -0
  57. package/src/lib/assign.ts +4 -3
  58. package/src/lib/assignHelper.ts +11 -13
  59. package/src/lib/native.ts +14 -3
  60. package/src/node/$Element.ts +204 -23
  61. package/src/node/$HTMLElement.ts +76 -0
  62. package/src/node/$Node.ts +145 -53
  63. package/src/node/node.ts +8 -6
  64. package/src/structure/Signal.ts +4 -4
  65. package/tsconfig.json +1 -1
  66. package/ext/css/src/structure/$CSSKeyframeRule.ts +0 -13
  67. package/ext/html/node/$HTMLElement.ts +0 -7
  68. package/ext/html/node/type.ts +0 -96
@@ -0,0 +1,25 @@
1
+ import { colorAssign } from "../colorAssign";
2
+
3
+ const _purple = {
4
+ 50: '#faf5ff',
5
+ 100: '#f3e8ff',
6
+ 200: '#e9d5ff',
7
+ 300: '#d8b4fe',
8
+ 400: '#c084fc',
9
+ 500: '#a855f7',
10
+ 600: '#9333ea',
11
+ 700: '#7e22ce',
12
+ 800: '#6b21a8',
13
+ 900: '#581c87',
14
+ 950: '#3b0764',
15
+ } as const;
16
+
17
+ colorAssign('purple', _purple);
18
+
19
+ declare module 'amateras/core' {
20
+ export namespace $ {
21
+ export namespace color {
22
+ export const purple: typeof _purple;
23
+ }
24
+ }
25
+ }
@@ -0,0 +1,25 @@
1
+ import { colorAssign } from "../colorAssign";
2
+
3
+ const _red = {
4
+ 50: '#fef2f2',
5
+ 100: '#fee2e2',
6
+ 200: '#fecaca',
7
+ 300: '#fca5a5',
8
+ 400: '#f87171',
9
+ 500: '#ef4444',
10
+ 600: '#dc2626',
11
+ 700: '#b91c1c',
12
+ 800: '#991b1b',
13
+ 900: '#7f1d1d',
14
+ 950: '#450a0a',
15
+ } as const;
16
+
17
+ colorAssign('red', _red);
18
+
19
+ declare module 'amateras/core' {
20
+ export namespace $ {
21
+ export namespace color {
22
+ export const red: typeof _red;
23
+ }
24
+ }
25
+ }
@@ -0,0 +1,25 @@
1
+ import { colorAssign } from "../colorAssign";
2
+
3
+ const _rose = {
4
+ 50: '#fff1f2',
5
+ 100: '#ffe4e6',
6
+ 200: '#fecdd3',
7
+ 300: '#fda4af',
8
+ 400: '#fb7185',
9
+ 500: '#f43f5e',
10
+ 600: '#e11d48',
11
+ 700: '#be123c',
12
+ 800: '#9f1239',
13
+ 900: '#881337',
14
+ 950: '#4c0519',
15
+ } as const;
16
+
17
+ colorAssign('rose', _rose);
18
+
19
+ declare module 'amateras/core' {
20
+ export namespace $ {
21
+ export namespace color {
22
+ export const rose: typeof _rose;
23
+ }
24
+ }
25
+ }
@@ -0,0 +1,25 @@
1
+ import { colorAssign } from "../colorAssign";
2
+
3
+ const _sky = {
4
+ 50: '#f0f9ff',
5
+ 100: '#e0f2fe',
6
+ 200: '#bae6fd',
7
+ 300: '#7dd3fc',
8
+ 400: '#38bdf8',
9
+ 500: '#0ea5e9',
10
+ 600: '#0284c7',
11
+ 700: '#0369a1',
12
+ 800: '#075985',
13
+ 900: '#0c4a6e',
14
+ 950: '#082f49',
15
+ } as const;
16
+
17
+ colorAssign('sky', _sky);
18
+
19
+ declare module 'amateras/core' {
20
+ export namespace $ {
21
+ export namespace color {
22
+ export const sky: typeof _sky;
23
+ }
24
+ }
25
+ }
@@ -0,0 +1,25 @@
1
+ import { colorAssign } from "../colorAssign";
2
+
3
+ const _slate = {
4
+ 50: '#f8fafc',
5
+ 100: '#f1f5f9',
6
+ 200: '#e2e8f0',
7
+ 300: '#cbd5e1',
8
+ 400: '#94a3b8',
9
+ 500: '#64748b',
10
+ 600: '#475569',
11
+ 700: '#334155',
12
+ 800: '#1e293b',
13
+ 900: '#0f172a',
14
+ 950: '#020617',
15
+ } as const
16
+
17
+ colorAssign('slate', _slate);
18
+
19
+ declare module 'amateras/core' {
20
+ export namespace $ {
21
+ export namespace color {
22
+ export const slate: typeof _slate;
23
+ }
24
+ }
25
+ }
@@ -0,0 +1,25 @@
1
+ import { colorAssign } from "../colorAssign";
2
+
3
+ const _stone = {
4
+ 50: '#fafaf9',
5
+ 100: '#f5f5f4',
6
+ 200: '#e7e5e4',
7
+ 300: '#d6d3d1',
8
+ 400: '#a8a29e',
9
+ 500: '#78716c',
10
+ 600: '#57534e',
11
+ 700: '#44403c',
12
+ 800: '#292524',
13
+ 900: '#1c1917',
14
+ 950: '#0c0a09',
15
+ } as const;
16
+
17
+ colorAssign('stone', _stone);
18
+
19
+ declare module 'amateras/core' {
20
+ export namespace $ {
21
+ export namespace color {
22
+ export const stone: typeof _stone;
23
+ }
24
+ }
25
+ }
@@ -0,0 +1,25 @@
1
+ import { colorAssign } from "../colorAssign";
2
+
3
+ const _teal = {
4
+ 50: '#f0fdfa',
5
+ 100: '#ccfbf1',
6
+ 200: '#99f6e4',
7
+ 300: '#5eead4',
8
+ 400: '#2dd4bf',
9
+ 500: '#14b8a6',
10
+ 600: '#0d9488',
11
+ 700: '#0f766e',
12
+ 800: '#115e59',
13
+ 900: '#134e4a',
14
+ 950: '#042f2e',
15
+ } as const;
16
+
17
+ colorAssign('teal', _teal);
18
+
19
+ declare module 'amateras/core' {
20
+ export namespace $ {
21
+ export namespace color {
22
+ export const teal: typeof _teal;
23
+ }
24
+ }
25
+ }
@@ -0,0 +1,25 @@
1
+ import { colorAssign } from "../colorAssign";
2
+
3
+ const _violet = {
4
+ 50: '#f5f3ff',
5
+ 100: '#ede9fe',
6
+ 200: '#ddd6fe',
7
+ 300: '#c4b5fd',
8
+ 400: '#a78bfa',
9
+ 500: '#8b5cf6',
10
+ 600: '#7c3aed',
11
+ 700: '#6d28d9',
12
+ 800: '#5b21b6',
13
+ 900: '#4c1d95',
14
+ 950: '#2e1065',
15
+ } as const;
16
+
17
+ colorAssign('violet', _violet);
18
+
19
+ declare module 'amateras/core' {
20
+ export namespace $ {
21
+ export namespace color {
22
+ export const violet: typeof _violet;
23
+ }
24
+ }
25
+ }
@@ -0,0 +1,25 @@
1
+ import { colorAssign } from "../colorAssign";
2
+
3
+ const _yellow = {
4
+ 50: '#fefce8',
5
+ 100: '#fef9c3',
6
+ 200: '#fef08a',
7
+ 300: '#fde047',
8
+ 400: '#facc15',
9
+ 500: '#eab308',
10
+ 600: '#ca8a04',
11
+ 700: '#a16207',
12
+ 800: '#854d0e',
13
+ 900: '#713f12',
14
+ 950: '#422006',
15
+ } as const;
16
+
17
+ colorAssign('yellow', _yellow);
18
+
19
+ declare module 'amateras/core' {
20
+ export namespace $ {
21
+ export namespace color {
22
+ export const yellow: typeof _yellow;
23
+ }
24
+ }
25
+ }
@@ -0,0 +1,25 @@
1
+ import { colorAssign } from "../colorAssign";
2
+
3
+ const _zinc = {
4
+ 50: '#fafafa',
5
+ 100: '#f4f4f5',
6
+ 200: '#e4e4e7',
7
+ 300: '#d4d4d8',
8
+ 400: '#a1a1aa',
9
+ 500: '#71717a',
10
+ 600: '#52525b',
11
+ 700: '#3f3f46',
12
+ 800: '#27272a',
13
+ 900: '#18181b',
14
+ 950: '#09090b',
15
+ } as const;
16
+
17
+ colorAssign('zinc', _zinc);
18
+
19
+ declare module 'amateras/core' {
20
+ export namespace $ {
21
+ export namespace color {
22
+ export const zinc: typeof _zinc;
23
+ }
24
+ }
25
+ }
@@ -0,0 +1,23 @@
1
+ import './colors/amber';
2
+ import './colors/blackwhite';
3
+ import './colors/blue';
4
+ import './colors/cyan';
5
+ import './colors/emerald';
6
+ import './colors/fuchsia';
7
+ import './colors/gray';
8
+ import './colors/green';
9
+ import './colors/indigo';
10
+ import './colors/lime';
11
+ import './colors/neutral';
12
+ import './colors/orange';
13
+ import './colors/pink';
14
+ import './colors/purple';
15
+ import './colors/red';
16
+ import './colors/rose';
17
+ import './colors/sky';
18
+ import './colors/slate';
19
+ import './colors/stone';
20
+ import './colors/teal';
21
+ import './colors/violet';
22
+ import './colors/yellow';
23
+ import './colors/zinc';
@@ -1,17 +1,14 @@
1
1
  import { $CSSRule } from "#structure/$CSSRule";
2
+ import { _Array_from } from "../../../../src/lib/native";
2
3
 
3
4
  export class $CSSKeyframesRule extends $CSSRule {
4
5
  name: string;
5
6
  constructor(name: string) {
6
- super();
7
+ super(`@keyframes ${name}`);
7
8
  this.name = name;
8
9
  }
9
10
 
10
11
  toString(): string {
11
12
  return this.name;
12
13
  }
13
-
14
- get css() {
15
- return `@keyframes ${this.name} { ${Array.from(this.rules).map(rule => rule.css).join(' ')} }`
16
- }
17
14
  }
@@ -1,30 +1,10 @@
1
1
  import { _Array_from, _instanceof } from "amateras/lib/native";
2
2
  import { $CSSRule } from "#structure/$CSSRule";
3
- import { $CSSStyleRule } from "./$CSSStyleRule";
4
3
 
5
4
  export class $CSSMediaRule extends $CSSRule {
6
5
  condition: string;
7
- constructor(condition: string) {
8
- super();
9
- this.condition = condition;
10
- }
11
-
12
- get css(): string {
13
- function findOwnerMediaRule(rule: $CSSRule, contextRules: $CSSMediaRule[]) {
14
- const ownerRule = rule.ownerRule;
15
- if (!ownerRule) return contextRules;
16
- if (_instanceof(ownerRule, $CSSMediaRule)) return findOwnerMediaRule(ownerRule, [ownerRule, ...contextRules]);
17
- else return findOwnerMediaRule(ownerRule, contextRules);
18
- }
19
-
20
- function findChildRules(rule: $CSSRule, rules: $CSSStyleRule[] = []) {
21
- _Array_from(rule.rules).forEach((_rule => {
22
- if (!_instanceof(_rule, $CSSStyleRule)) return;
23
- rules.push(_rule);
24
- return findChildRules(_rule, rules);
25
- }))
26
- return rules
27
- }
28
- return `@media ${findOwnerMediaRule(this, [this]).map(rule => rule.condition).join(' and ')} { ${findChildRules(this).map(rule => rule.css).join(' ')} }`
6
+ constructor(selector: string) {
7
+ super(selector);
8
+ this.condition = selector.replace('@media ', '');
29
9
  }
30
10
  }
@@ -1,25 +1,13 @@
1
- import { _instanceof } from "amateras/lib/native";
2
- import { $CSSMediaRule } from "#structure/$CSSMediaRule";
1
+ import { _Array_from, _instanceof, _Object_fromEntries } from "amateras/lib/native";
3
2
 
4
3
  export abstract class $CSSRule {
5
4
  rules = new Set<$CSSRule>();
6
- ownerRule: $CSSRule | null = null;
7
- constructor() {}
8
-
9
- abstract get css(): string;
10
-
11
- get mediaRules() {
12
- const rules: $CSSMediaRule[] = []
13
- this.rules.forEach(rule => {
14
- if (_instanceof(rule, $CSSMediaRule)) rules.push(rule);
15
- rules.push(...rule.mediaRules)
16
- })
17
- return rules;
5
+ selector: string;
6
+ constructor(selector: string) {
7
+ this.selector = selector;
18
8
  }
19
9
 
20
- addRule(rule: $CSSRule) {
21
- this.rules.add(rule);
22
- rule.ownerRule = this;
23
- return this;
10
+ get options(): {[key: string]: any} {
11
+ return _Object_fromEntries(_Array_from(this.rules).map(rule => [rule.selector, rule]))
24
12
  }
25
13
  }
@@ -1,23 +1,21 @@
1
1
  import type { $CSSDeclaration } from "#structure/$CSSDeclaration";
2
2
  import { $CSSRule } from "#structure/$CSSRule";
3
- import { _Array_from, _instanceof } from "amateras/lib/native";
3
+ import { _Array_from, _instanceof, _Object_fromEntries } from "amateras/lib/native";
4
4
 
5
5
  export class $CSSStyleRule extends $CSSRule {
6
- context: string[] = [];
7
6
  declarations = new Map<string, $CSSDeclaration>();
8
- className: string = '';
9
- constructor(context: string[] = []) {
10
- super();
11
- this.context = context;
7
+ constructor(selector: string) {
8
+ super(selector);
12
9
  }
13
10
 
14
- get css(): string {
15
- return `${this.selector} { ${_Array_from(this.declarations).map(([_, dec]) => `${dec}`).join(' ')} }`
11
+ clone(selector: string) {
12
+ const rule = new $CSSStyleRule(selector)
13
+ rule.declarations = this.declarations;
14
+ rule.rules = this.rules;
15
+ return rule
16
16
  }
17
17
 
18
- get selector() {
19
- const ctx: string[][] = [];
20
- this.context.forEach((part, i) => ctx.push(part.split(',').map(sel => ctx[i - 1] ? ctx[i - 1]!.map(prefix => `${prefix} ${sel.trim()}`) : [sel.trim()]).flat()))
21
- return ctx.at(-1)?.join(', ')
18
+ get options(): {[key: string]: any} {
19
+ return {..._Object_fromEntries(_Array_from(this.declarations).map(([_, dec]) => [dec.key, dec])), ...super.options}
22
20
  }
23
21
  }
package/ext/html/html.ts CHANGED
@@ -1,59 +1,25 @@
1
1
  import '#core';
2
- import { $Node } from '#node/$Node';
3
- import { $HTMLElement } from './node/$HTMLElement';
4
- import './node/type';
5
- import { assignHelper } from '#lib/assignHelper';
6
- export * from './node/type';
7
- export * from './node/$HTMLElement';
8
-
9
- // create element classes
10
- export const [
11
- $Input,
12
- $Anchor,
13
- $Image,
14
- $Canvas,
15
- $Dialog,
16
- $Form,
17
- $Label,
18
- $Media,
19
- $Select,
20
- $Option,
21
- $OptGroup,
22
- $TextArea,
23
- ] = [
24
- $HTMLElementBuilder<HTMLInputElement>('input'),
25
- $HTMLElementBuilder<HTMLAnchorElement>('a'),
26
- $HTMLElementBuilder<HTMLImageElement>('img'),
27
- $HTMLElementBuilder<HTMLCanvasElement>('canvas'),
28
- $HTMLElementBuilder<HTMLDialogElement>('dialog'),
29
- $HTMLElementBuilder<HTMLFormElement>('form'),
30
- $HTMLElementBuilder<HTMLLabelElement>('label'),
31
- $HTMLElementBuilder<HTMLMediaElement>('media'),
32
- $HTMLElementBuilder<HTMLSelectElement>('select'),
33
- $HTMLElementBuilder<HTMLOptionElement>('option'),
34
- $HTMLElementBuilder<HTMLOptGroupElement>('optgroup'),
35
- $HTMLElementBuilder<HTMLTextAreaElement>('textarea'),
36
- ]
37
-
38
- const targets: [object: Constructor<Node>, target: Constructor<$Node>, tagname?: string][] = [
39
- [HTMLElement, $HTMLElement],
40
- [HTMLInputElement, $Input, 'input'],
41
- [HTMLAnchorElement, $Anchor, 'a'],
42
- [HTMLImageElement, $Image, 'img'],
43
- [HTMLCanvasElement, $Canvas, 'canvas'],
44
- [HTMLDialogElement, $Dialog, 'dialog'],
45
- [HTMLFormElement, $Form, 'form'],
46
- [HTMLLabelElement, $Label, 'label'],
47
- [HTMLMediaElement, $Media, 'media'],
48
- [HTMLSelectElement, $Select, 'select'],
49
- [HTMLOptionElement, $Option, 'option'],
50
- [HTMLOptGroupElement, $OptGroup, 'optgroup'],
51
- [HTMLTextAreaElement, $TextArea, 'textarea'],
52
- ];
53
- assignHelper(targets);
54
-
55
- function $HTMLElementBuilder<Ele extends HTMLElement>(tagName: string) {
56
- return class extends $HTMLElement<Ele> {
57
- constructor() { super(tagName) }
58
- }
59
- }
2
+ import './node/$Anchor';
3
+ import './node/$Dialog';
4
+ import './node/$Form';
5
+ import './node/$Image';
6
+ import './node/$Canvas';
7
+ import './node/$Input';
8
+ import './node/$Label';
9
+ import './node/$Media';
10
+ import './node/$OptGroup';
11
+ import './node/$Option';
12
+ import './node/$Select';
13
+ import './node/$TextArea';
14
+ export * from './node/$Anchor';
15
+ export * from './node/$Canvas';
16
+ export * from './node/$Dialog';
17
+ export * from './node/$Form';
18
+ export * from './node/$Image';
19
+ export * from './node/$Input';
20
+ export * from './node/$Label';
21
+ export * from './node/$Media';
22
+ export * from './node/$OptGroup';
23
+ export * from './node/$Option';
24
+ export * from './node/$Select';
25
+ export * from './node/$TextArea';
@@ -0,0 +1,49 @@
1
+ import { assignHelper } from "#lib/assignHelper";
2
+ import { $HTMLElement } from "#node/$HTMLElement";
3
+
4
+ export class $Anchor extends $HTMLElement<HTMLAnchorElement> {
5
+ constructor() {
6
+ super('a')
7
+ }
8
+ }
9
+
10
+ export interface $Anchor extends $HTMLElement<HTMLAnchorElement> {
11
+ /** {@link HTMLAnchorElement.href} */
12
+ href(href: $Parameter<string>): this;
13
+ href(): string;
14
+ /** {@link HTMLAnchorElement.hreflang} */
15
+ hreflang(hreflang: $Parameter<string>): this;
16
+ hreflang(): string;
17
+ /** {@link HTMLAnchorElement.download} */
18
+ download(download: $Parameter<string>): this;
19
+ download(): string;
20
+ /** {@link HTMLAnchorElement.ping} */
21
+ ping(ping: $Parameter<string>): this;
22
+ ping(): string;
23
+ /** {@link HTMLAnchorElement.referrerPolicy} */
24
+ referrerPolicy(referrerPolicy: $Parameter<string>): this;
25
+ referrerPolicy(): string;
26
+ /** {@link HTMLAnchorElement.rel} */
27
+ rel(rel: $Parameter<string>): this;
28
+ rel(): string;
29
+ /** {@link HTMLAnchorElement.relList} */
30
+ relList(relList: $Parameter<string>): this;
31
+ relList(): DOMTokenList;
32
+ /** {@link HTMLAnchorElement.target} */
33
+ target(target: $Parameter<AnchorTarget>): this;
34
+ target(): AnchorTarget;
35
+ /** {@link HTMLAnchorElement.text} */
36
+ text(text: $Parameter<string>): this;
37
+ text(): string;
38
+ /** {@link HTMLAnchorElement.type} */
39
+ type(type: $Parameter<string>): this;
40
+ type(): string;
41
+ }
42
+
43
+ export type AnchorTarget = '_self' | '_blank' | '_parent' | '_top' | '_unfenced_top' | '';
44
+
45
+ declare module '#core' {
46
+ export function $(nodeName: 'a'): $Anchor
47
+ }
48
+
49
+ assignHelper(HTMLAnchorElement, $Anchor, 'a');
@@ -0,0 +1,16 @@
1
+ import { assignHelper } from "#lib/assignHelper";
2
+ import { $HTMLElement } from "#node/$HTMLElement";
3
+
4
+ export class $Canvas extends $HTMLElement<HTMLCanvasElement> {
5
+ constructor() {
6
+ super('canvas')
7
+ }
8
+ }
9
+
10
+ export interface $Canvas extends $HTMLElement<HTMLCanvasElement> {}
11
+
12
+ assignHelper(HTMLCanvasElement, $Canvas, 'canvas');
13
+
14
+ declare module '#core' {
15
+ export function $(nodeName: 'canvas'): $Canvas
16
+ }
@@ -0,0 +1,16 @@
1
+ import { assignHelper } from "#lib/assignHelper";
2
+ import { $HTMLElement } from "#node/$HTMLElement";
3
+
4
+ export class $Dialog extends $HTMLElement<HTMLDialogElement> {
5
+ constructor() {
6
+ super('dialog')
7
+ }
8
+ }
9
+
10
+ export interface $Dialog extends $HTMLElement<HTMLDialogElement> {}
11
+
12
+ assignHelper(HTMLDialogElement, $Dialog, 'dialog');
13
+
14
+ declare module '#core' {
15
+ export function $(nodeName: 'dialog'): $Dialog
16
+ }
@@ -0,0 +1,16 @@
1
+ import { assignHelper } from "#lib/assignHelper";
2
+ import { $HTMLElement } from "#node/$HTMLElement";
3
+
4
+ export class $Form extends $HTMLElement<HTMLFormElement> {
5
+ constructor() {
6
+ super('form')
7
+ }
8
+ }
9
+
10
+ export interface $Form extends $HTMLElement<HTMLFormElement> {}
11
+
12
+ assignHelper(HTMLFormElement, $Form, 'form');
13
+
14
+ declare module '#core' {
15
+ export function $(nodeName: 'form'): $Form
16
+ }
@@ -0,0 +1,72 @@
1
+ import { assignHelper } from "#lib/assignHelper";
2
+ import { $HTMLElement } from "#node/$HTMLElement";
3
+
4
+ export class $Image extends $HTMLElement<HTMLImageElement> {
5
+ constructor() {
6
+ super('img')
7
+ }
8
+ }
9
+
10
+ export interface $Image extends $HTMLElement<HTMLImageElement> {
11
+ /** {@link HTMLImageElement.complete} */
12
+ readonly complete: boolean;
13
+ /** {@link HTMLImageElement.currentSrc} */
14
+ readonly currentSrc: string;
15
+ /** {@link HTMLImageElement.naturalHeight} */
16
+ readonly naturalHeight: number;
17
+ /** {@link HTMLImageElement.naturalWidth} */
18
+ readonly naturalWidth: number;
19
+ /** {@link HTMLImageElement.x} */
20
+ readonly x: number;
21
+ /** {@link HTMLImageElement.y} */
22
+ readonly y: number;
23
+
24
+ /** {@link HTMLImageElement.decode} */
25
+ decode(): Promise<this>;
26
+
27
+ /** {@link HTMLImageElement.alt} */
28
+ alt(alt: $Parameter<string>): this;
29
+ alt(): string;
30
+ /** {@link HTMLImageElement.crossOrigin} */
31
+ crossOrigin(crossOrigin: $Parameter<string | null>): this;
32
+ crossOrigin(): string | null;
33
+ /** {@link HTMLImageElement.decoding} */
34
+ decoding(decoding: $Parameter<"async" | "sync" | "auto">): this;
35
+ decoding(): "async" | "sync" | "auto";
36
+ /** {@link HTMLImageElement.fetchPriority} */
37
+ fetchPriority(fetchPriority: $Parameter<"high" | "low" | "auto">): this;
38
+ fetchPriority(): "high" | "low" | "auto";
39
+ /** {@link HTMLImageElement.height} */
40
+ height(height: $Parameter<number>): this;
41
+ height(): number;
42
+ /** {@link HTMLImageElement.isMap} */
43
+ isMap(isMap: $Parameter<boolean>): this;
44
+ isMap(): boolean;
45
+ /** {@link HTMLImageElement.loading} */
46
+ loading(loading: $Parameter<"eager" | "lazy">): this;
47
+ loading(): "eager" | "lazy";
48
+ /** {@link HTMLImageElement.referrerPolicy} */
49
+ referrerPolicy(referrerPolicy: $Parameter<string>): this;
50
+ referrerPolicy(): string;
51
+ /** {@link HTMLImageElement.sizes} */
52
+ sizes(sizes: $Parameter<string>): this;
53
+ sizes(): string;
54
+ /** {@link HTMLImageElement.src} */
55
+ src(src: $Parameter<string>): this;
56
+ src(): string;
57
+ /** {@link HTMLImageElement.srcset} */
58
+ srcset(srcset: $Parameter<string>): this;
59
+ srcset(): string;
60
+ /** {@link HTMLImageElement.useMap} */
61
+ useMap(useMap: $Parameter<string>): this;
62
+ useMap(): string;
63
+ /** {@link HTMLImageElement.width} */
64
+ width(width: $Parameter<number>): this;
65
+ width(): number;
66
+ }
67
+
68
+ assignHelper(HTMLImageElement, $Image, 'img');
69
+
70
+ declare module '#core' {
71
+ export function $(nodeName: 'img'): $Image
72
+ }