Skip to content

Commit

Permalink
feat: supports directive & lazy load component
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangmo8 committed Feb 22, 2024
1 parent 3c2fa7c commit afd6516
Show file tree
Hide file tree
Showing 12 changed files with 2,495 additions and 1,290 deletions.
10 changes: 0 additions & 10 deletions .eslintrc

This file was deleted.

4 changes: 4 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// eslint.config.js
import antfu from '@antfu/eslint-config'

export default antfu()
68 changes: 35 additions & 33 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,19 @@
{
"name": "@varlet/nuxt",
"type": "module",
"version": "0.0.4",
"packageManager": "pnpm@7.22.0",
"description": "varlet module for nuxt",
"license": "MIT",
"type": "module",
"repository": {
"type": "git",
"url": "git+https://github.com/varletjs/varlet-nuxt.git"
},
"bugs": "https://github.com/varletjs/varlet-nuxt/issues",
"keywords": [
"varlet",
"nuxt"
],
"exports": {
".": {
"types": "./dist/types.d.ts",
Expand All @@ -16,18 +26,9 @@
"files": [
"dist"
],
"packageManager": "pnpm@7.22.0",
"keywords": [
"varlet",
"nuxt"
],
"repository": {
"type": "git",
"url": "git+https://github.com/varletjs/varlet-nuxt.git"
},
"bugs": "https://github.com/varletjs/varlet-nuxt/issues",
"scripts": {
"prepack": "nuxt-module-build",
"clear": "rm -rf ./playground/node_modules/.cache && rm -rf ./playground/.nuxt",
"dev": "nuxi dev playground",
"dev:build": "nuxi build playground",
"dev:prepare": "nuxt-module-build --stub && nuxi prepare playground",
Expand All @@ -36,47 +37,48 @@
"release": "npm run lint && npm run build && npx changelogen --release && npm publish && git push --follow-tags",
"lint": "eslint . --fix"
},
"husky": {
"hooks": {
"pre-commit": "lint-staged"
}
},
"lint-staged": {
"*.{js,jsx}": [
"eslint --fix",
"git add"
],
"*.{ts,tsx}": [
"eslint --fix",
"git add"
]
"peerDependencies": {
"@varlet/shared": "^2.9.3",
"@varlet/ui": "^2.9.3"
},
"dependencies": {
"@nuxt/kit": "^3.3.2",
"knitwork": "^1.0.0",
"magic-string": "^0.29.0",
"unplugin": "^1.0.1"
},
"peerDependencies": {
"@varlet/shared": "^2.9.3",
"@varlet/ui": "^2.9.3"
},
"devDependencies": {
"@antfu/eslint-config": "^2.6.4",
"@nuxt/eslint-config": "^0.1.1",
"@nuxt/module-builder": "^0.2.1",
"@nuxt/schema": "^3.3.2",
"@nuxtjs/eslint-config-typescript": "^12.0.0",
"@types/node": "^18.13.0",
"@varlet/shared": "^2.9.3",
"@varlet/ui": "^2.9.3",
"eslint": "^8.36.0",
"@varlet/shared": "latest",
"@varlet/ui": "latest",
"eslint": "^8.46.0",
"husky": "^8.0.3",
"lint-staged": "^13.2.0",
"nuxt": "^3.3.2",
"typescript": "^4.9.5"
},
"husky": {
"hooks": {
"pre-commit": "lint-staged"
}
},
"lint-staged": {
"*.{js,jsx}": [
"eslint --fix",
"git add"
],
"*.{ts,tsx}": [
"eslint --fix",
"git add"
]
},
"publishConfig": {
"access": "public",
"registry": "https://registry.npmjs.org/"
}
}
}
45 changes: 4 additions & 41 deletions playground/app.vue
Original file line number Diff line number Diff line change
@@ -1,46 +1,9 @@
<script setup lang="ts">
const show = ref(false)
const showSnackBar = () => {
Snackbar({
content: '这是一个消息条!!',
duration: 1000
})
}
import '@varlet/touch-emulator'
</script>

<template>
<div>
<var-button type="primary" block @click="show = !show">
66666666
</var-button>
<var-button @click="showSnackBar">
wudi
</var-button>
<client-only>
<var-snackbar v-model:show="show">
这是一个消息条!!
</var-snackbar>
</client-only>
<!-- <div v-ripple class="ripple-example-block">
点击
</div> -->
<var-skeleton :loading="show">
加载的数据
</var-skeleton>
</div>
<nuxt-layout>
<nuxt-page />
</nuxt-layout>
</template>

<style>
.ripple-example-block {
display: flex;
justify-content: center;
align-items: center;
height: 100px;
user-select: none;
cursor: pointer;
color: #888;
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
transition: background-color 0.25s;
}
</style>
5 changes: 4 additions & 1 deletion playground/package.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
{
"name": "my-module-playground",
"private": true,
"name": "my-module-playground"
"dependencies": {
"@varlet/touch-emulator": "^3.0.3"
}
}
22 changes: 22 additions & 0 deletions playground/pages/demo.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<script setup lang="ts">
import { Themes } from '@varlet/ui'
</script>

<template>
<lazy-var-button @click="() => StyleProvider(Themes.dark)">
ceshi
</lazy-var-button>
<lazy-var-paper
v-hover="{ color: 'var(--color-on-primary)', background: 'var(--color-primary)' }"
ripple
class="paper"
:elevation="2"
:width="100"
:height="100"
>
HOVER ME
</lazy-var-paper>
<nuxt-link to="/">
back
</nuxt-link>
</template>
56 changes: 56 additions & 0 deletions playground/pages/index.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<script setup lang="ts">
import { Themes } from '@varlet/ui'
const show = ref(false)
function showSnackBar() {
Snackbar({
content: '这是一个消息条!!',
duration: 1000,
})
}
</script>

<template>
<div>
<VarButton>wefwef</VarButton>
<nuxt-link to="/demo">
link to demo qwef
</nuxt-link>

<var-button block @click="() => StyleProvider(Themes.md3Light)">
Material Design 3 暗色
</var-button>
<var-button type="primary" block @click="show = !show">
66666666
</var-button>
<var-button @click="showSnackBar">
wudi
</var-button>
<client-only>
<var-snackbar v-model:show="show">
这是一个消息条!!
</var-snackbar>
</client-only>
<div v-ripple class="ripple-example-block">
点击
</div>
<var-skeleton :loading="show">
加载的数据
</var-skeleton>
</div>
</template>

<style>
.ripple-example-block {
display: flex;
justify-content: center;
align-items: center;
height: 100px;
user-select: none;
cursor: pointer;
color: #888;
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
transition: background-color 0.25s;
}
</style>
16 changes: 16 additions & 0 deletions playground/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit afd6516

Please sign in to comment.