@illuminateeducation/dna-atd-frontend 1.0.1-DNAATD-2189.0 → 1.0.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 (43) hide show
  1. package/README.md +1 -1
  2. package/dist/.vite/manifest.json +1 -8
  3. package/dist/assets/AdminLayout.css +1 -1
  4. package/dist/assets/AdminLayout.js +1 -1
  5. package/dist/assets/CustomizationView.css +1 -1
  6. package/dist/assets/CustomizationView.js +1 -1
  7. package/dist/assets/HomeView.js +1 -1
  8. package/dist/assets/NotFoundView.css +1 -1
  9. package/dist/assets/NotFoundView.js +1 -1
  10. package/dist/assets/ValidationView.css +1 -1
  11. package/dist/assets/ValidationView.js +1 -1
  12. package/dist/assets/index.js +2 -2
  13. package/package.json +2 -14
  14. package/dist/assets/HomeView.css +0 -1
  15. package/src/App.vue +0 -68
  16. package/src/__tests__/App.spec.js +0 -26
  17. package/src/components/common/BaseButton.vue +0 -20
  18. package/src/components/common/BaseInput.vue +0 -27
  19. package/src/components/common/BaseModal.vue +0 -37
  20. package/src/composables/useAsync.js +0 -34
  21. package/src/composables/useClickOutside.js +0 -29
  22. package/src/composables/useForm.js +0 -89
  23. package/src/composables/useLocalStorage.js +0 -51
  24. package/src/composables/useWindowSize.js +0 -30
  25. package/src/config/app.config.js +0 -79
  26. package/src/features/admin/customization/composables/useCustomization.js +0 -19
  27. package/src/features/admin/customization/store/customizationStore.js +0 -30
  28. package/src/features/admin/customization/views/CustomizationView.vue +0 -17
  29. package/src/features/admin/validation/composables/useValidation.js +0 -18
  30. package/src/features/admin/validation/store/validationStore.js +0 -25
  31. package/src/features/admin/validation/views/ValidationView.vue +0 -17
  32. package/src/index.js +0 -53
  33. package/src/layouts/AdminLayout.vue +0 -146
  34. package/src/main.js +0 -41
  35. package/src/router/index.js +0 -57
  36. package/src/services/apiService.js +0 -72
  37. package/src/services/integration.js +0 -59
  38. package/src/services/phpIntegration.js +0 -1
  39. package/src/stores/counter.js +0 -12
  40. package/src/utils/helpers.js +0 -119
  41. package/src/utils/validators.js +0 -131
  42. package/src/views/HomeView.vue +0 -121
  43. package/src/views/NotFoundView.vue +0 -56
package/src/index.js DELETED
@@ -1,53 +0,0 @@
1
- import { createApp } from 'vue'
2
- import { createPinia } from 'pinia'
3
- import router from './router'
4
- import App from './App.vue'
5
-
6
- export function createDnaAtdApp(elementId = '#app') {
7
- const app = createApp(App)
8
- const pinia = createPinia()
9
- app.use(pinia)
10
- app.use(router)
11
- return app.mount(elementId)
12
- }
13
-
14
- export function createDnaAtdAppInstance() {
15
- const app = createApp(App)
16
- const pinia = createPinia()
17
- app.use(pinia)
18
- app.use(router)
19
- return app
20
- }
21
-
22
- export { default as App } from './App.vue'
23
- export { default as router } from './router'
24
-
25
- export { default as BaseButton } from './components/common/BaseButton.vue'
26
- export { default as BaseInput } from './components/common/BaseInput.vue'
27
- export { default as BaseModal } from './components/common/BaseModal.vue'
28
-
29
- export { default as AdminLayout } from './layouts/AdminLayout.vue'
30
-
31
- export { useAsync } from './composables/useAsync'
32
- export { useForm } from './composables/useForm'
33
- export { useClickOutside } from './composables/useClickOutside'
34
- export { useLocalStorage } from './composables/useLocalStorage'
35
- export { useWindowSize } from './composables/useWindowSize'
36
-
37
- export { useValidationStore } from './features/admin/validation/store/validationStore'
38
- export { useCustomizationStore } from './features/admin/customization/store/customizationStore'
39
-
40
- export { useValidation } from './features/admin/validation/composables/useValidation'
41
- export { useCustomization } from './features/admin/customization/composables/useCustomization'
42
-
43
- export { default as ValidationView } from './features/admin/validation/views/ValidationView.vue'
44
- export { default as CustomizationView } from './features/admin/customization/views/CustomizationView.vue'
45
-
46
- export { default as apiService } from './services/apiService'
47
- export { appConfig } from './config/app.config'
48
-
49
- export * from './utils/helpers'
50
- export * from './utils/validators'
51
-
52
- export { default as HomeView } from './views/HomeView.vue'
53
- export { default as NotFoundView } from './views/NotFoundView.vue'
@@ -1,146 +0,0 @@
1
- <template>
2
- <div class="admin-layout">
3
- <aside class="admin-sidebar">
4
- <div class="sidebar-header">
5
- <h2>Admin Panel</h2>
6
- </div>
7
- <nav class="sidebar-nav">
8
- <router-link
9
- to="/admin/validation"
10
- class="nav-item"
11
- active-class="active"
12
- >
13
- <span class="nav-icon">✓</span>
14
- <span>Validation</span>
15
- </router-link>
16
- <router-link
17
- to="/admin/customization"
18
- class="nav-item"
19
- active-class="active"
20
- >
21
- <span class="nav-icon">🎨</span>
22
- <span>Customization</span>
23
- </router-link>
24
- </nav>
25
- <div class="sidebar-footer">
26
- <router-link to="/" class="back-link">
27
- ← Back to Home
28
- </router-link>
29
- </div>
30
- </aside>
31
-
32
- <main class="admin-content">
33
- <div class="content-header">
34
- <h1>{{ pageTitle }}</h1>
35
- </div>
36
- <div class="content-body">
37
- <router-view />
38
- </div>
39
- </main>
40
- </div>
41
- </template>
42
-
43
- <script setup>
44
- import { computed } from 'vue'
45
- import { useRoute } from 'vue-router'
46
-
47
- const route = useRoute()
48
-
49
- const pageTitle = computed(() => {
50
- return route.meta.title || 'Admin'
51
- })
52
- </script>
53
-
54
- <style scoped>
55
- .admin-layout {
56
- display: flex;
57
- min-height: 100vh;
58
- background-color: #f5f7fa;
59
- }
60
-
61
- .admin-sidebar {
62
- width: 250px;
63
- background-color: #2c3e50;
64
- color: white;
65
- display: flex;
66
- flex-direction: column;
67
- }
68
-
69
- .sidebar-header {
70
- padding: 2rem 1.5rem;
71
- border-bottom: 1px solid rgba(255,255,255,0.1);
72
- }
73
-
74
- .sidebar-header h2 {
75
- margin: 0;
76
- font-size: 1.5rem;
77
- }
78
-
79
- .sidebar-nav {
80
- flex: 1;
81
- padding: 1rem 0;
82
- }
83
-
84
- .nav-item {
85
- display: flex;
86
- align-items: center;
87
- gap: 1rem;
88
- padding: 1rem 1.5rem;
89
- color: rgba(255,255,255,0.8);
90
- text-decoration: none;
91
- transition: all 0.3s;
92
- }
93
-
94
- .nav-item:hover {
95
- background-color: rgba(255,255,255,0.1);
96
- color: white;
97
- }
98
-
99
- .nav-item.active {
100
- background-color: #3498db;
101
- color: white;
102
- border-right: 3px solid #2ecc71;
103
- }
104
-
105
- .nav-icon {
106
- font-size: 1.2rem;
107
- }
108
-
109
- .sidebar-footer {
110
- padding: 1.5rem;
111
- border-top: 1px solid rgba(255,255,255,0.1);
112
- }
113
-
114
- .back-link {
115
- color: rgba(255,255,255,0.8);
116
- text-decoration: none;
117
- transition: color 0.3s;
118
- }
119
-
120
- .back-link:hover {
121
- color: white;
122
- }
123
-
124
- .admin-content {
125
- flex: 1;
126
- display: flex;
127
- flex-direction: column;
128
- }
129
-
130
- .content-header {
131
- background: white;
132
- padding: 1.5rem 2rem;
133
- box-shadow: 0 2px 4px rgba(0,0,0,0.1);
134
- }
135
-
136
- .content-header h1 {
137
- margin: 0;
138
- font-size: 1.5rem;
139
- color: #2c3e50;
140
- }
141
-
142
- .content-body {
143
- flex: 1;
144
- overflow-y: auto;
145
- }
146
- </style>
package/src/main.js DELETED
@@ -1,41 +0,0 @@
1
- import { createApp } from 'vue'
2
- import { createPinia } from 'pinia'
3
-
4
- import App from './App.vue'
5
- import router from './router'
6
-
7
- // Backend Integration: Read data from DOM element attributes
8
- const appElement = document.getElementById('app')
9
- const configData = appElement?.getAttribute('data-config')
10
- const userData = appElement?.getAttribute('data-user')
11
-
12
- // Parse backend-provided data
13
- const backendConfig = configData ? JSON.parse(configData) : {}
14
- const backendUser = userData ? JSON.parse(userData) : {}
15
-
16
- // Create Vue app
17
- const app = createApp(App)
18
-
19
- // Make backend data available globally
20
- app.config.globalProperties.$config = backendConfig
21
- app.config.globalProperties.$user = backendUser
22
-
23
- // Setup plugins
24
- app.use(createPinia())
25
- app.use(router)
26
-
27
- // Mount app when DOM is ready
28
- document.addEventListener('DOMContentLoaded', () => {
29
- // Add any DOM modifications needed for backend integration
30
- const canvas = document.getElementById('canvas')
31
- if (canvas) {
32
- canvas.style.padding = '0'
33
- canvas.classList.add('vue-app')
34
- }
35
-
36
- // Mount the Vue app
37
- if (appElement) {
38
- app.mount('#app')
39
- }
40
- })
41
-
@@ -1,57 +0,0 @@
1
- import { createRouter, createWebHistory } from 'vue-router'
2
-
3
- const router = createRouter({
4
- history: createWebHistory(import.meta.env.BASE_URL),
5
- routes: [
6
- {
7
- path: '/',
8
- name: 'home',
9
- component: () => import('../views/HomeView.vue')
10
- },
11
- {
12
- path: '/admin',
13
- name: 'admin',
14
- component: () => import('../layouts/AdminLayout.vue'),
15
- redirect: '/admin/validation',
16
- children: [
17
- {
18
- path: 'validation',
19
- name: 'admin-validation',
20
- component: () => import('../features/admin/validation/views/ValidationView.vue'),
21
- meta: {
22
- title: 'Validation Management'
23
- }
24
- },
25
- {
26
- path: 'customization',
27
- name: 'admin-customization',
28
- component: () => import('../features/admin/customization/views/CustomizationView.vue'),
29
- meta: {
30
- title: 'UI Customization'
31
- }
32
- }
33
- ],
34
- meta: {
35
- requiresAuth: true
36
- }
37
- },
38
- {
39
- path: '/:pathMatch(.*)*',
40
- name: 'not-found',
41
- component: () => import('../views/NotFoundView.vue')
42
- }
43
- ]
44
- })
45
-
46
- // Navigation guard for authentication
47
- router.beforeEach((to, from, next) => {
48
- if (to.meta.requiresAuth) {
49
- // Add your authentication logic here
50
- // For now, we'll just allow access
51
- next()
52
- } else {
53
- next()
54
- }
55
- })
56
-
57
- export default router
@@ -1,72 +0,0 @@
1
- /**
2
- * API Service
3
- * Centralized API calls using fetch
4
- */
5
-
6
- const API_BASE_URL = import.meta.env.VITE_API_BASE_URL || 'http://localhost:3000/api'
7
-
8
- class ApiService {
9
- constructor(baseURL = API_BASE_URL) {
10
- this.baseURL = baseURL
11
- }
12
-
13
- async request(endpoint, options = {}) {
14
- const url = `${this.baseURL}${endpoint}`
15
- const config = {
16
- headers: {
17
- 'Content-Type': 'application/json',
18
- ...options.headers
19
- },
20
- ...options
21
- }
22
-
23
- try {
24
- const response = await fetch(url, config)
25
-
26
- if (!response.ok) {
27
- throw new Error(`HTTP error! status: ${response.status}`)
28
- }
29
-
30
- return await response.json()
31
- } catch (error) {
32
- console.error('API request failed:', error)
33
- throw error
34
- }
35
- }
36
-
37
- get(endpoint, options = {}) {
38
- return this.request(endpoint, { method: 'GET', ...options })
39
- }
40
-
41
- post(endpoint, data, options = {}) {
42
- return this.request(endpoint, {
43
- method: 'POST',
44
- body: JSON.stringify(data),
45
- ...options
46
- })
47
- }
48
-
49
- put(endpoint, data, options = {}) {
50
- return this.request(endpoint, {
51
- method: 'PUT',
52
- body: JSON.stringify(data),
53
- ...options
54
- })
55
- }
56
-
57
- patch(endpoint, data, options = {}) {
58
- return this.request(endpoint, {
59
- method: 'PATCH',
60
- body: JSON.stringify(data),
61
- ...options
62
- })
63
- }
64
-
65
- delete(endpoint, options = {}) {
66
- return this.request(endpoint, { method: 'DELETE', ...options })
67
- }
68
- }
69
-
70
- export const apiService = new ApiService()
71
- export default apiService
72
-
@@ -1,59 +0,0 @@
1
- /**
2
- * Integration Service
3
- * Handles communication between Vue app and backend
4
- */
5
-
6
- export class Integration {
7
- constructor() {
8
- this.config = this.getConfig()
9
- this.user = this.getUser()
10
- }
11
-
12
- /**
13
- * Get configuration from backend
14
- */
15
- getConfig() {
16
- const appElement = document.getElementById('app')
17
- const configData = appElement?.getAttribute('data-config')
18
- return configData ? JSON.parse(configData) : {}
19
- }
20
-
21
- /**
22
- * Get user data from backend
23
- */
24
- getUser() {
25
- const appElement = document.getElementById('app')
26
- const userData = appElement?.getAttribute('data-user')
27
- return userData ? JSON.parse(userData) : {}
28
- }
29
-
30
- /**
31
- * Get any custom data attribute
32
- */
33
- getData(attribute) {
34
- const appElement = document.getElementById('app')
35
- const data = appElement?.getAttribute(`data-${attribute}`)
36
- return data ? JSON.parse(data) : null
37
- }
38
-
39
- /**
40
- * Emit event to backend (via window for backend to listen)
41
- */
42
- emitToBackend(eventName, data) {
43
- window.dispatchEvent(new CustomEvent(`vue:${eventName}`, { detail: data }))
44
- }
45
-
46
- /**
47
- * Listen for backend events
48
- */
49
- listenFromBackend(eventName, callback) {
50
- window.addEventListener(`backend:${eventName}`, (event) => {
51
- callback(event.detail)
52
- })
53
- }
54
- }
55
-
56
- // Singleton instance
57
- export const integration = new Integration()
58
- export default integration
59
-
@@ -1 +0,0 @@
1
-
@@ -1,12 +0,0 @@
1
- import { ref, computed } from 'vue'
2
- import { defineStore } from 'pinia'
3
-
4
- export const useCounterStore = defineStore('counter', () => {
5
- const count = ref(0)
6
- const doubleCount = computed(() => count.value * 2)
7
- function increment() {
8
- count.value++
9
- }
10
-
11
- return { count, doubleCount, increment }
12
- })
@@ -1,119 +0,0 @@
1
- /**
2
- * Utility functions for common operations
3
- */
4
-
5
- /**
6
- * Debounce function to limit rate of function execution
7
- * @param {Function} func - Function to debounce
8
- * @param {number} wait - Delay in milliseconds
9
- * @returns {Function}
10
- */
11
- export function debounce(func, wait = 300) {
12
- let timeout
13
- return function executedFunction(...args) {
14
- const later = () => {
15
- clearTimeout(timeout)
16
- func(...args)
17
- }
18
- clearTimeout(timeout)
19
- timeout = setTimeout(later, wait)
20
- }
21
- }
22
-
23
- /**
24
- * Throttle function to limit function execution frequency
25
- * @param {Function} func - Function to throttle
26
- * @param {number} limit - Time limit in milliseconds
27
- * @returns {Function}
28
- */
29
- export function throttle(func, limit = 300) {
30
- let inThrottle
31
- return function executedFunction(...args) {
32
- if (!inThrottle) {
33
- func.apply(this, args)
34
- inThrottle = true
35
- setTimeout(() => (inThrottle = false), limit)
36
- }
37
- }
38
- }
39
-
40
- /**
41
- * Deep clone an object
42
- * @param {*} obj - Object to clone
43
- * @returns {*}
44
- */
45
- export function deepClone(obj) {
46
- if (obj === null || typeof obj !== 'object') return obj
47
- if (obj instanceof Date) return new Date(obj.getTime())
48
- if (obj instanceof Array) return obj.map(item => deepClone(item))
49
-
50
- const clonedObj = {}
51
- for (const key in obj) {
52
- if (obj.hasOwnProperty(key)) {
53
- clonedObj[key] = deepClone(obj[key])
54
- }
55
- }
56
- return clonedObj
57
- }
58
-
59
- /**
60
- * Format date to readable string
61
- * @param {Date|string} date - Date to format
62
- * @param {string} format - Format type ('short', 'long', 'time')
63
- * @returns {string}
64
- */
65
- export function formatDate(date, format = 'short') {
66
- const d = new Date(date)
67
-
68
- const options = {
69
- short: { year: 'numeric', month: 'short', day: 'numeric' },
70
- long: { year: 'numeric', month: 'long', day: 'numeric', hour: '2-digit', minute: '2-digit' },
71
- time: { hour: '2-digit', minute: '2-digit', second: '2-digit' }
72
- }
73
-
74
- return d.toLocaleDateString('en-US', options[format] || options.short)
75
- }
76
-
77
- /**
78
- * Generate unique ID
79
- * @returns {string}
80
- */
81
- export function generateId() {
82
- return `${Date.now()}-${Math.random().toString(36).substr(2, 9)}`
83
- }
84
-
85
- /**
86
- * Capitalize first letter of string
87
- * @param {string} str - String to capitalize
88
- * @returns {string}
89
- */
90
- export function capitalize(str) {
91
- if (!str) return ''
92
- return str.charAt(0).toUpperCase() + str.slice(1).toLowerCase()
93
- }
94
-
95
- /**
96
- * Truncate string to specified length
97
- * @param {string} str - String to truncate
98
- * @param {number} length - Max length
99
- * @param {string} suffix - Suffix to add
100
- * @returns {string}
101
- */
102
- export function truncate(str, length = 50, suffix = '...') {
103
- if (!str || str.length <= length) return str
104
- return str.substring(0, length).trim() + suffix
105
- }
106
-
107
- /**
108
- * Check if value is empty (null, undefined, empty string, empty array, empty object)
109
- * @param {*} value - Value to check
110
- * @returns {boolean}
111
- */
112
- export function isEmpty(value) {
113
- if (value === null || value === undefined) return true
114
- if (typeof value === 'string' && value.trim() === '') return true
115
- if (Array.isArray(value) && value.length === 0) return true
116
- if (typeof value === 'object' && Object.keys(value).length === 0) return true
117
- return false
118
- }
119
-
@@ -1,131 +0,0 @@
1
- /**
2
- * Validation utility functions
3
- */
4
-
5
- /**
6
- * Validate email format
7
- * @param {string} email - Email to validate
8
- * @returns {boolean}
9
- */
10
- export function isValidEmail(email) {
11
- const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/
12
- return emailRegex.test(email)
13
- }
14
-
15
- /**
16
- * Validate phone number
17
- * @param {string} phone - Phone number to validate
18
- * @returns {boolean}
19
- */
20
- export function isValidPhone(phone) {
21
- const phoneRegex = /^\d{10}$/
22
- return phoneRegex.test(phone.replace(/[\s-()]/g, ''))
23
- }
24
-
25
- /**
26
- * Validate URL format
27
- * @param {string} url - URL to validate
28
- * @returns {boolean}
29
- */
30
- export function isValidUrl(url) {
31
- try {
32
- new URL(url)
33
- return true
34
- } catch {
35
- return false
36
- }
37
- }
38
-
39
- /**
40
- * Validate password strength
41
- * @param {string} password - Password to validate
42
- * @returns {Object} - { isValid: boolean, strength: string, message: string }
43
- */
44
- export function validatePassword(password) {
45
- const minLength = 8
46
- const hasUpperCase = /[A-Z]/.test(password)
47
- const hasLowerCase = /[a-z]/.test(password)
48
- const hasNumbers = /\d/.test(password)
49
- const hasSpecialChar = /[!@#$%^&*(),.?":{}|<>]/.test(password)
50
-
51
- if (password.length < minLength) {
52
- return { isValid: false, strength: 'weak', message: `Password must be at least ${minLength} characters` }
53
- }
54
-
55
- let strength = 'weak'
56
- let strengthScore = 0
57
-
58
- if (hasUpperCase) strengthScore++
59
- if (hasLowerCase) strengthScore++
60
- if (hasNumbers) strengthScore++
61
- if (hasSpecialChar) strengthScore++
62
-
63
- if (strengthScore === 4) {
64
- strength = 'strong'
65
- } else if (strengthScore >= 2) {
66
- strength = 'medium'
67
- }
68
-
69
- return {
70
- isValid: true,
71
- strength,
72
- message: `Password strength: ${strength}`,
73
- hasUpperCase,
74
- hasLowerCase,
75
- hasNumbers,
76
- hasSpecialChar
77
- }
78
- }
79
-
80
- /**
81
- * Validate required field
82
- * @param {*} value - Value to validate
83
- * @returns {boolean}
84
- */
85
- export function isRequired(value) {
86
- if (value === null || value === undefined) return false
87
- if (typeof value === 'string' && value.trim() === '') return false
88
- if (Array.isArray(value) && value.length === 0) return false
89
- return true
90
- }
91
-
92
- /**
93
- * Validate min length
94
- * @param {string} value - Value to validate
95
- * @param {number} min - Minimum length
96
- * @returns {boolean}
97
- */
98
- export function minLength(value, min) {
99
- return value && value.length >= min
100
- }
101
-
102
- /**
103
- * Validate max length
104
- * @param {string} value - Value to validate
105
- * @param {number} max - Maximum length
106
- * @returns {boolean}
107
- */
108
- export function maxLength(value, max) {
109
- return value && value.length <= max
110
- }
111
-
112
- /**
113
- * Validate numeric value
114
- * @param {*} value - Value to validate
115
- * @returns {boolean}
116
- */
117
- export function isNumeric(value) {
118
- return !isNaN(parseFloat(value)) && isFinite(value)
119
- }
120
-
121
- /**
122
- * Validate value is within range
123
- * @param {number} value - Value to validate
124
- * @param {number} min - Minimum value
125
- * @param {number} max - Maximum value
126
- * @returns {boolean}
127
- */
128
- export function inRange(value, min, max) {
129
- return value >= min && value <= max
130
- }
131
-