@reactful/create 0.0.51

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 (132) hide show
  1. package/README.md +8 -0
  2. package/bun.lockb +0 -0
  3. package/common/package.json +22 -0
  4. package/common/tsconfig.json +24 -0
  5. package/index.js +77 -0
  6. package/package.json +16 -0
  7. package/templates/empty/index.html +12 -0
  8. package/templates/empty/index.ts +5 -0
  9. package/templates/minimal/index.html +12 -0
  10. package/templates/minimal/index.ts +5 -0
  11. package/templates/sampling/apis/auth/db.ts +15 -0
  12. package/templates/sampling/apis/auth/index.ts +28 -0
  13. package/templates/sampling/apis/hello.ts +3 -0
  14. package/templates/sampling/apis/quotes.ts +16 -0
  15. package/templates/sampling/apis/sub/index.ts +3 -0
  16. package/templates/sampling/apis/sub/sub.ts +3 -0
  17. package/templates/sampling/assets/SLIDEME.png +0 -0
  18. package/templates/sampling/assets/default.css +91 -0
  19. package/templates/sampling/assets/favicon.ico +0 -0
  20. package/templates/sampling/assets/icon.png +0 -0
  21. package/templates/sampling/assets/icon.svg +6 -0
  22. package/templates/sampling/assets/logo-144.png +0 -0
  23. package/templates/sampling/assets/logo-168.png +0 -0
  24. package/templates/sampling/assets/logo-192.png +0 -0
  25. package/templates/sampling/assets/logo-48.png +0 -0
  26. package/templates/sampling/assets/logo-512.png +0 -0
  27. package/templates/sampling/assets/logo-72.png +0 -0
  28. package/templates/sampling/assets/logo-96.png +0 -0
  29. package/templates/sampling/assets/manifest.json +57 -0
  30. package/templates/sampling/assets/markdown.css +274 -0
  31. package/templates/sampling/assets/robots.txt +1 -0
  32. package/templates/sampling/assets/system.css +7 -0
  33. package/templates/sampling/builds/about.html +27 -0
  34. package/templates/sampling/builds/bundle.js +13116 -0
  35. package/templates/sampling/builds/bundle.ts +25 -0
  36. package/templates/sampling/builds/client.ts +1 -0
  37. package/templates/sampling/builds/clock.html +30 -0
  38. package/templates/sampling/builds/counter.html +30 -0
  39. package/templates/sampling/builds/forms/form.html +48 -0
  40. package/templates/sampling/builds/forms/index.html +48 -0
  41. package/templates/sampling/builds/hello.html +60 -0
  42. package/templates/sampling/builds/htmlx.html +24 -0
  43. package/templates/sampling/builds/htmlx.tsx +13 -0
  44. package/templates/sampling/builds/index.html +98 -0
  45. package/templates/sampling/builds/login.html +45 -0
  46. package/templates/sampling/builds/profile/index.html +54 -0
  47. package/templates/sampling/builds/quotes.html +26 -0
  48. package/templates/sampling/builds/shared.js +76 -0
  49. package/templates/sampling/builds/system.html +27 -0
  50. package/templates/sampling/components/header.tsx +7 -0
  51. package/templates/sampling/directives/index.ts +1 -0
  52. package/templates/sampling/directives/shown.ts +6 -0
  53. package/templates/sampling/index.html +20 -0
  54. package/templates/sampling/index.ts +19 -0
  55. package/templates/sampling/routes/about.html +13 -0
  56. package/templates/sampling/routes/clock.tsx +35 -0
  57. package/templates/sampling/routes/counter.tsx +21 -0
  58. package/templates/sampling/routes/forms/form.css +19 -0
  59. package/templates/sampling/routes/forms/form.tsx +51 -0
  60. package/templates/sampling/routes/forms/index.tsx +3 -0
  61. package/templates/sampling/routes/hello.tsx +62 -0
  62. package/templates/sampling/routes/htmlx.html +15 -0
  63. package/templates/sampling/routes/index.md +15 -0
  64. package/templates/sampling/routes/login.tsx +36 -0
  65. package/templates/sampling/routes/profile/detail.css +13 -0
  66. package/templates/sampling/routes/profile/detail.tsx +48 -0
  67. package/templates/sampling/routes/profile/index.tsx +14 -0
  68. package/templates/sampling/routes/profile/profile.css +8 -0
  69. package/templates/sampling/routes/profile/tester.tsx +11 -0
  70. package/templates/sampling/routes/quotes.tsx +25 -0
  71. package/templates/sampling/routes/system.tsx +23 -0
  72. package/templates/sampling/tests/access.spec.ts +29 -0
  73. package/templates/sampling/tests/counter.spec.ts +19 -0
  74. package/templates/sampling/tests/form.spec.ts +51 -0
  75. package/templates/sampling/tests/hello.spec.ts +25 -0
  76. package/templates/sampling/tests/path.test.ts +20 -0
  77. package/testings/apis/auth/db.ts +15 -0
  78. package/testings/apis/auth/index.ts +28 -0
  79. package/testings/apis/hello.ts +3 -0
  80. package/testings/apis/quotes.ts +16 -0
  81. package/testings/apis/sub/index.ts +3 -0
  82. package/testings/apis/sub/sub.ts +3 -0
  83. package/testings/assets/SLIDEME.png +0 -0
  84. package/testings/assets/default.css +91 -0
  85. package/testings/assets/favicon.ico +0 -0
  86. package/testings/assets/icon.png +0 -0
  87. package/testings/assets/icon.svg +6 -0
  88. package/testings/assets/logo-144.png +0 -0
  89. package/testings/assets/logo-168.png +0 -0
  90. package/testings/assets/logo-192.png +0 -0
  91. package/testings/assets/logo-48.png +0 -0
  92. package/testings/assets/logo-512.png +0 -0
  93. package/testings/assets/logo-72.png +0 -0
  94. package/testings/assets/logo-96.png +0 -0
  95. package/testings/assets/manifest.json +57 -0
  96. package/testings/assets/markdown.css +274 -0
  97. package/testings/assets/robots.txt +1 -0
  98. package/testings/assets/system.css +7 -0
  99. package/testings/builds/forms/form.html +48 -0
  100. package/testings/builds/forms/index.html +48 -0
  101. package/testings/builds/profile/index.html +54 -0
  102. package/testings/bun.lockb +0 -0
  103. package/testings/components/header.tsx +7 -0
  104. package/testings/directives/index.ts +1 -0
  105. package/testings/directives/shown.ts +6 -0
  106. package/testings/index.html +20 -0
  107. package/testings/index.ts +19 -0
  108. package/testings/package.json +22 -0
  109. package/testings/routes/about.html +13 -0
  110. package/testings/routes/clock.tsx +35 -0
  111. package/testings/routes/counter.tsx +21 -0
  112. package/testings/routes/forms/form.css +19 -0
  113. package/testings/routes/forms/form.tsx +51 -0
  114. package/testings/routes/forms/index.tsx +3 -0
  115. package/testings/routes/hello.tsx +62 -0
  116. package/testings/routes/htmlx.html +15 -0
  117. package/testings/routes/index.md +15 -0
  118. package/testings/routes/login.tsx +36 -0
  119. package/testings/routes/profile/detail.css +13 -0
  120. package/testings/routes/profile/detail.tsx +48 -0
  121. package/testings/routes/profile/index.tsx +14 -0
  122. package/testings/routes/profile/profile.css +8 -0
  123. package/testings/routes/profile/tester.tsx +11 -0
  124. package/testings/routes/quotes.tsx +25 -0
  125. package/testings/routes/system.tsx +23 -0
  126. package/testings/tests/access.spec.ts +29 -0
  127. package/testings/tests/counter.spec.ts +19 -0
  128. package/testings/tests/form.spec.ts +51 -0
  129. package/testings/tests/hello.spec.ts +25 -0
  130. package/testings/tests/path.test.ts +20 -0
  131. package/testings/tsconfig.json +24 -0
  132. package/tsconfig.json +22 -0
@@ -0,0 +1,274 @@
1
+ /*---------------------------------------------------------------------------------------------
2
+ * Copyright (c) Microsoft Corporation. All rights reserved.
3
+ * Licensed under the MIT License. See License.txt in the project root for license information.
4
+ *--------------------------------------------------------------------------------------------*/
5
+ @import url('https://fonts.cdnfonts.com/css/agave');
6
+ @import url('https://fonts.googleapis.com/css2?family=Fira+Sans:wght@100;200;300;400&display=swap');
7
+ @import url('https://fonts.googleapis.com/css2?family=Fira+Sans:wght@100;200;300;400&family=Quicksand:wght@300;400;500;600;700&display=swap');
8
+
9
+
10
+
11
+ :root {
12
+ --base-font: 'fira-sans';
13
+ --code-font: 'agave';
14
+ }
15
+
16
+ @media (prefers-color-scheme: dark) {
17
+ /* :root { filter: invert(80%) contrast(150%); }
18
+ input { filter: invert(10%); } */
19
+ }
20
+
21
+ label > input { margin-left:10px; }
22
+
23
+ input {
24
+ font-family: var(--code-font);
25
+ padding: 5px 7px;
26
+ color: black;
27
+ }
28
+
29
+ html, body {
30
+ font-family: var(--base-font, -apple-system, BlinkMacSystemFont, "Segoe WPC", "Segoe UI", system-ui, "Ubuntu", "Droid Sans", sans-serif);
31
+ font-size: var(--markdown-font-size, 14px);
32
+ line-height: var(--markdown-line-height, 22px);
33
+ word-wrap: break-word;
34
+ }
35
+
36
+ body {
37
+ padding: 10px;
38
+ background: whitesmoke;
39
+ zoom: 1.1;
40
+ }
41
+
42
+
43
+ /* Reset margin top for elements */
44
+ h1,h2,h3,h4,h5,h6,p,ol,ul,pre {
45
+ margin-top: 0;
46
+ }
47
+
48
+ h1,h2,h3,h4,h5,h6 {
49
+ font-weight: 600;
50
+ margin-top: 24px;
51
+ margin-bottom: 16px;
52
+ line-height: 1.25;
53
+ }
54
+
55
+ #code-csp-warning {
56
+ position: fixed;
57
+ top: 0;
58
+ right: 0;
59
+ color: white;
60
+ margin: 16px;
61
+ text-align: center;
62
+ font-size: 12px;
63
+ font-family: sans-serif;
64
+ background-color: #444444;
65
+ cursor: pointer;
66
+ padding: 6px;
67
+ box-shadow: 1px 1px 1px rgba(0, 0, 0, .25);
68
+ }
69
+
70
+ #code-csp-warning:hover {
71
+ text-decoration: none;
72
+ background-color: #007acc;
73
+ box-shadow: 2px 2px 2px rgba(0, 0, 0, .25);
74
+ }
75
+
76
+ body.scrollBeyondLastLine {
77
+ margin-bottom: calc(100vh - 22px);
78
+ }
79
+
80
+ body.showEditorSelection .code-line {
81
+ position: relative;
82
+ }
83
+
84
+ body.showEditorSelection :not(tr, ul, ol).code-active-line:before,
85
+ body.showEditorSelection :not(tr, ul, ol).code-line:hover:before {
86
+ content: "";
87
+ display: block;
88
+ position: absolute;
89
+ top: 0;
90
+ left: -12px;
91
+ height: 100%;
92
+ }
93
+
94
+ .vscode-high-contrast.showEditorSelection :not(tr, ul, ol).code-line .code-line:hover:before {
95
+ border-left: none;
96
+ }
97
+
98
+ body.showEditorSelection li.code-active-line:before,
99
+ body.showEditorSelection li.code-line:hover:before {
100
+ left: -30px;
101
+ }
102
+
103
+ .vscode-light.showEditorSelection .code-active-line:before {
104
+ border-left: 3px solid rgba(0, 0, 0, 0.15);
105
+ }
106
+
107
+ .vscode-light.showEditorSelection .code-line:hover:before {
108
+ border-left: 3px solid rgba(0, 0, 0, 0.40);
109
+ }
110
+
111
+ .vscode-dark.showEditorSelection .code-active-line:before {
112
+ border-left: 3px solid rgba(255, 255, 255, 0.4);
113
+ }
114
+
115
+ .vscode-dark.showEditorSelection .code-line:hover:before {
116
+ border-left: 3px solid rgba(255, 255, 255, 0.60);
117
+ }
118
+
119
+ .vscode-high-contrast.showEditorSelection .code-active-line:before {
120
+ border-left: 3px solid rgba(255, 160, 0, 0.7);
121
+ }
122
+
123
+ .vscode-high-contrast.showEditorSelection .code-line:hover:before {
124
+ border-left: 3px solid rgba(255, 160, 0, 1);
125
+ }
126
+
127
+ /* Prevent `sub` and `sup` elements from affecting line height */
128
+ sub, sup { line-height: 0; }
129
+
130
+ ul ul:first-child,
131
+ ul ol:first-child,
132
+ ol ul:first-child,
133
+ ol ol:first-child {
134
+ margin-bottom: 0;
135
+ }
136
+
137
+ img, video {
138
+ max-width: 100%;
139
+ max-height: 100%;
140
+ }
141
+
142
+ a { text-decoration: none; }
143
+
144
+ a:hover { text-decoration: underline; }
145
+
146
+ a:focus,
147
+ input:focus,
148
+ select:focus,
149
+ textarea:focus {
150
+ outline: 1px solid -webkit-focus-ring-color;
151
+ outline-offset: -1px;
152
+ }
153
+
154
+ p {
155
+ margin-bottom: 16px;
156
+ }
157
+
158
+ li p {
159
+ margin-bottom: 0.7em;
160
+ }
161
+
162
+ ul,
163
+ ol {
164
+ margin-bottom: 0.7em;
165
+ }
166
+
167
+ hr {
168
+ border: 0;
169
+ height: 1px;
170
+ border-bottom: 1px solid;
171
+ }
172
+
173
+ h1 {
174
+ font-size: 2em;
175
+ margin-top: 0;
176
+ padding-bottom: 0.3em;
177
+ border-bottom-width: 1px;
178
+ border-bottom-style: solid;
179
+ }
180
+
181
+ h2 {
182
+ font-size: 1.5em;
183
+ padding-bottom: 0.3em;
184
+ border-bottom-width: 1px;
185
+ border-bottom-style: solid;
186
+ }
187
+
188
+ h3 {
189
+ font-size: 1.25em;
190
+ }
191
+
192
+ h4 {
193
+ font-size: 1em;
194
+ }
195
+
196
+ h5 {
197
+ font-size: 0.875em;
198
+ }
199
+
200
+ h6 {
201
+ font-size: 0.85em;
202
+ }
203
+
204
+ table {
205
+ border-collapse: collapse;
206
+ margin-bottom: 0.7em;
207
+ }
208
+
209
+ th {
210
+ text-align: left;
211
+ border-bottom: 1px solid;
212
+ }
213
+
214
+ th,
215
+ td {
216
+ padding: 5px 10px;
217
+ }
218
+
219
+ table>tbody>tr+tr>td {
220
+ border-top: 1px solid;
221
+ }
222
+
223
+ blockquote {
224
+ margin: 0;
225
+ padding: 2px 16px 0 10px;
226
+ border-left-width: 5px;
227
+ border-left-style: solid;
228
+ border-radius: 2px;
229
+ }
230
+
231
+ code {
232
+ font-family: var(--code-font, "SF Mono", Monaco, Menlo, Consolas, "Ubuntu Mono", "Liberation Mono", "DejaVu Sans Mono", "Courier New", monospace);
233
+ font-size: 1em;
234
+ line-height: 1.357em;
235
+ }
236
+
237
+ body.wordWrap pre {
238
+ white-space: pre-wrap;
239
+ }
240
+
241
+ pre:not(.hljs),
242
+ pre.hljs code>div {
243
+ padding: 16px;
244
+ border-radius: 3px;
245
+ overflow: auto;
246
+ }
247
+
248
+ pre code {
249
+ color: var(--vscode-editor-foreground);
250
+ tab-size: 4;
251
+ }
252
+
253
+ /** Theming */
254
+
255
+ pre {
256
+ background-color: var(--vscode-textCodeBlock-background);
257
+ border: 1px solid var(--vscode-widget-border);
258
+ }
259
+
260
+ .vscode-high-contrast h1 {
261
+ border-color: rgb(0, 0, 0);
262
+ }
263
+
264
+ .vscode-light th {
265
+ border-color: rgba(0, 0, 0, 0.69);
266
+ }
267
+
268
+ .vscode-dark th {
269
+ border-color: rgba(255, 255, 255, 0.69);
270
+ }
271
+
272
+ .vscode-light h1,.vscode-light h2,.vscode-light hr,.vscode-light td { border-color: rgba(0, 0, 0, 0.18);}
273
+
274
+ .vscode-dark h1,.vscode-dark h2,.vscode-dark hr,.vscode-dark td { border-color: rgba(255, 255, 255, 0.18);}
@@ -0,0 +1 @@
1
+ User-agent: *
@@ -0,0 +1,7 @@
1
+ h2 {
2
+ color:green;
3
+ font-weight: bolder;
4
+ border-bottom: solid 3px dimgray;
5
+ font-family: 'Bebas Neue', quicksand, sans-serif !important;
6
+ font-size: 50px !important;
7
+ }
@@ -0,0 +1,48 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <meta name="description" content="Home page">
7
+ <meta name="theme-color" content="#333">
8
+ <link rel="stylesheet" href="/assets/markdown.css">
9
+ <link rel="stylesheet" href="/assets/default.css">
10
+ <link rel="manifest" href="/assets/manifest.json">
11
+ <title>Welcome</title>
12
+ <meta name='viewport' content='width=device-width, initial-scale=1.0' />
13
+ <meta name='description' content='Home page' />
14
+ <meta name='theme-color' content='#333' />
15
+ <meta name='title' content='Welcome' />
16
+ <script src='/mnt/b/Repositorios/reactful/experiments/builds/shared.js'></script>
17
+ <script type='module' src='/mnt/b/Repositorios/reactful/experiments/builds/bundle.js'></script></head>
18
+ <body>
19
+ <div id='root'>
20
+ <jsx tag="jsx" uid="2" own="default"
21
+ src="/mnt/b/Repositorios/reactful/experiments/routes/forms/form.tsx" hidden
22
+ class="default">
23
+ <h1>Uncontrolled Components</h1>
24
+ <progress hidden>test...</progress>
25
+ <form cols="2" method="post" action="https://jsonplaceholder.typicode.com/posts1">
26
+ <label>Name<input id="name" bind="name" />
27
+ </label>
28
+ <label>Date<input type="date" bind="date" />
29
+ </label>
30
+ <label>Work<input pattern="dev|test" bind="work" />
31
+ </label>
32
+ <label>Mode<input bind="mode" />
33
+ </label>
34
+ <hr />
35
+ <hr />
36
+ <label>Accept?<input bind="term" type="checkbox" required />
37
+ </label>
38
+ <button>Submit</button>
39
+ </form>
40
+ <fieldset>
41
+ <legend>ERROR</legend>
42
+ <ul>
43
+ </ul>
44
+ </fieldset>
45
+ </jsx>
46
+ </div>
47
+ </body>
48
+ </html>
@@ -0,0 +1,48 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <meta name="description" content="Home page">
7
+ <meta name="theme-color" content="#333">
8
+ <link rel="stylesheet" href="/assets/markdown.css">
9
+ <link rel="stylesheet" href="/assets/default.css">
10
+ <link rel="manifest" href="/assets/manifest.json">
11
+ <title>Welcome</title>
12
+ <meta name='viewport' content='width=device-width, initial-scale=1.0' />
13
+ <meta name='description' content='Home page' />
14
+ <meta name='theme-color' content='#333' />
15
+ <meta name='title' content='Welcome' />
16
+ <script src='/mnt/b/Repositorios/reactful/experiments/builds/shared.js'></script>
17
+ <script type='module' src='/mnt/b/Repositorios/reactful/experiments/builds/bundle.js'></script></head>
18
+ <body>
19
+ <div id='root'>
20
+ <jsx tag="jsx" uid="2" own="default"
21
+ src="/mnt/b/Repositorios/reactful/experiments/routes/forms/form.tsx" hidden
22
+ class="default">
23
+ <h1>Uncontrolled Components</h1>
24
+ <progress hidden>test...</progress>
25
+ <form cols="2" method="post" action="https://jsonplaceholder.typicode.com/posts1">
26
+ <label>Name<input id="name" bind="name" />
27
+ </label>
28
+ <label>Date<input type="date" bind="date" />
29
+ </label>
30
+ <label>Work<input pattern="dev|test" bind="work" />
31
+ </label>
32
+ <label>Mode<input bind="mode" />
33
+ </label>
34
+ <hr />
35
+ <hr />
36
+ <label>Accept?<input bind="term" type="checkbox" required />
37
+ </label>
38
+ <button>Submit</button>
39
+ </form>
40
+ <fieldset>
41
+ <legend>ERROR</legend>
42
+ <ul>
43
+ </ul>
44
+ </fieldset>
45
+ </jsx>
46
+ </div>
47
+ </body>
48
+ </html>
@@ -0,0 +1,54 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <meta name="description" content="Home page">
7
+ <meta name="theme-color" content="#333">
8
+ <link rel="stylesheet" href="/assets/markdown.css">
9
+ <link rel="stylesheet" href="/assets/default.css">
10
+ <link rel="manifest" href="/assets/manifest.json">
11
+ <title>Welcome</title>
12
+ <meta name='viewport' content='width=device-width, initial-scale=1.0' />
13
+ <meta name='description' content='Home page' />
14
+ <meta name='theme-color' content='#333' />
15
+ <meta name='title' content='Welcome' />
16
+ <script src='/mnt/b/Repositorios/reactful/experiments/builds/shared.js'></script>
17
+ <script type='module' src='/mnt/b/Repositorios/reactful/experiments/builds/bundle.js'></script></head>
18
+ <body>
19
+ <div id='root'>
20
+ <h1 tag="h1" uid="3" class="default" style="color:#ffb300">Profile</h1>
21
+ <jsx tag="jsx" uid="12" own="default"
22
+ src="/mnt/b/Repositorios/reactful/experiments/routes/profile/detail.tsx" hidden
23
+ class="default">
24
+ <h3>Detail</h3>Parametric value = <b>
25
+ </b>
26
+ <hr />
27
+ <p>modular CSS keep original color</p>
28
+ <fieldset>
29
+ <legend>Mode</legend>
30
+ <section>
31
+ <button link="./developer">developer</button>
32
+ <button link="./manager">manager</button>
33
+ <button link="./tester">tester(component)</button>
34
+ </section>
35
+ <hr />
36
+ <section route="./developer">
37
+ <b>DEVELOPER</b> is Lorem ipsum dolor sit amet consectetur adipisicing elit.
38
+ Aspernatur similique ipsa, molestiae numquam laudantium quod, aliquid soluta
39
+ cumque placeat saepe mollitia sint consectetur labore consequatur pariatur
40
+ praesentium animi. Obcaecati, nihil?</section>
41
+ <section route="./manager">
42
+ <b>MANAGER</b> is Lorem ipsum dolor sit amet consectetur adipisicing elit.
43
+ Aspernatur similique ipsa, molestiae numquam laudantium quod, aliquid soluta
44
+ cumque placeat saepe mollitia sint consectetur labore consequatur pariatur
45
+ praesentium animi. Obcaecati, nihil?</section>
46
+ <div>
47
+ </div>
48
+ </fieldset>
49
+ </jsx>
50
+ <hr tag="hr" uid="8" class="default" />
51
+ <p tag="p" uid="10" class="default" style="color:red">modular CSS chainging to red</p>
52
+ </div>
53
+ </body>
54
+ </html>
Binary file
@@ -0,0 +1,7 @@
1
+ import React from 'react'
2
+
3
+ export const Header = props => <>
4
+ <h1 style={{color:'wheat'}}>{ props.children || props.title }</h1>
5
+ </>
6
+
7
+ export default { ok:true }
@@ -0,0 +1 @@
1
+ export * from './shown'
@@ -0,0 +1,6 @@
1
+ declare module "react" { interface HTMLAttributes<T> { shown?:boolean } }
2
+
3
+ export const shown = props =>
4
+ props?.shown === false
5
+ ? { ...props, hidden: true }
6
+ : props
@@ -0,0 +1,20 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+
4
+ <head>
5
+ <meta charset="UTF-8">
6
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
7
+
8
+ <meta name="description" content="Home page" >
9
+ <meta name="theme-color" content="#333"/>
10
+
11
+ <link rel="stylesheet" href="/assets/markdown.css">
12
+ <link rel="stylesheet" href="/assets/default.css" />
13
+ <link rel="manifest" href="/assets/manifest.json" />
14
+
15
+ <title>Welcome</title>
16
+ </head>
17
+ <body>
18
+ <div id="root"></div>
19
+ </body>
20
+ </html>
@@ -0,0 +1,19 @@
1
+ import React from "react"
2
+ import { shown } from './directives'
3
+ import { server } from "@reactful/server"
4
+
5
+ const storage = { name: "ok" }
6
+
7
+ await server("/routes", { failure, storage })
8
+ .inject(shown)
9
+ .render("#root")
10
+
11
+ function failure(status, errors) {
12
+ const children: any[] = errors.map((x, i) =>
13
+ React.createElement('li', { key:i }, x))
14
+
15
+ return React.createElement('div', {}, [
16
+ React.createElement('h1', {}, status),
17
+ React.createElement('ul', {}, children),
18
+ ])
19
+ }
@@ -0,0 +1,22 @@
1
+ {
2
+ "type": "module",
3
+ "name": "testings",
4
+ "module": "index.ts",
5
+ "scripts": {
6
+ "start": "bun --hot run index.ts",
7
+ "build": "rm -rf tsconfig.tsbuildinfo; bunx tsc -p tsconfig.json",
8
+ "clear": "rm -rf node_modules package-lock.json bun.lockb; bun i; bun run build"
9
+ },
10
+ "dependencies": {
11
+ "react": "^18.2.0",
12
+ "react-dom": "^18.2.0",
13
+ "@reactful/extensions": "latest",
14
+ "@reactful/server": "latest",
15
+ "@reactful/web": "latest"
16
+ },
17
+ "devDependencies": {
18
+ "bun-types": "^1.0.20",
19
+ "typescript": "^5.3.3",
20
+ "@types/react": "^18.2.57"
21
+ }
22
+ }
@@ -0,0 +1,13 @@
1
+ <head>
2
+ <title>About</title>
3
+ <meta name="description" content="About page">
4
+ </head>
5
+ <body>
6
+ <h1>About</h1>
7
+ <p>
8
+ Lorem ipsum dolor sit amet consectetur adipisicing elit.
9
+ Adipisci id eaque saepe ab numquam, nisi minus atque obcaecati,
10
+ dignissimos facere accusamus nihil ipsam repudiandae praesentium,
11
+ quia animi perspiciatis architecto fuga?
12
+ </p>
13
+ </body>
@@ -0,0 +1,35 @@
1
+ import React, { Suspense } from 'react'
2
+ import { server, seo } from '@reactful/web'
3
+
4
+ const loading = <h3>Loading content...</h3>
5
+ const address = "https://timeapi.io/api/Time/current/zone?timeZone=Europe/Amsterdam"
6
+
7
+ //@ts-ignore
8
+ @server("dynamic")
9
+ @seo('Time Zone', 'Time zone clock...')
10
+ export default function(props: any) {
11
+ return <Suspense fallback={loading}>
12
+ <TimeZone />
13
+ </Suspense>
14
+ }
15
+
16
+ async function TimeZone() {
17
+ const response = await fetch(address)
18
+ const { year, month, day, hour, minute, seconds } = await response.json()
19
+ const time = `${hour}:${minute}:${seconds}`
20
+ const date = `${year}-${month}-${day}`
21
+
22
+ return <React.Fragment>
23
+ <h1>World Clock</h1>
24
+ <h2>Europe/Amistedan timezone</h2>
25
+ <h3 style={{color:'yellow'}}> {date} {time} </h3>
26
+ <Suspense fallback={loading}>
27
+ <InnerAsyncComponent />
28
+ </Suspense>
29
+ </React.Fragment>
30
+ }
31
+
32
+ async function InnerAsyncComponent() {
33
+ await new Promise(promise => setTimeout(promise, 1000))
34
+ return <code><mark>I'm a inner subcomponent !!!</mark></code>
35
+ }
@@ -0,0 +1,21 @@
1
+ import React from 'react'
2
+ import { seo, client } from '@reactful/web'
3
+
4
+ //@ts-ignore
5
+ @seo('Counter', '...')
6
+ export default (props: any) => <>
7
+ <h1>Counter</h1>
8
+ <CountButton />
9
+
10
+ <h6 shown={false}>DONT SHOW ME!</h6>
11
+ </>
12
+
13
+ //@ts-ignore
14
+ @client(true)
15
+ export function CountButton(props: any, feeds: any) {
16
+ function onClick() { props.count ||= 0; props.count++ }
17
+
18
+ return <button style={{ padding:'20px' }} onClick={onClick}>
19
+ COUNTED: <b>{ props.count || 0 }</b>
20
+ </button>
21
+ }
@@ -0,0 +1,19 @@
1
+ /* form {
2
+ gap: 20px;
3
+ display: grid;
4
+ grid-template-columns: repeat(2, 1fr);
5
+ } */
6
+
7
+ code {
8
+ padding: 10px;
9
+ display: block;
10
+ background: silver;
11
+ }
12
+
13
+ progress {
14
+ width: 100%;
15
+ height: 30px;
16
+ }
17
+
18
+ progress[value]::-webkit-progress-bar { border-radius: 0; }
19
+ progress[value]::-webkit-progress-value { border-radius: 0; }
@@ -0,0 +1,51 @@
1
+ import React from "react"
2
+ import { client } from "@reactful/web"
3
+ import '@reactful/commons'
4
+ import "./form.css"
5
+
6
+ //@ts-ignore
7
+ @client(true)
8
+ export default (props, { fails: errors, await: awaits }: Feeds ) => <>
9
+ <h1>Uncontrolled Components</h1>
10
+ <progress hidden={!awaits} >test...</progress>
11
+
12
+ <form grid cols={2} method="post" data={props.user}
13
+ action="https://jsonplaceholder.typicode.com/posts1"
14
+ onValidate={onValidate} onSubmit={e => onSubmit(e)}>
15
+
16
+ <label>Name<input id="name" bind="name" /></label>
17
+ <label>Date<input type="date" bind="date" /></label>
18
+ <label>Work<input pattern="dev|test" bind="work" /></label>
19
+ <label>Mode<input validate={modeValidate} bind="mode" /></label>
20
+
21
+ <hr/><hr/>
22
+ <label>Accept?<input bind="term" type="checkbox" required /></label>
23
+ <button>Submit</button>
24
+ </form>
25
+
26
+
27
+ <fieldset shown={!!errors?.length}>
28
+ <legend>ERROR</legend>
29
+ <ul>{ errors?.map(x => <li>{ x.error }</li>) }</ul>
30
+ </fieldset>
31
+ </>
32
+
33
+ function modeValidate(value: string) {
34
+ console.log('modeValidate', value)
35
+ if (!value) return 'Mode is required!'
36
+ if (value.match(/\d+/)) return 'Mode is non-numerical!'
37
+ return ''
38
+ }
39
+
40
+ function onSubmit(e) {
41
+ // after submited validation (feeds)
42
+ console.log('after form submit', e)
43
+
44
+ }
45
+
46
+ async function onValidate(errors: Invalid[]) {
47
+ // add some async custom invalidations
48
+ // ex.: errors.push({field:'*', error:'some error', value:''})
49
+
50
+ console.warn(errors)
51
+ }
@@ -0,0 +1,3 @@
1
+ import Form from './form'
2
+
3
+ export default Form