@code-coaching/vuetiful 0.3.0 → 0.4.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/dist/style.css +1 -1
- package/dist/styles/all.css +142 -2
- package/dist/types/components/index.d.ts +2 -2
- package/dist/types/components/molecules/VDrawer.vue.d.ts +60 -0
- package/dist/types/components/molecules/index.d.ts +2 -1
- package/dist/types/services/drawer.service.d.ts +24 -0
- package/dist/types/services/index.d.ts +2 -1
- package/dist/vuetiful.es.mjs +133 -13
- package/dist/vuetiful.umd.js +11 -11
- package/package.json +1 -1
- package/src/components/index.ts +2 -2
- package/src/components/molecules/VDrawer.vue +97 -0
- package/src/components/molecules/VRailTile.vue +2 -5
- package/src/components/molecules/index.ts +2 -1
- package/src/services/drawer.service.ts +43 -0
- package/src/services/index.ts +2 -1
package/dist/vuetiful.es.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { defineComponent, useAttrs, openBlock, createBlock, resolveDynamicComponent, normalizeClass, unref, withCtx, createElementBlock, Fragment, createTextVNode, toDisplayString, createCommentVNode, renderSlot,
|
|
2
|
-
const _sfc_main$
|
|
1
|
+
import { defineComponent, useAttrs, openBlock, createBlock, resolveDynamicComponent, normalizeClass, unref, withCtx, createElementBlock, Fragment, createTextVNode, toDisplayString, createCommentVNode, renderSlot, ref, reactive, readonly, toRefs, computed, onMounted, createVNode, Transition, provide, createElementVNode, inject, mergeProps, withDirectives, resolveComponent, renderList, pushScopeId, popScopeId } from "vue";
|
|
2
|
+
const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
3
3
|
__name: "VButton",
|
|
4
4
|
props: {
|
|
5
5
|
tag: {
|
|
@@ -28,6 +28,131 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
|
28
28
|
};
|
|
29
29
|
}
|
|
30
30
|
});
|
|
31
|
+
const selectedRailTile = ref("");
|
|
32
|
+
const useRail = () => {
|
|
33
|
+
return {
|
|
34
|
+
selectedRailTile
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
const drawer = reactive({
|
|
38
|
+
id: "default",
|
|
39
|
+
open: false
|
|
40
|
+
});
|
|
41
|
+
const useDrawer = () => {
|
|
42
|
+
const open = (settings) => {
|
|
43
|
+
drawer.open = true;
|
|
44
|
+
if (settings) {
|
|
45
|
+
Object.keys(settings).forEach((key) => {
|
|
46
|
+
drawer[key] = settings[key];
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
const close = () => drawer.open = false;
|
|
51
|
+
const toggle = () => drawer.open = !drawer.open;
|
|
52
|
+
return {
|
|
53
|
+
drawer: readonly(drawer),
|
|
54
|
+
open,
|
|
55
|
+
close,
|
|
56
|
+
toggle
|
|
57
|
+
};
|
|
58
|
+
};
|
|
59
|
+
const _hoisted_1$4 = ["aria-labelledby", "aria-describedby"];
|
|
60
|
+
const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
61
|
+
__name: "VDrawer",
|
|
62
|
+
props: {
|
|
63
|
+
position: {
|
|
64
|
+
type: String,
|
|
65
|
+
default: "left"
|
|
66
|
+
},
|
|
67
|
+
duration: {
|
|
68
|
+
type: Number,
|
|
69
|
+
default: 300
|
|
70
|
+
},
|
|
71
|
+
regionBackdrop: {
|
|
72
|
+
type: String,
|
|
73
|
+
default: ""
|
|
74
|
+
},
|
|
75
|
+
regionDrawer: {
|
|
76
|
+
type: String,
|
|
77
|
+
default: ""
|
|
78
|
+
},
|
|
79
|
+
labelledby: {
|
|
80
|
+
type: String,
|
|
81
|
+
default: ""
|
|
82
|
+
},
|
|
83
|
+
describedby: {
|
|
84
|
+
type: String,
|
|
85
|
+
default: ""
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
setup(__props) {
|
|
89
|
+
const props = __props;
|
|
90
|
+
const { drawer: drawer2, close } = useDrawer();
|
|
91
|
+
const attrs = useAttrs();
|
|
92
|
+
const { position, duration, regionBackdrop, regionDrawer, labelledby, describedby } = toRefs(props);
|
|
93
|
+
const presets = {
|
|
94
|
+
top: { alignment: "top-0", width: "w-full", height: "h-[50%]", rounded: "rounded-bl-container-token rounded-br-container-token" },
|
|
95
|
+
bottom: { alignment: "bottom-0", width: "w-full", height: " h-[50%]", rounded: "rounded-tl-container-token rounded-tr-container-token" },
|
|
96
|
+
left: { alignment: "lef-0", width: "w-[90%]", height: "h-full", rounded: "rounded-tr-container-token rounded-br-container-token" },
|
|
97
|
+
right: { alignment: "right-0", width: "w-[90%]", height: "h-full", rounded: "rounded-tl-container-token rounded-bl-container-token" }
|
|
98
|
+
};
|
|
99
|
+
const preset = computed(() => presets[position.value]);
|
|
100
|
+
const elemBackdrop = ref();
|
|
101
|
+
const elemDrawer = ref();
|
|
102
|
+
const onBackdropInteraction = (event) => {
|
|
103
|
+
if (event.target === elemBackdrop.value)
|
|
104
|
+
close();
|
|
105
|
+
};
|
|
106
|
+
const onKeydownWindow = (event) => {
|
|
107
|
+
if (event.code === "Escape")
|
|
108
|
+
close();
|
|
109
|
+
};
|
|
110
|
+
onMounted(() => {
|
|
111
|
+
window.addEventListener("keydown", onKeydownWindow);
|
|
112
|
+
});
|
|
113
|
+
return (_ctx, _cache) => {
|
|
114
|
+
return openBlock(), createElementBlock(Fragment, null, [
|
|
115
|
+
createVNode(Transition, {
|
|
116
|
+
name: `slide-${unref(position)}-${unref(duration)}`
|
|
117
|
+
}, {
|
|
118
|
+
default: withCtx(() => [
|
|
119
|
+
unref(drawer2).open ? (openBlock(), createElementBlock("div", {
|
|
120
|
+
key: 0,
|
|
121
|
+
ref_key: "elemDrawer",
|
|
122
|
+
ref: elemDrawer,
|
|
123
|
+
class: normalizeClass(`drawer absolute overflow-y-auto shadow-xl transition-transform bg-surface-100-800-token ${unref(preset).width} ${unref(preset).height} ${unref(preset).rounded} ${unref(preset).alignment} z-50 ${unref(regionDrawer)}`),
|
|
124
|
+
role: "dialog",
|
|
125
|
+
"aria-modal": "true",
|
|
126
|
+
"aria-labelledby": unref(labelledby),
|
|
127
|
+
"aria-describedby": unref(describedby)
|
|
128
|
+
}, [
|
|
129
|
+
renderSlot(_ctx.$slots, "default")
|
|
130
|
+
], 10, _hoisted_1$4)) : createCommentVNode("", true)
|
|
131
|
+
]),
|
|
132
|
+
_: 3
|
|
133
|
+
}, 8, ["name"]),
|
|
134
|
+
createVNode(Transition, {
|
|
135
|
+
name: `fade-${unref(duration)}`
|
|
136
|
+
}, {
|
|
137
|
+
default: withCtx(() => {
|
|
138
|
+
var _a;
|
|
139
|
+
return [
|
|
140
|
+
unref(drawer2).open ? (openBlock(), createElementBlock("div", {
|
|
141
|
+
key: 0,
|
|
142
|
+
ref_key: "elemBackdrop",
|
|
143
|
+
ref: elemBackdrop,
|
|
144
|
+
class: normalizeClass(`drawer-backdrop backdrop-blur-xs fixed top-0 left-0 right-0 bottom-0 flex bg-surface-backdrop-token ${unref(regionBackdrop)} z-40 ${(_a = unref(attrs).class) != null ? _a : ""}`),
|
|
145
|
+
onMousedown: onBackdropInteraction,
|
|
146
|
+
onTouchstart: onBackdropInteraction
|
|
147
|
+
}, null, 34)) : createCommentVNode("", true)
|
|
148
|
+
];
|
|
149
|
+
}),
|
|
150
|
+
_: 1
|
|
151
|
+
}, 8, ["name"])
|
|
152
|
+
], 64);
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
});
|
|
31
156
|
const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
32
157
|
__name: "VRail",
|
|
33
158
|
props: {
|
|
@@ -80,12 +205,6 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
|
80
205
|
};
|
|
81
206
|
}
|
|
82
207
|
});
|
|
83
|
-
const selectedRailTile = ref("");
|
|
84
|
-
const useRail = () => {
|
|
85
|
-
return {
|
|
86
|
-
selectedRailTile
|
|
87
|
-
};
|
|
88
|
-
};
|
|
89
208
|
const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
90
209
|
__name: "VRailTile",
|
|
91
210
|
props: {
|
|
@@ -117,7 +236,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
|
117
236
|
const { selectedRailTile: selectedRailTile2 } = useRail();
|
|
118
237
|
const active = inject("active");
|
|
119
238
|
const hover = inject("hover");
|
|
120
|
-
const onClickHandler = (
|
|
239
|
+
const onClickHandler = () => {
|
|
121
240
|
if (!props.value)
|
|
122
241
|
return;
|
|
123
242
|
selectedRailTile2.value = props.value;
|
|
@@ -235,10 +354,11 @@ const _sfc_main$3 = defineComponent({
|
|
|
235
354
|
var components = /* @__PURE__ */ Object.freeze({
|
|
236
355
|
__proto__: null,
|
|
237
356
|
[Symbol.toStringTag]: "Module",
|
|
238
|
-
VButton: _sfc_main$
|
|
357
|
+
VButton: _sfc_main$7,
|
|
239
358
|
VRail: _sfc_main$5,
|
|
240
359
|
VRailTile: _sfc_main$4,
|
|
241
|
-
VShell: _sfc_main$3
|
|
360
|
+
VShell: _sfc_main$3,
|
|
361
|
+
VDrawer: _sfc_main$6
|
|
242
362
|
});
|
|
243
363
|
var main = "";
|
|
244
364
|
var tailwind = "";
|
|
@@ -46918,7 +47038,7 @@ var themeSwitcher_vue_vue_type_style_index_0_scoped_true_lang = "";
|
|
|
46918
47038
|
const _sfc_main = defineComponent({
|
|
46919
47039
|
components: {
|
|
46920
47040
|
DarkModeSwitch,
|
|
46921
|
-
VButton: _sfc_main$
|
|
47041
|
+
VButton: _sfc_main$7
|
|
46922
47042
|
},
|
|
46923
47043
|
props: {
|
|
46924
47044
|
bgLight: {
|
|
@@ -47161,4 +47281,4 @@ function install(app) {
|
|
|
47161
47281
|
}
|
|
47162
47282
|
}
|
|
47163
47283
|
var index = { install };
|
|
47164
|
-
export { _sfc_main$2 as CodeBlock, DarkModeSwitch, themeSwitcher as ThemeSwitcher, _sfc_main$
|
|
47284
|
+
export { _sfc_main$2 as CodeBlock, DarkModeSwitch, themeSwitcher as ThemeSwitcher, _sfc_main$7 as VButton, _sfc_main$6 as VDrawer, _sfc_main$5 as VRail, _sfc_main$4 as VRailTile, _sfc_main$3 as VShell, index as default, useDarkMode, useDrawer, useRail, useTheme, clipboard as vClipboard };
|