nextia 7.0.0 → 7.0.3

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 (77) hide show
  1. package/package.json +9 -13
  2. package/src/bin.js +4 -62
  3. package/src/{lib.js → lib/fx.js} +16 -31
  4. package/src/lib/index.js +32 -0
  5. package/src/lib/ui.js +121 -0
  6. package/src/lib/utils.js +107 -0
  7. package/template/README.md +0 -29
  8. package/template/_env.dev +0 -4
  9. package/template/_env.prod +0 -1
  10. package/template/_env.test +0 -1
  11. package/template/_gitignore +0 -10
  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.jpg +0 -0
  17. package/template/src/components/Counter/index.jsx +0 -34
  18. package/template/src/components/Counter/style.css +0 -5
  19. package/template/src/components/Message/index.jsx +0 -12
  20. package/template/src/components/index.js +0 -10
  21. package/template/src/components/ui/I18n/index.jsx +0 -23
  22. package/template/src/components/ui/Icon/index.jsx +0 -50
  23. package/template/src/components/ui/Link/index.jsx +0 -12
  24. package/template/src/components/ui/Svg/index.jsx +0 -54
  25. package/template/src/components/ui/Translate/index.jsx +0 -18
  26. package/template/src/index.html +0 -18
  27. package/template/src/index.jsx +0 -4
  28. package/template/src/pages/counter/functions.js +0 -6
  29. package/template/src/pages/counter/index.jsx +0 -51
  30. package/template/src/pages/counter/style.css +0 -2
  31. package/template/src/pages/env/functions.js +0 -3
  32. package/template/src/pages/env/index.jsx +0 -27
  33. package/template/src/pages/env/style.css +0 -2
  34. package/template/src/pages/functions.js +0 -37
  35. package/template/src/pages/home/functions.js +0 -43
  36. package/template/src/pages/home/index.jsx +0 -211
  37. package/template/src/pages/home/style.css +0 -51
  38. package/template/src/pages/http/not-found/index.jsx +0 -10
  39. package/template/src/pages/http/not-found/style.css +0 -2
  40. package/template/src/pages/icons/functions.js +0 -3
  41. package/template/src/pages/icons/index.jsx +0 -20
  42. package/template/src/pages/icons/style.css +0 -5
  43. package/template/src/pages/images/functions.js +0 -3
  44. package/template/src/pages/images/index.jsx +0 -20
  45. package/template/src/pages/images/style.css +0 -8
  46. package/template/src/pages/index.jsx +0 -114
  47. package/template/src/pages/mockapi/functions.js +0 -71
  48. package/template/src/pages/mockapi/index.jsx +0 -101
  49. package/template/src/pages/mockapi/style.css +0 -57
  50. package/template/src/pages/my-context/functions.js +0 -7
  51. package/template/src/pages/my-context/index.jsx +0 -32
  52. package/template/src/pages/my-context/style.css +0 -2
  53. package/template/src/pages/resize/functions.js +0 -3
  54. package/template/src/pages/resize/index.jsx +0 -15
  55. package/template/src/pages/resize/style.css +0 -2
  56. package/template/src/pages/search-params/functions.js +0 -3
  57. package/template/src/pages/search-params/index.jsx +0 -36
  58. package/template/src/pages/search-params/style.css +0 -2
  59. package/template/src/pages/subpage/hello/functions.js +0 -3
  60. package/template/src/pages/subpage/hello/index.jsx +0 -11
  61. package/template/src/pages/subpage/hello/style.css +0 -2
  62. package/template/src/pages/translate/functions.js +0 -5
  63. package/template/src/pages/translate/index.jsx +0 -31
  64. package/template/src/pages/translate/style.css +0 -12
  65. package/template/src/services/api.js +0 -9
  66. package/template/src/services/http.js +0 -40
  67. package/template/src/theme/animations.css +0 -72
  68. package/template/src/theme/fonts/Roboto-Regular.ttf +0 -0
  69. package/template/src/theme/fonts/index.css +0 -7
  70. package/template/src/theme/icons/exit.svg +0 -69
  71. package/template/src/theme/icons/icons.svg +0 -126
  72. package/template/src/theme/index.css +0 -39
  73. package/template/src/theme/util.css +0 -27
  74. package/template/src/utils/hooks.js +0 -49
  75. package/template/src/utils/index.js +0 -19
  76. package/template/test/index.test.js +0 -12
  77. package/template/vite.config.js +0 -97
@@ -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
- }
Binary file
@@ -1,34 +0,0 @@
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
- }
@@ -1,5 +0,0 @@
1
- .Counter-component {
2
- span {
3
- font-size: 60px;
4
- }
5
- }
@@ -1,12 +0,0 @@
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
- }
@@ -1,10 +0,0 @@
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 }
@@ -1,23 +0,0 @@
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
- }
@@ -1,50 +0,0 @@
1
- import { useEffect, useRef } from 'react'
2
- import icons from 'theme/icons/icons.svg?raw'
3
-
4
- export default function UiIcon({
5
- id,
6
- className,
7
- style,
8
- width = '48',
9
- height,
10
- viewBox = '0 0 48 48',
11
- fill = 'none',
12
- color = 'currentColor',
13
- stroke = 'currentColor',
14
- strokeWidth = '2',
15
- strokeLinecap = 'round',
16
- strokeLinejoin = 'round',
17
- ...props
18
- }) {
19
- const ref = useRef()
20
-
21
- useEffect(() => {
22
- const svg = new DOMParser()
23
- .parseFromString(icons, 'image/svg+xml')
24
- .documentElement.getElementById(id)
25
-
26
- if (svg) {
27
- ref.current.innerHTML = svg.innerHTML
28
- }
29
- }, [id])
30
-
31
- return (
32
- <svg
33
- xmlns="http://www.w3.org/2000/svg"
34
- ref={ref}
35
- id={id}
36
- className={className}
37
- style={style}
38
- width={width}
39
- height={height}
40
- viewBox={viewBox}
41
- fill={fill}
42
- color={color}
43
- stroke={stroke}
44
- strokeWidth={strokeWidth}
45
- strokeLinecap={strokeLinecap}
46
- strokeLinejoin={strokeLinejoin}
47
- {...props}
48
- />
49
- )
50
- }
@@ -1,12 +0,0 @@
1
- export default function UiLink({ children, href, value = {}, ...props }) {
2
- href ??= window.location.hash.split('?')[0]
3
- value = Object.keys(value).length
4
- ? `?${new URLSearchParams(value).toString()}`
5
- : ''
6
-
7
- return (
8
- <a href={href + value} {...props}>
9
- {children}
10
- </a>
11
- )
12
- }
@@ -1,54 +0,0 @@
1
- import { useEffect, useRef } from 'react'
2
-
3
- export default function UiSvg({
4
- src,
5
- width = '48',
6
- height,
7
- viewBox = '0 0 48 48',
8
- fill = 'none',
9
- color = 'currentColor',
10
- stroke = 'currentColor',
11
- strokeWidth = '2',
12
- strokeLinecap = 'round',
13
- strokeLinejoin = 'round'
14
- }) {
15
- const ref = useRef()
16
-
17
- useEffect(() => {
18
- if (!ref.current) return
19
-
20
- const svg = new DOMParser()
21
- .parseFromString(src, 'image/svg+xml')
22
- .querySelector('svg')
23
-
24
- svg.setAttribute('width', width)
25
- svg.setAttribute('height', height ?? width)
26
- svg.setAttribute('viewBox', viewBox)
27
- svg.setAttribute('fill', fill)
28
- svg.setAttribute('color', color)
29
- svg.setAttribute('stroke', stroke)
30
- svg.setAttribute('stroke-width', strokeWidth)
31
- svg.setAttribute('stroke-linecap', strokeLinecap)
32
- svg.setAttribute('stroke-linejoin', strokeLinejoin)
33
-
34
- const shadow =
35
- ref.current.shadowRoot ?? ref.current.attachShadow({ mode: 'open' })
36
- shadow.innerHTML = svg.outerHTML
37
-
38
- ref.current.style.width = `${width}px`
39
- ref.current.style.height = `${height ?? width}px`
40
- }, [
41
- src,
42
- width,
43
- height,
44
- viewBox,
45
- fill,
46
- color,
47
- stroke,
48
- strokeWidth,
49
- strokeLinecap,
50
- strokeLinejoin
51
- ])
52
-
53
- return <div ref={ref} />
54
- }
@@ -1,18 +0,0 @@
1
- export default function UiTranslate({
2
- value,
3
- onChange = () => {},
4
- className,
5
- style
6
- }) {
7
- return (
8
- <article className={className} style={style}>
9
- <select value={value.currentLocale} onChange={onChange}>
10
- {value.locales.map((e) => (
11
- <option key={e} value={e} className="m-2">
12
- {e}
13
- </option>
14
- ))}
15
- </select>
16
- </article>
17
- )
18
- }
@@ -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,6 +0,0 @@
1
- const initialState = {
2
- count: 1,
3
- count2: 1
4
- }
5
-
6
- export default { initialState }
@@ -1,51 +0,0 @@
1
- import { Counter } from 'components'
2
- import { css, useFx } from 'nextia'
3
- import functions from './functions'
4
- import './style.css'
5
-
6
- export default function CounterPage() {
7
- const { state, fx } = useFx(functions)
8
-
9
- return (
10
- <section
11
- className={css(
12
- 'CounterPage',
13
- '',
14
- 'class-test',
15
- 'class-test',
16
- {},
17
- null,
18
- true,
19
- false,
20
- [],
21
- { 'css-false': false },
22
- undefined,
23
- { 'css-true': true },
24
- { 'css-true': true }
25
- )}
26
- >
27
- Counters
28
- <div className={css(null)} />
29
- <div className={css(undefined)} />
30
- <div className={css([])} />
31
- <div className={css({})} />
32
- <div className={css()} />
33
- <Counter
34
- value={state.count}
35
- animation="count"
36
- onChange={() => {
37
- fx.set({ count: state.count + 1 })
38
- }}
39
- />
40
- <br />
41
- <br />
42
- <Counter
43
- value={state.count2}
44
- animation="count2"
45
- onChange={() => {
46
- fx.set({ count2: state.count2 + 10 })
47
- }}
48
- />
49
- </section>
50
- )
51
- }
@@ -1,2 +0,0 @@
1
- .CounterPage {
2
- }
@@ -1,3 +0,0 @@
1
- const initialState = {}
2
-
3
- export default { initialState }
@@ -1,27 +0,0 @@
1
- import { css, useFx } from 'nextia'
2
- import { useEffect } from 'react'
3
- import { env } from 'utils'
4
- import functions from './functions'
5
- import './style.css'
6
-
7
- export default function EnvPage() {
8
- const { state, fx } = useFx(functions)
9
-
10
- // env
11
- useEffect(() => {
12
- console.log('env:', env)
13
- }, [])
14
-
15
- return (
16
- <section className={css('EnvPage', '')}>
17
- <br />
18
- <br />
19
-
20
- <div style={{ display: 'flex' }}>
21
- <pre style={{ margin: '0 50px 0 50px' }}>
22
- env = {JSON.stringify(env, undefined, 2)}
23
- </pre>
24
- </div>
25
- </section>
26
- )
27
- }
@@ -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
- }