nextia 7.0.2 → 7.0.4

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 (73) hide show
  1. package/README.md +5 -2
  2. package/package.json +1 -1
  3. package/src/bin.js +4 -61
  4. package/src/lib/ui.js +9 -0
  5. package/biome.json +0 -21
  6. package/template/README.md +0 -29
  7. package/template/_env.dev +0 -4
  8. package/template/_env.prod +0 -1
  9. package/template/_env.test +0 -1
  10. package/template/_gitignore +0 -10
  11. package/template/biome.json +0 -21
  12. package/template/package.json +0 -35
  13. package/template/public/error.html +0 -14
  14. package/template/public/logo.svg +0 -105
  15. package/template/src/assets/i18n/index.js +0 -26
  16. package/template/src/assets/img/image.svg +0 -6
  17. package/template/src/assets/img/image.webp +0 -0
  18. package/template/src/components/Counter/index.jsx +0 -33
  19. package/template/src/components/Counter/style.css +0 -5
  20. package/template/src/components/Message/index.jsx +0 -12
  21. package/template/src/components/index.js +0 -6
  22. package/template/src/components/ui/Translate/index.jsx +0 -20
  23. package/template/src/index.html +0 -18
  24. package/template/src/index.jsx +0 -4
  25. package/template/src/pages/env/functions.js +0 -3
  26. package/template/src/pages/env/index.jsx +0 -26
  27. package/template/src/pages/env/style.css +0 -2
  28. package/template/src/pages/functions.js +0 -37
  29. package/template/src/pages/home/functions.js +0 -43
  30. package/template/src/pages/home/index.jsx +0 -211
  31. package/template/src/pages/home/style.css +0 -51
  32. package/template/src/pages/http/not-found/index.jsx +0 -10
  33. package/template/src/pages/http/not-found/style.css +0 -2
  34. package/template/src/pages/icons/functions.js +0 -3
  35. package/template/src/pages/icons/index.jsx +0 -21
  36. package/template/src/pages/icons/style.css +0 -8
  37. package/template/src/pages/images/functions.js +0 -3
  38. package/template/src/pages/images/index.jsx +0 -25
  39. package/template/src/pages/images/style.css +0 -27
  40. package/template/src/pages/index.jsx +0 -124
  41. package/template/src/pages/mockapi/functions.js +0 -71
  42. package/template/src/pages/mockapi/index.jsx +0 -101
  43. package/template/src/pages/mockapi/style.css +0 -57
  44. package/template/src/pages/my-context/functions.js +0 -7
  45. package/template/src/pages/my-context/index.jsx +0 -32
  46. package/template/src/pages/my-context/style.css +0 -2
  47. package/template/src/pages/resize/functions.js +0 -3
  48. package/template/src/pages/resize/index.jsx +0 -15
  49. package/template/src/pages/resize/style.css +0 -2
  50. package/template/src/pages/search-params/functions.js +0 -3
  51. package/template/src/pages/search-params/index.jsx +0 -35
  52. package/template/src/pages/search-params/style.css +0 -2
  53. package/template/src/pages/subpage/hello/functions.js +0 -3
  54. package/template/src/pages/subpage/hello/index.jsx +0 -11
  55. package/template/src/pages/subpage/hello/style.css +0 -2
  56. package/template/src/pages/translate/functions.js +0 -5
  57. package/template/src/pages/translate/index.jsx +0 -31
  58. package/template/src/pages/translate/style.css +0 -12
  59. package/template/src/pages/view-transition/functions.js +0 -6
  60. package/template/src/pages/view-transition/index.jsx +0 -30
  61. package/template/src/pages/view-transition/style.css +0 -2
  62. package/template/src/services/api.js +0 -9
  63. package/template/src/services/http.js +0 -40
  64. package/template/src/theme/fonts/Roboto-Regular.ttf +0 -0
  65. package/template/src/theme/fonts/index.css +0 -7
  66. package/template/src/theme/icons/icons.svg +0 -125
  67. package/template/src/theme/icons/index.css +0 -55
  68. package/template/src/theme/index.css +0 -39
  69. package/template/src/theme/utils/index.css +0 -29
  70. package/template/src/theme/utils/view-transition.css +0 -72
  71. package/template/src/utils/index.js +0 -5
  72. package/template/test/index.test.js +0 -11
  73. package/template/vite.config.js +0 -97
package/README.md CHANGED
@@ -5,12 +5,15 @@ Create fast web applications
5
5
  ### To start
6
6
 
7
7
  ```sh
8
+ gcl git@github.com:sinuhedev/nextia.git
8
9
  npm install
9
- cd template
10
+ cd templates/web
10
11
  npm install
11
12
  node --run dev
12
13
  ```
13
14
 
14
- ### npmjs
15
+ ### links
16
+
17
+ [github.com/sinuhedev/nextia](https://github.com/sinuhedev/nextia)
15
18
 
16
19
  [npmjs.com/package/nextia](https://www.npmjs.com/package/nextia)
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "nextia",
3
3
  "description": "Create fast web applications",
4
- "version": "7.0.2",
4
+ "version": "7.0.4",
5
5
  "license": "MIT",
6
6
  "type": "module",
7
7
  "engines": {
package/src/bin.js CHANGED
@@ -6,20 +6,10 @@
6
6
  * This source code is licensed under the MIT license found in the
7
7
  * LICENSE file in the root directory of this source tree.
8
8
  *
9
- * https://github.com/sinuhedev/create-nextia
9
+ * https://github.com/sinuhedev/nextia
10
10
  */
11
11
 
12
- import {
13
- access,
14
- cp,
15
- mkdir,
16
- readFile,
17
- rename,
18
- writeFile
19
- } from 'node:fs/promises'
20
- import { dirname } from 'node:path'
21
- import { fileURLToPath } from 'node:url'
22
- import pkg from '../package.json' with { type: 'json' }
12
+ import { writeFile } from 'node:fs/promises'
23
13
 
24
14
  function toPascalCase(str) {
25
15
  return str
@@ -126,8 +116,8 @@ async function createContainer(name) {
126
116
  // index.jsx
127
117
  writeFile(
128
118
  `${dirName}/index.jsx`,
129
- `import { useEffect } from 'react'
130
- import { css, useFx } from 'nextia'
119
+ `import { css, useFx } from 'nextia'
120
+ import { useEffect } from 'react'
131
121
  import functions from './functions'
132
122
  import './style.css'
133
123
 
@@ -165,48 +155,6 @@ export default { initialState }
165
155
  }
166
156
  }
167
157
 
168
- async function createProject(name) {
169
- const projectPath = `${process.cwd()}/${name}/`
170
-
171
- try {
172
- await access(projectPath)
173
- console.error(`The ${name} already exists`)
174
- return
175
- } catch {
176
- /* directory doesn't exist, proceed */
177
- }
178
-
179
- try {
180
- const __dirname = dirname(fileURLToPath(import.meta.url))
181
- const templatePath = `${__dirname}/../template`
182
-
183
- const replaceToken = async (filename, token, value) => {
184
- const content = await readFile(projectPath + filename, 'utf8')
185
- await writeFile(
186
- projectPath + filename,
187
- content.replaceAll(token, value),
188
- 'utf8'
189
- )
190
- }
191
-
192
- await cp(templatePath, projectPath, { recursive: true })
193
-
194
- await Promise.all(
195
- ['env.dev', 'env.prod', 'env.test', 'gitignore'].map((fileName) =>
196
- rename(`${projectPath}_${fileName}`, `${projectPath}.${fileName}`)
197
- )
198
- )
199
-
200
- await replaceToken('README.md', 'TEMPLATE', name)
201
- await replaceToken('package.json', 'TEMPLATE', name)
202
- await replaceToken('package.json', 'file:../', pkg.version)
203
-
204
- console.info(`✔ Project "${name}" created successfully!`)
205
- } catch (err) {
206
- console.error(`Failed to create project: ${err.message}`)
207
- }
208
- }
209
-
210
158
  async function main() {
211
159
  const ARG1 = process.argv[2]
212
160
  const ARG2 = process.argv[3]
@@ -226,11 +174,6 @@ async function main() {
226
174
  if (ARG2) await createContainer(ARG2)
227
175
  else console.warn('node --run nextia container <ContainerName>')
228
176
  break
229
-
230
- default:
231
- if (ARG1) await createProject(ARG1)
232
- else console.info(`v${pkg.version}\nnextia <ProjectName>`)
233
- break
234
177
  }
235
178
  }
236
179
 
package/src/lib/ui.js CHANGED
@@ -1,3 +1,12 @@
1
+ /**
2
+ * Copyright (c) 2025 Sinuhe Maceda https://sinuhe.dev
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ * https://github.com/sinuhedev/nextia
8
+ */
9
+
1
10
  import { createElement, useEffect, useRef } from 'react'
2
11
  import { useFx } from './fx'
3
12
  import { css } from './utils'
package/biome.json DELETED
@@ -1,21 +0,0 @@
1
- {
2
- "formatter": {
3
- "indentStyle": "space",
4
- "indentWidth": 2
5
- },
6
-
7
- "javascript": {
8
- "formatter": {
9
- "semicolons": "asNeeded",
10
- "quoteStyle": "single",
11
- "jsxQuoteStyle": "double",
12
- "trailingCommas": "none"
13
- }
14
- },
15
-
16
- "css": {
17
- "parser": {
18
- "tailwindDirectives": true
19
- }
20
- }
21
- }
@@ -1,29 +0,0 @@
1
- # TEMPLATE
2
-
3
- # To start
4
- Open http://localhost:3000 to view it in the browser.
5
-
6
- ```sh
7
- npm install
8
- #
9
- node --run dev
10
- node --run test
11
- node --run build <ENV>
12
- node --run preview
13
- ```
14
-
15
- # env
16
- ```.env
17
- .env # loaded in all cases
18
- .env.[ENV] # only loaded in specified ENV [ dev, test, prod ]
19
- ```
20
-
21
- * .env.dev
22
- * .env.prod
23
- * .env.test
24
-
25
- ```env
26
- PUBLIC_TITLE=TITLE
27
- PUBLIC_LOGGER=true
28
- PUBLIC_VIEW_TRANSITION=true
29
- ```
package/template/_env.dev DELETED
@@ -1,4 +0,0 @@
1
- PUBLIC_TITLE=dev
2
- PUBLIC_LOGGER=true
3
- PUBLIC_VIEW_TRANSITION=true
4
- PUBLIC_API=https://65fd14fb9fc4425c653119c5.mockapi.io/api/v1
@@ -1 +0,0 @@
1
- PUBLIC_TITLE=prod
@@ -1 +0,0 @@
1
- PUBLIC_TITLE=test
@@ -1,10 +0,0 @@
1
- node_modules
2
-
3
- out
4
- deploy
5
- deploy-variables
6
-
7
- .coverage
8
- .env
9
- .env.*
10
-
@@ -1,21 +0,0 @@
1
- {
2
- "formatter": {
3
- "indentStyle": "space",
4
- "indentWidth": 2
5
- },
6
-
7
- "javascript": {
8
- "formatter": {
9
- "semicolons": "asNeeded",
10
- "quoteStyle": "single",
11
- "jsxQuoteStyle": "double",
12
- "trailingCommas": "none"
13
- }
14
- },
15
-
16
- "css": {
17
- "parser": {
18
- "tailwindDirectives": true
19
- }
20
- }
21
- }
@@ -1,35 +0,0 @@
1
- {
2
- "name": "TEMPLATE",
3
- "description": "description",
4
- "version": "0.0.0",
5
- "type": "module",
6
- "private": true,
7
- "scripts": {
8
- "dev": "vite --mode dev",
9
- "clean": "rm -fr node_modules package-lock.json .coverage out",
10
- "build": "vite build --mode",
11
- "preview": "vite preview",
12
- "format": "biome format",
13
- "lint": "biome lint",
14
- "check": "biome check --reporter=summary",
15
- "page": "nextia page",
16
- "component": "nextia component",
17
- "container": "nextia container",
18
- "test": "vitest",
19
- "test:name": "vitest run --testNamePattern",
20
- "test:silent": "vitest run --silent",
21
- "test:coverage": "vitest run --silent --coverage"
22
- },
23
- "devDependencies": {
24
- "@vitejs/plugin-react": "^6.0.1",
25
- "@vitest/coverage-v8": "^4.1.2",
26
- "jsdom": "^29.0.1",
27
- "vite": "^8.0.3",
28
- "vitest": "^4.1.2"
29
- },
30
- "dependencies": {
31
- "nextia": "file:../",
32
- "react": "^19.2.4",
33
- "react-dom": "^19.2.4"
34
- }
35
- }
@@ -1,14 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="en">
3
-
4
- <head>
5
- <meta charset="UTF-8" />
6
- <title>Error</title>
7
- <link rel="shortcut icon" href="logo.svg" />
8
- </head>
9
-
10
- <body>
11
- Error ...
12
- </body>
13
-
14
- </html>
@@ -1,105 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2
- <svg
3
- width="64mm"
4
- height="64mm"
5
- viewBox="0 0 63.999981 64"
6
- version="1.1"
7
- id="svg"
8
- xmlns="http://www.w3.org/2000/svg"
9
- xmlns:svg="http://www.w3.org/2000/svg">
10
- <title
11
- id="logo">sinuhe.dev/logo</title>
12
- <defs
13
- id="defs" />
14
- <g
15
- id="layer1"
16
- style="display:none">
17
- <rect
18
- style="opacity:1;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.183199;stroke-linecap:square;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:fill markers stroke"
19
- id="rect4575"
20
- width="68.329857"
21
- height="67.899437"
22
- x="-0.10760616"
23
- y="0.15671897" />
24
- </g>
25
- <g
26
- id="layer6"
27
- style="display:inline"
28
- transform="translate(0,-67.73333)">
29
- <ellipse
30
- style="opacity:1;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.733511;stroke-linecap:square;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:fill markers stroke"
31
- id="path1043"
32
- cx="32.12582"
33
- cy="99.992744"
34
- rx="31.071707"
35
- ry="31.177364" />
36
- </g>
37
- <g
38
- id="layer5"
39
- style="display:inline"
40
- transform="translate(0,-67.73333)">
41
- <g
42
- id="g4700"
43
- style="display:inline;opacity:1;fill:#b21cbe;fill-opacity:1;stroke:#000000;stroke-width:1.04693;stroke-linecap:square;stroke-linejoin:round;stroke-miterlimit:1;stroke-dasharray:none;stroke-opacity:1">
44
- <path
45
- id="path4702"
46
- style="fill:#353564;fill-rule:evenodd;stroke:none;stroke-width:3.31004;stroke-linejoin:round"
47
- d="m 30.832208,99.306623 v 4.743067 l 4.96555,1.50109 v -4.43205 z"
48
- points="30.832208,104.04969 35.797758,105.55078 35.797758,101.11873 30.832208,99.306623 " />
49
- <path
50
- id="path4712"
51
- style="fill:#e9e9ff;fill-rule:evenodd;stroke:none;stroke-width:3.31004;stroke-linejoin:round"
52
- d="m 35.797758,101.11873 3.26925,-2.708535 v 4.896925 l -3.26925,2.24366 z"
53
- points="39.067008,98.410195 39.067008,103.30712 35.797758,105.55078 35.797758,101.11873 " />
54
- <path
55
- id="path4704"
56
- style="fill:#4d4d9f;fill-rule:evenodd;stroke:none;stroke-width:3.31004;stroke-linejoin:round"
57
- d="m 30.832208,99.306623 2.963096,-3.125021 5.271704,2.228593 -3.26925,2.708535 z"
58
- points="33.795304,96.181602 39.067008,98.410195 35.797758,101.11873 30.832208,99.306623 " />
59
- <path
60
- id="path4710"
61
- style="fill:#1c6fbe;fill-opacity:0.850847;fill-rule:evenodd;stroke:none;stroke-width:3.31004;stroke-linejoin:round"
62
- d="m 30.832208,104.04969 2.963096,-2.58867 5.271704,1.8461 -3.26925,2.24366 z"
63
- points="33.795304,101.46102 39.067008,103.30712 35.797758,105.55078 30.832208,104.04969 " />
64
- <path
65
- id="path4708"
66
- style="fill:#1c6fbe;fill-opacity:0.657627;fill-rule:evenodd;stroke:none;stroke-width:3.31004;stroke-linejoin:round"
67
- d="m 33.795304,96.181602 v 5.279418 l 5.271704,1.8461 v -4.896925 z"
68
- points="33.795304,101.46102 39.067008,103.30712 39.067008,98.410195 33.795304,96.181602 " />
69
- <path
70
- id="path4706"
71
- style="fill:#1c6fbe;fill-opacity:0.535593;fill-rule:evenodd;stroke:none;stroke-width:3.31004;stroke-linejoin:round"
72
- d="m 30.832208,99.306623 2.963096,-3.125021 v 5.279418 l -2.963096,2.58867 z"
73
- points="33.795304,96.181602 33.795304,101.46102 30.832208,104.04969 30.832208,99.306623 " />
74
- </g>
75
- <path
76
- style="fill:#1c6fbe;fill-opacity:1;stroke:none;stroke-width:0.253318;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:fill markers stroke"
77
- d="m 11.165395,82.054897 48.085834,16.788915 -1.255039,3.313058 z"
78
- id="path896" />
79
- <path
80
- style="fill:#1c6fbe;fill-opacity:1;stroke:none;stroke-width:0.264583px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
81
- d="m 32.028836,45.114235 18.106422,22.683955 -1.711567,-0.545593 z"
82
- id="path927"
83
- transform="matrix(0.95591558,0,0,0.95591558,-19.451471,38.9295)" />
84
- <path
85
- style="fill:#1c6fbe;fill-opacity:1;stroke:none;stroke-width:0.264583px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
86
- d="m 31.523833,70.837808 -17.088483,18.792702 0.125878,-1.618829 z"
87
- id="path946"
88
- transform="matrix(-0.9346334,0,0,-0.9854517,39.218821,189.98433)" />
89
- <path
90
- style="fill:#1c6fbe;fill-opacity:1;stroke:none;stroke-width:0.264583px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
91
- d="m -0.57636767,103.02518 46.59500667,-19.6116 -2.095993,2.003079 z"
92
- id="path966"
93
- transform="matrix(0.95591558,0,0,0.95591558,10.293548,21.654226)" />
94
- <path
95
- style="display:inline;fill:#1c6fbe;fill-opacity:1;stroke:none;stroke-width:0.264583px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
96
- d="m 31.526079,70.834722 -16.771302,18.447499 0.107264,-1.598211 z"
97
- id="path946-9"
98
- transform="matrix(-0.9346334,0,0,-0.9854517,41.337946,191.74435)" />
99
- <path
100
- style="display:inline;fill:#1c6fbe;fill-opacity:1;stroke:none;stroke-width:0.264583px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
101
- d="m -0.52687485,103.06681 48.61219685,-19.843049 -2.234064,1.992464 z"
102
- id="path966-2"
103
- transform="matrix(0.95591558,0,0,0.95591558,12.41267,23.41428)" />
104
- </g>
105
- </svg>
@@ -1,26 +0,0 @@
1
- export default {
2
- locales: ['EN', 'ES'],
3
- defaultLocale: 'ES',
4
-
5
- ui: {
6
- back: ['Back', 'Regresar'],
7
- cancel: ['Cancel', 'Cancelar'],
8
- home: ['Home', 'Inicio'],
9
- notFound: ['Not Found', 'Extraviado'],
10
- ok: ['OK', 'Aceptar'],
11
- signIn: ['Sign In', 'Iniciar Sesión'],
12
- signOut: ['Sign Out', 'Cerrar Sesión']
13
- },
14
-
15
- page: {
16
- name: ['My name is {0} {1} {2}', 'Mi nombre es {0} {1} {2}'],
17
- user: {
18
- family: ['Family', 'Famlilia']
19
- },
20
- module: {
21
- block: {
22
- docker: ['docker', 'contenedor']
23
- }
24
- }
25
- }
26
- }
@@ -1,6 +0,0 @@
1
- <svg width="256" height="256" viewBox="0 0 48 48" strokeWidth="1" aria-hidden="true" xmlns="http://www.w3.org/2000/svg">
2
- <defs id="defs" />
3
- <path id="background" d="m 6.9596e-8,0 h 50.155103930404003 v 48 h -50.155103930404003 z" fill="#f7df1e" />
4
- <path id="label"
5
- d="m 14.776102,40.11225 3.673125,-2.223 c 0.70875,1.256438 1.353375,2.319562 2.899688,2.319562 1.482186,0 2.416875,-0.57975 2.416875,-2.835 v -15.337125 h 4.510687 v 15.400875 c 0,4.671937 -2.738625,6.798562 -6.73425,6.798562 -3.608437,0 -5.703001,-1.868812 -6.766313,-4.124249 m 15.950625,-0.483 3.67275,-2.126438 c 0.966938,1.578938 2.223563,2.738813 4.446562,2.738813 1.869189,0 3.060938,-0.934501 3.060938,-2.223375 0,-1.5465 -1.224375,-2.094376 -3.286499,-2.99625 l -1.127439,-0.48375 c -3.254437,-1.385062 -5.413124,-3.125063 -5.413124,-6.798188 0,-3.38325 2.577562,-5.961 6.605249,-5.961 2.867626,0 4.929751,0.999001 6.411751,3.608813 l -3.51225,2.255625 c -0.773438,-1.385438 -1.610813,-1.933125 -2.899688,-1.933125 -1.321124,0 -2.158875,0.83775 -2.158875,1.933125 0,1.353187 0.837751,1.90125 2.770875,2.739 l 1.127625,0.483187 c 3.834375,1.643438 5.993063,3.318751 5.993063,7.088251 0,4.060124 -3.18975,6.283124 -7.475063,6.283124 -4.188562,0 -6.895125,-1.997625 -8.216062,-4.607625" />
6
- </svg>
Binary file
@@ -1,33 +0,0 @@
1
- import { useRef } from 'react'
2
- import './style.css'
3
- import { css, startViewTransition } from 'nextia'
4
-
5
- export default function Counter({
6
- name,
7
- value,
8
- className,
9
- style,
10
- animation = 'count',
11
- onChange
12
- }) {
13
- const ref = useRef()
14
-
15
- return (
16
- <article
17
- className={css('Counter-component', className)}
18
- style={style}
19
- name={name}
20
- >
21
- <button
22
- type="button"
23
- onClick={(e) => {
24
- startViewTransition(onChange(e), ref.current, animation)
25
- }}
26
- >
27
- Increment
28
- </button>
29
-
30
- <span ref={ref}>{value}</span>
31
- </article>
32
- )
33
- }
@@ -1,5 +0,0 @@
1
- .Counter-component {
2
- span {
3
- font-size: 60px;
4
- }
5
- }
@@ -1,12 +0,0 @@
1
- import { I18n } from 'nextia'
2
-
3
- export default function Messages({ name, className, style }) {
4
- return (
5
- <article className={className} style={style} name={name}>
6
- Message-component :{' '}
7
- <span>
8
- <I18n value="page.user.family" />
9
- </span>
10
- </article>
11
- )
12
- }
@@ -1,6 +0,0 @@
1
- import Counter from './Counter'
2
- import Message from './Message'
3
- // ui
4
- import Translate from './ui/Translate'
5
-
6
- export { Counter, Message, Translate }
@@ -1,20 +0,0 @@
1
- import { useFx } from 'nextia'
2
-
3
- export default function UiTranslate({ className, style }) {
4
- const { context } = useFx()
5
-
6
- const { currentLocale, locales } = context.state.i18n
7
- const { changeI18n } = context.fx
8
-
9
- return (
10
- <article className={className} style={style}>
11
- <select value={currentLocale} onChange={changeI18n}>
12
- {locales.map((e) => (
13
- <option key={e} value={e} className="m-2">
14
- {e}
15
- </option>
16
- ))}
17
- </select>
18
- </article>
19
- )
20
- }
@@ -1,18 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="en">
3
-
4
- <head>
5
- <meta charset="utf-8" />
6
- <title>%PUBLIC_TITLE%</title>
7
- <link rel="shortcut icon" href="logo.svg" />
8
- <meta name="version" content="%VERSION%" />
9
- <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0" />
10
- <link rel="stylesheet" href="theme/index.css" />
11
- <script type="module" src="index.jsx"></script>
12
- </head>
13
-
14
- <body>
15
- <div id="root"></div>
16
- </body>
17
-
18
- </html>
@@ -1,4 +0,0 @@
1
- import { createRoot } from 'react-dom/client'
2
- import Pages from './pages'
3
-
4
- createRoot(document.getElementById('root')).render(<Pages />)
@@ -1,3 +0,0 @@
1
- const initialState = {}
2
-
3
- export default { initialState }
@@ -1,26 +0,0 @@
1
- import { css, env, useFx } from 'nextia'
2
- import { useEffect } from 'react'
3
- import functions from './functions'
4
- import './style.css'
5
-
6
- export default function EnvPage() {
7
- const { state, fx } = useFx(functions)
8
-
9
- // env
10
- useEffect(() => {
11
- console.log('env:', env)
12
- }, [])
13
-
14
- return (
15
- <section className={css('EnvPage', '')}>
16
- <br />
17
- <br />
18
-
19
- <div style={{ display: 'flex' }}>
20
- <pre style={{ margin: '0 50px 0 50px' }}>
21
- env = {JSON.stringify(env, undefined, 2)}
22
- </pre>
23
- </div>
24
- </section>
25
- )
26
- }
@@ -1,2 +0,0 @@
1
- .EnvPage {
2
- }
@@ -1,37 +0,0 @@
1
- import i18nFile from 'assets/i18n'
2
-
3
- const initialState = {
4
- i18n: {
5
- currentLocale:
6
- window.localStorage.getItem('i18n') || i18nFile.defaultLocale,
7
- locales: i18nFile.locales
8
- },
9
- loading: false,
10
- num: 0
11
- }
12
-
13
- function changeI18n({ payload, set }) {
14
- const { value } = payload.target
15
- set({ i18n: { currentLocale: value } })
16
- window.localStorage.setItem('i18n', value)
17
- }
18
-
19
- function increment({ state, set }) {
20
- set({ num: state.num + 1 })
21
- }
22
-
23
- function decrement({ state, set }) {
24
- set({ num: state.num - 1 })
25
- }
26
-
27
- function zero({ payload, set }) {
28
- set({ num: payload.value })
29
- }
30
-
31
- export default {
32
- initialState,
33
- changeI18n,
34
- increment,
35
- decrement,
36
- zero
37
- }
@@ -1,43 +0,0 @@
1
- const initialState = {
2
- channel: 7,
3
- msg: 'https://sinuhe.dev',
4
- data: { user: 'Sinuhe MB' },
5
- myArray: ['A', 'B', 'C'],
6
- setNameValue: 'name value',
7
- form: {
8
- funny: false,
9
- gender: 'M',
10
- name: {
11
- firstName: 'Sinuhe',
12
- lastName: 'Maceda'
13
- },
14
- year: 33,
15
- moreArray: [[[50, 40, 10]]]
16
- },
17
- ls: {
18
- users: [
19
- {
20
- name: 'sinuhe',
21
- year: 33
22
- },
23
- {
24
- name: 'alberto',
25
- year: 20
26
- }
27
- ]
28
- }
29
- }
30
-
31
- function increment({ state, set }) {
32
- set({ channel: state.channel + 1 })
33
- }
34
-
35
- function decrement({ state, set }) {
36
- set({ channel: state.channel - 1 })
37
- }
38
-
39
- export default {
40
- initialState,
41
- increment,
42
- decrement
43
- }