amateras 0.2.0 → 0.4.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.
- package/README.md +25 -7
- package/ext/css/README.md +19 -0
- package/ext/css/src/index.ts +395 -322
- package/ext/css/src/lib/colorAssign.ts +6 -0
- package/ext/css/src/lib/colors/amber.ts +25 -0
- package/ext/css/src/lib/colors/blackwhite.ts +13 -0
- package/ext/css/src/lib/colors/blue.ts +25 -0
- package/ext/css/src/lib/colors/cyan.ts +25 -0
- package/ext/css/src/lib/colors/emerald.ts +25 -0
- package/ext/css/src/lib/colors/fuchsia.ts +25 -0
- package/ext/css/src/lib/colors/gray.ts +25 -0
- package/ext/css/src/lib/colors/green.ts +25 -0
- package/ext/css/src/lib/colors/indigo.ts +25 -0
- package/ext/css/src/lib/colors/lime.ts +25 -0
- package/ext/css/src/lib/colors/neutral.ts +25 -0
- package/ext/css/src/lib/colors/orange.ts +25 -0
- package/ext/css/src/lib/colors/pink.ts +25 -0
- package/ext/css/src/lib/colors/purple.ts +25 -0
- package/ext/css/src/lib/colors/red.ts +25 -0
- package/ext/css/src/lib/colors/rose.ts +25 -0
- package/ext/css/src/lib/colors/sky.ts +25 -0
- package/ext/css/src/lib/colors/slate.ts +25 -0
- package/ext/css/src/lib/colors/stone.ts +25 -0
- package/ext/css/src/lib/colors/teal.ts +25 -0
- package/ext/css/src/lib/colors/violet.ts +25 -0
- package/ext/css/src/lib/colors/yellow.ts +25 -0
- package/ext/css/src/lib/colors/zinc.ts +25 -0
- package/ext/css/src/lib/colors.ts +23 -0
- package/ext/css/src/structure/$CSSContainerRule.ts +13 -0
- package/ext/css/src/structure/$CSSKeyframesRule.ts +1 -5
- package/ext/css/src/structure/$CSSMediaRule.ts +3 -23
- package/ext/css/src/structure/$CSSRule.ts +6 -18
- package/ext/css/src/structure/$CSSStyleRule.ts +5 -14
- package/ext/css/src/structure/$CSSVariable.ts +3 -3
- package/ext/html/html.ts +1 -13
- package/ext/html/node/$Anchor.ts +31 -1
- package/ext/html/node/$Image.ts +54 -1
- package/ext/html/node/$Input.ts +154 -1
- package/ext/html/node/$OptGroup.ts +8 -1
- package/ext/html/node/$Option.ts +25 -1
- package/ext/html/node/$Select.ts +61 -1
- package/ext/i18n/README.md +53 -0
- package/ext/i18n/package.json +10 -0
- package/ext/i18n/src/index.ts +54 -0
- package/ext/i18n/src/node/I18nText.ts +35 -0
- package/ext/i18n/src/structure/I18n.ts +40 -0
- package/ext/i18n/src/structure/I18nDictionary.ts +31 -0
- package/ext/markdown/index.ts +123 -0
- package/ext/router/index.ts +13 -4
- package/ext/router/node/Page.ts +1 -0
- package/ext/router/node/Route.ts +4 -3
- package/ext/router/node/Router.ts +62 -17
- package/ext/router/node/RouterAnchor.ts +1 -1
- package/ext/ssr/index.ts +7 -5
- package/ext/ui/lib/VirtualScroll.ts +24 -0
- package/ext/ui/node/Accordian.ts +97 -0
- package/ext/ui/node/Tabs.ts +114 -0
- package/ext/ui/node/Toast.ts +16 -0
- package/ext/ui/node/Waterfall.ts +73 -0
- package/ext/ui/package.json +11 -0
- package/package.json +6 -7
- package/src/core.ts +36 -19
- package/src/global.ts +4 -0
- package/src/lib/assign.ts +12 -12
- package/src/lib/assignHelper.ts +2 -2
- package/src/lib/chain.ts +3 -0
- package/src/lib/debounce.ts +7 -0
- package/src/lib/env.ts +2 -0
- package/src/lib/native.ts +22 -24
- package/src/lib/randomId.ts +1 -1
- package/src/lib/sleep.ts +1 -1
- package/src/node/$Element.ts +301 -35
- package/src/node/$HTMLElement.ts +94 -1
- package/src/node/$Node.ts +148 -54
- package/src/node/$Virtual.ts +58 -0
- package/src/{node/node.ts → node.ts} +2 -4
- package/src/structure/Signal.ts +3 -3
- package/ext/css/src/structure/$CSSKeyframeRule.ts +0 -14
package/README.md
CHANGED
|
@@ -23,7 +23,9 @@ const paragraphStyle = $.css({
|
|
|
23
23
|
|
|
24
24
|
$('p').css(paragraphStyle).content([
|
|
25
25
|
'Amateras is a ',
|
|
26
|
-
$('span')
|
|
26
|
+
$('span')
|
|
27
|
+
.css({ color: 'blue', fontWeight: 700 })
|
|
28
|
+
.content('DOM Utility Library.')
|
|
27
29
|
])
|
|
28
30
|
```
|
|
29
31
|
|
|
@@ -34,7 +36,8 @@ import 'amateras';
|
|
|
34
36
|
const count$ = $.signal(0);
|
|
35
37
|
|
|
36
38
|
$(document.body).content([
|
|
37
|
-
$('button')
|
|
39
|
+
$('button')
|
|
40
|
+
.content('Click me')
|
|
38
41
|
.class('class1', 'class2')
|
|
39
42
|
.on('click', () => count$(oldValue => oldValue + 1)),
|
|
40
43
|
$('p').content($`Clicked ${count$} times.`)
|
|
@@ -43,7 +46,7 @@ $(document.body).content([
|
|
|
43
46
|
|
|
44
47
|
## State Management
|
|
45
48
|
```ts
|
|
46
|
-
import 'amateras'
|
|
49
|
+
import 'amateras';
|
|
47
50
|
|
|
48
51
|
const count$ = $.signal(0);
|
|
49
52
|
const doubleCount$ = $.compute(() => count() * 2);
|
|
@@ -56,6 +59,19 @@ $(document.body).content([
|
|
|
56
59
|
])
|
|
57
60
|
```
|
|
58
61
|
|
|
62
|
+
## HTMLElement Methods Import
|
|
63
|
+
```ts
|
|
64
|
+
import 'amateras';
|
|
65
|
+
import 'amateras/html';
|
|
66
|
+
|
|
67
|
+
// without html package
|
|
68
|
+
$('a').attr({ href: '/user' });
|
|
69
|
+
$('img').attr({ src: '/profile.jpg' });
|
|
70
|
+
// with html package
|
|
71
|
+
$('a').href('/user');
|
|
72
|
+
$('img').src('/profile.jpg');
|
|
73
|
+
```
|
|
74
|
+
|
|
59
75
|
## Custom Components
|
|
60
76
|
```ts
|
|
61
77
|
import 'amateras';
|
|
@@ -83,9 +99,11 @@ $(document.body).content([
|
|
|
83
99
|
```
|
|
84
100
|
|
|
85
101
|
## Packages
|
|
102
|
+
The packages size result using Vite 7.0 with default bundle settings, polyfills code size included.
|
|
86
103
|
| Package name | Size | Size(gzip) | Description |
|
|
87
104
|
| --- | --- | --- | --- |
|
|
88
|
-
| amateras | 5.
|
|
89
|
-
| amateras/html | 0.97 kB | 0.
|
|
90
|
-
| [amateras/css](./ext/css/README.md) | 3.
|
|
91
|
-
| [amateras/router](./ext/router/README.md) |
|
|
105
|
+
| amateras | 5.71 kB | 2.48 kB | Core |
|
|
106
|
+
| amateras/html | 0.97 kB | 0.25 kB | Import HTMLElement types and methods |
|
|
107
|
+
| [amateras/css](./ext/css/README.md) | 3.65 kB | 1.41 kB | Style in JS |
|
|
108
|
+
| [amateras/router](./ext/router/README.md) | 3.74 kB | 1.69 kB | Amateras Router |
|
|
109
|
+
| [amateras/i18n](./ext/i18n/README.md) | 1.49 kB | 0.57 kB | I18n translations |
|
package/ext/css/README.md
CHANGED
|
@@ -106,4 +106,23 @@ $(document.body).content([
|
|
|
106
106
|
$('h1').class('title').content('A red color title.')
|
|
107
107
|
])
|
|
108
108
|
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
### CSS Colors Preset
|
|
112
|
+
You can import colors preset from `amateras/color/COLOR_NAME` or `amateras/colors` path. These colors are reference from Tailwind colors, read the [documentation](https://tailwindcss.com/docs/colors) to know about the concepts.
|
|
113
|
+
```ts
|
|
114
|
+
// import black and white color preset
|
|
115
|
+
import 'amateras/color/blackwhite';
|
|
116
|
+
$.color.black; // '#000000'
|
|
117
|
+
$.color.white; // '#ffffff'
|
|
118
|
+
|
|
119
|
+
// import slate colors preset
|
|
120
|
+
import 'amateras/color/slate';
|
|
121
|
+
$.color.slate[100]; // '#f1f5f9'
|
|
122
|
+
$.color.slate[200]; // '#e2e8f0'
|
|
123
|
+
|
|
124
|
+
// import all colors preset
|
|
125
|
+
import 'amateras/colors';
|
|
126
|
+
$.color.red[600]; // '#dc2626'
|
|
127
|
+
$.color.zinc[500]; // '#71717a'
|
|
109
128
|
```
|