nextia 6.1.1 → 7.0.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 (76) hide show
  1. package/README.md +1 -1
  2. package/biome.json +21 -0
  3. package/package.json +13 -4
  4. package/src/bin.js +240 -0
  5. package/src/lib.js +2 -2
  6. package/template/README.md +29 -0
  7. package/template/_env.dev +4 -0
  8. package/template/_env.prod +1 -0
  9. package/template/_env.test +1 -0
  10. package/template/_gitignore +10 -0
  11. package/template/package.json +35 -0
  12. package/template/public/error.html +14 -0
  13. package/template/public/logo.svg +105 -0
  14. package/template/src/assets/i18n/index.js +26 -0
  15. package/template/src/assets/img/image.jpg +0 -0
  16. package/template/src/components/Counter/index.jsx +34 -0
  17. package/template/src/components/Counter/style.css +5 -0
  18. package/template/src/components/Message/index.jsx +12 -0
  19. package/template/src/components/index.js +10 -0
  20. package/template/src/components/ui/I18n/index.jsx +23 -0
  21. package/template/src/components/ui/Icon/index.jsx +50 -0
  22. package/template/src/components/ui/Link/index.jsx +12 -0
  23. package/template/src/components/ui/Svg/index.jsx +54 -0
  24. package/template/src/components/ui/Translate/index.jsx +18 -0
  25. package/template/src/index.html +18 -0
  26. package/template/src/index.jsx +4 -0
  27. package/template/src/pages/counter/functions.js +6 -0
  28. package/template/src/pages/counter/index.jsx +51 -0
  29. package/template/src/pages/counter/style.css +2 -0
  30. package/template/src/pages/env/functions.js +3 -0
  31. package/template/src/pages/env/index.jsx +27 -0
  32. package/template/src/pages/env/style.css +2 -0
  33. package/template/src/pages/functions.js +37 -0
  34. package/template/src/pages/home/functions.js +43 -0
  35. package/template/src/pages/home/index.jsx +211 -0
  36. package/template/src/pages/home/style.css +51 -0
  37. package/template/src/pages/http/not-found/index.jsx +10 -0
  38. package/template/src/pages/http/not-found/style.css +2 -0
  39. package/template/src/pages/icons/functions.js +3 -0
  40. package/template/src/pages/icons/index.jsx +20 -0
  41. package/template/src/pages/icons/style.css +5 -0
  42. package/template/src/pages/images/functions.js +3 -0
  43. package/template/src/pages/images/index.jsx +20 -0
  44. package/template/src/pages/images/style.css +8 -0
  45. package/template/src/pages/index.jsx +114 -0
  46. package/template/src/pages/mockapi/functions.js +71 -0
  47. package/template/src/pages/mockapi/index.jsx +101 -0
  48. package/template/src/pages/mockapi/style.css +57 -0
  49. package/template/src/pages/my-context/functions.js +7 -0
  50. package/template/src/pages/my-context/index.jsx +32 -0
  51. package/template/src/pages/my-context/style.css +2 -0
  52. package/template/src/pages/resize/functions.js +3 -0
  53. package/template/src/pages/resize/index.jsx +15 -0
  54. package/template/src/pages/resize/style.css +2 -0
  55. package/template/src/pages/search-params/functions.js +3 -0
  56. package/template/src/pages/search-params/index.jsx +36 -0
  57. package/template/src/pages/search-params/style.css +2 -0
  58. package/template/src/pages/subpage/hello/functions.js +3 -0
  59. package/template/src/pages/subpage/hello/index.jsx +11 -0
  60. package/template/src/pages/subpage/hello/style.css +2 -0
  61. package/template/src/pages/translate/functions.js +5 -0
  62. package/template/src/pages/translate/index.jsx +31 -0
  63. package/template/src/pages/translate/style.css +12 -0
  64. package/template/src/services/api.js +9 -0
  65. package/template/src/services/http.js +40 -0
  66. package/template/src/theme/animations.css +72 -0
  67. package/template/src/theme/fonts/Roboto-Regular.ttf +0 -0
  68. package/template/src/theme/fonts/index.css +7 -0
  69. package/template/src/theme/icons/exit.svg +69 -0
  70. package/template/src/theme/icons/icons.svg +126 -0
  71. package/template/src/theme/index.css +39 -0
  72. package/template/src/theme/util.css +27 -0
  73. package/template/src/utils/hooks.js +49 -0
  74. package/template/src/utils/index.js +19 -0
  75. package/template/test/index.test.js +12 -0
  76. package/template/vite.config.js +97 -0
package/README.md CHANGED
@@ -6,7 +6,7 @@ Create fast web applications
6
6
 
7
7
  ```sh
8
8
  npm install
9
- cd test-webapp
9
+ cd template
10
10
  npm install
11
11
  node --run dev
12
12
  ```
package/biome.json ADDED
@@ -0,0 +1,21 @@
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
+ }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "nextia",
3
3
  "description": "Create fast web applications",
4
- "version": "6.1.1",
4
+ "version": "7.0.0",
5
5
  "engines": {
6
6
  "node": ">22"
7
7
  },
@@ -20,16 +20,25 @@
20
20
  "keywords": [
21
21
  "react"
22
22
  ],
23
+ "bin": {
24
+ "nextia": "src/bin.js"
25
+ },
23
26
  "main": "src/lib.js",
24
27
  "scripts": {
25
- "clean": "rm -fr node_modules package-lock.json pnpm-lock.yaml .coverage target",
28
+ "clean": "rm -fr my-app node_modules package-lock.json .coverage out",
26
29
  "format": "biome format",
27
30
  "lint": "biome lint src",
28
31
  "check": "biome check --reporter=summary src",
29
32
  "test": "vitest run",
30
33
  "test:name": "vitest run --testNamePattern",
31
34
  "test:silent": "vitest run --silent",
32
- "test:coverage": "vitest run --silent --coverage"
35
+ "test:coverage": "vitest run --silent --coverage",
36
+ "test:version": "./src/bin.js",
37
+ "test:my-app": "rm -fr my-app && src/bin.js my-app",
38
+ "test:my-app:exists": "src/bin.js my-app",
39
+ "test:my-page": "cd my-app && ../src/bin.js page my-page",
40
+ "test:my-component": "cd my-app && ../src/bin.js component MyComponent",
41
+ "test:my-container": "cd my-app && ../src/bin.js container MyContainer"
33
42
  },
34
43
  "peerDependencies": {
35
44
  "react": "^19.2.3",
@@ -38,7 +47,7 @@
38
47
  "devDependencies": {
39
48
  "@vitejs/plugin-react": "^6.0.1",
40
49
  "@vitest/coverage-v8": "^4.0.18",
41
- "jsdom": "^29.0.0",
50
+ "jsdom": "^29.0.1",
42
51
  "vitest": "^4.0.18"
43
52
  }
44
53
  }
package/src/bin.js ADDED
@@ -0,0 +1,240 @@
1
+ #!/usr/bin/env node
2
+
3
+ /**
4
+ * Copyright (c) 2025 Sinuhe Maceda https://sinuhe.dev
5
+ *
6
+ * This source code is licensed under the MIT license found in the
7
+ * LICENSE file in the root directory of this source tree.
8
+ *
9
+ * https://github.com/sinuhedev/create-nextia
10
+ */
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' }
23
+
24
+ function toPascalCase(str) {
25
+ return str
26
+ .toLowerCase()
27
+ .replace(/[^a-zA-Z0-9 ]/g, ' ') // replace special characters
28
+ .split(/\s+/) // split by spaces
29
+ .map((word) => word.charAt(0).toUpperCase() + word.slice(1))
30
+ .join('')
31
+ }
32
+
33
+ async function createPage(name) {
34
+ const dirName = `./src/pages/${name}`
35
+ const pageName = `${toPascalCase(name)}Page`
36
+
37
+ try {
38
+ await mkdir(dirName)
39
+
40
+ // index.jsx
41
+ writeFile(
42
+ `${dirName}/index.jsx`,
43
+ `import { css, useFx } from 'nextia'
44
+ import { useEffect } from 'react'
45
+ import functions from './functions'
46
+ import './style.css'
47
+
48
+ export default function ${pageName} () {
49
+ const { state, fx } = useFx(functions)
50
+
51
+ return (
52
+ <section className={css('${pageName}', '')}>
53
+ ${pageName}
54
+ </section>
55
+ )
56
+ }
57
+ `
58
+ )
59
+
60
+ // style.sss
61
+ writeFile(
62
+ `${dirName}/style.css`,
63
+ `.${pageName} {
64
+ }
65
+ `
66
+ )
67
+
68
+ // function.js
69
+ writeFile(
70
+ `${dirName}/functions.js`,
71
+ `const initialState = {}
72
+
73
+ export default { initialState }
74
+ `
75
+ )
76
+ console.info(`✔ Page "${pageName}" created at ${dirName}`)
77
+ } catch (err) {
78
+ console.error(`Failed to create page: ${err.message}`)
79
+ }
80
+ }
81
+
82
+ async function createComponent(name) {
83
+ const dirName = `./src/components/${name}`
84
+
85
+ try {
86
+ await mkdir(dirName)
87
+ const componentName = toPascalCase(name)
88
+
89
+ // index.jsx
90
+ writeFile(
91
+ `${dirName}/index.jsx`,
92
+ `import { css } from 'nextia'
93
+ import { useEffect } from 'react'
94
+ import './style.css'
95
+
96
+ export default function ${componentName} ({ className, style }) {
97
+ return (
98
+ <article className={css('${componentName}', className)} style={style}>
99
+ ${componentName}
100
+ </article>
101
+ )
102
+ }
103
+ `
104
+ )
105
+
106
+ // style.css
107
+ writeFile(
108
+ `${dirName}/style.css`,
109
+ `.${componentName} {
110
+ }
111
+ `
112
+ )
113
+ console.info(`✔ Component "${name}" created at ${dirName}`)
114
+ } catch (err) {
115
+ console.error(`Failed to create component: ${err.message}`)
116
+ }
117
+ }
118
+
119
+ async function createContainer(name) {
120
+ const dirName = `./src/components/${name}`
121
+
122
+ try {
123
+ await mkdir(dirName)
124
+ const containerName = toPascalCase(name)
125
+
126
+ // index.jsx
127
+ writeFile(
128
+ `${dirName}/index.jsx`,
129
+ `import { useEffect } from 'react'
130
+ import { css, useFx } from 'nextia'
131
+ import functions from './functions'
132
+ import './style.css'
133
+
134
+ export default function ${containerName} ({ className, style }) {
135
+ const { state, fx } = useFx(functions)
136
+
137
+ return (
138
+ <article className={css('${containerName}', className, '')} style={style}>
139
+ ${containerName}
140
+ </article>
141
+ )
142
+ }
143
+ `
144
+ )
145
+
146
+ // style.css
147
+ writeFile(
148
+ `${dirName}/style.css`,
149
+ `.${containerName} {
150
+ }
151
+ `
152
+ )
153
+
154
+ // function.js
155
+ writeFile(
156
+ `${dirName}/functions.js`,
157
+ `const initialState = {}
158
+
159
+ export default { initialState }
160
+ `
161
+ )
162
+ console.info(`✔ Container "${name}" created at ${dirName}`)
163
+ } catch (err) {
164
+ console.error(`Failed to create container: ${err.message}`)
165
+ }
166
+ }
167
+
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
+ await cp(`${__dirname}/../biome.json`, `${projectPath}/biome.json`)
194
+
195
+ await Promise.all(
196
+ ['env.dev', 'env.prod', 'env.test', 'gitignore'].map((fileName) =>
197
+ rename(`${projectPath}_${fileName}`, `${projectPath}.${fileName}`)
198
+ )
199
+ )
200
+
201
+ await replaceToken('README.md', 'TEMPLATE', name)
202
+ await replaceToken('package.json', 'TEMPLATE', name)
203
+ await replaceToken('package.json', 'file:../', pkg.version)
204
+
205
+ console.info(`✔ Project "${name}" created successfully!`)
206
+ } catch (err) {
207
+ console.error(`Failed to create project: ${err.message}`)
208
+ }
209
+ }
210
+
211
+ async function main() {
212
+ const ARG1 = process.argv[2]
213
+ const ARG2 = process.argv[3]
214
+
215
+ switch (ARG1) {
216
+ case 'page':
217
+ if (ARG2) await createPage(ARG2)
218
+ else console.warn('node --run nextia page <page-name>')
219
+ break
220
+
221
+ case 'component':
222
+ if (ARG2) await createComponent(ARG2)
223
+ else console.warn('node --run nextia component <ComponentName>')
224
+ break
225
+
226
+ case 'container':
227
+ if (ARG2) await createContainer(ARG2)
228
+ else console.warn('node --run nextia container <ContainerName>')
229
+ break
230
+
231
+ default:
232
+ if (ARG1) await createProject(ARG1)
233
+ else console.info(`v${pkg.version}\nnpm create nextia <ProjectName>`)
234
+ break
235
+ }
236
+ }
237
+
238
+ main().catch((e) => {
239
+ console.error(e)
240
+ })
package/src/lib.js CHANGED
@@ -9,8 +9,8 @@
9
9
 
10
10
  import { createContext, use, useReducer } from 'react'
11
11
 
12
+ const LOGGER = import.meta.env.DEV && import.meta.env.PUBLIC_LOGGER !== 'false'
12
13
  const PagesContext = createContext()
13
- const isLogger = import.meta.env.DEV
14
14
 
15
15
  /**
16
16
  * util
@@ -169,7 +169,7 @@ function useFx(functions = { initialState: {} }) {
169
169
  const pageContext = use(PagesContext)
170
170
  const { initialState } = functions
171
171
  const [state, dispatch] = useReducer(
172
- isLogger ? reducerLogger : reducer,
172
+ LOGGER ? reducerLogger : reducer,
173
173
  initialState
174
174
  )
175
175
 
@@ -0,0 +1,29 @@
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
+ ```
@@ -0,0 +1,4 @@
1
+ PUBLIC_TITLE=dev
2
+ PUBLIC_LOGGER=true
3
+ PUBLIC_VIEW_TRANSITION=true
4
+ PUBLIC_API=https://65fd14fb9fc4425c653119c5.mockapi.io/api/v1
@@ -0,0 +1 @@
1
+ PUBLIC_TITLE=prod
@@ -0,0 +1 @@
1
+ PUBLIC_TITLE=test
@@ -0,0 +1,10 @@
1
+ node_modules
2
+
3
+ out
4
+ deploy
5
+ deploy-variables
6
+
7
+ .coverage
8
+ .env
9
+ .env.*
10
+
@@ -0,0 +1,35 @@
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.0.18",
26
+ "jsdom": "^29.0.1",
27
+ "vite": "^8.0.1",
28
+ "vitest": "^4.0.18"
29
+ },
30
+ "dependencies": {
31
+ "nextia": "file:../",
32
+ "react": "^19.2.4",
33
+ "react-dom": "^19.2.4"
34
+ }
35
+ }
@@ -0,0 +1,14 @@
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>
@@ -0,0 +1,105 @@
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>
@@ -0,0 +1,26 @@
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
+ }
@@ -0,0 +1,34 @@
1
+ import { useRef } from 'react'
2
+ import './style.css'
3
+ import { css } from 'nextia'
4
+ import { startViewTransition } from 'utils'
5
+
6
+ export default function Counter({
7
+ name,
8
+ value,
9
+ className,
10
+ style,
11
+ animation = 'count',
12
+ onChange
13
+ }) {
14
+ const ref = useRef()
15
+
16
+ return (
17
+ <article
18
+ className={css('Counter-component', className)}
19
+ style={style}
20
+ name={name}
21
+ >
22
+ <button
23
+ type="button"
24
+ onClick={(e) => {
25
+ startViewTransition(onChange(e), ref.current, animation)
26
+ }}
27
+ >
28
+ Increment
29
+ </button>
30
+
31
+ <span ref={ref}>{value}</span>
32
+ </article>
33
+ )
34
+ }
@@ -0,0 +1,5 @@
1
+ .Counter-component {
2
+ span {
3
+ font-size: 60px;
4
+ }
5
+ }
@@ -0,0 +1,12 @@
1
+ import { I18n } from 'components'
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
+ }
@@ -0,0 +1,10 @@
1
+ import Counter from './Counter'
2
+ import Message from './Message'
3
+ // ui
4
+ import I18n from './ui/I18n'
5
+ import Icon from './ui/Icon'
6
+ import Link from './ui/Link'
7
+ import Svg from './ui/Svg'
8
+ import Translate from './ui/Translate'
9
+
10
+ export { Counter, I18n, Icon, Link, Message, Svg, Translate }
@@ -0,0 +1,23 @@
1
+ import i18nFile from 'assets/i18n'
2
+ import { useFx } from 'nextia'
3
+
4
+ export default function UiI18n({ value, args = [] }) {
5
+ const { context } = useFx()
6
+
7
+ try {
8
+ let text = value.split('.').reduce((ac, el) => ac[el], i18nFile)
9
+ text = text[i18nFile.locales.indexOf(context.state.i18n.currentLocale)]
10
+
11
+ if (args) {
12
+ text = text.replace(
13
+ /([{}])\\1|[{](.*?)(?:!(.+?))?[}]/g,
14
+ (match, _literal, number) => args[number] || match
15
+ )
16
+ }
17
+
18
+ return text
19
+ } catch {
20
+ console.error(`Error in [il8n] => ${value}`)
21
+ return value
22
+ }
23
+ }