@katlux/toolkit 0.1.1-alpha.128 → 0.1.1-alpha.130
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/bin/add-ai-reference.mjs +85 -46
- package/dist/module.json +1 -1
- package/dist/runtime/components/KButton/KButton.global.d.vue.ts +1 -1
- package/dist/runtime/components/KButton/KButton.global.vue.d.ts +1 -1
- package/dist/runtime/components/KButton/KButton.logic.d.ts +1 -1
- package/dist/runtime/components/KCombobox/KCombobox.global.d.vue.ts +3 -3
- package/dist/runtime/components/KCombobox/KCombobox.global.vue.d.ts +3 -3
- package/dist/runtime/components/KCompositeInput/KCompositeInput.global.d.vue.ts +6 -6
- package/dist/runtime/components/KCompositeInput/KCompositeInput.global.vue.d.ts +6 -6
- package/dist/runtime/components/KDatePicker/KDatePicker.global.d.vue.ts +1 -1
- package/dist/runtime/components/KDatePicker/KDatePicker.global.vue.d.ts +1 -1
- package/dist/runtime/components/KDateTimePicker/KDateTimePicker.global.d.vue.ts +1 -1
- package/dist/runtime/components/KDateTimePicker/KDateTimePicker.global.vue.d.ts +1 -1
- package/dist/runtime/components/KDropdown/KDropdown.global.d.vue.ts +1 -1
- package/dist/runtime/components/KDropdown/KDropdown.global.vue.d.ts +1 -1
- package/dist/runtime/components/KPagination/KPagination.global.d.vue.ts +1 -1
- package/dist/runtime/components/KPagination/KPagination.global.vue.d.ts +1 -1
- package/dist/runtime/components/KTree/KTree.global.d.vue.ts +1 -1
- package/dist/runtime/components/KTree/KTree.global.vue.d.ts +1 -1
- package/dist/runtime/components/KTreePicker/KTreePicker.global.d.vue.ts +2 -2
- package/dist/runtime/components/KTreePicker/KTreePicker.global.vue.d.ts +2 -2
- package/dist/runtime/presets/default/components/KTree/KTree.d.vue.ts +1 -1
- package/dist/runtime/presets/default/components/KTree/KTree.vue.d.ts +1 -1
- package/dist/skills/KATLUX_INDEX.md +40 -0
- package/dist/skills/katlux-components/SKILL.md +106 -0
- package/dist/skills/katlux-components/components/KAccordion.md +27 -0
- package/dist/skills/katlux-components/components/KAlert.md +22 -0
- package/dist/skills/katlux-components/components/KAreaChart.md +19 -0
- package/dist/skills/katlux-components/components/KBarChart.md +20 -0
- package/dist/skills/katlux-components/components/KBulkActions.md +19 -0
- package/dist/skills/katlux-components/components/KButton.md +12 -0
- package/dist/skills/katlux-components/components/KCalendar.md +17 -0
- package/dist/skills/katlux-components/components/KCheckbox.md +15 -0
- package/dist/skills/katlux-components/components/KCombobox.md +41 -0
- package/dist/skills/katlux-components/components/KCompositeInput.md +67 -0
- package/dist/skills/katlux-components/components/KContextMenu.md +20 -0
- package/dist/skills/katlux-components/components/KDataIterator.md +35 -0
- package/dist/skills/katlux-components/components/KDatatable.md +55 -0
- package/dist/skills/katlux-components/components/KDatePicker.md +26 -0
- package/dist/skills/katlux-components/components/KDropdown.md +18 -0
- package/dist/skills/katlux-components/components/KGantt.md +28 -0
- package/dist/skills/katlux-components/components/KGrid.md +17 -0
- package/dist/skills/katlux-components/components/KHeatMap.md +32 -0
- package/dist/skills/katlux-components/components/KHourSelect.md +11 -0
- package/dist/skills/katlux-components/components/KIcon.md +5 -0
- package/dist/skills/katlux-components/components/KLayout.md +34 -0
- package/dist/skills/katlux-components/components/KLineChart.md +18 -0
- package/dist/skills/katlux-components/components/KLoader.md +7 -0
- package/dist/skills/katlux-components/components/KMaskTextbox.md +12 -0
- package/dist/skills/katlux-components/components/KModal.md +22 -0
- package/dist/skills/katlux-components/components/KPagination.md +22 -0
- package/dist/skills/katlux-components/components/KPanel.md +18 -0
- package/dist/skills/katlux-components/components/KPieChart.md +14 -0
- package/dist/skills/katlux-components/components/KProductList.md +42 -0
- package/dist/skills/katlux-components/components/KScatterChart.md +20 -0
- package/dist/skills/katlux-components/components/KSlider.md +28 -0
- package/dist/skills/katlux-components/components/KTabs.md +31 -0
- package/dist/skills/katlux-components/components/KTextbox.md +15 -0
- package/dist/skills/katlux-components/components/KToast.md +14 -0
- package/dist/skills/katlux-components/components/KTooltip.md +13 -0
- package/dist/skills/katlux-components/components/KTree.md +45 -0
- package/dist/skills/katlux-components/components/KTreePicker.md +35 -0
- package/dist/skills/katlux-components/components/KTreeView.md +30 -0
- package/dist/skills/katlux-components/components/MultiTabs.md +20 -0
- package/dist/skills/katlux-components/components/calendar-customization.md +6 -0
- package/dist/skills/katlux-components/components/datatable-customization.md +14 -0
- package/dist/skills/katlux-components/components/directives.md +11 -0
- package/dist/skills/katlux-components/components/form-validation.md +125 -0
- package/dist/skills/katlux-components/components/tree-customization.md +9 -0
- package/dist/skills/katlux-components/components/useToast.md +27 -0
- package/dist/skills/katlux-components/components/validation-directives.md +6 -0
- package/dist/skills/katlux-config/SKILL.md +156 -0
- package/dist/skills/katlux-presets/SKILL.md +356 -0
- package/dist/skills/katlux-providers/SKILL.md +64 -0
- package/dist/skills/katlux-providers/providers/ADataProvider.md +59 -0
- package/dist/skills/katlux-providers/providers/CAPIFlatClientDataProvider.md +28 -0
- package/dist/skills/katlux-providers/providers/CAPIFlatServerDataProvider.md +20 -0
- package/dist/skills/katlux-providers/providers/CFlatClientDataProvider.md +11 -0
- package/dist/skills/katlux-providers/providers/CFlatServerDataProvider.md +58 -0
- package/dist/skills/katlux-providers/providers/CTreeClientDataProvider.md +14 -0
- package/dist/skills/katlux-providers/providers/CTreeServerDataProvider.md +5 -0
- package/dist/skills/katlux-providers/providers/KatluxIndexedDB.md +10 -0
- package/dist/skills/katlux-providers/providers/RequestProvider.md +49 -0
- package/dist/skills/katlux-providers/providers/RequestQueue.md +52 -0
- package/dist/skills/katlux-providers/providers/api-protocol.md +40 -0
- package/dist/skills/katlux-providers/providers/caching.md +170 -0
- package/dist/skills/katlux-providers/providers/composables.md +107 -0
- package/dist/skills/katlux-providers/providers/encryption.md +151 -0
- package/dist/skills/katlux-providers/providers/react-integration.md +45 -0
- package/dist/skills/katlux-providers/providers/testing-isolation.md +6 -0
- package/dist/skills/katlux-providers/providers/types.md +27 -0
- package/dist/skills/katlux-providers/providers/useDataProvider.md +51 -0
- package/dist/skills/katlux-tokens/SKILL.md +133 -0
- package/package.json +3 -3
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
### 2.2.2 Form & Input Validation Architecture
|
|
2
|
+
Katlux provides a standardized, reactive validation system built directly into all form components (`KTextbox`, `KMaskTextbox`, `KTextarea`, `KCombobox`, `KRadiobox`, `KCheckbox`, `KDatePicker`, `KDateTimePicker`, `KTreePicker`, `KCompositeInput`).
|
|
3
|
+
|
|
4
|
+
#### Universal Validation Props
|
|
5
|
+
Every input component accepts:
|
|
6
|
+
| Prop | Type | Default | Description |
|
|
7
|
+
| --- | --- | --- | --- |
|
|
8
|
+
| `validation` | `'success' \| 'warning' \| 'error' \| null` | `null` | Semantic validation state. Applies thematic border classes (`is-success`, `is-warning`, `is-error`) via active preset CSS variables. |
|
|
9
|
+
| `validationText` | `string` | `''` | User-facing feedback message displayed immediately below the input. Only visible when `validation` is `'success'`, `'warning'`, or `'error'`. |
|
|
10
|
+
|
|
11
|
+
#### Semantic States & Design Tokens
|
|
12
|
+
- **`null` (Clean / Default)**: Neutral state. Default input borders (`var(--border-color)`), no validation text rendered.
|
|
13
|
+
- **`'success'`**: Constraint met / verified. Accented with `var(--success-500)` and green feedback text.
|
|
14
|
+
- **`'warning'`**: Advisory condition (e.g. approaching character limit, weak password, or asynchronous check pending). Accented with `var(--warning-500)`.
|
|
15
|
+
- **`'error'`**: Constraint violated (e.g. required field empty, format failure, server conflict). Accented with `var(--danger-500)`.
|
|
16
|
+
|
|
17
|
+
#### Standard Implementation Patterns
|
|
18
|
+
|
|
19
|
+
1. **Reactive Computed Rules (Real-Time)**:
|
|
20
|
+
```typescript
|
|
21
|
+
const email = ref('')
|
|
22
|
+
const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/
|
|
23
|
+
|
|
24
|
+
const emailValidation = computed(() => {
|
|
25
|
+
if (!email.value) return null
|
|
26
|
+
if (emailRegex.test(email.value)) return 'success'
|
|
27
|
+
if (email.value.includes('@') && !email.value.includes('.')) return 'warning'
|
|
28
|
+
return 'error'
|
|
29
|
+
})
|
|
30
|
+
|
|
31
|
+
const emailValidationText = computed(() => {
|
|
32
|
+
if (!email.value) return ''
|
|
33
|
+
if (emailRegex.test(email.value)) return 'Valid email format'
|
|
34
|
+
if (email.value.includes('@') && !email.value.includes('.')) return 'Incomplete domain extension'
|
|
35
|
+
return 'Please enter a valid email address'
|
|
36
|
+
})
|
|
37
|
+
```
|
|
38
|
+
```pug
|
|
39
|
+
KTextbox(
|
|
40
|
+
v-model="email"
|
|
41
|
+
type="email"
|
|
42
|
+
placeholder="user@example.com"
|
|
43
|
+
:validation="emailValidation"
|
|
44
|
+
:validationText="emailValidationText"
|
|
45
|
+
showClear
|
|
46
|
+
)
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
2. **Debounced Asynchronous / Remote Validation**:
|
|
50
|
+
```typescript
|
|
51
|
+
const username = ref('')
|
|
52
|
+
const asyncValidation = ref<'success' | 'warning' | 'error' | null>(null)
|
|
53
|
+
const asyncValidationText = ref('')
|
|
54
|
+
let timer: ReturnType<typeof setTimeout> | null = null
|
|
55
|
+
|
|
56
|
+
watch(username, (val) => {
|
|
57
|
+
if (timer) clearTimeout(timer)
|
|
58
|
+
const clean = val.trim()
|
|
59
|
+
if (!clean) {
|
|
60
|
+
asyncValidation.value = null
|
|
61
|
+
asyncValidationText.value = ''
|
|
62
|
+
return
|
|
63
|
+
}
|
|
64
|
+
// Set in-flight warning state
|
|
65
|
+
asyncValidation.value = 'warning'
|
|
66
|
+
asyncValidationText.value = `Checking availability for "${clean}"...`
|
|
67
|
+
|
|
68
|
+
timer = setTimeout(async () => {
|
|
69
|
+
const isTaken = ['admin', 'root', 'support'].includes(clean.toLowerCase())
|
|
70
|
+
if (isTaken) {
|
|
71
|
+
asyncValidation.value = 'error'
|
|
72
|
+
asyncValidationText.value = `Username "${clean}" is already taken`
|
|
73
|
+
} else {
|
|
74
|
+
asyncValidation.value = 'success'
|
|
75
|
+
asyncValidationText.value = `Username "${clean}" is available!`
|
|
76
|
+
}
|
|
77
|
+
}, 400)
|
|
78
|
+
})
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
3. **Complete Form Submission Handling**:
|
|
82
|
+
```typescript
|
|
83
|
+
const form = reactive({ name: '', email: '', terms: false })
|
|
84
|
+
const submitted = ref(false)
|
|
85
|
+
|
|
86
|
+
const formErrors = computed(() => {
|
|
87
|
+
const errs: string[] = []
|
|
88
|
+
if (!form.name.trim()) errs.push('Full Name is required')
|
|
89
|
+
if (!form.email || !/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(form.email)) errs.push('Valid Email is required')
|
|
90
|
+
if (!form.terms) errs.push('You must accept the terms of service')
|
|
91
|
+
return errs
|
|
92
|
+
})
|
|
93
|
+
|
|
94
|
+
function getFieldState(field: keyof typeof form) {
|
|
95
|
+
if (!submitted.value) return null
|
|
96
|
+
if (field === 'name') return form.name.trim() ? 'success' : 'error'
|
|
97
|
+
if (field === 'email') return /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(form.email) ? 'success' : 'error'
|
|
98
|
+
if (field === 'terms') return form.terms ? 'success' : 'error'
|
|
99
|
+
return null
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
function submitForm() {
|
|
103
|
+
submitted.value = true
|
|
104
|
+
if (formErrors.value.length === 0) {
|
|
105
|
+
// Dispatch validated payload to backend
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
```
|
|
109
|
+
```pug
|
|
110
|
+
KAlert(v-if="submitted && formErrors.length > 0" type="danger" title="Validation Errors")
|
|
111
|
+
ul
|
|
112
|
+
li(v-for="err in formErrors" :key="err") {{ err }}
|
|
113
|
+
|
|
114
|
+
KTextbox(
|
|
115
|
+
v-model="form.name"
|
|
116
|
+
:validation="getFieldState('name')"
|
|
117
|
+
validationText="Full Name is required"
|
|
118
|
+
placeholder="Name"
|
|
119
|
+
)
|
|
120
|
+
KButton(type="primary" @click="submitForm") Submit
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
---
|
|
124
|
+
|
|
125
|
+
## 2.3. Data & Advanced Display
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
### `KTree` Item Customization
|
|
2
|
+
```pug
|
|
3
|
+
KTree(:dataProvider="myProvider")
|
|
4
|
+
template(#item="{ data, node }")
|
|
5
|
+
KGrid(align="center")
|
|
6
|
+
KIcon(:iconname="data.type === 'folder' ? 'folder' : 'file'")
|
|
7
|
+
span {{ data.name }}
|
|
8
|
+
span.badge(v-if="node.hasChildren") {{ node.depth }}
|
|
9
|
+
```
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
### Global Notification Queue (`useToast()`)
|
|
2
|
+
Imperative notification composable accessible across any component, store, or composable:
|
|
3
|
+
```ts
|
|
4
|
+
const toast = useToast()
|
|
5
|
+
|
|
6
|
+
// Variant shortcuts
|
|
7
|
+
toast.success('Record created!')
|
|
8
|
+
toast.error('Failed to update')
|
|
9
|
+
toast.warning('Check connection')
|
|
10
|
+
toast.info('New message received')
|
|
11
|
+
toast.primary('System announcement')
|
|
12
|
+
|
|
13
|
+
// Custom configuration and positions
|
|
14
|
+
toast.show('Custom Alert', {
|
|
15
|
+
title: 'Network Sync',
|
|
16
|
+
position: 'bottom-right', // 'top-right' | 'top-left' | 'top-center' | 'bottom-right' | 'bottom-left' | 'bottom-center'
|
|
17
|
+
duration: 4000,
|
|
18
|
+
pauseOnHover: true,
|
|
19
|
+
onClose: () => console.log('Closed')
|
|
20
|
+
})
|
|
21
|
+
|
|
22
|
+
// Dismissal
|
|
23
|
+
toast.dismiss(id)
|
|
24
|
+
toast.clear() // Clear all toasts
|
|
25
|
+
toast.clear('top-right') // Clear specific position
|
|
26
|
+
```
|
|
27
|
+
- **Auto-Mounting**: `KToastContainer` is mounted automatically to `document.body` by `@katlux/toolkit`, requiring zero boilerplate in consumer projects.
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
### Form Validation Directives & Semantic Classes
|
|
2
|
+
- Form components automatically apply semantic class names matching validation state:
|
|
3
|
+
- `is-success`: Border and focus rings use `var(--success-500)`.
|
|
4
|
+
- `is-warning`: Border and focus rings use `var(--warning-500)`.
|
|
5
|
+
- `is-error`: Border and focus rings use `var(--danger-500)`.
|
|
6
|
+
- Use universal validation props (`:validation="state"` and `:validationText="msg"`) across all input components.
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: katlux-config
|
|
3
|
+
description: Katlux Toolkit project configuration, development standards, and installable packages reference. Use this skill when setting up nuxt.config.ts, app.config.ts, or when you need to know which packages to install.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Katlux Toolkit: Project Configuration & Development Standards
|
|
7
|
+
|
|
8
|
+
## Development Standards (Toolkit, Presets, Blocks)
|
|
9
|
+
|
|
10
|
+
1. **Mandatory Testing**: Every component (whether in `@katlux/toolkit`, presets, or blocks) requires unit and edge-case test coverage to guarantee full functionality and prevent regressions.
|
|
11
|
+
2. **Accessibility & WAI-ARIA**: All components implement appropriate WAI-ARIA roles (`role="dialog"`, `role="tablist"`, `role="grid"`, etc.), focus traps, keyboard navigation (`Enter`, `Space`, `Escape`), and accessible input clips (never `display: none` on interactive inputs).
|
|
12
|
+
3. **Translation-First Labels & Clean Props**: User-facing UI text, `aria-label`s, placeholders, empty state messages, button labels, and JS/TS strings use internationalization translation functions (`t('...')` / `:aria-label="t('...')"`). Avoid hardcoded English strings, static fallbacks (`|| ''`), or bloating props with extra label fields.
|
|
13
|
+
4. **CSS Variables Usage & Preset Selectors**: Styling properties (colors, fonts, sizes, borders, border-radii, shadows, gaps, margins, paddings, transitions) use CSS variables (e.g. `var(--primary-500)`, `var(--border-radius-md)`, `var(--component-gap)`). Preset root selectors use space-separated attribute selectors (`[data-preset~="preset-name"]`) rather than substring matching (`*=`). Avoid `!important` on preset theme rules to enable dynamic preset switching.
|
|
14
|
+
5. **No Deep Relative Imports**: Avoid deep relative imports (e.g. `../../../../composables/...`). Always use workspace or framework module aliases (such as `#toolkit/composables/...`, `#toolkit/components/...`, etc.) for clean, maintainable import paths.
|
|
15
|
+
|
|
16
|
+
## Template & Indentation Standards
|
|
17
|
+
|
|
18
|
+
1. **Template**: Always use **Pug** (`lang="pug"`).
|
|
19
|
+
2. **Indentation**: Use **Tabs**.
|
|
20
|
+
3. **Pug Tip**: Use `v-pre` on code blocks: `pre(v-pre) code {{ content }}`.
|
|
21
|
+
4. **Binding**: Bind DataProviders: `KDatatable(:dataProvider="myProvider")`.
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
## `nuxt.config.ts`
|
|
26
|
+
|
|
27
|
+
```typescript
|
|
28
|
+
export default defineNuxtConfig({
|
|
29
|
+
modules: ['@katlux/toolkit'],
|
|
30
|
+
runtimeConfig: {
|
|
31
|
+
public: {
|
|
32
|
+
katluxToolkit: {
|
|
33
|
+
template: 'default', // Active template name
|
|
34
|
+
templatesDir: '~/templates', // Path to custom template overrides
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
})
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
> [!NOTE]
|
|
42
|
+
> `@katlux/toolkit` automatically installs `@nuxtjs/i18n` with a minimal English default if it is not already present in the consumer's `modules` array. Katlux components rely on `nuxtApp.$t` for all user-facing labels and ARIA strings. If you need custom locales or translation files, add `'@nuxtjs/i18n'` with your own configuration to `modules` **before** `'@katlux/toolkit'` and the toolkit will skip its default installation.
|
|
43
|
+
|
|
44
|
+
---
|
|
45
|
+
|
|
46
|
+
## `app.config.ts`
|
|
47
|
+
|
|
48
|
+
```typescript
|
|
49
|
+
export default defineAppConfig({
|
|
50
|
+
katluxToolkit: {
|
|
51
|
+
presetList: [
|
|
52
|
+
{ name: 'Default', value: 'default' },
|
|
53
|
+
{ name: 'Modern', value: 'modern' },
|
|
54
|
+
{ name: 'Dark Mode', value: 'dark' },
|
|
55
|
+
{ name: 'Dark over Modern', value: ['dark', 'modern'] } // Multi-preset inheritance stack
|
|
56
|
+
],
|
|
57
|
+
// Accepts a single preset string (e.g., 'modern') or a priority array (e.g., ['dark', 'modern'])
|
|
58
|
+
// Priority order: Dark overrides Modern, which overrides Default fallback
|
|
59
|
+
activePreset: ['dark', 'modern'],
|
|
60
|
+
},
|
|
61
|
+
})
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
---
|
|
65
|
+
|
|
66
|
+
## Security & Content Security Policy (CSP) Standards
|
|
67
|
+
|
|
68
|
+
1. **Cookie Security & CSRF**:
|
|
69
|
+
- Keep authentication credentials in a **server-set `HttpOnly` cookie**, never in `localStorage`/`sessionStorage`/client-written cookies (readable by any XSS).
|
|
70
|
+
- For cookies written through `CCookieCache`, flags are constructor options: `sameSite` (default `'lax'`), `secure` (auto-detected from the request protocol), `httpOnly` (default `true`, server writes only), `path`. See the `katlux-providers` skill.
|
|
71
|
+
- `SameSite=Lax`/`Strict` is the baseline CSRF defense. For stricter needs (token-based CSRF), use a Nuxt-level module such as `nuxt-security` rather than rolling your own in the app.
|
|
72
|
+
|
|
73
|
+
2. **Content Security Policy (CSP)**:
|
|
74
|
+
- Configure CSP headers in `nuxt.config.ts` (via `routeRules` or server middleware) to prevent XSS and malicious inline scripts:
|
|
75
|
+
```typescript
|
|
76
|
+
export default defineNuxtConfig({
|
|
77
|
+
routeRules: {
|
|
78
|
+
'/**': {
|
|
79
|
+
headers: {
|
|
80
|
+
'Content-Security-Policy': [
|
|
81
|
+
"default-src 'self'",
|
|
82
|
+
"script-src 'self'",
|
|
83
|
+
"style-src 'self' 'unsafe-inline'",
|
|
84
|
+
"img-src 'self' data: https:",
|
|
85
|
+
"font-src 'self' https: data:",
|
|
86
|
+
"connect-src 'self'",
|
|
87
|
+
"frame-ancestors 'none'",
|
|
88
|
+
"base-uri 'self'",
|
|
89
|
+
"form-action 'self'"
|
|
90
|
+
].join('; ')
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
})
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
3. **SVG & Rich Text Sanitization**:
|
|
98
|
+
- Treat any `v-html` with unverified input as unsafe. `KIcon` passes its SVG string through `sanitizeHtml()` (`@katlux/toolkit`, `runtime/utils/sanitize.ts`), a best-effort **regex** filter that strips `<script>`/`<iframe>`-style tags, `on*=` handlers and plain `javascript:` URIs.
|
|
99
|
+
- **Limitation:** it is not a full HTML sanitizer — it does not catch every vector (e.g. `<svg/onload=…>` or entity-encoded `javascript:` URIs). Only feed it developer-controlled icon markup; use a real allowlist sanitizer such as DOMPurify for user-generated HTML.
|
|
100
|
+
|
|
101
|
+
---
|
|
102
|
+
|
|
103
|
+
## Installable Katlux Packages
|
|
104
|
+
|
|
105
|
+
| Package Name | Current Version | Description | Installation Command |
|
|
106
|
+
| --- | --- | --- | --- |
|
|
107
|
+
| `@katlux/toolkit` | `0.1.1-alpha.129` | Core Nuxt module, UI toolkit, presets, and components | `npm install @katlux/toolkit@alpha` |
|
|
108
|
+
| `@katlux/providers` | `0.1.1-alpha.117` | Core data providers, client caching, and state structures | `npm install @katlux/providers@alpha` |
|
|
109
|
+
| `@katlux/preset-modern` | `0.1.1-alpha.105` | Modern design preset and styling variables | `npm install @katlux/preset-modern@alpha` |
|
|
110
|
+
| `@katlux/preset-dark` | `0.1.1-alpha.36` | Sleek Dark Mode design preset | `npm install @katlux/preset-dark@alpha` |
|
|
111
|
+
| `@katlux/block-charts` | `0.1.1-alpha.105` | Pre-built charting block components | `npm install @katlux/block-charts@alpha` |
|
|
112
|
+
| `@katlux/block-ecommerce` | `0.1.1-alpha.105` | Pre-built eCommerce block components | `npm install @katlux/block-ecommerce@alpha` |
|
|
113
|
+
| `@katlux/mcp` | `0.1.0-alpha.9` | Model Context Protocol server for AI assistant integration | `npm install @katlux/mcp@alpha` |
|
|
114
|
+
|
|
115
|
+
> [!NOTE]
|
|
116
|
+
> Katlux packages are currently published under the `@alpha` tag on NPM. Always append `@alpha` or the specific version tag when adding dependencies.
|
|
117
|
+
|
|
118
|
+
---
|
|
119
|
+
|
|
120
|
+
## Monorepo Development Workflow
|
|
121
|
+
|
|
122
|
+
The project is a monorepo with apps under `apps/` and packages under `packages/`.
|
|
123
|
+
|
|
124
|
+
```bash
|
|
125
|
+
# Start the showcase dev server
|
|
126
|
+
cd apps/showcase && npm run dev
|
|
127
|
+
# OR from root (if workspace script is configured)
|
|
128
|
+
npm run dev
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
In dev mode, the showcase's `nuxt.config.ts` aliases `@katlux/*` package imports directly to their source `src/` directories (bypassing `dist/`). These aliases are **only active in development** (`process.env.NODE_ENV !== 'production'`) and should never appear in a consuming app's config.
|
|
132
|
+
|
|
133
|
+
```bash
|
|
134
|
+
# Build an individual package before publishing
|
|
135
|
+
cd packages/katlux-toolkit && npm run build
|
|
136
|
+
cd packages/katlux-providers && npm run build
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
```bash
|
|
140
|
+
# Publish packages to the beta npm tag
|
|
141
|
+
node publish-beta.mjs
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
---
|
|
145
|
+
|
|
146
|
+
## Typecheck Scopes & Verification Commands
|
|
147
|
+
|
|
148
|
+
The repository enforces three distinct typecheck scopes to guarantee type safety across packages, tests, and the consuming showcase Nuxt application:
|
|
149
|
+
|
|
150
|
+
| Scope | Script | Command | Purpose |
|
|
151
|
+
| :--- | :--- | :--- | :--- |
|
|
152
|
+
| **Root (Packages & Tests)** | `npm run typecheck` | `vue-tsc --noEmit` | Validates all packages (`packages/**`) and integration tests (`tests/**`), excluding `apps/**`. |
|
|
153
|
+
| **Strict Providers Package** | `npm run typecheck:providers` | `tsc -p packages/katlux-providers/tsconfig.json --noEmit` | Strict mode check on `@katlux/providers` source and unit specs. |
|
|
154
|
+
| **Showcase Application** | `npm run typecheck:showcase` | `npx nuxi prepare apps/showcase && vue-tsc --noEmit -p apps/showcase/tsconfig.json` | Validates the showcase Nuxt app including layouts, pages, and components using generated `.nuxt` types. |
|
|
155
|
+
| **Complete Monorepo Suite** | `npm run typecheck:all` | Runs all three scopes sequentially | Enforced in GitHub Actions CI (`.github/workflows/ci.yml`) on every push and PR. |
|
|
156
|
+
|