Skip to content

Commit f2366a4

Browse files
committed
Improvement - Add icons and exposed methods
1 parent 54f0673 commit f2366a4

File tree

5 files changed

+53
-6
lines changed

5 files changed

+53
-6
lines changed

TestingArena/ArenaVueUiIcon.vue

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { ref } from "vue";
33
import BaseIcon from "./../src/atoms/BaseIcon.vue";
44
55
const icons = ref([
6-
"annotator", "chart3dBar", "chartAgePyramid", "chartBar", "chartCandlestick", "chartChestnut", "chartDonut", "chartDonutEvolution", "chartGauge", "chartHeatmap", "chartLine", "chartMoodRadar", "chartOnion", "chartQuadrant", "chartRadar", "chartRelationCircle", "chartRings", "chartScatter", "chartSparkHistogram", "chartSparkStackbar", "chartTable", "chartThermometer", "chartTiremarks", "chartVerticalBar", "chartWaffle", "chartWheel", "close", "dashboard", "digit0", "digit1", "digit2", "digit3", "digit4", "digit5", "digit6", "digit7", "digit8", "digit9", "excel", "image", "labelClose", "labelOpen", "menu", "moodFlat", "moodHappy", "moodNeutral", "moodSad", "pdf", "screenshot", "skeleton", "smiley", "sort", "spin", "star", "tableClose", "tableOpen", "chartNestedDonuts", "chartSparkbar", "refresh", "circleQuestion", "circleExclamation", "circleCheck", "circleCancel", "moodLaughing", "moodWink", "moodEmbarrassed", "moodSurprised", "exitFullscreen", "fullscreen", "arrowRight", "arrowTop", "arrowBottom", "arrowLeft", "chartCluster", "chartSparkline", "legend", "csv", "chartGalaxy", "kpi", "kpiBox", "tooltip", "vueDataUi", "ratio", "func", "settings", "trendUp", "trendDown", "clipBoard", "zoomPlus", "zoomMinus", "clipboardLine", "clipboardDonut", "clipboardBar", "clipboardVariable", "triangle", "triangleFill", "square", "squareFill", "diamond", "diamondFill", "pentagon", "pentagonFill", "hexagon", "hexagonFill", "circle", "circleFill", "star", "starFace", "starFill", "numbers", "sigma", "mu", "lambda", "people", "copy", "accordion", "cursor", "trend", "chartStripPlot", "chartDumbbell", "copyLeft", "chartWordCloud", "stack", "unstack", "window", "chartFlow", "chartParallelCoordinatePlot", "tooltipDisabled", "pause", "play", "stop", "restart", "lap", "carouselTable", "battery", "chartStackbar", "chartBullet", "trash", "annotatorDisabled", "palette", "boxes", "chartFunnel", "chartHistoryPlot", "chartTableSparkline", "chartCirclePack", "icons", "robot"
6+
"annotator", "chart3dBar", "chartAgePyramid", "chartBar", "chartCandlestick", "chartChestnut", "chartDonut", "chartDonutEvolution", "chartGauge", "chartHeatmap", "chartLine", "chartMoodRadar", "chartOnion", "chartQuadrant", "chartRadar", "chartRelationCircle", "chartRings", "chartScatter", "chartSparkHistogram", "chartSparkStackbar", "chartTable", "chartThermometer", "chartTiremarks", "chartVerticalBar", "chartWaffle", "chartWheel", "close", "dashboard", "digit0", "digit1", "digit2", "digit3", "digit4", "digit5", "digit6", "digit7", "digit8", "digit9", "excel", "image", "labelClose", "labelOpen", "menu", "moodFlat", "moodHappy", "moodNeutral", "moodSad", "pdf", "screenshot", "skeleton", "smiley", "sort", "spin", "star", "tableClose", "tableOpen", "chartNestedDonuts", "chartSparkbar", "refresh", "circleQuestion", "circleExclamation", "circleCheck", "circleCancel", "moodLaughing", "moodWink", "moodEmbarrassed", "moodSurprised", "exitFullscreen", "fullscreen", "arrowRight", "arrowTop", "arrowBottom", "arrowLeft", "chartCluster", "chartSparkline", "legend", "csv", "chartGalaxy", "kpi", "kpiBox", "tooltip", "vueDataUi", "ratio", "func", "settings", "trendUp", "trendDown", "clipBoard", "zoomPlus", "zoomMinus", "clipboardLine", "clipboardDonut", "clipboardBar", "clipboardVariable", "triangle", "triangleFill", "square", "squareFill", "diamond", "diamondFill", "pentagon", "pentagonFill", "hexagon", "hexagonFill", "circle", "circleFill", "star", "starFace", "starFill", "numbers", "sigma", "mu", "lambda", "people", "copy", "accordion", "cursor", "trend", "chartStripPlot", "chartDumbbell", "copyLeft", "chartWordCloud", "stack", "unstack", "window", "chartFlow", "chartParallelCoordinatePlot", "tooltipDisabled", "pause", "play", "stop", "restart", "lap", "carouselTable", "battery", "chartStackbar", "chartBullet", "trash", "annotatorDisabled", "palette", "boxes", "chartFunnel", "chartHistoryPlot", "chartTableSparkline", "chartCirclePack", "icons", "robot", "hourglass", "computer", "htmlTag", "curlyBrackets", "curlySpread",
77
])
88
99
</script>
@@ -15,4 +15,7 @@ const icons = ref([
1515
<div style="display: flex; flex-wrap: wrap; gap: 12px; width: 100%; margin: 0 auto; margin-top: 64px; margin-bottom: 64px; max-width: 1200px">
1616
<BaseIcon v-for="icon in icons" :name="icon" stroke="#CCCCCC" :size="48"/>
1717
</div>
18+
<div style="display: flex; flex-wrap: wrap; gap: 12px; width: 100%; margin: 0 auto; margin-top: 64px; margin-bottom: 64px; max-width: 1200px">
19+
<BaseIcon v-for="icon in icons" :name="icon" stroke="#6376DD" :size="96"/>
20+
</div>
1821
</template>

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,4 +107,4 @@
107107
"vitest": "^3.1.1",
108108
"vue": "^3.5.13"
109109
}
110-
}
110+
}

src/atoms/BaseIcon.vue

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,12 @@ const icons = computed(() => {
182182
home: `<path fill="none" stroke="${props.stroke}" stroke-width="${props.strokeWidth}" stroke-linecap="round" stroke-linejoin="round" d="M 2 10 L 10 2 L 18 10 M 4 10 L 4 17 C 4 18 4 18 5 18 L 8 18 L 8 12 L 12 12 L 12 18 L 15 18 C 16 18 16 18 16 17 L 16 10 M 8 18"/>`,
183183
homeFilled: `<path fill="${props.stroke}" stroke="${props.stroke}" stroke-width="${props.strokeWidth}" stroke-linecap="round" stroke-linejoin="round" d="M 2 10 L 10 2 L 18 10 M 4 10 L 4 17 C 4 18 4 18 5 18 L 8 18 L 8 12 L 12 12 L 12 18 L 15 18 C 16 18 16 18 16 17 L 16 10 M 8 18"/>`,
184184
icons: `<path fill="none" stroke="${props.stroke}" stroke-width="${props.strokeWidth}" stroke-linecap="round" stroke-linejoin="round" d="M 1 9 L 5 2 L 9 9 L 1 9 M 12 9 L 12 2 L 19 2 L 19 9 L 12 9 M 5 11 C 0 11 0 18 5 18 C 10 18 10 11 5 11 M 15 11 L 15 18 L 16 18 L 16 11 L 15 11 M 12 14 L 19 14 L 19 15 L 12 15 L 12 14"/>`,
185-
robot: `<path fill="none" stroke="${props.stroke}" stroke-width="${props.strokeWidth}" stroke-linecap="round" stroke-linejoin="round" d="M 2 2 L 18 2 L 18 18 L 2 18 L 2 2 M 6 5 A 1 1 0 0 0 6 8 A 1 1 0 0 0 6 5 M 14 5 A 1 1 0 0 0 14 8 A 1 1 0 0 0 14 5 M 1 4 L 1 9 M 19 4 L 19 9 M 5 11 C 6 16 14 16 15 11 M 7 1 L 13 1"/>`
185+
robot: `<path fill="none" stroke="${props.stroke}" stroke-width="${props.strokeWidth}" stroke-linecap="round" stroke-linejoin="round" d="M 2 2 L 18 2 L 18 18 L 2 18 L 2 2 M 6 5 A 1 1 0 0 0 6 8 A 1 1 0 0 0 6 5 M 14 5 A 1 1 0 0 0 14 8 A 1 1 0 0 0 14 5 M 1 4 L 1 9 M 19 4 L 19 9 M 5 11 C 6 16 14 16 15 11 M 7 1 L 13 1"/>`,
186+
hourglass: `<path fill="none" stroke="${props.stroke}" stroke-width="${props.strokeWidth}" stroke-linecap="round" stroke-linejoin="round" d="M 4 1 L 16 1 M 13 1 C 16 3 14 5 14 5 M 7 1 C 4 3 6 5 6 5 M 4 19 L 16 19 M 6 5 C 10 10 10 10 6 15 M 14 5 C 10 10 10 10 14 15 M 13 19 C 16 17 14 15 14 15 M 7 19 C 4 17 6 15 6 15"/><path style="opacity:0.3" fill="${props.stroke}" stroke="none" d="M 7 18 L 13 18 C 14 15 11 13 10 13 C 9 13 6 15 7 18"/>`,
187+
computer: `<path fill="none" stroke="${props.stroke}" stroke-width="${props.strokeWidth}" stroke-linecap="round" stroke-linejoin="round" d="M 2 4 L 2 10 C 2 11 3 12 4 12 L 16 12 C 17 12 18 11 18 10 L 18 4 C 18 3 17 2 16 2 L 4 2 C 3 2 2 3 2 4 M 4 16 L 2 19 L 18 19 L 16 16 L 4 16 M 5 14 L 15 14 M 7 14 L 10 12 L 13 14 M 7 5 L 4 7 L 7 9 M 13 5 L 16 7 L 13 9 M 11 4 L 9 10"/>`,
188+
htmlTag: `<path fill="none" stroke="${props.stroke}" stroke-width="${props.strokeWidth}" stroke-linecap="round" stroke-linejoin="round" d="M 6 5 L 1 10 L 6 15 M 14 5 L 19 10 L 14 15 M 7 18 L 13 2"/>`,
189+
curlyBrackets: `<path fill="none" stroke="${props.stroke}" stroke-width="${props.strokeWidth}" stroke-linecap="round" stroke-linejoin="round" d="M 5 2 C 3 2 2 3 2 5 L 2.35 7.988 C 2 9 1 9 1 10 C 1 11 2 11 2.396 11.949 L 2 15 C 2 17 3 18 5 18 M 15 2 C 17 2 18 3 18 5 L 17.611 8.035 C 18 9 19 9 19 10 C 19 11 18 11 17.611 12.008 L 18 15 C 18 17 17 18 15 18"/>`,
190+
curlySpread: `<path fill="none" stroke="${props.stroke}" stroke-width="${props.strokeWidth}" stroke-linecap="round" stroke-linejoin="round" d="M 5 2 C 3 2 2 3 2 5 L 2.35 7.988 C 2 9 1 9 1 10 C 1 11 2 11 2.396 11.949 L 2 15 C 2 17 3 18 5 18 M 15 2 C 17 2 18 3 18 5 L 17.611 8.035 C 18 9 19 9 19 10 C 19 11 18 11 17.611 12.008 L 18 15 C 18 17 17 18 15 18 M 10 9 A 1 1 0 0 0 10 11 A 1 1 0 0 0 10 9 M 6 9 A 1 1 0 0 0 6 11 A 1 1 0 0 0 6 9 M 14 9 A 1 1 0 0 0 14 11 A 1 1 0 0 0 14 9"/>`,
186191
}
187192
});
188193

src/index.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { defineAsyncComponent } from "vue";
22
import getVueDataUiConfig from "./getVueDataUiConfig";
33
import getThemeConfig from "./getThemeConfig";
4-
import { getPalette, createWordCloudDatasetFromPlainText, abbreviate, createTSpans } from "./lib";
4+
import { getPalette, createWordCloudDatasetFromPlainText, abbreviate, createTSpans, createStraightPath, createSmoothPath } from "./lib";
55
import { lightenColor, darkenColor, shiftColorHue } from "./exposedLib";
66

77
export const Arrow = defineAsyncComponent(() => import("./atoms/Arrow.vue"))
@@ -77,5 +77,7 @@ export {
7777
getVueDataUiConfig,
7878
lightenColor,
7979
shiftColorHue,
80-
createTSpans
80+
createTSpans,
81+
createStraightPath,
82+
createSmoothPath
8183
}

types/vue-data-ui.d.ts

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1155,7 +1155,12 @@ declare module "vue-data-ui" {
11551155
| "home"
11561156
| "homeFilled"
11571157
| "icons"
1158-
| "robot";
1158+
| "robot"
1159+
| "hourglass"
1160+
| "computer"
1161+
| "htmlTag"
1162+
| "curlyBrackets"
1163+
| "curlySpread";
11591164

11601165
export const VueUiIcon: DefineComponent<{
11611166
name: VueUiIconName;
@@ -6878,6 +6883,38 @@ declare module "vue-data-ui" {
68786883
| ((word: string) => string)
68796884
| null;
68806885

6886+
6887+
export type Point = {
6888+
[key: string]: any
6889+
x: number
6890+
y: number
6891+
}
6892+
6893+
/**
6894+
* Vue Data UI utility
6895+
* ---
6896+
* Generate a straight line path to include in the d attribute of a svg path element
6897+
* ___
6898+
* @example
6899+
* const path = createStraightPath([{x: 1, y: 1}, { x: 2, y: 1.2}])
6900+
*
6901+
* @param points - An array of point objects
6902+
*/
6903+
export const createStraightPath: (points: Point[]) => string
6904+
6905+
/**
6906+
* Vue Data UI utility
6907+
* ---
6908+
* Generate a spline path to include in the d attribute of a svg path element
6909+
* ___
6910+
* @example
6911+
* const path = createSmoothPath([{x: 1, y: 1}, { x: 2, y: 1.2}, { x: 3, y: 0.2 }])
6912+
*
6913+
* @param points - An array of point objects
6914+
*/
6915+
export const createSmoothPath: (points: Point[]) => string
6916+
6917+
68816918
/**
68826919
* Vue Data UI utility
68836920
* ---

0 commit comments

Comments
 (0)