@vixoniccom/aqi 0.0.5 → 0.0.6-dev.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.env +1 -0
- package/.github/workflows/main.yml +6 -122
- package/CHANGELOG.md +2 -0
- package/build/main.js +1 -1
- package/build.zip +0 -0
- package/configuration/appeareanceGroup/AppeareanceInputs.ts +31 -8
- package/configuration/utils.ts +4 -0
- package/configuration.json +66 -7
- package/package.json +1 -1
- package/src/App.tsx +25 -1
- package/src/parameters.d.ts +3 -35
- package/src/presets/preset1.json +22 -0
- package/src/presets/preset2.json +23 -0
- package/tsconfig.json +1 -0
package/build.zip
CHANGED
|
Binary file
|
|
@@ -1,41 +1,64 @@
|
|
|
1
1
|
import { Label, NumberInput, SelectAssetKna, SelectInput, TextFormat, TextInput } from '@vixoniccom/modules'
|
|
2
|
+
import { ShowValidations } from '../utils'
|
|
3
|
+
|
|
4
|
+
const { personalizado, presetActive } = ShowValidations
|
|
2
5
|
|
|
3
6
|
export const appeareanceInputs = [
|
|
7
|
+
new Label({ label: 'Tema predefinido' }),
|
|
8
|
+
new SelectInput({
|
|
9
|
+
id: 'themePreset',
|
|
10
|
+
label: 'Tema',
|
|
11
|
+
description: 'Elige un tema para aplicar un estilo visual completo. Selecciona "Personalizado" para configurar cada campo de estilo de forma individual.',
|
|
12
|
+
items: [
|
|
13
|
+
{ label: 'Personalizado', value: 'personalizado' },
|
|
14
|
+
{ label: 'Inferior alargado', value: 'preset1' },
|
|
15
|
+
{ label: 'Lateral', value: 'preset2' },
|
|
16
|
+
],
|
|
17
|
+
}),
|
|
18
|
+
new Label({ label: 'Fuentes', show: presetActive }),
|
|
19
|
+
new TextFormat({ id: 'aqiFont', label: 'Fuente del índice de calidad del aire', show: presetActive }),
|
|
20
|
+
new TextFormat({ id: 'stationFont', label: 'Fuente de estación que realizó la medición', show: presetActive }),
|
|
21
|
+
new TextFormat({ id: 'qualityFont', label: 'Fuente del mensaje sobre la calidad del aire', show: presetActive }),
|
|
22
|
+
|
|
4
23
|
new Label({ label: 'General' }),
|
|
5
24
|
new SelectAssetKna({ id: 'backgroundImage', label: 'Fondo', required: false, extensions: ['jpg', 'png'] }),
|
|
6
|
-
new Label({ label: 'Posición' }),
|
|
25
|
+
new Label({ label: 'Posición', show: personalizado }),
|
|
7
26
|
new SelectInput({
|
|
8
27
|
id: 'positionCard',
|
|
9
28
|
label: 'Tipo de posición',
|
|
29
|
+
show: personalizado,
|
|
10
30
|
items: [
|
|
11
31
|
{ label: 'Horizontal', value: 'horizontal' },
|
|
12
32
|
{ label: 'Vertical', value: 'vertical' },
|
|
13
33
|
],
|
|
14
34
|
}),
|
|
15
|
-
new Label({ label: 'Diseño de la tarjeta' }),
|
|
35
|
+
new Label({ label: 'Diseño de la tarjeta', show: personalizado }),
|
|
16
36
|
new NumberInput({
|
|
17
37
|
id: 'topSeparationCard',
|
|
18
38
|
label: 'Separación desde arriba',
|
|
19
39
|
description: 'Separación de la tarjeta del margen superior',
|
|
40
|
+
show: personalizado,
|
|
20
41
|
}),
|
|
21
42
|
new NumberInput({
|
|
22
43
|
id: 'leftSeparationCard',
|
|
23
44
|
label: 'Separación desde izquierda',
|
|
24
45
|
description: 'Separación de la tarjeta del margen izquierdo',
|
|
46
|
+
show: personalizado,
|
|
25
47
|
}),
|
|
26
|
-
new NumberInput({ id: 'cardWidth', label: 'Ancho', required: false, description: 'Ancho de la tarjeta' }),
|
|
27
|
-
new NumberInput({ id: 'cardHeight', label: 'Alto', required: false, description: 'Altura de la tarjeta' }),
|
|
48
|
+
new NumberInput({ id: 'cardWidth', label: 'Ancho', required: false, description: 'Ancho de la tarjeta', show: personalizado }),
|
|
49
|
+
new NumberInput({ id: 'cardHeight', label: 'Alto', required: false, description: 'Altura de la tarjeta', show: personalizado }),
|
|
28
50
|
new NumberInput({
|
|
29
51
|
id: 'cardGap',
|
|
30
52
|
label: 'Separación entre elementos',
|
|
31
53
|
required: false,
|
|
32
54
|
description: 'Separación entre los elementos de la tarjeta',
|
|
55
|
+
show: personalizado,
|
|
33
56
|
}),
|
|
34
57
|
|
|
35
|
-
new Label({ label: 'Textos de la tarjeta' }),
|
|
36
|
-
new TextFormat({ id: 'aqiFormat', label: 'Formato del índice de calidad del aire' }),
|
|
37
|
-
new TextFormat({ id: 'stationFormat', label: 'Formato de estación que realizó la medición' }),
|
|
38
|
-
new TextFormat({ id: 'qualityFormat', label: 'Formato del mensaje sobre la calidad del aire' }),
|
|
58
|
+
new Label({ label: 'Textos de la tarjeta', show: personalizado }),
|
|
59
|
+
new TextFormat({ id: 'aqiFormat', label: 'Formato del índice de calidad del aire', show: personalizado }),
|
|
60
|
+
new TextFormat({ id: 'stationFormat', label: 'Formato de estación que realizó la medición', show: personalizado }),
|
|
61
|
+
new TextFormat({ id: 'qualityFormat', label: 'Formato del mensaje sobre la calidad del aire', show: personalizado }),
|
|
39
62
|
|
|
40
63
|
new Label({ label: 'Datos' }),
|
|
41
64
|
new TextInput({
|
package/configuration.json
CHANGED
|
@@ -5,6 +5,53 @@
|
|
|
5
5
|
"label": "Apariencia",
|
|
6
6
|
"type": "group",
|
|
7
7
|
"items": [
|
|
8
|
+
{
|
|
9
|
+
"type": "label",
|
|
10
|
+
"label": "Tema predefinido"
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
"id": "themePreset",
|
|
14
|
+
"label": "Tema",
|
|
15
|
+
"type": "select-input",
|
|
16
|
+
"description": "Elige un tema para aplicar un estilo visual completo. Selecciona \"Personalizado\" para configurar cada campo de estilo de forma individual.",
|
|
17
|
+
"items": [
|
|
18
|
+
{
|
|
19
|
+
"label": "Personalizado",
|
|
20
|
+
"value": "personalizado"
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"label": "Inferior alargado",
|
|
24
|
+
"value": "preset1"
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
"label": "Lateral",
|
|
28
|
+
"value": "preset2"
|
|
29
|
+
}
|
|
30
|
+
]
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
"type": "label",
|
|
34
|
+
"label": "Fuentes",
|
|
35
|
+
"show": "{{themePreset}} && {{themePreset}} !== \"personalizado\""
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
"id": "aqiFont",
|
|
39
|
+
"label": "Fuente del índice de calidad del aire",
|
|
40
|
+
"show": "{{themePreset}} && {{themePreset}} !== \"personalizado\"",
|
|
41
|
+
"type": "text-format"
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
"id": "stationFont",
|
|
45
|
+
"label": "Fuente de estación que realizó la medición",
|
|
46
|
+
"show": "{{themePreset}} && {{themePreset}} !== \"personalizado\"",
|
|
47
|
+
"type": "text-format"
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
"id": "qualityFont",
|
|
51
|
+
"label": "Fuente del mensaje sobre la calidad del aire",
|
|
52
|
+
"show": "{{themePreset}} && {{themePreset}} !== \"personalizado\"",
|
|
53
|
+
"type": "text-format"
|
|
54
|
+
},
|
|
8
55
|
{
|
|
9
56
|
"type": "label",
|
|
10
57
|
"label": "General"
|
|
@@ -22,42 +69,48 @@
|
|
|
22
69
|
},
|
|
23
70
|
{
|
|
24
71
|
"type": "label",
|
|
25
|
-
"label": "Posición"
|
|
72
|
+
"label": "Posición",
|
|
73
|
+
"show": "({{themePreset}} === \"personalizado\" || !{{themePreset}})"
|
|
26
74
|
},
|
|
27
75
|
{
|
|
28
76
|
"id": "positionCard",
|
|
29
77
|
"label": "Tipo de posición",
|
|
78
|
+
"show": "({{themePreset}} === \"personalizado\" || !{{themePreset}})",
|
|
30
79
|
"type": "select-input",
|
|
31
80
|
"items": [
|
|
32
81
|
{
|
|
33
|
-
"
|
|
34
|
-
"
|
|
82
|
+
"label": "Horizontal",
|
|
83
|
+
"value": "horizontal"
|
|
35
84
|
},
|
|
36
85
|
{
|
|
37
|
-
"
|
|
38
|
-
"
|
|
86
|
+
"label": "Vertical",
|
|
87
|
+
"value": "vertical"
|
|
39
88
|
}
|
|
40
89
|
]
|
|
41
90
|
},
|
|
42
91
|
{
|
|
43
92
|
"type": "label",
|
|
44
|
-
"label": "Diseño de la tarjeta"
|
|
93
|
+
"label": "Diseño de la tarjeta",
|
|
94
|
+
"show": "({{themePreset}} === \"personalizado\" || !{{themePreset}})"
|
|
45
95
|
},
|
|
46
96
|
{
|
|
47
97
|
"id": "topSeparationCard",
|
|
48
98
|
"label": "Separación desde arriba",
|
|
99
|
+
"show": "({{themePreset}} === \"personalizado\" || !{{themePreset}})",
|
|
49
100
|
"type": "number-input",
|
|
50
101
|
"description": "Separación de la tarjeta del margen superior"
|
|
51
102
|
},
|
|
52
103
|
{
|
|
53
104
|
"id": "leftSeparationCard",
|
|
54
105
|
"label": "Separación desde izquierda",
|
|
106
|
+
"show": "({{themePreset}} === \"personalizado\" || !{{themePreset}})",
|
|
55
107
|
"type": "number-input",
|
|
56
108
|
"description": "Separación de la tarjeta del margen izquierdo"
|
|
57
109
|
},
|
|
58
110
|
{
|
|
59
111
|
"id": "cardWidth",
|
|
60
112
|
"label": "Ancho",
|
|
113
|
+
"show": "({{themePreset}} === \"personalizado\" || !{{themePreset}})",
|
|
61
114
|
"type": "number-input",
|
|
62
115
|
"description": "Ancho de la tarjeta",
|
|
63
116
|
"required": false
|
|
@@ -65,6 +118,7 @@
|
|
|
65
118
|
{
|
|
66
119
|
"id": "cardHeight",
|
|
67
120
|
"label": "Alto",
|
|
121
|
+
"show": "({{themePreset}} === \"personalizado\" || !{{themePreset}})",
|
|
68
122
|
"type": "number-input",
|
|
69
123
|
"description": "Altura de la tarjeta",
|
|
70
124
|
"required": false
|
|
@@ -72,27 +126,32 @@
|
|
|
72
126
|
{
|
|
73
127
|
"id": "cardGap",
|
|
74
128
|
"label": "Separación entre elementos",
|
|
129
|
+
"show": "({{themePreset}} === \"personalizado\" || !{{themePreset}})",
|
|
75
130
|
"type": "number-input",
|
|
76
131
|
"description": "Separación entre los elementos de la tarjeta",
|
|
77
132
|
"required": false
|
|
78
133
|
},
|
|
79
134
|
{
|
|
80
135
|
"type": "label",
|
|
81
|
-
"label": "Textos de la tarjeta"
|
|
136
|
+
"label": "Textos de la tarjeta",
|
|
137
|
+
"show": "({{themePreset}} === \"personalizado\" || !{{themePreset}})"
|
|
82
138
|
},
|
|
83
139
|
{
|
|
84
140
|
"id": "aqiFormat",
|
|
85
141
|
"label": "Formato del índice de calidad del aire",
|
|
142
|
+
"show": "({{themePreset}} === \"personalizado\" || !{{themePreset}})",
|
|
86
143
|
"type": "text-format"
|
|
87
144
|
},
|
|
88
145
|
{
|
|
89
146
|
"id": "stationFormat",
|
|
90
147
|
"label": "Formato de estación que realizó la medición",
|
|
148
|
+
"show": "({{themePreset}} === \"personalizado\" || !{{themePreset}})",
|
|
91
149
|
"type": "text-format"
|
|
92
150
|
},
|
|
93
151
|
{
|
|
94
152
|
"id": "qualityFormat",
|
|
95
153
|
"label": "Formato del mensaje sobre la calidad del aire",
|
|
154
|
+
"show": "({{themePreset}} === \"personalizado\" || !{{themePreset}})",
|
|
96
155
|
"type": "text-format"
|
|
97
156
|
},
|
|
98
157
|
{
|
package/package.json
CHANGED
package/src/App.tsx
CHANGED
|
@@ -4,6 +4,10 @@ import { FontLoader } from './components/FontLoader'
|
|
|
4
4
|
import { FormattedText } from './components/FormattedText'
|
|
5
5
|
import { AqiData } from './types'
|
|
6
6
|
import { getData } from './services'
|
|
7
|
+
import preset1 from './presets/preset1.json'
|
|
8
|
+
import preset2 from './presets/preset2.json'
|
|
9
|
+
|
|
10
|
+
const PRESETS = { preset1, preset2 } as Record<string, Partial<VixonicParameters>>
|
|
7
11
|
|
|
8
12
|
interface Props {
|
|
9
13
|
data: VixonicData
|
|
@@ -11,7 +15,27 @@ interface Props {
|
|
|
11
15
|
}
|
|
12
16
|
|
|
13
17
|
export const App: React.FunctionComponent<Props> = ({ data, start }) => {
|
|
14
|
-
const { parameters, downloadsPath } = data
|
|
18
|
+
const { parameters: rawParameters, downloadsPath } = data
|
|
19
|
+
|
|
20
|
+
const withFont = (format: VixonicParameters['aqiFormat'], fontFormat: VixonicParameters['aqiFont']) => {
|
|
21
|
+
if (!fontFormat) return format
|
|
22
|
+
const { font, fontColor } = fontFormat
|
|
23
|
+
return { ...format, ...(font ? { font } : {}), ...(fontColor ? { fontColor } : {}) }
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const activePreset = rawParameters.themePreset && rawParameters.themePreset !== 'personalizado'
|
|
27
|
+
? PRESETS[rawParameters.themePreset]
|
|
28
|
+
: undefined
|
|
29
|
+
|
|
30
|
+
const parameters: VixonicParameters = activePreset
|
|
31
|
+
? {
|
|
32
|
+
...rawParameters,
|
|
33
|
+
...activePreset,
|
|
34
|
+
aqiFormat: withFont(activePreset.aqiFormat, rawParameters.aqiFont),
|
|
35
|
+
stationFormat: withFont(activePreset.stationFormat, rawParameters.stationFont),
|
|
36
|
+
qualityFormat: withFont(activePreset.qualityFormat, rawParameters.qualityFont),
|
|
37
|
+
}
|
|
38
|
+
: rawParameters
|
|
15
39
|
const backgroundImageState = parameters.backgroundImage ? `url('${downloadsPath}/${parameters.backgroundImage.filename}')` : ''
|
|
16
40
|
const [formattedData, setFormattedData] = useState<AqiData>()
|
|
17
41
|
const cityInput = parameters?.cityInput || "Santiago"
|
package/src/parameters.d.ts
CHANGED
|
@@ -1,41 +1,9 @@
|
|
|
1
1
|
declare type VixonicData = {
|
|
2
2
|
downloadsPath: string
|
|
3
|
-
services: { [key: string]: { data?: any
|
|
3
|
+
services: { [key: string]: { data?: any, updatedAt?: number } }
|
|
4
4
|
parameters: VixonicParameters
|
|
5
5
|
}
|
|
6
6
|
|
|
7
7
|
declare type VixonicParameters = Partial<{
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
topSeparationCard: number
|
|
11
|
-
leftSeparationCard: number
|
|
12
|
-
cardWidth: number
|
|
13
|
-
cardHeight: number
|
|
14
|
-
cardGap: number
|
|
15
|
-
aqiFormat: {
|
|
16
|
-
fontSize?: number
|
|
17
|
-
fontColor?: string
|
|
18
|
-
alignment?: { horizontal?: 'left' | 'right' | 'center' }
|
|
19
|
-
font?: { filename: string; id: string; __isAsset: true }
|
|
20
|
-
}
|
|
21
|
-
stationFormat: {
|
|
22
|
-
fontSize?: number
|
|
23
|
-
fontColor?: string
|
|
24
|
-
alignment?: { horizontal?: 'left' | 'right' | 'center' }
|
|
25
|
-
font?: { filename: string; id: string; __isAsset: true }
|
|
26
|
-
}
|
|
27
|
-
qualityFormat: {
|
|
28
|
-
fontSize?: number
|
|
29
|
-
fontColor?: string
|
|
30
|
-
alignment?: { horizontal?: 'left' | 'right' | 'center' }
|
|
31
|
-
font?: { filename: string; id: string; __isAsset: true }
|
|
32
|
-
}
|
|
33
|
-
cityInput: string
|
|
34
|
-
msj0: string
|
|
35
|
-
formatMjs: {
|
|
36
|
-
fontSize?: number
|
|
37
|
-
fontColor?: string
|
|
38
|
-
alignment?: { horizontal?: 'left' | 'right' | 'center' }
|
|
39
|
-
font?: { filename: string; id: string; __isAsset: true }
|
|
40
|
-
}
|
|
41
|
-
}>
|
|
8
|
+
themePreset: 'personalizado' | 'preset1' | 'preset2', aqiFont: { fontSize?: number, fontColor?: string, alignment?: { horizontal?: 'left' | 'right' | 'center' }, font?: { filename: string, id: string, __isAsset: true } }, stationFont: { fontSize?: number, fontColor?: string, alignment?: { horizontal?: 'left' | 'right' | 'center' }, font?: { filename: string, id: string, __isAsset: true } }, qualityFont: { fontSize?: number, fontColor?: string, alignment?: { horizontal?: 'left' | 'right' | 'center' }, font?: { filename: string, id: string, __isAsset: true } }, backgroundImage: {id?: string, filename?: string, extension?: string}, positionCard: 'horizontal' | 'vertical', topSeparationCard: number, leftSeparationCard: number, cardWidth: number, cardHeight: number, cardGap: number, aqiFormat: { fontSize?: number, fontColor?: string, alignment?: { horizontal?: 'left' | 'right' | 'center' }, font?: { filename: string, id: string, __isAsset: true } }, stationFormat: { fontSize?: number, fontColor?: string, alignment?: { horizontal?: 'left' | 'right' | 'center' }, font?: { filename: string, id: string, __isAsset: true } }, qualityFormat: { fontSize?: number, fontColor?: string, alignment?: { horizontal?: 'left' | 'right' | 'center' }, font?: { filename: string, id: string, __isAsset: true } }, cityInput: string, msj0: string, formatMjs: { fontSize?: number, fontColor?: string, alignment?: { horizontal?: 'left' | 'right' | 'center' }, font?: { filename: string, id: string, __isAsset: true } }
|
|
9
|
+
}>
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"positionCard": "horizontal",
|
|
3
|
+
"topSeparationCard": 20,
|
|
4
|
+
"leftSeparationCard": 400,
|
|
5
|
+
"cardWidth": 700,
|
|
6
|
+
"cardHeight": 120,
|
|
7
|
+
"aqiFormat": {
|
|
8
|
+
"fontSize": 25,
|
|
9
|
+
"fontColor": "#ffffff",
|
|
10
|
+
"alignment": { "horizontal": "center" }
|
|
11
|
+
},
|
|
12
|
+
"stationFormat": {
|
|
13
|
+
"fontSize": 16,
|
|
14
|
+
"fontColor": "#ffffff",
|
|
15
|
+
"alignment": { "horizontal": "center" }
|
|
16
|
+
},
|
|
17
|
+
"qualityFormat": {
|
|
18
|
+
"fontSize": 20,
|
|
19
|
+
"fontColor": "#ffffff",
|
|
20
|
+
"alignment": { "horizontal": "center" }
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{
|
|
2
|
+
"positionCard": "vertical",
|
|
3
|
+
"topSeparationCard": 220,
|
|
4
|
+
"leftSeparationCard": 116,
|
|
5
|
+
"cardWidth": 194,
|
|
6
|
+
"cardHeight": 316,
|
|
7
|
+
"cardGap": 1,
|
|
8
|
+
"aqiFormat": {
|
|
9
|
+
"fontSize": 15,
|
|
10
|
+
"fontColor": "#ffffff",
|
|
11
|
+
"alignment": { "horizontal": "center" }
|
|
12
|
+
},
|
|
13
|
+
"stationFormat": {
|
|
14
|
+
"fontSize": 4,
|
|
15
|
+
"fontColor": "#ffffff",
|
|
16
|
+
"alignment": { "horizontal": "center" }
|
|
17
|
+
},
|
|
18
|
+
"qualityFormat": {
|
|
19
|
+
"fontSize": 3,
|
|
20
|
+
"fontColor": "#ffffff",
|
|
21
|
+
"alignment": { "horizontal": "center" }
|
|
22
|
+
}
|
|
23
|
+
}
|