@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.
Files changed (80) hide show
  1. package/CHANGELOG.md +42 -0
  2. package/dist/components/DChip.vue.d.ts +1 -1
  3. package/dist/components/DPagination.vue.d.ts +2 -2
  4. package/dist/components/DStats.vue.d.ts +1 -1
  5. package/dist/components/animations/DAnimationAccordion.vue.d.ts +2 -2
  6. package/dist/components/animations/DAnimationDefLetterD.vue.d.ts +1 -1
  7. package/dist/components/animations/DAnimationFloatingLetter.vue.d.ts +2 -2
  8. package/dist/components/animations/DAnimationHypnosis.vue.d.ts +2 -2
  9. package/dist/components/animations/DAnimationSpinner.vue.d.ts +2 -2
  10. package/dist/components/animations/index.d.ts +5 -4
  11. package/dist/components/buttons/DBigBangButton.vue.d.ts +3 -3
  12. package/dist/components/buttons/DBigBangButtonAnimation.vue.d.ts +1 -1
  13. package/dist/components/buttons/DBtn.vue.d.ts +4 -3
  14. package/dist/components/buttons/index.d.ts +4 -3
  15. package/dist/components/cards/DCard.vue.d.ts +2 -2
  16. package/dist/components/cards/DCardTitle.vue.d.ts +1 -1
  17. package/dist/components/cards/index.d.ts +3 -2
  18. package/dist/components/content/DAlert.vue.d.ts +2 -2
  19. package/dist/components/content/DQuote.vue.d.ts +2 -2
  20. package/dist/components/content/index.d.ts +3 -2
  21. package/dist/components/index.d.ts +4 -3
  22. package/dist/components/lists/DActionsFan.vue.d.ts +5 -4
  23. package/dist/components/lists/DActionsList.vue.d.ts +5 -4
  24. package/dist/components/lists/index.d.ts +3 -2
  25. package/dist/components/utils/DWrapBackground.vue.d.ts +4 -3
  26. package/dist/components/utils/DWrapFocusHighlight.vue.d.ts +2 -2
  27. package/dist/components/utils/DWrapShape.vue.d.ts +8 -7
  28. package/dist/components/utils/index.d.ts +4 -3
  29. package/dist/composables/big-bang-button-utils.d.ts +1 -1
  30. package/dist/composables/router.d.ts +9 -6
  31. package/dist/composables/utils.d.ts +1 -0
  32. package/dist/esprit-design.js +1380 -1344
  33. package/dist/esprit-design.umd.cjs +13 -13
  34. package/dist/style.css +1 -1
  35. package/dist/utils/boundings.d.ts +2 -1
  36. package/index.html +14 -0
  37. package/package.json +9 -13
  38. package/plugins/shadows.js +87 -0
  39. package/src/components/DChip.vue +32 -0
  40. package/src/components/DPagination.vue +91 -0
  41. package/src/components/DStats.vue +514 -0
  42. package/src/components/animations/DAnimationAccordion.vue +103 -0
  43. package/src/components/animations/DAnimationDefLetterD.vue +11 -0
  44. package/src/components/animations/DAnimationFloatingLetter.vue +58 -0
  45. package/src/components/animations/DAnimationHypnosis.vue +102 -0
  46. package/src/components/animations/DAnimationSpinner.vue +114 -0
  47. package/src/components/animations/index.ts +11 -0
  48. package/src/components/buttons/DBigBangButton.vue +70 -0
  49. package/src/components/buttons/DBigBangButtonAnimation.vue +117 -0
  50. package/src/components/buttons/DBtn.vue +107 -0
  51. package/src/components/buttons/index.ts +5 -0
  52. package/src/components/cards/DCard.vue +98 -0
  53. package/src/components/cards/DCardTitle.vue +67 -0
  54. package/src/components/cards/index.ts +4 -0
  55. package/src/components/content/DAlert.vue +112 -0
  56. package/src/components/content/DQuote.vue +71 -0
  57. package/src/components/content/index.ts +4 -0
  58. package/src/components/index.ts +12 -0
  59. package/src/components/lists/DActionsFan.vue +153 -0
  60. package/src/components/lists/DActionsList.vue +100 -0
  61. package/src/components/lists/index.ts +4 -0
  62. package/src/components/utils/DWrapBackground.vue +76 -0
  63. package/src/components/utils/DWrapFocusHighlight.vue +241 -0
  64. package/src/components/utils/DWrapShape.vue +170 -0
  65. package/src/components/utils/index.ts +7 -0
  66. package/src/composables/big-bang-button-utils.ts +7 -0
  67. package/src/composables/index.ts +2 -0
  68. package/src/composables/router.ts +81 -0
  69. package/src/composables/utils.ts +5 -0
  70. package/src/index.ts +3 -0
  71. package/src/style.css +3 -0
  72. package/src/utils/boundings.ts +35 -0
  73. package/src/utils/index.ts +3 -0
  74. package/src/utils/pagination.ts +4 -0
  75. package/src/utils/polygon-animation.ts +139 -0
  76. package/src/vite-env.d.ts +1 -0
  77. package/tailwind.config.js +22 -0
  78. package/tsconfig.json +25 -0
  79. package/tsconfig.node.json +10 -0
  80. 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
+ }
@@ -0,0 +1,10 @@
1
+ {
2
+ "compilerOptions": {
3
+ "composite": true,
4
+ "skipLibCheck": true,
5
+ "module": "ESNext",
6
+ "moduleResolution": "bundler",
7
+ "allowSyntheticDefaultImports": true
8
+ },
9
+ "include": ["vite.config.ts"]
10
+ }
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
+ })