Skip to content

Commit

Permalink
Added VueUiMiniLoader component
Browse files Browse the repository at this point in the history
  • Loading branch information
graphieros committed Feb 14, 2024
1 parent ae7bbe1 commit 553f334
Show file tree
Hide file tree
Showing 7 changed files with 227 additions and 4 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
![GitHub issues](https://img.shields.io/github/issues/graphieros/vue-data-ui)
![NPM](https://img.shields.io/npm/l/vue-data-ui)
![npm](https://img.shields.io/npm/dt/vue-data-ui)
![Static Badge](https://img.shields.io/badge/components-36-green)
![Static Badge](https://img.shields.io/badge/components-37-green)

[Interactive documentation](https://vue-data-ui.graphieros.com/)

Expand Down Expand Up @@ -70,6 +70,7 @@ Available components:
- [VueUiAnnotator](https://vue-data-ui.graphieros.com/docs#vue-ui-annotator)
- [VueUiIcon](https://vue-data-ui.graphieros.com/docs#vue-ui-icon)
- [VueUiDigits](https://vue-data-ui.graphieros.com/docs#vue-ui-digits)
- [VueUiMiniLoader](https://vue-data-ui.graphieros.com/docs#vue-ui-mini-loader)

# Installation
```
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "vue-data-ui",
"private": false,
"version": "1.9.89",
"version": "1.9.90",
"type": "module",
"description": "A user-empowering data visualization Vue components library",
"keywords": [
Expand Down
41 changes: 41 additions & 0 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ import DigitsTest from "./components/vue-ui-digits.vue";
import MoleculeTest from './components/vue-ui-molecule.vue';
import DonutEvolutionTest from "./components/vue-ui-donut-evolution.vue";
import TableSparklineTest from "./components/vue-ui-table-sparkline.vue";
import MiniLoaderTest from "./components/vue-ui-mini-loader.vue";
const dataset = ref([
{
Expand Down Expand Up @@ -3831,6 +3832,28 @@ const moodRadarConfig = ref({
},
])
const miniLoaderConfig = ref({
type: "bar",
onion: {
gutterColor: "#CCCCCC",
gutterOpacity: 0.3,
gutterBlur: 0.2,
trackHueRotate: 360,
trackBlur: 2,
trackColor: "#42d392"
},
line: {
color: "#42d392",
blur: 1,
hueRotate: 360
},
bar: {
color: "#42d392",
blur: 1,
hueRotate: 360
}
})
</script>

<template>
Expand Down Expand Up @@ -3931,6 +3954,24 @@ const moodRadarConfig = ref({
</template>
</Box>

<Box open @copy="copyConfig(PROD_CONFIG.vue_ui_mini_loader)">
<template #title>
<!-- <BaseIcon name="chartTable"/> -->
VueUiMiniLoader
</template>
<template #info>
</template>
<template #dev>
<MiniLoaderTest :config="miniLoaderConfig" />
</template>
<!-- <template #prod>
<VueUiTableSparkline :dataset="tableSparklineDataset"/>
</template> -->
<template #config>
{{ PROD_CONFIG.vue_ui_mini_loader }}
</template>
</Box>

<Box @copy="copyConfig(PROD_CONFIG.vue_ui_table_sparkline)">
<template #title>
<BaseIcon name="chartTable"/>
Expand Down
134 changes: 134 additions & 0 deletions src/components/vue-ui-mini-loader.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
<script setup>
import { ref, computed, nextTick } from "vue";
import {
createUid,
palette,
} from '../lib';
import { useNestedProp } from "../useNestedProp";
import mainConfig from "../default_configs.json";
const props = defineProps({
config: {
type: Object,
default() {
return {}
}
},
dataset: {
type: Array,
default() {
return []
}
},
});
const uid = ref(createUid());
const defaultConfig = ref(mainConfig.vue_ui_mini_loader);
const loaderConfig = computed(() => {
return useNestedProp({
userConfig: props.config,
defaultConfig: defaultConfig.value
});
});
const viewBox = ref({
onion: "-10 -10 84 84",
line: "-10 -10 112 84",
bar: "-10 -10 106 84"
})
const onionStyle = computed(() => {
return {
gutter: `stroke:${loaderConfig.value.onion.gutterColor};opacity:${loaderConfig.value.onion.gutterOpacity};`,
gutterBlur: `filter:blur(${loaderConfig.value.onion.gutterBlur}px);`
}
})
const trackBlur = computed(() => `blur(${loaderConfig.value.onion.trackBlur}px) hue-rotate(${loaderConfig.value.onion.trackHueRotate}deg)`);
const lineBlur = computed(() => `blur(${loaderConfig.value.line.blur}px) hue-rotate(${loaderConfig.value.line.hueRotate}deg)`);
const barBlur = computed(() => `blur(${loaderConfig.value.bar.blur}px) hue-rotate(${loaderConfig.value.bar.hueRotate}deg)`);
</script>

<template>
<svg :viewBox="viewBox[loaderConfig.type]" style="background: transparent" width="100%">
<g v-if="loaderConfig.type === 'onion'">
<path d="M 3 32 C 3 45 12 62 32 62 A 1 1 0 0 0 32 3" stroke="black" stroke-width="4" fill="none" stroke-linecap="round" :style="onionStyle.gutter + onionStyle.gutterBlur"/>
<path d="M 13 32 C 13 39 19 52 32 52 A 1 1 0 0 0 32 13" stroke="black" stroke-width="4" fill="none" stroke-linecap="round" :style="onionStyle.gutter + onionStyle.gutterBlur"/>
<path d="M 23 32 C 23 37 26.5 41 32 41 A 1 1 0 0 0 32 25" stroke="black" stroke-width="4" fill="none" stroke-linecap="round" :style="onionStyle.gutter + onionStyle.gutterBlur"/>

<path d="M 3 32 C 3 45 12 62 32 62 A 1 1 0 0 0 32 3" :stroke="loaderConfig.onion.trackColor" stroke-width="4" fill="none" stroke-linecap="round" class="onion-animated"/>
<path d="M 13 32 C 13 39 19 52 32 52 A 1 1 0 0 0 32 13" :stroke="loaderConfig.onion.trackColor" stroke-width="4" fill="none" stroke-linecap="round" class="onion-animated"/>
<path d="M 23 32 C 23 37 26.5 41 32 41 A 1 1 0 0 0 32 25" :stroke="loaderConfig.onion.trackColor" stroke-width="4" fill="none" stroke-linecap="round" class="onion-animated"/>
</g>
<g v-if="loaderConfig.type === 'line'">
<path d="M 3 62 C 6 57 6 48 11 45 C 16 44 17 53 22 52 C 27 49 25 32 30 31 C 34 29 37 47 42 47 C 46 47 45 38 49 36 C 53 34 56 45 61 45 C 66 45 65 24 69 24 C 73 22 75 35 79 34 C 84 34 83 11 91 5" :stroke="loaderConfig.line.color" stroke-width="4" fill="none" stroke-linecap="round" class="line-animated"/>
</g>
<g v-if="loaderConfig.type === 'bar'">
<path d="M 3 62 L 3 44 M 12 62 L 12 49 M 21 62 L 21 37 M 30 62 L 30 29 M 39 62 L 39 43 M 48 62 L 48 16 M 57 62 L 57 24 M 66 62 L 66 35 M 75 62 L 75 20 M 84 62 L 84 5" :stroke="loaderConfig.bar.color" stroke-width="4" fill="none" stroke-linecap="round" class="bar-animated"/>
</g>
</svg>
</template>

<style scoped>
path.onion-animated {
stroke-dasharray: 0;
stroke-dashoffset: 0;
animation: onion-groove infinite cubic-bezier(.53,.15,.57,.93) 3s;
}
@keyframes onion-groove {
from {
stroke-dasharray: 160;
stroke-dashoffset: -140;
filter: blur(0px);
}
to {
stroke-dasharray: 160;
stroke-dashoffset: 0;
filter: v-bind(trackBlur);
}
}
path.line-animated {
stroke-dasharray: 0;
stroke-dashoffset: 0;
animation: line-funk infinite cubic-bezier(.53,.15,.57,.93) 3s;
}
@keyframes line-funk {
from {
stroke-dasharray: 300;
stroke-dashoffset: 300;
filter: blur(0px);
}
to {
stroke-dasharray: 300;
stroke-dashoffset: 100;
filter: v-bind(lineBlur);
}
}
path.bar-animated {
stroke-dasharray: 0;
stroke-dashoffset: 0;
animation: bar-jazz infinite cubic-bezier(.53,.15,.57,.93) 3s;
}
@keyframes bar-jazz {
from {
stroke-dasharray: 60;
stroke-dashoffset: 60;
filter: blur(0px);
}
to {
stroke-dasharray: 60;
stroke-dashoffset: 0;
filter: v-bind(barBlur);
}
}
</style>
21 changes: 21 additions & 0 deletions src/default_configs.json
Original file line number Diff line number Diff line change
Expand Up @@ -3080,5 +3080,26 @@
"userOptions": {
"show": true
}
},
"vue_ui_mini_loader": {
"type": "onion",
"onion": {
"gutterColor": "#CCCCCC",
"gutterOpacity": 0,
"gutterBlur": 0,
"trackHueRotate": 20,
"trackBlur": 5,
"trackColor": "#42d392"
},
"line": {
"color": "#42d392",
"blur": 1,
"hueRotate": 20
},
"bar": {
"color": "#42d392",
"blur": 1,
"hueRotate": 20
}
}
}
26 changes: 26 additions & 0 deletions types/vue-data-ui.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,32 @@ declare module 'vue-data-ui' {
[key: string]: unknown;
}

export type VueUiMiniLoaderConfig = {
type?: "line" | "bar" | "onion";
onion?: {
gutterColor?: string;
gutterOpacity?: number;
gutterBlur?: number;
trackHueRotate?: number;
trackBlur?: number;
trackColor?: string;
};
line?: {
color?: string;
blur?: number;
hueRotate?: number;
};
bar?: {
color?: string;
blur?: number;
hueRotate?: number;
}
}

export const VueUiMiniLoader: DefineComponent<{
config?: VueUiMiniLoaderConfig;
}>

export const Arrow: DefineComponent<{
markerEnd?: boolean,
markerSize?: number,
Expand Down

0 comments on commit 553f334

Please sign in to comment.