@d0rich/esprit-design 0.2.2 → 0.3.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/CHANGELOG.md +42 -0
- package/dist/components/DChip.vue.d.ts +1 -1
- package/dist/components/DPagination.vue.d.ts +2 -2
- package/dist/components/DStats.vue.d.ts +1 -1
- package/dist/components/animations/DAnimationAccordion.vue.d.ts +2 -2
- package/dist/components/animations/DAnimationDefLetterD.vue.d.ts +1 -1
- package/dist/components/animations/DAnimationFloatingLetter.vue.d.ts +2 -2
- package/dist/components/animations/DAnimationHypnosis.vue.d.ts +2 -2
- package/dist/components/animations/DAnimationSpinner.vue.d.ts +2 -2
- package/dist/components/animations/index.d.ts +5 -4
- package/dist/components/buttons/DBigBangButton.vue.d.ts +3 -3
- package/dist/components/buttons/DBigBangButtonAnimation.vue.d.ts +1 -1
- package/dist/components/buttons/DBtn.vue.d.ts +4 -3
- package/dist/components/buttons/index.d.ts +4 -3
- package/dist/components/cards/DCard.vue.d.ts +2 -2
- package/dist/components/cards/DCardTitle.vue.d.ts +1 -1
- package/dist/components/cards/index.d.ts +3 -2
- package/dist/components/content/DAlert.vue.d.ts +2 -2
- package/dist/components/content/DQuote.vue.d.ts +2 -2
- package/dist/components/content/index.d.ts +3 -2
- package/dist/components/index.d.ts +4 -3
- package/dist/components/lists/DActionsFan.vue.d.ts +5 -4
- package/dist/components/lists/DActionsList.vue.d.ts +5 -4
- package/dist/components/lists/index.d.ts +3 -2
- package/dist/components/utils/DWrapBackground.vue.d.ts +4 -3
- package/dist/components/utils/DWrapFocusHighlight.vue.d.ts +2 -2
- package/dist/components/utils/DWrapShape.vue.d.ts +8 -7
- package/dist/components/utils/index.d.ts +4 -3
- package/dist/composables/big-bang-button-utils.d.ts +1 -1
- package/dist/composables/router.d.ts +9 -6
- package/dist/composables/utils.d.ts +1 -0
- package/dist/esprit-design.js +1380 -1344
- package/dist/esprit-design.umd.cjs +13 -13
- package/dist/style.css +1 -1
- package/dist/utils/boundings.d.ts +2 -1
- package/index.html +14 -0
- package/package.json +9 -13
- package/plugins/shadows.js +87 -0
- package/src/components/DChip.vue +32 -0
- package/src/components/DPagination.vue +91 -0
- package/src/components/DStats.vue +514 -0
- package/src/components/animations/DAnimationAccordion.vue +103 -0
- package/src/components/animations/DAnimationDefLetterD.vue +11 -0
- package/src/components/animations/DAnimationFloatingLetter.vue +58 -0
- package/src/components/animations/DAnimationHypnosis.vue +102 -0
- package/src/components/animations/DAnimationSpinner.vue +114 -0
- package/src/components/animations/index.ts +11 -0
- package/src/components/buttons/DBigBangButton.vue +70 -0
- package/src/components/buttons/DBigBangButtonAnimation.vue +117 -0
- package/src/components/buttons/DBtn.vue +107 -0
- package/src/components/buttons/index.ts +5 -0
- package/src/components/cards/DCard.vue +98 -0
- package/src/components/cards/DCardTitle.vue +67 -0
- package/src/components/cards/index.ts +4 -0
- package/src/components/content/DAlert.vue +112 -0
- package/src/components/content/DQuote.vue +71 -0
- package/src/components/content/index.ts +4 -0
- package/src/components/index.ts +12 -0
- package/src/components/lists/DActionsFan.vue +153 -0
- package/src/components/lists/DActionsList.vue +100 -0
- package/src/components/lists/index.ts +4 -0
- package/src/components/utils/DWrapBackground.vue +76 -0
- package/src/components/utils/DWrapFocusHighlight.vue +241 -0
- package/src/components/utils/DWrapShape.vue +170 -0
- package/src/components/utils/index.ts +7 -0
- package/src/composables/big-bang-button-utils.ts +7 -0
- package/src/composables/index.ts +2 -0
- package/src/composables/router.ts +81 -0
- package/src/composables/utils.ts +5 -0
- package/src/index.ts +3 -0
- package/src/style.css +3 -0
- package/src/utils/boundings.ts +35 -0
- package/src/utils/index.ts +3 -0
- package/src/utils/pagination.ts +4 -0
- package/src/utils/polygon-animation.ts +139 -0
- package/src/vite-env.d.ts +1 -0
- package/tailwind.config.js +22 -0
- package/tsconfig.json +25 -0
- package/tsconfig.node.json +10 -0
- package/vite.config.ts +35 -0
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Representation of point coordinates.
|
|
3
|
+
*/
|
|
4
|
+
export type Coords = {
|
|
5
|
+
x: number
|
|
6
|
+
y: number
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Representation of line edge, where right and left points
|
|
11
|
+
* are on the opposite sides of the same corner.
|
|
12
|
+
*/
|
|
13
|
+
export type LineEdge = {
|
|
14
|
+
right: Coords
|
|
15
|
+
left: Coords
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
*
|
|
20
|
+
* Generate sets of keyframes for each point on line polygon
|
|
21
|
+
*
|
|
22
|
+
* @param line
|
|
23
|
+
* @returns Sets of keyframes for each polygon point
|
|
24
|
+
*/
|
|
25
|
+
export function generatePolygonLineKeyframes(line: LineEdge[]): Coords[][] {
|
|
26
|
+
return line.map((_, index, edges) => {
|
|
27
|
+
const leftPoints = edges.reduce((points, edge, currentIndex) => {
|
|
28
|
+
if (currentIndex > index) {
|
|
29
|
+
points.push(points.at(-1) as Coords)
|
|
30
|
+
} else {
|
|
31
|
+
points.push(edge.left)
|
|
32
|
+
}
|
|
33
|
+
return points
|
|
34
|
+
}, [] as Coords[])
|
|
35
|
+
const rightPoints = edges.reduce((points, edge, currentIndex) => {
|
|
36
|
+
if (currentIndex > index) {
|
|
37
|
+
points.push(points.at(-1) as Coords)
|
|
38
|
+
} else {
|
|
39
|
+
points.push(edge.right)
|
|
40
|
+
}
|
|
41
|
+
return points
|
|
42
|
+
}, [] as Coords[])
|
|
43
|
+
return [...rightPoints, ...leftPoints.reverse()]
|
|
44
|
+
})
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
*
|
|
49
|
+
* Generate 1 set of keyframes for the whole line polygon.
|
|
50
|
+
*
|
|
51
|
+
* @param line
|
|
52
|
+
* @returns Set of keyframes for the whole line polygon
|
|
53
|
+
*/
|
|
54
|
+
export function generatePolygonPointsKeyframes(line: LineEdge[]): Coords[][] {
|
|
55
|
+
const lineKfs = generatePolygonLineKeyframes(line)
|
|
56
|
+
const keyframesCount = lineKfs.length
|
|
57
|
+
const pointsCount = lineKfs[0].length
|
|
58
|
+
const result: Coords[][] = []
|
|
59
|
+
for (let i = 0; i < pointsCount; i++) {
|
|
60
|
+
const pointKfs: Coords[] = []
|
|
61
|
+
for (let k = 0; k < keyframesCount; k++) {
|
|
62
|
+
pointKfs.push(lineKfs[k][i])
|
|
63
|
+
}
|
|
64
|
+
result.push(pointKfs)
|
|
65
|
+
}
|
|
66
|
+
return result
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
*
|
|
71
|
+
* Apply animation to each point of line.
|
|
72
|
+
*
|
|
73
|
+
* @param line Declarative line description
|
|
74
|
+
* @param svgContainer <svg> element which line all figures
|
|
75
|
+
* @param svgPolygon <polygon> element in svg image which will be animated line
|
|
76
|
+
* @param animationCallback apply keyframes to specific points inside callback
|
|
77
|
+
*/
|
|
78
|
+
export function applyLinePerPointAnimation(
|
|
79
|
+
line: LineEdge[],
|
|
80
|
+
svgContainer: SVGSVGElement,
|
|
81
|
+
svgPolygon: SVGPolygonElement,
|
|
82
|
+
animationCallback: (point: DOMPoint, keyframes: Coords[]) => void
|
|
83
|
+
) {
|
|
84
|
+
const allPointsKeyframes = generatePolygonPointsKeyframes(line)
|
|
85
|
+
for (const pointKeyframes of allPointsKeyframes) {
|
|
86
|
+
const point = svgContainer.createSVGPoint()
|
|
87
|
+
svgPolygon.points.appendItem(point)
|
|
88
|
+
animationCallback(point, pointKeyframes)
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
*
|
|
94
|
+
* Apply last state to polygon.
|
|
95
|
+
*
|
|
96
|
+
* @param line Declarative line description
|
|
97
|
+
* @param svgContainer <svg> element which line all figures
|
|
98
|
+
* @param svgPolygon <polygon> element in svg image which will be line
|
|
99
|
+
*/
|
|
100
|
+
export function applyStaticPoints(
|
|
101
|
+
line: LineEdge[],
|
|
102
|
+
svgContainer: SVGSVGElement,
|
|
103
|
+
svgPolygon: SVGPolygonElement
|
|
104
|
+
) {
|
|
105
|
+
const finalLineState = generatePolygonLineKeyframes(line).at(-1)
|
|
106
|
+
if (!finalLineState) return
|
|
107
|
+
for (const pointCoords of finalLineState) {
|
|
108
|
+
const point = svgContainer.createSVGPoint()
|
|
109
|
+
point.x = pointCoords.x
|
|
110
|
+
point.y = pointCoords.y
|
|
111
|
+
svgPolygon.points.appendItem(point)
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
export function createCoordsFromArray(coordsAsArray: number[]): Coords {
|
|
116
|
+
if (coordsAsArray.length !== 2)
|
|
117
|
+
throw new Error(
|
|
118
|
+
'Array should contain 2 numbers in order to be translated into coords'
|
|
119
|
+
)
|
|
120
|
+
return {
|
|
121
|
+
x: coordsAsArray[0],
|
|
122
|
+
y: coordsAsArray[1]
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
export function createLineEdgeFromArray(edgeAsArray: number[][]): LineEdge {
|
|
127
|
+
if (edgeAsArray.length !== 2)
|
|
128
|
+
throw new Error(
|
|
129
|
+
'Array should contain 2 elements in order to be translated into LineEdge'
|
|
130
|
+
)
|
|
131
|
+
return {
|
|
132
|
+
left: createCoordsFromArray(edgeAsArray[0]),
|
|
133
|
+
right: createCoordsFromArray(edgeAsArray[1])
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
export function createLineFromArray(lineAsArray: number[][][]): LineEdge[] {
|
|
138
|
+
return lineAsArray.map(createLineEdgeFromArray)
|
|
139
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/// <reference types="vite/client" />
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-var-requires */
|
|
2
|
+
const defaultTheme = require('tailwindcss/defaultTheme')
|
|
3
|
+
|
|
4
|
+
/** @type {import('tailwindcss').Config} */
|
|
5
|
+
module.exports = {
|
|
6
|
+
darkMode: 'class',
|
|
7
|
+
content: ['./src/**/*.{vue,js,ts,jsx,tsx}'],
|
|
8
|
+
theme: {
|
|
9
|
+
fontFamily: {
|
|
10
|
+
sans: ['Roboto', ...defaultTheme.fontFamily.sans],
|
|
11
|
+
serif: ['"Roboto Slab"', ...defaultTheme.fontFamily.sans],
|
|
12
|
+
mono: ['"JetBrains Mono"', ...defaultTheme.fontFamily.mono],
|
|
13
|
+
dialog: ['Arsenal']
|
|
14
|
+
},
|
|
15
|
+
extend: {
|
|
16
|
+
screens: {
|
|
17
|
+
print: { raw: 'print' }
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
plugins: [require('./plugins/shadows')]
|
|
22
|
+
}
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2020",
|
|
4
|
+
"useDefineForClassFields": true,
|
|
5
|
+
"module": "ESNext",
|
|
6
|
+
"lib": ["ES2020", "DOM", "DOM.Iterable"],
|
|
7
|
+
"skipLibCheck": true,
|
|
8
|
+
|
|
9
|
+
/* Bundler mode */
|
|
10
|
+
"moduleResolution": "bundler",
|
|
11
|
+
"resolveJsonModule": true,
|
|
12
|
+
"isolatedModules": true,
|
|
13
|
+
"jsx": "preserve",
|
|
14
|
+
"outDir": "dist",
|
|
15
|
+
"declaration": true,
|
|
16
|
+
|
|
17
|
+
/* Linting */
|
|
18
|
+
"strict": true,
|
|
19
|
+
"noUnusedLocals": true,
|
|
20
|
+
"noUnusedParameters": true,
|
|
21
|
+
"noFallthroughCasesInSwitch": true
|
|
22
|
+
},
|
|
23
|
+
"include": ["src/**/*.ts", "src/**/*.d.ts", "src/**/*.tsx", "src/**/*.vue"],
|
|
24
|
+
"references": [{ "path": "./tsconfig.node.json" }]
|
|
25
|
+
}
|
package/vite.config.ts
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { resolve } from 'path'
|
|
2
|
+
import { defineConfig, splitVendorChunkPlugin } from 'vite'
|
|
3
|
+
import dts from 'vite-plugin-dts'
|
|
4
|
+
import vue from '@vitejs/plugin-vue'
|
|
5
|
+
|
|
6
|
+
// https://vitejs.dev/config/
|
|
7
|
+
export default defineConfig({
|
|
8
|
+
plugins: [
|
|
9
|
+
vue(),
|
|
10
|
+
splitVendorChunkPlugin(),
|
|
11
|
+
dts({
|
|
12
|
+
insertTypesEntry: true
|
|
13
|
+
})
|
|
14
|
+
],
|
|
15
|
+
build: {
|
|
16
|
+
lib: {
|
|
17
|
+
// src/indext.ts is where we have exported the component(s)
|
|
18
|
+
entry: resolve(__dirname, 'src'),
|
|
19
|
+
name: 'EspritDesign',
|
|
20
|
+
fileName: 'esprit-design'
|
|
21
|
+
},
|
|
22
|
+
rollupOptions: {
|
|
23
|
+
// make sure to externalize deps that shouldn't be bundled
|
|
24
|
+
// into your library
|
|
25
|
+
external: ['vue'],
|
|
26
|
+
output: {
|
|
27
|
+
// Provide global variables to use in the UMD build
|
|
28
|
+
// for externalized deps
|
|
29
|
+
globals: {
|
|
30
|
+
vue: 'Vue'
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
})
|