@witchcraft/ui 0.1.2 → 0.2.0
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 +3 -6
- package/dist/module.json +2 -2
- package/dist/module.mjs +15 -12
- package/dist/runtime/assets/utils.css +1 -1
- package/dist/runtime/build/generateTheme.js +1 -1
- package/dist/runtime/components/LibButton/LibButton.vue +10 -17
- package/dist/runtime/components/LibCheckbox/LibCheckbox.vue +8 -13
- package/dist/runtime/components/LibColorPicker/LibColorPicker.vue +5 -4
- package/dist/runtime/components/LibColorPicker/utils/safeConvertToHsva.js +1 -1
- package/dist/runtime/components/LibColorPicker/utils/safeConvertToRgba.js +1 -1
- package/dist/runtime/components/LibDarkModeSwitcher/LibDarkModeSwitcher.vue +5 -15
- package/dist/runtime/components/LibDatePicker/LibRangeDatePicker.vue +5 -0
- package/dist/runtime/components/LibDatePicker/LibSingleDatePicker.vue +5 -0
- package/dist/runtime/components/LibDebug/LibDebug.vue +1 -0
- package/dist/runtime/components/LibFileInput/LibFileInput.vue +3 -0
- package/dist/runtime/components/LibInputDeprecated/LibInputDeprecated.vue +14 -18
- package/dist/runtime/components/LibLabel/LibLabel.vue +9 -14
- package/dist/runtime/components/LibLabel/LibLabel.vue.d.ts +0 -1
- package/dist/runtime/components/LibMultiValues/LibMultiValues.vue +9 -10
- package/dist/runtime/components/LibNotifications/LibNotification.vue +2 -0
- package/dist/runtime/components/LibNotifications/LibNotifications.vue +1 -1
- package/dist/runtime/components/LibPalette/LibPalette.vue +9 -12
- package/dist/runtime/components/LibPopup/LibPopup.vue +2 -2
- package/dist/runtime/components/LibProgressBar/LibProgressBar.vue +10 -15
- package/dist/runtime/components/LibRecorder/LibRecorder.vue +12 -18
- package/dist/runtime/components/LibRoot/LibRoot.vue +3 -2
- package/dist/runtime/components/LibSimpleInput/LibSimpleInput.vue +12 -19
- package/dist/runtime/components/LibSuggestions/LibSuggestions.vue +10 -15
- package/dist/runtime/components/LibTable/LibTable.vue +2 -2
- package/dist/runtime/components/Template/NAME.vue +2 -2
- package/dist/runtime/components/shared/props.d.ts +0 -29
- package/dist/runtime/components/shared/props.js +0 -12
- package/dist/runtime/composables/useAccesibilityOutline.js +1 -1
- package/dist/runtime/composables/useDivideAttrs.js +1 -1
- package/dist/runtime/composables/useSuggestions.js +4 -4
- package/dist/runtime/directives/vDetectFlex.js +4 -4
- package/dist/runtime/directives/vExtractRootEl.d.ts +1 -1
- package/dist/runtime/directives/vResizableCols.d.ts +1 -1
- package/dist/runtime/directives/vResizableCols.js +4 -4
- package/dist/runtime/helpers/NotificationHandler.js +6 -6
- package/dist/runtime/helpers/base64ToImg.js +2 -2
- package/dist/runtime/nuxt/plugins/vue-plugin.js +1 -1
- package/dist/runtime/tailwind/themeConvertionOpts.d.ts +1 -1
- package/dist/runtime/theme.d.ts +1 -1
- package/dist/runtime/theme.js +1 -1
- package/dist/runtime/utils/notifyIfError.js +1 -1
- package/dist/runtime/vue/registerComponents.js +1 -1
- package/package.json +68 -89
- package/src/module.ts +19 -12
- package/src/runtime/assets/utils.css +5 -5
- package/src/runtime/build/generateTheme.ts +1 -1
- package/src/runtime/components/LibButton/LibButton.stories.ts +1 -1
- package/src/runtime/components/LibButton/LibButton.vue +4 -8
- package/src/runtime/components/LibCheckbox/LibCheckbox.vue +3 -7
- package/src/runtime/components/LibColorPicker/LibColorPicker.vue +6 -4
- package/src/runtime/components/LibColorPicker/utils/safeConvertToHsva.ts +1 -1
- package/src/runtime/components/LibColorPicker/utils/safeConvertToRgba.ts +1 -1
- package/src/runtime/components/LibDarkModeSwitcher/LibDarkModeSwitcher.vue +8 -15
- package/src/runtime/components/LibDatePicker/LibRangeDatePicker.vue +6 -0
- package/src/runtime/components/LibDatePicker/LibSingleDatePicker.vue +6 -0
- package/src/runtime/components/LibDebug/LibDebug.stories.ts +1 -1
- package/src/runtime/components/LibDebug/LibDebug.vue +2 -0
- package/src/runtime/components/LibFileInput/LibFileInput.vue +4 -0
- package/src/runtime/components/LibInputDeprecated/LibInputDeprecated.vue +7 -5
- package/src/runtime/components/LibLabel/LibLabel.vue +2 -3
- package/src/runtime/components/LibMultiValues/LibMultiValues.vue +5 -3
- package/src/runtime/components/LibNotifications/LibNotification.vue +3 -0
- package/src/runtime/components/LibNotifications/LibNotifications.vue +1 -1
- package/src/runtime/components/LibPalette/LibPalette.vue +3 -3
- package/src/runtime/components/LibPopup/LibPopup.vue +2 -2
- package/src/runtime/components/LibProgressBar/LibProgressBar.vue +2 -2
- package/src/runtime/components/LibRecorder/LibRecorder.vue +3 -3
- package/src/runtime/components/LibRoot/LibRoot.vue +3 -2
- package/src/runtime/components/LibSimpleInput/LibSimpleInput.vue +2 -2
- package/src/runtime/components/LibSuggestions/LibSuggestions.vue +2 -2
- package/src/runtime/components/LibTable/LibTable.vue +1 -1
- package/src/runtime/components/Template/NAME.vue +2 -2
- package/src/runtime/components/shared/props.ts +8 -12
- package/src/runtime/composables/useAccesibilityOutline.ts +1 -1
- package/src/runtime/composables/useDivideAttrs.ts +1 -1
- package/src/runtime/composables/useSuggestions.ts +4 -4
- package/src/runtime/directives/vDetectFlex.ts +4 -4
- package/src/runtime/directives/vExtractRootEl.ts +1 -1
- package/src/runtime/directives/vResizableCols.ts +5 -5
- package/src/runtime/helpers/NotificationHandler.ts +6 -6
- package/src/runtime/nuxt/plugins/vue-plugin.ts +1 -1
- package/src/runtime/tailwind/themeConvertionOpts.ts +1 -1
- package/src/runtime/theme.ts +2 -2
- package/src/runtime/utils/notifyIfError.ts +1 -1
- package/src/runtime/vue/registerComponents.ts +1 -1
|
@@ -34,14 +34,15 @@
|
|
|
34
34
|
)"
|
|
35
35
|
>
|
|
36
36
|
<TestControls v-if="testWrapperMode" :show-outline="showOutline"/>
|
|
37
|
-
|
|
37
|
+
<!-- @vue-expect-error data-allow-mismatch is for vue/nuxt to allow the hydration mismatch-->
|
|
38
|
+
<Notifications v-if="useNotifications && isClientSide" data-allow-mismatch/>
|
|
38
39
|
<slot/>
|
|
39
40
|
</div>
|
|
40
41
|
</div>
|
|
41
42
|
</template>
|
|
42
43
|
|
|
43
44
|
<script setup>
|
|
44
|
-
import { unreachable } from "@alanscodelog/utils/unreachable
|
|
45
|
+
import { unreachable } from "@alanscodelog/utils/unreachable";
|
|
45
46
|
import {} from "metamorphosis";
|
|
46
47
|
import { computed, onBeforeUnmount, onMounted, ref, toRaw } from "vue";
|
|
47
48
|
import { useAccesibilityOutline } from "../../composables/useAccesibilityOutline.js";
|
|
@@ -76,30 +76,23 @@ import { useAriaLabel } from "../../composables/useAriaLabel.js";
|
|
|
76
76
|
import { usePreHydrationValue } from "../../composables/usePreHydrationValue.js";
|
|
77
77
|
import { hasModifiers } from "../../helpers/hasModifiers.js";
|
|
78
78
|
import { twMerge } from "../../utils/twMerge.js";
|
|
79
|
-
import {
|
|
79
|
+
import { getFallbackId } from "../shared/props.js";
|
|
80
80
|
defineOptions({
|
|
81
81
|
name: "lib-simple-input",
|
|
82
82
|
inheritAttrs: false
|
|
83
83
|
});
|
|
84
84
|
const fallbackId = getFallbackId();
|
|
85
|
-
const props = defineProps(
|
|
86
|
-
id: { type: String, required: false },
|
|
87
|
-
label: { type: String, required: false },
|
|
88
|
-
disabled: { type: Boolean, required: false },
|
|
89
|
-
readonly: { type: Boolean, required: false },
|
|
90
|
-
border: { type: Boolean, required: false },
|
|
91
|
-
unstyle: { type: Boolean, required: false },
|
|
92
|
-
placeholder: { type: null, required: false },
|
|
93
|
-
type: { type: null, required: false },
|
|
94
|
-
valid: { type: Boolean, required: false }
|
|
95
|
-
}
|
|
96
|
-
id: "",
|
|
97
|
-
placeholder: "",
|
|
98
|
-
valid: true,
|
|
99
|
-
label: "",
|
|
100
|
-
type: void 0,
|
|
101
|
-
...baseInteractivePropsDefaults
|
|
102
|
-
}));
|
|
85
|
+
const props = defineProps({
|
|
86
|
+
id: { type: String, required: false, default: "" },
|
|
87
|
+
label: { type: String, required: false, default: "" },
|
|
88
|
+
disabled: { type: Boolean, required: false, default: false },
|
|
89
|
+
readonly: { type: Boolean, required: false, default: false },
|
|
90
|
+
border: { type: Boolean, required: false, default: true },
|
|
91
|
+
unstyle: { type: Boolean, required: false, default: false },
|
|
92
|
+
placeholder: { type: null, required: false, default: "" },
|
|
93
|
+
type: { type: null, required: false, default: void 0 },
|
|
94
|
+
valid: { type: Boolean, required: false, default: true }
|
|
95
|
+
});
|
|
103
96
|
const modelValue = defineModel({ type: null, ...{ required: true } });
|
|
104
97
|
const emit = defineEmits(["submit", "input"]);
|
|
105
98
|
const $attrs = useAttrs();
|
|
@@ -66,7 +66,7 @@ import { useSuggestions } from "../../composables/useSuggestions.js";
|
|
|
66
66
|
import { hasModifiers } from "../../helpers/hasModifiers.js";
|
|
67
67
|
import { twMerge } from "../../utils/twMerge.js";
|
|
68
68
|
import LibCheckbox from "../LibCheckbox/LibCheckbox.vue";
|
|
69
|
-
import {
|
|
69
|
+
import { getFallbackId } from "../shared/props.js";
|
|
70
70
|
defineOptions({
|
|
71
71
|
name: "lib-suggestions",
|
|
72
72
|
inheritAttrs: false
|
|
@@ -74,14 +74,14 @@ defineOptions({
|
|
|
74
74
|
const $ = useDivideAttrs(["item"]);
|
|
75
75
|
const emits = defineEmits(["submit", "update:isOpen", "update:activeSuggestion"]);
|
|
76
76
|
const fallbackId = getFallbackId();
|
|
77
|
-
const props = defineProps(
|
|
77
|
+
const props = defineProps({
|
|
78
78
|
id: { type: String, required: false },
|
|
79
79
|
label: { type: String, required: false },
|
|
80
|
-
disabled: { type: Boolean, required: false },
|
|
81
|
-
readonly: { type: Boolean, required: false },
|
|
82
|
-
border: { type: Boolean, required: false },
|
|
83
|
-
unstyle: { type: Boolean, required: false },
|
|
84
|
-
filterKeydown: { type: Function, required: false },
|
|
80
|
+
disabled: { type: Boolean, required: false, default: false },
|
|
81
|
+
readonly: { type: Boolean, required: false, default: false },
|
|
82
|
+
border: { type: Boolean, required: false, default: true },
|
|
83
|
+
unstyle: { type: Boolean, required: false, default: false },
|
|
84
|
+
filterKeydown: { type: Function, required: false, default: void 0 },
|
|
85
85
|
filterBlur: { type: Function, required: false },
|
|
86
86
|
filterFocus: { type: Function, required: false },
|
|
87
87
|
suggestions: { type: Array, required: false },
|
|
@@ -90,17 +90,12 @@ const props = defineProps(/* @__PURE__ */ _mergeDefaults({
|
|
|
90
90
|
updateOnlyOnSubmit: { type: Boolean, required: false },
|
|
91
91
|
suggestionsFilter: { type: Function, required: false },
|
|
92
92
|
allowOpenEmpty: { type: Boolean, required: false },
|
|
93
|
-
canOpen: { type: Boolean, required: false },
|
|
93
|
+
canOpen: { type: Boolean, required: false, default: true },
|
|
94
94
|
canClose: { type: Boolean, required: false },
|
|
95
|
-
isValid: { type: Boolean, required: false },
|
|
95
|
+
isValid: { type: Boolean, required: false, default: true },
|
|
96
96
|
suggestionSelector: { type: Function, required: false },
|
|
97
97
|
showSelectedValues: { type: Boolean, required: false }
|
|
98
|
-
}
|
|
99
|
-
isValid: true,
|
|
100
|
-
canOpen: true,
|
|
101
|
-
filterKeydown: void 0,
|
|
102
|
-
...baseInteractivePropsDefaults
|
|
103
|
-
}));
|
|
98
|
+
});
|
|
104
99
|
const $modelValue = defineModel("modelValue", { type: null, ...{ required: true } });
|
|
105
100
|
const $inputValue = defineModel("inputValue", { type: String, ...{ default: "" } });
|
|
106
101
|
const $open = defineModel("open", { type: Boolean, ...{ default: false } });
|
|
@@ -89,7 +89,7 @@
|
|
|
89
89
|
</template>
|
|
90
90
|
|
|
91
91
|
<script setup>
|
|
92
|
-
import { keys } from "@alanscodelog/utils/keys
|
|
92
|
+
import { keys } from "@alanscodelog/utils/keys";
|
|
93
93
|
import { computed, ref } from "vue";
|
|
94
94
|
import { vResizableCols } from "../../directives/vResizableCols.js";
|
|
95
95
|
import { twMerge } from "../../utils/twMerge.js";
|
|
@@ -105,7 +105,7 @@ const props = defineProps({
|
|
|
105
105
|
border: { type: Boolean, required: false, default: true },
|
|
106
106
|
cellBorder: { type: Boolean, required: false, default: true },
|
|
107
107
|
header: { type: Boolean, required: false, default: true },
|
|
108
|
-
colConfig: { type:
|
|
108
|
+
colConfig: { type: Object, required: false, default: () => ({}) }
|
|
109
109
|
});
|
|
110
110
|
const widths = ref([]);
|
|
111
111
|
const resizableOptions = computed(() => ({
|
|
@@ -9,9 +9,9 @@
|
|
|
9
9
|
</template>
|
|
10
10
|
|
|
11
11
|
<script setup>
|
|
12
|
-
import {
|
|
12
|
+
import { ref } from "vue";
|
|
13
13
|
import { twMerge } from "../../utils/twMerge.js";
|
|
14
|
-
import {
|
|
14
|
+
import {} from "../shared/props.js";
|
|
15
15
|
defineOptions({
|
|
16
16
|
name: "lib-name",
|
|
17
17
|
/* todo */
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { type PropType } from "vue";
|
|
2
1
|
import type { PopupPositioner, PopupPositionModifier } from "../../types/index.js";
|
|
3
2
|
export interface LinkableByIdProps {
|
|
4
3
|
/**
|
|
@@ -145,28 +144,6 @@ export interface PopupProps {
|
|
|
145
144
|
modifyPosition?: PopupPositionModifier;
|
|
146
145
|
canClose?: boolean;
|
|
147
146
|
}
|
|
148
|
-
export declare const baseInteractiveProps: {
|
|
149
|
-
readonly unstyle: {
|
|
150
|
-
readonly type: PropType<boolean>;
|
|
151
|
-
readonly required: false;
|
|
152
|
-
readonly default: false;
|
|
153
|
-
};
|
|
154
|
-
readonly disabled: {
|
|
155
|
-
readonly type: PropType<boolean>;
|
|
156
|
-
readonly required: false;
|
|
157
|
-
readonly default: false;
|
|
158
|
-
};
|
|
159
|
-
readonly readonly: {
|
|
160
|
-
readonly type: PropType<boolean>;
|
|
161
|
-
readonly required: false;
|
|
162
|
-
readonly default: false;
|
|
163
|
-
};
|
|
164
|
-
readonly border: {
|
|
165
|
-
readonly type: PropType<boolean>;
|
|
166
|
-
readonly required: false;
|
|
167
|
-
readonly default: true;
|
|
168
|
-
};
|
|
169
|
-
};
|
|
170
147
|
export type BaseInteractiveProps = {
|
|
171
148
|
/** Default is false. */
|
|
172
149
|
disabled?: boolean;
|
|
@@ -177,12 +154,6 @@ export type BaseInteractiveProps = {
|
|
|
177
154
|
/** Removes styles from the component. Default is false. */
|
|
178
155
|
unstyle?: boolean;
|
|
179
156
|
};
|
|
180
|
-
export declare const baseInteractivePropsDefaults: {
|
|
181
|
-
disabled: boolean;
|
|
182
|
-
readonly: boolean;
|
|
183
|
-
border: boolean;
|
|
184
|
-
unstyle: boolean;
|
|
185
|
-
};
|
|
186
157
|
/**
|
|
187
158
|
* @internal
|
|
188
159
|
* For easily typing attributes created by useDivideAttrs. See readme.
|
|
@@ -1,14 +1,2 @@
|
|
|
1
1
|
import { useId } from "vue";
|
|
2
2
|
export const getFallbackId = () => useId();
|
|
3
|
-
export const baseInteractiveProps = {
|
|
4
|
-
unstyle: { type: Boolean, required: false, default: false },
|
|
5
|
-
disabled: { type: Boolean, required: false, default: false },
|
|
6
|
-
readonly: { type: Boolean, required: false, default: false },
|
|
7
|
-
border: { type: Boolean, required: false, default: true }
|
|
8
|
-
};
|
|
9
|
-
export const baseInteractivePropsDefaults = {
|
|
10
|
-
disabled: false,
|
|
11
|
-
readonly: false,
|
|
12
|
-
border: true,
|
|
13
|
-
unstyle: false
|
|
14
|
-
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { castType } from "@alanscodelog/utils/castType
|
|
1
|
+
import { castType } from "@alanscodelog/utils/castType";
|
|
2
2
|
import { onBeforeUnmount, onMounted, ref, watch } from "vue";
|
|
3
3
|
export function useAccesibilityOutline(target, enable = ref(true)) {
|
|
4
4
|
const outline = ref(false);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { isBlank } from "@alanscodelog/utils/isBlank
|
|
2
|
-
import { isObject } from "@alanscodelog/utils/isObject
|
|
3
|
-
import { pushIfNotIn } from "@alanscodelog/utils/pushIfNotIn
|
|
4
|
-
import { removeIfIn } from "@alanscodelog/utils/removeIfIn
|
|
1
|
+
import { isBlank } from "@alanscodelog/utils/isBlank";
|
|
2
|
+
import { isObject } from "@alanscodelog/utils/isObject";
|
|
3
|
+
import { pushIfNotIn } from "@alanscodelog/utils/pushIfNotIn";
|
|
4
|
+
import { removeIfIn } from "@alanscodelog/utils/removeIfIn";
|
|
5
5
|
import { computed, ref, toRaw, watch } from "vue";
|
|
6
6
|
export function useSuggestions($inputValue, $modelValue, $open, emit, opts, debug = false) {
|
|
7
7
|
if (typeof opts.suggestions?.[0] === "object" && !opts.suggestionLabel && !opts.suggestionsFilter) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { castType } from "@alanscodelog/utils/castType
|
|
2
|
-
import { last } from "@alanscodelog/utils/last
|
|
3
|
-
import { throttle } from "@alanscodelog/utils/throttle
|
|
4
|
-
import { unreachable } from "@alanscodelog/utils/unreachable
|
|
1
|
+
import { castType } from "@alanscodelog/utils/castType";
|
|
2
|
+
import { last } from "@alanscodelog/utils/last";
|
|
3
|
+
import { throttle } from "@alanscodelog/utils/throttle";
|
|
4
|
+
import { unreachable } from "@alanscodelog/utils/unreachable";
|
|
5
5
|
import { globalResizeObserver } from "../globalResizeObserver.js";
|
|
6
6
|
const observer = globalResizeObserver;
|
|
7
7
|
const callbacks = {};
|
|
@@ -8,7 +8,7 @@ import type { Directive } from "vue";
|
|
|
8
8
|
*
|
|
9
9
|
* One can create a ref:
|
|
10
10
|
* ```ts
|
|
11
|
-
* import { vExtractRootEl } from "@witchcraft/ui/directives/vExtractRootEl
|
|
11
|
+
* import { vExtractRootEl } from "@witchcraft/ui/directives/vExtractRootEl"
|
|
12
12
|
* const el = ref<HTMLElement|null>(null)
|
|
13
13
|
*
|
|
14
14
|
* ```
|
|
@@ -9,7 +9,7 @@ import type { Directive } from "vue";
|
|
|
9
9
|
* </div>
|
|
10
10
|
* </template>
|
|
11
11
|
* <script setup>
|
|
12
|
-
* import {vResizeCols} from "@witchcraft/ui/directives/vResizableCols
|
|
12
|
+
* import {vResizeCols} from "@witchcraft/ui/directives/vResizableCols"
|
|
13
13
|
* </script>
|
|
14
14
|
* ```
|
|
15
15
|
*
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { castType } from "@alanscodelog/utils/castType
|
|
2
|
-
import { override } from "@alanscodelog/utils/override
|
|
3
|
-
import { throttle } from "@alanscodelog/utils/throttle
|
|
4
|
-
import { unreachable } from "@alanscodelog/utils/unreachable
|
|
1
|
+
import { castType } from "@alanscodelog/utils/castType";
|
|
2
|
+
import { override } from "@alanscodelog/utils/override";
|
|
3
|
+
import { throttle } from "@alanscodelog/utils/throttle";
|
|
4
|
+
import { unreachable } from "@alanscodelog/utils/unreachable";
|
|
5
5
|
import { globalResizeObserver } from "../globalResizeObserver.js";
|
|
6
6
|
const observer = globalResizeObserver;
|
|
7
7
|
const elMap = /* @__PURE__ */ new WeakMap();
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { castType } from "@alanscodelog/utils/castType
|
|
2
|
-
import { crop } from "@alanscodelog/utils/crop
|
|
3
|
-
import { indent } from "@alanscodelog/utils/indent
|
|
4
|
-
import { isBlank } from "@alanscodelog/utils/isBlank
|
|
5
|
-
import { pretty } from "@alanscodelog/utils/pretty
|
|
6
|
-
import { setReadOnly } from "@alanscodelog/utils/setReadOnly
|
|
1
|
+
import { castType } from "@alanscodelog/utils/castType";
|
|
2
|
+
import { crop } from "@alanscodelog/utils/crop";
|
|
3
|
+
import { indent } from "@alanscodelog/utils/indent";
|
|
4
|
+
import { isBlank } from "@alanscodelog/utils/isBlank";
|
|
5
|
+
import { pretty } from "@alanscodelog/utils/pretty";
|
|
6
|
+
import { setReadOnly } from "@alanscodelog/utils/setReadOnly";
|
|
7
7
|
export class NotificationHandler {
|
|
8
8
|
timeout = 5e3;
|
|
9
9
|
debug = false;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
export const base64ToImg = async (imageSrc) => {
|
|
2
2
|
const img = new Image();
|
|
3
|
-
const loaded = new Promise((resolve) => {
|
|
3
|
+
const loaded = new Promise(((resolve) => {
|
|
4
4
|
img.addEventListener("load", () => {
|
|
5
5
|
resolve(img);
|
|
6
6
|
});
|
|
7
|
-
});
|
|
7
|
+
}));
|
|
8
8
|
img.src = imageSrc;
|
|
9
9
|
await loaded;
|
|
10
10
|
return img;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { isArray } from "@alanscodelog/utils/isArray
|
|
1
|
+
import { isArray } from "@alanscodelog/utils/isArray";
|
|
2
2
|
import { defineNuxtPlugin, useRuntimeConfig } from "#imports";
|
|
3
3
|
import { registerDirectives } from "../../vue/registerDirectives.js";
|
|
4
4
|
export default defineNuxtPlugin({
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { type themeAsTailwindCss } from "metamorphosis/tailwind
|
|
1
|
+
import { type themeAsTailwindCss } from "metamorphosis/tailwind";
|
|
2
2
|
export declare const themeConvertionOpts: Parameters<typeof themeAsTailwindCss>[1];
|
package/dist/runtime/theme.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { Theme } from "metamorphosis/Theme
|
|
1
|
+
import type { Theme } from "metamorphosis/Theme";
|
|
2
2
|
export declare const theme: Theme;
|
package/dist/runtime/theme.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { baseTheme } from "metamorphosis/BaseTheme
|
|
1
|
+
import { baseTheme } from "metamorphosis/BaseTheme";
|
|
2
2
|
export const theme = baseTheme;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { capitalize } from "@alanscodelog/utils/capitalize
|
|
1
|
+
import { capitalize } from "@alanscodelog/utils/capitalize";
|
|
2
2
|
export const registerComponents = (app, components, prefix = "") => {
|
|
3
3
|
for (const key of Object.keys(components)) {
|
|
4
4
|
const component = components[key];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@witchcraft/ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Vue component library.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/runtime/main.lib.js",
|
|
@@ -10,10 +10,6 @@
|
|
|
10
10
|
"types": "./types/index.d.ts",
|
|
11
11
|
"import": "./dist/runtime/main.lib.js"
|
|
12
12
|
},
|
|
13
|
-
"./*": {
|
|
14
|
-
"import": "./dist/runtime/*",
|
|
15
|
-
"types": "./dist/runtime/*.d.ts"
|
|
16
|
-
},
|
|
17
13
|
"./components": {
|
|
18
14
|
"types": "./dist/runtime/components/index.d.ts",
|
|
19
15
|
"import": "./dist/runtime/components/index.js"
|
|
@@ -22,10 +18,6 @@
|
|
|
22
18
|
"types": "./dist/runtime/components/*/*.vue.d.ts",
|
|
23
19
|
"import": "./dist/runtime/components/*/*.vue"
|
|
24
20
|
},
|
|
25
|
-
"./composables/*": {
|
|
26
|
-
"types": "./dist/runtime/composables/*",
|
|
27
|
-
"import": "./dist/runtime/composables/*"
|
|
28
|
-
},
|
|
29
21
|
"./composables": {
|
|
30
22
|
"types": "./dist/runtime/composables/index.d.ts",
|
|
31
23
|
"import": "./dist/runtime/composables/index.js"
|
|
@@ -34,22 +26,10 @@
|
|
|
34
26
|
"types": "./dist/runtime/directives/index.d.ts",
|
|
35
27
|
"import": "./dist/runtime/directives/index.js"
|
|
36
28
|
},
|
|
37
|
-
"./directives/*": {
|
|
38
|
-
"types": "./dist/runtime/directives/*",
|
|
39
|
-
"import": "./dist/runtime/directives/*"
|
|
40
|
-
},
|
|
41
29
|
"./helpers": {
|
|
42
30
|
"types": "./dist/runtime/helpers/index.d.ts",
|
|
43
31
|
"import": "./dist/runtime/helpers/index.js"
|
|
44
32
|
},
|
|
45
|
-
"./helpers/*": {
|
|
46
|
-
"types": "./dist/runtime/helpers/*",
|
|
47
|
-
"import": "./dist/runtime/helpers/*"
|
|
48
|
-
},
|
|
49
|
-
"./build/*": {
|
|
50
|
-
"types": "./dist/runtime/build/*.d.ts",
|
|
51
|
-
"import": "./dist/runtime/build/*"
|
|
52
|
-
},
|
|
53
33
|
"./utils.css": "./src/runtime/assets/utils.css",
|
|
54
34
|
"./base.css": "./src/runtime/assets/base.css",
|
|
55
35
|
"./nuxt": {
|
|
@@ -59,6 +39,10 @@
|
|
|
59
39
|
"./types": {
|
|
60
40
|
"types": "./dist/runtime/types/index.d.ts",
|
|
61
41
|
"import": "./dist/runtime/types/index.js"
|
|
42
|
+
},
|
|
43
|
+
"./*": {
|
|
44
|
+
"import": "./dist/runtime/*.js",
|
|
45
|
+
"types": "./dist/runtime/*.d.ts"
|
|
62
46
|
}
|
|
63
47
|
},
|
|
64
48
|
"unbuild": {
|
|
@@ -67,6 +51,7 @@
|
|
|
67
51
|
"scripts": {
|
|
68
52
|
"prepare": "husky && pnpm gen:theme && cd playground && pnpm i",
|
|
69
53
|
"build": "nuxt-module-build prepare && nuxt-module-build build && nuxi generate playground",
|
|
54
|
+
"build:only": "nuxt-module-build build",
|
|
70
55
|
"dev:prepare": "nuxt-module-build build --stub && nuxt-module-build prepare && nuxi prepare playground",
|
|
71
56
|
"dev": "nuxi dev playground",
|
|
72
57
|
"storybook": "BROWSER=none storybook dev -p 6006",
|
|
@@ -87,10 +72,10 @@
|
|
|
87
72
|
"gen:theme": "echo src/runtime/build/generateTheme.ts"
|
|
88
73
|
},
|
|
89
74
|
"peerDependencies": {
|
|
75
|
+
"@iconify/json": "^2.2.323",
|
|
90
76
|
"tailwindcss": "^4.0.17",
|
|
91
|
-
"vue": "^3.2.47",
|
|
92
77
|
"unplugin-icons": "^22.1.0",
|
|
93
|
-
"
|
|
78
|
+
"vue": "^3.2.47"
|
|
94
79
|
},
|
|
95
80
|
"peerDependenciesMeta": {
|
|
96
81
|
"tailwindcss": {
|
|
@@ -101,83 +86,82 @@
|
|
|
101
86
|
}
|
|
102
87
|
},
|
|
103
88
|
"dependencies": {
|
|
104
|
-
"@alanscodelog/utils": "^
|
|
89
|
+
"@alanscodelog/utils": "^6.0.1",
|
|
105
90
|
"@egoist/vue-to-react": "^1.2.0",
|
|
106
|
-
"@iconify/json": "^2.2.
|
|
107
|
-
"@nuxt/kit": "^4.0.
|
|
108
|
-
"@nuxt/schema": "^4.0.
|
|
109
|
-
"@nuxt/types": "^2.
|
|
110
|
-
"@tailwindcss/vite": "^4.1.
|
|
111
|
-
"@witchcraft/nuxt-utils": "^0.
|
|
91
|
+
"@iconify/json": "^2.2.378",
|
|
92
|
+
"@nuxt/kit": "^4.0.3",
|
|
93
|
+
"@nuxt/schema": "^4.0.3",
|
|
94
|
+
"@nuxt/types": "^2.18.1",
|
|
95
|
+
"@tailwindcss/vite": "^4.1.12",
|
|
96
|
+
"@witchcraft/nuxt-utils": "^0.2.0",
|
|
112
97
|
"colord": "^2.9.3",
|
|
113
98
|
"colorjs.io": "0.6.0-alpha.1",
|
|
114
99
|
"defu": "^6.1.4",
|
|
115
|
-
"fast-glob": "^3.3.
|
|
116
|
-
"metamorphosis": "^0.
|
|
117
|
-
"reka-ui": "^2.
|
|
118
|
-
"tailwind-merge": "^3.1
|
|
119
|
-
"unplugin-icons": "^22.
|
|
120
|
-
"unplugin-vue-components": "^28.
|
|
121
|
-
"vue-component-type-helpers": "^2.
|
|
100
|
+
"fast-glob": "^3.3.3",
|
|
101
|
+
"metamorphosis": "^0.6.0",
|
|
102
|
+
"reka-ui": "^2.5.0",
|
|
103
|
+
"tailwind-merge": "^3.3.1",
|
|
104
|
+
"unplugin-icons": "^22.2.0",
|
|
105
|
+
"unplugin-vue-components": "^28.8.0",
|
|
106
|
+
"vue-component-type-helpers": "^2.2.12"
|
|
122
107
|
},
|
|
123
108
|
"devDependencies": {
|
|
124
|
-
"@alanscodelog/commitlint-config": "^3.
|
|
125
|
-
"@alanscodelog/eslint-config": "^5.0.
|
|
109
|
+
"@alanscodelog/commitlint-config": "^3.1.2",
|
|
110
|
+
"@alanscodelog/eslint-config": "^5.0.4",
|
|
126
111
|
"@alanscodelog/semantic-release-config": "^5.0.4",
|
|
127
|
-
"@alanscodelog/tsconfigs": "^6.
|
|
112
|
+
"@alanscodelog/tsconfigs": "^6.1.0",
|
|
128
113
|
"@alanscodelog/vite-config": "^0.0.5",
|
|
129
|
-
"@chromatic-com/storybook": "^3.2.
|
|
130
|
-
"@commitlint/cli": "^19.
|
|
131
|
-
"@internationalized/date": "^3.
|
|
132
|
-
"@nuxt/eslint-config": "^1.
|
|
114
|
+
"@chromatic-com/storybook": "^3.2.7",
|
|
115
|
+
"@commitlint/cli": "^19.8.1",
|
|
116
|
+
"@internationalized/date": "^3.9.0",
|
|
117
|
+
"@nuxt/eslint-config": "^1.9.0",
|
|
133
118
|
"@nuxt/module-builder": "^1.0.2",
|
|
134
|
-
"@nuxtjs/i18n": "^9.5.
|
|
135
|
-
"@playwright/test": "
|
|
119
|
+
"@nuxtjs/i18n": "^9.5.6",
|
|
120
|
+
"@playwright/test": "^1.50.0",
|
|
136
121
|
"@rollup/plugin-node-resolve": "^16.0.1",
|
|
137
|
-
"@storybook/addon-a11y": "^8.6.
|
|
138
|
-
"@storybook/addon-actions": "^8.6.
|
|
139
|
-
"@storybook/addon-essentials": "^8.6.
|
|
140
|
-
"@storybook/addon-interactions": "^8.6.
|
|
141
|
-
"@storybook/addon-links": "^8.6.
|
|
142
|
-
"@storybook/addon-storysource": "^8.6.
|
|
143
|
-
"@storybook/blocks": "^8.6.
|
|
144
|
-
"@storybook/manager-api": "^8.6.
|
|
145
|
-
"@storybook/test": "^8.6.
|
|
146
|
-
"@storybook/test-runner": "^0.22.
|
|
147
|
-
"@storybook/vue3": "^8.6.
|
|
148
|
-
"@storybook/vue3-vite": "^8.6.
|
|
149
|
-
"@tailwindcss/cli": "^4.1.
|
|
150
|
-
"@tailwindcss/postcss": "^4.1.
|
|
151
|
-
"@types/node": "^24.
|
|
152
|
-
"@vitejs/plugin-vue": "^6.0.
|
|
153
|
-
"@vue/runtime-core": "^3.
|
|
154
|
-
"@vue/runtime-dom": "^3.
|
|
155
|
-
"@vueuse/components": "^13.
|
|
156
|
-
"@vueuse/core": "^13.
|
|
157
|
-
"autoprefixer": "^10.4.
|
|
158
|
-
"concurrently": "^9.1
|
|
159
|
-
"eslint": "^9.
|
|
160
|
-
"eslint-plugin-jsdoc": "^48.
|
|
122
|
+
"@storybook/addon-a11y": "^8.6.14",
|
|
123
|
+
"@storybook/addon-actions": "^8.6.14",
|
|
124
|
+
"@storybook/addon-essentials": "^8.6.14",
|
|
125
|
+
"@storybook/addon-interactions": "^8.6.14",
|
|
126
|
+
"@storybook/addon-links": "^8.6.14",
|
|
127
|
+
"@storybook/addon-storysource": "^8.6.14",
|
|
128
|
+
"@storybook/blocks": "^8.6.14",
|
|
129
|
+
"@storybook/manager-api": "^8.6.14",
|
|
130
|
+
"@storybook/test": "^8.6.14",
|
|
131
|
+
"@storybook/test-runner": "^0.22.1",
|
|
132
|
+
"@storybook/vue3": "^8.6.14",
|
|
133
|
+
"@storybook/vue3-vite": "^8.6.14",
|
|
134
|
+
"@tailwindcss/cli": "^4.1.12",
|
|
135
|
+
"@tailwindcss/postcss": "^4.1.12",
|
|
136
|
+
"@types/node": "^24.3.0",
|
|
137
|
+
"@vitejs/plugin-vue": "^6.0.1",
|
|
138
|
+
"@vue/runtime-core": "^3.5.20",
|
|
139
|
+
"@vue/runtime-dom": "^3.5.20",
|
|
140
|
+
"@vueuse/components": "^13.8.0",
|
|
141
|
+
"@vueuse/core": "^13.8.0",
|
|
142
|
+
"autoprefixer": "^10.4.21",
|
|
143
|
+
"concurrently": "^9.2.1",
|
|
144
|
+
"eslint": "^9.34.0",
|
|
145
|
+
"eslint-plugin-jsdoc": "^48.11.0",
|
|
161
146
|
"http-server": "^14.1.1",
|
|
162
|
-
"husky": "^9.
|
|
147
|
+
"husky": "^9.1.7",
|
|
163
148
|
"indexit": "2.1.0-beta.3",
|
|
164
149
|
"madge": "^7.0.0",
|
|
165
|
-
"nuxt": "^4.0.
|
|
166
|
-
"playwright": "
|
|
167
|
-
"playwright-core": "
|
|
168
|
-
"semantic-release": "^24.
|
|
169
|
-
"storybook": "^8.6.
|
|
150
|
+
"nuxt": "^4.0.3",
|
|
151
|
+
"playwright": "^1.50.0",
|
|
152
|
+
"playwright-core": "^1.50.0",
|
|
153
|
+
"semantic-release": "^24.2.7",
|
|
154
|
+
"storybook": "^8.6.14",
|
|
170
155
|
"storybook-dark-mode": "^4.0.2",
|
|
171
|
-
"tailwindcss": "^4.1.
|
|
156
|
+
"tailwindcss": "^4.1.12",
|
|
172
157
|
"ts-node": "^10.9.2",
|
|
173
|
-
"typescript": "~5.8.
|
|
174
|
-
"unbuild": "^3.
|
|
175
|
-
"vite": "^7.
|
|
176
|
-
"vite-
|
|
177
|
-
"
|
|
178
|
-
"vue": "^3.5.13",
|
|
158
|
+
"typescript": "~5.8.3",
|
|
159
|
+
"unbuild": "^3.6.1",
|
|
160
|
+
"vite": "^7.1.3",
|
|
161
|
+
"vite-tsconfig-paths": "^5.1.4",
|
|
162
|
+
"vue": "^3.5.20",
|
|
179
163
|
"vue-tsc": "3.0.4",
|
|
180
|
-
"wait-on": "^8.0.
|
|
164
|
+
"wait-on": "^8.0.4"
|
|
181
165
|
},
|
|
182
166
|
"author": "Alan <alanscodelog@gmail.com>",
|
|
183
167
|
"repository": "https://github.com/witchcraftjs/ui",
|
|
@@ -202,10 +186,5 @@
|
|
|
202
186
|
},
|
|
203
187
|
"publishConfig": {
|
|
204
188
|
"access": "public"
|
|
205
|
-
},
|
|
206
|
-
"pnpm": {
|
|
207
|
-
"overrides": {
|
|
208
|
-
"rollup": "=4.45.0"
|
|
209
|
-
}
|
|
210
189
|
}
|
|
211
190
|
}
|
package/src/module.ts
CHANGED
|
@@ -8,8 +8,8 @@ import {
|
|
|
8
8
|
useLogger,
|
|
9
9
|
} from "@nuxt/kit"
|
|
10
10
|
import tailwindcss from "@tailwindcss/vite"
|
|
11
|
-
import { addImportsCustom } from "@witchcraft/nuxt-utils/utils/addImportsCustom
|
|
12
|
-
import { globFiles } from "@witchcraft/nuxt-utils/utils/globFiles
|
|
11
|
+
import { addImportsCustom } from "@witchcraft/nuxt-utils/utils/addImportsCustom"
|
|
12
|
+
import { globFiles } from "@witchcraft/nuxt-utils/utils/globFiles"
|
|
13
13
|
import { defu } from "defu"
|
|
14
14
|
import fs from "fs"
|
|
15
15
|
import { themeAsTailwindCss } from "metamorphosis/tailwind"
|
|
@@ -158,16 +158,23 @@ export default defineNuxtModule<ModuleOptions>({
|
|
|
158
158
|
logger.info(`Adding unplugin-icons`)
|
|
159
159
|
config.plugins ??= []
|
|
160
160
|
config.plugins = [
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
161
|
+
...(
|
|
162
|
+
options.includeUnpluginIconsPlugins
|
|
163
|
+
? [
|
|
164
|
+
// we must prepend or the custom style options don't work when the module is used
|
|
165
|
+
ViteComponents({
|
|
166
|
+
resolvers: [
|
|
167
|
+
IconsResolver({prefix:"i"}),
|
|
168
|
+
// we don't need our resolver since we use nuxt instead
|
|
169
|
+
],
|
|
170
|
+
}),
|
|
171
|
+
Icons({
|
|
172
|
+
compiler: "vue3",
|
|
173
|
+
...unpluginIconViteOptions,
|
|
174
|
+
}),
|
|
175
|
+
]
|
|
176
|
+
: []
|
|
177
|
+
),
|
|
171
178
|
tailwindcss() as any,
|
|
172
179
|
...config.plugins,
|
|
173
180
|
]
|