@innertia-solutions/innertia-nuxt 0.1.12 → 0.1.13
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/components/Attention.vue +269 -0
- package/components/Chart/index.vue +193 -0
- package/components/Container.vue +116 -0
- package/components/CopyButton.vue +98 -0
- package/components/Files/Card.vue +215 -0
- package/components/Files/Preview.vue +675 -0
- package/components/Files/Upload.vue +408 -0
- package/components/Files/UploadModal.vue +83 -0
- package/components/Forms/InputPin.vue +162 -0
- package/components/InfoToolbar.vue +54 -0
- package/components/Kanban/Standard.vue +588 -0
- package/components/Loader.vue +358 -0
- package/components/Modal/Base.vue +6 -0
- package/components/Modal/Confirm.vue +89 -0
- package/components/Modal/DeleteConfirm.vue +14 -31
- package/components/Modal/Form.vue +76 -0
- package/components/Modal/Host.vue +58 -0
- package/components/Modal/Prompt.vue +74 -0
- package/components/Modal.vue +119 -34
- package/components/Table/Standard.vue +198 -25
- package/components/Table/index.vue +169 -369
- package/components/Table/views/ViewCards.vue +74 -0
- package/components/Table/views/ViewDatabase.vue +236 -0
- package/components/Table/views/ViewTable.vue +299 -0
- package/components/Toast/Alert.vue +16 -111
- package/components/Toast/Container.vue +4 -29
- package/components/Toast/Notification.vue +8 -43
- package/components/Toast/Process.vue +8 -86
- package/components/Toast/Stack.vue +59 -0
- package/components/Toast/Standard.vue +115 -0
- package/components/Tree/Standard.vue +49 -4
- package/components/Workflow/Board.vue +356 -0
- package/components/Workflow/Builder.vue +454 -0
- package/components/Workflow/Form.vue +526 -0
- package/components/Workflow/Viewer.vue +225 -0
- package/components/Workflow/edges/TransitionEdge.vue +84 -0
- package/components/Workflow/nodes/StepNode.vue +88 -0
- package/composables/useClipboard.js +79 -0
- package/composables/useConfetti.js +194 -0
- package/composables/useFile.js +189 -0
- package/composables/useModal.js +71 -0
- package/composables/useToast.js +38 -65
- package/composables/useWorkflow/form.js +162 -0
- package/composables/useWorkflow/index.js +18 -0
- package/composables/useWorkflow/view.js +220 -0
- package/composables/useWorkflowLayout.js +162 -0
- package/css/tokens.css +10 -10
- package/nuxt.config.ts +1 -1
- package/package.json +13 -8
- package/stores/modal.js +48 -0
- package/stores/toast.js +156 -117
package/stores/toast.js
CHANGED
|
@@ -1,129 +1,168 @@
|
|
|
1
1
|
// stores/toast.js
|
|
2
2
|
import { defineStore } from 'pinia'
|
|
3
|
-
import {
|
|
3
|
+
import { markRaw } from 'vue'
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
5
|
+
/**
|
|
6
|
+
* Store unificado de toasts. Soporta tres variants:
|
|
7
|
+
*
|
|
8
|
+
* - 'alert' → toast simple con severity + título opcional + mensaje
|
|
9
|
+
* - 'notification' → más prominente, soporta acción y no auto-dismiss
|
|
10
|
+
* - 'process' → con barra de progreso, no auto-dismiss
|
|
11
|
+
*
|
|
12
|
+
* Y 6 posiciones: top-left|center|right · bottom-left|center|right
|
|
13
|
+
*
|
|
14
|
+
* Action opcional para cualquier variant:
|
|
15
|
+
* action: { label: 'Deshacer', onClick: () => { ... } }
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
const POSITIONS = ['top-left','top-center','top-right','bottom-left','bottom-center','bottom-right']
|
|
19
|
+
const SEVERITIES = ['success','error','warning','info']
|
|
20
|
+
|
|
21
|
+
const DEFAULTS = {
|
|
22
|
+
variant: 'alert',
|
|
23
|
+
severity: 'info',
|
|
24
|
+
position: 'top-right',
|
|
25
|
+
duration: 5000,
|
|
26
|
+
closable: true,
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
let _id = 0
|
|
30
|
+
const nextId = () => `t${++_id}`
|
|
31
|
+
|
|
32
|
+
function normalize(input, override = {}) {
|
|
33
|
+
const cfg = typeof input === 'string' ? { message: input } : { ...input }
|
|
34
|
+
const merged = { ...DEFAULTS, ...cfg, ...override }
|
|
35
|
+
if (!POSITIONS.includes(merged.position)) merged.position = 'top-right'
|
|
36
|
+
if (merged.action && typeof merged.action.onClick === 'function') {
|
|
37
|
+
// Pinia evita reactivear funciones — markRaw el objeto
|
|
38
|
+
merged.action = markRaw(merged.action)
|
|
39
|
+
}
|
|
40
|
+
return { ...merged, id: nextId(), createdAt: Date.now() }
|
|
13
41
|
}
|
|
14
42
|
|
|
15
43
|
export const useToastStore = defineStore('toast', {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
this._scheduleRemoval(toast)
|
|
54
|
-
},
|
|
55
|
-
error(config) {
|
|
56
|
-
const normalizedConfig = typeof config === 'string' ? { message: config } : config
|
|
57
|
-
const toast = {
|
|
58
|
-
...toastConfig,
|
|
59
|
-
id: uuid(),
|
|
60
|
-
severity: 'danger',
|
|
61
|
-
icon: 'ti ti-exclamation-circle',
|
|
62
|
-
title: 'Atención',
|
|
63
|
-
position: 'top-right',
|
|
64
|
-
...normalizedConfig,
|
|
65
|
-
}
|
|
66
|
-
this.toasts[toast.position].push(toast)
|
|
67
|
-
this._scheduleRemoval(toast)
|
|
68
|
-
},
|
|
69
|
-
show(config) {
|
|
70
|
-
const toast = {
|
|
71
|
-
id: uuid(),
|
|
72
|
-
severity: 'info',
|
|
73
|
-
position: 'top-right',
|
|
74
|
-
...toastConfig,
|
|
75
|
-
...config,
|
|
76
|
-
}
|
|
77
|
-
this.toasts[toast.position].push(toast)
|
|
78
|
-
this._scheduleRemoval(toast)
|
|
79
|
-
},
|
|
80
|
-
update(id, data) {
|
|
81
|
-
for (const key in this.toasts) {
|
|
82
|
-
const idx = this.toasts[key].findIndex(t => t.id === id)
|
|
83
|
-
if (idx !== -1) {
|
|
84
|
-
this.toasts[key][idx] = { ...this.toasts[key][idx], ...data }
|
|
85
|
-
break
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
},
|
|
89
|
-
remove(id) {
|
|
90
|
-
if (this.timeouts[id] !== undefined) {
|
|
91
|
-
clearTimeout(this.timeouts[id])
|
|
92
|
-
delete this.timeouts[id]
|
|
93
|
-
}
|
|
44
|
+
state: () => ({
|
|
45
|
+
toasts: Object.fromEntries(POSITIONS.map(p => [p, []])),
|
|
46
|
+
timeouts: {},
|
|
47
|
+
}),
|
|
48
|
+
getters: {
|
|
49
|
+
flat(state) {
|
|
50
|
+
return POSITIONS.flatMap(p => state.toasts[p])
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
actions: {
|
|
54
|
+
_push(toast) {
|
|
55
|
+
this.toasts[toast.position].push(toast)
|
|
56
|
+
this._scheduleRemoval(toast)
|
|
57
|
+
return toast.id
|
|
58
|
+
},
|
|
59
|
+
_scheduleRemoval(toast) {
|
|
60
|
+
if (!toast.duration || toast.duration <= 0) return
|
|
61
|
+
const tid = setTimeout(() => this.dismiss(toast.id), toast.duration)
|
|
62
|
+
this.timeouts[toast.id] = tid
|
|
63
|
+
},
|
|
64
|
+
|
|
65
|
+
// ── API pública ──────────────────────────────────────────────────
|
|
66
|
+
show(config) {
|
|
67
|
+
return this._push(normalize(config))
|
|
68
|
+
},
|
|
69
|
+
success(input, config = {}) {
|
|
70
|
+
return this._push(normalize(input, { ...config, severity: 'success' }))
|
|
71
|
+
},
|
|
72
|
+
error(input, config = {}) {
|
|
73
|
+
return this._push(normalize(input, { ...config, severity: 'error', duration: config.duration ?? 7000 }))
|
|
74
|
+
},
|
|
75
|
+
warning(input, config = {}) {
|
|
76
|
+
return this._push(normalize(input, { ...config, severity: 'warning' }))
|
|
77
|
+
},
|
|
78
|
+
info(input, config = {}) {
|
|
79
|
+
return this._push(normalize(input, { ...config, severity: 'info' }))
|
|
80
|
+
},
|
|
94
81
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
_scheduleRemoval(toast) {
|
|
100
|
-
if (toast.duration && toast.duration > 0) {
|
|
101
|
-
const timeoutId = setTimeout(() => {
|
|
102
|
-
this.remove(toast.id)
|
|
103
|
-
}, toast.duration)
|
|
82
|
+
/** Notification — variant prominente, NO auto-dismiss por defecto. */
|
|
83
|
+
notify(config = {}) {
|
|
84
|
+
return this._push(normalize({ ...config, variant: 'notification', duration: config.duration ?? 0 }))
|
|
85
|
+
},
|
|
104
86
|
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
87
|
+
/** Process — toast con barra de progreso. Devuelve id para actualizar. */
|
|
88
|
+
process(title, config = {}) {
|
|
89
|
+
return this._push(normalize({
|
|
90
|
+
...config,
|
|
91
|
+
variant: 'process',
|
|
92
|
+
title,
|
|
93
|
+
progress: 0,
|
|
94
|
+
progressLabel: config.progressLabel ?? 'Iniciando…',
|
|
95
|
+
duration: 0,
|
|
96
|
+
closable: config.closable ?? false,
|
|
97
|
+
}))
|
|
98
|
+
},
|
|
108
99
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
100
|
+
update(id, patch) {
|
|
101
|
+
for (const p of POSITIONS) {
|
|
102
|
+
const idx = this.toasts[p].findIndex(t => t.id === id)
|
|
103
|
+
if (idx !== -1) {
|
|
104
|
+
this.toasts[p][idx] = { ...this.toasts[p][idx], ...patch }
|
|
105
|
+
return
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
},
|
|
109
|
+
updateProgress(id, progress, progressLabel) {
|
|
110
|
+
const patch = { progress: Math.min(100, Math.max(0, progress)) }
|
|
111
|
+
if (progressLabel != null) patch.progressLabel = progressLabel
|
|
112
|
+
this.update(id, patch)
|
|
113
|
+
},
|
|
114
|
+
completeProcess(id, message = 'Completado') {
|
|
115
|
+
this.update(id, {
|
|
116
|
+
progress: 100,
|
|
117
|
+
progressLabel: message,
|
|
118
|
+
severity: 'success',
|
|
119
|
+
closable: true,
|
|
120
|
+
})
|
|
121
|
+
// Auto-dismiss después de 2.5s
|
|
122
|
+
const tid = setTimeout(() => this.dismiss(id), 2500)
|
|
123
|
+
this.timeouts[id] = tid
|
|
124
|
+
},
|
|
125
|
+
failProcess(id, message = 'Error') {
|
|
126
|
+
this.update(id, {
|
|
127
|
+
progressLabel: message,
|
|
128
|
+
severity: 'error',
|
|
129
|
+
closable: true,
|
|
130
|
+
duration: 7000,
|
|
131
|
+
})
|
|
132
|
+
const tid = setTimeout(() => this.dismiss(id), 7000)
|
|
133
|
+
this.timeouts[id] = tid
|
|
134
|
+
},
|
|
117
135
|
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
136
|
+
dismiss(id) {
|
|
137
|
+
if (this.timeouts[id] != null) {
|
|
138
|
+
clearTimeout(this.timeouts[id])
|
|
139
|
+
delete this.timeouts[id]
|
|
140
|
+
}
|
|
141
|
+
for (const p of POSITIONS) {
|
|
142
|
+
const idx = this.toasts[p].findIndex(t => t.id === id)
|
|
143
|
+
if (idx !== -1) {
|
|
144
|
+
this.toasts[p].splice(idx, 1)
|
|
145
|
+
return
|
|
146
|
+
}
|
|
147
|
+
}
|
|
128
148
|
},
|
|
149
|
+
clear(position) {
|
|
150
|
+
if (position && this.toasts[position]) {
|
|
151
|
+
for (const t of this.toasts[position]) {
|
|
152
|
+
if (this.timeouts[t.id]) { clearTimeout(this.timeouts[t.id]); delete this.timeouts[t.id] }
|
|
153
|
+
}
|
|
154
|
+
this.toasts[position] = []
|
|
155
|
+
} else {
|
|
156
|
+
for (const p of POSITIONS) {
|
|
157
|
+
for (const t of this.toasts[p]) {
|
|
158
|
+
if (this.timeouts[t.id]) { clearTimeout(this.timeouts[t.id]); delete this.timeouts[t.id] }
|
|
159
|
+
}
|
|
160
|
+
this.toasts[p] = []
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
},
|
|
164
|
+
|
|
165
|
+
// ── Compat (deprecated) ────────────────────────────────────────
|
|
166
|
+
remove(id) { this.dismiss(id) },
|
|
167
|
+
},
|
|
129
168
|
})
|