@witchcraft/ui 0.0.1 → 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.
- package/README.md +18 -28
- package/dist/module.d.mts +3 -1
- package/dist/module.json +3 -3
- package/dist/module.mjs +21 -12
- package/dist/runtime/assets/base.css +1 -1
- package/dist/runtime/assets/locales/en.json +2 -2
- package/dist/runtime/assets/tailwind.css +1 -1
- package/dist/runtime/assets/utils.css +1 -0
- package/dist/runtime/build/WitchcraftUiResolver.js +1 -1
- package/dist/runtime/components/Aria/Aria.vue +5 -9
- package/dist/runtime/components/Aria/Aria.vue.d.ts +5 -0
- package/dist/runtime/components/Icon/Icon.vue +12 -28
- package/dist/runtime/components/Icon/Icon.vue.d.ts +21 -0
- package/dist/runtime/components/LibButton/LibButton.vue +93 -117
- package/dist/runtime/components/LibButton/LibButton.vue.d.ts +36 -0
- package/dist/runtime/components/LibCheckbox/LibCheckbox.vue +53 -76
- package/dist/runtime/components/LibCheckbox/LibCheckbox.vue.d.ts +42 -0
- package/dist/runtime/components/LibColorInput/LibColorInput.vue +131 -101
- package/dist/runtime/components/LibColorInput/LibColorInput.vue.d.ts +63 -0
- package/dist/runtime/components/LibColorPicker/LibColorPicker.vue +326 -296
- package/dist/runtime/components/LibColorPicker/LibColorPicker.vue.d.ts +61 -0
- package/dist/runtime/components/LibColorPicker/utils/safeConvertToHsva.d.ts +2 -0
- package/dist/runtime/components/LibColorPicker/utils/safeConvertToHsva.js +18 -0
- package/dist/runtime/components/LibColorPicker/utils/safeConvertToRgba.d.ts +2 -0
- package/dist/runtime/components/LibColorPicker/utils/safeConvertToRgba.js +17 -0
- package/dist/runtime/components/LibColorPicker/utils/toLowPrecisionRgbaString.d.ts +2 -0
- package/dist/runtime/components/LibColorPicker/utils/toLowPrecisionRgbaString.js +8 -0
- package/dist/runtime/components/LibColorPicker/utils/truncate.d.ts +1 -0
- package/dist/runtime/components/LibColorPicker/utils/truncate.js +5 -0
- package/dist/runtime/components/LibDarkModeSwitcher/LibDarkModeSwitcher.vue +42 -64
- package/dist/runtime/components/LibDarkModeSwitcher/LibDarkModeSwitcher.vue.d.ts +22 -0
- package/dist/runtime/components/LibDatePicker/LibDatePicker.vue +20 -54
- package/dist/runtime/components/LibDatePicker/LibDatePicker.vue.d.ts +40 -0
- package/dist/runtime/components/LibDatePicker/LibRangeDatePicker.vue +205 -173
- package/dist/runtime/components/LibDatePicker/LibRangeDatePicker.vue.d.ts +34 -0
- package/dist/runtime/components/LibDatePicker/LibSingleDatePicker.vue +215 -164
- package/dist/runtime/components/LibDatePicker/LibSingleDatePicker.vue.d.ts +34 -0
- package/dist/runtime/components/LibDatePicker/LibTimeZonePicker.vue +9 -10
- package/dist/runtime/components/LibDatePicker/LibTimeZonePicker.vue.d.ts +22 -0
- package/dist/runtime/components/LibDebug/LibDebug.vue +47 -65
- package/dist/runtime/components/LibDebug/LibDebug.vue.d.ts +32 -0
- package/dist/runtime/components/LibDevOnly/LibDevOnly.vue +19 -34
- package/dist/runtime/components/LibDevOnly/LibDevOnly.vue.d.ts +22 -0
- package/dist/runtime/components/LibFileInput/LibFileInput.vue +155 -173
- package/dist/runtime/components/LibFileInput/LibFileInput.vue.d.ts +43 -0
- package/dist/runtime/components/LibInputDeprecated/LibInputDeprecated.vue +352 -0
- package/dist/runtime/components/LibInputDeprecated/LibInputDeprecated.vue.d.ts +165 -0
- package/dist/runtime/components/LibLabel/LibLabel.vue +30 -46
- package/dist/runtime/components/LibLabel/LibLabel.vue.d.ts +27 -0
- package/dist/runtime/components/LibMultiValues/LibMultiValues.vue +50 -66
- package/dist/runtime/components/LibMultiValues/LibMultiValues.vue.d.ts +29 -0
- package/dist/runtime/components/LibNotifications/LibNotification.vue +48 -56
- package/dist/runtime/components/LibNotifications/LibNotification.vue.d.ts +17 -0
- package/dist/runtime/components/LibNotifications/LibNotifications.vue +71 -83
- package/dist/runtime/components/LibNotifications/LibNotifications.vue.d.ts +13 -0
- package/dist/runtime/components/LibPagination/LibPagination.vue +86 -131
- package/dist/runtime/components/LibPagination/LibPagination.vue.d.ts +104 -0
- package/dist/runtime/components/LibPalette/LibPalette.vue +23 -26
- package/dist/runtime/components/LibPalette/LibPalette.vue.d.ts +14 -0
- package/dist/runtime/components/LibPopup/LibPopup.vue +326 -400
- package/dist/runtime/components/LibPopup/LibPopup.vue.d.ts +46 -0
- package/dist/runtime/components/LibProgressBar/LibProgressBar.vue +73 -93
- package/dist/runtime/components/LibProgressBar/LibProgressBar.vue.d.ts +41 -0
- package/dist/runtime/components/LibRecorder/LibRecorder.vue +134 -179
- package/dist/runtime/components/LibRecorder/LibRecorder.vue.d.ts +77 -0
- package/dist/runtime/components/LibRoot/LibRoot.vue +75 -89
- package/dist/runtime/components/LibRoot/LibRoot.vue.d.ts +41 -0
- package/dist/runtime/components/LibSimpleInput/LibSimpleInput.vue +51 -82
- package/dist/runtime/components/LibSimpleInput/LibSimpleInput.vue.d.ts +35 -0
- package/dist/runtime/components/LibSuggestions/LibSuggestions.vue +147 -164
- package/dist/runtime/components/LibSuggestions/LibSuggestions.vue.d.ts +94 -0
- package/dist/runtime/components/LibTable/LibTable.vue +69 -106
- package/dist/runtime/components/LibTable/LibTable.vue.d.ts +45 -0
- package/dist/runtime/components/Template/NAME.vue +15 -36
- package/dist/runtime/components/Template/NAME.vue.d.ts +17 -0
- package/dist/runtime/components/TestControls/TestControls.vue +7 -10
- package/dist/runtime/components/TestControls/TestControls.vue.d.ts +5 -0
- package/dist/runtime/components/index.d.ts +12 -11
- package/dist/runtime/components/index.js +12 -11
- package/dist/runtime/components/shared/props.d.ts +81 -16
- package/dist/runtime/components/shared/storyHelpers/playInput.js +5 -5
- package/dist/runtime/components/shared/storyHelpers/playSuggestions.js +15 -11
- package/dist/runtime/composables/index.d.ts +5 -0
- package/dist/runtime/composables/index.js +5 -0
- package/dist/runtime/composables/useDivideAttrs.js +1 -0
- package/dist/runtime/composables/useDragWithThreshold.d.ts +71 -0
- package/dist/runtime/composables/useDragWithThreshold.js +40 -0
- package/dist/runtime/composables/usePreHydrationValue.d.ts +12 -0
- package/dist/runtime/composables/usePreHydrationValue.js +15 -0
- package/dist/runtime/composables/useSetupI18n.d.ts +2 -0
- package/dist/runtime/composables/useSetupI18n.js +5 -1
- package/dist/runtime/composables/useSuggestions.d.ts +7 -5
- package/dist/runtime/composables/useSuggestions.js +94 -57
- package/dist/runtime/directives/vResizableCols.js +92 -84
- package/dist/runtime/helpers/NotificationHandler.d.ts +5 -0
- package/dist/runtime/helpers/index.d.ts +3 -1
- package/dist/runtime/helpers/index.js +3 -1
- package/dist/runtime/types/index.d.ts +6 -0
- package/dist/runtime/utils/notifyIfError.d.ts +14 -0
- package/dist/runtime/utils/notifyIfError.js +29 -0
- package/dist/types.d.mts +2 -6
- package/package.json +27 -29
- package/src/module.ts +31 -12
- package/src/runtime/assets/base.css +10 -1
- package/src/runtime/assets/locales/en.json +2 -2
- package/src/runtime/assets/tailwind.css +1 -1
- package/src/runtime/assets/{style.css → utils.css} +86 -4
- package/src/runtime/build/WitchcraftUiResolver.ts +1 -1
- package/src/runtime/components/Focus.stories.ts +3 -2
- package/src/runtime/components/Icon/Icon.vue +10 -6
- package/src/runtime/components/LibButton/LibButton.vue +41 -47
- package/src/runtime/components/LibCheckbox/LibCheckbox.vue +7 -4
- package/src/runtime/components/LibColorInput/LibColorInput.vue +111 -37
- package/src/runtime/components/LibColorPicker/LibColorPicker.stories.ts +25 -4
- package/src/runtime/components/LibColorPicker/LibColorPicker.vue +242 -131
- package/src/runtime/components/LibColorPicker/utils/safeConvertToHsva.ts +24 -0
- package/src/runtime/components/LibColorPicker/utils/safeConvertToRgba.ts +23 -0
- package/src/runtime/components/LibColorPicker/utils/toLowPrecisionRgbaString.ts +13 -0
- package/src/runtime/components/LibColorPicker/utils/truncate.ts +6 -0
- package/src/runtime/components/LibDarkModeSwitcher/LibDarkModeSwitcher.stories.ts +1 -1
- package/src/runtime/components/LibDarkModeSwitcher/LibDarkModeSwitcher.vue +11 -9
- package/src/runtime/components/LibDatePicker/LibDatePicker.vue +4 -17
- package/src/runtime/components/LibDatePicker/LibRangeDatePicker.vue +192 -131
- package/src/runtime/components/LibDatePicker/LibSingleDatePicker.vue +183 -115
- package/src/runtime/components/LibDatePicker/LibTimeZonePicker.vue +3 -3
- package/src/runtime/components/LibDebug/LibDebug.vue +15 -5
- package/src/runtime/components/LibDevOnly/LibDevOnly.vue +1 -3
- package/src/runtime/components/LibFileInput/LibFileInput.vue +54 -29
- package/src/runtime/components/{LibInput/LibInput.stories.ts → LibInputDeprecated/LibInputDeprecated.stories.ts} +64 -19
- package/{dist/runtime/components/LibInput/LibInput.vue → src/runtime/components/LibInputDeprecated/LibInputDeprecated.vue} +40 -34
- package/src/runtime/components/LibLabel/LibLabel.vue +2 -2
- package/src/runtime/components/LibMultiValues/LibMultiValues.stories.ts +5 -4
- package/src/runtime/components/LibMultiValues/LibMultiValues.vue +11 -13
- package/src/runtime/components/LibNotifications/LibNotification.vue +19 -11
- package/src/runtime/components/LibNotifications/LibNotifications.stories.ts +2 -2
- package/src/runtime/components/LibNotifications/LibNotifications.vue +20 -12
- package/src/runtime/components/LibPagination/LibPagination.stories.ts +2 -2
- package/src/runtime/components/LibPagination/LibPagination.vue +19 -20
- package/src/runtime/components/LibPalette/LibPalette.vue +3 -3
- package/src/runtime/components/LibPopup/LibPopup.stories.ts +2 -2
- package/src/runtime/components/LibPopup/LibPopup.vue +30 -67
- package/src/runtime/components/LibProgressBar/LibProgressBar.vue +3 -2
- package/src/runtime/components/LibRecorder/LibRecorder.vue +2 -3
- package/src/runtime/components/LibRoot/LibRoot.vue +14 -1
- package/src/runtime/components/LibSimpleInput/LibSimpleInput.stories.ts +1 -1
- package/src/runtime/components/LibSimpleInput/LibSimpleInput.vue +5 -8
- package/src/runtime/components/LibSuggestions/LibSuggestions.vue +42 -26
- package/src/runtime/components/LibTable/LibTable.vue +8 -9
- package/src/runtime/components/Scrolling.stories.ts +58 -0
- package/src/runtime/components/Template/NAME.vue +1 -1
- package/src/runtime/components/TestControls/TestControls.vue +1 -1
- package/src/runtime/components/index.ts +12 -12
- package/src/runtime/components/shared/props.ts +82 -19
- package/src/runtime/components/shared/storyHelpers/playInput.ts +6 -5
- package/src/runtime/components/shared/storyHelpers/playSuggestions.ts +25 -11
- package/src/runtime/composables/index.ts +5 -0
- package/src/runtime/composables/useDarkMode.ts +2 -2
- package/src/runtime/composables/useDivideAttrs.ts +1 -0
- package/src/runtime/composables/useDragWithThreshold.ts +108 -0
- package/src/runtime/composables/usePreHydrationValue.ts +30 -0
- package/src/runtime/composables/useSetupI18n.ts +8 -2
- package/src/runtime/composables/useSuggestions.ts +92 -45
- package/src/runtime/directives/vResizableCols.ts +82 -74
- package/src/runtime/helpers/NotificationHandler.ts +5 -0
- package/src/runtime/helpers/index.ts +3 -1
- package/src/runtime/types/index.ts +5 -0
- package/src/runtime/utils/notifyIfError.ts +45 -0
- package/dist/module.cjs +0 -5
- package/dist/module.d.ts +0 -34
- package/dist/runtime/assets/style.css +0 -1
- package/dist/runtime/components/Focus.stories.d.ts +0 -11
- package/dist/runtime/components/Focus.stories.js +0 -53
- package/dist/runtime/components/LibButton/LibButton.stories.d.ts +0 -12
- package/dist/runtime/components/LibButton/LibButton.stories.js +0 -94
- package/dist/runtime/components/LibCheckbox/LibCheckbox.stories.d.ts +0 -14
- package/dist/runtime/components/LibCheckbox/LibCheckbox.stories.js +0 -29
- package/dist/runtime/components/LibColorInput/LibColorInput.stories.d.ts +0 -7
- package/dist/runtime/components/LibColorInput/LibColorInput.stories.js +0 -58
- package/dist/runtime/components/LibColorPicker/LibColorPicker.stories.d.ts +0 -7
- package/dist/runtime/components/LibColorPicker/LibColorPicker.stories.js +0 -51
- package/dist/runtime/components/LibDarkModeSwitcher/LibDarkModeSwitcher.stories.d.ts +0 -7
- package/dist/runtime/components/LibDarkModeSwitcher/LibDarkModeSwitcher.stories.js +0 -36
- package/dist/runtime/components/LibDatePicker/LibDatePicker.stories.d.ts +0 -11
- package/dist/runtime/components/LibDatePicker/LibDatePicker.stories.js +0 -98
- package/dist/runtime/components/LibDebug/LibDebug.stories.d.ts +0 -9
- package/dist/runtime/components/LibDebug/LibDebug.stories.js +0 -46
- package/dist/runtime/components/LibFileInput/LibFileInput.stories.d.ts +0 -10
- package/dist/runtime/components/LibFileInput/LibFileInput.stories.js +0 -63
- package/dist/runtime/components/LibInput/LibInput.stories.d.ts +0 -33
- package/dist/runtime/components/LibInput/LibInput.stories.js +0 -339
- package/dist/runtime/components/LibLabel/LibLabel.stories.d.ts +0 -6
- package/dist/runtime/components/LibLabel/LibLabel.stories.js +0 -25
- package/dist/runtime/components/LibMultiValues/LibMultiValues.stories.d.ts +0 -23
- package/dist/runtime/components/LibMultiValues/LibMultiValues.stories.js +0 -60
- package/dist/runtime/components/LibNotifications/LibNotification.stories.d.ts +0 -15
- package/dist/runtime/components/LibNotifications/LibNotification.stories.js +0 -126
- package/dist/runtime/components/LibNotifications/LibNotifications.stories.d.ts +0 -6
- package/dist/runtime/components/LibNotifications/LibNotifications.stories.js +0 -109
- package/dist/runtime/components/LibPagination/LibPagination.stories.d.ts +0 -6
- package/dist/runtime/components/LibPagination/LibPagination.stories.js +0 -40
- package/dist/runtime/components/LibPalette/LibPalette.stories.d.ts +0 -6
- package/dist/runtime/components/LibPalette/LibPalette.stories.js +0 -20
- package/dist/runtime/components/LibPopup/LibPopup.stories.d.ts +0 -14
- package/dist/runtime/components/LibPopup/LibPopup.stories.js +0 -147
- package/dist/runtime/components/LibProgressBar/LibProgressBar.stories.d.ts +0 -10
- package/dist/runtime/components/LibProgressBar/LibProgressBar.stories.js +0 -81
- package/dist/runtime/components/LibRecorder/LibRecorder.stories.d.ts +0 -19
- package/dist/runtime/components/LibRecorder/LibRecorder.stories.js +0 -63
- package/dist/runtime/components/LibSimpleInput/LibSimpleInput.stories.d.ts +0 -26
- package/dist/runtime/components/LibSimpleInput/LibSimpleInput.stories.js +0 -78
- package/dist/runtime/components/LibSuggestions/LibSuggestions.stories.d.ts +0 -27
- package/dist/runtime/components/LibSuggestions/LibSuggestions.stories.js +0 -112
- package/dist/runtime/components/LibTable/LibTable.stories.d.ts +0 -16
- package/dist/runtime/components/LibTable/LibTable.stories.js +0 -156
- package/dist/runtime/components/reset.stories.d.ts +0 -5
- package/dist/runtime/components/reset.stories.js +0 -19
- package/dist/runtime/composables/useScrollNearContainerEdges.stories.d.ts +0 -7
- package/dist/runtime/composables/useScrollNearContainerEdges.stories.js +0 -85
- package/dist/runtime/helpers/addValue.d.ts +0 -1
- package/dist/runtime/helpers/addValue.js +0 -8
- package/dist/types.d.ts +0 -7
- package/src/runtime/components/LibInput/LibInput.vue +0 -372
- package/src/runtime/helpers/addValue.ts +0 -10
- /package/src/runtime/components/{reset.stories.ts → Reset.stories.ts} +0 -0
package/README.md
CHANGED
|
@@ -16,7 +16,7 @@ This is unfortunately not true styleless since the tailwind classes are still in
|
|
|
16
16
|
|
|
17
17
|
# Usage with Nuxt
|
|
18
18
|
|
|
19
|
-
Modules, composables, and directives should work out of the box without auto imports.
|
|
19
|
+
Modules, composables, and directives should work out of the box without auto imports. The module also installs the `reka-ui/nuxt` module.
|
|
20
20
|
|
|
21
21
|
## Tailwind (V4)
|
|
22
22
|
|
|
@@ -24,9 +24,16 @@ The module automatically sets up tailwind v4 and generates a custom `witchcraft-
|
|
|
24
24
|
|
|
25
25
|
It does not install "@nuxtjs/tailwindcss" for now since it's not compatible with v4. See [#919](https://github.com/nuxt-modules/tailwindcss/issues/919).
|
|
26
26
|
|
|
27
|
-
```css[~/assets/css/tailwind.css]
|
|
28
|
-
@import "@tailwindcss";
|
|
27
|
+
```css [~/assets/css/tailwind.css]
|
|
28
|
+
@import "@tailwindcss" source("../../../app");
|
|
29
29
|
@import "../../../.nuxt/witchcraft-ui.css";
|
|
30
|
+
|
|
31
|
+
// without Nuxt:
|
|
32
|
+
@import "@witchcraft/ui/utils.css";
|
|
33
|
+
@import "@witchcraft/ui/base.css";
|
|
34
|
+
// source used components
|
|
35
|
+
@source "@witchcraft/ui/components";
|
|
36
|
+
|
|
30
37
|
```
|
|
31
38
|
|
|
32
39
|
## Icons
|
|
@@ -54,14 +61,14 @@ Usually it is possible to do most modifications through props, but slots to repl
|
|
|
54
61
|
Most slots where possible are passed all properties needed to replace them except classes so you can do something like this, to for example replace the simple input component inside the input component.
|
|
55
62
|
|
|
56
63
|
```vue
|
|
57
|
-
<lib-input>
|
|
64
|
+
<lib-simple-input-deprecated>
|
|
58
65
|
<template #input="slotProps">
|
|
59
66
|
<lib-simple-input
|
|
60
67
|
:class="'completely custom styles'"
|
|
61
68
|
v-bind="slotProps"
|
|
62
69
|
></lib-simple-input>
|
|
63
70
|
</template>
|
|
64
|
-
</lib-input>
|
|
71
|
+
</lib-simple-input>
|
|
65
72
|
|
|
66
73
|
```
|
|
67
74
|
|
|
@@ -108,17 +115,11 @@ See [@witchcraft/editor/vite.config.dev.ts].
|
|
|
108
115
|
#### Extra Classes
|
|
109
116
|
|
|
110
117
|
```css
|
|
111
|
-
@import "@witchcraft/ui/
|
|
118
|
+
@import "@witchcraft/ui/utils.css";
|
|
112
119
|
@import "@witchcraft/ui/base.css";
|
|
113
|
-
@source "
|
|
120
|
+
@source "/path/to/node_modules/@witchcraft/ui/src/runtime/components";
|
|
114
121
|
```
|
|
115
|
-
Base just contains animation keyframes
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
#### Tailwind Configuration
|
|
119
|
-
|
|
120
|
-
This module does everything v4 style, so no configuration is needed.
|
|
121
|
-
|
|
122
|
+
Base just contains animation keyframes, basic styles for vue animations, and some basic global styles. They will get imported regardless of whether they are used since otherwise tailwind does not detect they are being used.
|
|
122
123
|
|
|
123
124
|
#### tailwind-merge
|
|
124
125
|
|
|
@@ -164,7 +165,7 @@ Note that using the strictTemplates compiler option can cause weird issues with
|
|
|
164
165
|
|
|
165
166
|
## Props
|
|
166
167
|
|
|
167
|
-
Due to issues with vue 3 removing $listeners and the fact that we can't inherit from an existing HTML attribute types to specify props for wrapper components (most of them), we have to declare props in a convoluted way to get proper types when we consume the
|
|
168
|
+
Due to issues with vue 3 removing $listeners and the fact that we can't inherit from an existing HTML attribute types to specify props for wrapper components (most of them), we have to declare props in a convoluted way to get proper types when we consume the components.
|
|
168
169
|
|
|
169
170
|
Here is an example of the needed code for props to work correctly:
|
|
170
171
|
```vue
|
|
@@ -174,14 +175,6 @@ Here is an example of the needed code for props to work correctly:
|
|
|
174
175
|
|
|
175
176
|
import type { BaseInteractiveProps } from "../shared/props.js"
|
|
176
177
|
|
|
177
|
-
// if using useDivideAttrs, we need to do the below for each prefix
|
|
178
|
-
// a helper type WrapperProps is provided to do this
|
|
179
|
-
type WrapperTypes = (WrapperProps<"wrapper", HTMLAttributes, {
|
|
180
|
-
// overrides
|
|
181
|
-
/** Tailwind classes. */
|
|
182
|
-
class:string;
|
|
183
|
-
}>)
|
|
184
|
-
|
|
185
178
|
// real props vue can understand, they will show up under props.*
|
|
186
179
|
type RealProps =
|
|
187
180
|
// simple types are okay
|
|
@@ -193,7 +186,6 @@ type RealProps =
|
|
|
193
186
|
id?: InputHTMLAttributes["id"]
|
|
194
187
|
}
|
|
195
188
|
|
|
196
|
-
|
|
197
189
|
interface Props
|
|
198
190
|
extends
|
|
199
191
|
// we need to ignore the complex InputHTMLAttributes type
|
|
@@ -205,12 +197,10 @@ interface Props
|
|
|
205
197
|
Partial<Omit<InputHTMLAttributes,"class" | "onSubmit"> & {
|
|
206
198
|
// overrides for the components
|
|
207
199
|
// usually, for example, class can only be a string (because of tailwind)
|
|
208
|
-
// this
|
|
209
|
-
// it will be passed as an attr
|
|
200
|
+
// this will be passed as an attr
|
|
210
201
|
class?:string
|
|
211
202
|
}>,
|
|
212
203
|
/** @vue-ignore */
|
|
213
|
-
Partial<WrapperTypes>,
|
|
214
204
|
RealProps
|
|
215
205
|
{ }
|
|
216
206
|
</script>
|
|
@@ -223,7 +213,7 @@ const props = withDefaults(defineProps<Props>(), {
|
|
|
223
213
|
id: "",
|
|
224
214
|
...baseInteractivePropsDefaults
|
|
225
215
|
})
|
|
226
|
-
const $ =
|
|
216
|
+
const $attrs = useAttrs()
|
|
227
217
|
</script>
|
|
228
218
|
```
|
|
229
219
|
|
package/dist/module.d.mts
CHANGED
|
@@ -24,9 +24,11 @@ interface ModuleOptions {
|
|
|
24
24
|
componentPrefix: string;
|
|
25
25
|
debug?: boolean;
|
|
26
26
|
/**
|
|
27
|
-
* @default "~/assets/css/tailwind.css"
|
|
27
|
+
* @default "~/assets/css/tailwind.css" if it exists.
|
|
28
28
|
*/
|
|
29
29
|
mainCssFile?: string;
|
|
30
|
+
/** @internal */
|
|
31
|
+
_playgroundWorkaround?: boolean;
|
|
30
32
|
}
|
|
31
33
|
declare const _default: _nuxt_schema.NuxtModule<ModuleOptions, ModuleOptions, false>;
|
|
32
34
|
|
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { indent, crop } from '@alanscodelog/utils';
|
|
2
2
|
import { createResolver, defineNuxtModule, useLogger, addTemplate, addComponent, addImports, installModule, addTypeTemplate } from '@nuxt/kit';
|
|
3
3
|
import tailwindcss from '@tailwindcss/vite';
|
|
4
4
|
import { globFiles, addImportsCustom } from '@witchcraft/nuxt-utils/utils';
|
|
@@ -18,6 +18,7 @@ const componentsInfo = globFiles([
|
|
|
18
18
|
`${resolve("./runtime/components")}/**/*.vue*`,
|
|
19
19
|
`!**/Template/**.vue`
|
|
20
20
|
], [], (filepath, name) => ({
|
|
21
|
+
originalName: name,
|
|
21
22
|
name: name.startsWith("Lib") ? name.replace("Lib", "PREFIX") : `PREFIX${name}`,
|
|
22
23
|
filepath
|
|
23
24
|
}));
|
|
@@ -34,7 +35,8 @@ const module = defineNuxtModule({
|
|
|
34
35
|
],
|
|
35
36
|
componentPrefix: "W",
|
|
36
37
|
debug: true,
|
|
37
|
-
mainCssFile: "~/assets/css/tailwind.css"
|
|
38
|
+
mainCssFile: "~/assets/css/tailwind.css",
|
|
39
|
+
_playgroundWorkaround: false
|
|
38
40
|
},
|
|
39
41
|
async setup(options, nuxt) {
|
|
40
42
|
const moduleName = "@witchcraft/ui";
|
|
@@ -57,18 +59,20 @@ const module = defineNuxtModule({
|
|
|
57
59
|
directives: options.directives
|
|
58
60
|
}
|
|
59
61
|
);
|
|
60
|
-
const contents = [
|
|
61
|
-
...componentsInfo.map((_) => _.filepath)
|
|
62
|
-
];
|
|
63
62
|
addTemplate({
|
|
64
63
|
filename: "witchcraft-ui.css",
|
|
65
64
|
write: true,
|
|
66
|
-
getContents: () => crop`
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
65
|
+
getContents: () => options._playgroundWorkaround ? crop`
|
|
66
|
+
${indent(themeAsTailwindCss(theme, themeConvertionOpts), 5)}
|
|
67
|
+
@import "${resolve("runtime/assets/base.css")}";
|
|
68
|
+
@import "${resolve("runtime/assets/utils.css")}";
|
|
69
|
+
${indent(filteredComponentsInfo.map((_) => `@source "${_.filepath}";`).join("\n"), 5)}
|
|
70
|
+
` : crop`
|
|
71
|
+
${indent(themeAsTailwindCss(theme, themeConvertionOpts), 5)}
|
|
72
|
+
@import "@witchcraft/ui/base.css";
|
|
73
|
+
@import "@witchcraft/ui/utils.css";
|
|
74
|
+
${indent(filteredComponentsInfo.map((_) => `@source "${_.filepath}";`).join("\n"), 5)}
|
|
75
|
+
`
|
|
72
76
|
});
|
|
73
77
|
await Promise.all(
|
|
74
78
|
filteredComponentsInfo.map(async (entry) => addComponent({
|
|
@@ -110,8 +114,13 @@ const module = defineNuxtModule({
|
|
|
110
114
|
];
|
|
111
115
|
}
|
|
112
116
|
});
|
|
113
|
-
|
|
117
|
+
const mainCssFile = await resolvePath(options.mainCssFile, nuxt.options.alias);
|
|
118
|
+
const exists = fs.existsSync(mainCssFile);
|
|
119
|
+
if (exists) {
|
|
120
|
+
nuxt.options.css.push(mainCssFile);
|
|
121
|
+
}
|
|
114
122
|
await installModule("unplugin-icons/nuxt");
|
|
123
|
+
await installModule("reka-ui/nuxt");
|
|
115
124
|
nuxt.options.alias["#witchcraft-ui"] = resolve("runtime");
|
|
116
125
|
nuxt.options.alias["#witchcraft-ui-helpers"] = resolve("runtime/helpers");
|
|
117
126
|
addTypeTemplate({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.v-enter-active,.v-leave-active{transition:opacity .5s ease}.v-enter-from,.v-leave-to{opacity:0}.list-enter-active,.list-leave-active,.list-move{transition:all .5s ease}.list-enter-from,.list-leave-to{opacity:0;transform:translateX(
|
|
1
|
+
.v-enter-active,.v-leave-active{transition:opacity .5s ease}.v-enter-from,.v-leave-to{opacity:0}.list-enter-active,.list-leave-active,.list-move{transition:all .5s ease}.list-enter-from,.list-leave-to{opacity:0;transform:translateX(100%)}.list-leave-active{position:absolute}.list-leave-to,.list-move{pointer-events:none;-webkit-user-select:none;-moz-user-select:none;user-select:none}@keyframes blink{0%{opacity:0}25%{opacity:1}75%{opacity:1}to{opacity:0}}@keyframes slide{0%{background-position:0}to{background-position:100%}}a{@apply link-like}*{@apply styled-scrollbar}textarea{@apply styled-resizer}
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"file-input.compact-choose-file-plural": "Choose Files",
|
|
6
6
|
"file-input.non-compact-choose-file": "Drag & Drop File",
|
|
7
7
|
"file-input.non-compact-choose-file-plural": "Drag & Drop Files",
|
|
8
|
-
"color-
|
|
8
|
+
"color-input.aria-and-title-prefix": "Click to Open Color Picker, Current Color: ",
|
|
9
9
|
"cancel": "Cancel",
|
|
10
10
|
"save": "Save",
|
|
11
11
|
"copy": "Copy",
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"color-picker.aria.value": "Value",
|
|
16
16
|
"color-picker.aria.hue-slider": "Hue Slider",
|
|
17
17
|
"color-picker.aria.alpha-slider": "Alpha Slider",
|
|
18
|
-
"color-picker.aria.description": "Use the arrow keys to move the handle, or use shift to move in 10 pixel increments.",
|
|
18
|
+
"color-picker.aria.description": "Use the arrow keys to move the handle, or use shift to move in 10 pixel increments. Press enter to save value.",
|
|
19
19
|
"dark-mode-switcher.title": "Switch dark mode type, current: ",
|
|
20
20
|
"dark-mode-switcher.system": "System",
|
|
21
21
|
"dark-mode-switcher.dark": "Dark",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
@import "tailwindcss" source("../../");@import "./theme.css";@import "./base.css";@import "./
|
|
1
|
+
@import "tailwindcss" source("../../");@import "./theme.css";@import "./base.css";@import "./utils.css";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@custom-variant dark (&:where(.dark, .dark *));@utility focus-outline-within{@apply outlined-within:outline-2 outlined-within:outline-accent-500 outlined-within:outline-offset-2}@utility focus-outline{@apply outlined:outline-2 outlined:outline-accent-500 outlined:outline-offset-2}@utility focus-outline-no-offset{@apply outlined:outline-2 outlined:outline-accent-500}@utility focus-outline-hidden{@apply outlined:outline-none}@utility bg-squares-gradient{--_square:var(--squareSize,5px);--_double_square:calc(var(--_square)*2);--_light_square:var(--lightSquare,var(--color-white));--_dark_square:var(--darkSquare,var(--color-black));background-color:var(--_light_square);background:repeating-conic-gradient(var(--_dark_square) 0 25%,var(--_light_square) 0 50%) 50% /var(--_double_square) var(--_double_square)}@utility square-light-*{--lightSquare:--value(--color- *)}@utility square-dark-*{--darkSquare:--value(--color- *)}@utility square-size-*{--squareSize:calc(--value(integer) * 1px)}@utility bg-bars-gradient{--_bg_color:var(--bars-bg-color,var(--color-accent-700));--_fg_color:var(--bars-fg-color,var(--color-accent-800));--_angle:var(--bars-angle,45deg);--_fg_width:var(--bars-fg-width,50%);--_bg_width:calc(100% - var(--_fg_width));background-color:var(--_bg_color);--_pos_1:calc(var(--_bg_width)/2);--_pos_2:calc(var(--_bg_width)/2 + var(--_fg_width)/2);--_pos_3:calc(var(--_bg_width) + var(--_fg_width)/2);background-image:repeating-linear-gradient(var(--_angle),var(--_bg_color),var(--_bg_color) var(--_pos_1),var(--_fg_color) var(--_pos_1),var(--_fg_color) var(--_pos_2),var(--_bg_color) var(--_pos_2),var(--_bg_color) var(--_pos_3),var(--_fg_color) var(--_pos_3),var(--_fg_color))}@utility bars-angle-*{--bars-angle:var(--value(integer) * 1deg)}@utility bars-fg-*{--bars-fg-color:--value(--color-*)}@utility bars-bg-*{--bars-bg-color:--value(--color-*)}@utility bars-w-*{--bars-fg-width:calc(--value(integer) * 1%, 50%)}@utility scrollbar-hidden{-ms-overflow-style:none;scrollbar-width:none;&::-webkit-scrollbar{display:none}}@utility styled-scrollbar{--_scrollbar_width:var(--scrollbar-width,calc(var(--spacing)*3));--_scrollbar_border_width:var(--scrollbar-border-width,calc(var(--spacing)/2));--_scrollbar_color:var(--scrollbar-color,--alpha(var(--color-accent-500)/40%));--_scrollbar_hover_color:var(--scrollbar-hover-color,--alpha(var(--color-accent-500)/80%));--_scrollbar_bg_color:var(--scrollbar-bg-color,var(--color-bg));.dark &{--_scrollbar_bg_color:var(--scrollbar-bg-color,var(--color-fg))}&::-webkit-scrollbar{height:var(--_scrollbar_width);width:var(--_scrollbar_width)}&::-webkit-scrollbar-corner,&::-webkit-scrollbar-track{background-color:transparent}&::-webkit-scrollbar-thumb,&::-webkit-scrollbar-track{border-radius:var(--_scrollbar_width)}&::-webkit-scrollbar-thumb{background-color:var(--_scrollbar_color);border:var(--_scrollbar_border_width) solid var(--_scrollbar_bg_color)}&::-webkit-scrollbar-thumb:hover{cursor:pointer}&::-webkit-scrollbar-thumb:active,&::-webkit-scrollbar-thumb:hover{background-color:var(--_scrollbar_hover_color);border-radius:var(--_scrollbar_width)}}@utility styled-scrollbar-w-*{--scrollbar-width:--value(integer)}@utility styled-scrollbar-border-w-*{--scrollbar-border-width:--value(integer)}@utility styled-scrollbar-*{--scrollbar-color:--value(--color-*)}@utility styled-scrollbar-bg-*{--scrollbar-bg-color:--value(--color-*)}@utility styled-resizer{--_resizer_width:var(--resizer-width,8px);--_resizer_color:var(--resizer-color,var(--color-neutral-300));.dark &{--_resizer_color:var(--resizer-color,var(--color-neutral-700))}&::-webkit-resizer{border-bottom-color:var(--_resizer_color);border-left-color:transparent;border-right-color:var(--_resizer_color);border-style:solid;border-top-color:transparent;border-width:var(--_resizer_width)}}@utility styled-resizer-w-*{--resizer-width:--value(integer)}@utility styled-resizer-color-*{--resizer-color:--value(--color-*)}@utility content-vertical-holder{--tw-content:"\200b";content:var(--tw-content)}@utility no-touch-action{touch-action:none}@utility bg-transparency-squares{@apply bg-squares-gradient square-light-white square-dark-neutral-300 square-size-6}@utility link-like{@apply cursor-pointer hover:text-accent-500}
|
|
@@ -2,15 +2,11 @@
|
|
|
2
2
|
<div tabindex="0">{{ value }}</div>
|
|
3
3
|
</template>
|
|
4
4
|
|
|
5
|
-
<script
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
defineProps<{
|
|
11
|
-
// eslint-disable-next-line vue/no-restricted-props
|
|
12
|
-
value: string
|
|
13
|
-
}>()
|
|
5
|
+
<script setup>
|
|
6
|
+
defineOptions({ name: "aria" });
|
|
7
|
+
defineProps({
|
|
8
|
+
value: { type: String, required: true }
|
|
9
|
+
});
|
|
14
10
|
</script>
|
|
15
11
|
|
|
16
12
|
<style scoped>
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
type __VLS_Props = {
|
|
2
|
+
value: string;
|
|
3
|
+
};
|
|
4
|
+
declare const _default: import("vue").DefineComponent<__VLS_Props, void, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
5
|
+
export default _default;
|
|
@@ -1,39 +1,23 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div
|
|
3
|
-
class="icon inline-block"
|
|
4
|
-
v-bind="{...$attrs, class:
|
|
3
|
+
:class="twMerge('icon inline-block', $attrs?.class)"
|
|
4
|
+
v-bind="{ ...$attrs, class: void 0 }"
|
|
5
5
|
>
|
|
6
6
|
<slot/>
|
|
7
7
|
</div>
|
|
8
8
|
</template>
|
|
9
9
|
|
|
10
|
-
<script setup
|
|
11
|
-
import { computed,
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
10
|
+
<script setup>
|
|
11
|
+
import { computed, useAttrs } from "vue";
|
|
12
|
+
import { twMerge } from "../../utils/twMerge.js";
|
|
13
|
+
defineOptions({
|
|
14
|
+
name: "icon",
|
|
15
|
+
inheritAttrs: false
|
|
16
|
+
});
|
|
17
|
+
const $attrs = useAttrs();
|
|
18
|
+
const props = defineProps({});
|
|
19
19
|
</script>
|
|
20
20
|
|
|
21
|
-
<script
|
|
22
|
-
/**
|
|
23
|
-
* Just a very simple wrapper for wrapping unplugin-icons in an inline-block div so the icon in the slot take's up a normal line height when it's alone.
|
|
24
|
-
*
|
|
25
|
-
* ```vue
|
|
26
|
-
* <icon><i-...></icon>
|
|
27
|
-
* ``
|
|
28
|
-
*/
|
|
29
|
-
export default {
|
|
30
|
-
name: "icon",
|
|
31
|
-
}
|
|
21
|
+
<script>
|
|
32
22
|
|
|
33
|
-
interface Props
|
|
34
|
-
extends
|
|
35
|
-
/** @vue-ignore */
|
|
36
|
-
Partial<Omit<HTMLAttributes, "class">
|
|
37
|
-
> { }
|
|
38
23
|
</script>
|
|
39
|
-
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { type HTMLAttributes } from "vue";
|
|
2
|
+
/**
|
|
3
|
+
* Just a very simple wrapper for wrapping unplugin-icons in an inline-block div so the icon in the slot take's up a normal line height when it's alone.
|
|
4
|
+
*
|
|
5
|
+
* ```vue
|
|
6
|
+
* <icon><i-...></icon>
|
|
7
|
+
* ``
|
|
8
|
+
*/
|
|
9
|
+
interface Props extends
|
|
10
|
+
/** @vue-ignore */
|
|
11
|
+
Partial<Omit<HTMLAttributes, "class">> {
|
|
12
|
+
}
|
|
13
|
+
declare const _default: __VLS_WithSlots<import("vue").DefineComponent<Props, void, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, {
|
|
14
|
+
default?: (props: {}) => any;
|
|
15
|
+
}>;
|
|
16
|
+
export default _default;
|
|
17
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
18
|
+
new (): {
|
|
19
|
+
$slots: S;
|
|
20
|
+
};
|
|
21
|
+
};
|