@innertia-solutions/nuxt-theme-spark 0.1.11

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 (34) hide show
  1. package/components/Admin/Base.vue +73 -0
  2. package/components/Admin/Header.vue +32 -0
  3. package/components/Admin/Page.vue +5 -0
  4. package/components/Admin/PageHeader.vue +18 -0
  5. package/components/App/Button.vue +59 -0
  6. package/components/App/Dropdown.vue +286 -0
  7. package/components/App/EmptyState.vue +433 -0
  8. package/components/App/LoadingState.vue +40 -0
  9. package/components/App/PageLoadingSpinner.vue +118 -0
  10. package/components/App/SwitchColorTheme.vue +55 -0
  11. package/components/App/Tag.vue +193 -0
  12. package/components/Forms/DatePicker.vue +255 -0
  13. package/components/Forms/Input.vue +72 -0
  14. package/components/Forms/Select.vue +100 -0
  15. package/components/Forms/SelectServer.vue +726 -0
  16. package/components/Layout/Admin.vue +32 -0
  17. package/components/Layout/Auth.vue +29 -0
  18. package/components/Modal/DeleteConfirm.vue +48 -0
  19. package/components/Modal.vue +103 -0
  20. package/components/Nav/Tabs.vue +39 -0
  21. package/components/Table/DownloadDropdown.vue +111 -0
  22. package/components/Table/FilterDropdown.vue +226 -0
  23. package/components/Toast/Alert.vue +113 -0
  24. package/components/Toast/Container.vue +34 -0
  25. package/components/Toast/Notification.vue +45 -0
  26. package/components/Toast/Process.vue +88 -0
  27. package/nuxt.config.ts +15 -0
  28. package/package.json +45 -0
  29. package/plugins/preline.client.ts +68 -0
  30. package/shared/composables/useForm.js +119 -0
  31. package/shared/composables/useTable.ts +84 -0
  32. package/shared/composables/useToast.js +69 -0
  33. package/shared/stores/toast.js +129 -0
  34. package/spark.css +207 -0
@@ -0,0 +1,129 @@
1
+ // stores/toast.js
2
+ import { defineStore } from 'pinia'
3
+ import { v4 as uuid } from 'uuid'
4
+
5
+ const toastConfig = {
6
+ severity: 'info',
7
+ title: null,
8
+ message: null,
9
+ duration: 5000,
10
+ progress: true,
11
+ position: 'top-right',
12
+ icon: null,
13
+ }
14
+
15
+ export const useToastStore = defineStore('toast', {
16
+ state: () => ({
17
+ toasts: {
18
+ 'top-left': [],
19
+ 'top-center': [],
20
+ 'top-right': [],
21
+ 'bottom-left': [],
22
+ 'bottom-center': [],
23
+ 'bottom-right': [],
24
+ },
25
+ timeouts: {}, // id → timeoutId (plain object, JSON-safe)
26
+ }),
27
+ actions: {
28
+ success(config) {
29
+ const normalizedConfig = typeof config === 'string' ? { message: config } : config
30
+ const toast = {
31
+ ...toastConfig,
32
+ id: uuid(),
33
+ severity: 'success',
34
+ icon: 'ti ti-circle-check text-green-500',
35
+ position: 'top-center',
36
+ ...normalizedConfig,
37
+ }
38
+ this.toasts[toast.position].push(toast)
39
+ this._scheduleRemoval(toast)
40
+ },
41
+ info(config) {
42
+ const normalizedConfig = typeof config === 'string' ? { message: config } : config
43
+ const toast = {
44
+ ...toastConfig,
45
+ id: uuid(),
46
+ severity: 'info',
47
+ icon: 'ti ti-info-circle',
48
+ title: 'Info',
49
+ position: 'top-right',
50
+ ...normalizedConfig,
51
+ }
52
+ this.toasts[toast.position].push(toast)
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
+ }
94
+
95
+ for (const key in this.toasts) {
96
+ this.toasts[key] = this.toasts[key].filter(t => t.id !== id)
97
+ }
98
+ },
99
+ _scheduleRemoval(toast) {
100
+ if (toast.duration && toast.duration > 0) {
101
+ const timeoutId = setTimeout(() => {
102
+ this.remove(toast.id)
103
+ }, toast.duration)
104
+
105
+ this.timeouts[toast.id] = timeoutId
106
+ }
107
+ },
108
+
109
+ // Método específico para actualizar progreso de un toast tipo process
110
+ updateProgress(id, progress, progressLabel = null) {
111
+ const updateData = { progress }
112
+ if (progressLabel) {
113
+ updateData.progressLabel = progressLabel
114
+ }
115
+ this.update(id, updateData)
116
+ },
117
+
118
+ // Método para completar un proceso
119
+ completeProcess(id, message = 'Completado') {
120
+ this.update(id, {
121
+ progress: 100,
122
+ progressLabel: message,
123
+ duration: 3000, // Auto-remove después de completar
124
+ })
125
+ // Programar removal para el proceso completado
126
+ this._scheduleRemoval({ id, duration: 3000 })
127
+ },
128
+ },
129
+ })
package/spark.css ADDED
@@ -0,0 +1,207 @@
1
+ @import "tailwindcss";
2
+ @import "preline/variants.css";
3
+ @plugin "@tailwindcss/forms";
4
+ @plugin "@tailwindcss/aspect-ratio";
5
+
6
+ /* Escanear componentes del paquete spark (en node_modules) */
7
+ @source "./components/**/*.vue";
8
+ @source "./shared/**/*.{js,ts}";
9
+ @source "./plugins/**/*.{js,ts}";
10
+
11
+ @custom-variant dark (&:where(.dark, .dark *));
12
+ @custom-variant hover (&:hover);
13
+
14
+ /* ─── Color tokens ─────────────────────────────────────────── */
15
+ @theme {
16
+ --color-background: var(--background);
17
+ --color-background-1: var(--background-1);
18
+ --color-background-2: var(--background-2);
19
+ --color-foreground: var(--foreground);
20
+ --color-foreground-inverse: var(--foreground-inverse);
21
+ --color-primary: var(--primary);
22
+ --color-primary-foreground: var(--primary-foreground);
23
+ --color-primary-hover: var(--primary-hover);
24
+ --color-primary-focus: var(--primary-focus);
25
+ --color-primary-line: var(--primary-line);
26
+ --color-card: var(--card);
27
+ --color-card-line: var(--card-line);
28
+ --color-card-divider: var(--card-divider);
29
+ --color-layer: var(--layer);
30
+ --color-layer-line: var(--layer-line);
31
+ --color-layer-hover: var(--layer-hover);
32
+ --color-layer-focus: var(--layer-focus);
33
+ --color-surface: var(--surface);
34
+ --color-surface-1: var(--surface-1);
35
+ --color-surface-foreground: var(--surface-foreground);
36
+ --color-muted: var(--muted);
37
+ --color-muted-foreground: var(--muted-foreground);
38
+ --color-muted-foreground-1: var(--muted-foreground-1);
39
+ --color-muted-foreground-2: var(--muted-foreground-2);
40
+ --color-muted-hover: var(--muted-hover);
41
+ --color-muted-focus: var(--muted-focus);
42
+ --color-navbar: var(--navbar);
43
+ --color-navbar-line: var(--navbar-line);
44
+ --color-sidebar: var(--sidebar);
45
+ --color-sidebar-line: var(--sidebar-line);
46
+ --color-dropdown: var(--dropdown);
47
+ --color-dropdown-line: var(--dropdown-line);
48
+ --color-dropdown-divider: var(--dropdown-divider);
49
+ --color-dropdown-item-foreground: var(--dropdown-item-foreground);
50
+ --color-dropdown-item-hover: var(--dropdown-item-hover);
51
+ --color-dropdown-item-focus: var(--dropdown-item-focus);
52
+ --color-tooltip: var(--tooltip);
53
+ --color-tooltip-line: var(--tooltip-line);
54
+ --color-tooltip-foreground: var(--tooltip-foreground);
55
+ --color-scrollbar-track: var(--scrollbar-track);
56
+ --color-scrollbar-thumb: var(--scrollbar-thumb);
57
+ --shadow-2xs: 0 1px 2px 0 rgb(15 23 42 / 0.04);
58
+ }
59
+
60
+ /* ─── Light theme ───────────────────────────────────────────── */
61
+ :root {
62
+ --background: #ffffff;
63
+ --background-1: #f8fafc;
64
+ --background-2: #f1f5f9;
65
+ --foreground: #111827;
66
+ --foreground-inverse: #ffffff;
67
+
68
+ --primary: #2563eb;
69
+ --primary-foreground: #ffffff;
70
+ --primary-hover: #1d4ed8;
71
+ --primary-focus: #1d4ed8;
72
+ --primary-line: #1d4ed8;
73
+
74
+ --card: #ffffff;
75
+ --card-line: #e5e7eb;
76
+ --card-divider: #e5e7eb;
77
+
78
+ --layer: #ffffff;
79
+ --layer-line: #e5e7eb;
80
+ --layer-hover: #f8fafc;
81
+ --layer-focus: #f1f5f9;
82
+
83
+ --surface: #f3f4f6;
84
+ --surface-1: #e5e7eb;
85
+ --surface-foreground: #374151;
86
+
87
+ --muted: #f8fafc;
88
+ --muted-foreground: #64748b;
89
+ --muted-foreground-1: #475569;
90
+ --muted-foreground-2: #94a3b8;
91
+ --muted-hover: #f1f5f9;
92
+ --muted-focus: #e2e8f0;
93
+
94
+ --navbar: #ffffff;
95
+ --navbar-line: #e5e7eb;
96
+ --sidebar: #ffffff;
97
+ --sidebar-line: #e5e7eb;
98
+
99
+ --dropdown: #ffffff;
100
+ --dropdown-line: #e5e7eb;
101
+ --dropdown-divider: #e5e7eb;
102
+ --dropdown-item-foreground: #334155;
103
+ --dropdown-item-hover: #f1f5f9;
104
+ --dropdown-item-focus: #e2e8f0;
105
+
106
+ --tooltip: #111827;
107
+ --tooltip-line: #111827;
108
+ --tooltip-foreground: #ffffff;
109
+
110
+ --scrollbar-track: #f1f5f9;
111
+ --scrollbar-thumb: #cbd5e1;
112
+ }
113
+
114
+ /* ─── Dark theme ────────────────────────────────────────────── */
115
+ .dark {
116
+ --background: #020617;
117
+ --background-1: #0f172a;
118
+ --background-2: #111827;
119
+ --foreground: #f8fafc;
120
+ --foreground-inverse: #020617;
121
+
122
+ --primary: #60a5fa;
123
+ --primary-foreground: #0f172a;
124
+ --primary-hover: #93c5fd;
125
+ --primary-focus: #93c5fd;
126
+ --primary-line: #3b82f6;
127
+
128
+ --card: #111827;
129
+ --card-line: #1f2937;
130
+ --card-divider: #1f2937;
131
+
132
+ --layer: #111827;
133
+ --layer-line: #1f2937;
134
+ --layer-hover: #1e293b;
135
+ --layer-focus: #334155;
136
+
137
+ --surface: #1f2937;
138
+ --surface-1: #334155;
139
+ --surface-foreground: #e5e7eb;
140
+
141
+ --muted: #111827;
142
+ --muted-foreground: #94a3b8;
143
+ --muted-foreground-1: #cbd5e1;
144
+ --muted-foreground-2: #64748b;
145
+ --muted-hover: #1e293b;
146
+ --muted-focus: #334155;
147
+
148
+ --navbar: #111827;
149
+ --navbar-line: #1f2937;
150
+ --sidebar: #111827;
151
+ --sidebar-line: #1f2937;
152
+
153
+ --dropdown: #111827;
154
+ --dropdown-line: #1f2937;
155
+ --dropdown-divider: #1f2937;
156
+ --dropdown-item-foreground: #e5e7eb;
157
+ --dropdown-item-hover: #1e293b;
158
+ --dropdown-item-focus: #334155;
159
+
160
+ --tooltip: #f8fafc;
161
+ --tooltip-line: #f8fafc;
162
+ --tooltip-foreground: #020617;
163
+
164
+ --scrollbar-track: #111827;
165
+ --scrollbar-thumb: #475569;
166
+ }
167
+
168
+ /* ─── Base styles ───────────────────────────────────────────── */
169
+ @layer base {
170
+ button:not(:disabled),
171
+ [role="button"]:not(:disabled) {
172
+ cursor: pointer;
173
+ }
174
+
175
+ body {
176
+ font-family: 'Inter', sans-serif;
177
+ font-size: 13px;
178
+ -webkit-font-smoothing: antialiased;
179
+ -moz-osx-font-smoothing: grayscale;
180
+ }
181
+ }
182
+
183
+ /* ─── Page transitions ──────────────────────────────────────── */
184
+ .page-enter-active,
185
+ .page-leave-active {
186
+ transition: all 0.2s ease-out;
187
+ }
188
+ .page-enter-from { opacity: 0; filter: blur(2px); }
189
+ .page-leave-to { opacity: 0; filter: blur(2px); }
190
+ .page-enter-to,
191
+ .page-leave-from { opacity: 1; filter: blur(0px); }
192
+
193
+ /* ─── Layout transitions ────────────────────────────────────── */
194
+ .layout-enter-active,
195
+ .layout-leave-active {
196
+ transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
197
+ }
198
+ .layout-enter-from { opacity: 0; transform: scale(0.96); filter: blur(4px); }
199
+ .layout-leave-to { opacity: 0; transform: scale(1.02); filter: blur(4px); }
200
+ .layout-enter-to,
201
+ .layout-leave-from { opacity: 1; transform: scale(1); filter: blur(0px); }
202
+
203
+ /* ─── Page loader ───────────────────────────────────────────── */
204
+ .page-loading-blur {
205
+ filter: blur(2px);
206
+ transition: filter 0.2s ease-out;
207
+ }