@katlux/toolkit 0.1.0-beta.0 → 0.1.0-beta.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 (162) hide show
  1. package/dist/module.d.cts +2 -0
  2. package/dist/module.d.mts +2 -0
  3. package/dist/module.json +9 -0
  4. package/dist/module.mjs +18 -0
  5. package/dist/types.d.mts +13 -0
  6. package/package.json +5 -2
  7. package/ARCHITECTURE.md +0 -70
  8. package/PRESET_NAMING.md +0 -63
  9. package/PRESET_SYSTEM.md +0 -204
  10. package/build.config.ts +0 -3
  11. package/nuxt.config.ts +0 -9
  12. package/src/module.ts +0 -36
  13. package/src/runtime/app.config.d.ts +0 -9
  14. package/src/runtime/components/KAccordion/KAccordion.global.vue +0 -18
  15. package/src/runtime/components/KAccordion/KAccordion.logic.ts +0 -49
  16. package/src/runtime/components/KAccordion/KAccordionItem.global.vue +0 -24
  17. package/src/runtime/components/KAccordion/KAccordionItem.logic.ts +0 -72
  18. package/src/runtime/components/KAlert/KAlert.global.vue +0 -10
  19. package/src/runtime/components/KAlert/KAlert.logic.ts +0 -3
  20. package/src/runtime/components/KBulkActions/KBulkActions.global.vue +0 -37
  21. package/src/runtime/components/KBulkActions/KBulkActions.logic.ts +0 -36
  22. package/src/runtime/components/KButton/KButton.global.vue +0 -37
  23. package/src/runtime/components/KButton/KButton.logic.ts +0 -75
  24. package/src/runtime/components/KCalendar/KCalendar.global.vue +0 -43
  25. package/src/runtime/components/KCalendar/KCalendar.logic.ts +0 -197
  26. package/src/runtime/components/KCalendar/KCalendarMonth.global.vue +0 -37
  27. package/src/runtime/components/KCalendar/KCalendarMonth.logic.ts +0 -175
  28. package/src/runtime/components/KCalendar/KCalendarWeek.global.vue +0 -10
  29. package/src/runtime/components/KCalendar/KCalendarWeek.logic.ts +0 -3
  30. package/src/runtime/components/KCalendar/recurringUtils.ts +0 -270
  31. package/src/runtime/components/KCalendar/types.ts +0 -54
  32. package/src/runtime/components/KCheckbox/KCheckbox.global.vue +0 -28
  33. package/src/runtime/components/KCheckbox/KCheckbox.logic.ts +0 -36
  34. package/src/runtime/components/KCombobox/KCombobox.global.vue +0 -51
  35. package/src/runtime/components/KCombobox/KCombobox.logic.ts +0 -194
  36. package/src/runtime/components/KContextMenu/KContextMenu.global.vue +0 -10
  37. package/src/runtime/components/KContextMenu/KContextMenu.logic.ts +0 -3
  38. package/src/runtime/components/KDatatable/KDataIterator.global.vue +0 -65
  39. package/src/runtime/components/KDatatable/KDataIterator.logic.ts +0 -59
  40. package/src/runtime/components/KDatatable/KDatatable.global.vue +0 -60
  41. package/src/runtime/components/KDatatable/KDatatable.logic.ts +0 -29
  42. package/src/runtime/components/KDatePicker/KDatePicker.global.vue +0 -52
  43. package/src/runtime/components/KDatePicker/KDatePicker.logic.ts +0 -87
  44. package/src/runtime/components/KDateTimePicker/KDateTimePicker.global.vue +0 -53
  45. package/src/runtime/components/KDateTimePicker/KDateTimePicker.logic.ts +0 -103
  46. package/src/runtime/components/KDropdown/KDropdown.global.vue +0 -25
  47. package/src/runtime/components/KDropdown/KDropdown.logic.ts +0 -46
  48. package/src/runtime/components/KGantt/KGantt.global.vue +0 -82
  49. package/src/runtime/components/KGantt/KGantt.logic.ts +0 -439
  50. package/src/runtime/components/KGrid/KGrid.global.vue +0 -22
  51. package/src/runtime/components/KGrid/KGrid.logic.ts +0 -67
  52. package/src/runtime/components/KHourPicker/KHourPicker.global.vue +0 -47
  53. package/src/runtime/components/KHourPicker/KHourPicker.logic.ts +0 -74
  54. package/src/runtime/components/KHourSelect/KHourSelect.global.vue +0 -41
  55. package/src/runtime/components/KHourSelect/KHourSelect.logic.ts +0 -92
  56. package/src/runtime/components/KIcon/KIcon.global.vue +0 -23
  57. package/src/runtime/components/KIcon/KIcon.logic.ts +0 -62
  58. package/src/runtime/components/KLoader/KLoader.global.vue +0 -27
  59. package/src/runtime/components/KLoader/KLoader.logic.ts +0 -34
  60. package/src/runtime/components/KMaskTextbox/KMaskTextbox.global.vue +0 -32
  61. package/src/runtime/components/KMaskTextbox/KMaskTextbox.logic.ts +0 -290
  62. package/src/runtime/components/KModal/KModal.global.vue +0 -28
  63. package/src/runtime/components/KModal/KModal.logic.ts +0 -20
  64. package/src/runtime/components/KPagination/KPagination.global.vue +0 -50
  65. package/src/runtime/components/KPagination/KPagination.logic.ts +0 -99
  66. package/src/runtime/components/KPanel/KPanel.global.vue +0 -22
  67. package/src/runtime/components/KPanel/KPanel.logic.ts +0 -24
  68. package/src/runtime/components/KRadiobox/KRadiobox.global.vue +0 -29
  69. package/src/runtime/components/KRadiobox/KRadiobox.logic.ts +0 -27
  70. package/src/runtime/components/KRangeSlider/KRangeSlider.global.vue +0 -43
  71. package/src/runtime/components/KRangeSlider/KRangeSlider.logic.ts +0 -94
  72. package/src/runtime/components/KSearchTree/KSearchTree.global.vue +0 -10
  73. package/src/runtime/components/KSearchTree/KSearchTree.logic.ts +0 -3
  74. package/src/runtime/components/KSearchTreeDropdown/KSearchTreeDropdown.global.vue +0 -10
  75. package/src/runtime/components/KSearchTreeDropdown/KSearchTreeDropdown.logic.ts +0 -3
  76. package/src/runtime/components/KSlider/KSlider.global.vue +0 -38
  77. package/src/runtime/components/KSlider/KSlider.logic.ts +0 -69
  78. package/src/runtime/components/KTabs/KTabItem.global.vue +0 -24
  79. package/src/runtime/components/KTabs/KTabItem.logic.ts +0 -48
  80. package/src/runtime/components/KTabs/KTabs.global.vue +0 -24
  81. package/src/runtime/components/KTabs/KTabs.logic.ts +0 -60
  82. package/src/runtime/components/KTextarea/KTextarea.global.vue +0 -26
  83. package/src/runtime/components/KTextarea/KTextarea.logic.ts +0 -43
  84. package/src/runtime/components/KTextbox/KTextbox.global.vue +0 -27
  85. package/src/runtime/components/KTextbox/KTextbox.logic.ts +0 -53
  86. package/src/runtime/components/KThree/KThree.global.vue +0 -13
  87. package/src/runtime/components/KTooltip/KTooltip.global.vue +0 -10
  88. package/src/runtime/components/KTooltip/KTooltip.logic.ts +0 -3
  89. package/src/runtime/components/KTree/KTree.global.vue +0 -41
  90. package/src/runtime/components/KTree/KTree.logic.ts +0 -92
  91. package/src/runtime/components/KTreePicker/KTreePicker.global.vue +0 -80
  92. package/src/runtime/components/KTreePicker/KTreePicker.logic.ts +0 -85
  93. package/src/runtime/components/KTreeView/KTreeView.global.vue +0 -81
  94. package/src/runtime/components/KTreeView/KTreeView.logic.ts +0 -146
  95. package/src/runtime/composables/useDebounce.ts +0 -33
  96. package/src/runtime/composables/useFilterLogic.ts +0 -245
  97. package/src/runtime/composables/usePresetComponent.ts +0 -69
  98. package/src/runtime/composables/useRemainingTime.ts +0 -28
  99. package/src/runtime/composables/useSortLogic.ts +0 -82
  100. package/src/runtime/composables/useTemplate.ts +0 -135
  101. package/src/runtime/directives/clickOutside.ts +0 -75
  102. package/src/runtime/directives/index.ts +0 -1
  103. package/src/runtime/plugins/PresetPlugin.ts +0 -59
  104. package/src/runtime/plugins/registerDirectives.ts +0 -6
  105. package/src/runtime/presets/default/assets/scss/css-variables.scss +0 -216
  106. package/src/runtime/presets/default/assets/scss/docs.scss +0 -52
  107. package/src/runtime/presets/default/assets/scss/index.scss +0 -4
  108. package/src/runtime/presets/default/assets/scss/mixins.scss +0 -94
  109. package/src/runtime/presets/default/assets/scss/reset.scss +0 -16
  110. package/src/runtime/presets/default/assets/svg/calendar.svg +0 -9
  111. package/src/runtime/presets/default/assets/svg/check.svg +0 -3
  112. package/src/runtime/presets/default/assets/svg/chevron.svg +0 -3
  113. package/src/runtime/presets/default/assets/svg/close.svg +0 -4
  114. package/src/runtime/presets/default/assets/svg/file.svg +0 -4
  115. package/src/runtime/presets/default/assets/svg/folder.svg +0 -3
  116. package/src/runtime/presets/default/assets/svg/search.svg +0 -4
  117. package/src/runtime/presets/default/assets/svg/user.svg +0 -4
  118. package/src/runtime/presets/default/components/KAccordion/KAccordion.vue +0 -12
  119. package/src/runtime/presets/default/components/KAccordion/KAccordionItem.vue +0 -53
  120. package/src/runtime/presets/default/components/KAlert/KAlert.vue +0 -5
  121. package/src/runtime/presets/default/components/KBulkActions/KBulkActions.vue +0 -45
  122. package/src/runtime/presets/default/components/KButton/KButton.vue +0 -163
  123. package/src/runtime/presets/default/components/KCalendar/KCalendar.vue +0 -84
  124. package/src/runtime/presets/default/components/KCalendar/KCalendarMonth.vue +0 -217
  125. package/src/runtime/presets/default/components/KCalendar/KCalendarWeek.vue +0 -5
  126. package/src/runtime/presets/default/components/KCheckbox/KCheckbox.vue +0 -61
  127. package/src/runtime/presets/default/components/KCombobox/KCombobox.vue +0 -106
  128. package/src/runtime/presets/default/components/KCombobox/KComboboxList.vue +0 -94
  129. package/src/runtime/presets/default/components/KContextMenu/KContextMenu.vue +0 -5
  130. package/src/runtime/presets/default/components/KDataIterator/KDataIterator.vue +0 -66
  131. package/src/runtime/presets/default/components/KDatatable/KDatatable.vue +0 -155
  132. package/src/runtime/presets/default/components/KDatePicker/KDatePicker.vue +0 -49
  133. package/src/runtime/presets/default/components/KDateTimePicker/KDateTimePicker.vue +0 -84
  134. package/src/runtime/presets/default/components/KDropdown/KDropdown.vue +0 -38
  135. package/src/runtime/presets/default/components/KGantt/KGantt.vue +0 -400
  136. package/src/runtime/presets/default/components/KGantt/KGanttRuler.vue +0 -56
  137. package/src/runtime/presets/default/components/KGantt/KGanttTimeline.vue +0 -218
  138. package/src/runtime/presets/default/components/KGrid/KGrid.vue +0 -72
  139. package/src/runtime/presets/default/components/KHourPicker/KHourPicker.vue +0 -55
  140. package/src/runtime/presets/default/components/KHourSelect/KHourSelect.vue +0 -49
  141. package/src/runtime/presets/default/components/KIcon/KIcon.vue +0 -30
  142. package/src/runtime/presets/default/components/KLoader/KLoader.vue +0 -66
  143. package/src/runtime/presets/default/components/KMaskTextbox/KMaskTextbox.vue +0 -125
  144. package/src/runtime/presets/default/components/KModal/KModal.vue +0 -45
  145. package/src/runtime/presets/default/components/KPagination/KPagination.vue +0 -72
  146. package/src/runtime/presets/default/components/KPanel/KPanel.vue +0 -55
  147. package/src/runtime/presets/default/components/KRadiobox/KRadiobox.vue +0 -44
  148. package/src/runtime/presets/default/components/KRangeSlider/KRangeSlider.vue +0 -189
  149. package/src/runtime/presets/default/components/KSearchTree/KSearchTree.vue +0 -5
  150. package/src/runtime/presets/default/components/KSearchTreeDropdown/KSearchTreeDropdown.vue +0 -5
  151. package/src/runtime/presets/default/components/KSlider/KSlider.vue +0 -144
  152. package/src/runtime/presets/default/components/KTabs/KTabItem.vue +0 -49
  153. package/src/runtime/presets/default/components/KTabs/KTabs.vue +0 -19
  154. package/src/runtime/presets/default/components/KTextarea/KTextarea.vue +0 -32
  155. package/src/runtime/presets/default/components/KTextbox/KTextbox.vue +0 -53
  156. package/src/runtime/presets/default/components/KTooltip/KTooltip.vue +0 -5
  157. package/src/runtime/presets/default/components/KTree/KTree.vue +0 -148
  158. package/src/runtime/presets/default/components/KTreePicker/KTreePicker.vue +0 -100
  159. package/src/runtime/presets/default/components/KTreeView/KTreeCell.vue +0 -53
  160. package/src/runtime/presets/default/components/KTreeView/KTreeView.vue +0 -62
  161. package/src/runtime/utils/PresetResolver.ts +0 -158
  162. package/tsconfig.json +0 -20
@@ -0,0 +1,2 @@
1
+ export * from "/home/cagatay/Desktop/projects/KatluxShowcase/packages/katlux-toolkit/src/module";
2
+ export { default } from "/home/cagatay/Desktop/projects/KatluxShowcase/packages/katlux-toolkit/src/module";
@@ -0,0 +1,2 @@
1
+ export * from "/home/cagatay/Desktop/projects/KatluxShowcase/packages/katlux-toolkit/src/module";
2
+ export { default } from "/home/cagatay/Desktop/projects/KatluxShowcase/packages/katlux-toolkit/src/module";
@@ -0,0 +1,9 @@
1
+ {
2
+ "name": "@katlux/toolkit",
3
+ "configKey": "katluxToolkit",
4
+ "version": "0.1.0",
5
+ "builder": {
6
+ "@nuxt/module-builder": "1.0.2",
7
+ "unbuild": "3.6.1"
8
+ }
9
+ }
@@ -0,0 +1,18 @@
1
+ import { createJiti } from "file:///home/cagatay/Desktop/projects/KatluxShowcase/node_modules/jiti/lib/jiti.mjs";
2
+
3
+ const jiti = createJiti(import.meta.url, {
4
+ "interopDefault": true,
5
+ "alias": {
6
+ "@katlux/toolkit": "/home/cagatay/Desktop/projects/KatluxShowcase/packages/katlux-toolkit"
7
+ },
8
+ "transformOptions": {
9
+ "babel": {
10
+ "plugins": []
11
+ }
12
+ }
13
+ })
14
+
15
+ /** @type {import("/home/cagatay/Desktop/projects/KatluxShowcase/packages/katlux-toolkit/src/module")} */
16
+ const _module = await jiti.import("/home/cagatay/Desktop/projects/KatluxShowcase/packages/katlux-toolkit/src/module.ts");
17
+
18
+ export default _module?.default ?? _module;
@@ -0,0 +1,13 @@
1
+ import type { ModuleHooks, ModuleRuntimeHooks, ModuleRuntimeConfig, ModulePublicRuntimeConfig } from './module.mjs'
2
+
3
+ declare module '#app' {
4
+ interface RuntimeNuxtHooks extends ModuleRuntimeHooks {}
5
+ }
6
+
7
+ declare module '@nuxt/schema' {
8
+ interface NuxtHooks extends ModuleHooks {}
9
+ interface RuntimeConfig extends ModuleRuntimeConfig {}
10
+ interface PublicRuntimeConfig extends ModulePublicRuntimeConfig {}
11
+ }
12
+
13
+ export * from "./module.mjs"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@katlux/toolkit",
3
- "version": "0.1.0-beta.0",
3
+ "version": "0.1.0-beta.1",
4
4
  "description": "Core UI toolkit and utilities for the Katlux ecosystem",
5
5
  "author": "Katlux",
6
6
  "license": "MIT",
@@ -38,5 +38,8 @@
38
38
  "@nuxt/kit": "^3.20.1",
39
39
  "pug": "^3.0.0",
40
40
  "sass": "^1.80.0"
41
- }
41
+ },
42
+ "files": [
43
+ "dist"
44
+ ]
42
45
  }
package/ARCHITECTURE.md DELETED
@@ -1,70 +0,0 @@
1
- # Template System Architecture Decision
2
-
3
- ## Problem
4
-
5
- The current implementation has templates hardcoded in `.global.vue` files with `v-if` switching. The external template files in `~/templates/modern/` are not actually being used - they're just imported for styles.
6
-
7
- ## Solution: Component-Based Template System
8
-
9
- Instead of hardcoded templates, we'll create separate template components that can be dynamically loaded.
10
-
11
- ### New Structure
12
-
13
- ```
14
- KButton/
15
- ├── KButton.global.vue # Main component (uses logic + loads template)
16
- ├── KButton.logic.ts # Business logic
17
- ├── KButtonDefault.vue # Default template component
18
- └── templates/default/ # Default styles
19
- └── KButton.scss
20
-
21
- templates/modern/
22
- └── KButton/
23
- ├── KButtonModern.vue # Modern template component
24
- └── KButton.scss # Modern styles
25
- ```
26
-
27
- ### How It Works
28
-
29
- 1. **KButton.global.vue** - Main component that:
30
- - Uses the logic composable
31
- - Dynamically loads the appropriate template component
32
- - Passes props/slots to the template component
33
-
34
- 2. **KButtonDefault.vue** - Default template component:
35
- - Pure presentation
36
- - Receives props from main component
37
- - Uses default styles
38
-
39
- 3. **KButtonModern.vue** - Modern template component:
40
- - Pure presentation
41
- - Receives same props
42
- - Uses modern styles
43
- - Can add new features (like icon slot)
44
-
45
- ### Benefits
46
-
47
- - ✅ External templates are actually used
48
- - ✅ True dynamic loading
49
- - ✅ Easy to add new templates
50
- - ✅ Clean separation of concerns
51
- - ✅ Templates can be in user's project
52
- - ✅ No bundling of unused templates
53
-
54
- ### Implementation
55
-
56
- The main component will use dynamic component loading:
57
-
58
- ```vue
59
- <component
60
- :is="templateComponent"
61
- v-bind="$props"
62
- v-bind="logicState"
63
- >
64
- <template v-for="(_, slot) in $slots" #[slot]="scope">
65
- <slot :name="slot" v-bind="scope" />
66
- </template>
67
- </component>
68
- ```
69
-
70
- This way, the template files in `~/templates/modern/` will be the actual source of truth!
package/PRESET_NAMING.md DELETED
@@ -1,63 +0,0 @@
1
- # Template Naming Convention
2
-
3
- ## File Structure
4
-
5
- Template files are organized by template name in folders, with component files using just the component name:
6
-
7
- ```
8
- templates/{templateName}/components/{ComponentName}/{ComponentName}.vue
9
- ```
10
-
11
- ### Examples
12
-
13
- | Template Name (config) | File Path |
14
- |------------------------|-----------|
15
- | `modern` | `templates/modern/components/KButton/KButton.vue` |
16
- | `dark` | `templates/dark/components/KButton/KButton.vue` |
17
- | `minimal` | `templates/minimal/components/KButton/KButton.vue` |
18
- | `my-custom-theme` | `templates/my-custom-theme/components/KButton/KButton.vue` |
19
- | `dark-mode` | `templates/dark-mode/components/KButton/KButton.vue` |
20
- | `glassmorphic` | `templates/glassmorphic/components/KButton/KButton.vue` |
21
-
22
- **Note**: The template name is in the folder path, and components are organized in a `components/` subfolder!
23
-
24
- ### Complete Structure Example
25
-
26
- For a template named `my-custom-theme`:
27
-
28
- ```
29
- templates/my-custom-theme/
30
- ├── assets/ (shared styles/svgs)
31
- └── components/
32
- └── KButton/
33
- └── KButton.vue
34
- ```
35
-
36
- The component file is simply `KButton.vue` - the template name comes from the folder!
37
-
38
- ### Configuration
39
-
40
- In `app.config.ts`:
41
-
42
- ```typescript
43
- export default defineAppConfig({
44
- katluxToolkit: {
45
- activeTemplate: 'my-custom-theme', // Will load from templates/my-custom-theme/components/
46
- },
47
- })
48
- ```
49
-
50
- ### How It Works
51
-
52
- 1. **Template name from config**: `'my-custom-theme'`
53
- 2. **Resolve component**: The system dynamically imports the component from `~/templates/my-custom-theme/components/KButton/KButton.vue`
54
-
55
- ### No Hardcoding!
56
-
57
- The component loader is fully parametric. You can create any template name you want:
58
-
59
- - `activeTemplate: 'glassmorphic'` → loads `templates/glassmorphic/components/KButton/KButton.vue`
60
- - `activeTemplate: 'retro'` → loads `templates/retro/components/KButton/KButton.vue`
61
- - `activeTemplate: 'neon'` → loads `templates/neon/components/KButton/KButton.vue`
62
-
63
- Just create the corresponding component file and it will work automatically!
package/PRESET_SYSTEM.md DELETED
@@ -1,204 +0,0 @@
1
- # KatluxToolkit Templating System - Usage Guide
2
-
3
- This guide shows you how to use the KatluxToolkit templating system to customize component appearance while keeping their logic intact.
4
-
5
- ## Quick Start
6
-
7
- ### 1. Current State
8
-
9
- The following components now support templating:
10
- - **KButton** - Buttons with various types and sizes
11
- - **KCheckbox** - Checkboxes with custom styling
12
- - **KTextbox** - Text input fields with clear button
13
- - **KTextarea** - Multi-line text areas
14
-
15
- ### 2. Available Templates
16
-
17
- - **default** - The original KButton design
18
- - **modern** - A new template with gradients, shadows, and smooth animations
19
-
20
- ### 3. How to Switch Templates
21
-
22
- To use a custom template, update your `app.config.ts`:
23
-
24
- ```typescript
25
- export default defineAppConfig({
26
- katluxToolkit: {
27
- activeTemplate: 'modern', // Change from 'default' to 'modern'
28
- },
29
- })
30
- ```
31
-
32
- ### 4. Restart Your Dev Server
33
-
34
- After changing the template, restart your Nuxt dev server:
35
-
36
- ```bash
37
- npm run dev
38
- ```
39
-
40
- All KButton components in your app will now use the modern template!
41
-
42
- ## Template Structure
43
-
44
- Templates are located in the `~/templates/{templateName}/` directory with component-specific folders:
45
-
46
- ```
47
- templates/
48
- └── modern/
49
- ├── KButton/
50
- │ ├── KButton.pug
51
- │ └── KButton.scss
52
- ├── KCheckbox/
53
- │ ├── KCheckbox.pug
54
- │ └── KCheckbox.scss
55
- ├── KTextbox/
56
- │ ├── KTextbox.pug
57
- │ └── KTextbox.scss
58
- └── KTextarea/
59
- ├── KTextarea.pug
60
- └── KTextarea.scss
61
- ```
62
-
63
- ## Creating Your Own Template
64
-
65
- ### Step 1: Create Template Directory
66
-
67
- ```bash
68
- mkdir -p templates/my-custom-theme
69
- ```
70
-
71
- ### Step 2: Create Component Template Files
72
-
73
- Each component gets its own folder with a `.vue` file.
74
- Since we use Vue 3.5+, we can use `defineModel` to simplify the code significantly.
75
-
76
- Create `templates/my-custom-theme/KButton/KButton.vue`:
77
-
78
- ```vue
79
- <template lang="pug">
80
- // Your custom markedown structure
81
- button.KButton.my-custom(:class="buttonClasses" @click="onClick")
82
- slot
83
- </template>
84
-
85
- <script lang="ts" setup>
86
- // Use defineModel for two-way binding if needed, or simple props
87
- const props = defineProps<{
88
- buttonClasses: any
89
- onClick: (e: MouseEvent) => void
90
- // ... other props
91
- }>()
92
- </script>
93
-
94
- <style lang="scss" scoped>
95
- .KButton.my-custom {
96
- // Your custom styles here
97
- background-color: #your-color;
98
- border-radius: 8px;
99
- padding: 10px 20px;
100
- }
101
- </style>
102
- ```
103
-
104
- For **KTextarea**, it's even simpler:
105
-
106
- ```vue
107
- <template lang="pug">
108
- textarea.my-textarea(v-model="text" :placeholder="placeholder" :rows="rows")
109
- </template>
110
-
111
- <script lang="ts" setup>
112
- // Automatically handles props and emits for v-model
113
- const text = defineModel<string>('text')
114
-
115
- defineProps<{
116
- placeholder: string
117
- rows: number
118
- }>()
119
- </script>
120
- ```
121
-
122
- ### Step 3: Activate Your Template
123
-
124
- Update `app.config.ts`:
125
-
126
- ```typescript
127
- export default defineAppConfig({
128
- katluxToolkit: {
129
- activeTemplate: 'my-custom-theme',
130
- },
131
- })
132
- ```
133
-
134
- ## Important Rules for Custom Templates
135
-
136
- 1. **Each component must have its own folder**
137
- * For KButton: `templates/{templateName}/KButton/`
138
- * File inside: `KButton.vue`
139
-
140
- 2. **Template files must match component names exactly**
141
- * `KButton.vue`, `KTextarea.vue`
142
- * Case-sensitive!
143
-
144
- 3. **Templates are standard Vue SFCs**
145
- * You can use `<script setup>`, `<template>`, and `<style scoped>`.
146
- * We recommend using `defineModel` for clean code.
147
-
148
- 4. **Templates must use the same props/slots as default**
149
- * Check the global component or default template to see available props.
150
-
151
- ## Modern Template Features
152
-
153
- The modern template includes:
154
-
155
- - **Gradient backgrounds** for all button types
156
- - **Smooth hover animations** with lift effect
157
- - **Enhanced shadows** for depth
158
- - **Icon slot support** for adding icons to buttons
159
- - **Custom loading spinner** with animation
160
-
161
- ### Using the Modern Template with Icons
162
-
163
- ```vue
164
- <KButton type="primary">
165
- <template #icon>
166
- <Icon name="mdi:check" />
167
- </template>
168
- Click Me
169
- </KButton>
170
- ```
171
-
172
- ## Switching Between Templates at Runtime
173
-
174
- You can switch templates programmatically:
175
-
176
- ```typescript
177
- const appConfig = useAppConfig()
178
- appConfig.katluxToolkit.activeTemplate = 'modern'
179
- ```
180
-
181
- Note: You may need to refresh the page for changes to take effect.
182
-
183
- ## Troubleshooting
184
-
185
- ### Template not loading?
186
-
187
- 1. Check that template files exist in `templates/{templateName}/`
188
- 2. Verify file names match exactly (case-sensitive)
189
- 3. Restart your dev server
190
- 4. Check browser console for errors
191
-
192
- ### Styles not applying?
193
-
194
- 1. Make sure SCSS syntax is correct
195
- 2. Check that you're using the correct class names
196
- 3. Verify SCSS variables are available (from KatluxToolkit)
197
-
198
- ## Next Steps
199
-
200
- More components will be made templateable soon! The same pattern will apply to:
201
- - KCheckbox
202
- - KTextbox
203
- - KDatatable, KBulkActions, KDataIterator, KPagination
204
- - And more...
package/build.config.ts DELETED
@@ -1,3 +0,0 @@
1
- export default {
2
- failOnWarn: false,
3
- }
package/nuxt.config.ts DELETED
@@ -1,9 +0,0 @@
1
- import { defineNuxtConfig } from 'nuxt/config'
2
- import { fileURLToPath } from 'node:url'
3
-
4
- export default defineNuxtConfig({
5
- alias: {
6
- '#toolkit': fileURLToPath(new URL('./src/runtime', import.meta.url)),
7
- '#toolkit/*': fileURLToPath(new URL('./src/runtime/*', import.meta.url))
8
- }
9
- })
package/src/module.ts DELETED
@@ -1,36 +0,0 @@
1
- import { defineNuxtModule, addComponentsDir, addImportsDir, addPlugin, createResolver } from '@nuxt/kit'
2
-
3
- export default defineNuxtModule({
4
- meta: {
5
- name: '@katlux/toolkit',
6
- configKey: 'katluxToolkit'
7
- },
8
- setup(options, nuxt) {
9
- const { resolve } = createResolver(import.meta.url)
10
-
11
- // 1. Auto-import components
12
- addComponentsDir({
13
- path: resolve('./runtime/components'),
14
- pathPrefix: false,
15
- extensions: ['vue'],
16
- global: true
17
- })
18
-
19
- // 2. Auto-import composables
20
- addImportsDir(resolve('./runtime/composables'))
21
-
22
- // 3. Register plugins
23
- addPlugin(resolve('./runtime/plugins/registerDirectives'))
24
- addPlugin(resolve('./runtime/plugins/PresetPlugin'))
25
-
26
- // 4. Add aliases for easier internal imports
27
- nuxt.options.alias['#toolkit'] = resolve('./runtime')
28
-
29
- // 5. Inject TypeScript compilerOptions into the generated tsconfig.json
30
- // so users don't have to manually configure 'allowArbitraryExtensions'
31
- nuxt.hook('prepare:types', (options) => {
32
- options.tsConfig.compilerOptions = options.tsConfig.compilerOptions || {}
33
- options.tsConfig.compilerOptions.allowArbitraryExtensions = true
34
- })
35
- }
36
- })
@@ -1,9 +0,0 @@
1
- export { }
2
-
3
- declare module '@nuxt/schema' {
4
- interface AppConfig {
5
- katluxToolkit?: {
6
- activePreset?: string
7
- }
8
- }
9
- }
@@ -1,18 +0,0 @@
1
- <script lang="ts" setup>
2
- import { useKAccordionLogic, KAccordionDefaultProps, type KAccordionProps } from './KAccordion.logic'
3
- import { usePresetComponent } from '../../composables/usePresetComponent'
4
- import { computed } from 'vue'
5
- import KAccordionDefault from '../../presets/default/components/KAccordion/KAccordion.vue'
6
-
7
- const props = defineProps(KAccordionDefaultProps)
8
-
9
- useKAccordionLogic(props as KAccordionProps)
10
-
11
- const presetComponent = usePresetComponent('KAccordion', KAccordionDefault)
12
- </script>
13
-
14
- <template lang="pug">
15
- component(:is="presetComponent")
16
- template(v-for="(_, slot) in $slots" #[slot]="scope")
17
- slot(:name="slot" v-bind="scope")
18
- </template>
@@ -1,49 +0,0 @@
1
- import { ref, provide } from 'vue'
2
-
3
- export interface KAccordionProps {
4
- multiOpen?: boolean
5
- }
6
-
7
- export const KAccordionDefaultProps = {
8
- multiOpen: {
9
- type: Boolean,
10
- },
11
- }
12
-
13
- export function useKAccordionLogic(props: KAccordionProps) {
14
- const openIds = ref<string[]>([])
15
- const items = ref<Map<string, any>>(new Map())
16
-
17
- function registerItem(id: string, item: any) {
18
- items.value.set(id, item)
19
- return () => {
20
- items.value.delete(id)
21
- }
22
- }
23
-
24
- function toggleItem(id: string) {
25
- if (props.multiOpen) {
26
- if (openIds.value.includes(id)) {
27
- openIds.value = openIds.value.filter((i) => i !== id)
28
- } else {
29
- openIds.value.push(id)
30
- }
31
- } else {
32
- if (openIds.value[0] === id) {
33
- openIds.value = []
34
- } else {
35
- openIds.value = [id]
36
- }
37
- }
38
- }
39
-
40
- function isOpen(id: string) {
41
- return openIds.value.includes(id)
42
- }
43
-
44
- provide('accordionRegister', registerItem)
45
- provide('accordionToggle', toggleItem)
46
- provide('accordionIsOpen', isOpen)
47
-
48
- return {}
49
- }
@@ -1,24 +0,0 @@
1
- <script lang="ts" setup>
2
- import { useKAccordionItemLogic, KAccordionItemDefaultProps, type KAccordionItemProps } from './KAccordionItem.logic'
3
- import { usePresetComponent } from '../../composables/usePresetComponent'
4
- import { computed } from 'vue'
5
- import KAccordionItemDefault from '../../presets/default/components/KAccordion/KAccordionItem.vue'
6
-
7
- const props = defineProps(KAccordionItemDefaultProps)
8
-
9
- const { isOpen, toggleAccordion } = useKAccordionItemLogic(props as KAccordionItemProps)
10
-
11
- const presetComponent = usePresetComponent('KAccordionItem', KAccordionItemDefault)
12
-
13
- const templateProps = computed(() => ({
14
- title: props.title,
15
- isOpen: isOpen.value,
16
- toggleAccordion
17
- }))
18
- </script>
19
-
20
- <template lang="pug">
21
- component(:is="presetComponent" v-bind="templateProps")
22
- template(v-for="(_, slot) in $slots" #[slot]="scope")
23
- slot(:name="slot" v-bind="scope")
24
- </template>
@@ -1,72 +0,0 @@
1
- import { inject, ref, onMounted, computed, watch, nextTick, onUnmounted } from 'vue'
2
-
3
- export interface KAccordionItemProps {
4
- title: string
5
- isOpen?: boolean
6
- }
7
-
8
- export const KAccordionItemDefaultProps = {
9
- title: {
10
- type: String,
11
- required: true,
12
- },
13
- isOpen: {
14
- type: Boolean,
15
- },
16
- }
17
-
18
- export function useKAccordionItemLogic(props: KAccordionItemProps) {
19
- const register = inject<(id: string, item: any) => () => void>('accordionRegister')
20
- const toggle = inject<(id: string) => void>('accordionToggle')
21
- const isOpenFn = inject<(id: string) => boolean>('accordionIsOpen')
22
- let unregister: (() => void) | null = null
23
-
24
- onMounted(() => {
25
- if (register) {
26
- unregister = register(props.title, {})
27
- if (props.isOpen && toggle) {
28
- nextTick(() => {
29
- if (!isOpenFn || !isOpenFn(props.title)) {
30
- toggle(props.title)
31
- }
32
- })
33
- }
34
- }
35
- })
36
-
37
- onUnmounted(() => {
38
- if (unregister) {
39
- unregister()
40
- }
41
- })
42
-
43
- watch(
44
- () => props.isOpen,
45
- (shouldBeOpen) => {
46
- if (toggle && isOpenFn) {
47
- const currentlyOpen = isOpenFn(props.title)
48
- if (shouldBeOpen && !currentlyOpen) {
49
- toggle(props.title)
50
- } else if (!shouldBeOpen && currentlyOpen) {
51
- toggle(props.title)
52
- }
53
- }
54
- }
55
- )
56
-
57
- const isOpen = computed(() => {
58
- if (!isOpenFn) return !!props.isOpen
59
- return isOpenFn(props.title)
60
- })
61
-
62
- function toggleAccordion() {
63
- if (toggle) {
64
- toggle(props.title)
65
- }
66
- }
67
-
68
- return {
69
- isOpen,
70
- toggleAccordion,
71
- }
72
- }
@@ -1,10 +0,0 @@
1
- <script lang="ts" setup>
2
- import { usePresetComponent } from '../../composables/usePresetComponent'
3
- import KAlertDefault from '../../presets/default/components/KAlert/KAlert.vue'
4
-
5
- const presetComponent = usePresetComponent('KAlert', KAlertDefault)
6
- </script>
7
-
8
- <template lang="pug">
9
- component(:is="presetComponent")
10
- </template>
@@ -1,3 +0,0 @@
1
- export interface KAlertProps { }
2
- export const KAlertDefaultProps = {}
3
- export function useKAlertLogic() { return {} }