@innertia-solutions/innertia-nuxt 0.1.1

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 (108) hide show
  1. package/.github/workflows/auto-publish.yml +64 -0
  2. package/.github/workflows/release.yml +59 -0
  3. package/README.md +60 -0
  4. package/app.config.ts +70 -0
  5. package/components/Admin/Base.vue +144 -0
  6. package/components/Admin/Header.vue +32 -0
  7. package/components/Admin/Page.vue +65 -0
  8. package/components/Admin/PageHeader.vue +31 -0
  9. package/components/App/Button.vue +59 -0
  10. package/components/App/DevEnvironmentBar.vue +43 -0
  11. package/components/App/Dropdown.vue +286 -0
  12. package/components/App/EmptyState.vue +433 -0
  13. package/components/App/LoadingState.vue +40 -0
  14. package/components/App/PageLoadingSpinner.vue +118 -0
  15. package/components/App/PreviewDock.vue +64 -0
  16. package/components/App/SwitchColorTheme.vue +51 -0
  17. package/components/App/Tag.vue +193 -0
  18. package/components/DataTable.vue +713 -0
  19. package/components/Forms/DatePicker.vue +255 -0
  20. package/components/Forms/Input.vue +75 -0
  21. package/components/Forms/Select.vue +100 -0
  22. package/components/Forms/SelectServer.vue +726 -0
  23. package/components/Layout/Admin.vue +32 -0
  24. package/components/Layout/Auth.vue +29 -0
  25. package/components/Layout/SidebarWithAppColumn.vue +388 -0
  26. package/components/Layout/TopBar.vue +113 -0
  27. package/components/MobileBlocker.vue +85 -0
  28. package/components/MobileLoginPicker.vue +83 -0
  29. package/components/Modal/Base.vue +29 -0
  30. package/components/Modal/DeleteConfirm.vue +48 -0
  31. package/components/Modal.vue +103 -0
  32. package/components/Nav/Tabs.vue +55 -0
  33. package/components/PermissionsTree.vue +272 -0
  34. package/components/Table/Database.vue +183 -0
  35. package/components/Table/DownloadDropdown.vue +111 -0
  36. package/components/Table/Enterprise.vue +540 -0
  37. package/components/Table/FilterDropdown.vue +226 -0
  38. package/components/Table/Grid.vue +62 -0
  39. package/components/Table/Kanban.vue +188 -0
  40. package/components/Table/List.vue +128 -0
  41. package/components/Table/PreviewTimeline.vue +118 -0
  42. package/components/Table/Standard.vue +1217 -0
  43. package/components/Table/index.vue +974 -0
  44. package/components/TableExportable.vue +172 -0
  45. package/components/TableFilter.vue +93 -0
  46. package/components/Toast/Alert.vue +113 -0
  47. package/components/Toast/Container.vue +34 -0
  48. package/components/Toast/Notification.vue +45 -0
  49. package/components/Toast/Process.vue +88 -0
  50. package/composables/useApi.js +95 -0
  51. package/composables/useApp.ts +46 -0
  52. package/composables/useAuth.js +82 -0
  53. package/composables/useContext.js +44 -0
  54. package/composables/useDate.js +241 -0
  55. package/composables/useDevice.js +21 -0
  56. package/composables/useDockedPreviews.js +56 -0
  57. package/composables/useDownload.js +87 -0
  58. package/composables/useEntity.js +82 -0
  59. package/composables/useForm.js +119 -0
  60. package/composables/useInnertiaMode.ts +25 -0
  61. package/composables/useMobileGuard.ts +81 -0
  62. package/composables/useNotifications.js +22 -0
  63. package/composables/usePermissions.js +23 -0
  64. package/composables/useRealtime.js +123 -0
  65. package/composables/useRequestInterceptors.js +27 -0
  66. package/composables/useRoles.js +53 -0
  67. package/composables/useRutFormatter.js +39 -0
  68. package/composables/useTable.ts +94 -0
  69. package/composables/useTablePreferences.ts +33 -0
  70. package/composables/useTenant.js +27 -0
  71. package/composables/useTimeAgo.js +37 -0
  72. package/composables/useToast.js +69 -0
  73. package/composables/useUserRealtime.js +17 -0
  74. package/composables/useUsers.js +111 -0
  75. package/css/themes/autumn.css +401 -0
  76. package/css/themes/bubblegum.css +408 -0
  77. package/css/themes/cashmere.css +412 -0
  78. package/css/themes/harvest.css +416 -0
  79. package/css/themes/moon.css +140 -0
  80. package/css/themes/ocean.css +273 -0
  81. package/css/themes/olive.css +413 -0
  82. package/css/themes/retro.css +431 -0
  83. package/css/themes/theme.css +725 -0
  84. package/error.vue +78 -0
  85. package/middleware/01.detect-subdomain.global.ts +43 -0
  86. package/middleware/02.validate-tenant.global.ts +67 -0
  87. package/middleware/03.apps.global.ts +88 -0
  88. package/middleware/auth.ts +9 -0
  89. package/middleware/guest.ts +9 -0
  90. package/nuxt.config.ts +42 -0
  91. package/package.json +60 -0
  92. package/pages/tenant-error.vue +50 -0
  93. package/plugins/api-auth.ts +12 -0
  94. package/plugins/api-tenant.client.ts +21 -0
  95. package/plugins/appearance.ts +8 -0
  96. package/plugins/auth-init.ts +34 -0
  97. package/plugins/dark-state.client.ts +29 -0
  98. package/plugins/dockedPreviewsSync.client.js +17 -0
  99. package/plugins/preline.client.ts +68 -0
  100. package/plugins/theme.client.ts +7 -0
  101. package/plugins/vue-query.ts +29 -0
  102. package/public/init-theme.js +15 -0
  103. package/spark.css +721 -0
  104. package/stores/auth.js +130 -0
  105. package/stores/dockedPreviews.js +34 -0
  106. package/stores/notifications.js +24 -0
  107. package/stores/tenant.js +54 -0
  108. package/stores/toast.js +129 -0
@@ -0,0 +1,118 @@
1
+ <script setup>
2
+ const props = defineProps({
3
+ endpoint: { type: String, required: true },
4
+ })
5
+
6
+ const api = useApi()
7
+ const events = ref([])
8
+ const pending = ref(false)
9
+ const error = ref(null)
10
+
11
+ const fetchHistory = async () => {
12
+ pending.value = true
13
+ error.value = null
14
+ try {
15
+ const data = await api.get(props.endpoint)
16
+ events.value = Array.isArray(data) ? data : (data.data ?? [])
17
+ } catch (e) {
18
+ error.value = e
19
+ } finally {
20
+ pending.value = false
21
+ }
22
+ }
23
+
24
+ const refresh = fetchHistory
25
+
26
+ watch(() => props.endpoint, fetchHistory, { immediate: true })
27
+
28
+ const typeConfig = {
29
+ created: { color: 'bg-green-500', label: 'Creado', textColor: 'text-green-600 dark:text-green-400' },
30
+ updated: { color: 'bg-blue-500', label: 'Actualizado', textColor: 'text-blue-600 dark:text-blue-400' },
31
+ deleted: { color: 'bg-red-500', label: 'Eliminado', textColor: 'text-red-600 dark:text-red-400' },
32
+ restored: { color: 'bg-amber-500', label: 'Restaurado', textColor: 'text-amber-600 dark:text-amber-400' },
33
+ default: { color: 'bg-muted-foreground', label: 'Evento', textColor: 'text-muted-foreground' },
34
+ }
35
+
36
+ const getConfig = (type) => typeConfig[type] ?? typeConfig.default
37
+
38
+ const formatDate = (iso) => {
39
+ if (!iso) return ''
40
+ const d = new Date(iso)
41
+ return d.toLocaleDateString('es-CL', { day: '2-digit', month: 'short', year: 'numeric', hour: '2-digit', minute: '2-digit' })
42
+ }
43
+ </script>
44
+
45
+ <template>
46
+ <div class="px-4 py-3">
47
+
48
+ <!-- Loading -->
49
+ <div v-if="pending" class="flex flex-col gap-3">
50
+ <div v-for="i in 3" :key="i" class="flex gap-3 animate-pulse">
51
+ <div class="flex flex-col items-center gap-1 shrink-0">
52
+ <div class="size-2.5 rounded-full bg-muted mt-1.5" />
53
+ <div class="w-px flex-1 bg-muted min-h-8" />
54
+ </div>
55
+ <div class="space-y-1.5 pb-4 flex-1">
56
+ <div class="h-3 w-24 bg-muted rounded" />
57
+ <div class="h-3 w-40 bg-muted rounded" />
58
+ </div>
59
+ </div>
60
+ </div>
61
+
62
+ <!-- Error -->
63
+ <div v-else-if="error" class="text-center py-6">
64
+ <p class="text-sm text-red-500">No se pudo cargar la bitácora</p>
65
+ <button @click="refresh()" class="mt-2 text-xs text-muted-foreground hover:text-foreground underline">Reintentar</button>
66
+ </div>
67
+
68
+ <!-- Empty -->
69
+ <div v-else-if="!events.length" class="text-center py-8">
70
+ <p class="text-sm text-muted-foreground">Sin registros en la bitácora</p>
71
+ </div>
72
+
73
+ <!-- Timeline -->
74
+ <div v-else class="flex flex-col">
75
+ <div
76
+ v-for="(event, idx) in events"
77
+ :key="event.id ?? idx"
78
+ class="flex gap-3"
79
+ >
80
+ <!-- Dot + line -->
81
+ <div class="flex flex-col items-center shrink-0">
82
+ <div class="size-2.5 rounded-full mt-1.5 shrink-0" :class="getConfig(event.type).color" />
83
+ <div v-if="idx < events.length - 1" class="w-px flex-1 bg-card-line min-h-4 my-1" />
84
+ </div>
85
+
86
+ <!-- Content -->
87
+ <div class="pb-4 flex-1 min-w-0">
88
+ <div class="flex items-baseline gap-2 flex-wrap">
89
+ <span class="text-xs font-semibold" :class="getConfig(event.type).textColor">
90
+ {{ event.action ?? getConfig(event.type).label }}
91
+ </span>
92
+ <span class="text-[10px] text-muted-foreground">{{ formatDate(event.created_at) }}</span>
93
+ </div>
94
+ <p v-if="event.description" class="text-xs text-foreground mt-0.5">{{ event.description }}</p>
95
+ <p v-if="event.user?.name" class="text-[10px] text-muted-foreground mt-0.5">por {{ event.user.name }}</p>
96
+
97
+ <!-- Properties diff -->
98
+ <div v-if="event.properties && Object.keys(event.properties).length" class="mt-1.5 space-y-0.5">
99
+ <div
100
+ v-for="(val, field) in event.properties"
101
+ :key="field"
102
+ class="flex items-center gap-1.5 text-[10px] text-muted-foreground bg-surface rounded px-1.5 py-0.5"
103
+ >
104
+ <span class="font-medium text-foreground">{{ field }}</span>
105
+ <span v-if="val?.old !== undefined">
106
+ <span class="line-through opacity-60">{{ val.old ?? '—' }}</span>
107
+ <span class="mx-1">→</span>
108
+ <span>{{ val.new ?? '—' }}</span>
109
+ </span>
110
+ <span v-else>{{ val }}</span>
111
+ </div>
112
+ </div>
113
+ </div>
114
+ </div>
115
+ </div>
116
+
117
+ </div>
118
+ </template>