diff --git a/src/components/Card.vue b/src/components/Card.vue
index d0a12a6..0afabbe 100644
--- a/src/components/Card.vue
+++ b/src/components/Card.vue
@@ -1,7 +1,8 @@
-
-
+
+
diff --git a/src/components/Editor.vue b/src/components/Editor.vue
index 13da10a..f8deada 100644
--- a/src/components/Editor.vue
+++ b/src/components/Editor.vue
@@ -1,39 +1,45 @@
diff --git a/src/const/editor.ts b/src/const/editor.ts
index cddbbe2..d845666 100644
--- a/src/const/editor.ts
+++ b/src/const/editor.ts
@@ -1,7 +1,7 @@
const editorConfig = [
{
label: "border-radius",
- value: 50,
+ value: 0,
params: {
min: 0,
step: 1,
@@ -10,7 +10,7 @@ const editorConfig = [
},
{
label: "width",
- value: 200,
+ value: 350,
params: {
min: 100,
max: 500,
@@ -24,15 +24,8 @@ const editorConfig = [
}
].map((i, index) => ({ ...i, id: index }));
-const BasicFolder = editorConfig.filter((i, j) => j <= 2)
-const OtherFolder = editorConfig.filter((i, j) => j > 2)
-
-export const folders = [{
+export const EditorFolder = {
type: 'folder',
- label: 'Basic',
- children: BasicFolder
-}, {
- type: 'folder',
- label: 'Other',
- children: OtherFolder
-}]
\ No newline at end of file
+ label: 'Image',
+ children: editorConfig
+}
\ No newline at end of file
diff --git a/src/const/hoverTilt.ts b/src/const/hoverTilt.ts
new file mode 100644
index 0000000..efb643d
--- /dev/null
+++ b/src/const/hoverTilt.ts
@@ -0,0 +1,115 @@
+export const hoverTiltConfig = [
+ {
+ label: "tilt-factor",
+ value: 1,
+ params: {
+ min: 0,
+ max: 2,
+ step: 0.1
+ }
+ },
+ // {
+ // label: "tilt-factor-y",
+ // value: 1,
+ // params: {
+ // min: 0,
+ // max: 2,
+ // step: 0.1
+ // }
+ // },
+ {
+ label: "scale-factor",
+ value: 1,
+ params: {
+ min: 0.8,
+ max: 1.2,
+ step: 0.05
+ }
+ },
+ //TODO:springOptions @see https://hover-tilt.simey.me/options/props/#springoptions
+ //TODO:tiltSpringOptions @see https://hover-tilt.simey.me/options/props/#tiltspringoptions
+ {
+ label: "enter-delay",
+ value: 0,
+ params: {
+ min: 0,
+ max: 500,
+ step: 50
+ }
+ },
+ {
+ label: "exit-delay",
+ value: 200,
+ params: {
+ min: 0,
+ max: 1000,
+ step: 50
+ }
+ },
+ //TODO:shadow @see https://hover-tilt.simey.me/options/props/#shadow
+ {
+ label: "shadow-blur",
+ value: 12,
+ params: {
+ min: 0,
+ max: 50,
+ step: 1
+ }
+ },
+ {
+ label: "blend-mode",
+ value: "overlay",
+ params: {
+ options: {
+ "overlay": "overlay",
+ "screen": "screen",
+ "multiply": "multiply",
+ 'plus-lighter': 'plus-lighter',
+ }
+ }
+ },
+ {
+ label: "glare-intensity",
+ value: 1,
+ params: {
+ min: 0,
+ max: 4,
+ step: 0.1
+ }
+ },
+ {
+ label: "glare-hue",
+ value: 270,
+ params: {
+ min: 0,
+ max: 360,
+ step: 10
+ }
+ },
+ //@see https://hover-tilt.simey.me/options/props/#glaremask
+ // {
+ // label: "glare-mask",
+ // value: undefined,
+ // },
+ //@see https://hover-tilt.simey.me/options/props/#glaremaskmode
+ {
+ label: "glare-mask-mode",
+ value: "outside",
+ params: {
+ // 'match-source' | 'luminance' | 'alpha' | 'none' | undefined
+ options: {
+ "match-source": "match-source",
+ "luminance": "luminance",
+ "alpha": "alpha",
+ "none": "none",
+ // "undefined": undefined
+ }
+ }
+ }
+].map((i, index) => ({ ...i, id: index }));
+
+export const TiltFolder = {
+ type: 'folder',
+ label: 'Tilt',
+ children: hoverTiltConfig
+}
diff --git a/src/stores/editor.ts b/src/stores/editor.ts
index c112d2e..ccc9aa5 100644
--- a/src/stores/editor.ts
+++ b/src/stores/editor.ts
@@ -1,6 +1,6 @@
import { defineStore } from 'pinia'
import { reactive, computed } from 'vue'
-import { folders } from '@/const/editor'
+import { EditorFolder } from '@/const/editor'
// 定义哪些属性需要添加 px 单位
const PX_PROPERTIES = ['width', 'border-radius']
@@ -11,7 +11,7 @@ export const useEditorStore = defineStore('editor', () => {
// 初始化表单数据
function initializeFormData() {
- folders.flatMap(f => f.type === 'folder' ? f.children : []).forEach((item: any) => {
+ EditorFolder.children.forEach((item: any) => {
if (!(item.label in formData)) {
formData[item.label] = item.value
}
diff --git a/src/stores/hoverTilt.ts b/src/stores/hoverTilt.ts
new file mode 100644
index 0000000..18dd70f
--- /dev/null
+++ b/src/stores/hoverTilt.ts
@@ -0,0 +1,37 @@
+import { defineStore } from 'pinia'
+import { reactive, computed } from 'vue'
+import { TiltFolder } from '@/const/hoverTilt'
+
+export const useHoverTiltStore = defineStore('hoverTilt', () => {
+ // 存储 hover-tilt 配置数据
+ const formData = reactive>({})
+
+ // 初始化表单数据
+ function initializeFormData() {
+ TiltFolder.children.forEach((item: any) => {
+ if (!(item.label in formData)) {
+ formData[item.label] = item.value
+ }
+ })
+ }
+
+ // 获取转换后的 props 对象,将驼峰命名转换为连字符命名
+ const tiltProps = computed(() => {
+ const props: Record = {}
+ Object.entries(formData).forEach(([key, value]) => {
+ if (value !== undefined) {
+ props[key] = value
+ }
+ })
+ return props
+ })
+
+ return {
+ formData,
+ tiltProps,
+ initializeFormData,
+
+ }
+}, {
+ persist: false
+})